atmn 2.0.250 → 2.0.252

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -4775,6 +4775,12 @@ var API_ROUTES = [
4775
4775
  type: "boolean",
4776
4776
  required: false,
4777
4777
  description: "When false, `webhooks` is the environment's complete set: every webhook not listed is deleted, including ones made in the dashboard. Defaults true, which leaves unlisted webhooks alone."
4778
+ },
4779
+ {
4780
+ name: "skip_updates",
4781
+ type: "boolean",
4782
+ required: false,
4783
+ description: "When true, only webhooks whose id does not exist yet are created. Updates, adoptions of dashboard webhooks and deletions are skipped and preview as `skip`. Defaults false."
4778
4784
  }
4779
4785
  ]
4780
4786
  },
@@ -4796,6 +4802,12 @@ var API_ROUTES = [
4796
4802
  type: "boolean",
4797
4803
  required: false,
4798
4804
  description: "When false, `webhooks` is the environment's complete set: every webhook not listed is deleted, including ones made in the dashboard. Defaults true, which leaves unlisted webhooks alone."
4805
+ },
4806
+ {
4807
+ name: "skip_updates",
4808
+ type: "boolean",
4809
+ required: false,
4810
+ description: "When true, only webhooks whose id does not exist yet are created. Updates, adoptions of dashboard webhooks and deletions are skipped and preview as `skip`. Defaults false."
4799
4811
  }
4800
4812
  ]
4801
4813
  },
@@ -8259,7 +8271,7 @@ var createClient = (options) => ({
8259
8271
  });
8260
8272
 
8261
8273
  // src/version.ts
8262
- var version = "2.0.250";
8274
+ var version = "2.0.252";
8263
8275
 
8264
8276
  // src/http/autumnFetch.ts
8265
8277
  var runtime = typeof Bun !== "undefined" ? `bun ${Bun.version}` : `node ${process.versions.node}`;
@@ -10636,16 +10648,16 @@ import { dirname as dirname4, join as join7 } from "node:path";
10636
10648
  import chalk3 from "chalk";
10637
10649
 
10638
10650
  // src/generated/skills.ts
