From e2bdca61337f24bac79507b4924c804cc5be5c93 Mon Sep 17 00:00:00 2001 From: km-anthropic Date: Thu, 7 Aug 2025 15:18:44 -0700 Subject: [PATCH] bun format --- base-action/src/run-claude.ts | 6 +++--- base-action/test/parse-shell-args.test.ts | 4 ++-- claude-args-example.yml | 11 +++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/base-action/src/run-claude.ts b/base-action/src/run-claude.ts index 844d932..5625990 100644 --- a/base-action/src/run-claude.ts +++ b/base-action/src/run-claude.ts @@ -114,9 +114,9 @@ export function prepareRunConfig( // Parse and append custom arguments (these can override the above) if (options.claudeArgs && options.claudeArgs.trim() !== "") { const parsed = parseShellArgs(options.claudeArgs); - // shell-quote returns an array that can contain strings and objects - // We only want string arguments - const customArgs = parsed.filter((arg): arg is string => typeof arg === "string"); + const customArgs = parsed.filter( + (arg): arg is string => typeof arg === "string", + ); claudeArgs.push(...customArgs); } diff --git a/base-action/test/parse-shell-args.test.ts b/base-action/test/parse-shell-args.test.ts index 7f8ab39..7e68c42 100644 --- a/base-action/test/parse-shell-args.test.ts +++ b/base-action/test/parse-shell-args.test.ts @@ -61,7 +61,7 @@ describe("shell-quote parseShellArgs", () => { test("should filter out non-string results", () => { // shell-quote can return objects for operators like | > < etc const result = parseShellArgs("echo hello"); - const filtered = result.filter(arg => typeof arg === "string"); + const filtered = result.filter((arg) => typeof arg === "string"); expect(filtered).toEqual(["echo", "hello"]); }); -}); \ No newline at end of file +}); diff --git a/claude-args-example.yml b/claude-args-example.yml index 06a6984..27d1b76 100644 --- a/claude-args-example.yml +++ b/claude-args-example.yml @@ -16,25 +16,24 @@ jobs: - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - + # Option 1: Simple prompt with custom args prompt: "Review this code and provide feedback" claude_args: "--max-turns 3 --model claude-3-5-sonnet-latest" - + # Option 2: Slash command with custom MCP config # prompt: "/review" # claude_args: "--mcp-config /workspace/custom-mcp.json --max-turns 5" - + # Option 3: Override output format and add custom system prompt # prompt: "Fix the failing tests" # claude_args: "--output-format json --system-prompt 'You are an expert test fixer'" - # How it works: # The action will execute: claude -p --verbose --output-format stream-json [your claude_args] # Where the prompt is piped via stdin # Benefits: # - Full control over Claude CLI arguments -# - Use any Claude feature without waiting for action updates +# - Use any Claude feature without waiting for action updates # - Override defaults when needed -# - Combine with existing inputs or use standalone \ No newline at end of file +# - Combine with existing inputs or use standalone