Skip to content

fix(skills): media-use resolve shim runs only the CLI it is handed - #8674

Merged
miguel-heygen merged 3 commits into
mainfrom
fix/media-use-shim-handed-cli
Nov 24, 2026
Merged

miguel-heygen merged 3 commits into
mainfrom
fix/media-use-shim-handed-cli

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

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 in HYPERFRAMES_CLI_ENTRY, or one the person sets there as an absolute path. Without one it stops with the launcher hint, through lib/npx-sync.mjs's resolveNpxInvocation, the same rule the other media-use helpers follow. It no longer runs packages/cli/dist/cli.js (or bun packages/cli/src/cli.ts) from three folders above itself.

Why

When HYPERFRAMES_PLUGIN_VERSION was 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/skills or skills), that folder is the project, so a packages/cli/dist/cli.js that 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 sets HYPERFRAMES_CLI_ENTRY to 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

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

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.js and src/cli.ts and a bun on PATH that leaves a mark. With no CLI handed over, the shim exits 1 with the launcher hint, with and without dist/cli.js, and nothing planted runs. With HYPERFRAMES_CLI_ENTRY set, 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 old resolve.mjs.

skills-manifest.json regenerated for the media-use change.

Not exercised: the path through plugin-cli.mjs --script; the launcher already sets HYPERFRAMES_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).

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 59b8046a.

  • resolve.mjs now has one path, resolveNpxInvocation(["hyperframes", "media-use", "resolve", ...]). With no absolute HYPERFRAMES_CLI_ENTRY it stops with the launcher hint. It never runs a packages/cli found three folders up, and never falls back to bun.
  • 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 in dist/skills/media-use/scripts/resolve.mjs, so hyperframes media-use resolve is unchanged.
    • commands/media-use.ts already sets HYPERFRAMES_CLI_ENTRY.
    • The plugin launcher sets it too (plugin-cli.mjs:149).
    • No CI step or contributor doc runs the shim directly.
  • Fails without the fix: confirmed. With the origin/main resolve.mjs swapped 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

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 24, 2026
…nded-cli

# Conflicts:
#	skills-manifest.json

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 24, 2026
…nded-cli

# Conflicts:
#	skills-manifest.json

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 24, 2026
Merged via the queue into main with commit df909c6 Nov 24, 2026
63 checks passed
@miguel-heygen
miguel-heygen deleted the fix/media-use-shim-handed-cli branch November 24, 2026 16:48
@miguel-heygen miguel-heygen mentioned this pull request Nov 24, 2026
3 of 4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants