@mevdragon/vidfarm-devcli 0.14.0 → 0.15.0

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 (418) hide show
  1. package/.agents/skills/embedded-captions/CATALOG.md +93 -0
  2. package/.agents/skills/embedded-captions/SKILL.md +286 -0
  3. package/.agents/skills/embedded-captions/assets/brand/CDPR-fankit-terms.txt +35 -0
  4. package/.agents/skills/embedded-captions/assets/brand/cyberpunk-widths.json +115 -0
  5. package/.agents/skills/embedded-captions/assets/fonts/char-widths.json +2211 -0
  6. package/.agents/skills/embedded-captions/assets/strokefonts/HersheyScript1.svg +242 -0
  7. package/.agents/skills/embedded-captions/assets/strokefonts/HersheyScriptMed.svg +242 -0
  8. package/.agents/skills/embedded-captions/dna/README.md +148 -0
  9. package/.agents/skills/embedded-captions/dna/chrome.json +68 -0
  10. package/.agents/skills/embedded-captions/dna/cream.json +69 -0
  11. package/.agents/skills/embedded-captions/dna/documentary.json +62 -0
  12. package/.agents/skills/embedded-captions/dna/editorial.json +70 -0
  13. package/.agents/skills/embedded-captions/dna/glitch.json +82 -0
  14. package/.agents/skills/embedded-captions/dna/ink.json +65 -0
  15. package/.agents/skills/embedded-captions/dna/keynote.json +62 -0
  16. package/.agents/skills/embedded-captions/dna/loud.json +75 -0
  17. package/.agents/skills/embedded-captions/dna/neon.json +58 -0
  18. package/.agents/skills/embedded-captions/dna/velocity.json +89 -0
  19. package/.agents/skills/embedded-captions/modes/cinematic/README.md +48 -0
  20. package/.agents/skills/embedded-captions/modes/cinematic/_archive/champion/spec.md +98 -0
  21. package/.agents/skills/embedded-captions/modes/cinematic/_archive/champion/template.html +188 -0
  22. package/.agents/skills/embedded-captions/modes/cinematic/_archive/memory-wall/spec.md +134 -0
  23. package/.agents/skills/embedded-captions/modes/cinematic/_archive/memory-wall/template.html +179 -0
  24. package/.agents/skills/embedded-captions/modes/cinematic/_archive/portrait-header/spec.md +81 -0
  25. package/.agents/skills/embedded-captions/modes/cinematic/_archive/portrait-header/template.html +170 -0
  26. package/.agents/skills/embedded-captions/modes/cinematic/cinematic-cream/spec.md +16 -0
  27. package/.agents/skills/embedded-captions/modes/cinematic/cinematic-cream/template.html +226 -0
  28. package/.agents/skills/embedded-captions/modes/cinematic/engine.html +355 -0
  29. package/.agents/skills/embedded-captions/modes/standard/_anatomy.md +233 -0
  30. package/.agents/skills/embedded-captions/modes/standard/_motion.md +192 -0
  31. package/.agents/skills/embedded-captions/modes/standard/fonts/build-fonts-css.cjs +97 -0
  32. package/.agents/skills/embedded-captions/references/aesthetic-principles.md +168 -0
  33. package/.agents/skills/embedded-captions/references/anti-patterns.md +188 -0
  34. package/.agents/skills/embedded-captions/references/bespoke-vs-presets.md +178 -0
  35. package/.agents/skills/embedded-captions/references/caption-grouping.md +130 -0
  36. package/.agents/skills/embedded-captions/references/composition-craft.md +522 -0
  37. package/.agents/skills/embedded-captions/references/direction-catalog.md +138 -0
  38. package/.agents/skills/embedded-captions/references/example-renders/champion.html +371 -0
  39. package/.agents/skills/embedded-captions/references/example-renders/memory-wall.html +334 -0
  40. package/.agents/skills/embedded-captions/references/failure-modes.md +145 -0
  41. package/.agents/skills/embedded-captions/references/layout-heuristics.md +238 -0
  42. package/.agents/skills/embedded-captions/references/motion-vocabulary.md +148 -0
  43. package/.agents/skills/embedded-captions/references/rail.md +68 -0
  44. package/.agents/skills/embedded-captions/references/reference-bar.md +47 -0
  45. package/.agents/skills/embedded-captions/references/scene-types.md +94 -0
  46. package/.agents/skills/embedded-captions/references/test-set.md +66 -0
  47. package/.agents/skills/embedded-captions/references/typographic-moves.md +266 -0
  48. package/.agents/skills/embedded-captions/references/typography-presets.md +63 -0
  49. package/.agents/skills/embedded-captions/scripts/audio-envelope.cjs +95 -0
  50. package/.agents/skills/embedded-captions/scripts/check-occlusion.cjs +250 -0
  51. package/.agents/skills/embedded-captions/scripts/check-overflow.cjs +194 -0
  52. package/.agents/skills/embedded-captions/scripts/check-rail-climax.cjs +233 -0
  53. package/.agents/skills/embedded-captions/scripts/check-timing.cjs +173 -0
  54. package/.agents/skills/embedded-captions/scripts/fill-timings.cjs +124 -0
  55. package/.agents/skills/embedded-captions/scripts/fit-fonts.cjs +158 -0
  56. package/.agents/skills/embedded-captions/scripts/gen-stroke-path.py +46 -0
  57. package/.agents/skills/embedded-captions/scripts/inject-fonts.cjs +169 -0
  58. package/.agents/skills/embedded-captions/scripts/lib-dna.cjs +201 -0
  59. package/.agents/skills/embedded-captions/scripts/make-cinematic.cjs +1205 -0
  60. package/.agents/skills/embedded-captions/scripts/make-composition.cjs +404 -0
  61. package/.agents/skills/embedded-captions/scripts/make-theme.cjs +8781 -0
  62. package/.agents/skills/embedded-captions/scripts/matte.cjs +294 -0
  63. package/.agents/skills/embedded-captions/scripts/measure-layout.cjs +293 -0
  64. package/.agents/skills/embedded-captions/scripts/prepare.sh +39 -0
  65. package/.agents/skills/embedded-captions/scripts/preview-frames.cjs +268 -0
  66. package/.agents/skills/embedded-captions/scripts/render-and-composite.sh +509 -0
  67. package/.agents/skills/embedded-captions/scripts/render-theme.sh +34 -0
  68. package/.agents/skills/embedded-captions/scripts/safe-zones.cjs +813 -0
  69. package/.agents/skills/embedded-captions/scripts/transcribe.cjs +349 -0
  70. package/.agents/skills/embedded-captions/themes/PORTING.md +49 -0
  71. package/.agents/skills/embedded-captions/themes/README.md +244 -0
  72. package/.agents/skills/embedded-captions/themes/anchor.json +27 -0
  73. package/.agents/skills/embedded-captions/themes/arcade.json +51 -0
  74. package/.agents/skills/embedded-captions/themes/aurora.json +41 -0
  75. package/.agents/skills/embedded-captions/themes/biolume.json +35 -0
  76. package/.agents/skills/embedded-captions/themes/brush.json +74 -0
  77. package/.agents/skills/embedded-captions/themes/chalkboard.json +52 -0
  78. package/.agents/skills/embedded-captions/themes/dossier.json +56 -0
  79. package/.agents/skills/embedded-captions/themes/graffiti.json +62 -0
  80. package/.agents/skills/embedded-captions/themes/hologram.json +41 -0
  81. package/.agents/skills/embedded-captions/themes/inkwater.json +43 -0
  82. package/.agents/skills/embedded-captions/themes/laser.json +46 -0
  83. package/.agents/skills/embedded-captions/themes/lastpage.json +33 -0
  84. package/.agents/skills/embedded-captions/themes/neonsign.json +53 -0
  85. package/.agents/skills/embedded-captions/themes/nightcity.json +56 -0
  86. package/.agents/skills/embedded-captions/themes/ordnance.json +54 -0
  87. package/.agents/skills/embedded-captions/themes/papercut.json +37 -0
  88. package/.agents/skills/embedded-captions/themes/popup.json +46 -0
  89. package/.agents/skills/embedded-captions/themes/ransom.json +62 -0
  90. package/.agents/skills/embedded-captions/themes/scoreboard.json +54 -0
  91. package/.agents/skills/embedded-captions/themes/spectrum.json +46 -0
  92. package/.agents/skills/embedded-captions/themes/stardust.json +29 -0
  93. package/.agents/skills/embedded-captions/themes/stomp.json +43 -0
  94. package/.agents/skills/embedded-captions/themes/terminal.json +49 -0
  95. package/.agents/skills/embedded-captions/themes/thunder.json +44 -0
  96. package/.agents/skills/embedded-captions/themes/transit.json +44 -0
  97. package/.agents/skills/embedded-captions/themes/vhs.json +47 -0
  98. package/.agents/skills/faceless-explainer/SKILL.md +209 -0
  99. package/.agents/skills/faceless-explainer/references/cut-catalog.md +215 -0
  100. package/.agents/skills/faceless-explainer/references/motion-language.md +156 -0
  101. package/.agents/skills/faceless-explainer/references/story-design.md +248 -0
  102. package/.agents/skills/faceless-explainer/references/visual-design.md +146 -0
  103. package/.agents/skills/faceless-explainer/scripts/assemble-index.mjs +570 -0
  104. package/.agents/skills/faceless-explainer/scripts/audio.mjs +260 -0
  105. package/.agents/skills/faceless-explainer/scripts/build-frame.mjs +536 -0
  106. package/.agents/skills/faceless-explainer/scripts/captions.mjs +508 -0
  107. package/.agents/skills/faceless-explainer/scripts/lib/assets.mjs +55 -0
  108. package/.agents/skills/faceless-explainer/scripts/lib/dimensions.mjs +45 -0
  109. package/.agents/skills/faceless-explainer/scripts/lib/storyboard.mjs +249 -0
  110. package/.agents/skills/faceless-explainer/scripts/lib/tokens.mjs +204 -0
  111. package/.agents/skills/faceless-explainer/scripts/lib/transition-registry.mjs +38 -0
  112. package/.agents/skills/faceless-explainer/scripts/lib/transitions.json +71 -0
  113. package/.agents/skills/faceless-explainer/scripts/transitions.mjs +320 -0
  114. package/.agents/skills/faceless-explainer/sub-agents/frame-worker.md +75 -0
  115. package/.agents/skills/flockposter/LICENSE +17 -0
  116. package/.agents/skills/flockposter/README.md +72 -0
  117. package/.agents/skills/flockposter/SKILL.md +562 -0
  118. package/.agents/skills/flockposter/examples/cli-instagram-reel.sh +21 -0
  119. package/.agents/skills/flockposter/examples/cli-multi-platform.json +69 -0
  120. package/.agents/skills/flockposter/examples/cli-tiktok-upload-only.sh +22 -0
  121. package/.agents/skills/flockposter/examples/cli-x-thread.sh +17 -0
  122. package/.agents/skills/flockposter/examples/cli-youtube-short.sh +21 -0
  123. package/.agents/skills/flockposter/examples/public-api-instagram-reel.json +28 -0
  124. package/.agents/skills/general-video/SKILL.md +143 -0
  125. package/.agents/skills/hyperframes/SKILL.md +160 -0
  126. package/.agents/skills/hyperframes-animation/SKILL.md +84 -0
  127. package/.agents/skills/hyperframes-animation/adapters/animate-text.md +64 -0
  128. package/.agents/skills/hyperframes-animation/adapters/animejs.md +114 -0
  129. package/.agents/skills/hyperframes-animation/adapters/css-animations.md +143 -0
  130. package/.agents/skills/hyperframes-animation/adapters/gsap-easing-and-stagger.md +118 -0
  131. package/.agents/skills/hyperframes-animation/adapters/gsap-timeline-and-labels.md +96 -0
  132. package/.agents/skills/hyperframes-animation/adapters/gsap-transforms-and-perf.md +96 -0
  133. package/.agents/skills/hyperframes-animation/adapters/gsap.md +105 -0
  134. package/.agents/skills/hyperframes-animation/adapters/html-in-canvas-patterns.md +507 -0
  135. package/.agents/skills/hyperframes-animation/adapters/lottie.md +117 -0
  136. package/.agents/skills/hyperframes-animation/adapters/three.md +131 -0
  137. package/.agents/skills/hyperframes-animation/adapters/typegpu.md +178 -0
  138. package/.agents/skills/hyperframes-animation/adapters/waapi.md +101 -0
  139. package/.agents/skills/hyperframes-animation/blueprints/comparison-split.md +27 -0
  140. package/.agents/skills/hyperframes-animation/blueprints/constellation-hub.md +44 -0
  141. package/.agents/skills/hyperframes-animation/blueprints/cta-morph-press.md +28 -0
  142. package/.agents/skills/hyperframes-animation/blueprints/cursor-ui-demo.md +57 -0
  143. package/.agents/skills/hyperframes-animation/blueprints/dataviz-countup.md +46 -0
  144. package/.agents/skills/hyperframes-animation/blueprints/device-surface-showcase.md +53 -0
  145. package/.agents/skills/hyperframes-animation/blueprints/grid-card-assemble.md +66 -0
  146. package/.agents/skills/hyperframes-animation/blueprints/kinetic-type-beats.md +78 -0
  147. package/.agents/skills/hyperframes-animation/blueprints/logo-assemble-lockup.md +69 -0
  148. package/.agents/skills/hyperframes-animation/blueprints/overwhelm-surround.md +28 -0
  149. package/.agents/skills/hyperframes-animation/blueprints/spatial-pan-stations.md +37 -0
  150. package/.agents/skills/hyperframes-animation/blueprints/ticker-takeover.md +29 -0
  151. package/.agents/skills/hyperframes-animation/blueprints/titlecard-reveal.md +42 -0
  152. package/.agents/skills/hyperframes-animation/blueprints/typewriter-reveal.md +51 -0
  153. package/.agents/skills/hyperframes-animation/blueprints/video-text-pivot.md +30 -0
  154. package/.agents/skills/hyperframes-animation/blueprints-index.md +146 -0
  155. package/.agents/skills/hyperframes-animation/examples/assets/avatars/02.avif +0 -0
  156. package/.agents/skills/hyperframes-animation/examples/assets/brands/github.avif +0 -0
  157. package/.agents/skills/hyperframes-animation/examples/assets/brands/nvidia.avif +0 -0
  158. package/.agents/skills/hyperframes-animation/examples/assets/brands/visa.avif +0 -0
  159. package/.agents/skills/hyperframes-animation/examples/assets/brands/zoominfo.avif +0 -0
  160. package/.agents/skills/hyperframes-animation/examples/brand-reveal-assemble-zoom.html +382 -0
  161. package/.agents/skills/hyperframes-animation/examples/comparison-split-cards.html +649 -0
  162. package/.agents/skills/hyperframes-animation/examples/concept-demo-decode-pan.html +520 -0
  163. package/.agents/skills/hyperframes-animation/examples/cta-morph-press.html +468 -0
  164. package/.agents/skills/hyperframes-animation/examples/cta-orbit-collapse.html +1298 -0
  165. package/.agents/skills/hyperframes-animation/examples/demo-page-scroll-spotlight.html +759 -0
  166. package/.agents/skills/hyperframes-animation/examples/hook-counter-burst.html +729 -0
  167. package/.agents/skills/hyperframes-animation/examples/messaging-multi-phrase.html +352 -0
  168. package/.agents/skills/hyperframes-animation/examples/metric-video-text-pivot.html +779 -0
  169. package/.agents/skills/hyperframes-animation/examples/problem-mockup-overwhelm.html +1374 -0
  170. package/.agents/skills/hyperframes-animation/examples/proof-logo-chain.html +861 -0
  171. package/.agents/skills/hyperframes-animation/examples/takeover-ticker-displace.html +347 -0
  172. package/.agents/skills/hyperframes-animation/examples/workflow-approve-press.html +606 -0
  173. package/.agents/skills/hyperframes-animation/rules/3d-page-scroll.md +227 -0
  174. package/.agents/skills/hyperframes-animation/rules/3d-text-depth-layers.md +297 -0
  175. package/.agents/skills/hyperframes-animation/rules/ai-tracking-box.md +382 -0
  176. package/.agents/skills/hyperframes-animation/rules/ambient-glow-bloom.md +305 -0
  177. package/.agents/skills/hyperframes-animation/rules/asr-keyword-glow.md +286 -0
  178. package/.agents/skills/hyperframes-animation/rules/avatar-cloud-network.md +371 -0
  179. package/.agents/skills/hyperframes-animation/rules/camera-cursor-tracking.md +246 -0
  180. package/.agents/skills/hyperframes-animation/rules/card-morph-anchor.md +267 -0
  181. package/.agents/skills/hyperframes-animation/rules/center-outward-expansion.md +227 -0
  182. package/.agents/skills/hyperframes-animation/rules/context-sensitive-cursor.md +257 -0
  183. package/.agents/skills/hyperframes-animation/rules/coordinate-target-zoom.md +332 -0
  184. package/.agents/skills/hyperframes-animation/rules/counting-dynamic-scale.md +283 -0
  185. package/.agents/skills/hyperframes-animation/rules/css-marker-patterns.md +373 -0
  186. package/.agents/skills/hyperframes-animation/rules/cursor-click-ripple.md +262 -0
  187. package/.agents/skills/hyperframes-animation/rules/depth-of-field-blur.md +313 -0
  188. package/.agents/skills/hyperframes-animation/rules/depth-scatter-assemble.md +303 -0
  189. package/.agents/skills/hyperframes-animation/rules/discrete-text-sequence.md +273 -0
  190. package/.agents/skills/hyperframes-animation/rules/dynamic-content-sequencing.md +307 -0
  191. package/.agents/skills/hyperframes-animation/rules/gsap-effects.md +299 -0
  192. package/.agents/skills/hyperframes-animation/rules/hacker-flip-3d.md +223 -0
  193. package/.agents/skills/hyperframes-animation/rules/kinetic-beat-slam.md +183 -0
  194. package/.agents/skills/hyperframes-animation/rules/motion-blur-streak.md +328 -0
  195. package/.agents/skills/hyperframes-animation/rules/multi-phase-camera.md +273 -0
  196. package/.agents/skills/hyperframes-animation/rules/orbit-3d-entry.md +301 -0
  197. package/.agents/skills/hyperframes-animation/rules/physics-press-reaction.md +350 -0
  198. package/.agents/skills/hyperframes-animation/rules/press-release-spring.md +296 -0
  199. package/.agents/skills/hyperframes-animation/rules/reactive-displacement.md +277 -0
  200. package/.agents/skills/hyperframes-animation/rules/scale-swap-transition.md +298 -0
  201. package/.agents/skills/hyperframes-animation/rules/sine-wave-loop.md +278 -0
  202. package/.agents/skills/hyperframes-animation/rules/split-tilt-cards.md +277 -0
  203. package/.agents/skills/hyperframes-animation/rules/spring-pop-entrance.md +273 -0
  204. package/.agents/skills/hyperframes-animation/rules/stat-bars-and-fills.md +156 -0
  205. package/.agents/skills/hyperframes-animation/rules/svg-icon-enrichment.md +329 -0
  206. package/.agents/skills/hyperframes-animation/rules/svg-path-draw.md +274 -0
  207. package/.agents/skills/hyperframes-animation/rules/vertical-spring-ticker.md +239 -0
  208. package/.agents/skills/hyperframes-animation/rules/viewport-change.md +349 -0
  209. package/.agents/skills/hyperframes-animation/rules-index.md +86 -0
  210. package/.agents/skills/hyperframes-animation/scripts/animation-map.mjs +606 -0
  211. package/.agents/skills/hyperframes-animation/scripts/package-loader.mjs +288 -0
  212. package/.agents/skills/hyperframes-animation/scripts/package-loader.test.mjs +62 -0
  213. package/.agents/skills/hyperframes-animation/techniques.md +507 -0
  214. package/.agents/skills/hyperframes-animation/transitions/TRANSITION-REGISTRY.md +167 -0
  215. package/.agents/skills/hyperframes-animation/transitions/catalog.md +127 -0
  216. package/.agents/skills/hyperframes-animation/transitions/css-3d.md +12 -0
  217. package/.agents/skills/hyperframes-animation/transitions/css-blur.md +51 -0
  218. package/.agents/skills/hyperframes-animation/transitions/css-cover.md +43 -0
  219. package/.agents/skills/hyperframes-animation/transitions/css-destruction.md +95 -0
  220. package/.agents/skills/hyperframes-animation/transitions/css-dissolve.md +66 -0
  221. package/.agents/skills/hyperframes-animation/transitions/css-distortion.md +45 -0
  222. package/.agents/skills/hyperframes-animation/transitions/css-grid.md +10 -0
  223. package/.agents/skills/hyperframes-animation/transitions/css-light.md +49 -0
  224. package/.agents/skills/hyperframes-animation/transitions/css-mechanical.md +30 -0
  225. package/.agents/skills/hyperframes-animation/transitions/css-other.md +25 -0
  226. package/.agents/skills/hyperframes-animation/transitions/css-push.md +41 -0
  227. package/.agents/skills/hyperframes-animation/transitions/css-radial.md +37 -0
  228. package/.agents/skills/hyperframes-animation/transitions/css-scale.md +24 -0
  229. package/.agents/skills/hyperframes-animation/transitions/overview.md +153 -0
  230. package/.agents/skills/hyperframes-cli/SKILL.md +113 -0
  231. package/.agents/skills/hyperframes-cli/references/doctor-browser.md +45 -0
  232. package/.agents/skills/hyperframes-cli/references/init-and-scaffold.md +55 -0
  233. package/.agents/skills/hyperframes-cli/references/lambda.md +132 -0
  234. package/.agents/skills/hyperframes-cli/references/lint-validate-inspect.md +121 -0
  235. package/.agents/skills/hyperframes-cli/references/preview-render.md +149 -0
  236. package/.agents/skills/hyperframes-cli/references/upgrade-info-misc.md +75 -0
  237. package/.agents/skills/hyperframes-core/SKILL.md +78 -0
  238. package/.agents/skills/hyperframes-core/references/composition-patterns.md +263 -0
  239. package/.agents/skills/hyperframes-core/references/data-attributes.md +70 -0
  240. package/.agents/skills/hyperframes-core/references/determinism-rules.md +68 -0
  241. package/.agents/skills/hyperframes-core/references/full-screen-motion.md +62 -0
  242. package/.agents/skills/hyperframes-core/references/minimal-composition.md +66 -0
  243. package/.agents/skills/hyperframes-core/references/script-format.md +49 -0
  244. package/.agents/skills/hyperframes-core/references/storyboard-format.md +95 -0
  245. package/.agents/skills/hyperframes-core/references/sub-compositions.md +237 -0
  246. package/.agents/skills/hyperframes-core/references/subagent-dispatch.md +41 -0
  247. package/.agents/skills/hyperframes-core/references/tailwind.md +125 -0
  248. package/.agents/skills/hyperframes-core/references/tracks-and-clips.md +76 -0
  249. package/.agents/skills/hyperframes-core/references/variables-and-media.md +90 -0
  250. package/.agents/skills/hyperframes-creative/SKILL.md +70 -0
  251. package/.agents/skills/hyperframes-creative/frame-presets/biennale-yellow/FRAME.md +289 -0
  252. package/.agents/skills/hyperframes-creative/frame-presets/biennale-yellow/caption-skin.html +221 -0
  253. package/.agents/skills/hyperframes-creative/frame-presets/biennale-yellow/frame-showcase.html +1214 -0
  254. package/.agents/skills/hyperframes-creative/frame-presets/blockframe/FRAME.md +275 -0
  255. package/.agents/skills/hyperframes-creative/frame-presets/blockframe/caption-skin.html +224 -0
  256. package/.agents/skills/hyperframes-creative/frame-presets/blockframe/frame-showcase.html +1347 -0
  257. package/.agents/skills/hyperframes-creative/frame-presets/blue-professional/FRAME.md +307 -0
  258. package/.agents/skills/hyperframes-creative/frame-presets/blue-professional/caption-skin.html +223 -0
  259. package/.agents/skills/hyperframes-creative/frame-presets/blue-professional/frame-showcase.html +1372 -0
  260. package/.agents/skills/hyperframes-creative/frame-presets/bold-poster/FRAME.md +275 -0
  261. package/.agents/skills/hyperframes-creative/frame-presets/bold-poster/caption-skin.html +230 -0
  262. package/.agents/skills/hyperframes-creative/frame-presets/bold-poster/frame-showcase.html +1140 -0
  263. package/.agents/skills/hyperframes-creative/frame-presets/broadside/FRAME.md +284 -0
  264. package/.agents/skills/hyperframes-creative/frame-presets/broadside/caption-skin.html +225 -0
  265. package/.agents/skills/hyperframes-creative/frame-presets/broadside/frame-showcase.html +1166 -0
  266. package/.agents/skills/hyperframes-creative/frame-presets/capsule/FRAME.md +284 -0
  267. package/.agents/skills/hyperframes-creative/frame-presets/capsule/caption-skin.html +224 -0
  268. package/.agents/skills/hyperframes-creative/frame-presets/capsule/frame-showcase.html +1465 -0
  269. package/.agents/skills/hyperframes-creative/frame-presets/cartesian/FRAME.md +278 -0
  270. package/.agents/skills/hyperframes-creative/frame-presets/cartesian/caption-skin.html +222 -0
  271. package/.agents/skills/hyperframes-creative/frame-presets/cartesian/frame-showcase.html +1263 -0
  272. package/.agents/skills/hyperframes-creative/frame-presets/claude/FRAME.md +277 -0
  273. package/.agents/skills/hyperframes-creative/frame-presets/claude/caption-skin.html +224 -0
  274. package/.agents/skills/hyperframes-creative/frame-presets/claude/frame-showcase.html +1439 -0
  275. package/.agents/skills/hyperframes-creative/frame-presets/cobalt-grid/FRAME.md +265 -0
  276. package/.agents/skills/hyperframes-creative/frame-presets/cobalt-grid/caption-skin.html +238 -0
  277. package/.agents/skills/hyperframes-creative/frame-presets/cobalt-grid/frame-showcase.html +1468 -0
  278. package/.agents/skills/hyperframes-creative/frame-presets/coral/FRAME.md +314 -0
  279. package/.agents/skills/hyperframes-creative/frame-presets/coral/caption-skin.html +226 -0
  280. package/.agents/skills/hyperframes-creative/frame-presets/coral/frame-showcase.html +1268 -0
  281. package/.agents/skills/hyperframes-creative/frame-presets/creative-mode/FRAME.md +333 -0
  282. package/.agents/skills/hyperframes-creative/frame-presets/creative-mode/caption-skin.html +227 -0
  283. package/.agents/skills/hyperframes-creative/frame-presets/creative-mode/frame-showcase.html +1330 -0
  284. package/.agents/skills/hyperframes-creative/frame-presets/daisy-days/FRAME.md +274 -0
  285. package/.agents/skills/hyperframes-creative/frame-presets/daisy-days/caption-skin.html +230 -0
  286. package/.agents/skills/hyperframes-creative/frame-presets/daisy-days/frame-showcase.html +1444 -0
  287. package/.agents/skills/hyperframes-creative/frame-presets/editorial-forest/FRAME.md +265 -0
  288. package/.agents/skills/hyperframes-creative/frame-presets/editorial-forest/caption-skin.html +223 -0
  289. package/.agents/skills/hyperframes-creative/frame-presets/editorial-forest/frame-showcase.html +1273 -0
  290. package/.agents/skills/hyperframes-creative/palettes/bold-energetic.md +14 -0
  291. package/.agents/skills/hyperframes-creative/palettes/clean-corporate.md +14 -0
  292. package/.agents/skills/hyperframes-creative/palettes/dark-premium.md +14 -0
  293. package/.agents/skills/hyperframes-creative/palettes/jewel-rich.md +14 -0
  294. package/.agents/skills/hyperframes-creative/palettes/monochrome.md +14 -0
  295. package/.agents/skills/hyperframes-creative/palettes/nature-earth.md +14 -0
  296. package/.agents/skills/hyperframes-creative/palettes/neon-electric.md +14 -0
  297. package/.agents/skills/hyperframes-creative/palettes/pastel-soft.md +14 -0
  298. package/.agents/skills/hyperframes-creative/palettes/warm-editorial.md +14 -0
  299. package/.agents/skills/hyperframes-creative/references/audio-reactive.md +76 -0
  300. package/.agents/skills/hyperframes-creative/references/beat-direction.md +164 -0
  301. package/.agents/skills/hyperframes-creative/references/composition-patterns.md +199 -0
  302. package/.agents/skills/hyperframes-creative/references/data-in-motion.md +19 -0
  303. package/.agents/skills/hyperframes-creative/references/design-adherence.md +19 -0
  304. package/.agents/skills/hyperframes-creative/references/design-picker.md +123 -0
  305. package/.agents/skills/hyperframes-creative/references/design-spec.md +55 -0
  306. package/.agents/skills/hyperframes-creative/references/house-style.md +73 -0
  307. package/.agents/skills/hyperframes-creative/references/motion-principles.md +150 -0
  308. package/.agents/skills/hyperframes-creative/references/narration.md +92 -0
  309. package/.agents/skills/hyperframes-creative/references/prompt-expansion.md +68 -0
  310. package/.agents/skills/hyperframes-creative/references/typography.md +218 -0
  311. package/.agents/skills/hyperframes-creative/references/video-composition.md +63 -0
  312. package/.agents/skills/hyperframes-creative/references/visual-styles.md +457 -0
  313. package/.agents/skills/hyperframes-creative/scripts/contrast-report.mjs +353 -0
  314. package/.agents/skills/hyperframes-creative/scripts/extract-audio-data.py +188 -0
  315. package/.agents/skills/hyperframes-creative/scripts/package-loader.mjs +288 -0
  316. package/.agents/skills/hyperframes-creative/scripts/package-loader.test.mjs +62 -0
  317. package/.agents/skills/hyperframes-creative/templates/design-picker.html +1432 -0
  318. package/.agents/skills/hyperframes-keyframes/SKILL.md +237 -0
  319. package/.agents/skills/hyperframes-keyframes/agents/openai.yaml +4 -0
  320. package/.agents/skills/hyperframes-keyframes/references/keyframe-patterns.md +106 -0
  321. package/.agents/skills/motion-graphics/SKILL.md +172 -0
  322. package/.agents/skills/motion-graphics/agents/builder.md +40 -0
  323. package/.agents/skills/motion-graphics/agents/director.md +53 -0
  324. package/.agents/skills/motion-graphics/agents/finalize.md +17 -0
  325. package/.agents/skills/motion-graphics/catalog-map.md +40 -0
  326. package/.agents/skills/motion-graphics/categories/asset-fusion/module.md +37 -0
  327. package/.agents/skills/motion-graphics/categories/charts/module.md +21 -0
  328. package/.agents/skills/motion-graphics/categories/kinetic-type/module.md +19 -0
  329. package/.agents/skills/motion-graphics/categories/logo-reveal/module.md +17 -0
  330. package/.agents/skills/motion-graphics/categories/lower-thirds/module.md +16 -0
  331. package/.agents/skills/motion-graphics/categories/maps/bake-basemap.mjs +273 -0
  332. package/.agents/skills/motion-graphics/categories/maps/module.md +61 -0
  333. package/.agents/skills/motion-graphics/categories/news/module.md +56 -0
  334. package/.agents/skills/motion-graphics/categories/stat/module.md +21 -0
  335. package/.agents/skills/motion-graphics/categories/tweet/module.md +16 -0
  336. package/.agents/skills/motion-graphics/categories/webpage/module.md +21 -0
  337. package/.agents/skills/motion-graphics/grounding/PROTOCOL.md +64 -0
  338. package/.agents/skills/motion-graphics/grounding/locate.mjs +227 -0
  339. package/.agents/skills/motion-graphics/phases/source/guide.md +21 -0
  340. package/.agents/skills/motion-graphics/references/builder-contract.md +38 -0
  341. package/.agents/skills/motion-graphics/references/motion-vocabulary.md +43 -0
  342. package/.agents/skills/motion-graphics/references/shot-plan-ir.md +54 -0
  343. package/.agents/skills/motion-graphics/samples/asset-fusion/_ref-circle-highlight.html +306 -0
  344. package/.agents/skills/product-launch-video/SKILL.md +208 -0
  345. package/.agents/skills/product-launch-video/references/cut-catalog.md +220 -0
  346. package/.agents/skills/product-launch-video/references/motion-language.md +156 -0
  347. package/.agents/skills/product-launch-video/references/story-design.md +373 -0
  348. package/.agents/skills/product-launch-video/references/visual-design.md +126 -0
  349. package/.agents/skills/product-launch-video/scripts/assemble-index.mjs +570 -0
  350. package/.agents/skills/product-launch-video/scripts/audio.mjs +260 -0
  351. package/.agents/skills/product-launch-video/scripts/build-frame.mjs +536 -0
  352. package/.agents/skills/product-launch-video/scripts/captions.mjs +508 -0
  353. package/.agents/skills/product-launch-video/scripts/lib/assets.mjs +55 -0
  354. package/.agents/skills/product-launch-video/scripts/lib/dimensions.mjs +45 -0
  355. package/.agents/skills/product-launch-video/scripts/lib/pad-frame-duration.mjs +36 -0
  356. package/.agents/skills/product-launch-video/scripts/lib/pad-frame-duration.test.mjs +76 -0
  357. package/.agents/skills/product-launch-video/scripts/lib/storyboard.mjs +249 -0
  358. package/.agents/skills/product-launch-video/scripts/lib/tokens.mjs +204 -0
  359. package/.agents/skills/product-launch-video/scripts/lib/transition-registry.mjs +38 -0
  360. package/.agents/skills/product-launch-video/scripts/lib/transitions.json +71 -0
  361. package/.agents/skills/product-launch-video/scripts/stage-assets.mjs +39 -0
  362. package/.agents/skills/product-launch-video/scripts/transitions.mjs +327 -0
  363. package/.agents/skills/product-launch-video/sub-agents/frame-worker.md +75 -0
  364. package/.agents/skills/slideshow/SKILL.md +550 -0
  365. package/.agents/skills/slideshow/references/standalone-harness.md +1020 -0
  366. package/.agents/skills/talking-head-recut/NOTICE.md +39 -0
  367. package/.agents/skills/talking-head-recut/SKILL.md +1195 -0
  368. package/.agents/skills/talking-head-recut/assets/vendor/gsap.min.js +10 -0
  369. package/.agents/skills/talking-head-recut/references/DESIGN_INDEX.md +145 -0
  370. package/.agents/skills/talking-head-recut/references/frames/clean.html +92 -0
  371. package/.agents/skills/talking-head-recut/references/frames/hairline.html +171 -0
  372. package/.agents/skills/talking-head-recut/references/frames/polaroid.html +131 -0
  373. package/.agents/skills/talking-head-recut/references/layouts/overlay.html +164 -0
  374. package/.agents/skills/talking-head-recut/references/layouts/pip.html +143 -0
  375. package/.agents/skills/talking-head-recut/references/layouts/split.html +121 -0
  376. package/.agents/skills/talking-head-recut/references/layouts/stack.html +109 -0
  377. package/.agents/skills/talking-head-recut/references/styles/academic.html +172 -0
  378. package/.agents/skills/talking-head-recut/references/styles/audit.html +170 -0
  379. package/.agents/skills/talking-head-recut/references/styles/editorial.html +189 -0
  380. package/.agents/skills/talking-head-recut/references/styles/geom.html +181 -0
  381. package/.agents/skills/talking-head-recut/references/styles/minimal.html +130 -0
  382. package/.agents/skills/talking-head-recut/references/styles/spotlight.html +142 -0
  383. package/.agents/skills/talking-head-recut/references/styles/swiss.html +188 -0
  384. package/.agents/skills/talking-head-recut/references/styles/terminal.html +196 -0
  385. package/.agents/skills/talking-head-recut/references/styles/whiteboard.html +170 -0
  386. package/.agents/skills/talking-head-recut/references/styles/xhs.html +206 -0
  387. package/.agents/skills/vidfarm-media/SKILL.md +85 -0
  388. package/.agents/skills/vidfarm-media/references/tts.md +54 -0
  389. package/.agents/skills/vidfarm-media/scripts/audio.mjs +628 -0
  390. package/.agents/skills/vidfarm-media/scripts/wait-bgm.mjs +31 -0
  391. package/.agents/skills/website-to-video/SKILL.md +145 -0
  392. package/.agents/skills/website-to-video/assets/sfx/CREDITS.md +35 -0
  393. package/.agents/skills/website-to-video/assets/sfx/manifest.json +97 -0
  394. package/.agents/skills/website-to-video/references/beat-builder-guide.md +263 -0
  395. package/.agents/skills/website-to-video/references/capabilities.md +713 -0
  396. package/.agents/skills/website-to-video/references/step-0-capture.md +55 -0
  397. package/.agents/skills/website-to-video/references/step-1-design.md +333 -0
  398. package/.agents/skills/website-to-video/references/step-2-brief.md +178 -0
  399. package/.agents/skills/website-to-video/references/step-3-storyboard.md +572 -0
  400. package/.agents/skills/website-to-video/references/step-4-vo.md +225 -0
  401. package/.agents/skills/website-to-video/references/step-5-build.md +483 -0
  402. package/.agents/skills/website-to-video/references/step-6-validate.md +341 -0
  403. package/.agents/skills/website-to-video/scripts/w2h-verify.mjs +759 -0
  404. package/SKILL.director.md +37 -0
  405. package/SKILL.platform.md +6 -1
  406. package/demo/dist/app.js +295 -11
  407. package/dist/src/app.js +317 -133
  408. package/dist/src/cli.js +529 -12
  409. package/dist/src/composition-runtime.js +262 -3
  410. package/dist/src/devcli/doctor.js +192 -0
  411. package/dist/src/devcli/hyperframes-cli.js +118 -0
  412. package/dist/src/devcli/skills.js +476 -0
  413. package/dist/src/devcli/stills.js +249 -0
  414. package/dist/src/editor-chat.js +255 -0
  415. package/dist/src/hyperframes/composition.js +5 -5
  416. package/dist/src/services/composition-lint.js +199 -0
  417. package/dist/src/services/hyperframes.js +67 -13
  418. package/package.json +2 -1
