@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
@@ -0,0 +1,192 @@
1
+ // arkts_static_check: overlay-builder-arrow-arg, sheet-isshow-no-writeback.
2
+ // Run from scripts/: node --test tests/arkts_static_check_sheet_builder.test.mjs
3
+ import { test } from 'node:test';
4
+ import assert from 'node:assert/strict';
5
+ import { spawnSync } from 'node:child_process';
6
+ import * as fs from 'node:fs';
7
+ import * as os from 'node:os';
8
+ import * as path from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+
11
+ const CHECKER = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'arkts_static_check.ts');
12
+
13
+ /** files: { 'pages/X.ets': src }, android: { 'feature/X.kt': src } | null -> stdout */
14
+ function run(files, android = null) {
15
+ const proj = fs.mkdtempSync(path.join(os.tmpdir(), 'asc-sheet-'));
16
+ const ets = path.join(proj, 'entry/src/main/ets');
17
+ const args = [CHECKER, '--ets', ets];
18
+ try {
19
+ for (const [rel, src] of Object.entries(files)) {
20
+ fs.mkdirSync(path.dirname(path.join(ets, rel)), { recursive: true });
21
+ fs.writeFileSync(path.join(ets, rel), src, 'utf8');
22
+ }
23
+ if (android !== null) {
24
+ const adir = path.join(proj, 'android');
25
+ for (const [rel, src] of Object.entries(android)) {
26
+ fs.mkdirSync(path.dirname(path.join(adir, rel)), { recursive: true });
27
+ fs.writeFileSync(path.join(adir, rel), src, 'utf8');
28
+ }
29
+ args.push('--android', adir);
30
+ }
31
+ return spawnSync(process.execPath, args, { encoding: 'utf8' }).stdout;
32
+ } finally {
33
+ fs.rmSync(proj, { recursive: true, force: true });
34
+ }
35
+ }
36
+
37
+ /** [file:line, ...] of one rule's hits within one section ('GATE' | 'CANDIDATES') */
38
+ function hits(out, rule, section = 'GATE') {
39
+ const gateAt = out.indexOf('[GATE]');
40
+ const candAt = out.indexOf('[CANDIDATES]');
41
+ const body = section === 'GATE' ? out.slice(gateAt, candAt < 0 ? undefined : candAt) : (candAt < 0 ? '' : out.slice(candAt));
42
+ return [...body.matchAll(new RegExp(`^ ${rule}\\s+(\\S+:\\d+)$`, 'gm'))].map((m) => m[1]);
43
+ }
44
+
45
+ const page = (body) => `@Entry
46
+ @ComponentV2
47
+ struct P {
48
+ @Local a: boolean = false;
49
+ @Param visible: boolean = false;
50
+ @Event onDismiss: () => void = () => {};
51
+ @Builder sheetA() { Text('a') }
52
+
53
+ build() {
54
+ ${body}
55
+ }
56
+ }
57
+ `;
58
+
59
+ // ---------------------------------------------------------------- overlay-builder-arrow-arg
60
+
61
+ test('bindSheet with an arrow-wrapped builder is a GATE (ds-1126 captcha sheet)', () => {
62
+ const out = run({ 'pages/P.ets': page(` Column() {
63
+ Text('x')
64
+ }
65
+ .bindSheet(this.visible, () => {
66
+ this.sheetA()
67
+ }, { onDisappear: () => { this.onDismiss() } })`) });
68
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg'), ['pages/P.ets:13']);
69
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), []);
70
+ });
71
+
72
+ test('bindContentCover and typed / async arrows are GATEs too', () => {
73
+ const out = run({ 'pages/P.ets': page(` Column() {
74
+ Text('x')
75
+ .bindContentCover(this.a!!, (): void => this.sheetA())
76
+ Text('y')
77
+ .bindSheet(this.a!!, async () => { this.sheetA() })
78
+ }`) });
79
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg'), ['pages/P.ets:12', 'pages/P.ets:14']);
80
+ });
81
+
82
+ test('a direct builder call, a builder in a string or a comment passes', () => {
83
+ const out = run({ 'pages/P.ets': page(` Column() {
84
+ Text('.bindSheet(this.a, () => {})')
85
+ // .bindSheet(this.a, () => { this.sheetA() })
86
+ }
87
+ .bindSheet(this.a!!, this.sheetA(), { height: SheetSize.FIT_CONTENT })`) });
88
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg'), []);
89
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg', 'CANDIDATES'), []);
90
+ });
91
+
92
+ test('overlay / background with an arrow builder is a CAND, a builder call is not', () => {
93
+ const out = run({ 'pages/P.ets': page(` Column() {
94
+ Text('x').overlay(() => { this.sheetA() })
95
+ Text('y').background(this.sheetA())
96
+ Text('z').onClick(() => { this.a = true })
97
+ }`) });
98
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg'), []);
99
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg', 'CANDIDATES'), ['pages/P.ets:11']);
100
+ });
101
+
102
+ // ---------------------------------------------------------------- sheet-isshow-no-writeback
103
+
104
+ test('one-way isShow without a close callback is a GATE, with or without options', () => {
105
+ const out = run({ 'pages/P.ets': page(` Column() {
106
+ Text('x')
107
+ .bindSheet(this.visible, this.sheetA())
108
+ Text('y')
109
+ .bindSheet(this.a, this.sheetA(), { height: SheetSize.LARGE })
110
+ }`) });
111
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), ['pages/P.ets:12', 'pages/P.ets:14']);
112
+ });
113
+
114
+ test('two-way binding or any close callback passes', () => {
115
+ const out = run({ 'pages/P.ets': page(` Column() {
116
+ Text('a').bindSheet($$this.a, this.sheetA())
117
+ Text('b').bindSheet(this.a!!, this.sheetA())
118
+ Text('c').bindSheet(this.visible, this.sheetA(), { onDisappear: () => { this.onDismiss() } })
119
+ Text('d').bindContentCover(this.visible, this.sheetA(), { onWillDismiss: () => { this.onDismiss() } })
120
+ Text('e').bindSheet(this.visible, this.sheetA(), { shouldDismiss: () => { this.onDismiss() } })
121
+ }`) });
122
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), []);
123
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback', 'CANDIDATES'), []);
124
+ });
125
+
126
+ test('options passed as a variable is a CAND', () => {
127
+ const out = run({ 'pages/P.ets': page(` Column() {
128
+ Text('x').bindSheet(this.visible, this.sheetA(), this.sheetOptions())
129
+ }`) });
130
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), []);
131
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback', 'CANDIDATES'), ['pages/P.ets:11']);
132
+ });
133
+
134
+ test('bindMenu / bindContextMenu / function literal builders; $$ isShow with an arrow reports only the arrow', () => {
135
+ const out = run({ 'pages/P.ets': page(` Column() {
136
+ Text('x').bindMenu(() => { this.sheetA() })
137
+ Text('y').bindContextMenu(function () { }, ResponseType.LongPress)
138
+ Text('z').bindSheet($$this.a, () => { this.sheetA() })
139
+ Text('w').bindContentCover(this.a!!, function () { })
140
+ }`) });
141
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg', 'CANDIDATES'), ['pages/P.ets:11', 'pages/P.ets:12']);
142
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg'), ['pages/P.ets:13', 'pages/P.ets:14']);
143
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), []);
144
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback', 'CANDIDATES'), []);
145
+ });
146
+
147
+ test('SHEET-BUILDER-ARROW marker downgrades the arrow GATE to a CAND', () => {
148
+ const out = run({ 'pages/P.ets': page(` Column() {
149
+ // SHEET-BUILDER-ARROW: verified on device with API 20
150
+ Text('x').bindSheet(this.a!!, () => { this.sheetA() })
151
+ }`) });
152
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg'), []);
153
+ assert.deepEqual(hits(out, 'overlay-builder-arrow-arg', 'CANDIDATES'), ['pages/P.ets:12']);
154
+ });
155
+
156
+ test('constant isShow passes', () => {
157
+ const out = run({ 'pages/P.ets': page(` Column() {
158
+ Text('a').bindSheet(true, this.sheetA())
159
+ Text('b').bindContentCover(false, this.sheetA())
160
+ }`) });
161
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), []);
162
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback', 'CANDIDATES'), []);
163
+ });
164
+
165
+ test('bindContentCover with a ModalTransition third argument is a GATE', () => {
166
+ const out = run({ 'pages/P.ets': page(` Column() {
167
+ Text('x').bindContentCover(this.visible, this.sheetA(), ModalTransition.DEFAULT)
168
+ }`) });
169
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), ['pages/P.ets:11']);
170
+ assert.match(out, /ModalTransition/);
171
+ });
172
+
173
+ test('a close callback that never writes state back is a CAND; one that blocks dismiss or is a reference passes', () => {
174
+ const out = run({ 'pages/P.ets': page(` Column() {
175
+ Text('a').bindSheet(this.visible, this.sheetA(), { onWillDisappear: () => { console.info('x') } })
176
+ Text('b').bindSheet(this.visible, this.sheetA(), { onWillDismiss: (d: DismissSheetAction) => { d.dismiss() } })
177
+ Text('c').bindSheet(this.visible, this.sheetA(), { shouldDismiss: (s: SheetDismiss) => { console.info('no') } })
178
+ Text('d').bindSheet(this.visible, this.sheetA(), { onDisappear: this.onDismiss })
179
+ Text('e').bindSheet(this.a, this.sheetA(), { onDisappear: () => { this.a = false } })
180
+ }`) });
181
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), []);
182
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback', 'CANDIDATES'), ['pages/P.ets:11', 'pages/P.ets:12']);
183
+ });
184
+
185
+ test('SHEET-CLOSE-OWNED marker downgrades the writeback GATE to a CAND', () => {
186
+ const out = run({ 'pages/P.ets': page(` Column() {
187
+ // SHEET-CLOSE-OWNED: parent resets visible from its own onDisappear
188
+ Text('x').bindSheet(this.visible, this.sheetA())
189
+ }`) });
190
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback'), []);
191
+ assert.deepEqual(hits(out, 'sheet-isshow-no-writeback', 'CANDIDATES'), ['pages/P.ets:12']);
192
+ });
@@ -19,6 +19,8 @@ const TOKENS = `export class AppColors {
19
19
  static readonly DANGER: string = '#FF2B2B';
20
20
  static readonly ORDER_NO: string = '#10086';
21
21
  static readonly YEAR: string = '#2024';
22
+ static readonly HINT: string = 'rgba(255,255,255,0.5)';
23
+ static readonly CLEAR: string = 'rgba(0, 0, 0, 0)';
22
24
  }
23
25
  `;
