@nextcommerce/campaigns-os 1.54.0 → 1.57.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 (111) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/CONTEXT.md +19 -5
  3. package/README.md +26 -12
  4. package/campaign-spec/README.md +15 -1
  5. package/campaign-spec/dist/checkout-flow.d.ts +90 -0
  6. package/campaign-spec/dist/checkout-flow.js +229 -0
  7. package/campaign-spec/dist/index.d.ts +1 -0
  8. package/campaign-spec/dist/index.js +6 -1
  9. package/campaign-spec/dist/normalize.d.ts +3 -2
  10. package/campaign-spec/dist/normalize.js +7 -5
  11. package/campaign-spec/dist/routing.d.ts +6 -3
  12. package/campaign-spec/dist/routing.js +6 -3
  13. package/campaign-spec/dist/rules/checkout-forward-target.d.ts +17 -0
  14. package/campaign-spec/dist/rules/checkout-forward-target.js +48 -0
  15. package/campaign-spec/dist/rules/checkout-step-reaches-checkout.d.ts +12 -0
  16. package/campaign-spec/dist/rules/checkout-step-reaches-checkout.js +37 -0
  17. package/campaign-spec/dist/rules/exit-intent-validation.js +2 -1
  18. package/campaign-spec/dist/rules/index.d.ts +4 -0
  19. package/campaign-spec/dist/rules/index.js +12 -0
  20. package/campaign-spec/dist/rules/one-checkout-per-path.d.ts +25 -0
  21. package/campaign-spec/dist/rules/one-checkout-per-path.js +84 -0
  22. package/campaign-spec/dist/rules/pre-payment-forward-target.d.ts +12 -0
  23. package/campaign-spec/dist/rules/pre-payment-forward-target.js +42 -0
  24. package/campaign-spec/dist/rules/promo-code-input-validation.js +2 -1
  25. package/campaign-spec/dist/rules/schema-version.d.ts +9 -4
  26. package/campaign-spec/dist/rules/schema-version.js +10 -5
  27. package/campaign-spec/dist/types.d.ts +20 -3
  28. package/campaign-spec/dist/types.js +3 -2
  29. package/compatibility.json +2 -2
  30. package/contracts/fixtures/runtime-recipe/accept/current.json +6 -1
  31. package/contracts/fixtures/runtime-recipe/accept/minimal.json +6 -1
  32. package/contracts/fixtures/runtime-recipe/dist-states.json +1 -1
  33. package/contracts/fixtures/runtime-recipe/reject/advisory-enforcement.json +6 -1
  34. package/contracts/fixtures/runtime-recipe/reject/allowlist-without-hosts.json +6 -1
  35. package/contracts/fixtures/runtime-recipe/reject/committed-output-claim.json +6 -1
  36. package/contracts/fixtures/runtime-recipe/reject/engines-disagreement-warns.json +6 -1
  37. package/contracts/fixtures/runtime-recipe/reject/lifecycle-scripts-enabled.json +6 -1
  38. package/contracts/fixtures/runtime-recipe/reject/missing-required-field.json +1 -1
  39. package/contracts/fixtures/runtime-recipe/reject/unknown-kind.json +6 -1
  40. package/contracts/fixtures/runtime-recipe/reject/unknown-network-policy.json +6 -1
  41. package/contracts/fixtures/runtime-recipe/reject/unknown-output-check.json +6 -1
  42. package/contracts/fixtures/runtime-recipe/reject/unknown-revision.json +5 -0
  43. package/contracts/fixtures/runtime-recipe/reject/unknown-step-id.json +6 -1
  44. package/contracts/fixtures/runtime-recipe/reject/unperformable-check-skipped.json +6 -1
  45. package/contracts/fixtures/runtime-recipe/reject/unpinned-lockfile.json +6 -1
  46. package/contracts/release-ledger.json +1146 -0
  47. package/contracts/runtime-recipe.campaigns-os-node-v1.json +6 -1
  48. package/contracts/supported-surface.json +9 -5
  49. package/docs/brand-theme-bridge.md +10 -0
  50. package/docs/build-packet.md +86 -26
  51. package/docs/campaigns-os-build-flow.md +1 -1
  52. package/docs/effects.md +2 -5
  53. package/docs/local-setup.md +1 -1
  54. package/docs/orientation-contract-reference.md +1 -1
  55. package/docs/qa-and-test-orders.md +133 -29
  56. package/docs/runtime-readiness.md +8 -3
  57. package/docs/skills-revision.md +10 -10
  58. package/docs/supported-surface.md +1 -1
  59. package/docs/versioning.md +4 -1
  60. package/docs/workflow-findings-sidecar.md +57 -2
  61. package/package.json +4 -1
  62. package/schemas/campaign-runtime-build-context.v0.schema.json +3 -1
  63. package/schemas/campaign-runtime-build-packet.v0.schema.json +3 -1
  64. package/schemas/campaign-spec.v5.schema.json +586 -0
  65. package/schemas/campaigns-os-run-record.v0.schema.json +20 -15
  66. package/skills/campaign-lifecycle-orientation/SKILL.md +10 -8
  67. package/skills/campaign-readback-classification/SKILL.md +3 -3
  68. package/skills/campaign-run-evidence/SKILL.md +3 -3
  69. package/skills/contribution-intake/SKILL.md +3 -3
  70. package/skills/next-campaigns-build/SKILL.md +6 -4
  71. package/skills/next-campaigns-os/SKILL.md +3 -3
  72. package/skills/next-campaigns-os-setup/SKILL.md +3 -3
  73. package/skills/next-campaigns-polish/SKILL.md +21 -6
  74. package/skills/next-campaigns-qa/SKILL.md +5 -4
  75. package/skills.json +10 -10
  76. package/src/adapter-decision-contract.mjs +27 -13
  77. package/src/brand-theme.mjs +44 -8
  78. package/src/build-brief.mjs +14 -5
  79. package/src/campaign-identity.mjs +33 -4
  80. package/src/cli-helpers.mjs +129 -0
  81. package/src/cli.mjs +156 -111
  82. package/src/commercial-journey.mjs +25 -2
  83. package/src/consent.mjs +3 -2
  84. package/src/design-source-package.mjs +1 -1
  85. package/src/design-source-publication.mjs +8 -8
  86. package/src/deviation.mjs +2 -1
  87. package/src/doctor/checks.mjs +212 -19
  88. package/src/doctor/inspect.mjs +4 -2
  89. package/src/doctor/next-step.mjs +46 -16
  90. package/src/doctor-sidecar.mjs +5 -3
  91. package/src/gate-actions.mjs +21 -1
  92. package/src/input-refresh.mjs +6 -6
  93. package/src/invocation.mjs +4 -3
  94. package/src/lifecycle.mjs +88 -6
  95. package/src/local-preview-policy.mjs +116 -12
  96. package/src/login.mjs +2 -1
  97. package/src/polish-browser.mjs +8 -2
  98. package/src/polish-node.mjs +9 -4
  99. package/src/polish-readability.mjs +2 -2
  100. package/src/qa-browser.mjs +741 -120
  101. package/src/qa-cart-entry.mjs +107 -20
  102. package/src/qa-node.mjs +179 -72
  103. package/src/qa-test-order-topology.mjs +118 -1
  104. package/src/qa-verdict-discovery.mjs +21 -4
  105. package/src/qa-verdict-publish.mjs +2 -1
  106. package/src/run-record.mjs +46 -34
  107. package/src/runtime-state-ignore.mjs +7 -5
  108. package/src/sdk-markup.mjs +41 -1
  109. package/src/source-html-intake.mjs +46 -4
  110. package/src/stage-ledger.mjs +18 -4
  111. package/src/stage-record.mjs +53 -16
