mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-15 12:13:59 +00:00
fix(dispatcher): treat --print as non-subcommand Claude session (#1341)
* fix(dispatcher): treat --print as non-subcommand Claude session * style: apply prettier formatting * fix(dispatcher): correct return type in subcommand detector getClaudeSubcommandName returns string | null; return false (boolean) was invalid after dev refactored isClaudeSubcommandInvocation to delegate to it. Change to return null to preserve the --print safety fix intent.
This commit is contained in:
1 parent
f0ec820054
commit
fd561b59bc
2 files changed
+20
-3
No files matched your search
@@ -56,6 +56,12 @@ describe('isClaudeSubcommandInvocation', () => {
|
||||
expect(isClaudeSubcommandInvocation(['--name', 'auth'])).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
it('treats --print prompt mode as non-subcommand even with subcommand-like prompt text', () => {
|
||||
expect(isClaudeSubcommandInvocation(['--print', 'agents'])).toBe(false);
|
||||
expect(isClaudeSubcommandInvocation(['--print', 'doctor'])).toBe(false);
|
||||
});
|
||||
|
||||
it('handles --flag=value forms', () => {
|
||||
expect(isClaudeSubcommandInvocation(['--model=sonnet', 'agents'])).toBe(true);
|
||||
});
|
||||
@@ -201,6 +207,13 @@ describe('subcommand passthrough — injectors short-circuit', () => {
|
||||
expect(appendBrowserToolArgs(['remote-control'])).toEqual(['remote-control']);
|
||||
});
|
||||
|
||||
|
||||
it('injectors still inject in --print prompt mode with subcommand-like prompt text', () => {
|
||||
const out = appendThirdPartyWebSearchToolArgs(['--print', 'agents']);
|
||||
expect(out).toContain('--append-system-prompt');
|
||||
expect(out).toContain('--disallowedTools');
|
||||
});
|
||||
|
||||
it('injectors still inject for non-subcommand interactive launches', () => {
|
||||
const out = appendThirdPartyWebSearchToolArgs(['fix the bug']);
|
||||
expect(out).toContain('--append-system-prompt');
|
||||
|
||||
Reference in new issue
Block a user