Commit Graph

4293 Commits

Author SHA1 Message Date
Steve Yegge
b3d6ef60bb feat: swarm commands improvements (bd-2ubv)
- Add findExistingSwarm helper and duplicate swarm check with --force flag
- Add bd swarm list command for discovering swarm molecules with progress stats
- Fix empty coordinator display in swarm create output
- Allow swarm status to accept swarm molecule ID (follows relates-to link)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 22:07:39 -08:00
Steve Yegge
5bd387c4bc bd sync: 2025-12-28 22:07:05 2025-12-28 22:07:05 -08:00
Steve Yegge
7a3498f881 refactor: extract shared getEpicChildren helper for swarm commands
- Add EpicChildren struct and getEpicChildren() helper function
- Define SwarmStore interface for dependency injection
- Refactor analyzeEpicForSwarm to use shared helper
- Refactor getSwarmStatus to use shared helper
- Eliminates duplicate code for fetching epic children and building
  dependency maps across both functions

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 21:44:06 -08:00
Steve Yegge
68ffda0fc0 bd sync: 2025-12-28 21:43:56 2025-12-28 21:43:56 -08:00
Steve Yegge
cb601d661e bd sync: 2025-12-28 21:38:58 2025-12-28 21:38:58 -08:00
Steve Yegge
a93736b8f6 bd sync: 2025-12-28 21:35:43 2025-12-28 21:35:43 -08:00
Steve Yegge
d5a87e839a docs: Replace Epic Planning with Ready Front model
The Ready Front model replaces temporal 'phase' thinking:
- Ready Front = issues with all deps satisfied (unblocked)
- Static: natural topology (sync points, bottlenecks)
- Dynamic: current wavefront of in-progress work

Key changes:
- Add cognitive trap warning (temporal language inverts deps)
- Graph Walk Pattern: walk backward from goal
- Requirement language: 'X needs Y' not 'X before Y'
- Validation with bd blocked
- Ready Fronts visualization
2025-12-28 21:35:30 -08:00
Steve Yegge
2213fc016d Add --short flag to bd show for compact output
Displays each issue on a single line with format:
<id> [<status>] P<priority> <type>: <title>

Example:
  bd show bd-nlzv --short
  bd-nlzv [open] P2 feature: bd show --short flag for compact output

Useful for quick status checks of multiple issues. (bd-nlzv)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 21:35:30 -08:00
Steve Yegge
2f6efffab3 bd sync: 2025-12-28 21:34:36 2025-12-28 21:35:30 -08:00
Steve Yegge
3fd4eccb78 perf: fix N+1 query in swarm status blocked check (bd-7p5l)
Build status map upfront from childIssues instead of calling
GetIssue for each dependency. Reduces queries from O(issues * deps)
to O(issues).

Also removes unused GetIssue from the interface.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 21:35:22 -08:00
Steve Yegge
67cf9dc302 feat: Add bd swarm create command (bd-fa1q)
Implements `bd swarm create <epic-id>` to create a swarm molecule
that orchestrates parallel work on an epic.

Features:
- Creates molecule with mol_type=swarm for discovery
- Links to epic via relates-to dependency
- Validates epic structure before creation
- Auto-wraps single issues in an epic when needed
- Optional --coordinator flag to specify coordinator agent
- Supports JSON output for machine consumption

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 21:34:24 -08:00
Steve Yegge
302964b0f6 bd sync: 2025-12-28 21:31:23 2025-12-28 21:31:23 -08:00
Steve Yegge
2b8d9bc751 bd sync: 2025-12-28 21:28:27 2025-12-28 21:28:27 -08:00
Steve Yegge
a1ac42aca9 feat: add bd swarm status command (bd-5x0j)
Show current swarm status computed from beads:
- Completed: closed issues with timestamps
- Active: in_progress issues with assignees
- Ready: open issues with all deps satisfied
- Blocked: open issues waiting on deps
- Progress percentage

