@koda-sl/baker-cli 0.149.0-dev.183ac88ea → 0.149.0-dev.328f015d3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  toModelSafeImage,
37
37
  ulid,
38
38
  validateCanvasDeep
39
- } from "./chunk-JBDSJZBZ.js";
39
+ } from "./chunk-O3VYLCJK.js";
40
40
  import {
41
41
  csvOrJson,
42
42
  daysAgoIso,
@@ -75,7 +75,7 @@ import {
75
75
  } from "./chunk-RK67WL4O.js";
76
76
 
77
77
  // src/cli.ts
78
- import { defineCommand as defineCommand182, runMain } from "citty";
78
+ import { defineCommand as defineCommand178, runMain } from "citty";
79
79
 
80
80
  // src/commands/actions/index.ts
81
81
  import { defineCommand as defineCommand18 } from "citty";
@@ -2133,7 +2133,6 @@ var chatChangeTypeSchema = z5.enum([
2133
2133
  "linkedin-ads",
2134
2134
  "google-ads",
2135
2135
  "meta-ads",
2136
- "tag-manager",
2137
2136
  // Immediate (already-applied) library effects — see lib/chatChanges.ts.
2138
2137
  "image",
2139
2138
  "video",
@@ -29019,513 +29018,8 @@ var schemaCommand = defineCommand154({
29019
29018
  }
29020
29019
  });
29021
29020
 
29022
- // src/commands/tag-manager/index.ts
29023
- import { defineCommand as defineCommand158 } from "citty";
29024
-
29025
- // src/commands/tag-manager/draft.ts
29026
- import { defineCommand as defineCommand155 } from "citty";
29027
-
29028
- // src/commands/tag-manager/shared.ts
29029
- import { readFileSync as readFileSync12 } from "fs";
29030
- function failValidation3(message) {
29031
- writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
29032
- process.exit(1);
29033
- }
29034
- function requireTarget4(args, entity) {
29035
- const positional = Array.isArray(args._) ? args._[0] : void 0;
29036
- const target = args.id ?? args.target ?? positional;
29037
- if (typeof target !== "string" || target.length === 0) {
29038
- failValidation3(`pass the ${entity} id or path as the positional argument`);
29039
- }
29040
- return target;
29041
- }
29042
- function loadJsonArg(args, flag = "json") {
29043
- const inline = args[flag];
29044
- const file = args.file;
29045
- const raw = typeof file === "string" && file.length > 0 ? readFileSync12(file, "utf8") : typeof inline === "string" && inline.length > 0 ? inline : void 0;
29046
- if (raw === void 0) {
29047
- failValidation3(`pass --${flag} with inline JSON or --file with a path to a JSON file`);
29048
- }
29049
- try {
29050
- const parsed = JSON.parse(raw);
29051
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
29052
- failValidation3(`--${flag} must be a JSON object`);
29053
- }
29054
- return parsed;
29055
- } catch {
29056
- return failValidation3(`--${flag} is not valid JSON`);
29057
- }
29058
- }
29059
- function handleError3(err) {
29060
- if (err instanceof ApiError) {
29061
- const notConnected = err.code === "NOT_FOUND" || err.code === "UNAUTHORIZED";
29062
- writeJsonEnvelope({
29063
- ok: false,
29064
- error: {
29065
- code: err.code,
29066
- message: err.message,
29067
- ...notConnected ? {
29068
- fix: {
29069
- action: "ask_user",
29070
- explanation: "Tag Manager is not connected for this company yet. Ask the user to connect Tag Manager in Settings \u2192 Connections and pick the container to manage, then retry. Continue with the rest of the task in the meantime."
29071
- }
29072
- } : {},
29073
- retryable: false
29074
- }
29075
- });
29076
- process.exit(1);
29077
- }
29078
- writeJsonEnvelope({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
29079
- process.exit(1);
29080
- }
29081
- function stageHints(response) {
29082
- const hints = [];
29083
- if (response.mode === "simulated") {
29084
- hints.push(
29085
- "Tag Manager writes are SIMULATED for this company \u2014 this change will not reach the real container on publish."
29086
- );
29087
- }
29088
- hints.push(
29089
- "Staged only. On publish these changes land in a new Tag Manager version that is NOT published \u2014 tell the user to publish that version in Tag Manager to make it live."
29090
- );
29091
- return hints;
29092
- }
29093
- async function stageOp3(op) {
29094
- const chatId = requireChatId();
29095
- try {
29096
- const data = await apiPost("/api/tag-manager/draft/stage", { chatId, op });
29097
- writeJsonEnvelope({ ok: true, data, hints: stageHints(data) });
29098
- } catch (err) {
29099
- handleError3(err);
29100
- }
29101
- }
29102
- async function draftAction2(path27, body) {
29103
- const chatId = requireChatId();
29104
- try {
29105
- const data = await apiPost(path27, { chatId, ...body });
29106
- writeJsonEnvelope({ ok: true, data });
29107
- return data;
29108
- } catch (err) {
29109
- handleError3(err);
29110
- }
29111
- }
29112
- function renderDraft(response) {
29113
- if (response.count === 0) {
29114
- return "No Tag Manager changes staged on this chat.";
29115
- }
29116
- const lines = [
29117
- `${response.count} staged Tag Manager change(s) \u2014 mode: ${response.mode}`,
29118
- ...response.ops.map((op) => {
29119
- const status = op.result ? ` [${op.result.status}]` : "";
29120
- return ` ${op.ref} ${op.summary}${status}`;
29121
- })
29122
- ];
29123
- if (response.versionId) {
29124
- lines.push(
29125
- "",
29126
- `Applied into Tag Manager version ${response.versionId}. It is NOT published \u2014 publish it in Tag Manager to go live.`
29127
- );
29128
- }
29129
- if (response.compilerError) {
29130
- lines.push("", `Tag Manager reported a problem building the version: ${response.compilerError}`);
29131
- }
29132
- return lines.join("\n");
29133
- }
29134
- async function draftList(json) {
29135
- const chatId = requireChatId();
29136
- try {
29137
- const data = await apiPost("/api/tag-manager/draft", { chatId });
29138
- if (json) {
29139
- writeJsonEnvelope({ ok: true, data });
29140
- return;
29141
- }
29142
- process.stdout.write(`${renderDraft(data)}
29143
- `);
29144
- } catch (err) {
29145
- handleError3(err);
29146
- }
29147
- }
29148
-
29149
- // src/commands/tag-manager/draft.ts
29150
- registerSchema({
29151
- command: "tagManager.draft",
29152
- 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.",
29153
- args: {
29154
- json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list", required: false }
29155
- }
29156
- });
29157
- var draftCommand3 = defineCommand155({
29158
- meta: {
29159
- name: "draft",
29160
- description: "List, show, amend, remove, or clear staged Tag Manager changes for this chat"
29161
- },
29162
- subCommands: {
29163
- list: defineCommand155({
29164
- meta: {
29165
- name: "list",
29166
- description: "Review everything staged on this chat (--json for the raw envelope)"
29167
- },
29168
- args: { json: { type: "boolean", description: "Print the raw JSON envelope", required: false } },
29169
- run: async ({ args }) => {
29170
- await draftList(args.json === true);
29171
- }
29172
- }),
29173
- show: defineCommand155({
29174
- meta: {
29175
- name: "show",
29176
- description: "Print the full staged payload for one change \u2014 the receipt to verify it looks right before publish (never truncated)."
29177
- },
29178
- args: { ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false } },
29179
- run: async ({ args }) => {
29180
- await draftAction2("/api/tag-manager/draft/show", {
29181
- ref: requireTarget4(args, "change")
29182
- });
29183
- }
29184
- }),
29185
- amend: defineCommand155({
29186
- meta: {
29187
- name: "amend",
29188
- description: "Update a staged change in place \u2014 merges a JSON patch into its payload (objects deep-merge, null deletes a key, arrays/scalars replace) and re-validates. Use this instead of remove + re-create."
29189
- },
29190
- args: {
29191
- ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false },
29192
- patch: { type: "string", description: "Inline JSON patch object", required: false },
29193
- file: { type: "string", description: "JSON file with the patch object", required: false }
29194
- },
29195
- run: async ({ args }) => {
29196
- await draftAction2("/api/tag-manager/draft/amend", {
29197
- ref: requireTarget4(args, "change"),
29198
- patch: loadJsonArg(args, "patch")
29199
- });
29200
- }
29201
- }),
29202
- remove: defineCommand155({
29203
- meta: { name: "remove", description: "Remove one staged change (cascades to anything depending on it)" },
29204
- args: { ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false } },
29205
- run: async ({ args }) => {
29206
- await draftAction2("/api/tag-manager/draft/remove", {
29207
- ref: requireTarget4(args, "change")
29208
- });
29209
- }
29210
- }),
29211
- clear: defineCommand155({
29212
- meta: { name: "clear", description: "Discard all Tag Manager changes staged on this chat" },
29213
- run: async () => {
29214
- await draftAction2("/api/tag-manager/draft/clear", {});
29215
- }
29216
- })
29217
- }
29218
- });
29219
-
29220
- // src/commands/tag-manager/read.ts
29221
- import { defineCommand as defineCommand156 } from "citty";
29222
- registerSchema({
29223
- command: "tagManager.containers",
29224
- description: "List the Google Tag Manager containers this company's connection can reach. The connected container is flagged. Start here to confirm which container you are managing.",
29225
- args: {}
29226
- });
29227
- registerSchema({
29228
- command: "tagManager.read",
29229
- description: "Read what is currently inside a Tag Manager container: tags, triggers, variables, folders and enabled built-in variables. Start here before proposing any change, so you edit what exists instead of duplicating it. Compact by default; pass --full for raw Tag Manager objects.",
29230
- args: {
29231
- container: { type: "string", description: "Numeric container id (defaults to the connected one)", required: false },
29232
- workspace: { type: "string", description: "Workspace id (defaults to the default workspace)", required: false },
29233
- entities: {
29234
- type: "string",
29235
- description: "Comma-separated subset: tag,trigger,variable,folder,builtInVariable",
29236
- required: false
29237
- },
29238
- full: { type: "boolean", description: "Include the raw Tag Manager object for each entity", required: false }
29239
- }
29240
- });
29241
- function fail6(err) {
29242
- if (err instanceof ApiError) {
29243
- const notConnected = err.code === "NOT_FOUND" || err.code === "UNAUTHORIZED";
29244
- writeJsonEnvelope({
29245
- ok: false,
29246
- error: {
29247
- code: err.code,
29248
- message: err.message,
29249
- ...notConnected ? {
29250
- fix: {
29251
- action: "ask_user",
29252
- explanation: "Tag Manager is not connected for this company yet. Ask the user to connect Tag Manager in Settings \u2192 Connections and choose the container to manage, then retry. Continue with the rest of the task in the meantime."
29253
- }
29254
- } : {},
29255
- retryable: false
29256
- }
29257
- });
29258
- process.exit(1);
29259
- }
29260
- writeJsonEnvelope({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
29261
- process.exit(1);
29262
- }
29263
- var containersCommand = defineCommand156({
29264
- meta: {
29265
- name: "containers",
29266
- description: `List Tag Manager containers reachable by this company's connection.
29267
-
29268
- Start here:
29269
- baker tag-manager containers`
29270
- },
29271
- run: async () => {
29272
- try {
29273
- const data = await apiGet("/api/tag-manager/containers");
29274
- writeJsonEnvelope({ ok: true, data });
29275
- } catch (err) {
29276
- fail6(err);
29277
- }
29278
- }
29279
- });
29280
- var readCommand = defineCommand156({
29281
- meta: {
29282
- name: "read",
29283
- description: `Read the current contents of the Tag Manager container \u2014 always do this before staging changes.
29284
-
29285
- Examples:
29286
- baker tag-manager read
29287
- baker tag-manager read --entities tag,trigger
29288
- baker tag-manager read --full`
29289
- },
29290
- args: {
29291
- container: { type: "string", description: "Numeric container id", required: false },
29292
- workspace: { type: "string", description: "Workspace id", required: false },
29293
- entities: { type: "string", description: "Comma-separated entity subset", required: false },
29294
- full: { type: "boolean", description: "Include raw Tag Manager objects", required: false }
29295
- },
29296
- run: async ({ args }) => {
29297
- const entities = typeof args.entities === "string" && args.entities.length > 0 ? args.entities.split(",").map((entry) => entry.trim()) : void 0;
29298
- try {
29299
- const data = await apiPost("/api/tag-manager/read", {
29300
- containerId: args.container,
29301
- workspaceId: args.workspace,
29302
- entities,
29303
- full: args.full === true
29304
- });
29305
- const hints = [];
29306
- if (data.installedContainerMismatch) {
29307
- hints.push(data.installedContainerMismatch);
29308
- }
29309
- hints.push(
29310
- "Reference an existing trigger or variable by its numeric id or {{Name}}. To reference something you are staging in this same chat, use its gtm_temp_* ref and the executor resolves it at publish."
29311
- );
29312
- writeJsonEnvelope({ ok: true, data, hints });
29313
- } catch (err) {
29314
- fail6(err);
29315
- }
29316
- }
29317
- });
29318
-
29319
- // src/commands/tag-manager/write-commands.ts
29320
- import { defineCommand as defineCommand157 } from "citty";
29321
- var ENTITIES = [
29322
- {
29323
- entity: "tag",
29324
- noun: "tag",
29325
- createHint: 'Payload needs name + type (e.g. "gaawe" for a GA4 event) and usually parameter[] and firingTriggerId[]. Reference a trigger by its numeric id, or by a gtm_temp_* ref if you are staging it in this same chat.'
29326
- },
29327
- {
29328
- entity: "trigger",
29329
- noun: "trigger",
29330
- createHint: 'Payload needs name + type (e.g. "pageview", "click", "customEvent"). Stage the trigger BEFORE the tag that fires on it, then reference it by its gtm_temp_* ref.'
29331
- },
29332
- {
29333
- entity: "variable",
29334
- noun: "variable",
29335
- createHint: 'Payload needs name + type (e.g. "v" for a data layer variable, "c" for a constant). Other entities reference a variable by NAME as {{Variable Name}}.'
29336
- },
29337
- {
29338
- entity: "folder",
29339
- noun: "folder",
29340
- createHint: "Payload needs name. Use folders to keep a large container legible."
29341
- }
29342
- ];
29343
- for (const { entity, noun, createHint } of ENTITIES) {
29344
- registerSchema({
29345
- command: `tagManager.${entity}.create`,
29346
- description: `Stage the creation of a Tag Manager ${noun}. ${createHint} Staged only \u2014 applies on publish into an unpublished container version.`,
29347
- args: {
29348
- json: { type: "string", description: `Inline JSON ${noun} definition`, required: false },
29349
- file: { type: "string", description: `Path to a JSON file with the ${noun} definition`, required: false },
29350
- container: { type: "string", description: "Numeric container id", required: false }
29351
- }
29352
- });
29353
- registerSchema({
29354
- command: `tagManager.${entity}.update`,
29355
- description: `Stage an update to an existing Tag Manager ${noun}. Pass the ${noun} id or path as the positional argument and the changed fields as JSON. Read the container first so you send the fields you mean to change.`,
29356
- args: {
29357
- json: { type: "string", description: "Inline JSON with the changed fields", required: false },
29358
- file: { type: "string", description: "Path to a JSON file with the changed fields", required: false }
29359
- }
29360
- });
29361
- registerSchema({
29362
- command: `tagManager.${entity}.delete`,
29363
- description: `Stage the deletion of a Tag Manager ${noun}. Pass its id or path as the positional argument. Deleting is irreversible once the resulting version is published \u2014 confirm with the user first.`,
29364
- args: {}
29365
- });
29366
- }
29367
- function entityCommand(entity, noun) {
29368
- return defineCommand157({
29369
- meta: { name: entity, description: `Stage ${noun} changes on this chat's Tag Manager draft` },
29370
- subCommands: {
29371
- create: defineCommand157({
29372
- meta: {
29373
- name: "create",
29374
- description: `Stage a new ${noun}
29375
-
29376
- Examples:
29377
- baker tag-manager ${entity} create --json '{"name":"GA4 Config","type":"googtag"}'
29378
- baker tag-manager ${entity} create --file ./${entity}.json`
29379
- },
29380
- args: {
29381
- json: { type: "string", description: "Inline JSON definition", required: false },
29382
- file: { type: "string", description: "Path to a JSON file", required: false },
29383
- container: { type: "string", description: "Numeric container id", required: false }
29384
- },
29385
- run: async ({ args }) => {
29386
- await stageOp3({
29387
- kind: `tagManager.${entity}.create`,
29388
- payload: loadJsonArg(args),
29389
- ...typeof args.container === "string" ? { containerId: args.container } : {}
29390
- });
29391
- }
29392
- }),
29393
- update: defineCommand157({
29394
- meta: {
29395
- name: "update",
29396
- description: `Stage an update to an existing ${noun} (pass its id or path)`
29397
- },
29398
- args: {
29399
- id: { type: "positional", description: `${noun} id or path`, required: false },
29400
- json: { type: "string", description: "Inline JSON with changed fields", required: false },
29401
- file: { type: "string", description: "Path to a JSON file", required: false },
29402
- container: { type: "string", description: "Numeric container id", required: false }
29403
- },
29404
- run: async ({ args }) => {
29405
- await stageOp3({
29406
- kind: `tagManager.${entity}.update`,
29407
- target: requireTarget4(args, noun),
29408
- payload: loadJsonArg(args),
29409
- ...typeof args.container === "string" ? { containerId: args.container } : {}
29410
- });
29411
- }
29412
- }),
29413
- delete: defineCommand157({
29414
- meta: { name: "delete", description: `Stage the deletion of a ${noun} (pass its id or path)` },
29415
- args: {
29416
- id: { type: "positional", description: `${noun} id or path`, required: false },
29417
- container: { type: "string", description: "Numeric container id", required: false }
29418
- },
29419
- run: async ({ args }) => {
29420
- await stageOp3({
29421
- kind: `tagManager.${entity}.delete`,
29422
- target: requireTarget4(args, noun),
29423
- ...typeof args.container === "string" ? { containerId: args.container } : {}
29424
- });
29425
- }
29426
- })
29427
- }
29428
- });
29429
- }
29430
- var tagCommand = entityCommand("tag", "tag");
29431
- var triggerCommand2 = entityCommand("trigger", "trigger");
29432
- var variableCommand = entityCommand("variable", "variable");
29433
- var folderCommand = entityCommand("folder", "folder");
29434
- registerSchema({
29435
- command: "tagManager.builtin",
29436
- description: "Enable or disable Tag Manager built-in variables by type (e.g. clickUrl, pageUrl, formId). Built-in variables must be enabled before a trigger or tag can reference them as {{Click URL}}.",
29437
- args: {
29438
- types: { type: "string", description: "Comma-separated built-in variable types", required: true }
29439
- }
29440
- });
29441
- function builtinTypes(args) {
29442
- const raw = args.types;
29443
- if (typeof raw !== "string" || raw.length === 0) {
29444
- process.stdout.write(
29445
- `${JSON.stringify({ ok: false, error: { code: "VALIDATION_ERROR", message: "pass --types with comma-separated built-in variable types" } }, null, 2)}
29446
- `
29447
- );
29448
- process.exit(1);
29449
- }
29450
- return raw.split(",").map((entry) => entry.trim());
29451
- }
29452
- var builtinCommand = defineCommand157({
29453
- meta: {
29454
- name: "builtin",
29455
- description: `Enable or disable built-in variables
29456
-
29457
- Examples:
29458
- baker tag-manager builtin enable --types clickUrl,clickText
29459
- baker tag-manager builtin disable --types formId`
29460
- },
29461
- subCommands: {
29462
- enable: defineCommand157({
29463
- meta: { name: "enable", description: "Stage enabling built-in variables" },
29464
- args: {
29465
- types: { type: "string", description: "Comma-separated types", required: false },
29466
- container: { type: "string", description: "Numeric container id", required: false }
29467
- },
29468
- run: async ({ args }) => {
29469
- await stageOp3({
29470
- kind: "tagManager.builtInVariable.enable",
29471
- payload: { type: builtinTypes(args) },
29472
- ...typeof args.container === "string" ? { containerId: args.container } : {}
29473
- });
29474
- }
29475
- }),
29476
- disable: defineCommand157({
29477
- meta: { name: "disable", description: "Stage disabling built-in variables" },
29478
- args: {
29479
- types: { type: "string", description: "Comma-separated types", required: false },
29480
- container: { type: "string", description: "Numeric container id", required: false }
29481
- },
29482
- run: async ({ args }) => {
29483
- await stageOp3({
29484
- kind: "tagManager.builtInVariable.disable",
29485
- payload: { type: builtinTypes(args) },
29486
- ...typeof args.container === "string" ? { containerId: args.container } : {}
29487
- });
29488
- }
29489
- })
29490
- }
29491
- });
29492
-
29493
- // src/commands/tag-manager/index.ts
29494
- var tagManagerCommand = defineCommand158({
29495
- meta: {
29496
- name: "tag-manager",
29497
- description: `Read and change what lives inside the client's Google Tag Manager container \u2014 tags, triggers, variables, folders and built-in variables.
29498
-
29499
- Start here:
29500
- baker tag-manager read \u2014 see what the container holds today
29501
-
29502
- Then stage changes (nothing is sent to Tag Manager until publish):
29503
- baker tag-manager trigger create --json '{"name":"Quote Submit","type":"customEvent"}'
29504
- baker tag-manager tag create --json '{"name":"GA4 Quote","type":"gaawe","firingTriggerId":["gtm_temp_trigger_..."]}'
29505
- baker tag-manager draft list \u2014 review everything staged
29506
-
29507
- On publish, staged changes are written into a new Tag Manager version that is NOT published.
29508
- Tell the user to publish that version in Tag Manager to make it live.
29509
-
29510
- This owns the CONTENTS of the container. Installing the container snippet on the site is a
29511
- different job \u2014 that is \`baker tags\` with the googleTagManager tag.
29512
-
29513
- Full guide: __tooling__/docs/tools/baker/tag-manager.md`
29514
- },
29515
- subCommands: {
29516
- containers: containersCommand,
29517
- read: readCommand,
29518
- tag: tagCommand,
29519
- trigger: triggerCommand2,
29520
- variable: variableCommand,
29521
- folder: folderCommand,
29522
- builtin: builtinCommand,
29523
- draft: draftCommand3
29524
- }
29525
- });
29526
-
29527
29021
  // src/commands/tags/index.ts
29528
- import { defineCommand as defineCommand159 } from "citty";
29022
+ import { defineCommand as defineCommand155 } from "citty";
29529
29023
 
29530
29024
  // src/commands/tags/shared.ts
29531
29025
  function failApi3(err) {
@@ -29591,7 +29085,7 @@ async function listTags(json) {
29591
29085
  failApi3(err);
29592
29086
  }
29593
29087
  }
29594
- var listCommand10 = defineCommand159({
29088
+ var listCommand10 = defineCommand155({
29595
29089
  meta: {
29596
29090
  name: "list",
29597
29091
  description: "Effective tags for this chat (production + staged), with each tag's full readable config (secrets excluded) \u2014 reuse a stored value to pre-fill a change rather than asking the user. Refs printed here are what flow side-effect tagIds should use. Example: baker tags list"
@@ -29610,7 +29104,7 @@ async function listDraft3() {
29610
29104
  failApi3(err);
29611
29105
  }
29612
29106
  }
29613
- var draftCommand4 = defineCommand159({
29107
+ var draftCommand3 = defineCommand155({
29614
29108
  meta: {
29615
29109
  name: "draft",
29616
29110
  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)."
@@ -29619,7 +29113,7 @@ var draftCommand4 = defineCommand159({
29619
29113
  await listDraft3();
29620
29114
  }
29621
29115
  });
29622
- var tagsCommand3 = defineCommand159({
29116
+ var tagsCommand3 = defineCommand155({
29623
29117
  meta: {
29624
29118
  name: "tags",
29625
29119
  description: `Read the client's marketing/analytics tags (Meta pixel, GA4, Google Ads, GTM, Clarity, Hotjar, \u2026) \u2014 production tags plus the changes staged in this chat.
@@ -29637,7 +29131,7 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
29637
29131
  },
29638
29132
  subCommands: {
29639
29133
  list: listCommand10,
29640
- draft: draftCommand4
29134
+ draft: draftCommand3
29641
29135
  },
29642
29136
  run: async () => {
29643
29137
  await listTags(false);
@@ -29645,10 +29139,10 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
29645
29139
  });
29646
29140
 
29647
29141
  // src/commands/testimonials/index.ts
29648
- import { defineCommand as defineCommand163 } from "citty";
29142
+ import { defineCommand as defineCommand159 } from "citty";
29649
29143
 
29650
29144
  // src/commands/testimonials/get.ts
29651
- import { defineCommand as defineCommand160 } from "citty";
29145
+ import { defineCommand as defineCommand156 } from "citty";
29652
29146
  registerSchema({
29653
29147
  command: "testimonials.get",
29654
29148
  description: "Get a single testimonial by ID",
@@ -29656,7 +29150,7 @@ registerSchema({
29656
29150
  id: { type: "string", description: "Testimonial ID", required: true }
29657
29151
  }
29658
29152
  });
29659
- var getCommand4 = defineCommand160({
29153
+ var getCommand4 = defineCommand156({
29660
29154
  meta: { name: "get", description: "Get a single testimonial by ID. Example: baker testimonials get j571abc123" },
29661
29155
  args: {
29662
29156
  id: { type: "positional", description: "Testimonial ID", required: false },
@@ -29693,7 +29187,7 @@ var getCommand4 = defineCommand160({
29693
29187
  });
29694
29188
 
29695
29189
  // src/commands/testimonials/list.ts
29696
- import { defineCommand as defineCommand161 } from "citty";
29190
+ import { defineCommand as defineCommand157 } from "citty";
29697
29191
  registerSchema({
29698
29192
  command: "testimonials.list",
29699
29193
  description: "List testimonials with optional filters.",
@@ -29723,7 +29217,7 @@ registerSchema({
29723
29217
  limit: { type: "number", description: "Max results (default 50)", required: false, default: 50 }
29724
29218
  }
29725
29219
  });
29726
- var listCommand11 = defineCommand161({
29220
+ var listCommand11 = defineCommand157({
29727
29221
  meta: {
29728
29222
  name: "list",
29729
29223
  description: "List testimonials with optional filters. Example: baker testimonials list --source google --sentiment positive"
@@ -29772,7 +29266,7 @@ var listCommand11 = defineCommand161({
29772
29266
  });
29773
29267
 
29774
29268
  // src/commands/testimonials/search.ts
29775
- import { defineCommand as defineCommand162 } from "citty";
29269
+ import { defineCommand as defineCommand158 } from "citty";
29776
29270
  function languageBiasHint(results, requestedLanguage) {
29777
29271
  if (requestedLanguage) {
29778
29272
  return null;
@@ -29850,7 +29344,7 @@ function buildSearchRequest(query, args) {
29850
29344
  }
29851
29345
  return body;
29852
29346
  }
29853
- var searchCommand2 = defineCommand162({
29347
+ var searchCommand2 = defineCommand158({
29854
29348
  meta: {
29855
29349
  name: "search",
29856
29350
  description: "Semantic search testimonials by text query. Uses hybrid BM25 + vector + reranking. Example: baker testimonials search 'great service' --rating-min 4"
@@ -29906,7 +29400,7 @@ var searchCommand2 = defineCommand162({
29906
29400
  var tagsCommand4 = makeTagsCommand("testimonials", "testimonial", "/api/testimonials/tags");
29907
29401
 
29908
29402
  // src/commands/testimonials/index.ts
29909
- var testimonialsCommand = defineCommand163({
29403
+ var testimonialsCommand = defineCommand159({
29910
29404
  meta: {
29911
29405
  name: "testimonials",
29912
29406
  description: `Find and browse testimonials in Baker. Subcommands: search, get, list, tags.
@@ -29928,10 +29422,10 @@ Full guide: __tooling__/docs/tools/baker/testimonials.md`
29928
29422
  });
29929
29423
 
29930
29424
  // src/commands/videos/index.ts
29931
- import { defineCommand as defineCommand168 } from "citty";
29425
+ import { defineCommand as defineCommand164 } from "citty";
29932
29426
 
29933
29427
  // src/commands/videos/delete.ts
29934
- import { defineCommand as defineCommand164 } from "citty";
29428
+ import { defineCommand as defineCommand160 } from "citty";
29935
29429
  registerSchema({
29936
29430
  command: "videos.delete",
29937
29431
  description: "Delete a video by ID",
@@ -29945,7 +29439,7 @@ registerSchema({
29945
29439
  }
29946
29440
  }
29947
29441
  });
29948
- var deleteCommand3 = defineCommand164({
29442
+ var deleteCommand3 = defineCommand160({
29949
29443
  meta: {
29950
29444
  name: "delete",
29951
29445
  description: "Delete a video by ID. Use --dry-run to preview. Example: baker videos delete j571abc123 --dry-run"
@@ -29986,7 +29480,7 @@ var deleteCommand3 = defineCommand164({
29986
29480
  });
29987
29481
 
29988
29482
  // src/commands/videos/get.ts
29989
- import { defineCommand as defineCommand165 } from "citty";
29483
+ import { defineCommand as defineCommand161 } from "citty";
29990
29484
  registerSchema({
29991
29485
  command: "videos.get",
29992
29486
  description: "Get a single video by ID",
@@ -29994,7 +29488,7 @@ registerSchema({
29994
29488
  id: { type: "string", description: "Video ID", required: true }
29995
29489
  }
29996
29490
  });
29997
- var getCommand5 = defineCommand165({
29491
+ var getCommand5 = defineCommand161({
29998
29492
  meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
29999
29493
  args: {
30000
29494
  id: { type: "positional", description: "Video ID", required: false },
@@ -30031,7 +29525,7 @@ var getCommand5 = defineCommand165({
30031
29525
  });
30032
29526
 
30033
29527
  // src/commands/videos/search.ts
30034
- import { defineCommand as defineCommand166 } from "citty";
29528
+ import { defineCommand as defineCommand162 } from "citty";
30035
29529
  registerSchema({
30036
29530
  command: "videos.search",
30037
29531
  description: "Search videos by text query. Only returns ready videos.",
@@ -30041,7 +29535,7 @@ registerSchema({
30041
29535
  tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
30042
29536
  }
30043
29537
  });
30044
- var searchCommand3 = defineCommand166({
29538
+ var searchCommand3 = defineCommand162({
30045
29539
  meta: {
30046
29540
  name: "search",
30047
29541
  description: "Semantic search videos by text query. Uses hybrid BM25 + vector + reranking. Example: baker videos search 'product demo' --tags tutorial"
@@ -30093,7 +29587,7 @@ var tagsCommand5 = makeTagsCommand("videos", "video", "/api/videos/tags");
30093
29587
  // src/commands/videos/upload.ts
30094
29588
  import { readFile as readFile22, stat as stat7 } from "fs/promises";
30095
29589
  import { extname as extname3 } from "path";
30096
- import { defineCommand as defineCommand167 } from "citty";
29590
+ import { defineCommand as defineCommand163 } from "citty";
30097
29591
  var MIME_MAP = {
30098
29592
  ".mp4": "video/mp4",
30099
29593
  ".mov": "video/quicktime",
@@ -30127,7 +29621,7 @@ function detectContentType(filePath) {
30127
29621
  }
30128
29622
  return mime;
30129
29623
  }
30130
- var uploadCommand2 = defineCommand167({
29624
+ var uploadCommand2 = defineCommand163({
30131
29625
  meta: {
30132
29626
  name: "upload",
30133
29627
  description: "Upload a video file to Baker via Mux direct upload. Auto-detects content type. Example: baker videos upload ./demo.mp4"
@@ -30181,7 +29675,7 @@ var uploadCommand2 = defineCommand167({
30181
29675
  });
30182
29676
 
30183
29677
  // src/commands/videos/index.ts
30184
- var videosCommand = defineCommand168({
29678
+ var videosCommand = defineCommand164({
30185
29679
  meta: {
30186
29680
  name: "videos",
30187
29681
  description: `Find and manage videos in Baker. Subcommands: search, get, upload, delete, tags.
@@ -30205,10 +29699,10 @@ Full guide: __tooling__/docs/tools/baker/videos.md`
30205
29699
  });
30206
29700
 
30207
29701
  // src/commands/winning-ads/index.ts
30208
- import { defineCommand as defineCommand181 } from "citty";
29702
+ import { defineCommand as defineCommand177 } from "citty";
30209
29703
 
30210
29704
  // src/commands/winning-ads/advertisers.ts
30211
- import { defineCommand as defineCommand169 } from "citty";
29705
+ import { defineCommand as defineCommand165 } from "citty";
30212
29706
 
30213
29707
  // src/commands/winning-ads/shared.ts
30214
29708
  function splitList(value) {
@@ -30261,7 +29755,7 @@ function advertiserNormalizer(record, full) {
30261
29755
  last_synced_at: record.last_synced_at ?? null
30262
29756
  };
30263
29757
  }
30264
- var advertisersCommand2 = defineCommand169({
29758
+ var advertisersCommand2 = defineCommand165({
30265
29759
  meta: {
30266
29760
  name: "advertisers",
30267
29761
  description: 'List corpus advertisers by name or domain. Find your own advertiser for --exclude-advertiser, or a competitor for --advertiser-id / winners. Example: baker winning-ads advertisers "Deel" --output md'
@@ -30319,7 +29813,7 @@ var advertisersCommand2 = defineCommand169({
30319
29813
  });
30320
29814
 
30321
29815
  // src/commands/winning-ads/brief.ts
30322
- import { defineCommand as defineCommand170 } from "citty";
29816
+ import { defineCommand as defineCommand166 } from "citty";
30323
29817
  registerSchema({
30324
29818
  command: "winning-ads.brief",
30325
29819
  description: "Generate a creative brief grounded in strategically-similar winning ads. Optionally describe the target creative with --dna (JSON) and steer with --notes.",
@@ -30365,7 +29859,7 @@ function parseDna(raw) {
30365
29859
  }
30366
29860
  return parsed;
30367
29861
  }
30368
- var briefCommand = defineCommand170({
29862
+ var briefCommand = defineCommand166({
30369
29863
  meta: {
30370
29864
  name: "brief",
30371
29865
  description: `Generate a creative brief from winning references. Example: baker winning-ads brief --dna '{"angle":"cost savings"}' --notes "B2B, LinkedIn video" --k 8`
@@ -30401,7 +29895,7 @@ var briefCommand = defineCommand170({
30401
29895
  });
30402
29896
 
30403
29897
  // src/commands/winning-ads/content.ts
30404
- import { defineCommand as defineCommand171 } from "citty";
29898
+ import { defineCommand as defineCommand167 } from "citty";
30405
29899
  registerSchema({
30406
29900
  command: "winning-ads.content",
30407
29901
  description: "Read what's INSIDE one winning ad: the spoken transcript, the on-screen text, and the ad copy. Use this after `search`/`winners`/`feed` return a shortlist \u2014 pass an ad_id to understand a reference before reproducing it. Add --full for speech, pacing, and soundtrack detail. Video ads carry the transcript/on-screen text; static ads carry only the copy.",
@@ -30414,7 +29908,7 @@ registerSchema({
30414
29908
  }
30415
29909
  }
30416
29910
  });
30417
- var contentCommand = defineCommand171({
29911
+ var contentCommand = defineCommand167({
30418
29912
  meta: {
30419
29913
  name: "content",
30420
29914
  description: "Read the transcript + on-screen text + copy of one winning ad. Example: baker winning-ads content adg_123 --platform meta --full --output md"
@@ -30463,7 +29957,7 @@ var contentCommand = defineCommand171({
30463
29957
  });
30464
29958
 
30465
29959
  // src/commands/winning-ads/feed.ts
30466
- import { defineCommand as defineCommand172 } from "citty";
29960
+ import { defineCommand as defineCommand168 } from "citty";
30467
29961
  function buildFeedParams(input) {
30468
29962
  const params = {};
30469
29963
  const advertiser = splitList(input.advertiser);
@@ -30515,7 +30009,7 @@ registerSchema({
30515
30009
  format: { type: "string", description: "Comma-separated formats to include (e.g. static,video)", required: false }
30516
30010
  }
30517
30011
  });
30518
- var feedCommand = defineCommand172({
30012
+ var feedCommand = defineCommand168({
30519
30013
  meta: {
30520
30014
  name: "feed",
30521
30015
  description: "Winners across every brand you follow (browse, then trim per advertiser). Example: baker winning-ads feed --per-advertiser 5 --output md"
@@ -30600,7 +30094,7 @@ var feedCommand = defineCommand172({
30600
30094
  });
30601
30095
 
30602
30096
  // src/commands/winning-ads/follow.ts
30603
- import { defineCommand as defineCommand173 } from "citty";
30097
+ import { defineCommand as defineCommand169 } from "citty";
30604
30098
  var PLATFORMS = ["meta", "linkedin"];
30605
30099
  registerSchema({
30606
30100
  command: "winning-ads.follow",
@@ -30615,7 +30109,7 @@ registerSchema({
30615
30109
  label: { type: "string", description: "Optional display label (defaults to the resolved name)", required: false }
30616
30110
  }
30617
30111
  });
30618
- var followCommand = defineCommand173({
30112
+ var followCommand = defineCommand169({
30619
30113
  meta: {
30620
30114
  name: "follow",
30621
30115
  description: 'Follow a brand to track ALL its ads \u2014 every platform and country. --platform is how we read your input, not a limit. A domain tracks both Meta + LinkedIn. Example: baker winning-ads follow "deel.com" --platform meta'
@@ -30662,7 +30156,7 @@ var followCommand = defineCommand173({
30662
30156
  });
30663
30157
 
30664
30158
  // src/commands/winning-ads/follow-competitors.ts
30665
- import { defineCommand as defineCommand174 } from "citty";
30159
+ import { defineCommand as defineCommand170 } from "citty";
30666
30160
  var PLATFORMS2 = ["meta", "linkedin"];
30667
30161
  var BATCH_TIMEOUT_MS = 3e5;
30668
30162
  function buildFollowBatchBody(input) {
@@ -30695,7 +30189,7 @@ registerSchema({
30695
30189
  }
30696
30190
  }
30697
30191
  });
30698
- var followCompetitorsCommand = defineCommand174({
30192
+ var followCompetitorsCommand = defineCommand170({
30699
30193
  meta: {
30700
30194
  name: "follow-competitors",
30701
30195
  description: 'Follow many brands at once by domain \u2014 add every competitor in one call. Example: baker winning-ads follow-competitors "deel.com,notion.so,hubspot.com"'
@@ -30770,7 +30264,7 @@ var followCompetitorsCommand = defineCommand174({
30770
30264
  });
30771
30265
 
30772
30266
  // src/commands/winning-ads/following.ts
30773
- import { defineCommand as defineCommand175 } from "citty";
30267
+ import { defineCommand as defineCommand171 } from "citty";
30774
30268
  registerSchema({
30775
30269
  command: "winning-ads.following",
30776
30270
  description: "List the brands you follow in your ad-dna library, with each one's status (ready vs still adding) and cached ad counts.",
@@ -30803,7 +30297,7 @@ function followingNormalizer(record, full) {
30803
30297
  platforms: Array.isArray(record.platforms) ? record.platforms : []
30804
30298
  };
30805
30299
  }
30806
- var followingCommand = defineCommand175({
30300
+ var followingCommand = defineCommand171({
30807
30301
  meta: {
30808
30302
  name: "following",
30809
30303
  description: "List brands you follow, with status (ready / adding\u2026) and cached counts. Example: baker winning-ads following --output md"
@@ -30838,7 +30332,7 @@ var followingCommand = defineCommand175({
30838
30332
  });
30839
30333
 
30840
30334
  // src/commands/winning-ads/patterns.ts
30841
- import { defineCommand as defineCommand176 } from "citty";
30335
+ import { defineCommand as defineCommand172 } from "citty";
30842
30336
  registerSchema({
30843
30337
  command: "winning-ads.patterns",
30844
30338
  description: "Mine what separates two cohorts of ads: pass a comma-list of winning ad ids (--winners) and a comma-list of weaker ad ids (--duds). Returns the discriminating DNA fields.",
@@ -30877,7 +30371,7 @@ function discriminatorRow(record) {
30877
30371
  top_values_duds: Array.isArray(record.top_values_b) ? record.top_values_b.join(", ") : ""
30878
30372
  };
30879
30373
  }
30880
- var patternsCommand = defineCommand176({
30374
+ var patternsCommand = defineCommand172({
30881
30375
  meta: {
30882
30376
  name: "patterns",
30883
30377
  description: "Discover what separates winning ads from weak ones. Example: baker winning-ads patterns --winners a_1,a_2,a_3 --duds a_9,a_8 --output md"
@@ -30933,7 +30427,7 @@ var patternsCommand = defineCommand176({
30933
30427
  });
30934
30428
 
30935
30429
  // src/commands/winning-ads/search.ts
30936
- import { defineCommand as defineCommand177 } from "citty";
30430
+ import { defineCommand as defineCommand173 } from "citty";
30937
30431
  registerSchema({
30938
30432
  command: "winning-ads.search",
30939
30433
  description: "Search the ad-dna corpus of scored winning ads. Returns a lean shortlist (advertiser, summary, scores, media_url) to pick a reference to reproduce.",
@@ -31041,7 +30535,7 @@ function buildSearchBody(args) {
31041
30535
  }
31042
30536
  return body;
31043
30537
  }
31044
- var searchCommand4 = defineCommand177({
30538
+ var searchCommand4 = defineCommand173({
31045
30539
  meta: {
31046
30540
  name: "search",
31047
30541
  description: "Search winning reference ads. Example: baker winning-ads search 'B2B SaaS before/after AI automation' --platform meta --format static --winner-category winner --exclude-advertiser adv_123 --output md"
@@ -31156,7 +30650,7 @@ var searchCommand4 = defineCommand177({
31156
30650
  });
31157
30651
 
31158
30652
  // src/commands/winning-ads/seeds.ts
31159
- import { defineCommand as defineCommand178 } from "citty";
30653
+ import { defineCommand as defineCommand174 } from "citty";
31160
30654
  function leanRow(r) {
31161
30655
  return {
31162
30656
  key: r.key,
@@ -31184,7 +30678,7 @@ function makeSeedCommand(opts) {
31184
30678
  limit: { type: "number", description: "Max keys 1-100 (default 20)", required: false, default: 20 }
31185
30679
  }
31186
30680
  });
31187
- return defineCommand178({
30681
+ return defineCommand174({
31188
30682
  meta: { name: opts.name, description: opts.description },
31189
30683
  args: {
31190
30684
  platform: { type: "string", description: "Single platform to segment on", required: false },
@@ -31233,7 +30727,7 @@ var formatsCommand = makeSeedCommand({
31233
30727
  });
31234
30728
 
31235
30729
  // src/commands/winning-ads/unfollow.ts
31236
- import { defineCommand as defineCommand179 } from "citty";
30730
+ import { defineCommand as defineCommand175 } from "citty";
31237
30731
  registerSchema({
31238
30732
  command: "winning-ads.unfollow",
31239
30733
  description: "Stop following a brand \u2014 removes it from your ad-dna library by advertiser id.",
@@ -31241,7 +30735,7 @@ registerSchema({
31241
30735
  advertiser: { type: "string", description: "Advertiser id to unfollow", required: true }
31242
30736
  }
31243
30737
  });
31244
- var unfollowCommand = defineCommand179({
30738
+ var unfollowCommand = defineCommand175({
31245
30739
  meta: {
31246
30740
  name: "unfollow",
31247
30741
  description: "Stop following a brand by advertiser id. Example: baker winning-ads unfollow adv_123"
@@ -31262,7 +30756,7 @@ var unfollowCommand = defineCommand179({
31262
30756
  });
31263
30757
 
31264
30758
  // src/commands/winning-ads/winners.ts
31265
- import { defineCommand as defineCommand180 } from "citty";
30759
+ import { defineCommand as defineCommand176 } from "citty";
31266
30760
  registerSchema({
31267
30761
  command: "winning-ads.winners",
31268
30762
  description: "Top winning ads for one advertiser id (from `advertisers` or `following`). Returns lean winner cards; add --full for DNA + longevity.",
@@ -31272,7 +30766,7 @@ registerSchema({
31272
30766
  platform: { type: "string", description: "Filter to a single platform: meta|linkedin", required: false }
31273
30767
  }
31274
30768
  });
31275
- var winnersCommand = defineCommand180({
30769
+ var winnersCommand = defineCommand176({
31276
30770
  meta: {
31277
30771
  name: "winners",
31278
30772
  description: "Top winning ads for a specific advertiser id. Example: baker winning-ads winners adv_123 --top 15 --output md"
@@ -31322,7 +30816,7 @@ var winnersCommand = defineCommand180({
31322
30816
  });
31323
30817
 
31324
30818
  // src/commands/winning-ads/index.ts
31325
- var winningAdsCommand = defineCommand181({
30819
+ var winningAdsCommand = defineCommand177({
31326
30820
  meta: {
31327
30821
  name: "winning-ads",
31328
30822
  description: `Search the ad-dna corpus of scored "winning" ads for reference creatives to reproduce, and manage the brands your library tracks. Proxied through the Baker backend (BAKER_API_KEY) \u2014 no separate token needed.
@@ -31378,7 +30872,7 @@ Full guide: __tooling__/docs/tools/baker/winning-ads.md`
31378
30872
  });
31379
30873
 
31380
30874
  // src/version.ts
31381
- import { readFileSync as readFileSync13 } from "fs";
30875
+ import { readFileSync as readFileSync12 } from "fs";
31382
30876
  function packageJsonUrl() {
31383
30877
  return new URL("../package.json", import.meta.url);
31384
30878
  }
@@ -31390,15 +30884,15 @@ function parsePackageVersion(raw) {
31390
30884
  throw new Error("Invalid CLI package.json: missing version");
31391
30885
  }
31392
30886
  function getCliVersion() {
31393
- return parsePackageVersion(readFileSync13(packageJsonUrl(), "utf8"));
30887
+ return parsePackageVersion(readFileSync12(packageJsonUrl(), "utf8"));
31394
30888
  }
31395
30889
 
31396
30890
  // src/cli.ts
31397
- var main = defineCommand182({
30891
+ var main = defineCommand178({
31398
30892
  meta: {
31399
30893
  name: "baker",
31400
30894
  version: getCliVersion(),
31401
- description: `AI-agent CLI for finding and managing images, videos, testimonials, action items, scheduled actions, marketing tags, Tag Manager containers, account history, and ad platform data in Baker.
30895
+ description: `AI-agent CLI for finding and managing images, videos, testimonials, action items, scheduled actions, marketing tags, account history, and ad platform data in Baker.
31402
30896
 
31403
30897
  Auth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.
31404
30898
  Chat: Set BAKER_CHAT_ID for action and scheduled-action commands that stage changes against a chat.
@@ -31421,7 +30915,6 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
31421
30915
  testimonials: testimonialsCommand,
31422
30916
  canvas: canvasCommand,
31423
30917
  tags: tagsCommand3,
31424
- "tag-manager": tagManagerCommand,
31425
30918
  chats: chatsCommand,
31426
30919
  history: historyCommand,
31427
30920
  "winning-ads": winningAdsCommand,