Commit graph

3,333 commits

Author SHA1 Message Date
coffeegoddd☕️✨
fa87dd2bdd feat: add global beads_global database for shared-server mode
Adds a project-agnostic beads_global database to shared-server mode so
clients can track issues globally across all projects on the server.

- Add EnsureGlobalDatabase() to create the DB during shared server init
- Add --global persistent flag to switch CLI commands to the global DB
- Add global_dolt_database field to metadata.json for connection info
- Seed global DB with issue_prefix="global" and sentinel project ID
- Export/import default to global-issues.jsonl with --global flag
- --global errors when not in shared-server mode (additive, no breakage)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 09:18:43 -07:00
matt wilkie
64e504d541
fix: enable auto-export by default and add init prompt (GH#2973) (#3204)
* fix: enable auto-export by default with canonical issues.jsonl name (GH#2973)

Users expected JSONL export to refresh automatically but export.auto
defaulted to false, requiring explicit opt-in. Also the default filename
(export.jsonl) didn't match the canonical issues.jsonl used in docs and
git hooks. Change defaults: export.auto=true, export.path=issues.jsonl,
export.git-add=true so viewers (bv) and git workflows see fresh data
without extra configuration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(init): add auto-export prompt and document export.* config (GH#2973)

Interactive bd init now asks whether to enable auto-export (default: yes).
Users can opt out during setup instead of discovering the setting later.

Also documents the export.* config namespace in bd config --help with
all four keys (export.auto, export.path, export.interval, export.git-add)
and adds export examples.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* docs: document export.* auto-export config keys (GH#2973)

Document the export.auto/path/interval/git-add keys in docs/CONFIG.md
and note the default-on switch in CHANGELOG.md [Unreleased].

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(export): don't prime throttle on empty init and skip git-add without git (GH#2973)

Review feedback on #3204 surfaced two regressions in the default-on
auto-export path:

1. bd init's PersistentPostRun fired maybeAutoExport with zero issues,
   writing an empty .beads/issues.jsonl and saving export-state.json with
   the current dolt commit + timestamp. The next `bd create` was then
   throttled for up to export.interval (default 60s) because the
   timestamp check in maybeAutoExport returned before considering the new
   commit, leaving issues.jsonl stale on fresh repos.

   Skip saving state and remove the empty file when the export produced
   no issues and no memories. The next write runs a real export
   immediately.

2. export.git-add defaulting to true emitted
   `Warning: auto-export: git add failed: exit status 128` on every
   write in the supported standalone BEADS_DIR flow where init
   intentionally skips `git init`. Gate the git add call on isGitRepo()
   so standalone users get silent, working auto-export.

Adds a scripttest regression guard for the init -> immediate create
path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(memory): disable auto-export in concurrent test (GH#2973)

TestEmbeddedMemoryConcurrent started failing on this branch after
auto-export became the default: every concurrent 'bd remember'/'bd
forget' call now fires maybeAutoExport, which reads store state after
the write. Under 8-worker contention this intermittently leaves a
forgotten key visible to 'bd memories'.

The test exercises memory concurrency, not export behavior; opt it
out of auto-export so the signal stays focused. Followup: investigate
the race between write commit and post-write auto-export read in
embedded Dolt concurrent paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 16:02:58 -07:00
matt wilkie
ebcb901d7a
fix(bootstrap): commit issue_prefix to config table (GH#3216) (#3247)
bd init/restore/import wrote issue_prefix via SetConfig but called
Commit(), which excludes the config table per GH#2455. The prefix row
sat orphaned in the working set forever, causing bd dolt pull to fail
with "cannot merge with uncommitted changes" on every fresh init.

Fix: use CommitWithConfig in the three bootstrap paths, matching the
pattern PR #3052 introduced for remember/forget/config set. Promote
CommitWithConfig to the VersionControl interface and add an alias on
EmbeddedDoltStore (whose Commit already includes config via DOLT_ADD -A).

Reported by @GraemeF.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:54:50 -07:00
matt wilkie
7ada7900d8
fix(list): emit informative truncation hint in all output modes (GH#3212) (#3243)
* fix(list): show informative truncation hint and emit in JSON mode (GH#3212)

bd list silently truncated at --limit (default 50) with no reliable signal
that results were hidden. The existing hint fired when len==limit, which
both gave false positives (exact match count) and no warning for JSON
consumers.

Fetch one extra row (effectiveLimit+1) to detect truncation accurately,
then emit a clearer one-line hint to stderr in all output modes —
including --json, --format, pretty/tree, and agent mode — so downstream
agents and scripts don't mistake a partial view for a complete one.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(list): capture stdout/stderr separately; cover truncation hint

TestEmbeddedList/limit used CombinedOutput() to parse JSON, so it choked
on the new stderr hint landing after the JSON array. Split stdout/stderr
in bdListJSON, add bdListCapture helper, and add a limit_truncation_hint
subtest covering GH#3212:
- hint appears on stderr when --limit truncates
- hint never leaks into stdout (JSON consumers)
- no hint with --limit 0 or when results fit under the cap

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(list): trim +1 overflow row in --watch mode (review feedback)

The truncation-detection change fetches effectiveLimit+1 rows, but the
watch loop re-ran SearchIssues with the bumped filter and never trimmed,
so every refresh rendered one extra issue (e.g. 21 rows under --limit 20).

Pass effectiveLimit to watchIssues and trim both the initial render and
each refresh; also surface the truncation hint in watch mode so persistent
watchers don't quietly show a partial view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:10:21 -07:00
Okano, Osamu
2568b6b404
Fix bd list watch hierarchy consistency (#3236)
* fix(list): keep watch hierarchy aligned with pretty output (beads-ymbv)

intent(list-watch): keep bd list --watch structurally aligned with bd list for parent-child relationships
decision(list-watch): reuse the dependency-aware pretty list renderer instead of the dotted-ID-only fallback
constraint(list-watch): watch mode still needs to render even if dependency records cannot be loaded
learned(list-watch): watch mode was the only list path that dropped parent-child hierarchy when IDs were not dotted

* fix(list): honor --parent in watch hierarchy (beads-fi04)

intent(list-watch): keep bd list --watch consistent with non-watch tree output when filtering by parent
decision(list-watch): load watched parent trees through getHierarchicalChildren and normalize them by id before snapshot comparison
constraint(list-watch): watch mode still needs deterministic snapshots even though parent tree assembly comes from map-backed descendant discovery
learned(list-watch): the earlier hierarchy fix only covered generic watch output because --parent exits through a separate pre-watch path
2026-04-13 11:01:42 -07:00
Okano, Osamu
9b4896f0e8
Fix formula search paths for worktree-aware beads dirs (#3235)
* fix(formula): resolve worktree-aware search paths (beads-oto)

intent(formula): worktree users should resolve formulas from the active shared .beads registry instead of cwd-only paths

decision(formula-search): route CLI help, formula lookup, and distill output hints through formula.DefaultSearchPaths so search path display matches runtime behavior

constraint(worktree): keep cwd/.beads fallback when no beads project is resolved so local formula registries still work before init

* fix(formula): align mol seed help with resolved search paths

intent(formula-help): worktree users should see the active beads workspace path instead of stale cwd-based guidance
constraint(formula-runtime): seed already resolves formulas through the shared default search helper so this change only updates the displayed contract

* test(formula): isolate worktree parser repo hooks

intent(formula-tests): keep worktree search path coverage focused on formula resolution instead of developer git hook state
constraint(git-test-repos): global core.hooksPath can inject failing pre-commit hooks into temp repos and break the setup commit
decision(formula-tests): reuse ForceRepoLocalHooksPath so the new worktree test follows the repo's existing git test isolation rule

* test(formula): simplify search-path test setup (beads-6kum)

intent(formula-tests): keep the new search-path coverage easy to extend without re-reading repetitive test scaffolding
constraint(formula-tests): helper extraction must preserve the hook-isolation and cache-reset behavior added for worktree coverage
decision(formula-tests): centralize repo init, fixture writing, and canonical path handling into local test helpers so each case stays focused on its assertions
2026-04-13 11:01:28 -07:00
matt wilkie
696ed0e9ba
fix(update): set status=deferred when --defer is provided (GH#3233) (#3241)
* fix(update): set status=deferred when --defer is provided (GH#3233)

`bd update --defer <date>` only set defer_until, leaving status=open,
so the ❄ icon (driven by status) was missing in `bd list`. `bd defer`
already sets both fields; align `bd update --defer` with that behavior.

Explicit --status wins if provided in the same invocation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(update): handle past-date and clear cases for --defer (GH#3233)

Address review feedback on the previous commit:

- Past-date --defer no longer flips status to deferred. The warning at
  this path promises the issue "will appear in bd ready immediately",
  which requires status to stay open.
- --defer="" now restores status=open (only when the issue was actually
  deferred), so the help text "show in bd ready immediately" holds.
  Non-deferred statuses like in_progress are preserved.

Explicit --status continues to win in both directions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 10:22:59 -07:00
Harry Miller
7ea14b23d2
security: harden remote URL validation at config parse time (#3210)
Add strict security validation for remote URLs and remote names to prevent
injection attacks when multi-remote support lands.

Changes:
- Add ValidateRemoteURL() with control character rejection, CLI flag
  injection prevention, scheme allowlist, and per-scheme structural
  validation (host/path requirements)
- Add ValidateRemoteName() aligned with existing peer-name policy
  (letter-start, alphanumeric + hyphen/underscore, max 64 chars)
- Add MatchesRemotePattern() and ValidateRemoteURLWithPatterns() for
  enterprise lockdown via federation.allowed-remote-patterns config
- Move config validation from simple IsRemoteURL() classifier to strict
  ValidateRemoteURL() security boundary
- Add defense-in-depth validation in AddCLIRemote/RemoveCLIRemote
- Add validation at clone entry points (cache.Ensure, bootstrap)
- Tighten SCP-style URL regex to exclude control characters in path
- Add comprehensive test coverage for null bytes, control chars,
  newline injection, CLI flag injection, scheme validation, structural
  validation, remote name edge cases, and pattern matching

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-13 09:58:50 -07:00
matt wilkie
dfd1add67d
chore(bootstrap): remove unreachable nil-cfg guard in finalizeSyncedBootstrap (#3222)
The caller chain (bootstrapCmd.Run → executeBootstrapPlan → executeSyncAction)
guarantees cfg is non-nil via DefaultConfig() fallback at bootstrap.go:178-180.

Follow-up to #3203.

Amp-Thread-ID: https://ampcode.com/threads/T-019d7fee-1326-74af-a566-9c45ad5b349e

Co-authored-by: Amp <amp@ampcode.com>
2026-04-12 14:46:51 -07:00
matt wilkie
bc613d8aaa
fix(hooks): sanitize husky hooks when copied into beads-managed dir (GH#3132) (#3208)
When `bd init` chains existing husky hooks into `.beads/hooks/`, it
blindly copied per-hook files whose `. "$(dirname "$0")/_/husky.sh"`
(v8) or `. "$(dirname "$0")/h"` (v9) source line dangles in the new
location. Result: v8 commits fail loudly with `husky.sh: No such file
or directory`; v9 commits silently no-op because husky's dispatcher
resolves to `.beads/<hook>` (does not exist) and exits 0, skipping all
of the user's lint-staged / formatter / etc. commands.

Detect husky source dirs and rewrite hook bodies to drop the helper
source line, injecting `node_modules/.bin` on PATH so `npx` and
project-local binaries continue to resolve. Skip copying husky's `h`
and `husky.sh` dispatchers, which are no longer needed once hooks are
inlined.
2026-04-12 14:45:43 -07:00
Julian Knutsen
4aa573db56
fix(bootstrap): write metadata.json and config.yaml after sync clone (#3203)
fix(bootstrap): write metadata.json and config.yaml after sync clone

executeSyncAction created .beads/ and cloned remote Dolt data but never
wrote metadata.json or config.yaml, leaving the workspace in a broken
state where bd status, bd where, and bd dolt push all failed.

Adds finalizeSyncedBootstrap helper that runs after cloneFromRemote and
mirrors what init does: save cfg as metadata.json, create the config.yaml
template, and persist sync.remote. The helper is idempotent so bootstrap
retries remain safe.

Fixes gastownhall/gascity#561

Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
2026-04-12 14:44:57 -07:00
matt wilkie
9d0b7ad5f1
fix: remove nonexistent -i flag from bd import references (#3200)
The bd import command takes a positional file argument, not a -i flag.
Three files referenced the nonexistent flag:
- cmd/bd/testdata/import.txt (testscript fixture)
- cmd/bd/testdata/export.txt (testscript fixture)
- CLAUDE.md (documentation)

Also updated CLAUDE.md comment from 'SQLite cache' to 'Dolt database'
to reflect the current storage backend.

Fixes bd-6nr, related to bd-7ds.

Amp-Thread-ID: https://ampcode.com/threads/T-019d7da6-5933-71c3-87bf-45fb4594ef25

Co-authored-by: Amp <amp@ampcode.com>
2026-04-11 12:31:38 -07:00
matt wilkie
df2078b56f
fix(ci): collapse multiline expression in cross-version-smoke workflow (#3189)
* fix(ci): collapse multiline expression in cross-version-smoke workflow

Multi-line plain YAML scalars are invalid — the ${{ }} expression
spanning multiple lines caused GitHub to reject the workflow file
immediately (0s, "workflow file issue") on every push to main.

Collapse to a single-line expression; semantics are unchanged.

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

* fix(ci): fix smoke test CWD, mode check, --silent compat, and prefix dots

Three independent bugs causing all 5 upgrade smoke scenarios to fail:

1. Smoke test CWD (root cause of most failures)
   - All `bd` invocations ran from the test script's CWD (the beads repo
     checkout), not from the isolated workspace $WS. This caused:
     * bd init to detect the beads repo's `origin` remote (has
       refs/dolt/data) and clone the entire beads Dolt database into $WS,
       corrupting the upgrade scenario and wasting minutes on chunk downloads.
     * `git config beads.role` to be written to the beads repo's git config
       instead of $WS's, so scenario 4's role check always failed.
   - Fix: add `prev()` and `cand()` helpers that cd into $WS before running.

2. `create --silent` not in binaries older than ~v1.1.0
   - --silent was added after the v1.0.0 release; calling it with older
     binaries silently failed (error to stderr, empty stdout), making every
     create attempt look like an init failure.
   - Fix: `prev_create()` helper tries --silent first, falls back to
     parsing any ID-like token from plain create output.

3. Mode preservation check used wrong path
   - Embedded Dolt stores data in `.beads/embeddeddolt/` (a directory).
     The test checked for `.beads/beads.db` (a file), which never exists
     in embedded mode, so the "DB exists before/after upgrade" assertions
     always failed.
   - Fix: `embedded_db_exists()` checks for either the directory
     (current embedded mode) or the legacy SQLite file.

Also fix issue_prefix dot sanitization in init.go (TestEmbeddedInit/
prefix_dot_sanitized): when a prefix like "GPUPolynomials.jl" is used,
`issue_prefix` stored in the DB must have dots replaced with underscores
(matching DoltDatabase sanitization), otherwise issue IDs contain dots.

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

* fix(ci): handle embedded-mode edge cases in upgrade smoke test

Three remaining failures after the CWD fix:

1. `storage.mode (not set)` treated as failure
   The `config get storage.mode` output includes the key name and "(not set)"
   when the config key doesn't exist. Embedded mode is the default and doesn't
   require an explicit setting, so any "not set" output should be accepted.
   Also accept the empty-string case that can arise with older config formats.

2. Embedded DB check too strict for v0.63.x
   v0.63.x was the first embedded-mode release; its init installed hooks and
   set beads.role correctly but may not have fully initialized the embeddeddolt/
   directory in CI due to early-release bugs. Changed the pre-upgrade check to
   verify `.beads/` directory exists (init ran) rather than the specific
   embeddeddolt/ subdirectory.

3. Create failures in old binaries treated as hard failures
   When an old binary cannot create issues (e.g. v0.63.x embedded init bug),
   the test now skips the data-migration and mutation checks with a `pass`
   (annotated as "skipped") rather than failing. The role-preservation and
   doctor checks still run.

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

* fix(ci): handle pre-embedded (server-mode) releases in smoke test scenario 3

v0.60.0-v0.62.0 used server mode and required an external Dolt server
to initialize. Without a running server in CI, their init installs hooks
but cannot create .beads/. The mode-preservation scenario was treating
this as a failure.

Change the pre-upgrade check in scenario 3 to skip gracefully when
.beads/ doesn't exist (old binary requires external server). The scenario
still runs candidate init and verifies the candidate defaults to embedded
mode — which is the meaningful test.

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 10:34:02 -07:00
Jim Wordelman
652d321968
fix: set FS_NOCOW_FL on .beads/ at init to avoid btrfs kworker thrashing (#3162)
Co-authored-by: quad341 <quad341@users.noreply.github.com>
2026-04-10 21:52:18 -07:00
Okano, Osamu
ef6c6e3e48
Follow up remaining runtime .beads fallbacks after GH#3124 (#3183)
* fix(workspace): align resolved workspace messaging and config lookup

intent(workspace): pure worktrees and external BEADS_DIR setups should work without implying a local .beads directory is required
decision(config): derive config repo roots from FindBeadsDir-backed workspace resolution instead of a local-only .beads walk
constraint(workspace-detection): keep FindBeadsDir ordering and storage behavior unchanged while making bd where the primary diagnostic hint
learned(testing): shared-server env and global .beads ignore rules can distort CGO suites, so regression coverage now normalizes those test paths

* fix(bootstrap): align no-workspace JSON wording

intent(bootstrap): machine-readable no-workspace output should match the resolved-workspace guidance used elsewhere on this branch
decision(bootstrap-json): reuse the shared workspace error helpers through a dedicated payload builder so tests can lock the JSON contract
constraint(review-loop): keep the bootstrap CLI flow unchanged outside the no-workspace JSON branch while adding a focused regression test

* fix(where): allow no-workspace diagnostics without db (beads-9f74-5l1)

intent(where): no-workspace guidance should point to a command that actually runs when workspace resolution fails
decision(startup): treat top-level where as a no-db command so it reaches its own handler before database preflight
constraint(where-tests): subprocess mode can change the exact hint text, so the regression test locks the JSON contract and stable guidance fragments instead

* fix(bootstrap): restore bd where guidance for no-workspace output (beads-9f74-3c3)

intent(bootstrap): no-workspace bootstrap guidance should match the resolved-workspace diagnostics introduced on this branch
decision(no-workspace-hints): reuse the shared hint that mentions bd where instead of the bootstrap-specific fallback text
constraint(bootstrap-tests): cover both the payload helper and subprocess CLI path so wording regressions are caught before release

* fix(workspace): remove no-workspace .beads fallbacks (beads-9f74-gr1)

intent(workspace-resolution): finish the GH#3124 follow-up for runtime paths that still fabricated local .beads state
rejected(no-workspace-fallback): inventing ./ .beads paths outside an active workspace hid shared-worktree resolution and created stray files
decision(setup-recipes): keep built-in bd setup recipes usable without a workspace but require an active workspace for custom recipe state
constraint(worktree-support): completion and backup helpers still need to resolve shared main-repo workspaces from a git worktree

* fix(config): skip no-workspace store init for store-free commands

intent(config): review-fix-loop found no-workspace config commands should reach their own graceful paths instead of failing in PersistentPreRun
decision(config-preflight): detect store-free config subcommands before DB synthesis so config.yaml, git-backed, and diagnostic flows can run without an opened store
constraint(json-contract): keep bd config validate --json machine-readable on stdout once pre-run stops short-circuiting into low-level DB errors
learned(config-preflight): the parent config command not being in noDbCommands leaked store init into show, validate, drift, apply, and yaml-only config helpers

* fix(ci): restore init prefix normalization and formatting

intent(ci): clear the current PR failures instead of leaving the branch blocked behind known red checks

decision(init-prefix): normalize dotted prefixes before persisting issue_prefix so config, metadata.json, and Dolt database naming stay aligned for Julia-style repos
constraint(fmt-check): CI runs gofmt over the whole repo, so the existing spacing drift in internal/jira/tracker_test.go had to be cleaned up on this branch to get a green run
learned(ci): the latest main CI was already red on the same formatting file and the same embedded shard, so rebasing surfaced pre-existing blockers rather than introducing a new shard-only regression
2026-04-10 21:23:14 -07:00
matt wilkie
3c7dec4fe6
fix(dolt): reject empty database name in embeddeddolt.New (GH#3113) (#3179)
Guard against empty database name early with a clear error message
instead of failing deep in schema migrations with "no database
selected". Includes regression tests for the guard and for
bd create --repo with an uninitialized target directory.

Cherry-picked from thejosephstevens#3113 — thank you Jo Stevens!

Co-authored-by: Jo Stevens <thejosephstevens@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 20:32:26 -07:00
coffeegoddd☕️✨
bf028bfc9a /cmd/bd/context_cmd.go: keep deprecated field 2026-04-10 15:04:20 -07:00
coffeegoddd☕️✨
4b3b06ef25 /{cmd,internal}: fix lint 2026-04-10 14:40:15 -07:00
coffeegoddd☕️✨
1684130a26 /{cmd,docs,internal}: get bootstrap and init working correctly and remote agnostic 2026-04-10 14:37:49 -07:00
coffeegoddd☕️✨
c96008f975 /cmd/bd: unify behavior of bd init and bootstrap 2026-04-10 14:36:19 -07:00
Harry Miller
8c8329a1af
Add side-effect hints for config set/unset commands (#3089)
Add side-effect hints for config set/unset commands.

After bd config set/unset changes a key with system-level side effects (federation.remote, dolt.shared-server, routing.mode, backup.enabled, sync.git-remote), prints actionable hints to stderr. Hints are informational and never block the operation.

Maintainer fixes: added missing 'explicit' routing mode, fixed test stderr redirect.

Thanks to @harry-miller-trimble for the contribution!

Closes bd-9qv
2026-04-10 14:04:46 -07:00
Harry Miller
e42f498acf
Improve config list: dynamic yaml key discovery and comprehensive env var detection (#3088)
Improve config list: dynamic key discovery and comprehensive env var detection.

Replaces the hardcoded yaml-only key list with config.AllKeys() + IsYamlOnlyKey() so new keys are automatically included. Fixes env override detection to use config.EnvVarName() for both BD_* and legacy BEADS_* prefixes with LookupEnv.

Thanks to @harry-miller-trimble for the contribution!

Closes bd-uss
2026-04-10 14:03:20 -07:00
Harry Miller
7ada135baf
Add az:// (Azure Blob Storage) as a recognized Dolt remote URL scheme (#3101)
Add az:// (Azure Blob Storage) as a recognized Dolt remote URL scheme.

Azure Blob Storage URLs were already functional for bootstrap via sync.git-remote, but the URL validator didn't recognize az:// — so config validate and error hints were incomplete.

Thanks to @harry-miller-trimble for the contribution!
2026-04-10 14:03:16 -07:00
Graeme Foster
1a218aa56f
fix: explicitly disable TLS in Dolt connections when not configured (#3107)
go-sql-driver/mysql v1.8+ changed the default TLS mode from "false" to
"preferred", causing all connections to attempt TLS negotiation. Dolt
servers without TLS configured reject this with "TLS requested but server
does not support TLS" instead of gracefully declining.

- ServerDSN.String() now explicitly sets tls=false when TLS is not enabled
- All ServerDSN call sites plumb cfg.GetDoltServerTLS() so Hosted Dolt
  users with BEADS_DOLT_SERVER_TLS=1 get TLS on every code path
- Added dsn_test.go with explicit TLS on/off assertions

Authored-by: Graeme Foster <80714+GraemeF@users.noreply.github.com>
2026-04-10 13:55:06 -07:00
Jack J Garzella
f3d4293b35
fix(init): sanitize dots in metadata.json DoltDatabase and add early validation (#3129)
Two bugs in bd init when the directory name contains dots (e.g. GPUPolynomials.jl):

1. metadata.json mismatch: dbName sanitized hyphens AND dots to underscores,
   but cfg.DoltDatabase only sanitized hyphens. This caused init in dotted
   directories to create a database under one name but record a different name
   in metadata.json, breaking every subsequent command.

2. No early validation for characters that survive sanitization (spaces, @, etc.):
   errors came from deep in the storage layer with no actionable hint.

Fixes #3128

Co-Authored-By: JJ Garzella <jjgarzella@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 13:51:41 -07:00
Dustin Brown
6466a09215
Merge pull request #3171 from coffeegoddd/db/remote-fix
fix(embeddeddolt): /cmd/bd/dolt.go: fix remote overwrite
2026-04-10 13:31:00 -07:00
coffeegoddd☕️✨
6385508af8 /cmd/bd/dolt.go: fix remote overwrite 2026-04-10 13:13:43 -07:00
Jim Wordelman
e39f041783
feat: add 'bd batch' for atomic multi-op transactions (#3165)
Shell scripts that loop over 'bd' invocations cause severe write
amplification on a dolt sql-server backed by btrfs+compression: each
process opens a connection, runs one operation, and creates one
DOLT_COMMIT. This new command lets a script collapse N operations into
a single dolt transaction with one DOLT_COMMIT.

Reads simple line-oriented commands from stdin (or -f file). Supported
subset matches what existing gascity orders actually loop over:

  close <id> [reason...]
  update <id> <key>=<value> [<key>=<value> ...]
  create <type> <priority> <title...>
  dep add <from-id> <to-id> [type]
  dep remove <from-id> <to-id>

Update keys: status, priority, title, assignee.

The command dispatches directly against storage.Transaction (which
already exists) so no refactoring of the existing cobra handlers is
required. Unsupported commands fail at parse time before any writes,
and any error inside the transaction rolls the whole batch back.

Tests:
- batch_test.go: tokenizer, parser, supported/unsupported commands,
  update key validation, command registration
- batch_embedded_test.go (//go:build cgo): full transaction commit,
  rollback on FK error, empty input no-op, unsupported command guard,
  dep remove path, and a guard test confirming the rollback trigger
  still actually fails at the storage layer

Co-authored-by: Jim Wordelman <jim@wordelman.name>
2026-04-10 13:10:59 -07:00
matt wilkie
2450c83b4c
Merge pull request #3118 from osamu2001/fix/hooks-worktree-main-repo-root
fix: use main repo root for hooks path in worktrees
2026-04-10 11:54:17 -07:00
Daniel Santo
01a3767ab6
fix(mol): use word-boundary regex in distill applyReplacements (#3157)
Thank you @thedanielsanto for the fix and thorough test coverage!
2026-04-10 11:53:52 -07:00
matt wilkie
0d1185119e refactor: simplify worktree root resolution in hooks
GetMainRepoRoot() already falls back to regular repo root for
non-worktree repos, making the IsWorktree() guard redundant.
Simplify all 5 call sites.

Co-Authored-By: osamu2001 <osamu2001@users.noreply.github.com>
2026-04-10 11:53:32 -07:00
Osamu Okano
093d5a99ea test: add worktree tests for hooks path configuration 2026-04-10 11:51:08 -07:00
Osamu Okano
0f6c3065e5 fix: use main repo root for hooks path in worktrees
git.GetRepoRoot() returns the worktree root, which causes
core.hooksPath to point to a non-existent path. Use
git.GetMainRepoRoot() in worktrees so hooks resolve correctly.
2026-04-10 11:51:08 -07:00
matt wilkie
5b64538611
Merge pull request #3116 from osamu2001/fix/reset-worktree-beads-path
fix: use FindBeadsDir for worktree-aware reset
2026-04-10 11:50:40 -07:00
matt wilkie
70e159689b fix: remove redundant os.Stat check after FindBeadsDir
FindBeadsDir() already validates directory existence internally,
so the subsequent os.Stat guard is unreachable dead code.

Co-Authored-By: osamu2001 <osamu2001@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 11:49:56 -07:00
matt wilkie
28cad635b4
Merge pull request #3120 from osamu2001/fix/doctor-worktree-path-resolution
fix: use worktree-aware beads dir in doctor checks
2026-04-10 11:48:45 -07:00
matt wilkie
7fa91c5a50
Merge pull request #3119 from osamu2001/fix/config-preflight-worktree-paths
fix: worktree-aware path resolution in config validate and preflight
2026-04-10 11:48:34 -07:00
matt wilkie
6804d9fd15
Merge pull request #3117 from osamu2001/fix/bootstrap-worktree-stray-beads
fix: use worktree fallback in bootstrap path synthesis
2026-04-10 11:48:24 -07:00
matt wilkie
fe1b5a880e
Merge pull request #3115 from osamu2001/fix/init-force-worktree-count
fix: add worktree fallback to countExistingIssues
2026-04-10 11:48:12 -07:00
matt wilkie
cbab45a28f
Merge pull request #3114 from osamu2001/fix/remove-worktree-rename-prefix-guard
fix: remove stale worktree guard in rename-prefix
2026-04-10 11:48:01 -07:00
matt wilkie
8ec324f0fd
Merge pull request #3168 from gastownhall/worktree-fix-3136-cross-prefix-dep
fix: allow cross-prefix dependency targets in bd dep add/remove
2026-04-10 11:45:51 -07:00
matt wilkie
7b02eddaf3 fix: allow cross-prefix dependency targets in bd dep add/remove
When resolveIDWithRouting fails for the dep target, check if the source
and target have different prefixes via types.ExtractPrefix. If they differ,
pass the raw ID through to AddDependency and let the storage layer handle
it via isCrossPrefixDep(). Applied to both dep add and dep remove.

Fixes #3134.

Co-authored-by: seanmartinsmith <seanmartinsmith@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 09:57:11 -07:00
matt wilkie
e54bc625fd
fix: correct 'bd config' hints to 'bd config set' in error messages (#3141)
Ten error messages across github, gitlab, and ado commands recommend
'bd config {key} {value}' but the CLI requires the 'set' verb:
'bd config set {key} {value}'.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 10:11:00 -07:00
matt wilkie
64678bcb34
fix: show diverged-history guidance on auto-push failure (#3138)
* fix: show diverged-history guidance on auto-push failure

When dolt auto-push fails with a 'no common ancestor' error, the user
only sees a cryptic warning. The explicit 'bd dolt push' and 'bd dolt
pull' commands already detect this and print recovery guidance via
printDivergedHistoryGuidance(), but the auto-push path did not.

Now auto-push also calls isDivergedHistoryErr() and prints the same
actionable recovery options (bootstrap, force-push, or re-init).

Amp-Thread-ID: https://ampcode.com/threads/T-019d6ee7-e46d-74f8-8b6e-2a0fc1b2d4d7
Co-authored-by: Amp <amp@ampcode.com>

* fix: store secret config keys in config.yaml, not Dolt DB

Keys like github.token and linear.api_key were stored in the Dolt
database's config table. When auto-push sends that data to a GitHub
remote, GitHub's push protection blocks the push because it detects
embedded secrets in the Dolt data files.

Fix: add github.token and linear.api_key to YamlOnlyKeys so they're
written to .beads/config.yaml (local-only, gitignored) instead of
the Dolt database. Update the read paths in getGitHubConfigValue()
and getLinearConfig() to check YAML config first for these keys.

Amp-Thread-ID: https://ampcode.com/threads/T-019d6ee7-e46d-74f8-8b6e-2a0fc1b2d4d7
Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-04-08 15:55:37 -07:00
coffeegoddd☕️✨
c71930d1e5 /{cmd,internal}: pr feedback 2026-04-08 15:03:32 -07:00
coffeegoddd☕️✨
5b81cbcb71 /cmd/bd: some cleanup 2026-04-08 14:53:58 -07:00
coffeegoddd☕️✨
a0849721ba /{cmd,internal}: some cleanup 2026-04-08 14:45:18 -07:00
coffeegoddd☕️✨
9778764aa3 /cmd/bd/shared_server_integration_test.go: run behind env var 2026-04-08 14:39:09 -07:00
coffeegoddd☕️✨
1444c6c726 /cmd/bd/shared_server_integration_test.go: log times in verbose mode 2026-04-08 14:18:42 -07:00
coffeegoddd☕️✨
0c2dfc14af /{cmd,internal}: shared server concurrency tests 2026-04-08 13:22:54 -07:00