@buaa_smat/hometrans 26.0.3 → 26.0.4-devecocli.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (780) hide show
  1. package/agents/code-reviewer.md +91 -21
  2. package/devecocli-plugin/common.ts +2271 -0
  3. package/devecocli-plugin/content-resolver.ts +363 -0
  4. package/devecocli-plugin/install.ts +72 -0
  5. package/devecocli-plugin/uninstall.ts +26 -0
  6. package/devecocli-plugin/update.ts +77 -0
  7. package/i18n/agents/code-reviewer.md +93 -21
  8. package/i18n/skills/a2h-app-migrate/SKILL.md +19 -11
  9. package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -0
  10. package/i18n/skills/a2h-app-migrate/references/stage-map.md +2 -2
  11. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +320 -73
  12. package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
  13. package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
  14. package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
  15. package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
  16. package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
  17. package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
  18. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
  19. package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
  20. package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
  21. package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
  22. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
  23. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
  24. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
  25. package/i18n/skills/a2h-arch-generate/SKILL.md +20 -17
  26. package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
  27. package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
  28. package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +25 -14
  29. package/i18n/skills/a2h-arch-generate/references/source-baseline.md +4 -4
  30. package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
  31. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +304 -0
  32. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
  33. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
  34. package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +52 -11
  35. package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
  36. package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +245 -0
  37. package/i18n/skills/a2h-batch-ui-align/SKILL.md +70 -21
  38. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
  39. package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
  40. package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
  41. package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
  42. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
  43. package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
  44. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
  45. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
  46. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
  47. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
  48. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
  49. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +31 -0
  50. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +22 -6
  51. package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
  52. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
  53. package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
  54. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +386 -16
  55. package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
  56. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
  57. package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
  58. package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
  59. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
  60. package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
  61. package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
  62. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
  63. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
  64. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
  65. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
  66. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
  67. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
  68. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
  69. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
  70. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
  71. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
  72. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
  73. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
  74. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
  75. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
  76. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
  77. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
  78. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
  79. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
  80. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
  81. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
  82. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
  83. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
  84. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
  85. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
  86. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
  87. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
  88. package/i18n/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
  89. package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +133 -0
  90. package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
  91. package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
  92. package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
  93. package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
  94. package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
  95. package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +11 -9
  96. package/i18n/skills/a2h-module-semantic-docs/SKILL.md +51 -13
  97. package/i18n/skills/a2h-page-specgen/SKILL.md +123 -20
  98. package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
  99. package/i18n/skills/a2h-page-specgen/references/body-language.md +11 -9
  100. package/i18n/skills/a2h-page-specgen/references/gates.md +119 -52
  101. package/i18n/skills/a2h-page-specgen/references/page-inventory.md +69 -22
  102. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
  103. package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
  104. package/i18n/skills/a2h-page-specgen/references/spec-template.md +113 -110
  105. package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
  106. package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
  107. package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
  108. package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
  109. package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
  110. package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +171 -62
  111. package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +314 -192
  112. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +364 -76
  113. package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +216 -8
  114. package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
  115. package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -223
  116. package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
  117. package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +521 -13
  118. package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
  119. package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
  120. package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
  121. package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
  122. package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
  123. package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
  124. package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
  125. package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +483 -125
  126. package/i18n/skills/a2h-page-specgen/scripts/render.mjs +10 -33
  127. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
  128. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
  129. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
  130. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
  131. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
  132. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
  133. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
  134. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
  135. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
  136. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
  137. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
  138. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
  139. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
  140. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
  141. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
  142. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
  143. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
  144. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
  145. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
  146. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
  147. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
  148. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
  149. package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
  150. package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
  151. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
  152. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
  153. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
  154. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
  155. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
  156. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
  157. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
  158. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
  159. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
  160. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
  161. package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +134 -163
  162. package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
  163. package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
  164. package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +206 -9
  165. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
  166. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
  167. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
  168. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
  169. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
  170. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
  171. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
  172. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
  173. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
  174. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
  175. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
  176. package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
  177. package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
  178. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +862 -12
  179. package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
  180. package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
  181. package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
  182. package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
  183. package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
  184. package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
  185. package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
  186. package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
  187. package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
  188. package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
  189. package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
  190. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
  191. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
  192. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
  193. package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +166 -3
  194. package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
  195. package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
  196. package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
  197. package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
  198. package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +69 -44
  199. package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
  200. package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
  201. package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +658 -120
  202. package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
  203. package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
  204. package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
  205. package/i18n/skills/a2h-resource-convert/SKILL.md +9 -1
  206. package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
  207. package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
  208. package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
  209. package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
  210. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
  211. package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
  212. package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
  213. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +69 -109
  214. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +135 -37
  215. package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
  216. package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
  217. package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
  218. package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
  219. package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
  220. package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +24 -13
  221. package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
  222. package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +170 -7
  223. package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
  224. package/i18n/skills/a2h-spec-generate/SKILL.md +2 -2
  225. package/i18n/skills/a2h-utg-explorer/SKILL.md +9 -3
  226. package/i18n/skills/a2h-utg-explorer/references/architecture.md +3 -0
  227. package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +74 -84
  228. package/i18n/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
  229. package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
  230. package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
  231. package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +252 -0
  232. package/i18n/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
  233. package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
  234. package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
  235. package/i18n/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
  236. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
  237. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
  238. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +211 -61
  239. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
  240. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +724 -47
  241. package/i18n/skills/a2h-utg-static/SKILL.md +6 -2
  242. package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +82 -12
  243. package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
  244. package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
  245. package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
  246. package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
  247. package/i18n/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
  248. package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
  249. package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +50 -5
  250. package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
  251. package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
  252. package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
  253. package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
  254. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +17 -0
  255. package/i18n/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
  256. package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -0
  257. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
  258. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +181 -17
  259. package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
  260. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
  261. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +118 -19
  262. package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
  263. package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +113 -70
  264. package/index.js +1643 -0
  265. package/package.json +10 -13
  266. package/plugin.jsonc +12 -0
  267. package/skills/a2h-app-migrate/SKILL.md +19 -11
  268. package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
  269. package/skills/a2h-app-migrate/references/stage-map.md +2 -2
  270. package/skills/a2h-app-migrate/references/workflow.yaml +307 -74
  271. package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
  272. package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
  273. package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
  274. package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
  275. package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
  276. package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
  277. package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
  278. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
  279. package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
  280. package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
  281. package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
  282. package/skills/a2h-app-migrate/scripts/ledger.mjs +64 -6
  283. package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
  284. package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
  285. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +33 -9
  286. package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
  287. package/skills/a2h-app-migrate/scripts/run_dir.mjs +27 -17
  288. package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
  289. package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
  290. package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
  291. package/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
  292. package/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
  293. package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
  294. package/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
  295. package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +7 -7
  296. package/skills/a2h-app-migrate/test/test_incremental_acceptance.mjs +145 -0
  297. package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
  298. package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
  299. package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
  300. package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +10 -0
  301. package/skills/a2h-app-migrate/test/test_json_io.mjs +1 -1
  302. package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +39 -0
  303. package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
  304. package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +33 -0
  305. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
  306. package/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
  307. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
  308. package/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
  309. package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -0
  310. package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +13 -5
  311. package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
  312. package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
  313. package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +170 -3
  314. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
  315. package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
  316. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +12 -0
  317. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
  318. package/skills/a2h-arch-generate/SKILL.md +20 -17
  319. package/skills/a2h-arch-generate/references/homegraph-workflow.md +10 -8
  320. package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
  321. package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
  322. package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
  323. package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
  324. package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
  325. package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +17 -0
  326. package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +26 -0
  327. package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
  328. package/skills/a2h-arkts-logic-coder/SKILL.md +146 -17
  329. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
  330. package/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
  331. package/skills/a2h-arkts-logic-coder/references/spec-design.md +42 -11
  332. package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
  333. package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +244 -0
  334. package/skills/a2h-batch-ui-align/SKILL.md +72 -22
  335. package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
  336. package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
  337. package/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
  338. package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
  339. package/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
  340. package/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
  341. package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
  342. package/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
  343. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
  344. package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
  345. package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
  346. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
  347. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
  348. package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +30 -0
  349. package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
  350. package/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
  351. package/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
  352. package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
  353. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +380 -16
  354. package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
  355. package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
  356. package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
  357. package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
  358. package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +39 -5
  359. package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
  360. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
  361. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +213 -30
  362. package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
  363. package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
  364. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
  365. package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
  366. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
  367. package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
  368. package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
  369. package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
  370. package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
  371. package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
  372. package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
  373. package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
  374. package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
  375. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
  376. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +24 -0
  377. package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
  378. package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
  379. package/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
  380. package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
  381. package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
  382. package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
  383. package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
  384. package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
  385. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
  386. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
  387. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
  388. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
  389. package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
  390. package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
  391. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
  392. package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
  393. package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
  394. package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
  395. package/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
  396. package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
  397. package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
  398. package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
  399. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +24 -2
  400. package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +14 -0
  401. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_baseline.test.mjs +129 -0
  402. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_runtime2.test.mjs +697 -0
  403. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +298 -0
  404. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
  405. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
  406. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
  407. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +41 -7
  408. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +346 -0
  409. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme_runtime.test.mjs +95 -0
  410. package/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
  411. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +126 -0
  412. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +1 -0
  413. package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
  414. package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
  415. package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
  416. package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
  417. package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +19 -0
  418. package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +15 -0
  419. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
  420. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
  421. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
  422. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -0
  423. package/skills/a2h-batch-ui-align/scripts/tests/group_pack_evidence.test.mjs +95 -0
  424. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +155 -1
  425. package/skills/a2h-batch-ui-align/scripts/tests/icon_coverage.test.mjs +314 -0
  426. package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
  427. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
  428. package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
  429. package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
  430. package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
  431. package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +5 -0
  432. package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
  433. package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
  434. package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
  435. package/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
  436. package/skills/a2h-dashboard-render/test/test_device_locale_dialogs.mjs +17 -0
  437. package/skills/a2h-module-semantic-docs/SKILL.md +51 -13
  438. package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
  439. package/skills/a2h-module-semantic-docs/test/test_incremental_fingerprint.mjs +94 -0
  440. package/skills/a2h-page-specgen/SKILL.md +124 -20
  441. package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
  442. package/skills/a2h-page-specgen/references/body-language.md +11 -9
  443. package/skills/a2h-page-specgen/references/evidence.md +35 -0
  444. package/skills/a2h-page-specgen/references/execution-model.md +135 -26
  445. package/skills/a2h-page-specgen/references/footprint-and-grouping.md +20 -15
  446. package/skills/a2h-page-specgen/references/gates.md +120 -52
  447. package/skills/a2h-page-specgen/references/page-inventory.md +69 -22
  448. package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
  449. package/skills/a2h-page-specgen/references/spec-example.md +312 -0
  450. package/skills/a2h-page-specgen/references/spec-template.md +112 -109
  451. package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
  452. package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
  453. package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
  454. package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
  455. package/skills/a2h-page-specgen/scripts/dispatch.mjs +8 -5
  456. package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
  457. package/skills/a2h-page-specgen/scripts/facts-build.mjs +170 -61
  458. package/skills/a2h-page-specgen/scripts/finalize.mjs +466 -63
  459. package/skills/a2h-page-specgen/scripts/footprint.mjs +302 -180
  460. package/skills/a2h-page-specgen/scripts/gate.mjs +372 -82
  461. package/skills/a2h-page-specgen/scripts/interactions.mjs +215 -8
  462. package/skills/a2h-page-specgen/scripts/inventory.mjs +102 -0
  463. package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -216
  464. package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +105 -13
  465. package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
  466. package/skills/a2h-page-specgen/scripts/lib/hg.mjs +520 -12
  467. package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
  468. package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
  469. package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +129 -6
  470. package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
  471. package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
  472. package/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
  473. package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
  474. package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
  475. package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
  476. package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +106 -0
  477. package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
  478. package/skills/a2h-page-specgen/scripts/prepare.mjs +470 -122
  479. package/skills/a2h-page-specgen/scripts/render.mjs +11 -34
  480. package/skills/a2h-page-specgen/scripts/report.mjs +339 -6
  481. package/skills/a2h-page-specgen/scripts/submission.mjs +253 -88
  482. package/skills/a2h-page-specgen/scripts/submit.mjs +12 -6
  483. package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
  484. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
  485. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
  486. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
  487. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
  488. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
  489. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
  490. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
  491. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
  492. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
  493. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
  494. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
  495. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
  496. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
  497. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
  498. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
  499. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
  500. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
  501. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
  502. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
  503. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
  504. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
  505. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
  506. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
  507. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
  508. package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
  509. package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
  510. package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
  511. package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
  512. package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
  513. package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
  514. package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
  515. package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
  516. package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
  517. package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
  518. package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
  519. package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
  520. package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +135 -137
  521. package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
  522. package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
  523. package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +178 -9
  524. package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +19 -1
  525. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
  526. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
  527. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
  528. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
  529. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
  530. package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
  531. package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
  532. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -0
  533. package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshOnResume.java +7 -0
  534. package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
  535. package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
  536. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
  537. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
  538. package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
  539. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
  540. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
  541. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
  542. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
  543. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
  544. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
  545. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
  546. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
  547. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
  548. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
  549. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
  550. package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
  551. package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
  552. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +869 -13
  553. package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
  554. package/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
  555. package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
  556. package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
  557. package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
  558. package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
  559. package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
  560. package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
  561. package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
  562. package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
  563. package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +1 -1
  564. package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
  565. package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
  566. package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
  567. package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
  568. package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
  569. package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +42 -2
  570. package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
  571. package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +171 -3
  572. package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
  573. package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +365 -1
  574. package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
  575. package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
  576. package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
  577. package/skills/a2h-page-specgen/scripts/test/render.test.mjs +85 -42
  578. package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
  579. package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
  580. package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
  581. package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
  582. package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +645 -115
  583. package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
  584. package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
  585. package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
  586. package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +88 -74
  587. package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +30 -1
  588. package/skills/a2h-page-specgen/scripts/waker.mjs +79 -12
  589. package/skills/a2h-page-specgen/scripts/watchdog.mjs +18 -17
  590. package/skills/a2h-resource-convert/SKILL.md +9 -1
  591. package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
  592. package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
  593. package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
  594. package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
  595. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
  596. package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
  597. package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
  598. package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
  599. package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
  600. package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
  601. package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
  602. package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
  603. package/skills/a2h-resource-convert/scripts/tests/code_vector_guard.test.mjs +75 -0
  604. package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
  605. package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
  606. package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
  607. package/skills/a2h-spec-design-pipeline/SKILL.md +48 -72
  608. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +123 -37
  609. package/skills/a2h-spec-design-pipeline/references/execution-model.md +40 -8
  610. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +5 -4
  611. package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
  612. package/skills/a2h-spec-design-pipeline/references/initialization.md +37 -5
  613. package/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
  614. package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
  615. package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
  616. package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +7 -1
  617. package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
  618. package/skills/a2h-spec-design-pipeline/references/scripts.md +38 -14
  619. package/skills/a2h-spec-design-pipeline/references/shared-layer.md +127 -4
  620. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +90 -24
  621. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +65 -34
  622. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +11 -1
  623. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +10 -2
  624. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
  625. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
  626. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
  627. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
  628. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
  629. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
  630. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
  631. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
  632. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
  633. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
  634. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
  635. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
  636. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/{HttpExtraDataEmptyStringCheck.js → platform/ExtraDataSubCheck.js} +27 -30
  637. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +4 -2
  638. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +3 -2
  639. package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
  640. package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
  641. package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
  642. package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +55 -2
  643. package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +138 -7
  644. package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +10 -13
  645. package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +21 -2
  646. package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
  647. package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +32 -2
  648. package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +109 -13
  649. package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
  650. package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
  651. package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +12 -17
  652. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +172 -7
  653. package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +36 -16
  654. package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
  655. package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
  656. package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
  657. package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
  658. package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
  659. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +27 -3
  660. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +20 -7
  661. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +143 -13
  662. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +168 -7
  663. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +139 -2
  664. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +25 -0
  665. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
  666. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +37 -0
  667. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
  668. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
  669. package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +4 -5
  670. package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
  671. package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
  672. package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
  673. package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
  674. package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +59 -8
  675. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +44 -0
  676. package/skills/a2h-spec-generate/SKILL.md +2 -2
  677. package/skills/a2h-spec-generate/references/specs.schema.json +24 -11
  678. package/skills/a2h-spec-generate/scripts/ensure-index.mjs +1 -2
  679. package/skills/a2h-spec-generate/test/ensure-index.test.mjs +1 -2
  680. package/skills/a2h-utg-explorer/SKILL.md +9 -3
  681. package/skills/a2h-utg-explorer/references/architecture.md +3 -0
  682. package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
  683. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +56 -5
  684. package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
  685. package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
  686. package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
  687. package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
  688. package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
  689. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
  690. package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
  691. package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
  692. package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -0
  693. package/skills/a2h-utg-explorer/scripts/tests/default_override.test.mjs +109 -0
  694. package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -0
  695. package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +254 -0
  696. package/skills/a2h-utg-explorer/scripts/tests/foreground_spelling.test.mjs +155 -0
  697. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +120 -0
  698. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
  699. package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
  700. package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
  701. package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +218 -0
  702. package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -0
  703. package/skills/a2h-utg-explorer/scripts/tests/recover_d_grounding.test.mjs +164 -0
  704. package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -0
  705. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +6 -2
  706. package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -0
  707. package/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
  708. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +122 -4
  709. package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
  710. package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
  711. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +138 -4
  712. package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
  713. package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +22 -13
  714. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
  715. package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
  716. package/skills/a2h-utg-static/SKILL.md +6 -2
  717. package/skills/a2h-utg-static/scripts/assemble.mjs +65 -0
  718. package/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
  719. package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
  720. package/skills/a2h-utg-static/scripts/compose_overlay.mjs +8 -1
  721. package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
  722. package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
  723. package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
  724. package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
  725. package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
  726. package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
  727. package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
  728. package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
  729. package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
  730. package/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
  731. package/skills/a2h-utg-static/scripts/run_pipeline.mjs +86 -4
  732. package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +30 -0
  733. package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
  734. package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
  735. package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
  736. package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
  737. package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
  738. package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
  739. package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
  740. package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
  741. package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
  742. package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
  743. package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
  744. package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
  745. package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
  746. package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
  747. package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
  748. package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
  749. package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
  750. package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
  751. package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -1
  752. package/README.md +0 -440
  753. package/dist/cli/config-store.js +0 -128
  754. package/dist/cli/config.js +0 -48
  755. package/dist/cli/editors.json +0 -114
  756. package/dist/cli/env-vars.js +0 -127
  757. package/dist/cli/index.js +0 -76
  758. package/dist/cli/init.js +0 -2618
  759. package/dist/cli/uninstall.js +0 -406
  760. package/dist/platform/compose.js +0 -228
  761. package/dist/platform/frontmatter.js +0 -151
  762. package/dist/platform/installer.js +0 -417
  763. package/dist/platform/language.js +0 -77
  764. package/dist/platform/registry.js +0 -337
  765. package/dist/platform/transform.js +0 -363
  766. package/dist/platform/types.js +0 -9
  767. package/dist/platform/validate.js +0 -152
  768. package/dist/utils/regex.js +0 -7
  769. package/env-requirements.json +0 -536
  770. package/resource/choose_editor.png +0 -0
  771. package/resource/convert_pipeline_process.svg +0 -114
  772. package/resource/project_architecture.svg +0 -120
  773. package/resource/set_environment.png +0 -0
  774. package/resource/set_multimodel.png +0 -0
  775. package/resource/set_sdk.png +0 -0
  776. package/resource/title_dark.png +0 -0
  777. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +0 -55
  778. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +0 -60
  779. package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +0 -948
  780. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +0 -1014
