mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -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();
|
mockExit.mockRestore();
|
||||||
mockConsoleError.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', () => {
|
describe('loadCliConfig', () => {
|
||||||
|
|||||||
@@ -233,6 +233,9 @@ export async function parseArguments(settings: Settings): Promise<CliArgs> {
|
|||||||
type: 'array',
|
type: 'array',
|
||||||
string: true,
|
string: true,
|
||||||
description: 'Tools that are allowed to run without confirmation',
|
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', {
|
.option('extensions', {
|
||||||
alias: 'e',
|
alias: 'e',
|
||||||
|
|||||||
Reference in New Issue
Block a user