auth-yes/tasks/new/2026-0825.01.jul.story.arch.monolith-decomposition-roadmap-1845.ph4.md

1.7 KiB

TASK METADATA

  • Target Files: infra/setup.ts, infra/setup/cli.ts, infra/setup/compose.ts, infra/setup/env.ts
  • Core Objective: Phase 4 (Infrastructure Scripts Refactoring): Decompose the monolithic 1,021-line infra/setup.ts installer into modular sub-modules under infra/setup/ separating CLI interactive prompts, Docker compose generation, and environment file management.
  • Dependencies: tasks/new/2026-0825.01.jul.story.arch.monolith-decomposition-roadmap-1845.md
  • Additional Important Notes: Must verify with deno check infra/setup.ts and ensure dry-run generation produces identical compose and env files.

2. Architectural Considerations & Risks

  • Risks:
    • Generating corrupted docker-compose.yml or .env files if template strings or formatting helpers are incorrectly moved.
  • Alternatives:
    • Keeping setup.ts as a single monolithic script; rejected due to maintenance difficulty and cognitive overload.

3. Proposed Implementation

  1. Extract Modular Setup Sub-modules (infra/setup/):
    • infra/setup/cli.ts: Extract interactive command-line prompts, flags parsing, and user confirmation dialogs.
    • infra/setup/compose.ts: Extract Docker compose YAML string generation and network/volume configuration.
    • infra/setup/env.ts: Extract .env file generation, cryptographic secret generation (keys, salts, PRF secrets), and domain configuration.
  2. Refactor infra/setup.ts:
    • Keep infra/setup.ts as the clean CLI runner that orchestrates the extracted modules.
  3. Quality Gates & Validation:
    • Run deno check infra/setup.ts.
    • Run deno fmt infra/ and verify generated configs against dummy test parameters.