@officexapp/vidfarm-devcli 0.21.35 → 0.21.36

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.
@@ -164,6 +164,24 @@ export function keySafeArtInstruction(keyColorHex) {
164
164
  `background. Keep the whole palette in strong contrast to ${hex}. The background must be visible ONLY around the ` +
165
165
  `outside of the objects, never showing through inside them.`);
166
166
  }
167
+ /**
168
+ * The same clause for the SMART keyer (devcli/plate-key.ts), which deletes only
169
+ * plate that reaches the sheet's edge. Three of the four bans above stop being
170
+ * necessary: a shape's enclosed interior can hold ANY color (including the plate
171
+ * color), outline/line-art shapes keep their middles, and a near-plate fill is
172
+ * safe as long as it is enclosed. What still matters is the silhouette — the
173
+ * outer edge has to be distinguishable from the plate, and nothing may fade into
174
+ * it — so this asks for exactly that and nothing more.
175
+ */
176
+ export function connectivitySafeArtInstruction(keyColorHex) {
177
+ const hex = keyColorHex.toUpperCase();
178
+ return (`KEY-SAFE ARTWORK (only the ${hex} background AROUND the objects gets deleted, never a color sealed inside one): ` +
179
+ `each object's OUTER EDGE must be a clearly different color from ${hex} and must be crisp — no soft glow, blur, mist, ` +
180
+ `feathering, drop shadow or reflection fading from the object into the background, and no ${hex} touching the object's ` +
181
+ `outline from the inside. Inside that outline the art is FREE: any palette (including ${hex} itself), flat or shaded or ` +
182
+ `painterly, filled or outlined, as long as every enclosed area is sealed by the artwork rather than opening out to the ` +
183
+ `background.`);
184
+ }
167
185
  /** At/above this `hole_pct` a sticker is worth warning about: past ~a fifth of
168
186
  * its own box, "the key ate the fill" is far more likely than "the artist drew
169
187
  * a ring". Tuned to stay quiet on letter counters, handles and small gaps. */
@@ -523,6 +541,36 @@ export async function analyzeKeyedArt(sourcePath) {
523
541
  const hole_pct = Math.round((holeArea / (opaque + holeArea)) * 1000) / 10;
524
542
  return { holes: holes.length, hole_pct, hollow: hole_pct >= HOLE_WARN_PCT };
525
543
  }
544
+ /**
545
+ * What share of a transparent still is actually opaque. Used to sanity-check a
546
+ * matte before trusting it: an ONNX matting pass on art it doesn't recognize as a
547
+ * subject can come back empty (everything transparent — a blank sticker) or
548
+ * untouched (everything opaque — the background still attached), and both look
549
+ * like success to the file system. Returns null when there's no alpha to read.
550
+ */
551
+ export async function measureOpaqueShare(sourcePath) {
552
+ if (!existsSync(sourcePath))
553
+ return null;
554
+ const dims = await probeImageDimensions(sourcePath);
555
+ if (!dims)
556
+ return null;
557
+ const longSide = Math.max(dims.width, dims.height);
558
+ const scale = longSide > 320 ? 320 / longSide : 1;
559
+ const sw = Math.max(1, Math.round(dims.width * scale));
560
+ const sh = Math.max(1, Math.round(dims.height * scale));
561
+ let alpha;
562
+ try {
563
+ alpha = await readAlphaPlane(sourcePath, sw, sh);
564
+ }
565
+ catch {
566
+ return null;
567
+ }
568
+ let opaque = 0;
569
+ for (let i = 0; i < alpha.length; i++)
570
+ if (alpha[i] > 8)
571
+ opaque++;
572
+ return Math.round((opaque / alpha.length) * 1000) / 10;
573
+ }
526
574
  /**
527
575
  * Re-encode a transparent still as a transparent GIF — the format a lot of
528
576
  * sticker surfaces (chat, forums, Notion, old-school web overlays) still want.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@officexapp/vidfarm-devcli",
3
- "version": "0.21.35",
3
+ "version": "0.21.36",
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": {
@@ -25,6 +25,7 @@
25
25
  "dist/src/devcli/local-backend.js",
26
26
  "dist/src/devcli/local-frontend-server.js",
27
27
  "dist/src/devcli/local-render.js",
28
+ "dist/src/devcli/plate-key.js",
28
29
  "dist/src/devcli/port-utils.js",
29
30
  "dist/src/devcli/process-scan.js",
30
31
  "dist/src/devcli/qa-check.js",
@@ -97,7 +98,7 @@
97
98
  "test:clips": "node --import tsx --test test/clip-curation.test.ts",
98
99
  "test:qa": "node --import tsx --test test/qa-check.test.ts",
99
100
  "test:studio-brand": "node --import tsx --test test/studio-brand.test.ts",
100
- "test:stickers": "node --import tsx --test test/sticker-pack.test.ts",
101
+ "test:stickers": "node --import tsx --test test/sticker-pack.test.ts test/plate-key.test.ts",
101
102
  "test:social-recycle": "node --import tsx --test test/social-recycle.test.ts",
102
103
  "test:dedupe": "node --import tsx --test test/dedupe-recipe.test.ts",
103
104
  "check:skills": "node scripts/build-director-skill-rollup.mjs --check && node scripts/check-skill-routes.mjs && node scripts/check-skill-nav.mjs",