返回 html-video
qoder.ts
根目录 / packages / runtime / src / defs / qoder.ts
1 import type { AgentDef } from '../types.js';
2
3 /**
4 * Qoder CLI def (`qodercli`, by Qoder — npm `@qoder-ai/qodercli`).
5 *
6 * Qoder ships two binaries: `qoder` (the IDE / Electron wrapper) and
7 * `qodercli` (the standalone coding agent CLI, installed via npm).
8 * html-video uses the latter — it's the headless-capable one.
9 *
10 * Headless contract (same shape as Claude Code / Codex / Qwen):
11 * echo "<prompt>" | qodercli -p - --permission-mode bypass_permissions
12 *
13 * -p - → non-interactive, read prompt from stdin, print to stdout.
14 * --permission-mode bypass_permissions → auto-approve all tool calls
15 * (file writes, shell, etc.) so the session never blocks on an
16 * interactive permission prompt the studio cannot answer.
17 *
18 * Prompt is passed via stdin (promptViaStdin: true) — avoids Windows shell
19 * escaping issues with backticks, quotes, and CJK chars in long prompts.
20 * Default stdout is plain text, so the extractor reads the fenced ```html``` block.
21 *
22 * Version probe: `qodercli -v` → e.g. "1.0.14".
23 */
24 export const qoderCli: AgentDef = {
25 id: 'qoder-cli',
26 name: 'Qoder CLI',
27 bin: 'qodercli',
28 versionArgs: ['-v'],
29 buildArgs(_prompt, _ctx) {
30 // -p -: read prompt from stdin (avoids Windows shell escaping issues
31 // with backticks, quotes, and other special chars in long prompts).
32 // --permission-mode bypass_permissions: auto-approve tool calls.
33 // --dangerously-skip-permissions: belt-and-suspenders — ensures
34 // the sandbox layer also lifts write/edit restrictions.
35 return ['-p', '-', '--permission-mode', 'bypass_permissions', '--dangerously-skip-permissions'];
36 },
37 streamFormat: 'plain',
38 promptViaStdin: true,
39 installUrl: 'https://www.npmjs.com/package/@qoder-ai/qodercli',
40 };
41
41 lines TYPESCRIPT