@koda-sl/baker-cli 0.149.0 → 0.150.0-dev.57528fa3f
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-
|
|
39
|
+
} from "./chunk-JBDSJZBZ.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
|
|
78
|
+
import { defineCommand as defineCommand182, runMain } from "citty";
|
|
79
79
|
|
|
80
80
|
// src/commands/actions/index.ts
|
|
81
81
|
import { defineCommand as defineCommand18 } from "citty";
|
|
@@ -2133,6 +2133,7 @@ var chatChangeTypeSchema = z5.enum([
|
|
|
2133
2133
|
"linkedin-ads",
|
|
2134
2134
|
"google-ads",
|
|
2135
2135
|
"meta-ads",
|
|
2136
|
+
"tag-manager",
|
|
2136
2137
|
// Immediate (already-applied) library effects — see lib/chatChanges.ts.
|
|
2137
2138
|
"image",
|
|
2138
2139
|
"video",
|
|
@@ -29018,9 +29019,505 @@ var schemaCommand = defineCommand154({
|
|
|
29018
29019
|
}
|
|
29019
29020
|
});
|
|
29020
29021
|
|
|
29021
|
-
// src/commands/
|
|
29022
|
+
// src/commands/tag-manager/index.ts
|
|
29023
|
+
import { defineCommand as defineCommand158 } from "citty";
|
|
29024
|
+
|
|
29025
|
+
// src/commands/tag-manager/draft.ts
|
|
29022
29026
|
import { defineCommand as defineCommand155 } from "citty";
|
|
29023
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
|
+
var STAGE_HINTS = [
|
|
29082
|
+
"Staged only \u2014 nothing has changed in Tag Manager yet. These apply when the chat completes, in dependency order, and close as a Tag Manager version. Whether that version goes live is a per-company setting, so never promise the user their tracking is live; say the changes are ready and will apply when you finish."
|
|
29083
|
+
];
|
|
29084
|
+
async function stageOp3(op) {
|
|
29085
|
+
const chatId = requireChatId();
|
|
29086
|
+
try {
|
|
29087
|
+
const data = await apiPost("/api/tag-manager/draft/stage", { chatId, op });
|
|
29088
|
+
writeJsonEnvelope({ ok: true, data, hints: STAGE_HINTS });
|
|
29089
|
+
} catch (err) {
|
|
29090
|
+
handleError3(err);
|
|
29091
|
+
}
|
|
29092
|
+
}
|
|
29093
|
+
async function draftAction2(path27, body) {
|
|
29094
|
+
const chatId = requireChatId();
|
|
29095
|
+
try {
|
|
29096
|
+
const data = await apiPost(path27, { chatId, ...body });
|
|
29097
|
+
writeJsonEnvelope({ ok: true, data });
|
|
29098
|
+
return data;
|
|
29099
|
+
} catch (err) {
|
|
29100
|
+
handleError3(err);
|
|
29101
|
+
}
|
|
29102
|
+
}
|
|
29103
|
+
function renderDraft(response) {
|
|
29104
|
+
if (response.count === 0) {
|
|
29105
|
+
return "No Tag Manager changes staged on this chat.";
|
|
29106
|
+
}
|
|
29107
|
+
const lines = [
|
|
29108
|
+
`${response.count} staged Tag Manager change(s)`,
|
|
29109
|
+
...response.ops.map((op) => {
|
|
29110
|
+
const status = op.result ? ` [${op.result.status}]` : "";
|
|
29111
|
+
return ` ${op.ref} ${op.summary}${status}`;
|
|
29112
|
+
})
|
|
29113
|
+
];
|
|
29114
|
+
if (response.versionId) {
|
|
29115
|
+
lines.push(
|
|
29116
|
+
"",
|
|
29117
|
+
response.published ? `Applied and published as Tag Manager version ${response.versionId}. These changes are live on the site.` : `Applied into Tag Manager version ${response.versionId}. It is NOT published \u2014 publish it in Tag Manager to go live.`
|
|
29118
|
+
);
|
|
29119
|
+
}
|
|
29120
|
+
if (response.compilerError) {
|
|
29121
|
+
lines.push("", `Tag Manager reported a problem building the version: ${response.compilerError}`);
|
|
29122
|
+
}
|
|
29123
|
+
return lines.join("\n");
|
|
29124
|
+
}
|
|
29125
|
+
async function draftList(json) {
|
|
29126
|
+
const chatId = requireChatId();
|
|
29127
|
+
try {
|
|
29128
|
+
const data = await apiPost("/api/tag-manager/draft", { chatId });
|
|
29129
|
+
if (json) {
|
|
29130
|
+
writeJsonEnvelope({ ok: true, data });
|
|
29131
|
+
return;
|
|
29132
|
+
}
|
|
29133
|
+
process.stdout.write(`${renderDraft(data)}
|
|
29134
|
+
`);
|
|
29135
|
+
} catch (err) {
|
|
29136
|
+
handleError3(err);
|
|
29137
|
+
}
|
|
29138
|
+
}
|
|
29139
|
+
|
|
29140
|
+
// src/commands/tag-manager/draft.ts
|
|
29141
|
+
registerSchema({
|
|
29142
|
+
command: "tagManager.draft",
|
|
29143
|
+
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.",
|
|
29144
|
+
args: {
|
|
29145
|
+
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list", required: false }
|
|
29146
|
+
}
|
|
29147
|
+
});
|
|
29148
|
+
var draftCommand3 = defineCommand155({
|
|
29149
|
+
meta: {
|
|
29150
|
+
name: "draft",
|
|
29151
|
+
description: "List, show, amend, remove, or clear staged Tag Manager changes for this chat"
|
|
29152
|
+
},
|
|
29153
|
+
subCommands: {
|
|
29154
|
+
list: defineCommand155({
|
|
29155
|
+
meta: {
|
|
29156
|
+
name: "list",
|
|
29157
|
+
description: "Review everything staged on this chat (--json for the raw envelope)"
|
|
29158
|
+
},
|
|
29159
|
+
args: { json: { type: "boolean", description: "Print the raw JSON envelope", required: false } },
|
|
29160
|
+
run: async ({ args }) => {
|
|
29161
|
+
await draftList(args.json === true);
|
|
29162
|
+
}
|
|
29163
|
+
}),
|
|
29164
|
+
show: defineCommand155({
|
|
29165
|
+
meta: {
|
|
29166
|
+
name: "show",
|
|
29167
|
+
description: "Print the full staged payload for one change \u2014 the receipt to verify it looks right before publish (never truncated)."
|
|
29168
|
+
},
|
|
29169
|
+
args: { ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false } },
|
|
29170
|
+
run: async ({ args }) => {
|
|
29171
|
+
await draftAction2("/api/tag-manager/draft/show", {
|
|
29172
|
+
ref: requireTarget4(args, "change")
|
|
29173
|
+
});
|
|
29174
|
+
}
|
|
29175
|
+
}),
|
|
29176
|
+
amend: defineCommand155({
|
|
29177
|
+
meta: {
|
|
29178
|
+
name: "amend",
|
|
29179
|
+
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."
|
|
29180
|
+
},
|
|
29181
|
+
args: {
|
|
29182
|
+
ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false },
|
|
29183
|
+
patch: { type: "string", description: "Inline JSON patch object", required: false },
|
|
29184
|
+
file: { type: "string", description: "JSON file with the patch object", required: false }
|
|
29185
|
+
},
|
|
29186
|
+
run: async ({ args }) => {
|
|
29187
|
+
await draftAction2("/api/tag-manager/draft/amend", {
|
|
29188
|
+
ref: requireTarget4(args, "change"),
|
|
29189
|
+
patch: loadJsonArg(args, "patch")
|
|
29190
|
+
});
|
|
29191
|
+
}
|
|
29192
|
+
}),
|
|
29193
|
+
remove: defineCommand155({
|
|
29194
|
+
meta: { name: "remove", description: "Remove one staged change (cascades to anything depending on it)" },
|
|
29195
|
+
args: { ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false } },
|
|
29196
|
+
run: async ({ args }) => {
|
|
29197
|
+
await draftAction2("/api/tag-manager/draft/remove", {
|
|
29198
|
+
ref: requireTarget4(args, "change")
|
|
29199
|
+
});
|
|
29200
|
+
}
|
|
29201
|
+
}),
|
|
29202
|
+
clear: defineCommand155({
|
|
29203
|
+
meta: { name: "clear", description: "Discard all Tag Manager changes staged on this chat" },
|
|
29204
|
+
run: async () => {
|
|
29205
|
+
await draftAction2("/api/tag-manager/draft/clear", {});
|
|
29206
|
+
}
|
|
29207
|
+
})
|
|
29208
|
+
}
|
|
29209
|
+
});
|
|
29210
|
+
|
|
29211
|
+
// src/commands/tag-manager/read.ts
|
|
29212
|
+
import { defineCommand as defineCommand156 } from "citty";
|
|
29213
|
+
registerSchema({
|
|
29214
|
+
command: "tagManager.containers",
|
|
29215
|
+
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.",
|
|
29216
|
+
args: {}
|
|
29217
|
+
});
|
|
29218
|
+
registerSchema({
|
|
29219
|
+
command: "tagManager.read",
|
|
29220
|
+
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.",
|
|
29221
|
+
args: {
|
|
29222
|
+
container: { type: "string", description: "Numeric container id (defaults to the connected one)", required: false },
|
|
29223
|
+
workspace: { type: "string", description: "Workspace id (defaults to the default workspace)", required: false },
|
|
29224
|
+
entities: {
|
|
29225
|
+
type: "string",
|
|
29226
|
+
description: "Comma-separated subset: tag,trigger,variable,folder,builtInVariable",
|
|
29227
|
+
required: false
|
|
29228
|
+
},
|
|
29229
|
+
full: { type: "boolean", description: "Include the raw Tag Manager object for each entity", required: false }
|
|
29230
|
+
}
|
|
29231
|
+
});
|
|
29232
|
+
function fail6(err) {
|
|
29233
|
+
if (err instanceof ApiError) {
|
|
29234
|
+
const notConnected = err.code === "NOT_FOUND" || err.code === "UNAUTHORIZED";
|
|
29235
|
+
writeJsonEnvelope({
|
|
29236
|
+
ok: false,
|
|
29237
|
+
error: {
|
|
29238
|
+
code: err.code,
|
|
29239
|
+
message: err.message,
|
|
29240
|
+
...notConnected ? {
|
|
29241
|
+
fix: {
|
|
29242
|
+
action: "ask_user",
|
|
29243
|
+
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."
|
|
29244
|
+
}
|
|
29245
|
+
} : {},
|
|
29246
|
+
retryable: false
|
|
29247
|
+
}
|
|
29248
|
+
});
|
|
29249
|
+
process.exit(1);
|
|
29250
|
+
}
|
|
29251
|
+
writeJsonEnvelope({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
|
|
29252
|
+
process.exit(1);
|
|
29253
|
+
}
|
|
29254
|
+
var containersCommand = defineCommand156({
|
|
29255
|
+
meta: {
|
|
29256
|
+
name: "containers",
|
|
29257
|
+
description: `List Tag Manager containers reachable by this company's connection.
|
|
29258
|
+
|
|
29259
|
+
Start here:
|
|
29260
|
+
baker tag-manager containers`
|
|
29261
|
+
},
|
|
29262
|
+
run: async () => {
|
|
29263
|
+
try {
|
|
29264
|
+
const data = await apiGet("/api/tag-manager/containers");
|
|
29265
|
+
writeJsonEnvelope({ ok: true, data });
|
|
29266
|
+
} catch (err) {
|
|
29267
|
+
fail6(err);
|
|
29268
|
+
}
|
|
29269
|
+
}
|
|
29270
|
+
});
|
|
29271
|
+
var readCommand = defineCommand156({
|
|
29272
|
+
meta: {
|
|
29273
|
+
name: "read",
|
|
29274
|
+
description: `Read the current contents of the Tag Manager container \u2014 always do this before staging changes.
|
|
29275
|
+
|
|
29276
|
+
Examples:
|
|
29277
|
+
baker tag-manager read
|
|
29278
|
+
baker tag-manager read --entities tag,trigger
|
|
29279
|
+
baker tag-manager read --full`
|
|
29280
|
+
},
|
|
29281
|
+
args: {
|
|
29282
|
+
container: { type: "string", description: "Numeric container id", required: false },
|
|
29283
|
+
workspace: { type: "string", description: "Workspace id", required: false },
|
|
29284
|
+
entities: { type: "string", description: "Comma-separated entity subset", required: false },
|
|
29285
|
+
full: { type: "boolean", description: "Include raw Tag Manager objects", required: false }
|
|
29286
|
+
},
|
|
29287
|
+
run: async ({ args }) => {
|
|
29288
|
+
const entities = typeof args.entities === "string" && args.entities.length > 0 ? args.entities.split(",").map((entry) => entry.trim()) : void 0;
|
|
29289
|
+
try {
|
|
29290
|
+
const data = await apiPost("/api/tag-manager/read", {
|
|
29291
|
+
containerId: args.container,
|
|
29292
|
+
workspaceId: args.workspace,
|
|
29293
|
+
entities,
|
|
29294
|
+
full: args.full === true
|
|
29295
|
+
});
|
|
29296
|
+
const hints = [];
|
|
29297
|
+
if (data.installedContainerMismatch) {
|
|
29298
|
+
hints.push(data.installedContainerMismatch);
|
|
29299
|
+
}
|
|
29300
|
+
hints.push(
|
|
29301
|
+
"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."
|
|
29302
|
+
);
|
|
29303
|
+
writeJsonEnvelope({ ok: true, data, hints });
|
|
29304
|
+
} catch (err) {
|
|
29305
|
+
fail6(err);
|
|
29306
|
+
}
|
|
29307
|
+
}
|
|
29308
|
+
});
|
|
29309
|
+
|
|
29310
|
+
// src/commands/tag-manager/write-commands.ts
|
|
29311
|
+
import { defineCommand as defineCommand157 } from "citty";
|
|
29312
|
+
var ENTITIES = [
|
|
29313
|
+
{
|
|
29314
|
+
entity: "tag",
|
|
29315
|
+
noun: "tag",
|
|
29316
|
+
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.'
|
|
29317
|
+
},
|
|
29318
|
+
{
|
|
29319
|
+
entity: "trigger",
|
|
29320
|
+
noun: "trigger",
|
|
29321
|
+
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.'
|
|
29322
|
+
},
|
|
29323
|
+
{
|
|
29324
|
+
entity: "variable",
|
|
29325
|
+
noun: "variable",
|
|
29326
|
+
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}}.'
|
|
29327
|
+
},
|
|
29328
|
+
{
|
|
29329
|
+
entity: "folder",
|
|
29330
|
+
noun: "folder",
|
|
29331
|
+
createHint: "Payload needs name. Use folders to keep a large container legible."
|
|
29332
|
+
}
|
|
29333
|
+
];
|
|
29334
|
+
for (const { entity, noun, createHint } of ENTITIES) {
|
|
29335
|
+
registerSchema({
|
|
29336
|
+
command: `tagManager.${entity}.create`,
|
|
29337
|
+
description: `Stage the creation of a Tag Manager ${noun}. ${createHint} Staged only \u2014 applies on publish into an unpublished container version.`,
|
|
29338
|
+
args: {
|
|
29339
|
+
json: { type: "string", description: `Inline JSON ${noun} definition`, required: false },
|
|
29340
|
+
file: { type: "string", description: `Path to a JSON file with the ${noun} definition`, required: false },
|
|
29341
|
+
container: { type: "string", description: "Numeric container id", required: false }
|
|
29342
|
+
}
|
|
29343
|
+
});
|
|
29344
|
+
registerSchema({
|
|
29345
|
+
command: `tagManager.${entity}.update`,
|
|
29346
|
+
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.`,
|
|
29347
|
+
args: {
|
|
29348
|
+
json: { type: "string", description: "Inline JSON with the changed fields", required: false },
|
|
29349
|
+
file: { type: "string", description: "Path to a JSON file with the changed fields", required: false }
|
|
29350
|
+
}
|
|
29351
|
+
});
|
|
29352
|
+
registerSchema({
|
|
29353
|
+
command: `tagManager.${entity}.delete`,
|
|
29354
|
+
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.`,
|
|
29355
|
+
args: {}
|
|
29356
|
+
});
|
|
29357
|
+
}
|
|
29358
|
+
function entityCommand(entity, noun) {
|
|
29359
|
+
return defineCommand157({
|
|
29360
|
+
meta: { name: entity, description: `Stage ${noun} changes on this chat's Tag Manager draft` },
|
|
29361
|
+
subCommands: {
|
|
29362
|
+
create: defineCommand157({
|
|
29363
|
+
meta: {
|
|
29364
|
+
name: "create",
|
|
29365
|
+
description: `Stage a new ${noun}
|
|
29366
|
+
|
|
29367
|
+
Examples:
|
|
29368
|
+
baker tag-manager ${entity} create --json '{"name":"GA4 Config","type":"googtag"}'
|
|
29369
|
+
baker tag-manager ${entity} create --file ./${entity}.json`
|
|
29370
|
+
},
|
|
29371
|
+
args: {
|
|
29372
|
+
json: { type: "string", description: "Inline JSON definition", required: false },
|
|
29373
|
+
file: { type: "string", description: "Path to a JSON file", required: false },
|
|
29374
|
+
container: { type: "string", description: "Numeric container id", required: false }
|
|
29375
|
+
},
|
|
29376
|
+
run: async ({ args }) => {
|
|
29377
|
+
await stageOp3({
|
|
29378
|
+
kind: `tagManager.${entity}.create`,
|
|
29379
|
+
payload: loadJsonArg(args),
|
|
29380
|
+
...typeof args.container === "string" ? { containerId: args.container } : {}
|
|
29381
|
+
});
|
|
29382
|
+
}
|
|
29383
|
+
}),
|
|
29384
|
+
update: defineCommand157({
|
|
29385
|
+
meta: {
|
|
29386
|
+
name: "update",
|
|
29387
|
+
description: `Stage an update to an existing ${noun} (pass its id or path)`
|
|
29388
|
+
},
|
|
29389
|
+
args: {
|
|
29390
|
+
id: { type: "positional", description: `${noun} id or path`, required: false },
|
|
29391
|
+
json: { type: "string", description: "Inline JSON with changed fields", required: false },
|
|
29392
|
+
file: { type: "string", description: "Path to a JSON file", required: false },
|
|
29393
|
+
container: { type: "string", description: "Numeric container id", required: false }
|
|
29394
|
+
},
|
|
29395
|
+
run: async ({ args }) => {
|
|
29396
|
+
await stageOp3({
|
|
29397
|
+
kind: `tagManager.${entity}.update`,
|
|
29398
|
+
target: requireTarget4(args, noun),
|
|
29399
|
+
payload: loadJsonArg(args),
|
|
29400
|
+
...typeof args.container === "string" ? { containerId: args.container } : {}
|
|
29401
|
+
});
|
|
29402
|
+
}
|
|
29403
|
+
}),
|
|
29404
|
+
delete: defineCommand157({
|
|
29405
|
+
meta: { name: "delete", description: `Stage the deletion of a ${noun} (pass its id or path)` },
|
|
29406
|
+
args: {
|
|
29407
|
+
id: { type: "positional", description: `${noun} id or path`, required: false },
|
|
29408
|
+
container: { type: "string", description: "Numeric container id", required: false }
|
|
29409
|
+
},
|
|
29410
|
+
run: async ({ args }) => {
|
|
29411
|
+
await stageOp3({
|
|
29412
|
+
kind: `tagManager.${entity}.delete`,
|
|
29413
|
+
target: requireTarget4(args, noun),
|
|
29414
|
+
...typeof args.container === "string" ? { containerId: args.container } : {}
|
|
29415
|
+
});
|
|
29416
|
+
}
|
|
29417
|
+
})
|
|
29418
|
+
}
|
|
29419
|
+
});
|
|
29420
|
+
}
|
|
29421
|
+
var tagCommand = entityCommand("tag", "tag");
|
|
29422
|
+
var triggerCommand2 = entityCommand("trigger", "trigger");
|
|
29423
|
+
var variableCommand = entityCommand("variable", "variable");
|
|
29424
|
+
var folderCommand = entityCommand("folder", "folder");
|
|
29425
|
+
registerSchema({
|
|
29426
|
+
command: "tagManager.builtin",
|
|
29427
|
+
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}}.",
|
|
29428
|
+
args: {
|
|
29429
|
+
types: { type: "string", description: "Comma-separated built-in variable types", required: true }
|
|
29430
|
+
}
|
|
29431
|
+
});
|
|
29432
|
+
function builtinTypes(args) {
|
|
29433
|
+
const raw = args.types;
|
|
29434
|
+
if (typeof raw !== "string" || raw.length === 0) {
|
|
29435
|
+
process.stdout.write(
|
|
29436
|
+
`${JSON.stringify({ ok: false, error: { code: "VALIDATION_ERROR", message: "pass --types with comma-separated built-in variable types" } }, null, 2)}
|
|
29437
|
+
`
|
|
29438
|
+
);
|
|
29439
|
+
process.exit(1);
|
|
29440
|
+
}
|
|
29441
|
+
return raw.split(",").map((entry) => entry.trim());
|
|
29442
|
+
}
|
|
29443
|
+
var builtinCommand = defineCommand157({
|
|
29444
|
+
meta: {
|
|
29445
|
+
name: "builtin",
|
|
29446
|
+
description: `Enable or disable built-in variables
|
|
29447
|
+
|
|
29448
|
+
Examples:
|
|
29449
|
+
baker tag-manager builtin enable --types clickUrl,clickText
|
|
29450
|
+
baker tag-manager builtin disable --types formId`
|
|
29451
|
+
},
|
|
29452
|
+
subCommands: {
|
|
29453
|
+
enable: defineCommand157({
|
|
29454
|
+
meta: { name: "enable", description: "Stage enabling built-in variables" },
|
|
29455
|
+
args: {
|
|
29456
|
+
types: { type: "string", description: "Comma-separated types", required: false },
|
|
29457
|
+
container: { type: "string", description: "Numeric container id", required: false }
|
|
29458
|
+
},
|
|
29459
|
+
run: async ({ args }) => {
|
|
29460
|
+
await stageOp3({
|
|
29461
|
+
kind: "tagManager.builtInVariable.enable",
|
|
29462
|
+
payload: { type: builtinTypes(args) },
|
|
29463
|
+
...typeof args.container === "string" ? { containerId: args.container } : {}
|
|
29464
|
+
});
|
|
29465
|
+
}
|
|
29466
|
+
}),
|
|
29467
|
+
disable: defineCommand157({
|
|
29468
|
+
meta: { name: "disable", description: "Stage disabling built-in variables" },
|
|
29469
|
+
args: {
|
|
29470
|
+
types: { type: "string", description: "Comma-separated types", required: false },
|
|
29471
|
+
container: { type: "string", description: "Numeric container id", required: false }
|
|
29472
|
+
},
|
|
29473
|
+
run: async ({ args }) => {
|
|
29474
|
+
await stageOp3({
|
|
29475
|
+
kind: "tagManager.builtInVariable.disable",
|
|
29476
|
+
payload: { type: builtinTypes(args) },
|
|
29477
|
+
...typeof args.container === "string" ? { containerId: args.container } : {}
|
|
29478
|
+
});
|
|
29479
|
+
}
|
|
29480
|
+
})
|
|
29481
|
+
}
|
|
29482
|
+
});
|
|
29483
|
+
|
|
29484
|
+
// src/commands/tag-manager/index.ts
|
|
29485
|
+
var tagManagerCommand = defineCommand158({
|
|
29486
|
+
meta: {
|
|
29487
|
+
name: "tag-manager",
|
|
29488
|
+
description: `Read and change what lives inside the client's Google Tag Manager container \u2014 tags, triggers, variables, folders and built-in variables.
|
|
29489
|
+
|
|
29490
|
+
Start here:
|
|
29491
|
+
baker tag-manager read \u2014 see what the container holds today
|
|
29492
|
+
|
|
29493
|
+
Then stage changes (nothing is sent to Tag Manager until publish):
|
|
29494
|
+
baker tag-manager trigger create --json '{"name":"Quote Submit","type":"customEvent"}'
|
|
29495
|
+
baker tag-manager tag create --json '{"name":"GA4 Quote","type":"gaawe","firingTriggerId":["gtm_temp_trigger_..."]}'
|
|
29496
|
+
baker tag-manager draft list \u2014 review everything staged
|
|
29497
|
+
|
|
29498
|
+
On publish, staged changes are written into a new Tag Manager version that is NOT published.
|
|
29499
|
+
Tell the user to publish that version in Tag Manager to make it live.
|
|
29500
|
+
|
|
29501
|
+
This owns the CONTENTS of the container. Installing the container snippet on the site is a
|
|
29502
|
+
different job \u2014 that is \`baker tags\` with the googleTagManager tag.
|
|
29503
|
+
|
|
29504
|
+
Full guide: __tooling__/docs/tools/baker/tag-manager.md`
|
|
29505
|
+
},
|
|
29506
|
+
subCommands: {
|
|
29507
|
+
containers: containersCommand,
|
|
29508
|
+
read: readCommand,
|
|
29509
|
+
tag: tagCommand,
|
|
29510
|
+
trigger: triggerCommand2,
|
|
29511
|
+
variable: variableCommand,
|
|
29512
|
+
folder: folderCommand,
|
|
29513
|
+
builtin: builtinCommand,
|
|
29514
|
+
draft: draftCommand3
|
|
29515
|
+
}
|
|
29516
|
+
});
|
|
29517
|
+
|
|
29518
|
+
// src/commands/tags/index.ts
|
|
29519
|
+
import { defineCommand as defineCommand159 } from "citty";
|
|
29520
|
+
|
|
29024
29521
|
// src/commands/tags/shared.ts
|
|
29025
29522
|
function failApi3(err) {
|
|
29026
29523
|
if (err instanceof ApiError) {
|
|
@@ -29085,7 +29582,7 @@ async function listTags(json) {
|
|
|
29085
29582
|
failApi3(err);
|
|
29086
29583
|
}
|
|
29087
29584
|
}
|
|
29088
|
-
var listCommand10 =
|
|
29585
|
+
var listCommand10 = defineCommand159({
|
|
29089
29586
|
meta: {
|
|
29090
29587
|
name: "list",
|
|
29091
29588
|
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"
|
|
@@ -29104,7 +29601,7 @@ async function listDraft3() {
|
|
|
29104
29601
|
failApi3(err);
|
|
29105
29602
|
}
|
|
29106
29603
|
}
|
|
29107
|
-
var
|
|
29604
|
+
var draftCommand4 = defineCommand159({
|
|
29108
29605
|
meta: {
|
|
29109
29606
|
name: "draft",
|
|
29110
29607
|
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)."
|
|
@@ -29113,7 +29610,7 @@ var draftCommand3 = defineCommand155({
|
|
|
29113
29610
|
await listDraft3();
|
|
29114
29611
|
}
|
|
29115
29612
|
});
|
|
29116
|
-
var tagsCommand3 =
|
|
29613
|
+
var tagsCommand3 = defineCommand159({
|
|
29117
29614
|
meta: {
|
|
29118
29615
|
name: "tags",
|
|
29119
29616
|
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.
|
|
@@ -29131,7 +29628,7 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
|
|
|
29131
29628
|
},
|
|
29132
29629
|
subCommands: {
|
|
29133
29630
|
list: listCommand10,
|
|
29134
|
-
draft:
|
|
29631
|
+
draft: draftCommand4
|
|
29135
29632
|
},
|
|
29136
29633
|
run: async () => {
|
|
29137
29634
|
await listTags(false);
|
|
@@ -29139,10 +29636,10 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
|
|
|
29139
29636
|
});
|
|
29140
29637
|
|
|
29141
29638
|
// src/commands/testimonials/index.ts
|
|
29142
|
-
import { defineCommand as
|
|
29639
|
+
import { defineCommand as defineCommand163 } from "citty";
|
|
29143
29640
|
|
|
29144
29641
|
// src/commands/testimonials/get.ts
|
|
29145
|
-
import { defineCommand as
|
|
29642
|
+
import { defineCommand as defineCommand160 } from "citty";
|
|
29146
29643
|
registerSchema({
|
|
29147
29644
|
command: "testimonials.get",
|
|
29148
29645
|
description: "Get a single testimonial by ID",
|
|
@@ -29150,7 +29647,7 @@ registerSchema({
|
|
|
29150
29647
|
id: { type: "string", description: "Testimonial ID", required: true }
|
|
29151
29648
|
}
|
|
29152
29649
|
});
|
|
29153
|
-
var getCommand4 =
|
|
29650
|
+
var getCommand4 = defineCommand160({
|
|
29154
29651
|
meta: { name: "get", description: "Get a single testimonial by ID. Example: baker testimonials get j571abc123" },
|
|
29155
29652
|
args: {
|
|
29156
29653
|
id: { type: "positional", description: "Testimonial ID", required: false },
|
|
@@ -29187,7 +29684,7 @@ var getCommand4 = defineCommand156({
|
|
|
29187
29684
|
});
|
|
29188
29685
|
|
|
29189
29686
|
// src/commands/testimonials/list.ts
|
|
29190
|
-
import { defineCommand as
|
|
29687
|
+
import { defineCommand as defineCommand161 } from "citty";
|
|
29191
29688
|
registerSchema({
|
|
29192
29689
|
command: "testimonials.list",
|
|
29193
29690
|
description: "List testimonials with optional filters.",
|
|
@@ -29217,7 +29714,7 @@ registerSchema({
|
|
|
29217
29714
|
limit: { type: "number", description: "Max results (default 50)", required: false, default: 50 }
|
|
29218
29715
|
}
|
|
29219
29716
|
});
|
|
29220
|
-
var listCommand11 =
|
|
29717
|
+
var listCommand11 = defineCommand161({
|
|
29221
29718
|
meta: {
|
|
29222
29719
|
name: "list",
|
|
29223
29720
|
description: "List testimonials with optional filters. Example: baker testimonials list --source google --sentiment positive"
|
|
@@ -29266,7 +29763,7 @@ var listCommand11 = defineCommand157({
|
|
|
29266
29763
|
});
|
|
29267
29764
|
|
|
29268
29765
|
// src/commands/testimonials/search.ts
|
|
29269
|
-
import { defineCommand as
|
|
29766
|
+
import { defineCommand as defineCommand162 } from "citty";
|
|
29270
29767
|
function languageBiasHint(results, requestedLanguage) {
|
|
29271
29768
|
if (requestedLanguage) {
|
|
29272
29769
|
return null;
|
|
@@ -29344,7 +29841,7 @@ function buildSearchRequest(query, args) {
|
|
|
29344
29841
|
}
|
|
29345
29842
|
return body;
|
|
29346
29843
|
}
|
|
29347
|
-
var searchCommand2 =
|
|
29844
|
+
var searchCommand2 = defineCommand162({
|
|
29348
29845
|
meta: {
|
|
29349
29846
|
name: "search",
|
|
29350
29847
|
description: "Semantic search testimonials by text query. Uses hybrid BM25 + vector + reranking. Example: baker testimonials search 'great service' --rating-min 4"
|
|
@@ -29400,7 +29897,7 @@ var searchCommand2 = defineCommand158({
|
|
|
29400
29897
|
var tagsCommand4 = makeTagsCommand("testimonials", "testimonial", "/api/testimonials/tags");
|
|
29401
29898
|
|
|
29402
29899
|
// src/commands/testimonials/index.ts
|
|
29403
|
-
var testimonialsCommand =
|
|
29900
|
+
var testimonialsCommand = defineCommand163({
|
|
29404
29901
|
meta: {
|
|
29405
29902
|
name: "testimonials",
|
|
29406
29903
|
description: `Find and browse testimonials in Baker. Subcommands: search, get, list, tags.
|
|
@@ -29422,10 +29919,10 @@ Full guide: __tooling__/docs/tools/baker/testimonials.md`
|
|
|
29422
29919
|
});
|
|
29423
29920
|
|
|
29424
29921
|
// src/commands/videos/index.ts
|
|
29425
|
-
import { defineCommand as
|
|
29922
|
+
import { defineCommand as defineCommand168 } from "citty";
|
|
29426
29923
|
|
|
29427
29924
|
// src/commands/videos/delete.ts
|
|
29428
|
-
import { defineCommand as
|
|
29925
|
+
import { defineCommand as defineCommand164 } from "citty";
|
|
29429
29926
|
registerSchema({
|
|
29430
29927
|
command: "videos.delete",
|
|
29431
29928
|
description: "Delete a video by ID",
|
|
@@ -29439,7 +29936,7 @@ registerSchema({
|
|
|
29439
29936
|
}
|
|
29440
29937
|
}
|
|
29441
29938
|
});
|
|
29442
|
-
var deleteCommand3 =
|
|
29939
|
+
var deleteCommand3 = defineCommand164({
|
|
29443
29940
|
meta: {
|
|
29444
29941
|
name: "delete",
|
|
29445
29942
|
description: "Delete a video by ID. Use --dry-run to preview. Example: baker videos delete j571abc123 --dry-run"
|
|
@@ -29480,7 +29977,7 @@ var deleteCommand3 = defineCommand160({
|
|
|
29480
29977
|
});
|
|
29481
29978
|
|
|
29482
29979
|
// src/commands/videos/get.ts
|
|
29483
|
-
import { defineCommand as
|
|
29980
|
+
import { defineCommand as defineCommand165 } from "citty";
|
|
29484
29981
|
registerSchema({
|
|
29485
29982
|
command: "videos.get",
|
|
29486
29983
|
description: "Get a single video by ID",
|
|
@@ -29488,7 +29985,7 @@ registerSchema({
|
|
|
29488
29985
|
id: { type: "string", description: "Video ID", required: true }
|
|
29489
29986
|
}
|
|
29490
29987
|
});
|
|
29491
|
-
var getCommand5 =
|
|
29988
|
+
var getCommand5 = defineCommand165({
|
|
29492
29989
|
meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
|
|
29493
29990
|
args: {
|
|
29494
29991
|
id: { type: "positional", description: "Video ID", required: false },
|
|
@@ -29525,7 +30022,7 @@ var getCommand5 = defineCommand161({
|
|
|
29525
30022
|
});
|
|
29526
30023
|
|
|
29527
30024
|
// src/commands/videos/search.ts
|
|
29528
|
-
import { defineCommand as
|
|
30025
|
+
import { defineCommand as defineCommand166 } from "citty";
|
|
29529
30026
|
registerSchema({
|
|
29530
30027
|
command: "videos.search",
|
|
29531
30028
|
description: "Search videos by text query. Only returns ready videos.",
|
|
@@ -29535,7 +30032,7 @@ registerSchema({
|
|
|
29535
30032
|
tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
|
|
29536
30033
|
}
|
|
29537
30034
|
});
|
|
29538
|
-
var searchCommand3 =
|
|
30035
|
+
var searchCommand3 = defineCommand166({
|
|
29539
30036
|
meta: {
|
|
29540
30037
|
name: "search",
|
|
29541
30038
|
description: "Semantic search videos by text query. Uses hybrid BM25 + vector + reranking. Example: baker videos search 'product demo' --tags tutorial"
|
|
@@ -29587,7 +30084,7 @@ var tagsCommand5 = makeTagsCommand("videos", "video", "/api/videos/tags");
|
|
|
29587
30084
|
// src/commands/videos/upload.ts
|
|
29588
30085
|
import { readFile as readFile22, stat as stat7 } from "fs/promises";
|
|
29589
30086
|
import { extname as extname3 } from "path";
|
|
29590
|
-
import { defineCommand as
|
|
30087
|
+
import { defineCommand as defineCommand167 } from "citty";
|
|
29591
30088
|
var MIME_MAP = {
|
|
29592
30089
|
".mp4": "video/mp4",
|
|
29593
30090
|
".mov": "video/quicktime",
|
|
@@ -29621,7 +30118,7 @@ function detectContentType(filePath) {
|
|
|
29621
30118
|
}
|
|
29622
30119
|
return mime;
|
|
29623
30120
|
}
|
|
29624
|
-
var uploadCommand2 =
|
|
30121
|
+
var uploadCommand2 = defineCommand167({
|
|
29625
30122
|
meta: {
|
|
29626
30123
|
name: "upload",
|
|
29627
30124
|
description: "Upload a video file to Baker via Mux direct upload. Auto-detects content type. Example: baker videos upload ./demo.mp4"
|
|
@@ -29675,7 +30172,7 @@ var uploadCommand2 = defineCommand163({
|
|
|
29675
30172
|
});
|
|
29676
30173
|
|
|
29677
30174
|
// src/commands/videos/index.ts
|
|
29678
|
-
var videosCommand =
|
|
30175
|
+
var videosCommand = defineCommand168({
|
|
29679
30176
|
meta: {
|
|
29680
30177
|
name: "videos",
|
|
29681
30178
|
description: `Find and manage videos in Baker. Subcommands: search, get, upload, delete, tags.
|
|
@@ -29699,10 +30196,10 @@ Full guide: __tooling__/docs/tools/baker/videos.md`
|
|
|
29699
30196
|
});
|
|
29700
30197
|
|
|
29701
30198
|
// src/commands/winning-ads/index.ts
|
|
29702
|
-
import { defineCommand as
|
|
30199
|
+
import { defineCommand as defineCommand181 } from "citty";
|
|
29703
30200
|
|
|
29704
30201
|
// src/commands/winning-ads/advertisers.ts
|
|
29705
|
-
import { defineCommand as
|
|
30202
|
+
import { defineCommand as defineCommand169 } from "citty";
|
|
29706
30203
|
|
|
29707
30204
|
// src/commands/winning-ads/shared.ts
|
|
29708
30205
|
function splitList(value) {
|
|
@@ -29755,7 +30252,7 @@ function advertiserNormalizer(record, full) {
|
|
|
29755
30252
|
last_synced_at: record.last_synced_at ?? null
|
|
29756
30253
|
};
|
|
29757
30254
|
}
|
|
29758
|
-
var advertisersCommand2 =
|
|
30255
|
+
var advertisersCommand2 = defineCommand169({
|
|
29759
30256
|
meta: {
|
|
29760
30257
|
name: "advertisers",
|
|
29761
30258
|
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'
|
|
@@ -29813,7 +30310,7 @@ var advertisersCommand2 = defineCommand165({
|
|
|
29813
30310
|
});
|
|
29814
30311
|
|
|
29815
30312
|
// src/commands/winning-ads/brief.ts
|
|
29816
|
-
import { defineCommand as
|
|
30313
|
+
import { defineCommand as defineCommand170 } from "citty";
|
|
29817
30314
|
registerSchema({
|
|
29818
30315
|
command: "winning-ads.brief",
|
|
29819
30316
|
description: "Generate a creative brief grounded in strategically-similar winning ads. Optionally describe the target creative with --dna (JSON) and steer with --notes.",
|
|
@@ -29859,7 +30356,7 @@ function parseDna(raw) {
|
|
|
29859
30356
|
}
|
|
29860
30357
|
return parsed;
|
|
29861
30358
|
}
|
|
29862
|
-
var briefCommand =
|
|
30359
|
+
var briefCommand = defineCommand170({
|
|
29863
30360
|
meta: {
|
|
29864
30361
|
name: "brief",
|
|
29865
30362
|
description: `Generate a creative brief from winning references. Example: baker winning-ads brief --dna '{"angle":"cost savings"}' --notes "B2B, LinkedIn video" --k 8`
|
|
@@ -29895,7 +30392,7 @@ var briefCommand = defineCommand166({
|
|
|
29895
30392
|
});
|
|
29896
30393
|
|
|
29897
30394
|
// src/commands/winning-ads/content.ts
|
|
29898
|
-
import { defineCommand as
|
|
30395
|
+
import { defineCommand as defineCommand171 } from "citty";
|
|
29899
30396
|
registerSchema({
|
|
29900
30397
|
command: "winning-ads.content",
|
|
29901
30398
|
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.",
|
|
@@ -29908,7 +30405,7 @@ registerSchema({
|
|
|
29908
30405
|
}
|
|
29909
30406
|
}
|
|
29910
30407
|
});
|
|
29911
|
-
var contentCommand =
|
|
30408
|
+
var contentCommand = defineCommand171({
|
|
29912
30409
|
meta: {
|
|
29913
30410
|
name: "content",
|
|
29914
30411
|
description: "Read the transcript + on-screen text + copy of one winning ad. Example: baker winning-ads content adg_123 --platform meta --full --output md"
|
|
@@ -29957,7 +30454,7 @@ var contentCommand = defineCommand167({
|
|
|
29957
30454
|
});
|
|
29958
30455
|
|
|
29959
30456
|
// src/commands/winning-ads/feed.ts
|
|
29960
|
-
import { defineCommand as
|
|
30457
|
+
import { defineCommand as defineCommand172 } from "citty";
|
|
29961
30458
|
function buildFeedParams(input) {
|
|
29962
30459
|
const params = {};
|
|
29963
30460
|
const advertiser = splitList(input.advertiser);
|
|
@@ -30009,7 +30506,7 @@ registerSchema({
|
|
|
30009
30506
|
format: { type: "string", description: "Comma-separated formats to include (e.g. static,video)", required: false }
|
|
30010
30507
|
}
|
|
30011
30508
|
});
|
|
30012
|
-
var feedCommand =
|
|
30509
|
+
var feedCommand = defineCommand172({
|
|
30013
30510
|
meta: {
|
|
30014
30511
|
name: "feed",
|
|
30015
30512
|
description: "Winners across every brand you follow (browse, then trim per advertiser). Example: baker winning-ads feed --per-advertiser 5 --output md"
|
|
@@ -30094,7 +30591,7 @@ var feedCommand = defineCommand168({
|
|
|
30094
30591
|
});
|
|
30095
30592
|
|
|
30096
30593
|
// src/commands/winning-ads/follow.ts
|
|
30097
|
-
import { defineCommand as
|
|
30594
|
+
import { defineCommand as defineCommand173 } from "citty";
|
|
30098
30595
|
var PLATFORMS = ["meta", "linkedin"];
|
|
30099
30596
|
registerSchema({
|
|
30100
30597
|
command: "winning-ads.follow",
|
|
@@ -30109,7 +30606,7 @@ registerSchema({
|
|
|
30109
30606
|
label: { type: "string", description: "Optional display label (defaults to the resolved name)", required: false }
|
|
30110
30607
|
}
|
|
30111
30608
|
});
|
|
30112
|
-
var followCommand =
|
|
30609
|
+
var followCommand = defineCommand173({
|
|
30113
30610
|
meta: {
|
|
30114
30611
|
name: "follow",
|
|
30115
30612
|
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'
|
|
@@ -30156,7 +30653,7 @@ var followCommand = defineCommand169({
|
|
|
30156
30653
|
});
|
|
30157
30654
|
|
|
30158
30655
|
// src/commands/winning-ads/follow-competitors.ts
|
|
30159
|
-
import { defineCommand as
|
|
30656
|
+
import { defineCommand as defineCommand174 } from "citty";
|
|
30160
30657
|
var PLATFORMS2 = ["meta", "linkedin"];
|
|
30161
30658
|
var BATCH_TIMEOUT_MS = 3e5;
|
|
30162
30659
|
function buildFollowBatchBody(input) {
|
|
@@ -30189,7 +30686,7 @@ registerSchema({
|
|
|
30189
30686
|
}
|
|
30190
30687
|
}
|
|
30191
30688
|
});
|
|
30192
|
-
var followCompetitorsCommand =
|
|
30689
|
+
var followCompetitorsCommand = defineCommand174({
|
|
30193
30690
|
meta: {
|
|
30194
30691
|
name: "follow-competitors",
|
|
30195
30692
|
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"'
|
|
@@ -30264,7 +30761,7 @@ var followCompetitorsCommand = defineCommand170({
|
|
|
30264
30761
|
});
|
|
30265
30762
|
|
|
30266
30763
|
// src/commands/winning-ads/following.ts
|
|
30267
|
-
import { defineCommand as
|
|
30764
|
+
import { defineCommand as defineCommand175 } from "citty";
|
|
30268
30765
|
registerSchema({
|
|
30269
30766
|
command: "winning-ads.following",
|
|
30270
30767
|
description: "List the brands you follow in your ad-dna library, with each one's status (ready vs still adding) and cached ad counts.",
|
|
@@ -30297,7 +30794,7 @@ function followingNormalizer(record, full) {
|
|
|
30297
30794
|
platforms: Array.isArray(record.platforms) ? record.platforms : []
|
|
30298
30795
|
};
|
|
30299
30796
|
}
|
|
30300
|
-
var followingCommand =
|
|
30797
|
+
var followingCommand = defineCommand175({
|
|
30301
30798
|
meta: {
|
|
30302
30799
|
name: "following",
|
|
30303
30800
|
description: "List brands you follow, with status (ready / adding\u2026) and cached counts. Example: baker winning-ads following --output md"
|
|
@@ -30332,7 +30829,7 @@ var followingCommand = defineCommand171({
|
|
|
30332
30829
|
});
|
|
30333
30830
|
|
|
30334
30831
|
// src/commands/winning-ads/patterns.ts
|
|
30335
|
-
import { defineCommand as
|
|
30832
|
+
import { defineCommand as defineCommand176 } from "citty";
|
|
30336
30833
|
registerSchema({
|
|
30337
30834
|
command: "winning-ads.patterns",
|
|
30338
30835
|
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.",
|
|
@@ -30371,7 +30868,7 @@ function discriminatorRow(record) {
|
|
|
30371
30868
|
top_values_duds: Array.isArray(record.top_values_b) ? record.top_values_b.join(", ") : ""
|
|
30372
30869
|
};
|
|
30373
30870
|
}
|
|
30374
|
-
var patternsCommand =
|
|
30871
|
+
var patternsCommand = defineCommand176({
|
|
30375
30872
|
meta: {
|
|
30376
30873
|
name: "patterns",
|
|
30377
30874
|
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"
|
|
@@ -30427,7 +30924,7 @@ var patternsCommand = defineCommand172({
|
|
|
30427
30924
|
});
|
|
30428
30925
|
|
|
30429
30926
|
// src/commands/winning-ads/search.ts
|
|
30430
|
-
import { defineCommand as
|
|
30927
|
+
import { defineCommand as defineCommand177 } from "citty";
|
|
30431
30928
|
registerSchema({
|
|
30432
30929
|
command: "winning-ads.search",
|
|
30433
30930
|
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.",
|
|
@@ -30535,7 +31032,7 @@ function buildSearchBody(args) {
|
|
|
30535
31032
|
}
|
|
30536
31033
|
return body;
|
|
30537
31034
|
}
|
|
30538
|
-
var searchCommand4 =
|
|
31035
|
+
var searchCommand4 = defineCommand177({
|
|
30539
31036
|
meta: {
|
|
30540
31037
|
name: "search",
|
|
30541
31038
|
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"
|
|
@@ -30650,7 +31147,7 @@ var searchCommand4 = defineCommand173({
|
|
|
30650
31147
|
});
|
|
30651
31148
|
|
|
30652
31149
|
// src/commands/winning-ads/seeds.ts
|
|
30653
|
-
import { defineCommand as
|
|
31150
|
+
import { defineCommand as defineCommand178 } from "citty";
|
|
30654
31151
|
function leanRow(r) {
|
|
30655
31152
|
return {
|
|
30656
31153
|
key: r.key,
|
|
@@ -30678,7 +31175,7 @@ function makeSeedCommand(opts) {
|
|
|
30678
31175
|
limit: { type: "number", description: "Max keys 1-100 (default 20)", required: false, default: 20 }
|
|
30679
31176
|
}
|
|
30680
31177
|
});
|
|
30681
|
-
return
|
|
31178
|
+
return defineCommand178({
|
|
30682
31179
|
meta: { name: opts.name, description: opts.description },
|
|
30683
31180
|
args: {
|
|
30684
31181
|
platform: { type: "string", description: "Single platform to segment on", required: false },
|
|
@@ -30727,7 +31224,7 @@ var formatsCommand = makeSeedCommand({
|
|
|
30727
31224
|
});
|
|
30728
31225
|
|
|
30729
31226
|
// src/commands/winning-ads/unfollow.ts
|
|
30730
|
-
import { defineCommand as
|
|
31227
|
+
import { defineCommand as defineCommand179 } from "citty";
|
|
30731
31228
|
registerSchema({
|
|
30732
31229
|
command: "winning-ads.unfollow",
|
|
30733
31230
|
description: "Stop following a brand \u2014 removes it from your ad-dna library by advertiser id.",
|
|
@@ -30735,7 +31232,7 @@ registerSchema({
|
|
|
30735
31232
|
advertiser: { type: "string", description: "Advertiser id to unfollow", required: true }
|
|
30736
31233
|
}
|
|
30737
31234
|
});
|
|
30738
|
-
var unfollowCommand =
|
|
31235
|
+
var unfollowCommand = defineCommand179({
|
|
30739
31236
|
meta: {
|
|
30740
31237
|
name: "unfollow",
|
|
30741
31238
|
description: "Stop following a brand by advertiser id. Example: baker winning-ads unfollow adv_123"
|
|
@@ -30756,7 +31253,7 @@ var unfollowCommand = defineCommand175({
|
|
|
30756
31253
|
});
|
|
30757
31254
|
|
|
30758
31255
|
// src/commands/winning-ads/winners.ts
|
|
30759
|
-
import { defineCommand as
|
|
31256
|
+
import { defineCommand as defineCommand180 } from "citty";
|
|
30760
31257
|
registerSchema({
|
|
30761
31258
|
command: "winning-ads.winners",
|
|
30762
31259
|
description: "Top winning ads for one advertiser id (from `advertisers` or `following`). Returns lean winner cards; add --full for DNA + longevity.",
|
|
@@ -30766,7 +31263,7 @@ registerSchema({
|
|
|
30766
31263
|
platform: { type: "string", description: "Filter to a single platform: meta|linkedin", required: false }
|
|
30767
31264
|
}
|
|
30768
31265
|
});
|
|
30769
|
-
var winnersCommand =
|
|
31266
|
+
var winnersCommand = defineCommand180({
|
|
30770
31267
|
meta: {
|
|
30771
31268
|
name: "winners",
|
|
30772
31269
|
description: "Top winning ads for a specific advertiser id. Example: baker winning-ads winners adv_123 --top 15 --output md"
|
|
@@ -30816,7 +31313,7 @@ var winnersCommand = defineCommand176({
|
|
|
30816
31313
|
});
|
|
30817
31314
|
|
|
30818
31315
|
// src/commands/winning-ads/index.ts
|
|
30819
|
-
var winningAdsCommand =
|
|
31316
|
+
var winningAdsCommand = defineCommand181({
|
|
30820
31317
|
meta: {
|
|
30821
31318
|
name: "winning-ads",
|
|
30822
31319
|
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.
|
|
@@ -30872,7 +31369,7 @@ Full guide: __tooling__/docs/tools/baker/winning-ads.md`
|
|
|
30872
31369
|
});
|
|
30873
31370
|
|
|
30874
31371
|
// src/version.ts
|
|
30875
|
-
import { readFileSync as
|
|
31372
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
30876
31373
|
function packageJsonUrl() {
|
|
30877
31374
|
return new URL("../package.json", import.meta.url);
|
|
30878
31375
|
}
|
|
@@ -30884,15 +31381,15 @@ function parsePackageVersion(raw) {
|
|
|
30884
31381
|
throw new Error("Invalid CLI package.json: missing version");
|
|
30885
31382
|
}
|
|
30886
31383
|
function getCliVersion() {
|
|
30887
|
-
return parsePackageVersion(
|
|
31384
|
+
return parsePackageVersion(readFileSync13(packageJsonUrl(), "utf8"));
|
|
30888
31385
|
}
|
|
30889
31386
|
|
|
30890
31387
|
// src/cli.ts
|
|
30891
|
-
var main =
|
|
31388
|
+
var main = defineCommand182({
|
|
30892
31389
|
meta: {
|
|
30893
31390
|
name: "baker",
|
|
30894
31391
|
version: getCliVersion(),
|
|
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.
|
|
31392
|
+
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.
|
|
30896
31393
|
|
|
30897
31394
|
Auth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.
|
|
30898
31395
|
Chat: Set BAKER_CHAT_ID for action and scheduled-action commands that stage changes against a chat.
|
|
@@ -30915,6 +31412,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
30915
31412
|
testimonials: testimonialsCommand,
|
|
30916
31413
|
canvas: canvasCommand,
|
|
30917
31414
|
tags: tagsCommand3,
|
|
31415
|
+
"tag-manager": tagManagerCommand,
|
|
30918
31416
|
chats: chatsCommand,
|
|
30919
31417
|
history: historyCommand,
|
|
30920
31418
|
"winning-ads": winningAdsCommand,
|