mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-08-21 19:08:57 +08:00
fix: preserve repeated add-dir flags in claude args (#1256)
This commit is contained in:
@@ -19,6 +19,7 @@ const ACCUMULATING_FLAGS = new Set([
|
||||
"disallowedTools",
|
||||
"disallowed-tools",
|
||||
"mcp-config",
|
||||
"add-dir",
|
||||
]);
|
||||
|
||||
// Delimiter used to join accumulated flag values
|
||||
@@ -200,6 +201,14 @@ export function parseSdkOptions(options: ClaudeOptions): ParsedSdkOptions {
|
||||
// Detect if --json-schema is present (for hasJsonSchema flag)
|
||||
const hasJsonSchema = "json-schema" in extraArgs;
|
||||
|
||||
const additionalDirectories = extraArgs["add-dir"]
|
||||
? extraArgs["add-dir"]
|
||||
.split(ACCUMULATE_DELIMITER)
|
||||
.map((dir) => dir.trim())
|
||||
.filter(Boolean)
|
||||
: [];
|
||||
delete extraArgs["add-dir"];
|
||||
|
||||
// Extract and merge allowedTools from all sources:
|
||||
// 1. From extraArgs (parsed from claudeArgs - contains tag mode's tools)
|
||||
// - Check both camelCase (--allowedTools) and hyphenated (--allowed-tools) variants
|
||||
@@ -304,6 +313,8 @@ export function parseSdkOptions(options: ClaudeOptions): ParsedSdkOptions {
|
||||
systemPrompt,
|
||||
fallbackModel: options.fallbackModel,
|
||||
pathToClaudeCodeExecutable: options.pathToClaudeCodeExecutable,
|
||||
additionalDirectories:
|
||||
additionalDirectories.length > 0 ? additionalDirectories : undefined,
|
||||
|
||||
// Pass through claudeArgs as extraArgs - CLI handles --mcp-config, --json-schema, etc.
|
||||
// Note: allowedTools and disallowedTools have been removed from extraArgs to prevent duplicates
|
||||
|
||||
Reference in New Issue
Block a user