@koda-sl/baker-cli 0.338.0 → 0.340.0-dev.10990633f

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
@@ -32,7 +32,7 @@ export BAKER_GSC_SITE_URL="https://example.com/"
32
32
  # Optional: default X Ads account ID (base36)
33
33
  export BAKER_X_ADS_ACCOUNT_ID="18ce53xyz"
34
34
 
35
- # Required for `baker actions ...` and `baker scheduled-actions create/update/delete` commands that stage against a chat
35
+ # Required for `baker actions ...` and `baker scheduled-agents create/update/delete` commands that stage against a chat
36
36
  export BAKER_CHAT_ID="<chat-id>"
37
37
  ```
38
38
 
@@ -43,7 +43,7 @@ export BAKER_CHAT_ID="<chat-id>"
43
43
  - `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.
44
44
  - `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.
45
45
  - `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.
46
- - `BAKER_CHAT_ID` — chat context for staged Work Action commands and staged Scheduled Action create/update/delete. `scheduled-actions trigger` does not require it. When set, it is also sent as an `x-baker-chat-id` header on every request, so library additions that apply immediately (images, videos, followed brands) are listed in that chat's changes as already applied.
46
+ - `BAKER_CHAT_ID` — chat context for staged Work Action commands and staged Scheduled agent create/update/delete. `scheduled-agents run` does not require it. When set, it is also sent as an `x-baker-chat-id` header on every request, so library additions that apply immediately (images, videos, followed brands) are listed in that chat's changes as already applied.
47
47
 
48
48
  ## Debug logging
49
49
 
