Skip to main content

editFileWithDiff

plugin.fs.editFileWithDiff(targetFile: string, codeEdit: string, diffIdentifier: string, prompt: string, applyModel?: string): Promise<EditFileAndApplyDiffResponse>

editFileWithDiff

Parameters

ParameterTypeRequiredDescription
targetFilestringYesThe target file to edit.
codeEditstringYesThe code edit to apply.
diffIdentifierstringYesThe diff identifier.
promptstringYesThe prompt for the edit.
applyModelstringNoThe model to apply the edit with.

Returns

Promise<EditFileAndApplyDiffResponse> — A promise that resolves with the edit result.

Example

import plugin from '@codebolt/plugin-sdk';

const result = await plugin.fs.editFileWithDiff('targetFile', 'codeEdit', 'diffIdentifier', 'prompt');
console.log(result);