@koda-sl/baker-cli 0.174.0-dev.ad43411a1 → 0.176.0-dev.afc31fdb4

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 (28) hide show
  1. package/README.md +11 -0
  2. package/dist/{chunk-7I2POXSJ.js → chunk-K3PWXVF7.js} +2 -2
  3. package/dist/{chunk-7QMWNMRW.js → chunk-PXXJ3HJW.js} +4 -4
  4. package/dist/{chunk-K424D3CY.js → chunk-QPVJGKV7.js} +3 -3
  5. package/dist/{chunk-TFPZLUVM.js → chunk-X5C6HE24.js} +5 -5
  6. package/dist/chunk-X5C6HE24.js.map +1 -0
  7. package/dist/{chunk-RK67WL4O.js → chunk-YL3HDEIJ.js} +6 -2
  8. package/dist/{chunk-RK67WL4O.js.map → chunk-YL3HDEIJ.js.map} +1 -1
  9. package/dist/{chunk-ZH6ZNYPB.js → chunk-ZWYQIEBI.js} +3 -3
  10. package/dist/cli.js +181 -71
  11. package/dist/cli.js.map +1 -1
  12. package/dist/client-PJ7ID35L.js +15 -0
  13. package/dist/engine/index.js +3 -3
  14. package/dist/env-6QJCMTRK.js +13 -0
  15. package/dist/{output-FL7WRIJF.js → output-NWX3YW64.js} +5 -5
  16. package/dist/{shared-OIYLDW3G.js → shared-5ZEOG664.js} +6 -6
  17. package/package.json +1 -1
  18. package/dist/chunk-TFPZLUVM.js.map +0 -1
  19. package/dist/client-XRQWOADV.js +0 -15
  20. package/dist/env-3JMYIH25.js +0 -11
  21. /package/dist/{chunk-7I2POXSJ.js.map → chunk-K3PWXVF7.js.map} +0 -0
  22. /package/dist/{chunk-7QMWNMRW.js.map → chunk-PXXJ3HJW.js.map} +0 -0
  23. /package/dist/{chunk-K424D3CY.js.map → chunk-QPVJGKV7.js.map} +0 -0
  24. /package/dist/{chunk-ZH6ZNYPB.js.map → chunk-ZWYQIEBI.js.map} +0 -0
  25. /package/dist/{client-XRQWOADV.js.map → client-PJ7ID35L.js.map} +0 -0
  26. /package/dist/{env-3JMYIH25.js.map → env-6QJCMTRK.js.map} +0 -0
  27. /package/dist/{output-FL7WRIJF.js.map → output-NWX3YW64.js.map} +0 -0
  28. /package/dist/{shared-OIYLDW3G.js.map → shared-5ZEOG664.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  toModelSafeImage,
37
37
  ulid,
38
38
  validateCanvasDeep
39
- } from "./chunk-K424D3CY.js";
39
+ } from "./chunk-QPVJGKV7.js";
40
40
  import {
41
41
  csvOrJson,
42
42
  daysAgoIso,
@@ -45,7 +45,7 @@ import {
45
45
  resolveAccountIdArg,
46
46
  resolveEffectiveStatus,
47
47
  todayIso
48
- } from "./chunk-7QMWNMRW.js";
48
+ } from "./chunk-PXXJ3HJW.js";
49
49
  import {
50
50
  buildQueryCacheKey,
51
51
  cacheGet,
@@ -61,21 +61,22 @@ import {
61
61
  writeAdsJson,
62
62
  writeAdsOutput,
63
63
  writeJsonEnvelope
64
- } from "./chunk-TFPZLUVM.js";
64
+ } from "./chunk-X5C6HE24.js";
65
65
  import {
66
66
  ApiError,
67
67
  apiGet,
68
68
  apiPost,
69
69
  validateConvexId
70
- } from "./chunk-ZH6ZNYPB.js";
70
+ } from "./chunk-ZWYQIEBI.js";
71
71
  import {
72
72
  installStreamTaps,
73
73
  logInvocation
74
- } from "./chunk-7I2POXSJ.js";
74
+ } from "./chunk-K3PWXVF7.js";
75
75
  import {
76
76
  getEnv,
77
- requireChatId
78
- } from "./chunk-RK67WL4O.js";
77
+ requireChatId,
78
+ resolveChatId
79
+ } from "./chunk-YL3HDEIJ.js";
79
80
 
