Commit graph

3 commits

Author SHA1 Message Date
CI Bot
37c97e0b79 fix(init): guard JSONL init against remote history
_codex-gpt-5.5-xhigh on behalf of CI Bot_

Agent-Signature: codex-gpt-5.5-medium on behalf of matt wilkie
Agent-Signature: claude-unknown-model-high on behalf of matt wilkie
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of matt wilkie
2026-06-22 15:28:38 -07:00
Kevin Glynn
d585928bb3
feat(init): add --init-if-missing for idempotent init (#3490) (#4332)
* feat(init): add --init-if-missing for idempotent init (#3490)

bd init aborts with exit 1 when the workspace is already initialized,
forcing scaffold scripts to pre-stat .beads/embeddeddolt/<prefix> to tell
"already initialized" (benign) apart from real errors. Add an opt-in
--init-if-missing flag: when the workspace already exists, init prints a
benign "Skipping init: workspace already initialized." to stderr and exits 0.
Default behavior (flag absent) is unchanged - exit 1 with the existing
"already initialized ... Aborting" message.

The flag is intercepted only at the existing checkExistingBeadsData guard
call site; detection logic and the --force/--reinit-local paths are untouched.

Docs regenerated via scripts/generate-cli-docs.sh and generate-llms-full.sh.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(init): abort --init-if-missing on explicit prefix mismatch

--init-if-missing silently skipped whenever a workspace already existed,
even if the caller passed an explicit --prefix that differed from the
existing workspace. That masked a real mismatch: `bd init --prefix bar
--init-if-missing` against an existing `foo` workspace exited 0 and
ignored the requested prefix.

Now, when --prefix is set explicitly (and --database is not), compare the
requested prefix against the existing workspace's recorded DoltDatabase
and abort on a genuine mismatch; matching or undeterminable cases still
skip benignly. Extracts the prefix->dbName normalization into shared
helpers so the guard derives exactly the same name init records, and
factors the decision into a pure, unit-tested helper.

Refs #3490

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(init): don't mask operational errors or --database mismatch under --init-if-missing

Two idempotent-init correctness fixes on top of #4332 (reviewer Bernoulli):

1. checkExistingBeadsData now distinguishes the benign "already initialized"
   outcome (errWorkspaceAlreadyInitialized, carried by a workspaceExistsError
   that keeps the user-facing message) from operational errors such as an
   unreadable .beads/embeddeddolt directory. --init-if-missing skips only the
   benign case; an operational error still aborts instead of being masked as a
   successful idempotent skip.

2. An explicit --database mismatch now aborts --init-if-missing, mirroring the
   existing --prefix guard. --database is the authoritative database selector,
   so it is checked even when --prefix is also set.

Tests: initIfMissingDatabaseMismatch table; checkExistingBeadsDataAt returns a
sentinel-matching error for an existing database and a non-matching
(operational) error when embeddeddolt is unreadable.

Agent-Signature: claude-opus-4-8-high on behalf of maphew

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
2026-06-18 09:51:27 -07:00
matt wilkie
b55472412b
docs: snapshot versioned docs for 1.0.5 release (#4246)
The v1.0.5 tag shipped with cmd/bd/version.go bumped to 1.0.5 but without
the Docusaurus version snapshot, so check-version-consistency (via
scripts/check-docs-version.sh) went red on main: versions.json and
docusaurus.config.ts lastVersion were still 1.0.4 and
website/versioned_docs/version-1.0.5 was missing.

Create the 1.0.5 docs snapshot to restore consistency:
- docusaurus docs:version 1.0.5 (versions.json + versioned_docs + sidebar)
- set docusaurus.config.ts lastVersion to 1.0.5
- regenerate versioned CLI reference (stamps "Reference for bd v1.0.5")
- regenerate website/static/llms-full.txt

Verified: scripts/check-versions.sh and scripts/check-doc-flags.sh pass.

Refs: mybd-4qku

Agent-Signature: claude-opus-4-8-medium on behalf of matt wilkie
2026-05-28 21:51:26 -07:00