@@ -0,0 +1,509 @@
1
+ #!/usr/bin/env bash
2
+ # End-to-end: hyperframes render + ffmpeg overlay matte → final.mp4
3
+ #
4
+ # Usage:
5
+ # bash render-and-composite.sh <project-dir> [hyperframes-repo-path]
6
+ #
7
+ # Env:
8
+ # HYPERFRAMES_ROOT override the hyperframes checkout location
9
+
10
+ set -euo pipefail
11
+
12
+ PROJECT="${1:?usage: render-and-composite.sh <project-dir> [hyperframes-repo]}"
13
+ PROJECT="$(cd "$PROJECT" && pwd)"
14
+
15
+ # Resolve the hyperframes CLI. Candidate order:
16
+ # 1. arg 2 2. $HYPERFRAMES_ROOT 3. repo root if this skill ships INSIDE the
17
+ # hyperframes repo (skills/embedded-captions/scripts → ../../..) 4. ~/Downloads/hyperframes
18
+ # 5. the installed hyperframes npm package (vidfarm-devcli ships it) 6. npx -y hyperframes
19
+ SKILL_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20
+ HF=""
21
+ for cand in "${2:-}" "${HYPERFRAMES_ROOT:-}" "$(cd "$SKILL_SCRIPT_DIR/../../.." 2>/dev/null && pwd)" "$HOME/Downloads/hyperframes"; do
22
+ if [[ -n "$cand" && -f "$cand/packages/cli/dist/cli.js" ]]; then HF="$cand"; break; fi
23
+ done
24
+ HF_CLI=""; HF_NPX=""
25
+ if [[ -n "$HF" ]]; then
26
+ export HYPERFRAMES_ROOT="$HF" # so the occlusion gate's measure-layout.cjs finds puppeteer too
27
+ HF_CLI="$HF/packages/cli/dist/cli.js"
28
+ else
29
+ # No built checkout — fall back to the npm package from this script's ancestor
30
+ # node_modules, else plain npx (fetches the CLI on demand).
31
+ HF_CLI="$(node -e 'process.stdout.write(require.resolve("hyperframes/dist/cli.js",{paths:[process.argv[1],process.cwd()]}))' "$SKILL_SCRIPT_DIR" 2>/dev/null || true)"
32
+ [[ -n "$HF_CLI" ]] || HF_NPX=1
33
+ # measure-layout.cjs (the occlusion gate) locates puppeteer ONLY via candidate
34
+ # roots' node_modules/puppeteer — without HYPERFRAMES_ROOT it exits 3 and aborts
35
+ # every npm-installed run. Resolve where the npm package's puppeteer actually
36
+ # lives (createRequire from the resolved CLI path) and export the directory
37
+ # whose node_modules contains it (handles npm-flat AND pnpm store layouts).
38
+ HF_PUP_ROOT=""
39
+ if [[ -n "$HF_CLI" ]]; then
40
+ HF_PUP_ROOT="$(node -e '
41
+ const { createRequire } = require("module");
42
+ const path = require("path");
43
+ const fs = require("fs");
44
+ try {
45
+ const pkg = createRequire(process.argv[1]).resolve("puppeteer/package.json");
46
+ const marker = path.sep + "node_modules" + path.sep;
47
+ const idx = pkg.lastIndexOf(marker);
48
+ const root = idx >= 0 ? pkg.slice(0, idx) : path.dirname(path.dirname(path.dirname(pkg)));
49
+ if (fs.existsSync(path.join(root, "node_modules", "puppeteer"))) process.stdout.write(root);
50
+ } catch { /* unresolvable — caller warns */ }
51
+ ' "$HF_CLI" 2>/dev/null || true)"
52
+ fi
53
+ if [[ -n "$HF_PUP_ROOT" ]]; then
54
+ export HYPERFRAMES_ROOT="$HF_PUP_ROOT"
55
+ else
56
+ echo "[render] WARN: puppeteer is not resolvable from the npm-installed hyperframes CLI — the occlusion/overflow gates (measure-layout.cjs) cannot run. Set HYPERFRAMES_ROOT to a checkout whose node_modules has puppeteer, or run with OCCLUSION_SKIP=1 to continue without the occlusion gate." >&2
57
+ fi
58
+ fi
59
+ # hf_run: invoke the hyperframes CLI, whichever way it resolved. Every spawn gets
60
+ # a fresh EMPTY HeyGen config dir — a stray ~/.heygen credential must never flip
61
+ # the CLI's audio-provider preference (same isolation as matte.cjs/transcribe.cjs).
62
+ HF_EMPTY_HEYGEN_DIR="$(mktemp -d)"
63
+ hf_run() {
64
+ if [[ -n "$HF_NPX" ]]; then
65
+ HYPERFRAMES_NO_TELEMETRY=1 HYPERFRAMES_SKIP_SKILLS=1 HEYGEN_CONFIG_DIR="$HF_EMPTY_HEYGEN_DIR" npx -y hyperframes "$@"
66
+ else
67
+ HYPERFRAMES_NO_TELEMETRY=1 HYPERFRAMES_SKIP_SKILLS=1 HEYGEN_CONFIG_DIR="$HF_EMPTY_HEYGEN_DIR" node "$HF_CLI" "$@"
68
+ fi
69
+ }
70
+ if [[ ! -d "$PROJECT/frames_fg" ]]; then
71
+ echo "[render] missing matte frames at $PROJECT/frames_fg — run matte.cjs first" >&2
72
+ exit 1
73
+ fi
74
+ # Which compiler owns this project? Cinematic = make-composition.cjs (plan.json).
75
+ # (Standard mode retired 2026-06-12 — rail-surface needs are served by theme
76
+ # DNAs like "anchor"; legacy standard.json projects re-render from their
77
+ # existing index.html or via the archived compiler in embedded-captions-archive.)
78
+ compiler_for() {
79
+ echo "make-composition.cjs"
80
+ }
81
+ if [[ ! -f "$PROJECT/index.html" ]]; then
82
+ if [[ -f "$PROJECT/plan.json" ]]; then
83
+ C="$(compiler_for)"
84
+ echo "[render] no index.html — auto-compiling via $C"
85
+ node "$(dirname "$0")/$C" "$PROJECT"
86
+ elif [[ -f "$PROJECT/cinematic.json" ]]; then
87
+ # cinematic.json-only project: the full compiler lowers blocks → plan.json → html
88
+ echo "[render] no index.html — auto-compiling via make-cinematic.cjs"
89
+ node "$(dirname "$0")/make-cinematic.cjs" "$PROJECT"
90
+ else
91
+ echo "[render] missing $PROJECT/index.html and standard.json/plan.json/cinematic.json — author + compile first" >&2
92
+ exit 1
93
+ fi
94
+ elif [[ -f "$PROJECT/cinematic.json" && "$PROJECT/cinematic.json" -nt "$PROJECT/index.html" ]]; then
95
+ echo "[render] cinematic.json newer than index.html — recompiling"
96
+ node "$(dirname "$0")/make-cinematic.cjs" "$PROJECT"
97
+ elif [[ -f "$PROJECT/plan.json" && "$PROJECT/plan.json" -nt "$PROJECT/index.html" ]]; then
98
+ C="$(compiler_for)"
99
+ echo "[render] plan.json newer than index.html — recompiling via $C"
100
+ node "$(dirname "$0")/$C" "$PROJECT"
101
+ else
102
+ # the COMPILERS themselves may have changed since this project last compiled —
103
+ # rendering stale HTML after a compiler fix silently re-ships the old bug
104
+ C="$(compiler_for)"
105
+ RECOMPILER="$C"
106
+ # for cinematic projects the FULL compiler is make-cinematic (compiler_for points
107
+ # at make-composition, which only re-emits html from an already-compiled plan)
108
+ if [[ -f "$PROJECT/cinematic.json" && "$C" == "make-composition.cjs" ]]; then RECOMPILER="make-cinematic.cjs"; fi
109
+ ENGINE="$(dirname "$0")/../modes/cinematic/engine.html"
110
+ if [[ "$(dirname "$0")/$RECOMPILER" -nt "$PROJECT/index.html" || "$(dirname "$0")/lib-dna.cjs" -nt "$PROJECT/index.html" || ( -f "$ENGINE" && "$ENGINE" -nt "$PROJECT/index.html" ) ]]; then
111
+ echo "[render] compiler/engine newer than index.html — recompiling via $RECOMPILER"
112
+ node "$(dirname "$0")/$RECOMPILER" "$PROJECT"
113
+ fi
114
+ fi
115
+
116
+ # Embed template fonts BEFORE the gates + render. hyperframes only auto-supplies
117
+ # its ~18 canonical fonts; every other template family (Anton, Bangers, VT323,
118
+ # Press Start 2P, …) silently falls back to a generic font on a clean/offline/CI
119
+ # machine — it only "looks right" locally when that font happens to be installed
120
+ # as a system font. inject-fonts inlines the @font-face (base64 woff2, from
121
+ # modes/standard/fonts/fonts.css) for whatever non-canonical families each HTML
122
+ # actually uses, so measure-layout AND the capture see the true glyph metrics.
123
+ # Idempotent; a no-op when every font is canonical/system or already declared.
124
+ node "$(dirname "$0")/inject-fonts.cjs" "$PROJECT" \
125
+ || echo "[render] (font embed skipped — inject-fonts.cjs/fonts.css unavailable)" >&2
126
+
127
+ # gate ledger — each gate appends one line; echoed as a summary before "done"
128
+ # (verdicts were drowning hundreds of lines up in ffmpeg logs)
129
+ GATES="$PROJECT/_gates.txt"; : > "$GATES"
130
+
131
+ # Gate: plan.json word timings must align with transcript.json within 80ms.
132
+ # A caption whose animation fires 500ms before or after the word is spoken
133
+ # breaks the "belongs to the scene" illusion — hard fail, not a warning.
134
+ # Skip only if transcript.json is missing (custom mode without transcript).
135
+ if [[ -f "$PROJECT/plan.json" && -f "$PROJECT/transcript.json" ]]; then
136
+ if ! node "$(dirname "$0")/check-timing.cjs" "$PROJECT" --strict; then
137
+ echo "[render] ABORTED — fix plan.json word timings to match transcript.json, then re-run." >&2
138
+ exit 2
139
+ fi
140
+ echo "timing PASS (strict)" >> "$GATES"
141
+ fi
142
+
143
+ # Gate: subject occlusion + frame-edge overflow — pixel-perfect via Chromium DOM
144
+ # rects (measure-layout.cjs) × the subject-matte alpha (sharp). Template mode only
145
+ # (skipped when plan.json is absent; custom mode uses check-overflow.cjs below).
146
+ if [[ -f "$PROJECT/plan.json" && -d "$PROJECT/frames_fg" ]]; then
147
+ # check-occlusion prints its verdict, then can intermittently hang on native
148
+ # (sharp/libvips) teardown — which would wedge the whole render. Run it under a
149
+ # watchdog: once the verdict is printed, a stuck exit can't block us. We read the
150
+ # pass/fail from its OUTPUT, not its exit code, so the hang is harmless.
151
+ OCC_LOG="$PROJECT/_occlusion.log"
152
+ node "$(dirname "$0")/check-occlusion.cjs" "$PROJECT" --strict > "$OCC_LOG" 2>&1 &
153
+ OCC_PID=$!; occ_t0=$SECONDS; OCC_RC=""; verdict_at=""
154
+ while kill -0 "$OCC_PID" 2>/dev/null; do
155
+ # mark when the verdict header is printed (analysis done). if-form: a failed grep
156
+ # must NOT trip set -e (it silently killed the whole render on fresh projects).
157
+ if [[ -z "$verdict_at" ]] && grep -qE '\[v2\].*word-fail' "$OCC_LOG" 2>/dev/null; then verdict_at=$SECONDS; fi
158
+ # verdict printed but still alive 8s later → native (sharp) teardown hang; or no
159
+ # verdict after 150s → measure/analysis stuck. Either way: kill + read verdict.
160
+ if { [[ -n "$verdict_at" ]] && (( SECONDS - verdict_at > 8 )); } || (( SECONDS - occ_t0 > 150 )); then
161
+ kill -9 "$OCC_PID" 2>/dev/null
162
+ if grep -q 'cap(s) FAIL' "$OCC_LOG"; then OCC_RC=2; else OCC_RC=0; fi
163
+ echo "[render] occlusion gate hung after verdict (sharp teardown) — killed zombie; verdict rc=$OCC_RC" >&2
164
+ break
165
+ fi
166
+ sleep 2
167
+ done
168
+ if [[ -z "$OCC_RC" ]]; then OCC_RC=0; wait "$OCC_PID" 2>/dev/null || OCC_RC=$?; fi # capture rc without tripping set -e
169
+ cat "$OCC_LOG"
170
+ if (( OCC_RC != 0 )); then
171
+ echo "[render] ABORTED — fix plan.json layout to reduce subject occlusion / frame-edge overflow, then re-run." >&2
172
+ echo " Override: OCCLUSION_SKIP=1 bash render-and-composite.sh <project>" >&2
173
+ if [[ "${OCCLUSION_SKIP:-0}" != "1" ]]; then
174
+ exit 2
175
+ fi
176
+ echo "[render] OCCLUSION_SKIP=1 set — continuing despite occlusion/overflow warnings." >&2
177
+ echo "occlusion+overflow OVERRIDDEN (OCCLUSION_SKIP=1 — conscious accept)" >> "$GATES"
178
+ fi
179
+ if (( OCC_RC == 0 )); then echo "occlusion+overflow PASS" >> "$GATES"; fi
180
+ fi
181
+
182
+ # Custom mode (no plan.json) skips the template gates above. Run a lightweight,
183
+ # mode-agnostic frame-overflow check as a WARNING only — custom designs may bleed
184
+ # off-frame intentionally, so it never aborts, but it surfaces captions that fall
185
+ # off the canvas (the failure we otherwise only catch by eye).
186
+ if [[ ! -f "$PROJECT/plan.json" && -f "$PROJECT/index.html" && -f "$(dirname "$0")/check-overflow.cjs" ]]; then
187
+ node "$(dirname "$0")/check-overflow.cjs" "$PROJECT" \
188
+ || echo "[render] (overflow check skipped — Chromium/puppeteer unavailable)" >&2
189
+ echo "overflow(index) checked (custom mode, warning-only)" >> "$GATES"
190
+ fi
191
+ # rail.html gets NO other automated coverage (the occlusion gate only reads plan.json
192
+ # caps) — run its overflow check whenever it exists. Was dead code inside the
193
+ # no-plan.json branch: Standard always HAS a derived plan.json, so it never ran.
194
+ if [[ -f "$PROJECT/rail.html" && -f "$(dirname "$0")/check-overflow.cjs" ]]; then
195
+ if node "$(dirname "$0")/check-overflow.cjs" "$PROJECT" rail.html; then
196
+ echo "overflow(rail) PASS" >> "$GATES"
197
+ else
198
+ echo "[render] (rail overflow check skipped — Chromium/puppeteer unavailable)" >&2
199
+ echo "overflow(rail) skipped (infra)" >> "$GATES"
200
+ fi
201
+ fi
202
+
203
+ # Standard hand-off gate: the PROMOTED climax word must NOT also be revealed in the
204
+ # rail during the climax's on-screen window (PIPELINE.md "Rail ↔ climax hand-off").
205
+ # Hard-fails on a CONFIRMED duplicate; infra issues (no puppeteer, etc.) exit 0 and
206
+ # never block. Override with RAIL_CLIMAX_SKIP=1 for a deliberate exception.
207
+ if [[ -f "$PROJECT/rail.html" && -f "$PROJECT/index.html" && -f "$(dirname "$0")/check-rail-climax.cjs" ]]; then
208
+ if ! node "$(dirname "$0")/check-rail-climax.cjs" "$PROJECT"; then
209
+ echo "[render] ABORTED — the promoted climax word is duplicated in the rail." >&2
210
+ echo " Apply the rail↔climax hand-off (PIPELINE.md), then re-run." >&2
211
+ echo " Override: RAIL_CLIMAX_SKIP=1 bash render-and-composite.sh <project>" >&2
212
+ if [[ "${RAIL_CLIMAX_SKIP:-0}" != "1" ]]; then
213
+ exit 2
214
+ fi
215
+ echo "[render] RAIL_CLIMAX_SKIP=1 — continuing despite the rail/climax duplicate." >&2
216
+ echo "rail-climax OVERRIDDEN (RAIL_CLIMAX_SKIP=1)" >> "$GATES"
217
+ else
218
+ echo "rail-climax PASS (no duplicate reveal)" >> "$GATES"
219
+ fi
220
+ fi
221
+
222
+ # FPS: matte.fps (written by matte.cjs at the source's NATIVE rate) is authoritative
223
+ # so the matte overlay stays frame-aligned with the render. Falls back to plan.fps /
224
+ # frame-count inference / 24. Warn if plan.json fps disagrees with the matte.
225
+ FPS=""
226
+ if [[ -f "$PROJECT/matte.fps" ]]; then
227
+ FPS="$(tr -dc '0-9' < "$PROJECT/matte.fps")"
228
+ if [[ -f "$PROJECT/plan.json" ]]; then
229
+ PFPS="$(node -e 'try{process.stdout.write(String(require(process.argv[1]).fps??""))}catch(e){}' "$PROJECT/plan.json" 2>/dev/null || true)"
230
+ if [[ -n "$PFPS" && "$PFPS" != "$FPS" ]]; then
231
+ echo "[render] WARN: plan.json fps=$PFPS != matte fps=$FPS — using matte fps to keep occlusion aligned" >&2
232
+ fi
233
+ fi
234
+ fi
235
+ if [[ -z "$FPS" || "$FPS" == "0" ]]; then
236
+ if [[ -f "$PROJECT/plan.json" ]]; then
237
+ FPS="$(node -e 'process.stdout.write(String(require(process.argv[1]).fps??24))' "$PROJECT/plan.json")"
238
+ elif [[ -d "$PROJECT/frames_fg" ]]; then
239
+ N="$(ls "$PROJECT/frames_fg" | wc -l | tr -d ' ')"
240
+ DUR="$(grep -oE 'data-duration="[0-9.]+"' "$PROJECT/index.html" | head -1 | grep -oE '[0-9.]+' || echo '')"
241
+ if [[ -n "$DUR" && "$N" -gt 0 ]]; then
242
+ FPS="$(awk "BEGIN{printf \"%d\", $N/$DUR + 0.5}")"
243
+ else
244
+ FPS=24
245
+ fi
246
+ else
247
+ FPS=24
248
+ fi
249
+ fi
250
+
251
+ # Caption layer: "bg" (classic embed — matte overlays subject on top of caps)
252
+ # or "fg" (captions always on top — announcement feel, used for 9:16 portraits
253
+ # where the subject fills the frame and bg mode loses too much to occlusion).
254
+ # Precedence: CLI env flag > plan.json > HTML data attribute > "bg".
255
+ CAPTION_LAYER="${CAPTION_LAYER_FLAG:-}"
256
+ if [[ -z "$CAPTION_LAYER" && -f "$PROJECT/plan.json" ]]; then
257
+ CAPTION_LAYER="$(node -e 'process.stdout.write(String(require(process.argv[1]).caption_layer??"bg"))' "$PROJECT/plan.json")"
258
+ fi
259
+ if [[ -z "$CAPTION_LAYER" && -f "$PROJECT/index.html" ]]; then
260
+ ATTR="$(grep -oE 'data-caption-layer="(bg|fg)"' "$PROJECT/index.html" | head -1 | grep -oE '(bg|fg)' || true)"
261
+ if [[ -n "$ATTR" ]]; then CAPTION_LAYER="$ATTR"; fi
262
+ fi
263
+ CAPTION_LAYER="${CAPTION_LAYER:-bg}"
264
+ echo "[render] caption_layer=$CAPTION_LAYER"
265
+
266
+ BG="$PROJECT/bg_plus_caps.mp4"
267
+ FINAL="$PROJECT/final.mp4"
268
+
269
+ # Snapshot the current index.html + plan.json into history/ so the user
270
+ # can recover a prior iteration's design after further edits overwrite it.
271
+ HISTORY_DIR="$PROJECT/history"
272
+ mkdir -p "$HISTORY_DIR"
273
+ STAMP="$(date +%Y%m%d-%H%M%S)"
274
+ cp "$PROJECT/index.html" "$HISTORY_DIR/index-${STAMP}.html"
275
+ cp "$PROJECT/plan.json" "$HISTORY_DIR/plan-${STAMP}.json" 2>/dev/null || true
276
+ echo "[render] snapshot → history/index-${STAMP}.html"
277
+
278
+ echo "[render] hyperframes render @ ${FPS}fps"
279
+
280
+ # Hyperframes occasionally hangs on Chromium shutdown *after* the output file
281
+ # is successfully written (seen multiple times on 15–30s clips). Without a
282
+ # guard the shell waits forever. This helper enforces a max wall-clock budget,
283
+ # and if the output is already on disk when we hit it, treats the run as
284
+ # successful and kills the zombie. Tune HF_TIMEOUT_S via env if needed.
285
+ # Default SCALES with clip size: two parallel Chromium passes on a long clip
286
+ # legitimately exceed a fixed 240s (a 38s/1151-frame render was killed at 244s
287
+ # while healthy). ~1.5s per source frame, floor 240s.
288
+ N_FRAMES="$(ls "$PROJECT/frames_fg" 2>/dev/null | wc -l | tr -d ' ')"
289
+ HF_TIMEOUT_S="${HF_TIMEOUT_S:-$(( N_FRAMES * 3 / 2 > 240 ? N_FRAMES * 3 / 2 : 240 ))}"
290
+ # hf_render_dir: render one hyperframes composition.
291
+ # args: <output.mp4> <label> <project_dir>
292
+ # watches for the Chromium-shutdown-hang; if output file exists and is >1MB
293
+ # past timeout, treats as success and kills the zombie.
294
+ hf_render_dir() {
295
+ local out="$1" label="$2" proj="$3" fmt="${4:-}"
296
+ # bash 3.2 (macOS) throws on empty-array expansion under `set -u`, so branch
297
+ # explicitly instead of splatting an optional --format array.
298
+ if [[ -n "$fmt" ]]; then
299
+ hf_run render --skill=embedded-captions --dir "$proj" --fps "$FPS" --format "$fmt" --crf 11 -o "$out" &
300
+ else
301
+ hf_run render --skill=embedded-captions --dir "$proj" --fps "$FPS" --crf 11 -o "$out" &
302
+ fi
303
+ local pid=$! start=$SECONDS elapsed
304
+ while kill -0 "$pid" 2>/dev/null; do
305
+ elapsed=$((SECONDS - start))
306
+ if (( elapsed > HF_TIMEOUT_S )); then
307
+ local sz=0
308
+ [[ -f "$out" ]] && sz=$(stat -f%z "$out" 2>/dev/null || echo 0)
309
+ if (( sz > 1000000 )); then
310
+ echo "[render] ${label}: node hung ${elapsed}s after shutdown (output ${sz}B exists, treating as success)"
311
+ kill -9 "$pid" 2>/dev/null
312
+ pkill -9 -f "puppeteer_dev_chrome_profile" 2>/dev/null
313
+ return 0
314
+ fi
315
+ echo "[render] ${label}: hung ${elapsed}s with no output — killing and failing" >&2
316
+ kill -9 "$pid" 2>/dev/null
317
+ pkill -9 -f "puppeteer_dev_chrome_profile" 2>/dev/null
318
+ return 2
319
+ fi
320
+ sleep 5
321
+ done
322
+ wait "$pid" 2>/dev/null
323
+ [[ -f "$out" ]]
324
+ }
325
+
326
+ # Link a project's assets into a shadow render dir EXCEPT the files we manage
327
+ # (the HTML we override + render outputs/intermediates). Links every other entry by
328
+ # its real name, so the shadow resolves whatever media the HTML references — including
329
+ # the ORIGINAL video filename `hyperframes init` scaffolds (e.g. clip.mp4), not just a
330
+ # fixed allow-list. Prevents the shadow-render 404 → silent/frozen output → abort.
331
+ link_assets() { # <project> <shadow>
332
+ local proj="$1" sh="$2" b
333
+ for p in "$proj"/*; do
334
+ [[ -e "$p" ]] || continue
335
+ b="$(basename "$p")"
336
+ case "$b" in
337
+ index.html|rail.html|index_fg.html|final.mp4|bg_plus_caps.mp4|fg_caps.mp4|rail.webm|history|_*) continue;;
338
+ esac
339
+ ln -sf "$p" "$sh/$b"
340
+ done
341
+ }
342
+
343
+ # Hybrid renders need 2 independent hyperframes passes. They share no state, so
344
+ # we run them in parallel (one in the main PROJECT, one in a shadow dir with
345
+ # index_fg.html renamed to index.html). Saves ~half of the Chromium cost.
346
+ FG_SHADOW=""
347
+ if [[ -f "$PROJECT/index_fg.html" ]]; then
348
+ FG_SHADOW="$PROJECT/_fg_shadow"
349
+ rm -rf "$FG_SHADOW" && mkdir -p "$FG_SHADOW"
350
+ # Link shared assets (any media filename); copy index_fg.html into shadow as index.html.
351
+ link_assets "$PROJECT" "$FG_SHADOW"
352
+ cp "$PROJECT/index_fg.html" "$FG_SHADOW/index.html"
353
+
354
+ FG_CAPS="$PROJECT/fg_caps.mp4"
355
+ echo "[render] hybrid fg/bg — launching both passes in parallel"
356
+ hf_render_dir "$BG" "bg_plus_caps" "$PROJECT" &
357
+ BG_PID=$!
358
+ hf_render_dir "$FG_CAPS" "fg_caps" "$FG_SHADOW" &
359
+ FG_PID=$!
360
+ # Wait for both; fail if either fails.
361
+ BG_RC=0; wait "$BG_PID" || BG_RC=$?
362
+ FG_RC=0; wait "$FG_PID" || FG_RC=$?
363
+ rm -rf "$FG_SHADOW"
364
+ if (( BG_RC != 0 )); then echo "[render] bg render failed" >&2; exit 1; fi
365
+ if (( FG_RC != 0 )); then echo "[render] fg render failed" >&2; exit 1; fi
366
+ elif [[ -f "$PROJECT/rail.html" ]]; then
367
+ # Standard mode: TWO independent hyperframes passes (base = index.html with the
368
+ # embed; rail = rail.html transparent). Each renders from its own shadow dir (the
369
+ # multiple-root ambiguity), and they share no state — run them IN PARALLEL like
370
+ # the fg-hybrid above (~halves the Chromium wall time). The rail webm is consumed
371
+ # by the composite stage below, which finds it already rendered.
372
+ BASE_SHADOW="$PROJECT/_base_shadow"; rm -rf "$BASE_SHADOW"; mkdir -p "$BASE_SHADOW"
373
+ link_assets "$PROJECT" "$BASE_SHADOW"
374
+ cp "$PROJECT/index.html" "$BASE_SHADOW/index.html"
375
+ RAIL_SHADOW="$PROJECT/_rail_shadow"; rm -rf "$RAIL_SHADOW"; mkdir -p "$RAIL_SHADOW"
376
+ link_assets "$PROJECT" "$RAIL_SHADOW"
377
+ cp "$PROJECT/rail.html" "$RAIL_SHADOW/index.html"
378
+ RAIL_WEBM="$PROJECT/rail.webm"
379
+ echo "[render] standard base + rail — launching both passes in parallel"
380
+ hf_render_dir "$BG" "bg_plus_caps" "$BASE_SHADOW" &
381
+ BASE_PID=$!
382
+ hf_render_dir "$RAIL_WEBM" "rail" "$RAIL_SHADOW" "webm" &
383
+ RAIL_PID=$!
384
+ BASE_RC=0; wait "$BASE_PID" || BASE_RC=$?
385
+ RAIL_RC=0; wait "$RAIL_PID" || RAIL_RC=$?
386
+ rm -rf "$BASE_SHADOW" "$RAIL_SHADOW"
387
+ if (( BASE_RC != 0 )); then echo "[render] bg render failed" >&2; exit 1; fi
388
+ if (( RAIL_RC != 0 )); then echo "[render] rail render failed" >&2; exit 1; fi
389
+ else
390
+ hf_render_dir "$BG" "bg_plus_caps" "$PROJECT" \
391
+ || { echo "[render] bg render failed" >&2; exit 1; }
392
+ fi
393
+
394
+ # Probe render dims for ffmpeg scale
395
+ W="$(ffprobe -v error -select_streams v:0 -show_entries stream=width -of default=nw=1:nk=1 "$BG")"
396
+ H="$(ffprobe -v error -select_streams v:0 -show_entries stream=height -of default=nw=1:nk=1 "$BG")"
397
+
398
+ # Clamp every composite to the matte (= source-video) length. The render uses
399
+ # plan.duration / data-duration, which can exceed the source (e.g. Whisper word
400
+ # timestamps overrun the clip). Past the source the a-roll is gone (black) but the
401
+ # matte overlay repeats its last frame → the tail shows the subject floating on
402
+ # black. frames_fg count/fps APPROXIMATES the source length, but fractional-rate
403
+ # sources (29.97) get over-extracted by integer-fps rounding (e.g. 544 frames for
404
+ # a 542-frame 18.085s clip -> 544/30 = 18.133s -> ~1.5 trailing BLACK frames after
405
+ # the a-roll stream ends). The true a-roll duration is authoritative: clamp to
406
+ # min(matte frames / fps, source duration).
407
+ MATTE_DUR="$(awk "BEGIN{printf \"%.3f\", $(ls "$PROJECT/frames_fg" | wc -l)/$FPS}")"
408
+ SRC_DUR="$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$PROJECT/source.mp4" 2>/dev/null || true)"
409
+ if [[ -n "${SRC_DUR:-}" ]]; then
410
+ MATTE_DUR="$(awk "BEGIN{m=$MATTE_DUR; s=$SRC_DUR; printf \"%.3f\", (s>0 && s<m) ? s : m}")"
411
+ fi
412
+ echo "[render] clamp output to source/matte length: ${MATTE_DUR}s"
413
+
414
+ # Bug-1 guard: the background plate ($BG) must be at least the matte/source length,
415
+ # else the tail (where the bg ran out but the matte continues) shows ONLY the
416
+ # foreground subject on black. Cinematic auto-fixes this (make-composition sets the
417
+ # canvas = source length); this catches a hand-authored Standard duration set to the
418
+ # last-caption time instead of the clip length. Clamp to the bg length so we never
419
+ # ship the only-foreground tail, and tell the author the real fix.
420
+ if [[ -f "$BG" ]]; then
421
+ BG_DUR="$(ffprobe -v error -show_entries format=duration -of default=nokey=1:noprint_wrappers=1 "$BG" 2>/dev/null | tr -dc '0-9.')"
422
+ if [[ -n "$BG_DUR" ]] && awk "BEGIN{exit !($BG_DUR < $MATTE_DUR - 0.3)}"; then
423
+ echo "[render] ⚠ background plate is ${BG_DUR}s but the clip is ${MATTE_DUR}s — the composition is shorter than the footage." >&2
424
+ echo " The tail would show ONLY the foreground subject on black. FIX: set the composition" >&2
425
+ echo " duration to the SOURCE clip length (data-duration on #root/#a-roll); captions may still" >&2
426
+ echo " end earlier. Clamping output to ${BG_DUR}s for now to avoid the broken tail." >&2
427
+ MATTE_DUR="$BG_DUR"
428
+ fi
429
+ fi
430
+
431
+ # ─────────────────────────────────────────────────────────────────────────────
432
+ # STANDARD mode (rail + embed) — detected by rail.html.
433
+ # $BG = index.html rendered (source video + the embed climax).
434
+ # (1) overlay the subject matte so the subject occludes the climax (embed = behind).
435
+ # (2) render rail.html → transparent WebM (the verbatim rail).
436
+ # (3) alpha-composite the rail IN FRONT so it is never occluded (rail = on top).
437
+ # The existing Cinematic paths below are untouched.
438
+ if [[ -f "$PROJECT/rail.html" ]]; then
439
+ MATTED="$PROJECT/_matted.mp4"
440
+ if [[ "$CAPTION_LAYER" == "fg" ]]; then
441
+ # caption_layer:fg — the climax sits IN FRONT of the subject (no behind-subject
442
+ # embed possible, e.g. a frame-filling 9:16 subject). bg_plus_caps already has the
443
+ # climax drawn over the video, so we SKIP the matte overlay (which would push the
444
+ # subject back in front of it). The rail still overlays on top below.
445
+ echo "[render] STANDARD (rail + FRONT climax) — caption_layer=fg, matte overlay skipped (${W}x${H})"
446
+ cp "$BG" "$MATTED"
447
+ else
448
+ echo "[render] STANDARD (rail + embed) — embed behind subject, rail alpha-overlaid in front (${W}x${H})"
449
+ ffmpeg -y -i "$BG" \
450
+ -framerate "$FPS" -i "$PROJECT/frames_fg/f_%04d.png" \
451
+ -filter_complex "[1:v]scale=${W}:${H},format=yuva420p[m];[0:v][m]overlay=format=auto[v]" \
452
+ -map "[v]" -map 0:a -r "$FPS" -t "$MATTE_DUR" -c:v libx264 -crf 11 -preset medium -c:a copy "$MATTED"
453
+ fi
454
+
455
+ # rail.webm was already rendered IN PARALLEL with the base pass above.
456
+ RAIL_WEBM="$PROJECT/rail.webm"
457
+ [[ -f "$RAIL_WEBM" ]] || { echo "[render] rail.webm missing (parallel rail pass failed?)" >&2; exit 1; }
458
+
459
+ # alpha-overlay the transparent rail in front of the matted video (force vp9
460
+ # decode so the WebM alpha plane is honoured by overlay)
461
+ ffmpeg -y -i "$MATTED" -c:v libvpx-vp9 -i "$RAIL_WEBM" \
462
+ -filter_complex "[0:v][1:v]overlay=format=auto[v]" \
463
+ -map "[v]" -map 0:a -r "$FPS" -t "$MATTE_DUR" -c:v libx264 -crf 11 -preset medium -c:a copy "$FINAL"
464
+ rm -f "$MATTED"
465
+ if [[ -s "$GATES" ]]; then echo "[render] ── gates ──"; sed 's/^/[render] /' "$GATES"; fi
466
+ echo "[render] done → $FINAL"
467
+ exit 0
468
+ fi
469
+
470
+ # Decide composite mode:
471
+ # - If make-composition emitted index_fg.html (any group has layer:fg),
472
+ # use hybrid regardless of plan-level caption_layer.
473
+ # - Else if caption_layer=fg globally, skip matte.
474
+ # - Else (default), matte embed.
475
+ if [[ -f "$PROJECT/index_fg.html" ]]; then
476
+ # Hybrid: bg_plus_caps and fg_caps were both rendered above in parallel.
477
+ # Now composite: bg_plus_caps + matte (subject on top) + fg_caps (screen).
478
+ FG_CAPS="$PROJECT/fg_caps.mp4"
479
+ echo "[render] hybrid — composite (bg_plus_caps + matte + fg_caps[screen blend])"
480
+ # fg_caps is bright caption on pure black. blend=screen makes it behave
481
+ # like CSS mix-blend-mode: screen on the matted video — captions pick up
482
+ # scene luminance, NOT a flat opaque overlay (which looks sticker-like).
483
+ # Use rgb format to avoid YUV-space color drift, then convert back for libx264.
484
+ ffmpeg -y -i "$BG" \
485
+ -framerate "$FPS" -i "$PROJECT/frames_fg/f_%04d.png" \
486
+ -i "$FG_CAPS" \
487
+ -filter_complex "[1:v]scale=${W}:${H},format=yuva420p[matte];[0:v][matte]overlay=format=auto,format=gbrp[matted];[2:v]format=gbrp[fg];[matted][fg]blend=all_mode=screen,format=yuv420p[v]" \
488
+ -map "[v]" -map 0:a \
489
+ -r "$FPS" -t "$MATTE_DUR" -c:v libx264 -crf 12 -preset medium -c:a copy \
490
+ "$FINAL"
491
+ elif [[ "$CAPTION_LAYER" == "fg" ]]; then
492
+ # Global FG mode: skip matte overlay entirely. bg_plus_caps.mp4 already
493
+ # has captions on top of a-roll. Re-encode for consistency.
494
+ echo "[render] fg mode (global) — skipping matte, re-encoding ${W}x${H}"
495
+ ffmpeg -y -i "$BG" \
496
+ -r "$FPS" -t "$MATTE_DUR" -c:v libx264 -crf 12 -preset medium -c:a copy \
497
+ "$FINAL"
498
+ else
499
+ echo "[render] bg mode — overlay matte (${W}x${H})"
500
+ ffmpeg -y -i "$BG" \
501
+ -framerate "$FPS" -i "$PROJECT/frames_fg/f_%04d.png" \
502
+ -filter_complex "[1:v]scale=${W}:${H},format=yuva420p[fg];[0:v][fg]overlay=format=auto[v]" \
503
+ -map "[v]" -map 0:a \
504
+ -r "$FPS" -t "$MATTE_DUR" -c:v libx264 -crf 12 -preset medium -c:a copy \
505
+ "$FINAL"
506
+ fi
507
+
508
+ if [[ -s "$GATES" ]]; then echo "[render] ── gates ──"; sed 's/^/[render] /' "$GATES"; fi
509
+ echo "[render] done → $FINAL"
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # render-theme.sh — compile + render + plate-reaction for THEME mode projects.
3
+ # bash render-theme.sh <project-dir>
4
+ # Project needs: theme.json, transcript.json, source.mp4, frames_fg/, matte.fps
5
+ # Output: final_fx.mp4 (final.mp4 = before plate reaction)
6
+ set -euo pipefail
7
+ PROJECT="${1:?usage: render-theme.sh <project-dir>}"
8
+ PROJECT="$(cd "$PROJECT" && pwd)"
9
+ SD="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+
11
+ node "$SD/make-theme.cjs" "$PROJECT"
12
+ # Gate honesty (cold-start E2E finding): theme mode enforces word timing at
13
+ # COMPILE time (sequential transcript matcher + verbatim completeness gate in
14
+ # make-theme.cjs — a mistimed/missing word is a compile error, not a render
15
+ # warning). The pixel occlusion gate is Cinematic-only; themes place heroes
16
+ # scene-aware (safe-zones) and are covered by overflow + rail-climax + the
17
+ # PAGEERROR gate below.
18
+ echo "[render-theme] gates: timing PASS (compile-enforced verbatim matcher)"
19
+ echo "[render-theme] gates: occlusion = scene-aware placement (pixel gate is Cinematic-only)"
20
+ RLOG="$PROJECT/_render-theme.log"
21
+ bash "$SD/render-and-composite.sh" "$PROJECT" 2>&1 | tee "$RLOG"
22
+ # GATE: a JS error in either generated layer silently yields a blank caption
23
+ # layer while every downstream gate still passes — fail loudly instead.
24
+ if grep -q "PAGEERROR" "$RLOG"; then
25
+ echo "[render-theme] FAIL — Browser PAGEERROR in a generated layer (see $RLOG)." >&2
26
+ echo " The caption timeline did not build; the output is missing captions." >&2
27
+ exit 2
28
+ fi
29
+ if [[ -f "$PROJECT/_postfx.sh" ]]; then
30
+ bash "$PROJECT/_postfx.sh"
31
+ else
32
+ cp "$PROJECT/final.mp4" "$PROJECT/final_fx.mp4"
33
+ fi
34
+ echo "[render-theme] done → $PROJECT/final_fx.mp4 (DELIVERABLE: final_fx.mp4; final.mp4 is the pre-plate-reaction cut)"