@koda-sl/baker-cli 0.363.0 → 0.364.0-dev.18349e66a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -69,7 +69,7 @@ import {
69
69
  validateCanvasDeep,
70
70
  withoutCastName,
71
71
  ytDlpBlockSignal
72
- } from "./chunk-AI4HWQVN.js";
72
+ } from "./chunk-K2IKLMCM.js";
73
73
  import {
74
74
  csvOrJson,
75
75
  daysAgoIso,
@@ -22933,9 +22933,49 @@ Subcommands:
22933
22933
 
22934
22934
  // src/commands/ads/linkedin/creatives.ts
22935
22935
  import { defineCommand as defineCommand44 } from "citty";
22936
+
22937
+ // src/commands/ads/list-rows.ts
22936
22938
  function asRecord(value) {
22937
22939
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
22938
22940
  }
22941
+ function readPath2(row, path48) {
22942
+ let current = row;
22943
+ for (const segment of path48.split(".")) {
22944
+ const record = asRecord(current);
22945
+ if (!record) return void 0;
22946
+ current = record[segment];
22947
+ }
22948
+ return current;
22949
+ }
22950
+ function projectFields(rows, paths) {
22951
+ return rows.map((row) => {
22952
+ const projected = {};
22953
+ for (const path48 of paths) {
22954
+ const value = readPath2(row, path48);
22955
+ if (value !== void 0) {
22956
+ projected[path48] = value;
22957
+ }
22958
+ }
22959
+ return projected;
22960
+ });
22961
+ }
22962
+ function shapeListRows(rows, args5, compact3) {
22963
+ const raw = rows;
22964
+ const fields = typeof args5.fields === "string" ? args5.fields : void 0;
22965
+ if (fields) {
22966
+ const paths = fields.split(",").map((field) => field.trim()).filter((field) => field.length > 0);
22967
+ if (paths.length > 0) {
22968
+ return { rows: projectFields(raw, paths), fields: paths };
22969
+ }
22970
+ }
22971
+ if (args5.full) return { rows: raw };
22972
+ return { rows: rows.map(compact3.row), fields: [...compact3.columns] };
22973
+ }
22974
+
22975
+ // src/commands/ads/linkedin/creatives.ts
22976
+ function asRecord2(value) {
22977
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
22978
+ }
22939
22979
  function asString(value) {
22940
22980
  return typeof value === "string" && value.length > 0 ? value : void 0;
22941
22981
  }
@@ -22943,12 +22983,12 @@ function creativeDestination(content) {
22943
22983
  if (!content) return { format: "unknown" };
22944
22984
  const reference = asString(content.reference);
22945
22985
  if (reference) return { format: "post", postUrn: reference };
22946
- const textAd = asRecord(content.textAd);
22986
+ const textAd = asRecord2(content.textAd);
22947
22987
  if (textAd) return { format: "text", landingUrl: asString(textAd.landingPage) };
22948
- const spotlight = asRecord(content.spotlight);
22988
+ const spotlight = asRecord2(content.spotlight);
22949
22989
  if (spotlight) return { format: "spotlight", landingUrl: asString(spotlight.landingPage) };
22950
- if (asRecord(content.follower)) return { format: "follower" };
22951
- if (asRecord(content.jobs)) return { format: "jobs" };
22990
+ if (asRecord2(content.follower)) return { format: "follower" };
22991
+ if (asRecord2(content.jobs)) return { format: "jobs" };
22952
22992
  return { format: "unknown" };
22953
22993
  }
22954
22994
  var COMPACT_COLUMNS = [
@@ -22976,27 +23016,6 @@ function compactRow(row) {
22976
23016
  ...destination.postUrn ? { postUrn: destination.postUrn } : {}
22977
23017
  };
22978
23018
  }
22979
- function readPath2(row, path48) {
22980
- let current = row;
22981
- for (const segment of path48.split(".")) {
22982
- const record = asRecord(current);
22983
- if (!record) return void 0;
22984
- current = record[segment];
22985
- }
22986
- return current;
22987
- }
22988
- function projectFields(rows, paths) {
22989
- return rows.map((row) => {
22990
- const projected = {};
22991
- for (const path48 of paths) {
22992
- const value = readPath2(row, path48);
22993
- if (value !== void 0) {
22994
- projected[path48] = value;
22995
- }
22996
- }
22997
- return projected;
22998
- });
22999
- }
23000
23019
  function unmappedShapeWarnings(rows, rawContentReturned) {
23001
23020
  const unmapped = rows.filter((row) => row.content && creativeDestination(row.content).format === "unknown");
23002
23021
  if (unmapped.length === 0) return [];
@@ -23008,18 +23027,6 @@ function unmappedShapeWarnings(rows, rawContentReturned) {
23008
23027
  }
23009
23028
  ];
23010
23029
  }
