import { Controller, Get, NotFoundException, Param, Query, UseGuards } from '@nestjs/common'; import { AuthGuard } from '../auth/auth.guard.js'; import { CoordService } from './coord.service.js'; @Controller('api/coord') @UseGuards(AuthGuard) export class CoordController { constructor(private readonly coordService: CoordService) {} @Get('status') async missionStatus(@Query('projectPath') projectPath?: string) { const resolvedPath = projectPath ?? process.cwd(); const status = await this.coordService.getMissionStatus(resolvedPath); if (!status) throw new NotFoundException('No active coord mission found'); return status; } @Get('tasks') async listTasks(@Query('projectPath') projectPath?: string) { const resolvedPath = projectPath ?? process.cwd(); return this.coordService.listTasks(resolvedPath); } @Get('tasks/:taskId') async taskStatus(@Param('taskId') taskId: string, @Query('projectPath') projectPath?: string) { const resolvedPath = projectPath ?? process.cwd(); const detail = await this.coordService.getTaskStatus(resolvedPath, taskId); if (!detail) throw new NotFoundException(`Task ${taskId} not found in coord mission`); return detail; } }