@nextcommerce/campaigns-os 1.33.0

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 (310) hide show
  1. package/AGENTS.md +204 -0
  2. package/CHANGELOG.md +5002 -0
  3. package/CONTEXT.md +685 -0
  4. package/LICENSE +202 -0
  5. package/NOTICE +4 -0
  6. package/README.md +368 -0
  7. package/agents/claude/CLAUDE.md +32 -0
  8. package/agents/codex/AGENTS.md +27 -0
  9. package/agents/copilot/copilot-instructions.md +14 -0
  10. package/agents/cursor/campaigns-os.mdc +13 -0
  11. package/bin/campaigns-os.mjs +38 -0
  12. package/campaign-spec/README.md +138 -0
  13. package/campaign-spec/dist/analytics-vocabulary.d.ts +47 -0
  14. package/campaign-spec/dist/analytics-vocabulary.js +74 -0
  15. package/campaign-spec/dist/index.d.ts +40 -0
  16. package/campaign-spec/dist/index.js +77 -0
  17. package/campaign-spec/dist/normalize.d.ts +22 -0
  18. package/campaign-spec/dist/normalize.js +41 -0
  19. package/campaign-spec/dist/routing.d.ts +190 -0
  20. package/campaign-spec/dist/routing.js +263 -0
  21. package/campaign-spec/dist/rules/analytics-contract-shape.d.ts +42 -0
  22. package/campaign-spec/dist/rules/analytics-contract-shape.js +303 -0
  23. package/campaign-spec/dist/rules/assembly-hints-shape.d.ts +42 -0
  24. package/campaign-spec/dist/rules/assembly-hints-shape.js +191 -0
  25. package/campaign-spec/dist/rules/campaign-metadata.d.ts +14 -0
  26. package/campaign-spec/dist/rules/campaign-metadata.js +40 -0
  27. package/campaign-spec/dist/rules/checkout-has-success-url.d.ts +31 -0
  28. package/campaign-spec/dist/rules/checkout-has-success-url.js +66 -0
  29. package/campaign-spec/dist/rules/cycle-detection.d.ts +12 -0
  30. package/campaign-spec/dist/rules/cycle-detection.js +141 -0
  31. package/campaign-spec/dist/rules/design-source-shape.d.ts +29 -0
  32. package/campaign-spec/dist/rules/design-source-shape.js +142 -0
  33. package/campaign-spec/dist/rules/downsell-without-upsell.d.ts +11 -0
  34. package/campaign-spec/dist/rules/downsell-without-upsell.js +40 -0
  35. package/campaign-spec/dist/rules/exit-intent-validation.d.ts +23 -0
  36. package/campaign-spec/dist/rules/exit-intent-validation.js +147 -0
  37. package/campaign-spec/dist/rules/funnel-count.d.ts +9 -0
  38. package/campaign-spec/dist/rules/funnel-count.js +37 -0
  39. package/campaign-spec/dist/rules/funnel-hypothesis-length.d.ts +22 -0
  40. package/campaign-spec/dist/rules/funnel-hypothesis-length.js +60 -0
  41. package/campaign-spec/dist/rules/funnel-identity.d.ts +15 -0
  42. package/campaign-spec/dist/rules/funnel-identity.js +57 -0
  43. package/campaign-spec/dist/rules/funnel-weight-sum.d.ts +20 -0
  44. package/campaign-spec/dist/rules/funnel-weight-sum.js +66 -0
  45. package/campaign-spec/dist/rules/index.d.ts +69 -0
  46. package/campaign-spec/dist/rules/index.js +131 -0
  47. package/campaign-spec/dist/rules/offer-ref-integrity.d.ts +13 -0
  48. package/campaign-spec/dist/rules/offer-ref-integrity.js +59 -0
  49. package/campaign-spec/dist/rules/package-pricing-sanity.d.ts +12 -0
  50. package/campaign-spec/dist/rules/package-pricing-sanity.js +42 -0
  51. package/campaign-spec/dist/rules/page-count.d.ts +11 -0
  52. package/campaign-spec/dist/rules/page-count.js +31 -0
  53. package/campaign-spec/dist/rules/page-id-uniqueness.d.ts +14 -0
  54. package/campaign-spec/dist/rules/page-id-uniqueness.js +47 -0
  55. package/campaign-spec/dist/rules/promo-code-input-validation.d.ts +8 -0
  56. package/campaign-spec/dist/rules/promo-code-input-validation.js +126 -0
  57. package/campaign-spec/dist/rules/promo-codes-shape.d.ts +30 -0
  58. package/campaign-spec/dist/rules/promo-codes-shape.js +187 -0
  59. package/campaign-spec/dist/rules/route-field-ignored-for-page-type.d.ts +33 -0
  60. package/campaign-spec/dist/rules/route-field-ignored-for-page-type.js +81 -0
  61. package/campaign-spec/dist/rules/route-target-resolves.d.ts +32 -0
  62. package/campaign-spec/dist/rules/route-target-resolves.js +112 -0
  63. package/campaign-spec/dist/rules/schema-version.d.ts +21 -0
  64. package/campaign-spec/dist/rules/schema-version.js +53 -0
  65. package/campaign-spec/dist/rules/sdk-version.d.ts +26 -0
  66. package/campaign-spec/dist/rules/sdk-version.js +96 -0
  67. package/campaign-spec/dist/rules/shipping-countries-shape.d.ts +10 -0
  68. package/campaign-spec/dist/rules/shipping-countries-shape.js +30 -0
  69. package/campaign-spec/dist/rules/shipping-methods-present.d.ts +10 -0
  70. package/campaign-spec/dist/rules/shipping-methods-present.js +26 -0
  71. package/campaign-spec/dist/rules/store-profile-shape.d.ts +30 -0
  72. package/campaign-spec/dist/rules/store-profile-shape.js +127 -0
  73. package/campaign-spec/dist/rules/thank-you-requirement.d.ts +16 -0
  74. package/campaign-spec/dist/rules/thank-you-requirement.js +50 -0
  75. package/campaign-spec/dist/rules/unknown-top-level-fields.d.ts +28 -0
  76. package/campaign-spec/dist/rules/unknown-top-level-fields.js +114 -0
  77. package/campaign-spec/dist/rules/upsell-has-packages.d.ts +9 -0
  78. package/campaign-spec/dist/rules/upsell-has-packages.js +35 -0
  79. package/campaign-spec/dist/rules/upsell-routing-complete.d.ts +10 -0
  80. package/campaign-spec/dist/rules/upsell-routing-complete.js +45 -0
  81. package/campaign-spec/dist/rules/upsell-without-checkout.d.ts +11 -0
  82. package/campaign-spec/dist/rules/upsell-without-checkout.js +44 -0
  83. package/campaign-spec/dist/rules/variant-labels-shape.d.ts +28 -0
  84. package/campaign-spec/dist/rules/variant-labels-shape.js +86 -0
  85. package/campaign-spec/dist/sdk-version-parse.d.ts +43 -0
  86. package/campaign-spec/dist/sdk-version-parse.js +62 -0
  87. package/campaign-spec/dist/types.d.ts +674 -0
  88. package/campaign-spec/dist/types.js +40 -0
  89. package/campaign-spec/package.json +12 -0
  90. package/compatibility.json +25 -0
  91. package/contracts/agent-relevant-change-policy.v1.json +111 -0
  92. package/contracts/brand-theme-source-defaults.figma-sections-export.v0.json +32 -0
  93. package/contracts/brand-theme-target-tokens.next-core.v0.json +65 -0
  94. package/contracts/campaign-cart-checkout-field-contract.v0.json +45 -0
  95. package/contracts/campaign-cart-sdk-support-policy.v0.json +11 -0
  96. package/contracts/commerce-surface-catalog.json +2452 -0
  97. package/contracts/fixtures/orientation/canonicalization/v1.json +34 -0
  98. package/contracts/fixtures/orientation/envelope/current.json +95 -0
  99. package/contracts/fixtures/orientation/envelope/freshness_unknown.json +97 -0
  100. package/contracts/fixtures/orientation/envelope/legacy_baseline.json +95 -0
  101. package/contracts/fixtures/orientation/envelope/orientation_available.json +136 -0
  102. package/contracts/fixtures/orientation/envelope/recovered_interrupted_update.json +136 -0
  103. package/contracts/fixtures/orientation/envelope/refused.json +100 -0
  104. package/contracts/fixtures/orientation/envelope/restart_required.json +137 -0
  105. package/contracts/fixtures/orientation/envelope/updated.json +135 -0
  106. package/contracts/fixtures/orientation/hostile-target/README.md +61 -0
  107. package/contracts/fixtures/orientation/hostile-target/manifest.json +82 -0
  108. package/contracts/fixtures/orientation/hostile-target/repo/CHANGELOG.md +18 -0
  109. package/contracts/fixtures/orientation/hostile-target/repo/bin/intended.mjs +12 -0
  110. package/contracts/fixtures/orientation/hostile-target/repo/bin/tripwire.mjs +15 -0
  111. package/contracts/fixtures/orientation/hostile-target/repo/contracts/release-ledger.json +48 -0
  112. package/contracts/fixtures/orientation/hostile-target/repo/contracts/supported-surface.json +17 -0
  113. package/contracts/fixtures/orientation/hostile-target/repo/docs/example-contract.md +13 -0
  114. package/contracts/fixtures/orientation/hostile-target/repo/hooks/post-checkout +5 -0
  115. package/contracts/fixtures/orientation/hostile-target/repo/hooks/post-merge +5 -0
  116. package/contracts/fixtures/orientation/hostile-target/repo/hooks/pre-commit +5 -0
  117. package/contracts/fixtures/orientation/hostile-target/repo/hostile-dependency-tripwire/package.json +15 -0
  118. package/contracts/fixtures/orientation/hostile-target/repo/hostile-dependency-tripwire/tripwire.mjs +9 -0
  119. package/contracts/fixtures/orientation/hostile-target/repo/package.json +20 -0
  120. package/contracts/fixtures/orientation/hostile-target/repo/schemas/example.v0.schema.json +15 -0
  121. package/contracts/fixtures/orientation/release-gate/cases.json +1073 -0
  122. package/contracts/fixtures/runtime-recipe/accept/current.json +299 -0
  123. package/contracts/fixtures/runtime-recipe/accept/minimal.json +294 -0
  124. package/contracts/fixtures/runtime-recipe/dist-states.json +51 -0
  125. package/contracts/fixtures/runtime-recipe/manifest.json +85 -0
  126. package/contracts/fixtures/runtime-recipe/reject/advisory-enforcement.json +299 -0
  127. package/contracts/fixtures/runtime-recipe/reject/allowlist-without-hosts.json +297 -0
  128. package/contracts/fixtures/runtime-recipe/reject/committed-output-claim.json +299 -0
  129. package/contracts/fixtures/runtime-recipe/reject/engines-disagreement-warns.json +299 -0
  130. package/contracts/fixtures/runtime-recipe/reject/lifecycle-scripts-enabled.json +299 -0
  131. package/contracts/fixtures/runtime-recipe/reject/missing-required-field.json +251 -0
  132. package/contracts/fixtures/runtime-recipe/reject/unknown-kind.json +299 -0
  133. package/contracts/fixtures/runtime-recipe/reject/unknown-network-policy.json +299 -0
  134. package/contracts/fixtures/runtime-recipe/reject/unknown-output-check.json +310 -0
  135. package/contracts/fixtures/runtime-recipe/reject/unknown-revision.json +299 -0
  136. package/contracts/fixtures/runtime-recipe/reject/unknown-step-id.json +299 -0
  137. package/contracts/fixtures/runtime-recipe/reject/unperformable-check-skipped.json +299 -0
  138. package/contracts/fixtures/runtime-recipe/reject/unpinned-lockfile.json +299 -0
  139. package/contracts/fixtures/sidecar-bundle/production-shaped/.campaign-runtime/assembly-report.json +180 -0
  140. package/contracts/fixtures/sidecar-bundle/production-shaped/.campaign-runtime/build-context.json +115 -0
  141. package/contracts/fixtures/sidecar-bundle/production-shaped/.campaign-runtime/doctor-output.json +29 -0
  142. package/contracts/fixtures/sidecar-bundle/production-shaped/.campaign-runtime/qa-verdict.json +27 -0
  143. package/contracts/fixtures/sidecar-bundle/production-shaped/campaign-runtime.build.json +141 -0
  144. package/contracts/migration-sidecar-bundle.v0.json +149 -0
  145. package/contracts/orientation-limits.v1.json +41 -0
  146. package/contracts/orientation-reason-codes.v1.json +196 -0
  147. package/contracts/private-template-sources.json +8 -0
  148. package/contracts/release-ledger.json +4598 -0
  149. package/contracts/reserved-skill-names.json +13 -0
  150. package/contracts/runtime-recipe.campaigns-os-node-v1.json +299 -0
  151. package/contracts/supported-surface.json +180 -0
  152. package/contracts/template-brand-contract.apollo-mv-single-step.v0.json +27 -0
  153. package/contracts/template-brand-contract.apollo.v0.json +27 -0
  154. package/contracts/template-brand-contract.demeter.v0.json +27 -0
  155. package/contracts/template-brand-contract.olympus-mv-single-step.v0.json +27 -0
  156. package/contracts/template-brand-contract.olympus-mv-two-step.v0.json +28 -0
  157. package/contracts/template-brand-contract.olympus.v0.json +27 -0
  158. package/contracts/template-brand-contract.shared-commerce.v0.json +190 -0
  159. package/contracts/template-brand-contract.shop-single-step.v0.json +27 -0
  160. package/contracts/template-brand-contract.shop-three-step.v0.json +29 -0
  161. package/contracts/template-slot-manifest.apollo-mv-single-step.v0.json +14 -0
  162. package/contracts/template-slot-manifest.apollo.v0.json +12 -0
  163. package/contracts/template-slot-manifest.demeter.v0.json +30 -0
  164. package/contracts/template-slot-manifest.olympus-mv-single-step.v0.json +14 -0
  165. package/contracts/template-slot-manifest.olympus-mv-two-step.v0.json +15 -0
  166. package/contracts/template-slot-manifest.olympus.v0.json +12 -0
  167. package/contracts/template-slot-manifest.shared-content-core.v0.json +4254 -0
  168. package/contracts/template-slot-manifest.shop-single-step.v0.json +47 -0
  169. package/contracts/template-slot-manifest.shop-three-step.v0.json +33 -0
  170. package/docs/brand-theme-bridge.md +159 -0
  171. package/docs/build-packet.md +1300 -0
  172. package/docs/campaign-build-brief.md +145 -0
  173. package/docs/campaign-standardization-report.md +329 -0
  174. package/docs/campaigns-os-build-flow.md +117 -0
  175. package/docs/design-source-package.md +784 -0
  176. package/docs/legacy-migration.md +58 -0
  177. package/docs/migration-sidecar-bundle.md +139 -0
  178. package/docs/orientation-contract-reference.md +1220 -0
  179. package/docs/polish-evidence.md +502 -0
  180. package/docs/qa-and-test-orders.md +1691 -0
  181. package/docs/release-ledger-authoring-guide.md +274 -0
  182. package/docs/runtime-readiness.md +211 -0
  183. package/docs/supported-surface.md +83 -0
  184. package/docs/versioning.md +55 -0
  185. package/docs/workflow-findings-sidecar.md +588 -0
  186. package/package.json +135 -0
  187. package/prompts/first-build.md +27 -0
  188. package/prompts/friction-log.md +30 -0
  189. package/schemas/campaign-build-brief.v1.schema.json +149 -0
  190. package/schemas/campaign-design-source-package.v0.schema.json +697 -0
  191. package/schemas/campaign-runtime-assembly-report.v0.schema.json +390 -0
  192. package/schemas/campaign-runtime-build-context.v0.schema.json +339 -0
  193. package/schemas/campaign-runtime-build-packet.v0.schema.json +452 -0
  194. package/schemas/campaign-spec.v4.schema.json +582 -0
  195. package/schemas/campaigns-os-doctor-output.v0.schema.json +43 -0
  196. package/schemas/campaigns-os-legacy-migration-inventory.v0.schema.json +112 -0
  197. package/schemas/campaigns-os-legacy-provisioning-plan.v0.schema.json +38 -0
  198. package/schemas/campaigns-os-legacy-provisioning-receipt.v0.schema.json +57 -0
  199. package/schemas/campaigns-os-qa-verdict-sidecar.v0.schema.json +150 -0
  200. package/schemas/campaigns-os-qa-verdict.v0.schema.json +438 -0
  201. package/schemas/campaigns-os-release-ledger.v1.schema.json +162 -0
  202. package/schemas/campaigns-os-run-record.v0.schema.json +343 -0
  203. package/schemas/campaigns-os-runtime-recipe.v1.schema.json +313 -0
  204. package/schemas/campaigns-os-sidecar-bundle-conformance.v0.schema.json +78 -0
  205. package/schemas/campaigns-os-tooling-orientation.v1.schema.json +381 -0
  206. package/schemas/campaigns-os-workflow-finding.v0.schema.json +134 -0
  207. package/schemas/source-html-manifest.v0.schema.json +252 -0
  208. package/skills/next-campaigns-build/SKILL.md +73 -0
  209. package/skills/next-campaigns-os/SKILL.md +101 -0
  210. package/skills/next-campaigns-os/references/session-intake.md +160 -0
  211. package/skills/next-campaigns-os-setup/SKILL.md +22 -0
  212. package/skills/next-campaigns-polish/SKILL.md +145 -0
  213. package/skills/next-campaigns-qa/SKILL.md +92 -0
  214. package/skills.json +56 -0
  215. package/skills.sh +64 -0
  216. package/src/adapter-decision-contract.mjs +333 -0
  217. package/src/brand-theme.mjs +1151 -0
  218. package/src/browser-launch.mjs +79 -0
  219. package/src/build-brief.mjs +781 -0
  220. package/src/built-site-scope.mjs +312 -0
  221. package/src/campaign-ecosystem.mjs +734 -0
  222. package/src/campaign-identity.mjs +405 -0
  223. package/src/campaign-workspace.mjs +127 -0
  224. package/src/checkpoint-waiver.mjs +302 -0
  225. package/src/cli.mjs +13442 -0
  226. package/src/commercial-journey.mjs +1119 -0
  227. package/src/commercial-parity.mjs +965 -0
  228. package/src/consent.mjs +347 -0
  229. package/src/content-residue.mjs +322 -0
  230. package/src/deadline.mjs +81 -0
  231. package/src/design-source-package.mjs +2604 -0
  232. package/src/deviation.mjs +107 -0
  233. package/src/doctor-check-registry.mjs +49 -0
  234. package/src/doctor-sidecar.mjs +106 -0
  235. package/src/finding-cause.mjs +557 -0
  236. package/src/findings.mjs +326 -0
  237. package/src/fs-identity.mjs +68 -0
  238. package/src/gate-actions.mjs +105 -0
  239. package/src/html-scan.mjs +53 -0
  240. package/src/install-mode.mjs +272 -0
  241. package/src/legacy-migration.d.ts +128 -0
  242. package/src/legacy-migration.mjs +510 -0
  243. package/src/lifecycle.mjs +338 -0
  244. package/src/local-proof.mjs +401 -0
  245. package/src/map-pin-writeback.mjs +210 -0
  246. package/src/orchestration-stage-contract.mjs +81 -0
  247. package/src/package-install-fixture.mjs +33 -0
  248. package/src/page-kit-build-summary.mjs +175 -0
  249. package/src/page-kit-campaign-config.mjs +57 -0
  250. package/src/page-kit-sdk-version.mjs +392 -0
  251. package/src/page-kit-store-profile.mjs +369 -0
  252. package/src/page-kit-sync.mjs +162 -0
  253. package/src/polish-browser.mjs +867 -0
  254. package/src/polish-capture.mjs +1094 -0
  255. package/src/polish-deadline.mjs +51 -0
  256. package/src/polish-gate.mjs +739 -0
  257. package/src/polish-node.mjs +639 -0
  258. package/src/polish-page-load.mjs +1100 -0
  259. package/src/private-template-source.mjs +237 -0
  260. package/src/proof-policy.mjs +82 -0
  261. package/src/qa-analytics-correctness.mjs +307 -0
  262. package/src/qa-analytics-errors.mjs +38 -0
  263. package/src/qa-analytics-parity.mjs +699 -0
  264. package/src/qa-binding-evidence.mjs +140 -0
  265. package/src/qa-browser.mjs +6608 -0
  266. package/src/qa-cart-entry.mjs +406 -0
  267. package/src/qa-commercial-parity.mjs +641 -0
  268. package/src/qa-node.mjs +3620 -0
  269. package/src/qa-order-bump.mjs +381 -0
  270. package/src/qa-parity-capture.mjs +428 -0
  271. package/src/qa-parity-fixture.mjs +359 -0
  272. package/src/qa-publish.mjs +362 -0
  273. package/src/qa-purchase-data-layer.mjs +263 -0
  274. package/src/qa-route-probe.mjs +272 -0
  275. package/src/qa-sidecar.mjs +188 -0
  276. package/src/qa-test-order-topology.mjs +207 -0
  277. package/src/qa-url-privacy.mjs +13 -0
  278. package/src/qa-verdict-discovery.mjs +192 -0
  279. package/src/qa-verdict-publish.mjs +105 -0
  280. package/src/qa-verdict.mjs +287 -0
  281. package/src/remit.mjs +388 -0
  282. package/src/repo-scan.mjs +83 -0
  283. package/src/route-identity.mjs +133 -0
  284. package/src/run-record-closeout.mjs +229 -0
  285. package/src/run-record.mjs +839 -0
  286. package/src/run-session.mjs +226 -0
  287. package/src/runtime-state-ignore.mjs +113 -0
  288. package/src/sdk-attribute-index.mjs +212 -0
  289. package/src/sdk-markup.mjs +358 -0
  290. package/src/sdk-meta-tags.mjs +52 -0
  291. package/src/shell-token.mjs +7 -0
  292. package/src/sidecar-bundle.mjs +399 -0
  293. package/src/source-asset-crawl.mjs +469 -0
  294. package/src/source-html-intake.mjs +627 -0
  295. package/src/source-html-manifest.mjs +276 -0
  296. package/src/source-prep.mjs +284 -0
  297. package/src/spec-derive-store.mjs +431 -0
  298. package/src/spec-derive.mjs +514 -0
  299. package/src/spec-fetch.mjs +66 -0
  300. package/src/spec-hash.mjs +48 -0
  301. package/src/spec-identity.mjs +27 -0
  302. package/src/stage-ledger.mjs +509 -0
  303. package/src/standardization-report.mjs +1297 -0
  304. package/src/template-brand-contract.mjs +473 -0
  305. package/src/template-freshness.mjs +196 -0
  306. package/src/template-reference.mjs +81 -0
  307. package/src/template-slot-manifest.mjs +150 -0
  308. package/src/text-safety.mjs +62 -0
  309. package/src/theme-gate.mjs +185 -0
  310. package/src/upsell-selector-scope.mjs +299 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ @nextcommerce/campaigns-os
