feat(dep): add --blocked-by and --depends-on flag aliases (bd-09kt)
Add flag-based alternatives to the positional argument for `bd dep add`: - `--blocked-by <id>`: Specify the blocking issue via flag - `--depends-on <id>`: Alias for --blocked-by This reduces token waste when Claude guesses flag-based syntax, which is a common pattern. Previously, Claude would attempt commands like: bd dep add issue-123 --blocked-by issue-456 This would fail with "unknown flag" and require retry. Now both: bd dep add issue-123 issue-456 bd dep add issue-123 --blocked-by issue-456 work identically. Closes GH#888 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -250,6 +250,35 @@ func TestDepCommandsInit(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDepAddFlagAliases(t *testing.T) {
|
||||
// Test that --blocked-by flag exists on depAddCmd
|
||||
blockedByFlag := depAddCmd.Flags().Lookup("blocked-by")
|
||||
if blockedByFlag == nil {
|
||||
t.Fatal("depAddCmd should have --blocked-by flag")
|
||||
}
|
||||
if blockedByFlag.DefValue != "" {
|
||||
t.Errorf("Expected default blocked-by='', got %q", blockedByFlag.DefValue)
|
||||
}
|
||||
|
||||
// Test that --depends-on flag exists on depAddCmd
|
||||
dependsOnFlag := depAddCmd.Flags().Lookup("depends-on")
|
||||
if dependsOnFlag == nil {
|
||||
t.Fatal("depAddCmd should have --depends-on flag")
|
||||
}
|
||||
if dependsOnFlag.DefValue != "" {
|
||||
t.Errorf("Expected default depends-on='', got %q", dependsOnFlag.DefValue)
|
||||
}
|
||||
|
||||
// Verify the help text mentions the flags
|
||||
longDesc := depAddCmd.Long
|
||||
if !strings.Contains(longDesc, "--blocked-by") {
|
||||
t.Error("Expected Long description to mention --blocked-by flag")
|
||||
}
|
||||
if !strings.Contains(longDesc, "--depends-on") {
|
||||
t.Error("Expected Long description to mention --depends-on flag")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDepTreeFormatFlag(t *testing.T) {
|
||||
// Test that the --format flag exists on depTreeCmd
|
||||
flag := depTreeCmd.Flags().Lookup("format")
|
||||
|
||||
Reference in New Issue
Block a user