Browse Source

temporarily remove bun strip ansi due to bug

Dax Raad 3 months ago
parent
commit
e316050bf5

+ 7 - 9
packages/opencode/src/cli/cmd/import.ts

@@ -2,7 +2,6 @@ import type { Argv } from "yargs"
 import { Session } from "../../session"
 import { Session } from "../../session"
 import { cmd } from "./cmd"
 import { cmd } from "./cmd"
 import { bootstrap } from "../bootstrap"
 import { bootstrap } from "../bootstrap"
-import { UI } from "../ui"
 import { Storage } from "../../storage/storage"
 import { Storage } from "../../storage/storage"
 import { Instance } from "../../project/instance"
 import { Instance } from "../../project/instance"
 import { EOL } from "os"
 import { EOL } from "os"
@@ -19,20 +18,19 @@ export const ImportCommand = cmd({
   },
   },
   handler: async (args) => {
   handler: async (args) => {
     await bootstrap(process.cwd(), async () => {
     await bootstrap(process.cwd(), async () => {
-      const file = Bun.file(args.file as string)
-      const exists = await file.exists()
-      if (!exists) {
-        UI.error(`File not found: ${args.file}`)
-        process.exit(1)
-      }
-
-      const exportData = (await file.json()) as {
+      const file = Bun.file(args.file)
+      const exportData = (await file.json().catch(() => {})) as {
         info: Session.Info
         info: Session.Info
         messages: Array<{
         messages: Array<{
           info: any
           info: any
           parts: any[]
           parts: any[]
         }>
         }>
       }
       }
+      if (!exportData) {
+        process.stdout.write(`File not found: ${args.file}`)
+        process.stdout.write(EOL)
+        return
+      }
 
 
       await Storage.write(["session", Instance.project.id, exportData.info.id], exportData.info)
       await Storage.write(["session", Instance.project.id, exportData.info.id], exportData.info)
 
 

+ 1 - 1
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

@@ -1171,7 +1171,7 @@ ToolRegistry.register<typeof BashTool>({
   name: "bash",
   name: "bash",
   container: "block",
   container: "block",
   render(props) {
   render(props) {
-    const output = createMemo(() => Bun.stripANSI(props.metadata.output?.trim() ?? ""))
+    const output = createMemo(() => props.metadata.output?.trim() ?? "")
     const { theme } = useTheme()
     const { theme } = useTheme()
     return (
     return (
       <>
       <>