2.1 KiB
2.1 KiB
TASK METADATA
- Target Files:
infra/setup/cli.ts,infra/setup/prompts/*.ts,infra/setup/commands/*.ts - Core Objective: Phase 4.1 (CLI Setup Modularization): Decompose the
772-line
infra/setup/cli.tsmonolith into isolated prompt flows and Cliffy command modules underinfra/setup/prompts/andinfra/setup/commands/. - Dependencies:
tasks/complete/2026-0825.01.jul.story.arch.monolith-decomposition-roadmap-1845.ph4.md - Additional Important Notes: Must reduce
infra/setup/cli.tsto a clean ~60-line router, passdeno check infra/setup.ts, and preserve all CLI subcommands (auth,test,build,compile_proto,dump_compose,spire,secrets,wizard).
2. Architectural Considerations & Risks
- Risks:
- Breaking CLI argument parsing or flag inheritance in Cliffy commands if command action handlers are miswired.
- Alternatives:
- Leaving 772 lines in
cli.ts; rejected because it violates the Single Responsibility Principle and combines UI prompts, network testers, and command routing into one file.
- Leaving 772 lines in
3. Proposed Implementation
-
Extract Interactive Prompts (
infra/setup/prompts/):infra/setup/prompts/auth.ts:promptAuthConfig,promptSpireConfig,promptConfirmation.infra/setup/prompts/wizard.ts:runSetupWizard,handleReviewConfigs.
-
Extract CLI Subcommands (
infra/setup/commands/):infra/setup/commands/auth.ts:authcommand action & setup file generator.infra/setup/commands/test.ts:testconnection action (handleTestConnection).infra/setup/commands/build.ts:buildandcompile_protocommand actions.infra/setup/commands/compose.ts:dump_composeandspirecommand actions.infra/setup/commands/secrets.ts:secretscommand action.
-
Refactor
infra/setup/cli.ts:- Keep
cli.tspurely as the lightweight Cliffy Command router (~60-80 lines) registering the command modules and executingrunCli(args).
- Keep
-
Quality Gates & Validation:
- Run
deno check infra/setup.ts. - Run
deno fmt infra/anddeno test --allow-all.
- Run