@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
@@ -1,45 +1,21 @@
1
1
  # @hometrans/api-permission-declared
2
2
 
3
- ## 规则说明
3
+ **目的**:源码 import 了 `data/api-permission-map.json` 登记的 Kit/模块时,检查**打包该代码的
4
+ entry/feature HAP** 的 `src/main/module.json5` 是否在 `requestPermissions` 中声明了所需权限;
5
+ 缺失即 warn。规则是数据驱动、Kit 粒度的:告警只提示复核调用点,不是缺陷证明。
4
6
 
5
- 当源码中 import 了某个 Kit / 模块(如 `@kit.CameraKit`、`@ohos.multimedia.camera`),而该 Kit / 模块在 `data/api-permission-map.json` 中登记了所需权限时,本规则检查该源文件所属模块的 `src/main/module.json5` 的 `module.requestPermissions` 是否声明了全部所需权限。缺失任意一项即报 `Warning`。
7
+ ## 判定边界
6
8
 
7
- 这是一条**数据驱动**的规则:映射表外置,新增 Kit / 权限只需给 `data/api-permission-map.json` 加条目,无需改动 checker 代码。
9
+ - import 说明符精确匹配表的 `module` / `aliases`;缺失报 warn。`module.json5` 无法定位或解析也
10
+ 报 warn,不静默放过。
11
+ - **权限归属**:HAR/HSP 不能声明权限。规则从源文件沿本地 import(相对路径、`oh-package.json5`
12
+ 包名、包内子路径)做工作集遍历,把需求归到可达的 entry/feature HAP,报在原始 import 行;
13
+ 每个 import 行单独报,一个 import 被多个 HAP 可达时分别报。没有 HAP 时回退到文件自己的
14
+ `module.json5`。
15
+ - 特殊条目:`restricted`/ACL → 追加签名 ACL 提示并优先 Picker/安全控件;`system_only` → 普通
16
+ 应用拿不到,改用免权限方案;`user_grant` → 追加运行时 `requestPermissionsFromUser` 提示。
8
17
 
9
- 映射表刻意只做到 **Kit 粒度**——记录的是「这个 Kit 可能用到哪些权限」,而不是精确到具体 API 调用。因此告警只是提醒复核调用点,不等于确有缺陷:gate 会逐条判断,只有代码确实用到该能力、且该权限可以申请时才补声明(见「修复方式」)。
10
-
11
- ## 判定流程
12
-
13
- 1. 用 ArkAnalyzer 的 `ImportInfo` 收集所有静态 import(`getFrom()`、`getOriginFullPosition()`)。
14
- 2. 用 import 说明符精确匹配映射表的 `module` 或 `aliases`。
15
- 3. 从源文件路径向上找到最近的 `src/main/module.json5`;随后按「权限归属」规则确定真正要检查的 `module.json5`(见下节)。
16
- 4. 解析 `module.json5`(支持注释和尾逗号),收集 `requestPermissions[].name`。
17
- 5. 对每条所需权限:未声明 → 报 Warning;无法定位 / 解析 `module.json5` → 也报 Warning(不静默放过)。
18
-
19
- ## 权限归属(多模块工程)
20
-
21
- HAR / HSP 模块**不能声明权限**:权限必须声明在会打包这些代码的 entry / feature HAP 的 `module.json5` 中。因此:
22
-
23
- 1. 规则先从被扫描文件向上定位工程根目录(`AppScope/`,或含 `modules` 数组的工程级 `build-profile.json5`;扫描范围只覆盖子目录时也能回溯到根,避免把模块目录当成工程根),再扫描工程内所有模块的 `src/main/module.json5`(按 `module.type` 区分 entry / feature HAP 与 HAR / HSP),并从各模块的 `oh-package.json5` 建立「包名 → 模块」索引。
24
- 2. 对每个 entry / feature HAP,从属于它的源文件出发,沿**本地导入**(相对路径、`oh-package.json5` 包名、包内子路径)做工作集遍历,递归收集可达源文件里的 Kit 导入及其所需权限(访问过的文件去重,避免循环)。
25
- 3. 用这些权限检查**该 HAP** 的 `requestPermissions`;告警仍出现在产生需求的 import 行上,但消息里的目标 `module.json5` 是入口 HAP 的,而不是 HAR 的。
26
- 4. 每个触发缺失的 import 行单独报告(按文件 + 行号去重),不按「权限」折叠:这样在某一 import 行加抑制不会连带隐藏其他调用点,每条报告都带有自己的证据;同一 import 若被多个 HAP 可达,会分别向各 HAP 报告。
27
- 5. 工程中没有 entry / feature HAP 时,退回旧行为:逐个源文件检查其自己所属的 `module.json5`;未被任何 HAP 可达的游离源文件也走旧行为,以保留 `noModuleFile` / `badModuleFile` 覆盖。
28
-
29
- 示例:`entry/src/main/ets/viewmodel/MainViewModel.ets` 导入共享库 `networklib`,而 `common/networklib/src/main/ets/NetworkClient.ets` 导入 `@kit.NetworkKit`。规则会沿这条链把 `GET_NETWORK_INFO` 的需求归到 `entry/src/main/module.json5` 上,而不是错误地要求 `common/networklib` 的 HAR 配置声明权限。
30
-
31
- ## 告警示例
32
-
33
- ```
34
- 导入 @kit.CameraKit 需要权限 ohos.permission.CAMERA(normal / user_grant, since API 9),
35
- 但 ../src/main/module.json5 的 requestPermissions 中未声明。
36
- ```
37
-
38
- ## 修复方式
39
-
40
- 本规则只产生 warn,先判断是否真需要修:代码确实用到该 Kit 所需的能力(如 `createCameraInput` / 相机预览、发起 HTTP 请求)且权限可以申请时,补声明;否则保留告警并记录判断。
41
-
42
- 在对应模块的 `module.json5` 中声明缺失权限:
18
+ ## 修复
43
19
 
