@buaa_smat/hometrans 26.0.2 → 26.0.3

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 (1053) hide show
  1. package/README.md +7 -6
  2. package/agents/code-reviewer.md +25 -138
  3. package/dist/cli/index.js +4 -1
  4. package/dist/cli/init.js +131 -26
  5. package/dist/cli/uninstall.js +5 -5
  6. package/dist/platform/language.js +77 -0
  7. package/env-requirements.json +30 -5
  8. package/i18n/FILE-NAMES.md +9 -0
  9. package/i18n/agents/code-reviewer.md +364 -0
  10. package/i18n/agents/model-render-worker.md +38 -0
  11. package/i18n/agents/specgen-worker.md +18 -0
  12. package/i18n/commands/hometrans.md +17 -0
  13. package/i18n/skills/a2h-app-migrate/SKILL.md +198 -0
  14. package/i18n/skills/a2h-app-migrate/references/config.example.json +28 -0
  15. package/i18n/skills/a2h-app-migrate/references/specs.example.json +19 -0
  16. package/i18n/skills/a2h-app-migrate/references/stage-map.md +50 -0
  17. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +1760 -0
  18. package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +114 -0
  19. package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1588 -0
  20. package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +657 -0
  21. package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +541 -0
  22. package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +131 -0
  23. package/i18n/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
  24. package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
  25. package/i18n/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
  26. package/i18n/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
  27. package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +698 -0
  28. package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
  29. package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
  30. package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
  31. package/i18n/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
  32. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +219 -0
  33. package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +196 -0
  34. package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
  35. package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +488 -0
  36. package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
  37. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +146 -0
  38. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +161 -0
  39. package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
  40. package/i18n/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
  41. package/i18n/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
  42. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +171 -0
  43. package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
  44. package/i18n/skills/a2h-arch-generate/SKILL.md +375 -0
  45. package/i18n/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
  46. package/i18n/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
  47. package/i18n/skills/a2h-arch-generate/references/arkts-mvvm-v2.md +1407 -0
  48. package/i18n/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
  49. package/i18n/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
  50. package/i18n/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
  51. package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
  52. package/i18n/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
  53. package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
  54. package/i18n/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
  55. package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +120 -0
  56. package/i18n/skills/a2h-arch-generate/references/source-baseline.md +93 -0
  57. package/i18n/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +360 -0
  58. package/i18n/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +798 -0
  59. package/i18n/skills/a2h-arch-generate/scripts/lib/contract_terms.mjs +40 -0
  60. package/i18n/skills/a2h-arch-generate/scripts/module_create/generate.mjs +639 -0
  61. package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
  62. package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
  63. package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
  64. package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
  65. package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
  66. package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
  67. package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1261 -0
  68. package/i18n/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
  69. package/i18n/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +851 -0
  70. package/i18n/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +982 -0
  71. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +9 -0
  72. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +192 -0
  73. package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +303 -0
  74. package/i18n/skills/a2h-arkts-logic-coder/scripts/design/move_spec_technical_reference.mjs +162 -0
  75. package/i18n/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +298 -0
  76. package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +587 -0
  77. package/i18n/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
  78. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
  79. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
  80. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
  81. package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
  82. package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
  83. package/i18n/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
  84. package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +352 -0
  85. package/i18n/skills/a2h-batch-ui-align/SKILL.md +323 -0
  86. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +31 -0
  87. package/i18n/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
  88. package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
  89. package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
  90. package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +80 -0
  91. package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +22 -0
  92. package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +87 -0
  93. package/i18n/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
  94. package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
  95. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +57 -0
  96. package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +29 -0
  97. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +705 -0
  98. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +417 -0
  99. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +139 -0
  100. package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
  101. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2549 -0
  102. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +560 -0
  103. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +148 -0
  104. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +220 -0
  105. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +28 -0
  106. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +216 -0
  107. package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +203 -0
  108. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +210 -0
  109. package/i18n/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +2005 -0
  110. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1748 -0
  111. package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
  112. package/i18n/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +245 -0
  113. package/i18n/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
  114. package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1787 -0
  115. package/i18n/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
  116. package/i18n/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
  117. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1836 -0
  118. package/i18n/skills/a2h-batch-ui-align/scripts/image_probe.mjs +405 -0
  119. package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1406 -0
  120. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1226 -0
  121. package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1220 -0
  122. package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +412 -0
  123. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
  124. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +18 -0
  125. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +173 -0
  126. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +629 -0
  127. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
  128. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +67 -0
  129. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
  130. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
  131. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
  132. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +136 -0
  133. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
  134. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +109 -0
  135. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
  136. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
  137. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
  138. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
  139. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
  140. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
  141. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
  142. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
  143. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
  144. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +551 -0
  145. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
  146. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +374 -0
  147. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
  148. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
  149. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +119 -0
  150. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
  151. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
  152. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +80 -0
  153. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +137 -0
  154. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
  155. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
  156. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
  157. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +97 -0
  158. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
  159. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -0
  160. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
  161. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
  162. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
  163. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
  164. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
  165. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
  166. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
  167. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
  168. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
  169. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
  170. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +123 -0
  171. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
  172. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
  173. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +67 -0
  174. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
  175. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
  176. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
  177. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
  178. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +427 -0
  179. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
  180. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
  181. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
  182. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
  183. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
  184. package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +560 -0
  185. package/i18n/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +245 -0
  186. package/i18n/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
  187. package/i18n/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
  188. package/i18n/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
  189. package/i18n/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
  190. package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +324 -0
  191. package/i18n/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
  192. package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +325 -0
  193. package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +48 -0
  194. package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +387 -0
  195. package/i18n/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
  196. package/i18n/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
  197. package/i18n/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +470 -0
  198. package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +59 -0
  199. package/i18n/skills/a2h-dashboard-render/SKILL.md +73 -0
  200. package/i18n/skills/a2h-dashboard-render/references/artifact-contract.jsonc +117 -0
  201. package/i18n/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
  202. package/i18n/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
  203. package/i18n/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
  204. package/i18n/skills/a2h-dashboard-render/scripts/dashboard.mjs +3245 -0
  205. package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +2048 -0
  206. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
  207. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
  208. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
  209. package/i18n/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
  210. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
  211. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
  212. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +154 -0
  213. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
  214. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
  215. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
  216. package/i18n/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
  217. package/i18n/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
  218. package/i18n/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
  219. package/i18n/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
  220. package/i18n/skills/a2h-fix-build-errors/SKILL.md +304 -0
  221. package/i18n/skills/a2h-fix-build-errors/references/arkts-strict-patterns.md +219 -0
  222. package/i18n/skills/a2h-fix-build-errors/references/rdb-entity-pattern.md +131 -0
  223. package/i18n/skills/a2h-module-semantic-docs/SKILL.md +227 -0
  224. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
  225. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
  226. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
  227. package/i18n/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
  228. package/i18n/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
  229. package/i18n/skills/a2h-page-specgen/SKILL.md +136 -0
  230. package/i18n/skills/a2h-page-specgen/references/body-language.md +177 -0
  231. package/i18n/skills/a2h-page-specgen/references/gates.md +262 -0
  232. package/i18n/skills/a2h-page-specgen/references/page-inventory.md +173 -0
  233. package/i18n/skills/a2h-page-specgen/references/spec-template.md +207 -0
  234. package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +1504 -0
  235. package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +1528 -0
  236. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +576 -0
  237. package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +138 -0
  238. package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +262 -0
  239. package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +176 -0
  240. package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +248 -0
  241. package/i18n/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
  242. package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +506 -0
  243. package/i18n/skills/a2h-page-specgen/scripts/render.mjs +299 -0
  244. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +616 -0
  245. package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +234 -0
  246. package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1166 -0
  247. package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +74 -0
  248. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +8 -0
  249. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +7 -0
  250. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +8 -0
  251. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
  252. package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +758 -0
  253. package/i18n/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
  254. package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +54 -0
  255. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +271 -0
  256. package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +54 -0
  257. package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +171 -0
  258. package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +301 -0
  259. package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +83 -0
  260. package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +139 -0
  261. package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +774 -0
  262. package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1011 -0
  263. package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +77 -0
  264. package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +419 -0
  265. package/i18n/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
  266. package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +323 -0
  267. package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +546 -0
  268. package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +511 -0
  269. package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +701 -0
  270. package/i18n/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
  271. package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1765 -0
  272. package/i18n/skills/a2h-resource-convert/SKILL.md +367 -0
  273. package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +335 -0
  274. package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +251 -0
  275. package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +219 -0
  276. package/i18n/skills/a2h-resource-convert/references/resource-mapping-rules.md +493 -0
  277. package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +249 -0
  278. package/i18n/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
  279. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +2532 -0
  280. package/i18n/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
  281. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +278 -0
  282. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +260 -0
  283. package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +163 -0
  284. package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +44 -0
  285. package/i18n/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
  286. package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +589 -0
  287. package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +506 -0
  288. package/i18n/skills/a2h-spec-generate/SKILL.md +375 -0
  289. package/i18n/skills/a2h-spec-generate/references/batch-mode.md +215 -0
  290. package/i18n/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
  291. package/i18n/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
  292. package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +184 -0
  293. package/i18n/skills/a2h-spec-generate/references/input-formats.md +27 -0
  294. package/i18n/skills/a2h-spec-generate/references/library-evidence.md +3 -0
  295. package/i18n/skills/a2h-spec-generate/references/method-discipline.md +64 -0
  296. package/i18n/skills/a2h-spec-generate/references/optional-gates.json +45 -0
  297. package/i18n/skills/a2h-spec-generate/references/recall-guide.md +84 -0
  298. package/i18n/skills/a2h-spec-generate/references/recall-terse.md +3 -0
  299. package/i18n/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
  300. package/i18n/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
  301. package/i18n/skills/a2h-spec-generate/references/review-checklist.md +22 -0
  302. package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
  303. package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
  304. package/i18n/skills/a2h-spec-generate/references/spec-samples.md +65 -0
  305. package/i18n/skills/a2h-spec-generate/references/specs.schema.json +85 -0
  306. package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +145 -0
  307. package/i18n/skills/a2h-spec-generate/references/transfer-file.md +5 -0
  308. package/i18n/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
  309. package/i18n/skills/a2h-spec-generate/references/worker-rules.md +129 -0
  310. package/i18n/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +702 -0
  311. package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +515 -0
  312. package/i18n/skills/a2h-spec-generate/scripts/collect-specs.mjs +727 -0
  313. package/i18n/skills/a2h-spec-generate/scripts/feature-stem.mjs +151 -0
  314. package/i18n/skills/a2h-spec-generate/scripts/parse_requirements.ts +515 -0
  315. package/i18n/skills/a2h-spec-generate/scripts/prepare-facts.mjs +313 -0
  316. package/i18n/skills/a2h-spec-generate/scripts/publish-specs.mjs +354 -0
  317. package/i18n/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +669 -0
  318. package/i18n/skills/a2h-spec-generate/scripts/render-tasks.mjs +385 -0
  319. package/i18n/skills/a2h-spec-generate/scripts/report.mjs +136 -0
  320. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
  321. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
  322. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
  323. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
  324. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1265 -0
  325. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1057 -0
  326. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +565 -0
  327. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +544 -0
  328. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
  329. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +317 -0
  330. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +707 -0
  331. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +436 -0
  332. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +608 -0
  333. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +650 -0
  334. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +178 -0
  335. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
  336. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +912 -0
  337. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +279 -0
  338. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +163 -0
  339. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
  340. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +256 -0
  341. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
  342. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
  343. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
  344. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
  345. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
  346. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
  347. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +340 -0
  348. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1857 -0
  349. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +262 -0
  350. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +722 -0
  351. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
  352. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
  353. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
  354. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
  355. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
  356. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
  357. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
  358. package/i18n/skills/a2h-spec-generate/template/REQ.txt +22 -0
  359. package/i18n/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
  360. package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +847 -0
  361. package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +415 -0
  362. package/i18n/skills/a2h-spec-generate/test/collect-specs.test.mjs +808 -0
  363. package/i18n/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
  364. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
  365. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
  366. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
  367. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
  368. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
  369. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
  370. package/i18n/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
  371. package/i18n/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
  372. package/i18n/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
  373. package/i18n/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
  374. package/i18n/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
  375. package/i18n/skills/a2h-spec-generate/test/report.test.mjs +47 -0
  376. package/i18n/skills/a2h-utg-explorer/SKILL.md +120 -0
  377. package/i18n/skills/a2h-utg-explorer/references/architecture.md +279 -0
  378. package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +918 -0
  379. package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +446 -0
  380. package/i18n/skills/a2h-utg-explorer/scripts/hint_check.mjs +147 -0
  381. package/i18n/skills/a2h-utg-explorer/scripts/hint_source.mjs +119 -0
  382. package/i18n/skills/a2h-utg-explorer/scripts/recover_b.mjs +550 -0
  383. package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +380 -0
  384. package/i18n/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
  385. package/i18n/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
  386. package/i18n/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
  387. package/i18n/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
  388. package/i18n/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
  389. package/i18n/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
  390. package/i18n/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
  391. package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +492 -0
  392. package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +199 -0
  393. package/i18n/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
  394. package/i18n/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
  395. package/i18n/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
  396. package/i18n/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
  397. package/i18n/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
  398. package/i18n/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
  399. package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
  400. package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
  401. package/i18n/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
  402. package/i18n/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
  403. package/i18n/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
  404. package/i18n/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
  405. package/i18n/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
  406. package/i18n/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
  407. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1412 -0
  408. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +2037 -0
  409. package/i18n/skills/a2h-utg-static/SKILL.md +368 -0
  410. package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
  411. package/i18n/skills/a2h-utg-static/references/view-interactions.md +215 -0
  412. package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +2120 -0
  413. package/i18n/skills/a2h-utg-static/scripts/audit.mjs +268 -0
  414. package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +609 -0
  415. package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +250 -0
  416. package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +374 -0
  417. package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
  418. package/i18n/skills/a2h-utg-static/scripts/fragment_nav.mjs +1137 -0
  419. package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -0
  420. package/i18n/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
  421. package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +913 -0
  422. package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +517 -0
  423. package/i18n/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
  424. package/i18n/skills/a2h-utg-static/scripts/static_prior.mjs +956 -0
  425. package/i18n/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
  426. package/i18n/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
  427. package/i18n/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
  428. package/i18n/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
  429. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +108 -0
  430. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +289 -0
  431. package/i18n/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
  432. package/i18n/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
  433. package/i18n/skills/a2h-utg-static/scripts/tests/test_fresh_branch_guard.mjs +49 -0
  434. package/i18n/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +136 -0
  435. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
  436. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
  437. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -0
  438. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
  439. package/i18n/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
  440. package/i18n/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
  441. package/i18n/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
  442. package/i18n/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +368 -0
  443. package/i18n/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
  444. package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +44 -0
  445. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
  446. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
  447. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_off_path.mjs +67 -0
  448. package/i18n/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
  449. package/i18n/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
  450. package/i18n/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
  451. package/i18n/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
  452. package/i18n/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
  453. package/i18n/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
  454. package/i18n/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +61 -0
  455. package/i18n/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
  456. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_data_table.mjs +340 -0
  457. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_relative_url.mjs +125 -0
  458. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -0
  459. package/i18n/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +340 -0
  460. package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1351 -0
  461. package/i18n/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
  462. package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
  463. package/package.json +13 -160
  464. package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
  465. package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
  466. package/skills/a2h-app-migrate/SKILL.md +17 -6
  467. package/skills/a2h-app-migrate/references/config.example.json +1 -0
  468. package/skills/a2h-app-migrate/references/stage-map.md +3 -1
  469. package/skills/a2h-app-migrate/references/workflow.yaml +138 -47
  470. package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +1 -2
  471. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +105 -39
  472. package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +7 -8
  473. package/skills/a2h-app-migrate/scripts/ledger.mjs +17 -5
  474. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +43 -7
  475. package/skills/a2h-app-migrate/scripts/run_dir.mjs +127 -41
  476. package/skills/a2h-app-migrate/scripts/spec_layout.mjs +2 -0
  477. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +38 -0
  478. package/skills/a2h-app-migrate/test/test_android_index.mjs +131 -0
  479. package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
  480. package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
  481. package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
  482. package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
  483. package/skills/a2h-app-migrate/test/test_devecocli_docs_preflight.mjs +32 -0
  484. package/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
  485. package/skills/a2h-app-migrate/test/test_entry_guards.mjs +102 -0
  486. package/skills/a2h-app-migrate/test/test_env_requirements.mjs +698 -0
  487. package/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
  488. package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
  489. package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
  490. package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +51 -0
  491. package/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
  492. package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +91 -0
  493. package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
  494. package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
  495. package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +111 -0
  496. package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +53 -0
  497. package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
  498. package/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
  499. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +219 -0
  500. package/skills/a2h-app-migrate/test/test_resume_summary.mjs +196 -0
  501. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
  502. package/skills/a2h-app-migrate/test/test_run_dir.mjs +488 -0
  503. package/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
  504. package/skills/a2h-app-migrate/test/test_spec_engine_acceptance.mjs +94 -0
  505. package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +147 -0
  506. package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +146 -0
  507. package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +161 -0
  508. package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +344 -0
  509. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
  510. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +53 -0
  511. package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
  512. package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +83 -0
  513. package/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
  514. package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +41 -0
  515. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +178 -0
  516. package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
  517. package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
  518. package/skills/a2h-arch-generate/SKILL.md +1 -1
  519. package/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
  520. package/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
  521. package/skills/a2h-arch-generate/references/homegraph-workflow.md +15 -6
  522. package/skills/a2h-arch-generate/references/module-evidence-subagent.md +2 -2
  523. package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
  524. package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +35 -46
  525. package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +33 -40
  526. package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +2 -3
  527. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
  528. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
  529. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
  530. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
  531. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
  532. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
  533. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
  534. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
  535. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
  536. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
  537. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
  538. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
  539. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
  540. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
  541. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
  542. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
  543. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
  544. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
  545. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
  546. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
  547. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
  548. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
  549. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
  550. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
  551. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
  552. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
  553. package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
  554. package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1260 -0
  555. package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +191 -0
  556. package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
  557. package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
  558. package/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
  559. package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +138 -0
  560. package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +2 -5
  561. package/skills/a2h-arkts-logic-coder/SKILL.md +21 -2
  562. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -0
  563. package/skills/a2h-arkts-logic-coder/references/code-generation.md +62 -0
  564. package/skills/a2h-arkts-logic-coder/references/spec-design.md +4 -0
  565. package/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +22 -25
  566. package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +583 -0
  567. package/skills/a2h-arkts-logic-coder/test/golden/inspect_happy.json +20 -0
  568. package/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
  569. package/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
  570. package/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
  571. package/skills/a2h-arkts-logic-coder/test/golden/resolve_cases.json +36 -0
  572. package/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
  573. package/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
  574. package/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
  575. package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +352 -0
  576. package/skills/a2h-batch-ui-align/SKILL.md +6 -4
  577. package/skills/a2h-batch-ui-align/references/cards/geometry.md +1 -1
  578. package/skills/a2h-batch-ui-align/references/cards/resources.md +4 -0
  579. package/skills/a2h-batch-ui-align/references/cards/widgets.md +22 -3
  580. package/skills/a2h-batch-ui-align/references/checker-rules.md +66 -3
  581. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +45 -8
  582. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -5
  583. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +2 -2
  584. package/skills/a2h-batch-ui-align/references/step4-prepare.md +4 -2
  585. package/skills/a2h-batch-ui-align/references/step5-convert.md +7 -5
  586. package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +6 -7
  587. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +84 -7
  588. package/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
  589. package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +229 -0
  590. package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1 -2
  591. package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +4 -5
  592. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +88 -26
  593. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +305 -12
  594. package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +231 -54
  595. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +8 -9
  596. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +18 -5
  597. package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +103 -3
  598. package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +231 -0
  599. package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +1 -5
  600. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +14 -8
  601. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +8 -0
  602. package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +3 -3
  603. package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +2 -2
  604. package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +84 -19
  605. package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +11 -4
  606. package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +2 -2
  607. package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
  608. package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +5 -5
  609. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +2 -2
  610. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +66 -2
  611. package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +119 -0
  612. package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +81 -8
  613. package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
  614. package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +123 -0
  615. package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +2 -3
  616. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +6 -0
  617. package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +217 -0
  618. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
  619. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +312 -0
  620. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
  621. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
  622. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +312 -0
  623. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
  624. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +427 -0
  625. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
  626. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
  627. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +235 -0
  628. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
  629. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
  630. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_safearea.test.mjs +742 -0
  631. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +91 -0
  632. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +86 -0
  633. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
  634. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +567 -0
  635. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +290 -0
  636. package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +74 -0
  637. package/skills/a2h-batch-ui-align/scripts/tests/detect_paradigm.test.mjs +260 -0
  638. package/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +244 -0
  639. package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +420 -0
  640. package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +31 -0
  641. package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
  642. package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
  643. package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
  644. package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
  645. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1628 -0
  646. package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
  647. package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
  648. package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
  649. package/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
  650. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +324 -0
  651. package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
  652. package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +325 -0
  653. package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +297 -0
  654. package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +48 -0
  655. package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +387 -0
  656. package/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
  657. package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
  658. package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
  659. package/skills/a2h-dashboard-render/scripts/dashboard.mjs +12 -14
  660. package/skills/a2h-dashboard-render/scripts/device_capture.mjs +29 -30
  661. package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
  662. package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
  663. package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
  664. package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
  665. package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
  666. package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
  667. package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
  668. package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
  669. package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
  670. package/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +203 -0
  671. package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
  672. package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
  673. package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
  674. package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
  675. package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
  676. package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
  677. package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
  678. package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
  679. package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
  680. package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
  681. package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
  682. package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
  683. package/skills/a2h-page-specgen/SKILL.md +136 -0
  684. package/skills/a2h-page-specgen/references/body-language.md +177 -0
  685. package/skills/a2h-page-specgen/references/evidence.md +70 -0
  686. package/skills/a2h-page-specgen/references/execution-model.md +255 -0
  687. package/skills/a2h-page-specgen/references/footprint-and-grouping.md +250 -0
  688. package/skills/a2h-page-specgen/references/gates.md +255 -0
  689. package/skills/a2h-page-specgen/references/page-inventory.md +173 -0
  690. package/skills/a2h-page-specgen/references/spec-template.md +207 -0
  691. package/skills/a2h-page-specgen/scripts/dispatch.mjs +209 -0
  692. package/skills/a2h-page-specgen/scripts/facts-build.mjs +1504 -0
  693. package/skills/a2h-page-specgen/scripts/finalize.mjs +422 -0
  694. package/skills/a2h-page-specgen/scripts/footprint.mjs +1528 -0
  695. package/skills/a2h-page-specgen/scripts/gate.mjs +558 -0
  696. package/skills/a2h-page-specgen/scripts/interactions.mjs +137 -0
  697. package/skills/a2h-page-specgen/scripts/inventory.mjs +269 -0
  698. package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +255 -0
  699. package/skills/a2h-page-specgen/scripts/lib/deps-source.mjs +399 -0
  700. package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +137 -0
  701. package/skills/a2h-page-specgen/scripts/lib/footprint-roles.mjs +278 -0
  702. package/skills/a2h-page-specgen/scripts/lib/fsx.mjs +79 -0
  703. package/skills/a2h-page-specgen/scripts/lib/hg.mjs +175 -0
  704. package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +355 -0
  705. package/skills/a2h-page-specgen/scripts/lib/prose.mjs +234 -0
  706. package/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
  707. package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +391 -0
  708. package/skills/a2h-page-specgen/scripts/lib/symbols.mjs +125 -0
  709. package/skills/a2h-page-specgen/scripts/lib/utg-io.mjs +110 -0
  710. package/skills/a2h-page-specgen/scripts/lib/waker-event-store.mjs +658 -0
  711. package/skills/a2h-page-specgen/scripts/prepare.mjs +492 -0
  712. package/skills/a2h-page-specgen/scripts/render.mjs +317 -0
  713. package/skills/a2h-page-specgen/scripts/report.mjs +7 -0
  714. package/skills/a2h-page-specgen/scripts/submission.mjs +532 -0
  715. package/skills/a2h-page-specgen/scripts/submit.mjs +79 -0
  716. package/skills/a2h-page-specgen/scripts/test/acceptance/README.md +77 -0
  717. package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +590 -0
  718. package/skills/a2h-page-specgen/scripts/test/acceptance/cases.example.json +57 -0
  719. package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +207 -0
  720. package/skills/a2h-page-specgen/scripts/test/dispatch.test.mjs +258 -0
  721. package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1164 -0
  722. package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +74 -0
  723. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Api.kt +20 -0
  724. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/BothAnnotations.kt +28 -0
  725. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Cache.kt +7 -0
  726. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Comments.kt +26 -0
  727. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Mmkv.kt +7 -0
  728. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Models.kt +19 -0
  729. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Pair.kt +7 -0
  730. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Prefs.kt +9 -0
  731. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Room.kt +11 -0
  732. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Sample.kt +43 -0
  733. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Templates.kt +34 -0
  734. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Timeouts.kt +8 -0
  735. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/androidTest/Helper.kt +5 -0
  736. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/build.gradle.kts +16 -0
  737. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/en.js.txt +5 -0
  738. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +4 -0
  739. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/libs.versions.toml +14 -0
  740. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/package.json +10 -0
  741. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values/strings.xml +10 -0
  742. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +4 -0
  743. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-land/strings.xml +5 -0
  744. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-night/strings.xml +5 -0
  745. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-v21/strings.xml +4 -0
  746. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +4 -0
  747. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/test/Legacy.kt +4 -0
  748. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/weather.proto +11 -0
  749. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/AppPreferences.kt +13 -0
  750. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/SettingsViewModel.kt +16 -0
  751. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-dao/src/UserDao.kt +28 -0
  752. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/base/strings.xml +6 -0
  753. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/fil/strings.xml +6 -0
  754. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/arrays.xml +25 -0
  755. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/strings.xml +10 -0
  756. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/xml/prefs.xml +27 -0
  757. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Api.java +19 -0
  758. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Datastore.kt +12 -0
  759. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Settings.java +13 -0
  760. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/forecast.js +14 -0
  761. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/store.js +14 -0
  762. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/BasePreferences.kt +13 -0
  763. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/Screen.kt +14 -0
  764. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/UiPreferences.kt +8 -0
  765. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-retrofit/src/AuthAPI.kt +26 -0
  766. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/AndroidManifest.xml +20 -0
  767. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/feature/auth/navigation/ScreenRoute.kt +8 -0
  768. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/pages.json +19 -0
  769. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/components/Widget.vue +11 -0
  770. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/detail/detail.vue +14 -0
  771. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/index/index.vue +24 -0
  772. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/store/userStore.js +11 -0
  773. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/uni_modules/uview-ui/components/u-thing.js +5 -0
  774. package/skills/a2h-page-specgen/scripts/test/fixtures/fp.mkdb.mjs +144 -0
  775. package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +94 -0
  776. package/skills/a2h-page-specgen/scripts/test/fixtures/src/MainFragment.java +6 -0
  777. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyListeners.java +12 -0
  778. package/skills/a2h-page-specgen/scripts/test/fixtures/src/PlainActivity.java +3 -0
  779. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
  780. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/fold-chain/utg.json +12 -0
  781. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/utg.json +34 -0
  782. package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +758 -0
  783. package/skills/a2h-page-specgen/scripts/test/footprint-roles.test.mjs +172 -0
  784. package/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
  785. package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +54 -0
  786. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +222 -0
  787. package/skills/a2h-page-specgen/scripts/test/helpers.mjs +54 -0
  788. package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +171 -0
  789. package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +301 -0
  790. package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +45 -0
  791. package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +139 -0
  792. package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +774 -0
  793. package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +464 -0
  794. package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1011 -0
  795. package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +120 -0
  796. package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +68 -0
  797. package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +390 -0
  798. package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +167 -0
  799. package/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
  800. package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +323 -0
  801. package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +546 -0
  802. package/skills/a2h-page-specgen/scripts/test/render.test.mjs +503 -0
  803. package/skills/a2h-page-specgen/scripts/test/source-text.test.mjs +181 -0
  804. package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +701 -0
  805. package/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
  806. package/skills/a2h-page-specgen/scripts/test/waker-event-store.test.mjs +1365 -0
  807. package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1765 -0
  808. package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +1979 -0
  809. package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +313 -0
  810. package/skills/a2h-page-specgen/scripts/waker.mjs +1234 -0
  811. package/skills/a2h-page-specgen/scripts/watchdog.mjs +298 -0
  812. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +49 -51
  813. package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
  814. package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
  815. package/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
  816. package/skills/a2h-spec-design-pipeline/SKILL.md +79 -78
  817. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +51 -12
  818. package/skills/a2h-spec-design-pipeline/references/execution-model.md +24 -6
  819. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +3 -2
  820. package/skills/a2h-spec-design-pipeline/references/initialization.md +15 -4
  821. package/skills/a2h-spec-design-pipeline/references/merge-queue.md +82 -41
  822. package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +61 -0
  823. package/skills/a2h-spec-design-pipeline/references/scripts.md +19 -10
  824. package/skills/a2h-spec-design-pipeline/references/shared-layer.md +267 -0
  825. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +61 -8
  826. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +62 -13
  827. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +8 -0
  828. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +8 -0
  829. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +55 -0
  830. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +60 -0
  831. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/HttpExtraDataEmptyStringCheck.js +488 -0
  832. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +11 -0
  833. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +17 -0
  834. package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +12 -38
  835. package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +40 -5
  836. package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +18 -0
  837. package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +74 -0
  838. package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +1 -1
  839. package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +1 -1
  840. package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +2 -2
  841. package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +128 -5
  842. package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +98 -35
  843. package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +218 -37
  844. package/skills/a2h-spec-design-pipeline/scripts/lib/shared_classes.ts +113 -0
  845. package/skills/a2h-spec-design-pipeline/scripts/lib/shared_docs.ts +202 -0
  846. package/skills/a2h-spec-design-pipeline/scripts/lib/wiring.ts +58 -0
  847. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +6 -7
  848. package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +3 -0
  849. package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +348 -0
  850. package/skills/a2h-spec-design-pipeline/scripts/scan_shared.ts +642 -0
  851. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +15 -5
  852. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +7 -2
  853. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +104 -1
  854. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +24 -0
  855. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +394 -0
  856. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +24 -1
  857. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +14 -0
  858. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +163 -5
  859. package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +15 -7
  860. package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +14 -0
  861. package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +350 -0
  862. package/skills/a2h-spec-design-pipeline/scripts/test_scan_shared.ts +996 -0
  863. package/skills/a2h-spec-design-pipeline/scripts/test_shared_classes.ts +80 -0
  864. package/skills/a2h-spec-design-pipeline/scripts/test_shared_docs.ts +205 -0
  865. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +121 -0
  866. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_e2e.ts +85 -0
  867. package/skills/a2h-spec-design-pipeline/scripts/test_validate_shared_manifest.ts +720 -0
  868. package/skills/a2h-spec-design-pipeline/scripts/test_wiring.ts +40 -0
  869. package/skills/a2h-spec-design-pipeline/scripts/validate_shared_manifest.ts +566 -0
  870. package/skills/a2h-spec-generate/SKILL.md +87 -21
  871. package/skills/a2h-spec-generate/references/batch-mode.md +78 -17
  872. package/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
  873. package/skills/a2h-spec-generate/references/fusion-task-contract.md +7 -0
  874. package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  875. package/skills/a2h-spec-generate/references/synthesis-rules.md +4 -2
  876. package/skills/a2h-spec-generate/references/worker-rules.md +6 -3
  877. package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +4 -5
  878. package/skills/a2h-spec-generate/scripts/check_spec.ts +145 -14
  879. package/skills/a2h-spec-generate/scripts/collect-specs.mjs +261 -19
  880. package/skills/a2h-spec-generate/scripts/dispatch-watch.mjs +1168 -0
  881. package/skills/a2h-spec-generate/scripts/feature-stem.mjs +1 -2
  882. package/skills/a2h-spec-generate/scripts/publish-specs.mjs +1 -2
  883. package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +1 -2
  884. package/skills/a2h-spec-generate/scripts/render-tasks.mjs +25 -46
  885. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +26 -27
  886. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +3 -6
  887. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +31 -32
  888. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +2 -3
  889. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +15 -26
  890. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +102 -81
  891. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +39 -19
  892. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +12 -13
  893. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
  894. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +35 -196
  895. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +3 -1
  896. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +22 -96
  897. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +3 -4
  898. package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +1 -1
  899. package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +74 -7
  900. package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +51 -7
  901. package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +42 -111
  902. package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +1 -20
  903. package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1 -2
  904. package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +3 -4
  905. package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
  906. package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
  907. package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
  908. package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
  909. package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/zip.ts +63 -0
  910. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +650 -0
  911. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
  912. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
  913. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
  914. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-seed.test.ts +195 -0
  915. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
  916. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +347 -0
  917. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1948 -0
  918. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-library-evidence.test.ts +239 -0
  919. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +277 -0
  920. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +844 -0
  921. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
  922. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
  923. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
  924. package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
  925. package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
  926. package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
  927. package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
  928. package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
  929. package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
  930. package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
  931. package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
  932. package/skills/a2h-spec-generate/scripts/reqgen/test/zip.test.ts +61 -0
  933. package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +879 -0
  934. package/skills/a2h-spec-generate/test/check-spec.test.ts +430 -0
  935. package/skills/a2h-spec-generate/test/collect-specs.test.mjs +811 -0
  936. package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
  937. package/skills/a2h-spec-generate/test/dispatch-watch.test.mjs +606 -0
  938. package/skills/a2h-spec-generate/test/ensure-index.test.mjs +230 -0
  939. package/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
  940. package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
  941. package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
  942. package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
  943. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
  944. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
  945. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
  946. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
  947. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
  948. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
  949. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
  950. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
  951. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
  952. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
  953. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
  954. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
  955. package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
  956. package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
  957. package/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
  958. package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +182 -0
  959. package/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
  960. package/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
  961. package/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
  962. package/skills/a2h-spec-generate/test/report.test.mjs +47 -0
  963. package/skills/a2h-utg-explorer/references/architecture.md +4 -0
  964. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +64 -80
  965. package/skills/a2h-utg-explorer/scripts/hint_check.mjs +1 -2
  966. package/skills/a2h-utg-explorer/scripts/recover.mjs +1 -1
  967. package/skills/a2h-utg-explorer/scripts/rejudge.mjs +5 -3
  968. package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
  969. package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +244 -0
  970. package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
  971. package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
  972. package/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
  973. package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
  974. package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +231 -0
  975. package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +160 -0
  976. package/skills/a2h-utg-explorer/scripts/tests/device_locale_identity.test.mjs +77 -0
  977. package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
  978. package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
  979. package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +137 -0
  980. package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
  981. package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
  982. package/skills/a2h-utg-explorer/scripts/tests/fresh_state_plan.test.mjs +78 -0
  983. package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
  984. package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
  985. package/skills/a2h-utg-explorer/scripts/tests/holds_without_data_parity.test.mjs +26 -0
  986. package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +492 -0
  987. package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +199 -0
  988. package/skills/a2h-utg-explorer/scripts/tests/launch_failure.test.mjs +40 -0
  989. package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
  990. package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
  991. package/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
  992. package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
  993. package/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
  994. package/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
  995. package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
  996. package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
  997. package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
  998. package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
  999. package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
  1000. package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
  1001. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +454 -0
  1002. package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
  1003. package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
  1004. package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +336 -0
  1005. package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
  1006. package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +142 -0
  1007. package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
  1008. package/skills/a2h-utg-explorer/scripts/tests/string_tables_twin_ties.test.mjs +83 -0
  1009. package/skills/a2h-utg-explorer/scripts/tests/tar_fixture.mjs +12 -0
  1010. package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
  1011. package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
  1012. package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
  1013. package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
  1014. package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
  1015. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +13 -3
  1016. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +107 -65
  1017. package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +155 -0
  1018. package/skills/a2h-utg-static/scripts/assemble.mjs +28 -3
  1019. package/skills/a2h-utg-static/scripts/click_paths.mjs +19 -20
  1020. package/skills/a2h-utg-static/scripts/compose_overlay.mjs +102 -2
  1021. package/skills/a2h-utg-static/scripts/fragment_nav.mjs +2 -3
  1022. package/skills/a2h-utg-static/scripts/nl_hints.mjs +2 -3
  1023. package/skills/a2h-utg-static/scripts/presenter_nav.mjs +1 -2
  1024. package/skills/a2h-utg-static/scripts/route_interceptor.mjs +21 -7
  1025. package/skills/a2h-utg-static/scripts/static_prior.mjs +26 -29
  1026. package/skills/a2h-utg-static/scripts/tests/test_activity_gates.mjs +84 -0
  1027. package/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +38 -0
  1028. package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +29 -1
  1029. package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +0 -5
  1030. package/skills/a2h-app-migrate/scripts/i18n-term.mjs +0 -54
  1031. package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +0 -5
  1032. package/skills/a2h-arch-generate/scripts/i18n-term.mjs +0 -54
  1033. package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +0 -5
  1034. package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +0 -54
  1035. package/skills/a2h-batch-ui-align/references/source-only-tier.md +0 -38
  1036. package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +0 -5
  1037. package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +0 -54
  1038. package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +0 -5
  1039. package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +0 -54
  1040. package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +0 -5
  1041. package/skills/a2h-resource-convert/scripts/i18n-term.mjs +0 -54
  1042. package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +0 -5
  1043. package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +0 -54
  1044. package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +0 -70
  1045. package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +0 -5
  1046. package/skills/a2h-spec-generate/scripts/i18n-term.mjs +0 -54
  1047. package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +0 -5
  1048. package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +0 -54
  1049. package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +0 -5
  1050. package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +0 -54
  1051. package/skills/a2h-utg-static/scripts/i18n-term.d.mts +0 -5
  1052. package/skills/a2h-utg-static/scripts/i18n-term.mjs +0 -54
  1053. package/skills/a2h-utg-static/scripts/tests/test_i18n_term.mjs +0 -155
