Changesets · Branches · Tags · Compare
| Changeset | a92cd8073012b9e1805fc0f58402a29539477447838cbe022f7c406b89d2cf70 |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-07-20 14:13 +02:00 |
| Committer | Dallin Romney <dallinromney@gmail.com> · 2025-07-20 14:13 +02:00 |
| Parents | 9df0fa5d79c7 |
14 files changed
modified core/tools/definitions/createRuleBlock.ts +1 −1
| @@ -16,7 +16,7 @@ | ||
| 16 | 16 | 'Creates a "rule" that can be referenced in future conversations. This should be used whenever you want to establish code standards / preferences that should be applied consistently, or when you want to avoid making a mistake again. To modify existing rules, use the edit tool instead.\n\nRule Types:\n- Always: Include only "rule" (always included in model context)\n- Auto Attached: Include "rule", "globs", and/or "regex" (included when files match patterns)\n- Agent Requested: Include "rule" and "description" (AI decides when to apply based on description)\n- Manual: Include only "rule" (only included when explicitly mentioned using @ruleName)', |
| 17 | 17 | parameters: { |
| 18 | 18 | type: "object", |
| 19 | - required: ["name", "rule", "description"], | |
| 19 | + required: ["name", "rule"], | |
| 20 | 20 | properties: { |
| 21 | 21 | name: { |
| 22 | 22 | type: "string", |
modified core/tools/definitions/ls.ts +1 −2
| @@ -16,12 +16,11 @@ | ||
| 16 | 16 | description: "List files and folders in a given directory", |
| 17 | 17 | parameters: { |
| 18 | 18 | type: "object", |
| 19 | - required: ["dirPath", "recursive"], | |
| 20 | 19 | properties: { |
| 21 | 20 | dirPath: { |
| 22 | 21 | type: "string", |
| 23 | 22 | description: |
| 24 | - "The directory path relative to the root of the project. Always use forward slash paths like '/'. rather than e.g. '.'", | |
| 23 | + "The directory path relative to the root of the project. Use forward slash paths like '/'. rather than e.g. '.'", | |
| 25 | 24 | }, |
| 26 | 25 | recursive: { |
| 27 | 26 | type: "boolean", |
modified core/tools/implementations/codebaseTool.ts +2 −8
| @@ -3,14 +3,8 @@ | ||
| 3 | 3 | import { retrieveContextItemsFromEmbeddings } from "../../context/retrieval/retrieval"; |
| 4 | 4 | |
| 5 | 5 | export const codebaseToolImpl: ToolImpl = async (args, extras) => { |
| 6 | - if (!args.query || args.query.trim() === "") { | |
| 7 | - return [ | |
| 8 | - { | |
| 9 | - name: "Error", | |
| 10 | - description: "Codebase search error", | |
| 11 | - content: "Query parameter is required and cannot be empty.", | |
| 12 | - }, | |
| 13 | - ]; | |
| 6 | + if (!args?.query || args.query.trim() === "") { | |
| 7 | + throw new Error("`query` parameter is required and cannot be empty."); | |
| 14 | 8 | } |
| 15 | 9 | |
| 16 | 10 | try { |
modified core/tools/implementations/createNewFile.ts +8 −0
| @@ -4,6 +4,14 @@ | ||
| 4 | 4 | import { getCleanUriPath, getUriPathBasename } from "../../util/uri"; |
| 5 | 5 | |
| 6 | 6 | export const createNewFileImpl: ToolImpl = async (args, extras) => { |
| 7 | + if (!args?.filepath) { | |
| 8 | + throw new Error("`filepath` argument is required and cannot be empty."); | |
| 9 | + } | |
| 10 | + if (args?.contents === undefined) { | |
| 11 | + throw new Error( | |
| 12 | + "`contents` argument is required to create a new file (can be empty).", | |
| 13 | + ); | |
| 14 | + } | |
| 7 | 15 | const resolvedFileUri = await inferResolvedUriFromRelativePath( |
| 8 | 16 | args.filepath, |
| 9 | 17 | extras.ide, |
modified core/tools/implementations/createRuleBlock.ts +5 −0
| @@ -13,6 +13,11 @@ | ||
| 13 | 13 | { name, rule, ...otherArgs }: CreateRuleBlockArgs, |
| 14 | 14 | extras, |
| 15 | 15 | ) => { |
| 16 | + if (!name || !rule) { | |
| 17 | + throw new Error( | |
| 18 | + "`name` and `rule` arguments are required to create a rule.", | |
| 19 | + ); | |
| 20 | + } | |
| 16 | 21 | const fileContent = createRuleMarkdown(name, rule, otherArgs); |
| 17 | 22 | |
| 18 | 23 | const [localContinueDir] = await extras.ide.getWorkspaceDirs(); |
modified core/tools/implementations/fetchUrlContent.ts +4 −0
| @@ -4,6 +4,10 @@ | ||
| 4 | 4 | const DEFAULT_FETCH_URL_CHAR_LIMIT = 20000; |
| 5 | 5 | |
| 6 | 6 | export const fetchUrlContentImpl: ToolImpl = async (args, extras) => { |
| 7 | + if (!args?.url) { | |
| 8 | + throw new Error("`url` argument is required and cannot be empty"); | |
| 9 | + } | |
| 10 | + | |
| 7 | 11 | const contextItems = await getUrlContextItems(args.url, extras.fetch); |
| 8 | 12 | |
| 9 | 13 | // Track truncated content |
modified core/tools/implementations/globSearch.ts +6 −0
| @@ -2,7 +2,13 @@ | ||
| 2 | 2 | import { ContextItem } from "../.."; |
| 3 | 3 | |
| 4 | 4 | const MAX_AGENT_GLOB_RESULTS = 100; |
| 5 | + | |
| 5 | 6 | export const fileGlobSearchImpl: ToolImpl = async (args, extras) => { |
| 7 | + if (!args?.pattern) { | |
| 8 | + throw new Error( | |
| 9 | + "`pattern` argument is required for a glob search, and cannot be empty", | |
| 10 | + ); | |
| 11 | + } | |
| 6 | 12 | const results = await extras.ide.getFileResults( |
| 7 | 13 | args.pattern, |
| 8 | 14 | MAX_AGENT_GLOB_RESULTS, |
modified core/tools/implementations/grepSearch.ts +6 −0
| @@ -41,6 +41,12 @@ | ||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | export const grepSearchImpl: ToolImpl = async (args, extras) => { |
| 44 | + if (!args?.query) { | |
| 45 | + throw new Error( | |
| 46 | + "`query` argument is required for a grep search, and cannot be empty", | |
| 47 | + ); | |
| 48 | + } | |
| 49 | + | |
| 44 | 50 | const results = await extras.ide.getSearchResults( |
| 45 | 51 | args.query, |
| 46 | 52 | DEFAULT_GREP_SEARCH_RESULTS_LIMIT, |
modified core/tools/implementations/readFile.ts +6 −0
| @@ -5,6 +5,12 @@ | ||
| 5 | 5 | import { throwIfFileExceedsHalfOfContext } from "./readFileLimit"; |
| 6 | 6 | |
| 7 | 7 | export const readFileImpl: ToolImpl = async (args, extras) => { |
| 8 | + if (!args?.filepath) { | |
| 9 | + throw new Error( | |
| 10 | + "`filepath` argument is required to read a file, and cannot be empty", | |
| 11 | + ); | |
| 12 | + } | |
| 13 | + | |
| 8 | 14 | const firstUriMatch = await resolveRelativePathInDir( |
| 9 | 15 | args.filepath, |
| 10 | 16 | extras.ide, |
modified core/tools/implementations/requestRule.ts +6 −0
| @@ -1,6 +1,12 @@ | ||
| 1 | 1 | import { ToolImpl } from "."; |
| 2 | 2 | |
| 3 | 3 | export const requestRuleImpl: ToolImpl = async (args, extras) => { |
| 4 | + if (!args?.name) { | |
| 5 | + throw new Error( | |
| 6 | + "`name` argument is required to request a rule, and cannot be empty", | |
| 7 | + ); | |
| 8 | + } | |
| 9 | + | |
| 4 | 10 | // Find the rule by name in the config |
| 5 | 11 | const rule = extras.config.rules.find((r) => r.name === args.name); |
| 6 | 12 |
modified core/tools/implementations/runTerminalCommand.ts +6 −0
| @@ -50,6 +50,12 @@ | ||
| 50 | 50 | ]; |
| 51 | 51 | |
| 52 | 52 | export const runTerminalCommandImpl: ToolImpl = async (args, extras) => { |
| 53 | + if (!args?.command) { | |
| 54 | + throw new Error( | |
| 55 | + "`command` argument is required to run a terminal command, and cannot be empty", | |
| 56 | + ); | |
| 57 | + } | |
| 58 | + | |
| 53 | 59 | // Default to waiting for completion if not specified |
| 54 | 60 | const waitForCompletion = args.waitForCompletion !== false; |
| 55 | 61 | const ideInfo = await extras.ide.getIdeInfo(); |
modified core/tools/implementations/searchWeb.ts +6 −0
| @@ -4,6 +4,12 @@ | ||
| 4 | 4 | const DEFAULT_WEB_SEARCH_CHAR_LIMIT = 8000; |
| 5 | 5 | |
| 6 | 6 | export const searchWebImpl: ToolImpl = async (args, extras) => { |
| 7 | + if (!args?.query) { | |
| 8 | + throw new Error( | |
| 9 | + "`query` argument is required to search the web, and cannot be empty", | |
| 10 | + ); | |
| 11 | + } | |
| 12 | + | |
| 7 | 13 | const webResults = await fetchSearchResults(args.query, 5, extras.fetch); |
| 8 | 14 | |
| 9 | 15 | // Track truncated results |
modified core/tools/implementations/viewSubdirectory.ts +6 −0
| @@ -4,7 +4,13 @@ | ||
| 4 | 4 | import { ToolImpl } from "."; |
| 5 | 5 | |
| 6 | 6 | export const viewSubdirectoryImpl: ToolImpl = async (args: any, extras) => { |
| 7 | + if (!args?.directory_path) { | |
| 8 | + throw new Error( | |
| 9 | + "`directory_path` argument is required to view a map of a subdirectory, and cannot be empty", | |
| 10 | + ); | |
| 11 | + } | |
| 7 | 12 | const { directory_path } = args; |
| 13 | + | |
| 8 | 14 | const uri = await resolveRelativePathInDir(directory_path, extras.ide); |
| 9 | 15 | |
| 10 | 16 | if (!uri) { |
modified gui/src/util/clientTools/editImpl.ts +5 −0
| @@ -6,6 +6,11 @@ | ||
| 6 | 6 | toolCallId, |
| 7 | 7 | extras, |
| 8 | 8 | ) => { |
| 9 | + if (!args.filepath || !args.changes) { | |
| 10 | + throw new Error( | |
| 11 | + "`filepath` and `changes` arguments are required to edit an existing file.", | |
| 12 | + ); | |
| 13 | + } | |
| 9 | 14 | const firstUriMatch = await resolveRelativePathInDir( |
| 10 | 15 | args.filepath, |
| 11 | 16 | extras.ideMessenger.ide, |