[EPIC] archied setup: interactive first-run configuration #880

Closed
opened 2026-10-27 13:38:07 +00:00 by sam · 0 comments
Owner

Move config generation out of install.sh and into the daemon as 'archied setup', so the thing that writes config.toml is the same code that reads it. install.sh currently hand-rolls TOML and has already drifted from the schema once: it hardcoded the GitHub token key and the Gitea host, so a Gitea install produced a config naming a token the installer never wrote. Modelled on tau's 'tau setup' (internal/cli/setup.go, internal/app/setup.go), adapted for archie's TOML config and existing secret-reference indirection.

Design

Port from tau: the CLI/app split behind a SetupPrompter interface so business logic is UI-agnostic and testable without a terminal; plain-stdio Select and hidden ReadSecret (golang.org/x/term) racing ctx.Done for Ctrl+C -- no TUI dependency; atomic temp+rename writes. DIVERGENCE FROM TAU: tau surgically patches YAML nodes to preserve comments. archie uses BurntSushi/toml, which does not preserve comments across a decode/encode round trip, so a full re-marshal would destroy config.example.toml's documentation. Decide this explicitly -- see the child issue. Secrets differ too: archie already has secret.SecretRef{engine,key} indirection, so setup writes the reference into TOML and the value into the env engine's store; that is archie's equivalent of tau's config.yaml/auth.yaml split and should be used rather than reinvented.

Acceptance Criteria

install.sh no longer generates config.toml; it invokes archied setup. Setup is idempotent and re-runnable against an existing config without clobbering unrelated settings. Every config it writes passes configuration.Validate, verified by a test that runs setup non-interactively and validates the output. Secrets never reach config.toml or argv: config holds a secret reference, the value goes to the env file at 0600 via atomic write. Prompts for secrets do not echo. A non-TTY invocation without sufficient input fails with a clear message rather than writing a partial config.

Close reason

Closed on GitHub; syncing bead state


Imported from beads archie-core-1786637498957-347-60ea9b86 · GitHub #368 · type epic · priority P2 · created 2026-08-08 · closed 2026-09-26

Move config generation out of install.sh and into the daemon as 'archied setup', so the thing that writes config.toml is the same code that reads it. install.sh currently hand-rolls TOML and has already drifted from the schema once: it hardcoded the GitHub token key and the Gitea host, so a Gitea install produced a config naming a token the installer never wrote. Modelled on tau's 'tau setup' (internal/cli/setup.go, internal/app/setup.go), adapted for archie's TOML config and existing secret-reference indirection. ### Design Port from tau: the CLI/app split behind a SetupPrompter interface so business logic is UI-agnostic and testable without a terminal; plain-stdio Select and hidden ReadSecret (golang.org/x/term) racing ctx.Done for Ctrl+C -- no TUI dependency; atomic temp+rename writes. DIVERGENCE FROM TAU: tau surgically patches YAML nodes to preserve comments. archie uses BurntSushi/toml, which does not preserve comments across a decode/encode round trip, so a full re-marshal would destroy config.example.toml's documentation. Decide this explicitly -- see the child issue. Secrets differ too: archie already has secret.SecretRef{engine,key} indirection, so setup writes the reference into TOML and the value into the env engine's store; that is archie's equivalent of tau's config.yaml/auth.yaml split and should be used rather than reinvented. ### Acceptance Criteria install.sh no longer generates config.toml; it invokes archied setup. Setup is idempotent and re-runnable against an existing config without clobbering unrelated settings. Every config it writes passes configuration.Validate, verified by a test that runs setup non-interactively and validates the output. Secrets never reach config.toml or argv: config holds a secret reference, the value goes to the env file at 0600 via atomic write. Prompts for secrets do not echo. A non-TTY invocation without sufficient input fails with a clear message rather than writing a partial config. ### Close reason Closed on GitHub; syncing bead state --- _Imported from beads `archie-core-1786637498957-347-60ea9b86` · GitHub #368 · type epic · priority P2 · created 2026-08-08 · closed 2026-09-26_
sam added the mediumepic labels 2026-10-27 13:38:07 +00:00
sam self-assigned this 2026-10-27 13:38:07 +00:00
sam closed this issue 2026-10-27 13:38:08 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#880