@koda-sl/baker-cli 0.353.0-dev.56f955de4 → 0.353.0-dev.847cbae62

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/README.md CHANGED
@@ -615,7 +615,7 @@ baker ads google keywords update <criterion-id> --customer-id 1234567890 --clear
615
615
  baker ads google ads create --customer-id 1234567890 --ad-group-ref g_temp_<adgroup> \
616
616
  --headlines "Fast Widgets,Buy Online,Free Shipping" --descriptions "Best widgets around.,Ships tomorrow." \
617
617
  --final-url https://example.com
618
- # Copy with commas in it — repeat the flag once per item (or quote the item: '"Fast, free quotes",Book today', or escape its comma: 'Fast\, free quotes,Book today')
618
+ # Copy with commas in it — repeat the flag once per item (or quote the item: '"Fast, free quotes",Book today')
619
619
  baker ads google ads create --customer-id 1234567890 --ad-group-ref g_temp_<adgroup> \
620
620
  --headlines "Fast Widgets,Buy Online,Free Shipping" \
621
621
  --descriptions "Calls, messages and bookings in one place." --descriptions "Ships tomorrow, free." \
package/dist/cli.js CHANGED
@@ -11035,6 +11035,20 @@ function adCopyHints(payload) {
11035
11035
  return tells.slice(0, MAX_HINTS).map(hintFor);
11036
11036
  }
11037
11037
 
11038
+ // src/commands/ads/hints.ts
11039
+ function backendHints(envelope) {
11040
+ const hints2 = envelope.hints;
11041
+ return Array.isArray(hints2) ? hints2.filter((hint) => typeof hint === "string") : [];
11042
+ }
11043
+ function withHints(envelope, extra) {
11044
+ const hints2 = [...backendHints(envelope), ...extra];
11045
+ return hints2.length > 0 ? { ...envelope, hints: hints2 } : envelope;
11046
+ }
11047
+ function hintLines(envelope) {
11048
+ return backendHints(envelope).map((hint) => `
11049
+ > ${hint}`).join("");
11050
+ }
11051
+
11038
11052
  // src/commands/ads/google/draft-status.ts
