@koda-sl/baker-cli 0.366.0-dev.b6091bc9b → 0.366.0-dev.daafff067
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 +3 -4
- package/dist/{chunk-A2LM5EDF.js → chunk-FXVELNAS.js} +6 -3
- package/dist/{chunk-A2LM5EDF.js.map → chunk-FXVELNAS.js.map} +1 -1
- package/dist/{chunk-BLMXG42J.js → chunk-L4QXAYIC.js} +15 -3
- package/dist/{chunk-BLMXG42J.js.map → chunk-L4QXAYIC.js.map} +1 -1
- package/dist/cli.js +205 -317
- package/dist/cli.js.map +1 -1
- package/dist/{output-M2DBCZFG.js → output-AT5SRVH7.js} +2 -2
- package/dist/{shared-BROA3UXS.js → shared-HZ44PY2F.js} +5 -3
- package/package.json +2 -1
- /package/dist/{output-M2DBCZFG.js.map → output-AT5SRVH7.js.map} +0 -0
- /package/dist/{shared-BROA3UXS.js.map → shared-HZ44PY2F.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -77,8 +77,9 @@ import {
|
|
|
77
77
|
handleMetaError,
|
|
78
78
|
resolveAccountIdArg,
|
|
79
79
|
resolveEffectiveStatus,
|
|
80
|
+
statusFilterHints,
|
|
80
81
|
todayIso
|
|
81
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-L4QXAYIC.js";
|
|
82
83
|
import {
|
|
83
84
|
buildQueryCacheKey,
|
|
84
85
|
cacheGet,
|
|
@@ -94,7 +95,7 @@ import {
|
|
|
94
95
|
writeAdsJson,
|
|
95
96
|
writeAdsOutput,
|
|
96
97
|
writeJsonEnvelope
|
|
97
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-FXVELNAS.js";
|
|
98
99
|
import {
|
|
99
100
|
ApiError,
|
|
100
101
|
apiGet,
|
|
@@ -9221,9 +9222,10 @@ var linkCommand = defineCommand7({
|
|
|
9221
9222
|
|
|
9222
9223
|
// src/commands/actions/list.ts
|
|
9223
9224
|
import { defineCommand as defineCommand8 } from "citty";
|
|
9225
|
+
import { Lexer } from "marked";
|
|
9224
9226
|
registerSchema({
|
|
9225
9227
|
command: "actions.list",
|
|
9226
|
-
description: 'List actions for the current company. Default: pre-bucketed (claimable/myClaims/blocked/claimedByOthers/completed/discarded), each bucket ordered do-first (blockers before blocked, then highest-leverage). The bucketed view reads the whole open backlog, so nothing pending is ever hidden from it. Set --bucketed=false for a flat list filterable by --status, orderable by --sort, and windowed by --limit. Looking for one Task by name? --search "conversion goal" --output md returns only the matching Tasks instead of the whole backlog.',
|
|
9228
|
+
description: 'List actions for the current company. Compact by default: a bucketed Task is its id and name (plus its blockers, holder or staged change); a flat row (--search, --bucketed=false) adds status, priority, tags and a one-line `summary` of its description. Checking whether a Task already exists? --search "<words>" returns the matches with their summaries. --full prints whole descriptions (or `baker actions get <id>` for one Task). Default: pre-bucketed (claimable/myClaims/blocked/claimedByOthers/completed/discarded), each bucket ordered do-first (blockers before blocked, then highest-leverage). The bucketed view reads the whole open backlog, so nothing pending is ever hidden from it. Set --bucketed=false for a flat list filterable by --status, orderable by --sort, and windowed by --limit. Looking for one Task by name? --search "conversion goal" --output md returns only the matching Tasks instead of the whole backlog.',
|
|
9227
9229
|
args: {
|
|
9228
9230
|
search: {
|
|
9229
9231
|
type: "string",
|
|
@@ -9251,13 +9253,19 @@ registerSchema({
|
|
|
9251
9253
|
description: `How many Tasks a flat list reads, newest first (only with --bucketed=false). Default: ${ACTIONS_LIST_DEFAULT_LIMIT}. When the read comes back full, hints[] says so \u2014 raise --limit to reach older Tasks.`,
|
|
9252
9254
|
required: false
|
|
9253
9255
|
},
|
|
9256
|
+
full: {
|
|
9257
|
+
type: "boolean",
|
|
9258
|
+
description: "Print every Task's whole description and full record instead of the compact row. Large on a real backlog \u2014 prefer --search, or `baker actions get <id>` for one Task.",
|
|
9259
|
+
required: false,
|
|
9260
|
+
default: false
|
|
9261
|
+
},
|
|
9254
9262
|
output: { type: "string", description: "Output format: json|md. Default: json", required: false }
|
|
9255
9263
|
}
|
|
9256
9264
|
});
|
|
9257
9265
|
var listCommand2 = defineCommand8({
|
|
9258
9266
|
meta: {
|
|
9259
9267
|
name: "list",
|
|
9260
|
-
description: "List actions. Default: bucketed view (claimable, myClaims, blocked, claimedByOthers). Use --bucketed=false for raw filter by --status,
|
|
9268
|
+
description: "List actions, one short row per Task (id and name; --search rows add a one-line summary). Default: bucketed view (claimable, myClaims, blocked, claimedByOthers). Use --bucketed=false for raw filter by --status, --search <text> to find Tasks by name, --full for whole descriptions."
|
|
9261
9269
|
},
|
|
9262
9270
|
args: {
|
|
9263
9271
|
search: { type: "string", description: "Find Tasks by words in name/description/tags", required: false },
|
|
@@ -9265,6 +9273,12 @@ var listCommand2 = defineCommand8({
|
|
|
9265
9273
|
status: { type: "string", description: "Status filter (raw mode)", required: false },
|
|
9266
9274
|
sort: { type: "string", description: "Order (raw mode): priority|recent", required: false },
|
|
9267
9275
|
limit: { type: "string", description: "How many Tasks to read (raw mode)", required: false },
|
|
9276
|
+
full: {
|
|
9277
|
+
type: "boolean",
|
|
9278
|
+
description: "Whole descriptions and full records",
|
|
9279
|
+
required: false,
|
|
9280
|
+
default: false
|
|
9281
|
+
},
|
|
9268
9282
|
output: { type: "string", description: "Output format: json|md", required: false }
|
|
9269
9283
|
},
|
|
9270
9284
|
run: async ({ args: args5 }) => {
|
|
@@ -9272,11 +9286,18 @@ var listCommand2 = defineCommand8({
|
|
|
9272
9286
|
const body = buildListRequest(args5, getEnv().BAKER_CHAT_ID);
|
|
9273
9287
|
const response = await apiPost("/api/actions/list", body);
|
|
9274
9288
|
const hints2 = body.bucketed === false && body.limit !== void 0 && response.ok && Array.isArray(response.data) ? buildListHints({ returned: response.data.length, limit: body.limit }) : [];
|
|
9275
|
-
const
|
|
9289
|
+
const compact3 = !args5.full && response.ok;
|
|
9290
|
+
const shaped = compact3 ? { ...response, data: compactListData(response.data) } : response;
|
|
9291
|
+
const envelope = hints2.length > 0 ? { ...shaped, hints: hints2 } : shaped;
|
|
9276
9292
|
if (args5.output === "md" && envelope.ok) {
|
|
9277
9293
|
process.stdout.write(renderMarkdown(envelope.data, hints2));
|
|
9278
9294
|
return;
|
|
9279
9295
|
}
|
|
9296
|
+
if (compact3) {
|
|
9297
|
+
process.stdout.write(`${JSON.stringify(envelope)}
|
|
9298
|
+
`);
|
|
9299
|
+
return;
|
|
9300
|
+
}
|
|
9280
9301
|
writeJson(envelope);
|
|
9281
9302
|
} catch (err) {
|
|
9282
9303
|
failApi(err);
|
|
@@ -9304,6 +9325,81 @@ function buildListRequest(args5, chatId) {
|
|
|
9304
9325
|
}
|
|
9305
9326
|
return body;
|
|
9306
9327
|
}
|
|
9328
|
+
var SUMMARY_MAX_CHARS = 100;
|
|
9329
|
+
function plainText(tokens) {
|
|
9330
|
+
return tokens.map((token) => {
|
|
9331
|
+
if (token.type === "image" || token.type === "html") {
|
|
9332
|
+
return "";
|
|
9333
|
+
}
|
|
9334
|
+
if (token.type === "br") {
|
|
9335
|
+
return " ";
|
|
9336
|
+
}
|
|
9337
|
+
if ("tokens" in token && Array.isArray(token.tokens)) {
|
|
9338
|
+
return plainText(token.tokens);
|
|
9339
|
+
}
|
|
9340
|
+
return "text" in token && typeof token.text === "string" ? token.text : "";
|
|
9341
|
+
}).join("");
|
|
9342
|
+
}
|
|
9343
|
+
function firstProse(tokens) {
|
|
9344
|
+
for (const token of tokens) {
|
|
9345
|
+
let text2 = "";
|
|
9346
|
+
if (token.type === "paragraph" || token.type === "text") {
|
|
9347
|
+
text2 = plainText(Array.isArray(token.tokens) ? token.tokens : [token]);
|
|
9348
|
+
} else if (token.type === "list") {
|
|
9349
|
+
text2 = firstProse(token.items.flatMap((item) => item.tokens));
|
|
9350
|
+
} else if (token.type === "blockquote") {
|
|
9351
|
+
text2 = firstProse(token.tokens ?? []);
|
|
9352
|
+
}
|
|
9353
|
+
const line = text2.replace(/\s+/g, " ").trim();
|
|
9354
|
+
if (line) {
|
|
9355
|
+
return line;
|
|
9356
|
+
}
|
|
9357
|
+
}
|
|
9358
|
+
return "";
|
|
9359
|
+
}
|
|
9360
|
+
function summarizeDescription(description) {
|
|
9361
|
+
const line = firstProse(Lexer.lex(description));
|
|
9362
|
+
if (line.length <= SUMMARY_MAX_CHARS) {
|
|
9363
|
+
return line;
|
|
9364
|
+
}
|
|
9365
|
+
const cut = line.slice(0, SUMMARY_MAX_CHARS - 1);
|
|
9366
|
+
const lastSpace = cut.lastIndexOf(" ");
|
|
9367
|
+
return `${(lastSpace > SUMMARY_MAX_CHARS / 2 ? cut.slice(0, lastSpace) : cut).trimEnd()}\u2026`;
|
|
9368
|
+
}
|
|
9369
|
+
function compactBucketEntry(entry) {
|
|
9370
|
+
const { description: _description, status: _status, hint: _hint, ...rest } = entry;
|
|
9371
|
+
return rest;
|
|
9372
|
+
}
|
|
9373
|
+
function compactFlatRow(entry) {
|
|
9374
|
+
const nested = entry.action;
|
|
9375
|
+
const doc = nested && typeof nested === "object" ? nested : entry;
|
|
9376
|
+
const { id, name, status, hint } = toRow(entry);
|
|
9377
|
+
const assignee = entry.assignee && typeof entry.assignee === "object" ? entry.assignee : null;
|
|
9378
|
+
return {
|
|
9379
|
+
id,
|
|
9380
|
+
name,
|
|
9381
|
+
status,
|
|
9382
|
+
...typeof doc.priority === "string" ? { priority: doc.priority } : {},
|
|
9383
|
+
...Array.isArray(doc.tags) && doc.tags.length > 0 ? { tags: doc.tags } : {},
|
|
9384
|
+
summary: summarizeDescription(typeof doc.description === "string" ? doc.description : ""),
|
|
9385
|
+
...hint ? { hint } : {},
|
|
9386
|
+
...typeof assignee?.name === "string" ? { assignee: assignee.name } : {}
|
|
9387
|
+
};
|
|
9388
|
+
}
|
|
9389
|
+
function compactListData(data) {
|
|
9390
|
+
if (Array.isArray(data)) {
|
|
9391
|
+
return data.map((entry) => compactFlatRow(entry));
|
|
9392
|
+
}
|
|
9393
|
+
if (!data || typeof data !== "object") {
|
|
9394
|
+
return data;
|
|
9395
|
+
}
|
|
9396
|
+
return Object.fromEntries(
|
|
9397
|
+
Object.entries(data).map(([bucket, entries]) => [
|
|
9398
|
+
bucket,
|
|
9399
|
+
Array.isArray(entries) ? entries.map((entry) => compactBucketEntry(entry)) : entries
|
|
9400
|
+
])
|
|
9401
|
+
);
|
|
9402
|
+
}
|
|
9307
9403
|
function toRow(entry) {
|
|
9308
9404
|
const nested = entry.action;
|
|
9309
9405
|
const doc = nested && typeof nested === "object" ? nested : entry;
|
|
@@ -9325,6 +9421,14 @@ function renderEntry(entry) {
|
|
|
9325
9421
|
const row = toRow(entry);
|
|
9326
9422
|
const suffix = row.status ? ` [${row.status}]` : "";
|
|
9327
9423
|
const lines = [`- \`${row.id}\` ${row.name}${suffix}`];
|
|
9424
|
+
const nested = entry.action;
|
|
9425
|
+
const doc = nested && typeof nested === "object" ? nested : entry;
|
|
9426
|
+
const text2 = typeof entry.summary === "string" ? entry.summary : doc.description;
|
|
9427
|
+
if (typeof text2 === "string" && text2.trim()) {
|
|
9428
|
+
lines.push(
|
|
9429
|
+
...text2.trim().split("\n").map((line) => line ? ` ${line}` : "")
|
|
9430
|
+
);
|
|
9431
|
+
}
|
|
9328
9432
|
if (row.hint) {
|
|
9329
9433
|
lines.push(` ${row.hint}`);
|
|
9330
9434
|
}
|
|
@@ -22955,49 +23059,9 @@ Subcommands:
|
|
|
22955
23059
|
|
|
22956
23060
|
// src/commands/ads/linkedin/creatives.ts
|
|
22957
23061
|
import { defineCommand as defineCommand44 } from "citty";
|
|
22958
|
-
|
|
22959
|
-
// src/commands/ads/list-rows.ts
|
|
22960
23062
|
function asRecord(value) {
|
|
22961
23063
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
22962
23064
|
}
|
|
22963
|
-
function readPath2(row, path48) {
|
|
22964
|
-
let current = row;
|
|
22965
|
-
for (const segment of path48.split(".")) {
|
|
22966
|
-
const record = asRecord(current);
|
|
22967
|
-
if (!record) return void 0;
|
|
22968
|
-
current = record[segment];
|
|
22969
|
-
}
|
|
22970
|
-
return current;
|
|
22971
|
-
}
|
|
22972
|
-
function projectFields(rows, paths) {
|
|
22973
|
-
return rows.map((row) => {
|
|
22974
|
-
const projected = {};
|
|
22975
|
-
for (const path48 of paths) {
|
|
22976
|
-
const value = readPath2(row, path48);
|
|
22977
|
-
if (value !== void 0) {
|
|
22978
|
-
projected[path48] = value;
|
|
22979
|
-
}
|
|
22980
|
-
}
|
|
22981
|
-
return projected;
|
|
22982
|
-
});
|
|
22983
|
-
}
|
|
22984
|
-
function shapeListRows(rows, args5, compact3) {
|
|
22985
|
-
const raw = rows;
|
|
22986
|
-
const fields = typeof args5.fields === "string" ? args5.fields : void 0;
|
|
22987
|
-
if (fields) {
|
|
22988
|
-
const paths = fields.split(",").map((field) => field.trim()).filter((field) => field.length > 0);
|
|
22989
|
-
if (paths.length > 0) {
|
|
22990
|
-
return { rows: projectFields(raw, paths), fields: paths };
|
|
22991
|
-
}
|
|
22992
|
-
}
|
|
22993
|
-
if (args5.full) return { rows: raw };
|
|
22994
|
-
return { rows: rows.map(compact3.row), fields: [...compact3.columns] };
|
|
22995
|
-
}
|
|
22996
|
-
|
|
22997
|
-
// src/commands/ads/linkedin/creatives.ts
|
|
22998
|
-
function asRecord2(value) {
|
|
22999
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
23000
|
-
}
|
|
23001
23065
|
function asString(value) {
|
|
23002
23066
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
23003
23067
|
}
|
|
@@ -23005,12 +23069,12 @@ function creativeDestination(content) {
|
|
|
23005
23069
|
if (!content) return { format: "unknown" };
|
|
23006
23070
|
const reference = asString(content.reference);
|
|
23007
23071
|
if (reference) return { format: "post", postUrn: reference };
|
|
23008
|
-
const textAd =
|
|
23072
|
+
const textAd = asRecord(content.textAd);
|
|
23009
23073
|
if (textAd) return { format: "text", landingUrl: asString(textAd.landingPage) };
|
|
23010
|
-
const spotlight =
|
|
23074
|
+
const spotlight = asRecord(content.spotlight);
|
|
23011
23075
|
if (spotlight) return { format: "spotlight", landingUrl: asString(spotlight.landingPage) };
|
|
23012
|
-
if (
|
|
23013
|
-
if (
|
|
23076
|
+
if (asRecord(content.follower)) return { format: "follower" };
|
|
23077
|
+
if (asRecord(content.jobs)) return { format: "jobs" };
|
|
23014
23078
|
return { format: "unknown" };
|
|
23015
23079
|
}
|
|
23016
23080
|
var COMPACT_COLUMNS = [
|
|
@@ -23038,6 +23102,27 @@ function compactRow(row) {
|
|
|
23038
23102
|
...destination.postUrn ? { postUrn: destination.postUrn } : {}
|
|
23039
23103
|
};
|
|
23040
23104
|
}
|
|
23105
|
+
function readPath2(row, path48) {
|
|
23106
|
+
let current = row;
|
|
23107
|
+
for (const segment of path48.split(".")) {
|
|
23108
|
+
const record = asRecord(current);
|
|
23109
|
+
if (!record) return void 0;
|
|
23110
|
+
current = record[segment];
|
|
23111
|
+
}
|
|
23112
|
+
return current;
|
|
23113
|
+
}
|
|
23114
|
+
function projectFields(rows, paths) {
|
|
23115
|
+
return rows.map((row) => {
|
|
23116
|
+
const projected = {};
|
|
23117
|
+
for (const path48 of paths) {
|
|
23118
|
+
const value = readPath2(row, path48);
|
|
23119
|
+
if (value !== void 0) {
|
|
23120
|
+
projected[path48] = value;
|
|
23121
|
+
}
|
|
23122
|
+
}
|
|
23123
|
+
return projected;
|
|
23124
|
+
});
|
|
23125
|
+
}
|
|
23041
23126
|
function unmappedShapeWarnings(rows, rawContentReturned) {
|
|
23042
23127
|
const unmapped = rows.filter((row) => row.content && creativeDestination(row.content).format === "unknown");
|
|
23043
23128
|
if (unmapped.length === 0) return [];
|
|
@@ -23049,6 +23134,18 @@ function unmappedShapeWarnings(rows, rawContentReturned) {
|
|
|
23049
23134
|
}
|
|
23050
23135
|
];
|
|
23051
23136
|
}
|
|
23137
|
+
function shapeRows(rows, args5) {
|
|
23138
|
+
const raw = rows;
|
|
23139
|
+
const fields = typeof args5.fields === "string" ? args5.fields : void 0;
|
|
23140
|
+
if (fields) {
|
|
23141
|
+
const paths = fields.split(",").map((field) => field.trim()).filter((field) => field.length > 0);
|
|
23142
|
+
if (paths.length > 0) {
|
|
23143
|
+
return { rows: projectFields(raw, paths), fields: paths };
|
|
23144
|
+
}
|
|
23145
|
+
}
|
|
23146
|
+
if (args5.full) return { rows: raw };
|
|
23147
|
+
return { rows: rows.map(compactRow), fields: [...COMPACT_COLUMNS] };
|
|
23148
|
+
}
|
|
23052
23149
|
var listArgs3 = {
|
|
23053
23150
|
"account-id": { type: "string", description: "Numeric account ID or urn:li:sponsoredAccount:N" },
|
|
23054
23151
|
"account-urn": { type: "string", description: "Alias for --account-id" },
|
|
@@ -23080,10 +23177,7 @@ var creativesListCommand = defineCommand44({
|
|
|
23080
23177
|
if (args5.limit) params.limit = String(args5.limit);
|
|
23081
23178
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
23082
23179
|
const data = await apiGet("/api/ads/linkedin/creatives", params);
|
|
23083
|
-
const shaped =
|
|
23084
|
-
row: compactRow,
|
|
23085
|
-
columns: COMPACT_COLUMNS
|
|
23086
|
-
});
|
|
23180
|
+
const shaped = shapeRows(data, args5);
|
|
23087
23181
|
const fmt = csvOrJson2(args5);
|
|
23088
23182
|
if (fmt !== "json") {
|
|
23089
23183
|
writeAdsOutput(shaped.rows, fmt, shaped.fields);
|
|
@@ -24101,198 +24195,22 @@ Examples:
|
|
|
24101
24195
|
|
|
24102
24196
|
// src/commands/ads/meta/activities.ts
|
|
24103
24197
|
import { defineCommand as defineCommand56 } from "citty";
|
|
24104
|
-
|
|
24105
|
-
// src/commands/ads/meta/list-rows.ts
|
|
24106
|
-
function pick(row, keys) {
|
|
24107
|
-
const picked = {};
|
|
24108
|
-
for (const key of keys) {
|
|
24109
|
-
if (row[key] !== void 0) picked[key] = row[key];
|
|
24110
|
-
}
|
|
24111
|
-
return picked;
|
|
24112
|
-
}
|
|
24113
|
-
function asRecord3(value) {
|
|
24114
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
24115
|
-
}
|
|
24116
|
-
var CAMPAIGN_COLUMNS = ["id", "name", "effective_status", "daily_budget", "lifetime_budget", "created_date"];
|
|
24117
|
-
function compactCampaign(row) {
|
|
24118
|
-
const created = row.created_time;
|
|
24119
|
-
return {
|
|
24120
|
-
...pick(row, ["id", "name", "effective_status", "daily_budget", "lifetime_budget"]),
|
|
24121
|
-
...typeof created === "string" ? { created_date: created.slice(0, 10) } : {}
|
|
24122
|
-
};
|
|
24123
|
-
}
|
|
24124
|
-
var ADSET_KEYS = [
|
|
24125
|
-
"id",
|
|
24126
|
-
"name",
|
|
24127
|
-
"campaign_id",
|
|
24128
|
-
"effective_status",
|
|
24129
|
-
"optimization_goal",
|
|
24130
|
-
"billing_event",
|
|
24131
|
-
"bid_strategy",
|
|
24132
|
-
"daily_budget",
|
|
24133
|
-
"lifetime_budget",
|
|
24134
|
-
"destination_type",
|
|
24135
|
-
// A Dynamic Creative ad set refuses every new ad, which changes the plan before anything is staged.
|
|
24136
|
-
"is_dynamic_creative"
|
|
24137
|
-
];
|
|
24138
|
-
var ADSET_COLUMNS = [...ADSET_KEYS, "learning_stage", "end_time", "created_time"];
|
|
24139
|
-
function compactAdSet(row) {
|
|
24140
|
-
const learning = asRecord3(row.learning_stage_info)?.status;
|
|
24141
|
-
return {
|
|
24142
|
-
...pick(row, ADSET_KEYS),
|
|
24143
|
-
...typeof learning === "string" ? { learning_stage: learning } : {},
|
|
24144
|
-
...pick(row, ["end_time", "created_time"])
|
|
24145
|
-
};
|
|
24146
|
-
}
|
|
24147
|
-
var AD_COLUMNS = [
|
|
24148
|
-
"id",
|
|
24149
|
-
"name",
|
|
24150
|
-
"adset_id",
|
|
24151
|
-
"campaign_id",
|
|
24152
|
-
"effective_status",
|
|
24153
|
-
"creative_id",
|
|
24154
|
-
"issues",
|
|
24155
|
-
"created_time"
|
|
24156
|
-
];
|
|
24157
|
-
function adIssues(value) {
|
|
24158
|
-
if (!Array.isArray(value)) return [];
|
|
24159
|
-
return value.flatMap((entry) => {
|
|
24160
|
-
const issue = asRecord3(entry);
|
|
24161
|
-
const text2 = issue?.error_summary ?? issue?.error_message;
|
|
24162
|
-
return typeof text2 === "string" && text2 ? [text2] : [];
|
|
24163
|
-
});
|
|
24164
|
-
}
|
|
24165
|
-
function compactAd(row) {
|
|
24166
|
-
const creativeId = asRecord3(row.creative)?.id;
|
|
24167
|
-
const issues = adIssues(row.issues_info);
|
|
24168
|
-
return {
|
|
24169
|
-
...pick(row, ["id", "name", "adset_id", "campaign_id", "effective_status"]),
|
|
24170
|
-
...creativeId !== void 0 ? { creative_id: creativeId } : {},
|
|
24171
|
-
...issues.length > 0 ? { issues } : {},
|
|
24172
|
-
...pick(row, ["created_time"])
|
|
24173
|
-
};
|
|
24174
|
-
}
|
|
24175
|
-
var ACTIVITY_COLUMNS = [
|
|
24176
|
-
"event_time",
|
|
24177
|
-
"event_type",
|
|
24178
|
-
"actor_name",
|
|
24179
|
-
"object_type",
|
|
24180
|
-
"object_name",
|
|
24181
|
-
"object_id",
|
|
24182
|
-
"change"
|
|
24183
|
-
];
|
|
24184
|
-
function isScalar(value) {
|
|
24185
|
-
return value === null || typeof value === "string" || typeof value === "number";
|
|
24186
|
-
}
|
|
24187
|
-
function activityChange(extraData) {
|
|
24188
|
-
if (typeof extraData !== "string") return void 0;
|
|
24189
|
-
let parsed;
|
|
24190
|
-
try {
|
|
24191
|
-
parsed = JSON.parse(extraData);
|
|
24192
|
-
} catch {
|
|
24193
|
-
return void 0;
|
|
24194
|
-
}
|
|
24195
|
-
const data = asRecord3(parsed);
|
|
24196
|
-
if (!data || !("new_value" in data) || !isScalar(data.new_value) || !isScalar(data.old_value ?? null)) {
|
|
24197
|
-
return void 0;
|
|
24198
|
-
}
|
|
24199
|
-
const show = (value) => value === null || value === void 0 ? "(none)" : String(value);
|
|
24200
|
-
return `${show(data.old_value)} \u2192 ${show(data.new_value)}`;
|
|
24201
|
-
}
|
|
24202
|
-
function compactActivity(row) {
|
|
24203
|
-
const change = activityChange(row.extra_data);
|
|
24204
|
-
return {
|
|
24205
|
-
...pick(row, ["event_time", "event_type", "actor_name", "object_type", "object_name", "object_id"]),
|
|
24206
|
-
...change !== void 0 ? { change } : {}
|
|
24207
|
-
};
|
|
24208
|
-
}
|
|
24209
|
-
var PROJECTIONS = {
|
|
24210
|
-
campaigns: { row: compactCampaign, columns: CAMPAIGN_COLUMNS },
|
|
24211
|
-
adsets: { row: compactAdSet, columns: ADSET_COLUMNS },
|
|
24212
|
-
ads: { row: compactAd, columns: AD_COLUMNS },
|
|
24213
|
-
activities: { row: compactActivity, columns: ACTIVITY_COLUMNS }
|
|
24214
|
-
};
|
|
24215
|
-
function shapeMetaListRows(kind, rows, args5) {
|
|
24216
|
-
return shapeListRows(rows, args5, PROJECTIONS[kind]);
|
|
24217
|
-
}
|
|
24218
|
-
var NOUNS = {
|
|
24219
|
-
campaigns: "campaigns",
|
|
24220
|
-
adsets: "ad sets",
|
|
24221
|
-
ads: "ads",
|
|
24222
|
-
activities: "activities"
|
|
24223
|
-
};
|
|
24224
|
-
function writeMetaListRows(kind, shaped, format) {
|
|
24225
|
-
if (format === "json") {
|
|
24226
|
-
writeAdsJson({ ok: true, data: shaped.rows });
|
|
24227
|
-
return;
|
|
24228
|
-
}
|
|
24229
|
-
if (format === "md" && shaped.rows.length === 0) {
|
|
24230
|
-
process.stdout.write(`No ${NOUNS[kind]} matched.
|
|
24231
|
-
`);
|
|
24232
|
-
return;
|
|
24233
|
-
}
|
|
24234
|
-
writeAdsOutput(shaped.rows, format, shaped.fields);
|
|
24235
|
-
}
|
|
24236
|
-
var META_LIST_SHAPE_ARGS = {
|
|
24237
|
-
fields: {
|
|
24238
|
-
type: "string",
|
|
24239
|
-
description: "CSV of dotted paths to return instead of the compact row, e.g. id,name,targeting.geo_locations"
|
|
24240
|
-
},
|
|
24241
|
-
full: { type: "boolean", description: "Return every field Meta sent (targeting, tracking specs, raw extra_data)" },
|
|
24242
|
-
output: {
|
|
24243
|
-
type: "string",
|
|
24244
|
-
description: "md|json|csv|jsonl \u2014 md (default) prints a table; json returns the rows in the { ok, data } envelope",
|
|
24245
|
-
default: "md"
|
|
24246
|
-
}
|
|
24247
|
-
};
|
|
24248
|
-
function registerMetaListSchema(kind, description, args5) {
|
|
24249
|
-
registerSchema({
|
|
24250
|
-
command: `ads.meta.${kind}`,
|
|
24251
|
-
description,
|
|
24252
|
-
args: Object.fromEntries(
|
|
24253
|
-
Object.entries(args5).map(([name, def]) => [
|
|
24254
|
-
name,
|
|
24255
|
-
{
|
|
24256
|
-
type: def.type,
|
|
24257
|
-
description: def.description ?? "",
|
|
24258
|
-
required: false,
|
|
24259
|
-
...def.default !== void 0 ? { default: def.default } : {}
|
|
24260
|
-
}
|
|
24261
|
-
])
|
|
24262
|
-
)
|
|
24263
|
-
});
|
|
24264
|
-
}
|
|
24265
|
-
|
|
24266
|
-
// src/commands/ads/meta/activities.ts
|
|
24267
|
-
var listArgs4 = {
|
|
24268
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
24269
|
-
days: { type: "string", description: "Lookback days (default 7)" },
|
|
24270
|
-
limit: { type: "string", description: "Max rows" },
|
|
24271
|
-
"no-cache": NO_CACHE_ARG,
|
|
24272
|
-
...META_LIST_SHAPE_ARGS
|
|
24273
|
-
};
|
|
24274
|
-
registerMetaListSchema(
|
|
24275
|
-
"activities",
|
|
24276
|
-
"Account change log, as a table by default, one row per event: event_time, event_type, actor_name, object_type, object_name, object_id, and change ('old \u2192 new' when the change is a single value). Start here: baker ads meta activities --account-id act_123 --days 2. --fields event_time,object_name,extra_data or --full for the raw change payload; --output json returns the rows in the envelope.",
|
|
24277
|
-
listArgs4
|
|
24278
|
-
);
|
|
24279
24198
|
var activitiesCommand = defineCommand56({
|
|
24280
24199
|
meta: {
|
|
24281
24200
|
name: "activities",
|
|
24282
24201
|
description: `Audit log of recent ad-account changes (created, paused, edited). Default lookback 7 days,
|
|
24283
24202
|
~90 day retention server-side.
|
|
24284
24203
|
|
|
24285
|
-
A table by default, one row per event: event_time, event_type, actor_name, object_type,
|
|
24286
|
-
object_name, object_id, and change ("old \u2192 new" when the change is a single value: status,
|
|
24287
|
-
name, budget, goal). --fields takes dotted paths (extra_data holds the raw change); --full returns
|
|
24288
|
-
every field Meta sent; --output json returns the rows as JSON.
|
|
24289
|
-
|
|
24290
24204
|
Examples:
|
|
24291
|
-
baker ads meta activities --account-id act_123 --days 14
|
|
24292
|
-
|
|
24293
|
-
|
|
24205
|
+
baker ads meta activities --account-id act_123 --days 14`
|
|
24206
|
+
},
|
|
24207
|
+
args: {
|
|
24208
|
+
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
24209
|
+
days: { type: "string", description: "Lookback days (default 7)" },
|
|
24210
|
+
limit: { type: "string", description: "Max rows" },
|
|
24211
|
+
"no-cache": NO_CACHE_ARG,
|
|
24212
|
+
output: { type: "string", description: "Output format", default: "json" }
|
|
24294
24213
|
},
|
|
24295
|
-
args: listArgs4,
|
|
24296
24214
|
run: async ({ args: args5 }) => {
|
|
24297
24215
|
const accountId = resolveAccountIdArg(args5);
|
|
24298
24216
|
try {
|
|
@@ -24301,8 +24219,12 @@ Examples:
|
|
|
24301
24219
|
if (args5.limit) params.limit = args5.limit;
|
|
24302
24220
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
24303
24221
|
const data = await apiGet("/api/ads/meta/activities", params);
|
|
24304
|
-
const
|
|
24305
|
-
|
|
24222
|
+
const fmt = csvOrJson(args5);
|
|
24223
|
+
if (fmt !== "json") {
|
|
24224
|
+
writeAdsOutput(data, fmt);
|
|
24225
|
+
return;
|
|
24226
|
+
}
|
|
24227
|
+
writeAdsJson({ ok: true, data });
|
|
24306
24228
|
} catch (err) {
|
|
24307
24229
|
handleMetaError(err);
|
|
24308
24230
|
}
|
|
@@ -26563,8 +26485,8 @@ Example: baker ads meta ads retag 120252158038400247 --url-tags "utm_source={{si
|
|
|
26563
26485
|
run: async ({ args: args5 }) => {
|
|
26564
26486
|
const { apiPost: apiPost2 } = await import("./client-3DGBQ2H3.js");
|
|
26565
26487
|
const { requireChatId: requireChatId2 } = await import("./env-BSG7TY5Y.js");
|
|
26566
|
-
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-
|
|
26567
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
26488
|
+
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-AT5SRVH7.js");
|
|
26489
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-HZ44PY2F.js");
|
|
26568
26490
|
try {
|
|
26569
26491
|
const accountId = bareAccountId2(args5);
|
|
26570
26492
|
const urlTags = typeof args5["url-tags"] === "string" ? args5["url-tags"] : void 0;
|
|
@@ -26711,8 +26633,8 @@ function duplicateCommand2(entity, label) {
|
|
|
26711
26633
|
run: async ({ args: args5 }) => {
|
|
26712
26634
|
const { apiPost: apiPost2 } = await import("./client-3DGBQ2H3.js");
|
|
26713
26635
|
const { requireChatId: requireChatId2 } = await import("./env-BSG7TY5Y.js");
|
|
26714
|
-
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-
|
|
26715
|
-
const { handleMetaError: handleMetaError2 } = await import("./shared-
|
|
26636
|
+
const { writeJsonEnvelope: writeJsonEnvelope2 } = await import("./output-AT5SRVH7.js");
|
|
26637
|
+
const { handleMetaError: handleMetaError2 } = await import("./shared-HZ44PY2F.js");
|
|
26716
26638
|
try {
|
|
26717
26639
|
const accountId = bareAccountId2(args5);
|
|
26718
26640
|
const chatId = requireChatId2();
|
|
@@ -26745,7 +26667,7 @@ var adsArchiveCommand = statusCommand3("archive", "ad.update", "ad");
|
|
|
26745
26667
|
var adsDuplicateCommand = duplicateCommand2("ad", "ad");
|
|
26746
26668
|
|
|
26747
26669
|
// src/commands/ads/meta/ads.ts
|
|
26748
|
-
var
|
|
26670
|
+
var listArgs4 = {
|
|
26749
26671
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26750
26672
|
"adset-id": { type: "string", description: "Filter to one adset" },
|
|
26751
26673
|
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
@@ -26753,19 +26675,14 @@ var listArgs5 = {
|
|
|
26753
26675
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
|
|
26754
26676
|
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
26755
26677
|
"no-cache": NO_CACHE_ARG,
|
|
26756
|
-
|
|
26678
|
+
output: { type: "string", description: "Output format", default: "json" }
|
|
26757
26679
|
};
|
|
26758
|
-
registerMetaListSchema(
|
|
26759
|
-
"ads",
|
|
26760
|
-
"List ads in a Meta ad account, as a table by default: id, name, adset_id, campaign_id, effective_status, creative_id, issues (why an ad is WITH_ISSUES), created_time. Start here: baker ads meta ads --adset-id 6123. --fields takes dotted paths (e.g. id,tracking_specs); --full returns every field Meta sent; --output json returns the rows in the envelope.",
|
|
26761
|
-
listArgs5
|
|
26762
|
-
);
|
|
26763
26680
|
var listCommand4 = defineCommand58({
|
|
26764
26681
|
meta: {
|
|
26765
26682
|
name: "list",
|
|
26766
26683
|
description: "List ads in a Meta ad account. Runs by default when no subcommand is given. Example: baker ads meta ads --account-id act_123"
|
|
26767
26684
|
},
|
|
26768
|
-
args:
|
|
26685
|
+
args: listArgs4,
|
|
26769
26686
|
run: async ({ args: args5 }) => {
|
|
26770
26687
|
const accountId = resolveAccountIdArg(args5);
|
|
26771
26688
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
@@ -26777,8 +26694,7 @@ var listCommand4 = defineCommand58({
|
|
|
26777
26694
|
if (args5.limit) params.limit = args5.limit;
|
|
26778
26695
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
26779
26696
|
const data = await apiGet("/api/ads/meta/ads", params);
|
|
26780
|
-
|
|
26781
|
-
writeMetaListRows("ads", shaped, csvOrJson(args5));
|
|
26697
|
+
writeAdsOutput(data, csvOrJson(args5), void 0, statusFilterHints(data, effectiveStatus, "ads"));
|
|
26782
26698
|
} catch (err) {
|
|
26783
26699
|
handleMetaError(err);
|
|
26784
26700
|
}
|
|
@@ -26792,14 +26708,9 @@ Defaults to ACTIVE only \u2014 pass --all-statuses to widen. Write subcommands s
|
|
|
26792
26708
|
|
|
26793
26709
|
The dashboard shows effective_status (e.g. WITH_ISSUES, PENDING_REVIEW, DISAPPROVED, ADSET_PAUSED), not status.
|
|
26794
26710
|
|
|
26795
|
-
Listings print a table by default: id, name, adset_id, campaign_id, effective_status, creative_id, issues
|
|
26796
|
-
(why an ad is WITH_ISSUES), created_time. --fields takes dotted paths (e.g. tracking_specs,
|
|
26797
|
-
preview_shareable_link); --full returns every field; --output json returns the rows as JSON.
|
|
26798
|
-
|
|
26799
26711
|
Examples:
|
|
26800
26712
|
baker ads meta ads --account-id act_123
|
|
26801
26713
|
baker ads meta ads --adset-id 6123
|
|
26802
|
-
baker ads meta ads --adset-id 6123 --fields id,name,preview_shareable_link
|
|
26803
26714
|
baker ads meta ads create --name "Ad 1" --adset meta_temp_as01 --creative meta_temp_cr01
|
|
26804
26715
|
baker ads meta ads pause 6123 --account-id act_123
|
|
26805
26716
|
baker ads meta ads retag 6123 --set "utm_medium=paid-social" \u2014 fix tracking on a LIVE ad, keeping everything else`
|
|
@@ -26818,32 +26729,27 @@ Examples:
|
|
|
26818
26729
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
26819
26730
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
26820
26731
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
26821
|
-
args:
|
|
26732
|
+
args: listArgs4,
|
|
26822
26733
|
default: "list"
|
|
26823
26734
|
});
|
|
26824
26735
|
|
|
26825
26736
|
// src/commands/ads/meta/adsets.ts
|
|
26826
26737
|
import { defineCommand as defineCommand59 } from "citty";
|
|
26827
|
-
var
|
|
26738
|
+
var listArgs5 = {
|
|
26828
26739
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26829
26740
|
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
26830
26741
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
26831
26742
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
|
|
26832
26743
|
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
26833
26744
|
"no-cache": NO_CACHE_ARG,
|
|
26834
|
-
|
|
26745
|
+
output: { type: "string", description: "Output format", default: "json" }
|
|
26835
26746
|
};
|
|
26836
|
-
registerMetaListSchema(
|
|
26837
|
-
"adsets",
|
|
26838
|
-
"List ad sets in a Meta ad account, as a table by default: id, name, campaign_id, effective_status, optimization_goal, billing_event, bid_strategy, budgets, destination_type, is_dynamic_creative, learning_stage, end_time, created_time. Targeting is not in the compact row \u2014 ask for it with --fields id,name,targeting (or --full). Start here: baker ads meta adsets --campaign-id 6123 --all-statuses. --output json returns the rows in the envelope.",
|
|
26839
|
-
listArgs6
|
|
26840
|
-
);
|
|
26841
26747
|
var listCommand5 = defineCommand59({
|
|
26842
26748
|
meta: {
|
|
26843
26749
|
name: "list",
|
|
26844
26750
|
description: "List ad sets in a Meta ad account. Runs by default when no subcommand is given. Example: baker ads meta adsets --account-id act_123"
|
|
26845
26751
|
},
|
|
26846
|
-
args:
|
|
26752
|
+
args: listArgs5,
|
|
26847
26753
|
run: async ({ args: args5 }) => {
|
|
26848
26754
|
const accountId = resolveAccountIdArg(args5);
|
|
26849
26755
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
@@ -26854,8 +26760,7 @@ var listCommand5 = defineCommand59({
|
|
|
26854
26760
|
if (args5.limit) params.limit = args5.limit;
|
|
26855
26761
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
26856
26762
|
const data = await apiGet("/api/ads/meta/adsets", params);
|
|
26857
|
-
|
|
26858
|
-
writeMetaListRows("adsets", shaped, csvOrJson(args5));
|
|
26763
|
+
writeAdsOutput(data, csvOrJson(args5), void 0, statusFilterHints(data, effectiveStatus, "ad sets"));
|
|
26859
26764
|
} catch (err) {
|
|
26860
26765
|
handleMetaError(err);
|
|
26861
26766
|
}
|
|
@@ -26867,14 +26772,9 @@ var adsetsCommand = defineCommand59({
|
|
|
26867
26772
|
description: `List ad sets in a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate).
|
|
26868
26773
|
Defaults to ACTIVE only. Write subcommands stage ops on this chat's draft.
|
|
26869
26774
|
|
|
26870
|
-
Listings print a table by default: id, name, campaign_id, effective_status, optimization_goal, billing_event,
|
|
26871
|
-
bid_strategy, budgets, destination_type, is_dynamic_creative, learning_stage, end_time, created_time. Targeting
|
|
26872
|
-
is not in the compact row \u2014 ask for it with --fields (dotted paths) or --full. --output json returns the rows as JSON.
|
|
26873
|
-
|
|
26874
26775
|
Examples:
|
|
26875
26776
|
baker ads meta adsets --account-id act_123
|
|
26876
26777
|
baker ads meta adsets --campaign-id 6123456789
|
|
26877
|
-
baker ads meta adsets --campaign-id 6123456789 --fields id,name,targeting.geo_locations
|
|
26878
26778
|
baker ads meta adsets create --campaign meta_temp_ab12 --name "US 25-54" --optimization-goal LINK_CLICKS --billing-event IMPRESSIONS --daily-budget 50 --targeting-file t.json`
|
|
26879
26779
|
},
|
|
26880
26780
|
subCommands: {
|
|
@@ -26890,13 +26790,13 @@ Examples:
|
|
|
26890
26790
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
26891
26791
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
26892
26792
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
26893
|
-
args:
|
|
26793
|
+
args: listArgs5,
|
|
26894
26794
|
default: "list"
|
|
26895
26795
|
});
|
|
26896
26796
|
|
|
26897
26797
|
// src/commands/ads/meta/audiences.ts
|
|
26898
26798
|
import { defineCommand as defineCommand60 } from "citty";
|
|
26899
|
-
var
|
|
26799
|
+
var listArgs6 = {
|
|
26900
26800
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26901
26801
|
limit: { type: "string", description: "Max rows" },
|
|
26902
26802
|
"no-cache": NO_CACHE_ARG,
|
|
@@ -26907,7 +26807,7 @@ var listCommand6 = defineCommand60({
|
|
|
26907
26807
|
name: "list",
|
|
26908
26808
|
description: "List custom audiences. Runs by default when no subcommand is given. Example: baker ads meta audiences --account-id act_123"
|
|
26909
26809
|
},
|
|
26910
|
-
args:
|
|
26810
|
+
args: listArgs6,
|
|
26911
26811
|
run: async ({ args: args5 }) => {
|
|
26912
26812
|
const accountId = resolveAccountIdArg(args5);
|
|
26913
26813
|
try {
|
|
@@ -26945,7 +26845,7 @@ Examples:
|
|
|
26945
26845
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
26946
26846
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
26947
26847
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
26948
|
-
args:
|
|
26848
|
+
args: listArgs6,
|
|
26949
26849
|
default: "list"
|
|
26950
26850
|
});
|
|
26951
26851
|
|
|
@@ -26982,25 +26882,20 @@ Examples:
|
|
|
26982
26882
|
|
|
26983
26883
|
// src/commands/ads/meta/campaigns.ts
|
|
26984
26884
|
import { defineCommand as defineCommand62 } from "citty";
|
|
26985
|
-
var
|
|
26885
|
+
var listArgs7 = {
|
|
26986
26886
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26987
26887
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
26988
26888
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter and return everything" },
|
|
26989
26889
|
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
26990
26890
|
"no-cache": NO_CACHE_ARG,
|
|
26991
|
-
|
|
26891
|
+
output: { type: "string", description: "Output format", default: "json" }
|
|
26992
26892
|
};
|
|
26993
|
-
registerMetaListSchema(
|
|
26994
|
-
"campaigns",
|
|
26995
|
-
"List campaigns in a Meta ad account, as a table by default: id, name, effective_status, daily_budget, lifetime_budget, created_date. ACTIVE only unless --all-statuses. Start here: baker ads meta campaigns --account-id act_123 --all-statuses. --fields takes dotted paths for anything else (e.g. id,name,objective,bid_strategy,special_ad_categories); --full returns every field Meta sent; --output json returns the rows in the envelope.",
|
|
26996
|
-
listArgs8
|
|
26997
|
-
);
|
|
26998
26893
|
var listCommand7 = defineCommand62({
|
|
26999
26894
|
meta: {
|
|
27000
26895
|
name: "list",
|
|
27001
26896
|
description: "List campaigns for a Meta ad account. Runs by default when no subcommand is given. Example: baker ads meta campaigns --account-id act_123"
|
|
27002
26897
|
},
|
|
27003
|
-
args:
|
|
26898
|
+
args: listArgs7,
|
|
27004
26899
|
run: async ({ args: args5 }) => {
|
|
27005
26900
|
const accountId = resolveAccountIdArg(args5);
|
|
27006
26901
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
@@ -27010,8 +26905,7 @@ var listCommand7 = defineCommand62({
|
|
|
27010
26905
|
if (args5.limit) params.limit = args5.limit;
|
|
27011
26906
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
27012
26907
|
const data = await apiGet("/api/ads/meta/campaigns", params);
|
|
27013
|
-
|
|
27014
|
-
writeMetaListRows("campaigns", shaped, csvOrJson(args5));
|
|
26908
|
+
writeAdsOutput(data, csvOrJson(args5), void 0, statusFilterHints(data, effectiveStatus, "campaigns"));
|
|
27015
26909
|
} catch (err) {
|
|
27016
26910
|
handleMetaError(err);
|
|
27017
26911
|
}
|
|
@@ -27027,15 +26921,9 @@ apply only when the chat is published.
|
|
|
27027
26921
|
In Meta's API "campaign" is the top-of-tree object (what marketers usually call a campaign group).
|
|
27028
26922
|
The dashboard shows effective_status: ACTIVE, PAUSED, DELETED, ARCHIVED, IN_PROCESS, WITH_ISSUES, etc.
|
|
27029
26923
|
|
|
27030
|
-
Listings print a table by default: id, name, effective_status, daily/lifetime budget, created_date.
|
|
27031
|
-
--fields takes dotted paths for anything else (objective, bid_strategy, special_ad_categories, created_time);
|
|
27032
|
-
--full returns every field; --output json returns the same rows in the { ok, data } envelope.
|
|
27033
|
-
|
|
27034
26924
|
Examples:
|
|
27035
26925
|
baker ads meta campaigns --account-id act_123 # ACTIVE only
|
|
27036
26926
|
baker ads meta campaigns --account-id act_123 --all-statuses # everything
|
|
27037
|
-
baker ads meta campaigns --account-id act_123 --fields id,name,objective,bid_strategy,special_ad_categories
|
|
27038
|
-
baker ads meta campaigns --account-id act_123 --output json # rows as JSON
|
|
27039
26927
|
baker ads meta campaigns create --account-id act_123 --name "Q3" --objective OUTCOME_LEADS --daily-budget 50
|
|
27040
26928
|
baker ads meta campaigns pause 6123 --account-id act_123`
|
|
27041
26929
|
},
|
|
@@ -27052,13 +26940,13 @@ Examples:
|
|
|
27052
26940
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
27053
26941
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
27054
26942
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
27055
|
-
args:
|
|
26943
|
+
args: listArgs7,
|
|
27056
26944
|
default: "list"
|
|
27057
26945
|
});
|
|
27058
26946
|
|
|
27059
26947
|
// src/commands/ads/meta/creatives.ts
|
|
27060
26948
|
import { defineCommand as defineCommand63 } from "citty";
|
|
27061
|
-
var
|
|
26949
|
+
var listArgs8 = {
|
|
27062
26950
|
"account-id": { type: "string", description: "Meta ad account ID (required if no --creative-id)" },
|
|
27063
26951
|
"creative-id": { type: "string", description: "Single creative ID" },
|
|
27064
26952
|
limit: { type: "string", description: "Max rows (default 500)" },
|
|
@@ -27070,7 +26958,7 @@ var listCommand8 = defineCommand63({
|
|
|
27070
26958
|
name: "list",
|
|
27071
26959
|
description: "List ad creatives, or fetch one by ID. Runs by default when no subcommand is given. Example: baker ads meta creatives --account-id act_123"
|
|
27072
26960
|
},
|
|
27073
|
-
args:
|
|
26961
|
+
args: listArgs8,
|
|
27074
26962
|
run: async ({ args: args5 }) => {
|
|
27075
26963
|
try {
|
|
27076
26964
|
const params = {};
|
|
@@ -27116,7 +27004,7 @@ Examples:
|
|
|
27116
27004
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
27117
27005
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
27118
27006
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
27119
|
-
args:
|
|
27007
|
+
args: listArgs8,
|
|
27120
27008
|
default: "list"
|
|
27121
27009
|
});
|
|
27122
27010
|
|
|
@@ -27164,7 +27052,7 @@ registerSchema({
|
|
|
27164
27052
|
output: { type: "string", description: "json|csv", required: false, default: "json" }
|
|
27165
27053
|
}
|
|
27166
27054
|
});
|
|
27167
|
-
var
|
|
27055
|
+
var listArgs9 = {
|
|
27168
27056
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
27169
27057
|
full: { type: "boolean", description: "Include the raw rule JSON, retention and creation times" },
|
|
27170
27058
|
limit: { type: "string", description: "Max rows" },
|
|
@@ -27176,7 +27064,7 @@ var listCommand9 = defineCommand64({
|
|
|
27176
27064
|
name: "list",
|
|
27177
27065
|
description: "List custom conversions. Runs by default when no subcommand is given. Example: baker ads meta custom-conversions --account-id act_123"
|
|
27178
27066
|
},
|
|
27179
|
-
args:
|
|
27067
|
+
args: listArgs9,
|
|
27180
27068
|
run: async ({ args: args5 }) => {
|
|
27181
27069
|
const accountId = resolveAccountIdArg(args5);
|
|
27182
27070
|
try {
|
|
@@ -27214,7 +27102,7 @@ Examples:
|
|
|
27214
27102
|
// `args` stays even though the parent has no `run`: citty scans rawArgs for
|
|
27215
27103
|
// the subcommand name using THIS command's arg defs. `default` (not `run`)
|
|
27216
27104
|
// dispatches the bare invocation.
|
|
27217
|
-
args:
|
|
27105
|
+
args: listArgs9,
|
|
27218
27106
|
default: "list"
|
|
27219
27107
|
});
|
|
27220
27108
|
|
|
@@ -28926,7 +28814,7 @@ registerSchema({
|
|
|
28926
28814
|
output: { type: "string", description: "Format: json|csv|md", required: false, default: "json" }
|
|
28927
28815
|
}
|
|
28928
28816
|
});
|
|
28929
|
-
var
|
|
28817
|
+
var listArgs10 = {
|
|
28930
28818
|
"account-id": { type: "string", description: "X Ads account ID" },
|
|
28931
28819
|
"funding-instrument-ids": { type: "string", description: "CSV of funding instrument IDs" },
|
|
28932
28820
|
"campaign-ids": { type: "string", description: "CSV of campaign IDs" },
|
|
@@ -28996,7 +28884,7 @@ Examples:
|
|
|
28996
28884
|
},
|
|
28997
28885
|
// A parent must never declare `run`: citty falls through to it AFTER the
|
|
28998
28886
|
// matched subcommand, so every write would also trigger a full live list.
|
|
28999
|
-
args:
|
|
28887
|
+
args: listArgs10,
|
|
29000
28888
|
default: "list"
|
|
29001
28889
|
});
|
|
29002
28890
|
|
|
@@ -43192,12 +43080,12 @@ function fail3(code, message) {
|
|
|
43192
43080
|
process.exit(2);
|
|
43193
43081
|
}
|
|
43194
43082
|
function resolveModels(args5) {
|
|
43195
|
-
const
|
|
43083
|
+
const pick = (flag, kind, fallback) => args5[flag] ? String(args5[flag]) : resolveModel(kind, fallback);
|
|
43196
43084
|
return {
|
|
43197
|
-
describeModel:
|
|
43198
|
-
selectModel:
|
|
43199
|
-
layoutModel:
|
|
43200
|
-
genModel:
|
|
43085
|
+
describeModel: pick("describe-model", "image_describe", "~google/gemini-pro-latest"),
|
|
43086
|
+
selectModel: pick("select-model", "text_generate", "~google/gemini-flash-latest"),
|
|
43087
|
+
layoutModel: pick("layout-model", "text_generate", "~google/gemini-flash-latest"),
|
|
43088
|
+
genModel: pick("gen-model", "image_generate", "openai/gpt-image-2")
|
|
43201
43089
|
};
|
|
43202
43090
|
}
|
|
43203
43091
|
var PLATFORM_PLACEMENTS = {
|
|
@@ -45231,18 +45119,18 @@ function parseBudget(raw) {
|
|
|
45231
45119
|
throw new Error(`--budget must be one of ${VIDEO_BUDGETS.join(", ")} (got "${v}")`);
|
|
45232
45120
|
}
|
|
45233
45121
|
function resolveModels2(args5) {
|
|
45234
|
-
const
|
|
45122
|
+
const pick = (flag, kind, fallback) => args5[flag] ? String(args5[flag]) : resolveModel2(kind, fallback);
|
|
45235
45123
|
return {
|
|
45236
45124
|
// Flash by default: ~2-3× faster per call than Pro, which keeps each
|
|
45237
45125
|
// per-scene deconstruct step well inside the action time budget and turns a
|
|
45238
45126
|
// ~9 min run into ~3-4 min. Override with --deconstruct-model
|
|
45239
45127
|
// ~google/gemini-pro-latest for the densest extraction when speed matters less.
|
|
45240
|
-
deconstructModel:
|
|
45241
|
-
selectModel:
|
|
45128
|
+
deconstructModel: pick("deconstruct-model", "video_deconstruct", "~google/gemini-flash-latest"),
|
|
45129
|
+
selectModel: pick("select-model", "text_generate", "~google/gemini-flash-latest"),
|
|
45242
45130
|
// Default to the strongest image model (matches the static-ad scaffold); the
|
|
45243
45131
|
// frame generators need the most faithful text/identity reproduction. Override
|
|
45244
45132
|
// with --image-model for a cheaper/faster pass.
|
|
45245
|
-
imageModel:
|
|
45133
|
+
imageModel: pick("image-model", "image_generate", "openai/gpt-image-2.5-sunburst")
|
|
45246
45134
|
};
|
|
45247
45135
|
}
|
|
45248
45136
|
function hasPhotorealCast(elements) {
|
|
@@ -54331,7 +54219,7 @@ var extractCommand = defineCommand149({
|
|
|
54331
54219
|
import { defineCommand as defineCommand150 } from "citty";
|
|
54332
54220
|
|
|
54333
54221
|
// src/commands/images/providerHits.ts
|
|
54334
|
-
function
|
|
54222
|
+
function asRecord2(value) {
|
|
54335
54223
|
return value && typeof value === "object" ? value : {};
|
|
54336
54224
|
}
|
|
54337
54225
|
function str(value) {
|
|
@@ -54356,7 +54244,7 @@ function providerHitNormalizer(record, full) {
|
|
|
54356
54244
|
if (!full) {
|
|
54357
54245
|
return compact3;
|
|
54358
54246
|
}
|
|
54359
|
-
const group =
|
|
54247
|
+
const group = asRecord2(record.group);
|
|
54360
54248
|
return {
|
|
54361
54249
|
...compact3,
|
|
54362
54250
|
externalUrl: str(record.externalUrl),
|
|
@@ -66619,7 +66507,7 @@ async function listTags(json) {
|
|
|
66619
66507
|
failApi3(err);
|
|
66620
66508
|
}
|
|
66621
66509
|
}
|
|
66622
|
-
var
|
|
66510
|
+
var listArgs11 = {
|
|
66623
66511
|
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" }
|
|
66624
66512
|
};
|
|
66625
66513
|
var listCommand19 = defineCommand222({
|
|
@@ -66627,7 +66515,7 @@ var listCommand19 = defineCommand222({
|
|
|
66627
66515
|
name: "list",
|
|
66628
66516
|
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"
|
|
66629
66517
|
},
|
|
66630
|
-
args:
|
|
66518
|
+
args: listArgs11,
|
|
66631
66519
|
run: async ({ args: args5 }) => {
|
|
66632
66520
|
await listTags(args5.json === true);
|
|
66633
66521
|
}
|
|
@@ -66675,7 +66563,7 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
|
|
|
66675
66563
|
// command's flags when it scans rawArgs for a subcommand name, and `default` (not
|
|
66676
66564
|
// `run`) dispatches the bare invocation — citty falls through to `run` after a
|
|
66677
66565
|
// subcommand, so a `run` here would also list on every `baker tags draft`.
|
|
66678
|
-
args:
|
|
66566
|
+
args: listArgs11,
|
|
66679
66567
|
default: "list"
|
|
66680
66568
|
});
|
|
66681
66569
|
|