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

@@ -116,30 +116,6 @@ function extractTarGz(tarGzPath, destDir, binaryName) {
}
}
// Re-sign binary for macOS to avoid slow Gatekeeper checks
// See: https://github.com/steveyegge/beads/issues/466
function resignForMacOS(binaryPath) {
if (os.platform() !== 'darwin') {
return;
}
console.log('Re-signing binary for macOS...');
try {
// Remove existing signature
try {
execSync(`codesign --remove-signature "${binaryPath}"`, { stdio: 'pipe' });
} catch (e) {
// Ignore errors - binary may not have a signature
}
// Add ad-hoc signature for this machine
execSync(`codesign --force --sign - "${binaryPath}"`, { stdio: 'pipe' });
console.log('✓ Binary re-signed for this machine');
} catch (err) {
console.warn('Warning: Failed to re-sign binary (non-fatal):', err.message);
}
}
// Extract zip file (for Windows)
function extractZip(zipPath, destDir, binaryName) {
console.log(`Extracting ${zipPath}...`);
@@ -200,9 +176,6 @@ async function install() {
extractTarGz(archivePath, binDir, binaryName);
}
// Re-sign for macOS to avoid Gatekeeper delays
resignForMacOS(binaryPath);
// Clean up archive
fs.unlinkSync(archivePath);