State is COMPUTED from beads, not stored separately.
Supports --json for programmatic use.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 21:28:14 -08:00
Steve Yegge
7ff5481966 fix: resolve golangci-lint errors (errcheck, gosec, unparam)
- orphans.go: check fmt.Scanln return value
- edit.go: #nosec G204 for trusted $EDITOR execution
- sync_git.go: #nosec G204 for git commands with internal branch names
- worktree_cmd.go: #nosec G304/G306 for .gitignore file operations
- migrations: handle rows.Close() error
- doctor_pollution.go: mark unused path parameter

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 20:50:54 -08:00
Jordan Hubbard
713c569e6e test: add git helper and guard annotations 2025-12-28 20:48:37 -08:00
Steve Yegge
f3dcafca66 feat: Add mol_type schema field for molecule type classification (bd-oxgi)
Add mol_type field to beads for swarm coordination:
- Values: 'swarm' (multi-polecat), 'patrol' (recurring ops), 'work' (default)
- Nullable, defaults to empty string (treated as 'work')

Changes:
- Add mol_type column to SQLite schema and migration 031
- Add MolType type with IsValid() validation in types.go
- Update insertIssue/GetIssue to handle mol_type
- Add --mol-type flag to create command
- Add mol_type filtering to list and ready commands
- Update RPC protocol for daemon mode support
- Update test schema in migrations_test.go

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 19:52:51 -08:00
Steve Yegge
77ba8f3d10 feat: Add bd swarm validate command (bd-nkqx)
Adds validation of epic structure for swarm execution:
- Computes ready fronts (waves of parallel work)
- Detects structural issues (cycles, orphans, missing deps)
- Reports estimated worker-sessions and max parallelism
- Warns about potential dependency inversions
- Returns exit code for CI integration

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 19:35:28 -08:00
Steve Yegge
27101a4f57 bd sync: 2025-12-28 19:04:53 2025-12-28 19:04:53 -08:00
Steve Yegge
8ed12091ab bd sync: code review round 2 issues 2025-12-28 19:00:43 -08:00
Steve Yegge
36ae647599 bd sync: 2025-12-28 19:00:28 2025-12-28 19:00:28 -08:00
Steve Yegge
b5beedbeda bd sync: 2025-12-28 18:45:30 2025-12-28 18:45:30 -08:00
Steve Yegge
6c14fd2225 refactor: Split large cmd/bd files to meet 800-line limit (bd-xtf5)
Split 6 files exceeding 800 lines by extracting cohesive function groups:

- show.go (1592→578): extracted show_thread.go, close.go, edit.go, update.go
- doctor.go (1295→690): extracted doctor_fix.go, doctor_health.go, doctor_pollution.go
- sync.go (1201→749): extracted sync_git.go
- compact.go (1199→775): extracted compact_tombstone.go, compact_rpc.go
- linear.go (1190→641): extracted linear_sync.go, linear_conflict.go
- main.go (1148→800): extracted main_help.go, main_errors.go, main_daemon.go

All files now under 800-line acceptance criteria.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 18:43:09 -08:00
Steve Yegge
7ea7aee411 refactor: Split init.go from 1928 to 705 lines (bd-xtf5)
Extract init.go into multiple focused files:

- init_git_hooks.go: Git hooks installation and merge driver setup (~480 lines)
- init_stealth.go: Stealth mode and fork/exclude configuration (~310 lines)
- init_agent.go: AGENTS.md and Claude settings setup (~170 lines)
- init_templates.go: config.yaml and README.md templates (~180 lines)

This reduces init.go from 1928 lines to 705 lines, meeting the <800 line target.
Each extracted file handles a cohesive set of functionality.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 18:43:09 -08:00
Steve Yegge
f7dd2eaa8c bd sync: 2025-12-28 Close bd-9btu, bd-kkka 2025-12-28 18:43:09 -08:00
Steve Yegge
2960a46913 bd sync: 2025-12-28 Close bd-1tkd 2025-12-28 18:42:51 -08:00
Steve Yegge
d4c55639ea refactor: Remove deprecated fetchAndRebaseInWorktree (bd-kkka)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 18:42:51 -08:00
Steve Yegge
1cdece372a bd sync: 2025-12-28 16:41:41 2025-12-28 16:41:49 -08:00
Steve Yegge
715631bcaa bd sync: 2025-12-28 16:41:33 2025-12-28 16:41:49 -08:00
Steve Yegge
9dda75ef15 docs: Document deprecation timeline and add removal warnings (bd-pndo)
- Add Deprecated section to CHANGELOG.md listing all deprecated commands
- Set removal target: v1.0.0 for all deprecated commands
- Add '(will be removed in v1.0.0)' to all deprecation messages
- Add proper Deprecated field to admin_aliases.go (cleanup, compact, reset)
- Remove manual warning prints from admin aliases (Cobra handles it)

