@wix/agent-skills 1.33.1 → 1.34.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 (616) hide show
  1. package/README.md +2 -0
  2. package/package.json +1 -1
  3. package/skills/wix-export/SKILL.md +83 -0
  4. package/skills/wix-harmony-editor/.publish-manifest.json +8 -0
  5. package/skills/wix-harmony-editor/COPY-SITE.md +494 -0
  6. package/skills/wix-harmony-editor/SKILL.md +317 -0
  7. package/skills/wix-harmony-editor/scripts/copy/build-description.mjs +249 -0
  8. package/skills/wix-harmony-editor/scripts/copy/check-description.mjs +225 -0
  9. package/skills/wix-harmony-editor/scripts/copy/check-mirror.mjs +89 -0
  10. package/skills/wix-harmony-editor/scripts/copy/compare-preview.mjs +76 -0
  11. package/skills/wix-harmony-editor/scripts/copy/deploy-description.mjs +212 -0
  12. package/skills/wix-harmony-editor/scripts/copy/desc-hash.mjs +44 -0
  13. package/skills/wix-harmony-editor/scripts/copy/editor-run.mjs +45 -0
  14. package/skills/wix-harmony-editor/scripts/copy/export-page.mjs +53 -0
  15. package/skills/wix-harmony-editor/scripts/copy/find-interactions.mjs +76 -0
  16. package/skills/wix-harmony-editor/scripts/copy/hide-scrollbars.mjs +16 -0
  17. package/skills/wix-harmony-editor/scripts/copy/import-media.mjs +150 -0
  18. package/skills/wix-harmony-editor/scripts/copy/link-url.mjs +27 -0
  19. package/skills/wix-harmony-editor/scripts/copy/lint-api.mjs +56 -0
  20. package/skills/wix-harmony-editor/scripts/copy/measure-source.mjs +211 -0
  21. package/skills/wix-harmony-editor/scripts/copy/merge-mirrors.mjs +29 -0
  22. package/skills/wix-harmony-editor/scripts/copy/mirror-site.mjs +92 -0
  23. package/skills/wix-harmony-editor/scripts/copy/mobile-stage.mjs +56 -0
  24. package/skills/wix-harmony-editor/scripts/copy/preview-widths.mjs +73 -0
  25. package/skills/wix-harmony-editor/scripts/copy/render-plate.mjs +67 -0
  26. package/skills/wix-harmony-editor/scripts/copy/serve-mirror.mjs +102 -0
  27. package/skills/wix-harmony-editor/scripts/copy/snapshot-capabilities.mjs +40 -0
  28. package/skills/wix-harmony-editor/scripts/copy/split-sections.mjs +191 -0
  29. package/skills/wix-harmony-editor/scripts/copy/upload-media-manager.mjs +61 -0
  30. package/skills/wix-harmony-editor/scripts/launch.sh +359 -0
  31. package/skills/wix-headless/SKILL.md +7 -2
  32. package/skills/wix-headless/references/CAPABILITIES.md +6 -1
  33. package/skills/wix-headless/references/DISCOVERY.md +2 -1
  34. package/skills/wix-headless/references/SDK_HANDOFF.md +6 -1
  35. package/skills/wix-headless/references/SEED.md +3 -2
  36. package/skills/wix-headless/references/SETUP.md +1 -0
  37. package/skills/wix-headless/references/inline-recipes/experience-donations.md +102 -0
  38. package/skills/wix-headless/references/inline-recipes/how-to-code-donations.md +146 -0
  39. package/skills/wix-headless/references/inline-recipes/setup-donations.md +15 -0
  40. package/skills/wix-headless/references/managed/CREATE.md +1 -1
  41. package/skills/wix-headless-kit/SKILL.md +110 -21
  42. package/skills/wix-headless-kit/guides/api-run.md +15 -13
  43. package/skills/wix-headless-kit/guides/existing-site.md +31 -0
  44. package/skills/wix-headless-kit/guides/migration.md +49 -17
  45. package/skills/wix-headless-kit/install/agents-md.mjs +1 -1
  46. package/skills/wix-headless-kit/install/context.mjs +61 -6
  47. package/skills/wix-headless-kit/install/pins.json +1 -1
  48. package/skills/wix-headless-kit/install/setup.mjs +107 -12
  49. package/skills/wix-headless-replatform/.publish-manifest.json +8 -0
  50. package/skills/wix-headless-replatform/SKILL.md +116 -0
  51. package/skills/wix-headless-replatform/agents/openai.yaml +6 -0
  52. package/skills/wix-headless-replatform/references/control-and-visual-fidelity-contract.md +43 -0
  53. package/skills/wix-headless-replatform/references/extraction-schema.md +187 -0
  54. package/skills/wix-headless-replatform/references/interaction-runtime-contract.md +137 -0
  55. package/skills/wix-headless-replatform/references/layout-blueprint-contract.md +41 -0
  56. package/skills/wix-headless-replatform/references/output-contract.md +93 -0
  57. package/skills/wix-headless-replatform/references/post-build-gap-contract.md +125 -0
  58. package/skills/wix-headless-replatform/references/qa-checklist.md +83 -0
  59. package/skills/wix-headless-replatform/references/safety.md +19 -0
  60. package/skills/wix-headless-replatform/references/ui-normalization-contract.md +70 -0
  61. package/skills/wix-headless-replatform/references/workflow.md +157 -0
  62. package/skills/wix-headless-replatform/registry/README.md +20 -0
  63. package/skills/wix-headless-replatform/registry/approvals/button/shadcn-default-ac60ef5.json +28 -0
  64. package/skills/wix-headless-replatform/registry/items/button/shadcn-default-ac60ef5/button.tsx +54 -0
  65. package/skills/wix-headless-replatform/registry/items/button/shadcn-default-ac60ef5/capabilities.json +60 -0
  66. package/skills/wix-headless-replatform/registry/items/button/shadcn-default-ac60ef5/contract.md +48 -0
  67. package/skills/wix-headless-replatform/registry/licenses/shadcn-ui-ac60ef5-MIT.txt +21 -0
  68. package/skills/wix-headless-replatform/registry/registry.json +36 -0
  69. package/skills/wix-headless-replatform/resources/rp-facelift/SKILL.md +32 -0
  70. package/skills/wix-headless-replatform/resources/rp-project-context/SKILL.md +62 -0
  71. package/skills/wix-headless-replatform/resources/rp-qa-gap-loop/SKILL.md +64 -0
  72. package/skills/wix-headless-replatform/resources/rp-source-evidence/SKILL.md +42 -0
  73. package/skills/wix-headless-replatform/resources/rp-ui-implementation/SKILL.md +73 -0
  74. package/skills/wix-headless-replatform/schemas/build-plan.schema.json +10 -0
  75. package/skills/wix-headless-replatform/schemas/candidate.schema.json +19 -0
  76. package/skills/wix-headless-replatform/schemas/common.schema.json +33 -0
  77. package/skills/wix-headless-replatform/schemas/decision-patch.schema.json +10 -0
  78. package/skills/wix-headless-replatform/schemas/decision-request.schema.json +10 -0
  79. package/skills/wix-headless-replatform/schemas/extraction-gap.schema.json +28 -0
  80. package/skills/wix-headless-replatform/schemas/extraction-manifest.schema.json +34 -0
  81. package/skills/wix-headless-replatform/schemas/final-report.schema.json +10 -0
  82. package/skills/wix-headless-replatform/schemas/foundation.schema.json +11 -0
  83. package/skills/wix-headless-replatform/schemas/metadata.schema.json +11 -0
  84. package/skills/wix-headless-replatform/schemas/observation-packet.schema.json +17 -0
  85. package/skills/wix-headless-replatform/schemas/page-capture.schema.json +11 -0
  86. package/skills/wix-headless-replatform/schemas/page-resolution.schema.json +33 -0
  87. package/skills/wix-headless-replatform/schemas/shared-chrome.schema.json +11 -0
  88. package/skills/wix-headless-replatform/schemas/unit.schema.json +40 -0
  89. package/skills/wix-headless-replatform/scripts/assemble-extraction.mjs +844 -0
  90. package/skills/wix-headless-replatform/scripts/benchmark-extraction.mjs +163 -0
  91. package/skills/wix-headless-replatform/scripts/browser-extraction-preflight.mjs +42 -0
  92. package/skills/wix-headless-replatform/scripts/build-extracted-homepage.mjs +228 -0
  93. package/skills/wix-headless-replatform/scripts/clear-wix-starter.mjs +87 -0
  94. package/skills/wix-headless-replatform/scripts/create-wix-project.mjs +505 -0
  95. package/skills/wix-headless-replatform/scripts/discover-urls.mjs +142 -0
  96. package/skills/wix-headless-replatform/scripts/extract-assets.mjs +140 -0
  97. package/skills/wix-headless-replatform/scripts/extract-design-system.mjs +637 -0
  98. package/skills/wix-headless-replatform/scripts/extract-interactions.mjs +1903 -0
  99. package/skills/wix-headless-replatform/scripts/extract-page.mjs +2461 -0
  100. package/skills/wix-headless-replatform/scripts/extract-seo.mjs +25 -0
  101. package/skills/wix-headless-replatform/scripts/extract-tokens.mjs +63 -0
  102. package/skills/wix-headless-replatform/scripts/finalize-extraction-report.mjs +126 -0
  103. package/skills/wix-headless-replatform/scripts/finalize-gap-review.mjs +180 -0
  104. package/skills/wix-headless-replatform/scripts/finalize-gap-review.test.mjs +98 -0
  105. package/skills/wix-headless-replatform/scripts/finalize-migration-website.mjs +103 -0
  106. package/skills/wix-headless-replatform/scripts/generate-control-state-contract.mjs +176 -0
  107. package/skills/wix-headless-replatform/scripts/generate-design-md.mjs +261 -0
  108. package/skills/wix-headless-replatform/scripts/generate-extraction-validators.mjs +25 -0
  109. package/skills/wix-headless-replatform/scripts/generate-invoice-download-backend.mjs +342 -0
  110. package/skills/wix-headless-replatform/scripts/generate-layout-blueprint.mjs +140 -0
  111. package/skills/wix-headless-replatform/scripts/generate-repeater-cms.mjs +22 -0
  112. package/skills/wix-headless-replatform/scripts/generate-route-plan.mjs +143 -0
  113. package/skills/wix-headless-replatform/scripts/generate-scene-contract.mjs +288 -0
  114. package/skills/wix-headless-replatform/scripts/generate-ui-normalization.mjs +266 -0
  115. package/skills/wix-headless-replatform/scripts/generate-visual-assets.mjs +111 -0
  116. package/skills/wix-headless-replatform/scripts/lib/browser-tooling.mjs +570 -0
  117. package/skills/wix-headless-replatform/scripts/lib/common.mjs +329 -0
  118. package/skills/wix-headless-replatform/scripts/lib/component-capabilities.mjs +121 -0
  119. package/skills/wix-headless-replatform/scripts/lib/component-registry.mjs +282 -0
  120. package/skills/wix-headless-replatform/scripts/lib/content-boundary.mjs +61 -0
  121. package/skills/wix-headless-replatform/scripts/lib/extraction-contract.mjs +374 -0
  122. package/skills/wix-headless-replatform/scripts/lib/extraction-detectors.mjs +243 -0
  123. package/skills/wix-headless-replatform/scripts/lib/extraction-validators.generated.mjs +1139 -0
  124. package/skills/wix-headless-replatform/scripts/lib/font-contract.mjs +326 -0
  125. package/skills/wix-headless-replatform/scripts/lib/frontend-automation-state.mjs +184 -0
  126. package/skills/wix-headless-replatform/scripts/lib/gap-analysis.mjs +396 -0
  127. package/skills/wix-headless-replatform/scripts/lib/html-extract.mjs +168 -0
  128. package/skills/wix-headless-replatform/scripts/lib/interaction-bootstrap.mjs +10 -0
  129. package/skills/wix-headless-replatform/scripts/lib/interaction-runtime.mjs +194 -0
  130. package/skills/wix-headless-replatform/scripts/lib/interaction-timeline.mjs +348 -0
  131. package/skills/wix-headless-replatform/scripts/lib/layout-blueprint/classifiers.mjs +141 -0
  132. package/skills/wix-headless-replatform/scripts/lib/layout-blueprint/geometry.mjs +43 -0
  133. package/skills/wix-headless-replatform/scripts/lib/layout-blueprint/vocabulary.mjs +18 -0
  134. package/skills/wix-headless-replatform/scripts/lib/ui-normalization.css +64 -0
  135. package/skills/wix-headless-replatform/scripts/optimize-svg.mjs +31 -0
  136. package/skills/wix-headless-replatform/scripts/post-build-gap.mjs +358 -0
  137. package/skills/wix-headless-replatform/scripts/provision-repeater-cms.mjs +25 -0
  138. package/skills/wix-headless-replatform/scripts/record-gap-decision.mjs +39 -0
  139. package/skills/wix-headless-replatform/scripts/replay-extraction.mjs +107 -0
  140. package/skills/wix-headless-replatform/scripts/resolve-home-page.mjs +96 -0
  141. package/skills/wix-headless-replatform/scripts/site-clone.mjs +658 -0
  142. package/skills/wix-headless-replatform/scripts/validate-font-contract.mjs +29 -0
  143. package/skills/wix-headless-replatform/scripts/verify-interactions.mjs +669 -0
  144. package/skills/wix-headless-replatform/scripts/visual-qa.mjs +370 -0
  145. package/skills/wix-headless-templates/donations/INSTRUCTIONS.md +37 -24
  146. package/skills/wix-headless-templates/donations/app/components/donations/DonateForm.tsx +49 -23
  147. package/skills/wix-headless-templates/donations/app/components/donations/DonationReceipt.tsx +6 -5
  148. package/skills/wix-headless-templates/donations/app/components/donations/GoalProgress.tsx +5 -5
  149. package/skills/wix-headless-templates/donations/app/wix/donations/campaigns.ts +4 -4
  150. package/skills/wix-headless-templates/donations/app/wix/donations/donate.ts +7 -3
  151. package/skills/wix-headless-templates/donations/app/wix/donations/donation-store.ts +2 -2
  152. package/skills/wix-headless-templates/donations/app/wix/donations/donations-core.ts +12 -9
  153. package/skills/wix-headless-templates/donations/project/src/components/donations/DonateForm.tsx +49 -23
  154. package/skills/wix-headless-templates/donations/project/src/components/donations/DonationReceipt.tsx +6 -5
  155. package/skills/wix-headless-templates/donations/project/src/components/donations/GoalProgress.tsx +5 -5
  156. package/skills/wix-headless-templates/donations/project/src/wix/donations/campaigns.ts +4 -4
  157. package/skills/wix-headless-templates/donations/project/src/wix/donations/donate.ts +7 -3
  158. package/skills/wix-headless-templates/donations/project/src/wix/donations/donation-store.ts +2 -2
  159. package/skills/wix-headless-templates/donations/project/src/wix/donations/donations-core.ts +12 -9
  160. package/skills/wix-headless-templates/donations/rest/campaigns.ts +4 -4
  161. package/skills/wix-headless-templates/donations/rest/donate.ts +7 -3
  162. package/skills/wix-headless-templates/donations/seed/SEED.md +12 -7
  163. package/skills/wix-headless-templates/donations/tests/donation-contract.test.mjs +71 -0
  164. package/skills/wix-headless-templates/donations/tests/donation-form.test.cjs +137 -0
  165. package/skills/wix-headless-templates/restaurants/INSTRUCTIONS.md +28 -14
  166. package/skills/wix-headless-templates/restaurants/app/components/restaurants/OrderCartDrawer.tsx +87 -5
  167. package/skills/wix-headless-templates/restaurants/app/hooks/restaurants/useOrderCart.ts +9 -1
  168. package/skills/wix-headless-templates/restaurants/app/wix/restaurants/order-store.ts +33 -4
  169. package/skills/wix-headless-templates/restaurants/app/wix/restaurants/ordering-core.ts +100 -5
  170. package/skills/wix-headless-templates/restaurants/app/wix/restaurants/ordering.ts +101 -15
  171. package/skills/wix-headless-templates/restaurants/app/wix/restaurants/types.ts +35 -1
  172. package/skills/wix-headless-templates/restaurants/project/src/components/restaurants/OrderCartDrawer.tsx +87 -5
  173. package/skills/wix-headless-templates/restaurants/project/src/hooks/restaurants/useOrderCart.ts +9 -1
  174. package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/order-store.ts +33 -4
  175. package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/ordering-core.ts +100 -5
  176. package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/ordering.ts +101 -15
  177. package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/types.ts +35 -1
  178. package/skills/wix-headless-templates/restaurants/rest/ordering.ts +91 -14
  179. package/skills/wix-import/SKILL.md +90 -0
  180. package/skills/wix-manage/SKILL.md +13 -3
  181. package/skills/wix-manage/references/dashboard-navigation/dashboard-navigation.md +2 -1
  182. package/skills/wix-manage/references/dashboard-navigation/routes.json +249 -0
  183. package/skills/wix-manage/references/donations/create-and-update-donation-campaigns.md +139 -0
  184. package/skills/wix-manage/references/events/events-dashboard-navigation.md +81 -0
  185. package/skills/wix-manage/references/sites/manage-oauth-apps.md +1 -0
  186. package/skills/wix-manage/references/sites/upload-static-site.md +127 -8
  187. package/skills/wix-replatform/.publish-manifest.json +5 -5
  188. package/skills/wix-replatform/CLI.md +162 -0
  189. package/skills/wix-replatform/README.md +52 -0
  190. package/skills/wix-replatform/SKILL.md +229 -684
  191. package/skills/wix-replatform/console/account.css +1 -0
  192. package/skills/wix-replatform/console/app.css +1 -0
  193. package/skills/wix-replatform/console/app.js +117 -0
  194. package/skills/wix-replatform/console/index.html +4 -0
  195. package/skills/wix-replatform/console/json.css +11 -0
  196. package/skills/wix-replatform/lib/agent-adapters/index.js +71 -0
  197. package/skills/wix-replatform/lib/app-page-routing.js +75 -0
  198. package/skills/wix-replatform/lib/artifact-freshness.js +11 -1
  199. package/skills/wix-replatform/lib/blocked-data-requests.js +427 -0
  200. package/skills/wix-replatform/lib/census-reconciliation.js +426 -0
  201. package/skills/wix-replatform/lib/completion-report.js +1393 -13
  202. package/skills/wix-replatform/lib/config-env.js +85 -11
  203. package/skills/wix-replatform/lib/confirmed-pictures.js +212 -0
  204. package/skills/wix-replatform/lib/dependency-readiness.js +423 -0
  205. package/skills/wix-replatform/lib/dependency-recovery.js +21 -0
  206. package/skills/wix-replatform/lib/destination-choice.js +163 -0
  207. package/skills/wix-replatform/lib/destination-handoff.js +62 -0
  208. package/skills/wix-replatform/lib/destination-http.js +81 -0
  209. package/skills/wix-replatform/lib/destination-route.js +98 -0
  210. package/skills/wix-replatform/lib/destination.js +919 -0
  211. package/skills/wix-replatform/lib/discovered-census.js +231 -0
  212. package/skills/wix-replatform/lib/discovered-set-status.js +255 -0
  213. package/skills/wix-replatform/lib/document-url-guard.js +203 -0
  214. package/skills/wix-replatform/lib/entity-qa-attestation.js +339 -0
  215. package/skills/wix-replatform/lib/entity-verification.js +18 -0
  216. package/skills/wix-replatform/lib/execution-capability.js +120 -0
  217. package/skills/wix-replatform/lib/execution-log.js +170 -0
  218. package/skills/wix-replatform/lib/execution-manifest.js +20 -2
  219. package/skills/wix-replatform/lib/execution-state.js +22 -0
  220. package/skills/wix-replatform/lib/expectations-ledger.js +96 -0
  221. package/skills/wix-replatform/lib/generated-plugin-handoff.js +140 -0
  222. package/skills/wix-replatform/lib/import-readiness-contract.js +23 -0
  223. package/skills/wix-replatform/lib/import-recovery.js +800 -6
  224. package/skills/wix-replatform/lib/imported-redirect-targets.js +608 -0
  225. package/skills/wix-replatform/lib/internal-link-reconciliation.js +166 -0
  226. package/skills/wix-replatform/lib/link-audit.js +173 -0
  227. package/skills/wix-replatform/lib/link-census.js +194 -0
  228. package/skills/wix-replatform/lib/link-plan.js +148 -0
  229. package/skills/wix-replatform/lib/link-verification.js +274 -0
  230. package/skills/wix-replatform/lib/link-write-journal.js +42 -0
  231. package/skills/wix-replatform/lib/local-state.js +869 -30
  232. package/skills/wix-replatform/lib/member-completion.js +658 -0
  233. package/skills/wix-replatform/lib/member-crosswalk.js +69 -0
  234. package/skills/wix-replatform/lib/member-outcome-registry.js +265 -0
  235. package/skills/wix-replatform/lib/migration-completion.js +311 -0
  236. package/skills/wix-replatform/lib/operator-identity.js +47 -0
  237. package/skills/wix-replatform/lib/orchestration-decisions.js +248 -0
  238. package/skills/wix-replatform/lib/orchestration-preflight.js +401 -19
  239. package/skills/wix-replatform/lib/orchestration-router.js +608 -32
  240. package/skills/wix-replatform/lib/orchestration-state.js +188 -12
  241. package/skills/wix-replatform/lib/order-reference-readiness.js +30 -0
  242. package/skills/wix-replatform/lib/payments-outcome-registry.js +200 -0
  243. package/skills/wix-replatform/lib/plugin-cms-fallback.js +618 -0
  244. package/skills/wix-replatform/lib/preservation-approval-stamp.js +54 -0
  245. package/skills/wix-replatform/lib/product-media-deferral.js +96 -0
  246. package/skills/wix-replatform/lib/progress-log.js +19 -3
  247. package/skills/wix-replatform/lib/read-back-approval.js +184 -0
  248. package/skills/wix-replatform/lib/read-back-comparison.js +136 -0
  249. package/skills/wix-replatform/lib/read-back-contract.js +243 -0
  250. package/skills/wix-replatform/lib/read-back-extract.js +118 -0
  251. package/skills/wix-replatform/lib/read-back-gate.js +734 -0
  252. package/skills/wix-replatform/lib/read-back-reads.js +94 -0
  253. package/skills/wix-replatform/lib/read-back-state.js +107 -0
  254. package/skills/wix-replatform/lib/read-back-summary.js +81 -0
  255. package/skills/wix-replatform/lib/rerun-conflicts.js +334 -0
  256. package/skills/wix-replatform/lib/run-controller.js +401 -0
  257. package/skills/wix-replatform/lib/seo-outcome-registry.js +45 -0
  258. package/skills/wix-replatform/lib/setup-verification.js +148 -0
  259. package/skills/wix-replatform/lib/source-access.js +231 -0
  260. package/skills/wix-replatform/lib/source-coverage.js +1130 -0
  261. package/skills/wix-replatform/lib/source-secrets.js +277 -0
  262. package/skills/wix-replatform/lib/structured-link-patch.js +59 -0
  263. package/skills/wix-replatform/lib/task-state.js +110 -0
  264. package/skills/wix-replatform/lib/url-preservation-report.js +319 -0
  265. package/skills/wix-replatform/lib/url-preservation-state.js +349 -1
  266. package/skills/wix-replatform/lib/url-redirect-plan.js +728 -0
  267. package/skills/wix-replatform/lib/url-verification.js +315 -0
  268. package/skills/wix-replatform/lib/user-action-effects.js +42 -0
  269. package/skills/wix-replatform/lib/user-actions.js +264 -0
  270. package/skills/wix-replatform/lib/website-handoff.js +1220 -0
  271. package/skills/wix-replatform/lib/wix-client-callers.js +54 -0
  272. package/skills/wix-replatform/lib/wix-dashboard-url.js +35 -0
  273. package/skills/wix-replatform/lib/write-verification-state.js +92 -0
  274. package/skills/wix-replatform/lib/write-verification.js +274 -0
  275. package/skills/wix-replatform/resources/rp-destination/SKILL.md +137 -0
  276. package/skills/wix-replatform/resources/rp-discovery/SKILL.md +189 -16
  277. package/skills/wix-replatform/resources/rp-discovery/scripts/promote-source-coverage.js +47 -0
  278. package/skills/wix-replatform/resources/rp-execute-import/SKILL.md +869 -29
  279. package/skills/wix-replatform/resources/rp-execute-import/scripts/shipping-estimate-audit.js +70 -0
  280. package/skills/wix-replatform/resources/rp-execute-setup/SKILL.md +195 -29
  281. package/skills/wix-replatform/resources/rp-execute-setup/scripts/execute-setup.js +442 -0
  282. package/skills/wix-replatform/resources/rp-execution-policy/SKILL.md +112 -0
  283. package/skills/wix-replatform/resources/rp-execution-policy/lib/coupon-currency-plan-report.js +143 -0
  284. package/skills/wix-replatform/resources/rp-execution-policy/lib/payments-report.js +244 -0
  285. package/skills/wix-replatform/resources/rp-import-codegen/SKILL.md +2082 -38
  286. package/skills/wix-replatform/resources/rp-mapper/SKILL.md +528 -11
  287. package/skills/wix-replatform/resources/rp-mapper/lib/structure-bridge-planning.js +303 -0
  288. package/skills/wix-replatform/resources/rp-mapper/scripts/coverage-reconcile.js +88 -0
  289. package/skills/wix-replatform/resources/rp-mapper/wix-business-solutions-taxonomy.md +6 -5
  290. package/skills/wix-replatform/resources/rp-preflight/SKILL.md +40 -0
  291. package/skills/wix-replatform/resources/rp-project-intake/SKILL.md +55 -0
  292. package/skills/wix-replatform/resources/rp-quick-runtime/SKILL.md +60 -0
  293. package/skills/wix-replatform/resources/rp-quick-runtime/lib/import-progress.js +89 -0
  294. package/skills/wix-replatform/resources/rp-quick-runtime/lib/limit-recovery.js +36 -0
  295. package/skills/wix-replatform/resources/rp-quick-shopify/SKILL.md +123 -0
  296. package/skills/wix-replatform/resources/rp-quick-shopify/quick-mode.json +124 -0
  297. package/skills/wix-replatform/resources/rp-quick-shopify/scripts/quick-mode.js +522 -0
  298. package/skills/wix-replatform/resources/rp-quick-woocommerce/SKILL.md +56 -0
  299. package/skills/wix-replatform/resources/rp-quick-woocommerce/quick-mode.json +91 -0
  300. package/skills/wix-replatform/resources/rp-quick-woocommerce/scripts/quick-mode.js +255 -0
  301. package/skills/wix-replatform/resources/rp-setup-discovery/SKILL.md +80 -10
  302. package/skills/wix-replatform/resources/rp-setup-discovery/scripts/quick-setup-plan.js +44 -0
  303. package/skills/wix-replatform/resources/rp-source-csv/SKILL.md +3 -0
  304. package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fileset.js +0 -0
  305. package/skills/wix-replatform/resources/rp-source-csv/scripts/csv-discovery.js +21 -1
  306. package/skills/wix-replatform/resources/rp-source-inputs/SKILL.md +66 -0
  307. package/skills/wix-replatform/resources/rp-source-sfcc/SKILL.md +153 -0
  308. package/skills/wix-replatform/resources/rp-source-shopify/SKILL.md +394 -0
  309. package/skills/wix-replatform/resources/rp-source-shopify/lib/discovery-reads.js +200 -0
  310. package/skills/wix-replatform/resources/rp-source-shopify/lib/import-findings.js +34 -0
  311. package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-bulk-sqlite-worker.js +44 -0
  312. package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-bulk.js +1470 -0
  313. package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-cli.js +446 -0
  314. package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-gift-cards.js +474 -0
  315. package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-protected-fields.js +879 -0
  316. package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-session.js +426 -0
  317. package/skills/wix-replatform/resources/rp-source-shopify/queries/articles.graphql +24 -0
  318. package/skills/wix-replatform/resources/rp-source-shopify/queries/blogs.graphql +18 -0
  319. package/skills/wix-replatform/resources/rp-source-shopify/queries/collections.graphql +40 -0
  320. package/skills/wix-replatform/resources/rp-source-shopify/queries/customers.graphql +76 -0
  321. package/skills/wix-replatform/resources/rp-source-shopify/queries/delivery-profiles.graphql +51 -0
  322. package/skills/wix-replatform/resources/rp-source-shopify/queries/discounts.graphql +35 -0
  323. package/skills/wix-replatform/resources/rp-source-shopify/queries/files.graphql +20 -0
  324. package/skills/wix-replatform/resources/rp-source-shopify/queries/gift-cards.graphql +18 -0
  325. package/skills/wix-replatform/resources/rp-source-shopify/queries/inventory.graphql +31 -0
  326. package/skills/wix-replatform/resources/rp-source-shopify/queries/locations.graphql +21 -0
  327. package/skills/wix-replatform/resources/rp-source-shopify/queries/menus.graphql +21 -0
  328. package/skills/wix-replatform/resources/rp-source-shopify/queries/metaobjects.graphql +30 -0
  329. package/skills/wix-replatform/resources/rp-source-shopify/queries/orders-core.graphql +150 -0
  330. package/skills/wix-replatform/resources/rp-source-shopify/queries/orders-fulfillments.graphql +36 -0
  331. package/skills/wix-replatform/resources/rp-source-shopify/queries/orders-refunds.graphql +48 -0
  332. package/skills/wix-replatform/resources/rp-source-shopify/queries/pages.graphql +20 -0
  333. package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-customers-address.graphql +8 -0
  334. package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-customers-email.graphql +6 -0
  335. package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-customers-name.graphql +8 -0
  336. package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-customers-phone.graphql +8 -0
  337. package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-orders-address.graphql +12 -0
  338. package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-orders-email.graphql +6 -0
  339. package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-orders-name.graphql +13 -0
  340. package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-orders-phone.graphql +13 -0
  341. package/skills/wix-replatform/resources/rp-source-shopify/queries/products.graphql +73 -0
  342. package/skills/wix-replatform/resources/rp-source-shopify/queries/url-redirects.graphql +13 -0
  343. package/skills/wix-replatform/resources/rp-source-shopify/scripts/shopify-discovery.js +693 -0
  344. package/skills/wix-replatform/resources/rp-source-shopify/scripts/shopify-extract.js +283 -0
  345. package/skills/wix-replatform/resources/rp-source-shopify/scripts/shopify-gift-card-remedy.js +191 -0
  346. package/skills/wix-replatform/resources/rp-source-shopify/scripts/shopify-session-check.js +115 -0
  347. package/skills/wix-replatform/resources/rp-source-shopify/source-schema.example.json +201 -0
  348. package/skills/wix-replatform/resources/rp-source-wordpress/PLUGIN-READ-PLANS.md +146 -0
  349. package/skills/wix-replatform/resources/rp-source-wordpress/SKILL.md +736 -22
  350. package/skills/wix-replatform/resources/rp-source-wordpress/lib/blocked-data-handlers.js +73 -0
  351. package/skills/wix-replatform/resources/rp-source-wordpress/lib/checkout-field-csv-parser.js +115 -0
  352. package/skills/wix-replatform/resources/rp-source-wordpress/lib/checkout-field-csv-parser.test-fixture.js +91 -0
  353. package/skills/wix-replatform/resources/rp-source-wordpress/lib/coupon-discovery.js +440 -0
  354. package/skills/wix-replatform/resources/rp-source-wordpress/lib/currency-gate.js +125 -0
  355. package/skills/wix-replatform/resources/rp-source-wordpress/lib/gateway-source-keys.js +252 -0
  356. package/skills/wix-replatform/resources/rp-source-wordpress/lib/gateway-source-keys.json +183 -0
  357. package/skills/wix-replatform/resources/rp-source-wordpress/lib/gateway-summary.mjs +333 -0
  358. package/skills/wix-replatform/resources/rp-source-wordpress/lib/invoice-discovery.js +426 -0
  359. package/skills/wix-replatform/resources/rp-source-wordpress/lib/plugin-disposition.js +400 -0
  360. package/skills/wix-replatform/resources/rp-source-wordpress/lib/plugin-entity-read-plan.js +633 -0
  361. package/skills/wix-replatform/resources/rp-source-wordpress/lib/plugin-knowledge.js +1127 -0
  362. package/skills/wix-replatform/resources/rp-source-wordpress/lib/refund-corroboration.js +194 -0
  363. package/skills/wix-replatform/resources/rp-source-wordpress/lib/refund-corroboration.json +100 -0
  364. package/skills/wix-replatform/resources/rp-source-wordpress/lib/sampled-ids-batch.js +157 -0
  365. package/skills/wix-replatform/resources/rp-source-wordpress/lib/secret-value-guard.js +234 -0
  366. package/skills/wix-replatform/resources/rp-source-wordpress/lib/store-currency.js +101 -0
  367. package/skills/wix-replatform/resources/rp-source-wordpress/lib/structure-bridge-reader.js +755 -0
  368. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wix-wp-plugin-v2-client.js +1074 -0
  369. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wix-wp-plugin-v2-client.test-fixture.js +149 -0
  370. package/skills/wix-replatform/resources/rp-source-wordpress/lib/woo-inventory.js +25 -0
  371. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-http.js +204 -9
  372. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-image-url.js +186 -0
  373. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-plugin-detect.js +1422 -0
  374. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-redirect-sources.js +343 -0
  375. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-route-classifier.js +262 -26
  376. package/skills/wix-replatform/resources/rp-source-wordpress/lib/yoast-product-seo-evidence.js +272 -0
  377. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/README.md +373 -0
  378. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/advanced-custom-fields.json +101 -0
  379. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/back-in-stock-notifier-for-woocommerce.json +81 -0
  380. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/capabilities-pending-decision.json +128 -0
  381. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/cms-fallback-eligible.json +18 -0
  382. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/contact-form-7.json +104 -0
  383. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/facebook-for-woocommerce.json +44 -0
  384. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/fingerprint-aliases.json +49 -0
  385. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/free-gifts-for-woocommerce.json +94 -0
  386. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/index.json +863 -0
  387. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/mailpoet.json +52 -0
  388. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/membership-for-woocommerce.json +161 -0
  389. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/mwb-bookings-for-woocommerce.json +180 -0
  390. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/no-migration-needed.json +286 -0
  391. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/pricing-deals-for-woocommerce.json +79 -0
  392. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/product-extras-for-woocommerce.json +120 -0
  393. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/pw-woocommerce-gift-cards.json +128 -0
  394. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/requires-development.json +88 -0
  395. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/seo-by-rank-math.json +80 -0
  396. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/seriously-simple-podcasting.json +46 -0
  397. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/strong-testimonials.json +55 -0
  398. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/subscriptions-for-woocommerce.json +99 -0
  399. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/tablepress.json +55 -0
  400. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/the-events-calendar.json +160 -0
  401. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/ti-woocommerce-wishlist.json +81 -0
  402. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woo-checkout-field-editor-pro.json +60 -0
  403. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woo-discount-rules.json +74 -0
  404. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woo-product-bundle.json +75 -0
  405. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-gift-cards.json +60 -0
  406. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-other-payment-gateway.json +44 -0
  407. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-pdf-invoices-packing-slips.json +57 -0
  408. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-product-addon.json +141 -0
  409. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-progressive-discounts.json +54 -0
  410. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/wordpress-seo.json +158 -0
  411. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/wpc-composite-products.json +97 -0
  412. package/skills/wix-replatform/resources/rp-source-wordpress/plugins/wpforms-lite.json +86 -0
  413. package/skills/wix-replatform/resources/rp-source-wordpress/scripts/capture-store-settings.js +90 -0
  414. package/skills/wix-replatform/resources/rp-source-wordpress/scripts/plugin-knowledge-validate.js +51 -0
  415. package/skills/wix-replatform/resources/rp-source-wordpress/scripts/plugin-knowledge.js +103 -0
  416. package/skills/wix-replatform/resources/rp-source-wordpress/scripts/wp-discovery.js +1668 -33
  417. package/skills/wix-replatform/resources/rp-source-wordpress/scripts/wp-plugin-inventory.js +273 -0
  418. package/skills/wix-replatform/resources/rp-source-wordpress/secret-value-patterns.v1.json +11 -0
  419. package/skills/wix-replatform/resources/rp-source-wordpress/sub-parts.json +13 -0
  420. package/skills/wix-replatform/resources/rp-target-wix/SKILL.md +446 -32
  421. package/skills/wix-replatform/resources/rp-target-wix/app-page-routing-capabilities.json +36 -0
  422. package/skills/wix-replatform/resources/rp-target-wix/domains/README.md +38 -2
  423. package/skills/wix-replatform/resources/rp-target-wix/domains/SERVICE-PLUGINS.md +322 -0
  424. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/docs-survey.json +70 -0
  425. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/domain.json +19 -9
  426. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/category.json +42 -8
  427. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/comment.json +54 -8
  428. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/post.json +66 -10
  429. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/tag.json +38 -7
  430. package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/docs-survey.json +332 -0
  431. package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/domain.json +75 -0
  432. package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/entities/booking.json +181 -0
  433. package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/entities/service-add-on.json +130 -0
  434. package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/entities/service.json +180 -0
  435. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/docs-survey.json +161 -0
  436. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/domain.json +15 -4
  437. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/collection.json +39 -7
  438. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/data-item.json +47 -8
  439. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/reference.json +7 -1
  440. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/docs-survey.json +204 -0
  441. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/domain.json +17 -4
  442. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/contact.json +159 -15
  443. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/email-subscription.json +80 -12
  444. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/label.json +48 -8
  445. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/docs-survey.json +306 -0
  446. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/domain.json +30 -7
  447. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/delivery-profile.json +171 -0
  448. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/discount-rule.json +182 -0
  449. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-applied-discount.json +129 -0
  450. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-invoice-document.json +192 -0
  451. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-line-item-options.json +123 -0
  452. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-line-item.json +60 -12
  453. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-merchant-note.json +112 -0
  454. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-payment.json +191 -0
  455. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-refund.json +140 -13
  456. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order.json +383 -18
  457. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/pickup-location.json +122 -0
  458. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/shipping-option.json +98 -0
  459. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/wishlist-item.json +86 -0
  460. package/skills/wix-replatform/resources/rp-target-wix/domains/events/docs-survey.json +128 -0
  461. package/skills/wix-replatform/resources/rp-target-wix/domains/events/domain.json +38 -0
  462. package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/category.json +73 -0
  463. package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/event.json +107 -0
  464. package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/registration-form.json +89 -0
  465. package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/rsvp.json +118 -0
  466. package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/ticket-definition.json +93 -0
  467. package/skills/wix-replatform/resources/rp-target-wix/domains/forms/docs-survey.json +86 -0
  468. package/skills/wix-replatform/resources/rp-target-wix/domains/forms/domain.json +56 -0
  469. package/skills/wix-replatform/resources/rp-target-wix/domains/forms/entities/form-submission.json +121 -0
  470. package/skills/wix-replatform/resources/rp-target-wix/domains/forms/entities/form.json +134 -0
  471. package/skills/wix-replatform/resources/rp-target-wix/domains/gift-cards/docs-survey.json +41 -0
  472. package/skills/wix-replatform/resources/rp-target-wix/domains/gift-cards/domain.json +50 -0
  473. package/skills/wix-replatform/resources/rp-target-wix/domains/gift-cards/entities/gift-card-product.json +87 -0
  474. package/skills/wix-replatform/resources/rp-target-wix/domains/gift-cards/entities/gift-card.json +130 -0
  475. package/skills/wix-replatform/resources/rp-target-wix/domains/index.json +914 -24
  476. package/skills/wix-replatform/resources/rp-target-wix/domains/media/docs-survey.json +41 -0
  477. package/skills/wix-replatform/resources/rp-target-wix/domains/media/domain.json +14 -4
  478. package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-file.json +45 -8
  479. package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-folder.json +41 -7
  480. package/skills/wix-replatform/resources/rp-target-wix/domains/members/docs-survey.json +119 -0
  481. package/skills/wix-replatform/resources/rp-target-wix/domains/members/domain.json +13 -3
  482. package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/badge.json +41 -7
  483. package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/custom-field.json +82 -0
  484. package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/member-about.json +77 -0
  485. package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/member.json +165 -13
  486. package/skills/wix-replatform/resources/rp-target-wix/domains/pricing-plans/docs-survey.json +41 -0
  487. package/skills/wix-replatform/resources/rp-target-wix/domains/pricing-plans/domain.json +46 -0
  488. package/skills/wix-replatform/resources/rp-target-wix/domains/pricing-plans/entities/plan-order.json +137 -0
  489. package/skills/wix-replatform/resources/rp-target-wix/domains/pricing-plans/entities/plan.json +133 -0
  490. package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/docs-survey.json +7 -0
  491. package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/domain.json +36 -0
  492. package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/amazon-shop-connect.json +71 -0
  493. package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/ebay-shop-connect.json +67 -0
  494. package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/google-youtube-connect.json +72 -0
  495. package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/meta-catalog-connect.json +74 -0
  496. package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/pinterest-catalog-connect.json +69 -0
  497. package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/tiktok-catalog-connect.json +61 -0
  498. package/skills/wix-replatform/resources/rp-target-wix/domains/schema.json +28 -1
  499. package/skills/wix-replatform/resources/rp-target-wix/domains/seo/docs-survey.json +109 -0
  500. package/skills/wix-replatform/resources/rp-target-wix/domains/seo/domain.json +73 -0
  501. package/skills/wix-replatform/resources/rp-target-wix/domains/seo/entities/item-seo-tags.json +148 -0
  502. package/skills/wix-replatform/resources/rp-target-wix/domains/seo/entities/seo-pattern.json +91 -0
  503. package/skills/wix-replatform/resources/rp-target-wix/domains/seo/entities/site-seo-tags.json +79 -0
  504. package/skills/wix-replatform/resources/rp-target-wix/domains/site/docs-survey.json +32 -0
  505. package/skills/wix-replatform/resources/rp-target-wix/domains/site/domain.json +49 -0
  506. package/skills/wix-replatform/resources/rp-target-wix/domains/site/entities/business-contact.json +103 -0
  507. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/docs-survey.json +203 -0
  508. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/domain.json +27 -10
  509. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/back-in-stock-request.json +119 -0
  510. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/brand.json +111 -0
  511. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/category.json +52 -8
  512. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/coupon.json +214 -10
  513. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/inventory-item.json +93 -13
  514. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product-customization.json +111 -0
  515. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product-tag.json +52 -10
  516. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product.json +145 -14
  517. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/promotion.json +84 -0
  518. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/review.json +178 -0
  519. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/subscription-product.json +87 -0
  520. package/skills/wix-replatform/resources/rp-target-wix/domains/tax/docs-survey.json +106 -0
  521. package/skills/wix-replatform/resources/rp-target-wix/domains/tax/domain.json +64 -0
  522. package/skills/wix-replatform/resources/rp-target-wix/domains/tax/entities/manual-tax-mapping.json +119 -0
  523. package/skills/wix-replatform/resources/rp-target-wix/domains/tax/entities/tax-group.json +94 -0
  524. package/skills/wix-replatform/resources/rp-target-wix/domains/tax/entities/tax-region.json +113 -0
  525. package/skills/wix-replatform/resources/rp-target-wix/domains/tax/entities/tax-settings.json +65 -0
  526. package/skills/wix-replatform/resources/rp-target-wix/lib/blog-author-attribution.js +165 -0
  527. package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-client.js +60 -0
  528. package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-duplicates.js +201 -0
  529. package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-ledger.js +306 -0
  530. package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-report.js +229 -0
  531. package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-stage.js +55 -0
  532. package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build.js +715 -0
  533. package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-media.js +567 -0
  534. package/skills/wix-replatform/resources/rp-target-wix/lib/bulk-results.js +73 -0
  535. package/skills/wix-replatform/resources/rp-target-wix/lib/contact-extended-fields.js +194 -0
  536. package/skills/wix-replatform/resources/rp-target-wix/lib/contact-import.js +133 -0
  537. package/skills/wix-replatform/resources/rp-target-wix/lib/contract-ledger.js +13 -4
  538. package/skills/wix-replatform/resources/rp-target-wix/lib/coupon-redemption-drift.js +491 -0
  539. package/skills/wix-replatform/resources/rp-target-wix/lib/customer-member.js +104 -0
  540. package/skills/wix-replatform/resources/rp-target-wix/lib/data-extension-schema.js +673 -0
  541. package/skills/wix-replatform/resources/rp-target-wix/lib/domain-knowledge.js +453 -2
  542. package/skills/wix-replatform/resources/rp-target-wix/lib/gift-card-balance-reconciliation.js +119 -0
  543. package/skills/wix-replatform/resources/rp-target-wix/lib/gift-card-build.js +566 -0
  544. package/skills/wix-replatform/resources/rp-target-wix/lib/gift-card-redemption-build.js +249 -0
  545. package/skills/wix-replatform/resources/rp-target-wix/lib/order-applied-discount-build.js +63 -0
  546. package/skills/wix-replatform/resources/rp-target-wix/lib/order-buyer.js +187 -0
  547. package/skills/wix-replatform/resources/rp-target-wix/lib/order-channel-build.js +64 -0
  548. package/skills/wix-replatform/resources/rp-target-wix/lib/order-history.js +1027 -0
  549. package/skills/wix-replatform/resources/rp-target-wix/lib/order-invoice-contract.js +90 -0
  550. package/skills/wix-replatform/resources/rp-target-wix/lib/order-payment-mapping.js +420 -0
  551. package/skills/wix-replatform/resources/rp-target-wix/lib/pricing-plan-definition.js +177 -0
  552. package/skills/wix-replatform/resources/rp-target-wix/lib/product-import.js +151 -0
  553. package/skills/wix-replatform/resources/rp-target-wix/lib/product-seo.js +723 -0
  554. package/skills/wix-replatform/resources/rp-target-wix/lib/seo-redirects.js +353 -0
  555. package/skills/wix-replatform/resources/rp-target-wix/lib/shipping-build.js +1437 -0
  556. package/skills/wix-replatform/resources/rp-target-wix/lib/shipping-option-stage.js +354 -0
  557. package/skills/wix-replatform/resources/rp-target-wix/lib/store-config-build.js +134 -0
  558. package/skills/wix-replatform/resources/rp-target-wix/lib/stores-category-attach.js +221 -0
  559. package/skills/wix-replatform/resources/rp-target-wix/lib/stores-inventory.js +248 -0
  560. package/skills/wix-replatform/resources/rp-target-wix/lib/stores-verification.js +86 -3
  561. package/skills/wix-replatform/resources/rp-target-wix/lib/tax-build.js +231 -0
  562. package/skills/wix-replatform/resources/rp-target-wix/lib/url-mapper-transport.js +28 -0
  563. package/skills/wix-replatform/resources/rp-target-wix/lib/value-utils.js +14 -0
  564. package/skills/wix-replatform/resources/rp-target-wix/lib/variant-correlation.js +34 -0
  565. package/skills/wix-replatform/resources/rp-target-wix/lib/wix-build.js +166 -15
  566. package/skills/wix-replatform/resources/rp-target-wix/lib/wix-target-spec.js +19 -2
  567. package/skills/wix-replatform/resources/rp-target-wix/lib/wix-writers.js +4079 -257
  568. package/skills/wix-replatform/resources/rp-target-wix/lib/write-verification.js +3 -0
  569. package/skills/wix-replatform/resources/rp-target-wix/scripts/docs-survey-sync.js +150 -0
  570. package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge-validate.js +40 -2
  571. package/skills/wix-replatform/resources/rp-target-wix/scripts/verify-stores.js +6 -1
  572. package/skills/wix-replatform/resources/rp-telemetry/SKILL.md +148 -8
  573. package/skills/wix-replatform/resources/rp-telemetry/lib/bi-sink.js +83 -15
  574. package/skills/wix-replatform/resources/rp-telemetry/lib/telemetry-recorder.js +1119 -215
  575. package/skills/wix-replatform/resources/rp-telemetry/lib/transcript-digest.js +318 -0
  576. package/skills/wix-replatform/resources/rp-telemetry/scripts/meter-from-audit.js +2 -2
  577. package/skills/wix-replatform/resources/rp-telemetry/scripts/rp-telemetry.js +106 -4
  578. package/skills/wix-replatform/resources/rp-website-continuation/SKILL.md +94 -0
  579. package/skills/wix-replatform/scripts/census-reconciliation.js +25 -0
  580. package/skills/wix-replatform/scripts/cms-fallback.js +89 -0
  581. package/skills/wix-replatform/scripts/discovered-census.js +26 -0
  582. package/skills/wix-replatform/scripts/discovered-set-status.js +33 -0
  583. package/skills/wix-replatform/scripts/entity-qa-attestation.js +130 -0
  584. package/skills/wix-replatform/scripts/execution-health-check.js +415 -0
  585. package/skills/wix-replatform/scripts/execution-manifest-validate.js +1 -1
  586. package/skills/wix-replatform/scripts/execution-state-prepare.js +1 -1
  587. package/skills/wix-replatform/scripts/expectations-ledger.js +44 -0
  588. package/skills/wix-replatform/scripts/import-contract-verify.js +183 -0
  589. package/skills/wix-replatform/scripts/internal-link-audit.js +90 -0
  590. package/skills/wix-replatform/scripts/item-seo-tags-verify.js +205 -0
  591. package/skills/wix-replatform/scripts/migration-completion.js +76 -0
  592. package/skills/wix-replatform/scripts/orchestration-preflight.js +21 -2
  593. package/skills/wix-replatform/scripts/orchestration-route.js +32 -1
  594. package/skills/wix-replatform/scripts/orchestration-state.js +146 -10
  595. package/skills/wix-replatform/scripts/read-back-gate.js +175 -0
  596. package/skills/wix-replatform/scripts/replatform-console.js +146 -0
  597. package/skills/wix-replatform/scripts/replatform.js +436 -0
  598. package/skills/wix-replatform/scripts/source-secrets.js +77 -0
  599. package/skills/wix-replatform/scripts/url-redirects.js +286 -0
  600. package/skills/wix-replatform/scripts/user-action.js +58 -0
  601. package/skills/wix-replatform/scripts/website-handoff-generate.js +64 -0
  602. package/skills/wix-replatform/scripts/wix-dashboard-url.js +54 -0
  603. package/skills/wix-replatform/scripts/wix-destination.js +143 -0
  604. package/skills/wix-replatform/scripts/wix-headless-scaffold.js +762 -0
  605. package/skills/wix-vibe-headless/SKILL.md +7 -3
  606. package/skills/wix-vibe-headless/install/deploy.cjs +61 -34
  607. package/skills/wix-vibe-headless/platforms/base44.md +1 -0
  608. package/skills/wix-vibe-headless/references/donations/INSTRUCTIONS.md +88 -0
  609. package/skills/wix-vibe-headless/references/donations/app/rest/wix-donations.js +112 -0
  610. package/skills/wix-vibe-headless/references/donations/seed/SEED.md +11 -0
  611. package/skills/wix-vibe-headless/references/donations/tests/donations.test.mjs +258 -0
  612. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +5 -2
  613. package/skills/wix-vibe-headless/references/restaurants/app/context/OrderCartContext.jsx +4 -1
  614. package/skills/wix-vibe-headless/references/restaurants/app/rest/wix-restaurants-ordering.js +67 -3
  615. package/skills/wix-vibe-headless/references/shared/app/rest/wix-client.js +4 -3
  616. package/skills/wix-replatform/resources/rp-target-wix/SPEC-product-reviews-and-blog-authorship.md +0 -330
