Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.

refactor(setup): CLI wizard becomes a thin /api/setup/bootstrap client - #909

Merged
shiba4life merged 3 commits into
mainfrom
kanban/a57cd-cli-rest-bootstrap
May 6, 2026
Merged

refactor(setup): CLI wizard becomes a thin /api/setup/bootstrap client#909
shiba4life merged 3 commits into
mainfrom
kanban/a57cd-cli-rest-bootstrap

Conversation

@shiba4life

Copy link
Copy Markdown
Collaborator

Summary

  • Rewrites run_setup_wizard as a thin REST client: ensure daemon, collect prompts, POST /api/setup/bootstrap, display recovery phrase, reload config. The server owns identity minting, Sled writes, Exemem registration, and the .onboarding_complete marker — closing out the master-key-never-minted bug from before feat(setup): canonical bootstrap endpoint + legacy migration #903 and unifying the brew-CLI and Tauri paths.
  • Adds folddb setup --non-interactive --name X [--email Y --birthday MM-DD --invite-code Z --no-cloud --ai-provider {anthropic|ollama|skip} ...] for CI / scripting.
  • Drops the in-process save_identity_card_via_local_node, the local Sled / node_config.json / marker writes, and the persist_ai_config helper they used.

Re-exports register_with_exemem, register_with_exemem_and_invite, and derive_recovery_phrase as CliError-friendly wrappers around fold_db_node::handlers::setup::* so cloud enable and restore keep their import paths.

Test plan

  • cargo test --bin folddb (clap + non-interactive arg builders, 5 new unit tests)
  • cargo test --test cli_integration_test setup_non_interactive — fresh daemon, non-interactive REST bootstrap, second invocation hits the 410 self-disable
  • Manual smoke (no os-keychain): FOLDDB_HOME=/tmp/test FOLDDB_PORT=19101 ./target/debug/folddb setup --non-interactive --name "Smoke" --no-cloud → daemon starts, recovery phrase prints, marker + node_config.json written, no plaintext keys in config
  • Manual smoke (--features os-keychain + FOLDDB_MASTER_KEY=<64-hex>) → identity in Sled is ENC:-prefixed
  • cargo clippy --bin folddb --bin folddb_server --tests -- -D warnings -A dead-code clean (the -A dead-code suppresses the pre-existing macOS-only build_attendee_ingestion_records warning that doesn't fire in Linux CI)

🤖 Generated with Claude Code

… POST

The legacy `run_setup_wizard` minted identity, wrote Sled trees, registered
with Exemem, and dropped the `.onboarding_complete` marker entirely
in-process — duplicating logic the canonical bootstrap endpoint already
owns and harboring the master-key-never-minted bug from before #903.

The CLI wizard is now a thin REST client around `POST /api/setup/bootstrap`:
ensure the daemon is running, collect prompts (interactive or via
`--non-interactive` flags), POST once, surface the recovery phrase, and
reload `node_config.json` from disk. Brew users and Tauri users now share
the same bootstrap path.

`folddb setup --non-interactive --name X [--email Y --invite-code Z
--no-cloud ...]` is the new headless mode for CI / scripting.

Verified end-to-end on macOS with `os-keychain`: identity stored in Sled is
ENC:-prefixed, marker present, no plaintext keys leak into
`node_config.json`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shiba4life
shiba4life enabled auto-merge May 6, 2026 04:36
shiba4life and others added 2 commits May 5, 2026 21:39
The egress classifier lint requires a `// trace-egress: <kind>` comment
within 3 lines preceding each reqwest::Client construction. The
post_bootstrap site had a free-form `// loopback:` comment that the lint
didn't recognize.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pure rustfmt — no behavior changes. (My local fmt run was missed; CI
caught the diffs.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shiba4life
shiba4life added this pull request to the merge queue May 6, 2026
Merged via the queue into main with commit a7915da May 6, 2026
11 checks passed
@shiba4life
shiba4life deleted the kanban/a57cd-cli-rest-bootstrap branch May 6, 2026 04:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant