Skip to content

feat(cli): add --output-schema flag#17276

Draft
Sceptyre wants to merge 14 commits intoanomalyco:devfrom
Sceptyre:feature/run-json-schema
Draft

feat(cli): add --output-schema flag#17276
Sceptyre wants to merge 14 commits intoanomalyco:devfrom
Sceptyre:feature/run-json-schema

Conversation

@Sceptyre
Copy link

@Sceptyre Sceptyre commented Mar 13, 2026

Issue for this PR

Closes #9320
Closes #10456

Type of change

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

What does this PR do?

This PR extends the output schema SDK feature added in a previous PR to the opencode run cli.
This adds the flags --json and --json-schema to allow enabling the json mode and defining the json-schema contents
The value for --json-schema can be either a json compatible string or a path to a file containing a json compatible string.

How did you verify your code works?

$ opencode-local run "hello world" --json --json-schema "{\"type\":\"object\",\"properties\":{\"is_hello_world\":{\"type\":\"boolean\"}},\"required\":[\"is_hello_world\"]}"
{"is_hello_world":true}

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

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

If you do not follow this template your PR will be automatically rejected.

@Sceptyre Sceptyre marked this pull request as ready for review March 13, 2026 02:40
@Sceptyre Sceptyre changed the title feat(9320): add --json and --json-schema flags feat(cli): add --json and --json-schema flags Mar 13, 2026
@Sceptyre Sceptyre marked this pull request as draft March 18, 2026 18:36
@Sceptyre Sceptyre changed the title feat(cli): add --json and --json-schema flags feat(cli): add --output-schema flag Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant