@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
@@ -188,9 +188,9 @@ class Position {
188
188
  }
189
189
 
190
190
  class FakeInvoke {
191
- signature: string;
192
- constructor(signature: string) { this.signature = signature; }
193
- getMethodSignature(): string { return this.signature; }
191
+ signature: string | FakeMethodSignature;
192
+ constructor(signature: string | FakeMethodSignature) { this.signature = signature; }
193
+ getMethodSignature(): string | FakeMethodSignature { return this.signature; }
194
194
  getArgs(): unknown[] { return []; }
195
195
  }
196
196
 
@@ -216,8 +216,8 @@ class ArkIfStmt {
216
216
  class ArkInvokeStmt {
217
217
  text: string;
218
218
  line: number;
219
- signature: string;
220
- constructor(text: string, line: number, signature: string) {
219
+ signature: string | FakeMethodSignature;
220
+ constructor(text: string, line: number, signature: string | FakeMethodSignature) {
221
221
  this.text = text; this.line = line; this.signature = signature;
222
222
  }
223
223
  getOriginalText(): string { return this.text; }
@@ -237,12 +237,23 @@ class ArkAssignStmt {
237
237
  getRightOp() { return this.signature === '' ? undefined : new ArkStaticInvokeExpr(this.signature); }
238
238
  }
239
239
 
240
+ /**
241
+ * The real ArkAnalyzer returns a `MethodSignature` object, not a string. The plain fakes above
242
+ * pass a string, which is why a `typeof signature !== 'string'` guard passed every unit test while
243
+ * the receiver gate silently disabled the whole rule in a real run. This shape pins the integration.
244
+ */
245
+ class FakeMethodSignature {
246
+ text: string;
247
+ constructor(text: string) { this.text = text; }
248
+ toString(): string { return this.text; }
249
+ }
250
+
240
251
  const IMAGE_SIG = '@ohos.multimedia.image: image.createImageSource(buf: ArrayBuffer)';
241
252
  const WRAPPER_SIG = 'ImageUtil.createImageSource(bytes: Uint8Array)';
242
253
 
243
- function runCheck(stmts: unknown[]) {
254
+ function runCheck(stmts: unknown[], filePath = '/proj/pages/A.ets') {
244
255
  const checker = new mod.PlatformApiContractCheck();
245
- checker.check(new FakeMethod(stmts));
256
+ checker.check(new FakeMethod(stmts, filePath));
246
257
  return checker.issues;
247
258
  }
248
259
 
@@ -306,3 +317,335 @@ test('fake CFG: a guarded nullable result stays silent', () => {
306
317
  ]);
307
318
  assert.deepEqual(issues, []);
308
319
  });
320
+
321
+ // ---------------------------------------------------------------- sql-capability
322
+
323
+ const SQL_CAPS = {
324
+ platforms: {
325
+ HarmonyOS: {
326
+ modules: { fts5: true },
327
+ tokenizers: { unicode61: true, ascii: true, porter: true, trigram: true, icu: false },
328
+ },
329
+ },
330
+ };
331
+
332
+ test('a tokenizer the target platform lacks is a finding', () => {
333
+ const found = mod.sqlCapabilityFindings(
334
+ "const sql = \"CREATE VIRTUAL TABLE IF NOT EXISTS lyric_fts USING fts5(title, content, tokenize = 'icu')\";",
335
+ SQL_CAPS, 'HarmonyOS');
336
+ assert.equal(found.length, 1);
337
+ assert.equal(found[0].feature, 'tokenizer');
338
+ assert.equal(found[0].name, 'icu');
339
+ assert.equal(found[0].table, 'lyric_fts');
340
+ });
341
+
342
+ test('quoted, double-quoted and bare tokenizer values are all recognised', () => {
343
+ for (const decl of ["tokenize = 'icu'", 'tokenize = "icu"', 'tokenize = icu']) {
344
+ const found = mod.sqlCapabilityFindings(
345
+ 'CREATE VIRTUAL TABLE t USING fts5(content, ' + decl + ')', SQL_CAPS, 'HarmonyOS');
346
+ assert.equal(found.length, 1, decl);
347
+ }
348
+ });
349
+
350
+ test('a supported tokenizer (including trailing options) stays silent', () => {
351
+ for (const decl of ['tokenize = \'unicode61\'', "tokenize = 'unicode61 remove_diacritics 2'", 'tokenize = trigram']) {
352
+ assert.deepEqual(
353
+ mod.sqlCapabilityFindings('CREATE VIRTUAL TABLE t USING fts5(c, ' + decl + ')', SQL_CAPS, 'HarmonyOS'),
354
+ [], decl);
355
+ }
356
+ });
357
+
358
+ test('an unknown tokenizer, an unknown platform and a missing table all stay silent', () => {
359
+ assert.deepEqual(
360
+ mod.sqlCapabilityFindings("CREATE VIRTUAL TABLE t USING fts5(c, tokenize = 'jieba')", SQL_CAPS, 'HarmonyOS'),
361
+ []);
362
+ assert.deepEqual(
363
+ mod.sqlCapabilityFindings("CREATE VIRTUAL TABLE t USING fts5(c, tokenize = 'icu')", SQL_CAPS, 'OpenHarmony'),
364
+ []);
365
+ assert.deepEqual(
366
+ mod.sqlCapabilityFindings("CREATE VIRTUAL TABLE t USING fts5(c, tokenize = 'icu')", {}, 'HarmonyOS'),
367
+ []);
368
+ });
369
+
370
+ test('a module the platform lacks is reported like a tokenizer', () => {
371
+ const caps = { platforms: { HarmonyOS: { modules: { fts5: true, fts4: false } } } };
372
+ const found = mod.sqlCapabilityFindings('CREATE VIRTUAL TABLE t USING fts4(content)', caps, 'HarmonyOS');
373
+ assert.equal(found.length, 1);
374
+ assert.equal(found[0].feature, 'module');
375
+ assert.equal(found[0].subject, 'USING fts4');
376
+ });
377
+
378
+ test('a string-concatenated DDL spread over lines is still recognised', () => {
379
+ // the shape a schema helper actually writes
380
+ const text = [
381
+ " const createSql: string = 'CREATE VIRTUAL TABLE IF NOT EXISTS ' + name + ' USING fts5(' +",
382
+ " columns.join(', ') + \", tokenize = 'icu')\";",
383
+ ].join('\n');
384
+ const found = mod.sqlCapabilityFindings(text, SQL_CAPS, 'HarmonyOS');
385
+ assert.equal(found.length, 1);
386
+ assert.equal(found[0].feature, 'tokenizer');
387
+ assert.equal(found[0].name, 'icu');
388
+ assert.equal(found[0].line, 1);
389
+ assert.equal(found[0].table, '(dynamic)');
390
+ });
391
+
392
+ test('a tokenizer supplied through a variable is out of scope (silent)', () => {
393
+ const text = "const sql = 'CREATE VIRTUAL TABLE t USING fts5(c, tokenize = ' + tokenizer + ')';";
394
+ assert.deepEqual(mod.sqlCapabilityFindings(text, SQL_CAPS, 'HarmonyOS'), []);
395
+ });
396
+
397
+ test('runtimeOS is resolved by walking up to build-profile.json5', () => {
398
+ const fs = requireFromHere('node:fs');
399
+ const os = requireFromHere('node:os');
400
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ht-caps-'));
401
+ fs.writeFileSync(path.join(root, 'build-profile.json5'),
402
+ '{ app: { products: [ { name: "default", runtimeOS: "HarmonyOS" } ] } }', 'utf8');
403
+ const nested = path.join(root, 'features', 'a', 'src');
404
+ fs.mkdirSync(nested, { recursive: true });
405
+ assert.equal(mod.resolveRuntimeOS(path.join(nested, 'AppDatabase.ets')), 'HarmonyOS');
406
+ assert.equal(mod.resolveRuntimeOS(path.join(os.tmpdir(), 'no-project', 'x.ets')), '');
407
+ fs.rmSync(root, { recursive: true, force: true });
408
+ });
409
+
410
+ test('a module-level build-profile without runtimeOS does not stop the walk', () => {
411
+ const fs = requireFromHere('node:fs');
412
+ const os = requireFromHere('node:os');
413
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ht-caps-mod-'));
414
+ fs.writeFileSync(path.join(root, 'build-profile.json5'),
415
+ '{ "app": { "products": [ { "runtimeOS": "HarmonyOS" } ] } }', 'utf8');
416
+ const har = path.join(root, 'common', 'data');
417
+ fs.mkdirSync(har, { recursive: true });
418
+ fs.writeFileSync(path.join(har, 'build-profile.json5'),
419
+ '{ "apiType": "stageMode", "buildOption": {} }', 'utf8');
420
+ const dbDir = path.join(har, 'src', 'main', 'ets', 'database');
421
+ fs.mkdirSync(dbDir, { recursive: true });
422
+ assert.equal(mod.resolveRuntimeOS(path.join(dbDir, 'AppDatabase.ets')), 'HarmonyOS');
423
+ fs.rmSync(root, { recursive: true, force: true });
424
+ });
425
+
426
+ // ---------------------------------------------------------------- image-src-form
427
+
428
+ test('a runtime image source is a checkpoint', () => {
429
+ const found = mod.imageSrcFindings(' Image(item.image)');
430
+ assert.equal(found.length, 1);
431
+ assert.equal(found[0].arg, 'item.image');
432
+ assert.equal(found[0].line, 1);
433
+ });
434
+
435
+ test('a call with nested parentheses keeps the whole argument', () => {
436
+ const found = mod.imageSrcFindings(' Image(this.specImage(spec))');
437
+ assert.equal(found.length, 1);
438
+ assert.equal(found[0].arg, 'this.specImage(spec)');
439
+ });
440
+
441
+ test('compile-time resources, PixelMap values, bare identifiers and comments stay silent', () => {
442
+ const silent = [
443
+ " Image($r('app.media.ic_arrow_back_filled'))",
444
+ " Image($rawfile('a.png'))",
445
+ ' Image(this.pixelMap)',
446
+ ' Image(icon)',
447
+ " Image(this.show ? $r('a') : $r('b'))",
448
+ ' // Image(painterResource(R.drawable.avatar), size 36.dp)',
449
+ ' * Image(fillMaxSize, ContentScale.Inside)',
450
+ ];
451
+ for (const text of silent) {
452
+ assert.deepEqual(mod.imageSrcFindings(text), [], text);
453
+ }
454
+ });
455
+
456
+ test('a template literal and two calls on one line are each reported', () => {
457
+ const found = mod.imageSrcFindings(
458
+ ' Image(`data:image/png;base64,${payload}`); Image(this.captchaImageSrc)');
459
+ assert.equal(found.length, 2);
460
+ assert.equal(found[0].arg, '`data:image/png;base64,${payload}`');
461
+ assert.equal(found[1].arg, 'this.captchaImageSrc');
462
+ });
463
+
464
+ test('static image literals are not runtime sources', () => {
465
+ assert.deepEqual(mod.imageSrcFindings("Image('https://example.com/a.png')"), []);
466
+ assert.deepEqual(mod.imageSrcFindings('Image("/common/images/a.png")'), []);
467
+ });
468
+
469
+ test('the image-src-form message names the argument (no %s left)', () => {
470
+ const fs = requireFromHere('node:fs');
471
+ const os = requireFromHere('node:os');
472
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ht-img-'));
473
+ const file = path.join(dir, 'A.ets');
474
+ fs.writeFileSync(file, ' Image(item.image)\n', 'utf8');
475
+ const issues = runCheck([new ArkInvokeStmt(' Image(item.image)', 1, '')], file);
476
+ assert.equal(issues.length, 1);
477
+ assert.match(issues[0].message.en, /Image\(item\.image\)/);
478
+ assert.ok(!issues[0].message.en.includes('%s'));
479
+ assert.ok(issues[0].message.cn.indexOf('%s') < 0);
480
+ fs.rmSync(dir, { recursive: true, force: true });
481
+ });
482
+
483
+ // ---------------------------------------------------------------- review fixes
484
+
485
+ test('an encoder called on a reused helper instance is accepted', () => {
486
+ const found = mod.selectEncodedArgFindings([
487
+ plainEvent('const helper = new util.Base64Helper();', 1),
488
+ plainEvent('const b64 = helper.encodeToStringSync(bytes);', 2),
489
+ loadDataEvent("this.controller.loadData(b64, 'text/html', 'base64');", 3),
490
+ ], contract);
491
+ assert.deepEqual(found, []);
492
+ });
493
+
494
+ test('an unencoded literal without # or % is not the failure this rule models', () => {
495
+ const plain = mod.selectEncodedArgFindings([
496
+ loadDataEvent("this.controller.loadData('<html><body>hi</body></html>', 'text/html', 'UTF-8');", 1),
497
+ ], contract);
498
+ assert.deepEqual(plain, []);
499
+ const risky = mod.selectEncodedArgFindings([
500
+ loadDataEvent("this.controller.loadData('<p style=\"color:#fff\">hi</p>', 'text/html', 'UTF-8');", 1),
501
+ ], contract);
502
+ assert.equal(risky.length, 1);
503
+ });
504
+
505
+ test('a second DDL inside the window does not leak its tokenize into the first', () => {
506
+ const text = [
507
+ "const a = 'CREATE VIRTUAL TABLE t1 USING fts5(c1)';",
508
+ "const b = 'CREATE VIRTUAL TABLE t2 USING fts5(' + \"c2, tokenize = 'icu')\";",
509
+ ].join('\n');
510
+ const found = mod.sqlCapabilityFindings(text, SQL_CAPS, 'HarmonyOS');
511
+ assert.equal(found.length, 1);
512
+ assert.equal(found[0].line, 2);
513
+ });
514
+
515
+ test('comments are stripped before scanning, string content is kept', () => {
516
+ const code = mod.stripComments([
517
+ "// CREATE VIRTUAL TABLE t USING fts5(c, tokenize = 'icu')",
518
+ "/* CREATE VIRTUAL TABLE u USING fts5(c, tokenize = 'icu') */",
519
+ "const sql = 'CREATE VIRTUAL TABLE v USING fts5(c, tokenize = ' + \"'icu')\";",
520
+ ].join('\n'));
521
+ assert.ok(code.indexOf('CREATE VIRTUAL TABLE t') < 0);
522
+ assert.ok(code.indexOf('CREATE VIRTUAL TABLE u') < 0);
523
+ assert.ok(code.indexOf('CREATE VIRTUAL TABLE v') >= 0);
524
+ });
525
+
526
+ test('the runtimeOS walk stops at a project root without runtimeOS', () => {
527
+ const fs = requireFromHere('node:fs');
528
+ const os = requireFromHere('node:os');
529
+ const outer = fs.mkdtempSync(path.join(os.tmpdir(), 'ht-root-'));
530
+ fs.writeFileSync(path.join(outer, 'build-profile.json5'),
531
+ '{ "app": { "products": [ { "runtimeOS": "HarmonyOS" } ] } }', 'utf8');
532
+ const proj = path.join(outer, 'proj');
533
+ fs.mkdirSync(path.join(proj, 'src'), { recursive: true });
534
+ fs.writeFileSync(path.join(proj, 'build-profile.json5'),
535
+ '{ "app": { "products": [ { "name": "default" } ] }, "modules": [] }', 'utf8');
536
+ assert.equal(mod.resolveRuntimeOS(path.join(proj, 'src', 'A.ets')), '');
537
+ fs.rmSync(outer, { recursive: true, force: true });
538
+ });
539
+
540
+ // ---------------------------------------------------------------- encoded-arg-missing
541
+
542
+ /** Statement event for a call site whose callee is the ArkWeb controller's `loadData`. */
543
+ function loadDataEvent(text: string, line: number, qualified = true) {
544
+ return { text, line, col: 0, api: 'loadData', qualified };
545
+ }
546
+
547
+ test('the contract ships the loadData encoded-arg whitelist', () => {
548
+ const spec = contract.argContracts.loadData;
549
+ assert.equal(spec.argIndex, 0);
550
+ assert.equal(spec.argKind, 'encoded');
551
+ assert.match(spec.receiver, /WebviewController/);
552
+ assert.ok(spec.encoders.some((p: string) => p.includes('encodeToStringSync')));
553
+ assert.ok(spec.encoders.some((p: string) => p.includes('encodeURIComponent')));
554
+ // The d.ts escape hatch: a non-empty baseUrl/historyUrl loads the payload as ordinary HTML.
555
+ assert.ok(spec.acceptWhen.some((r: { arg: number; nonEmpty?: boolean }) => r.arg === 3 && r.nonEmpty === true));
556
+ assert.ok(spec.acceptWhen.some((r: { arg: number; nonEmpty?: boolean }) => r.arg === 4 && r.nonEmpty === true));
557
+ assert.ok(spec.acceptWhen.some((r: { arg: number; equalsLiteral?: string }) =>
558
+ r.arg === 2 && String(r.equalsLiteral).toLowerCase() === 'base64'));
559
+ });
560
+
561
+ test('raw HTML in the loadData data slot is a finding', () => {
562
+ const found = mod.selectEncodedArgFindings([
563
+ loadDataEvent("this.controller.loadData(this.buildHtml(e), 'text/html', 'UTF-8');", 151),
564
+ ], contract);
565
+ assert.equal(found.length, 1);
566
+ assert.equal(found[0].line, 151);
567
+ assert.match(found[0].expect, /编码|encoded/i);
568
+ });
569
+
570
+ test('the buffer selector ignores encoded-arg contracts (single owner per shape)', () => {
571
+ const found = mod.selectBufferArgFindings([
572
+ loadDataEvent("this.controller.loadData(html, 'text/html', 'UTF-8');", 151),
573
+ ], contract);
574
+ assert.deepEqual(found, []);
575
+ });
576
+
577
+ test('inline and traced encoders never fire', () => {
578
+ const silent = [
579
+ "this.controller.loadData(new util.Base64Helper().encodeToStringSync(new util.TextEncoder().encodeInto(html)), 'text/html', 'base64');",
580
+ "this.controller.loadData(encodeURIComponent(html), 'text/html', 'UTF-8');",
581
+ ];
582
+ for (const text of silent) {
583
+ assert.deepEqual(mod.selectEncodedArgFindings([loadDataEvent(text, 1)], contract), [], text);
584
+ }
585
+ const traced = mod.selectEncodedArgFindings([
586
+ plainEvent('const b64 = new util.Base64Helper().encodeToStringSync(new util.TextEncoder().encodeInto(html));', 1),
587
+ loadDataEvent("this.controller.loadData(b64, 'text/html', 'base64');", 2),
588
+ ], contract);
589
+ assert.deepEqual(traced, []);
590
+ });
591
+
592
+ test('a call from a same-named non-controller owner never fires', () => {
593
+ assert.deepEqual(mod.selectEncodedArgFindings([
594
+ loadDataEvent('this.dao.loadData(html);', 3, false),
595
+ ], contract), []);
596
+ });
597
+
598
+ test('baseUrl/historyUrl non-empty and encoding=base64 are legal loadData forms', () => {
599
+ const silent = [
600
+ "this.controller.loadData(html, 'text/html', 'UTF-8', ' ', ' ');",
601
+ "this.controller.loadData(html, 'text/html', 'UTF-8', ' ', '');",
602
+ "this.controller.loadData(html, 'text/html', 'base64');",
603
+ ];
604
+ for (const text of silent) {
605
+ assert.deepEqual(mod.selectEncodedArgFindings([loadDataEvent(text, 1)], contract), [], text);
606
+ }
607
+ const stillFinding = [
608
+ "this.controller.loadData(html, 'text/html', 'UTF-8', '', '');",
609
+ "this.controller.loadData(html, 'text/html', 'UTF-8', baseUrl, historyUrl);",
610
+ // A declared encoding cannot override provably raw content.
611
+ "this.controller.loadData('<p style=\"color:#fff\">hi</p>', 'text/html', 'base64');",
612
+ ];
613
+ for (const text of stillFinding) {
614
+ assert.equal(mod.selectEncodedArgFindings([loadDataEvent(text, 1)], contract).length, 1, text);
615
+ }
616
+ });
617
+
618
+ test('a MethodSignature object (real ArkAnalyzer shape) still passes the receiver gate', () => {
619
+ const WEBVIEW_SIG = '@ohos.web.webview: webview.WebviewController.loadData(data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string)';
620
+ const raw = runCheck([
621
+ new ArkInvokeStmt("this.controller.loadData(html, 'text/html', 'UTF-8');", 151,
622
+ new FakeMethodSignature(WEBVIEW_SIG)),
623
+ ]);
624
+ assert.equal(raw.length, 1);
625
+ assert.equal(raw[0].line, 151);
626
+ assert.equal(raw[0].severity, WARN);
627
+ });
628
+
629
+ test('fake CFG: raw loadData is WARN, encoded is silent, other owners are silent', () => {
630
+ const WEBVIEW_SIG = '@ohos.web.webview: webview.WebviewController.loadData(data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string)';
631
+ const OTHER_SIG = 'Repo.loadData(payload: string)';
632
+
633
+ const raw = runCheck([
634
+ new ArkAssignStmt('const html = this.buildHtml(e);', 150, ''),
635
+ new ArkInvokeStmt("this.controller.loadData(html, 'text/html', 'UTF-8');", 151, WEBVIEW_SIG),
636
+ ]);
637
+ assert.equal(raw.length, 1);
638
+ assert.equal(raw[0].line, 151);
639
+ assert.equal(raw[0].severity, WARN);
640
+ assert.match(raw[0].message.en, /^\[encoded-arg-missing\]/);
641
+
642
+ const ok = runCheck([
643
+ new ArkInvokeStmt("this.controller.loadData(encodeURIComponent(html), 'text/html', 'UTF-8');", 151, WEBVIEW_SIG),
644
+ ]);
645
+ assert.deepEqual(ok, []);
646
+
647
+ const other = runCheck([
648
+ new ArkInvokeStmt('this.dao.loadData(html);', 3, OTHER_SIG),
649
+ ]);
650
+ assert.deepEqual(other, []);
651
+ });
@@ -0,0 +1,185 @@
1
+ // Tests for @hometrans/route-page-side-effect-import
2
+ // (rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js): a HAR/HSP
3
+ // @Entry({routeName}) page must have a side-effect import in every consuming HAP; named imports
4
+ // and barrels do not count; HAP-owned pages and orphan libraries stay silent; multi-HAP is
5
+ // per-HAP; comments are ignored.
6
+ import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from 'node:fs';
7
+ import * as os from 'node:os';
8
+ import * as path from 'node:path';
9
+ import { test, type TestContext } from 'node:test';
10
+ import assert from 'node:assert/strict';
11
+ import { createRequire } from 'node:module';
12
+ import { fileURLToPath } from 'node:url';
13
+
14
+ const requireFromHere = createRequire(import.meta.url);
15
+ const HERE = path.dirname(fileURLToPath(import.meta.url));
16
+ const RULES_DIR = path.join(HERE, '..', 'rules', 'migration-rules');
17
+
18
+ process.env.HOMECHECK_MODULE_PATH = path.join(HERE, 'fixtures', 'homecheck-stub.cjs');
19
+
20
+ const { RoutePageSideEffectImportCheck } = requireFromHere(
21
+ path.join(RULES_DIR, 'lib', 'checker', 'RoutePageSideEffectImportCheck.js'),
22
+ );
23
+
24
+ const ERROR = 2; // AlertLevel.ERROR
25
+
26
+ function project(t: TestContext, files: Record<string, string>): string {
27
+ const root = mkdtempSync(path.join(os.tmpdir(), 'a2h-route-side-effect-'));
28
+ t.after(() => rmSync(root, { recursive: true, force: true }));
29
+ for (const [rel, content] of Object.entries(files)) {
30
+ const target = path.join(root, rel);
31
+ mkdirSync(path.dirname(target), { recursive: true });
32
+ writeFileSync(target, content, 'utf8');
33
+ }
34
+ return root;
35
+ }
36
+
37
+ function runCheck(root: string, sceneFiles: string[]) {
38
+ const checker = new RoutePageSideEffectImportCheck();
39
+ checker.checkScene({
40
+ getFiles: () => sceneFiles.map((rel) => ({ getFilePath: () => path.join(root, rel) })),
41
+ });
42
+ return checker.issues;
43
+ }
44
+
45
+ const LIB_PAGE = `@Entry({ routeName: 'Lib.Page' })
46
+ @ComponentV2
47
+ export struct LibPage {
48
+ build() { Text('lib') }
49
+ }
50
+ `;
51
+
52
+ const BASE = {
53
+ 'AppScope/app.json5': '{ "app": { "bundleName": "example.app" } }',
54
+ 'products/app/oh-package.json5':
55
+ '{ "name": "app", "dependencies": { "lib": "file:../../libs/lib" } }',
56
+ 'products/app/src/main/module.json5': '{ "module": { "name": "app", "type": "entry" } }',
57
+ 'libs/lib/oh-package.json5': '{ "name": "lib", "main": "Index.ets" }',
58
+ 'libs/lib/src/main/module.json5': '{ "module": { "name": "lib", "type": "har" } }',
59
+ 'libs/lib/src/main/ets/pages/LibPage.ets': LIB_PAGE,
60
+ };
61
+
62
+ const SCENE = ['products/app/src/main/ets/pages/RouteRegistry.ets', 'libs/lib/src/main/ets/pages/LibPage.ets'];
63
+
64
+ function registry(importLine: string): string {
65
+ return `${importLine}\nexport class RouteRegistry {}\n`;
66
+ }
67
+
68
+ test('missing side-effect import is an ERROR on the @Entry line', (t) => {
69
+ const root = project(t, {
70
+ ...BASE,
71
+ 'products/app/src/main/ets/pages/RouteRegistry.ets': registry('// empty registry'),
72
+ });
73
+ const issues = runCheck(root, SCENE);
74
+ assert.equal(issues.length, 1);
75
+ assert.equal(issues[0].severity, ERROR);
76
+ assert.equal(issues[0].line, 1);
77
+ assert.match(issues[0].message.en, /\[route-page-side-effect-import\]/);
78
+ assert.match(issues[0].message.en, /Lib\.Page/);
79
+ assert.match(issues[0].message.en, /import 'lib\/src\/main\/ets\/pages\/LibPage';/);
80
+ });
81
+
82
+ test('a side-effect import of the page file passes', (t) => {
83
+ const root = project(t, {
84
+ ...BASE,
85
+ 'products/app/src/main/ets/pages/RouteRegistry.ets':
86
+ registry("import 'lib/src/main/ets/pages/LibPage';"),
87
+ });
88
+ assert.deepEqual(runCheck(root, SCENE), []);
89
+ });
90
+
91
+ test('a named import is not registration (tree-shaken)', (t) => {
92
+ const root = project(t, {
93
+ ...BASE,
94
+ 'products/app/src/main/ets/pages/RouteRegistry.ets':
95
+ registry("import { LibPage } from 'lib';"),
96
+ });
97
+ const issues = runCheck(root, SCENE);
98
+ assert.equal(issues.length, 1);
99
+ assert.equal(issues[0].severity, ERROR);
100
+ });
101
+
102
+ test('a barrel side-effect import does not register the page', (t) => {
103
+ const root = project(t, {
104
+ ...BASE,
105
+ 'libs/lib/Index.ets': "export { LibPage } from './src/main/ets/pages/LibPage';\n",
106
+ 'products/app/src/main/ets/pages/RouteRegistry.ets': registry("import 'lib';"),
107
+ });
108
+ const issues = runCheck(root, SCENE);
109
+ assert.equal(issues.length, 1);
110
+ });
111
+
112
+ test('a route page owned by the HAP itself is out of scope', (t) => {
113
+ const root = project(t, {
114
+ ...BASE,
115
+ 'products/app/src/main/ets/pages/AppPage.ets':
116
+ "@Entry({ routeName: 'App.Page' })\n@ComponentV2\nexport struct AppPage {}\n",
117
+ });
118
+ assert.deepEqual(runCheck(root, ['products/app/src/main/ets/pages/AppPage.ets']), []);
119
+ });
120
+
121
+ test('an orphan library is not reported', (t) => {
122
+ const root = project(t, {
123
+ 'AppScope/app.json5': '{ "app": {} }',
124
+ 'products/app/oh-package.json5': '{ "name": "app" }',
125
+ 'products/app/src/main/module.json5': '{ "module": { "name": "app", "type": "entry" } }',
126
+ 'libs/orphan/oh-package.json5': '{ "name": "orphan", "main": "Index.ets" }',
127
+ 'libs/orphan/src/main/module.json5': '{ "module": { "name": "orphan", "type": "har" } }',
128
+ 'libs/orphan/src/main/ets/pages/OrphanPage.ets':
129
+ "@Entry({ routeName: 'Orphan.Page' })\n@ComponentV2\nexport struct OrphanPage {}\n",
130
+ });
131
+ assert.deepEqual(
132
+ runCheck(root, ['libs/orphan/src/main/ets/pages/OrphanPage.ets']),
133
+ [],
134
+ );
135
+ });
136
+
137
+ test('ohosTest HAPs are not treated as consumers', (t) => {
138
+ const root = project(t, {
139
+ ...BASE,
140
+ 'libs/lib/src/ohosTest/module.json5':
141
+ '{ "module": { "name": "lib_test", "type": "entry" } }',
142
+ 'products/app/src/main/ets/pages/RouteRegistry.ets':
143
+ registry("import 'lib/src/main/ets/pages/LibPage';"),
144
+ });
145
+ assert.deepEqual(runCheck(root, SCENE), []);
146
+ });
147
+
148
+ test('every consuming HAP must register the page', (t) => {
149
+ const root = project(t, {
150
+ ...BASE,
151
+ 'products/app2/oh-package.json5':
152
+ '{ "name": "app2", "dependencies": { "lib": "file:../../libs/lib" } }',
153
+ 'products/app2/src/main/module.json5': '{ "module": { "name": "app2", "type": "entry" } }',
154
+ 'products/app2/src/main/ets/pages/RouteRegistry.ets': registry('// empty registry'),
155
+ 'products/app/src/main/ets/pages/RouteRegistry.ets':
156
+ registry("import 'lib/src/main/ets/pages/LibPage';"),
157
+ });
158
+ const issues = runCheck(root, [
159
+ ...SCENE,
160
+ 'products/app2/src/main/ets/pages/RouteRegistry.ets',
161
+ ]);
162
+ assert.equal(issues.length, 1);
163
+ assert.match(issues[0].message.en, /app2/);
164
+ });
165
+
166
+ test('a commented-out @Entry is ignored', (t) => {
167
+ const root = project(t, {
168
+ ...BASE,
169
+ 'libs/lib/src/main/ets/pages/LibPage.ets':
170
+ "// @Entry({ routeName: 'Lib.Page' })\n@ComponentV2\nexport struct LibPage {}\n",
171
+ });
172
+ assert.deepEqual(runCheck(root, SCENE), []);
173
+ });
174
+
175
+ test('idempotent: a second scene pass does not duplicate issues', (t) => {
176
+ const root = project(t, {
177
+ ...BASE,
178
+ 'products/app/src/main/ets/pages/RouteRegistry.ets': registry('// empty registry'),
179
+ });
180
+ const checker = new RoutePageSideEffectImportCheck();
181
+ const scene = { getFiles: () => SCENE.map((rel) => ({ getFilePath: () => path.join(root, rel) })) };
182
+ checker.checkScene(scene);
183
+ checker.checkScene(scene);
184
+ assert.equal(checker.issues.length, 1);
185
+ });