Deprecated commands documented:
- bd relate/unrelate → bd dep relate/unrelate
- bd daemons → bd daemon <subcommand>
- bd cleanup/compact/reset → bd admin <command>
- bd comment → bd comments add
- bd template* → bd mol/formula commands
- bd detect-pollution → bd doctor --check=pollution
- bd migrate-* → bd migrate <subcommand>

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:40:43 -08:00
Steve Yegge
2e7562e77b bd sync: 2025-12-28 Close bd-5l59 2025-12-28 16:40:42 -08:00
Steve Yegge
ff264c29d2 refactor: Organize Issue struct with section comments (bd-5l59)
Group 50+ fields into 15 logical sections with clear separators:
- Core Identification (ID, ContentHash)
- Issue Content (Title, Description, Design, AcceptanceCriteria, Notes)
- Status & Workflow (Status, Priority, IssueType)
- Assignment (Assignee, EstimatedMinutes)
- Timestamps (CreatedAt, CreatedBy, UpdatedAt, ClosedAt, CloseReason)
- External Integration (ExternalRef)
- Compaction Metadata
- Internal Routing (not exported)
- Relational Data (Labels, Dependencies, Comments)
- Tombstone Fields (soft-delete)
- Messaging Fields (inter-agent communication)
- Context Markers (Pinned, IsTemplate)
- Bonding Fields (compound molecule lineage)
- HOP Fields (entity tracking)
- Gate Fields (async coordination)
- Source Tracing Fields
- Agent Identity Fields

All tests pass, JSON serialization unchanged.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:40:41 -08:00
Steve Yegge
ad443c3af1 bd sync: 2025-12-28 Close bd-1tkd 2025-12-28 16:40:34 -08:00
Steve Yegge
2d92b452c9 refactor: Extract hashFieldWriter to reduce ComputeContentHash repetition (bd-1tkd)
- Created hashFieldWriter struct with typed helper methods
- Methods: str, int, strPtr, float32Ptr, duration, flag, entityRef
- Reduced ~100 lines of repetitive h.Write() patterns to ~55 lines
- All hash tests pass, output unchanged (backwards compatible)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:40:33 -08:00
Steve Yegge
e6ff1e89f0 refactor: Remove deprecated fetchAndRebaseInWorktree (bd-kkka)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:40:26 -08:00
Steve Yegge
7ffcfe5e53 Merge Nux polecat work (bd-9btu, bd-9hc9, bd-lrj8, bd-8zbo) 2025-12-28 16:39:46 -08:00
Steve Yegge
1bb61c5ffe refactor: Break up 275-line runCook into focused helpers (bd-8zbo)
Extracted 5 helper functions from the monolithic runCook function:

- parseCookFlags: Parse and validate command-line flags (~40 lines)
- loadAndResolveFormula: Parse, resolve, apply transformations (~60 lines)
- outputCookDryRun: Display dry-run preview (~60 lines)
- outputCookEphemeral: Output resolved formula as JSON (~30 lines)
- persistCookFormula: Create proto bead in database (~45 lines)

Main runCook function reduced from ~275 to ~65 lines with clear flow:
1. Parse flags → 2. Validate store → 3. Load formula
4. Extract metadata → 5. Handle mode (dry-run/ephemeral/persist)

Benefits:
- Each helper is single-responsibility and testable
- Added cookFlags struct for type-safe flag passing
- Error handling uses proper error returns instead of os.Exit
- Clear separation of concerns

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:37:30 -08:00
Steve Yegge
27de61fbd0 chore: Convert scattered TODOs to tracked issues (bd-lrj8)
Created 7 new beads to track TODOs that were previously inline comments:

