Revert "Make --allowed-tools work in non-interactive mode" (#10006)

This commit is contained in:
Gal Zahavi
2025-09-26 16:22:02 -07:00
committed by GitHub
parent 2aa2ab878b
commit 24c15b9d43
9 changed files with 7 additions and 388 deletions

View File

@@ -1936,51 +1936,6 @@ describe('loadCliConfig tool exclusions', () => {
expect(config.getExcludeTools()).not.toContain('replace');
expect(config.getExcludeTools()).not.toContain('write_file');
});
it('should not exclude shell tool in non-interactive mode when --allowed-tools="ShellTool" is set', async () => {
process.stdin.isTTY = false;
process.argv = [
'node',
'script.js',
'-p',
'test',
'--allowed-tools',
'ShellTool',
];
const argv = await parseArguments({} as Settings);
const config = await loadCliConfig({}, [], 'test-session', argv);
expect(config.getExcludeTools()).not.toContain(ShellTool.Name);
});
it('should not exclude shell tool in non-interactive mode when --allowed-tools="run_shell_command" is set', async () => {
process.stdin.isTTY = false;
process.argv = [
'node',
'script.js',
'-p',
'test',
'--allowed-tools',
'run_shell_command',
];
const argv = await parseArguments({} as Settings);
const config = await loadCliConfig({}, [], 'test-session', argv);
expect(config.getExcludeTools()).not.toContain(ShellTool.Name);
});
it('should not exclude shell tool in non-interactive mode when --allowed-tools="ShellTool(wc)" is set', async () => {
process.stdin.isTTY = false;
process.argv = [
'node',
'script.js',
'-p',
'test',
'--allowed-tools',
'ShellTool(wc)',
];
const argv = await parseArguments({} as Settings);
const config = await loadCliConfig({}, [], 'test-session', argv);
expect(config.getExcludeTools()).not.toContain(ShellTool.Name);
});
});
describe('loadCliConfig interactive', () => {