44
20
  ```json5
45
21
  {
@@ -55,42 +31,21 @@ HAR / HSP 模块**不能声明权限**:权限必须声明在会打包这些代
55
31
  }
56
32
  ```
57
33
 
58
- - `user_grant` 权限必须填写 `reason` 和 `usedScene`,并在运行时通过 `abilityAccessCtrl.requestPermissionsFromUser` 申请。
59
- - `restricted` / `system_basic/ACL` 权限还需要 AGC 审批并在签名配置中加入 ACL。
60
- - `system-only` 权限普通应用无法申请,应改用 Picker / 安全控件 / 跳转系统应用等免权限方案。
34
+ - `user_grant`:必须填 `reason` / `usedScene`,并在运行时申请。
35
+ - `restricted` / `system_basic`:还需 AGC 审批 **和** 签名配置的 ACL;只写 `module.json5`
36
+ 会安装失败或权限被丢弃。
37
+ - `system_only`:普通应用无法申请,改用 Picker / 安全控件 / 系统应用。
61
38
 
62
- 以下情况应保留告警(判定为 `left`)并记录理由:
39
+ 以下情况判定为 `left` 并记录理由:
63
40
 
64
- - import 实际走的是免权限路径——系统 Picker(`cameraPicker`、`PhotoViewPicker`、`DocumentViewPicker`)、`PasteButton`、仅播放的 `AVPlayer`、`getBundleInfoForSelf`、沙箱内文件读写等,Kit 粒度条目对这些调用点会过报;
65
- - 所需权限是 `restricted` / `system_basic` / `system_only`:声明了会装不上或过不了上架审核,应改走 Picker / 安全控件。
66
-
67
- ## 误报处理
68
-
69
- 优先记录判断而不是抑制:抑制会让该告警在以后所有扫描中都消失,而 warn 本来就不阻塞通过。确需静默该 import 行时:
70
-
71
- ```ts
72
- // homecheck-disable-next-line @hometrans/api-permission-declared
73
- ```
74
-
75
- 并在本轮 `homecheck-fix-report.md` 中记录 ruleId、文件、行号、原因和证据。
76
-
77
- 如果某个条目对整个工程都不成立(该 Kit 实际不需要这个权限),应修正手工维护的 `data/api-permission-map.json`,而不是到处加 disable 注释。
78
-
79
- ## 数据维护
80
-
81
- 映射表 `data/api-permission-map.json` 是手工维护的权威数据,新增 Kit / 权限只需给 `entries` 加一项,详见同目录 `README.md`。格式如下:
82
-
83
- ```json
84
- {
85
- "id": "kit-CameraKit",
86
- "module": "@kit.CameraKit",
87
- "aliases": ["@ohos.multimedia.camera"],
88
- "permissions": [
89
- { "name": "ohos.permission.CAMERA", "since": 9, "level": "normal", "grant": "user_grant", "restricted": false }
90
- ]
91
- }
92
- ```
41
+ - import 实际走免权限路径:系统 Picker(`cameraPicker` / `PhotoViewPicker` /
42
+ `DocumentViewPicker`)、`PasteButton`、仅播放的 `AVPlayer`、`getBundleInfoForSelf`、沙箱文件;
43
+ - 所需权限是 `restricted` / `system_basic` / `system_only`:声明会装不上或过不了上架审核。
93
44
 
94
- 权限元数据来自官方文档 `devecocli docs` 的「应用权限列表」;`since` / `level` / `grant` 请按该列表填写。
45
+ ## 维护 / 误报
95
46
 
96
- 可用环境变量 `HOMETRANS_API_PERMISSION_MAP` 指向自定义映射表(绝对路径),用于临时验证或本地扩展。
47
+ - 映射表是手工维护的权威数据,新增 Kit/权限只改 `data/api-permission-map.json`,格式见同目录
48
+ `README.md`;`HOMETRANS_API_PERMISSION_MAP` 可指向自定义表。
49
+ - 优先改数据表而不是加 `homecheck-disable`;确需抑制时写
50
+ `// homecheck-disable-next-line @hometrans/api-permission-declared`,并记录 ruleId、文件、行号、
51
+ 原因和证据。
@@ -1,47 +1,25 @@
1
1
  # @hometrans/api-permission-declared
2
2
 
