@koda-sl/baker-cli 0.379.0-dev.0114084a3 → 0.379.0-dev.bfd923423
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-KAOU6QLP.js} +58 -9
- package/dist/chunk-KAOU6QLP.js.map +1 -0
- package/dist/cli.js +471 -914
- package/dist/cli.js.map +1 -1
- package/dist/{shared-J7DQZ2ED.js → shared-TD76Z3W2.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-VLUGGVJL.js.map +0 -1
- /package/dist/{shared-J7DQZ2ED.js.map → shared-TD76Z3W2.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
resolveEffectiveStatus,
|
|
82
82
|
statusFilterHints,
|
|
83
83
|
todayIso
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-KAOU6QLP.js";
|
|
85
85
|
import {
|
|
86
86
|
buildQueryCacheKey,
|
|
87
87
|
cacheGet,
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
} from "./chunk-HJEMOSPH.js";
|
|
144
144
|
|
|
145
145
|
// src/cli.ts
|
|
146
|
-
import { defineCommand as
|
|
146
|
+
import { defineCommand as defineCommand248, runMain } from "citty";
|
|
147
147
|
|
|
148
148
|
// src/cache-flag.ts
|
|
149
149
|
var NO_CACHE_ARG = {
|
|
@@ -4534,9 +4534,6 @@ var chatChangeTypeSchema = z13.enum([
|
|
|
4534
4534
|
"image",
|
|
4535
4535
|
"video",
|
|
4536
4536
|
"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
4537
|
// A landing page saved to the reference library, keyed on the page.
|
|
4541
4538
|
"landing-reference",
|
|
4542
4539
|
// One Studio batch — the takes of one brief, as a set. See convex/lib/validators.ts.
|
|
@@ -6401,9 +6398,6 @@ var imageSourceSchema = z20.enum([
|
|
|
6401
6398
|
"google_testimonial",
|
|
6402
6399
|
"trustpilot_testimonial",
|
|
6403
6400
|
"instagram",
|
|
6404
|
-
"tiktok",
|
|
6405
|
-
"linkedin",
|
|
6406
|
-
"facebook",
|
|
6407
6401
|
"pexels",
|
|
6408
6402
|
"pixabay",
|
|
6409
6403
|
// Retired stock provider — kept so existing library rows stay filterable.
|
|
@@ -8215,7 +8209,6 @@ var videoSourceSchema = z30.enum([
|
|
|
8215
8209
|
"dailymotion",
|
|
8216
8210
|
"facebook",
|
|
8217
8211
|
"instagram",
|
|
8218
|
-
"linkedin",
|
|
8219
8212
|
"loom",
|
|
8220
8213
|
"newgrounds",
|
|
8221
8214
|
"ok",
|
|
@@ -12116,9 +12109,9 @@ var COPY_LIST_FLAG = {
|
|
|
12116
12109
|
descriptions: "--descriptions",
|
|
12117
12110
|
longHeadlines: "--long-headlines"
|
|
12118
12111
|
};
|
|
12119
|
-
function valueAt(root,
|
|
12112
|
+
function valueAt(root, path48) {
|
|
12120
12113
|
let node = root;
|
|
12121
|
-
for (const key of
|
|
12114
|
+
for (const key of path48) {
|
|
12122
12115
|
if (node === null || typeof node !== "object") return void 0;
|
|
12123
12116
|
node = node[key];
|
|
12124
12117
|
}
|
|
@@ -12351,11 +12344,11 @@ function parseKeywordEntry(raw, defaultMatch) {
|
|
|
12351
12344
|
function rawTextEntries(value, rawArgs) {
|
|
12352
12345
|
return repeatedValues(rawArgs, "text", value).flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
|
|
12353
12346
|
}
|
|
12354
|
-
function rawFileEntries(
|
|
12355
|
-
if (typeof
|
|
12347
|
+
function rawFileEntries(path48) {
|
|
12348
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
12356
12349
|
return [];
|
|
12357
12350
|
}
|
|
12358
|
-
return readFileSync2(
|
|
12351
|
+
return readFileSync2(path48, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
12359
12352
|
}
|
|
12360
12353
|
function keywordEntries(args5, rawArgs) {
|
|
12361
12354
|
const defaultMatch = typeof args5["match-type"] === "string" ? args5["match-type"].toUpperCase() : void 0;
|
|
@@ -12378,14 +12371,14 @@ function keywordEntries(args5, rawArgs) {
|
|
|
12378
12371
|
}
|
|
12379
12372
|
return entries;
|
|
12380
12373
|
}
|
|
12381
|
-
function loadJsonFileArg(
|
|
12382
|
-
if (typeof
|
|
12374
|
+
function loadJsonFileArg(path48) {
|
|
12375
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
12383
12376
|
return {};
|
|
12384
12377
|
}
|
|
12385
|
-
const inline =
|
|
12386
|
-
const source = inline ? "inline JSON" :
|
|
12378
|
+
const inline = path48.trimStart().startsWith("{");
|
|
12379
|
+
const source = inline ? "inline JSON" : path48;
|
|
12387
12380
|
try {
|
|
12388
|
-
const parsed = JSON.parse(inline ?
|
|
12381
|
+
const parsed = JSON.parse(inline ? path48 : readFileSync2(path48, "utf8"));
|
|
12389
12382
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
12390
12383
|
failWriteValidation(`${source} must contain a JSON object`);
|
|
12391
12384
|
}
|
|
@@ -12522,10 +12515,10 @@ async function stageUpdate(kind, customerId, target2, payload, hints2) {
|
|
|
12522
12515
|
async function stageTarget(kind, customerId, target2, hints2) {
|
|
12523
12516
|
await stageGoogleOp({ kind, customerId, target: target2 }, hints2);
|
|
12524
12517
|
}
|
|
12525
|
-
async function draftAction(
|
|
12518
|
+
async function draftAction(path48, body, chat) {
|
|
12526
12519
|
try {
|
|
12527
12520
|
const chatId = resolveChatId(chat);
|
|
12528
|
-
const response = await apiPost(
|
|
12521
|
+
const response = await apiPost(path48, { chatId, ...body });
|
|
12529
12522
|
writeJsonEnvelope(response);
|
|
12530
12523
|
} catch (err) {
|
|
12531
12524
|
handleGoogleError(err);
|
|
@@ -14943,14 +14936,14 @@ function mappingRowProblem(row) {
|
|
|
14943
14936
|
|
|
14944
14937
|
// ../api/src/event-sources/template.ts
|
|
14945
14938
|
var MENTION = /\{\{\s*([^{}]+?)\s*\}\}/g;
|
|
14946
|
-
function mentionOf(
|
|
14947
|
-
return `{{${
|
|
14939
|
+
function mentionOf(path48) {
|
|
14940
|
+
return `{{${path48}}}`;
|
|
14948
14941
|
}
|
|
14949
14942
|
function templateMentions(template) {
|
|
14950
14943
|
const seen = [];
|
|
14951
14944
|
for (const match of template.matchAll(MENTION)) {
|
|
14952
|
-
const
|
|
14953
|
-
if (
|
|
14945
|
+
const path48 = (match[1] ?? "").trim();
|
|
14946
|
+
if (path48 !== "" && !seen.includes(path48)) seen.push(path48);
|
|
14954
14947
|
}
|
|
14955
14948
|
return seen;
|
|
14956
14949
|
}
|
|
@@ -18305,17 +18298,17 @@ function ignoredColumnHints(columns) {
|
|
|
18305
18298
|
`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
18299
|
];
|
|
18307
18300
|
}
|
|
18308
|
-
function readRowsFile(
|
|
18309
|
-
const inline =
|
|
18301
|
+
function readRowsFile(path48) {
|
|
18302
|
+
const inline = path48.trimStart().startsWith("[") || path48.trimStart().startsWith("{");
|
|
18310
18303
|
let text2;
|
|
18311
18304
|
try {
|
|
18312
|
-
text2 = inline ?
|
|
18305
|
+
text2 = inline ? path48 : readFileSync4(path48, "utf8");
|
|
18313
18306
|
} catch (err) {
|
|
18314
|
-
failWriteValidation(`could not read ${
|
|
18307
|
+
failWriteValidation(`could not read ${path48}: ${err instanceof Error ? err.message : String(err)}`);
|
|
18315
18308
|
}
|
|
18316
18309
|
const parsed = parseConversionRowsText(text2);
|
|
18317
18310
|
if (!parsed.ok) {
|
|
18318
|
-
failWriteValidation(`${inline ? "the conversions passed inline" :
|
|
18311
|
+
failWriteValidation(`${inline ? "the conversions passed inline" : path48}: ${parsed.error}`);
|
|
18319
18312
|
}
|
|
18320
18313
|
return { rows: parsed.rows, ignoredColumns: parsed.ignoredColumns };
|
|
18321
18314
|
}
|
|
@@ -20190,19 +20183,19 @@ function failWriteValidation2(message) {
|
|
|
20190
20183
|
writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
|
|
20191
20184
|
process.exit(1);
|
|
20192
20185
|
}
|
|
20193
|
-
function loadJsonFileArg2(
|
|
20194
|
-
if (typeof
|
|
20186
|
+
function loadJsonFileArg2(path48) {
|
|
20187
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
20195
20188
|
return {};
|
|
20196
20189
|
}
|
|
20197
20190
|
try {
|
|
20198
|
-
const parsed = JSON.parse(readFileSync5(
|
|
20191
|
+
const parsed = JSON.parse(readFileSync5(path48, "utf8"));
|
|
20199
20192
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
20200
|
-
failWriteValidation2(`${
|
|
20193
|
+
failWriteValidation2(`${path48} must contain a JSON object`);
|
|
20201
20194
|
}
|
|
20202
20195
|
return parsed;
|
|
20203
20196
|
} catch (err) {
|
|
20204
20197
|
if (err instanceof SyntaxError) {
|
|
20205
|
-
failWriteValidation2(`${
|
|
20198
|
+
failWriteValidation2(`${path48} is not valid JSON: ${err.message}`);
|
|
20206
20199
|
}
|
|
20207
20200
|
throw err;
|
|
20208
20201
|
}
|
|
@@ -20287,15 +20280,15 @@ function parseLocaleFlag(value) {
|
|
|
20287
20280
|
}
|
|
20288
20281
|
return { language: match[1], country: match[2].toUpperCase() };
|
|
20289
20282
|
}
|
|
20290
|
-
function loadTargetingFileArg(
|
|
20291
|
-
if (typeof
|
|
20283
|
+
function loadTargetingFileArg(path48) {
|
|
20284
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
20292
20285
|
return void 0;
|
|
20293
20286
|
}
|
|
20294
|
-
const parsed = loadJsonFileArg2(
|
|
20287
|
+
const parsed = loadJsonFileArg2(path48);
|
|
20295
20288
|
const criteria = parsed.targetingCriteria ?? parsed;
|
|
20296
20289
|
if (!criteria.include) {
|
|
20297
20290
|
failWriteValidation2(
|
|
20298
|
-
`${
|
|
20291
|
+
`${path48} must contain targeting criteria with an "include" block (see baker schema ads.linkedin.campaigns.create)`
|
|
20299
20292
|
);
|
|
20300
20293
|
}
|
|
20301
20294
|
return criteria;
|
|
@@ -20330,14 +20323,14 @@ function parseCsvLine(line) {
|
|
|
20330
20323
|
cells.push(current);
|
|
20331
20324
|
return cells.map((cell3) => cell3.trim());
|
|
20332
20325
|
}
|
|
20333
|
-
function parseListFileArg(
|
|
20334
|
-
if (typeof
|
|
20326
|
+
function parseListFileArg(path48, maxRows) {
|
|
20327
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
20335
20328
|
return void 0;
|
|
20336
20329
|
}
|
|
20337
|
-
const raw = readFileSync5(
|
|
20330
|
+
const raw = readFileSync5(path48, "utf8");
|
|
20338
20331
|
const lines = raw.split(/\r?\n/).filter((line) => line.trim().length > 0);
|
|
20339
20332
|
if (lines.length < 2) {
|
|
20340
|
-
failWriteValidation2(`${
|
|
20333
|
+
failWriteValidation2(`${path48} needs a header row and at least one data row`);
|
|
20341
20334
|
}
|
|
20342
20335
|
const columns = parseCsvLine(lines[0]).map((column) => column.trim());
|
|
20343
20336
|
const rows = [];
|
|
@@ -20356,7 +20349,7 @@ function parseListFileArg(path49, maxRows) {
|
|
|
20356
20349
|
}
|
|
20357
20350
|
}
|
|
20358
20351
|
if (rows.length > maxRows) {
|
|
20359
|
-
failWriteValidation2(`${
|
|
20352
|
+
failWriteValidation2(`${path48} has ${rows.length} rows \u2014 the inline limit is ${maxRows}. Split the list.`);
|
|
20360
20353
|
}
|
|
20361
20354
|
return { columns, rows };
|
|
20362
20355
|
}
|
|
@@ -20452,11 +20445,11 @@ function readPositionals(args5) {
|
|
|
20452
20445
|
function splitIdList(raw) {
|
|
20453
20446
|
return raw.split(",").map((id) => id.trim()).filter(Boolean);
|
|
20454
20447
|
}
|
|
20455
|
-
function idsFileEntries(
|
|
20456
|
-
if (typeof
|
|
20448
|
+
function idsFileEntries(path48) {
|
|
20449
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
20457
20450
|
return [];
|
|
20458
20451
|
}
|
|
20459
|
-
return readFileSync5(
|
|
20452
|
+
return readFileSync5(path48, "utf8").split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#")).flatMap(splitIdList);
|
|
20460
20453
|
}
|
|
20461
20454
|
function requireTargets(args5, entity) {
|
|
20462
20455
|
const positionals = readPositionals(args5);
|
|
@@ -23218,9 +23211,9 @@ import { defineCommand as defineCommand44 } from "citty";
|
|
|
23218
23211
|
function asRecord(value) {
|
|
23219
23212
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
23220
23213
|
}
|
|
23221
|
-
function readPath2(row,
|
|
23214
|
+
function readPath2(row, path48) {
|
|
23222
23215
|
let current = row;
|
|
23223
|
-
for (const segment of
|
|
23216
|
+
for (const segment of path48.split(".")) {
|
|
23224
23217
|
const record = asRecord(current);
|
|
23225
23218
|
if (!record) return void 0;
|
|
23226
23219
|
current = record[segment];
|
|
@@ -23230,10 +23223,10 @@ function readPath2(row, path49) {
|
|
|
23230
23223
|
function projectFields(rows, paths) {
|
|
23231
23224
|
return rows.map((row) => {
|
|
23232
23225
|
const projected = {};
|
|
23233
|
-
for (const
|
|
23234
|
-
const value = readPath2(row,
|
|
23226
|
+
for (const path48 of paths) {
|
|
23227
|
+
const value = readPath2(row, path48);
|
|
23235
23228
|
if (value !== void 0) {
|
|
23236
|
-
projected[
|
|
23229
|
+
projected[path48] = value;
|
|
23237
23230
|
}
|
|
23238
23231
|
}
|
|
23239
23232
|
return projected;
|
|
@@ -23246,16 +23239,16 @@ function shapeListRows(rows, args5, compact4) {
|
|
|
23246
23239
|
const paths = fields.split(",").map((field) => field.trim()).filter((field) => field.length > 0);
|
|
23247
23240
|
if (paths.length > 0) {
|
|
23248
23241
|
const projected = projectFields(raw, paths).map((row, i) => {
|
|
23249
|
-
const missing = paths.filter((
|
|
23242
|
+
const missing = paths.filter((path48) => row[path48] === void 0);
|
|
23250
23243
|
const source = rows[i];
|
|
23251
23244
|
if (missing.length === 0 || source === void 0) return row;
|
|
23252
23245
|
const compactRow3 = compact4.row(source);
|
|
23253
|
-
for (const
|
|
23254
|
-
if (compactRow3[
|
|
23246
|
+
for (const path48 of missing) {
|
|
23247
|
+
if (compactRow3[path48] !== void 0) row[path48] = compactRow3[path48];
|
|
23255
23248
|
}
|
|
23256
23249
|
return row;
|
|
23257
23250
|
});
|
|
23258
|
-
const unmatched = paths.filter((
|
|
23251
|
+
const unmatched = paths.filter((path48) => projected.every((row) => row[path48] === void 0));
|
|
23259
23252
|
if (projected.length === 0 || unmatched.length === 0) return { rows: projected, fields: paths };
|
|
23260
23253
|
const carried = /* @__PURE__ */ new Set([...compact4.columns, ...raw.flatMap((row) => Object.keys(row))]);
|
|
23261
23254
|
return {
|
|
@@ -24302,11 +24295,14 @@ Examples:
|
|
|
24302
24295
|
BAKER_META_AD_ACCOUNT_ID=act_123 baker ads meta account`
|
|
24303
24296
|
},
|
|
24304
24297
|
args: {
|
|
24305
|
-
"account-id": {
|
|
24298
|
+
"account-id": {
|
|
24299
|
+
type: "string",
|
|
24300
|
+
description: "Meta ad account ID (act_...); defaults to the only connected account"
|
|
24301
|
+
},
|
|
24306
24302
|
"no-cache": NO_CACHE_ARG
|
|
24307
24303
|
},
|
|
24308
24304
|
run: async ({ args: args5 }) => {
|
|
24309
|
-
const accountId = resolveAccountIdArg(args5);
|
|
24305
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
24310
24306
|
try {
|
|
24311
24307
|
const params = { "account-id": accountId };
|
|
24312
24308
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
@@ -24544,7 +24540,7 @@ function registerMetaListSchema(kind, description, args5) {
|
|
|
24544
24540
|
|
|
24545
24541
|
// src/commands/ads/meta/activities.ts
|
|
24546
24542
|
var listArgs4 = {
|
|
24547
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
24543
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
24548
24544
|
days: { type: "string", description: "Lookback days (default 7)" },
|
|
24549
24545
|
limit: { type: "string", description: "Max rows" },
|
|
24550
24546
|
"no-cache": NO_CACHE_ARG,
|
|
@@ -24573,7 +24569,7 @@ Examples:
|
|
|
24573
24569
|
},
|
|
24574
24570
|
args: listArgs4,
|
|
24575
24571
|
run: async ({ args: args5 }) => {
|
|
24576
|
-
const accountId = resolveAccountIdArg(args5);
|
|
24572
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
24577
24573
|
try {
|
|
24578
24574
|
const params = { "account-id": accountId };
|
|
24579
24575
|
if (args5.days) params.days = args5.days;
|
|
@@ -24625,54 +24621,54 @@ function buildCustomConversionRule(input) {
|
|
|
24625
24621
|
function customConversionRuleRefusal(rule) {
|
|
24626
24622
|
return ruleNodeRefusal(rule, "rule");
|
|
24627
24623
|
}
|
|
24628
|
-
function branchRefusal(key, value,
|
|
24624
|
+
function branchRefusal(key, value, path48) {
|
|
24629
24625
|
if (!Array.isArray(value) || value.length === 0) {
|
|
24630
|
-
return `${
|
|
24626
|
+
return `${path48}.${key} must be a non-empty array of conditions \u2014 an empty one counts every event the pixel sends`;
|
|
24631
24627
|
}
|
|
24632
24628
|
for (const [index, child] of value.entries()) {
|
|
24633
|
-
const refusal = ruleNodeRefusal(child, `${
|
|
24629
|
+
const refusal = ruleNodeRefusal(child, `${path48}.${key}[${index}]`);
|
|
24634
24630
|
if (refusal) {
|
|
24635
24631
|
return refusal;
|
|
24636
24632
|
}
|
|
24637
24633
|
}
|
|
24638
24634
|
return void 0;
|
|
24639
24635
|
}
|
|
24640
|
-
function conditionRefusal(key, value,
|
|
24641
|
-
return key === "and" || key === "or" ? branchRefusal(key, value,
|
|
24636
|
+
function conditionRefusal(key, value, path48) {
|
|
24637
|
+
return key === "and" || key === "or" ? branchRefusal(key, value, path48) : leafRefusal(key, value, path48);
|
|
24642
24638
|
}
|
|
24643
|
-
function ruleNodeRefusal(node,
|
|
24639
|
+
function ruleNodeRefusal(node, path48) {
|
|
24644
24640
|
if (!isRecord2(node)) {
|
|
24645
|
-
return `${
|
|
24641
|
+
return `${path48} must be an object like {"URL":{"i_contains":"/thank-you"}}`;
|
|
24646
24642
|
}
|
|
24647
24643
|
const entries = Object.entries(node);
|
|
24648
24644
|
if (entries.length === 0) {
|
|
24649
|
-
return `${
|
|
24645
|
+
return `${path48} is empty \u2014 a rule with no condition counts every event the pixel sends`;
|
|
24650
24646
|
}
|
|
24651
24647
|
if (entries.length > 1) {
|
|
24652
|
-
return `${
|
|
24648
|
+
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
24649
|
}
|
|
24654
24650
|
for (const [key, value] of entries) {
|
|
24655
|
-
const refusal = conditionRefusal(key, value,
|
|
24651
|
+
const refusal = conditionRefusal(key, value, path48);
|
|
24656
24652
|
if (refusal) {
|
|
24657
24653
|
return refusal;
|
|
24658
24654
|
}
|
|
24659
24655
|
}
|
|
24660
24656
|
return void 0;
|
|
24661
24657
|
}
|
|
24662
|
-
function leafRefusal(field, condition,
|
|
24658
|
+
function leafRefusal(field, condition, path48) {
|
|
24663
24659
|
if (!isRecord2(condition)) {
|
|
24664
|
-
return `${
|
|
24660
|
+
return `${path48}.${field} must be a test like {"i_contains":"/thank-you"}, not a bare value`;
|
|
24665
24661
|
}
|
|
24666
24662
|
const tests = Object.entries(condition);
|
|
24667
24663
|
if (tests.length === 0) {
|
|
24668
|
-
return `${
|
|
24664
|
+
return `${path48}.${field} names no test \u2014 use one of ${Object.keys(RULE_OPERATORS).join(", ")}`;
|
|
24669
24665
|
}
|
|
24670
24666
|
if (tests.length > 1) {
|
|
24671
|
-
return `${
|
|
24667
|
+
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
24668
|
}
|
|
24673
24669
|
for (const [operator] of tests) {
|
|
24674
24670
|
if (!RULE_OPERATORS[operator]) {
|
|
24675
|
-
return `${
|
|
24671
|
+
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
24672
|
}
|
|
24677
24673
|
}
|
|
24678
24674
|
return void 0;
|
|
@@ -25153,8 +25149,7 @@ var LEAD_FORM_CTA_TYPES = [
|
|
|
25153
25149
|
var AD_FORMATS2 = ["SINGLE_IMAGE", "CAROUSEL", "SINGLE_VIDEO"];
|
|
25154
25150
|
var ENROLL_STATUSES = ["OPT_IN", "OPT_OUT"];
|
|
25155
25151
|
var STAGEABLE_CREATE_STATUSES4 = ["ACTIVE", "PAUSED"];
|
|
25156
|
-
var UPDATE_STATUSES = ["ACTIVE", "PAUSED", "ARCHIVED"
|
|
25157
|
-
var CREATIVE_UPDATE_STATUSES = ["ACTIVE", "PAUSED", "ARCHIVED"];
|
|
25152
|
+
var UPDATE_STATUSES = ["ACTIVE", "PAUSED", "ARCHIVED"];
|
|
25158
25153
|
var CUSTOM_AUDIENCE_SUBTYPES = ["CUSTOM", "WEBSITE", "ENGAGEMENT", "LOOKALIKE"];
|
|
25159
25154
|
var CUSTOMER_FILE_SOURCES = [
|
|
25160
25155
|
"USER_PROVIDED_ONLY",
|
|
@@ -25377,7 +25372,7 @@ function positionsMissingRequiredFeed(targeting) {
|
|
|
25377
25372
|
// ../api/src/ads-meta/ops.ts
|
|
25378
25373
|
var tempRefSchema4 = z37.string().regex(TEMP_REF_REGEX4, "expected a meta_temp_* reference");
|
|
25379
25374
|
var parentRefSchema3 = z37.union([z37.string().regex(NUMERIC_ID_REGEX3, "expected a numeric id"), tempRefSchema4]);
|
|
25380
|
-
var moneySchema2 = z37.
|
|
25375
|
+
var moneySchema2 = z37.object({
|
|
25381
25376
|
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
25377
|
currencyCode: z37.string().length(3).optional()
|
|
25383
25378
|
});
|
|
@@ -25388,11 +25383,11 @@ var updateStatusSchema = z37.enum(UPDATE_STATUSES);
|
|
|
25388
25383
|
function currencyMinimums2(currencyCode) {
|
|
25389
25384
|
return CURRENCY_MINIMUMS2[currencyCode] ?? DEFAULT_CURRENCY_MINIMUM2;
|
|
25390
25385
|
}
|
|
25391
|
-
function validateDailyBudgetFloor(money, ctx,
|
|
25386
|
+
function validateDailyBudgetFloor(money, ctx, path48) {
|
|
25392
25387
|
if (money?.currencyCode) {
|
|
25393
25388
|
const min = currencyMinimums2(money.currencyCode).dailyBudgetMin;
|
|
25394
25389
|
if (Number(money.amount) < min) {
|
|
25395
|
-
ctx.addIssue({ code: "custom", path:
|
|
25390
|
+
ctx.addIssue({ code: "custom", path: path48, message: `below the ${min} ${money.currencyCode} daily minimum` });
|
|
25396
25391
|
}
|
|
25397
25392
|
}
|
|
25398
25393
|
}
|
|
@@ -25465,7 +25460,7 @@ function targetingHardLimitsDemographics(t) {
|
|
|
25465
25460
|
return narrowsAgeMax || narrowsAgeMin || narrowsGender;
|
|
25466
25461
|
}
|
|
25467
25462
|
var specialAdCategoriesSchema = z37.array(z37.enum(SPECIAL_AD_CATEGORIES)).default(["NONE"]);
|
|
25468
|
-
var campaignCreateSchema4 = z37.
|
|
25463
|
+
var campaignCreateSchema4 = z37.object({
|
|
25469
25464
|
name: z37.string().min(1).max(META_LIMITS.campaign.nameMax),
|
|
25470
25465
|
objective: z37.enum(OBJECTIVES2),
|
|
25471
25466
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
@@ -25503,7 +25498,7 @@ var campaignCreateSchema4 = z37.strictObject({
|
|
|
25503
25498
|
});
|
|
25504
25499
|
}
|
|
25505
25500
|
});
|
|
25506
|
-
var campaignUpdateSchema4 = z37.
|
|
25501
|
+
var campaignUpdateSchema4 = z37.object({
|
|
25507
25502
|
name: z37.string().min(1).max(META_LIMITS.campaign.nameMax).optional(),
|
|
25508
25503
|
status: updateStatusSchema.optional(),
|
|
25509
25504
|
bid_strategy: z37.enum(BID_STRATEGIES2).optional(),
|
|
@@ -25521,7 +25516,7 @@ var campaignUpdateSchema4 = z37.strictObject({
|
|
|
25521
25516
|
}
|
|
25522
25517
|
validateDailyBudgetFloor(p.dailyBudget, ctx, ["dailyBudget", "amount"]);
|
|
25523
25518
|
});
|
|
25524
|
-
var
|
|
25519
|
+
var promotedObjectSchema = z37.object({
|
|
25525
25520
|
page_id: parentRefSchema3.optional(),
|
|
25526
25521
|
pixel_id: z37.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
25527
25522
|
custom_event_type: z37.enum(CUSTOM_EVENT_TYPES).optional(),
|
|
@@ -25541,12 +25536,9 @@ var promotedObjectFields = {
|
|
|
25541
25536
|
product_set_id: z37.string().regex(NUMERIC_ID_REGEX3).optional(),
|
|
25542
25537
|
whatsapp_phone_number: z37.string().optional(),
|
|
25543
25538
|
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
|
-
});
|
|
25539
|
+
}).partial();
|
|
25548
25540
|
var attributionSpecSchema = z37.array(
|
|
25549
|
-
z37.
|
|
25541
|
+
z37.object({
|
|
25550
25542
|
event_type: z37.enum(ATTRIBUTION_EVENT_TYPES),
|
|
25551
25543
|
window_days: z37.union([z37.literal(1), z37.literal(7), z37.literal(28)])
|
|
25552
25544
|
})
|
|
@@ -25711,7 +25703,7 @@ function validateAdSetPlacements(p, ctx) {
|
|
|
25711
25703
|
ctx.addIssue({ code: "custom", path: ["targeting"], message: `${message} (${PLACEMENT_TARGETING_DOC})` });
|
|
25712
25704
|
}
|
|
25713
25705
|
}
|
|
25714
|
-
var adSetCreateSchema = z37.
|
|
25706
|
+
var adSetCreateSchema = z37.object(adSetFields).superRefine((p, ctx) => {
|
|
25715
25707
|
validateAdSetBudgetAndBid(p, ctx);
|
|
25716
25708
|
validateAdSetPromotedObject(p, ctx);
|
|
25717
25709
|
validateAdvantageAudience(p, ctx);
|
|
@@ -25724,7 +25716,7 @@ var adSetCreateSchema = z37.strictObject(adSetFields).superRefine((p, ctx) => {
|
|
|
25724
25716
|
});
|
|
25725
25717
|
}
|
|
25726
25718
|
});
|
|
25727
|
-
var adSetUpdateSchema = z37.
|
|
25719
|
+
var adSetUpdateSchema = z37.object({
|
|
25728
25720
|
name: adSetFields.name.optional(),
|
|
25729
25721
|
status: updateStatusSchema.optional(),
|
|
25730
25722
|
dailyBudget: moneySchema2.optional(),
|
|
@@ -25754,7 +25746,7 @@ var adSetUpdateSchema = z37.strictObject({
|
|
|
25754
25746
|
var messageSchema = z37.string().min(1).max(META_LIMITS.creative.messageHardMax);
|
|
25755
25747
|
var headlineSchema2 = z37.string().min(1).max(META_LIMITS.creative.headlineMax);
|
|
25756
25748
|
var descriptionSchema = z37.string().min(1).max(META_LIMITS.creative.descriptionMax);
|
|
25757
|
-
var callToActionSchema = z37.
|
|
25749
|
+
var callToActionSchema = z37.object({
|
|
25758
25750
|
type: z37.enum(CTA_TYPES2),
|
|
25759
25751
|
/** Overrides the base link for the CTA button; defaults to the ad's link. */
|
|
25760
25752
|
link: httpsUrlSchema3.optional(),
|
|
@@ -25775,7 +25767,7 @@ var callToActionSchema = z37.strictObject({
|
|
|
25775
25767
|
});
|
|
25776
25768
|
}
|
|
25777
25769
|
});
|
|
25778
|
-
var creativeEnhancementsSchema = z37.
|
|
25770
|
+
var creativeEnhancementsSchema = z37.object({
|
|
25779
25771
|
standardEnhancements: z37.enum(ENROLL_STATUSES).optional(),
|
|
25780
25772
|
features: z37.record(z37.string(), z37.enum(ENROLL_STATUSES)).optional()
|
|
25781
25773
|
});
|
|
@@ -25806,7 +25798,7 @@ function countImageRefs(p) {
|
|
|
25806
25798
|
function countVideoRefs(p) {
|
|
25807
25799
|
return [p.videoId, p.videoRef].filter(Boolean).length;
|
|
25808
25800
|
}
|
|
25809
|
-
var singleCreativeSchema = z37.
|
|
25801
|
+
var singleCreativeSchema = z37.object({
|
|
25810
25802
|
creativeType: z37.literal("single"),
|
|
25811
25803
|
...creativeSharedFields,
|
|
25812
25804
|
/** Primary text. */
|
|
@@ -25840,7 +25832,7 @@ var singleCreativeSchema = z37.strictObject({
|
|
|
25840
25832
|
});
|
|
25841
25833
|
}
|
|
25842
25834
|
});
|
|
25843
|
-
var carouselCardSchema = z37.
|
|
25835
|
+
var carouselCardSchema = z37.object({
|
|
25844
25836
|
link: httpsUrlSchema3,
|
|
25845
25837
|
headline: z37.string().max(META_LIMITS.creative.headlineMax).optional(),
|
|
25846
25838
|
description: z37.string().max(META_LIMITS.creative.descriptionMax).optional(),
|
|
@@ -25863,7 +25855,7 @@ var carouselCardSchema = z37.strictObject({
|
|
|
25863
25855
|
ctx.addIssue({ code: "custom", path: ["videoId"], message: "each card is an image OR a video, not both" });
|
|
25864
25856
|
}
|
|
25865
25857
|
});
|
|
25866
|
-
var carouselCreativeSchema2 = z37.
|
|
25858
|
+
var carouselCreativeSchema2 = z37.object({
|
|
25867
25859
|
creativeType: z37.literal("carousel"),
|
|
25868
25860
|
...creativeSharedFields,
|
|
25869
25861
|
message: messageSchema,
|
|
@@ -25885,19 +25877,19 @@ var carouselCreativeSchema2 = z37.strictObject({
|
|
|
25885
25877
|
});
|
|
25886
25878
|
}
|
|
25887
25879
|
});
|
|
25888
|
-
var dynamicImageSchema = z37.
|
|
25889
|
-
var dynamicVideoSchema = z37.
|
|
25880
|
+
var dynamicImageSchema = z37.object({ ...imageMediaFields }).refine((p) => countImageRefs(p) === 1, "each dynamic image needs exactly one reference");
|
|
25881
|
+
var dynamicVideoSchema = z37.object({
|
|
25890
25882
|
videoId: videoMediaFields.videoId,
|
|
25891
25883
|
videoRef: videoMediaFields.videoRef,
|
|
25892
25884
|
thumbnailHash: videoMediaFields.thumbnailHash
|
|
25893
25885
|
}).refine((p) => countVideoRefs(p) === 1, "each dynamic video needs exactly one reference");
|
|
25894
25886
|
var DYN = META_LIMITS.creative;
|
|
25895
|
-
var dynamicCreativeSchema = z37.
|
|
25887
|
+
var dynamicCreativeSchema = z37.object({
|
|
25896
25888
|
creativeType: z37.literal("dynamic"),
|
|
25897
25889
|
...creativeSharedFields,
|
|
25898
|
-
bodies: z37.array(z37.
|
|
25899
|
-
titles: z37.array(z37.
|
|
25900
|
-
descriptions: z37.array(z37.
|
|
25890
|
+
bodies: z37.array(z37.object({ text: messageSchema })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
25891
|
+
titles: z37.array(z37.object({ text: headlineSchema2 })).min(DYN.dynamicTextsMin).max(DYN.dynamicTextsMax),
|
|
25892
|
+
descriptions: z37.array(z37.object({ text: descriptionSchema })).max(DYN.dynamicTextsMax).optional(),
|
|
25901
25893
|
images: z37.array(dynamicImageSchema).optional(),
|
|
25902
25894
|
videos: z37.array(dynamicVideoSchema).optional(),
|
|
25903
25895
|
/**
|
|
@@ -25913,7 +25905,7 @@ var dynamicCreativeSchema = z37.strictObject({
|
|
|
25913
25905
|
* different enums.
|
|
25914
25906
|
*/
|
|
25915
25907
|
call_to_action: callToActionSchema.optional(),
|
|
25916
|
-
link_urls: z37.array(z37.
|
|
25908
|
+
link_urls: z37.array(z37.object({ website_url: httpsUrlSchema3, display_url: z37.string().optional() })).min(1),
|
|
25917
25909
|
/**
|
|
25918
25910
|
* `asset_feed_spec.optimization_type` — passed through as a free string on
|
|
25919
25911
|
* purpose. Meta's own 400 enumerates ten values and then accepts
|
|
@@ -25944,7 +25936,7 @@ var dynamicCreativeSchema = z37.strictObject({
|
|
|
25944
25936
|
});
|
|
25945
25937
|
});
|
|
25946
25938
|
});
|
|
25947
|
-
var existingPostCreativeSchema = z37.
|
|
25939
|
+
var existingPostCreativeSchema = z37.object({
|
|
25948
25940
|
creativeType: z37.literal("existing_post"),
|
|
25949
25941
|
name: creativeSharedFields.name,
|
|
25950
25942
|
/** "<page_id>_<post_id>" object story id of the post to promote. */
|
|
@@ -25953,7 +25945,7 @@ var existingPostCreativeSchema = z37.strictObject({
|
|
|
25953
25945
|
url_tags: creativeSharedFields.url_tags,
|
|
25954
25946
|
enhancements: creativeSharedFields.enhancements
|
|
25955
25947
|
});
|
|
25956
|
-
var specCreativeSchema = z37.
|
|
25948
|
+
var specCreativeSchema = z37.object({
|
|
25957
25949
|
creativeType: z37.literal("spec"),
|
|
25958
25950
|
name: creativeSharedFields.name,
|
|
25959
25951
|
url_tags: creativeSharedFields.url_tags,
|
|
@@ -25982,29 +25974,29 @@ var creativeContentSchema2 = z37.discriminatedUnion("creativeType", [
|
|
|
25982
25974
|
specCreativeSchema
|
|
25983
25975
|
]);
|
|
25984
25976
|
var adCreativeCreateSchema = creativeContentSchema2;
|
|
25985
|
-
var adCreativeUpdateSchema = z37.
|
|
25977
|
+
var adCreativeUpdateSchema = z37.object({
|
|
25986
25978
|
name: z37.string().max(META_LIMITS.creative.nameMax).optional(),
|
|
25987
|
-
status:
|
|
25979
|
+
status: updateStatusSchema.optional(),
|
|
25988
25980
|
/** Content patch — only honored when the target is a staged meta_temp_* creative. */
|
|
25989
25981
|
content: z37.record(z37.string(), z37.unknown()).optional()
|
|
25990
25982
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
25991
|
-
var adCreateSchema2 = z37.
|
|
25983
|
+
var adCreateSchema2 = z37.object({
|
|
25992
25984
|
name: z37.string().min(1).max(META_LIMITS.ad.nameMax),
|
|
25993
25985
|
adset_id: parentRefSchema3,
|
|
25994
25986
|
status: stageableStatusSchema3.default("PAUSED"),
|
|
25995
|
-
creative: z37.
|
|
25987
|
+
creative: z37.object({ creative_id: parentRefSchema3 }),
|
|
25996
25988
|
/** Conversion pixel / offline event set / view tags — structural passthrough. */
|
|
25997
25989
|
tracking_specs: z37.array(z37.record(z37.string(), z37.unknown())).optional()
|
|
25998
25990
|
});
|
|
25999
|
-
var adUpdateSchema2 = z37.
|
|
25991
|
+
var adUpdateSchema2 = z37.object({
|
|
26000
25992
|
name: z37.string().min(1).max(META_LIMITS.ad.nameMax).optional(),
|
|
26001
25993
|
status: updateStatusSchema.optional(),
|
|
26002
25994
|
/** Swapping the creative is the Meta way to "edit" an ad's creative. */
|
|
26003
|
-
creative: z37.
|
|
25995
|
+
creative: z37.object({ creative_id: parentRefSchema3 }).optional(),
|
|
26004
25996
|
tracking_specs: z37.array(z37.record(z37.string(), z37.unknown())).optional()
|
|
26005
25997
|
}).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.
|
|
25998
|
+
var lookalikeSpecSchema = z37.object({
|
|
25999
|
+
origin: z37.array(z37.object({ id: parentRefSchema3 })).min(1),
|
|
26008
26000
|
ratio: z37.number().min(0.01).max(0.2).optional(),
|
|
26009
26001
|
country: z37.string().length(2).optional()
|
|
26010
26002
|
});
|
|
@@ -26022,7 +26014,7 @@ function mixedEventSourceTypes(rule) {
|
|
|
26022
26014
|
const distinct = [...new Set(types)].sort();
|
|
26023
26015
|
return distinct.length > 1 ? distinct : [];
|
|
26024
26016
|
}
|
|
26025
|
-
var customAudienceCreateSchema = z37.
|
|
26017
|
+
var customAudienceCreateSchema = z37.object({
|
|
26026
26018
|
name: z37.string().min(1).max(META_LIMITS.audience.nameMax),
|
|
26027
26019
|
subtype: z37.enum(CUSTOM_AUDIENCE_SUBTYPES),
|
|
26028
26020
|
description: z37.string().max(500).optional(),
|
|
@@ -26054,11 +26046,11 @@ var customAudienceCreateSchema = z37.strictObject({
|
|
|
26054
26046
|
});
|
|
26055
26047
|
}
|
|
26056
26048
|
});
|
|
26057
|
-
var customAudienceUpdateSchema = z37.
|
|
26049
|
+
var customAudienceUpdateSchema = z37.object({
|
|
26058
26050
|
name: z37.string().min(1).max(META_LIMITS.audience.nameMax).optional(),
|
|
26059
26051
|
description: z37.string().max(500).optional()
|
|
26060
26052
|
}).refine((p) => Object.values(p).some((val) => val !== void 0), "update needs at least one field");
|
|
26061
|
-
var customConversionCreateSchema = z37.
|
|
26053
|
+
var customConversionCreateSchema = z37.object({
|
|
26062
26054
|
name: z37.string().min(1).max(META_LIMITS.customConversion.nameMax),
|
|
26063
26055
|
description: z37.string().max(META_LIMITS.customConversion.descriptionMax).optional(),
|
|
26064
26056
|
/** 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 +26066,7 @@ var customConversionCreateSchema = z37.strictObject({
|
|
|
26074
26066
|
ctx.addIssue({ code: "custom", path: ["rule"], message: refusal });
|
|
26075
26067
|
}
|
|
26076
26068
|
});
|
|
26077
|
-
var mediaUploadSchema = z37.
|
|
26069
|
+
var mediaUploadSchema = z37.object({
|
|
26078
26070
|
kind: z37.enum(MEDIA_KINDS),
|
|
26079
26071
|
bakerImageId: bakerMediaIdSchema2.optional(),
|
|
26080
26072
|
bakerVideoId: bakerMediaIdSchema2.optional(),
|
|
@@ -26250,33 +26242,26 @@ import { defineCommand as defineCommand57 } from "citty";
|
|
|
26250
26242
|
|
|
26251
26243
|
// src/commands/ads/meta/write-shared.ts
|
|
26252
26244
|
import { readFileSync as readFileSync9 } from "fs";
|
|
26253
|
-
function bareAccountId2(args5) {
|
|
26254
|
-
return resolveAccountIdArg(args5).replace(/^act_/, "");
|
|
26245
|
+
async function bareAccountId2(args5) {
|
|
26246
|
+
return (await resolveAccountIdArg(args5)).replace(/^act_/, "");
|
|
26255
26247
|
}
|
|
26256
26248
|
function failWriteValidation3(message) {
|
|
26257
26249
|
writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
|
|
26258
26250
|
process.exit(1);
|
|
26259
26251
|
}
|
|
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) {
|
|
26252
|
+
function loadJsonFileArg3(path48) {
|
|
26253
|
+
if (typeof path48 !== "string" || path48.length === 0) {
|
|
26269
26254
|
return {};
|
|
26270
26255
|
}
|
|
26271
26256
|
try {
|
|
26272
|
-
const parsed = JSON.parse(readFileSync9(
|
|
26257
|
+
const parsed = JSON.parse(readFileSync9(path48, "utf8"));
|
|
26273
26258
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
26274
|
-
failWriteValidation3(`${
|
|
26259
|
+
failWriteValidation3(`${path48} must contain a JSON object`);
|
|
26275
26260
|
}
|
|
26276
26261
|
return parsed;
|
|
26277
26262
|
} catch (err) {
|
|
26278
26263
|
if (err instanceof SyntaxError) {
|
|
26279
|
-
failWriteValidation3(`${
|
|
26264
|
+
failWriteValidation3(`${path48} is not valid JSON: ${err.message}`);
|
|
26280
26265
|
}
|
|
26281
26266
|
throw err;
|
|
26282
26267
|
}
|
|
@@ -26384,7 +26369,7 @@ async function stageStatusChange2(input) {
|
|
|
26384
26369
|
// src/commands/ads/meta/write-commands.ts
|
|
26385
26370
|
var STAGED_NOTE2 = "Staged until publish \u2014 review with `baker ads meta draft`.";
|
|
26386
26371
|
var accountArgs2 = {
|
|
26387
|
-
"account-id": { type: "string", description: "Numeric account ID or act_N" }
|
|
26372
|
+
"account-id": { type: "string", description: "Numeric account ID or act_N; defaults to the only connected account" }
|
|
26388
26373
|
};
|
|
26389
26374
|
function campaignPayloadFromFlags2(args5) {
|
|
26390
26375
|
return {
|
|
@@ -26440,7 +26425,7 @@ Example: baker ads meta campaigns create --name "Q3 Prospecting" --objective OUT
|
|
|
26440
26425
|
file: { type: "string", description: "JSON file with the full payload; flags override file keys" }
|
|
26441
26426
|
},
|
|
26442
26427
|
run: async ({ args: args5 }) => {
|
|
26443
|
-
const accountId = bareAccountId2(args5);
|
|
26428
|
+
const accountId = await bareAccountId2(args5);
|
|
26444
26429
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), campaignPayloadFromFlags2(args5));
|
|
26445
26430
|
await stageOp2({ kind: "campaign.create", accountId, payload });
|
|
26446
26431
|
}
|
|
@@ -26460,7 +26445,7 @@ Pass a meta_temp_* ref to amend a campaign staged in this chat. Example: baker a
|
|
|
26460
26445
|
file: { type: "string", description: "JSON file with fields to change" }
|
|
26461
26446
|
},
|
|
26462
26447
|
run: async ({ args: args5 }) => {
|
|
26463
|
-
const accountId = bareAccountId2(args5);
|
|
26448
|
+
const accountId = await bareAccountId2(args5);
|
|
26464
26449
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), {
|
|
26465
26450
|
name: args5.name,
|
|
26466
26451
|
status: upper(args5.status),
|
|
@@ -26471,7 +26456,6 @@ Pass a meta_temp_* ref to amend a campaign staged in this chat. Example: baker a
|
|
|
26471
26456
|
start_time: parseDateFlag2(args5.start, "--start"),
|
|
26472
26457
|
stop_time: parseDateFlag2(args5.stop, "--stop")
|
|
26473
26458
|
});
|
|
26474
|
-
refuseDeleteByUpdate(payload, "campaigns");
|
|
26475
26459
|
await stageOp2({
|
|
26476
26460
|
kind: "campaign.update",
|
|
26477
26461
|
accountId,
|
|
@@ -26554,7 +26538,7 @@ Example: baker ads meta custom-conversions create --name "Lead formulario" --pix
|
|
|
26554
26538
|
value: { type: "string", description: "Default value of one conversion, when the site sends no value" }
|
|
26555
26539
|
},
|
|
26556
26540
|
run: async ({ args: args5 }) => {
|
|
26557
|
-
const accountId = bareAccountId2(args5);
|
|
26541
|
+
const accountId = await bareAccountId2(args5);
|
|
26558
26542
|
await stageOp2({
|
|
26559
26543
|
kind: "customConversion.create",
|
|
26560
26544
|
accountId,
|
|
@@ -26611,7 +26595,7 @@ Example: baker ads meta adsets create --campaign meta_temp_ab12 --name "US 25-54
|
|
|
26611
26595
|
},
|
|
26612
26596
|
args: { campaign: { type: "string", description: "Parent campaign id or meta_temp_* ref" }, ...adSetWriteArgs },
|
|
26613
26597
|
run: async ({ args: args5 }) => {
|
|
26614
|
-
const accountId = bareAccountId2(args5);
|
|
26598
|
+
const accountId = await bareAccountId2(args5);
|
|
26615
26599
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), adSetPayloadFromFlags(args5));
|
|
26616
26600
|
await stageOp2({ kind: "adSet.create", accountId, payload });
|
|
26617
26601
|
}
|
|
@@ -26625,14 +26609,13 @@ Example: baker ads meta adsets update 6123 --daily-budget 80`
|
|
|
26625
26609
|
},
|
|
26626
26610
|
args: { id: { type: "positional", description: "Ad set id or meta_temp_* ref", required: true }, ...adSetWriteArgs },
|
|
26627
26611
|
run: async ({ args: args5 }) => {
|
|
26628
|
-
const accountId = bareAccountId2(args5);
|
|
26612
|
+
const accountId = await bareAccountId2(args5);
|
|
26629
26613
|
const {
|
|
26630
26614
|
campaign_id: _drop,
|
|
26631
26615
|
billing_event: _be,
|
|
26632
26616
|
...payload
|
|
26633
26617
|
} = adSetPayloadFromFlags(args5);
|
|
26634
26618
|
const merged = mergePayload3(loadJsonFileArg3(args5.file), payload);
|
|
26635
|
-
refuseDeleteByUpdate(merged, "adsets");
|
|
26636
26619
|
await stageOp2({
|
|
26637
26620
|
kind: "adSet.update",
|
|
26638
26621
|
accountId,
|
|
@@ -26728,7 +26711,7 @@ Example: baker ads meta creatives create --page 555 --message "Save now" --link
|
|
|
26728
26711
|
file: { type: "string", description: "JSON file with the full creative payload (carousel cards / dynamic assets)" }
|
|
26729
26712
|
},
|
|
26730
26713
|
run: async ({ args: args5 }) => {
|
|
26731
|
-
const accountId = bareAccountId2(args5);
|
|
26714
|
+
const accountId = await bareAccountId2(args5);
|
|
26732
26715
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), creativePayloadFromFlags(args5));
|
|
26733
26716
|
if (payload.creativeType === void 0) {
|
|
26734
26717
|
payload.creativeType = "single";
|
|
@@ -26759,7 +26742,7 @@ Amending a staged (meta_temp_*) creative merges fields into the create. Example:
|
|
|
26759
26742
|
}
|
|
26760
26743
|
},
|
|
26761
26744
|
run: async ({ args: args5 }) => {
|
|
26762
|
-
const accountId = bareAccountId2(args5);
|
|
26745
|
+
const accountId = await bareAccountId2(args5);
|
|
26763
26746
|
const file = loadJsonFileArg3(args5.file);
|
|
26764
26747
|
const payload = mergePayload3(file, {
|
|
26765
26748
|
name: args5.name,
|
|
@@ -26793,7 +26776,7 @@ Example: baker ads meta ads create --name "Ad 1" --adset meta_temp_as01 --creati
|
|
|
26793
26776
|
file: { type: "string", description: "JSON file with the full payload" }
|
|
26794
26777
|
},
|
|
26795
26778
|
run: async ({ args: args5 }) => {
|
|
26796
|
-
const accountId = bareAccountId2(args5);
|
|
26779
|
+
const accountId = await bareAccountId2(args5);
|
|
26797
26780
|
const tracking = args5["tracking-file"] ? loadJsonFileArg3(args5["tracking-file"]).tracking_specs : void 0;
|
|
26798
26781
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), {
|
|
26799
26782
|
name: args5.name,
|
|
@@ -26820,13 +26803,12 @@ Example: baker ads meta ads update 6123 --creative meta_temp_cr02`
|
|
|
26820
26803
|
file: { type: "string", description: "JSON file with fields to change" }
|
|
26821
26804
|
},
|
|
26822
26805
|
run: async ({ args: args5 }) => {
|
|
26823
|
-
const accountId = bareAccountId2(args5);
|
|
26806
|
+
const accountId = await bareAccountId2(args5);
|
|
26824
26807
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), {
|
|
26825
26808
|
name: args5.name,
|
|
26826
26809
|
status: upper(args5.status),
|
|
26827
26810
|
creative: args5.creative ? { creative_id: String(args5.creative) } : void 0
|
|
26828
26811
|
});
|
|
26829
|
-
refuseDeleteByUpdate(payload, "ads");
|
|
26830
26812
|
await stageOp2({
|
|
26831
26813
|
kind: "ad.update",
|
|
26832
26814
|
accountId,
|
|
@@ -26857,9 +26839,9 @@ Example: baker ads meta ads retag 120252158038400247 --url-tags "utm_source={{si
|
|
|
26857
26839
|
const { apiPost: apiPost2 } = await import("./client-GR6YL3YX.js");
|
|
26858
26840
|
const { requireChatId: requireChatId2 } = await import("./env-4P5HOGNA.js");
|
|
26859
26841
|
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-NMQXZF3Z.js");
|
|
26860
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
26842
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-TD76Z3W2.js");
|
|
26861
26843
|
try {
|
|
26862
|
-
const accountId = bareAccountId2(args5);
|
|
26844
|
+
const accountId = await bareAccountId2(args5);
|
|
26863
26845
|
const urlTags = typeof args5["url-tags"] === "string" ? args5["url-tags"] : void 0;
|
|
26864
26846
|
const setRaw = typeof args5.set === "string" ? args5.set : void 0;
|
|
26865
26847
|
if (urlTags === void 0 === (setRaw === void 0)) {
|
|
@@ -26913,7 +26895,7 @@ Example: baker ads meta audiences create --name "Site visitors 30d" --subtype WE
|
|
|
26913
26895
|
file: { type: "string", description: "JSON file with lookalike_spec / rule / full payload" }
|
|
26914
26896
|
},
|
|
26915
26897
|
run: async ({ args: args5 }) => {
|
|
26916
|
-
const accountId = bareAccountId2(args5);
|
|
26898
|
+
const accountId = await bareAccountId2(args5);
|
|
26917
26899
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), {
|
|
26918
26900
|
name: args5.name,
|
|
26919
26901
|
subtype: upper(args5.subtype),
|
|
@@ -26936,7 +26918,7 @@ var audiencesUpdateCommand = defineCommand57({
|
|
|
26936
26918
|
file: { type: "string", description: "JSON file with fields to change" }
|
|
26937
26919
|
},
|
|
26938
26920
|
run: async ({ args: args5 }) => {
|
|
26939
|
-
const accountId = bareAccountId2(args5);
|
|
26921
|
+
const accountId = await bareAccountId2(args5);
|
|
26940
26922
|
const payload = mergePayload3(loadJsonFileArg3(args5.file), { name: args5.name, description: args5.description });
|
|
26941
26923
|
await stageOp2({
|
|
26942
26924
|
kind: "customAudience.update",
|
|
@@ -26960,7 +26942,7 @@ Example: baker ads meta media upload --kind image --image-id <bakerImageId>`
|
|
|
26960
26942
|
name: { type: "string", description: "Display name / filename hint" }
|
|
26961
26943
|
},
|
|
26962
26944
|
run: async ({ args: args5 }) => {
|
|
26963
|
-
const accountId = bareAccountId2(args5);
|
|
26945
|
+
const accountId = await bareAccountId2(args5);
|
|
26964
26946
|
const kind = String(args5.kind ?? "").toLowerCase();
|
|
26965
26947
|
if (kind !== "image" && kind !== "video") {
|
|
26966
26948
|
failWriteValidation3("--kind must be image or video");
|
|
@@ -26972,19 +26954,13 @@ Example: baker ads meta media upload --kind image --image-id <bakerImageId>`
|
|
|
26972
26954
|
});
|
|
26973
26955
|
}
|
|
26974
26956
|
});
|
|
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
26957
|
function statusCommand3(name, kind, label) {
|
|
26981
|
-
const status =
|
|
26982
|
-
const note = STATUS_COMMAND_NOTE[name];
|
|
26958
|
+
const status = name === "pause" ? "PAUSED" : name === "resume" ? "ACTIVE" : "ARCHIVED";
|
|
26983
26959
|
return defineCommand57({
|
|
26984
|
-
meta: { name, description: `Stage ${name} for a ${label}. ${
|
|
26960
|
+
meta: { name, description: `Stage ${name} for a ${label}. ${STAGED_NOTE2}` },
|
|
26985
26961
|
args: { id: { type: "positional", description: `${label} id`, required: true }, ...accountArgs2 },
|
|
26986
26962
|
run: async ({ args: args5 }) => {
|
|
26987
|
-
const accountId = bareAccountId2(args5);
|
|
26963
|
+
const accountId = await bareAccountId2(args5);
|
|
26988
26964
|
await stageStatusChange2({
|
|
26989
26965
|
kind,
|
|
26990
26966
|
accountId,
|
|
@@ -27011,9 +26987,9 @@ function duplicateCommand2(entity, label) {
|
|
|
27011
26987
|
const { apiPost: apiPost2 } = await import("./client-GR6YL3YX.js");
|
|
27012
26988
|
const { requireChatId: requireChatId2 } = await import("./env-4P5HOGNA.js");
|
|
27013
26989
|
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-NMQXZF3Z.js");
|
|
27014
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
26990
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-TD76Z3W2.js");
|
|
27015
26991
|
try {
|
|
27016
|
-
const accountId = bareAccountId2(args5);
|
|
26992
|
+
const accountId = await bareAccountId2(args5);
|
|
27017
26993
|
const chatId = requireChatId2();
|
|
27018
26994
|
const response = await apiPost2("/api/ads/meta/draft/duplicate", {
|
|
27019
26995
|
chatId,
|
|
@@ -27033,22 +27009,19 @@ function duplicateCommand2(entity, label) {
|
|
|
27033
27009
|
var campaignsPauseCommand2 = statusCommand3("pause", "campaign.update", "campaign");
|
|
27034
27010
|
var campaignsResumeCommand2 = statusCommand3("resume", "campaign.update", "campaign");
|
|
27035
27011
|
var campaignsArchiveCommand2 = statusCommand3("archive", "campaign.update", "campaign");
|
|
27036
|
-
var campaignsDeleteCommand = statusCommand3("delete", "campaign.update", "campaign");
|
|
27037
27012
|
var campaignsDuplicateCommand2 = duplicateCommand2("campaign", "campaign");
|
|
27038
27013
|
var adSetsPauseCommand = statusCommand3("pause", "adSet.update", "ad set");
|
|
27039
27014
|
var adSetsResumeCommand = statusCommand3("resume", "adSet.update", "ad set");
|
|
27040
27015
|
var adSetsArchiveCommand = statusCommand3("archive", "adSet.update", "ad set");
|
|
27041
|
-
var adSetsDeleteCommand = statusCommand3("delete", "adSet.update", "ad set");
|
|
27042
27016
|
var adSetsDuplicateCommand = duplicateCommand2("adSet", "ad set");
|
|
27043
27017
|
var adsPauseCommand = statusCommand3("pause", "ad.update", "ad");
|
|
27044
27018
|
var adsResumeCommand = statusCommand3("resume", "ad.update", "ad");
|
|
27045
27019
|
var adsArchiveCommand = statusCommand3("archive", "ad.update", "ad");
|
|
27046
|
-
var adsDeleteCommand = statusCommand3("delete", "ad.update", "ad");
|
|
27047
27020
|
var adsDuplicateCommand = duplicateCommand2("ad", "ad");
|
|
27048
27021
|
|
|
27049
27022
|
// src/commands/ads/meta/ads.ts
|
|
27050
27023
|
var listArgs5 = {
|
|
27051
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27024
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27052
27025
|
"adset-id": { type: "string", description: "Filter to one adset" },
|
|
27053
27026
|
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
27054
27027
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
@@ -27070,7 +27043,7 @@ var listCommand4 = defineCommand58({
|
|
|
27070
27043
|
},
|
|
27071
27044
|
args: listArgs5,
|
|
27072
27045
|
run: async ({ args: args5 }) => {
|
|
27073
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27046
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27074
27047
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
27075
27048
|
try {
|
|
27076
27049
|
const params = { "account-id": accountId };
|
|
@@ -27091,7 +27064,7 @@ var listCommand4 = defineCommand58({
|
|
|
27091
27064
|
var adsListCommand = defineCommand58({
|
|
27092
27065
|
meta: {
|
|
27093
27066
|
name: "ads",
|
|
27094
|
-
description: `List ads in a Meta ad account, or stage writes (create/update/pause/resume/archive/
|
|
27067
|
+
description: `List ads in a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate/retag).
|
|
27095
27068
|
Defaults to ACTIVE only \u2014 pass --all-statuses to widen. Write subcommands stage ops on this chat's draft.
|
|
27096
27069
|
|
|
27097
27070
|
The dashboard shows effective_status (e.g. WITH_ISSUES, PENDING_REVIEW, DISAPPROVED, ADSET_PAUSED), not status.
|
|
@@ -27116,7 +27089,6 @@ Examples:
|
|
|
27116
27089
|
pause: adsPauseCommand,
|
|
27117
27090
|
resume: adsResumeCommand,
|
|
27118
27091
|
archive: adsArchiveCommand,
|
|
27119
|
-
delete: adsDeleteCommand,
|
|
27120
27092
|
duplicate: adsDuplicateCommand,
|
|
27121
27093
|
retag: adsRetagCommand
|
|
27122
27094
|
},
|
|
@@ -27131,7 +27103,7 @@ Examples:
|
|
|
27131
27103
|
// src/commands/ads/meta/adsets.ts
|
|
27132
27104
|
import { defineCommand as defineCommand59 } from "citty";
|
|
27133
27105
|
var listArgs6 = {
|
|
27134
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27106
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27135
27107
|
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
27136
27108
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
27137
27109
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
|
|
@@ -27152,7 +27124,7 @@ var listCommand5 = defineCommand59({
|
|
|
27152
27124
|
},
|
|
27153
27125
|
args: listArgs6,
|
|
27154
27126
|
run: async ({ args: args5 }) => {
|
|
27155
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27127
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27156
27128
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
27157
27129
|
try {
|
|
27158
27130
|
const params = { "account-id": accountId };
|
|
@@ -27172,7 +27144,7 @@ var listCommand5 = defineCommand59({
|
|
|
27172
27144
|
var adsetsCommand = defineCommand59({
|
|
27173
27145
|
meta: {
|
|
27174
27146
|
name: "adsets",
|
|
27175
|
-
description: `List ad sets in a Meta ad account, or stage writes (create/update/pause/resume/archive/
|
|
27147
|
+
description: `List ad sets in a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate).
|
|
27176
27148
|
Defaults to ACTIVE only. Write subcommands stage ops on this chat's draft.
|
|
27177
27149
|
|
|
27178
27150
|
Listings print a table by default: id, name, campaign_id, effective_status, optimization_goal, billing_event,
|
|
@@ -27193,7 +27165,6 @@ Examples:
|
|
|
27193
27165
|
pause: adSetsPauseCommand,
|
|
27194
27166
|
resume: adSetsResumeCommand,
|
|
27195
27167
|
archive: adSetsArchiveCommand,
|
|
27196
|
-
delete: adSetsDeleteCommand,
|
|
27197
27168
|
duplicate: adSetsDuplicateCommand
|
|
27198
27169
|
},
|
|
27199
27170
|
// `args` stays even though the parent has no `run`: citty scans rawArgs for the
|
|
@@ -27207,7 +27178,7 @@ Examples:
|
|
|
27207
27178
|
// src/commands/ads/meta/audiences.ts
|
|
27208
27179
|
import { defineCommand as defineCommand60 } from "citty";
|
|
27209
27180
|
var listArgs7 = {
|
|
27210
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27181
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27211
27182
|
limit: { type: "string", description: "Max rows" },
|
|
27212
27183
|
"no-cache": NO_CACHE_ARG,
|
|
27213
27184
|
output: { type: "string", description: "Output format", default: "json" }
|
|
@@ -27219,7 +27190,7 @@ var listCommand6 = defineCommand60({
|
|
|
27219
27190
|
},
|
|
27220
27191
|
args: listArgs7,
|
|
27221
27192
|
run: async ({ args: args5 }) => {
|
|
27222
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27193
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27223
27194
|
try {
|
|
27224
27195
|
const params = { "account-id": accountId };
|
|
27225
27196
|
if (args5.limit) params.limit = args5.limit;
|
|
@@ -27293,7 +27264,7 @@ Examples:
|
|
|
27293
27264
|
// src/commands/ads/meta/campaigns.ts
|
|
27294
27265
|
import { defineCommand as defineCommand62 } from "citty";
|
|
27295
27266
|
var listArgs8 = {
|
|
27296
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27267
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27297
27268
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
27298
27269
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter and return everything" },
|
|
27299
27270
|
"name-contains": NAME_CONTAINS_ARG,
|
|
@@ -27313,7 +27284,7 @@ var listCommand7 = defineCommand62({
|
|
|
27313
27284
|
},
|
|
27314
27285
|
args: listArgs8,
|
|
27315
27286
|
run: async ({ args: args5 }) => {
|
|
27316
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27287
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27317
27288
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
27318
27289
|
try {
|
|
27319
27290
|
const params = { "account-id": accountId };
|
|
@@ -27332,7 +27303,7 @@ var listCommand7 = defineCommand62({
|
|
|
27332
27303
|
var campaignsCommand3 = defineCommand62({
|
|
27333
27304
|
meta: {
|
|
27334
27305
|
name: "campaigns",
|
|
27335
|
-
description: `List campaigns for a Meta ad account, or stage writes (create/update/pause/resume/archive/
|
|
27306
|
+
description: `List campaigns for a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate).
|
|
27336
27307
|
Defaults to ACTIVE only \u2014 pass --all-statuses to widen. Write subcommands stage ops on this chat's draft and
|
|
27337
27308
|
apply only when the chat is published.
|
|
27338
27309
|
|
|
@@ -27359,7 +27330,6 @@ Examples:
|
|
|
27359
27330
|
pause: campaignsPauseCommand2,
|
|
27360
27331
|
resume: campaignsResumeCommand2,
|
|
27361
27332
|
archive: campaignsArchiveCommand2,
|
|
27362
|
-
delete: campaignsDeleteCommand,
|
|
27363
27333
|
duplicate: campaignsDuplicateCommand2
|
|
27364
27334
|
},
|
|
27365
27335
|
// `args` stays even though the parent has no `run`: citty scans rawArgs for the
|
|
@@ -27373,7 +27343,10 @@ Examples:
|
|
|
27373
27343
|
// src/commands/ads/meta/creatives.ts
|
|
27374
27344
|
import { defineCommand as defineCommand63 } from "citty";
|
|
27375
27345
|
var listArgs9 = {
|
|
27376
|
-
"account-id": {
|
|
27346
|
+
"account-id": {
|
|
27347
|
+
type: "string",
|
|
27348
|
+
description: "Meta ad account ID (act_...) when listing without --creative-id; defaults to the only connected account"
|
|
27349
|
+
},
|
|
27377
27350
|
"creative-id": { type: "string", description: "Single creative ID" },
|
|
27378
27351
|
limit: { type: "string", description: "Max rows (default 500)" },
|
|
27379
27352
|
"no-cache": NO_CACHE_ARG,
|
|
@@ -27391,7 +27364,7 @@ var listCommand8 = defineCommand63({
|
|
|
27391
27364
|
if (args5["creative-id"]) {
|
|
27392
27365
|
params["creative-id"] = args5["creative-id"];
|
|
27393
27366
|
} else {
|
|
27394
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27367
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27395
27368
|
params["account-id"] = accountId;
|
|
27396
27369
|
}
|
|
27397
27370
|
if (args5.limit) params.limit = args5.limit;
|
|
@@ -27471,7 +27444,11 @@ registerSchema({
|
|
|
27471
27444
|
command: "ads.meta.custom-conversions",
|
|
27472
27445
|
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
27446
|
args: {
|
|
27474
|
-
"account-id": {
|
|
27447
|
+
"account-id": {
|
|
27448
|
+
type: "string",
|
|
27449
|
+
description: "Meta ad account ID (act_...); defaults to the only connected account",
|
|
27450
|
+
required: false
|
|
27451
|
+
},
|
|
27475
27452
|
full: { type: "boolean", description: "Include the raw rule JSON, retention and creation times", required: false },
|
|
27476
27453
|
limit: { type: "string", description: "Max rows", required: false },
|
|
27477
27454
|
"no-cache": { type: "boolean", description: "Bypass the cache", required: false },
|
|
@@ -27479,7 +27456,7 @@ registerSchema({
|
|
|
27479
27456
|
}
|
|
27480
27457
|
});
|
|
27481
27458
|
var listArgs10 = {
|
|
27482
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27459
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...); defaults to the only connected account" },
|
|
27483
27460
|
full: { type: "boolean", description: "Include the raw rule JSON, retention and creation times" },
|
|
27484
27461
|
limit: { type: "string", description: "Max rows" },
|
|
27485
27462
|
"no-cache": NO_CACHE_ARG,
|
|
@@ -27492,7 +27469,7 @@ var listCommand9 = defineCommand64({
|
|
|
27492
27469
|
},
|
|
27493
27470
|
args: listArgs10,
|
|
27494
27471
|
run: async ({ args: args5 }) => {
|
|
27495
|
-
const accountId = resolveAccountIdArg(args5);
|
|
27472
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
27496
27473
|
try {
|
|
27497
27474
|
const params = { "account-id": accountId };
|
|
27498
27475
|
if (args5.limit) params.limit = args5.limit;
|
|
@@ -28369,7 +28346,10 @@ Examples:
|
|
|
28369
28346
|
baker ads meta pixels --account-id act_123 --pixel-id 9876 --stats --days 7`
|
|
28370
28347
|
},
|
|
28371
28348
|
args: {
|
|
28372
|
-
"account-id": {
|
|
28349
|
+
"account-id": {
|
|
28350
|
+
type: "string",
|
|
28351
|
+
description: "Meta ad account ID (act_...); defaults to the only connected account"
|
|
28352
|
+
},
|
|
28373
28353
|
"pixel-id": { type: "string", description: "Pixel ID for --stats" },
|
|
28374
28354
|
stats: { type: "boolean", description: "Fetch firing stats for the pixel" },
|
|
28375
28355
|
aggregation: {
|
|
@@ -28413,7 +28393,7 @@ async function runStats(args5) {
|
|
|
28413
28393
|
emit(data, args5);
|
|
28414
28394
|
}
|
|
28415
28395
|
async function runList(args5) {
|
|
28416
|
-
const accountId = resolveAccountIdArg(args5);
|
|
28396
|
+
const accountId = await resolveAccountIdArg(args5);
|
|
28417
28397
|
const params = { "account-id": accountId };
|
|
28418
28398
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
28419
28399
|
const { pixels, restrictedFields } = await apiGet("/api/ads/meta/pixels", params);
|
|
@@ -31972,12 +31952,12 @@ function flowExists(slug) {
|
|
|
31972
31952
|
return existsSync3(join2(flowsDir(), slug, "_data.json"));
|
|
31973
31953
|
}
|
|
31974
31954
|
function readFlowTree(slug) {
|
|
31975
|
-
const
|
|
31976
|
-
if (!existsSync3(
|
|
31955
|
+
const path48 = join2(flowsDir(), slug, "_data.json");
|
|
31956
|
+
if (!existsSync3(path48)) {
|
|
31977
31957
|
failLocal(`No form "${slug}". Run "baker flows list" to see the forms in this workspace.`);
|
|
31978
31958
|
}
|
|
31979
31959
|
try {
|
|
31980
|
-
return JSON.parse(readFileSync11(
|
|
31960
|
+
return JSON.parse(readFileSync11(path48, "utf-8"));
|
|
31981
31961
|
} catch (error) {
|
|
31982
31962
|
failLocal(`Could not read form "${slug}": ${error instanceof Error ? error.message : String(error)}`);
|
|
31983
31963
|
}
|
|
@@ -32937,12 +32917,12 @@ function readPeopleFile(args5) {
|
|
|
32937
32917
|
}
|
|
32938
32918
|
function unreadablePeopleFile(args5) {
|
|
32939
32919
|
if (!args5["people-file"]) return void 0;
|
|
32940
|
-
const
|
|
32920
|
+
const path48 = String(args5["people-file"]);
|
|
32941
32921
|
try {
|
|
32942
|
-
readFileSync12(
|
|
32922
|
+
readFileSync12(path48, "utf8");
|
|
32943
32923
|
return void 0;
|
|
32944
32924
|
} catch {
|
|
32945
|
-
return `Couldn't read --people-file ${
|
|
32925
|
+
return `Couldn't read --people-file ${path48}. Check the path, or pass the people inline with --person.`;
|
|
32946
32926
|
}
|
|
32947
32927
|
}
|
|
32948
32928
|
function peopleLimitError(args5) {
|
|
@@ -33914,11 +33894,11 @@ function parseFieldArgs(argv) {
|
|
|
33914
33894
|
for (const pair of parseRepeated(argv, "--field")) {
|
|
33915
33895
|
const eq = pair.indexOf("=");
|
|
33916
33896
|
const field = eq === -1 ? pair : pair.slice(0, eq);
|
|
33917
|
-
const
|
|
33897
|
+
const path48 = eq === -1 ? "" : pair.slice(eq + 1).trim();
|
|
33918
33898
|
const problem = mappingRowProblem(field);
|
|
33919
33899
|
if (problem !== null) throw new ConversionArgsError(problem);
|
|
33920
|
-
if (
|
|
33921
|
-
mapping[field] =
|
|
33900
|
+
if (path48 === "") throw new ConversionArgsError(`--field ${field} needs a path: --field ${field}=<dotted.path>.`);
|
|
33901
|
+
mapping[field] = path48;
|
|
33922
33902
|
}
|
|
33923
33903
|
return mapping;
|
|
33924
33904
|
}
|
|
@@ -35520,11 +35500,11 @@ function unwrap(response) {
|
|
|
35520
35500
|
}
|
|
35521
35501
|
return response.data;
|
|
35522
35502
|
}
|
|
35523
|
-
async function readAvatars(
|
|
35524
|
-
return unwrap(await apiGet(
|
|
35503
|
+
async function readAvatars(path48, params) {
|
|
35504
|
+
return unwrap(await apiGet(path48, params));
|
|
35525
35505
|
}
|
|
35526
|
-
async function writeAvatars(
|
|
35527
|
-
return unwrap(await apiPost(
|
|
35506
|
+
async function writeAvatars(path48, body) {
|
|
35507
|
+
return unwrap(await apiPost(path48, body));
|
|
35528
35508
|
}
|
|
35529
35509
|
|
|
35530
35510
|
// src/commands/avatars/create.ts
|
|
@@ -36433,12 +36413,12 @@ function missingFontFiles(urls, available) {
|
|
|
36433
36413
|
function planFontAdoption(sources, families) {
|
|
36434
36414
|
const wanted = new Map(families.map((family) => [normalizeFamily(family), family]));
|
|
36435
36415
|
const byFamily = /* @__PURE__ */ new Map();
|
|
36436
|
-
for (const { path:
|
|
36437
|
-
const dir = posix.dirname(
|
|
36416
|
+
for (const { path: path48, source } of sources) {
|
|
36417
|
+
const dir = posix.dirname(path48);
|
|
36438
36418
|
for (const face of declaredFontFaces(source)) {
|
|
36439
36419
|
if (!wanted.has(face.family)) continue;
|
|
36440
36420
|
const perFile = byFamily.get(face.family) ?? /* @__PURE__ */ new Map();
|
|
36441
|
-
perFile.set(
|
|
36421
|
+
perFile.set(path48, [...perFile.get(path48) ?? [], rebaseFontFaceSrc(face.block, dir)]);
|
|
36442
36422
|
byFamily.set(face.family, perFile);
|
|
36443
36423
|
}
|
|
36444
36424
|
}
|
|
@@ -49264,10 +49244,10 @@ function parseValueExpression(raw) {
|
|
|
49264
49244
|
return parts.map(parsePart);
|
|
49265
49245
|
}
|
|
49266
49246
|
function trackingFieldIds() {
|
|
49267
|
-
const
|
|
49268
|
-
if (!existsSync6(
|
|
49247
|
+
const path48 = join4(flowsDir(), "..", "tracking.ts");
|
|
49248
|
+
if (!existsSync6(path48)) return null;
|
|
49269
49249
|
try {
|
|
49270
|
-
const source = readFileSync15(
|
|
49250
|
+
const source = readFileSync15(path48, "utf-8");
|
|
49271
49251
|
const block2 = source.match(/TRACKING_FIELD_IDS\s*=\s*\[([\s\S]*?)\]\s*as const/)?.[1];
|
|
49272
49252
|
if (!block2) return null;
|
|
49273
49253
|
const ids = [...block2.matchAll(/"(tracking\.[a-z0-9_]+)"/g)].map((match) => match[1]);
|
|
@@ -49841,13 +49821,13 @@ function specsFromFile(parsed) {
|
|
|
49841
49821
|
return `${destField}${type}=${entry?.value ?? ""}`;
|
|
49842
49822
|
});
|
|
49843
49823
|
}
|
|
49844
|
-
function readSpecFile(
|
|
49824
|
+
function readSpecFile(path48) {
|
|
49845
49825
|
let raw;
|
|
49846
49826
|
try {
|
|
49847
|
-
raw =
|
|
49827
|
+
raw = path48 === "-" ? readFileSync16(0, "utf-8") : readFileSync16(path48, "utf-8");
|
|
49848
49828
|
} catch (error) {
|
|
49849
49829
|
refuse(
|
|
49850
|
-
`Could not read ${
|
|
49830
|
+
`Could not read ${path48 === "-" ? "the mapping from stdin" : `"${path48}"`}: ${error instanceof Error ? error.message : String(error)}`
|
|
49851
49831
|
);
|
|
49852
49832
|
}
|
|
49853
49833
|
let parsed;
|
|
@@ -49855,7 +49835,7 @@ function readSpecFile(path49) {
|
|
|
49855
49835
|
parsed = JSON.parse(raw);
|
|
49856
49836
|
} catch (error) {
|
|
49857
49837
|
refuse(
|
|
49858
|
-
`${
|
|
49838
|
+
`${path48 === "-" ? "stdin" : `"${path48}"`} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
49859
49839
|
'Expected { "map": { "<destField>": "<value>", \u2026 } }'
|
|
49860
49840
|
);
|
|
49861
49841
|
}
|
|
@@ -50154,21 +50134,21 @@ var ARRAY_FIELDS = [
|
|
|
50154
50134
|
"tagIds"
|
|
50155
50135
|
];
|
|
50156
50136
|
var ARRAY_OWNERS = ["", "body"];
|
|
50157
|
-
function dropUnsetOptionals(sideEffect,
|
|
50137
|
+
function dropUnsetOptionals(sideEffect, path48) {
|
|
50158
50138
|
return OPTIONAL_STRINGS.flatMap((key) => {
|
|
50159
50139
|
if (!(key in sideEffect) || sideEffect[key] !== null && sideEffect[key] !== "") return [];
|
|
50160
50140
|
delete sideEffect[key];
|
|
50161
|
-
return [{ path:
|
|
50141
|
+
return [{ path: path48, change: `dropped \`${key}\` (an optional string is absent, never null)` }];
|
|
50162
50142
|
});
|
|
50163
50143
|
}
|
|
50164
|
-
function fillNulledArrays(target2, prefix,
|
|
50144
|
+
function fillNulledArrays(target2, prefix, path48) {
|
|
50165
50145
|
return ARRAY_FIELDS.flatMap((key) => {
|
|
50166
50146
|
if (!(key in target2) || target2[key] !== null) return [];
|
|
50167
50147
|
target2[key] = [];
|
|
50168
|
-
return [{ path:
|
|
50148
|
+
return [{ path: path48, change: `\`${prefix}${key}: null\` \u2192 \`[]\`` }];
|
|
50169
50149
|
});
|
|
50170
50150
|
}
|
|
50171
|
-
function tidyEmailRecipients(sideEffect,
|
|
50151
|
+
function tidyEmailRecipients(sideEffect, path48) {
|
|
50172
50152
|
if (sideEffect.type !== "email") return [];
|
|
50173
50153
|
const config = sideEffect.encryptedConfig;
|
|
50174
50154
|
if (!config || typeof config !== "object" || Array.isArray(config)) return [];
|
|
@@ -50179,7 +50159,7 @@ function tidyEmailRecipients(sideEffect, path49) {
|
|
|
50179
50159
|
const tidied = to.join(", ");
|
|
50180
50160
|
if (tidied === raw) return [];
|
|
50181
50161
|
config.email = tidied;
|
|
50182
|
-
return [{ path:
|
|
50162
|
+
return [{ path: path48, change: "tidied the recipient list's spacing and separators" }];
|
|
50183
50163
|
}
|
|
50184
50164
|
function sideEffectsOf(node) {
|
|
50185
50165
|
if (!Array.isArray(node.sideEffects)) return [];
|
|
@@ -50188,13 +50168,13 @@ function sideEffectsOf(node) {
|
|
|
50188
50168
|
);
|
|
50189
50169
|
}
|
|
50190
50170
|
function normalizeSideEffect(sideEffect, where) {
|
|
50191
|
-
const
|
|
50171
|
+
const path48 = `${where} \u2192 ${String(sideEffect.id ?? "side effect")}`;
|
|
50192
50172
|
const arrays = ARRAY_OWNERS.flatMap((owner) => {
|
|
50193
50173
|
const target2 = owner ? sideEffect[owner] : sideEffect;
|
|
50194
50174
|
if (!target2 || typeof target2 !== "object") return [];
|
|
50195
|
-
return fillNulledArrays(target2, owner ? `${owner}.` : "",
|
|
50175
|
+
return fillNulledArrays(target2, owner ? `${owner}.` : "", path48);
|
|
50196
50176
|
});
|
|
50197
|
-
return [...dropUnsetOptionals(sideEffect,
|
|
50177
|
+
return [...dropUnsetOptionals(sideEffect, path48), ...arrays, ...tidyEmailRecipients(sideEffect, path48)];
|
|
50198
50178
|
}
|
|
50199
50179
|
function normalizeFlowTree(tree) {
|
|
50200
50180
|
const changes = [];
|
|
@@ -51584,10 +51564,10 @@ async function stageOps(ops) {
|
|
|
51584
51564
|
handleError5(err);
|
|
51585
51565
|
}
|
|
51586
51566
|
}
|
|
51587
|
-
async function draftAction2(
|
|
51567
|
+
async function draftAction2(path48, body, chat) {
|
|
51588
51568
|
const chatId = resolveChatId(chat);
|
|
51589
51569
|
try {
|
|
51590
|
-
const data = await apiPost(
|
|
51570
|
+
const data = await apiPost(path48, { chatId, ...body });
|
|
51591
51571
|
writeJsonEnvelope({ ok: true, data });
|
|
51592
51572
|
return data;
|
|
51593
51573
|
} catch (err) {
|
|
@@ -54116,9 +54096,9 @@ async function readImageBuffer(pathOrUrl) {
|
|
|
54116
54096
|
}
|
|
54117
54097
|
return readFile28(pathOrUrl);
|
|
54118
54098
|
}
|
|
54119
|
-
async function isDirectory(
|
|
54099
|
+
async function isDirectory(path48) {
|
|
54120
54100
|
try {
|
|
54121
|
-
const s = await stat7(
|
|
54101
|
+
const s = await stat7(path48);
|
|
54122
54102
|
return s.isDirectory();
|
|
54123
54103
|
} catch {
|
|
54124
54104
|
return false;
|
|
@@ -54546,13 +54526,13 @@ function resolveDownloadPath({ baseName, extension, out, outIsDirectory: outIsDi
|
|
|
54546
54526
|
}
|
|
54547
54527
|
function disambiguate(paths) {
|
|
54548
54528
|
const taken = /* @__PURE__ */ new Set();
|
|
54549
|
-
return paths.map((
|
|
54550
|
-
if (!taken.has(
|
|
54551
|
-
taken.add(
|
|
54552
|
-
return
|
|
54529
|
+
return paths.map((path48) => {
|
|
54530
|
+
if (!taken.has(path48)) {
|
|
54531
|
+
taken.add(path48);
|
|
54532
|
+
return path48;
|
|
54553
54533
|
}
|
|
54554
|
-
const ext = extname3(
|
|
54555
|
-
const stem =
|
|
54534
|
+
const ext = extname3(path48);
|
|
54535
|
+
const stem = path48.slice(0, path48.length - ext.length);
|
|
54556
54536
|
let n = 2;
|
|
54557
54537
|
while (taken.has(`${stem}-${n}${ext}`)) n += 1;
|
|
54558
54538
|
const unique = `${stem}-${n}${ext}`;
|
|
@@ -54678,10 +54658,10 @@ async function runDownloads(plan) {
|
|
|
54678
54658
|
const paths = disambiguate(fetched.map((item) => item.path));
|
|
54679
54659
|
const downloaded = [];
|
|
54680
54660
|
for (const [index, item] of fetched.entries()) {
|
|
54681
|
-
const
|
|
54661
|
+
const path48 = paths[index] ?? item.path;
|
|
54682
54662
|
try {
|
|
54683
|
-
await atomicWrite(
|
|
54684
|
-
downloaded.push({ input: item.input, output:
|
|
54663
|
+
await atomicWrite(path48, item.buffer);
|
|
54664
|
+
downloaded.push({ input: item.input, output: path48, bytes: item.buffer.length, contentType: item.contentType });
|
|
54685
54665
|
} catch (err) {
|
|
54686
54666
|
failed.push({ input: item.input, error: failureMessage(err, "Write failed") });
|
|
54687
54667
|
}
|
|
@@ -62868,353 +62848,11 @@ Full guide: __tooling__/docs/tools/baker/mcp.md`
|
|
|
62868
62848
|
}
|
|
62869
62849
|
});
|
|
62870
62850
|
|
|
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
62851
|
// src/commands/research/index.ts
|
|
63214
|
-
import { defineCommand as
|
|
62852
|
+
import { defineCommand as defineCommand196 } from "citty";
|
|
63215
62853
|
|
|
63216
62854
|
// src/commands/research/advertisers.ts
|
|
63217
|
-
import { defineCommand as
|
|
62855
|
+
import { defineCommand as defineCommand184 } from "citty";
|
|
63218
62856
|
|
|
63219
62857
|
// src/commands/research/hints.ts
|
|
63220
62858
|
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 +63054,7 @@ var FIELDS3 = {
|
|
|
63416
63054
|
etv: "Estimated traffic value (USD)",
|
|
63417
63055
|
visibility: "SERP visibility score (0-1)"
|
|
63418
63056
|
};
|
|
63419
|
-
var advertisersCommand =
|
|
63057
|
+
var advertisersCommand = defineCommand184({
|
|
63420
63058
|
meta: {
|
|
63421
63059
|
name: "advertisers",
|
|
63422
63060
|
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 +63110,7 @@ Examples:
|
|
|
63472
63110
|
});
|
|
63473
63111
|
|
|
63474
63112
|
// src/commands/research/autocomplete.ts
|
|
63475
|
-
import { defineCommand as
|
|
63113
|
+
import { defineCommand as defineCommand185 } from "citty";
|
|
63476
63114
|
registerSchema({
|
|
63477
63115
|
command: "research.autocomplete",
|
|
63478
63116
|
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 +63133,7 @@ registerSchema({
|
|
|
63495
63133
|
var FIELDS4 = {
|
|
63496
63134
|
suggestion: "Autocomplete suggestion from Google"
|
|
63497
63135
|
};
|
|
63498
|
-
var autocompleteCommand =
|
|
63136
|
+
var autocompleteCommand = defineCommand185({
|
|
63499
63137
|
meta: {
|
|
63500
63138
|
name: "autocomplete",
|
|
63501
63139
|
description: `Get Google Autocomplete suggestions for keyword expansion.
|
|
@@ -63550,7 +63188,7 @@ Examples:
|
|
|
63550
63188
|
});
|
|
63551
63189
|
|
|
63552
63190
|
// src/commands/research/countries.ts
|
|
63553
|
-
import { defineCommand as
|
|
63191
|
+
import { defineCommand as defineCommand186 } from "citty";
|
|
63554
63192
|
registerSchema({
|
|
63555
63193
|
command: "research.countries",
|
|
63556
63194
|
description: "List all supported country codes for --location flag in research commands.",
|
|
@@ -63607,7 +63245,7 @@ var FIELDS5 = {
|
|
|
63607
63245
|
code: "Country code to pass as --location",
|
|
63608
63246
|
name: "Country name"
|
|
63609
63247
|
};
|
|
63610
|
-
var countriesCommand =
|
|
63248
|
+
var countriesCommand = defineCommand186({
|
|
63611
63249
|
meta: {
|
|
63612
63250
|
name: "countries",
|
|
63613
63251
|
description: "List all supported country codes for --location flag."
|
|
@@ -63618,7 +63256,7 @@ var countriesCommand = defineCommand192({
|
|
|
63618
63256
|
});
|
|
63619
63257
|
|
|
63620
63258
|
// src/commands/research/fetch.ts
|
|
63621
|
-
import { defineCommand as
|
|
63259
|
+
import { defineCommand as defineCommand187 } from "citty";
|
|
63622
63260
|
var CONTENT_PREVIEW_CHARS = 2e4;
|
|
63623
63261
|
var TIMEOUT_MS = 18e4;
|
|
63624
63262
|
registerSchema({
|
|
@@ -63691,7 +63329,7 @@ function fetchFix(code) {
|
|
|
63691
63329
|
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
63330
|
};
|
|
63693
63331
|
}
|
|
63694
|
-
var fetchCommand =
|
|
63332
|
+
var fetchCommand = defineCommand187({
|
|
63695
63333
|
meta: {
|
|
63696
63334
|
name: "fetch",
|
|
63697
63335
|
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 +63406,7 @@ Examples:
|
|
|
63768
63406
|
});
|
|
63769
63407
|
|
|
63770
63408
|
// src/commands/research/intent.ts
|
|
63771
|
-
import { defineCommand as
|
|
63409
|
+
import { defineCommand as defineCommand188 } from "citty";
|
|
63772
63410
|
registerSchema({
|
|
63773
63411
|
command: "research.intent",
|
|
63774
63412
|
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 +63429,7 @@ var FIELDS7 = {
|
|
|
63791
63429
|
intent: "Primary Google Search intent: informational, navigational, commercial, transactional",
|
|
63792
63430
|
probability: "Confidence score 0.0-1.0"
|
|
63793
63431
|
};
|
|
63794
|
-
var intentCommand =
|
|
63432
|
+
var intentCommand = defineCommand188({
|
|
63795
63433
|
meta: {
|
|
63796
63434
|
name: "intent",
|
|
63797
63435
|
description: `Classify Google Search intent for keywords. Returns intent type and confidence.
|
|
@@ -63839,7 +63477,7 @@ Examples:
|
|
|
63839
63477
|
});
|
|
63840
63478
|
|
|
63841
63479
|
// src/commands/research/keyword-gap.ts
|
|
63842
|
-
import { defineCommand as
|
|
63480
|
+
import { defineCommand as defineCommand189 } from "citty";
|
|
63843
63481
|
registerSchema({
|
|
63844
63482
|
command: "research.keyword-gap",
|
|
63845
63483
|
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 +63506,7 @@ var FIELDS8 = {
|
|
|
63868
63506
|
cpc: "Cost per click USD",
|
|
63869
63507
|
their_position: "Competitor's ranking position"
|
|
63870
63508
|
};
|
|
63871
|
-
var keywordGapCommand =
|
|
63509
|
+
var keywordGapCommand = defineCommand189({
|
|
63872
63510
|
meta: {
|
|
63873
63511
|
name: "keyword-gap",
|
|
63874
63512
|
description: `Find keywords a competitor has that you don't. Supports pagination via --offset.
|
|
@@ -63943,7 +63581,7 @@ Examples:
|
|
|
63943
63581
|
});
|
|
63944
63582
|
|
|
63945
63583
|
// src/commands/research/keyword-metrics.ts
|
|
63946
|
-
import { defineCommand as
|
|
63584
|
+
import { defineCommand as defineCommand190 } from "citty";
|
|
63947
63585
|
|
|
63948
63586
|
// src/commands/research/keyword-metrics-rows.ts
|
|
63949
63587
|
var KEYWORD_METRICS_SOURCE = "keyword_planner_estimate_via_dataforseo";
|
|
@@ -64023,7 +63661,7 @@ registerSchema({
|
|
|
64023
63661
|
"no-cache": { type: "boolean", description: "Skip server cache, hit API directly", required: false }
|
|
64024
63662
|
}
|
|
64025
63663
|
});
|
|
64026
|
-
var keywordMetricsCommand =
|
|
63664
|
+
var keywordMetricsCommand = defineCommand190({
|
|
64027
63665
|
meta: {
|
|
64028
63666
|
name: "keyword-metrics",
|
|
64029
63667
|
description: `Volume, CPC and competition for keywords you name. No domain required.
|
|
@@ -64105,7 +63743,7 @@ Examples:
|
|
|
64105
63743
|
});
|
|
64106
63744
|
|
|
64107
63745
|
// src/commands/research/keywords-for-site.ts
|
|
64108
|
-
import { defineCommand as
|
|
63746
|
+
import { defineCommand as defineCommand191 } from "citty";
|
|
64109
63747
|
registerSchema({
|
|
64110
63748
|
command: "research.keywords-for-site",
|
|
64111
63749
|
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 +63776,7 @@ var FIELDS9 = {
|
|
|
64138
63776
|
competition: "LOW, MEDIUM, or HIGH",
|
|
64139
63777
|
competition_index: "Competition score 0-100"
|
|
64140
63778
|
};
|
|
64141
|
-
var keywordsForSiteCommand =
|
|
63779
|
+
var keywordsForSiteCommand = defineCommand191({
|
|
64142
63780
|
meta: {
|
|
64143
63781
|
name: "keywords-for-site",
|
|
64144
63782
|
description: `Get keywords a competitor targets in Google. Use --type to filter paid/organic.
|
|
@@ -64200,7 +63838,7 @@ Examples:
|
|
|
64200
63838
|
});
|
|
64201
63839
|
|
|
64202
63840
|
// src/commands/research/languages.ts
|
|
64203
|
-
import { defineCommand as
|
|
63841
|
+
import { defineCommand as defineCommand192 } from "citty";
|
|
64204
63842
|
registerSchema({
|
|
64205
63843
|
command: "research.languages",
|
|
64206
63844
|
description: "List all supported language codes for --language flag in research commands.",
|
|
@@ -64230,7 +63868,7 @@ var FIELDS10 = {
|
|
|
64230
63868
|
code: "Language code to pass as --language",
|
|
64231
63869
|
name: "Language name (also accepted by --language)"
|
|
64232
63870
|
};
|
|
64233
|
-
var languagesCommand2 =
|
|
63871
|
+
var languagesCommand2 = defineCommand192({
|
|
64234
63872
|
meta: {
|
|
64235
63873
|
name: "languages",
|
|
64236
63874
|
description: "List all supported language codes for --language flag."
|
|
@@ -64241,7 +63879,7 @@ var languagesCommand2 = defineCommand198({
|
|
|
64241
63879
|
});
|
|
64242
63880
|
|
|
64243
63881
|
// src/commands/research/lighthouse.ts
|
|
64244
|
-
import { defineCommand as
|
|
63882
|
+
import { defineCommand as defineCommand193 } from "citty";
|
|
64245
63883
|
registerSchema({
|
|
64246
63884
|
command: "research.lighthouse",
|
|
64247
63885
|
description: "Landing page performance audit. Returns metrics that affect Google Ads Quality Score and CPC.",
|
|
@@ -64260,7 +63898,7 @@ var FIELDS11 = {
|
|
|
64260
63898
|
speed_index_ms: "Speed Index in ms (good: < 3400)",
|
|
64261
63899
|
interactive_ms: "Time to Interactive in ms (good: < 3800)"
|
|
64262
63900
|
};
|
|
64263
|
-
var lighthouseCommand =
|
|
63901
|
+
var lighthouseCommand = defineCommand193({
|
|
64264
63902
|
meta: {
|
|
64265
63903
|
name: "lighthouse",
|
|
64266
63904
|
description: `Landing page performance audit. Metrics affecting Google Ads Quality Score.
|
|
@@ -64298,7 +63936,7 @@ Examples:
|
|
|
64298
63936
|
});
|
|
64299
63937
|
|
|
64300
63938
|
// src/commands/research/relevant-pages.ts
|
|
64301
|
-
import { defineCommand as
|
|
63939
|
+
import { defineCommand as defineCommand194 } from "citty";
|
|
64302
63940
|
registerSchema({
|
|
64303
63941
|
command: "research.relevant-pages",
|
|
64304
63942
|
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 +63962,7 @@ var FIELDS12 = {
|
|
|
64324
63962
|
keywords: "Total organic keywords the page ranks for",
|
|
64325
63963
|
top_10: "Keywords in positions 1-10"
|
|
64326
63964
|
};
|
|
64327
|
-
var relevantPagesCommand =
|
|
63965
|
+
var relevantPagesCommand = defineCommand194({
|
|
64328
63966
|
meta: {
|
|
64329
63967
|
name: "relevant-pages",
|
|
64330
63968
|
description: `Get the top pages of a competitor domain with traffic data.
|
|
@@ -64371,7 +64009,7 @@ Examples:
|
|
|
64371
64009
|
});
|
|
64372
64010
|
|
|
64373
64011
|
// src/commands/research/web.ts
|
|
64374
|
-
import { defineCommand as
|
|
64012
|
+
import { defineCommand as defineCommand195 } from "citty";
|
|
64375
64013
|
registerSchema({
|
|
64376
64014
|
command: "research.web",
|
|
64377
64015
|
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 +64060,7 @@ async function runDeepResearch(question) {
|
|
|
64422
64060
|
}
|
|
64423
64061
|
throw new Error("Deep research timed out");
|
|
64424
64062
|
}
|
|
64425
|
-
var webCommand =
|
|
64063
|
+
var webCommand = defineCommand195({
|
|
64426
64064
|
meta: {
|
|
64427
64065
|
name: "web",
|
|
64428
64066
|
description: `Search the web with AI to answer any open-ended marketing question. Uses live internet data via Google Search.
|
|
@@ -64484,7 +64122,7 @@ Examples:
|
|
|
64484
64122
|
});
|
|
64485
64123
|
|
|
64486
64124
|
// src/commands/research/index.ts
|
|
64487
|
-
var researchCommand =
|
|
64125
|
+
var researchCommand = defineCommand196({
|
|
64488
64126
|
meta: {
|
|
64489
64127
|
name: "research",
|
|
64490
64128
|
description: `Competitive intelligence and AI-powered research commands.
|
|
@@ -64531,10 +64169,10 @@ Full guide: __tooling__/docs/tools/baker/research.md`
|
|
|
64531
64169
|
});
|
|
64532
64170
|
|
|
64533
64171
|
// src/commands/scheduled-agents/index.ts
|
|
64534
|
-
import { defineCommand as
|
|
64172
|
+
import { defineCommand as defineCommand207 } from "citty";
|
|
64535
64173
|
|
|
64536
64174
|
// src/commands/scheduled-agents/create.ts
|
|
64537
|
-
import { defineCommand as
|
|
64175
|
+
import { defineCommand as defineCommand197 } from "citty";
|
|
64538
64176
|
|
|
64539
64177
|
// src/commands/scheduled-agents/shared.ts
|
|
64540
64178
|
var TEMP_SCHEDULED_AGENT_PREFIX = "temp_agent_";
|
|
@@ -64901,7 +64539,7 @@ registerSchema({
|
|
|
64901
64539
|
}
|
|
64902
64540
|
}
|
|
64903
64541
|
});
|
|
64904
|
-
var createCommand3 =
|
|
64542
|
+
var createCommand3 = defineCommand197({
|
|
64905
64543
|
meta: {
|
|
64906
64544
|
name: "create",
|
|
64907
64545
|
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 +64596,7 @@ var createCommand3 = defineCommand203({
|
|
|
64958
64596
|
});
|
|
64959
64597
|
|
|
64960
64598
|
// src/commands/scheduled-agents/delete.ts
|
|
64961
|
-
import { defineCommand as
|
|
64599
|
+
import { defineCommand as defineCommand198 } from "citty";
|
|
64962
64600
|
registerSchema({
|
|
64963
64601
|
command: "scheduled-agents.delete",
|
|
64964
64602
|
description: "Stage deletion of a published scheduled agent, or cancel one this chat staged (temp_agent_*).",
|
|
@@ -64966,7 +64604,7 @@ registerSchema({
|
|
|
64966
64604
|
id: { type: "string", description: "Published scheduled agent ID or temp_agent_* draft ID", required: true }
|
|
64967
64605
|
}
|
|
64968
64606
|
});
|
|
64969
|
-
var deleteCommand3 =
|
|
64607
|
+
var deleteCommand3 = defineCommand198({
|
|
64970
64608
|
meta: {
|
|
64971
64609
|
name: "delete",
|
|
64972
64610
|
description: "Stage a scheduled agent deletion. Example: baker scheduled-agents delete <id-or-temp_agent_id>"
|
|
@@ -64995,7 +64633,7 @@ var deleteCommand3 = defineCommand204({
|
|
|
64995
64633
|
});
|
|
64996
64634
|
|
|
64997
64635
|
// src/commands/scheduled-agents/get.ts
|
|
64998
|
-
import { defineCommand as
|
|
64636
|
+
import { defineCommand as defineCommand199 } from "citty";
|
|
64999
64637
|
registerSchema({
|
|
65000
64638
|
command: "scheduled-agents.get",
|
|
65001
64639
|
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 +64642,7 @@ registerSchema({
|
|
|
65004
64642
|
chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
|
|
65005
64643
|
}
|
|
65006
64644
|
});
|
|
65007
|
-
var getCommand4 =
|
|
64645
|
+
var getCommand4 = defineCommand199({
|
|
65008
64646
|
meta: {
|
|
65009
64647
|
name: "get",
|
|
65010
64648
|
description: "Get a scheduled agent. Example: baker scheduled-agents get <id-or-temp_agent_id>"
|
|
@@ -65043,7 +64681,7 @@ var getCommand4 = defineCommand205({
|
|
|
65043
64681
|
});
|
|
65044
64682
|
|
|
65045
64683
|
// src/commands/scheduled-agents/list.ts
|
|
65046
|
-
import { defineCommand as
|
|
64684
|
+
import { defineCommand as defineCommand200 } from "citty";
|
|
65047
64685
|
var FULL_DESCRIPTION = "Return every item and staged change as stored, briefs included (tens of KB). Prefer `get <id>` for one item.";
|
|
65048
64686
|
registerSchema({
|
|
65049
64687
|
command: "scheduled-agents.list",
|
|
@@ -65053,7 +64691,7 @@ registerSchema({
|
|
|
65053
64691
|
full: { type: "boolean", description: FULL_DESCRIPTION, required: false }
|
|
65054
64692
|
}
|
|
65055
64693
|
});
|
|
65056
|
-
var
|
|
64694
|
+
var listCommand17 = defineCommand200({
|
|
65057
64695
|
meta: {
|
|
65058
64696
|
name: "list",
|
|
65059
64697
|
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 +64717,7 @@ var listCommand18 = defineCommand206({
|
|
|
65079
64717
|
});
|
|
65080
64718
|
|
|
65081
64719
|
// src/commands/scheduled-agents/run.ts
|
|
65082
|
-
import { defineCommand as
|
|
64720
|
+
import { defineCommand as defineCommand201 } from "citty";
|
|
65083
64721
|
registerSchema({
|
|
65084
64722
|
command: "scheduled-agents.run",
|
|
65085
64723
|
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 +64725,7 @@ registerSchema({
|
|
|
65087
64725
|
id: { type: "string", description: "Published scheduled agent ID", required: true }
|
|
65088
64726
|
}
|
|
65089
64727
|
});
|
|
65090
|
-
var runCommand2 =
|
|
64728
|
+
var runCommand2 = defineCommand201({
|
|
65091
64729
|
meta: {
|
|
65092
64730
|
name: "run",
|
|
65093
64731
|
description: "Run a published scheduled agent now. Example: baker scheduled-agents run <id>"
|
|
@@ -65119,7 +64757,7 @@ var runCommand2 = defineCommand207({
|
|
|
65119
64757
|
});
|
|
65120
64758
|
|
|
65121
64759
|
// src/commands/scheduled-agents/targets.ts
|
|
65122
|
-
import { defineCommand as
|
|
64760
|
+
import { defineCommand as defineCommand202 } from "citty";
|
|
65123
64761
|
var ARGS2 = {
|
|
65124
64762
|
trigger: {
|
|
65125
64763
|
type: "string",
|
|
@@ -65153,7 +64791,7 @@ registerSchema({
|
|
|
65153
64791
|
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
64792
|
args: ARGS2
|
|
65155
64793
|
});
|
|
65156
|
-
var targetsCommand =
|
|
64794
|
+
var targetsCommand = defineCommand202({
|
|
65157
64795
|
meta: {
|
|
65158
64796
|
name: "targets",
|
|
65159
64797
|
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 +64834,7 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
65196
64834
|
// src/commands/scheduled-agents/templates.ts
|
|
65197
64835
|
import { readFile as readFile32 } from "fs/promises";
|
|
65198
64836
|
import path46 from "path";
|
|
65199
|
-
import { defineCommand as
|
|
64837
|
+
import { defineCommand as defineCommand203 } from "citty";
|
|
65200
64838
|
registerSchema({
|
|
65201
64839
|
command: "scheduled-agents.templates",
|
|
65202
64840
|
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 +64889,7 @@ registerSchema({
|
|
|
65251
64889
|
}
|
|
65252
64890
|
}
|
|
65253
64891
|
});
|
|
65254
|
-
var templatesCommand =
|
|
64892
|
+
var templatesCommand = defineCommand203({
|
|
65255
64893
|
meta: {
|
|
65256
64894
|
name: "templates",
|
|
65257
64895
|
description: `The recipes this company can run \u2014 Baker's own plus theirs, with what each one produces.
|
|
@@ -65347,7 +64985,7 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
65347
64985
|
});
|
|
65348
64986
|
|
|
65349
64987
|
// src/commands/scheduled-agents/triggers.ts
|
|
65350
|
-
import { defineCommand as
|
|
64988
|
+
import { defineCommand as defineCommand204 } from "citty";
|
|
65351
64989
|
var ARGS3 = {
|
|
65352
64990
|
trigger: {
|
|
65353
64991
|
type: "string",
|
|
@@ -65433,7 +65071,7 @@ function shapeTriggerCatalog(response, filter) {
|
|
|
65433
65071
|
}
|
|
65434
65072
|
return { ok: true, data: { groups, reacting: catalog.reacting } };
|
|
65435
65073
|
}
|
|
65436
|
-
var triggersCommand2 =
|
|
65074
|
+
var triggersCommand2 = defineCommand204({
|
|
65437
65075
|
meta: {
|
|
65438
65076
|
name: "triggers",
|
|
65439
65077
|
description: `Everything that can start a scheduled agent.
|
|
@@ -65463,7 +65101,7 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
65463
65101
|
});
|
|
65464
65102
|
|
|
65465
65103
|
// src/commands/scheduled-agents/unstage.ts
|
|
65466
|
-
import { defineCommand as
|
|
65104
|
+
import { defineCommand as defineCommand205 } from "citty";
|
|
65467
65105
|
registerSchema({
|
|
65468
65106
|
command: "scheduled-agents.unstage",
|
|
65469
65107
|
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 +65127,7 @@ function unstageBody(args5, chatId) {
|
|
|
65489
65127
|
}
|
|
65490
65128
|
return { chatId, ref: args5.ref, index };
|
|
65491
65129
|
}
|
|
65492
|
-
var unstageCommand =
|
|
65130
|
+
var unstageCommand = defineCommand205({
|
|
65493
65131
|
meta: {
|
|
65494
65132
|
name: "unstage",
|
|
65495
65133
|
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 +65158,7 @@ var unstageCommand = defineCommand211({
|
|
|
65520
65158
|
});
|
|
65521
65159
|
|
|
65522
65160
|
// src/commands/scheduled-agents/update.ts
|
|
65523
|
-
import { defineCommand as
|
|
65161
|
+
import { defineCommand as defineCommand206 } from "citty";
|
|
65524
65162
|
registerSchema({
|
|
65525
65163
|
command: "scheduled-agents.update",
|
|
65526
65164
|
description: "Stage an update to a published scheduled agent, or to one this chat staged (temp_agent_*).",
|
|
@@ -65547,7 +65185,7 @@ registerSchema({
|
|
|
65547
65185
|
enabled: { type: "string", description: "Replacement enabled state", required: false, enum: ["true", "false"] }
|
|
65548
65186
|
}
|
|
65549
65187
|
});
|
|
65550
|
-
var updateCommand4 =
|
|
65188
|
+
var updateCommand4 = defineCommand206({
|
|
65551
65189
|
meta: {
|
|
65552
65190
|
name: "update",
|
|
65553
65191
|
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 +65256,7 @@ var updateCommand4 = defineCommand212({
|
|
|
65618
65256
|
});
|
|
65619
65257
|
|
|
65620
65258
|
// src/commands/scheduled-agents/index.ts
|
|
65621
|
-
var scheduledAgentsCommand =
|
|
65259
|
+
var scheduledAgentsCommand = defineCommand207({
|
|
65622
65260
|
meta: {
|
|
65623
65261
|
name: "scheduled-agents",
|
|
65624
65262
|
description: `Manage Scheduled agents. Subcommands: list, get, triggers, targets, create, update, delete, unstage, run, templates.
|
|
@@ -65647,7 +65285,7 @@ Examples:
|
|
|
65647
65285
|
Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
65648
65286
|
},
|
|
65649
65287
|
subCommands: {
|
|
65650
|
-
list:
|
|
65288
|
+
list: listCommand17,
|
|
65651
65289
|
get: getCommand4,
|
|
65652
65290
|
triggers: triggersCommand2,
|
|
65653
65291
|
targets: targetsCommand,
|
|
@@ -65661,14 +65299,14 @@ Full guide: __tooling__/docs/tools/baker/scheduled-agents.md`
|
|
|
65661
65299
|
});
|
|
65662
65300
|
|
|
65663
65301
|
// src/commands/schema.ts
|
|
65664
|
-
import { defineCommand as
|
|
65302
|
+
import { defineCommand as defineCommand208 } from "citty";
|
|
65665
65303
|
function narrowToFamily(commandName, available) {
|
|
65666
65304
|
const segments = commandName.split(".");
|
|
65667
65305
|
const prefix = segments[0] === "ads" && segments[1] ? `ads.${segments[1]}.` : `${segments[0]}.`;
|
|
65668
65306
|
const siblings = available.filter((name) => name.startsWith(prefix));
|
|
65669
65307
|
return siblings.length > 0 ? siblings : available;
|
|
65670
65308
|
}
|
|
65671
|
-
var schemaCommand2 =
|
|
65309
|
+
var schemaCommand2 = defineCommand208({
|
|
65672
65310
|
meta: {
|
|
65673
65311
|
name: "schema",
|
|
65674
65312
|
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 +65351,10 @@ var schemaCommand2 = defineCommand214({
|
|
|
65713
65351
|
});
|
|
65714
65352
|
|
|
65715
65353
|
// src/commands/studio/index.ts
|
|
65716
|
-
import { defineCommand as
|
|
65354
|
+
import { defineCommand as defineCommand217 } from "citty";
|
|
65717
65355
|
|
|
65718
65356
|
// src/commands/studio/animate.ts
|
|
65719
|
-
import { defineCommand as
|
|
65357
|
+
import { defineCommand as defineCommand209 } from "citty";
|
|
65720
65358
|
|
|
65721
65359
|
// src/commands/studio/spokenPace.ts
|
|
65722
65360
|
var WORDS_PER_SECOND3 = SPOKEN_WORDS_PER_SECOND;
|
|
@@ -65942,7 +65580,7 @@ function parseImageRefs(spec) {
|
|
|
65942
65580
|
}
|
|
65943
65581
|
var defaultDeps = {
|
|
65944
65582
|
ingest: (url) => apiPost("/api/images/ingest", { url, source: "uploaded" }),
|
|
65945
|
-
upload: (
|
|
65583
|
+
upload: (path48) => uploadLocalImage({ file: path48, contentType: detectImageContentType(path48), source: "uploaded" })
|
|
65946
65584
|
};
|
|
65947
65585
|
async function resolveLibraryImageIds(spec, limit, deps = defaultDeps) {
|
|
65948
65586
|
const refs = parseImageRefs(spec);
|
|
@@ -65962,10 +65600,10 @@ async function resolveLibraryImageIds(spec, limit, deps = defaultDeps) {
|
|
|
65962
65600
|
}
|
|
65963
65601
|
return { imageIds, added };
|
|
65964
65602
|
}
|
|
65965
|
-
function uploadFailure(
|
|
65603
|
+
function uploadFailure(path48) {
|
|
65966
65604
|
return (error) => {
|
|
65967
65605
|
if (error instanceof ApiError) throw error;
|
|
65968
|
-
throw new ApiError("VALIDATION_ERROR", `Could not read "${
|
|
65606
|
+
throw new ApiError("VALIDATION_ERROR", `Could not read "${path48}" as an image.`);
|
|
65969
65607
|
};
|
|
65970
65608
|
}
|
|
65971
65609
|
|
|
@@ -66229,7 +65867,7 @@ async function adByHandHintFor(body) {
|
|
|
66229
65867
|
return null;
|
|
66230
65868
|
}
|
|
66231
65869
|
}
|
|
66232
|
-
var animateCommand =
|
|
65870
|
+
var animateCommand = defineCommand209({
|
|
66233
65871
|
meta: {
|
|
66234
65872
|
name: "animate",
|
|
66235
65873
|
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 +65992,7 @@ var animateCommand = defineCommand215({
|
|
|
66354
65992
|
});
|
|
66355
65993
|
|
|
66356
65994
|
// src/commands/studio/generate.ts
|
|
66357
|
-
import { defineCommand as
|
|
65995
|
+
import { defineCommand as defineCommand210 } from "citty";
|
|
66358
65996
|
var MODEL_LIST2 = IMAGE_MODEL_IDS;
|
|
66359
65997
|
var DEFAULT_MAX_WAIT_MS2 = 24e4;
|
|
66360
65998
|
registerSchema({
|
|
@@ -66490,7 +66128,7 @@ function buildGenerateBody(args5, prompt) {
|
|
|
66490
66128
|
}
|
|
66491
66129
|
return body;
|
|
66492
66130
|
}
|
|
66493
|
-
var generateCommand =
|
|
66131
|
+
var generateCommand = defineCommand210({
|
|
66494
66132
|
meta: {
|
|
66495
66133
|
name: "generate",
|
|
66496
66134
|
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 +66211,7 @@ var generateCommand = defineCommand216({
|
|
|
66573
66211
|
});
|
|
66574
66212
|
|
|
66575
66213
|
// src/commands/studio/get.ts
|
|
66576
|
-
import { defineCommand as
|
|
66214
|
+
import { defineCommand as defineCommand211 } from "citty";
|
|
66577
66215
|
registerSchema({
|
|
66578
66216
|
command: "studio.get",
|
|
66579
66217
|
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 +66220,7 @@ registerSchema({
|
|
|
66582
66220
|
full: { type: "boolean", description: "Include settings, references and attribution", required: false }
|
|
66583
66221
|
}
|
|
66584
66222
|
});
|
|
66585
|
-
var getCommand5 =
|
|
66223
|
+
var getCommand5 = defineCommand211({
|
|
66586
66224
|
meta: {
|
|
66587
66225
|
name: "get",
|
|
66588
66226
|
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 +66249,7 @@ var getCommand5 = defineCommand217({
|
|
|
66611
66249
|
});
|
|
66612
66250
|
|
|
66613
66251
|
// src/commands/studio/improve.ts
|
|
66614
|
-
import { defineCommand as
|
|
66252
|
+
import { defineCommand as defineCommand212 } from "citty";
|
|
66615
66253
|
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
66254
|
registerSchema({
|
|
66617
66255
|
command: "studio.improve",
|
|
@@ -66636,7 +66274,7 @@ registerSchema({
|
|
|
66636
66274
|
}
|
|
66637
66275
|
}
|
|
66638
66276
|
});
|
|
66639
|
-
var improveCommand =
|
|
66277
|
+
var improveCommand = defineCommand212({
|
|
66640
66278
|
meta: {
|
|
66641
66279
|
name: "improve",
|
|
66642
66280
|
description: `${DESCRIPTION2}
|
|
@@ -66680,7 +66318,7 @@ Examples:
|
|
|
66680
66318
|
});
|
|
66681
66319
|
|
|
66682
66320
|
// src/commands/studio/keep.ts
|
|
66683
|
-
import { defineCommand as
|
|
66321
|
+
import { defineCommand as defineCommand213 } from "citty";
|
|
66684
66322
|
registerSchema({
|
|
66685
66323
|
command: "studio.keep",
|
|
66686
66324
|
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 +66328,7 @@ registerSchema({
|
|
|
66690
66328
|
undo: { type: "boolean", description: "Un-star an image, or take a kept clip back out", required: false }
|
|
66691
66329
|
}
|
|
66692
66330
|
});
|
|
66693
|
-
var keepCommand =
|
|
66331
|
+
var keepCommand = defineCommand213({
|
|
66694
66332
|
meta: {
|
|
66695
66333
|
name: "keep",
|
|
66696
66334
|
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 +66379,7 @@ var keepCommand = defineCommand219({
|
|
|
66741
66379
|
});
|
|
66742
66380
|
|
|
66743
66381
|
// src/commands/studio/list.ts
|
|
66744
|
-
import { defineCommand as
|
|
66382
|
+
import { defineCommand as defineCommand214 } from "citty";
|
|
66745
66383
|
registerSchema({
|
|
66746
66384
|
command: "studio.list",
|
|
66747
66385
|
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 +66390,7 @@ registerSchema({
|
|
|
66752
66390
|
full: { type: "boolean", description: "Include settings, references and attribution", required: false }
|
|
66753
66391
|
}
|
|
66754
66392
|
});
|
|
66755
|
-
var
|
|
66393
|
+
var listCommand18 = defineCommand214({
|
|
66756
66394
|
meta: {
|
|
66757
66395
|
name: "list",
|
|
66758
66396
|
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 +66424,7 @@ var listCommand19 = defineCommand220({
|
|
|
66786
66424
|
});
|
|
66787
66425
|
|
|
66788
66426
|
// src/commands/studio/models.ts
|
|
66789
|
-
import { defineCommand as
|
|
66427
|
+
import { defineCommand as defineCommand215 } from "citty";
|
|
66790
66428
|
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
66429
|
registerSchema({
|
|
66792
66430
|
command: "studio.models",
|
|
@@ -66873,7 +66511,7 @@ function buildModelCards(kind, model) {
|
|
|
66873
66511
|
const selected = model ? ids.filter((id) => id === model) : ids;
|
|
66874
66512
|
return selected.map((id) => build(id));
|
|
66875
66513
|
}
|
|
66876
|
-
var modelsCommand =
|
|
66514
|
+
var modelsCommand = defineCommand215({
|
|
66877
66515
|
meta: {
|
|
66878
66516
|
name: "models",
|
|
66879
66517
|
description: `${DESCRIPTION3}
|
|
@@ -66920,13 +66558,13 @@ Examples:
|
|
|
66920
66558
|
});
|
|
66921
66559
|
|
|
66922
66560
|
// src/commands/studio/skills.ts
|
|
66923
|
-
import { defineCommand as
|
|
66561
|
+
import { defineCommand as defineCommand216 } from "citty";
|
|
66924
66562
|
registerSchema({
|
|
66925
66563
|
command: "studio.skills",
|
|
66926
66564
|
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
66565
|
args: {}
|
|
66928
66566
|
});
|
|
66929
|
-
var skillsCommand =
|
|
66567
|
+
var skillsCommand = defineCommand216({
|
|
66930
66568
|
meta: {
|
|
66931
66569
|
name: "skills",
|
|
66932
66570
|
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 +66588,7 @@ var skillsCommand = defineCommand222({
|
|
|
66950
66588
|
});
|
|
66951
66589
|
|
|
66952
66590
|
// src/commands/studio/index.ts
|
|
66953
|
-
var studioCommand =
|
|
66591
|
+
var studioCommand = defineCommand217({
|
|
66954
66592
|
meta: {
|
|
66955
66593
|
name: "studio",
|
|
66956
66594
|
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 +66622,7 @@ Full guide: __tooling__/docs/tools/baker/studio.md`
|
|
|
66984
66622
|
generate: generateCommand,
|
|
66985
66623
|
animate: animateCommand,
|
|
66986
66624
|
get: getCommand5,
|
|
66987
|
-
list:
|
|
66625
|
+
list: listCommand18,
|
|
66988
66626
|
keep: keepCommand,
|
|
66989
66627
|
models: modelsCommand,
|
|
66990
66628
|
skills: skillsCommand,
|
|
@@ -66993,10 +66631,10 @@ Full guide: __tooling__/docs/tools/baker/studio.md`
|
|
|
66993
66631
|
});
|
|
66994
66632
|
|
|
66995
66633
|
// src/commands/tag-manager/index.ts
|
|
66996
|
-
import { defineCommand as
|
|
66634
|
+
import { defineCommand as defineCommand221 } from "citty";
|
|
66997
66635
|
|
|
66998
66636
|
// src/commands/tag-manager/draft.ts
|
|
66999
|
-
import { defineCommand as
|
|
66637
|
+
import { defineCommand as defineCommand218 } from "citty";
|
|
67000
66638
|
|
|
67001
66639
|
// src/commands/tag-manager/shared.ts
|
|
67002
66640
|
import { readFileSync as readFileSync21 } from "fs";
|
|
@@ -67063,10 +66701,10 @@ async function stageOp4(op) {
|
|
|
67063
66701
|
handleError8(err);
|
|
67064
66702
|
}
|
|
67065
66703
|
}
|
|
67066
|
-
async function draftAction3(
|
|
66704
|
+
async function draftAction3(path48, body, chat) {
|
|
67067
66705
|
const chatId = resolveChatId(chat);
|
|
67068
66706
|
try {
|
|
67069
|
-
const data = await apiPost(
|
|
66707
|
+
const data = await apiPost(path48, { chatId, ...body });
|
|
67070
66708
|
writeJsonEnvelope({ ok: true, data });
|
|
67071
66709
|
return data;
|
|
67072
66710
|
} catch (err) {
|
|
@@ -67119,13 +66757,13 @@ registerSchema({
|
|
|
67119
66757
|
chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
|
|
67120
66758
|
}
|
|
67121
66759
|
});
|
|
67122
|
-
var draftCommand5 =
|
|
66760
|
+
var draftCommand5 = defineCommand218({
|
|
67123
66761
|
meta: {
|
|
67124
66762
|
name: "draft",
|
|
67125
66763
|
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
66764
|
},
|
|
67127
66765
|
subCommands: {
|
|
67128
|
-
list:
|
|
66766
|
+
list: defineCommand218({
|
|
67129
66767
|
meta: {
|
|
67130
66768
|
name: "list",
|
|
67131
66769
|
description: "Review everything staged on this chat (--json for the raw envelope)"
|
|
@@ -67138,7 +66776,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67138
66776
|
await draftList2(args5.json === true, args5.chat);
|
|
67139
66777
|
}
|
|
67140
66778
|
}),
|
|
67141
|
-
show:
|
|
66779
|
+
show: defineCommand218({
|
|
67142
66780
|
meta: {
|
|
67143
66781
|
name: "show",
|
|
67144
66782
|
description: "Print the full staged payload for one change \u2014 the receipt to verify it looks right before publish (never truncated)."
|
|
@@ -67155,7 +66793,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67155
66793
|
);
|
|
67156
66794
|
}
|
|
67157
66795
|
}),
|
|
67158
|
-
amend:
|
|
66796
|
+
amend: defineCommand218({
|
|
67159
66797
|
meta: {
|
|
67160
66798
|
name: "amend",
|
|
67161
66799
|
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 +66810,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67172
66810
|
});
|
|
67173
66811
|
}
|
|
67174
66812
|
}),
|
|
67175
|
-
remove:
|
|
66813
|
+
remove: defineCommand218({
|
|
67176
66814
|
meta: { name: "remove", description: "Remove one staged change (cascades to anything depending on it)" },
|
|
67177
66815
|
args: { ref: { type: "positional", description: "Staged ref (gtm_temp_*) or target", required: false } },
|
|
67178
66816
|
run: async ({ args: args5 }) => {
|
|
@@ -67181,7 +66819,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67181
66819
|
});
|
|
67182
66820
|
}
|
|
67183
66821
|
}),
|
|
67184
|
-
clear:
|
|
66822
|
+
clear: defineCommand218({
|
|
67185
66823
|
meta: { name: "clear", description: "Discard all Tag Manager changes staged on this chat" },
|
|
67186
66824
|
run: async () => {
|
|
67187
66825
|
await draftAction3("/api/tag-manager/draft/clear", {});
|
|
@@ -67191,7 +66829,7 @@ var draftCommand5 = defineCommand224({
|
|
|
67191
66829
|
});
|
|
67192
66830
|
|
|
67193
66831
|
// src/commands/tag-manager/read.ts
|
|
67194
|
-
import { defineCommand as
|
|
66832
|
+
import { defineCommand as defineCommand219 } from "citty";
|
|
67195
66833
|
registerSchema({
|
|
67196
66834
|
command: "tagManager.containers",
|
|
67197
66835
|
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 +66870,7 @@ function containersHints(containers) {
|
|
|
67232
66870
|
}))
|
|
67233
66871
|
});
|
|
67234
66872
|
}
|
|
67235
|
-
var containersCommand =
|
|
66873
|
+
var containersCommand = defineCommand219({
|
|
67236
66874
|
meta: {
|
|
67237
66875
|
name: "containers",
|
|
67238
66876
|
description: `List Tag Manager containers reachable by this company's connection.
|
|
@@ -67249,7 +66887,7 @@ Start here:
|
|
|
67249
66887
|
}
|
|
67250
66888
|
}
|
|
67251
66889
|
});
|
|
67252
|
-
var readCommand =
|
|
66890
|
+
var readCommand = defineCommand219({
|
|
67253
66891
|
meta: {
|
|
67254
66892
|
name: "read",
|
|
67255
66893
|
description: `Read the current contents of the Tag Manager container \u2014 always do this before staging changes.
|
|
@@ -67291,7 +66929,7 @@ Examples:
|
|
|
67291
66929
|
});
|
|
67292
66930
|
|
|
67293
66931
|
// src/commands/tag-manager/write-commands.ts
|
|
67294
|
-
import { defineCommand as
|
|
66932
|
+
import { defineCommand as defineCommand220 } from "citty";
|
|
67295
66933
|
var CONTAINER_ARG_DESCRIPTION = "Numeric container id (optional only when one container is connected \u2014 run `baker tag-manager containers`)";
|
|
67296
66934
|
var ENTITIES = [
|
|
67297
66935
|
{
|
|
@@ -67347,10 +66985,10 @@ for (const { entity, noun, createHint } of ENTITIES) {
|
|
|
67347
66985
|
});
|
|
67348
66986
|
}
|
|
67349
66987
|
function entityCommand(entity, noun, example) {
|
|
67350
|
-
return
|
|
66988
|
+
return defineCommand220({
|
|
67351
66989
|
meta: { name: entity, description: `Stage ${noun} changes on this chat's Tag Manager draft` },
|
|
67352
66990
|
subCommands: {
|
|
67353
|
-
create:
|
|
66991
|
+
create: defineCommand220({
|
|
67354
66992
|
meta: {
|
|
67355
66993
|
name: "create",
|
|
67356
66994
|
description: `Stage a new ${noun}
|
|
@@ -67372,7 +67010,7 @@ Examples:
|
|
|
67372
67010
|
});
|
|
67373
67011
|
}
|
|
67374
67012
|
}),
|
|
67375
|
-
update:
|
|
67013
|
+
update: defineCommand220({
|
|
67376
67014
|
meta: {
|
|
67377
67015
|
name: "update",
|
|
67378
67016
|
description: `Stage an update to an existing ${noun} (pass its id or path)`
|
|
@@ -67392,7 +67030,7 @@ Examples:
|
|
|
67392
67030
|
});
|
|
67393
67031
|
}
|
|
67394
67032
|
}),
|
|
67395
|
-
delete:
|
|
67033
|
+
delete: defineCommand220({
|
|
67396
67034
|
meta: { name: "delete", description: `Stage the deletion of a ${noun} (pass its id or path)` },
|
|
67397
67035
|
args: {
|
|
67398
67036
|
id: { type: "positional", description: `${noun} id or path`, required: false },
|
|
@@ -67433,7 +67071,7 @@ function builtinTypes(args5) {
|
|
|
67433
67071
|
}
|
|
67434
67072
|
return raw.split(",").map((entry) => entry.trim());
|
|
67435
67073
|
}
|
|
67436
|
-
var builtinCommand =
|
|
67074
|
+
var builtinCommand = defineCommand220({
|
|
67437
67075
|
meta: {
|
|
67438
67076
|
name: "builtin",
|
|
67439
67077
|
description: `Enable or disable built-in variables
|
|
@@ -67443,7 +67081,7 @@ Examples:
|
|
|
67443
67081
|
baker tag-manager builtin disable --types formId`
|
|
67444
67082
|
},
|
|
67445
67083
|
subCommands: {
|
|
67446
|
-
enable:
|
|
67084
|
+
enable: defineCommand220({
|
|
67447
67085
|
meta: { name: "enable", description: "Stage enabling built-in variables" },
|
|
67448
67086
|
args: {
|
|
67449
67087
|
types: { type: "string", description: "Comma-separated types", required: false },
|
|
@@ -67457,7 +67095,7 @@ Examples:
|
|
|
67457
67095
|
});
|
|
67458
67096
|
}
|
|
67459
67097
|
}),
|
|
67460
|
-
disable:
|
|
67098
|
+
disable: defineCommand220({
|
|
67461
67099
|
meta: { name: "disable", description: "Stage disabling built-in variables" },
|
|
67462
67100
|
args: {
|
|
67463
67101
|
types: { type: "string", description: "Comma-separated types", required: false },
|
|
@@ -67475,7 +67113,7 @@ Examples:
|
|
|
67475
67113
|
});
|
|
67476
67114
|
|
|
67477
67115
|
// src/commands/tag-manager/index.ts
|
|
67478
|
-
var tagManagerCommand =
|
|
67116
|
+
var tagManagerCommand = defineCommand221({
|
|
67479
67117
|
meta: {
|
|
67480
67118
|
name: "tag-manager",
|
|
67481
67119
|
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 +67150,7 @@ Full guide: __tooling__/docs/tools/baker/tag-manager.md`
|
|
|
67512
67150
|
});
|
|
67513
67151
|
|
|
67514
67152
|
// src/commands/tags/index.ts
|
|
67515
|
-
import { defineCommand as
|
|
67153
|
+
import { defineCommand as defineCommand222 } from "citty";
|
|
67516
67154
|
|
|
67517
67155
|
// src/commands/tags/shared.ts
|
|
67518
67156
|
function failApi3(err) {
|
|
@@ -67592,7 +67230,7 @@ async function listTags(json) {
|
|
|
67592
67230
|
var listArgs12 = {
|
|
67593
67231
|
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" }
|
|
67594
67232
|
};
|
|
67595
|
-
var
|
|
67233
|
+
var listCommand19 = defineCommand222({
|
|
67596
67234
|
meta: {
|
|
67597
67235
|
name: "list",
|
|
67598
67236
|
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 +67249,7 @@ async function listDraft4(chat) {
|
|
|
67611
67249
|
failApi3(err);
|
|
67612
67250
|
}
|
|
67613
67251
|
}
|
|
67614
|
-
var draftCommand6 =
|
|
67252
|
+
var draftCommand6 = defineCommand222({
|
|
67615
67253
|
meta: {
|
|
67616
67254
|
name: "draft",
|
|
67617
67255
|
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 +67259,7 @@ var draftCommand6 = defineCommand228({
|
|
|
67621
67259
|
await listDraft4(args5.chat);
|
|
67622
67260
|
}
|
|
67623
67261
|
});
|
|
67624
|
-
var tagsCommand4 =
|
|
67262
|
+
var tagsCommand4 = defineCommand222({
|
|
67625
67263
|
meta: {
|
|
67626
67264
|
name: "tags",
|
|
67627
67265
|
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 +67276,7 @@ Examples:
|
|
|
67638
67276
|
Full guide: __tooling__/docs/tools/baker/tags.md`
|
|
67639
67277
|
},
|
|
67640
67278
|
subCommands: {
|
|
67641
|
-
list:
|
|
67279
|
+
list: listCommand19,
|
|
67642
67280
|
draft: draftCommand6
|
|
67643
67281
|
},
|
|
67644
67282
|
// Bare `baker tags` lists the effective tags. `args` stays so citty knows this
|
|
@@ -67650,10 +67288,10 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
|
|
|
67650
67288
|
});
|
|
67651
67289
|
|
|
67652
67290
|
// src/commands/testimonials/index.ts
|
|
67653
|
-
import { defineCommand as
|
|
67291
|
+
import { defineCommand as defineCommand226 } from "citty";
|
|
67654
67292
|
|
|
67655
67293
|
// src/commands/testimonials/get.ts
|
|
67656
|
-
import { defineCommand as
|
|
67294
|
+
import { defineCommand as defineCommand223 } from "citty";
|
|
67657
67295
|
registerSchema({
|
|
67658
67296
|
command: "testimonials.get",
|
|
67659
67297
|
description: "Get a single testimonial by ID",
|
|
@@ -67661,7 +67299,7 @@ registerSchema({
|
|
|
67661
67299
|
id: { type: "string", description: "Testimonial ID", required: true }
|
|
67662
67300
|
}
|
|
67663
67301
|
});
|
|
67664
|
-
var getCommand6 =
|
|
67302
|
+
var getCommand6 = defineCommand223({
|
|
67665
67303
|
meta: { name: "get", description: "Get a single testimonial by ID. Example: baker testimonials get j571abc123" },
|
|
67666
67304
|
args: {
|
|
67667
67305
|
id: { type: "positional", description: "Testimonial ID", required: false },
|
|
@@ -67698,7 +67336,7 @@ var getCommand6 = defineCommand229({
|
|
|
67698
67336
|
});
|
|
67699
67337
|
|
|
67700
67338
|
// src/commands/testimonials/list.ts
|
|
67701
|
-
import { defineCommand as
|
|
67339
|
+
import { defineCommand as defineCommand224 } from "citty";
|
|
67702
67340
|
|
|
67703
67341
|
// src/commands/testimonials/emptyCorpusHints.ts
|
|
67704
67342
|
function resolveEmptyReason({
|
|
@@ -67855,7 +67493,7 @@ function buildListParams(args5) {
|
|
|
67855
67493
|
}
|
|
67856
67494
|
return params;
|
|
67857
67495
|
}
|
|
67858
|
-
var
|
|
67496
|
+
var listCommand20 = defineCommand224({
|
|
67859
67497
|
meta: {
|
|
67860
67498
|
name: "list",
|
|
67861
67499
|
description: "List testimonials with optional filters. Example: baker testimonials list --source google --sentiment positive"
|
|
@@ -67915,7 +67553,7 @@ var listCommand21 = defineCommand230({
|
|
|
67915
67553
|
});
|
|
67916
67554
|
|
|
67917
67555
|
// src/commands/testimonials/search.ts
|
|
67918
|
-
import { defineCommand as
|
|
67556
|
+
import { defineCommand as defineCommand225 } from "citty";
|
|
67919
67557
|
var FILTER_FLAGS2 = ["source", "rating-min", "rating-max", "status", "sentiment", "language", "tags"];
|
|
67920
67558
|
function languageBiasHint(results, requestedLanguage) {
|
|
67921
67559
|
if (requestedLanguage) {
|
|
@@ -67994,7 +67632,7 @@ function buildSearchRequest(query, args5) {
|
|
|
67994
67632
|
}
|
|
67995
67633
|
return body;
|
|
67996
67634
|
}
|
|
67997
|
-
var searchCommand3 =
|
|
67635
|
+
var searchCommand3 = defineCommand225({
|
|
67998
67636
|
meta: {
|
|
67999
67637
|
name: "search",
|
|
68000
67638
|
description: "Semantic search testimonials by text query. Uses hybrid BM25 + vector + reranking. Example: baker testimonials search 'great service' --rating-min 4"
|
|
@@ -68058,7 +67696,7 @@ var searchCommand3 = defineCommand231({
|
|
|
68058
67696
|
var tagsCommand5 = makeTagsCommand("testimonials", "testimonial", "/api/testimonials/tags");
|
|
68059
67697
|
|
|
68060
67698
|
// src/commands/testimonials/index.ts
|
|
68061
|
-
var testimonialsCommand =
|
|
67699
|
+
var testimonialsCommand = defineCommand226({
|
|
68062
67700
|
meta: {
|
|
68063
67701
|
name: "testimonials",
|
|
68064
67702
|
description: `Find and browse testimonials in Baker. Subcommands: search, get, list, tags.
|
|
@@ -68074,16 +67712,16 @@ Full guide: __tooling__/docs/tools/baker/testimonials.md`
|
|
|
68074
67712
|
subCommands: {
|
|
68075
67713
|
get: getCommand6,
|
|
68076
67714
|
search: searchCommand3,
|
|
68077
|
-
list:
|
|
67715
|
+
list: listCommand20,
|
|
68078
67716
|
tags: tagsCommand5
|
|
68079
67717
|
}
|
|
68080
67718
|
});
|
|
68081
67719
|
|
|
68082
67720
|
// src/commands/videos/index.ts
|
|
68083
|
-
import { defineCommand as
|
|
67721
|
+
import { defineCommand as defineCommand234 } from "citty";
|
|
68084
67722
|
|
|
68085
67723
|
// src/commands/videos/delete.ts
|
|
68086
|
-
import { defineCommand as
|
|
67724
|
+
import { defineCommand as defineCommand227 } from "citty";
|
|
68087
67725
|
registerSchema({
|
|
68088
67726
|
command: "videos.delete",
|
|
68089
67727
|
description: "Delete a video by ID",
|
|
@@ -68097,7 +67735,7 @@ registerSchema({
|
|
|
68097
67735
|
}
|
|
68098
67736
|
}
|
|
68099
67737
|
});
|
|
68100
|
-
var deleteCommand4 =
|
|
67738
|
+
var deleteCommand4 = defineCommand227({
|
|
68101
67739
|
meta: {
|
|
68102
67740
|
name: "delete",
|
|
68103
67741
|
description: "Delete a video by ID. Use --dry-run to preview. Example: baker videos delete j571abc123 --dry-run"
|
|
@@ -68138,7 +67776,7 @@ var deleteCommand4 = defineCommand233({
|
|
|
68138
67776
|
});
|
|
68139
67777
|
|
|
68140
67778
|
// src/commands/videos/describe.ts
|
|
68141
|
-
import { defineCommand as
|
|
67779
|
+
import { defineCommand as defineCommand228 } from "citty";
|
|
68142
67780
|
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
67781
|
registerSchema({
|
|
68144
67782
|
command: "videos.describe",
|
|
@@ -68155,7 +67793,7 @@ registerSchema({
|
|
|
68155
67793
|
full: { type: "boolean", description: "Return the whole library row, not just what changed", required: false }
|
|
68156
67794
|
}
|
|
68157
67795
|
});
|
|
68158
|
-
var describeCommand2 =
|
|
67796
|
+
var describeCommand2 = defineCommand228({
|
|
68159
67797
|
meta: {
|
|
68160
67798
|
name: "describe",
|
|
68161
67799
|
description: `Correct what the library says a video is. Only the fields you pass change; the rest keep their current values.
|
|
@@ -68212,10 +67850,108 @@ Example: baker videos describe j571abc123 --description "Customer explaining how
|
|
|
68212
67850
|
}
|
|
68213
67851
|
});
|
|
68214
67852
|
|
|
68215
|
-
// src/commands/videos/
|
|
68216
|
-
import {
|
|
67853
|
+
// src/commands/videos/get.ts
|
|
67854
|
+
import { defineCommand as defineCommand229 } from "citty";
|
|
67855
|
+
registerSchema({
|
|
67856
|
+
command: "videos.get",
|
|
67857
|
+
description: "Get a single video by ID",
|
|
67858
|
+
args: {
|
|
67859
|
+
id: { type: "string", description: "Video ID", required: true }
|
|
67860
|
+
}
|
|
67861
|
+
});
|
|
67862
|
+
var getCommand7 = defineCommand229({
|
|
67863
|
+
meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
|
|
67864
|
+
args: {
|
|
67865
|
+
id: { type: "positional", description: "Video ID", required: false },
|
|
67866
|
+
"video-id": { type: "string", description: "Video ID (alternative to positional)", required: false },
|
|
67867
|
+
output: { type: "string", description: "Output format: json|files|md", required: false, default: "json" },
|
|
67868
|
+
fields: { type: "string", description: "Comma-separated field names to include", required: false },
|
|
67869
|
+
full: { type: "boolean", description: "Include full metadata", required: false, default: false }
|
|
67870
|
+
},
|
|
67871
|
+
run: async ({ args: args5 }) => {
|
|
67872
|
+
try {
|
|
67873
|
+
const id = args5.id || args5["video-id"];
|
|
67874
|
+
if (!id) {
|
|
67875
|
+
writeJson({ ok: false, error: { code: "VALIDATION_ERROR", message: "Video ID is required" } });
|
|
67876
|
+
process.exit(1);
|
|
67877
|
+
}
|
|
67878
|
+
validateConvexId(id);
|
|
67879
|
+
const data = await apiGet("/api/videos/get", { id });
|
|
67880
|
+
writeOutput(
|
|
67881
|
+
{ ok: true, data },
|
|
67882
|
+
args5.output || "json",
|
|
67883
|
+
args5.fields ? args5.fields.split(",") : void 0,
|
|
67884
|
+
args5.full,
|
|
67885
|
+
videoNormalizer
|
|
67886
|
+
);
|
|
67887
|
+
} catch (err) {
|
|
67888
|
+
if (err instanceof ApiError) {
|
|
67889
|
+
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
67890
|
+
process.exit(1);
|
|
67891
|
+
}
|
|
67892
|
+
writeJson({ ok: false, error: { code: "INTERNAL_ERROR", message: "Unexpected error" } });
|
|
67893
|
+
process.exit(1);
|
|
67894
|
+
}
|
|
67895
|
+
}
|
|
67896
|
+
});
|
|
67897
|
+
|
|
67898
|
+
// src/commands/videos/group.ts
|
|
67899
|
+
import { defineCommand as defineCommand230 } from "citty";
|
|
67900
|
+
registerSchema({
|
|
67901
|
+
command: "videos.group",
|
|
67902
|
+
description: "List every clip and image that arrived in the same set as this video (carousel slides, one page)",
|
|
67903
|
+
args: {
|
|
67904
|
+
id: { type: "string", description: "A video or image id \u2014 returns that asset's whole set", required: false },
|
|
67905
|
+
"group-key": { type: "string", description: "The set key directly, when you already have it", required: false }
|
|
67906
|
+
}
|
|
67907
|
+
});
|
|
67908
|
+
var groupCommand2 = defineCommand230({
|
|
67909
|
+
meta: {
|
|
67910
|
+
name: "group",
|
|
67911
|
+
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>"
|
|
67912
|
+
},
|
|
67913
|
+
args: {
|
|
67914
|
+
id: { type: "positional", description: "A video or image id from the set", required: false },
|
|
67915
|
+
"group-key": { type: "string", description: "The set key, if you already have it", required: false }
|
|
67916
|
+
},
|
|
67917
|
+
run: async ({ args: args5 }) => {
|
|
67918
|
+
await runMediaGroupLookup({
|
|
67919
|
+
id: args5.id,
|
|
67920
|
+
groupKey: args5["group-key"],
|
|
67921
|
+
path: "/api/videos/group",
|
|
67922
|
+
idLabel: "a video or image id"
|
|
67923
|
+
});
|
|
67924
|
+
}
|
|
67925
|
+
});
|
|
67926
|
+
|
|
67927
|
+
// src/commands/videos/ingest.ts
|
|
67928
|
+
import { mkdtemp as mkdtemp3, rm as rm9, stat as stat11 } from "fs/promises";
|
|
67929
|
+
import { tmpdir as tmpdir4 } from "os";
|
|
68217
67930
|
import path47 from "path";
|
|
68218
|
-
import { defineCommand as
|
|
67931
|
+
import { defineCommand as defineCommand231 } from "citty";
|
|
67932
|
+
|
|
67933
|
+
// src/lib/streamUpload.ts
|
|
67934
|
+
import { createHash as createHash2 } from "crypto";
|
|
67935
|
+
import { createReadStream } from "fs";
|
|
67936
|
+
import { Readable } from "stream";
|
|
67937
|
+
import { pipeline } from "stream/promises";
|
|
67938
|
+
async function hashFile(filePath) {
|
|
67939
|
+
const hash = createHash2("sha256");
|
|
67940
|
+
await pipeline(createReadStream(filePath), hash);
|
|
67941
|
+
return hash.digest("hex");
|
|
67942
|
+
}
|
|
67943
|
+
async function putFileStreamed(args5) {
|
|
67944
|
+
const body = Readable.toWeb(createReadStream(args5.filePath));
|
|
67945
|
+
return await fetch(args5.putUrl, {
|
|
67946
|
+
method: "PUT",
|
|
67947
|
+
body,
|
|
67948
|
+
headers: {
|
|
67949
|
+
"Content-Type": args5.contentType,
|
|
67950
|
+
"Content-Length": String(args5.sizeBytes)
|
|
67951
|
+
},
|
|
67952
|
+
duplex: "half"
|
|
67953
|
+
});
|
|
67954
|
+
}
|
|
68219
67955
|
|
|
68220
67956
|
// src/commands/videos/videoPlatforms.ts
|
|
68221
67957
|
var PLATFORM_DOMAINS = {
|
|
@@ -68224,7 +67960,6 @@ var PLATFORM_DOMAINS = {
|
|
|
68224
67960
|
tiktok: ["tiktok.com"],
|
|
68225
67961
|
twitter: ["twitter.com", "x.com", "vxtwitter.com", "fixvx.com"],
|
|
68226
67962
|
facebook: ["facebook.com", "fb.watch", "fb.com"],
|
|
68227
|
-
linkedin: ["linkedin.com", "lnkd.in"],
|
|
68228
67963
|
reddit: ["reddit.com", "redd.it"],
|
|
68229
67964
|
vimeo: ["vimeo.com"],
|
|
68230
67965
|
dailymotion: ["dailymotion.com", "dai.ly"],
|
|
@@ -68329,181 +68064,6 @@ function safePathname(rawUrl) {
|
|
|
68329
68064
|
}
|
|
68330
68065
|
}
|
|
68331
68066
|
|
|
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
68067
|
// src/commands/videos/ingest.ts
|
|
68508
68068
|
registerSchema({
|
|
68509
68069
|
command: "videos.ingest",
|
|
@@ -68532,7 +68092,7 @@ registerSchema({
|
|
|
68532
68092
|
"dry-run": { type: "boolean", description: "Preview the operation without executing", required: false }
|
|
68533
68093
|
}
|
|
68534
68094
|
});
|
|
68535
|
-
var ingestCommand2 =
|
|
68095
|
+
var ingestCommand2 = defineCommand231({
|
|
68536
68096
|
meta: {
|
|
68537
68097
|
name: "ingest",
|
|
68538
68098
|
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 +68278,7 @@ function ingestUrl(args5) {
|
|
|
68718
68278
|
}
|
|
68719
68279
|
async function downloadThenIngest(args5, country) {
|
|
68720
68280
|
const vimeoCookie = captureVimeoCookie();
|
|
68721
|
-
const workDir = await mkdtemp3(
|
|
68281
|
+
const workDir = await mkdtemp3(path47.join(tmpdir4(), "videos-ingest-"));
|
|
68722
68282
|
try {
|
|
68723
68283
|
const probe = await probeYtDlp({ url: args5.url, country, vimeoCookie, cookieDir: workDir });
|
|
68724
68284
|
if (isAudioOnly(probe.info)) {
|
|
@@ -68794,7 +68354,7 @@ async function uploadToAssetStore(filePath, sizeBytes) {
|
|
|
68794
68354
|
}
|
|
68795
68355
|
|
|
68796
68356
|
// src/commands/videos/search.ts
|
|
68797
|
-
import { defineCommand as
|
|
68357
|
+
import { defineCommand as defineCommand232 } from "citty";
|
|
68798
68358
|
registerSchema({
|
|
68799
68359
|
command: "videos.search",
|
|
68800
68360
|
description: "Search videos by text query. Only returns ready videos.",
|
|
@@ -68804,7 +68364,7 @@ registerSchema({
|
|
|
68804
68364
|
tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
|
|
68805
68365
|
}
|
|
68806
68366
|
});
|
|
68807
|
-
var searchCommand4 =
|
|
68367
|
+
var searchCommand4 = defineCommand232({
|
|
68808
68368
|
meta: {
|
|
68809
68369
|
name: "search",
|
|
68810
68370
|
description: "Semantic search videos by text query. Uses hybrid BM25 + vector + reranking. Example: baker videos search 'product demo' --tags tutorial"
|
|
@@ -68856,7 +68416,7 @@ var tagsCommand6 = makeTagsCommand("videos", "video", "/api/videos/tags");
|
|
|
68856
68416
|
// src/commands/videos/upload.ts
|
|
68857
68417
|
import { readFile as readFile33, stat as stat12 } from "fs/promises";
|
|
68858
68418
|
import { basename as basename3, extname as extname4 } from "path";
|
|
68859
|
-
import { defineCommand as
|
|
68419
|
+
import { defineCommand as defineCommand233 } from "citty";
|
|
68860
68420
|
var MIME_MAP = {
|
|
68861
68421
|
".mp4": "video/mp4",
|
|
68862
68422
|
".mov": "video/quicktime",
|
|
@@ -68898,7 +68458,7 @@ function detectContentType(filePath) {
|
|
|
68898
68458
|
function isRemoteUrl3(value) {
|
|
68899
68459
|
return /^https?:\/\//i.test(value);
|
|
68900
68460
|
}
|
|
68901
|
-
var uploadCommand2 =
|
|
68461
|
+
var uploadCommand2 = defineCommand233({
|
|
68902
68462
|
meta: {
|
|
68903
68463
|
name: "upload",
|
|
68904
68464
|
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 +68542,10 @@ var uploadCommand2 = defineCommand240({
|
|
|
68982
68542
|
});
|
|
68983
68543
|
|
|
68984
68544
|
// src/commands/videos/index.ts
|
|
68985
|
-
var videosCommand =
|
|
68545
|
+
var videosCommand = defineCommand234({
|
|
68986
68546
|
meta: {
|
|
68987
68547
|
name: "videos",
|
|
68988
|
-
description: `Find and manage videos in Baker. Subcommands: search, get, upload, ingest,
|
|
68548
|
+
description: `Find and manage videos in Baker. Subcommands: search, get, upload, ingest, describe, delete, tags.
|
|
68989
68549
|
|
|
68990
68550
|
Examples:
|
|
68991
68551
|
baker videos search "product demo" --limit 5
|
|
@@ -68993,7 +68553,6 @@ Examples:
|
|
|
68993
68553
|
baker videos get <video-id>
|
|
68994
68554
|
baker videos upload ./demo.mp4
|
|
68995
68555
|
baker videos ingest https://www.youtube.com/watch?v=abc123
|
|
68996
|
-
baker videos fetch https://www.youtube.com/watch?v=abc123 --out ./clips
|
|
68997
68556
|
baker videos describe <video-id> --description "Customer testimonial, 30s"
|
|
68998
68557
|
baker videos delete <video-id> --dry-run
|
|
68999
68558
|
baker videos tags
|
|
@@ -69005,7 +68564,6 @@ Full guide: __tooling__/docs/tools/baker/videos.md`
|
|
|
69005
68564
|
search: searchCommand4,
|
|
69006
68565
|
upload: uploadCommand2,
|
|
69007
68566
|
ingest: ingestCommand2,
|
|
69008
|
-
fetch: fetchCommand2,
|
|
69009
68567
|
describe: describeCommand2,
|
|
69010
68568
|
delete: deleteCommand4,
|
|
69011
68569
|
tags: tagsCommand6
|
|
@@ -69013,10 +68571,10 @@ Full guide: __tooling__/docs/tools/baker/videos.md`
|
|
|
69013
68571
|
});
|
|
69014
68572
|
|
|
69015
68573
|
// src/commands/winning-ads/index.ts
|
|
69016
|
-
import { defineCommand as
|
|
68574
|
+
import { defineCommand as defineCommand247 } from "citty";
|
|
69017
68575
|
|
|
69018
68576
|
// src/commands/winning-ads/advertisers.ts
|
|
69019
|
-
import { defineCommand as
|
|
68577
|
+
import { defineCommand as defineCommand235 } from "citty";
|
|
69020
68578
|
|
|
69021
68579
|
// src/commands/winning-ads/shared.ts
|
|
69022
68580
|
function splitList3(value) {
|
|
@@ -69025,7 +68583,7 @@ function splitList3(value) {
|
|
|
69025
68583
|
}
|
|
69026
68584
|
return value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
69027
68585
|
}
|
|
69028
|
-
function
|
|
68586
|
+
function reportError2(err) {
|
|
69029
68587
|
if (err instanceof ApiError) {
|
|
69030
68588
|
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
69031
68589
|
process.exit(1);
|
|
@@ -69069,7 +68627,7 @@ function advertiserNormalizer(record, full) {
|
|
|
69069
68627
|
last_synced_at: record.last_synced_at ?? null
|
|
69070
68628
|
};
|
|
69071
68629
|
}
|
|
69072
|
-
var advertisersCommand2 =
|
|
68630
|
+
var advertisersCommand2 = defineCommand235({
|
|
69073
68631
|
meta: {
|
|
69074
68632
|
name: "advertisers",
|
|
69075
68633
|
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 +68679,13 @@ var advertisersCommand2 = defineCommand242({
|
|
|
69121
68679
|
advertiserNormalizer
|
|
69122
68680
|
);
|
|
69123
68681
|
} catch (err) {
|
|
69124
|
-
|
|
68682
|
+
reportError2(err);
|
|
69125
68683
|
}
|
|
69126
68684
|
}
|
|
69127
68685
|
});
|
|
69128
68686
|
|
|
69129
68687
|
// src/commands/winning-ads/brief.ts
|
|
69130
|
-
import { defineCommand as
|
|
68688
|
+
import { defineCommand as defineCommand236 } from "citty";
|
|
69131
68689
|
registerSchema({
|
|
69132
68690
|
command: "winning-ads.brief",
|
|
69133
68691
|
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 +68731,7 @@ function parseDna(raw) {
|
|
|
69173
68731
|
}
|
|
69174
68732
|
return parsed;
|
|
69175
68733
|
}
|
|
69176
|
-
var briefCommand =
|
|
68734
|
+
var briefCommand = defineCommand236({
|
|
69177
68735
|
meta: {
|
|
69178
68736
|
name: "brief",
|
|
69179
68737
|
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 +68761,13 @@ var briefCommand = defineCommand243({
|
|
|
69203
68761
|
const data = await apiPost("/api/ad-library/brief", body);
|
|
69204
68762
|
writeJson({ ok: true, data });
|
|
69205
68763
|
} catch (err) {
|
|
69206
|
-
|
|
68764
|
+
reportError2(err);
|
|
69207
68765
|
}
|
|
69208
68766
|
}
|
|
69209
68767
|
});
|
|
69210
68768
|
|
|
69211
68769
|
// src/commands/winning-ads/content.ts
|
|
69212
|
-
import { defineCommand as
|
|
68770
|
+
import { defineCommand as defineCommand237 } from "citty";
|
|
69213
68771
|
registerSchema({
|
|
69214
68772
|
command: "winning-ads.content",
|
|
69215
68773
|
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 +68780,7 @@ registerSchema({
|
|
|
69222
68780
|
}
|
|
69223
68781
|
}
|
|
69224
68782
|
});
|
|
69225
|
-
var contentCommand =
|
|
68783
|
+
var contentCommand = defineCommand237({
|
|
69226
68784
|
meta: {
|
|
69227
68785
|
name: "content",
|
|
69228
68786
|
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 +68823,13 @@ var contentCommand = defineCommand244({
|
|
|
69265
68823
|
adContentNormalizer
|
|
69266
68824
|
);
|
|
69267
68825
|
} catch (err) {
|
|
69268
|
-
|
|
68826
|
+
reportError2(err);
|
|
69269
68827
|
}
|
|
69270
68828
|
}
|
|
69271
68829
|
});
|
|
69272
68830
|
|
|
69273
68831
|
// src/commands/winning-ads/feed.ts
|
|
69274
|
-
import { defineCommand as
|
|
68832
|
+
import { defineCommand as defineCommand238 } from "citty";
|
|
69275
68833
|
function buildFeedParams(input) {
|
|
69276
68834
|
const params = {};
|
|
69277
68835
|
const advertiser = splitList3(input.advertiser);
|
|
@@ -69323,7 +68881,7 @@ registerSchema({
|
|
|
69323
68881
|
format: { type: "string", description: "Comma-separated formats to include (e.g. static,video)", required: false }
|
|
69324
68882
|
}
|
|
69325
68883
|
});
|
|
69326
|
-
var feedCommand2 =
|
|
68884
|
+
var feedCommand2 = defineCommand238({
|
|
69327
68885
|
meta: {
|
|
69328
68886
|
name: "feed",
|
|
69329
68887
|
description: "Winners across every brand you follow (browse, then trim per advertiser). Example: baker winning-ads feed --per-advertiser 5 --output md"
|
|
@@ -69402,13 +68960,13 @@ var feedCommand2 = defineCommand245({
|
|
|
69402
68960
|
`);
|
|
69403
68961
|
}
|
|
69404
68962
|
} catch (err) {
|
|
69405
|
-
|
|
68963
|
+
reportError2(err);
|
|
69406
68964
|
}
|
|
69407
68965
|
}
|
|
69408
68966
|
});
|
|
69409
68967
|
|
|
69410
68968
|
// src/commands/winning-ads/follow.ts
|
|
69411
|
-
import { defineCommand as
|
|
68969
|
+
import { defineCommand as defineCommand239 } from "citty";
|
|
69412
68970
|
var PLATFORMS = adLibraryPlatformSchema.options;
|
|
69413
68971
|
registerSchema({
|
|
69414
68972
|
command: "winning-ads.follow",
|
|
@@ -69423,7 +68981,7 @@ registerSchema({
|
|
|
69423
68981
|
label: { type: "string", description: "Optional display label (defaults to the resolved name)", required: false }
|
|
69424
68982
|
}
|
|
69425
68983
|
});
|
|
69426
|
-
var followCommand =
|
|
68984
|
+
var followCommand = defineCommand239({
|
|
69427
68985
|
meta: {
|
|
69428
68986
|
name: "follow",
|
|
69429
68987
|
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 +69022,13 @@ var followCommand = defineCommand246({
|
|
|
69464
69022
|
}
|
|
69465
69023
|
writeJson({ ok: true, data, hints: hints2 });
|
|
69466
69024
|
} catch (err) {
|
|
69467
|
-
|
|
69025
|
+
reportError2(err);
|
|
69468
69026
|
}
|
|
69469
69027
|
}
|
|
69470
69028
|
});
|
|
69471
69029
|
|
|
69472
69030
|
// src/commands/winning-ads/follow-competitors.ts
|
|
69473
|
-
import { defineCommand as
|
|
69031
|
+
import { defineCommand as defineCommand240 } from "citty";
|
|
69474
69032
|
var PLATFORMS2 = adLibraryPlatformSchema.options;
|
|
69475
69033
|
var BATCH_TIMEOUT_MS = 3e5;
|
|
69476
69034
|
function buildFollowBatchBody(input) {
|
|
@@ -69503,7 +69061,7 @@ registerSchema({
|
|
|
69503
69061
|
}
|
|
69504
69062
|
}
|
|
69505
69063
|
});
|
|
69506
|
-
var followCompetitorsCommand =
|
|
69064
|
+
var followCompetitorsCommand = defineCommand240({
|
|
69507
69065
|
meta: {
|
|
69508
69066
|
name: "follow-competitors",
|
|
69509
69067
|
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 +69130,13 @@ var followCompetitorsCommand = defineCommand247({
|
|
|
69572
69130
|
}
|
|
69573
69131
|
writeJson({ ok: true, data, hints: hints2.length > 0 ? hints2 : void 0 });
|
|
69574
69132
|
} catch (err) {
|
|
69575
|
-
|
|
69133
|
+
reportError2(err);
|
|
69576
69134
|
}
|
|
69577
69135
|
}
|
|
69578
69136
|
});
|
|
69579
69137
|
|
|
69580
69138
|
// src/commands/winning-ads/following.ts
|
|
69581
|
-
import { defineCommand as
|
|
69139
|
+
import { defineCommand as defineCommand241 } from "citty";
|
|
69582
69140
|
registerSchema({
|
|
69583
69141
|
command: "winning-ads.following",
|
|
69584
69142
|
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 +69190,7 @@ function followingNormalizer(record, full) {
|
|
|
69632
69190
|
platforms: Array.isArray(record.platforms) ? record.platforms : []
|
|
69633
69191
|
};
|
|
69634
69192
|
}
|
|
69635
|
-
var followingCommand =
|
|
69193
|
+
var followingCommand = defineCommand241({
|
|
69636
69194
|
meta: {
|
|
69637
69195
|
name: "following",
|
|
69638
69196
|
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 +69220,13 @@ var followingCommand = defineCommand248({
|
|
|
69662
69220
|
followingNormalizer
|
|
69663
69221
|
);
|
|
69664
69222
|
} catch (err) {
|
|
69665
|
-
|
|
69223
|
+
reportError2(err);
|
|
69666
69224
|
}
|
|
69667
69225
|
}
|
|
69668
69226
|
});
|
|
69669
69227
|
|
|
69670
69228
|
// src/commands/winning-ads/patterns.ts
|
|
69671
|
-
import { defineCommand as
|
|
69229
|
+
import { defineCommand as defineCommand242 } from "citty";
|
|
69672
69230
|
registerSchema({
|
|
69673
69231
|
command: "winning-ads.patterns",
|
|
69674
69232
|
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 +69265,7 @@ function discriminatorRow(record) {
|
|
|
69707
69265
|
top_values_duds: Array.isArray(record.top_values_b) ? record.top_values_b.join(", ") : ""
|
|
69708
69266
|
};
|
|
69709
69267
|
}
|
|
69710
|
-
var patternsCommand =
|
|
69268
|
+
var patternsCommand = defineCommand242({
|
|
69711
69269
|
meta: {
|
|
69712
69270
|
name: "patterns",
|
|
69713
69271
|
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 +69315,13 @@ var patternsCommand = defineCommand249({
|
|
|
69757
69315
|
(record) => discriminatorRow(record)
|
|
69758
69316
|
);
|
|
69759
69317
|
} catch (err) {
|
|
69760
|
-
|
|
69318
|
+
reportError2(err);
|
|
69761
69319
|
}
|
|
69762
69320
|
}
|
|
69763
69321
|
});
|
|
69764
69322
|
|
|
69765
69323
|
// src/commands/winning-ads/search.ts
|
|
69766
|
-
import { defineCommand as
|
|
69324
|
+
import { defineCommand as defineCommand243 } from "citty";
|
|
69767
69325
|
registerSchema({
|
|
69768
69326
|
command: "winning-ads.search",
|
|
69769
69327
|
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 +69457,9 @@ function reportSearchError(err) {
|
|
|
69899
69457
|
writeJson({ ok: false, error: { code: err.code, message: err.message, fix } });
|
|
69900
69458
|
process.exit(1);
|
|
69901
69459
|
}
|
|
69902
|
-
|
|
69460
|
+
reportError2(err);
|
|
69903
69461
|
}
|
|
69904
|
-
var searchCommand5 =
|
|
69462
|
+
var searchCommand5 = defineCommand243({
|
|
69905
69463
|
meta: {
|
|
69906
69464
|
name: "search",
|
|
69907
69465
|
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 +69579,7 @@ var searchCommand5 = defineCommand250({
|
|
|
70021
69579
|
});
|
|
70022
69580
|
|
|
70023
69581
|
// src/commands/winning-ads/seeds.ts
|
|
70024
|
-
import { defineCommand as
|
|
69582
|
+
import { defineCommand as defineCommand244 } from "citty";
|
|
70025
69583
|
function leanRow(r) {
|
|
70026
69584
|
return {
|
|
70027
69585
|
key: r.key,
|
|
@@ -70049,7 +69607,7 @@ function makeSeedCommand(opts) {
|
|
|
70049
69607
|
limit: { type: "number", description: "Max keys 1-100 (default 20)", required: false, default: 20 }
|
|
70050
69608
|
}
|
|
70051
69609
|
});
|
|
70052
|
-
return
|
|
69610
|
+
return defineCommand244({
|
|
70053
69611
|
meta: { name: opts.name, description: opts.description },
|
|
70054
69612
|
args: {
|
|
70055
69613
|
platform: { type: "string", description: "Single platform to segment on", required: false },
|
|
@@ -70076,7 +69634,7 @@ function makeSeedCommand(opts) {
|
|
|
70076
69634
|
}
|
|
70077
69635
|
writeOutput({ ok: true, data: projected }, output);
|
|
70078
69636
|
} catch (err) {
|
|
70079
|
-
|
|
69637
|
+
reportError2(err);
|
|
70080
69638
|
}
|
|
70081
69639
|
}
|
|
70082
69640
|
});
|
|
@@ -70098,7 +69656,7 @@ var formatsCommand = makeSeedCommand({
|
|
|
70098
69656
|
});
|
|
70099
69657
|
|
|
70100
69658
|
// src/commands/winning-ads/unfollow.ts
|
|
70101
|
-
import { defineCommand as
|
|
69659
|
+
import { defineCommand as defineCommand245 } from "citty";
|
|
70102
69660
|
registerSchema({
|
|
70103
69661
|
command: "winning-ads.unfollow",
|
|
70104
69662
|
description: "Stop following a brand \u2014 removes it from your ad-dna library by advertiser id.",
|
|
@@ -70106,7 +69664,7 @@ registerSchema({
|
|
|
70106
69664
|
advertiser: { type: "string", description: "Advertiser id to unfollow", required: true }
|
|
70107
69665
|
}
|
|
70108
69666
|
});
|
|
70109
|
-
var unfollowCommand =
|
|
69667
|
+
var unfollowCommand = defineCommand245({
|
|
70110
69668
|
meta: {
|
|
70111
69669
|
name: "unfollow",
|
|
70112
69670
|
description: "Stop following a brand by advertiser id. Example: baker winning-ads unfollow adv_123"
|
|
@@ -70121,13 +69679,13 @@ var unfollowCommand = defineCommand252({
|
|
|
70121
69679
|
});
|
|
70122
69680
|
writeJson({ ok: true, data });
|
|
70123
69681
|
} catch (err) {
|
|
70124
|
-
|
|
69682
|
+
reportError2(err);
|
|
70125
69683
|
}
|
|
70126
69684
|
}
|
|
70127
69685
|
});
|
|
70128
69686
|
|
|
70129
69687
|
// src/commands/winning-ads/winners.ts
|
|
70130
|
-
import { defineCommand as
|
|
69688
|
+
import { defineCommand as defineCommand246 } from "citty";
|
|
70131
69689
|
registerSchema({
|
|
70132
69690
|
command: "winning-ads.winners",
|
|
70133
69691
|
description: "Top winning ads for one advertiser id (from `advertisers` or `following`). Returns lean winner cards; add --full for DNA + longevity.",
|
|
@@ -70137,7 +69695,7 @@ registerSchema({
|
|
|
70137
69695
|
platform: { type: "string", description: "Filter to a single platform: meta|linkedin|tiktok", required: false }
|
|
70138
69696
|
}
|
|
70139
69697
|
});
|
|
70140
|
-
var winnersCommand =
|
|
69698
|
+
var winnersCommand = defineCommand246({
|
|
70141
69699
|
meta: {
|
|
70142
69700
|
name: "winners",
|
|
70143
69701
|
description: "Top winning ads for a specific advertiser id. Example: baker winning-ads winners adv_123 --top 15 --output md"
|
|
@@ -70181,13 +69739,13 @@ var winnersCommand = defineCommand253({
|
|
|
70181
69739
|
winningAdNormalizer
|
|
70182
69740
|
);
|
|
70183
69741
|
} catch (err) {
|
|
70184
|
-
|
|
69742
|
+
reportError2(err);
|
|
70185
69743
|
}
|
|
70186
69744
|
}
|
|
70187
69745
|
});
|
|
70188
69746
|
|
|
70189
69747
|
// src/commands/winning-ads/index.ts
|
|
70190
|
-
var winningAdsCommand =
|
|
69748
|
+
var winningAdsCommand = defineCommand247({
|
|
70191
69749
|
meta: {
|
|
70192
69750
|
name: "winning-ads",
|
|
70193
69751
|
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 +69817,7 @@ function getCliVersion() {
|
|
|
70259
69817
|
}
|
|
70260
69818
|
|
|
70261
69819
|
// src/cli.ts
|
|
70262
|
-
var main =
|
|
69820
|
+
var main = defineCommand248({
|
|
70263
69821
|
meta: {
|
|
70264
69822
|
name: "baker",
|
|
70265
69823
|
version: getCliVersion(),
|
|
@@ -70299,7 +69857,6 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
70299
69857
|
history: historyCommand2,
|
|
70300
69858
|
hubspot: hubspotCommand,
|
|
70301
69859
|
"winning-ads": winningAdsCommand,
|
|
70302
|
-
"media-sources": mediaSourcesCommand,
|
|
70303
69860
|
mcp: mcpCommand,
|
|
70304
69861
|
schema: schemaCommand2
|
|
70305
69862
|
}
|