@kaydash9999/banker-plugins 0.26.1 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +39 -0
- package/README.md +25 -10
- package/bin/lib/codex-hooks.mjs +7 -1
- package/codex/command-skills/front-qa/SKILL.md +3 -1
- package/codex/hooks.json +15 -5
- package/codex/manifest.json +4 -0
- package/codex/skills/ralph/SKILL.md +272 -0
- package/codex/skills/ralph/scripts/gate-evidence.mjs +457 -0
- package/codex/skills/ralph/scripts/ralph-state.mjs +622 -0
- package/codex/skills/ralph/scripts/run-folder.mjs +299 -0
- package/codex/transform-matrix.md +5 -4
- package/commands/front-qa.md +3 -1
- package/hooks/ralph-continue-codex.mjs +59 -0
- package/package.json +1 -1
- package/skills/all-in-one/SKILL.md +22 -8
- package/skills/ralph-qa/references/gate-evidence.mjs +3 -3
- package/skills/ralph-qa/references/run-folder.mjs +3 -3
- package/skills/ultra-chain/SKILL.md +11 -4
- package/skills/ultra-init/SKILL.md +9 -7
- package/skills/ultraqa/references/gate-evidence.mjs +3 -3
- package/skills/ultraqa/references/run-folder.mjs +3 -3
- package/skills/video-gen/SKILL.md +141 -0
- package/skills/video-gen/assets/example.json +36 -0
- package/skills/video-gen/scripts/vg-catalog.mjs +23 -0
- package/skills/video-gen/scripts/vg-deck.mjs +72 -0
- package/skills/video-gen/scripts/vg-draw.mjs +231 -0
- package/skills/video-gen/scripts/vg-engine.mjs +74 -0
- package/skills/video-gen/scripts/vg-fx.mjs +106 -0
- package/skills/video-gen/scripts/vg-model.mjs +236 -0
- package/skills/video-gen/scripts/vg-render.mjs +151 -0
- package/skills/video-gen/scripts/vg-scenes.mjs +226 -0
- package/skills/video-gen/scripts/video-gen.mjs +212 -0
- package/skills/video-gen/vendor/README.md +25 -0
- package/skills/video-gen/vendor/aimotion/LICENSE.md +21 -0
- package/skills/video-gen/vendor/canvaskit/LICENSE.md +29 -0
- package/skills/video-gen/vendor/canvaskit/THIRD-PARTY-NOTICES.md +1366 -0
- package/skills/video-gen/vendor/canvaskit/canvaskit.js +270 -0
- package/skills/video-gen/vendor/canvaskit/canvaskit.wasm +0 -0
- package/skills/video-gen/vendor/fonts/NotoSans-Bold.ttf +0 -0
- package/skills/video-gen/vendor/fonts/NotoSans-Regular.ttf +0 -0
- package/skills/video-gen/vendor/fonts/NotoSansKR-Bold.otf +0 -0
- package/skills/video-gen/vendor/fonts/NotoSansKR-Regular.otf +0 -0
- package/skills/video-gen/vendor/fonts/OFL-noto-sans-kr.md +94 -0
- package/skills/video-gen/vendor/fonts/OFL-noto-sans.md +93 -0
- package/skills/video-gen/vendor/h264-mp4-encoder/LICENSE.md +21 -0
- package/skills/video-gen/vendor/h264-mp4-encoder/MPL-1.1.md +469 -0
- package/skills/video-gen/vendor/h264-mp4-encoder/h264-mp4-encoder.node.js +2 -0
- package/skills/visual-ralph/SKILL.md +9 -4
- package/skills/wbs-gen/SKILL.md +127 -0
- package/skills/wbs-gen/assets/example.json +58 -0
- package/skills/wbs-gen/scripts/wbs-gen.mjs +238 -0
- package/skills/wbs-gen/scripts/wg-dates.mjs +106 -0
- package/skills/wbs-gen/scripts/wg-holidays.mjs +89 -0
- package/skills/wbs-gen/scripts/wg-html.mjs +108 -0
- package/skills/wbs-gen/scripts/wg-plan.mjs +230 -0
- package/skills/wbs-gen/scripts/wg-xlsx.mjs +328 -0
- package/skills/wbs-gen/scripts/wg-zip.mjs +83 -0
- package/skills/wide-pptx/SKILL.md +121 -0
- package/skills/wide-pptx/assets/example.json +63 -0
- package/skills/wide-pptx/scripts/wide-pptx.mjs +185 -0
- package/skills/wide-pptx/scripts/wp-html.mjs +98 -0
- package/skills/wide-pptx/scripts/wp-model.mjs +236 -0
- package/skills/wide-pptx/scripts/wp-pptx.mjs +219 -0
- package/skills/wide-pptx/scripts/wp-svg.mjs +114 -0
- package/skills/wide-pptx/vendor/LICENSE-jszip.md +651 -0
- package/skills/wide-pptx/vendor/LICENSE-pako.md +21 -0
- package/skills/wide-pptx/vendor/LICENSE-pptxgenjs.md +21 -0
- package/skills/wide-pptx/vendor/README.md +12 -0
- package/skills/wide-pptx/vendor/THIRD-PARTY-NOTICES.md +142 -0
- package/skills/wide-pptx/vendor/pptxgen.bundle.js +96 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// vg-scenes.mjs: one draw function per scene type. Each draws the scene at local time t (0 .. duration) on a
|
|
2
|
+
// Painter, from the scene and the theme only, so any frame can be drawn on its own. Every scene clears the frame
|
|
3
|
+
// first, and entrances fit the scene's length (gaps shrink, then starts and effect lengths scale), so everything is
|
|
4
|
+
// shown at rest before the scene ends, however short.
|
|
5
|
+
import { clamp, counter, decimals, ease, fitGap, grouped, lerp, smooth, stagger } from "./vg-fx.mjs";
|
|
6
|
+
import { PALETTE } from "./vg-model.mjs";
|
|
7
|
+
|
|
8
|
+
const enter = (t, at = 0, dur = 0.6) => ease.outCubic(clamp((t - at) / dur));
|
|
9
|
+
const margin = (P) => Math.round(P.W * 0.08);
|
|
10
|
+
// Entrances finish this long before the scene ends, so its last moment shows everything at rest.
|
|
11
|
+
const REST = 0.3;
|
|
12
|
+
/** 1 when entrances that take `base` seconds fit before REST, less in a shorter scene: starts and lengths scale by it. */
|
|
13
|
+
const pace = (duration, base) => Math.min(1, (duration - REST) / base);
|
|
14
|
+
// Splits text into what a reader sees as characters (a Hangul syllable, an emoji with its skin tone).
|
|
15
|
+
const SEG = typeof Intl !== "undefined" && Intl.Segmenter ? new Intl.Segmenter("ko", { granularity: "grapheme" }) : null;
|
|
16
|
+
export const graphemes = (s) => (SEG ? Array.from(SEG.segment(s), (x) => x.segment) : Array.from(s));
|
|
17
|
+
|
|
18
|
+
/** The heading and its accent bar; returns the y below them (the real heading height, two lines included). */
|
|
19
|
+
function heading(P, th, title, t, k = 1) {
|
|
20
|
+
const m = margin(P);
|
|
21
|
+
const a = enter(t, 0.1 * k, 0.6 * k);
|
|
22
|
+
const top = m * 0.8;
|
|
23
|
+
const h = P.text(title, m, top + (1 - a) * 20 * P.u, { size: 44 * P.u, bold: true, color: th.fg, width: P.W - 2 * m }, { alpha: a }).h;
|
|
24
|
+
P.rect(m, top + h + 8 * P.u, 110 * P.u * enter(t, 0.3 * k, 0.6 * k), 6 * P.u, th.accent);
|
|
25
|
+
return top + h + 40 * P.u;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function title(P, s, th, t) {
|
|
29
|
+
P.clear(th.bg);
|
|
30
|
+
const m = margin(P);
|
|
31
|
+
const cy = P.H * 0.46;
|
|
32
|
+
const k = pace(s.duration, 1.5);
|
|
33
|
+
P.rect(m, cy - 18 * P.u, P.W * 0.18 * enter(t, 0.2 * k, 0.8 * k), 8 * P.u, th.accent);
|
|
34
|
+
const a = stagger(t, 0, { start: 0.35 * k, dur: 0.7 * k, curve: ease.outBack });
|
|
35
|
+
const h = P.text(s.title, m, cy + (1 - clamp(a)) * 40 * P.u, { size: 64 * P.u, bold: true, color: th.fg, width: P.W - 2 * m }, { alpha: clamp(a) }).h;
|
|
36
|
+
if (s.subtitle) P.text(s.subtitle, m, cy + h + 18 * P.u, { size: 30 * P.u, color: th.muted, width: P.W - 2 * m }, { alpha: enter(t, 0.9 * k, 0.6 * k) });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Lines whose characters enter one by one (stagger with an outBack overshoot), centred. */
|
|
40
|
+
function kinetic(P, s, th, t) {
|
|
41
|
+
P.clear(th.bg);
|
|
42
|
+
const size = (s.lines.length > 3 ? 56 : 76) * P.u;
|
|
43
|
+
const lh = size * 1.35;
|
|
44
|
+
const lines = s.lines.map(graphemes);
|
|
45
|
+
const total = lines.reduce((n, l) => n + l.length, 0);
|
|
46
|
+
const k = pace(s.duration, 0.7);
|
|
47
|
+
const gap = fitGap(total, 0.06, 0.2 * k, 0.5 * k, s.duration - REST);
|
|
48
|
+
let y = P.H / 2 - (lines.length * lh) / 2;
|
|
49
|
+
let i = 0;
|
|
50
|
+
lines.forEach((chars, li) => {
|
|
51
|
+
const widths = chars.map((ch) => P.measure(ch, { size, bold: true }).w);
|
|
52
|
+
let x = (P.W - widths.reduce((a, b) => a + b, 0)) / 2;
|
|
53
|
+
chars.forEach((ch, c) => {
|
|
54
|
+
const p = stagger(t, i++, { start: 0.2 * k, gap, dur: 0.5 * k, curve: ease.outBack });
|
|
55
|
+
const color = li === lines.length - 1 && c === chars.length - 1 ? th.accent : th.fg;
|
|
56
|
+
if (ch.trim()) P.text(ch, x, y + (1 - p) * 0.4 * size, { size, bold: true, color }, { alpha: clamp(p * 1.4), scale: lerp(0.6, 1, clamp(p)) });
|
|
57
|
+
x += widths[c];
|
|
58
|
+
});
|
|
59
|
+
y += lh;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function bullets(P, s, th, t) {
|
|
64
|
+
P.clear(th.bg);
|
|
65
|
+
const m = margin(P);
|
|
66
|
+
const k = pace(s.duration, 1.2);
|
|
67
|
+
let y = heading(P, th, s.title, t, k);
|
|
68
|
+
const size = 32 * P.u;
|
|
69
|
+
const gap = fitGap(s.bullets.length, 0.35, 0.6 * k, 0.6 * k, s.duration - REST);
|
|
70
|
+
s.bullets.forEach((b, i) => {
|
|
71
|
+
const p = stagger(t, i, { start: 0.6 * k, gap, dur: 0.6 * k });
|
|
72
|
+
P.circle(m + 10 * P.u, y + size * 0.62, 7 * P.u * p, th.accent);
|
|
73
|
+
const h = P.text(b, m + 34 * P.u + (1 - p) * 40 * P.u, y, { size, color: th.fg, width: P.W - 2 * m - 34 * P.u }, { alpha: p }).h;
|
|
74
|
+
y += h + 16 * P.u;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function chart(P, s, th, t) {
|
|
79
|
+
P.clear(th.bg);
|
|
80
|
+
const m = margin(P);
|
|
81
|
+
const top = heading(P, th, s.title, t, pace(s.duration, 1.2)) + 30 * P.u;
|
|
82
|
+
const box = { x: m + 60 * P.u, y: top, w: P.W - 2 * m - 60 * P.u, h: Math.max(40 * P.u, P.H - top - m - 40 * P.u) };
|
|
83
|
+
const all = s.chart.series.flatMap((x) => x.values);
|
|
84
|
+
const hi = all.reduce((a, b) => Math.max(a, b), 0);
|
|
85
|
+
const lo = all.reduce((a, b) => Math.min(a, b), 0);
|
|
86
|
+
const y = (v) => box.y + box.h - ((v - lo) / (hi - lo || 1)) * box.h;
|
|
87
|
+
P.line([[box.x, y(0)], [box.x + box.w, y(0)]], th.muted, 2 * P.u, 0.6);
|
|
88
|
+
const slot = box.w / s.chart.labels.length;
|
|
89
|
+
s.chart.labels.forEach((l, i) => P.text(l, box.x + slot * i, box.y + box.h + 10 * P.u, { size: 18 * P.u, color: th.muted, width: slot, align: "center" }));
|
|
90
|
+
const geo = { box, y, slot, d: decimals(all), end: s.duration - REST };
|
|
91
|
+
if (s.chart.kind === "line") lineSeries(P, s, t, geo);
|
|
92
|
+
else barSeries(P, s, th, t, geo);
|
|
93
|
+
legend(P, s, th, box);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function barSeries(P, s, th, t, { y, box, slot, d, end }) {
|
|
97
|
+
const n = s.chart.series.length;
|
|
98
|
+
const bw = (slot * 0.7) / n;
|
|
99
|
+
const count = s.chart.labels.length;
|
|
100
|
+
// The first bar starts at `from` and grows for `dur`; both scale so a bar fits a short scene, then the series and
|
|
101
|
+
// label gaps shrink so the last bar is full by `end`.
|
|
102
|
+
const q = Math.min(1, end / 1.4);
|
|
103
|
+
const from = 0.6 * q;
|
|
104
|
+
const dur = 0.8 * q;
|
|
105
|
+
const k0 = fitGap(n, 0.15, from, dur + 0.08 * (count - 1), end);
|
|
106
|
+
const gap = fitGap(count, 0.08, from + k0 * (n - 1), dur, end);
|
|
107
|
+
s.chart.series.forEach((ser, k) => ser.values.forEach((v, i) => {
|
|
108
|
+
const p = stagger(t, i, { start: from + k * k0, gap, dur });
|
|
109
|
+
const top = lerp(y(0), y(v), p);
|
|
110
|
+
const x = box.x + slot * i + slot * 0.15 + bw * k;
|
|
111
|
+
P.rect(x, Math.min(top, y(0)), bw * 0.92, Math.abs(y(0) - top), PALETTE[k % PALETTE.length]);
|
|
112
|
+
const label = p >= 1 ? grouped(v, d) : grouped(v * p, d);
|
|
113
|
+
if (p > 0.05 && v !== 0) P.text(label, x - 20 * P.u, Math.min(top, y(0)) - 26 * P.u, { size: 16 * P.u, color: th.fg, width: bw + 40 * P.u, align: "center" }, { alpha: p, transient: p < 1 });
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function lineSeries(P, s, t, { y, box, slot, end }) {
|
|
118
|
+
const from = Math.min(0.6, end * 0.4);
|
|
119
|
+
const draw = Math.min(1.6, end - from);
|
|
120
|
+
const dot = Math.min(0.3, draw);
|
|
121
|
+
const p = enter(t, from, draw);
|
|
122
|
+
s.chart.series.forEach((ser, k) => {
|
|
123
|
+
const pts = ser.values.map((v, i) => [box.x + slot * (i + 0.5), y(v)]);
|
|
124
|
+
const color = PALETTE[k % PALETTE.length];
|
|
125
|
+
P.clip(box.x - 10, box.y - 20 * P.u, (box.w + 20) * p, box.h + 40 * P.u, () => P.line(pts, color, 5 * P.u));
|
|
126
|
+
const gap = fitGap(pts.length, draw / pts.length, from, dot, end);
|
|
127
|
+
pts.forEach((q, i) => P.circle(q[0], q[1], 8 * P.u * stagger(t, i, { start: from, gap, dur: dot, curve: ease.outBack }), color));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function legend(P, s, th, box) {
|
|
132
|
+
if (s.chart.series.length < 2 && !s.chart.unit) return;
|
|
133
|
+
let x = box.x;
|
|
134
|
+
const yy = box.y - 34 * P.u;
|
|
135
|
+
if (s.chart.unit) x += P.text(`(${s.chart.unit})`, x, yy, { size: 16 * P.u, color: th.muted }).w + 24 * P.u;
|
|
136
|
+
if (s.chart.series.length < 2) return;
|
|
137
|
+
s.chart.series.forEach((ser, k) => {
|
|
138
|
+
P.rect(x, yy + 4 * P.u, 16 * P.u, 16 * P.u, PALETTE[k % PALETTE.length]);
|
|
139
|
+
x += 24 * P.u + P.text(ser.name, x + 24 * P.u, yy, { size: 16 * P.u, color: th.fg }).w + 24 * P.u;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** A big number that rolls from `from` to `to` (with their decimal places), its label above and unit after. */
|
|
144
|
+
function count(P, s, th, t) {
|
|
145
|
+
P.clear(th.bg);
|
|
146
|
+
const d = decimals([s.from, s.to]);
|
|
147
|
+
const start = Math.min(0.4, s.duration * 0.15);
|
|
148
|
+
const roll = Math.max(0.1, s.duration - REST - start);
|
|
149
|
+
const v = counter(t, s.from, s.to, start, roll, d);
|
|
150
|
+
const k = pace(s.duration, 0.8);
|
|
151
|
+
const unit = s.unit ? ` ${s.unit}` : "";
|
|
152
|
+
const size = 120 * P.u;
|
|
153
|
+
if (s.label) P.text(s.label, 0, P.H / 2 - size * 0.9, { size: 30 * P.u, color: th.muted, width: P.W, align: "center" }, { alpha: enter(t, 0.1 * k, 0.6 * k) });
|
|
154
|
+
const h = P.text(`${grouped(v, d)}${unit}`, 0, P.H / 2 - size * 0.45, { size, bold: true, color: th.fg, width: P.W, align: "center" }, { alpha: enter(t, 0.2 * k, 0.6 * k), transient: v !== s.to }).h;
|
|
155
|
+
const mw = Math.min(P.W, P.measure(`${grouped(s.to, d)}${unit}`, { size, bold: true }).w);
|
|
156
|
+
P.rect((P.W - mw) / 2, P.H / 2 - size * 0.45 + h + 6 * P.u, mw * enter(t, start, roll), 6 * P.u, th.accent);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** A name strap: the accent plate leads, the dark bar follows, the name rises inside it, then all rewind out. */
|
|
160
|
+
function lowerthird(P, s, th, t) {
|
|
161
|
+
P.clear(th.bg);
|
|
162
|
+
if (s.image) P.image(s.image, { x: 0, y: 0, w: P.W, h: P.H }, { zoom: lerp(1, 1.06, t / s.duration) });
|
|
163
|
+
const outAt = Math.max(s.duration * 0.6, s.duration - 0.7);
|
|
164
|
+
const out = smooth((t - outAt) / Math.min(0.6, s.duration - outAt));
|
|
165
|
+
const m = margin(P);
|
|
166
|
+
const nameSize = 34 * P.u;
|
|
167
|
+
const name = P.measure(s.name, { size: nameSize, bold: true, width: P.W * 0.7 });
|
|
168
|
+
const role = s.role ? P.measure(s.role, { size: 20 * P.u, width: P.W * 0.7 }) : { w: 0, h: 0 };
|
|
169
|
+
const w = Math.max(name.w, role.w) + 60 * P.u;
|
|
170
|
+
const h = name.h + role.h + 40 * P.u;
|
|
171
|
+
const y = P.H - m - h;
|
|
172
|
+
const k = Math.min(1, outAt / 1.5);
|
|
173
|
+
const plate = enter(t, 0.2 * k, 0.5 * k) * (1 - out);
|
|
174
|
+
const bar = enter(t, 0.35 * k, 0.55 * k) * (1 - out);
|
|
175
|
+
P.rect(m - 12 * P.u, y, 12 * P.u + w * plate, h, th.accent);
|
|
176
|
+
P.rect(m, y, w * bar, h, th.ink, 0.92);
|
|
177
|
+
P.clip(m, y, w * bar, h, () => {
|
|
178
|
+
const rise = enter(t, 0.6 * k, 0.5 * k) * (1 - out);
|
|
179
|
+
P.text(s.name, m + 30 * P.u, y + 18 * P.u + (1 - rise) * h, { size: nameSize, bold: true, color: "FFFFFF", width: P.W * 0.7 });
|
|
180
|
+
if (s.role) P.text(s.role, m + 30 * P.u, y + 22 * P.u + name.h + (1 - enter(t, 0.8 * k, 0.5 * k) * (1 - out)) * h, { size: 20 * P.u, color: th.muted, width: P.W * 0.7 });
|
|
181
|
+
});
|
|
182
|
+
P.rect(m + 30 * P.u, y + h - 12 * P.u, name.w * enter(t, k, 0.5 * k) * (1 - out), 4 * P.u, th.accent);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function quote(P, s, th, t) {
|
|
186
|
+
P.clear(th.bg);
|
|
187
|
+
const m = margin(P);
|
|
188
|
+
const k = pace(s.duration, 2);
|
|
189
|
+
const pop = stagger(t, 0, { start: 0.1 * k, dur: 0.6 * k, curve: ease.outBack });
|
|
190
|
+
P.text("“", m, P.H * 0.18, { size: 160 * P.u, bold: true, color: th.accent }, { alpha: clamp(pop), scale: lerp(0.4, 1, clamp(pop)) });
|
|
191
|
+
const a = enter(t, 0.5 * k, 0.8 * k);
|
|
192
|
+
const h = P.text(s.quote, m + 20 * P.u, P.H * 0.36 + (1 - a) * 30 * P.u, { size: 44 * P.u, bold: true, color: th.fg, width: P.W - 2 * m - 40 * P.u }, { alpha: a }).h;
|
|
193
|
+
if (s.by) P.text(`- ${s.by}`, m, P.H * 0.36 + h + 30 * P.u, { size: 26 * P.u, color: th.muted, width: P.W - 2 * m, align: "right" }, { alpha: enter(t, 1.2 * k, 0.6 * k) });
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function image(P, s, th, t) {
|
|
197
|
+
P.clear("000000");
|
|
198
|
+
const k = t / s.duration;
|
|
199
|
+
const opts = s.motion === "pan" ? { zoom: 1.12, pan: lerp(-1, 1, k) } : { zoom: lerp(1, 1.1, k) };
|
|
200
|
+
P.image(s.image, { x: 0, y: 0, w: P.W, h: P.H }, opts);
|
|
201
|
+
if (!s.caption) return;
|
|
202
|
+
const m = margin(P);
|
|
203
|
+
const q = pace(s.duration, 1);
|
|
204
|
+
const a = enter(t, 0.4 * q, 0.6 * q);
|
|
205
|
+
const size = 26 * P.u;
|
|
206
|
+
const c = P.measure(s.caption, { size, width: P.W - 2 * m - 40 * P.u });
|
|
207
|
+
P.rect(m, P.H - m - c.h - 30 * P.u, Math.min(P.W - 2 * m, c.w + 40 * P.u), c.h + 30 * P.u, th.ink, 0.8 * a);
|
|
208
|
+
P.text(s.caption, m + 20 * P.u, P.H - m - c.h - 15 * P.u, { size, color: "FFFFFF", width: P.W - 2 * m - 40 * P.u }, { alpha: a });
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** Credits rolling up from below the frame to above it over the scene. */
|
|
212
|
+
function credits(P, s, th, t) {
|
|
213
|
+
P.clear(th.bg);
|
|
214
|
+
const size = 30 * P.u;
|
|
215
|
+
const gap = size * 0.7;
|
|
216
|
+
const items = [...(s.title ? [{ text: s.title, bold: true, size: size * 1.4 }] : []), ...s.lines.map((l) => ({ text: l, bold: false, size }))];
|
|
217
|
+
const heights = items.map((it) => P.measure(it.text, { size: it.size, bold: it.bold, width: P.W * 0.8, align: "center" }).h);
|
|
218
|
+
const total = heights.reduce((a, b) => a + b + gap, 0);
|
|
219
|
+
let y = lerp(P.H, -total, clamp(t / s.duration));
|
|
220
|
+
items.forEach((it, i) => {
|
|
221
|
+
if (y + heights[i] > 0 && y < P.H) P.text(it.text, P.W * 0.1, y, { size: it.size, bold: it.bold, color: it.bold ? th.accent : th.fg, width: P.W * 0.8, align: "center" });
|
|
222
|
+
y += heights[i] + gap;
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export const DRAW = { title, kinetic, bullets, chart, counter: count, lowerthird, quote, image, credits };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* video-gen.mjs: the helper the video-gen skill runs. It turns a scene file (JSON) into an H.264 MP4 with the
|
|
4
|
+
* bundled engine (Skia CanvasKit and an H.264 encoder, both WASM, plus Noto fonts): no Chrome, no ffmpeg, no
|
|
5
|
+
* install, no network.
|
|
6
|
+
*
|
|
7
|
+
* node video-gen.mjs list what can be made (built in, or which skill)
|
|
8
|
+
* node video-gen.mjs example print a sample scene file (JSON)
|
|
9
|
+
* node video-gen.mjs from-deck --deck <deck.json> a wide-pptx deck as a scene file (JSON on stdout)
|
|
10
|
+
* node video-gen.mjs check --scene <scene.json>
|
|
11
|
+
* node video-gen.mjs still --scene <scene.json> --at <seconds> --out <file.png> [--force]
|
|
12
|
+
* node video-gen.mjs render --scene <scene.json> --out <file.mp4> [--quality <10-51>] [--force]
|
|
13
|
+
*
|
|
14
|
+
* - Image paths in the scene file are local files, relative to its folder.
|
|
15
|
+
* - render prints progress on stderr about once a second, then `WROTE <path>` and `OK ...` on stdout.
|
|
16
|
+
* - Outputs are written through a random temporary name; a hard link (or an exclusive copy) puts it in place, so
|
|
17
|
+
* an existing file is never replaced without --force.
|
|
18
|
+
*
|
|
19
|
+
* Exit status: 0 done, 1 the scene file has errors, 2 usage error or a file that could not be read or written.
|
|
20
|
+
*/
|
|
21
|
+
import { randomBytes } from "node:crypto";
|
|
22
|
+
import { constants, copyFileSync, linkSync, lstatSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
23
|
+
import { dirname, extname, join, resolve } from "node:path";
|
|
24
|
+
import { fileURLToPath } from "node:url";
|
|
25
|
+
import { catalogText } from "./vg-catalog.mjs";
|
|
26
|
+
import { deckToScenes } from "./vg-deck.mjs";
|
|
27
|
+
import { readScenes, sceneBase } from "./vg-model.mjs";
|
|
28
|
+
import { layoutWarnings, probeImages, renderMp4, renderStill } from "./vg-render.mjs";
|
|
29
|
+
|
|
30
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
31
|
+
const EXAMPLE = join(HERE, "..", "assets", "example.json");
|
|
32
|
+
|
|
33
|
+
class Usage extends Error {}
|
|
34
|
+
|
|
35
|
+
const isDir = (p) => {
|
|
36
|
+
try {
|
|
37
|
+
return statSync(p).isDirectory();
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function parseArgs(argv, bools = ["force"]) {
|
|
44
|
+
const out = { _: [] };
|
|
45
|
+
for (let i = 0; i < argv.length; i++) {
|
|
46
|
+
const a = argv[i];
|
|
47
|
+
if (!a.startsWith("--")) {
|
|
48
|
+
out._.push(a);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const name = a.slice(2);
|
|
52
|
+
if (bools.includes(name)) {
|
|
53
|
+
out[name] = true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const v = argv[++i];
|
|
57
|
+
if (v === undefined || v.startsWith("--")) throw new Usage(`--${name} 에 값이 없음`);
|
|
58
|
+
out[name] = v;
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function readJson(file, what) {
|
|
64
|
+
if (!file) throw new Usage(`--${what} <파일.json> 이 필요함`);
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(readFileSync(file, "utf8").replace(/^\uFEFF/, ""));
|
|
67
|
+
} catch (e) {
|
|
68
|
+
throw new Usage(`${what} 을 읽지 못함: ${e.message}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Reads and checks the scene file, decodes its images and measures its text; null when it has errors. */
|
|
73
|
+
async function loadScenes(args) {
|
|
74
|
+
const res = readScenes(readJson(args.scene, "scene"), sceneBase(args.scene));
|
|
75
|
+
const errors = [...res.errors];
|
|
76
|
+
const warnings = [...res.warnings];
|
|
77
|
+
if (res.model) errors.push(...(await probeImages(res.model)));
|
|
78
|
+
if (res.model && !errors.length) warnings.push(...(await layoutWarnings(res.model)));
|
|
79
|
+
for (const w of warnings) process.stderr.write(`경고: ${w}\n`);
|
|
80
|
+
for (const e of errors) process.stderr.write(`오류: ${e}\n`);
|
|
81
|
+
return errors.length ? null : res.model;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const summary = (m) => `장면 ${m.scenes.length}, ${m.duration.toFixed(1)}초, ${m.width}x${m.height}, ${m.fps}fps, 프레임 ${m.frames}`;
|
|
85
|
+
|
|
86
|
+
/** Checks the output path before any work: extension, folder, and (without --force) an existing file. */
|
|
87
|
+
function target(args, ext) {
|
|
88
|
+
if (!args.out) throw new Usage(`--out <파일${ext}> 이 필요함`);
|
|
89
|
+
const p = resolve(args.out);
|
|
90
|
+
if (extname(p).toLowerCase() !== ext) throw new Usage(`--out 은 ${ext} 이어야 함`);
|
|
91
|
+
if (!isDir(dirname(p))) throw new Usage(`출력 폴더가 없음: ${dirname(p)}`);
|
|
92
|
+
let st = null;
|
|
93
|
+
try {
|
|
94
|
+
st = lstatSync(p);
|
|
95
|
+
} catch {
|
|
96
|
+
// nothing there yet
|
|
97
|
+
}
|
|
98
|
+
if (st && !args.force) throw new Usage(`이미 있음(덮어쓰려면 --force): ${p}`);
|
|
99
|
+
if (st && !st.isFile()) throw new Usage(`보통 파일이 아니라 덮어쓰지 않음: ${p}`);
|
|
100
|
+
return p;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function copyExclusive(tmp, dest) {
|
|
104
|
+
try {
|
|
105
|
+
copyFileSync(tmp, dest, constants.COPYFILE_EXCL);
|
|
106
|
+
} catch (e) {
|
|
107
|
+
if (e.code !== "EEXIST") rmSync(dest, { force: true });
|
|
108
|
+
throw e;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function writeOut(dest, data, force) {
|
|
113
|
+
const tmp = join(dirname(dest), `.${randomBytes(6).toString("hex")}.video-gen.tmp`);
|
|
114
|
+
try {
|
|
115
|
+
writeFileSync(tmp, data, { flag: "wx" });
|
|
116
|
+
if (force) renameSync(tmp, dest);
|
|
117
|
+
else {
|
|
118
|
+
try {
|
|
119
|
+
linkSync(tmp, dest);
|
|
120
|
+
} catch (e) {
|
|
121
|
+
if (e.code === "EEXIST") throw e;
|
|
122
|
+
copyExclusive(tmp, dest);
|
|
123
|
+
}
|
|
124
|
+
rmSync(tmp, { force: true });
|
|
125
|
+
}
|
|
126
|
+
} catch (e) {
|
|
127
|
+
rmSync(tmp, { force: true });
|
|
128
|
+
throw new Usage(`쓰지 못함 ${dest}: ${e.code === "EEXIST" ? "이미 있음(덮어쓰려면 --force)" : e.message}`);
|
|
129
|
+
}
|
|
130
|
+
return dest;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async function cmdRender(args) {
|
|
134
|
+
const dest = target(args, ".mp4");
|
|
135
|
+
const quality = args.quality === undefined ? 20 : Number(args.quality);
|
|
136
|
+
if (!Number.isInteger(quality) || quality < 10 || quality > 51) throw new Usage("--quality 는 10~51 정수(작을수록 고화질)");
|
|
137
|
+
const model = await loadScenes(args);
|
|
138
|
+
if (!model) return 1;
|
|
139
|
+
let last = 0;
|
|
140
|
+
const onFrame = (i, n) => {
|
|
141
|
+
if (Date.now() - last < 1000 && i < n) return;
|
|
142
|
+
last = Date.now();
|
|
143
|
+
process.stderr.write(`프레임 ${i}/${n}\n`);
|
|
144
|
+
};
|
|
145
|
+
const { bytes, frames } = await renderMp4(model, { quality, onFrame });
|
|
146
|
+
process.stdout.write(`WROTE ${writeOut(dest, bytes, args.force)}\nOK ${summary(model)}, 기록 ${frames}, ${(bytes.length / 1048576).toFixed(1)}MB\n`);
|
|
147
|
+
return 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** A still is a video frame: --at is snapped to the frame grid, and a time past the video is an error. */
|
|
151
|
+
async function cmdStill(args) {
|
|
152
|
+
const dest = target(args, ".png");
|
|
153
|
+
const at = Number(args.at);
|
|
154
|
+
if (!Number.isFinite(at) || at < 0) throw new Usage("--at <초> 는 0 이상 숫자");
|
|
155
|
+
const model = await loadScenes(args);
|
|
156
|
+
if (!model) return 1;
|
|
157
|
+
if (at >= model.duration) throw new Usage(`--at 은 영상 길이(${model.duration}초)보다 짧아야 함`);
|
|
158
|
+
const frame = Math.min(model.frames - 1, Math.round(at * model.fps));
|
|
159
|
+
process.stdout.write(`WROTE ${writeOut(dest, await renderStill(model, frame / model.fps), args.force)}\nFRAME ${frame} (${(frame / model.fps).toFixed(3)}초)\n`);
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async function cmdCheck(args) {
|
|
164
|
+
const model = await loadScenes(args);
|
|
165
|
+
if (!model) return 1;
|
|
166
|
+
process.stdout.write(`OK ${summary(model)}\n`);
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function cmdFromDeck(args) {
|
|
171
|
+
const { scenes, skipped } = deckToScenes(readJson(args.deck, "deck"), dirname(resolve(args.deck)));
|
|
172
|
+
for (const s of skipped) process.stderr.write(`경고: ${s}\n`);
|
|
173
|
+
process.stdout.write(`${JSON.stringify(scenes, null, 2)}\n`);
|
|
174
|
+
return 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const COMMANDS = {
|
|
178
|
+
list: () => (process.stdout.write(catalogText()), 0),
|
|
179
|
+
example: () => (process.stdout.write(readFileSync(EXAMPLE, "utf8")), 0),
|
|
180
|
+
"from-deck": cmdFromDeck,
|
|
181
|
+
check: cmdCheck,
|
|
182
|
+
still: cmdStill,
|
|
183
|
+
render: cmdRender,
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export async function main(argv) {
|
|
187
|
+
const [cmd, ...rest] = argv;
|
|
188
|
+
const run = Object.prototype.hasOwnProperty.call(COMMANDS, cmd) ? COMMANDS[cmd] : null;
|
|
189
|
+
if (!run) throw new Usage(`명령: ${Object.keys(COMMANDS).join(" | ")}`);
|
|
190
|
+
return run(parseArgs(rest));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Compared as real paths: Node resolves links in import.meta.url but not in argv[1], so a linked path would
|
|
194
|
+
// otherwise do nothing and exit 0.
|
|
195
|
+
const real = (p) => {
|
|
196
|
+
try {
|
|
197
|
+
return realpathSync(p);
|
|
198
|
+
} catch {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
if (process.argv[1] && real(process.argv[1]) !== null && real(process.argv[1]) === real(fileURLToPath(import.meta.url))) {
|
|
203
|
+
main(process.argv.slice(2)).then(
|
|
204
|
+
(code) => {
|
|
205
|
+
process.exitCode = code;
|
|
206
|
+
},
|
|
207
|
+
(e) => {
|
|
208
|
+
process.stderr.write(`${e instanceof Usage ? "" : "내부 오류: "}${e.message}\n`);
|
|
209
|
+
process.exitCode = 2;
|
|
210
|
+
},
|
|
211
|
+
);
|
|
212
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# vendor
|
|
2
|
+
|
|
3
|
+
video-gen 이 설치와 내려받기 없이 영상을 만들려고 넣은 파일이다. 모두 고치지 않은 원본이다.
|
|
4
|
+
|
|
5
|
+
| 파일 | 원본 | 판 | 라이선스 | sha256 |
|
|
6
|
+
|---|---|---|---|---|
|
|
7
|
+
| `canvaskit/canvaskit.js`, `canvaskit/canvaskit.wasm` | npm `canvaskit-wasm` 의 `bin/full/` (Skia) | 0.42.0 | BSD-3-Clause, `canvaskit/LICENSE.md`. 안에 든 ICU, FreeType, HarfBuzz, libjpeg-turbo, libpng, libwebp, zlib, Wuffs 의 고지는 `canvaskit/THIRD-PARTY-NOTICES.md` | js `894815b2d39b24de2eacdb01453778d83e0b6c418b034e3b728e80956ac2a9d5`, wasm `aca7fa6019f95d3de98d4a49ae60a3d66a09e9d5ca74091fbc369b9be959f959` |
|
|
8
|
+
| `h264-mp4-encoder/h264-mp4-encoder.node.js` | npm `h264-mp4-encoder` 의 `embuild/dist/` | 1.0.12 | MIT, `h264-mp4-encoder/LICENSE.md`. 안의 구성요소는 아래 | `f8df9c1791b249f75e5cef77f8e32a135b4cdb2c918a0c4593669e8571085c0c` |
|
|
9
|
+
| `fonts/NotoSans-Regular.ttf`, `fonts/NotoSans-Bold.ttf` | notofonts.github.io `fonts/NotoSans/hinted/ttf/` | | SIL OFL 1.1, `fonts/OFL-noto-sans.md` | Regular `478c558ea716033cd60c03438f628dfa75694dcf6b5f6d505a2f05fd2b4f3823`, Bold `1df075a380fc7cb898acf64c1f7b3b4dd780de3caa860178bf929de35817a913` |
|
|
10
|
+
| `fonts/NotoSansKR-Regular.otf`, `fonts/NotoSansKR-Bold.otf` | noto-cjk `Sans/SubsetOTF/KR/` | | SIL OFL 1.1, `fonts/OFL-noto-sans-kr.md` | Regular `69975a0ac8472717870aefeab0a4d52739308d90856b9955313b2ad5e0148d68`, Bold `5a6ceb287ed2fc6cfc6213144ebea68cbd94b20fc9eb873d8486493bf02d9bda` |
|
|
11
|
+
| `aimotion/LICENSE.md` | github.com/kstost/cokacmotion `LICENSE` | c417b16 | MIT. `scripts/vg-fx.mjs` 가 옮겨 쓴 코드의 고지 | |
|
|
12
|
+
|
|
13
|
+
## h264-mp4-encoder 안의 구성요소
|
|
14
|
+
|
|
15
|
+
| 구성요소 | 라이선스 | 원본 소스 |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| minih264 (H.264 인코더) | public domain(CC0) | https://github.com/TrevorSundberg/minih264 커밋 `25f441086ac8f2eef1c883476c095f9397843ac8` (원본 https://github.com/lieff/minih264) |
|
|
18
|
+
| libmp4v2 (MP4 쓰기) | Mozilla Public License 1.1, 전문 `h264-mp4-encoder/MPL-1.1.md` | https://github.com/TrevorSundberg/libmp4v2 커밋 `d49b4466ed76fc23b59e31a5f7f10f34b30ad7c4` (원본 https://github.com/sergiomb2/libmp4v2) |
|
|
19
|
+
|
|
20
|
+
- 커밋 번호는 h264-mp4-encoder 의 `v1.0.12` 태그가 가리키는 하위 모듈이다.
|
|
21
|
+
- libmp4v2 는 MPL 1.1 이다. 실행 형태(WASM)로 함께 배포하므로 그 소스를 MPL 1.1 로 구할 수 있게 한다:
|
|
22
|
+
- 위 커밋의 소스 묶음을 이 저장소의 `third_party/libmp4v2-d49b4466.tar.gz` 에 둔다(npm 패키지에는 넣지 않음). sha256 `c63b3dcb1e7f77e8134b9ccd2500cb144b51b90ba5bce0625313f8d23a9f2e1c`.
|
|
23
|
+
- banker 는 이 구성요소를 고치지 않았다.
|
|
24
|
+
- 이 인코더의 Emscripten 글루는 불러올 때 프로세스의 처리되지 않은 예외와 거부 처리기를 등록한다. `video-gen.mjs` 는 자기 거부를 모두 처리한다.
|
|
25
|
+
- 판을 올릴 때는 파일을 바꾸고 이 표의 sha256 을 고친 뒤 `scripts/video-gen.test.mjs` 를 돌린다(시험이 sha256 을 대조함).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kstost
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) 2011 Google Inc. All rights reserved.
|
|
2
|
+
//
|
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
|
4
|
+
// modification, are permitted provided that the following conditions are
|
|
5
|
+
// met:
|
|
6
|
+
//
|
|
7
|
+
// * Redistributions of source code must retain the above copyright
|
|
8
|
+
// notice, this list of conditions and the following disclaimer.
|
|
9
|
+
// * Redistributions in binary form must reproduce the above
|
|
10
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
// in the documentation and/or other materials provided with the
|
|
12
|
+
// distribution.
|
|
13
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
14
|
+
// contributors may be used to endorse or promote products derived from
|
|
15
|
+
// this software without specific prior written permission.
|
|
16
|
+
//
|
|
17
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
|
|
29
|
+
--------------------------------------------------------------------------------
|