From 73035c3048d20b2574ec0b265ef56bd588e2eb9d Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 5 Mar 2026 16:34:50 -0700 Subject: [PATCH] fix: strip shell comment lines from claude_args before parsing shell-quote treats # as a comment character, causing all content after a comment line to be swallowed. This strips lines starting with # before passing to parseShellArgs, so users can add documentation comments to their claude_args without breaking subsequent flags. Fixes #802 Co-Authored-By: Claude Opus 4.6 --- base-action/src/parse-sdk-options.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/base-action/src/parse-sdk-options.ts b/base-action/src/parse-sdk-options.ts index 35df281d2..f62a49434 100644 --- a/base-action/src/parse-sdk-options.ts +++ b/base-action/src/parse-sdk-options.ts @@ -79,6 +79,18 @@ function mergeMcpConfigs(configValues: string[]): string { return JSON.stringify(merged); } +/** + * Strip shell-style comment lines from input. + * shell-quote treats # as a comment character, swallowing all subsequent content. + * This removes lines whose first non-whitespace character is # before parsing. + */ +function stripShellComments(input: string): string { + return input + .split("\n") + .filter((line) => !line.trim().startsWith("#")) + .join("\n"); +} + /** * Parse claudeArgs string into extraArgs record for SDK pass-through * The SDK/CLI will handle --mcp-config, --json-schema, etc. @@ -92,7 +104,7 @@ function parseClaudeArgsToExtraArgs( if (!claudeArgs?.trim()) return {}; const result: Record = {}; - const args = parseShellArgs(claudeArgs).filter( + const args = parseShellArgs(stripShellComments(claudeArgs)).filter( (arg): arg is string => typeof arg === "string", );