---
phase: 14-parallel-phase-execution
plan: 03
type: execute
wave: 2
depends_on: ["14-01", "14-02"]
files_modified:
  - src/dispatch/phase-dispatch.ts
  - src/dispatch/types.ts
  - src/dispatch/index.ts
autonomous: true
---

<objective>
Create PhaseDispatchManager port interface for dependency-ordered phase execution.

Purpose: Enable queuing and dispatching phases based on their dependencies.
Output: PhaseDispatchManager interface with queue/dispatch operations.
</objective>

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

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/14-parallel-phase-execution/14-01-SUMMARY.md
@.planning/phases/14-parallel-phase-execution/14-02-SUMMARY.md

# Reference implementations:
@src/dispatch/types.ts
@src/dispatch/manager.ts
</context>

<tasks>

<task type="auto">
  <name>Task 1: Define PhaseDispatchManager port interface</name>
  <files>src/dispatch/types.ts</files>
  <action>
Add types for phase dispatch:

QueuedPhase interface:
- phaseId: string
- initiativeId: string
- queuedAt: Date
- dependsOn: string[] (phase IDs)

PhaseDispatchResult interface:
- success: boolean
- phaseId: string
- reason?: string (failure reason)

PhaseDispatchManager port interface:
- queuePhase(phaseId: string): Promise<void>
- getNextDispatchablePhase(): Promise<QueuedPhase | null>
- dispatchNextPhase(): Promise<PhaseDispatchResult>
- completePhase(phaseId: string): Promise<void>
- blockPhase(phaseId: string, reason: string): Promise<void>
- getPhaseQueueState(): Promise<{ queued: QueuedPhase[], ready: QueuedPhase[], blocked: Array<{phaseId: string, reason: string}> }>

Follow exact patterns from DispatchManager for tasks.
  </action>
  <verify>npx tsc --noEmit passes</verify>
  <done>PhaseDispatchManager interface defined with all methods</done>
</task>

<task type="auto">
  <name>Task 2: Export phase dispatch types</name>
  <files>src/dispatch/index.ts</files>
  <action>
Export new types from dispatch module:
- QueuedPhase
- PhaseDispatchResult
- PhaseDispatchManager
  </action>
  <verify>npx tsc --noEmit passes</verify>
  <done>Phase dispatch types exported from dispatch module</done>
</task>

</tasks>

<verification>
Before declaring plan complete:
- [ ] `npm run build` succeeds without errors
- [ ] `npm test` passes all tests
- [ ] PhaseDispatchManager importable from src/dispatch
</verification>

<success_criteria>

- All tasks completed
- All verification checks pass
- Interface follows hexagonal architecture (port pattern)
- Methods mirror DispatchManager for consistency
</success_criteria>

<output>
After completion, create `.planning/phases/14-parallel-phase-execution/14-03-SUMMARY.md`
</output>
