feat(inventory): add cy inventory outputs and resources commands#469
Merged
Conversation
0a8a702 to
7046cfc
Compare
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
7046cfc to
11b3756
Compare
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.
What
Adds a discoverable
cy inventorycommand tree to browse the Terraform state inventory (backend Organization Inventory endpoints):cy inventory outputs list— list Terraform state outputscy inventory outputs get <key>— print a single output value (raw, scriptable;-o jsonfor the full object)cy inventory resources list— list tracked resourcesThe middleware (
ListInventoryOutputs/ListInventoryResources) already existed and was wired into theMiddlewareinterface; this PR adds the missing user-facing command layer.Details
--project/--env/--componentvia the sharedcyargsflags (-p/-e/-c,CY_*env support).--key,--type,--pinned,--provider,--module, …) plus a generic repeatable--filter 'attribute[condition]=value'.internal/cyargs(AddLHSFilterFlag/GetLHSFilters) so any List command can reuse it.outputs getdefaults 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