From 93f8ab56c25eb7a600184272bc9b99f400ea8042 Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Mon, 22 Sep 2025 18:18:04 +0200 Subject: [PATCH] Add support for kebab-case --allowed-tools flag (#581) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update parseAllowedTools to accept both --allowedTools and --allowed-tools - Add regex alternation to support both camelCase and kebab-case variants - Add test cases for unquoted and quoted kebab-case formats - All existing tests continue to pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude --- src/modes/agent/parse-tools.ts | 8 ++++---- test/modes/parse-tools.test.ts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/modes/agent/parse-tools.ts b/src/modes/agent/parse-tools.ts index b0b844e..9b2fdcb 100644 --- a/src/modes/agent/parse-tools.ts +++ b/src/modes/agent/parse-tools.ts @@ -1,10 +1,10 @@ export function parseAllowedTools(claudeArgs: string): string[] { - // Match --allowedTools followed by the value + // Match --allowedTools or --allowed-tools followed by the value // Handle both quoted and unquoted values const patterns = [ - /--allowedTools\s+"([^"]+)"/, // Double quoted - /--allowedTools\s+'([^']+)'/, // Single quoted - /--allowedTools\s+([^\s]+)/, // Unquoted + /--(?:allowedTools|allowed-tools)\s+"([^"]+)"/, // Double quoted + /--(?:allowedTools|allowed-tools)\s+'([^']+)'/, // Single quoted + /--(?:allowedTools|allowed-tools)\s+([^\s]+)/, // Unquoted ]; for (const pattern of patterns) { diff --git a/test/modes/parse-tools.test.ts b/test/modes/parse-tools.test.ts index f32281a..e88e800 100644 --- a/test/modes/parse-tools.test.ts +++ b/test/modes/parse-tools.test.ts @@ -68,4 +68,20 @@ describe("parseAllowedTools", () => { "mcp__github_comment__update", ]); }); + + test("parses kebab-case --allowed-tools", () => { + const args = "--allowed-tools mcp__github__*,mcp__github_comment__*"; + expect(parseAllowedTools(args)).toEqual([ + "mcp__github__*", + "mcp__github_comment__*", + ]); + }); + + test("parses quoted kebab-case --allowed-tools", () => { + const args = '--allowed-tools "mcp__github__*,mcp__github_comment__*"'; + expect(parseAllowedTools(args)).toEqual([ + "mcp__github__*", + "mcp__github_comment__*", + ]); + }); });