Files
Codewalkers/.planning/phases/12-phase-task-decomposition/12-02-PLAN.md
Lukas May 41f868294b docs(12): create phase plan
Phase 12: Phase-Task Decomposition
- 8 plans in 4 waves
- 4 parallel, 4 sequential
- Ready for execution
2026-01-31 21:03:07 +01:00

3.4 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous
phase plan type wave depends_on files_modified autonomous
12-phase-task-decomposition 02 execute 1
src/db/repositories/plan-repository.ts
src/db/repositories/drizzle/drizzle-plan-repository.ts
src/db/repositories/index.ts
true
Extend PlanRepository with methods needed for task decomposition workflow.

Purpose: Enable creating plans from architect output and querying plans by phase. The decompose agent needs to know what plans exist in a phase to break them into tasks.

Output: PlanRepository with findByPhaseId, getNextNumber, bulk creation methods.

<execution_context> @/.claude/get-shit-done/workflows/execute-plan.md @/.claude/get-shit-done/templates/summary.md </execution_context>

@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md

Pattern reference from Phase 11 (repository extensions)

@.planning/phases/11-architect-agent/11-02-SUMMARY.md

Source files to modify

@src/db/repositories/plan-repository.ts @src/db/repositories/drizzle/drizzle-plan-repository.ts @src/db/repositories/phase-repository.ts

Task 1: Extend PlanRepository port interface src/db/repositories/plan-repository.ts Add the following methods to PlanRepository interface (following pattern from PhaseRepository):
  1. findByPhaseId(phaseId: string): Promise<Plan[]> - Get all plans for a phase, ordered by number
  2. getNextNumber(phaseId: string): Promise<number> - Get next available plan number (MAX+1 or 1 if none) npm run build passes (no implementation yet) PlanRepository interface extended with new methods
Task 2: Implement methods in DrizzlePlanRepository src/db/repositories/drizzle/drizzle-plan-repository.ts Implement the new methods in DrizzlePlanRepository adapter:
  1. findByPhaseId(phaseId):

    • Query plans table where phase_id = phaseId
    • Order by number ascending
    • Return array (empty if none)
  2. getNextNumber(phaseId):

    • Query MAX(number) where phase_id = phaseId
    • Return max + 1, or 1 if no plans exist

Follow the pattern from DrizzlePhaseRepository.getNextNumber. npm run build passes, npm test passes DrizzlePlanRepository implements findByPhaseId and getNextNumber

Task 3: Export types from repositories index src/db/repositories/index.ts Verify PlanRepository and its types are properly exported. If not already exported: - Export PlanRepository interface - Export CreatePlanData type - Export UpdatePlanData type

Check existing exports and add if missing. npm run build passes, types importable from src/db/repositories All PlanRepository types properly exported

Before declaring plan complete: - [ ] npm run build succeeds - [ ] npm test passes all tests - [ ] PlanRepository.findByPhaseId exists and works - [ ] PlanRepository.getNextNumber exists and works - [ ] Types exported from index

<success_criteria>

  • All tasks completed
  • All verification checks pass
  • No errors or warnings introduced
  • PlanRepository ready for tRPC procedures </success_criteria>
After completion, create `.planning/phases/12-phase-task-decomposition/12-02-SUMMARY.md`