@@ -3,7 +3,7 @@
3
3
  "_growth_note": "When a bound below is genuinely reached, the answer is to find out why before raising it. A dependency install that exceeds its bound on a warm machine is a supply-chain change, not a slow morning; an output inventory that exceeds its file or byte bound is a build that went wrong, not a package that grew 50x overnight. Raising a bound is the fallback, it advances recipe_revision, and it owes a release-ledger entry. Widening the accepted npm range follows the same path, and its trigger is external and checkable: widen when a Node release line ships that npm major by default, not when a particular machine happens to have it installed.",
4
4
  "schema": "campaigns-os-runtime-recipe/v1",
5
5
  "recipe_kind": "campaigns-os-node-v1",
6
- "recipe_revision": "1.0.2",
6
+ "recipe_revision": "1.0.3",
7
7
  "refusal_reason_code": "runtime_recipe_refused",
8
8
  "fail_closed": true,
9
9
  "unperformable_check_disposition": "failed",
@@ -106,6 +106,7 @@
106
106
  "fingerprint_algorithm": "sha256",
107
107
  "files": [
108
108
  "campaign-spec/analytics-vocabulary.ts",
109
+ "campaign-spec/checkout-flow.ts",
109
110
  "campaign-spec/index.ts",
110
111
  "campaign-spec/normalize.ts",
111
112
  "campaign-spec/package.json",
@@ -113,7 +114,9 @@
113
114
  "campaign-spec/rules/analytics-contract-shape.ts",
114
115
  "campaign-spec/rules/assembly-hints-shape.ts",
115
116
  "campaign-spec/rules/campaign-metadata.ts",
117
+ "campaign-spec/rules/checkout-forward-target.ts",
116
118
  "campaign-spec/rules/checkout-has-success-url.ts",
119
+ "campaign-spec/rules/checkout-step-reaches-checkout.ts",
117
120
  "campaign-spec/rules/cycle-detection.ts",
118
121
  "campaign-spec/rules/design-source-shape.ts",
119
122
  "campaign-spec/rules/downsell-without-upsell.ts",
@@ -124,9 +127,11 @@
124
127
  "campaign-spec/rules/funnel-weight-sum.ts",
125
128
  "campaign-spec/rules/index.ts",
126
129
  "campaign-spec/rules/offer-ref-integrity.ts",
130
+ "campaign-spec/rules/one-checkout-per-path.ts",
127
131
  "campaign-spec/rules/package-pricing-sanity.ts",
128
132
  "campaign-spec/rules/page-count.ts",
129
133
  "campaign-spec/rules/page-id-uniqueness.ts",
134
+ "campaign-spec/rules/pre-payment-forward-target.ts",
130
135
  "campaign-spec/rules/promo-code-input-validation.ts",
131
136
  "campaign-spec/rules/promo-codes-shape.ts",
132
137
  "campaign-spec/rules/route-field-ignored-for-page-type.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_note": "The downstream contract manifest. Everything listed here is SUPPORTED SURFACE: consumers (campaigns-agent, campaign-builder, the private ops repo, page-kit campaign repos) may depend on it, and changing it is a deliberate act — hashed entries require a surface_version bump in the same change (check-supported-surface.mjs --base, mirroring the skills.json bump gate), named entries must keep existing at their path, cli_commands must keep resolving in the CLI dispatch, package_exports must stay exported, and every entry must ship in the npm pack (files[] coverage). Anything NOT listed here — src/** internals, scripts/** checkers, examples/**, prompts/**, contracts/** other than this file and the entries named[] below (the orientation contract, the release ledger, and the consumer-facing orientation fixtures) — is implementation: consumers may read it for context but must not build on it, and it can change without notice. Rationale and the compatibility promise: docs/supported-surface.md.",
3
- "surface_version": "1.54.0",
3
+ "surface_version": "1.57.0",
4
4
  "package_exports": [
5
5
  "./commercial-journey",
6
6
  "./commercial-parity",
@@ -8,6 +8,7 @@
8
8
  "./campaign-spec",
9
9
  "./legacy-migration",
10
10
  "./schemas/campaign-spec.v4.schema.json",
11
+ "./schemas/campaign-spec.v5.schema.json",
11
12
  "./schemas/campaigns-os-legacy-migration-inventory.v0.schema.json",
12
13
  "./schemas/campaigns-os-legacy-provisioning-plan.v0.schema.json",
13
14
  "./schemas/campaigns-os-legacy-provisioning-receipt.v0.schema.json",
@@ -51,7 +52,7 @@
51
52
  "sha256": "53269453dfdaac4b286124d445b60b0c46205dfbaf8037ac61b30254a32df53a"
52
53
  },
53
54
  "contracts/runtime-recipe.campaigns-os-node-v1.json": {
54
- "sha256": "90aaaaade90cf2525ea1aa05be5cb2d02b57e6e59f9278a946efa8a087946fd3"
55
+ "sha256": "ab0537a4756310d3a35b400d3932e46695a820f1b8b398f52f6fd0906098bc1d"
55
56
  },
56
57
  "schemas/campaign-build-brief.v1.schema.json": {
57
58
  "sha256": "d524003184131398dc15fdb84385af1be0de0c69d6c5ede7278689a5b6101b81"
@@ -63,14 +64,17 @@
63
64
  "sha256": "625a6f2ed6bee726f9cddad750e64a54a7e03744c777f5a70afe4a39afdd9848"
64
65
  },
65
66
  "schemas/campaign-runtime-build-context.v0.schema.json": {
66
- "sha256": "f310c1b7844d9b1994864d15858ff0c6f17efc1e5285ba193d181bdb2dd4be2f"
67
+ "sha256": "1f9bd6cced44a8ba6b29cc650f2b071db67ad710c5a9e9dfe47287eac11e0ebf"
67
68
  },
68
69
  "schemas/campaign-runtime-build-packet.v0.schema.json": {
69
- "sha256": "5002529c5979c4d8fef7e298de82ebdf625ffbd11f5284ba684d96d173788d62"
70
+ "sha256": "f0952f64fe9f5ae6147649e5e99b24f215c8d080fca4e330d73f54e49a00d0e2"
70
71
  },
71
72
  "schemas/campaign-spec.v4.schema.json": {
72
73
  "sha256": "af56c3de638d3c4e1fd5df8c2d733754d9ad16caa23b5bec92ce3a6f71bd0271"
73
74
  },
75
+ "schemas/campaign-spec.v5.schema.json": {
76
+ "sha256": "2923382e94ac51f6a19a3f9dfd0993d8c30fab33cd9be3d6901f314e02f5d960"
77
+ },
74
78
  "schemas/campaigns-os-legacy-migration-inventory.v0.schema.json": {
75
79
  "sha256": "d6edc4572900d15fdaf6b8c59916b0d885303c1d398bdadeb7c58285522c9049"
76
80
  },
@@ -96,7 +100,7 @@
96
100
  "sha256": "d7521fe0ab4deb62485f92286cb890ee548ea290793a6ce7444ecc42ba336d49"
97
101
  },
