@koda-sl/baker-cli 0.353.0-dev.5340e1062 → 0.353.0-dev.5d1d795f9

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/dist/cli.js CHANGED
@@ -42,7 +42,6 @@ import {
42
42
  isAudioOnly,
43
43
  isPersistedAssetRef,
44
44
  isVimeoAuthFailure,
45
- loadCompositionMeta,
46
45
  looksLikeHttpUrl,
47
46
  maxInputReferences,
48
47
  maxInputSlot,
@@ -69,7 +68,7 @@ import {
69
68
  validateCanvasDeep,
70
69
  withoutCastName,
71
70
  ytDlpBlockSignal
72
- } from "./chunk-Q2VR3FVM.js";
71
+ } from "./chunk-PHHQLFY3.js";
73
72
  import {
74
73
  csvOrJson,
75
74
  daysAgoIso,
@@ -35532,49 +35531,7 @@ import { defineCommand as defineCommand119 } from "citty";
35532
35531
 
35533
35532
  // src/commands/canvas/catalog.ts
35534
35533
  import { defineCommand as defineCommand108 } from "citty";
35535
-
35536
- // src/commands/canvas/composition-path.ts
35537
- import { existsSync as existsSync4 } from "fs";
35538
- import { readdir as readdir2 } from "fs/promises";
35539
- import path3 from "path";
35540
- function resolveShippedCanvasDir(name, startDir, exists2 = existsSync4, maxDepth = 8) {
35541
- const rel = path3.join("canvas", name);
35542
- let dir = startDir;
35543
- for (let i = 0; i < maxDepth; i++) {
35544
- const candidate = path3.join(dir, rel);
35545
- if (exists2(path3.join(candidate, "meta.json"))) return candidate;
35546
- const parent = path3.dirname(dir);
35547
- if (parent === dir) break;
35548
- dir = parent;
35549
- }
35550
- return path3.resolve(startDir, "../../../", rel);
35551
- }
35552
- async function listShippedCompositions(startDir, maxDepth = 8) {
35553
- let dir = startDir;
35554
- for (let i = 0; i < maxDepth; i++) {
35555
- const root = path3.join(dir, "canvas");
35556
- const found = await compositionsIn(root);
35557
- if (found.length > 0) return found.sort((a, b) => a.id.localeCompare(b.id));
35558
- const parent = path3.dirname(dir);
35559
- if (parent === dir) break;
35560
- dir = parent;
35561
- }
35562
- return [];
35563
- }
35564
- async function compositionsIn(root) {
35565
- const children = await readdir2(root, { withFileTypes: true }).catch(() => []);
35566
- const loaded = await Promise.all(
35567
- children.filter((child) => child.isDirectory()).map(async (child) => {
35568
- const compositionDir = path3.join(root, child.name);
35569
- const meta = await loadCompositionMeta(compositionDir).catch(() => null);
35570
- return meta ? { id: meta.id, title: meta.title, dir: compositionDir } : null;
35571
- })
35572
- );
35573
- return loaded.filter((c) => c !== null);
35574
- }
35575
-
35576
- // src/commands/canvas/catalog.ts
35577
- var DESCRIPTION = "The canvas node catalog. Start here: `baker canvas catalog` lists every node by category with one line each (a few KB). Then `--node video_generate` prints that node's full JSON Schema \u2014 params, inputs, outputs, models, when to use it. `--category image` narrows the list; add `--full` for that category's schemas. `--full` alone prints every schema (~160 KB) \u2014 prefer `--node`. The unfiltered list also carries `compositions` \u2014 ready-made motion graphics, each with the `dir` to copy next to your canvas.";
35534
+ var DESCRIPTION = "The canvas node catalog. Start here: `baker canvas catalog` lists every node by category with one line each (a few KB). Then `--node video_generate` prints that node's full JSON Schema \u2014 params, inputs, outputs, models, when to use it. `--category image` narrows the list; add `--full` for that category's schemas. `--full` alone prints every schema (~160 KB) \u2014 prefer `--node`.";
35578
35535
  var ARGS = {
35579
35536
  node: {
35580
35537
  type: "string",
@@ -35593,16 +35550,12 @@ var ARGS = {
35593
35550
  description: "Print full JSON Schemas instead of the one-line index (every node, or the --category)."
35594
35551
  }
35595
35552
  };
35596
- async function canvasCatalog(opts) {
35597
- const compositions = await listShippedCompositions(import.meta.dirname);
35598
- return catalogView(generateCatalog(defaultRegistry(), { compositions }), opts);
35599
- }
35600
35553
  registerSchema({ command: "canvas.catalog", description: DESCRIPTION, args: ARGS });
35601
35554
  var catalogCommand = defineCommand108({
35602
35555
  meta: { name: "catalog", description: DESCRIPTION },
35603
35556
  args: ARGS,
35604
35557
  async run({ args: args5 }) {
35605
- const view = await canvasCatalog({
35558
+ const view = catalogView(generateCatalog(defaultRegistry()), {
35606
35559
  node: typeof args5.node === "string" ? args5.node : void 0,
35607
35560
  category: typeof args5.category === "string" ? args5.category : void 0,
35608
35561
  full: args5.full === true
@@ -35615,7 +35568,7 @@ var catalogCommand = defineCommand108({
35615
35568
 
35616
35569
  // src/commands/canvas/critique.ts
35617
35570
  import { readFile as readFile3 } from "fs/promises";
35618
- import path4 from "path";
35571
+ import path3 from "path";
35619
35572
  import { defineCommand as defineCommand109 } from "citty";
35620
35573
 
35621
35574
  // src/engine/scaffold/lib/critique.ts
@@ -35743,7 +35696,7 @@ var critiqueCommand = defineCommand109({
35743
35696
  },
35744
35697
  args: { file: { type: "positional", required: true, description: "Path to canvas JSON" } },
35745
35698
  async run({ args: args5 }) {
35746
- const filePath = path4.resolve(String(args5.file));
35699
+ const filePath = path3.resolve(String(args5.file));
35747
35700
  const raw = await readFile3(filePath, "utf8");
35748
35701
  let parsed;
35749
35702
  try {
@@ -35775,8 +35728,8 @@ var critiqueCommand = defineCommand109({
35775
35728
 
35776
35729
  // src/commands/canvas/inspect.ts
35777
35730
  import { execFile } from "child_process";
35778
- import { readdir as readdir3, readFile as readFile4, stat } from "fs/promises";
35779
- import path5 from "path";
35731
+ import { readdir as readdir2, readFile as readFile4, stat } from "fs/promises";
35732
+ import path4 from "path";
35780
35733
  import { promisify } from "util";
35781
35734
  import { defineCommand as defineCommand110 } from "citty";
35782
35735
  var execFileAsync = promisify(execFile);
@@ -35794,7 +35747,7 @@ var inspectCommand = defineCommand110({
35794
35747
  }
35795
35748
  },
35796
35749
  async run({ args: args5 }) {
35797
- const outputsDir = path5.resolve(String(args5["outputs-dir"] ?? "canvas"));
35750
+ const outputsDir = path4.resolve(String(args5["outputs-dir"] ?? "canvas"));
35798
35751
  const runArg = String(args5.run);
35799
35752
  const runDir = await resolveRunDir(runArg, outputsDir);
35800
35753
  const manifest = await loadManifest(runDir);
@@ -35806,7 +35759,7 @@ var inspectCommand = defineCommand110({
35806
35759
  }
35807
35760
  const summary = {
35808
35761
  ok: true,
35809
- run_id: manifest.run_id ?? path5.basename(runDir),
35762
+ run_id: manifest.run_id ?? path4.basename(runDir),
35810
35763
  run_dir: runDir,
35811
35764
  stats: manifest.stats ?? null,
35812
35765
  output: manifest.output ?? null,
@@ -35819,18 +35772,18 @@ var inspectCommand = defineCommand110({
35819
35772
  }
35820
35773
  });
35821
35774
  async function resolveRunDir(run, outputsDir) {
35822
- if (path5.isAbsolute(run)) {
35775
+ if (path4.isAbsolute(run)) {
35823
35776
  const s2 = await stat(run).catch(() => null);
35824
35777
  if (s2?.isDirectory()) return run;
35825
35778
  throw new Error(`inspect: ${run} is not a directory`);
35826
35779
  }
35827
- const candidate = path5.join(outputsDir, run);
35780
+ const candidate = path4.join(outputsDir, run);
35828
35781
  const s = await stat(candidate).catch(() => null);
35829
35782
  if (s?.isDirectory()) return candidate;
35830
35783
  throw new Error(`inspect: no run directory at ${candidate}`);
35831
35784
  }
35832
35785
  async function loadManifest(runDir) {
35833
- const manifestPath = path5.join(runDir, "manifest.json");
35786
+ const manifestPath = path4.join(runDir, "manifest.json");
35834
35787
  try {
35835
35788
  const raw = await readFile4(manifestPath, "utf-8");
35836
35789
  return JSON.parse(raw);
@@ -35840,9 +35793,9 @@ async function loadManifest(runDir) {
35840
35793
  }
35841
35794
  async function listRunFiles(runDir) {
35842
35795
  const out = [];
35843
- const names = await readdir3(runDir);
35796
+ const names = await readdir2(runDir);
35844
35797
  for (const name of names) {
35845
- const abs = path5.join(runDir, name);
35798
+ const abs = path4.join(runDir, name);
35846
35799
  const s = await stat(abs).catch(() => null);
35847
35800
  if (!s?.isFile()) continue;
35848
35801
  out.push({ name, path: abs, size: s.size });
@@ -35887,58 +35840,58 @@ async function probeDuration(filePath) {
35887
35840
  }
35888
35841
 
35889
35842
  // src/commands/canvas/rerun.ts
35890
- import path18 from "path";
35843
+ import path17 from "path";
35891
35844
  import { defineCommand as defineCommand112 } from "citty";
35892
35845
 
35893
35846
  // src/commands/canvas/run.ts
35894
35847
  import { readFile as readFile12 } from "fs/promises";
35895
- import path17 from "path";
35848
+ import path16 from "path";
35896
35849
  import { defineCommand as defineCommand111 } from "citty";
35897
35850
 
35898
35851
  // src/commands/canvas/normalize-paths.ts
35899
- import { existsSync as existsSync5, realpathSync } from "fs";
35852
+ import { existsSync as existsSync4, realpathSync } from "fs";
35900
35853
  import { writeFile as writeFile2 } from "fs/promises";
35901
- import path6 from "path";
35902
- function findWorkspaceRoot(startDir, exists2 = existsSync5, maxDepth = 12) {
35903
- let dir = path6.resolve(startDir);
35854
+ import path5 from "path";
35855
+ function findWorkspaceRoot(startDir, exists2 = existsSync4, maxDepth = 12) {
35856
+ let dir = path5.resolve(startDir);
35904
35857
  for (let i = 0; i < maxDepth; i++) {
35905
- if (exists2(path6.join(dir, "package.json"))) return dir;
35906
- const parent = path6.dirname(dir);
35858
+ if (exists2(path5.join(dir, "package.json"))) return dir;
35859
+ const parent = path5.dirname(dir);
35907
35860
  if (parent === dir) break;
35908
35861
  dir = parent;
35909
35862
  }
35910
35863
  return null;
35911
35864
  }
35912
35865
  function canonicalize(target) {
35913
- const abs = path6.resolve(target);
35866
+ const abs = path5.resolve(target);
35914
35867
  let dir = abs;
35915
35868
  for (; ; ) {
35916
35869
  try {
35917
35870
  const real = realpathSync(dir);
35918
- return dir === abs ? real : path6.join(real, path6.relative(dir, abs));
35871
+ return dir === abs ? real : path5.join(real, path5.relative(dir, abs));
35919
35872
  } catch {
35920
- const parent = path6.dirname(dir);
35873
+ const parent = path5.dirname(dir);
35921
35874
  if (parent === dir) return abs;
35922
35875
  dir = parent;
35923
35876
  }
35924
35877
  }
35925
35878
  }
35926
35879
  function isInside(root, target) {
35927
- const rel = path6.relative(root, target);
35928
- return rel !== "" && !rel.startsWith("..") && !path6.isAbsolute(rel);
35880
+ const rel = path5.relative(root, target);
35881
+ return rel !== "" && !rel.startsWith("..") && !path5.isAbsolute(rel);
35929
35882
  }
35930
35883
  function toCanvasRelative(canvasDir, target) {
35931
- return path6.relative(canvasDir, target).split(path6.sep).join("/");
35884
+ return path5.relative(canvasDir, target).split(path5.sep).join("/");
35932
35885
  }
35933
35886
  var RUNTIME_WORKSPACE_ROOT = "/home/user/repo";
35934
35887
  function rewriteTarget(value, workspaceRoot) {
35935
35888
  if (typeof value !== "string" || value.length === 0) return null;
35936
- if (value.includes("[TODO") || looksLikeHttpUrl(value) || !path6.isAbsolute(value)) return null;
35889
+ if (value.includes("[TODO") || looksLikeHttpUrl(value) || !path5.isAbsolute(value)) return null;
35937
35890
  const target = canonicalize(value);
35938
35891
  if (isInside(workspaceRoot, target)) return target;
35939
- const fromRuntime = path6.relative(RUNTIME_WORKSPACE_ROOT, path6.normalize(value));
35940
- if (fromRuntime !== "" && !fromRuntime.startsWith("..") && !path6.isAbsolute(fromRuntime)) {
35941
- return path6.join(workspaceRoot, fromRuntime);
35892
+ const fromRuntime = path5.relative(RUNTIME_WORKSPACE_ROOT, path5.normalize(value));
35893
+ if (fromRuntime !== "" && !fromRuntime.startsWith("..") && !path5.isAbsolute(fromRuntime)) {
35894
+ return path5.join(workspaceRoot, fromRuntime);
35942
35895
  }
35943
35896
  return null;
35944
35897
  }
@@ -35966,7 +35919,7 @@ function normalizeAbsoluteCanvasPaths(canvas, canvasDir, workspaceRoot) {
35966
35919
  return rewrites.length === 0 ? { canvas, rewrites } : { canvas: { ...canvas, nodes }, rewrites };
35967
35920
  }
35968
35921
  async function healAbsoluteCanvasPaths(filePath, canvas) {
35969
- const canvasDir = path6.dirname(filePath);
35922
+ const canvasDir = path5.dirname(filePath);
35970
35923
  const workspaceRoot = findWorkspaceRoot(canvasDir);
35971
35924
  if (!workspaceRoot) return { canvas, rewrites: [], text: null };
35972
35925
  const normalized = normalizeAbsoluteCanvasPaths(canvas, canvasDir, workspaceRoot);
@@ -35997,7 +35950,7 @@ function unsuppliedPlaceholderAssets(canvas) {
35997
35950
  }
35998
35951
 
35999
35952
  // src/commands/canvas/resolve-paths.ts
36000
- import path7 from "path";
35953
+ import path6 from "path";
36001
35954
  function resolveRelativeCanvasPaths(canvas, baseDir) {
36002
35955
  if (!canvas || typeof canvas !== "object") return canvas;
36003
35956
  const c = canvas;
@@ -36010,24 +35963,24 @@ function resolveNode(node, baseDir) {
36010
35963
  const params = n.params;
36011
35964
  if (!params || typeof params !== "object") return node;
36012
35965
  if (n.type === "ingest" && params.source === "path" && isResolvableRelative(params.path)) {
36013
- return { ...node, params: { ...params, path: path7.resolve(baseDir, params.path) } };
35966
+ return { ...node, params: { ...params, path: path6.resolve(baseDir, params.path) } };
36014
35967
  }
36015
35968
  if (n.type === "hyperframe_render" && isResolvableRelative(params.composition)) {
36016
- return { ...node, params: { ...params, composition: path7.resolve(baseDir, params.composition) } };
35969
+ return { ...node, params: { ...params, composition: path6.resolve(baseDir, params.composition) } };
36017
35970
  }
36018
35971
  return node;
36019
35972
  }
36020
35973
  function isResolvableRelative(value) {
36021
- return typeof value === "string" && value.length > 0 && !value.includes("[TODO") && !looksLikeHttpUrl(value) && !path7.isAbsolute(value);
35974
+ return typeof value === "string" && value.length > 0 && !value.includes("[TODO") && !looksLikeHttpUrl(value) && !path6.isAbsolute(value);
36022
35975
  }
36023
35976
 
36024
35977
  // src/commands/canvas/source-version.ts
36025
35978
  import { readFile as readFile6 } from "fs/promises";
36026
- import path9 from "path";
35979
+ import path8 from "path";
36027
35980
 
36028
35981
  // src/commands/canvas/scene-files.ts
36029
- import { mkdir as mkdir2, readFile as readFile5, readdir as readdir4, rm, writeFile as writeFile3 } from "fs/promises";
36030
- import path8 from "path";
35982
+ import { mkdir as mkdir2, readFile as readFile5, readdir as readdir3, rm, writeFile as writeFile3 } from "fs/promises";
35983
+ import path7 from "path";
36031
35984
  var SCENES_DIR = "scenes";
36032
35985
  var GLOBAL_PROMPT_FILE = "prompt.json";
36033
35986
  var REBUILD_FILE = "prompt.rebuild.json";
@@ -36044,38 +35997,38 @@ function splitBlueprint(blueprint) {
36044
35997
  }
36045
35998
  async function writeSceneFiles(outDir, blueprint) {
36046
35999
  const { global, scenes } = splitBlueprint(blueprint);
36047
- await writeFile3(path8.join(outDir, GLOBAL_PROMPT_FILE), `${JSON.stringify(global, null, 2)}
36000
+ await writeFile3(path7.join(outDir, GLOBAL_PROMPT_FILE), `${JSON.stringify(global, null, 2)}
36048
36001
  `, "utf8");
36049
- const scenesDir = path8.join(outDir, SCENES_DIR);
36002
+ const scenesDir = path7.join(outDir, SCENES_DIR);
36050
36003
  await mkdir2(scenesDir, { recursive: true });
36051
36004
  const written = /* @__PURE__ */ new Set();
36052
36005
  for (let i = 0; i < scenes.length; i++) {
36053
36006
  const name = sceneFileName(i, scenes.length);
36054
36007
  written.add(name);
36055
- await writeFile3(path8.join(scenesDir, name), `${JSON.stringify(scenes[i], null, 2)}
36008
+ await writeFile3(path7.join(scenesDir, name), `${JSON.stringify(scenes[i], null, 2)}
36056
36009
  `, "utf8");
36057
36010
  }
36058
36011
  for (const name of await listSceneFileNames(scenesDir)) {
36059
- if (!written.has(name)) await rm(path8.join(scenesDir, name), { force: true });
36012
+ if (!written.has(name)) await rm(path7.join(scenesDir, name), { force: true });
36060
36013
  }
36061
36014
  }
36062
36015
  async function listSceneFileNames(scenesDir) {
36063
36016
  let entries;
36064
36017
  try {
36065
- entries = await readdir4(scenesDir);
36018
+ entries = await readdir3(scenesDir);
36066
36019
  } catch {
36067
36020
  return [];
36068
36021
  }
36069
36022
  return entries.filter((n) => /^s\d+\.json$/.test(n)).sort(bySceneIndex);
36070
36023
  }
36071
36024
  async function listSceneFiles(creativeDir) {
36072
- const scenesDir = path8.join(creativeDir, SCENES_DIR);
36073
- return (await listSceneFileNames(scenesDir)).map((n) => path8.join(scenesDir, n));
36025
+ const scenesDir = path7.join(creativeDir, SCENES_DIR);
36026
+ return (await listSceneFileNames(scenesDir)).map((n) => path7.join(scenesDir, n));
36074
36027
  }
36075
36028
  async function reassembleBlueprint(creativeDir) {
36076
36029
  const files = await listSceneFiles(creativeDir);
36077
36030
  if (files.length === 0) return null;
36078
- const globalRaw = await readFile5(path8.join(creativeDir, GLOBAL_PROMPT_FILE), "utf8");
36031
+ const globalRaw = await readFile5(path7.join(creativeDir, GLOBAL_PROMPT_FILE), "utf8");
36079
36032
  const global = JSON.parse(globalRaw);
36080
36033
  const scenes = [];
36081
36034
  for (const file of files) {
@@ -36097,8 +36050,8 @@ async function computeSourceSha(canvasPath) {
36097
36050
  } catch {
36098
36051
  return void 0;
36099
36052
  }
36100
- const canvasDir = path9.dirname(canvasPath);
36101
- const promptPath = path9.join(canvasDir, "prompt.json");
36053
+ const canvasDir = path8.dirname(canvasPath);
36054
+ const promptPath = path8.join(canvasDir, "prompt.json");
36102
36055
  let promptBytes;
36103
36056
  try {
36104
36057
  promptBytes = await readFile6(promptPath);
@@ -36125,7 +36078,7 @@ async function computeSourceSha(canvasPath) {
36125
36078
 
36126
36079
  // src/commands/canvas/scene-projection.ts
36127
36080
  import { readFile as readFile7 } from "fs/promises";
36128
- import path10 from "path";
36081
+ import path9 from "path";
36129
36082
 
36130
36083
  // src/engine/scaffold/video.ts
36131
36084
  import { toCardinal as nwAr } from "n2words/ar-SA";
@@ -39531,12 +39484,12 @@ function nonPromptParamsDiverge(live = {}, rebuilt = {}) {
39531
39484
  return false;
39532
39485
  }
39533
39486
  async function syncSceneNodeParams(canvas, canvasPath, log) {
39534
- const creativeDir = path10.dirname(canvasPath);
39487
+ const creativeDir = path9.dirname(canvasPath);
39535
39488
  const blueprint = await reassembleBlueprint(creativeDir);
39536
39489
  if (!blueprint) return "not_applicable";
39537
39490
  let rebuildRaw;
39538
39491
  try {
39539
- rebuildRaw = await readFile7(path10.join(creativeDir, REBUILD_FILE), "utf8");
39492
+ rebuildRaw = await readFile7(path9.join(creativeDir, REBUILD_FILE), "utf8");
39540
39493
  } catch {
39541
39494
  log(
39542
39495
  `[scenes] this creative has scene files but no ${REBUILD_FILE}, so edits to scenes/*.json are NOT reaching the render \u2014 the prompts inlined in the canvas are what renders. Re-scaffold the creative to restore the link, or edit the canvas node prompts directly.`
@@ -39671,13 +39624,13 @@ ${body}` : header || body || compactJson(record);
39671
39624
  }
39672
39625
 
39673
39626
  // src/commands/canvas/run-record.ts
39674
- import path11 from "path";
39627
+ import path10 from "path";
39675
39628
  var MAX_RUN_NODES = 200;
39676
39629
  var MAX_OUTPUTS_PER_NODE = 10;
39677
39630
  var MAX_FINAL_OUTPUTS = 10;
39678
39631
  var MAX_CREATIVE_SLUG_LENGTH = 100;
39679
39632
  function creativeSlugFromCanvasPath(filePath) {
39680
- const normalized = filePath.split(path11.sep).join("/");
39633
+ const normalized = filePath.split(path10.sep).join("/");
39681
39634
  const match = normalized.match(/(?:^|\/)src\/creatives\/([a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\//);
39682
39635
  const slug = match?.[1] ?? null;
39683
39636
  return slug && slug.length <= MAX_CREATIVE_SLUG_LENGTH ? slug : null;
@@ -39970,24 +39923,24 @@ var RunRecordPoster = class {
39970
39923
 
39971
39924
  // src/commands/canvas/run-retention.ts
39972
39925
  import { rm as rm2 } from "fs/promises";
39973
- import path12 from "path";
39926
+ import path11 from "path";
39974
39927
  function runDirsToPrune(entries, keep, currentRunId) {
39975
39928
  const runs = entries.filter((e) => /^r_[0-9A-Za-z]+$/.test(e) && e !== currentRunId).sort();
39976
39929
  if (keep <= 0) return runs;
39977
39930
  return runs.slice(0, Math.max(0, runs.length - keep));
39978
39931
  }
39979
39932
  async function pruneOldRuns(outputsDir, keep, currentRunId, log) {
39980
- const { readdir: readdir17 } = await import("fs/promises");
39933
+ const { readdir: readdir16 } = await import("fs/promises");
39981
39934
  let entries;
39982
39935
  try {
39983
- entries = await readdir17(outputsDir);
39936
+ entries = await readdir16(outputsDir);
39984
39937
  } catch {
39985
39938
  return;
39986
39939
  }
39987
39940
  const toPrune = runDirsToPrune(entries, keep, currentRunId);
39988
39941
  if (toPrune.length === 0) return;
39989
39942
  for (const dir of toPrune) {
39990
- await rm2(path12.join(outputsDir, dir), { recursive: true, force: true }).catch(
39943
+ await rm2(path11.join(outputsDir, dir), { recursive: true, force: true }).catch(
39991
39944
  (e) => log(`[prune ] could not remove ${dir}: ${e.message}`)
39992
39945
  );
39993
39946
  }
@@ -39995,13 +39948,13 @@ async function pruneOldRuns(outputsDir, keep, currentRunId, log) {
39995
39948
  }
39996
39949
 
39997
39950
  // src/commands/canvas/dirty-marker.ts
39998
- import { mkdir as mkdir3, readdir as readdir5, rm as rm3, writeFile as writeFile5 } from "fs/promises";
39999
- import path13 from "path";
39951
+ import { mkdir as mkdir3, readdir as readdir4, rm as rm3, writeFile as writeFile5 } from "fs/promises";
39952
+ import path12 from "path";
40000
39953
  function creativeDirtyDir(base) {
40001
- return base ?? path13.resolve("canvas", ".dirty");
39954
+ return base ?? path12.resolve("canvas", ".dirty");
40002
39955
  }
40003
39956
  function dirtyMarkerFile(slug, base) {
40004
- return path13.join(creativeDirtyDir(base), `${slug}.json`);
39957
+ return path12.join(creativeDirtyDir(base), `${slug}.json`);
40005
39958
  }
40006
39959
  async function clearCreativeDirty(slug, base) {
40007
39960
  try {
@@ -40012,17 +39965,17 @@ async function clearCreativeDirty(slug, base) {
40012
39965
 
40013
39966
  // src/commands/canvas/run-resume.ts
40014
39967
  import { mkdir as mkdir4, readFile as readFile9, rm as rm4, writeFile as writeFile6 } from "fs/promises";
40015
- import path14 from "path";
39968
+ import path13 from "path";
40016
39969
  function markerKey(canvasPath) {
40017
39970
  const slug = creativeSlugFromCanvasPath(canvasPath);
40018
- const identity = slug ?? path14.relative(process.cwd(), path14.resolve(canvasPath));
39971
+ const identity = slug ?? path13.relative(process.cwd(), path13.resolve(canvasPath));
40019
39972
  return sha256Hex(Buffer.from(identity)).slice(0, 32);
40020
39973
  }
40021
39974
  function legacyMarkerKey(canvasPath) {
40022
- return sha256Hex(Buffer.from(path14.resolve(canvasPath))).slice(0, 32);
39975
+ return sha256Hex(Buffer.from(path13.resolve(canvasPath))).slice(0, 32);
40023
39976
  }
40024
39977
  function markerFile(outputsDir, key) {
40025
- return path14.join(outputsDir, ".inflight", `${key}.json`);
39978
+ return path13.join(outputsDir, ".inflight", `${key}.json`);
40026
39979
  }
40027
39980
  var REMOTE_ADOPT_STALE_MS = 12e4;
40028
39981
  function classifyRemoteRun(run, now) {
@@ -40069,8 +40022,8 @@ async function readMarkerRunId(outputsDir, canvasPath) {
40069
40022
  async function markRunInFlight(outputsDir, canvasPath, runId) {
40070
40023
  try {
40071
40024
  const file = markerFile(outputsDir, markerKey(canvasPath));
40072
- await mkdir4(path14.dirname(file), { recursive: true });
40073
- await writeFile6(file, JSON.stringify({ runId, canvasPath: path14.resolve(canvasPath), startedAt: Date.now() }));
40025
+ await mkdir4(path13.dirname(file), { recursive: true });
40026
+ await writeFile6(file, JSON.stringify({ runId, canvasPath: path13.resolve(canvasPath), startedAt: Date.now() }));
40074
40027
  } catch {
40075
40028
  }
40076
40029
  }
@@ -40084,8 +40037,8 @@ async function clearRunMarker(outputsDir, canvasPath) {
40084
40037
  }
40085
40038
 
40086
40039
  // src/commands/canvas/run-snapshot.ts
40087
- import { mkdir as mkdir5, readdir as readdir6, readFile as readFile10, stat as stat2, writeFile as writeFile7 } from "fs/promises";
40088
- import path15 from "path";
40040
+ import { mkdir as mkdir5, readdir as readdir5, readFile as readFile10, stat as stat2, writeFile as writeFile7 } from "fs/promises";
40041
+ import path14 from "path";
40089
40042
  var SNAPSHOT_SCHEMA = "baker-canvas-snapshot/1";
40090
40043
  var MAX_SNAPSHOT_FILE_BYTES = 32 * 1024 * 1024;
40091
40044
  var EXT_TO_MIME = {
@@ -40112,15 +40065,15 @@ var EXT_TO_MIME = {
40112
40065
  woff2: "font/woff2"
40113
40066
  };
40114
40067
  function mimeForFile(filePath) {
40115
- const ext = path15.extname(filePath).slice(1).toLowerCase();
40068
+ const ext = path14.extname(filePath).slice(1).toLowerCase();
40116
40069
  return EXT_TO_MIME[ext] ?? "application/octet-stream";
40117
40070
  }
40118
40071
  function toPosix(p) {
40119
- return p.split(path15.sep).join("/");
40072
+ return p.split(path14.sep).join("/");
40120
40073
  }
40121
40074
  function isInside2(dir, target) {
40122
- const rel = path15.relative(dir, target);
40123
- return !rel.startsWith("..") && !path15.isAbsolute(rel);
40075
+ const rel = path14.relative(dir, target);
40076
+ return !rel.startsWith("..") && !path14.isAbsolute(rel);
40124
40077
  }
40125
40078
  function localPathRefsFromCanvas(parsed) {
40126
40079
  const nodes = parsed?.nodes;
@@ -40145,24 +40098,24 @@ function isSnapshotablePath(value) {
40145
40098
  async function sourceRefsToSnapshot(canvasDir, parsed) {
40146
40099
  const refs = new Set(localPathRefsFromCanvas(parsed));
40147
40100
  for (const sceneFile of await listSceneFiles(canvasDir)) {
40148
- refs.add(toPosix(path15.relative(canvasDir, sceneFile)));
40101
+ refs.add(toPosix(path14.relative(canvasDir, sceneFile)));
40149
40102
  }
40150
40103
  refs.add(REBUILD_FILE);
40151
40104
  return [...refs];
40152
40105
  }
40153
40106
  async function uploadRunSnapshot(client, opts) {
40154
40107
  try {
40155
- const canvasDir = path15.dirname(opts.canvasPath);
40108
+ const canvasDir = path14.dirname(opts.canvasPath);
40156
40109
  const put = (bytes, mime) => putContentAddressed(client, bytes, mime, opts.signal);
40157
40110
  const canvasBytes = Buffer.from(opts.raw);
40158
40111
  const canvasUpload = await put(canvasBytes, "application/json");
40159
40112
  const files = [];
40160
40113
  const skipped = [];
40161
40114
  for (const refPath of await sourceRefsToSnapshot(canvasDir, opts.parsed)) {
40162
- const abs = path15.isAbsolute(refPath) ? refPath : path15.resolve(canvasDir, refPath);
40115
+ const abs = path14.isAbsolute(refPath) ? refPath : path14.resolve(canvasDir, refPath);
40163
40116
  if (!isInside2(canvasDir, abs)) {
40164
40117
  skipped.push({
40165
- path: toPosix(path15.relative(canvasDir, abs)),
40118
+ path: toPosix(path14.relative(canvasDir, abs)),
40166
40119
  reason: "outside the creative folder \u2014 read from the workspace on rerun"
40167
40120
  });
40168
40121
  continue;
@@ -40171,12 +40124,12 @@ async function uploadRunSnapshot(client, opts) {
40171
40124
  try {
40172
40125
  st = await stat2(abs);
40173
40126
  } catch {
40174
- skipped.push({ path: toPosix(path15.relative(canvasDir, abs)), reason: "missing" });
40127
+ skipped.push({ path: toPosix(path14.relative(canvasDir, abs)), reason: "missing" });
40175
40128
  continue;
40176
40129
  }
40177
40130
  const fileList = st.isDirectory() ? await listFilesRecursive(abs) : [abs];
40178
40131
  for (const file of fileList) {
40179
- const rel = toPosix(path15.relative(canvasDir, file));
40132
+ const rel = toPosix(path14.relative(canvasDir, file));
40180
40133
  const size = (await stat2(file)).size;
40181
40134
  if (size > MAX_SNAPSHOT_FILE_BYTES) {
40182
40135
  skipped.push({ path: rel, reason: `too large (${size} bytes)` });
@@ -40191,7 +40144,7 @@ async function uploadRunSnapshot(client, opts) {
40191
40144
  schema: SNAPSHOT_SCHEMA,
40192
40145
  creativeSlug: opts.creativeSlug,
40193
40146
  canvasSha: canvasUpload.sha256,
40194
- canvas: { path: path15.basename(opts.canvasPath), sha256: canvasUpload.sha256, url: canvasUpload.url },
40147
+ canvas: { path: path14.basename(opts.canvasPath), sha256: canvasUpload.sha256, url: canvasUpload.url },
40195
40148
  files,
40196
40149
  skipped: skipped.length > 0 ? skipped : void 0
40197
40150
  };
@@ -40217,8 +40170,8 @@ async function putContentAddressed(client, bytes, mime, signal) {
40217
40170
  return { sha256, url: publicUrl };
40218
40171
  }
40219
40172
  async function listFilesRecursive(dir) {
40220
- const entries = await readdir6(dir, { recursive: true, withFileTypes: true });
40221
- return entries.filter((d) => d.isFile()).map((d) => path15.join(d.parentPath, d.name));
40173
+ const entries = await readdir5(dir, { recursive: true, withFileTypes: true });
40174
+ return entries.filter((d) => d.isFile()).map((d) => path14.join(d.parentPath, d.name));
40222
40175
  }
40223
40176
  var SnapshotConflictError = class extends Error {
40224
40177
  conflicts;
@@ -40230,16 +40183,16 @@ var SnapshotConflictError = class extends Error {
40230
40183
  };
40231
40184
  async function restoreRunSnapshot(manifest, targetDir, opts = {}) {
40232
40185
  const entries = [manifest.canvas, ...manifest.files];
40233
- const resolvedTarget = path15.resolve(targetDir);
40186
+ const resolvedTarget = path14.resolve(targetDir);
40234
40187
  const planned = [];
40235
40188
  const conflicts = [];
40236
40189
  const upToDate = [];
40237
40190
  for (const entry of entries) {
40238
- if (path15.isAbsolute(entry.path) || entry.path.split("/").includes("..")) {
40191
+ if (path14.isAbsolute(entry.path) || entry.path.split("/").includes("..")) {
40239
40192
  throw new Error(`snapshot entry escapes the creative directory: ${entry.path}`);
40240
40193
  }
40241
- const target = path15.resolve(resolvedTarget, entry.path);
40242
- if (target !== resolvedTarget && !target.startsWith(resolvedTarget + path15.sep)) {
40194
+ const target = path14.resolve(resolvedTarget, entry.path);
40195
+ if (target !== resolvedTarget && !target.startsWith(resolvedTarget + path14.sep)) {
40243
40196
  throw new Error(`snapshot entry escapes the creative directory: ${entry.path}`);
40244
40197
  }
40245
40198
  const existing = await readFile10(target).catch(() => null);
@@ -40264,18 +40217,18 @@ async function restoreRunSnapshot(manifest, targetDir, opts = {}) {
40264
40217
  if (sha256Hex(bytes) !== entry.sha256) {
40265
40218
  throw new Error(`snapshot download for ${entry.path} does not match its recorded sha256`);
40266
40219
  }
40267
- await mkdir5(path15.dirname(target), { recursive: true });
40220
+ await mkdir5(path14.dirname(target), { recursive: true });
40268
40221
  await writeFile7(target, bytes);
40269
40222
  restored.push(entry.path);
40270
40223
  }
40271
- return { canvasPath: path15.resolve(resolvedTarget, manifest.canvas.path), restored, upToDate };
40224
+ return { canvasPath: path14.resolve(resolvedTarget, manifest.canvas.path), restored, upToDate };
40272
40225
  }
40273
40226
 
40274
40227
  // src/engine/nodes/local/lib/render-review.ts
40275
40228
  import { execFile as execFile2 } from "child_process";
40276
- import { mkdtemp, readdir as readdir7, readFile as readFile11, rm as rm5 } from "fs/promises";
40229
+ import { mkdtemp, readdir as readdir6, readFile as readFile11, rm as rm5 } from "fs/promises";
40277
40230
  import { tmpdir } from "os";
40278
- import path16 from "path";
40231
+ import path15 from "path";
40279
40232
  import { promisify as promisify2 } from "util";
40280
40233
  import { z as z39 } from "zod";
40281
40234
  var RENDER_REVIEW_MODEL = "~google/gemini-pro-latest";
@@ -40697,11 +40650,11 @@ async function reviewRenderedVideo(opts) {
40697
40650
  const duration = await videoDuration(opts.video);
40698
40651
  if (duration === null) return null;
40699
40652
  const spent = (usage) => opts.onSpend?.(usage);
40700
- const dir = await mkdtemp(path16.join(tmpdir(), "baker-review-"));
40653
+ const dir = await mkdtemp(path15.join(tmpdir(), "baker-review-"));
40701
40654
  try {
40702
40655
  const grabbed = [];
40703
40656
  for (const [i, at] of reviewFrameTimes(duration, RENDER_REVIEW_FRAMES).entries()) {
40704
- const out = path16.join(dir, `f${String(i).padStart(2, "0")}.jpg`);
40657
+ const out = path15.join(dir, `f${String(i).padStart(2, "0")}.jpg`);
40705
40658
  try {
40706
40659
  await execFileAsync2("ffmpeg", buildFrameGrabArgs(opts.video, at, out), { timeout: 3e4 });
40707
40660
  grabbed.push({ at, image: await readFile11(out, { encoding: "base64" }) });
@@ -40751,7 +40704,7 @@ async function reviewRenderedVideo(opts) {
40751
40704
  }
40752
40705
  }
40753
40706
  async function reviewContextBeside(canvasPath) {
40754
- const raw = await readFile11(path16.join(path16.dirname(canvasPath), "prompt.json"), "utf-8").catch(() => null);
40707
+ const raw = await readFile11(path15.join(path15.dirname(canvasPath), "prompt.json"), "utf-8").catch(() => null);
40755
40708
  if (!raw) return {};
40756
40709
  try {
40757
40710
  const blueprint = JSON.parse(raw);
@@ -40767,12 +40720,12 @@ async function reviewContextBeside(canvasPath) {
40767
40720
  }
40768
40721
  }
40769
40722
  async function sceneWindowsBeside(canvasPath) {
40770
- const dir = path16.join(path16.dirname(canvasPath), "scenes");
40771
- const files = await readdir7(dir).catch(() => null);
40723
+ const dir = path15.join(path15.dirname(canvasPath), "scenes");
40724
+ const files = await readdir6(dir).catch(() => null);
40772
40725
  if (!files) return [];
40773
40726
  const windows = [];
40774
40727
  for (const name of files.filter((f) => f.endsWith(".json")).sort()) {
40775
- const raw = await readFile11(path16.join(dir, name), "utf-8").catch(() => null);
40728
+ const raw = await readFile11(path15.join(dir, name), "utf-8").catch(() => null);
40776
40729
  if (!raw) continue;
40777
40730
  try {
40778
40731
  const scene = JSON.parse(raw);
@@ -40898,7 +40851,7 @@ function stopBeforeKinds(until) {
40898
40851
  return null;
40899
40852
  }
40900
40853
  async function executeCanvasRun(opts) {
40901
- const filePath = path17.resolve(opts.file);
40854
+ const filePath = path16.resolve(opts.file);
40902
40855
  const raw = await readFile12(filePath, "utf8");
40903
40856
  let parsed;
40904
40857
  try {
@@ -40921,7 +40874,7 @@ ${describeRewrites(healed.rewrites)}
40921
40874
  `
40922
40875
  );
40923
40876
  }
40924
- parsed = resolveRelativeCanvasPaths(parsed, path17.dirname(filePath));
40877
+ parsed = resolveRelativeCanvasPaths(parsed, path16.dirname(filePath));
40925
40878
  try {
40926
40879
  await syncStyleProjection(parsed, (line) => process.stderr.write(`${line}
40927
40880
  `));
@@ -41027,7 +40980,7 @@ ${describeRewrites(healed.rewrites)}
41027
40980
  const canvasSha = sha256Hex(Buffer.from(canvasText));
41028
40981
  const creativeSlug = creativeSlugFromCanvasPath(filePath) ?? void 0;
41029
40982
  const client = opts.record === false ? null : buildBackendClient();
41030
- const outputsDir = opts.outputsDir ? path17.resolve(opts.outputsDir) : path17.resolve("canvas");
40983
+ const outputsDir = opts.outputsDir ? path16.resolve(opts.outputsDir) : path16.resolve("canvas");
41031
40984
  const { runId, resumed, source, concurrentRunId } = await resolveRunId({
41032
40985
  explicitRunId: opts.runId,
41033
40986
  fresh: opts.fresh === true,
@@ -41061,7 +41014,7 @@ ${describeRewrites(healed.rewrites)}
41061
41014
  const canvasSnapshotUrl = client && creativeSlug ? await uploadRunSnapshot(client, { canvasPath: filePath, raw: canvasText, creativeSlug, parsed }) ?? void 0 : void 0;
41062
41015
  const recordMeta = {
41063
41016
  creativeSlug,
41064
- canvasPath: path17.relative(process.cwd(), filePath) || void 0,
41017
+ canvasPath: path16.relative(process.cwd(), filePath) || void 0,
41065
41018
  canvasSha,
41066
41019
  // The fingerprint the dashboard compares against the current source to flag
41067
41020
  // "edited since last render". Computed from the on-disk canvas.json +
@@ -41319,7 +41272,7 @@ var rerunCommand = defineCommand112({
41319
41272
  if (latest.canvasSha && manifest.canvasSha !== latest.canvasSha) {
41320
41273
  fail2("snapshot_mismatch", `snapshot manifest for run ${latest.runId} does not match its recorded canvas sha`);
41321
41274
  }
41322
- const targetDir = path18.resolve("src", "creatives", slug);
41275
+ const targetDir = path17.resolve("src", "creatives", slug);
41323
41276
  let restoredCanvasPath;
41324
41277
  try {
41325
41278
  const restore = await restoreRunSnapshot(manifest, targetDir, { force: args5["force-remote"] === true });
@@ -41369,7 +41322,7 @@ async function fetchManifest(url) {
41369
41322
 
41370
41323
  // src/commands/canvas/scaffold-static-ad.ts
41371
41324
  import { access, mkdir as mkdir6, readFile as readFile14, writeFile as writeFile8 } from "fs/promises";
41372
- import path22 from "path";
41325
+ import path21 from "path";
41373
41326
  import { defineCommand as defineCommand114 } from "citty";
41374
41327
 
41375
41328
  // src/engine/scaffold/staticAd.ts
@@ -41657,7 +41610,7 @@ function staticAdReport(input, elementsInput, opts) {
41657
41610
  }
41658
41611
 
41659
41612
  // src/commands/canvas/creative-definition.ts
41660
- import path19 from "path";
41613
+ import path18 from "path";
41661
41614
  var PLATFORM_VALUES = ["meta", "google", "linkedin", "tiktok", "youtube", "x", "other"];
41662
41615
  var FORMAT_VALUES = ["1:1", "4:5", "9:16", "16:9", "1.91:1"];
41663
41616
  function titleFromSlug(slug) {
@@ -41705,16 +41658,16 @@ function buildCreativeDefinition(input) {
41705
41658
  }
41706
41659
 
41707
41660
  // src/commands/canvas/scaffold-static-ad-paths.ts
41708
- import path20 from "path";
41661
+ import path19 from "path";
41709
41662
  function resolveScaffoldStaticAdPaths(rawFile, out, cwd = process.cwd(), slug) {
41710
41663
  const file = rawFile.trim();
41711
41664
  const imageIsUrl = /^https?:\/\//i.test(file);
41712
- const imageSource = imageIsUrl ? file : path20.resolve(cwd, file);
41713
- const outPath = out ? path20.resolve(cwd, out) : slug ? path20.join(cwd, "src", "creatives", slug, `${slug}.canvas.json`) : imageIsUrl ? path20.join(cwd, "static-ad.canvas.json") : path20.join(path20.dirname(imageSource), "static-ad.canvas.json");
41714
- const blueprintPath = path20.join(path20.dirname(outPath), "prompt.json");
41715
- const creativeDir = slug ? path20.dirname(outPath) : null;
41716
- const definitionPath = creativeDir ? path20.join(creativeDir, "_definition.md") : null;
41717
- const referencesDir = creativeDir ? path20.join(creativeDir, "references") : null;
41665
+ const imageSource = imageIsUrl ? file : path19.resolve(cwd, file);
41666
+ const outPath = out ? path19.resolve(cwd, out) : slug ? path19.join(cwd, "src", "creatives", slug, `${slug}.canvas.json`) : imageIsUrl ? path19.join(cwd, "static-ad.canvas.json") : path19.join(path19.dirname(imageSource), "static-ad.canvas.json");
41667
+ const blueprintPath = path19.join(path19.dirname(outPath), "prompt.json");
41668
+ const creativeDir = slug ? path19.dirname(outPath) : null;
41669
+ const definitionPath = creativeDir ? path19.join(creativeDir, "_definition.md") : null;
41670
+ const referencesDir = creativeDir ? path19.join(creativeDir, "references") : null;
41718
41671
  return { imageIsUrl, imageSource, outPath, blueprintPath, creativeDir, definitionPath, referencesDir };
41719
41672
  }
41720
41673
  var SCAFFOLD_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
@@ -41724,8 +41677,8 @@ function isValidScaffoldSlug(slug) {
41724
41677
  }
41725
41678
 
41726
41679
  // src/commands/canvas/sync-definition.ts
41727
- import { readdir as readdir8, readFile as readFile13, stat as stat3 } from "fs/promises";
41728
- import path21 from "path";
41680
+ import { readdir as readdir7, readFile as readFile13, stat as stat3 } from "fs/promises";
41681
+ import path20 from "path";
41729
41682
  import { defineCommand as defineCommand113 } from "citty";
41730
41683
 
41731
41684
  // src/commands/canvas/definition-graph.ts
@@ -41818,26 +41771,26 @@ async function syncCreativeDefinitionBestEffort(input) {
41818
41771
  }
41819
41772
  }
41820
41773
  async function resolveCanvasPath(inputPath) {
41821
- const resolved = path21.resolve(inputPath);
41774
+ const resolved = path20.resolve(inputPath);
41822
41775
  let dir = resolved;
41823
41776
  try {
41824
41777
  if ((await stat3(resolved)).isFile()) {
41825
41778
  if (resolved.endsWith(".canvas.json")) return resolved;
41826
- dir = path21.dirname(resolved);
41779
+ dir = path20.dirname(resolved);
41827
41780
  }
41828
41781
  } catch {
41829
- dir = resolved.endsWith(".canvas.json") ? path21.dirname(resolved) : resolved;
41782
+ dir = resolved.endsWith(".canvas.json") ? path20.dirname(resolved) : resolved;
41830
41783
  }
41831
41784
  let entries;
41832
41785
  try {
41833
- entries = await readdir8(dir);
41786
+ entries = await readdir7(dir);
41834
41787
  } catch {
41835
41788
  return null;
41836
41789
  }
41837
41790
  const canvases = entries.filter((name) => name.endsWith(".canvas.json"));
41838
41791
  const slug = creativeSlugFromCanvasPath(`${dir}/x/`);
41839
41792
  const chosen = (slug ? canvases.find((name) => name === `${slug}.canvas.json`) : void 0) ?? canvases[0];
41840
- return chosen ? path21.join(dir, chosen) : null;
41793
+ return chosen ? path20.join(dir, chosen) : null;
41841
41794
  }
41842
41795
  var syncDefinitionCommand = defineCommand113({
41843
41796
  meta: {
@@ -42118,7 +42071,7 @@ var scaffoldStaticAdCommand = defineCommand114({
42118
42071
  process.cwd(),
42119
42072
  slug
42120
42073
  );
42121
- await mkdir6(path22.dirname(outPath), { recursive: true });
42074
+ await mkdir6(path21.dirname(outPath), { recursive: true });
42122
42075
  const { describeModel, selectModel, layoutModel, genModel } = resolveModels(args5);
42123
42076
  let durableSourceUrl;
42124
42077
  if (referencesDir) {
@@ -42238,7 +42191,7 @@ var scaffoldStaticAdCommand = defineCommand114({
42238
42191
  run_estimated_credits: validation.estimatedCredits
42239
42192
  },
42240
42193
  checklist: {
42241
- edit_prompt: `Edit ${path22.basename(blueprintPath)} \u2014 it is the blueprint generated from your image; rewrite it into the ad you want (palette, copy, claims, subjects). It feeds the generator directly.`,
42194
+ edit_prompt: `Edit ${path21.basename(blueprintPath)} \u2014 it is the blueprint generated from your image; rewrite it into the ad you want (palette, copy, claims, subjects). It feeds the generator directly.`,
42242
42195
  assets_to_supply: report.elements,
42243
42196
  font_slot: report.includes_font ? "Drop a brand font at the [TODO] brandfont path (the describe pass recorded the ad's typefaces under `fonts` in prompt.json \u2014 match those). The font is wired into the render as a TYPE SPECIMEN reference so generated text takes the brand letterforms. Delete the brandfont + type_ref nodes to skip it." : "skipped (--skip-font)",
42244
42197
  actor_sheets: report.actor_sheets.length > 0 ? `Each living hero (${report.actor_sheets.join(", ")}) is fused into a generated multi-view reference sheet (image_reference_sheet) that the render grounds on \u2014 so drop ONE clean photo at that hero's ingest and the sheet builds the consistent turnaround. Pass --skip-actor-sheets to ground on the lone photo instead.` : "none (no person/animal heroes detected, or --skip-actor-sheets)",
@@ -43007,8 +42960,8 @@ function injectAdBrandOverlay(indexHtml, overlayHtml) {
43007
42960
  }
43008
42961
 
43009
42962
  // src/engine/scaffold/ad-brand-source.ts
43010
- import { readdir as readdir9, readFile as readFile15 } from "fs/promises";
43011
- import path23 from "path";
42963
+ import { readdir as readdir8, readFile as readFile15 } from "fs/promises";
42964
+ import path22 from "path";
43012
42965
  import sharp from "sharp";
43013
42966
  var BRAND_DIR = "src/brand";
43014
42967
  function paletteFromBrandDoc(markdown) {
@@ -43060,16 +43013,16 @@ function pickBrandMark(files) {
43060
43013
  }
43061
43014
  async function readBrandFromWorkspace(root = ".") {
43062
43015
  const found = {};
43063
- const doc = await readFile15(path23.join(root, BRAND_DIR, "BRAND.md"), "utf-8").catch(() => null);
43016
+ const doc = await readFile15(path22.join(root, BRAND_DIR, "BRAND.md"), "utf-8").catch(() => null);
43064
43017
  if (doc) {
43065
43018
  const palette = paletteFromBrandDoc(doc);
43066
43019
  if (palette.length > 0) found.palette = palette;
43067
43020
  }
43068
- const dir = path23.join(root, BRAND_DIR, "logos");
43069
- const files = await readdir9(dir).catch(() => null);
43021
+ const dir = path22.join(root, BRAND_DIR, "logos");
43022
+ const files = await readdir8(dir).catch(() => null);
43070
43023
  if (files) {
43071
43024
  const mark = pickBrandMark(files);
43072
- if (mark) found.logo = path23.join(BRAND_DIR, "logos", mark);
43025
+ if (mark) found.logo = path22.join(BRAND_DIR, "logos", mark);
43073
43026
  }
43074
43027
  return found;
43075
43028
  }
@@ -43079,20 +43032,20 @@ function svgIsLiveText(svg) {
43079
43032
  async function markIsReal(markPath, root = ".") {
43080
43033
  const brandLogos = await findBrandLogosDir(markPath, root);
43081
43034
  if (brandLogos) return await markDirectoryIsReal(brandLogos);
43082
- return await markDirectoryIsReal(path23.dirname(markPath));
43035
+ return await markDirectoryIsReal(path22.dirname(markPath));
43083
43036
  }
43084
43037
  async function findBrandLogosDir(markPath, root) {
43085
43038
  const candidates = [];
43086
- let dir = path23.resolve(path23.dirname(markPath));
43039
+ let dir = path22.resolve(path22.dirname(markPath));
43087
43040
  for (; ; ) {
43088
- candidates.push(path23.join(dir, BRAND_DIR, "logos"));
43089
- const parent = path23.dirname(dir);
43041
+ candidates.push(path22.join(dir, BRAND_DIR, "logos"));
43042
+ const parent = path22.dirname(dir);
43090
43043
  if (parent === dir) break;
43091
43044
  dir = parent;
43092
43045
  }
43093
- candidates.push(path23.join(root, BRAND_DIR, "logos"));
43046
+ candidates.push(path22.join(root, BRAND_DIR, "logos"));
43094
43047
  for (const candidate of candidates) {
43095
- if (await readdir9(candidate).then(
43048
+ if (await readdir8(candidate).then(
43096
43049
  () => true,
43097
43050
  () => false
43098
43051
  ))
@@ -43101,12 +43054,12 @@ async function findBrandLogosDir(markPath, root) {
43101
43054
  return null;
43102
43055
  }
43103
43056
  async function markDirectoryIsReal(dir) {
43104
- const files = await readdir9(dir).catch(() => null);
43057
+ const files = await readdir8(dir).catch(() => null);
43105
43058
  if (!files) return false;
43106
43059
  const marks = files.filter((f) => /\.(svg|png|webp)$/i.test(f));
43107
43060
  if (marks.length === 0) return false;
43108
43061
  for (const f of marks.filter((f2) => /\.svg$/i.test(f2))) {
43109
- const svg = await readFile15(path23.join(dir, f), "utf-8").catch(() => null);
43062
+ const svg = await readFile15(path22.join(dir, f), "utf-8").catch(() => null);
43110
43063
  if (svg === null || svgIsLiveText(svg)) return false;
43111
43064
  }
43112
43065
  return true;
@@ -43133,6 +43086,22 @@ async function markInkIsLight(markPath) {
43133
43086
  }
43134
43087
  }
43135
43088
 
43089
+ // src/commands/canvas/composition-path.ts
43090
+ import { existsSync as existsSync5 } from "fs";
43091
+ import path23 from "path";
43092
+ function resolveShippedCanvasDir(name, startDir, exists2 = existsSync5, maxDepth = 8) {
43093
+ const rel = path23.join("canvas", name);
43094
+ let dir = startDir;
43095
+ for (let i = 0; i < maxDepth; i++) {
43096
+ const candidate = path23.join(dir, rel);
43097
+ if (exists2(path23.join(candidate, "meta.json"))) return candidate;
43098
+ const parent = path23.dirname(dir);
43099
+ if (parent === dir) break;
43100
+ dir = parent;
43101
+ }
43102
+ return path23.resolve(startDir, "../../../", rel);
43103
+ }
43104
+
43136
43105
  // src/commands/canvas/scaffold-ad.ts
43137
43106
  function pinnedOnAvatar(handle, model) {
43138
43107
  const hint = pinnedModelHint({ avatar: handle ?? void 0, model, generateAudio: true });
@@ -43683,7 +43652,7 @@ function routeVideoModel(input) {
43683
43652
 
43684
43653
  // src/engine/nodes/local/lib/sceneDetect.ts
43685
43654
  import { execFile as execFile3 } from "child_process";
43686
- import { mkdtemp as mkdtemp2, readdir as readdir10, readFile as readFile17, rm as rm6 } from "fs/promises";
43655
+ import { mkdtemp as mkdtemp2, readdir as readdir9, readFile as readFile17, rm as rm6 } from "fs/promises";
43687
43656
  import { tmpdir as tmpdir2 } from "os";
43688
43657
  import { join as join3 } from "path";
43689
43658
  import { promisify as promisify3 } from "util";
@@ -43757,7 +43726,7 @@ async function runSceneDetectOnce(filePath, threshold, minSceneLenS, timeoutMs)
43757
43726
  ],
43758
43727
  { encoding: "utf-8", maxBuffer: 32 * 1024 * 1024, timeout: timeoutMs }
43759
43728
  );
43760
- const csvName = (await readdir10(outDir)).find((f) => f.toLowerCase().endsWith(".csv"));
43729
+ const csvName = (await readdir9(outDir)).find((f) => f.toLowerCase().endsWith(".csv"));
43761
43730
  if (!csvName) return [];
43762
43731
  return parsePySceneDetectCsvCuts(await readFile17(join3(outDir, csvName), "utf-8"));
43763
43732
  } finally {
@@ -45159,11 +45128,11 @@ Full guide: __tooling__/docs/tools/baker/creatives.md`
45159
45128
  import { defineCommand as defineCommand124 } from "citty";
45160
45129
 
45161
45130
  // src/commands/experiment/composition.ts
45162
- import { readdir as readdir12, readFile as readFile24 } from "fs/promises";
45131
+ import { readdir as readdir11, readFile as readFile24 } from "fs/promises";
45163
45132
  import path30 from "path";
45164
45133
 
45165
45134
  // src/commands/landing/import-graph.ts
45166
- import { readdir as readdir11, readFile as readFile23, stat as stat5 } from "fs/promises";
45135
+ import { readdir as readdir10, readFile as readFile23, stat as stat5 } from "fs/promises";
45167
45136
  import path29 from "path";
45168
45137
  var SOURCE_EXT = /\.(astro|ts|tsx|js|jsx|mjs|cjs|vue|svelte)$/;
45169
45138
  var RESOLVE_CANDIDATES = [
@@ -45191,7 +45160,7 @@ async function isFile(p) {
45191
45160
  async function walkFiles(dir) {
45192
45161
  let entries;
45193
45162
  try {
45194
- entries = await readdir11(dir, { withFileTypes: true });
45163
+ entries = await readdir10(dir, { withFileTypes: true });
45195
45164
  } catch {
45196
45165
  return [];
45197
45166
  }
@@ -45294,7 +45263,7 @@ function formsOnlyIn(these, those) {
45294
45263
  }
45295
45264
  async function knownFlows(root) {
45296
45265
  try {
45297
- const entries = await readdir12(path30.join(root, "src/lib/flow-engine/flows"), { withFileTypes: true });
45266
+ const entries = await readdir11(path30.join(root, "src/lib/flow-engine/flows"), { withFileTypes: true });
45298
45267
  return new Set(entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name));
45299
45268
  } catch {
45300
45269
  return /* @__PURE__ */ new Set();
@@ -45315,7 +45284,7 @@ async function readForms(root, slug) {
45315
45284
 
45316
45285
  // src/commands/experiment/fold.ts
45317
45286
  import { statSync } from "fs";
45318
- import { cp as cp3, mkdir as mkdir9, readdir as readdir13, readFile as readFile25, rm as rm8, stat as stat6, writeFile as writeFile12 } from "fs/promises";
45287
+ import { cp as cp3, mkdir as mkdir9, readdir as readdir12, readFile as readFile25, rm as rm8, stat as stat6, writeFile as writeFile12 } from "fs/promises";
45319
45288
  import path32 from "path";
45320
45289
 
45321
45290
  // ../api/src/experiments/variants.ts
@@ -45390,7 +45359,7 @@ async function isDir(p) {
45390
45359
  async function filesUnder(dir, prefix = "") {
45391
45360
  let entries;
45392
45361
  try {
45393
- entries = await readdir13(dir, { withFileTypes: true });
45362
+ entries = await readdir12(dir, { withFileTypes: true });
45394
45363
  } catch {
45395
45364
  return [];
45396
45365
  }
@@ -55754,7 +55723,7 @@ Full guide: __tooling__/docs/tools/baker/images.md`
55754
55723
  import { defineCommand as defineCommand182 } from "citty";
55755
55724
 
55756
55725
  // src/commands/landing/critique.ts
55757
- import { readdir as readdir15, readFile as readFile30, stat as stat9 } from "fs/promises";
55726
+ import { readdir as readdir14, readFile as readFile30, stat as stat9 } from "fs/promises";
55758
55727
  import path37 from "path";
55759
55728
  import { defineCommand as defineCommand171 } from "citty";
55760
55729
 
@@ -56965,7 +56934,7 @@ async function writeCritiqueSnapshot(projectRoot, snapshot) {
56965
56934
  }
56966
56935
 
56967
56936
  // src/commands/landing/source-version.ts
56968
- import { readdir as readdir14, readFile as readFile29, stat as stat8 } from "fs/promises";
56937
+ import { readdir as readdir13, readFile as readFile29, stat as stat8 } from "fs/promises";
56969
56938
  import path36 from "path";
56970
56939
  var CRITIQUED_ROOTS = ["src/pages/", "src/components/"];
56971
56940
  async function landingSourceRelPaths(root, slug) {
@@ -57021,7 +56990,7 @@ async function isFile2(p) {
57021
56990
  async function walkAstro(dir) {
57022
56991
  let entries;
57023
56992
  try {
57024
- entries = await readdir14(dir, { withFileTypes: true });
56993
+ entries = await readdir13(dir, { withFileTypes: true });
57025
56994
  } catch {
57026
56995
  return [];
57027
56996
  }
@@ -57154,7 +57123,7 @@ async function readCompetitorNames(projectRoot) {
57154
57123
  const dir = path37.join(projectRoot, "src", "content", "competitors");
57155
57124
  let entries;
57156
57125
  try {
57157
- entries = (await readdir15(dir)).filter((f) => f.endsWith(".md"));
57126
+ entries = (await readdir14(dir)).filter((f) => f.endsWith(".md"));
57158
57127
  } catch {
57159
57128
  return [];
57160
57129
  }
@@ -57172,7 +57141,7 @@ async function readCompetitorNames(projectRoot) {
57172
57141
  }
57173
57142
  async function listLandingSlugs(projectRoot) {
57174
57143
  try {
57175
- const entries = await readdir15(path37.join(projectRoot, "src", "pages"), { withFileTypes: true });
57144
+ const entries = await readdir14(path37.join(projectRoot, "src", "pages"), { withFileTypes: true });
57176
57145
  return entries.filter((e) => e.isDirectory() && !e.name.startsWith("_") && !e.name.startsWith(".")).map((e) => e.name).sort();
57177
57146
  } catch {
57178
57147
  return [];
@@ -60365,7 +60334,7 @@ Full guide: __tooling__/docs/tools/baker/landing.md`
60365
60334
 
60366
60335
  // src/commands/landing/variant.ts
60367
60336
  import { randomUUID as randomUUID2 } from "crypto";
60368
- import { mkdir as mkdir14, readdir as readdir16, readFile as readFile31, stat as stat10, writeFile as writeFile19 } from "fs/promises";
60337
+ import { mkdir as mkdir14, readdir as readdir15, readFile as readFile31, stat as stat10, writeFile as writeFile19 } from "fs/promises";
60369
60338
  import path45 from "path";
60370
60339
  import { defineCommand as defineCommand181 } from "citty";
60371
60340
  registerSchema({
@@ -60402,7 +60371,7 @@ async function readInternalId(definitionPath) {
60402
60371
  async function archivedVariantNumbers(root, internalId) {
60403
60372
  if (!internalId) return [];
60404
60373
  try {
60405
- const entries = await readdir16(path45.resolve(root, "src/_variants", internalId), { withFileTypes: true });
60374
+ const entries = await readdir15(path45.resolve(root, "src/_variants", internalId), { withFileTypes: true });
60406
60375
  return entries.filter((entry) => entry.isDirectory()).map((entry) => Number(entry.name)).filter((n) => Number.isInteger(n) && n > 0);
60407
60376
  } catch {
60408
60377
  return [];
@@ -60432,7 +60401,7 @@ async function exists(p) {
60432
60401
  }
60433
60402
  async function listLandingSlugs2(root) {
60434
60403
  try {
60435
- const entries = await readdir16(path45.resolve(root, "src", "pages"), { withFileTypes: true });
60404
+ const entries = await readdir15(path45.resolve(root, "src", "pages"), { withFileTypes: true });
60436
60405
  return entries.filter((e) => e.isDirectory() && !e.name.startsWith("_") && !e.name.startsWith(".")).map((e) => e.name).sort();
60437
60406
  } catch {
60438
60407
  return [];
@@ -60441,7 +60410,7 @@ async function listLandingSlugs2(root) {
60441
60410
  async function listComponents(componentsDir, prefix = "") {
60442
60411
  let entries;
60443
60412
  try {
60444
- entries = await readdir16(componentsDir, { withFileTypes: true });
60413
+ entries = await readdir15(componentsDir, { withFileTypes: true });
60445
60414
  } catch {
60446
60415
  return [];
60447
60416
  }