Repository navigation
fix(skills): media-use resolve shim runs only the CLI it is handed - #8674
Conversation
jrusso1020
left a comment
There was a problem hiding this comment.
Approving at 59b8046a.
resolve.mjsnow has one path,resolveNpxInvocation(["hyperframes", "media-use", "resolve", ...]). With no absoluteHYPERFRAMES_CLI_ENTRYit stops with the launcher hint. It never runs apackages/clifound three folders up, and never falls back tobun.- Nothing in the repo depended on the checkout shortcut:
- The CLI build (
packages/cli/scripts/build-copy.mjs:171) replaces this shim with the real engine indist/skills/media-use/scripts/resolve.mjs, sohyperframes media-use resolveis unchanged. commands/media-use.tsalready setsHYPERFRAMES_CLI_ENTRY.- The plugin launcher sets it too (
plugin-cli.mjs:149). - No CI step or contributor doc runs the shim directly.
- The CLI build (
- Fails without the fix: confirmed. With the
origin/mainresolve.mjsswapped in, "a project-scope install never runs a CLI planted beside its skills folder" fails, and the other two tests pass. At head, 3/3 pass.
Review by Rames
…nded-cli # Conflicts: # skills-manifest.json
jrusso1020
left a comment
There was a problem hiding this comment.
Re-approving at 5ce6942c. This is the head I approved, 59b8046a, with main merged in.
I compared this PR's own changes against main before and after the merge (main...59b8046a against 02636023...5ce6942c). resolve.mjs and resolve-plugin.test.mjs are unchanged. The only difference is the regenerated media-use hash in skills-manifest.json, which CI's skills-manifest job checks.
…nded-cli # Conflicts: # skills-manifest.json
jrusso1020
left a comment
There was a problem hiding this comment.
Re-review at c95db4bf6e1141e2a1a6777906ef186cb29b9f2d, a merge of main into 5ce6942c27, which I approved earlier.
The PR's own patch against its merge base is identical between the two heads: the same 3 files, +60/-52. The only differing line is the regenerated skills-manifest.json hash for media-use, which the merge requires. resolve.mjs and resolve-plugin.test.mjs are unchanged, so my earlier review still holds.
Need: yes · Size: ok · Reuse: nothing new · Simpler: already minimal · Structure: fine (merge only; no split)
Risk: low — a merge of main plus a regenerated manifest hash
— Rames
What
skills/media-use/scripts/resolve.mjs(the legacy resolve shim) now starts only the HyperFrames CLI it is handed: the one the plugin launcher passes inHYPERFRAMES_CLI_ENTRY, or one the person sets there as an absolute path. Without one it stops with the launcher hint, throughlib/npx-sync.mjs'sresolveNpxInvocation, the same rule the other media-use helpers follow. It no longer runspackages/cli/dist/cli.js(orbun packages/cli/src/cli.ts) from three folders above itself.Why
When
HYPERFRAMES_PLUGIN_VERSIONwas unset, the shim treated the folder three levels up as a HyperFrames checkout and ran the CLI it found there. In a project-scope skills install (<project>/.agents/skills,.claude/skillsorskills), that folder is the project, so apackages/cli/dist/cli.jsthat came with the project ran with the person's environment. The skill docs already say helpers never look the CLI up in the project (skills/media-use/references/audio.md); the shim was the one place that still did.Related work
Follows the rule set in #7552 for the plugin launcher and the other helpers.
How
The shim's two branches become one: always
resolveNpxInvocation(["hyperframes", "media-use", "resolve", ...]). An installed copy and a repo checkout can't be told apart from their files, so the checkout shortcut goes too. A contributor running the shim from a checkout setsHYPERFRAMES_CLI_ENTRYto their built CLI, as the error message says. The test that pinned the checkout shortcut ("helper package override keeps a contributor's local CLI") is replaced by the test below.Test plan
New test in
skills/media-use/scripts/resolve-plugin.test.mjs: the shim copied to<project>/.agents/skills/media-use/scripts, with planted CLIs at<project>/.agents/packages/cli/dist/cli.jsandsrc/cli.tsand abunon PATH that leaves a mark. With no CLI handed over, the shim exits 1 with the launcher hint, with and withoutdist/cli.js, and nothing planted runs. WithHYPERFRAMES_CLI_ENTRYset, that CLI runs and the planted ones still don't. 3 runs in a row green on Linux, with the two existing tests in the file.fails without the fix:
skills/media-use/scripts/resolve-plugin.test.mjs"a project-scope install never runs a CLI planted beside its skills folder" fails with the oldresolve.mjs.skills-manifest.jsonregenerated for the media-use change.Not exercised: the path through
plugin-cli.mjs --script; the launcher already setsHYPERFRAMES_CLI_ENTRY, which the existing test "plugin resolver runs the CLI the launcher handed over, not npx in the project" covers. Not run on Windows (the file's tests skip there).