- Replace placeholder agent command with proper subcommands
- Add agent spawn command with --name, --task, --cwd options
- Add agent stop command to stop running agents
- Add agent list command to show all agents
- Add agent get command for detailed agent info
- Add agent resume command for waiting agents
- Add agent result command to get execution results
- All commands use tRPC client for type-safe communication
- Import AgentManager type into context.ts
- Add optional agentManager field to TRPCContext interface
- Add optional agentManager to CreateContextOptions
- Update TrpcAdapterOptions with optional agentManager
- Pass agentManager through to createContext in adapter
- Test spawn with worktree and agent record creation
- Test duplicate name rejection
- Test AgentSpawned event emission
- Test stop with subprocess kill and status update
- Test list, get, getByName operations
- Test resume with session_id and --resume flag
- Test AgentResumed event emission
- Fix: use agent.id from repository for activeAgents tracking
- Use Claude CLI with --output-format json for agent spawning
- Extract session_id from JSON result for resume capability
- Emit lifecycle events: spawned, stopped, crashed, resumed, waiting
- Handle waiting_for_input status for AskUserQuestion pauses
- Uses WorktreeManager for isolated agent workspaces
- Implement DrizzleAgentRepository with all AgentRepository methods
- Add findByName, findByTaskId, findBySessionId lookups
- Add findByStatus for filtering including waiting_for_input
- Add updateStatus and updateSessionId for state changes
- Add agents table to test-helpers.ts SQL
- Export DrizzleAgentRepository from drizzle/index.ts
- 22 tests covering all operations and edge cases
- AgentSpawnedEvent for new agent creation
- AgentStoppedEvent with reason (user_requested, task_complete, error, waiting_for_input)
- AgentCrashedEvent for unexpected failures
- AgentResumedEvent for session resumption
- AgentWaitingEvent when agent pauses on AskUserQuestion
- Updated DomainEventMap union with all agent events
- Define AgentRepository interface with CRUD operations
- Add findByName, findByTaskId, findBySessionId for lookups
- Add findByStatus for filtering by agent state
- Add updateStatus and updateSessionId for state changes
- Export AgentStatus type
- Export from repositories barrel file
- AgentStatus type for agent lifecycle states
- SpawnAgentOptions for spawn configuration
- AgentInfo for agent state representation
- AgentResult for execution results
- AgentManager interface with spawn, stop, list, get, getByName, resume, getResult
- Define agents table with id, name (unique), taskId, sessionId, worktreeId, status
- Status enum: idle, running, waiting_for_input, stopped, crashed
- Foreign key to tasks with onDelete: 'set null' (agent may outlive task)
- Add agentsRelations linking to tasks
- Export Agent and NewAgent types
Key changes:
- Add agent names (human-readable like 'gastown') instead of UUID-only
- Use Claude CLI with --output-format json instead of SDK streaming
- Session ID extracted from CLI JSON output, not SDK init message
- Add waiting_for_input status for AskUserQuestion scenarios
- Resume flow is for answering agent questions, not general resumption
- CLI commands use names as primary identifier
- Worktree type for representing git worktrees
- WorktreeDiff type for change preview
- MergeResult type for merge operation results
- WorktreeManager interface (PORT) with CRUD, diff, and merge methods
- Full JSDoc documentation explaining port-adapter relationship
Covers requirements: GIT-01, GIT-02, GIT-03, GIT-04
- WorktreeCreatedEvent for worktree creation tracking
- WorktreeRemovedEvent for worktree cleanup tracking
- WorktreeMergedEvent for successful merge tracking
- WorktreeConflictEvent for merge conflict notification
- All events added to DomainEventMap union type
- src/db/index.ts exports repository interfaces and adapters
- cascade.test.ts tests full hierarchy cascade behavior:
- Delete initiative removes all phases, plans, tasks
- Delete phase removes only its plans and tasks
- Delete plan removes only its tasks
- All 45 repository tests passing
- DrizzleInitiativeRepository: CRUD with nanoid ID generation
- DrizzlePhaseRepository: findByInitiativeId ordered by number
- DrizzlePlanRepository: findByPhaseId ordered by number
- DrizzleTaskRepository: findByPlanId ordered by order field
- All adapters use DI for DrizzleDatabase instance
- Timestamps set automatically on create/update
- Throws on update/delete of non-existent entities
- InitiativeRepository: CRUD for initiative aggregate
- PhaseRepository: CRUD with findByInitiativeId ordered by number
- PlanRepository: CRUD with findByPhaseId ordered by number
- TaskRepository: CRUD with findByPlanId ordered by order field
- Re-export all interfaces from repositories/index.ts
Schema defines 5 tables with proper foreign key relationships:
- initiatives: Top-level projects (active/completed/archived)
- phases: Major milestones within initiatives
- plans: Groups of related tasks within phases
- tasks: Individual work items with type, priority, status, order
- task_dependencies: Dependency relationships between tasks
All tables have cascade deletes and Unix timestamp fields.
Types exported: Initiative, Phase, Plan, Task, TaskDependency + New* variants.
Relations exported for Drizzle relational queries.
- Update status command to use tRPC client for server communication
- Display health status, uptime, and process count
- Handle connection errors gracefully with helpful message
- Add 7 integration tests proving full CLI-server tRPC flow
- Tests cover health procedure, status procedure, and error handling
- Create src/server/trpc-adapter.ts with fetch adapter for node:http
- Create src/cli/trpc-client.ts with typed client factory functions
- Update CoordinationServer to route /trpc/* to tRPC handler
- Move @trpc/client from devDeps to regular deps
- Keep /health and /status HTTP endpoints for backwards compatibility
Tasks completed: 2/2
- Write unit tests for ProcessRegistry and ProcessManager
- Refactor ProcessManager to emit events via event bus
SUMMARY: .planning/phases/01.1-hexagonal-architecture/01.1-03-SUMMARY.md
Tasks completed: 2/2
- Write unit tests for LogManager and ProcessLogWriter
- Add event emission to ProcessLogWriter
SUMMARY: .planning/phases/01.1-hexagonal-architecture/01.1-04-SUMMARY.md
Tasks completed: 2/2
- Write unit tests for CoordinationServer
- Add event emission to server and shutdown handler
SUMMARY: .planning/phases/01.1-hexagonal-architecture/01.1-05-SUMMARY.md
- Test server lifecycle (start, stop, isRunning)
- Test HTTP endpoints (GET /health, GET /status, 404, 405)
- Test PID file management (create, remove, stale cleanup)
- Verify server throws on double-start or existing PID file
Tasks completed: 3/3
- Install and configure Vitest test framework
- Create EventBus port interface and EventEmitter adapter
- Define domain events with typed payloads and tests
SUMMARY: .planning/phases/01.1-hexagonal-architecture/01.1-01-SUMMARY.md