You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: support JSON schema as a constrain of opencode run command #9320
Picking this up. The server/SDK already supports it — session.prompt accepts format: { type: "json_schema", schema, retryCount? } and the v2 SDK exposes it on the typed body (@opencode-ai/sdk/v2). The gap is the CLI surface; today opencode run --format json only controls the event stream shape, not the model's output contract.
Prior attempt #17276 stalled with no review and is stale against the current effectCmd structure of run.ts.
Proposed surface (mirrors codex exec --output-schema / claude -p --json-schema):
opencode run "extract function names from auth.py" --output-schema ./schema.json
--output-schema accepts a path to a .json file or an inline JSON string. The structured JSON is written to stdout.
Would be happy to submit a PR for this if the direction's right.
Reacted by Tuanshu, Justyna Wojtczak, Abdellah Fytahi and Dongjin Hong
Activity
github-actions commentedon Jan 19, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
laygir commentedon Mar 10, 2026
Arrived here looking for equivalent of following but for Opencode to run on the pipeline for code review. (also allowedTools)
trevorWieland commentedon May 27, 2026
Picking this up. The server/SDK already supports it —
session.promptacceptsformat: { type: "json_schema", schema, retryCount? }and the v2 SDK exposes it on the typed body (@opencode-ai/sdk/v2). The gap is the CLI surface; todayopencode run --format jsononly controls the event stream shape, not the model's output contract.Prior attempt #17276 stalled with no review and is stale against the current
effectCmdstructure ofrun.ts.Proposed surface (mirrors
codex exec --output-schema/claude -p --json-schema):opencode run "extract function names from auth.py" --output-schema ./schema.json--output-schemaaccepts a path to a.jsonfile or an inline JSON string. The structured JSON is written to stdout.Would be happy to submit a PR for this if the direction's right.
github-actions commentedon Jul 27, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.