Add BD_AGENT_MODE for ultra-compact output

Adds agent-optimized output mode for `bd list` triggered by:
- BD_AGENT_MODE=1 environment variable (explicit)
- CLAUDE_CODE environment variable (auto-detect)

Agent mode provides:
- Ultra-compact format: just "ID: Title" per line
- Lower default limit (20 vs 50) for context efficiency
- No colors, no emojis, no pager
- Defaults to open/in_progress only (existing behavior)

(bd-x2ht)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-30 15:59:11 -08:00
parent 288334f8b4
commit b45e68c5ce
3 changed files with 66 additions and 2 deletions

View File

@@ -152,3 +152,26 @@ func TestRenderCommandAndCategoryAreUppercaseSafe(t *testing.T) {
t.Fatalf("command output missing text: %q", cmd)
}
}
func TestIsAgentMode(t *testing.T) {
// Test default (no env vars) - t.Setenv automatically restores after test
t.Setenv("BD_AGENT_MODE", "")
t.Setenv("CLAUDE_CODE", "")
if IsAgentMode() {
t.Fatal("expected false with no env vars")
}
// Test BD_AGENT_MODE=1
t.Setenv("BD_AGENT_MODE", "1")
t.Setenv("CLAUDE_CODE", "")
if !IsAgentMode() {
t.Fatal("expected true with BD_AGENT_MODE=1")
}
// Test CLAUDE_CODE auto-detection
t.Setenv("BD_AGENT_MODE", "")
t.Setenv("CLAUDE_CODE", "something")
if !IsAgentMode() {
t.Fatal("expected true with CLAUDE_CODE set")
}
}