Browse Source

chore: generate

opencode-agent[bot] 2 months ago
parent
commit
c36a433a1f

+ 4 - 2
packages/ui/src/components/session-diff.test.ts

@@ -37,7 +37,8 @@ describe("session diff", () => {
   test("renders whole-file VCS patches as complete diffs", () => {
   test("renders whole-file VCS patches as complete diffs", () => {
     const fileDiff = resolveFileDiff({
     const fileDiff = resolveFileDiff({
       file: "a.ts",
       file: "a.ts",
-      patch: "diff --git a/a.ts b/a.ts\nindex 1a2b3c4..5d6e7f8 100644\n--- a/a.ts\n+++ b/a.ts\n@@ -1,2 +1,2 @@\n one\n-old\n+new\n",
+      patch:
+        "diff --git a/a.ts b/a.ts\nindex 1a2b3c4..5d6e7f8 100644\n--- a/a.ts\n+++ b/a.ts\n@@ -1,2 +1,2 @@\n one\n-old\n+new\n",
     })
     })
 
 
     expect(fileDiff.isPartial).toBe(false)
     expect(fileDiff.isPartial).toBe(false)
@@ -47,7 +48,8 @@ describe("session diff", () => {
   test("keeps ordinary leading tool patches partial", () => {
   test("keeps ordinary leading tool patches partial", () => {
     const fileDiff = resolveFileDiff({
     const fileDiff = resolveFileDiff({
       file: "a.ts",
       file: "a.ts",
-      patch: "Index: a.ts\n===================================================================\n--- a.ts\n+++ a.ts\n@@ -1,5 +1,5 @@\n-old\n+new\n two\n three\n four\n five\n",
+      patch:
+        "Index: a.ts\n===================================================================\n--- a.ts\n+++ a.ts\n@@ -1,5 +1,5 @@\n-old\n+new\n two\n three\n four\n five\n",
     })
     })
 
 
     expect(fileDiff.isPartial).toBe(true)
     expect(fileDiff.isPartial).toBe(true)

+ 1 - 1
packages/ui/src/components/session-diff.ts

@@ -64,7 +64,7 @@ function fileDiffFromPatch(file: string, patch: string) {
   const input = contents ? undefined : patchInput(file, patch)
   const input = contents ? undefined : patchInput(file, patch)
   const value = contents
   const value = contents
     ? fileDiffFromContent(file, contents.before, contents.after)
     ? fileDiffFromContent(file, contents.before, contents.after)
-    : (input ? parsePatchFiles(input)[0]?.files[0] : undefined) ?? emptyFileDiff(file)
+    : ((input ? parsePatchFiles(input)[0]?.files[0] : undefined) ?? emptyFileDiff(file))
   patchFileDiffCache.set(key, value)
   patchFileDiffCache.set(key, value)
   while (patchFileDiffCache.size > diffCacheLimit) patchFileDiffCache.delete(patchFileDiffCache.keys().next().value!)
   while (patchFileDiffCache.size > diffCacheLimit) patchFileDiffCache.delete(patchFileDiffCache.keys().next().value!)
   return value
   return value