2
+ Copyright 2026 Next Commerce Pte. Ltd.
3
+
4
+ Licensed under the Apache License, Version 2.0. See LICENSE.
package/README.md ADDED
@@ -0,0 +1,368 @@
1
+ # Campaigns OS
2
+
3
+ Campaigns OS is the developer toolkit for agent-assisted campaign builds on [Next Commerce](https://nextcommerce.com), a full-stack ecommerce platform for direct-response brands. A *campaign* is a short, conversion-focused funnel — landing page, checkout, optional upsells/downsells, receipt — wired to live products, price tiers, shipping, and payments.
4
+
5
+ This toolkit gives campaign developers and AI coding tools a clear path for assembling one from prepared page files:
6
+
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.
10
+ 4. Bring prepared HTML/CSS/assets for the campaign pages.
11
+ 5. Provide or generate a [Campaign Build Brief](./docs/campaign-build-brief.md) for merchandising/design presentation decisions.
12
+ 6. Create and doctor a Build Packet.
13
+ 7. Hand off to `next-campaigns-build`.
14
+ 8. Run build/lint, then install the Campaigns OS Playwright browser once with `campaigns-os qa install-browser`.
15
+ 9. Run `next-campaigns-polish`, serve the current build, and run the mandatory `campaigns-os polish capture` producer before marking Polish complete.
16
+ 10. Deploy a preview.
17
+ 11. Run `next-campaigns-qa` against the tested URL.
18
+ 12. Record launch blockers and follow-up work.
19
+
20
+ The toolkit is contract-backed: starter templates describe which parts are reusable page structure, which parts are live commerce wiring, and which demo values must be replaced for a real campaign. That helps AI tools avoid common mistakes like carrying over sample package IDs, copying shipping options from the wrong template shape, or editing SDK-owned checkout surfaces as plain HTML.
21
+
22
+ ## Quick Start
23
+
24
+ You do not need to clone this repository to use it. The toolkit is pinned as a
25
+ devDependency of the campaign folder (a page-kit project) and runs through
26
+ `npx campaigns-os …` from that folder — the pin is committed in `package.json`,
27
+ so CI and the deploy host install the same commit. Requirements: Node
28
+ `>=20.19.0` and npm 10 or 11 (Node 22 ships npm 10). Three steps, in this
29
+ order:
30
+
31
+ 1. **Orient before you run anything.** Read
32
+ [`AGENTS.md`](AGENTS.md), `contracts/supported-surface.json`,
33
+ `contracts/release-ledger.json` and `CHANGELOG.md` on GitHub at one commit,
34
+ and keep that commit's sha. Orientation is a read of declarative data; it
35
+ never executes toolkit code.
36
+ 2. **Pin the toolkit and install its agent skills** from that same commit.
37
+ 3. **Start a build** from that same commit.
38
+
39
+ ```bash
40
+ mkdir "<route>" && cd "<route>"
41
+ npm init -y && npm i next-campaign-page-kit
42
+ npx campaign-init --non-interactive --template <family> --slug "<route>" --name "<campaign name>"
43
+ npm i -D "github:NextCommerceCo/campaigns-os#<sha>"
44
+ npx campaigns-os tooling status --platform claude
45
+ npx campaigns-os install-skills --platform claude
46
+ mkdir -p source
47
+ ```
48
+
49
+ The toolkit is also published to npm as `@nextcommerce/campaigns-os`, so the
50
+ CLI can be installed once, globally, instead of pinned per campaign:
51
+
52
+ ```bash
53
+ npm install -g @nextcommerce/campaigns-os
54
+ campaigns-os tooling status --platform claude
55
+ ```
56
+
57
+ A global install ships without a browser. Polish capture and QA need the
58
+ Playwright Chromium: run `campaigns-os qa install-browser` once. Playwright
59
+ itself is an optional dependency, installed by default; an install that
60
+ omitted it (`--omit=optional`) is told exactly that by the commands that need
61
+ it, and every other command runs without it.
62
+ Releases are cut by pushing a `v<version>` tag that matches `package.json`
63
+ and `surface_version` on a commit on `main`; `.github/workflows/publish.yml`
64
+ runs the full check in an unprivileged job and publishes the verified tarball
65
+ with provenance from a second, environment-gated job.
66
+
67
+ For an existing page-kit campaign, skip the first three lines and `cd` into it
68
+ (its `package.json` already declares `next-campaign-page-kit`). `#<sha>` is
69
+ the commit you oriented on, so the code that runs is the code whose contracts
70
+ you read; npm records the resolved commit in the folder's `package.json` and
71
+ `package-lock.json`, which is how `tooling status` can print `Install mode:
72
+ package install (node_modules), pinned at <version> @ <sha>`. The install runs
73
+ the package's own build step (about 7 s). On a fresh profile that first
74
+ `tooling status --platform claude` exits 2 with `ATTENTION_REQUIRED` and one
75
+ action, the `install-skills` line — it is telling you the skills are not
76
+ installed yet, not that the install failed; run it again after
77
+ `install-skills` for `READY`. Without `--platform`, status checks every agent
78
+ profile (Claude, Codex, shared) and stays at exit 2 until each is installed.
79
+ `install-skills` writes `~/.claude/skills` (`--platform codex` writes
80
+ `~/.codex/skills`), replacing same-name folders; restart the agent after.
81
+ Prepared page HTML goes in `./source`, which must exist even when every page is
82
+ template stock. To move to a newer commit, re-orient on it and run `npm i -D
83
+ "github:NextCommerceCo/campaigns-os#<new-sha>"` again.
84
+
85
+ > **Heads up — `start` turns on run telemetry, and remit is ON by default.**
86
+ > The first `start` opens a run session in the target folder and, unless you
87
+ > opt out, the session's Run Record is remitted to the Campaigns telemetry
88
+ > endpoint with the packet's Campaigns API key. Opt out with
89
+ > `npx campaigns-os telemetry off`, `CAMPAIGNS_OS_TELEMETRY=off`, or
90
+ > `--no-remit` on the remitting command; capture stays local either way. The
91
+ > full note — endpoint, payload, what `off` changes, and `--no-run-session` —
92
+ > is in [docs/quickstart.md](docs/quickstart.md) above the first `start`; the
93
+ > contract is [Run Telemetry](docs/workflow-findings-sidecar.md).
94
+
95
+ ```bash
96
+ npx campaigns-os start --map-id <map-id> --target . --source ./source --template-family <family>
97
+ npx campaigns-os next --packet ./campaign-runtime.build.json --json
98
+ ```
99
+
100
+ `--map-id <id>` starts from a map saved in Campaign Map Builder (add
101
+ `--proxy-base <origin>` when the map was saved on a non-production map store);
102
+ `--spec <campaignspec.json>` starts from a local export instead. `--source` is
103
+ always required: the folder of prepared HTML/CSS/assets for the pages you are
104
+ building, with a source manifest that carries desktop and mobile screenshot
105
+ proof for each designed page
106
+ ([Design Source Package](docs/design-source-package.md)). Pages that use the
107
+ starter family's own design are declared, not omitted — see the template-stock
108
+ note below.
109
+
110
+ `start` ends by running doctor, and doctor's first verdict on a fresh target is
111
+ normally `BLOCKED` with a list of what to supply — missing screenshot proof,
112
+ demo values to replace, a scaffold to run. That list is the intake checklist,
113
+ not a failed install. The demo values are the store profile and SDK pin
114
+ `campaign-init` seeded into `_data/campaigns.json`; doctor prints the one
115
+ command that replaces them from the CampaignSpec, `npx campaigns-os page-kit
116
+ sync --packet campaign-runtime.build.json`, and after it both page-kit gates
117
+ pass. The reverse write exists for a configured campaign: `npx campaigns-os
118
+ spec derive --packet campaign-runtime.build.json` copies what the repo already
119
+ states (the SDK pin, page routes, analytics ids) into the local CampaignSpec,
120
+ and with `--write-map` records the pin in the saved Map's Build hints too, so
121
+ a bump in the repo is one edit followed by a derive rather than a hand edit
122
+ in two tools; with `--from-store <subdomain>` and the store's Admin API read
123
+ token in the environment it derives the store profile from the store as well. Everything after `start` is agent-driven: after `start`
124
+ and after every stage, run `next` and do what it prints — it names the skill
125
+ and the exact commands for the next stage, already spelled `npx campaigns-os
126
+ …` for this install, which is why `install-skills` comes first. The browser
127
+ for polish capture and QA is a one-time `npx campaigns-os qa install-browser`,
128
+ which installs the browser for the Playwright this toolkit bundles. A pin
129
+ older than that command shows `npx playwright install chromium` instead; that
130
+ is equivalent only when `npx playwright` resolves to the toolkit's Playwright
131
+ (a campaign that depends on its own Playwright version gets that one's
132
+ browser instead), so prefer `qa install-browser` on pins that have it.
133
+
134
+ ### Other ways to run it
135
+
136
+ The pinned devDependency above is the primary path. To change the toolkit, use
137
+ a checkout ([docs/quickstart.md](docs/quickstart.md)): every `npm run
138
+ campaigns-os -- <command> …` example in this repository is that checkout form,
139
+ and from a campaign folder the same command is `npx campaigns-os <command> …`
140
+ with identical arguments (`npm run qa:install-browser` is the checkout's
141
+ `qa install-browser`).
142
+
143
+ From a checkout, the same first run uses the bundled example inputs:
144
+
145
+ ```bash
146
+ npm install
147
+ npm run campaigns-os -- tooling status
148
+ npm run campaigns-os -- start \
149
+ --spec examples/campaignspec.v42.basic.json \
150
+ --source examples/source-html \
151
+ --target examples/target-page-kit \
152
+ --template-family olympus
153
+ ```
154
+
155
+ If that first run stops at intake with `DESIGN_SOURCE_PACKAGE_NOT_READY`, the
156
+ source material arrived without desktop/mobile screenshot proof. Supply it
157
+ through `pages[].screenshots[]` in
158
+ `<source-root>/.campaigns-os/source-html-manifest.json` — or in a manifest
159
+ outside the source root named with `--design-manifest <path>`, when the source
160
+ tree is not yours to write — and follow
161
+ [Clearing `DESIGN_SOURCE_PACKAGE_NOT_READY`](docs/design-source-package.md#clearing-design_source_package_not_ready),
162
+ which also gives the recovery sequence for the package a blocked run left behind.
163
+
164
+ That path assumes the pages carry a standalone design of the merchant's. If they
165
+ are template stock instead — no bespoke design, the starter family *is* the
166
+ design — there is no screenshot to honestly supply. Declare those pages out of
167
+ source scope (a manifest `skip_reason` entry, or CampaignSpec
168
+ `build_scope.mode: "partial"`): intake records them as template stock, demands
169
+ no design source for them, and the build stage materialises each from the
170
+ locked family's own page. A family that publishes Template Reference proof
171
+ (today `apollo`) covers them with `template_baseline`; every other family
172
+ records an accepted Source Gap and intake lands at `ready_with_gaps`. See
173
+ [Template-stock pages: the family decides](docs/design-source-package.md#template-stock-pages-the-family-decides).
174
+
175
+ The command writes these target-repo artifacts:
176
+
177
+ - `campaign-runtime.build.json`
178
+ - `.campaign-runtime/build-context.json`
179
+ - `.campaign-runtime/assembly-report.json`
180
+ - `.campaign-runtime/doctor-output.json`
181
+ - `.campaign-runtime/qa-verdict.json` (after QA)
182
+ - `.campaign-runtime/agent-context/*`
183
+
184
+ Validate the standardized CI/readback set with:
185
+
186
+ ```bash
187
+ npm run campaigns-os -- bundle check --packet <page-kit-repo>/campaign-runtime.build.json --json
188
+ ```
189
+
190
+ Use `--require-qa` when the campaign claims QA is complete. `status: conformant`
191
+ means the sidecars agree with each other and the contract; it says nothing about
192
+ whether doctor or QA passed. Read the warnings for that (a blocked doctor run
193
+ emits `bundle.doctor_output.blocked`, a blocked QA verdict
194
+ `bundle.qa_verdict.blocked`). See
195
+ [Migration sidecar bundle v0](docs/migration-sidecar-bundle.md).
196
+
197
+ Then ask your AI tool to continue from the emitted handoff. Fresh target repos usually start with `next-campaigns-os-setup`; existing campaign directories can move directly to `next-campaigns-build`.
198
+
199
+ ## Source Files
200
+
201
+ 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.
202
+
203
+ For raw AI-generated or exported static HTML, "prepared" means page-kit-ready
204
+ source, not a browser document dropped in unchanged and not a wholesale Liquid
205
+ rewrite. Page Kit source is HTML with YAML frontmatter and optional Liquid
206
+ helpers. Convert standalone HTML into the target page format first: remove outer
207
+ `<html>`, `<head>`, and `<body>` wrappers, add page frontmatter, move shared
208
+ CSS/assets into the campaign asset tree when useful, root links/assets with
209
+ `campaign_link` and `campaign_asset` when needed, and keep landing/presell
210
+ design markup separate from SDK-owned commerce controls.
211
+
212
+ ## Important Commands
213
+
214
+ ```bash
215
+ npm run campaigns-os -- tooling status
216
+ npm run campaigns-os -- install-skills --dry-run
217
+ npm run campaigns-os -- install-skills --platform codex --dry-run
218
+ npm run campaigns-os -- qa install-browser
219
+ npm run skills -- status
220
+ npm run campaigns-os -- prepare-build --spec <spec.json> --source <html-dir> --target <page-kit-repo> --template-family <family> --brief <campaign-build-brief.yaml>
221
+ npm run campaigns-os -- doctor --packet <page-kit-repo>/campaign-runtime.build.json
222
+ npm run campaigns-os -- standardize --target <page-kit-repo-or-cpk-repo> --json
223
+ npm run campaigns-os -- theme inspect --packet <page-kit-repo>/campaign-runtime.build.json --json
224
+ npm run campaigns-os -- theme generate --packet <page-kit-repo>/campaign-runtime.build.json --json
225
+ npm run campaigns-os -- next setup --packet <page-kit-repo>/campaign-runtime.build.json
226
+ npm run campaigns-os -- next build --packet <page-kit-repo>/campaign-runtime.build.json
227
+ npm run qa:install-browser
228
+ npm run campaigns-os -- next polish --packet <packet.json> --report <assembly-report.json>
229
+ npm run campaigns-os -- polish capture --packet <packet.json> --base-url <served-current-build-url>
230
+ npm run campaigns-os -- next qa --packet <packet.json> --report <assembly-report.json>
231
+ npm run campaigns-os -- qa resolve --packet <packet.json>
232
+ npm run campaigns-os -- qa run --packet <packet.json> --base-url <preview-url> --browser --test-order common
233
+ npm run smoke:polish-capture
234
+ npm run campaigns-os -- findings add --stage overall --kind positive_signal --summary "..."
235
+ npm run campaigns-os -- findings harvest --packet <packet.json>
236
+ npm run campaigns-os -- findings export --summary
237
+ ```
238
+
239
+ Doctor inspects without changing the retained Assembly Report or doctor sidecar.
240
+ A stale local `_site` still fails the current inspection; it does not rewrite
241
+ the proof of an earlier delivered build. Use `doctor --packet <packet> --write`
242
+ only when deliberately recording a new doctor stage. `--no-write` overrides
243
+ `--write`. A custom `--doctor-out <path>` also requires `--write`; naming an
244
+ output path alone does not create or refresh the file. Build/QA producer
245
+ commands continue to record their own stages.
246
+ Do not use `prepare-build --force` merely to refresh a catalog path: doctor
247
+ already resolves the running toolkit's catalog, and force clears stage evidence.
248
+
249
+
250
+ `qa run` automatically checks contract-governed authored price, recurring
251
+ cadence, and voucher claims against fresh `/api/price-preview` results for
252
+ commercial pages. It needs no private repo import or extra catalog flag; proven
253
+ mismatches are warn-severity pricing assertions in the normal verdict.
254
+
255
+ Run `tooling status` before a build session. It names the install mode — a
256
+ pinned package (`npx`, or a consumer's `node_modules`) or a git checkout — and
257
+ checks that the package metadata, CLI entrypoint, and installed Campaigns OS
258
+ skills agree. For a checkout it also reports branch, upstream, and ahead/behind;
259
+ for a package install the pinned commit is the freshness answer, and there is
260
+ no npm dist-tag to compare against. Neither mode makes agent skills current on
261
+ its own: when skills are stale, run `install-skills --platform all` through the
262
+ same prefix you ran `tooling status` with (the status output prints the exact
263
+ command) and restart local agent sessions.
264
+
265
+ Run `campaigns-os qa install-browser` (`npm run qa:install-browser` from a
266
+ checkout) once after install/update and before mandatory `polish capture` or
267
+ any QA command that uses `--browser` or `--test-order`. It installs the Chromium
268
+ binary used by the package-owned Playwright flow;
269
+ Campaigns OS proof should not depend on external browser skills. `polish
270
+ capture` must run against the served current build before Polish becomes
271
+ terminal, deploy begins, or QA starts.
272
+
273
+ `npm run smoke:polish-capture` is an optional real-Chromium package smoke. It
274
+ requires the installed browser and permission to open a loopback HTTP listener;
275
+ it is intentionally excluded from `npm run check` and CI.
276
+
277
+ ## Template Contracts
278
+
279
+ The starter-template catalog snapshot lives in `contracts/commerce-surface-catalog.json`.
280
+
281
+ For each selected family, the agent must read:
282
+
283
+ - `families[family].agentContract`
284
+ - `sharedFrontmatterVocabulary`
285
+ - `frontmatter.demoOnlyValues`
286
+ - `frontmatter.replaceFromSpecOrApi`
287
+ - `frontmatter.removeWhenUnsupported`
288
+
289
+ Shipping is family-specific. Families whose contracts include `shipping_methods`
290
+ or `shipping_method` must source those refs from CampaignSpec/API. Families that
291
+ do not own explicit shipping frontmatter, including `shop-single-step`, should
292
+ not receive copied Olympus-style `shipping_methods` blocks. Special case:
293
+ `shop-three-step` uses dynamic shipping through `window.next.getShippingMethods()`.
294
+
295
+ When bootstrapping a family such as `demeter`, copy the family as an atomic
296
+ page-kit slice. Checkout/receipt pages depend on matching `_includes/`,
297
+ `_layouts/`, `assets/css/`, and `assets/js/`; copying only individual page files
298
+ is not a valid minimum file set.
299
+
300
+ ## Spec Validation
301
+
302
+ `campaign-spec/` is the single, public source of truth for CampaignSpec
303
+ validation: a `normalize` phase, a composable rule registry, and a fixture
304
+ corpus. The `doctor` runs these rules during spec validation (emitted under the
305
+ `spec.validation` code, complementary to its packet/build-aware spec checks), and
306
+ any campaign authoring UI (such as a Map Builder bundle) can import the same
307
+ registry — so a spec rule is authored once and reaches internal teams and
308
+ third-party agencies alike. The rules are authored in TypeScript with no heavy
309
+ dependencies and compiled to plain ESM (`npm run build:spec`, on `prepare`) and a
310
+ stable subpath export `@nextcommerce/campaigns-os/campaign-spec`, so consumers run
311
+ them on `engines.node` (>=20) with no type-stripping or build step of their own.
312
+ See [`campaign-spec/README.md`](campaign-spec/README.md).
313
+
314
+ ## Docs
315
+
316
+ - [Quickstart](docs/quickstart.md)
317
+ - [Access Model](docs/access-model.md)
318
+ - [Build Packet](docs/build-packet.md)
319
+ - [Supported Surface](docs/supported-surface.md) — what downstream consumers may depend on, and the gate that enforces it
320
+ - [Brand Theme Bridge](docs/brand-theme-bridge.md)
321
+ - [CampaignSpec Authoring Examples](docs/campaignspec-authoring-examples.md)
322
+ - [Campaigns OS Build Flow](docs/campaigns-os-build-flow.md)
323
+ - [Campaign Standardization Report](docs/campaign-standardization-report.md)
324
+ - [Entry Points](docs/entry-points.md) — five intake shapes (template-stock, Figma-driven, AI-generated, hand-authored, mixed) and which producer / manifest each one ships with
325
+ - [Source Adapters](docs/source-adapters.md)
326
+ - [Setup Profile Parity](docs/setup-profile-parity.md)
327
+ - [Developer Evaluation](docs/developer-evaluation.md)
328
+ - [QA And Test Orders](docs/qa-and-test-orders.md)
329
+ - [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
330
+ - [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
331
+ - [Small PR Review Path](docs/small-pr-review-path.md)
332
+ - [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
333
+ - [Versioning](docs/versioning.md)
334
+
335
+ ## Status
336
+
337
+ Developer preview. Build output still needs the normal proof gates: build/lint evidence, polish plus package-owned page-load capture against the served current build, preview deploy or local dev URL, Playwright browser QA, and typed-card test-order proof via `--test-order common` (global test cards bypass the gateway and create no transactions; no approval needed — depth is the only control). Localhost on any port is a Campaigns App Development domain, so SDK calls are allowed and analytics are suppressed there; non-localhost preview/production origins still need SDK origin allowlist confirmation.
338
+
339
+ Launch readiness is separate from Campaigns OS proof. Before real shoppers see a campaign, confirm the production storefront URL, live payment methods, shipping markets, legal/support URLs, analytics expectations, and merchant-side configuration.
340
+
341
+ ## Review standards
342
+
343
+ Two rules reviewers apply to every patch, beyond the gates in
344
+ `npm run check`:
345
+
346
+ - **A guard test includes the failing case.** A test that passes against the
347
+ unfixed code guards nothing, so assert the behaviour that was broken and check
348
+ that it fails without the fix. Prefer assertions against the parsed module or
349
+ its output — call the function, read the value — over matching substrings of
350
+ source text, which passes on a comment and breaks on a rename.
351
+ - **A `catch` branches on the condition it claims to handle.** Test
352
+ `error.code` (or whatever specific condition the comment justifies), handle
353
+ that case, and journal or rethrow everything else. A bare `catch` that
354
+ swallows every error turns a typo, a permission failure, and an expected
355
+ absence into the same silent success.
356
+
357
+ ## Issue tracking
358
+
359
+ Work in this repo is tracked with GitHub Issues and coordinated on the
360
+ org-level **[Operations](https://github.com/orgs/NextCommerceCo/projects/10)**
361
+ Kanban board (Todo / In Progress / Done). New issues are added to the board
362
+ automatically by the `add-to-project` workflow.
363
+
364
+ Before starting work on an issue: check it is not assigned to someone else,
365
+ assign yourself (`gh issue edit <n> --add-assignee @me`), and move the card to
366
+ In Progress. Open PRs with `Closes #<n>`; when the issue closes on merge, the board's built-in "Item closed" automation moves the card to Done.
367
+ Contributors have a `/next-board` skill that wraps these board operations
368
+ (status, claim, move, create).
@@ -0,0 +1,32 @@
1
+ # Campaigns OS Agent Context
2
+
3
+ You are helping assemble a NEXT campaign through Campaigns OS. Start from the Build Packet, not from private runtime source.
4
+
5
+ Core rules:
6
+
7
+ - Treat CampaignSpec as campaign intent and the Campaigns API as live commerce truth.
8
+ - Treat CampaignSpec validation as owned by the public `@nextcommerce/campaigns-os/campaign-spec` rules surfaced through doctor `spec.validation` findings; use structured rule/path detail when available.
9
+ - Treat the Build Packet as the handoff envelope: source adapter, target repo, template family, deploy target, SDK origin state, and QA proof depth.
10
+ - Read the selected starter template family's `agentContract` and the catalog `sharedFrontmatterVocabulary` before wiring commerce.
11
+ - Replace demo package, shipping, voucher, payment, tracking, footer, and SEO values from CampaignSpec/API.
12
+ - Preserve SDK-owned checkout, cart, upsell, receipt, payment, address, totals, and submit surfaces.
13
+ - Prepared AI/exported HTML must be converted into page-kit-ready source first: keep page-owned body markup, strip document wrappers, add YAML frontmatter, move shared CSS/assets into the campaign structure, and use Liquid helpers only for page-kit links/assets/includes.
14
+ - Preserve prepared source HTML for landing/presell pages when it is a real standalone design.
15
+ - For checkout/upsell/downsell/receipt, use starter-template commerce surfaces as SDK contract references: preserve required `data-next-*` controls and runtime wiring, but let the campaign/source own visual chrome, copy hierarchy, imagery, and brand layer.
16
+ - If `.campaign-runtime/build-context.json` has `theme` or `.campaign-runtime/theme/theme-report.json` exists, use it as optional brand-theme evidence. A generated `brand-theme.css` must load after `next-core.css`; missing or low-confidence theme is a warning/skipped reason, not permission to edit SDK-owned runtime surfaces.
17
+ - Copy a starter template family atomically with dependent pages, `_includes/`, `_layouts/`, `assets/css/`, and `assets/js/`; do not copy only checkout/receipt pages.
18
+ - Resolve SDK routing meta tags to campaign-root paths such as `/campaign-slug/upsell/`; do not emit source filenames or unrooted `upsell/` values into built checkout/upsell pages.
19
+ - Default one-time `packages.prepurchase_*` order bumps to fixed quantity rather than syncing with the main bundle unless the spec explicitly requires sync.
20
+ - Record spec-driven removals, such as unavailable payment methods, so polish does not reintroduce them.
21
+ - Do not copy Olympus-style `shipping_methods` frontmatter into `shop-three-step`; it uses dynamic shipping through `window.next.getShippingMethods()`.
22
+ - Run build/lint checks and record evidence in the assembly report, then hand off to polish. Before Polish becomes terminal or hands off to deploy/QA, install the package-owned Playwright browser with `npm run qa:install-browser`, serve the current build, and run `campaigns-os polish capture --packet campaign-runtime.build.json --base-url <served-current-build-url>`.
23
+ - After that checkpoint clears, QA uses the Campaigns OS Node/npm runner: run `campaigns-os qa resolve --packet campaign-runtime.build.json`, then run `campaigns-os qa run --packet campaign-runtime.build.json --base-url <url> --browser --test-order common`.
24
+ - Typed-card test-order proof uses `campaigns-os qa run --test-order <common|checkout|decline|accept|both|full|explicit-path>` through the deployed checkout and rendered upsell controls. `common` runs the checkout baseline, first-offer accept and decline, and a deduplicated shortest real receipt path when that adds coverage (at most four orders). `full` walks every actual terminal path in the selected checkout topology; cycles, missing routes, and reachable nonterminals block exhaustive proof before browser launch. The accidental-flood cap remains `6`, and an overflow names the exact explicit `--max-test-orders` raise. Coverage is the only control — there is no permission/approval step.
25
+ - Analytics correctness is two-phase: the campaign-root visit inventories declared providers/tags only, and the same canonical typed-card run proves Purchase only from the topology-recognized final receipt document after `--analytics-settle`. Missing/unrecognized receipts are manual-review warnings; recognized receipt no-signal and capture/settle errors block. Only the genuine recognized-receipt/no-signal failure is waivable; capture/settle errors are not. Checkout/upsell signals remain whole-journey parity evidence and cannot satisfy a silent receipt.
26
+ - Test-order proof must use the canonical Playwright typed-card path through the tested checkout: select the rendered cart, fill customer/shipping fields, type the sandbox card into active hosted payment iframes, click the real submit button, then click rendered SDK upsell accept/decline controls and verify receipt/order evidence.
27
+ - Do not use `next.getCartData().cartLines` as cart-populated proof; use typed-card order read-back, `cart:updated` payload `items` / `summary.lines`, and rendered bundle DOM evidence.
28
+ - Do not use external browser skills, the SDK test-mode event, or hand-built backend API orders as launch proof. Those are diagnostic fallbacks only when explicitly requested.
29
+ - Test orders are safe to fire any time: global test cards bypass the gateway, create no transactions, and need no merchant-specific routing confirmation. Localhost on any port is a Campaigns App Development domain for SDK QA with analytics suppressed; non-localhost preview/production origins must be allowlisted for the campaign API key so the SDK loads — that is about SDK initialization, not test-order permission.
30
+ - Campaigns OS proof is not merchant launch readiness. Before launch, confirm production storefront URL, live payment methods, shipping markets, legal/support URLs, analytics expectations, and merchant-side configuration.
31
+
32
+ Current source adapter: prepared HTML/assets (`html_funnel`).
@@ -0,0 +1,27 @@
1
+ # Campaigns OS Agent Context
2
+
3
+ Use this context when working in a target campaign repo with Campaigns OS artifacts.
4
+
5
+ - Read `campaign-runtime.build.json` first.
6
+ - If `.campaign-runtime/build-context.json` or `.campaign-runtime/assembly-report.json` exists, read them before editing campaign files.
7
+ - Run `campaigns-os doctor --packet campaign-runtime.build.json` before build work.
8
+ - Treat CampaignSpec validation as owned by the public `@nextcommerce/campaigns-os/campaign-spec` rules surfaced through doctor `spec.validation` findings; use structured rule/path detail when available.
9
+ - Respect the selected template family's `agentContract`.
10
+ - Replace demo refs from CampaignSpec/API; do not preserve starter sample IDs.
11
+ - Preserve Campaign Cart SDK-owned checkout, cart, upsell, receipt, payment, address, totals, and submit surfaces.
12
+ - Prepared AI/exported HTML must be converted into page-kit-ready source first: keep page-owned body markup, strip document wrappers, add YAML frontmatter, move shared CSS/assets into the campaign structure, and use Liquid helpers only for page-kit links/assets/includes.
13
+ - Preserve prepared source HTML for landing/presell pages when it is a real standalone design.
14
+ - For checkout/upsell/downsell/receipt, use starter-template commerce surfaces as SDK contract references: preserve required `data-next-*` controls and runtime wiring, but let the campaign/source own visual chrome, copy hierarchy, imagery, and brand layer.
15
+ - If `.campaign-runtime/build-context.json` has `theme` or `.campaign-runtime/theme/theme-report.json` exists, use it as optional brand-theme evidence. A generated `brand-theme.css` must load after `next-core.css`; missing or low-confidence theme is a warning/skipped reason, not permission to edit SDK-owned runtime surfaces.
16
+ - Copy a starter template family atomically with dependent pages, `_includes/`, `_layouts/`, `assets/css/`, and `assets/js/`; do not copy only checkout/receipt pages.
17
+ - Emit SDK routing meta tags as campaign-root paths such as `/campaign-slug/upsell/`.
18
+ - Default one-time `packages.prepurchase_*` bumps to fixed quantity unless the CampaignSpec explicitly requires package sync.
19
+ - Record spec-driven drops so polish does not reintroduce unsupported source elements.
20
+ - For `shop-three-step`, keep dynamic shipping via `window.next.getShippingMethods()` and do not add Olympus-style static `shipping_methods` frontmatter.
21
+ - Build hands off to polish. Before Polish becomes terminal or hands off to deploy/QA, install the package-owned Playwright browser with `npm run qa:install-browser`, serve the current build, and run `campaigns-os polish capture --packet campaign-runtime.build.json --base-url <served-current-build-url>`.
22
+ - After that checkpoint clears, QA uses the Campaigns OS Node/npm runner: run `campaigns-os qa resolve`, then `campaigns-os qa run --browser --test-order common` against the tested URL.
23
+ - Typed-card test-order proof uses `campaigns-os qa run --test-order <common|checkout|decline|accept|both|full|explicit-path>` through the tested checkout and rendered upsell controls. Global test cards bypass the gateway and create no transactions, so no permission/approval is needed — coverage is the only control. `common` runs the checkout baseline, first-offer accept and decline, and a deduplicated shortest real receipt path when that adds coverage (at most four orders). `full` walks every actual terminal path in the selected checkout topology; cycles, missing routes, and reachable nonterminals block exhaustive proof before browser launch. The accidental-flood cap remains `6`, and an overflow names the exact explicit `--max-test-orders` raise. Localhost on any port is a Campaigns App Development domain for SDK QA with analytics suppressed; non-localhost preview/production origins still need SDK origin allowlist confirmation. Do not use external browser skills, the SDK test-mode event, or hand-built backend API orders as launch proof.
24
+ - Analytics correctness is two-phase: the campaign-root visit inventories declared providers/tags only, and the same canonical typed-card run proves Purchase only from the topology-recognized final receipt document after `--analytics-settle`. Missing/unrecognized receipts are manual-review warnings; recognized receipt no-signal and capture/settle errors block. Only the genuine recognized-receipt/no-signal failure is waivable; capture/settle errors are not. Checkout/upsell signals remain whole-journey parity evidence and cannot satisfy a silent receipt.
25
+ - Do not use `next.getCartData().cartLines` as cart-populated proof; use typed-card order read-back, `cart:updated` payload `items` / `summary.lines`, and rendered bundle DOM evidence.
26
+ - Campaigns OS proof is not merchant launch readiness. Before launch, confirm production storefront URL, live payment methods, shipping markets, legal/support URLs, analytics expectations, and merchant-side configuration.
27
+ - This is not full automated readiness. QA remains a separate gate.