refactor(tools): consolidated directory listing functionality from ls tool into read tool

- Consolidated directory listing functionality from dedicated `ls` tool into the `read` tool.
- Removed the `ls` tool and all related exports, types, and configurations from the public API.
- Updated `read` tool to return formatted directory listings with modification times instead of redirecting to `ls` tool.
- Removed `bashInterceptor.simpleLs` setting and related interception logic from bash tool.
- Removed `ls.enabled` setting and related tool registration logic.
- Removed test cases for the `ls` tool and updated tool type definitions to remove `LsToolResultEvent`.
This commit is contained in:
can1357
2026-02-02 14:55:48 +01:00
parent 5926226e5c
commit e66d71f6b9
18 changed files with 84 additions and 407 deletions
@@ -103,27 +103,3 @@ export function checkBashInterception(
return { block: false };
}
/**
* Check if a command is a simple directory listing that should use `ls` tool.
* Only applies to bare `ls` without complex flags.
*/
export function checkSimpleLsInterception(command: string, availableTools: string[]): InterceptionResult {
if (!availableTools.includes("ls")) {
return { block: false };
}
// Match simple ls commands (ls, ls -la, ls /path, etc.)
// Don't intercept complex pipes or commands
const simpleLsPattern = /^\s*ls(\s+(-[a-zA-Z]+\s*)*)?(\s+[^|;&]+)?\s*$/;
if (simpleLsPattern.test(command.trim())) {
return {
block: true,
message: `Use the \`ls\` tool instead of bash ls. It provides structured output.\n\nOriginal command: ${command}`,
suggestedTool: "ls",
};
}
return { block: false };
}