(action: string | undefined, args: string[])
| 85 | console.error(`\x1b[31merror:\x1b[0m ${err instanceof Error ? err.message : err}`); |
| 86 | process.exit(1); |
| 87 | } |
| 88 | |
| 89 | async function dispatch(): Promise<void> { |
| 90 | switch (group) { |
| 91 | case 'project': |
| 92 | return project(action, rest); |
| 93 | case 'persona': |
| 94 | return persona(action, rest); |
| 95 | case 'run': |
| 96 | return run([action, ...rest].filter(Boolean).join(' ')); |
| 97 | case 'ls': |
| 98 | return kildList(); |
| 99 | case 'new': |
| 100 | return kildNew([action, ...rest].filter(Boolean).join(' ')); |
| 101 | case 'send': { |
| 102 | if (!action || rest.length === 0) { |
| 103 | throw new Error('usage: kild send <id> --to a,b <text…>'); |
| 104 | } |
| 105 | return kildSend(action, rest.join(' ')); |
| 106 | } |
| 107 | case 'stop': { |
| 108 | if (!action) throw new Error('usage: kild stop <id> [--as <handle>]'); |
| 109 | return kildStop(action); |
no test coverage detected