@@ -689,7 +689,7 @@ Command groups: `budgets`, `campaigns`, `ad-groups`, `keywords` (add/update/remo
689
689
 
690
690
  **Amending a staged op** — `draft amend <ref> (--file patch.json | --patch '<json>')` merges a JSON patch into an already-staged op's payload (objects deep-merge, `null` deletes a key, arrays/scalars replace) and re-validates it in full. Always prefer this over removing and re-staging — it preserves the op's ref (so dependents don't break) and its position in the draft. `draft show <ref>` prints the full staged payload (including warnings/annotations) so you can verify a change looks right before publish.
691
691
 
692
- **Reading an earlier chat's changes** — `draft list` and `draft show` take `--chat <chat-id>` to read another chat in the same company instead of the current one. Every staged-draft family accepts it: `ads google|meta|linkedin draft list|show`, `tag-manager draft list|show`, `actions draft`, `tags draft`, and `scheduled-actions list|get`. A published draft is kept in full, so this returns what that chat actually wrote — every headline, bid and target — plus each op's outcome and error. Use it when asked to redo or reapply earlier work rather than reconstructing copy from a summary. Read-only: staging, `amend`, `remove` and `clear` stay bound to `BAKER_CHAT_ID`, so one chat can never edit another's draft. To re-run only the changes a publish failed to land, use the chat's **Retry** control in the dashboard — it re-sends exactly those and leaves the ones that applied untouched.
692
+ **Reading an earlier chat's changes** — `draft list` and `draft show` take `--chat <chat-id>` to read another chat in the same company instead of the current one. Every staged-draft family accepts it: `ads google|meta|linkedin draft list|show`, `tag-manager draft list|show`, `actions draft`, `tags draft`, and `scheduled-agents list|get`. A published draft is kept in full, so this returns what that chat actually wrote — every headline, bid and target — plus each op's outcome and error. Use it when asked to redo or reapply earlier work rather than reconstructing copy from a summary. Read-only: staging, `amend`, `remove` and `clear` stay bound to `BAKER_CHAT_ID`, so one chat can never edit another's draft. To re-run only the changes a publish failed to land, use the chat's **Retry** control in the dashboard — it re-sends exactly those and leaves the ones that applied untouched.
693
693
 
694
694
  **Already-satisfied writes aren't staged** — an update or pause/resume whose every field already holds the requested value on the live account is dropped instead of staged: the envelope returns `"staged": false, "noop": true` with a `reason` ("this ad is already Paused on Google Ads"), plus a hint. This is a success, not an error — there is nothing to publish. Only a positively-read live snapshot can trigger it; a failed or empty read always stages. Batch responses list the dropped ops under `skipped`, and `count` reflects what actually entered the draft.
695
695
 
@@ -3261,63 +3261,79 @@ baker winning-ads patterns --winners a_1,a_2,a_3 --duds a_9,a_8 --top-n 10 --out
3261
3261
 
3262
3262
  ---
3263
3263
 
3264
- ### Scheduled Actions (`baker scheduled-actions`)
3264
+ ### Scheduled agents (`baker scheduled-agents`)
3265
3265
 
3266
- Manage company-scoped scheduled recipes that spawn Work Actions later or on a cadence. `create`, `update`, and `delete` stage draft ops on `BAKER_CHAT_ID` and apply when the chat is published. `list` and `get` include draft state when `BAKER_CHAT_ID` is set. `trigger` runs immediately on a published scheduled action and does not require a chat id. Use a regular Work Action instead when there is no date or cadence.
3266
+ A Scheduled agent is a **trigger** and a **prompt**. When the trigger fires, a Session opens with that prompt and does the job — there is no Task in between. `create`, `update`, and `delete` stage draft ops on `BAKER_CHAT_ID` and apply when the chat is published. `list` and `get` include draft state when `BAKER_CHAT_ID` is set. `run` fires a published item immediately and does not require a chat id.
3267
3267
 
3268
3268
  ```bash
3269
- baker scheduled-actions list
3270
- baker scheduled-actions get <id-or-temp_sched_id>
3269
+ baker scheduled-agents triggers # every trigger there is
3270
+ baker scheduled-agents list
3271
+ baker scheduled-agents get <id-or-temp_agent_id>
3271
3272
 
3272
- baker scheduled-actions create --name "Weekly report" --description "Prepare report" --cron "0 9 * * MON" --timezone Europe/Madrid
3273
- baker scheduled-actions create --name "Launch reminder" --description "Check launch" --run-at "2026-09-01T07:00:00Z" --disabled --no-spawn-agent
3274
- baker scheduled-actions create --name "Spend review" --description "Review spend anomalies" --cron "0 9 * * MON" --prompt "Focus on blockers"
3273
+ baker scheduled-agents create --name "Weekly report" --description "Prepare report" --prompt "Review last week's spend." --cron "0 9 * * MON" --timezone Europe/Madrid
3274
+ baker scheduled-agents create --name "Launch reminder" --description "Check launch" --prompt "Check the launch checklist." --run-at "2026-09-01T07:00:00Z" --disabled
3275
+ baker scheduled-agents create --name "Chase a new quote" --description "Follow up while it is warm" --prompt "Read the answers and draft the follow-up." --trigger form.submitted --form quote
3276
+ baker scheduled-agents create --name "Celebrate the first sale" --description "Once, ever" --prompt "Write the announcement." --trigger event.received --event purchase --occurrences 1
3275
3277
 
3276
- baker scheduled-actions update <id-or-temp_sched_id> --enabled false
3277
- baker scheduled-actions update <id-or-temp_sched_id> --run-at "2026-09-02T07:00:00Z" --spawn-agent true --prompt "Use the launch checklist"
3278
- baker scheduled-actions update <id-or-temp_sched_id> --mode publish # runs go live unreviewed
3279
- baker scheduled-actions update <id-or-temp_sched_id> --mode recommend # runs advise and change nothing
3280
- baker scheduled-actions delete <id-or-temp_sched_id>
3278
+ baker scheduled-agents update <id-or-temp_agent_id> --enabled false
3279
+ baker scheduled-agents update <id-or-temp_agent_id> --run-at "2026-09-02T07:00:00Z" --prompt "Use the launch checklist"
3280
+ baker scheduled-agents update <id-or-temp_agent_id> --trigger experiment.ended
3281
+ baker scheduled-agents delete <id-or-temp_agent_id>
3281
3282
 
3282
- baker scheduled-actions trigger <id>
3283
+ baker scheduled-agents run <id>
3283
3284
 
3284
- baker scheduled-actions templates --list # every recipe this company can run
3285
- baker scheduled-actions templates --category measurement # one group only
3286
- baker scheduled-actions create --template baker-ads --name "Weekly ad review" --description "..." --cron "0 8 * * MON"
3285
+ baker scheduled-agents templates --list # every recipe this company can run
3286
+ baker scheduled-agents templates --category measurement # one group only
3287
+ baker scheduled-agents create --template baker-ads --name "Weekly ad review" --description "..." --cron "0 8 * * MON"
3287
3288
  ```
3288
3289
 
3290
+ Triggers:
3291
+
3292
+ | `--trigger` | Fires when | Narrow it with |
3293
+ |---|---|---|
3294
+ | *(use `--run-at`)* | Once, at a time you pick | — |
3295
+ | *(use `--cron`)* | On a repeating cadence | — |
3296
+ | `webhook.received` | Another tool posts to this item's own private address | — |
3297
+ | `event.received` | An event arrives from the site or a connected tool | `--event <name>` |
3298
+ | `form.submitted` | Somebody sends answers from a Form | `--form <slug>` |
3299
+ | `flow.step.submitted` | Somebody gets as far as one step of a Form | `--form <slug> --step <id>` |
3300
+ | `experiment.ended` | Somebody ends an A/B test | `--experiment <id>` |
3301
+ | `experiment.concluded` | The winner has been moved into the page | `--experiment <id>` |
3302
+ | `task.completed` | A Task is closed | `--tag <slug>` |
3303
+ | `task.claimed` | An agent picks up a Task | `--tag <slug>` |
3304
+
3289
3305
  Rules:
3290
3306
 
3291
- - `--cron` and `--run-at` are mutually exclusive.
3292
- - `--run-at` must be an ISO UTC timestamp ending in `Z`, and still in the future — a time that has already passed is refused when the op is staged. If a one-off's time passes while the chat is still open, publishing creates the task **switched off** with the reason on it rather than dropping it, so it is never lost.
3293
- - Draft-created ids use `temp_sched_*`; use them with `get`, `update`, or `delete` before publish.
3307
+ - `--cron`, `--run-at` and `--trigger` are mutually exclusive — an item has exactly one trigger.
3308
+ - `--run-at` must be an ISO UTC timestamp ending in `Z`, and still in the future — a time that has already passed is refused when the op is staged. If a one-off's time passes while the chat is still open, publishing creates it **switched off** with the reason on it rather than dropping it.
3309
+ - Leaving a narrowing flag off means "any" — any Form, any event, any test — including ones that do not exist yet.
3310
+ - `--occurrences 1` runs only the first time the trigger ever fires; `--occurrences 1,3` the first and the third. Omit it to run every time. It counts firings of this item's trigger, so a firing that `--occurrences` declines is still counted.
3311
+ - A signal-triggered item will not start a second run while its last one is still going, and never wakes itself.
3312
+ - `--prompt` is the whole job: there is no mode and no `--spawn-agent`. If a run should only advise, the brief says so.
3313
+ - Publishing every run's work unreviewed is a standing authorization only the user can grant, on the item in Baker. The API refuses `autoPublish` outright.
3314
+ - Draft-created ids use `temp_agent_*`; use them with `get`, `update`, or `delete` before publish.
3294
3315
  - Staged commands require `BAKER_CHAT_ID` to point to an `in_progress` chat.
3295
- - `trigger` rejects `temp_sched_*` and only accepts published scheduled-action ids.
3316
+ - `run` rejects `temp_agent_*` and only accepts published ids. It returns the `chatId` of the Session it opened.
3296
3317
  - Company Timezone is the default; `--timezone` is an explicit IANA override.
3297
- - `--mode` sets how far a run goes on its own: `remind` (opens the Task, runs nothing), `recommend` (writes up what it would change, touches nothing), `propose` (does the work, waits to be published — the default), `publish` (does the work and publishes it unreviewed). It applies when the chat is published, on the authority of whoever published it; a chat completed with no person behind it lands a `publish` task on `propose` instead.
3298
- - `--mode` supersedes `--spawn-agent`/`--no-spawn-agent`, which can only reach `remind` and `propose`. Passing both is rejected.
3299
- - Scheduled actions spawn agents by default; create with `--no-spawn-agent` or update with `--spawn-agent false` to disable it.
3300
- - `--prompt` maps to the scheduled action's additional spawned-agent instructions (`agentPrompt`), not a replacement for Baker's automatic spawned Work Action reference.
3301
- - `--prompt` requires a run that does the work: it is rejected alongside `--mode remind`, `--no-spawn-agent` (create) or `--spawn-agent false` (update), since a bypassed agent never reads it.
3302
- - `--template <id>` binds the schedule to a marketplace recipe instead of a prompt you wrote. The row stores the id alone: name, brief and prompt resolve at fire time, so the job improves when the recipe does. `--description` carries what is true of this company. One row per recipe per company; a second `create` for the same id is refused.
3318
+ - `--template <id>` copies a marketplace recipe's brief onto the item — a copy, not a link, so the owner can read and edit every word, and a later change to the recipe does not reach it. `--prompt` is appended after it. The same recipe can be used more than once.
3303
3319
 
3304
3320
  #### Marketplace recipes (`templates`)
3305
3321
 
3306
- `templates` lists every recipe a company can switch on — the ones Baker maintains plus any the company wrote — and is also how one of theirs is written. Recipes we maintain take priority: a company recipe can never use one of our ids, and resolution reads ours first.
3322
+ `templates` lists every recipe a company can build an item from — the ones Baker maintains plus any the company wrote — and is also how one of theirs is written. Recipes we maintain take priority: a company recipe can never use one of our ids, and resolution reads ours first.
3307
3323
 
3308
3324
  ```bash
3309
- baker scheduled-actions templates --list --drafts # include theirs not offered yet
3325
+ baker scheduled-agents templates --list --drafts # include theirs not offered yet
3310
3326
 
3311
3327
  # Writing one of theirs, in this order:
3312
- baker scheduled-actions templates --save weekly-posthog-check \
3328
+ baker scheduled-agents templates --save weekly-posthog-check \
3313
3329
  --name "Weekly PostHog check" \
3314
3330
  --tagline "What moved in the funnel, from PostHog rather than GA4." \
3315
3331
  --recipe-category measurement --frequency weekly \
3316
3332
  --brief-file ./brief.md
3317
3333
 
3318
- # ...schedule it with --template, trigger it, read what the run produced, then:
3319
- baker scheduled-actions templates --publish weekly-posthog-check
3320
- baker scheduled-actions templates --delete weekly-posthog-check
3334
+ # ...build an item from it with --template, run that item, read what it produced, then:
3335
+ baker scheduled-agents templates --publish weekly-posthog-check
3336
+ baker scheduled-agents templates --delete weekly-posthog-check
3321
3337
  ```
3322
3338
 
3323
3339
  - **Saving does not offer it.** A saved recipe is invisible and cannot be scheduled until `--publish`. The step between the two is running it: nothing enforces that, and it is the only way to know it produces anything worth reading.
@@ -3435,7 +3451,7 @@ baker actions create --name "Build hero" --priority high --tags landing,creative
3435
3451
  # (temp_hero_copy, not hero_copy) and is rejected with a VALIDATION_ERROR otherwise — the prefix is
3436
3452
  # what tells a task staged in this chat apart from a published action id in link/update/complete/draft remove.
3437
3453
  # If the name/description reads as recurring or future-dated (e.g. "weekly", "every Monday", "schedule"),
3438
- # create emits a hint to use `baker scheduled-actions create` instead of a Work Action.
3454
+ # create emits a hint to use `baker scheduled-agents create` instead of a Work Action.
3439
3455
  # If it instead names work a surface executes in-chat (a GTM container change, a site tag, an ad-platform
3440
3456
  # write, a page or form edit, or a value only the user has), create emits a do-it-now hint naming that
3441
3457
  # surface — doing the work is the default, an action is the exception. One advisory hint per call: the
@@ -3651,7 +3667,7 @@ baker chats diff <id> --live # in-progress Session: read from its l
3651
3667
  ```
3652
3668
 
3653
3669
  **`list` flags:** `--status active|archived|all` (default `all`), `--limit` (1-100, default 20), `--full` (include each Session's full change list).
3654
- **`view`:** returns the unified `effects` — git content (`content`, `creatives`) AND DB-only effects that never touch the repo (`actions`, `scheduledActions`, `tags`, `ads.{google,meta,linkedin}`), each resolved to real detail and flagged `staged` (in-progress draft) vs applied. Plus `kickoff`, `outputs` counts, `threads`, `commits`, `diffAvailable`.
3670
+ **`view`:** returns the unified `effects` — git content (`content`, `creatives`) AND DB-only effects that never touch the repo (`actions`, `scheduledActions`, `tags`, `ads.{google,meta,linkedin,x}`, `tagManager`, `ga4`, `funnel` (with the ways in it added or removed, `triggersAdded`/`triggersRemoved`), `conversions`, `conversionSends`, `eventSources`), plus `otherChanges` for every other change the Session made (A/B tests, recipes, library images), each resolved to real detail and flagged `staged` (in-progress draft) vs applied. Plus `kickoff`, `outputs` counts, `threads`, `commits`, `diffAvailable`.
3655
3671
  **`transcript` flags:** `--limit` (1-1000, default 100, most recent), `--full` (untruncated text). Returns `entries` (`role` + `text`) and `truncated`.
3656
3672
  **`diff` flags:** `--surface knowledge|company|brand|landings|flows|creatives`, `--full` (patch text per file), `--live` (read an in-progress Session's changes from its live workspace). Returns `available`, `source` (`published`|`live`), `files` (`path`, `surface`, `status`, `additions`, `deletions`, `patch`), and `truncated` when a large live diff was capped.
3657
3673
 
@@ -19,9 +19,9 @@ import {
19
19
  shouldEscalate
20
20
  } from "./chunk-4VP5WWPR.js";
21
21
 
22
- // ../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js
22
+ // ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/766ad107c42df28eeadaf0ac2f9089c8a9e200f6ba0b2b1a817b8d536cbdcc49/node_modules/safe-stable-stringify/index.js
23
23
  var require_safe_stable_stringify = __commonJS({
24
- "../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(exports, module) {
24
+ "../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/766ad107c42df28eeadaf0ac2f9089c8a9e200f6ba0b2b1a817b8d536cbdcc49/node_modules/safe-stable-stringify/index.js"(exports, module) {
25
25
  "use strict";
26
26
  var { hasOwnProperty } = Object.prototype;
27
27
  var stringify = configure2();
@@ -1113,7 +1113,7 @@ function resolveAdaptFormats(params) {
1113
1113
  return params.formats ?? [];
1114
1114
  }
1115
1115
 
1116
- // ../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/esm/wrapper.js
1116
+ // ../../.pnpm-store/v10/links/@/safe-stable-stringify/2.5.0/766ad107c42df28eeadaf0ac2f9089c8a9e200f6ba0b2b1a817b8d536cbdcc49/node_modules/safe-stable-stringify/esm/wrapper.js
1117
1117
  var import__ = __toESM(require_safe_stable_stringify(), 1);
1118
1118
  var configure = import__.default.configure;
1119
1119
  var wrapper_default = import__.default;
@@ -9804,4 +9804,4 @@ export {
9804
9804
  defaultRegistry,
9805
9805
  createEngineFromEnv
9806
9806
  };
9807
- //# sourceMappingURL=chunk-FFOURYP5.js.map
9807
+ //# sourceMappingURL=chunk-D5P4COPD.js.map