Skip to content

Commit 797eb8c

Browse files
committed
fix(cli): pass --model through to the TUI entry
The root command accepted --model but dropped it before the TUI started, so `opencode --model <id> --prompt ...` silently ran on the configured default model. Pass the flag through to the TUI args, where the existing args.model handling parses it and selects the model — matching the run path's behavior.
1 parent b2cecc6 commit 797eb8c

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

packages/cli/src/commands/commands.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ const Root = Spec.make(typeof OPENCODE_CLI_NAME === "string" ? OPENCODE_CLI_NAME
5555
Flag.optional,
5656
),
5757
prompt: Flag.string("prompt").pipe(Flag.withDescription("Prompt to use"), Flag.optional),
58+
model: Flag.string("model").pipe(
59+
Flag.withAlias("m"),
60+
Flag.withDescription("Model to use in the format provider/model#variant"),
61+
Flag.optional,
62+
),
5863
},
5964
commands: [
6065
Spec.make("upgrade", {

packages/cli/src/commands/handlers/default.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export default Runtime.handler(Commands, (input) =>
7676
continue: input.continue,
7777
sessionID: Option.getOrUndefined(input.session),
7878
prompt: Option.getOrUndefined(input.prompt),
79+
model: Option.getOrUndefined(input.model),
7980
auto: input.auto || input.yolo || input.dangerouslySkipPermissions,
8081
},
8182
config: {

0 commit comments

Comments
 (0)