80
81
  // src/cli.ts
81
82
  import { defineCommand as defineCommand188, runMain } from "citty";
@@ -2632,7 +2633,17 @@ var adEffectSchema = z7.object({
2632
2633
  staged: z7.boolean(),
2633
2634
  entity: z7.string().nullable(),
2634
2635
  operation: z7.string().nullable(),
2635
- summary: z7.string().nullable()
2636
+ summary: z7.string().nullable(),
2637
+ /** Addresses the op for `draft show --chat <thisChat> <ref>`, which returns the full payload. */
2638
+ ref: z7.string(),
2639
+ /**
2640
+ * What the publish did with this op, or null while it is still staged. Without it a reader cannot
2641
+ * tell a change that reached the platform from one that was rejected — a whole failed publish
2642
+ * reads exactly like a successful one.
2643
+ */
2644
+ outcome: z7.enum(["applied", "simulated", "failed", "skipped"]).nullable(),
2645
+ /** Why it failed, verbatim from the platform. Null unless the op failed. */
2646
+ error: z7.string().nullable()
2636
2647
  });
2637
2648
  var creativeEffectSchema = z7.object({
2638
2649
  op: effectOpSchema,
@@ -2874,6 +2885,7 @@ var historyCategorySchema = z9.enum([
2874
2885
  "creative",
2875
2886
  "report",
2876
2887
  "domain",
2888
+ "hosting",
2877
2889
  "integration",
2878
2890
  "tag_manager"
2879
2891
  ]);
@@ -3907,11 +3919,21 @@ var discardCommand = defineCommand4({
3907
3919
 
3908
3920
  // src/commands/actions/draft.ts
3909
3921
  import { defineCommand as defineCommand5 } from "citty";
3922
+
3923
+ // src/commands/chat-arg.ts
3924
+ var CHAT_READ_ARG = {
3925
+ type: "string",
3926
+ description: "Read another chat's staged changes instead of this one's. Start here when asked to redo, reapply or explain what an earlier chat did \u2014 its changes are kept verbatim, including what happened to each one on publish. Never retype an earlier chat's work from a summary."
3927
+ };
3928
+
3929
+ // src/commands/actions/draft.ts
3910
3930
  var REMOVE_OP_KINDS = ["update", "complete", "discard"];
3911
3931
  registerSchema({
3912
3932
  command: "actions.draft.list",
3913
- description: "Review the action ops staged in THIS chat's draft before publish (creates/updates/completes/discards/links). Staged ops are invisible to `actions list`/`status` until the chat publishes \u2014 use this to verify what will apply and catch duplicates.",
3914
- args: {}
3933
+ description: "Review the action ops staged in THIS chat's draft before publish (creates/updates/completes/discards/links). Staged ops are invisible to `actions list`/`status` until the chat publishes \u2014 use this to verify what will apply and catch duplicates. Takes --chat <id> to read an earlier chat's staged ops instead.",
3934
+ args: {
3935
+ chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
3936
+ }
3915
3937
  });
3916
3938
  registerSchema({
3917
3939
  command: "actions.draft.remove",
@@ -3935,9 +3957,10 @@ var listCommand = defineCommand5({
3935
3957
  name: "list",
3936
3958
  description: "Show every action op staged in this chat's draft, with footgun warnings. Example: baker actions draft"
3937
3959
  },
3938
- run: async () => {
3960
+ args: { chat: CHAT_READ_ARG },
3961
+ run: async ({ args }) => {
3939
3962
  try {
3940
- const chatId = requireChatId();
3963
+ const chatId = resolveChatId(args.chat);
3941
3964
  const response = await apiPost("/api/actions/draft", { chatId });
3942
3965
  writeJson(response);
3943
3966
  } catch (err) {
@@ -4008,8 +4031,11 @@ var clearCommand = defineCommand5({
4008
4031
  var draftCommand = defineCommand5({
4009
4032
  meta: {
4010
4033
  name: "draft",
4011
- description: "Review and edit the action ops staged in this chat BEFORE publish. Subcommands: list (default), remove, clear. Staged ops are invisible to `actions list`/`status` until publish, so check here before finishing."
4034
+ description: "Review and edit the action ops staged in this chat BEFORE publish. Subcommands: list (default), remove, clear. Staged ops are invisible to `actions list`/`status` until publish, so check here before finishing. `list` takes --chat <id> to read an earlier chat's staged ops instead."
4012
4035
  },
4036
+ // Declared on the parent too: `default: "list"` dispatches the bare `draft --chat <id>` form, and
4037
+ // citty prints help for a flag the parent does not know instead of forwarding it.
4038
+ args: { chat: CHAT_READ_ARG },
4013
4039
  subCommands: {
4014
4040
  list: listCommand,
4015
4041
  remove: removeCommand,
@@ -8258,18 +8284,18 @@ async function stageUpdate(kind, customerId, target, payload, hints) {
8258
8284
  async function stageTarget(kind, customerId, target, hints) {
8259
8285
  await stageGoogleOp({ kind, customerId, target }, hints);
8260
8286
  }
8261
- async function draftAction(path28, body) {
8287
+ async function draftAction(path28, body, chat) {
8262
8288
  try {
8263
- const chatId = requireChatId();
8289
+ const chatId = resolveChatId(chat);
8264
8290
  const response = await apiPost(path28, { chatId, ...body });
8265
8291
  writeJsonEnvelope(response);
8266
8292
  } catch (err) {
8267
8293
  handleGoogleError(err);
8268
8294
  }
8269
8295
  }
8270
- async function draftListAction(json) {
8296
+ async function draftListAction(json, chat) {
8271
8297
  try {
8272
- const chatId = requireChatId();
8298
+ const chatId = resolveChatId(chat);
8273
8299
  const response = await apiPost("/api/ads/google/draft", { chatId });
8274
8300
  if (json || !response.ok || !response.data) {
8275
8301
  writeJsonEnvelope(response);
@@ -8284,16 +8310,22 @@ async function draftListAction(json) {
8284
8310
 
8285
8311
  // src/commands/ads/google/draft.ts
8286
8312
  var draftCommand2 = defineCommand22({
8287
- meta: { name: "draft", description: "List, remove, clear, amend, or show staged Google Ads write ops for this chat" },
8313
+ meta: {
8314
+ name: "draft",
8315
+ description: "List, remove, clear, amend, or show staged Google Ads write ops for this chat. `list` and `show` take --chat <id> to read an earlier chat's changes instead."
8316
+ },
8288
8317
  subCommands: {
8289
8318
  list: defineCommand22({
8290
8319
  meta: {
8291
8320
  name: "list",
8292
8321
  description: "Review everything staged as a campaign \u25B8 ad group \u25B8 ad tree (--json for the raw envelope)"
8293
8322
  },
8294
- args: { json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable tree" } },
8323
+ args: {
8324
+ json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable tree" },
8325
+ chat: CHAT_READ_ARG
8326
+ },
8295
8327
  run: async ({ args }) => {
8296
- await draftListAction(args.json === true);
8328
+ await draftListAction(args.json === true, args.chat);
8297
8329
  }
8298
8330
  }),
8299
8331
  remove: defineCommand22({
@@ -8339,10 +8371,11 @@ var draftCommand2 = defineCommand22({
8339
8371
  type: "positional",
8340
8372
  description: "Staged op ref (g_temp_*) or target id/resource name",
8341
8373
  required: false
8342
- }
8374
+ },
8375
+ chat: CHAT_READ_ARG
8343
8376
  },
8344
8377
  run: async ({ args }) => {
8345
- await draftAction("/api/ads/google/draft/show", { ref: requireTarget(args, "op") });
8378
+ await draftAction("/api/ads/google/draft/show", { ref: requireTarget(args, "op") }, args.chat);
8346
8379
  }
8347
8380
  })
8348
8381
  }
@@ -11113,6 +11146,7 @@ function requireTargets(args, entity) {
11113
11146
  }
11114
11147
 
11115
11148
  // src/commands/ads/linkedin/schemas.ts
11149
+ var CHAT_READ_ARG_DESCRIPTION = CHAT_READ_ARG.description;
11116
11150
  registerSchema({
11117
11151
  command: "ads.linkedin.accounts",
11118
11152
  description: "List LinkedIn ad accounts in the company's connected scope. Pass --include-all to list every account the OAuth token can see.",
@@ -11811,7 +11845,8 @@ registerSchema({
11811
11845
  type: "boolean",
11812
11846
  description: "Print the raw JSON envelope instead of the readable tree",
11813
11847
  required: false
11814
- }
11848
+ },
11849
+ chat: { type: "string", description: CHAT_READ_ARG_DESCRIPTION, required: false }
11815
11850
  }
11816
11851
  });
11817
11852
  registerSchema({
@@ -11825,6 +11860,18 @@ registerSchema({
11825
11860
  }
11826
11861
  }
11827
11862
  });
11863
+ registerSchema({
11864
+ command: "ads.linkedin.draft.show",
11865
+ description: "Print the full staged payload for one LinkedIn op \u2014 the receipt to verify a change looks right before publish (never truncated), and the only way to read back verbatim what an earlier chat wrote.",
11866
+ args: {
11867
+ ref: {
11868
+ type: "positional",
11869
+ description: "Op ref (li_temp_* for creates, target id/URN for updates)",
11870
+ required: true
11871
+ },
11872
+ chat: { type: "string", description: CHAT_READ_ARG_DESCRIPTION, required: false }
11873
+ }
11874
+ });
11828
11875
  registerSchema({
11829
11876
  command: "ads.linkedin.draft.clear",
11830
11877
  description: "Discard ALL staged LinkedIn ops in this chat's draft. Nothing applies on publish.",
@@ -14015,9 +14062,9 @@ function renderDraftStatus2(data) {
14015
14062
  }
14016
14063
 
14017
14064
  // src/commands/ads/linkedin/draft.ts
14018
- async function listDraft(json) {
14065
+ async function listDraft(json, chat) {
14019
14066
  try {
14020
- const chatId = requireChatId();
14067
+ const chatId = resolveChatId(chat);
14021
14068
  const response = await apiPost("/api/ads/linkedin/draft", {
14022
14069
  chatId
14023
14070
  });
@@ -14036,9 +14083,12 @@ var listCommand3 = defineCommand45({
14036
14083
  name: "list",
14037
14084
  description: "Review everything staged as a Campaign group \u25B8 Campaign \u25B8 Creative tree (--json for the raw envelope). Example: baker ads linkedin draft"
14038
14085
  },
14039
- args: { json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable tree" } },
14086
+ args: {
14087
+ json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable tree" },
14088
+ chat: CHAT_READ_ARG
14089
+ },
14040
14090
  run: async ({ args }) => {
14041
- await listDraft(args.json === true);
14091
+ await listDraft(args.json === true, args.chat);
14042
14092
  }
14043
14093
  });
14044
14094
  var removeCommand2 = defineCommand45({
@@ -14115,12 +14165,13 @@ var showCommand = defineCommand45({
14115
14165
  description: "Print the full staged payload for one op \u2014 the receipt to verify a change looks right before publish (never truncated)."
14116
14166
  },
14117
14167
  args: {
14118
- ref: { type: "positional", description: "Staged op ref (li_temp_*) or target id/URN", required: true }
14168
+ ref: { type: "positional", description: "Staged op ref (li_temp_*) or target id/URN", required: true },
14169
+ chat: CHAT_READ_ARG
14119
14170
  },
14120
14171
  run: async ({ args }) => {
14121
14172
  const ref = requireTarget2(args, "op");
14122
14173
  try {
14123
- const chatId = requireChatId();
14174
+ const chatId = resolveChatId(args.chat);
14124
14175
  const body = { chatId, ref };
14125
14176
  const response = await apiPost(
14126
14177
  "/api/ads/linkedin/draft/show",
@@ -14135,8 +14186,11 @@ var showCommand = defineCommand45({
14135
14186
  var linkedinDraftCommand = defineCommand45({
14136
14187
  meta: {
14137
14188
  name: "draft",
14138
- description: "Review and edit the LinkedIn write ops staged in this chat BEFORE publish. Subcommands: list (default), remove, clear, amend, show. Ops never hit LinkedIn until the chat is published."
14189
+ description: "Review and edit the LinkedIn write ops staged in this chat BEFORE publish. Subcommands: list (default), remove, clear, amend, show. Ops never hit LinkedIn until the chat is published. `list` and `show` take --chat <id> to read an earlier chat's changes instead."
14139
14190
  },
14191
+ // Declared on the parent too: `default: "list"` dispatches the bare `draft --chat <id>` form, and
14192
+ // citty prints help for a flag the parent does not know instead of forwarding it.
14193
+ args: { chat: CHAT_READ_ARG },
14140
14194
  subCommands: {
14141
14195
  list: listCommand3,
14142
14196
  remove: removeCommand2,
@@ -15518,6 +15572,17 @@ var metaDraftListResponseSchema = z19.object({
15518
15572
  /** Non-blocking cross-op quality advisories — "good campaign, not just valid". */
15519
15573
  advisories: z19.array(metaDraftAdvisorySchema)
15520
15574
  });
15575
+ var metaDraftShowRequestSchema = z19.object({
15576
+ chatId: z19.string(),
15577
+ ref: z19.string()
15578
+ });
15579
+ var metaDraftShowResponseSchema = z19.object({
15580
+ op: metaDraftOpViewSchema.extend({
15581
+ payload: z19.unknown().optional(),
15582
+ warnings: z19.array(z19.string()).optional(),
15583
+ annotations: z19.unknown().optional()
15584
+ })
15585
+ });
15521
15586
  var metaDraftRemoveRequestSchema = z19.object({
15522
15587
  chatId: z19.string(),
15523
15588
  ref: z19.string()
@@ -16105,10 +16170,10 @@ function duplicateCommand2(entity, label) {
16105
16170
  replace: { type: "boolean", description: "Pause the original once the copy publishes" }
16106
16171
  },
16107
16172
  run: async ({ args }) => {
16108
- const { apiPost: apiPost2 } = await import("./client-XRQWOADV.js");
16109
- const { requireChatId: requireChatId2 } = await import("./env-3JMYIH25.js");
16110
- const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-FL7WRIJF.js");
16111
- const { handleMetaError: handleMetaError2 } = await import("./shared-OIYLDW3G.js");
16173
+ const { apiPost: apiPost2 } = await import("./client-PJ7ID35L.js");
16174
+ const { requireChatId: requireChatId2 } = await import("./env-6QJCMTRK.js");
16175
+ const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-NWX3YW64.js");
16176
+ const { handleMetaError: handleMetaError2 } = await import("./shared-5ZEOG664.js");
16112
16177
  try {
16113
16178
  const accountId = bareAccountId2(args);
16114
16179
  const chatId = requireChatId2();
@@ -16497,9 +16562,9 @@ Examples:
16497
16562
 
16498
16563
  // src/commands/ads/meta/draft.ts
16499
16564
  import { defineCommand as defineCommand62 } from "citty";
16500
- async function listDraft2() {
16565
+ async function listDraft2(chat) {
16501
16566
  try {
16502
- const chatId = requireChatId();
16567
+ const chatId = resolveChatId(chat);
16503
16568
  const response = await apiPost("/api/ads/meta/draft", { chatId });
16504
16569
  writeJsonEnvelope(response);
16505
16570
  } catch (err) {
@@ -16511,7 +16576,32 @@ var listCommand9 = defineCommand62({
16511
16576
  name: "list",
16512
16577
  description: "Show every Meta write op staged in this chat, its mode (simulated = publish will NOT hit Meta), dependencies, and post-publish results. Example: baker ads meta draft"
16513
16578
  },
16514
- run: listDraft2
16579
+ args: { chat: CHAT_READ_ARG },
16580
+ run: async ({ args }) => {
16581
+ await listDraft2(args.chat);
16582
+ }
16583
+ });
16584
+ var showCommand2 = defineCommand62({
16585
+ meta: {
16586
+ name: "show",
16587
+ description: "Print the full staged payload for one op \u2014 the receipt to verify a change looks right before publish (never truncated). Example: baker ads meta draft show meta_temp_abc123"
16588
+ },
16589
+ args: {
16590
+ ref: { type: "positional", description: "Op ref (meta_temp_* for creates, target id for updates)", required: true },
16591
+ chat: CHAT_READ_ARG
16592
+ },
16593
+ run: async ({ args }) => {
16594
+ try {
16595
+ const chatId = resolveChatId(args.chat);
16596
+ const response = await apiPost("/api/ads/meta/draft/show", {
16597
+ chatId,
16598
+ ref: args.ref
16599
+ });
16600
+ writeJsonEnvelope(response);
16601
+ } catch (err) {
16602
+ handleMetaError(err);
16603
+ }
16604
+ }
16515
16605
  });
16516
16606
  var removeCommand3 = defineCommand62({
16517
16607
  meta: {
@@ -16554,9 +16644,12 @@ var clearCommand3 = defineCommand62({
16554
16644
  var metaDraftCommand = defineCommand62({
16555
16645
  meta: {
16556
16646
  name: "draft",
16557
- description: "Review and edit the Meta write ops staged in this chat BEFORE publish. Subcommands: list (default), remove, clear. Ops never hit Meta until the chat is published."
16647
+ 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."
16558
16648
  },
16559
- subCommands: { list: listCommand9, remove: removeCommand3, clear: clearCommand3 },
16649
+ // Declared on the parent too: `default: "list"` dispatches the bare `draft --chat <id>` form, and
16650
+ // citty prints help for a flag the parent does not know instead of forwarding it.
16651
+ args: { chat: CHAT_READ_ARG },
16652
+ subCommands: { list: listCommand9, show: showCommand2, remove: removeCommand3, clear: clearCommand3 },
16560
16653
  // `default` (not `run`) dispatches the bare invocation: citty falls through to `run`
16561
16654
  // after dispatching a subcommand, so a `run` here would list the draft a second time
16562
16655
  // on every `draft list` / `draft remove` / `draft clear`.
@@ -26438,7 +26531,7 @@ var listCommand11 = defineCommand104({
26438
26531
  writeJson({ ok: true, data: { flows } });
26439
26532
  }
26440
26533
  });
26441
- var showCommand2 = defineCommand104({
26534
+ var showCommand3 = defineCommand104({
26442
26535
  meta: {
26443
26536
  name: "show",
26444
26537
  description: "Show a Form's confidential fields and their configuration status (never secret values). Example: baker flows show contact"
@@ -26474,7 +26567,7 @@ Full guide: __tooling__/docs/tools/baker/flows.md`
26474
26567
  },
26475
26568
  subCommands: {
26476
26569
  list: listCommand11,
26477
- show: showCommand2
26570
+ show: showCommand3
26478
26571
  },
26479
26572
  // Bare `baker flows` lists the Forms. This must be `default`, not `run`: citty falls
26480
26573
  // through to `run` after dispatching a subcommand, so a `run` here would also print
@@ -33453,7 +33546,8 @@ registerSchema({
33453
33546
  command: "scheduled-actions.get",
33454
33547
  description: "Get a published scheduled action or a temp_sched_* draft-created scheduled action.",
33455
33548
  args: {
33456
- id: { type: "string", description: "Published scheduled action ID or temp_sched_* draft ID", required: true }
33549
+ id: { type: "string", description: "Published scheduled action ID or temp_sched_* draft ID", required: true },
33550
+ chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
33457
33551
  }
33458
33552
  });
33459
33553
  var getCommand3 = defineCommand155({
@@ -33467,7 +33561,8 @@ var getCommand3 = defineCommand155({
33467
33561
  type: "string",
33468
33562
  description: "Scheduled action ID (alternative to positional)",
33469
33563
  required: false
33470
- }
33564
+ },
33565
+ chat: CHAT_READ_ARG
33471
33566
  },
33472
33567
  run: async ({ args }) => {
33473
33568
  try {
@@ -33477,12 +33572,13 @@ var getCommand3 = defineCommand155({
33477
33572
  }
33478
33573
  validateScheduledActionRef(id);
33479
33574
  const env = getEnv();
33480
- if (isTempScheduledActionId(id) && !env.BAKER_CHAT_ID) {
33481
- failValidation2("BAKER_CHAT_ID is required to get a temp scheduled action ID.");
33575
+ const chatId = typeof args.chat === "string" && args.chat.length > 0 ? args.chat : env.BAKER_CHAT_ID;
33576
+ if (isTempScheduledActionId(id) && !chatId) {
33577
+ failValidation2("BAKER_CHAT_ID or --chat is required to get a temp scheduled action ID.");
33482
33578
  }
33483
33579
  const body = { id };
33484
- if (env.BAKER_CHAT_ID) {
33485
- body.chatId = env.BAKER_CHAT_ID;
33580
+ if (chatId) {
33581
+ body.chatId = chatId;
33486
33582
  }
33487
33583
  const response = await apiPost("/api/scheduled-actions/get", body);
33488
33584
  writeJson(response);
@@ -33496,20 +33592,24 @@ var getCommand3 = defineCommand155({
33496
33592
  import { defineCommand as defineCommand156 } from "citty";
33497
33593
  registerSchema({
33498
33594
  command: "scheduled-actions.list",
33499
- description: "List published scheduled actions. Includes draft state when BAKER_CHAT_ID is set.",
33500
- args: {}
33595
+ description: "List published scheduled actions. Includes draft state when BAKER_CHAT_ID is set, or --chat <id> to read an earlier chat's staged schedules instead.",
33596
+ args: {
33597
+ chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
33598
+ }
33501
33599
  });
33502
33600
  var listCommand14 = defineCommand156({
33503
33601
  meta: {
33504
33602
  name: "list",
33505
- description: "List scheduled actions. Includes staged draft ops when BAKER_CHAT_ID is set."
33603
+ description: "List scheduled actions. Includes staged draft ops when BAKER_CHAT_ID is set, or --chat <id> to read an earlier chat's staged schedules instead."
33506
33604
  },
33507
- run: async () => {
33605
+ args: { chat: CHAT_READ_ARG },
33606
+ run: async ({ args }) => {
33508
33607
  try {
33509
33608
  const env = getEnv();
33510
33609
  const body = {};
33511
- if (env.BAKER_CHAT_ID) {
33512
- body.chatId = env.BAKER_CHAT_ID;
33610
+ const chatId = typeof args.chat === "string" && args.chat.length > 0 ? args.chat : env.BAKER_CHAT_ID;
33611
+ if (chatId) {
33612
+ body.chatId = chatId;
33513
33613
  }
33514
33614
  const response = await apiPost("/api/scheduled-actions/list", body);
33515
33615
  writeJson(response);
@@ -33809,8 +33909,8 @@ async function stageOp3(op) {
33809
33909
  handleError3(err);
33810
33910
  }
33811
33911
  }
33812
- async function draftAction2(path28, body) {
33813
- const chatId = requireChatId();
33912
+ async function draftAction2(path28, body, chat) {
33913
+ const chatId = resolveChatId(chat);
33814
33914
  try {
33815
33915
  const data = await apiPost(path28, { chatId, ...body });
33816
33916
  writeJsonEnvelope({ ok: true, data });
@@ -33841,8 +33941,8 @@ function renderDraft(response) {
33841
33941
  }
33842
33942
  return lines.join("\n");
33843
33943
  }
33844
- async function draftList(json) {
33845
- const chatId = requireChatId();
33944
+ async function draftList(json, chat) {
33945
+ const chatId = resolveChatId(chat);
33846
33946
  try {
33847
33947
  const data = await apiPost("/api/tag-manager/draft", { chatId });
33848
33948
  if (json) {
@@ -33859,15 +33959,16 @@ async function draftList(json) {
33859
33959
  // src/commands/tag-manager/draft.ts
33860
33960
  registerSchema({
33861
33961
  command: "tagManager.draft",
33862
- description: "Review and undo the Tag Manager changes staged on this chat. Use `list` to see everything staged, `show` to inspect one change in full before publish, `amend` to correct one in place, and `remove`/`clear` to drop them.",
33962
+ description: "Review and undo the Tag Manager changes staged on this chat. Use `list` to see everything staged, `show` to inspect one change in full before publish, `amend` to correct one in place, and `remove`/`clear` to drop them. `list` and `show` take --chat <id> to read an earlier chat's changes instead.",
33863
33963
  args: {
33864
- json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list", required: false }
33964
+ json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list", required: false },
33965
+ chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
33865
33966
  }
33866
33967
  });
33867
33968
  var draftCommand3 = defineCommand161({
33868
33969
  meta: {
33869
33970
  name: "draft",
33870
- description: "List, show, amend, remove, or clear staged Tag Manager changes for this chat"
33971
+ description: "List, show, amend, remove, or clear staged Tag Manager changes for this chat. `list` and `show` take --chat <id> to read an earlier chat's changes instead."
33871
33972
  },
33872
33973
  subCommands: {
33873
33974
  list: defineCommand161({
@@ -33875,9 +33976,12 @@ var draftCommand3 = defineCommand161({
33875
33976
  name: "list",
33876
33977
  description: "Review everything staged on this chat (--json for the raw envelope)"
33877
33978
  },
33878
- args: { json: { type: "boolean", description: "Print the raw JSON envelope", required: false } },
33979
+ args: {
33980
+ json: { type: "boolean", description: "Print the raw JSON envelope", required: false },
33981
+ chat: CHAT_READ_ARG
33982
+ },
33879
33983
  run: async ({ args }) => {
33880
- await draftList(args.json === true);
33984
+ await draftList(args.json === true, args.chat);
33881
33985
  }
33882
33986
  }),
33883
33987
  show: defineCommand161({
@@ -33885,11 +33989,16 @@ var draftCommand3 = defineCommand161({
33885
33989
  name: "show",
33886
33990
  description: "Print the full staged payload for one change \u2014 the receipt to verify it looks right before publish (never truncated)."
33887
33991
  },
33888
- args: { ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false } },
33992
+ args: {
33993
+ ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false },
33994
+ chat: CHAT_READ_ARG
33995
+ },
33889
33996
  run: async ({ args }) => {
33890
- await draftAction2("/api/tag-manager/draft/show", {
33891
- ref: requireTarget4(args, "change")
33892
- });
33997
+ await draftAction2(
33998
+ "/api/tag-manager/draft/show",
33999
+ { ref: requireTarget4(args, "change") },
34000
+ args.chat
34001
+ );
33893
34002
  }
33894
34003
  }),
33895
34004
  amend: defineCommand161({
@@ -34325,9 +34434,9 @@ var listCommand15 = defineCommand165({
34325
34434
  await listTags(args.json === true);
34326
34435
  }
34327
34436
  });
34328
- async function listDraft3() {
34437
+ async function listDraft3(chat) {
34329
34438
  try {
34330
- const chatId = requireChatId();
34439
+ const chatId = resolveChatId(chat);
34331
34440
  const response = await apiPost("/api/tags/draft", { chatId });
34332
34441
  writeJson({ ok: true, data: response });
34333
34442
  } catch (err) {
@@ -34337,10 +34446,11 @@ async function listDraft3() {
34337
34446
  var draftCommand4 = defineCommand165({
34338
34447
  meta: {
34339
34448
  name: "draft",
34340
- description: "Review the tag changes staged in this chat (read-only). Staged changes were approved via request_tag_input and apply when the chat is published; to amend or drop one, propose a follow-up change through the same tool (a delete on a tag_temp_* ref drops the staged create)."
34449
+ description: "Review the tag changes staged in this chat (read-only). Staged changes were approved via request_tag_input and apply when the chat is published; to amend or drop one, propose a follow-up change through the same tool (a delete on a tag_temp_* ref drops the staged create). Takes --chat <id> to read an earlier chat's staged changes instead."
34341
34450
  },
34342
- run: async () => {
34343
- await listDraft3();
34451
+ args: { chat: CHAT_READ_ARG },
34452
+ run: async ({ args }) => {
34453
+ await listDraft3(args.chat);
34344
34454
  }
34345
34455
  });
34346
34456
  var tagsCommand3 = defineCommand165({