feat: add Git worktree compatibility (PR #478)

Adds comprehensive Git worktree support for beads issue tracking:

Core changes:
- New internal/git/gitdir.go package for worktree detection
- GetGitDir() returns proper .git location (main repo, not worktree)
- Updated all hooks to use git.GetGitDir() instead of local helper
- BeadsDir() now prioritizes main repository's .beads directory

Features:
- Hooks auto-install in main repo when run from worktree
- Shared .beads directory across all worktrees
- Config option no-install-hooks to disable auto-install
- New bd worktree subcommand for diagnostics

Documentation:
- New docs/WORKTREES.md with setup instructions
- Updated CHANGELOG.md and AGENT_INSTRUCTIONS.md

Testing:
- Updated tests to use exported git.GetGitDir()
- Added worktree detection tests

Co-authored-by: Claude <noreply@anthropic.com>
Closes: #478
This commit is contained in:
matt wilkie
2025-12-13 10:40:40 -08:00
committed by Steve Yegge
parent de7b511765
commit e01b7412d9
64 changed files with 1895 additions and 3708 deletions

View File

@@ -230,13 +230,7 @@ main() {
"# bd-hooks-version: $NEW_VERSION"
done
# 10. Update default.nix
echo " • default.nix"
update_file "default.nix" \
"version = \"$CURRENT_VERSION\"" \
"version = \"$NEW_VERSION\""
# 11. Update CHANGELOG.md
# 10. Update CHANGELOG.md
echo " • CHANGELOG.md"
update_changelog "$NEW_VERSION"
@@ -259,7 +253,6 @@ main() {
"$(grep '__version__ = ' integrations/beads-mcp/src/beads_mcp/__init__.py | sed 's/.*"\(.*\)".*/\1/')"
"$(jq -r '.version' npm-package/package.json)"
"$(grep '# bd-hooks-version: ' cmd/bd/templates/hooks/pre-commit | sed 's/.*: \(.*\)/\1/')"
"$(grep 'version = ' default.nix | sed 's/.*"\(.*\)".*/\1/')"
)
ALL_MATCH=true
@@ -379,8 +372,7 @@ main() {
integrations/beads-mcp/src/beads_mcp/__init__.py \
npm-package/package.json \
README.md \
cmd/bd/templates/hooks/* \
default.nix
cmd/bd/templates/hooks/*
# Add PLUGIN.md if it exists
if [ -f "PLUGIN.md" ]; then
@@ -399,7 +391,6 @@ Updated all component versions:
- Plugin: $CURRENT_VERSION$NEW_VERSION
- MCP server: $CURRENT_VERSION$NEW_VERSION
- npm package: $CURRENT_VERSION$NEW_VERSION
- Nix package: $CURRENT_VERSION$NEW_VERSION
- Documentation: $CURRENT_VERSION$NEW_VERSION
Generated by scripts/bump-version.sh"