Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit ed33d82

Browse files
authored
feat(cli): auto-submit prompt when using --prompt flag (anomalyco#4510)
1 parent 2d63c22 commit ed33d82

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export type PromptRef = {
4444
reset(): void
4545
blur(): void
4646
focus(): void
47+
submit(): void
4748
}
4849

4950
const PLACEHOLDERS = ["Fix a TODO in the codebase", "What is the tech stack of this project?", "Fix broken tests"]
@@ -447,11 +448,14 @@ export function Prompt(props: PromptProps) {
447448
})
448449
setStore("extmarkToPartIndex", new Map())
449450
},
451+
submit() {
452+
submit()
453+
},
450454
})
451455

452456
async function submit() {
453457
if (props.disabled) return
454-
if (autocomplete.visible) return
458+
if (autocomplete?.visible) return
455459
if (!store.prompt.input) return
456460
const trimmed = store.prompt.input.trim()
457461
if (trimmed === "exit" || trimmed === "quit" || trimmed === ":q") {

packages/opencode/src/cli/cmd/tui/routes/home.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export function Home() {
5757
} else if (args.prompt) {
5858
prompt.set({ input: args.prompt, parts: [] })
5959
once = true
60+
prompt.submit()
6061
}
6162
})
6263
const directory = useDirectory()

0 commit comments

Comments
 (0)