diff --git a/packages/cli/src/commands/run.ts b/packages/cli/src/commands/run.ts index e427b03..26d38f7 100755 --- a/packages/cli/src/commands/run.ts +++ b/packages/cli/src/commands/run.ts @@ -1,5 +1,5 @@ /** - * RunCommand - Run the AirCoding project (spawns TUI) + * RunCommand - Start a session (spawns TUI) * DD ยง17. Routes side effects through RuntimeApp. * * @module packages/cli/src/commands/run @@ -11,11 +11,28 @@ import { TuiApp } from '@aircoding/tui' export async function runCommand(project_path?: string): Promise { const config = loadConfig(project_path) - console.log(`Starting AirCoding for ${config.project_root || process.cwd()}`) + const project_root = config.project_root || process.cwd() + console.log(`Starting AirCoding for ${project_root}`) const runtime = await createRuntime(config) await runtime.start() + // Push initial projection snapshot so TUI shows the session + runtime.projection_client.receive_snapshot({ + session_id: 'current', + project_id: '', + status: 'running', + title: project_root.split('/').pop() || 'AirCoding', + tasks: [], + agents: [], + tool_runs: [], + command_runs: [], + artifacts: [], + permission_prompts: [], + blockers: [], + updated_at: new Date().toISOString() + }) + // Wire TUI to runtime's ProjectionClient (B15 fix) const tui = new TuiApp({ client: runtime.projection_client }) await tui.start() @@ -27,4 +44,8 @@ export async function runCommand(project_path?: string): Promise { await runtime.shutdown() process.exit(0) }) -} + + // Keep process alive for TUI interaction + console.log(`\nSession active. Press 'q' to quit, 'h' for help.`) + await new Promise(() => {}) // Wait forever until SIGINT +} \ No newline at end of file