hyperframes 0.6.97 → 0.6.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/beat-analyzer.global.js +326 -0
  2. package/dist/cli.js +2479 -1961
  3. package/dist/commands/layout-audit.browser.js +86 -0
  4. package/dist/hyperframe-runtime.js +22 -22
  5. package/dist/hyperframe.manifest.json +1 -1
  6. package/dist/hyperframe.runtime.iife.js +22 -22
  7. package/dist/skills/hyperframes-cli/SKILL.md +67 -103
  8. package/dist/skills/hyperframes-cli/references/doctor-browser.md +45 -0
  9. package/dist/skills/hyperframes-cli/references/init-and-scaffold.md +51 -0
  10. package/dist/skills/hyperframes-cli/references/lambda.md +132 -0
  11. package/dist/skills/hyperframes-cli/references/lint-validate-inspect.md +93 -0
  12. package/dist/skills/hyperframes-cli/references/preview-render.md +107 -0
  13. package/dist/skills/hyperframes-cli/references/upgrade-info-misc.md +75 -0
  14. package/dist/studio/assets/hyperframes-player-DgsMQSvV.js +418 -0
  15. package/dist/studio/assets/index-B62bDCQv.css +1 -0
  16. package/dist/studio/assets/index-Ce3pBm_I.js +252 -0
  17. package/dist/studio/assets/{index-HveJ0MuV.js → index-D-ET9M0b.js} +1 -1
  18. package/dist/studio/assets/index-D-bS9Dxx.js +1 -0
  19. package/dist/studio/index.html +2 -2
  20. package/dist/templates/_shared/AGENTS.md +46 -21
  21. package/dist/templates/_shared/CLAUDE.md +16 -14
  22. package/package.json +3 -2
  23. package/dist/pngDecodeBlitWorker.js +0 -239
  24. package/dist/skills/gsap/SKILL.md +0 -240
  25. package/dist/skills/gsap/references/effects.md +0 -297
  26. package/dist/skills/gsap/scripts/extract-audio-data.py +0 -188
  27. package/dist/skills/hyperframes/SKILL.md +0 -491
  28. package/dist/skills/hyperframes/data-in-motion.md +0 -19
  29. package/dist/skills/hyperframes/house-style.md +0 -73
  30. package/dist/skills/hyperframes/palettes/bold-energetic.md +0 -14
  31. package/dist/skills/hyperframes/palettes/clean-corporate.md +0 -14
  32. package/dist/skills/hyperframes/palettes/dark-premium.md +0 -14
  33. package/dist/skills/hyperframes/palettes/jewel-rich.md +0 -14
  34. package/dist/skills/hyperframes/palettes/monochrome.md +0 -14
  35. package/dist/skills/hyperframes/palettes/nature-earth.md +0 -14
  36. package/dist/skills/hyperframes/palettes/neon-electric.md +0 -14
  37. package/dist/skills/hyperframes/palettes/pastel-soft.md +0 -14
  38. package/dist/skills/hyperframes/palettes/warm-editorial.md +0 -14
  39. package/dist/skills/hyperframes/patterns.md +0 -191
  40. package/dist/skills/hyperframes/references/audio-reactive.md +0 -76
  41. package/dist/skills/hyperframes/references/beat-direction.md +0 -171
  42. package/dist/skills/hyperframes/references/captions.md +0 -163
  43. package/dist/skills/hyperframes/references/css-patterns.md +0 -373
  44. package/dist/skills/hyperframes/references/design-picker.md +0 -117
  45. package/dist/skills/hyperframes/references/dynamic-techniques.md +0 -102
  46. package/dist/skills/hyperframes/references/html-in-canvas-patterns.md +0 -507
  47. package/dist/skills/hyperframes/references/motion-principles.md +0 -150
  48. package/dist/skills/hyperframes/references/narration.md +0 -92
  49. package/dist/skills/hyperframes/references/prompt-expansion.md +0 -68
  50. package/dist/skills/hyperframes/references/techniques.md +0 -525
  51. package/dist/skills/hyperframes/references/text-effects.md +0 -64
  52. package/dist/skills/hyperframes/references/transcript-guide.md +0 -107
  53. package/dist/skills/hyperframes/references/transitions/catalog.md +0 -117
  54. package/dist/skills/hyperframes/references/transitions/css-3d.md +0 -12
  55. package/dist/skills/hyperframes/references/transitions/css-blur.md +0 -51
  56. package/dist/skills/hyperframes/references/transitions/css-cover.md +0 -43
  57. package/dist/skills/hyperframes/references/transitions/css-destruction.md +0 -95
  58. package/dist/skills/hyperframes/references/transitions/css-dissolve.md +0 -66
  59. package/dist/skills/hyperframes/references/transitions/css-distortion.md +0 -45
  60. package/dist/skills/hyperframes/references/transitions/css-grid.md +0 -10
  61. package/dist/skills/hyperframes/references/transitions/css-light.md +0 -49
  62. package/dist/skills/hyperframes/references/transitions/css-mechanical.md +0 -30
  63. package/dist/skills/hyperframes/references/transitions/css-other.md +0 -25
  64. package/dist/skills/hyperframes/references/transitions/css-push.md +0 -41
  65. package/dist/skills/hyperframes/references/transitions/css-radial.md +0 -37
  66. package/dist/skills/hyperframes/references/transitions/css-scale.md +0 -24
  67. package/dist/skills/hyperframes/references/transitions.md +0 -138
  68. package/dist/skills/hyperframes/references/typography.md +0 -175
  69. package/dist/skills/hyperframes/references/video-composition.md +0 -62
  70. package/dist/skills/hyperframes/scripts/animation-map.mjs +0 -601
  71. package/dist/skills/hyperframes/scripts/contrast-report.mjs +0 -348
  72. package/dist/skills/hyperframes/scripts/package-loader.mjs +0 -269
  73. package/dist/skills/hyperframes/templates/design-picker.html +0 -1432
  74. package/dist/skills/hyperframes/visual-styles.md +0 -443
  75. package/dist/studio/assets/hyperframes-player-Daj5djxa.js +0 -418
  76. package/dist/studio/assets/index-B0twsRu0.css +0 -1
  77. package/dist/studio/assets/index-Cfye9xzo.js +0 -251
