opencode-fast-apply 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,qBAAqB,CAAA;AAwhBvD,eAAO,MAAM,eAAe,EAAE,MAmL7B,CAAA;AAGD,eAAe,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -180,9 +180,6 @@ function shortenPath(filePath, workingDir) {
|
|
|
180
180
|
function estimateTokens(text) {
|
|
181
181
|
return Math.ceil(text.length / 4);
|
|
182
182
|
}
|
|
183
|
-
function formatDiffForMarkdown(diff) {
|
|
184
|
-
return "```diff\n" + diff + "\n```";
|
|
185
|
-
}
|
|
186
183
|
function normalizeWhitespace(text) {
|
|
187
184
|
return text
|
|
188
185
|
.split('\n')
|
|
@@ -410,7 +407,7 @@ async function sendTUINotification(client, sessionID, filePath, workingDir, inse
|
|
|
410
407
|
"",
|
|
411
408
|
`Applied changes to ${shortPath} (+${insertions} -${deletions}):`,
|
|
412
409
|
"",
|
|
413
|
-
|
|
410
|
+
diff
|
|
414
411
|
].join("\n");
|
|
415
412
|
await sendTUIMessage(client, sessionID, message, params);
|
|
416
413
|
}
|
|
@@ -507,6 +504,8 @@ write({
|
|
|
507
504
|
return formatErrorOutput(errorMsg, target_filepath, directory);
|
|
508
505
|
}
|
|
509
506
|
const mergedCode = result.content;
|
|
507
|
+
// Read original file content BEFORE applying changes (for diff comparison)
|
|
508
|
+
const originalFileContent = await readFile(filepath, "utf-8");
|
|
510
509
|
// Apply partial edit with smart matching
|
|
511
510
|
const applyResult = await applyPartialEdit(filepath, original_code, mergedCode);
|
|
512
511
|
if (!applyResult.success) {
|
|
@@ -522,8 +521,7 @@ write({
|
|
|
522
521
|
await sendTUIErrorNotification(client, toolCtx.sessionID, target_filepath, directory, error.message, params);
|
|
523
522
|
return formatErrorOutput(error.message, target_filepath, directory);
|
|
524
523
|
}
|
|
525
|
-
//
|
|
526
|
-
const originalFileContent = await readFile(filepath, "utf-8");
|
|
524
|
+
// Generate diff comparing original content with merged content
|
|
527
525
|
const diff = generateUnifiedDiff(target_filepath, originalFileContent, applyResult.newFileContent);
|
|
528
526
|
const { added, removed } = countChanges(diff);
|
|
529
527
|
const modifiedTokens = estimateTokens(diff);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-fast-apply",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "OpenCode plugin for Fast Apply - High-performance code editing with OpenAI-compatible APIs (LM Studio, Ollama)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"prepublishOnly": "npm run build"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@opencode-ai/plugin": "
|
|
19
|
+
"@opencode-ai/plugin": "^1.1.6",
|
|
20
20
|
"diff": "^8.0.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|