Commit Graph

51 Commits

Author SHA1 Message Date
Steve Yegge
10a313e3a6 Add integration tests for worktree workflow with separate databases
- Created test_worktree_separate_dbs.py with 6 comprehensive tests
- Verifies recommended workflow: one .beads database per worktree
- Tests confirm MCP works with BEADS_USE_DAEMON=0 in worktrees
- Validates database isolation, git syncing, and --no-daemon flag
- All tests passing

Addresses GH #119

Amp-Thread-ID: https://ampcode.com/threads/T-57d5c589-0522-4059-8183-2f0f7f1dccba
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 13:06:05 -07:00
Steve Yegge
4f560379f2 Add description parameter to bd update command and MCP server
Fixes #114 and #122 by adding --description/-d flag to bd update CLI
and description parameter to MCP update_issue tool.

Changes:
- CLI: Added --description flag to updateCmd
- RPC: Added Description field to UpdateArgs
- Daemon: Updated updatesFromArgs to handle description
- MCP: Added description to update_issue, UpdateIssueParams, and clients
- Storage: description already supported in allowedUpdateFields

Tested in both daemon and direct modes.
2025-10-23 11:00:19 -07:00
Steve Yegge
09a9865087 chore: Bump version to 0.14.0
Updated all component versions:
- bd CLI: 0.12.0 → 0.14.0
- Plugin: 0.12.0 → 0.14.0
- MCP server: 0.12.0 → 0.14.0
- Documentation: 0.12.0 → 0.14.0

Generated by scripts/bump-version.sh
2025-10-22 23:15:18 -07:00
Steve Yegge
d0bd0a7e0d chore: Bump version to 0.12.0
Updated all component versions:
- bd CLI: 0.11.0 → 0.12.0
- Plugin: 0.11.0 → 0.12.0
- MCP server: 0.11.0 → 0.12.0
- Documentation: 0.11.0 → 0.12.0

