Repository navigation
feat: add modelRemap to translate agent and command models per machine - #105
Open
Rahulsharma0810 wants to merge 1 commit into
Open
Rahulsharma0810 wants to merge 1 commit into
Rahulsharma0810 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #101
What
New
modelRemapmap inopencode-synced.jsoncthat translates model names per machine:{ "modelRemap": { "some-provider/some-model": "other-provider/other-model" } }model:frontmatter key of markdown files inagent/,agents/,command/,commands/,mode/,modes/, and themodel/small_modelvalues inopencode.json(c)(at any depth, soagent.*.modelandcommand.*.modelare covered).#variantsuffix is kept when only the base model is mapped. Only exact strings are replaced; prompt bodies and other keys are never touched, and an indentedmodel:inside frontmatter is ignored.Deviation from #101
The issue suggested putting the table in
opencode-synced.overrides.jsonc. That file is deep-merged intoopencode.json, so an extra top-level key there would end up in the real config and could fail schema validation. I putmodelRemapinopencode-synced.jsonc(which is already synced, per machine), and leftdropUnknownModelsout because the plugin has no reliable list of locally installed providers.Compatibility
Default is an empty map, which is a no-op. Invalid entries (non-string, empty, identity) are dropped during normalization.
Tests
model-remap.test.ts: exact and variant matches, prototype-key safety, ambiguous inversion, frontmatter-only rewriting, quotes and CRLF, no-frontmatter files, nested config keys without mutating the input.apply.test.ts: pull rewrites agent file andopencode.json; a pull then push leaves the repo files unchanged; no remap means no change.config.test.ts: normalization.bun run check,bun run test(219 passing) andbun run buildpass.