beads/docs/cli-reference/init-safety.md
Chris Sells cc9601f85c fix(cli): printed doc paths point at the new docs locations
Per decision 7, bd's user-facing strings now reference the Mintlify-era
paths: prime policy-profiles help, storage-backend comparison help
(store_factory_nocgo, init --backend), init-safety help (recovery
playbooks now docs/recovery/init-safety.md; the ADR reference now
engdocs/adr/), the pk-fork-refused recovery URL (dolt.go), doctor's plugin
suggestions (claude.go) and managed-handoff pointer, aider setup guidance
and the shared recipe template (quickstart URL), and the agent instruction
templates (sync-concepts URL, quickstart URL). bd mol pour's help no
longer claims molecules are 'synced with git' — they sync via Dolt like
any other bead.

Also corrects the stale claude recipe ProjectPath metadata
(.claude/settings.local.json -> .claude/settings.json; the dedicated
installer has written settings.json since the migration sweep).

This repo's AGENTS.md managed section is refreshed to the new template
body (hash bacef91e, has-remote variant preserved), and agents.md.tmpl's
embedded marker matches. Template tests updated to pin the new fragment;
CLI docs regenerated.

Recorded, not fixed (behavior-level, see the decision record):
routing.mode's maintainer/contributor no-op values and the
sync.require_confirmation_on_mass_delete key with no consumer.

Note: TestCheckBeadsRole_NotConfigured/_NotGitRepo in cmd/bd/doctor fail
on any machine with beads.role in the global git config (no HOME
isolation) — pre-existing, unrelated to this change.
2026-07-12 10:37:17 -07:00

80 lines
2.7 KiB
Markdown

---
title: "bd init-safety"
description: "Explain bd init flag semantics and the destroy-token format"
---
{/* AUTO-GENERATED: do not edit manually */}
Generated from `bd help --doc init-safety`.
bd init flag safety contract.
Every bd init invocation resolves project_id from exactly one explicitly
named source (local reinit, remote adoption, or a fresh mint). When the
source is ambiguous, bd init refuses.
FLAG SURFACE
bd init Mint a new identity. Bootstraps from
origin if it has refs/dolt/data.
bd init --reinit-local Re-initialize local .beads/ over existing
local data. Does NOT authorize discarding
remote history. If origin has Dolt data
this will refuse — pair with
--discard-remote to override.
bd init --reinit-local \ Discard the remote's Dolt history and
--discard-remote replace it with the local reinit. First
bd dolt push after this will be a
history-replacing force-push.
bd init --force Deprecated alias for --reinit-local.
Kept working for ≥2 releases.
bd init --from-jsonl Import from configured import.path. If
origin has Dolt data, this refuses unless
--discard-remote authorizes replacing that
remote history.
ADOPTING A REMOTE
If you want to use the remote's existing history, use:
bd bootstrap
bd init will automatically suggest this when a remote is detected.
DESTROY-TOKEN (non-interactive only)
When running with no TTY (CI, agents, piped input), --discard-remote
requires an explicit --destroy-token value. The token format is:
DESTROY-<issue-prefix>
For example, if your issue prefix is "bd", the token is "DESTROY-bd":
bd init --reinit-local --discard-remote --destroy-token=DESTROY-bd
In interactive (TTY) mode you confirm via a typed prompt instead. The
token is not echoed by bd's runtime error messages — this is a
deliberate guard against pattern-matched one-liners (see
engdocs/adr/0002-init-safety-invariants.md).
EXIT CODES
10 refused: remote has Dolt history and you selected local history
without --discard-remote
11 refused: existing local data and you declined the destroy confirm
12 refused: --discard-remote passed without a valid --destroy-token
(non-interactive mode)
RECOVERY
If you hit a refusal, see docs/recovery/init-safety.md for step-by-step recovery
playbooks for each exit code.
```
bd init-safety [flags]
```