24
26
  const PAGE = `@Entry
@@ -66,7 +68,7 @@ function run(mode) {
66
68
  test('dynamic theme: hex tokens, Color.White attr and a sheet without backgroundColor are GATE', () => {
67
69
  const r = run('light-dark+runtime-color');
68
70
  // '#333333' (all digits, 6 long) is a colour; Color.Black on the line after `color:` is an argument too
69
- assert.deepEqual(r.at(r.gate, 'theme-color-literal').sort(), ['Tokens.ets:2', 'Tokens.ets:3', 'pages/P.ets:13', 'pages/P.ets:7']);
71
+ assert.deepEqual(r.at(r.gate, 'theme-color-literal').sort(), ['Tokens.ets:2', 'Tokens.ets:3', 'Tokens.ets:9', 'pages/P.ets:13', 'pages/P.ets:7']);
70
72
  assert.deepEqual(r.at(r.gate, 'theme-sheet-background-default'), ['pages/P.ets:8']);
71
73
  assert.equal(r.code, 1);
72
74
  });
@@ -75,7 +77,7 @@ test('THEME-FIXED downgrades to CAND; transparent, digit-only copy text and labe
75
77
  const r = run('light-dark');
76
78
  assert.deepEqual(r.at(r.cand, 'theme-color-literal'), ['Tokens.ets:6']);
77
79
  // SCRIM (transparent), ORDER_NO ('#10086', 5 digits) and YEAR ('#2024', copy text) are not reported
78
- assert.equal(/Tokens\.ets:(4|7|8)\b/.test(r.gate + r.cand), false);
80
+ assert.equal(/Tokens\.ets:(4|7|8|10)\b/.test(r.gate + r.cand), false);
79
81
  });
80
82
 
81
83
  test('static theme or no contract: neither rule fires', () => {
@@ -691,3 +691,41 @@ test('overlays_owned_elsewhere names the overlay file of a page-anchored owner;
691
691
  fs.rmSync(tmp, { recursive: true, force: true });
692
692
  }
693
693
  });
694
+
695
+ test('host_effects of an open-overlay edge reach source-only and captured meta.json and conversion_set.json', () => {
696
+ // ydweather ds-1126: opening the daily panel also hides the weather content (showHideWeatherContent(false)).
697
+ const FX = { open: [{ id: 'fx:WeatherDailyPanel.kt:189', stmt: 'showHideWeatherContent?.invoke(false)',
698
+ at: 'w/WeatherDailyPanel.kt:189', resolved: [{ stmt: 'contentOpacity = if (show) 1f else 0f', at: 'w/WeatherContentList.kt:59' }] }],
699
+ dismiss: [{ id: 'fx:WeatherDailyPanel.kt:94', stmt: 'showHideWeatherContent?.invoke(true)', at: 'w/WeatherDailyPanel.kt:94', resolved: [] }] };
700
+ const tmp = mkTmp();
701
+ try {
702
+ const ws = path.join(tmp, 'ws');
703
+ const ui = path.join(tmp, 'ui');
704
+ w(path.join(ws, 'utg.json'), {
705
+ nodes: [{ id: 'activity:Main', kind: 'activity', status: 'static-only' },
706
+ { id: 'activity:Other', kind: 'activity', status: 'static-only' },
707
+ { id: 'overlay:DailyDetail', kind: 'screen', status: 'static-only' }],
708
+ links: [{ source: 'activity:Main', target: 'overlay:DailyDetail', mechanism: 'open-overlay', args: { host_effects: FX } },
709
+ { source: 'activity:Main', target: 'activity:Other', mechanism: 'start-activity', args: { host_effects: { open: [], dismiss: [] } } }],
710
+ });
711
+ w(path.join(ws, 'click_paths.json'), { paths: {} });
712
+ w(path.join(ui, 'page_0001_Main', 'meta.json'), { page_id: 'page_0001_Main', static_node: 'activity:Main', screenshots: [] });
713
+ w(path.join(ui, 'export_manifest.json'), { pages: [{ page_dir: 'page_0001_Main', static_node: 'activity:Main' }] });
714
+ w(path.join(ui, 'pages.json'), { pages: [] });
715
+ bcs.build(ws, ui);
716
+ const cap = readDoc(path.join(ui, 'page_0001_Main', 'meta.json'));
717
+ assert.deepEqual(cap.overlay_effects, [{ source: 'activity:Main', target: 'overlay:DailyDetail', mechanism: 'open-overlay',
718
+ trigger: null, host_effects: FX }]);
719
+ const pages = readDoc(path.join(ui, 'pages.json')).pages;
720
+ const detailDir = pages.map((p) => p.page_dir).find((d) => /DailyDetail/.test(d));
721
+ assert.ok(detailDir, 'the overlay screen converts as a page');
722
+ const src = readDoc(path.join(detailDir, 'meta.json'));
723
+ assert.deepEqual(src.reached_from[0].host_effects, FX);
724
+ const other = pages.map((p) => p.page_dir).find((d) => /Other/.test(d));
725
+ assert.equal('host_effects' in readDoc(path.join(other, 'meta.json')).reached_from[0], false, 'an empty host_effects is dropped');
726
+ const cs = readDoc(path.join(ui, 'conversion_set.json'));
727
+ assert.deepEqual(cs.overlay_effects.map((e) => [e.source, e.target]), [['activity:Main', 'overlay:DailyDetail']]);
728
+ } finally {
729
+ fs.rmSync(tmp, { recursive: true, force: true });
730
+ }
731
+ });
@@ -0,0 +1,106 @@
1
+ // Compose shared-composable families (build_conversion_set.mjs composeKeys / shared_families) and the leader's
2
+ // cross-module placement rule (group_queue.mjs SHARED_FAMILY_RULE).
3
+ // Run from scripts/: node --test tests/build_conversion_set_compose.test.mjs
4
+
5
+ import { test, describe, beforeEach, afterEach } from 'node:test';
6
+ import assert from 'node:assert/strict';
7
+ import * as fs from 'node:fs';
8
+ import * as os from 'node:os';
9
+ import * as path from 'node:path';
10
+
11
+ import * as bcs from '../build_conversion_set.mjs';
12
+ import * as gq from '../group_queue.mjs';
13
+
14
+ function w(p, data) {
15
+ fs.mkdirSync(path.dirname(p), { recursive: true });
16
+ fs.writeFileSync(p, typeof data === 'string' ? data : JSON.stringify(data), 'utf8');
17
+ }
18
+
19
+ const SCAFFOLD = 'app/src/main/java/x/ui/component/CaptureScaffold.kt';
20
+ const HOME = 'app/src/main/java/x/ui/screen/home/HomeScreen.kt';
21
+ const capture = (name) => ({
22
+ id: `compose-route:${name}_capture`, kind: 'compose-route', status: 'static-only',
23
+ declared_at: `app/src/main/java/x/ui/screen/${name}/nav/${name}CaptureNav.kt:40`,
24
+ widgets: [{ widget: 'Text', kind: 'text', at: `${SCAFFOLD}:148`, text: '©', via: 'CaptureScaffold' },
25
+ { widget: 'Text', kind: 'text', at: `app/src/main/java/x/ui/screen/${name}/${name}CaptureScreen.kt:30`,
26
+ via: `${name}CaptureScreen` }],
27
+ });
28
+ // The static stage resolved each screen's own private `Item` into HomeScreen.kt (measured: 7 pages).
29
+ const withItem = (id) => ({
30
+ id, kind: 'compose-route', status: 'static-only',
31
+ widgets: [{ widget: 'Row', kind: 'row', at: `${HOME}:397`, via: 'Item' }],
32
+ });
33
+
34
+ describe('compose shared-composable families', () => {
35
+ let tmp; let hp; let ws; let ui; let src;
36
+ beforeEach(() => {
37
+ tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'bcs-compose-'));
38
+ hp = path.join(tmp, 'hmos');
39
+ ws = path.join(hp, '.hometrans', 'utg_static');
40
+ ui = path.join(hp, '.hometrans', 'ui_info');
41
+ src = path.join(tmp, 'android');
42
+ w(path.join(ws, 'utg.json'), { nodes: [capture('idiom'), capture('lyric'), capture('writing'),
43
+ withItem('compose-route:home'), withItem('compose-route:settings')], links: [] });
44
+ w(path.join(ws, 'click_paths.json'), { paths: {} });
45
+ w(path.join(ui, 'pages.json'), { pages: [] });
46
+ w(path.join(src, SCAFFOLD), '@Composable\nfun CaptureScaffold(onBackClick: () -> Unit) {}\n');
47
+ w(path.join(src, HOME), '@Composable\nprivate fun Item(title: String) {}\n');
48
+ w(path.join(hp, '.hometrans', 'module_placement.json'), { schema: 'module-placement/1', ui_module: 'products/phone',
49
+ groups: {
50
+ 'compose-route:idiom_capture': { module: 'features/phrase' },
51
+ 'compose-route:lyric_capture': { module: 'features/reading' },
52
+ 'compose-route:writing_capture': { module: 'features/reading' },
53
+ } });
54
+ });
55
+ afterEach(() => fs.rmSync(tmp, { recursive: true, force: true }));
56
+
57
+ const groups = () => {
58
+ const doc = JSON.parse(fs.readFileSync(path.join(ui, 'conversion_set.json'), 'utf8'));
59
+ return Object.fromEntries(doc.plan.groups.map((g) => [g.anchor, g]));
60
+ };
61
+
62
+ test('pages wrapping one composable form a family; the leader records the modules it spans', () => {
63
+ bcs.build(ws, ui, null, false, false, { source: src });
64
+ const g = groups();
65
+ const fam = `compose:${SCAFFOLD}#CaptureScaffold`;
66
+ const lead = g['compose-route:idiom_capture'];
67
+ for (const a of ['compose-route:lyric_capture', 'compose-route:writing_capture']) {
68
+ assert.deepEqual(g[a].reuse_from, [{ family: fam, from: lead.id }]);
69
+ assert.ok(g[a].after.includes(lead.id), `${a} waits for the leader (same stage)`);
70
+ }
71
+ assert.deepEqual(lead.shared_families, [{ family: fam, modules: ['features/phrase', 'features/reading'] }]);
72
+ // a page's own Screen composable is held by one page only: no family
73
+ assert.ok(!JSON.stringify(g).includes('idiomCaptureScreen"'));
74
+ });
75
+
76
+ test('a private composable is never a family, with or without the source', () => {
77
+ bcs.build(ws, ui, null, false, false, { source: src });
78
+ assert.deepEqual(groups()['compose-route:settings'].reuse_from, []);
79
+ // without the source: HomeScreen.kt is not named after `Item` and is no component dir
80
+ bcs.build(ws, ui, null, false, false, {});
81
+ const g = groups();
82
+ assert.deepEqual(g['compose-route:settings'].reuse_from, []);
83
+ assert.equal(g['compose-route:lyric_capture'].reuse_from.length, 1);
84
+ });
85
+
86
+ test('the Android root defaults to the project the static stage recorded', () => {
87
+ w(path.join(src, SCAFFOLD), '@Composable\nprivate fun CaptureScaffold() {}\n'); // made private: no family
88
+ w(path.join(ws, 'pipeline_summary.json'), { project: src });
89
+ bcs.build(ws, ui, null, false, false, {});
90
+ assert.deepEqual(groups()['compose-route:lyric_capture'].reuse_from, []);
91
+ });
92
+
93
+ test('shareableByPath keeps named or component-dir files only', () => {
94
+ assert.equal(bcs.shareableByPath(SCAFFOLD, 'CaptureScaffold'), true);
95
+ assert.equal(bcs.shareableByPath('a/ui/screen/k/components/KnowledgePanel.kt', 'Panel'), true);
96
+ assert.equal(bcs.shareableByPath(HOME, 'Item'), false);
97
+ });
98
+
99
+ test('the leader is told to write a cross-module family into common/', () => {
100
+ const plan = new Map([['G001', { id: 'G001', shared_families: [{ family: 'compose:a#S', modules: ['features/a', 'features/b'] }] }],
101
+ ['G002', { id: 'G002' }]]);
102
+ assert.deepEqual(gq._sharedFamilies(plan, ['G002']), {});
103
+ assert.deepEqual(gq._sharedFamilies(plan, ['G001']).G001[0].modules, ['features/a', 'features/b']);
104
+ assert.match(gq.SHARED_FAMILY_RULE, /common\/\*/);
105
+ });
106
+ });
@@ -80,6 +80,21 @@ describe('Commit', () => {
80
80
  assert.equal(subjects()[0], 'G2: Settings (source-only)');
81
81
  });
