diff options
| author | Dax <[email protected]> | 2026-02-18 12:22:46 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-18 17:22:46 +0000 |
| commit | 472d01fbaf8e5aa46048062d3dd8f7acb1fc2c49 (patch) | |
| tree | 92c1231d9881d1a5d2f3d93ad5991c1fcde4c6a0 | |
| parent | a5c15a23e4b352b21c4e0fe8056c302436564107 (diff) | |
| download | opencode-472d01fbaf8e5aa46048062d3dd8f7acb1fc2c49.tar.gz opencode-472d01fbaf8e5aa46048062d3dd8f7acb1fc2c49.zip | |
refactor: migrate cli/cmd/run.ts from Bun.file() to Filesystem/stat modules (#14155)
| -rw-r--r-- | packages/opencode/src/cli/cmd/github.ts | 3 | ||||
| -rw-r--r-- | packages/opencode/src/cli/cmd/run.ts | 12 |
2 files changed, 5 insertions, 10 deletions
diff --git a/packages/opencode/src/cli/cmd/github.ts b/packages/opencode/src/cli/cmd/github.ts index 7f9a03d94..c44b7f6a2 100644 --- a/packages/opencode/src/cli/cmd/github.ts +++ b/packages/opencode/src/cli/cmd/github.ts @@ -1,5 +1,6 @@ import path from "path" import { exec } from "child_process" +import { Filesystem } from "../../util/filesystem" import * as prompts from "@clack/prompts" import { map, pipe, sortBy, values } from "remeda" import { Octokit } from "@octokit/rest" @@ -360,7 +361,7 @@ export const GithubInstallCommand = cmd({ ? "" : `\n env:${providers[provider].env.map((e) => `\n ${e}: \${{ secrets.${e} }}`).join("")}` - await Bun.write( + await Filesystem.write( path.join(app.root, WORKFLOW_FILE), `name: opencode diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts index 55cf9a2a0..bf63eabf8 100644 --- a/packages/opencode/src/cli/cmd/run.ts +++ b/packages/opencode/src/cli/cmd/run.ts @@ -6,6 +6,7 @@ import { cmd } from "./cmd" import { Flag } from "../../flag/flag" import { bootstrap } from "../bootstrap" import { EOL } from "os" +import { Filesystem } from "../../util/filesystem" import { createOpencodeClient, type Message, type OpencodeClient, type ToolPart } from "@opencode-ai/sdk/v2" import { Server } from "../../server/server" import { Provider } from "../../provider/provider" @@ -315,19 +316,12 @@ export const RunCommand = cmd({ for (const filePath of list) { const resolvedPath = path.resolve(process.cwd(), filePath) - const file = Bun.file(resolvedPath) - const stats = await file.stat().catch(() => {}) - if (!stats) { - UI.error(`File not found: ${filePath}`) - process.exit(1) - } - if (!(await file.exists())) { + if (!(await Filesystem.exists(resolvedPath))) { UI.error(`File not found: ${filePath}`) process.exit(1) } - const stat = await file.stat() - const mime = stat.isDirectory() ? "application/x-directory" : "text/plain" + const mime = (await Filesystem.isDir(resolvedPath)) ? "application/x-directory" : "text/plain" files.push({ type: "file", |
