sera-code 0.1.3 → 0.1.4

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 (332) hide show
  1. package/README.md +9 -1
  2. package/bin/sera.mjs +31 -0
  3. package/dist/bundle/chunks/{chunk-OXMPCU7P.js → chunk-DFRGGJWV.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-KO3Z5BTR.js → chunk-EMXTNOOJ.js} +5 -5
  5. package/dist/bundle/chunks/{chunk-KXU77PUU.js → chunk-ET2ARYK4.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-ZNCN2NGY.js → chunk-G5BGS7HZ.js} +2 -2
  7. package/dist/bundle/chunks/{chunk-HODJBMOY.js → chunk-GSGPISRE.js} +3 -4
  8. package/dist/bundle/chunks/{chunk-46WGNYIE.js → chunk-NMUS7OCP.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-HQBQWHLD.js → chunk-RCQXVPCE.js} +1 -1
  10. package/dist/bundle/chunks/{cli-MML2DU4A.js → cli-NOCFT7AL.js} +1 -1
  11. package/dist/bundle/chunks/{execute-HXDNZ26B.js → execute-S2O3RL6V.js} +1 -1
  12. package/dist/bundle/chunks/github-copilot.js +1 -1
  13. package/dist/bundle/chunks/{runtime-JAH75CB5.js → runtime-BRT7AUXY.js} +1 -1
  14. package/dist/bundle/chunks/{virtual-modules-OE2CSJ4W.js → virtual-modules-QR2XYBMY.js} +1 -1
  15. package/dist/bundle/cli-runtime.js +1 -1
  16. package/dist/bundle/index.js +1 -1
  17. package/dist/bundle/rpc-entry.js +1 -1
  18. package/lib/postinstall.js +16 -0
  19. package/lib/update.js +85 -0
  20. package/lib/win-setup.js +96 -0
  21. package/package.json +4 -1
  22. package/sera-core/skills/ambalaj-tasarim/NOTICE +1 -0
  23. package/sera-core/skills/ambalaj-tasarim/SKILL.md +34 -0
  24. package/sera-core/skills/ambalaj-tasarim/dieline.mjs +17 -0
  25. package/sera-core/skills/ambalaj-tasarim/sera-pack.js +535 -0
  26. package/sera-core/skills/animasyonlu-site/NOTICE +1 -0
  27. package/sera-core/skills/animasyonlu-site/SKILL.md +26 -0
  28. package/sera-core/skills/animasyonlu-site/sera-motion.js +310 -0
  29. package/sera-core/skills/animate/LICENSE +21 -0
  30. package/sera-core/skills/animate/NOTICE +2 -0
  31. package/sera-core/skills/animate/RECIPES.md +324 -0
  32. package/sera-core/skills/animate/SKILL.md +209 -0
  33. package/sera-core/skills/astryx-ui/SKILL.md +37 -0
  34. package/sera-core/skills/awwwards/LICENSE +21 -0
  35. package/sera-core/skills/awwwards/NOTICE +5 -0
  36. package/sera-core/skills/awwwards/SKILL.md +357 -0
  37. package/sera-core/skills/awwwards/references/anatomy.md +103 -0
  38. package/sera-core/skills/awwwards/references/art-direction.md +114 -0
  39. package/sera-core/skills/awwwards/references/astro.md +235 -0
  40. package/sera-core/skills/awwwards/references/concepts.md +110 -0
  41. package/sera-core/skills/awwwards/references/content.md +88 -0
  42. package/sera-core/skills/awwwards/references/engine.md +751 -0
  43. package/sera-core/skills/awwwards/references/layout.md +81 -0
  44. package/sera-core/skills/awwwards/references/motion.md +463 -0
  45. package/sera-core/skills/awwwards/references/nextjs.md +386 -0
  46. package/sera-core/skills/awwwards/references/patterns.md +123 -0
  47. package/sera-core/skills/awwwards/references/quality-bar.md +151 -0
  48. package/sera-core/skills/awwwards/references/quality.md +91 -0
  49. package/sera-core/skills/awwwards/references/ship.md +36 -0
  50. package/sera-core/skills/awwwards/references/typography.md +135 -0
  51. package/sera-core/skills/awwwards/references/webgl.md +430 -0
  52. package/sera-core/skills/awwwards/scripts/audit.mjs +243 -0
  53. package/sera-core/skills/awwwards/scripts/browser.mjs +54 -0
  54. package/sera-core/skills/awwwards/scripts/font.mjs +87 -0
  55. package/sera-core/skills/awwwards/scripts/og.mjs +20 -0
  56. package/sera-core/skills/awwwards/scripts/photos.mjs +65 -0
  57. package/sera-core/skills/awwwards/scripts/serve.mjs +48 -0
  58. package/sera-core/skills/awwwards/scripts/shoot.mjs +675 -0
  59. package/sera-core/skills/beceri-yaz/SKILL.md +39 -0
  60. package/sera-core/skills/brag-slim/LICENSE +21 -0
  61. package/sera-core/skills/brag-slim/NOTICE +2 -0
  62. package/sera-core/skills/brag-slim/SKILL.md +108 -0
  63. package/sera-core/skills/brainstorming/LICENSE +21 -0
  64. package/sera-core/skills/brainstorming/NOTICE +5 -0
  65. package/sera-core/skills/brainstorming/SKILL.md +298 -0
  66. package/sera-core/skills/brainstorming/builder-check-prompt.md +23 -0
  67. package/sera-core/skills/copywriting/LICENSE +21 -0
  68. package/sera-core/skills/copywriting/NOTICE +5 -0
  69. package/sera-core/skills/copywriting/SKILL.md +343 -0
  70. package/sera-core/skills/copywriting/references/ai-tells.md +309 -0
  71. package/sera-core/skills/copywriting/references/copy-frameworks.md +432 -0
  72. package/sera-core/skills/copywriting/references/natural-transitions.md +256 -0
  73. package/sera-core/skills/cro/LICENSE +21 -0
  74. package/sera-core/skills/cro/NOTICE +5 -0
  75. package/sera-core/skills/cro/SKILL.md +198 -0
  76. package/sera-core/skills/cro/references/experiments.md +248 -0
  77. package/sera-core/skills/cro/references/form.md +422 -0
  78. package/sera-core/skills/derin-arastirma/referanslar/arastirma-yontem.md +11 -0
  79. package/sera-core/skills/emil-design-eng/LICENSE +21 -0
  80. package/sera-core/skills/emil-design-eng/NOTICE +2 -0
  81. package/sera-core/skills/emil-design-eng/SKILL.md +684 -0
  82. package/sera-core/skills/frontend-design/LICENSE.txt +177 -0
  83. package/sera-core/skills/frontend-design/NOTICE +2 -0
  84. package/sera-core/skills/frontend-design/SKILL.md +71 -0
  85. package/sera-core/skills/gorsel-denetim/SKILL.md +30 -0
  86. package/sera-core/skills/hallmark/LICENSE +21 -0
  87. package/sera-core/skills/hallmark/NOTICE +5 -0
  88. package/sera-core/skills/hallmark/SKILL.md +154 -0
  89. package/sera-core/skills/hallmark/references/anatomy.md +71 -0
  90. package/sera-core/skills/hallmark/references/brand-truth.md +40 -0
  91. package/sera-core/skills/hallmark/references/comp.md +104 -0
  92. package/sera-core/skills/hallmark/references/craft.md +116 -0
  93. package/sera-core/skills/hallmark/references/dark-mode.md +49 -0
  94. package/sera-core/skills/hallmark/references/data-viz.md +48 -0
  95. package/sera-core/skills/hallmark/references/design-md.md +53 -0
  96. package/sera-core/skills/hallmark/references/direction.md +52 -0
  97. package/sera-core/skills/hallmark/references/export-formats.md +80 -0
  98. package/sera-core/skills/hallmark/references/flow.md +131 -0
  99. package/sera-core/skills/hallmark/references/fonts.md +58 -0
  100. package/sera-core/skills/hallmark/references/gates.md +243 -0
  101. package/sera-core/skills/hallmark/references/genres/atmospheric.md +24 -0
  102. package/sera-core/skills/hallmark/references/genres/editorial.md +24 -0
  103. package/sera-core/skills/hallmark/references/genres/modern-minimal.md +24 -0
  104. package/sera-core/skills/hallmark/references/genres/playful.md +24 -0
  105. package/sera-core/skills/hallmark/references/imagery.md +99 -0
  106. package/sera-core/skills/hallmark/references/interaction-and-states.md +89 -0
  107. package/sera-core/skills/hallmark/references/layout.md +104 -0
  108. package/sera-core/skills/hallmark/references/macrostructures/01-bento-grid.md +21 -0
  109. package/sera-core/skills/hallmark/references/macrostructures/02-long-document.md +35 -0
  110. package/sera-core/skills/hallmark/references/macrostructures/03-marquee-hero.md +21 -0
  111. package/sera-core/skills/hallmark/references/macrostructures/04-stat-led.md +21 -0
  112. package/sera-core/skills/hallmark/references/macrostructures/05-workbench.md +21 -0
  113. package/sera-core/skills/hallmark/references/macrostructures/06-conversational-faq.md +28 -0
  114. package/sera-core/skills/hallmark/references/macrostructures/07-manifesto.md +28 -0
  115. package/sera-core/skills/hallmark/references/macrostructures/08-photographic.md +21 -0
  116. package/sera-core/skills/hallmark/references/macrostructures/09-quote-led.md +21 -0
  117. package/sera-core/skills/hallmark/references/macrostructures/10-specimen.md +21 -0
  118. package/sera-core/skills/hallmark/references/macrostructures/11-catalogue.md +21 -0
  119. package/sera-core/skills/hallmark/references/macrostructures/12-letter.md +21 -0
  120. package/sera-core/skills/hallmark/references/macrostructures/13-index-first.md +21 -0
  121. package/sera-core/skills/hallmark/references/macrostructures/14-narrative-workflow.md +21 -0
  122. package/sera-core/skills/hallmark/references/macrostructures/15-split-studio.md +21 -0
  123. package/sera-core/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
  124. package/sera-core/skills/hallmark/references/macrostructures/17-type-specimen.md +19 -0
  125. package/sera-core/skills/hallmark/references/macrostructures/18-portfolio-grid.md +21 -0
  126. package/sera-core/skills/hallmark/references/macrostructures/19-map-diagram.md +21 -0
  127. package/sera-core/skills/hallmark/references/macrostructures/20-ecosystem-index.md +19 -0
  128. package/sera-core/skills/hallmark/references/macrostructures/21-component-playground.md +21 -0
  129. package/sera-core/skills/hallmark/references/macrostructures.md +119 -0
  130. package/sera-core/skills/hallmark/references/microinteractions.md +80 -0
  131. package/sera-core/skills/hallmark/references/patterns.md +202 -0
  132. package/sera-core/skills/hallmark/references/redesign.md +88 -0
  133. package/sera-core/skills/hallmark/references/responsive.md +46 -0
  134. package/sera-core/skills/hallmark/references/review-finish.md +19 -0
  135. package/sera-core/skills/hallmark/references/review-hero.md +20 -0
  136. package/sera-core/skills/hallmark/references/scroll-choreography.md +110 -0
  137. package/sera-core/skills/hallmark/references/texture.md +90 -0
  138. package/sera-core/skills/hallmark/references/themes/README.md +58 -0
  139. package/sera-core/skills/hallmark/references/themes/almanac.md +103 -0
  140. package/sera-core/skills/hallmark/references/themes/arcade.md +102 -0
  141. package/sera-core/skills/hallmark/references/themes/atelier.md +98 -0
  142. package/sera-core/skills/hallmark/references/themes/bloom.md +102 -0
  143. package/sera-core/skills/hallmark/references/themes/blueprint.md +103 -0
  144. package/sera-core/skills/hallmark/references/themes/broadside.md +108 -0
  145. package/sera-core/skills/hallmark/references/themes/brutal.md +95 -0
  146. package/sera-core/skills/hallmark/references/themes/carnival.md +104 -0
  147. package/sera-core/skills/hallmark/references/themes/cobalt.md +101 -0
  148. package/sera-core/skills/hallmark/references/themes/console.md +99 -0
  149. package/sera-core/skills/hallmark/references/themes/coral.md +102 -0
  150. package/sera-core/skills/hallmark/references/themes/darkroom.md +99 -0
  151. package/sera-core/skills/hallmark/references/themes/dose.md +98 -0
  152. package/sera-core/skills/hallmark/references/themes/dusk.md +105 -0
  153. package/sera-core/skills/hallmark/references/themes/editorial.md +97 -0
  154. package/sera-core/skills/hallmark/references/themes/formwork.md +107 -0
  155. package/sera-core/skills/hallmark/references/themes/furrow.md +98 -0
  156. package/sera-core/skills/hallmark/references/themes/garden.md +97 -0
  157. package/sera-core/skills/hallmark/references/themes/grid.md +101 -0
  158. package/sera-core/skills/hallmark/references/themes/halftone.md +106 -0
  159. package/sera-core/skills/hallmark/references/themes/hedgerow.md +104 -0
  160. package/sera-core/skills/hallmark/references/themes/hum.md +99 -0
  161. package/sera-core/skills/hallmark/references/themes/ink.md +106 -0
  162. package/sera-core/skills/hallmark/references/themes/kiln.md +108 -0
  163. package/sera-core/skills/hallmark/references/themes/loom.md +106 -0
  164. package/sera-core/skills/hallmark/references/themes/lumen.md +103 -0
  165. package/sera-core/skills/hallmark/references/themes/manifesto.md +101 -0
  166. package/sera-core/skills/hallmark/references/themes/midnight.md +97 -0
  167. package/sera-core/skills/hallmark/references/themes/newsprint.md +102 -0
  168. package/sera-core/skills/hallmark/references/themes/overprint.md +101 -0
  169. package/sera-core/skills/hallmark/references/themes/pasteup.md +100 -0
  170. package/sera-core/skills/hallmark/references/themes/piste.md +99 -0
  171. package/sera-core/skills/hallmark/references/themes/refract.md +101 -0
  172. package/sera-core/skills/hallmark/references/themes/ribbon.md +106 -0
  173. package/sera-core/skills/hallmark/references/themes/rim.md +96 -0
  174. package/sera-core/skills/hallmark/references/themes/riso.md +98 -0
  175. package/sera-core/skills/hallmark/references/themes/solstice.md +104 -0
  176. package/sera-core/skills/hallmark/references/themes/specimen.md +100 -0
  177. package/sera-core/skills/hallmark/references/themes/spore.md +104 -0
  178. package/sera-core/skills/hallmark/references/themes/sport.md +101 -0
  179. package/sera-core/skills/hallmark/references/themes/squeeze.md +99 -0
  180. package/sera-core/skills/hallmark/references/themes/sticker.md +106 -0
  181. package/sera-core/skills/hallmark/references/themes/studio.md +99 -0
  182. package/sera-core/skills/hallmark/references/themes/terminal.md +96 -0
  183. package/sera-core/skills/hallmark/references/themes/terrazzo.md +106 -0
  184. package/sera-core/skills/hallmark/references/themes/ultraviolet.md +106 -0
  185. package/sera-core/skills/hallmark/references/themes/vantage.md +99 -0
  186. package/sera-core/skills/hallmark/references/themes/vellum.md +105 -0
  187. package/sera-core/skills/hallmark/references/themes/wayfind.md +105 -0
  188. package/sera-core/skills/hallmark/references/themes/werkstatt.md +105 -0
  189. package/sera-core/skills/hallmark/scripts/capture.mjs +132 -0
  190. package/sera-core/skills/hallmark/scripts/refcheck.mjs +405 -0
  191. package/sera-core/skills/hallmark/scripts/sloplint-render.mjs +1283 -0
  192. package/sera-core/skills/hallmark/scripts/sloplint.mjs +4426 -0
  193. package/sera-core/skills/hallmark/scripts/theme.mjs +660 -0
  194. package/sera-core/skills/kurum-ici-iletisim/SKILL.md +40 -0
  195. package/sera-core/skills/launch/LICENSE +21 -0
  196. package/sera-core/skills/launch/NOTICE +5 -0
  197. package/sera-core/skills/launch/SKILL.md +385 -0
  198. package/sera-core/skills/launch/references/shipped-changes.md +84 -0
  199. package/sera-core/skills/launch/references/site-launch-qa.md +57 -0
  200. package/sera-core/skills/marka-kimligi/SKILL.md +30 -0
  201. package/sera-core/skills/mcp-yaz/SKILL.md +41 -0
  202. package/sera-core/skills/mobil-arayuz/SKILL.md +12 -0
  203. package/sera-core/skills/mvp-scoping/LICENSE +21 -0
  204. package/sera-core/skills/mvp-scoping/NOTICE +5 -0
  205. package/sera-core/skills/mvp-scoping/SKILL.md +95 -0
  206. package/sera-core/skills/ortak-yazarlik/SKILL.md +32 -0
  207. package/sera-core/skills/oyun-turleri/SKILL.md +176 -0
  208. package/sera-core/skills/paralel-sadelestirme/SKILL.md +33 -0
  209. package/sera-core/skills/phaser-core/LICENSE +201 -0
  210. package/sera-core/skills/phaser-core/NOTICE +5 -0
  211. package/sera-core/skills/phaser-core/NOTICE-UPSTREAM +15 -0
  212. package/sera-core/skills/phaser-core/SKILL.md +245 -0
  213. package/sera-core/skills/phaser-core/references/scene-flow.md +177 -0
  214. package/sera-core/skills/pitch-deck/LICENSE +21 -0
  215. package/sera-core/skills/pitch-deck/NOTICE +5 -0
  216. package/sera-core/skills/pitch-deck/SKILL.md +103 -0
  217. package/sera-core/skills/sera-3d-oyun/NOTICE +1 -0
  218. package/sera-core/skills/sera-3d-oyun/SKILL.md +12 -0
  219. package/sera-core/skills/sera-3d-oyun/sera-3d.js +3697 -0
  220. package/sera-core/skills/sera-diyagram/SKILL.md +43 -0
  221. package/sera-core/skills/sera-ofis-dosya/SKILL.md +3 -0
  222. package/sera-core/skills/sera-ofis-dosya/referanslar/ofis-ileri.md +46 -0
  223. package/sera-core/skills/sera-ui-site/NOTICE +1 -0
  224. package/sera-core/skills/sera-ui-site/SKILL.md +10 -0
  225. package/sera-core/skills/sera-ui-site/sera-ui.js +83 -0
  226. package/sera-core/skills/sera-veri-gorsel/SKILL.md +3 -0
  227. package/sera-core/skills/sera-veri-gorsel/referanslar/palet-dogrula.mjs +80 -0
  228. package/sera-core/skills/sistem-tarama/SKILL.md +49 -0
  229. package/sera-core/skills/sistem-tarama/referanslar/komutlar.md +78 -0
  230. package/sera-core/skills/tasarim-stilleri/SKILL.md +113 -0
  231. package/sera-core/skills/teardown/LICENSE +22 -0
  232. package/sera-core/skills/teardown/NOTICE +3 -0
  233. package/sera-core/skills/teardown/SKILL.md +144 -0
  234. package/sera-core/skills/teardown/package-lock.json +545 -0
  235. package/sera-core/skills/teardown/package.json +18 -0
  236. package/sera-core/skills/teardown/paths.mjs +30 -0
  237. package/sera-core/skills/teardown/run_sfx.py +10 -0
  238. package/sera-core/skills/teardown/sfx/__init__.py +10 -0
  239. package/sera-core/skills/teardown/sfx/__main__.py +64 -0
  240. package/sera-core/skills/teardown/sfx/dsp.py +453 -0
  241. package/sera-core/skills/teardown/sfx/loudness.py +72 -0
  242. package/sera-core/skills/teardown/sfx/mix.py +111 -0
  243. package/sera-core/skills/teardown/sfx/samples/SOURCES.md +23 -0
  244. package/sera-core/skills/teardown/sfx/samples/fs-258269-mouth-pop.ogg +0 -0
  245. package/sera-core/skills/teardown/sfx/samples/fs-323432-typing.ogg +0 -0
  246. package/sera-core/skills/teardown/sfx/samples/fs-329533-room-tone-in-an-apartment-livi.ogg +0 -0
  247. package/sera-core/skills/teardown/sfx/samples/fs-329569-roomtone-bedroom-yew.ogg +0 -0
  248. package/sera-core/skills/teardown/sfx/samples/fs-339521-vhs-rewind-forward-and-eject.ogg +0 -0
  249. package/sera-core/skills/teardown/sfx/samples/fs-349504-triangle-open-04.ogg +0 -0
  250. package/sera-core/skills/teardown/sfx/samples/fs-416777-digital-typing-wav.ogg +0 -0
  251. package/sera-core/skills/teardown/sfx/samples/fs-426767-apartment-room-tone-wav.ogg +0 -0
  252. package/sera-core/skills/teardown/sfx/samples/fs-447909-keyboard-typing.ogg +0 -0
  253. package/sera-core/skills/teardown/sfx/samples/fs-447910-plop.ogg +0 -0
  254. package/sera-core/skills/teardown/sfx/samples/fs-79388-keyboard-typing-wav.ogg +0 -0
  255. package/sera-core/skills/teardown/sfx/samples/fs-824189-pop-in-sfx.ogg +0 -0
  256. package/sera-core/skills/teardown/sfx/score_kit.py +206 -0
  257. package/sera-core/skills/teardown/sfx/synth.py +294 -0
  258. package/sera-core/skills/teardown/sheet.mjs +127 -0
  259. package/sera-core/skills/teardown/sims/beats.py +212 -0
  260. package/sera-core/skills/teardown/sims/build.mjs +141 -0
  261. package/sera-core/skills/teardown/sims/capture.mjs +211 -0
  262. package/sera-core/skills/teardown/sims/cessna-film/main.js +4 -0
  263. package/sera-core/skills/teardown/sims/cessna-film/timeline.json +1 -0
  264. package/sera-core/skills/teardown/sims/cessna-live/main.js +5 -0
  265. package/sera-core/skills/teardown/sims/cessna-shared/console.js +288 -0
  266. package/sera-core/skills/teardown/sims/cessna-shared/film.js +254 -0
  267. package/sera-core/skills/teardown/sims/cessna-shared/flight.js +53 -0
  268. package/sera-core/skills/teardown/sims/cessna-shared/gear.js +364 -0
  269. package/sera-core/skills/teardown/sims/cessna-shared/live.js +351 -0
  270. package/sera-core/skills/teardown/sims/cessna-shared/score.py +41 -0
  271. package/sera-core/skills/teardown/sims/cessna-shared/stage.js +248 -0
  272. package/sera-core/skills/teardown/sims/kit/director.js +300 -0
  273. package/sera-core/skills/teardown/sims/kit/hud.js +194 -0
  274. package/sera-core/skills/teardown/sims/kit/runtime.js +168 -0
  275. package/sera-core/skills/teardown/sims/kit/stage3d.js +114 -0
  276. package/sera-core/skills/teardown/sims/kit/style.css +137 -0
  277. package/sera-core/skills/teardown/sims/kit/util.js +79 -0
  278. package/sera-core/skills/teardown/sims/kit/warm.js +66 -0
  279. package/sera-core/skills/teardown/sims/strandbeest-film/main.js +4 -0
  280. package/sera-core/skills/teardown/sims/strandbeest-film/timeline.json +1 -0
  281. package/sera-core/skills/teardown/sims/strandbeest-live/main.js +5 -0
  282. package/sera-core/skills/teardown/sims/strandbeest-shared/beast.js +419 -0
  283. package/sera-core/skills/teardown/sims/strandbeest-shared/console.js +375 -0
  284. package/sera-core/skills/teardown/sims/strandbeest-shared/film.js +352 -0
  285. package/sera-core/skills/teardown/sims/strandbeest-shared/jansen.js +67 -0
  286. package/sera-core/skills/teardown/sims/strandbeest-shared/live.js +420 -0
  287. package/sera-core/skills/teardown/sims/strandbeest-shared/score.py +85 -0
  288. package/sera-core/skills/teardown/sims/strandbeest-shared/stage.js +463 -0
  289. package/sera-core/skills/teardown/sims/v8-film/main.js +4 -0
  290. package/sera-core/skills/teardown/sims/v8-film/timeline.json +1 -0
  291. package/sera-core/skills/teardown/sims/v8-live/main.js +5 -0
  292. package/sera-core/skills/teardown/sims/v8-shared/console.js +339 -0
  293. package/sera-core/skills/teardown/sims/v8-shared/engine.js +624 -0
  294. package/sera-core/skills/teardown/sims/v8-shared/film.js +239 -0
  295. package/sera-core/skills/teardown/sims/v8-shared/kin.js +86 -0
  296. package/sera-core/skills/teardown/sims/v8-shared/live.js +374 -0
  297. package/sera-core/skills/teardown/sims/v8-shared/score.py +60 -0
  298. package/sera-core/skills/teardown/sims/v8-shared/stage.js +173 -0
  299. package/sera-core/skills/teardown/wave.mjs +67 -0
  300. package/sera-core/skills/toplu-degisiklik/SKILL.md +39 -0
  301. package/sera-core/skills/ui-ux-pro-max/LICENSE +21 -0
  302. package/sera-core/skills/ui-ux-pro-max/NOTICE +5 -0
  303. package/sera-core/skills/ui-ux-pro-max/SKILL.md +13 -0
  304. package/sera-core/skills/ui-ux-pro-max/references/pro-rules.md +117 -0
  305. package/sera-core/skills/ui-ux-pro-max/references/quick-reference.md +266 -0
  306. package/sera-core/skills/unslop/LICENSE.md +410 -0
  307. package/sera-core/skills/unslop/SKILL.md +217 -0
  308. package/sera-core/skills/unslop/references/effects.md +113 -0
  309. package/sera-core/skills/unslop/references/refs/unslop-dashboard-after.webp +0 -0
  310. package/sera-core/skills/unslop/references/refs/unslop-hero-after.webp +0 -0
  311. package/sera-core/skills/unslop/references/refs.md +16 -0
  312. package/sera-core/skills/unslop/references/rtl.md +72 -0
  313. package/sera-core/skills/unslop/references/signs.md +125 -0
  314. package/sera-core/skills/unslop/references/tokens.md +137 -0
  315. package/sera-core/skills/unslop/references/visuals.md +84 -0
  316. package/sera-core/skills/unslop/scripts/snapshot.mjs +197 -0
  317. package/sera-core/skills/uretken-sanat/SKILL.md +42 -0
  318. package/sera-core/skills/verification-before-completion/LICENSE +21 -0
  319. package/sera-core/skills/verification-before-completion/NOTICE +5 -0
  320. package/sera-core/skills/verification-before-completion/SKILL.md +120 -0
  321. package/sera-core/skills/web-yayin-listesi/SKILL.md +3 -0
  322. package/sera-core/src/app-master.ts +2 -2
  323. package/sera-core/src/app-verify.ts +33 -0
  324. package/sera-core/src/extension.ts +16 -2
  325. package/sera-core/src/generated/build-rules.ts +81 -17
  326. package/sera-core/src/generated/quality-probe.ts +2 -0
  327. package/sera-core/src/generated/zero-knowledge.ts +36 -9
  328. package/sera-core/src/image-tool.ts +12 -2
  329. package/sera-core/src/link-data-tools.ts +411 -0
  330. package/sera-core/src/skills.ts +54 -18
  331. package/sera-core/src/video-tool.ts +51 -0
  332. package/sera-core/src/zk.ts +7 -3
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env python
2
+ """Beat map for a music track, so a sim can cut and hit on the music.
3
+
4
+ python sims/beats.py music/track.mp3 [--duration 30] [--start auto|SECONDS] [-o out.json]
5
+
6
+ Decodes with ffmpeg, then in pure Python:
7
+ - tempo from the autocorrelation of the onset envelope (prefers 100-160 BPM),
8
+ - the beat grid, aligned to the onsets,
9
+ - downbeats (the beat phase with the most low-band attack),
10
+ - kicks (low-band onset peaks, with strength 0..1),
11
+ - energy per bar, and the drop (the biggest sustained jump in energy).
12
+
13
+ With --start auto the 30 s window is placed so the drop lands at ~40 % of the
14
+ clip, snapped to a bar. All times in the output are relative to the window start.
15
+ """
16
+ import argparse
17
+ import json
18
+ import math
19
+ import os
20
+ import subprocess
21
+ import sys
22
+ from array import array
23
+
24
+ FFMPEG = os.environ.get('FFMPEG', 'ffmpeg')
25
+ SR = 11025
26
+ HOP = 256
27
+ FPS = SR / HOP # envelope frames per second (~43)
28
+
29
+
30
+ def decode(path, filt=None):
31
+ cmd = [FFMPEG, '-v', 'error', '-i', path, '-ac', '1', '-ar', str(SR)]
32
+ if filt:
33
+ cmd += ['-af', filt]
34
+ cmd += ['-f', 's16le', '-']
35
+ raw = subprocess.run(cmd, check=True, capture_output=True).stdout
36
+ a = array('h')
37
+ a.frombytes(raw[: len(raw) // 2 * 2])
38
+ return a
39
+
40
+
41
+ def frame_energy(samples):
42
+ n = len(samples) // HOP
43
+ out = array('d', bytes(8 * n))
44
+ for i in range(n):
45
+ s = 0
46
+ for x in samples[i * HOP:(i + 1) * HOP]:
47
+ s += x * x
48
+ out[i] = s / HOP
49
+ return out
50
+
51
+
52
+ def onset(env):
53
+ """Positive change of log energy, lightly smoothed."""
54
+ lg = [math.log(1e-3 + e) for e in env]
55
+ d = [0.0] + [max(0.0, lg[i] - lg[i - 1]) for i in range(1, len(lg))]
56
+ return [0.5 * d[i] + 0.25 * (d[i - 1] if i else 0) + 0.25 * (d[i + 1] if i + 1 < len(d) else 0)
57
+ for i in range(len(d))]
58
+
59
+
60
+ def tempo(nov):
61
+ """Best period in frames from the autocorrelation, weighted toward ~126 BPM."""
62
+ n = len(nov)
63
+ mean = sum(nov) / n
64
+ x = [v - mean for v in nov]
65
+ best, best_lag = -1e18, None
66
+ scores = {}
67
+ lo = int(FPS * 60 / 190)
68
+ hi = int(FPS * 60 / 70) + 1
69
+ for lag in range(lo, hi):
70
+ s = 0.0
71
+ for i in range(n - lag):
72
+ s += x[i] * x[i + lag]
73
+ bpm = 60 * FPS / lag
74
+ w = math.exp(-0.5 * (math.log2(bpm / 126) / 0.6) ** 2)
75
+ scores[lag] = s
76
+ if s * w > best:
77
+ best, best_lag = s * w, lag
78
+ # parabolic refinement
79
+ l = best_lag
80
+ if l - 1 in scores and l + 1 in scores:
81
+ a, b, c = scores[l - 1], scores[l], scores[l + 1]
82
+ den = a - 2 * b + c
83
+ if den:
84
+ l = l + 0.5 * (a - c) / den
85
+ return l
86
+
87
+
88
+ def beat_grid(nov, period):
89
+ """Phase of the grid that sits on the most onset energy, then local snapping."""
90
+ n = len(nov)
91
+ best, best_off = -1, 0
92
+ for off in range(int(period) + 1):
93
+ s, k = 0.0, 0
94
+ while True:
95
+ i = int(round(off + k * period))
96
+ if i >= n:
97
+ break
98
+ s += nov[i]
99
+ k += 1
100
+ if s > best:
101
+ best, best_off = s, off
102
+ beats = []
103
+ while best_off - period >= 0: # grid back to the very start
104
+ best_off -= period
105
+ k = 0
106
+ while True:
107
+ c = best_off + k * period
108
+ if c >= n:
109
+ break
110
+ i = int(round(c))
111
+ lo, hi = max(0, i - 2), min(n - 1, i + 2)
112
+ j = max(range(lo, hi + 1), key=lambda q: nov[q])
113
+ # only snap if the peak is clearly there, else keep the grid
114
+ beats.append(j if nov[j] > 1.5 * nov[i] + 1e-9 else i)
115
+ k += 1
116
+ return beats
117
+
118
+
119
+ def main():
120
+ ap = argparse.ArgumentParser()
121
+ ap.add_argument('track')
122
+ ap.add_argument('--duration', type=float, default=30)
123
+ ap.add_argument('--start', default='auto')
124
+ ap.add_argument('-o', '--out')
125
+ args = ap.parse_args()
126
+
127
+ full = decode(args.track)
128
+ low = decode(args.track, 'lowpass=f=140,lowpass=f=140')
129
+ total = len(full) / SR
130
+ env = frame_energy(full)
131
+ envl = frame_energy(low)
132
+ nov = onset(env)
133
+ novl = onset(envl)
134
+ comb = [a + 1.5 * b for a, b in zip(nov, novl)]
135
+
136
+ period = tempo(comb)
137
+ bpm = 60 * FPS / period
138
+ beats = beat_grid(comb, period)
139
+ # downbeat phase: most low-band attack
140
+ phase = max(range(4), key=lambda p: sum(novl[b] for b in beats[p::4]))
141
+ downs = beats[phase::4]
142
+
143
+ # kicks: low-band onset peaks above an adaptive threshold
144
+ srt = sorted(novl)
145
+ thr = srt[int(len(srt) * 0.9)]
146
+ peak = max(novl) or 1
147
+ kicks = []
148
+ for i in range(1, len(novl) - 1):
149
+ if novl[i] > thr and novl[i] >= novl[i - 1] and novl[i] > novl[i + 1]:
150
+ if not kicks or i - kicks[-1][0] > FPS * 0.18:
151
+ kicks.append((i, novl[i] / peak))
152
+
153
+ # energy per bar
154
+ bar_e = []
155
+ for b in range(len(downs) - 1):
156
+ seg = env[downs[b]:downs[b + 1]]
157
+ bar_e.append(math.sqrt(sum(seg) / max(1, len(seg))))
158
+ mx = max(bar_e) or 1
159
+ bar_e = [e / mx for e in bar_e]
160
+
161
+ # drop: biggest jump vs the previous 4 bars that holds for the next 2
162
+ drop_bar, best = None, 0
163
+ for b in range(4, len(bar_e) - 2):
164
+ before = sum(bar_e[b - 4:b]) / 4
165
+ after = min(bar_e[b:b + 2])
166
+ j = after - before
167
+ if j > best:
168
+ best, drop_bar = j, b
169
+ drop_t = downs[drop_bar] / FPS if drop_bar is not None else None
170
+
171
+ D = args.duration
172
+ if args.start == 'auto':
173
+ if drop_t is not None and best > 0.12:
174
+ want = drop_t - 0.4 * D
175
+ else:
176
+ # loudest window
177
+ nb = max(1, int(D / (240 / bpm)))
178
+ want_bar = max(range(max(1, len(bar_e) - nb)), key=lambda b: sum(bar_e[b:b + nb]))
179
+ want = downs[want_bar] / FPS
180
+ want = min(max(0.0, want), max(0.0, total - D))
181
+ start = min((d / FPS for d in downs), key=lambda d: abs(d - want))
182
+ if start + D > total:
183
+ start = max(0.0, total - D)
184
+ else:
185
+ start = float(args.start)
186
+ end = start + D
187
+
188
+ rel = lambda f: round(f / FPS - start, 3)
189
+ inwin = lambda f: start - 1e-6 <= f / FPS < end
190
+ bar_starts = [d for d in downs if inwin(d)]
191
+ out = {
192
+ 'track': os.path.abspath(args.track),
193
+ 'start': round(start, 3),
194
+ 'duration': D,
195
+ 'bpm': round(bpm, 2),
196
+ 'beats': [rel(b) for b in beats if inwin(b)],
197
+ 'downbeats': [rel(d) for d in bar_starts],
198
+ 'kicks': [[rel(i), round(s, 3)] for i, s in kicks if inwin(i)],
199
+ 'barEnergy': [round(bar_e[downs.index(d)], 3) for d in bar_starts if downs.index(d) < len(bar_e)],
200
+ 'drop': round(drop_t - start, 3) if drop_t is not None and start <= drop_t < end else None,
201
+ }
202
+ path = args.out or os.path.splitext(args.track)[0] + f'.beats-{int(round(start))}.json'
203
+ os.makedirs(os.path.dirname(os.path.abspath(path)), exist_ok=True)
204
+ with open(path, 'w') as f:
205
+ json.dump(out, f)
206
+ print(f'{os.path.basename(args.track)}: {out["bpm"]} bpm, window {start:.2f}-{end:.2f} s, '
207
+ f'drop {"%.2f" % out["drop"] if out["drop"] is not None else "none"} (clip time), '
208
+ f'{len(out["beats"])} beats, {len(out["kicks"])} kicks -> {path}')
209
+
210
+
211
+ if __name__ == '__main__':
212
+ sys.exit(main())
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env node
2
+ // Bundles every sims/<name>/main.js into one self-contained HTML file:
3
+ // teardown-out/dist/<name>.html (three.js, fonts, CSS inlined). Opens from file://,
4
+ // works offline, can be published as-is.
5
+ //
6
+ // node sims/build.mjs every example in sims/
7
+ // node sims/build.mjs v8-live one example
8
+ // node sims/build.mjs ./my-machine your own sim: any folder with a main.js. Import the kit as
9
+ // 'teardown-kit/runtime.js', 'teardown-kit/util.js' and so on.
10
+ //
11
+ // An entry may carry build.json with {"swap": {"heavy.glb": "light.glb"}}: every import of a file named heavy.glb is
12
+ // served from light.glb in the same folder (a site page with lighter models than its film). {"external": {...}} does
13
+ // the same but leaves the model out of the page: the import becomes the string "url:light.glb", the file is copied
14
+ // next to the page and listed in <name>.assets.json (the site build copies those too). The page stays small enough
15
+ // for link crawlers (X reads the share card from it). {"files": [...]} copies more files from node_modules next to the
16
+ // page the same way (decoders a loader fetches at runtime).
17
+ import fs from 'node:fs';
18
+ import path from 'node:path';
19
+ import {fileURLToPath} from 'node:url';
20
+ import {DEPS, DIST, fromDeps} from '../paths.mjs';
21
+
22
+ const esbuild = fromDeps('esbuild');
23
+
24
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
25
+ fs.mkdirSync(DIST, {recursive: true});
26
+
27
+ const font = (weight) => {
28
+ const file = path.join(
29
+ DEPS,
30
+ `@fontsource/jetbrains-mono/files/jetbrains-mono-latin-${weight}-normal.woff2`,
31
+ );
32
+ const b64 = fs.readFileSync(file).toString('base64');
33
+ return `@font-face{font-family:'JetBrains Mono';font-weight:${weight};font-style:normal;font-display:block;src:url(data:font/woff2;base64,${b64}) format('woff2');}`;
34
+ };
35
+ const inter = fs.readFileSync(path.join(DEPS, '@fontsource-variable/inter/files/inter-latin-wght-normal.woff2')).toString('base64');
36
+ const FONTS = [400, 600, 700].map(font).join('\n') +
37
+ `\n@font-face{font-family:'Inter';font-weight:100 900;font-style:normal;font-display:block;src:url(data:font/woff2;base64,${inter}) format('woff2');}`;
38
+ const KIT_CSS = fs.readFileSync(path.join(HERE, 'kit/style.css'), 'utf8');
39
+
40
+ const names = process.argv.slice(2).length
41
+ ? process.argv.slice(2)
42
+ : fs
43
+ .readdirSync(HERE)
44
+ .filter((d) => fs.existsSync(path.join(HERE, d, 'main.js')));
45
+
46
+ // `teardown-kit/x.js` resolves to sims/kit/x.js, so a sim outside this folder can use the kit.
47
+ const kitPlugin = {
48
+ name: 'teardown-kit',
49
+ setup(b) {
50
+ b.onResolve({filter: /^teardown-kit\//}, (args) => ({path: path.join(HERE, 'kit', args.path.slice('teardown-kit/'.length))}));
51
+ },
52
+ };
53
+
54
+ for (const arg of names) {
55
+ const dir = fs.existsSync(path.join(HERE, arg, 'main.js')) ? path.join(HERE, arg) : path.resolve(arg);
56
+ if (!fs.existsSync(path.join(dir, 'main.js'))) {
57
+ console.error(`no main.js in ${dir}`);
58
+ process.exit(1);
59
+ }
60
+ const name = path.basename(dir);
61
+ const t0 = Date.now();
62
+ const cfgFile = path.join(dir, 'build.json');
63
+ const bcfg = fs.existsSync(cfgFile) ? JSON.parse(fs.readFileSync(cfgFile, 'utf8')) : {};
64
+ const swap = bcfg.swap || {};
65
+ const external = bcfg.external || {};
66
+ const assets = [];
67
+ const plugins = Object.keys(external).length
68
+ ? [
69
+ {
70
+ name: 'external',
71
+ setup(b) {
72
+ b.onResolve({filter: /\.glb$/}, (args) => {
73
+ const base = path.basename(args.path);
74
+ if (!external[base]) return undefined;
75
+ const src = path.join(args.resolveDir, path.dirname(args.path), external[base]);
76
+ if (!assets.includes(src)) assets.push(src);
77
+ return {path: external[base], namespace: 'ext'};
78
+ });
79
+ b.onLoad({filter: /.*/, namespace: 'ext'}, (args) => ({contents: `export default ${JSON.stringify('url:' + args.path)};`, loader: 'js'}));
80
+ },
81
+ },
82
+ ]
83
+ : Object.keys(swap).length
84
+ ? [
85
+ {
86
+ name: 'swap',
87
+ setup(b) {
88
+ b.onResolve({filter: /\.glb$/}, (args) => {
89
+ const base = path.basename(args.path);
90
+ if (!swap[base]) return undefined;
91
+ return {path: path.join(args.resolveDir, path.dirname(args.path), swap[base])};
92
+ });
93
+ },
94
+ },
95
+ ]
96
+ : [];
97
+ const res = await esbuild.build({
98
+ plugins: [kitPlugin, ...plugins],
99
+ entryPoints: [path.join(dir, 'main.js')],
100
+ bundle: true,
101
+ nodePaths: [DEPS],
102
+ format: 'esm',
103
+ minify: !process.env.SIMS_DEBUG,
104
+ write: false,
105
+ target: 'es2022',
106
+ legalComments: 'none',
107
+ loader: {'.glb': 'base64', '.woff2': 'base64'},
108
+ logLevel: 'warning',
109
+ });
110
+ const js = res.outputFiles[0].text.replace(/<\/script/g, '<\\/script');
111
+ const css = fs.existsSync(path.join(dir, 'style.css')) ? fs.readFileSync(path.join(dir, 'style.css'), 'utf8') : '';
112
+ const html = `<!doctype html>
113
+ <html lang="en">
114
+ <head>
115
+ <meta charset="utf-8">
116
+ <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
117
+ <title>${name}</title>
118
+ <style>
119
+ ${FONTS}
120
+ ${KIT_CSS}
121
+ ${css}
122
+ </style>
123
+ </head>
124
+ <body>
125
+ <div id="app"></div>
126
+ <script type="module">
127
+ ${js}
128
+ </script>
129
+ </body>
130
+ </html>
131
+ `;
132
+ const out = path.join(DIST, `${name}.html`);
133
+ fs.writeFileSync(out, html);
134
+ const listFile = path.join(DIST, `${name}.assets.json`);
135
+ assets.push(...(bcfg.files || []).map((f) => path.join(DEPS, f)));
136
+ if (assets.length) {
137
+ for (const a of assets) fs.copyFileSync(a, path.join(DIST, path.basename(a)));
138
+ fs.writeFileSync(listFile, JSON.stringify(assets.map((a) => path.basename(a))));
139
+ } else if (fs.existsSync(listFile)) fs.rmSync(listFile);
140
+ console.log(`${out} ${(html.length / 1024).toFixed(0)} KB ${Date.now() - t0} ms`);
141
+ }
@@ -0,0 +1,211 @@
1
+ #!/usr/bin/env node
2
+ // Frame-accurate capture of a sim page to mp4: steps window.SIM.render(t) for
3
+ // every frame in headless Chromium, screenshots, pipes to ffmpeg, then muxes
4
+ // a music track if given.
5
+ //
6
+ // node sims/capture.mjs <name> [--config post.json] [--out teardown-out/x.mp4]
7
+ // [--size 1080x1350] [--dpr 1.3333] [--fps 60] [--from 0] [--to <duration>]
8
+ // (--size is the layout in CSS px; --dpr multiplies the output: 1080x1350
9
+ // at the default 4/3 gives a 1440x1800 video. Default 60 fps, crf 16.)
10
+ // [--music music/track.mp3 [--music-start auto|SEC] [--no-sync] [--lufs -21]] [--crf 21]
11
+ // [--still 12.5] (--still: one PNG, no video)
12
+ // [--stills 0,4,9,14 --cols 3] (tiled review sheet, every tile labelled t=)
13
+ // [--stills beats [--timeline f.json]] (one tile per timeline beat, +0.3 s so motion settles)
14
+ // [--stills every:0.2 --from 3 --to 5] (scrub a transition)
15
+ //
16
+ // <name> is a sim built into teardown-out/dist, or a path to any .html
17
+ // that exposes window.seek(seconds) and freezes its clock on ?render
18
+ // (motion-effects, vox-explainer, milestone-reveal, model-showdown). An .html
19
+ // needs --to <seconds> unless it sets window.DURATION.
20
+ import {spawn} from 'node:child_process';
21
+ import fs from 'node:fs';
22
+ import path from 'node:path';
23
+ import {fileURLToPath, pathToFileURL} from 'node:url';
24
+ import {CHROMIUM, CHROMIUM_ARGS, DIST, FFMPEG, OUT, PYTHON, playwright} from '../paths.mjs';
25
+
26
+ const {chromium} = playwright();
27
+
28
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
29
+ const argv = process.argv.slice(2);
30
+ const name = argv[0];
31
+ const opt = (k, d) => {
32
+ const i = argv.indexOf(`--${k}`);
33
+ return i === -1 ? d : argv[i + 1];
34
+ };
35
+ if (!name) {
36
+ console.error('usage: node sims/capture.mjs <name|file.html> [--config f.json] [--out f.mp4] [--music f.wav]');
37
+ process.exit(1);
38
+ }
39
+ const SEEK = name.endsWith('.html');
40
+ const html = SEEK ? path.resolve(name) : path.join(DIST, `${name}.html`);
41
+ const label = SEEK ? path.basename(name, '.html') : name;
42
+ if (!fs.existsSync(html)) {
43
+ console.error(SEEK ? `missing ${html}` : `missing ${html}; run node sims/build.mjs ${name}`);
44
+ process.exit(1);
45
+ }
46
+ const [W, H] = opt('size', '1080x1350').split('x').map(Number);
47
+ const config = opt('config') ? JSON.parse(fs.readFileSync(opt('config'), 'utf8')) : {};
48
+ // --music <file> [--music-start auto|SECONDS]: analyse the track (sims/beats.py),
49
+ // cut the window so the drop lands ~40% in, and give the beat map to the director.
50
+ const music = opt('music');
51
+ let beats = null;
52
+ if (music) {
53
+ const dur = Number(opt('to', config.duration ?? 30)) - Number(opt('from', 0));
54
+ const ms = opt('music-start', 'auto');
55
+ const cache = path.join(OUT, 'beats', `${path.basename(music).replace(/\.[^.]+$/, '')}-${ms}-${dur}.json`);
56
+ fs.mkdirSync(path.dirname(cache), {recursive: true});
57
+ const {execFileSync} = await import('node:child_process');
58
+ if (!fs.existsSync(cache) || fs.statSync(cache).mtimeMs < fs.statSync(music).mtimeMs) {
59
+ execFileSync(PYTHON, ['-I', path.join(HERE, 'beats.py'), music, '--duration', String(dur), '--start', ms, '-o', cache], {stdio: 'inherit'});
60
+ }
61
+ beats = JSON.parse(fs.readFileSync(cache, 'utf8'));
62
+ if (!opt('no-sync')) config.beats = beats;
63
+ }
64
+ const still = opt('still');
65
+ const stamp = new Date().toISOString().slice(5, 16).replace(/[-:T]/g, '');
66
+ const out = path.resolve(opt('out', path.join(OUT, still ? `${label}-${still}.png` : `${label}-${stamp}.mp4`)));
67
+ fs.mkdirSync(path.dirname(out), {recursive: true});
68
+
69
+ // Browser and GPU flags come from ../paths.mjs.
70
+ const exe = CHROMIUM;
71
+ const browser = await chromium.launch({
72
+ executablePath: exe,
73
+ args: CHROMIUM_ARGS,
74
+ });
75
+ const dpr = Number(opt('dpr', 4 / 3));
76
+ const page = await browser.newPage({viewport: {width: W, height: H}, deviceScaleFactor: dpr});
77
+ page.on('console', (m) => m.type() === 'error' && console.error('[page]', m.text()));
78
+ page.on('pageerror', (e) => console.error('[page error]', e.message));
79
+ await page.addInitScript((cfg) => {
80
+ window.__CAPTURE = true;
81
+ window.__SIM_CONFIG = cfg;
82
+ }, config);
83
+ await page.goto(pathToFileURL(html).href + (SEEK ? '?render' : ''));
84
+ await page.waitForFunction(
85
+ (seek) => (seek ? typeof window.seek === 'function' : window.SIM && window.SIM.ready),
86
+ SEEK,
87
+ {timeout: 60000},
88
+ );
89
+ await page.evaluate(() => document.fonts.ready);
90
+ const info = await page.evaluate((seek) => {
91
+ const gl = document.createElement('canvas').getContext('webgl2');
92
+ const ext = gl && gl.getExtension('WEBGL_debug_renderer_info');
93
+ return {
94
+ duration: seek ? window.DURATION : window.SIM.duration,
95
+ fps: seek ? window.FPS : window.SIM.fps,
96
+ gpu: ext ? gl.getParameter(ext.UNMASKED_RENDERER_WEBGL) : 'unknown',
97
+ };
98
+ }, SEEK);
99
+ console.log(`gpu: ${info.gpu}`);
100
+ // One entry point for both contracts: a sim's SIM.render(t) or a page's seek(t).
101
+ const draw = (t) => page.evaluate(([x, seek]) => (seek ? window.seek(x) : window.SIM.render(x)), [t, SEEK]);
102
+ const end = Number(opt('to', info.duration));
103
+ if (!Number.isFinite(end)) {
104
+ console.error('no duration: pass --to <seconds> or set window.DURATION in the page');
105
+ process.exit(1);
106
+ }
107
+
108
+ // --stills: a list, `beats` (every number in the timeline, +0.3 s), or `every:<step>`.
109
+ const stillTimes = (arg) => {
110
+ if (arg === 'beats') {
111
+ const file = opt('timeline', path.join(HERE, name, 'timeline.json'));
112
+ const tl = JSON.parse(fs.readFileSync(file, 'utf8'));
113
+ const ts = [];
114
+ const walk = (v, key) => {
115
+ if (key === 'fps' || key === 'duration') return;
116
+ if (typeof v === 'number') ts.push(v + 0.3);
117
+ else if (Array.isArray(v)) v.forEach((x) => walk(x));
118
+ else if (v && typeof v === 'object') Object.entries(v).forEach(([k, x]) => walk(x, k));
119
+ };
120
+ walk(tl);
121
+ return [0, ...ts];
122
+ }
123
+ if (arg.startsWith('every:')) {
124
+ const step = Number(arg.slice(6));
125
+ const ts = [];
126
+ for (let t = Number(opt('from', 0)); t <= end + 1e-6; t += step) ts.push(t);
127
+ return ts;
128
+ }
129
+ return arg.split(',').map(Number);
130
+ };
131
+
132
+ const stills = opt('stills');
133
+ if (stills) {
134
+ const ts = [...new Set(stillTimes(stills).map((t) => Math.min(Math.max(t, 0), end - 1 / 120).toFixed(2)))]
135
+ .map(Number)
136
+ .sort((a, b) => a - b);
137
+ const dir = out.replace(/\.(png|mp4)$/, '') + '-frames';
138
+ fs.mkdirSync(dir, {recursive: true});
139
+ for (const [i, t] of ts.entries()) {
140
+ await draw(t);
141
+ // The t= label goes into the DOM for the screenshot only, so no ffmpeg font setup is needed.
142
+ await page.evaluate((txt) => {
143
+ const el = document.createElement('div');
144
+ el.id = '__t';
145
+ el.textContent = txt;
146
+ el.style.cssText =
147
+ 'position:fixed;right:12px;top:12px;z-index:2147483647;font:600 28px monospace;color:#fff;background:rgba(0,0,0,.65);padding:4px 10px;border-radius:4px';
148
+ document.body.appendChild(el);
149
+ }, `t=${t.toFixed(2)}`);
150
+ await page.screenshot({path: path.join(dir, `${String(i).padStart(3, '0')}.png`)});
151
+ await page.evaluate(() => document.getElementById('__t')?.remove());
152
+ }
153
+ await browser.close();
154
+ const cols = Math.min(ts.length, Number(opt('cols', 3)));
155
+ const sheet = out.endsWith('.png') ? out : out.replace(/\.mp4$/, '') + '-sheet.png';
156
+ const tw = Math.round(W * 0.4);
157
+ const th = Math.round(H * 0.4);
158
+ await new Promise((r) =>
159
+ spawn(FFMPEG, ['-loglevel', 'error', '-y', '-framerate', '1', '-i', path.join(dir, '%03d.png'),
160
+ '-vf', `scale=${tw}:${th},tile=${cols}x${Math.ceil(ts.length / cols)}:padding=4:color=0x333333`, '-frames:v', '1', sheet],
161
+ {stdio: 'inherit'}).on('close', r),
162
+ );
163
+ console.log(`→ ${sheet} (full frames in ${dir})`);
164
+ process.exit(0);
165
+ }
166
+
167
+ if (still !== undefined) {
168
+ await draw(Number(still));
169
+ await page.screenshot({path: out});
170
+ await browser.close();
171
+ console.log(`→ ${out}`);
172
+ process.exit(0);
173
+ }
174
+
175
+ const fps = Number(opt('fps', 60));
176
+ const from = Number(opt('from', 0));
177
+ const to = end;
178
+ const frames = Math.round((to - from) * fps);
179
+ const silent = music ? out.replace(/\.mp4$/, '-silent.mp4') : out;
180
+
181
+ const ff = spawn(
182
+ FFMPEG,
183
+ ['-loglevel', 'error', '-y', '-f', 'image2pipe', '-framerate', String(fps), '-i', '-',
184
+ '-c:v', 'libx264', '-preset', 'slow', '-crf', String(opt('crf', 16)), '-pix_fmt', 'yuv420p', '-movflags', '+faststart', silent],
185
+ {stdio: ['pipe', 'inherit', 'inherit']},
186
+ );
187
+ const t0 = Date.now();
188
+ for (let i = 0; i < frames; i++) {
189
+ await draw(from + i / fps);
190
+ const buf = await page.screenshot({type: 'jpeg', quality: 97});
191
+ if (!ff.stdin.write(buf)) await new Promise((r) => ff.stdin.once('drain', r));
192
+ if (i % fps === 0) process.stdout.write(`\r${i}/${frames} frames ${((Date.now() - t0) / 1000).toFixed(0)} s`);
193
+ }
194
+ ff.stdin.end();
195
+ await new Promise((r) => ff.on('close', r));
196
+ await browser.close();
197
+ console.log(`\r${frames}/${frames} frames ${((Date.now() - t0) / 1000).toFixed(0)} s`);
198
+
199
+ if (music) {
200
+ await new Promise((r, j) =>
201
+ spawn(
202
+ FFMPEG,
203
+ ['-loglevel', 'error', '-y', '-i', silent, '-ss', String(beats.start), '-i', music, '-map', '0:v', '-map', '1:a',
204
+ '-c:v', 'copy', '-c:a', 'aac', '-b:a', '256k', '-af', `loudnorm=I=${opt('lufs', -21)}:TP=-3,afade=t=in:d=0.04,afade=t=out:st=${(to - from - 0.6).toFixed(2)}:d=0.6`,
205
+ '-shortest', '-movflags', '+faststart', out],
206
+ {stdio: 'inherit'},
207
+ ).on('close', (c) => (c === 0 ? r() : j(new Error('mux failed')))),
208
+ );
209
+ fs.rmSync(silent);
210
+ }
211
+ console.log(`→ ${out}`);
@@ -0,0 +1,4 @@
1
+ // CESSNA 337 SKYMASTER main landing gear film. Shared code in ../cessna-shared.
2
+ import {run} from '../cessna-shared/film.js';
3
+
4
+ run();
@@ -0,0 +1 @@
1
+ {"duration":26.2}
@@ -0,0 +1,5 @@
1
+ import {runLive} from '../cessna-shared/live.js';
2
+
3
+ // The Cessna 337 main landing gear as an interactive page for the site: takeoff and landing, the timeline, views,
4
+ // display modes, orbit, and an auto tour when left alone.
5
+ runLive();