82
82
 
83
+ test('a verified group whose own commit failed (commit_pending.json) keeps its files from the next commit', () => {
84
+ write('entry/src/main/ets/pages/MainPage.ets', T0 + 60); // G1's, its commit failed
85
+ write('entry/src/main/ets/pages/SettingsPage.ets', T0 + 120); // G2's
86
+ queue({ G1: 'verified', G2: 'returned', G3: 'pending' });
87
+ let r = gc.select(hp, 'G2');
88
+ assert.ok(r.files.includes('entry/src/main/ets/pages/MainPage.ets'), 'settled: up for grabs (before the fix, always)');
89
+ fs.mkdirSync(path.join(meta, 'queue_logs'), { recursive: true });
90
+ fs.writeFileSync(path.join(meta, 'queue_logs', 'commit_pending.json'), JSON.stringify({ G1: { error: 'index.lock', at: 1 } }));
91
+ r = gc.select(hp, 'G2');
92
+ assert.deepEqual(r.held, ['entry/src/main/ets/pages/MainPage.ets']);
93
+ assert.deepEqual(r.files, ['entry/src/main/ets/pages/SettingsPage.ets']);
94
+ // G1's own retry still takes them
95
+ assert.ok(gc.select(hp, 'G1').files.includes('entry/src/main/ets/pages/MainPage.ets'));
96
+ });
97
+
83
98
  test('an unsettled group\'s reported unpredicted files are held', () => {
84
99
  write('entry/src/main/ets/pages/MainPage.ets', T0 + 60);
85
100
  write('entry/src/main/ets/components/SettingsRow.ets', T0 + 90); // not predicted, G2's
@@ -0,0 +1,150 @@
1
+ // group_pass: one pass of the Step 5.4 loop (release, verify, lease) as a single command.
2
+ import { test, describe, beforeEach, afterEach } from 'node:test';
3
+ import assert from 'node:assert/strict';
4
+ import * as fs from 'node:fs';
5
+ import * as os from 'node:os';
6
+ import * as path from 'node:path';
7
+ import * as gq from '../group_queue.mjs';
8
+ import { pass, blockingIssues, headingBlocking, trailingJson, commitOutcome, loadPending } from '../group_pass.mjs';
9
+
10
+ describe('Pass', () => {
11
+ let temp; let hp; let prompts; let real;
12
+ const meta = () => path.join(hp, '.hometrans');
13
+
14
+ beforeEach(() => {
15
+ temp = fs.mkdtempSync(path.join(os.tmpdir(), 'gp-'));
16
+ hp = path.join(temp, 'hp');
17
+ fs.mkdirSync(path.join(meta(), 'ui_info'), { recursive: true });
18
+ fs.mkdirSync(path.join(hp, 'entry', 'src', 'main', 'ets', 'pages'), { recursive: true });
19
+ const groups = [
20
+ { id: 'G001', stage: 1, lane: null, after: [], page_dirs: ['p1'], predicted_writes: ['pages/A.ets'] },
21
+ { id: 'G002', stage: 1, lane: null, after: [], page_dirs: ['p2'], predicted_writes: ['pages/B.ets'] },
22
+ ];
23
+ fs.writeFileSync(path.join(meta(), 'ui_info', 'conversion_set.json'), JSON.stringify({ plan: { groups } }), 'utf8');
24
+ fs.writeFileSync(path.join(meta(), 'batch_progress.json'), JSON.stringify({ ui_module: 'entry', pages: {} }), 'utf8');
25
+ prompts = path.join(temp, 'prompts');
26
+ fs.mkdirSync(prompts);
27
+ for (const g of groups) fs.writeFileSync(path.join(prompts, `${g.id}.md`), 'convert', 'utf8');
28
+ real = gq._impl.host;
29
+ gq._impl.host = () => 'deveco'; // a host that cannot cancel: stalled units are released by the pass
30
+ });
31
+
32
+ afterEach(() => {
33
+ gq._impl.host = real;
34
+ fs.rmSync(temp, { recursive: true, force: true, maxRetries: 10, retryDelay: 200 });
35
+ });
36
+
37
+ test('leases on the first pass, then settles a reported group on the next', () => {
38
+ gq.init(hp, { prompts, width: 2, stall_min: 15, batch_groups: 1, batch_pages: 8 });
39
+ const first = pass(hp, { commit: false });
40
+ assert.deepEqual(first.dispatch.map((d) => d.unit).sort(), ['G001', 'G002']);
41
+ assert.match(first.next, /bind/);
42
+ for (const d of first.dispatch) gq.bind(hp, d.unit, `ses_${d.unit}`);
43
+ const logs = path.join(meta(), 'queue_logs');
44
+ fs.mkdirSync(logs, { recursive: true });
45
+ fs.writeFileSync(path.join(logs, 'G001.report.md'), '## REPORT G001\nwrote pages/A.ets\n', 'utf8');
46
+ fs.writeFileSync(path.join(hp, 'entry', 'src', 'main', 'ets', 'pages', 'A.ets'), 'struct A {}', 'utf8');
47
+ const second = pass(hp, { commit: false, lease: false });
48
+ assert.deepEqual(second.released, ['G001']);
49
+ // phase5_check decides: either it verified the group or it asked for a fix; never left returned
50
+ assert.equal(second.verified.length + second.requeued.length + second.needs_human.length, 1);
51
+ assert.equal(gq.loadState(hp).groups.G001.state === 'returned', false);
52
+ });
53
+
54
+ test('a checkpoint commit that failed stays pending and is retried on every pass until it lands', () => {
55
+ gq.init(hp, { prompts, width: 2, stall_min: 15, batch_groups: 1, batch_pages: 8 });
56
+ pass(hp, { commit: false }); // leases (dispatches) G001 and G002
57
+ const pend = path.join(meta(), 'queue_logs', 'commit_pending.json');
58
+ fs.mkdirSync(path.dirname(pend), { recursive: true });
59
+ fs.writeFileSync(pend, JSON.stringify({ G001: { error: 'index.lock', at: 1 }, G999: { error: 'x', at: 1 } }));
60
+ // the temp project is no git work tree: G001's commit fails again; G999 is no group of the plan
61
+ const r = pass(hp, { commit: true, lease: false });
62
+ assert.equal(r.committed_late.length, 2);
63
+ assert.ok(r.committed_late.every((c) => c.commit_error));
64
+ assert.ok(r.needs_human.some((n) => n.group === 'G001' && /retried on the next pass/.test(n.hint)));
65
+ assert.ok(r.needs_human.some((n) => n.group === 'G999' && /dropped from commit_pending/.test(n.hint)));
66
+ assert.deepEqual(Object.keys(JSON.parse(fs.readFileSync(pend, 'utf8'))), ['G001'], 'a permanent failure is not retried forever');
67
+ });
68
+ });
69
+
70
+ describe('phase5 output for a requeue', () => {
71
+ const out = [
72
+ 'phase5_check — 2 file(s); blocking=3', '',
73
+ '[static GATE, these files] 1 (blocking)', ' unwired-handler pages/A.ets:12 onClick is empty',
74
+ '[static CANDIDATES, these files] 1 — annotate in the matching EVIDENCE item', ' inset-double-applied pages/A.ets:30', '',
75
+ '[text_color] measured text color vs code font color (1 capture dirs, 4 texts compared): GATE 0 (blocking), CAND 1', ' [cand] Title', '',
76
+ '[missing_files] files not found (blocking): 0', '',
77
+ '[unresolved_resources] $r / $rawfile that do not resolve in resources/ (blocking): 2', ' pages/A.ets:3 app.media.x', ' pages/A.ets:4 app.color.y', '',
78
+ '[drawing_candidates] Android custom drawing (candidate, not blocking: confirm with --group / --report): 1', ' Chart.kt', '',
79
+ '[evidence_overlong] EVIDENCE blocks over budget (compress: conclusion + source pointer): 1', ' pages/A.ets:40',
80
+ ].join(String.fromCharCode(10));
81
+
82
+ test('only sections with a non-zero blocking count, with their items', () => {
83
+ const s = blockingIssues(out);
84
+ assert.match(s, /\[static GATE, these files\] 1 \(blocking\) \| unwired-handler +pages\/A\.ets:12/);
85
+ assert.match(s, /app\.media\.x \| pages\/A\.ets:4 app\.color\.y/);
86
+ for (const not of ['missing_files', 'CANDIDATES', 'text_color', 'Chart.kt', 'evidence_overlong', '[cand]']) assert.ok(!s.includes(not), not);
87
+ });
88
+
89
+ test('missing files are told apart from a zero count; an error heading counts as one', () => {
90
+ assert.equal(headingBlocking('[missing_files] files not found (blocking): 0'), 0);
91
+ assert.equal(headingBlocking('[missing_files] files not found (blocking): 2'), 2);
92
+ assert.equal(headingBlocking('[static] checker crashed (blocking: no GATE verdict; fix the checker run and re-run)'), 1);
93
+ assert.equal(headingBlocking('[icons] reference icons vs // ICON markers (3 icons): GATE 2 (blocking), CAND 0'), 2);
94
+ // phase5 prints this one on every run (phase5_check sections)
95
+ assert.equal(headingBlocking('[evidence_misnamed] EVIDENCE(name) not a Phase 5 heading verbatim (blocking: rename): 0'), 0);
96
+ assert.equal(headingBlocking('[evidence_misnamed] EVIDENCE(name) not a Phase 5 heading verbatim (blocking: rename): 3'), 3);
97
+ assert.equal(headingBlocking('[degrade_reason_ruled_out] 已降级 whose only reason is 未捕获 — implement it from source, or name the platform gap (blocking): 0'), 0);
98
+ });
99
+ });
100
+
101
+ describe('commitOutcome', () => {
102
+ const fresh = () => ({ verified: [], needs_human: [] });
103
+ test('a commit is recorded with its short sha', () => {
104
+ const out = fresh();
105
+ commitOutcome(out, 'G1', { code: 0, out: '', json: { group: 'G1', commit: '0123456789abcdef' } });
106
+ assert.deepEqual(out.verified, [{ group: 'G1', commit: '01234567' }]);
107
+ assert.deepEqual(out.needs_human, []);
108
+ });
109
+ test('nothing of the group changed: verified, no commit, nobody bothered', () => {
110
+ const out = fresh();
111
+ commitOutcome(out, 'G1', { code: 0, out: '', json: { group: 'G1', commit: null, reason: 'nothing changed that belongs to this group' } });
112
+ assert.equal(out.verified[0].commit_skipped, 'nothing changed that belongs to this group');
113
+ assert.deepEqual(out.needs_human, []);
114
+ });
115
+ test('git refused (exit 1, no JSON): verified with commit_error, and the parent is told', () => {
116
+ const out = fresh();
117
+ const err = commitOutcome(out, 'G1', { code: 1, out: 'git commit failed: fatal: Unable to create index.lock', json: null });
118
+ assert.match(err, /index\.lock/);
119
+ assert.match(out.verified[0].commit_error, /index\.lock/);
120
+ assert.equal(out.needs_human.length, 1);
121
+ assert.match(out.needs_human[0].hint, /not committed/);
122
+ });
123
+ test('a settled commit returns null; a retried one is reported under committed_late', () => {
124
+ const out = fresh();
125
+ assert.equal(commitOutcome(out, 'G1', { code: 0, out: '', json: { commit: 'abcdef0123' } }, 'committed_late'), null);
126
+ assert.deepEqual(out.committed_late, [{ group: 'G1', commit: 'abcdef01' }]);
127
+ assert.deepEqual(out.verified, []);
128
+ });
129
+ });
130
+
131
+ describe('a pass without a queue', () => {
132
+ test('says to run group_queue init instead of a TypeError', () => {
133
+ const hp = fs.mkdtempSync(path.join(os.tmpdir(), 'gp-noq-'));
134
+ try {
135
+ assert.throws(() => pass(hp, { commit: false, lease: false }), /group_queue\.mjs init/);
136
+ assert.deepEqual(loadPending(hp), {});
137
+ } finally { fs.rmSync(hp, { recursive: true, force: true }); }
138
+ });
139
+ });
140
+
141
+ describe('trailingJson', () => {
142
+ const NL = String.fromCharCode(10);
143
+ test('the last top-level object of stdout, past text with braces before it', () => {
144
+ assert.deepEqual(trailingJson(['reaped {2} units', '{"reported":["G1"]}', ''].join(NL)), { reported: ['G1'] });
145
+ assert.deepEqual(trailingJson(['log', '{', ' "a": {', ' "b": 1', ' }', '}', ''].join(NL)), { a: { b: 1 } });
146
+ assert.deepEqual(trailingJson(['{"first":1}', '{"last":2}'].join(NL)), { last: 2 });
147
+ assert.equal(trailingJson('no json here {'), null);
148
+ });
149
+ });
150
+