@@ -1,14 +1,44 @@
1
1
  'use strict';
2
2
 
3
+ const { verificationKind } = require('./entity-verification');
3
4
  const crypto = require('node:crypto');
4
5
  const fs = require('node:fs/promises');
5
6
  const path = require('node:path');
6
- const { loadAttemptJournal, loadCrosswalk } = require('./local-state.js');
7
+ const {
8
+ UNRESOLVED_ATTEMPT_STATUSES,
9
+ loadAttemptJournal,
10
+ loadCrosswalk,
11
+ rerunDecision,
12
+ attemptJournalPath,
13
+ readAttemptJournalSince,
14
+ foldAttemptsBySourceKey,
15
+ } = require('./local-state.js');
16
+ const { updateSupportFor } = require('./rerun-conflicts.js');
17
+ const { appendExecutionLog } = require('./execution-log.js');
7
18
 
8
19
  const RECOVERY_SCHEMA_VERSION = 1;
9
- const RECOVERY_MODES = ['partial', 'missing-only', 'failed-only', 'deferred-only', 'resumed'];
20
+ const RECOVERY_MODES = ['partial', 'missing-only', 'failed-only', 'deferred-only', 'unresolved-only', 'resumed', 'rerun'];
10
21
  const RECOVERY_STATUSES = ['complete', 'partial', 'failed', 'blocked'];