10639
- var SKILLS_VERSION = "2.0.249";
10651
+ var SKILLS_VERSION = "2.0.251";
10640
10652
  var SKILLS = [
10641
10653
  {
10642
10654
  name: "autumn-setup",
10643
10655
  description: "First-time Autumn setup — install the atmn CLI, connect to an org (sign in, or keyless with no account), turn the user's pricing into autumn.config.ts, and push it to a sandbox org. Use when the user is new to Autumn, pastes an Autumn setup prompt, or asks to set up Autumn, add billing, monetization, subscriptions, usage-based billing, pricing, or plans. If Autumn is already set up, use autumn-catalog instead.",
10644
- version: "2.0.249",
10656
+ version: "2.0.251",
10645
10657
  markdown: `---
10646
10658
  name: autumn-setup
10647
10659
  description: First-time Autumn setup — install the atmn CLI, connect to an org (sign in, or keyless with no account), turn the user's pricing into autumn.config.ts, and push it to a sandbox org. Use when the user is new to Autumn, pastes an Autumn setup prompt, or asks to set up Autumn, add billing, monetization, subscriptions, usage-based billing, pricing, or plans. If Autumn is already set up, use autumn-catalog instead.
10648
- version: 2.0.249
10660
+ version: 2.0.251
10649
10661
  ---
10650
10662
 
10651
10663
  # Setup
@@ -10803,11 +10815,11 @@ Then stop. Don't keep building, don't tour the dashboard, don't deploy anything.
10803
10815
  {
10804
10816
  name: "autumn-catalog",
10805
10817
  description: "Modeling a user's pricing into an Autumn catalog — deciding the structure (plans, variants, add-ons, licenses, credit systems, pooled balances) before writing config, then filling in the numbers. Use when the user describes their pricing or asks to model, change, or push a catalog.",
10806
- version: "2.0.249",
10818
+ version: "2.0.251",
10807
10819
  markdown: `---
10808
10820
  name: autumn-catalog
10809
10821
  description: Modeling a user's pricing into an Autumn catalog — deciding the structure (plans, variants, add-ons, licenses, credit systems, pooled balances) before writing config, then filling in the numbers. Use when the user describes their pricing or asks to model, change, or push a catalog.
10810
- version: 2.0.249
10822
+ version: 2.0.251
10811
10823
  ---
10812
10824
 
10813
10825
  # Catalog
@@ -14679,11 +14691,11 @@ Pitch: "Pro $20/mo or $200/yr — 1,000 messages per month either way."
14679
14691
  },
14680
14692
  {
14681
14693
  path: "references/atmn.md",
14682
- contents: "# atmn catalog flows\n\nContents: commands · when to use it · the config is the catalog's state (versions, renames, drafts) · variants and licenses · config shapes · splitting the config · update loop · pull · webhooks · sandboxes and keys · what to show the user.\n\nUse `atmn` when a project has or should have an `autumn.config.ts` source of truth.\n\nCommands — these two, not `atmn preview` (that does not exist):\n\n```sh\natmn push # lints, then previews the diff; applies nothing\natmn push --yes # apply exactly what the preview showed\n```\n\n`push` without `--yes` is always a dry run, on a clean org too, and it never asks anything: `--yes` is the only gate. The commands that do ask (`init`, `login --keyless`, `sandbox use`, `skills install`) print the flag to pass instead whenever there is no TTY, which is every agent run; `--headless` forces that in a terminal.\n\n## When to use it\n\n- New project: run `atmn init`. It connects (sign in, or keyless), places the config, pulls whatever the org already holds, and installs these skills beside it.\n- Existing project: if `autumn.config.ts` exists, run `atmn pull` first so every row carries its server ids, then edit and push. Never rewrite a config that predates you from scratch.\n- Use MCP/API directly when the user wants dashboard/API-first changes or there is no local config workflow.\n\n## The config is the catalog's state\n\nThe document is the whole desired catalog for every collection it states. A plan or feature missing from a stated `plans` / `features` is a deletion (archived when customers depend on it). A collection left out entirely is not managed. That rule reaches down to versions: **a version row missing from `plans` is deleted too**.\n\nEvery version of a plan is a row in `plans`. Rows of one plan share a `planId`; each names its version with `versionSlug`; exactly one is `active: true` and the rest `active: false`. There is no history collection and no timeline — array order means nothing. What a version *is* (a group of customers, not a step in time) is the `autumn-concepts` skill's: read `references/plan.md` in the `autumn-concepts` skill. This file owns how rows express it.\n\nTwo fields make a row addressable:\n\n- `planId` + `versionSlug` — what you write. The pair names exactly one version. `versionSlug` is required on every plan row and every variant row, including a plan's only version; an omitted slug is a lint error, never an implicit `v1`.\n- `internalId` — the server's stable id. It is minted on the first `push --yes` and written back into the fixture; `pull` writes it for every row that lacks one. A fixture carrying it can be renamed (`planId`, `featureId`, `versionSlug`) and the server treats that as a rename, not a delete plus create.\n\n**This is where atmn differs from the API and the dashboard.** Those send one plan entry plus flags — `versioning`, `active`, `propagate` — as `references/catalog-update.md` describes. A config has none of those flags. The intent is read off the rows — which rows exist, which one is active, which carry an `internalId` — and the preview reports what the server derived. If the preview says something other than what you meant, change the rows and preview again; never look for a flag.\n\n| You want | Row edit | Preview shows |\n|---|---|---|\n| Change a version in place (active or history) | edit that row; keep its `versionSlug` and `internalId` | `~ pro@v1`, a migration for its customers |\n| The same change on every version | make the edit on every row of the plan | one `~` per row |\n| A new version; customers stay on the old one | add a row: same `planId`, new `versionSlug`, `active: true`, **no `internalId`**; flip the old row to `active: false` | `+ pro@v2`, and `active: true -> false` on the old row |\n| A draft nobody can buy yet | add the row with `active: false` beside the active one | `+` with no pointer move |\n| Rename the plan id | change `planId` on **every** row of the plan (all carry `internalId`) | a rename, not `-` + `+` |\n| Rename a version | change `versionSlug` on a row that carries `internalId` | `Version slug` rename |\n| Retire a version | remove its row | `-`; refused while customers are on it (it names both exits: migrate them, or archive the whole plan) |\n\nGuards the lint applies before anything is sent: a plan with no active row or two active rows (`mark the one customers can buy active: true and the rest active: false`), a missing `versionSlug`, the same `planId` + `versionSlug` twice. A plan whose only row is `active: false` is refused — a draft needs an active sibling.\n\nNumbers vs slugs: the server numbers versions in creation order and the preview labels rows with that number (`pro@v2`). The config never states numbers, only slugs. Push a `v1` row after `v2` already exists and the server numbers it higher; the slug still says `v1`. Never read a preview number back as the slug.\n\n## Variants and licenses\n\nWhat a variant's customize can change, when a base edit reaches a variant, and how a license link anchors to a child version are catalog-wide: `references/catalog-update.md`. What is atmn's:\n\n- A variant is an entry in its base row's `variants` array and a license link an entry in the parent row's `licenses` array: `variant({...})` and `license({...})` fixtures, inline or imported from their own files, edited in place there. Pull writes new ones in that form. Every entry the config lists is a declared overlay; there is no `propagate` in a config, so a base edit reaches a variant through the entry you write, not a follow flag.\n- Minting a base version means listing the variant entries again under the new base row, each with the new `versionSlug` and no `internalId`. The old entries stay under the old base row. One variant version cannot serve two base rows; the lint names both rows and says to version and relink the variant.\n- To retire a variant, set `archived: true` on its entry. A variant left out of the array is a deletion, refused while customers hold it.\n- Every `license({...})` states `versionSlug` — the lint refuses one without it — because the link is pinned to that child version and a config that names it links the same version in every environment. Pull writes it back. Minting a child version moves no parent; relinking a parent is editing that slug.\n\n## Config shapes\n\n`autumn.config.ts` uses the atmn package types, not raw API JSON. Field names are camelCase: `featureId`, `planId`, `billingMethod`, `billingUnits`, `freeTrial`, `intervalCount`, `versionSlug`. Follow the exported types from the package when editing config. Amounts are plain dollars: $20 is `20`, never `2000`.\n\nBuilders — `feature`, `plan`, `variant`, `license`. Items are plain objects on the plan; there is no `item()` builder and fixtures expose `featureId` / `planId`, never `.id`. A plan with an active `v2`, its `v1` kept for the customers still on it, each with an annual variant:\n\n```ts\nimport { atmn, feature, plan, variant } from \"atmn\";\n\nexport const messages = feature({\n featureId: \"messages\",\n name: \"Messages\",\n type: \"metered\",\n consumable: true,\n});\n\nexport const proAnnualV2 = variant({\n variantPlanId: \"pro_annual\",\n versionSlug: \"v2\",\n name: \"Pro Annual\",\n customize: { price: { amount: 250, interval: \"year\" } },\n});\n\nexport const proAnnualV1 = variant({\n variantPlanId: \"pro_annual\",\n versionSlug: \"v1\",\n name: \"Pro Annual\",\n customize: { price: { amount: 200, interval: \"year\" } },\n});\n\nexport const proV2 = plan({\n planId: \"pro\",\n versionSlug: \"v2\",\n active: true,\n name: \"Pro\",\n price: { amount: 25, interval: \"month\" },\n items: [{ featureId: messages.featureId, included: 10000, reset: { interval: \"month\" } }],\n variants: [proAnnualV2],\n});\n\nexport const proV1 = plan({\n internalId: \"prod_…\", // written back by push --yes / pull\n planId: \"pro\",\n versionSlug: \"v1\",\n active: false,\n name: \"Pro\",\n price: { amount: 20, interval: \"month\" },\n items: [{ featureId: messages.featureId, included: 5000, reset: { interval: \"month\" } }],\n variants: [proAnnualV1],\n});\n\nexport default atmn({ features: [messages], plans: [proV2, proV1] });\n```\n\nBefore `proV2` existed, `proV1` was the active row; minting `v2` was adding `proV2` without an `internalId` and flipping `proV1` to `active: false`.\n\nUsage-priced item:\n\n```ts\n{\n featureId: messages.featureId,\n included: 10000,\n reset: { interval: \"month\" },\n price: {\n amount: 0.9,\n billingMethod: \"usage_based\",\n billingUnits: 1000,\n interval: \"month\",\n },\n}\n```\n\n## Splitting the config\n\n`atmn init` scaffolds four files: `autumn.config.ts` (the root, `export default atmn({...})`), `features.ts`, `plans.ts`, `rewards.ts`. Every version of every plan lives in the `plans` array — active and history rows side by side. The config is ordinary TypeScript, so a row can be lifted into its own file under any export name and referenced from the array; `pull` follows imports and edits each fixture where it lives, and appends rows it has to add to the imported array. What it cannot do is edit a fixture that is not a plain literal — a spread, a helper call, a `.map()` — and it says so and writes nothing rather than guess.\n\n## Update loop\n\n1. Inspect or create `autumn.config.ts`.\n2. Edit the config to represent the desired catalog.\n3. Run `atmn push` to preview changes.\n4. Show the user the plan diffs, the customer impact, which plans mint a new version, and the draft migrations it would create. If the versioning is not what they meant, change the rows (table above) and preview again.\n5. Rerun `atmn push --yes` to apply the same preview.\n6. Report created/updated/deleted/archived features and plans, and the draft migrations the output lists. `push --yes` also writes `internalId` (and any `versionSlug` the server assigned) back into the fixtures — say so; those edits are expected.\n\nTwo notes push prints that are worth relaying: a plan removed while an id-less plan appears looks like a rename — pull first so the fixture carries its id; and a config still stating a deprecated field (`entityFeatureId`) gets a note naming the replacement.\n\n## Pull\n\n`atmn pull` writes the server's catalog back into the config in place: it flips `active` where the dashboard promoted a version, appends versions the config never mentioned, and backfills `internalId` and `versionSlug`. Run it after anyone touches the dashboard, and before editing a config you did not write. With no config yet, `pull` asks which folder to create it in; headless, it prints the `-c <dir>` hint and stops, so run `atmn init` or pass `-c` instead.\n\n`atmn pull --overwrite` is different: it rewrites `autumn.config.ts` and the `features.ts`, `plans.ts` and `rewards.ts` beside it from the server. It never deletes a file, and it leaves alone any file that does not import the package. It needs `--yes`, and it is the right move only when the config describes a different org than the key — the tell is `Your config no longer matches this org's catalog`. Anywhere else, a plain `pull` is what you want.\n\n## Webhooks\n\n`webhooks` in the config lists the Autumn webhooks it manages. Each `webhook()` is one endpoint in one environment, keyed by `env` and `id`. For every environment `push` syncs, the list is complete: `push` creates or updates the webhooks it states and deletes the ones it doesn't.\n\nTo register a webhook in several environments, write one `webhook()` per environment. The same `id` may repeat across environments:\n\n```ts\nimport { atmn, webhook } from \"atmn\";\n\nconst events = [\"billing.updated\", \"balances.limit_reached\"];\n\nexport default atmn({\n webhooks: [\n webhook({ id: \"billing\", env: \"live\", url: \"https://myapp.com/api/autumn\", events }), // atmn push -p\n webhook({ id: \"billing\", env: \"sandbox\", url: \"https://staging.myapp.com/api/autumn\", events }), // the default sandbox\n webhook({ id: \"billing\", env: \"qa-team\", url: \"https://qa.myapp.com/api/autumn\", events }), // the sandbox named qa-team\n ],\n});\n```\n\n- `env`: `live` for `-p`, `sandbox` for the default sandbox, or a named sandbox's slug (its name lowercased; no spaces). An environment with no entry has nothing registered. Never copy a sandbox URL into a `live` entry: ask the user for the production URL, or leave `live` out.\n- One `id` may appear once per `env`; a repeat in the same env is refused.\n- Configs from atmn 2.0.36–2.0.42 stated `url` as a map (`url: { live, sandbox }`). That shape is refused: split it into one `webhook()` per env.\n- Every URL must be https and publicly reachable; localhost and private networks are refused, tunnels such as ngrok work.\n- Leave `events` out to receive every event. Don't write `events: []`.\n- Vercel webhooks require their own distinct webhook and are a mutually exclusive variant to the rest. It can only listen to Vercel events and cannot later be changed to listen to non-Vercel events.\n- `id` is permanent: changing it registers a new webhook. In one env, two ids that differ only by case or `-`/`_` are refused.\n- A webhook made in the dashboard has no id of its own, so its entry uses the `ep_…` id `pull` writes. Keep that id: push updates that endpoint by it.\n- `push` syncs webhooks to every sandbox with a key in your env files (`AUTUMN_SECRET_KEY` → `sandbox`, each `AUTUMN_SANDBOX_<id>_SECRET_KEY` → its slug), each through its own key, whichever sandbox is pinned. The preview shows one `Webhooks · <env>` block per env with changes. A key that's rejected or belongs to another org skips its env with a warning. The catalog and settings still go to the targeted env only.\n- Production webhooks change only with `-p`, which syncs `live` and no sandbox. When `AUTUMN_PROD_SECRET_KEY` is set, a plain push also previews `live` read-only, and if production would change it prints `Production webhooks differ from your config (<ids>). Run atmn push -p to update production.` Relay that line, and run `-p` only when the user asks.\n- The preview gives a changed URL its own line (`billing url: old → new`). Read it out to the user before `--yes`.\n- Removing a `webhook()` entry deletes that endpoint on the next `push --yes`, dashboard-made ones included. The preview lists each one as `- <id> delete <url>` under its env; read those lines out to the user before `--yes`. Environments push doesn't sync (no key, a skipped key, or `live` without `-p`) are never deleted from, and a config with no `webhooks` key deletes nothing.\n- `push --yes` writes each new webhook's signing secret once and prints exactly where: `AUTUMN_WEBHOOK_<ID>_SECRET` in `.env.prod` for `-p`, `AUTUMN_WEBHOOK_<ID>_<SANDBOX_SLUG>_SECRET` in `.env.local` (or `.env`) for each sandbox (`AUTUMN_WEBHOOK_BILLING_SANDBOX_SECRET` for the default sandbox, `AUTUMN_WEBHOOK_BILLING_QA_TEAM_SECRET` for `qa-team`). Secrets saved earlier keep their existing names. If two sandboxes' names differ only by punctuation (`qa-team`, `qa_team`), they would share a variable, so push refuses before writing; ask the user to rename one. Relay the variable name and file; never print or read the secret.\n- `pull` reads webhooks from every env with a key in your env files (`AUTUMN_SECRET_KEY` → `sandbox`, `AUTUMN_PROD_SECRET_KEY` → `live`, each `AUTUMN_SANDBOX_<id>_SECRET_KEY` → its slug), whatever the target. A key that's rejected, belongs to another org, or whose sandbox is gone skips its env with a warning, and that env's entries stay. For each env it read, pull writes one entry per endpoint: it adds new ones (dashboard ones under their `ep_…` id), updates changed fields, and deletes an entry the server no longer has in that env. A value written as code (`process.env.X`) is never rewritten; pull warns when it differs from the server.\n\n## Sandboxes and keys\n\n- `atmn sandbox use <name>` pins a named sandbox; every command after it targets that sandbox until `atmn sandbox use --clear`.\n- `atmn reset --yes` empties the pinned sandbox; `atmn push --yes` rebuilds it from the config.\n- `atmn env --json` says which org, sandbox and key a command would hit, with `notes` on what to do when something is off.\n- A missing key fails fast and names the fix: `AUTUMN_SECRET_KEY is not set. Run atmn login, or atmn login --keyless if you don't have an account.` — hand that to the setup flow, don't ask the user to paste a key.\n\n## What to show the user\n\n- Which plans mint a new version, and the draft migrations that come with them.\n- Feature/plan/version deletions that will archive instead because dependencies or customers exist.\n- Which sandbox is pinned before applying anything."
14694
+ contents: "# atmn catalog flows\n\nContents: commands · when to use it · the config is the catalog's state (versions, renames, drafts) · variants and licenses · config shapes · splitting the config · update loop · pull · webhooks · sandboxes and keys · what to show the user.\n\nUse `atmn` when a project has or should have an `autumn.config.ts` source of truth.\n\nCommands — these, not `atmn preview` (that does not exist):\n\n```sh\natmn push # lints, then previews the diff; applies nothing\natmn push --yes # apply exactly what the preview showed\natmn push --safe # only create ids the env doesn't hold yet; add --yes to apply\n```\n\n`push` without `--yes` is always a dry run, on a clean org too, and it never asks anything: `--yes` is the only gate. The commands that do ask (`init`, `login --keyless`, `sandbox use`, `skills install`) print the flag to pass instead whenever there is no TTY, which is every agent run; `--headless` forces that in a terminal.\n\n`--safe` only ever adds. A plan, feature, reward, referral program or webhook is created only when its id doesn't exist yet in the target env; everything else is skipped and shown greyed under a `Safe mode` header. Edits, renames, new versions, new variants or items under an existing plan, and deletions are all skipped, and the settings lane is skipped entirely. If a new row needs an id that only a skipped change provides (a new plan using a renamed feature, say), the whole push is refused and names that change: push without `--safe` or split the change. A server too old to honour `--safe` is refused before anything is written. Use it when the user wants to add to a catalog without risking what is already there.\n\n## When to use it\n\n- New project: run `atmn init`. It connects (sign in, or keyless), places the config, pulls whatever the org already holds, and installs these skills beside it.\n- Existing project: if `autumn.config.ts` exists, run `atmn pull` first so every row carries its server ids, then edit and push. Never rewrite a config that predates you from scratch.\n- Use MCP/API directly when the user wants dashboard/API-first changes or there is no local config workflow.\n\n## The config is the catalog's state\n\nThe document is the whole desired catalog for every collection it states. A plan or feature missing from a stated `plans` / `features` is a deletion (archived when customers depend on it). A collection left out entirely is not managed. That rule reaches down to versions: **a version row missing from `plans` is deleted too**.\n\nEvery version of a plan is a row in `plans`. Rows of one plan share a `planId`; each names its version with `versionSlug`; exactly one is `active: true` and the rest `active: false`. There is no history collection and no timeline — array order means nothing. What a version *is* (a group of customers, not a step in time) is the `autumn-concepts` skill's: read `references/plan.md` in the `autumn-concepts` skill. This file owns how rows express it.\n\nTwo fields make a row addressable:\n\n- `planId` + `versionSlug` — what you write. The pair names exactly one version. `versionSlug` is required on every plan row and every variant row, including a plan's only version; an omitted slug is a lint error, never an implicit `v1`.\n- `internalId` — the server's stable id. It is minted on the first `push --yes` and written back into the fixture; `pull` writes it for every row that lacks one. A fixture carrying it can be renamed (`planId`, `featureId`, `versionSlug`) and the server treats that as a rename, not a delete plus create.\n\n**This is where atmn differs from the API and the dashboard.** Those send one plan entry plus flags — `versioning`, `active`, `propagate` — as `references/catalog-update.md` describes. A config has none of those flags. The intent is read off the rows — which rows exist, which one is active, which carry an `internalId` — and the preview reports what the server derived. If the preview says something other than what you meant, change the rows and preview again; never look for a flag.\n\n| You want | Row edit | Preview shows |\n|---|---|---|\n| Change a version in place (active or history) | edit that row; keep its `versionSlug` and `internalId` | `~ pro@v1`, a migration for its customers |\n| The same change on every version | make the edit on every row of the plan | one `~` per row |\n| A new version; customers stay on the old one | add a row: same `planId`, new `versionSlug`, `active: true`, **no `internalId`**; flip the old row to `active: false` | `+ pro@v2`, and `active: true -> false` on the old row |\n| A draft nobody can buy yet | add the row with `active: false` beside the active one | `+` with no pointer move |\n| Rename the plan id | change `planId` on **every** row of the plan (all carry `internalId`) | a rename, not `-` + `+` |\n| Rename a version | change `versionSlug` on a row that carries `internalId` | `Version slug` rename |\n| Retire a version | remove its row | `-`; refused while customers are on it (it names both exits: migrate them, or archive the whole plan) |\n\nGuards the lint applies before anything is sent: a plan with no active row or two active rows (`mark the one customers can buy active: true and the rest active: false`), a missing `versionSlug`, the same `planId` + `versionSlug` twice. A plan whose only row is `active: false` is refused — a draft needs an active sibling.\n\nNumbers vs slugs: the server numbers versions in creation order and the preview labels rows with that number (`pro@v2`). The config never states numbers, only slugs. Push a `v1` row after `v2` already exists and the server numbers it higher; the slug still says `v1`. Never read a preview number back as the slug.\n\n## Variants and licenses\n\nWhat a variant's customize can change, when a base edit reaches a variant, and how a license link anchors to a child version are catalog-wide: `references/catalog-update.md`. What is atmn's:\n\n- A variant is an entry in its base row's `variants` array and a license link an entry in the parent row's `licenses` array: `variant({...})` and `license({...})` fixtures, inline or imported from their own files, edited in place there. Pull writes new ones in that form. Every entry the config lists is a declared overlay; there is no `propagate` in a config, so a base edit reaches a variant through the entry you write, not a follow flag.\n- Minting a base version means listing the variant entries again under the new base row, each with the new `versionSlug` and no `internalId`. The old entries stay under the old base row. One variant version cannot serve two base rows; the lint names both rows and says to version and relink the variant.\n- To retire a variant, set `archived: true` on its entry. A variant left out of the array is a deletion, refused while customers hold it.\n- Every `license({...})` states `versionSlug` — the lint refuses one without it — because the link is pinned to that child version and a config that names it links the same version in every environment. Pull writes it back. Minting a child version moves no parent; relinking a parent is editing that slug.\n\n## Config shapes\n\n`autumn.config.ts` uses the atmn package types, not raw API JSON. Field names are camelCase: `featureId`, `planId`, `billingMethod`, `billingUnits`, `freeTrial`, `intervalCount`, `versionSlug`. Follow the exported types from the package when editing config. Amounts are plain dollars: $20 is `20`, never `2000`.\n\nBuilders — `feature`, `plan`, `variant`, `license`. Items are plain objects on the plan; there is no `item()` builder and fixtures expose `featureId` / `planId`, never `.id`. A plan with an active `v2`, its `v1` kept for the customers still on it, each with an annual variant:\n\n```ts\nimport { atmn, feature, plan, variant } from \"atmn\";\n\nexport const messages = feature({\n featureId: \"messages\",\n name: \"Messages\",\n type: \"metered\",\n consumable: true,\n});\n\nexport const proAnnualV2 = variant({\n variantPlanId: \"pro_annual\",\n versionSlug: \"v2\",\n name: \"Pro Annual\",\n customize: { price: { amount: 250, interval: \"year\" } },\n});\n\nexport const proAnnualV1 = variant({\n variantPlanId: \"pro_annual\",\n versionSlug: \"v1\",\n name: \"Pro Annual\",\n customize: { price: { amount: 200, interval: \"year\" } },\n});\n\nexport const proV2 = plan({\n planId: \"pro\",\n versionSlug: \"v2\",\n active: true,\n name: \"Pro\",\n price: { amount: 25, interval: \"month\" },\n items: [{ featureId: messages.featureId, included: 10000, reset: { interval: \"month\" } }],\n variants: [proAnnualV2],\n});\n\nexport const proV1 = plan({\n internalId: \"prod_…\", // written back by push --yes / pull\n planId: \"pro\",\n versionSlug: \"v1\",\n active: false,\n name: \"Pro\",\n price: { amount: 20, interval: \"month\" },\n items: [{ featureId: messages.featureId, included: 5000, reset: { interval: \"month\" } }],\n variants: [proAnnualV1],\n});\n\nexport default atmn({ features: [messages], plans: [proV2, proV1] });\n```\n\nBefore `proV2` existed, `proV1` was the active row; minting `v2` was adding `proV2` without an `internalId` and flipping `proV1` to `active: false`.\n\nUsage-priced item:\n\n```ts\n{\n featureId: messages.featureId,\n included: 10000,\n reset: { interval: \"month\" },\n price: {\n amount: 0.9,\n billingMethod: \"usage_based\",\n billingUnits: 1000,\n interval: \"month\",\n },\n}\n```\n\n## Splitting the config\n\n`atmn init` scaffolds four files: `autumn.config.ts` (the root, `export default atmn({...})`), `features.ts`, `plans.ts`, `rewards.ts`. Every version of every plan lives in the `plans` array — active and history rows side by side. The config is ordinary TypeScript, so a row can be lifted into its own file under any export name and referenced from the array; `pull` follows imports and edits each fixture where it lives, and appends rows it has to add to the imported array. What it cannot do is edit a fixture that is not a plain literal — a spread, a helper call, a `.map()` — and it says so and writes nothing rather than guess.\n\n## Update loop\n\n1. Inspect or create `autumn.config.ts`.\n2. Edit the config to represent the desired catalog.\n3. Run `atmn push` to preview changes.\n4. Show the user the plan diffs, the customer impact, which plans mint a new version, and the draft migrations it would create. If the versioning is not what they meant, change the rows (table above) and preview again.\n5. Rerun `atmn push --yes` to apply the same preview.\n6. Report created/updated/deleted/archived features and plans, and the draft migrations the output lists. `push --yes` also writes `internalId` (and any `versionSlug` the server assigned) back into the fixtures — say so; those edits are expected.\n\nTwo notes push prints that are worth relaying: a plan removed while an id-less plan appears looks like a rename — pull first so the fixture carries its id; and a config still stating a deprecated field (`entityFeatureId`) gets a note naming the replacement.\n\n## Pull\n\n`atmn pull` writes the server's catalog back into the config in place: it flips `active` where the dashboard promoted a version, appends versions the config never mentioned, and backfills `internalId` and `versionSlug`. Run it after anyone touches the dashboard, and before editing a config you did not write. With no config yet, `pull` asks which folder to create it in; headless, it prints the `-c <dir>` hint and stops, so run `atmn init` or pass `-c` instead.\n\n`atmn pull --overwrite` is different: it rewrites `autumn.config.ts` and the `features.ts`, `plans.ts` and `rewards.ts` beside it from the server. It never deletes a file, and it leaves alone any file that does not import the package. It needs `--yes`, and it is the right move only when the config describes a different org than the key — the tell is `Your config no longer matches this org's catalog`. Anywhere else, a plain `pull` is what you want.\n\n## Webhooks\n\n`webhooks` in the config lists the Autumn webhooks it manages. Each `webhook()` is one endpoint in one environment, keyed by `env` and `id`. For every environment `push` syncs, the list is complete: `push` creates or updates the webhooks it states and deletes the ones it doesn't.\n\nTo register a webhook in several environments, write one `webhook()` per environment. The same `id` may repeat across environments:\n\n```ts\nimport { atmn, webhook } from \"atmn\";\n\nconst events = [\"billing.updated\", \"balances.limit_reached\"];\n\nexport default atmn({\n webhooks: [\n webhook({ id: \"billing\", env: \"live\", url: \"https://myapp.com/api/autumn\", events }), // atmn push -p\n webhook({ id: \"billing\", env: \"sandbox\", url: \"https://staging.myapp.com/api/autumn\", events }), // the default sandbox\n webhook({ id: \"billing\", env: \"qa-team\", url: \"https://qa.myapp.com/api/autumn\", events }), // the sandbox named qa-team\n ],\n});\n```\n\n- `env`: `live` for `-p`, `sandbox` for the default sandbox, or a named sandbox's slug (its name lowercased; no spaces). An environment with no entry has nothing registered. Never copy a sandbox URL into a `live` entry: ask the user for the production URL, or leave `live` out.\n- One `id` may appear once per `env`; a repeat in the same env is refused.\n- Configs from atmn 2.0.36–2.0.42 stated `url` as a map (`url: { live, sandbox }`). That shape is refused: split it into one `webhook()` per env.\n- Every URL must be https and publicly reachable; localhost and private networks are refused, tunnels such as ngrok work.\n- Leave `events` out to receive every event. Don't write `events: []`.\n- Vercel webhooks require their own distinct webhook and are a mutually exclusive variant to the rest. It can only listen to Vercel events and cannot later be changed to listen to non-Vercel events.\n- `id` is permanent: changing it registers a new webhook. In one env, two ids that differ only by case or `-`/`_` are refused.\n- A webhook made in the dashboard has no id of its own, so its entry uses the `ep_…` id `pull` writes. Keep that id: push updates that endpoint by it.\n- `push` syncs webhooks to every sandbox with a key in your env files (`AUTUMN_SECRET_KEY` → `sandbox`, each `AUTUMN_SANDBOX_<id>_SECRET_KEY` → its slug), each through its own key, whichever sandbox is pinned. The preview shows one `Webhooks · <env>` block per env with changes. A key that's rejected or belongs to another org skips its env with a warning. The catalog and settings still go to the targeted env only.\n- Production webhooks change only with `-p`, which syncs `live` and no sandbox. When `AUTUMN_PROD_SECRET_KEY` is set, a plain push also previews `live` read-only, and if production would change it prints `Production webhooks differ from your config (<ids>). Run atmn push -p to update production.` Relay that line, and run `-p` only when the user asks.\n- The preview gives a changed URL its own line (`billing url: old → new`). Read it out to the user before `--yes`.\n- Removing a `webhook()` entry deletes that endpoint on the next `push --yes`, dashboard-made ones included. The preview lists each one as `- <id> delete <url>` under its env; read those lines out to the user before `--yes`. Environments push doesn't sync (no key, a skipped key, or `live` without `-p`) are never deleted from, and a config with no `webhooks` key deletes nothing.\n- `push --yes` writes each new webhook's signing secret once and prints exactly where: `AUTUMN_WEBHOOK_<ID>_SECRET` in `.env.prod` for `-p`, `AUTUMN_WEBHOOK_<ID>_<SANDBOX_SLUG>_SECRET` in `.env.local` (or `.env`) for each sandbox (`AUTUMN_WEBHOOK_BILLING_SANDBOX_SECRET` for the default sandbox, `AUTUMN_WEBHOOK_BILLING_QA_TEAM_SECRET` for `qa-team`). Secrets saved earlier keep their existing names. If two sandboxes' names differ only by punctuation (`qa-team`, `qa_team`), they would share a variable, so push refuses before writing; ask the user to rename one. Relay the variable name and file; never print or read the secret.\n- `pull` reads webhooks from every env with a key in your env files (`AUTUMN_SECRET_KEY` → `sandbox`, `AUTUMN_PROD_SECRET_KEY` → `live`, each `AUTUMN_SANDBOX_<id>_SECRET_KEY` → its slug), whatever the target. A key that's rejected, belongs to another org, or whose sandbox is gone skips its env with a warning, and that env's entries stay. For each env it read, pull writes one entry per endpoint: it adds new ones (dashboard ones under their `ep_…` id), updates changed fields, and deletes an entry the server no longer has in that env. A value written as code (`process.env.X`) is never rewritten; pull warns when it differs from the server.\n\n## Sandboxes and keys\n\n- `atmn sandbox use <name>` pins a named sandbox; every command after it targets that sandbox until `atmn sandbox use --clear`.\n- `atmn reset --yes` empties the pinned sandbox; `atmn push --yes` rebuilds it from the config.\n- `atmn env --json` says which org, sandbox and key a command would hit, with `notes` on what to do when something is off.\n- A missing key fails fast and names the fix: `AUTUMN_SECRET_KEY is not set. Run atmn login, or atmn login --keyless if you don't have an account.` — hand that to the setup flow, don't ask the user to paste a key.\n\n## What to show the user\n\n- Which plans mint a new version, and the draft migrations that come with them.\n- Feature/plan/version deletions that will archive instead because dependencies or customers exist.\n- Which sandbox is pinned before applying anything."
14683
14695
  },
14684
14696
  {
14685
14697
  path: "references/catalog-update.md",
14686
- contents: "# Catalog update flow\n\nContents: ground rules · the update model (desired state, two ways to state it, addressing a row, versioning, variants, licenses, features) · loop · reading the preview · deciding per plan · what to report.\n\nUse this when customers are on these plans and the user wants to change pricing or plans. A half-built config from a setup session is not this — keep building with the normal workflow. What a version, a draft and `active` mean is the `autumn-concepts` skill's: read `references/plan.md` in the `autumn-concepts` skill. How rows in `autumn.config.ts` express the same intents: `references/atmn.md`.\n\n## Ground rules\n\n- Never run the new-catalog interview against a live catalog. Read the current catalog first; it is the truth to diff against, not a draft to replace.\n- Touch only what the change names. Every other plan, item and id stays byte-identical — rewriting untouched plans is the classic update failure.\n- Match the existing catalog's patterns; if sibling plans model a thing one way, the change follows that way.\n- The questions are \"who's affected\", not \"what do you sell\": new version or edit in place? all versions? which variants and license parents follow? migrate customers or grandfather them?\n- Structural changes (\"add seats\", \"make credits shared\") re-enter the Shape forks exactly as a new catalog would.\n- Preview before every write; apply only the exact previewed params.\n\n## The update model\n\nRead with `catalogV2.get` (`include_versions: true` to see every version). Preview with `catalogV2.preview_update`, apply with `catalogV2.update` — the same params, so a preview is always exactly what apply would do. `catalogV2.diff` is a read-only delta with no write validation, for reconciling a local copy.\n\n**The payload is desired state, per collection.** `features`, `plans`, `rewards`, `referral_programs`: a collection left out is untouched. With `skip_deletions: false` a stated collection is complete and anything missing from it is removed; with `skip_version_deletions: false` the same holds for a stated plan's versions. Removal archives rather than deletes whenever customers hold the row. `remove_plans` (optionally pinned to one version) and `remove_features` remove by name under the default; `skip_plan_ids` shields plans from a complete payload.\n\n**Two ways to state a change.** A targeted payload states only the plan being changed and says who follows through `propagate` — that is how the dashboard and API or MCP callers work. A whole-catalog payload states every plan, every version and every variant, and flips both `skip_*_deletions` off — that is what `autumn.config.ts` sends. Both reach the same server; pick the one matching the surface you are on and don't mix them.\n\n**If the surface is atmn**, the same model applies with these differences, which decide whether an edit does what you meant (mechanics in `references/atmn.md`):\n\n- The config is the complete state of every collection it names. A plan, version or variant left out is a deletion, not \"unchanged\".\n- There are no `versioning`, `propagate` or follow flags. Intent is read off the rows: a row with a new `versionSlug` and no `internalId` mints a version, flipping `active` promotes, every variant the base lists is an explicit overlay, and a license link names its child version.\n- Rows are addressed by the stable `internalId` the CLI writes back after `push --yes` and `pull`. Renaming a plan id, feature id or version slug is safe only on a row that carries it — so run `atmn pull` before editing a config you did not write.\n- The lint runs before anything is sent, and preview then apply are `atmn push` and `atmn push --yes` with the same config, so a push previews exactly what it would apply.\n\n**Addressing a row.** `plan_id` names the plan; `version_slug` pins one version, and omitting it targets the active row. `internal_id` addresses a row by its stable id, which is what makes `plan_id` and `version_slug` renames safe; without it, `new_plan_id` renames and is blocked while customers or reward programs reference the id.\n\n**Versioning.** `versioning` is `existing` (default: edit the addressed row), `all_versions` (the same edit on every version), or `new_version` (mint the next version; customers stay where they are). `active: true` promotes the minted row; omit it to mint a draft. `new_version_slug` names the minted row. `migration: { draft: true }` creates a migration draft for customers on an in-place or all-versions edit; it is rejected with `new_version`, because minting is the choice to leave customers alone.\n\n**Variants.** They live under the base entry's `variants[]`, never as top-level plans. Each entry is a declared overlay: `customize.items` replaces the item list, `add_items` / `remove_items` patch it, `price` and `free_trial` override. Declaring an entry is not the same as following: a base edit reaches a variant only when `propagate.variants` names it (pinned by `version_slug`), and relatives not named are frozen. When the base mints a new version, a following or overlaid variant with customers mints its next version too. To retire a variant, set `archived: true` on its entry. Nesting an entry under a base links it there; `base_variant_id: null` detaches it.\n\n**Licenses.** A parent's `licenses[]` entry names `license_plan_id`, `included`, `prepaid_only`, an optional `version_slug` and a `customize` (price, add or remove items). A link is pinned to one child version, named by `version_slug`. Versioning the child moves no parent: moving a parent onto the new child version is an explicit change to its link. `propagate.license_parents` lets named parents follow a child edit; anything not named stays pinned. The preview's `license_parents` lists the parents pointing at a child row being changed.\n\n**Features.** `new_feature_id` renames; `archived` archives or restores. A plan may reference a feature stated in the same payload.\n\n## Loop\n\n1. Read the current catalog and the proposed change.\n2. Build params for only what changes.\n3. Preview. Never skip this before a write.\n4. Summarize what the preview reports (below) and settle the decisions per plan.\n5. If anything changed, revise and preview again.\n6. Apply with the exact previewed params, under the global write-approval rules.\n7. Report, including any migration draft — it moves nobody until it is reviewed and run.\n\n## Reading the preview\n\nPer plan entry:\n\n- `action` is per plan id: `create` means no live version existed, `update` covers edits and minting alike; `will_archive` says a removal archives instead. `state.usage` carries capped customer counts; `state.reasons` are ready-made lines for why something archives or is blocked.\n- `versioning` says what actually happens (`new_version` is null when an existing row is edited) and `options` lists the strategies available for this plan today — offer only those.\n- `sibling_versions`: the other versions that could receive the same edit, each with the slots it had diverged on that the edit would overwrite.\n- `variants[]`: each resolved as `unchanged` (frozen), `propagated` (followed) or `explicit` (the payload declared it), with conflicts — slots the variant already overrides. Conflicts inform the decision; they never block.\n- `license_parents[]`: the same three states for parents whose link points at this row.\n- Feature entries carry blockers that would reject the update; check them before applying.\n- Top level: the migration drafts the update would create.\n\n## Deciding, per plan\n\n1. **Versioning.** If the change touches no base price and no priced item, edit in place (`existing`, or `all_versions` when every customer group should get it) and say so — no question needed. If it changes a base price or a priced item on a plan with customers, ask: new version (they keep their terms) or in place plus a migration draft (they move to the new terms)? Offer only what `options` lists.\n2. **Relatives.** Default to following conflict-free variants and license parents; ask before following into a conflict, showing what would be overwritten.\n3. **Migration.** For an in-place edit on a plan with customers, offer the draft. Never create one alongside `new_version`.\n\n## What to report\n\nWhich plans mint a new version and which are edited in place; which variants and parents follow; deletions that archive because customers or dependencies exist; and the migration drafts created, with the reminder that they still have to be run."
14698
+ contents: "# Catalog update flow\n\nContents: ground rules · the update model (desired state, two ways to state it, addressing a row, versioning, variants, licenses, features) · loop · reading the preview · deciding per plan · what to report.\n\nUse this when customers are on these plans and the user wants to change pricing or plans. A half-built config from a setup session is not this — keep building with the normal workflow. What a version, a draft and `active` mean is the `autumn-concepts` skill's: read `references/plan.md` in the `autumn-concepts` skill. How rows in `autumn.config.ts` express the same intents: `references/atmn.md`.\n\n## Ground rules\n\n- Never run the new-catalog interview against a live catalog. Read the current catalog first; it is the truth to diff against, not a draft to replace.\n- Touch only what the change names. Every other plan, item and id stays byte-identical — rewriting untouched plans is the classic update failure.\n- Match the existing catalog's patterns; if sibling plans model a thing one way, the change follows that way.\n- The questions are \"who's affected\", not \"what do you sell\": new version or edit in place? all versions? which variants and license parents follow? migrate customers or grandfather them?\n- Structural changes (\"add seats\", \"make credits shared\") re-enter the Shape forks exactly as a new catalog would.\n- Preview before every write; apply only the exact previewed params.\n\n## The update model\n\nRead with `catalogV2.get` (`include_versions: true` to see every version). Preview with `catalogV2.preview_update`, apply with `catalogV2.update` — the same params, so a preview is always exactly what apply would do. `catalogV2.diff` is a read-only delta with no write validation, for reconciling a local copy.\n\n**The payload is desired state, per collection.** `features`, `plans`, `rewards`, `referral_programs`: a collection left out is untouched. With `skip_deletions: false` a stated collection is complete and anything missing from it is removed; with `skip_version_deletions: false` the same holds for a stated plan's versions. Removal archives rather than deletes whenever customers hold the row. `remove_plans` (optionally pinned to one version) and `remove_features` remove by name under the default; `skip_plan_ids` shields plans from a complete payload. `skip_updates: true` keeps only creates of ids the env doesn't hold yet: every other row previews as `skip` and is never written, and the preview echoes `skip_updates` back.\n\n**Two ways to state a change.** A targeted payload states only the plan being changed and says who follows through `propagate` — that is how the dashboard and API or MCP callers work. A whole-catalog payload states every plan, every version and every variant, and flips both `skip_*_deletions` off — that is what `autumn.config.ts` sends. Both reach the same server; pick the one matching the surface you are on and don't mix them.\n\n**If the surface is atmn**, the same model applies with these differences, which decide whether an edit does what you meant (mechanics in `references/atmn.md`):\n\n- The config is the complete state of every collection it names. A plan, version or variant left out is a deletion, not \"unchanged\".\n- There are no `versioning`, `propagate` or follow flags. Intent is read off the rows: a row with a new `versionSlug` and no `internalId` mints a version, flipping `active` promotes, every variant the base lists is an explicit overlay, and a license link names its child version.\n- Rows are addressed by the stable `internalId` the CLI writes back after `push --yes` and `pull`. Renaming a plan id, feature id or version slug is safe only on a row that carries it — so run `atmn pull` before editing a config you did not write.\n- The lint runs before anything is sent, and preview then apply are `atmn push` and `atmn push --yes` with the same config, so a push previews exactly what it would apply.\n\n**Addressing a row.** `plan_id` names the plan; `version_slug` pins one version, and omitting it targets the active row. `internal_id` addresses a row by its stable id, which is what makes `plan_id` and `version_slug` renames safe; without it, `new_plan_id` renames and is blocked while customers or reward programs reference the id.\n\n**Versioning.** `versioning` is `existing` (default: edit the addressed row), `all_versions` (the same edit on every version), or `new_version` (mint the next version; customers stay where they are). `active: true` promotes the minted row; omit it to mint a draft. `new_version_slug` names the minted row. `migration: { draft: true }` creates a migration draft for customers on an in-place or all-versions edit; it is rejected with `new_version`, because minting is the choice to leave customers alone.\n\n**Variants.** They live under the base entry's `variants[]`, never as top-level plans. Each entry is a declared overlay: `customize.items` replaces the item list, `add_items` / `remove_items` patch it, `price` and `free_trial` override. Declaring an entry is not the same as following: a base edit reaches a variant only when `propagate.variants` names it (pinned by `version_slug`), and relatives not named are frozen. When the base mints a new version, a following or overlaid variant with customers mints its next version too. To retire a variant, set `archived: true` on its entry. Nesting an entry under a base links it there; `base_variant_id: null` detaches it.\n\n**Licenses.** A parent's `licenses[]` entry names `license_plan_id`, `included`, `prepaid_only`, an optional `version_slug` and a `customize` (price, add or remove items). A link is pinned to one child version, named by `version_slug`. Versioning the child moves no parent: moving a parent onto the new child version is an explicit change to its link. `propagate.license_parents` lets named parents follow a child edit; anything not named stays pinned. The preview's `license_parents` lists the parents pointing at a child row being changed.\n\n**Features.** `new_feature_id` renames; `archived` archives or restores. A plan may reference a feature stated in the same payload.\n\n## Loop\n\n1. Read the current catalog and the proposed change.\n2. Build params for only what changes.\n3. Preview. Never skip this before a write.\n4. Summarize what the preview reports (below) and settle the decisions per plan.\n5. If anything changed, revise and preview again.\n6. Apply with the exact previewed params, under the global write-approval rules.\n7. Report, including any migration draft — it moves nobody until it is reviewed and run.\n\n## Reading the preview\n\nPer plan entry:\n\n- `action` is per plan id: `create` means no live version existed, `update` covers edits and minting alike; `will_archive` says a removal archives instead. `state.usage` carries capped customer counts; `state.reasons` are ready-made lines for why something archives or is blocked.\n- `versioning` says what actually happens (`new_version` is null when an existing row is edited) and `options` lists the strategies available for this plan today — offer only those.\n- `sibling_versions`: the other versions that could receive the same edit, each with the slots it had diverged on that the edit would overwrite.\n- `variants[]`: each resolved as `unchanged` (frozen), `propagated` (followed) or `explicit` (the payload declared it), with conflicts — slots the variant already overrides. Conflicts inform the decision; they never block.\n- `license_parents[]`: the same three states for parents whose link points at this row.\n- Feature entries carry blockers that would reject the update; check them before applying.\n- Top level: the migration drafts the update would create.\n\n## Deciding, per plan\n\n1. **Versioning.** If the change touches no base price and no priced item, edit in place (`existing`, or `all_versions` when every customer group should get it) and say so — no question needed. If it changes a base price or a priced item on a plan with customers, ask: new version (they keep their terms) or in place plus a migration draft (they move to the new terms)? Offer only what `options` lists.\n2. **Relatives.** Default to following conflict-free variants and license parents; ask before following into a conflict, showing what would be overwritten.\n3. **Migration.** For an in-place edit on a plan with customers, offer the draft. Never create one alongside `new_version`.\n\n## What to report\n\nWhich plans mint a new version and which are edited in place; which variants and parents follow; deletions that archive because customers or dependencies exist; and the migration drafts created, with the reminder that they still have to be run."
14687
14699
  },
14688
14700
  {
14689
14701
  path: "references/rewards.md",
@@ -14694,11 +14706,11 @@ Pitch: "Pro $20/mo or $200/yr — 1,000 messages per month either way."
14694
14706
  {
14695
14707
  name: "autumn-integrate",
14696
14708
  description: "Integrating Autumn into an app's backend — creating customers, billing flows (attach, checkout, upgrade, cancel), gating features with check, recording usage with track, and exposing billing data to the frontend. Use when the user asks to integrate Autumn, add billing/payments to their app, gate features, meter usage, or build checkout/upgrade flows. Requires a pushed catalog; use autumn-catalog first if plans don't exist yet.",
14697
- version: "2.0.249",
14709
+ version: "2.0.251",
14698
14710
  markdown: `---
14699
14711
  name: autumn-integrate
14700
14712
  description: Integrating Autumn into an app's backend — creating customers, billing flows (attach, checkout, upgrade, cancel), gating features with check, recording usage with track, and exposing billing data to the frontend. Use when the user asks to integrate Autumn, add billing/payments to their app, gate features, meter usage, or build checkout/upgrade flows. Requires a pushed catalog; use autumn-catalog first if plans don't exist yet.
14701
- version: 2.0.249
14713
+ version: 2.0.251
14702
14714
  ---
14703
14715
 
14704
14716
  # Integrate
@@ -19417,11 +19429,11 @@ Monitor your logs for this message. If you see it, check [status.useautumn.com](
19417
19429
  {
19418
19430
  name: "autumn-concepts",
19419
19431
  description: "Understanding Autumn's billing objects before acting on them — what a plan version is and what active means, when a trial starts or ends billing, how entity- and seat-scoped subscriptions differ from the customer's own, what a customize diff actually changes, and how caps, overage, and top-ups behave. Load before versioning, editing, or drafting a plan, or when a customer's state does not match the plain reading of their plan.",
19420
- version: "2.0.249",
19432
+ version: "2.0.251",
19421
19433
  markdown: `---
19422
19434
  name: autumn-concepts
19423
19435
  description: Understanding Autumn's billing objects before acting on them — what a plan version is and what active means, when a trial starts or ends billing, how entity- and seat-scoped subscriptions differ from the customer's own, what a customize diff actually changes, and how caps, overage, and top-ups behave. Load before versioning, editing, or drafting a plan, or when a customer's state does not match the plain reading of their plan.
19424
- version: 2.0.249
19436
+ version: 2.0.251
19425
19437
  ---
19426
19438
 
19427
19439
  # Concepts
@@ -24104,9 +24116,10 @@ var PREVIOUS_ATTRIBUTE_LABELS = {
24104
24116
 
24105
24117
  // src/render/renderWebhooks.ts
24106
24118
  import chalk4 from "chalk";
24119
+ var isWrite = (change) => change.action !== "unmanaged" && change.action !== "skip";
24107
24120
  var webhooksHaveWork = ({
24108
24121
  webhooks
24109
- }) => (webhooks?.changes ?? []).some((change) => change.action !== "unmanaged");
24122
+ }) => (webhooks?.changes ?? []).some(isWrite);
24110
24123
  var DETAIL_INDENT = " ";
24111
24124
  var list2 = (values) => values.length === 0 ? "every event" : values.join(", ");
24112
24125
  var updateDetails = ({
@@ -24154,6 +24167,8 @@ var renderChange = ({ change }) => {
24154
24167
  return [
24155
24168
  ` ${chalk4.red(`- ${change.id}`)} ${chalk4.bold("delete")}${chalk4.dim(` ${change.webhook.url}`)}`
24156
24169
  ];
24170
+ if (change.action === "skip")
24171
+ return [chalk4.dim(` · ${change.id} skipped (would ${change.skipped})`)];
24157
24172
  return [
24158
24173
  chalk4.dim(` · ${change.id} unmanaged (not in your config; atmn leaves it alone)`)
24159
24174
  ];
@@ -24164,7 +24179,7 @@ var renderWebhooks = ({
24164
24179
  const rows = webhooks.changes.flatMap((change) => renderChange({ change }));
24165
24180
  if (rows.length === 0)
24166
24181
  return null;
24167
- const count = webhooks.changes.filter((change) => change.action !== "unmanaged").length;
24182
+ const count = webhooks.changes.filter(isWrite).length;
24168
24183
  const heading = webhooks.env === undefined ? `Webhooks (${count})` : `Webhooks · ${webhooks.env} (${count})`;
24169
24184
  return [chalk4.bold(heading), ...rows].join(`
24170
24185
  `);
@@ -24418,6 +24433,12 @@ var rowHasWork = (row) => isChange(row) || Object.values(row).some((value) => Ar
24418
24433
  var DETAIL_INDENT2 = " ";
24419
24434
  var VARIANT_INDENT = DETAIL_INDENT2;
24420
24435
  var planRowId = (row) => row.version === undefined ? row.planId ?? "?" : `${row.planId}@v${row.version}`;
24436
+ var skippedLine = ({
24437
+ id,
24438
+ label,
24439
+ indent = " "
24440
+ }) => `${indent}${chalk5.dim(`· ${id}${label && label !== id ? ` ${label}` : ""} skipped`)}`;
24441
+ var SAFE_MODE_HEADER = "Safe mode: only ids that don't exist yet are created. Updates and deletions are skipped.";
24421
24442
  var contextLine = ({
24422
24443
  id,
24423
24444
  label,
@@ -24492,6 +24513,8 @@ var isMintedVersion = (plan) => plan.versioning?.resolved === "new_version" || p
24492
24513
  var isFreshRow = (plan) => plan.action === "create" || isMintedVersion(plan);
24493
24514
  var renderPlanRow = ({ plan }) => {
24494
24515
  const id = planRowId(plan);
24516
+ if (plan.action === "skip")
24517
+ return [skippedLine({ id, label: plan.name })];
24495
24518
  const fresh = isFreshRow(plan);
24496
24519
  return [
24497
24520
  isChange(plan) ? line({ action: fresh ? "create" : plan.action, id, label: plan.name }) : contextLine({ id, label: plan.name }),
@@ -24589,10 +24612,12 @@ var renderPreview = ({
24589
24612
  preview,
24590
24613
  migrationLinkBase
24591
24614
  }) => {
24592
- const features = (preview.features ?? []).filter(rowHasWork);
24593
- const plans = (preview.plans ?? []).filter(rowHasWork);
24594
- const rewards = (preview.rewards ?? []).filter(rowHasWork);
24595
- const referralPrograms = (preview.referralPrograms ?? []).filter(rowHasWork);
24615
+ const safe = preview.skipUpdates === true;
24616
+ const shown = (row) => rowHasWork(row) || safe && row.action === "skip";
24617
+ const features = (preview.features ?? []).filter(shown);
24618
+ const plans = (preview.plans ?? []).filter(shown);
24619
+ const rewards = (preview.rewards ?? []).filter(shown);
24620
+ const referralPrograms = (preview.referralPrograms ?? []).filter(shown);
24596
24621
  const migrations = preview.migrations ?? [];
24597
24622
  const settings = settingChanges(preview.settings);
24598
24623
  const webhooks = (preview.webhooks ?? []).map((lane) => renderWebhooks({ webhooks: lane })).filter((block) => block !== null);
@@ -24601,7 +24626,7 @@ var renderPreview = ({
24601
24626
  if (features.length === 0 && plans.length === 0 && rewards.length === 0 && referralPrograms.length === 0 && settings.length === 0 && webhooks.length === 0 && productionHint === null) {
24602
24627
  return chalk5.dim("No changes. Your catalog matches your config.");
24603
24628
  }
24604
- const sections = [];
24629
+ const sections = safe ? [chalk5.bold(SAFE_MODE_HEADER)] : [];
24605
24630
  if (settings.length > 0) {
24606
24631
  sections.push([
24607
24632
  chalk5.bold(`Settings (${settings.length})`),
@@ -24612,7 +24637,12 @@ var renderPreview = ({
24612
24637
  if (features.length > 0) {
24613
24638
  sections.push([
24614
24639
  chalk5.bold(`Features (${features.length})`),
24615
- ...features.flatMap((feature) => [
24640
+ ...features.flatMap((feature) => feature.action === "skip" ? [
24641
+ skippedLine({
24642
+ id: feature.featureId ?? "?",
24643
+ label: feature.name
24644
+ })
24645
+ ] : [
24616
24646
  line({
24617
24647
  action: feature.action,
24618
24648
  id: feature.featureId ?? "?",
@@ -24636,7 +24666,12 @@ var renderPreview = ({
24636
24666
  if (rewards.length > 0) {
24637
24667
  sections.push([
24638
24668
  chalk5.bold(`Rewards (${rewards.length})`),
24639
- ...rewards.flatMap((reward) => [
24669
+ ...rewards.flatMap((reward) => reward.action === "skip" ? [
24670
+ skippedLine({
24671
+ id: reward.id ?? "?",
24672
+ label: reward.name ?? reward.kind
24673
+ })
24674
+ ] : [
24640
24675
  line({
24641
24676
  action: reward.action,
24642
24677
  id: reward.id ?? "?",
@@ -24653,7 +24688,12 @@ var renderPreview = ({
24653
24688
  if (referralPrograms.length > 0) {
24654
24689
  sections.push([
24655
24690
  chalk5.bold(`Referral programs (${referralPrograms.length})`),
24656
- ...referralPrograms.flatMap((program) => [
24691
+ ...referralPrograms.flatMap((program) => program.action === "skip" ? [
24692
+ skippedLine({
24693
+ id: program.id ?? "?",
24694
+ label: program.rewardId ?? undefined
24695
+ })
24696
+ ] : [
24657
24697
  line({
24658
24698
  action: program.action,
24659
24699
  id: program.id ?? "?",
@@ -25124,6 +25164,15 @@ var settleLanes = async (lanes) => {
25124
25164
  return { values, failures };
25125
25165
  };
25126
25166
 
25167
+ // src/actions/push/safeMode.ts
25168
+ var SAFE_UNSUPPORTED_MESSAGE = "The server doesn't support --safe: its preview did not confirm skip_updates, so it could apply updates. Nothing was applied. Update the server or push without --safe.";
25169
+ var assertSafeEchoed = ({
25170
+ preview
25171
+ }) => {
25172
+ if (preview.skipUpdates !== true)
25173
+ throw new Error(SAFE_UNSUPPORTED_MESSAGE);
25174
+ };
25175
+
25127
25176
  // src/actions/sandbox/withSandboxScopeHint.ts
25128
25177
  var SCOPE_REFUSAL = "Insufficient scopes";
25129
25178
  var SANDBOX_LOGIN_HINT = "Your key can't manage sandboxes: it was minted before atmn asked for platform:write. Run atmn login again to mint one that can.";
@@ -25331,14 +25380,18 @@ var assertDistinctSecretNames = ({
25331
25380
  var previewEnv = async ({
25332
25381
  env,
25333
25382
  rows,
25334
- clientFor
25383
+ clientFor,
25384
+ safe
25335
25385
  }) => {
25336
25386
  try {
25337
25387
  const key = await env.envKey();
25338
25388
  const webhooks = resolveWebhooksForEnv({ rows, envKey: key });
25339
25389
  const client = clientFor({ secretKey: env.secretKey });
25340
- const body = { webhooks, skipDeletions: false };
25341
- const { changes, errors } = await client.previewSyncWebhooks(body);
25390
+ const body = safe ? { webhooks, skipDeletions: true, skipUpdates: true } : { webhooks, skipDeletions: false };
25391
+ const response = await client.previewSyncWebhooks(body);
25392
+ if (safe)
25393
+ assertSafeEchoed({ preview: response });
25394
+ const { changes, errors } = response;
25342
25395
  return {
25343
25396
  lane: {
25344
25397
  preview: { env: key, changes },
@@ -25359,7 +25412,8 @@ var previewWebhookEnvs = async ({
25359
25412
  rows,
25360
25413
  envs,
25361
25414
  prod,
25362
- clientFor
25415
+ clientFor,
25416
+ safe = false
25363
25417
  }) => {
25364
25418
  if (rows === undefined)
25365
25419
  return;
@@ -25369,8 +25423,8 @@ var previewWebhookEnvs = async ({
25369
25423
  const synced = all.filter((env) => isLive(env) === prod);
25370
25424
  const probed = prod ? [] : all.filter(isLive);
25371
25425
  const [syncedResults, probedResults] = await Promise.all([
25372
- Promise.allSettled(synced.map((env) => previewEnv({ env, rows, clientFor }))),
25373
- Promise.allSettled(probed.map((env) => previewEnv({ env, rows, clientFor })))
25426
+ Promise.allSettled(synced.map((env) => previewEnv({ env, rows, clientFor, safe }))),
25427
+ Promise.allSettled(probed.map((env) => previewEnv({ env, rows, clientFor, safe })))
25374
25428
  ]);
25375
25429
  const lanes = [];
25376
25430
  const skipped = [];
@@ -25588,7 +25642,8 @@ var runPush = async ({
25588
25642
  migrationLinkBase,
25589
25643
  prod = false,
25590
25644
  webhookEnvs,
25591
- webhookClientFor
25645
+ webhookClientFor,
25646
+ safe = false
25592
25647
  }) => {
25593
25648
  const project = resolveProject({ cwd, configFlag });
25594
25649
  const dirs = configSearchDirs({ cwd, configPath: configFlag });
@@ -25597,7 +25652,8 @@ var runPush = async ({
25597
25652
  dirs,
25598
25653
  ...project.configPath === null ? {} : { configPath: project.configPath }
25599
25654
  });
25600
- const { catalog: wire, singletons, lists, warnings } = splitWire(document);
25655
+ const { catalog, singletons, lists, warnings } = splitWire(document);
25656
+ const wire = safe ? { ...catalog, skip_deletions: true, skip_updates: true } : catalog;
25601
25657
  if (warnings.length > 0)
25602
25658
  write(`${renderLintWarnings({ warnings })}
25603
25659
 
@@ -25607,7 +25663,11 @@ var runPush = async ({
25607
25663
  write(`${renderDeprecatedUses({ uses: deprecated })}
25608
25664
 
25609
25665
  `);
25610
- const settingsBody = singletons.settings;
25666
+ if (safe && singletons.settings !== undefined)
25667
+ write(`Settings: skipped in safe mode.
25668
+
25669
+ `);
25670
+ const settingsBody = safe ? undefined : singletons.settings;
25611
25671
  const previews = await settleLanes({
25612
25672
  settings: previewSettings({ client, body: settingsBody }),
25613
25673
  catalog: client.previewUpdate(wire),
@@ -25615,7 +25675,8 @@ var runPush = async ({
25615
25675
  rows: lists.webhooks,
25616
25676
  envs: webhookEnvs,
25617
25677
  prod,
25618
- clientFor: webhookClientFor
25678
+ clientFor: webhookClientFor,
25679
+ safe
25619
25680
  })
25620
25681
  });
25621
25682
  const { settings, webhooks } = previews.values;
@@ -25624,6 +25685,8 @@ var runPush = async ({
25624
25685
  if (failures.length > 0)
25625
25686
  throw new PushLanesError({ stage: "preview", failures });
25626
25687
  const catalogPreview = previews.values.catalog ?? {};
25688
+ if (safe)
25689
+ assertSafeEchoed({ preview: catalogPreview });
25627
25690
  const preview = {
25628
25691
  ...catalogPreview,
25629
25692
  settings,
@@ -26615,7 +26678,7 @@ Linking a keyless org to an account:
26615
26678
  json: options.json === true
26616
26679
  });
26617
26680
  });
26618
- program.command("push").description("preview autumn.config.ts against your catalog; --yes applies it").option("-y, --yes", "apply the changes the preview shows").option("-d, --dry-run", "preview only, even with --yes").action(async (options, command) => {
26681
+ program.command("push").description("preview autumn.config.ts against your catalog; --yes applies it").option("-y, --yes", "apply the changes the preview shows").option("-d, --dry-run", "preview only, even with --yes").option("--safe", "only create ids that don't exist yet: never update or delete, and skip settings").action(async (options, command) => {
26619
26682
  const target = prepareTarget({ command });
26620
26683
  const apply = options.yes === true && options.dryRun !== true;
26621
26684
  const result = await runPush({
@@ -26624,7 +26687,8 @@ Linking a keyless org to an account:
26624
26687
  dryRun: !apply,
26625
26688
  prod: command.optsWithGlobals().prod === true,
26626
26689
  webhookEnvs: webhookEnvsFor({ target }),
26627
- webhookClientFor: webhookClientFor({ target })
26690
+ webhookClientFor: webhookClientFor({ target }),
26691
+ safe: options.safe === true
26628
26692
  });
26629
26693
  process.exitCode = pushExitCode({ apply, result });
26630
26694
  if (!apply && !previewIsEmpty({ preview: result.preview }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atmn",
3
- "version": "2.0.250",
3
+ "version": "2.0.252",
4
4
  "license": "MIT",
5
5
  "description": "The CLI for Autumn — define your pricing in code, sync it to Autumn, and keep everything in version control.",
6
6
  "bin": {
@@ -51,5 +51,5 @@
51
51
  "open": "10.2.0",
52
52
  "yaml": "2.9.0"
53
53
  },
54
- "gitHead": "4589df33097332b850fb08ab3c92460922414d8d"
54
+ "gitHead": "7b7b0ac1a5a41a0f5a3eaaaa742a17f0cb45867c"
55
55
  }
@@ -0,0 +1,11 @@
1
+ /** An old server strips skip_updates and would apply updates; only its echo proves it honoured the flag. */
2
+ export const SAFE_UNSUPPORTED_MESSAGE =
3
+ "The server doesn't support --safe: its preview did not confirm skip_updates, so it could apply updates. Nothing was applied. Update the server or push without --safe.";
4
+
5
+ export const assertSafeEchoed = ({
6
+ preview,
7
+ }: {
8
+ preview: { skipUpdates?: boolean };
9
+ }): void => {
10
+ if (preview.skipUpdates !== true) throw new Error(SAFE_UNSUPPORTED_MESSAGE);
11
+ };
@@ -22,6 +22,7 @@ import {
22
22
  renderDeprecatedUses,
23
23
  } from "./push/deprecatedFields";
24
24
  import { PushLanesError, settleLanes } from "./push/pushLanesError";
25
+ import { assertSafeEchoed } from "./push/safeMode";
25
26
  import { withSettingsScopeHint } from "./sandbox/withSandboxScopeHint";
26
27
  import { applyWebhooks } from "./webhooks/applyWebhooks";
27
28
  import {
@@ -71,6 +72,8 @@ export type PushOptions = {
71
72
  webhookEnvs?: () => WebhookPullEnv[];
72
73
  /** A client for one env's own key. */
73
74
  webhookClientFor?: WebhookClientFor;
75
+ /** `--safe`: only ids the env doesn't hold yet are created; nothing updates or deletes, settings are skipped. */
76
+ safe?: boolean;
74
77
  };
75
78
 
76
79
  type RewardBody = { id?: string; internal_id?: string };
@@ -351,6 +354,7 @@ export const runPush = async ({
351
354
  prod = false,
352
355
  webhookEnvs,
353
356
  webhookClientFor,
357
+ safe = false,
354
358
  }: PushOptions): Promise<PushResult> => {
355
359
  const project = resolveProject({ cwd, configFlag });
356
360
  const dirs = configSearchDirs({ cwd, configPath: configFlag });
@@ -361,14 +365,20 @@ export const runPush = async ({
361
365
  ...(project.configPath === null ? {} : { configPath: project.configPath }),
362
366
  });
363
367
  // One document, three destinations: the catalog, each singleton and each synced list.
364
- const { catalog: wire, singletons, lists, warnings } = splitWire(document);
368
+ const { catalog, singletons, lists, warnings } = splitWire(document);
369
+ const wire = safe
370
+ ? { ...catalog, skip_deletions: true, skip_updates: true }
371
+ : catalog;
365
372
  if (warnings.length > 0) write(`${renderLintWarnings({ warnings })}\n\n`);
366
373
 
367
374
  const deprecated = deprecatedUsesIn({ wire });
368
375
  if (deprecated.length > 0)
369
376
  write(`${renderDeprecatedUses({ uses: deprecated })}\n\n`);
370
377
 
371
- const settingsBody = singletons.settings;
378
+ // Settings can only update, so safe mode leaves the whole lane out.
379
+ if (safe && singletons.settings !== undefined)
380
+ write("Settings: skipped in safe mode.\n\n");
381
+ const settingsBody = safe ? undefined : singletons.settings;
372
382
  const previews = await settleLanes<{
373
383
  settings: SettingsPreview | undefined;
374
384
  catalog: CatalogPreview;
@@ -381,6 +391,7 @@ export const runPush = async ({
381
391
  envs: webhookEnvs,
382
392
  prod,
383
393
  clientFor: webhookClientFor,
394
+ safe,
384
395
  }),
385
396
  });
386
397
  const { settings, webhooks } = previews.values;
@@ -396,6 +407,7 @@ export const runPush = async ({
396
407
  if (failures.length > 0)
397
408
  throw new PushLanesError({ stage: "preview", failures });
398
409
  const catalogPreview = previews.values.catalog ?? {};
410
+ if (safe) assertSafeEchoed({ preview: catalogPreview });
399
411
 
400
412
  const preview: CatalogPreview = {
401
413
  ...catalogPreview,
@@ -2,6 +2,7 @@ import type { AutumnClient, SyncWebhooksParams } from "../../generated/client";
2
2
  import type { WebhooksPreview } from "../../render/renderWebhooks";
3
3
  import { webhookEnvSkipWarning } from "../pull/webhooks/webhookEnvSkipWarning";
4
4
  import type { WebhookPullEnv } from "../pull/webhooks/webhookPullEnvs";
5
+ import { assertSafeEchoed } from "../push/safeMode";
5
6
  import { resolveWebhooksForEnv } from "./resolveWebhooksForEnv";
6
7
  import type { WebhookEnv } from "./types/webhookEnv";
7
8
  import {
@@ -91,17 +92,25 @@ const previewEnv = async ({
91
92
  env,
92
93
  rows,
93
94
  clientFor,
95
+ safe,
94
96
  }: {
95
97
  env: WebhookPullEnv;
96
98
  rows: Record<string, unknown>[];
97
99
  clientFor: WebhookClientFor;
100
+ safe: boolean;
98
101
  }): Promise<EnvPreview> => {
99
102
  try {
100
103
  const key = await env.envKey();
101
104
  const webhooks = resolveWebhooksForEnv({ rows, envKey: key });
102
105
  const client = clientFor({ secretKey: env.secretKey });
103
- const body = { webhooks, skipDeletions: false };
104
- const { changes, errors } = await client.previewSyncWebhooks(body);
106
+ const body: SyncWebhooksParams & { skipUpdates?: boolean } = safe
107
+ ? { webhooks, skipDeletions: true, skipUpdates: true }
108
+ : { webhooks, skipDeletions: false };
109
+ const response: { skipUpdates?: boolean } & Awaited<
110
+ ReturnType<WebhookClient["previewSyncWebhooks"]>
111
+ > = await client.previewSyncWebhooks(body);
112
+ if (safe) assertSafeEchoed({ preview: response });
113
+ const { changes, errors } = response;
105
114
  return {
106
115
  lane: {
107
116
  preview: { env: key, changes },
@@ -128,11 +137,14 @@ export const previewWebhookEnvs = async ({
128
137
  envs,
129
138
  prod,
130
139
  clientFor,
140
+ safe = false,
131
141
  }: {
132
142
  rows: Record<string, unknown>[] | undefined;
133
143
  envs: (() => WebhookPullEnv[]) | undefined;
134
144
  prod: boolean;
135
145
  clientFor: WebhookClientFor | undefined;
146
+ /** Send skip_updates and refuse a server that doesn't echo it. */
147
+ safe?: boolean;
136
148
  }): Promise<WebhookLanes | undefined> => {
137
149
  if (rows === undefined) return undefined;
138
150
  if (envs === undefined || clientFor === undefined)
@@ -142,10 +154,10 @@ export const previewWebhookEnvs = async ({
142
154
  const probed = prod ? [] : all.filter(isLive);
143
155
  const [syncedResults, probedResults] = await Promise.all([
144
156
  Promise.allSettled(
145
- synced.map((env) => previewEnv({ env, rows, clientFor })),
157
+ synced.map((env) => previewEnv({ env, rows, clientFor, safe })),
146
158
  ),
147
159
  Promise.allSettled(
148
- probed.map((env) => previewEnv({ env, rows, clientFor })),
160
+ probed.map((env) => previewEnv({ env, rows, clientFor, safe })),
149
161
  ),
150
162
  ]);
151
163
 
package/src/cli.ts CHANGED
@@ -399,9 +399,13 @@ Linking a keyless org to an account:
399
399
  )
400
400
  .option("-y, --yes", "apply the changes the preview shows")
401
401
  .option("-d, --dry-run", "preview only, even with --yes")
402
+ .option(
403
+ "--safe",
404
+ "only create ids that don't exist yet: never update or delete, and skip settings",
405
+ )
402
406
  .action(
403
407
  async (
404
- options: { dryRun?: boolean; yes?: boolean },
408
+ options: { dryRun?: boolean; yes?: boolean; safe?: boolean },
405
409
  command: Command,
406
410
  ) => {
407
411
  const target = prepareTarget({ command });
@@ -415,6 +419,7 @@ Linking a keyless org to an account:
415
419
  prod: command.optsWithGlobals<GlobalFlags>().prod === true,
416
420
  webhookEnvs: webhookEnvsFor({ target }),
417
421
  webhookClientFor: webhookClientFor({ target }),
422
+ safe: options.safe === true,
418
423
  });
419
424
  // A dry run that never saw the catalog must not read as clean.
420
425
  process.exitCode = pushExitCode({ apply, result });