Commit Graph

405 Commits

Author SHA1 Message Date
Steve Yegge
2426f556d4 Fix prefix validation critical bugs from oracle review
- Boundary-aware ID replacement (prevents wy-1 corrupting wy-10)
- Sort IDs by length descending before replacement
- Validate configured prefix is not empty
- Validate ID format before renaming (numeric suffix required)
- All critical issues from oracle review addressed
2025-10-21 20:49:03 -07:00
Steve Yegge
7072531843 Document stress test pollution investigation (vc-248) 2025-10-21 20:47:57 -07:00
Steve Yegge
3fda1b803b Update issue status: close bd-188 2025-10-21 20:43:54 -07:00
Steve Yegge
656ee6b65d Update issues.jsonl after bd init fix 2025-10-21 20:39:27 -07:00
Steve Yegge
7f82708b90 Fix bd init to auto-import issues from git on fresh clone
Prevents agents from creating duplicate low-numbered issues when starting
with a fresh git clone that already has issues.jsonl in git history.

Changes:
- bd init now checks for existing issues in git after DB creation
- Auto-imports with collision resolution if found
- Updates AGENTS.md to simplify onboarding (just 'bd init')

Fixes the scenario where:
1. Fresh clone has .beads/issues.jsonl in git (212 issues)
2. Agent runs bd init (creates empty DB)
3. Agent starts creating bd-1, bd-2, etc (collisions with git)

Now bd init automatically imports all issues from git on first run.

Amp-Thread-ID: https://ampcode.com/threads/T-8a41f14d-d4c3-4c50-a18b-5f112110f138
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:38:35 -07:00
Steve Yegge
36bd877e7c Renumber issues to compact ID space (bd-1 to bd-212) 2025-10-21 20:37:38 -07:00
Steve Yegge
2f9bac9b3e Sync issues after daemon work 2025-10-21 20:36:04 -07:00
Steve Yegge
645d268e43 Implement database handshake protocol in RPC layer
- Add ExpectedDB field to RPC Request
- Server validates client's expected DB matches daemon's DB
- Return clear error on mismatch with both paths
- Old clients (no ExpectedDB) still work with warning
- Add Path() method to storage.Storage interface
- Tests verify cross-database connections rejected

Prevents database pollution when client connects to wrong daemon.

Amp-Thread-ID: https://ampcode.com/threads/T-c4454192-39c6-4c67-96a9-675cbfc4db92
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:35:55 -07:00
Steve Yegge
e1a445afd2 Remove global socket fallback, enforce local-only daemons
- Remove ~/.beads/bd.sock fallback in getSocketPath()
- Always return local socket path (.beads/bd.sock)
- Add migration warning if old global socket exists
- Update AGENTS.md to remove global daemon references
- Document breaking change in CHANGELOG.md
- Fix test isolation: tests now use temp .beads dir and chdir

Prevents cross-project daemon connections and database pollution.
Each project must use its own local daemon.

