Skip to content

Commit d5971e2

Browse files
authored
refactor: migrate src/cli/cmd/import.ts from Bun.file() to Filesystem module (#14143)
1 parent c71f4d4 commit d5971e2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/opencode/src/cli/cmd/import.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { SessionTable, MessageTable, PartTable } from "../../session/session.sql
88
import { Instance } from "../../project/instance"
99
import { ShareNext } from "../../share/share-next"
1010
import { EOL } from "os"
11+
import { Filesystem } from "../../util/filesystem"
1112

1213
/** Discriminated union returned by the ShareNext API (GET /api/share/:id/data) */
1314
export type ShareData =
@@ -116,8 +117,7 @@ export const ImportCommand = cmd({
116117

117118
exportData = transformed
118119
} else {
119-
const file = Bun.file(args.file)
120-
exportData = await file.json().catch(() => {})
120+
exportData = await Filesystem.readJson<NonNullable<typeof exportData>>(args.file).catch(() => undefined)
121121
if (!exportData) {
122122
process.stdout.write(`File not found: ${args.file}`)
123123
process.stdout.write(EOL)

0 commit comments

Comments
 (0)