Phase 01: Core Infrastructure - 5 plans in 3 waves - Wave 1: Project foundation (01-01) - Wave 2: CLI, process mgmt, logging (01-02, 01-03, 01-04) [parallel] - Wave 3: Server mode & shutdown (01-05) - Ready for execution
3.6 KiB
3.6 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous
| phase | plan | type | wave | depends_on | files_modified | autonomous | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| 01-core-infrastructure | 03 | execute | 2 |
|
|
true |
Purpose: Infrastructure for managing agent processes in later phases. Agents are child processes that need lifecycle management. Output: ProcessManager class with spawn, stop, list, and restart operations.
<execution_context>
@/.claude/get-shit-done/workflows/execute-plan.md
@/.claude/get-shit-done/templates/summary.md
</execution_context>
Create src/process/registry.ts:
- ProcessRegistry class with Map<string, ProcessInfo> storage
- register(info: ProcessInfo): void
- unregister(id: string): void
- get(id: string): ProcessInfo | undefined
- getAll(): ProcessInfo[]
- getByPid(pid: number): ProcessInfo | undefined
- clear(): void
Registry is in-memory for now (Phase 2 adds SQLite persistence).
TypeScript compiles, registry can add/remove/list processes
ProcessRegistry class works with full CRUD operations
Task 2: Create process manager with spawn/stop
src/process/manager.ts, src/process/index.ts
Create src/process/manager.ts:
- Import execa for process spawning
- ProcessManager class:
- constructor takes ProcessRegistry instance
- spawn(options: SpawnOptions): Promise - spawns detached child, registers in registry, returns info
- stop(id: string): Promise - sends SIGTERM, waits up to 5s, then SIGKILL if needed
- stopAll(): Promise - stops all registered processes
- restart(id: string): Promise - stops then respawns with same config
- isRunning(id: string): boolean - checks if process is alive
Use execa with { detached: true } for background processes.
Store spawned process reference to enable stop/restart.
Handle process exit events to update registry status.
Create src/process/index.ts - export ProcessManager, ProcessRegistry, types.
Can spawn a simple process (e.g., sleep 10), list it, stop it
ProcessManager can spawn, stop, restart, and list child processes
Before declaring plan complete:
- [ ] `npm run build` succeeds
- [ ] ProcessRegistry correctly tracks process info
- [ ] ProcessManager.spawn() starts a detached process
- [ ] ProcessManager.stop() terminates running process
- [ ] ProcessManager.isRunning() correctly reports status
- [ ] Process exit updates registry status automatically
<success_criteria>
- All tasks completed
- All verification checks pass
- Process lifecycle (spawn → track → stop) works end-to-end
- Infrastructure ready for agent management in Phase 4 </success_criteria>