opencode-fast-apply 2.2.0 → 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.
@@ -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;AAshBvD,eAAO,MAAM,eAAe,EAAE,MAgL7B,CAAA;AAGD,eAAe,eAAe,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
@@ -399,14 +399,15 @@ async function sendTUIMessage(client, sessionID, message, params) {
399
399
  console.error("[fast-apply] Failed to send TUI notification:", error.message);
400
400
  }
401
401
  }
402
- async function sendTUINotification(client, sessionID, filePath, workingDir, insertions, deletions, modifiedTokens, params) {
402
+ async function sendTUINotification(client, sessionID, filePath, workingDir, insertions, deletions, modifiedTokens, diff, params) {
403
403
  const shortPath = shortenPath(filePath, workingDir);
404
404
  const tokenStr = formatTokenCount(modifiedTokens);
405
405
  const message = [
406
406
  `▣ Fast Apply | ~${tokenStr} tokens modified`,
407
407
  "",
408
- "Applied changes:",
409
- `→ ${shortPath}: +${insertions} -${deletions}`
408
+ `Applied changes to ${shortPath} (+${insertions} -${deletions}):`,
409
+ "",
410
+ diff
410
411
  ].join("\n");
411
412
  await sendTUIMessage(client, sessionID, message, params);
412
413
  }
@@ -503,6 +504,8 @@ write({
503
504
  return formatErrorOutput(errorMsg, target_filepath, directory);
504
505
  }
505
506
  const mergedCode = result.content;
507
+ // Read original file content BEFORE applying changes (for diff comparison)
508
+ const originalFileContent = await readFile(filepath, "utf-8");
506
509
  // Apply partial edit with smart matching
507
510
  const applyResult = await applyPartialEdit(filepath, original_code, mergedCode);
508
511
  if (!applyResult.success) {
@@ -518,12 +521,11 @@ write({
518
521
  await sendTUIErrorNotification(client, toolCtx.sessionID, target_filepath, directory, error.message, params);
519
522
  return formatErrorOutput(error.message, target_filepath, directory);
520
523
  }
521
- // Read origfile for diff comparison
522
- const originalFileContent = await readFile(filepath, "utf-8");
524
+ // Generate diff comparing original content with merged content
523
525
  const diff = generateUnifiedDiff(target_filepath, originalFileContent, applyResult.newFileContent);
524
526
  const { added, removed } = countChanges(diff);
525
527
  const modifiedTokens = estimateTokens(diff);
526
- await sendTUINotification(client, toolCtx.sessionID, target_filepath, directory, added, removed, modifiedTokens, params);
528
+ await sendTUINotification(client, toolCtx.sessionID, target_filepath, directory, added, removed, modifiedTokens, diff, params);
527
529
  return formatFastApplyResult(target_filepath, directory, added, removed, diff, modifiedTokens);
528
530
  },
529
531
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-fast-apply",
3
- "version": "2.2.0",
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": "latest",
19
+ "@opencode-ai/plugin": "^1.1.6",
20
20
  "diff": "^8.0.2"
21
21
  },
22
22
  "devDependencies": {