@@ -1,144 +1,108 @@
1
1
  ---
2
2
  name: hyperframes-cli
3
- description: HyperFrames CLI dev loop `npx hyperframes` for scaffolding (init), validation (lint, inspect), preview, render, and environment troubleshooting (doctor, browser, info, upgrade). Use when running any of these commands or troubleshooting the HyperFrames build/render environment. For asset preprocessing commands (`tts`, `transcribe`, `remove-background`), invoke the `hyperframes-media` skill instead.
3
+ description: HyperFrames CLI dev loop. Use when running npx hyperframes init, add, catalog, capture, lint, validate, inspect, layout, snapshot, preview, play, render, publish, 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`).
4
4
  ---
5
5
 
6
6
  # HyperFrames CLI
7
7
 
8
- Everything runs through `npx hyperframes`. Requires Node.js >= 22 and FFmpeg.
8
+ Everything runs through `npx hyperframes` unless project instructions specify a local wrapper. Obey the local wrapper exactly. Requires Node.js >= 22 and FFmpeg.
9
9
 
10
10
  ## Workflow
11
11
 
12
- 1. **Scaffold** — `npx hyperframes init my-video`
13
- 2. **Write** — author HTML composition (see the `hyperframes` skill)
12
+ 1. **Scaffold** — `npx hyperframes init my-video` (or `capture` from a URL)
13
+ 2. **Write** — author HTML composition (see the `hyperframes-core` skill)
14
14
  3. **Lint** — `npx hyperframes lint`
15
- 4. **Visual inspect** — `npx hyperframes inspect`
16
- 5. **Preview** — `npx hyperframes preview`
17
- 6. **Render** — `npx hyperframes render`
15
+ 4. **Validate** — `npx hyperframes validate` (runtime errors + contrast)
16
+ 5. **Visual inspect** — `npx hyperframes inspect`
17
+ 6. **Preview** — `npx hyperframes preview`
18
+ 7. **Render** — pick the variant:
19
+ - Iterate: `npx hyperframes render --quality draft`
20
+ - Deliver: `npx hyperframes render --quality high --output out.mp4`
21
+ - CI / cross-host repro: `npx hyperframes render --docker --strict --output out.mp4`
22
+ - Cloud (long / large): `npx hyperframes lambda render ./my-project --width 1920 --height 1080 --wait` (see Lambda below)
18
23
 
19
- Lint and inspect before preview. `lint` catches missing `data-composition-id`, overlapping tracks, and unregistered timelines. `inspect` opens the rendered composition in headless Chrome, seeks through the timeline, and reports text spilling out of bubbles/containers or off the canvas.
24
+ 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.
20
25
 
21
- ## Scaffolding
26
+ For motion-heavy work, prefer snapshot-driven iteration — see `references/lint-validate-inspect.md` for the discipline.
22
27
 
23
- ```bash
24
- npx hyperframes init my-video # interactive wizard
25
- npx hyperframes init my-video --example warm-grain # pick an example
26
- npx hyperframes init my-video --video clip.mp4 # with video file
27
- npx hyperframes init my-video --audio track.mp3 # with audio file
28
- npx hyperframes init my-video --example blank --tailwind # with Tailwind v4 browser runtime
29
- npx hyperframes init my-video --non-interactive # skip prompts (CI/agents)
30
- ```
31
-
32
- Templates: `blank`, `warm-grain`, `play-mode`, `swiss-grid`, `vignelli`, `decision-tree`, `kinetic-type`, `product-promo`, `nyt-graph`.
33
-
34
- `init` creates the right file structure, copies media, transcribes audio with Whisper, and installs AI coding skills. Use it instead of creating files by hand.
35
-
36
- When using `--tailwind`, invoke the `tailwind` skill before editing classes or theme tokens. The scaffold uses Tailwind v4.2 via the browser runtime, not Studio's Tailwind v3 setup.
28
+ ## Agent Conventions
37
29
 
38
- ## Linting
30
+ Cross-cutting rules that hold for every command:
39
31
 
40
- ```bash
41
- npx hyperframes lint # current directory
42
- npx hyperframes lint ./my-project # specific project
43
- npx hyperframes lint --verbose # info-level findings
44
- npx hyperframes lint --json # machine-readable
45
- ```
46
-
47
- Lints `index.html` and all files in `compositions/`. Reports errors (must fix), warnings (should fix), and info (with `--verbose`).
32
+ - **`--json` is available on every command except `render`, `preview`, and `play`.** Use it for any agent / CI invocation of the supported commands; output includes a `_meta` envelope (cli version, latest available, update advice). `render` reports status via stdout + exit code only — verify success with the post-render check below; `preview` / `play` are servers, no JSON.
33
+ - **`doctor --json` always exits 0**, even when the environment is broken. Gate on the payload's `ok` field: `npx hyperframes doctor --json | jq -e '.ok' > /dev/null`. This insulates pipelines from CLI release churn.
34
+ - **Non-TTY mode is auto-detected.** When `stdout` is not a TTY (CI, agents, piped output) the CLI auto-switches to non-interactive; `init` then **requires `--example`**. Pass `--non-interactive` to force this mode even on a TTY.
35
+ - **CI gating on render**: `--strict` fails on lint errors, `--strict-all` fails on warnings too, `--strict-variables` fails on undeclared `--variables` keys.
36
+ - **Paths in `--json` are redacted** — `$HOME` becomes the literal `$HOME` so output is safe to paste into bug reports and agent contexts.
37
+ - **Post-render verification.** After `render` returns 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 with `ffprobe -i "$OUTPUT" -show_format -v error`.
48
38
 
49
- ## Visual Inspect
50
-
51
- ```bash
52
- npx hyperframes inspect # inspect rendered layout over the timeline
53
- npx hyperframes inspect ./my-project # specific project
54
- npx hyperframes inspect --json # agent-readable findings
55
- npx hyperframes inspect --samples 15 # denser timeline sweep
56
- npx hyperframes inspect --at 1.5,4,7.25 # explicit hero-frame timestamps
57
- ```
39
+ ## Routing
58
40
 
59
- Use this after `lint` and `validate`, especially for compositions with speech bubbles, cards, captions, or tight typography. It reports:
41
+ | Want to… | Read |
42
+ | ---------------------------------------------------------------------------------------------------------- | ------------------------------------- |
43
+ | Scaffold a project (`init`, `capture`, `skills`) | `references/init-and-scaffold.md` |
44
+ | Check correctness (`lint`, `validate`, `inspect`, `snapshot`) | `references/lint-validate-inspect.md` |
45
+ | Preview or render (`preview`, `play`, `render`, `publish`) | `references/preview-render.md` |
46
+ | Diagnose the environment (`doctor`, `browser`) | `references/doctor-browser.md` |
47
+ | Cloud render on AWS Lambda (`lambda deploy / sites / render / progress / destroy / policies`) | `references/lambda.md` |
48
+ | Everything else (`info`, `upgrade`, `compositions`, `docs`, `benchmark`, `telemetry`, asset preprocessing) | `references/upgrade-info-misc.md` |
60
49
 
61
- - Text extending outside the nearest visual container or bubble
62
- - Text clipped by its own fixed-width/fixed-height box
63
- - Text extending outside the composition canvas
64
- - Children escaping clipping containers
50
+ ## Cross-Skill Hand-Offs
65
51
 
66
- Errors should be fixed before rendering. Warnings are surfaced for agent review; add `--strict` to fail on warnings too. Repeated static issues are collapsed by default so JSON output stays compact for LLM context windows. If overflow is intentional for an entrance/exit animation, mark the element or ancestor with `data-layout-allow-overflow`. If a decorative element should never be audited, mark it with `data-layout-ignore`.
52
+ - **Tailwind projects** (`init --tailwind`) use `hyperframes-core` (Tailwind reference) before editing classes or theme tokens.
53
+ - **Registry blocks/components** (`hyperframes add`, `hyperframes catalog`) → use `hyperframes-registry` for install paths, sub-composition wiring, and snippet merging.
54
+ - **Asset preprocessing** (`tts`, `transcribe`, `remove-background`) → use `hyperframes-media` for voice selection, Whisper model rules, captions, and TTS-to-captions chain.
55
+ - **Parametrized renders** (`--variables`) → declared via `data-composition-variables` on `<html>`; see `hyperframes-core` for the full schema.
67
56
 
68
- `npx hyperframes layout` remains available as a compatibility alias for the same visual inspection pass.
57
+ ## Lambda (Cloud Rendering)
69
58
 
70
- ## Previewing
59
+ `hyperframes lambda` deploys distributed rendering to AWS Lambda and drives renders from your laptop or CI. End-to-end is three commands:
71
60
 
72
61
  ```bash
