opencode-fast-apply 2.2.0 → 2.2.1
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 +8 -4
- package/package.json +1 -1
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;AA4hBvD,eAAO,MAAM,eAAe,EAAE,MAiL7B,CAAA;AAGD,eAAe,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -180,6 +180,9 @@ 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
|
+
}
|
|
183
186
|
function normalizeWhitespace(text) {
|
|
184
187
|
return text
|
|
185
188
|
.split('\n')
|
|
@@ -399,14 +402,15 @@ async function sendTUIMessage(client, sessionID, message, params) {
|
|
|
399
402
|
console.error("[fast-apply] Failed to send TUI notification:", error.message);
|
|
400
403
|
}
|
|
401
404
|
}
|
|
402
|
-
async function sendTUINotification(client, sessionID, filePath, workingDir, insertions, deletions, modifiedTokens, params) {
|
|
405
|
+
async function sendTUINotification(client, sessionID, filePath, workingDir, insertions, deletions, modifiedTokens, diff, params) {
|
|
403
406
|
const shortPath = shortenPath(filePath, workingDir);
|
|
404
407
|
const tokenStr = formatTokenCount(modifiedTokens);
|
|
405
408
|
const message = [
|
|
406
409
|
`▣ Fast Apply | ~${tokenStr} tokens modified`,
|
|
407
410
|
"",
|
|
408
|
-
|
|
409
|
-
|
|
411
|
+
`Applied changes to ${shortPath} (+${insertions} -${deletions}):`,
|
|
412
|
+
"",
|
|
413
|
+
formatDiffForMarkdown(diff)
|
|
410
414
|
].join("\n");
|
|
411
415
|
await sendTUIMessage(client, sessionID, message, params);
|
|
412
416
|
}
|
|
@@ -523,7 +527,7 @@ write({
|
|
|
523
527
|
const diff = generateUnifiedDiff(target_filepath, originalFileContent, applyResult.newFileContent);
|
|
524
528
|
const { added, removed } = countChanges(diff);
|
|
525
529
|
const modifiedTokens = estimateTokens(diff);
|
|
526
|
-
await sendTUINotification(client, toolCtx.sessionID, target_filepath, directory, added, removed, modifiedTokens, params);
|
|
530
|
+
await sendTUINotification(client, toolCtx.sessionID, target_filepath, directory, added, removed, modifiedTokens, diff, params);
|
|
527
531
|
return formatFastApplyResult(target_filepath, directory, added, removed, diff, modifiedTokens);
|
|
528
532
|
},
|
|
529
533
|
}),
|
package/package.json
CHANGED