@buaa_smat/hometrans 26.0.5 → 26.0.6

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 (472) hide show
  1. package/README.md +249 -279
  2. package/agents/code-reviewer.md +1 -1
  3. package/dist/cli/editors.json +20 -0
  4. package/dist/platform/registry.js +1 -0
  5. package/dist/platform/validate.js +2 -1
  6. package/i18n/agents/code-reviewer.md +1 -1
  7. package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  8. package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  9. package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  10. package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  11. package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  12. package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  13. package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
  14. package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  15. package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  16. package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  17. package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  18. package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
  19. package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
  20. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
  21. package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
  22. package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
  23. package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
  24. package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
  25. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  26. package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
  27. package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
  28. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
  29. package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
  30. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
  31. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
  32. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
  33. package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
  34. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
  35. package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
  36. package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
  37. package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
  38. package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
  39. package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
  40. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
  41. package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
  42. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
  43. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
  44. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
  45. package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
  46. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
  47. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
  48. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
  49. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
  50. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
  51. package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
  52. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
  53. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
  54. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
  55. package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
  56. package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
  57. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
  58. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
  59. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
  60. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
  61. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
  62. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
  63. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
  64. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
  65. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
  66. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
  67. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
  68. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
  69. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
  70. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
  71. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
  72. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
  73. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
  74. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
  75. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
  76. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
  77. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
  78. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
  79. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
  80. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
  81. package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
  82. package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
  83. package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
  84. package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
  85. package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
  86. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
  87. package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
  88. package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
  89. package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
  90. package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
  91. package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
  92. package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
  93. package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
  94. package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
  95. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
  96. package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
  97. package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
  98. package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
  99. package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
  100. package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
  101. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
  102. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
  103. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
  104. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
  105. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
  106. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
  107. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
  108. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
  109. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
  110. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
  111. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
  112. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
  113. package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
  114. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
  115. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
  116. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
  117. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
  118. package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
  119. package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
  120. package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
  121. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
  122. package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
  123. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
  124. package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
  125. package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
  126. package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
  127. package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
  128. package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
  129. package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
  130. package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
  131. package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
  132. package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
  133. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
  134. package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
  135. package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
  136. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
  137. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
  138. package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
  139. package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
  140. package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
  141. package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
  142. package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
  143. package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
  144. package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
  145. package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
  146. package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
  147. package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
  148. package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
  149. package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
  150. package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
  151. package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
  152. package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
  153. package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
  154. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
  155. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
  156. package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
  157. package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
  158. package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
  159. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
  160. package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
  161. package/package.json +2 -1
  162. package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  163. package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  164. package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
  165. package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
  166. package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
  167. package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
  168. package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
  169. package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  170. package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  171. package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  172. package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
  173. package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
  174. package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
  175. package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
  176. package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
  177. package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  178. package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
  179. package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
  180. package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
  181. package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
  182. package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
  183. package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
  184. package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  185. package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
  186. package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  187. package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
  188. package/skills/a2h-app-migrate/SKILL.md +31 -14
  189. package/skills/a2h-app-migrate/references/stage-map.md +4 -2
  190. package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
  191. package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
  192. package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
  193. package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
  194. package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
  195. package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
  196. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
  197. package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
  198. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
  199. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
  200. package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
  201. package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
  202. package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
  203. package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
  204. package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
  205. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  206. package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
  207. package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
  208. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
  209. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
  210. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
  211. package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
  212. package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
  213. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
  214. package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
  215. package/skills/a2h-batch-ui-align/SKILL.md +14 -12
  216. package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
  217. package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
  218. package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
  219. package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
  220. package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
  221. package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
  222. package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
  223. package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
  224. package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
  225. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
  226. package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
  227. package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
  228. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
  229. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
  230. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
  231. package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +1 -1
  232. package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
  233. package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
  234. package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
  235. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
  236. package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
  237. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
  238. package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
  239. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
  240. package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
  241. package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
  242. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
  243. package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
  244. package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
  245. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
  246. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
  247. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
  248. package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
  249. package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
  250. package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
  251. package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
  252. package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
  253. package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
  254. package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
  255. package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
  256. package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
  257. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
  258. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
  259. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
  260. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
  261. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
  262. package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
  263. package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
  264. package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
  265. package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
  266. package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
  267. package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
  268. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
  269. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
  270. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
  271. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
  272. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
  273. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
  274. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
  275. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
  276. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
  277. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
  278. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
  279. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
  280. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
  281. package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
  282. package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
  283. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
  284. package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
  285. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
  286. package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
  287. package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
  288. package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
  289. package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
  290. package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
  291. package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
  292. package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
  293. package/skills/a2h-page-specgen/SKILL.md +36 -5
  294. package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
  295. package/skills/a2h-page-specgen/references/evidence.md +2 -1
  296. package/skills/a2h-page-specgen/references/execution-model.md +13 -5
  297. package/skills/a2h-page-specgen/references/gates.md +33 -7
  298. package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
  299. package/skills/a2h-page-specgen/references/spec-example.md +166 -32
  300. package/skills/a2h-page-specgen/references/spec-template.md +8 -5
  301. package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
  302. package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
  303. package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
  304. package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
  305. package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
  306. package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
  307. package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
  308. package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
  309. package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
  310. package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
  311. package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
  312. package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
  313. package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
  314. package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
  315. package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
  316. package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
  317. package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
  318. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
  319. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
  320. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
  321. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
  322. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
  323. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
  324. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
  325. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
  326. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
  327. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
  328. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
  329. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
  330. package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
  331. package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
  332. package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
  333. package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
  334. package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
  335. package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
  336. package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
  337. package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
  338. package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
  339. package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
  340. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
  341. package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
  342. package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
  343. package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
  344. package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
  345. package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
  346. package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
  347. package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
  348. package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
  349. package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
  350. package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
  351. package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
  352. package/skills/a2h-resource-convert/SKILL.md +1 -1
  353. package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
  354. package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
  355. package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
  356. package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
  357. package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
  358. package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
  359. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
  360. package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
  361. package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
  362. package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
  363. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
  364. package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
  365. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
  366. package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
  367. package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
  368. package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
  369. package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
  370. package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
  371. package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
  372. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
  373. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
  374. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
  375. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
  376. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
  377. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
  378. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
  379. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
  380. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
  381. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
  382. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
  383. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
  384. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
  385. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
  386. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
  387. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
  388. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
  389. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
  390. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
  391. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
  392. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
  393. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
  394. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
  395. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
  396. package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
  397. package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
  398. package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
  399. package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
  400. package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
  401. package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
  402. package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
  403. package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
  404. package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
  405. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
  406. package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
  407. package/skills/a2h-spec-generate/references/input-formats.md +1 -1
  408. package/skills/a2h-utg-explorer/SKILL.md +11 -5
  409. package/skills/a2h-utg-explorer/references/architecture.md +37 -19
  410. package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
  411. package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
  412. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
  413. package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
  414. package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
  415. package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
  416. package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
  417. package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
  418. package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
  419. package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
  420. package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
  421. package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
  422. package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
  423. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
  424. package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
  425. package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
  426. package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
  427. package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
  428. package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
  429. package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
  430. package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
  431. package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
  432. package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
  433. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
  434. package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
  435. package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
  436. package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
  437. package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
  438. package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
  439. package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
  440. package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
  441. package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
  442. package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
  443. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
  444. package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
  445. package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
  446. package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
  447. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
  448. package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
  449. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
  450. package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
  451. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
  452. package/skills/a2h-utg-static/SKILL.md +3 -3
  453. package/skills/a2h-utg-static/references/extractors.md +7 -0
  454. package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
  455. package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
  456. package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
  457. package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
  458. package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
  459. package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
  460. package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
  461. package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
  462. package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
  463. package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
  464. package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
  465. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
  466. package/resource/convert_pipeline_process.svg +0 -114
  467. package/resource/project_architecture.svg +0 -120
  468. package/resource/set_environment.png +0 -0
  469. package/resource/set_multimodel.png +0 -0
  470. package/skills/a2h-app-migrate/references/specs.example.json +0 -19
  471. package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
  472. package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
