* feat(media-use): color grading — grade/lut resolve, smart-grade, grade-compare CLI Add color grading to media-use as first-class resolve types plus a faithful comparison command. All local, offline, deterministic — no model, no GPU. - resolve -t grade / -t lut: produce a data-color-grading block (or a frozen .cube). Look cascade: core preset (no file) -> bundled .cube library -> parametric buildCube. Emitted .cube is Rec.709 and validated against core's colorLuts constraints (LUT_3D_SIZE <= 64) before it is frozen. - smart grade (grade --for <media>): ffmpeg signalstats -> adjust suggestion (exposure / contrast / white balance), surfaced with the measured evidence on stderr as a starting point; never auto-applied. - hyperframes grade-compare: renders N candidate grades onto a reference frame through the real runtime shader into one labeled comparison PNG, so an agent picks a look without opening Studio. Prepends an "original" baseline cell by default (--no-baseline to omit). Shares the headless-capture pipeline with snapshot via capture/captureCompositionFrame. - media-use SKILL: proactive "media opportunity pass" guidance (grounded signal -> offer, ask once, surface don't mutate). Verified: media-use 116/116, grade-compare 7/7, snapshot 9/9, lint + format clean, full build green, comparison renders end to end. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * test(cli): narrow grade-compare baseline assertion off unknown-typed grading Assert the whole cell via toEqual instead of reaching into .grading.preset / .grading.lut on the unknown-typed field, keeping the test typecheck-clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * feat(media-use): agent-authored LUTs via --params + validate --from cube; never-read-.cube guardrail - resolve -t lut / -t grade --params '<json>': build a parametric .cube from explicit params (bypassing the intent cascade), validate, and freeze in one step. --intent becomes the optional description. Lets an agent commit a look it computed itself. - --from <file.cube> now validates the ingested LUT for lut/grade types and rejects an invalid/oversized cube (no partial write) — the escape hatch for a LUT the agent generated with its own code. - SKILL.md: hard rule to never read a .cube body into context (~size^3 lines, zero legible signal) — inspect via grade-compare (see it) or cube-validate (ok/size), read the manifest description for meaning; plus both authoring paths and the parametric-vs-film-stock ceiling note. Verified: media-use 116/116, lint + format clean; smokes — --params builds a valid frozen cube, grade --params returns a lut block, bad JSON and an oversized --from cube are both rejected with no stray file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * fix(cli): grade-compare validates referenced LUTs, warns on no-op cells, caps candidates Bug-bash follow-ups — grade-compare silently accepted bad input: - Validate LUT *content*, not just existence: each referenced .cube is parsed with core's parseCubeLut (now exported from @hyperframes/core) and rejected with a per-cell error ("LUT for \"<label>\" is not a valid .cube: ..."). A file that exists but isn't a valid cube no longer renders a silent no-op cell. - Warn on inactive cells: a grading that normalizes to inactive (e.g. a malformed {lut:12345}) emits a stderr warning naming the cell; the auto-prepended "original" baseline is intentionally inactive and stays silent. stdout remains valid JSON. - Cap candidates at 16 (excluding baseline): over-cap input renders the first N and reports {truncated:true, total:M} on stdout + a stderr note — no silent drop, no unbounded giant sheet. Verified: grade-compare 10/10; non-cube LUT → clear error; {lut:12345} → warning + ok; 20 cells → cells=17 truncated total=20; valid runs unchanged. Lint/format clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * feat(cli): general `hyperframes compare` visual-variant primitive Generalize grade-compare's "render N variants → one labeled sheet → the agent looks and picks" loop into a standalone command that works on ANY variation (font, layout, motion, grade, whole compositions) — the tool never needs to know what differs. - `hyperframes compare <path...> [--at <sec>] [--labels a,b,c] [--out] [--cols] [--json]`: renders each agent-authored composition variant through the real runtime (captureCompositionFrame) and stitches one labeled comparison sheet + JSON ({ok, sheet, rendered, variants, truncated?/total?}). 2+ paths required; caps at 16 with loud truncation. It presents, it does not judge — choosing is the caller's job. - Factored the shared "render a labeled set → contact sheet" path so compare, grade-compare, and snapshot all sit on it (no duplication). grade-compare is now the first color-specific specialization of this primitive. - New pathArgs util + contactSheet test; hyperframes-cli SKILL documents compare as the agent's "see your own renders and choose" primitive. Verified: 26/26 across compare + grade-compare + snapshot + contactSheet (no regressions); compare renders 3 variants into one visibly-distinct labeled sheet; 2+-path error path clean; lint/format clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * fix(ci): green the skills CI — skip ffmpeg tests when absent, oxfmt markdown The "Test: skills" CI job runs bare `node --test` with no ffmpeg on PATH (by design — skills tests are meant to be node-builtin-only). The grade-analyzer + smart-grade tests shell to ffmpeg and were failing there with ENOENT. Guard them to skip when ffmpeg isn't on PATH; they still run locally / where it is. Also oxfmt README.md + hyperframes/media-use SKILL.md (the whole-repo `oxfmt --check .` Format job caught markdown left unformatted by the rebase conflict resolution). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * fix(ci): skip core-conformance test when tsx is unavailable The "Test: skills" CI job installs no deps, so the normalizeHfColorGrading conformance test (which imports core's TS via `node --import tsx`) failed there. Guard it to skip when tsx can't resolve; runs locally / in the deps-installed Test job. Completes the skills-CI greening (the ffmpeg guards handled the rest). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * fix(cli): escape grade-compare src double-quotes (CodeQL XSS) + Windows-safe compare test - grade-compare built `<img src="...">` (double-quoted) with the single-quote escaper, leaving `"` unescaped — a `"` in the frame path could break out (CodeQL: incomplete HTML attribute sanitization). Use escapeXml for src. - compare label test hard-coded POSIX paths that can't match on Windows; assert the derived labels (the subject); path resolution is covered elsewhere. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * refactor(media-use): generate LUT library from params (drop committed .cube files) The 3 bundled .cube files were 733 lines each (2,199 total) and were themselves buildCube output — pure repo bloat. Replace with compact per-look params in luts/index.json, generated on resolve; add an optional `url` for future scanned LUTs to be CDN-hosted + downloaded on demand (freezeUrl) instead of committed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * feat(media-use): serve library LUTs from CDN on-demand (static.heygen.ai/luts), params fallback Looks now carry a CDN `url` (hosted at s3://heygen-public/luts → static.heygen.ai/luts/<id>.cube); resolve downloads + validates + freezes on demand, like bgm/image. `params` stays as the deterministic offline fallback (--local-only, or if the download fails), so resolution is never blocked on the network. Provider prefers url, falls back to params. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv * fix(media-use): address #2041 review — atomic LUT writes, compare telemetry, follow-ups - Atomic .cube writes: library provider (url + params) and the parametric generator now write to a .tmp path, validate, then rename, so a crash can never orphan an invalid .cube at the final path (was validate-after-write). - track("media_use_resolve") now emits provenance.via (url/params-fallback/params). - grade-compare + compare: --timeout flag (was hardcoded 5000) and a media_use_compare event (cells, truncated, total, render_ready_timed_out); openSettledCompositionPage now surfaces the render-ready timeout. - compare staging skips node_modules/.git; --for gets an upfront existence check. - Rec.709 luma comment; HYPERFRAMES_ANALYZE_TIMEOUT_MS override; measured note uses basename; LUT s3 hosting moved from index.json into luts/README.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H5k87mPZ4d6yiFwcWSb8Vv --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
12 KiB
name, description
| name | description |
|---|---|
| hyperframes-cli | HyperFrames CLI dev loop. Use when running npx hyperframes init, add, catalog, capture, lint, validate, inspect, layout, snapshot, compare, grade-compare, preview, play, render, publish, feedback, lambda, doctor, browser, info, upgrade, skills, compositions, docs, benchmark, telemetry, transcribe, tts, or remove-background, or when troubleshooting the HyperFrames build/render environment. Entry point for AWS Lambda cloud rendering (`hyperframes lambda deploy / render / progress / destroy / policies / sites`). |
HyperFrames CLI
Everything runs through npx hyperframes unless project instructions specify a local wrapper. Obey the local wrapper exactly. Requires Node.js >= 22 and FFmpeg.
Workflow
- Scaffold —
npx hyperframes init my-video(orcapturefrom a URL).initalso checks the installed skills against the latest on GitHub and updates the global set if any are out of date. The--skip-skillsflag is currently neutered (temporary, while the skills.sh registry catches up), so everyinitruns this check and pulls our latest skills regardless. - Write — author HTML composition (see the
hyperframes-coreskill) - Lint —
npx hyperframes lint - Validate —
npx hyperframes validate(runtime errors + contrast) - Visual inspect —
npx hyperframes inspect - Preview / edit —
npx hyperframes previewopens Studio, the timeline editor where the user can manually edit anything (not just watch). Review there, then ask before rendering. - Render — pick the variant:
- Iterate:
npx hyperframes render --quality draft - Deliver:
npx hyperframes render --quality high --output out.mp4 - CI / cross-host repro:
npx hyperframes render --docker --strict --output out.mp4 - Cloud (long / large):
npx hyperframes lambda render ./my-project --width 1920 --height 1080 --wait(see Lambda below)
- Iterate:
- Report feedback — after verifying the output,
npx hyperframes feedback --rating <1-5> --comment "..."once per task (see Agent Conventions).
Run lint, validate, and inspect before preview. lint catches missing data-composition-id, overlapping tracks, and unregistered timelines. validate loads the composition in headless Chrome and reports runtime console errors plus WCAG contrast issues. inspect seeks through the timeline and reports text spilling out of bubbles/containers or off the canvas — and, when a *.motion.json sidecar is present, verifies motion intent (entrances firing under seek, stagger order, in-frame, liveness) against that same seeked timeline.
For motion-heavy work, prefer snapshot-driven iteration and a *.motion.json sidecar — see references/lint-validate-inspect.md for the discipline and motion-verification spec. To compare agent-authored candidate variants, use npx hyperframes compare <path...> [--at <sec>] [--labels a,b,c] [--out compare.png] [--cols n] [--json] to render each composition through its own runtime, assemble one labeled sheet, inspect it side by side, and choose. For color-grade selection, use the color-specific sibling npx hyperframes grade-compare --for <frame> --grades grades.json (or --luts a.cube,b.cube) to render every grading candidate through the real WebGL grading runtime into one labeled PNG before choosing the winner.
Agent Conventions
Cross-cutting rules that hold for every command:
--jsonis available on every command exceptrender,preview, andplayserver modes. Use it for any agent / CI invocation of the supported commands; output includes a_metaenvelope (cli version, latest available, update advice).renderreports status via stdout + exit code only — verify success with the post-render check below.preview --selection --jsonandpreview --context --jsonare the preview exceptions: they do not start a server, they query the user's running Studio session and exit.doctor --jsonalways exits 0, even when the environment is broken. Gate on the payload'sokfield:npx hyperframes doctor --json | jq -e '.ok' > /dev/null. This insulates pipelines from CLI release churn.- Non-TTY mode is auto-detected. When
stdoutis not a TTY (CI, agents, piped output) the CLI auto-switches to non-interactive;initthen requires--example. Pass--non-interactiveto force this mode even on a TTY. - CI gating on render:
--strictfails on lint errors,--strict-allfails on warnings too,--strict-variablesfails on undeclared--variableskeys. - Paths in
--jsonare redacted —$HOMEbecomes the literal$HOMEso output is safe to paste into bug reports and agent contexts. - Render is user-gated. Never auto-render once the checks pass. Pause at
preview, tell the user the video is editable in Studio, and render only after they approve. - Use Studio context for user-directed edits. When the user says "this selected element", "the thing I clicked", "current selection", or similar, ask them to select it in Studio, then run
npx hyperframes preview --context --json --context-fields selection. Use the returnedselection.target.hfId/selector,selection.sourceFile,selection.currentTime, andselection.thumbnailUrlto anchor the edit. Ifselectionisnullanderrors.selection.codeisno-selection, ask the user to click the element and rerun; do not guess from screenshots. - Keep Studio context compact.
preview --context --jsonreturns compact selection by default. Add--context-fields selection,--context-fields selection,lint, or--context-fields lintto avoid bloating agent context. Use--context-detail fullonly when you need heavy fields like computed styles, inline styles, or text-field metadata. - Post-render verification. After
renderreturns exit 0, confirm the output file exists and has plausible size before reporting success:[ -s "$OUTPUT" ] || echo "render produced no output". The CLI prints◇ <path>on success; for long renders also sanity-check duration withffprobe -i "$OUTPUT" -show_format -v error. - Report feedback after a successful render. Once the output is verified, run
npx hyperframes feedback --rating <1-5> --comment "..."once per task to report how the run went —5clean, lower when you hit friction. Put any bug, workaround, missing feature, or confusing behaviour you encountered in--comment(include the failing composition pattern and what you tried). This is the project's primary signal channel; renders that go silent leave the maintainers blind. Skip only when telemetry is disabled or the user opted out.
Routing
| Want to… | Read |
|---|---|
Scaffold a project (init, capture, skills) |
references/init-and-scaffold.md |
Check correctness (lint, validate, inspect, snapshot) |
references/lint-validate-inspect.md |
Preview or render (preview, play, render, publish) |
references/preview-render.md |
Diagnose the environment (doctor, browser) |
references/doctor-browser.md |
Cloud render on AWS Lambda (lambda deploy / sites / render / progress / destroy / policies) |
references/lambda.md |
Everything else (info, upgrade, compositions, docs, benchmark, telemetry, asset preprocessing) |
references/upgrade-info-misc.md |
Cross-Skill Hand-Offs
- Tailwind projects (
init --tailwind) → usehyperframes-core(Tailwind reference) before editing classes or theme tokens. - Registry blocks/components (
hyperframes add,hyperframes catalog) → usehyperframes-registryfor install paths, sub-composition wiring, and snippet merging. - Asset preprocessing (
tts,transcribe,remove-background) → usemedia-usefor voice selection, Whisper model rules, captions, and TTS-to-captions chain. - Parametrized renders (
--variables) → declared viadata-composition-variableson<html>; seehyperframes-corefor the full schema.
Lambda (Cloud Rendering)
hyperframes lambda deploys distributed rendering to AWS Lambda and drives renders from your laptop or CI. End-to-end is three commands:
npx hyperframes lambda deploy # provision SAM stack (Lambda + Step Functions + S3)
npx hyperframes lambda render ./my-project --width 1920 --height 1080 --wait
npx hyperframes lambda destroy # tear down (S3 bucket is retained)
Use Lambda when a render is too long / too large for one host (multi-minute videos, 4K, large parallel batches) and you have AWS credentials configured. For dev-loop iteration stay on local render.
See references/lambda.md for prerequisites, all 6 subcommands (deploy, sites create, render, progress, destroy, policies), IAM policy validation, state files, and cost / cleanup rules.
Minimum Completion Gate
Static gates
npx hyperframes lint
npx hyperframes validate
Add inspect for layout-sensitive work and render --strict in CI to fail on lint errors.
Visual smoke test — required when the project uses sub-compositions
lint / validate / inspect evaluate each composition in isolation. They never load index.html and mount sub-compositions via data-composition-src, so they cannot catch cross-file mount failures (see hyperframes-core → references/sub-compositions.md, "Common pitfalls"). The only gate that catches them is one that actually loads index.html and seeks the timeline.
Use hyperframes snapshot — it loads the project the same way render does (so it exercises the same mount path) but only captures the timestamps you request, so it's seconds instead of a full render:
# Capture one frame at the midpoint of every sub-composition.
# Midpoints = data-start + data-duration/2 for each host slot in index.html.
npx hyperframes snapshot --at <t1>,<t2>,<t3>,...
# Or, if you don't need per-scene targeting, an evenly-spaced sample:
npx hyperframes snapshot --frames 9
Output lands in snapshots/frame-NN-at-Xs.png. Eyeball each frame against the scene plan.
Per-frame red flags (each maps to a specific failure mode the static gates miss):
| What you see | Root cause |
|---|---|
| Text shows up tiny + unstyled in the top-left corner | <style> block left in <head> outside <template> (Pitfall 1) — no CSS reached live DOM |
| SVG/icon elements blown up to canvas-size | Same as above — no width/height constraints applied |
| Hero element of the scene is missing entirely; only background + watermark visible | Host-id ≠ template id (Pitfall 2) — timeline never ran, frame captured at initial state |
Snapshot command logs Sub-composition timelines not registered after 45000ms |
Pitfall 2 — direct confirmation |
snapshots/ can be deleted after eyeballing; the user-facing final render is a separate pass with npx hyperframes render.