3
- ## What it checks
4
-
5
- When a source file imports a Kit/module (for example `@kit.CameraKit` or `@ohos.multimedia.camera`) that is registered in `data/api-permission-map.json`, this rule checks whether the owning module's `src/main/module.json5` declares every required permission in `module.requestPermissions`. Any missing permission is reported as a `Warning`.
6
-
7
- The rule is data-driven: the mapping is external, so adding a newly introduced Kit/permission only requires a new entry in `data/api-permission-map.json` — no checker code changes.
8
-
9
- The map is deliberately **Kit-level** — it records the permissions a Kit *may* require, not the exact call that needs them. A finding is therefore a hint to inspect the call site, not proof of a defect: the gate judges every warning and declares the permission only when the code really exercises the capability and the permission is grantable (see below).
10
-
11
- ## Algorithm
12
-
13
- 1. Collect static imports through ArkAnalyzer `ImportInfo` (`getFrom()`, `getOriginFullPosition()`).
14
- 2. Match each import specifier exactly against the map's `module` or `aliases`.
15
- 3. Walk up from the source file to the nearest `src/main/module.json5`, then apply the "permission ownership" rule below to decide which `module.json5` is actually checked.
16
- 4. Parse that `module.json5` (comments and trailing commas are allowed) and collect `requestPermissions[].name`.
17
- 5. For every required permission: report a `Warning` when it is missing; also report a `Warning` when `module.json5` cannot be located or parsed (never silently pass).
18
-
19
- ## Permission ownership (multi-module projects)
20
-
21
- HAR / HSP modules **cannot declare permissions** — they must be declared in the entry / feature HAP that packages the code. Therefore:
22
-
23
- 1. The rule first locates the project root by walking up from the scanned files (`AppScope/`, or a project-level `build-profile.json5` whose `modules` array is present); a scan scope limited to a subdirectory therefore still resolves the root instead of mistaking a module directory for it. It then discovers every module's `src/main/module.json5` in the project (using `module.type` to tell entry / feature HAPs from HAR / HSP) and indexes "package name → module" from each `oh-package.json5`.
24
- 2. For each entry / feature HAP, it walks a worklist from the HAP's own source files through **local imports** (relative paths, `oh-package.json5` package names, and in-package subpaths) to collect, transitively, the Kit requirements of every reachable source file (files are de-duplicated to avoid cycles).
25
- 3. Those requirements are checked against **that HAP's** `requestPermissions`. Findings are still reported on the originating import line, but the target `module.json5` named in the message is the entry HAP's, not the HAR's.
26
- 4. Every triggering import site is reported (de-duplicated by file + line), not one finding per permission: a suppression applied to one line cannot hide the other sites, and each finding carries its own evidence. An import reachable from several HAPs is reported against each of them.
27
- 5. When the project has no entry / feature HAP, the rule falls back to the legacy behaviour (check each source file's own `module.json5`). Stray files not reachable from any HAP also use the legacy path, preserving `noModuleFile` / `badModuleFile` coverage.
28
-
29
- Example: `entry/src/main/ets/viewmodel/MainViewModel.ets` imports the shared library `networklib`, whose `common/networklib/src/main/ets/NetworkClient.ets` imports `@kit.NetworkKit`. The rule follows that chain and attributes `GET_NETWORK_INFO` to `entry/src/main/module.json5`, instead of wrongly asking `common/networklib`'s HAR config to declare it.
30
-
31
- ## Example finding
32
-
33
- ```
34
- Import of @kit.CameraKit requires ohos.permission.CAMERA (normal / user_grant, since API 9),
35
- but it is not declared in ../src/main/module.json5 requestPermissions.
36
- ```
37
-
38
- ## How to fix
39
-
40
- This rule only raises warnings, so first decide whether the finding is real. Declare the permission
41
- when the code actually exercises the capability the Kit needs (e.g. `createCameraInput` / camera
42
- preview, an HTTP request) and the permission is grantable; otherwise leave it and record the judgement.
43
-
44
- Declare the missing permission in the owning module's `module.json5`:
3
+ **Purpose**: when a source file imports a Kit/module registered in
4
+ `data/api-permission-map.json`, check that the **entry/feature HAP that packages the code** declares
5
+ every required permission in its `src/main/module.json5` `requestPermissions`; a missing one is a
6
+ warning. The rule is data-driven and Kit-level: a finding is a hint to inspect the call site, not
7
+ proof of a defect.
8
+
9
+ ## Boundaries
10
+
11
+ - An import specifier must match the map's `module` / `aliases`; a missing declaration is a warning.
12
+ An unlocatable or unparsable `module.json5` is also a warning — never a silent pass.
13
+ - **Ownership**: HAR/HSP modules cannot declare permissions. The rule walks a worklist from the
14
+ source file through local imports (relative paths, `oh-package.json5` package names, in-package
15
+ subpaths) to every reachable entry/feature HAP, and reports on the original import line. Each
16
+ import line is reported separately; one import reachable from several HAPs is reported against
17
+ each of them. Without a HAP it falls back to the file's own `module.json5`.
18
+ - Flags: `restricted`/ACL → signing-ACL note and Picker/security-component preference;
19
+ `system_only` → no ordinary-app route, use a permission-free alternative; `user_grant` → runtime
20
+ `requestPermissionsFromUser` note.
21
+
22
+ ## Fix
45
23
 
46
24
  ```json5
47
25
  {
@@ -57,47 +35,25 @@ Declare the missing permission in the owning module's `module.json5`:
57
35
  }
58
36
  ```
59
37
 
60
- - `user_grant` permissions also require `reason` / `usedScene` and a runtime `abilityAccessCtrl.requestPermissionsFromUser` call.
61
- - `restricted` / `system_basic/ACL` permissions additionally require AGC approval and an ACL entry in the signing configuration.
62
- - `system-only` permissions cannot be requested by ordinary apps; use a Picker, a security component, or delegate to a system app instead.
38
+ - `user_grant`: `reason` / `usedScene` are required, plus the runtime request.
39
+ - `restricted` / `system_basic`: also need AGC approval **and** an ACL entry in the signing profile;
40
+ `module.json5` alone either drops the permission at install time or fails the installation.
41
+ - `system_only`: cannot be requested by ordinary apps — use a Picker, a security component, or a
42
+ system app.
63
43
 
64
- Leave the warning (verdict `left`) and record the reason when:
44
+ Leave the warning (verdict `left`) and record why when:
65
45
 
66
- - the import reaches a permission-free path — the system Picker (`cameraPicker`, `PhotoViewPicker`,
46
+ - the import reaches a permission-free path — system Picker (`cameraPicker`, `PhotoViewPicker`,
67
47
  `DocumentViewPicker`), `PasteButton`, playback-only `AVPlayer`, `getBundleInfoForSelf`, local
68
- sandbox file I/O — so the Kit-level entry over-reports for this call site;
69
- - the required permission is `restricted` / `system_basic` / `system_only`: declaring it would fail the
70
- install or the app-store review. Point the code at the Picker / security component instead.
71
-
72
- ## Suppressing a false positive
73
-
74
- Prefer recording the judgement over suppressing: a suppression hides the finding from every future
75
- scan, and the warning is already non-blocking. If the import line really must be silenced:
76
-
77
- ```ts
78
- // homecheck-disable-next-line @hometrans/api-permission-declared
79
- ```
80
-
81
- Record the ruleId, file, line, reason and evidence in the round's `homecheck-fix-report.md`.
82
-
83
- When the entry is wrong for the whole project (a Kit that never requires the permission), fix the
84
- hand-maintained `data/api-permission-map.json` instead of sprinkling disable comments.
85
-
86
- ## Maintaining the data file
87
-
88
- `data/api-permission-map.json` is the hand-maintained source of truth. Add one entry per new Kit/permission; see `data/README.md` in the rule package. Example:
89
-
90
- ```json
91
- {
92
- "id": "kit-CameraKit",
93
- "module": "@kit.CameraKit",
94
- "aliases": ["@ohos.multimedia.camera"],
95
- "permissions": [
96
- { "name": "ohos.permission.CAMERA", "since": 9, "level": "normal", "grant": "user_grant", "restricted": false }
97
- ]
98
- }
99
- ```
100
-
101
- Fill `since` / `level` / `grant` from the official permission list (`devecocli docs`). Bump `version` when the file changes.
102
-
103
- Set `HOMETRANS_API_PERMISSION_MAP` to an absolute path to use a custom mapping file for local validation or extension.
48
+ sandbox I/O — so the Kit-level entry over-reports this site;
49
+ - the permission is `restricted` / `system_basic` / `system_only`: declaring it fails install or
50
+ app-store review.
51
+
52
+ ## Data / false positives
53
+
54
+ - `data/api-permission-map.json` is the hand-maintained source of truth; add a Kit/permission entry
55
+ there (format in `data/README.md`), not in checker code. `HOMETRANS_API_PERMISSION_MAP` points at
56
+ a custom map.
57
+ - Prefer fixing the map over adding `// homecheck-disable-next-line
58
+ @hometrans/api-permission-declared`; when suppression is unavoidable, record ruleId, file, line,
59
+ reason and evidence.
@@ -1,124 +1,155 @@
1
- # ArkUI 运行期契约陷阱合一规则(@hometrans/arkui-runtime-pitfall)
1
+ # ArkUI 运行期契约与路由载体陷阱(@hometrans/arkui-runtime-pitfall)
2
2
 
3
- ## 现象
3
+ **编译全绿、内置规则全过、运行期 100% 爆**的 14 类缺陷:多数直接杀进程或让接收页渲染
4
+ `undefined`,其余静默破坏功能。
4
5
 
5
- 八类缺陷同构:**编译全绿、内置规则全过、运行期 100% 爆**——框架契约错误,不是代码逻辑
6
- 错误。其中四类直接杀进程,其余静默破坏功能:
7
-
8
- | 子码 | 运行期表现 | 典型现场 |
6
+ | 子码 | 现象 | 级别 |
9
7
  | --- | --- | --- |
10
- | `[alpha-scale-mismatch]` | `setAlphaComponent(color, 0.5)`——alpha 通道取值 0..255,小数截断成 alpha 字节 0(`1.0` 则是 1),渲染成全(或近乎全)透明("按钮消失") | 登录按钮 |
11
- | `[controlled-input-writeback]` | onChange 回调用 `if (filtered !== v)` 守卫回写——纯数字输入永不回写,输满 4 位"完成验证"仍不可点 | 图形验证码弹窗 |
12
- | `[builder-param-bare-method-ref]` | 自定义组件(V1 或 V2——官方 FAQ faqs-arkui-229 的 V1 写法同样会崩)收 `@BuilderParam trailing: this.AvatarTrailing` 裸引用且 `@Builder` 函数体读 this——裸引用把 this 重绑到子组件,一点即 `undefined is not callable` 杀页面 | 个人页等列表页(批量出现) |
13
- | `[builder-param-arrow-inline-component]` | `@BuilderParam` 收的箭头函数体里直接写组件(`trailing: () => { PriceText({…}) }`)——只有 `@Builder` 函数体会被编译成 UI 代码,箭头体里的调用是对组件类的普通调用,槽位渲染时抛 "class constructor cannot be invoked without 'new'" | 订单详情、分类列表页 |
14
- | `[dialog-controller-v2-builder]` | V1 `CustomDialogController` 的宿主是 `@ComponentV2`,或 builder 目标不是 `@CustomDialog` 组件——弹窗打开即抛 "class constructor cannot be invoked without 'new'" | 删除确认弹窗 |
15
- | `[appstoragev2-connect-creator]` | `AppStorageV2.connect(Cls, key)` 缺第 3 参 defaultCreator——首次连接抛 `BusinessError: The default creator should be function when first connect`,页面进程被杀;同 key 被不同文件各自声明的类连接(同名拷贝也是不同类型)同样抛错——未捕获杀页面,被捕获则功能静默劣化 | 跨模块共享的主题槽 |
16
- | `[input-type-decimal-domain]` | 价格/金额/成本/重量/评分输入框用 `.type(InputType.Number)`——ArkUI 的 `Number` 是字符白名单剔 `.`,真机输 99.9 回读 999 | 筛选价格区间 |
17
- | `[theme-mode-closure]` | ThemeMode 状态有写入,但全工程没有任何 `setColorMode()` 调用——深色模式永不生效 | 设置页(半接线) |
18
-
19
- ## 判定
20
-
21
- 一条规则 ID、一个 checker、基于文本的词法分析,整场景一趟完成(跨文件表是全工程口径:
22
- 一个模块声明的组件被另一个模块误用同样能判定):
23
-
24
- - **alpha-scale-mismatch**——`setAlphaComponent(<expr>, <字面量>)` 且字面量是纯小数
25
- (`0 < n <= 1`,`1.0` 截断成 alpha 字节 1 同样近乎全透明),**且被调符号自身的声明可
26
- 证明是 0..255 语义**:同文件声明,或相对 import 指向的文件里的声明。**函数体为权威
27
- 证据**——alpha 参数上的界检查(`alpha > 255`、`alpha <= 255`)不受声明周边注释噪声
28
- 干扰;函数体没有界检查时才回退到紧贴声明上方的连续 `//` 注释块,两者都提到就定不了
29
- 级。该模块若同时导出 `withAlpha`,告警会直接推荐它承载 0..1 语义。同名的 0..1 语义
30
- helper 是合法代码;无法溯源的符号(kit import、裸全局、别名)定不了级、保持沉默。
31
- 字节值(`128`)、变量、注释内的写法不触发。
32
- - **controlled-input-writeback**——回调属于 `TextInput`/`TextArea`/`Search` 且 `text` 单向
33
- 绑定 `this.x`(只有显示由状态驱动时,漏回写才会脱同步——Slider 的条件写入不触发),
34
- 回调体内没有把值交出去的 `this.…(…)` 调用。其内出现 `if (x !== v)` 守卫(任一操作数
35
- 是回调参数)且守卫块内写状态:同一状态在回调别处也有无条件赋值、或守卫带 else 两臂
36
- 都写时不触发。推荐修法(先无条件回写、再守卫复位文本)不触发。
37
- - **builder-param-bare-method-ref**——`Ident({ prop: this.Method })` 且 `Ident` 按声明来源
38
- 解析(别名感知)到具体文件、`prop` 是它的 `@BuilderParam` 成员——V1(`@Component`)与
39
- V2(`@ComponentV2`)子组件同查(FAQ faqs-arkui-229)。仅当 `@Builder` 函数体真的读
40
- `this.` 才触发——不读 this 时重绑无害。`@LocalBuilder` 成员 this 固定为声明组件、永不
41
- 触发;箭头包裹(`() => { this.Method() }`)是合法写法。
42
- - **builder-param-arrow-inline-component**——`Ident({ prop: () => { … } })` 且 `prop` 是 `Ident`
43
- (按声明来源解析)的 `@BuilderParam` 成员,箭头体里调用了**能确认是组件**的名字:内置组件
44
- (`Text`、`Column`、`ForEach` …),或本文件声明 / 相对 import 解析到的 struct。import 进来的
45
- 全局 `@Builder function`(`() => { EmptyView() }`)、`this.X()` 成员 builder、解析不到的名字
46
- (包 import)都不触发;传给非 `@BuilderParam` 成员(事件回调)的箭头不查。属性或调用行上方
47
- 写 `// ARROW-SLOT: <依据>` 关闭该处。与 a2h-batch-ui-align 的同名 GATE 口径一致。
48
- - **dialog-controller-v2-builder**——`new CustomDialogController({ builder: Ident(…) })` 且
49
- 宿主 struct 是 `@ComponentV2`,或 builder 目标解析到的组件不是 `@CustomDialog`
50
- (`@ComponentV2` 目标或普通 `@Component`)。`@CustomDialog` 目标 + V1 宿主合法;解析不
51
- 了的目标(包 import)保持沉默。
52
- - **appstoragev2-connect-creator**——`AppStorageV2`/`PersistenceV2` 的 `.connect(Cls, key)`
53
- 传 2 个参数,按全工程 key 表定级:
54
- - 无守卫 + 该 key 在所有扫描文件里无 creator → **error**(首次连接必然抛错);
55
- - 无守卫 + 别处已有 creator → **warn**(只有那处先执行才合法,受加载/访问顺序约束);
56
- - 同文件前面有 `keys().includes(key)` 守卫 + 别处已有 creator → **沉默**(文档化的合法
57
- 后连形态);
58
- - 有守卫 + 全工程无 creator → **warn**(key 永远不会被创建,守卫恒假、分支永不执行——
59
- 静默死状态)。
60
- 无法解析成字面量的 key(拼接、跨文件 import)定不了级、保持沉默。
61
- 另:同一 key 被**不同文件各自声明的类**连接(按声明来源比较、别名感知——多个文件
62
- import 同一个导出类是正常形态、不触发;各模块拷贝同名类是不同类型、触发)。未捕获
63
- 站点各报 **error**,包在 try/catch 里的报 **warn**(抛错被设计性吞掉,但功能静默劣化)。
64
- 类来源解析不了的站点不参与比较。
65
- - **input-type-decimal-domain**——`.type(InputType.Number)` 且所在 struct 名、`TextInput(…)`
66
- 构造实参(绑定变量、占位文案/资源名)含小数域关键词——英文整词(price / prices /
67
- amount / amounts / money / cost / costs / fee / fees / balance / balances / weight /
68
- weights / rating / ratings / discount / decimal)或中文整词(价格 / 金额 / 价钱 / 售价 /
69
- 单价 / 总价 / 重量 / 评分 / 折扣 / 余额;按词匹配,`数量` 这类整数域不触发)。验证码、
70
- 图形码字段不触发。
71
- - **theme-mode-closure**——某文件写 ThemeMode(`x.themeMode = …`、`setThemeMode(…)`、
72
- `= ThemeMode.<成员>`),而所有扫描文件都没有 `setColorMode(` 调用。在首个写入点报一条。
73
-
74
- 子码记在消息键前缀,单一规则 ID 在报告与 `plugin:@hometrans/all` 门禁统计里保持可 grep
75
- (按 `[子码]` 前缀可分别计数)。
8
+ | `[alpha-scale-mismatch]` | `setAlphaComponent(color, 0.5)`:alpha 通道是 0..255,小数截断成全透明 | error* |
9
+ | `[controlled-input-writeback]` | `if (filtered !== v)` 守卫状态回写,恰好合法输入永不回写 | warn |
10
+ | `[builder-param-bare-method-ref]` | `@BuilderParam: this.Method` 裸引用把 `this` 重绑到子组件,调用即崩 | error |
11
+ | `[builder-param-arrow-inline-component]` | `@BuilderParam` 的箭头体里直接写组件,槽位渲染抛 "class constructor …" | error |
12
+ | `[dialog-controller-v2-builder]` | V1 `CustomDialogController` 在 V2 宿主,或目标不是 `@CustomDialog` | error |
13
+ | `[appstoragev2-connect-creator]` | 2 参 `connect` 缺少 creator;或同 key 被不同文件的类连接 | error / warn |
14
+ | `[input-type-decimal-domain]` | 价格/金额等小数域用 `InputType.Number`,`99.9` 回读 `999` | warn |
15
+ | `[theme-mode-closure]` | 写了 ThemeMode,但全工程没有 `setColorMode()` | warn |
16
+ | `[foreach-key-stale-render]` | ForEach 只用身份字段(如 id)做 key,却渲染或透传会变的内容:数据换成同 id 的新对象后行内字段不刷新(「退页重进才对」);整对象交给接收方时会解析子组件 `@Param` / 同文件 `@Builder` 参数实际读取的字段并列进提示 | warn |
17
+ | `[sql-identifier-quoting]` | 字段/键名是 SQLite 关键字(非 `%fallback`)或非常规标识符且未加引号;`store.insert/batchInsert` 拼 INSERT 列表时也不加引号 → 14800021 | warn |
18
+ | `[route-param-v2-instance]` | router params 携带 `@ObservedV2`/`@Observed` 实例,跨页后字段变 `__ob_*`/`undefined` | error |
19
+ | `[route-param-v2-new]` | params 里内联 `new Xxx(...)` | error |
20
+ | `[route-param-v2-stringify]` | 对装饰实例 `JSON.stringify`,结果不是期望的 DTO | error |
21
+ | `[route-param-unrebuilt-receive]` | `getParams()` 断言回装饰类契约,既不校验也不重建实体 | warn |
22
+ | `[route-back-index-base]` | 带索引的 `back(index)` 不来自 `getState().index`:索引起点文档写 `[0,+∞)`、运行期按 1 起且拒绝 0;应显式算目标并在 `< 1` 时退回 `back()`。仅 router 接收者(`router` / `getRouter()` / 局部别名),`// BACK-INDEX:` 关闭单处 | warn |
23
+ | `[i18n-simple-datetime-format]` | `i18n.getSimpleDateTimeFormatByPattern`:合法模式在运行期被判非法(890001),调用抛错、文本缺段;创建失败还留下 native 对象 | error |
24
+ | `[self-refresh-feedback]` | 状态绑定的组件(Refresh / Search / Toggle / Tabs / Slider / Swiper)回调体未守卫:程序化写入会再触发一次业务 | warn |
25
+
26
+ \* alpha 仅在符号声明可证为 0..255 契约时 error。
27
+
28
+ ## 判定边界
29
+
30
+ - **alpha**:`setAlphaComponent` 第二参是纯小数(`0 < n <= 1`),且同文件/相对 import 的声明
31
+ 可证 0..255:函数体的界检查为权威,无界检查才看声明上方连续注释。字节值、变量、注释、
32
+ 无法溯源的符号静默。
33
+ - **controlled-input-writeback**:`TextInput`/`TextArea`/`Search` 的 `text` 单向绑定 `this.x`,
34
+ 回调里 `if (x !== v)` 守卫了状态回写且没有把值交出去的 `this.…(…)` 调用。无条件回写、
35
+ 守卫带 else 两臂都写时不触发。
36
+ - **builder-param-bare-method-ref**:`Ident({ prop: this.Method })`,`prop` 是 `Ident` 的
37
+ `@BuilderParam` 成员,且 `@Builder` 体读了 `this`(V1/V2 同查)。`@LocalBuilder` 与箭头包裹合法。
38
+ - **builder-param-arrow-inline-component**:`@BuilderParam` 的箭头体直接调用可确认的组件
39
+ (内置组件、同文件 struct、相对 import 的 struct)。import 的全局 `@Builder`、成员 builder、
40
+ 无法解析的名字静默;`// ARROW-SLOT: <依据>` 关闭该处。
41
+ - **dialog-controller-v2-builder**:`new CustomDialogController({ builder: Ident(…) })` 的宿主是
42
+ `@ComponentV2`,或目标不是 `@CustomDialog`。`@CustomDialog` + V1 宿主合法。
43
+ - **appstoragev2-connect-creator**:2 参 `connect` 按全工程 key 表定级——无 creator → error;
44
+ creator 在别处 → warn(顺序依赖);有 `keys().includes` 守卫 + 有 creator → 静默;有守卫 +
45
+ 无 creator → warn(死分支)。同 key 由不同文件的类连接:未捕获 error,try/catch 内 warn。
46
+ 无法解析的 key 静默。
47
+ - **input-type-decimal-domain**:`.type(InputType.Number)` 且 struct 名/构造实参含小数域关键词
48
+ (price/amount/money/cost/weight/rating/价格/金额/售价/重量/评分/折扣/余额 …)。验证码、
49
+ 图形码不触发。
50
+ - **sql-identifier-quoting**:标识符是 SQLite 关键字且不在 `%fallback` 名单(如 `from/index/order/group/values/where/limit/join/on/to`),或不是常规标识符(`^[A-Za-z_][A-Za-z0-9_]*$`),且 SQL 里裸写。`EXPLAIN/OFFSET/KEY/FIRST/...` 在 fallback 名单里,裸写合法,不报。DDL 已加引号也会给一条 advisory;`relationalStore.ValuesBucket` 字面量的键同样检查;工程 schema 含风险列时,`store.insert/batchInsert/insertAll` 调用点再报一条。全部 WARN。
51
+ - **theme-mode-closure**:某处写 ThemeMode,而所有扫描文件都没有 `setColorMode(`。首个写入点报一条。
52
+ - **foreach-key-stale-render**:`ForEach` 有 keyGenerator,key 只含 ≤1 个条目成员(身份键),且生成器直接读
53
+ `item.字段` 或把整个 item 交给接收方。整对象透传时解析接收方:子组件(同文件 / 相对 import)按 `@Param`
54
+ 成员、同一文件的 `@Builder` 按参数读取的字段;非 `@Param` 成员只显示组件名。接收方不可解析时仍会报,
55
+ 只降级为泛称短语。核心语义:**key 不变时 ForEach 不重跑生成器,条目接收到的值不会更新;
56
+ `@ObservedV2`/`@Trace` 不能跨过被复用的行传值**——只改成 `@ComponentV2 + @Param` 不成立,必须同时让 key
57
+ 变化,或改用 LazyForEach。静默:key 已混入多成员、`JSON.stringify(item)` / `${item}`、key 调 helper、
58
+ 数组字面量、无 keyGenerator。`// FOREACH-KEY: <理由>` 关闭单处;内层已覆盖时外层仍会被报,按预期关闭
59
+ (规则只读单层 key)。
60
+ - **route-param-v2-instance / -v2-new / -v2-stringify / -unrebuilt-receive**:路由器形状调用
61
+ (`.back` / `.pushUrl` / `.replaceUrl` / `.pushNamedRoute` / `.replaceNamedRoute`)的 `params`
62
+ 递归检查;类型解析 import-aware(相对 import、`as` 别名、`import type`、`import * as ns`),
63
+ 裸类型名只有全场景唯一同名声明时才可信。`any`/`Object` 断言、helper 返回值、对象展开、
64
+ `Object.assign`、包类型保持静默。接收端 warn 需同时满足:断言回“字段仍是装饰类”的契约,
65
+ 且方法余下部分没有 `typeof` 校验、也没有 `new Xxx(...)` 重建。
66
+ - **route-back-index-base**:带索引的 `.back(index)`(`back()` / `back({url})` 不算),且索引表达式
67
+ 不是 `getState().index - N`(含通过局部变量中转的形式)。只认 router 接收者:`router` / `this.router`
68
+ 这类成员、`X.getRouter()` 的结果,以及它们的局部别名(`const routing = ui.getRouter()`);自定义栈/
69
+ 队列的 `history.back(n)`、`this.queue.back(n)` 不报。报一条,提示显式计算目标并在 `< 1` 时退回
70
+ `back()`;确属固定层级,用 `// BACK-INDEX: <理由>`(调用行或正上方的注释行)关闭单处。索引起点在
71
+ 平台声明之间不一致(`UIContext.Router` 写 `[0,+∞)`,`@ohos.router` / `getState().index` /
72
+ `getStateByIndex` 为 1 起,运行期拒绝 0),不要以 `.d.ts` 文字为准。
73
+ - **i18n-simple-datetime-format**:任何 `getSimpleDateTimeFormatByPattern(...)` 调用点都报,不按接收者过滤(方法名属于平台 API);注释里的同名字样不计。
74
+ - **self-refresh-feedback**:组件以状态为输入(`refreshing` / `value` / `isOn` / `index`)且绑定值不是字面量,注册了对应回调(`onRefreshing` / `onChange`),回调体首句没有对该状态短路,且体里有调用(纯赋值回写不算)。同文件能看到该状态在回调之外被赋值时用「回环」措辞,否则用「请核对写入点」措辞。`// SELF-REFRESH-OK: <理由>` 关闭单处。
76
75
 
77
76
  ## 严重度
78
77
 
79
- `error` 的语义是**代码只要执行就是缺陷——不存在合法读法**。`warn` 的语义是结论取决于
80
- 意图或业务语义;门禁逐条评判 `@hometrans` 告警并修复真实缺陷。
81
-
82
- - `error`:alpha-scale(已证明 0..255 契约)、builder-param(@Builder 体读 this)、
83
- builder-param-arrow-inline-component(箭头槽位里直接写了已确认的组件)、
84
- dialog-controller(V2 宿主或非 @CustomDialog 目标)、无守卫且全工程该 key 无 creator 的
85
- connect、同 key 异源类连接的未捕获站点。
86
- - `warn`:controlled-input-writeback(条件回写可能有意为之)、input-type-decimal-domain
87
- (小数域是从命名推断的——命了价格名的纯整数字段是合法的)、theme-mode-closure
88
- ("只持状态、深浅渲染归资源限定词"是有意设计时合法)、无守卫但同 key 别处已有
89
- creator 的 2 参 connect(顺序依赖)、有守卫但全工程无 creator 的 2 参 connect(分支
90
- 永不执行——设计取舍)、包在 try/catch 里的同 key 异源类连接站点(抛错被设计性处理,
91
- 但功能仍在静默劣化)。
78
+ - `error`:alpha(已证 0..255)、builder-param(体读 this / 槽位写了确认组件)、dialog(V2 宿主 /
79
+ 非 `@CustomDialog`)、无 creator 的 2 参 connect、同 key 异源类的未捕获站点、
80
+ route-param-v2-instance / -v2-new / -v2-stringify。
81
+ - `error`(恒定):i18n-simple-datetime-format——API 自身不可用,与调用点无关。
82
+ - `warn`:controlled-input-writeback、input-type-decimal-domain、theme-mode-closure、foreach-key-stale-render、self-refresh-feedback、顺序依赖
83
+ 或死分支的 connect、try/catch 内的异源类站点、route-param-unrebuilt-receive、route-back-index-base。
92
84
 
93
85
  ## 修复
94
86
 
95
87
  ```ts
96
- // [alpha-scale-mismatch] 0..1 → 0..255(helper 模块有 withAlpha 时可用 withAlpha(primary, 0.5))
97
- .backgroundColor(this.vm.isLoginEnabled ? theme.primary : setAlphaComponent(theme.primary, 128))
88
+ // [alpha-scale-mismatch]
89
+ setAlphaComponent(theme.primary, 128) // 或 withAlpha(theme.primary, 0.5)
90
+
91
+ // [controlled-input-writeback] 先无条件回写,再单独决定是否复位文本
92
+ this.imageCode = filtered;
98
93
 
99
- // [builder-param-bare-method-ref] 引用一律箭头包裹
100
- AppListItem({
101
- trailing: () => { this.AvatarTrailing() }
102
- })
103
- // 或把成员声明成 @LocalBuilder——its 固定为声明组件
94
+ // [builder-param-bare-method-ref]
95
+ AppListItem({ trailing: () => { this.AvatarTrailing() } })
104
96
 
105
- // [builder-param-arrow-inline-component] 组件写进 @Builder,箭头体只调用它
97
+ // [builder-param-arrow-inline-component]
106
98
  @Builder PriceTrailing() { PriceText({ price: this.price }) }
107
99
  OrderDetailListItem({ trailingContent: () => { this.PriceTrailing() } })
108
100
 
109
- // [dialog-controller-v2-builder] V2 弹窗不走 V1 控制器
110
- // 改用 promptAction/ComponentContent,或由 @Trace 状态驱动的页内遮罩
101
+ // [dialog-controller-v2-builder] V2 用 promptAction/ComponentContent 或页内遮罩
111
102
 
112
- // [appstoragev2-connect-creator] 永远给 creator,一个 key 永远一个类——
113
- // 类在唯一共享模块里声明一次,而不是每个 feature 各拷贝一份
114
- const slot = AppStorageV2.connect(PrimaryColorSlot, PRIMARY_SLOT_KEY, () => new PrimaryColorSlot());
103
+ // [appstoragev2-connect-creator]
104
+ AppStorageV2.connect(PrimaryColorSlot, PRIMARY_SLOT_KEY, () => new PrimaryColorSlot());
115
105
 
116
106
  // [input-type-decimal-domain]
117
107
  .type(InputType.NUMBER_DECIMAL)
118
108
 
119
- // [theme-mode-closure] 写时生效,启动恢复
109
+ // [sql-identifier-quoting] 生成的 SQL 对表名与每一列都加双引号(或给列改名)
110
+ // 不要用 store.insert/batchInsert:平台拼 INSERT 列表时不加引号
111
+ await store.execute('INSERT OR REPLACE INTO "t" ("id","from") VALUES (?,?)', [id, from]);
112
+
113
+ // [theme-mode-closure]
120
114
  getApplicationContext().setColorMode(modeToConfigurationConstant(mode));
115
+
116
+ // [foreach-key-stale-render]
117
+ // 反例:身份键 + 内容会变(同 id 新对象时行内不刷新)
118
+ ForEach(this.rows, (row: RowModel) => { this.RowCard(row) }, (row: RowModel) => `row-${row.id}`)
119
+ // 正解:把渲染字段拼进 key(整对象交子组件时,规则会列出该子组件实际渲染的字段)
120
+ ForEach(this.rows, (row: RowModel) => { RowView({ row: row }) }, (row: RowModel) => `${row.id}:${row.count}`)
121
+ // 只把行改成 @ComponentV2 + @Param 而 key 不变仍不刷新:被复用的行不会重跑生成器,
122
+ // 子组件 @Param 不会重新求值。需要对象级刷新时让 key 随渲染字段变化,或改用 LazyForEach + notifyDataChange。
123
+ // 静态列表:`// FOREACH-KEY: <理由>` 关闭。
124
+
125
+ // [route-param-*] 跨页一律扁平 DTO;接收端校验并重建实体
126
+ interface ItemResultDto { id: number; code: string; title: string; enabled: boolean; }
127
+ const result = { item: toItemDto(item) };
128
+ router.back({ url: 'pages/TargetPage', params: result });
129
+ const dto = params.item;
130
+ if (dto !== undefined && typeof dto.code === 'string') {
131
+ this.viewModel.onItemSelected(new Item(dto.id, dto.code, dto.title, dto.enabled));
132
+ }
133
+
134
+ // [route-back-index-base] 用 getState().index 反推目标,越界退回 back()
135
+ const targetIndex = router.getState().index - 2;
136
+ if (targetIndex >= 1) {
137
+ router.back(targetIndex);
138
+ } else {
139
+ router.back();
140
+ }
141
+
142
+ // [i18n-simple-datetime-format] 自实现,不用 i18n 原生格式化
143
+ const hh = d.getHours() < 10 ? `0${d.getHours()}` : `${d.getHours()}`;
144
+ const mm = d.getMinutes() < 10 ? `0${d.getMinutes()}` : `${d.getMinutes()}`;
145
+ const label = `${hh}:${mm}`;
146
+
147
+ // [self-refresh-feedback] 手势态与业务态分开,或给回调加首句守卫
148
+ Refresh({ refreshing: this.refreshing }) { this.content() }
149
+ .onRefreshing(() => {
150
+ if (this.refreshing) { return; } // 程序化置真不是用户下拉
151
+ this.onRefresh();
152
+ })
121
153
  ```
122
154
 
123
- `[controlled-input-writeback]` 的修法:先无条件回写滤后值,再单独判断是否复位输入框文本
124
- ——绝不用 `filtered !== v` 去拦状态回写。
155
+ `JSON.parse(JSON.stringify(entity))` 不是修复——它只是把规则报告的坏序列化路径再走一遍。