@nextcommerce/campaigns-os 1.37.3 → 1.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/AGENTS.md +114 -10
  2. package/CHANGELOG.md +708 -0
  3. package/README.md +44 -31
  4. package/agents/claude/CLAUDE.md +5 -1
  5. package/campaign-spec/dist/types.d.ts +2 -0
  6. package/contracts/agent-relevant-change-policy.v1.json +11 -1
  7. package/contracts/effects.v1.json +4887 -0
  8. package/contracts/migration-sidecar-bundle.v0.json +9 -0
  9. package/contracts/release-ledger.json +1541 -0
  10. package/contracts/supported-surface.json +33 -12
  11. package/docs/build-packet.md +83 -22
  12. package/docs/campaigns-os-build-flow.md +2 -2
  13. package/docs/demo-preview.md +1 -1
  14. package/docs/diagnostics.md +7 -4
  15. package/docs/effects.md +350 -0
  16. package/docs/gateway-login.md +113 -0
  17. package/docs/local-setup.md +51 -0
  18. package/docs/migration-sidecar-bundle.md +6 -1
  19. package/docs/orientation-contract-reference.md +4 -1
  20. package/docs/progress-snapshots.md +9 -3
  21. package/docs/qa-and-test-orders.md +29 -13
  22. package/docs/readback.md +523 -0
  23. package/docs/runtime-readiness.md +1 -1
  24. package/docs/sdk-storage-compatibility.md +1 -1
  25. package/docs/skills-revision.md +364 -0
  26. package/docs/supported-surface.md +11 -3
  27. package/docs/versioning.md +8 -4
  28. package/package.json +10 -4
  29. package/schemas/campaign-runtime-assembly-report.v0.schema.json +6 -1
  30. package/schemas/campaign-runtime-build-packet.v0.schema.json +11 -1
  31. package/schemas/campaign-spec.v4.schema.json +4 -0
  32. package/schemas/campaigns-os-effects.v1.schema.json +211 -0
  33. package/schemas/campaigns-os-progress-snapshot.v0.schema.json +1 -0
  34. package/schemas/campaigns-os-qa-verdict-sidecar.v0.schema.json +1 -0
  35. package/schemas/campaigns-os-qa-verdict.v0.schema.json +1 -0
  36. package/schemas/campaigns-os-readback.v2.schema.json +267 -0
  37. package/schemas/campaigns-os-run-record.v0.schema.json +1 -0
  38. package/skills/campaign-lifecycle-orientation/SKILL.md +179 -0
  39. package/skills/campaign-readback-classification/SKILL.md +230 -0
  40. package/skills/campaign-run-evidence/SKILL.md +142 -0
  41. package/skills/contribution-intake/SKILL.md +85 -0
  42. package/skills/next-campaigns-build/SKILL.md +33 -12
  43. package/skills/next-campaigns-os/SKILL.md +59 -22
  44. package/skills/next-campaigns-os/references/session-intake.md +4 -4
  45. package/skills/next-campaigns-os-setup/SKILL.md +35 -14
  46. package/skills/next-campaigns-polish/SKILL.md +43 -17
  47. package/skills/next-campaigns-qa/SKILL.md +53 -28
  48. package/skills.json +40 -7
  49. package/src/admin-transport.mjs +123 -0
  50. package/src/cli.mjs +1178 -270
  51. package/src/credential-store.mjs +183 -0
  52. package/src/deviation.mjs +3 -2
  53. package/src/diagnostic.mjs +4 -1
  54. package/src/finding-cause.mjs +14 -10
  55. package/src/gate-actions.mjs +2 -2
  56. package/src/install-mode.mjs +17 -9
  57. package/src/lifecycle.mjs +96 -0
  58. package/src/login.mjs +152 -0
  59. package/src/package-install-fixture.mjs +3 -2
  60. package/src/polish-node.mjs +5 -2
  61. package/src/progress-node.mjs +3 -2
  62. package/src/progress.mjs +5 -3
  63. package/src/qa-node.mjs +105 -36
  64. package/src/qa-publish.mjs +112 -2
  65. package/src/qa-sidecar.mjs +2 -0
  66. package/src/qa-verdict-discovery.mjs +11 -0
  67. package/src/qa-verdict-publish.mjs +1 -0
  68. package/src/qa-verdict.mjs +8 -1
  69. package/src/readback.mjs +1937 -0
  70. package/src/remit.mjs +17 -3
  71. package/src/run-record-closeout.mjs +3 -4
  72. package/src/run-record.mjs +4 -0
  73. package/src/sidecar-bundle.mjs +21 -0
  74. package/src/spec-source-identity.mjs +44 -0
  75. package/src/stage-ledger.mjs +4 -1
  76. package/src/tooling-setup.mjs +160 -0
