feat: add products & components command groups (CU-868k0t6gb) - #1
Merged
Conversation
…t6gb) Replace hardcoded "Craftybase"/"craftybase"/docs URL in the root help screen with brand.ProductName, brand.BinaryName, and a new brand.DocsURL so the planned Stocksmith rebrand stays a contained change. Output is byte-identical (golden + suite unchanged). The ASCII wordmark is noted as the one inherent rebrand touch-point that cannot be centralized. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…unt (CU-868k0t6gb)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Implement products command group with HTTP list/show runners, matching materials architecture. Adds projectResource factory pattern, projectListFlags for list filtering (sku, name, category, state, page, per-page, all), and runProjectList/runProjectShow handlers with JSON/NDJSON/table branching. Include contract tests locking API envelope shape, money format, and param mapping (--category → category_name). Update root help coverage invariant. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds read-only
productsandcomponentscommand groups to the CLI — the CLI side of API Story A3 (Products/Components read). Both resources share the same API shape (Projectrecords distinguished byoutput_type), so they share a single core (commands/projects.go); the two registration files are thin.craftybase products list/craftybase products show <id>craftybase components list/craftybase components show <id>listcolumns:ID · NAME · SKU · CATEGORY · VARIANTS · ON HAND · AVAILABLE · UNIT PRICE.showaddsSTATEand aVARIATIONS (n)sub-table (ID · SKU · ATTRIBUTES · ON HAND · AVAILABLE · UNIT PRICE · DEFAULT), with aNo active variations.empty state.--json/--ndjsoncarry the full nested variations;unit_priceis financial-gated (renders—in tables, omitted in JSON for view-only keys). Filters mirrormaterials:--sku,--name,--category→category_name,--state, plus--page/--per-page/--all/--ndjson.PRD & plan live in the vault:
CU-868k0t6gb/prd-products-components.md,plan-products-components.md.Commits
b33b5cdfix: align table columns under color — dropstext/tabwriter, which counted ANSI escape bytes as visible width and misaligned colored headers. Separable bugfix bundled here (the products/components tables render throughFormatTable); happy to split into its own PR if preferred.f531790fix: readcurrent_pagefrom the list meta envelope (was reading the non-existentpagekey)bc2cd2efeat: project/variation models + table/show renderers (pure, unit-tested)b34fb36feat: products list/show command group99a194ffeat: components list/show command groupTesting
go test ./... -racegreen,go vet ./...clean, gofmt/goimports clean on all changed files.category,variationsarray,current_page, noprojectsleak); the root-help command-coverage invariant; branded-help golden regenerated (+products, +components lines).Follow-ups (not blocking — tracked for a separate ticket)
materialsonto the shared core before A4/Recipes lands to avoid a third clone of the list/show flow; consider renaming the core to a resource-neutral symbol.--json --allcurrently falls through to the table render (latent inmaterialstoo) — decide between erroring or emitting a JSON array.Ticket: CU-868k0t6gb (Story A7 of the Public API epic).
🤖 Generated with Claude Code