fix(opencode): accept documented string forms for skill compatibility and top-level permission#2096
Merged
Conversation
… and top-level permission (#2066) OpenCode documents SKILL.md `compatibility` as a free-form string (e.g. `compatibility: opencode`), but the schema modeled it as object-only, so importing the documented form threw `Invalid frontmatter`. Widen OpenCodeSkillFrontmatterSchema and the rulesync opencode-section schema to a string|object union and propagate it through toRulesyncSkill/fromRulesyncSkill. OpenCode also documents the top-level `permission` config as accepting a bare uniform string (`"permission": "allow"`) applying to all tools, but the schema typed it as object-only. Widen OpencodePermissionsConfigSchema to a string|record union and map the uniform string into the canonical model as the wildcard tool/glob `{ "*": { "*": value } }`, matching OpenCode's own `*` all-tools convention. The object forms remain fully backward compatible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Follow-up for OpenCode upstream (#2066). Two schema-widening bug fixes so rulesync accepts the documented string forms instead of throwing or rejecting valid config.
Part 1 — skills compatibility string|object
OpenCode SKILL.md documents
compatibility: opencode(a bare string), but the schema was object-only, so importing such a skill threw. Widened OpenCodeSkillFrontmatterSchema.compatibility to a string|looseObject union and propagated it through fromRulesyncSkill/toRulesyncSkill and the opencode section of rulesync-skill.ts.Part 2 — permissions top-level uniform string
OpenCode documents a bare top-level string applying to all tools (permission: allow), but the top-level field was object-only. Widened to enum(allow,ask,deny) | record; a top-level string maps to the canonical model as { "": { "": value } }, mirroring OpenCode own "*"-as-all-tools convention (no meaningful lossiness; round-trips to the equivalent verbose object form).
Backward compatibility with the existing object forms is preserved.
Tests
Verification
pnpm cicheck fully green: 298 test files, 6622 tests; lint/typecheck, cspell, secretlint, supported-tools, gitignore all pass.
References
Closes #2066