@koda-sl/baker-cli 0.25.0-dev.f89d9a60 → 0.25.1
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 +78 -55
- package/dist/cli.js +1 -1
- package/dist/commands/ads/index.d.ts.map +1 -1
- package/dist/commands/ads/index.js +8 -7
- package/dist/commands/ads/index.js.map +1 -1
- package/dist/commands/ads/meta/account.d.ts +11 -0
- package/dist/commands/ads/meta/account.d.ts.map +1 -0
- package/dist/commands/ads/meta/account.js +32 -0
- package/dist/commands/ads/meta/account.js.map +1 -0
- package/dist/commands/ads/meta/accounts.d.ts +20 -0
- package/dist/commands/ads/meta/accounts.d.ts.map +1 -0
- package/dist/commands/ads/meta/accounts.js +55 -0
- package/dist/commands/ads/meta/accounts.js.map +1 -0
- package/dist/commands/ads/meta/activities.d.ts +24 -0
- package/dist/commands/ads/meta/activities.d.ts.map +1 -0
- package/dist/commands/ads/meta/activities.js +44 -0
- package/dist/commands/ads/meta/activities.js.map +1 -0
- package/dist/commands/ads/meta/ads.d.ts +36 -0
- package/dist/commands/ads/meta/ads.d.ts.map +1 -0
- package/dist/commands/ads/meta/ads.js +57 -0
- package/dist/commands/ads/meta/ads.js.map +1 -0
- package/dist/commands/ads/meta/adsets.d.ts +32 -0
- package/dist/commands/ads/meta/adsets.d.ts.map +1 -0
- package/dist/commands/ads/meta/adsets.js +50 -0
- package/dist/commands/ads/meta/adsets.js.map +1 -0
- package/dist/commands/ads/meta/audiences.d.ts +20 -0
- package/dist/commands/ads/meta/audiences.d.ts.map +1 -0
- package/dist/commands/ads/meta/audiences.js +41 -0
- package/dist/commands/ads/meta/audiences.js.map +1 -0
- package/dist/commands/ads/meta/businesses.d.ts +12 -0
- package/dist/commands/ads/meta/businesses.d.ts.map +1 -0
- package/dist/commands/ads/meta/businesses.js +35 -0
- package/dist/commands/ads/meta/businesses.js.map +1 -0
- package/dist/commands/ads/meta/campaigns.d.ts +28 -0
- package/dist/commands/ads/meta/campaigns.d.ts.map +1 -0
- package/dist/commands/ads/meta/campaigns.js +51 -0
- package/dist/commands/ads/meta/campaigns.js.map +1 -0
- package/dist/commands/ads/meta/creatives.d.ts +24 -0
- package/dist/commands/ads/meta/creatives.d.ts.map +1 -0
- package/dist/commands/ads/meta/creatives.js +51 -0
- package/dist/commands/ads/meta/creatives.js.map +1 -0
- package/dist/commands/ads/meta/index.d.ts +17 -0
- package/dist/commands/ads/meta/index.d.ts.map +1 -0
- package/dist/commands/ads/meta/index.js +79 -0
- package/dist/commands/ads/meta/index.js.map +1 -0
- package/dist/commands/ads/meta/insights.d.ts +92 -0
- package/dist/commands/ads/meta/insights.d.ts.map +1 -0
- package/dist/commands/ads/meta/insights.js +260 -0
- package/dist/commands/ads/meta/insights.js.map +1 -0
- package/dist/commands/ads/meta/pixels.d.ts +33 -0
- package/dist/commands/ads/meta/pixels.d.ts.map +1 -0
- package/dist/commands/ads/meta/pixels.js +76 -0
- package/dist/commands/ads/meta/pixels.js.map +1 -0
- package/dist/commands/ads/meta/presets.d.ts +30 -0
- package/dist/commands/ads/meta/presets.d.ts.map +1 -0
- package/dist/commands/ads/meta/presets.js +86 -0
- package/dist/commands/ads/meta/presets.js.map +1 -0
- package/dist/commands/ads/meta/preview.d.ts +32 -0
- package/dist/commands/ads/meta/preview.d.ts.map +1 -0
- package/dist/commands/ads/meta/preview.js +90 -0
- package/dist/commands/ads/meta/preview.js.map +1 -0
- package/dist/commands/ads/meta/shared.d.ts +18 -0
- package/dist/commands/ads/meta/shared.d.ts.map +1 -0
- package/dist/commands/ads/meta/shared.js +86 -0
- package/dist/commands/ads/meta/shared.js.map +1 -0
- package/dist/env.d.ts +1 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +1 -4
- package/dist/env.js.map +1 -1
- package/dist/error-handler.d.ts +1 -1
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +3 -3
- package/dist/error-handler.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/ads/x/accounts.d.ts +0 -14
- package/dist/commands/ads/x/accounts.d.ts.map +0 -1
- package/dist/commands/ads/x/accounts.js +0 -73
- package/dist/commands/ads/x/accounts.js.map +0 -1
- package/dist/commands/ads/x/active-entities.d.ts +0 -43
- package/dist/commands/ads/x/active-entities.d.ts.map +0 -1
- package/dist/commands/ads/x/active-entities.js +0 -88
- package/dist/commands/ads/x/active-entities.js.map +0 -1
- package/dist/commands/ads/x/audiences.d.ts +0 -19
- package/dist/commands/ads/x/audiences.d.ts.map +0 -1
- package/dist/commands/ads/x/audiences.js +0 -65
- package/dist/commands/ads/x/audiences.js.map +0 -1
- package/dist/commands/ads/x/campaigns.d.ts +0 -34
- package/dist/commands/ads/x/campaigns.d.ts.map +0 -1
- package/dist/commands/ads/x/campaigns.js +0 -56
- package/dist/commands/ads/x/campaigns.js.map +0 -1
- package/dist/commands/ads/x/cards.d.ts +0 -19
- package/dist/commands/ads/x/cards.d.ts.map +0 -1
- package/dist/commands/ads/x/cards.js +0 -65
- package/dist/commands/ads/x/cards.js.map +0 -1
- package/dist/commands/ads/x/error-parser.d.ts +0 -3
- package/dist/commands/ads/x/error-parser.d.ts.map +0 -1
- package/dist/commands/ads/x/error-parser.js +0 -80
- package/dist/commands/ads/x/error-parser.js.map +0 -1
- package/dist/commands/ads/x/funding.d.ts +0 -19
- package/dist/commands/ads/x/funding.d.ts.map +0 -1
- package/dist/commands/ads/x/funding.js +0 -65
- package/dist/commands/ads/x/funding.js.map +0 -1
- package/dist/commands/ads/x/index.d.ts +0 -2
- package/dist/commands/ads/x/index.d.ts.map +0 -1
- package/dist/commands/ads/x/index.js +0 -50
- package/dist/commands/ads/x/index.js.map +0 -1
- package/dist/commands/ads/x/line-items.d.ts +0 -34
- package/dist/commands/ads/x/line-items.d.ts.map +0 -1
- package/dist/commands/ads/x/line-items.js +0 -55
- package/dist/commands/ads/x/line-items.js.map +0 -1
- package/dist/commands/ads/x/media.d.ts +0 -24
- package/dist/commands/ads/x/media.d.ts.map +0 -1
- package/dist/commands/ads/x/media.js +0 -70
- package/dist/commands/ads/x/media.js.map +0 -1
- package/dist/commands/ads/x/output.d.ts +0 -13
- package/dist/commands/ads/x/output.d.ts.map +0 -1
- package/dist/commands/ads/x/output.js +0 -75
- package/dist/commands/ads/x/output.js.map +0 -1
- package/dist/commands/ads/x/presets.d.ts +0 -15
- package/dist/commands/ads/x/presets.d.ts.map +0 -1
- package/dist/commands/ads/x/presets.js +0 -60
- package/dist/commands/ads/x/presets.js.map +0 -1
- package/dist/commands/ads/x/promoted-tweets.d.ts +0 -29
- package/dist/commands/ads/x/promoted-tweets.d.ts.map +0 -1
- package/dist/commands/ads/x/promoted-tweets.js +0 -74
- package/dist/commands/ads/x/promoted-tweets.js.map +0 -1
- package/dist/commands/ads/x/run-list.d.ts +0 -17
- package/dist/commands/ads/x/run-list.d.ts.map +0 -1
- package/dist/commands/ads/x/run-list.js +0 -60
- package/dist/commands/ads/x/run-list.js.map +0 -1
- package/dist/commands/ads/x/stats/index.d.ts +0 -2
- package/dist/commands/ads/x/stats/index.d.ts.map +0 -1
- package/dist/commands/ads/x/stats/index.js +0 -32
- package/dist/commands/ads/x/stats/index.js.map +0 -1
- package/dist/commands/ads/x/stats/job-create.d.ts +0 -58
- package/dist/commands/ads/x/stats/job-create.d.ts.map +0 -1
- package/dist/commands/ads/x/stats/job-create.js +0 -95
- package/dist/commands/ads/x/stats/job-create.js.map +0 -1
- package/dist/commands/ads/x/stats/job-status.d.ts +0 -18
- package/dist/commands/ads/x/stats/job-status.d.ts.map +0 -1
- package/dist/commands/ads/x/stats/job-status.js +0 -58
- package/dist/commands/ads/x/stats/job-status.js.map +0 -1
- package/dist/commands/ads/x/stats/job.d.ts +0 -63
- package/dist/commands/ads/x/stats/job.d.ts.map +0 -1
- package/dist/commands/ads/x/stats/job.js +0 -183
- package/dist/commands/ads/x/stats/job.js.map +0 -1
- package/dist/commands/ads/x/stats/sync.d.ts +0 -73
- package/dist/commands/ads/x/stats/sync.d.ts.map +0 -1
- package/dist/commands/ads/x/stats/sync.js +0 -151
- package/dist/commands/ads/x/stats/sync.js.map +0 -1
- package/dist/commands/ads/x/targeting-constants.d.ts +0 -34
- package/dist/commands/ads/x/targeting-constants.d.ts.map +0 -1
- package/dist/commands/ads/x/targeting-constants.js +0 -80
- package/dist/commands/ads/x/targeting-constants.js.map +0 -1
- package/dist/commands/ads/x/targeting-criteria.d.ts +0 -24
- package/dist/commands/ads/x/targeting-criteria.d.ts.map +0 -1
- package/dist/commands/ads/x/targeting-criteria.js +0 -69
- package/dist/commands/ads/x/targeting-criteria.js.map +0 -1
package/README.md
CHANGED
|
@@ -27,9 +27,6 @@ export BAKER_GA4_PROPERTY_ID="properties/123456789"
|
|
|
27
27
|
# Optional: default GSC site URL
|
|
28
28
|
export BAKER_GSC_SITE_URL="https://example.com/"
|
|
29
29
|
|
|
30
|
-
# Optional: default X Ads account ID (base36)
|
|
31
|
-
export BAKER_X_ADS_ACCOUNT_ID="18ce53xyz"
|
|
32
|
-
|
|
33
30
|
# Required for `baker actions ...` commands that stage against a chat
|
|
34
31
|
export BAKER_CHAT_ID="<chat-id>"
|
|
35
32
|
```
|
|
@@ -39,7 +36,6 @@ export BAKER_CHAT_ID="<chat-id>"
|
|
|
39
36
|
- `BAKER_GOOGLE_ADS_CUSTOMER_ID` — default Google Ads customer ID (10 digits). Used when `--customer-id` is not passed. If neither is set and the account has exactly one Google Ads customer, it is auto-selected.
|
|
40
37
|
- `BAKER_GA4_PROPERTY_ID` — default GA4 property ID. Used when `--property-id` is not passed. If neither is set and exactly one property is connected, it is auto-selected.
|
|
41
38
|
- `BAKER_GSC_SITE_URL` — default GSC site URL. Used when `--site-url` is not passed. If neither is set and exactly one site is verified, it is auto-selected.
|
|
42
|
-
- `BAKER_X_ADS_ACCOUNT_ID` — default X Ads account ID (base36). Used when `--account-id` is not passed. If neither is set and exactly one X Ads account is connected, it is auto-selected.
|
|
43
39
|
|
|
44
40
|
## Output Format
|
|
45
41
|
|
|
@@ -692,72 +688,99 @@ All errors include a `fix` object with `action`, `correctedCommand` (when applic
|
|
|
692
688
|
|
|
693
689
|
---
|
|
694
690
|
|
|
695
|
-
###
|
|
691
|
+
### Meta Ads (`baker ads meta`)
|
|
692
|
+
|
|
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.
|
|
696
694
|
|
|
697
|
-
|
|
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.
|
|
698
696
|
|
|
699
|
-
|
|
700
|
-
- `BAKER_X_ADS_ACCOUNT_ID` — default account ID (base36). Used when `--account-id` is not passed. If neither is set and exactly one X Ads account is connected, it's auto-selected.
|
|
697
|
+
#### Common AI questions, mapped to commands
|
|
701
698
|
|
|
702
|
-
|
|
699
|
+
```bash
|
|
700
|
+
# "How is account X doing this week?"
|
|
701
|
+
baker ads meta insights --object act_123
|
|
703
702
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
| `accounts` | All accessible X Ads accounts |
|
|
707
|
-
| `funding` | Funding instruments for an account |
|
|
708
|
-
| `campaigns` | Campaigns (filter by `--funding-instrument-ids`, `--campaign-ids`) |
|
|
709
|
-
| `line-items` | Line items / ad groups (filter by `--campaign-ids`, `--line-item-ids`) |
|
|
710
|
-
| `promoted-tweets` | Promoted tweets (filter by `--line-item-ids`) |
|
|
711
|
-
| `cards` | Website cards, video cards, carousels |
|
|
712
|
-
| `media` | Media library (images / GIFs / videos) — `--media-type IMAGE\|GIF\|VIDEO` |
|
|
713
|
-
| `audiences` | Custom audiences (size, targetable status) |
|
|
714
|
-
| `targeting-criteria` | Targeting attached to line items |
|
|
715
|
-
| `targeting-constants` | Lookup locations / interests / events / devices etc. — `--constant <name> --q "Madrid"` |
|
|
716
|
-
| `active-entities` | Entities with metric activity in a time range |
|
|
717
|
-
| `stats sync` | Synchronous analytics (≤7 days, no segmentation) |
|
|
718
|
-
| `stats job` | Async stats end-to-end (creates + polls + downloads + decompresses). Must run in the background (the harness enforces this). Use for ranges >7 days, segmented stats, or when sync limits are hit. |
|
|
719
|
-
| `stats job-create` | Low-level: create async stats job, return ID immediately |
|
|
720
|
-
| `stats job-status` | Low-level: poll job status / get download URL |
|
|
703
|
+
# "Which campaigns are profitable?"
|
|
704
|
+
baker ads meta insights --object act_123 --level campaign --intent revenue --date-preset last_28d
|
|
721
705
|
|
|
722
|
-
|
|
706
|
+
# "Which creatives need a refresh?"
|
|
707
|
+
baker ads meta insights --object act_123 --level ad --intent ranking --date-preset last_14d
|
|
723
708
|
|
|
724
|
-
|
|
725
|
-
baker ads
|
|
726
|
-
baker ads x campaigns --account-id 18ce53xyz
|
|
727
|
-
baker ads x line-items --account-id 18ce53xyz --campaign-ids abc
|
|
728
|
-
baker ads x promoted-tweets --account-id 18ce53xyz
|
|
709
|
+
# "Where do users drop off the funnel?"
|
|
710
|
+
baker ads meta insights --object act_123 --intent funnel
|
|
729
711
|
|
|
730
|
-
#
|
|
731
|
-
baker ads
|
|
712
|
+
# "Should we shift budget to Instagram?"
|
|
713
|
+
baker ads meta insights --object act_123 --level adset \
|
|
714
|
+
--breakdowns publisher_platform,platform_position
|
|
732
715
|
|
|
733
|
-
#
|
|
734
|
-
baker ads
|
|
735
|
-
--entity-ids abc,def --start-time 2026-05-01T00:00:00Z --end-time 2026-05-07T00:00:00Z \
|
|
736
|
-
--metric-groups ENGAGEMENT,BILLING --granularity DAY
|
|
716
|
+
# "Why did spend drop yesterday?"
|
|
717
|
+
baker ads meta activities --account-id act_123 --days 7
|
|
737
718
|
|
|
738
|
-
#
|
|
739
|
-
|
|
740
|
-
baker ads
|
|
741
|
-
--entity-ids abc --start-time 2026-04-01T00:00:00Z --end-time 2026-05-01T00:00:00Z \
|
|
742
|
-
--metric-groups ENGAGEMENT,BILLING --segmentation-type LOCATIONS
|
|
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
|
|
743
722
|
|
|
744
|
-
#
|
|
745
|
-
baker ads
|
|
746
|
-
|
|
747
|
-
--metric-groups ENGAGEMENT,BILLING --segmentation-type LOCATIONS
|
|
748
|
-
baker ads x stats job-status --account-id 18ce53xyz --job-id <jobId>
|
|
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
|
|
749
726
|
|
|
750
|
-
#
|
|
751
|
-
baker ads
|
|
727
|
+
# "What audience is this targeting?"
|
|
728
|
+
baker ads meta audiences --account-id act_123
|
|
752
729
|
|
|
753
|
-
#
|
|
754
|
-
baker ads
|
|
755
|
-
baker ads
|
|
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
|
|
756
733
|
```
|
|
757
734
|
|
|
758
|
-
|
|
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
|
+
|
|
753
|
+
```
|
|
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
|
|
767
|
+
```
|
|
768
|
+
|
|
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
|
+
|
|
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
|
|
759
779
|
|
|
760
|
-
|
|
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.
|
|
761
784
|
|
|
762
785
|
---
|
|
763
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.25.
|
|
15
|
+
version: "0.25.1",
|
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/ads/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/ads/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,qDAoBrB,CAAC"}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
2
|
import { googleCommand } from "./google/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { metaCommand } from "./meta/index.js";
|
|
4
4
|
export const adsCommand = defineCommand({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "ads",
|
|
7
|
-
description: `Ad platform commands.
|
|
7
|
+
description: `Ad platform commands. Each platform exposes its own native command surface — no forced parity.
|
|
8
8
|
|
|
9
9
|
Platforms:
|
|
10
|
-
google — Google Ads (GAQL queries, keywords, accounts
|
|
11
|
-
|
|
10
|
+
google — Google Ads (GAQL queries, keywords, accounts)
|
|
11
|
+
meta — Meta Ads (campaigns, adsets, ads, insights, previews)
|
|
12
12
|
|
|
13
13
|
Examples:
|
|
14
14
|
baker ads google accounts
|
|
15
15
|
baker ads google query --preset campaign-performance --customer-id 1234567890
|
|
16
|
-
baker ads
|
|
17
|
-
baker ads
|
|
16
|
+
baker ads meta accounts
|
|
17
|
+
baker ads meta campaigns --account-id act_123 --effective-status ACTIVE
|
|
18
|
+
baker ads meta insights --object act_123 --level ad --date-preset last_7d --fields impressions,spend,ctr`,
|
|
18
19
|
},
|
|
19
20
|
subCommands: {
|
|
20
21
|
google: googleCommand,
|
|
21
|
-
|
|
22
|
+
meta: metaCommand,
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/ads/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/ads/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;IACtC,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,WAAW,EAAE;;;;;;;;;;;2GAW0F;KACxG;IACD,WAAW,EAAE;QACX,MAAM,EAAE,aAAa;QACrB,IAAI,EAAE,WAAW;KAClB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const accountCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID (act_...)";
|
|
5
|
+
};
|
|
6
|
+
readonly "skip-cache": {
|
|
7
|
+
readonly type: "boolean";
|
|
8
|
+
readonly description: "Bypass server-side cache";
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/account.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;;EAwBzB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson } from "../output.js";
|
|
4
|
+
import { handleMetaError, resolveAccountIdArg } from "./shared.js";
|
|
5
|
+
export const accountCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "account",
|
|
8
|
+
description: `Show single Meta ad account detail (currency, timezone, balance, business).
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
baker ads meta account --account-id act_123
|
|
12
|
+
BAKER_META_AD_ACCOUNT_ID=act_123 baker ads meta account`,
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
"account-id": { type: "string", description: "Meta ad account ID (act_...)" },
|
|
16
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
17
|
+
},
|
|
18
|
+
run: async ({ args }) => {
|
|
19
|
+
const accountId = resolveAccountIdArg(args);
|
|
20
|
+
try {
|
|
21
|
+
const params = { "account-id": accountId };
|
|
22
|
+
if (args["skip-cache"])
|
|
23
|
+
params["skip-cache"] = "true";
|
|
24
|
+
const data = await apiGet("/api/ads/meta/account", params);
|
|
25
|
+
writeAdsJson({ ok: true, data });
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
handleMetaError(err);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;IAC1C,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;;;;0DAIyC;KACvD;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE;QAC7E,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;KAC3E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;YACnE,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAA0B,uBAAuB,EAAE,MAAM,CAAC,CAAC;YACpF,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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const accountsCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "include-all": {
|
|
3
|
+
readonly type: "boolean";
|
|
4
|
+
readonly description: "List all accessible accounts, ignoring picker scope";
|
|
5
|
+
};
|
|
6
|
+
readonly "no-cache": {
|
|
7
|
+
readonly type: "boolean";
|
|
8
|
+
readonly description: "Skip CLI-side cache";
|
|
9
|
+
};
|
|
10
|
+
readonly "skip-cache": {
|
|
11
|
+
readonly type: "boolean";
|
|
12
|
+
readonly description: "Bypass server-side cache (force re-fetch)";
|
|
13
|
+
};
|
|
14
|
+
readonly output: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
readonly description: "Output format: json|csv|jsonl|md";
|
|
17
|
+
readonly default: "json";
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/accounts.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EA6C1B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { cacheGet, cacheSet } from "../cache.js";
|
|
4
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
5
|
+
import { csvOrJson, handleMetaError } from "./shared.js";
|
|
6
|
+
export const accountsCommand = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "accounts",
|
|
9
|
+
description: `List Meta ad accounts in this company's connected scope.
|
|
10
|
+
|
|
11
|
+
Examples:
|
|
12
|
+
baker ads meta accounts
|
|
13
|
+
baker ads meta accounts --include-all # ignore picker scope and list every account the token can see
|
|
14
|
+
baker ads meta accounts --output csv`,
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
"include-all": { type: "boolean", description: "List all accessible accounts, ignoring picker scope" },
|
|
18
|
+
"no-cache": { type: "boolean", description: "Skip CLI-side cache" },
|
|
19
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache (force re-fetch)" },
|
|
20
|
+
output: { type: "string", description: "Output format: json|csv|jsonl|md", default: "json" },
|
|
21
|
+
},
|
|
22
|
+
run: async ({ args }) => {
|
|
23
|
+
const includeAll = args["include-all"] === true;
|
|
24
|
+
const useCache = !args["no-cache"];
|
|
25
|
+
const cacheKey = `accounts:${includeAll ? "all" : "scoped"}`;
|
|
26
|
+
if (useCache) {
|
|
27
|
+
const cached = cacheGet("meta-accounts", cacheKey);
|
|
28
|
+
if (cached) {
|
|
29
|
+
writeAdsJson({ ok: true, data: cached.data, cached: true });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const params = {};
|
|
35
|
+
if (includeAll)
|
|
36
|
+
params["include-all"] = "true";
|
|
37
|
+
if (args["skip-cache"])
|
|
38
|
+
params["skip-cache"] = "true";
|
|
39
|
+
const data = await apiGet("/api/ads/meta/accounts", params);
|
|
40
|
+
if (useCache) {
|
|
41
|
+
cacheSet("meta-accounts", cacheKey, data, 60 * 60 * 1000);
|
|
42
|
+
}
|
|
43
|
+
const fmt = csvOrJson(args);
|
|
44
|
+
if (fmt !== "json") {
|
|
45
|
+
writeAdsOutput(data, fmt);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
writeAdsJson({ ok: true, data });
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
handleMetaError(err);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAczD,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;IAC3C,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE;;;;;uCAKsB;KACpC;IACD,IAAI,EAAE;QACJ,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,qDAAqD,EAAE;QACtG,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,qBAAqB,EAAE;QACnE,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,2CAA2C,EAAE;QAC3F,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kCAAkC,EAAE,OAAO,EAAE,MAAM,EAAE;KAC7F;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;QAChD,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,YAAY,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC7D,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,MAAM,GAAG,QAAQ,CAAgB,eAAe,EAAE,QAAQ,CAAC,CAAC;YAClE,IAAI,MAAM,EAAE,CAAC;gBACX,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC5D,OAAO;YACT,CAAC;QACH,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,IAAI,UAAU;gBAAE,MAAM,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC;YAC/C,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAgB,wBAAwB,EAAE,MAAM,CAAC,CAAC;YAC3E,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,CAAC,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;YAC5D,CAAC;YACD,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAiD,EAAE,GAAG,CAAC,CAAC;gBACvE,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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const activitiesCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID";
|
|
5
|
+
};
|
|
6
|
+
readonly days: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Lookback days (default 7)";
|
|
9
|
+
};
|
|
10
|
+
readonly limit: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Max rows";
|
|
13
|
+
};
|
|
14
|
+
readonly "skip-cache": {
|
|
15
|
+
readonly type: "boolean";
|
|
16
|
+
readonly description: "Bypass server-side cache";
|
|
17
|
+
};
|
|
18
|
+
readonly output: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "Output format";
|
|
21
|
+
readonly default: "json";
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=activities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activities.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/activities.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAkC5B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
|
|
5
|
+
export const activitiesCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "activities",
|
|
8
|
+
description: `Audit log of recent ad-account changes (created, paused, edited). Default lookback 7 days,
|
|
9
|
+
~90 day retention server-side.
|
|
10
|
+
|
|
11
|
+
Examples:
|
|
12
|
+
baker ads meta activities --account-id act_123 --days 14`,
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
16
|
+
days: { type: "string", description: "Lookback days (default 7)" },
|
|
17
|
+
limit: { type: "string", description: "Max rows" },
|
|
18
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
19
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
20
|
+
},
|
|
21
|
+
run: async ({ args }) => {
|
|
22
|
+
const accountId = resolveAccountIdArg(args);
|
|
23
|
+
try {
|
|
24
|
+
const params = { "account-id": accountId };
|
|
25
|
+
if (args.days)
|
|
26
|
+
params.days = args.days;
|
|
27
|
+
if (args.limit)
|
|
28
|
+
params.limit = args.limit;
|
|
29
|
+
if (args["skip-cache"])
|
|
30
|
+
params["skip-cache"] = "true";
|
|
31
|
+
const data = await apiGet("/api/ads/meta/activities", params);
|
|
32
|
+
const fmt = csvOrJson(args);
|
|
33
|
+
if (fmt !== "json") {
|
|
34
|
+
writeAdsOutput(data, fmt);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
writeAdsJson({ ok: true, data });
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
handleMetaError(err);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=activities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activities.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/activities.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,iBAAiB,GAAG,aAAa,CAAC;IAC7C,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE;;;;2DAI0C;KACxD;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;QACnE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2BAA2B,EAAE;QAClE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE;QAClD,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;YACnE,IAAI,IAAI,CAAC,IAAI;gBAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAc,CAAC;YACjD,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,0BAA0B,EAAE,MAAM,CAAC,CAAC;YAC9F,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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const adsListCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID";
|
|
5
|
+
};
|
|
6
|
+
readonly "adset-id": {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Filter to one adset";
|
|
9
|
+
};
|
|
10
|
+
readonly "campaign-id": {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly description: "Filter to one campaign";
|
|
13
|
+
};
|
|
14
|
+
readonly "effective-status": {
|
|
15
|
+
readonly type: "string";
|
|
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";
|
|
21
|
+
};
|
|
22
|
+
readonly limit: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly description: "Max rows (default 1000)";
|
|
25
|
+
};
|
|
26
|
+
readonly "skip-cache": {
|
|
27
|
+
readonly type: "boolean";
|
|
28
|
+
readonly description: "Bypass server-side cache";
|
|
29
|
+
};
|
|
30
|
+
readonly output: {
|
|
31
|
+
readonly type: "string";
|
|
32
|
+
readonly description: "Output format";
|
|
33
|
+
readonly default: "json";
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
//# sourceMappingURL=ads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ads.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/ads.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CzB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { apiGet } from "../../../client.js";
|
|
3
|
+
import { writeAdsJson, writeAdsOutput } from "../output.js";
|
|
4
|
+
import { csvOrJson, handleMetaError, resolveAccountIdArg, resolveEffectiveStatus } from "./shared.js";
|
|
5
|
+
export const adsListCommand = defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "ads",
|
|
8
|
+
description: `List ads in a Meta ad account. Defaults to ACTIVE only — pass --all-statuses to widen.
|
|
9
|
+
|
|
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 without calling generatepreviews.
|
|
12
|
+
|
|
13
|
+
Examples:
|
|
14
|
+
baker ads meta ads --account-id act_123
|
|
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`,
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
"account-id": { type: "string", description: "Meta ad account ID" },
|
|
21
|
+
"adset-id": { type: "string", description: "Filter to one adset" },
|
|
22
|
+
"campaign-id": { type: "string", description: "Filter to one campaign" },
|
|
23
|
+
"effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
|
|
24
|
+
"all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter" },
|
|
25
|
+
limit: { type: "string", description: "Max rows (default 1000)" },
|
|
26
|
+
"skip-cache": { type: "boolean", description: "Bypass server-side cache" },
|
|
27
|
+
output: { type: "string", description: "Output format", default: "json" },
|
|
28
|
+
},
|
|
29
|
+
run: async ({ args }) => {
|
|
30
|
+
const accountId = resolveAccountIdArg(args);
|
|
31
|
+
const effectiveStatus = resolveEffectiveStatus(args);
|
|
32
|
+
try {
|
|
33
|
+
const params = { "account-id": accountId };
|
|
34
|
+
if (args["adset-id"])
|
|
35
|
+
params["adset-id"] = args["adset-id"];
|
|
36
|
+
if (args["campaign-id"])
|
|
37
|
+
params["campaign-id"] = args["campaign-id"];
|
|
38
|
+
if (effectiveStatus)
|
|
39
|
+
params["effective-status"] = effectiveStatus;
|
|
40
|
+
if (args.limit)
|
|
41
|
+
params.limit = args.limit;
|
|
42
|
+
if (args["skip-cache"])
|
|
43
|
+
params["skip-cache"] = "true";
|
|
44
|
+
const data = await apiGet("/api/ads/meta/ads", params);
|
|
45
|
+
const fmt = csvOrJson(args);
|
|
46
|
+
if (fmt !== "json") {
|
|
47
|
+
writeAdsOutput(data, fmt);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
writeAdsJson({ ok: true, data });
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
handleMetaError(err);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=ads.js.map
|
|
@@ -0,0 +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,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEtG,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;IAC1C,IAAI,EAAE;QACJ,IAAI,EAAE,KAAK;QACX,WAAW,EAAE;;;;;;;;;uDASsC;KACpD;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;QACnE,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE;QAClE,aAAa,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;QACxE,kBAAkB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;QAClH,cAAc,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,gCAAgC,EAAE;QAClF,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yBAAyB,EAAE;QACjE,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,MAAM,SAAS,GAAG,mBAAmB,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,IAAI,CAAC,UAAU,CAAC;gBAAE,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,CAAW,CAAC;YACtE,IAAI,IAAI,CAAC,aAAa,CAAC;gBAAE,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,CAAW,CAAC;YAC/E,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,mBAAmB,EAAE,MAAM,CAAC,CAAC;YACvF,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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const adsetsCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly "account-id": {
|
|
3
|
+
readonly type: "string";
|
|
4
|
+
readonly description: "Meta ad account ID";
|
|
5
|
+
};
|
|
6
|
+
readonly "campaign-id": {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly description: "Filter to one campaign";
|
|
9
|
+
};
|
|
10
|
+
readonly "effective-status": {
|
|
11
|
+
readonly type: "string";
|
|
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";
|
|
17
|
+
};
|
|
18
|
+
readonly limit: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "Max rows (default 1000)";
|
|
21
|
+
};
|
|
22
|
+
readonly "skip-cache": {
|
|
23
|
+
readonly type: "boolean";
|
|
24
|
+
readonly description: "Bypass server-side cache";
|
|
25
|
+
};
|
|
26
|
+
readonly output: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
readonly description: "Output format";
|
|
29
|
+
readonly default: "json";
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=adsets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adsets.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/adsets.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCxB,CAAC"}
|