- bd-7l27: Integrate migration detection into bd doctor (5 files)
- bd-6x6g: Add multi-repo target repo switching in bd create
- bd-ag35: Add daemon RPC endpoints for config and stale check
- bd-2dwo: Remove deprecated daemon logger function
- bd-0qx5: Implement Jira issue timestamp comparison for sync
- bd-7zka: Implement formula features (repeat, for_each, branch, gate, split)
- bd-h048: Refactor sync_test to use direct import logic

Updated 16 TODO comments to include bead ID references for tracking.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:34:24 -08:00
Steve Yegge
dedf5cfe92 bd sync: closed bd-9hc9 after refactoring autoflush.go 2025-12-28 16:23:54 -08:00
Steve Yegge
efb56e9dd8 refactor: Break up 280-line flushToJSONLWithState into focused helpers (bd-9hc9)
Extracted 8 helper functions from the monolithic flushToJSONLWithState:

- recordFlushFailure/recordFlushSuccess: Failure tracking and counter management
- readExistingJSONL: Parse existing JSONL file for incremental merging
- fetchAndMergeIssues: Fetch dirty issues from DB and merge into map
- filterWisps: Remove ephemeral (wisp) issues from export
- filterByMultiRepoPrefix: Multi-repo prefix filtering for non-primary repos
- updateFlushExportMetadata: Store hashes and timestamps after export
- getIssuesToExport: Determine full vs incremental export issue list

Main function now reads as a clear pipeline:
1. Validate integrity -> 2. Get issues -> 3. Read existing JSONL
4. Merge from DB -> 5. Filter wisps -> 6. Filter by prefix
7. Write atomically -> 8. Update metadata

Benefits:
- Each helper is single-responsibility and testable
- Main function reduced from ~280 to ~94 lines
- Logic is clearly separated and documented
- Easier to understand and maintain

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:23:45 -08:00
Steve Yegge
5d540c4385 bd sync: 2025-12-28 16:18:10 2025-12-28 16:18:10 -08:00
Steve Yegge
40b65b8dbe bd sync: closed bd-9btu after refactoring cook.go 2025-12-28 16:15:33 -08:00
Steve Yegge
1d4eb6d94c refactor: Consolidate duplicated step collection functions in cook.go (bd-9btu)
Replaced three near-identical functions with a single unified collectSteps()
that uses a callback strategy for label handling:

- Removed collectStepsRecursive() (DB version)
- Removed collectStepsToSubgraph() (in-memory version)
- Removed collectStepIDMappings() (now handled by unified function)

The new collectSteps() function:
- Takes optional labelHandler callback for DB path (extracts labels separately)
- Takes optional issueMap for in-memory path
- Always builds idMapping for dependency resolution
- Eliminates ~60 lines of duplicated code

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 16:15:17 -08:00
Steve Yegge
09876fff99 bd sync: 2025-12-28 16:02:46 2025-12-28 16:02:46 -08:00
Steve Yegge
7f950eeabd bd sync: 2025-12-28 15:42:33 2025-12-28 15:42:46 -08:00
Steve Yegge
f459f8ef7f refactor: Extract stepTypeToIssueType helper to remove duplicated switch (bd-j3dj)
Extracted duplicated switch statement for mapping step type strings to
types.IssueType into a single helper function. This removes code
duplication between collectStepsToSubgraph() and collectStepsRecursive().

The new stepTypeToIssueType() function:
- Converts 'task', 'bug', 'feature', 'epic', 'chore' to types
- Returns types.TypeTask for empty or unrecognized types
- Used by both functions with children-override-to-epic logic preserved
2025-12-28 15:42:24 -08:00
Steve Yegge
167e9a18bc bd sync: 2025-12-28 15:38:09 2025-12-28 15:38:09 -08:00
Steve Yegge
d70d669e76 bd sync: 2025-12-28 15:33:10 2025-12-28 15:33:10 -08:00
Steve Yegge
5e99b68863 bd sync: 2025-12-28 13:52:31 2025-12-28 14:00:14 -08:00
Steve Yegge
0f008d3979 docs: Add components overview explaining CLI vs Plugin vs MCP
Clarifies the relationship between bd CLI, Claude Code Plugin,
and MCP server. Most users only need the CLI.

Closes #782

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:00:05 -08:00