Amp-Thread-ID: https://ampcode.com/threads/T-c4454192-39c6-4c67-96a9-675cbfc4db92
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:35:55 -07:00
Steve Yegge
3e44951f15 Add prefix validation on bulk import
- Detects prefix mismatches during import
- Shows warning with mismatched prefixes and counts
- Added --rename-on-import flag to automatically fix prefixes
- Auto-import is lenient about prefixes (doesn't enforce)
- All tests passing
2025-10-21 20:34:37 -07:00
Steve Yegge
aba982f785 Update issues.jsonl and documentation
Amp-Thread-ID: https://ampcode.com/threads/T-fea21f01-c136-437f-a61f-226872ae7a38
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:29:10 -07:00
Steve Yegge
7fc65c0f26 Sync issue tracking after merge work 2025-10-21 19:57:24 -07:00
Steve Yegge
2de58621a7 Fix misleading 'bd ready' message when all issues closed
Now distinguishes between:
- 'No open work found (all issues are closed)' - when everything is done
- 'No ready work found (all issues have blocking dependencies)' - when work exists but is blocked
2025-10-21 19:54:01 -07:00
Steve Yegge
7ae148cf2b Add --id flag to bd list for filtering by specific issue IDs
- Add --id flag accepting comma-separated IDs
- Implements ID filtering at CLI, RPC, and storage layers
- Normalizes IDs (trim, dedupe, remove empty) like labels
- Guards against excessive ID lists (max 1000)
- Works with other filters (status, priority, etc.)

Closes bd-200

Amp-Thread-ID: https://ampcode.com/threads/T-377464f2-1e7f-46f9-b23e-1e3cfd611061
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 19:53:27 -07:00
Steve Yegge
edd4ec95c5 Implement bd merge command with dependency migration and text references
- Add performMerge() with dependency migration in both directions
- Implement updateMergeTextReferences() for text reference updates
- Close source issues with 'Merged into bd-X' reason
- Fix store initialization panic by checking daemon mode earlier
- Add TODO for transaction support (deferred, see bd-215 for idempotency approach)

Closes bd-202, bd-193, bd-194, bd-195, bd-196
Related: bd-190 (merge epic), bd-215 (idempotency enhancement)

Amp-Thread-ID: https://ampcode.com/threads/T-30fe297d-4713-4f84-abc9-3bd264caa4c6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 19:39:22 -07:00
Steve Yegge
0921cb7eaa Update issues
Amp-Thread-ID: https://ampcode.com/threads/T-887df83f-0ef0-45ee-82ac-776e43e01095
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 19:24:54 -07:00
Steve Yegge
272c56a9b7 Database recovery: Remove 9k test issues, restore clean state
Restored to commit ce13140 (196 legitimate issues) + today's work:
- bd-192: Closed (merge validation implemented)
- bd-191: Updated with simplified approach notes
- bd-200: Created (--id flag feature request from filter-flag-design.md)

Test pollution analysis:
- 3:28pm (743f64d): 186 issues (clean baseline)
- 4:47pm (ce13140): 196 issues (+10 merge epic work) ✓
- 5:48pm (6e29eef): 9365 issues (+9169 test pollution) ✗
- Now: 198 issues (196 + bd-192 closed + bd-200 created) ✓

The 9k test issues (bd-1000 through bd-9169) were accidentally
committed from ~/src/vc test workers that bypassed isolation.

Amp-Thread-ID: https://ampcode.com/threads/T-22945597-9f4f-413b-afde-dcf3099eb2f0
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 18:34:28 -07:00
Steve Yegge
c0807e50e3 Implement merge validation logic (bd-192)
- Add merge command with --into and --dry-run flags
- Validate target and source issues exist
- Validate no self-merge attempts
- Add comprehensive test coverage
- Capture --id flag feature request as bd-9369

Amp-Thread-ID: https://ampcode.com/threads/T-22945597-9f4f-413b-afde-dcf3099eb2f0
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 18:23:17 -07:00
Steve Yegge
6e29eef0c2 Revert bd-191: Remove merged_into schema field
Use simpler approach for bd-190 merge feature:
- Close merged issues with reason 'Merged into bd-X'
- No schema changes or migrations needed
- Parseable close reason is cleaner than separate field

Also updated merge epic child issues with simplified design.
2025-10-21 17:48:09 -07:00
Steve Yegge
ce13140ff2 Add epic bd-190 with 9 child tasks for merge command implementation 2025-10-21 16:47:11 -07:00
Steve Yegge
743f64dd46 Restore clean database state - 186 legitimate issues 2025-10-21 15:28:29 -07:00
Steve Yegge
acc813e528 Fix #94: Handle NULL assignee in epic status query
- Use sql.NullString to scan nullable assignee column
- Prevents 'converting NULL to string is unsupported' error
- Only set assignee if value is valid (not NULL)
2025-10-21 15:01:26 -07:00
Steve Yegge
ec946ee48b Fix #97: Add daemon mode check to rename-prefix command
- Prevents nil pointer dereference when daemon is active
- Ensures direct mode or fails gracefully
- Lower Python requirement to 3.10+ for beads-mcp (#99)

Amp-Thread-ID: https://ampcode.com/threads/T-740c6f9c-b8f0-4155-8bfa-7075eea2df22
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 14:56:18 -07:00
Steve Yegge
52d6fd8deb Sync issue updates: close bd-189, create bd-188 2025-10-21 14:10:26 -07:00
Steve Yegge
3f4878eb09 Auto-import from git on empty DB (bd-189)
- Add checkAndAutoImport() that detects empty DB with issues in git
- Automatically imports from git HEAD:.beads/issues.jsonl
- Integrated into list, ready, and stats commands
- Zero cognitive load for agents in fresh clones
- Makes JSONL truly the source of truth
- DB becomes ephemeral cache that auto-rebuilds

Also:
- Update AGENTS.md onboarding section with import instructions
- Merge PR #98 (enhanced .gitignore)

Amp-Thread-ID: https://ampcode.com/threads/T-ffcb5e95-e5a0-486b-a0ae-ce8bd861ab9d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 14:10:26 -07:00
Ben Madore
cfe15a9d34 Enhance .gitignore created during bd init (#98)
- Expand .gitignore to include all SQLite-related files (journal, WAL, SHM)
- Add daemon runtime files (logs, PID, socket)
- Include legacy database filenames
- Explicitly allow JSONL files with !*.jsonl pattern
- Add test coverage to verify .gitignore content
2025-10-21 13:59:19 -07:00
Steve Yegge
34593cad8c Add RPC support for compact command (bd-184)
- Added OpCompact and OpCompactStats operation constants
- Added CompactArgs, CompactStatsArgs, and response types to RPC protocol
- Implemented handleCompact and handleCompactStats in RPC server
- Updated compact command to use RPC when daemon is available
- Fixed RPC client to include Cwd for proper database routing
- Compact now works in daemon mode with --no-daemon flag

Amp-Thread-ID: https://ampcode.com/threads/T-87885d07-80ad-466d-9ffb-cc96fab4853f
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 00:29:50 -07:00
Steve Yegge
6a6b5099e9 Sync issues from agent updates
Amp-Thread-ID: https://ampcode.com/threads/T-87885d07-80ad-466d-9ffb-cc96fab4853f
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 00:17:05 -07:00
Steve Yegge
3e991d2eea Track GH #66: Implement bd quickstart command (bd-183) 2025-10-21 00:13:31 -07:00
Steve Yegge
f4dd9e09a1 Fix MCP update tool bypassing close approval workflow
- Detect when update is called with status='closed'
- Redirect to close_issue to preserve approval workflow
- Ensures closing tasks always requires same approval regardless of tool used

Fixes #90

Amp-Thread-ID: https://ampcode.com/threads/T-9eab3a82-18f3-4ae3-a2d5-d114811383c1
Co-authored-by: Amp <amp@ampcode.com>
2025-10-20 23:47:56 -07:00
Steve Yegge
f41cd8816e Fix bd-180: bd import now creates database if .beads/ directory exists
Previously, 'bd import' would fail if the database didn't exist, even when
importing into a directory with a .beads/ folder. This made it impossible
to recreate a database from JSONL after schema changes or database removal.

Changes:
- Allow import command to create database when .beads/ directory exists
- Prefer local .beads/vc.db over ancestor databases for import operations
- Enable the workflow: mv .beads/vc.db backup && bd import .beads/issues.jsonl

Fixes #180

Amp-Thread-ID: https://ampcode.com/threads/T-7842ea55-6ce4-4162-9ad8-299124a15946
Co-authored-by: Amp <amp@ampcode.com>
2025-10-20 23:36:40 -07:00
Steve Yegge
50a0846763 chore: Add Homebrew formula for v0.10.1 and remove old formulas 2025-10-20 22:21:08 -07:00
Steve Yegge
19b3200cd4 chore: Bump version to 0.10.1
Updated all component versions:
- bd CLI: 0.10.0 → 0.10.1
- Plugin: 0.10.0 → 0.10.1
- MCP server: 0.9.11 → 0.10.1
- Documentation: 0.10.0 → 0.10.1

Includes fix for bd-179 (derive prefix from database filename)
2025-10-20 22:18:41 -07:00
Steve Yegge
db8efd534c Fix bd-179: Derive prefix from database filename when config missing
- Add dbPath field to SQLiteStorage to track database file path
- Create derivePrefixFromPath() helper to extract prefix from filename
- Update ID generation in CreateIssue() and generateBatchIDs() to use filename fallback
- Fix tests to explicitly set issue_prefix config for bd- prefixed tests

When config doesn't have issue_prefix set, bd now correctly derives it from
the database filename (e.g., wy-.db -> wy) instead of always defaulting to 'bd'.

Fixes: bd-179
2025-10-20 22:18:08 -07:00
Steve Yegge
b6ba8e2e0c Update issue tracking
Amp-Thread-ID: https://ampcode.com/threads/T-f0d1fec1-a98b-4788-84ba-b8f4f74badb8
Co-authored-by: Amp <amp@ampcode.com>
2025-10-20 21:52:41 -07:00
Steve Yegge
1ac24409ec Close follow-up issues from Windows PR review
- bd-176: Signal handling already implemented
- bd-177: Process management already implemented
- bd-178: Windows CI added
2025-10-20 21:28:08 -07:00
Steve Yegge
49275463d2 Add Windows CI build (#bd-178)
- Add windows-latest job to GitHub Actions
- Build bd.exe and run tests on Windows
- Catch cross-platform issues early
2025-10-20 21:27:32 -07:00
Steve Yegge
a86f3e139e Add native Windows support (#91)
- Native Windows daemon using TCP loopback endpoints
- Direct-mode fallback for CLI/daemon compatibility
- Comment operations over RPC
- PowerShell installer script
- Go 1.24 requirement
- Cross-OS testing documented

Co-authored-by: danshapiro <danshapiro@users.noreply.github.com>
Amp-Thread-ID: https://ampcode.com/threads/T-c6230265-055f-4af1-9712-4481061886db
Co-authored-by: Amp <amp@ampcode.com>
2025-10-20 21:08:49 -07:00
Steve Yegge
94a23cae39 Release 0.10.0 - Add bd onboard command
- Update CHANGELOG.md with 0.10.0 release notes
- Clean up dist/ directory (remove 0.9.11 artifacts)
- bd-173: Agent-first onboarding command
2025-10-20 15:48:38 -07:00
Steve Yegge
c3101ff5f1 Add Homebrew formula for 0.10.0 2025-10-20 15:28:35 -07:00
Steve Yegge
5045496bbe Bump version to 0.10.0 2025-10-20 15:27:30 -07:00
Steve Yegge
e10e34b221 Add agent-first 'bd onboard' command (bd-173)
- Refactor bd onboard to output instructions instead of doing string replacement
- Leverage agent intelligence to naturally integrate bd into documentation
- Bootstrap via 'BEFORE ANYTHING ELSE: run bd onboard' in AGENTS.md
- Agent receives formatted instructions to update AGENTS.md and CLAUDE.md
- More agentic approach - adapts to existing project structure
- Update README with new bootstrap workflow

Amp-Thread-ID: https://ampcode.com/threads/T-d70fd1bf-8d44-48b6-bb55-5ae49efb23b8
Co-authored-by: Amp <amp@ampcode.com>
2025-10-20 15:04:33 -07:00
Steve Yegge
01aeed6997 Add 0.9.11 release notes 2025-10-19 23:27:14 -07:00
Steve Yegge
ec9570c045 chore: Bump version to 0.9.11
Updated all component versions:
- bd CLI: 0.9.10 → 0.9.11
- Plugin: 0.9.10 → 0.9.11
- MCP server: 0.9.10 → 0.9.11
- Documentation: 0.9.10 → 0.9.11

Generated by scripts/bump-version.sh
2025-10-19 23:23:39 -07:00
Steve Yegge
095ebc70e6 Fix MCP server None/null crashes in list/ready/stats (bd-172, fixes #79)
Add null safety checks in bd_daemon_client.py:
- list_issues(): Return empty array if issues_data is None
- ready(): Return empty array if issues_data is None
- stats(): Use empty dict if stats_data is None

This prevents TypeError crashes when daemon returns None/empty responses.

Amp-Thread-ID: https://ampcode.com/threads/T-072304c3-3a03-4091-92a9-9e16b4538227
Co-authored-by: Amp <amp@ampcode.com>
2025-10-19 23:23:33 -07:00
Steve Yegge
24cd163afb Add comprehensive label documentation (bd-159, bd-163)
- Create LABELS.md with complete guide to label system
- Document label patterns, filtering, workflows, and best practices
- Add Labels section to README with examples
- Link LABELS.md in documentation section
- Close bd-159 and bd-163

Amp-Thread-ID: https://ampcode.com/threads/T-072304c3-3a03-4091-92a9-9e16b4538227
Co-authored-by: Amp <amp@ampcode.com>
2025-10-19 23:11:52 -07:00
Steve Yegge
422c102f46 Add label filtering to bd list with AND/OR semantics
- Add --label flag for AND filtering (must have ALL labels)
- Add --label-any flag for OR filtering (must have AT LEAST ONE label)
- Add normalizeLabels() helper to trim, dedupe, and clean inputs
- Fix RPC title filtering parity bug (forward via Query field)
- Add comprehensive tests for label filtering including combined AND+OR
- Update documentation in README and CHANGELOG
- Improve flag help text to clarify combined semantics

Closes bd-161
2025-10-19 23:03:02 -07:00
Steve Yegge
f1ec927a7c feat: Add label display to bd show and bd list
- Populate labels in bd list human-readable output (direct mode)
- Populate labels in bd list JSON output (direct and daemon modes)
- Populate labels in daemon RPC handlers (handleList, handleShow)
- handleShow now returns full IssueDetails with labels/deps/dependents
- Labels displayed with 'Labels: [label1, label2]' format

Closes bd-164

Amp-Thread-ID: https://ampcode.com/threads/T-30cd607d-c509-4a8c-9cac-c2aea2ad75c6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-19 22:44:39 -07:00
Steve Yegge
a6035aaf25 test: Add comprehensive version compatibility tests
- Tests for daemon/client version checking
- Covers all compatibility scenarios (major/minor/patch versions)
- Tests legacy client support (empty version)
- Tests health check version reporting
- Tests ping/health bypass version checks
- All 13 test cases pass

Closes bd-160

Amp-Thread-ID: https://ampcode.com/threads/T-30cd607d-c509-4a8c-9cac-c2aea2ad75c6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-19 22:30:48 -07:00
Steve Yegge
7658c4a8e8 Add command documentation and improve daemon UX
- Added human-readable uptime formatting (51m 59s vs 3119.4 seconds)
- Fixed daemon stop race condition with SIGKILL
- Added markdown docs for 19 commands: blocked, comments, compact, daemon,
  delete, dep, epic, export, import, label, list, quickstart, rename-prefix,
  renumber, reopen, repos, restore, stale, sync
- Closed: bd-159, bd-152, bd-168
- Deleted test issues: bd-144, bd-145

Amp-Thread-ID: https://ampcode.com/threads/T-9f7c3fed-62de-4bcd-a059-8c1b77cdb841
Co-authored-by: Amp <amp@ampcode.com>
2025-10-19 22:24:14 -07:00