@koda-sl/baker-cli 0.24.0-dev.55a07065 → 0.25.0-dev.55a07065

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.
Files changed (31) hide show
  1. package/README.md +79 -46
  2. package/dist/cli.js +1 -1
  3. package/dist/commands/ads/meta/ads.d.ts +5 -1
  4. package/dist/commands/ads/meta/ads.d.ts.map +1 -1
  5. package/dist/commands/ads/meta/ads.js +11 -8
  6. package/dist/commands/ads/meta/ads.js.map +1 -1
  7. package/dist/commands/ads/meta/adsets.d.ts +5 -1
  8. package/dist/commands/ads/meta/adsets.d.ts.map +1 -1
  9. package/dist/commands/ads/meta/adsets.js +9 -6
  10. package/dist/commands/ads/meta/adsets.js.map +1 -1
  11. package/dist/commands/ads/meta/campaigns.d.ts +5 -1
  12. package/dist/commands/ads/meta/campaigns.d.ts.map +1 -1
  13. package/dist/commands/ads/meta/campaigns.js +12 -9
  14. package/dist/commands/ads/meta/campaigns.js.map +1 -1
  15. package/dist/commands/ads/meta/index.d.ts +15 -0
  16. package/dist/commands/ads/meta/index.d.ts.map +1 -1
  17. package/dist/commands/ads/meta/index.js +36 -33
  18. package/dist/commands/ads/meta/index.js.map +1 -1
  19. package/dist/commands/ads/meta/insights.d.ts +26 -14
  20. package/dist/commands/ads/meta/insights.d.ts.map +1 -1
  21. package/dist/commands/ads/meta/insights.js +154 -78
  22. package/dist/commands/ads/meta/insights.js.map +1 -1
  23. package/dist/commands/ads/meta/presets.d.ts +23 -11
  24. package/dist/commands/ads/meta/presets.d.ts.map +1 -1
  25. package/dist/commands/ads/meta/presets.js +62 -86
  26. package/dist/commands/ads/meta/presets.js.map +1 -1
  27. package/dist/commands/ads/meta/shared.d.ts +6 -0
  28. package/dist/commands/ads/meta/shared.d.ts.map +1 -1
  29. package/dist/commands/ads/meta/shared.js +15 -0
  30. package/dist/commands/ads/meta/shared.js.map +1 -1
  31. package/package.json +1 -1
