refactor(skill): SKILL.md-relative path resolver, drop Codex native plugin

STEP 0 (CANONICAL PATH SELF-CHECK) used to force any SKILL.md load that wasn't
under $HOME/.claude/plugins/cache/last30days-skill/last30days/{version}/ to
re-Read from there. That guard is Claude-Code-specific (defends against the
marketplaces/ stale-clone bug) and broke under non-Claude installers like
`npx skills add`, ~/.codex/skills/, and ~/.agents/skills/.

The new STEP 0 narrows the check to its actual target: fire only when the
loaded SKILL.md path contains /.claude/plugins/marketplaces/. Every other
install path is trusted. The 2026-04-22 incident workaround is preserved
without breaking other harnesses.

Step 1 SKILL_ROOT resolver collapses the Codex-first / Claude-fallback /
CWD-fallback chain into a single precedence walk: Claude plugin cache
(versioned) first, then ~/.codex/skills, ~/.agents/skills, repo checkout,
./.skills/last30days (npx skills install dir), CWD, and GEMINI_EXTENSION_DIR.

Also drops Codex native plugin support: .codex-plugin/plugin.json is deleted,
the badge VERSION jq fallback in line 108 stops looking at it, and render.py's
_skill_version no longer scans for it. Codex users install via `npx skills add`
or the per-harness skill dir going forward.

render.py::_skill_version gains a SKILL.md frontmatter fallback so the badge
no longer emits `v?` on install dirs that sync.sh populates (which don't
include .claude-plugin/plugin.json).
This commit is contained in:
Trevin Chow
2026-05-15 20:22:00 -07:00
parent 54db014c7c
commit c913e1cf89
4 changed files with 54 additions and 96 deletions
-9
View File
@@ -22,20 +22,11 @@ def _skill_version() -> str:
class TestPluginContract(unittest.TestCase):
def test_codex_manifest_points_at_skills_tree(self) -> None:
manifest = _json(ROOT / ".codex-plugin" / "plugin.json")
self.assertEqual("last30days", manifest["name"])
self.assertEqual("./skills/", manifest["skills"])
self.assertTrue(SKILL_ROOT.joinpath("SKILL.md").is_file())
self.assertTrue(SKILL_ROOT.joinpath("scripts", "last30days.py").is_file())
def test_versions_match_across_manifests(self) -> None:
pyproject = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))
version = pyproject["project"]["version"]
self.assertEqual(version, _skill_version())
self.assertEqual(version, _json(ROOT / ".codex-plugin" / "plugin.json")["version"])
self.assertEqual(version, _json(ROOT / ".claude-plugin" / "plugin.json")["version"])
marketplace = _json(ROOT / ".claude-plugin" / "marketplace.json")