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:
onyx
2026-01-04 11:29:43 -08:00
committed by Steve Yegge
parent 563f7e875d
commit 5229b3e90d
2 changed files with 86 additions and 14 deletions

View File

@@ -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")