73
- npx hyperframes preview # serve current directory
74
- npx hyperframes preview --port 4567 # custom port (default 3002)
62
+ npx hyperframes lambda deploy # provision SAM stack (Lambda + Step Functions + S3)
63
+ npx hyperframes lambda render ./my-project --width 1920 --height 1080 --wait
64
+ npx hyperframes lambda destroy # tear down (S3 bucket is retained)
75
65
  ```
76
66
 
77
- Hot-reloads on file changes. Opens the studio in your browser automatically.
78
-
79
- When handing a project back to the user, use the Studio project URL, not the
80
- source `index.html` path:
67
+ 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`.
81
68
 
82
- ```text
83
- http://localhost:<port>/#project/<project-name>
84
- ```
69
+ 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.
85
70
 
86
- Use the actual port from the preview output and the project directory name. For
87
- example, after `npx hyperframes preview --port 3017` in `codex-openai-video`,
88
- report `http://localhost:3017/#project/codex-openai-video`.
71
+ ## Minimum Completion Gate
89
72
 
90
- Treat `index.html` as source-code context only. It is fine to link it as an
91
- implementation file, but do not label it as the project or preview surface.
92
-
93
- ## Rendering
73
+ ### Static gates
94
74
 
95
75
  ```bash
96
- npx hyperframes render # standard MP4
97
- npx hyperframes render --output final.mp4 # named output
98
- npx hyperframes render --quality draft # fast iteration
99
- npx hyperframes render --fps 60 --quality high # final delivery
100
- npx hyperframes render --format webm # transparent WebM
101
- npx hyperframes render --docker # byte-identical
76
+ npx hyperframes lint
77
+ npx hyperframes validate
102
78
  ```
