Keep refreshing opencode's other spelling

Merged
JE
4mo ago
+60-6

#624's central claim was wrong, and I shipped it. This corrects the record and the regression it introduced.

What #624 said

opencode reads skills/, plural — it has never read either path we wrote.

What opencode actually does

From the shipped 1.18.4 binary's own docs table — not the docs site:

| Global skills  | `~/.config/opencode/skill(s)/<name>/SKILL.md` |
| Project skills | `.opencode/skill(s)/<name>/SKILL.md`          |
| Project agents | `.opencode/agent/<name>.md` or `.opencode/agents/<name>.md` |

skill(s) — the same optional plural opencode uses for agent(s) and command(s). Both spellings work. The singular paths were fine.

I asserted that negative from a summarizing fetch of https://opencode.ai/docs/skills/, which rendered the parenthetical as plain skills. A negative claim deserved a primary source, and the binary was available the whole time.

The regression

skillLocations is both the wizard's install targets and the refresh set. #624 moved it wholly to plural, so anyone who picked OpenCode in basecamp skill before #624 now has a file that:

  • opencode still loads — it works
  • the refresh loop no longer visits — it never updates again

Working and silently frozen at the version that installed it. That is worse than broken, because nothing reports it, and it is the exact failure mode #624 claimed to be fixing.

The fix

Separate the two roles the list was playing:

  • skillLocations — wizard install targets. Unchanged, still plural.
  • legacySkillLocations — paths an agent still reads that we no longer suggest. Refreshed, never offered.

refreshAllInstalledSkills walks both. Refresh updates in place and does not create the new path, so nobody ends up with two copies drifting apart — asserted in the test.

Verification

TestRefreshAllInstalledSkills_LegacyOpenCodePath fails against the pre-fix loop:

-- API coverage: See API-COVERAGE.md in the CLI repo
+old
a pre-#624 opencode install must keep getting refreshed

and passes after it. bin/ci green (EXIT=0).

What from #624 still holds

  • ~/.agents/skills/<name>/SKILL.md is auto-loaded by opencode — confirmed in the same table — so the skill has always worked there regardless of the wizard. That claim was right.
  • Plural install targets are valid, so the new default is fine; this is additive.
  • Pinning path literals in a test rather than deriving them was right, and that test's comment is corrected here too.

#617 gets a correction as well, since I told the requester the wizard was broken for them.


Summary by cubic

Restores refresh for OpenCode skills installed at the singular skill path so pre-#624 installs keep updating. Keeps plural install targets and updates legacy installs in place without creating duplicates.

  • Bug Fixes
    • Added legacySkillLocations for OpenCode skill paths (global and project).
    • refreshAllInstalledSkills now walks both install and legacy paths; no new files are created.
    • Confirmed OpenCode accepts skill(s); added regression test to ensure legacy paths keep refreshing.