11039
11053
  var OPERATION_LABELS = {
11040
11054
  create: "Creating",
@@ -11364,7 +11378,7 @@ async function stageGoogleOp(raw, hints2) {
11364
11378
  const chatId = requireChatId();
11365
11379
  const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
11366
11380
  const allHints = [...noopHints(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
11367
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
11381
+ writeJsonEnvelope(withHints(response, allHints));
11368
11382
  } catch (err) {
11369
11383
  handleGoogleError(err);
11370
11384
  }
@@ -11402,7 +11416,7 @@ async function stageGoogleOps(rawOps, hints2) {
11402
11416
  const chatId = requireChatId();
11403
11417
  const response = await apiPost("/api/ads/google/draft/stage-batch", { chatId, ops });
11404
11418
  const allHints = [...skippedHints(response.data.skipped ?? [], ops.length), ...hints2 ?? [], ...adCopyHints(ops)];
11405
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
11419
+ writeJsonEnvelope(withHints(response, allHints));
11406
11420
  } catch (err) {
11407
11421
  handleGoogleError(err);
11408
11422
  }
@@ -11430,7 +11444,7 @@ async function draftListAction(json, chat) {
11430
11444
  writeJsonEnvelope(response);
11431
11445
  return;
11432
11446
  }
11433
- process.stdout.write(`${renderDraftStatus(response.data)}
11447
+ process.stdout.write(`${renderDraftStatus(response.data)}${hintLines(response)}
11434
11448
  `);
11435
11449
  } catch (err) {
11436
11450
  handleGoogleError(err);
@@ -16798,7 +16812,7 @@ import { defineCommand as defineCommand31 } from "citty";
16798
16812
 
16799
16813
  // src/commands/ads/google/ad-copy-flags.ts
16800
16814
  var AD_COPY_LIST_FLAGS = ["headlines", "descriptions", "long-headlines"];
16801
- 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' (or escape its comma: '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"'`;
16815
+ 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"'`;
16802
16816
  function skipBlanks(value, at) {
16803
16817
  let i = at;
16804
16818
  while (value[i] === " " || value[i] === " ") i++;
@@ -16822,20 +16836,6 @@ function readQuotedField(value, open, flag) {
16822
16836
  }
16823
16837
  return { text: text2, next: after + 1 };
16824
16838
  }
16825
- function readUnquotedField(value, start) {
16826
- let text2 = "";
16827
- let j = start;
16828
- while (j < value.length && value[j] !== ",") {
16829
- if (value[j] === "\\" && value[j + 1] === ",") {
16830
- text2 += ",";
16831
- j += 2;
16832
- } else {
16833
- text2 += value[j];
16834
- j++;
16835
- }
16836
- }
16837
- return { text: text2, next: j + 1 };
16838
- }
16839
16839
  function splitQuotedList(value, flag) {
16840
16840
  const fields = [];
16841
16841
  let i = 0;
@@ -16846,9 +16846,10 @@ function splitQuotedList(value, flag) {
16846
16846
  fields.push({ text: text2, quoted: true });
16847
16847
  i = next;
16848
16848
  } else {
16849
- const { text: text2, next } = readUnquotedField(value, start);
16850
- fields.push({ text: text2, quoted: false });
16851
- i = next;
16849
+ const comma = value.indexOf(",", start);
16850
+ const end = comma === -1 ? value.length : comma;
16851
+ fields.push({ text: value.slice(start, end), quoted: false });
16852
+ i = end + 1;
16852
16853
  }
16853
16854
  }
16854
16855
  const several = fields.length > 1;
@@ -16866,7 +16867,7 @@ function jsonStringArray(value) {
16866
16867
  function parseCopyList(value, flag) {
16867
16868
  let items;
16868
16869
  if (Array.isArray(value)) {
16869
- items = value.filter((v) => typeof v === "string").map((v) => ({ text: v.replaceAll("\\,", ",").trim(), splitAtComma: false }));
16870
+ items = value.filter((v) => typeof v === "string").map((v) => ({ text: v.trim(), splitAtComma: false }));
16870
16871
  } else if (typeof value === "string") {
16871
16872
  const trimmed = value.trim();
16872
16873
  const json = jsonStringArray(trimmed);
@@ -19227,7 +19228,7 @@ async function stageOp(raw, hints2) {
19227
19228
  op: preflight.data
19228
19229
  });
19229
19230
  const allHints = [...batchNudge(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
19230
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
19231
+ writeJsonEnvelope(withHints(response, allHints));
19231
19232
  } catch (err) {
19232
19233
  handleLinkedinError(err);
19233
19234
  }
@@ -19254,7 +19255,7 @@ async function stageLinkedinOps(rawOps, hints2) {
19254
19255
  const chatId = requireChatId();
19255
19256
  const response = await apiPost("/api/ads/linkedin/draft/stage-batch", { chatId, ops });
19256
19257
  const allHints = [...hints2 ?? [], ...adCopyHints(ops)];
19257
- writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
19258
+ writeJsonEnvelope(withHints(response, allHints));
19258
19259
  } catch (err) {
19259
19260
  handleLinkedinError(err);
19260
19261
  }
@@ -22463,7 +22464,7 @@ async function listDraft(json, chat) {
22463
22464
  writeJsonEnvelope(response);
22464
22465
  return;
22465
22466
  }
22466
- process.stdout.write(`${renderDraftStatus2(response.data)}
22467
+ process.stdout.write(`${renderDraftStatus2(response.data)}${hintLines(response)}
22467
22468
  `);
22468
22469
  } catch (err) {
22469
22470
  handleLinkedinError(err);
@@ -24830,7 +24831,12 @@ var metaDraftAdvisorySchema = z34.object({
24830
24831
  message: z34.string()
24831
24832
  });
24832
24833
  var metaDraftListResponseSchema = z34.object({
24833
- status: z34.enum(["active", "publishing", "applied", "discarded", "none"]),
24834
+ /**
24835
+ * `applied` means the publish finished with no op failed or skipped — when `mode` is `simulated`
24836
+ * nothing reached Meta. `partial` means the publish finished but at least one op failed or was
24837
+ * skipped — read each op's `result` for which one and why.
24838
+ */
24839
+ status: z34.enum(["active", "publishing", "applied", "partial", "discarded", "none"]),
24834
24840
  mode: metaWriteModeSchema,
24835
24841
  count: z34.number(),
24836
24842
  ops: z34.array(metaDraftOpViewSchema),
@@ -24987,7 +24993,7 @@ async function stageOp2(raw) {
24987
24993
  const chatId = requireChatId();
24988
24994
  const response = await apiPost("/api/ads/meta/draft/stage", { chatId, op: preflight.data });
24989
24995
  const copyHints = adCopyHints(preflight.data);
24990
- writeJsonEnvelope(copyHints.length > 0 ? { ...response, hints: copyHints } : response);
24996
+ writeJsonEnvelope(withHints(response, copyHints));
24991
24997
  } catch (err) {
24992
24998
  handleMetaError(err);
24993
24999
  }