@koda-sl/baker-cli 0.379.0-dev.0114084a3 → 0.379.0-dev.600795410
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{chunk-VLUGGVJL.js → chunk-MK4AIHRF.js} +69 -15
- package/dist/chunk-MK4AIHRF.js.map +1 -0
- package/dist/cli.js +475 -917
- package/dist/cli.js.map +1 -1
- package/dist/{shared-J7DQZ2ED.js → shared-DDBXEUL4.js} +4 -2
- package/package.json +1 -1
- package/dist/chunk-VLUGGVJL.js.map +0 -1
- /package/dist/{shared-J7DQZ2ED.js.map → shared-DDBXEUL4.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -72,6 +72,7 @@ import {
|
|
|
72
72
|
ytDlpBlockSignal
|
|
73
73
|
} from "./chunk-CHJOTJTZ.js";
|
|
74
74
|
import {
|
|
75
|
+
META_ACCOUNTS_CACHE,
|
|
75
76
|
NAME_CONTAINS_ARG,
|
|
76
77
|
csvOrJson,
|
|
77
78
|
daysAgoIso,
|
|
@@ -81,7 +82,7 @@ import {
|
|
|
81
82
|
resolveEffectiveStatus,
|
|
82
83
|
statusFilterHints,
|
|
83
84
|
todayIso
|
|
84
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-MK4AIHRF.js";
|
|
85
86
|
import {
|
|
86
87
|
buildQueryCacheKey,
|
|
87
88
|
cacheGet,
|
|
@@ -143,7 +144,7 @@ import {
|
|
|
143
144
|
} from "./chunk-HJEMOSPH.js";
|
|
144
145
|
|
|
145
146
|
// src/cli.ts
|
|
146
|
-
import { defineCommand as
|
|
147
|
+
import { defineCommand as defineCommand248, runMain } from "citty";
|
|
147
148
|
|
|
148
149
|
// src/cache-flag.ts
|
|
149
150
|
var NO_CACHE_ARG = {
|
|
@@ -4534,9 +4535,6 @@ var chatChangeTypeSchema = z13.enum([
|
|
|
4534
4535
|
"image",
|
|
4535
4536
|
"video",
|
|
4536
4537
|
"followed-advertiser",
|
|
4537
|
-
// A connected social account feeding the image and video libraries, keyed
|
|
4538
|
-
// on `platform:handle`. Immediate — see convex/mediaSources/mutations.ts.
|
|
4539
|
-
"media-source",
|
|
4540
4538
|
// A landing page saved to the reference library, keyed on the page.
|
|
4541
4539
|
"landing-reference",
|
|
4542
4540
|
// One Studio batch — the takes of one brief, as a set. See convex/lib/validators.ts.
|
|
@@ -6401,9 +6399,6 @@ var imageSourceSchema = z20.enum([
|
|
|
6401
6399
|
"google_testimonial",
|
|
6402
6400
|
"trustpilot_testimonial",
|
|
6403
6401
|
"instagram",
|
|
6404
|
-
"tiktok",
|
|
6405
|
-
"linkedin",
|
|
6406
|
-
"facebook",
|
|
6407
6402
|
"pexels",
|
|
6408
6403
|
"pixabay",
|
|
6409
6404
|
// Retired stock provider — kept so existing library rows stay filterable.
|
|
@@ -8215,7 +8210,6 @@ var videoSourceSchema = z30.enum([
|
|
|
8215
8210
|
"dailymotion",
|
|
8216
8211
|
"facebook",
|
|
8217
8212
|
"instagram",
|
|
8218
|
-
"linkedin",
|
|
8219
8213
|
"loom",
|
|
8220
8214
|
"newgrounds",
|
|
8221
8215
|
"ok",
|
|
@@ -12116,9 +12110,9 @@ var COPY_LIST_FLAG = {
|
|
|
12116
12110
|
descriptions: "--descriptions",
|
|
12117
12111
|
longHeadlines: "--long-headlines"
|
|
12118
12112
|
};
|
|
12119
|
-
function valueAt(root,
|
|
12113
|
+
function valueAt(root, path48) {
|
|
12120
12114
|
let node = root;
|
|
12121
|
-
for (const key of
|
|
12115
|
+
for (const key of path48) {
|
|
12122
12116
|
if (node === null || typeof node !== "object") return void 0;
|
|
12123
12117
|
node = node[key];
|
|
12124
12118
|
}
|
|
@@ -12351,11 +12345,11 @@ function parseKeywordEntry(raw, defaultMatch) {
|
|
|
12351
12345
|
function rawTextEntries(value, rawArgs) {
|
|
12352
12346
|
return repeatedValues(rawArgs, "text", value).flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
|
|
12353
12347
|
}
|
|
12354
|
-
function rawFileEntries(
|
|
12355
|
-
if (typeof
|
|
12348
|
+
function rawFileEntries(path48) {
|
|
12349
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
12356
12350
|
return [];
|
|
12357
12351
|
}
|
|
12358
|
-
return readFileSync2(
|
|
12352
|
+
return readFileSync2(path48, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
12359
12353
|
}
|
|
12360
12354
|
function keywordEntries(args5, rawArgs) {
|
|
12361
12355
|
const defaultMatch = typeof args5["match-type"] === "string" ? args5["match-type"].toUpperCase() : void 0;
|
|
@@ -12378,14 +12372,14 @@ function keywordEntries(args5, rawArgs) {
|
|
|
12378
12372
|
}
|
|
12379
12373
|
return entries;
|
|
12380
12374
|
}
|
|
12381
|
-
function loadJsonFileArg(
|
|
12382
|
-
if (typeof
|
|
12375
|
+
function loadJsonFileArg(path48) {
|
|
12376
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
12383
12377
|
return {};
|
|
12384
12378
|
}
|
|
12385
|
-
const inline =
|
|
12386
|
-
const source = inline ? "inline JSON" :
|
|
12379
|
+
const inline = path48.trimStart().startsWith("{");
|
|
12380
|
+
const source = inline ? "inline JSON" : path48;
|
|
12387
12381
|
try {
|
|
12388
|
-
const parsed = JSON.parse(inline ?
|
|
12382
|
+
const parsed = JSON.parse(inline ? path48 : readFileSync2(path48, "utf8"));
|
|
12389
12383
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
12390
12384
|
failWriteValidation(`${source} must contain a JSON object`);
|
|
12391
12385
|
}
|
|
@@ -12522,10 +12516,10 @@ async function stageUpdate(kind, customerId, target2, payload, hints2) {
|
|
|
12522
12516
|
async function stageTarget(kind, customerId, target2, hints2) {
|
|
12523
12517
|
await stageGoogleOp({ kind, customerId, target: target2 }, hints2);
|
|
12524
12518
|
}
|
|
12525
|
-
async function draftAction(
|
|
12519
|
+
async function draftAction(path48, body, chat) {
|
|
12526
12520
|
try {
|
|
12527
12521
|
const chatId = resolveChatId(chat);
|
|
12528
|
-
const response = await apiPost(
|
|
12522
|
+
const response = await apiPost(path48, { chatId, ...body });
|
|
12529
12523
|
writeJsonEnvelope(response);
|
|
12530
12524
|
} catch (err) {
|
|
12531
12525
|
handleGoogleError(err);
|
|
@@ -14943,14 +14937,14 @@ function mappingRowProblem(row) {
|
|
|
14943
14937
|
|
|
14944
14938
|
// ../api/src/event-sources/template.ts
|
|
14945
14939
|
var MENTION = /\{\{\s*([^{}]+?)\s*\}\}/g;
|
|
14946
|
-
function mentionOf(
|
|
14947
|
-
return `{{${
|
|
14940
|
+
function mentionOf(path48) {
|
|
14941
|
+
return `{{${path48}}}`;
|
|
14948
14942
|
}
|
|
14949
14943
|
function templateMentions(template) {
|
|
14950
14944
|
const seen = [];
|
|
14951
14945
|
for (const match of template.matchAll(MENTION)) {
|
|
14952
|
-
const
|
|
14953
|
-
if (
|
|
14946
|
+
const path48 = (match[1] ?? "").trim();
|
|
14947
|
+
if (path48 !== "" && !seen.includes(path48)) seen.push(path48);
|
|
14954
14948
|
}
|
|
14955
14949
|
return seen;
|
|
14956
14950
|
}
|
|
@@ -18305,17 +18299,17 @@ function ignoredColumnHints(columns) {
|
|
|
18305
18299
|
`Ignored ${columns.length} column(s) that are not part of a conversion: ${columns.join(", ")}. A conversion carries an order id, a date, and something to match on: a click id (gclid / gbraid / wbraid), an email, a phone, or all four of givenName + familyName + country + postalCode. Optionally a value + currency, conversionCount, and eventSource (WEB / APP / IN_STORE / PHONE / OTHER). A column named just \`Name\` is ignored on purpose \u2014 Google needs the first and last name separately, so split it before re-running.`
|
|
18306
18300
|
];
|
|
18307
18301
|
}
|
|
18308
|
-
function readRowsFile(
|
|
18309
|
-
const inline =
|
|
18302
|
+
function readRowsFile(path48) {
|
|
18303
|
+
const inline = path48.trimStart().startsWith("[") || path48.trimStart().startsWith("{");
|
|
18310
18304
|
let text2;
|
|
18311
18305
|
try {
|
|
18312
|
-
text2 = inline ?
|
|
18306
|
+
text2 = inline ? path48 : readFileSync4(path48, "utf8");
|
|
18313
18307
|
} catch (err) {
|
|
18314
|
-
failWriteValidation(`could not read ${
|
|
18308
|
+
failWriteValidation(`could not read ${path48}: ${err instanceof Error ? err.message : String(err)}`);
|
|
18315
18309
|
}
|
|
18316
18310
|
const parsed = parseConversionRowsText(text2);
|
|
18317
18311
|
if (!parsed.ok) {
|
|
18318
|
-
failWriteValidation(`${inline ? "the conversions passed inline" :
|
|
18312
|
+
failWriteValidation(`${inline ? "the conversions passed inline" : path48}: ${parsed.error}`);
|
|
18319
18313
|
}
|
|
18320
18314
|
return { rows: parsed.rows, ignoredColumns: parsed.ignoredColumns };
|
|
18321
18315
|
}
|
|
@@ -20190,19 +20184,19 @@ function failWriteValidation2(message) {
|
|
|
20190
20184
|
writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
|
|
20191
20185
|
process.exit(1);
|
|
20192
20186
|
}
|
|
20193
|
-
function loadJsonFileArg2(
|
|
20194
|
-
if (typeof
|
|
20187
|
+
function loadJsonFileArg2(path48) {
|
|
20188
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
20195
20189
|
return {};
|
|
20196
20190
|
}
|
|
20197
20191
|
try {
|
|
20198
|
-
const parsed = JSON.parse(readFileSync5(
|
|
20192
|
+
const parsed = JSON.parse(readFileSync5(path48, "utf8"));
|
|
20199
20193
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
20200
|
-
failWriteValidation2(`${
|
|
20194
|
+
failWriteValidation2(`${path48} must contain a JSON object`);
|
|
20201
20195
|
}
|
|
20202
20196
|
return parsed;
|
|
20203
20197
|
} catch (err) {
|
|
20204
20198
|
if (err instanceof SyntaxError) {
|
|
20205
|
-
failWriteValidation2(`${
|
|
20199
|
+
failWriteValidation2(`${path48} is not valid JSON: ${err.message}`);
|
|
20206
20200
|
}
|
|
20207
20201
|
throw err;
|
|
20208
20202
|
}
|
|
@@ -20287,15 +20281,15 @@ function parseLocaleFlag(value) {
|
|
|
20287
20281
|
}
|
|
20288
20282
|
return { language: match[1], country: match[2].toUpperCase() };
|
|
20289
20283
|
}
|
|
20290
|
-
function loadTargetingFileArg(
|
|
20291
|
-
if (typeof
|
|
20284
|
+
function loadTargetingFileArg(path48) {
|
|
20285
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
20292
20286
|
return void 0;
|
|
20293
20287
|
}
|
|
20294
|
-
const parsed = loadJsonFileArg2(
|
|
20288
|
+
const parsed = loadJsonFileArg2(path48);
|
|
20295
20289
|
const criteria = parsed.targetingCriteria ?? parsed;
|
|
20296
20290
|
if (!criteria.include) {
|
|
20297
20291
|
failWriteValidation2(
|
|
20298
|
-
`${
|
|
20292
|
+
`${path48} must contain targeting criteria with an "include" block (see baker schema ads.linkedin.campaigns.create)`
|
|
20299
20293
|
);
|
|
20300
20294
|
}
|
|
20301
20295
|
return criteria;
|
|
@@ -20330,14 +20324,14 @@ function parseCsvLine(line) {
|
|
|
20330
20324
|
cells.push(current);
|
|
20331
20325
|
return cells.map((cell3) => cell3.trim());
|
|
20332
20326
|
}
|
|
20333
|
-
function parseListFileArg(
|
|
20334
|
-
if (typeof
|
|
20327
|
+
function parseListFileArg(path48, maxRows) {
|
|
20328
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
20335
20329
|
return void 0;
|
|
20336
20330
|
}
|
|
20337
|
-
const raw = readFileSync5(
|
|
20331
|
+
const raw = readFileSync5(path48, "utf8");
|
|
20338
20332
|
const lines = raw.split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
20339
20333
|
if (lines.length < 2) {
|
|
20340
|
-
failWriteValidation2(`${
|
|
20334
|
+
failWriteValidation2(`${path48} needs a header row and at least one data row`);
|
|
20341
20335
|
}
|
|
20342
20336
|
const columns = parseCsvLine(lines[0]).map((column) => column.trim());
|
|
20343
20337
|
const rows = [];
|
|
@@ -20356,7 +20350,7 @@ function parseListFileArg(path49, maxRows) {
|
|
|
20356
20350
|
}
|
|
20357
20351
|
}
|
|
20358
20352
|
if (rows.length > maxRows) {
|
|
20359
|
-
failWriteValidation2(`${
|
|
20353
|
+
failWriteValidation2(`${path48} has ${rows.length} rows \u2014 the inline limit is ${maxRows}. Split the list.`);
|
|
20360
20354
|
}
|
|
20361
20355
|
return { columns, rows };
|
|
20362
20356
|
}
|
|
@@ -20452,11 +20446,11 @@ function readPositionals(args5) {
|
|
|
20452
20446
|
function splitIdList(raw) {
|
|
20453
20447
|
return raw.split(",").map((id) => id.trim()).filter(Boolean);
|
|
20454
20448
|
}
|
|
20455
|
-
function idsFileEntries(
|
|
20456
|
-
if (typeof
|
|
20449
|
+
function idsFileEntries(path48) {
|
|
20450
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
20457
20451
|
return [];
|
|
20458
20452
|
}
|
|
20459
|
-
return readFileSync5(
|
|
20453
|
+
return readFileSync5(path48, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#")).flatMap(splitIdList);
|
|
20460
20454
|
}
|
|
20461
20455
|
function requireTargets(args5, entity) {
|
|
20462
20456
|
const positionals = readPositionals(args5);
|
|
@@ -23218,9 +23212,9 @@ import { defineCommand as defineCommand44 } from "citty";
|
|
|
23218
23212
|
function asRecord(value) {
|
|
23219
23213
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
23220
23214
|
}
|
|
23221
|
-
function readPath2(row,
|
|
23215
|
+
function readPath2(row, path48) {
|
|
23222
23216
|
let current = row;
|
|
23223
|
-
for (const segment of
|
|
23217
|
+
for (const segment of path48.split(".")) {
|
|
23224
23218
|
const record = asRecord(current);
|
|
23225
23219
|
if (!record) return void 0;
|
|
23226
23220
|
current = record[segment];
|
|
@@ -23230,10 +23224,10 @@ function readPath2(row, path49) {
|
|
|
23230
23224
|
function projectFields(rows, paths) {
|
|
23231
23225
|
return rows.map((row) => {
|
|
23232
23226
|
const projected = {};
|
|
23233
|
-
for (const
|
|
23234
|
-
const value = readPath2(row,
|
|
23227
|
+
for (const path48 of paths) {
|
|
23228
|
+
const value = readPath2(row, path48);
|
|
23235
23229
|
if (value !== void 0) {
|
|
23236
|
-
projected[
|
|
23230
|
+
projected[path48] = value;
|
|
23237
23231
|
}
|
|
23238
23232
|
}
|
|
23239
23233
|
return projected;
|
|
@@ -23246,16 +23240,16 @@ function shapeListRows(rows, args5, compact4) {
|
|
|
23246
23240
|
const paths = fields.split(",").map((field) => field.trim()).filter((field) => field.length > 0);
|
|
23247
23241
|
if (paths.length > 0) {
|
|
23248
23242
|
const projected = projectFields(raw, paths).map((row, i) => {
|
|
23249
|
-
const missing = paths.filter((
|
|
23243
|
+
const missing = paths.filter((path48) => row[path48] === void 0);
|
|
23250
23244
|
const source = rows[i];
|
|
23251
23245
|
if (missing.length === 0 || source === void 0) return row;
|
|
23252
23246
|
const compactRow3 = compact4.row(source);
|
|
23253
|
-
for (const
|
|
23254
|
-
if (compactRow3[
|
|
23247
|
+
for (const path48 of missing) {
|
|
23248
|
+
if (compactRow3[path48] !== void 0) row[path48] = compactRow3[path48];
|
|
23255
23249
|
}
|
|
23256
23250
|
return row;
|
|
23257
23251
|
});
|
|
23258
|
-
const unmatched = paths.filter((
|
|
23252
|
+
const unmatched = paths.filter((path48) => projected.every((row) => row[path48] === void 0));
|
|
23259
23253
|
if (projected.length === 0 || unmatched.length === 0) return { rows: projected, fields: paths };
|
|
23260
23254
|
const carried = /* @__PURE__ */ new Set([...compact4.columns, ...raw.flatMap((row) => Object.keys(row))]);
|
|
23261
23255
|
return {
|
|
@@ -24302,11 +24296,14 @@ Examples:
|
|
|
24302
24296
|
BAKER_META_AD_ACCOUNT_ID=act_123 baker ads meta account`
|
|
24303
24297
|
},
|
|
24304
24298
|
args: {
|
|
24305
|
-
"account-id": {
|
|
24299
|
+
"account-id": {
|
|
24300
|
+
type: "string",
|
|
24301
|
+
description: "Meta ad account ID (act_...); defaults to the only connected account"
|
|
24302
|
+
},
|
|
24306
24303
|
"no-cache": NO_CACHE_ARG
|
|
24307
24304
|
},
|
|
24308
24305
|
run: async ({ args: args5 }) => {
|
|
24309
|
-
const accountId = resolveAccountIdArg(args5);
|
|
24306
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
24310
24307
|
try {
|
|
24311
24308
|
const params = { "account-id": accountId };
|
|
24312
24309
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
@@ -24352,9 +24349,9 @@ Examples:
|
|
|
24352
24349
|
run: async ({ args: args5 }) => {
|
|
24353
24350
|
const includeAll = args5["include-all"] === true;
|
|
24354
24351
|
const useCache = !args5["no-cache"];
|
|
24355
|
-
const cacheKey =
|
|
24352
|
+
const cacheKey = includeAll ? "accounts:all" : META_ACCOUNTS_CACHE.key;
|
|
24356
24353
|
if (useCache) {
|
|
24357
|
-
const cached = cacheGet(
|
|
24354
|
+
const cached = cacheGet(META_ACCOUNTS_CACHE.category, cacheKey);
|
|
24358
24355
|
if (cached) {
|
|
24359
24356
|
writeJsonEnvelope({
|
|
24360
24357
|
ok: true,
|
|
@@ -24371,7 +24368,7 @@ Examples:
|
|
|
24371
24368
|
if (!useCache) params["skip-cache"] = "true";
|
|
24372
24369
|
const data = await apiGet("/api/ads/meta/accounts", params);
|
|
24373
24370
|
if (useCache) {
|
|
24374
|
-
cacheSet(
|
|
24371
|
+
cacheSet(META_ACCOUNTS_CACHE.category, cacheKey, data, META_ACCOUNTS_CACHE.ttlMs);
|
|
24375
24372
|
}
|
|
24376
24373
|
const fmt = csvOrJson(args5);
|
|
24377
24374
|
if (fmt !== "json") {
|
|
@@ -24544,7 +24541,7 @@ function registerMetaListSchema(kind, description, args5) {
|
|
|
24544
24541
|
|
|
24545
24542
|
// src/commands/ads/meta/activities.ts
|
|
24546
24543
|
var listArgs4 = {
|
|
24547
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
24544
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
24548
24545
|
days: { type: "string", description: "Lookback days (default 7)" },
|
|
24549
24546
|
limit: { type: "string", description: "Max rows" },
|
|
24550
24547
|
"no-cache": NO_CACHE_ARG,
|
|
@@ -24573,7 +24570,7 @@ Examples:
|
|
|
24573
24570
|
},
|
|
24574
24571
|
args: listArgs4,
|
|
24575
24572
|
run: async ({ args: args5 }) => {
|
|
24576
|
-
const accountId = resolveAccountIdArg(args5);
|
|
24573
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
24577
24574
|
try {
|
|
24578
24575
|
const params = { "account-id": accountId };
|
|
24579
24576
|
if (args5.days) params.days = args5.days;
|
|
@@ -24625,54 +24622,54 @@ function buildCustomConversionRule(input) {
|
|
|
24625
24622
|
function customConversionRuleRefusal(rule) {
|
|
24626
24623
|
return ruleNodeRefusal(rule, "rule");
|
|
24627
24624
|
}
|
|
24628
|
-
function branchRefusal(key, value,
|
|
24625
|
+
function branchRefusal(key, value, path48) {
|
|
24629
24626
|
if (!Array.isArray(value) || value.length === 0) {
|
|
24630
|
-
return `${
|
|
24627
|
+
return `${path48}.${key} must be a non-empty array of conditions \u2014 an empty one counts every event the pixel sends`;
|
|
24631
24628
|
}
|
|
24632
24629
|
for (const [index, child] of value.entries()) {
|
|
24633
|
-
const refusal = ruleNodeRefusal(child, `${
|
|
24630
|
+
const refusal = ruleNodeRefusal(child, `${path48}.${key}[${index}]`);
|
|
24634
24631
|
if (refusal) {
|
|
24635
24632
|
return refusal;
|
|
24636
24633
|
}
|
|
24637
24634
|
}
|
|
24638
24635
|
return void 0;
|
|
24639
24636
|
}
|
|
24640
|
-
function conditionRefusal(key, value,
|
|
24641
|
-
return key === "and" || key === "or" ? branchRefusal(key, value,
|
|
24637
|
+
function conditionRefusal(key, value, path48) {
|
|
24638
|
+
return key === "and" || key === "or" ? branchRefusal(key, value, path48) : leafRefusal(key, value, path48);
|
|
24642
24639
|
}
|
|
24643
|
-
function ruleNodeRefusal(node,
|
|
24640
|
+
function ruleNodeRefusal(node, path48) {
|
|
24644
24641
|
if (!isRecord2(node)) {
|
|
24645
|
-
return `${
|
|
24642
|
+
return `${path48} must be an object like {"URL":{"i_contains":"/thank-you"}}`;
|
|
24646
24643
|
}
|
|
24647
24644
|
const entries = Object.entries(node);
|
|
24648
24645
|
if (entries.length === 0) {
|
|
24649
|
-
return `${
|
|
24646
|
+
return `${path48} is empty \u2014 a rule with no condition counts every event the pixel sends`;
|
|
24650
24647
|
}
|
|
24651
24648
|
if (entries.length > 1) {
|
|
24652
|
-
return `${
|
|
24649
|
+
return `${path48} names ${entries.length} conditions side by side (${entries.map(([key]) => key).join(", ")}) \u2014 Meta reads one branch or one field test per object, so combine them with {"and":[\u2026]}`;
|
|
24653
24650
|
}
|
|
24654
24651
|
for (const [key, value] of entries) {
|
|
24655
|
-
const refusal = conditionRefusal(key, value,
|
|
24652
|
+
const refusal = conditionRefusal(key, value, path48);
|
|
24656
24653
|
if (refusal) {
|
|
24657
24654
|
return refusal;
|
|
24658
24655
|
}
|
|
24659
24656
|
}
|
|
24660
24657
|
return void 0;
|
|
24661
24658
|
}
|
|
24662
|
-
function leafRefusal(field, condition,
|
|
24659
|
+
function leafRefusal(field, condition, path48) {
|
|
24663
24660
|
if (!isRecord2(condition)) {
|
|
24664
|
-
return `${
|
|
24661
|
+
return `${path48}.${field} must be a test like {"i_contains":"/thank-you"}, not a bare value`;
|
|
24665
24662
|
}
|
|
24666
24663
|
const tests = Object.entries(condition);
|
|
24667
24664
|
if (tests.length === 0) {
|
|
24668
|
-
return `${
|
|
24665
|
+
return `${path48}.${field} names no test \u2014 use one of ${Object.keys(RULE_OPERATORS).join(", ")}`;
|
|
24669
24666
|
}
|
|
24670
24667
|
if (tests.length > 1) {
|
|
24671
|
-
return `${
|
|
24668
|
+
return `${path48}.${field} names ${tests.length} operators at once (${tests.map(([operator]) => operator).join(", ")}) \u2014 test a field once per condition and combine them with {"and":[\u2026]}`;
|
|
24672
24669
|
}
|
|
24673
24670
|
for (const [operator] of tests) {
|
|
24674
24671
|
if (!RULE_OPERATORS[operator]) {
|
|
24675
|
-
return `${
|
|
24672
|
+
return `${path48}.${field} uses "${operator}", which is not a Meta rule operator \u2014 use one of ${Object.keys(RULE_OPERATORS).join(", ")} (URL matching is i_contains, not contains or includes)`;
|
|
24676
24673
|
}
|
|
24677
24674
|
}
|
|
24678
24675
|
return void 0;
|
|
@@ -25153,8 +25150,7 @@ var LEAD_FORM_CTA_TYPES = [
|
|
|
25153
25150
|
var AD_FORMATS2 = ["SINGLE_IMAGE", "CAROUSEL", "SINGLE_VIDEO"];
|
|
25154
25151
|
var ENROLL_STATUSES = ["OPT_IN", "OPT_OUT"];
|
|
25155
25152
|
var STAGEABLE_CREATE_STATUSES4 = ["ACTIVE", "PAUSED"];
|
|
25156
|
-
var UPDATE_STATUSES = ["ACTIVE", "PAUSED", "ARCHIVED"
|
|
25157
|
-
var CREATIVE_UPDATE_STATUSES = ["ACTIVE", "PAUSED", "ARCHIVED"];
|
|
25153
|
+
var UPDATE_STATUSES = ["ACTIVE", "PAUSED", "ARCHIVED"];
|
|
25158
25154
|
var CUSTOM_AUDIENCE_SUBTYPES = ["CUSTOM", "WEBSITE", "ENGAGEMENT", "LOOKALIKE"];
|
|
25159
25155
|
var CUSTOMER_FILE_SOURCES = [
|
|
25160
25156
|
"USER_PROVIDED_ONLY",
|
|
@@ -25377,7 +25373,7 @@ function positionsMissingRequiredFeed(targeting) {
|
|
|
25377
25373
|
// ../api/src/ads-meta/ops.ts
|
|
25378
25374
|
var tempRefSchema4 = z37.string().regex(TEMP_REF_REGEX4, "expected a meta_temp_* reference");
|
|
25379
25375
|
var parentRefSchema3 = z37.union([z37.string().regex(NUMERIC_ID_REGEX3, "expected a numeric id"), tempRefSchema4]);
|
|
25380
|
-
var moneySchema2 = z37.
|
|
25376
|
+
var moneySchema2 = z37.object({
|
|
25381
25377
|
amount: z37.string().regex(/^\d+(\.\d{1,3})?$/, "expected a decimal amount like 50 or 50.00").refine((val) => Number(val) > 0, "amount must be greater than zero"),
|
|
25382
25378
|
currencyCode: z37.string().length(3).optional()
|
|
25383
25379
|
});
|
|
@@ -25388,11 +25384,11 @@ var updateStatusSchema = z37.enum(UPDATE_STATUSES);
|
|
|
25388
25384
|
function currencyMinimums2(currencyCode) {
|
|
25389
25385
|
return CURRENCY_MINIMUMS2[currencyCode] ?? DEFAULT_CURRENCY_MINIMUM2;
|
|
25390
25386
|
}
|
|
25391
|
-
function validateDailyBudgetFloor(money, ctx,
|
|
25387
|
+
function validateDailyBudgetFloor(money, ctx, path48) {
|
|
25392
25388
|
if (money?.currencyCode) {
|
|
25393
25389
|
const min = currencyMinimums2(money.currencyCode).dailyBudgetMin;
|
|
25394
25390
|
if (Number(money.amount) < min) {
|
|
25395
|
-
ctx.addIssue({ code: "custom", path:
|
|
25391
|
+
ctx.addIssue({ code: "custom", path: path48, message: `below the ${min} ${money.currencyCode} daily minimum` });
|
|
25396
25392
|
}
|
|
25397
25393
|
}
|
|
25398
25394
|
}
|
|
@@ -25465,7 +25461,7 @@ function targetingHardLimitsDemographics(t) {
|
|
|
25465
25461
|
return narrowsAgeMax || narrowsAgeMin || narrowsGender;
|
|
25466
25462
|
}
|
|
25467
25463
|
var specialAdCategoriesSchema = z37.array(z37.enum(SPECIAL_AD_CATEGORIES)).default(["NONE"]);
|
|
25468
|
-
var campaignCreateSchema4 = z37.
|
|
25464
|
+
var campaignCreateSchema4 = z37.object({
|
|
25469
25465
|
name: z37.string().min(1).max(META_LIMITS.campaign.nameMax),
|
|
25470
25466
|
objective: z37.enum(OBJECTIVES2),
|
|
25471
25467
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
@@ -25503,7 +25499,7 @@ var campaignCreateSchema4 = z37.strictObject({
|
|
|
25503
25499
|
});
|
|
25504
25500
|
}
|
|
25505
25501
|
});
|
|
25506
|
-
var campaignUpdateSchema4 = z37.
|
|
25502
|
+
var campaignUpdateSchema4 = z37.object({
|
|
25507
25503
|
name: z37.string().min(1).max(META_LIMITS.campaign.nameMax).optional(),
|
|
25508
25504
|
status: updateStatusSchema.optional(),
|
|
25509
25505
|
bid_strategy: z37.enum(BID_STRATEGIES2).optional(),
|
|
@@ -25521,7 +25517,7 @@ var campaignUpdateSchema4 = z37.strictObject({
|
|
|
25521
25517
|
}
|
|
25522
25518
|
validateDailyBudgetFloor(p.dailyBudget, ctx, ["dailyBudget", "amount"]);
|
|
25523
25519
|
});
|
|
25524
|
-
var
|
|
25520
|
+
var promotedObjectSchema = z37.object({
|
|
25525
25521
|
page_id: parentRefSchema3.optional(),
|
|
25526
25522
|
pixel_id: z37.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
25527
25523
|
custom_event_type: z37.enum(CUSTOM_EVENT_TYPES).optional(),
|
|
@@ -25541,12 +25537,9 @@ var promotedObjectFields = {
|
|
|
25541
25537
|
product_set_id: z37.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
25542
25538
|
whatsapp_phone_number: z37.string().optional(),
|
|
25543
25539
|
offline_conversion_data_set_id: z37.string().regex(NUMERIC_ID_REGEX3).optional()
|
|
25544
|
-
};
|
|
25545
|
-
var promotedObjectSchema = z37.strictObject(promotedObjectFields, {
|
|
25546
|
-
error: (issue) => issue.code === "unrecognized_keys" ? `promoted_object does not take ${issue.keys.map((key) => `"${key}"`).join(", ")} \u2014 it takes ${Object.keys(promotedObjectFields).join(", ")}` : void 0
|
|
25547
|
-
});
|
|
25540
|
+
}).partial();
|
|
25548
25541
|
var attributionSpecSchema = z37.array(
|
|
25549
|
-
z37.
|
|
25542
|
+
z37.object({
|
|
25550
25543
|
event_type: z37.enum(ATTRIBUTION_EVENT_TYPES),
|
|
25551
25544
|
window_days: z37.union([z37.literal(1), z37.literal(7), z37.literal(28)])
|
|
25552
25545
|
})
|
|
@@ -25711,7 +25704,7 @@ function validateAdSetPlacements(p, ctx) {
|
|
|
25711
25704
|
ctx.addIssue({ code: "custom", path: ["targeting"], message: `${message} (${PLACEMENT_TARGETING_DOC})` });
|
|
25712
25705
|
}
|
|
25713
25706
|
}
|
|
25714
|
-
var adSetCreateSchema = z37.
|
|
25707
|
+
var adSetCreateSchema = z37.object(adSetFields).superRefine((p, ctx) => {
|
|
25715
25708
|
validateAdSetBudgetAndBid(p, ctx);
|
|
25716
25709
|
validateAdSetPromotedObject(p, ctx);
|
|
25717
25710
|
validateAdvantageAudience(p, ctx);
|
|
@@ -25724,7 +25717,7 @@ var adSetCreateSchema = z37.strictObject(adSetFields).superRefine((p, ctx) => {
|
|
|
25724
25717
|
});
|
|
25725
25718
|
}
|
|
25726
25719
|
});
|
|
25727
|
-
var adSetUpdateSchema = z37.
|
|
25720
|
+
var adSetUpdateSchema = z37.object({
|
|
25728
25721
|
name: adSetFields.name.optional(),
|
|
25729
25722
|
status: updateStatusSchema.optional(),
|
|
25730
25723
|
dailyBudget: moneySchema2.optional(),
|
|
@@ -25754,7 +25747,7 @@ var adSetUpdateSchema = z37.strictObject({
|
|
|
25754
25747
|
var messageSchema = z37.string().min(1).max(META_LIMITS.creative.messageHardMax);
|
|
25755
25748
|
var headlineSchema2 = z37.string().min(1).max(META_LIMITS.creative.headlineMax);
|
|
25756
25749
|
var descriptionSchema = z37.string().min(1).max(META_LIMITS.creative.descriptionMax);
|
|
25757
|
-
var callToActionSchema = z37.
|
|
25750
|
+
var callToActionSchema = z37.object({
|
|
25758
25751
|
type: z37.enum(CTA_TYPES2),
|
|
25759
25752
|
/** Overrides the base link for the CTA button; defaults to the ad's link. */
|
|
25760
25753
|
link: httpsUrlSchema3.optional(),
|
|
@@ -25775,7 +25768,7 @@ var callToActionSchema = z37.strictObject({
|
|
|
25775
25768
|
});
|
|
25776
25769
|
}
|
|
25777
25770
|
});
|
|
25778
|
-
var creativeEnhancementsSchema = z37.
|
|
25771
|
+
var creativeEnhancementsSchema = z37.object({
|
|
25779
25772
|
standardEnhancements: z37.enum(ENROLL_STATUSES).optional(),
|
|
25780
25773
|
features: z37.record(z37.string(), z37.enum(ENROLL_STATUSES)).optional()
|
|
25781
25774
|
});
|
|
@@ -25806,7 +25799,7 @@ function countImageRefs(p) {
|
|
|
25806
25799
|
function countVideoRefs(p) {
|
|
25807
25800
|
return [p.videoId, p.videoRef].filter(Boolean).length;
|
|
25808
25801
|
}
|
|
25809
|
-
var singleCreativeSchema = z37.
|
|
25802
|
+
var singleCreativeSchema = z37.object({
|
|
25810
25803
|
creativeType: z37.literal("single"),
|
|
25811
25804
|
...creativeSharedFields,
|
|
25812
25805
|
/** Primary text. */
|
|
@@ -25840,7 +25833,7 @@ var singleCreativeSchema = z37.strictObject({
|
|
|
25840
25833
|
});
|
|
25841
25834
|
}
|
|
25842
25835
|
});
|
|
25843
|
-
var carouselCardSchema = z37.
|
|
25836
|
+
var carouselCardSchema = z37.object({
|
|
25844
25837
|
link: httpsUrlSchema3,
|
|
25845
25838
|
headline: z37.string().max(META_LIMITS.creative.headlineMax).optional(),
|
|
25846
25839
|
description: z37.string().max(META_LIMITS.creative.descriptionMax).optional(),
|
|
@@ -25863,7 +25856,7 @@ var carouselCardSchema = z37.strictObject({
|
|
|
25863
25856
|
ctx.addIssue({ code: "custom", path: ["videoId"], message: "each card is an image OR a video, not both" });
|
|
25864
25857
|
}
|
|
25865
25858
|
});
|
|
25866
|
-
var carouselCreativeSchema2 = z37.
|
|
25859
|
+
var carouselCreativeSchema2 = z37.object({
|
|
25867
25860
|
creativeType: z37.literal("carousel"),
|
|
25868
25861
|
...creativeSharedFields,
|
|
25869
25862
|
message: messageSchema,
|
|
@@ -25885,19 +25878,19 @@ var carouselCreativeSchema2 = z37.strictObject({
|
|
|
25885
25878
|
});
|
|
25886
25879
|
}
|
|
25887
25880
|
});
|
|
25888
|
-
var dynamicImageSchema = z37.
|
|
25889
|
-
var dynamicVideoSchema = z37.
|
|
25881
|
+
var dynamicImageSchema = z37.object({ ...imageMediaFields }).refine((p) => countImageRefs(p) === 1, "each dynamic image needs exactly one reference");
|
|
25882
|
+
var dynamicVideoSchema = z37.object({
|
|
25890
25883
|
videoId: videoMediaFields.videoId,
|
|
25891
25884
|
videoRef: videoMediaFields.videoRef,
|
|
25892
25885
|
thumbnailHash: videoMediaFields.thumbnailHash
|
|
25893
25886
|
}).refine((p) => countVideoRefs(p) === 1, "each dynamic video needs exactly one reference");
|
|
25894
25887
|
var DYN = META_LIMITS.creative;
|
|
25895
|
-
var dynamicCreativeSchema = z37.
|
|
25888
|
+
var dynamicCreativeSchema = z37.object({
|
|
25896
25889
|
creativeType: z37.literal("dynamic"),
|
|
25897
25890
|
...creativeSharedFields,
|
|
25898
|
-
bodies: z37.array(z37.
|
|
25899
|
-
titles: z37.array(z37.
|
|
25900
|
-
descriptions: z37.array(z37.
|
|
25891
|
+
bodies: z37.array(z37.object({ text: messageSchema })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
25892
|
+
titles: z37.array(z37.object({ text: headlineSchema2 })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
25893
|
+
descriptions: z37.array(z37.object({ text: descriptionSchema })).max(DYN.dynamicTextsMax).optional(),
|
|
25901
25894
|
images: z37.array(dynamicImageSchema).optional(),
|
|
25902
25895
|
videos: z37.array(dynamicVideoSchema).optional(),
|
|
25903
25896
|
/**
|
|
@@ -25913,7 +25906,7 @@ var dynamicCreativeSchema = z37.strictObject({
|
|
|
25913
25906
|
* different enums.
|
|
25914
25907
|
*/
|
|
25915
25908
|
call_to_action: callToActionSchema.optional(),
|
|
25916
|
-
link_urls: z37.array(z37.
|
|
25909
|
+
link_urls: z37.array(z37.object({ website_url: httpsUrlSchema3, display_url: z37.string().optional() })).min(1),
|
|
25917
25910
|
/**
|
|
25918
25911
|
* `asset_feed_spec.optimization_type` — passed through as a free string on
|
|
25919
25912
|
* purpose. Meta's own 400 enumerates ten values and then accepts
|
|
@@ -25944,7 +25937,7 @@ var dynamicCreativeSchema = z37.strictObject({
|
|
|
25944
25937
|
});
|
|
25945
25938
|
});
|
|
25946
25939
|
});
|
|
25947
|
-
var existingPostCreativeSchema = z37.
|
|
25940
|
+
var existingPostCreativeSchema = z37.object({
|
|
25948
25941
|
creativeType: z37.literal("existing_post"),
|
|
25949
25942
|
name: creativeSharedFields.name,
|
|
25950
25943
|
/** "<page_id>_<post_id>" object story id of the post to promote. */
|
|
@@ -25953,7 +25946,7 @@ var existingPostCreativeSchema = z37.strictObject({
|
|
|
25953
25946
|
url_tags: creativeSharedFields.url_tags,
|
|
25954
25947
|
enhancements: creativeSharedFields.enhancements
|
|
25955
25948
|
});
|
|
25956
|
-
var specCreativeSchema = z37.
|
|
25949
|
+
var specCreativeSchema = z37.object({
|
|
25957
25950
|
creativeType: z37.literal("spec"),
|
|
25958
25951
|
name: creativeSharedFields.name,
|
|
25959
25952
|
url_tags: creativeSharedFields.url_tags,
|
|
@@ -25982,29 +25975,29 @@ var creativeContentSchema2 = z37.discriminatedUnion("creativeType", [
|
|
|
25982
25975
|
specCreativeSchema
|
|
25983
25976
|
]);
|
|
25984
25977
|
var adCreativeCreateSchema = creativeContentSchema2;
|
|
25985
|
-
var adCreativeUpdateSchema = z37.
|
|
25978
|
+
var adCreativeUpdateSchema = z37.object({
|
|
25986
25979
|
name: z37.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
25987
|
-
status:
|
|
25980
|
+
status: updateStatusSchema.optional(),
|
|
25988
25981
|
/** Content patch — only honored when the target is a staged meta_temp_* creative. */
|
|
25989
25982
|
content: z37.record(z37.string(), z37.unknown()).optional()
|
|
25990
25983
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
25991
|
-
var adCreateSchema2 = z37.
|
|
25984
|
+
var adCreateSchema2 = z37.object({
|
|
25992
25985
|
name: z37.string().min(1).max(META_LIMITS.ad.nameMax),
|
|
25993
25986
|
adset_id: parentRefSchema3,
|
|
25994
25987
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
25995
|
-
creative: z37.
|
|
25988
|
+
creative: z37.object({ creative_id: parentRefSchema3 }),
|
|
25996
25989
|
/** Conversion pixel / offline event set / view tags — structural passthrough. */
|
|
25997
25990
|
tracking_specs: z37.array(z37.record(z37.string(), z37.unknown())).optional()
|
|
25998
25991
|
});
|
|
25999
|
-
var adUpdateSchema2 = z37.
|
|
25992
|
+
var adUpdateSchema2 = z37.object({
|
|
26000
25993
|
name: z37.string().min(1).max(META_LIMITS.ad.nameMax).optional(),
|
|
26001
25994
|
status: updateStatusSchema.optional(),
|
|
26002
25995
|
/** Swapping the creative is the Meta way to "edit" an ad's creative. */
|
|
26003
|
-
creative: z37.
|
|
25996
|
+
creative: z37.object({ creative_id: parentRefSchema3 }).optional(),
|
|
26004
25997
|
tracking_specs: z37.array(z37.record(z37.string(), z37.unknown())).optional()
|
|
26005
25998
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
26006
|
-
var lookalikeSpecSchema = z37.
|
|
26007
|
-
origin: z37.array(z37.
|
|
25999
|
+
var lookalikeSpecSchema = z37.object({
|
|
26000
|
+
origin: z37.array(z37.object({ id: parentRefSchema3 })).min(1),
|
|
26008
26001
|
ratio: z37.number().min(0.01).max(0.2).optional(),
|
|
26009
26002
|
country: z37.string().length(2).optional()
|
|
26010
26003
|
});
|
|
@@ -26022,7 +26015,7 @@ function mixedEventSourceTypes(rule) {
|
|
|
26022
26015
|
const distinct = [...new Set(types)].sort();
|
|
26023
26016
|
return distinct.length > 1 ? distinct : [];
|
|
26024
26017
|
}
|
|
26025
|
-
var customAudienceCreateSchema = z37.
|
|
26018
|
+
var customAudienceCreateSchema = z37.object({
|
|
26026
26019
|
name: z37.string().min(1).max(META_LIMITS.audience.nameMax),
|
|
26027
26020
|
subtype: z37.enum(CUSTOM_AUDIENCE_SUBTYPES),
|
|
26028
26021
|
description: z37.string().max(500).optional(),
|
|
@@ -26054,11 +26047,11 @@ var customAudienceCreateSchema = z37.strictObject({
|
|
|
26054
26047
|
});
|
|
26055
26048
|
}
|
|
26056
26049
|
});
|
|
26057
|
-
var customAudienceUpdateSchema = z37.
|
|
26050
|
+
var customAudienceUpdateSchema = z37.object({
|
|
26058
26051
|
name: z37.string().min(1).max(META_LIMITS.audience.nameMax).optional(),
|
|
26059
26052
|
description: z37.string().max(500).optional()
|
|
26060
26053
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
26061
|
-
var customConversionCreateSchema = z37.
|
|
26054
|
+
var customConversionCreateSchema = z37.object({
|
|
26062
26055
|
name: z37.string().min(1).max(META_LIMITS.customConversion.nameMax),
|
|
26063
26056
|
description: z37.string().max(META_LIMITS.customConversion.descriptionMax).optional(),
|
|
26064
26057
|
/** The pixel the conversion counts from — `event_source_id` on the wire. Baker never creates pixels, so this is always a real id. */
|
|
@@ -26074,7 +26067,7 @@ var customConversionCreateSchema = z37.strictObject({
|
|
|
26074
26067
|
ctx.addIssue({ code: "custom", path: ["rule"], message: refusal });
|
|
26075
26068
|
}
|
|
26076
26069
|
});
|
|
26077
|
-
var mediaUploadSchema = z37.
|
|
26070
|
+
var mediaUploadSchema = z37.object({
|
|
26078
26071
|
kind: z37.enum(MEDIA_KINDS),
|
|
26079
26072
|
bakerImageId: bakerMediaIdSchema2.optional(),
|
|
26080
26073
|
bakerVideoId: bakerMediaIdSchema2.optional(),
|
|
@@ -26250,33 +26243,26 @@ import { defineCommand as defineCommand57 } from "citty";
|
|
|
26250
26243
|
|
|
26251
26244
|
// src/commands/ads/meta/write-shared.ts
|
|
26252
26245
|
import { readFileSync as readFileSync9 } from "fs";
|
|
26253
|
-
function bareAccountId2(args5) {
|
|
26254
|
-
return resolveAccountIdArg(args5).replace(/^act_/, "");
|
|
26246
|
+
async function bareAccountId2(args5) {
|
|
26247
|
+
return (await resolveAccountIdArg(args5)).replace(/^act_/, "");
|
|
26255
26248
|
}
|
|
26256
26249
|
function failWriteValidation3(message) {
|
|
26257
26250
|
writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
|
|
26258
26251
|
process.exit(1);
|
|
26259
26252
|
}
|
|
26260
|
-
function
|
|
26261
|
-
if (
|
|
26262
|
-
failWriteValidation3(
|
|
26263
|
-
`update does not delete \u2014 deleting is permanent. Use \`baker ads meta ${group} delete <id>\` if the user asked to delete; otherwise pause or archive.`
|
|
26264
|
-
);
|
|
26265
|
-
}
|
|
26266
|
-
}
|
|
26267
|
-
function loadJsonFileArg3(path49) {
|
|
26268
|
-
if (typeof path49 !== "string" || path49.length === 0) {
|
|
26253
|
+
function loadJsonFileArg3(path48) {
|
|
26254
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
26269
26255
|
return {};
|
|
26270
26256
|
}
|
|
26271
26257
|
try {
|
|
26272
|
-
const parsed = JSON.parse(readFileSync9(
|
|
26258
|
+
const parsed = JSON.parse(readFileSync9(path48, "utf8"));
|
|
26273
26259
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
26274
|
-
failWriteValidation3(`${
|
|
26260
|
+
failWriteValidation3(`${path48} must contain a JSON object`);
|
|
26275
26261
|
}
|
|
26276
26262
|
return parsed;
|
|
26277
26263
|
} catch (err) {
|
|
26278
26264
|
if (err instanceof SyntaxError) {
|
|
26279
|
-
failWriteValidation3(`${
|
|
26265
|
+
failWriteValidation3(`${path48} is not valid JSON: ${err.message}`);
|
|
26280
26266
|
}
|
|
26281
26267
|
throw err;
|
|
26282
26268
|
}
|
|
@@ -26384,7 +26370,7 @@ async function stageStatusChange2(input) {
|
|
|
26384
26370
|
// src/commands/ads/meta/write-commands.ts
|
|
26385
26371
|
var STAGED_NOTE2 = "Staged until publish \u2014 review with `baker ads meta draft`.";
|
|
26386
26372
|
var accountArgs2 = {
|
|
26387
|
-
"account-id": { type: "string", description: "Numeric account ID or act_N" }
|
|
26373
|
+
"account-id": { type: "string", description: "Numeric account ID or act_N; defaults to the only connected account" }
|
|
26388
26374
|
};
|
|
26389
26375
|
function campaignPayloadFromFlags2(args5) {
|
|
26390
26376
|
return {
|
|
@@ -26440,7 +26426,7 @@ Example: baker ads meta campaigns create --name "Q3 Prospecting" --objective OUT
|
|
|
26440
26426
|
file: { type: "string", description: "JSON file with the full payload; flags override file keys" }
|
|
26441
26427
|
},
|
|
26442
26428
|
run: async ({ args: args5 }) => {
|
|
26443
|
-
const accountId = bareAccountId2(args5);
|
|
26429
|
+
const accountId = await bareAccountId2(args5);
|
|
26444
26430
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), campaignPayloadFromFlags2(args5));
|
|
26445
26431
|
await stageOp2({ kind: "campaign.create", accountId, payload });
|
|
26446
26432
|
}
|
|
@@ -26460,7 +26446,7 @@ Pass a meta_temp_* ref to amend a campaign staged in this chat. Example: baker a
|
|
|
26460
26446
|
file: { type: "string", description: "JSON file with fields to change" }
|
|
26461
26447
|
},
|
|
26462
26448
|
run: async ({ args: args5 }) => {
|
|
26463
|
-
const accountId = bareAccountId2(args5);
|
|
26449
|
+
const accountId = await bareAccountId2(args5);
|
|
26464
26450
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), {
|
|
26465
26451
|
name: args5.name,
|
|
26466
26452
|
status: upper(args5.status),
|
|
@@ -26471,7 +26457,6 @@ Pass a meta_temp_* ref to amend a campaign staged in this chat. Example: baker a
|
|
|
26471
26457
|
start_time: parseDateFlag2(args5.start, "--start"),
|
|
26472
26458
|
stop_time: parseDateFlag2(args5.stop, "--stop")
|
|
26473
26459
|
});
|
|
26474
|
-
refuseDeleteByUpdate(payload, "campaigns");
|
|
26475
26460
|
await stageOp2({
|
|
26476
26461
|
kind: "campaign.update",
|
|
26477
26462
|
accountId,
|
|
@@ -26554,7 +26539,7 @@ Example: baker ads meta custom-conversions create --name "Lead formulario" --pix
|
|
|
26554
26539
|
value: { type: "string", description: "Default value of one conversion, when the site sends no value" }
|
|
26555
26540
|
},
|
|
26556
26541
|
run: async ({ args: args5 }) => {
|
|
26557
|
-
const accountId = bareAccountId2(args5);
|
|
26542
|
+
const accountId = await bareAccountId2(args5);
|
|
26558
26543
|
await stageOp2({
|
|
26559
26544
|
kind: "customConversion.create",
|
|
26560
26545
|
accountId,
|
|
@@ -26611,7 +26596,7 @@ Example: baker ads meta adsets create --campaign meta_temp_ab12 --name "US 25-54
|
|
|
26611
26596
|
},
|
|
26612
26597
|
args: { campaign: { type: "string", description: "Parent campaign id or meta_temp_* ref" }, ...adSetWriteArgs },
|
|
26613
26598
|
run: async ({ args: args5 }) => {
|
|
26614
|
-
const accountId = bareAccountId2(args5);
|
|
26599
|
+
const accountId = await bareAccountId2(args5);
|
|
26615
26600
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), adSetPayloadFromFlags(args5));
|
|
26616
26601
|
await stageOp2({ kind: "adSet.create", accountId, payload });
|
|
26617
26602
|
}
|
|
@@ -26625,14 +26610,13 @@ Example: baker ads meta adsets update 6123 --daily-budget 80`
|
|
|
26625
26610
|
},
|
|
26626
26611
|
args: { id: { type: "positional", description: "Ad set id or meta_temp_* ref", required: true }, ...adSetWriteArgs },
|
|
26627
26612
|
run: async ({ args: args5 }) => {
|
|
26628
|
-
const accountId = bareAccountId2(args5);
|
|
26613
|
+
const accountId = await bareAccountId2(args5);
|
|
26629
26614
|
const {
|
|
26630
26615
|
campaign_id: _drop,
|
|
26631
26616
|
billing_event: _be,
|
|
26632
26617
|
...payload
|
|
26633
26618
|
} = adSetPayloadFromFlags(args5);
|
|
26634
26619
|
const merged = mergePayload3(loadJsonFileArg3(args5.file), payload);
|
|
26635
|
-
refuseDeleteByUpdate(merged, "adsets");
|
|
26636
26620
|
await stageOp2({
|
|
26637
26621
|
kind: "adSet.update",
|
|
26638
26622
|
accountId,
|
|
@@ -26728,7 +26712,7 @@ Example: baker ads meta creatives create --page 555 --message "Save now" --link
|
|
|
26728
26712
|
file: { type: "string", description: "JSON file with the full creative payload (carousel cards / dynamic assets)" }
|
|
26729
26713
|
},
|
|
26730
26714
|
run: async ({ args: args5 }) => {
|
|
26731
|
-
const accountId = bareAccountId2(args5);
|
|
26715
|
+
const accountId = await bareAccountId2(args5);
|
|
26732
26716
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), creativePayloadFromFlags(args5));
|
|
26733
26717
|
if (payload.creativeType === void 0) {
|
|
26734
26718
|
payload.creativeType = "single";
|
|
@@ -26759,7 +26743,7 @@ Amending a staged (meta_temp_*) creative merges fields into the create. Example:
|
|
|
26759
26743
|
}
|
|
26760
26744
|
},
|
|
26761
26745
|
run: async ({ args: args5 }) => {
|
|
26762
|
-
const accountId = bareAccountId2(args5);
|
|
26746
|
+
const accountId = await bareAccountId2(args5);
|
|
26763
26747
|
const file = loadJsonFileArg3(args5.file);
|
|
26764
26748
|
const payload = mergePayload3(file, {
|
|
26765
26749
|
name: args5.name,
|
|
@@ -26793,7 +26777,7 @@ Example: baker ads meta ads create --name "Ad 1" --adset meta_temp_as01 --creati
|
|
|
26793
26777
|
file: { type: "string", description: "JSON file with the full payload" }
|
|
26794
26778
|
},
|
|
26795
26779
|
run: async ({ args: args5 }) => {
|
|
26796
|
-
const accountId = bareAccountId2(args5);
|
|
26780
|
+
const accountId = await bareAccountId2(args5);
|
|
26797
26781
|
const tracking = args5["tracking-file"] ? loadJsonFileArg3(args5["tracking-file"]).tracking_specs : void 0;
|
|
26798
26782
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), {
|
|
26799
26783
|
name: args5.name,
|
|
@@ -26820,13 +26804,12 @@ Example: baker ads meta ads update 6123 --creative meta_temp_cr02`
|
|
|
26820
26804
|
file: { type: "string", description: "JSON file with fields to change" }
|
|
26821
26805
|
},
|
|
26822
26806
|
run: async ({ args: args5 }) => {
|
|
26823
|
-
const accountId = bareAccountId2(args5);
|
|
26807
|
+
const accountId = await bareAccountId2(args5);
|
|
26824
26808
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), {
|
|
26825
26809
|
name: args5.name,
|
|
26826
26810
|
status: upper(args5.status),
|
|
26827
26811
|
creative: args5.creative ? { creative_id: String(args5.creative) } : void 0
|
|
26828
26812
|
});
|
|
26829
|
-
refuseDeleteByUpdate(payload, "ads");
|
|
26830
26813
|
await stageOp2({
|
|
26831
26814
|
kind: "ad.update",
|
|
26832
26815
|
accountId,
|
|
@@ -26857,9 +26840,9 @@ Example: baker ads meta ads retag 120252158038400247 --url-tags "utm_source={{si
|
|
|
26857
26840
|
const { apiPost: apiPost2 } = await import("./client-GR6YL3YX.js");
|
|
26858
26841
|
const { requireChatId: requireChatId2 } = await import("./env-4P5HOGNA.js");
|
|
26859
26842
|
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-NMQXZF3Z.js");
|
|
26860
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
26843
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-DDBXEUL4.js");
|
|
26861
26844
|
try {
|
|
26862
|
-
const accountId = bareAccountId2(args5);
|
|
26845
|
+
const accountId = await bareAccountId2(args5);
|
|
26863
26846
|
const urlTags = typeof args5["url-tags"] === "string" ? args5["url-tags"] : void 0;
|
|
26864
26847
|
const setRaw = typeof args5.set === "string" ? args5.set : void 0;
|
|
26865
26848
|
if (urlTags === void 0 === (setRaw === void 0)) {
|
|
@@ -26913,7 +26896,7 @@ Example: baker ads meta audiences create --name "Site visitors 30d" --subtype WE
|
|
|
26913
26896
|
file: { type: "string", description: "JSON file with lookalike_spec / rule / full payload" }
|
|
26914
26897
|
},
|
|
26915
26898
|
run: async ({ args: args5 }) => {
|
|
26916
|
-
const accountId = bareAccountId2(args5);
|
|
26899
|
+
const accountId = await bareAccountId2(args5);
|
|
26917
26900
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), {
|
|
26918
26901
|
name: args5.name,
|
|
26919
26902
|
subtype: upper(args5.subtype),
|
|
@@ -26936,7 +26919,7 @@ var audiencesUpdateCommand = defineCommand57({
|
|
|
26936
26919
|
file: { type: "string", description: "JSON file with fields to change" }
|
|
26937
26920
|
},
|
|
26938
26921
|
run: async ({ args: args5 }) => {
|
|
26939
|
-
const accountId = bareAccountId2(args5);
|
|
26922
|
+
const accountId = await bareAccountId2(args5);
|
|
26940
26923
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), { name: args5.name, description: args5.description });
|
|
26941
26924
|
await stageOp2({
|
|
26942
26925
|
kind: "customAudience.update",
|
|
@@ -26960,7 +26943,7 @@ Example: baker ads meta media upload --kind image --image-id <bakerImageId>`
|
|
|
26960
26943
|
name: { type: "string", description: "Display name / filename hint" }
|
|
26961
26944
|
},
|
|
26962
26945
|
run: async ({ args: args5 }) => {
|
|
26963
|
-
const accountId = bareAccountId2(args5);
|
|
26946
|
+
const accountId = await bareAccountId2(args5);
|
|
26964
26947
|
const kind = String(args5.kind ?? "").toLowerCase();
|
|
26965
26948
|
if (kind !== "image" && kind !== "video") {
|
|
26966
26949
|
failWriteValidation3("--kind must be image or video");
|
|
@@ -26972,19 +26955,13 @@ Example: baker ads meta media upload --kind image --image-id <bakerImageId>`
|
|
|
26972
26955
|
});
|
|
26973
26956
|
}
|
|
26974
26957
|
});
|
|
26975
|
-
var STATUS_BY_COMMAND = { pause: "PAUSED", resume: "ACTIVE", archive: "ARCHIVED", delete: "DELETED" };
|
|
26976
|
-
var STATUS_COMMAND_NOTE = {
|
|
26977
|
-
archive: "Archived stays readable in Ads Manager and can be found with --effective-status ARCHIVED.",
|
|
26978
|
-
delete: "Deleting is permanent and cannot be undone \u2014 Meta removes it and everything under it. Prefer pause or archive unless the user asked to delete."
|
|
26979
|
-
};
|
|
26980
26958
|
function statusCommand3(name, kind, label) {
|
|
26981
|
-
const status =
|
|
26982
|
-
const note = STATUS_COMMAND_NOTE[name];
|
|
26959
|
+
const status = name === "pause" ? "PAUSED" : name === "resume" ? "ACTIVE" : "ARCHIVED";
|
|
26983
26960
|
return defineCommand57({
|
|
26984
|
-
meta: { name, description: `Stage ${name} for a ${label}. ${
|
|
26961
|
+
meta: { name, description: `Stage ${name} for a ${label}. ${STAGED_NOTE2}` },
|
|
26985
26962
|
args: { id: { type: "positional", description: `${label} id`, required: true }, ...accountArgs2 },
|
|
26986
26963
|
run: async ({ args: args5 }) => {
|
|
26987
|
-
const accountId = bareAccountId2(args5);
|
|
26964
|
+
const accountId = await bareAccountId2(args5);
|
|
26988
26965
|
await stageStatusChange2({
|
|
26989
26966
|
kind,
|
|
26990
26967
|
accountId,
|
|
@@ -27011,9 +26988,9 @@ function duplicateCommand2(entity, label) {
|
|
|
27011
26988
|
const { apiPost: apiPost2 } = await import("./client-GR6YL3YX.js");
|
|
27012
26989
|
const { requireChatId: requireChatId2 } = await import("./env-4P5HOGNA.js");
|
|
27013
26990
|
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-NMQXZF3Z.js");
|
|
27014
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
26991
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-DDBXEUL4.js");
|
|
27015
26992
|
try {
|
|
27016
|
-
const accountId = bareAccountId2(args5);
|
|
26993
|
+
const accountId = await bareAccountId2(args5);
|
|
27017
26994
|
const chatId = requireChatId2();
|
|
27018
26995
|
const response = await apiPost2("/api/ads/meta/draft/duplicate", {
|
|
27019
26996
|
chatId,
|
|
@@ -27033,22 +27010,19 @@ function duplicateCommand2(entity, label) {
|
|
|
27033
27010
|
var campaignsPauseCommand2 = statusCommand3("pause", "campaign.update", "campaign");
|
|
27034
27011
|
var campaignsResumeCommand2 = statusCommand3("resume", "campaign.update", "campaign");
|
|
27035
27012
|
var campaignsArchiveCommand2 = statusCommand3("archive", "campaign.update", "campaign");
|
|
27036
|
-
var campaignsDeleteCommand = statusCommand3("delete", "campaign.update", "campaign");
|
|
27037
27013
|
var campaignsDuplicateCommand2 = duplicateCommand2("campaign", "campaign");
|
|
27038
27014
|
var adSetsPauseCommand = statusCommand3("pause", "adSet.update", "ad set");
|
|
27039
27015
|
var adSetsResumeCommand = statusCommand3("resume", "adSet.update", "ad set");
|
|
27040
27016
|
var adSetsArchiveCommand = statusCommand3("archive", "adSet.update", "ad set");
|
|
27041
|
-
var adSetsDeleteCommand = statusCommand3("delete", "adSet.update", "ad set");
|
|
27042
27017
|
var adSetsDuplicateCommand = duplicateCommand2("adSet", "ad set");
|
|
27043
27018
|
var adsPauseCommand = statusCommand3("pause", "ad.update", "ad");
|
|
27044
27019
|
var adsResumeCommand = statusCommand3("resume", "ad.update", "ad");
|
|
27045
27020
|
var adsArchiveCommand = statusCommand3("archive", "ad.update", "ad");
|
|
27046
|
-
var adsDeleteCommand = statusCommand3("delete", "ad.update", "ad");
|
|
27047
27021
|
var adsDuplicateCommand = duplicateCommand2("ad", "ad");
|
|
27048
27022
|
|
|
27049
27023
|
// src/commands/ads/meta/ads.ts
|
|
27050
27024
|
var listArgs5 = {
|
|
27051
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27025
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27052
27026
|
"adset-id": { type: "string", description: "Filter to one adset" },
|
|
27053
27027
|
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
27054
27028
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
@@ -27070,7 +27044,7 @@ var listCommand4 = defineCommand58({
|
|
|
27070
27044
|
},
|
|
27071
27045
|
args: listArgs5,
|
|
27072
27046
|
run: async ({ args: args5 }) => {
|
|
27073
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27047
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27074
27048
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
27075
27049
|
try {
|
|
27076
27050
|
const params = { "account-id": accountId };
|
|
@@ -27091,7 +27065,7 @@ var listCommand4 = defineCommand58({
|
|
|
27091
27065
|
var adsListCommand = defineCommand58({
|
|
27092
27066
|
meta: {
|
|
27093
27067
|
name: "ads",
|
|
27094
|
-
description: `List ads in a Meta ad account, or stage writes (create/update/pause/resume/archive/
|
|
27068
|
+
description: `List ads in a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate/retag).
|
|
27095
27069
|
Defaults to ACTIVE only \u2014 pass --all-statuses to widen. Write subcommands stage ops on this chat's draft.
|
|
27096
27070
|
|
|
27097
27071
|
The dashboard shows effective_status (e.g. WITH_ISSUES, PENDING_REVIEW, DISAPPROVED, ADSET_PAUSED), not status.
|
|
@@ -27116,7 +27090,6 @@ Examples:
|
|
|
27116
27090
|
pause: adsPauseCommand,
|
|
27117
27091
|
resume: adsResumeCommand,
|
|
27118
27092
|
archive: adsArchiveCommand,
|
|
27119
|
-
delete: adsDeleteCommand,
|
|
27120
27093
|
duplicate: adsDuplicateCommand,
|
|
27121
27094
|
retag: adsRetagCommand
|
|
27122
27095
|
},
|
|
@@ -27131,7 +27104,7 @@ Examples:
|
|
|
27131
27104
|
// src/commands/ads/meta/adsets.ts
|
|
27132
27105
|
import { defineCommand as defineCommand59 } from "citty";
|
|
27133
27106
|
var listArgs6 = {
|
|
27134
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27107
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27135
27108
|
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
27136
27109
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
27137
27110
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
|
|
@@ -27152,7 +27125,7 @@ var listCommand5 = defineCommand59({
|
|
|
27152
27125
|
},
|
|
27153
27126
|
args: listArgs6,
|
|
27154
27127
|
run: async ({ args: args5 }) => {
|
|
27155
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27128
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27156
27129
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
27157
27130
|
try {
|
|
27158
27131
|
const params = { "account-id": accountId };
|
|
@@ -27172,7 +27145,7 @@ var listCommand5 = defineCommand59({
|
|
|
27172
27145
|
var adsetsCommand = defineCommand59({
|
|
27173
27146
|
meta: {
|
|
27174
27147
|
name: "adsets",
|
|
27175
|
-
description: `List ad sets in a Meta ad account, or stage writes (create/update/pause/resume/archive/
|
|
27148
|
+
description: `List ad sets in a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate).
|
|
27176
27149
|
Defaults to ACTIVE only. Write subcommands stage ops on this chat's draft.
|
|
27177
27150
|
|
|
27178
27151
|
Listings print a table by default: id, name, campaign_id, effective_status, optimization_goal, billing_event,
|
|
@@ -27193,7 +27166,6 @@ Examples:
|
|
|
27193
27166
|
pause: adSetsPauseCommand,
|
|
27194
27167
|
resume: adSetsResumeCommand,
|
|
27195
27168
|
archive: adSetsArchiveCommand,
|
|
27196
|
-
delete: adSetsDeleteCommand,
|
|
27197
27169
|
duplicate: adSetsDuplicateCommand
|
|
27198
27170
|
},
|
|
27199
27171
|
// `args` stays even though the parent has no `run`: citty scans rawArgs for the
|
|
@@ -27207,7 +27179,7 @@ Examples:
|
|
|
27207
27179
|
// src/commands/ads/meta/audiences.ts
|
|
27208
27180
|
import { defineCommand as defineCommand60 } from "citty";
|
|
27209
27181
|
var listArgs7 = {
|
|
27210
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27182
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27211
27183
|
limit: { type: "string", description: "Max rows" },
|
|
27212
27184
|
"no-cache": NO_CACHE_ARG,
|
|
27213
27185
|
output: { type: "string", description: "Output format", default: "json" }
|
|
@@ -27219,7 +27191,7 @@ var listCommand6 = defineCommand60({
|
|
|
27219
27191
|
},
|
|
27220
27192
|
args: listArgs7,
|
|
27221
27193
|
run: async ({ args: args5 }) => {
|
|
27222
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27194
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27223
27195
|
try {
|
|
27224
27196
|
const params = { "account-id": accountId };
|
|
27225
27197
|
if (args5.limit) params.limit = args5.limit;
|
|
@@ -27293,7 +27265,7 @@ Examples:
|
|
|
27293
27265
|
// src/commands/ads/meta/campaigns.ts
|
|
27294
27266
|
import { defineCommand as defineCommand62 } from "citty";
|
|
27295
27267
|
var listArgs8 = {
|
|
27296
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27268
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27297
27269
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
27298
27270
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter and return everything" },
|
|
27299
27271
|
"name-contains": NAME_CONTAINS_ARG,
|
|
@@ -27313,7 +27285,7 @@ var listCommand7 = defineCommand62({
|
|
|
27313
27285
|
},
|
|
27314
27286
|
args: listArgs8,
|
|
27315
27287
|
run: async ({ args: args5 }) => {
|
|
27316
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27288
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27317
27289
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
27318
27290
|
try {
|
|
27319
27291
|
const params = { "account-id": accountId };
|
|
@@ -27332,7 +27304,7 @@ var listCommand7 = defineCommand62({
|
|
|
27332
27304
|
var campaignsCommand3 = defineCommand62({
|
|
27333
27305
|
meta: {
|
|
27334
27306
|
name: "campaigns",
|
|
27335
|
-
description: `List campaigns for a Meta ad account, or stage writes (create/update/pause/resume/archive/
|
|
27307
|
+
description: `List campaigns for a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate).
|
|
27336
27308
|
Defaults to ACTIVE only \u2014 pass --all-statuses to widen. Write subcommands stage ops on this chat's draft and
|
|
27337
27309
|
apply only when the chat is published.
|
|
27338
27310
|
|
|
@@ -27359,7 +27331,6 @@ Examples:
|
|
|
27359
27331
|
pause: campaignsPauseCommand2,
|
|
27360
27332
|
resume: campaignsResumeCommand2,
|
|
27361
27333
|
archive: campaignsArchiveCommand2,
|
|
27362
|
-
delete: campaignsDeleteCommand,
|
|
27363
27334
|
duplicate: campaignsDuplicateCommand2
|
|
27364
27335
|
},
|
|
27365
27336
|
// `args` stays even though the parent has no `run`: citty scans rawArgs for the
|
|
@@ -27373,7 +27344,10 @@ Examples:
|
|
|
27373
27344
|
// src/commands/ads/meta/creatives.ts
|
|
27374
27345
|
import { defineCommand as defineCommand63 } from "citty";
|
|
27375
27346
|
var listArgs9 = {
|
|
27376
|
-
"account-id": {
|
|
27347
|
+
"account-id": {
|
|
27348
|
+
type: "string",
|
|
27349
|
+
description: "Meta ad account ID (act_...) when listing without --creative-id; defaults to the only connected account"
|
|
27350
|
+
},
|
|
27377
27351
|
"creative-id": { type: "string", description: "Single creative ID" },
|
|
27378
27352
|
limit: { type: "string", description: "Max rows (default 500)" },
|
|
27379
27353
|
"no-cache": NO_CACHE_ARG,
|
|
@@ -27391,7 +27365,7 @@ var listCommand8 = defineCommand63({
|
|
|
27391
27365
|
if (args5["creative-id"]) {
|
|
27392
27366
|
params["creative-id"] = args5["creative-id"];
|
|
27393
27367
|
} else {
|
|
27394
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27368
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27395
27369
|
params["account-id"] = accountId;
|
|
27396
27370
|
}
|
|
27397
27371
|
if (args5.limit) params.limit = args5.limit;
|
|
@@ -27471,7 +27445,11 @@ registerSchema({
|
|
|
27471
27445
|
command: "ads.meta.custom-conversions",
|
|
27472
27446
|
description: "List the Custom Conversions defined on a Meta ad account \u2014 the measurement objects a marketer sets up in Events Manager (a pixel event narrowed by a rule, e.g. 'PageView on /thank-you'). Start here whenever the user talks about their own conversions rather than a standard event: an ad set optimizes toward one with `adsets create --custom-conversion-id <id>`.",
|
|
27473
27447
|
args: {
|
|
27474
|
-
"account-id": {
|
|
27448
|
+
"account-id": {
|
|
27449
|
+
type: "string",
|
|
27450
|
+
description: "Meta ad account ID (act_...); defaults to the only connected account",
|
|
27451
|
+
required: false
|
|
27452
|
+
},
|
|
27475
27453
|
full: { type: "boolean", description: "Include the raw rule JSON, retention and creation times", required: false },
|
|
27476
27454
|
limit: { type: "string", description: "Max rows", required: false },
|
|
27477
27455
|
"no-cache": { type: "boolean", description: "Bypass the cache", required: false },
|
|
@@ -27479,7 +27457,7 @@ registerSchema({
|
|
|
27479
27457
|
}
|
|
27480
27458
|
});
|
|
27481
27459
|
var listArgs10 = {
|
|
27482
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27460
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27483
27461
|
full: { type: "boolean", description: "Include the raw rule JSON, retention and creation times" },
|
|
27484
27462
|
limit: { type: "string", description: "Max rows" },
|
|
27485
27463
|
"no-cache": NO_CACHE_ARG,
|
|
@@ -27492,7 +27470,7 @@ var listCommand9 = defineCommand64({
|
|
|
27492
27470
|
},
|
|
27493
27471
|
args: listArgs10,
|
|
27494
27472
|
run: async ({ args: args5 }) => {
|
|
27495
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27473
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27496
27474
|
try {
|
|
27497
27475
|
const params = { "account-id": accountId };
|
|
27498
27476
|
if (args5.limit) params.limit = args5.limit;
|
|
@@ -28369,7 +28347,10 @@ Examples:
|
|
|
28369
28347
|
baker ads meta pixels --account-id act_123 --pixel-id 9876 --stats --days 7`
|
|
28370
28348
|
},
|
|
28371
28349
|
args: {
|
|
28372
|
-
"account-id": {
|
|
28350
|
+
"account-id": {
|
|
28351
|
+
type: "string",
|
|
28352
|
+
description: "Meta ad account ID (act_...); defaults to the only connected account"
|
|
28353
|
+
},
|
|
28373
28354
|
"pixel-id": { type: "string", description: "Pixel ID for --stats" },
|
|
28374
28355
|
stats: { type: "boolean", description: "Fetch firing stats for the pixel" },
|
|
28375
28356
|
aggregation: {
|
|
@@ -28413,7 +28394,7 @@ async function runStats(args5) {
|
|
|
28413
28394
|
emit(data, args5);
|
|
28414
28395
|
}
|
|
28415
28396
|
async function runList(args5) {
|
|
28416
|
-
const accountId = resolveAccountIdArg(args5);
|
|
28397
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
28417
28398
|
const params = { "account-id": accountId };
|
|
28418
28399
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
28419
28400
|
const { pixels, restrictedFields } = await apiGet("/api/ads/meta/pixels", params);
|
|
@@ -31972,12 +31953,12 @@ function flowExists(slug) {
|
|
|
31972
31953
|
return existsSync3(join2(flowsDir(), slug, "_data.json"));
|
|
31973
31954
|
}
|
|
31974
31955
|
function readFlowTree(slug) {
|
|
31975
|
-
const
|
|
31976
|
-
if (!existsSync3(
|
|
31956
|
+
const path48 = join2(flowsDir(), slug, "_data.json");
|
|
31957
|
+
if (!existsSync3(path48)) {
|
|
31977
31958
|
failLocal(`No form "${slug}". Run "baker flows list" to see the forms in this workspace.`);
|
|
31978
31959
|
}
|
|
31979
31960
|
try {
|
|
31980
|
-
return JSON.parse(readFileSync11(
|
|
31961
|
+
return JSON.parse(readFileSync11(path48, "utf-8"));
|
|
31981
31962
|
} catch (error) {
|
|
31982
31963
|
failLocal(`Could not read form "${slug}": ${error instanceof Error ? error.message : String(error)}`);
|
|
31983
31964
|
}
|
|
@@ -32937,12 +32918,12 @@ function readPeopleFile(args5) {
|
|
|
32937
32918
|
}
|
|
32938
32919
|
function unreadablePeopleFile(args5) {
|
|
32939
32920
|
if (!args5["people-file"]) return void 0;
|
|
32940
|
-
const
|
|
32921
|
+
const path48 = String(args5["people-file"]);
|
|
32941
32922
|
try {
|
|
32942
|
-
readFileSync12(
|
|
32923
|
+
readFileSync12(path48, "utf8");
|
|
32943
32924
|
return void 0;
|
|
32944
32925
|
} catch {
|
|
32945
|
-
return `Couldn't read --people-file ${
|
|
32926
|
+
return `Couldn't read --people-file ${path48}. Check the path, or pass the people inline with --person.`;
|
|
32946
32927
|
}
|
|
32947
32928
|
}
|
|
32948
32929
|
function peopleLimitError(args5) {
|
|
@@ -33914,11 +33895,11 @@ function parseFieldArgs(argv) {
|
|
|
33914
33895
|
for (const pair of parseRepeated(argv, "--field")) {
|
|
33915
33896
|
const eq = pair.indexOf("=");
|
|
33916
33897
|
const field = eq === -1 ? pair : pair.slice(0, eq);
|
|
33917
|
-
const
|
|
33898
|
+
const path48 = eq === -1 ? "" : pair.slice(eq + 1).trim();
|
|
33918
33899
|
const problem = mappingRowProblem(field);
|
|
33919
33900
|
if (problem !== null) throw new ConversionArgsError(problem);
|
|
33920
|
-
if (
|
|
33921
|
-
mapping[field] =
|
|
33901
|
+
if (path48 === "") throw new ConversionArgsError(`--field ${field} needs a path: --field ${field}=<dotted.path>.`);
|
|
33902
|
+
mapping[field] = path48;
|
|
33922
33903
|
}
|
|
33923
33904
|
return mapping;
|
|
33924
33905
|
}
|
|
@@ -35520,11 +35501,11 @@ function unwrap(response) {
|
|
|
35520
35501
|
}
|
|
35521
35502
|
return response.data;
|
|
35522
35503
|
}
|
|
35523
|
-
async function readAvatars(
|
|
35524
|
-
return unwrap(await apiGet(
|
|
35504
|
+
async function readAvatars(path48, params) {
|
|
35505
|
+
return unwrap(await apiGet(path48, params));
|
|
35525
35506
|
}
|
|
35526
|
-
async function writeAvatars(
|
|
35527
|
-
return unwrap(await apiPost(
|
|
35507
|
+
async function writeAvatars(path48, body) {
|
|
35508
|
+
return unwrap(await apiPost(path48, body));
|
|
35528
35509
|
}
|
|
35529
35510
|
|
|
35530
35511
|
// src/commands/avatars/create.ts
|
|
@@ -36433,12 +36414,12 @@ function missingFontFiles(urls, available) {
|
|
|
36433
36414
|
function planFontAdoption(sources, families) {
|
|
36434
36415
|
const wanted = new Map(families.map((family) => [normalizeFamily(family), family]));
|
|
36435
36416
|
const byFamily = /* @__PURE__ */ new Map();
|
|
36436
|
-
for (const { path:
|
|
36437
|
-
const dir = posix.dirname(
|
|
36417
|
+
for (const { path: path48, source } of sources) {
|
|
36418
|
+
const dir = posix.dirname(path48);
|
|
36438
36419
|
for (const face of declaredFontFaces(source)) {
|
|
36439
36420
|
if (!wanted.has(face.family)) continue;
|
|
36440
36421
|
const perFile = byFamily.get(face.family) ?? /* @__PURE__ */ new Map();
|
|
36441
|
-
perFile.set(
|
|
36422
|
+
perFile.set(path48, [...perFile.get(path48) ?? [], rebaseFontFaceSrc(face.block, dir)]);
|
|
36442
36423
|
byFamily.set(face.family, perFile);
|
|
36443
36424
|
}
|
|
36444
36425
|
}
|
|
@@ -49264,10 +49245,10 @@ function parseValueExpression(raw) {
|
|
|
49264
49245
|
return parts.map(parsePart);
|
|
49265
49246
|
}
|
|
49266
49247
|
function trackingFieldIds() {
|
|
49267
|
-
const
|
|
49268
|
-
if (!existsSync6(
|
|
49248
|
+
const path48 = join4(flowsDir(), "..", "tracking.ts");
|
|
49249
|
+
if (!existsSync6(path48)) return null;
|
|
49269
49250
|
try {
|
|
49270
|
-
const source = readFileSync15(
|
|
49251
|
+
const source = readFileSync15(path48, "utf-8");
|
|
49271
49252
|
const block2 = source.match(/TRACKING_FIELD_IDS\s*=\s*\[([\s\S]*?)\]\s*as const/)?.[1];
|
|
49272
49253
|
if (!block2) return null;
|
|
49273
49254
|
const ids = [...block2.matchAll(/"(tracking\.[a-z0-9_]+)"/g)].map((match) => match[1]);
|
|
@@ -49841,13 +49822,13 @@ function specsFromFile(parsed) {
|
|
|
49841
49822
|
return `${destField}${type}=${entry?.value ?? ""}`;
|
|
49842
49823
|
});
|
|
49843
49824
|
}
|
|
49844
|
-
function readSpecFile(
|
|
49825
|
+
function readSpecFile(path48) {
|
|
49845
49826
|
let raw;
|
|
49846
49827
|
try {
|
|
49847
|
-
raw =
|
|
49828
|
+
raw = path48 === "-" ? readFileSync16(0, "utf-8") : readFileSync16(path48, "utf-8");
|
|
49848
49829
|
} catch (error) {
|
|
49849
49830
|
refuse(
|
|
49850
|
-
`Could not read ${
|
|
49831
|
+
`Could not read ${path48 === "-" ? "the mapping from stdin" : `"${path48}"`}: ${error instanceof Error ? error.message : String(error)}`
|
|
49851
49832
|
);
|
|
49852
49833
|
}
|
|
49853
49834
|
let parsed;
|
|
@@ -49855,7 +49836,7 @@ function readSpecFile(path49) {
|
|
|
49855
49836
|
parsed = JSON.parse(raw);
|
|
49856
49837
|
} catch (error) {
|
|
49857
49838
|
refuse(
|
|
49858
|
-
`${
|
|
49839
|
+
`${path48 === "-" ? "stdin" : `"${path48}"`} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
49859
49840
|
'Expected { "map": { "<destField>": "<value>", \u2026 } }'
|
|
49860
49841
|
);
|
|
49861
49842
|
}
|
|
@@ -50154,21 +50135,21 @@ var ARRAY_FIELDS = [
|
|
|
50154
50135
|
"tagIds"
|
|
50155
50136
|
];
|
|
50156
50137
|
var ARRAY_OWNERS = ["", "body"];
|
|
50157
|
-
function dropUnsetOptionals(sideEffect,
|
|
50138
|
+
function dropUnsetOptionals(sideEffect, path48) {
|
|
50158
50139
|
return OPTIONAL_STRINGS.flatMap((key) => {
|
|
50159
50140
|
if (!(key in sideEffect) || sideEffect[key] !== null && sideEffect[key] !== "") return [];
|
|
50160
50141
|
delete sideEffect[key];
|
|
50161
|
-
return [{ path:
|
|
50142
|
+
return [{ path: path48, change: `dropped \`${key}\` (an optional string is absent, never null)` }];
|
|
50162
50143
|
});
|
|
50163
50144
|
}
|
|
50164
|
-
function fillNulledArrays(target2, prefix,
|
|
50145
|
+
function fillNulledArrays(target2, prefix, path48) {
|
|
50165
50146
|
return ARRAY_FIELDS.flatMap((key) => {
|
|
50166
50147
|
if (!(key in target2) || target2[key] !== null) return [];
|
|
50167
50148
|
target2[key] = [];
|
|
50168
|
-
return [{ path:
|
|
50149
|
+
return [{ path: path48, change: `\`${prefix}${key}: null\` \u2192 \`[]\`` }];
|
|
50169
50150
|
});
|
|
50170
50151
|
}
|
|
50171
|
-
function tidyEmailRecipients(sideEffect,
|
|
50152
|
+
function tidyEmailRecipients(sideEffect, path48) {
|
|
50172
50153
|
if (sideEffect.type !== "email") return [];
|
|
50173
50154
|
const config = sideEffect.encryptedConfig;
|
|
50174
50155
|
if (!config || typeof config !== "object" || Array.isArray(config)) return [];
|
|
@@ -50179,7 +50160,7 @@ function tidyEmailRecipients(sideEffect, path49) {
|
|
|
50179
50160
|
const tidied = to.join(", ");
|
|
50180
50161
|
if (tidied === raw) return [];
|
|
50181
50162
|
config.email = tidied;
|
|
50182
|
-
return [{ path:
|
|
50163
|
+
return [{ path: path48, change: "tidied the recipient list's spacing and separators" }];
|
|
50183
50164
|
}
|
|
50184
50165
|
function sideEffectsOf(node) {
|
|
50185
50166
|
if (!Array.isArray(node.sideEffects)) return [];
|
|
@@ -50188,13 +50169,13 @@ function sideEffectsOf(node) {
|
|
|
50188
50169
|
);
|
|
50189
50170
|
}
|
|
50190
50171
|
function normalizeSideEffect(sideEffect, where) {
|
|
50191
|
-
const
|
|
50172
|
+
const path48 = `${where} \u2192 ${String(sideEffect.id ?? "side effect")}`;
|
|
50192
50173
|
const arrays = ARRAY_OWNERS.flatMap((owner) => {
|
|
50193
50174
|
const target2 = owner ? sideEffect[owner] : sideEffect;
|
|
50194
50175
|
if (!target2 || typeof target2 !== "object") return [];
|
|
50195
|
-
return fillNulledArrays(target2, owner ? `${owner}.` : "",
|
|
50176
|
+
return fillNulledArrays(target2, owner ? `${owner}.` : "", path48);
|
|
50196
50177
|
});
|
|
50197
|
-
return [...dropUnsetOptionals(sideEffect,
|
|
50178
|
+
return [...dropUnsetOptionals(sideEffect, path48), ...arrays, ...tidyEmailRecipients(sideEffect, path48)];
|
|
50198
50179
|
}
|
|
50199
50180
|
function normalizeFlowTree(tree) {
|
|
50200
50181
|
const changes = [];
|
|
@@ -51584,10 +51565,10 @@ async function stageOps(ops) {
|
|
|
51584
51565
|
handleError5(err);
|
|
51585
51566
|
}
|
|
51586
51567
|
}
|
|
51587
|
-
async function draftAction2(
|
|
51568
|
+
async function draftAction2(path48, body, chat) {
|
|
51588
51569
|
const chatId = resolveChatId(chat);
|
|
51589
51570
|
try {
|
|
51590
|
-
const data = await apiPost(
|
|
51571
|
+
const data = await apiPost(path48, { chatId, ...body });
|
|
51591
51572
|
writeJsonEnvelope({ ok: true, data });
|
|
51592
51573
|
return data;
|
|
51593
51574
|
} catch (err) {
|
|
@@ -54116,9 +54097,9 @@ async function readImageBuffer(pathOrUrl) {
|
|
|
54116
54097
|
}
|
|
54117
54098
|
return readFile28(pathOrUrl);
|
|
54118
54099
|
}
|
|
54119
|
-
async function isDirectory(
|
|
54100
|
+
async function isDirectory(path48) {
|
|
54120
54101
|
try {
|
|
54121
|
-
const s = await stat7(
|
|
54102
|
+
const s = await stat7(path48);
|
|
54122
54103
|
return s.isDirectory();
|
|
54123
54104
|
} catch {
|
|
54124
54105
|
return false;
|
|
@@ -54546,13 +54527,13 @@ function resolveDownloadPath({ baseName, extension, out, outIsDirectory: outIsDi
|
|
|
54546
54527
|
}
|
|
54547
54528
|
function disambiguate(paths) {
|
|
54548
54529
|
const taken = /* @__PURE__ */ new Set();
|
|
54549
|
-
return paths.map((
|
|
54550
|
-
if (!taken.has(
|
|
54551
|
-
taken.add(
|
|
54552
|
-
return
|
|
54530
|
+
return paths.map((path48) => {
|
|
54531
|
+
if (!taken.has(path48)) {
|
|
54532
|
+
taken.add(path48);
|
|
54533
|
+
return path48;
|
|
54553
54534
|
}
|
|
54554
|
-
const ext = extname3(
|
|
54555
|
-
const stem =
|
|
54535
|
+
const ext = extname3(path48);
|
|
54536
|
+
const stem = path48.slice(0, path48.length - ext.length);
|
|
54556
54537
|
let n = 2;
|
|
54557
54538
|
while (taken.has(`${stem}-${n}${ext}`)) n += 1;
|
|
54558
54539
|
const unique = `${stem}-${n}${ext}`;
|
|
@@ -54678,10 +54659,10 @@ async function runDownloads(plan) {
|
|
|
54678
54659
|
const paths = disambiguate(fetched.map((item) => item.path));
|
|
54679
54660
|
const downloaded = [];
|
|
54680
54661
|
for (const [index, item] of fetched.entries()) {
|
|
54681
|
-
const
|
|
54662
|
+
const path48 = paths[index] ?? item.path;
|
|
54682
54663
|
try {
|
|
54683
|
-
await atomicWrite(
|
|
54684
|
-
downloaded.push({ input: item.input, output:
|
|
54664
|
+
await atomicWrite(path48, item.buffer);
|
|
54665
|
+
downloaded.push({ input: item.input, output: path48, bytes: item.buffer.length, contentType: item.contentType });
|
|
54685
54666
|
} catch (err) {
|
|
54686
54667
|
failed.push({ input: item.input, error: failureMessage(err, "Write failed") });
|
|
54687
54668
|
}
|
|
@@ -62868,353 +62849,11 @@ Full guide: __tooling__/docs/tools/baker/mcp.md`
|
|
|
62868
62849
|
}
|
|
62869
62850
|
});
|
|
62870
62851
|
|
|
62871
|
-
// src/commands/media-sources/index.ts
|
|
62872
|
-
import { defineCommand as defineCommand189 } from "citty";
|
|
62873
|
-
|
|
62874
|
-
// ../api/src/media-sources.ts
|
|
62875
|
-
import { z as z51 } from "zod";
|
|
62876
|
-
var mediaSourcePlatformSchema = z51.enum(["instagram", "tiktok", "youtube", "linkedin", "facebook"]);
|
|
62877
|
-
var mediaSourceRefreshIntervalSchema = z51.enum(["never", "daily", "weekly", "monthly"]);
|
|
62878
|
-
var mediaSourceSyncStatusSchema = z51.enum(["idle", "fetching", "processing", "error"]);
|
|
62879
|
-
var mediaSourceHalfSchema = z51.object({
|
|
62880
|
-
sourceId: z51.string(),
|
|
62881
|
-
syncStatus: mediaSourceSyncStatusSchema,
|
|
62882
|
-
storedCount: z51.number().optional(),
|
|
62883
|
-
pendingItems: z51.number().optional(),
|
|
62884
|
-
failedItems: z51.number().optional(),
|
|
62885
|
-
lastSyncedAt: z51.number().optional(),
|
|
62886
|
-
errorMessage: z51.string().optional()
|
|
62887
|
-
});
|
|
62888
|
-
var mediaSourceSummarySchema = z51.object({
|
|
62889
|
-
key: z51.string(),
|
|
62890
|
-
platform: mediaSourcePlatformSchema,
|
|
62891
|
-
platformLabel: z51.string(),
|
|
62892
|
-
handle: z51.string(),
|
|
62893
|
-
label: z51.string(),
|
|
62894
|
-
profileUrl: z51.string(),
|
|
62895
|
-
profileImageUrl: z51.string().optional(),
|
|
62896
|
-
refreshInterval: mediaSourceRefreshIntervalSchema,
|
|
62897
|
-
/** Absent for a platform that feeds no images (YouTube). */
|
|
62898
|
-
images: mediaSourceHalfSchema.optional(),
|
|
62899
|
-
videos: mediaSourceHalfSchema.optional(),
|
|
62900
|
-
createdAt: z51.number()
|
|
62901
|
-
});
|
|
62902
|
-
var mediaSourceProfileSchema = z51.object({
|
|
62903
|
-
platform: mediaSourcePlatformSchema,
|
|
62904
|
-
handle: z51.string(),
|
|
62905
|
-
displayName: z51.string(),
|
|
62906
|
-
avatarUrl: z51.string(),
|
|
62907
|
-
bio: z51.string(),
|
|
62908
|
-
followers: z51.number().optional(),
|
|
62909
|
-
postCount: z51.number().optional(),
|
|
62910
|
-
isPrivate: z51.boolean(),
|
|
62911
|
-
profileUrl: z51.string(),
|
|
62912
|
-
channelId: z51.string().optional()
|
|
62913
|
-
});
|
|
62914
|
-
var mediaSourcesAddRequestSchema = z51.object({
|
|
62915
|
-
/** A profile URL, or an @handle together with `platform`. */
|
|
62916
|
-
input: z51.string().trim().min(1, "Pass the account's profile URL or @handle"),
|
|
62917
|
-
/** Needed only when `input` is a bare handle; a URL names its own platform. */
|
|
62918
|
-
platform: mediaSourcePlatformSchema.optional(),
|
|
62919
|
-
/** Auto-sync cadence. Omitted = off (sync on demand). */
|
|
62920
|
-
every: mediaSourceRefreshIntervalSchema.optional()
|
|
62921
|
-
});
|
|
62922
|
-
var mediaSourceKeySchema = z51.string().trim().regex(/^(instagram|tiktok|youtube|linkedin|facebook):.+$/, "Pass a source key like tiktok:nike");
|
|
62923
|
-
var mediaSourcesSyncRequestSchema = z51.object({ key: mediaSourceKeySchema });
|
|
62924
|
-
var mediaSourcesRemoveRequestSchema = z51.object({ key: mediaSourceKeySchema });
|
|
62925
|
-
var mediaSourcesScheduleRequestSchema = z51.object({
|
|
62926
|
-
key: mediaSourceKeySchema,
|
|
62927
|
-
every: mediaSourceRefreshIntervalSchema
|
|
62928
|
-
});
|
|
62929
|
-
|
|
62930
|
-
// src/commands/media-sources/add.ts
|
|
62931
|
-
import { defineCommand as defineCommand184 } from "citty";
|
|
62932
|
-
|
|
62933
|
-
// src/commands/media-sources/shared.ts
|
|
62934
|
-
function reportError2(err) {
|
|
62935
|
-
if (err instanceof ApiError) {
|
|
62936
|
-
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
62937
|
-
process.exit(1);
|
|
62938
|
-
}
|
|
62939
|
-
writeJson({ ok: false, error: { code: "INTERNAL_ERROR", message: "Unexpected error" } });
|
|
62940
|
-
process.exit(1);
|
|
62941
|
-
}
|
|
62942
|
-
function halfState(half) {
|
|
62943
|
-
if (!half) return null;
|
|
62944
|
-
return {
|
|
62945
|
-
status: half.syncStatus === "fetching" || half.syncStatus === "processing" ? "importing" : half.syncStatus,
|
|
62946
|
-
stored: half.storedCount ?? 0,
|
|
62947
|
-
...half.pendingItems ? { pending: half.pendingItems } : {},
|
|
62948
|
-
...half.failedItems ? { failed: half.failedItems } : {},
|
|
62949
|
-
...half.lastSyncedAt ? { lastSyncedAt: new Date(half.lastSyncedAt).toISOString() } : {},
|
|
62950
|
-
...half.errorMessage ? { error: half.errorMessage } : {}
|
|
62951
|
-
};
|
|
62952
|
-
}
|
|
62953
|
-
function compactSource(source) {
|
|
62954
|
-
return {
|
|
62955
|
-
key: source.key,
|
|
62956
|
-
platform: source.platform,
|
|
62957
|
-
label: source.label,
|
|
62958
|
-
url: source.profileUrl,
|
|
62959
|
-
autoSync: source.refreshInterval,
|
|
62960
|
-
images: halfState(source.images),
|
|
62961
|
-
videos: halfState(source.videos)
|
|
62962
|
-
};
|
|
62963
|
-
}
|
|
62964
|
-
function isImporting(source) {
|
|
62965
|
-
return [source.images, source.videos].some(
|
|
62966
|
-
(half) => half?.syncStatus === "fetching" || half?.syncStatus === "processing"
|
|
62967
|
-
);
|
|
62968
|
-
}
|
|
62969
|
-
|
|
62970
|
-
// src/commands/media-sources/add.ts
|
|
62971
|
-
registerSchema({
|
|
62972
|
-
command: "media-sources.add",
|
|
62973
|
-
description: "Connect a public social account as a source for the image and video libraries \u2014 Instagram, TikTok, YouTube (videos only), LinkedIn company pages, Facebook pages. Its recent posts (up to a year back) are imported, described and made searchable; the import runs in the background. Applies immediately and shows on the chat as an already-applied change. Adding an account that is already connected is a no-op.",
|
|
62974
|
-
args: {
|
|
62975
|
-
input: {
|
|
62976
|
-
type: "string",
|
|
62977
|
-
description: "Profile URL (names its own platform) or @handle together with --platform",
|
|
62978
|
-
required: true
|
|
62979
|
-
},
|
|
62980
|
-
platform: {
|
|
62981
|
-
type: "string",
|
|
62982
|
-
description: `Needed only for a bare handle: ${mediaSourcePlatformSchema.options.join("|")}`,
|
|
62983
|
-
required: false
|
|
62984
|
-
},
|
|
62985
|
-
every: {
|
|
62986
|
-
type: "string",
|
|
62987
|
-
description: `Auto-sync cadence: ${mediaSourceRefreshIntervalSchema.options.join("|")} (default never \u2014 sync on demand)`,
|
|
62988
|
-
required: false
|
|
62989
|
-
}
|
|
62990
|
-
}
|
|
62991
|
-
});
|
|
62992
|
-
var addCommand3 = defineCommand184({
|
|
62993
|
-
meta: {
|
|
62994
|
-
name: "add",
|
|
62995
|
-
description: "Connect a social account (Instagram, TikTok, YouTube, LinkedIn page, Facebook page) as a media source. Start here with the profile URL.\n\nExamples:\n baker media-sources add https://www.tiktok.com/@acme\n baker media-sources add @acme --platform instagram --every weekly\n baker media-sources add https://www.youtube.com/@acme"
|
|
62996
|
-
},
|
|
62997
|
-
args: {
|
|
62998
|
-
input: { type: "positional", description: "Profile URL or @handle", required: true },
|
|
62999
|
-
platform: {
|
|
63000
|
-
type: "string",
|
|
63001
|
-
description: "instagram|tiktok|youtube|linkedin|facebook \u2014 only for a bare handle",
|
|
63002
|
-
required: false
|
|
63003
|
-
},
|
|
63004
|
-
every: { type: "string", description: "Auto-sync: never|daily|weekly|monthly", required: false }
|
|
63005
|
-
},
|
|
63006
|
-
run: async ({ args: args5 }) => {
|
|
63007
|
-
const parsed = mediaSourcesAddRequestSchema.safeParse({
|
|
63008
|
-
input: String(args5.input ?? ""),
|
|
63009
|
-
platform: args5.platform ? String(args5.platform).toLowerCase() : void 0,
|
|
63010
|
-
every: args5.every ? String(args5.every).toLowerCase() : void 0
|
|
63011
|
-
});
|
|
63012
|
-
if (!parsed.success) {
|
|
63013
|
-
const issue = parsed.error.issues[0];
|
|
63014
|
-
writeJson({
|
|
63015
|
-
ok: false,
|
|
63016
|
-
error: {
|
|
63017
|
-
code: "VALIDATION_ERROR",
|
|
63018
|
-
message: issue ? `${issue.path.join(".") || "input"}: ${issue.message}` : "Invalid request"
|
|
63019
|
-
}
|
|
63020
|
-
});
|
|
63021
|
-
process.exit(1);
|
|
63022
|
-
}
|
|
63023
|
-
try {
|
|
63024
|
-
const data = await apiPost("/api/media-sources/add", parsed.data, {
|
|
63025
|
-
timeoutMs: 12e4
|
|
63026
|
-
});
|
|
63027
|
-
const hints2 = [
|
|
63028
|
-
data.created ? `Connected ${data.source.label} on ${data.source.platformLabel}. Its posts are importing in the background \u2014 they become searchable with \`baker images search\` / \`baker videos search\` as each one is analysed. Check progress with \`baker media-sources list\`.` : `${data.source.label} on ${data.source.platformLabel} was already connected; a fresh import was started if one wasn't running.`
|
|
63029
|
-
];
|
|
63030
|
-
if (data.source.platform === "youtube") {
|
|
63031
|
-
hints2.push(
|
|
63032
|
-
"YouTube feeds the video library only, newest first, a batch per sync; videos over 20 minutes are skipped."
|
|
63033
|
-
);
|
|
63034
|
-
}
|
|
63035
|
-
if (data.source.refreshInterval === "never") {
|
|
63036
|
-
hints2.push(
|
|
63037
|
-
`Auto-sync is off. If the user wants new posts to keep arriving: \`baker media-sources schedule ${data.source.key} --every weekly\`.`
|
|
63038
|
-
);
|
|
63039
|
-
}
|
|
63040
|
-
writeJson({
|
|
63041
|
-
ok: true,
|
|
63042
|
-
data: { created: data.created, source: compactSource(data.source), name: data.profile.displayName },
|
|
63043
|
-
hints: hints2
|
|
63044
|
-
});
|
|
63045
|
-
} catch (err) {
|
|
63046
|
-
reportError2(err);
|
|
63047
|
-
}
|
|
63048
|
-
}
|
|
63049
|
-
});
|
|
63050
|
-
|
|
63051
|
-
// src/commands/media-sources/list.ts
|
|
63052
|
-
import { defineCommand as defineCommand185 } from "citty";
|
|
63053
|
-
registerSchema({
|
|
63054
|
-
command: "media-sources.list",
|
|
63055
|
-
description: "List the social accounts connected as image/video sources, with each one's key, import status and how many images and videos it has brought in.",
|
|
63056
|
-
args: {}
|
|
63057
|
-
});
|
|
63058
|
-
var listCommand17 = defineCommand185({
|
|
63059
|
-
meta: {
|
|
63060
|
-
name: "list",
|
|
63061
|
-
description: "List connected media sources (key, platform, import status, stored images/videos).\n\nExample: baker media-sources list"
|
|
63062
|
-
},
|
|
63063
|
-
args: {},
|
|
63064
|
-
run: async () => {
|
|
63065
|
-
try {
|
|
63066
|
-
const { sources } = await apiGet("/api/media-sources/list");
|
|
63067
|
-
const hints2 = [];
|
|
63068
|
-
if (sources.length === 0) {
|
|
63069
|
-
hints2.push(
|
|
63070
|
-
"No sources connected. Connect the brand's own accounts with `baker media-sources add <profile URL>` to fill the image and video libraries."
|
|
63071
|
-
);
|
|
63072
|
-
} else if (sources.some(isImporting)) {
|
|
63073
|
-
hints2.push("Some sources are still importing \u2014 their counts will grow over the next minutes.");
|
|
63074
|
-
}
|
|
63075
|
-
writeJson({ ok: true, data: sources.map(compactSource), hints: hints2.length > 0 ? hints2 : void 0 });
|
|
63076
|
-
} catch (err) {
|
|
63077
|
-
reportError2(err);
|
|
63078
|
-
}
|
|
63079
|
-
}
|
|
63080
|
-
});
|
|
63081
|
-
|
|
63082
|
-
// src/commands/media-sources/remove.ts
|
|
63083
|
-
import { defineCommand as defineCommand186 } from "citty";
|
|
63084
|
-
registerSchema({
|
|
63085
|
-
command: "media-sources.remove",
|
|
63086
|
-
description: "Disconnect a media source. Stops future imports; images and videos it already brought in stay in the library. Applies immediately.",
|
|
63087
|
-
args: { key: { type: "string", description: "Source key, e.g. tiktok:acme", required: true } }
|
|
63088
|
-
});
|
|
63089
|
-
var removeCommand6 = defineCommand186({
|
|
63090
|
-
meta: {
|
|
63091
|
-
name: "remove",
|
|
63092
|
-
description: "Disconnect a media source (already-imported media stays).\n\nExample: baker media-sources remove tiktok:acme"
|
|
63093
|
-
},
|
|
63094
|
-
args: { key: { type: "positional", description: "Source key, e.g. tiktok:acme", required: true } },
|
|
63095
|
-
run: async ({ args: args5 }) => {
|
|
63096
|
-
const parsed = mediaSourcesRemoveRequestSchema.safeParse({ key: String(args5.key ?? "") });
|
|
63097
|
-
if (!parsed.success) {
|
|
63098
|
-
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message: parsed.error.issues[0]?.message ?? "" } });
|
|
63099
|
-
process.exit(1);
|
|
63100
|
-
}
|
|
63101
|
-
try {
|
|
63102
|
-
const data = await apiPost("/api/media-sources/remove", parsed.data);
|
|
63103
|
-
writeJson({ ok: true, data });
|
|
63104
|
-
} catch (err) {
|
|
63105
|
-
reportError2(err);
|
|
63106
|
-
}
|
|
63107
|
-
}
|
|
63108
|
-
});
|
|
63109
|
-
|
|
63110
|
-
// src/commands/media-sources/schedule.ts
|
|
63111
|
-
import { defineCommand as defineCommand187 } from "citty";
|
|
63112
|
-
registerSchema({
|
|
63113
|
-
command: "media-sources.schedule",
|
|
63114
|
-
description: "Set how often a connected source imports new posts on its own.",
|
|
63115
|
-
args: {
|
|
63116
|
-
key: { type: "string", description: "Source key, e.g. tiktok:acme", required: true },
|
|
63117
|
-
every: {
|
|
63118
|
-
type: "string",
|
|
63119
|
-
description: `Cadence: ${mediaSourceRefreshIntervalSchema.options.join("|")} (never = only on demand)`,
|
|
63120
|
-
required: true
|
|
63121
|
-
}
|
|
63122
|
-
}
|
|
63123
|
-
});
|
|
63124
|
-
var scheduleCommand = defineCommand187({
|
|
63125
|
-
meta: {
|
|
63126
|
-
name: "schedule",
|
|
63127
|
-
description: "Set a source's auto-sync cadence.\n\nExample: baker media-sources schedule tiktok:acme --every weekly"
|
|
63128
|
-
},
|
|
63129
|
-
args: {
|
|
63130
|
-
key: { type: "positional", description: "Source key, e.g. tiktok:acme", required: true },
|
|
63131
|
-
every: { type: "string", description: "never|daily|weekly|monthly", required: true }
|
|
63132
|
-
},
|
|
63133
|
-
run: async ({ args: args5 }) => {
|
|
63134
|
-
const parsed = mediaSourcesScheduleRequestSchema.safeParse({
|
|
63135
|
-
key: String(args5.key ?? ""),
|
|
63136
|
-
every: String(args5.every ?? "").toLowerCase()
|
|
63137
|
-
});
|
|
63138
|
-
if (!parsed.success) {
|
|
63139
|
-
const issue = parsed.error.issues[0];
|
|
63140
|
-
writeJson({
|
|
63141
|
-
ok: false,
|
|
63142
|
-
error: { code: "VALIDATION_ERROR", message: issue ? `${issue.path.join(".")}: ${issue.message}` : "" }
|
|
63143
|
-
});
|
|
63144
|
-
process.exit(1);
|
|
63145
|
-
}
|
|
63146
|
-
try {
|
|
63147
|
-
const data = await apiPost("/api/media-sources/schedule", parsed.data);
|
|
63148
|
-
writeJson({ ok: true, data: { ...data, autoSync: parsed.data.every } });
|
|
63149
|
-
} catch (err) {
|
|
63150
|
-
reportError2(err);
|
|
63151
|
-
}
|
|
63152
|
-
}
|
|
63153
|
-
});
|
|
63154
|
-
|
|
63155
|
-
// src/commands/media-sources/sync.ts
|
|
63156
|
-
import { defineCommand as defineCommand188 } from "citty";
|
|
63157
|
-
registerSchema({
|
|
63158
|
-
command: "media-sources.sync",
|
|
63159
|
-
description: "Import a connected source's new posts now. Runs in the background; only posts not yet in the library are fetched.",
|
|
63160
|
-
args: {
|
|
63161
|
-
key: { type: "string", description: "Source key from `media-sources list`, e.g. tiktok:acme", required: true }
|
|
63162
|
-
}
|
|
63163
|
-
});
|
|
63164
|
-
var syncCommand = defineCommand188({
|
|
63165
|
-
meta: {
|
|
63166
|
-
name: "sync",
|
|
63167
|
-
description: "Import a source's new posts now.\n\nExample: baker media-sources sync tiktok:acme"
|
|
63168
|
-
},
|
|
63169
|
-
args: { key: { type: "positional", description: "Source key, e.g. tiktok:acme", required: true } },
|
|
63170
|
-
run: async ({ args: args5 }) => {
|
|
63171
|
-
const parsed = mediaSourcesSyncRequestSchema.safeParse({ key: String(args5.key ?? "") });
|
|
63172
|
-
if (!parsed.success) {
|
|
63173
|
-
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message: parsed.error.issues[0]?.message ?? "" } });
|
|
63174
|
-
process.exit(1);
|
|
63175
|
-
}
|
|
63176
|
-
try {
|
|
63177
|
-
const data = await apiPost("/api/media-sources/sync", parsed.data);
|
|
63178
|
-
writeJson({
|
|
63179
|
-
ok: true,
|
|
63180
|
-
data,
|
|
63181
|
-
hints: data.started ? void 0 : ["An import was already running for this source; nothing new was started."]
|
|
63182
|
-
});
|
|
63183
|
-
} catch (err) {
|
|
63184
|
-
reportError2(err);
|
|
63185
|
-
}
|
|
63186
|
-
}
|
|
63187
|
-
});
|
|
63188
|
-
|
|
63189
|
-
// src/commands/media-sources/index.ts
|
|
63190
|
-
var mediaSourcesCommand = defineCommand189({
|
|
63191
|
-
meta: {
|
|
63192
|
-
name: "media-sources",
|
|
63193
|
-
description: `Connect social accounts whose posts fill the image and video libraries: Instagram, TikTok, YouTube (videos), LinkedIn company pages, Facebook pages. Subcommands: add, list, sync, schedule, remove.
|
|
63194
|
-
|
|
63195
|
-
Examples:
|
|
63196
|
-
baker media-sources add https://www.tiktok.com/@acme
|
|
63197
|
-
baker media-sources add @acme --platform instagram --every weekly
|
|
63198
|
-
baker media-sources list
|
|
63199
|
-
baker media-sources sync youtube:acme
|
|
63200
|
-
baker media-sources schedule linkedin:acme --every monthly
|
|
63201
|
-
baker media-sources remove facebook:acme
|
|
63202
|
-
Full guide: __tooling__/docs/tools/baker/media-sources.md`
|
|
63203
|
-
},
|
|
63204
|
-
subCommands: {
|
|
63205
|
-
add: addCommand3,
|
|
63206
|
-
list: listCommand17,
|
|
63207
|
-
sync: syncCommand,
|
|
63208
|
-
schedule: scheduleCommand,
|
|
63209
|
-
remove: removeCommand6
|
|
63210
|
-
}
|
|
63211
|
-
});
|
|
63212
|
-
|
|
63213
62852
|
// src/commands/research/index.ts
|
|
63214
|
-
import { defineCommand as
|
|
62853
|
+
import { defineCommand as defineCommand196 } from "citty";
|
|
63215
62854
|
|
|
63216
62855
|
// src/commands/research/advertisers.ts
|
|
63217
|
-
import { defineCommand as
|
|
62856
|
+
import { defineCommand as defineCommand184 } from "citty";
|
|
63218
62857
|
|
|
63219
62858
|
// src/commands/research/hints.ts
|
|
63220
62859
|
var AD_COPY_ROUTE = 'This returns competing domains and their SERP economics \u2014 no ad copy, no headlines, no creative. For the actual copy of a competitor\'s ads: `baker winning-ads advertisers "<brand>"` \u2192 `baker winning-ads search "<brief>" --advertiser-id <id>` \u2192 `baker winning-ads content <adId>` (`primary_text` / `headline` / `cta`, plus the spoken transcript and on-screen text for video). That corpus is Meta and LinkedIn only \u2014 Google SERP ad copy is not available through any Baker command, so do not keep querying for it here.';
|
|
@@ -63416,7 +63055,7 @@ var FIELDS3 = {
|
|
|
63416
63055
|
etv: "Estimated traffic value (USD)",
|
|
63417
63056
|
visibility: "SERP visibility score (0-1)"
|
|
63418
63057
|
};
|
|
63419
|
-
var advertisersCommand =
|
|
63058
|
+
var advertisersCommand = defineCommand184({
|
|
63420
63059
|
meta: {
|
|
63421
63060
|
name: "advertisers",
|
|
63422
63061
|
description: `Domains competing for a keyword in Google SERPs, with position, relevance, traffic value and visibility. Returns NO ad copy \u2014 for a competitor's headlines and body copy use \`baker winning-ads content <adId>\` (Meta/LinkedIn only).
|
|
@@ -63472,7 +63111,7 @@ Examples:
|
|
|
63472
63111
|
});
|
|
63473
63112
|
|
|
63474
63113
|
// src/commands/research/autocomplete.ts
|
|
63475
|
-
import { defineCommand as
|
|
63114
|
+
import { defineCommand as defineCommand185 } from "citty";
|
|
63476
63115
|
registerSchema({
|
|
63477
63116
|
command: "research.autocomplete",
|
|
63478
63117
|
description: "Get Google Autocomplete suggestions for a seed keyword. Useful for keyword expansion and discovering what people actually search for. If --location and --language are omitted, defaults to United States (us) and English (en).",
|
|
@@ -63495,7 +63134,7 @@ registerSchema({
|
|
|
63495
63134
|
var FIELDS4 = {
|
|
63496
63135
|
suggestion: "Autocomplete suggestion from Google"
|
|
63497
63136
|
};
|
|
63498
|
-
var autocompleteCommand =
|
|
63137
|
+
var autocompleteCommand = defineCommand185({
|
|
63499
63138
|
meta: {
|
|
63500
63139
|
name: "autocomplete",
|
|
63501
63140
|
description: `Get Google Autocomplete suggestions for keyword expansion.
|
|
@@ -63550,7 +63189,7 @@ Examples:
|
|
|
63550
63189
|
});
|
|
63551
63190
|
|
|
63552
63191
|
// src/commands/research/countries.ts
|
|
63553
|
-
import { defineCommand as
|
|
63192
|
+
import { defineCommand as defineCommand186 } from "citty";
|
|
63554
63193
|
registerSchema({
|
|
63555
63194
|
command: "research.countries",
|
|
63556
63195
|
description: "List all supported country codes for --location flag in research commands.",
|
|
@@ -63607,7 +63246,7 @@ var FIELDS5 = {
|
|
|
63607
63246
|
code: "Country code to pass as --location",
|
|
63608
63247
|
name: "Country name"
|
|
63609
63248
|
};
|
|
63610
|
-
var countriesCommand =
|
|
63249
|
+
var countriesCommand = defineCommand186({
|
|
63611
63250
|
meta: {
|
|
63612
63251
|
name: "countries",
|
|
63613
63252
|
description: "List all supported country codes for --location flag."
|
|
@@ -63618,7 +63257,7 @@ var countriesCommand = defineCommand192({
|
|
|
63618
63257
|
});
|
|
63619
63258
|
|
|
63620
63259
|
// src/commands/research/fetch.ts
|
|
63621
|
-
import { defineCommand as
|
|
63260
|
+
import { defineCommand as defineCommand187 } from "citty";
|
|
63622
63261
|
var CONTENT_PREVIEW_CHARS = 2e4;
|
|
63623
63262
|
var TIMEOUT_MS = 18e4;
|
|
63624
63263
|
registerSchema({
|
|
@@ -63691,7 +63330,7 @@ function fetchFix(code) {
|
|
|
63691
63330
|
explanation: "This read failed. Don't build a retry ladder around it \u2014 finish the rest of the job with what you can reach and name this page as a gap."
|
|
63692
63331
|
};
|
|
63693
63332
|
}
|
|
63694
|
-
var fetchCommand =
|
|
63333
|
+
var fetchCommand = defineCommand187({
|
|
63695
63334
|
meta: {
|
|
63696
63335
|
name: "fetch",
|
|
63697
63336
|
description: `Read a page an ordinary web fetch could not. Bot walls and JavaScript-rendered pages are resolved for you \u2014 you never have to retry, wait, or drive a browser yourself.
|
|
@@ -63768,7 +63407,7 @@ Examples:
|
|
|
63768
63407
|
});
|
|
63769
63408
|
|
|
63770
63409
|
// src/commands/research/intent.ts
|
|
63771
|
-
import { defineCommand as
|
|
63410
|
+
import { defineCommand as defineCommand188 } from "citty";
|
|
63772
63411
|
registerSchema({
|
|
63773
63412
|
command: "research.intent",
|
|
63774
63413
|
description: "Classify Google Search intent for keywords. Determines if someone searching is looking to buy, research, or navigate. If --language is omitted, defaults to English (en). The response includes a query_context object showing which language was used.",
|
|
@@ -63791,7 +63430,7 @@ var FIELDS7 = {
|
|
|
63791
63430
|
intent: "Primary Google Search intent: informational, navigational, commercial, transactional",
|
|
63792
63431
|
probability: "Confidence score 0.0-1.0"
|
|
63793
63432
|
};
|
|
63794
|
-
var intentCommand =
|
|
63433
|
+
var intentCommand = defineCommand188({
|
|
63795
63434
|
meta: {
|
|
63796
63435
|
name: "intent",
|
|
63797
63436
|
description: `Classify Google Search intent for keywords. Returns intent type and confidence.
|
|
@@ -63839,7 +63478,7 @@ Examples:
|
|
|
63839
63478
|
});
|
|
63840
63479
|
|
|
63841
63480
|
// src/commands/research/keyword-gap.ts
|
|
63842
|
-
import { defineCommand as
|
|
63481
|
+
import { defineCommand as defineCommand189 } from "citty";
|
|
63843
63482
|
registerSchema({
|
|
63844
63483
|
command: "research.keyword-gap",
|
|
63845
63484
|
description: "Find keywords a competitor ranks for (organic or paid) that you don't. Discovers expansion opportunities. If --location and --language are omitted, defaults to United States (us) and English (en). The response includes a query_context object showing which location/language were used.",
|
|
@@ -63868,7 +63507,7 @@ var FIELDS8 = {
|
|
|
63868
63507
|
cpc: "Cost per click USD",
|
|
63869
63508
|
their_position: "Competitor's ranking position"
|
|
63870
63509
|
};
|
|
63871
|
-
var keywordGapCommand =
|
|
63510
|
+
var keywordGapCommand = defineCommand189({
|
|
63872
63511
|
meta: {
|
|
63873
63512
|
name: "keyword-gap",
|
|
63874
63513
|
description: `Find keywords a competitor has that you don't. Supports pagination via --offset.
|
|
@@ -63943,7 +63582,7 @@ Examples:
|
|
|
63943
63582
|
});
|
|
63944
63583
|
|
|
63945
63584
|
// src/commands/research/keyword-metrics.ts
|
|
63946
|
-
import { defineCommand as
|
|
63585
|
+
import { defineCommand as defineCommand190 } from "citty";
|
|
63947
63586
|
|
|
63948
63587
|
// src/commands/research/keyword-metrics-rows.ts
|
|
63949
63588
|
var KEYWORD_METRICS_SOURCE = "keyword_planner_estimate_via_dataforseo";
|
|
@@ -64023,7 +63662,7 @@ registerSchema({
|
|
|
64023
63662
|
"no-cache": { type: "boolean", description: "Skip server cache, hit API directly", required: false }
|
|
64024
63663
|
}
|
|
64025
63664
|
});
|
|
64026
|
-
var keywordMetricsCommand =
|
|
63665
|
+
var keywordMetricsCommand = defineCommand190({
|
|
64027
63666
|
meta: {
|
|
64028
63667
|
name: "keyword-metrics",
|
|
64029
63668
|
description: `Volume, CPC and competition for keywords you name. No domain required.
|
|
@@ -64105,7 +63744,7 @@ Examples:
|
|
|
64105
63744
|
});
|
|
64106
63745
|
|
|
64107
63746
|
// src/commands/research/keywords-for-site.ts
|
|
64108
|
-
import { defineCommand as
|
|
63747
|
+
import { defineCommand as defineCommand191 } from "citty";
|
|
64109
63748
|
registerSchema({
|
|
64110
63749
|
command: "research.keywords-for-site",
|
|
64111
63750
|
description: "Get keywords a competitor targets in Google. Use --type paid to see only paid keywords, --type organic for organic only. If --location and --language are omitted, defaults to United States (us) and English (en). The response includes a query_context object showing which location/language were used.",
|
|
@@ -64138,7 +63777,7 @@ var FIELDS9 = {
|
|
|
64138
63777
|
competition: "LOW, MEDIUM, or HIGH",
|
|
64139
63778
|
competition_index: "Competition score 0-100"
|
|
64140
63779
|
};
|
|
64141
|
-
var keywordsForSiteCommand =
|
|
63780
|
+
var keywordsForSiteCommand = defineCommand191({
|
|
64142
63781
|
meta: {
|
|
64143
63782
|
name: "keywords-for-site",
|
|
64144
63783
|
description: `Get keywords a competitor targets in Google. Use --type to filter paid/organic.
|
|
@@ -64200,7 +63839,7 @@ Examples:
|
|
|
64200
63839
|
});
|
|
64201
63840
|
|
|
64202
63841
|
// src/commands/research/languages.ts
|
|
64203
|
-
import { defineCommand as
|
|
63842
|
+
import { defineCommand as defineCommand192 } from "citty";
|
|
64204
63843
|
registerSchema({
|
|
64205
63844
|
command: "research.languages",
|
|
64206
63845
|
description: "List all supported language codes for --language flag in research commands.",
|
|
@@ -64230,7 +63869,7 @@ var FIELDS10 = {
|
|
|
64230
63869
|
code: "Language code to pass as --language",
|
|
64231
63870
|
name: "Language name (also accepted by --language)"
|
|
64232
63871
|
};
|
|
64233
|
-
var languagesCommand2 =
|
|
63872
|
+
var languagesCommand2 = defineCommand192({
|
|
64234
63873
|
meta: {
|
|
64235
63874
|
name: "languages",
|
|
64236
63875
|
description: "List all supported language codes for --language flag."
|
|
@@ -64241,7 +63880,7 @@ var languagesCommand2 = defineCommand198({
|
|
|
64241
63880
|
});
|
|
64242
63881
|
|
|
64243
63882
|
// src/commands/research/lighthouse.ts
|
|
64244
|
-
import { defineCommand as
|
|
63883
|
+
import { defineCommand as defineCommand193 } from "citty";
|
|
64245
63884
|
registerSchema({
|
|
64246
63885
|
command: "research.lighthouse",
|
|
64247
63886
|
description: "Landing page performance audit. Returns metrics that affect Google Ads Quality Score and CPC.",
|
|
@@ -64260,7 +63899,7 @@ var FIELDS11 = {
|
|
|
64260
63899
|
speed_index_ms: "Speed Index in ms (good: < 3400)",
|
|
64261
63900
|
interactive_ms: "Time to Interactive in ms (good: < 3800)"
|
|
64262
63901
|
};
|
|
64263
|
-
var lighthouseCommand =
|
|
63902
|
+
var lighthouseCommand = defineCommand193({
|
|
64264
63903
|
meta: {
|
|
64265
63904
|
name: "lighthouse",
|
|
64266
63905
|
description: `Landing page performance audit. Metrics affecting Google Ads Quality Score.
|
|
@@ -64298,7 +63937,7 @@ Examples:
|
|
|
64298
63937
|
});
|
|
64299
63938
|
|
|
64300
63939
|
// src/commands/research/relevant-pages.ts
|
|
64301
|
-
import { defineCommand as
|
|
63940
|
+
import { defineCommand as defineCommand194 } from "citty";
|
|
64302
63941
|
registerSchema({
|
|
64303
63942
|
command: "research.relevant-pages",
|
|
64304
63943
|
description: "Get the top pages of a competitor domain with organic traffic and ranking data. Shows which pages drive the most traffic. If --location and --language are omitted, defaults to United States (us) and English (en).",
|
|
@@ -64324,7 +63963,7 @@ var FIELDS12 = {
|
|
|
64324
63963
|
keywords: "Total organic keywords the page ranks for",
|
|
64325
63964
|
top_10: "Keywords in positions 1-10"
|
|
64326
63965
|
};
|
|
64327
|
-
var relevantPagesCommand =
|
|
63966
|
+
var relevantPagesCommand = defineCommand194({
|
|
64328
63967
|
meta: {
|
|
64329
63968
|
name: "relevant-pages",
|
|
64330
63969
|
description: `Get the top pages of a competitor domain with traffic data.
|
|
@@ -64371,7 +64010,7 @@ Examples:
|
|
|
64371
64010
|
});
|
|
64372
64011
|
|
|
64373
64012
|
// src/commands/research/web.ts
|
|
64374
|
-
import { defineCommand as
|
|
64013
|
+
import { defineCommand as defineCommand195 } from "citty";
|
|
64375
64014
|
registerSchema({
|
|
64376
64015
|
command: "research.web",
|
|
64377
64016
|
description: "Search the web with AI to answer marketing questions \u2014 competitors, ICP, pricing, pain points, market trends. Three depth levels: medium (quick, default), high (thorough), xhigh (exhaustive deep research).",
|
|
@@ -64422,7 +64061,7 @@ async function runDeepResearch(question) {
|
|
|
64422
64061
|
}
|
|
64423
64062
|
throw new Error("Deep research timed out");
|
|
64424
64063
|
}
|
|
64425
|
-
var webCommand =
|
|
64064
|
+
var webCommand = defineCommand195({
|
|
64426
64065
|
meta: {
|
|
64427
64066
|
name: "web",
|
|
64428
64067
|
description: `Search the web with AI to answer any open-ended marketing question. Uses live internet data via Google Search.
|
|
@@ -64484,7 +64123,7 @@ Examples:
|
|
|
64484
64123
|
});
|
|
64485
64124
|
|
|
64486
64125
|
// src/commands/research/index.ts
|
|
64487
|
-
var researchCommand =
|
|
64126
|
+
var researchCommand = defineCommand196({
|
|
64488
64127
|
meta: {
|
|
64489
64128
|
name: "research",
|
|
64490
64129
|
description: `Competitive intelligence and AI-powered research commands.
|
|
@@ -64531,10 +64170,10 @@ Full guide: __tooling__/docs/tools/baker/research.md`
|
|
|
64531
64170
|
});
|
|
64532
64171
|
|
|
64533
64172
|
// src/commands/scheduled-agents/index.ts
|
|
64534
|
-
import { defineCommand as
|
|
64173
|
+
import { defineCommand as defineCommand207 } from "citty";
|
|
64535
64174
|
|
|
64536
64175
|
// src/commands/scheduled-agents/create.ts
|
|
64537
|
-
import { defineCommand as
|
|
64176
|
+
import { defineCommand as defineCommand197 } from "citty";
|
|
64538
64177
|
|
|
64539
64178
|
// src/commands/scheduled-agents/shared.ts
|
|
64540
64179
|
var TEMP_SCHEDULED_AGENT_PREFIX = "temp_agent_";
|
|
@@ -64901,7 +64540,7 @@ registerSchema({
|
|
|
64901
64540
|
}
|
|
64902
64541
|
}
|
|
64903
64542
|
});
|
|
64904
|
-
var createCommand3 =
|
|
64543
|
+
var createCommand3 = defineCommand197({
|
|
64905
64544
|
meta: {
|
|
64906
64545
|
name: "create",
|
|
64907
64546
|
description: 'Stage a scheduled agent. Examples: baker scheduled-agents create --name "Weekly report" --description "..." --prompt "..." --cron "0 9 * * MON" | baker scheduled-agents create --name "Chase a new lead" --description "..." --prompt "Research {{payload.answers.company}} and draft a reply" --trigger form.submitted --form quote | baker scheduled-agents create --name "Big deals" --description "..." --prompt "..." --trigger webhook.received --when "deal.stage = won AND deal.amount > 10000" --times 3'
|
|
@@ -64958,7 +64597,7 @@ var createCommand3 = defineCommand203({
|
|
|
64958
64597
|
});
|
|
64959
64598
|
|
|
64960
64599
|
// src/commands/scheduled-agents/delete.ts
|
|
64961
|
-
import { defineCommand as
|
|
64600
|
+
import { defineCommand as defineCommand198 } from "citty";
|
|
64962
64601
|
registerSchema({
|
|
64963
64602
|
command: "scheduled-agents.delete",
|
|
64964
64603
|
description: "Stage deletion of a published scheduled agent, or cancel one this chat staged (temp_agent_*).",
|
|
@@ -64966,7 +64605,7 @@ registerSchema({
|
|
|
64966
64605
|
id: { type: "string", description: "Published scheduled agent ID or temp_agent_* draft ID", required: true }
|
|
64967
64606
|
}
|
|
64968
64607
|
});
|
|
64969
|
-
var deleteCommand3 =
|
|
64608
|
+
var deleteCommand3 = defineCommand198({
|
|
64970
64609
|
meta: {
|
|
64971
64610
|
name: "delete",
|
|
64972
64611
|
description: "Stage a scheduled agent deletion. Example: baker scheduled-agents delete <id-or-temp_agent_id>"
|
|
@@ -64995,7 +64634,7 @@ var deleteCommand3 = defineCommand204({
|
|
|
64995
64634
|
});
|
|
64996
64635
|
|
|
64997
64636
|
// src/commands/scheduled-agents/get.ts
|
|
64998
|
-
import { defineCommand as
|
|
64637
|
+
import { defineCommand as defineCommand199 } from "citty";
|
|
64999
64638
|
registerSchema({
|
|
65000
64639
|
command: "scheduled-agents.get",
|
|
65001
64640
|
description: "Get a published scheduled agent, or one this chat has staged (temp_agent_*). A published one comes with runsAs: who each run acts as ({ name, personalTools, companyTools, notSignedIn?, toolsOff? }) \u2014 the tools a run loads, which decides whether a job like reading someone's inbox can work. Its recentRuns and any draftOps this chat staged on it come with it.",
|
|
@@ -65004,7 +64643,7 @@ registerSchema({
|
|
|
65004
64643
|
chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
|
|
65005
64644
|
}
|
|
65006
64645
|
});
|
|
65007
|
-
var getCommand4 =
|
|
64646
|
+
var getCommand4 = defineCommand199({
|
|
65008
64647
|
meta: {
|
|
65009
64648
|
name: "get",
|
|
65010
64649
|
description: "Get a scheduled agent. Example: baker scheduled-agents get <id-or-temp_agent_id>"
|
|
@@ -65043,7 +64682,7 @@ var getCommand4 = defineCommand205({
|
|
|
65043
64682
|
});
|
|
65044
64683
|
|
|
65045
64684
|
// src/commands/scheduled-agents/list.ts
|
|
65046
|
-
import { defineCommand as
|
|
64685
|
+
import { defineCommand as defineCommand200 } from "citty";
|
|
65047
64686
|
var FULL_DESCRIPTION = "Return every item and staged change as stored, briefs included (tens of KB). Prefer `get <id>` for one item.";
|
|
65048
64687
|
registerSchema({
|
|
65049
64688
|
command: "scheduled-agents.list",
|
|
@@ -65053,7 +64692,7 @@ registerSchema({
|
|
|
65053
64692
|
full: { type: "boolean", description: FULL_DESCRIPTION, required: false }
|
|
65054
64693
|
}
|
|
65055
64694
|
});
|
|
65056
|
-
var
|
|
64695
|
+
var listCommand17 = defineCommand200({
|
|
65057
64696
|
meta: {
|
|
65058
64697
|
name: "list",
|
|
65059
64698
|
description: "List scheduled agents: id, name, trigger and status for each, plus this chat's staged changes when BAKER_CHAT_ID is set (or --chat <id> for an earlier chat's). Briefs are left out. Start here: baker scheduled-agents list; then baker scheduled-agents get <id> for one item's brief."
|
|
@@ -65079,7 +64718,7 @@ var listCommand18 = defineCommand206({
|
|
|
65079
64718
|
});
|
|
65080
64719
|
|
|
65081
64720
|
// src/commands/scheduled-agents/run.ts
|
|
65082
|
-
import { defineCommand as
|
|
64721
|
+
import { defineCommand as defineCommand201 } from "citty";
|
|
65083
64722
|
registerSchema({
|
|
65084
64723
|
command: "scheduled-agents.run",
|
|
65085
64724
|
description: "Run a published scheduled agent now, whatever its trigger says. Opens a Session immediately and returns its chatId. Does not need BAKER_CHAT_ID, and refuses a temp_agent_* id \u2014 a staged item has to be published before it can run.",
|
|
@@ -65087,7 +64726,7 @@ registerSchema({
|
|
|
65087
64726
|
id: { type: "string", description: "Published scheduled agent ID", required: true }
|
|
65088
64727
|
}
|
|
65089
64728
|
});
|
|
65090
|
-
var runCommand2 =
|
|
64729
|
+
var runCommand2 = defineCommand201({
|
|
65091
64730
|
meta: {
|
|
65092
64731
|
name: "run",
|
|
65093
64732
|
description: "Run a published scheduled agent now. Example: baker scheduled-agents run <id>"
|
|
@@ -65119,7 +64758,7 @@ var runCommand2 = defineCommand207({
|
|
|
65119
64758
|
});
|
|
65120
64759
|
|
|
65121
64760
|
// src/commands/scheduled-agents/targets.ts
|
|
65122
|
-
import { defineCommand as
|
|
64761
|
+
import { defineCommand as defineCommand202 } from "citty";
|
|
65123
64762
|
var ARGS2 = {
|
|
65124
64763
|
trigger: {
|
|
65125
64764
|
type: "string",
|
|
@@ -65153,7 +64792,7 @@ registerSchema({
|
|
|
65153
64792
|
description: "What a trigger can be pointed at: the open Tasks, the company's scheduled agents, its review sources, followed competitors, pages, Forms and their steps, Knowledge collections, tools. Returns each option's value (pass it to the matching flag on create/update) with its name.",
|
|
65154
64793
|
args: ARGS2
|
|
65155
64794
|
});
|
|
65156
|
-
var targetsCommand =
|
|
64795
|
+
var targetsCommand = defineCommand202({
|
|
65157
64796
|
meta: {
|
|
65158
64797
|
name: "targets",
|
|
65159
64798
|
description: `What a trigger can be pointed at \u2014 so "when a Task is picked up" becomes "when THIS Task is picked up".
|
|
@@ -65196,7 +64835,7 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
65196
64835
|
// src/commands/scheduled-agents/templates.ts
|
|
65197
64836
|
import { readFile as readFile32 } from "fs/promises";
|
|
65198
64837
|
import path46 from "path";
|
|
65199
|
-
import { defineCommand as
|
|
64838
|
+
import { defineCommand as defineCommand203 } from "citty";
|
|
65200
64839
|
registerSchema({
|
|
65201
64840
|
command: "scheduled-agents.templates",
|
|
65202
64841
|
description: "The recipes available to this company: the ones Baker ships plus the ones they wrote themselves, each with its id, what it produces and how often it is meant to run. Read this before proposing a company's automation, so every recipe you name is one that exists. Also how a company gets a recipe of its own \u2014 save a brief, prove it runs, then publish it.",
|
|
@@ -65251,7 +64890,7 @@ registerSchema({
|
|
|
65251
64890
|
}
|
|
65252
64891
|
}
|
|
65253
64892
|
});
|
|
65254
|
-
var templatesCommand =
|
|
64893
|
+
var templatesCommand = defineCommand203({
|
|
65255
64894
|
meta: {
|
|
65256
64895
|
name: "templates",
|
|
65257
64896
|
description: `The recipes this company can run \u2014 Baker's own plus theirs, with what each one produces.
|
|
@@ -65347,7 +64986,7 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
65347
64986
|
});
|
|
65348
64987
|
|
|
65349
64988
|
// src/commands/scheduled-agents/triggers.ts
|
|
65350
|
-
import { defineCommand as
|
|
64989
|
+
import { defineCommand as defineCommand204 } from "citty";
|
|
65351
64990
|
var ARGS3 = {
|
|
65352
64991
|
trigger: {
|
|
65353
64992
|
type: "string",
|
|
@@ -65433,7 +65072,7 @@ function shapeTriggerCatalog(response, filter) {
|
|
|
65433
65072
|
}
|
|
65434
65073
|
return { ok: true, data: { groups, reacting: catalog.reacting } };
|
|
65435
65074
|
}
|
|
65436
|
-
var triggersCommand2 =
|
|
65075
|
+
var triggersCommand2 = defineCommand204({
|
|
65437
65076
|
meta: {
|
|
65438
65077
|
name: "triggers",
|
|
65439
65078
|
description: `Everything that can start a scheduled agent.
|
|
@@ -65463,7 +65102,7 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
65463
65102
|
});
|
|
65464
65103
|
|
|
65465
65104
|
// src/commands/scheduled-agents/unstage.ts
|
|
65466
|
-
import { defineCommand as
|
|
65105
|
+
import { defineCommand as defineCommand205 } from "citty";
|
|
65467
65106
|
registerSchema({
|
|
65468
65107
|
command: "scheduled-agents.unstage",
|
|
65469
65108
|
description: "Take back what this chat staged on one scheduled agent, before Publish \u2014 the same as discarding its row in the change list. With --index, only that one change (its `index` in `baker scheduled-agents list` \u2192 draft.ops). Taking back a create also takes back the edits staged on it. Never touches a published item: to change or remove one, stage update/delete instead.",
|
|
@@ -65489,7 +65128,7 @@ function unstageBody(args5, chatId) {
|
|
|
65489
65128
|
}
|
|
65490
65129
|
return { chatId, ref: args5.ref, index };
|
|
65491
65130
|
}
|
|
65492
|
-
var unstageCommand =
|
|
65131
|
+
var unstageCommand = defineCommand205({
|
|
65493
65132
|
meta: {
|
|
65494
65133
|
name: "unstage",
|
|
65495
65134
|
description: "Take back what this chat staged on a scheduled agent, before Publish. Examples: baker scheduled-agents unstage temp_agent_abc123 | baker scheduled-agents unstage <id> --index 2"
|
|
@@ -65520,7 +65159,7 @@ var unstageCommand = defineCommand211({
|
|
|
65520
65159
|
});
|
|
65521
65160
|
|
|
65522
65161
|
// src/commands/scheduled-agents/update.ts
|
|
65523
|
-
import { defineCommand as
|
|
65162
|
+
import { defineCommand as defineCommand206 } from "citty";
|
|
65524
65163
|
registerSchema({
|
|
65525
65164
|
command: "scheduled-agents.update",
|
|
65526
65165
|
description: "Stage an update to a published scheduled agent, or to one this chat staged (temp_agent_*).",
|
|
@@ -65547,7 +65186,7 @@ registerSchema({
|
|
|
65547
65186
|
enabled: { type: "string", description: "Replacement enabled state", required: false, enum: ["true", "false"] }
|
|
65548
65187
|
}
|
|
65549
65188
|
});
|
|
65550
|
-
var updateCommand4 =
|
|
65189
|
+
var updateCommand4 = defineCommand206({
|
|
65551
65190
|
meta: {
|
|
65552
65191
|
name: "update",
|
|
65553
65192
|
description: "Stage a scheduled agent update. Examples: baker scheduled-agents update <id> --enabled false | baker scheduled-agents update <id> --trigger form.submitted --form quote"
|
|
@@ -65618,7 +65257,7 @@ var updateCommand4 = defineCommand212({
|
|
|
65618
65257
|
});
|
|
65619
65258
|
|
|
65620
65259
|
// src/commands/scheduled-agents/index.ts
|
|
65621
|
-
var scheduledAgentsCommand =
|
|
65260
|
+
var scheduledAgentsCommand = defineCommand207({
|
|
65622
65261
|
meta: {
|
|
65623
65262
|
name: "scheduled-agents",
|
|
65624
65263
|
description: `Manage Scheduled agents. Subcommands: list, get, triggers, targets, create, update, delete, unstage, run, templates.
|
|
@@ -65647,7 +65286,7 @@ Examples:
|
|
|
65647
65286
|
Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
65648
65287
|
},
|
|
65649
65288
|
subCommands: {
|
|
65650
|
-
list:
|
|
65289
|
+
list: listCommand17,
|
|
65651
65290
|
get: getCommand4,
|
|
65652
65291
|
triggers: triggersCommand2,
|
|
65653
65292
|
targets: targetsCommand,
|
|
@@ -65661,14 +65300,14 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
65661
65300
|
});
|
|
65662
65301
|
|
|
65663
65302
|
// src/commands/schema.ts
|
|
65664
|
-
import { defineCommand as
|
|
65303
|
+
import { defineCommand as defineCommand208 } from "citty";
|
|
65665
65304
|
function narrowToFamily(commandName, available) {
|
|
65666
65305
|
const segments = commandName.split(".");
|
|
65667
65306
|
const prefix = segments[0] === "ads" && segments[1] ? `ads.${segments[1]}.` : `${segments[0]}.`;
|
|
65668
65307
|
const siblings = available.filter((name) => name.startsWith(prefix));
|
|
65669
65308
|
return siblings.length > 0 ? siblings : available;
|
|
65670
65309
|
}
|
|
65671
|
-
var schemaCommand2 =
|
|
65310
|
+
var schemaCommand2 = defineCommand208({
|
|
65672
65311
|
meta: {
|
|
65673
65312
|
name: "schema",
|
|
65674
65313
|
description: "Inspect command argument schemas (for AI agent introspection). Lists all commands if no argument given. Example: baker schema images search (or images.search)"
|
|
@@ -65713,10 +65352,10 @@ var schemaCommand2 = defineCommand214({
|
|
|
65713
65352
|
});
|
|
65714
65353
|
|
|
65715
65354
|
// src/commands/studio/index.ts
|
|
65716
|
-
import { defineCommand as
|
|
65355
|
+
import { defineCommand as defineCommand217 } from "citty";
|
|
65717
65356
|
|
|
65718
65357
|
// src/commands/studio/animate.ts
|
|
65719
|
-
import { defineCommand as
|
|
65358
|
+
import { defineCommand as defineCommand209 } from "citty";
|
|
65720
65359
|
|
|
65721
65360
|
// src/commands/studio/spokenPace.ts
|
|
65722
65361
|
var WORDS_PER_SECOND3 = SPOKEN_WORDS_PER_SECOND;
|
|
@@ -65942,7 +65581,7 @@ function parseImageRefs(spec) {
|
|
|
65942
65581
|
}
|
|
65943
65582
|
var defaultDeps = {
|
|
65944
65583
|
ingest: (url) => apiPost("/api/images/ingest", { url, source: "uploaded" }),
|
|
65945
|
-
upload: (
|
|
65584
|
+
upload: (path48) => uploadLocalImage({ file: path48, contentType: detectImageContentType(path48), source: "uploaded" })
|
|
65946
65585
|
};
|
|
65947
65586
|
async function resolveLibraryImageIds(spec, limit, deps = defaultDeps) {
|
|
65948
65587
|
const refs = parseImageRefs(spec);
|
|
@@ -65962,10 +65601,10 @@ async function resolveLibraryImageIds(spec, limit, deps = defaultDeps) {
|
|
|
65962
65601
|
}
|
|
65963
65602
|
return { imageIds, added };
|
|
65964
65603
|
}
|
|
65965
|
-
function uploadFailure(
|
|
65604
|
+
function uploadFailure(path48) {
|
|
65966
65605
|
return (error) => {
|
|
65967
65606
|
if (error instanceof ApiError) throw error;
|
|
65968
|
-
throw new ApiError("VALIDATION_ERROR", `Could not read "${
|
|
65607
|
+
throw new ApiError("VALIDATION_ERROR", `Could not read "${path48}" as an image.`);
|
|
65969
65608
|
};
|
|
65970
65609
|
}
|
|
65971
65610
|
|
|
@@ -66229,7 +65868,7 @@ async function adByHandHintFor(body) {
|
|
|
66229
65868
|
return null;
|
|
66230
65869
|
}
|
|
66231
65870
|
}
|
|
66232
|
-
var animateCommand =
|
|
65871
|
+
var animateCommand = defineCommand209({
|
|
66233
65872
|
meta: {
|
|
66234
65873
|
name: "animate",
|
|
66235
65874
|
description: "Render a clip. With an image the look is already fixed, so the prompt describes MOVEMENT \u2014 what the camera does, what the subject does, in what order. With --from text there is no image and the prompt is the whole shot.\n\nA rendered clip is NOT usable anywhere until you keep it: `baker studio keep <id> --slot N` is what puts it in the video library. Takes nobody keeps are never ingested, which is what makes a rejected batch cheap.\n\nFor anything longer than 15 seconds, or to build on footage that already exists, use --model bytedance/seedance-2.5: it renders 4-30s and is the only model that reads an existing clip or an existing soundtrack.\n\nExamples:\n baker studio animate 'slow push in, model turns to camera and smiles' --image j57abc123def456ghi789\n baker studio animate 'she looks to camera and says: \"Hola, soy Elena\"' --avatar elena --quality 720p --aspect-ratio 9:16\n baker studio animate 'handheld drift right, steam rising from the cup' --image './out/hero.png' --duration 6 --quality 1080p\n baker studio animate 'product rotates once on a turntable' --image j57abc\u2026,j57def\u2026 --from references\n baker studio animate 'she keeps walking, camera stays with her, then she stops and looks up' --image j57abc\u2026 --from references --from-clip j57batch\u2026:0 --model bytedance/seedance-2.5 --duration 20\n baker studio animate 'hold on the product, then a slow push-in' --from references --from-video j57vid\u2026 --model bytedance/seedance-2.5\n baker studio animate 'slow drone pull-back over a solar farm at golden hour, no people' --from text --model bytedance/seedance-2.5 --duration 12"
|
|
@@ -66354,7 +65993,7 @@ var animateCommand = defineCommand215({
|
|
|
66354
65993
|
});
|
|
66355
65994
|
|
|
66356
65995
|
// src/commands/studio/generate.ts
|
|
66357
|
-
import { defineCommand as
|
|
65996
|
+
import { defineCommand as defineCommand210 } from "citty";
|
|
66358
65997
|
var MODEL_LIST2 = IMAGE_MODEL_IDS;
|
|
66359
65998
|
var DEFAULT_MAX_WAIT_MS2 = 24e4;
|
|
66360
65999
|
registerSchema({
|
|
@@ -66490,7 +66129,7 @@ function buildGenerateBody(args5, prompt) {
|
|
|
66490
66129
|
}
|
|
66491
66130
|
return body;
|
|
66492
66131
|
}
|
|
66493
|
-
var generateCommand =
|
|
66132
|
+
var generateCommand = defineCommand210({
|
|
66494
66133
|
meta: {
|
|
66495
66134
|
name: "generate",
|
|
66496
66135
|
description: "Start here to make an image. Renders 1-8 takes of one brief, ingests each into the media library as it lands, and shows the batch in the dashboard Studio next to the ones the client ran.\n\nModel choice: google/gemini-3.1-flash-image-preview (default \u2014 fast, best at editing a reference and at extreme ratios), google/gemini-3-pro-image-preview (highest fidelity, slower), openai/gpt-image-2 (photoreal and the cleanest in-image text \u2014 no --image-size, no 4:5 / 5:4), recraft/recraft-v4.1-pro-vector (vector/flat marks with palette control).\n\n--reference is the biggest quality lever there is: a real logo, product shot, Pinterest pin or sandbox screenshot beats any amount of adjectives.\n\nExamples:\n baker studio generate 'matte black bottle on wet marble, hard studio light, 35mm' --aspect-ratio 3:2 --count 3\n baker studio generate 'this bottle on a sunlit kitchen counter' --reference './src/brand/product.png,https://\u2026/kitchen.jpg'\n baker studio generate 'founder-style selfie, kitchen background, natural light' --skill ugc-selfie-hook\n baker studio generate 'flat geometric mascot, brand palette' --model recraft/recraft-v4.1-pro-vector --rgb-colors '[[10,10,10],[255,80,0]]'"
|
|
@@ -66573,7 +66212,7 @@ var generateCommand = defineCommand216({
|
|
|
66573
66212
|
});
|
|
66574
66213
|
|
|
66575
66214
|
// src/commands/studio/get.ts
|
|
66576
|
-
import { defineCommand as
|
|
66215
|
+
import { defineCommand as defineCommand211 } from "citty";
|
|
66577
66216
|
registerSchema({
|
|
66578
66217
|
command: "studio.get",
|
|
66579
66218
|
description: "Read one Studio batch: every take, where it lives, and why a take is missing. This is how you pick up a batch that was still rendering when the start command returned.",
|
|
@@ -66582,7 +66221,7 @@ registerSchema({
|
|
|
66582
66221
|
full: { type: "boolean", description: "Include settings, references and attribution", required: false }
|
|
66583
66222
|
}
|
|
66584
66223
|
});
|
|
66585
|
-
var getCommand5 =
|
|
66224
|
+
var getCommand5 = defineCommand211({
|
|
66586
66225
|
meta: {
|
|
66587
66226
|
name: "get",
|
|
66588
66227
|
description: "Read one Studio batch \u2014 the takes, their urls, whether each is in the library, and the reason for any that failed.\n\nExample: baker studio get j57abc123def456ghi789\nExample: baker studio get j57abc123def456ghi789 --full"
|
|
@@ -66611,7 +66250,7 @@ var getCommand5 = defineCommand217({
|
|
|
66611
66250
|
});
|
|
66612
66251
|
|
|
66613
66252
|
// src/commands/studio/improve.ts
|
|
66614
|
-
import { defineCommand as
|
|
66253
|
+
import { defineCommand as defineCommand212 } from "citty";
|
|
66615
66254
|
var DESCRIPTION2 = "Sharpen a rough brief into directed art direction \u2014 the same rewrite the client gets from the wand in the Studio prompt bar. Reach for it when you are relaying the CLIENT's own words and want them shaped without substituting your voice; when you are writing the art direction yourself, just write it, because you will do a better job than this does.";
|
|
66616
66255
|
registerSchema({
|
|
66617
66256
|
command: "studio.improve",
|
|
@@ -66636,7 +66275,7 @@ registerSchema({
|
|
|
66636
66275
|
}
|
|
66637
66276
|
}
|
|
66638
66277
|
});
|
|
66639
|
-
var improveCommand =
|
|
66278
|
+
var improveCommand = defineCommand212({
|
|
66640
66279
|
meta: {
|
|
66641
66280
|
name: "improve",
|
|
66642
66281
|
description: `${DESCRIPTION2}
|
|
@@ -66680,7 +66319,7 @@ Examples:
|
|
|
66680
66319
|
});
|
|
66681
66320
|
|
|
66682
66321
|
// src/commands/studio/keep.ts
|
|
66683
|
-
import { defineCommand as
|
|
66322
|
+
import { defineCommand as defineCommand213 } from "citty";
|
|
66684
66323
|
registerSchema({
|
|
66685
66324
|
command: "studio.keep",
|
|
66686
66325
|
description: "Mark one take as the keeper. For an image this stars it, so the client reviewing the batch sees which one you used. For a CLIP it is the step that puts it in the video library \u2014 until then the clip cannot be used in a canvas, a landing, or an ad.",
|
|
@@ -66690,7 +66329,7 @@ registerSchema({
|
|
|
66690
66329
|
undo: { type: "boolean", description: "Un-star an image, or take a kept clip back out", required: false }
|
|
66691
66330
|
}
|
|
66692
66331
|
});
|
|
66693
|
-
var keepCommand =
|
|
66332
|
+
var keepCommand = defineCommand213({
|
|
66694
66333
|
meta: {
|
|
66695
66334
|
name: "keep",
|
|
66696
66335
|
description: "Mark one take as the keeper. An image gets starred (it was already in the library); a clip gets INGESTED into the video library, which is what makes it usable anywhere else.\n\nExample: baker studio keep j57abc123def456ghi789 --slot 2\nExample: baker studio keep j57abc123def456ghi789 --slot 2 --undo"
|
|
@@ -66741,7 +66380,7 @@ var keepCommand = defineCommand219({
|
|
|
66741
66380
|
});
|
|
66742
66381
|
|
|
66743
66382
|
// src/commands/studio/list.ts
|
|
66744
|
-
import { defineCommand as
|
|
66383
|
+
import { defineCommand as defineCommand214 } from "citty";
|
|
66745
66384
|
registerSchema({
|
|
66746
66385
|
command: "studio.list",
|
|
66747
66386
|
description: "Recent Studio batches for THIS conversation, newest first \u2014 what you have already generated, so you re-use a take instead of paying for it twice. `--all` widens it to everything the company generated, including what people ran themselves in the dashboard.",
|
|
@@ -66752,7 +66391,7 @@ registerSchema({
|
|
|
66752
66391
|
full: { type: "boolean", description: "Include settings, references and attribution", required: false }
|
|
66753
66392
|
}
|
|
66754
66393
|
});
|
|
66755
|
-
var
|
|
66394
|
+
var listCommand18 = defineCommand214({
|
|
66756
66395
|
meta: {
|
|
66757
66396
|
name: "list",
|
|
66758
66397
|
description: "Recent Studio batches, newest first. Scoped to this conversation unless you pass --all.\n\nExample: baker studio list\nExample: baker studio list --kind video --limit 5\nExample: baker studio list --all # includes batches the client ran in the dashboard"
|
|
@@ -66786,7 +66425,7 @@ var listCommand19 = defineCommand220({
|
|
|
66786
66425
|
});
|
|
66787
66426
|
|
|
66788
66427
|
// src/commands/studio/models.ts
|
|
66789
|
-
import { defineCommand as
|
|
66428
|
+
import { defineCommand as defineCommand215 } from "citty";
|
|
66790
66429
|
var DESCRIPTION3 = "What each Studio model actually accepts: its shapes, resolutions, clip lengths, prompt character cap, how many reference images it takes, and which knobs it has. Read this before a batch you care about \u2014 the models disagree far more than they look like they do, and a setting the chosen model does not have is REFUSED, not ignored.";
|
|
66791
66430
|
registerSchema({
|
|
66792
66431
|
command: "studio.models",
|
|
@@ -66873,7 +66512,7 @@ function buildModelCards(kind, model) {
|
|
|
66873
66512
|
const selected = model ? ids.filter((id) => id === model) : ids;
|
|
66874
66513
|
return selected.map((id) => build(id));
|
|
66875
66514
|
}
|
|
66876
|
-
var modelsCommand =
|
|
66515
|
+
var modelsCommand = defineCommand215({
|
|
66877
66516
|
meta: {
|
|
66878
66517
|
name: "models",
|
|
66879
66518
|
description: `${DESCRIPTION3}
|
|
@@ -66920,13 +66559,13 @@ Examples:
|
|
|
66920
66559
|
});
|
|
66921
66560
|
|
|
66922
66561
|
// src/commands/studio/skills.ts
|
|
66923
|
-
import { defineCommand as
|
|
66562
|
+
import { defineCommand as defineCommand216 } from "citty";
|
|
66924
66563
|
registerSchema({
|
|
66925
66564
|
command: "studio.skills",
|
|
66926
66565
|
description: "The craft directions `studio generate --skill <id>` accepts. Each one carries directed art direction plus the model, shape and take count it wants, so you pick a look by name instead of writing the boilerplate yourself.",
|
|
66927
66566
|
args: {}
|
|
66928
66567
|
});
|
|
66929
|
-
var skillsCommand =
|
|
66568
|
+
var skillsCommand = defineCommand216({
|
|
66930
66569
|
meta: {
|
|
66931
66570
|
name: "skills",
|
|
66932
66571
|
description: "List the craft directions available to `baker studio generate --skill <id>` \u2014 what each one is for, whether it wants a reference image, and the model/shape/count it defaults to.\n\nExample: baker studio skills"
|
|
@@ -66950,7 +66589,7 @@ var skillsCommand = defineCommand222({
|
|
|
66950
66589
|
});
|
|
66951
66590
|
|
|
66952
66591
|
// src/commands/studio/index.ts
|
|
66953
|
-
var studioCommand =
|
|
66592
|
+
var studioCommand = defineCommand217({
|
|
66954
66593
|
meta: {
|
|
66955
66594
|
name: "studio",
|
|
66956
66595
|
description: `Make new imagery and clips. Every batch is recorded and shows up in the dashboard Studio for the client to review, labelled with this conversation.
|
|
@@ -66984,7 +66623,7 @@ Full guide: __tooling__/docs/tools/baker/studio.md`
|
|
|
66984
66623
|
generate: generateCommand,
|
|
66985
66624
|
animate: animateCommand,
|
|
66986
66625
|
get: getCommand5,
|
|
66987
|
-
list:
|
|
66626
|
+
list: listCommand18,
|
|
66988
66627
|
keep: keepCommand,
|
|
66989
66628
|
models: modelsCommand,
|
|
66990
66629
|
skills: skillsCommand,
|
|
@@ -66993,10 +66632,10 @@ Full guide: __tooling__/docs/tools/baker/studio.md`
|
|
|
66993
66632
|
});
|
|
66994
66633
|
|
|
66995
66634
|
// src/commands/tag-manager/index.ts
|
|
66996
|
-
import { defineCommand as
|
|
66635
|
+
import { defineCommand as defineCommand221 } from "citty";
|
|
66997
66636
|
|
|
66998
66637
|
// src/commands/tag-manager/draft.ts
|
|
66999
|
-
import { defineCommand as
|
|
66638
|
+
import { defineCommand as defineCommand218 } from "citty";
|
|
67000
66639
|
|
|
67001
66640
|
// src/commands/tag-manager/shared.ts
|
|
67002
66641
|
import { readFileSync as readFileSync21 } from "fs";
|
|
@@ -67063,10 +66702,10 @@ async function stageOp4(op) {
|
|
|
67063
66702
|
handleError8(err);
|
|
67064
66703
|
}
|
|
67065
66704
|
}
|
|
67066
|
-
async function draftAction3(
|
|
66705
|
+
async function draftAction3(path48, body, chat) {
|
|
67067
66706
|
const chatId = resolveChatId(chat);
|
|
67068
66707
|
try {
|
|
67069
|
-
const data = await apiPost(
|
|
66708
|
+
const data = await apiPost(path48, { chatId, ...body });
|
|
67070
66709
|
writeJsonEnvelope({ ok: true, data });
|
|
67071
66710
|
return data;
|
|
67072
66711
|
} catch (err) {
|
|
@@ -67119,13 +66758,13 @@ registerSchema({
|
|
|
67119
66758
|
chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
|
|
67120
66759
|
}
|
|
67121
66760
|
});
|
|
67122
|
-
var draftCommand5 =
|
|
66761
|
+
var draftCommand5 = defineCommand218({
|
|
67123
66762
|
meta: {
|
|
67124
66763
|
name: "draft",
|
|
67125
66764
|
description: "List, show, amend, remove, or clear staged Tag Manager changes for this chat. `list` and `show` take --chat <id> to read an earlier chat's changes instead."
|
|
67126
66765
|
},
|
|
67127
66766
|
subCommands: {
|
|
67128
|
-
list:
|
|
66767
|
+
list: defineCommand218({
|
|
67129
66768
|
meta: {
|
|
67130
66769
|
name: "list",
|
|
67131
66770
|
description: "Review everything staged on this chat (--json for the raw envelope)"
|
|
@@ -67138,7 +66777,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67138
66777
|
await draftList2(args5.json === true, args5.chat);
|
|
67139
66778
|
}
|
|
67140
66779
|
}),
|
|
67141
|
-
show:
|
|
66780
|
+
show: defineCommand218({
|
|
67142
66781
|
meta: {
|
|
67143
66782
|
name: "show",
|
|
67144
66783
|
description: "Print the full staged payload for one change \u2014 the receipt to verify it looks right before publish (never truncated)."
|
|
@@ -67155,7 +66794,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67155
66794
|
);
|
|
67156
66795
|
}
|
|
67157
66796
|
}),
|
|
67158
|
-
amend:
|
|
66797
|
+
amend: defineCommand218({
|
|
67159
66798
|
meta: {
|
|
67160
66799
|
name: "amend",
|
|
67161
66800
|
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."
|
|
@@ -67172,7 +66811,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67172
66811
|
});
|
|
67173
66812
|
}
|
|
67174
66813
|
}),
|
|
67175
|
-
remove:
|
|
66814
|
+
remove: defineCommand218({
|
|
67176
66815
|
meta: { name: "remove", description: "Remove one staged change (cascades to anything depending on it)" },
|
|
67177
66816
|
args: { ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false } },
|
|
67178
66817
|
run: async ({ args: args5 }) => {
|
|
@@ -67181,7 +66820,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67181
66820
|
});
|
|
67182
66821
|
}
|
|
67183
66822
|
}),
|
|
67184
|
-
clear:
|
|
66823
|
+
clear: defineCommand218({
|
|
67185
66824
|
meta: { name: "clear", description: "Discard all Tag Manager changes staged on this chat" },
|
|
67186
66825
|
run: async () => {
|
|
67187
66826
|
await draftAction3("/api/tag-manager/draft/clear", {});
|
|
@@ -67191,7 +66830,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67191
66830
|
});
|
|
67192
66831
|
|
|
67193
66832
|
// src/commands/tag-manager/read.ts
|
|
67194
|
-
import { defineCommand as
|
|
66833
|
+
import { defineCommand as defineCommand219 } from "citty";
|
|
67195
66834
|
registerSchema({
|
|
67196
66835
|
command: "tagManager.containers",
|
|
67197
66836
|
description: "List the Google Tag Manager containers this company's connection can reach. Every container the company connected is flagged `connected: true` \u2014 there can be several, and Baker may read and change all of them. Start here to confirm which containers you are managing.",
|
|
@@ -67232,7 +66871,7 @@ function containersHints(containers) {
|
|
|
67232
66871
|
}))
|
|
67233
66872
|
});
|
|
67234
66873
|
}
|
|
67235
|
-
var containersCommand =
|
|
66874
|
+
var containersCommand = defineCommand219({
|
|
67236
66875
|
meta: {
|
|
67237
66876
|
name: "containers",
|
|
67238
66877
|
description: `List Tag Manager containers reachable by this company's connection.
|
|
@@ -67249,7 +66888,7 @@ Start here:
|
|
|
67249
66888
|
}
|
|
67250
66889
|
}
|
|
67251
66890
|
});
|
|
67252
|
-
var readCommand =
|
|
66891
|
+
var readCommand = defineCommand219({
|
|
67253
66892
|
meta: {
|
|
67254
66893
|
name: "read",
|
|
67255
66894
|
description: `Read the current contents of the Tag Manager container \u2014 always do this before staging changes.
|
|
@@ -67291,7 +66930,7 @@ Examples:
|
|
|
67291
66930
|
});
|
|
67292
66931
|
|
|
67293
66932
|
// src/commands/tag-manager/write-commands.ts
|
|
67294
|
-
import { defineCommand as
|
|
66933
|
+
import { defineCommand as defineCommand220 } from "citty";
|
|
67295
66934
|
var CONTAINER_ARG_DESCRIPTION = "Numeric container id (optional only when one container is connected \u2014 run `baker tag-manager containers`)";
|
|
67296
66935
|
var ENTITIES = [
|
|
67297
66936
|
{
|
|
@@ -67347,10 +66986,10 @@ for (const { entity, noun, createHint } of ENTITIES) {
|
|
|
67347
66986
|
});
|
|
67348
66987
|
}
|
|
67349
66988
|
function entityCommand(entity, noun, example) {
|
|
67350
|
-
return
|
|
66989
|
+
return defineCommand220({
|
|
67351
66990
|
meta: { name: entity, description: `Stage ${noun} changes on this chat's Tag Manager draft` },
|
|
67352
66991
|
subCommands: {
|
|
67353
|
-
create:
|
|
66992
|
+
create: defineCommand220({
|
|
67354
66993
|
meta: {
|
|
67355
66994
|
name: "create",
|
|
67356
66995
|
description: `Stage a new ${noun}
|
|
@@ -67372,7 +67011,7 @@ Examples:
|
|
|
67372
67011
|
});
|
|
67373
67012
|
}
|
|
67374
67013
|
}),
|
|
67375
|
-
update:
|
|
67014
|
+
update: defineCommand220({
|
|
67376
67015
|
meta: {
|
|
67377
67016
|
name: "update",
|
|
67378
67017
|
description: `Stage an update to an existing ${noun} (pass its id or path)`
|
|
@@ -67392,7 +67031,7 @@ Examples:
|
|
|
67392
67031
|
});
|
|
67393
67032
|
}
|
|
67394
67033
|
}),
|
|
67395
|
-
delete:
|
|
67034
|
+
delete: defineCommand220({
|
|
67396
67035
|
meta: { name: "delete", description: `Stage the deletion of a ${noun} (pass its id or path)` },
|
|
67397
67036
|
args: {
|
|
67398
67037
|
id: { type: "positional", description: `${noun} id or path`, required: false },
|
|
@@ -67433,7 +67072,7 @@ function builtinTypes(args5) {
|
|
|
67433
67072
|
}
|
|
67434
67073
|
return raw.split(",").map((entry) => entry.trim());
|
|
67435
67074
|
}
|
|
67436
|
-
var builtinCommand =
|
|
67075
|
+
var builtinCommand = defineCommand220({
|
|
67437
67076
|
meta: {
|
|
67438
67077
|
name: "builtin",
|
|
67439
67078
|
description: `Enable or disable built-in variables
|
|
@@ -67443,7 +67082,7 @@ Examples:
|
|
|
67443
67082
|
baker tag-manager builtin disable --types formId`
|
|
67444
67083
|
},
|
|
67445
67084
|
subCommands: {
|
|
67446
|
-
enable:
|
|
67085
|
+
enable: defineCommand220({
|
|
67447
67086
|
meta: { name: "enable", description: "Stage enabling built-in variables" },
|
|
67448
67087
|
args: {
|
|
67449
67088
|
types: { type: "string", description: "Comma-separated types", required: false },
|
|
@@ -67457,7 +67096,7 @@ Examples:
|
|
|
67457
67096
|
});
|
|
67458
67097
|
}
|
|
67459
67098
|
}),
|
|
67460
|
-
disable:
|
|
67099
|
+
disable: defineCommand220({
|
|
67461
67100
|
meta: { name: "disable", description: "Stage disabling built-in variables" },
|
|
67462
67101
|
args: {
|
|
67463
67102
|
types: { type: "string", description: "Comma-separated types", required: false },
|
|
@@ -67475,7 +67114,7 @@ Examples:
|
|
|
67475
67114
|
});
|
|
67476
67115
|
|
|
67477
67116
|
// src/commands/tag-manager/index.ts
|
|
67478
|
-
var tagManagerCommand =
|
|
67117
|
+
var tagManagerCommand = defineCommand221({
|
|
67479
67118
|
meta: {
|
|
67480
67119
|
name: "tag-manager",
|
|
67481
67120
|
description: `Read and change what lives inside the client's Google Tag Manager container \u2014 tags, triggers, variables, folders and built-in variables.
|
|
@@ -67512,7 +67151,7 @@ Full guide: __tooling__/docs/tools/baker/tag-manager.md`
|
|
|
67512
67151
|
});
|
|
67513
67152
|
|
|
67514
67153
|
// src/commands/tags/index.ts
|
|
67515
|
-
import { defineCommand as
|
|
67154
|
+
import { defineCommand as defineCommand222 } from "citty";
|
|
67516
67155
|
|
|
67517
67156
|
// src/commands/tags/shared.ts
|
|
67518
67157
|
function failApi3(err) {
|
|
@@ -67592,7 +67231,7 @@ async function listTags(json) {
|
|
|
67592
67231
|
var listArgs12 = {
|
|
67593
67232
|
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" }
|
|
67594
67233
|
};
|
|
67595
|
-
var
|
|
67234
|
+
var listCommand19 = defineCommand222({
|
|
67596
67235
|
meta: {
|
|
67597
67236
|
name: "list",
|
|
67598
67237
|
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"
|
|
@@ -67611,7 +67250,7 @@ async function listDraft4(chat) {
|
|
|
67611
67250
|
failApi3(err);
|
|
67612
67251
|
}
|
|
67613
67252
|
}
|
|
67614
|
-
var draftCommand6 =
|
|
67253
|
+
var draftCommand6 = defineCommand222({
|
|
67615
67254
|
meta: {
|
|
67616
67255
|
name: "draft",
|
|
67617
67256
|
description: "Review the tag changes staged in this chat (read-only). Staged changes were approved via request_tag_input and apply when the chat is published; to amend or drop one, propose a follow-up change through the same tool (a delete on a tag_temp_* ref drops the staged create). Takes --chat <id> to read an earlier chat's staged changes instead."
|
|
@@ -67621,7 +67260,7 @@ var draftCommand6 = defineCommand228({
|
|
|
67621
67260
|
await listDraft4(args5.chat);
|
|
67622
67261
|
}
|
|
67623
67262
|
});
|
|
67624
|
-
var tagsCommand4 =
|
|
67263
|
+
var tagsCommand4 = defineCommand222({
|
|
67625
67264
|
meta: {
|
|
67626
67265
|
name: "tags",
|
|
67627
67266
|
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.
|
|
@@ -67638,7 +67277,7 @@ Examples:
|
|
|
67638
67277
|
Full guide: __tooling__/docs/tools/baker/tags.md`
|
|
67639
67278
|
},
|
|
67640
67279
|
subCommands: {
|
|
67641
|
-
list:
|
|
67280
|
+
list: listCommand19,
|
|
67642
67281
|
draft: draftCommand6
|
|
67643
67282
|
},
|
|
67644
67283
|
// Bare `baker tags` lists the effective tags. `args` stays so citty knows this
|
|
@@ -67650,10 +67289,10 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
|
|
|
67650
67289
|
});
|
|
67651
67290
|
|
|
67652
67291
|
// src/commands/testimonials/index.ts
|
|
67653
|
-
import { defineCommand as
|
|
67292
|
+
import { defineCommand as defineCommand226 } from "citty";
|
|
67654
67293
|
|
|
67655
67294
|
// src/commands/testimonials/get.ts
|
|
67656
|
-
import { defineCommand as
|
|
67295
|
+
import { defineCommand as defineCommand223 } from "citty";
|
|
67657
67296
|
registerSchema({
|
|
67658
67297
|
command: "testimonials.get",
|
|
67659
67298
|
description: "Get a single testimonial by ID",
|
|
@@ -67661,7 +67300,7 @@ registerSchema({
|
|
|
67661
67300
|
id: { type: "string", description: "Testimonial ID", required: true }
|
|
67662
67301
|
}
|
|
67663
67302
|
});
|
|
67664
|
-
var getCommand6 =
|
|
67303
|
+
var getCommand6 = defineCommand223({
|
|
67665
67304
|
meta: { name: "get", description: "Get a single testimonial by ID. Example: baker testimonials get j571abc123" },
|
|
67666
67305
|
args: {
|
|
67667
67306
|
id: { type: "positional", description: "Testimonial ID", required: false },
|
|
@@ -67698,7 +67337,7 @@ var getCommand6 = defineCommand229({
|
|
|
67698
67337
|
});
|
|
67699
67338
|
|
|
67700
67339
|
// src/commands/testimonials/list.ts
|
|
67701
|
-
import { defineCommand as
|
|
67340
|
+
import { defineCommand as defineCommand224 } from "citty";
|
|
67702
67341
|
|
|
67703
67342
|
// src/commands/testimonials/emptyCorpusHints.ts
|
|
67704
67343
|
function resolveEmptyReason({
|
|
@@ -67855,7 +67494,7 @@ function buildListParams(args5) {
|
|
|
67855
67494
|
}
|
|
67856
67495
|
return params;
|
|
67857
67496
|
}
|
|
67858
|
-
var
|
|
67497
|
+
var listCommand20 = defineCommand224({
|
|
67859
67498
|
meta: {
|
|
67860
67499
|
name: "list",
|
|
67861
67500
|
description: "List testimonials with optional filters. Example: baker testimonials list --source google --sentiment positive"
|
|
@@ -67915,7 +67554,7 @@ var listCommand21 = defineCommand230({
|
|
|
67915
67554
|
});
|
|
67916
67555
|
|
|
67917
67556
|
// src/commands/testimonials/search.ts
|
|
67918
|
-
import { defineCommand as
|
|
67557
|
+
import { defineCommand as defineCommand225 } from "citty";
|
|
67919
67558
|
var FILTER_FLAGS2 = ["source", "rating-min", "rating-max", "status", "sentiment", "language", "tags"];
|
|
67920
67559
|
function languageBiasHint(results, requestedLanguage) {
|
|
67921
67560
|
if (requestedLanguage) {
|
|
@@ -67994,7 +67633,7 @@ function buildSearchRequest(query, args5) {
|
|
|
67994
67633
|
}
|
|
67995
67634
|
return body;
|
|
67996
67635
|
}
|
|
67997
|
-
var searchCommand3 =
|
|
67636
|
+
var searchCommand3 = defineCommand225({
|
|
67998
67637
|
meta: {
|
|
67999
67638
|
name: "search",
|
|
68000
67639
|
description: "Semantic search testimonials by text query. Uses hybrid BM25 + vector + reranking. Example: baker testimonials search 'great service' --rating-min 4"
|
|
@@ -68058,7 +67697,7 @@ var searchCommand3 = defineCommand231({
|
|
|
68058
67697
|
var tagsCommand5 = makeTagsCommand("testimonials", "testimonial", "/api/testimonials/tags");
|
|
68059
67698
|
|
|
68060
67699
|
// src/commands/testimonials/index.ts
|
|
68061
|
-
var testimonialsCommand =
|
|
67700
|
+
var testimonialsCommand = defineCommand226({
|
|
68062
67701
|
meta: {
|
|
68063
67702
|
name: "testimonials",
|
|
68064
67703
|
description: `Find and browse testimonials in Baker. Subcommands: search, get, list, tags.
|
|
@@ -68074,16 +67713,16 @@ Full guide: __tooling__/docs/tools/baker/testimonials.md`
|
|
|
68074
67713
|
subCommands: {
|
|
68075
67714
|
get: getCommand6,
|
|
68076
67715
|
search: searchCommand3,
|
|
68077
|
-
list:
|
|
67716
|
+
list: listCommand20,
|
|
68078
67717
|
tags: tagsCommand5
|
|
68079
67718
|
}
|
|
68080
67719
|
});
|
|
68081
67720
|
|
|
68082
67721
|
// src/commands/videos/index.ts
|
|
68083
|
-
import { defineCommand as
|
|
67722
|
+
import { defineCommand as defineCommand234 } from "citty";
|
|
68084
67723
|
|
|
68085
67724
|
// src/commands/videos/delete.ts
|
|
68086
|
-
import { defineCommand as
|
|
67725
|
+
import { defineCommand as defineCommand227 } from "citty";
|
|
68087
67726
|
registerSchema({
|
|
68088
67727
|
command: "videos.delete",
|
|
68089
67728
|
description: "Delete a video by ID",
|
|
@@ -68097,7 +67736,7 @@ registerSchema({
|
|
|
68097
67736
|
}
|
|
68098
67737
|
}
|
|
68099
67738
|
});
|
|
68100
|
-
var deleteCommand4 =
|
|
67739
|
+
var deleteCommand4 = defineCommand227({
|
|
68101
67740
|
meta: {
|
|
68102
67741
|
name: "delete",
|
|
68103
67742
|
description: "Delete a video by ID. Use --dry-run to preview. Example: baker videos delete j571abc123 --dry-run"
|
|
@@ -68138,7 +67777,7 @@ var deleteCommand4 = defineCommand233({
|
|
|
68138
67777
|
});
|
|
68139
67778
|
|
|
68140
67779
|
// src/commands/videos/describe.ts
|
|
68141
|
-
import { defineCommand as
|
|
67780
|
+
import { defineCommand as defineCommand228 } from "citty";
|
|
68142
67781
|
var DESCRIPTION_HELP2 = "What the clip actually shows, in the words someone would search for it by. This is what `baker videos search` retrieves on.";
|
|
68143
67782
|
registerSchema({
|
|
68144
67783
|
command: "videos.describe",
|
|
@@ -68155,7 +67794,7 @@ registerSchema({
|
|
|
68155
67794
|
full: { type: "boolean", description: "Return the whole library row, not just what changed", required: false }
|
|
68156
67795
|
}
|
|
68157
67796
|
});
|
|
68158
|
-
var describeCommand2 =
|
|
67797
|
+
var describeCommand2 = defineCommand228({
|
|
68159
67798
|
meta: {
|
|
68160
67799
|
name: "describe",
|
|
68161
67800
|
description: `Correct what the library says a video is. Only the fields you pass change; the rest keep their current values.
|
|
@@ -68212,10 +67851,108 @@ Example: baker videos describe j571abc123 --description "Customer explaining how
|
|
|
68212
67851
|
}
|
|
68213
67852
|
});
|
|
68214
67853
|
|
|
68215
|
-
// src/commands/videos/
|
|
68216
|
-
import {
|
|
67854
|
+
// src/commands/videos/get.ts
|
|
67855
|
+
import { defineCommand as defineCommand229 } from "citty";
|
|
67856
|
+
registerSchema({
|
|
67857
|
+
command: "videos.get",
|
|
67858
|
+
description: "Get a single video by ID",
|
|
67859
|
+
args: {
|
|
67860
|
+
id: { type: "string", description: "Video ID", required: true }
|
|
67861
|
+
}
|
|
67862
|
+
});
|
|
67863
|
+
var getCommand7 = defineCommand229({
|
|
67864
|
+
meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
|
|
67865
|
+
args: {
|
|
67866
|
+
id: { type: "positional", description: "Video ID", required: false },
|
|
67867
|
+
"video-id": { type: "string", description: "Video ID (alternative to positional)", required: false },
|
|
67868
|
+
output: { type: "string", description: "Output format: json|files|md", required: false, default: "json" },
|
|
67869
|
+
fields: { type: "string", description: "Comma-separated field names to include", required: false },
|
|
67870
|
+
full: { type: "boolean", description: "Include full metadata", required: false, default: false }
|
|
67871
|
+
},
|
|
67872
|
+
run: async ({ args: args5 }) => {
|
|
67873
|
+
try {
|
|
67874
|
+
const id = args5.id || args5["video-id"];
|
|
67875
|
+
if (!id) {
|
|
67876
|
+
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message: "Video ID is required" } });
|
|
67877
|
+
process.exit(1);
|
|
67878
|
+
}
|
|
67879
|
+
validateConvexId(id);
|
|
67880
|
+
const data = await apiGet("/api/videos/get", { id });
|
|
67881
|
+
writeOutput(
|
|
67882
|
+
{ ok: true, data },
|
|
67883
|
+
args5.output || "json",
|
|
67884
|
+
args5.fields ? args5.fields.split(",") : void 0,
|
|
67885
|
+
args5.full,
|
|
67886
|
+
videoNormalizer
|
|
67887
|
+
);
|
|
67888
|
+
} catch (err) {
|
|
67889
|
+
if (err instanceof ApiError) {
|
|
67890
|
+
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
67891
|
+
process.exit(1);
|
|
67892
|
+
}
|
|
67893
|
+
writeJson({ ok: false, error: { code: "INTERNAL_ERROR", message: "Unexpected error" } });
|
|
67894
|
+
process.exit(1);
|
|
67895
|
+
}
|
|
67896
|
+
}
|
|
67897
|
+
});
|
|
67898
|
+
|
|
67899
|
+
// src/commands/videos/group.ts
|
|
67900
|
+
import { defineCommand as defineCommand230 } from "citty";
|
|
67901
|
+
registerSchema({
|
|
67902
|
+
command: "videos.group",
|
|
67903
|
+
description: "List every clip and image that arrived in the same set as this video (carousel slides, one page)",
|
|
67904
|
+
args: {
|
|
67905
|
+
id: { type: "string", description: "A video or image id \u2014 returns that asset's whole set", required: false },
|
|
67906
|
+
"group-key": { type: "string", description: "The set key directly, when you already have it", required: false }
|
|
67907
|
+
}
|
|
67908
|
+
});
|
|
67909
|
+
var groupCommand2 = defineCommand230({
|
|
67910
|
+
meta: {
|
|
67911
|
+
name: "group",
|
|
67912
|
+
description: "List every asset that arrived in the same set as this clip \u2014 the other slides of the Instagram post it came from, stills included. A carousel is authored to be read in order, so a clip pulled out of one is usually missing half its meaning. Example: baker videos group <videoId>"
|
|
67913
|
+
},
|
|
67914
|
+
args: {
|
|
67915
|
+
id: { type: "positional", description: "A video or image id from the set", required: false },
|
|
67916
|
+
"group-key": { type: "string", description: "The set key, if you already have it", required: false }
|
|
67917
|
+
},
|
|
67918
|
+
run: async ({ args: args5 }) => {
|
|
67919
|
+
await runMediaGroupLookup({
|
|
67920
|
+
id: args5.id,
|
|
67921
|
+
groupKey: args5["group-key"],
|
|
67922
|
+
path: "/api/videos/group",
|
|
67923
|
+
idLabel: "a video or image id"
|
|
67924
|
+
});
|
|
67925
|
+
}
|
|
67926
|
+
});
|
|
67927
|
+
|
|
67928
|
+
// src/commands/videos/ingest.ts
|
|
67929
|
+
import { mkdtemp as mkdtemp3, rm as rm9, stat as stat11 } from "fs/promises";
|
|
67930
|
+
import { tmpdir as tmpdir4 } from "os";
|
|
68217
67931
|
import path47 from "path";
|
|
68218
|
-
import { defineCommand as
|
|
67932
|
+
import { defineCommand as defineCommand231 } from "citty";
|
|
67933
|
+
|
|
67934
|
+
// src/lib/streamUpload.ts
|
|
67935
|
+
import { createHash as createHash2 } from "crypto";
|
|
67936
|
+
import { createReadStream } from "fs";
|
|
67937
|
+
import { Readable } from "stream";
|
|
67938
|
+
import { pipeline } from "stream/promises";
|
|
67939
|
+
async function hashFile(filePath) {
|
|
67940
|
+
const hash = createHash2("sha256");
|
|
67941
|
+
await pipeline(createReadStream(filePath), hash);
|
|
67942
|
+
return hash.digest("hex");
|
|
67943
|
+
}
|
|
67944
|
+
async function putFileStreamed(args5) {
|
|
67945
|
+
const body = Readable.toWeb(createReadStream(args5.filePath));
|
|
67946
|
+
return await fetch(args5.putUrl, {
|
|
67947
|
+
method: "PUT",
|
|
67948
|
+
body,
|
|
67949
|
+
headers: {
|
|
67950
|
+
"Content-Type": args5.contentType,
|
|
67951
|
+
"Content-Length": String(args5.sizeBytes)
|
|
67952
|
+
},
|
|
67953
|
+
duplex: "half"
|
|
67954
|
+
});
|
|
67955
|
+
}
|
|
68219
67956
|
|
|
68220
67957
|
// src/commands/videos/videoPlatforms.ts
|
|
68221
67958
|
var PLATFORM_DOMAINS = {
|
|
@@ -68224,7 +67961,6 @@ var PLATFORM_DOMAINS = {
|
|
|
68224
67961
|
tiktok: ["tiktok.com"],
|
|
68225
67962
|
twitter: ["twitter.com", "x.com", "vxtwitter.com", "fixvx.com"],
|
|
68226
67963
|
facebook: ["facebook.com", "fb.watch", "fb.com"],
|
|
68227
|
-
linkedin: ["linkedin.com", "lnkd.in"],
|
|
68228
67964
|
reddit: ["reddit.com", "redd.it"],
|
|
68229
67965
|
vimeo: ["vimeo.com"],
|
|
68230
67966
|
dailymotion: ["dailymotion.com", "dai.ly"],
|
|
@@ -68329,181 +68065,6 @@ function safePathname(rawUrl) {
|
|
|
68329
68065
|
}
|
|
68330
68066
|
}
|
|
68331
68067
|
|
|
68332
|
-
// src/commands/videos/fetch.ts
|
|
68333
|
-
registerSchema({
|
|
68334
|
-
command: "videos.fetch",
|
|
68335
|
-
description: "Download a video page (YouTube, TikTok, Vimeo, \u2026) to a local .mp4 without adding it to the library. For editing a clip locally; use `videos ingest` to add one to the library.",
|
|
68336
|
-
args: {
|
|
68337
|
-
url: { type: "string", description: "Video page URL", required: true },
|
|
68338
|
-
out: { type: "string", description: "Directory to write the file into (created if missing)", required: true },
|
|
68339
|
-
"max-seconds": {
|
|
68340
|
-
type: "string",
|
|
68341
|
-
description: `Refuse videos longer than this many seconds (default ${MAX_VIDEO_INGEST_SECONDS})`,
|
|
68342
|
-
required: false
|
|
68343
|
-
},
|
|
68344
|
-
"timeout-ms": { type: "string", description: "Download time limit in milliseconds", required: false }
|
|
68345
|
-
}
|
|
68346
|
-
});
|
|
68347
|
-
function positiveInt(value) {
|
|
68348
|
-
const parsed = typeof value === "string" ? Number.parseInt(value, 10) : Number.NaN;
|
|
68349
|
-
return Number.isInteger(parsed) && parsed > 0 ? parsed : void 0;
|
|
68350
|
-
}
|
|
68351
|
-
var fetchCommand2 = defineCommand235({
|
|
68352
|
-
meta: {
|
|
68353
|
-
name: "fetch",
|
|
68354
|
-
description: "Download a video page to a local .mp4 without adding it to the library. Same downloader as `ingest` (proxy fallback, duration check).\n\nExample: baker videos fetch https://www.youtube.com/watch?v=abc123 --out ./clips"
|
|
68355
|
-
},
|
|
68356
|
-
args: {
|
|
68357
|
-
url: { type: "positional", description: "Video page URL", required: true },
|
|
68358
|
-
out: { type: "string", description: "Directory to write the file into", required: true },
|
|
68359
|
-
"max-seconds": { type: "string", description: "Refuse videos longer than this", required: false },
|
|
68360
|
-
"timeout-ms": { type: "string", description: "Download time limit in milliseconds", required: false }
|
|
68361
|
-
},
|
|
68362
|
-
run: async ({ args: args5 }) => {
|
|
68363
|
-
const url = String(args5.url ?? "");
|
|
68364
|
-
const outDir = path47.resolve(String(args5.out ?? ""));
|
|
68365
|
-
const maxSeconds = positiveInt(args5["max-seconds"]) ?? MAX_VIDEO_INGEST_SECONDS;
|
|
68366
|
-
try {
|
|
68367
|
-
await mkdir15(outDir, { recursive: true });
|
|
68368
|
-
const vimeoCookie = captureVimeoCookie();
|
|
68369
|
-
const probe = await probeYtDlp({ url, vimeoCookie, cookieDir: outDir });
|
|
68370
|
-
if (isAudioOnly(probe.info)) {
|
|
68371
|
-
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message: "That link is audio, not video." } });
|
|
68372
|
-
process.exit(1);
|
|
68373
|
-
}
|
|
68374
|
-
const seconds = durationSeconds(probe.info);
|
|
68375
|
-
const tooLong = refuseByDuration(seconds, maxSeconds);
|
|
68376
|
-
if (tooLong) {
|
|
68377
|
-
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message: tooLong } });
|
|
68378
|
-
process.exit(1);
|
|
68379
|
-
}
|
|
68380
|
-
const { filePath, tier, reducedQuality } = await runYtDlp({
|
|
68381
|
-
url,
|
|
68382
|
-
audioOnly: false,
|
|
68383
|
-
workDir: outDir,
|
|
68384
|
-
vimeoCookie,
|
|
68385
|
-
timeoutMs: positiveInt(args5["timeout-ms"]) ?? downloadTimeoutMs(seconds)
|
|
68386
|
-
});
|
|
68387
|
-
writeJson({
|
|
68388
|
-
ok: true,
|
|
68389
|
-
data: {
|
|
68390
|
-
file: filePath,
|
|
68391
|
-
durationSeconds: seconds,
|
|
68392
|
-
egress: tier,
|
|
68393
|
-
...reducedQuality ? { reducedQuality: true } : {}
|
|
68394
|
-
}
|
|
68395
|
-
});
|
|
68396
|
-
} catch (err) {
|
|
68397
|
-
const message = err instanceof YtDlpError ? `${err.message}: ${err.stderrTail}`.trim() : err instanceof Error ? err.message : String(err);
|
|
68398
|
-
writeJson({ ok: false, error: { code: "DOWNLOAD_FAILED", message } });
|
|
68399
|
-
process.exit(1);
|
|
68400
|
-
}
|
|
68401
|
-
}
|
|
68402
|
-
});
|
|
68403
|
-
|
|
68404
|
-
// src/commands/videos/get.ts
|
|
68405
|
-
import { defineCommand as defineCommand236 } from "citty";
|
|
68406
|
-
registerSchema({
|
|
68407
|
-
command: "videos.get",
|
|
68408
|
-
description: "Get a single video by ID",
|
|
68409
|
-
args: {
|
|
68410
|
-
id: { type: "string", description: "Video ID", required: true }
|
|
68411
|
-
}
|
|
68412
|
-
});
|
|
68413
|
-
var getCommand7 = defineCommand236({
|
|
68414
|
-
meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
|
|
68415
|
-
args: {
|
|
68416
|
-
id: { type: "positional", description: "Video ID", required: false },
|
|
68417
|
-
"video-id": { type: "string", description: "Video ID (alternative to positional)", required: false },
|
|
68418
|
-
output: { type: "string", description: "Output format: json|files|md", required: false, default: "json" },
|
|
68419
|
-
fields: { type: "string", description: "Comma-separated field names to include", required: false },
|
|
68420
|
-
full: { type: "boolean", description: "Include full metadata", required: false, default: false }
|
|
68421
|
-
},
|
|
68422
|
-
run: async ({ args: args5 }) => {
|
|
68423
|
-
try {
|
|
68424
|
-
const id = args5.id || args5["video-id"];
|
|
68425
|
-
if (!id) {
|
|
68426
|
-
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message: "Video ID is required" } });
|
|
68427
|
-
process.exit(1);
|
|
68428
|
-
}
|
|
68429
|
-
validateConvexId(id);
|
|
68430
|
-
const data = await apiGet("/api/videos/get", { id });
|
|
68431
|
-
writeOutput(
|
|
68432
|
-
{ ok: true, data },
|
|
68433
|
-
args5.output || "json",
|
|
68434
|
-
args5.fields ? args5.fields.split(",") : void 0,
|
|
68435
|
-
args5.full,
|
|
68436
|
-
videoNormalizer
|
|
68437
|
-
);
|
|
68438
|
-
} catch (err) {
|
|
68439
|
-
if (err instanceof ApiError) {
|
|
68440
|
-
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
68441
|
-
process.exit(1);
|
|
68442
|
-
}
|
|
68443
|
-
writeJson({ ok: false, error: { code: "INTERNAL_ERROR", message: "Unexpected error" } });
|
|
68444
|
-
process.exit(1);
|
|
68445
|
-
}
|
|
68446
|
-
}
|
|
68447
|
-
});
|
|
68448
|
-
|
|
68449
|
-
// src/commands/videos/group.ts
|
|
68450
|
-
import { defineCommand as defineCommand237 } from "citty";
|
|
68451
|
-
registerSchema({
|
|
68452
|
-
command: "videos.group",
|
|
68453
|
-
description: "List every clip and image that arrived in the same set as this video (carousel slides, one page)",
|
|
68454
|
-
args: {
|
|
68455
|
-
id: { type: "string", description: "A video or image id \u2014 returns that asset's whole set", required: false },
|
|
68456
|
-
"group-key": { type: "string", description: "The set key directly, when you already have it", required: false }
|
|
68457
|
-
}
|
|
68458
|
-
});
|
|
68459
|
-
var groupCommand2 = defineCommand237({
|
|
68460
|
-
meta: {
|
|
68461
|
-
name: "group",
|
|
68462
|
-
description: "List every asset that arrived in the same set as this clip \u2014 the other slides of the Instagram post it came from, stills included. A carousel is authored to be read in order, so a clip pulled out of one is usually missing half its meaning. Example: baker videos group <videoId>"
|
|
68463
|
-
},
|
|
68464
|
-
args: {
|
|
68465
|
-
id: { type: "positional", description: "A video or image id from the set", required: false },
|
|
68466
|
-
"group-key": { type: "string", description: "The set key, if you already have it", required: false }
|
|
68467
|
-
},
|
|
68468
|
-
run: async ({ args: args5 }) => {
|
|
68469
|
-
await runMediaGroupLookup({
|
|
68470
|
-
id: args5.id,
|
|
68471
|
-
groupKey: args5["group-key"],
|
|
68472
|
-
path: "/api/videos/group",
|
|
68473
|
-
idLabel: "a video or image id"
|
|
68474
|
-
});
|
|
68475
|
-
}
|
|
68476
|
-
});
|
|
68477
|
-
|
|
68478
|
-
// src/commands/videos/ingest.ts
|
|
68479
|
-
import { mkdtemp as mkdtemp3, rm as rm9, stat as stat11 } from "fs/promises";
|
|
68480
|
-
import { tmpdir as tmpdir4 } from "os";
|
|
68481
|
-
import path48 from "path";
|
|
68482
|
-
import { defineCommand as defineCommand238 } from "citty";
|
|
68483
|
-
|
|
68484
|
-
// src/lib/streamUpload.ts
|
|
68485
|
-
import { createHash as createHash2 } from "crypto";
|
|
68486
|
-
import { createReadStream } from "fs";
|
|
68487
|
-
import { Readable } from "stream";
|
|
68488
|
-
import { pipeline } from "stream/promises";
|
|
68489
|
-
async function hashFile(filePath) {
|
|
68490
|
-
const hash = createHash2("sha256");
|
|
68491
|
-
await pipeline(createReadStream(filePath), hash);
|
|
68492
|
-
return hash.digest("hex");
|
|
68493
|
-
}
|
|
68494
|
-
async function putFileStreamed(args5) {
|
|
68495
|
-
const body = Readable.toWeb(createReadStream(args5.filePath));
|
|
68496
|
-
return await fetch(args5.putUrl, {
|
|
68497
|
-
method: "PUT",
|
|
68498
|
-
body,
|
|
68499
|
-
headers: {
|
|
68500
|
-
"Content-Type": args5.contentType,
|
|
68501
|
-
"Content-Length": String(args5.sizeBytes)
|
|
68502
|
-
},
|
|
68503
|
-
duplex: "half"
|
|
68504
|
-
});
|
|
68505
|
-
}
|
|
68506
|
-
|
|
68507
68068
|
// src/commands/videos/ingest.ts
|
|
68508
68069
|
registerSchema({
|
|
68509
68070
|
command: "videos.ingest",
|
|
@@ -68532,7 +68093,7 @@ registerSchema({
|
|
|
68532
68093
|
"dry-run": { type: "boolean", description: "Preview the operation without executing", required: false }
|
|
68533
68094
|
}
|
|
68534
68095
|
});
|
|
68535
|
-
var ingestCommand2 =
|
|
68096
|
+
var ingestCommand2 = defineCommand231({
|
|
68536
68097
|
meta: {
|
|
68537
68098
|
name: "ingest",
|
|
68538
68099
|
description: "Add a video to the library from a URL. A direct file URL is handed straight to Baker, which fetches it. A page URL (YouTube, TikTok, Vimeo, Instagram) is downloaded here first, then uploaded \u2014 and a direct URL that Baker cannot fetch falls back to that same path automatically.\n\nExample: baker videos ingest https://www.youtube.com/watch?v=abc123"
|
|
@@ -68718,7 +68279,7 @@ function ingestUrl(args5) {
|
|
|
68718
68279
|
}
|
|
68719
68280
|
async function downloadThenIngest(args5, country) {
|
|
68720
68281
|
const vimeoCookie = captureVimeoCookie();
|
|
68721
|
-
const workDir = await mkdtemp3(
|
|
68282
|
+
const workDir = await mkdtemp3(path47.join(tmpdir4(), "videos-ingest-"));
|
|
68722
68283
|
try {
|
|
68723
68284
|
const probe = await probeYtDlp({ url: args5.url, country, vimeoCookie, cookieDir: workDir });
|
|
68724
68285
|
if (isAudioOnly(probe.info)) {
|
|
@@ -68794,7 +68355,7 @@ async function uploadToAssetStore(filePath, sizeBytes) {
|
|
|
68794
68355
|
}
|
|
68795
68356
|
|
|
68796
68357
|
// src/commands/videos/search.ts
|
|
68797
|
-
import { defineCommand as
|
|
68358
|
+
import { defineCommand as defineCommand232 } from "citty";
|
|
68798
68359
|
registerSchema({
|
|
68799
68360
|
command: "videos.search",
|
|
68800
68361
|
description: "Search videos by text query. Only returns ready videos.",
|
|
@@ -68804,7 +68365,7 @@ registerSchema({
|
|
|
68804
68365
|
tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
|
|
68805
68366
|
}
|
|
68806
68367
|
});
|
|
68807
|
-
var searchCommand4 =
|
|
68368
|
+
var searchCommand4 = defineCommand232({
|
|
68808
68369
|
meta: {
|
|
68809
68370
|
name: "search",
|
|
68810
68371
|
description: "Semantic search videos by text query. Uses hybrid BM25 + vector + reranking. Example: baker videos search 'product demo' --tags tutorial"
|
|
@@ -68856,7 +68417,7 @@ var tagsCommand6 = makeTagsCommand("videos", "video", "/api/videos/tags");
|
|
|
68856
68417
|
// src/commands/videos/upload.ts
|
|
68857
68418
|
import { readFile as readFile33, stat as stat12 } from "fs/promises";
|
|
68858
68419
|
import { basename as basename3, extname as extname4 } from "path";
|
|
68859
|
-
import { defineCommand as
|
|
68420
|
+
import { defineCommand as defineCommand233 } from "citty";
|
|
68860
68421
|
var MIME_MAP = {
|
|
68861
68422
|
".mp4": "video/mp4",
|
|
68862
68423
|
".mov": "video/quicktime",
|
|
@@ -68898,7 +68459,7 @@ function detectContentType(filePath) {
|
|
|
68898
68459
|
function isRemoteUrl3(value) {
|
|
68899
68460
|
return /^https?:\/\//i.test(value);
|
|
68900
68461
|
}
|
|
68901
|
-
var uploadCommand2 =
|
|
68462
|
+
var uploadCommand2 = defineCommand233({
|
|
68902
68463
|
meta: {
|
|
68903
68464
|
name: "upload",
|
|
68904
68465
|
description: "Upload a video to Baker \u2014 accepts a local file path OR a remote http(s) URL.\n\nLocal: auto-detects content type and uploads via Mux direct upload.\nRemote: hands off to `videos ingest` (direct fetch, or download-then-upload for a YouTube/TikTok/Vimeo page).\n\nExamples:\n baker videos upload ./demo.mp4\n baker videos upload https://www.youtube.com/watch?v=abc123"
|
|
@@ -68982,10 +68543,10 @@ var uploadCommand2 = defineCommand240({
|
|
|
68982
68543
|
});
|
|
68983
68544
|
|
|
68984
68545
|
// src/commands/videos/index.ts
|
|
68985
|
-
var videosCommand =
|
|
68546
|
+
var videosCommand = defineCommand234({
|
|
68986
68547
|
meta: {
|
|
68987
68548
|
name: "videos",
|
|
68988
|
-
description: `Find and manage videos in Baker. Subcommands: search, get, upload, ingest,
|
|
68549
|
+
description: `Find and manage videos in Baker. Subcommands: search, get, upload, ingest, describe, delete, tags.
|
|
68989
68550
|
|
|
68990
68551
|
Examples:
|
|
68991
68552
|
baker videos search "product demo" --limit 5
|
|
@@ -68993,7 +68554,6 @@ Examples:
|
|
|
68993
68554
|
baker videos get <video-id>
|
|
68994
68555
|
baker videos upload ./demo.mp4
|
|
68995
68556
|
baker videos ingest https://www.youtube.com/watch?v=abc123
|
|
68996
|
-
baker videos fetch https://www.youtube.com/watch?v=abc123 --out ./clips
|
|
68997
68557
|
baker videos describe <video-id> --description "Customer testimonial, 30s"
|
|
68998
68558
|
baker videos delete <video-id> --dry-run
|
|
68999
68559
|
baker videos tags
|
|
@@ -69005,7 +68565,6 @@ Full guide: __tooling__/docs/tools/baker/videos.md`
|
|
|
69005
68565
|
search: searchCommand4,
|
|
69006
68566
|
upload: uploadCommand2,
|
|
69007
68567
|
ingest: ingestCommand2,
|
|
69008
|
-
fetch: fetchCommand2,
|
|
69009
68568
|
describe: describeCommand2,
|
|
69010
68569
|
delete: deleteCommand4,
|
|
69011
68570
|
tags: tagsCommand6
|
|
@@ -69013,10 +68572,10 @@ Full guide: __tooling__/docs/tools/baker/videos.md`
|
|
|
69013
68572
|
});
|
|
69014
68573
|
|
|
69015
68574
|
// src/commands/winning-ads/index.ts
|
|
69016
|
-
import { defineCommand as
|
|
68575
|
+
import { defineCommand as defineCommand247 } from "citty";
|
|
69017
68576
|
|
|
69018
68577
|
// src/commands/winning-ads/advertisers.ts
|
|
69019
|
-
import { defineCommand as
|
|
68578
|
+
import { defineCommand as defineCommand235 } from "citty";
|
|
69020
68579
|
|
|
69021
68580
|
// src/commands/winning-ads/shared.ts
|
|
69022
68581
|
function splitList3(value) {
|
|
@@ -69025,7 +68584,7 @@ function splitList3(value) {
|
|
|
69025
68584
|
}
|
|
69026
68585
|
return value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
69027
68586
|
}
|
|
69028
|
-
function
|
|
68587
|
+
function reportError2(err) {
|
|
69029
68588
|
if (err instanceof ApiError) {
|
|
69030
68589
|
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
69031
68590
|
process.exit(1);
|
|
@@ -69069,7 +68628,7 @@ function advertiserNormalizer(record, full) {
|
|
|
69069
68628
|
last_synced_at: record.last_synced_at ?? null
|
|
69070
68629
|
};
|
|
69071
68630
|
}
|
|
69072
|
-
var advertisersCommand2 =
|
|
68631
|
+
var advertisersCommand2 = defineCommand235({
|
|
69073
68632
|
meta: {
|
|
69074
68633
|
name: "advertisers",
|
|
69075
68634
|
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'
|
|
@@ -69121,13 +68680,13 @@ var advertisersCommand2 = defineCommand242({
|
|
|
69121
68680
|
advertiserNormalizer
|
|
69122
68681
|
);
|
|
69123
68682
|
} catch (err) {
|
|
69124
|
-
|
|
68683
|
+
reportError2(err);
|
|
69125
68684
|
}
|
|
69126
68685
|
}
|
|
69127
68686
|
});
|
|
69128
68687
|
|
|
69129
68688
|
// src/commands/winning-ads/brief.ts
|
|
69130
|
-
import { defineCommand as
|
|
68689
|
+
import { defineCommand as defineCommand236 } from "citty";
|
|
69131
68690
|
registerSchema({
|
|
69132
68691
|
command: "winning-ads.brief",
|
|
69133
68692
|
description: "Generate a creative brief grounded in strategically-similar winning ads. Optionally describe the target creative with --dna (JSON) and steer with --notes.",
|
|
@@ -69173,7 +68732,7 @@ function parseDna(raw) {
|
|
|
69173
68732
|
}
|
|
69174
68733
|
return parsed;
|
|
69175
68734
|
}
|
|
69176
|
-
var briefCommand =
|
|
68735
|
+
var briefCommand = defineCommand236({
|
|
69177
68736
|
meta: {
|
|
69178
68737
|
name: "brief",
|
|
69179
68738
|
description: `Generate a creative brief from winning references. Example: baker winning-ads brief --dna '{"angle":"cost savings"}' --notes "B2B, LinkedIn video" --k 8`
|
|
@@ -69203,13 +68762,13 @@ var briefCommand = defineCommand243({
|
|
|
69203
68762
|
const data = await apiPost("/api/ad-library/brief", body);
|
|
69204
68763
|
writeJson({ ok: true, data });
|
|
69205
68764
|
} catch (err) {
|
|
69206
|
-
|
|
68765
|
+
reportError2(err);
|
|
69207
68766
|
}
|
|
69208
68767
|
}
|
|
69209
68768
|
});
|
|
69210
68769
|
|
|
69211
68770
|
// src/commands/winning-ads/content.ts
|
|
69212
|
-
import { defineCommand as
|
|
68771
|
+
import { defineCommand as defineCommand237 } from "citty";
|
|
69213
68772
|
registerSchema({
|
|
69214
68773
|
command: "winning-ads.content",
|
|
69215
68774
|
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.",
|
|
@@ -69222,7 +68781,7 @@ registerSchema({
|
|
|
69222
68781
|
}
|
|
69223
68782
|
}
|
|
69224
68783
|
});
|
|
69225
|
-
var contentCommand =
|
|
68784
|
+
var contentCommand = defineCommand237({
|
|
69226
68785
|
meta: {
|
|
69227
68786
|
name: "content",
|
|
69228
68787
|
description: "Read the transcript + on-screen text + copy of one winning ad. Example: baker winning-ads content adg_123 --platform meta --full --output md"
|
|
@@ -69265,13 +68824,13 @@ var contentCommand = defineCommand244({
|
|
|
69265
68824
|
adContentNormalizer
|
|
69266
68825
|
);
|
|
69267
68826
|
} catch (err) {
|
|
69268
|
-
|
|
68827
|
+
reportError2(err);
|
|
69269
68828
|
}
|
|
69270
68829
|
}
|
|
69271
68830
|
});
|
|
69272
68831
|
|
|
69273
68832
|
// src/commands/winning-ads/feed.ts
|
|
69274
|
-
import { defineCommand as
|
|
68833
|
+
import { defineCommand as defineCommand238 } from "citty";
|
|
69275
68834
|
function buildFeedParams(input) {
|
|
69276
68835
|
const params = {};
|
|
69277
68836
|
const advertiser = splitList3(input.advertiser);
|
|
@@ -69323,7 +68882,7 @@ registerSchema({
|
|
|
69323
68882
|
format: { type: "string", description: "Comma-separated formats to include (e.g. static,video)", required: false }
|
|
69324
68883
|
}
|
|
69325
68884
|
});
|
|
69326
|
-
var feedCommand2 =
|
|
68885
|
+
var feedCommand2 = defineCommand238({
|
|
69327
68886
|
meta: {
|
|
69328
68887
|
name: "feed",
|
|
69329
68888
|
description: "Winners across every brand you follow (browse, then trim per advertiser). Example: baker winning-ads feed --per-advertiser 5 --output md"
|
|
@@ -69402,13 +68961,13 @@ var feedCommand2 = defineCommand245({
|
|
|
69402
68961
|
`);
|
|
69403
68962
|
}
|
|
69404
68963
|
} catch (err) {
|
|
69405
|
-
|
|
68964
|
+
reportError2(err);
|
|
69406
68965
|
}
|
|
69407
68966
|
}
|
|
69408
68967
|
});
|
|
69409
68968
|
|
|
69410
68969
|
// src/commands/winning-ads/follow.ts
|
|
69411
|
-
import { defineCommand as
|
|
68970
|
+
import { defineCommand as defineCommand239 } from "citty";
|
|
69412
68971
|
var PLATFORMS = adLibraryPlatformSchema.options;
|
|
69413
68972
|
registerSchema({
|
|
69414
68973
|
command: "winning-ads.follow",
|
|
@@ -69423,7 +68982,7 @@ registerSchema({
|
|
|
69423
68982
|
label: { type: "string", description: "Optional display label (defaults to the resolved name)", required: false }
|
|
69424
68983
|
}
|
|
69425
68984
|
});
|
|
69426
|
-
var followCommand =
|
|
68985
|
+
var followCommand = defineCommand239({
|
|
69427
68986
|
meta: {
|
|
69428
68987
|
name: "follow",
|
|
69429
68988
|
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 every platform we can resolve. Example: baker winning-ads follow "deel.com" --platform meta'
|
|
@@ -69464,13 +69023,13 @@ var followCommand = defineCommand246({
|
|
|
69464
69023
|
}
|
|
69465
69024
|
writeJson({ ok: true, data, hints: hints2 });
|
|
69466
69025
|
} catch (err) {
|
|
69467
|
-
|
|
69026
|
+
reportError2(err);
|
|
69468
69027
|
}
|
|
69469
69028
|
}
|
|
69470
69029
|
});
|
|
69471
69030
|
|
|
69472
69031
|
// src/commands/winning-ads/follow-competitors.ts
|
|
69473
|
-
import { defineCommand as
|
|
69032
|
+
import { defineCommand as defineCommand240 } from "citty";
|
|
69474
69033
|
var PLATFORMS2 = adLibraryPlatformSchema.options;
|
|
69475
69034
|
var BATCH_TIMEOUT_MS = 3e5;
|
|
69476
69035
|
function buildFollowBatchBody(input) {
|
|
@@ -69503,7 +69062,7 @@ registerSchema({
|
|
|
69503
69062
|
}
|
|
69504
69063
|
}
|
|
69505
69064
|
});
|
|
69506
|
-
var followCompetitorsCommand =
|
|
69065
|
+
var followCompetitorsCommand = defineCommand240({
|
|
69507
69066
|
meta: {
|
|
69508
69067
|
name: "follow-competitors",
|
|
69509
69068
|
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"'
|
|
@@ -69572,13 +69131,13 @@ var followCompetitorsCommand = defineCommand247({
|
|
|
69572
69131
|
}
|
|
69573
69132
|
writeJson({ ok: true, data, hints: hints2.length > 0 ? hints2 : void 0 });
|
|
69574
69133
|
} catch (err) {
|
|
69575
|
-
|
|
69134
|
+
reportError2(err);
|
|
69576
69135
|
}
|
|
69577
69136
|
}
|
|
69578
69137
|
});
|
|
69579
69138
|
|
|
69580
69139
|
// src/commands/winning-ads/following.ts
|
|
69581
|
-
import { defineCommand as
|
|
69140
|
+
import { defineCommand as defineCommand241 } from "citty";
|
|
69582
69141
|
registerSchema({
|
|
69583
69142
|
command: "winning-ads.following",
|
|
69584
69143
|
description: "List the brands you follow in your ad-dna library, with each one's status (ready vs still adding) and cached ad counts. A brand still adding has counts that are a lie in progress; one with `discovery_failed` has counts that are short because we couldn't finish looking, which is not the same as it running no ads.",
|
|
@@ -69632,7 +69191,7 @@ function followingNormalizer(record, full) {
|
|
|
69632
69191
|
platforms: Array.isArray(record.platforms) ? record.platforms : []
|
|
69633
69192
|
};
|
|
69634
69193
|
}
|
|
69635
|
-
var followingCommand =
|
|
69194
|
+
var followingCommand = defineCommand241({
|
|
69636
69195
|
meta: {
|
|
69637
69196
|
name: "following",
|
|
69638
69197
|
description: "List brands you follow, with status (ready / adding\u2026) and cached counts. A brand's counts are only final once it is ready. Example: baker winning-ads following --output md"
|
|
@@ -69662,13 +69221,13 @@ var followingCommand = defineCommand248({
|
|
|
69662
69221
|
followingNormalizer
|
|
69663
69222
|
);
|
|
69664
69223
|
} catch (err) {
|
|
69665
|
-
|
|
69224
|
+
reportError2(err);
|
|
69666
69225
|
}
|
|
69667
69226
|
}
|
|
69668
69227
|
});
|
|
69669
69228
|
|
|
69670
69229
|
// src/commands/winning-ads/patterns.ts
|
|
69671
|
-
import { defineCommand as
|
|
69230
|
+
import { defineCommand as defineCommand242 } from "citty";
|
|
69672
69231
|
registerSchema({
|
|
69673
69232
|
command: "winning-ads.patterns",
|
|
69674
69233
|
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.",
|
|
@@ -69707,7 +69266,7 @@ function discriminatorRow(record) {
|
|
|
69707
69266
|
top_values_duds: Array.isArray(record.top_values_b) ? record.top_values_b.join(", ") : ""
|
|
69708
69267
|
};
|
|
69709
69268
|
}
|
|
69710
|
-
var patternsCommand =
|
|
69269
|
+
var patternsCommand = defineCommand242({
|
|
69711
69270
|
meta: {
|
|
69712
69271
|
name: "patterns",
|
|
69713
69272
|
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"
|
|
@@ -69757,13 +69316,13 @@ var patternsCommand = defineCommand249({
|
|
|
69757
69316
|
(record) => discriminatorRow(record)
|
|
69758
69317
|
);
|
|
69759
69318
|
} catch (err) {
|
|
69760
|
-
|
|
69319
|
+
reportError2(err);
|
|
69761
69320
|
}
|
|
69762
69321
|
}
|
|
69763
69322
|
});
|
|
69764
69323
|
|
|
69765
69324
|
// src/commands/winning-ads/search.ts
|
|
69766
|
-
import { defineCommand as
|
|
69325
|
+
import { defineCommand as defineCommand243 } from "citty";
|
|
69767
69326
|
registerSchema({
|
|
69768
69327
|
command: "winning-ads.search",
|
|
69769
69328
|
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.",
|
|
@@ -69899,9 +69458,9 @@ function reportSearchError(err) {
|
|
|
69899
69458
|
writeJson({ ok: false, error: { code: err.code, message: err.message, fix } });
|
|
69900
69459
|
process.exit(1);
|
|
69901
69460
|
}
|
|
69902
|
-
|
|
69461
|
+
reportError2(err);
|
|
69903
69462
|
}
|
|
69904
|
-
var searchCommand5 =
|
|
69463
|
+
var searchCommand5 = defineCommand243({
|
|
69905
69464
|
meta: {
|
|
69906
69465
|
name: "search",
|
|
69907
69466
|
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"
|
|
@@ -70021,7 +69580,7 @@ var searchCommand5 = defineCommand250({
|
|
|
70021
69580
|
});
|
|
70022
69581
|
|
|
70023
69582
|
// src/commands/winning-ads/seeds.ts
|
|
70024
|
-
import { defineCommand as
|
|
69583
|
+
import { defineCommand as defineCommand244 } from "citty";
|
|
70025
69584
|
function leanRow(r) {
|
|
70026
69585
|
return {
|
|
70027
69586
|
key: r.key,
|
|
@@ -70049,7 +69608,7 @@ function makeSeedCommand(opts) {
|
|
|
70049
69608
|
limit: { type: "number", description: "Max keys 1-100 (default 20)", required: false, default: 20 }
|
|
70050
69609
|
}
|
|
70051
69610
|
});
|
|
70052
|
-
return
|
|
69611
|
+
return defineCommand244({
|
|
70053
69612
|
meta: { name: opts.name, description: opts.description },
|
|
70054
69613
|
args: {
|
|
70055
69614
|
platform: { type: "string", description: "Single platform to segment on", required: false },
|
|
@@ -70076,7 +69635,7 @@ function makeSeedCommand(opts) {
|
|
|
70076
69635
|
}
|
|
70077
69636
|
writeOutput({ ok: true, data: projected }, output);
|
|
70078
69637
|
} catch (err) {
|
|
70079
|
-
|
|
69638
|
+
reportError2(err);
|
|
70080
69639
|
}
|
|
70081
69640
|
}
|
|
70082
69641
|
});
|
|
@@ -70098,7 +69657,7 @@ var formatsCommand = makeSeedCommand({
|
|
|
70098
69657
|
});
|
|
70099
69658
|
|
|
70100
69659
|
// src/commands/winning-ads/unfollow.ts
|
|
70101
|
-
import { defineCommand as
|
|
69660
|
+
import { defineCommand as defineCommand245 } from "citty";
|
|
70102
69661
|
registerSchema({
|
|
70103
69662
|
command: "winning-ads.unfollow",
|
|
70104
69663
|
description: "Stop following a brand \u2014 removes it from your ad-dna library by advertiser id.",
|
|
@@ -70106,7 +69665,7 @@ registerSchema({
|
|
|
70106
69665
|
advertiser: { type: "string", description: "Advertiser id to unfollow", required: true }
|
|
70107
69666
|
}
|
|
70108
69667
|
});
|
|
70109
|
-
var unfollowCommand =
|
|
69668
|
+
var unfollowCommand = defineCommand245({
|
|
70110
69669
|
meta: {
|
|
70111
69670
|
name: "unfollow",
|
|
70112
69671
|
description: "Stop following a brand by advertiser id. Example: baker winning-ads unfollow adv_123"
|
|
@@ -70121,13 +69680,13 @@ var unfollowCommand = defineCommand252({
|
|
|
70121
69680
|
});
|
|
70122
69681
|
writeJson({ ok: true, data });
|
|
70123
69682
|
} catch (err) {
|
|
70124
|
-
|
|
69683
|
+
reportError2(err);
|
|
70125
69684
|
}
|
|
70126
69685
|
}
|
|
70127
69686
|
});
|
|
70128
69687
|
|
|
70129
69688
|
// src/commands/winning-ads/winners.ts
|
|
70130
|
-
import { defineCommand as
|
|
69689
|
+
import { defineCommand as defineCommand246 } from "citty";
|
|
70131
69690
|
registerSchema({
|
|
70132
69691
|
command: "winning-ads.winners",
|
|
70133
69692
|
description: "Top winning ads for one advertiser id (from `advertisers` or `following`). Returns lean winner cards; add --full for DNA + longevity.",
|
|
@@ -70137,7 +69696,7 @@ registerSchema({
|
|
|
70137
69696
|
platform: { type: "string", description: "Filter to a single platform: meta|linkedin|tiktok", required: false }
|
|
70138
69697
|
}
|
|
70139
69698
|
});
|
|
70140
|
-
var winnersCommand =
|
|
69699
|
+
var winnersCommand = defineCommand246({
|
|
70141
69700
|
meta: {
|
|
70142
69701
|
name: "winners",
|
|
70143
69702
|
description: "Top winning ads for a specific advertiser id. Example: baker winning-ads winners adv_123 --top 15 --output md"
|
|
@@ -70181,13 +69740,13 @@ var winnersCommand = defineCommand253({
|
|
|
70181
69740
|
winningAdNormalizer
|
|
70182
69741
|
);
|
|
70183
69742
|
} catch (err) {
|
|
70184
|
-
|
|
69743
|
+
reportError2(err);
|
|
70185
69744
|
}
|
|
70186
69745
|
}
|
|
70187
69746
|
});
|
|
70188
69747
|
|
|
70189
69748
|
// src/commands/winning-ads/index.ts
|
|
70190
|
-
var winningAdsCommand =
|
|
69749
|
+
var winningAdsCommand = defineCommand247({
|
|
70191
69750
|
meta: {
|
|
70192
69751
|
name: "winning-ads",
|
|
70193
69752
|
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.
|
|
@@ -70259,7 +69818,7 @@ function getCliVersion() {
|
|
|
70259
69818
|
}
|
|
70260
69819
|
|
|
70261
69820
|
// src/cli.ts
|
|
70262
|
-
var main =
|
|
69821
|
+
var main = defineCommand248({
|
|
70263
69822
|
meta: {
|
|
70264
69823
|
name: "baker",
|
|
70265
69824
|
version: getCliVersion(),
|
|
@@ -70299,7 +69858,6 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
70299
69858
|
history: historyCommand2,
|
|
70300
69859
|
hubspot: hubspotCommand,
|
|
70301
69860
|
"winning-ads": winningAdsCommand,
|
|
70302
|
-
"media-sources": mediaSourcesCommand,
|
|
70303
69861
|
mcp: mcpCommand,
|
|
70304
69862
|
schema: schemaCommand2
|
|
70305
69863
|
}
|