@buaa_smat/hometrans 26.0.2 → 26.0.4-devecocli.1

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 (1496) hide show
  1. package/agents/code-reviewer.md +111 -154
  2. package/devecocli-plugin/common.ts +2271 -0
  3. package/devecocli-plugin/content-resolver.ts +363 -0
  4. package/devecocli-plugin/install.ts +72 -0
  5. package/devecocli-plugin/uninstall.ts +26 -0
  6. package/devecocli-plugin/update.ts +77 -0
  7. package/i18n/FILE-NAMES.md +9 -0
  8. package/i18n/agents/code-reviewer.md +436 -0
  9. package/i18n/agents/model-render-worker.md +38 -0
  10. package/i18n/agents/specgen-worker.md +18 -0
  11. package/i18n/commands/hometrans.md +17 -0
  12. package/i18n/skills/a2h-app-migrate/SKILL.md +206 -0
  13. package/i18n/skills/a2h-app-migrate/references/config.example.json +28 -0
  14. package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -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 +2007 -0
  18. package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +187 -0
  19. package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1656 -0
  20. package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +728 -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 +143 -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 +713 -0
  28. package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +117 -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 +271 -0
  33. package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +222 -0
  34. package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +136 -0
  35. package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +552 -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 +263 -0
  38. package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +165 -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 +207 -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 +378 -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 +131 -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/SKILL.md +304 -0
  72. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +10 -0
  73. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +249 -0
  74. package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +344 -0
  75. package/i18n/skills/a2h-arkts-logic-coder/scripts/design/move_spec_technical_reference.mjs +162 -0
  76. package/i18n/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +298 -0
  77. package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +877 -0
  78. package/i18n/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
  79. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
  80. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
  81. package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
  82. package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
  83. package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
  84. package/i18n/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
  85. package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +597 -0
  86. package/i18n/skills/a2h-batch-ui-align/SKILL.md +372 -0
  87. package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +35 -0
  88. package/i18n/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
  89. package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
  90. package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
  91. package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +85 -0
  92. package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +23 -0
  93. package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +89 -0
  94. package/i18n/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
  95. package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
  96. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +62 -0
  97. package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +30 -0
  98. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +930 -0
  99. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +420 -0
  100. package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +158 -0
  101. package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
  102. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2552 -0
  103. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +560 -0
  104. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +175 -0
  105. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +251 -0
  106. package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +28 -0
  107. package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +232 -0
  108. package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +206 -0
  109. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +232 -0
  110. package/i18n/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +2005 -0
  111. package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
  112. package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +2118 -0
  113. package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
  114. package/i18n/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +245 -0
  115. package/i18n/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
  116. package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1805 -0
  117. package/i18n/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
  118. package/i18n/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
  119. package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1959 -0
  120. package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
  121. package/i18n/skills/a2h-batch-ui-align/scripts/image_probe.mjs +405 -0
  122. package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1632 -0
  123. package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1300 -0
  124. package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1234 -0
  125. package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +417 -0
  126. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
  127. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +18 -0
  128. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +216 -0
  129. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +615 -0
  130. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
  131. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +49 -0
  132. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
  133. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
  134. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
  135. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +136 -0
  136. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
  137. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +109 -0
  138. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
  139. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
  140. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
  141. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
  142. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
  143. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
  144. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
  145. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
  146. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
  147. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
  148. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
  149. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
  150. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
  151. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
  152. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +780 -0
  153. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
  154. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
  155. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +408 -0
  156. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
  157. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
  158. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
  159. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
  160. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +179 -0
  161. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
  162. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
  163. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +81 -0
  164. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +137 -0
  165. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
  166. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
  167. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
  168. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
  169. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +147 -0
  170. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
  171. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
  172. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +127 -0
  173. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
  174. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
  175. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
  176. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
  177. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
  178. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
  179. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
  180. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
  181. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
  182. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
  183. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
  184. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +184 -0
  185. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
  186. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
  187. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
  188. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +67 -0
  189. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
  190. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
  191. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
  192. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
  193. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
  194. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +651 -0
  195. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
  196. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
  197. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
  198. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
  199. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
  200. package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
  201. package/i18n/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
  202. package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +693 -0
  203. package/i18n/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +245 -0
  204. package/i18n/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
  205. package/i18n/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
  206. package/i18n/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
  207. package/i18n/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
  208. package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +326 -0
  209. package/i18n/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
  210. package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +356 -0
  211. package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +60 -0
  212. package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +395 -0
  213. package/i18n/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
  214. package/i18n/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
  215. package/i18n/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +470 -0
  216. package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +62 -0
  217. package/i18n/skills/a2h-dashboard-render/SKILL.md +73 -0
  218. package/i18n/skills/a2h-dashboard-render/references/artifact-contract.jsonc +117 -0
  219. package/i18n/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
  220. package/i18n/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
  221. package/i18n/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
  222. package/i18n/skills/a2h-dashboard-render/scripts/dashboard.mjs +3245 -0
  223. package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +2050 -0
  224. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
  225. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
  226. package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
  227. package/i18n/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
  228. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
  229. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
  230. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +154 -0
  231. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
  232. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
  233. package/i18n/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
  234. package/i18n/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
  235. package/i18n/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
  236. package/i18n/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
  237. package/i18n/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
  238. package/i18n/skills/a2h-fix-build-errors/SKILL.md +304 -0
  239. package/i18n/skills/a2h-fix-build-errors/references/arkts-strict-patterns.md +219 -0
  240. package/i18n/skills/a2h-fix-build-errors/references/rdb-entity-pattern.md +131 -0
  241. package/i18n/skills/a2h-module-semantic-docs/SKILL.md +265 -0
  242. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
  243. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
  244. package/i18n/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
  245. package/i18n/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
  246. package/i18n/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
  247. package/i18n/skills/a2h-page-specgen/SKILL.md +239 -0
  248. package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
  249. package/i18n/skills/a2h-page-specgen/references/body-language.md +179 -0
  250. package/i18n/skills/a2h-page-specgen/references/gates.md +329 -0
  251. package/i18n/skills/a2h-page-specgen/references/page-inventory.md +220 -0
  252. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
  253. package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
  254. package/i18n/skills/a2h-page-specgen/references/spec-template.md +210 -0
  255. package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
  256. package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
  257. package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
  258. package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
  259. package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
  260. package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +1613 -0
  261. package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +1650 -0
  262. package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +864 -0
  263. package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +346 -0
  264. package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
  265. package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +155 -0
  266. package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
  267. package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +684 -0
  268. package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
  269. package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
  270. package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
  271. package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +252 -0
  272. package/i18n/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
  273. package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
  274. package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
  275. package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
  276. package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +864 -0
  277. package/i18n/skills/a2h-page-specgen/scripts/render.mjs +276 -0
  278. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +897 -0
  279. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
  280. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
  281. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
  282. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
  283. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
  284. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
  285. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
  286. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
  287. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
  288. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
  289. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
  290. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
  291. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
  292. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
  293. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
  294. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
  295. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
  296. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
  297. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
  298. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
  299. package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
  300. package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
  301. package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
  302. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
  303. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
  304. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
  305. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
  306. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
  307. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
  308. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
  309. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
  310. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
  311. package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
  312. package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +205 -0
  313. package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
  314. package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1205 -0
  315. package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +271 -0
  316. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +8 -0
  317. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +7 -0
  318. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +8 -0
  319. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
  320. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
  321. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
  322. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
  323. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
  324. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
  325. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
  326. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
  327. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
  328. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
  329. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
  330. package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
  331. package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +1029 -0
  332. package/i18n/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
  333. package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +143 -0
  334. package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +1121 -0
  335. package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
  336. package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +188 -0
  337. package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +549 -0
  338. package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
  339. package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
  340. package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +368 -0
  341. package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +348 -0
  342. package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +250 -0
  343. package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +776 -0
  344. package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
  345. package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1103 -0
  346. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
  347. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
  348. package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
  349. package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +240 -0
  350. package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +427 -0
  351. package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
  352. package/i18n/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
  353. package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +418 -0
  354. package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1782 -0
  355. package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +536 -0
  356. package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
  357. package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
  358. package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +1239 -0
  359. package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
  360. package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
  361. package/i18n/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
  362. package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1801 -0
  363. package/i18n/skills/a2h-resource-convert/SKILL.md +375 -0
  364. package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +336 -0
  365. package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +272 -0
  366. package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +226 -0
  367. package/i18n/skills/a2h-resource-convert/references/resource-mapping-rules.md +493 -0
  368. package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +251 -0
  369. package/i18n/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
  370. package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +2596 -0
  371. package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
  372. package/i18n/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
  373. package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
  374. package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +238 -0
  375. package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +358 -0
  376. package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
  377. package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
  378. package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +266 -0
  379. package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
  380. package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
  381. package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +55 -0
  382. package/i18n/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
  383. package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
  384. package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +752 -0
  385. package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +661 -0
  386. package/i18n/skills/a2h-spec-generate/SKILL.md +375 -0
  387. package/i18n/skills/a2h-spec-generate/references/batch-mode.md +215 -0
  388. package/i18n/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
  389. package/i18n/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
  390. package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +184 -0
  391. package/i18n/skills/a2h-spec-generate/references/input-formats.md +27 -0
  392. package/i18n/skills/a2h-spec-generate/references/library-evidence.md +3 -0
  393. package/i18n/skills/a2h-spec-generate/references/method-discipline.md +64 -0
  394. package/i18n/skills/a2h-spec-generate/references/optional-gates.json +45 -0
  395. package/i18n/skills/a2h-spec-generate/references/recall-guide.md +84 -0
  396. package/i18n/skills/a2h-spec-generate/references/recall-terse.md +3 -0
  397. package/i18n/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
  398. package/i18n/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
  399. package/i18n/skills/a2h-spec-generate/references/review-checklist.md +22 -0
  400. package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
  401. package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
  402. package/i18n/skills/a2h-spec-generate/references/spec-samples.md +65 -0
  403. package/i18n/skills/a2h-spec-generate/references/specs.schema.json +85 -0
  404. package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +145 -0
  405. package/i18n/skills/a2h-spec-generate/references/transfer-file.md +5 -0
  406. package/i18n/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
  407. package/i18n/skills/a2h-spec-generate/references/worker-rules.md +129 -0
  408. package/i18n/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +702 -0
  409. package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +515 -0
  410. package/i18n/skills/a2h-spec-generate/scripts/collect-specs.mjs +727 -0
  411. package/i18n/skills/a2h-spec-generate/scripts/feature-stem.mjs +151 -0
  412. package/i18n/skills/a2h-spec-generate/scripts/parse_requirements.ts +515 -0
  413. package/i18n/skills/a2h-spec-generate/scripts/prepare-facts.mjs +313 -0
  414. package/i18n/skills/a2h-spec-generate/scripts/publish-specs.mjs +354 -0
  415. package/i18n/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +669 -0
  416. package/i18n/skills/a2h-spec-generate/scripts/render-tasks.mjs +385 -0
  417. package/i18n/skills/a2h-spec-generate/scripts/report.mjs +136 -0
  418. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
  419. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
  420. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
  421. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
  422. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1265 -0
  423. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1057 -0
  424. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +565 -0
  425. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +544 -0
  426. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
  427. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +317 -0
  428. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +707 -0
  429. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +436 -0
  430. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +608 -0
  431. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +650 -0
  432. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +178 -0
  433. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
  434. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +912 -0
  435. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +279 -0
  436. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +163 -0
  437. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
  438. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +256 -0
  439. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
  440. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
  441. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
  442. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
  443. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
  444. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
  445. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +340 -0
  446. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1857 -0
  447. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +262 -0
  448. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +722 -0
  449. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
  450. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
  451. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
  452. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
  453. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
  454. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
  455. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
  456. package/i18n/skills/a2h-spec-generate/template/REQ.txt +22 -0
  457. package/i18n/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
  458. package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +847 -0
  459. package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +415 -0
  460. package/i18n/skills/a2h-spec-generate/test/collect-specs.test.mjs +808 -0
  461. package/i18n/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
  462. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
  463. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
  464. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
  465. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
  466. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
  467. package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
  468. package/i18n/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
  469. package/i18n/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
  470. package/i18n/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
  471. package/i18n/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
  472. package/i18n/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
  473. package/i18n/skills/a2h-spec-generate/test/report.test.mjs +47 -0
  474. package/i18n/skills/a2h-utg-explorer/SKILL.md +126 -0
  475. package/i18n/skills/a2h-utg-explorer/references/architecture.md +282 -0
  476. package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +908 -0
  477. package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +446 -0
  478. package/i18n/skills/a2h-utg-explorer/scripts/hint_check.mjs +147 -0
  479. package/i18n/skills/a2h-utg-explorer/scripts/hint_source.mjs +119 -0
  480. package/i18n/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
  481. package/i18n/skills/a2h-utg-explorer/scripts/recover_b.mjs +550 -0
  482. package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +647 -0
  483. package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
  484. package/i18n/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
  485. package/i18n/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
  486. package/i18n/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
  487. package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +252 -0
  488. package/i18n/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
  489. package/i18n/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
  490. package/i18n/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
  491. package/i18n/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
  492. package/i18n/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
  493. package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +614 -0
  494. package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +214 -0
  495. package/i18n/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
  496. package/i18n/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
  497. package/i18n/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
  498. package/i18n/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
  499. package/i18n/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
  500. package/i18n/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
  501. package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
  502. package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
  503. package/i18n/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
  504. package/i18n/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
  505. package/i18n/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
  506. package/i18n/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
  507. package/i18n/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
  508. package/i18n/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
  509. package/i18n/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
  510. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
  511. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
  512. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1562 -0
  513. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
  514. package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +2714 -0
  515. package/i18n/skills/a2h-utg-static/SKILL.md +372 -0
  516. package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
  517. package/i18n/skills/a2h-utg-static/references/view-interactions.md +215 -0
  518. package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +2190 -0
  519. package/i18n/skills/a2h-utg-static/scripts/audit.mjs +268 -0
  520. package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +720 -0
  521. package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +250 -0
  522. package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +374 -0
  523. package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
  524. package/i18n/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
  525. package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
  526. package/i18n/skills/a2h-utg-static/scripts/fragment_nav.mjs +1137 -0
  527. package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +705 -0
  528. package/i18n/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
  529. package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +958 -0
  530. package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
  531. package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
  532. package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +545 -0
  533. package/i18n/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
  534. package/i18n/skills/a2h-utg-static/scripts/static_prior.mjs +956 -0
  535. package/i18n/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
  536. package/i18n/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
  537. package/i18n/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
  538. package/i18n/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
  539. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +125 -0
  540. package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +289 -0
  541. package/i18n/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
  542. package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -0
  543. package/i18n/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
  544. package/i18n/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
  545. package/i18n/skills/a2h-utg-static/scripts/tests/test_fresh_branch_guard.mjs +49 -0
  546. package/i18n/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +136 -0
  547. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
  548. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
  549. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
  550. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +457 -0
  551. package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
  552. package/i18n/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
  553. package/i18n/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
  554. package/i18n/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
  555. package/i18n/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +368 -0
  556. package/i18n/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
  557. package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +78 -0
  558. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
  559. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
  560. package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_off_path.mjs +67 -0
  561. package/i18n/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
  562. package/i18n/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
  563. package/i18n/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
  564. package/i18n/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
  565. package/i18n/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
  566. package/i18n/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
  567. package/i18n/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +61 -0
  568. package/i18n/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
  569. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_data_table.mjs +340 -0
  570. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_relative_url.mjs +125 -0
  571. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
  572. package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +330 -0
  573. package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
  574. package/i18n/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +340 -0
  575. package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1394 -0
  576. package/i18n/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
  577. package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
  578. package/index.js +1643 -0
  579. package/package.json +18 -168
  580. package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
  581. package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
  582. package/plugin.jsonc +12 -0
  583. package/skills/a2h-app-migrate/SKILL.md +31 -12
  584. package/skills/a2h-app-migrate/references/config.example.json +1 -0
  585. package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
  586. package/skills/a2h-app-migrate/references/stage-map.md +4 -2
  587. package/skills/a2h-app-migrate/references/workflow.yaml +427 -103
  588. package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
  589. package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
  590. package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -6
  591. package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
  592. package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
  593. package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
  594. package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
  595. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +178 -44
  596. package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
  597. package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +81 -11
  598. package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
  599. package/skills/a2h-app-migrate/scripts/ledger.mjs +80 -10
  600. package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
  601. package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
  602. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +72 -12
  603. package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
  604. package/skills/a2h-app-migrate/scripts/run_dir.mjs +137 -41
  605. package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
  606. package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
  607. package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
  608. package/skills/a2h-app-migrate/scripts/spec_layout.mjs +2 -0
  609. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +38 -0
  610. package/skills/a2h-app-migrate/test/test_android_index.mjs +143 -0
  611. package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
  612. package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
  613. package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
  614. package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
  615. package/skills/a2h-app-migrate/test/test_devecocli_docs_preflight.mjs +32 -0
  616. package/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
  617. package/skills/a2h-app-migrate/test/test_entry_guards.mjs +102 -0
  618. package/skills/a2h-app-migrate/test/test_env_requirements.mjs +713 -0
  619. package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
  620. package/skills/a2h-app-migrate/test/test_finalize.mjs +117 -0
  621. package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
  622. package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
  623. package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +51 -0
  624. package/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
  625. package/skills/a2h-app-migrate/test/test_incremental_acceptance.mjs +145 -0
  626. package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
  627. package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
  628. package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
  629. package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +101 -0
  630. package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
  631. package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
  632. package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +150 -0
  633. package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
  634. package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +86 -0
  635. package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
  636. package/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
  637. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +271 -0
  638. package/skills/a2h-app-migrate/test/test_resume_summary.mjs +222 -0
  639. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +136 -0
  640. package/skills/a2h-app-migrate/test/test_run_dir.mjs +552 -0
  641. package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -0
  642. package/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
  643. package/skills/a2h-app-migrate/test/test_spec_engine_acceptance.mjs +94 -0
  644. package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +155 -0
  645. package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +263 -0
  646. package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +165 -0
  647. package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +511 -0
  648. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
  649. package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
  650. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +65 -0
  651. package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
  652. package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +83 -0
  653. package/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
  654. package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +41 -0
  655. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +214 -0
  656. package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
  657. package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
  658. package/skills/a2h-arch-generate/SKILL.md +20 -17
  659. package/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
  660. package/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
  661. package/skills/a2h-arch-generate/references/homegraph-workflow.md +25 -14
  662. package/skills/a2h-arch-generate/references/module-evidence-subagent.md +2 -2
  663. package/skills/a2h-arch-generate/references/source-baseline.md +4 -4
  664. package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
  665. package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
  666. package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +35 -46
  667. package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
  668. package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +33 -40
  669. package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +2 -3
  670. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
  671. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
  672. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
  673. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
  674. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
  675. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
  676. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
  677. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
  678. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
  679. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
  680. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
  681. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
  682. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
  683. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
  684. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
  685. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
  686. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
  687. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
  688. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
  689. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
  690. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
  691. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
  692. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
  693. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
  694. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
  695. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
  696. package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
  697. package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1260 -0
  698. package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +208 -0
  699. package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
  700. package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
  701. package/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
  702. package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +164 -0
  703. package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +2 -5
  704. package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
  705. package/skills/a2h-arkts-logic-coder/SKILL.md +163 -15
  706. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +3 -1
  707. package/skills/a2h-arkts-logic-coder/references/code-generation.md +120 -1
  708. package/skills/a2h-arkts-logic-coder/references/spec-design.md +46 -11
  709. package/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +22 -25
  710. package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +873 -0
  711. package/skills/a2h-arkts-logic-coder/test/golden/inspect_happy.json +20 -0
  712. package/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
  713. package/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
  714. package/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
  715. package/skills/a2h-arkts-logic-coder/test/golden/resolve_cases.json +36 -0
  716. package/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
  717. package/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
  718. package/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
  719. package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +596 -0
  720. package/skills/a2h-batch-ui-align/SKILL.md +78 -26
  721. package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
  722. package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
  723. package/skills/a2h-batch-ui-align/references/cards/geometry.md +6 -1
  724. package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
  725. package/skills/a2h-batch-ui-align/references/cards/resources.md +9 -3
  726. package/skills/a2h-batch-ui-align/references/cards/widgets.md +27 -3
  727. package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
  728. package/skills/a2h-batch-ui-align/references/checker-rules.md +301 -13
  729. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +53 -13
  730. package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
  731. package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
  732. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +14 -9
  733. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +2 -2
  734. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
  735. package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +30 -0
  736. package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
  737. package/skills/a2h-batch-ui-align/references/step4-prepare.md +7 -2
  738. package/skills/a2h-batch-ui-align/references/step5-convert.md +33 -9
  739. package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +6 -7
  740. package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
  741. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +463 -22
  742. package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
  743. package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
  744. package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
  745. package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
  746. package/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
  747. package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +263 -0
  748. package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +20 -3
  749. package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +4 -5
  750. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +220 -35
  751. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +517 -41
  752. package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
  753. package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +231 -54
  754. package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
  755. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +239 -14
  756. package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
  757. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +98 -11
  758. package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
  759. package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
  760. package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +118 -4
  761. package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
  762. package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
  763. package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +231 -0
  764. package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
  765. package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +1 -5
  766. package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
  767. package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
  768. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +61 -12
  769. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +32 -0
  770. package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
  771. package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +3 -3
  772. package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
  773. package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +2 -2
  774. package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +84 -19
  775. package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +11 -4
  776. package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +2 -2
  777. package/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
  778. package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
  779. package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
  780. package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +5 -5
  781. package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
  782. package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
  783. package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
  784. package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
  785. package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
  786. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +2 -2
  787. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +110 -12
  788. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
  789. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
  790. package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +179 -0
  791. package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
  792. package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +81 -8
  793. package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
  794. package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
  795. package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
  796. package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
  797. package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
  798. package/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
  799. package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +184 -0
  800. package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
  801. package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
  802. package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +2 -3
  803. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +30 -2
  804. package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +231 -0
  805. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
  806. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +312 -0
  807. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_baseline.test.mjs +129 -0
  808. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
  809. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
  810. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +312 -0
  811. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_runtime2.test.mjs +697 -0
  812. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
  813. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +298 -0
  814. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
  815. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +651 -0
  816. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
  817. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
  818. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
  819. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +269 -0
  820. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
  821. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +346 -0
  822. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
  823. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_safearea.test.mjs +742 -0
  824. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +91 -0
  825. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +86 -0
  826. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme_runtime.test.mjs +95 -0
  827. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
  828. package/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
  829. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +693 -0
  830. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +291 -0
  831. package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
  832. package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
  833. package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
  834. package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
  835. package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +93 -0
  836. package/skills/a2h-batch-ui-align/scripts/tests/detect_paradigm.test.mjs +260 -0
  837. package/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +244 -0
  838. package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +435 -0
  839. package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +31 -0
  840. package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
  841. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
  842. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
  843. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
  844. package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -0
  845. package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
  846. package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
  847. package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
  848. package/skills/a2h-batch-ui-align/scripts/tests/group_pack_evidence.test.mjs +95 -0
  849. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1782 -0
  850. package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
  851. package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
  852. package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
  853. package/skills/a2h-batch-ui-align/scripts/tests/icon_coverage.test.mjs +314 -0
  854. package/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
  855. package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
  856. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +326 -0
  857. package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
  858. package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
  859. package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +356 -0
  860. package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
  861. package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +302 -0
  862. package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
  863. package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +60 -0
  864. package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +395 -0
  865. package/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
  866. package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
  867. package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
  868. package/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
  869. package/skills/a2h-dashboard-render/scripts/dashboard.mjs +12 -14
  870. package/skills/a2h-dashboard-render/scripts/device_capture.mjs +29 -30
  871. package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
  872. package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
  873. package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
  874. package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
  875. package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
  876. package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
  877. package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
  878. package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
  879. package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
  880. package/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +203 -0
  881. package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
  882. package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
  883. package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
  884. package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
  885. package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
  886. package/skills/a2h-dashboard-render/test/test_device_locale_dialogs.mjs +17 -0
  887. package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
  888. package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
  889. package/skills/a2h-module-semantic-docs/SKILL.md +51 -13
  890. package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
  891. package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
  892. package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
  893. package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
  894. package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
  895. package/skills/a2h-module-semantic-docs/test/test_incremental_fingerprint.mjs +94 -0
  896. package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
  897. package/skills/a2h-page-specgen/SKILL.md +240 -0
  898. package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
  899. package/skills/a2h-page-specgen/references/body-language.md +179 -0
  900. package/skills/a2h-page-specgen/references/evidence.md +105 -0
  901. package/skills/a2h-page-specgen/references/execution-model.md +364 -0
  902. package/skills/a2h-page-specgen/references/footprint-and-grouping.md +255 -0
  903. package/skills/a2h-page-specgen/references/gates.md +323 -0
  904. package/skills/a2h-page-specgen/references/page-inventory.md +220 -0
  905. package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
  906. package/skills/a2h-page-specgen/references/spec-example.md +312 -0
  907. package/skills/a2h-page-specgen/references/spec-template.md +210 -0
  908. package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
  909. package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
  910. package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
  911. package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
  912. package/skills/a2h-page-specgen/scripts/dispatch.mjs +212 -0
  913. package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
  914. package/skills/a2h-page-specgen/scripts/facts-build.mjs +1613 -0
  915. package/skills/a2h-page-specgen/scripts/finalize.mjs +825 -0
  916. package/skills/a2h-page-specgen/scripts/footprint.mjs +1650 -0
  917. package/skills/a2h-page-specgen/scripts/gate.mjs +848 -0
  918. package/skills/a2h-page-specgen/scripts/interactions.mjs +344 -0
  919. package/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
  920. package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +155 -0
  921. package/skills/a2h-page-specgen/scripts/lib/deps-source.mjs +399 -0
  922. package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +229 -0
  923. package/skills/a2h-page-specgen/scripts/lib/footprint-roles.mjs +278 -0
  924. package/skills/a2h-page-specgen/scripts/lib/fsx.mjs +79 -0
  925. package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
  926. package/skills/a2h-page-specgen/scripts/lib/hg.mjs +683 -0
  927. package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
  928. package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
  929. package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +478 -0
  930. package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
  931. package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
  932. package/skills/a2h-page-specgen/scripts/lib/prose.mjs +238 -0
  933. package/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
  934. package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
  935. package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
  936. package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
  937. package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
  938. package/skills/a2h-page-specgen/scripts/lib/symbols.mjs +125 -0
  939. package/skills/a2h-page-specgen/scripts/lib/utg-io.mjs +110 -0
  940. package/skills/a2h-page-specgen/scripts/lib/waker-event-store.mjs +658 -0
  941. package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
  942. package/skills/a2h-page-specgen/scripts/prepare.mjs +840 -0
  943. package/skills/a2h-page-specgen/scripts/render.mjs +294 -0
  944. package/skills/a2h-page-specgen/scripts/report.mjs +340 -0
  945. package/skills/a2h-page-specgen/scripts/submission.mjs +697 -0
  946. package/skills/a2h-page-specgen/scripts/submit.mjs +85 -0
  947. package/skills/a2h-page-specgen/scripts/test/acceptance/README.md +77 -0
  948. package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +871 -0
  949. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
  950. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
  951. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
  952. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
  953. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
  954. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
  955. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
  956. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
  957. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
  958. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
  959. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
  960. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
  961. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
  962. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
  963. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
  964. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
  965. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
  966. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
  967. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
  968. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
  969. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
  970. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
  971. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
  972. package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
  973. package/skills/a2h-page-specgen/scripts/test/acceptance/cases.example.json +57 -0
  974. package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
  975. package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
  976. package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
  977. package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
  978. package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
  979. package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
  980. package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
  981. package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
  982. package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
  983. package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
  984. package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
  985. package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
  986. package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +205 -0
  987. package/skills/a2h-page-specgen/scripts/test/dispatch.test.mjs +258 -0
  988. package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
  989. package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1203 -0
  990. package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +243 -0
  991. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Api.kt +20 -0
  992. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/BothAnnotations.kt +28 -0
  993. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Cache.kt +7 -0
  994. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Comments.kt +26 -0
  995. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Mmkv.kt +7 -0
  996. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Models.kt +19 -0
  997. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Pair.kt +7 -0
  998. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Prefs.kt +9 -0
  999. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Room.kt +11 -0
  1000. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Sample.kt +43 -0
  1001. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Templates.kt +34 -0
  1002. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Timeouts.kt +8 -0
  1003. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/androidTest/Helper.kt +5 -0
  1004. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/build.gradle.kts +16 -0
  1005. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/en.js.txt +5 -0
  1006. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +4 -0
  1007. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/libs.versions.toml +14 -0
  1008. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/package.json +10 -0
  1009. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values/strings.xml +10 -0
  1010. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +4 -0
  1011. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-land/strings.xml +5 -0
  1012. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-night/strings.xml +5 -0
  1013. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-v21/strings.xml +4 -0
  1014. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +4 -0
  1015. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/test/Legacy.kt +4 -0
  1016. package/skills/a2h-page-specgen/scripts/test/fixtures/facts/weather.proto +11 -0
  1017. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/AppPreferences.kt +13 -0
  1018. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/SettingsViewModel.kt +16 -0
  1019. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-dao/src/UserDao.kt +28 -0
  1020. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/base/strings.xml +6 -0
  1021. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/fil/strings.xml +6 -0
  1022. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/arrays.xml +25 -0
  1023. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/strings.xml +10 -0
  1024. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/xml/prefs.xml +27 -0
  1025. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Api.java +19 -0
  1026. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Datastore.kt +12 -0
  1027. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Settings.java +13 -0
  1028. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/forecast.js +14 -0
  1029. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/store.js +14 -0
  1030. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/BasePreferences.kt +13 -0
  1031. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/Screen.kt +14 -0
  1032. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/UiPreferences.kt +8 -0
  1033. package/skills/a2h-page-specgen/scripts/test/fixtures/facts-retrofit/src/AuthAPI.kt +26 -0
  1034. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/AndroidManifest.xml +20 -0
  1035. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/feature/auth/navigation/ScreenRoute.kt +8 -0
  1036. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/pages.json +19 -0
  1037. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/components/Widget.vue +11 -0
  1038. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/detail/detail.vue +14 -0
  1039. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/index/index.vue +24 -0
  1040. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/store/userStore.js +11 -0
  1041. package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/uni_modules/uview-ui/components/u-thing.js +5 -0
  1042. package/skills/a2h-page-specgen/scripts/test/fixtures/fp.mkdb.mjs +144 -0
  1043. package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +112 -0
  1044. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
  1045. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
  1046. package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
  1047. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
  1048. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
  1049. package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
  1050. package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
  1051. package/skills/a2h-page-specgen/scripts/test/fixtures/src/MainFragment.java +6 -0
  1052. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -0
  1053. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyListeners.java +12 -0
  1054. package/skills/a2h-page-specgen/scripts/test/fixtures/src/PlainActivity.java +3 -0
  1055. package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshOnResume.java +7 -0
  1056. package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
  1057. package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
  1058. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
  1059. package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
  1060. package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
  1061. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
  1062. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
  1063. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
  1064. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
  1065. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
  1066. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
  1067. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
  1068. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
  1069. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
  1070. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
  1071. package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
  1072. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
  1073. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/fold-chain/utg.json +12 -0
  1074. package/skills/a2h-page-specgen/scripts/test/fixtures/utg/utg.json +34 -0
  1075. package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +1029 -0
  1076. package/skills/a2h-page-specgen/scripts/test/footprint-roles.test.mjs +172 -0
  1077. package/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
  1078. package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +143 -0
  1079. package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +1078 -0
  1080. package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
  1081. package/skills/a2h-page-specgen/scripts/test/helpers.mjs +188 -0
  1082. package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +549 -0
  1083. package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
  1084. package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
  1085. package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +368 -0
  1086. package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +310 -0
  1087. package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +250 -0
  1088. package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +776 -0
  1089. package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
  1090. package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +464 -0
  1091. package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
  1092. package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
  1093. package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1103 -0
  1094. package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
  1095. package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
  1096. package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +160 -0
  1097. package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
  1098. package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +236 -0
  1099. package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +398 -0
  1100. package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
  1101. package/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
  1102. package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +418 -0
  1103. package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
  1104. package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1782 -0
  1105. package/skills/a2h-page-specgen/scripts/test/render.test.mjs +546 -0
  1106. package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
  1107. package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
  1108. package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
  1109. package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
  1110. package/skills/a2h-page-specgen/scripts/test/source-text.test.mjs +181 -0
  1111. package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +1231 -0
  1112. package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
  1113. package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
  1114. package/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
  1115. package/skills/a2h-page-specgen/scripts/test/waker-event-store.test.mjs +1365 -0
  1116. package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1801 -0
  1117. package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +1993 -0
  1118. package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +342 -0
  1119. package/skills/a2h-page-specgen/scripts/waker.mjs +1301 -0
  1120. package/skills/a2h-page-specgen/scripts/watchdog.mjs +299 -0
  1121. package/skills/a2h-resource-convert/SKILL.md +9 -1
  1122. package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
  1123. package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
  1124. package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
  1125. package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
  1126. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +115 -53
  1127. package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
  1128. package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
  1129. package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
  1130. package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
  1131. package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
  1132. package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
  1133. package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
  1134. package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
  1135. package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
  1136. package/skills/a2h-resource-convert/scripts/tests/code_vector_guard.test.mjs +75 -0
  1137. package/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
  1138. package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
  1139. package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
  1140. package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
  1141. package/skills/a2h-spec-design-pipeline/SKILL.md +98 -121
  1142. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +170 -45
  1143. package/skills/a2h-spec-design-pipeline/references/execution-model.md +62 -12
  1144. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -4
  1145. package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
  1146. package/skills/a2h-spec-design-pipeline/references/initialization.md +49 -6
  1147. package/skills/a2h-spec-design-pipeline/references/merge-queue.md +198 -54
  1148. package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
  1149. package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
  1150. package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +67 -0
  1151. package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
  1152. package/skills/a2h-spec-design-pipeline/references/scripts.md +47 -14
  1153. package/skills/a2h-spec-design-pipeline/references/shared-layer.md +390 -0
  1154. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +148 -29
  1155. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +104 -24
  1156. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +18 -0
  1157. package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +16 -0
  1158. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
  1159. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
  1160. package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
  1161. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
  1162. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
  1163. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
  1164. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
  1165. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
  1166. package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
  1167. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
  1168. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
  1169. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
  1170. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/platform/ExtraDataSubCheck.js +485 -0
  1171. package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +13 -0
  1172. package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +18 -0
  1173. package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +12 -38
  1174. package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
  1175. package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
  1176. package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
  1177. package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +95 -7
  1178. package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +156 -7
  1179. package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +71 -0
  1180. package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +22 -3
  1181. package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
  1182. package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +33 -3
  1183. package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +2 -2
  1184. package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +232 -13
  1185. package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
  1186. package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
  1187. package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +220 -44
  1188. package/skills/a2h-spec-design-pipeline/scripts/lib/shared_classes.ts +113 -0
  1189. package/skills/a2h-spec-design-pipeline/scripts/lib/shared_docs.ts +202 -0
  1190. package/skills/a2h-spec-design-pipeline/scripts/lib/wiring.ts +58 -0
  1191. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +178 -14
  1192. package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +3 -0
  1193. package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +368 -0
  1194. package/skills/a2h-spec-design-pipeline/scripts/scan_shared.ts +642 -0
  1195. package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
  1196. package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
  1197. package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
  1198. package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
  1199. package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
  1200. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +42 -8
  1201. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +27 -9
  1202. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +242 -9
  1203. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +192 -7
  1204. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +531 -0
  1205. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +49 -1
  1206. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
  1207. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +51 -0
  1208. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
  1209. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
  1210. package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +17 -10
  1211. package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
  1212. package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
  1213. package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
  1214. package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
  1215. package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +14 -0
  1216. package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +401 -0
  1217. package/skills/a2h-spec-design-pipeline/scripts/test_scan_shared.ts +996 -0
  1218. package/skills/a2h-spec-design-pipeline/scripts/test_shared_classes.ts +80 -0
  1219. package/skills/a2h-spec-design-pipeline/scripts/test_shared_docs.ts +205 -0
  1220. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +165 -0
  1221. package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_e2e.ts +85 -0
  1222. package/skills/a2h-spec-design-pipeline/scripts/test_validate_shared_manifest.ts +720 -0
  1223. package/skills/a2h-spec-design-pipeline/scripts/test_wiring.ts +40 -0
  1224. package/skills/a2h-spec-design-pipeline/scripts/validate_shared_manifest.ts +566 -0
  1225. package/skills/a2h-spec-generate/SKILL.md +89 -23
  1226. package/skills/a2h-spec-generate/references/batch-mode.md +78 -17
  1227. package/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
  1228. package/skills/a2h-spec-generate/references/fusion-task-contract.md +7 -0
  1229. package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  1230. package/skills/a2h-spec-generate/references/specs.schema.json +24 -11
  1231. package/skills/a2h-spec-generate/references/synthesis-rules.md +4 -2
  1232. package/skills/a2h-spec-generate/references/worker-rules.md +6 -3
  1233. package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +4 -5
  1234. package/skills/a2h-spec-generate/scripts/check_spec.ts +145 -14
  1235. package/skills/a2h-spec-generate/scripts/collect-specs.mjs +261 -19
  1236. package/skills/a2h-spec-generate/scripts/dispatch-watch.mjs +1168 -0
  1237. package/skills/a2h-spec-generate/scripts/ensure-index.mjs +1 -2
  1238. package/skills/a2h-spec-generate/scripts/feature-stem.mjs +1 -2
  1239. package/skills/a2h-spec-generate/scripts/publish-specs.mjs +1 -2
  1240. package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +1 -2
  1241. package/skills/a2h-spec-generate/scripts/render-tasks.mjs +25 -46
  1242. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +26 -27
  1243. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +3 -6
  1244. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +31 -32
  1245. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +2 -3
  1246. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +15 -26
  1247. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +102 -81
  1248. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +39 -19
  1249. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +12 -13
  1250. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
  1251. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +35 -196
  1252. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +3 -1
  1253. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +22 -96
  1254. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +3 -4
  1255. package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +1 -1
  1256. package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +74 -7
  1257. package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +51 -7
  1258. package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +42 -111
  1259. package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +1 -20
  1260. package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1 -2
  1261. package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +3 -4
  1262. package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
  1263. package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
  1264. package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
  1265. package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
  1266. package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/zip.ts +63 -0
  1267. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +650 -0
  1268. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
  1269. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
  1270. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
  1271. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-seed.test.ts +195 -0
  1272. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
  1273. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +347 -0
  1274. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1948 -0
  1275. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-library-evidence.test.ts +239 -0
  1276. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +277 -0
  1277. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +844 -0
  1278. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
  1279. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
  1280. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
  1281. package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
  1282. package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
  1283. package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
  1284. package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
  1285. package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
  1286. package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
  1287. package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
  1288. package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
  1289. package/skills/a2h-spec-generate/scripts/reqgen/test/zip.test.ts +61 -0
  1290. package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +879 -0
  1291. package/skills/a2h-spec-generate/test/check-spec.test.ts +430 -0
  1292. package/skills/a2h-spec-generate/test/collect-specs.test.mjs +811 -0
  1293. package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
  1294. package/skills/a2h-spec-generate/test/dispatch-watch.test.mjs +606 -0
  1295. package/skills/a2h-spec-generate/test/ensure-index.test.mjs +229 -0
  1296. package/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
  1297. package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
  1298. package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
  1299. package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
  1300. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
  1301. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
  1302. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
  1303. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
  1304. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
  1305. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
  1306. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
  1307. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
  1308. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
  1309. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
  1310. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
  1311. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
  1312. package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
  1313. package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
  1314. package/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
  1315. package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +182 -0
  1316. package/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
  1317. package/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
  1318. package/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
  1319. package/skills/a2h-spec-generate/test/report.test.mjs +47 -0
  1320. package/skills/a2h-utg-explorer/SKILL.md +9 -3
  1321. package/skills/a2h-utg-explorer/references/architecture.md +7 -0
  1322. package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
  1323. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +120 -85
  1324. package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
  1325. package/skills/a2h-utg-explorer/scripts/hint_check.mjs +1 -2
  1326. package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
  1327. package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
  1328. package/skills/a2h-utg-explorer/scripts/recover.mjs +1 -1
  1329. package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
  1330. package/skills/a2h-utg-explorer/scripts/rejudge.mjs +5 -3
  1331. package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
  1332. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
  1333. package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
  1334. package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
  1335. package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
  1336. package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -0
  1337. package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +244 -0
  1338. package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
  1339. package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
  1340. package/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
  1341. package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
  1342. package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +231 -0
  1343. package/skills/a2h-utg-explorer/scripts/tests/default_override.test.mjs +109 -0
  1344. package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +160 -0
  1345. package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -0
  1346. package/skills/a2h-utg-explorer/scripts/tests/device_locale_identity.test.mjs +77 -0
  1347. package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
  1348. package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +254 -0
  1349. package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
  1350. package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +137 -0
  1351. package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
  1352. package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
  1353. package/skills/a2h-utg-explorer/scripts/tests/foreground_spelling.test.mjs +155 -0
  1354. package/skills/a2h-utg-explorer/scripts/tests/fresh_state_plan.test.mjs +78 -0
  1355. package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
  1356. package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
  1357. package/skills/a2h-utg-explorer/scripts/tests/holds_without_data_parity.test.mjs +26 -0
  1358. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +120 -0
  1359. package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
  1360. package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +614 -0
  1361. package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +214 -0
  1362. package/skills/a2h-utg-explorer/scripts/tests/launch_failure.test.mjs +40 -0
  1363. package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
  1364. package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
  1365. package/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
  1366. package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
  1367. package/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
  1368. package/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
  1369. package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
  1370. package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +218 -0
  1371. package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -0
  1372. package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
  1373. package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
  1374. package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
  1375. package/skills/a2h-utg-explorer/scripts/tests/recover_d_grounding.test.mjs +164 -0
  1376. package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -0
  1377. package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
  1378. package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
  1379. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +458 -0
  1380. package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -0
  1381. package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
  1382. package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
  1383. package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +336 -0
  1384. package/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
  1385. package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
  1386. package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +142 -0
  1387. package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
  1388. package/skills/a2h-utg-explorer/scripts/tests/string_tables_twin_ties.test.mjs +83 -0
  1389. package/skills/a2h-utg-explorer/scripts/tests/tar_fixture.mjs +12 -0
  1390. package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
  1391. package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
  1392. package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
  1393. package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
  1394. package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
  1395. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +135 -7
  1396. package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
  1397. package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
  1398. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +245 -69
  1399. package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
  1400. package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +164 -0
  1401. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
  1402. package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
  1403. package/skills/a2h-utg-static/SKILL.md +6 -2
  1404. package/skills/a2h-utg-static/scripts/assemble.mjs +93 -3
  1405. package/skills/a2h-utg-static/scripts/click_paths.mjs +135 -25
  1406. package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
  1407. package/skills/a2h-utg-static/scripts/compose_overlay.mjs +110 -3
  1408. package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
  1409. package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
  1410. package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
  1411. package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
  1412. package/skills/a2h-utg-static/scripts/fragment_nav.mjs +2 -3
  1413. package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
  1414. package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
  1415. package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
  1416. package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
  1417. package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
  1418. package/skills/a2h-utg-static/scripts/nl_hints.mjs +34 -7
  1419. package/skills/a2h-utg-static/scripts/presenter_nav.mjs +1 -2
  1420. package/skills/a2h-utg-static/scripts/route_interceptor.mjs +21 -7
  1421. package/skills/a2h-utg-static/scripts/run_pipeline.mjs +86 -4
  1422. package/skills/a2h-utg-static/scripts/static_prior.mjs +26 -29
  1423. package/skills/a2h-utg-static/scripts/tests/test_activity_gates.mjs +84 -0
  1424. package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +30 -0
  1425. package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
  1426. package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
  1427. package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
  1428. package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
  1429. package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
  1430. package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
  1431. package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
  1432. package/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +38 -0
  1433. package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
  1434. package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
  1435. package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
  1436. package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
  1437. package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
  1438. package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +29 -1
  1439. package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
  1440. package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
  1441. package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
  1442. package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
  1443. package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
  1444. package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
  1445. package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -1
  1446. package/README.md +0 -439
  1447. package/dist/cli/config-store.js +0 -128
  1448. package/dist/cli/config.js +0 -48
  1449. package/dist/cli/editors.json +0 -114
  1450. package/dist/cli/env-vars.js +0 -127
  1451. package/dist/cli/index.js +0 -73
  1452. package/dist/cli/init.js +0 -2513
  1453. package/dist/cli/uninstall.js +0 -406
  1454. package/dist/platform/compose.js +0 -228
  1455. package/dist/platform/frontmatter.js +0 -151
  1456. package/dist/platform/installer.js +0 -417
  1457. package/dist/platform/registry.js +0 -337
  1458. package/dist/platform/transform.js +0 -363
  1459. package/dist/platform/types.js +0 -9
  1460. package/dist/platform/validate.js +0 -152
  1461. package/dist/utils/regex.js +0 -7
  1462. package/env-requirements.json +0 -511
  1463. package/resource/choose_editor.png +0 -0
  1464. package/resource/convert_pipeline_process.svg +0 -114
  1465. package/resource/project_architecture.svg +0 -120
  1466. package/resource/set_environment.png +0 -0
  1467. package/resource/set_multimodel.png +0 -0
  1468. package/resource/set_sdk.png +0 -0
  1469. package/resource/title_dark.png +0 -0
  1470. package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +0 -5
  1471. package/skills/a2h-app-migrate/scripts/i18n-term.mjs +0 -54
  1472. package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +0 -5
  1473. package/skills/a2h-arch-generate/scripts/i18n-term.mjs +0 -54
  1474. package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +0 -5
  1475. package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +0 -54
  1476. package/skills/a2h-batch-ui-align/references/source-only-tier.md +0 -38
  1477. package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +0 -5
  1478. package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +0 -54
  1479. package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +0 -5
  1480. package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +0 -54
  1481. package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +0 -5
  1482. package/skills/a2h-resource-convert/scripts/i18n-term.mjs +0 -54
  1483. package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +0 -885
  1484. package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +0 -5
  1485. package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +0 -54
  1486. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +0 -856
  1487. package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +0 -70
  1488. package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +0 -5
  1489. package/skills/a2h-spec-generate/scripts/i18n-term.mjs +0 -54
  1490. package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +0 -5
  1491. package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +0 -54
  1492. package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +0 -5
  1493. package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +0 -54
  1494. package/skills/a2h-utg-static/scripts/i18n-term.d.mts +0 -5
  1495. package/skills/a2h-utg-static/scripts/i18n-term.mjs +0 -54
  1496. package/skills/a2h-utg-static/scripts/tests/test_i18n_term.mjs +0 -155