98
102
  "schemas/campaigns-os-run-record.v0.schema.json": {
99
- "sha256": "00dc9bcec79c12ea22a27f636188bcc33c6811df2d646ac7b49d4cc076e97355"
103
+ "sha256": "390cbc9debacfbfb17d999961baa041a2138fa20a116ec463fbbefbbb05f622d"
100
104
  },
101
105
  "schemas/campaigns-os-runtime-recipe.v1.schema.json": {
102
106
  "sha256": "f8a2ab5eadbb71fb6d5653b670ee71e4471c3df74dd04000d3dbd3d9ae9e71fc"
@@ -22,6 +22,16 @@ It compares source tokens against known `figma-sections-export` scaffold
22
22
  defaults, maps real brand values onto a local versioned next-core target-token
23
23
  contract, and writes evidence into a theme report.
24
24
 
25
+ A rule whose selector subject has a whole sale, discount, badge, rating, star,
26
+ strike, border or announcement name part does not supply primary or CTA unless
27
+ that subject also has a brand, primary, cta, button or btn part, or is a `button`
28
+ element or a submit input. In comma lists,
29
+ the other selectors still count. Primary keeps the header, navigation, brand
30
+ and hero matching used on main, including element selectors and ancestors;
31
+ button backgrounds keep the same CTA matching, including cart, buy, order and
32
+ submit names and IDs. If no CTA token or button background exists, the CTA uses
33
+ the accent fallback and the warning asks the operator to confirm it.
34
+
25
35
  `campaigns-os theme generate` writes:
26
36
 
27
37
  ```text
@@ -19,7 +19,8 @@ The current schema is `schemas/campaign-runtime-build-packet.v0.schema.json`.
19
19
 
20
20
  A saved Map is optional for a prepared-HTML build. The coding agent authors an
21
21
  ordinary CampaignSpec from the brief, source design and configured campaign's
22
- real commerce values, following `schemas/campaign-spec.v4.schema.json`. The
22
+ real commerce values, following `schemas/campaign-spec.v5.schema.json` (a 4.2/4.3
23
+ spec still reads, upgraded on read; see `docs/versioning.md`). The
23
24
  operator supplies the selected store/campaign, public Campaigns API key, intended
24
25
  pages and commercial choices, plus store contact details and policy URLs. Verify
25
26
  the store/campaign binding, and read the package, offer and shipping references
@@ -1020,13 +1021,25 @@ than hand-adding the field. Note that a committed artifact set always reads
1020
1021
  stale to the readback once HEAD moves past it — freshness proof is a
1021
1022
  regeneration at HEAD, not a property a commit can preserve.
1022
1023
 
1023
- Commit durable packet/context/report artifacts when they represent a real build handoff. The rest of `.campaign-runtime/` is machine-local and is not for the campaign repository: `run-session.json`, `command-lifecycle.jsonl`, `agent-deviations.jsonl`, `workflow-findings.jsonl`, `run-records/`, `fetched-specs/`, `polish-evidence/`, `evidence/`, and `*.log`/`*.tmp` are per-machine, append-only, or carry live URLs and absolute paths, and so are the full QA verdicts `qa run` writes under the target's `qa-output/`. `start`, `prepare-build`, `install-agent-context`, and `run start` write a managed ignore block for exactly that set into the target's `.gitignore` once (keyed on its marker line; edit the list beneath it freely). The readback bundle (`build-context.json`, `assembly-report.json`, `doctor-output.json`, `qa-verdict.json`), `input/`, `theme/`, `agent-context/`, and `setup-handoff.json` are deliberately not ignored. The Campaigns API key is a public, browser-side, domain-allowlisted key and may already be present in the local CampaignSpec as `campaign.campaigns_api_key`; do not duplicate it into the packet unless the spec is unavailable. Do not commit raw private API responses, backend secrets, or temporary media exports.
1024
+ Commit durable packet/context/report artifacts when they represent a real build handoff. The rest of `.campaign-runtime/` is machine-local and is not for the campaign repository: `run-session.json`, `command-lifecycle.jsonl`, `agent-deviations.jsonl`, `workflow-findings.jsonl`, `run-records/`, `fetched-specs/`, `progress/`, `polish-evidence/`, `evidence/`, and `*.log`/`*.tmp` are per-machine, append-only, or carry live URLs and absolute paths, and so are the full QA verdicts `qa run` writes under the target's `qa-output/`. `start`, `prepare-build`, `install-agent-context`, and `run start` write a managed ignore block for that set into the target's `.gitignore` (keyed on its marker line; edit the list beneath it freely). An existing block gains `qa-output/` and `.campaign-runtime/progress/` when they are missing, since those hold live URLs, order references and remit records. The readback bundle (`build-context.json`, `assembly-report.json`, `doctor-output.json`, `qa-verdict.json`), `input/`, `theme/`, `agent-context/`, and `setup-handoff.json` are deliberately not ignored. The Campaigns API key is a public, browser-side, domain-allowlisted key and may already be present in the local CampaignSpec as `campaign.campaigns_api_key`; do not duplicate it into the packet unless the spec is unavailable. Do not commit raw private API responses, backend secrets, or temporary media exports.
1024
1025
 
1025
1026
  Packet-mode `doctor` is inspection-only by default and preserves retained evidence and active run journals, even when lifecycle capture is configured. Use `--write` to intentionally record fresh evidence; `--no-write` takes precedence. Inspection still reports current blockers and keeps the same exit status.
1026
1027
 
1027
1028
  `campaigns-os doctor --packet <packet> --write` restates its outcome on the Assembly Report's `stages.doctor` (status, command, outputs, blockers, warnings, `checked_at`). A re-run that reaches the same outcome leaves the report's bytes unchanged rather than refreshing the timestamp alone, so a digest taken of the report — a Run Record's `assembly_report` sha256 — keeps verifying across repeated doctor runs; a changed outcome still rewrites the file.
1028
1029
 
1029
- `campaigns-os start` / `campaigns-os prepare-build` writes packet, context, report, and generated doctor-output paths as relative paths by default, including sibling CampaignSpec/source directories such as `../campaign-source`. `campaigns-os doctor` continues to accept older absolute-path packets; use `campaigns-os doctor --packet <packet> --write --strip-paths` when regenerating a commit-ready doctor output from an older packet. Committed handoff artifacts should not contain machine-local absolute paths unless no relative form is possible.
1030
+ `campaigns-os start` / `campaigns-os prepare-build` writes portable packet, context, report, and generated doctor-output paths. Resolve each path from its reader's base:
1031
+
1032
+ | Field | Base | Writer |
1033
+ |---|---|---|
1034
+ | Build Packet `spec.local_path`, `design_source_package.path`, `source_html.root`, `build_brief.input_path`, `build_brief.normalized_path`, `assembly.target_repo`, `assembly.commerce_catalog.path` | Build Packet file's directory, including when `--out` places it under `config/` | `start` / `prepare-build`; `record brief` and stage records retain this base for older absolute values |
1035
+ | Build Packet `source_html.pages[].path`; Build Context `page_map[].source_path` | Source HTML root | `start` / `prepare-build`; later context writes retain it |
1036
+ | Build Packet and Build Context `source_html.pages[].page_kit.target_path` / `page_map[].page_kit.target_path` | Page Kit output directory | `start` / `prepare-build`; later packet/context writes retain it |
1037
+ | Build Packet `assembly.output_dir` and `source_html.pages[].page_kit.output_path`; Build Context `page_map[].output_path` and `page_map[].page_kit.output_path` | Target repository root | `start` / `prepare-build`; later packet/context writes retain it |
1038
+ | Build Context and Assembly Report `design_source_package.path` | Directory of that context or report file (normally `.campaign-runtime/`) | `start` / `prepare-build`; later report writes retain it |
1039
+ | Normalized Campaign Build Brief `_meta.input_path` | Directory of the normalized brief file | `start` / `prepare-build`; `record brief` and `record spec` retain it |
1040
+ | Other listed Build Context, Assembly Report, and doctor-output filesystem paths | Target repository root | Intake, `doctor --write`, `next`, and stage writes |
1041
+
1042
+ Outside source inputs use ordinary relative paths from the applicable base; keep them at the recorded locations when moving the repository. Manifest paths embedded in decision evidence use relative paths from the target repository root. A stored command such as `next.command` uses a relative packet path and runs from the target repository root. `campaigns-os doctor` continues to accept older absolute-path packets; `--strip-paths` remains available when inspecting an older packet. Machine-local run sessions and journals remain ignored and may use absolute paths.
1030
1043
 
1031
1044
  `start` / `prepare-build` also run the [Brand Theme Bridge](./brand-theme-bridge.md)
1032
1045
  in `inspect_only` mode. The optional theme evidence lives in `context.theme`,
@@ -1253,25 +1266,39 @@ coverage blocks source readiness.
1253
1266
 
1254
1267
  ## Adapter And Proof Fields
1255
1268
 
1256
- Fresh packets now include `source_html.adapter_contract`. Build Context and
1257
- Assembly Report carry the same values as `adapter_decisions`, and build agents
1258
- should update the report as they complete work.
1269
+ Fresh packets include `source_html.adapter_contract`. Build Context and
1270
+ Assembly Report carry the same values as `adapter_decisions`. After building,
1271
+ record the true scalar decisions with `record build --adapter-decision
1272
+ <key>=<value>[,<key>=<value>...]` (one flag, comma-separated `key=value`
1273
+ pairs). For example, set `raw_html_conversion_status=completed` after source
1274
+ HTML conversion, or `not_required` when there is no source HTML to convert.
1275
+ A repeated `--adapter-decision` flag keeps only the last list. The command
1276
+ writes the Assembly Report only. Doctor's adapter gates and leftover-wrapper
1277
+ check read the effective decisions in report → Build Context → packet order;
1278
+ doctor still validates each copy's shape separately. Source preparation reads
1279
+ the packet's `wrapper_policy`, which is selected at intake with
1280
+ `prepare-build --wrapper-policy` or the source-html manifest's `wrapper_policy`
1281
+ option. The record flag refuses that key, an unknown key, or a value outside
1282
+ the allowed values below. The object-valued
1283
+ `template_files_copied` has no flag: its `status`, `required_groups`, `groups`,
1284
+ and `paths` remain required proof in the report and keep their existing doctor
1285
+ checks.
1259
1286
 
1260
1287
  Required adapter decisions:
1261
1288
 
1262
- | Field | Purpose |
1263
- | --- | --- |
1264
- | `raw_html_conversion_status` | Whether prepared HTML has been converted into page-kit-ready source. |
1265
- | `source_asset_strategy` | How images/fonts/CSS/JS are moved and referenced. Prefer `pagekit_campaign_asset_root`. |
1266
- | `commerce_shell_adoption` | Whether checkout/upsell/downsell/receipt use a template-clone-first SDK surface. |
1267
- | `route_rewrite_policy` | How page links, CTAs, and SDK routing values were rewritten from CampaignSpec routes. |
1268
- | `template_files_copied` | Whether the selected template family was copied/verified as one atomic page-kit slice. |
1269
- | `config_script_strategy` | How campaign config scripts are loaded. |
1270
- | `wrapper_policy` | Whether document wrappers are stripped, preserved, or not required. |
1271
- | `frontmatter_policy` | How Page Kit YAML frontmatter is created or preserved. |
1272
- | `script_style_reference_policy` | How scripts/styles move into frontmatter, campaign assets, inline blocks, or passthrough. |
1273
- | `cta_rewrite_policy` | How CTA destinations are rewritten from CampaignSpec routes. |
1274
- | `layout_choice` | Which Page Kit layout strategy wraps the prepared source. |
1289
+ | Field | Purpose | `record build` allowed values |
1290
+ | --- | --- | --- |
1291
+ | `raw_html_conversion_status` | Whether prepared HTML has been converted into page-kit-ready source. | `pending`, `in_progress`, `completed`, `not_required`, `blocked` |
1292
+ | `source_asset_strategy` | How images/fonts/CSS/JS are moved and referenced. | `pagekit_campaign_asset_root`, `external_cdn`, `raw_passthrough`, `not_applicable`, `unknown` |
1293
+ | `commerce_shell_adoption` | Whether checkout/upsell/downsell/receipt use a template-clone-first SDK surface. | `not_required`, `template_clone_first_required`, `template_clone_first_verified`, `sdk_surfaces_preserved`, `custom_html_experimental` |
1294
+ | `route_rewrite_policy` | How page links, CTAs, and SDK routing values were rewritten from CampaignSpec routes. | `campaignspec_routes_via_campaign_link`, `pagekit_public_routes`, `raw_passthrough`, `not_applicable`, `unknown` |
1295
+ | `template_files_copied` | Whether the selected template family was copied/verified as one atomic page-kit slice. | Object-valued proof; no flag |
1296
+ | `config_script_strategy` | How campaign config scripts are loaded. | `campaign_asset`, `frontmatter_script`, `inline`, `not_required`, `unknown` |
1297
+ | `wrapper_policy` | Whether document wrappers are stripped, preserved, or not required. | Intake only: `strip_document_wrappers`, `preserve_document_wrappers`, `not_required`, `unknown` |
1298
+ | `frontmatter_policy` | How Page Kit YAML frontmatter is created or preserved. | `pagekit_yaml_frontmatter`, `raw_passthrough`, `not_required`, `unknown` |
1299
+ | `script_style_reference_policy` | How scripts/styles move into frontmatter, campaign assets, inline blocks, or passthrough. | `frontmatter_or_campaign_asset`, `frontmatter`, `campaign_asset`, `inline`, `raw_passthrough`, `not_required`, `unknown` |
1300
+ | `cta_rewrite_policy` | How CTA destinations are rewritten from CampaignSpec routes. | `campaignspec_routes_via_campaign_link`, `pagekit_public_routes`, `raw_passthrough`, `not_applicable`, `unknown` |
1301
+ | `layout_choice` | Which Page Kit layout strategy wraps the prepared source. | `campaign_layout`, `page_layout`, `raw_passthrough`, `not_applicable`, `unknown` |
1275
1302
 
1276
1303
  Fresh build context also includes `source.asset_crawl`
1277
1304
  (`source-asset-crawl/v0`). `prepare-build` scans the source HTML files and
@@ -1449,10 +1476,29 @@ Fresh `prepare-build` output also writes `source_html.pages[].page_kit` for mapp
1449
1476
  - `target_path` is the page file relative to `assembly.output_dir` (`checkout.html`, `receipt.html`, etc.).
1450
1477
  - `output_path` is the same target file relative to `assembly.target_repo`.
1451
1478
  - `public_route` is the rendered campaign-rooted route Page Kit should produce.
1452
- - `page_type` is the CPK runtime/analytics vocabulary (`product`, `checkout`, `upsell`, `receipt`), not the richer CampaignSpec or producer page type. CampaignSpec `select` pages project as CPK `checkout` because they are pre-checkout runtime selection surfaces.
1453
- - `frontmatter` names the Page Kit frontmatter fields the build should write or preserve.
1479
+ - `page_type` is the CPK runtime/analytics vocabulary (`product`, `checkout`, `upsell`, `receipt`), not the richer CampaignSpec or producer page type. CampaignSpec `select` and `checkout_step` pages project as CPK `checkout` because they render the SDK checkout surface ahead of the page that takes payment.
1480
+ - `frontmatter` names the Page Kit frontmatter fields the build should write or preserve. Beside `page_type`, `permalink`, `next_url` and `decline_url`, two keys wire multi-step checkout paths: `success_url`, on every page that leads into a Checkout (a `select` page, a `checkout_step`, or a landing page whose forward links reach one), is that Checkout's post-payment destination and feeds the page's `next-success-url` meta tag, which the SDK reads for express orders; `step_number`, on a `checkout_step` only, is its position on its path from 1, for the step form's `data-next-step-number`. The step form's `data-next-checkout-step` is the page's `next_url`.
1454
1481
  - `permalink_required` is true when Page Kit's filename-derived route would not match `public_route`.
1455
1482
 
1483
+ An entry page (`is_entry: true`) declares the campaign root when `page_url` is
1484
+ empty, `/`, `/<slug>/`, or `<slug>`.
1485
+ If Page Kit emits its mapped target file, or a materialised template-stock
1486
+ family page, at that file's route without a root output, doctor recognizes the
1487
+ built page and warns that the root is unserved. The warning names both routes:
1488
+ add a redirect from the root to the emitted route or set
1489
+ `permalink: /<slug>/` on the entry page, the campaign root as Page Kit emits it.
1490
+ It uses `campaign.route_root`: a root-served campaign names `/` and
1491
+ `/<file-route>/`; a slug-served campaign names `/<slug>/` and
1492
+ `/<slug>/<file-route>/`. The built files stay under `_site/<slug>/` in both cases.
1493
+ `qa resolve --packet campaign-runtime.build.json --base-url <preview-url>` then
1494
+ prints the locally emitted entry route. An explicit permalink on that entry's
1495
+ Page Kit source file takes precedence, even if stale output remains at the
1496
+ file route. Doctor still warns if that permalink serves a non-root route and
1497
+ the root output is absent. With no permalink, a root `index.html` takes
1498
+ precedence over the recorded file route; with a non-root permalink, a present
1499
+ root output suppresses the warning while QA keeps the permalink Entry URL.
1500
+ Another page's `index.html` cannot stand in for the entry.
1501
+
1456
1502
  The Design Source Package should reference this projection without confusing it
1457
1503
  with Surface Identity. Surface Identity is the campaign-facing join key; Page Kit
1458
1504
  `page_type`, public routes, output paths, CampaignSpec/Map Builder page IDs,
@@ -1737,7 +1783,7 @@ hand-editing `.campaign-runtime/` JSON:
1737
1783
  | Command | Writes | Refused (nothing written) when |
1738
1784
  |---|---|---|
1739
1785
  | `campaigns-os record setup --packet <p>` | Build Context `scaffold.required=false` (`handoff_skill` next-campaigns-build) and `stages.setup` completed | the campaign output directory (`assembly.output_dir`) does not exist, or there is no Build Context or Assembly Report |
1740
- | `campaigns-os record build --packet <p> [--build-environment <development\|production>]` | `stages.assembly` completed with `build_fingerprint` = doctor's `derived.build_output_fingerprint.value`, `source_package_material_fingerprint` = the report's Design Source Package material fingerprint when present, `evidence.build_environment` = the `--build-environment` value when given (kept from the last record otherwise), and `stages.polish` reset to `required` (`required_by` build, `required_for` qa) unless its evidence is bound to this exact output; a completed `stages.deploy` whose `source_build_fingerprint` names other output is reset to `required` the same way, without the old probe's `outputs` and `evidence`, and its prior record is kept in `stages.deploy.history` (a deploy with no `source_build_fingerprint`, recorded before deploy stamped it, is kept) | doctor cannot compute the fingerprint (no `_site/<public_route_slug>/`), setup is still required, or `stages.setup` is not terminal |
1786
+ | `campaigns-os record build --packet <p> [--build-environment <development\|production>] [--adapter-decision <key>=<value>[,<key>=<value>...]]` | `stages.assembly` completed with `build_fingerprint` = doctor's `derived.build_output_fingerprint.value`, `source_package_material_fingerprint` = the report's Design Source Package material fingerprint when present, `evidence.build_environment` = the `--build-environment` value when given (kept from the last record otherwise), and the specified scalar `report.adapter_decisions`; all recordable decisions go in one comma-separated flag (a repeated flag keeps only the last list); `wrapper_policy` stays an intake choice. `stages.polish` resets to `required` (`required_by` build, `required_for` qa) unless its evidence is bound to this exact output; a completed `stages.deploy` whose `source_build_fingerprint` names other output resets to `required` the same way, without the old probe's `outputs` and `evidence`, and its prior record is kept in `stages.deploy.history` (a deploy with no `source_build_fingerprint`, recorded before deploy stamped it, is kept) | doctor cannot compute the fingerprint (no `_site/<public_route_slug>/`), setup is still required, `stages.setup` is not terminal, or an adapter decision key/value is invalid |
1741
1787
  | `campaigns-os record polish --packet <p> --evidence <file>` | `stages.polish` from the file (`docs/polish-evidence.md` §7: completed, blocked or skipped), bound to doctor's current fingerprint; `report.theme.repair_loop_defect` when the file sets it | build is not recorded for the current output, the file has a shape error (named by field), or, for a completed status, the polish gate doctor evaluates would not pass on the result |
1742
1788
  | `campaigns-os record theme --packet <p>` | `report.theme`: status `applied`, `load_order` `after-next-core`, `css_path`, `commerce_pages` and per-page evidence read from each built commerce page's stylesheet links; any earlier theme waiver is cleared | build is not recorded for the current output, the campaign ships no commerce pages, a built commerce page that loads `next-core.css` does not load `brand-theme.css` (or `checkout-brand.css`) after it or links one missing from the built output, or no built commerce page loads `next-core.css` |
1743
1789
  | `campaigns-os record deploy --packet <p> --base-url <url>` | the packet's `deploy.preview_url` and `stages.deploy` completed with the URL in `outputs`, one evidence line per built page that answered (each page is requested under the URL first), and `source_build_fingerprint` = the recorded `stages.assembly.build_fingerprint` it probed, so a later `record build` of different output makes deploy owed again and `next` routes back to `record deploy` before QA; a byte-identical rebuild keeps it current | the packet is not `local-serve`, the URL is not a loopback origin naming the campaign's route root, a built page does not answer 2xx, polish is not recorded, the built output changed since build was recorded, or the theme gate is blocked |
@@ -1747,7 +1793,19 @@ prepare-build gate is set (`next` answers prepare-build) or while an earlier
1747
1793
  stage in the order below is not terminal. The exception is the one `next`
1748
1794
  makes: on the local preview, a polish doctor carries forward (never recorded
1749
1795
  for this build) does not hold `record deploy` back, as it does not hold `next`;
1750
- polish stays owed and QA reports it.
1796
+ polish stays owed and QA reports it. If every mapped page is template stock on
1797
+ a hosted preview, doctor carries the same missing-evidence shape forward.
1798
+ `record deploy` remains local-only: record an unset hosted preview URL with
1799
+ `campaigns-os qa policy set --packet <p> --preview-url <url>`, then run
1800
+ `campaigns-os next --packet <p>`. The hosted preview must be a non-loopback
1801
+ HTTP(S) URL whose origin or QA-resolved campaign route path differs from `deploy.production_url`;
1802
+ query and fragment text does not make the production page a preview. With
1803
+ `deploy.preview_url` recorded, run `campaigns-os next qa --packet <p>` and
1804
+ `campaigns-os qa run --packet <p> --base-url <preview-url> --browser
1805
+ --test-order common`. The recorded hosted preview satisfies the deploy step
1806
+ for this all-template shape. After QA records a verdict for the current build,
1807
+ `campaigns-os next --packet <p>` reaches closeout without a hosted deploy
1808
+ record. QA against the packet's production URL retains the strict gate.
1751
1809
 
1752
1810
  Each command reads the same packet, Build Context and Assembly Report `next`
1753
1811
  reads (`--context` / `--report` override them the same way), validates what it
@@ -1773,9 +1831,11 @@ check exits non-zero with the problems listed, one per line; a value outside a
1773
1831
  schema enum (for example an `adapter_decisions` policy) is listed with the
1774
1832
  values the schema allows and the value it got. Re-run `record
1775
1833
  build` after every page-kit build; a rebuild that changes the output needs
1776
- `polish capture` and `record polish` again.
1834
+ `polish capture` and `record polish` again. After deploy is recorded for the
1835
+ rebuilt output, `next` asks for QA again if the last QA record names the
1836
+ previous build fingerprint, even while its stage status still says completed.
1777
1837
 
1778
- Stage order: `setup → build → polish → deploy → qa`. The picker walks this list and returns the first stage whose recorded status isn't terminal (`completed`, `completed_with_warnings`, `skipped`). During Polish, install the package-owned browser first, then run `campaigns-os polish capture` against the served current build before recording a terminal `stages.polish.status` or proceeding to deploy/QA; the producer attaches package-owned `visual_review.page_load` evidence and never marks the stage complete itself.
1838
+ Stage order: `setup → build → polish → deploy → qa`. The picker walks this list and returns the first stage whose recorded status isn't terminal (`completed`, `completed_with_warnings`, `skipped`), except that a carried-forward all-template hosted preview with a recorded `deploy.preview_url` satisfies deploy without a report record. During Polish, when a design route exists, install the package-owned browser first, then run `campaigns-os polish capture` against the served current build before recording a terminal `stages.polish.status` or proceeding to deploy/QA; the producer attaches package-owned `visual_review.page_load` evidence and never marks the stage complete itself. Template-stock campaigns with no design route have no capture to run and follow the preview policy above.
1779
1839
 
1780
1840
  | Stage | Report key | Owner |
1781
1841
  |---|---|---|
@@ -1808,7 +1868,7 @@ Result shape (with `--json`):
1808
1868
  Terminal states:
1809
1869
 
1810
1870
  - **`stage: "doctor-blocked"`** — doctor returned errors. Resolve the blockers and re-run `campaigns-os doctor` to confirm before calling `next` again.
1811
- - **`stage: "done"`** — every stage is in a terminal status. Pipeline is complete. To re-run a specific stage, set its status back to `"pending"` in the assembly report and call `next` again.
1871
+ - **`stage: "done"`** — every stage is terminal, or a carried-forward all-template hosted preview satisfies deploy with a recorded `deploy.preview_url` and current-build QA verdict. Pipeline is complete. To repeat build work, do the work and use `record build`; it makes downstream stages owed as needed. Use `record setup` or `record polish` after repeating those stages, and `qa run` for QA. `record deploy` records a local-serve target; other hosted deploys record the URL and stage outcome as the deploy prompt describes. Then call `next` again.
1812
1872
  - **`stage_blocked: true`** — the picker returned a stage whose recorded status is `blocked`. Don't run the prompt as-is; clear the blocker first.
1813
1873
 
1814
1874
  The legacy form `campaigns-os next <stage>` (e.g. `next build`) still works and is the way to force a specific stage when you want to override the picker.
@@ -12,7 +12,7 @@ The happy path is intentionally tight:
12
12
  8. Run polish, serve the current built output, and run `campaigns-os polish capture --packet <packet> --base-url <served-current-build-url>`. Do not mark Polish terminal or begin deploy/QA until this package-owned page-load evidence passes or has an exact finding waiver.
13
13
  9. Deploy a preview.
14
14
  10. Run `campaigns-os qa resolve --packet <packet>`, then `campaigns-os qa run --packet <packet> --browser --test-order common` with the tested URL. Saved-Map QA uses the existing consent and publication controls; pass `--no-post-verdict` to keep its verdict local. Local-spec QA always keeps verdicts and progress local, even with `--post-verdict`, and `qa publish` refuses local-spec packets. Run Telemetry retains its consent controls.
15
- 11. Treat test-order depth as the control: global test cards bypass the gateway and create no transactions, so no approval is needed. Localhost on any port is a Campaigns App Development domain (SDK allowed, analytics suppressed); non-localhost preview/production origins must still be allowlisted for the campaign API key so the SDK loads.
15
+ 11. Global test cards bypass the gateway and create no transactions, but each test order leaves a real store order record. Unless the operator has already said test orders are fine for this campaign, ask once, up front, before placing test orders; then proceed. There is no permission flag; test-order depth controls coverage. Localhost on any port is a Campaigns App Development domain (SDK allowed, analytics suppressed); non-localhost preview/production origins must still be allowlisted for the campaign API key so the SDK loads.
16
16
  12. Promote, block, or iterate from the recorded build, polish, deploy, QA, and test-order evidence.
17
17
 
18
18
  Pause only for missing inputs, doctor blockers, blocked deploys, out-of-scope runtime pages that block checkout proof, or merchant-specific uncertainty. The default path should not branch into external browser skills or hand-built backend order creation.
package/docs/effects.md CHANGED
@@ -209,9 +209,7 @@ template family is certified, and whether a named brief can be read, depend on
209
209
  file content: those checks still run in the handler and are journaled.
210
210
  The operator-facing `run-record` and `run end` commands refuse bare, empty, or
211
211
  whitespace-only values for every value-taking inherited run-record flag before
212
- packet work. The five agent
213
- token and elapsed-time flags retain their non-negative-integer diagnostics;
214
- `--surfaces` rejects unknown values, and `--dry-run` rejects a value. The
212
+ packet work. `--surfaces` rejects unknown values, and `--dry-run` rejects a value. The
215
213
  inherited boolean flags (`--no-remit`, `--no-write`, `--dry-run`, and `--json`)
216
214
  retain their bare-flag behavior. `run end` also rejects `--new-run` and
217
215
  `--run-id` because the saved session fixes its run ID. `run-record` also
@@ -225,8 +223,7 @@ literal relative path, so the default context file is not read. Bare or empty
225
223
  `--context` or `--report` still makes QA auto-end fail and leaves the session
226
224
  open; bare or empty `--qa-verdict` fails a Run Record closeout when inherited,
227
225
  though QA auto-end supplies its own verdict path. The underlying run-record
228
- handler still rejects invalid agent
229
- integers, unknown `--surfaces`, and any valued `--dry-run` that reaches it. QA
226
+ handler still rejects unknown `--surfaces` and any valued `--dry-run` that reaches it. QA
230
227
  auto-end drops `--dry-run` from inherited flags; if another inherited value
231
228
  fails in the handler, auto-end is skipped and the session stays open. QA's own
232
229
  journal entry is unaffected because auto-end runs after QA persistence. A named
@@ -3,7 +3,7 @@
3
3
  For a new campaign, create an empty working folder and run this from it:
4
4
 
5
5
  ```sh
6
- npm init -y && npm install --save-exact next-campaign-page-kit@0.2.0 && npm install --save-dev --save-exact @nextcommerce/campaigns-os@1.54.0 && npx --no-install campaigns-os tooling setup --target . --platform claude
6
+ npm init -y && npm install --save-exact next-campaign-page-kit@0.2.0 && npm install --save-dev --save-exact @nextcommerce/campaigns-os@1.57.0 && npx --no-install campaigns-os tooling setup --target . --platform claude
7
7
  ```
8
8
 
9
9
  `npm init -y` gives the folder its own `package.json`. Without one, npm
@@ -26,7 +26,7 @@ Ledger schema id: `campaigns-os-release-ledger/v1`
26
26
  Change policy version: `1.0.0`
27
27
  Reason-code vocabulary version: `1.0.0`
28
28
  Limits version: `1.0.0`
29
- Supported surface at generation time: `1.54.0`
29
+ Supported surface at generation time: `1.57.0`
30
30
 
31
31
  ## Forward compatibility
32
32