diff options
Diffstat (limited to 'packages/core/src/tools')
| -rw-r--r-- | packages/core/src/tools/edit.ts | 8 | ||||
| -rw-r--r-- | packages/core/src/tools/grep.test.ts | 2 | ||||
| -rw-r--r-- | packages/core/src/tools/read-many-files.test.ts | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/packages/core/src/tools/edit.ts b/packages/core/src/tools/edit.ts index 87a2ea44..fd936611 100644 --- a/packages/core/src/tools/edit.ts +++ b/packages/core/src/tools/edit.ts @@ -209,7 +209,7 @@ Expectation for required parameters: // Creating a new file isNewFile = true; } else if (!fileExists) { - // Trying to edit a non-existent file (and old_string is not empty) + // Trying to edit a nonexistent file (and old_string is not empty) error = { display: `File not found. Cannot apply edit. Use an empty old_string to create a new file.`, raw: `File not found: ${params.file_path}`, @@ -239,12 +239,12 @@ Expectation for required parameters: raw: `Failed to edit, 0 occurrences found for old_string in ${params.file_path}. No edits made. The exact text in old_string was not found. Ensure you're not escaping content incorrectly and check whitespace, indentation, and context. Use ${ReadFileTool.Name} tool to verify.`, }; } else if (occurrences !== expectedReplacements) { - const occurenceTerm = + const occurrenceTerm = expectedReplacements === 1 ? 'occurrence' : 'occurrences'; error = { - display: `Failed to edit, expected ${expectedReplacements} ${occurenceTerm} but found ${occurrences}.`, - raw: `Failed to edit, Expected ${expectedReplacements} ${occurenceTerm} but found ${occurrences} for old_string in file: ${params.file_path}`, + display: `Failed to edit, expected ${expectedReplacements} ${occurrenceTerm} but found ${occurrences}.`, + raw: `Failed to edit, Expected ${expectedReplacements} ${occurrenceTerm} but found ${occurrences} for old_string in file: ${params.file_path}`, }; } else if (finalOldString === finalNewString) { error = { diff --git a/packages/core/src/tools/grep.test.ts b/packages/core/src/tools/grep.test.ts index 2e018cce..09dec35f 100644 --- a/packages/core/src/tools/grep.test.ts +++ b/packages/core/src/tools/grep.test.ts @@ -17,7 +17,7 @@ vi.mock('child_process', () => ({ on: (event: string, cb: (...args: unknown[]) => void) => { if (event === 'error' || event === 'close') { // Simulate command not found or error for git grep and system grep - // to force fallback to JS implementation. + // to force it to fall back to JS implementation. setTimeout(() => cb(1), 0); // cb(1) for error/close } }, diff --git a/packages/core/src/tools/read-many-files.test.ts b/packages/core/src/tools/read-many-files.test.ts index adad6efc..641aa705 100644 --- a/packages/core/src/tools/read-many-files.test.ts +++ b/packages/core/src/tools/read-many-files.test.ts @@ -272,7 +272,7 @@ describe('ReadManyFilesTool', () => { ); }); - it('should handle non-existent specific files gracefully', async () => { + it('should handle nonexistent specific files gracefully', async () => { const params = { paths: ['nonexistent-file.txt'] }; const result = await tool.execute(params, new AbortController().signal); expect(result.llmContent).toEqual([ |
