mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-15 00:21:09 -07:00
Correctly support comma-separated values for --allowed-tools (#8386)
Co-authored-by: anthony bushong <agmsb@users.noreply.github.com>
This commit is contained in:
@@ -296,6 +296,17 @@ describe('parseArguments', () => {
|
||||
mockExit.mockRestore();
|
||||
mockConsoleError.mockRestore();
|
||||
});
|
||||
|
||||
it('should support comma-separated values for --allowed-tools', async () => {
|
||||
process.argv = [
|
||||
'node',
|
||||
'script.js',
|
||||
'--allowed-tools',
|
||||
'read_file,ShellTool(git status)',
|
||||
];
|
||||
const argv = await parseArguments({} as Settings);
|
||||
expect(argv.allowedTools).toEqual(['read_file', 'ShellTool(git status)']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('loadCliConfig', () => {
|
||||
|
||||
@@ -233,6 +233,9 @@ export async function parseArguments(settings: Settings): Promise<CliArgs> {
|
||||
type: 'array',
|
||||
string: true,
|
||||
description: 'Tools that are allowed to run without confirmation',
|
||||
coerce: (tools: string[]) =>
|
||||
// Handle comma-separated values
|
||||
tools.flatMap((tool) => tool.split(',').map((t) => t.trim())),
|
||||
})
|
||||
.option('extensions', {
|
||||
alias: 'e',
|
||||
|
||||
Reference in New Issue
Block a user