@@ -0,0 +1,1234 @@
1
+ // English mirror: the same neutral behavior contracts as the shared suite,
2
+ // written against the English gate, prompts, and word-count limits. Draft bodies
3
+ // and the one inline page fixture are English; behavior fields stay neutral.
4
+ import assert from "node:assert/strict";
5
+ import crypto from "node:crypto";
6
+ import fs from "node:fs";
7
+ import os from "node:os";
8
+ import path from "node:path";
9
+ import test from "node:test";
10
+ import { spawnSync } from "node:child_process";
11
+ import { fileURLToPath } from "node:url";
12
+ import { evaluatePreAudit, runPreAudit } from "../behavior-audit.mjs";
13
+ import { enrichBehaviorEvidence, writeBehaviorEvidence } from "../behavior-discovery.mjs";
14
+ import { assertionIdentity, stableDigest, BEHAVIOR_SCHEMA_VERSION } from "../behavior-model.mjs";
15
+ import { listFilesRecursively, readJson, writeJsonAtomic } from "../lib/fsx.mjs";
16
+ import { stemOf } from "../render.mjs";
17
+ import { behaviorAssertion, completedSourceReview, makeBehaviorPlan, plannedSpecified, recordedSnapshot, withBehaviorSnapshot, writeAlphaSource } from "./behavior-fixtures.mjs";
18
+
19
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), "behavior-pre-"));
20
+ const { unit, reference, currentSnapshot, snapshotHistory } = writeAlphaSource(root);
21
+ function validDiscovery() {
22
+ const assertion = { ...behaviorAssertion(), evidence_refs: [reference] };
23
+ Object.assign(assertion, assertionIdentity(assertion));
24
+ return {
25
+ page_id: "page:Alpha",
26
+ attempt: 1,
27
+ source_units: [unit],
28
+ source_unit_reviews: [completedSourceReview(unit, [assertion.id])],
29
+ assertions: [assertion], unknowns: [], planned: [plannedSpecified(assertion)],
30
+ evidence_reviews: [{ assertion_id: assertion.id, status: "supported" }],
31
+ };
32
+ }
33
+ function validEvidence() {
34
+ const discovery = validDiscovery();
35
+ return withBehaviorSnapshot({
36
+ ...discovery,
37
+ sourceProject: root,
38
+ inventory_status: "closed",
39
+ composition_roots: ["src/alpha.js"],
40
+ candidates: [],
41
+ current_snapshot: currentSnapshot,
42
+ snapshot_history: snapshotHistory,
43
+ unresolved_references: [],
44
+ });
45
+ }
46
+ function auditWith(mutate) {
47
+ const discovery = validDiscovery();
48
+ const evidence = validEvidence();
49
+ mutate(discovery, evidence);
50
+ const anchoredEvidence = withBehaviorSnapshot(evidence);
51
+ return evaluatePreAudit({ plan: makeBehaviorPlan(anchoredEvidence, []), evidence: anchoredEvidence, discovery, sourceProject: root });
52
+ }
53
+
54
+ test("completed pre-audit allows related discovery unknowns without calling them passes", () => {
55
+ const result = auditWith(discovery => {
56
+ discovery.unknowns.push({
57
+ id: "unk_alpha", reason: "unsupported-construct", source_unit_ids: [unit.id],
58
+ scope: "assertion", affected_assertion_id: discovery.assertions[0].id, affected_fields: ["outcomes"],
59
+ evidence_refs: [reference], relevance_review: { status: "reviewed", conclusion: "blocks-fields" },
60
+ next_action: "Review the unsupported source region",
61
+ });
62
+ discovery.planned = [{ assertion_id: discovery.assertions[0].id, status: "unknown", unknown_ids: ["unk_alpha"], review_status: "reviewed" }];
63
+ discovery.evidence_reviews[0].status = "insufficient";
64
+ });
65
+ assert.equal(result.status, "completed");
66
+ assert.equal(result.coverage_status, "partial");
67
+ assert.equal(result.unknowns.length, 1);
68
+ assert.deepEqual(result.failures, []);
69
+ });
70
+
71
+ test("re-anchored entry unknowns are valid evidence for the pre-audit", () => {
72
+ const entryUnknown = evidence_refs => ({
73
+ id: "unk_entry",
74
+ scope: "behavior",
75
+ page_id: "page:Alpha",
76
+ reason: "review-incomplete",
77
+ cause: "wrapper-call-not-found",
78
+ affected_fields: ["trigger"],
79
+ candidate_ids: [],
80
+ source_unit_ids: [unit.id],
81
+ evidence_refs,
82
+ relevance_review: { status: "reviewed", conclusion: "blocks-fields" },
83
+ next_action: "Inspect the wrapper call",
84
+ });
85
+ const anchored = auditWith((discovery, evidence) => {
86
+ evidence.unknowns = [entryUnknown([reference])];
87
+ });
88
+ assert.deepEqual(anchored.failures, []);
89
+
90
+ const bare = { ...reference };
91
+ delete bare.snapshot_digest;
92
+ delete bare.profile_id;
93
+ const unanchored = auditWith((discovery, evidence) => {
94
+ evidence.unknowns = [entryUnknown([bare])];
95
+ });
96
+ assert.ok(unanchored.failures.some(failure =>
97
+ failure.code === "unknown-evidence-invalid" && /unrecorded-evidence-snapshot/.test(failure.message)),
98
+ "an unanchored reference must still fail closed");
99
+ });
100
+
101
+ test("invalid evidence, conflict, unrelated unknown, and supported-plus-unknown are hard failures", () => {
102
+ const mutations = [
103
+ discovery => { discovery.assertions[0].evidence_refs = []; },
104
+ discovery => {
105
+ const other = { ...discovery.assertions[0], outcomes: [{ kind: "visible-change", description: "A conflicting result" }] };
106
+ Object.assign(other, assertionIdentity(other));
107
+ discovery.assertions.push(other);
108
+ discovery.planned.push(plannedSpecified(other));
109
+ },
110
+ discovery => {
111
+ discovery.unknowns.push({
112
+ id: "unk_other", reason: "source-unread", source_unit_ids: ["su_other"],
113
+ scope: "assertion", affected_assertion_id: discovery.assertions[0].id, affected_fields: ["outcomes"],
114
+ evidence_refs: [reference], relevance_review: { status: "reviewed", conclusion: "blocks-fields" },
115
+ next_action: "Read another source",
116
+ });
117
+ discovery.planned = [{ assertion_id: discovery.assertions[0].id, status: "unknown", unknown_ids: ["unk_other"], review_status: "reviewed" }];
118
+ discovery.evidence_reviews[0].status = "insufficient";
119
+ },
120
+ discovery => {
121
+ discovery.unknowns.push({
122
+ id: "unk_supported", reason: "unsupported-construct", source_unit_ids: [unit.id],
123
+ scope: "assertion", affected_assertion_id: discovery.assertions[0].id, affected_fields: ["outcomes"],
124
+ evidence_refs: [reference], relevance_review: { status: "reviewed", conclusion: "blocks-fields" },
125
+ next_action: "Review the unsupported source region",
126
+ });
127
+ discovery.planned = [{ assertion_id: discovery.assertions[0].id, status: "unknown", unknown_ids: ["unk_supported"], review_status: "reviewed" }];
128
+ },
129
+ ];
130
+ for (const mutate of mutations) {
131
+ const result = auditWith(mutate);
132
+ assert.equal(result.status, "failed");
133
+ assert.ok(result.failures.length > 0);
134
+ }
135
+ });
136
+
137
+ test("deleting an immutable assertion or forging closed inventory is a hard failure", () => {
138
+ const deleted = auditWith(discovery => {
139
+ discovery.assertions = [];
140
+ discovery.planned = [];
141
+ discovery.evidence_reviews = [];
142
+ });
143
+ assert.equal(deleted.status, "failed");
144
+ const forged = auditWith((discovery, evidence) => {
145
+ evidence.inventory_status = "partial";
146
+ evidence.unresolved_references.push({ referring_file: "src/host.js", locator: "src/missing.js" });
147
+ discovery.inventory_status = "closed";
148
+ });
149
+ assert.equal(forged.status, "failed");
150
+ });
151
+
152
+ test("reviewed zero-behavior SourceUnits resolve without inventing assertions", () => {
153
+ const evidence = withBehaviorSnapshot(enrichBehaviorEvidence({
154
+ pages: [{ page_id: "page:Alpha", declared_at: "src/alpha.js", source_origins: [], out_edges: [], widgets: [] }],
155
+ footprint: new Map([["page:Alpha", {
156
+ all: new Set(["src/alpha.js"]), writable: new Set(), resolvedFile: "src/alpha.js", origin_units: [], unresolved: [],
157
+ }]]),
158
+ sourceProject: root,
159
+ }).get("page:Alpha"));
160
+ const discovery = {
161
+ ...evidence,
162
+ source_unit_reviews: evidence.source_units.map(unit => completedSourceReview(unit, [])),
163
+ resolutions: evidence.unknowns.filter(unknown => unknown.reason === "review-incomplete").map(unknown => ({
164
+ unknown_id: unknown.id,
165
+ status: "no-assertions-found",
166
+ source_unit_id: unknown.source_unit_ids[0],
167
+ reviewed_digest: evidence.current_snapshot.source_units[0].content_digest,
168
+ review_status: "reviewed",
169
+ evidence_refs: [],
170
+ assertion_ids: [],
171
+ })),
172
+ };
173
+ const result = evaluatePreAudit({ plan: makeBehaviorPlan(evidence), evidence, discovery, sourceProject: root });
174
+ assert.equal(result.status, "completed");
175
+ assert.equal(result.coverage_status, "complete");
176
+ assert.deepEqual(result.dispositions, []);
177
+ });
178
+
179
+ test("required evidence units do not owe target-page interaction scan records", () => {
180
+ fs.writeFileSync(path.join(root, "src", "producer.js"), "export const producer = 1;\n");
181
+ const page = {
182
+ page_id: "page:Alpha", declared_at: "src/alpha.js", source_origins: [], out_edges: [], widgets: [],
183
+ };
184
+ const produced = enrichBehaviorEvidence({
185
+ pages: [page],
186
+ footprint: new Map([["page:Alpha", {
187
+ all: new Set(["src/alpha.js", "src/producer.js"]), writable: new Set(), resolvedFile: "src/alpha.js",
188
+ origin_units: [], unresolved: [],
189
+ }]]),
190
+ entryEvidence: new Map([["page:Alpha", {
191
+ candidates: [], requiredLocators: ["src/producer.js"], unknowns: [], outbound: [],
192
+ }]]),
193
+ sourceProject: root,
194
+ }).get("page:Alpha");
195
+ produced.interaction_scans = produced.interaction_scans.filter(scan => scan.locator !== "src/producer.js");
196
+ const evidence = withBehaviorSnapshot(produced);
197
+ const discovery = {
198
+ ...evidence,
199
+ source_unit_reviews: evidence.source_units.map(sourceUnit => completedSourceReview(sourceUnit, [])),
200
+ };
201
+ const result = evaluatePreAudit({
202
+ plan: makeBehaviorPlan(evidence), evidence, discovery, sourceProject: root,
203
+ });
204
+ assert.equal(result.status, "completed");
205
+ assert.equal(result.unknowns.some(unknown => unknown.code === "interaction-scan-missing"), false);
206
+ });
207
+
208
+ test("a missing persisted interaction scan is incomplete while forged or duplicate scan state fails", () => {
209
+ const missingScanRecord = auditWith((discovery, evidence) => {
210
+ evidence.interaction_scans = [];
211
+ });
212
+ const duplicateScanRecord = auditWith((discovery, evidence) => {
213
+ evidence.interaction_scans.push({ ...evidence.interaction_scans[0] });
214
+ });
215
+ const unknownScanRecord = auditWith((discovery, evidence) => {
216
+ evidence.interaction_scans.push({ ...evidence.interaction_scans[0], source_unit_id: "su_other" });
217
+ });
218
+ const locatorConflict = auditWith((discovery, evidence) => {
219
+ evidence.interaction_scans[0].locator = "src/other.js";
220
+ });
221
+ const forgedSignalCount = auditWith((discovery, evidence) => {
222
+ evidence.interaction_scans[0].signal_count += 1;
223
+ });
224
+ assert.equal(missingScanRecord.status, "incomplete");
225
+ assert.equal(missingScanRecord.coverage_status, "partial");
226
+ assert.ok(duplicateScanRecord.failures.some(f => f.code === "interaction-scan-duplicate"));
227
+ assert.ok(unknownScanRecord.failures.some(f => f.code === "interaction-scan-unknown"));
228
+ assert.ok(locatorConflict.failures.some(f => f.code === "interaction-scan-locator"));
229
+ assert.ok(forgedSignalCount.failures.some(f => f.code === "interaction-scan-count"));
230
+
231
+ const noPlanAggregate = validEvidence();
232
+ const plan = makeBehaviorPlan(noPlanAggregate);
233
+ delete plan.pages[0].interactions;
234
+ const missingPlan = evaluatePreAudit({
235
+ plan, evidence: noPlanAggregate, discovery: validDiscovery(), sourceProject: root,
236
+ });
237
+ assert.equal(missingPlan.status, "failed");
238
+ assert.ok(missingPlan.failures.some(f => f.code === "interaction-scan-plan"));
239
+ });
240
+
241
+ function lifecycleTruncationUnknown() {
242
+ return {
243
+ id: "unk_lifecycle_truncated_alpha",
244
+ scope: "lifecycle",
245
+ reason: "lifecycle-review-incomplete",
246
+ cause: "truncated",
247
+ source_unit_id: unit.id,
248
+ locator: unit.locator,
249
+ next_action: "Review the full truncated SourceUnit and write an explicit resolution",
250
+ };
251
+ }
252
+
253
+ test("a missing or forged lifecycle scan record is unfinished work or a hard failure", () => {
254
+ const missingScanRecord = auditWith((discovery, evidence) => {
255
+ evidence.lifecycle_scans = [];
256
+ });
257
+ assert.equal(missingScanRecord.status, "incomplete");
258
+ assert.equal(missingScanRecord.coverage_status, "partial");
259
+ assert.ok(missingScanRecord.unknowns.some(unknown =>
260
+ unknown.code === "lifecycle-scan-missing" && unknown.reason === "lifecycle-review-incomplete"));
261
+
262
+ const duplicateScanRecord = auditWith((discovery, evidence) => {
263
+ evidence.lifecycle_scans.push({ ...evidence.lifecycle_scans[0] });
264
+ });
265
+ const unknownScanRecord = auditWith((discovery, evidence) => {
266
+ evidence.lifecycle_scans.push({ ...evidence.lifecycle_scans[0], source_unit_id: "su_other" });
267
+ });
268
+ const locatorConflict = auditWith((discovery, evidence) => {
269
+ evidence.lifecycle_scans[0].locator = "src/other.js";
270
+ });
271
+ const badStatus = auditWith((discovery, evidence) => {
272
+ evidence.lifecycle_scans[0].status = "started";
273
+ });
274
+ const malformedTruncatedFlag = auditWith((discovery, evidence) => {
275
+ evidence.lifecycle_scans[0].truncated = "yes";
276
+ });
277
+ assert.ok(duplicateScanRecord.failures.some(f => f.code === "lifecycle-scan-duplicate"));
278
+ assert.ok(unknownScanRecord.failures.some(f => f.code === "lifecycle-scan-unknown"));
279
+ assert.ok(locatorConflict.failures.some(f => f.code === "lifecycle-scan-locator"));
280
+ assert.ok(badStatus.failures.some(f => f.code === "lifecycle-scan-status"));
281
+ assert.ok(malformedTruncatedFlag.failures.some(f => f.code === "lifecycle-scan-truncated"));
282
+ });
283
+
284
+ test("a lifecycle truncation is declared only by its own unknown, never the interaction one", () => {
285
+ // Legal declaration: the record stays non-failing but the page is incomplete
286
+ // until the unknown is explicitly resolved.
287
+ const declared = auditWith((discovery, evidence) => {
288
+ evidence.lifecycle_scans[0].truncated = true;
289
+ const unknown = lifecycleTruncationUnknown();
290
+ evidence.unknowns.push(unknown);
291
+ discovery.unknowns.push(unknown);
292
+ });
293
+ assert.ok(!declared.failures.some(f => f.code === "lifecycle-scan-truncated"));
294
+ assert.equal(declared.status, "incomplete");
295
+ assert.equal(declared.coverage_status, "partial");
296
+
297
+ // An interaction truncation unknown does not declare a lifecycle truncation.
298
+ const crossMasked = auditWith((discovery, evidence) => {
299
+ evidence.lifecycle_scans[0].truncated = true;
300
+ const unknown = truncatedInteractionUnknown();
301
+ evidence.unknowns.push(unknown);
302
+ discovery.unknowns.push(unknown);
303
+ });
304
+ assert.ok(crossMasked.failures.some(f => f.code === "lifecycle-scan-truncated"));
305
+
306
+ // The reverse holds too: a lifecycle unknown does not legalize an
307
+ // interaction truncation — each axis declares its own truncations.
308
+ const reverseMasked = auditWith((discovery, evidence) => {
309
+ evidence.interaction_scans = [truncatedScanRecord()];
310
+ const unknown = lifecycleTruncationUnknown();
311
+ evidence.unknowns.push(unknown);
312
+ discovery.unknowns.push(unknown);
313
+ });
314
+ assert.ok(reverseMasked.failures.some(f => f.code === "interaction-scan-truncated"));
315
+ });
316
+
317
+ function truncatedInteractionUnknown() {
318
+ return {
319
+ id: "unk_truncated_alpha",
320
+ scope: "interaction",
321
+ reason: "review-incomplete",
322
+ cause: "truncated",
323
+ source_unit_id: unit.id,
324
+ locator: unit.locator,
325
+ next_action: "Review the full truncated SourceUnit and write an explicit resolution",
326
+ };
327
+ }
328
+
329
+ function truncatedScanRecord() {
330
+ return {
331
+ source_unit_id: unit.id, locator: unit.locator,
332
+ status: "ok", signal_count: 0, truncated: true,
333
+ };
334
+ }
335
+
336
+ function assertionTruncation(mutate = () => {}) {
337
+ return auditWith((discovery, evidence) => {
338
+ const unknown = truncatedInteractionUnknown();
339
+ evidence.interaction_scans = [truncatedScanRecord()];
340
+ evidence.unknowns.push(unknown);
341
+ discovery.unknowns.push(unknown);
342
+ const resolution = {
343
+ unknown_id: unknown.id, status: "resolved",
344
+ source_unit_id: unit.id, reviewed_digest: unit.content_digest,
345
+ evidence_refs: [reference],
346
+ assertion_ids: [discovery.assertions[0].id], review_status: "reviewed",
347
+ };
348
+ discovery.resolutions = [resolution];
349
+ mutate({ discovery, evidence, resolution, unknown });
350
+ });
351
+ }
352
+
353
+ function zeroAssertionTruncation(mutate = () => {}) {
354
+ const unknown = truncatedInteractionUnknown();
355
+ const discovery = {
356
+ page_id: "page:Alpha", attempt: 1, source_units: [unit],
357
+ source_unit_reviews: [completedSourceReview(unit, [])],
358
+ assertions: [], unknowns: [unknown], planned: [], evidence_reviews: [],
359
+ resolutions: [{
360
+ unknown_id: unknown.id, status: "resolved",
361
+ source_unit_id: unit.id, reviewed_digest: unit.content_digest,
362
+ evidence_refs: [reference], assertion_ids: [], review_status: "reviewed",
363
+ }],
364
+ };
365
+ const evidence = withBehaviorSnapshot({
366
+ ...discovery,
367
+ sourceProject: root, inventory_status: "closed",
368
+ composition_roots: ["src/alpha.js"], candidates: [],
369
+ current_snapshot: currentSnapshot, snapshot_history: snapshotHistory,
370
+ unresolved_references: [], interaction_scans: [truncatedScanRecord()],
371
+ });
372
+ mutate({ discovery, evidence, resolution: discovery.resolutions[0], unknown });
373
+ const anchored = withBehaviorSnapshot(evidence);
374
+ return evaluatePreAudit({
375
+ plan: makeBehaviorPlan(anchored), evidence: anchored, discovery, sourceProject: root,
376
+ });
377
+ }
378
+
379
+ test("a completed truncation resolution closes an interaction scan in a zero-assertion review", () => {
380
+ const closed = zeroAssertionTruncation();
381
+ assert.equal(closed.status, "completed");
382
+ assert.equal(closed.coverage_status, "complete");
383
+ assert.deepEqual(closed.unknowns, []);
384
+
385
+ const missing = zeroAssertionTruncation(({ discovery }) => { delete discovery.resolutions; });
386
+ assert.equal(missing.status, "incomplete");
387
+ assert.equal(missing.coverage_status, "partial");
388
+ assert.ok(missing.unknowns.some(entry => entry.id === "unk_truncated_alpha"));
389
+
390
+ const staleDigest = zeroAssertionTruncation(({ resolution }) => { resolution.reviewed_digest = "bad-digest"; });
391
+ assert.equal(staleDigest.status, "incomplete");
392
+ assert.equal(staleDigest.coverage_status, "partial");
393
+ assert.ok(staleDigest.unknowns.some(entry => entry.id === "unk_truncated_alpha"));
394
+
395
+ const forgedIdentity = zeroAssertionTruncation(({ resolution }) => { resolution.source_unit_id = "su_other"; });
396
+ assert.equal(forgedIdentity.status, "failed");
397
+ assert.ok(forgedIdentity.failures.some(failure => failure.code === "resolution-identity"));
398
+ });
399
+
400
+ test("a truncation resolution closes only a review whose assertion set matches", () => {
401
+ const closed = assertionTruncation();
402
+ assert.equal(closed.status, "completed");
403
+ assert.equal(closed.coverage_status, "complete");
404
+
405
+ const emptyAttribution = assertionTruncation(({ resolution }) => { resolution.assertion_ids = []; });
406
+ assert.equal(emptyAttribution.status, "failed");
407
+ assert.ok(emptyAttribution.failures.some(failure => failure.code === "resolution-assertions"));
408
+
409
+ const forgedAttribution = assertionTruncation(({ discovery, resolution }) => {
410
+ resolution.assertion_ids = [discovery.assertions[0].id, "ba_not_real"];
411
+ });
412
+ assert.equal(forgedAttribution.status, "failed");
413
+ assert.ok(forgedAttribution.failures.some(failure => failure.code === "resolution-assertions"));
414
+ });
415
+
416
+ test("a truncation resolution needs every attributed candidate lawfully closed", () => {
417
+ const candidate = () => ({
418
+ candidate_id: "cand_truncated", evidence_refs: [reference], review_status: "pending",
419
+ });
420
+
421
+ const open = zeroAssertionTruncation(({ discovery, evidence, unknown }) => {
422
+ evidence.candidates.push(candidate());
423
+ discovery.candidate_reviews = [{ candidate_id: "cand_truncated", status: "pending" }];
424
+ assert.equal(unknown.id, "unk_truncated_alpha");
425
+ });
426
+ assert.equal(open.status, "incomplete");
427
+ assert.equal(open.coverage_status, "partial");
428
+ assert.ok(open.unknowns.some(entry => entry.id === "unk_truncated_alpha"));
429
+
430
+ const waived = zeroAssertionTruncation(({ discovery, evidence }) => {
431
+ evidence.candidates.push(candidate());
432
+ discovery.candidate_reviews = [{ candidate_id: "cand_truncated", status: "refuted" }];
433
+ discovery.candidate_dispositions = [{
434
+ candidate_id: "cand_truncated", status: "waived", reason: "no-user-observable",
435
+ evidence_refs: [reference], review_status: "reviewed",
436
+ }];
437
+ });
438
+ assert.equal(waived.status, "completed");
439
+ assert.equal(waived.coverage_status, "complete");
440
+ assert.deepEqual(waived.unknowns, []);
441
+ });
442
+
443
+ test("missing, duplicate, extra, or stale-digest SourceUnit reviews fail reconciliation", () => {
444
+ const missing = auditWith(discovery => { discovery.source_unit_reviews = []; });
445
+ assert.equal(missing.status, "incomplete");
446
+ assert.equal(missing.coverage_status, "partial");
447
+ assert.deepEqual(missing.failures, []);
448
+
449
+ const mutations = [
450
+ discovery => { discovery.source_unit_reviews.push(discovery.source_unit_reviews[0]); },
451
+ discovery => { discovery.source_unit_reviews.push(completedSourceReview({ ...unit, id: "su_extra" }, [])); },
452
+ discovery => { discovery.source_unit_reviews[0].reviewed_digest = "old-digest"; },
453
+ ];
454
+ for (const mutate of mutations) assert.equal(auditWith(mutate).status, "failed");
455
+ });
456
+
457
+ test("a trigger-only candidate can be refuted and legally waived", () => {
458
+ const result = auditWith((discovery, evidence) => {
459
+ const candidate = {
460
+ candidate_id: "cand_alpha",
461
+ subject: { page_id: "page:Alpha", region_id: "region:Primary" },
462
+ trigger: { verb: "activate", target: "Primary action" },
463
+ evidence_refs: [reference], review_status: "pending",
464
+ };
465
+ evidence.candidates.push(candidate);
466
+ discovery.candidate_reviews = [{ candidate_id: candidate.candidate_id, status: "refuted" }];
467
+ discovery.candidate_dispositions = [{
468
+ candidate_id: candidate.candidate_id, status: "waived", reason: "no-user-observable",
469
+ evidence_refs: [reference], review_status: "reviewed",
470
+ }];
471
+ });
472
+ assert.equal(result.status, "completed");
473
+ assert.deepEqual(result.failures, []);
474
+ });
475
+
476
+ test("candidate and planned waiver evidence must be current and valid", () => {
477
+ const sourcePath = path.join(root, "src", "alpha.js");
478
+ const originalSource = fs.readFileSync(sourcePath);
479
+ const historical = recordedSnapshot("static-source-v0", [
480
+ { ...unit, content_digest: "recorded-old-content" },
481
+ ]);
482
+ const staleReference = {
483
+ ...reference, profile_id: historical.profile_id, snapshot_digest: historical.snapshot_digest,
484
+ };
485
+ const cases = [
486
+ {
487
+ name: "stale",
488
+ apply: (discovery, evidence) => {
489
+ evidence.snapshot_history.push(historical);
490
+ return staleReference;
491
+ },
492
+ },
493
+ {
494
+ name: "source-changed",
495
+ apply: () => {
496
+ fs.writeFileSync(sourcePath, "export const alpha = 'changed';\n");
497
+ return reference;
498
+ },
499
+ },
500
+ {
501
+ name: "source-unread",
502
+ apply: (discovery, evidence) => {
503
+ const unread = { ...unit, read_status: "unread" };
504
+ evidence.current_snapshot = { ...evidence.current_snapshot, source_units: [unread] };
505
+ evidence.source_units = [unread];
506
+ return reference;
507
+ },
508
+ },
509
+ {
510
+ name: "invalid",
511
+ apply: () => ({ ...reference, span: { start: 0, end: 1 } }),
512
+ },
513
+ ];
514
+
515
+ for (const { name, apply } of cases) {
516
+ const candidateResult = auditWith((discovery, evidence) => {
517
+ const candidate = {
518
+ candidate_id: `cand_${name.replace(/-/g, "_")}`,
519
+ subject: { page_id: "page:Alpha", region_id: "region:Secondary" },
520
+ trigger: { verb: "activate", target: "Secondary action" },
521
+ evidence_refs: [reference], review_status: "pending",
522
+ };
523
+ evidence.candidates.push(candidate);
524
+ discovery.candidate_reviews = [{ candidate_id: candidate.candidate_id, status: "refuted" }];
525
+ discovery.candidate_dispositions = [{
526
+ candidate_id: candidate.candidate_id, status: "waived", reason: "no-user-observable",
527
+ evidence_refs: [apply(discovery, evidence)], review_status: "reviewed",
528
+ }];
529
+ });
530
+ assert.equal(candidateResult.status, "failed", `candidate ${name} waiver must fail`);
531
+ assert.ok(candidateResult.failures.some(failure =>
532
+ failure.code === "waiver-evidence-invalid"), `candidate ${name} waiver failure`);
533
+
534
+ const plannedResult = auditWith((discovery, evidence) => {
535
+ discovery.planned = [{
536
+ assertion_id: discovery.assertions[0].id, status: "no-user-observable",
537
+ evidence_refs: [apply(discovery, evidence)], review_status: "reviewed",
538
+ }];
539
+ discovery.evidence_reviews[0].status = "refuted";
540
+ });
541
+ assert.equal(plannedResult.status, "failed", `planned ${name} waiver must fail`);
542
+ assert.ok(plannedResult.failures.some(failure =>
543
+ failure.code === "waiver-evidence-invalid"), `planned ${name} waiver failure`);
544
+ fs.writeFileSync(sourcePath, originalSource);
545
+ }
546
+ });
547
+
548
+ test("a terminal evidence review without a planned disposition is a hard failure", () => {
549
+ const result = auditWith(discovery => {
550
+ discovery.planned = [];
551
+ });
552
+ assert.equal(result.status, "failed");
553
+ assert.ok(result.failures.some(failure => failure.code === "planned-missing"));
554
+ });
555
+
556
+ test("a composition review-incomplete unknown keeps pre-audit coverage partial", () => {
557
+ const unknown = {
558
+ id: "unk_composition_review", scope: "composition", reason: "review-incomplete",
559
+ source_unit_ids: [unit.id], referring_file: "src/alpha.js", locator: "src/missing.js",
560
+ relevance_review: { status: "reviewed", conclusion: "blocks-composition" },
561
+ next_action: "Resolve the missing composition reference",
562
+ };
563
+ const result = auditWith((discovery, evidence) => {
564
+ evidence.unknowns.push(unknown);
565
+ discovery.unknowns.push(unknown);
566
+ });
567
+ assert.equal(result.status, "completed");
568
+ assert.equal(result.coverage_status, "partial");
569
+ assert.ok(result.unknowns.some(entry => entry.id === unknown.id));
570
+ });
571
+
572
+ test("a pending candidate review is incomplete rather than a waiver or pass", () => {
573
+ const result = auditWith((discovery, evidence) => {
574
+ evidence.candidates.push({ candidate_id: "cand_pending", evidence_refs: [reference], review_status: "pending" });
575
+ discovery.candidate_reviews = [{ candidate_id: "cand_pending", status: "pending" }];
576
+ });
577
+ assert.equal(result.status, "incomplete");
578
+ });
579
+
580
+ test("new current evidence resolves an initial stale unknown", () => {
581
+ const result = auditWith((discovery, evidence) => {
582
+ const historical = recordedSnapshot("static-source-v0", [
583
+ { ...unit, content_digest: "recorded-old-content" },
584
+ ]);
585
+ evidence.snapshot_history.push(historical);
586
+ evidence.assertions[0].evidence_refs = [{
587
+ ...reference, profile_id: historical.profile_id, snapshot_digest: historical.snapshot_digest,
588
+ }];
589
+ evidence.unknowns.push({ id: "unk_stale", reason: "stale-evidence", source_unit_ids: [unit.id], next_action: "Read current source" });
590
+ discovery.resolutions = [{
591
+ unknown_id: "unk_stale", status: "resolved", evidence_refs: [reference], assertion_ids: [discovery.assertions[0].id],
592
+ }];
593
+ });
594
+ assert.equal(result.status, "completed");
595
+ assert.equal(result.coverage_status, "complete");
596
+ assert.deepEqual(result.unknowns, []);
597
+ });
598
+
599
+ test("distinct evidence-backed branches do not become a conflict group", () => {
600
+ const result = auditWith(discovery => {
601
+ const other = {
602
+ ...discovery.assertions[0],
603
+ source_branch: "branch:alternate",
604
+ outcomes: [{ kind: "visible-change", description: "An alternate result" }],
605
+ };
606
+ Object.assign(other, assertionIdentity(other));
607
+ discovery.assertions.push(other);
608
+ discovery.planned.push(plannedSpecified(other));
609
+ discovery.evidence_reviews.push({ assertion_id: other.id, status: "supported" });
610
+ discovery.source_unit_reviews = [
611
+ completedSourceReview(unit, [discovery.assertions[0].id, other.id]),
612
+ ];
613
+ });
614
+ assert.equal(result.status, "completed");
615
+ assert.deepEqual(result.failures, []);
616
+ });
617
+
618
+ test("recorded stale evidence requires rediscovery but does not fake an incomplete audit", () => {
619
+ const result = auditWith((discovery, evidence) => {
620
+ const historical = recordedSnapshot("static-source-v0", [
621
+ { ...unit, content_digest: "recorded-old-content" },
622
+ ]);
623
+ const staleReference = { ...reference, profile_id: historical.profile_id, snapshot_digest: historical.snapshot_digest };
624
+ evidence.snapshot_history.push(historical);
625
+ evidence.assertions[0].evidence_refs = [staleReference];
626
+ discovery.assertions[0].evidence_refs = [staleReference];
627
+ discovery.unknowns.push({
628
+ id: "unk_stale_assertion", scope: "assertion", reason: "stale-evidence",
629
+ source_unit_ids: [unit.id], affected_assertion_id: discovery.assertions[0].id,
630
+ affected_fields: ["outcomes"], evidence_refs: [staleReference],
631
+ relevance_review: { status: "reviewed", conclusion: "blocks-fields" },
632
+ next_action: "Rediscover current source evidence",
633
+ });
634
+ discovery.planned = [{
635
+ assertion_id: discovery.assertions[0].id, status: "unknown",
636
+ unknown_ids: ["unk_stale_assertion"], review_status: "reviewed",
637
+ }];
638
+ discovery.evidence_reviews[0].status = "insufficient";
639
+ });
640
+ assert.equal(result.status, "completed");
641
+ assert.equal(result.coverage_status, "partial");
642
+ assert.ok(result.unknowns.some(unknown => unknown.reason === "stale-evidence"));
643
+ assert.deepEqual(result.failures, []);
644
+ });
645
+
646
+ test("a stale assertion cannot remain specified", () => {
647
+ const result = auditWith((discovery, evidence) => {
648
+ const historical = recordedSnapshot("static-source-v0", [
649
+ { ...unit, content_digest: "recorded-old-content" },
650
+ ]);
651
+ const staleReference = { ...reference, profile_id: historical.profile_id, snapshot_digest: historical.snapshot_digest };
652
+ evidence.snapshot_history.push(historical);
653
+ evidence.assertions[0].evidence_refs = [staleReference];
654
+ discovery.assertions[0].evidence_refs = [staleReference];
655
+ });
656
+ assert.equal(result.status, "failed");
657
+ });
658
+
659
+ test("synchronized Evidence and discovery tampering cannot replace the plan anchor", () => {
660
+ const discovery = validDiscovery();
661
+ const originalEvidence = validEvidence();
662
+ const plan = makeBehaviorPlan(originalEvidence);
663
+ const changed = {
664
+ ...originalEvidence.assertions[0],
665
+ outcomes: [{ kind: "visible-change", description: "Tampered result" }],
666
+ };
667
+ Object.assign(changed, assertionIdentity(changed));
668
+ const evidence = withBehaviorSnapshot({ ...originalEvidence, assertions: [changed] });
669
+ discovery.assertions = [changed];
670
+ discovery.planned = [plannedSpecified(changed)];
671
+ discovery.evidence_reviews = [{ assertion_id: changed.id, status: "supported" }];
672
+ const result = evaluatePreAudit({ plan, evidence, discovery, sourceProject: root });
673
+ assert.equal(result.status, "failed");
674
+ assert.ok(result.failures.some(failure => failure.message.includes("snapshot") || failure.message.includes("plan")));
675
+ });
676
+
677
+ test("self-consistent but unanchored history cannot downgrade invalid evidence", () => {
678
+ const discovery = validDiscovery();
679
+ const originalEvidence = validEvidence();
680
+ const plan = makeBehaviorPlan(originalEvidence);
681
+ const historical = recordedSnapshot("static-source-v0", [
682
+ { ...unit, content_digest: "recorded-old-content" },
683
+ ]);
684
+ const staleReference = {
685
+ ...reference,
686
+ profile_id: historical.profile_id,
687
+ snapshot_digest: historical.snapshot_digest,
688
+ };
689
+ originalEvidence.assertions[0].evidence_refs = [staleReference];
690
+ originalEvidence.snapshot_history.push(historical);
691
+ discovery.assertions[0].evidence_refs = [staleReference];
692
+ const evidence = withBehaviorSnapshot(originalEvidence);
693
+ const result = evaluatePreAudit({ plan, evidence, discovery, sourceProject: root });
694
+ assert.equal(result.status, "failed");
695
+ });
696
+
697
+ test("composition root tampering fails the Evidence anchor", () => {
698
+ const discovery = validDiscovery();
699
+ const originalEvidence = validEvidence();
700
+ const plan = makeBehaviorPlan(originalEvidence);
701
+ const evidence = withBehaviorSnapshot({
702
+ ...originalEvidence,
703
+ composition_roots: ["src/other.js"],
704
+ });
705
+ const result = evaluatePreAudit({ plan, evidence, discovery, sourceProject: root });
706
+ assert.equal(result.status, "failed");
707
+ });
708
+
709
+ test("unfinished source or evidence review is incomplete rather than passed", () => {
710
+ const result = auditWith(discovery => { discovery.source_unit_reviews[0].status = "incomplete"; });
711
+ assert.equal(result.status, "incomplete");
712
+ assert.deepEqual(result.failures, []);
713
+ // An unfinished audit can never claim complete coverage, even when the
714
+ // SourceUnit is readable and composition is closed.
715
+ assert.equal(result.coverage_status, "partial");
716
+ });
717
+
718
+ // ---------------------------------------------------------------------------
719
+ // Real on-disk and ledger-fenced pre-audit.
720
+ // ---------------------------------------------------------------------------
721
+
722
+ const PRE_CLI = fileURLToPath(new URL("../behavior-audit.mjs", import.meta.url));
723
+ const OUT_SCHEMA = BEHAVIOR_SCHEMA_VERSION;
724
+
725
+ function seedPreOutDir() {
726
+ const outDir = fs.mkdtempSync(path.join(os.tmpdir(), "behavior-pre-disk-"));
727
+ const discovery = validDiscovery();
728
+ const evidence = validEvidence();
729
+ const plan = makeBehaviorPlan(evidence);
730
+ writeBehaviorEvidence({ outDir, behaviors: [evidence] });
731
+ writeJsonAtomic(path.join(outDir, "plan.json"), plan);
732
+ const discoveryPath = path.join(outDir, "behavior", "attempt-1", "g1", "discovery.json");
733
+ writeJsonAtomic(discoveryPath, { schema_version: OUT_SCHEMA, attempt: 1, pages: [discovery] });
734
+ writeLedger(outDir, plan.plan_version);
735
+ return { outDir, plan, evidence, discovery, discoveryPath };
736
+ }
737
+
738
+ function writeLedger(outDir, planVersion) {
739
+ const event = {
740
+ ev: "plan", ledger_version: 2, plan_version: planVersion,
741
+ groups: [{ group_id: "g1", kind: "page", pages: ["page:Alpha"], spec_ids: ["page:Alpha"] }],
742
+ t: "2026-11-16T00:00:00.000Z",
743
+ };
744
+ fs.writeFileSync(path.join(outDir, "ledger.jsonl"), `${JSON.stringify(event)}\n`);
745
+ }
746
+
747
+ function evidenceTreeDigest(outDir) {
748
+ const dir = path.join(outDir, "evidence");
749
+ return listFilesRecursively(dir)
750
+ .map(file => [path.relative(dir, file).split(path.sep).join("/"),
751
+ crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex")]);
752
+ }
753
+
754
+ test("runPreAudit writes a group audit with page digests and never edits immutable evidence", () => {
755
+ const { outDir } = seedPreOutDir();
756
+ const before = evidenceTreeDigest(outDir);
757
+ const result = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
758
+ assert.equal(result.status, "completed");
759
+ assert.equal(result.attempt, 1);
760
+ assert.match(result.discovery_digest, /^[0-9a-f]{64}$/);
761
+ assert.equal(result.pages["page:Alpha"].status, "completed");
762
+ assert.equal(result.pages["page:Alpha"].coverage_status, "complete");
763
+ assert.deepEqual(evidenceTreeDigest(outDir), before);
764
+
765
+ const written = readJson(path.join(outDir, "behavior", "attempt-1", "g1", "pre-audit.json"));
766
+ assert.equal(written.status, "completed");
767
+ assert.equal(written.attempt, 1);
768
+ assert.deepEqual(written.pages, result.pages);
769
+ assert.equal(written.discovery_digest, result.discovery_digest);
770
+ });
771
+
772
+ test("runPreAudit fails every page when the ledger plan_version does not match plan.json", () => {
773
+ const { outDir } = seedPreOutDir();
774
+ writeLedger(outDir, "p-deadbeef");
775
+ const result = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
776
+ assert.equal(result.status, "failed");
777
+ assert.equal(result.coverage_status, "partial");
778
+ assert.equal(result.pages["page:Alpha"].status, "failed");
779
+ assert.ok(result.pages["page:Alpha"].failures.some(failure => /ledger/i.test(failure.message)));
780
+ });
781
+
782
+ test("synchronized evidence and discovery tampering with unanchored history fails pre-audit", () => {
783
+ const { outDir, plan, discoveryPath } = seedPreOutDir();
784
+ const original = validEvidence();
785
+ const changed = {
786
+ ...original.assertions[0],
787
+ outcomes: [{ kind: "visible-change", description: "Tampered result" }],
788
+ };
789
+ Object.assign(changed, assertionIdentity(changed));
790
+ const historical = recordedSnapshot("static-source-v0", [
791
+ { ...unit, content_digest: "recorded-old-content" },
792
+ ]);
793
+ const tampered = withBehaviorSnapshot({
794
+ ...original,
795
+ assertions: [changed],
796
+ snapshot_history: [...original.snapshot_history, historical],
797
+ });
798
+ writeBehaviorEvidence({ outDir, behaviors: [tampered] });
799
+ const discovery = validDiscovery();
800
+ discovery.assertions = [changed];
801
+ discovery.planned = [plannedSpecified(changed)];
802
+ discovery.evidence_reviews = [{ assertion_id: changed.id, status: "supported" }];
803
+ writeJsonAtomic(discoveryPath, { schema_version: OUT_SCHEMA, attempt: 1, pages: [discovery] });
804
+ const result = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
805
+ assert.notEqual(tampered.snapshot_digest, plan.pages[0].behavior.snapshot_digest);
806
+ assert.equal(result.status, "failed");
807
+ assert.ok(result.pages["page:Alpha"].failures
808
+ .some(failure => failure.message.includes("snapshot") || failure.message.includes("plan")));
809
+ });
810
+
811
+ test("runPreAudit refuses a discovery document for another attempt", () => {
812
+ const { outDir, discoveryPath, discovery } = seedPreOutDir();
813
+ writeJsonAtomic(discoveryPath, { schema_version: OUT_SCHEMA, attempt: 2, pages: [discovery] });
814
+ const result = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
815
+ assert.equal(result.status, "failed");
816
+ assert.equal(result.pages["page:Alpha"].status, "failed");
817
+ assert.ok(result.pages["page:Alpha"].failures.some(failure => /attempt/i.test(failure.message)));
818
+ });
819
+
820
+ test("pre CLI exits 0 for a completed audit and 1 for a failed one", () => {
821
+ const { outDir } = seedPreOutDir();
822
+ const completed = spawnSync(process.execPath, [PRE_CLI, outDir, "pre", "g1", "--attempt", "1"], { encoding: "utf8" });
823
+ assert.equal(completed.status, 0, completed.stderr);
824
+
825
+ writeLedger(outDir, "p-deadbeef");
826
+ const failed = spawnSync(process.execPath, [PRE_CLI, outDir, "pre", "g1", "--attempt", "1"], { encoding: "utf8" });
827
+ assert.equal(failed.status, 1, failed.stderr);
828
+ assert.match(failed.stdout, /failed/);
829
+ });
830
+
831
+ test("page and group discovery digests are deterministic and track content", () => {
832
+ const { outDir, discoveryPath } = seedPreOutDir();
833
+ const first = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
834
+ const second = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
835
+ assert.equal(second.discovery_digest, first.discovery_digest);
836
+ assert.equal(second.pages["page:Alpha"].discovery_digest, first.pages["page:Alpha"].discovery_digest);
837
+ assert.notEqual(first.pages["page:Alpha"].discovery_digest, first.discovery_digest);
838
+
839
+ const discovery = validDiscovery();
840
+ discovery.unknowns.push({
841
+ id: "unk_digest", scope: "assertion", reason: "unsupported-construct",
842
+ source_unit_ids: [unit.id], affected_assertion_id: discovery.assertions[0].id,
843
+ affected_fields: ["outcomes"], evidence_refs: [reference],
844
+ relevance_review: { status: "reviewed", conclusion: "blocks-fields" },
845
+ next_action: "Review it",
846
+ });
847
+ discovery.planned = [{ assertion_id: discovery.assertions[0].id, status: "unknown", unknown_ids: ["unk_digest"], review_status: "reviewed" }];
848
+ discovery.evidence_reviews[0].status = "insufficient";
849
+ writeJsonAtomic(discoveryPath, { schema_version: OUT_SCHEMA, attempt: 1, pages: [discovery] });
850
+ const changed = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
851
+ assert.notEqual(changed.pages["page:Alpha"].discovery_digest, first.pages["page:Alpha"].discovery_digest);
852
+ assert.notEqual(changed.discovery_digest, first.discovery_digest);
853
+ });
854
+
855
+ test("group discovery_digest covers the full discovery document", () => {
856
+ const { outDir, discoveryPath } = seedPreOutDir();
857
+ const result = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
858
+ const document = readJson(discoveryPath);
859
+ assert.equal(result.discovery_digest, stableDigest(document));
860
+ assert.equal(result.discovery_digest, stableDigest({
861
+ schema_version: document.schema_version,
862
+ attempt: document.attempt,
863
+ pages: document.pages,
864
+ }));
865
+
866
+ const reduced = {
867
+ schema_version: document.schema_version,
868
+ attempt: document.attempt,
869
+ pages: document.pages
870
+ .map(page => ({ page_id: page.page_id, discovery_digest: stableDigest(page) }))
871
+ .sort((a, b) => a.page_id.localeCompare(b.page_id)),
872
+ };
873
+ assert.notEqual(result.discovery_digest, stableDigest(reduced));
874
+ });
875
+
876
+ test("completed and incomplete pre-audits both permit drafting while failed does not", () => {
877
+ const completed = auditWith(() => {});
878
+ assert.equal(completed.status, "completed");
879
+ const incomplete = auditWith(discovery => { discovery.source_unit_reviews[0].status = "incomplete"; });
880
+ assert.equal(incomplete.status, "incomplete");
881
+ const failed = auditWith(discovery => { discovery.assertions = []; discovery.planned = []; discovery.evidence_reviews = []; });
882
+ assert.equal(failed.status, "failed");
883
+ });
884
+
885
+ // ---------------------------------------------------------------------------
886
+ // Fix round 1 regressions (C1–C3, I1–I6).
887
+ // ---------------------------------------------------------------------------
888
+
889
+ function relatedUnknown(discovery, overrides = {}) {
890
+ return {
891
+ id: "unk_related",
892
+ reason: "unsupported-construct",
893
+ scope: "assertion",
894
+ source_unit_ids: [unit.id],
895
+ affected_assertion_id: discovery.assertions[0].id,
896
+ affected_fields: ["outcomes"],
897
+ evidence_refs: [reference],
898
+ relevance_review: { status: "reviewed", conclusion: "blocks-fields" },
899
+ next_action: "Review the unsupported source region",
900
+ ...overrides,
901
+ };
902
+ }
903
+
904
+ function zeroBehaviorKnownEvidence() {
905
+ const evidence = withBehaviorSnapshot(enrichBehaviorEvidence({
906
+ pages: [{ page_id: "page:Alpha", declared_at: "src/alpha.js", source_origins: [], out_edges: [], widgets: [] }],
907
+ footprint: new Map([["page:Alpha", {
908
+ all: new Set(["src/alpha.js"]), writable: new Set(), resolvedFile: "src/alpha.js", origin_units: [], unresolved: [],
909
+ }]]),
910
+ sourceProject: root,
911
+ }).get("page:Alpha"));
912
+ const sourceUnitReviews = evidence.source_units.map(sourceUnit => completedSourceReview(sourceUnit, []));
913
+ const requiresResolution = {
914
+ id: "unk_zero_review", scope: "interaction", page_id: "page:Alpha",
915
+ reason: "review-incomplete", cause: "no_source",
916
+ next_action: "Inspect the page for interactions the static scan could not observe",
917
+ };
918
+ return {
919
+ evidence,
920
+ sourceUnitReviews,
921
+ unknown: requiresResolution,
922
+ discovery: overrides => ({
923
+ ...evidence,
924
+ source_unit_reviews: sourceUnitReviews,
925
+ unknowns: [...evidence.unknowns, requiresResolution],
926
+ ...overrides,
927
+ }),
928
+ };
929
+ }
930
+
931
+ test("C1 planned unknown requires a named unresolved unknown with direct relevance", () => {
932
+ const mutations = [
933
+ // no unknown records at all
934
+ discovery => {
935
+ discovery.planned = [{
936
+ assertion_id: discovery.assertions[0].id, status: "unknown",
937
+ unknown_ids: [], review_status: "reviewed",
938
+ }];
939
+ discovery.evidence_reviews[0].status = "insufficient";
940
+ },
941
+ // unknown_ids names no record
942
+ discovery => {
943
+ discovery.planned = [{
944
+ assertion_id: discovery.assertions[0].id, status: "unknown",
945
+ unknown_ids: ["unk_missing"], review_status: "reviewed",
946
+ }];
947
+ discovery.evidence_reviews[0].status = "insufficient";
948
+ },
949
+ // related to another assertion, not the planned one
950
+ discovery => {
951
+ const other = {
952
+ ...discovery.assertions[0],
953
+ source_branch: "branch:alternate",
954
+ outcomes: [{ kind: "visible-change", description: "Another result" }],
955
+ };
956
+ Object.assign(other, assertionIdentity(other));
957
+ discovery.assertions.push(other);
958
+ discovery.evidence_reviews.push({ assertion_id: other.id, status: "supported" });
959
+ discovery.unknowns.push(relatedUnknown(discovery, {
960
+ id: "unk_elsewhere", affected_assertion_id: other.id,
961
+ }));
962
+ discovery.planned = [
963
+ {
964
+ assertion_id: discovery.assertions[0].id, status: "unknown",
965
+ unknown_ids: ["unk_elsewhere"], review_status: "reviewed",
966
+ },
967
+ plannedSpecified(other),
968
+ ];
969
+ discovery.evidence_reviews[0].status = "insufficient";
970
+ },
971
+ // unknown_ids on a non-unknown status
972
+ discovery => {
973
+ discovery.unknowns.push(relatedUnknown(discovery, { id: "unk_idle" }));
974
+ discovery.planned = [{ ...plannedSpecified(discovery.assertions[0]), unknown_ids: ["unk_idle"] }];
975
+ },
976
+ // unknown_ids cites an already resolved unknown
977
+ discovery => {
978
+ discovery.unknowns.push(relatedUnknown(discovery, { id: "unk_done" }));
979
+ discovery.resolutions = [{
980
+ unknown_id: "unk_done", status: "resolved",
981
+ evidence_refs: [reference], assertion_ids: [discovery.assertions[0].id],
982
+ }];
983
+ discovery.planned = [{
984
+ assertion_id: discovery.assertions[0].id, status: "unknown",
985
+ unknown_ids: ["unk_done"], review_status: "reviewed",
986
+ }];
987
+ discovery.evidence_reviews[0].status = "insufficient";
988
+ },
989
+ ];
990
+ for (const mutate of mutations) {
991
+ const result = auditWith(mutate);
992
+ assert.equal(result.status, "failed");
993
+ assert.ok(result.failures.some(failure => /unknown/i.test(failure.message)));
994
+ }
995
+ });
996
+
997
+ test("C2 terminal candidate reviews without a disposition are hard failures", () => {
998
+ for (const status of ["supported", "refuted"]) {
999
+ const result = auditWith((discovery, evidence) => {
1000
+ const candidate = { candidate_id: `cand_${status}`, evidence_refs: [reference], review_status: "pending" };
1001
+ evidence.candidates.push(candidate);
1002
+ discovery.candidate_reviews = [{ candidate_id: candidate.candidate_id, status }];
1003
+ });
1004
+ assert.equal(result.status, "failed");
1005
+ assert.ok(result.failures.some(failure => /candidate/i.test(failure.message)));
1006
+ assert.equal(result.coverage_status, "partial");
1007
+ }
1008
+
1009
+ const unfinished = auditWith((discovery, evidence) => {
1010
+ evidence.candidates.push({ candidate_id: "cand_unfinished", evidence_refs: [reference], review_status: "pending" });
1011
+ discovery.candidate_reviews = [{ candidate_id: "cand_unfinished", status: "failed" }];
1012
+ });
1013
+ assert.equal(unfinished.status, "incomplete");
1014
+ assert.equal(unfinished.coverage_status, "partial");
1015
+ });
1016
+
1017
+ test("C3 duplicate-assertion needs a same-behavior group, a reviewed specified target, and semantic equivalence", () => {
1018
+ const duplicateOf = (discovery, { targetKey = "same", targetReview = "reviewed", semanticReview = true } = {}) => {
1019
+ const original = discovery.assertions[0];
1020
+ const duplicate = {
1021
+ ...original,
1022
+ ...(targetKey === "same" ? {} : { source_branch: "branch:unrelated" }),
1023
+ outcomes: [{ kind: "visible-change", description: "A separately recorded result" }],
1024
+ };
1025
+ Object.assign(duplicate, assertionIdentity(duplicate));
1026
+ discovery.assertions.push(duplicate);
1027
+ discovery.source_unit_reviews = [
1028
+ completedSourceReview(unit, [original.id, duplicate.id]),
1029
+ ];
1030
+ const canonical = {
1031
+ ...plannedSpecified(original),
1032
+ review_status: targetReview,
1033
+ };
1034
+ const disposition = {
1035
+ assertion_id: duplicate.id, status: "duplicate-assertion",
1036
+ canonical_assertion_id: original.id, review_status: "reviewed",
1037
+ ...(semanticReview ? { semantic_equivalence_review: { status: "supported", conclusion: "equivalent" } } : {}),
1038
+ };
1039
+ discovery.planned = [canonical, disposition];
1040
+ discovery.evidence_reviews.push({ assertion_id: duplicate.id, status: "supported" });
1041
+ return { original, duplicate };
1042
+ };
1043
+
1044
+ const valid = auditWith(discovery => {
1045
+ const { original, duplicate } = duplicateOf(discovery);
1046
+ assert.equal(duplicate.behavior_key, original.behavior_key);
1047
+ assert.notEqual(duplicate.id, original.id);
1048
+ });
1049
+ assert.equal(valid.status, "completed");
1050
+ assert.deepEqual(valid.failures, []);
1051
+
1052
+ const unrelatedTarget = auditWith(discovery => { duplicateOf(discovery, { targetKey: "unrelated" }); });
1053
+ assert.equal(unrelatedTarget.status, "failed");
1054
+ assert.ok(unrelatedTarget.failures.some(failure => /canonical|behavior/i.test(failure.message)));
1055
+
1056
+ const unreviewedTarget = auditWith(discovery => { duplicateOf(discovery, { targetReview: "incomplete" }); });
1057
+ assert.equal(unreviewedTarget.status, "failed");
1058
+
1059
+ const noSemanticReview = auditWith(discovery => { duplicateOf(discovery, { semanticReview: false }); });
1060
+ assert.equal(noSemanticReview.status, "failed");
1061
+ });
1062
+
1063
+ test("I1 a failed resolution leaves its unknown unresolved and coverage partial", () => {
1064
+ const result = auditWith(discovery => {
1065
+ discovery.unknowns.push({
1066
+ id: "unk_need", scope: "interaction", page_id: "page:Alpha",
1067
+ reason: "review-incomplete", next_action: "Review the page source",
1068
+ });
1069
+ discovery.resolutions = [{
1070
+ unknown_id: "unk_need", status: "no-assertions-found",
1071
+ source_unit_id: unit.id, reviewed_digest: "bad-digest",
1072
+ review_status: "reviewed", evidence_refs: [], assertion_ids: [],
1073
+ }];
1074
+ });
1075
+ assert.equal(result.status, "failed");
1076
+ assert.equal(result.coverage_status, "partial");
1077
+ assert.ok(result.unknowns.some(unknown => unknown.id === "unk_need"));
1078
+ });
1079
+
1080
+ test("I2 supported plus unknown fails even when the planned review is incomplete", () => {
1081
+ const result = auditWith(discovery => {
1082
+ discovery.unknowns.push(relatedUnknown(discovery, { id: "unk_open" }));
1083
+ discovery.planned = [{
1084
+ assertion_id: discovery.assertions[0].id, status: "unknown",
1085
+ unknown_ids: ["unk_open"], review_status: "incomplete",
1086
+ }];
1087
+ });
1088
+ assert.equal(result.status, "failed");
1089
+ assert.ok(result.failures.some(failure => /supported/i.test(failure.message)));
1090
+ });
1091
+
1092
+ test("I3 malformed anchored evidence writes a failed audit instead of crashing the CLI", () => {
1093
+ const { outDir } = seedPreOutDir();
1094
+ const evidenceDir = path.join(outDir, "evidence", stemOf("page:Alpha"));
1095
+ writeJsonAtomic(path.join(evidenceDir, "assertions.json"), [null]);
1096
+
1097
+ const result = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
1098
+ assert.equal(result.status, "failed");
1099
+ assert.equal(result.pages["page:Alpha"].status, "failed");
1100
+ assert.equal(result.pages["page:Alpha"].coverage_status, "partial");
1101
+ assert.ok(result.pages["page:Alpha"].failures.some(failure => /malformed/i.test(failure.message)));
1102
+ const written = readJson(path.join(outDir, "behavior", "attempt-1", "g1", "pre-audit.json"));
1103
+ assert.equal(written.pages["page:Alpha"].status, "failed");
1104
+
1105
+ const cli = spawnSync(process.execPath, [PRE_CLI, outDir, "pre", "g1", "--attempt", "1"], { encoding: "utf8" });
1106
+ assert.equal(cli.status, 1, cli.stderr);
1107
+ assert.equal(cli.stderr, "");
1108
+
1109
+ const corruptComposition = readJson(path.join(evidenceDir, "composition.json"));
1110
+ corruptComposition.source_units = [null];
1111
+ writeJsonAtomic(path.join(evidenceDir, "composition.json"), corruptComposition);
1112
+ const corrupt = runPreAudit({ outDir, groupId: "g1", attempt: 1, sourceProject: root });
1113
+ assert.equal(corrupt.status, "failed");
1114
+ assert.ok(corrupt.pages["page:Alpha"].failures.some(failure => /malformed/i.test(failure.message)));
1115
+ });
1116
+
1117
+ test("I4 zero-behavior review-incomplete unknown needs an explicit digest-matched resolution", () => {
1118
+ const { evidence, unknown, discovery } = zeroBehaviorKnownEvidence();
1119
+ const unitDigest = evidence.current_snapshot.source_units[0].content_digest;
1120
+
1121
+ const withoutResolution = evaluatePreAudit({
1122
+ plan: makeBehaviorPlan(evidence), evidence, discovery: discovery(), sourceProject: root,
1123
+ });
1124
+ assert.equal(withoutResolution.coverage_status, "partial");
1125
+ assert.ok(withoutResolution.unknowns.some(entry => entry.id === unknown.id));
1126
+
1127
+ const closes = evaluatePreAudit({
1128
+ plan: makeBehaviorPlan(evidence), evidence,
1129
+ discovery: discovery({
1130
+ resolutions: [{
1131
+ unknown_id: unknown.id, status: "no-assertions-found",
1132
+ source_unit_id: evidence.current_snapshot.source_units[0].id,
1133
+ reviewed_digest: unitDigest, review_status: "reviewed",
1134
+ evidence_refs: [], assertion_ids: [],
1135
+ }],
1136
+ }),
1137
+ sourceProject: root,
1138
+ });
1139
+ assert.equal(closes.status, "completed");
1140
+ assert.equal(closes.coverage_status, "complete");
1141
+ assert.deepEqual(closes.dispositions, []);
1142
+ assert.deepEqual(closes.unknowns, []);
1143
+
1144
+ const badDigest = evaluatePreAudit({
1145
+ plan: makeBehaviorPlan(evidence), evidence,
1146
+ discovery: discovery({
1147
+ resolutions: [{
1148
+ unknown_id: unknown.id, status: "no-assertions-found",
1149
+ source_unit_id: evidence.current_snapshot.source_units[0].id,
1150
+ reviewed_digest: "bad-digest", review_status: "reviewed",
1151
+ evidence_refs: [], assertion_ids: [],
1152
+ }],
1153
+ }),
1154
+ sourceProject: root,
1155
+ });
1156
+ assert.equal(badDigest.status, "failed");
1157
+ assert.equal(badDigest.coverage_status, "partial");
1158
+ assert.ok(badDigest.unknowns.some(entry => entry.id === unknown.id));
1159
+
1160
+ const invented = evaluatePreAudit({
1161
+ plan: makeBehaviorPlan(evidence), evidence,
1162
+ discovery: discovery({
1163
+ resolutions: [{
1164
+ unknown_id: unknown.id, status: "no-assertions-found",
1165
+ source_unit_id: evidence.current_snapshot.source_units[0].id,
1166
+ reviewed_digest: unitDigest, review_status: "reviewed",
1167
+ evidence_refs: [], assertion_ids: ["ba_not_real"],
1168
+ }],
1169
+ }),
1170
+ sourceProject: root,
1171
+ });
1172
+ assert.equal(invented.status, "failed");
1173
+ assert.equal(invented.coverage_status, "partial");
1174
+ });
1175
+
1176
+ test("I5 candidate-scoped behavior unknowns obey the field contract", () => {
1177
+ const candidate = { candidate_id: "cand_insuff", evidence_refs: [reference], review_status: "pending" };
1178
+ const baseUnknown = {
1179
+ id: "unk_cand", scope: "behavior", candidate_id: candidate.candidate_id,
1180
+ reason: "review-insufficient", affected_fields: ["outcomes"],
1181
+ evidence_refs: [reference],
1182
+ relevance_review: { status: "reviewed", conclusion: "blocks-fields" },
1183
+ next_action: "Gather direct source evidence for the candidate behavior",
1184
+ };
1185
+ const withCandidate = overrides => auditWith((discovery, evidence) => {
1186
+ evidence.candidates.push(candidate);
1187
+ discovery.candidate_reviews = [{ candidate_id: candidate.candidate_id, status: "insufficient" }];
1188
+ const unknown = { ...baseUnknown, ...overrides };
1189
+ for (const [key, value] of Object.entries(overrides)) if (value === undefined) delete unknown[key];
1190
+ discovery.unknowns.push(unknown);
1191
+ discovery.candidate_dispositions = [{
1192
+ candidate_id: candidate.candidate_id, status: "unknown",
1193
+ unknown_ids: [unknown.id], review_status: "reviewed",
1194
+ }];
1195
+ });
1196
+
1197
+ const valid = withCandidate({});
1198
+ assert.equal(valid.status, "completed");
1199
+ assert.equal(valid.coverage_status, "partial");
1200
+ assert.deepEqual(valid.failures, []);
1201
+
1202
+ for (const overrides of [
1203
+ { affected_fields: undefined },
1204
+ { evidence_refs: undefined },
1205
+ { relevance_review: undefined },
1206
+ { affected_fields: ["not-a-behavior-field"] },
1207
+ ]) {
1208
+ const rejected = withCandidate(overrides);
1209
+ assert.equal(rejected.status, "failed");
1210
+ }
1211
+ });
1212
+
1213
+ test("I6 incomplete or failed audits never report complete coverage", () => {
1214
+ const incomplete = auditWith(discovery => { discovery.source_unit_reviews[0].status = "incomplete"; });
1215
+ assert.equal(incomplete.status, "incomplete");
1216
+ assert.equal(incomplete.coverage_status, "partial");
1217
+
1218
+ const failed = auditWith(discovery => {
1219
+ discovery.assertions = [];
1220
+ discovery.planned = [];
1221
+ discovery.evidence_reviews = [];
1222
+ });
1223
+ assert.equal(failed.status, "failed");
1224
+ assert.equal(failed.coverage_status, "partial");
1225
+
1226
+ const evidence = validEvidence();
1227
+ const anchoredPlan = makeBehaviorPlan(evidence);
1228
+ const tampered = withBehaviorSnapshot({ ...evidence, composition_roots: ["src/other.js"] });
1229
+ const anchorFailed = evaluatePreAudit({
1230
+ plan: anchoredPlan, evidence: tampered, discovery: validDiscovery(), sourceProject: root,
1231
+ });
1232
+ assert.equal(anchorFailed.status, "failed");
1233
+ assert.equal(anchorFailed.coverage_status, "partial");
1234
+ });