Commit graph

14 commits

Author SHA1 Message Date
cwalv
4d14fb8ce1 feat: auto-detect beads database on git origin during bootstrap
When running `bd bootstrap` in a fresh clone, probe origin for
refs/dolt/data and automatically clone the existing beads database
instead of creating unrelated state. `bd init` warns if the ref
exists and suggests using `bd bootstrap` instead.

Fixes #2580
2026-03-14 00:18:13 -07:00
Osamu Okano
24836dd25b
fix(init): skip AGENTS.md generation in bare repositories 2026-03-02 20:25:52 +09:00
beads/crew/emma
76b2f1e456 refactor: gut JSONL sync engine, keep simple manual import/export (bd-h0zvj.2)
Delete 11 production files and 19 test files (~12,900 lines):
- 3-way merge engine (sync_merge, sync_conflict, sync_manual)
- Sync mode infrastructure (sync_mode, sync_mode_cmd)
- Sync state tracking and backoff (sync_state)
- Sync branch/worktree operations (sync_branch, migrate_sync)
- Integrity checks (sync_check, sync_status)
- Bridge functions (sync_bridge)

Rewrite sync.go from 805 to 159 lines:
- Default: Dolt commit + push
- --import: JSONL → Dolt
- --export/--flush-only: Dolt → JSONL
- --pull: Pull from Dolt remote

Keep sync_helpers.go with core export/import functions.
Keep sync_git.go (used by init.go, restore.go).

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 16:42:44 -08:00
quartz
d582e00ffc perf(tests): replace ~60 git init subprocess calls with cached template copy
Use sync.Once to create a single git repo template at test startup, then
copy the .git directory for each test instead of spawning git init. Reduces
subprocess overhead across cmd/bd, cmd/bd/doctor, and cmd/bd/doctor/fix
packages (-283 lines net).

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

Executed-By: beads/polecats/quartz
Rig: beads
Role: polecats
2026-02-14 17:49:53 -08:00
darcy
4480faf737 fix: remove/fix 14 broken tests after JSONL/daemon deletion (-2,782 lines)
Tests were calling stubbed JSONL functions (writeJSONLAtomic, autoImportIfNewer,
validateJSONLIntegrity, etc.) that now return nil/empty after the JSONL sync
removal. Also fixes: --no-daemon flag re-registered as hidden no-op for backward
compat, getProjectRoot uses runtime.Caller to avoid CWD sensitivity, removed
--no-daemon from init test args, added v0.49.6 changelog entries.

Deleted: direct_mode_test.go, jsonl_integrity_test.go, jsonl_lock_test.go,
rename_prefix_jsonl_update_test.go. Trimmed: main_test.go, nodb_test.go,
show_watch_test.go, staleness_test.go.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 12:10:35 -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
Peter Chanthamynavong
5d93aaf722
fix(sync): remove orphaned restoreBeadsDirFromBranch function (#1121)
Remove dead code that was inadvertently orphaned when PR #918 refactored
the sync flow. The function was never called since v0.47.0.

The function caused GH#1100 by running `git checkout HEAD -- .beads/`
which restored the entire .beads/ directory, overwriting uncommitted
config.yaml changes.

Add regression test (TestConfigPreservedDuringSync) to prevent similar
restoration logic from being reintroduced.

Fixes #1100
2026-01-15 19:22:52 -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
fang
2332e6f5bd fix: update tests for getCurrentBranchOrHEAD and getPIDFileForSocket
- sync_git_test.go: getCurrentBranchOrHEAD now returns 1 value (not 2)
- daemon_basics_test.go: getPIDFileForSocket uses dbPath not socketPath
- daemon_autostart.go: mark unused socketPath param with underscore

These tests were broken by recent refactors that changed function signatures
but didn't update the corresponding test files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 23:51:56 -08:00
Phredrick Phool
228b7195b1 fix(sync): handle detached HEAD in bd sync --status
Add getCurrentBranchOrHEAD() which returns "HEAD" when in detached HEAD
state instead of failing. This fixes bd sync --status for jj/jujutsu users.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 07:09:25 -06:00
Phredrick Phool
465f39b366 Merge remote-tracking branch 'origin/main' into fix-jj-detached-head-upstream-check
# Conflicts:
#	cmd/bd/sync_git_test.go
2026-01-12 06:49:51 -06:00
Phredrick Phool
78fec4bc45 fix(daemon): check sync-branch upstream for jj/jujutsu compatibility
When sync-branch is configured, check that branch's upstream instead of
current HEAD's upstream. This fixes --auto-push with jj/jujutsu which
always operates in detached HEAD mode.

Adds gitBranchHasUpstream(branch) to check specific branch's upstream
tracking, independent of current HEAD state.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 06:44:31 -06:00
Steve Yegge
d74a14d92a test(sync): add tests for redirect handling in git status checks
Add tests for gitHasBeadsChanges and gitHasUncommittedBeadsChanges
functions when .beads directory is redirected to another repo:

- Test non-redirected case (baseline functionality)
- Test redirected case with no changes (clean target repo)
- Test redirected case with changes (modified file in target)

These tests cover the redirect detection logic added in a61cbde6
that uses `git -C <targetRepoDir>` when beadsDir is redirected.

Closes: bd-hxcf

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 21:31:24 -08:00
ruby
32aea46ca6 test(sync): add unit tests for gitHasUncommittedBeadsChanges (bd-p7i2)
Extract parseGitStatusForBeadsChanges helper function from
gitHasUncommittedBeadsChanges to enable unit testing without git setup.

Add 14 test cases covering:
- Empty/no changes
- Modified files (staged, unstaged, both)
- Added files (staged, with modifications)
- Untracked files (should return false)
- Deleted files (should return false)
- Renamed/copied files
- Edge cases (short status line)

Part of GH#885 follow-up.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 16:22:20 -08:00