@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
@@ -26,6 +26,20 @@
26
26
  * CFG-based sibling module `platform/ExtraDataSubCheck.js`, which
27
27
  * reports through this rule.
28
28
  *
29
+ * [encoded-arg-missing] value-form contract (whitelist polarity): `loadData`'s `data` must
30
+ * be a Base64- or URL-encoded string (`@ohos.web.webview.d.ts`:
31
+ * "A string encoded according to Base64 or URL"). Passing raw HTML
32
+ * compiles fine; the engine treats the payload as a `data:` URL body,
33
+ * so the first `#` (a CSS hex colour) starts the URL fragment and
34
+ * everything after it - `<body>` included - is dropped: the page
35
+ * renders blank with no error and no log. Two call forms are legal and
36
+ * stay silent: an encoded payload (the `encoders` whitelist), or a
37
+ * non-empty `baseUrl`/`historyUrl` (the d.ts recommends a space for
38
+ * both; with either non-empty the payload is ordinary HTML, not a
39
+ * `data:` URL), or `encoding: "base64"`. WARN: an unprovable value
40
+ * (alias chains, name reuse) must not block, so this routes to
41
+ * review like `[nullable-return-unguarded]`.
42
+ *
29
43
  * Precision rules (each one exists because a text-only version mis-reported real code):
30
44
  *
31
45
  * - Statement shapes come from the CFG, not from whole-statement text. `ArkIfStmt.getOriginalText()`
@@ -38,7 +52,9 @@
38
52
  * arrow function passed to `.then(...)` is not attributed to the outer statement — the closure
39
53
  * body is a separate method and is reported there.
40
54
  * - The callee must belong to the API's real owner (`receiver` in the contract table): a project
41
- * wrapper named `createImageSource(bytes: Uint8Array)` never fires.
55
+ * wrapper named `createImageSource(bytes: Uint8Array)` never fires. The analyzer returns a
56
+ * `MethodSignature` object, not a string; coerce with `String(...)` before matching (requiring a
57
+ * raw string silently disabled every receiver-gated sub-check in real runs).
42
58
  * - `allowText` forms (`x.buffer`, `x.buffer.slice(...)`, `as ArrayBuffer`) are the correct
43
59
  * argument and always pass, including when written inline.
44
60
  * - Local backtracking is scope-blind by nature, so it is fail-safe: a name declared more than