package/README.md CHANGED
@@ -5,8 +5,8 @@ Campaigns OS is the developer toolkit for agent-assisted campaign builds on [Nex
5
5
  This toolkit gives campaign developers and AI coding tools a clear path for assembling one from prepared page files:
6
6
 
7
7
  1. Configure the campaign in the Next Commerce dashboard (Campaigns App).
8
- 2. Create or review the Campaign Map in [Campaign Map Builder](https://campaign-map.nextcommerce.com).
9
- 3. Export a local CampaignSpec JSON.
8
+ 2. Use the current saved Map in [Campaign Map Builder](https://campaign-map.nextcommerce.com), or have the coding agent author a [local CampaignSpec](docs/build-packet.md#local-spec-entry) from the brief and verified campaign values.
9
+ 3. Keep the CampaignSpec JSON with its saved Map ID or stable `local_spec_id`, plus its public route slug.
10
10
  4. Bring prepared HTML/CSS/assets for the campaign pages.
11
11
  5. Provide or generate a [Campaign Build Brief](./docs/campaign-build-brief.md) for merchandising/design presentation decisions.
12
12
  6. Create and doctor a Build Packet.
@@ -26,10 +26,14 @@ installation, a saved Map, preview observation, and recorded QA each establish.
26
26
 
27
27
  You do not need to clone this repository to use it. The toolkit is pinned as a
28
28
  devDependency of the campaign folder (a page-kit project) and runs through
29
- `npx campaigns-os …` from that folder — the pin is committed in `package.json`
30
- and the lockfile, so CI and the deploy host install the same package bytes. Requirements: Node
31
- `>=20.19.0` and npm 10 or 11 (Node 22 ships npm 10). Three steps, in this
32
- order:
29
+ `npx --no-install campaigns-os …` from that folder — the pin is committed in
30
+ `package.json` and the lockfile, so CI and the deploy host install the same
31
+ package bytes. Keep `--no-install`: `campaigns-os` is only the bin name of
32
+ `@nextcommerce/campaigns-os`, so in a folder without the pinned copy a plain
33
+ `npx campaigns-os` looks that name up on the registry and, with no terminal to
34
+ ask, installs what it finds; with the flag, npx stops with an error instead.
35
+ Requirements: Node `>=20.19.0` and npm 10 or 11 (Node 22 ships npm 10). Three
36
+ steps, in this order:
33
37
 
34
38
  1. **Orient before you run anything.** Read
35
39
  [`AGENTS.md`](AGENTS.md), `contracts/supported-surface.json`,
@@ -44,8 +48,8 @@ mkdir "<route>" && cd "<route>"
44
48
  npm init -y && npm i next-campaign-page-kit
45
49
  npx campaign-init --non-interactive --template <family> --slug "<route>" --name "<campaign name>"
46
50
  npm install --save-dev --save-exact @nextcommerce/campaigns-os@1.37.3
47
- npx campaigns-os tooling status --platform claude
48
- npx campaigns-os install-skills --platform claude
51
+ npx --no-install campaigns-os tooling status --platform claude
52
+ npx --no-install campaigns-os install-skills --platform claude
49
53
  mkdir -p source
50
54
  ```
51
55
 
@@ -76,8 +80,9 @@ dist-tag for a reproducible build. Commit `package.json` and `package-lock.json`
76
80
  A Git source pin remains supported when using an unreleased reviewed commit:
77
81
  `npm install --save-dev --save-exact "github:NextCommerceCo/campaigns-os#<full-sha>"`.
78
82
 
79
- For a visual sample, `npx campaigns-os demo --target ./apollo-sample`
80
- (1.37.0 or later) copies four inert Apollo pages; open the printed
83
+ For a visual sample, run
84
+ `npx --no-install campaigns-os demo --target ./apollo-sample` (1.37.0 or later).
85
+ It copies four inert Apollo pages; open the printed
81
86
  `landing/index.html` directly. It downloads nothing and creates no campaign
82
87
  evidence. Keep sample edits and start a real campaign in a separate new Page Kit
83
88
  folder. See [offline sample preview](docs/demo-preview.md).
@@ -101,20 +106,22 @@ template stock. To update, review the new release source and install its exact v
101
106
  > The first `start` opens a run session in the target folder and, unless you
102
107
  > opt out, the session's Run Record is remitted to the Campaigns telemetry
103
108
  > endpoint with the packet's Campaigns API key. Opt out with
104
- > `npx campaigns-os telemetry off`, `CAMPAIGNS_OS_TELEMETRY=off`, or
109
+ > `npx --no-install campaigns-os telemetry off`, `CAMPAIGNS_OS_TELEMETRY=off`, or
105
110
  > `--no-remit` on the remitting command; capture stays local either way. The
106
111
  > full note — endpoint, payload, what `off` changes, and `--no-run-session` —
107
112
  > is in [docs/quickstart.md](docs/quickstart.md) above the first `start`; the
108
113
  > contract is [Run Telemetry](docs/workflow-findings-sidecar.md).
109
114
 
110
115
  ```bash
111
- npx campaigns-os start --map-id <map-id> --target . --source ./source --template-family <family>
112
- npx campaigns-os next --packet ./campaign-runtime.build.json --json
116
+ npx --no-install campaigns-os start --map-id <map-id> --target . --source ./source --template-family <family>
117
+ npx --no-install campaigns-os next --packet ./campaign-runtime.build.json --json
113
118
  ```
114
119
 
115
120
  `--map-id <id>` starts from a map saved in Campaign Map Builder (add
116
121
  `--proxy-base <origin>` when the map was saved on a non-production map store);
117
- `--spec <campaignspec.json>` starts from a local export instead. `--source` is
122
+ `--spec <campaignspec.json>` starts from a local export or an agent-authored
123
+ [local spec](docs/build-packet.md#local-spec-entry) instead. Local-spec identity
124
+ requires a reviewed 1.43.0-or-later release. `--source` is
118
125
  always required: the folder of prepared HTML/CSS/assets for the pages you are
119
126
  building, with a source manifest that carries desktop and mobile screenshot
120
127
  proof for each designed page
@@ -127,10 +134,11 @@ normally `BLOCKED` with a list of what to supply — missing screenshot proof,
127
134
  demo values to replace, a scaffold to run. That list is the intake checklist,
128
135
  not a failed install. The demo values are the store profile and SDK pin
129
136
  `campaign-init` seeded into `_data/campaigns.json`; doctor prints the one
130
- command that replaces them from the CampaignSpec, `npx campaigns-os page-kit
131
- sync --packet campaign-runtime.build.json`, and after it both page-kit gates
132
- pass. The reverse write exists for a configured campaign: `npx campaigns-os
133
- spec derive --packet campaign-runtime.build.json` copies what the repo already
137
+ command that replaces them from the CampaignSpec, `npx --no-install
138
+ campaigns-os page-kit sync --packet campaign-runtime.build.json`, and after it
139
+ both page-kit gates pass. The reverse write exists for a configured campaign:
140
+ `npx --no-install campaigns-os spec derive --packet
141
+ campaign-runtime.build.json` copies what the repo already
134
142
  states (the SDK pin, page routes, analytics ids) into the local CampaignSpec,
135
143
  and with `--write-map` records the pin in the saved Map's Build hints too, so
136
144
  a bump in the repo is one edit followed by a derive rather than a hand edit
@@ -145,12 +153,13 @@ fields, and resolve competing edits before the next build.
145
153
 
146
154
  Everything after `start` is agent-driven: after `start`
147
155
  and after every stage, run `next` and do what it prints — it names the skill
148
- and the exact commands for the next stage, already spelled `npx campaigns-os
149
- …` for this install, which is why `install-skills` comes first. The browser
150
- for polish capture and QA is a one-time `npx campaigns-os qa install-browser`,
151
- which installs the browser for the Playwright this toolkit bundles. A pin
152
- older than that command shows `npx playwright install chromium` instead; that
153
- is equivalent only when `npx playwright` resolves to the toolkit's Playwright
156
+ and the exact commands for the next stage, already spelled `npx --no-install
157
+ campaigns-os …` for this install, which is why `install-skills` comes first.
158
+ Releases before 1.41.2 print the same commands without `--no-install`; add it
159
+ when you copy one. The browser for polish capture and QA is a one-time
160
+ `npx --no-install campaigns-os qa install-browser`, which installs the browser
161
+ for the Playwright this toolkit bundles. A pin older than that command shows
162
+ `npx playwright install chromium` instead; that is equivalent only when `npx playwright` resolves to the toolkit's Playwright
154
163
  (a campaign that depends on its own Playwright version gets that one's
155
164
  browser instead), so prefer `qa install-browser` on pins that have it.
156
165
 
@@ -159,9 +168,9 @@ browser instead), so prefer `qa install-browser` on pins that have it.
159
168
  The pinned devDependency above is the primary path. To change the toolkit, use
160
169
  a checkout ([docs/quickstart.md](docs/quickstart.md)): every `npm run
161
170
  campaigns-os -- <command> …` example in this repository is that checkout form,
162
- and from a campaign folder the same command is `npx campaigns-os <command> …`
163
- with identical arguments (`npm run qa:install-browser` is the checkout's
164
- `qa install-browser`).
171
+ and from a campaign folder the same command is
172
+ `npx --no-install campaigns-os <command> …` with identical arguments (`npm run
173
+ qa:install-browser` is the checkout's `qa install-browser`).
165
174
 
166
175
  From a checkout, the same first run uses the bundled example inputs:
167
176
 
@@ -221,7 +230,7 @@ Then ask your AI tool to continue from the emitted handoff. Fresh target repos u
221
230
 
222
231
  ## Source Files
223
232
 
224
- The current source adapter is `html_funnel`: bring prepared HTML/CSS/assets for the campaign pages, plus a local exported CampaignSpec from Campaign Map Builder.
233
+ The current source adapter is `html_funnel`: bring prepared HTML/CSS/assets for the campaign pages, plus a CampaignSpec exported from Campaign Map Builder or authored by the coding agent through the [local-spec entry](docs/build-packet.md#local-spec-entry).
225
234
 
226
235
  For raw AI-generated or exported static HTML, "prepared" means page-kit-ready
227
236
  source, not a browser document dropped in unchanged and not a wholesale Liquid
@@ -284,9 +293,10 @@ checks that the package metadata, CLI entrypoint, and installed Campaigns OS
284
293
  skills agree. For a checkout it also reports branch, upstream, and ahead/behind;
285
294
  for a package install the pinned commit is the freshness answer, and there is
286
295
  no npm dist-tag to compare against. Neither mode makes agent skills current on
287
- its own: when skills are stale, run `install-skills --platform all` through the
288
- same prefix you ran `tooling status` with (the status output prints the exact
289
- command) and restart local agent sessions.
296
+ its own: when skills are stale, run the refresh command the status output
297
+ prints (it names each stale platform, through the same prefix you ran
298
+ `tooling status` with) and restart local agent sessions. Without `--platform`,
299
+ status checks only the platforms where Campaigns OS skills are installed.
290
300
 
291
301
  Run `campaigns-os qa install-browser` (`npm run qa:install-browser` from a
292
302
  checkout) once after install/update and before mandatory `polish capture` or
@@ -352,11 +362,14 @@ See [`campaign-spec/README.md`](campaign-spec/README.md).
352
362
  - [Setup Profile Parity](docs/setup-profile-parity.md)
353
363
  - [Developer Evaluation](docs/developer-evaluation.md)
354
364
  - [QA And Test Orders](docs/qa-and-test-orders.md)
365
+ - [Run-Artifact Readback](docs/readback.md) — `campaigns-os readback`: a read-only projection of one run's emitted artifacts, with per-artifact freshness against the checkout and a versioned JSON contract to gate on
366
+ - [Declared Command Effects](docs/effects.md) — what every supported invocation writes and sends, one row per command and effect-changing flag, each row proved by a test that runs the real CLI in a disposable target
355
367
  - [Legacy Migration Contract](docs/legacy-migration.md) — pure inventory, preview-plan, receipt, Offer request/readback, and token-free evidence helpers for bounded SDK 0.3.x shadow migrations
356
368
  - [Template Family vs Figma-extraction vs Hybrid](docs/template-vs-extraction-decision.md) — when to mint a template family, when to extract a bespoke design, and when to do both
357
369
  - [Small PR Review Path](docs/small-pr-review-path.md)
358
370
  - [Run Telemetry](docs/workflow-findings-sidecar.md) — per-run Run Record (system signal + workflow findings) tagged by improvement surface; captured locally always, remitted to Next Commerce only with up-front opt-out consent
359
371
  - [Versioning](docs/versioning.md)
372
+ - [ADR 0002: One shipping path](docs/adr/0002-one-shipping-path-campaigns-agent-fold.md) — decides that the agent surface (skills, charter, declared effects, readback) lives in this repository; Campaigns Agent folds in
360
373
 
361
374
  ## Status
362
375
 
@@ -1,6 +1,10 @@
1
1
  # Campaigns OS Agent Context
2
2
 
3
- You are helping assemble a NEXT campaign through Campaigns OS. Start from the Build Packet, not from private runtime source.
3
+ You are helping assemble a NEXT campaign through Campaigns OS. Use the
4
+ `next-campaigns-os` skill from this project's pinned toolkit. When a Build
5
+ Packet exists, read it and follow `next`. Check the loaded skill's bundle
6
+ revision and restart the session if it differs from the
7
+ project copy. Do not use private runtime source as the campaign's starting point.
4
8
 
5
9
  Core rules:
6
10
 
@@ -593,6 +593,8 @@ export interface AnalyticsContract {
593
593
  * local-experimental.
594
594
  */
595
595
  export interface SpecIdentity {
596
+ /** Stable agent-authored identity when there is no saved Map. */
597
+ local_spec_id?: string;
596
598
  map_id?: string;
597
599
  source?: string;
598
600
  id?: string;
@@ -59,8 +59,19 @@
59
59
  { "match": { "kind": "exact", "value": "contracts/agent-relevant-change-policy.v1.json" }, "class": "compatibility_policy" },
60
60
  { "match": { "kind": "exact", "value": "contracts/orientation-limits.v1.json" }, "class": "compatibility_policy" },
61
61
  { "match": { "kind": "exact", "value": "contracts/orientation-reason-codes.v1.json" }, "class": "compatibility_policy" },
62
+ { "match": { "kind": "exact", "value": "contracts/effects.v1.json" }, "class": "compatibility_policy" },
62
63
  { "match": { "kind": "exact", "value": "bin/campaigns-os.mjs" }, "class": "cli_surface" },
63
64
  { "match": { "kind": "exact", "value": "src/cli.mjs" }, "class": "cli_surface" },
65
+ {
66
+ "match": { "kind": "prefix", "value": "src/agent/" },
67
+ "class": "cli_surface",
68
+ "_note": "The agent-facing entry points (skill install, agent context, the tooling-status revision check) are reachable from the supported argv surface, so a change under src/agent/ is a CLI-surface change even though the rest of src/ is unsupported implementation. This rule sits ahead of the broad src/ ignore on purpose: the ignore's reason is 'implementation reachable only through declared package exports', which is exactly what this subtree is not."
69
+ },
70
+ {
71
+ "match": { "kind": "prefix", "value": "agents/" },
72
+ "class": "documentation",
73
+ "_note": "The per-platform agent instruction files an agent orients on (and that `install-agent-context` copies into a target repo). They were ignored as 'illustrative' while nothing consumed them; they are now named supported surface, so a change to one is a documentation change a consumer can see."
74
+ },
64
75
  { "match": { "kind": "exact", "value": "skills.json" }, "class": "skill" },
65
76
  { "match": { "kind": "exact", "value": "skills.sh" }, "class": "skill" },
66
77
  { "match": { "kind": "prefix", "value": "skills/" }, "class": "skill" },
@@ -92,7 +103,6 @@
92
103
  { "match": { "kind": "prefix", "value": "campaign-spec/" }, "reason": "Tests, fixtures, and packaging metadata for the generated runtime. The runtime sources a consumer must rebuild are classified by the generated_runtime rule first; only that rule's exclusions reach here." },
93
104
  { "match": { "kind": "prefix", "value": "examples/" }, "reason": "Illustrative, regenerated at will (docs/supported-surface.md)." },
94
105
  { "match": { "kind": "prefix", "value": "prompts/" }, "reason": "Illustrative, regenerated at will (docs/supported-surface.md)." },
95
- { "match": { "kind": "prefix", "value": "agents/" }, "reason": "Illustrative, regenerated at will (docs/supported-surface.md)." },
96
106
  { "match": { "kind": "prefix", "value": "docs/adr/" }, "reason": "Architecture decision records: rationale, not a consumed contract." },
97
107
  { "match": { "kind": "prefix", "value": "docs/" }, "reason": "Documentation that is not on the named supported surface and not an agent document of record. Named docs are classified by the derived pass first." },
98
108
  { "match": { "kind": "exact", "value": "README.md" }, "reason": "Repository front page; the agent entry point is AGENTS.md." },