Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/web/client/src/components/tools/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {
TERMINAL_COMMAND_TOOL_PARAMETERS,
TODO_WRITE_TOOL_NAME,
TODO_WRITE_TOOL_PARAMETERS,
TYPECHECK_TOOL_NAME,
TYPECHECK_TOOL_PARAMETERS,
WEB_SEARCH_TOOL_NAME,
WEB_SEARCH_TOOL_PARAMETERS,
WRITE_FILE_TOOL_NAME,
Expand Down Expand Up @@ -167,6 +169,14 @@ const TOOL_HANDLERS: ClientToolMap = {
handler: async (args: z.infer<typeof WEB_SEARCH_TOOL_PARAMETERS>, editorEngine: EditorEngine) =>
handleWebSearchTool(args),
},
[TYPECHECK_TOOL_NAME]: {
name: TYPECHECK_TOOL_NAME,
inputSchema: TYPECHECK_TOOL_PARAMETERS,
handler: async (args: z.infer<typeof TYPECHECK_TOOL_PARAMETERS>, editorEngine: EditorEngine) => {
return handleTerminalCommandTool({ command: 'bun run typecheck' }, editorEngine);
},
},

};

export async function handleToolCall(toolCall: ToolCall<string, unknown>, editorEngine: EditorEngine) {
Expand Down
7 changes: 7 additions & 0 deletions packages/ai/src/tools/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,10 @@ export const grepTool = tool({
description: 'Powerful search tool built on ripgrep with full regex syntax support',
inputSchema: GREP_TOOL_PARAMETERS,
});
export const TYPECHECK_TOOL_NAME = 'typecheck';
export const TYPECHECK_TOOL_PARAMETERS = z.object({});
export const typecheckTool = tool({
description:
'Run this as the final command after all other commands, especially after every file edit, when type changes are suspected, and on new project creation, to ensure type safety across the project. If any type errors are found, the AI will attempt to fix them automatically.',
inputSchema: TYPECHECK_TOOL_PARAMETERS,
});
3 changes: 3 additions & 0 deletions packages/ai/src/tools/toolset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
grepTool,
TERMINAL_COMMAND_TOOL_NAME,
terminalCommandTool,
TYPECHECK_TOOL_NAME,
typecheckTool,
} from './cli';
import {
FUZZY_EDIT_FILE_TOOL_NAME,
Expand Down Expand Up @@ -60,4 +62,5 @@ export const BUILD_TOOL_SET: ToolSet = {
[BASH_EDIT_TOOL_NAME]: bashEditTool,
[SANDBOX_TOOL_NAME]: sandboxTool,
[TERMINAL_COMMAND_TOOL_NAME]: terminalCommandTool,
[TYPECHECK_TOOL_NAME]: typecheckTool,
};