From e0f43b88c219ba2d08fae8470b69a272012320c5 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Fri, 22 May 2026 11:11:08 -0400 Subject: [PATCH] test: cover agents permission-mode passthrough --- .../unit/utils/claude-subcommand-detector.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/unit/utils/claude-subcommand-detector.test.ts b/tests/unit/utils/claude-subcommand-detector.test.ts index 412e72cf..3f4512dd 100644 --- a/tests/unit/utils/claude-subcommand-detector.test.ts +++ b/tests/unit/utils/claude-subcommand-detector.test.ts @@ -110,6 +110,15 @@ describe('stripClaudeSubcommandSessionArgs', () => { ).toEqual(['mcp', '--setting-sources', 'user']); }); + it('removes --permission-mode for non-agents subcommands', () => { + expect( + stripClaudeSubcommandSessionArgs(['--permission-mode', 'bypassPermissions', 'doctor']) + ).toEqual(['doctor']); + expect(stripClaudeSubcommandSessionArgs(['doctor', '--permission-mode=acceptEdits'])).toEqual([ + 'doctor', + ]); + }); + it('preserves --permission-mode for the agents subcommand (after)', () => { // `claude agents` accepts `--permission-mode ` as the default // permission mode for dispatched sessions; CCS must not strip it. @@ -124,6 +133,12 @@ describe('stripClaudeSubcommandSessionArgs', () => { ).toEqual(['agents', '--permission-mode', 'bypassPermissions']); }); + it('preserves --permission-mode for the agents subcommand (before, separate value form)', () => { + expect( + stripClaudeSubcommandSessionArgs(['--permission-mode', 'bypassPermissions', 'agents']) + ).toEqual(['--permission-mode', 'bypassPermissions', 'agents']); + }); + it('preserves --permission-mode for the agents subcommand (before, --flag=value form)', () => { expect( stripClaudeSubcommandSessionArgs(['--permission-mode=bypassPermissions', 'agents'])