fix(cli): pass --model through to the TUI entry by holny · Pull Request #47699 · anomalyco/opencode · GitHub
Skip to content

fix(cli): pass --model through to the TUI entry - #47699

Closed
holny wants to merge 1 commit into
anomalyco:v2from
holny:tui-model-flag
Closed

holny wants to merge 1 commit into
anomalyco:v2from
holny:tui-model-flag

Conversation

@holny

@holny holny commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Fixes #47172

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

opencode --model <id> --prompt ... accepted the flag on the root command but dropped it before the TUI started, so the session silently ran on the configured default model — the requested id was never mentioned or validated. The run path already resolves and validates the same flag.

  • Define --model (with -m alias) on the root command params
  • Pass it through to the TUI args, where the existing args.model handling parses it and selects the model, warning on malformed values — matching the run path

How did you verify your code works?

  • --help on the root entry now lists --model, -m
  • bun typecheck in packages/cli and packages/tui
  • bun test in packages/cli (259 passing) and packages/tui (2 pre-existing timeouts in dialog-shell-output tests reproduce on a clean baseline, unrelated)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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.
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@holny

holny commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Fixes #47172 — the linked-issue check doesn't resolve the keyword from a fork PR, so referencing it here directly.

@holny

holny commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Gentle nudge — this adds a --model/-m flag to the TUI entry path (root spec + handler arg passthrough), checks green and cli tests passing. Happy to rework or rebase if anything needs adjusting.

@holny holny closed this by deleting the head repository Sep 9, 2026
@holny

holny commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant