@koda-sl/baker-cli 0.868.0-dev.009dcef7a → 0.868.0-dev.0975639e1

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.
Files changed (78) hide show
  1. package/README.md +3 -2
  2. package/dist/{account-assets-L6BX4YUQ.js → account-assets-W2GJYDRE.js} +6 -6
  3. package/dist/{account-level-OX34JQ7C.js → account-level-N3QDHYOG.js} +4 -4
  4. package/dist/{ads-ZR5D7BZT.js → ads-7PLEAQ4Y.js} +10 -10
  5. package/dist/{ads-66KVUF35.js → ads-IWV53RNM.js} +3 -3
  6. package/dist/{adsets-3NIYL2GQ.js → adsets-KYF344OG.js} +9 -9
  7. package/dist/{asset-writes-5ZKZDPQ4.js → asset-writes-GNDDJZ55.js} +4 -4
  8. package/dist/{audience-writes-NL6NRLLY.js → audience-writes-IO4MHAWC.js} +4 -4
  9. package/dist/{audiences-DL267GNQ.js → audiences-WS4F3HBZ.js} +6 -6
  10. package/dist/{campaigns-RXDC5FSQ.js → campaigns-S5K2CCBC.js} +9 -9
  11. package/dist/{catalogs-QAZ7ZZ5R.js → catalogs-FAINI4WF.js} +3 -3
  12. package/dist/{chunk-3R62EYYX.js → chunk-47SIB7JD.js} +1 -1
  13. package/dist/{chunk-OMJ7DVFJ.js → chunk-6BMO6ZH6.js} +6 -5
  14. package/dist/{chunk-OMJ7DVFJ.js.map → chunk-6BMO6ZH6.js.map} +1 -1
  15. package/dist/{chunk-GED2RAQE.js → chunk-7BRLLCKC.js} +2 -2
  16. package/dist/{chunk-LJO3I2W2.js → chunk-BPIHAIWB.js} +11 -20
  17. package/dist/chunk-BPIHAIWB.js.map +1 -0
  18. package/dist/{chunk-UE5ZFTDL.js → chunk-FYVPXWLZ.js} +2 -2
  19. package/dist/{chunk-EGM42UKF.js → chunk-R7TJKILR.js} +2 -2
  20. package/dist/cli.js +1 -1
  21. package/dist/{copy-writes-QYN6PBU2.js → copy-writes-R3HYTK6I.js} +4 -4
  22. package/dist/{creatives-CPLH3KHQ.js → creatives-L2VSIFDC.js} +4 -4
  23. package/dist/{custom-conversions-CTJVAZKC.js → custom-conversions-NRK47O6Z.js} +4 -4
  24. package/dist/{draft-UU3F2VMJ.js → draft-H744DU5T.js} +203 -8
  25. package/dist/draft-H744DU5T.js.map +1 -0
  26. package/dist/{insights-QU5A4XBO.js → insights-54KZY55Q.js} +2 -2
  27. package/dist/{instant-experiences-EJWYFWDT.js → instant-experiences-Y2F6IWIY.js} +3 -3
  28. package/dist/{leads-FEEWX7OO.js → leads-ZVFKPQK2.js} +3 -3
  29. package/dist/{linkedin-OZGEZLN5.js → linkedin-EBOTX37R.js} +4 -8
  30. package/dist/{linkedin-OZGEZLN5.js.map → linkedin-EBOTX37R.js.map} +1 -1
  31. package/dist/{media-PUOLJUN3.js → media-UMSC6EET.js} +3 -3
  32. package/dist/{meta-C7VHIHDL.js → meta-G7EJ6Q4S.js} +32 -32
  33. package/dist/{page-photos-ZBMJLL5V.js → page-photos-56WZO7EN.js} +3 -3
  34. package/dist/preview-HD3QAR53.js +104 -0
  35. package/dist/preview-HD3QAR53.js.map +1 -0
  36. package/dist/{preview-25YWCQBJ.js → preview-LP3RV2F2.js} +48 -131
  37. package/dist/preview-LP3RV2F2.js.map +1 -0
  38. package/dist/{rule-writes-6XP7G35U.js → rule-writes-KB6RB5GF.js} +4 -4
  39. package/dist/{rules-BRULCGRV.js → rules-M6DKJW3S.js} +7 -7
  40. package/dist/{studies-357M2C2K.js → studies-MUMENEVH.js} +5 -5
  41. package/dist/{study-writes-HXUQRPIK.js → study-writes-5X4ZTRZD.js} +3 -3
  42. package/dist/{targeting-7T7XHBIX.js → targeting-TQ7RYWX2.js} +3 -3
  43. package/dist/{write-commands-4KI6T2NF.js → write-commands-HI3GEWWX.js} +5 -5
  44. package/package.json +1 -1
  45. package/dist/chunk-LJO3I2W2.js.map +0 -1
  46. package/dist/draft-UU3F2VMJ.js.map +0 -1
  47. package/dist/preview-25YWCQBJ.js.map +0 -1
  48. package/dist/preview-TTIHEWK6.js +0 -147
  49. package/dist/preview-TTIHEWK6.js.map +0 -1
  50. /package/dist/{account-assets-L6BX4YUQ.js.map → account-assets-W2GJYDRE.js.map} +0 -0
  51. /package/dist/{account-level-OX34JQ7C.js.map → account-level-N3QDHYOG.js.map} +0 -0
  52. /package/dist/{ads-ZR5D7BZT.js.map → ads-7PLEAQ4Y.js.map} +0 -0
  53. /package/dist/{ads-66KVUF35.js.map → ads-IWV53RNM.js.map} +0 -0
  54. /package/dist/{adsets-3NIYL2GQ.js.map → adsets-KYF344OG.js.map} +0 -0
  55. /package/dist/{asset-writes-5ZKZDPQ4.js.map → asset-writes-GNDDJZ55.js.map} +0 -0
  56. /package/dist/{audience-writes-NL6NRLLY.js.map → audience-writes-IO4MHAWC.js.map} +0 -0
  57. /package/dist/{audiences-DL267GNQ.js.map → audiences-WS4F3HBZ.js.map} +0 -0
  58. /package/dist/{campaigns-RXDC5FSQ.js.map → campaigns-S5K2CCBC.js.map} +0 -0
  59. /package/dist/{catalogs-QAZ7ZZ5R.js.map → catalogs-FAINI4WF.js.map} +0 -0
  60. /package/dist/{chunk-3R62EYYX.js.map → chunk-47SIB7JD.js.map} +0 -0
  61. /package/dist/{chunk-GED2RAQE.js.map → chunk-7BRLLCKC.js.map} +0 -0
  62. /package/dist/{chunk-UE5ZFTDL.js.map → chunk-FYVPXWLZ.js.map} +0 -0
  63. /package/dist/{chunk-EGM42UKF.js.map → chunk-R7TJKILR.js.map} +0 -0
  64. /package/dist/{copy-writes-QYN6PBU2.js.map → copy-writes-R3HYTK6I.js.map} +0 -0
  65. /package/dist/{creatives-CPLH3KHQ.js.map → creatives-L2VSIFDC.js.map} +0 -0
  66. /package/dist/{custom-conversions-CTJVAZKC.js.map → custom-conversions-NRK47O6Z.js.map} +0 -0
  67. /package/dist/{insights-QU5A4XBO.js.map → insights-54KZY55Q.js.map} +0 -0
  68. /package/dist/{instant-experiences-EJWYFWDT.js.map → instant-experiences-Y2F6IWIY.js.map} +0 -0
  69. /package/dist/{leads-FEEWX7OO.js.map → leads-ZVFKPQK2.js.map} +0 -0
  70. /package/dist/{media-PUOLJUN3.js.map → media-UMSC6EET.js.map} +0 -0
  71. /package/dist/{meta-C7VHIHDL.js.map → meta-G7EJ6Q4S.js.map} +0 -0
  72. /package/dist/{page-photos-ZBMJLL5V.js.map → page-photos-56WZO7EN.js.map} +0 -0
  73. /package/dist/{rule-writes-6XP7G35U.js.map → rule-writes-KB6RB5GF.js.map} +0 -0
  74. /package/dist/{rules-BRULCGRV.js.map → rules-M6DKJW3S.js.map} +0 -0
  75. /package/dist/{studies-357M2C2K.js.map → studies-MUMENEVH.js.map} +0 -0
  76. /package/dist/{study-writes-HXUQRPIK.js.map → study-writes-5X4ZTRZD.js.map} +0 -0
  77. /package/dist/{targeting-7T7XHBIX.js.map → targeting-TQ7RYWX2.js.map} +0 -0
  78. /package/dist/{write-commands-4KI6T2NF.js.map → write-commands-HI3GEWWX.js.map} +0 -0
