Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/workspaces/adapters/ai-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,9 @@ describe('composeHeadlessCommand (one-shot headless argv, prompt placed per-CLI)
'{"enableAllProjectMcpServers":true}',
'--allowedTools',
'Bash(alice:*),Bash(alice-workspace:*),Bash(alice-uta:*),Bash(traderhub:*)',
// Without this, Write/Edit fall through to a permission prompt headless has no way to answer.
'--permission-mode',
'acceptEdits',
'-p',
'--output-format',
'stream-json',
Expand Down
5 changes: 5 additions & 0 deletions src/workspaces/adapters/claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ const HEADLESS_ALLOWED_TOOLS = [
'Bash(traderhub:*)',
].join(',');

// The allowlist above covers Bash only. Without this, Write/Edit fall through
// to a permission prompt `-p` cannot answer, so headless runs lose all file output.
const HEADLESS_PERMISSION_MODE = 'acceptEdits';

function isRecord(value: unknown): value is Record<string, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value);
}
Expand Down Expand Up @@ -277,6 +281,7 @@ export const claudeAdapter: CliAdapter = {
...base,
'--settings', AUTOTRUST_SETTINGS,
'--allowedTools', HEADLESS_ALLOWED_TOOLS,
'--permission-mode', HEADLESS_PERMISSION_MODE,
...(ctx.sessionRuntime?.headlessArgs ?? []),
...(ctx.resume ? ['--resume', ctx.resume.sessionId] : []),
'-p', '--output-format', 'stream-json', '--verbose',
Expand Down