Add stdin support to run command

Allow piping content to opencode run when no message arguments are provided, enabling standard Unix pipe patterns for better CLI integration.

🤖 Generated with [opencode](https://opencode.ai)

Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
Dax Raad 2025-07-07 16:29:04 -04:00
parent 9253a3ca9e
commit c51de945a5

View file

@ -54,7 +54,14 @@ export const RunCommand = cmd({
})
},
handler: async (args) => {
const message = args.message.join(" ")
let message = args.message.join(" ")
// Read from stdin if no message provided and stdin is available
if (!message && !process.stdin.isTTY) {
message = await Bun.stdin.text()
message = message.trim()
}
await bootstrap({ cwd: process.cwd() }, async () => {
const session = await (async () => {
if (args.continue) {