@@ -4,6 +4,7 @@ import { createHash } from "node:crypto";
4
4
  import fs from "node:fs";
5
5
  import path from "node:path";
6
6
  import { readJson, writeJsonAtomic } from "./lib/fsx.mjs";
7
+ import { loadEvidenceFromDisk } from "./lib/graph-evidence.mjs";
7
8
  import { renderAll } from "./render.mjs";
8
9
  import { runGroupGates } from "./gate.mjs";
9
10
  import { fold, withLock } from "./lib/ledger.mjs";
@@ -13,6 +14,7 @@ import { assertPlanContentVersion } from "./footprint.mjs";
13
14
  import {
14
15
  assertBehaviorArtifactBaseline,
15
16
  assertBehaviorArtifactsUnchanged,
17
+ assertBehaviorEvidenceAnchor,
16
18
  collectBehaviorArtifactDigests,
17
19
  } from "./behavior-audit.mjs";
18
20
  import { buildCoverageReport, renderCoverageMarkdown } from "./report.mjs";
@@ -143,7 +145,10 @@ export function buildSpecsJson({ plan, mdPaths, groupDeps, drafts = new Map(), m
143
145
  * written into the app-migrate final report. Only a
144
146
  * run that produced no SPEC at all aborts.
145
147
  */
146
- export function manifestCompleteness({ coverageReport, failures = [], missingSpecIds = [], scopeUnmatched = [], scopeLogicUncovered = [] }) {
148
+ export function manifestCompleteness({
149
+ coverageReport, failures = [], missingSpecIds = [], scopeUnmatched = [], scopeLogicUncovered = [],
150
+ omittedReasonCodes = [],
151
+ }) {
147
152
  const partialPages = (coverageReport?.pages ?? [])
148
153
  .filter(page => page?.delivery_status !== "delivered-complete");
149
154
  const failedShards = [...new Set(failures.map(failure => failure?.group_id).filter(Boolean))].sort();
@@ -162,6 +167,7 @@ export function manifestCompleteness({ coverageReport, failures = [], missingSpe
162
167
  ...(scopeUnmatched.length > 0 ? ["scope-node-unmatched"] : []),
163
168
  // a no-UI unit of the scope no scoped page's shared layer covers: no SPEC carries it
164
169
  ...(scopeLogicUncovered.length > 0 ? ["scope-logic-uncovered"] : []),
170
+ ...omittedReasonCodes,
165
171
  ].filter(code => typeof code === "string" && code !== ""))].sort();
166
172
  // `areas` counts evidence gaps. A pure gate failure has none, so it is omitted
167
173
  // rather than printed as `areas: 0` next to a non-empty failure list.
@@ -183,6 +189,50 @@ export function manifestCompleteness({ coverageReport, failures = [], missingSpe
183
189
  };
184
190
  }
185
191
 
192
+ /**
193
+ * Project prepare-time omitted SourceUnits into a page-keyed summary.
194
+ *
195
+ * Evidence is the source of record; the plan mirror is the fallback for
196
+ * behavior-free fixtures or a missing/malformed evidence file. A page with any
197
+ * omitted unit can never be delivered-complete, even when discovery resolved
198
+ * the composition unknown.
199
+ */
200
+ export function collectOmittedByPage({ plan, outDir } = {}) {
201
+ const omittedByPage = new Map();
202
+ const pages = (Array.isArray(plan?.pages) ? plan.pages : [])
203
+ .filter(page => page?.behavior && typeof page.page_id === "string" && page.page_id !== "");
204
+ if (pages.length === 0) return omittedByPage;
205
+ assertPlanContentVersion(plan);
206
+ for (const page of pages) {
207
+ let unknowns = null;
208
+ let source = "evidence";
209
+ try {
210
+ const evidence = loadEvidenceFromDisk(outDir, page.page_id);
211
+ assertBehaviorEvidenceAnchor({ plan, pageId: page.page_id, evidence });
212
+ unknowns = evidence.unknowns;
213
+ } catch {
214
+ unknowns = page.behavior.unknowns;
215
+ source = "plan-mirror";
216
+ }
217
+ if (!Array.isArray(unknowns)) {
218
+ unknowns = [];
219
+ source = "plan-mirror";
220
+ }
221
+ const omitted = unknowns.filter(unknown =>
222
+ Array.isArray(unknown?.omitted_source_units) && unknown.omitted_source_units.length > 0);
223
+ if (omitted.length === 0) continue;
224
+ omittedByPage.set(page.page_id, {
225
+ count: omitted.reduce((total, unknown) => total + unknown.omitted_source_units.length, 0),
226
+ causes: [...new Set(omitted.map(unknown => unknown.cause ?? unknown.reason)
227
+ .filter(code => typeof code === "string" && code !== ""))].sort(),
228
+ unknown_ids: omitted.map(unknown => unknown.id)
229
+ .filter(id => typeof id === "string" && id !== "").sort(),
230
+ source,
231
+ });
232
+ }
233
+ return omittedByPage;
234
+ }
235
+
186
236
  /** The `scope` block of a scoped run's specs.json (null for a whole-app run). */
187
237
  export function manifestScope(plan) {
188
238
  const s = plan?.scope;
@@ -358,7 +408,7 @@ function finalizeUnlocked(outDir) {
358
408
 
359
409
  // Collect the immutable behavior artifacts after plan/attempt loading but
360
410
  // before renderAll writes anything. The first pass over every group builds a
361
- // complete baseline, including the four fixed evidence files of each behavior
411
+ // complete baseline, including the five fixed evidence files of each behavior
362
412
  // page as digest-or-null. Later observations may not add a key or turn a null
363
413
  // into a present file, and may never replace a validated digest.
364
414
  // Each group's observation contains the shared evidence tree and only its own
@@ -560,12 +610,14 @@ function finalizeUnlocked(outDir) {
560
610
  linksByPage.get(pageId).push(...behaviors);
561
611
  }
562
612
 
613
+ const omittedByPage = collectOmittedByPage({ plan, outDir });
563
614
  const coverageReport = buildCoverageReport({
564
615
  plan,
565
616
  groups,
566
617
  behaviorByGroup,
567
618
  failures: allFailures,
568
619
  linksByPage,
620
+ omittedByPage,
569
621
  });
570
622
 
571
623
  // Build groupDeps map
@@ -600,6 +652,7 @@ function finalizeUnlocked(outDir) {
600
652
  ...manifestCompleteness({
601
653
  coverageReport, failures: allFailures, missingSpecIds, scopeUnmatched: scope?.unmatched ?? [],
602
654
  scopeLogicUncovered: (scope?.logic ?? []).filter((l) => !l.covered).map((l) => l.unit),
655
+ omittedReasonCodes: omittedByPage.size > 0 ? ["composition-omitted"] : [],
603
656
  }),
604
657
  };
605
658
 
@@ -5,10 +5,11 @@ import fs from "node:fs";
5
5
  import path from "node:path";
6
6
  import { types } from "node:util";
7
7
  import { slugify, toPosix } from "./lib/fsx.mjs";
8
- import { bfsFileEvidence, findLabelFile, declarationReferrers } from "./lib/hg.mjs";
8
+ import { bfsFileEvidence, findLabelFile, declarationReferrers, declarationInheritanceTargets, declarationInheritanceChain, COMPOSITION_EDGE_KINDS } from "./lib/hg.mjs";
9
9
  import { RUNTIME_RE, roleOf, bucketOf } from "./lib/footprint-roles.mjs";
10
10
  import { isExcludedEvidencePath } from "./facts-build.mjs";
11
11
  import { stableDigest } from "./behavior-model.mjs";
12
+ import { collectContractCalls } from "./contract-calls.mjs";
12
13
 
13
14
  // source resolution rung 1/2: a `declared_at` that already names a source file.
14
15
  const SOURCE_EXT_RE = /\.(java|kt|kts|vue|nvue|uvue|ets|js|mjs|cjs|jsx|ts|tsx)$/i;
@@ -38,6 +39,7 @@ function hasCompleteResolvedUniAppArtifact(page) {
38
39
 
39
40
  // BFS depth for footprint traversal.
40
41
  export const FOOTPRINT_DEPTH = 3;
42
+ export const COMPOSITION_DEPTH = 2;
41
43
 
42
44
  /**
43
45
  * The five values `resolvePageFiles` returns in `by`, as the single source of
@@ -261,6 +263,14 @@ function sortUnresolved(records) {
261
263
  });
262
264
  }
263
265
 
266
+ function sortByLocator(entries) {
267
+ return entries.sort((left, right) => {
268
+ const a = `${left.locator}\u0000${left.reason ?? ""}`;
269
+ const b = `${right.locator}\u0000${right.reason ?? ""}`;
270
+ return a < b ? -1 : a > b ? 1 : 0;
271
+ });
272
+ }
273
+
264
274
  /**
265
275
  * Resolve a page's composition origins while the graph is still open.
266
276
  *
@@ -348,6 +358,17 @@ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
348
358
  const sharedDeclaredAt = sharedDeclaredAtOf(pages);
349
359
 
350
360
  const out = new Map();
361
+ const contractCache = { rows: new Map(), text: new Map() };
362
+ const isExcludedContractTarget = value => {
363
+ const role = roleOf(value, roleCtx);
364
+ return role === "runtime" || role === "wiring";
365
+ };
366
+ const importsStmt = db.prepare(`
367
+ SELECT DISTINCT n2.file_path AS fp
368
+ FROM nodes n1 JOIN edges e ON e.source = n1.id
369
+ JOIN nodes n2 ON n2.id = e.target
370
+ WHERE n1.file_path = ? AND e.kind = 'imports' AND n2.file_path IS NOT NULL
371
+ `);
351
372
  for (const page of pages) {
352
373
  const { originUnits, originUnresolved } = compositionOrigins({
353
374
  page, sourceProject, db, sharedDeclaredAt,
@@ -362,12 +383,36 @@ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
362
383
  resolvedFile: null,
363
384
  origin_units: originUnits,
364
385
  unresolved: sortUnresolved(originUnresolved),
386
+ composition: new Set(),
387
+ bodyInheritance: new Set(),
388
+ compositionUnresolved: sortUnresolved(originUnresolved),
389
+ behaviorReachUnresolved: sortUnresolved(originUnresolved),
390
+ compositionFrontier: [],
391
+ reachOnly: [],
392
+ imports: [],
393
+ distance: {},
394
+ directInheritance: new Set(),
395
+ contractCalls: collectContractCalls({
396
+ db,
397
+ sourceProject,
398
+ page,
399
+ entry: {
400
+ resolvedFile: null,
401
+ composition: new Set(),
402
+ bodyInheritance: new Set(),
403
+ directInheritance: new Set(),
404
+ origin_units: originUnits,
405
+ },
406
+ isExcludedTarget: isExcludedContractTarget,
407
+ cache: contractCache,
408
+ }),
365
409
  });
366
410
  continue;
367
411
  }
368
412
 
369
413
  const all = new Set();
370
414
  const writable = new Set();
415
+ const distance = {};
371
416
  const reached = bfsFileEvidence(db, [file], { depth: FOOTPRINT_DEPTH });
372
417
  for (const raw of reached.resolved) {
373
418
  const f = normalize(raw);
@@ -381,12 +426,84 @@ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
381
426
  all.add(f);
382
427
  if (role === "writable") writable.add(f);
383
428
  }
429
+ for (const [raw, hops] of reached.distances ?? new Map()) {
430
+ const f = normalize(raw);
431
+ if (!Number.isInteger(hops) || hops < 0) continue;
432
+ if (!(f in distance) || hops < distance[f]) distance[f] = hops;
433
+ }
434
+
435
+ const stem = path.basename(file).replace(/\.[^.]+$/, "");
436
+ const inheritanceNames = [page.fqn, page.label, stem];
437
+ const directInheritance = new Set();
438
+ for (const raw of declarationInheritanceTargets(db, file, inheritanceNames)) {
439
+ const f = normalize(raw);
440
+ if (roleOf(f, roleCtx) === "runtime") continue;
441
+ directInheritance.add(f);
442
+ }
443
+ const bodyInheritance = new Set();
444
+ for (const raw of declarationInheritanceChain(db, file, inheritanceNames)) {
445
+ const f = normalize(raw);
446
+ if (roleOf(f, roleCtx) === "runtime" || f === file) continue;
447
+ bodyInheritance.add(f);
448
+ }
449
+
450
+ const compositionReached = bfsFileEvidence(db, [file], {
451
+ depth: COMPOSITION_DEPTH,
452
+ edgeKinds: COMPOSITION_EDGE_KINDS,
453
+ includeFrontier: true,
454
+ });
455
+ const composition = new Set();
456
+ for (const raw of compositionReached.resolved) {
457
+ const f = normalize(raw);
458
+ if (f === file || roleOf(f, roleCtx) === "runtime") continue;
459
+ composition.add(f);
460
+ }
461
+ const compositionFrontier = [];
462
+ for (const entry of compositionReached.frontier ?? []) {
463
+ const f = normalize(entry.locator);
464
+ if (f === file || roleOf(f, roleCtx) === "runtime") continue;
465
+ compositionFrontier.push({ locator: f, reason: entry.reason ?? "depth" });
466
+ }
467
+ for (const f of bodyInheritance) {
468
+ if (!all.has(f)) compositionFrontier.push({ locator: f, reason: "inheritance" });
469
+ }
470
+ const imports = new Set();
471
+ for (const row of importsStmt.all(file)) {
472
+ const f = normalize(row.fp);
473
+ if (f === file || roleOf(f, roleCtx) === "runtime") continue;
474
+ imports.add(f);
475
+ }
476
+ const reachOnly = [...all].filter(f =>
477
+ f !== file
478
+ && !composition.has(f)
479
+ && !bodyInheritance.has(f)
480
+ && !imports.has(f));
384
481
 
385
482
  const unresolvedByKey = new Map();
386
483
  for (const record of [...reached.unresolved, ...originUnresolved]) {
387
484
  const key = unresolvedKey(record);
388
485
  if (!unresolvedByKey.has(key)) unresolvedByKey.set(key, record);
389
486
  }
487
+ const compositionUnresolvedByKey = new Map();
488
+ for (const record of [...compositionReached.unresolved, ...originUnresolved]) {
489
+ const key = unresolvedKey(record);
490
+ if (!compositionUnresolvedByKey.has(key)) compositionUnresolvedByKey.set(key, record);
491
+ }
492
+
493
+ const contractCalls = collectContractCalls({
494
+ db,
495
+ sourceProject,
496
+ page,
497
+ entry: {
498
+ resolvedFile: file,
499
+ composition,
500
+ bodyInheritance,
501
+ directInheritance,
502
+ origin_units: originUnits,
503
+ },
504
+ isExcludedTarget: isExcludedContractTarget,
505
+ cache: contractCache,
506
+ });
390
507
 
391
508
  out.set(page.page_id, {
392
509
  all: new Set([...all].sort()),
@@ -394,6 +511,16 @@ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
394
511
  resolvedFile: file,
395
512
  origin_units: originUnits,
396
513
  unresolved: sortUnresolved([...unresolvedByKey.values()]),
514
+ composition: new Set([...composition].sort()),
515
+ bodyInheritance: new Set([...bodyInheritance].sort()),
516
+ compositionUnresolved: sortUnresolved([...compositionUnresolvedByKey.values()]),
517
+ behaviorReachUnresolved: sortUnresolved([...unresolvedByKey.values()]),
518
+ compositionFrontier: sortByLocator(compositionFrontier),
519
+ reachOnly: [...new Set(reachOnly)].sort(),
520
+ imports: [...imports].sort(),
521
+ distance,
522
+ directInheritance: new Set([...directInheritance].sort()),
523
+ contractCalls,
397
524
  });
398
525
  }
399
526
  return out;
@@ -512,7 +639,7 @@ const FEATURE_MARKERS = new Map([
512
639
  ]);
513
640
 
514
641
  /** Gradle module root of `file`: the path before its first `src/<sourceSet>/`. */
515
- function moduleRootOf(file) {
642
+ export function moduleRootOf(file) {
516
643
  const m = /^(?:(.*?)\/)?src\/[^/]+\//.exec(file);
517
644
  if (!m) return null; // decompiled trees have no `src/<set>/` layer
518
645
  return m[1] === undefined || m[1] === "" ? "." : m[1];
@@ -570,17 +570,25 @@ function runGates(opts, { partial }) {
570
570
  continue;
571
571
  }
572
572
 
573
- // Derive token and check it appears in scenario text
573
+ // A draft may name the claim itself: Compose routes and overlay names have
574
+ // no Chinese stem in the frozen vocabulary. A supplied token is matched
575
+ // verbatim in the claimed scenario's steps; without one, derive it from the
576
+ // item as before.
577
+ const supplied = typeof claim.claim_token === "string" ? claim.claim_token.trim() : "";
574
578
  let token;
575
- try {
576
- token = claimToken(claim.item, "edges", nodesById);
577
- } catch (err) {
578
- failures.push({
579
- gate: "G4",
580
- spec_id,
581
- message: `edge ${claim.item}: ${err.message}`,
582
- });
583
- continue;
579
+ if (supplied === "") {
580
+ try {
581
+ token = claimToken(claim.item, "edges", nodesById);
582
+ } catch (err) {
583
+ failures.push({
584
+ gate: "G4",
585
+ spec_id,
586
+ message: `edge ${claim.item}: ${err.message}`,
587
+ });
588
+ continue;
589
+ }
590
+ } else {
591
+ token = supplied;
584
592
  }
585
593
 
586
594
  const scenario = draft.scenarios[scenarioIdx];
@@ -599,7 +607,7 @@ function runGates(opts, { partial }) {
599
607
  // major semantic constituents appear (e.g., "下拉刷新" splits to "下拉" and "刷新").
600
608
  // This avoids false positives where scattered characters match non-consecutively.
601
609
  let hasToken = scenarioText.includes(token);
602
- if (!hasToken && token.length >= 4) {
610
+ if (!hasToken && supplied === "" && token.length >= 4) {
603
611
  // Try common 2-char splits for Chinese compound verbs
604
612
  const midpoint = Math.floor(token.length / 2);
605
613
  const part1 = token.slice(0, midpoint);
@@ -838,6 +846,7 @@ function runGates(opts, { partial }) {
838
846
  requireAuditArtifacts,
839
847
  });
840
848
  if (behavior) failures.push(...behavior.failures);
849
+ if (behavior) warnings.push(...(behavior.warnings ?? []));
841
850
 
842
851
  return {
843
852
  ok: failures.length === 0,
@@ -126,12 +126,58 @@ function pushToken(out, kind, label, value) {
126
126
  out.push({ kind, label, value: v });
127
127
  }
128
128
 
129
+ // 规则陈述是自由文本,只有其中的阿拉伯数字能被逐值核对。这些数字按步骤会写出的形态归一:
130
+ // 千分位去掉分隔符(`10,000` 记作 `10000`)、带符号的只取绝对值(`-32` 记作 `32`,因为步骤
131
+ // 用“减去”表达符号)、指数展开成十进制(`1e3` 记作 `1000`)。
132
+ //
133
+ // 起点的 lookbehind 有两层:`(?<![\w.])` 避开标识符与小数,`(?<![A-Za-z_]-)` 避开
134
+ // “字母-连字符-数字”的标签形态(`UTF-8`、`SHA-1`、`AES-256`),后者在归一符号时曾被放宽。
135
+ const RULE_NUMBER_RE = /(?<![\w.])(?<![A-Za-z_]-)([+-]?(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?(?:[eE][+-]?\d+)?)(?![\w.])/g;
136
+
137
+ // 日期与时刻是结构形态,不是规则可写错的常量:`2024-01-15` 在中文步骤里写作“2024 年 1 月 15 日”,
138
+ // 要求 `01` 逐字出现只会制造不可满足的 token。等长掩码保留下标,供 trailing 检查继续使用原文。
139
+ const DATE_OR_TIME_RE = /(?<![\w])(?:\d{4}-\d{1,2}-\d{1,2}|\d{1,2}:\d{2}(?::\d{2})?)(?![\w])/g;
140
+
141
+ // U+4F4D U+5C0F U+6570 即“位小数”;本文件与英文镜像共用同一份实现。
142
+ const DECIMAL_PLACES_RE = /^\s*(?:\u4f4d\u5c0f\u6570|decimals?(?:\s+places?)?(?![A-Za-z]))/i;
143
+
144
+ // 只描述“值怎么打印”的数字不是步骤能写错的事实:改它只改展示,不改规则结果。以下风格不入账,
145
+ // 其余一律入账——漏写的系数、偏移、阈值、枚举值仍然会失败。新增风格往这里加一条即可。
146
+ const RULE_DISPLAY_FORMATS = Object.freeze([
147
+ // 字段宽度:`小数部分固定为 00` 补足两位,不是数值。
148
+ (value) => /^0+$/.test(value) && value.length > 1,
149
+ // 精度:`保留 2 位小数` / `keep 2 decimal places` 数的是位数,不是数值。
150
+ (value, trailing) => DECIMAL_PLACES_RE.test(trailing),
151
+ ]);
152
+
153
+ function normalizeRuleNumber(literal) {
154
+ const unsigned = literal.replace(/^[+-]/, "").replace(/,/g, "");
155
+ if (!/[eE]/.test(unsigned)) return unsigned;
156
+ const expanded = String(Number(unsigned));
157
+ return /[eE]/.test(expanded) ? null : expanded;
158
+ }
159
+
160
+ function ruleNumberTokens(statement) {
161
+ const out = [];
162
+ const scan = statement.replace(DATE_OR_TIME_RE, (match) => " ".repeat(match.length));
163
+ for (const match of scan.matchAll(RULE_NUMBER_RE)) {
164
+ const literal = match[0];
165
+ const value = normalizeRuleNumber(literal);
166
+ if (value === null) continue;
167
+ const trailing = statement.slice(match.index + literal.length);
168
+ if (RULE_DISPLAY_FORMATS.some((isFormat) => isFormat(value, trailing))) continue;
169
+ out.push(value);
170
+ }
171
+ return out;
172
+ }
173
+
129
174
  /**
130
175
  * Every token the merged steps must contain, in authoring order, de-duplicated.
131
176
  *
132
- * `rules` is deliberately absent: a free-form statement ("华氏度等于摄氏度乘一点八加三十二")
133
- * cannot be matched token by token without inventing a parser, so rule coverage stays a review
134
- * checklist item instead of a gate claim. See `references/gates.md`.
177
+ * Endpoint/persistence/data contract values are read field by field. A `rules` statement is
178
+ * free-form prose, so it is not matched word by word; its numeric constants are. That keeps a
179
+ * conversion formula from being summarised as “apply the conversion rule” while the derived
180
+ * numbers never reach the SPEC.
135
181
  *
136
182
  * @param {object|null|undefined} contracts
137
183
  * @returns {Array<{kind: string, label: string, value: string}>}
@@ -145,6 +191,13 @@ export function factTokens(contracts) {
145
191
  out.push(...entryTokens(kind, entry));
146
192
  }
147
193
  }
194
+ for (const entry of entriesOf(contracts.rules)) {
195
+ const statement = text(entry?.statement);
196
+ if (statement === "") continue;
197
+ for (const value of ruleNumberTokens(statement)) {
198
+ pushToken(out, "rules", "number", value);
199
+ }
200
+ }
148
201
  const seen = new Set();
149
202
  return out.filter((token) => {
150
203
  const key = `${token.kind}|${token.label}|${token.value}`;
@@ -123,6 +123,21 @@ export function loadEvidenceFromDisk(root, pageId) {
123
123
  const dir = path.join(root, "evidence", stemOf(pageId));
124
124
  const composition = readJson(path.join(dir, "composition.json"));
125
125
  const schemaVersion = composition.schema_version ?? LEGACY_BEHAVIOR_SCHEMA_VERSION;
126
+ const contractEvidence = asArray(composition.contract_evidence);
127
+ const contractInventory = composition.contract_inventory ?? null;
128
+ const contractDispositions = asArray(composition.contract_dispositions);
129
+ const contractsFile = path.join(dir, "contracts.json");
130
+ if (fs.existsSync(contractsFile)) {
131
+ const contracts = readJson(contractsFile);
132
+ const sameContracts = stableDigest(contracts.evidence ?? []) === stableDigest(contractEvidence)
133
+ && stableDigest(contracts.inventory ?? null) === stableDigest(contractInventory)
134
+ && stableDigest(contracts.dispositions ?? []) === stableDigest(contractDispositions);
135
+ if (!sameContracts) {
136
+ throw new Error(`contract evidence mismatch for ${pageId}`);
137
+ }
138
+ } else if (contractEvidence.length > 0 || contractInventory !== null || contractDispositions.length > 0) {
139
+ throw new Error(`contract evidence missing for ${pageId}`);
140
+ }
126
141
  return {
127
142
  schema_version: schemaVersion,
128
143
  profile: composition.profile,
@@ -141,6 +156,18 @@ export function loadEvidenceFromDisk(root, pageId) {
141
156
  ?? (schemaVersion === LEGACY_BEHAVIOR_SCHEMA_VERSION ? legacyGraphEvidence() : null),
142
157
  operation_candidates: asArray(composition.operation_candidates),
143
158
  outbound_evidence: asArray(composition.outbound_evidence),
159
+ composition: asArray(composition.composition),
160
+ body_inheritance: asArray(composition.body_inheritance),
161
+ composition_unresolved: asArray(composition.composition_unresolved),
162
+ behavior_reach_unresolved: composition.behavior_reach_unresolved ?? null,
163
+ composition_frontier: asArray(composition.composition_frontier),
164
+ reach_only: composition.reach_only ?? null,
165
+ imports: asArray(composition.imports),
166
+ contract_evidence: contractEvidence,
167
+ contract_inventory: contractInventory,
168
+ contract_dispositions: contractDispositions,
169
+ scope_exclusions: asArray(composition.scope_exclusions),
170
+ trim_exclusions: asArray(composition.trim_exclusions),
144
171
  candidates: readJson(path.join(dir, "candidates.json")),
145
172
  assertions: readJson(path.join(dir, "assertions.json")),
146
173
  unknowns: readJson(path.join(dir, "unknowns.json")),
@@ -24,6 +24,10 @@ const require = createRequire(import.meta.url);
24
24
  /** Edge kinds excluded from BFS traversal. */
25
25
  export const EXCLUDED_EDGE_KINDS = ["contains"];
26
26
 
27
+ export const COMPOSITION_EDGE_KINDS = Object.freeze([
28
+ "imports", "references", "instantiates",
29
+ ]);
30
+
27
31
  /** Edge kinds traversed by BFS (every kind except `contains`). */
28
32
  export const TRAVERSED_EDGE_KINDS = [
29
33
  "calls",
@@ -461,8 +465,12 @@ export function openReadOnly(sourceProject) {
461
465
  * @returns {{resolved: Set<string>, unresolved: Array<{referring_file: string,
462
466
  * locator: string, target_node_id: string, kind: string}>}}
463
467
  */
464
- export function bfsFileEvidence(db, startFiles, { depth = 3 } = {}) {
465
- const placeholders = TRAVERSED_EDGE_KINDS.map(() => "?").join(",");
468
+ export function bfsFileEvidence(db, startFiles, {
469
+ depth = 3,
470
+ edgeKinds = TRAVERSED_EDGE_KINDS,
471
+ includeFrontier = false,
472
+ } = {}) {
473
+ const placeholders = edgeKinds.map(() => "?").join(",");
466
474
  const expand = db.prepare(`
467
475
  SELECT DISTINCT n1.file_path AS referring_file, e.target AS target_node_id, e.kind, n2.file_path AS fp
468
476
  FROM nodes n1
@@ -483,21 +491,31 @@ export function bfsFileEvidence(db, startFiles, { depth = 3 } = {}) {
483
491
  const projectIndex = hasUnresolvedRefs ? projectSourceNames(db) : null;
484
492
 
485
493
  const visited = new Set();
494
+ const distances = new Map();
495
+ const frontier = new Map();
486
496
  const queue = [];
487
497
  const unresolvedByKey = new Map();
488
498
 
489
499
  for (const f of startFiles) {
490
500
  if (f !== null && f !== undefined && !visited.has(f)) {
491
501
  visited.add(f);
502
+ distances.set(f, 0);
492
503
  queue.push({ file: f, dist: 0 });
493
504
  }
494
505
  }
495
506
 
496
507
  while (queue.length > 0) {
497
508
  const { file, dist } = queue.shift();
498
- if (dist >= depth) continue;
509
+ if (dist >= depth) {
510
+ if (includeFrontier) {
511
+ for (const row of expand.all(file, ...edgeKinds)) {
512
+ if (row.fp) frontier.set(row.fp, { locator: row.fp, reason: "depth" });
513
+ }
514
+ }
515
+ continue;
516
+ }
499
517
 
500
- const rows = expand.all(file, ...TRAVERSED_EDGE_KINDS);
518
+ const rows = expand.all(file, ...edgeKinds);
501
519
  for (const row of expandUnresolved?.all(file) ?? []) {
502
520
  if (!SOURCE_UNIT_REFERENCE_KIND_SET.has(row.reference_kind)) continue;
503
521
  if (!namesKnownProjectSymbol(row.reference_name, projectIndex, row.file_path)) continue;
@@ -528,6 +546,7 @@ export function bfsFileEvidence(db, startFiles, { depth = 3 } = {}) {
528
546
  }
529
547
  if (!visited.has(fp)) {
530
548
  visited.add(fp);
549
+ distances.set(fp, dist + 1);
531
550
  queue.push({ file: fp, dist: dist + 1 });
532
551
  }
533
552
  }
@@ -543,7 +562,12 @@ export function bfsFileEvidence(db, startFiles, { depth = 3 } = {}) {
543
562
  return left < right ? -1 : left > right ? 1 : 0;
544
563
  });
545
564
 
546
- return { resolved: visited, unresolved };
565
+ return {
566
+ resolved: visited,
567
+ unresolved,
568
+ distances,
569
+ frontier: [...frontier.values()].sort((a, b) => (a.locator < b.locator ? -1 : a.locator > b.locator ? 1 : 0)),
570
+ };
547
571
  }
548
572
 
549
573
  /**
@@ -565,6 +589,91 @@ export function bfsFiles(db, startFiles, opts = {}) {
565
589
  return bfsFileEvidence(db, startFiles, opts).resolved;
566
590
  }
567
591
 
592
+ /**
593
+ * Direct `extends`/`implements` targets of a page body's declaring class.
594
+ *
595
+ * File-scoped inheritance edges also carry inner/anonymous classes, so the
596
+ * caller supplies the page's class names. When no declaration matches (for
597
+ * example a Compose or uni-app body), the file-scoped set is returned as a
598
+ * conservative fallback.
599
+ *
600
+ * @param {import("node:sqlite").DatabaseSync} db
601
+ * @param {string} file — page body file_path
602
+ * @param {string[]} [names] — page fqn/label/stem candidates
603
+ * @returns {Set<string>} target file_path values
604
+ */
605
+ export function declarationInheritanceTargets(db, file, names = []) {
606
+ const rows = db.prepare(`
607
+ SELECT DISTINCT n1.name AS source_name, n1.kind AS source_kind, n2.file_path AS fp
608
+ FROM nodes n1
609
+ JOIN edges e ON e.source = n1.id
610
+ JOIN nodes n2 ON n2.id = e.target
611
+ WHERE n1.file_path = ?
612
+ AND n1.kind IN ('class', 'interface', 'struct')
613
+ AND e.kind IN ('extends', 'implements')
614
+ AND n2.file_path IS NOT NULL
615
+ `).all(file);
616
+ const wanted = names.filter(name => typeof name === "string" && name !== "");
617
+ const matches = wanted.length === 0 ? rows : rows.filter(row =>
618
+ wanted.some(name =>
619
+ row.source_name === name
620
+ || name.endsWith(`.${row.source_name}`)
621
+ || row.source_name.endsWith(`.${name}`)));
622
+ const chosen = matches.length > 0 ? matches : rows;
623
+ return new Set(chosen.map(row => row.fp).filter(Boolean));
624
+ }
625
+
626
+ /**
627
+ * Transitive `extends`/`implements` chain from a page body's declaring class.
628
+ * Each hop is declaration-scoped, so inner/anonymous classes never contribute.
629
+ *
630
+ * @param {import("node:sqlite").DatabaseSync} db
631
+ * @param {string} file — page body file_path
632
+ * @param {string[]} names — page fqn/label/stem candidates
633
+ * @param {{ maxDepth?: number }} [opts]
634
+ * @returns {Set<string>} inherited file_path values (the body itself excluded)
635
+ */
636
+ export function declarationInheritanceChain(db, file, names = [], { maxDepth = 8 } = {}) {
637
+ const stmt = db.prepare(`
638
+ SELECT DISTINCT n1.name AS source_name, n2.name AS target_name, n2.file_path AS fp
639
+ FROM nodes n1
640
+ JOIN edges e ON e.source = n1.id
641
+ JOIN nodes n2 ON n2.id = e.target
642
+ WHERE n1.file_path = ?
643
+ AND n1.kind IN ('class', 'interface', 'struct')
644
+ AND e.kind IN ('extends', 'implements')
645
+ AND n2.file_path IS NOT NULL
646
+ `);
647
+ const chain = new Set();
648
+ const seen = new Set();
649
+ let queue = [{ file, names }];
650
+ let depth = 0;
651
+ while (queue.length > 0 && depth < maxDepth) {
652
+ depth += 1;
653
+ const next = [];
654
+ for (const item of queue) {
655
+ if (seen.has(item.file)) continue;
656
+ seen.add(item.file);
657
+ const rows = stmt.all(item.file);
658
+ const wanted = item.names.filter(name => typeof name === "string" && name !== "");
659
+ const matches = wanted.length === 0 ? rows : rows.filter(row =>
660
+ wanted.some(name =>
661
+ row.source_name === name
662
+ || name.endsWith(`.${row.source_name}`)
663
+ || row.source_name.endsWith(`.${name}`)));
664
+ const chosen = matches.length > 0 ? matches : rows;
665
+ for (const row of chosen) {
666
+ const fp = row.fp;
667
+ if (!fp || fp === file) continue;
668
+ chain.add(fp);
669
+ next.push({ file: fp, names: [row.target_name] });
670
+ }
671
+ }
672
+ queue = next;
673
+ }
674
+ return chain;
675
+ }
676
+
568
677
  /**
569
678
  * Files that reference a *declaration* (type or top-level function) declared in
570
679
  * `file` through an ownership edge, one hop away.