Skip to content

fix(opencode): allow partial command overrides in JSON config#27086

Open
joao-paulo-santos wants to merge 1 commit into
anomalyco:devfrom
joao-paulo-santos:fix/partial-command-override
Open

fix(opencode): allow partial command overrides in JSON config#27086
joao-paulo-santos wants to merge 1 commit into
anomalyco:devfrom
joao-paulo-santos:fix/partial-command-override

Conversation

@joao-paulo-santos
Copy link
Copy Markdown

@joao-paulo-santos joao-paulo-santos commented May 12, 2026

Issue for this PR

Fixes #27035

Type of change

  • Bug fix

What does this PR do?

ConfigCommand.Info requires template as a mandatory field, but the docs show that JSON config can override just the model for a built-in command. Since template is derived from markdown content for built-in commands, users shouldn't need to copy-paste it.

Made template optional in the Info schema. Markdown-loaded commands always set template from md.content.trim(), so they're unaffected. The command/index.ts loop now skips entries without a template — partial overrides get their template filled in when markdown commands are merged at config.ts:619.

Note: This PR is scoped to fixing the schema validation only. The actual override values (e.g. model) are currently overwritten by the markdown merge at config.ts:619 due to merge order (mergeDeep(jsonConfig, markdownCommands) — markdown wins on overlapping keys). That should be addressed as a separate issue.

How did you verify your code works?

  • bun test test/config/config.test.ts — 84 tests pass, including a new test that configures a command override with only model (no template)
  • bun turbo typecheck — 14/14 packages clean
  • Pre-push CI hook confirmed typecheck passes

Screenshots / recordings

N/A — config validation fix, no UI changes.

Checklist

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

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 12, 2026
@github-actions
Copy link
Copy Markdown
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.

command config requires template when overriding only model, contradicting docs

1 participant