Skip to content

feat(cli): add --match-contract filter to inspect command#1860

Open
saturn-dbeal wants to merge 2 commits intousecannon:devfrom
saturn-dbeal:feat/inspect-match-contract
Open

feat(cli): add --match-contract filter to inspect command#1860
saturn-dbeal wants to merge 2 commits intousecannon:devfrom
saturn-dbeal:feat/inspect-match-contract

Conversation

@saturn-dbeal
Copy link
Copy Markdown
Contributor

Adds a --match-contract flag to the cannon inspect command that accepts a regex pattern to filter which contracts are shown in the output.

This is useful when working with large deployments where you only care about specific contracts.

Usage:

# Show only contracts matching "Proxy"
cannon inspect my-package:1.0.0 --match-contract "Proxy"

# Export only specific contracts as JSON
cannon inspect my-package:1.0.0 --out artifact-json --match-contract "^Core"

# Write only matching contract deployments
cannon inspect my-package:1.0.0 --write-deployments ./output --match-contract "Token"

The filter works across all output modes:

  • overview: Only shows matching contracts in the contract list
  • artifact-json: Only includes matching contracts in the JSON output
  • deploy-json: Only includes matching contracts from the deployment state
  • --write-deployments: Only writes files for matching contracts

The pattern is applied recursively through nested imports.

Related: #1761 (original request for more output control)

- Add proper type imports (ContractMap, BundledChainBuilderOutputs)
- Add explicit type casts for lodash pickBy/mapValues results
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