@@ -0,0 +1,1261 @@
1
+ #!/usr/bin/env node
2
+ // Golden-sample tests for the unified marker syntax and the three parse/validate scripts.
3
+ //
4
+ // Covers:
5
+ // 1. validate_architecture_docs.py — positive and negative cases of the unified marker `# [EXISTING] [HAP|HAR|HSP]`
6
+ // (EXISTING first): both generate/reconcile modes, the --allow-existing
7
+ // gate, token order/unknown/duplicate, and the migration hint for the old <!-- EXISTING_TARGET -->.
8
+ // 2. module_create/generate.py — the scaffold parser parses the same syntax consistently
9
+ // (EXISTING prefix ignored, an EXISTING-only line is not a module root, invalid comments raise errors).
10
+ // 3. validate_incremental_docs.py — # EXISTING on-disk existence, inspection
11
+ // freshness, reconciliation consistency (existing_targets / planned_only / disposition).
12
+ //
13
+ // Usage: node scripts/tests/run_tests.mjs
14
+
15
+ import { fileURLToPath } from "node:url";
16
+ import os from "node:os";
17
+ import { spawnSync } from "node:child_process";
18
+ import {
19
+ fs, path, process, pyJsonDump, parseStrictJson, pyRepr, runCapture,
20
+ resolveLikePython, isFile,
21
+ } from "../lib/py_compat.mjs";
22
+ import { parseDocument, DesignError } from "../module_create/generate.mjs";
23
+
24
+ const TESTS_DIR = path.dirname(fileURLToPath(import.meta.url));
25
+ const SCRIPTS_DIR = path.dirname(TESTS_DIR);
26
+ const TESTDATA = path.join(SCRIPTS_DIR, "module_create", "testdata");
27
+ const VALIDATOR = path.join(SCRIPTS_DIR, "validate_architecture_docs.mjs");
28
+ const DATA_VALIDATOR = path.join(SCRIPTS_DIR, "validate_data_docs.mjs");
29
+ const INCREMENTAL = path.join(SCRIPTS_DIR, "validate_incremental_docs.mjs");
30
+
31
+ const ANNOTATED = [
32
+ "common/utils",
33
+ "common/utils/src/main/ets/utils",
34
+ "features/home",
35
+ "features/home/src/main/ets/pages",
36
+ "features/sync",
37
+ "products/app",
38
+ "products/app/src/main/ets/pages",
39
+ ].sort();
40
+ const MODULE_DIRS = ["products/app", "features/home", "features/sync", "common/utils"];
41
+
42
+ const EMPTY_DB = "# database_design\n\n## Storage Overview\n\n| Database | Purpose |\n|---|---|\n\n## Database Tables\n";
43
+ const EMPTY_PREF = "# Preferences\n\n## Preferences Keys\n";
44
+
45
+ let PASS = 0;
46
+ let FAIL = 0;
47
+ const FAILURES = [];
48
+
49
+
50
+ function pyGet(obj, key, dflt = null) {
51
+ return obj !== null && obj !== undefined && Object.hasOwn(obj, key) ? obj[key] : dflt;
52
+ }
53
+
54
+
55
+ function deepRepr(value) {
56
+ if (typeof value === "string") return pyRepr(value);
57
+ if (value === null || value === undefined) return "None";
58
+ if (value === true) return "True";
59
+ if (value === false) return "False";
60
+ if (typeof value === "bigint") return String(value);
61
+ if (typeof value === "number") return String(value);
62
+ if (value instanceof Set) {
63
+ const items = [...value];
64
+ return items.length === 0 ? "set()" : `{${items.map(deepRepr).join(", ")}}`;
65
+ }
66
+ if (Array.isArray(value)) return `[${value.map(deepRepr).join(", ")}]`;
67
+ if (typeof value === "object") {
68
+ const items = Object.entries(value).map(([k, v]) => `${pyRepr(k)}: ${deepRepr(v)}`);
69
+ return `{${items.join(", ")}}`;
70
+ }
71
+ return String(value);
72
+ }
73
+
74
+
75
+ function pyStr(value) {
76
+ if (value === null || value === undefined) return "None";
77
+ if (value === true) return "True";
78
+ if (value === false) return "False";
79
+ if (typeof value === "object") return deepRepr(value);
80
+ return String(value);
81
+ }
82
+
83
+
84
+ function deepEq(a, b) {
85
+ if (a === b) return true;
86
+ if (Array.isArray(a) && Array.isArray(b)) {
87
+ return a.length === b.length && a.every((x, i) => deepEq(x, b[i]));
88
+ }
89
+ return false;
90
+ }
91
+
92
+
93
+ function check(name, ok, detail = "") {
94
+ if (ok) {
95
+ PASS += 1;
96
+ process.stdout.write(` PASS ${name}\n`);
97
+ } else {
98
+ FAIL += 1;
99
+ FAILURES.push(`${name} :: ${detail}`);
100
+ process.stdout.write(` FAIL ${name} ${detail}\n`);
101
+ }
102
+ }
103
+
104
+
105
+ function baseDoc(name) {
106
+ return fs.readFileSync(path.join(TESTDATA, name), "utf8");
107
+ }
108
+
109
+
110
+ function mutate(text, oldStr, newStr) {
111
+ if (!text.includes(oldStr)) throw new Error(`mutation source not found: ${pyRepr(oldStr)}`);
112
+ return text.replace(oldStr, newStr);
113
+ }
114
+
115
+
116
+ function runValidator(doc, packaging, conversion, allowExisting, report, projectKind = "application") {
117
+ const cmd = [
118
+ process.execPath, VALIDATOR,
119
+ "--document", doc,
120
+ "--packaging-mode", packaging,
121
+ "--conversion-mode", conversion,
122
+ "--project-kind", projectKind,
123
+ "--report", report,
124
+ ];
125
+ if (allowExisting) cmd.push("--allow-existing");
126
+ const proc = runCapture(cmd);
127
+ const data = parseStrictJson(fs.readFileSync(report, "utf8"));
128
+ return [proc.returncode, data];
129
+ }
130
+
131
+
132
+ function errorCodes(data) {
133
+ return new Set((data.blocking_errors || []).map((e) => e.code ?? ""));
134
+ }
135
+
136
+
137
+ function incErrorCodes(data) {
138
+ return new Set((data.errors || []).map((e) => e.code ?? ""));
139
+ }
140
+
141
+
142
+ function incWarningCodes(data) {
143
+ return new Set((data.warnings || []).map((w) => w.code ?? ""));
144
+ }
145
+
146
+
147
+ function testStructural(tmp) {
148
+ process.stdout.write("== validate_architecture_docs.mjs (unified marker syntax) ==\n");
149
+ const three = baseDoc("three-layer-PROJECT_DESIGN.md");
150
+ const single = baseDoc("single-entry-PROJECT_DESIGN.md");
151
+ const recon = baseDoc("reconcile-layer-PROJECT_DESIGN.md");
152
+
153
+ const doc = (text, name) => {
154
+ const p = path.join(tmp, name);
155
+ fs.writeFileSync(p, text, "utf8");
156
+ return p;
157
+ };
158
+
159
+ let [code, data] = runValidator(doc(three, "t01.md"), "layered", "direct", false, path.join(tmp, "r01.json"));
160
+ check("T01 three-layer generate passes",
161
+ code === 0 && data.validation_status === "complete",
162
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
163
+
164
+ [code, data] = runValidator(doc(single, "t02.md"), "single-entry", "logical", false, path.join(tmp, "r02.json"));
165
+ check("T02 single-entry generate passes",
166
+ code === 0 && data.validation_status === "complete",
167
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
168
+
169
+ [code, data] = runValidator(doc(recon, "t03.md"), "layered", "direct", true, path.join(tmp, "r03.json"));
170
+ check("T03 reconcile passes (--allow-existing) + existing_annotations set",
171
+ code === 0 && data.validation_status === "complete"
172
+ && deepEq([...data.existing_annotations].sort(), ANNOTATED)
173
+ && data.allow_existing === true,
174
+ `exit=${code} status=${pyStr(pyGet(data, "validation_status"))} `
175
+ + `existing=${deepRepr([...pyGet(data, "existing_annotations", [])].sort())} `
176
+ + `errors=${deepRepr(errorCodes(data))}`);
177
+
178
+ [code, data] = runValidator(doc(recon, "t04.md"), "layered", "direct", false, path.join(tmp, "r04.json"));
179
+ check("T04 reconcile doc without --allow-existing → existing_annotation_not_allowed",
180
+ code === 2 && errorCodes(data).has("existing_annotation_not_allowed"),
181
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
182
+
183
+ let text = mutate(recon, "└── sync/ # EXISTING HSP", "└── sync/ # HSP EXISTING");
184
+ [code, data] = runValidator(doc(text, "t05.md"), "layered", "direct", true, path.join(tmp, "r05.json"));
185
+ check("T05 type first (# HSP EXISTING) → tree_annotation wrong order",
186
+ code === 2 && errorCodes(data).has("tree_annotation")
187
+ && (data.blocking_errors || []).some((e) => (e.message ?? "").includes("EXISTING must come before the package type")),
188
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
189
+
190
+ text = mutate(three, "└── trade/ # HSP", "└── trade/ # FOO");
191
+ [code, data] = runValidator(doc(text, "t06.md"), "layered", "direct", false, path.join(tmp, "r06.json"));
192
+ check("T06 unknown token (# FOO) → tree_annotation",
193
+ code === 2 && errorCodes(data).has("tree_annotation"),
194
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
195
+
196
+ text = mutate(recon, "└── sync/ # EXISTING HSP", "└── sync/ # EXISTING EXISTING");
197
+ [code, data] = runValidator(doc(text, "t07.md"), "layered", "direct", true, path.join(tmp, "r07.json"));
198
+ check("T07 duplicate token (# EXISTING EXISTING) → tree_annotation",
199
+ code === 2 && errorCodes(data).has("tree_annotation"),
200
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
201
+
202
+ text = mutate(three, "└── trade/ # HSP", "└── trade/ <!-- EXISTING_TARGET -->");
203
+ [code, data] = runValidator(doc(text, "t08.md"), "layered", "direct", true, path.join(tmp, "r08.json"));
204
+ check("T08 legacy <!-- EXISTING_TARGET --> → legacy_annotation_form",
205
+ code === 2 && errorCodes(data).has("legacy_annotation_form"),
206
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
207
+
208
+ text = mutate(three, "└── trade/ # HSP", "└── trade/ # HAP # HAP");
209
+ [code, data] = runValidator(doc(text, "t09.md"), "layered", "direct", false, path.join(tmp, "r09.json"));
210
+ check("T09 two comments on one line (# HAP # HAP) → tree_annotation",
211
+ code === 2 && errorCodes(data).has("tree_annotation"),
212
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
213
+
214
+ text = mutate(recon, "├── home/ # EXISTING HAR", "├── home/ # EXISTING");
215
+ [code, data] = runValidator(doc(text, "t10.md"), "layered", "direct", true, path.join(tmp, "r10.json"));
216
+ check("T10 module root with only # EXISTING (type lost) → module_without_type_marker",
217
+ code === 2 && errorCodes(data).has("module_without_type_marker")
218
+ && !errorCodes(data).has("existing_annotation_not_allowed"),
219
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
220
+ }
221
+
222
+
223
+ function testScaffoldParser() {
224
+ process.stdout.write("== module_create/generate.mjs (scaffold parsing consistency) ==\n");
225
+
226
+ let [design, modules] = parseDocument(baseDoc("three-layer-PROJECT_DESIGN.md"));
227
+ check("S01 three-layer module parsing (type annotations stay compatible)",
228
+ deepEq(modules, [["products/app", "HAP"], ["features/home", "HAR"],
229
+ ["features/trade", "HSP"], ["common/utils", "HAR"]]),
230
+ deepRepr(modules));
231
+
232
+ [design, modules] = parseDocument(baseDoc("single-entry-PROJECT_DESIGN.md"));
233
+ check("S02 single-entry module parsing",
234
+ deepEq(modules, [["entry", "HAP"]]),
235
+ deepRepr(modules));
236
+
237
+ [design, modules] = parseDocument(baseDoc("reconcile-layer-PROJECT_DESIGN.md"));
238
+ check("S03 reconcile parsing: the EXISTING prefix is ignored, an EXISTING-only line is not a module root",
239
+ deepEq(modules, [["products/app", "HAP"], ["features/home", "HAR"],
240
+ ["features/payment", "HAR"], ["features/sync", "HSP"],
241
+ ["common/utils", "HAR"]]),
242
+ deepRepr(modules));
243
+
244
+ let bad = mutate(baseDoc("reconcile-layer-PROJECT_DESIGN.md"),
245
+ "└── sync/ # EXISTING HSP", "└── sync/ # HSP EXISTING");
246
+ try {
247
+ parseDocument(bad);
248
+ check("S04 reversed order (# HSP EXISTING) → DesignError", false, "no exception raised");
249
+ } catch (exc) {
250
+ if (!(exc instanceof DesignError)) throw exc;
251
+ check("S04 reversed order (# HSP EXISTING) → DesignError",
252
+ String(exc).includes("EXISTING") || String(exc).includes("invalid annotation"), String(exc));
253
+ }
254
+
255
+ bad = mutate(baseDoc("three-layer-PROJECT_DESIGN.md"),
256
+ "└── trade/ # HSP", "└── trade/ # FOO");
257
+ try {
258
+ parseDocument(bad);
259
+ check("S05 unknown token (# FOO) → DesignError", false, "no exception raised");
260
+ } catch (exc) {
261
+ if (!(exc instanceof DesignError)) throw exc;
262
+ check("S05 unknown token (# FOO) → DesignError", String(exc).includes("invalid annotation"), String(exc));
263
+ }
264
+ }
265
+
266
+
267
+ function buildFakeProject(root, docText, { dropDirs = new Set(), staleInspection = false, dropDisposition = false } = {}) {
268
+ const hometrans = path.join(root, ".hometrans");
269
+ const arch = path.join(hometrans, "arch_generate");
270
+ fs.mkdirSync(path.join(arch, "reconcile"), { recursive: true });
271
+ fs.writeFileSync(path.join(hometrans, "project_design.md"), docText, "utf8");
272
+ fs.writeFileSync(path.join(hometrans, "database_design.md"), EMPTY_DB, "utf8");
273
+ fs.writeFileSync(path.join(hometrans, "preferences_design.md"), EMPTY_PREF, "utf8");
274
+
275
+ for (const p of ANNOTATED) {
276
+ if (!dropDirs.has(p)) fs.mkdirSync(path.join(root, p), { recursive: true });
277
+ }
278
+
279
+ let directories = [...new Set([...ANNOTATED,
280
+ "products/app/src/main", "products/app/src/main/ets", "products/app/src/main/resources",
281
+ "features/home/src/main", "features/home/src/main/ets", "features/home/src/main/resources",
282
+ "features/sync/src/main", "features/sync/src/main/ets", "features/sync/src/main/resources",
283
+ "common/utils/src/main", "common/utils/src/main/ets", "common/utils/src/main/resources",
284
+ "entry/src/main/ets/pages",
285
+ ])].sort();
286
+ let modules = [
287
+ { name: "app", directory: "products/app", type: "entry",
288
+ declared_dependencies: ["home", "sync", "utils"], source_roots: ["products/app/src/main/ets"],
289
+ build_file: "products/app/build-profile.json5" },
290
+ { name: "home", directory: "features/home", type: "har",
291
+ declared_dependencies: ["utils"], source_roots: ["features/home/src/main/ets"],
292
+ build_file: "features/home/build-profile.json5" },
293
+ { name: "sync", directory: "features/sync", type: "hsp",
294
+ declared_dependencies: ["utils"], source_roots: ["features/sync/src/main/ets"],
295
+ build_file: "features/sync/build-profile.json5" },
296
+ { name: "utils", directory: "common/utils", type: "har",
297
+ declared_dependencies: [], source_roots: ["common/utils/src/main/ets"],
298
+ build_file: "common/utils/build-profile.json5" },
299
+ ];
300
+ if (staleInspection) {
301
+ directories = directories.filter((d) => d !== "features/sync");
302
+ modules = modules.filter((m) => m.directory !== "features/sync");
303
+ }
304
+
305
+ const targetInspection = {
306
+ schema_version: 1,
307
+ target_project_dir: String(root),
308
+ harmony_project: { valid: true, markers: ["build-profile.json5"], app_name: "fakenote",
309
+ api_level: "12", products: ["default"] },
310
+ modules: modules,
311
+ directories: directories,
312
+ storage: { database_present: false, preference_present: false,
313
+ databases: [], preference_stores: [] },
314
+ homegraph: { available: false, mode: "unavailable", index_present: false, reason: "test fixture" },
315
+ warnings: [],
316
+ };
317
+ fs.writeFileSync(path.join(arch, "target_inspection.json"), pyJsonDump(targetInspection), "utf8");
318
+
319
+ const responsibilities = [
320
+ { id: "r001", source_responsibilities: ["module::app / HomeActivity"],
321
+ source_description: "Home feed display", disposition: "reuse-existing",
322
+ target: "products/app/src/main/ets/pages", target_exists: true,
323
+ reason: "The existing page already carries this responsibility", notes: null },
324
+ { id: "r002", source_responsibilities: ["module::feature / FeedFragment"],
325
+ source_description: "Home refresh capability", disposition: "adapt-existing",
326
+ target: "features/home/src/main/ets/pages", target_exists: true,
327
+ reason: "The existing module needs extending with the refresh responsibility", notes: null },
328
+ { id: "r003", source_responsibilities: ["module::pay / CheckoutActivity"],
329
+ source_description: "Payment collection and bill queries", disposition: "introduce-planned",
330
+ target: "features/payment/src/main/ets/pages", target_exists: false,
331
+ reason: "The current project has no payment module", notes: null },
332
+ { id: "r004", source_responsibilities: ["module::core / SyncWorker"],
333
+ source_description: "Background data sync", disposition: "reuse-existing",
334
+ target: "features/sync/src/main/ets/engine", target_exists: true,
335
+ reason: "The existing sync engine already carries this responsibility", notes: null },
336
+ ];
337
+ if (dropDisposition) delete responsibilities[1].disposition;
338
+
339
+ const existingTargets = ANNOTATED.map((p) => ({
340
+ path: p,
341
+ kind: MODULE_DIRS.includes(p) ? "module" : "directory",
342
+ current_responsibility: "Current responsibility description",
343
+ fate: "retained", reason: null, absorbed_into: null,
344
+ }));
345
+ const reconciliation = {
346
+ schema_version: 1,
347
+ generated_by: "a2h-arch-generate",
348
+ inputs: {
349
+ scope_json: path.join(arch, "scope.json"),
350
+ inspection_json: path.join(arch, "inspection.json"),
351
+ target_inspection_json: path.join(arch, "target_inspection.json"),
352
+ },
353
+ responsibilities: responsibilities,
354
+ existing_targets: existingTargets,
355
+ planned_only: [{ path: "features/payment", reason: "The current project has no payment module" }],
356
+ review_required: [],
357
+ warnings: [],
358
+ };
359
+ fs.writeFileSync(path.join(arch, "reconcile", "architecture_reconciliation.json"),
360
+ pyJsonDump(reconciliation), "utf8");
361
+ }
362
+
363
+
364
+ function runIncremental(root) {
365
+ const report = path.join(root, ".hometrans", "arch_generate", "incremental_report.json");
366
+ const proc = runCapture([
367
+ process.execPath, INCREMENTAL,
368
+ "--arch-gen-dir", path.join(root, ".hometrans", "arch_generate"),
369
+ "--project-design", path.join(root, ".hometrans", "project_design.md"),
370
+ "--database-doc", path.join(root, ".hometrans", "database_design.md"),
371
+ "--preferences-doc", path.join(root, ".hometrans", "preferences_design.md"),
372
+ "--report", report,
373
+ "--packaging-mode", "layered",
374
+ "--conversion-mode", "direct",
375
+ "--project-kind", "application",
376
+ ]);
377
+ const data = parseStrictJson(fs.readFileSync(report, "utf8"));
378
+ return [proc.returncode, data];
379
+ }
380
+
381
+
382
+ function testIncremental(tmp) {
383
+ process.stdout.write("== validate_incremental_docs.mjs (EXISTING semantic checks) ==\n");
384
+ const recon = baseDoc("reconcile-layer-PROJECT_DESIGN.md");
385
+
386
+ let root = path.join(tmp, "inc01");
387
+ buildFakeProject(root, recon);
388
+ let [code, data] = runIncremental(root);
389
+ check("I01 consistent project passes with the correct annotation set",
390
+ code === 0 && data.passed === true
391
+ && deepEq(data.annotated_paths, ANNOTATED)
392
+ && deepEq(data.errors, []) && deepEq(data.warnings, []),
393
+ `exit=${code} errors=${deepRepr(incErrorCodes(data))} warnings=${deepRepr(incWarningCodes(data))}`);
394
+
395
+ root = path.join(tmp, "inc02");
396
+ buildFakeProject(root, mutate(recon, "├── payment/ # HAR", "├── payment/ # EXISTING HAR"));
397
+ [code, data] = runIncremental(root);
398
+ let codes = incErrorCodes(data);
399
+ check("I02 planned-only path annotated → planned_only_annotated + annotation_missing_in_reconcile",
400
+ code === 1 && ["planned_only_annotated", "annotation_missing_in_reconcile"].every((c) => codes.has(c)),
401
+ `exit=${code} errors=${deepRepr(codes)}`);
402
+
403
+ root = path.join(tmp, "inc03");
404
+ buildFakeProject(root, recon, { dropDirs: new Set(["common/utils/src/main/ets/utils"]) });
405
+ [code, data] = runIncremental(root);
406
+ codes = incErrorCodes(data);
407
+ check("I03 annotated path not on disk → annotation_path_missing",
408
+ code === 1 && codes.has("annotation_path_missing"),
409
+ `exit=${code} errors=${deepRepr(codes)}`);
410
+
411
+ root = path.join(tmp, "inc04");
412
+ buildFakeProject(root, recon, { staleInspection: true });
413
+ [code, data] = runIncremental(root);
414
+ check("I04 stale inspection (on disk but not recorded) → warning annotation_not_in_inspection",
415
+ code === 0 && data.passed === true
416
+ && incWarningCodes(data).has("annotation_not_in_inspection"),
417
+ `exit=${code} errors=${deepRepr(incErrorCodes(data))} warnings=${deepRepr(incWarningCodes(data))}`);
418
+
419
+ root = path.join(tmp, "inc05");
420
+ buildFakeProject(root, recon, { dropDisposition: true });
421
+ [code, data] = runIncremental(root);
422
+ codes = incErrorCodes(data);
423
+ check("I05 responsibility without disposition → missing_disposition",
424
+ code === 1 && codes.has("missing_disposition"),
425
+ `exit=${code} errors=${deepRepr(codes)}`);
426
+
427
+ root = path.join(tmp, "inc06");
428
+ buildFakeProject(root, mutate(recon, "└── sync/ # EXISTING HSP", "└── sync/ <!-- EXISTING_TARGET -->"));
429
+ [code, data] = runIncremental(root);
430
+ codes = incErrorCodes(data);
431
+ check("I06 legacy <!-- --> form → legacy_annotation_form (including structure delegation)",
432
+ code === 1 && (codes.has("legacy_annotation_form") || codes.has("structural_legacy_annotation_form")),
433
+ `exit=${code} errors=${deepRepr(codes)}`);
434
+ }
435
+
436
+
437
+ function makeSyntheticInspection(dbPresent, prefPresent) {
438
+ const inspection = {
439
+ storage_presence: { database: dbPresent, preferences: prefPresent },
440
+ database_schemas: [],
441
+ preference_stores: [],
442
+ };
443
+ if (dbPresent) {
444
+ inspection.database_schemas = [{
445
+ name: "app.db",
446
+ source_kind: "room_source_entities",
447
+ confidence: "authoritative",
448
+ tables: [{
449
+ name: "notes",
450
+ columns: [
451
+ { field: "id", type: "Long", key: "PK", constraints: [] },
452
+ { field: "title", type: "String", key: "", constraints: ["NOT NULL"] },
453
+ ],
454
+ }],
455
+ }];
456
+ }
457
+ if (prefPresent) {
458
+ inspection.preference_stores = [{
459
+ name: "settings",
460
+ confidence: "authoritative",
461
+ keys: [
462
+ { key: "seen", type: "Boolean", default: null },
463
+ { key: "theme", type: "String", default: "light" },
464
+ ],
465
+ }];
466
+ }
467
+ return inspection;
468
+ }
469
+
470
+
471
+ const POPULATED_DB_DOC = `# database_design
472
+
473
+ ## Storage Overview
474
+
475
+ | Database | Purpose |
476
+ |---|---|
477
+ | app.db | Planned database |
478
+
479
+ ## Database Tables
480
+
481
+ ### \`app.db\`
482
+
483
+ #### \`notes\`
484
+
485
+ | Field | Type | Key | Constraints |
486
+ |---|---|---|---|
487
+ | id | INTEGER | PK | |
488
+ | title | TEXT | | NOT NULL |
489
+ `;
490
+
491
+ const POPULATED_PREF_DOC = `# Preferences
492
+
493
+ ## Preferences Keys
494
+
495
+ ### \`settings\`
496
+
497
+ | Key | Type | Default |
498
+ |---|---|---|
499
+ | seen | Boolean | |
500
+ | theme | String | light |
501
+ `;
502
+
503
+
504
+ function runDataValidator(archDir, dbDoc, prefDoc, report) {
505
+ const proc = runCapture([
506
+ process.execPath, DATA_VALIDATOR,
507
+ "--inspection", path.join(archDir, "inspection.json"),
508
+ "--database-doc", dbDoc,
509
+ "--preferences-doc", prefDoc,
510
+ "--report", report,
511
+ ]);
512
+ const data = parseStrictJson(fs.readFileSync(report, "utf8"));
513
+ return [proc.returncode, data];
514
+ }
515
+
516
+
517
+ function testDataDocConstraints(tmp) {
518
+ process.stdout.write("== validate_data_docs constraints (type affinity / null defaults / superset semantics) ==\n");
519
+
520
+ const writeArch = (name, inspection, withReconcile) => {
521
+ const arch = path.join(tmp, name);
522
+ fs.mkdirSync(arch, { recursive: true });
523
+ fs.writeFileSync(path.join(arch, "inspection.json"), pyJsonDump(inspection, { indent: null }), "utf8");
524
+ if (withReconcile) {
525
+ fs.mkdirSync(path.join(arch, "reconcile"), { recursive: true });
526
+ fs.writeFileSync(path.join(arch, "reconcile", "architecture_reconciliation.json"), "{}", "utf8");
527
+ }
528
+ return arch;
529
+ };
530
+
531
+ const dbDoc = path.join(tmp, "db_affinity.md");
532
+ fs.writeFileSync(dbDoc, POPULATED_DB_DOC, "utf8");
533
+ const prefDoc = path.join(tmp, "pref_null_default.md");
534
+ fs.writeFileSync(prefDoc, POPULATED_PREF_DOC, "utf8");
535
+
536
+ let arch = writeArch("arch_t11", makeSyntheticInspection(true, true), false);
537
+ let [code, data] = runDataValidator(arch, dbDoc, prefDoc, path.join(tmp, "r_t11.json"));
538
+ let codes = errorCodes(data);
539
+ check("T11 type affinity: Kotlin Long/String vs INTEGER/TEXT passes + null defaults skipped",
540
+ code === 0 && !["database_type_mismatch", "preference_type_mismatch", "preference_default_mismatch"].some((c) => codes.has(c)),
541
+ `exit=${code} errors=${deepRepr(codes)}`);
542
+
543
+ const badDb = path.join(tmp, "db_mismatch.md");
544
+ fs.writeFileSync(badDb, POPULATED_DB_DOC.replaceAll("| title | TEXT |", "| title | INTEGER |"), "utf8");
545
+ [code, data] = runDataValidator(arch, badDb, prefDoc, path.join(tmp, "r_t11b.json"));
546
+ codes = errorCodes(data);
547
+ check("T11 type affinity failure: TEXT vs INTEGER still reports mismatch",
548
+ code === 2 && codes.has("database_type_mismatch"),
549
+ `exit=${code} errors=${deepRepr(codes)}`);
550
+
551
+ const emptyDb = path.join(tmp, "db_empty.md");
552
+ fs.writeFileSync(emptyDb, "# database_design\n\n## Storage Overview\n\n| Database | Purpose |\n|---|---|\n\n## Database Tables\n", "utf8");
553
+ const emptyPref = path.join(tmp, "pref_empty.md");
554
+ fs.writeFileSync(emptyPref, "# Preferences\n\n## Preferences Keys\n", "utf8");
555
+
556
+ arch = writeArch("arch_t13a", makeSyntheticInspection(false, false), true);
557
+ [code, data] = runDataValidator(arch, dbDoc, prefDoc, path.join(tmp, "r_t13a.json"));
558
+ const warningCodes = new Set((data.warnings || []).map((w) => w.code ?? ""));
559
+ check("T13a superset: no source storage + reconcile directory → content allowed (advisory warning only)",
560
+ code === 0 && warningCodes.size === 1 && warningCodes.has("content_beyond_source_storage")
561
+ && data.reconcile_mode === true,
562
+ `exit=${code} warnings=${deepRepr(warningCodes)}`);
563
+
564
+ arch = writeArch("arch_t13b", makeSyntheticInspection(false, false), false);
565
+ [code, data] = runDataValidator(arch, dbDoc, prefDoc, path.join(tmp, "r_t13b.json"));
566
+ codes = errorCodes(data);
567
+ check("T13b no reconcile directory → invented_* blocking errors (generate strictness unchanged)",
568
+ code === 2 && ["invented_database_content", "invented_preferences_content"].every((c) => codes.has(c))
569
+ && data.reconcile_mode === false,
570
+ `exit=${code} errors=${deepRepr(codes)}`);
571
+ }
572
+
573
+
574
+ function testTreeEdgeCases(tmp) {
575
+ process.stdout.write("== tree edge constraints (test directory exemption / digit-leading directory segments) ==\n");
576
+
577
+ const doc = (text, name) => {
578
+ const p = path.join(tmp, name);
579
+ fs.writeFileSync(p, text, "utf8");
580
+ return p;
581
+ };
582
+
583
+ const t14 = `## Project Structure
584
+
585
+ \`\`\`text
586
+ entry/ # HAP
587
+ └── src/
588
+ ├── main/
589
+ │ ├── ets/
590
+ │ │ └── pages/
591
+ │ └── resources/
592
+ ├── ohosTest/
593
+ ├── test/
594
+ └── mock/
595
+ \`\`\`
596
+
597
+ ## Module Semantics
598
+
599
+ | Module Path | Module Responsibility |
600
+ |---|---|
601
+ | entry/src/main/ets/pages | Page assembly for the single application entry; hosts the startup flow and the home page display. |
602
+ `;
603
+ let [code, data] = runValidator(doc(t14, "t14.md"), "single-entry", "logical", false, path.join(tmp, "r_t14.json"));
604
+ check("T14 structural directories (src/ohosTest, src/test, src/mock) are exempt from leaf semantic rows",
605
+ code === 0 && data.validation_status === "complete",
606
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
607
+
608
+ const t15 = `## Project Structure
609
+
610
+ \`\`\`text
611
+ 360safe/ # HAP
612
+ └── src/
613
+ └── main/
614
+ └── ets/
615
+ └── pages/
616
+ \`\`\`
617
+
618
+ ## Module Semantics
619
+
620
+ | Module Path | Module Responsibility |
621
+ |---|---|
622
+ | 360safe/src/main/ets/pages | Page assembly for the library entry; hosts the display of core capabilities. |
623
+ `;
624
+ [code, data] = runValidator(doc(t15, "t15.md"), "single-entry", "direct", false, path.join(tmp, "r_t15.json"), "library");
625
+ check("T15 a digit-leading directory segment (360safe/) is valid",
626
+ code === 0 && data.validation_status === "complete",
627
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
628
+ }
629
+
630
+
631
+ const CREATE_PROJECT = path.join(SCRIPTS_DIR, "create_project.mjs");
632
+
633
+ const DEVECOCLI_STUB = `#!/bin/bash
634
+ # Test stub: record the received arguments and create a minimal project for clear_modules post-processing.
635
+ echo "$@" > "$STUB_LOG"
636
+ path=""
637
+ prev=""
638
+ for arg in "$@"; do
639
+ if [ "$prev" = "--project-path" ]; then path="$arg"; fi
640
+ prev="$arg"
641
+ done
642
+ mkdir -p "$path"
643
+ printf '{\\n "modules": [\\n { "name": "entry", "srcPath": "./entry" }\\n ]\\n}\\n' > "$path/build-profile.json5"
644
+ exit 0
645
+ `;
646
+
647
+
648
+ function runCreateProject(binDir, log, ...extra) {
649
+ const stub = path.join(binDir, "devecocli");
650
+ fs.writeFileSync(stub, DEVECOCLI_STUB, "utf8");
651
+ fs.chmodSync(stub, 0o755);
652
+ const env = { ...process.env, STUB_LOG: log };
653
+ const proc = spawnSync(process.execPath, [CREATE_PROJECT, ...extra, "--devecocli-bin", stub],
654
+ { encoding: "utf8", env });
655
+ const argv = isFile(log) ? fs.readFileSync(log, "utf8").split(/\s+/).filter((s) => s !== "") : [];
656
+ return [proc.status, argv, proc.stderr ?? ""];
657
+ }
658
+
659
+
660
+ function testCreateProjectAppName(tmp) {
661
+ process.stdout.write("== create_project.mjs shell creation (devecocli/json5 stubs) ==\n");
662
+
663
+ const binDir = path.join(tmp, "stubbin");
664
+ fs.mkdirSync(binDir, { recursive: true });
665
+
666
+ const proj1 = path.join(tmp, "proj1");
667
+ const [code, argv, err] = runCreateProject(binDir, path.join(tmp, "log1.txt"), "--output-root", proj1);
668
+ const derivedOk = (
669
+ code === 0
670
+ && argv[argv.indexOf("--app-name") + 1] === "proj1"
671
+ && argv[argv.indexOf("--project-path") + 1] === resolveLikePython(proj1)
672
+ && deepEq(parseStrictJson(fs.readFileSync(path.join(proj1, "build-profile.json5"), "utf8")).modules, [])
673
+ );
674
+ check("C01 default: the app name derived from the directory name is passed to devecocli, and modules is emptied",
675
+ derivedOk, `exit=${code} argv=${deepRepr(argv)} err=${err.slice(-150)}`);
676
+ }
677
+
678
+
679
+ // Regression tests for the PR #43 review fixes.
680
+ function testReviewFixes(tmp) {
681
+ process.stdout.write("== review-fix regressions (globPattern / strip / pyOr / root directory / TOML single quotes) ==\n");
682
+
683
+ // 1. globPattern: multi-level patterns (was single-level only)
684
+ {
685
+ const src = fs.readFileSync(path.join(SCRIPTS_DIR, "inspect_android_project.mjs"), "utf8");
686
+ const start = src.indexOf("function segmentMatcher");
687
+ const end = src.indexOf("export function readText");
688
+ const pathExists = (p) => { try { fs.statSync(p); return true; } catch { return false; } };
689
+ const mod = new Function("fs", "path", "pathExists", src.slice(start, end) + "; return { globPattern };")(
690
+ fs, path, pathExists);
691
+ const root = fs.mkdtempSync(path.join(tmp, "glob-"));
692
+ fs.mkdirSync(path.join(root, "src", "main", "java"), { recursive: true });
693
+ fs.writeFileSync(path.join(root, "src", "A.java"), "x");
694
+ fs.writeFileSync(path.join(root, "src", "main", "java", "B.java"), "x");
695
+ const single = mod.globPattern(root, "src/*.java").map((p) => path.relative(root, p));
696
+ const deep = mod.globPattern(root, "src/**/*.java").map((p) => path.relative(root, p));
697
+ check("R01 globPattern src/*.java matches one level",
698
+ single.length === 1 && single[0] === "src/A.java", JSON.stringify(single));
699
+ check("R02 globPattern src/**/*.java matches several levels",
700
+ deep.length === 2, JSON.stringify(deep));
701
+ fs.rmSync(root, { recursive: true, force: true });
702
+ }
703
+
704
+ // 2. strip(",") semantics — DECIMAL(10,2) not corrupted
705
+ {
706
+ const stripped = "DECIMAL(10,2)".replace(/^[,]+|[,]+$/g, "");
707
+ check("R03 strip(\",\") trims only the ends (DECIMAL(10,2) unchanged)",
708
+ stripped === "DECIMAL(10,2)", stripped);
709
+ const stripped2 = ",INTEGER,".replace(/^[,]+|[,]+$/g, "");
710
+ check("R04 strip(\",\") trims leading and trailing commas",
711
+ stripped2 === "INTEGER", stripped2);
712
+ }
713
+
714
+ // 3. ?? -> or: empty array falls through
715
+ {
716
+ const pyOr = (...values) => {
717
+ for (const value of values) {
718
+ if (value === null || value === undefined) continue;
719
+ if (Array.isArray(value) && value.length === 0) continue;
720
+ if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) continue;
721
+ if (typeof value === "string" && value === "") continue;
722
+ if (typeof value === "number" && value === 0) continue;
723
+ if (value === false) continue;
724
+ return value;
725
+ }
726
+ return undefined;
727
+ };
728
+ check("R05 pyOr falls back to the next item on an empty array",
729
+ JSON.stringify(pyOr([], ["a"])) === JSON.stringify(["a"]));
730
+ check("R06 pyOr does not fall back on a non-empty array",
731
+ JSON.stringify(pyOr(["x"], ["a"])) === JSON.stringify(["x"]));
732
+ }
733
+
734
+ // 4. relOrAbs: root module → "."
735
+ {
736
+ const src = fs.readFileSync(path.join(SCRIPTS_DIR, "inspect_android_project.mjs"), "utf8");
737
+ const start = src.indexOf("function relOrAbs");
738
+ const end = src.indexOf("// ------", start);
739
+ const mod = new Function("path", "resolveLikePython",
740
+ src.slice(start, end).replace("function relOrAbs", "function relOrAbs") + "; return { relOrAbs };")(
741
+ path, (p) => path.resolve(p));
742
+ check("R07 relOrAbs outputs for a root-directory module \".\"",
743
+ mod.relOrAbs("/tmp/proj", "/tmp/proj") === ".", mod.relOrAbs("/tmp/proj", "/tmp/proj"));
744
+ check("R08 relOrAbs outputs a relative path for a submodule",
745
+ mod.relOrAbs("/tmp/proj/entry", "/tmp/proj") === "entry", mod.relOrAbs("/tmp/proj/entry", "/tmp/proj"));
746
+ }
747
+
748
+ // 5. TOML single-quoted literal strings
749
+ {
750
+ const src = fs.readFileSync(path.join(SCRIPTS_DIR, "inspect_android_project.mjs"), "utf8");
751
+ const start = src.indexOf("function parseTomlSubset");
752
+ const end = src.indexOf("function findTomlComment");
753
+ const pyStrip = (x) => x.trim();
754
+ const findTomlComment = (v) => { let inS = false; for (let i = 0; i < v.length; i++) { if (v[i] === '"') inS = !inS; if (v[i] === "#" && !inS) return i; } return -1; };
755
+ const splitTomlInline = (v) => { const parts = []; let cur = ""; let inS = false; for (const ch of v) { if (ch === '"') inS = !inS; if (ch === "," && !inS) { parts.push(cur); cur = ""; continue; } cur += ch; } if (pyStrip(cur) !== "") parts.push(cur); return parts; };
756
+ const mod = new Function("fs", "pyStrip", "findTomlComment", "splitTomlInline",
757
+ src.slice(start, end) + "; return { parseTomlSubset };")(fs, pyStrip, findTomlComment, splitTomlInline);
758
+ const data = mod.parseTomlSubset("\n[plugins]\nkotlin = 'org.jetbrains.kotlin.android'\n");
759
+ check("R09 TOML single-quoted literal string parsing",
760
+ data.plugins?.kotlin === "org.jetbrains.kotlin.android", JSON.stringify(data));
761
+ }
762
+ }
763
+
764
+ // Gradle project with multiple applications: both apps depend on :lib.
765
+ function buildMultiAppRepo(root) {
766
+ const write = (rel, text) => {
767
+ const p = path.join(root, rel);
768
+ fs.mkdirSync(path.dirname(p), { recursive: true });
769
+ fs.writeFileSync(p, text, "utf8");
770
+ };
771
+ write("settings.gradle", "include ':a', ':b', ':lib'\n");
772
+ write("build.gradle", "\n");
773
+ for (const m of ["a", "b"]) {
774
+ write(`${m}/build.gradle`, "plugins { id 'com.android.application' }\ndependencies { implementation project(':lib') }\n");
775
+ write(`${m}/src/main/AndroidManifest.xml`, `<manifest package="x.${m}"><application/></manifest>\n`);
776
+ }
777
+ write("lib/build.gradle", "plugins { id 'com.android.library' }\n");
778
+ write("lib/src/main/AndroidManifest.xml", "<manifest package=\"x.lib\"/>\n");
779
+ }
780
+
781
+
782
+ function testExistingProjectFixes(tmp) {
783
+ process.stdout.write("== existing-project compatibility (--app-module / existing topology / resource-only modules / table escaping) ==\n");
784
+ const INSPECT = path.join(SCRIPTS_DIR, "inspect_project.mjs");
785
+ const repo = path.join(tmp, "multi_app");
786
+ buildMultiAppRepo(repo);
787
+
788
+ let proc = runCapture([process.execPath, INSPECT, repo, "--target-project-dir", path.join(tmp, "ma_auto")]);
789
+ check("A01 several applications, none specified → ambiguity reported with a --app-module hint",
790
+ proc.returncode !== 0 && proc.stderr.includes("--app-module"),
791
+ `exit=${proc.returncode} stderr=${proc.stderr.slice(0, 200)}`);
792
+
793
+ const target = path.join(tmp, "ma_a");
794
+ proc = runCapture([process.execPath, INSPECT, repo, "--app-module", ":a", "--target-project-dir", target]);
795
+ let scope = {};
796
+ if (proc.returncode === 0) {
797
+ scope = parseStrictJson(fs.readFileSync(path.join(target, ".hometrans", "arch_generate", "scope.json"), "utf8"));
798
+ }
799
+ check("A02 --app-module :a passed through → only :a and its dependency closure selected",
800
+ proc.returncode === 0 && deepEq(scope.selected_modules, [":a", ":lib"])
801
+ && scope.requested_app_module === ":a",
802
+ `exit=${proc.returncode} selected=${deepRepr(scope.selected_modules)} stderr=${proc.stderr.slice(0, 200)}`);
803
+
804
+ proc = runCapture([process.execPath, INSPECT, repo, "--app-module", "b", "--target-project-dir", path.join(tmp, "ma_b")]);
805
+ check("A03 --app-module accepts the alias b without a colon",
806
+ proc.returncode === 0, `exit=${proc.returncode} stderr=${proc.stderr.slice(0, 200)}`);
807
+
808
+ proc = runCapture([process.execPath, INSPECT, repo, "--app-module", "nope", "--target-project-dir", path.join(tmp, "ma_x")]);
809
+ check("A04 --app-module pointing at a missing module → explicit error",
810
+ proc.returncode !== 0 && proc.stderr.includes("Requested module was not found: nope"),
811
+ `exit=${proc.returncode} stderr=${proc.stderr.slice(0, 200)}`);
812
+
813
+ const libTarget = path.join(tmp, "ma_lib");
814
+ proc = runCapture([process.execPath, INSPECT, repo, "--app-module", ":lib", "--target-project-dir", libTarget]);
815
+ scope = proc.returncode === 0
816
+ ? parseStrictJson(fs.readFileSync(path.join(libTarget, ".hometrans", "arch_generate", "scope.json"), "utf8"))
817
+ : {};
818
+ check("A05 --app-module pointing at a library → only that module selected, as a library project",
819
+ proc.returncode === 0 && scope.project_kind === "library" && deepEq(scope.selected_modules, [":lib"]),
820
+ `exit=${proc.returncode} kind=${pyStr(scope.project_kind)} selected=${deepRepr(scope.selected_modules)}`);
821
+
822
+ // Existing project: the top level is feature/ rather than features/, and there is a resource-only HAR.
823
+ const recon = baseDoc("reconcile-layer-PROJECT_DESIGN.md").replace(/\r\n/g, "\n");
824
+ const renamed = recon
825
+ .replace("features/\n", "feature/\n")
826
+ .replaceAll("| features/", "| feature/");
827
+ const doc = (text, name) => {
828
+ const p = path.join(tmp, name);
829
+ fs.writeFileSync(p, text, "utf8");
830
+ return p;
831
+ };
832
+ let [code, data] = runValidator(doc(renamed, "e01.md"), "layered", "direct", true, path.join(tmp, "re01.json"));
833
+ check("E01 reconcile existing group name feature/ → features/ no longer required",
834
+ code === 0 && !errorCodes(data).has("layered_layout_missing_root"),
835
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
836
+
837
+ [code, data] = runValidator(doc(renamed, "e02.md"), "layered", "direct", false, path.join(tmp, "re02.json"));
838
+ check("E02 generate still enforces the literal root names products/features/common",
839
+ code === 2 && errorCodes(data).has("layered_layout_missing_root"),
840
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
841
+
842
+ const noHap = mutate(recon, "└── app/ # EXISTING HAP", "└── app/ # EXISTING HAR");
843
+ [code, data] = runValidator(doc(noHap, "e03.md"), "layered", "direct", true, path.join(tmp, "re03.json"));
844
+ check("E03 reconcile application without any HAP → existing_layout_missing_hap",
845
+ code === 2 && errorCodes(data).has("existing_layout_missing_hap"),
846
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
847
+
848
+ const resourceOnly = mutate(recon,
849
+ "common/\n└── utils/ # EXISTING HAR\n",
850
+ "common/\n├── res/ # EXISTING HAR\n│ └── src/\n│ └── main/\n│ └── resources/\n└── utils/ # EXISTING HAR\n");
851
+ [code, data] = runValidator(doc(resourceOnly, "e04.md"), "layered", "direct", true, path.join(tmp, "re04.json"));
852
+ const warnCodes = new Set((data.warnings || []).map((w) => w.code ?? ""));
853
+ check("E04 reconcile existing resource-only HAR (no ets, has resources) → warning, allowed",
854
+ code === 0 && !errorCodes(data).has("module_marker_without_src_main_ets")
855
+ && warnCodes.has("existing_resource_only_module"),
856
+ `exit=${code} errors=${deepRepr(errorCodes(data))} warnings=${deepRepr(warnCodes)}`);
857
+
858
+ const plannedResource = mutate(resourceOnly, "├── res/ # EXISTING HAR", "├── res/ # HAR");
859
+ [code, data] = runValidator(doc(plannedResource, "e05.md"), "layered", "direct", true, path.join(tmp, "re05.json"));
860
+ check("E05 a newly planned module without ets still reports module_marker_without_src_main_ets",
861
+ code === 2 && errorCodes(data).has("module_marker_without_src_main_ets"),
862
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
863
+
864
+ // Preference default values contain `|` and `\`: after rendering, the validator must restore each cell exactly.
865
+ const arch = path.join(tmp, "pipe_arch");
866
+ fs.mkdirSync(arch, { recursive: true });
867
+ const inspection = makeSyntheticInspection(false, true);
868
+ inspection.preference_stores[0].keys.push(
869
+ { key: "ai_tabs", type: "String", default: "translation|transcribe" },
870
+ { key: "sep", type: "String", default: "a\\b" },
871
+ );
872
+ fs.writeFileSync(path.join(arch, "inspection.json"), pyJsonDump(inspection, { indent: null }), "utf8");
873
+ fs.writeFileSync(path.join(arch, "scope.json"), pyJsonDump({ source_kind: "android" }, { indent: null }), "utf8");
874
+ const out = path.join(tmp, "pipe_out");
875
+ proc = runCapture([
876
+ process.execPath, path.join(SCRIPTS_DIR, "generate_source_baseline.mjs"),
877
+ "--scope", path.join(arch, "scope.json"),
878
+ "--inspection", path.join(arch, "inspection.json"),
879
+ "--output-dir", out,
880
+ ]);
881
+ const prefText = proc.returncode === 0 ? fs.readFileSync(path.join(out, "preferences_design.md"), "utf8") : "";
882
+ check("P01 | and \\ in default values are escaped when rendered",
883
+ prefText.includes("| ai_tabs | String | translation\\|transcribe |")
884
+ && prefText.includes("| sep | String | a\\\\b |"),
885
+ `exit=${proc.returncode} stderr=${proc.stderr.slice(0, 200)}`);
886
+ if (proc.returncode === 0) {
887
+ [code, data] = runDataValidator(arch, path.join(out, "database_design.md"), path.join(out, "preferences_design.md"), path.join(tmp, "rp01.json"));
888
+ check("P02 escaped table passes the data validator (no invalid_table_row / default mismatch)",
889
+ code === 0, `exit=${code} errors=${deepRepr(errorCodes(data))}`);
890
+ }
891
+ }
892
+
893
+
894
+ function writeTree(root, files) {
895
+ for (const [rel, text] of Object.entries(files)) {
896
+ const p = path.join(root, rel);
897
+ fs.mkdirSync(path.dirname(p), { recursive: true });
898
+ fs.writeFileSync(p, text, "utf8");
899
+ }
900
+ }
901
+
902
+
903
+ function testStorageExtraction(tmp) {
904
+ process.stdout.write("== storage extraction (DB name / comments / preference receivers / sourceSets / HarmonyOS ownership) ==\n");
905
+ const INSPECT = path.join(SCRIPTS_DIR, "inspect_project.mjs");
906
+ const repo = path.join(tmp, "legacy_repo");
907
+ writeTree(repo, {
908
+ "settings.gradle": "include ':app', ':lib'\n",
909
+ "build.gradle": "\n",
910
+ "app/build.gradle": "plugins { id 'com.android.application' }\ndependencies { implementation project(':lib') }\n",
911
+ "app/src/main/AndroidManifest.xml": "<manifest package=\"x.app\"><application/></manifest>\n",
912
+ "lib/build.gradle": [
913
+ "plugins { id 'com.android.library' }",
914
+ "android {",
915
+ " sourceSets {",
916
+ " main {",
917
+ " manifest.srcFile 'AndroidManifest.xml'",
918
+ " java.srcDirs = ['src']",
919
+ " res.srcDirs = ['res']",
920
+ " }",
921
+ " }",
922
+ "}",
923
+ "",
924
+ ].join("\n"),
925
+ "lib/AndroidManifest.xml": "<manifest package=\"x.lib\"/>\n",
926
+ "lib/res/values/strings.xml": "<resources/>\n",
927
+ "lib/src/com/x/db/ReaderDbHelper.java": [
928
+ "package com.x.db;",
929
+ "public class ReaderDbHelper extends SQLiteOpenHelper {",
930
+ " private static final String DB_NAME = \"ReaderReader.db\";",
931
+ " private static final int DB_VERSION = 6;",
932
+ " public ReaderDbHelper(Context ctx) { super(ctx, DB_NAME, null, DB_VERSION); }",
933
+ " public void onCreate(SQLiteDatabase db) {",
934
+ " db.execSQL(HighLightTable.CREATE_SQL);",
935
+ " // db.execSQL(\"CREATE TABLE old_table (id INTEGER)\");",
936
+ " }",
937
+ "}",
938
+ "",
939
+ ].join("\n"),
940
+ "lib/src/com/x/db/HighLightTable.java": [
941
+ "package com.x.db;",
942
+ "public class HighLightTable {",
943
+ " public static final String CREATE_SQL = \"CREATE TABLE highlight (id INTEGER PRIMARY KEY, text TEXT)\";",
944
+ " /* CREATE TABLE ghost (a TEXT) */",
945
+ "}",
946
+ "",
947
+ ].join("\n"),
948
+ "lib/src/com/x/db/PassDbHelper.java": [
949
+ "package com.x.db;",
950
+ "public class PassDbHelper extends SQLiteOpenHelper {",
951
+ " public PassDbHelper(Context ctx, String name, int version) { super(ctx, name, null, version); }",
952
+ " public void onCreate(SQLiteDatabase db) { db.execSQL(\"CREATE TABLE pass_item (id INTEGER)\"); }",
953
+ "}",
954
+ "",
955
+ ].join("\n"),
956
+ "lib/src/com/x/util/Misc.kt": "package com.x.util\nfun f() {\n val name = \"unrelated.db\"\n val version = 9\n}\n",
957
+ "lib/src/com/x/pref/Settings.java": [
958
+ "package com.x.pref;",
959
+ "public class Settings {",
960
+ " void read(Context c, JSONObject json, Intent intent) {",
961
+ " SharedPreferences prefs = c.getSharedPreferences(\"AppSetting\", 0);",
962
+ " boolean a = prefs.getBoolean(\"show_tab_name\", true);",
963
+ " String s = json.getString(\"server_field\");",
964
+ " Bundle b = intent.getExtras(); String q = b.getString(\"bundle_key\");",
965
+ " String e = intent.getExtras().getString(\"extra_key\");",
966
+ " String t = getString(\"helper_key\", \"\");",
967
+ " }",
968
+ "}",
969
+ "",
970
+ ].join("\n"),
971
+ });
972
+ const target = path.join(tmp, "legacy_target");
973
+ const proc = runCapture([process.execPath, INSPECT, repo, "--app-module", ":app", "--target-project-dir", target]);
974
+ const arch = path.join(target, ".hometrans", "arch_generate");
975
+ const inspection = proc.returncode === 0 ? parseStrictJson(fs.readFileSync(path.join(arch, "inspection.json"), "utf8")) : {};
976
+ const scope = proc.returncode === 0 ? parseStrictJson(fs.readFileSync(path.join(arch, "scope.json"), "utf8")) : {};
977
+ check("S01 inspection done", proc.returncode === 0, `exit=${proc.returncode} stderr=${proc.stderr.slice(0, 300)}`);
978
+
979
+ const libRoots = pyGet(pyGet(scope, "selected_source_roots", {}), ":lib", []);
980
+ check("S02 src/, res/ and manifest declared in build.gradle sourceSets.main are scanned",
981
+ deepEq([...libRoots].sort(), ["lib/AndroidManifest.xml", "lib/res", "lib/src"]),
982
+ `roots=${deepRepr(libRoots)}`);
983
+
984
+ const dbs = pyGet(inspection, "database_schemas", []);
985
+ const reader = dbs.find((db) => db.name === "ReaderReader.db");
986
+ check("S03 the database name comes from the super(ctx, DB_NAME, …) constant, not the helper class name",
987
+ reader !== undefined && !dbs.some((db) => db.name === "ReaderDbHelper" || db.name === "HighLightTable"),
988
+ `dbs=${deepRepr(dbs.map((db) => db.name))}`);
989
+ check("S04 the version comes from the DB_VERSION constant",
990
+ reader !== undefined && Number(reader.version) === 6, `version=${pyStr(reader?.version)}`);
991
+ const tables = reader ? reader.tables.map((t) => t.name).sort() : [];
992
+ check("S05 DDL in a constants class belongs to the helper that references it; CREATE TABLE in comments is not recorded",
993
+ deepEq(tables, ["highlight"]) && !dbs.some((db) => (db.tables ?? []).some((t) => ["ghost", "old_table"].includes(t.name))),
994
+ `tables=${deepRepr(tables)}`);
995
+
996
+ const pass = dbs.find((db) => (db.tables ?? []).some((t) => t.name === "pass_item"));
997
+ check("S09 super(ctx, name, …) pass-through constructor arguments are not resolved to an unrelated val name = \"…\"",
998
+ pass !== undefined && pass.name !== "unrelated.db" && pass.confidence === "review_required"
999
+ && pass.version === undefined,
1000
+ `pass=${deepRepr(pass ? { name: pass.name, confidence: pass.confidence, version: pass.version } : null)}`);
1001
+
1002
+ const stores = pyGet(inspection, "preference_stores", []);
1003
+ const appSetting = stores.find((st) => st.name === "AppSetting");
1004
+ const keyConf = Object.fromEntries((appSetting?.keys ?? []).map((k) => [k.key, k.confidence]));
1005
+ check("S06 keys on a SharedPreferences instance stay authoritative",
1006
+ keyConf.show_tab_name === "authoritative", `keys=${deepRepr(keyConf)}`);
1007
+ const allKeys = new Set(stores.flatMap((st) => (st.keys ?? []).map((k) => k.key)));
1008
+ check("S07 getString on JSONObject / Bundle / getExtras() no longer counts as a preference key",
1009
+ !["server_field", "bundle_key", "extra_key"].some((k) => allKeys.has(k)),
1010
+ `keys=${deepRepr([...allKeys].sort())}`);
1011
+ check("S08 getString( with an unknown receiver \"k\", def) is kept but downgraded to review_required",
1012
+ keyConf.helper_key === "review_required", `keys=${deepRepr(keyConf)}`);
1013
+
1014
+ // HarmonyOS target: two RDB stores in different files; DDL lives in a
1015
+ // separate file imported only by the second opener; a third file has
1016
+ // commented-out store code.
1017
+ const hmos = path.join(tmp, "hmos_storage");
1018
+ const ets = "entry/src/main/ets";
1019
+ writeTree(hmos, {
1020
+ "build-profile.json5": "{\"app\": {}, \"modules\": [{\"name\": \"entry\", \"srcPath\": \"./entry\"}]}\n",
1021
+ "entry/build-profile.json5": "{\"targets\": []}\n",
1022
+ "entry/src/main/module.json5": "{\"module\": {\"name\": \"entry\", \"type\": \"entry\"}}\n",
1023
+ [`${ets}/db/EventsDb.ets`]: [
1024
+ "import relationalStore from '@ohos.data.relationalStore';",
1025
+ "const STORE_NAME = 'events.db';",
1026
+ "export async function open(ctx) {",
1027
+ " const store = await relationalStore.getRdbStore(ctx, { name: STORE_NAME, securityLevel: 1 });",
1028
+ " await store.executeSql('CREATE TABLE IF NOT EXISTS event (id INTEGER PRIMARY KEY, title TEXT)');",
1029
+ "}",
1030
+ "",
1031
+ ].join("\n"),
1032
+ [`${ets}/db/TingDb.ets`]: [
1033
+ "import relationalStore from '@ohos.data.relationalStore';",
1034
+ "import { TING_SQL } from './TingSchema';",
1035
+ "export async function open(ctx) {",
1036
+ " const store = await relationalStore.getRdbStore(ctx, { name: 'eudic_ting.db', securityLevel: 1 });",
1037
+ " await store.executeSql(TING_SQL);",
1038
+ "}",
1039
+ "",
1040
+ ].join("\n"),
1041
+ [`${ets}/db/TingSchema.ets`]: "export const TING_SQL = 'CREATE TABLE IF NOT EXISTS ting_item (id INTEGER, name TEXT)';\n",
1042
+ [`${ets}/db/Legacy.ets`]: "// relationalStore.getRdbStore(ctx, { name: 'old.db' })\n// 'CREATE TABLE zombie (a TEXT)'\n",
1043
+ [`${ets}/pref/A.ets`]: "const p = preferences.getPreferencesSync(ctx, { name: 'x' });\nconst s = dataPreferences.getPreferences(ctx, 'settings');\ns.get('theme', 'light');\n",
1044
+ [`${ets}/pref/B.ets`]: "const q = dataPreferences.getPreferences(ctx, 'other');\nq.get('volume', 3);\n",
1045
+ [`${ets}/pref/C.ets`]: "import { PreferencesUtil } from './PreferencesUtil';\nPreferencesUtil.get('orphan', 1);\n",
1046
+ });
1047
+ const hReport = path.join(tmp, "hmos_target_inspection.json");
1048
+ const hp = runCapture([
1049
+ process.execPath, path.join(SCRIPTS_DIR, "inspect_harmony_target.mjs"),
1050
+ "--target-project-dir", hmos, "--report", hReport,
1051
+ ]);
1052
+ const hData = isFile(hReport) ? parseStrictJson(fs.readFileSync(hReport, "utf8")) : {};
1053
+ const hdbs = pyGet(pyGet(hData, "storage", {}), "databases", []);
1054
+ const tablesOf = (name) => (hdbs.find((db) => db.name === name)?.tables ?? []).map((t) => t.name).sort();
1055
+ check("H01 HarmonyOS inspection done", hp.returncode === 0 && isFile(hReport), `exit=${hp.returncode} stderr=${hp.stderr.slice(0, 300)}`);
1056
+ check("H02 same-file constant name: STORE_NAME resolves to events.db, tables belong to this database",
1057
+ deepEq(tablesOf("events.db"), ["event"]), `dbs=${deepRepr(hdbs.map((db) => [db.name, db.tables.map((t) => t.name)]))}`);
1058
+ check("H03 tables in a separate schema file belong to the database that imports it, not the first one found",
1059
+ deepEq(tablesOf("eudic_ting.db"), ["ting_item"]) && !tablesOf("events.db").includes("ting_item"),
1060
+ `dbs=${deepRepr(hdbs.map((db) => [db.name, db.tables.map((t) => t.name)]))}`);
1061
+ check("H04 commented-out getRdbStore / CREATE TABLE yields no database or table",
1062
+ !hdbs.some((db) => db.name === "old.db" || (db.tables ?? []).some((t) => t.name === "zombie")),
1063
+ `dbs=${deepRepr(hdbs.map((db) => db.name))}`);
1064
+ const hprefs = pyGet(pyGet(hData, "storage", {}), "preference_stores", []);
1065
+ const prefKeys = Object.fromEntries(hprefs.map((st) => [st.name, (st.keys ?? []).map((k) => k.key).sort()]));
1066
+ check("H05 preference keys belong to the store opened in this file, not the first store found",
1067
+ deepEq(prefKeys.other ?? [], ["volume"]) && !(prefKeys.settings ?? []).includes("volume"),
1068
+ `prefs=${deepRepr(prefKeys)}`);
1069
+ check("H06 with several stores, keys in a file that opens no store belong to no store",
1070
+ !Object.values(prefKeys).some((keys) => keys.includes("orphan")), `prefs=${deepRepr(prefKeys)}`);
1071
+
1072
+ // Single-store module: a PreferencesUtil wrapper opens the store, pages
1073
+ // only call the wrapper; their keys still belong to that one store.
1074
+ const hmosOne = path.join(tmp, "hmos_single_store");
1075
+ writeTree(hmosOne, {
1076
+ "build-profile.json5": "{\"app\": {}, \"modules\": [{\"name\": \"entry\", \"srcPath\": \"./entry\"}]}\n",
1077
+ "entry/build-profile.json5": "{\"targets\": []}\n",
1078
+ "entry/src/main/module.json5": "{\"module\": {\"name\": \"entry\", \"type\": \"entry\"}}\n",
1079
+ [`${ets}/util/PreferencesUtil.ets`]: "const store = dataPreferences.getPreferencesSync(ctx, 'app_prefs');\nexport function get(k, d) { return store.getSync(k, d); }\n",
1080
+ [`${ets}/pages/Index.ets`]: "import { PreferencesUtil } from '../util/PreferencesUtil';\nconst size = PreferencesUtil.get('font_size', 14);\n",
1081
+ });
1082
+ const oneReport = path.join(tmp, "hmos_single_inspection.json");
1083
+ runCapture([
1084
+ process.execPath, path.join(SCRIPTS_DIR, "inspect_harmony_target.mjs"),
1085
+ "--target-project-dir", hmosOne, "--report", oneReport,
1086
+ ]);
1087
+ const oneData = isFile(oneReport) ? parseStrictJson(fs.readFileSync(oneReport, "utf8")) : {};
1088
+ const oneKeys = Object.fromEntries(pyGet(pyGet(oneData, "storage", {}), "preference_stores", [])
1089
+ .map((st) => [st.name, (st.keys ?? []).map((k) => k.key).sort()]));
1090
+ check("H07 with a single store in the module, keys used through a wrapper class belong to that store",
1091
+ (oneKeys.app_prefs ?? []).includes("font_size"), `prefs=${deepRepr(oneKeys)}`);
1092
+ }
1093
+
1094
+
1095
+ // Chinese contract forms (i18n/terms.json): this English copy writes the en
1096
+ // headings / table headers everywhere else; every reader must accept the zh
1097
+ // forms like the en ones (written as \uXXXX escapes).
1098
+ function toChineseProjectDesign(text) {
1099
+ return mutate(mutate(mutate(text,
1100
+ "## Project Structure", "## \u9879\u76ee\u7ed3\u6784"),
1101
+ "## Module Semantics", "## \u6a21\u5757\u8bed\u4e49"),
1102
+ "| Module Path | Module Responsibility |", "| \u6a21\u5757\u8def\u5f84 | \u6a21\u5757\u529f\u80fd |");
1103
+ }
1104
+
1105
+ const ZH_POPULATED_DB_DOC = POPULATED_DB_DOC
1106
+ .replace("## Storage Overview", "## \u5b58\u50a8\u603b\u89c8")
1107
+ .replace("| Database | Purpose |", "| \u6570\u636e\u5e93 | \u7528\u9014 |")
1108
+ .replace("## Database Tables", "## \u6570\u636e\u5e93\u8868")
1109
+ .replace("| Field | Type | Key | Constraints |", "| \u5b57\u6bb5 | \u7c7b\u578b | \u952e | \u7ea6\u675f |");
1110
+ const ZH_POPULATED_PREF_DOC = POPULATED_PREF_DOC
1111
+ .replace("## Preferences Keys", "## Preferences \u76f8\u5173\u952e")
1112
+ .replace("| Key | Type | Default |", "| \u952e | \u7c7b\u578b | \u9ed8\u8ba4\u503c |");
1113
+ const ZH_EMPTY_DB = "# database_design\n\n## \u5b58\u50a8\u603b\u89c8\n\n| \u6570\u636e\u5e93 | \u7528\u9014 |\n|---|---|\n\n## \u6570\u636e\u5e93\u8868\n";
1114
+ const ZH_EMPTY_PREF = "# Preferences\n\n## Preferences \u76f8\u5173\u952e\n";
1115
+
1116
+
1117
+ function testChineseContractForms(tmp) {
1118
+ process.stdout.write("== Chinese contract forms (i18n/terms.json, zh/en both accepted) ==\n");
1119
+ const doc = (text, name) => {
1120
+ const p = path.join(tmp, name);
1121
+ fs.writeFileSync(p, text, "utf8");
1122
+ return p;
1123
+ };
1124
+ const three = toChineseProjectDesign(baseDoc("three-layer-PROJECT_DESIGN.md"));
1125
+ const recon = toChineseProjectDesign(baseDoc("reconcile-layer-PROJECT_DESIGN.md"));
1126
+
1127
+ let [code, data] = runValidator(doc(three, "e01.md"), "layered", "direct", false, path.join(tmp, "re01.json"));
1128
+ check("E01 three-layer generate with Chinese headings / table headers passes",
1129
+ code === 0 && data.validation_status === "complete",
1130
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1131
+
1132
+ [code, data] = runValidator(doc(recon, "e02.md"), "layered", "direct", true, path.join(tmp, "re02.json"));
1133
+ check("E02 Chinese reconcile passes + existing_annotations match the English version",
1134
+ code === 0 && deepEq([...(data.existing_annotations || [])].sort(), ANNOTATED),
1135
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1136
+
1137
+ [code, data] = runValidator(
1138
+ doc(mutate(three, "| \u6a21\u5757\u8def\u5f84 | \u6a21\u5757\u529f\u80fd |", "| \u6a21\u5757\u8def\u5f84 | \u6a21\u5757\u63cf\u8ff0 |"), "e03.md"),
1139
+ "layered", "direct", false, path.join(tmp, "re03.json"));
1140
+ check("E03 wrong Chinese table header → module_semantics_header",
1141
+ code === 2 && errorCodes(data).has("module_semantics_header"),
1142
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1143
+
1144
+ [code, data] = runValidator(
1145
+ doc(mutate(three, "## \u6a21\u5757\u8bed\u4e49", "## \u6a21\u5757\u8bed"), "e04.md"),
1146
+ "layered", "direct", false, path.join(tmp, "re04.json"));
1147
+ check("E04 wrong Chinese level-two heading → formal_section_contract",
1148
+ code === 2 && errorCodes(data).has("formal_section_contract"),
1149
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1150
+
1151
+ [code, data] = runValidator(
1152
+ doc(mutate(three, "## \u6a21\u5757\u8bed\u4e49", "## \u6a21\u5757\u8bed\u4e49\n\nTBD"), "e05.md"),
1153
+ "layered", "direct", false, path.join(tmp, "re05.json"));
1154
+ check("E05 placeholder TBD in a Chinese-heading document → architecture_placeholder",
1155
+ code === 2 && errorCodes(data).has("architecture_placeholder"),
1156
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1157
+
1158
+ const [, modules] = parseDocument(three);
1159
+ check("E06 scaffold parses Chinese headings, modules match the English version",
1160
+ deepEq(modules, [["products/app", "HAP"], ["features/home", "HAR"],
1161
+ ["features/trade", "HSP"], ["common/utils", "HAR"]]),
1162
+ deepRepr(modules));
1163
+
1164
+ // data docs
1165
+ const arch = path.join(tmp, "arch_e07");
1166
+ fs.mkdirSync(arch, { recursive: true });
1167
+ fs.writeFileSync(path.join(arch, "inspection.json"),
1168
+ pyJsonDump(makeSyntheticInspection(true, true), { indent: null }), "utf8");
1169
+ [code, data] = runDataValidator(arch, doc(ZH_POPULATED_DB_DOC, "e07_db.md"), doc(ZH_POPULATED_PREF_DOC, "e07_pref.md"),
1170
+ path.join(tmp, "re07.json"));
1171
+ check("E07 Chinese database / preferences docs pass (headings and table headers in Chinese)",
1172
+ code === 0 && errorCodes(data).size === 0,
1173
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1174
+
1175
+ [code, data] = runDataValidator(
1176
+ arch,
1177
+ doc(ZH_POPULATED_DB_DOC.replace("| title | TEXT |", "| title | INTEGER |"), "e08_db.md"),
1178
+ doc(ZH_POPULATED_PREF_DOC, "e08_pref.md"), path.join(tmp, "re08.json"));
1179
+ check("E08 Chinese-header tables are compared as usual: TEXT vs INTEGER still reports mismatch",
1180
+ code === 2 && errorCodes(data).has("database_type_mismatch"),
1181
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1182
+
1183
+ [code, data] = runDataValidator(
1184
+ arch,
1185
+ doc(ZH_POPULATED_DB_DOC.replace("| \u5b57\u6bb5 | \u7c7b\u578b | \u952e | \u7ea6\u675f |", "| \u5b57\u6bb5 | \u7c7b\u578b | \u952e\u540d | \u7ea6\u675f |"), "e09_db.md"),
1186
+ doc(ZH_POPULATED_PREF_DOC, "e09_pref.md"), path.join(tmp, "re09.json"));
1187
+ check("E09 wrong Chinese field table header → invalid_table_header",
1188
+ code === 2 && errorCodes(data).has("invalid_table_header"),
1189
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1190
+
1191
+ const archEmpty = path.join(tmp, "arch_e10");
1192
+ fs.mkdirSync(archEmpty, { recursive: true });
1193
+ fs.writeFileSync(path.join(archEmpty, "inspection.json"),
1194
+ pyJsonDump(makeSyntheticInspection(false, false), { indent: null }), "utf8");
1195
+ [code, data] = runDataValidator(archEmpty, doc(ZH_EMPTY_DB, "e10_db.md"), doc(ZH_EMPTY_PREF, "e10_pref.md"),
1196
+ path.join(tmp, "re10.json"));
1197
+ check("E10 Chinese empty state (zh Storage Overview / Preferences Keys headings) passes",
1198
+ code === 0 && errorCodes(data).size === 0,
1199
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1200
+
1201
+ [code, data] = runDataValidator(archEmpty, doc(EMPTY_DB, "e11_db.md"), doc(EMPTY_PREF, "e11_pref.md"),
1202
+ path.join(tmp, "re11.json"));
1203
+ check("E11 English empty state still passes",
1204
+ code === 0 && errorCodes(data).size === 0,
1205
+ `exit=${code} errors=${deepRepr(errorCodes(data))}`);
1206
+
1207
+ [code, data] = runDataValidator(
1208
+ arch,
1209
+ // bare name: a backticked name followed by a suffix keeps its backticks in both forms
1210
+ doc(ZH_POPULATED_DB_DOC.replace("#### `notes`", "#### notes\uff08\u5df2\u5e9f\u5f03\uff09"), "e12_db.md"),
1211
+ doc(ZH_POPULATED_PREF_DOC, "e12_pref.md"), path.join(tmp, "re12.json"));
1212
+ const enDeprecated = runDataValidator(
1213
+ arch,
1214
+ doc(POPULATED_DB_DOC.replace("#### `notes`", "#### notes (deprecated)"), "e12z_db.md"),
1215
+ doc(POPULATED_PREF_DOC, "e12z_pref.md"), path.join(tmp, "re12z.json"));
1216
+ check("E12 table name suffix (full-width zh form) is stripped just like (deprecated)",
1217
+ code === 0 && enDeprecated[0] === 0
1218
+ && deepEq([...errorCodes(data)].sort(), [...errorCodes(enDeprecated[1])].sort()),
1219
+ `zh exit=${code} ${deepRepr(errorCodes(data))} en exit=${enDeprecated[0]} ${deepRepr(errorCodes(enDeprecated[1]))}`);
1220
+
1221
+ // incremental validator: Chinese-heading project_design.md + Chinese-heading data docs
1222
+ const root = path.join(tmp, "inc_en");
1223
+ buildFakeProject(root, recon);
1224
+ fs.writeFileSync(path.join(root, ".hometrans", "database_design.md"), ZH_EMPTY_DB, "utf8");
1225
+ fs.writeFileSync(path.join(root, ".hometrans", "preferences_design.md"), ZH_EMPTY_PREF, "utf8");
1226
+ [code, data] = runIncremental(root);
1227
+ check("E13 validate_incremental_docs reads Chinese headings, annotation set matches the English version",
1228
+ code === 0 && data.passed === true && deepEq(data.annotated_paths, ANNOTATED),
1229
+ `exit=${code} errors=${deepRepr(incErrorCodes(data))} warnings=${deepRepr(incWarningCodes(data))}`);
1230
+ }
1231
+
1232
+
1233
+ function main() {
1234
+ const td = fs.mkdtempSync(path.join(os.tmpdir(), "arch_marker_tests_"));
1235
+ try {
1236
+ const tmp = td;
1237
+ testStructural(tmp);
1238
+ testTreeEdgeCases(tmp);
1239
+ testDataDocConstraints(tmp);
1240
+ testScaffoldParser();
1241
+ if (process.platform !== "win32") testCreateProjectAppName(tmp); // C01 uses a #!/bin/bash stub
1242
+ testReviewFixes(tmp);
1243
+ testExistingProjectFixes(tmp);
1244
+ testStorageExtraction(tmp);
1245
+ testIncremental(tmp);
1246
+ testChineseContractForms(tmp);
1247
+ } finally {
1248
+ fs.rmSync(td, { recursive: true, force: true });
1249
+ }
1250
+ process.stdout.write("\n");
1251
+ process.stdout.write(`total: ${PASS} passed, ${FAIL} failed\n`);
1252
+ if (FAILURES.length > 0) {
1253
+ process.stdout.write("failure details:\n");
1254
+ for (const f of FAILURES) {
1255
+ process.stdout.write(` - ${f}\n`);
1256
+ }
1257
+ }
1258
+ return FAIL > 0 ? 1 : 0;
1259
+ }
1260
+
1261
+ process.exitCode = main();