Skip to content

feat: add recipes list/show command group (CU-868k0t6gb) - #9

Merged
obitum merged 2 commits into
mainfrom
feat/recipes
Jun 22, 2026
Merged

feat: add recipes list/show command group (CU-868k0t6gb)#9
obitum merged 2 commits into
mainfrom
feat/recipes

Conversation

@obitum

@obitum obitum commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

A4 — Recipes command group

Adds recipes list and recipes show <id>, the read-side CLI for A4/Recipes (backend CU-868k0t6g6) under the A7 CLI umbrella (CU-868k0t6gb).

A recipe is the bill of materials (formulation) for a product or variation — the materials and quantities consumed per batch, with cost/COGS rollups.

What's here

  • recipes list — paginated table: ID, PRODUCT, NAME, VARIATION, BATCH, INGR, UNIT COST, UNIT COGS. Filters: --product-id, --variation-id, --updated-since (incremental sync), plus the universal --all / --page / --per-page / --json / --ndjson.
  • recipes show <id> — vertical key-value detail (incl. all six cost / labour / COGS rollups) followed by an INGREDIENTS sub-table (material / qty / unit).

Design decisions

  • Per-unit cost lens in the list (unit_cost + unit_cogs) — the per-unit COGS is the number makers price against.
  • Human names with id fallbackproduct_name / variation_name / material_name, falling back to the id when null (recipes expose names that manufactures did not).

Architecture

Zero shared-core changes. Consumes the existing resourceConfig + pluggable listFilters seam built in A5 — this PR is one new commands/recipes.go mirroring commands/manufactures.go, plus the root-help row, the regenerated help golden, and the regenerated command-reference docs.

Constraints upheld

  • Money stays a {amount, currency_code} string pair (*output.Money); gated/null renders , never a float.
  • No internal model-name leak — only product_id / material_id surface (the contract test asserts project_id / item_id are absent).
  • 3-group goimports; go test ./... -race, go vet ./..., gofmt clean.

Testing

  • Unit tests for filters, table (incl. gated costs, name/id fallback, malformed-skip), show (detail, empty ingredients, gated dashes), and the nameOrID / variationRef helpers.
  • A recipes fixture contract check (envelope key, money shape, no internal-name leak).
  • Root-help golden + gen-docs reference regenerated and in sync (site-CI).

🤖 Generated with Claude Code

obitum and others added 2 commits June 22, 2026 21:04
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@obitum
obitum merged commit 0660c2f into main Jun 22, 2026
3 checks passed
@obitum
obitum deleted the feat/recipes branch June 22, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant