Skip to content

fix(media-use): carve with the CLI's own analysis, never a project's core - #7887

Closed
michaelwang11394 wants to merge 2 commits into
mainfrom
fix-carve-from-cli
Closed

michaelwang11394 wants to merge 2 commits into
mainfrom
fix-carve-from-cli

Conversation

@michaelwang11394

Copy link
Copy Markdown
Contributor

What

The voiceover carve now runs as a CLI command, hyperframes media-use carve, and never loads @hyperframes/core from the project.

  • New command. hyperframes media-use carve --comp index.html hands the skill's carve.mjs the audio-carve and audio-fx modules the CLI bundles, and the CLI's trusted FFmpeg. The flags are unchanged: --bed, --voice (repeatable), --strength and --dry-run.
  • Direct runs. node carve.mjs without --core now stops with a message that names the CLI command. With --core <dir>, it still loads a core the person installed there. It no longer resolves one from the composition's folder.
  • Docs. references/mixing.md, docs/reference/audio-effects.mdx and the media-use section of docs/packages/cli.mdx use the command. The skill no longer tells the agent to install @hyperframes/core into the project.

Why

carve.mjs anchored createRequire at the composition's folder and imported @hyperframes/core from whatever node_modules that found. In a project someone else made, that is the project's own code, run with the person's account. The CLI already bundles core, so it can hand the same analysis to the script instead.

Related work

Refs #7552, which made the other media helpers run the CLI their caller hands over instead of looking one up in the project.

How

  • carve.mjs keeps its logic. main() becomes carveComposition(argv, core, ffmpeg), so both the CLI and a direct run call the same function.
  • The CLI imports the copy of carve.mjs it ships under dist/skills/media-use/ (the build already copies that tree), or the repo's copy in a source checkout. Neither is in the project.
  • decode() now takes the FFmpeg path. The CLI passes findFFmpeg(), its trusted lookup; a direct run keeps ffmpeg from PATH as before.

What I measured

  • A temp project with package.json, music.wav, narration.wav, an index.html naming both, and a planted node_modules/@hyperframes/core whose index.js writes a marker file:
    • main's carve.mjs --comp index.html --dry-run wrote the marker: the project's core ran.
    • The built CLI's media-use carve --comp index.html printed the bed, the voice, 6 bands and a 60-point level envelope, wrote the carve onto music-bed, and the marker was never written.
    • This branch's carve.mjs --comp index.html without --core exits 1 with the message naming the CLI command, and the marker was never written.
  • skills/media-use/audio/scripts/carve.test.mjs: 21 passed. fails without the fix: the new test plants a core in the project and runs the script directly; on main the planted core runs.
  • src/commands/media-use/carve.test.ts and the other media-use command tests: 16 passed.
  • tsc --noEmit for the CLI, oxlint, check-docs-cli-commands.mjs, check-core-skills.mjs and the comment ratchet pass.
  • Locally, 3 tests in history.test.ts and lambda/deploy.test.ts fail with lock and timing errors. Those files do not touch this change; CI runs them on a clean machine.

What I did NOT exercise

  • Windows. The command uses the same FFmpeg lookup as the other CLI commands.
  • Studio's carve panel, which this does not change.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

…@hyperframes/core

hyperframes media-use carve hands carve.mjs the audio-carve and audio-fx modules the CLI
bundles, and its trusted FFmpeg. Run directly, carve.mjs needs --core naming a core the person
installed; it no longer resolves one from the composition's folder.
@mintlify

mintlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 16, 2026, 12:50 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@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.

Reviewed at 61079a0830624b0251b2bce396aacf954739ae25.

The CLI supplies its own imported audio-carve/audio-fx implementations and trusted FFmpeg path to the skill runner. Direct script use now refuses to discover core through the project; explicit --core remains an intentional caller choice. The packaged/source script-path fallback and build-copy integration agree.

Validation: Node 24 carve script suite: 21 passed. CLI vitest run src/commands/media-use --maxWorkers=2: 16 passed after building workspace dependencies. Independent source review found no blocker. I did not run a model or a full packaged media conversion.

Nit: update the stale project-anchored wording in carve.mjs's core-loading comment to describe the new explicit-core contract.

Need: yes · Size: ok · Reuse: CLI core imports and trusted FFmpeg resolver · Simpler: already minimal · Structure: fine (checked media-use dispatch and script packaging; no split)
Risk: low — removes implicit project module execution while preserving the existing carving implementation.

Verdict: APPROVE
Reasoning: The CLI uses trusted analysis code and the standalone script fails closed without an explicit core implementation.

— Review by Rames

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 16, 2026
@michaelwang11394
michaelwang11394 removed this pull request from the merge queue due to a manual request Nov 16, 2026
@michaelwang11394

Copy link
Copy Markdown
Contributor Author

Taking this out of the merge queue. #7893 fixes the same carve problem, and its owner wrote it, so that one should land. Both change carve.mjs, so only one can merge. I'll close this PR once #7893 merges. If you'd rather have the CLI-command approach here instead, say so and I'll queue it again.

@michaelwang11394

Copy link
Copy Markdown
Contributor Author

Closing this as superseded. #7926 (merged) fixed the same problem on main: carve.mjs now imports a bundled copy of core's carve and audio-fx functions, so it never loads @hyperframes/core from a project. #7893 (merged) then added the missing analyseCarveDynamics export so carve runs again. SECOPS-1292 is Done and finding find_01PpDYu59CXbaL9rDD2sKnUM is resolved as fixed. Thanks for the review, Rames.

This branch was successfully deployed

1 active deployment
staging - docs — 61079a08 Deployed Nov 16, 2026 by mintlify[bot]
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