Skip to content

Commit 015c785

Browse files
committed
fix(opencode): restore Bun stdin reads for prompt input
Use Bun.stdin.text() again for run and TUI stdin so Bun.spawn() prefilled buffers reach the compiled CLI. This avoids the regression introduced by the node:stream/consumers path.
1 parent 74effa8 commit 015c785

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

‎packages/opencode/src/cli/cmd/run.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { cmd } from "./cmd"
66
import { Flag } from "../../flag/flag"
77
import { bootstrap } from "../bootstrap"
88
import { EOL } from "os"
9-
import { text as streamText } from "node:stream/consumers"
109
import { Filesystem } from "../../util/filesystem"
1110
import { createOpencodeClient, type Message, type OpencodeClient, type ToolPart } from "@opencode-ai/sdk/v2"
1211
import { Server } from "../../server/server"
@@ -338,7 +337,7 @@ export const RunCommand = cmd({
338337
}
339338
}
340339

341-
if (!process.stdin.isTTY) message += "\n" + (await streamText(process.stdin))
340+
if (!process.stdin.isTTY) message += "\n" + (await Bun.stdin.text())
342341

343342
if (message.trim().length === 0 && !args.command) {
344343
UI.error("You must provide a message or a command")

‎packages/opencode/src/cli/cmd/tui/thread.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { tui } from "./app"
33
import { Rpc } from "@/util/rpc"
44
import { type rpc } from "./worker"
55
import path from "path"
6-
import { text as streamText } from "node:stream/consumers"
76
import { fileURLToPath } from "url"
87
import { UI } from "@/cli/ui"
98
import { Log } from "@/util/log"
@@ -54,7 +53,7 @@ async function target() {
5453
}
5554

5655
async function input(value?: string) {
57-
const piped = process.stdin.isTTY ? undefined : await streamText(process.stdin)
56+
const piped = process.stdin.isTTY ? undefined : await Bun.stdin.text()
5857
if (!value) return piped
5958
if (!piped) return value
6059
return piped + "\n" + value

0 commit comments

Comments
 (0)