@koda-sl/baker-cli 0.364.0-dev.c9e3bcde2 → 0.365.0-dev.055a73fd1

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
@@ -943,8 +943,7 @@ baker ads meta creatives create --account-id act_123 --page 555 --instagram-us
943
943
  baker ads meta ads create --account-id act_123 --name "Ad 1" --adset meta_temp_as --creative meta_temp_cr
944
944
 
945
945
  # review + edit before publish
946
- baker ads meta draft # one line per op: ref · kind · summary · after <refs>, then advisories
947
- baker ads meta draft --json # raw JSON envelope for scripting
946
+ baker ads meta draft
948
947
  baker ads meta draft show meta_temp_cr # full staged payload — the receipt before publish
949
948
  baker ads meta draft remove meta_temp_cr # removing a create cascades to dependents
950
949
  baker ads meta draft clear
package/dist/cli.js CHANGED
@@ -9792,7 +9792,7 @@ import { defineCommand as defineCommand19 } from "citty";
9792
9792
  function listed(resources) {
9793
9793
  return resources.map((resource) => resource.label ? `${resource.id} (${resource.label})` : resource.id).join("; ");
9794
9794
  }
9795
- function connectedResourceHints({ plural: plural2, singular, flag, resources }) {
9795
+ function connectedResourceHints({ plural, singular, flag, resources }) {
9796
9796
  if (resources.length === 0) {
9797
9797
  return [];
9798
9798
  }
@@ -9800,7 +9800,7 @@ function connectedResourceHints({ plural: plural2, singular, flag, resources })
9800
9800
  return [`This company connected one ${singular}: ${listed(resources)}. Commands use it unless you pass ${flag}.`];
9801
9801
  }
9802
9802
  return [
9803
- `This company connected ${resources.length} ${plural2}: ${listed(resources)}. Each command works on one, so pass ${flag} \u2014 nothing is picked for you. A question about the whole business covers all ${resources.length}: answering from one and reporting it as the total is wrong.`
9803
+ `This company connected ${resources.length} ${plural}: ${listed(resources)}. Each command works on one, so pass ${flag} \u2014 nothing is picked for you. A question about the whole business covers all ${resources.length}: answering from one and reporting it as the total is wrong.`
9804
9804
  ];
9805
9805
  }
9806
9806
 
@@ -14740,8 +14740,8 @@ var SEND_PLATFORM_SPECS = {
14740
14740
  title: "Meta",
14741
14741
  eventMeans: "A Meta event name \u2014 Lead, Purchase, Schedule, or one of your own",
14742
14742
  eventKind: "name",
14743
- credentialFields: ["accessToken", "datasetId"],
14744
- setupHint: "Add the Conversions API access token and dataset id to the Meta pixel in Tracking"
14743
+ credentialFields: ["accessToken"],
14744
+ setupHint: "Add the Conversions API access token to the Meta pixel in Tracking"
14745
14745
  },