@@ -1,3 +1,12 @@
1
+ import {
2
+ bareAccountId,
3
+ failWriteValidation,
4
+ preflightOp
5
+ } from "./chunk-6BMO6ZH6.js";
6
+ import "./chunk-47SIB7JD.js";
7
+ import {
8
+ TEMP_REF_REGEX
9
+ } from "./chunk-GDFJOCDO.js";
1
10
  import {
2
11
  handleMetaError
3
12
  } from "./chunk-DP76WGDV.js";
@@ -9,25 +18,50 @@ import {
9
18
  SHOW_FULL_ARG,
10
19
  showEnvelope
11
20
  } from "./chunk-3TGKBO5K.js";
21
+ import {
22
+ loadJsonPayloads
23
+ } from "./chunk-LZ5DS4UB.js";
12
24
  import {
13
25
  LIST_WHERE_ARG,
14
26
  draftListWhere,
15
27
  requireDraftWhere,
16
28
  wholeDraftHints
17
29
  } from "./chunk-RHN5FEWA.js";
30
+ import {
31
+ adCopyHints
32
+ } from "./chunk-XD7C5OE7.js";
33
+ import "./chunk-UKENQSZ2.js";
18
34
  import {
19
35
  hintLines,
20
36
  withHints
21
37
  } from "./chunk-D5FY4FAK.js";
38
+ import "./chunk-RZFR2H4D.js";
22
39
  import "./chunk-QALAJNBG.js";
40
+ import "./chunk-7FH3IREG.js";
41
+ import "./chunk-ERSX3MKH.js";
23
42
  import {
24
43
  CHAT_READ_ARG,
25
44
  DRAFT_FULL_ARG
26
45
  } from "./chunk-X32MFGWW.js";
46
+ import "./chunk-7I62SEZ6.js";
47
+ import "./chunk-TLONRIPP.js";
48
+ import "./chunk-6U2SODK6.js";
49
+ import "./chunk-XJCGSPCT.js";
50
+ import "./chunk-YSZAKQIA.js";
51
+ import "./chunk-QHKPHGGR.js";
52
+ import "./chunk-WZ5YRUQU.js";
53
+ import "./chunk-FRPD55CU.js";
54
+ import "./chunk-4L5HUR2F.js";
55
+ import "./chunk-O5H5ZG2O.js";
27
56
  import {
28
57
  writeJsonEnvelope
29
58
  } from "./chunk-NX4EB2TK.js";
59
+ import "./chunk-SOPVIIUW.js";
60
+ import "./chunk-G4FG5EQO.js";
61
+ import "./chunk-CS4VA3GQ.js";
62
+ import "./chunk-CVAQZO4I.js";
30
63
  import {
64
+ ApiError,
31
65
  apiPost
32
66
  } from "./chunk-EHEPW3O2.js";
33
67
  import "./chunk-4OF7Q356.js";
@@ -42,7 +76,162 @@ import {
42
76
  import "./chunk-YQSBHWOI.js";
43
77
 
44
78
  // src/commands/ads/meta/draft.ts
79
+ import { defineCommand as defineCommand2 } from "citty";
80
+
81
+ // src/commands/ads/meta/draft-stage.ts
45
82
  import { defineCommand } from "citty";
83
+ var BATCH_MAX = 100;
84
+ var STAGE_DESCRIPTION = `Stage many Meta changes from ONE file, in one call \u2014 any mix of kinds, up to ${BATCH_MAX} ops.
85
+
86
+ Start here whenever a job is more than a few staged changes: N library pictures into M ad sets, a
87
+ set of ads, a campaign tree. Never loop the single commands from a script.
88
+ baker ads meta draft stage --file ops.json --account-id act_123
89
+
90
+ The file is a JSON array (or JSON Lines, one op per line). Each op is what the single commands
91
+ build \u2014 kind, accountId (or --account-id for all), target for a change to something that exists,
92
+ payload. A create can take a name in "as" (meta_temp_<anything>); later ops in the same file use
93
+ that name wherever a ref goes, and it becomes the real ref. Upload each picture once and reuse it:
94
+ {"kind":"media.upload","as":"meta_temp_img1","payload":{"kind":"image","bakerImageId":"<id>"}}
95
+ {"kind":"adCreative.create","as":"meta_temp_cr1","payload":{"creativeType":"single","page_id":"555",
96
+ "message":"\u2026","headline":"\u2026","link":"https://example.com","imageRef":"meta_temp_img1",
97
+ "call_to_action":{"type":"LEARN_MORE"}}}
98
+ {"kind":"ad.create","payload":{"name":"Ad 1","adset_id":"6123","creative":{"creative_id":"meta_temp_cr1"},"status":"PAUSED"}}
99
+ {"kind":"ad.create","payload":{"name":"Ad 1","adset_id":"6124","creative":{"creative_id":"meta_temp_cr1"},"status":"PAUSED"}}
100
+ Each kind's payload: \`baker schema ads meta <group> create\` (creatives create --variant placement for a
101
+ placement creative). Ops stage in file order, parents first.
102
+ Returns count, refs (each "as" \u2192 its real ref; later calls use the real ref) and only the ops that
103
+ carry a warning; --full lists every op.
104
+ All-or-nothing: an op refused at staging takes back the ops this file staged before it, and the
105
+ error names the op. Fix it and run the whole file again.
106
+ Then: baker ads meta draft`;
107
+ var FILE_ARG = {
108
+ type: "string",
109
+ description: "JSON array or JSON Lines of ops ({kind, accountId?, target?, payload?, as?}), path or inline"
110
+ };
111
+ var ACCOUNT_ARG = {
112
+ type: "string",
113
+ description: "Ad account (act_123) for every op that does not name its own"
114
+ };
115
+ var FULL_ARG = { type: "boolean", description: "List every staged op, not only those with a warning" };
116
+ registerSchema({
117
+ command: "ads.meta.draft.stage",
118
+ routes: ["POST /api/ads/meta/draft/stage", "POST /api/ads/meta/draft/remove"],
119
+ effect: "stage",
120
+ description: STAGE_DESCRIPTION,
121
+ args: {
122
+ file: { ...FILE_ARG, required: true },
123
+ "account-id": { ...ACCOUNT_ARG, required: false },
124
+ full: { ...FULL_ARG, required: false }
125
+ }
126
+ });
127
+ function withNames(value, names) {
128
+ if (typeof value === "string") return names.get(value) ?? value;
129
+ if (Array.isArray(value)) return value.map((item) => withNames(item, names));
130
+ if (value !== null && typeof value === "object") {
131
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, withNames(child, names)]));
132
+ }
133
+ return value;
134
+ }
135
+ function namesUsed(value, names) {
136
+ if (typeof value === "string") return names.has(value) ? [value] : [];
137
+ if (Array.isArray(value)) return value.flatMap((item) => namesUsed(item, names));
138
+ if (value !== null && typeof value === "object") return Object.values(value).flatMap((v) => namesUsed(v, names));
139
+ return [];
140
+ }
141
+ function fileOps(items, accountId) {
142
+ if (items.length === 0) {
143
+ failWriteValidation(
144
+ 'pass --file with the ops to stage: a JSON array (or JSON Lines) of {"kind","accountId"?,"target"?,"payload"?,"as"?}'
145
+ );
146
+ }
147
+ if (items.length > BATCH_MAX) {
148
+ failWriteValidation(`${items.length} ops exceeds the limit of ${BATCH_MAX} \u2014 split the file and run each part`);
149
+ }
150
+ const declared = /* @__PURE__ */ new Map();
151
+ for (const [index, item] of items.entries()) {
152
+ const { as: name } = item;
153
+ if (name === void 0) continue;
154
+ if (typeof name !== "string" || !TEMP_REF_REGEX.test(name)) {
155
+ failWriteValidation(`ops[${index}]: "as" must be meta_temp_<at least 4 letters or digits>, e.g. meta_temp_img1`);
156
+ }
157
+ if ("target" in item) {
158
+ failWriteValidation(`ops[${index}]: "as" names a create \u2014 a change to something that exists already has a ref`);
159
+ }
160
+ const earlier = declared.get(name);
161
+ if (earlier !== void 0) {
162
+ failWriteValidation(`ops[${index}]: ${name} already names ops[${earlier}] \u2014 give each create its own name`);
163
+ }
164
+ declared.set(name, index);
165
+ }
166
+ return items.map(({ as: name, ...rest }, index) => {
167
+ const later = new Set([...declared].filter(([, at]) => at >= index).map(([n]) => n));
168
+ const [early] = namesUsed(rest, later);
169
+ if (early !== void 0) {
170
+ failWriteValidation(
171
+ `ops[${index}] names ${early}, which ops[${declared.get(early)}] creates \u2014 put each create before the ops that name it`
172
+ );
173
+ }
174
+ const op = rest.accountId === void 0 && accountId ? { ...rest, accountId } : rest;
175
+ preflightOp(op, `ops[${index}] (${String(op.kind)}): `);
176
+ return { name: typeof name === "string" ? name : void 0, op };
177
+ });
178
+ }
179
+ async function takeBack(chatId, refs) {
180
+ for (const ref of [...refs].reverse()) {
181
+ await apiPost("/api/ads/meta/draft/remove", { chatId, ref }).catch(() => void 0);
182
+ }
183
+ }
184
+ async function refuseFile(chatId, staged, at, err) {
185
+ const created = new Set(staged.filter((entry) => !entry.amended).map((entry) => entry.ref));
186
+ const keeps = staged.some((entry) => entry.amended && !created.has(entry.ref));
187
+ if (!keeps) await takeBack(chatId, [...created]);
188
+ if (!(err instanceof ApiError)) handleMetaError(err);
189
+ const after = keeps ? `the ${staged.length} op(s) before it stay staged (${staged.map((entry) => entry.ref).join(", ")}) because one changed an op staged earlier \u2014 review with \`baker ads meta draft\`` : "nothing from this file stayed staged \u2014 fix that op and run the whole file again";
190
+ handleMetaError(new ApiError(err.code, `${at}: ${err.message} \u2014 ${after}`, err.fix));
191
+ }
192
+ async function stageFile(ops, full) {
193
+ const chatId = requireChatId();
194
+ const names = /* @__PURE__ */ new Map();
195
+ const staged = [];
196
+ const hints = [];
197
+ for (const [index, { name, op }] of ops.entries()) {
198
+ const resolved = withNames(op, names);
199
+ try {
200
+ const response = await apiPost("/api/ads/meta/draft/stage", { chatId, op: resolved });
201
+ staged.push(response.data);
202
+ hints.push(...response.hints ?? []);
203
+ if (name !== void 0) names.set(name, response.data.ref);
204
+ } catch (err) {
205
+ await refuseFile(chatId, staged, `ops[${index}] (${String(op.kind)})`, err);
206
+ }
207
+ }
208
+ const copy = await adCopyHints(ops.map(({ op }) => op.payload));
209
+ const shown = full ? staged : staged.filter((entry) => entry.warnings.length > 0);
210
+ const allHints = [.../* @__PURE__ */ new Set([...hints, ...copy])];
211
+ writeJsonEnvelope({
212
+ ok: true,
213
+ data: {
214
+ staged: true,
215
+ count: staged.length,
216
+ refs: Object.fromEntries(names),
217
+ ops: shown.map(({ ref, kind, summary, warnings }) => ({ ref, kind, summary, warnings }))
218
+ },
219
+ ...allHints.length > 0 ? { hints: allHints } : {}
220
+ });
221
+ }
222
+ var draftStageCommand = withEffect(
223
+ { effect: "stage", routes: ["POST /api/ads/meta/draft/stage", "POST /api/ads/meta/draft/remove"] },
224
+ defineCommand({
225
+ meta: { name: "stage", description: STAGE_DESCRIPTION },
226
+ args: { file: FILE_ARG, "account-id": ACCOUNT_ARG, full: FULL_ARG },
227
+ run: async ({ args }) => {
228
+ const items = loadJsonPayloads(args.file);
229
+ const needsAccount = items.some((item) => item.accountId === void 0);
230
+ const accountId = needsAccount ? await bareAccountId(args) : void 0;
231
+ await stageFile(fileOps(items, accountId), args.full === true);
232
+ }
233
+ })
234
+ );
46
235
 
47
236
  // src/commands/ads/meta/draft-status.ts
48
237
  var STATUS_HEADINGS = {
@@ -228,7 +417,7 @@ async function listDraft(json, chat, full = false, selector) {
228
417
  handleMetaError(err);
229
418
  }
230
419
  }
231
- var listCommand = defineCommand({
420
+ var listCommand = defineCommand2({
232
421
  meta: {
233
422
  name: "list",
234
423
  description: "Show every Meta write op staged in this chat, one line each (ref \xB7 kind \xB7 summary \xB7 parent ad set or campaign and its status \xB7 dependencies \xB7 post-publish result), with staged ads counted by their ad set's status; --json for the raw envelope, --full for every op's payload too. Publishing reaches the real ad account, so review this before you finish. Example: baker ads meta draft"
@@ -248,7 +437,7 @@ var listCommand = defineCommand({
248
437
  );
249
438
  }
250
439
  });
251
- var showCommand = defineCommand({
440
+ var showCommand = defineCommand2({
252
441
  meta: {
253
442
  name: "show",
254
443
  description: "Print the staged payload for one op \u2014 the receipt to verify a change looks right before publish. A list longer than 50 items (a customer list's members) prints as its count; --full prints every item. Example: baker ads meta draft show meta_temp_abc123"
@@ -273,7 +462,7 @@ var showCommand = defineCommand({
273
462
  }
274
463
  }
275
464
  });
276
- var removeCommand = defineCommand({
465
+ var removeCommand = defineCommand2({
277
466
  meta: {
278
467
  name: "remove",
279
468
  description: "Drop staged Meta ops \u2014 one, or many in one call. Removing a create cascades to everything that depends on it. Example: baker ads meta draft remove meta_temp_abc123 meta_temp_def456"
@@ -303,7 +492,7 @@ var removeCommand = defineCommand({
303
492
  }
304
493
  }
305
494
  });
306
- var clearCommand = defineCommand({
495
+ var clearCommand = defineCommand2({
307
496
  meta: {
308
497
  name: "clear",
309
498
  description: "Discard ALL staged Meta ops in this chat's draft \u2014 nothing will apply on publish. Example: baker ads meta draft clear"
@@ -324,10 +513,10 @@ withEffect({ effect: "read", routes: ["POST /api/ads/meta/draft"] }, listCommand
324
513
  withEffect({ effect: "read", routes: ["POST /api/ads/meta/draft/show"] }, showCommand);
325
514
  withEffect({ effect: "unstage", routes: ["POST /api/ads/meta/draft/remove"] }, removeCommand);
326
515
  withEffect({ effect: "unstage", routes: ["POST /api/ads/meta/draft/clear"] }, clearCommand);
327
- var metaDraftCommand = defineCommand({
516
+ var metaDraftCommand = defineCommand2({
328
517
  meta: {
329
518
  name: "draft",
330
- description: "Review and edit the Meta write ops staged in this chat BEFORE publish. Subcommands: list (default), show, remove, clear. Ops never hit Meta until the chat is published. `list` and `show` take --chat <id> to read an earlier chat's changes instead."
519
+ description: "Review and edit the Meta write ops staged in this chat BEFORE publish. Subcommands: list (default), show, remove, clear, and stage --file (many ops from one file in one call, names chaining creates). Ops never hit Meta until the chat is published. `list` and `show` take --chat <id> to read an earlier chat's changes instead."
331
520
  },
332
521
  // Declared on the parent too: `default: "list"` dispatches the bare `draft --chat <id>` form, and
333
522
  // citty prints help for a flag the parent does not know instead of forwarding it.
@@ -337,7 +526,13 @@ var metaDraftCommand = defineCommand({
337
526
  chat: CHAT_READ_ARG,
338
527
  where: LIST_WHERE_ARG
339
528
  },
340
- subCommands: { list: listCommand, show: showCommand, remove: removeCommand, clear: clearCommand },
529
+ subCommands: {
530
+ list: listCommand,
531
+ show: showCommand,
532
+ remove: removeCommand,
533
+ clear: clearCommand,
534
+ stage: draftStageCommand
535
+ },
341
536
  // `default` (not `run`) dispatches the bare invocation: citty falls through to `run`
342
537
  // after dispatching a subcommand, so a `run` here would list the draft a second time
343
538
  // on every `draft list` / `draft remove` / `draft clear`.
@@ -346,4 +541,4 @@ var metaDraftCommand = defineCommand({
346
541
  export {
347
542
  metaDraftCommand
348
543
  };
349
- //# sourceMappingURL=draft-UU3F2VMJ.js.map
544
+ //# sourceMappingURL=draft-H744DU5T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/ads/meta/draft.ts","../src/commands/ads/meta/draft-stage.ts","../src/commands/ads/meta/draft-status.ts"],"sourcesContent":["import type {\n MetaDraftClearResponse,\n MetaDraftListResponse,\n MetaDraftRemoveResponse,\n MetaDraftShowResponse,\n} from \"@baker/api/ads-meta\";\nimport { defineCommand } from \"citty\";\nimport { apiPost } from \"../../../client.ts\";\nimport { requireChatId, resolveChatId } from \"../../../env.ts\";\nimport { registerSchema, withEffect } from \"../../../schemas.ts\";\nimport { CHAT_READ_ARG, DRAFT_FULL_ARG } from \"../../chat-arg.ts\";\nimport { draftRefs, removeDraftRefs } from \"../../draft-refs.ts\";\nimport { draftListWhere, LIST_WHERE_ARG, requireDraftWhere, wholeDraftHints } from \"../../draft-where.ts\";\nimport { SHOW_FULL_ARG, showEnvelope } from \"../draft-show.ts\";\nimport { hintLines, withHints } from \"../hints.ts\";\nimport { writeJsonEnvelope } from \"../output.ts\";\nimport { draftStageCommand } from \"./draft-stage.ts\";\nimport { renderDraftStatus } from \"./draft-status.ts\";\nimport { handleMetaError } from \"./shared.ts\";\n\nregisterSchema({\n command: \"ads.meta.draft\",\n routes: [\"POST /api/ads/meta/draft\"],\n effect: \"read\",\n description:\n \"Review every Meta op staged on this chat, one line each: ref · kind · summary · the ad set (or campaign) a staged ad (or ad set) goes into with the status it publishes under · what it waits on · ✗ blocked: <why> when publish would now refuse it, and after a publish ✓ applied → id or ✗ failed: <error>. `draft show <ref>` prints one op's payload (--full for lists over 50 items).\",\n args: {\n json: { type: \"boolean\", description: \"Raw JSON envelope instead of the readable list\", required: false },\n full: { type: \"boolean\", description: DRAFT_FULL_ARG.description, required: false },\n chat: { type: \"string\", description: \"Read another chat's draft instead of this one\", required: false },\n where: LIST_WHERE_ARG,\n },\n});\n\n/**\n * The readable one-line-per-op view is the default, like the Google, LinkedIn and X drafts;\n * `--json` (or `--output json`) returns the raw envelope for tools.\n */\nasync function listDraft(json: boolean, chat?: unknown, full = false, selector?: string): Promise<void> {\n const where = selector === undefined ? undefined : requireDraftWhere(selector);\n try {\n const chatId = resolveChatId(chat);\n const response = await apiPost<{ ok: boolean; data?: MetaDraftListResponse }>(\"/api/ads/meta/draft\", {\n chatId,\n ...(full || where ? { full: true } : {}),\n });\n if (where && selector !== undefined && response.ok && response.data) {\n const narrowed = draftListWhere(response.data, where, selector);\n writeJsonEnvelope(withHints({ ...response, data: narrowed.data }, narrowed.hints));\n return;\n }\n if (json || full || !response.ok || !response.data) {\n const whole = response.ok && response.data ? wholeDraftHints(response.data.ops, \"baker ads meta draft list\") : [];\n writeJsonEnvelope(withHints(response, whole));\n return;\n }\n process.stdout.write(`${renderDraftStatus(response.data)}${hintLines(response)}\\n`);\n } catch (err) {\n handleMetaError(err);\n }\n}\n\nconst listCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"Show every Meta write op staged in this chat, one line each (ref · kind · summary · parent ad set or campaign and its status · dependencies · post-publish result), with staged ads counted by their ad set's status; --json for the raw envelope, --full for every op's payload too. Publishing reaches the real ad account, so review this before you finish. Example: baker ads meta draft\",\n },\n args: {\n json: { type: \"boolean\", description: \"Print the raw JSON envelope instead of the readable list\" },\n full: DRAFT_FULL_ARG,\n chat: CHAT_READ_ARG,\n where: LIST_WHERE_ARG,\n },\n run: async ({ args }) => {\n await listDraft(\n args.json === true,\n args.chat,\n args.full === true,\n typeof args.where === \"string\" ? args.where : undefined,\n );\n },\n});\n\nconst showCommand = defineCommand({\n meta: {\n name: \"show\",\n description:\n \"Print the staged payload for one op — the receipt to verify a change looks right before publish. A list longer than 50 items (a customer list's members) prints as its count; --full prints every item. Example: baker ads meta draft show meta_temp_abc123\",\n },\n args: {\n ref: { type: \"positional\", description: \"Op ref (meta_temp_* for creates, target id for updates)\", required: true },\n // `show` always prints the envelope; `--json` is the spelling `list` taught, so it is accepted here too.\n json: { type: \"boolean\", description: \"Accepted for symmetry with list; show always prints the JSON envelope\" },\n chat: CHAT_READ_ARG,\n full: SHOW_FULL_ARG,\n },\n run: async ({ args }) => {\n try {\n const chatId = resolveChatId(args.chat);\n const response = await apiPost<{ ok: true; data: MetaDraftShowResponse }>(\"/api/ads/meta/draft/show\", {\n chatId,\n ref: args.ref,\n });\n writeJsonEnvelope(showEnvelope(response, args.full === true));\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nconst removeCommand = defineCommand({\n meta: {\n name: \"remove\",\n description:\n \"Drop staged Meta ops — one, or many in one call. Removing a create cascades to everything that depends on it. Example: baker ads meta draft remove meta_temp_abc123 meta_temp_def456\",\n },\n args: {\n ref: {\n type: \"positional\",\n description: \"Op ref(s) (meta_temp_* for creates, target id for updates) — several, space- or comma-separated\",\n required: true,\n },\n },\n run: async ({ args }) => {\n const refs = draftRefs(args._);\n if (refs.length > 1) {\n await removeDraftRefs(\"/api/ads/meta/draft/remove\", refs);\n return;\n }\n try {\n const chatId = requireChatId();\n const response = await apiPost<{ ok: true; data: MetaDraftRemoveResponse }>(\"/api/ads/meta/draft/remove\", {\n chatId,\n ref: args.ref,\n });\n writeJsonEnvelope(response);\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nconst clearCommand = defineCommand({\n meta: {\n name: \"clear\",\n description:\n \"Discard ALL staged Meta ops in this chat's draft — nothing will apply on publish. Example: baker ads meta draft clear\",\n },\n run: async () => {\n try {\n const chatId = requireChatId();\n const response = await apiPost<{ ok: true; data: MetaDraftClearResponse }>(\"/api/ads/meta/draft/clear\", {\n chatId,\n });\n writeJsonEnvelope(response);\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nwithEffect({ effect: \"read\", routes: [\"POST /api/ads/meta/draft\"] }, listCommand);\nwithEffect({ effect: \"read\", routes: [\"POST /api/ads/meta/draft/show\"] }, showCommand);\nwithEffect({ effect: \"unstage\", routes: [\"POST /api/ads/meta/draft/remove\"] }, removeCommand);\nwithEffect({ effect: \"unstage\", routes: [\"POST /api/ads/meta/draft/clear\"] }, clearCommand);\n\nexport const metaDraftCommand = defineCommand({\n meta: {\n name: \"draft\",\n description:\n \"Review and edit the Meta write ops staged in this chat BEFORE publish. Subcommands: list (default), show, remove, clear, and stage --file (many ops from one file in one call, names chaining creates). Ops never hit Meta until the chat is published. `list` and `show` take --chat <id> to read an earlier chat's changes instead.\",\n },\n // Declared on the parent too: `default: \"list\"` dispatches the bare `draft --chat <id>` form, and\n // citty prints help for a flag the parent does not know instead of forwarding it.\n args: {\n json: { type: \"boolean\", description: \"Print the raw JSON envelope instead of the readable list\" },\n full: DRAFT_FULL_ARG,\n chat: CHAT_READ_ARG,\n where: LIST_WHERE_ARG,\n },\n subCommands: {\n list: listCommand,\n show: showCommand,\n remove: removeCommand,\n clear: clearCommand,\n stage: draftStageCommand,\n },\n // `default` (not `run`) dispatches the bare invocation: citty falls through to `run`\n // after dispatching a subcommand, so a `run` here would list the draft a second time\n // on every `draft list` / `draft remove` / `draft clear`.\n default: \"list\",\n});\n","import { type MetaDraftOpInput, type MetaDraftStageResponse, TEMP_REF_REGEX } from \"@baker/api/ads-meta\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiPost } from \"../../../client.ts\";\nimport { requireChatId } from \"../../../env.ts\";\nimport { registerSchema, withEffect } from \"../../../schemas.ts\";\nimport { adCopyHints } from \"../copy-hints.ts\";\nimport { loadJsonPayloads } from \"../google/write-shared.ts\";\nimport { writeJsonEnvelope } from \"../output.ts\";\nimport { handleMetaError } from \"./shared.ts\";\nimport { bareAccountId, failWriteValidation, preflightOp } from \"./write-shared.ts\";\n\n/**\n * `draft stage --file`: many Meta ops from one file, in one command. Pictures into ad sets is three\n * ops per ad (upload, creative, ad), each needing the ref the one before it returned, so without this\n * the agent wrote a script looping the CLI and parsing every envelope. Each op still goes through the\n * one-op stage route — Meta staging dry-runs each change, so a whole tree in one request would\n * outlast the request — but the names are resolved here, and a refusal takes back what the file\n * staged before it.\n */\n\nconst BATCH_MAX = 100;\n\nconst STAGE_DESCRIPTION = `Stage many Meta changes from ONE file, in one call — any mix of kinds, up to ${BATCH_MAX} ops.\n\nStart here whenever a job is more than a few staged changes: N library pictures into M ad sets, a\nset of ads, a campaign tree. Never loop the single commands from a script.\n baker ads meta draft stage --file ops.json --account-id act_123\n\nThe file is a JSON array (or JSON Lines, one op per line). Each op is what the single commands\nbuild — kind, accountId (or --account-id for all), target for a change to something that exists,\npayload. A create can take a name in \"as\" (meta_temp_<anything>); later ops in the same file use\nthat name wherever a ref goes, and it becomes the real ref. Upload each picture once and reuse it:\n {\"kind\":\"media.upload\",\"as\":\"meta_temp_img1\",\"payload\":{\"kind\":\"image\",\"bakerImageId\":\"<id>\"}}\n {\"kind\":\"adCreative.create\",\"as\":\"meta_temp_cr1\",\"payload\":{\"creativeType\":\"single\",\"page_id\":\"555\",\n \"message\":\"…\",\"headline\":\"…\",\"link\":\"https://example.com\",\"imageRef\":\"meta_temp_img1\",\n \"call_to_action\":{\"type\":\"LEARN_MORE\"}}}\n {\"kind\":\"ad.create\",\"payload\":{\"name\":\"Ad 1\",\"adset_id\":\"6123\",\"creative\":{\"creative_id\":\"meta_temp_cr1\"},\"status\":\"PAUSED\"}}\n {\"kind\":\"ad.create\",\"payload\":{\"name\":\"Ad 1\",\"adset_id\":\"6124\",\"creative\":{\"creative_id\":\"meta_temp_cr1\"},\"status\":\"PAUSED\"}}\nEach kind's payload: \\`baker schema ads meta <group> create\\` (creatives create --variant placement for a\nplacement creative). Ops stage in file order, parents first.\nReturns count, refs (each \"as\" → its real ref; later calls use the real ref) and only the ops that\ncarry a warning; --full lists every op.\nAll-or-nothing: an op refused at staging takes back the ops this file staged before it, and the\nerror names the op. Fix it and run the whole file again.\nThen: baker ads meta draft`;\n\nconst FILE_ARG = {\n type: \"string\",\n description: \"JSON array or JSON Lines of ops ({kind, accountId?, target?, payload?, as?}), path or inline\",\n} as const;\nconst ACCOUNT_ARG = {\n type: \"string\",\n description: \"Ad account (act_123) for every op that does not name its own\",\n} as const;\nconst FULL_ARG = { type: \"boolean\", description: \"List every staged op, not only those with a warning\" } as const;\n\nregisterSchema({\n command: \"ads.meta.draft.stage\",\n routes: [\"POST /api/ads/meta/draft/stage\", \"POST /api/ads/meta/draft/remove\"],\n effect: \"stage\",\n description: STAGE_DESCRIPTION,\n args: {\n file: { ...FILE_ARG, required: true },\n \"account-id\": { ...ACCOUNT_ARG, required: false },\n full: { ...FULL_ARG, required: false },\n },\n});\n\ninterface FileOp {\n name?: string;\n op: Record<string, unknown>;\n}\n\n/** Every string in `value` equal to a key of `names`, swapped for its value: same shape otherwise. */\nfunction withNames(value: unknown, names: ReadonlyMap<string, string>): unknown {\n if (typeof value === \"string\") return names.get(value) ?? value;\n if (Array.isArray(value)) return value.map((item) => withNames(item, names));\n if (value !== null && typeof value === \"object\") {\n return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, withNames(child, names)]));\n }\n return value;\n}\n\n/** The strings in `value` that a later op in the file names: refused, since that op is not staged yet. */\nfunction namesUsed(value: unknown, names: ReadonlySet<string>): string[] {\n if (typeof value === \"string\") return names.has(value) ? [value] : [];\n if (Array.isArray(value)) return value.flatMap((item) => namesUsed(item, names));\n if (value !== null && typeof value === \"object\") return Object.values(value).flatMap((v) => namesUsed(v, names));\n return [];\n}\n\n/** The file's ops, each with its name split off and the account filled in; the names checked before anything stages. */\nexport function fileOps(items: ReadonlyArray<Record<string, unknown>>, accountId: string | undefined): FileOp[] {\n if (items.length === 0) {\n failWriteValidation(\n 'pass --file with the ops to stage: a JSON array (or JSON Lines) of {\"kind\",\"accountId\"?,\"target\"?,\"payload\"?,\"as\"?}',\n );\n }\n if (items.length > BATCH_MAX) {\n failWriteValidation(`${items.length} ops exceeds the limit of ${BATCH_MAX} — split the file and run each part`);\n }\n const declared = new Map<string, number>();\n for (const [index, item] of items.entries()) {\n const { as: name } = item;\n if (name === undefined) continue;\n if (typeof name !== \"string\" || !TEMP_REF_REGEX.test(name)) {\n failWriteValidation(`ops[${index}]: \"as\" must be meta_temp_<at least 4 letters or digits>, e.g. meta_temp_img1`);\n }\n if (\"target\" in item) {\n failWriteValidation(`ops[${index}]: \"as\" names a create — a change to something that exists already has a ref`);\n }\n const earlier = declared.get(name);\n if (earlier !== undefined) {\n failWriteValidation(`ops[${index}]: ${name} already names ops[${earlier}] — give each create its own name`);\n }\n declared.set(name, index);\n }\n return items.map(({ as: name, ...rest }, index) => {\n const later = new Set([...declared].filter(([, at]) => at >= index).map(([n]) => n));\n const [early] = namesUsed(rest, later);\n if (early !== undefined) {\n failWriteValidation(\n `ops[${index}] names ${early}, which ops[${declared.get(early)}] creates — put each create before the ops that name it`,\n );\n }\n const op = rest.accountId === undefined && accountId ? { ...rest, accountId } : rest;\n preflightOp(op, `ops[${index}] (${String(op.kind)}): `);\n return { name: typeof name === \"string\" ? name : undefined, op };\n });\n}\n\ninterface StageEnvelope {\n ok: true;\n data: MetaDraftStageResponse;\n hints?: string[];\n}\n\n/** Drops what this file staged, newest first. A ref a cascade already took is not an error. */\nasync function takeBack(chatId: string, refs: readonly string[]): Promise<void> {\n for (const ref of [...refs].reverse()) {\n await apiPost(\"/api/ads/meta/draft/remove\", { chatId, ref }).catch(() => undefined);\n }\n}\n\n/**\n * A refused op ends the file: what it staged before is taken back, unless one of those ops amended an\n * op staged before this file ran, which removing cannot undo. The refusal names the op either way.\n */\nasync function refuseFile(\n chatId: string,\n staged: readonly MetaDraftStageResponse[],\n at: string,\n err: unknown,\n): Promise<never> {\n const created = new Set(staged.filter((entry) => !entry.amended).map((entry) => entry.ref));\n const keeps = staged.some((entry) => entry.amended && !created.has(entry.ref));\n if (!keeps) await takeBack(chatId, [...created]);\n if (!(err instanceof ApiError)) handleMetaError(err);\n const after = keeps\n ? `the ${staged.length} op(s) before it stay staged (${staged.map((entry) => entry.ref).join(\", \")}) because one changed an op staged earlier — review with \\`baker ads meta draft\\``\n : \"nothing from this file stayed staged — fix that op and run the whole file again\";\n handleMetaError(new ApiError(err.code, `${at}: ${err.message} — ${after}`, err.fix));\n}\n\nasync function stageFile(ops: readonly FileOp[], full: boolean): Promise<void> {\n const chatId = requireChatId();\n const names = new Map<string, string>();\n const staged: MetaDraftStageResponse[] = [];\n const hints: string[] = [];\n for (const [index, { name, op }] of ops.entries()) {\n const resolved = withNames(op, names) as MetaDraftOpInput;\n try {\n const response = await apiPost<StageEnvelope>(\"/api/ads/meta/draft/stage\", { chatId, op: resolved });\n staged.push(response.data);\n hints.push(...(response.hints ?? []));\n if (name !== undefined) names.set(name, response.data.ref);\n } catch (err) {\n await refuseFile(chatId, staged, `ops[${index}] (${String(op.kind)})`, err);\n }\n }\n const copy = await adCopyHints(ops.map(({ op }) => op.payload));\n const shown = full ? staged : staged.filter((entry) => entry.warnings.length > 0);\n const allHints = [...new Set([...hints, ...copy])];\n writeJsonEnvelope({\n ok: true,\n data: {\n staged: true,\n count: staged.length,\n refs: Object.fromEntries(names),\n ops: shown.map(({ ref, kind, summary, warnings }) => ({ ref, kind, summary, warnings })),\n },\n ...(allHints.length > 0 ? { hints: allHints } : {}),\n });\n}\n\nexport const draftStageCommand = withEffect(\n { effect: \"stage\", routes: [\"POST /api/ads/meta/draft/stage\", \"POST /api/ads/meta/draft/remove\"] },\n defineCommand({\n meta: { name: \"stage\", description: STAGE_DESCRIPTION },\n args: { file: FILE_ARG, \"account-id\": ACCOUNT_ARG, full: FULL_ARG },\n run: async ({ args }) => {\n const items = loadJsonPayloads(args.file);\n const needsAccount = items.some((item) => item.accountId === undefined);\n const accountId = needsAccount ? await bareAccountId(args as Record<string, unknown>) : undefined;\n await stageFile(fileOps(items, accountId), args.full === true);\n },\n }),\n);\n","import type { MetaDraftListResponse, MetaDraftOpView } from \"@baker/api/ads-meta\";\n\n/**\n * Render the staged Meta draft as one line per op — ref, kind, summary, what it\n * waits on and, after a publish, what happened to it. The Google, LinkedIn and\n * X drafts already print a readable view by default; Meta printed the pretty\n * JSON envelope, and agents piped every read through python to get these same\n * columns back. Pure: takes the draft-list response, returns text.\n */\n\nconst STATUS_HEADINGS: Record<MetaDraftListResponse[\"status\"], string> = {\n active: \"staged\",\n publishing: \"publishing\",\n applied: \"published\",\n partial: \"published with failures\",\n discarded: \"discarded\",\n none: \"none\",\n};\n\nfunction plural(count: number, word: string): string {\n return `${count} ${word}${count === 1 ? \"\" : \"s\"}`;\n}\n\nfunction headingLine(draft: MetaDraftListResponse): string {\n const heading = STATUS_HEADINGS[draft.status];\n if (draft.status === \"active\" || draft.status === \"discarded\") {\n return `Meta Ads — ${plural(draft.count, \"change\")} ${heading} · ${draft.mode}`;\n }\n const counts = new Map<string, number>();\n for (const op of draft.ops) {\n const status = op.result?.status ?? \"pending\";\n counts.set(status, (counts.get(status) ?? 0) + 1);\n }\n const summary = [...counts].map(([status, count]) => `${count} ${status}`).join(\", \");\n return `Meta Ads — ${heading} · ${summary} · ${draft.mode}`;\n}\n\n/** A failed op: why, and what of it already reached Meta. */\nfunction failedPart(result: NonNullable<MetaDraftOpView[\"result\"]>): string {\n const landed = result.landed ? ` (${result.landed})` : \"\";\n return `✗ failed: ${result.error ?? \"no reason recorded\"}${landed}`;\n}\n\nfunction resultPart(op: MetaDraftOpView): string | undefined {\n const result = op.result;\n if (!result) {\n return undefined;\n }\n if (result.status === \"failed\") {\n return failedPart(result);\n }\n if (result.status === \"skipped\") {\n // Publish records either the dependency ref that did not apply or a plain reason; either way the op is finished.\n const because = result.skippedBecause;\n if (because && op.dependsOn.includes(because)) {\n return `✗ skipped: ${because} did not apply`;\n }\n return `✗ skipped: ${because ?? \"a change it needs did not apply\"}`;\n }\n const id = result.id ?? result.hash;\n const applied = `✓ ${result.status}${id ? ` → ${id}` : \"\"}`;\n const verification = result.verification;\n if (verification && verification.status !== \"confirmed\") {\n return `${applied} (read-back ${verification.status}${verification.note ? `: ${verification.note}` : \"\"})`;\n }\n return applied;\n}\n\nconst PARENT_WORD: Record<string, string> = {\n \"ad.create\": \"ad set\",\n \"ad.copy\": \"ad set\",\n \"adSet.create\": \"campaign\",\n \"adSet.copy\": \"campaign\",\n};\n\nconst STAGED_AD_KINDS: ReadonlySet<string> = new Set([\"ad.create\", \"ad.copy\"]);\n\n/** Where a staged ad (or ad set) goes, and the status that parent publishes with. */\nfunction parentPart(op: MetaDraftOpView): string | undefined {\n const parent = op.parent;\n if (!parent) {\n return undefined;\n }\n const word = PARENT_WORD[op.kind] ?? \"parent\";\n const named = parent.name ? `\"${parent.name}\" (${parent.ref})` : parent.ref;\n const staged = parent.staged ? \", staged here\" : \"\";\n const status = parent.status\n ? `${parent.statusBefore ? `${parent.statusBefore} → ` : \"\"}${parent.status}`\n : \"status not recorded\";\n return `in ${word} ${named}${staged} ${status}`;\n}\n\n/** \"Which staged ads will run\" in one line: ads counted by the status of the ad set they go into. */\nfunction adParentStatusLine(ops: readonly MetaDraftOpView[]): string | undefined {\n const counts = new Map<string, number>();\n for (const op of ops) {\n if (STAGED_AD_KINDS.has(op.kind) && op.parent) {\n const status = op.parent.status ?? \"not recorded\";\n counts.set(status, (counts.get(status) ?? 0) + 1);\n }\n }\n if (counts.size === 0) {\n return undefined;\n }\n return `Staged ads by ad set status: ${[...counts].map(([status, count]) => `${count} ${status}`).join(\", \")}`;\n}\n\nfunction readinessLine(ops: readonly MetaDraftOpView[]): string {\n const blocked = ops.filter((op) => op.blocked);\n if (blocked.length === 0) {\n return \"Every change passed its checks when staged — no need to re-check them.\";\n }\n // A first publish holds every change beside a refused one; only the refused ones need fixing.\n const heldBack = blocked.filter((op) => op.heldBack).length;\n const refused = blocked.length - heldBack;\n const held =\n heldBack === 0\n ? \"\"\n : `; the other ${plural(heldBack, \"change\")} ${heldBack === 1 ? \"is\" : \"are\"} held back with ${refused === 1 ? \"it\" : \"them\"} and need${heldBack === 1 ? \"s\" : \"\"} nothing`;\n return `${plural(refused, \"change\")} passed its checks when staged but would be refused now (✗ blocked below) — fix or remove ${refused === 1 ? \"it\" : \"them\"} before publishing${held}.`;\n}\n\nfunction opLine(op: MetaDraftOpView, showAccount: boolean): string {\n const parts = [op.ref, op.kind, op.summary];\n if (op.target && op.target !== op.ref) {\n parts.push(`target ${op.target}`);\n }\n if (showAccount) {\n parts.push(`account ${op.accountId}`);\n }\n const parent = parentPart(op);\n if (parent) {\n parts.push(parent);\n }\n if (op.dependsOn.length > 0) {\n parts.push(`after ${op.dependsOn.join(\", \")}`);\n }\n if (op.blocked) {\n parts.push(`✗ blocked: ${op.blocked}`);\n }\n const result = resultPart(op);\n if (result) {\n parts.push(result);\n }\n // Creative copy and provider errors can carry line breaks; one op stays one line.\n return ` ${parts.join(\" · \").replace(/[\\r\\n]+/g, \" \")}`;\n}\n\nexport function renderDraftStatus(draft: MetaDraftListResponse): string {\n if (draft.status === \"none\" || draft.count === 0) {\n return \"No staged Meta changes on this chat.\";\n }\n const lines = [headingLine(draft)];\n if (draft.status === \"active\") {\n lines.push(\"Publishing makes every change real on the ad account.\", readinessLine(draft.ops));\n }\n const adParents = adParentStatusLine(draft.ops);\n if (adParents) {\n lines.push(adParents);\n }\n lines.push(\"\");\n // A draft may span several ad accounts; the account is only noise when there is one.\n const showAccount = new Set(draft.ops.map((op) => op.accountId)).size > 1;\n for (const op of draft.ops) {\n lines.push(opLine(op, showAccount));\n }\n if (draft.advisories.length > 0) {\n lines.push(\"\", \"Advisories\");\n for (const advisory of draft.advisories) {\n lines.push(` ! ${advisory.ref}: ${advisory.message}`);\n }\n }\n lines.push(\n \"\",\n \"Staged payload for one op: baker ads meta draft show <ref> (--full for lists over 50 items) · raw envelope: --json\",\n );\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM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AAA;AAAA,EAIA,SAAS;AACX,CAAC;","names":["defineCommand","defineCommand"]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  placementFormatNote,
3
3
  previewFormatForPosition
4
- } from "./chunk-3R62EYYX.js";
4
+ } from "./chunk-47SIB7JD.js";
5
5
  import "./chunk-GDFJOCDO.js";
6
6
  import {
7
7
  csvOrJson,
@@ -1224,4 +1224,4 @@ export {
1224
1224
  insightsCommand,
1225
1225
  wantsAsync
1226
1226
  };
1227
- //# sourceMappingURL=insights-QU5A4XBO.js.map
1227
+ //# sourceMappingURL=insights-54KZY55Q.js.map
@@ -6,8 +6,8 @@ import {
6
6
  mergePayload,
7
7
  requireTarget,
8
8
  stageOp
9
- } from "./chunk-OMJ7DVFJ.js";
10
- import "./chunk-3R62EYYX.js";
9
+ } from "./chunk-6BMO6ZH6.js";
10
+ import "./chunk-47SIB7JD.js";
11
11
  import "./chunk-GDFJOCDO.js";
12
12
  import {
13
13
  csvOrJson,
@@ -265,4 +265,4 @@ export {
265
265
  instantExperiencesCreateCommand,
266
266
  instantExperiencesUpdateCommand
267
267
  };
268
- //# sourceMappingURL=instant-experiences-EJWYFWDT.js.map
268
+ //# sourceMappingURL=instant-experiences-Y2F6IWIY.js.map
@@ -8,10 +8,10 @@ import {
8
8
  requireTarget,
9
9
  stageOp,
10
10
  upper
11
- } from "./chunk-OMJ7DVFJ.js";
11
+ } from "./chunk-6BMO6ZH6.js";
12
12
  import {
13
13
  isMetaLeadAdsRefusal
14
- } from "./chunk-3R62EYYX.js";
14
+ } from "./chunk-47SIB7JD.js";
15
15
  import "./chunk-GDFJOCDO.js";
16
16
  import {
17
17
  csvOrJson,
@@ -572,4 +572,4 @@ export {
572
572
  leadPageHints,
573
573
  leadsCommand
574
574
  };
575
- //# sourceMappingURL=leads-FEEWX7OO.js.map
575
+ //# sourceMappingURL=leads-ZVFKPQK2.js.map
@@ -1294,13 +1294,9 @@ registerSchema({
1294
1294
  registerSchema({
1295
1295
  command: "ads.linkedin.preview",
1296
1296
  ...live("POST /api/ads/linkedin/preview"),
1297
- description: "See existing ads as LinkedIn renders them in the feed, desktop and mobile: shownText (the text people see, in order) plus a picture of each for visual questions. Check it before saying how an ad looks. Several ads are one call (`preview 1611562694 1611562695`), never a loop.",
1297
+ description: "See an existing ad as LinkedIn renders it in the feed, desktop and mobile: shownText (the text people see, in order) plus a picture of each for visual questions. Check it before saying how an ad looks.",
1298
1298
  args: {
1299
- id: {
1300
- type: "positional",
1301
- description: "Creative id or urn:li:sponsoredCreative:N \u2014 several, space- or comma-separated",
1302
- required: true
1303
- },
1299
+ id: { type: "positional", description: "Creative id or urn:li:sponsoredCreative:N", required: true },
1304
1300
  "account-id": { type: "string", description: "Account ID", required: false },
1305
1301
  "account-urn": { type: "string", description: "Alias", required: false },
1306
1302
  placement: { type: "string", description: "desktop|mobile|both (default both)", required: false },
@@ -1489,7 +1485,7 @@ Full guide: __tooling__/docs/tools/baker/ads-linkedin.md`
1489
1485
  "campaign-groups": () => import("./campaign-groups-VBOFSUJS.js").then((m) => m.campaignGroupsCommand),
1490
1486
  campaigns: () => import("./campaigns-YFB3PCLE.js").then((m) => m.campaignsCommand),
1491
1487
  creatives: () => import("./creatives-D5WLUJWC.js").then((m) => m.creativesCommand),
1492
- preview: () => import("./preview-TTIHEWK6.js").then((m) => m.previewCommand),
1488
+ preview: () => import("./preview-HD3QAR53.js").then((m) => m.previewCommand),
1493
1489
  audiences: () => import("./write-commands-X72A5F7K.js").then((m) => m.audiencesCommand),
1494
1490
  "lead-forms": () => import("./write-commands-X72A5F7K.js").then((m) => m.leadFormsCommand),
1495
1491
  experiments: () => import("./experiments-VYYS5Y7W.js").then((m) => m.experimentsCommand),
@@ -1514,4 +1510,4 @@ Full guide: __tooling__/docs/tools/baker/ads-linkedin.md`
1514
1510
  export {
1515
1511
  linkedinCommand
1516
1512
  };
1517
- //# sourceMappingURL=linkedin-OZGEZLN5.js.map
1513
+ //# sourceMappingURL=linkedin-EBOTX37R.js.map