@koda-sl/baker-cli 0.366.0-dev.9bf895443 → 0.366.0-dev.b6091bc9b
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 -2
- package/dist/cli.js +322 -230
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9792,7 +9792,7 @@ import { defineCommand as defineCommand19 } from "citty";
|
|
|
9792
9792
|
function listed(resources) {
|
|
9793
9793
|
return resources.map((resource) => resource.label ? `${resource.id} (${resource.label})` : resource.id).join("; ");
|
|
9794
9794
|
}
|
|
9795
|
-
function connectedResourceHints({ plural
|
|
9795
|
+
function connectedResourceHints({ plural, singular, flag, resources }) {
|
|
9796
9796
|
if (resources.length === 0) {
|
|
9797
9797
|
return [];
|
|
9798
9798
|
}
|
|
@@ -9800,7 +9800,7 @@ function connectedResourceHints({ plural: plural2, singular, flag, resources })
|
|
|
9800
9800
|
return [`This company connected one ${singular}: ${listed(resources)}. Commands use it unless you pass ${flag}.`];
|
|
9801
9801
|
}
|
|
9802
9802
|
return [
|
|
9803
|
-
`This company connected ${resources.length} ${
|
|
9803
|
+
`This company connected ${resources.length} ${plural}: ${listed(resources)}. Each command works on one, so pass ${flag} \u2014 nothing is picked for you. A question about the whole business covers all ${resources.length}: answering from one and reporting it as the total is wrong.`
|
|
9804
9804
|
];
|
|
9805
9805
|
}
|
|
9806
9806
|
|
|
@@ -22955,9 +22955,49 @@ Subcommands:
|
|
|
22955
22955
|
|
|
22956
22956
|
// src/commands/ads/linkedin/creatives.ts
|
|
22957
22957
|
import { defineCommand as defineCommand44 } from "citty";
|
|
22958
|
+
|
|
22959
|
+
// src/commands/ads/list-rows.ts
|
|
22958
22960
|
function asRecord(value) {
|
|
22959
22961
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
22960
22962
|
}
|
|
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
|
+
}
|
|
22961
23001
|
function asString(value) {
|
|
22962
23002
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
22963
23003
|
}
|
|
@@ -22965,12 +23005,12 @@ function creativeDestination(content) {
|
|
|
22965
23005
|
if (!content) return { format: "unknown" };
|
|
22966
23006
|
const reference = asString(content.reference);
|
|
22967
23007
|
if (reference) return { format: "post", postUrn: reference };
|
|
22968
|
-
const textAd =
|
|
23008
|
+
const textAd = asRecord2(content.textAd);
|
|
22969
23009
|
if (textAd) return { format: "text", landingUrl: asString(textAd.landingPage) };
|
|
22970
|
-
const spotlight =
|
|
23010
|
+
const spotlight = asRecord2(content.spotlight);
|
|
22971
23011
|
if (spotlight) return { format: "spotlight", landingUrl: asString(spotlight.landingPage) };
|
|
22972
|
-
if (
|
|
22973
|
-
if (
|
|
23012
|
+
if (asRecord2(content.follower)) return { format: "follower" };
|
|
23013
|
+
if (asRecord2(content.jobs)) return { format: "jobs" };
|
|
22974
23014
|
return { format: "unknown" };
|
|
22975
23015
|
}
|
|
22976
23016
|
var COMPACT_COLUMNS = [
|
|
@@ -22998,27 +23038,6 @@ function compactRow(row) {
|
|
|
22998
23038
|
...destination.postUrn ? { postUrn: destination.postUrn } : {}
|
|
22999
23039
|
};
|
|
23000
23040
|
}
|
|
23001
|
-
function readPath2(row, path48) {
|
|
23002
|
-
let current = row;
|
|
23003
|
-
for (const segment of path48.split(".")) {
|
|
23004
|
-
const record = asRecord(current);
|
|
23005
|
-
if (!record) return void 0;
|
|
23006
|
-
current = record[segment];
|
|
23007
|
-
}
|
|
23008
|
-
return current;
|
|
23009
|
-
}
|
|
23010
|
-
function projectFields(rows, paths) {
|
|
23011
|
-
return rows.map((row) => {
|
|
23012
|
-
const projected = {};
|
|
23013
|
-
for (const path48 of paths) {
|
|
23014
|
-
const value = readPath2(row, path48);
|
|
23015
|
-
if (value !== void 0) {
|
|
23016
|
-
projected[path48] = value;
|
|
23017
|
-
}
|
|
23018
|
-
}
|
|
23019
|
-
return projected;
|
|
23020
|
-
});
|
|
23021
|
-
}
|
|
23022
23041
|
function unmappedShapeWarnings(rows, rawContentReturned) {
|
|
23023
23042
|
const unmapped = rows.filter((row) => row.content && creativeDestination(row.content).format === "unknown");
|
|
23024
23043
|
if (unmapped.length === 0) return [];
|
|
@@ -23030,18 +23049,6 @@ function unmappedShapeWarnings(rows, rawContentReturned) {
|
|
|
23030
23049
|
}
|
|
23031
23050
|
];
|
|
23032
23051
|
}
|
|
23033
|
-
function shapeRows(rows, args5) {
|
|
23034
|
-
const raw = rows;
|
|
23035
|
-
const fields = typeof args5.fields === "string" ? args5.fields : void 0;
|
|
23036
|
-
if (fields) {
|
|
23037
|
-
const paths = fields.split(",").map((field) => field.trim()).filter((field) => field.length > 0);
|
|
23038
|
-
if (paths.length > 0) {
|
|
23039
|
-
return { rows: projectFields(raw, paths), fields: paths };
|
|
23040
|
-
}
|
|
23041
|
-
}
|
|
23042
|
-
if (args5.full) return { rows: raw };
|
|
23043
|
-
return { rows: rows.map(compactRow), fields: [...COMPACT_COLUMNS] };
|
|
23044
|
-
}
|
|
23045
23052
|
var listArgs3 = {
|
|
23046
23053
|
"account-id": { type: "string", description: "Numeric account ID or urn:li:sponsoredAccount:N" },
|
|
23047
23054
|
"account-urn": { type: "string", description: "Alias for --account-id" },
|
|
@@ -23073,7 +23080,10 @@ var creativesListCommand = defineCommand44({
|
|
|
23073
23080
|
if (args5.limit) params.limit = String(args5.limit);
|
|
23074
23081
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
23075
23082
|
const data = await apiGet("/api/ads/linkedin/creatives", params);
|
|
23076
|
-
const shaped =
|
|
23083
|
+
const shaped = shapeListRows(data, args5, {
|
|
23084
|
+
row: compactRow,
|
|
23085
|
+
columns: COMPACT_COLUMNS
|
|
23086
|
+
});
|
|
23077
23087
|
const fmt = csvOrJson2(args5);
|
|
23078
23088
|
if (fmt !== "json") {
|
|
23079
23089
|
writeAdsOutput(shaped.rows, fmt, shaped.fields);
|
|
@@ -24091,22 +24101,198 @@ Examples:
|
|
|
24091
24101
|
|
|
24092
24102
|
// src/commands/ads/meta/activities.ts
|
|
24093
24103
|
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
|
+
);
|
|
24094
24279
|
var activitiesCommand = defineCommand56({
|
|
24095
24280
|
meta: {
|
|
24096
24281
|
name: "activities",
|
|
24097
24282
|
description: `Audit log of recent ad-account changes (created, paused, edited). Default lookback 7 days,
|
|
24098
24283
|
~90 day retention server-side.
|
|
24099
24284
|
|
|
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
|
+
|
|
24100
24290
|
Examples:
|
|
24101
|
-
baker ads meta activities --account-id act_123 --days 14
|
|
24102
|
-
|
|
24103
|
-
|
|
24104
|
-
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
24105
|
-
days: { type: "string", description: "Lookback days (default 7)" },
|
|
24106
|
-
limit: { type: "string", description: "Max rows" },
|
|
24107
|
-
"no-cache": NO_CACHE_ARG,
|
|
24108
|
-
output: { type: "string", description: "Output format", default: "json" }
|
|
24291
|
+
baker ads meta activities --account-id act_123 --days 14
|
|
24292
|
+
baker ads meta activities --account-id act_123 --days 2 --output json
|
|
24293
|
+
baker ads meta activities --account-id act_123 --fields event_time,object_name,extra_data`
|
|
24109
24294
|
},
|
|
24295
|
+
args: listArgs4,
|
|
24110
24296
|
run: async ({ args: args5 }) => {
|
|
24111
24297
|
const accountId = resolveAccountIdArg(args5);
|
|
24112
24298
|
try {
|
|
@@ -24115,12 +24301,8 @@ Examples:
|
|
|
24115
24301
|
if (args5.limit) params.limit = args5.limit;
|
|
24116
24302
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
24117
24303
|
const data = await apiGet("/api/ads/meta/activities", params);
|
|
24118
|
-
const
|
|
24119
|
-
|
|
24120
|
-
writeAdsOutput(data, fmt);
|
|
24121
|
-
return;
|
|
24122
|
-
}
|
|
24123
|
-
writeAdsJson({ ok: true, data });
|
|
24304
|
+
const shaped = shapeMetaListRows("activities", data, args5);
|
|
24305
|
+
writeMetaListRows("activities", shaped, csvOrJson(args5));
|
|
24124
24306
|
} catch (err) {
|
|
24125
24307
|
handleMetaError(err);
|
|
24126
24308
|
}
|
|
@@ -26563,7 +26745,7 @@ var adsArchiveCommand = statusCommand3("archive", "ad.update", "ad");
|
|
|
26563
26745
|
var adsDuplicateCommand = duplicateCommand2("ad", "ad");
|
|
26564
26746
|
|
|
26565
26747
|
// src/commands/ads/meta/ads.ts
|
|
26566
|
-
var
|
|
26748
|
+
var listArgs5 = {
|
|
26567
26749
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26568
26750
|
"adset-id": { type: "string", description: "Filter to one adset" },
|
|
26569
26751
|
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
@@ -26571,14 +26753,19 @@ var listArgs4 = {
|
|
|
26571
26753
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
|
|
26572
26754
|
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
26573
26755
|
"no-cache": NO_CACHE_ARG,
|
|
26574
|
-
|
|
26756
|
+
...META_LIST_SHAPE_ARGS
|
|
26575
26757
|
};
|
|
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
|
+
);
|
|
26576
26763
|
var listCommand4 = defineCommand58({
|
|
26577
26764
|
meta: {
|
|
26578
26765
|
name: "list",
|
|
26579
26766
|
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"
|
|
26580
26767
|
},
|
|
26581
|
-
args:
|
|
26768
|
+
args: listArgs5,
|
|
26582
26769
|
run: async ({ args: args5 }) => {
|
|
26583
26770
|
const accountId = resolveAccountIdArg(args5);
|
|
26584
26771
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
@@ -26590,12 +26777,8 @@ var listCommand4 = defineCommand58({
|
|
|
26590
26777
|
if (args5.limit) params.limit = args5.limit;
|
|
26591
26778
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
26592
26779
|
const data = await apiGet("/api/ads/meta/ads", params);
|
|
26593
|
-
const
|
|
26594
|
-
|
|
26595
|
-
writeAdsOutput(data, fmt);
|
|
26596
|
-
return;
|
|
26597
|
-
}
|
|
26598
|
-
writeAdsJson({ ok: true, data });
|
|
26780
|
+
const shaped = shapeMetaListRows("ads", data, args5);
|
|
26781
|
+
writeMetaListRows("ads", shaped, csvOrJson(args5));
|
|
26599
26782
|
} catch (err) {
|
|
26600
26783
|
handleMetaError(err);
|
|
26601
26784
|
}
|
|
@@ -26609,9 +26792,14 @@ Defaults to ACTIVE only \u2014 pass --all-statuses to widen. Write subcommands s
|
|
|
26609
26792
|
|
|
26610
26793
|
The dashboard shows effective_status (e.g. WITH_ISSUES, PENDING_REVIEW, DISAPPROVED, ADSET_PAUSED), not status.
|
|
26611
26794
|
|
|
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
|
+
|
|
26612
26799
|
Examples:
|
|
26613
26800
|
baker ads meta ads --account-id act_123
|
|
26614
26801
|
baker ads meta ads --adset-id 6123
|
|
26802
|
+
baker ads meta ads --adset-id 6123 --fields id,name,preview_shareable_link
|
|
26615
26803
|
baker ads meta ads create --name "Ad 1" --adset meta_temp_as01 --creative meta_temp_cr01
|
|
26616
26804
|
baker ads meta ads pause 6123 --account-id act_123
|
|
26617
26805
|
baker ads meta ads retag 6123 --set "utm_medium=paid-social" \u2014 fix tracking on a LIVE ad, keeping everything else`
|
|
@@ -26630,27 +26818,32 @@ Examples:
|
|
|
26630
26818
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
26631
26819
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
26632
26820
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
26633
|
-
args:
|
|
26821
|
+
args: listArgs5,
|
|
26634
26822
|
default: "list"
|
|
26635
26823
|
});
|
|
26636
26824
|
|
|
26637
26825
|
// src/commands/ads/meta/adsets.ts
|
|
26638
26826
|
import { defineCommand as defineCommand59 } from "citty";
|
|
26639
|
-
var
|
|
26827
|
+
var listArgs6 = {
|
|
26640
26828
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26641
26829
|
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
26642
26830
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
26643
26831
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
|
|
26644
26832
|
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
26645
26833
|
"no-cache": NO_CACHE_ARG,
|
|
26646
|
-
|
|
26834
|
+
...META_LIST_SHAPE_ARGS
|
|
26647
26835
|
};
|
|
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
|
+
);
|
|
26648
26841
|
var listCommand5 = defineCommand59({
|
|
26649
26842
|
meta: {
|
|
26650
26843
|
name: "list",
|
|
26651
26844
|
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"
|
|
26652
26845
|
},
|
|
26653
|
-
args:
|
|
26846
|
+
args: listArgs6,
|
|
26654
26847
|
run: async ({ args: args5 }) => {
|
|
26655
26848
|
const accountId = resolveAccountIdArg(args5);
|
|
26656
26849
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
@@ -26661,12 +26854,8 @@ var listCommand5 = defineCommand59({
|
|
|
26661
26854
|
if (args5.limit) params.limit = args5.limit;
|
|
26662
26855
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
26663
26856
|
const data = await apiGet("/api/ads/meta/adsets", params);
|
|
26664
|
-
const
|
|
26665
|
-
|
|
26666
|
-
writeAdsOutput(data, fmt);
|
|
26667
|
-
return;
|
|
26668
|
-
}
|
|
26669
|
-
writeAdsJson({ ok: true, data });
|
|
26857
|
+
const shaped = shapeMetaListRows("adsets", data, args5);
|
|
26858
|
+
writeMetaListRows("adsets", shaped, csvOrJson(args5));
|
|
26670
26859
|
} catch (err) {
|
|
26671
26860
|
handleMetaError(err);
|
|
26672
26861
|
}
|
|
@@ -26678,9 +26867,14 @@ var adsetsCommand = defineCommand59({
|
|
|
26678
26867
|
description: `List ad sets in a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate).
|
|
26679
26868
|
Defaults to ACTIVE only. Write subcommands stage ops on this chat's draft.
|
|
26680
26869
|
|
|
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
|
+
|
|
26681
26874
|
Examples:
|
|
26682
26875
|
baker ads meta adsets --account-id act_123
|
|
26683
26876
|
baker ads meta adsets --campaign-id 6123456789
|
|
26877
|
+
baker ads meta adsets --campaign-id 6123456789 --fields id,name,targeting.geo_locations
|
|
26684
26878
|
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`
|
|
26685
26879
|
},
|
|
26686
26880
|
subCommands: {
|
|
@@ -26696,13 +26890,13 @@ Examples:
|
|
|
26696
26890
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
26697
26891
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
26698
26892
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
26699
|
-
args:
|
|
26893
|
+
args: listArgs6,
|
|
26700
26894
|
default: "list"
|
|
26701
26895
|
});
|
|
26702
26896
|
|
|
26703
26897
|
// src/commands/ads/meta/audiences.ts
|
|
26704
26898
|
import { defineCommand as defineCommand60 } from "citty";
|
|
26705
|
-
var
|
|
26899
|
+
var listArgs7 = {
|
|
26706
26900
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26707
26901
|
limit: { type: "string", description: "Max rows" },
|
|
26708
26902
|
"no-cache": NO_CACHE_ARG,
|
|
@@ -26713,7 +26907,7 @@ var listCommand6 = defineCommand60({
|
|
|
26713
26907
|
name: "list",
|
|
26714
26908
|
description: "List custom audiences. Runs by default when no subcommand is given. Example: baker ads meta audiences --account-id act_123"
|
|
26715
26909
|
},
|
|
26716
|
-
args:
|
|
26910
|
+
args: listArgs7,
|
|
26717
26911
|
run: async ({ args: args5 }) => {
|
|
26718
26912
|
const accountId = resolveAccountIdArg(args5);
|
|
26719
26913
|
try {
|
|
@@ -26751,7 +26945,7 @@ Examples:
|
|
|
26751
26945
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
26752
26946
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
26753
26947
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
26754
|
-
args:
|
|
26948
|
+
args: listArgs7,
|
|
26755
26949
|
default: "list"
|
|
26756
26950
|
});
|
|
26757
26951
|
|
|
@@ -26788,20 +26982,25 @@ Examples:
|
|
|
26788
26982
|
|
|
26789
26983
|
// src/commands/ads/meta/campaigns.ts
|
|
26790
26984
|
import { defineCommand as defineCommand62 } from "citty";
|
|
26791
|
-
var
|
|
26985
|
+
var listArgs8 = {
|
|
26792
26986
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26793
26987
|
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
26794
26988
|
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter and return everything" },
|
|
26795
26989
|
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
26796
26990
|
"no-cache": NO_CACHE_ARG,
|
|
26797
|
-
|
|
26991
|
+
...META_LIST_SHAPE_ARGS
|
|
26798
26992
|
};
|
|
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
|
+
);
|
|
26799
26998
|
var listCommand7 = defineCommand62({
|
|
26800
26999
|
meta: {
|
|
26801
27000
|
name: "list",
|
|
26802
27001
|
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"
|
|
26803
27002
|
},
|
|
26804
|
-
args:
|
|
27003
|
+
args: listArgs8,
|
|
26805
27004
|
run: async ({ args: args5 }) => {
|
|
26806
27005
|
const accountId = resolveAccountIdArg(args5);
|
|
26807
27006
|
const effectiveStatus = resolveEffectiveStatus(args5);
|
|
@@ -26811,12 +27010,8 @@ var listCommand7 = defineCommand62({
|
|
|
26811
27010
|
if (args5.limit) params.limit = args5.limit;
|
|
26812
27011
|
if (args5["no-cache"]) params["skip-cache"] = "true";
|
|
26813
27012
|
const data = await apiGet("/api/ads/meta/campaigns", params);
|
|
26814
|
-
const
|
|
26815
|
-
|
|
26816
|
-
writeAdsOutput(data, fmt);
|
|
26817
|
-
return;
|
|
26818
|
-
}
|
|
26819
|
-
writeAdsJson({ ok: true, data });
|
|
27013
|
+
const shaped = shapeMetaListRows("campaigns", data, args5);
|
|
27014
|
+
writeMetaListRows("campaigns", shaped, csvOrJson(args5));
|
|
26820
27015
|
} catch (err) {
|
|
26821
27016
|
handleMetaError(err);
|
|
26822
27017
|
}
|
|
@@ -26832,9 +27027,15 @@ apply only when the chat is published.
|
|
|
26832
27027
|
In Meta's API "campaign" is the top-of-tree object (what marketers usually call a campaign group).
|
|
26833
27028
|
The dashboard shows effective_status: ACTIVE, PAUSED, DELETED, ARCHIVED, IN_PROCESS, WITH_ISSUES, etc.
|
|
26834
27029
|
|
|
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
|
+
|
|
26835
27034
|
Examples:
|
|
26836
27035
|
baker ads meta campaigns --account-id act_123 # ACTIVE only
|
|
26837
27036
|
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
|
|
26838
27039
|
baker ads meta campaigns create --account-id act_123 --name "Q3" --objective OUTCOME_LEADS --daily-budget 50
|
|
26839
27040
|
baker ads meta campaigns pause 6123 --account-id act_123`
|
|
26840
27041
|
},
|
|
@@ -26851,13 +27052,13 @@ Examples:
|
|
|
26851
27052
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
26852
27053
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
26853
27054
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
26854
|
-
args:
|
|
27055
|
+
args: listArgs8,
|
|
26855
27056
|
default: "list"
|
|
26856
27057
|
});
|
|
26857
27058
|
|
|
26858
27059
|
// src/commands/ads/meta/creatives.ts
|
|
26859
27060
|
import { defineCommand as defineCommand63 } from "citty";
|
|
26860
|
-
var
|
|
27061
|
+
var listArgs9 = {
|
|
26861
27062
|
"account-id": { type: "string", description: "Meta ad account ID (required if no --creative-id)" },
|
|
26862
27063
|
"creative-id": { type: "string", description: "Single creative ID" },
|
|
26863
27064
|
limit: { type: "string", description: "Max rows (default 500)" },
|
|
@@ -26869,7 +27070,7 @@ var listCommand8 = defineCommand63({
|
|
|
26869
27070
|
name: "list",
|
|
26870
27071
|
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"
|
|
26871
27072
|
},
|
|
26872
|
-
args:
|
|
27073
|
+
args: listArgs9,
|
|
26873
27074
|
run: async ({ args: args5 }) => {
|
|
26874
27075
|
try {
|
|
26875
27076
|
const params = {};
|
|
@@ -26915,7 +27116,7 @@ Examples:
|
|
|
26915
27116
|
// subcommand name using THIS command's arg defs, so without them `--account-id act_1`
|
|
26916
27117
|
// would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
|
|
26917
27118
|
// invocation — citty falls through to `run` after a subcommand, double-executing it.
|
|
26918
|
-
args:
|
|
27119
|
+
args: listArgs9,
|
|
26919
27120
|
default: "list"
|
|
26920
27121
|
});
|
|
26921
27122
|
|
|
@@ -26963,7 +27164,7 @@ registerSchema({
|
|
|
26963
27164
|
output: { type: "string", description: "json|csv", required: false, default: "json" }
|
|
26964
27165
|
}
|
|
26965
27166
|
});
|
|
26966
|
-
var
|
|
27167
|
+
var listArgs10 = {
|
|
26967
27168
|
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
26968
27169
|
full: { type: "boolean", description: "Include the raw rule JSON, retention and creation times" },
|
|
26969
27170
|
limit: { type: "string", description: "Max rows" },
|
|
@@ -26975,7 +27176,7 @@ var listCommand9 = defineCommand64({
|
|
|
26975
27176
|
name: "list",
|
|
26976
27177
|
description: "List custom conversions. Runs by default when no subcommand is given. Example: baker ads meta custom-conversions --account-id act_123"
|
|
26977
27178
|
},
|
|
26978
|
-
args:
|
|
27179
|
+
args: listArgs10,
|
|
26979
27180
|
run: async ({ args: args5 }) => {
|
|
26980
27181
|
const accountId = resolveAccountIdArg(args5);
|
|
26981
27182
|
try {
|
|
@@ -27013,120 +27214,17 @@ Examples:
|
|
|
27013
27214
|
// `args` stays even though the parent has no `run`: citty scans rawArgs for
|
|
27014
27215
|
// the subcommand name using THIS command's arg defs. `default` (not `run`)
|
|
27015
27216
|
// dispatches the bare invocation.
|
|
27016
|
-
args:
|
|
27217
|
+
args: listArgs10,
|
|
27017
27218
|
default: "list"
|
|
27018
27219
|
});
|
|
27019
27220
|
|
|
27020
27221
|
// src/commands/ads/meta/draft.ts
|
|
27021
27222
|
import { defineCommand as defineCommand65 } from "citty";
|
|
27022
|
-
|
|
27023
|
-
// src/commands/ads/meta/draft-status.ts
|
|
27024
|
-
var STATUS_HEADINGS = {
|
|
27025
|
-
active: "staged",
|
|
27026
|
-
publishing: "publishing",
|
|
27027
|
-
applied: "published",
|
|
27028
|
-
partial: "published with failures",
|
|
27029
|
-
discarded: "discarded",
|
|
27030
|
-
none: "none"
|
|
27031
|
-
};
|
|
27032
|
-
function plural(count2, word) {
|
|
27033
|
-
return `${count2} ${word}${count2 === 1 ? "" : "s"}`;
|
|
27034
|
-
}
|
|
27035
|
-
function headingLine(draft) {
|
|
27036
|
-
const heading = STATUS_HEADINGS[draft.status];
|
|
27037
|
-
if (draft.status === "active" || draft.status === "discarded") {
|
|
27038
|
-
return `Meta Ads \u2014 ${plural(draft.count, "change")} ${heading} \xB7 ${draft.mode}`;
|
|
27039
|
-
}
|
|
27040
|
-
const counts = /* @__PURE__ */ new Map();
|
|
27041
|
-
for (const op of draft.ops) {
|
|
27042
|
-
const status = op.result?.status ?? "pending";
|
|
27043
|
-
counts.set(status, (counts.get(status) ?? 0) + 1);
|
|
27044
|
-
}
|
|
27045
|
-
const summary = [...counts].map(([status, count2]) => `${count2} ${status}`).join(", ");
|
|
27046
|
-
return `Meta Ads \u2014 ${heading} \xB7 ${summary} \xB7 ${draft.mode}`;
|
|
27047
|
-
}
|
|
27048
|
-
function resultPart(op) {
|
|
27049
|
-
const result = op.result;
|
|
27050
|
-
if (!result) {
|
|
27051
|
-
return void 0;
|
|
27052
|
-
}
|
|
27053
|
-
if (result.status === "failed") {
|
|
27054
|
-
return `\u2717 failed: ${result.error ?? "no reason recorded"}`;
|
|
27055
|
-
}
|
|
27056
|
-
if (result.status === "skipped") {
|
|
27057
|
-
const because = result.skippedBecause;
|
|
27058
|
-
if (because && op.dependsOn.includes(because)) {
|
|
27059
|
-
return `\u2717 skipped: ${because} did not apply`;
|
|
27060
|
-
}
|
|
27061
|
-
return `\u2717 skipped: ${because ?? "a change it needs did not apply"}`;
|
|
27062
|
-
}
|
|
27063
|
-
const id = result.id ?? result.hash;
|
|
27064
|
-
const applied = `\u2713 ${result.status}${id ? ` \u2192 ${id}` : ""}`;
|
|
27065
|
-
const verification = result.verification;
|
|
27066
|
-
if (verification && verification.status !== "confirmed") {
|
|
27067
|
-
return `${applied} (read-back ${verification.status}${verification.note ? `: ${verification.note}` : ""})`;
|
|
27068
|
-
}
|
|
27069
|
-
return applied;
|
|
27070
|
-
}
|
|
27071
|
-
function opLine(op, showAccount) {
|
|
27072
|
-
const parts = [op.ref, op.kind, op.summary];
|
|
27073
|
-
if (op.target && op.target !== op.ref) {
|
|
27074
|
-
parts.push(`target ${op.target}`);
|
|
27075
|
-
}
|
|
27076
|
-
if (showAccount) {
|
|
27077
|
-
parts.push(`account ${op.accountId}`);
|
|
27078
|
-
}
|
|
27079
|
-
if (op.dependsOn.length > 0) {
|
|
27080
|
-
parts.push(`after ${op.dependsOn.join(", ")}`);
|
|
27081
|
-
}
|
|
27082
|
-
const result = resultPart(op);
|
|
27083
|
-
if (result) {
|
|
27084
|
-
parts.push(result);
|
|
27085
|
-
}
|
|
27086
|
-
return ` ${parts.join(" \xB7 ").replace(/[\r\n]+/g, " ")}`;
|
|
27087
|
-
}
|
|
27088
|
-
function renderDraftStatus3(draft) {
|
|
27089
|
-
if (draft.status === "none" || draft.count === 0) {
|
|
27090
|
-
return "No staged Meta changes on this chat.";
|
|
27091
|
-
}
|
|
27092
|
-
const lines = [headingLine(draft)];
|
|
27093
|
-
if (draft.status === "active") {
|
|
27094
|
-
lines.push("Publishing makes every change real on the ad account.");
|
|
27095
|
-
}
|
|
27096
|
-
lines.push("");
|
|
27097
|
-
const showAccount = new Set(draft.ops.map((op) => op.accountId)).size > 1;
|
|
27098
|
-
for (const op of draft.ops) {
|
|
27099
|
-
lines.push(opLine(op, showAccount));
|
|
27100
|
-
}
|
|
27101
|
-
if (draft.advisories.length > 0) {
|
|
27102
|
-
lines.push("", "Advisories");
|
|
27103
|
-
for (const advisory of draft.advisories) {
|
|
27104
|
-
lines.push(` ! ${advisory.ref}: ${advisory.message}`);
|
|
27105
|
-
}
|
|
27106
|
-
}
|
|
27107
|
-
lines.push("", "Full staged payload for one op: baker ads meta draft show <ref> \xB7 raw envelope: --json");
|
|
27108
|
-
return lines.join("\n");
|
|
27109
|
-
}
|
|
27110
|
-
|
|
27111
|
-
// src/commands/ads/meta/draft.ts
|
|
27112
|
-
registerSchema({
|
|
27113
|
-
command: "ads.meta.draft",
|
|
27114
|
-
description: "Review every Meta op staged on this chat, one line each: ref \xB7 kind \xB7 summary \xB7 what it waits on, and after a publish \u2713 applied \u2192 id or \u2717 failed: <error>. `draft show <ref>` prints one op's full payload.",
|
|
27115
|
-
args: {
|
|
27116
|
-
json: { type: "boolean", description: "Raw JSON envelope instead of the readable list", required: false },
|
|
27117
|
-
chat: { type: "string", description: "Read another chat's draft instead of this one", required: false }
|
|
27118
|
-
}
|
|
27119
|
-
});
|
|
27120
|
-
async function listDraft2(json, chat) {
|
|
27223
|
+
async function listDraft2(chat) {
|
|
27121
27224
|
try {
|
|
27122
27225
|
const chatId = resolveChatId(chat);
|
|
27123
27226
|
const response = await apiPost("/api/ads/meta/draft", { chatId });
|
|
27124
|
-
|
|
27125
|
-
writeJsonEnvelope(response);
|
|
27126
|
-
return;
|
|
27127
|
-
}
|
|
27128
|
-
process.stdout.write(`${renderDraftStatus3(response.data)}
|
|
27129
|
-
`);
|
|
27227
|
+
writeJsonEnvelope(response);
|
|
27130
27228
|
} catch (err) {
|
|
27131
27229
|
handleMetaError(err);
|
|
27132
27230
|
}
|
|
@@ -27134,14 +27232,11 @@ async function listDraft2(json, chat) {
|
|
|
27134
27232
|
var listCommand10 = defineCommand65({
|
|
27135
27233
|
meta: {
|
|
27136
27234
|
name: "list",
|
|
27137
|
-
description: "Show every Meta write op staged in this chat,
|
|
27138
|
-
},
|
|
27139
|
-
args: {
|
|
27140
|
-
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" },
|
|
27141
|
-
chat: CHAT_READ_ARG
|
|
27235
|
+
description: "Show every Meta write op staged in this chat, its dependencies, and post-publish results. Publishing reaches the real ad account, so review this before you finish. Example: baker ads meta draft"
|
|
27142
27236
|
},
|
|
27237
|
+
args: { chat: CHAT_READ_ARG },
|
|
27143
27238
|
run: async ({ args: args5 }) => {
|
|
27144
|
-
await listDraft2(args5.
|
|
27239
|
+
await listDraft2(args5.chat);
|
|
27145
27240
|
}
|
|
27146
27241
|
});
|
|
27147
27242
|
var showCommand2 = defineCommand65({
|
|
@@ -27211,10 +27306,7 @@ var metaDraftCommand = defineCommand65({
|
|
|
27211
27306
|
},
|
|
27212
27307
|
// Declared on the parent too: `default: "list"` dispatches the bare `draft --chat <id>` form, and
|
|
27213
27308
|
// citty prints help for a flag the parent does not know instead of forwarding it.
|
|
27214
|
-
args: {
|
|
27215
|
-
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" },
|
|
27216
|
-
chat: CHAT_READ_ARG
|
|
27217
|
-
},
|
|
27309
|
+
args: { chat: CHAT_READ_ARG },
|
|
27218
27310
|
subCommands: { list: listCommand10, show: showCommand2, remove: removeCommand3, clear: clearCommand3 },
|
|
27219
27311
|
// `default` (not `run`) dispatches the bare invocation: citty falls through to `run`
|
|
27220
27312
|
// after dispatching a subcommand, so a `run` here would list the draft a second time
|
|
@@ -28834,7 +28926,7 @@ registerSchema({
|
|
|
28834
28926
|
output: { type: "string", description: "Format: json|csv|md", required: false, default: "json" }
|
|
28835
28927
|
}
|
|
28836
28928
|
});
|
|
28837
|
-
var
|
|
28929
|
+
var listArgs11 = {
|
|
28838
28930
|
"account-id": { type: "string", description: "X Ads account ID" },
|
|
28839
28931
|
"funding-instrument-ids": { type: "string", description: "CSV of funding instrument IDs" },
|
|
28840
28932
|
"campaign-ids": { type: "string", description: "CSV of campaign IDs" },
|
|
@@ -28904,7 +28996,7 @@ Examples:
|
|
|
28904
28996
|
},
|
|
28905
28997
|
// A parent must never declare `run`: citty falls through to it AFTER the
|
|
28906
28998
|
// matched subcommand, so every write would also trigger a full live list.
|
|
28907
|
-
args:
|
|
28999
|
+
args: listArgs11,
|
|
28908
29000
|
default: "list"
|
|
28909
29001
|
});
|
|
28910
29002
|
|
|
@@ -29027,7 +29119,7 @@ function renderNode3(node, depth, showAccount, out) {
|
|
|
29027
29119
|
}
|
|
29028
29120
|
}
|
|
29029
29121
|
var NO_CHANGES = "No X Ads changes staged";
|
|
29030
|
-
var
|
|
29122
|
+
var STATUS_HEADINGS = {
|
|
29031
29123
|
active: "staged",
|
|
29032
29124
|
publishing: "publishing",
|
|
29033
29125
|
applied: "published",
|
|
@@ -29039,8 +29131,8 @@ function didNotApply(op) {
|
|
|
29039
29131
|
function didApply(op) {
|
|
29040
29132
|
return op.result?.status === "applied" || op.result?.status === "simulated";
|
|
29041
29133
|
}
|
|
29042
|
-
function
|
|
29043
|
-
const heading =
|
|
29134
|
+
function headingLine(draft) {
|
|
29135
|
+
const heading = STATUS_HEADINGS[draft.status] ?? draft.status;
|
|
29044
29136
|
if (draft.status !== "applied" && draft.status !== "publishing") {
|
|
29045
29137
|
return `X Ads: ${draft.count} change${draft.count === 1 ? "" : "s"} ${heading}`;
|
|
29046
29138
|
}
|
|
@@ -29054,11 +29146,11 @@ function problemLines(draft) {
|
|
|
29054
29146
|
return `\u2717 ${op.summary} \u2014 failed: ${reason}`;
|
|
29055
29147
|
});
|
|
29056
29148
|
}
|
|
29057
|
-
function
|
|
29149
|
+
function renderDraftStatus3(draft) {
|
|
29058
29150
|
if (draft.status === "none" || draft.count === 0) {
|
|
29059
29151
|
return NO_CHANGES;
|
|
29060
29152
|
}
|
|
29061
|
-
const out = [
|
|
29153
|
+
const out = [headingLine(draft), ""];
|
|
29062
29154
|
const tree = draft.tree ?? [];
|
|
29063
29155
|
const showAccount = accountsInTree3(tree).size > 1;
|
|
29064
29156
|
for (const node of tree) {
|
|
@@ -29096,7 +29188,7 @@ async function listDraft3(json, chat) {
|
|
|
29096
29188
|
writeJsonEnvelope(response);
|
|
29097
29189
|
return;
|
|
29098
29190
|
}
|
|
29099
|
-
process.stdout.write(`${
|
|
29191
|
+
process.stdout.write(`${renderDraftStatus3(response.data)}
|
|
29100
29192
|
`);
|
|
29101
29193
|
} catch (err) {
|
|
29102
29194
|
handleDraftError(err);
|
|
@@ -43100,12 +43192,12 @@ function fail3(code, message) {
|
|
|
43100
43192
|
process.exit(2);
|
|
43101
43193
|
}
|
|
43102
43194
|
function resolveModels(args5) {
|
|
43103
|
-
const
|
|
43195
|
+
const pick2 = (flag, kind, fallback) => args5[flag] ? String(args5[flag]) : resolveModel(kind, fallback);
|
|
43104
43196
|
return {
|
|
43105
|
-
describeModel:
|
|
43106
|
-
selectModel:
|
|
43107
|
-
layoutModel:
|
|
43108
|
-
genModel:
|
|
43197
|
+
describeModel: pick2("describe-model", "image_describe", "~google/gemini-pro-latest"),
|
|
43198
|
+
selectModel: pick2("select-model", "text_generate", "~google/gemini-flash-latest"),
|
|
43199
|
+
layoutModel: pick2("layout-model", "text_generate", "~google/gemini-flash-latest"),
|
|
43200
|
+
genModel: pick2("gen-model", "image_generate", "openai/gpt-image-2")
|
|
43109
43201
|
};
|
|
43110
43202
|
}
|
|
43111
43203
|
var PLATFORM_PLACEMENTS = {
|
|
@@ -45139,18 +45231,18 @@ function parseBudget(raw) {
|
|
|
45139
45231
|
throw new Error(`--budget must be one of ${VIDEO_BUDGETS.join(", ")} (got "${v}")`);
|
|
45140
45232
|
}
|
|
45141
45233
|
function resolveModels2(args5) {
|
|
45142
|
-
const
|
|
45234
|
+
const pick2 = (flag, kind, fallback) => args5[flag] ? String(args5[flag]) : resolveModel2(kind, fallback);
|
|
45143
45235
|
return {
|
|
45144
45236
|
// Flash by default: ~2-3× faster per call than Pro, which keeps each
|
|
45145
45237
|
// per-scene deconstruct step well inside the action time budget and turns a
|
|
45146
45238
|
// ~9 min run into ~3-4 min. Override with --deconstruct-model
|
|
45147
45239
|
// ~google/gemini-pro-latest for the densest extraction when speed matters less.
|
|
45148
|
-
deconstructModel:
|
|
45149
|
-
selectModel:
|
|
45240
|
+
deconstructModel: pick2("deconstruct-model", "video_deconstruct", "~google/gemini-flash-latest"),
|
|
45241
|
+
selectModel: pick2("select-model", "text_generate", "~google/gemini-flash-latest"),
|
|
45150
45242
|
// Default to the strongest image model (matches the static-ad scaffold); the
|
|
45151
45243
|
// frame generators need the most faithful text/identity reproduction. Override
|
|
45152
45244
|
// with --image-model for a cheaper/faster pass.
|
|
45153
|
-
imageModel:
|
|
45245
|
+
imageModel: pick2("image-model", "image_generate", "openai/gpt-image-2.5-sunburst")
|
|
45154
45246
|
};
|
|
45155
45247
|
}
|
|
45156
45248
|
function hasPhotorealCast(elements) {
|
|
@@ -54239,7 +54331,7 @@ var extractCommand = defineCommand149({
|
|
|
54239
54331
|
import { defineCommand as defineCommand150 } from "citty";
|
|
54240
54332
|
|
|
54241
54333
|
// src/commands/images/providerHits.ts
|
|
54242
|
-
function
|
|
54334
|
+
function asRecord4(value) {
|
|
54243
54335
|
return value && typeof value === "object" ? value : {};
|
|
54244
54336
|
}
|
|
54245
54337
|
function str(value) {
|
|
@@ -54264,7 +54356,7 @@ function providerHitNormalizer(record, full) {
|
|
|
54264
54356
|
if (!full) {
|
|
54265
54357
|
return compact3;
|
|
54266
54358
|
}
|
|
54267
|
-
const group =
|
|
54359
|
+
const group = asRecord4(record.group);
|
|
54268
54360
|
return {
|
|
54269
54361
|
...compact3,
|
|
54270
54362
|
externalUrl: str(record.externalUrl),
|
|
@@ -66527,7 +66619,7 @@ async function listTags(json) {
|
|
|
66527
66619
|
failApi3(err);
|
|
66528
66620
|
}
|
|
66529
66621
|
}
|
|
66530
|
-
var
|
|
66622
|
+
var listArgs12 = {
|
|
66531
66623
|
json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" }
|
|
66532
66624
|
};
|
|
66533
66625
|
var listCommand19 = defineCommand222({
|
|
@@ -66535,7 +66627,7 @@ var listCommand19 = defineCommand222({
|
|
|
66535
66627
|
name: "list",
|
|
66536
66628
|
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"
|
|
66537
66629
|
},
|
|
66538
|
-
args:
|
|
66630
|
+
args: listArgs12,
|
|
66539
66631
|
run: async ({ args: args5 }) => {
|
|
66540
66632
|
await listTags(args5.json === true);
|
|
66541
66633
|
}
|
|
@@ -66583,7 +66675,7 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
|
|
|
66583
66675
|
// command's flags when it scans rawArgs for a subcommand name, and `default` (not
|
|
66584
66676
|
// `run`) dispatches the bare invocation — citty falls through to `run` after a
|
|
66585
66677
|
// subcommand, so a `run` here would also list on every `baker tags draft`.
|
|
66586
|
-
args:
|
|
66678
|
+
args: listArgs12,
|
|
66587
66679
|
default: "list"
|
|
66588
66680
|
});
|
|
66589
66681
|
|