Skip to content

feat(inventory): add cy inventory outputs and resources commands#469

Merged
fhacloid merged 1 commit into
developfrom
feat/cli-inventory-commands
Jul 1, 2026
Merged

feat(inventory): add cy inventory outputs and resources commands#469
fhacloid merged 1 commit into
developfrom
feat/cli-inventory-commands

Conversation

@fhacloid

Copy link
Copy Markdown
Contributor

What

Adds a discoverable cy inventory command tree to browse the Terraform state inventory (backend Organization Inventory endpoints):

  • cy inventory outputs list — list Terraform state outputs
  • cy inventory outputs get <key> — print a single output value (raw, scriptable; -o json for the full object)
  • cy inventory resources list — list tracked resources

The middleware (ListInventoryOutputs / ListInventoryResources) already existed and was wired into the Middleware interface; this PR adds the missing user-facing command layer.

Details

  • Scoping: --project / --env / --component via the shared cyargs flags (-p/-e/-c, CY_* env support).
  • Filters: curated per-resource flags (--key, --type, --pinned, --provider, --module, …) plus a generic repeatable --filter 'attribute[condition]=value'.
  • The generic LHS filter flag is added to internal/cyargs (AddLHSFilterFlag / GetLHSFilters) so any List command can reuse it.
  • outputs get defaults to the existing field printer for the raw value, overridable with -o json|yaml|jq=<expr>.

Tests

  • internal/cyargs/filters_test.go — LHS filter parsing (valid + malformed).
  • e2e/inventory_test.go — command wiring + filter pass-through (outputs/resources come from TF state and can't be created in tests, so this mirrors the middleware LHS discovery test).

🤖 Generated with Claude Code

@fhacloid fhacloid requested a review from gaelL June 30, 2026 13:09
@fhacloid fhacloid force-pushed the feat/cli-inventory-commands branch from 0a8a702 to 7046cfc Compare June 30, 2026 13:10
Add a discoverable command tree to browse the Terraform state inventory:

  cy inventory outputs list   — list state outputs
  cy inventory outputs get    — print a single output value (scriptable)
  cy inventory resources list — list tracked resources

Commands support project/environment/component scoping via the shared
cyargs flags, curated per-resource filter flags, and a generic repeatable
--filter 'attribute[condition]=value'. The generic LHS filter flag is added
to internal/cyargs (AddLHSFilterFlag/GetLHSFilters) for reuse by other List
commands. `outputs get` defaults to the field printer for the raw value,
overridable with -o json/yaml/jq.

Tests: cyargs filter parsing unit tests + e2e inventory wiring/filter checks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FDJ4Wqu8vtoCey5EE5K5aw
@fhacloid fhacloid force-pushed the feat/cli-inventory-commands branch from 7046cfc to 11b3756 Compare July 1, 2026 13:32
@fhacloid fhacloid merged commit 31650cd into develop Jul 1, 2026
4 checks passed
@fhacloid fhacloid deleted the feat/cli-inventory-commands branch July 1, 2026 13:46
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