GET /tasks/:id/activity returns a time-sorted ActivityItem[] assembled from existing data (task created, handoffs by taskId, memory by relatedTasks, current status). memory add + task done gain optional tokens/duration/by metadata surfaced in the timeline. Board cards expand inline to show the timeline. Index gains taskId + relatedTasks columns with migrations. 74 -> 97 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import { input, select } from '@inquirer/prompts';
|
|
import { createTask, listTasks, getTask, claimTask, doneTask } from '../../core/services/taskService.js';
|
|
import type { Task } from '../../core/schema.js';
|
|
|
|
export async function taskCreate(cwd: string, options: Partial<Task> = {}): Promise<void> {
|
|
const title = options.title ?? await input({ message: 'Task title:' });
|
|
const role = options.role ?? await select({
|
|
message: 'Role:',
|
|
choices: [
|
|
{ name: 'architect', value: 'architect' },
|
|
{ name: 'implementer', value: 'implementer' },
|
|
{ name: 'reviewer', value: 'reviewer' },
|
|
{ name: 'tester', value: 'tester' },
|
|
],
|
|
});
|
|
const priority = options.priority ?? 'medium';
|
|
|
|
const task = createTask(cwd, { title, role, priority });
|
|
console.log(`Created ${task.id}: ${task.title}`);
|
|
}
|
|
|
|
export function taskList(cwd: string, filters?: { status?: string; role?: string }): void {
|
|
const tasks = listTasks(cwd, filters);
|
|
if (tasks.length === 0) {
|
|
console.log('No tasks found.');
|
|
return;
|
|
}
|
|
for (const t of tasks) {
|
|
console.log(`${t.id} [${t.status}] (${t.role ?? 'unassigned'}) ${t.title}`);
|
|
}
|
|
}
|
|
|
|
export function taskShow(cwd: string, id: string): void {
|
|
const { task, body } = getTask(cwd, id);
|
|
console.log(`# ${task.title}`);
|
|
console.log(`Status: ${task.status} | Role: ${task.role ?? '-'} | Priority: ${task.priority}`);
|
|
console.log('\n' + body);
|
|
}
|
|
|
|
export function taskClaim(cwd: string, id: string, agentName: string): void {
|
|
claimTask(cwd, id, agentName);
|
|
console.log(`${id} claimed by ${agentName}.`);
|
|
}
|
|
|
|
export function taskDone(
|
|
cwd: string,
|
|
id: string,
|
|
meta?: { tokens?: number; duration?: number; by?: string },
|
|
): void {
|
|
doneTask(cwd, id, {
|
|
doneBy: meta?.by,
|
|
doneTokens: meta?.tokens,
|
|
doneDuration: meta?.duration,
|
|
});
|
|
console.log(`${id} marked as done.`);
|
|
}
|