Background
scripts/check-cli-surface.sh merges $ROOT_FLAGS (all root command flags) into every subcommand's flag list at line 45:
ROOT_FLAGS=$("$BINARY" --help --agent 2>/dev/null | jq -c '[.flags // [] | .[] | {name, type}]')
# ...
((.flags // []) + (.inherited_flags // []) + $root | group_by(.name) | map(.[0]) | sort_by(.name))
This incorrectly propagates --version to all subcommands. Cobra adds --version as a local flag on the root (via InitDefaultVersionFlag), not a persistent one — it does not inherit to subcommands.
Impact
The Go surface walker (github.com/basecamp/cli/surface v0.2.1) correctly omits --version from subcommands. This creates a 612-entry divergence between the shell script and the Go walker. Documented in PR #366.
Fix
Change $ROOT_FLAGS to only include root persistent flags, not all root flags. The --help --agent JSON already distinguishes .flags from .inherited_flags — filter $ROOT_FLAGS to only the persistent subset, or use inherited_flags from the root's children instead of force-merging root flags.
Related
Background
scripts/check-cli-surface.shmerges$ROOT_FLAGS(all root command flags) into every subcommand's flag list at line 45:This incorrectly propagates
--versionto all subcommands. Cobra adds--versionas a local flag on the root (viaInitDefaultVersionFlag), not a persistent one — it does not inherit to subcommands.Impact
The Go surface walker (
github.com/basecamp/cli/surfacev0.2.1) correctly omits--versionfrom subcommands. This creates a 612-entry divergence between the shell script and the Go walker. Documented in PR #366.Fix
Change
$ROOT_FLAGSto only include root persistent flags, not all root flags. The--help --agentJSON already distinguishes.flagsfrom.inherited_flags— filter$ROOT_FLAGSto only the persistent subset, or useinherited_flagsfrom the root's children instead of force-merging root flags.Related
scripts/check-smoke-coverage.sh:54— has a hardcodedalias_mapfor campfire→chat that is now redundant since.surfaceincludes alias paths natively