refactor(cli): Use excludeTools for non-interactive mode (#1072)
This commit is contained in:
parent
101b6fe767
commit
4463671284
|
@ -21,15 +21,7 @@ import {
|
||||||
ApprovalMode,
|
ApprovalMode,
|
||||||
Config,
|
Config,
|
||||||
EditTool,
|
EditTool,
|
||||||
GlobTool,
|
|
||||||
GrepTool,
|
|
||||||
LSTool,
|
|
||||||
MemoryTool,
|
|
||||||
ReadFileTool,
|
|
||||||
ReadManyFilesTool,
|
|
||||||
ShellTool,
|
ShellTool,
|
||||||
WebFetchTool,
|
|
||||||
WebSearchTool,
|
|
||||||
WriteFileTool,
|
WriteFileTool,
|
||||||
sessionId,
|
sessionId,
|
||||||
logUserPrompt,
|
logUserPrompt,
|
||||||
|
@ -166,28 +158,16 @@ async function loadNonInteractiveConfig(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything is not allowed, ensure that only read-only tools are configured.
|
// Everything is not allowed, ensure that only read-only tools are configured.
|
||||||
|
const existingExcludeTools = settings.merged.excludeTools || [];
|
||||||
let existingCoreTools = config.getCoreTools();
|
|
||||||
existingCoreTools = existingCoreTools || [
|
|
||||||
ReadFileTool.Name,
|
|
||||||
LSTool.Name,
|
|
||||||
GrepTool.Name,
|
|
||||||
GlobTool.Name,
|
|
||||||
EditTool.Name,
|
|
||||||
WriteFileTool.Name,
|
|
||||||
WebFetchTool.Name,
|
|
||||||
WebSearchTool.Name,
|
|
||||||
ReadManyFilesTool.Name,
|
|
||||||
ShellTool.Name,
|
|
||||||
MemoryTool.Name,
|
|
||||||
];
|
|
||||||
const interactiveTools = [ShellTool.Name, EditTool.Name, WriteFileTool.Name];
|
const interactiveTools = [ShellTool.Name, EditTool.Name, WriteFileTool.Name];
|
||||||
const nonInteractiveTools = existingCoreTools.filter(
|
|
||||||
(tool) => !interactiveTools.includes(tool),
|
const newExcludeTools = [
|
||||||
);
|
...new Set([...existingExcludeTools, ...interactiveTools]),
|
||||||
|
];
|
||||||
|
|
||||||
const nonInteractiveSettings = {
|
const nonInteractiveSettings = {
|
||||||
...settings.merged,
|
...settings.merged,
|
||||||
coreTools: nonInteractiveTools,
|
excludeTools: newExcludeTools,
|
||||||
};
|
};
|
||||||
return await loadCliConfig(
|
return await loadCliConfig(
|
||||||
nonInteractiveSettings,
|
nonInteractiveSettings,
|
||||||
|
|
|
@ -427,6 +427,9 @@ Add any other context about the problem here.
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should use the custom bug command URL from config if available', async () => {
|
it('should use the custom bug command URL from config if available', async () => {
|
||||||
|
process.env.CLI_VERSION = '0.1.0';
|
||||||
|
process.env.SANDBOX = 'sandbox-exec';
|
||||||
|
process.env.SEATBELT_PROFILE = 'permissive-open';
|
||||||
const bugCommand = {
|
const bugCommand = {
|
||||||
urlTemplate:
|
urlTemplate:
|
||||||
'https://custom-bug-tracker.com/new?title={title}&body={body}',
|
'https://custom-bug-tracker.com/new?title={title}&body={body}',
|
||||||
|
@ -449,7 +452,7 @@ Add any other context about the problem here.
|
||||||
* **CLI Version:** 0.1.0
|
* **CLI Version:** 0.1.0
|
||||||
* **Git Commit:** ${GIT_COMMIT_INFO}
|
* **Git Commit:** ${GIT_COMMIT_INFO}
|
||||||
* **Operating System:** test-platform test-node-version
|
* **Operating System:** test-platform test-node-version
|
||||||
* **Sandbox Environment:** no sandbox
|
* **Sandbox Environment:** sandbox-exec (permissive-open)
|
||||||
* **Model Version:** test-model
|
* **Model Version:** test-model
|
||||||
* **Memory Usage:** 11.8 MB
|
* **Memory Usage:** 11.8 MB
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -87,7 +87,9 @@ describe('usePhraseCycler', () => {
|
||||||
expect(result.current).toBe(WITTY_LOADING_PHRASES[0]);
|
expect(result.current).toBe(WITTY_LOADING_PHRASES[0]);
|
||||||
|
|
||||||
// Set back to active - should pick a random witty phrase
|
// Set back to active - should pick a random witty phrase
|
||||||
|
act(() => {
|
||||||
rerender({ isActive: true, isWaiting: false });
|
rerender({ isActive: true, isWaiting: false });
|
||||||
|
});
|
||||||
expect(WITTY_LOADING_PHRASES).toContain(result.current);
|
expect(WITTY_LOADING_PHRASES).toContain(result.current);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue