Skip to content

Comments

feat(cli): add --format json option to models command#14554

Open
kevinWangSheng wants to merge 2 commits intoanomalyco:devfrom
kevinWangSheng:feat/models-json-format
Open

feat(cli): add --format json option to models command#14554
kevinWangSheng wants to merge 2 commits intoanomalyco:devfrom
kevinWangSheng:feat/models-json-format

Conversation

@kevinWangSheng
Copy link

@kevinWangSheng kevinWangSheng commented Feb 21, 2026

Issue for this PR

Closes #14550

Type of change

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

What does this PR do?

Adds --format json option to opencode models command for machine-readable output. The session list command already supports this, so this brings consistency. When --format json is used, outputs a JSON array of model objects.

How did you verify your code works?

Ran opencode models --format json locally and verified valid JSON output. Typecheck passes.

Screenshots / recordings

N/A - CLI output change.

Checklist

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

The session list command supports --format json for machine-readable
output, but the models command only supported plain text. This adds a
--format option with choices "text" (default) and "json" to bring
consistency across CLI commands and enable scripting use cases.

Closes anomalyco#14550

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Feb 21, 2026
Spread model properties before explicit id/provider/model fields so the
explicit values take precedence and TypeScript no longer warns about 'id'
being specified more than once.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Feb 21, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): add --format json option to models command

1 participant