agenthub/src/cli/commands/delegate.ts
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

25 lines
932 B
TypeScript

import { loadConfig } from '../../core/config.js';
import { suggestDelegation, autoDelegate } from '../../core/services/delegateService.js';
export async function delegate(cwd: string, options: { auto?: boolean } = {}): Promise<void> {
const config = loadConfig(cwd);
const suggestion = suggestDelegation(cwd);
if (!suggestion) {
console.log('No open tasks to delegate.');
return;
}
console.log('Suggested delegation:');
console.log(` Task: ${suggestion.task.id}${suggestion.task.title}`);
console.log(` Role: ${suggestion.role}`);
console.log(` Preferred agent: ${suggestion.preferredAgent}`);
if (config.delegationMode === 'auto' || options.auto) {
autoDelegate(cwd);
console.log('AgentHub: Handoff created automatically');
} else {
console.log('Run with --auto to create the handoff, or run:');
console.log(` agenthub handoff create --taskId ${suggestion.task.id}`);
}
}