Skip to content

Commit aa74655

Browse files
committed
fix(deps): pin plugin dependency and improve diff handling
- Remove unused formatDiffForMarkdown function - Move originalFileContent read before applying changes for accurate diff comparison - Pin @opencode-ai/plugin to ^1.1.6 instead of 'latest' for stability - Bump version to 2.2.2
1 parent 16f0abf commit aa74655

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,6 @@ 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-
235231
function normalizeWhitespace(text: string): string {
236232
return text
237233
.split('\n')
@@ -520,7 +516,7 @@ async function sendTUINotification(
520516
"",
521517
`Applied changes to ${shortPath} (+${insertions} -${deletions}):`,
522518
"",
523-
formatDiffForMarkdown(diff)
519+
diff
524520
].join("\n")
525521

526522
await sendTUIMessage(client, sessionID, message, params)
@@ -659,6 +655,9 @@ write({
659655

660656
const mergedCode = result.content
661657

658+
// Read original file content BEFORE applying changes (for diff comparison)
659+
const originalFileContent = await readFile(filepath, "utf-8")
660+
662661
// Apply partial edit with smart matching
663662
const applyResult = await applyPartialEdit(filepath, original_code, mergedCode)
664663

@@ -690,8 +689,7 @@ write({
690689
return formatErrorOutput(error.message, target_filepath, directory)
691690
}
692691

693-
// Read origfile for diff comparison
694-
const originalFileContent = await readFile(filepath, "utf-8")
692+
// Generate diff comparing original content with merged content
695693
const diff = generateUnifiedDiff(
696694
target_filepath,
697695
originalFileContent,

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opencode-fast-apply",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
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",
@@ -16,7 +16,7 @@
1616
"prepublishOnly": "npm run build"
1717
},
1818
"dependencies": {
19-
"@opencode-ai/plugin": "latest",
19+
"@opencode-ai/plugin": "^1.1.6",
2020
"diff": "^8.0.2"
2121
},
2222
"devDependencies": {

0 commit comments

Comments
 (0)