auth-yes/tasks/complete/2026-0825.01.jul.story.arch.monolith-decomposition-roadmap-1845.ph4.md
google-labs-jules[bot] 779f890b2f Refactored the 1,000+ line setup.ts into sub-modules
- Extracted CLI commands into infra/setup/cli.ts
- Extracted docker compose configuration to infra/setup/compose.ts
- Extracted env variable generation to infra/setup/env.ts
- Extracted build commands to infra/setup/build.ts
- Retained infra/setup.ts as a simple entrypoint orchestrator

Co-authored-by: mrteye <1945243+mrteye@users.noreply.github.com>
2026-08-26 00:34:24 +00:00

41 lines
1.7 KiB
Markdown

# 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.