11
22
  const DEFERRED_ATTEMPT_STATUSES = new Set(['deferred', 'needs_verification']);
23
+ // A missing crosswalk link uses existing source-marker/natural-key checks and
24
+ // attempt-journal reconciliation before create. These statuses mean a previous write MIGHT have
25
+ // landed without being confirmed into the crosswalk, so creating again risks a duplicate.
26
+ const UNCERTAIN_ATTEMPT_STATUSES = new Set(['deferred', 'needs_verification', 'succeeded_unverified', 'started']);
27
+ // The three terminal `skipped_*` statuses
28
+ // `coverageStatusCounts` deliberately never buckets (it has no branch for any of them) make no
29
+ // journal-count claim at all -- there is nothing an importer could even report a disagreeing
30
+ // number for. A target type whose journal rows are ENTIRELY one or more of these is therefore not
31
+ // "unreported journal activity"; it is a type nothing was ever attempted, deferred, or failed for.
32
+ // Before this fix, the reverse journal->summary check (`unmatchedJournalEntities` below) counted
33
+ // ALL rows for a target type, including these, so a type whose only rows were e.g.
34
+ // `skipped_out_of_scope` was never named by any ordinary or naming-only summary bucket (nothing
35
+ // was imported/deferred/failed/attempted/already-present for it) and fell into
36
+ // `unmatchedJournalEntities` permanently -- for example a journal whose only row for
37
+ // a target type (`ecom/shipping-option`) is a single `skipped_out_of_scope` row. Excluding these statuses from the "claiming" row count used by
38
+ // that check -- and from `coverageByType`'s cumulative high-water mark itself,
39
+ // so the mark and the check it feeds always measure the same thing -- fixes this without making
40
+ // skipped_out_of_scope a journal-count claim anywhere else.
41
+ const NON_CLAIMING_ATTEMPT_STATUSES = new Set(['skipped_already_imported', 'skipped_safe_mode_blocked', 'skipped_out_of_scope']);
12
42
 
