- Add --skip-agents flag to bd init to skip AGENTS.md and Claude
settings generation, addressing concern about invasive file modifications
- Add 'Branchless Workflows (Jujutsu / jj)' section to GIT_INTEGRATION.md
documenting what works without hooks and without branch concepts
- Fix dead link to non-existent docs/JUJUTSU.md in printJJAliasInstructions
Closes#1335
Amp-Thread-ID: https://ampcode.com/threads/T-019ce867-cdd6-77cf-bb69-f8c1af71227a
Co-authored-by: Amp <amp@ampcode.com>
bd sync was removed as a command but references persisted in:
- CLI help text (--dolt-auto-commit flag description)
- Code comments (dolt_autocommit.go, init_contributor.go)
- Agent setup generators (aider, cursor, junie, mux)
- Doctor agent remediation commands
- Jujutsu hook alias (init_git_hooks.go)
- Copilot integration docs
All references now point to the current commands:
- bd dolt commit (for committing changes)
- bd dolt push (for pushing to remote)
Tests updated to match.
Complements #2389 (config/sync.mode removal) and #2419 (command removal).
Remaining stale references in other docs tracked in GH#2435.
The embed directive loaded 5 hook template files into the binary, but
installHooksWithOptions() only used map keys for iteration — content was
always generated dynamically by generateHookSection(). Templates also had
a hardcoded v0.56.1 version that drifted from the dynamic Version variable.
- Remove //go:embed directive, hooksFS, and getEmbeddedHooks()
- Replace with static managedHookNames slice
- Change installHooksWithOptions to accept []string instead of map[string]string
- Remove dead installHooks() wrapper (never called)
- Delete cmd/bd/templates/hooks/ directory (5 template files)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/granite
Rig: beads
Role: polecats
Use BEGIN/END section markers in git hooks, consistent with how
AGENTS.md integration already works. This preserves user content
outside the markers across bd init re-runs, hook upgrades, and
bd hooks install.
Changes:
- Add hookSectionBeginPrefix/hookSectionEnd constants and helpers:
generateHookSection(), injectHookSection(), removeHookSection()
- Update installHooksWithOptions() to inject sections into existing
hook files instead of replacing them. Legacy bd hooks (shim/inline)
are migrated to section format; non-bd hooks get sections appended.
- Update uninstallHooks() to remove only the beads section, preserving
user content. Files with only a shebang remaining are deleted.
- Update getHookVersion() to scan the entire file (not just first 15
lines) and recognize section markers anywhere.
- Update hooksInstalled()/detectExistingHooks() to recognize section
marker format as bd hooks.
- Update buildPreCommitHook/buildPostMergeHook/buildJJPreCommitHook
in init_git_hooks.go to use section markers.
- Update all 5 hook templates to section marker format.
- Add comprehensive tests for section injection, removal, install
idempotency, and uninstall with user content preservation.
Fixes#1380
Amp-Thread-ID: https://ampcode.com/threads/T-019ca7b3-8137-7218-8707-b7ae93c31ab5
Co-authored-by: Amp <amp@ampcode.com>
CheckGitHooks() guarded on Version != "" which skipped inline bd hooks
(empty version string), while hooksNeedUpdate() correctly treated them as
outdated. Replace the guard with IsBdHook to handle inline hooks consistently.
Consolidate hooksNeedUpdate() to delegate to CheckGitHooks(), eliminating
duplicated version-checking logic.
Follow-up to GH#1466 / PR #2008.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: auto-update stale hooks during bd init (GH#1466)
bd init now detects outdated git hooks and reinstalls them, not just
missing ones. Previously, hooksInstalled() only checked existence and
signature — hooks from older CLI versions were never updated.
Adds hooksNeedUpdate() which uses getHookVersion() to compare hook
version markers against the current CLI version. Shim hooks are skipped
(they delegate to bd hooks run and are never stale).
Adds bd-hooks-version markers to all inline hook templates so newly
installed hooks are properly versioned and not flagged as outdated on
subsequent bd init runs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address review findings for stale hooks detection
- Fix misleading test: "non-executable hook files" now uses current
version to isolate the permissions variable, documenting that
hooksNeedUpdate checks version not permissions
- Distinguish file-not-found from permission/IO errors in
hooksNeedUpdate — warn on stderr for non-NotExist errors instead
of silently continuing
- Add user feedback distinguishing "update" from fresh "install" —
prints "Updating hooks to version X.Y.Z..." when overwriting
existing outdated hooks
- Document calling context constraint in hooksNeedUpdate doc comment
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: check scanner.Err in getHookVersion and handle read errors in hooksNeedUpdate
getHookVersion now checks scanner.Err() after reading hook files,
surfacing I/O errors instead of silently misclassifying hooks as
non-bd (which caused hooksNeedUpdate to skip them with no warning).
hooksNeedUpdate now tracks read errors and returns true when hooks
exist but couldn't be read, attempting re-install rather than silently
skipping the update.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Remove FindJSONLPath, FindJSONLInDir, JSONLExport config field, JSONL
bootstrap detection, post-merge JSONL import hook, and findActualJSONLFile.
Update hasBeadsProjectFiles to check for dolt/ directory instead of JSONL
files. Simplify error messages and hook descriptions to remove JSONL
references. Update comments across types, storage, and doctor subsystem.
29 files changed, -882/+79 lines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The preCommitHookBody() inline template still used 'bd hook pre-commit'
after the command was renamed to 'bd hooks run'. The template files in
cmd/bd/templates/hooks/ were already fixed (a7e1203e) but this inline
path used by bd init was missed.
Fixes: gt-0qii3n, gt-sue187, gt-u7qk7q, gt-e9wkz0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: gastown/crew/gus
Rig: gastown
Role: crew
bd sync was calling CommitPending + Push on every invocation, causing
perceived slowness when agents call it at high velocity. Now prints a
deprecation message and exits immediately without opening the database.
Updated AGENTS.md, AGENT_INSTRUCTIONS.md, SKILL.md, copilot-instructions,
and init templates to reference bd dolt push/pull instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Delete broken store_nocgo_test.go (references undefined errNoCGO),
remove dead bootstrapEmbeddedDolt/hasDoltSubdir functions, and clean up
stale comments and docs that still referenced embedded mode, CGO
requirements, or in-process Dolt across 20 files.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
On Windows and WSL with NTFS-mounted repos, `bd hooks install` can
write hook files with CRLF line endings. This causes git to fail with:
/usr/bin/env: 'sh\r': No such file or directory
Two sources of CRLF contamination:
1. Embedded hook templates may have CRLF when built on Windows/NTFS
(go:embed captures files as-is from disk)
2. The prepare-commit-msg template already contained CRLF
Fix:
- Normalize embedded hook content with strings.ReplaceAll("\r\n", "\n")
before writing to disk in both hooks.go and init_git_hooks.go
- Add .gitattributes rules to enforce LF for shell scripts and hook
templates regardless of platform
- Fix flock deadlock in bd sync and pre-commit hook by using
exportToJSONLWithStore() directly instead of spawning subprocess
- Fix bd doctor --fix --yes hang by removing re-run of diagnostics
after fixes (embedded Dolt singleton deadlocks on second open)
- Update pre-commit hook template and preCommitHookBody() to export
Dolt→JSONL instead of skipping Dolt backend entirely
- Auto-commit in bd init so users don't need manual bd vc commit
- Stop flagging issues.jsonl as classic artifact (pre-commit creates it)
- Update doctor fix messages to suggest bd vc commit for Dolt users
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update comments and user-facing messages across 17 production files to
reflect the current Dolt-native architecture (no daemon):
- Gitignore template: reorganized, daemon/SQLite entries moved to legacy section
- Doctor fix messages: removed references to non-existent bd daemon commands
- Doctor federation: updated fix suggestions to use gt dolt start / server mode
- Doctor integrity: removed "daemon won't start" messaging
- Code comments: replaced daemon mode references with current architecture terms
- Lock handling: marked daemon.lock as legacy cleanup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Run make fmt to fix all gofmt issues. Add nolint directives for:
- G204 (gosec) in cmd/bd/stubs.go: git args are internal, not user-supplied
- unparam in internal/syncbranch/worktree.go: error return kept for callers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
Delete internal/merge/ (3,958 LOC), cmd/bd/merge.go, cmd/bd/resolve_conflicts.go
and all related tests. Stub callers: deletion_tracking returns no-op,
git/worktree uses local-wins, syncbranch/worktree uses remote-wins.
Make mergeDriverInstalled/installMergeDriver no-ops. Update 11 test files.
Dolt handles sync natively, eliminating the need for JSONL-level 3-way merge.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Executed-By: beads/crew/emma
Rig: beads
Role: crew
Remove interactive prompt when existing git hooks are found during bd init.
Now defaults to chaining with existing hooks automatically, matching the
previously-recommended option. On failure, warns and suggests bd doctor --fix.
Users can still skip with --skip-hooks or --skip-merge-driver flags.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pre-commit and post-merge git hooks were unconditionally running
bd sync/import for JSONL sync, which fails with Dolt backend.
Now both hooks check metadata.json for backend type and exit early
if Dolt is configured. Dolt uses its own sync mechanism.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add detection and hook support for jujutsu repositories:
- IsJujutsuRepo(): detects .jj directory
- IsColocatedJJGit(): detects colocated jj+git repos
- GetJujutsuRoot(): finds jj repo root
For colocated repos (jj git init --colocate):
- Install simplified hooks without staging (jj auto-commits working copy)
- Worktree handling preserved for git worktrees in colocated repos
For pure jj repos (no git):
- Print alias instructions since jj doesn't have native hooks yet
Closes: hq-ew1mbr.12
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Git hooks are shared across all worktrees and live in the common git
directory (e.g., /repo/.git/hooks), not the worktree-specific directory
(e.g., /repo/.git/worktrees/feature/hooks).
The core issue was in GetGitHooksDir() which used GetGitDir() instead
of GetGitCommonDir(). This caused hooks to be installed to/read from
the wrong location when running in a worktree.
Additionally, several places in the codebase manually constructed
hooks paths using gitDir + "hooks" instead of calling GetGitHooksDir().
These have been updated to use the proper worktree-aware path.
Affected areas:
- GetGitHooksDir() now uses GetGitCommonDir()
- CheckGitHooks() uses GetGitHooksDir()
- installHooks/uninstallHooks use GetGitHooksDir()
- runChainedHook() uses GetGitHooksDir()
- Doctor checks use git-common-dir for hooks paths
- Reset command uses GetGitCommonDir() for hooks and beads-worktrees
Symptoms that this fixes:
- Chained hooks (pre-commit.old) not running in worktrees
- bd hooks install not finding/installing hooks correctly in worktrees
- bd hooks list showing incorrect status in worktrees
- bd doctor reporting incorrect hooks status in worktrees
Co-authored-by: Zain Rizvi <4468967+ZainRizvi@users.noreply.github.com>
Centralizes repository context resolution via RepoContext API, fixing bugs where git commands run in the wrong repo when BEADS_DIR points elsewhere or in worktree scenarios.
prek (https://prek.j178.dev) is a faster Rust-based alternative to
pre-commit that uses the same .pre-commit-config.yaml config files.
Changes:
- Add prek detection pattern in hookManagerPatterns (before pre-commit
to ensure correct detection since prek hooks may contain 'pre-commit')
- Handle prek in checkManagerBdIntegration using same config parser
- Update init_git_hooks.go to recognize prek-installed hooks
- Rename isPreCommit field to isPreCommitFramework for clarity
- Use regex pattern matching all pre-commit/prek signatures consistently
- Add test cases for prek run and prek hook-impl signatures
Co-authored-by: Ismar Iljazovic <ismar@gmail.com>
Two fixes:
1. `bd init` chaining was broken - the code referenced `.old` hooks but
never actually renamed the existing hooks. Added the missing os.Rename().
2. `bd hooks install` now supports --chain flag to chain with existing hooks
(e.g., pre-commit framework). When used, existing hooks are renamed to
.old and bd hooks run will call them before the bd logic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract init.go into multiple focused files:
- init_git_hooks.go: Git hooks installation and merge driver setup (~480 lines)
- init_stealth.go: Stealth mode and fork/exclude configuration (~310 lines)
- init_agent.go: AGENTS.md and Claude settings setup (~170 lines)
- init_templates.go: config.yaml and README.md templates (~180 lines)
This reduces init.go from 1928 lines to 705 lines, meeting the <800 line target.
Each extracted file handles a cohesive set of functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>