bd sync: 2025-11-24 19:28:28

This commit is contained in:
Steve Yegge
2025-11-24 19:28:28 -08:00
parent 3d280f9b6b
commit cf560a947c

View File

@@ -25,7 +25,6 @@
{"id":"bd-7yg","content_hash":"a421df3d78f39edb93e421f18e042ad113f6d26c91439d1f732d3df7c80eee62","title":"Git merge driver uses invalid placeholders (%L, %R instead of %A, %B)","description":"## Problem\n\nThe beads git merge driver is configured with invalid Git placeholders:\n\n```\ngit config merge.beads.driver \"bd merge %A %O %L %R\"\n```\n\nGit doesn't recognize `%L` or `%R` as valid merge driver placeholders. The valid placeholders are:\n- `%O` = base (common ancestor)\n- `%A` = current version (ours)\n- `%B` = other version (theirs)\n\n## Impact\n\n- Affects ALL users when they have `.beads/beads.jsonl` merge conflicts\n- Automatic JSONL merge fails with error: \"error reading left file: failed to open file: open 7: no such file or directory\"\n- Users must manually resolve conflicts instead of getting automatic merge\n\n## Root Cause\n\nThe `bd init` command (or wherever the merge driver is configured) is using non-standard placeholders. When Git encounters `%L` and `%R`, it either passes them literally or interprets them incorrectly.\n\n## Fix\n\nUpdate the merge driver configuration to:\n```\ngit config merge.beads.driver \"bd merge %A %O %A %B\"\n```\n\nWhere:\n- 1st `%A` = output file (current file, will be overwritten)\n- `%O` = base (common ancestor)\n- 2nd `%A` = left/current version\n- `%B` = right/other version\n\n## Action Items\n\n1. Fix `bd init` (or equivalent setup command) to use correct placeholders\n2. Add migration/warning for existing users with misconfigured merge driver\n3. Update documentation with correct merge driver setup\n4. Consider adding validation when `bd init` is run","status":"open","priority":1,"issue_type":"bug","created_at":"2025-11-21T19:51:55.747608-05:00","updated_at":"2025-11-21T19:51:55.747608-05:00","source_repo":"."}
{"id":"bd-853a","content_hash":"df6de1f6a58a995d979a7be59c2fb38800e81b96e8fa0bd39980f8bf9f1a4f37","title":"bd resolve-conflicts - Git merge conflict resolver","description":"Automatically resolve JSONL merge conflicts.\n\nModes:\n- Mechanical: ID remapping (no AI)\n- AI-assisted: Smart merge/keep decisions\n- Interactive: Review each conflict\n\nHandles \u003c\u003c\u003c\u003c\u003c\u003c\u003c conflict markers in .beads/beads.jsonl\n\nFiles: cmd/bd/resolve_conflicts.go (new)","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-24T17:04:47.303547-08:00","updated_at":"2025-11-24T17:04:47.303547-08:00","source_repo":"."}
{"id":"bd-90v","content_hash":"9863bc4154603ebc58c4649f8a74b5508f8b30aae6db360e84485e2d7f19fb30","title":"bd prime: AI context loading and Claude Code integration","description":"Implement `bd prime` command and Claude Code hooks for context recovery. Hooks work with BOTH MCP server and CLI approaches - they solve the context memory problem (keeping bd workflow fresh after compaction) not the tool access problem (MCP vs CLI).","design":"## Epic Scope\n\nThis epic covers:\n1. Core `bd prime` command implementation with MCP-aware output\n2. Claude Code hooks via `bd setup claude` (works with MCP OR CLI)\n3. Automatic context recovery via SessionStart/PreCompact hooks\n4. `bd doctor` verification for Claude setup\n5. Documentation updates\n\n## Goals\n- Keep bd workflow fresh in agent context (prevent markdown TODO reversion)\n- Enable automatic context recovery after compaction/clear\n- Adapt to user's workflow preference (MCP vs CLI) automatically\n- Support multi-user projects (mixed Claude/non-Claude teams)\n- Verify setup with `bd doctor`\n\n## Architecture Understanding\n\n**MCP vs CLI is a user preference (not project-level):**\n- User installs MCP server globally → gets native bd tools\n- User doesn't install MCP → uses CLI via Bash tool\n- `bd prime` auto-detects which mode and adapts output\n- Same hooks work for all users regardless of preference\n\n**Hooks complement both approaches:**\n- **With MCP**: Hooks output workflow reminders (~500 tokens) - prevents forgetting to use MCP tools\n- **Without MCP**: Hooks output full CLI reference (~1-2k tokens) - provides command syntax\n- **Both cases**: Prevents markdown TODO reversion after compaction\n\n**Why hooks matter even with MCP:**\n- MCP tools can be forgotten after compaction\n- Hooks refresh \"use bd, not markdown\" reminder\n- PreCompact keeps bd workflow fresh in memory\n- Works in both MCP and CLI scenarios\n\n## Token Optimization\n\n**MCP mode** (~500 tokens):\n- Workflow reminders only\n- No CLI syntax (user has native tools)\n- References to MCP tool names\n\n**Non-MCP mode** (~1-2k tokens):\n- Full workflow rules\n- Complete CLI command reference\n- Examples and common patterns\n\n**Why adaptive output matters:**\n- MCP users waste tokens on CLI docs they don't need\n- Non-MCP users need full command reference\n- Same hook works for everyone, adapts automatically\n- Multi-user projects: each dev gets appropriate output for their setup\n\n## Out of Scope\n- Tip system infrastructure (separate epic)\n- Cursor/Windsurf integration (separate issues)\n- MCP server modifications","acceptance_criteria":"- `bd prime` command exists and outputs AI-optimized markdown\n- `bd setup claude` installs hooks and slash commands\n- Hooks auto-call `bd prime` when .beads/ detected\n- `bd doctor` verifies Claude integration\n- Documentation complete in AGENTS.md, README.md, QUICKSTART.md\n- All child issues closed","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-11T23:31:12.119012-08:00","updated_at":"2025-11-12T00:11:07.743189-08:00","source_repo":"."}
{"id":"bd-98c4e1fa.1","content_hash":"6440d1ece0a91c8f49adc09aafa7a998b049bcd51f257125ad8bc0b7b03e317b","title":"Update AGENTS.md with event-driven mode","description":"Document BEADS_DAEMON_MODE env var. Explain opt-in during Phase 1. Add troubleshooting for watcher failures.","status":"open","priority":2,"issue_type":"task","created_at":"2025-10-29T23:05:13.986452-07:00","updated_at":"2025-10-31T20:36:49.381832-07:00","source_repo":"."}
{"id":"bd-9dbq","content_hash":"3c462046931ba97960701c8b73ccbbbfbe74379b9e982b62b37a58d04354da4b","title":"Add transaction support for atomic issue creation","description":"Use Beads transaction API to create all issues atomically\n\nDesign:\nAdd a transaction-aware API to Beads Storage interface.\n\nApproach 1 (Recommended): RunInTransaction wrapper\n```go\n// In beads/storage.go\ntype Storage interface {\n // ... existing methods ...\n \n // RunInTransaction executes fn in a transaction\n // If fn returns error, transaction is rolled back\n // If fn returns nil, transaction is committed\n RunInTransaction(ctx context.Context, fn func(tx Transaction) error) error\n}\n\ntype Transaction interface {\n // Same methods as Storage, but use underlying *sql.Tx\n CreateIssue(ctx context.Context, issue *Issue, actor string) error\n AddLabel(ctx context.Context, issueID, label, actor string) error\n AddDependency(ctx context.Context, dep *Dependency, actor string) error\n UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error\n // ... etc\n}\n```\n\nImplementation in sqlite/sqlite.go:\n```go\nfunc (s *SQLiteStorage) RunInTransaction(ctx context.Context, fn func(tx Transaction) error) error {\n tx, err := s.db.BeginTx(ctx, nil)\n if err != nil {\n return err\n }\n defer tx.Rollback() // Safe to call even after commit\n \n txStorage := \u0026transactionStorage{tx: tx, storage: s}\n if err := fn(txStorage); err != nil {\n return err\n }\n \n return tx.Commit()\n}\n\ntype transactionStorage struct {\n tx *sql.Tx\n storage *SQLiteStorage\n}\n\nfunc (t *transactionStorage) CreateIssue(ctx context.Context, issue *Issue, actor string) error {\n // Same logic as storage.CreateIssue but use t.tx instead of s.db\n // ...\n}\n```\n\nApproach 2 (Alternative): Optional tx parameter\n```go\n// More invasive - requires changing all method signatures\nCreateIssue(ctx context.Context, issue *Issue, actor string, tx ...*sql.Tx) error\n```\n\nPrefer Approach 1 - cleaner API and explicit transaction scope.\n\nNotes:\nContext from VC implementation (vc-apx8):\n\nThe VC plan approval code (internal/planning/approval.go) needs to create multiple issues atomically:\n1. Phase issues (chores)\n2. Task issues \n3. Dependencies between them\n4. Labels\n5. Mission metadata updates\n6. Plan deletion\n\nCurrent problem:\n- Each operation uses storage methods that get their own DB connections\n- Starting a transaction (db.BeginTx) and then calling storage methods causes deadlock\n- Storage methods try to acquire connections while transaction holds a lock\n\nWhat Beads needs:\n1. A transaction-aware API, either:\n - RunInTransaction(func(tx) error) pattern (preferred)\n - OR: All storage methods accept optional *sql.Tx parameter\n\n2. Example usage:\n err := store.RunInTransaction(ctx, func(tx Transaction) error {\n // All operations use tx instead of separate connections\n issue := \u0026Issue{...}\n if err := tx.CreateIssue(ctx, issue, actor); err != nil {\n return err // Triggers rollback\n }\n if err := tx.AddLabel(ctx, issue.ID, \"label\", actor); err != nil {\n return err // Triggers rollback\n }\n return nil // Triggers commit\n })\n\n3. The Transaction interface should expose same methods as Storage:\n - CreateIssue\n - AddLabel\n - AddDependency\n - UpdateMission\n - DeletePlan\n - etc.\n\nReference implementation:\n- See internal/storage/beads/wrapper.go for existing transaction examples\n- Lines 146, 236, 305 show BeginTx usage for migrations\n- But these are DDL operations, not issue CRUD\n\nAcceptance Criteria:\n- WHEN creating issues in transaction THEN all succeed or all rollback\n- WHEN transaction commits THEN all issues exist in Beads\n- WHEN transaction rolls back THEN no issues exist","status":"open","priority":1,"issue_type":"task","created_at":"2025-11-24T11:32:52.877111-08:00","updated_at":"2025-11-24T11:32:52.877111-08:00","source_repo":".","dependencies":[{"issue_id":"bd-9dbq","depends_on_id":"bd-6pul","type":"related","created_at":"2025-11-24T11:37:44.948422-08:00","created_by":"daemon"}]}
{"id":"bd-9e23","content_hash":"fa94af8126d5d8c816a6f83d5ad191ebdb954687abb87ce30e4f67eee4f1a9ce","title":"Optimize Memory backend GetIssueByExternalRef with index","description":"Currently GetIssueByExternalRef in Memory storage uses O(n) linear search through all issues.\n\nCurrent code (memory.go:282-308):\nfor _, issue := range m.issues {\n if issue.ExternalRef != nil \u0026\u0026 *issue.ExternalRef == externalRef {\n return \u0026issueCopy, nil\n }\n}\n\nProposed optimization:\n- Add externalRefToID map[string]string to MemoryStorage\n- Maintain it in CreateIssue, UpdateIssue, DeleteIssue\n- Achieve O(1) lookup like SQLite's index\n\nImpact: Low (--no-db mode typically has smaller datasets)\nRelated: bd-1022","status":"open","priority":4,"issue_type":"chore","created_at":"2025-11-02T15:32:30.242357-08:00","updated_at":"2025-11-02T15:32:30.242357-08:00","source_repo":"."}
{"id":"bd-au0","content_hash":"755c63ab5b27bc77ee20034d16cc63614a0b3f10a81728f1bde5503cf6615813","title":"Command Set Standardization \u0026 Flag Consistency","description":"Comprehensive improvements to bd command set based on 2025 audit findings.\n\n## Background\nSee docs/command-audit-2025.md for detailed analysis.\n\n## Goals\n1. Standardize flag naming and behavior across all commands\n2. Add missing flags for feature parity\n3. Fix naming confusion\n4. Improve consistency in JSON output\n\n## Success Criteria\n- All mutating commands support --dry-run (no --preview variants)\n- bd update supports label operations\n- bd search has filter parity with bd list\n- Priority flags accept both int and P0-P4 format everywhere\n- JSON output is consistent across all commands","status":"open","priority":2,"issue_type":"epic","created_at":"2025-11-21T21:05:55.672749-05:00","updated_at":"2025-11-21T21:05:55.672749-05:00","source_repo":"."}