@koda-sl/baker-cli 0.380.0 → 0.382.0-dev.a410b0488

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
@@ -70,7 +70,7 @@ import {
70
70
  validateCanvasDeep,
71
71
  withoutCastName,
72
72
  ytDlpBlockSignal
73
- } from "./chunk-FGHMWBUD.js";
73
+ } from "./chunk-CHJOTJTZ.js";
74
74
  import {
75
75
  NAME_CONTAINS_ARG,
76
76
  csvOrJson,
@@ -12127,6 +12127,24 @@ function adCopyHints(payload) {
12127
12127
  return tells.slice(0, MAX_HINTS).map(hintFor);
12128
12128
  }
12129
12129
 
12130
+ // src/commands/ads/hints.ts
12131
+ function backendHints(envelope) {
12132
+ const hints2 = envelope.hints;
12133
+ return Array.isArray(hints2) ? hints2.filter((hint) => typeof hint === "string") : [];
12134
+ }
12135
+ function withHints(envelope, extra) {
12136
+ const hints2 = [...backendHints(envelope), ...extra];
12137
+ return hints2.length > 0 ? { ...envelope, hints: hints2 } : envelope;
12138
+ }
12139
+ function hintLines(envelope) {
12140
+ return backendHints(envelope).map((hint) => `
12141
+ > ${hint}`).join("");
12142
+ }
12143
+ function splitHints(response) {
12144
+ const { hints: hints2, ...data } = response;
12145
+ return { data, hints: hints2 ?? [] };
12146
+ }
12147
+
12130
12148
  // src/commands/ads/google/copy-list-usage.ts
12131
12149
  var AD_COPY_LIST_USAGE = `repeat the flag once per item, or pass one comma-separated list and wrap an item that contains a comma in double quotes: '"Fast, free quotes",Book today'. A flag given once is read as a list, so a lone item with a comma needs its double quotes too: '"Fast, free quotes"'`;
12132
12150
  var COPY_LIST_FLAG = {
@@ -12491,7 +12509,7 @@ async function stageGoogleOp(raw, hints2) {
12491
12509
  const chatId = requireChatId();
12492
12510
  const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
12493
12511
  const allHints = [...noopHints(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
12494
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
12512
+ writeJsonEnvelope(withHints(response, allHints));
12495
12513
  } catch (err) {
12496
12514
  handleGoogleError(err);
12497
12515
  }
@@ -12529,7 +12547,7 @@ async function stageGoogleOps(rawOps, hints2) {
12529
12547
  const chatId = requireChatId();
12530
12548
  const response = await apiPost("/api/ads/google/draft/stage-batch", { chatId, ops });
12531
12549
  const allHints = [...skippedHints(response.data.skipped ?? [], ops.length), ...hints2 ?? [], ...adCopyHints(ops)];
12532
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
12550
+ writeJsonEnvelope(withHints(response, allHints));
12533
12551
  } catch (err) {
12534
12552
  handleGoogleError(err);
12535
12553
  }
@@ -12557,7 +12575,7 @@ async function draftListAction(json, chat) {
12557
12575
  writeJsonEnvelope(response);
12558
12576
  return;
12559
12577
  }
12560
- process.stdout.write(`${renderDraftStatus(response.data)}
12578
+ process.stdout.write(`${renderDraftStatus(response.data)}${hintLines(response)}
12561
12579
  `);
12562
12580
  } catch (err) {
12563
12581
  handleGoogleError(err);
@@ -20432,7 +20450,7 @@ async function stageOp(raw, hints2) {
20432
20450
  op: preflight.data
20433
20451
  });
20434
20452
  const allHints = [...batchNudge(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
20435
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
20453
+ writeJsonEnvelope(withHints(response, allHints));
20436
20454
  } catch (err) {
20437
20455
  handleLinkedinError(err);
20438
20456
  }
@@ -20459,7 +20477,7 @@ async function stageLinkedinOps(rawOps, hints2) {
20459
20477
  const chatId = requireChatId();
20460
20478
  const response = await apiPost("/api/ads/linkedin/draft/stage-batch", { chatId, ops });
20461
20479
  const allHints = [...hints2 ?? [], ...adCopyHints(ops)];
20462
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
20480
+ writeJsonEnvelope(withHints(response, allHints));
20463
20481
  } catch (err) {
20464
20482
  handleLinkedinError(err);
20465
20483
  }
@@ -23731,7 +23749,7 @@ async function listDraft(json, chat) {
23731
23749
  writeJsonEnvelope(response);
23732
23750
  return;
23733
23751
  }
23734
- process.stdout.write(`${renderDraftStatus2(response.data)}
23752
+ process.stdout.write(`${renderDraftStatus2(response.data)}${hintLines(response)}
23735
23753
  `);
23736
23754
  } catch (err) {
23737
23755
  handleLinkedinError(err);
@@ -26436,7 +26454,7 @@ async function stageOp2(raw) {
26436
26454
  const chatId = requireChatId();
26437
26455
  const response = await apiPost("/api/ads/meta/draft/stage", { chatId, op: preflight.data });
26438
26456
  const copyHints = adCopyHints(preflight.data);
26439
- writeJsonEnvelope(copyHints.length > 0 ? { ...response, hints: copyHints } : response);
26457
+ writeJsonEnvelope(withHints(response, copyHints));
26440
26458
  } catch (err) {
26441
26459
  handleMetaError(err);
26442
26460
  }
@@ -27709,7 +27727,7 @@ async function listDraft2(json, chat) {
27709
27727
  writeJsonEnvelope(response);
27710
27728
  return;
27711
27729
  }
27712
- process.stdout.write(`${renderDraftStatus3(response.data)}
27730
+ process.stdout.write(`${renderDraftStatus3(response.data)}${hintLines(response)}
27713
27731
  `);
27714
27732
  } catch (err) {
27715
27733
  handleMetaError(err);
@@ -42003,6 +42021,12 @@ async function restoreRunSnapshot(manifest, targetDir, opts = {}) {
42003
42021
  return { canvasPath: path14.resolve(resolvedTarget, manifest.canvas.path), restored, upToDate };
42004
42022
  }
42005
42023
 
42024
+ // src/commands/canvas/unchanged-run.ts
42025
+ function unchangedRunHint(runId, stats) {
42026
+ if (stats.total_nodes === 0 || stats.cached_nodes < stats.total_nodes) return null;
42027
+ return `Nothing changed since the last render: every step came from the cache, so this run is no new version. To read what a render produced, use \`baker canvas inspect ${runId}\` instead of re-running; re-run a canvas only after editing it or the files it reads.`;
42028
+ }
42029
+
42006
42030
  // src/engine/nodes/local/lib/render-review.ts
42007
42031
  import { execFile as execFile2 } from "child_process";
42008
42032
  import { mkdtemp, readdir as readdir6, readFile as readFile11, rm as rm5 } from "fs/promises";
@@ -42886,6 +42910,8 @@ ${describeRewrites(healed.rewrites)}
42886
42910
  `Anything about the mark or the closing card is a composition fix, not a re-render: both are drawn as HTML by the caption composition, so editing it and re-running re-renders only that pass \u2014 the clips are cached and no generation is paid for again. Fix them, then re-run: edit the \`show\` of the scene files named above \u2014 a shot with a person handling equipment is where limbs and objects go wrong, so widen it, move the hands out of frame, or drop the person from that beat. Re-running re-renders only the scenes you edited; everything else comes from the cache (this run: ${result.stats?.cached_nodes ?? 0} of ${result.stats?.total_nodes ?? 0} nodes were cached).`
42887
42911
  ] : []
42888
42912
  ] : [];
42913
+ const unchanged = result.stats ? unchangedRunHint(result.run_id, result.stats) : null;
42914
+ if (unchanged) hints2.push(unchanged);
42889
42915
  if (poster) {
42890
42916
  await poster.flush(
42891
42917
  // `review` is null only when nobody looked (no key, no ffmpeg, unreadable video);
@@ -51625,11 +51651,11 @@ var WARNING_HINT = "Read the warnings above before telling the user this is read
51625
51651
  async function stageOp3(op) {
51626
51652
  const chatId = requireChatId();
51627
51653
  try {
51628
- const data = await apiPost("/api/ga4/draft/stage", { chatId, op });
51654
+ const { data, hints: hints2 } = splitHints(await apiPost("/api/ga4/draft/stage", { chatId, op }));
51629
51655
  writeJsonEnvelope({
51630
51656
  ok: true,
51631
51657
  data,
51632
- hints: [...STAGE_HINTS, ...data.warnings.length > 0 ? [WARNING_HINT] : []]
51658
+ hints: [...hints2, ...STAGE_HINTS, ...data.warnings.length > 0 ? [WARNING_HINT] : []]
51633
51659
  });
51634
51660
  } catch (err) {
51635
51661
  handleError5(err);
@@ -51643,11 +51669,13 @@ async function stageOps(ops) {
51643
51669
  }
51644
51670
  const chatId = requireChatId();
51645
51671
  try {
51646
- const data = await apiPost("/api/ga4/draft/stage-batch", { chatId, ops });
51672
+ const { data, hints: hints2 } = splitHints(
51673
+ await apiPost("/api/ga4/draft/stage-batch", { chatId, ops })
51674
+ );
51647
51675
  writeJsonEnvelope({
51648
51676
  ok: true,
51649
51677
  data,
51650
- hints: [...STAGE_HINTS, ...data.ops.some((op) => op.warnings.length > 0) ? [WARNING_HINT] : []]
51678
+ hints: [...hints2, ...STAGE_HINTS, ...data.ops.some((op) => op.warnings.length > 0) ? [WARNING_HINT] : []]
51651
51679
  });
51652
51680
  } catch (err) {
51653
51681
  handleError5(err);
@@ -51656,8 +51684,8 @@ async function stageOps(ops) {
51656
51684
  async function draftAction2(path48, body, chat) {
51657
51685
  const chatId = resolveChatId(chat);
51658
51686
  try {
51659
- const data = await apiPost(path48, { chatId, ...body });
51660
- writeJsonEnvelope({ ok: true, data });
51687
+ const { data, hints: hints2 } = splitHints(await apiPost(path48, { chatId, ...body }));
51688
+ writeJsonEnvelope({ ok: true, data, ...hints2.length > 0 ? { hints: hints2 } : {} });
51661
51689
  return data;
51662
51690
  } catch (err) {
51663
51691
  handleError5(err);
@@ -51689,12 +51717,13 @@ function renderDraft(response) {
51689
51717
  async function draftList(json, chat) {
51690
51718
  const chatId = resolveChatId(chat);
51691
51719
  try {
51692
- const data = await apiPost("/api/ga4/draft", { chatId });
51720
+ const response = await apiPost("/api/ga4/draft", { chatId });
51721
+ const { data, hints: hints2 } = splitHints(response);
51693
51722
  if (json) {
51694
- writeJsonEnvelope({ ok: true, data });
51723
+ writeJsonEnvelope({ ok: true, data, ...hints2.length > 0 ? { hints: hints2 } : {} });
51695
51724
  return;
51696
51725
  }
51697
- process.stdout.write(`${renderDraft(data)}
51726
+ process.stdout.write(`${renderDraft(data)}${hintLines(response)}
51698
51727
  `);
51699
51728
  } catch (err) {
51700
51729
  handleError5(err);
@@ -66784,8 +66813,10 @@ var STAGE_HINTS2 = [
66784
66813
  async function stageOp4(op) {
66785
66814
  const chatId = requireChatId();
66786
66815
  try {
66787
- const data = await apiPost("/api/tag-manager/draft/stage", { chatId, op });
66788
- writeJsonEnvelope({ ok: true, data, hints: STAGE_HINTS2 });
66816
+ const { data, hints: hints2 } = splitHints(
66817
+ await apiPost("/api/tag-manager/draft/stage", { chatId, op })
66818
+ );
66819
+ writeJsonEnvelope({ ok: true, data, hints: [...hints2, ...STAGE_HINTS2] });
66789
66820
  } catch (err) {
66790
66821
  handleError8(err);
66791
66822
  }
@@ -66793,8 +66824,8 @@ async function stageOp4(op) {
66793
66824
  async function draftAction3(path48, body, chat) {
66794
66825
  const chatId = resolveChatId(chat);
66795
66826
  try {
66796
- const data = await apiPost(path48, { chatId, ...body });
66797
- writeJsonEnvelope({ ok: true, data });
66827
+ const { data, hints: hints2 } = splitHints(await apiPost(path48, { chatId, ...body }));
66828
+ writeJsonEnvelope({ ok: true, data, ...hints2.length > 0 ? { hints: hints2 } : {} });
66798
66829
  return data;
66799
66830
  } catch (err) {
66800
66831
  handleError8(err);
@@ -66825,12 +66856,13 @@ function renderDraft2(response) {
66825
66856
  async function draftList2(json, chat) {
66826
66857
  const chatId = resolveChatId(chat);
66827
66858
  try {
66828
- const data = await apiPost("/api/tag-manager/draft", { chatId });
66859
+ const response = await apiPost("/api/tag-manager/draft", { chatId });
66860
+ const { data, hints: hints2 } = splitHints(response);
66829
66861
  if (json) {
66830
- writeJsonEnvelope({ ok: true, data });
66862
+ writeJsonEnvelope({ ok: true, data, ...hints2.length > 0 ? { hints: hints2 } : {} });
66831
66863
  return;
66832
66864
  }
66833
- process.stdout.write(`${renderDraft2(data)}
66865
+ process.stdout.write(`${renderDraft2(data)}${hintLines(response)}
66834
66866
  `);
66835
66867
  } catch (err) {
66836
66868
  handleError8(err);