@litfamily/litclaude 1.0.37 → 1.0.39
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.
- package/CHANGELOG.md +71 -0
- package/README.md +11 -8
- package/README_ko-KR.md +11 -8
- package/bin/litclaude-ai.js +3 -3
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/assets/skills/lit-adhd.webp +0 -0
- package/docs/assets/skills/lit-hijack.webp +0 -0
- package/docs/assets/skills/lit-schematic.webp +0 -0
- package/docs/hooks.md +117 -26
- package/docs/workflow-compatibility-audit.md +1 -1
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/agents/lit-executor.md +4 -2
- package/plugins/litclaude/bin/litclaude-ai +1 -0
- package/plugins/litclaude/bin/litclaude-hook.js +373 -53
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/commands/lit-adhd.md +107 -0
- package/plugins/litclaude/commands/lit-hijack.md +102 -0
- package/plugins/litclaude/commands/lit-loop.md +4 -2
- package/plugins/litclaude/commands/lit-plan.md +5 -4
- package/plugins/litclaude/commands/lit-rewind.md +107 -0
- package/plugins/litclaude/commands/litgoal.md +5 -4
- package/plugins/litclaude/commands/start-work.md +25 -10
- package/plugins/litclaude/hooks/lit-mod.mjs +51 -5
- package/plugins/litclaude/lib/canonical-skill-catalog.mjs +3 -0
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +205 -101
- package/plugins/litclaude/lib/lit-activation.mjs +24 -10
- package/plugins/litclaude/lib/mod/frame.mjs +235 -49
- package/plugins/litclaude/lib/mod/motion.mjs +21 -0
- package/plugins/litclaude/lib/mod/settings.mjs +4 -0
- package/plugins/litclaude/lib/mod/skills.mjs +3 -0
- package/plugins/litclaude/lib/mod/state.mjs +100 -7
- package/plugins/litclaude/lib/mod/svg-card.mjs +167 -25
- package/plugins/litclaude/lib/mod/timeline.mjs +28 -5
- package/plugins/litclaude/lib/mod/toasts.mjs +5 -2
- package/plugins/litclaude/lib/mod/view.mjs +240 -6
- package/plugins/litclaude/lib/mod/workflow.mjs +36 -7
- package/plugins/litclaude/lib/motion-render-gate.mjs +25 -7
- package/plugins/litclaude/lib/render_pages.py +29 -1
- package/plugins/litclaude/lib/rewind/brief.mjs +370 -0
- package/plugins/litclaude/lib/rewind/collect.mjs +413 -0
- package/plugins/litclaude/lib/rewind/gauge.mjs +87 -0
- package/plugins/litclaude/lib/rewind/next-step.mjs +89 -0
- package/plugins/litclaude/lib/rewind/redact.mjs +36 -0
- package/plugins/litclaude/lib/rewind/suggest.mjs +51 -0
- package/plugins/litclaude/lib/rewind/transcripts.mjs +259 -0
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +403 -18
- package/plugins/litclaude/lib/workflow-stack.mjs +243 -0
- package/plugins/litclaude/lib/workflow-stage.mjs +127 -103
- package/plugins/litclaude/scripts/scaffold-plan.mjs +1 -1
- package/plugins/litclaude/skills/frontend-ui-ux/SKILL.md +18 -3
- package/plugins/litclaude/skills/frontend-ui-ux/kit/components.css +414 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/plugins/litclaude/skills/frontend-ui-ux/kit/ui.js +226 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/brand-and-imagery.md +1 -1
- package/plugins/litclaude/skills/frontend-ui-ux/references/complete-contract.md +1 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/craft-floor.md +9 -4
- package/plugins/litclaude/skills/frontend-ui-ux/references/default-editorial-pixel.json +6 -5
- package/plugins/litclaude/skills/frontend-ui-ux/references/house-styles.md +234 -0
- package/plugins/litclaude/skills/frontend-ui-ux/references/motion-guide.md +3 -3
- package/plugins/litclaude/skills/frontend-ui-ux/references/production-interview.md +1 -1
- package/plugins/litclaude/skills/frontend-ui-ux/references/slop-register.md +7 -7
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-lock.mjs +196 -0
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +30 -9
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-rules.mjs +19 -7
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-static.mjs +12 -2
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe.mjs +53 -6
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/plugins/litclaude/skills/lit-adhd/SKILL.md +168 -0
- package/plugins/litclaude/skills/lit-adhd/references/card-examples.md +125 -0
- package/plugins/litclaude/skills/lit-adhd/references/status-taxonomy.md +43 -0
- package/plugins/litclaude/skills/lit-adhd/scripts/rewind.mjs +11 -0
- package/plugins/litclaude/skills/lit-diagram-drawer/SKILL.md +17 -5
- package/plugins/litclaude/skills/lit-diagram-drawer/references/style-guide.md +20 -11
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/plugins/litclaude/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/references/verifier-guide.md +1 -1
- package/plugins/litclaude/skills/lit-diagram-drawer/scripts/visual-quality.mjs +3 -3
- package/plugins/litclaude/skills/lit-docx/SKILL.md +6 -1
- package/plugins/litclaude/skills/lit-docx/references/direction-step.md +8 -4
- package/plugins/litclaude/skills/lit-handoff/SKILL.md +2 -1
- package/plugins/litclaude/skills/lit-hijack/SKILL.md +551 -0
- package/plugins/litclaude/skills/lit-hijack/references/capture-and-provenance.md +124 -0
- package/plugins/litclaude/skills/lit-hijack/references/clean-room-build.md +133 -0
- package/plugins/litclaude/skills/lit-hijack/references/distil-and-licence.md +128 -0
- package/plugins/litclaude/skills/lit-hijack/references/gap-and-port-design.md +152 -0
- package/plugins/litclaude/skills/lit-hijack/references/parity-and-report.md +131 -0
- package/plugins/litclaude/skills/lit-hijack/scripts/hijack.mjs +854 -0
- package/plugins/litclaude/skills/lit-loop/SKILL.md +4 -3
- package/plugins/litclaude/skills/lit-plan/SKILL.md +16 -10
- package/plugins/litclaude/skills/lit-pptx/SKILL.md +35 -15
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/plugins/litclaude/skills/lit-pptx/fonts/provenance.json +32 -1
- package/plugins/litclaude/skills/lit-pptx/references/agents/architect.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/anti-slop-checklist.md +32 -11
- package/plugins/litclaude/skills/lit-pptx/references/authoring-guide.md +2 -2
- package/plugins/litclaude/skills/lit-pptx/references/data-display-cookbook.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/density-and-fill.md +3 -4
- package/plugins/litclaude/skills/lit-pptx/references/direction-step.md +23 -4
- package/plugins/litclaude/skills/lit-pptx/references/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/15-design-lecture-bauhaus-ko.md +139 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/16-community-programme-riso-ko.md +158 -0
- package/plugins/litclaude/skills/lit-pptx/references/examples/17-public-data-briefing-newsroom-ko.md +179 -0
- package/plugins/litclaude/skills/lit-pptx/references/layout-families.md +22 -26
- package/plugins/litclaude/skills/lit-pptx/references/title-treatments.md +30 -26
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/atlas.md +4 -4
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/chalk.md +3 -3
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/gazette.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/ledger.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/night.md +1 -1
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/paper.md +3 -3
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/riso.md +137 -0
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/signal.md +2 -2
- package/plugins/litclaude/skills/lit-pptx/references/tonalities/studio.md +6 -7
- package/plugins/litclaude/skills/lit-pptx/scripts/compile-deck.js +1 -1
- package/plugins/litclaude/skills/lit-pptx/scripts/craft_extras.py +135 -91
- package/plugins/litclaude/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/render-pack.js +370 -563
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/plugins/litclaude/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/plugins/litclaude/skills/lit-pptx/scripts/qa_deck.py +5 -5
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/plugins/litclaude/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/plugins/litclaude/skills/lit-recap/SKILL.md +4 -0
- package/plugins/litclaude/skills/lit-schematic/SKILL.md +123 -0
- package/plugins/litclaude/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/plugins/litclaude/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/plugins/litclaude/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/plugins/litclaude/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/plugins/litclaude/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/plugins/litclaude/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/plugins/litclaude/skills/lit-schematic/references/journal-figures.md +72 -0
- package/plugins/litclaude/skills/lit-schematic/references/kit-api.md +134 -0
- package/plugins/litclaude/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/plugins/litclaude/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/plugins/litclaude/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/plugins/litclaude/skills/lit-schematic/references/verification.md +100 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/fonts.mjs +27 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/render.mjs +233 -0
- package/plugins/litclaude/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/plugins/litclaude/skills/lit-scientific-visualization/SKILL.md +14 -4
- package/plugins/litclaude/skills/lit-typographic-motion/SKILL.md +54 -45
- package/plugins/litclaude/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +11 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/blender/runner.py +218 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/core/presets.mjs +1 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/analysis.mjs +65 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/assets.mjs +208 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/blender.mjs +143 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/board.mjs +136 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/brief.mjs +7 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/chrome.mjs +6 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-assets.mjs +5 -3
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-capture.mjs +4 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover-treatment.mjs +37 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/cover.mjs +17 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/done.mjs +42 -3
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/frame-worker.mjs +7 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/gallery.mjs +121 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/house.mjs +44 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/look.mjs +33 -19
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/pipeline.mjs +18 -7
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/scaffold.mjs +210 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/score.mjs +639 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/sound-cli.mjs +21 -4
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/sound.mjs +126 -27
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-capture.mjs +7 -6
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-gate.mjs +59 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-qa.mjs +141 -9
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage-serve.mjs +28 -5
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/stage.mjs +82 -14
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/styles.mjs +213 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/node/treatment.mjs +311 -10
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/cover-init.js +14 -2
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/init.js +11 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/qa.js +6 -1
- package/plugins/litclaude/skills/lit-typographic-motion/engine/stage/stage-kit.js +83 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/plugins/litclaude/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/hero-3d/expected.json +69 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/painted-light/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/recipes/weight-tide/expected.json +2 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/cover.md +67 -15
- package/plugins/litclaude/skills/lit-typographic-motion/references/craft-loop.md +3 -2
- package/plugins/litclaude/skills/lit-typographic-motion/references/depth.md +122 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/look.md +28 -13
- package/plugins/litclaude/skills/lit-typographic-motion/references/runtime.md +4 -3
- package/plugins/litclaude/skills/lit-typographic-motion/references/sound.md +92 -23
- package/plugins/litclaude/skills/lit-typographic-motion/references/stage.md +43 -22
- package/plugins/litclaude/skills/lit-typographic-motion/references/studio.md +245 -0
- package/plugins/litclaude/skills/lit-typographic-motion/references/style-bibles.md +30 -6
- package/plugins/litclaude/skills/lit-typographic-motion/references/treatment.md +108 -14
- package/plugins/litclaude/skills/lit-typographic-motion/scripts/motion-doctor.mjs +16 -3
- package/plugins/litclaude/skills/lit-typographic-motion/scripts/motion.mjs +47 -7
- package/plugins/litclaude/skills/lit-typographic-motion/styles/paper.json +41 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/swiss-signal.json +41 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/terminalcore.json +42 -0
- package/plugins/litclaude/skills/lit-typographic-motion/styles/tidal.json +41 -0
- package/plugins/litclaude/skills/litgoal/SKILL.md +3 -2
- package/plugins/litclaude/skills/litresearch/SKILL.md +5 -0
- package/plugins/litclaude/skills/readme-studio/SKILL.md +10 -0
- package/plugins/litclaude/skills/readme-studio/references/production-interview.md +2 -0
- package/plugins/litclaude/skills/readme-studio/templates/hyperframes-cover/package-lock.json +3 -3
- package/plugins/litclaude/skills/readme-studio/templates/remotion-cover/package-lock.json +3 -3
- package/plugins/litclaude/skills/start-work/SKILL.md +24 -11
- package/scripts/qa-cover-recipes.mjs +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Cover capture: one headless Chrome on the stage path's software rung, laid out at the cover's CSS
|
|
1
|
+
// Cover capture: one headless Chrome on the stage path's software rung (the GPU rung for a 3D hero), laid out at the cover's CSS
|
|
2
2
|
// size and captured at twice that (device scale 2), the page served from disk on the synthetic stage
|
|
3
3
|
// origin, the cover init script injected before any page script. The renderer SEEKS: it calls
|
|
4
4
|
// window.renderFrame(t, { mask }) for any t in [0, 1) in any order, captures, and a worker pool
|
|
@@ -18,13 +18,13 @@ const withTimeout = (promise, ms, message) => Promise.race([
|
|
|
18
18
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
19
19
|
|
|
20
20
|
/** The stage flag set at the cover's device scale. */
|
|
21
|
-
export const coverFlags = ({ width, height, scale }) => stageFlags({ width, height }).map((f) => (f === "--force-device-scale-factor=1" ? `--force-device-scale-factor=${scale}` : f));
|
|
21
|
+
export const coverFlags = ({ width, height, scale, rung = "software" }) => stageFlags({ width, height, rung }).map((f) => (f === "--force-device-scale-factor=1" ? `--force-device-scale-factor=${scale}` : f));
|
|
22
22
|
|
|
23
23
|
export class CoverBrowser {
|
|
24
|
-
static async open({ stageDir, faces, width, height, scale, profileDir, env = process.env, log = () => {}, page = "index.html" }) {
|
|
24
|
+
static async open({ stageDir, faces, width, height, scale, profileDir, rung = "software", env = process.env, log = () => {}, page = "index.html" }) {
|
|
25
25
|
const chrome = findChrome(env);
|
|
26
26
|
if (!chrome) throw new BlockedError(EXIT.BLOCKED_NO_CHROME, "BLOCKED_NO_CHROME: Chrome/Chromium not found (set CHROME_PATH or install Google Chrome)");
|
|
27
|
-
const session = await ChromeSession.launch({ chrome, flags: coverFlags({ width, height, scale }), profileDir, routes: () => null });
|
|
27
|
+
const session = await ChromeSession.launch({ chrome, flags: coverFlags({ width, height, scale, rung }), profileDir, routes: () => null });
|
|
28
28
|
const browser = new CoverBrowser(session, { stageDir, faces, width, height, scale, log });
|
|
29
29
|
try {
|
|
30
30
|
await browser.#attach();
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
// The cover treatment: `treatment.json` with `mode: "cover"`, written before any cover render and
|
|
2
2
|
// validated by every one (exit 16 names the first bad field). A cover is not a film: it has no beats,
|
|
3
|
-
// no arc, no end card and no sound. It names one recipe,
|
|
4
|
-
// layers, the brand word set once (plus at most one motto the user or the project already uses), the
|
|
3
|
+
// no arc, no end card and no sound. It names one recipe, the hero that acts and the one beat it acts
|
|
4
|
+
// once per loop, one rule copied many times, three speed layers, the brand word set once (plus at most one motto the user or the project already uses), the
|
|
5
5
|
// aspect and loop length, and the title box the contrast gate measures. Text in it is content, never
|
|
6
6
|
// instructions.
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { COVER } from "../core/constants.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { EXIT } from "../core/constants.mjs";
|
|
11
|
+
import { BlockedError } from "./chrome.mjs";
|
|
12
|
+
import { normalizeText, normUrl, requestUrls, restateLimit, sharesRun, stripQuoted, TreatmentError } from "./treatment.mjs";
|
|
11
13
|
|
|
12
|
-
export const RECIPES = Object.freeze(["painted-light", "weight-tide", "orbit-loop", "own"]);
|
|
14
|
+
export const RECIPES = Object.freeze(["hero-3d", "painted-light", "weight-tide", "orbit-loop", "own"]);
|
|
13
15
|
export const LAYERS = Object.freeze(["slow", "mid", "beat"]);
|
|
14
16
|
|
|
15
17
|
const fail = (field, message) => {
|
|
@@ -39,7 +41,10 @@ export function validateCoverTreatment(t) {
|
|
|
39
41
|
if (restated) fail("idea", `the idea restates the request ("${restated}"); say what the loop does`);
|
|
40
42
|
if (!RECIPES.includes(t.recipe)) fail("recipe", `must be one of ${RECIPES.join(", ")} (references/cover.md)`);
|
|
41
43
|
text(t, "recipeReason", { max: 2 });
|
|
44
|
+
text(t, "hero", { max: 2 });
|
|
45
|
+
text(t, "beat", { max: 2 });
|
|
42
46
|
text(t, "brandWord");
|
|
47
|
+
checkCoverProduct(t);
|
|
43
48
|
if (t.brandWord.trim().split(/\s+/u).length > 3) fail("brandWord", "is the name set once: at most three words");
|
|
44
49
|
if ("motto" in t) {
|
|
45
50
|
const m = t.motto;
|
|
@@ -85,6 +90,21 @@ export function validateCoverTreatment(t) {
|
|
|
85
90
|
return { ...t, page, out, frames, encode, seed: Number.isInteger(t.seed) ? t.seed >>> 0 : 0 };
|
|
86
91
|
}
|
|
87
92
|
|
|
93
|
+
// A link in the request names the product: the cover is built from its real logo, images and words,
|
|
94
|
+
// fetched by `motion.mjs assets --cover` before the treatment, never from the name alone.
|
|
95
|
+
function checkCoverProduct(t) {
|
|
96
|
+
const urls = requestUrls(t.request);
|
|
97
|
+
if (!("product" in t)) {
|
|
98
|
+
if (urls.length) fail("product", `missing: the request links ${urls[0]}; fetch its real assets first with motion.mjs assets --out <dir> --url <link> --cover, look at them, and set product { name, url } (cover.md, Named products)`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const p = t.product;
|
|
102
|
+
if (!p || typeof p !== "object") fail("product", "must be an object { name, url }");
|
|
103
|
+
text(t, "product.name");
|
|
104
|
+
if (urls.length && !urls.includes(normUrl(p.url))) fail("product.url", `must be the link the request gives (${urls.join(", ")})`);
|
|
105
|
+
if ("unreachable" in p) text(t, "product.unreachable");
|
|
106
|
+
}
|
|
107
|
+
|
|
88
108
|
/** Load and validate `<out>/treatment.json` as a cover; keeps the first valid one for the done-check. */
|
|
89
109
|
export function loadCoverTreatment(out) {
|
|
90
110
|
const file = path.join(out, "treatment.json");
|
|
@@ -97,6 +117,19 @@ export function loadCoverTreatment(out) {
|
|
|
97
117
|
}
|
|
98
118
|
if (raw?.mode !== "cover") fail("mode", "this treatment is a film: render it with stage or make (references/treatment.md); a cover sets mode: cover");
|
|
99
119
|
const treatment = validateCoverTreatment(raw);
|
|
120
|
+
const p = treatment.product;
|
|
121
|
+
if (p?.unreachable) throw new BlockedError(EXIT.BLOCKED_ASSET_MISSING, `BLOCKED_ASSET_MISSING: ${p.name}'s real assets could not be reached (${p.unreachable}); ask the user for its logo or README images, put them in ${path.join(out, "cover", "assets")} and list them in assets.json`);
|
|
122
|
+
if (p && !existsSync(path.join(out, "product.json"))) fail("product", `no ${path.join(out, "product.json")}: run motion.mjs assets --out ${out} --url ${p.url} --cover first`);
|
|
123
|
+
if (p) {
|
|
124
|
+
let fetched = [];
|
|
125
|
+
try {
|
|
126
|
+
fetched = JSON.parse(readFileSync(path.join(out, "product.json"), "utf8"))?.product?.assets ?? [];
|
|
127
|
+
} catch (error) {
|
|
128
|
+
fail("product", `${path.join(out, "product.json")} is not valid JSON (${error.message}); run motion.mjs assets --out ${out} --url ${p.url} --cover again`);
|
|
129
|
+
}
|
|
130
|
+
const astray = fetched.filter((a) => !String(a?.path ?? "").startsWith("cover/assets/"));
|
|
131
|
+
if (astray.length) fail("product", `${astray[0].path} sits outside cover/assets/, where the cover page cannot load it; run motion.mjs assets --out ${out} --url ${p.url} --cover again`);
|
|
132
|
+
}
|
|
100
133
|
const first = path.join(out, ".run", "treatment.first.json");
|
|
101
134
|
if (!existsSync(first)) {
|
|
102
135
|
mkdirSync(path.dirname(first), { recursive: true });
|
|
@@ -213,9 +213,21 @@ export async function renderCover({ out, round = 1, env = process.env, log = ()
|
|
|
213
213
|
let replay;
|
|
214
214
|
let sought;
|
|
215
215
|
const order = seekOrder(times.length, treatment.seed || 20261020);
|
|
216
|
+
let rung = treatment.recipe === "hero-3d" ? "gpu" : "software";
|
|
217
|
+
const notices = [];
|
|
216
218
|
try {
|
|
217
|
-
const open = (label) => CoverBrowser.open({ stageDir, faces, width: pw, height: ph, scale: COVER.captureScale, profileDir: path.join(runDir, `chrome-${label}`), env, log });
|
|
218
|
-
|
|
219
|
+
const open = (label) => CoverBrowser.open({ stageDir, faces, width: pw, height: ph, scale: COVER.captureScale, profileDir: path.join(runDir, `chrome-${label}`), rung, env, log });
|
|
220
|
+
let a;
|
|
221
|
+
try {
|
|
222
|
+
a = await open("master");
|
|
223
|
+
} catch (error) {
|
|
224
|
+
// The 3D hero asks for the GPU rung; when it cannot start or draw there, all three passes take
|
|
225
|
+
// the software rung (they must share one) and the report says so.
|
|
226
|
+
if (rung !== "gpu" || error.code === EXIT.BLOCKED_NO_CHROME || error.code === EXIT.STAGE_NETWORK_REQUEST || error.code === EXIT.STAGE_NONDETERMINISTIC) throw error;
|
|
227
|
+
notices.push(`the 3D hero asked for the GPU rung and it failed there (${String(error.message).slice(0, 120)}); rendered on the software rung (SwiftShader), slower, same frames`);
|
|
228
|
+
rung = "software";
|
|
229
|
+
a = await open("master");
|
|
230
|
+
}
|
|
219
231
|
try {
|
|
220
232
|
master = await capturePass({ browser: a, pool, times, dir: dirs.frames, prefix: "f", width: w, height: h });
|
|
221
233
|
await capturePass({ browser: a, pool, times, dir: dirs.masks, prefix: "m", mask: true, width: w, height: h });
|
|
@@ -290,12 +302,12 @@ export async function renderCover({ out, round = 1, env = process.env, log = ()
|
|
|
290
302
|
});
|
|
291
303
|
const indexed = stills.finish(sheetFile);
|
|
292
304
|
writeFileSync(path.join(out, "poster.png"), readFileSync(path.join(stills.dir, "poster.png")));
|
|
293
|
-
const report = formatCoverReport(gate, { strict: true })
|
|
305
|
+
const report = `${formatCoverReport(gate, { strict: true })}${notices.map((n) => `warning: ${n}\n`).join("")}`;
|
|
294
306
|
writeFileSync(path.join(out, "gate-report.txt"), report);
|
|
295
307
|
const manifest = {
|
|
296
308
|
schema: "litclaude.motion-cover/v1", mode: "cover", round, recipe: treatment.recipe,
|
|
297
309
|
treatmentSha256: sha256(readFileSync(path.join(out, "treatment.json"))), stillsSha256: indexed.sha256,
|
|
298
|
-
page: treatment.page, size: treatment.out, scale: COVER.captureScale, fps: treatment.fps, frames: times.length, frameMs: ms,
|
|
310
|
+
page: treatment.page, size: treatment.out, scale: COVER.captureScale, rung, warnings: notices, fps: treatment.fps, frames: times.length, frameMs: ms,
|
|
299
311
|
encoder: encoded.encoder, encode: treatment.encode, file: path.basename(encoded.file), bytes: statSync(encoded.file).size, captureSec,
|
|
300
312
|
gate: { pass: gate.pass, target: gate.target, medianD: gate.medianD, movingFrac: gate.movingFrac, longestStillSec: gate.longestStillSec, spike: gate.spike, seamLocal: gate.seamLocal, gates: gate.gates },
|
|
301
313
|
};
|
|
@@ -341,7 +353,7 @@ export async function renderCoverWindow({ out, round = 1, window: [t0, t1], env
|
|
|
341
353
|
mkdirSync(dir, { recursive: true });
|
|
342
354
|
const [w, h] = treatment.out;
|
|
343
355
|
const pool = new CoverPool();
|
|
344
|
-
const browser = await CoverBrowser.open({ stageDir, faces, width: treatment.page[0], height: treatment.page[1], scale: COVER.captureScale, profileDir: path.join(out, ".run", "cover-window-chrome"), env, log });
|
|
356
|
+
const browser = await CoverBrowser.open({ stageDir, faces, width: treatment.page[0], height: treatment.page[1], scale: COVER.captureScale, profileDir: path.join(out, ".run", "cover-window-chrome"), rung: treatment.recipe === "hero-3d" ? "gpu" : "software", env, log });
|
|
345
357
|
try {
|
|
346
358
|
await capturePass({ browser, pool, times: [...new Set(picks.map((p) => p.index))].map((i) => [i, i / treatment.frames]), dir, prefix: "f", width: w, height: h });
|
|
347
359
|
} finally {
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
// treatment with the first valid one and records any downgrade. A cover (treatment mode: cover) is
|
|
7
7
|
// done on its own terms: the decoded cover reached every TARGET gate, and the last look round viewed
|
|
8
8
|
// the contact sheet, the poster and the seam pair of that render. A generated asset in assets.json
|
|
9
|
-
// becomes a label the reply has to carry.
|
|
9
|
+
// becomes a label the reply has to carry. A film whose treatment asks for a preview (`preview: true`)
|
|
10
|
+
// is done at its board: a stills-only render whose layout check passed, looked at, storyboard included.
|
|
10
11
|
import { createHash } from "node:crypto";
|
|
11
12
|
import { existsSync, readFileSync } from "node:fs";
|
|
12
13
|
import path from "node:path";
|
|
13
14
|
import { generatedLabels } from "./cover-assets.mjs";
|
|
14
15
|
import { validateCoverTreatment } from "./cover-treatment.mjs";
|
|
16
|
+
import { readHouse } from "./house.mjs";
|
|
15
17
|
import { readLook } from "./look.mjs";
|
|
16
18
|
import { readStills } from "./stills.mjs";
|
|
17
19
|
import { validateTreatment } from "./treatment.mjs";
|
|
@@ -49,10 +51,11 @@ export function evaluateDone({ out, viewedFiles = null }) {
|
|
|
49
51
|
try {
|
|
50
52
|
const raw = JSON.parse(readFileSync(tFile, "utf8"));
|
|
51
53
|
if (raw?.mode === "cover") return evaluateCoverDone({ out, raw, viewedFiles });
|
|
52
|
-
treatment = validateTreatment(raw);
|
|
54
|
+
treatment = validateTreatment(raw, { house: readHouse(out) });
|
|
53
55
|
} catch (error) {
|
|
54
56
|
return notDone(`treatment.json is not valid: ${error.message}`);
|
|
55
57
|
}
|
|
58
|
+
if (treatment.preview === true) return evaluatePreviewDone({ out, viewedFiles });
|
|
56
59
|
const manifestFile = path.join(out, "manifest.json");
|
|
57
60
|
const reportFile = path.join(out, "gate-report.txt");
|
|
58
61
|
if (!existsSync(manifestFile) || !existsSync(reportFile)) return notDone("no full render has finished (manifest.json or gate-report.txt is missing)");
|
|
@@ -85,7 +88,7 @@ export function evaluateDone({ out, viewedFiles = null }) {
|
|
|
85
88
|
if (stills && last.stillsSha256 !== stills.sha256) reasons.push("the last look round was recorded before the final render (its stills manifest differs); look again and record it");
|
|
86
89
|
if (last.blocked === "no-vision-tool") unviewed = true;
|
|
87
90
|
else if (stills) {
|
|
88
|
-
const required = stills.index.files.filter((f) => ["poster", "sheet", "beat", "strip"].includes(f.kind)).map((f) => f.file);
|
|
91
|
+
const required = stills.index.files.filter((f) => ["poster", "sheet", "beat", "strip", "board"].includes(f.kind)).map((f) => f.file);
|
|
89
92
|
const missing = required.filter((f) => !last.viewed?.includes(f));
|
|
90
93
|
if (missing.length) reasons.push(`the last look round did not view ${missing.slice(0, 4).join(", ")}${missing.length > 4 ? ` (+${missing.length - 4})` : ""}`);
|
|
91
94
|
if (viewedFiles) {
|
|
@@ -110,6 +113,42 @@ export function evaluateDone({ out, viewedFiles = null }) {
|
|
|
110
113
|
return { status: unviewed ? "DONE_UNVIEWED" : "DONE", reasons: [], downgraded, openItems };
|
|
111
114
|
}
|
|
112
115
|
|
|
116
|
+
/** A preview: the board round of a film is the deliverable; the full render waits for the user. */
|
|
117
|
+
export function evaluatePreviewDone({ out, viewedFiles = null }) {
|
|
118
|
+
const reasons = [];
|
|
119
|
+
const stills = readStills(out);
|
|
120
|
+
if (!stills) return { status: "NOT_DONE", reasons: ["no board yet: render with --stills-only"], downgraded: [], openItems: [], preview: true };
|
|
121
|
+
const board = stills.index.files.find((f) => f.kind === "board");
|
|
122
|
+
if (!board) reasons.push("the stills set has no storyboard (stills/board.png); render with --stills-only again");
|
|
123
|
+
try {
|
|
124
|
+
const check = JSON.parse(readFileSync(path.join(out, "stills", "check.json"), "utf8"));
|
|
125
|
+
const failed = (check.rules ?? []).filter((x) => x.status === "FAIL").map((x) => x.id);
|
|
126
|
+
if (failed.length) reasons.push(`the board check failed (${failed.join(", ")}); fix the page and render the board again`);
|
|
127
|
+
} catch {
|
|
128
|
+
if (stills.index.path === "stage") reasons.push("the board check result (stills/check.json) is missing");
|
|
129
|
+
}
|
|
130
|
+
let look;
|
|
131
|
+
try {
|
|
132
|
+
look = readLook(out);
|
|
133
|
+
} catch {
|
|
134
|
+
return { status: "NOT_DONE", reasons: ["look.json is unreadable"], downgraded: [], openItems: [], preview: true };
|
|
135
|
+
}
|
|
136
|
+
const last = look.rounds[look.rounds.length - 1];
|
|
137
|
+
if (!last) reasons.push("no look round on the board: open the storyboard and the stills with Read and record round 1");
|
|
138
|
+
else {
|
|
139
|
+
if (last.stillsSha256 !== stills.sha256) reasons.push("the look round was recorded before the latest board; look again and record it");
|
|
140
|
+
const required = stills.index.files.filter((f) => ["board", "sheet", "beat"].includes(f.kind)).map((f) => f.file);
|
|
141
|
+
const missing = required.filter((f) => !last.viewed?.includes(f));
|
|
142
|
+
if (missing.length) reasons.push(`the look round did not view ${missing.slice(0, 4).join(", ")}`);
|
|
143
|
+
if (viewedFiles) {
|
|
144
|
+
const unopened = (last.viewed ?? []).filter((f) => !viewedFiles.has(path.resolve(out, f)));
|
|
145
|
+
if (unopened.length) reasons.push(`these files are listed as viewed but were never opened with the image tool: ${unopened.slice(0, 4).join(", ")}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (reasons.length) return { status: "NOT_DONE", reasons, downgraded: [], openItems: [], preview: true };
|
|
149
|
+
return { status: last.blocked === "no-vision-tool" ? "DONE_UNVIEWED" : "DONE", reasons: [], downgraded: [], openItems: [], preview: true, labels: [`this is the storyboard preview (${path.join(out, "stills", "board.png")}); the film is not rendered yet, and the user can say go to render it`] };
|
|
150
|
+
}
|
|
151
|
+
|
|
113
152
|
/** The cover branch of the done-check (references/cover.md, Done). */
|
|
114
153
|
export function evaluateCoverDone({ out, raw, viewedFiles = null }) {
|
|
115
154
|
const notDone = (reason) => ({ status: "NOT_DONE", reasons: [reason], downgraded: [], openItems: [], mode: "cover" });
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// One frame-analysis worker: decode a captured PNG to RGBA and analyse it off the capture thread
|
|
2
|
-
// (the SHA-256 of the decoded RGBA, the flash-audit cells on the frame's own grid, the
|
|
3
|
-
// percentile luminance). The capture loop steps the next
|
|
2
|
+
// (the SHA-256 of the decoded RGBA, the flash-audit cells on the frame's own grid, the 0.5th and
|
|
3
|
+
// 99.5th percentile luminance, the busy-cell share for DEAD-AIR). The capture loop steps the next
|
|
4
|
+
// frame while a pool of these decodes.
|
|
4
5
|
import { parentPort } from "node:worker_threads";
|
|
5
|
-
import { analyzeFrame } from "./analysis.mjs";
|
|
6
|
+
import { analyzeFrame, busyShare } from "./analysis.mjs";
|
|
6
7
|
import { decodePng } from "./png.mjs";
|
|
7
8
|
|
|
8
9
|
parentPort.on("message", ({ id, png, width, height }) => {
|
|
@@ -14,9 +15,10 @@ parentPort.on("message", ({ id, png, width, height }) => {
|
|
|
14
15
|
}
|
|
15
16
|
const rgba = image.channels === 4 ? image.pixels : toRgba(image.pixels, image.channels);
|
|
16
17
|
// A stage frame is opaque: analyzeFrame's alpha-as-ink count is meaningless here and is dropped.
|
|
17
|
-
const { cells, luminanceP995, rgbaSha256 } = analyzeFrame(rgba, width, height);
|
|
18
|
+
const { cells, luminanceP995, luminanceP005, rgbaSha256 } = analyzeFrame(rgba, width, height);
|
|
19
|
+
const busy = busyShare(rgba, width, height);
|
|
18
20
|
const buffer = rgba.buffer.slice(rgba.byteOffset, rgba.byteOffset + rgba.byteLength);
|
|
19
|
-
parentPort.postMessage({ id, rgba: buffer, cells, luminanceP995, rgbaSha256 }, [buffer, cells.R.buffer, cells.G.buffer, cells.B.buffer]);
|
|
21
|
+
parentPort.postMessage({ id, rgba: buffer, cells, luminanceP995, luminanceP005, rgbaSha256, busy }, [buffer, cells.R.buffer, cells.G.buffer, cells.B.buffer]);
|
|
20
22
|
} catch (error) {
|
|
21
23
|
parentPort.postMessage({ id, error: error.message });
|
|
22
24
|
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// `motion.mjs styles --out <dir> [--format 16:9|9:16]`: the style gallery. One short demo film, the
|
|
2
|
+
// same treatment and the same drawings, rendered as a board round in every house style, so a person
|
|
3
|
+
// can see what each style looks like before asking for a film. Each style's board lands in
|
|
4
|
+
// `<dir>/<style>/stills/board.png`, and `<dir>/styles.png` puts them side by side. The demo also
|
|
5
|
+
// proves the styles and the scaffold pass the board check as shipped.
|
|
6
|
+
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { EXIT } from "../core/constants.mjs";
|
|
9
|
+
import { decodePng } from "./png.mjs";
|
|
10
|
+
import { scaffoldHtml } from "./scaffold.mjs";
|
|
11
|
+
import { renderStage } from "./stage.mjs";
|
|
12
|
+
import { composeGrid } from "./stills.mjs";
|
|
13
|
+
import { STYLE_IDS, readStyle } from "./styles.mjs";
|
|
14
|
+
|
|
15
|
+
const COPY = ["작게 시작해서 끝까지", "One clock for every frame", "한 화면에 한 가지 생각", "Same house, every film"];
|
|
16
|
+
|
|
17
|
+
/** The demo treatment for one style: four shots, one of each text layout, 12 s. */
|
|
18
|
+
export function demoTreatment(styleId, format = "16:9") {
|
|
19
|
+
const style = readStyle(styleId);
|
|
20
|
+
const hand = (i) => style.transitions[i % style.transitions.length];
|
|
21
|
+
const vertical = format === "9:16" ? " vertical" : "";
|
|
22
|
+
const beats = [
|
|
23
|
+
{ t0: 0, t1: 3, layout: "title", hero: "The opening line lands while a ring draws itself behind it.", purpose: "Open on the promise.", onScreen: "A ring drawing on behind the opening line.", motion: "The ring draws on; the line rises in.", sound: "Pad opens with a hit on the first word." },
|
|
24
|
+
{ t0: 3, t1: 6, layout: "split", hero: "Five bars rise in turn beside the line.", purpose: "Show the system.", onScreen: "Five bars rising beside one line.", motion: "Bars rise in stagger.", sound: "Hit on the cut." },
|
|
25
|
+
{ t0: 6, t1: 9, layout: "split-alt", hero: "A dot travels a path from left to right.", purpose: "Show one idea per screen.", onScreen: "A dot crossing a drawn path.", motion: "The dot travels the path.", sound: "A rise into the close." },
|
|
26
|
+
{ t0: 9, t1: 12, layout: "stage", hero: "A grid of squares settles above the closing line.", purpose: "Close on the house.", onScreen: "A settling grid of squares over a closing caption.", motion: "Squares settle in stagger.", sound: "Closing cadence." },
|
|
27
|
+
].map((b, i, all) => ({ ...b, lines: [i], transition: i === all.length - 1 ? "end" : hand(i) }));
|
|
28
|
+
return {
|
|
29
|
+
// A calibration sheet, not a film: the same simple demo in every style, so the styles compare.
|
|
30
|
+
request: `render a 12 s${vertical} simple demo film in the ${styleId} style`,
|
|
31
|
+
register: "minimal",
|
|
32
|
+
genre: "other", path: "stage", pathReason: "The demo draws shapes beside its type, which the type engine cannot draw.",
|
|
33
|
+
style: styleId,
|
|
34
|
+
idea: "Four screens, one per layout, so the house style can be judged before a film is made.",
|
|
35
|
+
audience: "Someone choosing a house style for their films.", channel: "A gallery sheet viewed before a film is made, played with sound.",
|
|
36
|
+
format, formatReason: format === "9:16" ? "The gallery shows the vertical layouts." : "The gallery shows the landscape layouts.",
|
|
37
|
+
durationSec: 12, beats,
|
|
38
|
+
story: { expect: "Four screens that each show a new shape.", turn: "The bars of the second screen become the path the dot travels on the third.", beat: 2, payoff: "Everything settles into one grid above the closing line." },
|
|
39
|
+
protagonist: { name: "the signal mark", kind: "object", look: "The style's signal colour as a ring, bars, a dot and one accent square.", acts: [{ beat: 0, action: "Draws itself as a ring." }, { beat: 1, action: "Rises as five bars." }, { beat: 2, action: "Travels the path as a dot." }, { beat: 3, action: "Lands as the accent square of the grid." }] },
|
|
40
|
+
subject: { name: "the style demo", source: "invented", specifics: ["Four screens with a ring, bars, a travelling dot and a grid.", "Each screen uses one layout of the house grid."] },
|
|
41
|
+
visualDevices: [{ kind: "shape", role: "subject", beats: [0, 1, 2, 3] }, { kind: "path", role: "support", beats: [2] }],
|
|
42
|
+
typePlan: { faces: [style.faces.headline.family], hierarchy: "One line per screen in the style's headline or display size.", maxWordsOnScreen: 6 },
|
|
43
|
+
sound: { mode: "generated", plan: "The style's own bed with a hit on the cuts and a closing cadence.", palette: { ...style.sound }, events: [{ t: 1.2, on: "The ring closes.", kind: "tap" }, { t: 4.4, on: "The last bar reaches its height.", kind: "tap" }, { t: 10.6, on: "The accent square lands in the grid.", kind: "chime" }] },
|
|
44
|
+
copy: { source: "invented", lines: COPY },
|
|
45
|
+
inventions: ["the style demo (its four screens)", "all four copy lines"],
|
|
46
|
+
ambition: "Each screen shows one layout cleanly so the style's type, colour and motion read at a glance.",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// The demo's drawings: generic shapes in the style's own colours, one per shot.
|
|
51
|
+
const DEMO_DRAW = [
|
|
52
|
+
`(s, svg) => {
|
|
53
|
+
const z = LitStage.zone(s.layout, "subject");
|
|
54
|
+
const r = Math.min(z.w, z.h) * 0.34;
|
|
55
|
+
const len = 2 * Math.PI * r;
|
|
56
|
+
svg.innerHTML = \`<circle cx="\${z.w * 0.5}" cy="\${z.h * 0.5}" r="\${r}" fill="none" stroke="var(--lit-line)" stroke-width="6"/><circle cx="\${z.w * 0.5}" cy="\${z.h * 0.5}" r="\${r}" fill="none" stroke="var(--lit-signal)" stroke-width="6" stroke-dasharray="\${len}" stroke-dashoffset="\${len * (1 - s.enter(0, 1.6))}"/>\`;
|
|
57
|
+
},`,
|
|
58
|
+
`(s, svg) => {
|
|
59
|
+
const z = LitStage.zone(s.layout, "subject");
|
|
60
|
+
const w = z.w / 9;
|
|
61
|
+
svg.innerHTML = [0, 1, 2, 3, 4].map((k) => { const h = z.h * (0.3 + 0.12 * k) * s.enter(0.1 + k * T.stagger.item * 2, T.dur.hero); return \`<rect x="\${w * (1 + k * 1.6)}" y="\${z.h * 0.9 - h}" width="\${w}" height="\${h}" fill="\${k === 4 ? "var(--lit-accent, var(--lit-signal))" : "var(--lit-signal)"}"/>\`; }).join("");
|
|
62
|
+
},`,
|
|
63
|
+
`(s, svg) => {
|
|
64
|
+
const z = LitStage.zone(s.layout, "subject");
|
|
65
|
+
const x = z.w * (0.1 + 0.8 * T.ease.move(LitStage.clamp(s.local / (s.length * 0.8))));
|
|
66
|
+
svg.innerHTML = \`<path d="M\${z.w * 0.1} \${z.h * 0.6} C \${z.w * 0.35} \${z.h * 0.2}, \${z.w * 0.65} \${z.h * 0.9}, \${z.w * 0.9} \${z.h * 0.45}" fill="none" stroke="var(--lit-line)" stroke-width="5"/><circle cx="\${x}" cy="\${z.h * 0.55}" r="\${z.h * 0.06}" fill="var(--lit-signal)"/>\`;
|
|
67
|
+
},`,
|
|
68
|
+
`(s, svg) => {
|
|
69
|
+
const z = LitStage.zone(s.layout, "subject");
|
|
70
|
+
const n = 8;
|
|
71
|
+
const c = Math.min(z.w / (n + 2), z.h / 4);
|
|
72
|
+
const cells = [];
|
|
73
|
+
for (let k = 0; k < n * 2; k++) { const e = s.enter(0.05 * k, T.dur.move); cells.push(\`<rect x="\${c * (1 + (k % n)) + c * 0.1}" y="\${z.h * 0.3 + c * Math.floor(k / n) + (1 - e) * 30}" width="\${c * 0.8}" height="\${c * 0.8}" opacity="\${e}" fill="\${k === 11 ? "var(--lit-accent, var(--lit-signal))" : "var(--lit-muted)"}"/>\`); }
|
|
74
|
+
svg.innerHTML = cells.join("");
|
|
75
|
+
},`,
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
/** The demo page: the scaffold with the demo drawings in its DRAW slots. */
|
|
79
|
+
export function demoPage(treatment) {
|
|
80
|
+
let k = 0;
|
|
81
|
+
return scaffoldHtml(treatment).replace(/ {4}\(s, svg, t\) => \{\},/gu, () => ` ${DEMO_DRAW[k++ % DEMO_DRAW.length]}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Render the gallery: a board round per style, then one sheet of the four boards. */
|
|
85
|
+
export async function stylesCommand({ out, format = "16:9", env = process.env, log = () => {} }) {
|
|
86
|
+
if (!["16:9", "9:16"].includes(format)) return { code: EXIT.USAGE, message: "--format is 16:9 or 9:16" };
|
|
87
|
+
mkdirSync(out, { recursive: true });
|
|
88
|
+
const boards = [];
|
|
89
|
+
const verdicts = [];
|
|
90
|
+
for (const id of STYLE_IDS) {
|
|
91
|
+
const dir = path.join(out, id);
|
|
92
|
+
rmSync(dir, { recursive: true, force: true });
|
|
93
|
+
mkdirSync(path.join(dir, "stage"), { recursive: true });
|
|
94
|
+
const treatment = demoTreatment(id, format);
|
|
95
|
+
writeFileSync(path.join(dir, "treatment.json"), `${JSON.stringify(treatment, null, 2)}\n`);
|
|
96
|
+
writeFileSync(path.join(dir, "stage", "index.html"), demoPage(treatment));
|
|
97
|
+
log(`styles: rendering the ${id} board`);
|
|
98
|
+
const r = await renderStage({ out: dir, round: 1, stillsOnly: true, env, log });
|
|
99
|
+
verdicts.push(`${id}: ${r.code === EXIT.OK ? "board check PASS" : r.message.split(";")[0]}`);
|
|
100
|
+
boards.push(decodePng(readFileSync(path.join(dir, "stills", "board.png"))));
|
|
101
|
+
}
|
|
102
|
+
const rgba = boards.map((b) => (b.channels === 4 ? b.pixels : toRgba(b.pixels, b.channels)));
|
|
103
|
+
const sheet = composeGrid(rgba, boards[0].width, boards[0].height, { cols: 2, tw: 960, th: 540 });
|
|
104
|
+
const file = path.join(out, "styles.png");
|
|
105
|
+
writeFileSync(file, sheet);
|
|
106
|
+
const failed = verdicts.filter((v) => !/PASS$/u.test(v));
|
|
107
|
+
return { code: failed.length ? EXIT.GATE_FAIL_QA : EXIT.OK, message: `STYLES: ${file}\n${verdicts.join("\n")}` };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function toRgba(pixels, channels) {
|
|
111
|
+
const n = pixels.length / channels;
|
|
112
|
+
const out = Buffer.alloc(n * 4);
|
|
113
|
+
for (let i = 0; i < n; i++) {
|
|
114
|
+
out[i * 4] = pixels[i * channels];
|
|
115
|
+
out[i * 4 + 1] = pixels[i * channels + (channels >= 3 ? 1 : 0)];
|
|
116
|
+
out[i * 4 + 2] = pixels[i * channels + (channels >= 3 ? 2 : 0)];
|
|
117
|
+
out[i * 4 + 3] = 255;
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// The house file: `motion-house.json` beside a film's output folder (the user's working directory).
|
|
2
|
+
// A full render that passes its gate writes it, or appends the film to it; while it exists, the
|
|
3
|
+
// treatment validator holds every new film in that folder to its style unless the request names
|
|
4
|
+
// another. It is data the validator reads, so the second film starts from the first one's style
|
|
5
|
+
// without anyone having to remember it.
|
|
6
|
+
import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { STYLE_IDS } from "./styles.mjs";
|
|
9
|
+
|
|
10
|
+
export const HOUSE_FILE = "motion-house.json";
|
|
11
|
+
export const HOUSE_SCHEMA = "litclaude.motion-house/v1";
|
|
12
|
+
const MAX_FILMS = 50;
|
|
13
|
+
|
|
14
|
+
export const houseFileFor = (out) => path.join(path.dirname(path.resolve(out)), HOUSE_FILE);
|
|
15
|
+
|
|
16
|
+
/** The house record for an output folder, or null when there is none or it is unusable. */
|
|
17
|
+
export function readHouse(out) {
|
|
18
|
+
const file = houseFileFor(out);
|
|
19
|
+
if (!existsSync(file)) return null;
|
|
20
|
+
try {
|
|
21
|
+
const house = JSON.parse(readFileSync(file, "utf8"));
|
|
22
|
+
if (house?.schema !== HOUSE_SCHEMA || !STYLE_IDS.includes(house.style)) return null;
|
|
23
|
+
return house;
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Record a passed film. The first film sets the house style; later films are appended. A film in a
|
|
31
|
+
* style the request named outright is appended without moving the house style.
|
|
32
|
+
*/
|
|
33
|
+
export function recordHouse(out, { style, path: renderPath, format, durationSec, now = new Date() }) {
|
|
34
|
+
const file = houseFileFor(out);
|
|
35
|
+
const house = readHouse(out) ?? { schema: HOUSE_SCHEMA, style, createdAt: now.toISOString(), films: [] };
|
|
36
|
+
const dir = path.basename(path.resolve(out));
|
|
37
|
+
const films = (Array.isArray(house.films) ? house.films : []).filter((f) => f?.dir !== dir);
|
|
38
|
+
films.push({ dir, style, path: renderPath, format, durationSec, at: now.toISOString() });
|
|
39
|
+
const next = { ...house, films: films.slice(-MAX_FILMS) };
|
|
40
|
+
const tmp = `${file}.tmp`;
|
|
41
|
+
writeFileSync(tmp, `${JSON.stringify(next, null, 2)}\n`);
|
|
42
|
+
renameSync(tmp, file);
|
|
43
|
+
return next;
|
|
44
|
+
}
|
|
@@ -11,15 +11,16 @@ import { BlockedError } from "./chrome.mjs";
|
|
|
11
11
|
import { readStills } from "./stills.mjs";
|
|
12
12
|
|
|
13
13
|
export const LOOK_FILE = "look.json";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
// Film question 10 is the story turn, answered on the turn beat's own still (story.beat).
|
|
15
|
+
export const QUESTIONS = Object.freeze([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
|
|
16
|
+
// Cover mode asks its own nine (references/cover.md): motion in every half second, the seam, the
|
|
17
|
+
// motion surviving the encoder, the brand word, the three speed layers, slide-likeness, damage, what
|
|
18
|
+
// a motion designer would change, and the hero acting its beat once per loop.
|
|
19
|
+
export const COVER_QUESTIONS = Object.freeze([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
|
20
|
+
// A "no" on these, a "yes" on the next, or a named question (film 7, cover 8) needs another round.
|
|
20
21
|
const REVISE = Object.freeze({
|
|
21
|
-
film: { no: new Set([1, 2, 3, 5, 6]), yes: new Set([4, 8, 9]), named: 7 },
|
|
22
|
-
cover: { no: new Set([1, 2, 3, 4, 5]), yes: new Set([6, 7]), named: 8 },
|
|
22
|
+
film: { no: new Set([1, 2, 3, 5, 6, 10]), yes: new Set([4, 8, 9]), named: 7 },
|
|
23
|
+
cover: { no: new Set([1, 2, 3, 4, 5, 9]), yes: new Set([6, 7]), named: 8 },
|
|
23
24
|
});
|
|
24
25
|
const PLACEHOLDER = /<[^<>\n]{1,80}>/u;
|
|
25
26
|
const BARE = /^\s*(?:yes|no|y|n|ok|none|named|네|아니요|아니오|예|없음|있음)[.!]?\s*$/iu;
|
|
@@ -62,18 +63,28 @@ export function reviseTriggers(answers, mode = "film") {
|
|
|
62
63
|
return answers.filter((a) => (r.no.has(a.q) && a.verdict === "no") || (r.yes.has(a.q) && a.verdict === "yes") || (a.q === r.named && a.verdict === "named")).map((a) => a.q);
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
/** The still of the story's turn beat (`stills/beat-NN.png`), or null when the treatment names none. */
|
|
67
|
+
function turnStill(out) {
|
|
68
|
+
try {
|
|
69
|
+
const beat = JSON.parse(readFileSync(path.join(out, "treatment.json"), "utf8")).story?.beat;
|
|
70
|
+
return Number.isInteger(beat) ? `stills/beat-${String(beat + 1).padStart(2, "0")}.png` : null;
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
65
76
|
/** Validate an answers document against the current stills set; returns the round record. */
|
|
66
77
|
export function checkAnswers(doc, { round, stills, out }) {
|
|
67
78
|
if (!doc || typeof doc !== "object") refuse("the answers file must be a JSON object");
|
|
68
79
|
const cover = stills.index.mode === "cover";
|
|
69
80
|
const questions = cover ? COVER_QUESTIONS : QUESTIONS;
|
|
70
81
|
const namedQ = cover ? REVISE.cover.named : REVISE.film.named;
|
|
71
|
-
if (!cover && doc.defects !== undefined) refuse("defects are a cover-mode record; a film round names its weakest beat instead");
|
|
72
82
|
const listed = new Set(stills.index.files.map((f) => f.file));
|
|
73
83
|
const inSet = (file) => listed.has(file) && existsSync(path.join(out, file));
|
|
74
84
|
if (!Array.isArray(doc.viewed) || !doc.viewed.length) refuse("viewed must list every stills file you opened with the image tool this round");
|
|
75
85
|
for (const file of doc.viewed) if (!inSet(file)) refuse(`viewed file ${JSON.stringify(file)} is not in the latest stills set (${path.join(out, "stills", "index.json")})`);
|
|
76
|
-
if (!Array.isArray(doc.answers)) refuse(`answers must be an array of the ${cover ? "
|
|
86
|
+
if (!Array.isArray(doc.answers)) refuse(`answers must be an array of the ${cover ? "nine cover" : "ten"} questions`);
|
|
87
|
+
const turn = cover ? null : turnStill(out);
|
|
77
88
|
const answers = [];
|
|
78
89
|
const seen = new Set();
|
|
79
90
|
for (const a of doc.answers) {
|
|
@@ -83,6 +94,7 @@ export function checkAnswers(doc, { round, stills, out }) {
|
|
|
83
94
|
const verdicts = a.q === namedQ ? ["none", "named"] : ["yes", "no"];
|
|
84
95
|
if (!verdicts.includes(a.verdict)) refuse(`question ${a.q}: verdict must be ${verdicts.join(" or ")}`);
|
|
85
96
|
if (!inSet(a.frame)) refuse(`question ${a.q}: frame ${JSON.stringify(a.frame)} is not in the latest stills set`);
|
|
97
|
+
if (a.q === 10 && turn && a.frame !== turn) refuse(`question 10: answer it on the turn beat's still ${turn} (story.beat in treatment.json)`);
|
|
86
98
|
if (!isObservation(a.observed)) refuse(`question ${a.q}: observed must be at least one sentence naming a concrete visible detail in ${a.frame}, not a bare verdict`);
|
|
87
99
|
if (a.q === 1 && !cover) {
|
|
88
100
|
if (!["blind", "self"].includes(a.by)) refuse("question 1: by must be blind (a fresh subagent that saw only the sheet and the beat stills) or self");
|
|
@@ -100,26 +112,28 @@ export function checkAnswers(doc, { round, stills, out }) {
|
|
|
100
112
|
}
|
|
101
113
|
answers.sort((a, b) => a.q - b.q);
|
|
102
114
|
const defects = checkDefects(doc.defects, { cover, stills, inSet });
|
|
103
|
-
return { answers, viewed: [...new Set(doc.viewed)], weakestBeat: doc.weakestBeat ?? null, change: doc.change ?? null, aids: Array.isArray(doc.aids) ? doc.aids.map(String) : [], ...(cover ? { defects } : {}) };
|
|
115
|
+
return { answers, viewed: [...new Set(doc.viewed)], weakestBeat: doc.weakestBeat ?? null, change: doc.change ?? null, aids: Array.isArray(doc.aids) ? doc.aids.map(String) : [], ...(cover || defects.length ? { defects } : {}) };
|
|
104
116
|
}
|
|
105
117
|
|
|
106
118
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* `frame` a file of the current stills set that shows it. A
|
|
110
|
-
* fix
|
|
119
|
+
* Defects: at most three per round, worst first, each { t, region, frame, observed, cause, fix }. `t`
|
|
120
|
+
* is the time in seconds where the defect shows (the loop time for a cover), `region` the
|
|
121
|
+
* [x, y, w, h] it covers in frame pixels, `frame` a file of the current stills set that shows it. A
|
|
122
|
+
* cover checks the fix with a window re-render around `t`; a film fixes those seconds and renders the
|
|
123
|
+
* board again. Optional on a film round, where the named weakest beat stays required in round 1.
|
|
111
124
|
*/
|
|
112
125
|
function checkDefects(list, { cover, stills, inSet }) {
|
|
113
|
-
if (list === undefined
|
|
126
|
+
if (list === undefined) return [];
|
|
114
127
|
if (!Array.isArray(list)) refuse("defects must be an array");
|
|
115
128
|
if (list.length > COVER.maxDefects) refuse(`at most ${COVER.maxDefects} defects per round; fix the worst first`);
|
|
116
|
-
const { width, height
|
|
129
|
+
const { width, height } = stills.index;
|
|
130
|
+
const durationSec = stills.index.durationSec ?? (stills.index.frameCount && stills.index.fps ? stills.index.frameCount / stills.index.fps : null);
|
|
117
131
|
return list.map((d, i) => {
|
|
118
132
|
const f = `defect ${i + 1}`;
|
|
119
133
|
if (!d || typeof d !== "object") refuse(`${f} must be an object`);
|
|
120
|
-
if (typeof d.t !== "number" || !(d.t >= 0) || (durationSec && d.t >= durationSec)) refuse(`${f}: t must be the loop time in seconds${durationSec ? ` (0 to ${durationSec})` : ""} where the defect shows`);
|
|
134
|
+
if (typeof d.t !== "number" || !(d.t >= 0) || (durationSec && d.t >= durationSec)) refuse(`${f}: t must be the ${cover ? "loop " : ""}time in seconds${durationSec ? ` (0 to ${durationSec})` : ""} where the defect shows`);
|
|
121
135
|
const r = d.region;
|
|
122
|
-
if (!Array.isArray(r) || r.length !== 4 || !r.every(Number.isInteger) || r[0] < 0 || r[1] < 0 || r[2] <= 0 || r[3] <= 0 || r[0] + r[2] > width || r[1] + r[3] > height) refuse(`${f}: region must be [x, y, w, h] inside the ${width}x${height} cover`);
|
|
136
|
+
if (!Array.isArray(r) || r.length !== 4 || !r.every(Number.isInteger) || r[0] < 0 || r[1] < 0 || r[2] <= 0 || r[3] <= 0 || r[0] + r[2] > width || r[1] + r[3] > height) refuse(`${f}: region must be [x, y, w, h] inside the ${width}x${height} ${cover ? "cover" : "frame"}`);
|
|
123
137
|
if (!inSet(d.frame)) refuse(`${f}: frame ${JSON.stringify(d.frame)} is not in the latest stills set`);
|
|
124
138
|
if (!isObservation(d.observed)) refuse(`${f}: observed must be at least one sentence naming what is visible there`);
|
|
125
139
|
if (![d.cause, d.fix].every((x) => typeof x === "string" && x.trim().length >= 8 && !PLACEHOLDER.test(x))) refuse(`${f}: cause and fix must each say something concrete`);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// brief): timeline -> pre-flight gate -> stills -> contact sheet -> [--stills-only stops] -> master,
|
|
3
3
|
// preview, poster, reduced-motion still into .run/stage -> determinism re-render and perf in a second
|
|
4
4
|
// Chrome process -> full gate -> promote, or withhold on a flash-audit FAIL.
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
5
6
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, createWriteStream } from "node:fs";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { spawnSync } from "node:child_process";
|
|
@@ -23,6 +24,8 @@ import { formatReport, formatPreflightReport } from "./report.mjs";
|
|
|
23
24
|
import { loadTreatment, TreatmentError } from "./treatment.mjs";
|
|
24
25
|
import { viewedCount } from "./look.mjs";
|
|
25
26
|
import { stillsPlan, writeStills } from "./stills.mjs";
|
|
27
|
+
import { addToStills, writeBoard } from "./board.mjs";
|
|
28
|
+
import { recordHouse } from "./house.mjs";
|
|
26
29
|
import { treatmentSha } from "./done.mjs";
|
|
27
30
|
import { auditMuxed } from "./sound.mjs";
|
|
28
31
|
import { soundTrackFor } from "./sound-cli.mjs";
|
|
@@ -183,7 +186,7 @@ export function cutFrames(plan) {
|
|
|
183
186
|
* midpoints, a -6/0/+6 strip at each of the engine's cuts, and a 12-frame sheet. Returns the frames
|
|
184
187
|
* so a full render can rewrite the index with the delivered poster.
|
|
185
188
|
*/
|
|
186
|
-
async function renderStillsSet({ session, plan, treatment, out, round, stillsOnly }) {
|
|
189
|
+
async function renderStillsSet({ session, plan, treatment, out, round, stillsOnly, env = process.env, log = () => {} }) {
|
|
187
190
|
const beats = treatment.beats.map((b) => ({ t0: Math.min(b.t0, plan.durationSec), t1: Math.min(b.t1, plan.durationSec) }));
|
|
188
191
|
const cuts = plan.shots.slice(1).map((sh) => Math.round(sh.start * plan.fps)).filter((c) => c > 0 && c < plan.frameCount);
|
|
189
192
|
const layout = stillsPlan({ beats, fps: plan.fps, frameCount: plan.frameCount, cuts, posterBeat: treatment.posterBeat });
|
|
@@ -194,8 +197,15 @@ async function renderStillsSet({ session, plan, treatment, out, round, stillsOnl
|
|
|
194
197
|
frames.set(n, Buffer.from(bytes));
|
|
195
198
|
});
|
|
196
199
|
}
|
|
197
|
-
|
|
198
|
-
|
|
200
|
+
// Every stills set carries the storyboard (references/studio.md), drawn from its beat stills.
|
|
201
|
+
const write = async (posterFile = null) => {
|
|
202
|
+
const stills = writeStills({ out, plan: layout, frames, width: 1920, height: 1080, fps: plan.fps, frameCount: plan.frameCount, round, stillsOnly, path: "type", posterFile });
|
|
203
|
+
const beatFiles = stills.index.files.filter((f) => f.kind === "beat").sort((a, b) => a.beat - b.beat).map((f) => path.join(out, f.file));
|
|
204
|
+
await writeBoard({ out, treatment, beatFiles, env, log });
|
|
205
|
+
stills.sha256 = addToStills(out, { file: "stills/board.png", kind: "board", frames: layout.beats }, { sha256: (b) => createHash("sha256").update(b).digest("hex") });
|
|
206
|
+
return stills;
|
|
207
|
+
};
|
|
208
|
+
return { layout, frames, stills: await write(), write };
|
|
199
209
|
}
|
|
200
210
|
|
|
201
211
|
function contrastFrames(plan) {
|
|
@@ -444,10 +454,10 @@ export async function make({ briefPath, out, round = 1, stillsOnly = false, view
|
|
|
444
454
|
let poster;
|
|
445
455
|
let still;
|
|
446
456
|
try {
|
|
447
|
-
stillsSet = await renderStillsSet({ session, plan, treatment: prep.treatment, out, round, stillsOnly: stillsOnly || !ffmpeg });
|
|
457
|
+
stillsSet = await renderStillsSet({ session, plan, treatment: prep.treatment, out, round, stillsOnly: stillsOnly || !ffmpeg, env, log });
|
|
448
458
|
log(`stills: ${stillsSet.stills.files.length} files in ${path.join(out, "stills")}`);
|
|
449
459
|
if (stillsOnly) {
|
|
450
|
-
return { code: EXIT.OK, message: `STILLS_ONLY:
|
|
460
|
+
return { code: EXIT.OK, message: `STILLS_ONLY: open the storyboard ${path.join(out, "stills", "board.png")} and every file in ${path.join(out, "stills")} (index.json lists them), record the round with look --round ${round}, make the change, then render the film with --round ${round + 1} (no --stills-only)`, plan, stills: stillsSet.stills, egress: session.egress, renderer: session.renderer };
|
|
451
461
|
}
|
|
452
462
|
if (!ffmpeg) {
|
|
453
463
|
return { code: EXIT.BLOCKED_NO_FFMPEG_FOR_VIDEO, message: `BLOCKED_NO_FFMPEG_FOR_VIDEO: ffmpeg is not on PATH; the stills and contact sheet are in ${path.join(out, "stills")}; install ffmpeg for the MP4, preview and poster`, plan };
|
|
@@ -496,7 +506,8 @@ export async function make({ briefPath, out, round = 1, stillsOnly = false, view
|
|
|
496
506
|
const { gate, manifest } = collectAndEvaluate({ out, previewRecords: preview.records, previewFps: preview.rung?.fps, determinism, perf, coverage: pre.coverage, still, extraRules: soundAudit.rules });
|
|
497
507
|
const promoted = promote({ out, gate });
|
|
498
508
|
const loc = (name) => (promoted.withheld ? path.join(out, "withheld", name) : path.join(out, name));
|
|
499
|
-
if (existsSync(loc("poster.png"))) stillsSet.write(loc("poster.png"));
|
|
509
|
+
if (existsSync(loc("poster.png"))) await stillsSet.write(loc("poster.png"));
|
|
510
|
+
if (gate.pass && !promoted.withheld) recordHouse(out, { style: prep.treatment.style, path: "type", format: prep.treatment.format, durationSec: prep.treatment.durationSec });
|
|
500
511
|
const report = formatReport({
|
|
501
512
|
manifest, reason: plan.reason, gate, round, framesViewed: resolveViewed(out, viewed), software: manifest.softwareRenderer, withheld: promoted.withheld,
|
|
502
513
|
outputs: { film: loc("film.mp4"), preview: preview.file ? loc(path.basename(preview.file)) : "(no preview under 3 MB)", poster: loc("poster.png"), still: loc("reduced-motion.png") },
|
|
@@ -568,7 +579,7 @@ export async function partial({ mode, briefPath, out, env = process.env, log = (
|
|
|
568
579
|
const session = await openSession({ plan: prep.plan, fontKeys: prep.fontKeys, runDir: prep.runDir, env, log });
|
|
569
580
|
try {
|
|
570
581
|
if (mode === "stills" || mode === "sheet") {
|
|
571
|
-
const set = await renderStillsSet({ session, plan: prep.plan, treatment: prep.treatment, out, round: 1, stillsOnly: true });
|
|
582
|
+
const set = await renderStillsSet({ session, plan: prep.plan, treatment: prep.treatment, out, round: 1, stillsOnly: true, env, log });
|
|
572
583
|
return { code: EXIT.OK, message: `STILLS: ${set.stills.files.length} files in ${path.join(out, "stills")} (the sheet is stills/sheet.png)` };
|
|
573
584
|
}
|
|
574
585
|
const perf = await perfCheck({ session, plan: prep.plan });
|