You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add setup wizard domain model and idempotent stack state helpers #1599
The new propr setup command needs to coordinate existing environment checks, stack initialization, image pulling, agent configuration, GitHub authentication, stack startup, whitelist setup, optional repo setup, and UI launch. Before adding UI, create a small setup-specific domain layer so the flow is testable without Ink or readline.
Requirements
Add setup step/status types that can be shared by Ink and fallback renderers.
Add helpers for resolving the stack root, checking whether the stack is already initialized, and safely editing .env.
Keep the command re-runnable and non-destructive by default.
Reuse existing runChecks, scaffoldStack, upsertEnvVars, and orchestrator APIs where possible.
Implementation Specification
Create packages/cli/src/commands/setup/types.ts and packages/cli/src/commands/setup/state.ts. If scaffoldStack is not exported from initStack.ts, export it in a separate issue before this helper calls it.
Acceptance Criteria
Setup state helpers can be imported without starting Docker or rendering UI.
Existing .env values are preserved unless a step explicitly writes a selected value.
The helper returns enough information for both TUI and sequential wizard renderers to show progress and next actions.
This implementation starts with a narrow domain layer instead of putting setup logic directly inside the Commander action or Ink component. That keeps setup re-runnable and testable: the UI becomes a renderer over explicit setup state, while file and Docker mutations stay in small functions. A single monolithic command implementation was considered, but rejected because it would make the fallback wizard duplicate logic and would be hard to unit test. The trade-off is a few extra setup files, but those files establish clear ownership for a feature that will grow.
File: packages/cli/src/commands/setup/types.ts (new file)
Why this file: This file defines the setup wizard contract shared by the command, Ink TUI, fallback wizard, and tests. Keeping it separate prevents UI-specific concerns from leaking into the setup engine.
File: packages/cli/src/commands/setup/state.ts (new file)
Why this file: This file centralizes setup state creation and .env mutation helpers. It connects the wizard to existing config and env-file utilities while keeping mutations explicit and idempotent.
import{existsSync}from'node:fs';import{resolve}from'node:path';import{createConfigManager}from'../../config/index.js';import{upsertEnvVars}from'../../utils/envFile.js';importtype{SetupStepId,SetupStepState,SetupWizardState}from'./types.js';constSTEP_TITLES: Record<SetupStepId,string>={environment: 'Check environment',docker: 'Docker runtime',images: 'Container images',agents: 'Coding agents','github-cli': 'GitHub CLI session','github-intake': 'GitHub event intake','stack-init': 'Initialize stack','stack-start': 'Start and validate stack',whitelist: 'GitHub user whitelist',repository: 'Add repository','web-ui': 'Open Web UI',};exportconstSETUP_STEP_ORDER=Object.keys(STEP_TITLES)asSetupStepId[];exportfunctioncreateInitialSetupState(rootDir: string,isInteractive: boolean): SetupWizardState{return{
rootDir,
isInteractive,currentStep: 'environment',// Keep the full step list stable so both Ink and sequential renderers can// display the same progress model even when individual steps are skipped.steps: SETUP_STEP_ORDER.map((id): SetupStepState=>({
id,title: STEP_TITLES[id],status: 'pending',})),};}exportfunctionupdateStep(state: SetupWizardState,id: SetupStepId,patch: Partial<SetupStepState>): SetupWizardState{return{
...state,currentStep: id,steps: state.steps.map((step)=>(step.id===id ? { ...step, ...patch} : step)),};}exportasyncfunctionresolveSetupRoot(root?: string): Promise<string>{constconfigManager=awaitcreateConfigManager();constconfiguredRoot=configManager.getStackRoot();// Prefer an explicit root because setup may be used to adjust a non-default// stack. Fall back to saved stackRoot, then cwd to match existing control-plane commands.returnresolve(root??configuredRoot??process.cwd());}exportfunctionstackEnvExists(rootDir: string): boolean{returnexistsSync(`${rootDir}/.env`);}exportfunctionwriteSetupEnv(rootDir: string,values: Record<string,string>): void{// Use the shared upsert helper so setup preserves comments and unrelated// operator edits instead of rewriting the whole .env file.upsertEnvVars(`${rootDir}/.env`,values);}
Activity
propr-dev commentedon Jun 22, 2026
Suggested Implementation:
Implementation Approach
This implementation starts with a narrow domain layer instead of putting setup logic directly inside the Commander action or Ink component. That keeps setup re-runnable and testable: the UI becomes a renderer over explicit setup state, while file and Docker mutations stay in small functions. A single monolithic command implementation was considered, but rejected because it would make the fallback wizard duplicate logic and would be hard to unit test. The trade-off is a few extra setup files, but those files establish clear ownership for a feature that will grow.
File:
packages/cli/src/commands/setup/types.ts(new file)Why this file: This file defines the setup wizard contract shared by the command, Ink TUI, fallback wizard, and tests. Keeping it separate prevents UI-specific concerns from leaking into the setup engine.
File:
packages/cli/src/commands/setup/state.ts(new file)Why this file: This file centralizes setup state creation and
.envmutation helpers. It connects the wizard to existing config and env-file utilities while keeping mutations explicit and idempotent.propr-dev commentedon Jun 22, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-4-8 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-4-81599/claude-opus-4-8-add-setup-wizard-domain-m-20260622-0930-ge5mainissue-1599-20260622-0930-claude-opus-4-8-ge5🔍 Track Task Execution
propr-dev commentedon Jun 22, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-4-8 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-4-81599/claude-opus-4-8-add-setup-wizard-domain-m-20260622-0930-elf1599-epic-build-comprehensive-b5cissue-1599-20260622-0930-claude-opus-4-8-elf🔍 Track Task Execution
Implementation complete. Both files are created and clean (only the n…
Everything passes. Here's a summary of what I implemented for issue #…
[1599 by Claude Opus 4.8] Add setup wizard domain model and idempoten…
Implementation complete. Both files are created and clean (only the n…