103
79
 
104
- | Flag | Options | Default | Notes |
105
- | -------------------- | --------------------- | -------------------------- | ------------------------------------------------------------------ |
106
- | `--output` | path | renders/name_timestamp.mp4 | Output path |
107
- | `--fps` | 24, 30, 60 | 30 | 60fps doubles render time |
108
- | `--quality` | draft, standard, high | standard | draft for iterating |
109
- | `--format` | mp4, webm | mp4 | WebM supports transparency |
110
- | `--workers` | 1-8 or auto | auto | Each spawns Chrome |
111
- | `--docker` | flag | off | Reproducible output |
112
- | `--gpu` | flag | off | GPU-accelerated encoding |
113
- | `--strict` | flag | off | Fail on lint errors |
114
- | `--strict-all` | flag | off | Fail on errors AND warnings |
115
- | `--variables` | JSON object | — | Override variable values declared in `data-composition-variables` |
116
- | `--variables-file` | path | — | JSON file with variable values (alternative to `--variables`) |
117
- | `--strict-variables` | flag | off | Fail render on undeclared keys or type mismatches in `--variables` |
118
-
119
- **Quality guidance:** `draft` while iterating, `standard` for review, `high` for final delivery.
80
+ Add `inspect` for layout-sensitive work and `render --strict` in CI to fail on lint errors.
120
81
 
121
- **Parametrized renders:** the composition declares its variables on the `<html>` root with **`data-composition-variables`** a JSON **array of declarations** (`{id, type, label, default}` per entry) that defines the schema. Scripts inside read the resolved values via `window.__hyperframes.getVariables()`. The CLI **`--variables '{"title":"Q4 Report"}'`** is a JSON **object keyed by id** that overrides those declared defaults for one render; missing keys fall through, so the same composition runs unchanged in dev preview and in production. (Sub-comp hosts can also override per-instance with **`data-variable-values`** — same object shape, scoped to one mount of the sub-composition. See the `hyperframes` skill for the full pattern.)
82
+ ### Visual smoke testrequired when the project uses sub-compositions
122
83
 
123
- ## Asset Preprocessing
84
+ `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.
124
85
 
125
- `npx hyperframes tts`, `transcribe`, and `remove-background` produce assets (narration audio, word-level transcripts, transparent video) that get dropped into a composition. Each downloads its own model on first run. For voice selection, whisper model rules (the `.en`-translates-non-English gotcha), output format choice (VP9 alpha WebM vs ProRes), and the TTS transcribe captions chain, invoke the `hyperframes-media` skill.
126
-
127
- ## Troubleshooting
86
+ 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:
128
87
 
129
88
  ```bash
