diff --git a/CLAUDE.md b/CLAUDE.md index 2d557ed..4ddcdd6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,13 +4,32 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project -`bggpipe` — a resumable, idempotent CLI pipeline: shelf photos → Claude vision title + edition-cue extraction → BoardGameGeek ID and version matching → human review → collection diff → upload to BGG via Playwright → metadata enrichment (`games.json`). Full design: @bgg-shelf-pipeline-spec.md. **The repo is greenfield — no code exists yet.** Follow the spec's "Suggested Build Order" when scaffolding; re-run `/init` once code exists. +`bggpipe` — a resumable, idempotent CLI pipeline that turns shelf photos into a BoardGameGeek collection, in six stages: -## Stack (decided, not yet scaffolded) +| # | Command | What it does | Status | +|---|---------|--------------|--------| +| 1 | `bggpipe extract` | Claude vision reads titles + edition cues from `photos/` | working | +| 2 | `bggpipe resolve` | match titles to BGG IDs and versions via XML API2 | working (stub data — see hard rules) | +| 3 | `bggpipe review` | human review of ambiguous/unmatched items; `--web` serves a FastAPI UI on port 8377 | working | +| 4 | `bggpipe diff` | diff approved matches against the existing BGG collection | working | +| 5 | `bggpipe upload` | add games via a logged-in Playwright session | **not built** — CLI stub exits 1; Playwright not yet a dependency | +| 6 | `bggpipe enrich` | fetch full game/version metadata into `games.json` | working | -- Python 3.12+, deps via **uv** (`uv add`, `uv run`), CLI framework **typer**, tests **pytest**, lint/format **ruff**. -- Browser automation: **Playwright** (not Selenium). Needs `uv run playwright install chromium` after install. -- Vision: Anthropic API, latest Sonnet model. +Full design lives in `bgg-shelf-pipeline-spec.md` (read it before changing pipeline semantics); the upload-stage walkthrough is in `docs/bgg-upload-flow.md`. + +## Commands + +- `uv sync` — install deps (Python 3.12+, managed by **uv**; use `uv add`, never pip). +- `uv run bggpipe ` — run a pipeline stage. Non-secret settings come from `config.toml` (username, dirs, vision model, rate limit); `--config` overrides the path. +- `uv run pytest` — 105 tests, all offline against fixtures. Tests marked `live` hit the real BGG API (read-only) and are skipped unless you pass `--run-live`. +- `uv run ruff check` / `uv run ruff format` — lint (rules E, F, I, UP, B, SIM) and format. + +## Layout + +- `src/bggpipe/` — `cli.py` (typer app), one module per stage (`extract`, `resolve`, `review` + `webreview`, `diff`, `enrich`), plus `bgg_client.py` (rate-limited XML API2 client that caches responses to `data/bgg_cache/`), `normalize.py` (title normalization), `models.py` (dataclasses), `config.py`. +- `scripts/` — `write_stub_fixtures.py` / `write_photo_fixtures.py` generate synthetic fixtures; `record_fixtures.py` re-records real API responses once a token exists. +- `tests/fixtures/bgg_cache/` — stub XML fixtures the offline tests run against. +- `data/` — pipeline state (CSV/JSON artifacts are committed; caches are not — see Git). ## Hard rules (from spec — never violate) @@ -31,5 +50,5 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Git -- Remote is self-hosted Gitea 1.26 (`git.kestrelsnest.social`), **not GitHub** — `gh` CLI does not work here. -- Commit `data/matches.csv`, `data/to_add.csv`, `data/upload_log.csv`, `data/titles.json`, `data/unidentified.json`, `data/games.json`. Never commit `data/bgg_cache/`, `photos/`, Playwright storage state, or `.env`. +- Remote is self-hosted Gitea 1.26 (`git.kestrelsnest.social/eric/bggpipe`), **not GitHub** — `gh` CLI does not work here. +- Commit `data/matches.csv`, `data/to_add.csv`, `data/to_update.csv`, `data/upload_log.csv`, `data/titles.json`, `data/unidentified.json`, `data/unidentified_dismissed.json`, `data/games.json`, and the collection snapshot XMLs. Never commit `data/bgg_cache/`, `data/extract_raw/`, `photos/`, Playwright storage state, or `.env`.