Add phase command group with dependency management and dispatch operations:
- cw phase add-dependency: Create dependency between phases
- cw phase dependencies: List dependencies for a phase
- cw phase queue: Queue phase for execution
- cw phase dispatch: Dispatch next available phase
- cw phase queue-status: Show queued, ready, and blocked phases
- Import PhaseDispatchManager type from dispatch module
- Add requirePhaseDispatchManager helper function
- Add createPhaseDependency: creates dependency between two phases
- Add getPhaseDependencies: returns phase IDs that a phase depends on
- Add queuePhase: queues phase for dispatch
- Add dispatchNextPhase: dispatches next available phase
- Add getPhaseQueueState: returns phase queue state
All procedures follow existing naming conventions and error handling patterns.
- Import PhaseDispatchManager type from dispatch module
- Add optional phaseDispatchManager to TRPCContext interface
- Add phaseDispatchManager to CreateContextOptions
- Wire phaseDispatchManager through createContext function
Includes blocking fix: added 'blocked' status to phases schema enum
- Add createDependency(phaseId, dependsOnPhaseId) to interface and adapter
- Add getDependencies(phaseId) returning IDs of phases this phase depends on
- Add getDependents(phaseId) returning IDs of phases that depend on this phase
- Import phaseDependencies table in DrizzlePhaseRepository
- Follow exact pattern from DrizzleTaskRepository.createDependency
- PhaseQueuedEvent for tracking phases awaiting execution
- PhaseStartedEvent for phase execution start
- PhaseCompletedEvent for phase completion with success flag
- PhaseBlockedEvent for blocked phases with reason
- Add phase_dependencies table mirroring task_dependencies pattern
- Add phaseId and dependsOnPhaseId FK columns with cascade delete
- Add phasesRelations with dependsOn and dependents many relations
- Add phaseDependenciesRelations with phase and dependsOnPhase one relations
- Export PhaseDependency and NewPhaseDependency types
- Added v1.2 entry to MILESTONES.md
- Created milestones/v1.2-ROADMAP.md archive
- Updated ROADMAP.md with archive link
- Evolved PROJECT.md with v1.2 validated requirements
- Updated STATE.md for next milestone planning
Tasks completed: 3/3
- Create real Claude CLI integration test file
- Fix ClaudeAgentManager to parse structured_output
- Run real Claude tests and document findings
SUMMARY: .planning/phases/13-real-claude-e2e-tests/13-01-SUMMARY.md
Milestone v1.2 complete (21 plans, 4 phases)
- Add proper test timeouts (120s for real API calls)
- Document key finding: result field is empty, structured_output has data
- Add validation cost estimates (~$0.025 per simple call)
- Confirm MockAgentManager accurately simulates real CLI behavior
- Add structured_output field to ClaudeCliResult interface
- Read from structured_output when present (--json-schema response)
- Fall back to parsing result for backwards compatibility
- Add test file for validating JSON schemas with real Claude CLI
- Tests are skipped by default (REAL_CLAUDE_TESTS=1 to enable)
- Covers execute, discuss, breakdown, and decompose modes
- Helper function callClaudeCli() handles CLI invocation
Phase 13: Real Claude E2E Tests
- 1 plan in 1 wave
- Validates JSON schemas with actual Claude CLI
- Fixes structured_output parsing in ClaudeAgentManager
- Tests skipped by default (expensive)
- Add tests for spawn decompose agent with completion
- Add tests for Q&A flow with questions and resume
- Add tests for multiple questions handling
- Add tests for task persistence from decomposition
- Add tests for all task types (auto, checkpoint variants)
- Add tests for task dependencies
- Add full workflow test: initiative -> phase -> plan -> decompose -> tasks
- Add setArchitectDecomposeComplete and setArchitectDecomposeQuestions helpers
- Add planRepository to harness for plan operations
- Add createPlan and getTasksForPlan convenience methods
- Import TaskBreakdown and Plan types
Add tests for getNextNumber method:
- Returns 1 for phase with no plans
- Returns max + 1 for phase with existing plans
- Not affected by plans in other phases
Add tests for decompose mode scenarios:
- Spawn agent in decompose mode
- Complete with tasks on decompose_complete
- Pause on questions in decompose mode
- Emit stopped event with decompose_complete reason
- Set result message with task count
Add CLI commands for plan management:
- cw plan list --phase <id>: List plans in a phase
- cw plan create --phase <id> --name <name>: Create a plan
- cw plan get <id>: Get plan details
- cw plan tasks <id>: List tasks in a plan
Add architect decompose command:
- cw architect decompose <planId>: Spawn agent to decompose plan into tasks
- Import buildDecomposePrompt from agent prompts
- Add spawnArchitectDecompose procedure for decompose mode
- Validates plan and phase exist before spawning
- Spawns agent with decompose mode and comprehensive prompt
- Add buildDecomposePrompt for decompose mode agent operations
- Import Phase and Plan types from schema
- Comprehensive prompt explaining task breakdown rules, types, and output format
- Add createDependency method to TaskRepository interface
- Implement createDependency in DrizzleTaskRepository
- Add createTasksFromDecomposition procedure for bulk task creation
- Procedure verifies plan exists before creating tasks
- Creates tasks in order, building number-to-ID map
- Creates task dependencies after all tasks exist
- Dependencies mapped from task numbers to IDs
- Import PlanRepository type from repositories
- Add planRepository?: PlanRepository to TRPCContext type
- Add planRepository to CreateContextOptions
- Update createContext to include planRepository
- Import TaskBreakdown from schema.ts
- Add decompose_complete status to MockAgentScenario type
- Update completeAgent() to handle decompose_complete scenarios
- Emit agent:stopped with reason 'decompose_complete' for E2E testing
- Add TaskBreakdown type with number, name, description, type, dependencies
- Create decomposeOutputSchema discriminated union (questions/decompose_complete/error)
- Create decomposeOutputJsonSchema for Claude CLI --json-schema flag
- Update module docstring to include decompose mode