14746
14746
  googleAds: {
14747
14747
  title: "Google Ads",
@@ -27019,110 +27019,11 @@ Examples:
27019
27019
 
27020
27020
  // src/commands/ads/meta/draft.ts
27021
27021
  import { defineCommand as defineCommand65 } from "citty";
27022
-
27023
- // src/commands/ads/meta/draft-status.ts
27024
- var STATUS_HEADINGS = {
27025
- active: "staged",
27026
- publishing: "publishing",
27027
- applied: "published",
27028
- partial: "published with failures",
27029
- discarded: "discarded",
27030
- none: "none"
27031
- };
27032
- function plural(count2, word) {
27033
- return `${count2} ${word}${count2 === 1 ? "" : "s"}`;
27034
- }
27035
- function headingLine(draft) {
27036
- const heading = STATUS_HEADINGS[draft.status];
27037
- if (draft.status === "active" || draft.status === "discarded") {
27038
- return `Meta Ads \u2014 ${plural(draft.count, "change")} ${heading} \xB7 ${draft.mode}`;
27039
- }
27040
- const counts = /* @__PURE__ */ new Map();
27041
- for (const op of draft.ops) {
27042
- const status = op.result?.status ?? "pending";
27043
- counts.set(status, (counts.get(status) ?? 0) + 1);
27044
- }
27045
- const summary = [...counts].map(([status, count2]) => `${count2} ${status}`).join(", ");
27046
- return `Meta Ads \u2014 ${heading} \xB7 ${summary} \xB7 ${draft.mode}`;
27047
- }
27048
- function resultPart(op) {
27049
- const result = op.result;
27050
- if (!result) {
27051
- return void 0;
27052
- }
27053
- if (result.status === "failed") {
27054
- return `\u2717 failed: ${result.error ?? "no reason recorded"}`;
27055
- }
27056
- if (result.status === "skipped") {
27057
- return `\u2717 skipped: waiting on ${result.skippedBecause ?? "a change that did not apply"}`;
27058
- }
27059
- const id = result.id ?? result.hash;
27060
- const applied = `\u2713 ${result.status}${id ? ` \u2192 ${id}` : ""}`;
27061
- const verification = result.verification;
27062
- if (verification && verification.status !== "confirmed") {
27063
- return `${applied} (read-back ${verification.status}${verification.note ? `: ${verification.note}` : ""})`;
27064
- }
27065
- return applied;
27066
- }
27067
- function opLine(op, showAccount) {
27068
- const parts = [op.ref, op.kind, op.summary];
27069
- if (op.target && op.target !== op.ref) {
27070
- parts.push(`target ${op.target}`);
27071
- }
27072
- if (showAccount) {
27073
- parts.push(`account ${op.accountId}`);
27074
- }
27075
- if (op.dependsOn.length > 0) {
27076
- parts.push(`after ${op.dependsOn.join(", ")}`);
27077
- }
27078
- const result = resultPart(op);
27079
- if (result) {
27080
- parts.push(result);
27081
- }
27082
- return ` ${parts.join(" \xB7 ")}`;
27083
- }
27084
- function renderDraftStatus3(draft) {
27085
- if (draft.status === "none" || draft.count === 0) {
27086
- return "No staged Meta changes on this chat.";
27087
- }
27088
- const lines = [headingLine(draft)];
27089
- if (draft.status === "active") {
27090
- lines.push("Publishing makes every change real on the ad account.");
27091
- }
27092
- lines.push("");
27093
- const showAccount = new Set(draft.ops.map((op) => op.accountId)).size > 1;
27094
- for (const op of draft.ops) {
27095
- lines.push(opLine(op, showAccount));
27096
- }
27097
- if (draft.advisories.length > 0) {
27098
- lines.push("", "Advisories");
27099
- for (const advisory of draft.advisories) {
27100
- lines.push(` ! ${advisory.ref}: ${advisory.message}`);
27101
- }
27102
- }
27103
- lines.push("", "Full staged payload for one op: baker ads meta draft show <ref> \xB7 raw envelope: --json");
27104
- return lines.join("\n");
27105
- }
27106
-
27107
- // src/commands/ads/meta/draft.ts
27108
- registerSchema({
27109
- command: "ads.meta.draft",
27110
- description: "Review every Meta op staged on this chat, one line each: ref \xB7 kind \xB7 summary \xB7 what it waits on, and after a publish \u2713 applied \u2192 id or \u2717 failed: <error>. `draft show <ref>` prints one op's full payload.",
27111
- args: {
27112
- json: { type: "boolean", description: "Raw JSON envelope instead of the readable list", required: false },
27113
- chat: { type: "string", description: "Read another chat's draft instead of this one", required: false }
27114
- }
27115
- });
27116
- async function listDraft2(json, chat) {
27022
+ async function listDraft2(chat) {
27117
27023
  try {
27118
27024
  const chatId = resolveChatId(chat);
27119
27025
  const response = await apiPost("/api/ads/meta/draft", { chatId });
27120
- if (json || !response.ok || !response.data) {
27121
- writeJsonEnvelope(response);
27122
- return;
27123
- }
27124
- process.stdout.write(`${renderDraftStatus3(response.data)}
27125
- `);
27026
+ writeJsonEnvelope(response);
27126
27027
  } catch (err) {
27127
27028
  handleMetaError(err);
27128
27029
  }
@@ -27130,14 +27031,11 @@ async function listDraft2(json, chat) {
27130
27031
  var listCommand10 = defineCommand65({
27131
27032
  meta: {
27132
27033
  name: "list",
27133
- description: "Show every Meta write op staged in this chat, one line each (ref \xB7 kind \xB7 summary \xB7 dependencies \xB7 post-publish result); --json for the raw envelope. Publishing reaches the real ad account, so review this before you finish. Example: baker ads meta draft"
27134
- },
27135
- args: {
27136
- json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" },
27137
- chat: CHAT_READ_ARG
27034
+ description: "Show every Meta write op staged in this chat, its dependencies, and post-publish results. Publishing reaches the real ad account, so review this before you finish. Example: baker ads meta draft"
27138
27035
  },
27036
+ args: { chat: CHAT_READ_ARG },
27139
27037
  run: async ({ args: args5 }) => {
27140
- await listDraft2(args5.json === true, args5.chat);
27038
+ await listDraft2(args5.chat);
27141
27039
  }
27142
27040
  });
27143
27041
  var showCommand2 = defineCommand65({
@@ -27207,10 +27105,7 @@ var metaDraftCommand = defineCommand65({
27207
27105
  },
27208
27106
  // Declared on the parent too: `default: "list"` dispatches the bare `draft --chat <id>` form, and
27209
27107
  // citty prints help for a flag the parent does not know instead of forwarding it.
27210
- args: {
27211
- json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" },
27212
- chat: CHAT_READ_ARG
27213
- },
27108
+ args: { chat: CHAT_READ_ARG },
27214
27109
  subCommands: { list: listCommand10, show: showCommand2, remove: removeCommand3, clear: clearCommand3 },
27215
27110
  // `default` (not `run`) dispatches the bare invocation: citty falls through to `run`
27216
27111
  // after dispatching a subcommand, so a `run` here would list the draft a second time
@@ -29023,7 +28918,7 @@ function renderNode3(node, depth, showAccount, out) {
29023
28918
  }
29024
28919
  }
29025
28920
  var NO_CHANGES = "No X Ads changes staged";
29026
- var STATUS_HEADINGS2 = {
28921
+ var STATUS_HEADINGS = {
29027
28922
  active: "staged",
29028
28923
  publishing: "publishing",
29029
28924
  applied: "published",
@@ -29035,8 +28930,8 @@ function didNotApply(op) {
29035
28930
  function didApply(op) {
29036
28931
  return op.result?.status === "applied" || op.result?.status === "simulated";
29037
28932
  }
29038
- function headingLine2(draft) {
29039
- const heading = STATUS_HEADINGS2[draft.status] ?? draft.status;
28933
+ function headingLine(draft) {
28934
+ const heading = STATUS_HEADINGS[draft.status] ?? draft.status;
29040
28935
  if (draft.status !== "applied" && draft.status !== "publishing") {
29041
28936
  return `X Ads: ${draft.count} change${draft.count === 1 ? "" : "s"} ${heading}`;
29042
28937
  }
@@ -29050,11 +28945,11 @@ function problemLines(draft) {
29050
28945
  return `\u2717 ${op.summary} \u2014 failed: ${reason}`;
29051
28946
  });
29052
28947
  }
29053
- function renderDraftStatus4(draft) {
28948
+ function renderDraftStatus3(draft) {
29054
28949
  if (draft.status === "none" || draft.count === 0) {
29055
28950
  return NO_CHANGES;
29056
28951
  }
29057
- const out = [headingLine2(draft), ""];
28952
+ const out = [headingLine(draft), ""];
29058
28953
  const tree = draft.tree ?? [];
29059
28954
  const showAccount = accountsInTree3(tree).size > 1;
29060
28955
  for (const node of tree) {
@@ -29092,7 +28987,7 @@ async function listDraft3(json, chat) {
29092
28987
  writeJsonEnvelope(response);
29093
28988
  return;
29094
28989
  }
29095
- process.stdout.write(`${renderDraftStatus4(response.data)}
28990
+ process.stdout.write(`${renderDraftStatus3(response.data)}
29096
28991
  `);
29097
28992
  } catch (err) {
29098
28993
  handleDraftError(err);