# @dpf/bootstrap

Pure planning library for the DPF agent toolchain bootstrap. Decides every TOML / JSON / memory delta needed to converge a contributor's Claude Code + Codex CLI session to a known kernel-aware state. The shell adapters (`scripts/dpf-bootstrap-agent-toolchain.{ps1,sh}`) apply the writes; this package owns the contract.

See:
- Spec: [docs/superpowers/specs/2026-05-26-agent-toolchain-bootstrap-design.md](../../docs/superpowers/specs/2026-05-26-agent-toolchain-bootstrap-design.md)
- Plan: [docs/superpowers/plans/2026-05-26-agent-toolchain-bootstrap.md](../../docs/superpowers/plans/2026-05-26-agent-toolchain-bootstrap.md)
- BI: BI-4B17051B under EP-INSTALL-HARDENING-2026-05-23

## Architectural rule

Installer scripts are orchestration adapters, not config parsers. If a script needs to decide whether a TOML / JSON / memory file changes, that decision belongs in this package and its tests. No regex edits of structured config in shell.

## Public surface

```ts
import {
  planClaudeCodePluginConfig,
  planCodexConfig,
  planKernelMemorySeed,
  planMcpReadinessProbe,
  interpretMcpReadinessResponse,
  renderSmokeTestScenario,
  interpretSmokeResponse,
  redactTranscriptForPersistence,
  materializeAgentToolchainState,
  computeReadinessState,
  readinessCopy,
} from "@dpf/bootstrap/agent-toolchain";
```

Every planning function is data-in / data-out — no filesystem writes, no network, no spawn. Tests cover idempotence, byte preservation, user-intent preservation, bearer redaction, and stale-entry plans against fixtures captured from the operator's real configs.

## Bearer-token discipline

Every fixture, every test, every persisted state-file shape is bearer-redacted. `redactTranscriptForPersistence` is the runtime gate; `fixtures-redaction.test.ts` is the structural gate. A bearer leak in a PR is a security regression.
