import { input, select } from '@inquirer/prompts'; import { createHandoff, listHandoffs, getHandoff } from '../../core/services/handoffService.js'; import type { Handoff } from '../../core/schema.js'; const roles = ['architect', 'implementer', 'reviewer', 'tester']; export async function handoffCreate(cwd: string, options: Partial = {}): Promise { const fromRole = options.fromRole ?? await select({ message: 'From role:', choices: roles.map((r) => ({ name: r, value: r })) }); const toRole = options.toRole ?? await select({ message: 'To role:', choices: roles.map((r) => ({ name: r, value: r })) }); const taskId = options.taskId ?? await input({ message: 'Related task id (optional):' }); const summary = options.summary ?? await input({ message: 'Summary:' }); const context = options.context ?? await input({ message: 'Context:' }); const handoff = createHandoff(cwd, { fromRole, toRole, fromAgent: options.fromAgent, toAgent: options.toAgent, taskId: taskId || undefined, summary, context, }); console.log(`Handoff created: ${handoff.id}`); } export function handoffRead(cwd: string, id: string): void { const { handoff, body } = getHandoff(cwd, id); console.log(`# ${handoff.summary}`); console.log(`From: ${handoff.fromRole} → ${handoff.toRole}`); if (handoff.taskId) console.log(`Task: ${handoff.taskId}`); console.log('\n' + body); } export function handoffList(cwd: string): void { const handoffs = listHandoffs(cwd); if (handoffs.length === 0) { console.log('No handoffs found.'); return; } for (const h of handoffs) { console.log(`${h.id}: ${h.title}`); } }