fix(cli): allow subcommand options to override global options#1062
Open
dsylla wants to merge 1 commit intoruvnet:mainfrom
Open
fix(cli): allow subcommand options to override global options#1062dsylla wants to merge 1 commit intoruvnet:mainfrom
dsylla wants to merge 1 commit intoruvnet:mainfrom
Conversation
The parser was applying global option defaults before command resolution, causing validation failures when subcommands defined options with the same name but different choices (e.g., --format). Changes: - Defer applyDefaults() call until after command resolution - Skip global defaults when command defines same option name - Filter global options from validation when command overrides them Fixes: `claude-flow process monitor` failing with "Invalid value for --format: text. Must be one of: dashboard, compact, json"
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
--formatoption was being validated against global option choicesclaude-flow process monitorfailed with "Invalid value for --format: text. Must be one of: dashboard, compact, json"Root Cause
The parser applied global option defaults (
--formatdefaulting to'text') before command resolution. When validating, the subcommand's--formatchoices (['dashboard', 'compact', 'json']) were checked against the global default value ('text'), causing validation to fail.Changes
applyDefaults()- no longer called duringparse(), moved to CLI after command resolutionapplyDefaults()to accept command parameter and skip global defaults when command defines same optionvalidateFlags()to filter out global options when command overrides themapplyDefaults(flags, targetCommand)after subcommand resolutionTest Plan
claude-flow process monitornow works (uses dashboard format by default)claude-flow process monitor --format jsonworksclaude-flow process monitor --format compactworksclaude-flow --versionstill works🤖 Generated with claude-flow