@officexapp/vidfarm-devcli 0.21.27 → 0.21.28
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/.agents/skills/editor-capabilities/SKILL.md +26 -0
- package/.agents/skills/vidfarm/SKILL.md +6 -4
- package/.agents/skills/vidfarm/recipes/local-edit-render-approve.md +3 -2
- package/.agents/skills/vidfarm/references/assets-and-sourcing.md +3 -3
- package/.agents/skills/vidfarm/references/automation-and-local-dev.md +32 -0
- package/.agents/skills/vidfarm/references/editor-workflows.md +41 -5
- package/.agents/skills/vidfarm/references/onboarding.md +4 -4
- package/.agents/skills/vidfarm/references/primitives.md +5 -1
- package/SKILL.director.md +94 -19
- package/SKILL.md +5 -2
- package/dist/src/cli.js +69 -0
- package/dist/src/devcli/qa-check.js +420 -0
- package/package.json +3 -1
- package/public/serve-shells/tools-image.html +378 -265
- package/public/serve-shells/tools-video.html +760 -167
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
// Social-native QA check for the devcli — read a composition.html on disk and
|
|
2
|
+
// flag "HTML slop": landing-page furniture that shows up everywhere on the web
|
|
3
|
+
// and NEVER in a real TikTok/Reel/Short. Compositions are authored in HTML, so
|
|
4
|
+
// an agent that reaches for its web-page instincts produces gradient CTA
|
|
5
|
+
// capsules, benefit chip rows, and frosted cards floating over footage — the
|
|
6
|
+
// single loudest tell that a video was machine-made.
|
|
7
|
+
//
|
|
8
|
+
// DESIGN CONTRACT (read before adding a rule):
|
|
9
|
+
// * BLOCKLIST, never allowlist. We name specific, well-known web-furniture
|
|
10
|
+
// patterns. Anything we haven't named is legal. A composition that does
|
|
11
|
+
// something weird, ugly, hand-made, or wildly stylized must PASS — the
|
|
12
|
+
// check exists to stop slop, not to homogenize style. If a rule would fire
|
|
13
|
+
// on a legitimately creative choice, the rule is wrong; loosen it.
|
|
14
|
+
// * FEEDBACK, never a gate. `vidfarm qa` exits 0 even with errors unless the
|
|
15
|
+
// caller opts into `--strict`. Nothing in the render path depends on it.
|
|
16
|
+
// * PRECISION over recall. Every `error` needs TWO independent signals (e.g.
|
|
17
|
+
// action copy AND a button shape). Single weak signals are `warn` at most.
|
|
18
|
+
// A false positive teaches agents to ignore the tool; a false negative just
|
|
19
|
+
// means we missed one.
|
|
20
|
+
//
|
|
21
|
+
// Pure DOM (linkedom) — no ffmpeg, no network, no Chrome. Local-only: this is a
|
|
22
|
+
// devcli capability with no cloud/REST equivalent.
|
|
23
|
+
import { parseHTML } from "linkedom";
|
|
24
|
+
// ── The font regime ───────────────────────────────────────────────────────────
|
|
25
|
+
// Mirrors CAPTION_FONT_REGIME in composition-edit.ts / COMPOSITION_FONT_IMPORT
|
|
26
|
+
// in services/studio-project-adapter.ts. A family outside this set is not even
|
|
27
|
+
// imported by the composition, so it silently falls back to a web-default sans
|
|
28
|
+
// at render — which IS the slop look.
|
|
29
|
+
const FONT_REGIME = ["tiktok sans", "montserrat", "abel", "source code pro", "yesteryear"];
|
|
30
|
+
// Named separately so we can say "this is a website font" instead of the vaguer
|
|
31
|
+
// "not imported" — the more actionable message when an agent typed it on purpose.
|
|
32
|
+
const WEB_DEFAULT_FONTS = [
|
|
33
|
+
"inter", "roboto", "system-ui", "-apple-system", "arial", "helvetica", "helvetica neue",
|
|
34
|
+
"segoe ui", "times", "times new roman", "georgia", "verdana", "tahoma", "open sans", "lato", "nunito"
|
|
35
|
+
];
|
|
36
|
+
// Bootstrap / Tailwind / generic web-component class names. Matched as whole
|
|
37
|
+
// tokens against class attributes, so `btn-primary` hits and `subtle` doesn't.
|
|
38
|
+
const SLOP_CLASS_TOKENS = [
|
|
39
|
+
"btn", "button", "cta", "badge", "chip", "pill", "tag", "card", "panel", "navbar", "nav",
|
|
40
|
+
"hero", "jumbotron", "alert", "breadcrumb", "form-control", "input-group", "container",
|
|
41
|
+
"container-fluid", "row", "list-group", "well", "thumbnail", "media-object"
|
|
42
|
+
];
|
|
43
|
+
const SLOP_CLASS_PREFIXES = [
|
|
44
|
+
"col-", "rounded-full", "shadow-lg", "shadow-xl", "shadow-2xl", "backdrop-blur",
|
|
45
|
+
"bg-gradient-to-", "ring-", "btn-", "card-", "badge-", "nav-", "navbar-"
|
|
46
|
+
];
|
|
47
|
+
// Copy whose only job is to be clicked. Bare CTA words in a caption are FINE
|
|
48
|
+
// ("buy now" is a legitimate social line) — this list only escalates a finding
|
|
49
|
+
// when the text also sits inside a button shape.
|
|
50
|
+
const ACTION_COPY = /\b(sign\s?up|get\s?started|learn\s?more|book\s+a\s+(call|demo)|start\s+(your\s+)?free\s+trial|free\s+trial|try\s+(it\s+)?free|click\s+here|subscribe\s+now|shop\s+now|order\s+now|contact\s+us|join\s+now|download\s+now|register\s+now|read\s+more|see\s+plans|view\s+pricing)\b/i;
|
|
51
|
+
// The stock trust-badge phrases that show up in benefit chip rows.
|
|
52
|
+
const BENEFIT_COPY = /(no\s+credit\s+card|money[-\s]?back|cancel\s+any\s?time|24\/7|free\s+shipping|verified|guarantee|no\s+commitment|risk[-\s]?free)/i;
|
|
53
|
+
function textOf(node) {
|
|
54
|
+
return String(node?.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
55
|
+
}
|
|
56
|
+
function classTokens(node) {
|
|
57
|
+
return String(node?.getAttribute?.("class") ?? "").split(/\s+/).filter(Boolean);
|
|
58
|
+
}
|
|
59
|
+
function styleString(node) {
|
|
60
|
+
return String(node?.getAttribute?.("style") ?? "").toLowerCase();
|
|
61
|
+
}
|
|
62
|
+
/** Parse a CSS length in px from an inline style declaration. */
|
|
63
|
+
function pxOf(style, prop) {
|
|
64
|
+
const match = style.match(new RegExp(`(?:^|;)\\s*${prop}\\s*:\\s*(-?[\\d.]+)px`));
|
|
65
|
+
return match ? Number(match[1]) : null;
|
|
66
|
+
}
|
|
67
|
+
function hasDecl(style, prop) {
|
|
68
|
+
return new RegExp(`(?:^|;)\\s*${prop}\\s*:`).test(style);
|
|
69
|
+
}
|
|
70
|
+
/** border-radius in px, treating any %/9999-style value as "fully rounded". */
|
|
71
|
+
function radiusPx(style) {
|
|
72
|
+
const match = style.match(/(?:^|;)\s*border-radius\s*:\s*([^;]+)/);
|
|
73
|
+
if (!match)
|
|
74
|
+
return 0;
|
|
75
|
+
const raw = match[1].trim();
|
|
76
|
+
if (/%/.test(raw))
|
|
77
|
+
return 9999;
|
|
78
|
+
const num = Number((raw.match(/(-?[\d.]+)px/) ?? [])[1] ?? 0);
|
|
79
|
+
return Number.isFinite(num) ? num : 0;
|
|
80
|
+
}
|
|
81
|
+
function primaryFamily(raw) {
|
|
82
|
+
return String(raw).split(",")[0].replace(/['"]/g, "").trim().toLowerCase();
|
|
83
|
+
}
|
|
84
|
+
function label(node, fallback) {
|
|
85
|
+
const value = node?.getAttribute?.("data-label") ||
|
|
86
|
+
node?.getAttribute?.("data-slug") ||
|
|
87
|
+
node?.getAttribute?.("data-hf-id") ||
|
|
88
|
+
node?.getAttribute?.("id") ||
|
|
89
|
+
"";
|
|
90
|
+
const text = textOf(node).slice(0, 40);
|
|
91
|
+
const name = String(value).trim() || fallback;
|
|
92
|
+
return text ? `${name} — "${text}"` : name;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* QA a composition's HTML. Pure: returns findings, mutates nothing. Safe on
|
|
96
|
+
* malformed input (returns a clean report rather than throwing) — a QA pass
|
|
97
|
+
* must never be the thing that breaks a render.
|
|
98
|
+
*/
|
|
99
|
+
export function qaCompositionHtml(html) {
|
|
100
|
+
const findings = [];
|
|
101
|
+
let root = null;
|
|
102
|
+
let document = null;
|
|
103
|
+
try {
|
|
104
|
+
({ document } = parseHTML(html));
|
|
105
|
+
root = document.querySelector("[data-composition-id]") ?? document.body;
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return {
|
|
109
|
+
ok: true,
|
|
110
|
+
verdict: "clean",
|
|
111
|
+
errors: [],
|
|
112
|
+
warnings: [],
|
|
113
|
+
checked: { layers: 0, text_layers: 0, canvas: null }
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (!root) {
|
|
117
|
+
return { ok: true, verdict: "clean", errors: [], warnings: [], checked: { layers: 0, text_layers: 0, canvas: null } };
|
|
118
|
+
}
|
|
119
|
+
const push = (f) => findings.push(f);
|
|
120
|
+
const all = Array.from(root.querySelectorAll("*"));
|
|
121
|
+
const layers = Array.from(root.querySelectorAll("[data-start]"));
|
|
122
|
+
// Only layers that actually SHOW WORDS get judged on typography and placement.
|
|
123
|
+
// A `data-layer-kind="text"` div is also how compositions carry scrims,
|
|
124
|
+
// gradient washes, and colour blocks — those legitimately span the full frame
|
|
125
|
+
// and have no font at all, so judging them would be pure noise.
|
|
126
|
+
const textLayers = Array.from(root.querySelectorAll('[data-layer-kind="caption"], [data-layer-kind="text"]')).filter((node) => textOf(node).length > 0);
|
|
127
|
+
const canvasW = Number(root.getAttribute?.("data-width") ?? 0) || null;
|
|
128
|
+
const canvasH = Number(root.getAttribute?.("data-height") ?? 0) || null;
|
|
129
|
+
// ── Rule: clickable elements ────────────────────────────────────────────────
|
|
130
|
+
// Nothing in a video is clickable. A <button>, a link, or a form control in a
|
|
131
|
+
// composition is web instinct leaking through, full stop.
|
|
132
|
+
for (const node of all) {
|
|
133
|
+
const tag = String(node.tagName ?? "").toLowerCase();
|
|
134
|
+
if (tag === "button" || tag === "form" || tag === "input" || tag === "select" || tag === "textarea") {
|
|
135
|
+
push({
|
|
136
|
+
rule: "clickable-element",
|
|
137
|
+
severity: "error",
|
|
138
|
+
message: `<${tag}> in a composition — nothing in a video is clickable.`,
|
|
139
|
+
where: label(node, `<${tag}>`),
|
|
140
|
+
fix: "Delete the control. If it carried a call to action, say it as a timed caption line on the footage (or in the voiceover)."
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else if (tag === "a" && node.getAttribute?.("href")) {
|
|
144
|
+
push({
|
|
145
|
+
rule: "clickable-element",
|
|
146
|
+
severity: "warn",
|
|
147
|
+
message: "<a href> in a composition — links do nothing in a rendered MP4.",
|
|
148
|
+
where: label(node, "<a>"),
|
|
149
|
+
fix: "Keep the text if it's a real caption (a spoken URL reads fine); drop the anchor and any button styling around it."
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// ── Rule: web-framework class names ────────────────────────────────────────
|
|
154
|
+
// Bootstrap/Tailwind furniture names. Two or more distinct hits is a strong
|
|
155
|
+
// signal someone built a landing page section; one is worth a nudge.
|
|
156
|
+
const frameworkHits = [];
|
|
157
|
+
for (const node of all) {
|
|
158
|
+
for (const token of classTokens(node)) {
|
|
159
|
+
const lower = token.toLowerCase();
|
|
160
|
+
if (SLOP_CLASS_TOKENS.includes(lower) || SLOP_CLASS_PREFIXES.some((p) => lower.startsWith(p))) {
|
|
161
|
+
frameworkHits.push({ node, token });
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (frameworkHits.length) {
|
|
167
|
+
const tokens = [...new Set(frameworkHits.map((h) => h.token))].slice(0, 6).join(", ");
|
|
168
|
+
push({
|
|
169
|
+
rule: "web-framework-classes",
|
|
170
|
+
severity: frameworkHits.length >= 2 ? "error" : "warn",
|
|
171
|
+
message: `${frameworkHits.length} element(s) using web-page class names (${tokens}) — this is a landing page, not a video.`,
|
|
172
|
+
where: label(frameworkHits[0].node, "element"),
|
|
173
|
+
fix: "Rebuild as timed text on the footage. Text belongs ON the frame, not inside a container with padding and a shadow."
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// Only CSS-FRAMEWORK stylesheets — a jsdelivr <script> for GSAP/anime.js is a
|
|
177
|
+
// normal, encouraged part of a local composition and must never trip this.
|
|
178
|
+
if (/bootstrap[^"']*\.css|cdn\.tailwindcss\.com|tailwind[^"']*\.css|fontawesome[^"']*\.css|bulma[^"']*\.css|foundation[^"']*\.css/i.test(html)) {
|
|
179
|
+
push({
|
|
180
|
+
rule: "web-framework-classes",
|
|
181
|
+
severity: "error",
|
|
182
|
+
message: "A CSS framework stylesheet (Bootstrap/Tailwind/FontAwesome/Bulma) is linked into the composition.",
|
|
183
|
+
where: "<head>",
|
|
184
|
+
fix: "Remove it. Its defaults ARE the look to avoid, and renders should be offline-deterministic. (A <script> CDN for GSAP/anime.js is fine — this is about CSS frameworks.)"
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
// ── Rule: CTA button ───────────────────────────────────────────────────────
|
|
188
|
+
// Two signals required: action copy AND a button shape (pill/rounded fill).
|
|
189
|
+
// "BUY NOW" as a bare caption is legitimate social copy and must not fire.
|
|
190
|
+
for (const node of all) {
|
|
191
|
+
const text = textOf(node);
|
|
192
|
+
if (!text || text.length > 60 || !ACTION_COPY.test(text))
|
|
193
|
+
continue;
|
|
194
|
+
const style = styleString(node);
|
|
195
|
+
const radius = radiusPx(style);
|
|
196
|
+
const filled = /background(?:-color|-image)?\s*:/.test(style) && !/background[^;]*:\s*(none|transparent)/.test(style);
|
|
197
|
+
const gradient = /linear-gradient|radial-gradient/.test(style);
|
|
198
|
+
const shadowed = hasDecl(style, "box-shadow");
|
|
199
|
+
const buttonShape = (radius >= 16 && filled) || (gradient && radius >= 8) || (filled && shadowed && radius >= 8);
|
|
200
|
+
if (buttonShape) {
|
|
201
|
+
push({
|
|
202
|
+
rule: "cta-button",
|
|
203
|
+
severity: "error",
|
|
204
|
+
message: `CTA button ("${text.slice(0, 40)}") — a filled, rounded capsule with action copy. Pure landing page.`,
|
|
205
|
+
where: label(node, "cta"),
|
|
206
|
+
fix: "Kill the capsule. Deliver the CTA as a plain caption line in the font regime, spoken in the voiceover, or as an arrow pointing at real on-screen UI."
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// ── Rule: benefit chip / badge row ─────────────────────────────────────────
|
|
211
|
+
// "✓ No Credit Card Needed · ✓ 30-Min Trial" — a row of small rounded tags.
|
|
212
|
+
// Requires 2+ siblings that are each small, filled, and rounded.
|
|
213
|
+
const parents = new Map();
|
|
214
|
+
for (const node of all) {
|
|
215
|
+
const style = styleString(node);
|
|
216
|
+
const text = textOf(node);
|
|
217
|
+
if (!text || text.length > 45)
|
|
218
|
+
continue;
|
|
219
|
+
const filled = /background(?:-color|-image)?\s*:/.test(style) && !/background[^;]*:\s*(none|transparent)/.test(style);
|
|
220
|
+
const chipShape = radiusPx(style) >= 10 && filled;
|
|
221
|
+
const chipCopy = /^[✓✔✅•·]/.test(text) || BENEFIT_COPY.test(text);
|
|
222
|
+
if (!(chipShape && (chipCopy || text.split(" ").length <= 5)))
|
|
223
|
+
continue;
|
|
224
|
+
const parent = node.parentNode;
|
|
225
|
+
if (!parent)
|
|
226
|
+
continue;
|
|
227
|
+
const bucket = parents.get(parent) ?? [];
|
|
228
|
+
bucket.push(node);
|
|
229
|
+
parents.set(parent, bucket);
|
|
230
|
+
}
|
|
231
|
+
for (const [, bucket] of parents) {
|
|
232
|
+
if (bucket.length < 2)
|
|
233
|
+
continue;
|
|
234
|
+
push({
|
|
235
|
+
rule: "badge-chip-row",
|
|
236
|
+
severity: "error",
|
|
237
|
+
message: `A row of ${bucket.length} badge/chip pills (${bucket.slice(0, 3).map((n) => `"${textOf(n).slice(0, 22)}"`).join(", ")}) — trust badges are website furniture.`,
|
|
238
|
+
where: label(bucket[0], "chip"),
|
|
239
|
+
fix: "Say each benefit as its OWN timed caption line on the footage, one at a time, in the font regime. One idea per beat reads far better than a chip strip."
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
// ── Rule: card / panel / glassmorphism ─────────────────────────────────────
|
|
243
|
+
// A rounded box with a border, shadow, or frosted blur, holding more than one
|
|
244
|
+
// piece of content. A tight caption BAND is legal (small radius, one run) —
|
|
245
|
+
// this fires only once the band has become a container.
|
|
246
|
+
for (const node of all) {
|
|
247
|
+
const style = styleString(node);
|
|
248
|
+
if (!style)
|
|
249
|
+
continue;
|
|
250
|
+
const radius = radiusPx(style);
|
|
251
|
+
const frosted = /backdrop-filter\s*:\s*[^;]*blur/.test(style);
|
|
252
|
+
const bordered = /(?:^|;)\s*border\s*:\s*(?!0|none)/.test(style) || hasDecl(style, "border-width");
|
|
253
|
+
const shadowed = hasDecl(style, "box-shadow") && !/box-shadow\s*:\s*none/.test(style);
|
|
254
|
+
const childBoxes = Array.from(node.children ?? []).filter((c) => textOf(c)).length;
|
|
255
|
+
const filled = /background(?:-color|-image)?\s*:/.test(style) && !/background[^;]*:\s*(none|transparent)/.test(style);
|
|
256
|
+
if (frosted) {
|
|
257
|
+
push({
|
|
258
|
+
rule: "glass-card",
|
|
259
|
+
severity: "error",
|
|
260
|
+
message: "Glassmorphism (backdrop-filter blur) — a frosted web panel floating over the footage.",
|
|
261
|
+
where: label(node, "panel"),
|
|
262
|
+
fix: "Drop the panel. If the text needs legibility over busy footage, use a heavy outline (background_style outline) or a tight solid band that hugs the words."
|
|
263
|
+
});
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
if (radius >= 12 && (bordered || shadowed) && filled && childBoxes >= 2) {
|
|
267
|
+
push({
|
|
268
|
+
rule: "card-panel",
|
|
269
|
+
severity: "error",
|
|
270
|
+
message: `Card/panel: rounded ${Math.round(radius)}px box with ${bordered ? "a border" : "a drop shadow"} wrapping ${childBoxes} elements.`,
|
|
271
|
+
where: label(node, "card"),
|
|
272
|
+
fix: "Put the text directly on the frame. A legibility band is legal — radius ≤8px, no border, no shadow, hugging ONE text run — but a headline + subheading + URL inside one rounded box is a web card."
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// ── Rule: gradient text fill ───────────────────────────────────────────────
|
|
277
|
+
if (/background-clip\s*:\s*text|-webkit-background-clip\s*:\s*text/i.test(html)) {
|
|
278
|
+
push({
|
|
279
|
+
rule: "gradient-text",
|
|
280
|
+
severity: "error",
|
|
281
|
+
message: "Gradient-filled text (background-clip:text) — a SaaS hero headline treatment.",
|
|
282
|
+
where: "composition styles",
|
|
283
|
+
fix: "Use a solid fill. If you want emphasis, pop a SINGLE word in an accent color, or go heavier weight / ALL-CAPS."
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
// ── Rule: page structure elements ──────────────────────────────────────────
|
|
287
|
+
for (const node of all) {
|
|
288
|
+
const tag = String(node.tagName ?? "").toLowerCase();
|
|
289
|
+
if (tag === "table" || tag === "nav" || tag === "header" || tag === "footer") {
|
|
290
|
+
push({
|
|
291
|
+
rule: "page-structure",
|
|
292
|
+
severity: tag === "table" ? "warn" : "error",
|
|
293
|
+
message: `<${tag}> element — page chrome has no place in a video frame.`,
|
|
294
|
+
where: label(node, `<${tag}>`),
|
|
295
|
+
fix: tag === "table"
|
|
296
|
+
? "If it's real data, build it as an animated stat/number reveal instead of a static grid of cells."
|
|
297
|
+
: "Delete it and re-time its content as captions on the footage."
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (tag === "ul" || tag === "ol") {
|
|
301
|
+
const style = styleString(node);
|
|
302
|
+
// A list with markers switched OFF is just a layout container — fine.
|
|
303
|
+
if (!/list-style(?:-type)?\s*:\s*none/.test(style)) {
|
|
304
|
+
push({
|
|
305
|
+
rule: "bullet-list",
|
|
306
|
+
severity: "warn",
|
|
307
|
+
message: `<${tag}> with visible bullet markers — a slide/webpage list, not a social beat.`,
|
|
308
|
+
where: label(node, `<${tag}>`),
|
|
309
|
+
fix: "Reveal the points ONE AT A TIME as timed caption lines. If you want the list look, set list-style:none and animate each row in."
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// ── Rule: font regime ──────────────────────────────────────────────────────
|
|
315
|
+
for (const node of textLayers) {
|
|
316
|
+
const attr = String(node.getAttribute?.("data-font-family") ?? "").trim();
|
|
317
|
+
const style = styleString(node);
|
|
318
|
+
const cssMatch = style.match(/(?:^|;)\s*font-family\s*:\s*([^;]+)/);
|
|
319
|
+
const family = primaryFamily(attr || (cssMatch ? cssMatch[1] : ""));
|
|
320
|
+
if (family && !FONT_REGIME.includes(family)) {
|
|
321
|
+
const isWebDefault = WEB_DEFAULT_FONTS.includes(family) || family === "sans-serif" || family === "serif";
|
|
322
|
+
push({
|
|
323
|
+
rule: "font-regime",
|
|
324
|
+
severity: isWebDefault ? "error" : "warn",
|
|
325
|
+
message: isWebDefault
|
|
326
|
+
? `Text layer in "${family}" — a website body font. This alone makes a frame read as a screenshot of a web page.`
|
|
327
|
+
: `Text layer in "${family}", outside the composition's imported font regime — it will silently fall back at render.`,
|
|
328
|
+
where: label(node, "text layer"),
|
|
329
|
+
fix: `Use an imported display family: Montserrat (default), TikTok Sans, Abel, Source Code Pro, or Yesteryear — e.g. \`vidfarm set-style <dir> --layer <key> --font-family Montserrat\`. Local renders auto-coerce this, but the editor preview will not match until you fix it.`
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
// Weight: the TikTok caption look is heavy. Light weights are a legitimate
|
|
333
|
+
// creative choice for a title card, so this is only ever a nudge.
|
|
334
|
+
const weightRaw = node.getAttribute?.("data-font-weight") ?? (style.match(/(?:^|;)\s*font-weight\s*:\s*(\d{3})/) ?? [])[1];
|
|
335
|
+
const weight = Number(weightRaw);
|
|
336
|
+
if (Number.isFinite(weight) && weight > 0 && weight < 600) {
|
|
337
|
+
push({
|
|
338
|
+
rule: "font-weight",
|
|
339
|
+
severity: "warn",
|
|
340
|
+
message: `Caption weight ${weight} — social captions read at 700–900; anything lighter dissolves on a phone over moving footage.`,
|
|
341
|
+
where: label(node, "text layer"),
|
|
342
|
+
fix: "Bump to 700–900 unless the light weight is a deliberate title-card look."
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
// Size: 0 is invisible (a real bug we have shipped before); tiny text is
|
|
346
|
+
// unreadable at phone scale. Only judged when we know the canvas width.
|
|
347
|
+
const sizePx = pxOf(style, "font-size") ?? Number(node.getAttribute?.("data-font-size") ?? NaN);
|
|
348
|
+
if (Number.isFinite(sizePx)) {
|
|
349
|
+
if (sizePx === 0) {
|
|
350
|
+
push({
|
|
351
|
+
rule: "font-size",
|
|
352
|
+
severity: "error",
|
|
353
|
+
message: "font-size:0 — this text renders invisibly.",
|
|
354
|
+
where: label(node, "text layer"),
|
|
355
|
+
fix: "Set a real size: ~36–64px on a 1080-wide frame."
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
else if (canvasW && sizePx > 0 && sizePx < canvasW * 0.026) {
|
|
359
|
+
push({
|
|
360
|
+
rule: "font-size",
|
|
361
|
+
severity: "warn",
|
|
362
|
+
message: `font-size ${Math.round(sizePx)}px on a ${canvasW}px-wide canvas — too small to read on a phone.`,
|
|
363
|
+
where: label(node, "text layer"),
|
|
364
|
+
fix: `Aim for ~${Math.round(canvasW * 0.033)}–${Math.round(canvasW * 0.06)}px.`
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
// ── Rule: caption safe zone ────────────────────────────────────────────────
|
|
370
|
+
// Local renders auto-normalize this, but the editor preview and cloud render
|
|
371
|
+
// do not — so flag it as a warning rather than silently relying on the fixer.
|
|
372
|
+
// PORTRAIT ONLY: the dead zones are phone-feed chrome (status bar, action rail,
|
|
373
|
+
// username block). A 16:9 or square composition has no such constraint.
|
|
374
|
+
if (canvasH && canvasW && canvasH > canvasW) {
|
|
375
|
+
for (const node of textLayers) {
|
|
376
|
+
const style = styleString(node);
|
|
377
|
+
const top = Number((style.match(/(?:^|;)\s*top\s*:\s*(-?[\d.]+)%/) ?? [])[1]);
|
|
378
|
+
const height = Number((style.match(/(?:^|;)\s*height\s*:\s*(-?[\d.]+)%/) ?? [])[1]);
|
|
379
|
+
if (!Number.isFinite(top))
|
|
380
|
+
continue;
|
|
381
|
+
const bottom = top + (Number.isFinite(height) ? height : 0);
|
|
382
|
+
if (top < 8 || bottom > 85) {
|
|
383
|
+
push({
|
|
384
|
+
rule: "caption-safe-zone",
|
|
385
|
+
severity: "warn",
|
|
386
|
+
message: `Text at ${top.toFixed(0)}%–${bottom.toFixed(0)}% spills into the phone-UI dead zone (safe band is 8%–85%).`,
|
|
387
|
+
where: label(node, "text layer"),
|
|
388
|
+
fix: "Pull it inside 8%–85% keeping its top-vs-bottom anchoring. `vidfarm render --target local` clamps this automatically; the editor preview and cloud render do not."
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
const errors = findings.filter((f) => f.severity === "error");
|
|
394
|
+
const warnings = findings.filter((f) => f.severity === "warn");
|
|
395
|
+
return {
|
|
396
|
+
ok: errors.length === 0,
|
|
397
|
+
verdict: errors.length ? "slop" : warnings.length ? "warnings" : "clean",
|
|
398
|
+
errors,
|
|
399
|
+
warnings,
|
|
400
|
+
checked: {
|
|
401
|
+
layers: layers.length,
|
|
402
|
+
text_layers: textLayers.length,
|
|
403
|
+
canvas: canvasW && canvasH ? `${canvasW}×${canvasH}` : null
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
/** Human-readable report body (no trailing summary line — the CLI adds that). */
|
|
408
|
+
export function formatQaReport(report, colors) {
|
|
409
|
+
const { red, yellow, dim, reset } = colors;
|
|
410
|
+
const lines = [];
|
|
411
|
+
for (const finding of [...report.errors, ...report.warnings]) {
|
|
412
|
+
const isError = finding.severity === "error";
|
|
413
|
+
const mark = isError ? `${red}✗ SLOP${reset}` : `${yellow}! warn${reset}`;
|
|
414
|
+
lines.push(`${mark} ${dim}[${finding.rule}]${reset} ${finding.message}`);
|
|
415
|
+
lines.push(` ${dim}at${reset} ${finding.where}`);
|
|
416
|
+
lines.push(` ${dim}→${reset} ${finding.fix}`);
|
|
417
|
+
}
|
|
418
|
+
return lines.join("\n");
|
|
419
|
+
}
|
|
420
|
+
//# sourceMappingURL=qa-check.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@officexapp/vidfarm-devcli",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.28",
|
|
4
4
|
"description": "Local bridge for the Vidfarm Trackpad Editor. `vidfarm serve <template_id>` boots the FULL editor on localhost (disk-backed records/storage, free in-process render); edit composition.html on disk (Claude Code, Codex, etc.) and the browser live-morphs it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"dist/src/devcli/local-render.js",
|
|
25
25
|
"dist/src/devcli/port-utils.js",
|
|
26
26
|
"dist/src/devcli/process-scan.js",
|
|
27
|
+
"dist/src/devcli/qa-check.js",
|
|
27
28
|
"dist/src/devcli/sequence.js",
|
|
28
29
|
"dist/src/devcli/skills.js",
|
|
29
30
|
"dist/src/devcli/speech.js",
|
|
@@ -86,6 +87,7 @@
|
|
|
86
87
|
"start": "node --import ./dist/src/instrument.js --enable-source-maps dist/src/index.js",
|
|
87
88
|
"check": "tsc -p tsconfig.json --noEmit && npm run check:skills",
|
|
88
89
|
"test:clips": "node --import tsx --test test/clip-curation.test.ts",
|
|
90
|
+
"test:qa": "node --import tsx --test test/qa-check.test.ts",
|
|
89
91
|
"check:skills": "node scripts/build-director-skill-rollup.mjs --check && node scripts/check-skill-routes.mjs",
|
|
90
92
|
"benchmark:editor-chat": "node --import tsx scripts/benchmark-editor-chat-harness.mjs",
|
|
91
93
|
"cdk:deploy:prod-serverless": "npm run build && dotenv -e .env.production -- npx aws-cdk deploy --app 'node dist/infra/cdk/bin/vidfarm-prod.js'",
|