Skip to content
Open
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
18 changes: 17 additions & 1 deletion base-action/src/parse-sdk-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ const ACCUMULATING_FLAGS = new Set([
// Delimiter used to join accumulated flag values
const ACCUMULATE_DELIMITER = "\x00";

/**
* Strip shell-style comments from input before parsing.
* Shell-quote treats # as a comment character, swallowing all content after it.
* This function removes lines that start with # (after trimming) to prevent
* flags after comments from being swallowed.
*/
function stripShellComments(input: string): string {
return input
.split("\n")
.filter((line) => !line.trim().startsWith("#"))
.join("\n");
}

type McpConfig = {
mcpServers?: Record<string, unknown>;
};
Expand Down Expand Up @@ -91,8 +104,11 @@ function parseClaudeArgsToExtraArgs(
): Record<string, string | null> {
if (!claudeArgs?.trim()) return {};

// Strip shell comments before parsing to prevent # from swallowing subsequent flags
const strippedArgs = stripShellComments(claudeArgs);

const result: Record<string, string | null> = {};
const args = parseShellArgs(claudeArgs).filter(
const args = parseShellArgs(strippedArgs).filter(
(arg): arg is string => typeof arg === "string",
);

Expand Down