@@ -152,13 +168,68 @@ function statementEventsOf(method, contract) {
152
168
 
153
169
  /** The callee belongs to the API's real owner (`receiver` pattern in the contract table). */
154
170
  function isQualified(invoke, spec) {
155
- const signature = safe(() => invoke.getMethodSignature(), '');
156
- if (typeof signature !== 'string' || signature.length === 0) { return false; } // cannot prove → silent
171
+ // ArkAnalyzer's `ArkInvokeExpr.getMethodSignature()` returns a `MethodSignature` object whose
172
+ // `toString()` is the readable `owner.method(...)` form. Coerce before the type check: requiring
173
+ // a raw string here silently disabled every receiver-gated sub-check in real runs (the unit
174
+ // tests passed because their fake returned a string).
175
+ const signature = String(safe(() => invoke.getMethodSignature(), ''));
176
+ if (signature.length === 0) { return false; } // cannot prove → silent
157
177
  const receiver = spec !== undefined && spec !== null && typeof spec === 'object' ? spec.receiver : undefined;
158
178
  if (typeof receiver !== 'string' || receiver.length === 0) { return true; }
159
179
  return new RegExp(receiver).test(normalizeSignature(signature));
160
180
  }
161
181
 
182
+ /* ------------------------------------------------------------------ */
183
+ /* shared text helpers */
184
+ /* ------------------------------------------------------------------ */
185
+
186
+ /**
187
+ * A single string literal (`'a'`, `"a"` or a template without `${}`), or null. Interpolated
188
+ * templates are runtime values, so they are not literals here.
189
+ */
190
+ function literalOf(text) {
191
+ const m = /^(['"`])([\s\S]*)\1$/.exec(String(text).trim());
192
+ if (m === null) { return null; }
193
+ if (m[1] === '`' && m[2].includes('${')) { return null; }
194
+ return { quote: m[1], body: m[2] };
195
+ }
196
+
197
+ /** Replace `//` and block comments with spaces, keeping line breaks (and therefore line numbers). */
198
+ function stripComments(text) {
199
+ const src = String(text);
200
+ let out = '';
201
+ let i = 0;
202
+ let quote = '';
203
+ while (i < src.length) {
204
+ const c = src[i];
205
+ if (quote !== '') {
206
+ out += c;
207
+ if (c === '\\') { out += src[i + 1] || ''; i += 2; continue; }
208
+ if (c === quote) { quote = ''; }
209
+ i++;
210
+ continue;
211
+ }
212
+ if (c === '"' || c === "'" || c === '`') { quote = c; out += c; i++; continue; }
213
+ if (c === '/' && src[i + 1] === '/') {
214
+ while (i < src.length && src[i] !== '\n') { out += ' '; i++; }
215
+ continue;
216
+ }
217
+ if (c === '/' && src[i + 1] === '*') {
218
+ out += ' ';
219
+ i += 2;
220
+ while (i < src.length && !(src[i] === '*' && src[i + 1] === '/')) {
221
+ out += src[i] === '\n' ? '\n' : ' ';
222
+ i++;
223
+ }
224
+ if (i < src.length) { out += ' '; i += 2; }
225
+ continue;
226
+ }
227
+ out += c;
228
+ i++;
229
+ }
230
+ return out;
231
+ }
232
+
162
233
  /* ------------------------------------------------------------------ */
163
234
  /* text primitives over one statement (pure — unit-tested) */
164
235
  /* ------------------------------------------------------------------ */
@@ -308,6 +379,7 @@ function selectBufferArgFindings(events, contract) {
308
379
  if (event.qualified !== true || event.api === '') { continue; }
309
380
  const spec = contracts[event.api];
310
381
  if (spec === undefined) { continue; }
382
+ if (spec.argKind === 'encoded') { continue; } // whitelist mode: see selectEncodedArgFindings
311
383
  const index = typeof spec.argIndex === 'number' ? spec.argIndex : 0;
312
384
  for (const call of topLevelCalls(event.text, event.api)) {
313
385
  const arg = call.args[index];
@@ -323,6 +395,243 @@ function selectBufferArgFindings(events, contract) {
323
395
  return out;
324
396
  }
325
397
 
398
+ /**
399
+ * The argument (or a local it is assigned from) is produced by one of the declared encoders.
400
+ * Mirror of `rejectReason`, but for `argKind: "encoded"` the contract is a whitelist: a
401
+ * content-injection API takes an already-encoded payload, so "not provably encoded" is the finding.
402
+ */
403
+ function allowedByTrace(arg, spec, assigns, depth) {
404
+ const text = String(arg).trim();
405
+ if (isAllowedArg(text, spec.allowText)) { return true; }
406
+ for (const encoder of spec.encoders || []) {
407
+ if (text.includes(encoder)) { return true; }
408
+ }
409
+ if (depth >= MAX_DEPTH || !/^[A-Za-z_$][\w$]*$/.test(text)) { return false; }
410
+ const entry = assigns.get(text);
411
+ if (entry === undefined || entry.ambiguous) { return false; }
412
+ for (const rhs of entry.values) {
413
+ if (allowedByTrace(rhs, spec, assigns, depth + 1)) { return true; }
414
+ }
415
+ return false;
416
+ }
417
+
418
+ /**
419
+ * Alternative call forms that make the encoded-data requirement unnecessary.
420
+ *
421
+ * `WebviewController.loadData` only takes the `data:`-URL branch when **both** `baseUrl` and
422
+ * `historyUrl` are empty; with a non-empty baseUrl/historyUrl the payload is loaded as ordinary
423
+ * HTML. The d.ts recommends passing a space for both when the HTML itself contains `#`, so that
424
+ * form is as correct as base64 and must not be reported. A declared `encoding: "base64"` is the
425
+ * other documented form. Each rule is a proof obligation: only a literal can satisfy
426
+ * `equalsLiteral`, and `nonEmpty` requires a non-empty literal, so a variable that may be empty
427
+ * stays a finding (fail-safe).
428
+ */
429
+ function acceptedByAlternative(args, spec, dataArg) {
430
+ for (const rule of spec.acceptWhen || []) {
431
+ if (rule === null || typeof rule !== 'object') { continue; }
432
+ const index = typeof rule.arg === 'number' ? rule.arg : -1;
433
+ if (index < 0) { continue; }
434
+ const raw = args[index];
435
+ if (raw === undefined) { continue; }
436
+ const literal = literalOf(raw);
437
+ if (literal === null) { continue; }
438
+ if (typeof rule.equalsLiteral === 'string') {
439
+ // A declared base64 encoding cannot override provably raw content: a literal that contains
440
+ // the fragment characters is still the failure this rule is about.
441
+ const dataLiteral = literalOf(dataArg);
442
+ if (dataLiteral !== null && /[#%]/.test(dataLiteral.body)) { continue; }
443
+ if (literal.body.trim().toLowerCase() === rule.equalsLiteral.trim().toLowerCase()) { return true; }
444
+ }
445
+ if (rule.nonEmpty === true && literal.body.length > 0) { return true; }
446
+ }
447
+ return false;
448
+ }
449
+
450
+ /** Calls whose contracted argument slot is not a provably encoded payload. */
451
+ function selectEncodedArgFindings(events, contract) {
452
+ const out = [];
453
+ const contracts = (contract && contract.argContracts) || {};
454
+ const assigns = assignmentMap(events);
455
+ const seen = new Set();
456
+ for (const event of events) {
457
+ if (event.qualified !== true || event.api === '') { continue; }
458
+ const spec = contracts[event.api];
459
+ if (spec === undefined || spec.argKind !== 'encoded') { continue; }
460
+ const index = typeof spec.argIndex === 'number' ? spec.argIndex : 0;
461
+ for (const call of topLevelCalls(event.text, event.api)) {
462
+ const arg = call.args[index];
463
+ if (arg === undefined) { continue; }
464
+ if (allowedByTrace(arg, spec, assigns, 0)) { continue; }
465
+ if (acceptedByAlternative(call.args, spec, arg)) { continue; }
466
+ // A plain literal without `#` or `%` cannot hit the data-URL fragment truncation the rule is
467
+ // about (that failure needs at least one of those characters), so it stays silent.
468
+ const literal = literalOf(arg);
469
+ if (literal !== null && !/[#%]/.test(literal.body)) { continue; }
470
+ const key = event.line + '|' + event.col + '|' + event.api;
471
+ if (seen.has(key)) { continue; }
472
+ seen.add(key);
473
+ out.push({ line: event.line, api: event.api, arg: arg, expect: spec.expect || 'encoded string' });
474
+ }
475
+ }
476
+ return out;
477
+ }
478
+
479
+ /**
480
+ * Message for `[encoded-arg-missing]`. Kept outside the constructor's message table so the wording
481
+ * lives next to the check that raises it.
482
+ */
483
+ function encodedArgMessage(api, arg, expect) {
484
+ return {
485
+ en: '[encoded-arg-missing] ' + api + ' is called with `' + arg + '`, but the parameter must be a ' +
486
+ expect + ' (d.ts: "A string encoded according to Base64 or URL"). Raw text is treated as a' +
487
+ ' data: URL body, so a `#` inside it (e.g. a CSS hex colour) starts the URL fragment and' +
488
+ ' everything after it - including <body> - is dropped: the page renders blank with no error.' +
489
+ ' Encode first and declare it: `const b64 = new util.Base64Helper().encodeToStringSync(' +
490
+ 'new util.TextEncoder().encodeInto(html)); controller.loadData(b64, "text/html", "base64")`.',
491
+ cn: '[encoded-arg-missing] ' + api + ' 的第 0 个实参 `' + arg + '` 不满足「' + expect +
492
+ '」的契约(d.ts 原文:A string encoded according to Base64 or URL)。传原始文本时会被当成' +
493
+ ' data: URL 的内容;只要其中出现 `#`(比如 CSS 十六进制颜色),它就成了 URL fragment 起点,' +
494
+ '其后包括 <body> 在内的内容全部丢弃,页面空白且不报错。应先编码再声明编码方式:' +
495
+ '`const b64 = new util.Base64Helper().encodeToStringSync(new util.TextEncoder().encodeInto(html));' +
496
+ ' controller.loadData(b64, "text/html", "base64")`。',
497
+ };
498
+ }
499
+
500
+ /*
501
+ * SQL capability contract (same rule):
502
+ * `CREATE VIRTUAL TABLE ... USING <module>(... tokenize = '<name>')` depends on compile-time
503
+ * features of the target platform's SQLite build, which no type system or `.d.ts` exposes.
504
+ * The target platform is resolved from the project's `build-profile.json5` (`runtimeOS`) and the
505
+ * feature is looked up in `data/api-param-contract.json#sqlCapabilities`.
506
+ *
507
+ * Three-valued on purpose: only a capability the table marks `false` is reported; `true`, a missing
508
+ * entry, an unrecognised module/tokenizer or an unresolvable platform stay silent (a new platform or
509
+ * a project-local tokenizer must not produce noise).
510
+ */
511
+ const CREATE_VIRTUAL_RE = /\bcreate\s+virtual\s+table\b/i;
512
+ const USING_MODULE_RE = /\busing\s+([A-Za-z0-9_]+)\s*\(/i;
513
+ const TABLE_NAME_RE = /\bcreate\s+virtual\s+table\b([\s\S]*?)\busing\s+/i;
514
+ const TOKENIZE_RE = /\btokenize\s*=\s*(?:'([^']*)'|"([^"]*)"|([A-Za-z0-9_]+))/i;
515
+ /** A DDL statement is often built by string concatenation; three lines cover the usual shape. */
516
+ const SQL_WINDOW_LINES = 3;
517
+
518
+ /** Best-effort table name: a literal identifier, or `(dynamic)` when the name is concatenated. */
519
+ function tableNameOf(window) {
520
+ const m = TABLE_NAME_RE.exec(window);
521
+ if (m === null) { return '(dynamic)'; }
522
+ const chunk = m[1].replace(/\bif\s+not\s+exists\b/ig, '').trim().replace(/^["'`]|["'`]$/g, '').trim();
523
+ return /^[A-Za-z0-9_]+$/.test(chunk) ? chunk : '(dynamic)';
524
+ }
525
+
526
+ /** Names marked `true` in a `{ name: boolean }` capability map, for the "available" hint. */
527
+ function allowedNames(map) {
528
+ const out = [];
529
+ if (map === undefined || map === null || typeof map !== 'object') { return out; }
530
+ for (const key of Object.keys(map)) {
531
+ if (map[key] === true) { out.push(key); }
532
+ }
533
+ return out;
534
+ }
535
+
536
+ /**
537
+ * `CREATE VIRTUAL TABLE ... USING <module>(...)` whose module or `tokenize=` value the target
538
+ * platform is known not to provide. Pure: `caps` is the parsed `sqlCapabilities` object.
539
+ *
540
+ * The scan starts on the line that begins the statement and looks at a small window of following
541
+ * lines, because the DDL is routinely assembled with `+` (schema helper style). A statement that
542
+ * spans more than the window, or whose tokenizer comes from a variable, is out of scope.
543
+ */
544
+ function sqlCapabilityFindings(text, caps, platform) {
545
+ const out = [];
546
+ if (caps === undefined || caps === null || typeof caps !== 'object') { return out; }
547
+ const platforms = caps.platforms;
548
+ if (platforms === undefined || platforms === null) { return out; }
549
+ const spec = platforms[platform];
550
+ if (spec === undefined || spec === null) { return out; } // unknown platform: silent
551
+ const modules = spec.modules || {};
552
+ const tokenizers = spec.tokenizers || {};
553
+
554
+ const lines = String(text).split(/\r?\n/);
555
+ for (let i = 0; i < lines.length; i++) {
556
+ if (!CREATE_VIRTUAL_RE.test(lines[i])) { continue; }
557
+ const window = (() => {
558
+ let text = lines.slice(i, i + SQL_WINDOW_LINES).join(' ');
559
+ // Do not let a following DDL statement (or its tokenize=) leak into this one.
560
+ const lower = text.toLowerCase();
561
+ const firstAt = lower.indexOf('create virtual table');
562
+ const secondAt = lower.indexOf('create virtual table', firstAt + 1);
563
+ if (secondAt > 0) { text = text.slice(0, secondAt); }
564
+ return text;
565
+ })();
566
+ const m = USING_MODULE_RE.exec(window);
567
+ if (m === null) { continue; }
568
+ const module = m[1].toLowerCase();
569
+ // Bound the argument list at the statement terminator. Bracket matching is unusable here: the
570
+ // DDL is string-concatenated, so a quote pair spans `' + columns.join(', ') + "` and a naive
571
+ // scanner would close the argument list at the wrong `)`.
572
+ const openAt = m.index + m[0].length - 1;
573
+ let args = window.slice(openAt + 1);
574
+ const semi = args.indexOf(';');
575
+ if (semi >= 0) { args = args.slice(0, semi); }
576
+ const table = tableNameOf(window);
577
+
578
+ if (modules[module] === false) {
579
+ out.push({ line: i + 1, feature: 'module', name: module, table: table,
580
+ subject: 'USING ' + module });
581
+ }
582
+
583
+ const t = TOKENIZE_RE.exec(args);
584
+ if (t !== null) {
585
+ // `unicode61 remove_diacritics 2` -> unicode61
586
+ const name = String(t[1] || t[2] || t[3] || '').trim().split(/\s+/)[0].toLowerCase();
587
+ if (name !== '' && tokenizers[name] === false) {
588
+ out.push({ line: i + 1, feature: 'tokenizer', name: name, table: table,
589
+ subject: "tokenize='" + name + "'" });
590
+ }
591
+ }
592
+ }
593
+ return out;
594
+ }
595
+
596
+ function sqlCapabilityMessage(finding, platform, caps) {
597
+ const spec = (caps && caps.platforms && caps.platforms[platform]) || {};
598
+ const pool = allowedNames(finding.feature === 'module' ? spec.modules : spec.tokenizers);
599
+ const alternatives = pool.length > 0 ? pool.join(' / ') : '-';
600
+ return {
601
+ en: '[sql-capability] ' + finding.subject + ' on table `' + finding.table + '` is not provided by' +
602
+ ' the target platform (' + platform + '), so `CREATE VIRTUAL TABLE` fails at runtime and the' +
603
+ ' table never exists. The capability table lists: ' + alternatives + '. If none fits the' +
604
+ ' search semantics, skip FTS and query with LIKE. Verify with one CREATE + MATCH against the' +
605
+ ' real store before relying on it.',
606
+ cn: '[sql-capability] 表 `' + finding.table + '` 的 ' + finding.subject + ' 在目标平台(' +
607
+ platform + ')上不存在,`CREATE VIRTUAL TABLE` 会在运行期失败,表根本建不出来。能力表里可用的是:' +
608
+ alternatives + '。若都不满足检索语义,可不建 FTS、检索改走 LIKE。上线前请对真实 store 跑一次' +
609
+ ' CREATE + MATCH 自检。',
610
+ };
611
+ }
612
+
613
+ /** Resolve `app.products[].runtimeOS` by walking up to the project's build-profile.json5. */
614
+ function resolveRuntimeOS(filePath) {
615
+ let dir = path.dirname(path.resolve(String(filePath || '.')));
616
+ for (let hop = 0; hop < 16; hop++) {
617
+ const candidate = path.join(dir, 'build-profile.json5');
618
+ if (fs.existsSync(candidate)) {
619
+ const text = safe(() => fs.readFileSync(candidate, 'utf8'), '');
620
+ // JSON5: the key may be unquoted, and either quote style may be used.
621
+ const m = /(?:"runtimeOS"|'runtimeOS'|\bruntimeOS)\s*:\s*["']([^"']+)["']/.exec(text);
622
+ if (m !== null) { return m[1]; }
623
+ // A HAR/HSP module has its own build-profile.json5 without runtimeOS: keep walking.
624
+ // The project root is the one with an `app` section - if that has no runtimeOS, the platform
625
+ // is genuinely unknown, so stop instead of reading an unrelated outer project.
626
+ if (/(?:"app"|'app'|\bapp)\s*:\s*\{/.test(text)) { return ''; }
627
+ }
628
+ const parent = path.dirname(dir);
629
+ if (parent === dir) { break; }
630
+ dir = parent;
631
+ }
632
+ return '';
633
+ }
634
+
326
635
  const GUARD_PATTERNS = [
327
636
  '\\b%s\\s*(?:===?|!==?)\\s*(?:null|undefined)',
328
637
  '!\\s*%s\\b',
@@ -382,13 +691,77 @@ function selectNullableReturnFindings(events, contract) {
382
691
  return out;
383
692
  }
384
693
 
694
+ /* ------------------------------------------------------------------ */
695
+ /* Image source form (same rule) */
696
+ /* ------------------------------------------------------------------ */
697
+
698
+ /** A bare identifier is usually a Resource builder param; everything else is evaluated at runtime. */
699
+ const BARE_IDENTIFIER_RE = /^[A-Za-z_$][\w$]*$/;
700
+
701
+ /**
702
+ * `Image(x)` where `x` is evaluated at runtime (member access, call, template, concatenation).
703
+ * Not a verdict about the value: it is a checkpoint, because a malformed string source (a data URL
704
+ * missing `;base64,`, a typo'd URI) compiles, renders nothing, and logs nothing.
705
+ *
706
+ * Skipped on purpose, to keep the signal usable: `$r(...)` / `$rawfile(...)` (compile-time
707
+ * resources), `PixelMap` values, bare identifiers (usually a `Resource` parameter) and comments.
708
+ */
709
+ function imageSrcFindings(text) {
710
+ const out = [];
711
+ const lines = String(text).split(/\r?\n/);
712
+ for (let i = 0; i < lines.length; i++) {
713
+ const raw = lines[i];
714
+ if (/\bImage\s*\(/.test(raw) === false) { continue; }
715
+ const trimmed = raw.trim();
716
+ if (trimmed.startsWith('//') || trimmed.startsWith('*') || trimmed.startsWith('/*')) { continue; }
717
+ for (const call of topLevelCalls(raw, 'Image')) {
718
+ const arg = String(call.args[0] || '').trim();
719
+ if (arg === '') { continue; }
720
+ if (arg.includes('$r(') || arg.includes('$rawfile(')) { continue; }
721
+ if (/pixelmap/i.test(arg)) { continue; }
722
+ if (BARE_IDENTIFIER_RE.test(arg)) { continue; }
723
+ // A static literal (no interpolation) is not a runtime source; the rule targets values that
724
+ // are assembled at run time, where the form cannot be seen from the call site.
725
+ if (literalOf(arg) !== null) { continue; }
726
+ out.push({ line: i + 1, arg: arg });
727
+ }
728
+ }
729
+ return out;
730
+ }
731
+
732
+ /** Substitute `%s` placeholders in an already-built message pair. */
733
+ function fillMessage(template, values) {
734
+ const build = (text) => {
735
+ let result = String(text);
736
+ for (const value of values) { result = result.replace('%s', String(value)); }
737
+ return result;
738
+ };
739
+ return { en: build(template.en), cn: build(template.cn) };
740
+ }
741
+
742
+ function imageSrcMessage() {
743
+ return {
744
+ en: '[image-src-form] `Image(%s)` takes a runtime string. Check its form before shipping:' +
745
+ ' `http(s)://` URL, `file://` URI, or a data URL written as' +
746
+ ' `data:<mime>;base64,<payload>`. A data URL missing the `;base64,` marker (or a payload that' +
747
+ ' is not actually encoded) neither throws nor logs - the image simply renders as nothing.',
748
+ cn: '[image-src-form] `Image(%s)` 传入的是运行期字符串。上线前确认它的形态:`http(s)://` URL、' +
749
+ '`file://` URI,或写成 `data:<mime>;base64,<payload>` 的 data URL。data URL 少了 `;base64,`' +
750
+ ' 标记(或载荷其实不是 base64)时既不抛错也不打日志,图片只是渲染不出来。',
751
+ };
752
+ }
753
+
385
754
  /* ------------------------------------------------------------------ */
386
755
  /* Checker */
387
756
  /* ------------------------------------------------------------------ */
388
757
 
389
758
  function loadContract() {
390
759
  const parsed = safe(() => JSON.parse(fs.readFileSync(CONTRACT_FILE, 'utf8')), null);
391
- return parsed !== null && typeof parsed === 'object' ? parsed : { argContracts: {}, nullableReturns: {} };
760
+ if (parsed === null || typeof parsed !== 'object') {
761
+ return { argContracts: {}, nullableReturns: {}, sqlCapabilities: {} };
762
+ }
763
+ if (parsed.sqlCapabilities === undefined) { parsed.sqlCapabilities = {}; }
764
+ return parsed;
392
765
  }
393
766
 
394
767
  class PlatformApiContractCheck extends MethodChecker {
@@ -396,6 +769,9 @@ class PlatformApiContractCheck extends MethodChecker {
396
769
  super();
397
770
  this.contract = loadContract();
398
771
  this.extraData = new ExtraDataSubCheck(this);
772
+ this.scannedFiles = new Set();
773
+ this.reported = new Set();
774
+ this.runtimeOsCache = new Map();
399
775
  this.messages = {
400
776
  bufferArg: {
401
777
  en: '[buffer-arg-type] %s is called with `%s`, but the parameter must be a real %s — the SDK returns `undefined` for the wrong buffer type, and the next member access throws "Cannot read property … of undefined" (uncaught, the process is killed). Pass an ArrayBuffer: `bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength)`.',
@@ -408,7 +784,17 @@ class PlatformApiContractCheck extends MethodChecker {
408
784
  };
409
785
  }
410
786
 
787
+ reset() {
788
+ if (typeof super.reset === 'function') { super.reset(); }
789
+ this.scannedFiles = new Set();
790
+ this.reported = new Set();
791
+ this.runtimeOsCache = new Map();
792
+ }
793
+
411
794
  check(method) {
795
+ // Whole-file checks run even when this method has no CFG events, so a file whose methods are
796
+ // all empty still gets its DDL / Image scan.
797
+ this.checkFileContracts(method);
412
798
  // Value-domain contract (extraData) has its own CFG walk and wording.
413
799
  this.extraData.check(method);
414
800
  const events = statementEventsOf(method, this.contract);
@@ -424,6 +810,16 @@ class PlatformApiContractCheck extends MethodChecker {
424
810
  severity: AlertLevel.ERROR,
425
811
  });
426
812
  }
813
+ for (const finding of selectEncodedArgFindings(events, this.contract)) {
814
+ this.addIssue({
815
+ filePath: filePath,
816
+ line: finding.line,
817
+ colStart: 0,
818
+ colEnd: 0,
819
+ message: encodedArgMessage(finding.api, finding.arg, finding.expect),
820
+ severity: AlertLevel.WARN,
821
+ });
822
+ }
427
823
  for (const finding of selectNullableReturnFindings(events, this.contract)) {
428
824
  this.addIssue({
429
825
  filePath: filePath,
@@ -436,6 +832,71 @@ class PlatformApiContractCheck extends MethodChecker {
436
832
  }
437
833
  }
438
834
 
835
+ /**
836
+ * Whole-file checks, once per declaring file: the DDL strings usually live in a schema helper and
837
+ * the `Image(...)` call sites are spread across page components, not in the method under review.
838
+ */
839
+ checkFileContracts(method) {
840
+ const filePath = safe(() => method.getDeclaringArkFile().getFilePath(), '');
841
+ if (filePath === '' || this.scannedFiles.has(filePath)) { return; }
842
+ this.scannedFiles.add(filePath);
843
+ const text = safe(() => fs.readFileSync(filePath, 'utf8'), '');
844
+ if (text === '') { return; }
845
+ const code = stripComments(text);
846
+ this.checkSqlCapabilities(filePath, code);
847
+ this.checkImageSource(filePath, code);
848
+ }
849
+
850
+ /** Cached `runtimeOS` per directory: a project has many files but one build-profile.json5. */
851
+ runtimeOSOf(filePath) {
852
+ const dir = path.dirname(path.resolve(filePath));
853
+ const cached = this.runtimeOsCache.get(dir);
854
+ if (cached !== undefined) { return cached; }
855
+ const value = resolveRuntimeOS(filePath);
856
+ this.runtimeOsCache.set(dir, value);
857
+ return value;
858
+ }
859
+
860
+ /** SQL capability contract: only a capability the table marks `false` is reported. */
861
+ checkSqlCapabilities(filePath, text) {
862
+ if (text.toLowerCase().indexOf('virtual table') < 0) { return; }
863
+ const caps = this.contract.sqlCapabilities;
864
+ if (caps === undefined || caps === null || typeof caps !== 'object') { return; }
865
+ const platform = this.runtimeOSOf(filePath);
866
+ if (platform === '') { return; } // target platform unknown: silent
867
+ for (const finding of sqlCapabilityFindings(text, caps, platform)) {
868
+ const key = 'sql-capability|' + filePath + '|' + finding.line + '|' + finding.subject;
869
+ if (this.reported.has(key)) { continue; }
870
+ this.reported.add(key);
871
+ this.addIssue({
872
+ filePath: filePath,
873
+ line: finding.line,
874
+ colStart: 0,
875
+ colEnd: 0,
876
+ message: sqlCapabilityMessage(finding, platform, caps),
877
+ severity: AlertLevel.WARN,
878
+ });
879
+ }
880
+ }
881
+
882
+ /** Runtime `Image(src)` checkpoint: the value form cannot be verified, so ask for a look. */
883
+ checkImageSource(filePath, text) {
884
+ if (text.indexOf('Image(') < 0 && text.indexOf('Image (') < 0) { return; }
885
+ for (const finding of imageSrcFindings(text)) {
886
+ const key = 'image-src-form|' + filePath + '|' + finding.line + '|' + finding.arg;
887
+ if (this.reported.has(key)) { continue; }
888
+ this.reported.add(key);
889
+ this.addIssue({
890
+ filePath: filePath,
891
+ line: finding.line,
892
+ colStart: 0,
893
+ colEnd: 0,
894
+ message: fillMessage(imageSrcMessage(), [finding.arg]),
895
+ severity: AlertLevel.WARN,
896
+ });
897
+ }
898
+ }
899
+
439
900
  render(key, values) {
440
901
  const template = this.messages[key];
441
902
  const build = (text) => {
@@ -468,6 +929,13 @@ module.exports = {
468
929
  assignmentMap,
469
930
  isAllowedArg,
470
931
  rejectReason,
932
+ allowedByTrace,
933
+ acceptedByAlternative,
471
934
  selectBufferArgFindings,
935
+ selectEncodedArgFindings,
472
936
  selectNullableReturnFindings,
937
+ sqlCapabilityFindings,
938
+ resolveRuntimeOS,
939
+ imageSrcFindings,
940
+ stripComments,
473
941
  };