@litfamily/litgravity 0.1.1 → 0.1.3
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 +46 -0
- package/README.md +19 -3
- package/README_ko-KR.md +19 -3
- package/TRADEMARK.md +12 -0
- package/package.json +3 -2
- package/plugin/hooks/lib/lanes.mjs +65 -0
- package/plugin/hooks/lib/liveness.mjs +81 -0
- package/plugin/hooks/lib/motion.mjs +34 -5
- package/plugin/hooks/lib/reentry.mjs +7 -0
- package/plugin/hooks/lib/rewind/brief.mjs +364 -0
- package/plugin/hooks/lib/rewind/collect.mjs +359 -0
- package/plugin/hooks/lib/rewind/gauge.mjs +55 -0
- package/plugin/hooks/lib/rewind/next-step.mjs +77 -0
- package/plugin/hooks/lib/rewind/redact.mjs +60 -0
- package/plugin/hooks/lib/rewind/transcripts.mjs +214 -0
- package/plugin/hooks/lib/routes.mjs +79 -5
- package/plugin/hooks/lib/workflow-stack.mjs +213 -0
- package/plugin/hooks/post-tool-use.mjs +39 -1
- package/plugin/hooks/pre-invocation.mjs +93 -2
- package/plugin/hooks/session-start.mjs +26 -3
- package/plugin/hooks/stop.mjs +55 -6
- package/plugin/hud/looks.mjs +29 -0
- package/plugin/hud/render.mjs +277 -12
- package/plugin/plugin.json +1 -1
- package/plugin/skills/frontend-ui-ux/SKILL.md +12 -1
- package/plugin/skills/frontend-ui-ux/kit/components.css +417 -0
- package/plugin/skills/frontend-ui-ux/kit/fonts.json +22 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/landing.html +164 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/settings.html +114 -0
- package/plugin/skills/frontend-ui-ux/kit/layouts/workspace.html +115 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/computational-brutalism.json +227 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/field-notes.json +205 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/graphite.json +200 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/meadow.json +199 -0
- package/plugin/skills/frontend-ui-ux/kit/styles/neo-brutalism.json +222 -0
- package/plugin/skills/frontend-ui-ux/kit/ui.js +226 -0
- package/plugin/skills/frontend-ui-ux/references/house-styles.md +234 -0
- package/plugin/skills/frontend-ui-ux/scripts/design-lock.mjs +400 -0
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-lock.mjs +196 -0
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +30 -9
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe-rules.mjs +20 -8
- package/plugin/skills/frontend-ui-ux/scripts/interface-probe.mjs +42 -9
- package/plugin/skills/frontend-ui-ux/scripts/pixel-art.mjs +60 -0
- package/plugin/skills/lit-adhd/SKILL.md +160 -0
- package/plugin/skills/lit-adhd/references/card-examples.md +107 -0
- package/plugin/skills/lit-adhd/references/status-taxonomy.md +34 -0
- package/plugin/skills/lit-adhd/scripts/rewind.mjs +5 -0
- package/plugin/skills/lit-diagram-drawer/SKILL.md +5 -3
- package/plugin/skills/lit-diagram-drawer/references/drawing-rules.md +1 -1
- package/plugin/skills/lit-diagram-drawer/references/style-guide.md +21 -12
- package/plugin/skills/lit-diagram-drawer/references/type-architecture.md +3 -3
- package/plugin/skills/lit-diagram-drawer/references/type-dependency.md +1 -1
- package/plugin/skills/lit-diagram-drawer/references/type-tree.md +3 -3
- package/plugin/skills/lit-diagram-drawer/references/type-wardley.md +1 -1
- package/plugin/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +1 -2
- package/plugin/skills/lit-diagram-drawer/scripts/visual-quality.mjs +1 -2
- package/plugin/skills/lit-docx/SKILL.md +3 -3
- package/plugin/skills/lit-handoff/SKILL.md +1 -0
- package/plugin/skills/lit-hijack/SKILL.md +263 -0
- package/plugin/skills/lit-hijack/references/capture-and-provenance.md +100 -0
- package/plugin/skills/lit-hijack/references/clean-room-build.md +75 -0
- package/plugin/skills/lit-hijack/references/distil-and-licence.md +67 -0
- package/plugin/skills/lit-hijack/references/gap-and-port-design.md +100 -0
- package/plugin/skills/lit-hijack/references/parity-and-report.md +85 -0
- package/plugin/skills/lit-hijack/scripts/hijack.mjs +953 -0
- package/plugin/skills/lit-plan/SKILL.md +3 -2
- package/plugin/skills/lit-plan/references/plan-contract.md +12 -1
- package/plugin/skills/lit-plan/scripts/check-plan.mjs +39 -3
- package/plugin/skills/lit-plan/templates/plan.md +3 -0
- package/plugin/skills/lit-pptx/SKILL.md +8 -8
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Bold.ttf +0 -0
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/JetBrainsMono-Regular.ttf +0 -0
- package/plugin/skills/lit-pptx/fonts/jetbrains-mono/OFL.txt +93 -0
- package/plugin/skills/lit-pptx/fonts/provenance.json +32 -1
- package/plugin/skills/lit-pptx/references/agents/analyst.md +34 -56
- package/plugin/skills/lit-pptx/references/agents/antithesis.md +49 -67
- package/plugin/skills/lit-pptx/references/agents/architect.md +38 -51
- package/plugin/skills/lit-pptx/references/agents/critic.md +25 -41
- package/plugin/skills/lit-pptx/references/agents/synthesizer.md +37 -46
- package/plugin/skills/lit-pptx/references/agents/thesis.md +29 -49
- package/plugin/skills/lit-pptx/references/anti-slop-checklist.md +119 -145
- package/plugin/skills/lit-pptx/references/authoring-guide.md +187 -278
- package/plugin/skills/lit-pptx/references/consensus-protocol.md +99 -97
- package/plugin/skills/lit-pptx/references/data-display-cookbook.md +36 -137
- package/plugin/skills/lit-pptx/references/density-and-fill.md +147 -216
- package/plugin/skills/lit-pptx/references/design-system-azure.md +56 -85
- package/plugin/skills/lit-pptx/references/direction-step.md +134 -176
- package/plugin/skills/lit-pptx/references/examples/01-pitch-signal-ko.md +114 -115
- package/plugin/skills/lit-pptx/references/examples/02-pitch-studio-ko.md +66 -66
- package/plugin/skills/lit-pptx/references/examples/03-business-review-ledger-ko.md +63 -63
- package/plugin/skills/lit-pptx/references/examples/04-business-review-night-en.md +96 -96
- package/plugin/skills/lit-pptx/references/examples/05-research-talk-paper-en.md +81 -81
- package/plugin/skills/lit-pptx/references/examples/06-lecture-chalk-ko.md +103 -103
- package/plugin/skills/lit-pptx/references/examples/07-data-review-night-en.md +100 -98
- package/plugin/skills/lit-pptx/references/examples/08-image-led-atlas-ko.md +76 -76
- package/plugin/skills/lit-pptx/references/examples/09-briefing-gazette-ko.md +96 -96
- package/plugin/skills/lit-pptx/references/examples/10-status-update-ledger-ko.md +80 -80
- package/plugin/skills/lit-pptx/references/examples/11-portfolio-studio-en.md +72 -72
- package/plugin/skills/lit-pptx/references/examples/12-research-tutorial-chalk-en.md +95 -95
- package/plugin/skills/lit-pptx/references/examples/13-engineering-review-computational-brutalism-ko.md +173 -0
- package/plugin/skills/lit-pptx/references/examples/14-launch-pitch-neo-brutalism-ko.md +154 -0
- package/plugin/skills/lit-pptx/references/examples/15-design-lecture-bauhaus-ko.md +139 -0
- package/plugin/skills/lit-pptx/references/examples/16-community-programme-riso-ko.md +158 -0
- package/plugin/skills/lit-pptx/references/examples/17-public-data-briefing-newsroom-ko.md +179 -0
- package/plugin/skills/lit-pptx/references/interview-protocol.md +83 -102
- package/plugin/skills/lit-pptx/references/layout-families.md +161 -265
- package/plugin/skills/lit-pptx/references/stages/autopilot.md +30 -70
- package/plugin/skills/lit-pptx/references/stages/interview.md +36 -68
- package/plugin/skills/lit-pptx/references/stages/plan.md +26 -67
- package/plugin/skills/lit-pptx/references/title-treatments.md +93 -145
- package/plugin/skills/lit-pptx/references/tonalities/atlas.md +95 -108
- package/plugin/skills/lit-pptx/references/tonalities/bauhaus.md +140 -0
- package/plugin/skills/lit-pptx/references/tonalities/chalk.md +107 -122
- package/plugin/skills/lit-pptx/references/tonalities/computational-brutalism.md +150 -0
- package/plugin/skills/lit-pptx/references/tonalities/gazette.md +87 -111
- package/plugin/skills/lit-pptx/references/tonalities/ledger.md +96 -125
- package/plugin/skills/lit-pptx/references/tonalities/neo-brutalism.md +161 -0
- package/plugin/skills/lit-pptx/references/tonalities/newsroom.md +144 -0
- package/plugin/skills/lit-pptx/references/tonalities/night.md +104 -131
- package/plugin/skills/lit-pptx/references/tonalities/paper.md +114 -130
- package/plugin/skills/lit-pptx/references/tonalities/riso.md +137 -0
- package/plugin/skills/lit-pptx/references/tonalities/signal.md +96 -103
- package/plugin/skills/lit-pptx/references/tonalities/studio.md +81 -112
- package/plugin/skills/lit-pptx/scripts/compile-deck.js +4 -6
- package/plugin/skills/lit-pptx/scripts/craft_extras.py +135 -91
- package/plugin/skills/lit-pptx/scripts/deck_craft.py +1 -1
- package/plugin/skills/lit-pptx/scripts/embed_fonts.py +13 -1
- package/plugin/skills/lit-pptx/scripts/layout_inventory.py +1 -1
- package/plugin/skills/lit-pptx/scripts/learn_template.py +1 -1
- package/plugin/skills/lit-pptx/scripts/lib/grid-resolver.js +101 -110
- package/plugin/skills/lit-pptx/scripts/lib/layout-resolver.js +9 -15
- package/plugin/skills/lit-pptx/scripts/lib/render-pack.js +370 -563
- package/plugin/skills/lit-pptx/scripts/lib/slide-grid.js +104 -0
- package/plugin/skills/lit-pptx/scripts/lib/template-registry.js +57 -6
- package/plugin/skills/lit-pptx/scripts/qa_deck.py +6 -6
- package/plugin/skills/lit-pptx/scripts/render_pages.py +31 -0
- package/plugin/skills/lit-pptx/scripts/validate_pptx.py +1 -1
- package/plugin/skills/lit-pptx/specs/markdown-slide-spec-v1.md +167 -191
- package/plugin/skills/lit-pptx/specs/markdown-slide-spec-v2.md +117 -166
- package/plugin/skills/lit-pptx/specs/template-enrollment-contract.md +307 -330
- package/plugin/skills/lit-pptx/templates/tonalities/atlas/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/bauhaus/pack.yaml +98 -0
- package/plugin/skills/lit-pptx/templates/tonalities/chalk/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/computational-brutalism/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/gazette/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/ledger/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/neo-brutalism/pack.yaml +107 -0
- package/plugin/skills/lit-pptx/templates/tonalities/newsroom/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/night/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/paper/pack.yaml +1 -1
- package/plugin/skills/lit-pptx/templates/tonalities/riso/pack.yaml +99 -0
- package/plugin/skills/lit-pptx/templates/tonalities/signal/pack.yaml +2 -2
- package/plugin/skills/lit-pptx/templates/tonalities/studio/pack.yaml +1 -1
- package/plugin/skills/lit-schematic/SKILL.md +114 -0
- package/plugin/skills/lit-schematic/examples/iso-heat-exchanger/build.mjs +38 -0
- package/plugin/skills/lit-schematic/examples/iso-heat-exchanger/scene.mjs +133 -0
- package/plugin/skills/lit-schematic/examples/journal-adsorption-rig/build.mjs +87 -0
- package/plugin/skills/lit-schematic/examples/pid-dosing-skid/build.mjs +85 -0
- package/plugin/skills/lit-schematic/references/cutaway-outputs.md +70 -0
- package/plugin/skills/lit-schematic/references/isometric-craft.md +101 -0
- package/plugin/skills/lit-schematic/references/journal-figures.md +72 -0
- package/plugin/skills/lit-schematic/references/kit-api.md +134 -0
- package/plugin/skills/lit-schematic/references/pfd-and-layout.md +53 -0
- package/plugin/skills/lit-schematic/references/pid-drafting.md +103 -0
- package/plugin/skills/lit-schematic/references/pid-symbols.md +163 -0
- package/plugin/skills/lit-schematic/references/verification.md +100 -0
- package/plugin/skills/lit-schematic/scripts/doctor.mjs +57 -0
- package/plugin/skills/lit-schematic/scripts/lib/figure.mjs +81 -0
- package/plugin/skills/lit-schematic/scripts/lib/fonts.mjs +27 -0
- package/plugin/skills/lit-schematic/scripts/lib/geom.mjs +113 -0
- package/plugin/skills/lit-schematic/scripts/lib/interactive.mjs +292 -0
- package/plugin/skills/lit-schematic/scripts/lib/isa.mjs +115 -0
- package/plugin/skills/lit-schematic/scripts/lib/iso.mjs +719 -0
- package/plugin/skills/lit-schematic/scripts/lib/legend-sheet.mjs +162 -0
- package/plugin/skills/lit-schematic/scripts/lib/pid.mjs +937 -0
- package/plugin/skills/lit-schematic/scripts/lib/png.mjs +132 -0
- package/plugin/skills/lit-schematic/scripts/lib/qa-core.mjs +658 -0
- package/plugin/skills/lit-schematic/scripts/lib/route.mjs +218 -0
- package/plugin/skills/lit-schematic/scripts/lib/sheet.mjs +890 -0
- package/plugin/skills/lit-schematic/scripts/lib/svg.mjs +82 -0
- package/plugin/skills/lit-schematic/scripts/lib/theme.mjs +115 -0
- package/plugin/skills/lit-schematic/scripts/motion.mjs +129 -0
- package/plugin/skills/lit-schematic/scripts/qa.mjs +92 -0
- package/plugin/skills/lit-schematic/scripts/render.mjs +233 -0
- package/plugin/skills/lit-schematic/scripts/scaffold.mjs +60 -0
- package/plugin/skills/lit-scientific-visualization/SKILL.md +17 -6
- package/plugin/skills/lit-typographic-motion/SKILL.md +58 -48
- package/plugin/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +13 -2
- package/plugin/skills/lit-typographic-motion/engine/blender/runner.py +218 -0
- package/plugin/skills/lit-typographic-motion/engine/core/presets.mjs +1 -1
- package/plugin/skills/lit-typographic-motion/engine/node/analysis.mjs +65 -1
- package/plugin/skills/lit-typographic-motion/engine/node/assets.mjs +298 -0
- package/plugin/skills/lit-typographic-motion/engine/node/blender.mjs +143 -0
- package/plugin/skills/lit-typographic-motion/engine/node/board.mjs +136 -0
- package/plugin/skills/lit-typographic-motion/engine/node/brief.mjs +7 -1
- package/plugin/skills/lit-typographic-motion/engine/node/chrome.mjs +9 -12
- package/plugin/skills/lit-typographic-motion/engine/node/cover-assets.mjs +5 -3
- package/plugin/skills/lit-typographic-motion/engine/node/cover-capture.mjs +7 -6
- package/plugin/skills/lit-typographic-motion/engine/node/cover-treatment.mjs +37 -4
- package/plugin/skills/lit-typographic-motion/engine/node/cover.mjs +19 -8
- package/plugin/skills/lit-typographic-motion/engine/node/done.mjs +45 -6
- package/plugin/skills/lit-typographic-motion/engine/node/frame-worker.mjs +7 -5
- package/plugin/skills/lit-typographic-motion/engine/node/gallery.mjs +121 -0
- package/plugin/skills/lit-typographic-motion/engine/node/host.mjs +34 -0
- package/plugin/skills/lit-typographic-motion/engine/node/house.mjs +44 -0
- package/plugin/skills/lit-typographic-motion/engine/node/look.mjs +34 -20
- package/plugin/skills/lit-typographic-motion/engine/node/pipeline.mjs +19 -9
- package/plugin/skills/lit-typographic-motion/engine/node/scaffold.mjs +210 -0
- package/plugin/skills/lit-typographic-motion/engine/node/score.mjs +639 -0
- package/plugin/skills/lit-typographic-motion/engine/node/sound-cli.mjs +21 -4
- package/plugin/skills/lit-typographic-motion/engine/node/sound.mjs +127 -29
- package/plugin/skills/lit-typographic-motion/engine/node/stage-capture.mjs +7 -6
- package/plugin/skills/lit-typographic-motion/engine/node/stage-gate.mjs +59 -5
- package/plugin/skills/lit-typographic-motion/engine/node/stage-qa.mjs +141 -9
- package/plugin/skills/lit-typographic-motion/engine/node/stage-serve.mjs +28 -5
- package/plugin/skills/lit-typographic-motion/engine/node/stage.mjs +82 -14
- package/plugin/skills/lit-typographic-motion/engine/node/styles.mjs +213 -0
- package/plugin/skills/lit-typographic-motion/engine/node/treatment.mjs +311 -10
- package/plugin/skills/lit-typographic-motion/engine/stage/cover-init.js +14 -2
- package/plugin/skills/lit-typographic-motion/engine/stage/init.js +11 -1
- package/plugin/skills/lit-typographic-motion/engine/stage/qa.js +6 -1
- package/plugin/skills/lit-typographic-motion/engine/stage/stage-kit.js +83 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/LICENSE +21 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/addons/environments/RoomEnvironment.js +144 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/addons/geometries/RoundedBoxGeometry.js +155 -0
- package/plugin/skills/lit-typographic-motion/engine/vendor/three/three.module.js +54571 -0
- package/plugin/skills/lit-typographic-motion/recipes/hero-3d/expected.json +69 -0
- package/plugin/skills/lit-typographic-motion/recipes/hero-3d/index.html +139 -0
- package/plugin/skills/lit-typographic-motion/recipes/orbit-loop/expected.json +6 -4
- package/plugin/skills/lit-typographic-motion/recipes/painted-light/expected.json +4 -2
- package/plugin/skills/lit-typographic-motion/recipes/weight-tide/expected.json +7 -5
- package/plugin/skills/lit-typographic-motion/references/cover.md +394 -443
- package/plugin/skills/lit-typographic-motion/references/craft-loop.md +57 -87
- package/plugin/skills/lit-typographic-motion/references/depth.md +122 -0
- package/plugin/skills/lit-typographic-motion/references/look.md +94 -129
- package/plugin/skills/lit-typographic-motion/references/runtime.md +58 -91
- package/plugin/skills/lit-typographic-motion/references/sound.md +130 -99
- package/plugin/skills/lit-typographic-motion/references/stage.md +190 -215
- package/plugin/skills/lit-typographic-motion/references/studio.md +245 -0
- package/plugin/skills/lit-typographic-motion/references/style-bibles.md +108 -97
- package/plugin/skills/lit-typographic-motion/references/treatment.md +191 -143
- package/plugin/skills/lit-typographic-motion/scripts/motion-doctor.mjs +17 -5
- package/plugin/skills/lit-typographic-motion/scripts/motion.mjs +47 -7
- package/plugin/skills/lit-typographic-motion/styles/paper.json +41 -0
- package/plugin/skills/lit-typographic-motion/styles/swiss-signal.json +41 -0
- package/plugin/skills/lit-typographic-motion/styles/terminalcore.json +42 -0
- package/plugin/skills/lit-typographic-motion/styles/tidal.json +41 -0
- package/plugin/skills/litresearch/SKILL.md +1 -0
- package/plugin/skills/readme-studio/SKILL.md +2 -0
- package/plugin/skills/review-work/SKILL.md +1 -1
- package/plugin/skills/start-work/SKILL.md +2 -2
|
@@ -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,34 @@
|
|
|
1
|
+
// Host lookups that differ on Windows. `where` ends each line with \r\n, so a plain split("\n")
|
|
2
|
+
// keeps the \r and the path is never found. npm on Windows is npm.cmd, and since the
|
|
3
|
+
// CVE-2024-27980 fix (Node 18.20.2, 20.12.2, 21.7.3 and every 22+) Node refuses to spawn a .cmd
|
|
4
|
+
// without a shell (spawnSync EINVAL). When npm itself started us, npm_execpath names its npm-cli.js
|
|
5
|
+
// and this Node runs it with no shell at all; otherwise the .cmd goes through cmd.exe with every
|
|
6
|
+
// argument quoted, and an argument cmd.exe could still reinterpret inside quotes is refused.
|
|
7
|
+
import { spawnSync } from "node:child_process";
|
|
8
|
+
|
|
9
|
+
const LOOKUP = Object.freeze({ win32: "where", default: "which" });
|
|
10
|
+
|
|
11
|
+
/** The first match for `name` on PATH, or null. */
|
|
12
|
+
export function which(name, env = process.env, { platform = process.platform, spawn = spawnSync } = {}) {
|
|
13
|
+
const cmd = LOOKUP[platform] ?? LOOKUP.default;
|
|
14
|
+
const probe = spawn(cmd, [name], { encoding: "utf8", env });
|
|
15
|
+
if (probe.status !== 0) return null;
|
|
16
|
+
return String(probe.stdout ?? "").split(/\r?\n/u).map((line) => line.trim()).find(Boolean) ?? null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const CMD_SAFE = /^[\w@.,:=+/\\-]+$/u;
|
|
20
|
+
const CMD_UNSAFE = /["%\r\n]/u;
|
|
21
|
+
|
|
22
|
+
export const quoteForCmd = (arg) => {
|
|
23
|
+
const text = String(arg);
|
|
24
|
+
if (CMD_UNSAFE.test(text)) throw new Error(`refusing to pass ${JSON.stringify(text)} through cmd.exe`);
|
|
25
|
+
// Trailing backslashes are doubled so the closing quote still ends the argument for node.
|
|
26
|
+
return CMD_SAFE.test(text) ? text : `"${text.replace(/(\\+)$/u, "$1$1")}"`;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** { command, args, shell } for spawn/spawnSync. */
|
|
30
|
+
export function npmInvocation(args, { platform = process.platform, env = process.env, execPath = process.execPath } = {}) {
|
|
31
|
+
if (platform !== "win32") return { command: "npm", args, shell: false };
|
|
32
|
+
if (/npm-cli\.c?js$/iu.test(env.npm_execpath ?? "")) return { command: execPath, args: [env.npm_execpath, ...args], shell: false };
|
|
33
|
+
return { command: "npm.cmd", args: args.map(quoteForCmd), shell: true };
|
|
34
|
+
}
|
|
@@ -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 = "litgravity.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}.${process.pid}.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
|
-
if (!Array.isArray(doc.viewed) || !doc.viewed.length) refuse("viewed must list every stills file you opened with
|
|
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,10 +24,11 @@ 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";
|
|
29
|
-
import { describeSpawn } from "../../../../lib/host-exec.mjs";
|
|
30
32
|
|
|
31
33
|
export const DELIVERABLES = ["film.mp4", "preview.webp", "preview.gif", "poster.png", "reduced-motion.png"];
|
|
32
34
|
|
|
@@ -88,7 +90,7 @@ export async function prepare({ briefPath, out, env = process.env, wordTiming =
|
|
|
88
90
|
audioTier = "librosa-beat-grid";
|
|
89
91
|
log(`beat grid: ${grid.beats.length} beats at ${grid.tempo} BPM`);
|
|
90
92
|
} else warnings.push("audio analysis found fewer than two beats; Tier 1 text reading-time is used");
|
|
91
|
-
} else warnings.push(`audio analysis failed (${
|
|
93
|
+
} else warnings.push(`audio analysis failed (${(result.stderr || "").trim().split("\n").pop()}); Tier 1 text reading-time is used`);
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
const plan = asBlocked(() => planFromBrief(brief, { beatGrid, targetSec: treatment.durationSec, treatment }));
|
|
@@ -184,7 +186,7 @@ export function cutFrames(plan) {
|
|
|
184
186
|
* midpoints, a -6/0/+6 strip at each of the engine's cuts, and a 12-frame sheet. Returns the frames
|
|
185
187
|
* so a full render can rewrite the index with the delivered poster.
|
|
186
188
|
*/
|
|
187
|
-
async function renderStillsSet({ session, plan, treatment, out, round, stillsOnly }) {
|
|
189
|
+
async function renderStillsSet({ session, plan, treatment, out, round, stillsOnly, env = process.env, log = () => {} }) {
|
|
188
190
|
const beats = treatment.beats.map((b) => ({ t0: Math.min(b.t0, plan.durationSec), t1: Math.min(b.t1, plan.durationSec) }));
|
|
189
191
|
const cuts = plan.shots.slice(1).map((sh) => Math.round(sh.start * plan.fps)).filter((c) => c > 0 && c < plan.frameCount);
|
|
190
192
|
const layout = stillsPlan({ beats, fps: plan.fps, frameCount: plan.frameCount, cuts, posterBeat: treatment.posterBeat });
|
|
@@ -195,8 +197,15 @@ async function renderStillsSet({ session, plan, treatment, out, round, stillsOnl
|
|
|
195
197
|
frames.set(n, Buffer.from(bytes));
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
|
-
|
|
199
|
-
|
|
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 };
|
|
200
209
|
}
|
|
201
210
|
|
|
202
211
|
function contrastFrames(plan) {
|
|
@@ -445,10 +454,10 @@ export async function make({ briefPath, out, round = 1, stillsOnly = false, view
|
|
|
445
454
|
let poster;
|
|
446
455
|
let still;
|
|
447
456
|
try {
|
|
448
|
-
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 });
|
|
449
458
|
log(`stills: ${stillsSet.stills.files.length} files in ${path.join(out, "stills")}`);
|
|
450
459
|
if (stillsOnly) {
|
|
451
|
-
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 };
|
|
452
461
|
}
|
|
453
462
|
if (!ffmpeg) {
|
|
454
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 };
|
|
@@ -497,7 +506,8 @@ export async function make({ briefPath, out, round = 1, stillsOnly = false, view
|
|
|
497
506
|
const { gate, manifest } = collectAndEvaluate({ out, previewRecords: preview.records, previewFps: preview.rung?.fps, determinism, perf, coverage: pre.coverage, still, extraRules: soundAudit.rules });
|
|
498
507
|
const promoted = promote({ out, gate });
|
|
499
508
|
const loc = (name) => (promoted.withheld ? path.join(out, "withheld", name) : path.join(out, name));
|
|
500
|
-
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 });
|
|
501
511
|
const report = formatReport({
|
|
502
512
|
manifest, reason: plan.reason, gate, round, framesViewed: resolveViewed(out, viewed), software: manifest.softwareRenderer, withheld: promoted.withheld,
|
|
503
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") },
|
|
@@ -569,7 +579,7 @@ export async function partial({ mode, briefPath, out, env = process.env, log = (
|
|
|
569
579
|
const session = await openSession({ plan: prep.plan, fontKeys: prep.fontKeys, runDir: prep.runDir, env, log });
|
|
570
580
|
try {
|
|
571
581
|
if (mode === "stills" || mode === "sheet") {
|
|
572
|
-
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 });
|
|
573
583
|
return { code: EXIT.OK, message: `STILLS: ${set.stills.files.length} files in ${path.join(out, "stills")} (the sheet is stills/sheet.png)` };
|
|
574
584
|
}
|
|
575
585
|
const perf = await perfCheck({ session, plan: prep.plan });
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// `motion.mjs scaffold --out <dir>`: the starting stage page, written from the treatment, so every
|
|
2
|
+
// film has the same architecture: the COPY block, one <section> per shot with its type placed in the
|
|
3
|
+
// shot's type zone and an empty subject group in its subject zone, entrances and hand-offs on the
|
|
4
|
+
// house style's tokens, and one DRAW function per shot where the drawing goes. The page passes the
|
|
5
|
+
// style rules as written; the drawing is the model's. A 3D film (`depth: "3d"`) also gets the
|
|
6
|
+
// three.js world: an import map onto the vendored build, a full-frame canvas behind the shots, one
|
|
7
|
+
// persistent protagonist group lit and shadowed in the style's palette, and one WORLD function per
|
|
8
|
+
// shot. It never overwrites an existing page.
|
|
9
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { EXIT } from "../core/constants.mjs";
|
|
12
|
+
import { BlockedError } from "./chrome.mjs";
|
|
13
|
+
import { findBlender } from "./blender.mjs";
|
|
14
|
+
import { FORMATS, asksPathTraced, loadTreatment } from "./treatment.mjs";
|
|
15
|
+
|
|
16
|
+
const HANGUL = /[ㄱ-ㆎ가-힣]/u;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Which copy lines each shot shows: the treatment's `lines` when given; otherwise spread in order over
|
|
20
|
+
* the shots that have a type zone, the first line on the first and the last line on the last.
|
|
21
|
+
*/
|
|
22
|
+
export function linesPerShot(treatment) {
|
|
23
|
+
const beats = treatment.beats;
|
|
24
|
+
if (beats.some((b) => Array.isArray(b.lines))) return beats.map((b) => (Array.isArray(b.lines) ? b.lines : []));
|
|
25
|
+
const lines = treatment.copy.lines.map((_, i) => i);
|
|
26
|
+
const textShots = beats.map((b, i) => (b.layout === "full" ? null : i)).filter((i) => i !== null);
|
|
27
|
+
const out = beats.map(() => []);
|
|
28
|
+
if (!textShots.length) return out;
|
|
29
|
+
lines.forEach((line, k) => {
|
|
30
|
+
const at = lines.length > 1 ? Math.round((k * (textShots.length - 1)) / (lines.length - 1)) : 0;
|
|
31
|
+
out[textShots[at]].push(line);
|
|
32
|
+
});
|
|
33
|
+
return out;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The scaffold page for a stage treatment. */
|
|
37
|
+
export function scaffoldHtml(treatment) {
|
|
38
|
+
const [width, height] = FORMATS[treatment.format];
|
|
39
|
+
const perShot = linesPerShot(treatment);
|
|
40
|
+
const lang = treatment.copy.lines.some((l) => HANGUL.test(l)) ? "ko" : "en";
|
|
41
|
+
const sections = treatment.beats.map((b, i) => {
|
|
42
|
+
const lines = perShot[i];
|
|
43
|
+
const roleOf = (k) => (k > 0 ? "lit-body lit-muted" : b.layout === "title" ? "lit-display lit-ink" : "lit-headline lit-ink");
|
|
44
|
+
const type = b.layout === "full" || !lines.length ? "" : `\n <div class="type" data-zone="type">${lines.map((line, k) => `\n <p class="${roleOf(k)}" data-copy="${line}"></p>`).join("")}\n </div>`;
|
|
45
|
+
return ` <!-- shot ${i + 1}: ${String(b.purpose).replace(/--/gu, "-")} -->\n <section class="shot" data-shot="${i}">\n <svg class="subject" data-zone="subject"></svg>${type}\n </section>`;
|
|
46
|
+
}).join("\n");
|
|
47
|
+
const draws = treatment.beats.map((b, i) => ` // shot ${i + 1} (${b.layout}): ${String(b.hero).replace(/\*\//gu, "* /")}\n (s, svg, t) => {},`).join("\n");
|
|
48
|
+
const solid = treatment.depth === "3d";
|
|
49
|
+
const worlds = treatment.beats.map((b, i) => ` // shot ${i + 1} (${b.layout})\n (s, hero, cam, t) => {},`).join("\n");
|
|
50
|
+
const head3d = solid ? `
|
|
51
|
+
<script type="importmap">{ "imports": { "three": "/lit/three/three.module.js", "three/addons/": "/lit/three/addons/" } }</script>` : "";
|
|
52
|
+
const canvas3d = solid ? `<canvas id="world" width="${width}" height="${height}"></canvas>\n` : "";
|
|
53
|
+
const style3d = solid ? `
|
|
54
|
+
#world { position: absolute; left: 0; top: 0; width: ${width}px; height: ${height}px; }` : "";
|
|
55
|
+
const world3d = solid ? `
|
|
56
|
+
// The world: one scene for the whole film, drawn on the GPU rung (software when it is missing). The
|
|
57
|
+
// protagonist lives in HERO from the first frame to the last; each shot's WORLD function poses it,
|
|
58
|
+
// the camera and anything else as a function of the shot's progress. The camera is aimed so the
|
|
59
|
+
// world origin sits at the centre of the shot's subject zone. More parts of the vendored build:
|
|
60
|
+
// three/addons/geometries/RoundedBoxGeometry.js.
|
|
61
|
+
const PAL = LitStyle.palette;
|
|
62
|
+
const renderer = new THREE.WebGLRenderer({ canvas: document.getElementById("world"), antialias: true, alpha: true, preserveDrawingBuffer: true });
|
|
63
|
+
renderer.setPixelRatio(1);
|
|
64
|
+
renderer.setSize(${width}, ${height}, false);
|
|
65
|
+
renderer.setClearColor(0x000000, 0);
|
|
66
|
+
renderer.outputColorSpace = THREE.SRGBColorSpace;
|
|
67
|
+
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
|
68
|
+
renderer.shadowMap.enabled = true;
|
|
69
|
+
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
|
70
|
+
const scene = new THREE.Scene();
|
|
71
|
+
scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture;
|
|
72
|
+
const cam = new THREE.PerspectiveCamera(32, ${width} / ${height}, 0.1, 100);
|
|
73
|
+
const key = new THREE.DirectionalLight(0xffffff, 2.2);
|
|
74
|
+
key.position.set(3, 6, 4);
|
|
75
|
+
key.castShadow = true;
|
|
76
|
+
key.shadow.mapSize.set(2048, 2048);
|
|
77
|
+
key.shadow.radius = 4;
|
|
78
|
+
key.shadow.bias = -0.0004; // without these a turning object's shadow acne flickers as flashes
|
|
79
|
+
key.shadow.normalBias = 0.03;
|
|
80
|
+
scene.add(key, new THREE.HemisphereLight(PAL.surface ?? PAL.ground, PAL.ground, 0.6));
|
|
81
|
+
const floor = new THREE.Mesh(new THREE.PlaneGeometry(40, 40), new THREE.ShadowMaterial({ opacity: 0.18 }));
|
|
82
|
+
floor.rotation.x = -Math.PI / 2;
|
|
83
|
+
floor.receiveShadow = true;
|
|
84
|
+
scene.add(floor);
|
|
85
|
+
const HERO = new THREE.Group();
|
|
86
|
+
scene.add(HERO);
|
|
87
|
+
|
|
88
|
+
// Aim the camera so the origin lands on the centre of the shot's subject zone.
|
|
89
|
+
function aim(layout) {
|
|
90
|
+
const z = LitStage.zone(layout, "subject");
|
|
91
|
+
cam.setViewOffset(${width}, ${height}, ${width} / 2 - (z.x + z.w / 2), ${height} / 2 - (z.y + z.h / 2), ${width}, ${height});
|
|
92
|
+
return z.h / ${height};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const WORLD = [
|
|
96
|
+
${worlds}
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
function drawWorld(s, t) {
|
|
100
|
+
cam.position.set(0, 1.6, 7);
|
|
101
|
+
cam.lookAt(0, 0.6, 0);
|
|
102
|
+
aim(s.beat.layout);
|
|
103
|
+
WORLD[s.index](s, HERO, cam, t);
|
|
104
|
+
renderer.render(scene, cam);
|
|
105
|
+
}
|
|
106
|
+
` : "";
|
|
107
|
+
const scriptOpen = solid ? `<script type="module">
|
|
108
|
+
import * as THREE from "three";
|
|
109
|
+
import { RoomEnvironment } from "three/addons/environments/RoomEnvironment.js";
|
|
110
|
+
` : "<script>\n";
|
|
111
|
+
return `<!doctype html>
|
|
112
|
+
<html lang="${lang}">
|
|
113
|
+
<head>
|
|
114
|
+
<meta charset="utf-8">
|
|
115
|
+
<link rel="stylesheet" href="/lit/fonts.css">
|
|
116
|
+
<link rel="stylesheet" href="/lit/style.css">
|
|
117
|
+
<script src="/lit/style.js"></script>
|
|
118
|
+
<script src="/lit/stage-kit.js"></script>${head3d}
|
|
119
|
+
<style>
|
|
120
|
+
html, body { width: ${width}px; height: ${height}px; }
|
|
121
|
+
.shot { position: absolute; left: 0; top: 0; width: ${width}px; height: ${height}px; visibility: hidden; }
|
|
122
|
+
.subject { position: absolute; overflow: visible; }
|
|
123
|
+
.type { display: flex; flex-direction: column; justify-content: center; gap: 0.4em; }${style3d}
|
|
124
|
+
</style>
|
|
125
|
+
</head>
|
|
126
|
+
<body>
|
|
127
|
+
${canvas3d}${sections}
|
|
128
|
+
${scriptOpen} // The film's words: every copy line of treatment.json, verbatim. Edit them here.
|
|
129
|
+
const COPY = ${JSON.stringify(treatment.copy.lines, null, 2).replace(/\n/gu, "\n ")};
|
|
130
|
+
|
|
131
|
+
const { define, shot, place, tokens, text, clamp, clipRect, clipCircle } = LitStage;
|
|
132
|
+
const T = tokens();
|
|
133
|
+
const BEATS = LitTimeline.beats;
|
|
134
|
+
const SHOTS = [...document.querySelectorAll(".shot")];
|
|
135
|
+
SHOTS.forEach((el, i) => {
|
|
136
|
+
place(el.querySelector('[data-zone="subject"]'), BEATS[i].layout, "subject");
|
|
137
|
+
const type = el.querySelector('[data-zone="type"]');
|
|
138
|
+
if (type) place(type, BEATS[i].layout, "type");
|
|
139
|
+
});
|
|
140
|
+
for (const el of document.querySelectorAll("[data-copy]")) {
|
|
141
|
+
el.textContent = COPY[Number(el.dataset.copy)];
|
|
142
|
+
text(el);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// One function per shot: draw the subject into its svg (the subject zone) as a function of the
|
|
146
|
+
// shot's progress. s is LitStage.shot(t): s.p (0..1), s.local (seconds), s.enter(delay, dur).
|
|
147
|
+
const DRAW = [
|
|
148
|
+
${draws}
|
|
149
|
+
];
|
|
150
|
+
|
|
151
|
+
// How a shot hands off to the next, over the style's exit duration before the cut.
|
|
152
|
+
const HANDOFF = T.dur.exit;
|
|
153
|
+
const handoff = { wipe: (el, p) => clipRect(el, p, { from: "left" }), iris: (el, p) => clipCircle(el, p, { x: 50, y: 50 }), dissolve: (el, p) => { el.style.opacity = String(p); } };
|
|
154
|
+
|
|
155
|
+
function paint(i, s, t) {
|
|
156
|
+
const el = SHOTS[i];
|
|
157
|
+
el.style.visibility = "visible";
|
|
158
|
+
const type = el.querySelector('[data-zone="type"]');
|
|
159
|
+
if (type) {
|
|
160
|
+
const e = s.enter(0.1);
|
|
161
|
+
type.style.opacity = String(e);
|
|
162
|
+
type.style.transform = \`translateY(\${(1 - e) * 24}px)\`;
|
|
163
|
+
}
|
|
164
|
+
DRAW[i](s, el.querySelector('[data-zone="subject"]'), t);
|
|
165
|
+
}
|
|
166
|
+
${world3d}
|
|
167
|
+
define({ width: ${width}, height: ${height}, fps: ${treatment.fps ?? 60}, duration: ${treatment.durationSec}, render(t) {
|
|
168
|
+
for (const el of SHOTS) Object.assign(el.style, { visibility: "hidden", opacity: "", clipPath: "", transform: "", zIndex: "" });
|
|
169
|
+
const s = shot(t);
|
|
170
|
+
paint(s.index, s, t);${solid ? "\n drawWorld(s, t);" : ""}
|
|
171
|
+
const next = SHOTS[s.index + 1];
|
|
172
|
+
const into = clamp((t - (s.beat.t1 - HANDOFF)) / HANDOFF);
|
|
173
|
+
if (next && into > 0) {
|
|
174
|
+
const p = T.ease.move(into);
|
|
175
|
+
const kind = s.beat.transition;
|
|
176
|
+
if (handoff[kind]) {
|
|
177
|
+
next.style.zIndex = "1";
|
|
178
|
+
paint(s.index + 1, shot(BEATS[s.index + 1].t0), t);
|
|
179
|
+
handoff[kind](next, p);
|
|
180
|
+
} else if (kind === "push") {
|
|
181
|
+
SHOTS[s.index].style.transform = \`translateX(\${-p * ${width}}px)\`;
|
|
182
|
+
paint(s.index + 1, shot(BEATS[s.index + 1].t0), t);
|
|
183
|
+
next.style.transform = \`translateX(\${(1 - p) * ${width}}px)\`;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} });
|
|
187
|
+
</script>
|
|
188
|
+
</body>
|
|
189
|
+
</html>
|
|
190
|
+
`;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Write `<out>/stage/index.html` from the treatment; refuses to replace a page. */
|
|
194
|
+
// The scaffold's word on the 3D renderer: a Blender film draws its world in stage/scene.py; a film that
|
|
195
|
+
// asks for high-quality 3D on a machine with Blender is pointed at that rung before any drawing starts.
|
|
196
|
+
function rungNote(treatment, out, env) {
|
|
197
|
+
if (treatment.depth !== "3d") return "";
|
|
198
|
+
if (treatment.render3d === "blender") return ` This is a Blender film: write the world in ${path.join(out, "stage", "scene.py")}, look at the preview stills (blender --out ${out}), render the plate (--final), and show it under the type with LitStage.plate() in place of the three.js world (references/depth.md, The Blender rung).`;
|
|
199
|
+
const found = asksPathTraced(treatment.request) ? findBlender({ env }) : null;
|
|
200
|
+
return found ? `\nBLENDER: ${found.path} is installed and the request asks for high-quality 3D. Take the Blender rung: set render3d "blender" in the treatment, write stage/scene.py, and keep this page for the type, labels and panels over the plate (references/depth.md, The Blender rung).` : "";
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function scaffoldCommand({ out, env = process.env }) {
|
|
204
|
+
const treatment = loadTreatment(out, { pathName: "stage" });
|
|
205
|
+
const file = path.join(out, "stage", "index.html");
|
|
206
|
+
if (existsSync(file)) throw new BlockedError(EXIT.USAGE, `${file} exists; scaffold never overwrites a page (move it away to start again)`);
|
|
207
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
208
|
+
writeFileSync(file, scaffoldHtml(treatment));
|
|
209
|
+
return { code: EXIT.OK, message: `SCAFFOLD: ${file} (style ${treatment.style}, ${treatment.beats.length} shots). Draw each shot's subject in its DRAW function, then render the board: stage --out ${out} --round 1 --stills-only${rungNote(treatment, out, env)}` };
|
|
210
|
+
}
|