chahinebrini ff79cbb639 feat(cli): brand all AgentHub console output with "AgentHub:" prefix
Every user-facing line — the watch stream and each command's success
line, on both the local and --server (remote) paths — now carries an
"AgentHub:" prefix so it's recognizable in any agent's console
(Claude / Codex / Kimi), independent of the board.

- watch: formatEvent rewritten to verb-based, branded lines
  ("AgentHub: Task received <id>  <title>  [status]",
   "AgentHub: Task done <id>  by <agent>", "AgentHub: Handoff …"),
  plus an "AgentHub: connected" line on stream start.
- task/handoff/decision/memory/delegate/init + server-listening lines
  branded on the local command path.
- cli/index.ts: same branding on the --server remote path (the path
  agents actually hit), so CLI line and SSE stream now match.
- tests: formatEvent assertions updated to the branded format
  (regex-tolerant of column padding). 106/106 green.

codex + kimi stay implementers by convention (role=implementer +
assignedTo) — no schema change. Bump 0.1.1 -> 0.1.2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 16:09:15 +02:00

57 lines
1.9 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(`AgentHub: Task 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(`AgentHub: Task claimed ${id} 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(`AgentHub: Task done ${id}`);
}