@@ -0,0 +1,2005 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Android emulator page traversal tool (fast version, TypeScript edition)
4
+ * Features: BFS-traverses every page, saves screenshot, View XML, Activity/Window info, and generates index.json + report.html.
5
+ *
6
+ * Zero third-party dependencies, only Node built-in modules; can be distributed standalone.
7
+ * Equivalent to the original android_parse_fast.py (functional equivalence).
8
+ *
9
+ * Usage:
10
+ * node android_parse_fast.ts --package <pkg> --output <dir> [--device serial] [--adb-path adb]
11
+ * [--max-pages 500] [--max-scrolls 10] [--manual] [--page "<description>"]
12
+ */
13
+
14
+ import { spawnSync, type SpawnSyncReturns } from 'node:child_process';
15
+ import * as fs from 'node:fs';
16
+ import * as path from 'node:path';
17
+ import * as readline from 'node:readline';
18
+ import { createHash } from 'node:crypto';
19
+ import { pathToFileURL } from 'node:url';
20
+
21
+ // ─────────────────────────────────────────────
22
+ // Default configuration values
23
+ // ─────────────────────────────────────────────
24
+ const ADB_PATH_DEFAULT = process.env.ADB_PATH || 'adb';
25
+ // Unset = no -s: adb picks by ANDROID_SERIAL / the only online device. Hard-coding emulator-5554 makes capture fail on real devices or
26
+ // emulators on other ports (the first screen cannot be fetched; the whole run yields 0 pages).
27
+ const DEVICE_SERIAL_DEFAULT = '';
28
+ const IDLE_POLL_INTERVAL_DEFAULT = 0.2;
29
+ const IDLE_TIMEOUT_DEFAULT = 5;
30
+ const MAX_PAGES_DEFAULT = 500;
31
+ const MAX_SCROLLS_DEFAULT = 10;
32
+ const SCROLL_DURATION_MS_DEFAULT = 300;
33
+ const SKIP_RESOURCE_ID_PATTERNS_DEFAULT = [
34
+ 'statusBarBackground',
35
+ 'navigationBarBackground',
36
+ 'action_bar_container',
37
+ 'status_bar',
38
+ 'navigation_bar',
39
+ ];
40
+ const HORIZONTAL_SCROLL_CLASSES = new Set(['android.widget.HorizontalScrollView']);
41
+
42
+ function sleep(seconds: number): void {
43
+ const end = Date.now() + seconds * 1000;
44
+ const ia = new Int32Array(new SharedArrayBuffer(4));
45
+ while (Date.now() < end) Atomics.wait(ia, 0, 0, Math.min(50, end - Date.now()));
46
+ }
47
+
48
+ // ─────────────────────────────────────────────
49
+ // Minimal XML parser (equivalent to xml.etree root.iter("node") + get attribute)
50
+ // ─────────────────────────────────────────────
51
+ interface XmlNode {
52
+ tag: string;
53
+ attrs: Record<string, string>;
54
+ children: XmlNode[];
55
+ }
56
+
57
+ const XML_ENTITIES: Record<string, string> = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'" };
58
+
59
+ function decodeEntities(s: string): string {
60
+ return s.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g, (m, ent: string) => {
61
+ if (ent[0] === '#') {
62
+ const code = ent[1] === 'x' || ent[1] === 'X' ? parseInt(ent.slice(2), 16) : parseInt(ent.slice(1), 10);
63
+ return Number.isNaN(code) ? m : String.fromCodePoint(code);
64
+ }
65
+ return ent in XML_ENTITIES ? XML_ENTITIES[ent] : m;
66
+ });
67
+ }
68
+
69
+ class XmlParseError extends Error {}
70
+
71
+ function parseXml(xml: string): XmlNode {
72
+ let i = 0;
73
+ const n = xml.length;
74
+ const stack: XmlNode[] = [];
75
+ let root: XmlNode | null = null;
76
+
77
+ const readAttrs = (raw: string): Record<string, string> => {
78
+ const attrs: Record<string, string> = {};
79
+ const re = /([^\s=/>]+)\s*=\s*"([^"]*)"|([^\s=/>]+)\s*=\s*'([^']*)'/g;
80
+ let m: RegExpExecArray | null;
81
+ while ((m = re.exec(raw)) !== null) {
82
+ if (m[1] !== undefined) attrs[m[1]] = decodeEntities(m[2]);
83
+ else if (m[3] !== undefined) attrs[m[3]] = decodeEntities(m[4]);
84
+ }
85
+ return attrs;
86
+ };
87
+
88
+ while (i < n) {
89
+ const lt = xml.indexOf('<', i);
90
+ if (lt < 0) break;
91
+ i = lt;
92
+ if (xml.startsWith('<?', i)) {
93
+ const end = xml.indexOf('?>', i);
94
+ if (end < 0) throw new XmlParseError('unterminated declaration');
95
+ i = end + 2;
96
+ continue;
97
+ }
98
+ if (xml.startsWith('<!--', i)) {
99
+ const end = xml.indexOf('-->', i);
100
+ if (end < 0) throw new XmlParseError('unterminated comment');
101
+ i = end + 3;
102
+ continue;
103
+ }
104
+ if (xml.startsWith('<!', i)) {
105
+ const end = xml.indexOf('>', i);
106
+ if (end < 0) throw new XmlParseError('unterminated markup declaration');
107
+ i = end + 1;
108
+ continue;
109
+ }
110
+ let j = i + 1;
111
+ let quote: string | null = null;
112
+ for (; j < n; j++) {
113
+ const c = xml[j];
114
+ if (quote) {
115
+ if (c === quote) quote = null;
116
+ } else if (c === '"' || c === "'") quote = c;
117
+ else if (c === '>') break;
118
+ }
119
+ if (j >= n) throw new XmlParseError('unterminated tag');
120
+ const inner = xml.slice(i + 1, j);
121
+ i = j + 1;
122
+ if (inner[0] === '/') {
123
+ if (!stack.pop()) throw new XmlParseError('unexpected closing tag');
124
+ continue;
125
+ }
126
+ const selfClosing = inner.endsWith('/');
127
+ const body = selfClosing ? inner.slice(0, -1) : inner;
128
+ const spaceIdx = body.search(/[\s/]/);
129
+ const tag = spaceIdx < 0 ? body : body.slice(0, spaceIdx);
130
+ const attrRaw = spaceIdx < 0 ? '' : body.slice(spaceIdx);
131
+ const node: XmlNode = { tag, attrs: readAttrs(attrRaw), children: [] };
132
+ if (stack.length > 0) stack[stack.length - 1].children.push(node);
133
+ else if (root === null) root = node;
134
+ if (!selfClosing) stack.push(node);
135
+ }
136
+ if (root === null) throw new XmlParseError('no root element');
137
+ return root;
138
+ }
139
+
140
+ function* iterNodes(root: XmlNode, tag: string): Generator<XmlNode> {
141
+ if (root.tag === tag) yield root;
142
+ for (const child of root.children) yield* iterNodes(child, tag);
143
+ }
144
+
145
+ function attr(node: XmlNode, key: string, dflt = ''): string {
146
+ return key in node.attrs ? node.attrs[key] : dflt;
147
+ }
148
+
149
+ function extractInts(s: string): number[] {
150
+ const m = s.match(/\d+/g);
151
+ return m ? m.map((x) => parseInt(x, 10)) : [];
152
+ }
153
+
154
+ // ─────────────────────────────────────────────
155
+ // Element/signature pure functions (equivalent to PageCrawler @staticmethod)
156
+ // ─────────────────────────────────────────────
157
+ interface ClickableElement {
158
+ class: string;
159
+ text: string;
160
+ 'resource-id': string;
161
+ 'content-desc': string;
162
+ bounds: string;
163
+ center: [number, number] | null;
164
+ 'long-clickable': boolean;
165
+ scroll_index?: number;
166
+ }
167
+
168
+ interface ScrollContainer {
169
+ bounds: [number, number, number, number];
170
+ class: string;
171
+ 'resource-id': string;
172
+ }
173
+
174
+ function parseBoundsCenter(bounds: string): [number, number] | null {
175
+ const nums = extractInts(bounds);
176
+ if (nums.length === 4) {
177
+ const [x1, y1, x2, y2] = nums;
178
+ return [Math.trunc((x1 + x2) / 2), Math.trunc((y1 + y2) / 2)];
179
+ }
180
+ return null;
181
+ }
182
+
183
+ function getClickableElements(xmlContent: string): ClickableElement[] {
184
+ const elements: ClickableElement[] = [];
185
+ if (!xmlContent) return elements;
186
+ let root: XmlNode;
187
+ try {
188
+ root = parseXml(xmlContent);
189
+ } catch (e) {
190
+ console.log(` [WARN] XML parse failed: ${(e as Error).message}`);
191
+ return elements;
192
+ }
193
+
194
+ const listviewChildSet = new Set<XmlNode>();
195
+ for (const node of iterNodes(root, 'node')) {
196
+ const cls = attr(node, 'class');
197
+ if (cls.includes('ListView') || cls.includes('GridView')) {
198
+ for (const child of node.children) listviewChildSet.add(child);
199
+ }
200
+ }
201
+
202
+ const extractText = (node: XmlNode): string => {
203
+ const t = attr(node, 'text');
204
+ if (t) return t;
205
+ for (const child of iterNodes(node, 'node')) {
206
+ const ct = attr(child, 'text');
207
+ if (ct) return ct;
208
+ }
209
+ return '';
210
+ };
211
+
212
+ for (const node of iterNodes(root, 'node')) {
213
+ if (attr(node, 'enabled') !== 'true') continue;
214
+ const isClickable = attr(node, 'clickable') === 'true';
215
+ const isLongClickable = attr(node, 'long-clickable') === 'true';
216
+ const isListviewItem = listviewChildSet.has(node);
217
+ const isCheckable = attr(node, 'checkable') === 'true';
218
+ if (!(isClickable || isLongClickable || isListviewItem || isCheckable)) continue;
219
+ const bounds = attr(node, 'bounds');
220
+ let text = attr(node, 'text');
221
+ if (!text) text = extractText(node);
222
+ const baseInfo = {
223
+ class: attr(node, 'class'),
224
+ text,
225
+ 'resource-id': attr(node, 'resource-id'),
226
+ 'content-desc': attr(node, 'content-desc'),
227
+ bounds,
228
+ center: parseBoundsCenter(bounds),
229
+ };
230
+ if (isClickable || isListviewItem || isCheckable) elements.push({ ...baseInfo, 'long-clickable': false });
231
+ if (isLongClickable) elements.push({ ...baseInfo, 'long-clickable': true });
232
+ }
233
+ return elements;
234
+ }
235
+
236
+ function extractNodeKeys(xmlContent: string): Set<string> {
237
+ const keys = new Set<string>();
238
+ if (!xmlContent) return keys;
239
+ let root: XmlNode;
240
+ try {
241
+ root = parseXml(xmlContent);
242
+ } catch {
243
+ return keys;
244
+ }
245
+ for (const node of iterNodes(root, 'node')) {
246
+ keys.add(
247
+ [attr(node, 'class'), attr(node, 'resource-id'), attr(node, 'text'), attr(node, 'content-desc'), attr(node, 'bounds')].join(''),
248
+ );
249
+ }
250
+ return keys;
251
+ }
252
+
253
+ function setsEqual(a: Set<string>, b: Set<string>): boolean {
254
+ if (a.size !== b.size) return false;
255
+ for (const v of a) if (!b.has(v)) return false;
256
+ return true;
257
+ }
258
+
259
+ function findScrollableContainers(xmlContent: string): ScrollContainer[] {
260
+ const containers: ScrollContainer[] = [];
261
+ if (!xmlContent) return containers;
262
+ let root: XmlNode;
263
+ try {
264
+ root = parseXml(xmlContent);
265
+ } catch {
266
+ return containers;
267
+ }
268
+ for (const node of iterNodes(root, 'node')) {
269
+ if (attr(node, 'scrollable') !== 'true') continue;
270
+ const cls = attr(node, 'class');
271
+ if (HORIZONTAL_SCROLL_CLASSES.has(cls)) continue;
272
+ const nums = extractInts(attr(node, 'bounds'));
273
+ if (nums.length !== 4) continue;
274
+ const [x1, y1, x2, y2] = nums;
275
+ if (y2 - y1 < 200) continue;
276
+ containers.push({ bounds: [x1, y1, x2, y2], class: cls, 'resource-id': attr(node, 'resource-id') });
277
+ }
278
+ containers.sort(
279
+ (a, b) => (b.bounds[2] - b.bounds[0]) * (b.bounds[3] - b.bounds[1]) - (a.bounds[2] - a.bounds[0]) * (a.bounds[3] - a.bounds[1]),
280
+ );
281
+ return containers;
282
+ }
283
+
284
+ function normalizeComponent(component: string): string {
285
+ if (!component.includes('/')) return component;
286
+ const idx = component.indexOf('/');
287
+ const pkg = component.slice(0, idx);
288
+ let cls = component.slice(idx + 1);
289
+ if (cls.startsWith('.')) cls = pkg + cls;
290
+ return `${pkg}/${cls}`;
291
+ }
292
+
293
+ function stableActivityKey(activityInfo: Record<string, string>): string {
294
+ const focus = activityInfo['current_focus'] ?? '';
295
+ const resumed = activityInfo['resumed_activity'] ?? '';
296
+ const m = focus.match(/[\w.]+\/[\w.]+/);
297
+ if (m) return normalizeComponent(m[0]);
298
+ const actM = resumed.match(/[\w.]+\/[\w.]+/);
299
+ const actPart = actM ? normalizeComponent(actM[0]) : 'unknown';
300
+ const winTypeM = focus.match(/(PopupWindow|Dialog|DecorView|Toast)/);
301
+ const winType = winTypeM ? winTypeM[1] : 'overlay';
302
+ return `${actPart}|${winType}`;
303
+ }
304
+
305
+ function pageSignature(activityInfo: Record<string, string>, xmlContent: string): string {
306
+ const actKey = stableActivityKey(activityInfo);
307
+ if (!xmlContent) return `${actKey}|empty`;
308
+ const clickable = getClickableElements(xmlContent);
309
+ if (clickable.length === 0) return `${actKey}|no_clickable`;
310
+ const elemFeatures = clickable.map((e) =>
311
+ [e.class ?? '', e['resource-id'] ?? '', e['content-desc'] ?? '', e.bounds ?? ''].join('|'),
312
+ );
313
+ const featuresStr = elemFeatures.join(';');
314
+ const featureHash = createHash('md5').update(featuresStr, 'utf-8').digest('hex').slice(0, 16);
315
+ return `${actKey}|${featureHash}`;
316
+ }
317
+
318
+ type RootIdentity = [string, Set<string>];
319
+
320
+ function rootIdentifiedSet(activityInfo: Record<string, string>, xmlContent: string): RootIdentity {
321
+ const resumed = activityInfo['resumed_activity'] ?? '';
322
+ const m = resumed.match(/[\w.]+\/[\w.]+/);
323
+ const actKey = m ? normalizeComponent(m[0]) : 'unknown';
324
+ if (!xmlContent) return [actKey, new Set()];
325
+ const clickable = getClickableElements(xmlContent);
326
+ const elems = new Set<string>();
327
+ for (const e of clickable) {
328
+ const desc = e['content-desc'] ?? '';
329
+ const rid = e['resource-id'] ?? '';
330
+ if (!desc && !rid) continue;
331
+ elems.add([e.class ?? '', rid, desc].join(''));
332
+ }
333
+ return [actKey, elems];
334
+ }
335
+
336
+ function isSameRootPage(rootInfo: RootIdentity, currentInfo: RootIdentity, threshold = 0.6): boolean {
337
+ const [rootAct, rootElems] = rootInfo;
338
+ const [curAct, curElems] = currentInfo;
339
+ if (rootAct !== curAct) return false;
340
+ if (rootElems.size === 0 && curElems.size === 0) return true;
341
+ if (rootElems.size === 0 || curElems.size === 0) return false;
342
+ let inter = 0;
343
+ for (const v of rootElems) if (curElems.has(v)) inter++;
344
+ const union = rootElems.size + curElems.size - inter;
345
+ return union > 0 && inter / union >= threshold;
346
+ }
347
+
348
+ /** Whether current_focus contains a `package/activity` component (dialog/overlay focus does not). */
349
+ function focusHasActivityComponent(activityInfo: Record<string, string>): boolean {
350
+ return /[\w.]+\/[\w.]+/.test(activityInfo['current_focus'] ?? '');
351
+ }
352
+
353
+ /**
354
+ * Take the short name of the "root page Activity" from the already-captured first-screen activity_info; restartToRoot uses it to decide whether it is back on the root page.
355
+ *
356
+ * Must use the **actually landed first screen**, not the launch component: the entry may be a trampoline
357
+ * (com.ichi2.anki/.IntentHandler) while the landing page is DeckPicker; using the entry short name as the keyword would never match the root page.
358
+ */
359
+ function rootKeywordFromActivityInfo(activityInfo: Record<string, string> | undefined): string | null {
360
+ for (const key of ['resumed_activity', 'current_focus', 'focused_app']) {
361
+ const s = activityInfo?.[key] ?? '';
362
+ const m = s.match(/[\w.]+\/[\w.$]+/);
363
+ if (!m) continue;
364
+ const comp = normalizeComponent(m[0]);
365
+ const act = comp.split('/')[1] ?? '';
366
+ const parts = act.split('.');
367
+ const short = parts[parts.length - 1];
368
+ if (short) return short;
369
+ }
370
+ return null;
371
+ }
372
+
373
+ /**
374
+ * Extract the launch component [package, activity] from activity info.
375
+ * Prefer current_focus (usually a fully qualified Activity), fall back to resumed_activity (may be a relative name `.ui.Main`,
376
+ * which am start also accepts). Returns null if neither is available.
377
+ */
378
+ function extractLaunchComponent(activityInfo: Record<string, string>): [string, string] | null {
379
+ for (const key of ['current_focus', 'resumed_activity']) {
380
+ const s = activityInfo[key] ?? '';
381
+ const m = s.match(/([\w.]+)\/([\w.]+)/);
382
+ if (m) return [m[1], m[2]];
383
+ }
384
+ return null;
385
+ }
386
+
387
+ type ElemId = [string, string, string, string, boolean];
388
+
389
+ function findElementOnScreen(xmlContent: string, elemId: ElemId | [string, string, string, string]): ClickableElement | null {
390
+ const rid = elemId[0];
391
+ const text = elemId[1];
392
+ const desc = elemId[2];
393
+ const bounds = elemId[3];
394
+ const isLong = elemId.length >= 5 ? (elemId[4] as boolean) : null;
395
+ const clickableElements = getClickableElements(xmlContent);
396
+
397
+ if (bounds) {
398
+ for (const e of clickableElements) {
399
+ if (
400
+ e['resource-id'] === rid &&
401
+ e.text === text &&
402
+ e['content-desc'] === desc &&
403
+ e.bounds === bounds &&
404
+ (isLong === null || e['long-clickable'] === isLong)
405
+ ) {
406
+ return e;
407
+ }
408
+ }
409
+ }
410
+ for (const e of clickableElements) {
411
+ if (
412
+ e['resource-id'] === rid &&
413
+ e.text === text &&
414
+ e['content-desc'] === desc &&
415
+ (isLong === null || e['long-clickable'] === isLong)
416
+ ) {
417
+ return e;
418
+ }
419
+ }
420
+ return null;
421
+ }
422
+
423
+ // ─────────────────────────────────────────────
424
+ // Device constants: density and physical resolution
425
+ // ─────────────────────────────────────────────
426
+ /**
427
+ * Capture device density and resolution -- written into each page's meta.json `device_info` field.
428
+ *
429
+ * Why it must be recorded at capture time: density is a constant "identical on every page of the same device", while downstream measure_pack
430
+ * can only **back-solve** it from the side length of square nodes in the view tree. Back-solving is mathematically non-unique -- 72px can be
431
+ * 24dp@3.0, or 36dp@2.0 / 48dp@1.5; the whole harmonic family is self-consistent; pages with a single toolbar icon size
432
+ * are guaranteed ties. Once solved wrong, all vp values on that page are off by 2-3x, yet compilation, reference checks and cross-page consistency
433
+ * all still pass (since every page is wrong the same way). `wm density` gives the true value in one line; not recording it at capture time = discarding it.
434
+ */
435
+ interface DeviceInfo {
436
+ /** Effective dpi (override takes precedence). null if unavailable. */
437
+ dpi: number | null;
438
+ /** dpi / 160, i.e. the px->vp conversion factor on the ArkUI side. null if unavailable. */
439
+ density: number | null;
440
+ /** Which source the density came from, for review. */
441
+ density_source: 'wm density (override)' | 'wm density (physical)' | 'unavailable';
442
+ width_px: number | null;
443
+ height_px: number | null;
444
+ /** Raw output for manual checking (the two lines differ on devices changed via `wm density`). */
445
+ raw: { wm_density: string; wm_size: string };
446
+ }
447
+
448
+ // ─────────────────────────────────────────────
449
+ // ADBHelper: wraps all ADB device communication and interaction
450
+ // ─────────────────────────────────────────────
451
+ class ADBHelper {
452
+ adbPath: string;
453
+ deviceSerial: string | null;
454
+ idlePollInterval: number;
455
+ idleTimeout: number;
456
+ scrollDurationMs: number;
457
+ /** Target app package name; on multi-display devices (car head units etc.) used to pick the right line among multiple focus/resumed lines. */
458
+ targetPackage: string | null;
459
+ /** Cached physical display id for screencap -d; undefined = not resolved, null = resolution failed (fall back to no -d). */
460
+ private cachedPhysicalDisplayId: string | null | undefined = undefined;
461
+ /** Device density/resolution cache; queried only once per traversal (density does not change mid-run). */
462
+ private cachedDeviceInfo: DeviceInfo | undefined = undefined;
463
+
464
+ constructor(opts: {
465
+ adbPath?: string;
466
+ deviceSerial?: string | null;
467
+ idlePollInterval?: number;
468
+ idleTimeout?: number;
469
+ scrollDurationMs?: number;
470
+ targetPackage?: string | null;
471
+ } = {}) {
472
+ this.adbPath = opts.adbPath ?? ADB_PATH_DEFAULT;
473
+ this.deviceSerial = opts.deviceSerial ?? DEVICE_SERIAL_DEFAULT;
474
+ this.targetPackage = opts.targetPackage ?? null;
475
+ this.idlePollInterval = opts.idlePollInterval ?? IDLE_POLL_INTERVAL_DEFAULT;
476
+ this.idleTimeout = opts.idleTimeout ?? IDLE_TIMEOUT_DEFAULT;
477
+ this.scrollDurationMs = opts.scrollDurationMs ?? SCROLL_DURATION_MS_DEFAULT;
478
+ }
479
+
480
+ private buildArgs(args: string[]): string[] {
481
+ const full: string[] = [];
482
+ if (this.deviceSerial) full.push('-s', this.deviceSerial);
483
+ full.push(...args);
484
+ return full;
485
+ }
486
+
487
+ private spawn(args: string[], timeout: number, binary: boolean): SpawnSyncReturns<Buffer> {
488
+ return spawnSync(this.adbPath, this.buildArgs(args), {
489
+ timeout: timeout * 1000,
490
+ maxBuffer: 128 * 1024 * 1024,
491
+ windowsHide: true,
492
+ }) as SpawnSyncReturns<Buffer>;
493
+ }
494
+
495
+ run(args: string[], timeout = 15): string {
496
+ const res = this.spawn(args, timeout, false);
497
+ if (res.error) {
498
+ const code = (res.error as NodeJS.ErrnoException).code;
499
+ if (code === 'ETIMEDOUT') {
500
+ console.log(` [WARN] adb command timed out: ${args.join(' ')}`);
501
+ return '';
502
+ }
503
+ if (code === 'ENOENT') {
504
+ throw new Error('adb not found; make sure it is installed and on PATH, or set ADB_PATH');
505
+ }
506
+ }
507
+ const out = res.stdout ?? Buffer.alloc(0);
508
+ // When adb subcommands like `am start` fail, the reason goes to stderr (e.g. SecurityException:
509
+ // Permission Denial -- target Activity not exported). Reading only stdout drops the whole reason,
510
+ // and the upper layer only sees a misleading "did not reach target page" conclusion.
511
+ const err = (res.stderr ?? Buffer.alloc(0)).toString('utf-8').trim();
512
+ if (err && res.status !== 0) {
513
+ console.log(` [ADB-ERR] ${args.join(' ')}`);
514
+ for (const line of err.split(/\r?\n/).slice(0, 4)) console.log(` ${line}`);
515
+ }
516
+ return out.toString('utf-8').trim();
517
+ }
518
+
519
+ /**
520
+ * Ask the system for the target package's actually launchable launcher entry component.
521
+ *
522
+ * Cannot substitute "the Activity of the current foreground window": in many apps the first-screen Activity is
523
+ * `exported="false"` (AnkiDroid's DeckPicker is one); the real entry is an
524
+ * exported trampoline (IntentHandler). Running `am start -n` with the first-screen Activity
525
+ * is rejected by the system with SecurityException, and the app never starts.
526
+ *
527
+ * @returns e.g. "com.ichi2.anki/.IntentHandler"; null if parsing fails
528
+ */
529
+ resolveLauncherActivity(pkg: string): string | null {
530
+ const out = this.shell(['cmd', 'package', 'resolve-activity', '--brief', pkg], 20);
531
+ const lines = out.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
532
+ for (let i = lines.length - 1; i >= 0; i--) {
533
+ const m = lines[i].match(/^([\w.]+)\/([\w.$]+)$/);
534
+ if (m && m[1] === pkg) return lines[i];
535
+ }
536
+ return null;
537
+ }
538
+
539
+ shell(args: string[], timeout = 15): string {
540
+ return this.run(['shell', ...args], timeout);
541
+ }
542
+
543
+ /**
544
+ * Read device density and physical resolution (queried once per run, result cached).
545
+ *
546
+ * Override density (devices changed via `wm density N`) **takes precedence over** physical density -- the UI is laid out by the override,
547
+ * and converting with the physical value yields systematically offset vp.
548
+ */
549
+ deviceInfo(): DeviceInfo {
550
+ if (this.cachedDeviceInfo !== undefined) return this.cachedDeviceInfo;
551
+ const densRaw = this.shell(['wm', 'density']);
552
+ const sizeRaw = this.shell(['wm', 'size']);
553
+ const ovD = /Override density:\s*(\d+)/.exec(densRaw);
554
+ const phD = /Physical density:\s*(\d+)/.exec(densRaw);
555
+ const dpi = ovD ? Number(ovD[1]) : phD ? Number(phD[1]) : null;
556
+ const ovS = /Override size:\s*(\d+)x(\d+)/.exec(sizeRaw);
557
+ const phS = /Physical size:\s*(\d+)x(\d+)/.exec(sizeRaw);
558
+ const sz = ovS ?? phS;
559
+ const info: DeviceInfo = {
560
+ dpi,
561
+ density: dpi ? Math.round((dpi / 160) * 1000) / 1000 : null,
562
+ density_source: dpi === null
563
+ ? 'unavailable'
564
+ : ovD ? 'wm density (override)' : 'wm density (physical)',
565
+ width_px: sz ? Number(sz[1]) : null,
566
+ height_px: sz ? Number(sz[2]) : null,
567
+ raw: { wm_density: densRaw, wm_size: sizeRaw },
568
+ };
569
+ if (info.density === null) {
570
+ console.log(' [WARN] `wm density` returned no parsable density; downstream measure_pack can only infer it (the result may be ambiguous)');
571
+ } else {
572
+ console.log(` device density: ${info.density} (${info.dpi}dpi, ${info.density_source})`
573
+ + (info.width_px ? ` resolution ${info.width_px}x${info.height_px}` : ''));
574
+ }
575
+ this.cachedDeviceInfo = info;
576
+ return info;
577
+ }
578
+
579
+ /**
580
+ * Wait until the target package settles in the **current focused window**; returns whether it did.
581
+ *
582
+ * Difference from waitForIdle(): here the focused window must be non-null and belong to the target package.
583
+ * During a transparent trampoline transition (e.g. AnkiDroid's IntentHandler) mCurrentFocus=null,
584
+ * which is "stable" for waitForIdle() but not dumpable for uiautomator.
585
+ */
586
+ waitForPackageForeground(pkg: string, timeoutSec = 12): boolean {
587
+ const deadline = Date.now() + timeoutSec * 1000;
588
+ let stableCount = 0;
589
+ let prev: string | null = null;
590
+ while (Date.now() < deadline) {
591
+ const info = this.getCurrentActivity();
592
+ const focus = info['current_focus'] ?? '';
593
+ // Must be "has a focused window + focus belongs to target package"; null focus does not count as landed.
594
+ const ok = !/=null\b/.test(focus) && focus.includes(pkg) && /[\w.]+\/[\w.$]+/.test(focus);
595
+ if (ok && focus === prev) {
596
+ stableCount += 1;
597
+ if (stableCount >= 2) return true;
598
+ } else {
599
+ stableCount = ok ? 1 : 0;
600
+ }
601
+ prev = ok ? focus : null;
602
+ sleep(0.4);
603
+ }
604
+ return false;
605
+ }
606
+
607
+ waitForIdle(): void {
608
+ const deadline = Date.now() + this.idleTimeout * 1000;
609
+ let prevFocus: string | null = null;
610
+ let interval = this.idlePollInterval;
611
+ while (Date.now() < deadline) {
612
+ sleep(interval);
613
+ interval = Math.min(interval * 1.5, 0.5);
614
+ const transitionOut = this.shell(['dumpsys', 'window', 'animator']);
615
+ if (transitionOut.includes('Transition ready') || transitionOut.includes('Running animations')) continue;
616
+ const focusOut = this.shell(['dumpsys', 'window']);
617
+ // On multi-display devices each display has its own mCurrentFocus line; concatenate all for the stability comparison,
618
+ // to avoid looking only at the secondary display line (often null, always "stable") and misjudging the UI as idle.
619
+ const currentFocus = focusOut
620
+ .split(/\r?\n/)
621
+ .filter((line) => line.includes('mCurrentFocus'))
622
+ .map((line) => line.trim())
623
+ .join(' | ');
624
+ if (currentFocus && currentFocus === prevFocus) return;
625
+ prevFocus = currentFocus;
626
+ }
627
+ console.log(` [WARN] timed out waiting for the UI to go idle (${this.idleTimeout}s), continuing`);
628
+ }
629
+
630
+ checkDevice(): boolean {
631
+ const out = this.run(['devices']);
632
+ const lines = out.split(/\r?\n/).filter((l) => l.trim() && !l.includes('List of devices'));
633
+ const online = lines.filter((l) => l.includes('device') && !l.includes('offline'));
634
+ if (online.length === 0) {
635
+ console.log(' no online device detected; start the emulator first and check that adb devices lists it');
636
+ return false;
637
+ }
638
+ const onlineDevices = online.map((line) => line.split(/\s+/)[0]);
639
+ console.log(` online devices: [${onlineDevices.map((d) => `'${d}'`).join(', ')}]`);
640
+ // When unspecified, follow adb's own rule: ANDROID_SERIAL, else the only online device; with several online, do not pick for the user.
641
+ // Specified device not online -> fail; never silently switch to another device (it would capture another app state / another screen).
642
+ const envSerial = (process.env.ANDROID_SERIAL || '').trim();
643
+ if (!this.deviceSerial && envSerial) this.deviceSerial = envSerial;
644
+ if (!this.deviceSerial) {
645
+ if (onlineDevices.length > 1) {
646
+ console.log(` [ERR] ${onlineDevices.length} online devices; pick the one to capture with --device <serial> or ANDROID_SERIAL`);
647
+ return false;
648
+ }
649
+ this.deviceSerial = onlineDevices[0];
650
+ console.log(` no device given, using the only online device: ${this.deviceSerial}`);
651
+ } else if (!onlineDevices.includes(this.deviceSerial)) {
652
+ console.log(` [ERR] the given device ${this.deviceSerial} is not online (online: ${onlineDevices.join(', ')})`);
653
+ return false;
654
+ } else {
655
+ console.log(` using the given device: ${this.deviceSerial}`);
656
+ }
657
+ return true;
658
+ }
659
+
660
+ /**
661
+ * Pick the most trustworthy line among multiple candidates.
662
+ * On multi-display devices (car units / foldables / cluster+main screen), `dumpsys window` and
663
+ * `dumpsys activity activities` output **one line per display** for
664
+ * mCurrentFocus / topResumedActivity, where the secondary display line is often `null` or the system
665
+ * launcher. So we cannot just take the first and break: prefer the line containing the target package,
666
+ * then any non-null line with a `pkg/activity` component name, and finally fall back to the first line.
667
+ */
668
+ private pickBestLine(lines: string[]): string | undefined {
669
+ if (lines.length === 0) return undefined;
670
+ // Do not "prefer lines containing the target package": when the target package is not in foreground, that would dig up a stale or secondary
671
+ // line containing the package name, faking "target app in foreground", making isInTargetApp() wrongly true,
672
+ // and another app's screen gets captured as the target page. The foreground check must faithfully reflect the current state.
673
+ const withComponent = lines.find((l) => !/=null\b/.test(l) && /[\w.]+\/[\w.]+/.test(l));
674
+ return withComponent ?? lines[0];
675
+ }
676
+
677
+ getCurrentActivity(): Record<string, string> {
678
+ const info: Record<string, string> = {};
679
+ const actOut = this.shell(['dumpsys', 'activity', 'activities']);
680
+ // Must use `window displays` rather than `window`: the latter's output may include
681
+ // historical DISPLAY CONTENTS snapshots inside the `Last ANR continued` section; pickBestLine()
682
+ // would pick that stale mCurrentFocus (observed to be an unrelated app).
683
+ const winOut = this.shell(['dumpsys', 'window', 'displays']);
684
+
685
+ const resumedLines: string[] = [];
686
+ for (const line of actOut.split(/\r?\n/)) {
687
+ if (/ResumedActivity|topActivity/i.test(line)) resumedLines.push(line.trim());
688
+ }
689
+ const resumed = this.pickBestLine(resumedLines);
690
+ if (resumed !== undefined) info['resumed_activity'] = resumed;
691
+
692
+ const focusLines: string[] = [];
693
+ const focusedAppLines: string[] = [];
694
+ for (const line of winOut.split(/\r?\n/)) {
695
+ if (line.includes('mCurrentFocus')) focusLines.push(line.trim());
696
+ else if (line.includes('mFocusedApp')) focusedAppLines.push(line.trim());
697
+ }
698
+ const focus = this.pickBestLine(focusLines);
699
+ if (focus !== undefined) info['current_focus'] = focus;
700
+ const focusedApp = this.pickBestLine(focusedAppLines);
701
+ if (focusedApp !== undefined) info['focused_app'] = focusedApp;
702
+
703
+ return info;
704
+ }
705
+
706
+ tap(x: number, y: number): void {
707
+ this.shell(['input', 'tap', String(x), String(y)]);
708
+ this.waitForIdle();
709
+ }
710
+
711
+ longPress(x: number, y: number, durationMs = 1000): void {
712
+ this.shell(['input', 'swipe', String(x), String(y), String(x), String(y), String(durationMs)]);
713
+ this.waitForIdle();
714
+ }
715
+
716
+ tapOrLongPress(x: number, y: number, isLongClick = false): void {
717
+ if (isLongClick) this.longPress(x, y);
718
+ else this.tap(x, y);
719
+ }
720
+
721
+ pressBack(): void {
722
+ this.shell(['input', 'keyevent', 'KEYCODE_BACK']);
723
+ this.waitForIdle();
724
+ }
725
+
726
+ dumpXmlQuick(): string {
727
+ const remotePath = '/sdcard/ui_dump.xml';
728
+ this.shell(['rm -f /sdcard/ui_dump.xml && uiautomator dump /sdcard/ui_dump.xml'], 20);
729
+ for (let k = 0; k < 6; k++) {
730
+ const check = this.shell(['ls', remotePath]);
731
+ if (check.includes(remotePath)) break;
732
+ sleep(0.2);
733
+ }
734
+ return this.shell(['cat', remotePath], 15);
735
+ }
736
+
737
+ getViewXmlFast(pageDir: string): string {
738
+ const xmlContent = this.dumpXmlQuick();
739
+ if (xmlContent) fs.writeFileSync(path.join(pageDir, 'view.xml'), xmlContent, 'utf-8');
740
+ return xmlContent;
741
+ }
742
+
743
+ /**
744
+ * Resolve the SurfaceFlinger **physical** display id of the screen hosting the target app (screencap -d only accepts physical ids;
745
+ * logical ids like 0/2/3 fail directly with "Failed to take screenshot. Status: -2").
746
+ *
747
+ * On multi-display devices (car cluster + main screen, foldables etc.) without -d, screencap first writes to stdout
748
+ * a "[Warning] Multiple displays were found..." text, shifting the whole PNG binary forward
749
+ * so the image cannot be opened; and it "defaults to the first display", not necessarily the one hosting the app.
750
+ *
751
+ * Flow: dumpsys activity activities finds the `Display #N` hosting the target package
752
+ * -> in dumpsys display, take the physical id from uniqueId "local:<physId>" on the line with `displayId N,`.
753
+ * On single-display devices resolution fails and returns null, falling back to the old no -d behavior (no warning then either).
754
+ */
755
+ private resolveTargetPhysicalDisplayId(): string | null {
756
+ if (this.cachedPhysicalDisplayId !== undefined) return this.cachedPhysicalDisplayId;
757
+ let result: string | null = null;
758
+ try {
759
+ if (this.targetPackage) {
760
+ const actOut = this.shell(['dumpsys', 'activity', 'activities']);
761
+ let curDisplay: string | null = null;
762
+ let logicalId: string | null = null;
763
+ for (const line of actOut.split(/\r?\n/)) {
764
+ const m = line.match(/^Display #(\d+)/);
765
+ if (m) curDisplay = m[1];
766
+ else if (curDisplay && line.includes(this.targetPackage)) {
767
+ logicalId = curDisplay;
768
+ break;
769
+ }
770
+ }
771
+ if (logicalId !== null) {
772
+ const dispOut = this.shell(['dumpsys', 'display']);
773
+ // Line-by-line scan: DisplayInfo is one long line; `displayId <N>,` and uniqueId are on the same line.
774
+ for (const line of dispOut.split(/\r?\n/)) {
775
+ if (!line.includes(`displayId ${logicalId},`)) continue;
776
+ const m = line.match(/uniqueId "local:(\d+)"/);
777
+ if (m) {
778
+ result = m[1];
779
+ break;
780
+ }
781
+ }
782
+ }
783
+ }
784
+ } catch {
785
+ result = null;
786
+ }
787
+ if (result) console.log(` [INFO] screenshot target display physical id: ${result}`);
788
+ this.cachedPhysicalDisplayId = result;
789
+ return result;
790
+ }
791
+
792
+ screencapBytes(): Buffer | null {
793
+ const physId = this.resolveTargetPhysicalDisplayId();
794
+ const capArgs = physId
795
+ ? ['exec-out', 'screencap', '-d', physId, '-p']
796
+ : ['exec-out', 'screencap', '-p'];
797
+ const res = spawnSync(this.adbPath, this.buildArgs(capArgs), {
798
+ timeout: 15 * 1000,
799
+ maxBuffer: 128 * 1024 * 1024,
800
+ windowsHide: true,
801
+ }) as SpawnSyncReturns<Buffer>;
802
+ if (res.error && (res.error as NodeJS.ErrnoException).code === 'ETIMEDOUT') {
803
+ console.log(' [WARN] screenshot timed out');
804
+ return null;
805
+ }
806
+ const out = res.stdout ?? Buffer.alloc(0);
807
+ if (out.length === 0) return null;
808
+ // Fallback: always truncate at the PNG magic, stripping any warning text screencap may prepend to stdout.
809
+ const magic = Buffer.from([0x89, 0x50, 0x4e, 0x47]);
810
+ const at = out.indexOf(magic);
811
+ if (at < 0) {
812
+ console.log(` [WARN] screenshot output contains no PNG data: ${out.subarray(0, 120).toString('utf-8').trim()}`);
813
+ return null;
814
+ }
815
+ return at === 0 ? out : out.subarray(at);
816
+ }
817
+
818
+ takeScreenshot(pageDir: string): void {
819
+ const localPath = path.join(pageDir, 'screenshot.png');
820
+ const data = this.screencapBytes();
821
+ if (data) {
822
+ fs.writeFileSync(localPath, data);
823
+ } else {
824
+ const remotePath = '/sdcard/screenshot.png';
825
+ const physId = this.resolveTargetPhysicalDisplayId();
826
+ // When saving to device then pulling, the display must also be specified, or a secondary display may be captured on multi-display devices.
827
+ if (physId) this.shell(['screencap', '-d', physId, '-p', remotePath]);
828
+ else this.shell(['screencap', '-p', remotePath]);
829
+ sleep(0.3);
830
+ this.run(['pull', remotePath, localPath], 15);
831
+ }
832
+ }
833
+
834
+ scrollToPosition(containerBounds: [number, number, number, number], scrollIndex: number): void {
835
+ if (scrollIndex <= 0) return;
836
+ const [x1, y1, , y2] = containerBounds;
837
+ const x2 = containerBounds[2];
838
+ const cx = Math.trunc((x1 + x2) / 2);
839
+ const height = y2 - y1;
840
+ const swipeFromY = y1 + Math.trunc(height * 0.7);
841
+ const swipeToY = y1 + Math.trunc(height * 0.3);
842
+ for (let k = 0; k < scrollIndex; k++) {
843
+ this.shell(['input', 'swipe', String(cx), String(swipeFromY), String(cx), String(swipeToY), String(this.scrollDurationMs)]);
844
+ this.waitForIdle();
845
+ }
846
+ }
847
+
848
+ flushPendingPulls(): void {
849
+ // The TS version writes screenshots synchronously with no async pull queue; keep an empty implementation to match call sites.
850
+ }
851
+ }
852
+
853
+ // ─────────────────────────────────────────────
854
+ // Queue item / record types
855
+ // ─────────────────────────────────────────────
856
+ interface ScrollInfo {
857
+ scroll_index: number;
858
+ container_bounds: number[];
859
+ }
860
+ interface ClickStep {
861
+ from: string;
862
+ element: string;
863
+ center: number[];
864
+ 'resource-id': string;
865
+ text: string;
866
+ 'content-desc': string;
867
+ 'long-clickable': boolean;
868
+ scroll_info: ScrollInfo | null;
869
+ }
870
+ type QueueItem = [ClickStep[], ElemId, string[], ScrollInfo | null];
871
+
872
+ interface PageRecord {
873
+ page_id: string | null;
874
+ label: string;
875
+ timestamp: string;
876
+ activity_info: Record<string, string>;
877
+ /** Captured true device density/resolution; measure_pack prefers it to avoid back-solving ambiguity. */
878
+ device_info?: DeviceInfo;
879
+ clickable_count: number;
880
+ clickable_elements: ClickableElement[];
881
+ scroll_container_bounds: number[] | null;
882
+ _tmp_dir?: string;
883
+ _screenshots?: string[];
884
+ _view_xmls?: string[];
885
+ screenshot?: string;
886
+ view_xml?: string;
887
+ screenshots?: string[];
888
+ view_xmls?: string[];
889
+ click_path?: ClickStep[] | 'manual';
890
+ came_from?: string;
891
+ trigger_element?: string;
892
+ description?: string;
893
+ }
894
+
895
+ function escapeHtml(s: string): string {
896
+ return s
897
+ .replace(/&/g, '&amp;')
898
+ .replace(/</g, '&lt;')
899
+ .replace(/>/g, '&gt;')
900
+ .replace(/"/g, '&quot;')
901
+ .replace(/'/g, '&#x27;');
902
+ }
903
+
904
+ // ─────────────────────────────────────────────
905
+ // PageCrawler: UI traversal logic, page capture, checkpoint resume, report generation
906
+ // ─────────────────────────────────────────────
907
+ class PageCrawler {
908
+ adb: ADBHelper;
909
+ package: string;
910
+ outputRoot: string;
911
+ maxPages: number;
912
+ maxScrolls: number;
913
+ skipPatterns: string[];
914
+
915
+ // Runtime state
916
+ pagesIndex: PageRecord[] = [];
917
+ visitedSignatures = new Set<string>();
918
+ pathSignatures: Record<string, string> = {};
919
+ blockedElements = new Set<string>();
920
+ queue: QueueItem[] = [];
921
+ pageCounter = 0;
922
+ stats = { skipped_elements: 0, probe_skipped: 0 };
923
+
924
+ constructor(opts: {
925
+ adb: ADBHelper;
926
+ package: string;
927
+ outputDir: string;
928
+ maxPages?: number;
929
+ maxScrolls?: number;
930
+ skipPatterns?: string[];
931
+ }) {
932
+ this.adb = opts.adb;
933
+ this.package = opts.package;
934
+ this.outputRoot = opts.outputDir;
935
+ this.maxPages = opts.maxPages ?? MAX_PAGES_DEFAULT;
936
+ this.maxScrolls = opts.maxScrolls ?? MAX_SCROLLS_DEFAULT;
937
+ this.skipPatterns = opts.skipPatterns ?? SKIP_RESOURCE_ID_PATTERNS_DEFAULT;
938
+ }
939
+
940
+ static elemIdOf(elem: ClickableElement): ElemId {
941
+ return [
942
+ elem['resource-id'] ?? '',
943
+ elem.text ?? '',
944
+ elem['content-desc'] ?? '',
945
+ elem.bounds ?? '',
946
+ elem['long-clickable'] ?? false,
947
+ ];
948
+ }
949
+
950
+ shouldSkipElement(elem: ClickableElement): boolean {
951
+ const rid = elem['resource-id'] ?? '';
952
+ const text = elem.text ?? '';
953
+ const desc = elem['content-desc'] ?? '';
954
+ const cls = elem.class ?? '';
955
+ for (const pattern of this.skipPatterns) if (rid.includes(pattern)) return true;
956
+ if (!text && !desc && !rid && cls.includes('ImageView')) return true;
957
+ return false;
958
+ }
959
+
960
+ isInTargetApp(activityInfo: Record<string, string>): boolean {
961
+ const focus = activityInfo['current_focus'] ?? '';
962
+ const resumed = activityInfo['resumed_activity'] ?? '';
963
+ console.log(focus, resumed);
964
+ return focus.includes(this.package) || resumed.includes(this.package);
965
+ }
966
+
967
+ scrollAndDump(
968
+ pageDir: string,
969
+ containerBounds: [number, number, number, number],
970
+ initialXml = '',
971
+ ): { xmlList: string[]; xmlPaths: string[]; screenshotPaths: string[] } {
972
+ const [x1, y1, , y2b] = containerBounds;
973
+ const x2 = containerBounds[2];
974
+ const y2 = y2b;
975
+ const cx = Math.trunc((x1 + x2) / 2);
976
+ const height = y2 - y1;
977
+ const swipeFromY = y1 + Math.trunc(height * 0.7);
978
+ const swipeToY = y1 + Math.trunc(height * 0.3);
979
+
980
+ const xmlList: string[] = [];
981
+ const xmlPaths: string[] = [];
982
+ const screenshotPaths: string[] = [];
983
+ let prevKeys: Set<string> | null = initialXml ? extractNodeKeys(initialXml) : null;
984
+
985
+ for (let i = 0; i < this.maxScrolls; i++) {
986
+ this.adb.shell(['input', 'swipe', String(cx), String(swipeFromY), String(cx), String(swipeToY), String(this.adb.scrollDurationMs)]);
987
+ this.adb.waitForIdle();
988
+ const newXml = this.adb.dumpXmlQuick();
989
+ const newKeys = extractNodeKeys(newXml);
990
+ if (prevKeys !== null && setsEqual(newKeys, prevKeys)) {
991
+ console.log(` šŸ“œ reached the bottom after ${i + 1} scroll(s), skipping the screenshot`);
992
+ break;
993
+ }
994
+ prevKeys = newKeys;
995
+ xmlList.push(newXml);
996
+ const xmlPath = path.join(pageDir, `view_scroll_${i + 1}.xml`);
997
+ fs.writeFileSync(xmlPath, newXml, 'utf-8');
998
+ xmlPaths.push(xmlPath);
999
+ const ssPath = path.join(pageDir, `screenshot_scroll_${i + 1}.png`);
1000
+ const data = this.adb.screencapBytes();
1001
+ if (data) {
1002
+ fs.writeFileSync(ssPath, data);
1003
+ screenshotPaths.push(ssPath);
1004
+ console.log(` šŸ“ø scroll ${i + 1}: XML + screenshot saved`);
1005
+ }
1006
+ }
1007
+ return { xmlList, xmlPaths, screenshotPaths };
1008
+ }
1009
+
1010
+ capturePage(label: string): {
1011
+ record: PageRecord;
1012
+ xmlContent: string;
1013
+ clickable: ClickableElement[];
1014
+ scrollContainerBounds: [number, number, number, number] | null;
1015
+ } {
1016
+ const tmpDir = path.join(this.outputRoot, '_tmp_capture');
1017
+ if (fs.existsSync(tmpDir)) fs.rmSync(tmpDir, { recursive: true, force: true });
1018
+ fs.mkdirSync(tmpDir, { recursive: true });
1019
+
1020
+ console.log(`\nšŸ“„ [capturing] ${label}`);
1021
+ const actInfo = this.adb.getCurrentActivity();
1022
+ console.log(` Focus : ${actInfo['current_focus'] ?? 'N/A'}`);
1023
+ console.log(` Activity: ${actInfo['resumed_activity'] ?? 'N/A'}`);
1024
+
1025
+ const xmlContent = this.adb.getViewXmlFast(tmpDir);
1026
+ console.log(` View XML saved (${Buffer.byteLength(xmlContent, 'utf-8')} bytes)`);
1027
+ this.adb.takeScreenshot(tmpDir);
1028
+ console.log(' screenshot saved');
1029
+
1030
+ const allScreenshots = [path.join(tmpDir, 'screenshot.png')];
1031
+ const allViewXmls = [path.join(tmpDir, 'view.xml')];
1032
+ const allXmlContents = [xmlContent];
1033
+ const scrollContainers = findScrollableContainers(xmlContent);
1034
+ if (scrollContainers.length > 0) {
1035
+ const container = scrollContainers[0];
1036
+ console.log(` šŸ“œ scrollable container detected: ${container.class} ${container['resource-id']}`);
1037
+ const { xmlList, xmlPaths, screenshotPaths } = this.scrollAndDump(tmpDir, container.bounds, xmlContent);
1038
+ if (xmlList.length > 0) {
1039
+ allXmlContents.push(...xmlList);
1040
+ allViewXmls.push(...xmlPaths);
1041
+ allScreenshots.push(...screenshotPaths);
1042
+ console.log(` šŸ“œ scroll capture done: ${xmlList.length} scroll(s), ${allScreenshots.length} screenshot(s) in total`);
1043
+ }
1044
+ }
1045
+
1046
+ const seenClickable = new Set<string>();
1047
+ const clickable: ClickableElement[] = [];
1048
+ allXmlContents.forEach((xc, idx) => {
1049
+ for (const elem of getClickableElements(xc)) {
1050
+ const key = [
1051
+ elem['resource-id'] ?? '',
1052
+ elem.text ?? '',
1053
+ elem['content-desc'] ?? '',
1054
+ elem.class ?? '',
1055
+ elem.bounds ?? '',
1056
+ String(elem['long-clickable'] ?? false),
1057
+ ].join(' ');
1058
+ if (!seenClickable.has(key)) {
1059
+ seenClickable.add(key);
1060
+ elem.scroll_index = idx;
1061
+ clickable.push(elem);
1062
+ }
1063
+ }
1064
+ });
1065
+ console.log(` clickable elements: ${clickable.length}`);
1066
+
1067
+ const scrollContainerBounds = scrollContainers.length > 0 ? scrollContainers[0].bounds : null;
1068
+ const record: PageRecord = {
1069
+ page_id: null,
1070
+ label,
1071
+ timestamp: new Date().toISOString(),
1072
+ activity_info: actInfo,
1073
+ device_info: this.adb.deviceInfo(),
1074
+ clickable_count: clickable.length,
1075
+ clickable_elements: clickable,
1076
+ scroll_container_bounds: scrollContainerBounds ? [...scrollContainerBounds] : null,
1077
+ _tmp_dir: tmpDir,
1078
+ _screenshots: allScreenshots,
1079
+ _view_xmls: allViewXmls,
1080
+ };
1081
+ return { record, xmlContent, clickable, scrollContainerBounds };
1082
+ }
1083
+
1084
+ restartToRoot(
1085
+ launchPackage: string | null,
1086
+ launchActivity: string | null,
1087
+ rootActivityKeyword: string | null = null,
1088
+ rootIdentity: RootIdentity | null = null,
1089
+ ): boolean {
1090
+ if (!launchPackage || !launchActivity) {
1091
+ console.log(' [WARN] package or Activity name is empty, cannot restart');
1092
+ return false;
1093
+ }
1094
+ const component = `${launchPackage}/${launchActivity}`;
1095
+
1096
+ const isAtRoot = (): boolean => {
1097
+ const activityInfo = this.adb.getCurrentActivity();
1098
+ const focus = activityInfo['current_focus'] ?? '';
1099
+ const resumed = activityInfo['resumed_activity'] ?? '';
1100
+ if (rootActivityKeyword) {
1101
+ if (!focus.includes(rootActivityKeyword) && !resumed.includes(rootActivityKeyword)) return false;
1102
+ }
1103
+ if (rootIdentity) {
1104
+ const xml = this.adb.dumpXmlQuick();
1105
+ const curIdentity = rootIdentifiedSet(activityInfo, xml);
1106
+ if (!isSameRootPage(rootIdentity, curIdentity)) {
1107
+ const [, curElems] = curIdentity;
1108
+ const [, rootElems] = rootIdentity;
1109
+ let inter = 0;
1110
+ for (const v of rootElems) if (curElems.has(v)) inter++;
1111
+ const union = rootElems.size + curElems.size - inter;
1112
+ const sim = union ? inter / union : 0;
1113
+ console.log(` [DEBUG] root page similarity: ${sim.toFixed(2)} (intersection ${inter}/union ${union})`);
1114
+ return false;
1115
+ }
1116
+ }
1117
+ return true;
1118
+ };
1119
+
1120
+ this.adb.shell(['am', 'force-stop', launchPackage]);
1121
+ sleep(1.0);
1122
+ this.adb.shell(['am', 'start', '-n', component, '--activity-clear-task', '--activity-clear-top']);
1123
+ this.adb.waitForIdle();
1124
+ // When the entry is a trampoline, the landing page needs one more beat before it is dumpable (same as the first launch in crawl()).
1125
+ this.adb.waitForPackageForeground(launchPackage);
1126
+
1127
+ for (let retry = 0; retry < 4; retry++) {
1128
+ if (isAtRoot()) return true;
1129
+ console.log(` [INFO] waiting for the page to finish loading... (retry ${retry + 1}/4)`);
1130
+ sleep(2);
1131
+ }
1132
+
1133
+ console.log(' [WARN] root page not reached after force-stop (the app did not start / stopped on a non-root page, see [ADB-ERR] above)');
1134
+ console.log(' [INFO] trying to recover with back + the click path...');
1135
+ this.adb.pressBack();
1136
+ if (isAtRoot()) return true;
1137
+
1138
+ console.log(' [WARN] every recovery method failed, skipping this navigation');
1139
+ return false;
1140
+ }
1141
+
1142
+ navigateViaRestart(
1143
+ clickPath: ClickStep[],
1144
+ launchPackage: string | null,
1145
+ launchActivity: string | null,
1146
+ rootActivityKeyword: string | null = null,
1147
+ stepSignatures: string[] | null = null,
1148
+ rootIdentity: RootIdentity | null = null,
1149
+ ): boolean {
1150
+ if (!launchPackage || !launchActivity) {
1151
+ console.log(' [WARN] package or Activity name is empty, cannot navigate');
1152
+ return false;
1153
+ }
1154
+ if (clickPath.length === 0) return true;
1155
+ if (!this.restartToRoot(launchPackage, launchActivity, rootActivityKeyword, rootIdentity)) {
1156
+ console.log(' [ERR] cannot get back to the root page, navigation failed');
1157
+ return false;
1158
+ }
1159
+
1160
+ for (let i = 0; i < clickPath.length; i++) {
1161
+ const step = clickPath[i];
1162
+ let xml = this.adb.dumpXmlQuick();
1163
+ const stepScroll = step.scroll_info;
1164
+ if (stepScroll && stepScroll.scroll_index > 0) {
1165
+ this.adb.scrollToPosition(stepScroll.container_bounds as [number, number, number, number], stepScroll.scroll_index);
1166
+ xml = this.adb.dumpXmlQuick();
1167
+ }
1168
+ const elemId: [string, string, string, string] = [step['resource-id'] ?? '', step.text ?? '', step['content-desc'] ?? '', ''];
1169
+ const found = findElementOnScreen(xml, elemId);
1170
+ const isLong = step['long-clickable'] ?? false;
1171
+ if (found && found.center) {
1172
+ this.adb.tapOrLongPress(found.center[0], found.center[1], isLong);
1173
+ } else if (step.center) {
1174
+ console.log(` [WARN] element ${step.element ?? '?'} not found, using the recorded coordinates`);
1175
+ this.adb.tapOrLongPress(step.center[0], step.center[1], isLong);
1176
+ } else {
1177
+ console.log(` [ERR] cannot navigate to step: ${step.element ?? '?'}`);
1178
+ return false;
1179
+ }
1180
+
1181
+ if (stepSignatures && i < stepSignatures.length && stepSignatures[i]) {
1182
+ const verifyXml = this.adb.dumpXmlQuick();
1183
+ const verifyInfo = this.adb.getCurrentActivity();
1184
+ const actualSig = pageSignature(verifyInfo, verifyXml);
1185
+ if (actualSig !== stepSignatures[i]) {
1186
+ const expectedAct = stepSignatures[i].split('|')[0];
1187
+ const actualAct = actualSig.split('|')[0];
1188
+ if (expectedAct !== actualAct) {
1189
+ console.log(` [WARN] Activity mismatch after navigation step ${i + 1} (expected=${expectedAct}, actual=${actualAct})`);
1190
+ return false;
1191
+ }
1192
+ }
1193
+ }
1194
+ }
1195
+ return true;
1196
+ }
1197
+
1198
+ // ── Checkpoint resume ──
1199
+ private saveQueue(): void {
1200
+ const items = this.queue.map(([clickPath, elemId, stepSigs, scrollInfo]) => [clickPath, [...elemId], stepSigs, scrollInfo]);
1201
+ try {
1202
+ fs.writeFileSync(path.join(this.outputRoot, 'queue_checkpoint.json'), JSON.stringify(items), 'utf-8');
1203
+ } catch (e) {
1204
+ console.log(` [WARN] failed to save the queue checkpoint: ${(e as Error).message}`);
1205
+ }
1206
+ }
1207
+
1208
+ private loadQueue(): QueueItem[] | null {
1209
+ const qfile = path.join(this.outputRoot, 'queue_checkpoint.json');
1210
+ if (!fs.existsSync(qfile)) return null;
1211
+ try {
1212
+ const items = JSON.parse(fs.readFileSync(qfile, 'utf-8')) as [ClickStep[], unknown[], string[], ScrollInfo | null][];
1213
+ return items.map(([clickPath, elemIdList, stepSigs, scrollInfo]) => [
1214
+ clickPath,
1215
+ elemIdList as ElemId,
1216
+ stepSigs,
1217
+ scrollInfo,
1218
+ ]);
1219
+ } catch (e) {
1220
+ console.log(` [WARN] failed to load the queue checkpoint: ${(e as Error).message}, rebuilding the queue`);
1221
+ return null;
1222
+ }
1223
+ }
1224
+
1225
+ private rebuildQueueFromPages(pagesIndex: PageRecord[]): QueueItem[] {
1226
+ const queue: QueueItem[] = [];
1227
+ for (const page of pagesIndex) {
1228
+ const clickPath = (Array.isArray(page.click_path) ? page.click_path : []) as ClickStep[];
1229
+ const clickable = page.clickable_elements ?? [];
1230
+ const scrollContainerBounds = page.scroll_container_bounds;
1231
+ for (const elem of clickable) {
1232
+ if (this.shouldSkipElement(elem)) continue;
1233
+ const elemId = PageCrawler.elemIdOf(elem);
1234
+ const si = elem.scroll_index ?? 0;
1235
+ let scrollInfo: ScrollInfo | null = null;
1236
+ if (si > 0 && scrollContainerBounds) scrollInfo = { scroll_index: si, container_bounds: [...scrollContainerBounds] };
1237
+ queue.push([clickPath, elemId, [], scrollInfo]);
1238
+ }
1239
+ }
1240
+ return queue;
1241
+ }
1242
+
1243
+ private tryLoadCheckpoint():
1244
+ | { pagesIndex: PageRecord[]; visited: Set<string>; pageCounter: number; queue: QueueItem[]; blocked: Set<string> }
1245
+ | null {
1246
+ const indexFile = path.join(this.outputRoot, 'index.json');
1247
+ if (!fs.existsSync(indexFile)) return null;
1248
+ const pageDirs = fs.existsSync(this.outputRoot)
1249
+ ? fs.readdirSync(this.outputRoot).filter((d) => d.startsWith('page_'))
1250
+ : [];
1251
+ if (pageDirs.length === 0) return null;
1252
+
1253
+ let pagesIndex: PageRecord[];
1254
+ try {
1255
+ pagesIndex = JSON.parse(fs.readFileSync(indexFile, 'utf-8')) as PageRecord[];
1256
+ } catch (e) {
1257
+ console.log(` [WARN] failed to read index.json: ${(e as Error).message}, starting over`);
1258
+ return null;
1259
+ }
1260
+ if (!pagesIndex || pagesIndex.length === 0) return null;
1261
+
1262
+ console.log(`\nā© found an existing checkpoint: ${pagesIndex.length} page(s), trying to resume...`);
1263
+ const visited = new Set<string>();
1264
+ let pageCounter = 0;
1265
+ for (const page of pagesIndex) {
1266
+ const pageId = page.page_id ?? '';
1267
+ if (!pageId) continue;
1268
+ const m = pageId.match(/page_(\d+)/);
1269
+ if (m) pageCounter = Math.max(pageCounter, parseInt(m[1], 10));
1270
+ const viewXmlPath = path.join(this.outputRoot, pageId, 'view.xml');
1271
+ if (fs.existsSync(viewXmlPath)) {
1272
+ const xmlContent = fs.readFileSync(viewXmlPath, 'utf-8');
1273
+ visited.add(pageSignature(page.activity_info ?? {}, xmlContent));
1274
+ }
1275
+ }
1276
+
1277
+ const savedQueue = this.loadQueue();
1278
+ let queue: QueueItem[];
1279
+ if (savedQueue !== null) {
1280
+ queue = savedQueue;
1281
+ console.log(` queue restored from the checkpoint: ${queue.length} pending element(s) (exact resume)`);
1282
+ } else {
1283
+ queue = this.rebuildQueueFromPages(pagesIndex);
1284
+ console.log(` queue rebuilt (fallback): ${queue.length} element(s) (explored ones included, BFS skips them)`);
1285
+ }
1286
+ const blocked = new Set<string>();
1287
+ console.log(` restored ${visited.size} visited signature(s), ${queue.length} pending element(s) in the queue`);
1288
+ return { pagesIndex, visited, pageCounter, queue, blocked };
1289
+ }
1290
+
1291
+ // ── Page commit ──
1292
+ private finalizePage(record: PageRecord, pageId: string): void {
1293
+ const pageDir = path.join(this.outputRoot, pageId);
1294
+ const tmpDir = record._tmp_dir!;
1295
+ if (fs.existsSync(tmpDir)) fs.renameSync(tmpDir, pageDir);
1296
+ else fs.mkdirSync(pageDir, { recursive: true });
1297
+
1298
+ record.page_id = pageId;
1299
+ record.screenshot = `${pageId}/screenshot.png`;
1300
+ record.view_xml = `${pageId}/view.xml`;
1301
+
1302
+ const screenshotsList = [`${pageId}/screenshot.png`];
1303
+ for (const ssPath of record._screenshots ?? []) {
1304
+ const ssName = path.basename(ssPath);
1305
+ if (ssName !== 'screenshot.png') screenshotsList.push(`${pageId}/${ssName}`);
1306
+ }
1307
+ record.screenshots = screenshotsList;
1308
+
1309
+ const viewXmlsList = [`${pageId}/view.xml`];
1310
+ for (const xmlPath of record._view_xmls ?? []) {
1311
+ const xmlName = path.basename(xmlPath);
1312
+ if (xmlName !== 'view.xml') viewXmlsList.push(`${pageId}/${xmlName}`);
1313
+ }
1314
+ record.view_xmls = viewXmlsList;
1315
+
1316
+ delete record._tmp_dir;
1317
+ delete record._screenshots;
1318
+ delete record._view_xmls;
1319
+
1320
+ fs.writeFileSync(path.join(pageDir, 'meta.json'), JSON.stringify(record, null, 2), 'utf-8');
1321
+ console.log(` āœ… saved as [${pageId}]`);
1322
+ }
1323
+
1324
+ private activityNameSuffix(record: PageRecord): string {
1325
+ const resumed = record.activity_info?.['resumed_activity'] ?? '';
1326
+ let mAct = resumed.match(/[\w.]+\/([\w.]+)/);
1327
+ if (!mAct) {
1328
+ const f = record.activity_info?.['current_focus'] ?? '';
1329
+ mAct = f.match(/[\w.]+\/([\w.]+)/);
1330
+ }
1331
+ let activityName = '';
1332
+ if (mAct) {
1333
+ const parts = mAct[1].split('.');
1334
+ activityName = parts[parts.length - 1];
1335
+ }
1336
+ return activityName ? `_${activityName}` : '';
1337
+ }
1338
+
1339
+ commitPage(record: PageRecord): string {
1340
+ this.pageCounter += 1;
1341
+ const suffix = this.activityNameSuffix(record);
1342
+ const pageId = `page_${String(this.pageCounter).padStart(4, '0')}${suffix}`;
1343
+ this.finalizePage(record, pageId);
1344
+ return pageId;
1345
+ }
1346
+
1347
+ commitManualPage(record: PageRecord, pageCounter: number): string {
1348
+ const suffix = this.activityNameSuffix(record);
1349
+ const pageId = `manual_${String(pageCounter).padStart(4, '0')}${suffix}`;
1350
+ this.finalizePage(record, pageId);
1351
+ return pageId;
1352
+ }
1353
+
1354
+ // ── HTML report generation ──
1355
+ generateHtmlReport(pages: PageRecord[]): void {
1356
+ let cards = '';
1357
+ for (const p of pages) {
1358
+ const activity = escapeHtml(p.activity_info?.['current_focus'] ?? 'N/A');
1359
+ const resumed = escapeHtml(p.activity_info?.['resumed_activity'] ?? 'N/A');
1360
+ const clickPath = p.click_path ?? [];
1361
+ let pathDisplay: string;
1362
+ if (clickPath === 'manual') {
1363
+ pathDisplay = `(Manual capture: ${escapeHtml(p.description ?? "manual capture")})`;
1364
+ } else if (Array.isArray(clickPath) && clickPath.length > 0) {
1365
+ const longClickTag = '<b class="long-click">long-press</b>';
1366
+ pathDisplay = clickPath
1367
+ .map(
1368
+ (s) =>
1369
+ `<code>${escapeHtml(s.from)}</code> ${s['long-clickable'] ? longClickTag : 'tap'} <b>${escapeHtml(s.element)}</b>`,
1370
+ )
1371
+ .join(' → ');
1372
+ } else {
1373
+ pathDisplay = '(initial page)';
1374
+ }
1375
+
1376
+ const screenshotPath = escapeHtml(p.screenshot ?? '');
1377
+ const screenshots = p.screenshots ?? [p.screenshot ?? ''];
1378
+ const viewXmls = p.view_xmls ?? [p.view_xml ?? ''];
1379
+ let screenshotsHtml: string;
1380
+ if (screenshots.length > 1) {
1381
+ let pairsHtml = '';
1382
+ screenshots.forEach((ss, idx) => {
1383
+ const xmlLink = idx < viewXmls.length ? viewXmls[idx] : viewXmls[viewXmls.length - 1];
1384
+ const labelTag = idx === 0 ? 'initial' : `scroll ${idx}`;
1385
+ pairsHtml +=
1386
+ `<div class="scroll-pair">` +
1387
+ `<img src="${escapeHtml(ss)}" alt="screenshot" onerror="this.style.display='none'"/>` +
1388
+ `<a href="${escapeHtml(xmlLink)}" target="_blank">${labelTag} XML</a>` +
1389
+ `</div>`;
1390
+ });
1391
+ screenshotsHtml = `<div class="screenshots-gallery">${pairsHtml}</div>`;
1392
+ } else {
1393
+ screenshotsHtml = `<img src="${escapeHtml(screenshots[0])}" alt="screenshot" onerror="this.style.display='none'"/>`;
1394
+ }
1395
+
1396
+ const labelEscaped = escapeHtml(p.label);
1397
+ const pageIdEscaped = escapeHtml(p.page_id ?? '');
1398
+ const viewXmlEscaped = escapeHtml(p.view_xml ?? '');
1399
+ let xmlLinksHtml: string;
1400
+ if (viewXmls.length > 1) {
1401
+ xmlLinksHtml = viewXmls
1402
+ .map((vx, i) => `<a href="${escapeHtml(vx)}" target="_blank">šŸ“„ XML${i === 0 ? '' : `_${i}`}</a>`)
1403
+ .join(' ');
1404
+ } else {
1405
+ xmlLinksHtml = `<a href="${viewXmlEscaped}" target="_blank">šŸ“„ View XML</a>`;
1406
+ }
1407
+
1408
+ cards += `
1409
+ <div class="card">
1410
+ <div class="card-header">
1411
+ <span class="pid">${pageIdEscaped}</span>
1412
+ <span class="label">${labelEscaped}</span>
1413
+ <span class="time">${escapeHtml((p.timestamp ?? '').slice(0, 19))}</span>
1414
+ </div>
1415
+ <div class="card-body">
1416
+ ${screenshotsHtml}
1417
+ <div class="meta">
1418
+ <div><b>Focus:</b> <code>${activity}</code></div>
1419
+ <div><b>Activity:</b> <code>${resumed}</code></div>
1420
+ <div><b>Click path:</b> ${pathDisplay}</div>
1421
+ <div><b>Clickable elements:</b> ${p.clickable_count}</div>
1422
+ <div class="links">
1423
+ ${xmlLinksHtml}
1424
+ <a href="${pageIdEscaped}/meta.json" target="_blank">šŸ—‚ Metadata JSON</a>
1425
+ </div>
1426
+ </div>
1427
+ </div>
1428
+ </div>`;
1429
+ }
1430
+
1431
+ const now = new Date();
1432
+ const pad = (x: number): string => String(x).padStart(2, '0');
1433
+ const genTime = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}`;
1434
+
1435
+ const html = `<!DOCTYPE html>
1436
+ <html lang="zh">
1437
+ <head>
1438
+ <meta charset="UTF-8">
1439
+ <title>Android Page Crawl Report (fast)</title>
1440
+ <style>
1441
+ body { font-family: -apple-system, sans-serif; background: #f5f5f5; margin: 0; padding: 20px; }
1442
+ h1 { color: #333; }
1443
+ .summary { background: #fff; border-radius: 8px; padding: 16px; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
1444
+ .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
1445
+ .card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
1446
+ .card-header { background: #1a73e8; color: #fff; padding: 10px 14px; display: flex; gap: 10px; align-items: center; }
1447
+ .pid { font-weight: bold; font-size: 13px; background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 4px; }
1448
+ .label { flex: 1; font-size: 14px; }
1449
+ .time { font-size: 11px; opacity: .8; }
1450
+ .card-body { display: flex; gap: 12px; padding: 12px; }
1451
+ .card-body img { width: 140px; height: auto; border-radius: 4px; border: 1px solid #eee; object-fit: cover; flex-shrink: 0; }
1452
+ .screenshots-gallery { display: flex; gap: 6px; overflow-x: auto; flex-shrink: 0; max-width: 320px; padding-bottom: 4px; }
1453
+ .screenshots-gallery img { width: 120px; height: auto; border-radius: 4px; border: 1px solid #eee; object-fit: cover; flex-shrink: 0; }
1454
+ .scroll-pair { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
1455
+ .scroll-pair a { font-size: 10px; color: #1a73e8; text-decoration: none; }
1456
+ .scroll-pair a:hover { text-decoration: underline; }
1457
+ .meta { font-size: 12px; color: #444; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
1458
+ .meta code { font-size: 11px; background: #f0f0f0; padding: 1px 4px; border-radius: 3px; word-break: break-all; }
1459
+ .links { display: flex; gap: 10px; margin-top: 4px; }
1460
+ .links a { color: #1a73e8; text-decoration: none; font-size: 12px; }
1461
+ .links a:hover { text-decoration: underline; }
1462
+ .long-click { color: #e65100; background: #fff3e0; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
1463
+ </style>
1464
+ </head>
1465
+ <body>
1466
+ <h1>šŸ“± Android Page Crawl Report (fast)</h1>
1467
+ <div class="summary">
1468
+ <b>Generated:</b> ${genTime} &nbsp;|&nbsp;
1469
+ <b>Pages captured:</b> ${pages.length}
1470
+ </div>
1471
+ <div class="grid">
1472
+ ${cards}
1473
+ </div>
1474
+ </body>
1475
+ </html>`;
1476
+
1477
+ fs.writeFileSync(path.join(this.outputRoot, 'report.html'), html, 'utf-8');
1478
+ }
1479
+
1480
+ private flushReport(): void {
1481
+ try {
1482
+ fs.writeFileSync(path.join(this.outputRoot, 'index.json'), JSON.stringify(this.pagesIndex, null, 2), 'utf-8');
1483
+ this.generateHtmlReport(this.pagesIndex);
1484
+ this.saveQueue();
1485
+ } catch (e) {
1486
+ console.log(` [WARN] failed to write the report: ${(e as Error).message}`);
1487
+ }
1488
+ }
1489
+
1490
+ /** Success = at least one page captured. Failure (no device / cannot enter app / first screen failed / 0 pages) returns false -> process exit 1. */
1491
+ crawl(): boolean {
1492
+ const ok = this.crawlInner();
1493
+ if (ok === false) return false;
1494
+ if (this.pagesIndex.length === 0) {
1495
+ console.log('[ERR] no page was captured');
1496
+ return false;
1497
+ }
1498
+ return true;
1499
+ }
1500
+
1501
+ private crawlInner(): boolean | void {
1502
+ if (!this.adb.checkDevice()) return false;
1503
+
1504
+ let activityInfo = this.adb.getCurrentActivity();
1505
+ // Two cases needing a clean restart:
1506
+ // 1) Not inside the target app (original logic).
1507
+ // 2) Inside the target app, but the foreground is a dialog/overlay -- current_focus has no activity component, so no launch component can be extracted.
1508
+ // Common when the previous traversal/resume ended on a dialog (resumed_activity still contains the package, so it is judged "in app").
1509
+ // Without a restart, all later force-stop navigations would abort for lack of launch info.
1510
+ const focusHasComponent = focusHasActivityComponent(activityInfo);
1511
+ const notInApp = !this.isInTargetApp(activityInfo);
1512
+ if (notInApp || !focusHasComponent) {
1513
+ if (notInApp) {
1514
+ console.log(`not inside the target app (${this.package}), force-stopping and launching...`);
1515
+ } else {
1516
+ console.log(
1517
+ `the foreground is a dialog/overlay (${activityInfo['current_focus'] ?? 'N/A'}), force-stopping and relaunching to get back to a clean root page...`,
1518
+ );
1519
+ }
1520
+ this.adb.shell(['am', 'force-stop', this.package]);
1521
+ sleep(0.5);
1522
+ this.adb.shell(['monkey', '-p', this.package, '-c', 'android.intent.category.LAUNCHER', '1']);
1523
+ this.adb.waitForIdle();
1524
+ // During the trampoline transition mCurrentFocus=null, and waitForIdle() wrongly judges it idle;
1525
+ // must also wait until the target package truly holds the focused window, otherwise a non-dumpable intermediate state is captured.
1526
+ if (!this.adb.waitForPackageForeground(this.package)) {
1527
+ console.log(` [WARN] timed out waiting for ${this.package} to get the focused window, still trying`);
1528
+ }
1529
+ activityInfo = this.adb.getCurrentActivity();
1530
+ if (!this.isInTargetApp(activityInfo)) {
1531
+ console.log(`[ERR] still not inside the target app (${this.package}) after launch; check the package name`);
1532
+ return false;
1533
+ }
1534
+ }
1535
+
1536
+ // launchPackage only accepts the --package value. Never infer it from the foreground window:
1537
+ // when the target package is not in foreground, pickBestLine() falls back to "any line with package/Activity",
1538
+ // so launchPackage could become an unrelated app -- which would then be killed by `am force-stop`.
1539
+ const launchPackage: string = this.package;
1540
+ let launchActivity: string | null = null;
1541
+
1542
+ const resolved = this.adb.resolveLauncherActivity(launchPackage);
1543
+ if (resolved) {
1544
+ launchActivity = resolved.split('/')[1];
1545
+ console.log(`launch Activity: ${resolved} (from resolve-activity)`);
1546
+ } else {
1547
+ // Fallback: only when resolve-activity gives no result, fall back to the foreground window, and it must be the same package.
1548
+ const comp = extractLaunchComponent(activityInfo);
1549
+ if (comp && comp[0] === launchPackage) {
1550
+ launchActivity = comp[1];
1551
+ console.log(`launch Activity: ${launchPackage}/${launchActivity} (from the foreground window, fallback)`);
1552
+ } else {
1553
+ console.log(
1554
+ `[WARN] cannot determine the launch Activity of ${launchPackage}: focus=${activityInfo['current_focus'] ?? ''} resumed=${activityInfo['resumed_activity'] ?? ''}`,
1555
+ );
1556
+ }
1557
+ }
1558
+
1559
+ // The root page keyword can only be determined after first-screen capture (the entry may be a trampoline with a differently named landing page);
1560
+ // declared here first; assigned in the checkpoint / first-screen capture branches below.
1561
+ let rootActivityKeyword: string | null = null;
1562
+
1563
+ fs.mkdirSync(this.outputRoot, { recursive: true });
1564
+ console.log(`\nšŸ“‚ output dir: ${path.resolve(this.outputRoot)}\n`);
1565
+ console.log('='.repeat(60));
1566
+ console.log('starting the crawl (fast: BFS + lightweight probing)...');
1567
+ console.log('='.repeat(60));
1568
+
1569
+ let rootIdentity: RootIdentity | null = null;
1570
+ const checkpoint = this.tryLoadCheckpoint();
1571
+ if (checkpoint) {
1572
+ this.pagesIndex = checkpoint.pagesIndex;
1573
+ this.visitedSignatures = checkpoint.visited;
1574
+ this.pageCounter = checkpoint.pageCounter;
1575
+ this.queue = checkpoint.queue;
1576
+ this.blockedElements = checkpoint.blocked;
1577
+ console.log(`ā© resuming from page ${this.pageCounter + 1}\n`);
1578
+ for (const p of this.pagesIndex) {
1579
+ if (!p.click_path || (Array.isArray(p.click_path) && p.click_path.length === 0)) {
1580
+ const rootXmlPath = path.join(this.outputRoot, p.page_id!, 'view.xml');
1581
+ if (fs.existsSync(rootXmlPath)) {
1582
+ const rootXml = fs.readFileSync(rootXmlPath, 'utf-8');
1583
+ rootIdentity = rootIdentifiedSet(p.activity_info ?? {}, rootXml);
1584
+ }
1585
+ rootActivityKeyword = rootKeywordFromActivityInfo(p.activity_info ?? {});
1586
+ if (rootActivityKeyword) console.log(`root Activity keyword: ${rootActivityKeyword} (from ${p.page_id})`);
1587
+ break;
1588
+ }
1589
+ }
1590
+ } else {
1591
+ // The first screen must be captured while "the target package holds the focused window". isInTargetApp() alone is not enough:
1592
+ // it also returns true for focus=null + resumed=<trampoline>, and at that moment uiautomator
1593
+ // dumps nothing (view.xml 0 bytes, 0 clickable elements).
1594
+ if (!this.adb.waitForPackageForeground(this.package)) {
1595
+ const preInfo = this.adb.getCurrentActivity();
1596
+ console.log(
1597
+ `[ERR] the target app (${this.package}) does not hold the focused window before the first screen is captured: focus=${preInfo['current_focus'] ?? 'N/A'} resumed=${preInfo['resumed_activity'] ?? 'N/A'}`,
1598
+ );
1599
+ console.log(' the first screen is the baseline for every later page; a wrong capture would pollute the whole run, aborted.');
1600
+ return false;
1601
+ }
1602
+ const { record, xmlContent, clickable, scrollContainerBounds } = this.capturePage("Initial page");
1603
+ const pageId = this.commitPage(record);
1604
+ record.click_path = [];
1605
+ fs.writeFileSync(path.join(this.outputRoot, pageId, 'meta.json'), JSON.stringify(record, null, 2), 'utf-8');
1606
+ const sig = pageSignature(record.activity_info, xmlContent);
1607
+ rootIdentity = rootIdentifiedSet(record.activity_info, xmlContent);
1608
+ rootActivityKeyword = rootKeywordFromActivityInfo(record.activity_info);
1609
+ if (rootActivityKeyword) console.log(`root Activity keyword: ${rootActivityKeyword} (from the first screen)`);
1610
+ this.visitedSignatures.add(sig);
1611
+ this.pathSignatures[JSON.stringify([])] = sig;
1612
+ this.pagesIndex.push(record);
1613
+ this.flushReport();
1614
+
1615
+ for (const elem of clickable) {
1616
+ if (this.shouldSkipElement(elem)) {
1617
+ this.stats.skipped_elements += 1;
1618
+ continue;
1619
+ }
1620
+ const elemId = PageCrawler.elemIdOf(elem);
1621
+ const si = elem.scroll_index ?? 0;
1622
+ let scrollInfo: ScrollInfo | null = null;
1623
+ if (si > 0 && scrollContainerBounds) scrollInfo = { scroll_index: si, container_bounds: [...scrollContainerBounds] };
1624
+ this.queue.push([[], elemId, [], scrollInfo]);
1625
+ }
1626
+ }
1627
+
1628
+ const failedPaths = new Set<string>();
1629
+ while (this.queue.length > 0 && this.pageCounter < this.maxPages) {
1630
+ const [clickPath, elemId, stepSignatures, scrollInfo] = this.queue.shift()!;
1631
+ const elemKey = JSON.stringify(elemId);
1632
+ if (this.blockedElements.has(elemKey)) continue;
1633
+
1634
+ const pathKey = clickPath.length > 0 ? JSON.stringify(clickPath) : '';
1635
+ let skip = false;
1636
+ for (const fp of failedPaths) {
1637
+ if (pathKey.startsWith(fp) && fp.length > 2) {
1638
+ skip = true;
1639
+ break;
1640
+ }
1641
+ }
1642
+ if (skip) continue;
1643
+
1644
+ const pathDesc = clickPath.length > 0 ? clickPath.map((s) => s.element ?? '?').join(' → ') : "Root page";
1645
+ console.log(`\n🧭 navigating to: ${pathDesc}`);
1646
+
1647
+ if (!launchPackage || !launchActivity) {
1648
+ console.log(' [ERR] cannot restart the app, launch info missing');
1649
+ continue;
1650
+ }
1651
+
1652
+ if (clickPath.length > 0) {
1653
+ if (!this.navigateViaRestart(clickPath, launchPackage, launchActivity, rootActivityKeyword, stepSignatures, rootIdentity)) {
1654
+ console.log(' [ERR] navigation failed, skipping');
1655
+ failedPaths.add(pathKey);
1656
+ continue;
1657
+ }
1658
+ } else {
1659
+ if (!this.restartToRoot(launchPackage, launchActivity, rootActivityKeyword, rootIdentity)) {
1660
+ console.log(' [ERR] cannot get back to the root page, skipping');
1661
+ continue;
1662
+ }
1663
+ }
1664
+
1665
+ let freshXml = this.adb.dumpXmlQuick();
1666
+ if (scrollInfo && scrollInfo.scroll_index > 0) {
1667
+ console.log(` šŸ“œ scrolled ${scrollInfo.scroll_index} time(s) to reach the element`);
1668
+ this.adb.scrollToPosition(scrollInfo.container_bounds as [number, number, number, number], scrollInfo.scroll_index);
1669
+ freshXml = this.adb.dumpXmlQuick();
1670
+ }
1671
+
1672
+ const foundElem = findElementOnScreen(freshXml, elemId);
1673
+ if (!foundElem || !foundElem.center) {
1674
+ console.log(` [SKIP] element not found: ${JSON.stringify(elemId.slice(0, 3))}`);
1675
+ continue;
1676
+ }
1677
+
1678
+ // input tap/swipe are global events hitting **whatever window is foreground at that time**, not bound to an app.
1679
+ // If the foreground is no longer the target app (navigation jumped away midway, system stole focus for a dialog, etc.),
1680
+ // the tap lands on someone else's screen, and the following dump/screenshot also records it into ui_info.
1681
+ const preTapInfo = this.adb.getCurrentActivity();
1682
+ if (!this.isInTargetApp(preTapInfo)) {
1683
+ console.log(` [SKIP] the foreground is no longer the target app before the tap (${preTapInfo['current_focus'] ?? 'N/A'}), skipping`);
1684
+ continue;
1685
+ }
1686
+
1687
+ const center = foundElem.center;
1688
+ const labelText = foundElem.text || foundElem['content-desc'] || foundElem['resource-id'] || 'unknown';
1689
+ console.log(`\nšŸ‘† tap: [${labelText}] @ ${JSON.stringify(center)}`);
1690
+ const isLong = foundElem['long-clickable'] ?? false;
1691
+ if (isLong) console.log(' šŸ” triggering with a long press');
1692
+ this.adb.tapOrLongPress(center[0], center[1], isLong);
1693
+
1694
+ const probeXml = this.adb.dumpXmlQuick();
1695
+ const probeInfo = this.adb.getCurrentActivity();
1696
+ let newSig = pageSignature(probeInfo, probeXml);
1697
+
1698
+ if (!this.isInTargetApp(probeInfo)) {
1699
+ console.log(' āš ļø jumped to another app, marking and skipping');
1700
+ this.blockedElements.add(elemKey);
1701
+ continue;
1702
+ }
1703
+ if (this.visitedSignatures.has(newSig)) {
1704
+ console.log(' ā™»ļø page already visited, skipping (screenshot saved)');
1705
+ this.stats.probe_skipped += 1;
1706
+ continue;
1707
+ }
1708
+
1709
+ const { record: newRecord, xmlContent: newXml, clickable: newClickable, scrollContainerBounds: newScrollBounds } =
1710
+ this.capturePage(`After clicking '${labelText}'`);
1711
+ newSig = pageSignature(newRecord.activity_info, newXml);
1712
+ this.visitedSignatures.add(newSig);
1713
+ const pageId = this.commitPage(newRecord);
1714
+
1715
+ const newClickPath: ClickStep[] = [
1716
+ ...clickPath,
1717
+ {
1718
+ from: pathDesc,
1719
+ element: labelText,
1720
+ center: [...center],
1721
+ 'resource-id': foundElem['resource-id'] ?? '',
1722
+ text: foundElem.text ?? '',
1723
+ 'content-desc': foundElem['content-desc'] ?? '',
1724
+ 'long-clickable': isLong,
1725
+ scroll_info: scrollInfo,
1726
+ },
1727
+ ];
1728
+ newRecord.came_from = pathDesc;
1729
+ newRecord.trigger_element = labelText;
1730
+ newRecord.click_path = newClickPath;
1731
+ fs.writeFileSync(path.join(this.outputRoot, pageId, 'meta.json'), JSON.stringify(newRecord, null, 2), 'utf-8');
1732
+ this.pagesIndex.push(newRecord);
1733
+ this.flushReport();
1734
+
1735
+ this.pathSignatures[JSON.stringify(newClickPath)] = newSig;
1736
+ const newStepSigs = [...stepSignatures, newSig];
1737
+
1738
+ for (const ne of newClickable) {
1739
+ if (this.shouldSkipElement(ne)) {
1740
+ this.stats.skipped_elements += 1;
1741
+ continue;
1742
+ }
1743
+ const newEid = PageCrawler.elemIdOf(ne);
1744
+ const si = ne.scroll_index ?? 0;
1745
+ let neScrollInfo: ScrollInfo | null = null;
1746
+ if (si > 0 && newScrollBounds) neScrollInfo = { scroll_index: si, container_bounds: [...newScrollBounds] };
1747
+ this.queue.push([newClickPath, newEid, newStepSigs, neScrollInfo]);
1748
+ }
1749
+ }
1750
+
1751
+ this.adb.flushPendingPulls();
1752
+ this.flushReport();
1753
+ try {
1754
+ fs.rmSync(path.join(this.outputRoot, 'queue_checkpoint.json'), { force: true });
1755
+ } catch {
1756
+ /* ignore */
1757
+ }
1758
+
1759
+ console.log('\n' + '='.repeat(60));
1760
+ console.log(`āœ… crawl finished! ${this.pagesIndex.length} page(s) captured`);
1761
+ console.log(`šŸ“‚ output dir: ${path.resolve(this.outputRoot)}`);
1762
+ console.log(`šŸ“‹ index file: ${path.join(this.outputRoot, 'index.json')}`);
1763
+ console.log(`🌐 HTML report: ${path.join(this.outputRoot, 'report.html')}`);
1764
+ console.log('\nšŸ“Š speed-up stats:');
1765
+ console.log(` low-value elements filtered: ${this.stats.skipped_elements}`);
1766
+ console.log(` skipped by lightweight probing (screenshots saved): ${this.stats.probe_skipped}`);
1767
+ console.log('='.repeat(60));
1768
+ }
1769
+
1770
+ /** Read existing index.json (empty array if missing or corrupt). Shared by manual/single-page capture. */
1771
+ private loadExistingIndex(): PageRecord[] {
1772
+ const indexFile = path.join(this.outputRoot, 'index.json');
1773
+ if (!fs.existsSync(indexFile)) return [];
1774
+ try {
1775
+ return JSON.parse(fs.readFileSync(indexFile, 'utf-8')) as PageRecord[];
1776
+ } catch (e) {
1777
+ console.log(`[WARN] failed to read index.json: ${(e as Error).message}, creating a new index`);
1778
+ return [];
1779
+ }
1780
+ }
1781
+
1782
+ /** Largest manual_NNNN number among existing pages, used to continue numbering. */
1783
+ static lastManualCounter(pagesIndex: PageRecord[]): number {
1784
+ let counter = 0;
1785
+ for (const p of pagesIndex) {
1786
+ const mm = (p.page_id ?? '').match(/manual_(\d+)/);
1787
+ if (mm) counter = Math.max(counter, parseInt(mm[1], 10));
1788
+ }
1789
+ return counter;
1790
+ }
1791
+
1792
+ /**
1793
+ * Single-page capture mode (--page "<description>"): no navigation; directly takes the device's **current** page
1794
+ * as the page to capture once (screenshot + view.xml + scrolling capture of scrollable containers), writes index.json /
1795
+ * report.html then exits. Equivalent to entering one description then q in manualCrawl, but non-interactive,
1796
+ * so external scripts can call it page by page following their own UI sequence.
1797
+ */
1798
+ capturePageOnce(description: string): boolean | void {
1799
+ if (!this.adb.checkDevice()) return false;
1800
+ fs.mkdirSync(this.outputRoot, { recursive: true });
1801
+
1802
+ const pagesIndex = this.loadExistingIndex();
1803
+ if (pagesIndex.length > 0) console.log(`šŸ“‚ loaded ${pagesIndex.length} existing page(s)`);
1804
+ const manualCounter = PageCrawler.lastManualCounter(pagesIndex) + 1;
1805
+
1806
+ console.log(`\nšŸ“‚ output dir: ${path.resolve(this.outputRoot)}`);
1807
+ console.log(`šŸ“ single-page capture mode: ${description}`);
1808
+
1809
+ const { record } = this.capturePage(description);
1810
+ record.click_path = 'manual';
1811
+ record.description = description;
1812
+ const pageId = this.commitManualPage(record, manualCounter);
1813
+ pagesIndex.push(record);
1814
+ fs.writeFileSync(path.join(this.outputRoot, 'index.json'), JSON.stringify(pagesIndex, null, 2), 'utf-8');
1815
+ this.pagesIndex = pagesIndex;
1816
+ this.generateHtmlReport(pagesIndex);
1817
+
1818
+ console.log(`\nāœ… single-page capture done: [${pageId}] (index.json has ${pagesIndex.length} page(s))`);
1819
+ console.log(`šŸ“‚ output dir: ${path.resolve(this.outputRoot)}`);
1820
+ }
1821
+
1822
+ async manualCrawl(): Promise<boolean | void> {
1823
+ if (!this.adb.checkDevice()) return false;
1824
+ fs.mkdirSync(this.outputRoot, { recursive: true });
1825
+
1826
+ const pagesIndex = this.loadExistingIndex();
1827
+ if (pagesIndex.length > 0) console.log(`šŸ“‚ loaded ${pagesIndex.length} existing page(s)`);
1828
+ let manualCounter = PageCrawler.lastManualCounter(pagesIndex);
1829
+
1830
+ console.log(`\nšŸ“‚ output dir: ${path.resolve(this.outputRoot)}`);
1831
+ console.log(`šŸ“ manual capture mode started (manual numbering starts at ${manualCounter + 1})`);
1832
+ console.log('='.repeat(60));
1833
+ console.log('How to use:');
1834
+ console.log(' 1. navigate to the target page on the device by hand');
1835
+ console.log(' 2. type a page description (e.g. "Settings > About"), then press Enter to capture');
1836
+ console.log(' 3. type q to quit');
1837
+ console.log('='.repeat(60));
1838
+
1839
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
1840
+ const question = (q: string): Promise<string> => new Promise((resolve) => rl.question(q, resolve));
1841
+
1842
+ try {
1843
+ for (;;) {
1844
+ console.log();
1845
+ let desc = (await question('šŸ“ page description (q to quit): ')).trim();
1846
+ if (desc.toLowerCase() === 'q') {
1847
+ console.log('šŸ‘‹ leaving manual capture mode');
1848
+ break;
1849
+ }
1850
+ if (!desc) desc = "manual capture";
1851
+ manualCounter += 1;
1852
+ const { record } = this.capturePage(desc);
1853
+ record.click_path = 'manual';
1854
+ record.description = desc;
1855
+ this.commitManualPage(record, manualCounter);
1856
+ pagesIndex.push(record);
1857
+ fs.writeFileSync(path.join(this.outputRoot, 'index.json'), JSON.stringify(pagesIndex, null, 2), 'utf-8');
1858
+ this.pagesIndex = pagesIndex;
1859
+ this.generateHtmlReport(pagesIndex);
1860
+ console.log(` šŸ“‹ index.json and report.html updated (${pagesIndex.length} page(s) in total)`);
1861
+ }
1862
+ } finally {
1863
+ rl.close();
1864
+ }
1865
+ console.log(`\nāœ… manual capture done! ${pagesIndex.length} page(s) in total (crawled ones included)`);
1866
+ console.log(`šŸ“‚ output dir: ${path.resolve(this.outputRoot)}`);
1867
+ }
1868
+ }
1869
+
1870
+ // ─────────────────────────────────────────────
1871
+ // CLI
1872
+ // ─────────────────────────────────────────────
1873
+ interface CliArgs {
1874
+ package: string;
1875
+ output: string;
1876
+ manual: boolean;
1877
+ page: string | null;
1878
+ device: string;
1879
+ adbPath: string;
1880
+ maxPages: number;
1881
+ maxScrolls: number;
1882
+ }
1883
+
1884
+ function printHelp(): void {
1885
+ console.log(
1886
+ [
1887
+ 'Android emulator page crawler (fast)',
1888
+ '',
1889
+ 'Usage: node android_parse_fast.ts --package <pkg> --output <dir> [options]',
1890
+ '',
1891
+ ' --package, -p target app package name (required)',
1892
+ ' --output, -o output directory (required)',
1893
+ ' --manual manual capture mode: navigate to a page by hand, then press Enter to capture',
1894
+ ' --page "<desc>" single-page capture mode: capture the device\'s current page under this description and exit (no crawl)',
1895
+ ` --device ADB device serial (default: none, adb picks by ANDROID_SERIAL / the only online device)`,
1896
+ ` --adb-path path to the adb executable (default: env ADB_PATH, else adb on PATH)`,
1897
+ ` --max-pages maximum pages to crawl (default: ${MAX_PAGES_DEFAULT})`,
1898
+ ` --max-scrolls maximum scrolls per scrollable container (default: ${MAX_SCROLLS_DEFAULT})`,
1899
+ ].join('\n'),
1900
+ );
1901
+ }
1902
+
1903
+ function parseArgs(argv: string[]): CliArgs {
1904
+ const args: CliArgs = {
1905
+ package: '',
1906
+ output: '',
1907
+ manual: false,
1908
+ page: null,
1909
+ device: DEVICE_SERIAL_DEFAULT,
1910
+ adbPath: ADB_PATH_DEFAULT,
1911
+ maxPages: MAX_PAGES_DEFAULT,
1912
+ maxScrolls: MAX_SCROLLS_DEFAULT,
1913
+ };
1914
+ for (let i = 0; i < argv.length; i++) {
1915
+ const a = argv[i];
1916
+ const next = (): string => {
1917
+ if (i + 1 >= argv.length) {
1918
+ console.error(`Missing value for ${a}`);
1919
+ process.exit(2);
1920
+ }
1921
+ return argv[++i];
1922
+ };
1923
+ if (a === '--package' || a === '-p') args.package = next();
1924
+ else if (a === '--output' || a === '-o') args.output = next();
1925
+ else if (a === '--manual') args.manual = true;
1926
+ else if (a === '--page') args.page = next();
1927
+ else if (a === '--device') args.device = next();
1928
+ else if (a === '--adb-path') args.adbPath = next();
1929
+ else if (a === '--max-pages') args.maxPages = parseInt(next(), 10);
1930
+ else if (a === '--max-scrolls') args.maxScrolls = parseInt(next(), 10);
1931
+ else if (a === '-h' || a === '--help') {
1932
+ printHelp();
1933
+ process.exit(0);
1934
+ } else {
1935
+ console.error(`Unknown argument: ${a}`);
1936
+ process.exit(2);
1937
+ }
1938
+ }
1939
+ if (!args.package) {
1940
+ console.error('error: --package/-p is required');
1941
+ process.exit(2);
1942
+ }
1943
+ if (!args.output) {
1944
+ console.error('error: --output/-o is required');
1945
+ process.exit(2);
1946
+ }
1947
+ if (args.page !== null && args.manual) {
1948
+ console.error('error: --page and --manual are mutually exclusive');
1949
+ process.exit(2);
1950
+ }
1951
+ return args;
1952
+ }
1953
+
1954
+ async function main(): Promise<number> {
1955
+ const args = parseArgs(process.argv.slice(2));
1956
+ const adb = new ADBHelper({ adbPath: args.adbPath, deviceSerial: args.device, targetPackage: args.package });
1957
+ const crawler = new PageCrawler({
1958
+ adb,
1959
+ package: args.package,
1960
+ outputDir: args.output,
1961
+ maxPages: args.maxPages,
1962
+ maxScrolls: args.maxScrolls,
1963
+ });
1964
+ // Previously always returned 0: no device / first screen failed / 0 pages also exit 0, and the caller (ui-align Step 3.2) treated an empty dir as success.
1965
+ let ok: boolean | void;
1966
+ if (args.page !== null) ok = crawler.capturePageOnce(args.page.trim() || "single-page capture");
1967
+ else if (args.manual) ok = await crawler.manualCrawl();
1968
+ else ok = crawler.crawl();
1969
+ return ok === false ? 1 : 0;
1970
+ }
1971
+
1972
+ const isEntry = process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href;
1973
+ if (isEntry) {
1974
+ main().then(
1975
+ (code) => process.exit(code),
1976
+ (err) => {
1977
+ console.error(err instanceof Error ? err.message : err);
1978
+ process.exit(1);
1979
+ },
1980
+ );
1981
+ }
1982
+
1983
+ export {
1984
+ parseXml,
1985
+ iterNodes,
1986
+ parseBoundsCenter,
1987
+ getClickableElements,
1988
+ extractNodeKeys,
1989
+ findScrollableContainers,
1990
+ normalizeComponent,
1991
+ stableActivityKey,
1992
+ pageSignature,
1993
+ rootIdentifiedSet,
1994
+ isSameRootPage,
1995
+ findElementOnScreen,
1996
+ focusHasActivityComponent,
1997
+ extractLaunchComponent,
1998
+ rootKeywordFromActivityInfo,
1999
+ PageCrawler,
2000
+ ADBHelper,
2001
+ };
2002
+
2003
+
2004
+
2005
+