diff options
| author | Dax Raad <[email protected]> | 2025-05-26 22:08:50 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-26 22:08:50 -0400 |
| commit | 2e938d9da1589e1e00b9739c5e6c8dc72dda872a (patch) | |
| tree | 40b58ba37c7566311a67cf1fb6daa103eef9545a /js/src/tool/patch.ts | |
| parent | b840a4075956f00d0c46c82b19da24d984dddd07 (diff) | |
| download | opencode-2e938d9da1589e1e00b9739c5e6c8dc72dda872a.tar.gz opencode-2e938d9da1589e1e00b9739c5e6c8dc72dda872a.zip | |
Standardize API parameters to camelCase and improve LSP client reliability
- Convert tool parameters from snake_case to camelCase for consistency
- Add file existence check in LSP client before opening files
- Fix version increment timing in LSP textDocument operations
- Optimize session token tracking using onStepFinish callback
- Add debugging logs for diagnostics troubleshooting
🤖 Generated with opencode
Co-Authored-By: opencode <[email protected]>
Diffstat (limited to 'js/src/tool/patch.ts')
| -rw-r--r-- | js/src/tool/patch.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/js/src/tool/patch.ts b/js/src/tool/patch.ts index d1969e8a1..209a2d927 100644 --- a/js/src/tool/patch.ts +++ b/js/src/tool/patch.ts @@ -34,7 +34,7 @@ CRITICAL REQUIREMENTS FOR USING THIS TOOL: The tool will apply all changes in a single atomic operation.`; const PatchParams = z.object({ - patch_text: z + patchText: z .string() .describe("The full patch text that describes all changes to be made"), }); @@ -269,13 +269,13 @@ export const patch = Tool.define({ name: "patch", description: DESCRIPTION, parameters: PatchParams, - execute: async ({ patch_text }) => { - if (!patch_text) { - throw new Error("patch_text is required"); + execute: async (params) => { + if (!params.patchText) { + throw new Error("patchText is required"); } // Identify all files needed for the patch and verify they've been read - const filesToRead = identifyFilesNeeded(patch_text); + const filesToRead = identifyFilesNeeded(params.patchText); for (const filePath of filesToRead) { let absPath = filePath; if (!path.isAbsolute(absPath)) { @@ -309,7 +309,7 @@ export const patch = Tool.define({ } // Check for new files to ensure they don't already exist - const filesToAdd = identifyFilesAdded(patch_text); + const filesToAdd = identifyFilesAdded(params.patchText); for (const filePath of filesToAdd) { let absPath = filePath; if (!path.isAbsolute(absPath)) { @@ -343,7 +343,7 @@ export const patch = Tool.define({ } // Process the patch - const [patch, fuzz] = textToPatch(patch_text, currentFiles); + const [patch, fuzz] = textToPatch(params.patchText, currentFiles); if (fuzz > 3) { throw new Error( `patch contains fuzzy matches (fuzz level: ${fuzz}). Please make your context lines more precise`, |
