fix(cli): restore -y shorthand on todo task delete and skill setup#417
Open
jackjin1997 wants to merge 1 commit into
Open
fix(cli): restore -y shorthand on todo task delete and skill setup#417jackjin1997 wants to merge 1 commit into
jackjin1997 wants to merge 1 commit into
Conversation
Both subcommands register a local --yes flag with the same name as the global persistent --yes/-y. During cobra's persistent-flag merge the same-named parent flag (and its -y shorthand) is skipped, so -y resolved to nothing and `dws todo task delete -y` / `dws skill setup -y` failed with "unknown shorthand flag: 'y'" — only the long --yes worked. Register the -y shorthand on the local flags (Bool -> BoolP). Removing the local flags instead would drop the shorthand too and also break a standalone unit test that constructs skill setup without the root persistent flags. Fixes DingTalk-Real-AI#370
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
-yshorthand on the local--yesflags ofdws todo task delete(internal/helpers/todo.go) anddws skill setup(internal/app/skill_setup.go) —Bool("yes")→BoolP("yes", "y", ...).--yesflag with the same name as the global persistent--yes/-y. During cobra's persistent-flag merge, the same-named parent flag (and its-yshorthand) is skipped, so-yresolved to nothing:--yesworked, which is surprising for an AI-agent-oriented CLI where-yis the documented global shorthand.Fixes #370
Verification
make buildmake lint—go vetpasses;staticchecknot installed in my local env (CI covers it)go test ./internal/helpers/ ./internal/app/(incl. newTestTodoTaskDeleteHasYesShorthand,TestSkillSetupHasYesShorthand)make policy./scripts/policy/check-generated-drift.sh./scripts/policy/check-command-surface.sh --strictNotes
TestRunSkillSetupRejectsSkillFlagInMonoMode) that constructsskill setupwithout the root persistent flags and passes--yes. Adding-yis the smaller, safer change that directly fixes the reported symptom and keeps both standalone and mounted usage working — cobra's merge skips the duplicate-named persistent flag, so the local-ybecomes the active shorthand with no collision.RunEreads viacmd.Flags().GetBool("yes")in both commands, so behavior is unchanged beyond the shorthand now resolving.