@koda-sl/baker-cli 0.146.1 → 0.148.0

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
@@ -34,7 +34,7 @@ import {
34
34
  toModelSafeImage,
35
35
  ulid,
36
36
  validateCanvasDeep
37
- } from "./chunk-TAGQCU36.js";
37
+ } from "./chunk-2F5SCTNS.js";
38
38
  import {
39
39
  csvOrJson,
40
40
  daysAgoIso,
@@ -5395,17 +5395,27 @@ var googleDraftStageRequestSchema = z13.object({
5395
5395
  chatId: z13.string(),
5396
5396
  op: googleDraftOpInputSchema
5397
5397
  });
5398
- var googleDraftStageResponseSchema = z13.object({
5399
- staged: z13.literal(true),
5400
- ref: z13.string(),
5401
- kind: googleDraftOpKindSchema,
5402
- mode: googleWriteModeSchema,
5403
- dependsOn: z13.array(z13.string()),
5404
- summary: z13.string(),
5405
- warnings: z13.array(z13.string()),
5406
- /** True when the op amended an already-staged op in place instead of appending a new one. */
5407
- amended: z13.boolean().optional()
5408
- });
5398
+ var googleDraftStageResponseSchema = z13.discriminatedUnion("staged", [
5399
+ z13.object({
5400
+ staged: z13.literal(true),
5401
+ ref: z13.string(),
5402
+ kind: googleDraftOpKindSchema,
5403
+ mode: googleWriteModeSchema,
5404
+ dependsOn: z13.array(z13.string()),
5405
+ summary: z13.string(),
5406
+ warnings: z13.array(z13.string()),
5407
+ /** True when the op amended an already-staged op in place instead of appending a new one. */
5408
+ amended: z13.boolean().optional()
5409
+ }),
5410
+ z13.object({
5411
+ staged: z13.literal(false),
5412
+ noop: z13.literal(true),
5413
+ kind: googleDraftOpKindSchema,
5414
+ mode: googleWriteModeSchema,
5415
+ summary: z13.string(),
5416
+ reason: z13.string()
5417
+ })
5418
+ ]);
5409
5419
  var googleDraftAmendRequestSchema = z13.object({
5410
5420
  chatId: z13.string(),
5411
5421
  ref: z13.string(),
@@ -5432,7 +5442,8 @@ var googleDraftStageBatchResponseSchema = z13.object({
5432
5442
  summary: z13.string(),
5433
5443
  warnings: z13.array(z13.string())
5434
5444
  })
5435
- )
5445
+ ),
5446
+ skipped: z13.array(z13.object({ kind: googleDraftOpKindSchema, summary: z13.string(), reason: z13.string() })).optional()
5436
5447
  });
5437
5448
  var googleDraftOpViewSchema = z13.object({
5438
5449
  ref: z13.string(),
@@ -5691,7 +5702,7 @@ function keywordEntries(args) {
5691
5702
  const seen = /* @__PURE__ */ new Set();
5692
5703
  for (const item of raw) {
5693
5704
  const entry = parseKeywordEntry(item, defaultMatch);
5694
- const key = `${entry.text}\0${entry.matchType}`;
5705
+ const key = JSON.stringify([entry.text, entry.matchType]);
5695
5706
  if (!seen.has(key)) {
5696
5707
  seen.add(key);
5697
5708
  entries.push(entry);
@@ -5758,6 +5769,9 @@ function handleGoogleError(err) {
5758
5769
  });
5759
5770
  process.exit(1);
5760
5771
  }
5772
+ function noopHints(data) {
5773
+ return data.staged ? [] : [`NOT STAGED \u2014 ${data.reason}. Nothing to publish for this change; say so rather than reporting it as done.`];
5774
+ }
5761
5775
  async function stageGoogleOp(raw, hints) {
5762
5776
  const preflight = googleDraftOpInputSchema.safeParse(raw);
5763
5777
  if (!preflight.success) {
@@ -5775,7 +5789,8 @@ async function stageGoogleOp(raw, hints) {
5775
5789
  try {
5776
5790
  const chatId = requireChatId();
5777
5791
  const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
5778
- writeJsonEnvelope(hints && hints.length > 0 ? { ...response, hints } : response);
5792
+ const allHints = [...noopHints(response.data), ...hints ?? []];
5793
+ writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
5779
5794
  } catch (err) {
5780
5795
  handleGoogleError(err);
5781
5796
  }
@@ -5811,7 +5826,14 @@ async function stageGoogleOps(rawOps, hints) {
5811
5826
  try {
5812
5827
  const chatId = requireChatId();
5813
5828
  const response = await apiPost("/api/ads/google/draft/stage-batch", { chatId, ops });
5814
- writeJsonEnvelope(hints && hints.length > 0 ? { ...response, hints } : response);
5829
+ const skipped = response.data.skipped ?? [];
5830
+ const allHints = [
5831
+ ...skipped.length > 0 ? [
5832
+ `${skipped.length} of ${ops.length} op(s) NOT STAGED \u2014 already in the requested state: ${skipped.map((s) => s.reason).join("; ")}`
5833
+ ] : [],
5834
+ ...hints ?? []
5835
+ ];
5836
+ writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
5815
5837
  } catch (err) {
5816
5838
  handleGoogleError(err);
5817
5839
  }
@@ -19699,7 +19721,7 @@ var runCommand = defineCommand88({
19699
19721
  "cache-policy": { type: "string", description: "read_write | bypass | read_only" },
19700
19722
  regenerate: {
19701
19723
  type: "string",
19702
- description: "Comma-separated node ids to force fresh THIS run (e.g. --regenerate gen_4x5,gen_9x16), bypassing the content cache for just those nodes + everything downstream. For a persistent re-render, bump a node's `regenerate` field in the canvas JSON instead."
19724
+ description: "Comma-separated node ids to force fresh THIS run (e.g. --regenerate gen,adapt), bypassing the content cache for just those nodes + everything downstream. For a persistent re-render, bump a node's `regenerate` field in the canvas JSON instead."
19703
19725
  },
19704
19726
  concurrency: {
19705
19727
  type: "string",
@@ -19872,6 +19894,10 @@ async function executeCanvasRun(opts) {
19872
19894
  );
19873
19895
  process.exit(2);
19874
19896
  }
19897
+ for (const w of validation.warnings ?? []) {
19898
+ process.stdout.write(`[warn] ${w.code}: ${w.message}
19899
+ `);
19900
+ }
19875
19901
  const canvasSha = sha256Hex(Buffer.from(raw));
19876
19902
  const creativeSlug = creativeSlugFromCanvasPath(filePath) ?? void 0;
19877
19903
  const client = opts.record === false ? null : buildBackendClient();