diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index e1457830..88eede84 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -63,7 +63,7 @@ {"id":"bd-3ggb","title":"Rebuild local binary","description":"Build and verify: go build -o bd ./cmd/bd \u0026\u0026 ./bd version","status":"tombstone","priority":1,"issue_type":"task","created_at":"2025-12-18T22:43:03.101428-08:00","updated_at":"2025-12-24T16:25:30.089869-08:00","dependencies":[{"issue_id":"bd-3ggb","depends_on_id":"bd-qqc","type":"parent-child","created_at":"2025-12-18T22:43:16.748289-08:00","created_by":"daemon"},{"issue_id":"bd-3ggb","depends_on_id":"bd-4y4g","type":"blocks","created_at":"2025-12-18T22:43:20.950376-08:00","created_by":"daemon"}],"deleted_at":"2025-12-24T16:25:30.089869-08:00","deleted_by":"daemon","delete_reason":"delete","original_type":"task"} {"id":"bd-3jcw","title":"activity.go: Missing test coverage","description":"The new activity.go command (from bd-xo1o.3) has no test coverage. At minimum, tests should cover:\n- parseDurationString() for various formats (5m, 1h, 2d, invalid)\n- filterEvents() for --mol and --type filtering\n- formatEvent() and getEventDisplay() for all mutation types\n\nDiscovered during code review of bd-xo1o implementation.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-12-23T04:06:15.563579-08:00","updated_at":"2025-12-23T04:14:56.150151-08:00","closed_at":"2025-12-23T04:14:56.150151-08:00","close_reason":"Added activity_test.go with tests for parseDurationString, filterEvents, getEventDisplay, and formatEvent covering all mutation types"} {"id":"bd-3sz0","title":"Auto-repair stale merge driver configs with invalid placeholders","description":"Old bd versions (\u003c0.24.0) installed merge driver with invalid placeholders %L %R instead of %A %B. Add detection to bd doctor --fix: check if git config merge.beads.driver contains %L or %R, auto-repair to 'bd merge %A %O %A %B'. One-time migration for users who initialized with old versions.","status":"closed","priority":2,"issue_type":"feature","assignee":"beads/morsov","created_at":"2025-11-21T23:16:10.762808-08:00","updated_at":"2025-12-23T23:48:18.11858-08:00","closed_at":"2025-12-23T23:48:18.11858-08:00","close_reason":"Feature already implemented: CheckMergeDriver() detects %L/%R placeholders, fix.MergeDriver() repairs to 'bd merge %A %O %A %B'. Tests pass, manual verification confirms bd doctor --fix works correctly.","dependencies":[{"issue_id":"bd-3sz0","depends_on_id":"bd-tbz3","type":"parent-child","created_at":"2025-11-21T23:16:10.763612-08:00","created_by":"daemon","metadata":"{}"}]} -{"id":"bd-3u8m","title":"Create bd admin parent command and nest cleanup/compact/reset","description":"## Task\nCreate new `bd admin` parent command and move:\n- `bd cleanup` → `bd admin cleanup`\n- `bd compact` → `bd admin compact`\n- `bd reset` → `bd admin reset`\n\n## Implementation\n\n### 1. Create admin.go\nNew file with parent command:\n```go\nvar adminCmd = \u0026cobra.Command{\n Use: \"admin\",\n Short: \"Administrative commands for database maintenance\",\n Long: `Administrative commands for beads database maintenance.\n\nThese commands are for advanced users and should be used carefully:\n cleanup Delete closed issues and prune expired tombstones\n compact Compact old closed issues to save space\n reset Remove all beads data and configuration\n\nFor routine operations, prefer 'bd doctor --fix'.`,\n}\n\nfunc init() {\n rootCmd.AddCommand(adminCmd)\n adminCmd.AddCommand(cleanupCmd)\n adminCmd.AddCommand(compactCmd)\n adminCmd.AddCommand(resetCmd)\n}\n```\n\n### 2. Update cleanup.go, compact.go, reset.go\n- Remove `rootCmd.AddCommand()` from each init()\n- Keep all existing functionality\n\n### 3. Create hidden aliases for backwards compatibility\nTop-level hidden commands that forward to admin subcommands.\n\n### 4. Update docs (major updates)\n- docs/CLI_REFERENCE.md - cleanup, compact references\n- docs/QUICKSTART.md - compact, cleanup references\n- docs/FAQ.md - compact references\n- docs/TROUBLESHOOTING.md - compact references\n- docs/DELETIONS.md - compact reference\n- docs/CONFIG.md - compact reference\n- skills/beads/SKILL.md - compact reference\n- commands/compact.md - update all examples\n- examples/compaction/README.md - update examples\n\n## Files to create\n- cmd/bd/admin.go\n\n## Files to modify\n- cmd/bd/cleanup.go\n- cmd/bd/compact.go\n- cmd/bd/reset.go\n- cmd/bd/main.go (aliases)\n- Multiple docs (see list above)\n","status":"closed","priority":2,"issue_type":"task","assignee":"jasper","created_at":"2025-12-27T15:10:41.836341-08:00","created_by":"mayor","updated_at":"2025-12-27T16:07:30.707323-08:00","closed_at":"2025-12-27T16:07:30.707323-08:00","close_reason":"Implemented bd admin parent command with cleanup/compact/reset subcommands and hidden aliases for backwards compatibility","pinned":true} +{"id":"bd-3u8m","title":"Create bd admin parent command and nest cleanup/compact/reset","description":"## Task\nCreate new `bd admin` parent command and move:\n- `bd cleanup` → `bd admin cleanup`\n- `bd compact` → `bd admin compact`\n- `bd reset` → `bd admin reset`\n\n## Implementation\n\n### 1. Create admin.go\nNew file with parent command:\n```go\nvar adminCmd = \u0026cobra.Command{\n Use: \"admin\",\n Short: \"Administrative commands for database maintenance\",\n Long: `Administrative commands for beads database maintenance.\n\nThese commands are for advanced users and should be used carefully:\n cleanup Delete closed issues and prune expired tombstones\n compact Compact old closed issues to save space\n reset Remove all beads data and configuration\n\nFor routine operations, prefer 'bd doctor --fix'.`,\n}\n\nfunc init() {\n rootCmd.AddCommand(adminCmd)\n adminCmd.AddCommand(cleanupCmd)\n adminCmd.AddCommand(compactCmd)\n adminCmd.AddCommand(resetCmd)\n}\n```\n\n### 2. Update cleanup.go, compact.go, reset.go\n- Remove `rootCmd.AddCommand()` from each init()\n- Keep all existing functionality\n\n### 3. Create hidden aliases for backwards compatibility\nTop-level hidden commands that forward to admin subcommands.\n\n### 4. Update docs (major updates)\n- docs/CLI_REFERENCE.md - cleanup, compact references\n- docs/QUICKSTART.md - compact, cleanup references\n- docs/FAQ.md - compact references\n- docs/TROUBLESHOOTING.md - compact references\n- docs/DELETIONS.md - compact reference\n- docs/CONFIG.md - compact reference\n- skills/beads/SKILL.md - compact reference\n- commands/compact.md - update all examples\n- examples/compaction/README.md - update examples\n\n## Files to create\n- cmd/bd/admin.go\n\n## Files to modify\n- cmd/bd/cleanup.go\n- cmd/bd/compact.go\n- cmd/bd/reset.go\n- cmd/bd/main.go (aliases)\n- Multiple docs (see list above)\n","status":"in_progress","priority":2,"issue_type":"task","assignee":"jasper","created_at":"2025-12-27T15:10:41.836341-08:00","created_by":"mayor","updated_at":"2025-12-27T15:57:27.501626-08:00","pinned":true} {"id":"bd-3uje","title":"Test issue for pin --for","description":"Testing the pin --for flag","status":"tombstone","priority":3,"issue_type":"task","assignee":"test-agent","created_at":"2025-12-22T02:53:43.075522-08:00","updated_at":"2025-12-22T02:54:07.973855-08:00","deleted_at":"2025-12-22T02:54:07.973855-08:00","deleted_by":"daemon","delete_reason":"delete","original_type":"task"} {"id":"bd-3x9o","title":"Merge: bd-by0d","description":"branch: polecat/furiosa\ntarget: main\nsource_issue: bd-by0d\nrig: beads","status":"closed","priority":2,"issue_type":"merge-request","created_at":"2025-12-19T23:21:26.817906-08:00","updated_at":"2025-12-20T23:17:26.998785-08:00","closed_at":"2025-12-20T23:17:26.998785-08:00","close_reason":"Branches nuked, MRs obsolete"} {"id":"bd-3zm7","title":"bd mol advance: Step through molecule execution","description":"Implement bd mol advance for stepping through molecules.\n\n## Command\n\n```bash\nbd mol advance \u003cmol-id\u003e\n```\n\n## Behavior\n\n1. Load molecule state from .beads/molecules/\u003cmol-id\u003e.state.yaml\n2. Find current step\n3. Mark current step completed\n4. Find next available step (respecting needs/deps)\n5. Update state file\n6. Output next step info (or COMPLETE if done)\n\n## Step State Machine\n\n```\npending → in_progress → completed\n```\n\nWhen advancing:\n- Current step: in_progress → completed\n- Next step: pending → in_progress\n\n## Output\n\n```bash\n$ bd mol advance mol-deacon-patrol\n✓ Step inbox-check completed\n→ Next step: spawn-work\n\nTitle: Spawn polecat for ready work\nDescription: ...\n```\n\nOr if complete:\n```bash\n$ bd mol advance mol-deacon-patrol\n✓ Step self-inspect completed\n✓ Molecule COMPLETE\n\nRun bd mol reset to loop, or gt handoff to cycle.\n```\n\n## Files\n\n- cmd/bd/mol_advance.go\n- internal/mol/state.go","status":"closed","priority":0,"issue_type":"task","created_at":"2025-12-24T15:53:31.832867-08:00","updated_at":"2025-12-24T16:53:13.244739-08:00","closed_at":"2025-12-24T16:53:13.244739-08:00","close_reason":"REJECTED: Blocked by bd-hulf which was rejected. The concept of 'advance' is valid but must work by closing the current child bead and traversing the DAG to find the next open step - no external state file.","dependencies":[{"issue_id":"bd-3zm7","depends_on_id":"bd-hulf","type":"blocks","created_at":"2025-12-24T15:53:49.233523-08:00","created_by":"daemon"}]} @@ -94,7 +94,7 @@ {"id":"bd-581b80b3","title":"bd find-duplicates - AI-powered duplicate detection","description":"Find semantically duplicate issues.\n\nApproaches:\n1. Mechanical: Exact title/description matching\n2. Embeddings: Cosine similarity (cheap, scalable)\n3. AI: LLM-based semantic comparison (expensive, accurate)\n\nUses embeddings by default for \u003e100 issues.\n\nFiles: cmd/bd/find_duplicates.go (new)","status":"tombstone","priority":1,"issue_type":"task","created_at":"2025-10-29T20:49:49.126801-07:00","updated_at":"2025-12-25T01:21:01.952723-08:00","close_reason":"Closed","deleted_at":"2025-12-25T01:21:01.952723-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task"} {"id":"bd-589x","title":"HANDOFF: Version 0.30.7 release in progress","description":"## Context\nDoing a 0.30.7 patch release with bug fixes.\n\n## What's done\n- Fixed #657: bd graph nil pointer crash (graph.go:102)\n- Fixed #652: Windows npm installer file lock (postinstall.js)\n- Updated CHANGELOG.md and info.go\n- Pushed to main, CI running (run 20390861825)\n- Created version-bump molecule template (bd-6s61) and instantiated for 0.30.7 (bd-8pyn)\n\n## In progress\nMolecule bd-8pyn has 3 remaining tasks:\n - bd-dxo7: Wait for CI to pass\n - bd-7l70: Verify release artifacts \n - bd-5c91: Update local installation\n\n## Check CI\n gh run list --repo steveyegge/beads --limit 1\n gh run view 20390861825 --repo steveyegge/beads\n\n## New feature filed\nbd-n777: Timer beads for scheduled agent callbacks\nDesign for Deacon-managed timers that can interrupt agents via tmux\n\n## Resume commands\n bd --no-daemon show bd-8pyn\n gh run list --repo steveyegge/beads --limit 1","status":"closed","priority":2,"issue_type":"message","assignee":"beads/dave","created_at":"2025-12-19T23:06:14.902334-08:00","updated_at":"2025-12-20T00:49:51.927111-08:00","closed_at":"2025-12-20T00:25:59.596546-08:00"} {"id":"bd-5b6e","title":"Add tests for helper functions (GetDirtyIssueHash, GetAllDependencyRecords, export hashes)","description":"Several utility functions have 0% coverage:\n- GetDirtyIssueHash (dirty.go)\n- GetAllDependencyRecords (dependencies.go)\n- GetExportHash, SetExportHash, ClearAllExportHashes (hash.go)\n\nThese are lower priority but should have basic coverage.","status":"open","priority":4,"issue_type":"task","created_at":"2025-11-01T22:40:58.989976-07:00","updated_at":"2025-11-01T22:40:58.989976-07:00"} -{"id":"bd-5e9q","title":"Add backwards-compatible aliases and deprecation warnings","description":"## Task\nEnsure backwards compatibility by adding hidden aliases for all moved commands.\n\n## Implementation\n\n### Create aliases.go\nNew file to centralize alias management:\n```go\npackage main\n\nimport (\n \"fmt\"\n \"os\"\n \n \"github.com/spf13/cobra\"\n)\n\n// Deprecated command aliases for backwards compatibility\n// These will be removed in v0.XX.0\n\nfunc init() {\n // migrate-* → migrate *\n addDeprecatedAlias(\"migrate-hash-ids\", \"migrate hash-ids\")\n addDeprecatedAlias(\"migrate-issues\", \"migrate issues\")\n addDeprecatedAlias(\"migrate-sync\", \"migrate sync\")\n addDeprecatedAlias(\"migrate-tombstones\", \"migrate tombstones\")\n \n // top-level → admin *\n addDeprecatedAlias(\"cleanup\", \"admin cleanup\")\n addDeprecatedAlias(\"compact\", \"admin compact\")\n addDeprecatedAlias(\"reset\", \"admin reset\")\n \n // top-level → formula *\n addDeprecatedAlias(\"cook\", \"formula cook\")\n}\n\nfunc addDeprecatedAlias(old, new string) {\n cmd := \u0026cobra.Command{\n Use: old,\n Hidden: true,\n Run: func(cmd *cobra.Command, args []string) {\n fmt.Fprintf(os.Stderr, \"⚠️ '%s' is deprecated, use '%s' instead\\n\", old, new)\n // Forward execution to new command\n },\n }\n rootCmd.AddCommand(cmd)\n}\n```\n\n### Deprecation behavior\n1. First release: Show warning, execute command\n2. One release later: Show warning, still execute\n3. Third release: Remove aliases entirely\n\n## Files to create\n- cmd/bd/aliases.go\n\n## Files to modify \n- cmd/bd/main.go (ensure aliases loaded)\n","status":"closed","priority":2,"issue_type":"task","assignee":"opal","created_at":"2025-12-27T15:11:33.54574-08:00","created_by":"mayor","updated_at":"2025-12-27T16:06:08.157887-08:00","closed_at":"2025-12-27T16:06:08.157887-08:00","close_reason":"Added aliases.go with infrastructure for backwards-compatible command aliases. Aliases only activate after commands are moved to their new locations.","pinned":true} +{"id":"bd-5e9q","title":"Add backwards-compatible aliases and deprecation warnings","description":"## Task\nEnsure backwards compatibility by adding hidden aliases for all moved commands.\n\n## Implementation\n\n### Create aliases.go\nNew file to centralize alias management:\n```go\npackage main\n\nimport (\n \"fmt\"\n \"os\"\n \n \"github.com/spf13/cobra\"\n)\n\n// Deprecated command aliases for backwards compatibility\n// These will be removed in v0.XX.0\n\nfunc init() {\n // migrate-* → migrate *\n addDeprecatedAlias(\"migrate-hash-ids\", \"migrate hash-ids\")\n addDeprecatedAlias(\"migrate-issues\", \"migrate issues\")\n addDeprecatedAlias(\"migrate-sync\", \"migrate sync\")\n addDeprecatedAlias(\"migrate-tombstones\", \"migrate tombstones\")\n \n // top-level → admin *\n addDeprecatedAlias(\"cleanup\", \"admin cleanup\")\n addDeprecatedAlias(\"compact\", \"admin compact\")\n addDeprecatedAlias(\"reset\", \"admin reset\")\n \n // top-level → formula *\n addDeprecatedAlias(\"cook\", \"formula cook\")\n}\n\nfunc addDeprecatedAlias(old, new string) {\n cmd := \u0026cobra.Command{\n Use: old,\n Hidden: true,\n Run: func(cmd *cobra.Command, args []string) {\n fmt.Fprintf(os.Stderr, \"⚠️ '%s' is deprecated, use '%s' instead\\n\", old, new)\n // Forward execution to new command\n },\n }\n rootCmd.AddCommand(cmd)\n}\n```\n\n### Deprecation behavior\n1. First release: Show warning, execute command\n2. One release later: Show warning, still execute\n3. Third release: Remove aliases entirely\n\n## Files to create\n- cmd/bd/aliases.go\n\n## Files to modify \n- cmd/bd/main.go (ensure aliases loaded)\n","status":"in_progress","priority":2,"issue_type":"task","assignee":"opal","created_at":"2025-12-27T15:11:33.54574-08:00","created_by":"mayor","updated_at":"2025-12-27T15:57:30.190321-08:00","pinned":true} {"id":"bd-5exm","title":"Merge: bd-49kw","description":"branch: polecat/nux\ntarget: main\nsource_issue: bd-49kw\nrig: beads","status":"closed","priority":1,"issue_type":"merge-request","created_at":"2025-12-23T20:43:23.156375-08:00","updated_at":"2025-12-23T21:21:57.693169-08:00","closed_at":"2025-12-23T21:21:57.693169-08:00","close_reason":"stale - no code pushed"} {"id":"bd-5hrq","title":"bd doctor: detect issues referenced in commits but still open","description":"Add a doctor check that finds 'orphaned' issues - ones referenced in git commit messages (e.g., 'fix bug (bd-xxx)') but still marked as open in beads.\n\n**Detection logic:**\n1. Get all open issue IDs from beads\n2. Parse git log for issue ID references matching pattern \\(prefix-[a-z0-9.]+\\)\n3. Report issues that appear in commits but are still open\n\n**Output:**\n⚠ Warning: N issues referenced in commits but still open\n bd-xxx: 'Issue title' (commit abc123)\n bd-yyy: 'Issue title' (commit def456)\n \n These may be implemented but not closed. Run 'bd show \u003cid\u003e' to check.\n\n**Implementation:**\n- Add check to doctor/checks.go\n- Use git log parsing (already have git utilities)\n- Match against configured issue_prefix","status":"closed","priority":1,"issue_type":"feature","created_at":"2025-12-21T21:48:08.473165-08:00","updated_at":"2025-12-21T21:55:37.795109-08:00","closed_at":"2025-12-21T21:55:37.795109-08:00","close_reason":"Implemented CheckOrphanedIssues in git.go with 8 test cases. Detects issues referenced in commits (e.g., 'fix bug (bd-xxx)') that are still open. Shows warning with issue IDs and commit hashes."} {"id":"bd-5qim","title":"Optimize GetReadyWork performance - 752ms on 10K database (target: \u003c50ms)","notes":"# Performance Analysis (10K Issue Database)\n\nAnalyzed using CPU profiles from benchmark suite on Apple M2 Pro.\n\n## Operation Performance\n\n| Operation | Time | Allocations | Memory |\n|----------------------------------|---------|-------------|--------|\n| bd ready (GetReadyWork) | ~752ms | 167,466 | 16MB |\n| bd list (SearchIssues no filter) | ~11.6ms | 89,214 | 5.8MB |\n| bd list (SearchIssues filtered) | ~9.2ms | 62,365 | 3.5MB |\n| bd create (CreateIssue) | ~2.6ms | 146 | 8.6KB |\n| bd update (UpdateIssue) | ~0.32ms | 364 | 15KB |\n| bd close (UpdateIssue) | ~0.32ms | 364 | 15KB |\n\n**Target: \u003c50ms for all operations on 10K database**\n\n**Current issue: GetReadyWork is 15x over target (752ms vs 50ms)**\n\n## Root Cause\n\nGetReadyWork (internal/storage/sqlite/ready.go:90-128) uses recursive CTE to propagate blocking:\n- 65x slower than SearchIssues\n- Recalculates entire blocked issue tree on every call\n- Algorithm:\n 1. Find directly blocked issues via 'blocks' dependencies\n 2. Recursively propagate blockage to descendants (max depth: 50)\n 3. Exclude all blocked issues from results\n\n## CPU Profile Analysis\n\n- Database syscalls (pthread_cond_signal, syscall6): ~75%\n- SQLite engine overhead: inherent to recursive CTE\n- Application code (query construction): \u003c1%\n\n**Bottleneck is the recursive CTE query execution, not application code.**\n\n## Optimization Recommendations\n\n### High Impact (Likely to achieve \u003c50ms target)\n\n1. **Cache blocked issue calculation**\n - Add `blocked_issues` table updated on dependency changes\n - Trade write complexity for read speed (ready called \u003e\u003e dependency changes)\n - Eliminates recursive CTE on every read\n\n2. **Add/verify database indexes**\n ```sql\n CREATE INDEX IF NOT EXISTS idx_dependencies_blocked \n ON dependencies(issue_id, type, depends_on_id);\n CREATE INDEX IF NOT EXISTS idx_issues_status \n ON issues(status);\n ```\n\n### Medium Impact\n\n3. **Reduce allocations** (167K allocations for GetReadyWork)\n - Profile `scanIssues()` for object pooling opportunities\n - Reuse slice capacity for repeated calls\n\n### Low Impact (Not recommended)\n- Query optimization for CRUD operations (already \u003c3ms)\n- Connection pooling tuning (not showing in profiles)\n\n## Verification\n\nRun benchmarks to validate optimization:\n```bash\nmake bench-quick\ngo tool pprof -http=:8080 internal/storage/sqlite/bench-cpu-*.prof\n```\n\nProfile files automatically generated in `internal/storage/sqlite/`.","status":"tombstone","priority":0,"issue_type":"bug","created_at":"2025-11-14T09:02:46.507526-08:00","updated_at":"2025-12-25T01:21:01.952723-08:00","deleted_at":"2025-12-25T01:21:01.952723-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"bug"} @@ -348,7 +348,7 @@ {"id":"bd-jke6","title":"Add covering index (label, issue_id) for label queries","description":"GetIssuesByLabel joins labels table but requires table lookup after using idx_labels_label.\n\n**Query (labels.go:165):**\n```sql\nSELECT ... FROM issues i\nJOIN labels l ON i.id = l.issue_id\nWHERE l.label = ?\n```\n\n**Problem:** Current idx_labels_label index doesn't cover issue_id, requiring row lookup.\n\n**Solution:** Add migration:\n```sql\nCREATE INDEX IF NOT EXISTS idx_labels_label_issue ON labels(label, issue_id);\n```\n\nThis is a covering index - query can be satisfied entirely from the index without touching the labels table rows.","status":"closed","priority":3,"issue_type":"task","created_at":"2025-12-22T22:58:51.485354-08:00","updated_at":"2025-12-22T23:15:13.839904-08:00","closed_at":"2025-12-22T23:15:13.839904-08:00","close_reason":"Implemented in migration 026_additional_indexes.go","dependencies":[{"issue_id":"bd-jke6","depends_on_id":"bd-h0we","type":"discovered-from","created_at":"2025-12-22T22:58:51.485984-08:00","created_by":"daemon"}]} {"id":"bd-jv4w","title":"Phase 1.2: Separate bdt executable - Initial structure","description":"Create minimal bdt command structure completely separate from bd. Must not share code, config, or database.\n\n## Subtasks\n1. Create cmd/bdt/ directory with main.go\n2. Implement bdt version, help, and status commands\n3. Configure separate database location: $HOME/.bdt/ (not $HOME/.beads/)\n4. Create separate issues file: issues.toon (not issues.jsonl)\n5. Update build system:\n - Makefile: Add bdt target\n - .goreleaser.yml: Add bdt binary config\n\n## Files to Create\n- cmd/bdt/main.go - Entry point\n- cmd/bdt/version.go - Version handling\n- cmd/bdt/help.go - Help text (separate from bd)\n\n## Success Criteria\n- `make build` produces both `bd` and `bdt` executables\n- `bdt version` shows distinct version output from bd\n- `bdt --help` shows distinct help text\n- bdt uses $HOME/.bdt/ directory (verify with `bdt info`)\n- bd and bdt completely isolated (no shared imports beyond stdlib)","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-19T11:48:34.866877282-07:00","updated_at":"2025-12-19T12:59:11.389296015-07:00","closed_at":"2025-12-19T12:59:11.389296015-07:00"} {"id":"bd-jvu","title":"Add bd update --parent flag to change issue parent","description":"Allow changing an issue's parent with bd update --parent \u003cnew-parent-id\u003e. Useful for reorganizing tasks under different epics or moving issues between hierarchies. Should update the parent-child dependency relationship.","status":"tombstone","priority":3,"issue_type":"feature","created_at":"2025-12-17T22:24:07.274485-08:00","updated_at":"2025-12-25T01:21:01.952723-08:00","deleted_at":"2025-12-25T01:21:01.952723-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"feature"} -{"id":"bd-kff0","title":"Integrate detect-pollution into bd doctor","description":"## Task\nMove `bd detect-pollution` → `bd doctor --check=pollution`\n\n## Current state\n- detect-pollution already shows deprecation hint pointing to doctor\n- Doctor command exists with multiple checks\n\n## Implementation\n\n### 1. Update doctor.go\n- Add pollution check to the doctor checks\n- Add `--check=pollution` flag option\n- Integrate detect-pollution logic\n\n### 2. Update detect_pollution.go\n- Mark as hidden (deprecated)\n- Forward to doctor --check=pollution\n- Keep for one release cycle\n\n### 3. Update docs\n- Remove detect-pollution from any command lists\n- Update doctor docs to include pollution check\n\n## Files to modify\n- cmd/bd/doctor.go\n- cmd/bd/detect_pollution.go\n","status":"closed","priority":2,"issue_type":"task","assignee":"onyx","created_at":"2025-12-27T15:11:10.46326-08:00","created_by":"mayor","updated_at":"2025-12-27T16:04:58.471341-08:00","closed_at":"2025-12-27T16:04:58.471341-08:00","close_reason":"Integrated detect-pollution into bd doctor --check=pollution","pinned":true} +{"id":"bd-kff0","title":"Integrate detect-pollution into bd doctor","description":"## Task\nMove `bd detect-pollution` → `bd doctor --check=pollution`\n\n## Current state\n- detect-pollution already shows deprecation hint pointing to doctor\n- Doctor command exists with multiple checks\n\n## Implementation\n\n### 1. Update doctor.go\n- Add pollution check to the doctor checks\n- Add `--check=pollution` flag option\n- Integrate detect-pollution logic\n\n### 2. Update detect_pollution.go\n- Mark as hidden (deprecated)\n- Forward to doctor --check=pollution\n- Keep for one release cycle\n\n### 3. Update docs\n- Remove detect-pollution from any command lists\n- Update doctor docs to include pollution check\n\n## Files to modify\n- cmd/bd/doctor.go\n- cmd/bd/detect_pollution.go\n","status":"in_progress","priority":2,"issue_type":"task","assignee":"onyx","created_at":"2025-12-27T15:11:10.46326-08:00","created_by":"mayor","updated_at":"2025-12-27T15:57:28.526311-08:00","pinned":true} {"id":"bd-knta","title":"Deacon Patrol","description":"Mayor's daemon patrol loop for handling callbacks, health checks, and cleanup.","status":"tombstone","priority":2,"issue_type":"molecule","created_at":"2025-12-26T13:08:21.233771-08:00","updated_at":"2025-12-27T00:10:54.179341-08:00","deleted_at":"2025-12-27T00:10:54.179341-08:00","deleted_by":"daemon","delete_reason":"delete","original_type":"molecule"} {"id":"bd-kptp","title":"Merge: bd-qioh","description":"branch: polecat/Errata\ntarget: main\nsource_issue: bd-qioh\nrig: beads","status":"closed","priority":2,"issue_type":"merge-request","created_at":"2025-12-23T13:46:08.832073-08:00","updated_at":"2025-12-23T19:12:08.350136-08:00","closed_at":"2025-12-23T19:12:08.350136-08:00","close_reason":"Stale merge-requests from orphaned polecat branches - refinery not processing"} {"id":"bd-kpy","title":"Sync race: rebase-based divergence recovery resurrects tombstones","description":"## Problem\nWhen two repos sync simultaneously, tombstones can be resurrected:\n\n1. Repo A deletes issue (creates tombstone), pushes to sync branch\n2. Repo B (with 'closed' status) exports and tries to push\n3. Push fails (non-fast-forward)\n4. fetchAndRebaseInWorktree does git rebase\n5. Git rebase applies B's 'closed' patch on top of A's 'tombstone'\n6. TEXT-level rebase doesn't invoke beads merge driver\n7. 'closed' overwrites 'tombstone' = resurrection\n\n## Root Cause\nCommitToSyncBranch uses git rebase for divergence recovery, but rebase is text-level, not content-level. The proper content-level merge in PullFromSyncBranch handles tombstones correctly, but it runs AFTER the problematic push.\n\n## Proposed Fix\nOption 1: Don't push in CommitToSyncBranch - let PullFromSyncBranch handle merge+push\nOption 2: Replace git rebase with content-level merge in fetchAndRebaseInWorktree\nOption 3: Reorder sync steps: Export → Pull/Merge → Commit → Push\n\n## Workaround Applied\nExcluded tombstones from orphan detection warnings (commit 1e97d9cc).\n\nSee also: bd-3852 (Add orphan detection migration)","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-12-17T23:29:33.049272-08:00","updated_at":"2025-12-24T22:41:09.184574-08:00","closed_at":"2025-12-24T22:41:09.184574-08:00","close_reason":"Fixed by replacing git rebase with content-level merge in divergence recovery"} @@ -544,7 +544,7 @@ {"id":"bd-trgb","title":"bd sync deleted non-.beads files (skills/beads/*)","description":"On 2025-12-23, commit 7b671662 (bd sync) inadvertently deleted 5 files from skills/beads/ that were added by PR #722 (commit e432fcc8). These files are outside .beads/ and should never be touched by bd sync.\n\nFiles deleted:\n- skills/beads/README.md\n- skills/beads/references/INTEGRATION_PATTERNS.md\n- skills/beads/references/MOLECULES.md\n- skills/beads/references/PATTERNS.md\n- skills/beads/references/TROUBLESHOOTING.md\n\nInvestigation needed:\n1. How did bd sync stage/commit files outside .beads/?\n2. Was this a one-time accident or is there a systematic bug?\n3. Add safeguards to prevent bd sync from touching non-.beads paths\n\nReported via GH#738.","status":"closed","priority":1,"issue_type":"bug","created_at":"2025-12-25T11:56:04.544656-08:00","updated_at":"2025-12-25T12:05:31.785355-08:00","closed_at":"2025-12-25T12:05:31.785355-08:00","close_reason":"Fixed - added pathspec to gitCommit() and commitToExternalBeadsRepo()"} {"id":"bd-ttbf","title":"bd mol reset: Reset molecule to initial state for looping","description":"Implement bd mol reset for patrol loop behavior.\n\n## Command\n\n```bash\nbd mol reset \u003cmol-id\u003e\n```\n\n## Behavior\n\n1. Load molecule state from .beads/molecules/\u003cmol-id\u003e.state.yaml\n2. Reset all step states to pending\n3. Clear current_step (or set to first step)\n4. Preserve: bonded_at, bonded_by, variables\n5. Update: reset_count++, last_reset_at\n\n## Use Case: Deacon Patrol Loop\n\n```\ninbox-check → spawn-work → self-inspect → mol-reset → (loop)\n```\n\nThe Deacon runs its patrol, then resets the molecule to start fresh.\nNo gt handoff needed unless context is high.\n\n## State After Reset\n\n```yaml\nid: mol-deacon-patrol\nstatus: running\ncurrent_step: inbox-check # Back to first\nreset_count: 5\nlast_reset_at: 2025-12-24T...\nsteps:\n inbox-check: pending # All reset\n spawn-work: pending\n self-inspect: pending\n```\n\n## Files\n\n- cmd/bd/mol_reset.go\n- internal/mol/state.go (add Reset method)","status":"closed","priority":0,"issue_type":"task","created_at":"2025-12-24T15:53:20.154106-08:00","updated_at":"2025-12-24T16:53:14.837362-08:00","closed_at":"2025-12-24T16:53:14.837362-08:00","close_reason":"REJECTED: Blocked by bd-hulf which was rejected. The concept of 'reset' is valid but must work by reopening child beads - no external state file.","dependencies":[{"issue_id":"bd-ttbf","depends_on_id":"bd-hulf","type":"blocks","created_at":"2025-12-24T15:53:49.159903-08:00","created_by":"daemon"}]} {"id":"bd-tvu3","title":"Improve test coverage for internal/beads (48.1% → 70%)","description":"Improve test coverage for internal/beads package from 48% to 70%.\n\n## Current State\n- Coverage: 48.4%\n- Files: beads.go, fingerprint.go\n- Tests: beads_test.go (moderate coverage)\n\n## Functions Needing Tests\n\n### beads.go (database discovery)\n- [ ] followRedirect - needs redirect file tests\n- [ ] findDatabaseInBeadsDir - needs various dir structures\n- [x] NewSQLiteStorage - likely covered\n- [ ] FindDatabasePath - needs BEADS_DB env var tests\n- [ ] hasBeadsProjectFiles - needs file existence tests\n- [ ] FindBeadsDir - needs directory traversal tests\n- [ ] FindJSONLPath - needs path derivation tests\n- [ ] findGitRoot - needs git repo tests\n- [ ] findDatabaseInTree - needs nested directory tests\n- [ ] FindAllDatabases - needs multi-database tests\n- [ ] FindWispDir - needs wisp directory tests\n- [ ] FindWispDatabasePath - needs wisp path tests\n- [ ] NewWispStorage - needs wisp storage tests\n- [ ] EnsureWispGitignore - needs gitignore creation tests\n- [ ] IsWispDatabase - needs path classification tests\n\n### fingerprint.go (repo identification)\n- [ ] ComputeRepoID - needs various remote URL tests\n- [ ] canonicalizeGitURL - needs URL normalization tests\n- [ ] GetCloneID - needs clone identification tests\n\n## Implementation Guide\n\n1. **Use temp directories:**\n ```go\n func TestFindBeadsDir(t *testing.T) {\n tmpDir := t.TempDir()\n beadsDir := filepath.Join(tmpDir, \".beads\")\n os.MkdirAll(beadsDir, 0755)\n \n // Create test files\n os.WriteFile(filepath.Join(beadsDir, \"beads.db\"), []byte{}, 0644)\n \n // Change to tmpDir and test\n oldWd, _ := os.Getwd()\n os.Chdir(tmpDir)\n defer os.Chdir(oldWd)\n \n result := FindBeadsDir()\n assert.Equal(t, beadsDir, result)\n }\n ```\n\n2. **Test scenarios:**\n - BEADS_DB environment variable set\n - .beads/ in current directory\n - .beads/ in parent directory\n - Redirect file pointing elsewhere\n - No beads directory found\n - Wisp directory alongside main beads\n\n3. **Git remote URL tests:**\n ```go\n tests := []struct{\n input string\n expected string\n }{\n {\"git@github.com:user/repo.git\", \"github.com/user/repo\"},\n {\"https://github.com/user/repo\", \"github.com/user/repo\"},\n {\"ssh://git@github.com/user/repo.git\", \"github.com/user/repo\"},\n }\n ```\n\n## Success Criteria\n- Coverage ≥ 70%\n- All FindXxx functions have tests\n- Environment variable handling tested\n- Edge cases (missing dirs, redirects) covered\n\n## Run Tests\n```bash\ngo test -v -cover ./internal/beads\ngo test -race ./internal/beads\n```","status":"closed","priority":1,"issue_type":"task","assignee":"beads/Beader","created_at":"2025-12-13T20:42:59.739142-08:00","updated_at":"2025-12-23T13:36:17.885237-08:00","closed_at":"2025-12-23T13:36:17.885237-08:00","close_reason":"Coverage improved from 48.4% to 80.2%, exceeding 70% target","dependencies":[{"issue_id":"bd-tvu3","depends_on_id":"bd-iz5t","type":"parent-child","created_at":"2025-12-23T12:44:07.362967-08:00","created_by":"daemon"}]} -{"id":"bd-twbi","title":"Relocate quickstart to bd help quickstart or docs","description":"## Task\nMove `bd quickstart` → `bd help quickstart` or convert to documentation.\n\n## Options\n\n### Option A: Move to bd help quickstart\n- Create a custom help topic\n- Cobra supports additional help topics\n\n### Option B: Convert to docs only\n- Keep content in docs/QUICKSTART.md\n- Remove the command entirely\n- Update references to point to docs\n\n## Recommendation\nOption B - quickstart is essentially documentation, not a functional command.\nThe command just prints formatted text that could live in docs.\n\n## Implementation (Option B)\n1. Ensure docs/QUICKSTART.md has equivalent content\n2. Add hidden alias that prints \"See docs/QUICKSTART.md or bd help\"\n3. Update all references:\n - README.md\n - docs/INSTALLING.md\n - docs/EXTENDING.md\n - npm-package/INTEGRATION_GUIDE.md\n - .beads/README.md\n\n## Files to modify\n- cmd/bd/quickstart.go (hide or remove)\n- Multiple docs (update references)\n","status":"in_progress","priority":3,"issue_type":"task","created_at":"2025-12-27T15:11:10.238898-08:00","created_by":"mayor","updated_at":"2025-12-27T16:07:10.365066-08:00"} +{"id":"bd-twbi","title":"Relocate quickstart to bd help quickstart or docs","description":"## Task\nMove `bd quickstart` → `bd help quickstart` or convert to documentation.\n\n## Options\n\n### Option A: Move to bd help quickstart\n- Create a custom help topic\n- Cobra supports additional help topics\n\n### Option B: Convert to docs only\n- Keep content in docs/QUICKSTART.md\n- Remove the command entirely\n- Update references to point to docs\n\n## Recommendation\nOption B - quickstart is essentially documentation, not a functional command.\nThe command just prints formatted text that could live in docs.\n\n## Implementation (Option B)\n1. Ensure docs/QUICKSTART.md has equivalent content\n2. Add hidden alias that prints \"See docs/QUICKSTART.md or bd help\"\n3. Update all references:\n - README.md\n - docs/INSTALLING.md\n - docs/EXTENDING.md\n - npm-package/INTEGRATION_GUIDE.md\n - .beads/README.md\n\n## Files to modify\n- cmd/bd/quickstart.go (hide or remove)\n- Multiple docs (update references)\n","status":"open","priority":3,"issue_type":"task","created_at":"2025-12-27T15:11:10.238898-08:00","created_by":"mayor","updated_at":"2025-12-27T15:11:10.238898-08:00"} {"id":"bd-u0g9","title":"GH#405: Prefix parsing with hyphens treats first segment as prefix","description":"Prefix me-py-toolkit gets parsed as just me- when detecting mismatches. Fix prefix parsing to handle multi-hyphen prefixes. See GitHub issue #405.","status":"tombstone","priority":2,"issue_type":"bug","created_at":"2025-12-16T01:03:18.354066-08:00","updated_at":"2025-12-17T16:11:17.070763-08:00","deleted_at":"2025-12-17T16:11:17.070763-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"bug"} {"id":"bd-u0sb","title":"Merge: bd-uqfn","description":"branch: polecat/cheedo\ntarget: main\nsource_issue: bd-uqfn\nrig: beads","status":"closed","priority":2,"issue_type":"merge-request","created_at":"2025-12-20T01:11:52.033964-08:00","updated_at":"2025-12-20T23:17:26.994875-08:00","closed_at":"2025-12-20T23:17:26.994875-08:00","close_reason":"Branches nuked, MRs obsolete"} {"id":"bd-u2sc","title":"GH#692: Code quality and refactoring improvements","description":"Epic for implementing refactoring suggestions from GitHub issue #692 (rsnodgrass). These are code quality improvements that don't change functionality but improve maintainability, type safety, and performance.\n\nOriginal issue: https://github.com/steveyegge/beads/issues/692\n\nHigh priority items:\n1. Replace map[string]interface{} with typed structs for JSON output\n2. Adopt slices.SortFunc instead of sort.Slice (Go 1.21+)\n3. Split large files (sync.go, init.go, show.go)\n4. Introduce slog for structured logging in daemon\n\nLower priority:\n5. Further CLI helper extraction\n6. Preallocate slices in hot paths\n7. Polish items (error wrapping, table-driven parsing)","status":"closed","priority":3,"issue_type":"epic","created_at":"2025-12-22T14:26:31.630004-08:00","updated_at":"2025-12-23T22:07:32.477628-08:00","closed_at":"2025-12-23T22:07:32.477628-08:00","close_reason":"All 4 child tasks completed by swarm","external_ref":"gh-692"} @@ -574,7 +574,7 @@ {"id":"bd-w3z7","title":"Move cook to formula subcommand","description":"## Task\nMove `bd cook` → `bd formula cook`\n\n## Implementation\n\n### 1. Update formula.go\n- Add `cookCmd` as subcommand of `formulaCmd`\n- Import necessary packages from cook.go if not already present\n\n### 2. Update cook.go\n- Remove `rootCmd.AddCommand(cookCmd)` from init()\n- Keep the command implementation as-is\n\n### 3. Create hidden alias for backwards compatibility\n- In main.go or aliases file, add:\n ```go\n aliasCmd := \u0026cobra.Command{\n Use: \"cook\",\n Hidden: true,\n Run: func(cmd *cobra.Command, args []string) {\n // Forward to formula cook\n },\n }\n ```\n\n### 4. Update docs\n- docs/MOLECULES.md - if `bd cook` mentioned\n- CHANGELOG.md - add deprecation notice\n\n## Files to modify\n- cmd/bd/formula.go (add subcommand)\n- cmd/bd/cook.go (change registration)\n- cmd/bd/main.go (add hidden alias)\n","status":"closed","priority":2,"issue_type":"task","assignee":"obsidian","created_at":"2025-12-27T15:10:21.169344-08:00","created_by":"mayor","updated_at":"2025-12-27T16:00:56.582141-08:00","closed_at":"2025-12-27T16:00:56.582141-08:00","close_reason":"Moved bd cook to bd formula cook with hidden alias for backwards compatibility","pinned":true} {"id":"bd-w8g0","title":"test pin issue","status":"tombstone","priority":2,"issue_type":"task","created_at":"2025-12-20T22:44:27.963361-08:00","updated_at":"2025-12-20T22:44:57.977229-08:00","deleted_at":"2025-12-20T22:44:57.977229-08:00","deleted_by":"daemon","delete_reason":"delete","original_type":"task"} {"id":"bd-wa2l","title":"bd cook: Compile formula to proto","description":"Implement the 'bd cook' command that transforms formulas into protos:\n\nUsage: bd cook \u003cformula-file\u003e [options]\n bd cook .beads/formulas/*.formula.yaml\n\nProcess:\n1. Parse formula YAML (uses formula parser)\n2. Resolve extends (formula inheritance)\n3. Expand macros (expansion rules)\n4. Apply aspects (cross-cutting concerns)\n5. Generate flat proto bead\n\nOutput:\n- Creates proto bead in .beads/ with mol-prefix\n- Proto has all steps pre-expanded\n- Proto is ready for pour/wisp instantiation\n\nExample:\n bd cook .beads/formulas/mol-deacon-patrol.formula.yaml\n → Creates mol-deacon-patrol proto bead\n\nGas Town tracking: gt-8tmz.13","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-24T13:19:53.66483-08:00","updated_at":"2025-12-24T13:44:20.020124-08:00","closed_at":"2025-12-24T13:44:20.020124-08:00","close_reason":"Implemented by Dave","dependencies":[{"issue_id":"bd-wa2l","depends_on_id":"bd-weu8","type":"blocks","created_at":"2025-12-24T13:20:00.070003-08:00","created_by":"daemon"}]} -{"id":"bd-wb9g","title":"Relocate thanks command to bd info --thanks","description":"## Task\nMove `bd thanks` → `bd info --thanks`\n\n## Implementation\n\n### 1. Update info.go\n- Add `--thanks` flag\n- Import thanks.go display logic\n- When --thanks flag set, call thanks display function\n\n### 2. Update thanks.go\n- Export the display function (rename to public)\n- Remove rootCmd.AddCommand()\n- Optionally keep as hidden alias\n\n### 3. Update docs\n- README.md if mentioned\n- CHANGELOG.md - deprecation notice\n\n## Files to modify\n- cmd/bd/info.go\n- cmd/bd/thanks.go\n","status":"closed","priority":3,"issue_type":"task","created_at":"2025-12-27T15:11:10.019562-08:00","created_by":"mayor","updated_at":"2025-12-27T16:08:21.488428-08:00","closed_at":"2025-12-27T16:08:21.488428-08:00","close_reason":"Relocated to bd info --thanks; bd thanks is now hidden alias"} +{"id":"bd-wb9g","title":"Relocate thanks command to bd info --thanks","description":"## Task\nMove `bd thanks` → `bd info --thanks`\n\n## Implementation\n\n### 1. Update info.go\n- Add `--thanks` flag\n- Import thanks.go display logic\n- When --thanks flag set, call thanks display function\n\n### 2. Update thanks.go\n- Export the display function (rename to public)\n- Remove rootCmd.AddCommand()\n- Optionally keep as hidden alias\n\n### 3. Update docs\n- README.md if mentioned\n- CHANGELOG.md - deprecation notice\n\n## Files to modify\n- cmd/bd/info.go\n- cmd/bd/thanks.go\n","status":"open","priority":3,"issue_type":"task","created_at":"2025-12-27T15:11:10.019562-08:00","created_by":"mayor","updated_at":"2025-12-27T15:11:10.019562-08:00"} {"id":"bd-wc2","title":"Test body-file","description":"This is a test description from a file.\n\nIt has multiple lines.\n","status":"tombstone","priority":4,"issue_type":"task","created_at":"2025-12-17T17:27:20.508724-08:00","updated_at":"2025-12-25T01:21:01.952723-08:00","deleted_at":"2025-12-25T01:21:01.952723-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task"} {"id":"bd-weu8","title":"Formula parser: YAML schema for .formula.yaml files","description":"Implement formula parsing from YAML:\n- Define YAML schema for .formula.yaml files\n- Parse steps, compose rules, vars\n- Support extends for formula inheritance\n- Validate formula structure\n\nSchema should support:\n- formula: name\n- description: text\n- version: number\n- type: workflow|expansion|aspect\n- vars: variable definitions\n- steps: step definitions\n- compose: composition rules\n\nGas Town tracking: gt-8tmz.12","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-24T13:19:41.30319-08:00","updated_at":"2025-12-24T13:44:20.018577-08:00","closed_at":"2025-12-24T13:44:20.018577-08:00","close_reason":"Implemented by Dave"} {"id":"bd-whgv","title":"Merge: bd-401h","description":"branch: polecat/rictus\ntarget: main\nsource_issue: bd-401h\nrig: beads","status":"closed","priority":2,"issue_type":"merge-request","created_at":"2025-12-19T23:20:37.854953-08:00","updated_at":"2025-12-20T23:17:26.999477-08:00","closed_at":"2025-12-20T23:17:26.999477-08:00","close_reason":"Branches nuked, MRs obsolete"} diff --git a/cmd/bd/detect_pollution.go b/cmd/bd/detect_pollution.go index 7e674bb0..d733392c 100644 --- a/cmd/bd/detect_pollution.go +++ b/cmd/bd/detect_pollution.go @@ -12,15 +12,17 @@ import ( "github.com/steveyegge/beads/internal/ui" ) -// showDetectPollutionDeprecationHint shows a hint about bd doctor consolidation (bd-bqcc) +// showDetectPollutionDeprecationHint shows a hint about bd doctor consolidation (bd-kff0) func showDetectPollutionDeprecationHint() { - fmt.Fprintln(os.Stderr, ui.RenderMuted("💡 Tip: 'bd doctor' now detects test pollution in the Metadata section")) + fmt.Fprintln(os.Stderr, ui.RenderMuted("💡 Tip: Use 'bd doctor --check=pollution' instead (this command is deprecated)")) } var detectPollutionCmd = &cobra.Command{ - Use: "detect-pollution", - GroupID: "maint", - Short: "Detect and optionally clean test issues from database", + Use: "detect-pollution", + GroupID: "maint", + Hidden: true, // bd-kff0: deprecated, use 'bd doctor --check=pollution' instead + Deprecated: "use 'bd doctor --check=pollution' instead", + Short: "Detect and optionally clean test issues from database", Long: `Detect test issues that leaked into production database using pattern matching. This command finds issues that appear to be test data based on: diff --git a/cmd/bd/doctor.go b/cmd/bd/doctor.go index e065a8be..c06b2039 100644 --- a/cmd/bd/doctor.go +++ b/cmd/bd/doctor.go @@ -19,6 +19,7 @@ import ( "github.com/steveyegge/beads/internal/beads" "github.com/steveyegge/beads/internal/configfile" "github.com/steveyegge/beads/internal/syncbranch" + "github.com/steveyegge/beads/internal/types" "github.com/steveyegge/beads/internal/ui" ) @@ -56,6 +57,8 @@ var ( doctorFixChildParent bool // bd-cuek: opt-in fix for child→parent deps perfMode bool checkHealthMode bool + doctorCheckFlag string // bd-kff0: run specific check (e.g., "pollution") + doctorClean bool // bd-kff0: for pollution check, delete detected issues ) // ConfigKeyHintsDoctor is the config key for suppressing doctor hints @@ -98,6 +101,10 @@ Export Mode (--output): Save diagnostics to a JSON file for historical analysis and bug reporting. Includes timestamp and platform info for tracking intermittent issues. +Specific Check Mode (--check): + Run a specific check in detail. Available checks: + - pollution: Detect and optionally clean test issues from database + Examples: bd doctor # Check current directory bd doctor /path/to/repo # Check specific repository @@ -108,7 +115,9 @@ Examples: bd doctor --fix --fix-child-parent # Also fix child→parent deps (opt-in) bd doctor --dry-run # Preview what --fix would do without making changes bd doctor --perf # Performance diagnostics - bd doctor --output diagnostics.json # Export diagnostics to file`, + bd doctor --output diagnostics.json # Export diagnostics to file + bd doctor --check=pollution # Show potential test issues + bd doctor --check=pollution --clean # Delete test issues (with confirmation)`, Run: func(cmd *cobra.Command, args []string) { // Use global jsonOutput set by PersistentPreRun @@ -137,6 +146,19 @@ Examples: return } + // Run specific check if --check flag is set (bd-kff0) + if doctorCheckFlag != "" { + switch doctorCheckFlag { + case "pollution": + runPollutionCheck(absPath, doctorClean, doctorYes) + return + default: + fmt.Fprintf(os.Stderr, "Error: unknown check %q\n", doctorCheckFlag) + fmt.Fprintf(os.Stderr, "Available checks: pollution\n") + os.Exit(1) + } + } + // Run diagnostics result := runDiagnostics(absPath) @@ -457,7 +479,7 @@ func applyFixList(path string, fixes []doctorCheck) { continue case "Test Pollution": // No auto-fix: test cleanup requires user review - fmt.Printf(" ⚠ Run 'bd detect-pollution' to review and clean test issues\n") + fmt.Printf(" ⚠ Run 'bd doctor --check=pollution' to review and clean test issues\n") continue case "Git Conflicts": // No auto-fix: git conflicts require manual resolution @@ -1081,9 +1103,145 @@ func printDiagnostics(result doctorResult) { } } +// runPollutionCheck runs detailed test pollution detection (bd-kff0) +// This integrates the detect-pollution command functionality into doctor. +func runPollutionCheck(path string, clean bool, yes bool) { + // Ensure we have a store initialized (uses direct mode, no daemon support yet) + if err := ensureDirectMode("pollution check requires direct mode"); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } + + ctx := rootCtx + + // Get all issues + allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{}) + if err != nil { + fmt.Fprintf(os.Stderr, "Error fetching issues: %v\n", err) + os.Exit(1) + } + + // Detect pollution (reuse detectTestPollution from detect_pollution.go) + polluted := detectTestPollution(allIssues) + + if len(polluted) == 0 { + if !jsonOutput { + fmt.Println("No test pollution detected!") + } else { + outputJSON(map[string]interface{}{ + "polluted_count": 0, + "issues": []interface{}{}, + }) + } + return + } + + // Categorize by confidence + highConfidence := []pollutionResult{} + mediumConfidence := []pollutionResult{} + + for _, p := range polluted { + if p.score >= 0.9 { + highConfidence = append(highConfidence, p) + } else { + mediumConfidence = append(mediumConfidence, p) + } + } + + if jsonOutput { + result := map[string]interface{}{ + "polluted_count": len(polluted), + "high_confidence": len(highConfidence), + "medium_confidence": len(mediumConfidence), + "issues": []map[string]interface{}{}, + } + + for _, p := range polluted { + result["issues"] = append(result["issues"].([]map[string]interface{}), map[string]interface{}{ + "id": p.issue.ID, + "title": p.issue.Title, + "score": p.score, + "reasons": p.reasons, + "created_at": p.issue.CreatedAt, + }) + } + + outputJSON(result) + return + } + + // Human-readable output + fmt.Printf("Found %d potential test issues:\n\n", len(polluted)) + + if len(highConfidence) > 0 { + fmt.Printf("High Confidence (score ≥ 0.9):\n") + for _, p := range highConfidence { + fmt.Printf(" %s: %q (score: %.2f)\n", p.issue.ID, p.issue.Title, p.score) + for _, reason := range p.reasons { + fmt.Printf(" - %s\n", reason) + } + } + fmt.Printf(" (Total: %d issues)\n\n", len(highConfidence)) + } + + if len(mediumConfidence) > 0 { + fmt.Printf("Medium Confidence (score 0.7-0.9):\n") + for _, p := range mediumConfidence { + fmt.Printf(" %s: %q (score: %.2f)\n", p.issue.ID, p.issue.Title, p.score) + for _, reason := range p.reasons { + fmt.Printf(" - %s\n", reason) + } + } + fmt.Printf(" (Total: %d issues)\n\n", len(mediumConfidence)) + } + + if !clean { + fmt.Printf("Run 'bd doctor --check=pollution --clean' to delete these issues (with confirmation).\n") + return + } + + // Confirmation prompt + if !yes { + fmt.Printf("\nDelete %d test issues? [y/N] ", len(polluted)) + var response string + _, _ = fmt.Scanln(&response) + if strings.ToLower(response) != "y" { + fmt.Println("Canceled.") + return + } + } + + // Backup to JSONL before deleting + backupPath := ".beads/pollution-backup.jsonl" + if err := backupPollutedIssues(polluted, backupPath); err != nil { + fmt.Fprintf(os.Stderr, "Error backing up issues: %v\n", err) + os.Exit(1) + } + fmt.Printf("Backed up %d issues to %s\n", len(polluted), backupPath) + + // Delete issues + fmt.Printf("\nDeleting %d issues...\n", len(polluted)) + deleted := 0 + for _, p := range polluted { + if err := deleteIssue(ctx, p.issue.ID); err != nil { + fmt.Fprintf(os.Stderr, "Error deleting %s: %v\n", p.issue.ID, err) + continue + } + deleted++ + } + + // Schedule auto-flush + markDirtyAndScheduleFlush() + + fmt.Printf("%s Deleted %d test issues\n", ui.RenderPass("✓"), deleted) + fmt.Printf("\nCleanup complete. To restore, run: bd import %s\n", backupPath) +} + func init() { rootCmd.AddCommand(doctorCmd) doctorCmd.Flags().BoolVar(&perfMode, "perf", false, "Run performance diagnostics and generate CPU profile") doctorCmd.Flags().BoolVar(&checkHealthMode, "check-health", false, "Quick health check for git hooks (silent on success)") doctorCmd.Flags().StringVarP(&doctorOutput, "output", "o", "", "Export diagnostics to JSON file (bd-9cc)") + doctorCmd.Flags().StringVar(&doctorCheckFlag, "check", "", "Run specific check in detail (e.g., 'pollution')") + doctorCmd.Flags().BoolVar(&doctorClean, "clean", false, "For pollution check: delete detected test issues") } diff --git a/cmd/bd/doctor/validation.go b/cmd/bd/doctor/validation.go index ca03c29f..17323795 100644 --- a/cmd/bd/doctor/validation.go +++ b/cmd/bd/doctor/validation.go @@ -304,7 +304,7 @@ func CheckTestPollution(path string) DoctorCheck { Status: "warning", Message: fmt.Sprintf("%d potential test issue(s) detected", count), Detail: "Test issues may have leaked into production database", - Fix: "Run 'bd detect-pollution' to review and clean test issues", + Fix: "Run 'bd doctor --check=pollution' to review and clean test issues", } }