Generated by scripts/bump-version.sh
2025-10-22 18:24:27 -07:00
Steve Yegge
935470a3d8 Fix MCP close method signature bug (GH #107, bd-67)
- Fix BdDaemonClient.close() to accept issue_id and reason parameters
- Remove uv.lock from repo

Amp-Thread-ID: https://ampcode.com/threads/T-0017f48d-605c-410f-9a77-db62153c9357
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 17:53:28 -07:00
Steve Yegge
42762188ed Fix MCP close tool method signature error (GH #107)
Renamed BdDaemonClient.close() cleanup method to cleanup() to eliminate
method name collision with async close(params) method for closing issues.

Root cause: Python method resolution meant the non-async close(self)
cleanup method was shadowing the async close(self, params) method that
closes issues, causing 'takes 1 positional argument but 2 were given'.

Changes:
- bd_daemon_client.py: Renamed close() -> cleanup()
- server.py: Updated cleanup code to call cleanup() instead of close()
- test_lifecycle.py: Updated tests to use cleanup()

All close-related tests pass. Fixes GitHub issue #107.
Tracked in bd-67 (closed).
2025-10-22 17:43:11 -07:00
Steve Yegge
2a032ae3ba chore: Bump version to 0.11.0
Updated all component versions:
- bd CLI: 0.10.1 → 0.11.0
- Plugin: 0.10.1 → 0.11.0
- MCP server: 0.10.1 → 0.11.0
- Documentation: 0.10.1 → 0.11.0

Generated by scripts/bump-version.sh
2025-10-22 01:09:25 -07:00
mountaintopsolutions
0f044117b4 Normalize --acceptance flag for bd update command (#102)
- Update bd update to use --acceptance instead of --acceptance-criteria
- Update MCP client to use --acceptance flag
- Simplify SKILL.md documentation now that both commands use same flag

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-22 00:15:54 -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
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
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
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
5045496bbe Bump version to 0.10.0 2025-10-20 15:27:30 -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
bf43215dd1 Fix bd-167: Handle Amp's workspace_root parameter injection
- Add workspace_root param to all MCP tool signatures (accepted but ignored)
- Fix where_am_i to accept workspace_root
- Fix set_context to always set env vars even when DB not found
- Allows init to work immediately after set_context
2025-10-19 21:36:07 -07:00
Steve Yegge
5e0030d283 Add lifecycle management for beads-mcp processes (bd-148)
- Register atexit handler to close daemon connections
- Add signal handlers for SIGTERM/SIGINT for graceful shutdown
- Implement cleanup() to close all daemon client connections
- Track daemon clients globally for cleanup
- Add close() method to BdDaemonClient (no-op since connections are per-request)
- Register client on first use via _get_client()
- Add comprehensive lifecycle tests

This prevents MCP server processes from accumulating without cleanup.
Each tool invocation will now properly clean up on exit.

Amp-Thread-ID: https://ampcode.com/threads/T-05d76b8e-dac9-472b-bfd0-afe10e3457cd
Co-authored-by: Amp <amp@ampcode.com>
2025-10-18 14:27:37 -07:00
Steve Yegge
0795797bac docs: Document multi-repo workflow with global daemon
Implements bd-122: Document how to use beads across multiple projects

Added comprehensive multi-repo documentation:
- README.md: Global daemon section with architecture diagram
- AGENTS.md: MCP multi-repo configuration (global daemon + per-project)
- integrations/beads-mcp/README.md: BEADS_WORKING_DIR usage
- Mermaid diagram showing one daemon serving multiple repos

Documentation covers:
- Global daemon (bd daemon --global) for system-wide usage
- Per-project MCP instances with BEADS_WORKING_DIR
- Comparison table (local vs global)
- When to use each approach
- Example workflows for multi-project setups

Benefits of global daemon:
- One daemon process for all repos
- Automatic socket discovery (local -> global fallback)
- Better resource usage
- Per-request context routing to correct database

Amp-Thread-ID: https://ampcode.com/threads/T-ea606216-b886-4af0-bba8-56d000362d01
Co-authored-by: Amp <amp@ampcode.com>
2025-10-17 22:49:22 -07:00
Steve Yegge
958bbc0853 feat(daemon): Add --global flag for multi-repo support
Implements bd-121: Global daemon with system-wide socket

Changes:
- Add --global flag to daemon command
- Use ~/.beads/bd.sock when --global is set
- Skip git repo validation for global daemon
- Update daemon discovery to check ~/.beads/ as fallback
- Both Go CLI and Python MCP client check global socket
- Update all tests to pass global parameter

Benefits:
- Single daemon serves all repos on system
- No per-repo daemon management needed
- Better resource usage for users with many repos
- Automatic fallback when local daemon not running

Usage:
  bd daemon --global         # Start global daemon
  bd daemon --status --global # Check global status
  bd daemon --stop --global   # Stop global daemon

Related: bd-73 (multi-repo epic)
Amp-Thread-ID: https://ampcode.com/threads/T-ea606216-b886-4af0-bba8-56d000362d01
Co-authored-by: Amp <amp@ampcode.com>
2025-10-17 22:45:33 -07:00
Steve Yegge
3446bb0ee4 Merge pull request #76 from ghoseb/fix/windows-stdio-crash
fix(mcp): Fix AsyncIO crash on Windows
2025-10-17 22:25:42 -07:00
Michael Shuffett
74b460b298 fix(mcp): Fix three critical bugs in beads MCP plugin
This PR fixes three bugs that prevented the MCP plugin from working:

1. **Fixed parameter name mismatch in tools.py**
   - Changed `workspace_root=workspace_root` to `working_dir=workspace_root`
   - The `create_bd_client()` function expects `working_dir` parameter,
     but tools.py was passing `workspace_root`
   - This caused "got an unexpected keyword argument 'workspace_root'" error

2. **Added version check guard for daemon client**
   - Added `hasattr(_client, '_check_version')` check before calling
   - BdDaemonClient doesn't have `_check_version()` method, only BdCliClient does
   - This caused "'BdDaemonClient' object has no attribute '_check_version'" error

3. **Implemented proper daemon socket detection for fallback**
   - Added synchronous socket file existence check before creating daemon client
   - Walks up directory tree looking for `.beads/bd.sock` file
   - Only creates daemon client if socket exists, otherwise falls back to CLI
   - Previously, daemon client was created but failed on first method call
   - This enables the documented "prefer_daemon with automatic CLI fallback" behavior

**Testing:**
- Verified MCP tools work correctly with single-repo setup
- Confirmed automatic fallback to CLI when daemon isn't running
- Tested on macOS with bd v0.9.9

**Related Issues:**
- Addresses symptoms similar to #65 (Windows BEADS_WORKING_DIR issue)
2025-10-17 21:16:19 -07:00
Baishampayan Ghose
67739fbdc7 fix(mcp): Fix AsyncIO crash on Windows
Since our implementation uses `async` IO for subprocess communication, it's
crucial to utilize the `fastMCP.run_async()` entry-point of FastMCP.

This should fix crashes on Windows.

ref: steveyegge/beads#53
2025-10-18 09:45:17 +05:30
Steve Yegge
52e2993bf6 chore: Bump version to 0.9.10
Updated all component versions:
- bd CLI: 0.9.9 → 0.9.10
- Plugin: 0.9.9 → 0.9.10
- MCP server: 0.9.9 → 0.9.10
- Documentation: 0.9.9 → 0.9.10

Generated by scripts/bump-version.sh
2025-10-17 18:15:29 -07:00
Steve Yegge
ac5578d5f1 Complete daemon RPC with per-request context routing (bd-115)
- MCP server now uses daemon client by default with CLI fallback
- Added BEADS_USE_DAEMON environment variable (default: enabled)
- Created multi-repo integration test (all tests pass)
- Updated .gitignore for daemon runtime files
- Added SETUP_DAEMON.md with migration instructions
- Closed bd-105 (investigation complete) and bd-114 (multi-server confusion)

This enables single MCP server to handle multiple repos via daemon
with per-request context routing. No more multiple MCP server configs!

Amp-Thread-ID: https://ampcode.com/threads/T-c222692e-f6ef-4649-9726-db59470b82ef
Co-authored-by: Amp <amp@ampcode.com>
2025-10-17 16:55:14 -07:00
Steve Yegge
b40de9bc41 Implement daemon RPC with per-request context routing (bd-115)
- Added per-request storage routing in daemon server
  - Server now supports Cwd field in requests for database discovery
  - Tree-walking to find .beads/*.db from any working directory
  - Storage caching for performance across requests

- Created Python daemon client (bd_daemon_client.py)
  - RPC over Unix socket communication
  - Implements full BdClientBase interface
  - Auto-discovery of daemon socket from working directory

- Refactored bd_client.py with abstract interface
  - BdClientBase abstract class for common interface
  - BdCliClient for CLI-based operations (renamed from BdClient)
  - create_bd_client() factory with daemon/CLI fallback
  - Backwards-compatible BdClient alias

Next: Update MCP server to use daemon client when available
2025-10-17 16:28:29 -07:00
Steve Yegge
ff0ce6c3a7 Improve MCP client working directory handling
- Use os.getcwd() directly instead of PWD fallback (more reliable)
- Add cwd parameter to _run_command for per-command overrides

Amp-Thread-ID: https://ampcode.com/threads/T-bf7caacc-f242-4224-b730-1f4442a7ed50
Co-authored-by: Amp <amp@ampcode.com>
2025-10-17 14:22:26 -07:00
Steve Yegge
a971762b0e Remove ~/.beads fallback behavior
- Remove ~/.beads/default.db fallback from FindDatabasePath()
- Update daemon to error if no database found instead of falling back
- Update main.go to require explicit database initialization
- Add help/version/quickstart to commands that don't need database
- Add MCP client debug logging for database routing

Amp-Thread-ID: https://ampcode.com/threads/T-2b757a14-cf10-400e-a83c-30349182dd82
Co-authored-by: Amp <amp@ampcode.com>
2025-10-17 10:56:52 -07:00
Steve Yegge
1a82bbaee3 chore: Bump version to 0.9.9
Updated all component versions:
- bd CLI: 0.9.8 → 0.9.9
- Plugin: 0.9.8 → 0.9.9
- MCP server: 0.9.8 → 0.9.9
- Documentation: 0.9.8 → 0.9.9

Generated by scripts/bump-version.sh
2025-10-17 00:33:27 -07:00
Steve Yegge
1eb59fa120 chore: Bump version to 0.9.8
Updated all component versions:
- bd CLI: 0.9.7 → 0.9.8
- Plugin: 0.9.7 → 0.9.8
- MCP server: 0.9.7 → 0.9.8
- Documentation: 0.9.7 → 0.9.8

Generated by scripts/bump-version.sh
2025-10-16 15:10:43 -07:00
Baishampayan Ghose
32a718dacd feat(mcp): Add reopen command support for closed issues
Implements the `bd` reopen command across the entire MCP stack, enabling
agents to reopen closed issues with optional reason tracking for audit
trails. This addresses the need to handle regressions and incorrectly
closed issues without manual `bd` CLI intervention.

The reopen command is more explicit than `bd update --status open` and
emits a dedicated Reopened event in the audit log, making it easier to
track why issues were reopened during analysis.

Changes:
  - `models.py`: Add ReopenIssueParams with issue_ids list and optional reason
  - `bd_client.py`: Implement reopen() method with JSON response parsing
  - `tools.py`: Add beads_reopen_issue() wrapper with Annotated types for MCP
  - `server.py`: Register 'reopen' MCP tool with description and parameters

Testing (10 new):
  - `test_bd_client.py`: 4 unit tests (mocked subprocess)
  - `test_bd_client_integration.py`: 3 integration tests (real `bd` CLI)
  - `test_mcp_server_integration.py`: 3 MCP integration tests (FastMCP Client)
  - `test_tools.py`: 3 tools wrapper tests (mocked BdClient)

Also updated `README.md`.
2025-10-16 12:01:04 -07:00
Steve Yegge
7106df48e7 chore: Bump version to 0.9.7
Updated all component versions:
- bd CLI: 0.9.6 → 0.9.7
- Plugin: 0.9.6 → 0.9.7
- MCP server: 0.9.6 → 0.9.7
- Documentation: 0.9.6 → 0.9.7

Generated by scripts/bump-version.sh
2025-10-15 12:47:26 -07:00
Steve Yegge
691f90f833 Auto-fix remaining linting issues - remove unused imports 2025-10-15 11:45:11 -07:00
Steve Yegge
3347fd65ca Fix remaining linting issues - combine nested with statements 2025-10-15 11:44:59 -07:00
Baishampayan Ghose
4353592fe6 test(mcp): Fix two failing integration tests and linting errors
1. Fix `test_default_beads_path_auto_detection`
    - Changed beads_path to use `Field(default_factory=_default_beads_path)` so the default is evaluated at instance
    creation time, not class definition time
    - Updated test to mock both `shutil.which` and `os.access`
2. Fix `test_init_creates_beads_directory`
    - Fixed test to pass `working_dir=temp_dir` to `BdClient` instead of using `os.chdir()`
    - The `_get_working_dir()` method checks `PWD` env var first, which isn't updated by `os.chdir()`
3. Fix minor linting errors reported by `ruff` tool
4. Update `beads` version to `0.9.6` in `uv.lock` file

MCP Server test coverage is now excellent, at 92% overall maintaining our high-standards of production level quality.

```
Name                         Stmts   Miss  Cover
------------------------------------------------
src/beads_mcp/__init__.py        1      0   100%
src/beads_mcp/__main__.py        3      3     0%
src/beads_mcp/bd_client.py     214     14    93%
src/beads_mcp/config.py         51      2    96%
src/beads_mcp/models.py         92      1    99%
src/beads_mcp/server.py         58     16    72%
src/beads_mcp/tools.py          59      0   100%
------------------------------------------------
TOTAL                          478     36    92%
```
2025-10-15 16:59:16 +05:30
Steve Yegge
2b03805651 chore: Bump version to 0.9.6
Updated all component versions:
- bd CLI: 0.9.5 → 0.9.6
- Plugin: 0.9.5 → 0.9.6
- MCP server: 0.9.5 → 0.9.6
- Documentation: 0.9.5 → 0.9.6

Generated by scripts/bump-version.sh
2025-10-15 02:32:15 -07:00
Steve Yegge
2cc17a9acf chore: Bump version to 0.9.5
Updated all component versions:
- bd CLI: 0.9.4 → 0.9.5
- Plugin: 0.9.4 → 0.9.5
- MCP server: 0.9.4 → 0.9.5
- Documentation: 0.9.4 → 0.9.5

Generated by scripts/bump-version.sh
2025-10-14 19:22:53 -07:00
Steve Yegge
3a1f99790a feat(mcp): Add debug_env tool to diagnose working directory issues
Added a debug tool that reports:
- os.getcwd() value
- PWD environment variable
- BEADS_WORKING_DIR environment variable
- Other relevant environment variables

This will help diagnose where bd commands are running from and whether
Claude Code sets PWD or other variables correctly.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 19:22:53 -07:00
Steve Yegge
01b606fe7b fix(mcp): Run bd commands in user's working directory
The MCP server was running bd commands from the plugin installation directory,
causing the database to be created in the wrong place.

Added BEADS_WORKING_DIR config option and modified BdClient to use working
directory for subprocess calls. Falls back to PWD environment variable.

This ensures bd commands run from the user's actual project directory.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 18:57:32 -07:00
Steve Yegge
23bbdc7afa feat(mcp): Setup beads-mcp for PyPI distribution
Prepared the beads-mcp package for publishing to PyPI, simplifying installation
for users who want to use the MCP server with Claude Desktop or other MCP clients.

Changes:
- Added LICENSE file (MIT) to integrations/beads-mcp/
- Updated pyproject.toml with PyPI metadata (license, URLs, classifiers)
- Updated README with simplified installation (uv tool install beads-mcp)
- Created PYPI.md with detailed publishing guide
- Updated examples/claude-desktop-mcp/README to reference the production MCP server

Installation is now simplified from:
  git clone && cd && uv sync
to:
  uv tool install beads-mcp

Configuration is simplified from multi-line with --directory args to:
  "command": "beads-mcp"

Tested build successfully. Package ready for:
- Test PyPI: python -m twine upload --repository testpypi dist/*
- Production PyPI: python -m twine upload dist/*

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 18:07:22 -07:00
Steve Yegge
061e8c4a27 feat(mcp): improve error messages for missing bd CLI
Add helpful installation instructions when bd CLI is not found,
making it clear that the CLI must be installed separately.

Changes:
- Add BdNotFoundError.installation_message() with clear install steps
- Update all BdNotFoundError raises to use new formatted message
- Improve config error message with installation instructions first
- Update tests to match new error message format

Error message now shows:
- Clear explanation that bd CLI is required
- Installation command with curl one-liner
- Link to GitHub installation docs
- Reminder to restart Claude Code after installation

Test results: 90/91 tests passing (1 unrelated path assertion)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 17:33:54 -07:00
Steve Yegge
b4e37f9fb5 chore: Bump version to 0.9.4
Updated all component versions:
- bd CLI: 0.9.3 → 0.9.4
- Plugin: 0.9.3 → 0.9.4
- MCP server: 0.9.3 → 0.9.4
- Documentation: 0.9.3 → 0.9.4

Generated by scripts/bump-version.sh
2025-10-14 17:12:30 -07:00
Steve Yegge
c049bf4351 fix(mcp): run bd commands in user's working directory instead of MCP server directory
The MCP server was running all bd commands in its own installation directory
(~/.claude/plugins/marketplaces/beads-marketplace/integrations/beads-mcp/)
instead of the user's project directory. This caused databases to be created
in the wrong location.

For example, when working in ~/ai/flutter/wyvern and running `bd init --prefix wy-`,
the database was created at:
  ~/.claude/plugins/marketplaces/beads-marketplace/integrations/beads-mcp/.beads/wy-.db

Instead of the expected location:
  ~/ai/flutter/wyvern/.beads/wy-.db

Solution:
- Add `cwd=os.getcwd()` to all asyncio.create_subprocess_exec() calls
- This makes bd commands execute in the current working directory from PWD env var
- Claude Code updates PWD for the MCP server process environment

Impact:
- bd init now creates .beads/ in the correct project directory
- All bd commands (create, list, update, etc.) operate on the correct database
- Multi-project workflows work correctly without manual DB path configuration

Test results: 90/91 tests passing (1 unrelated path assertion failure)
2025-10-14 17:11:45 -07:00
Steve Yegge
f16ba3f30f chore: Bump version to 0.9.3
Release highlights:
- Removed CGO dependency for better portability
- Fixed critical MCP server bugs (path resolution, init tool)
- Improved Claude Code plugin documentation
- Enhanced MCP server configuration robustness
- All 91 tests passing

Major changes since 0.9.2:
1. CGO removal - Pure Go SQLite driver for easier installation
2. MCP init fix - Tool now correctly creates .beads in current directory
3. MCP path resolution - Auto-detects bd executable via PATH
4. Plugin docs - Better quickstart for Claude Code users
5. Config validation - Command names resolved via shutil.which()

Breaking changes: None
Migration: No action needed

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 16:52:45 -07:00
Steve Yegge
ba8fdf1a8c fix: MCP init tool creates .beads in current directory
Critical bug: MCP init tool reported success but didn't create .beads
directory. It was using --db flag which tells bd to use an existing
database elsewhere instead of creating a new one.

Root cause:
- bd_client.init() was calling _global_flags() which adds --db flag
- bd init --db <path> uses existing db instead of creating new one
- Result: init appeared to succeed but created nothing

Fix:
- Remove _global_flags() from init command
- Only pass --actor flag (safe for init)
- Do NOT pass --db flag to init (defeats the purpose)
- Add explicit comment explaining why

Testing:
- Added test_init_creates_beads_directory() integration test
- Verifies .beads directory is created in current working directory
- Verifies database file has correct prefix
- All 91 tests pass

This was causing silent failures where agents thought they initialized
bd but the .beads directory was never created.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 16:47:29 -07:00
Steve Yegge
800ed300a6 fix: MCP server bd executable path resolution
Fixes issue where MCP tools failed with "bd executable not found"
when BEADS_PATH was set to command name instead of absolute path.

Changes:
- Remove BEADS_PATH=bd from plugin.json (use auto-detection)
- Enhance config validator to resolve command names via PATH
- Add comprehensive config validation tests (11 new tests)

The validator now accepts both:
  - Absolute paths: /usr/local/bin/bd
  - Command names: bd (resolved via shutil.which)

This makes the MCP server more robust and user-friendly while
maintaining backward compatibility.

All 90 tests pass.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 16:37:59 -07:00
Steve Yegge
3b5b4842ff fix: Replace sys.exit() with exception in config validation
Fixes MCP server hanging when bd executable is not found at default path.

Problem:
- Config validation used sys.exit(1) on failure
- sys.exit() hangs in async MCP server context (doesn't properly terminate)
- Default bd path was hardcoded to ~/.local/bin/bd

Solution:
1. Use shutil.which() to find bd in PATH before falling back to default
2. Raise ConfigError instead of calling sys.exit()
3. MCP server now properly fails with error message instead of hanging

This fixes the multi-minute hang when trying to use MCP tools if bd is
installed in a non-default location (e.g., /usr/local/bin/bd).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 16:10:52 -07:00
Steve Yegge
a4d816d1f4 fix: Remove unsupported engines field and add runtime version checking
Fixes Claude Code marketplace plugin installation failure (bd-183).

Problem: The plugin.json manifest included an engines field (borrowed from npm)
to specify minimum bd CLI version requirements. However, Claude Code's plugin
manifest schema doesn't recognize this field, causing validation errors when
installing via /plugin marketplace add.

Solution:
1. Remove the engines field from plugin.json
2. Add runtime version checking in the MCP server startup
3. Update documentation to reflect automatic version checking

Changes:
- .claude-plugin/plugin.json: Remove unsupported engines field
- integrations/beads-mcp/src/beads_mcp/bd_client.py:
  - Add BdVersionError exception class
  - Add _check_version() method to validate bd CLI >= 0.9.0
  - Use bd version command (not bd --version)
- integrations/beads-mcp/src/beads_mcp/tools.py:
  - Make _get_client() async to support version checking
  - Update all tool functions to await _get_client()
  - Add version check on first MCP server use
- .claude-plugin/commands/bd-version.md: Update to mention automatic checking
- PLUGIN.md: Document automatic version validation at startup

Benefits:
- Plugin installs successfully via Claude Code marketplace
- Clear error messages if bd CLI version is too old
- Version check happens once per MCP server lifetime (not per command)
- Users get actionable update instructions in error messages

Closes bd-183
2025-10-14 15:54:50 -07:00
Steve Yegge
653d7fd574 chore: Update uv.lock after testing MCP server 2025-10-14 14:34:04 -07:00
Steve Yegge
2bb6f026c2 fix: Update version bump script to include MCP server __init__.py
Issue found: bump-version.sh was missing the MCP server's __init__.py file, causing version mismatches (pyproject.toml: 0.9.2, __init__.py: 1.0.0).

Changes:
- Add integrations/beads-mcp/src/beads_mcp/__init__.py to update list
- Add it to git staging in auto-commit
- Add it to verification check
- Fix current version mismatch: 1.0.0 to 0.9.2

Now the script updates 7 files instead of 6
2025-10-14 14:34:04 -07:00
Steve Yegge
c0f1044d42 fix: Sync all component versions to 0.9.2
Fixes version inconsistencies across the project. All components now at 0.9.2:

Updated:
- .claude-plugin/plugin.json: 0.9.0 → 0.9.2
- .claude-plugin/marketplace.json: 0.9.0 → 0.9.2
- integrations/beads-mcp/pyproject.toml: 1.0.0 → 0.9.2
- README.md: v0.9.0 → v0.9.2
- PLUGIN.md: Updated version requirements

Root cause: Previous version bumps (0.9.0 → 0.9.1 → 0.9.2) only updated
cmd/bd/version.go, leaving other components out of sync.

The MCP server was initially versioned at 1.0.0 when added today, but
syncing to 0.9.2 for consistency since the project is still in alpha.

Closes bd-66

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 13:42:37 -07:00