13
43
  function executionDir(projectDir) {
14
44
  return path.join(projectDir, 'execution');
@@ -84,14 +114,167 @@ function normalizeSelectionFilters(input = {}) {
84
114
  missingOnly: Boolean(input.missingOnly || input['missing-only']),
85
115
  failedOnly: Boolean(input.failedOnly || input['failed-only']),
86
116
  deferredOnly: Boolean(input.deferredOnly || input['deferred-only']),
117
+ // Unresolved gets its own selection mode because its next action differs:
118
+ // read the target back, never re-send. Re-sending an uncertain write is how a recovery
119
+ // pass creates a duplicate on a live store.
120
+ unresolvedOnly: Boolean(input.unresolvedOnly || input['unresolved-only']),
87
121
  };
88
- const exclusive = [filters.missingOnly, filters.failedOnly, filters.deferredOnly].filter(Boolean);
122
+ const exclusive = [filters.missingOnly, filters.failedOnly, filters.deferredOnly, filters.unresolvedOnly].filter(Boolean);
89
123
  if (exclusive.length > 1) {
90
- throw new Error('--missing-only, --failed-only, and --deferred-only are mutually exclusive');
124
+ throw new Error('--missing-only, --failed-only, --deferred-only, and --unresolved-only are mutually exclusive');
91
125
  }
92
126
  return filters;
93
127
  }
