Commit graph

31 commits

Author SHA1 Message Date
coffeegoddd☕️✨
a35edfd28e /{internal,cmd,.goreleaser,.github}: embedded mode by default 2026-03-28 13:47:20 -07:00
coffeegoddd☕️✨
f4b04e2ecd /cmd/bd: remove docker tip in embeddeddolt mode 2026-03-26 11:13:02 -07:00
matt wilkie
6673026068 feat: add --skip-agents flag and branchless/JJ docs (GH#1335)
- 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>
2026-03-13 11:19:10 -07:00
Marco Del Pin
b7bd6d6fae fix: replace stale 'bd sync' references with bd dolt push/commit (GH#2435)
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.
2026-03-07 17:00:19 +01:00
granite
e1e4cb7306 fix: remove unused embedded hook templates and dead installHooks wrapper (bd-gp5b)
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
2026-03-01 11:11:10 -08:00
Pablo LION
2752d60869
fix: use marker-managed install path for jj hooks (#2232) 2026-03-01 09:52:30 -08:00
maphew
1b56f58b31 feat: use section markers for git hooks (GH#1380)
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>
2026-02-28 21:55:24 -07:00
Pablo LION
59ff8d90f4 fix: unify hook outdated detection between CheckGitHooks and hooksNeedUpdate
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>
2026-02-25 08:18:01 +01:00
Pablo LION
7dafce0743
feat: auto-update stale hooks during bd init (GH#1466) (#2008)
* 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>
2026-02-24 20:10:02 -08:00
beads/crew/lydia
5e243b1097 refactor: remove JSONL storage layer from core Go files (bd-9ni.2)
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>
2026-02-22 21:52:18 -08:00
beads/crew/elinor
c980b96baf fix: remove JSONL storage functions and config field (bd-9ni.2)
Remove FindJSONLPath, FindJSONLInDir, JSONLExport config field, and
JSONL bootstrap detection code. Simplify post-merge hook to no-op since
Dolt handles sync internally. Update hook descriptions to remove stale
JSONL references. 19 files changed, ~850 lines removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:36:00 -08:00
gastown/crew/gus
94d8607921 fix(hooks): use 'bd hooks run' instead of nonexistent 'bd hook' in init hook body
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
2026-02-22 18:45:43 -08:00
beads/crew/jane
34fa1c1239 refactor(sync): make bd sync a deprecated no-op, update agent instructions
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>
2026-02-21 19:07:02 -08:00
beads/crew/emma
bd68c87b00 fix: remove stale embedded Dolt references after server-only migration
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
2026-02-21 16:59:44 -08:00
Marco Del Pin
718a5e2c25
fix: normalize CRLF line endings in git hook files (#1917)
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
2026-02-20 09:22:21 -08:00
beads/crew/emma
8d5ae2ad91 Merge origin/main, resolve conflicts, fix shell hook template and revert db name change
Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-18 10:31:19 -08:00
Martin Volerich
db2bbdde63 fix(dolt): resolve lock deadlocks, doctor hangs, and hook export issues
- 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>
2026-02-17 14:43:57 -05:00
beads/crew/emma
ff0b469154 chore: Clean up stale daemon references in code comments and doctor messages
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
2026-02-16 19:25:17 -08:00
obsidian
304c6846e1 fix: gofmt formatting across 24 files and 2 lint warnings (bd-i4o4e)
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
2026-02-16 01:17:23 -08:00
beads/crew/emma
cddddf72e3 refactor: remove all no-op stubs and dead functions (bd-h0zvj.1)
Remove 16 no-op functions and their 48 call sites across 26 files.

Deleted files:
- staleness.go: requireFreshDB(), ensureDatabaseFresh() no-ops
- dolt/dirty_issues.go: ClearDirtyIssuesByID(), SetJSONLFileHash() no-ops
- dolt/multirepo.go: ExportToMultiRepo(), HydrateFromMultiRepo() no-ops

Removed functions:
- clearAutoFlushState() from stubs.go
- checkAndAutoImport(), checkGitForIssues(), importFromGit() from autoimport_stubs.go
- installMergeDriver(), mergeDriverInstalled() from init_git_hooks.go

Removed call sites:
- requireFreshDB(): 17 callers across read commands
- checkAndAutoImport(): 4 callers in query/list/search/ready
- ClearDirtyIssuesByID/SetJSONLFileHash/clearAutoFlushState: export.go
- ExportToMultiRepo/HydrateFromMultiRepo: sync_helpers.go
- checkGitForIssues: init.go prefix auto-detection

Kept dolt/compact.go stubs (CheckEligibility, ApplyCompaction, etc.) as
intentional "not yet implemented" — compaction is a forward-looking feature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 16:26:50 -08:00
beads/crew/emma
5102512917 refactor: remove 3-way merge engine (Phase 3)
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
2026-02-14 20:31:29 -08:00
beads/crew/lizzy
2bb827facb style: run gofmt across entire codebase (bd-nmk12)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:35:20 -08:00
jane
6fe7f20e38 feat: default to chaining hooks in bd init instead of prompting (bd-bxha)
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>
2026-02-05 18:46:02 -08:00
lizzy
e07ac184cf fix(cli): use abstract error messages instead of exposing internals (bd-ats9.3.2)
Replace internal implementation terminology in user-facing error messages:
- "JSONL path not found" → "beads storage file not found"
- "failed to load issues from <path>" → "failed to load issues"
- "single-process only" Dolt message → generic backend message
- "failed to open/read/close JSONL" → "failed to open/read/close storage file"
- "Failed to flush bd changes to JSONL" → "Failed to flush bd changes to storage"
- "failed to export target repo JSONL" → "failed to export to target repo"

Files modified:
- daemon_guard.go
- daemon_sync_branch.go
- daemon_sync.go
- nodb.go
- delete.go
- create.go
- init_git_hooks.go

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 20:18:26 -08:00
gastown/crew/joe
c78889fa65 fix(hooks): skip JSONL sync for Dolt backend
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>
2026-01-25 11:50:14 -08:00
beads/crew/lizzy
2fe15e2328 feat(hooks): add jujutsu (jj) version control support
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>
2026-01-20 19:13:02 -08:00
Zain Rizvi
e723417168
Fix git hooks not working in worktrees (#1126)
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>
2026-01-16 12:01:43 -08:00
Peter Chanthamynavong
0a48519561
feat(context): centralize RepoContext API for git operations (#1102)
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.
2026-01-15 07:55:08 -08:00
Ismar
d931f81427
feat: add prek support as pre-commit alternative (#1040)
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>
2026-01-12 17:29:57 -08:00
beads/crew/fang
f77b290d43 fix: git hook chaining now works correctly (GH#816)
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>
2025-12-30 20:40:09 -08:00
Steve Yegge
7ea7aee411 refactor: Split init.go from 1928 to 705 lines (bd-xtf5)
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>
2025-12-28 18:43:09 -08:00