Skip to content

Commit 16f0abf

Browse files
committed
feat(notifications): include diff preview in fast apply notifications
Add formatted diff output to TUI notifications when fast apply completes. This provides immediate visual feedback of the changes applied without requiring users to check the file separately. - Add formatDiffForMarkdown helper to wrap diffs in markdown code blocks - Pass diff content through to sendTUINotification function - Update notification message format to include diff preview - Bump version to 2.2.1
1 parent 475f9d5 commit 16f0abf

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ function estimateTokens(text: string): number {
228228
return Math.ceil(text.length / 4)
229229
}
230230

231+
function formatDiffForMarkdown(diff: string): string {
232+
return "```diff\n" + diff + "\n```"
233+
}
234+
231235
function normalizeWhitespace(text: string): string {
232236
return text
233237
.split('\n')
@@ -505,6 +509,7 @@ async function sendTUINotification(
505509
insertions: number,
506510
deletions: number,
507511
modifiedTokens: number,
512+
diff: string,
508513
params: SessionParams
509514
): Promise<void> {
510515
const shortPath = shortenPath(filePath, workingDir)
@@ -513,8 +518,9 @@ async function sendTUINotification(
513518
const message = [
514519
`▣ Fast Apply | ~${tokenStr} tokens modified`,
515520
"",
516-
"Applied changes:",
517-
`→ ${shortPath}: +${insertions} -${deletions}`
521+
`Applied changes to ${shortPath} (+${insertions} -${deletions}):`,
522+
"",
523+
formatDiffForMarkdown(diff)
518524
].join("\n")
519525

520526
await sendTUIMessage(client, sessionID, message, params)
@@ -703,6 +709,7 @@ write({
703709
added,
704710
removed,
705711
modifiedTokens,
712+
diff,
706713
params
707714
)
708715

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opencode-fast-apply",
3-
"version": "2.2.0",
3+
"version": "2.2.1",
44
"description": "OpenCode plugin for Fast Apply - High-performance code editing with OpenAI-compatible APIs (LM Studio, Ollama)",
55
"type": "module",
66
"main": "dist/index.js",

0 commit comments

Comments
 (0)