bd list --tree: - Use actual parent-child dependencies instead of dotted ID hierarchy - Treat epic dependencies as parent-child relationships - Sort children by priority (P0 first) - Fix tree display in daemon mode with read-only store access bd graph: - Add --all flag to show dependency graph of all open issues - Add --compact flag for tree-style rendering (reduces 44+ lines to 13) - Fix "needs:N" cognitive noise by using semantic colors - Add blocks:N indicator with semantic red coloring bd show: - Tufte-aligned header with status icon, priority, and type badges - Add glamour markdown rendering with auto light/dark mode detection - Cap markdown line width at 100 chars for readability - Mute entire row for closed dependencies (work done, no attention needed) Design system: - Add shared status icons (○ ◐ ● ✓ ❄) with semantic colors - Implement priority colors: P0 red, P1 orange, P2 muted gold, P3-P4 neutral - Add TrueColor profile for distinct hex color rendering - Type badges for epic (purple) and bug (red) Design principles: - Semantic colors only for actionable items - Closed items fade (muted gray) - Icons > text labels for better scanability Co-Authored-By: SageOx <ox@sageox.ai>
115 lines
3.2 KiB
Go
115 lines
3.2 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestShow_ExternalRef(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping CLI test in short mode")
|
|
}
|
|
|
|
// Build bd binary
|
|
tmpBin := filepath.Join(t.TempDir(), "bd")
|
|
buildCmd := exec.Command("go", "build", "-o", tmpBin, "./")
|
|
buildCmd.Dir = "."
|
|
if out, err := buildCmd.CombinedOutput(); err != nil {
|
|
t.Fatalf("failed to build bd: %v\n%s", err, out)
|
|
}
|
|
|
|
// Create temp directory for test database
|
|
tmpDir := t.TempDir()
|
|
|
|
// Initialize beads
|
|
initCmd := exec.Command(tmpBin, "init", "--prefix", "test", "--quiet")
|
|
initCmd.Dir = tmpDir
|
|
if out, err := initCmd.CombinedOutput(); err != nil {
|
|
t.Fatalf("init failed: %v\n%s", err, out)
|
|
}
|
|
|
|
// Create issue with external ref
|
|
createCmd := exec.Command(tmpBin, "--no-daemon", "create", "External ref test", "-p", "1",
|
|
"--external-ref", "https://example.com/spec.md", "--json")
|
|
createCmd.Dir = tmpDir
|
|
createOut, err := createCmd.CombinedOutput()
|
|
if err != nil {
|
|
t.Fatalf("create failed: %v\n%s", err, createOut)
|
|
}
|
|
|
|
var issue map[string]interface{}
|
|
if err := json.Unmarshal(createOut, &issue); err != nil {
|
|
t.Fatalf("failed to parse create output: %v, output: %s", err, createOut)
|
|
}
|
|
id := issue["id"].(string)
|
|
|
|
// Show the issue and verify external ref is displayed
|
|
showCmd := exec.Command(tmpBin, "--no-daemon", "show", id)
|
|
showCmd.Dir = tmpDir
|
|
showOut, err := showCmd.CombinedOutput()
|
|
if err != nil {
|
|
t.Fatalf("show failed: %v\n%s", err, showOut)
|
|
}
|
|
|
|
out := string(showOut)
|
|
if !strings.Contains(out, "External:") {
|
|
t.Errorf("expected 'External:' in output, got: %s", out)
|
|
}
|
|
if !strings.Contains(out, "https://example.com/spec.md") {
|
|
t.Errorf("expected external ref URL in output, got: %s", out)
|
|
}
|
|
}
|
|
|
|
func TestShow_NoExternalRef(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping CLI test in short mode")
|
|
}
|
|
|
|
// Build bd binary
|
|
tmpBin := filepath.Join(t.TempDir(), "bd")
|
|
buildCmd := exec.Command("go", "build", "-o", tmpBin, "./")
|
|
buildCmd.Dir = "."
|
|
if out, err := buildCmd.CombinedOutput(); err != nil {
|
|
t.Fatalf("failed to build bd: %v\n%s", err, out)
|
|
}
|
|
|
|
tmpDir := t.TempDir()
|
|
|
|
// Initialize beads
|
|
initCmd := exec.Command(tmpBin, "init", "--prefix", "test", "--quiet")
|
|
initCmd.Dir = tmpDir
|
|
if out, err := initCmd.CombinedOutput(); err != nil {
|
|
t.Fatalf("init failed: %v\n%s", err, out)
|
|
}
|
|
|
|
// Create issue WITHOUT external ref
|
|
createCmd := exec.Command(tmpBin, "--no-daemon", "create", "No ref test", "-p", "1", "--json")
|
|
createCmd.Dir = tmpDir
|
|
createOut, err := createCmd.CombinedOutput()
|
|
if err != nil {
|
|
t.Fatalf("create failed: %v\n%s", err, createOut)
|
|
}
|
|
|
|
var issue map[string]interface{}
|
|
if err := json.Unmarshal(createOut, &issue); err != nil {
|
|
t.Fatalf("failed to parse create output: %v, output: %s", err, createOut)
|
|
}
|
|
id := issue["id"].(string)
|
|
|
|
// Show the issue - should NOT contain External Ref line
|
|
showCmd := exec.Command(tmpBin, "--no-daemon", "show", id)
|
|
showCmd.Dir = tmpDir
|
|
showOut, err := showCmd.CombinedOutput()
|
|
if err != nil {
|
|
t.Fatalf("show failed: %v\n%s", err, showOut)
|
|
}
|
|
|
|
out := string(showOut)
|
|
if strings.Contains(out, "External:") {
|
|
t.Errorf("expected no 'External:' line for issue without external ref, got: %s", out)
|
|
}
|
|
}
|