@koda-sl/baker-cli 0.275.0 → 0.276.0-dev.fc47c292d

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 CHANGED
@@ -741,7 +741,7 @@ All errors include a `fix` object with `action`, `correctedCommand` (when applic
741
741
 
742
742
  ### X (Twitter) Ads (`baker ads x`)
743
743
 
744
- Read X Ads campaigns, line items, promoted tweets, creatives, audiences, and analytics. Powered by the X Ads API v12.
744
+ Read X Ads campaigns, line items, promoted tweets, creatives, audiences, and analytics — and stage changes that apply when the chat is published. Powered by the X Ads API v12.
745
745
 
746
746
  **Environment:**
747
747
  - `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.
@@ -759,12 +759,17 @@ Read X Ads campaigns, line items, promoted tweets, creatives, audiences, and ana
759
759
  | `media` | Media library (images / GIFs / videos) — `--media-type IMAGE\|GIF\|VIDEO` |
760
760
  | `audiences` | Custom audiences (size, targetable status) |
761
761
  | `targeting-criteria` | Targeting attached to line items |
762
- | `targeting-constants` | Lookup locations / interests / events / devices etc. — `--constant <name> --q "Madrid"` |
762
+ | `targeting-constants` | Lookup locations / interests / events / devices etc. — `--constant <name> --q "Madrid"`. `--location-type` is plural (`COUNTRIES`, `REGIONS`, `CITIES`, `METROS`, `POSTAL_CODES`); `tv_shows` needs `--locale` (take one from `tv_markets`) |
763
763
  | `active-entities` | Entities with metric activity in a time range |
764
- | `stats sync` | Synchronous analytics (≤7 days, no segmentation) |
764
+ | `stats sync` | Synchronous analytics (≤7 days, no segmentation). A preset asking for a longer window is shortened to 7 days and says so in `hints` |
765
765
  | `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. |
766
766
  | `stats job-create` | Low-level: create async stats job, return ID immediately |
767
767
  | `stats job-status` | Low-level: poll job status / get download URL |
768
+ | `campaigns create\|update\|pause\|resume` | **Staged write** — a new or changed campaign |
769
+ | `line-items create\|update\|pause\|resume` | **Staged write** — a new or changed ad group |
770
+ | `promoted-tweets create\|remove` | **Staged write** — promote posts, or stop promoting them |
771
+ | `targeting-criteria create\|remove` | **Staged write** — targeting on an ad group |
772
+ | `draft` | Review the staged Campaign ▸ Ad group ▸ Ad tree; `show`, `amend`, `remove`, `clear` |
768
773
 
769
774
  **Examples:**
770
775
 
@@ -777,9 +782,10 @@ baker ads x promoted-tweets --account-id 18ce53xyz
777
782
  # Sync analytics with a preset (saves tokens)
778
783
  baker ads x stats sync --preset campaign-engagement-7d --entity-ids abc,def
779
784
 
780
- # Free-form sync stats
785
+ # Free-form sync stats. At DAY granularity X requires both times to be midnight in the ad
786
+ # account's own timezone (`baker ads x accounts` reports it) — below, midnight in a UTC-7 account.
781
787
  baker ads x stats sync --account-id 18ce53xyz --entity LINE_ITEM \
782
- --entity-ids abc,def --start-time 2026-05-01T00:00:00Z --end-time 2026-05-07T00:00:00Z \
788
+ --entity-ids abc,def --start-time 2026-05-01T07:00:00Z --end-time 2026-05-07T07:00:00Z \
783
789
  --metric-groups ENGAGEMENT,BILLING --granularity DAY
784
790
 
785
791
  # Async job, sync from the CLI's perspective (creates → polls → downloads → returns).
@@ -794,14 +800,25 @@ baker ads x stats job-create --account-id 18ce53xyz --entity CAMPAIGN \
794
800
  --metric-groups ENGAGEMENT,BILLING --segmentation-type LOCATIONS
795
801
  baker ads x stats job-status --account-id 18ce53xyz --job-id <jobId>
796
802
 
803
+ # Staged writes — nothing reaches X until the chat is published
804
+ baker ads x campaigns create --name "Spring" --funding-instrument-id vtbot --daily-budget 5
805
+ baker ads x line-items create --campaign-id x_temp_abc --name "Spain" --objective WEBSITE_CLICKS
806
+ baker ads x targeting-criteria create --line-item-id x_temp_def --type LOCATION --value ecdce75d48b13b64
807
+ baker ads x promoted-tweets create --line-item-id x_temp_def --tweet-ids 2042198488033661285
808
+ baker ads x draft # review; after publishing, the authoritative record
809
+ baker ads x campaigns pause oilf0,omyq3 # every id in one call
810
+
797
811
  # List sync presets
798
812
  baker ads x stats sync --list-presets
799
813
 
800
- # Targeting lookups
801
- baker ads x targeting-constants --constant locations --q "Madrid" --country-code ES
814
+ # Targeting lookups (--location-type is plural; tv_shows needs a --locale from tv_markets)
815
+ baker ads x targeting-constants --constant locations --q "Madrid" --country-code ES --location-type CITIES
802
816
  baker ads x targeting-constants --constant interests
817
+ baker ads x targeting-constants --constant tv_shows --locale en-US
803
818
  ```
804
819
 
820
+ **Writes are staged.** Every `create`/`update`/`pause`/`resume`/`remove` appends an op to the current chat's draft (`BAKER_CHAT_ID`); X is not called. The draft applies when the chat is published and discarding the chat reverses it. Creates default to `PAUSED`. Budgets and bids are given in account currency (`--daily-budget 12.50`). Chain creates with the `x_temp_*` ref a create returns.
821
+
805
822
  **Caching:** account list 1h · campaigns/line items/promoted tweets 1h (date-keyed) · cards/media/audiences 6h · stats sync 1h · targeting constants 7 days. Pass `--no-cache` to bypass.
806
823
 
807
824
  **Rate limits:** server-side buckets (`xAds:read`, `xAds:write`, `xAds:analyticsSync`, `xAds:analyticsAsync`, `xAds:audiences`) sit well under X's published quotas; 429s honor `x-account-rate-limit-reset` / `x-rate-limit-reset` headers.
@@ -16,9 +16,9 @@ import {
16
16
  shouldEscalate
17
17
  } from "./chunk-DZUVUGEP.js";
18
18
 
19
- // ../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js
19
+ // ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/509a695c9237c6e3727f1f1f99169917f329e3ff3f7877be290b684e24bf153d/node_modules/safe-stable-stringify/index.js
20
20
  var require_safe_stable_stringify = __commonJS({
21
- "../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(exports, module) {
21
+ "../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/509a695c9237c6e3727f1f1f99169917f329e3ff3f7877be290b684e24bf153d/node_modules/safe-stable-stringify/index.js"(exports, module) {
22
22
  "use strict";
23
23
  var { hasOwnProperty } = Object.prototype;
24
24
  var stringify = configure2();
@@ -1092,7 +1092,7 @@ function resolveAdaptFormats(params) {
1092
1092
  return params.formats ?? [];
1093
1093
  }
1094
1094
 
1095
- // ../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/esm/wrapper.js
1095
+ // ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/509a695c9237c6e3727f1f1f99169917f329e3ff3f7877be290b684e24bf153d/node_modules/safe-stable-stringify/esm/wrapper.js
1096
1096
  var import__ = __toESM(require_safe_stable_stringify(), 1);
1097
1097
  var configure = import__.default.configure;
1098
1098
  var wrapper_default = import__.default;
@@ -9154,4 +9154,4 @@ export {
9154
9154
  defaultRegistry,
9155
9155
  createEngineFromEnv
9156
9156
  };
9157
- //# sourceMappingURL=chunk-36KVUYVL.js.map
9157
+ //# sourceMappingURL=chunk-RQRP3SAY.js.map