23011
- function shapeRows(rows, args5) {
23012
- const raw = rows;
23013
- const fields = typeof args5.fields === "string" ? args5.fields : void 0;
23014
- if (fields) {
23015
- const paths = fields.split(",").map((field) => field.trim()).filter((field) => field.length > 0);
23016
- if (paths.length > 0) {
23017
- return { rows: projectFields(raw, paths), fields: paths };
23018
- }
23019
- }
23020
- if (args5.full) return { rows: raw };
23021
- return { rows: rows.map(compactRow), fields: [...COMPACT_COLUMNS] };
23022
- }
23023
23030
  var listArgs3 = {
23024
23031
  "account-id": { type: "string", description: "Numeric account ID or urn:li:sponsoredAccount:N" },
23025
23032
  "account-urn": { type: "string", description: "Alias for --account-id" },
@@ -23051,7 +23058,10 @@ var creativesListCommand = defineCommand44({
23051
23058
  if (args5.limit) params.limit = String(args5.limit);
23052
23059
  if (args5["no-cache"]) params["skip-cache"] = "true";
23053
23060
  const data = await apiGet("/api/ads/linkedin/creatives", params);
23054
- const shaped = shapeRows(data, args5);
23061
+ const shaped = shapeListRows(data, args5, {
23062
+ row: compactRow,
23063
+ columns: COMPACT_COLUMNS
23064
+ });
23055
23065
  const fmt = csvOrJson2(args5);
23056
23066
  if (fmt !== "json") {
23057
23067
  writeAdsOutput(shaped.rows, fmt, shaped.fields);
@@ -24069,22 +24079,178 @@ Examples:
24069
24079
 
24070
24080
  // src/commands/ads/meta/activities.ts
24071
24081
  import { defineCommand as defineCommand56 } from "citty";
24082
+
24083
+ // src/commands/ads/meta/list-rows.ts
24084
+ function pick(row, keys) {
24085
+ const picked = {};
24086
+ for (const key of keys) {
24087
+ if (row[key] !== void 0) picked[key] = row[key];
24088
+ }
24089
+ return picked;
24090
+ }
24091
+ function asRecord3(value) {
24092
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
24093
+ }
24094
+ var CAMPAIGN_COLUMNS = [
24095
+ "id",
24096
+ "name",
24097
+ "effective_status",
24098
+ "objective",
24099
+ "daily_budget",
24100
+ "lifetime_budget",
24101
+ "bid_strategy",
24102
+ "special_ad_categories",
24103
+ "stop_time",
24104
+ "created_time"
24105
+ ];
24106
+ var ADSET_KEYS = [
24107
+ "id",
24108
+ "name",
24109
+ "campaign_id",
24110
+ "effective_status",
24111
+ "optimization_goal",
24112
+ "billing_event",
24113
+ "bid_strategy",
24114
+ "daily_budget",
24115
+ "lifetime_budget",
24116
+ "destination_type"
24117
+ ];
24118
+ var ADSET_COLUMNS = [...ADSET_KEYS, "learning_stage", "end_time", "created_time"];
24119
+ function compactAdSet(row) {
24120
+ const learning = asRecord3(row.learning_stage_info)?.status;
24121
+ return {
24122
+ ...pick(row, ADSET_KEYS),
24123
+ ...typeof learning === "string" ? { learning_stage: learning } : {},
24124
+ ...pick(row, ["end_time", "created_time"])
24125
+ };
24126
+ }
24127
+ var AD_COLUMNS = [
24128
+ "id",
24129
+ "name",
24130
+ "adset_id",
24131
+ "campaign_id",
24132
+ "effective_status",
24133
+ "creative_id",
24134
+ "issues",
24135
+ "created_time"
24136
+ ];
24137
+ function adIssues(value) {
24138
+ if (!Array.isArray(value)) return [];
24139
+ return value.flatMap((entry) => {
24140
+ const issue = asRecord3(entry);
24141
+ const text2 = issue?.error_summary ?? issue?.error_message;
24142
+ return typeof text2 === "string" && text2 ? [text2] : [];
24143
+ });
24144
+ }
24145
+ function compactAd(row) {
24146
+ const creativeId = asRecord3(row.creative)?.id;
24147
+ const issues = adIssues(row.issues_info);
24148
+ return {
24149
+ ...pick(row, ["id", "name", "adset_id", "campaign_id", "effective_status"]),
24150
+ ...creativeId !== void 0 ? { creative_id: creativeId } : {},
24151
+ ...issues.length > 0 ? { issues } : {},
24152
+ ...pick(row, ["created_time"])
24153
+ };
24154
+ }
24155
+ var ACTIVITY_COLUMNS = [
24156
+ "event_time",
24157
+ "event_type",
24158
+ "actor_name",
24159
+ "object_type",
24160
+ "object_name",
24161
+ "object_id",
24162
+ "change"
24163
+ ];
24164
+ function isScalar(value) {
24165
+ return value === null || typeof value === "string" || typeof value === "number";
24166
+ }
24167
+ function activityChange(extraData) {
24168
+ if (typeof extraData !== "string") return void 0;
24169
+ let parsed;
24170
+ try {
24171
+ parsed = JSON.parse(extraData);
24172
+ } catch {
24173
+ return void 0;
24174
+ }
24175
+ const data = asRecord3(parsed);
24176
+ if (!data || !("new_value" in data) || !isScalar(data.new_value) || !isScalar(data.old_value ?? null)) {
24177
+ return void 0;
24178
+ }
24179
+ const show = (value) => value === null || value === void 0 ? "(none)" : String(value);
24180
+ return `${show(data.old_value)} \u2192 ${show(data.new_value)}`;
24181
+ }
24182
+ function compactActivity(row) {
24183
+ const change = activityChange(row.extra_data);
24184
+ return {
24185
+ ...pick(row, ["event_time", "event_type", "actor_name", "object_type", "object_name", "object_id"]),
24186
+ ...change !== void 0 ? { change } : {}
24187
+ };
24188
+ }
24189
+ var PROJECTIONS = {
24190
+ campaigns: { row: (row) => pick(row, CAMPAIGN_COLUMNS), columns: CAMPAIGN_COLUMNS },
24191
+ adsets: { row: compactAdSet, columns: ADSET_COLUMNS },
24192
+ ads: { row: compactAd, columns: AD_COLUMNS },
24193
+ activities: { row: compactActivity, columns: ACTIVITY_COLUMNS }
24194
+ };
24195
+ function shapeMetaListRows(kind, rows, args5) {
24196
+ return shapeListRows(rows, args5, PROJECTIONS[kind]);
24197
+ }
24198
+ var META_LIST_SHAPE_ARGS = {
24199
+ fields: {
24200
+ type: "string",
24201
+ description: "CSV of dotted paths to return instead of the compact row, e.g. id,name,targeting.geo_locations"
24202
+ },
24203
+ full: { type: "boolean", description: "Return every field Meta sent (targeting, tracking specs, raw extra_data)" },
24204
+ output: { type: "string", description: "json|csv|jsonl|md \u2014 md prints a table of the compact row", default: "json" }
24205
+ };
24206
+ function registerMetaListSchema(kind, description, args5) {
24207
+ registerSchema({
24208
+ command: `ads.meta.${kind}`,
24209
+ description,
24210
+ args: Object.fromEntries(
24211
+ Object.entries(args5).map(([name, def]) => [
24212
+ name,
24213
+ {
24214
+ type: def.type,
24215
+ description: def.description ?? "",
24216
+ required: false,
24217
+ ...def.default !== void 0 ? { default: def.default } : {}
24218
+ }
24219
+ ])
24220
+ )
24221
+ });
24222
+ }
24223
+
24224
+ // src/commands/ads/meta/activities.ts
24225
+ var listArgs4 = {
24226
+ "account-id": { type: "string", description: "Meta ad account ID" },
24227
+ days: { type: "string", description: "Lookback days (default 7)" },
24228
+ limit: { type: "string", description: "Max rows" },
24229
+ "no-cache": NO_CACHE_ARG,
24230
+ ...META_LIST_SHAPE_ARGS
24231
+ };
24232
+ registerMetaListSchema(
24233
+ "activities",
24234
+ "Account change log. Compact 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 --output md. --fields event_time,object_name,extra_data or --full for the raw change payload.",
24235
+ listArgs4
24236
+ );
24072
24237
  var activitiesCommand = defineCommand56({
24073
24238
  meta: {
24074
24239
  name: "activities",
24075
24240
  description: `Audit log of recent ad-account changes (created, paused, edited). Default lookback 7 days,
24076
24241
  ~90 day retention server-side.
24077
24242
 
24243
+ Compact by default, one row per event: event_time, event_type, actor_name, object_type,
24244
+ object_name, object_id, and change ("old \u2192 new" when the change is a single value: status,
24245
+ name, budget, goal). --fields takes dotted paths (extra_data holds the raw change); --full returns
24246
+ every field Meta sent.
24247
+
24078
24248
  Examples:
24079
- baker ads meta activities --account-id act_123 --days 14`
24080
- },
24081
- args: {
24082
- "account-id": { type: "string", description: "Meta ad account ID" },
24083
- days: { type: "string", description: "Lookback days (default 7)" },
24084
- limit: { type: "string", description: "Max rows" },
24085
- "no-cache": NO_CACHE_ARG,
24086
- output: { type: "string", description: "Output format", default: "json" }
24249
+ baker ads meta activities --account-id act_123 --days 14
24250
+ baker ads meta activities --account-id act_123 --days 2 --output md
24251
+ baker ads meta activities --account-id act_123 --fields event_time,object_name,extra_data`
24087
24252
  },
24253
+ args: listArgs4,
24088
24254
  run: async ({ args: args5 }) => {
24089
24255
  const accountId = resolveAccountIdArg(args5);
24090
24256
  try {
@@ -24093,12 +24259,13 @@ Examples:
24093
24259
  if (args5.limit) params.limit = args5.limit;
24094
24260
  if (args5["no-cache"]) params["skip-cache"] = "true";
24095
24261
  const data = await apiGet("/api/ads/meta/activities", params);
24262
+ const shaped = shapeMetaListRows("activities", data, args5);
24096
24263
  const fmt = csvOrJson(args5);
24097
24264
  if (fmt !== "json") {
24098
- writeAdsOutput(data, fmt);
24265
+ writeAdsOutput(shaped.rows, fmt, shaped.fields);
24099
24266
  return;
24100
24267
  }
24101
- writeAdsJson({ ok: true, data });
24268
+ writeAdsJson({ ok: true, data: shaped.rows });
24102
24269
  } catch (err) {
24103
24270
  handleMetaError(err);
24104
24271
  }
@@ -26541,7 +26708,7 @@ var adsArchiveCommand = statusCommand3("archive", "ad.update", "ad");
26541
26708
  var adsDuplicateCommand = duplicateCommand2("ad", "ad");
26542
26709
 
26543
26710
  // src/commands/ads/meta/ads.ts
26544
- var listArgs4 = {
26711
+ var listArgs5 = {
26545
26712
  "account-id": { type: "string", description: "Meta ad account ID" },
26546
26713
  "adset-id": { type: "string", description: "Filter to one adset" },
26547
26714
  "campaign-id": { type: "string", description: "Filter to one campaign" },
@@ -26549,14 +26716,19 @@ var listArgs4 = {
26549
26716
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
26550
26717
  limit: { type: "string", description: "Max rows (default 1000)" },
26551
26718
  "no-cache": NO_CACHE_ARG,
26552
- output: { type: "string", description: "Output format", default: "json" }
26719
+ ...META_LIST_SHAPE_ARGS
26553
26720
  };
26721
+ registerMetaListSchema(
26722
+ "ads",
26723
+ "List ads in a Meta ad account. Compact 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 --output md. --fields takes dotted paths (e.g. id,tracking_specs); --full returns every field Meta sent.",
26724
+ listArgs5
26725
+ );
26554
26726
  var listCommand4 = defineCommand58({
26555
26727
  meta: {
26556
26728
  name: "list",
26557
26729
  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"
26558
26730
  },
26559
- args: listArgs4,
26731
+ args: listArgs5,
26560
26732
  run: async ({ args: args5 }) => {
26561
26733
  const accountId = resolveAccountIdArg(args5);
26562
26734
  const effectiveStatus = resolveEffectiveStatus(args5);
@@ -26568,12 +26740,13 @@ var listCommand4 = defineCommand58({
26568
26740
  if (args5.limit) params.limit = args5.limit;
26569
26741
  if (args5["no-cache"]) params["skip-cache"] = "true";
26570
26742
  const data = await apiGet("/api/ads/meta/ads", params);
26743
+ const shaped = shapeMetaListRows("ads", data, args5);
26571
26744
  const fmt = csvOrJson(args5);
26572
26745
  if (fmt !== "json") {
26573
- writeAdsOutput(data, fmt);
26746
+ writeAdsOutput(shaped.rows, fmt, shaped.fields);
26574
26747
  return;
26575
26748
  }
26576
- writeAdsJson({ ok: true, data });
26749
+ writeAdsJson({ ok: true, data: shaped.rows });
26577
26750
  } catch (err) {
26578
26751
  handleMetaError(err);
26579
26752
  }
@@ -26587,9 +26760,14 @@ Defaults to ACTIVE only \u2014 pass --all-statuses to widen. Write subcommands s
26587
26760
 
26588
26761
  The dashboard shows effective_status (e.g. WITH_ISSUES, PENDING_REVIEW, DISAPPROVED, ADSET_PAUSED), not status.
26589
26762
 
26763
+ Listing rows are compact: id, name, adset_id, campaign_id, effective_status, creative_id, issues
26764
+ (why an ad is WITH_ISSUES), created_time. --fields takes dotted paths (e.g. tracking_specs,
26765
+ preview_shareable_link); --full returns every field.
26766
+
26590
26767
  Examples:
26591
26768
  baker ads meta ads --account-id act_123
26592
26769
  baker ads meta ads --adset-id 6123
26770
+ baker ads meta ads --adset-id 6123 --fields id,name,preview_shareable_link
26593
26771
  baker ads meta ads create --name "Ad 1" --adset meta_temp_as01 --creative meta_temp_cr01
26594
26772
  baker ads meta ads pause 6123 --account-id act_123
26595
26773
  baker ads meta ads retag 6123 --set "utm_medium=paid-social" \u2014 fix tracking on a LIVE ad, keeping everything else`
@@ -26608,27 +26786,32 @@ Examples:
26608
26786
  // subcommand name using THIS command's arg defs, so without them `--account-id act_1`
26609
26787
  // would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
26610
26788
  // invocation — citty falls through to `run` after a subcommand, double-executing it.
26611
- args: listArgs4,
26789
+ args: listArgs5,
26612
26790
  default: "list"
26613
26791
  });
26614
26792
 
26615
26793
  // src/commands/ads/meta/adsets.ts
26616
26794
  import { defineCommand as defineCommand59 } from "citty";
26617
- var listArgs5 = {
26795
+ var listArgs6 = {
26618
26796
  "account-id": { type: "string", description: "Meta ad account ID" },
26619
26797
  "campaign-id": { type: "string", description: "Filter to one campaign" },
26620
26798
  "effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
26621
26799
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
26622
26800
  limit: { type: "string", description: "Max rows (default 1000)" },
26623
26801
  "no-cache": NO_CACHE_ARG,
26624
- output: { type: "string", description: "Output format", default: "json" }
26802
+ ...META_LIST_SHAPE_ARGS
26625
26803
  };
26804
+ registerMetaListSchema(
26805
+ "adsets",
26806
+ "List ad sets in a Meta ad account. Compact by default: id, name, campaign_id, effective_status, optimization_goal, billing_event, bid_strategy, budgets, destination_type, 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.",
26807
+ listArgs6
26808
+ );
26626
26809
  var listCommand5 = defineCommand59({
26627
26810
  meta: {
26628
26811
  name: "list",
26629
26812
  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"
26630
26813
  },
26631
- args: listArgs5,
26814
+ args: listArgs6,
26632
26815
  run: async ({ args: args5 }) => {
26633
26816
  const accountId = resolveAccountIdArg(args5);
26634
26817
  const effectiveStatus = resolveEffectiveStatus(args5);
@@ -26639,12 +26822,13 @@ var listCommand5 = defineCommand59({
26639
26822
  if (args5.limit) params.limit = args5.limit;
26640
26823
  if (args5["no-cache"]) params["skip-cache"] = "true";
26641
26824
  const data = await apiGet("/api/ads/meta/adsets", params);
26825
+ const shaped = shapeMetaListRows("adsets", data, args5);
26642
26826
  const fmt = csvOrJson(args5);
26643
26827
  if (fmt !== "json") {
26644
- writeAdsOutput(data, fmt);
26828
+ writeAdsOutput(shaped.rows, fmt, shaped.fields);
26645
26829
  return;
26646
26830
  }
26647
- writeAdsJson({ ok: true, data });
26831
+ writeAdsJson({ ok: true, data: shaped.rows });
26648
26832
  } catch (err) {
26649
26833
  handleMetaError(err);
26650
26834
  }
@@ -26656,9 +26840,14 @@ var adsetsCommand = defineCommand59({
26656
26840
  description: `List ad sets in a Meta ad account, or stage writes (create/update/pause/resume/archive/duplicate).
26657
26841
  Defaults to ACTIVE only. Write subcommands stage ops on this chat's draft.
26658
26842
 
26843
+ Listing rows are compact: id, name, campaign_id, effective_status, optimization_goal, billing_event,
26844
+ bid_strategy, budgets, destination_type, learning_stage, end_time, created_time. Targeting is not in
26845
+ the compact row \u2014 ask for it with --fields (dotted paths) or --full.
26846
+
26659
26847
  Examples:
26660
26848
  baker ads meta adsets --account-id act_123
26661
26849
  baker ads meta adsets --campaign-id 6123456789
26850
+ baker ads meta adsets --campaign-id 6123456789 --fields id,name,targeting.geo_locations
26662
26851
  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`
26663
26852
  },
26664
26853
  subCommands: {
@@ -26674,13 +26863,13 @@ Examples:
26674
26863
  // subcommand name using THIS command's arg defs, so without them `--account-id act_1`
26675
26864
  // would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
26676
26865
  // invocation — citty falls through to `run` after a subcommand, double-executing it.
26677
- args: listArgs5,
26866
+ args: listArgs6,
26678
26867
  default: "list"
26679
26868
  });
26680
26869
 
26681
26870
  // src/commands/ads/meta/audiences.ts
26682
26871
  import { defineCommand as defineCommand60 } from "citty";
26683
- var listArgs6 = {
26872
+ var listArgs7 = {
26684
26873
  "account-id": { type: "string", description: "Meta ad account ID" },
26685
26874
  limit: { type: "string", description: "Max rows" },
26686
26875
  "no-cache": NO_CACHE_ARG,
@@ -26691,7 +26880,7 @@ var listCommand6 = defineCommand60({
26691
26880
  name: "list",
26692
26881
  description: "List custom audiences. Runs by default when no subcommand is given. Example: baker ads meta audiences --account-id act_123"
26693
26882
  },
26694
- args: listArgs6,
26883
+ args: listArgs7,
26695
26884
  run: async ({ args: args5 }) => {
26696
26885
  const accountId = resolveAccountIdArg(args5);
26697
26886
  try {
@@ -26729,7 +26918,7 @@ Examples:
26729
26918
  // subcommand name using THIS command's arg defs, so without them `--account-id act_1`
26730
26919
  // would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
26731
26920
  // invocation — citty falls through to `run` after a subcommand, double-executing it.
26732
- args: listArgs6,
26921
+ args: listArgs7,
26733
26922
  default: "list"
26734
26923
  });
26735
26924
 
@@ -26766,20 +26955,25 @@ Examples:
26766
26955
 
26767
26956
  // src/commands/ads/meta/campaigns.ts
26768
26957
  import { defineCommand as defineCommand62 } from "citty";
26769
- var listArgs7 = {
26958
+ var listArgs8 = {
26770
26959
  "account-id": { type: "string", description: "Meta ad account ID" },
26771
26960
  "effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
26772
26961
  "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter and return everything" },
26773
26962
  limit: { type: "string", description: "Max rows (default 1000)" },
26774
26963
  "no-cache": NO_CACHE_ARG,
26775
- output: { type: "string", description: "Output format", default: "json" }
26964
+ ...META_LIST_SHAPE_ARGS
26776
26965
  };
26966
+ registerMetaListSchema(
26967
+ "campaigns",
26968
+ "List campaigns in a Meta ad account. Compact by default: id, name, effective_status, objective, budgets, bid_strategy, special_ad_categories, stop_time, created_time. ACTIVE only unless --all-statuses. Start here: baker ads meta campaigns --account-id act_123 --all-statuses --output md. --fields takes dotted paths for anything else; --full returns every field Meta sent.",
26969
+ listArgs8
26970
+ );
26777
26971
  var listCommand7 = defineCommand62({
26778
26972
  meta: {
26779
26973
  name: "list",
26780
26974
  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"
26781
26975
  },
26782
- args: listArgs7,
26976
+ args: listArgs8,
26783
26977
  run: async ({ args: args5 }) => {
26784
26978
  const accountId = resolveAccountIdArg(args5);
26785
26979
  const effectiveStatus = resolveEffectiveStatus(args5);
@@ -26789,12 +26983,13 @@ var listCommand7 = defineCommand62({
26789
26983
  if (args5.limit) params.limit = args5.limit;
26790
26984
  if (args5["no-cache"]) params["skip-cache"] = "true";
26791
26985
  const data = await apiGet("/api/ads/meta/campaigns", params);
26986
+ const shaped = shapeMetaListRows("campaigns", data, args5);
26792
26987
  const fmt = csvOrJson(args5);
26793
26988
  if (fmt !== "json") {
26794
- writeAdsOutput(data, fmt);
26989
+ writeAdsOutput(shaped.rows, fmt, shaped.fields);
26795
26990
  return;
26796
26991
  }
26797
- writeAdsJson({ ok: true, data });
26992
+ writeAdsJson({ ok: true, data: shaped.rows });
26798
26993
  } catch (err) {
26799
26994
  handleMetaError(err);
26800
26995
  }
@@ -26810,9 +27005,14 @@ apply only when the chat is published.
26810
27005
  In Meta's API "campaign" is the top-of-tree object (what marketers usually call a campaign group).
26811
27006
  The dashboard shows effective_status: ACTIVE, PAUSED, DELETED, ARCHIVED, IN_PROCESS, WITH_ISSUES, etc.
26812
27007
 
27008
+ Listing rows are compact: id, name, effective_status, objective, daily/lifetime budget, bid_strategy,
27009
+ special_ad_categories, stop_time, created_time. --fields takes dotted paths for anything else; --full returns every field.
27010
+
26813
27011
  Examples:
26814
27012
  baker ads meta campaigns --account-id act_123 # ACTIVE only
26815
27013
  baker ads meta campaigns --account-id act_123 --all-statuses # everything
27014
+ baker ads meta campaigns --account-id act_123 --all-statuses --output md # as a table
27015
+ baker ads meta campaigns --account-id act_123 --fields id,name,budget_remaining,start_time
26816
27016
  baker ads meta campaigns create --account-id act_123 --name "Q3" --objective OUTCOME_LEADS --daily-budget 50
26817
27017
  baker ads meta campaigns pause 6123 --account-id act_123`
26818
27018
  },
@@ -26829,13 +27029,13 @@ Examples:
26829
27029
  // subcommand name using THIS command's arg defs, so without them `--account-id act_1`
26830
27030
  // would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
26831
27031
  // invocation — citty falls through to `run` after a subcommand, double-executing it.
26832
- args: listArgs7,
27032
+ args: listArgs8,
26833
27033
  default: "list"
26834
27034
  });
26835
27035
 
26836
27036
  // src/commands/ads/meta/creatives.ts
26837
27037
  import { defineCommand as defineCommand63 } from "citty";
26838
- var listArgs8 = {
27038
+ var listArgs9 = {
26839
27039
  "account-id": { type: "string", description: "Meta ad account ID (required if no --creative-id)" },
26840
27040
  "creative-id": { type: "string", description: "Single creative ID" },
26841
27041
  limit: { type: "string", description: "Max rows (default 500)" },
@@ -26847,7 +27047,7 @@ var listCommand8 = defineCommand63({
26847
27047
  name: "list",
26848
27048
  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"
26849
27049
  },
26850
- args: listArgs8,
27050
+ args: listArgs9,
26851
27051
  run: async ({ args: args5 }) => {
26852
27052
  try {
26853
27053
  const params = {};
@@ -26893,7 +27093,7 @@ Examples:
26893
27093
  // subcommand name using THIS command's arg defs, so without them `--account-id act_1`
26894
27094
  // would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare
26895
27095
  // invocation — citty falls through to `run` after a subcommand, double-executing it.
26896
- args: listArgs8,
27096
+ args: listArgs9,
26897
27097
  default: "list"
26898
27098
  });
26899
27099
 
@@ -26941,7 +27141,7 @@ registerSchema({
26941
27141
  output: { type: "string", description: "json|csv", required: false, default: "json" }
26942
27142
  }
26943
27143
  });
26944
- var listArgs9 = {
27144
+ var listArgs10 = {
26945
27145
  "account-id": { type: "string", description: "Meta ad account ID" },
26946
27146
  full: { type: "boolean", description: "Include the raw rule JSON, retention and creation times" },
26947
27147
  limit: { type: "string", description: "Max rows" },
@@ -26953,7 +27153,7 @@ var listCommand9 = defineCommand64({
26953
27153
  name: "list",
26954
27154
  description: "List custom conversions. Runs by default when no subcommand is given. Example: baker ads meta custom-conversions --account-id act_123"
26955
27155
  },
26956
- args: listArgs9,
27156
+ args: listArgs10,
26957
27157
  run: async ({ args: args5 }) => {
26958
27158
  const accountId = resolveAccountIdArg(args5);
26959
27159
  try {
@@ -26991,7 +27191,7 @@ Examples:
26991
27191
  // `args` stays even though the parent has no `run`: citty scans rawArgs for
26992
27192
  // the subcommand name using THIS command's arg defs. `default` (not `run`)
26993
27193
  // dispatches the bare invocation.
26994
- args: listArgs9,
27194
+ args: listArgs10,
26995
27195
  default: "list"
26996
27196
  });
26997
27197
 
@@ -28703,7 +28903,7 @@ registerSchema({
28703
28903
  output: { type: "string", description: "Format: json|csv|md", required: false, default: "json" }
28704
28904
  }
28705
28905
  });
28706
- var listArgs10 = {
28906
+ var listArgs11 = {
28707
28907
  "account-id": { type: "string", description: "X Ads account ID" },
28708
28908
  "funding-instrument-ids": { type: "string", description: "CSV of funding instrument IDs" },
28709
28909
  "campaign-ids": { type: "string", description: "CSV of campaign IDs" },
@@ -28773,7 +28973,7 @@ Examples:
28773
28973
  },
28774
28974
  // A parent must never declare `run`: citty falls through to it AFTER the
28775
28975
  // matched subcommand, so every write would also trigger a full live list.
28776
- args: listArgs10,
28976
+ args: listArgs11,
28777
28977
  default: "list"
28778
28978
  });
28779
28979
 
@@ -42969,12 +43169,12 @@ function fail3(code, message) {
42969
43169
  process.exit(2);
42970
43170
  }
42971
43171
  function resolveModels(args5) {
42972
- const pick = (flag, kind, fallback) => args5[flag] ? String(args5[flag]) : resolveModel(kind, fallback);
43172
+ const pick2 = (flag, kind, fallback) => args5[flag] ? String(args5[flag]) : resolveModel(kind, fallback);
42973
43173
  return {
42974
- describeModel: pick("describe-model", "image_describe", "~google/gemini-pro-latest"),
42975
- selectModel: pick("select-model", "text_generate", "~google/gemini-flash-latest"),
42976
- layoutModel: pick("layout-model", "text_generate", "~google/gemini-flash-latest"),
42977
- genModel: pick("gen-model", "image_generate", "openai/gpt-image-2")
43174
+ describeModel: pick2("describe-model", "image_describe", "~google/gemini-pro-latest"),
43175
+ selectModel: pick2("select-model", "text_generate", "~google/gemini-flash-latest"),
43176
+ layoutModel: pick2("layout-model", "text_generate", "~google/gemini-flash-latest"),
43177
+ genModel: pick2("gen-model", "image_generate", "openai/gpt-image-2")
42978
43178
  };
42979
43179
  }
42980
43180
  var PLATFORM_PLACEMENTS = {
@@ -45008,18 +45208,18 @@ function parseBudget(raw) {
45008
45208
  throw new Error(`--budget must be one of ${VIDEO_BUDGETS.join(", ")} (got "${v}")`);
45009
45209
  }
45010
45210
  function resolveModels2(args5) {
45011
- const pick = (flag, kind, fallback) => args5[flag] ? String(args5[flag]) : resolveModel2(kind, fallback);
45211
+ const pick2 = (flag, kind, fallback) => args5[flag] ? String(args5[flag]) : resolveModel2(kind, fallback);
45012
45212
  return {
45013
45213
  // Flash by default: ~2-3× faster per call than Pro, which keeps each
45014
45214
  // per-scene deconstruct step well inside the action time budget and turns a
45015
45215
  // ~9 min run into ~3-4 min. Override with --deconstruct-model
45016
45216
  // ~google/gemini-pro-latest for the densest extraction when speed matters less.
45017
- deconstructModel: pick("deconstruct-model", "video_deconstruct", "~google/gemini-flash-latest"),
45018
- selectModel: pick("select-model", "text_generate", "~google/gemini-flash-latest"),
45217
+ deconstructModel: pick2("deconstruct-model", "video_deconstruct", "~google/gemini-flash-latest"),
45218
+ selectModel: pick2("select-model", "text_generate", "~google/gemini-flash-latest"),
45019
45219
  // Default to the strongest image model (matches the static-ad scaffold); the
45020
45220
  // frame generators need the most faithful text/identity reproduction. Override
45021
45221
  // with --image-model for a cheaper/faster pass.
45022
- imageModel: pick("image-model", "image_generate", "openai/gpt-image-2.5-sunburst")
45222
+ imageModel: pick2("image-model", "image_generate", "openai/gpt-image-2.5-sunburst")
45023
45223
  };
45024
45224
  }
45025
45225
  function hasPhotorealCast(elements) {
@@ -54108,7 +54308,7 @@ var extractCommand = defineCommand149({
54108
54308
  import { defineCommand as defineCommand150 } from "citty";
54109
54309
 
54110
54310
  // src/commands/images/providerHits.ts
54111
- function asRecord2(value) {
54311
+ function asRecord4(value) {
54112
54312
  return value && typeof value === "object" ? value : {};
54113
54313
  }
54114
54314
  function str(value) {
@@ -54133,7 +54333,7 @@ function providerHitNormalizer(record, full) {
54133
54333
  if (!full) {
54134
54334
  return compact3;
54135
54335
  }
54136
- const group = asRecord2(record.group);
54336
+ const group = asRecord4(record.group);
54137
54337
  return {
54138
54338
  ...compact3,
54139
54339
  externalUrl: str(record.externalUrl),
@@ -66396,7 +66596,7 @@ async function listTags(json) {
66396
66596
  failApi3(err);
66397
66597
  }
66398
66598
  }
66399
- var listArgs11 = {
66599
+ var listArgs12 = {
66400
66600
  json: { type: "boolean", description: "Print the raw JSON envelope instead of the readable list" }
66401
66601
  };
66402
66602
  var listCommand19 = defineCommand222({
@@ -66404,7 +66604,7 @@ var listCommand19 = defineCommand222({
66404
66604
  name: "list",
66405
66605
  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"
66406
66606
  },
66407
- args: listArgs11,
66607
+ args: listArgs12,
66408
66608
  run: async ({ args: args5 }) => {
66409
66609
  await listTags(args5.json === true);
66410
66610
  }
@@ -66452,7 +66652,7 @@ Full guide: __tooling__/docs/tools/baker/tags.md`
66452
66652
  // command's flags when it scans rawArgs for a subcommand name, and `default` (not
66453
66653
  // `run`) dispatches the bare invocation — citty falls through to `run` after a
66454
66654
  // subcommand, so a `run` here would also list on every `baker tags draft`.
66455
- args: listArgs11,
66655
+ args: listArgs12,
66456
66656
  default: "list"
66457
66657
  });
66458
66658