@koda-sl/baker-cli 0.444.0-dev.cac1750ec → 0.445.0-dev.71ff4e44a

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
@@ -69,6 +69,7 @@ import {
69
69
  ValidationError,
70
70
  VideoBlueprintSchema,
71
71
  YtDlpError,
72
+ adSpecErrorText,
72
73
  adSpecFromBlueprint,
73
74
  adSpecJsonSchema,
74
75
  adaptBrief,
@@ -171,6 +172,7 @@ import {
171
172
  samePictureSizes,
172
173
  sanitizeId,
173
174
  sceneWindowsBeside,
175
+ sceneWordProblems,
174
176
  sha256Hex,
175
177
  shapeListRows,
176
178
  specimenText,
@@ -198,7 +200,7 @@ import {
198
200
  withoutCastName,
199
201
  wordCount,
200
202
  ytDlpBlockSignal
201
- } from "./chunk-GY352NRN.js";
203
+ } from "./chunk-CYZ7H4F5.js";
202
204
  import {
203
205
  NAME_CONTAINS_ARG,
204
206
  csvOrJson,
@@ -71038,7 +71040,7 @@ function toPosix(p) {
71038
71040
  }
71039
71041
 
71040
71042
  // src/commands/creatives/ideas-model.ts
71041
- import { parse as parseYaml2 } from "yaml";
71043
+ import { parse as parseYaml2, YAMLParseError } from "yaml";
71042
71044
  var IDEA_ANGLES = [
71043
71045
  "pain_relief",
71044
71046
  "aspiration",
@@ -71087,6 +71089,18 @@ function frontmatterOf(markdown) {
71087
71089
  return null;
71088
71090
  }
71089
71091
  }
71092
+ function frontmatterError(markdown) {
71093
+ const block2 = FRONTMATTER.exec(markdown)?.[1];
71094
+ if (block2 === void 0) return null;
71095
+ try {
71096
+ parseYaml2(block2);
71097
+ return null;
71098
+ } catch (e) {
71099
+ const line = e instanceof YAMLParseError ? e.linePos?.[0]?.line : void 0;
71100
+ const at = line ? ` at line ${line} (\`${block2.split(/\r?\n/)[line - 1]?.trim() ?? ""}\`)` : "";
71101
+ return `the frontmatter is not valid YAML${at}: put each text value wholly in double quotes, with any quote inside it as \\" or as single quotes`;
71102
+ }
71103
+ }
71090
71104
  function text2(value2) {
71091
71105
  if (typeof value2 === "string") return value2.trim() || void 0;
71092
71106
  if (typeof value2 === "number") return String(value2);
@@ -71141,6 +71155,8 @@ function fieldProblems(f) {
71141
71155
  return problems;
71142
71156
  }
71143
71157
  function parseIdea(id, markdown) {
71158
+ const unparsable = frontmatterError(markdown);
71159
+ if (unparsable) return { problems: [unparsable] };
71144
71160
  const fm = frontmatterOf(markdown) ?? {};
71145
71161
  const f = {
71146
71162
  who: text2(fm.who),
@@ -71714,6 +71730,14 @@ async function staticSpecGate(canvas, canvasDir) {
71714
71730
  fix: "Write the ad in prompt.json: the scene the viewer sees and each line of copy as it prints. Then re-run."
71715
71731
  };
71716
71732
  }
71733
+ const sceneWords = spec.native ? [] : sceneWordProblems(spec);
71734
+ if (sceneWords.length > 0) {
71735
+ return {
71736
+ code: "scene_words_not_in_copy",
71737
+ problems: sceneWords,
71738
+ fix: "Edit prompt.json: every word or figure the picture shows is a `copy` line (`in_scene`, with `on`); describe any other surface without words. Then re-run."
71739
+ };
71740
+ }
71717
71741
  const concept = conceptProblems(spec);
71718
71742
  if (concept.length > 0) {
71719
71743
  return {
@@ -71809,7 +71833,8 @@ async function prepareCanvas(canvasPath, opts = {}) {
71809
71833
  staticCopy = native === "not_applicable" ? await syncStaticAdBrief(canvas, log) : native;
71810
71834
  if (logo === "regenerated" || pictures === "regenerated") staticCopy = "regenerated";
71811
71835
  } catch (e) {
71812
- throw new CanvasPrepareError("style_projection", `prompt.json is not readable or not a valid ad: ${errorMessage(e)}`, {
71836
+ throw new CanvasPrepareError("style_projection", `prompt.json is not readable or not a valid ad:
71837
+ ${adSpecErrorText(e)}`, {
71813
71838
  fix: `Fix ${path14.join(canvasDir, "prompt.json")} so it parses as JSON (and, for a static ad, matches the ad spec the message names), then re-run.`
71814
71839
  });
71815
71840
  }
@@ -74322,7 +74347,8 @@ function viewerCheckFailure(outcome2, slug) {
74322
74347
  ...outcome2.verdict.missed.map(missLine),
74323
74348
  ...missing ? [`They needed: ${missing}`] : [],
74324
74349
  "Rewrite the copy in prompt.json so the words on the ad say it plainly (name the offer and who it is for; a stranger reads only what is printed), then re-run.",
74325
- `Check new copy before rendering with \`baker canvas viewer-check ${slug}\`.`,
74350
+ // The run asks the viewer itself, from the same cache: a separate check is one more wait (dev, Oct 2026).
74351
+ `Then run the same \`baker canvas run\` again: it checks the new copy before it spends (or \`baker canvas viewer-check ${slug}\` alone).`,
74326
74352
  "If this ad will run to people who already know the brand, record that viewer in _definition.md (`targetAdSet` and `viewer`, from `baker ads meta adsets --audience`) instead of rewriting."
74327
74353
  ].join(" ");
74328
74354
  return {
@@ -81054,7 +81080,7 @@ function ideasHints(report) {
81054
81080
  if (next.length === 1) hints2.push(`Build: \`baker creatives make ${next[0]}\`.`);
81055
81081
  if (next.length > 1)
81056
81082
  hints2.push(
81057
- `Build ${next.join(", ")} at once: one \`creative-producer\` per idea, all spawned in one message in the background, each given its idea id, and handle each as it returns. Never build them one after another: each render takes minutes.`
81083
+ `Build ${next.join(", ")} at once: one \`creative-producer\` per idea, all spawned in one message in the background, each given its idea id, and handle each as it returns. Never build them one after another: each render takes minutes. Edited an idea after this check? Run \`baker creatives ideas\` again first: a producer cannot build an idea with a problem.`
81058
81084
  );
81059
81085
  return hints2;
81060
81086
  }