Pre-approve common tools (Bash, Read, Write, Edit, Glob, Grep)

claude -p in non-interactive mode cannot show approval prompts,
so tools like gh/git were blocked. Add --allowedTools to enable
tool execution without manual approval.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 22:10:09 +10:00
co-authored by Claude Opus 4.6
parent 593d0dcd5f
commit 92c55df021
+7 -1
View File
@@ -47,7 +47,13 @@ function callClaude(model, messages) {
.join("\n\n");
const cliModel = MODEL_MAP[model] || model;
const args = ["-p", "--model", cliModel, "--output-format", "text", "--no-session-persistence", "--", prompt];
const args = [
"-p", "--model", cliModel,
"--output-format", "text",
"--no-session-persistence",
"--allowedTools", "Bash", "Read", "Write", "Edit", "Glob", "Grep",
"--", prompt,
];
const env = { ...process.env };
delete env.CLAUDECODE;