130
- npx hyperframes doctor # check environment (Chrome, FFmpeg, Node, memory)
131
- npx hyperframes browser # manage bundled Chrome
132
- npx hyperframes info # version and environment details
133
- npx hyperframes upgrade # check for updates
89
+ # Capture one frame at the midpoint of every sub-composition.
90
+ # Midpoints = data-start + data-duration/2 for each host slot in index.html.
91
+ npx hyperframes snapshot --at <t1>,<t2>,<t3>,...
92
+
93
+ # Or, if you don't need per-scene targeting, an evenly-spaced sample:
94
+ npx hyperframes snapshot --frames 9
134
95
  ```
135
96
 
136
- Run `doctor` first if rendering fails. Common issues: missing FFmpeg, missing Chrome, low memory.
97
+ Output lands in `snapshots/frame-NN-at-Xs.png`. Eyeball each frame against the scene plan.
137
98
 
138
- ## Other
99
+ Per-frame red flags (each maps to a specific failure mode the static gates miss):
139
100
 
140
- ```bash
141
- npx hyperframes compositions # list compositions in project
142
- npx hyperframes docs # open documentation
143
- npx hyperframes benchmark . # benchmark render performance
144
- ```
101
+ | What you see | Root cause |
102
+ | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
103
+ | Text shows up tiny + unstyled in the top-left corner | `<style>` block left in `<head>` outside `<template>` (Pitfall 1) — no CSS reached live DOM |
104
+ | SVG/icon elements blown up to canvas-size | Same as above — no width/height constraints applied |
105
+ | 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 |
106
+ | Snapshot command logs `Sub-composition timelines not registered after 45000ms` | Pitfall 2 — direct confirmation |
107
+
108
+ `snapshots/` can be deleted after eyeballing; the user-facing final render is a separate pass with `npx hyperframes render`.
@@ -0,0 +1,45 @@
1
+ # doctor, browser
2
+
3
+ Environment diagnosis and bundled-Chrome management. Run these first when a render or preview fails.
4
+
5
+ ## doctor
6
+
7
+ ```bash
8
+ npx hyperframes doctor
9
+ npx hyperframes doctor --json # CI / agent output (always exit 0; gate on payload `ok`)
10
+ ```
11
+
12
+ Runs independent checks and reports each as ok/warn/fail:
13
+
14
+ - **Version** — installed CLI vs latest on npm (hints upgrade when stale)
15
+ - **Node.js** — ≥ 22 required
16
+ - **CPU**, **Memory**, **Disk** — host resources
17
+ - **Environment** — env vars that affect the renderer
18
+ - **FFmpeg** / **FFprobe** — found, version, codecs
19
+ - **Chrome** — bundled or system, version, path
20
+ - **Docker** / **Docker running** — required only for `render --docker`
21
+ - **/dev/shm** — inside containers only
22
+
23
+ Run `doctor` first when:
24
+
25
+ - `render` fails with a Chrome or FFmpeg error.
26
+ - `preview` opens but the composition fails to load.
27
+ - A fresh machine has never run HyperFrames.
28
+
29
+ Common issues:
30
+
31
+ - **Missing FFmpeg** — install via `brew install ffmpeg` (macOS) or your package manager.
32
+ - **Missing bundled Chrome** — run `npx hyperframes browser ensure`.
33
+ - **Low memory** — close other Chromes, reduce `--workers`, or use `--quality draft`.
34
+
35
+ ## browser
36
+
37
+ ```bash
38
+ npx hyperframes browser ensure # find or download the pinned Chrome
39
+ npx hyperframes browser path # print the browser executable path (for scripting)
40
+ npx hyperframes browser clear # remove the cached Chrome download
41
+ ```
42
+
43
+ Manage the Chrome build HyperFrames uses for rendering. The pinned version exists because pixel output drifts across Chrome versions — using the bundled build keeps rendered output reproducible across machines.
44
+
45
+ Use `path` to embed the binary in scripts: `$(npx hyperframes browser path)`.
@@ -0,0 +1,51 @@
1
+ # init, capture, skills
2
+
3
+ Scaffolding commands. Use these instead of creating files by hand — they set up the right file structure, copy media, run transcription, and install AI coding skills.
4
+
5
+ ## init
6
+
7
+ ```bash
8
+ npx hyperframes init my-video # TTY: interactive wizard
9
+ npx hyperframes init my-video --example warm-grain # pick an example
10
+ npx hyperframes init my-video --example blank --resolution portrait
11
+ npx hyperframes init my-video --video clip.mp4 # with video file
12
+ npx hyperframes init my-video --audio track.mp3 # with audio file
13
+ npx hyperframes init my-video --example blank --tailwind # Tailwind v4 browser runtime
14
+ npx hyperframes init my-video --non-interactive --example blank # CI/agents — flag-only
15
+ ```
16
+
17
+ **Default depends on TTY**: in a terminal, the CLI prompts for example/options. Outside a TTY (CI, agents, piped output) it auto-switches to non-interactive and **requires `--example`** (the CLI errors with a usage example if missing). Pass `--non-interactive` to force flag-only mode even on a TTY.
18
+
19
+ Templates: `blank`, `warm-grain`, `play-mode`, `swiss-grid`, `vignelli`, `decision-tree`, `kinetic-type`, `product-promo`, `nyt-graph`.
20
+
21
+ Other useful flags:
22
+
23
+ - `--resolution` — preset: `landscape` (1920×1080), `portrait` (1080×1920), `landscape-4k`, `portrait-4k`, `square` (1080×1080), `square-4k`. Aliases: `1080p`, `4k`, `uhd`, `1080p-square`, `4k-square`.
24
+ - `--skip-skills` — don't install AI coding skills after scaffold.
25
+ - `--skip-transcribe` — don't auto-transcribe `--audio` / `--video` with Whisper.
26
+ - `--model`, `--language` — Whisper model / language for the auto-transcription.
27
+
28
+ When using `--tailwind`, invoke the `hyperframes-core` (Tailwind reference) skill before editing classes or theme tokens. The scaffold uses Tailwind v4 browser runtime patterns, not Studio's Tailwind v3 setup.
29
+
30
+ When `--audio` or `--video` is supplied, `init` transcribes the file with Whisper. For voice/model selection see the `hyperframes-media` skill.
31
+
32
+ ## capture
33
+
34
+ ```bash
35
+ npx hyperframes capture https://stripe.com # scaffold from a website
36
+ npx hyperframes capture https://linear.app -o linear-video # custom output directory
37
+ npx hyperframes capture https://example.com --json # JSON output for agents
38
+ npx hyperframes capture https://example.com --skip-assets # skip image/SVG download
39
+ npx hyperframes capture https://example.com --max-screenshots 12
40
+ npx hyperframes capture https://example.com --timeout 60000 # page-load timeout in ms
41
+ ```
42
+
43
+ Captures a live URL as an editable HyperFrames project: screenshots become layered scenes, assets are downloaded locally, and the result is a normal project you can `lint` / `preview` / `render`. Use this when the user supplies a URL as the starting point for a video.
44
+
45
+ ## skills
46
+
47
+ ```bash
48
+ npx hyperframes skills # install HyperFrames skills for AI coding tools
49
+ ```
50
+
51
+ One-time setup that adds the HyperFrames skill pack (`hyperframes-core`, `-creative`, `-animation`, `-cli`, `-registry`, `-media`, plus the `product-launch-video` and `hyperframes-read-first` orchestrators) to the local AI coding environment so agents follow the framework conventions. Re-run after major HyperFrames upgrades.
@@ -0,0 +1,132 @@
1
+ # lambda — Cloud Rendering on AWS Lambda
2
+
3
+ Deploy HyperFrames distributed rendering to AWS Lambda and drive renders from your laptop or CI. Wraps `@hyperframes/aws-lambda` SDK plus AWS SAM. End-to-end is three commands:
4
+
5
+ ```bash
6
+ npx hyperframes lambda deploy
7
+ npx hyperframes lambda render ./my-project --width 1920 --height 1080 --wait
8
+ npx hyperframes lambda destroy
9
+ ```
10
+
11
+ ## When to Use Lambda vs Local Render
12
+
13
+ - **Local `render`** — dev-loop iteration, single host, anything under a few minutes at 1080p.
14
+ - **`lambda render`** — long videos, 4K, large parallel batches, or anything where local Chrome would time out / exhaust RAM. Pay-per-invocation, no idle cost.
15
+
16
+ For one-off short renders Lambda is not worth the deploy overhead.
17
+
18
+ ## Prerequisites
19
+
20
+ - AWS credentials configured (env vars, `~/.aws/credentials`, SSO, or IMDS).
21
+ - AWS SAM CLI on `PATH`.
22
+ - `bun` on `PATH` (builds the Lambda handler ZIP).
23
+
24
+ ## Subcommands
25
+
26
+ ### deploy
27
+
28
+ ```bash
29
+ npx hyperframes lambda deploy \
30
+ --stack-name=hyperframes-prod \
31
+ --region=us-east-1 \
32
+ --concurrency=8 \
33
+ --memory=10240
34
+ ```
35
+
36
+ Builds `packages/aws-lambda/dist/handler.zip` and SAM-deploys the stack (Lambda + Step Functions + S3 + IAM). Idempotent — re-running on the same `--stack-name` is a no-op when nothing changed. Writes `<cwd>/.hyperframes/lambda-stack-<name>.json` so later subcommands don't need to call `describe-stacks`.
37
+
38
+ | Flag | Default | Description |
39
+ | --------------- | ------------------------------- | ----------------------------- |
40
+ | `--stack-name` | `hyperframes-default` | CloudFormation stack name |
41
+ | `--region` | `AWS_REGION` env or `us-east-1` | AWS region |
42
+ | `--profile` | `AWS_PROFILE` env | Named AWS credentials profile |
43
+ | `--concurrency` | `8` | Lambda reserved concurrency |
44
+ | `--memory` | `10240` | Lambda memory in MB |
45
+ | `--skip-build` | off | Reuse existing `handler.zip` |
46
+
47
+ ### sites create
48
+
49
+ ```bash
50
+ npx hyperframes lambda sites create ./my-project
51
+ # → siteId: abc1234deadbeef0 (stable across re-runs of the same tree)
52
+
53
+ npx hyperframes lambda render ./my-project --site-id=abc1234deadbeef0 ...
54
+ ```
55
+
56
+ Tars + uploads `<projectDir>` to S3 with a content-addressed key. Returns a stable `siteId` you can reuse — re-renders of the same tree skip the upload.
57
+
58
+ ### render
59
+
60
+ ```bash
61
+ npx hyperframes lambda render ./my-project \
62
+ --width 1920 --height 1080 --fps 30 --format mp4 \
63
+ --chunk-size 240 --max-parallel-chunks 16 \
64
+ --wait
65
+ ```
66
+
67
+ Starts a Step Functions execution. Returns immediately with a `renderId` unless `--wait` is set, in which case the CLI blocks until completion and streams per-chunk progress lines. Add `--json` for machine-parseable output.
68
+
69
+ | Flag | Description |
70
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
71
+ | `--width` / `--height` | Output dimensions in pixels |
72
+ | `--output-resolution` | Supersampling preset (engages Chrome `deviceScaleFactor`) — `landscape` / `landscape-4k` / `portrait` / `portrait-4k` / `square` / `square-4k`, plus aliases (`1080p`, `4k`, `uhd`, `hd`, `1080p-portrait`, `4k-portrait`, `1080p-square`, `4k-square`). Use this to render an authored-at-1080p composition at 4K without re-laying-out — see footgun below. |
73
+ | `--fps` | `24` / `30` / `60` |
74
+ | `--format` | `mp4` / `mov` / `png-sequence` (default `mp4`) |
75
+ | `--codec` | `h264` / `h265` (mp4 only) |
76
+ | `--quality` | `draft` / `standard` / `high` |
77
+ | `--chunk-size` | Frames per chunk (default `240`) |
78
+ | `--max-parallel-chunks` | Max concurrent chunks (default `16`) |
79
+ | `--site-id` | Reuse an existing site (skip upload) |
80
+ | `--wait` | Block until completion, stream progress |
81
+ | `--json` | Machine-parseable progress snapshot |
82
+
83
+ **`--width` / `--height` footgun.** Setting `--width 3840 --height 2160` against a composition whose `data-width="1920"` silently produces 1080p — the runtime lays out the page at the composition's authored dimensions and the CLI flags are ignored for layout. To actually output at 4K, use `--output-resolution 4k` (supersamples via `deviceScaleFactor`). The CLI now prints a warning when CLI dimensions disagree with the composition's `data-width` / `data-height` and `--output-resolution` is not set; the warning is suppressed when `--json` is on or `index.html` isn't on disk (`--site-id` flows).
84
+
85
+ ### progress
86
+
87
+ ```bash
88
+ npx hyperframes lambda progress hf-render-abcd1234
89
+ npx hyperframes lambda progress arn:aws:states:us-east-1:...:execution:...
90
+ ```
91
+
92
+ Prints one snapshot — overall percent, frames rendered, Lambda invocations, accrued cost, and any errors. Accepts a bare `renderId` (resolved against the stack's state-machine ARN) or a full SFN execution ARN.
93
+
94
+ ### destroy
95
+
96
+ ```bash
97
+ npx hyperframes lambda destroy
98
+ ```
99
+
100
+ Calls `sam delete --no-prompts` and drops the local state file. **The render S3 bucket is configured `Retain`** so it survives stack destruction — empty + delete it via the AWS console / CLI if you want the storage back.
101
+
102
+ ### Non-retryable errors
103
+
104
+ A subset of failures the Step Functions state machine short-circuits instead of running through its 4× 15-min retry budget. `progress` surfaces these immediately with the error class name; do not re-issue `lambda render` blindly when you see one.
105
+
106
+ - **`ChromeBinaryUnavailableError`** — `@sparticuz/chromium` returned an empty/missing executable path. A prior chunk hit `Sandbox.Timedout` mid-extraction and the warm instance is wedged until the execution environment recycles. Remedy: bump a Lambda env var (forces a new exec env) or `lambda deploy` again. Not a transient render failure; retries will burn budget on the same wedged instance.
107
+ - **`FFMPEG_VERSION_MISMATCH`** / **`PLAN_HASH_MISMATCH`** — planner / executor version drift. Re-deploy.
108
+
109
+ ### policies
110
+
111
+ Print or validate the minimum IAM permissions the CLI needs.
112
+
113
+ ```bash
114
+ npx hyperframes lambda policies user # inline policy for an IAM user
115
+ npx hyperframes lambda policies role --principal=cloudformation # { TrustRelationship, InlinePolicy }
116
+ npx hyperframes lambda policies validate ./infra/iam/hf-deploy.json # CI gate
117
+ ```
118
+
119
+ `validate` reads a JSON policy doc and checks the union of its `Effect: Allow` actions (expanding `s3:*` / `s3:Get*` / `*` wildcards) against the CLI's required action set. Missing actions print to stderr; the command exits non-zero. Wire it into CI to catch policy drift before the next deploy fails.
120
+
121
+ The default action set is deliberately broad (`Resource: "*"`) because CloudFormation creates new ARNs on every adopter's first deploy. Tighten `Resource` after that first run if security posture requires it.
122
+
123
+ ## State Files
124
+
125
+ `hyperframes lambda` stores per-stack metadata under `<cwd>/.hyperframes/lambda-stack-<name>.json` (bucket name, state-machine ARN, region). Not secret, but AWS-account-identifying. Commit it to a repo or `.gitignore` it per your workflow.
126
+
127
+ ## Cost and Cleanup
128
+
129
+ - `lambda destroy` removes the SAM stack but **leaves the S3 bucket** (`Retain`). Delete it manually if you want the storage back.
130
+ - Lambda billing is per-invocation + duration. `progress` reports the accrued cost.
131
+ - `--concurrency` caps parallel Lambda invocations — keep it aligned with your account quota.
132
+ - `--chunk-size` and `--max-parallel-chunks` trade off per-chunk overhead against parallelism; larger chunks reduce coordinator overhead, smaller chunks parallelize more aggressively.
@@ -0,0 +1,93 @@
1
+ # lint, validate, inspect, snapshot
2
+
3
+ The correctness pipeline. Run in this order: `lint` (static, fast) → `validate` (runtime, headless Chrome) → `inspect` (layout sweep). `snapshot` is a separate utility for capturing still frames.
4
+
5
+ ## Discipline (motion-heavy work)
6
+
7
+ When the composition is animation-driven, run the checks before you reach for `preview` or `render`:
8
+
9
+ - Run `lint` after the first HTML pass — earlier, not later.
10
+ - Capture `snapshot` at meaningful timeline states; look at the PNGs.
11
+ - Inspect snapshots _before_ tuning automated warnings — your eye catches what the auditor misses.
12
+ - Treat layout warnings as defects unless a snapshot proves the overflow is intentional, in which case mark it with `data-layout-allow-overflow`.
13
+
14
+ ## lint
15
+
16
+ ```bash
17
+ npx hyperframes lint # current directory
18
+ npx hyperframes lint ./my-project # specific project
19
+ npx hyperframes lint --verbose # info-level findings
20
+ npx hyperframes lint --json # machine-readable
21
+ ```
22
+
23
+ Lints `index.html` and all files in `compositions/`. Reports errors (must fix), warnings (should fix), and info (with `--verbose`). Catches missing `data-composition-id`, overlapping tracks on the same `data-track-index`, and unregistered timelines.
24
+
25
+ **Blind spot — media inside a sub-composition (not yet a lint rule).** A `<video>`/`<audio>` inside a `compositions/*.html` `<template>` (or nested in a wrapper `<div>` anywhere) is never seeked/decoded and renders blank/black; `lint`/`validate`/`inspect` all pass. Media must be a direct child of the host root (`index.html`) — see `hyperframes-core` → `variables-and-media.md`. Until a rule exists, check manually before render:
26
+
27
+ ```bash
28
+ grep -nE '<(video|audio)\b' compositions/*.html # expect NO matches; media belongs in index.html
29
+ ```
30
+
31
+ A non-empty result is a defect. Then `snapshot` each scene that has a video and confirm the panel actually shows footage (a blank/black panel where a clip should play is a bug, not a placeholder — treat it as render-blocking).
32
+
33
+ ## validate
34
+
35
+ ```bash
36
+ npx hyperframes validate # current directory
37
+ npx hyperframes validate ./my-project # specific project
38
+ npx hyperframes validate --json # agent-readable findings
39
+ npx hyperframes validate --timeout 5000 # ms to wait for scripts (default 3000)
40
+ npx hyperframes validate --no-contrast # skip WCAG contrast audit while iterating
41
+ ```
42
+
43
+ Static lint is fast but blind to runtime failures. `validate` loads the composition in headless Chrome, plays through it, and reports:
44
+
45
+ - JavaScript console errors and unhandled exceptions
46
+ - Failed network requests (media-file `ERR_ABORTED` filtered out)
47
+ - WCAG AA contrast violations on visible text — sampled at 5 timestamps across the timeline. Disable with `--no-contrast`.
48
+
49
+ **Fixing contrast warnings** — thresholds are 4.5:1 for normal text, 3:1 for large text (24px+, or 19px+ bold):
50
+
51
+ - On dark backgrounds, brighten the failing color until it clears the threshold; on light backgrounds, darken it.
52
+ - Stay within the palette family — don't invent a new color, adjust the existing one.
53
+ - Re-run `validate` until clean.
54
+
55
+ Run `validate` before `inspect` when an animation has scripts, fetched data, or theming. Combine with `render --strict` in CI.
56
+
57
+ ## inspect
58
+
59
+ ```bash
60
+ npx hyperframes inspect # inspect rendered layout over the timeline
61
+ npx hyperframes inspect ./my-project # specific project
62
+ npx hyperframes inspect --json # agent-readable findings (schemaVersion, samples, issues, bboxes)
63
+ npx hyperframes inspect --samples 15 # denser timeline sweep (default 9)
64
+ npx hyperframes inspect --at 1.5,4,7.25 # explicit hero-frame timestamps
65
+ npx hyperframes inspect --tolerance 4 # allowed overflow in px before reporting (default 2)
66
+ npx hyperframes inspect --strict # exit non-zero on warnings too (default: only errors)
67
+ ```
68
+
69
+ Use this after `lint` and `validate`, especially for compositions with speech bubbles, cards, captions, or tight typography. It reports:
70
+
71
+ - Text extending outside the nearest visual container or bubble
72
+ - Text clipped by its own fixed-width/fixed-height box
73
+ - Text extending outside the composition canvas
74
+ - Children escaping clipping containers
75
+
76
+ Errors should be fixed before rendering. Warnings are surfaced for agent review; add `--strict` to fail on warnings too. Repeated static issues are collapsed by default so JSON output stays compact for LLM context windows.
77
+
78
+ **Escape hatches:**
79
+
80
+ - `data-layout-allow-overflow` — mark an element or ancestor when overflow is intentional for an entrance/exit animation.
81
+ - `data-layout-ignore` — mark a decorative element that should never be audited.
82
+
83
+ `npx hyperframes layout` remains available as a compatibility alias for the same visual inspection pass.
84
+
85
+ ## snapshot
86
+
87
+ ```bash
88
+ npx hyperframes snapshot # 5 key frames as PNG
89
+ npx hyperframes snapshot ./my-project # specific project
90
+ npx hyperframes snapshot --frames 10 # evenly-spaced N frames
91
+ ```
92
+
93
+ Captures still PNGs from the composition for visual diffing, thumbnails, or attaching to a PR. Faster than rendering a video when you only need a few hero frames. Output lands in the project's snapshots directory.