fix(config): support legacy skills array#22120
Open
kobecai wants to merge 2 commits intoanomalyco:devfrom
Open
fix(config): support legacy skills array#22120kobecai wants to merge 2 commits intoanomalyco:devfrom
kobecai wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
22120
…On Sun, 12 Apr Reiwa 8 at 11:55 AM kobecai ***@***.***> wrote:
Issue for this PR
Closes #22040 <#22040>
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
This fixes startup/config validation when opencode.json contains the
older skills array format.
Before this change, a config like:
{
"skills": [
{
"name": "test",
"description": "Test skill",
"command": "echo test"
}
]
}would fail with Invalid input: expected object, received array.I changed config parsing so skills accepts both the current object format (paths / urls) and the legacy inline array format. I also updated skill loadingso legacy inline entries are still loaded into the skill registry instead of only avoiding the validation error.
This should fix the reported issue because the failure was happening at config schema validation time, and after that the legacy entries still need to besurfaced as skills to preserve behavior.
### How did you verify your code works?
Ran these locally from packages/opencode:
bun test test/config/config.test.ts test/skill/skill.test.tsbun typecheck
I also reproduced the issue first with a minimal opencode.json using the legacy skills array and confirmed it failed before the change.
### Screenshots / recordings
N/A
### Checklist
- [x] I have tested my changes locally- [x] I have not included unrelated changes in this PR
------------------------------
You can view, comment on, or merge this pull request online at:
#22120
Commit Summary
- 1d68eec
<1d68eec>
fix(config): support legacy skills array
File Changes
(4 files <https://github.com/anomalyco/opencode/pull/22120/files>)
- *M* packages/opencode/src/config/config.ts
<https://github.com/anomalyco/opencode/pull/22120/files#diff-2ca52542d251bb69bf981f39dd51de9943a6c2cb4ee53d7799c83bbf322a0891>
(16)
- *M* packages/opencode/src/skill/index.ts
<https://github.com/anomalyco/opencode/pull/22120/files#diff-d0625ce1f1950542a87fb814cc72ccf58a3ed3a5689621f685149fdc4545b608>
(55)
- *M* packages/opencode/test/config/config.test.ts
<https://github.com/anomalyco/opencode/pull/22120/files#diff-24f7bef0388f1a47d5b39089467e8f15077d65cbfcb18f48aaaba5b11e409b4b>
(35)
- *M* packages/opencode/test/skill/skill.test.ts
<https://github.com/anomalyco/opencode/pull/22120/files#diff-f8486852cfc6f89192e4ee0d9aca3ea06005b47ef80aa5d3ecd0f4247b1a1e38>
(33)
Patch Links:
- https://github.com/anomalyco/opencode/pull/22120.patch
- https://github.com/anomalyco/opencode/pull/22120.diff
—
Reply to this email directly, view it on GitHub
<#22120>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/B3JG3S5MOPCLHYLEYOAAWNT4VM4X7AVCNFSM6AAAAACXVQHPICVHI2DSMVQWIX3LMV43ASLTON2WKOZUGI2DMOJTHAYDKNQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
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.
Issue for this PR
Closes #22040
Type of change
What does this PR do?
This fixes startup/config validation when
opencode.jsoncontains the olderskillsarray format.Before this change, a config like:
{ "skills": [ { "name": "test", "description": "Test skill", "command": "echo test" } ] } would fail with Invalid input: expected object, received array. I changed config parsing so skills accepts both the current object format (paths / urls) and the legacy inline array format. I also updated skill loading so legacy inline entries are still loaded into the skill registry instead of only avoiding the validation error. This should fix the reported issue because the failure was happening at config schema validation time, and after that the legacy entries still need to be surfaced as skills to preserve behavior. ### How did you verify your code works? Ran these locally from packages/opencode: bun test test/config/config.test.ts test/skill/skill.test.ts bun typecheck I also reproduced the issue first with a minimal opencode.json using the legacy skills array and confirmed it failed before the change. ### Screenshots / recordings N/A ### Checklist - [x] I have tested my changes locally - [x] I have not included unrelated changes in this PR