94
128
 
129
+ // A rerun buckets the refreshed scope into create / update / unchanged
130
+ // / unknown against the crosswalk baseline. It is deliberately NOT expressible as the existing
131
+ // filters: `missingOnly` excludes every crosswalk hit (so no changed record is ever seen) and
132
+ // `failedOnly` only revisits what was already attempted (so a change nobody attempted is
133
+ // missed). A regression check exists because an importer built from those two filters looks
134
+ // like a delta and silently is not.
135
+ //
136
+ // `unknown` is a first-class outcome, never folded into unchanged: see rerunDecision.
137
+ function selectRerunRecords(records, options = {}) {
138
+ if (!Array.isArray(records)) {
139
+ throw new Error('records must be an array');
140
+ }
141
+ const sourceSystem = options.sourceSystem || 'wordpress';
142
+ const sourceEntityType = requireString(
143
+ options.entity || options.sourceEntityType,
144
+ 'rerun selection entity',
145
+ );
146
+ const getSourceId = options.getSourceId || defaultSourceId;
147
+ const crosswalkBySource = options.crosswalkBySource || {};
148
+ const attemptsBySource = options.attemptsBySource || foldAttemptsBySource(options.attemptRows || []);
149
+ // How to read this entity's version off a refreshed source record. Declared by the adapter,
150
+ // never guessed here — an object id or capture time must never be treated as a record version an object id or capture time as a record version.
151
+ const sourceVersionField = options.sourceVersionField || null;
152
+ const getSourceVersion = options.getSourceVersion
153
+ || ((record) => (sourceVersionField ? record?.[sourceVersionField] : undefined));
154
+ const getSourceHash = options.getSourceHash || (() => undefined);
155
+ const sourceHashDefinition = options.sourceHashDefinition || null;
156
+ // Excluded history and deletions stay out. The accepted scope is enforced HERE
157
+ // rather than deferred to a generated importer: `inScope(record)` returns false for anything
158
+ // the approved plan excluded, and those records are reported as out-of-scope, never actioned.
159
+ // Deletions need no rule beyond this loop: a record absent from the refreshed source is simply
160
+ // never iterated, so absence can never become a delete instruction.
161
+ const inScope = typeof options.inScope === 'function' ? options.inScope : null;
162
+ // Per-entity update capability, so a changed record for an entity with no verified
163
+ // revision-protected writer is reported for review instead of being routed to an update.
164
+ const entityRef = options.targetEntityRef || null;
165
+ const declaredUpdateWriters = options.declaredUpdateWriters || {};
166
+ // FAIL CLOSED. An undeclared entity used to default to supported:true, which bypassed BOTH the
167
+ // order ban and the verified-writer requirement — an order with no targetEntityRef went
168
+ // straight to `update`. Absence of a declaration is not evidence that an update is safe, so
169
+ // the missing declaration is itself a review outcome.
170
+ const updateSupport = updateSupportFor(entityRef, { declaredUpdateWriters });
171
+
172
+ const create = [];
173
+ const update = [];
174
+ const unchanged = [];
175
+ const unknown = [];
176
+ const excluded = [];
177
+ const outOfScope = [];
178
+ const needsReconciliation = [];
179
+ const reportForReview = [];
180
+
181
+ for (const record of records) {
182
+ const sourceId = getSourceId(record);
183
+ if (sourceId === undefined || sourceId === null || sourceId === '') {
184
+ excluded.push({ record, reason: 'missing_source_id' });
185
+ continue;
186
+ }
187
+ const stableKey = sourceStableKey(sourceSystem, sourceEntityType, String(sourceId));
188
+ if (inScope && !inScope(record)) {
189
+ outOfScope.push({ sourceStableKey: stableKey, reason: 'excluded_by_accepted_scope' });
190
+ continue;
191
+ }
192
+ const crosswalkRow = crosswalkBySource[stableKey] || null;
193
+ const latestAttempt = attemptsBySource[stableKey] || null;
194
+ const decision = rerunDecision({
195
+ crosswalkRow,
196
+ sourceVersion: getSourceVersion(record),
197
+ sourceVersionField,
198
+ sourceHash: getSourceHash(record),
199
+ sourceHashDefinition,
200
+ });
201
+ const entry = {
202
+ record,
203
+ sourceStableKey: stableKey,
204
+ existing: crosswalkRow,
205
+ latestAttempt,
206
+ decision,
207
+ };
208
+ if (decision.action === 'create') {
209
+ // The attempt journal is consulted, not merely carried: an unconfirmed earlier write may
210
+ // already exist on the target, so this reconciles before it creates a second one.
211
+ if (latestAttempt && UNCERTAIN_ATTEMPT_STATUSES.has(latestAttempt.status)) {
212
+ needsReconciliation.push({ ...entry, reason: `uncertain_prior_attempt:${latestAttempt.status}` });
213
+ } else {
214
+ create.push(entry);
215
+ }
216
+ } else if (decision.action === 'update') {
217
+ if (!updateSupport.supported) {
218
+ reportForReview.push({ ...entry, reason: updateSupport.reason, detail: updateSupport.detail || null });
219
+ } else if (latestAttempt && UNCERTAIN_ATTEMPT_STATUSES.has(latestAttempt.status)) {
220
+ // An uncertain attempt is as dangerous on a LINKED record as on a new one, for a
221
+ // different reason: if the previous write actually landed and the process died before
222
+ // saving its baseline, the saved revision is already stale. Re-sending it makes the
223
+ // importer collide with its OWN earlier write and report it to the user as a merchant
224
+ // edit. Reconcile first.
225
+ needsReconciliation.push({ ...entry, reason: `uncertain_prior_attempt:${latestAttempt.status}` });
226
+ } else {
227
+ update.push(entry);
228
+ }
229
+ } else if (decision.action === 'skip') {
230
+ if (verificationKind({ ...options, entity: sourceEntityType }) !== 'none') {
231
+ needsReconciliation.push({ ...entry, reason: 'unchanged_source_requires_target_verification' });
232
+ } else unchanged.push(entry);
233
+ } else {
234
+ unknown.push(entry);
235
+ }
236
+ }
237
+
238
+ // Unknown counts are not zero. The caller reports these four buckets separately; an
239
+ // unresolved record must never be summed into unchanged to make a report look clean.
240
+ return {
241
+ entity: sourceEntityType,
242
+ mode: 'rerun',
243
+ create,
244
+ update,
245
+ unchanged,
246
+ unknown,
247
+ excluded,
248
+ outOfScope,
249
+ needsReconciliation,
250
+ reportForReview,
251
+ updateSupport,
252
+ summary: {
253
+ entity: sourceEntityType,
254
+ recordsRead: records.length,
255
+ toCreate: create.length,
256
+ toUpdate: update.length,
257
+ unchanged: unchanged.length,
258
+ unknown: unknown.length,
259
+ needsReconciliation: needsReconciliation.length,
260
+ reportForReview: reportForReview.length,
261
+ outOfScope: outOfScope.length,
262
+ excluded: excluded.length,
263
+ sourceVersionField: sourceVersionField || null,
264
+ },
265
+ };
266
+ }
267
+
268
+ async function selectRerunRecordsFromState(projectDir, records, options = {}) {
269
+ const crosswalk = await loadCrosswalk(projectDir);
270
+ const attempts = await loadAttemptJournal(projectDir);
271
+ return selectRerunRecords(records, {
272
+ ...options,
273
+ crosswalkBySource: crosswalk.bySource,
274
+ attemptRows: attempts.rows,
275
+ });
276
+ }
277
+
95
278
  function foldAttemptsBySource(attemptRows = []) {
96
279
  const bySource = {};
97
280
  for (const row of attemptRows) {
@@ -120,6 +303,7 @@ function selectImportRecords(records, options = {}) {
120
303
  const excluded = [];
121
304
  const failed = [];
122
305
  const deferred = [];
306
+ const unresolved = [];
123
307
 
124
308
  for (const record of records) {
125
309
  const sourceId = getSourceId(record);
@@ -136,7 +320,8 @@ function selectImportRecords(records, options = {}) {
136
320
  excluded.push({ sourceStableKey: stableKey, sourceType, reason: 'source_type_filter' });
137
321
  continue;
138
322
  }
139
- if (filters.missingOnly && existing) {
323
+ const identityRequired = verificationKind({ ...options, entity: sourceEntityType, targetEntityType: existing?.targetEntityType }) !== 'none';
324
+ if (filters.missingOnly && existing && !identityRequired) {
140
325
  alreadyPresent.push({ sourceStableKey: stableKey, targetId: existing.targetId, reason: 'crosswalk' });
141
326
  continue;
142
327
  }
@@ -148,6 +333,10 @@ function selectImportRecords(records, options = {}) {
148
333
  excluded.push({ sourceStableKey: stableKey, reason: 'not_deferred' });
149
334
  continue;
150
335
  }
336
+ if (filters.unresolvedOnly && (!latestAttempt || !UNRESOLVED_ATTEMPT_STATUSES.has(latestAttempt.status))) {
337
+ excluded.push({ sourceStableKey: stableKey, reason: 'not_unresolved' });
338
+ continue;
339
+ }
151
340
 
152
341
  if (latestAttempt && String(latestAttempt.status).startsWith('failed')) {
153
342
  failed.push(stableKey);
@@ -155,6 +344,12 @@ function selectImportRecords(records, options = {}) {
155
344
  if (latestAttempt && DEFERRED_ATTEMPT_STATUSES.has(latestAttempt.status)) {
156
345
  deferred.push(stableKey);
157
346
  }
347
+ // Never also counted in `failed`: the two sets are disjoint by construction, and an
348
+ // uncertain write summed into a failure count produces a report that reconciles
349
+ // arithmetically and is wrong.
350
+ if (latestAttempt && UNRESOLVED_ATTEMPT_STATUSES.has(latestAttempt.status)) {
351
+ unresolved.push(stableKey);
352
+ }
158
353
  selected.push({ record, sourceStableKey: stableKey, sourceType, existing, latestAttempt });
159
354
  }
160
355
 
@@ -164,6 +359,7 @@ function selectImportRecords(records, options = {}) {
164
359
  selected,
165
360
  alreadyPresent,
166
361
  excluded,
362
+ unresolved,
167
363
  summary: {
168
364
  entity: sourceEntityType,
169
365
  sourceType: filters.sourceType || 'all',
@@ -173,6 +369,7 @@ function selectImportRecords(records, options = {}) {
173
369
  excluded: excluded.length,
174
370
  failedCandidates: failed.length,
175
371
  deferredCandidates: deferred.length,
372
+ unresolvedCandidates: unresolved.length,
176
373
  },
177
374
  };
178
375
  }
@@ -209,7 +406,8 @@ function normalizeRecoveryEntry(input = {}) {
209
406
  const mode = input.mode || (input.selectionFilters && (
210
407
  input.selectionFilters.missingOnly ? 'missing-only' :
211
408
  input.selectionFilters.failedOnly ? 'failed-only' :
212
- input.selectionFilters.deferredOnly ? 'deferred-only' : 'partial'
409
+ input.selectionFilters.deferredOnly ? 'deferred-only' :
410
+ input.selectionFilters.unresolvedOnly ? 'unresolved-only' : 'partial'
213
411
  ));
214
412
  if (!RECOVERY_MODES.includes(mode)) {
215
413
  throw new Error(`recovery mode must be one of: ${RECOVERY_MODES.join(', ')}`);
@@ -222,10 +420,19 @@ function normalizeRecoveryEntry(input = {}) {
222
420
  if (Number.isNaN(Date.parse(timestamp))) {
223
421
  throw new Error('recovery timestamp must be an ISO timestamp');
224
422
  }
423
+ // `unresolved` must be stated, not defaulted: an entry that omits it is an
424
+ // entry whose author never decided where its uncertain writes went, and `count()` would
425
+ // silently read that as zero.
426
+ if (input.unresolved === undefined || input.unresolved === null) {
427
+ throw new Error('recovery unresolved count must be stated explicitly — uncertain writes are never folded into failed');
428
+ }
225
429
  const entry = {
226
430
  schemaVersion: RECOVERY_SCHEMA_VERSION,
227
431
  recoveryId: input.recoveryId || null,
228
432
  timestamp,
433
+ // This entry is built field by field, so anything not named here is
434
+ // dropped silently — which is why both of these are added explicitly.
435
+ runId: requireString(input.runId, 'recovery runId'),
229
436
  mode,
230
437
  selectionFilters: input.selectionFilters || {},
231
438
  reason: requireString(input.reason || 'operator_requested_recovery', 'recovery reason'),
@@ -235,16 +442,95 @@ function normalizeRecoveryEntry(input = {}) {
235
442
  alreadyPresent: count(input.alreadyPresent, 'alreadyPresent'),
236
443
  failed: count(input.failed, 'failed'),
237
444
  deferred: count(input.deferred, 'deferred'),
445
+ // Its own count, never summed into `failed`. A recovery record whose failed count silently
446
+ // includes uncertain writes reconciles arithmetically and is wrong, which is the worst
447
+ // combination available.
448
+ unresolved: count(input.unresolved, 'unresolved'),
238
449
  crosswalkChanges: input.crosswalkChanges || { before: 0, after: 0, added: 0, updated: 0 },
239
450
  summaryChanges: input.summaryChanges || {},
240
451
  outcome: requireString(input.outcome || status, 'recovery outcome'),
241
452
  status,
242
453
  logs: Array.isArray(input.logs) ? input.logs : [],
454
+ // A keep-Wix answer has to survive a reload, or the next rerun re-asks a
455
+ // question the user already answered — or worse, silently overwrites what they chose to
456
+ // keep. This entry is built field-by-field, so anything not named here is dropped; before
457
+ // this, passing a recordConflictDecision() result through lost choice, record identity,
458
+ // versions and the binding fingerprint without erroring.
459
+ conflictDecisions: normalizeConflictDecisions(input.conflictDecisions),
243
460
  };
244
461
  entry.recoveryId = recoveryIdFor(entry);
245
462
  return entry;
246
463
  }
247
464
 
465
+ // Each decision keeps exactly the fields keepDecisionApplies()/approvalApplies() need to judge
466
+ // whether it still applies. A decision missing any of them cannot be matched later, so it is
467
+ // rejected at write time rather than silently stored as unusable.
468
+ const CONFLICT_DECISION_FIELDS = [
469
+ 'choice', 'sourceStableKey', 'targetId', 'entity',
470
+ 'sourceVersion', 'sourceHash', 'reviewedTargetRevision', 'bindingFingerprint',
471
+ 'decidedBy', 'decidedAt',
472
+ ];
473
+
474
+ function normalizeConflictDecisions(input) {
475
+ if (input === undefined || input === null) {
476
+ return [];
477
+ }
478
+ if (!Array.isArray(input)) {
479
+ throw new Error('conflictDecisions must be an array');
480
+ }
481
+ return input.map((d, i) => {
482
+ if (!d || typeof d !== 'object') {
483
+ throw new Error(`conflictDecisions[${i}] must be an object`);
484
+ }
485
+ for (const required of ['choice', 'sourceStableKey', 'targetId', 'bindingFingerprint']) {
486
+ if (!d[required] || typeof d[required] !== 'string') {
487
+ throw new Error(`conflictDecisions[${i}].${required} must be a non-empty string — a decision that cannot be matched to a record is not reusable`);
488
+ }
489
+ }
490
+ if (!['override', 'keep'].includes(d.choice)) {
491
+ throw new Error(`conflictDecisions[${i}].choice must be override or keep`);
492
+ }
493
+ const out = {};
494
+ for (const f of CONFLICT_DECISION_FIELDS) {
495
+ out[f] = d[f] === undefined ? null : d[f];
496
+ }
497
+ return out;
498
+ });
499
+ }
500
+
501
+ // Reads every conflict decision recorded across the whole recovery log, newest last, so a rerun
502
+ // can ask "did the user already answer for this record?" without replaying the log itself.
503
+ function recoveryEntriesOf(recoveryLog) {
504
+ // loadRecoveryLog() returns an ARRAY. Reading `.entries` off it yields
505
+ // Array.prototype.entries -- a function, which a for-of then rejects with a bare
506
+ // "entries is not iterable". Accept the array (the real shape on disk) and the
507
+ // `{ entries: [...] }` wrapper, and treat anything else as empty.
508
+ if (Array.isArray(recoveryLog)) {
509
+ return recoveryLog;
510
+ }
511
+ if (recoveryLog && Array.isArray(recoveryLog.entries)) {
512
+ return recoveryLog.entries;
513
+ }
514
+ return [];
515
+ }
516
+
517
+ function loadConflictDecisions(recoveryLog) {
518
+ const entries = recoveryEntriesOf(recoveryLog);
519
+ const out = [];
520
+ for (const entry of entries) {
521
+ for (const d of (entry.conflictDecisions || [])) {
522
+ out.push({ ...d, recoveryId: entry.recoveryId || null, timestamp: entry.timestamp || null });
523
+ }
524
+ }
525
+ return out;
526
+ }
527
+
528
+ // The newest decision for one record, which is the only one that can still apply.
529
+ function latestConflictDecisionFor(recoveryLog, sourceStableKey) {
530
+ const all = loadConflictDecisions(recoveryLog).filter((d) => d.sourceStableKey === sourceStableKey);
531
+ return all.length ? all[all.length - 1] : null;
532
+ }
533
+
248
534
  async function loadRecoveryLog(projectDir) {
249
535
  const rows = await readJsonIfExists(recoveryLogPath(projectDir), []);
250
536
  if (!Array.isArray(rows)) {
@@ -277,14 +563,427 @@ function diffCounts(before = {}, after = {}) {
277
563
  return diff;
278
564
  }
279
565
 
566
+ // ---------------------------------------------------------------------------
567
+ // The live import summary checks its held counters against the attempt journal for
568
+ // the same run, instead of trusting them on faith. This cache keeps that check cheap and isolated per run.
569
+ // ---------------------------------------------------------------------------
570
+
571
+ const COVERAGE_JOURNAL_REL_PATH = 'state/attempts/write-attempts.ndjson';
572
+ const COVERAGE_ORDINARY_BUCKETS = ['imported', 'deferred', 'failed', 'attempted'];
573
+ // A flush can legitimately name an entity ONLY through a
574
+ // non-coverage-bucket counter -- `alreadyPresentByCrosswalk` records what a re-run pass found
575
+ // already linked, with nothing attempted this run and so no journal status to compare it
576
+ // against (the `imported + alreadyPresentByCrosswalk + deferred + failed == inScope` identity
577
+ // this repo's entityCompleteness accounting already protects). A flush naming only this
578
+ // counter for an entity is still reporting on that entity: it must count toward "this flush named
579
+ // it" for the reverse-direction match, the same way an ordinary bucket does, or a correct re-run
580
+ // pass reporting solely `alreadyPresentByCrosswalk` gets the same false `unmatchedJournalEntities`
581
+ // mismatch an ordinary bucket's absence would produce if it were mistaken for silence.
582
+ const COVERAGE_NAMING_ONLY_BUCKETS = ['alreadyPresentByCrosswalk'];
583
+
584
+ // Keyed by the absolute live-journal path, so distinct project directories (or a test's many temp
585
+ // dirs) never share state. Each entry's `offset` is the end of the last complete line read; `runs`
586
+ // holds one folded Map<sourceStableKey, latestRow> PER RUN ID seen in the journal so far -- not
587
+ // only the run currently flushing -- so switching from run A to run B and back never carries A's
588
+ // rows into B's map and never misses a row written while the other run was flushing. Memory is
589
+ // O(unique records across runs in the journal); work per flush is O(new bytes read).
590
+ //
591
+ // `reportedEntityCoverage` is a SIBLING per-run accumulator, independent of the folded rows: for
592
+ // each resolved target entity type some flush of this run has named a summary key for (ever, not
593
+ // only the flush currently running), it keeps the highest CLAIMING journal row count (never the raw row count -- see `NON_CLAIMING_ATTEMPT_STATUSES` above) that was true for
594
+ // that entity AT THE TIME it was last named -- not just a boolean "was it ever named". The journal fold
595
+ // is deliberately cumulative across the whole run (so a later flush sees everything an earlier one
596
+ // did -- that is the point of this cache), but `live-import-summary.json` is fully overwritten on
597
+ // every flush and a real multi-entity importer flushes one entity at a time (the only documented
598
+ // caller shape, rp-import-codegen/SKILL.md's contacts wrapper). Comparing the CURRENT flush's
599
+ // summary keys against the FULL run's cumulative journal entity types would then flag every entity
600
+ // reported by an earlier flush of the SAME run as "journal has rows, no summary key names it" the
601
+ // moment a later flush reports a different entity -- a false mismatch on every correctly-behaving
602
+ // multi-entity run. Tracking what has EVER been named across
603
+ // the run's own flushes, instead of only the current one, keeps a truly never-reported entity type
604
+ // detectable (it is never added) while an entity named by an earlier flush of this same run is
605
+ // correctly recognized as reported, not re-flagged by a later, different flush -- AS LONG AS the
606
+ // journal has not grown new rows for that entity since the last time it was named.
607
+ //
608
+ // A plain per-entity boolean
609
+ // is wrong, because "named once" is not the same thing as "accounts for the journal's current
610
+ // state". A flush naming an entity ONLY via a naming-only bucket (`alreadyPresentByCrosswalk`)
611
+ // while that entity had zero matching journal rows at that moment legitimately agrees -- but if the journal LATER accrues real, ordinary-status rows for that same entity type,
612
+ // and no later flush of the run ever names it again (via any bucket), a permanent boolean would
613
+ // keep calling that entity "reported" forever, hiding genuinely unreported journal activity from
614
+ // the reverse-direction (journal -> summary) check this check exists to provide. Storing the ROW
615
+ // COUNT that was true at the moment of naming, instead of a bare boolean, and re-comparing it
616
+ // against the journal's CURRENT row count on every subsequent flush, fixes this without reopening
617
+ // either case: an entity whose journal rows have not grown past what was already named stays correctly
618
+ // exempt (the legitimate "nothing new happened" cases both look like this), while new,
619
+ // never-claimed rows past that high-water mark are caught the same way a never-named entity is.
620
+ //
621
+ // This whole cache, including `reportedEntityCoverage`, is
622
+ // process-local (in-memory) and is NOT persisted across a process restart. That is intentional,
623
+ // not an oversight: a run id's entire lifetime is confined to one process by a GATE-ENFORCED
624
+ // contract, not merely a convention. Every generated importer must self-describe
625
+ // `runIdSource: "process-start"` (`assertGeneratedImporterContract` below rejects anything else;
626
+ // `rp-import-codegen/SKILL.md`'s "runId is the id the importer mints at process start" and
627
+ // `rp-execute-import/SKILL.md`'s recovery-log contract, "the id the importer minted at process
628
+ // start, so the entry is attributable to a pass", restate the same rule). So a genuinely resumed
629
+ // or recovery pass is a NEW process that mints a NEW run id -- it is correct, not a loss of state,
630
+ // for that new run id's `reportedEntityCoverage` to start empty, because no flush has ever happened
631
+ // under it. This reasoning does NOT cover a caller outside that gated contract that manually
632
+ // reuses an old run id across a process restart (for example an ad hoc recovery script bypassing
633
+ // codegen); that usage is unsupported today and would resurface the false-mismatch pattern on
634
+ // its first post-restart flush.
635
+ const coverageJournalCache = new Map();
636
+
637
+ function emptyCoverageCacheEntry() {
638
+ return { offset: 0, runs: new Map(), reportedEntityCoverage: new Map() };
639
+ }
640
+
641
+ // Reuses `foldAttemptsBySourceKey` (local-state.js) on just the newly read rows, grouped by run,
642
+ // then merges each run's folded result into that run's cached map -- `Map.set` overwrites, and the
643
+ // new rows are strictly later in file order than whatever is already cached, so this reproduces
644
+ // exactly what folding the whole run's rows from scratch would produce.
645
+ function mergeRowsIntoCoverageCache(entry, rows) {
646
+ const byRun = new Map();
647
+ for (const row of rows) {
648
+ if (!row || !row.runId || !row.sourceStableKey) {
649
+ continue;
650
+ }
651
+ if (!byRun.has(row.runId)) {
652
+ byRun.set(row.runId, []);
653
+ }
654
+ byRun.get(row.runId).push(row);
655
+ }
656
+ for (const [rowRunId, runRows] of byRun) {
657
+ const folded = foldAttemptsBySourceKey(runRows);
658
+ let runMap = entry.runs.get(rowRunId);
659
+ if (!runMap) {
660
+ runMap = new Map();
661
+ entry.runs.set(rowRunId, runMap);
662
+ }
663
+ for (const [key, row] of folded) {
664
+ runMap.set(key, row);
665
+ }
666
+ }
667
+ }
668
+
669
+ // Count buckets, computed directly from the folded rows' latest status -- never derived by summing
670
+ // other held counters. `attempted` matches this repo's documented semantics
671
+ // (rp-import-codegen/SKILL.md:2181-2182): imported or failed, never deferred.
672
+ function coverageStatusCounts(rows) {
673
+ const counts = { imported: 0, deferred: 0, failed: 0, attempted: 0, unexpectedSkipped: 0, unresolved: 0 };
674
+ for (const row of rows) {
675
+ const status = row.status;
676
+ if (status === 'imported') {
677
+ counts.imported += 1;
678
+ counts.attempted += 1;
679
+ } else if (status === 'failed_retryable' || status === 'failed_terminal') {
680
+ counts.failed += 1;
681
+ counts.attempted += 1;
682
+ } else if (DEFERRED_ATTEMPT_STATUSES.has(status)) {
683
+ counts.deferred += 1;
684
+ } else if (status === 'skipped_unexpected') {
685
+ counts.unexpectedSkipped += 1;
686
+ } else if (UNRESOLVED_ATTEMPT_STATUSES.has(status)) {
687
+ counts.unresolved += 1;
688
+ }
689
+ }
690
+ return counts;
691
+ }
692
+
693
+ // A held counter is "carried" only when the summary names it explicitly, including an explicit 0
694
+ // -- `in` rather than a truthiness check, so a real `0` is never mistaken for absence.
695
+ function heldBucketValue(summary, bucket, key) {
696
+ const container = summary && summary[bucket];
697
+ if (!container || typeof container !== 'object' || !(key in container)) {
698
+ return { present: false, value: null };
699
+ }
700
+ return { present: true, value: container[key] };
701
+ }
702
+
703
+ function truncateMessage(message) {
704
+ return typeof message === 'string' && message.length > 300 ? message.slice(0, 300) : message;
705
+ }
706
+
707
+ // Disagreeing `{key, bucket, held, journal}` entries, in entity-then-bucket order -- shared by the
708
+ // execution-log detail text below and by completion-report.js's operator-action text.
709
+ function coverageDisagreements(coverageCheck) {
710
+ const items = [];
711
+ for (const [key, row] of Object.entries((coverageCheck && coverageCheck.entities) || {})) {
712
+ for (const bucket of [...COVERAGE_ORDINARY_BUCKETS, 'unexpectedSkipped']) {
713
+ const counter = row[bucket];
714
+ if (counter && counter.compared && counter.agrees === false) {
715
+ items.push({ key, bucket, held: counter.held, journal: counter.journal });
716
+ }
717
+ }
718
+ }
719
+ return items;
720
+ }
721
+
722
+ function describeCoverageMismatch(coverageCheck) {
723
+ const parts = coverageDisagreements(coverageCheck)
724
+ .map((item) => `${item.key}.${item.bucket} disagrees (held ${item.held}, journal ${item.journal})`);
725
+ for (const key of (coverageCheck && coverageCheck.unmatched) || []) {
726
+ parts.push(`${key} not found in the journal for this run`);
727
+ }
728
+ for (const type of (coverageCheck && coverageCheck.unmatchedJournalEntities) || []) {
729
+ parts.push(`journal has ${type} records not named by any summary key`);
730
+ }
731
+ return parts.join('; ') || 'coverage check mismatch';
732
+ }
733
+
734
+ // Reads (incrementally, via the cache above) the live journal rows for `runId`,
735
+ // folds them, and compares them against `summary`'s held counters. Never throws: every case the
736
+ // check itself cannot complete resolves to `status: "unchecked"` with a named `reason`.
737
+ async function computeCoverageCheck(projectDir, summary, options, runId) {
738
+ const checkedAt = new Date().toISOString();
739
+ const base = { runId: runId || null, checkedAt, journalPath: COVERAGE_JOURNAL_REL_PATH };
740
+ if (!runId) {
741
+ return { ...base, status: 'unchecked', reason: 'no_run_id', rowsRead: 0, entities: {}, unmatched: [], unmatchedJournalEntities: [] };
742
+ }
743
+
744
+ const absPath = path.resolve(attemptJournalPath(projectDir));
745
+ let entry = coverageJournalCache.get(absPath);
746
+ if (!entry) {
747
+ entry = emptyCoverageCacheEntry();
748
+ coverageJournalCache.set(absPath, entry);
749
+ }
750
+
751
+ let readResult;
752
+ try {
753
+ readResult = await readAttemptJournalSince(projectDir, entry.offset);
754
+ } catch (error) {
755
+ if (error && error.code === 'JOURNAL_MISSING') {
756
+ return { ...base, status: 'unchecked', reason: 'journal_missing', rowsRead: 0, entities: {}, unmatched: [], unmatchedJournalEntities: [] };
757
+ }
758
+ if (error && error.code === 'JOURNAL_READ_FAILED') {
759
+ return {
760
+ ...base, status: 'unchecked', reason: 'journal_read_failed', rowsRead: 0, entities: {}, unmatched: [], unmatchedJournalEntities: [],
761
+ error: { code: (error.cause && error.cause.code) || null, message: truncateMessage(error.message) },
762
+ };
763
+ }
764
+ if (error && error.code === 'JOURNAL_INVALID') {
765
+ // Drop the whole cache entry so the next flush retries with a full read.
766
+ coverageJournalCache.delete(absPath);
767
+ return {
768
+ ...base, status: 'unchecked', reason: 'journal_invalid', rowsRead: 0, entities: {}, unmatched: [], unmatchedJournalEntities: [],
769
+ error: { line: truncateMessage(error.line), message: truncateMessage(error.message) },
770
+ };
771
+ }
772
+ throw error;
773
+ }
774
+
775
+ if (readResult.truncated) {
776
+ entry.runs = new Map();
777
+ entry.reportedEntityCoverage = new Map();
778
+ }
779
+ mergeRowsIntoCoverageCache(entry, readResult.rows);
780
+ entry.offset = readResult.nextOffset;
781
+
782
+ const runMap = entry.runs.get(runId) || new Map();
783
+ const entityTypesOption = (options && options.entityTypes) || {};
784
+ const resolveTargetEntityType = (key) => entityTypesOption[key] || key;
785
+
786
+ // Buckets that merely NAME an entity (for match purposes) vs. buckets whose VALUE is actually
787
+ // compared against the journal. `alreadyPresentByCrosswalk` is in the first set only.
788
+ const summaryKeys = new Set();
789
+ for (const bucket of [...COVERAGE_ORDINARY_BUCKETS, 'unexpectedSkipped', ...COVERAGE_NAMING_ONLY_BUCKETS]) {
790
+ const container = summary && summary[bucket];
791
+ if (container && typeof container === 'object') {
792
+ for (const key of Object.keys(container)) {
793
+ summaryKeys.add(key);
794
+ }
795
+ }
796
+ }
797
+
798
+ const rowsByTargetType = new Map();
799
+ for (const row of runMap.values()) {
800
+ const type = row.targetEntityType;
801
+ if (!rowsByTargetType.has(type)) {
802
+ rowsByTargetType.set(type, []);
803
+ }
804
+ rowsByTargetType.get(type).push(row);
805
+ }
806
+
807
+ const entities = {};
808
+ const unmatched = [];
809
+ const matchedTargetTypes = new Set();
810
+ let anyMismatch = false;
811
+ let anyUnresolved = false;
812
+
813
+ for (const key of summaryKeys) {
814
+ const targetType = resolveTargetEntityType(key);
815
+ const rows = rowsByTargetType.get(targetType) || [];
816
+ // A key named ONLY through a naming-only bucket (e.g. `alreadyPresentByCrosswalk`) makes
817
+ // no claim about journal activity for this entity -- zero matching rows is its expected,
818
+ // unremarkable state (nothing was attempted this run), not an unmatched claim. A key that
819
+ // names at least one ORDINARY bucket (imported/deferred/failed/attempted) is still held to
820
+ // the existing rule: claiming activity with zero matching journal rows is unmatched.
821
+ const namesOrdinaryBucket = COVERAGE_ORDINARY_BUCKETS.some((bucket) => heldBucketValue(summary, bucket, key).present);
822
+ if (rows.length === 0 && namesOrdinaryBucket) {
823
+ // A summary key with no matching rows is reported as unmatched, never as agreement.
824
+ unmatched.push(key);
825
+ anyMismatch = true;
826
+ continue;
827
+ }
828
+ matchedTargetTypes.add(targetType);
829
+ const counts = coverageStatusCounts(rows);
830
+ if (counts.unresolved > 0) {
831
+ anyUnresolved = true;
832
+ }
833
+ const entityRow = { unresolved: counts.unresolved };
834
+ for (const bucket of COVERAGE_ORDINARY_BUCKETS) {
835
+ const held = heldBucketValue(summary, bucket, key);
836
+ if (!held.present) {
837
+ entityRow[bucket] = { held: null, journal: counts[bucket], agrees: null, compared: false };
838
+ } else {
839
+ const agrees = held.value === counts[bucket];
840
+ if (!agrees) {
841
+ anyMismatch = true;
842
+ }
843
+ entityRow[bucket] = { held: held.value, journal: counts[bucket], agrees, compared: true };
844
+ }
845
+ }
846
+ // `unexpectedSkipped` is deliberately the opposite of the four ordinary buckets: a status
847
+ // nothing should ever reach must not go invisible merely because the importer never named a
848
+ // counter for it, so an absent held value defaults to 0 rather than to "not compared".
849
+ const heldSkipped = heldBucketValue(summary, 'unexpectedSkipped', key);
850
+ const heldSkippedValue = heldSkipped.present ? heldSkipped.value : 0;
851
+ const skippedAgrees = heldSkippedValue === counts.unexpectedSkipped;
852
+ if (!skippedAgrees) {
853
+ anyMismatch = true;
854
+ }
855
+ entityRow.unexpectedSkipped = { held: heldSkippedValue, journal: counts.unexpectedSkipped, agrees: skippedAgrees, compared: true };
856
+ entities[key] = entityRow;
857
+ }
858
+
859
+ // Accumulate this flush's matched target types into the run's PERSISTED, cumulative
860
+ // coverage map -- not a bare "was it ever named" boolean, but the CLAIMING journal row count that
861
+ // was true for that entity AT THE TIME it was named. See the cache comment above
862
+ // `coverageJournalCache` for why cumulative tracking across flushes is required at all, and
863
+ // for why a boolean is not enough on its own: a naming-only bucket (or any bucket) can
864
+ // legitimately name an entity while the journal has zero (or fewer) rows for it, and the journal
865
+ // can keep growing afterward without any later flush ever naming that entity again. Storing the
866
+ // row count lets the reverse check keep comparing cumulative reported coverage against the
867
+ // journal's cumulative state on every flush, instead of permanently exempting an entity the
868
+ // moment it is named once.
869
+ //
870
+ // This mark and the reverse-mismatch check below are two
871
+ // halves of one invariant -- "the mark only ever reflects rows that make a journal-count claim" --
872
+ // and must be computed from the SAME per-type claiming count, not two separately-filtered ones.
873
+ // Updating the mark with each type's FULL row count (claiming + non-claiming) while the check below
874
+ // compares it against the claiming-only count let a type matched while it already had non-claiming
875
+ // rows (e.g. `skipped_out_of_scope`) set an inflated mark that could then mask a later genuine,
876
+ // never-renamed claiming row (e.g. a real `imported` row) for that same type -- the mark never
877
+ // dropped, so `covered < claimingRowCount` stayed false even though the claim was real. Computing
878
+ // `claimingRowCountByType` once, up front, and using it for BOTH the mark and the check keeps them
879
+ // structurally unable to drift apart again.
880
+ const claimingRowCountByType = new Map();
881
+ for (const [targetType, rowsForType] of rowsByTargetType) {
882
+ const claimingRowCount = rowsForType.filter((row) => !NON_CLAIMING_ATTEMPT_STATUSES.has(row.status)).length;
883
+ claimingRowCountByType.set(targetType, claimingRowCount);
884
+ }
885
+
886
+ let coverageByType = entry.reportedEntityCoverage.get(runId);
887
+ if (!coverageByType) {
888
+ coverageByType = new Map();
889
+ entry.reportedEntityCoverage.set(runId, coverageByType);
890
+ }
891
+ for (const targetType of matchedTargetTypes) {
892
+ const claimingRowCount = claimingRowCountByType.get(targetType) || 0;
893
+ const previouslyCovered = coverageByType.get(targetType) || 0;
894
+ coverageByType.set(targetType, Math.max(previouslyCovered, claimingRowCount));
895
+ }
896
+
897
+ // Journal -> summary direction: a targetEntityType with real folded CLAIMING rows but no summary
898
+ // key EVER naming it across this run's flushes (directly, or via `entityTypes`) is a counter the
899
+ // importer never reported. "Named" is re-checked against the journal's CURRENT cumulative
900
+ // claiming row count on every flush, not treated as a one-time permanent exemption -- an entity
901
+ // whose claiming row count has grown past what was covered the last time it was named is just as
902
+ // unreported, from this run's own summary, as one that was never named at all.
903
+ //
904
+ // A target type whose ONLY rows are e.g. `skipped_out_of_scope` has zero claiming rows, so
905
+ // `covered` (0, since `coverageByType` only ever accumulates claiming counts too) is never less
906
+ // than 0 and it is correctly never flagged -- it made no claim, so there is nothing to be missing.
907
+ const unmatchedJournalEntities = [];
908
+ for (const [targetType, claimingRowCount] of claimingRowCountByType) {
909
+ const covered = coverageByType.get(targetType) || 0;
910
+ if (covered < claimingRowCount) {
911
+ unmatchedJournalEntities.push(targetType);
912
+ anyMismatch = true;
913
+ }
914
+ }
915
+
916
+ let status;
917
+ let reason;
918
+ if (anyMismatch) {
919
+ status = 'mismatch';
920
+ } else if (anyUnresolved) {
921
+ status = 'unchecked';
922
+ reason = 'has_unresolved';
923
+ } else {
924
+ status = 'agrees';
925
+ }
926
+
927
+ return {
928
+ ...base,
929
+ status,
930
+ ...(reason ? { reason } : {}),
931
+ rowsRead: readResult.rows.length,
932
+ entities,
933
+ unmatched,
934
+ unmatchedJournalEntities,
935
+ };
936
+ }
937
+
938
+ // This is the PER-BATCH FLUSH POINT, not a recovery-only helper. An
939
+ // importer that holds its counters until the end loses them to any interruption, and a long
940
+ // import redirected to a temp file loses them to the shell. Call it after every batch with the
941
+ // run's own held counters -- never with figures re-derived from the append-only ledger, which
942
+ // folds dry-run rows, retried batches and recovery re-entries into the live total.
943
+ //
944
+ // Durable accounting, not liveness: heartbeat output belongs to `lib/progress-log.js`.
945
+ //
946
+ // When this flush names a run id (its own `options.runId`, else `summary.runId`), the
947
+ // write is also checked against that run's attempt-journal rows. The check never replaces a
948
+ // held counter and never throws for its own sake -- a wrong or uncheckable count is reported, not
949
+ // hidden, and the write still completes normally either way.
280
950
  async function writeLiveImportSummary(projectDir, summary, options = {}) {
281
951
  const before = await readJsonIfExists(liveImportSummaryPath(projectDir), null);
952
+ const effectiveRunId = options.runId || (summary && summary.runId) || null;
953
+ const coverageCheck = await computeCoverageCheck(projectDir, summary, options, effectiveRunId);
282
954
  const next = {
283
955
  schemaVersion: 1,
284
956
  generatedAt: new Date().toISOString(),
285
957
  ...(summary || {}),
958
+ coverageCheck,
286
959
  };
287
960
  await writeJsonAtomic(liveImportSummaryPath(projectDir), next);
961
+ if (options.runId) {
962
+ await appendExecutionLog(projectDir, {
963
+ runId: options.runId,
964
+ phase: options.phase || 'import',
965
+ event: 'batch_flush',
966
+ detail: options.detail || `accounting flushed after batch ${options.batchNumber === undefined ? '(unnumbered)' : options.batchNumber}`,
967
+ artifacts: ['execution/live-import-summary.json'],
968
+ });
969
+ }
970
+ if (effectiveRunId && coverageCheck.status === 'mismatch') {
971
+ await appendExecutionLog(projectDir, {
972
+ runId: effectiveRunId,
973
+ phase: options.phase || 'import',
974
+ event: 'coverage_mismatch',
975
+ detail: describeCoverageMismatch(coverageCheck),
976
+ artifacts: ['execution/live-import-summary.json'],
977
+ });
978
+ } else if (effectiveRunId && coverageCheck.status === 'unchecked') {
979
+ await appendExecutionLog(projectDir, {
980
+ runId: effectiveRunId,
981
+ phase: options.phase || 'import',
982
+ event: 'coverage_unchecked',
983
+ detail: `coverage check could not run (reason: ${coverageCheck.reason})`,
984
+ artifacts: ['execution/live-import-summary.json'],
985
+ });
986
+ }
288
987
  return {
289
988
  path: 'execution/live-import-summary.json',
290
989
  beforeExists: Boolean(before),
@@ -294,11 +993,95 @@ async function writeLiveImportSummary(projectDir, summary, options = {}) {
294
993
  failed: diffCounts(before && before.failed, next.failed),
295
994
  ...(options.extraChanges || {}),
296
995
  },
996
+ coverageCheck,
297
997
  };
298
998
  }
299
999
 
1000
+
1001
+ // ---------------------------------------------------------------------------
1002
+ // The generated importer declares its modes, and the gate checks them.
1003
+ //
1004
+ // Before this, the codegen skill ASKED for selective-recovery flags and nothing anywhere
1005
+ // verified that a generated importer honoured the instruction. A generated importer once
1006
+ // shipped that parsed no command-line arguments at all, exposed none of the modes,
1007
+ // and passed the import gate — a mandatory boundary that existed only as prose.
1008
+ // ---------------------------------------------------------------------------
1009
+
1010
+ const GENERATED_IMPORTER_CONTRACT_VERSION = 1;
1011
+
1012
+ const REQUIRED_SELECTION_MODES = [
1013
+ 'entity',
1014
+ 'source-type',
1015
+ 'missing-only',
1016
+ 'failed-only',
1017
+ 'deferred-only',
1018
+ 'unresolved-only',
1019
+ 'rerun',
1020
+ ];
1021
+
1022
+ // Project-relative, forward-slashed. These are the paths the shared helpers actually write, so
1023
+ // a descriptor that names something else describes an importer keeping a private ledger.
1024
+ const REQUIRED_LEDGER_PATHS = {
1025
+ attempts: 'state/attempts/write-attempts.ndjson',
1026
+ sampleAttempts: 'state/sample/attempts/write-attempts.ndjson',
1027
+ unresolved: 'execution/unresolved-writes.ndjson',
1028
+ recoveryLog: 'execution/recovery-log.json',
1029
+ };
1030
+
1031
+ // Throws naming EVERY missing mode and EVERY misplaced path at once. One error per run of the
1032
+ // gate would turn a codegen fix into a guessing game.
1033
+ function assertGeneratedImporterContract(descriptor) {
1034
+ const problems = [];
1035
+ if (!descriptor || typeof descriptor !== 'object' || Array.isArray(descriptor)) {
1036
+ throw new Error('generated importer contract: descriptor must be an object — an entrypoint that ignores --describe fails the gate, it never passes by default');
1037
+ }
1038
+ if (descriptor.contractVersion !== GENERATED_IMPORTER_CONTRACT_VERSION) {
1039
+ problems.push(`contractVersion must be ${GENERATED_IMPORTER_CONTRACT_VERSION}, got ${JSON.stringify(descriptor.contractVersion)}`);
1040
+ }
1041
+ if (descriptor.runIdSource !== 'process-start') {
1042
+ problems.push(`runIdSource must be "process-start", got ${JSON.stringify(descriptor.runIdSource)}`);
1043
+ }
1044
+ const modes = Array.isArray(descriptor.selectionModes) ? descriptor.selectionModes : null;
1045
+ if (!modes) {
1046
+ problems.push('selectionModes must be an array of mode names');
1047
+ } else {
1048
+ for (const mode of REQUIRED_SELECTION_MODES) {
1049
+ if (!modes.includes(mode)) {
1050
+ problems.push(`missing selection mode: ${mode}`);
1051
+ }
1052
+ }
1053
+ }
1054
+ const ledger = descriptor.ledger;
1055
+ if (!ledger || typeof ledger !== 'object' || Array.isArray(ledger)) {
1056
+ problems.push('ledger must be an object naming the durable artifact paths');
1057
+ } else {
1058
+ for (const [key, expected] of Object.entries(REQUIRED_LEDGER_PATHS)) {
1059
+ const actual = ledger[key];
1060
+ if (typeof actual !== 'string' || actual.replace(/\\/g, '/') !== expected) {
1061
+ problems.push(`ledger.${key} must be "${expected}", got ${JSON.stringify(actual)}`);
1062
+ }
1063
+ }
1064
+ // The vendoring escape hatch survives for the helper IMPLEMENTATIONS; it does not survive
1065
+ // for the entry contract, and an append-only ledger is part of that contract.
1066
+ if (ledger.appendOnly !== true) {
1067
+ problems.push('ledger.appendOnly must be true — a per-record log of what we wrote to a merchant store is only ever appended to');
1068
+ }
1069
+ }
1070
+ if (problems.length) {
1071
+ throw new Error(`generated importer contract violated:\n - ${problems.join('\n - ')}`);
1072
+ }
1073
+ return descriptor;
1074
+ }
1075
+
300
1076
  module.exports = {
301
1077
  RECOVERY_SCHEMA_VERSION,
1078
+ RECOVERY_MODES,
1079
+ DEFERRED_ATTEMPT_STATUSES,
1080
+ UNCERTAIN_ATTEMPT_STATUSES,
1081
+ GENERATED_IMPORTER_CONTRACT_VERSION,
1082
+ REQUIRED_SELECTION_MODES,
1083
+ REQUIRED_LEDGER_PATHS,
1084
+ assertGeneratedImporterContract,
302
1085
  recoveryLogPath,
303
1086
  liveImportSummaryPath,
304
1087
  normalizeSelectionFilters,
@@ -306,8 +1089,19 @@ module.exports = {
306
1089
  sourceStableKey,
307
1090
  selectImportRecords,
308
1091
  selectImportRecordsFromState,
1092
+ selectRerunRecords,
1093
+ selectRerunRecordsFromState,
309
1094
  normalizeRecoveryEntry,
1095
+ normalizeConflictDecisions,
1096
+ recoveryEntriesOf,
1097
+ loadConflictDecisions,
1098
+ latestConflictDecisionFor,
310
1099
  loadRecoveryLog,
311
1100
  appendRecoveryLogEntry,
312
1101
  writeLiveImportSummary,
1102
+ // Exported so `completion-report.js`'s operator-action text and `website-handoff.js`'s
1103
+ // rendering can describe the same disagreements the writer computed, without recomputing them.
1104
+ coverageDisagreements,
1105
+ describeCoverageMismatch,
1106
+ COVERAGE_JOURNAL_REL_PATH,
313
1107
  };