package/README.md CHANGED
@@ -690,64 +690,97 @@ All errors include a `fix` object with `action`, `correctedCommand` (when applic
690
690
 
691
691
  ### Meta Ads (`baker ads meta`)
692
692
 
693
- Meta Marketing API (Facebook + Instagram). Connect via OAuth in the dashboard, then pick which ad accounts to scope to. Default account ID: `BAKER_META_AD_ACCOUNT_ID` env var or `--account-id` flag (accepts both `act_123` and bare `123`).
693
+ Meta Marketing API (Facebook + Instagram). Connect via OAuth in the dashboard, pick which ad accounts to scope to, then call from the CLI. Account ID via `--account-id act_123` or `BAKER_META_AD_ACCOUNT_ID` env var.
694
694
 
695
- Discovery:
696
- ```
697
- baker ads meta accounts # accounts in the connected scope
698
- baker ads meta accounts --include-all # every account the token can see
699
- baker ads meta businesses # Business Manager IDs (needed for studies/catalogs)
700
- ```
695
+ The command surface is **curated for AI agents**, not 1:1 with the Marketing API. Smart defaults so an agent doesn't need to remember every flag.
701
696
 
702
- Account-scoped reads:
703
- ```
704
- baker ads meta account --account-id act_123 # currency, balance, business, status
705
- baker ads meta currency --account-id act_123 # lightweight currency lookup
706
- baker ads meta campaigns --account-id act_123 --effective-status ACTIVE,PAUSED
707
- baker ads meta adsets --campaign-id 6123 # all adsets in one campaign
708
- baker ads meta ads --adset-id 6123 # all ads in one adset
709
- baker ads meta creatives --account-id act_123 # list creatives
710
- baker ads meta creatives --creative-id 9988 # single creative
711
- baker ads meta images --account-id act_123 # AdImages keyed by per-account hash
712
- baker ads meta labels --account-id act_123
713
- baker ads meta audiences --account-id act_123 # custom audiences (incl. lookalikes)
714
- baker ads meta pixels --account-id act_123 # Meta Pixels
715
- baker ads meta pixels --pixel-id 9988 --stats --days 7 # firing stats
716
- baker ads meta activities --account-id act_123 --days 14 # account audit log (~90d retention)
717
- baker ads meta high-demand-periods --campaign-id 6123 # scheduled budget bumps
718
- ```
697
+ #### Common AI questions, mapped to commands
719
698
 
720
- Insights (sync + async):
721
- ```
722
- baker ads meta insights --object act_123 --level ad --fields impressions,spend,ctr --date-preset last_7d
723
- baker ads meta insights --object act_123 --preset campaign-performance
724
- baker ads meta insights --object act_123 --preset placement-breakdown --since 2026-01-01 --until 2026-03-31 --async
725
- baker ads meta insights --list-presets # list built-in presets
726
- ```
699
+ ```bash
700
+ # "How is account X doing this week?"
701
+ baker ads meta insights --object act_123
727
702
 
728
- Presets bundled: `campaign-performance`, `creative-performance`, `placement-breakdown`, `device-breakdown`, `audience-breakdown`, `funnel`, `video-performance`. All Meta-native — not parity-aligned with the Google Ads presets.
703
+ # "Which campaigns are profitable?"
704
+ baker ads meta insights --object act_123 --level campaign --intent revenue --date-preset last_28d
729
705
 
730
- Attribution windows: as of Jan 2026 only `1d_view, 1d_click, 7d_click, 28d_click` are functional. Others return empty.
706
+ # "Which creatives need a refresh?"
707
+ baker ads meta insights --object act_123 --level ad --intent ranking --date-preset last_14d
731
708
 
732
- Previews (creative review workflow):
733
- ```
734
- baker ads meta preview --creative-id 6123 --ad-format MOBILE_FEED_STANDARD
735
- baker ads meta preview --ad-id 9988 --ad-format INSTAGRAM_REELS --out-file /tmp/p.html
736
- baker ads meta preview --account-id act_123 --creative '{"object_story_spec":{...}}' --ad-format MOBILE_FEED_STANDARD
709
+ # "Where do users drop off the funnel?"
710
+ baker ads meta insights --object act_123 --intent funnel
711
+
712
+ # "Should we shift budget to Instagram?"
713
+ baker ads meta insights --object act_123 --level adset \
714
+ --breakdowns publisher_platform,platform_position
715
+
716
+ # "Why did spend drop yesterday?"
717
+ baker ads meta activities --account-id act_123 --days 7
718
+
719
+ # "What are we running right now?"
720
+ baker ads meta campaigns --account-id act_123 # ACTIVE only by default
721
+ baker ads meta ads --account-id act_123 --all-statuses # widen to everything
722
+
723
+ # "Tell me about ad 9988"
724
+ baker ads meta creatives --creative-id 9988
725
+ baker ads meta preview --creative-id 9988 --ad-format MOBILE_FEED_STANDARD --out-file /tmp/p.html
726
+
727
+ # "What audience is this targeting?"
728
+ baker ads meta audiences --account-id act_123
729
+
730
+ # "Is the pixel firing?"
731
+ baker ads meta pixels --account-id act_123
732
+ baker ads meta pixels --pixel-id 9988 --stats --days 7
737
733
  ```
738
734
 
739
- Business-scoped:
735
+ #### Smart defaults (so agents don't enumerate the API)
736
+
737
+ **`insights`** — the workhorse:
738
+ - `--level account` (override: `campaign|adset|ad`)
739
+ - `--intent baseline` field bundle. Intents available: `baseline`, `revenue`, `funnel`, `ranking`, `video`, `identity`. List with `--list-intents`.
740
+ - `--date-preset last_7d` unless you pass `--since`/`--until`.
741
+ - Filter: `impressions > 0` so undelivered rows don't pollute results. Pass `--include-undelivered` to keep them.
742
+ - Sort: `spend` descending — highest-impact rows first. `--no-sort` to disable.
743
+ - Attribution windows: `7d_click, 1d_view` (only `1d_view, 1d_click, 7d_click, 28d_click` work post Jan 2026).
744
+ - Identity columns (`campaign_name`, `ad_name`, etc.) appended automatically per `--level` so rows are self-describing.
745
+ - Auto-async when the query is heavy (level=ad with breakdowns over an account, >2 breakdowns, >90-day range). Pass `--async` to force it or `--no-async` to refuse fallback.
746
+
747
+ **Listings (`campaigns`/`adsets`/`ads`)** default to `effective_status=ACTIVE` — pass `--all-statuses` to widen, or `--effective-status ACTIVE,PAUSED` for a custom set.
748
+
749
+ **Pagination** is auto-drained (no manual cursor handling).
750
+
751
+ #### Full command surface
752
+
740
753
  ```
741
- baker ads meta studies --business-id 12345 # split tests + lift studies
742
- baker ads meta studies --study-id 99 --results
743
- baker ads meta catalogs --business-id 12345 # product catalogs (commerce DPA, hotels, etc.)
754
+ accounts # ad accounts in the connected scope
755
+ accounts --include-all # every account the token can see (admin/debug)
756
+ account # single-account detail (currency, balance, business, status)
757
+ businesses # /me/businesses
758
+ campaigns # ACTIVE-only by default
759
+ adsets # filter by --campaign-id
760
+ ads # filter by --adset-id or --campaign-id
761
+ creatives # list per account, or fetch single via --creative-id
762
+ audiences # custom audiences (incl. lookalikes)
763
+ pixels # list, or --stats for one --pixel-id
764
+ activities # account audit log, ~90d retention
765
+ insights # see "Smart defaults" above
766
+ preview # iframe HTML for a creative or ad in a given ad_format
744
767
  ```
745
768
 
746
- Notes:
747
- - Money fields differ between read and write. `spend` is a decimal string in account currency. Budget writes (not yet supported) use integer minor units, with non-uniform offsets (JPY/KRW = 1, KWD/BHD = 1000, most = 100).
748
- - `effective_status` `status`. UI should show `effective_status` (e.g. `WITH_ISSUES`, `PENDING_REVIEW`, `DISAPPROVED`, `ADSET_PAUSED`).
749
- - Account scoping: backend validates every request against the picker selection. Pick accounts via the dashboard "Meta Ads" connection settings before calling these commands.
769
+ The HTTP backend exposes more endpoints (catalogs, ad-studies, ad-images, labels, high-demand-periods, raw currency lookup). They're intentionally not surfaced as CLI commands because AI agents rarely need them. Hit them via curl against `/api/ads/meta/*` if needed.
770
+
771
+ #### Auth + caching
772
+
750
773
  - Tokens auto-refresh server-side (60-day rolling long-lived user tokens). On `code 190` reconnect Meta from the dashboard.
774
+ - Account scoping: backend rejects any call against an account not in the picker selection — pick accounts via Settings → Connections → Meta Ads first.
775
+ - All cached actions are keyed per company; two companies that connect to the same Meta account never share cache entries.
776
+ - `--skip-cache` on any command forces a re-fetch.
777
+
778
+ #### Notes / gotchas
779
+
780
+ - `spend` is a decimal string in account currency, not an integer.
781
+ - `effective_status` ≠ `status`. The dashboard shows effective_status (e.g. `WITH_ISSUES`, `PENDING_REVIEW`, `DISAPPROVED`, `ADSET_PAUSED`).
782
+ - Meta creatives are effectively immutable once attached. Editing copy/image/CTA = create a new creative + reattach (writes are out of scope for now).
783
+ - Currency offsets are non-uniform (JPY/KRW = 1, KWD/BHD = 1000, most = 100). Read `account.currency` before doing budget math.
751
784
 
752
785
  ---
753
786
 
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import { videosCommand } from "./commands/videos/index.js";
12
12
  const main = defineCommand({
13
13
  meta: {
14
14
  name: "baker",
15
- version: "0.24.0",
15
+ version: "0.25.0",
16
16
  description: `AI-agent CLI for finding and managing images, videos, testimonials, action items, and ad platform data in Baker.
17
17
 
18
18
  Auth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.
@@ -13,7 +13,11 @@ export declare const adsListCommand: import("citty").CommandDef<{
13
13
  };
14
14
  readonly "effective-status": {
15
15
  readonly type: "string";
16
- readonly description: "Comma-separated effective_status filter";
16
+ readonly description: "Comma-separated effective_status filter (overrides default)";
17
+ };
18
+ readonly "all-statuses": {
19
+ readonly type: "boolean";
20
+ readonly description: "Drop the default ACTIVE filter";
17
21
  };
18
22
  readonly limit: {
19
23
  readonly type: "string";
@@ -1 +1 @@
1
- {"version":3,"file":"ads.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/ads.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CzB,CAAC"}
1
+ {"version":3,"file":"ads.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/ads.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CzB,CAAC"}
@@ -1,39 +1,42 @@
1
1
  import { defineCommand } from "citty";
2
2
  import { apiGet } from "../../../client.js";
3
3
  import { writeAdsJson, writeAdsOutput } from "../output.js";
4
- import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
4
+ import { csvOrJson, handleMetaError, resolveAccountIdArg, resolveEffectiveStatus } from "./shared.js";
5
5
  export const adsListCommand = defineCommand({
6
6
  meta: {
7
7
  name: "ads",
8
- description: `List ads in a Meta ad account, optionally scoped by adset or campaign.
8
+ description: `List ads in a Meta ad account. Defaults to ACTIVE only pass --all-statuses to widen.
9
9
 
10
10
  The dashboard shows effective_status (e.g. WITH_ISSUES, PENDING_REVIEW, DISAPPROVED, ADSET_PAUSED), not status.
11
- preview_shareable_link returns a Meta-hosted URL useful for design review.
11
+ preview_shareable_link returns a Meta-hosted URL useful for design review without calling generatepreviews.
12
12
 
13
13
  Examples:
14
14
  baker ads meta ads --account-id act_123
15
- baker ads meta ads --adset-id 6123 --effective-status ACTIVE
16
- baker ads meta ads --campaign-id 6123 --output csv`,
15
+ baker ads meta ads --adset-id 6123
16
+ baker ads meta ads --campaign-id 6123 --all-statuses
17
+ baker ads meta ads --account-id act_123 --output csv`,
17
18
  },
18
19
  args: {
19
20
  "account-id": { type: "string", description: "Meta ad account ID" },
20
21
  "adset-id": { type: "string", description: "Filter to one adset" },
21
22
  "campaign-id": { type: "string", description: "Filter to one campaign" },
22
- "effective-status": { type: "string", description: "Comma-separated effective_status filter" },
23
+ "effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
24
+ "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
23
25
  limit: { type: "string", description: "Max rows (default 1000)" },
24
26
  "skip-cache": { type: "boolean", description: "Bypass server-side cache" },
25
27
  output: { type: "string", description: "Output format", default: "json" },
26
28
  },
27
29
  run: async ({ args }) => {
28
30
  const accountId = resolveAccountIdArg(args);
31
+ const effectiveStatus = resolveEffectiveStatus(args);
29
32
  try {
30
33
  const params = { "account-id": accountId };
31
34
  if (args["adset-id"])
32
35
  params["adset-id"] = args["adset-id"];
33
36
  if (args["campaign-id"])
34
37
  params["campaign-id"] = args["campaign-id"];
35
- if (args["effective-status"])
36
- params["effective-status"] = args["effective-status"];
38
+ if (effectiveStatus)
39
+ params["effective-status"] = effectiveStatus;
37
40
  if (args.limit)
38
41
  params.limit = args.limit;
39
42
  if (args["skip-cache"])
@@ -1 +1 @@
1
- {"version":3,"file":"ads.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/ads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;IAC1C,IAAI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AAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -9,7 +9,11 @@ export declare const adsetsCommand: import("citty").CommandDef<{
9
9
  };
10
10
  readonly "effective-status": {
11
11
  readonly type: "string";
12
- readonly description: "Comma-separated effective_status filter";
12
+ readonly description: "Comma-separated effective_status filter (overrides default)";
13
+ };
14
+ readonly "all-statuses": {
15
+ readonly type: "boolean";
16
+ readonly description: "Drop the default ACTIVE filter";
13
17
  };
14
18
  readonly limit: {
15
19
  readonly type: "string";
@@ -1 +1 @@
1
- {"version":3,"file":"adsets.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/adsets.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCxB,CAAC"}
1
+ {"version":3,"file":"adsets.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/adsets.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCxB,CAAC"}
@@ -1,32 +1,35 @@
1
1
  import { defineCommand } from "citty";
2
2
  import { apiGet } from "../../../client.js";
3
3
  import { writeAdsJson, writeAdsOutput } from "../output.js";
4
- import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
4
+ import { csvOrJson, handleMetaError, resolveAccountIdArg, resolveEffectiveStatus } from "./shared.js";
5
5
  export const adsetsCommand = defineCommand({
6
6
  meta: {
7
7
  name: "adsets",
8
- description: `List ad sets in a Meta ad account, optionally scoped to one campaign.
8
+ description: `List ad sets in a Meta ad account, optionally scoped to one campaign. Defaults to ACTIVE only.
9
9
 
10
10
  Examples:
11
11
  baker ads meta adsets --account-id act_123
12
- baker ads meta adsets --campaign-id 6123456789 --effective-status ACTIVE`,
12
+ baker ads meta adsets --campaign-id 6123456789
13
+ baker ads meta adsets --campaign-id 6123 --all-statuses`,
13
14
  },
14
15
  args: {
15
16
  "account-id": { type: "string", description: "Meta ad account ID" },
16
17
  "campaign-id": { type: "string", description: "Filter to one campaign" },
17
- "effective-status": { type: "string", description: "Comma-separated effective_status filter" },
18
+ "effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
19
+ "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
18
20
  limit: { type: "string", description: "Max rows (default 1000)" },
19
21
  "skip-cache": { type: "boolean", description: "Bypass server-side cache" },
20
22
  output: { type: "string", description: "Output format", default: "json" },
21
23
  },
22
24
  run: async ({ args }) => {
23
25
  const accountId = resolveAccountIdArg(args);
26
+ const effectiveStatus = resolveEffectiveStatus(args);
24
27
  try {
25
28
  const params = { "account-id": accountId };
26
29
  if (args["campaign-id"])
27
30
  params["campaign-id"] = args["campaign-id"];
28
- if (args["effective-status"])
29
- params["effective-status"] = args["effective-status"];
31
+ if (effectiveStatus)
32
+ params["effective-status"] = effectiveStatus;
30
33
  if (args.limit)
31
34
  params.limit = args.limit;
32
35
  if (args["skip-cache"])
@@ -1 +1 @@
1
- {"version":3,"file":"adsets.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/adsets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,M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,CAAC"}
@@ -5,7 +5,11 @@ export declare const campaignsCommand: import("citty").CommandDef<{
5
5
  };
6
6
  readonly "effective-status": {
7
7
  readonly type: "string";
8
- readonly description: "Comma-separated effective_status filter";
8
+ readonly description: "Comma-separated effective_status filter (overrides default)";
9
+ };
10
+ readonly "all-statuses": {
11
+ readonly type: "boolean";
12
+ readonly description: "Drop the default ACTIVE filter and return everything";
9
13
  };
10
14
  readonly limit: {
11
15
  readonly type: "string";
@@ -1 +1 @@
1
- {"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/campaigns.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAsC3B,CAAC"}
1
+ {"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/campaigns.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;EAyC3B,CAAC"}
@@ -1,33 +1,36 @@
1
1
  import { defineCommand } from "citty";
2
2
  import { apiGet } from "../../../client.js";
3
3
  import { writeAdsJson, writeAdsOutput } from "../output.js";
4
- import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
4
+ import { csvOrJson, handleMetaError, resolveAccountIdArg, resolveEffectiveStatus } from "./shared.js";
5
5
  export const campaignsCommand = defineCommand({
6
6
  meta: {
7
7
  name: "campaigns",
8
- description: `List campaigns for a Meta ad account.
8
+ description: `List campaigns for a Meta ad account. Defaults to ACTIVE only — pass --all-statuses to widen.
9
9
 
10
- Note: in Meta's API, "campaign" is what we'd call a campaign group. Status uses effective_status (filterable),
11
- which can be ACTIVE, PAUSED, DELETED, ARCHIVED, IN_PROCESS, WITH_ISSUES, etc.
10
+ In Meta's API "campaign" is the top-of-tree object (what marketers usually call a campaign group).
11
+ The dashboard shows effective_status: ACTIVE, PAUSED, DELETED, ARCHIVED, IN_PROCESS, WITH_ISSUES, etc.
12
12
 
13
13
  Examples:
14
- baker ads meta campaigns --account-id act_123
15
- baker ads meta campaigns --account-id act_123 --effective-status ACTIVE,PAUSED
14
+ baker ads meta campaigns --account-id act_123 # ACTIVE only
15
+ baker ads meta campaigns --account-id act_123 --all-statuses # everything
16
+ baker ads meta campaigns --account-id act_123 --effective-status ACTIVE,PAUSED # custom set
16
17
  baker ads meta campaigns --account-id act_123 --output csv`,
17
18
  },
18
19
  args: {
19
20
  "account-id": { type: "string", description: "Meta ad account ID" },
20
- "effective-status": { type: "string", description: "Comma-separated effective_status filter" },
21
+ "effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
22
+ "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter and return everything" },
21
23
  limit: { type: "string", description: "Max rows (default 1000)" },
22
24
  "skip-cache": { type: "boolean", description: "Bypass server-side cache" },
23
25
  output: { type: "string", description: "Output format", default: "json" },
24
26
  },
25
27
  run: async ({ args }) => {
26
28
  const accountId = resolveAccountIdArg(args);
29
+ const effectiveStatus = resolveEffectiveStatus(args);
27
30
  try {
28
31
  const params = { "account-id": accountId };
29
- if (args["effective-status"])
30
- params["effective-status"] = args["effective-status"];
32
+ if (effectiveStatus)
33
+ params["effective-status"] = effectiveStatus;
31
34
  if (args.limit)
32
35
  params.limit = args.limit;
33
36
  if (args["skip-cache"])
@@ -1 +1 @@
1
- {"version":3,"file":"campaigns.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/campaigns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;IAC5C,IAAI,EAAE;QACJ,IAAI,E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CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,eAAe,GAAG,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;YACnE,IAAI,eAAe;gBAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,eAAe,CAAC;YAClE,IAAI,IAAI,CAAC,KAAK;gBAAE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAe,CAAC;YACpD,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAiC,yBAAyB,EAAE,MAAM,CAAC,CAAC;YAC7F,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -1,2 +1,17 @@
1
+ /**
2
+ * Meta Ads command surface — curated for AI agents, not 1:1 with the Marketing API.
3
+ *
4
+ * The HTTP backend exposes more endpoints (catalogs, studies, ad-images, labels,
5
+ * high-demand-periods, currency lookup). They're intentionally not surfaced as
6
+ * CLI commands because AI agents rarely need them in isolation. Hit them via
7
+ * curl against the API if you need them.
8
+ *
9
+ * Default behaviors that matter:
10
+ * - Listings (campaigns/adsets/ads) filter to ACTIVE — pass --all-statuses to widen.
11
+ * - Insights filter out non-delivered rows (impressions=0) and sort by spend desc.
12
+ * - Insights pick a smart field bundle via --intent (baseline|revenue|funnel|ranking|video|identity).
13
+ * - Heavy insights queries auto-fall to async (poll loop hidden).
14
+ * - Attribution defaults to 7d_click,1d_view — the only windows still working as of Jan 2026.
15
+ */
1
16
  export declare const metaCommand: import("citty").CommandDef<import("citty").ArgsDef>;
2
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/index.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,WAAW,qDAuDtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/index.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,qDAiDtB,CAAC"}
@@ -7,67 +7,70 @@ import { adsetsCommand } from "./adsets.js";
7
7
  import { audiencesCommand } from "./audiences.js";
8
8
  import { businessesCommand } from "./businesses.js";
9
9
  import { campaignsCommand } from "./campaigns.js";
10
- import { catalogsCommand } from "./catalogs.js";
11
10
  import { creativesCommand } from "./creatives.js";
12
- import { currencyCommand } from "./currency.js";
13
- import { highDemandPeriodsCommand } from "./high-demand-periods.js";
14
- import { imagesCommand } from "./images.js";
15
11
  import { insightsCommand } from "./insights.js";
16
- import { labelsCommand } from "./labels.js";
17
12
  import { pixelsCommand } from "./pixels.js";
18
13
  import { previewCommand } from "./preview.js";
19
- import { studiesCommand } from "./studies.js";
14
+ /**
15
+ * Meta Ads command surface — curated for AI agents, not 1:1 with the Marketing API.
16
+ *
17
+ * The HTTP backend exposes more endpoints (catalogs, studies, ad-images, labels,
18
+ * high-demand-periods, currency lookup). They're intentionally not surfaced as
19
+ * CLI commands because AI agents rarely need them in isolation. Hit them via
20
+ * curl against the API if you need them.
21
+ *
22
+ * Default behaviors that matter:
23
+ * - Listings (campaigns/adsets/ads) filter to ACTIVE — pass --all-statuses to widen.
24
+ * - Insights filter out non-delivered rows (impressions=0) and sort by spend desc.
25
+ * - Insights pick a smart field bundle via --intent (baseline|revenue|funnel|ranking|video|identity).
26
+ * - Heavy insights queries auto-fall to async (poll loop hidden).
27
+ * - Attribution defaults to 7d_click,1d_view — the only windows still working as of Jan 2026.
28
+ */
20
29
  export const metaCommand = defineCommand({
21
30
  meta: {
22
31
  name: "meta",
23
- description: `Meta Marketing API (Facebook + Instagram ads).
32
+ description: `Meta Marketing API — AI-first command surface (Facebook + Instagram ads).
24
33
 
25
34
  Discovery:
26
35
  baker ads meta accounts — accounts in this company's connected scope
27
36
  baker ads meta accounts --include-all — every account the token can see
28
37
  baker ads meta businesses — Business Manager IDs
29
38
 
30
- Account-scoped:
31
- baker ads meta account --account-id act_123
32
- baker ads meta currency --account-id act_123
33
- baker ads meta campaigns --account-id act_123 --effective-status ACTIVE
39
+ Snapshot a running account (default = ACTIVE only):
40
+ baker ads meta campaigns --account-id act_123
34
41
  baker ads meta adsets --campaign-id 6123
35
- baker ads meta ads --account-id act_123 --effective-status ACTIVE
36
- baker ads meta creatives --account-id act_123
37
- baker ads meta images --account-id act_123
38
- baker ads meta labels --account-id act_123
39
- baker ads meta audiences --account-id act_123
40
- baker ads meta pixels --account-id act_123
41
- baker ads meta activities --account-id act_123 --days 14
42
+ baker ads meta ads --adset-id 6123
43
+ baker ads meta campaigns --account-id act_123 --all-statuses — include paused, archived
42
44
 
43
- Insights + previews:
44
- baker ads meta insights --object act_123 --preset campaign-performance
45
- baker ads meta insights --object act_123 --preset placement-breakdown --async
46
- baker ads meta preview --creative-id 6123 --ad-format MOBILE_FEED_STANDARD --out-file /tmp/p.html
45
+ Drill in:
46
+ baker ads meta account --account-id act_123 currency, balance, business
47
+ baker ads meta creatives --creative-id 9988 — single creative detail
48
+ baker ads meta audiences --account-id act_123
49
+ baker ads meta pixels --account-id act_123 — pixel list
50
+ baker ads meta pixels --pixel-id 9988 --stats --days 7 — firing health
47
51
 
48
- Business-scoped:
49
- baker ads meta studies --business-id 12345
50
- baker ads meta catalogs --business-id 12345
52
+ Performance (the workhorse):
53
+ baker ads meta insights --object act_123 — defaults: level=account, intent=baseline, last_7d
54
+ baker ads meta insights --object act_123 --intent revenue --date-preset last_28d
55
+ baker ads meta insights --object act_123 --level ad --intent ranking — flag creatives to refresh
56
+ baker ads meta insights --object act_123 --level adset --breakdowns publisher_platform,age — placement × age
57
+ baker ads meta insights --object act_123 --level ad --since 2026-01-01 --until 2026-03-31 — auto-async
58
+ baker ads meta insights --list-presets
51
59
 
52
- Other:
53
- baker ads meta high-demand-periods --campaign-id 6123`,
60
+ Audit & review:
61
+ baker ads meta activities --account-id act_123 --days 14
62
+ baker ads meta preview --creative-id 9988 --ad-format MOBILE_FEED_STANDARD --out-file /tmp/p.html`,
54
63
  },
55
64
  subCommands: {
56
65
  accounts: accountsCommand,
57
66
  account: accountCommand,
58
- currency: currencyCommand,
59
67
  businesses: businessesCommand,
60
68
  campaigns: campaignsCommand,
61
69
  adsets: adsetsCommand,
62
70
  ads: adsListCommand,
63
71
  creatives: creativesCommand,
64
- images: imagesCommand,
65
- labels: labelsCommand,
66
72
  audiences: audiencesCommand,
67
73
  pixels: pixelsCommand,
68
- studies: studiesCommand,
69
- catalogs: catalogsCommand,
70
- "high-demand-periods": highDemandPeriodsCommand,
71
74
  activities: activitiesCommand,
72
75
  insights: insightsCommand,
73
76
  preview: previewCommand,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,C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7B,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;KACxB;CACF,CAAC,CAAC"}
@@ -1,24 +1,24 @@
1
1
  export declare const insightsCommand: import("citty").CommandDef<{
2
2
  readonly object: {
3
3
  readonly type: "string";
4
- readonly description: "Object ID — act_<id> for account, or campaign/adset/ad ID";
4
+ readonly description: "Object ID — act_<id> for account, or a campaign/adset/ad ID";
5
5
  readonly required: true;
6
6
  };
7
7
  readonly level: {
8
8
  readonly type: "string";
9
- readonly description: "account|campaign|adset|ad";
9
+ readonly description: "account|campaign|adset|ad (default: account)";
10
10
  };
11
- readonly fields: {
11
+ readonly intent: {
12
12
  readonly type: "string";
13
- readonly description: "Comma-separated fields list";
13
+ readonly description: "baseline|revenue|funnel|ranking|video|identity (default: baseline)";
14
14
  };
15
- readonly preset: {
15
+ readonly fields: {
16
16
  readonly type: "string";
17
- readonly description: "Insights preset name";
17
+ readonly description: "Comma-separated field list (overrides --intent bundle)";
18
18
  };
19
- readonly "list-presets": {
19
+ readonly "list-intents": {
20
20
  readonly type: "boolean";
21
- readonly description: "List available presets and exit";
21
+ readonly description: "Print available intents and exit";
22
22
  };
23
23
  readonly "date-preset": {
24
24
  readonly type: "string";
@@ -38,19 +38,23 @@ export declare const insightsCommand: import("citty").CommandDef<{
38
38
  };
39
39
  readonly breakdowns: {
40
40
  readonly type: "string";
41
- readonly description: "Comma-separated breakdowns";
41
+ readonly description: "Comma-separated breakdowns (e.g. publisher_platform,age)";
42
42
  };
43
43
  readonly "action-breakdowns": {
44
44
  readonly type: "string";
45
- readonly description: "Comma-separated action_breakdowns";
45
+ readonly description: "Slice the actions[] array (default: action_type for revenue/funnel)";
46
46
  };
47
47
  readonly filtering: {
48
48
  readonly type: "string";
49
- readonly description: "JSON array of {field,operator,value}";
49
+ readonly description: "Override default filter — JSON array of {field,operator,value}";
50
+ };
51
+ readonly "include-undelivered": {
52
+ readonly type: "boolean";
53
+ readonly description: "Keep rows where impressions=0 (off by default)";
50
54
  };
51
55
  readonly "attribution-windows": {
52
56
  readonly type: "string";
53
- readonly description: "Comma-separated. Only 1d_view, 1d_click, 7d_click, 28d_click work as of Jan 2026";
57
+ readonly description: "Override default 7d_click,1d_view (only 1d_view, 1d_click, 7d_click, 28d_click work post Jan 2026)";
54
58
  };
55
59
  readonly "use-account-attribution": {
56
60
  readonly type: "boolean";
@@ -62,11 +66,19 @@ export declare const insightsCommand: import("citty").CommandDef<{
62
66
  };
63
67
  readonly limit: {
64
68
  readonly type: "string";
65
- readonly description: "Max rows (default per preset)";
69
+ readonly description: "Max rows (default 1000)";
66
70
  };
67
71
  readonly async: {
68
72
  readonly type: "boolean";
69
- readonly description: "Submit as async job, poll, then dump results";
73
+ readonly description: "Force async submit-and-poll path";
74
+ };
75
+ readonly "no-async": {
76
+ readonly type: "boolean";
77
+ readonly description: "Refuse the auto-async fallback for heavy queries";
78
+ };
79
+ readonly "no-sort": {
80
+ readonly type: "boolean";
81
+ readonly description: "Skip default spend-desc sort";
70
82
  };
71
83
  readonly "skip-cache": {
72
84
  readonly type: "boolean";
@@ -1 +1 @@
1
- {"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/insights.ts"],"names":[],"mappings":"AAqHA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2F1B,CAAC"}
1
+ {"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/insights.ts"],"names":[],"mappings":"AAwLA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiG1B,CAAC"}