Metadata-Version: 2.4
Name: pricegraph-cli
Version: 0.1.0
Summary: Official PriceGraph UK command-line interface for product discovery and price comparison
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: typer<1.0.0,>=0.12.0
Requires-Dist: httpx<1.0.0,>=0.27.0
Requires-Dist: rich<16.0.0,>=13.7.0
Provides-Extra: dev
Requires-Dist: pytest<10.0.0,>=8.0.0; extra == "dev"

# PriceGraph CLI (`pricegraph-cli`)

Official, lightweight, read-only command-line interface for **PriceGraph UK** (`https://www.pricegraph.co.uk`).

## Installation (Once Published)

```bash
pipx install pricegraph-cli
```

## Local Development Install

```bash
pip install --no-deps --no-build-isolation -e ./cli
pricegraph --help
```

## Uninstall

```bash
pip uninstall -y pricegraph-cli
```

## Commands

| Command | Description | Example |
|---|---|---|
| `search` | Search UK retail products | `pricegraph search "sony wh1000xm5" --limit 5` |
| `compare` | Compare live UK offers by GTIN or query | `pricegraph compare 4548736132566` |
| `resolve` | Resolve Brand + MPN to canonical GTIN | `pricegraph resolve --brand Sony --mpn WH1000XM5` |
| `batch` | Batch-compare up to 10 GTINs (args or `--stdin`) | `pricegraph batch 4548736132566 5036108314256` |
| `categories` | List canonical UK retail categories | `pricegraph categories --published-only` |
| `merchants` | List participating UK retail merchants | `pricegraph merchants --q laptop` |
| `deals` | List current verified UK retail deals | `pricegraph deals --limit 10` |
| `open` | Explicitly open a validated `/product/<slug>` page | `pricegraph open 1` or `pricegraph open 4548736132566 --dry-run` |
| `version` | Show CLI version (offline by default; `--remote` checks API) | `pricegraph version --json` |

## Machine Output & Exit Codes

* `--json` and `--csv` write strictly to `stdout` (no banners or spinners); errors and warnings write to `stderr`.
* CSV output neutralizes spreadsheet formula prefixes (`=`, `+`, `-`, `@`, `\t`, `\r`).
* Exit codes: `0` OK, `2` invalid input, `3` not found (`404`), `4` restricted (`401`/`402`/`403`), `5` rate-limited/unavailable (`429`/`503`), `6` transport/malformed response.

## Privacy & Commercial Model

* **No affiliate links or redirects:** The CLI never contains affiliate URLs, sets affiliate cookies, or opens `/go/*` endpoints. `pricegraph open` launches only validated first-party `https://www.pricegraph.co.uk/product/<slug>?utm_source=cli` pages (`--no-utm` omits `utm_source=cli`).
* **Minimal, opt-out telemetry:** By default, requests send `User-Agent: pricegraph-cli/<version>` and `X-PriceGraph-Client: cli/<version>`. Set `PRICEGRAPH_NO_TELEMETRY=1` (or `PRICEGRAPH_TELEMETRY=0`) to omit `X-PriceGraph-Client` and use a generic `User-Agent`.
* **No persistent catalogue cache:** Only short-TTL (`15m`) product page references for numbered `pricegraph open <n>` are stored locally (`~/.cache/pricegraph-cli/recent_refs.json`).
