Commit graph

3,576 commits

Author SHA1 Message Date
Dustin Brown
0fdaa27ed0
Revert "Revert "Revert external server CLI dir override" (#3891)"
This reverts commit 410cff40b9.
2026-05-11 14:48:20 -07:00
matt wilkie
410cff40b9
Revert "Revert external server CLI dir override" (#3891)
This reverts commit 9b0cf9e600. Reverts #3862 . Clean up after rogue agent merged before Dolt-related PR was cleared by @coffeegoddd
2026-05-11 14:39:03 -07:00
matt wilkie
87963b4ce9
Revert "Add external server CLI dir override (bd-fn9) (#3498)" (#3890)
This reverts commit 0fffa44a23.
2026-05-11 14:34:22 -07:00
matt wilkie
e7fb5793a4
Revert "Revert external server CLI dir override" (#3888)
This reverts commit 9b0cf9e600.
2026-05-11 14:30:44 -07:00
matt wilkie
9b0cf9e600
Revert external server CLI dir override
Reverts PR #3498 / commit 0fffa44a2302a496dfa4ffa838843b3bbf0ee122.\n\nPR #3498 added BEADS_DOLT_CLI_DIR routing without a confirmed reproduction and introduced an external-server push/pull regression. Remove that override and its docs/tests so main no longer requires a local CLI database directory in external-server mode.\n\n_codex-gpt-5- on behalf of CI Bot_
2026-05-11 13:00:02 -07:00
Dustin Brown
8ab102fa78
Merge pull request #3871 from coffeegoddd/db/schema
Db/schema
2026-05-10 21:36:08 -07:00
coffeegoddd☕️✨
173288d61d /internal/storage: remove backward compat stuff 2026-05-10 15:46:41 -07:00
matt wilkie
cb9d7aad5a
test: make embedded init hook path windows-safe (#3864) 2026-05-10 10:32:37 -07:00
coffeegoddd☕️✨
23e11ff132 /cmd/bd/store_factory_nocgo.go: fix build 2026-05-10 07:14:56 -07:00
coffeegoddd☕️✨
c7aa60dcb4 /{cmd,internal}: tweaks before merge 2026-05-10 07:09:32 -07:00
coffeegoddd☕️✨
cb04e03fdb /cmd/bd: get compiling again 2026-05-10 06:57:43 -07:00
coffeegoddd☕️✨
3d7173c3c1 /{internal,cmd,.gitignore}: wip, proxy server fixes and uow impl 2026-05-10 06:57:41 -07:00
Dustin Brown
5d087a6862
Merge pull request #3833 from coffeegoddd/db/proxy
Db/proxy
2026-05-10 06:52:03 -07:00
matt wilkie
c62f012d8a
test(cmd/bd): use t.Chdir in drift tests to fix chdir race (#3747)
* test(cmd/bd): use t.Chdir in drift tests to fix chdir race (GH#3729-followup)

The TestCheckHooksDrift/Server/Remote tests in config_drift_test.go were
using the manual os.Chdir + defer os.Chdir(origDir) pattern, which is
not race-safe when other tests in the same package call t.Parallel and
share the process cwd.

t.Chdir (Go 1.24+) restores cwd via t.Cleanup and refuses to run if the
test (or any ancestor) is parallel — both eliminating the race window
and surfacing future misuse loudly.

Fixes flaky TestCheckHooksDriftNotGitRepo identified as a pre-existing
chdir race during PR #3716 review (mybd-j2s).

Verified: go test -count=20 -run '^TestCheckHooksDriftNotGitRepo$' passes.
Amp-Thread-ID: https://ampcode.com/threads/T-019dfe19-17ae-713e-bc3a-d7c9da6a117d
Co-authored-by: Amp <amp@ampcode.com>

* test(cmd/bd): accept embedded Dolt lock output

---------

Co-authored-by: CI Bot <ci@beads.test>
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: upgrade-test <test@beads.test>
2026-05-09 21:47:51 -07:00
Scott Hamilton
1cf8337340
fix(auto-import): restore empty-DB guard regressed by #3630, plus a test repair (#3691)
* fix(auto-import): restore top-level emptiness guard in maybeAutoImportJSONL (#2)

* fix(auto-import): restore top-level emptiness guard in maybeAutoImportJSONL

PR #3630 introduced jsonlImporter as a single-transaction fast-path for embedded mode and moved the TotalIssues>0 emptiness check inside that path. Stores that don't implement jsonlImporter (server-mode dolt store) fall through to the fallback multi-call path — which has no emptiness guard, so every bd command unconditionally runs importFromLocalJSONLFull on a non-empty Dolt.

importFromLocalJSONLFull's underlying ON DUPLICATE KEY UPDATE semantics in InsertIssueIntoTable then re-impose the (often stale) JSONL field values on top of live Dolt rows. Combined with the auto-export's debounce/commit-watermark gating in export_auto.go, partial-field bd updates (e.g. --append-notes alone, --priority=N alone) get clobbered: the next command's auto-import overwrites the just-written field with whatever the JSONL last had.

Restore the top-level GetStatistics+TotalIssues>0 guard that v1.0.3 had, before the path-fork. The embedded jsonlImporter retains its own atomic in-tx check (defense in depth against concurrent-writer races, which was the legitimate intent of #3630). The fallback path is now once again a true upgrade-recovery path: it only fires when the database is actually empty.

Reproducer (server mode):
1. bd update X --priority=2 --notes="X"
2. bd update X --append-notes "; appended"
3. bd update X --priority=3

Pre-fix: step 3 leaves notes='X' (the '; appended' is silently lost) and step 2 may revert priority to JSONL's stale value.
Post-fix: each single-field update preserves the unspecified fields from Dolt.

Test coverage gap: existing auto_import_upgrade_test.go is //go:build cgo and only exercises the embedded path. A non-CGO server-mode integration test would prevent reintroduction; left as a follow-up.

* test(auto-import): add server-mode fallback regression test for empty-DB guard

Adds two unit tests covering the server-mode fallback path of maybeAutoImportJSONL. Existing tests in auto_import_upgrade_test.go are //go:build cgo and exercise only the embedded jsonlImporter branch — leaving the fallback path (the actual location of the data-clobber regression) uncovered by CI.

Test design: a small testability seam exposes importFromLocalJSONLFull as a package-level 'fallbackImporter' var that tests can substitute. A minimal stub storage.DoltStorage embeds the interface (nil) and overrides only GetStatistics; any other method call panics, which is correct since the function under test should not invoke them after the emptiness guard short-circuits.

TestMaybeAutoImportJSONL_ServerModeFallback_SkipsWhenNonEmpty fails on the buggy code (substituted importer is invoked when it shouldn't be) and passes after the guard is restored. TestMaybeAutoImportJSONL_ServerModeFallback_RunsWhenEmpty is the negative control — guards against a future change that always short-circuits and would let the regression test pass vacuously.

* fix(test): TestEmbeddedAutoImportJSONLNoExplicitCommit — use write command to trigger auto-import (#3)

* fix(test): use a write command to trigger auto-import in TestEmbeddedAutoImportJSONLNoExplicitCommit

The test was added in PR #3630 with a comment claiming bd list 'triggers maybeAutoImportJSONL in pre-run'. This is incorrect: bd list is registered in cmd/bd/main.go's readOnlyCommands map, and the dispatcher at main.go:1023 explicitly skips maybeAutoImportJSONL for read-only commands (a guard added 2026-04-14 in fa87dd2bd to avoid opening a writable handle for read commands per GH#804).

The test consequently asserted on a 0-issue empty store, failed with 'expected 3 imported issues, got 0', and shipped broken. CI did not catch this because the test is gated behind BEADS_TEST_EMBEDDED_DOLT=1 and t.Skips otherwise; the embedded suite must not have been enabled in the PR's pipeline.

Fix: use bd create (a write command) to trigger auto-import in pre-run. bd create's own write coalesces with the auto-import via PersistentPostRun's maybeAutoCommit — exactly the deferred-commit flow the test was designed to verify. The post-import marker also brings the asserted total to 4.

The original commitCount > 2 assertion was a brittle proxy for 'auto-import didn't issue its own DOLT_COMMIT'. Replace it with a direct check: forbid the 'auto-import: ... (upgrade recovery, GH#2994)' commit message that the function only emits when it calls s.Commit explicitly (the fallback path). Its absence is the actual property under test.

Verified: passes locally with BEADS_TEST_EMBEDDED_DOLT=1; the four sibling auto-import tests in the same file continue to pass.

* docs(test): correct commit path attribution per PR #3 review

Copilot reviewer noted the previous comment incorrectly attributed the coalesced Dolt commit to PersistentPostRun's maybeAutoCommit. The actual commit path: bd create itself calls store.Commit at cmd/bd/create.go:676 (gated on isEmbeddedMode || postCreateWrites). The auto-import stages writes into the Dolt working set and bd create's own commit picks them up alongside its create write; PersistentPostRun's maybeAutoCommit is then a no-op.

* fix(auto-import): handle nil statistics guard

Incorporates the defensive nil-statistics behavior from #3690 by realies, while keeping #3691 as the broader tested fix.

Co-authored-by: realies <5107843+realies@users.noreply.github.com>

---------

Co-authored-by: maphew <486200+maphew@users.noreply.github.com>
Co-authored-by: realies <5107843+realies@users.noreply.github.com>
2026-05-09 14:50:07 -07:00
coffeegoddd☕️✨
bcad82554f /cmd/bd/init.go: remove comment 2026-05-08 14:30:45 -07:00
coffeegoddd☕️✨
40506eeaba /{.gitignore,cmd}: disable proxy server mode 2026-05-08 14:25:47 -07:00
coffeegoddd☕️✨
a65d9d1683 /cmd/bd/init.go: some more fixes 2026-05-08 14:19:50 -07:00
coffeegoddd☕️✨
bd02b5ea6d /cmd/bd/init.go: experimental 2026-05-08 13:27:17 -07:00
coffeegoddd☕️✨
c2b998e41d /{cmd,internal}: some refactors 2026-05-08 13:07:37 -07:00
coffeegoddd☕️✨
04f4e06d42 /{cmd,internal}: root piece 2026-05-08 12:14:51 -07:00
coffeegoddd☕️✨
f2954dd9f9 /{cmd,internal}: support logpath 2026-05-08 11:10:45 -07:00
coffeegoddd☕️✨
4ff5308f9a /{cmd,internal}: server config 2026-05-08 10:25:47 -07:00
Harry Miller
b1db6b1328
Merge pull request #3581 from guyua9/fix/windows-drive-dolt-remote-guyua9
fix: preserve Windows drive remotes for dolt sync
2026-05-08 10:11:15 -07:00
matt wilkie
ee3ea9165c
Merge pull request #3746 from scotthamilton77/feat/hook-json-gemini-claude-compliance
feat(setup): Gemini/Claude hook JSON compliance, --hook-json flag, legacy migration
2026-05-08 09:52:46 -07:00
Harry Miller
ce62266b54
Merge pull request #3509 from seanmartinsmith/docs/import-help-completeness
docs(import): enumerate all fields the importer handles in --help
2026-05-08 09:34:16 -07:00
matt wilkie
f52c78b2a1 fix(setup): finish hook JSON migration 2026-05-08 09:21:39 -07:00
Scott Hamilton
287d8a84c8 feat(setup): Gemini/Claude hook JSON compliance, --hook-json flag, legacy migration
Fixes Gemini CLI hook integration by emitting the required SessionStart JSON envelope. Extends the same standard to Claude Code hooks (documented spec, not just tolerated raw text). Adds legacy detection in bd setup gemini --check.

- Add `--hook-json` flag to `bd prime` wrapping output in the cross-CLI `hookSpecificOutput.additionalContext` JSON envelope (Claude Code, Gemini CLI, and Codex all share this contract)
- Update `bd setup gemini` to register `bd prime --hook-json` on SessionStart; remove PreCompress registration (advisory-only, no additionalContext support per Gemini docs v0.40.1)
- Update `bd setup claude` to register `bd prime --hook-json` on SessionStart and PreCompact (JSON form is the documented spec; raw text was merely tolerated)
- Migration sweeps in both setup commands so re-running upgrades bare-command installs cleanly
- `bd setup gemini --check` distinguishes current (`--hook-json`) from legacy (bare `bd prime`) installs and emits upgrade advisory for legacy
- Fix `removeHookCommand` bug: previously dropped entire hook entry on first command match, silently deleting sibling commands; now filters only the matching command and drops the entry only when empty
- Refresh docs and recipes to reflect SessionStart-only Gemini hook behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-05-08 09:16:25 -07:00
matt wilkie
65a61df6f7
Merge pull request #3819 from cdimartino/codex-hooks-integration
feat(setup): add add proper codex hook integration
2026-05-08 09:15:08 -07:00
Jim Wordelman
2a5a9802bc
fix(dolt): bd dolt status probes SQL when local server is externally-managed
Route bd dolt status through the SQL probe when dolt_mode=server points at a local host but bd auto-start is disabled. In that configuration bd is not the server lifecycle owner, so the PID-file path can report a false negative even though the configured sql-server is reachable.

Keep the bd-managed local PID-file status path unchanged and covered with rendering tests. Document the observable JSON shape change for affected automation in the Unreleased changelog.

Fixes be-0eyj.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 08:29:16 -07:00
seanmartinsmith
4eaced4092
test(setup): use filepath.Join in TestGeminiSettingsPaths assertions (#3555)
Test hardcoded forward-slash path literals against output from
filepath.Join, so it failed on Windows even though the production
code (geminiProjectSettingsPath, geminiGlobalSettingsPath) was
correct.

Matches the existing pattern from TestMuxProjectAgentsPath and
TestMuxGlobalAgentsPath in the same package, which compare
filepath.Join(...) on both sides.

Fixes #3554
2026-05-08 08:20:11 -07:00
cdimartino
e69c53d893 Add proper hook integration 2026-05-08 11:16:49 -04:00
upgrade-test
ce242a8796 chore: Bump version to 1.0.4 2026-05-07 16:57:58 -07:00
coffeegoddd☕️✨
55b302a3e0 /cmd/bd: some cleanup 2026-05-07 16:40:03 -07:00
coffeegoddd☕️✨
4bf03b31e6 /{cmd,internal}: initial proxy server backend pass 2026-05-07 16:26:16 -07:00
Dustin Brown
e17502dda1
Merge pull request #3792 from coffeegoddd/db/proxy-3
add doltserver store (storage.DoltStorage)
2026-05-07 13:08:09 -07:00
matt wilkie
01f57ee3df
test: fix release preflight harness checks
Fix release pre-flight harness checks found while validating v1.0.4.

- prefer initialized dbPath over inherited BEADS_DIR for no-DB commands
- update npm integration assumptions for grouped help and embedded Dolt behavior
- read Version from cmd/bd/version.go in upgrade smoke test
- resolve relative CANDIDATE_BIN before running candidate commands from temp workspaces
- skip hook/agent setup in upgrade smoke init to avoid old-version timeout paths
- seed worktree hook-path test before git worktree add

Fixes #3764.

Verification:
- go test -tags gms_pure_go ./cmd/bd -count=1
- npm --prefix npm-package run test:all
- ./scripts/release.sh 1.0.4 --dry-run
- go test -tags gms_pure_go ./...
- make test-upgrade

Note: local make test-regression timed out separately in TestEpicWithChildrenStatus after most scenarios passed; CI passed on this PR.
2026-05-07 10:30:35 -07:00
coffeegoddd☕️✨
5e66b2a675 /cmd/bd/db_proxy_child.go: rebase main 2026-05-06 15:41:16 -07:00
Dustin Brown
6a6421740a
Merge pull request #3761 from coffeegoddd/db/proxy-2
wire DoltServer into db-proxy-child for the local-server backend
2026-05-06 15:38:43 -07:00
coffeegoddd☕️✨
adb0cc1a40 /cmd/bd/db_proxy_child.go: cleanup 2026-05-06 15:16:33 -07:00
coffeegoddd☕️✨
bed5e5f857 /{cmd,internal}: wire up db proxy child 2026-05-06 15:11:25 -07:00
matt wilkie
4f622a5d2f
Merge pull request #3609 from jjgarzella/fix/bd-close-routing-fallback
fix(close): route ID resolution like show/update (closes #3608)
2026-05-06 13:21:55 -07:00
AI Tooling for @idvorkin
bbd4e4d3c1
fix(mol): recognize TypeMolecule roots in findParentMolecules (#3719) (#3721)
`bd mol pour` creates molecule roots with `IssueType: types.TypeMolecule`
(cmd/bd/cook.go:452, :840), but `findParentMolecules` only treated
`TypeEpic` or template-labeled issues as molecule roots. As a result,
walking up from any poured-molecule step never found a parent, so:

  - `bd close <step> --continue` silently no-oped (`AdvanceToNextStep`
    returned `nil, nil` and the close-flow skipped its print path)
  - `bd close <step> --continue --claim-next` claimed nothing — the
    `--claim-next` branch in close.go is gated on `!continueFlag`

The existing tests (TestFindParentMolecule, TestFindParentMoleculesBatch,
TestAdvanceToNextStep, plus its concurrency variants) all construct the
root with `TypeEpic + BeadsTemplateLabel`, so both isMolecule clauses
matched and the gap stayed hidden.

Add `TypeMolecule` to the isMolecule check, plus two regression tests:

  - TestFindParentMolecule_RootShapes — table-driven, covers every root
    shape (TypeEpic+label, TypeMolecule no-label, TypeTask+label, plain
    TypeTask) for both findParentMolecule and findParentMolecules.
  - TestAdvanceToNextStep_PouredMolecule — reproduces #3719 end-to-end:
    poured-style root, autoClaim=true, asserts the next step is
    actually moved to in_progress.

Fixes #3719

Co-authored-by: AI+idvorkin <aitools-idvorkin@gmail.com>
2026-05-06 13:17:07 -07:00
CI Bot
03385349b3 fix(close): adapt routed close to current main
Keep the PR #3609 behavior while aligning the rebased branch with current main: preserve local -> prefix -> contributor-auto routing precedence, use the centralized Dolt auto-commit path for routed stores, and remove stale embedded-flock framing from comments and changelog.

Refs GH#3609
2026-05-06 13:04:54 -07:00
JJ Garzella
ba9d2507ee test(close): table-driven routing-fallback tests (beads-bn1)
Replaces the two single-purpose tests added in beads-0km with one
table-driven test covering three scenarios:

- maintainer-mode local-only resolution (no routing involved).
- contributor batch where every ID lives in the planning store; both
  results must share one routed-store handle (the dedupe that prevents
  the GH#3586 flock-deadlock pattern).
- contributor mixed batch with one local and one routed ID; validates
  per-result store routing and the mutatedStores fan-out invariant.

Also extracts a small seedIssue helper so the case bodies stay focused
on the per-case wiring.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 13:04:54 -07:00
JJ Garzella
564bd1ea77 fix(close): route ID resolution like show/update (beads-0km)
bd close called utils.ResolvePartialID directly against the local store,
while bd show and bd update went through resolveAndGetIssueWithRouting.
In contributor auto-routing mode (routing.mode=auto + routing.contributor
+ beads.role=contributor), bd create writes new issues to the routed
planning store; show/update found them via the routing fallback but close
errored with "no issue found matching <id>" — even for IDs that bd create
had just returned.

Replaces the bare resolver with resolveCloseTargets, which:
- Tries the local store first (fast path).
- Falls back to a single shared contributor-routed handle reused across
  every routed ID. Per-id routing would deadlock on the embeddeddolt
  flock (same class as GH#3586) for the common case of bulk-closing
  several IDs that all live in the planning store.
- Falls back to explicit prefix routing via routes.jsonl as a last resort.

The per-id close loop now uses each result's Store for IsBlocked,
CloseIssue, autoCloseCompletedMolecule, and the re-fetch. countEpicOpenChildren
takes an explicit store parameter. CommitPending fans out across every
mutated store so embedded-mode flushes the routed store too.
--suggest-next, --continue, and --claim-next reuse the first resolved
result's store, matching the common-case assumption that all IDs route
together.

Adds two regression tests:
- TestResolveCloseTargets_RoutesToContributorPlanning: multi-id batch
  resolves through one shared routed handle.
- TestResolveCloseTargets_LocalStoreUnchanged: maintainer-mode close
  resolves against the local store with no routing involved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 13:04:54 -07:00
Kevin Glynn
059d729b1a
fix(setup): drop bd sync from Mux fallback; warn on stale Claude hooks (GH#3546) (#3642)
Mux post-edit hook now calls bd dolt push when only ~/bin/bd is available,
matching the primary branch.

bd setup claude --check scans Claude settings for removed bd sync hook
commands and prints a stderr warning with remediation.

Tests: TestClaudeSettingsUsesRemovedSyncCommand.
2026-05-06 12:57:09 -07:00
Kevin Glynn
d648b6a264
fix(list): emphasize truncation warning with WarnStyle (GH#3580) (#3739)
The truncation hint from printTruncationHint was plain text, easily
missed — especially in --tree mode where truncation can make the
tree structure misleading. Render it with ui.RenderWarn (yellow)
so the warning stands out.

Closes gastownhall#3580
2026-05-06 12:33:25 -07:00
Julian Knutsen
7a1f7e4cde
fix(release): harden shipped release formula adoption (#3668) 2026-05-06 12:14:54 -07:00
Harry Miller
b47a36ec85
Merge pull request #3742 from seanmartinsmith/fix/plugin-claude-agents-validation
fix(plugin): move claude agent out of shared codex dir to fix plugin install
2026-05-06 11:36:37 -07:00