Metadata-Version: 2.4
Name: earlyforge-cli
Version: 0.1.2
Summary: Command-line client for the EarlyForge Trends API: emerging trends from the editorial intelligence platform (free Pulse mirror and full trends feed)
Author: EarlyForge
License: MIT
Project-URL: Homepage, https://earlyforge.ai
Project-URL: Documentation, https://docs.earlyforge.ai/guides/api/trends-api
Project-URL: Source, https://github.com/Earlyforge-official/earlyforge
Keywords: earlyforge,trends,trend-detection,emerging-trends,news,newsroom,journalism,editorial-intelligence,cli
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: click>=8.1.0
Requires-Dist: httpx>=0.27.0

# earlyforge-cli

EarlyForge is an AI-powered editorial intelligence platform that detects emerging trends across thousands of sources in 50 countries and turns them into original, sourced articles. This package gives you its trend data from code: see [earlyforge.ai/developers](https://earlyforge.ai/developers).

Command-line client for the **EarlyForge Trends API**, with two tiers
under the same `/v1/api/trends/*` prefix:

- **Pulse mirror** (`pulse top|region|category|trend`) — free on every
  account, no plan required. The same daily snapshot already shown on
  [earlyforge.ai/pulse](https://earlyforge.ai/pulse).
- **Full trends feed** (`pulse full`/`pulse full-trend`) — every plan,
  including free, and **not "all trends unlocked."** Every plan reveals a
  daily, random, category-diversified budget of trend names (bigger on
  paid plans) — exactly what your organization's dashboard Trends page
  shows unlocked today, no more, no less.

Not a CLI for articles, briefs, or alerts — the public API never exposes
those on any plan. Full reference: [docs.earlyforge.ai/guides/api/cli](https://docs.earlyforge.ai/guides/api/cli). Source: [github.com/Earlyforge-official/earlyforge](https://github.com/Earlyforge-official/earlyforge/tree/main/cli-earlyforge).

## Install

Not published yet. Contact [support@earlyforge.ai](mailto:support@earlyforge.ai) for early access.

## Configure

```bash
export EARLYFORGE_API_KEY=ef_live_xxxxxxxxxxxxxxxx
```

Get a key from **Settings → API Keys** in the EarlyForge console. Or pass
`--api-key` on each command instead of the env var.

## Commands

```bash
earlyforge pulse top [--date YYYY-MM-DD]
earlyforge pulse region <REGION> [--date YYYY-MM-DD]
earlyforge pulse category <CATEGORY> [--date YYYY-MM-DD]
earlyforge pulse trend <TREND_ID>
earlyforge pulse full [--region US] [--category tech] [--page 1] [--limit 20]
earlyforge pulse full-trend <TREND_ID>
```

Every command pretty-prints the JSON response and accepts `--api-key` and
`--base-url` (default `https://api.earlyforge.ai`, useful for pointing at
a local gateway in development).

`pulse full` and `pulse full-trend` work on every plan, including free.
They are **not** "all trends unlocked": every plan only reveals a daily,
random, category-diversified budget of trend names (bigger on paid
plans), same as the dashboard's Trends page. A trend outside that budget
stays in the list with its name redacted (`"name_locked": true`) for
`pulse full`, or returns HTTP 402 for `pulse full-trend`.

### Examples

```bash
earlyforge pulse top
earlyforge pulse top --date 2026-11-01
earlyforge pulse region US
earlyforge pulse category politics
earlyforge pulse trend tr_a1b2c3
earlyforge pulse full --region US --limit 50
earlyforge pulse full-trend tr_a1b2c3
```

## Errors

A non-2xx response prints `Error: ... (<detail>)` to stderr and exits
with status `1` — the same `401` invalid-key / `404` unknown-trend /
`502` upstream-unavailable cases documented in the OpenAPI spec, plus
`402` (`trend_locked` on `pulse full-trend` for a trend outside today's
budget).

## Rate limits

No monthly call quota on this surface — only the shared 60 requests/60s
burst limit applies, same as the anonymous Pulse page.

## Tests

```bash
pip install -e . pytest
pytest
```
