@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,1650 @@
1
+ // footprint.mjs — page -> source file, per-page footprint, grouping, and plan construction.
2
+
3
+ import crypto from "node:crypto";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+ import { types } from "node:util";
7
+ import { slugify, toPosix } from "./lib/fsx.mjs";
8
+ import { bfsFileEvidence, findLabelFile, declarationReferrers } from "./lib/hg.mjs";
9
+ import { RUNTIME_RE, roleOf, bucketOf } from "./lib/footprint-roles.mjs";
10
+ import { isExcludedEvidencePath } from "./facts-build.mjs";
11
+ import { stableDigest } from "./behavior-model.mjs";
12
+
13
+ // source resolution rung 1/2: a `declared_at` that already names a source file.
14
+ const SOURCE_EXT_RE = /\.(java|kt|kts|vue|nvue|uvue|ets|js|mjs|cjs|jsx|ts|tsx)$/i;
15
+
16
+ // source resolution rung 3: the Android page table.
17
+ const MANIFEST_RE = /(^|\/)AndroidManifest\.xml$/i;
18
+
19
+ // UniApp record classifier: a pages.json declaration identifies the platform.
20
+ const PAGES_JSON_RE = /(^|\/)pages\.json$/i;
21
+
22
+ const isNonemptyString = (value) => typeof value === "string" && value !== "";
23
+
24
+ /** A resolved path is consumable only with the complete UTG artifact contract. */
25
+ function hasCompleteResolvedUniAppArtifact(page) {
26
+ return page.sfc_status === "resolved"
27
+ && isNonemptyString(page.resolved_file)
28
+ && isNonemptyString(page.app_root)
29
+ && isNonemptyString(page.route)
30
+ && isNonemptyString(page.origin_kind)
31
+ && isNonemptyString(page.source_file)
32
+ && isNonemptyString(page.evidence_digest)
33
+ && (page.sfc_reason === null || typeof page.sfc_reason === "string")
34
+ && Array.isArray(page.sfc_candidates)
35
+ && Array.isArray(page.provenance_variants)
36
+ && page.provenance_variants.length > 0;
37
+ }
38
+
39
+ // BFS depth for footprint traversal.
40
+ export const FOOTPRINT_DEPTH = 3;
41
+
42
+ /**
43
+ * The five values `resolvePageFiles` returns in `by`, as the single source of
44
+ * truth for both the literals below and any consumer that needs the ladder's
45
+ * outcome set (the grouping report records which rung resolved each page).
46
+ * Key order is stable; it is not the platform-dispatch order.
47
+ */
48
+ export const RESOLVE_BY = Object.freeze({
49
+ DECLARED_AT: "declared_at",
50
+ REG_LABEL: "reg-label",
51
+ MANIFEST_LABEL: "manifest-label",
52
+ UNIAPP_ROUTE: "uniapp-route",
53
+ UNRESOLVED: "unresolved",
54
+ });
55
+
56
+ /**
57
+ * POSIX form with `.`/empty segments dropped and runs of `/` collapsed.
58
+ *
59
+ * Absoluteness is preserved, exactly as `roleOf` does it: `roleOf`'s
60
+ * `sourceRoots` gate compares paths against roots with the same leading-slash
61
+ * rule, so stripping it here would make an absolute `file_path` compare as if
62
+ * it were repo-relative and silently fall outside every root.
63
+ */
64
+ function normalize(p) {
65
+ const raw = toPosix(p);
66
+ const absolute = raw.startsWith("/");
67
+ const parts = [];
68
+ for (const seg of raw.split("/")) {
69
+ if (seg === "" || seg === ".") continue;
70
+ parts.push(seg);
71
+ }
72
+ const joined = parts.join("/");
73
+ return absolute ? `/${joined}` : joined;
74
+ }
75
+
76
+ /**
77
+ * Strip a trailing `:line` (or `:line:col`) suffix.
78
+ *
79
+ * source resolution rung 2 looks `declared_at` up in `sharedDeclaredAt`, which is counted
80
+ * without line numbers. Strip the suffix before lookup so shared registration files are
81
+ * disambiguated through the page label.
82
+ */
83
+ export function stripDeclaredLine(declaredAt) {
84
+ if (typeof declaredAt !== "string") return null;
85
+ return declaredAt.replace(/(?::\d+)+$/, "");
86
+ }
87
+
88
+ /**
89
+ * source resolution: the set of source files that more than one page declares.
90
+ *
91
+ * Computed over ALL pages at once — a single page cannot know it shares its
92
+ * `declared_at` with others. Counting happens on the `:line`-stripped path;
93
+ * only source files participate (an `AndroidManifest.xml` shared by many
94
+ * activities is normal and is rung 3's business, not rung 2's).
95
+ *
96
+ * @param {{declared_at?: string|null}[]} pages
97
+ * @returns {Set<string>} repo-relative paths declared by >1 page
98
+ */
99
+ export function sharedDeclaredAtOf(pages) {
100
+ const counts = new Map();
101
+ for (const page of pages) {
102
+ const raw = stripDeclaredLine(page?.declared_at ?? null);
103
+ if (raw === null) continue;
104
+ const p = normalize(raw);
105
+ if (!SOURCE_EXT_RE.test(p)) continue;
106
+ counts.set(p, (counts.get(p) ?? 0) + 1);
107
+ }
108
+ return new Set([...counts].filter(([, n]) => n > 1).map(([p]) => p));
109
+ }
110
+
111
+ /**
112
+ * Ask the graph for the file of the node named `label` (source resolution rung 2/3).
113
+ *
114
+ * Uses `findLabelFile`, not `findClassFile`: Compose routes are registered as
115
+ * `composable(...)` **function** nodes, so a class-only lookup returns null for
116
+ * exactly the pages rung 2 exists to disambiguate. Accepts either a real
117
+ * `DatabaseSync` (openReadOnly) or the two-method stand-in used by the tests.
118
+ *
119
+ * A label equal to `exclude` is treated as a miss: when the registration
120
+ * file declares the route under the filename's own name, the graph resolves the
121
+ * label back to the very file `declared_at` named, and "succeeding" with it
122
+ * would hand this page the registration file's footprint — the identical-surface
123
+ * ambiguity rung 2 rejects.
124
+ */
125
+ function labelFile(db, label, exclude = null) {
126
+ if (!db || typeof label !== "string" || label === "") return null;
127
+ // A stand-in db may expose only one of the two lookups; a real DatabaseSync
128
+ // exposes neither and is queried through `findLabelFile(db, ...)`.
129
+ const found = typeof db.findLabelFile === "function"
130
+ ? db.findLabelFile(label)
131
+ : typeof db.findClassFile === "function"
132
+ ? db.findClassFile(label)
133
+ : findLabelFile(db, label);
134
+ if (found === null || found === undefined) return null;
135
+ const p = normalize(found);
136
+ if (exclude !== null && p === exclude) return null;
137
+ return p;
138
+ }
139
+
140
+ /**
141
+ * source resolution — resolve one page to its source file.
142
+ *
143
+ * UniApp/hybrid records are dispatched to the UTG-artifact branch before any
144
+ * declaration rung. For every other record, declared source, shared
145
+ * registration, and Android Manifest are tried in order and the first hit wins;
146
+ * nothing else is inferred. In particular a rung-2 miss does NOT fall back to
147
+ * the shared registration file, because that would hand several routes the
148
+ * same footprint.
149
+ *
150
+ * @param {object} args
151
+ * @param {{page_id?: string, kind?: string|null, label?: string|null,
152
+ * declared_at?: string|null}} args.page
153
+ * @param {string} args.sourceProject
154
+ * @param {object|null} args.db homegraph handle (needed by rungs 2 and 3)
155
+ * @param {Set<string>} [args.sharedDeclaredAt] files declared by >1 page
156
+ * @returns {{file: string|null, by: string}}
157
+ * @throws {TypeError} when `page` is not an object.
158
+ */
159
+ export function resolvePageFiles({
160
+ page,
161
+ sourceProject,
162
+ db = null,
163
+ sharedDeclaredAt = new Set(),
164
+ } = {}) {
165
+ if (!page || typeof page !== "object") {
166
+ throw new TypeError("resolvePageFiles: page must be an object");
167
+ }
168
+ const declaredRaw = stripDeclaredLine(page.declared_at ?? null);
169
+ const declared = declaredRaw === null ? null : normalize(declaredRaw);
170
+ const isUniapp = page.kind === "hybrid-page"
171
+ || (typeof page.page_id === "string" && page.page_id.startsWith("hybrid-page:"))
172
+ || (declared !== null && PAGES_JSON_RE.test(declared));
173
+
174
+ // UniApp platform dispatch comes before every declaration-based rung. The
175
+ // page id identifies the record family only; it is never parsed as a route.
176
+ // Partial and legacy records cannot be rescued by declared_at, source_file,
177
+ // labels, candidates, or probes.
178
+ if (isUniapp) {
179
+ if (hasCompleteResolvedUniAppArtifact(page)) {
180
+ return { file: normalize(page.resolved_file), by: RESOLVE_BY.UNIAPP_ROUTE };
181
+ }
182
+ return { file: null, by: RESOLVE_BY.UNRESOLVED };
183
+ }
184
+
185
+ // Rung 1 / 2 — declared_at is already a source file.
186
+ if (declared !== null && SOURCE_EXT_RE.test(declared)) {
187
+ const shared = sharedDeclaredAt instanceof Set
188
+ ? sharedDeclaredAt.has(declared)
189
+ : false;
190
+ if (!shared) return { file: declared, by: RESOLVE_BY.DECLARED_AT };
191
+ const viaLabel = labelFile(db, page.label, declared);
192
+ if (viaLabel) return { file: viaLabel, by: RESOLVE_BY.REG_LABEL };
193
+ return { file: null, by: RESOLVE_BY.UNRESOLVED };
194
+ }
195
+
196
+ // Rung 3 — AndroidManifest.xml: the label is the activity class.
197
+ if (declared !== null && MANIFEST_RE.test(declared)) {
198
+ const viaLabel = labelFile(db, page.label);
199
+ if (viaLabel) return { file: viaLabel, by: RESOLVE_BY.MANIFEST_LABEL };
200
+ }
201
+
202
+ return { file: null, by: RESOLVE_BY.UNRESOLVED };
203
+ }
204
+
205
+ /**
206
+ * source resolution RUNTIME: is this path SDK/vendor output that the footprint must exclude?
207
+ *
208
+ * RUNTIME_RE is frozen verbatim, so three of its alternatives (`/www/`,
209
+ * `/assets/apps/`, `/dist/`) carry a leading slash and only match a rooted
210
+ * path. The bare filenames it also names (`uni-app-view.umd.js`,
211
+ * `vite.config.js`) are normally handed in unrooted, so the path is tested in
212
+ * both forms — the same rooting `roleOf` uses internally.
213
+ *
214
+ * `uni_modules/` is deliberately NOT here: footprint places it in role
215
+ * classification (`roleOf`), and duplicating it would split one rule in two.
216
+ */
217
+ export function isRuntime(file) {
218
+ if (typeof file !== "string") {
219
+ throw new TypeError(`isRuntime expects a path string, got ${typeof file}`);
220
+ }
221
+ const p = normalize(file);
222
+ return RUNTIME_RE.test(p) || RUNTIME_RE.test(`/${p}`);
223
+ }
224
+
225
+ /**
226
+ * `ctx` handed to `roleOf`, with null/undefined values dropped.
227
+ *
228
+ * `roleOf` THROWS on `wiringPaths: null` and on a null `sourceRoots`, but for
229
+ * our callers both mean the same thing as an absent key: "not determined".
230
+ * Dropping them is the one conversion that keeps that meaning, so a caller can
231
+ * pass a plain result object without pre-filtering it. Every other value is
232
+ * forwarded untouched — `roleOf`'s strictness is the point, and swallowing it
233
+ * here would let a vendored file be classified writable.
234
+ */
235
+ function normalizeCtx(ctx) {
236
+ if (ctx === null || ctx === undefined) return {};
237
+ if (typeof ctx !== "object") {
238
+ throw new TypeError(`computeFootprint: ctx must be an object, got ${typeof ctx}`);
239
+ }
240
+ const out = {};
241
+ for (const [k, v] of Object.entries(ctx)) {
242
+ if (v === null || v === undefined) continue;
243
+ out[k] = v;
244
+ }
245
+ return out;
246
+ }
247
+
248
+ function unresolvedKey(record) {
249
+ return stableDigest(record);
250
+ }
251
+
252
+ function sortUnresolved(records) {
253
+ const order = record => [
254
+ record.referring_file, record.locator, record.target_node_id, record.kind,
255
+ record.line ?? 0, record.col ?? 0, record.status ?? "",
256
+ ].map(value => String(value ?? "")).join("\u0000");
257
+ return records.sort((a, b) => {
258
+ const left = order(a);
259
+ const right = order(b);
260
+ return left < right ? -1 : left > right ? 1 : 0;
261
+ });
262
+ }
263
+
264
+ /**
265
+ * Resolve a page's composition origins while the graph is still open.
266
+ *
267
+ * Each `page.source_origins` record is routed through the same
268
+ * `resolvePageFiles` ladder as the page itself, so a folded overlay or an
269
+ * instance peer is never silently collapsed into the host's footprint. An
270
+ * origin that resolves to no file is still returned (with `resolvedFile:null`)
271
+ * and is also recorded as an unresolved reference: provenance is data, not an
272
+ * implementation detail.
273
+ */
274
+ function compositionOrigins({ page, sourceProject, db, sharedDeclaredAt }) {
275
+ const originUnits = (Array.isArray(page.source_origins) ? page.source_origins : [])
276
+ .map((origin) => {
277
+ const resolved = resolvePageFiles({
278
+ page: origin, sourceProject, db, sharedDeclaredAt,
279
+ });
280
+ return { origin, resolvedFile: resolved.file, by: resolved.by };
281
+ });
282
+
283
+ const pageReferring = stripDeclaredLine(page.declared_at ?? null);
284
+ const originUnresolved = [];
285
+ for (const unit of originUnits) {
286
+ if (unit.resolvedFile !== null) continue;
287
+ const origin = unit.origin ?? {};
288
+ const referring = stripDeclaredLine(origin.declared_at ?? null) ?? pageReferring;
289
+ originUnresolved.push({
290
+ referring_file: referring,
291
+ locator: origin.page_id ?? null,
292
+ target_node_id: origin.page_id ?? null,
293
+ kind: origin.kind ?? null,
294
+ });
295
+ }
296
+ return { originUnits, originUnresolved };
297
+ }
298
+
299
+ /**
300
+ * footprint — per-page implementation surface.
301
+ *
302
+ * For each page: resolve its file (source resolution), BFS it at depth 3 over the traversed
303
+ * edge kinds, drop runtime, then split what is left by `roleOf`:
304
+ *
305
+ * - `all` — everything reachable that is business code (consumed, wiring,
306
+ * writable). Runtime files are absent: they are SDK output, not the page.
307
+ * - `writable` — only role `writable`. `consumed` never enters it; a shared UI
308
+ * component or base class is not this page's contract to change.
309
+ * - `resolvedFile` — the source resolution result, or null. The estimator reads it for the
310
+ * `widgets`-empty `est` fallback, so it must always be present.
311
+ * - `origin_units` — every `page.source_origins` record resolved while the graph is
312
+ * open, as `{origin, resolvedFile, by}`. Folded overlays and instance peers
313
+ * remain separate units; folding never removes provenance.
314
+ * - `unresolved` — traversal and origin references whose target has no file,
315
+ * as `{referring_file, locator, target_node_id, kind}`. A NULL `file_path` is
316
+ * evidence, not a row to silently drop.
317
+ *
318
+ * @param {object} args
319
+ * @param {{page_id: string}[]} args.pages
320
+ * @param {string} args.sourceProject
321
+ * @param {object} args.db open homegraph handle; never null (索引前置条件 — no index,
322
+ * no downgrade)
323
+ * @param {object} [args.ctx] forwarded to `roleOf` (`wiringPaths`, `sourceRoots`)
324
+ * @returns {Map<string, {all: Set<string>, writable: Set<string>,
325
+ * resolvedFile: string|null, origin_units: object[], unresolved: object[]}>}
326
+ * @throws {TypeError} without a usable `db` or `sourceProject`, or when `ctx`
327
+ * is unusable.
328
+ */
329
+ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
330
+ if (!db) {
331
+ throw new TypeError(
332
+ "computeFootprint: db is required; never degrade to name heuristics",
333
+ );
334
+ }
335
+ if (!Array.isArray(pages)) {
336
+ throw new TypeError("computeFootprint: pages must be an array");
337
+ }
338
+ // Named up front: without it `path.join` throws a bare "The path argument
339
+ // must be of type string" from several frames down, which says nothing about
340
+ // which argument was wrong.
341
+ if (typeof sourceProject !== "string" || sourceProject === "") {
342
+ throw new TypeError("computeFootprint: sourceProject must be a non-empty string");
343
+ }
344
+ const roleCtx = normalizeCtx(ctx);
345
+ // Derived once for the whole run: a page cannot know it shares its
346
+ // `declared_at` with another, and rung 2 is the only defence against several
347
+ // pages inheriting one registration file's footprint.
348
+ const sharedDeclaredAt = sharedDeclaredAtOf(pages);
349
+
350
+ const out = new Map();
351
+ for (const page of pages) {
352
+ const { originUnits, originUnresolved } = compositionOrigins({
353
+ page, sourceProject, db, sharedDeclaredAt,
354
+ });
355
+ const { file } = resolvePageFiles({
356
+ page, sourceProject, db, sharedDeclaredAt,
357
+ });
358
+ if (file === null) {
359
+ out.set(page.page_id, {
360
+ all: new Set(),
361
+ writable: new Set(),
362
+ resolvedFile: null,
363
+ origin_units: originUnits,
364
+ unresolved: sortUnresolved(originUnresolved),
365
+ });
366
+ continue;
367
+ }
368
+
369
+ const all = new Set();
370
+ const writable = new Set();
371
+ const reached = bfsFileEvidence(db, [file], { depth: FOOTPRINT_DEPTH });
372
+ for (const raw of reached.resolved) {
373
+ const f = normalize(raw);
374
+ // `roleOf` is the single runtime authority: it tests the same frozen
375
+ // RUNTIME_RE against `"/" + p` and also carries the `uni_modules/` rule.
376
+ // A second `isRuntime` filter here would be dead (it can never change the
377
+ // outcome) and untestable — a stage two classifiers disagree on is how a
378
+ // vendored file slips into g00, so there is exactly one.
379
+ const role = roleOf(f, roleCtx);
380
+ if (role === "runtime") continue;
381
+ all.add(f);
382
+ if (role === "writable") writable.add(f);
383
+ }
384
+
385
+ const unresolvedByKey = new Map();
386
+ for (const record of [...reached.unresolved, ...originUnresolved]) {
387
+ const key = unresolvedKey(record);
388
+ if (!unresolvedByKey.has(key)) unresolvedByKey.set(key, record);
389
+ }
390
+
391
+ out.set(page.page_id, {
392
+ all: new Set([...all].sort()),
393
+ writable: new Set([...writable].sort()),
394
+ resolvedFile: file,
395
+ origin_units: originUnits,
396
+ unresolved: sortUnresolved([...unresolvedByKey.values()]),
397
+ });
398
+ }
399
+ return out;
400
+ }
401
+
402
+ /**
403
+ * Build the page-ownership index over source files.
404
+ *
405
+ * A page owns its body and the implementation files its body declares a direct
406
+ * dependency on. The question is answered backwards — which page body names
407
+ * this file's declaration? — because the forward footprint already collapsed
408
+ * many pages onto the same dependency, so "referenced by this page" cannot
409
+ * distinguish an owner from a bystander.
410
+ *
411
+ * The rule is deliberately one hop and declaration-level:
412
+ * - a body that imports, references or instantiates the file's declaration
413
+ * *is* its owner;
414
+ * - a body that only calls a member inherited or shared with other pages is
415
+ * not, and neither is a body that merely inherits the declaration —
416
+ * `extends`/`implements` (and the parallel import it drags along) mark a
417
+ * base class as shared infrastructure, which keeps base activities, base
418
+ * view models, result buses and navigation helpers ownerless (they mint
419
+ * no page-scoped claim);
420
+ * - a body file backing two page records (a Compose route and the pager tab
421
+ * that shows the same screen) is owned by both, because it is literally the
422
+ * same UI — unlike a shared dependency, which is not UI at all.
423
+ *
424
+ * No name affinity is ever consulted: renaming a screen or view model cannot
425
+ * change the answer.
426
+ *
427
+ * @param {object} args
428
+ * @param {import("node:sqlite").DatabaseSync|null} args.db homegraph handle; null
429
+ * disables resolution (every lookup returns an empty owner set) so fixtures
430
+ * stay offline
431
+ * @param {Map<string, {resolvedFile: string|null}>|object} args.footprint
432
+ * page_id -> footprint entry (same shape `computeFootprint` returns)
433
+ * @returns {{ownersOf: (file: string) => Set<string>,
434
+ * ownerOf: (file: string) => string|null,
435
+ * pageByBody: Map<string, Set<string>>}}
436
+ * `ownersOf` memoises per file; `ownerOf` is the unique-owner convenience
437
+ */
438
+ export function buildPageOwnerIndex({ db = null, footprint } = {}) {
439
+ const pageByBody = new Map();
440
+ const entries = types.isMap(footprint)
441
+ ? footprint.entries()
442
+ : Object.entries(footprint ?? {});
443
+ for (const [pageId, entry] of entries) {
444
+ const body = entry?.resolvedFile;
445
+ if (typeof body !== "string" || body === "") continue;
446
+ if (!pageByBody.has(body)) pageByBody.set(body, new Set());
447
+ pageByBody.get(body).add(pageId);
448
+ }
449
+
450
+ const cache = new Map();
451
+ const ownersOf = (file) => {
452
+ if (typeof file !== "string" || file === "") return new Set();
453
+ if (cache.has(file)) return cache.get(file);
454
+ if (pageByBody.has(file)) {
455
+ const bodyOwners = new Set(pageByBody.get(file));
456
+ cache.set(file, bodyOwners);
457
+ return bodyOwners;
458
+ }
459
+ if (db === null || typeof db?.prepare !== "function") {
460
+ const empty = new Set();
461
+ cache.set(file, empty);
462
+ return empty;
463
+ }
464
+ const owners = new Set();
465
+ for (const referrer of declarationReferrers(db, file)) {
466
+ for (const pageId of pageByBody.get(referrer) ?? []) owners.add(pageId);
467
+ }
468
+ cache.set(file, owners);
469
+ return owners;
470
+ };
471
+ const ownerOf = (file) => {
472
+ const owners = ownersOf(file);
473
+ return owners.size === 1 ? [...owners][0] : null;
474
+ };
475
+
476
+ return { ownersOf, ownerOf, pageByBody };
477
+ }
478
+
479
+ // ---------------------------------------------------------------------------
480
+ // Candidate keys, de-duplication, SPLIT and computed span.
481
+ // ---------------------------------------------------------------------------
482
+
483
+ /** Candidate keys, coarse to fine. Tie-breaks follow this order. */
484
+ export const KEY_ORDER = Object.freeze(["module", "feature", "parent", "route"]);
485
+
486
+ // Defaults. Callers may override via `params`.
487
+ const DEFAULT_MAX_PAGES = 12; // MAX_PAGES_PER_GROUP
488
+ const DEFAULT_CONCURRENCY = 8;
489
+ const DEFAULT_CONTRACTS_PER_GROUP = 8;
490
+
491
+ // Span convention: a group of N pages is predicted to need
492
+ // max(1, ceil(N / 4)) serial chunks. The acceptance runner imports the same constant.
493
+ export const PAGES_PER_CHUNK = 4;
494
+
495
+ // Foundation filter constants. `foundationFilter` is the single implementation;
496
+ // `g00Files` delegates to it so span uses the foundation-filtered g00.
497
+ const FOUNDATION_MIN_GROUPS = 10;
498
+ const FOUNDATION_FRACTION = 0.2;
499
+ const FOUNDATION_MIN_THRESHOLD = 3;
500
+
501
+ // `feature` markers (key selection `ui/screen/<域>/<功能>`, `pages/<x>`, `features/<x>`):
502
+ // `screen` keeps the domain AND function segment, `features` keeps one, and
503
+ // `pages`/`views` keep the whole route-like directory (`pages/order/list`).
504
+ // A marker with nothing after it names no feature and yields null.
505
+ const FEATURE_MARKERS = new Map([
506
+ ["screen", { extra: 2, withParent: "ui" }],
507
+ ["screens", { extra: 2, withParent: "ui" }],
508
+ ["features", { extra: 1 }],
509
+ ["feature", { extra: 1 }],
510
+ ["pages", { extra: Infinity }],
511
+ ["views", { extra: Infinity }],
512
+ ]);
513
+
514
+ /** Gradle module root of `file`: the path before its first `src/<sourceSet>/`. */
515
+ function moduleRootOf(file) {
516
+ const m = /^(?:(.*?)\/)?src\/[^/]+\//.exec(file);
517
+ if (!m) return null; // decompiled trees have no `src/<set>/` layer
518
+ return m[1] === undefined || m[1] === "" ? "." : m[1];
519
+ }
520
+
521
+ /** key selection `feature`: a directory path, never the file name; null when unmatched. */
522
+ function featureOf(dirs) {
523
+ for (let i = 0; i < dirs.length; i++) {
524
+ const rule = FEATURE_MARKERS.get(dirs[i].toLowerCase());
525
+ if (!rule) continue;
526
+ const after = dirs.length - i - 1;
527
+ if (after < 1) continue; // marker with no function directory under it
528
+ const start = rule.withParent && i > 0 && dirs[i - 1].toLowerCase() === rule.withParent
529
+ ? i - 1
530
+ : i;
531
+ const end = i + 1 + Math.min(after, rule.extra);
532
+ return dirs.slice(start, end).join("/");
533
+ }
534
+ return null;
535
+ }
536
+
537
+ /**
538
+ * key selection — the four candidate keys of one page.
539
+ *
540
+ * A key that cannot be derived is `null`, never `parent`: `module` needs a
541
+ * Gradle project (`ctx.hasGradle`) AND a `src/<set>/` layer, `route` needs a
542
+ * `pages.json` (`ctx.hasPagesJson`) AND a route emitted by UTG,
543
+ * `feature` needs a marker directory. `parent` is always derivable from a
544
+ * resolved file. If a key is null for every page it is unavailable for the
545
+ * project (key selection "该键不参与"), and it never becomes a `parent` copy.
546
+ *
547
+ * @param {string} pageId
548
+ * @param {string|null} file repo-relative source file, or null when unresolved
549
+ * @param {{hasGradle?: boolean, hasPagesJson?: boolean}} [ctx]
550
+ * @param {string|null} [route] complete route emitted by UTG
551
+ * @returns {{module: string|null, feature: string|null,
552
+ * parent: string|null, route: string|null}}
553
+ */
554
+ export function keysFor(pageId, file, ctx = {}, route = null) {
555
+ const c = ctx ?? {};
556
+ const out = { module: null, feature: null, parent: null, route: null };
557
+
558
+ // Route grouping consumes the UTG artifact, never a second page-id parse.
559
+ if (c.hasPagesJson && typeof route === "string" && route !== "") out.route = route;
560
+
561
+ if (typeof file !== "string" || file === "") return out;
562
+ const p = normalize(file);
563
+ if (p === "") return out;
564
+ // Absoluteness is kept, so `/a/b/C.java` and `a/b/C.java` stay distinct
565
+ // group keys instead of silently collapsing into one directory.
566
+ const absolute = p.startsWith("/");
567
+ const parts = p.split("/").filter((s) => s !== "");
568
+ const dirs = parts.slice(0, -1); // the file name is never part of a key
569
+ const joined = dirs.join("/");
570
+
571
+ out.parent = dirs.length === 0 ? (absolute ? "/" : ".") : (absolute ? `/${joined}` : joined);
572
+ out.feature = featureOf(dirs);
573
+ // `p` (not `joined`) so an absolute file yields an absolute module root, the
574
+ // same way `parent` keeps it; otherwise `/w/app/...` and `w/app/...` collide.
575
+ if (c.hasGradle) out.module = moduleRootOf(p);
576
+ return out;
577
+ }
578
+
579
+ /** `keys` may be a Map or a plain object keyed by page id. */
580
+ function keyOfPage(keys, id, key) {
581
+ const entry = keys instanceof Map ? keys.get(id) : keys?.[id];
582
+ const v = entry?.[key];
583
+ return typeof v === "string" && v !== "" ? v : null;
584
+ }
585
+
586
+ /**
587
+ * Canonical form of a grouping: a new Map whose entries are sorted by group
588
+ * name and whose member arrays are sorted ascending.
589
+ *
590
+ * Group names are unique strings, so the name sort is total; that makes the
591
+ * grouping a function of the page SET alone, never of the order the caller
592
+ * enumerated pages in. `inventory.mjs` emits pages in `utg.json` node order,
593
+ * which is unsorted, so without this the same page set produced two different
594
+ * groupings depending on where the pages happened to sit in the file.
595
+ */
596
+ function canonicalGroups(groups) {
597
+ return new Map([...groups]
598
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
599
+ .map(([name, members]) => [name, [...members].sort()]));
600
+ }
601
+
602
+ /**
603
+ * Fold page ids into groups by `keyFn`, returning the canonical grouping:
604
+ * entries sorted by group name, members sorted ascending, so the result depends
605
+ * only on the page set and not on the order `ids` was given in (over-cap splitting
606
+ * "确定性切分"). Group order is therefore alphabetical, not first-appearance.
607
+ *
608
+ * A page whose key is null/undefined/"" is an orphan (key selection "页面缺键当孤儿
609
+ * 处理"): it gets its own `orphan/<id>` group, so one unresolved page cannot
610
+ * make the whole key unusable nor join a group it does not belong to.
611
+ *
612
+ * A repeated id is folded once. Two entries for one page are the same page, and
613
+ * letting them through would inflate `largest` (and so the chunk count, the
614
+ * span, and possibly the fit/over-cap verdict) for a reason that has nothing to
615
+ * do with the grouping — a page listed twice is not two pages.
616
+ *
617
+ * @param {string[]} ids
618
+ * @param {(id: string) => string|null|undefined} keyFn
619
+ * @returns {Map<string, string[]>}
620
+ */
621
+ export function groupsFrom(ids, keyFn) {
622
+ const groups = new Map();
623
+ const seen = new Set();
624
+ for (const id of ids) {
625
+ if (seen.has(id)) continue;
626
+ seen.add(id);
627
+ const k = keyFn(id);
628
+ const name = typeof k === "string" && k !== "" ? k : `orphan/${id}`;
629
+ if (!groups.has(name)) groups.set(name, []);
630
+ groups.get(name).push(id);
631
+ }
632
+ return canonicalGroups(groups);
633
+ }
634
+
635
+ /**
636
+ * over-cap splitting — bring an over-cap key's groups under `maxPages`.
637
+ *
638
+ * Each over-cap group is re-split by the next finer key that actually divides
639
+ * it, descending KEY_ORDER after `key`; a finer key that yields a single
640
+ * sub-group is skipped rather than silently accepted. Whatever is still over
641
+ * the cap after every finer key is cut deterministically: ids sorted, dealt
642
+ * round-robin into `ceil(n / maxPages)` slices, each reported in `artificial`
643
+ * (lossy — one slice may hold unrelated pages, so the report lists them).
644
+ *
645
+ * Every output order here — group order, member order, slice order — depends
646
+ * only on the page SET, never on the order `ids` was given in. That is what
647
+ * makes the grouping report reproducible across runs; the caller writes it to
648
+ * disk so consumers can compare it byte for byte. Concretely: members are
649
+ * sorted ascending, group names are sorted ascending on the way out, and
650
+ * `artificial` is sorted by `group`. The `#N` slice suffixes are assigned
651
+ * before the sort, so sorting never renumbers a slice.
652
+ *
653
+ * @param {string[]} ids
654
+ * @param {Map|object} keys page id -> keysFor() result
655
+ * @param {string} key the over-cap key
656
+ * @param {{maxPages?: number}} [opts]
657
+ * @returns {{groups: Map<string,string[]>,
658
+ * artificial: {group: string, from: string, pages: string[]}[]}}
659
+ */
660
+ export function splitOverCap(ids, keys, key, { maxPages = DEFAULT_MAX_PAGES } = {}) {
661
+ const at = KEY_ORDER.indexOf(key);
662
+ if (at < 0) throw new TypeError(`splitOverCap: unknown key ${JSON.stringify(key)}`);
663
+ if (!Number.isInteger(maxPages) || maxPages < 1) {
664
+ throw new TypeError(`splitOverCap: maxPages must be a positive integer, got ${maxPages}`);
665
+ }
666
+ const groups = new Map();
667
+ const artificial = [];
668
+
669
+ const refine = (name, members, finer) => {
670
+ if (members.length <= maxPages) {
671
+ groups.set(name, members);
672
+ return;
673
+ }
674
+ if (finer.length === 0) {
675
+ const sorted = [...members].sort();
676
+ const n = Math.ceil(sorted.length / maxPages);
677
+ const slices = Array.from({ length: n }, () => []);
678
+ sorted.forEach((id, i) => slices[i % n].push(id));
679
+ slices.forEach((pages, i) => {
680
+ const slice = `${name}#${i + 1}`;
681
+ groups.set(slice, pages);
682
+ artificial.push({ group: slice, from: name, pages });
683
+ });
684
+ return;
685
+ }
686
+ const [next, ...rest] = finer;
687
+ // `members` arrives sorted (see the entry loop), so `sub`'s insertion order
688
+ // — which is the emitted group order — and the member order inside each
689
+ // sub-group are both a function of the page SET, not of the order the
690
+ // caller happened to enumerate pages in.
691
+ const sub = new Map();
692
+ for (const id of members) {
693
+ const v = keyOfPage(keys, id, next);
694
+ const sk = v === null ? `${name}|(none)` : `${name}|${v}`;
695
+ if (!sub.has(sk)) sub.set(sk, []);
696
+ sub.get(sk).push(id);
697
+ }
698
+ if (sub.size === 1) {
699
+ refine(name, members, rest); // this key does not divide the group
700
+ return;
701
+ }
702
+ for (const [sk, m] of sub) refine(sk, m, rest);
703
+ };
704
+
705
+ // `groupsFrom` hands back the canonical grouping (groups sorted by name,
706
+ // members sorted ascending), so every branch below — the finer-key descent
707
+ // included — sees members in an order that is a function of the page set.
708
+ // Both returned collections are canonicalised again on the way out, because
709
+ // this function appends to them in descent order rather than name order.
710
+ const base = groupsFrom(ids, (id) => keyOfPage(keys, id, key));
711
+ const finer = KEY_ORDER.slice(at + 1);
712
+ for (const [name, members] of base) refine(name, members, finer);
713
+ // Sort AFTER the slices were built: the `#N` suffixes are already fixed, so
714
+ // this reorders the report without renumbering a slice.
715
+ artificial.sort((a, b) => (a.group < b.group ? -1 : a.group > b.group ? 1 : 0));
716
+ return { groups: canonicalGroups(groups), artificial };
717
+ }
718
+
719
+ /**
720
+ * Writable file set of one page; accepts a Map or object, Set or `{writable}`.
721
+ *
722
+ * Brand-based `types.isMap`, not `instanceof`: `buildPlan` accepts a `Map` whose
723
+ * prototype has been rearranged (see `isFootprintIndex`), and `instanceof` would
724
+ * then fall through to the object lookup and silently find nothing.
725
+ */
726
+ function writableOf(footprint, id) {
727
+ // `Map.prototype.get.call`, not `footprint.get`: a brand-Map whose prototype
728
+ // has been rearranged has no own `.get`, and `map.get(...)` would throw on it.
729
+ const v = types.isMap(footprint) ? Map.prototype.get.call(footprint, id) : footprint?.[id];
730
+ if (v instanceof Set) return v;
731
+ if (v && v.writable instanceof Set) return v.writable;
732
+ return new Set();
733
+ }
734
+
735
+ /**
736
+ * g00 file set for one grouping: writable files owned by >= 2 groups, minus foundation files
737
+ * once there are >= 10 groups. `foundationFilter` owns the threshold; this function builds the
738
+ * owners map and delegates.
739
+ */
740
+ function g00Files(ids, footprint, groups) {
741
+ const groupOf = new Map();
742
+ for (const [name, members] of groups) for (const id of members) groupOf.set(id, name);
743
+ const owners = new Map();
744
+ for (const id of ids) {
745
+ const g = groupOf.get(id);
746
+ if (g === undefined) continue;
747
+ for (const f of writableOf(footprint, id)) {
748
+ if (!owners.has(f)) owners.set(f, new Set());
749
+ owners.get(f).add(g);
750
+ }
751
+ }
752
+ return [...foundationFilter(owners, groups.size, {}).g00].sort();
753
+ }
754
+
755
+ function spanParams(opts = {}) {
756
+ const concurrency = opts.concurrency ?? DEFAULT_CONCURRENCY;
757
+ const contractsPerGroup = opts.contractsPerGroup ?? DEFAULT_CONTRACTS_PER_GROUP;
758
+ for (const [k, v] of [["concurrency", concurrency], ["contractsPerGroup", contractsPerGroup]]) {
759
+ if (!Number.isInteger(v) || v < 1) {
760
+ throw new TypeError(`${k} must be a positive integer, got ${v}`);
761
+ }
762
+ }
763
+ return { concurrency, contractsPerGroup };
764
+ }
765
+
766
+ /** Span plus the g00 size used for the calculation. */
767
+ function measure(ids, footprint, groups, opts) {
768
+ const { concurrency, contractsPerGroup } = spanParams(opts);
769
+ const g00 = g00Files(ids, footprint, groups);
770
+
771
+ const buckets = new Map();
772
+ for (const f of g00) {
773
+ const b = bucketOf(f);
774
+ buckets.set(b, (buckets.get(b) ?? 0) + 1);
775
+ }
776
+ const bucketChunks = [...buckets.values()].map((n) => Math.ceil(n / contractsPerGroup));
777
+ const wave1 = bucketChunks.length ? Math.max(...bucketChunks) : 0;
778
+
779
+ const groupChunks = [...groups.values()]
780
+ .map((m) => Math.max(1, Math.ceil(m.length / PAGES_PER_CHUNK)));
781
+ const maxGroup = groupChunks.length ? Math.max(...groupChunks) : 0;
782
+ // span/estimation "wave2 = max(最大功能组的 chunk 数, ceil((总功能 chunk + 总契约 chunk) / 8))".
783
+ const total = groupChunks.reduce((a, b) => a + b, 0)
784
+ + bucketChunks.reduce((a, b) => a + b, 0);
785
+ const wave2 = Math.max(maxGroup, Math.ceil(total / concurrency));
786
+ return { span: wave1 + wave2, g00: g00.length };
787
+ }
788
+
789
+ /**
790
+ * span = wave1 + wave2 (a parallel-depth proxy, not wall time).
791
+ *
792
+ * - wave1 = the largest g00 bucket's chunks, `ceil(bucketSize / contractsPerGroup)`;
793
+ * - wave2 = `max(maxGroupChunks, ceil(totalChunks / concurrency))`, with
794
+ * `chunk = max(1, ceil(groupPages / 4))` and totalChunks counting functional
795
+ * groups plus g00 bucket chunks.
796
+ *
797
+ * g00 is foundation-filtered so the span uses the same g00 the pipeline will create.
798
+ *
799
+ * @param {string[]} ids
800
+ * @param {Map|object} footprintByPage page id -> writable Set | {writable}
801
+ * @param {Map<string,string[]>} groups
802
+ * @param {{concurrency?: number, contractsPerGroup?: number}} [opts]
803
+ * @returns {number}
804
+ */
805
+ export function computeSpan(ids, footprintByPage, groups, opts = {}) {
806
+ return measure(ids, footprintByPage, groups, opts).span;
807
+ }
808
+
809
+ /**
810
+ * The four numbers `grouping-report.json` publishes per candidate. Two
811
+ * candidates with the same tuple are indistinguishable in the report, which is
812
+ * exactly the acceptance failure ("两条 groups/largest/g00/span 全等而 key 不同").
813
+ *
814
+ * Gating de-duplication on this tuple instead of on set equality is both
815
+ * sufficient and strictly stronger: an identical partition necessarily has the
816
+ * same group count, the same largest group, the same writable-file sets — hence
817
+ * the same g00 and span — so `frozenset(frozenset(group))` equality always
818
+ * lands in the same tuple. Testing the tuple therefore covers partition equality and additionally
819
+ * catches distinct partitions that happen to report identical numbers.
820
+ */
821
+ function reportTuple(candidate) {
822
+ return `${candidate.groups}|${candidate.largest}|${candidate.g00}|${candidate.span}`;
823
+ }
824
+
825
+ /**
826
+ * key selection — pick the grouping key with the smallest computed span.
827
+ *
828
+ * Per key in KEY_ORDER:
829
+ * - null for every page -> `unavailable[]`; NOT a candidate and never a parent
830
+ * copy (that degradation is what produced twin candidates);
831
+ * - largest group <= maxPages -> candidate `<key>`, verdict `fit`;
832
+ * - otherwise the SPLIT result is the candidate `<key>+SPLIT`, verdict
833
+ * `over-cap`, with `bare_largest` recording how far the bare key overflowed —
834
+ * over-cap is a different outcome from unavailable, not the same bucket;
835
+ * - a candidate whose `groups`/`largest`/`g00`/`span` tuple equals an earlier
836
+ * one is withheld from `candidates[]` and listed in `deduped[]` as
837
+ * `dedup_of:<kept key>`. That tuple is how the report presents a candidate and
838
+ * how acceptance judges twins, and an identical partition always lands in it (see
839
+ * {@link reportTuple}), so this also covers identical `frozenset` partitions.
840
+ * Keys are visited coarse to fine, so the kept one is the coarser / more apt
841
+ * label; withholding a twin cannot change the outcome, since equal numbers
842
+ * require equal span and the tie-break already prefers the kept coarser key.
843
+ *
844
+ * The winner has the minimum span; ties go to the coarser key (KEY_ORDER, i.e.
845
+ * module > feature > parent > route). Fewest-groups is not a valid span proxy.
846
+ *
847
+ * Both `chosen.groups` and `chosen.artificial` come from `groupsFrom` /
848
+ * `splitOverCap`, so they are canonical: group order and `artificial` order are
849
+ * sorted by name, and members ascending. The output depends only on the page
850
+ * SET, not on the order `ids` was given in. `g<NN>-<slug>` directory numbering and the byte-for-byte
851
+ * `grouping-report.json` comparison rely on. Group order is alphabetical
852
+ * rather than first-appearance; no consumer depends on first-appearance.
853
+ *
854
+ * `chosen` is null when no key is available at all: there is nothing to group
855
+ * by, and inventing a grouping would be the silent fallback key selection forbids.
856
+ *
857
+ * @param {object} args
858
+ * @param {string[]} args.ids
859
+ * @param {Map|object} args.keys page id -> keysFor() result
860
+ * @param {Map|object} args.footprint page id -> writable Set | {writable}
861
+ * @param {{concurrency?: number, contractsPerGroup?: number, maxPages?: number}} [args.params]
862
+ * @returns {{chosen: {label: string, groups: Map<string,string[]>,
863
+ * artificial: object[]}|null,
864
+ * candidates: {key: string, groups: number, largest: number,
865
+ * g00: number, span: number, verdict: "fit"|"over-cap"}[],
866
+ * unavailable: {key: string, verdict: "unavailable"}[],
867
+ * deduped: {key: string, verdict: string}[]}}
868
+ */
869
+ export function chooseCandidate({ ids, keys, footprint, params } = {}) {
870
+ if (!Array.isArray(ids)) throw new TypeError("chooseCandidate: ids must be an array");
871
+ // `params` destructured without a default and then guarded: `params: null`
872
+ // would otherwise surface as "Cannot read properties of null", which names
873
+ // nothing. An absent params means "all defaults", a null one is a caller bug.
874
+ if (params === undefined) params = {};
875
+ if (params === null || typeof params !== "object") {
876
+ throw new TypeError(`chooseCandidate: params must be an object, got ${params}`);
877
+ }
878
+ const maxPages = params.maxPages ?? DEFAULT_MAX_PAGES;
879
+ if (!Number.isInteger(maxPages) || maxPages < 1) {
880
+ throw new TypeError(`chooseCandidate: maxPages must be a positive integer, got ${maxPages}`);
881
+ }
882
+ const spanOpts = { concurrency: params.concurrency, contractsPerGroup: params.contractsPerGroup };
883
+ spanParams(spanOpts);
884
+
885
+ const unavailable = [];
886
+ const deduped = [];
887
+ const kept = []; // {order, candidate, groups, artificial}
888
+ const seen = new Map(); // report tuple -> kept label
889
+
890
+ KEY_ORDER.forEach((key, order) => {
891
+ if (ids.every((id) => keyOfPage(keys, id, key) === null)) {
892
+ unavailable.push({ key, verdict: "unavailable" });
893
+ return;
894
+ }
895
+ const bare = groupsFrom(ids, (id) => keyOfPage(keys, id, key));
896
+ const bareLargest = Math.max(...[...bare.values()].map((m) => m.length));
897
+ let label = key;
898
+ let groups = bare;
899
+ let artificial = [];
900
+ let verdict = "fit";
901
+ if (bareLargest > maxPages) {
902
+ ({ groups, artificial } = splitOverCap(ids, keys, key, { maxPages }));
903
+ label = `${key}+SPLIT`;
904
+ verdict = "over-cap";
905
+ }
906
+
907
+ const { span, g00 } = measure(ids, footprint, groups, spanOpts);
908
+ const candidate = {
909
+ key: label,
910
+ groups: groups.size,
911
+ largest: Math.max(...[...groups.values()].map((m) => m.length)),
912
+ g00,
913
+ span,
914
+ verdict,
915
+ };
916
+
917
+ const tuple = reportTuple(candidate);
918
+ if (seen.has(tuple)) {
919
+ deduped.push({ key: label, verdict: `dedup_of:${seen.get(tuple)}` });
920
+ return;
921
+ }
922
+ // Claim the tuple only once this label is retained, so a withheld candidate
923
+ // can never become the `dedup_of` target of a later one.
924
+ seen.set(tuple, label);
925
+
926
+ if (verdict === "over-cap") candidate.bare_largest = bareLargest;
927
+ kept.push({ order, candidate, groups, artificial });
928
+ });
929
+
930
+ let best = null;
931
+ for (const k of kept) {
932
+ if (best === null
933
+ || k.candidate.span < best.candidate.span
934
+ || (k.candidate.span === best.candidate.span && k.order < best.order)) {
935
+ best = k;
936
+ }
937
+ }
938
+ return {
939
+ chosen: best === null
940
+ ? null
941
+ : { label: best.candidate.key, groups: best.groups, artificial: best.artificial },
942
+ candidates: kept.map((k) => k.candidate),
943
+ unavailable,
944
+ deduped,
945
+ };
946
+ }
947
+
948
+ // ---------------------------------------------------------------------------
949
+ // Foundation filtering, dependencies, estimation, SPEC units, and the downstream plan object.
950
+ //
951
+ // Shapes (this project has no TypeScript; these comments are the contract):
952
+ // Plan = {plan_version, inputs, params, page_enumeration, pages,
953
+ // unclassified, orphan_overlays, foundation_files,
954
+ // key_context, spec_units, groups, grouping}
955
+ // SpecUnit = {spec_id, page_id, part, parts, dir, est, status_domain}
956
+ // Group = {group_id, dir, kind: "shared"|"page", pages: string[],
957
+ // spec_ids: string[], deps: string[], deps_reason: string[], est_scenarios: number}
958
+ // ---------------------------------------------------------------------------
959
+
960
+ // EST trigger patterns for the source-file fallback. ViewModel injection is an architecture
961
+ // pattern, not a user-visible trigger, so `hiltViewModel` / `viewModel` are absent.
962
+ const EST_SIG_RE =
963
+ /\bsetOnClickListener\b|\bonClick\s*[=({]|\bsetOnRefreshListener\b|\bonRefresh\b/;
964
+
965
+ // Comment lines start with `*`, `//` or `/*` after trimming.
966
+ function isCommentLine(line) {
967
+ const t = line.trim();
968
+ return t.startsWith("//") || t.startsWith("*") || t.startsWith("/*");
969
+ }
970
+
971
+ /** SIG hits in `file`, or `null` when the file cannot be read. */
972
+ function countSigHits(file) {
973
+ if (typeof file !== "string" || file === "") return null;
974
+ let text;
975
+ try {
976
+ text = fs.readFileSync(file, "utf8");
977
+ } catch {
978
+ // A page whose source could not be resolved is the ladder's rung 5 — a
979
+ // normal outcome, not an error (source resolution). No throw.
980
+ return null;
981
+ }
982
+ let hits = 0;
983
+ for (const line of text.split(/\r?\n/)) {
984
+ if (isCommentLine(line)) continue;
985
+ if (EST_SIG_RE.test(line)) hits += 1;
986
+ }
987
+ return hits;
988
+ }
989
+
990
+ /**
991
+ * Trigger widgets: `kind === "action"`, `role ∈ {action, trigger}`,
992
+ * `is_trigger === true`, or a present `gesture_param` / `composable`.
993
+ *
994
+ * "Present" excludes `null`/`undefined`/`""`/`false`: the interaction scanner
995
+ * emits `gesture_param: null` on every signal, and treating that as a trigger
996
+ * would count each signal twice.
997
+ */
998
+ function isTriggerWidget(w) {
999
+ if (!w || typeof w !== "object") return false;
1000
+ if (w.kind === "action") return true;
1001
+ if (w.role === "action" || w.role === "trigger") return true;
1002
+ if (w.is_trigger === true) return true;
1003
+ if (w.gesture_param !== null && w.gesture_param !== undefined && w.gesture_param !== "") {
1004
+ return true;
1005
+ }
1006
+ if (w.composable !== null && w.composable !== undefined
1007
+ && w.composable !== false && w.composable !== "") {
1008
+ return true;
1009
+ }
1010
+ return false;
1011
+ }
1012
+
1013
+ const countOf = (v) => (Array.isArray(v) ? v.length : 0);
1014
+
1015
+ /**
1016
+ * Expected scenario count of one page.
1017
+ *
1018
+ * `est(P) = 1 + |out_edges(P)| + 触发控件数 + 交互信号数`
1019
+ *
1020
+ * When `widgets` is empty (or absent) utg-static extracted no widget evidence —
1021
+ * the Compose `entry<Route> { Screen() }` shape — so the formula switches to
1022
+ * `1 + |out_edges| + SIG hits` over the resolved UI source file. The interaction
1023
+ * term is NOT added there: both scan the same file for the same patterns, and
1024
+ * adding them double-counts (span/estimation "不重复计数"). Unreadable or absent
1025
+ * `resolvedFile` degrades to `1 + |out_edges|`.
1026
+ *
1027
+ * `resolvedFile` is a path this function can open. `buildPlan` resolves the
1028
+ * footprint entry (a repo-relative path) against `inputs.sourceProject` before
1029
+ * calling; a caller holding an absolute path may pass it straight through.
1030
+ *
1031
+ * @param {{out_edges?: object[], widgets?: object[]|null,
1032
+ * interactions?: object[]}} page
1033
+ * @param {string|null} [resolvedFile]
1034
+ * @returns {number}
1035
+ * @throws {TypeError} when `page` is not an object.
1036
+ */
1037
+ export function estOf(page, resolvedFile = null) {
1038
+ if (!page || typeof page !== "object") {
1039
+ throw new TypeError("estOf: page must be an object");
1040
+ }
1041
+ const edges = countOf(page.out_edges);
1042
+ const widgets = Array.isArray(page.widgets) ? page.widgets : null;
1043
+ if (widgets !== null && widgets.length > 0) {
1044
+ const triggers = widgets.filter(isTriggerWidget).length;
1045
+ return 1 + edges + triggers + countOf(page.interactions);
1046
+ }
1047
+ const hits = countSigHits(resolvedFile);
1048
+ return hits === null ? 1 + edges : 1 + edges + hits;
1049
+ }
1050
+
1051
+ /**
1052
+ * Split the shared-file set into g00 (contract writers) and foundation
1053
+ * (project-wide infrastructure).
1054
+ *
1055
+ * `foundationFilter` owns this threshold. `g00Files` delegates here, so span uses exactly the g00
1056
+ * the plan publishes.
1057
+ *
1058
+ * - `nGroups >= 10`: `threshold = max(3, ceil(nGroups * 0.20))`; a file with
1059
+ * `|owners| >= threshold` is foundation (excluded, no contract); a file with
1060
+ * `2 <= |owners| < threshold` is g00.
1061
+ * - otherwise no foundation filter: `|owners| >= 2` is g00.
1062
+ *
1063
+ * Foundation files are not "unspecified": they are the project's runtime base,
1064
+ * referenced on demand by downstream coders and outside this skill's remit
1065
+ * (g00/foundation). They are returned in their own set so the report can list them.
1066
+ *
1067
+ * @param {Map<string, Set<string>>} owners file -> owning group names
1068
+ * @param {number} nGroups
1069
+ * @param {{minGroups?: number, fraction?: number, minThreshold?: number}} [params]
1070
+ * optional overrides of the three foundation constants.
1071
+ * @returns {{g00: Set<string>, foundation: Set<string>}}
1072
+ * @throws {TypeError} on a non-Map `owners`, a non-integer `nGroups`, a
1073
+ * non-Set owner value, or an unusable override.
1074
+ */
1075
+ export function foundationFilter(owners, nGroups, params = {}) {
1076
+ if (!(owners instanceof Map)) {
1077
+ throw new TypeError("foundationFilter: owners must be a Map of file -> Set<group>");
1078
+ }
1079
+ if (!Number.isInteger(nGroups) || nGroups < 0) {
1080
+ throw new TypeError(
1081
+ `foundationFilter: nGroups must be a non-negative integer, got ${nGroups}`,
1082
+ );
1083
+ }
1084
+ const p = params === undefined ? {} : params;
1085
+ if (p === null || typeof p !== "object") {
1086
+ throw new TypeError(`foundationFilter: params must be an object, got ${p}`);
1087
+ }
1088
+ const minGroups = p.minGroups ?? FOUNDATION_MIN_GROUPS;
1089
+ const fraction = p.fraction ?? FOUNDATION_FRACTION;
1090
+ const minThreshold = p.minThreshold ?? FOUNDATION_MIN_THRESHOLD;
1091
+ if (!Number.isInteger(minGroups) || minGroups < 0) {
1092
+ throw new TypeError(`foundationFilter: minGroups must be a non-negative integer, got ${minGroups}`);
1093
+ }
1094
+ if (typeof fraction !== "number" || !(fraction > 0) || fraction > 1) {
1095
+ throw new TypeError(`foundationFilter: fraction must be in (0, 1], got ${fraction}`);
1096
+ }
1097
+ if (!Number.isInteger(minThreshold) || minThreshold < 1) {
1098
+ throw new TypeError(`foundationFilter: minThreshold must be a positive integer, got ${minThreshold}`);
1099
+ }
1100
+
1101
+ const threshold = nGroups >= minGroups
1102
+ ? Math.max(minThreshold, Math.ceil(nGroups * fraction))
1103
+ : Infinity;
1104
+ const g00 = new Set();
1105
+ const foundation = new Set();
1106
+ for (const [file, set] of owners) {
1107
+ if (!(set instanceof Set)) {
1108
+ throw new TypeError(
1109
+ `foundationFilter: owners.get(${JSON.stringify(file)}) must be a Set of group names`,
1110
+ );
1111
+ }
1112
+ if (isExcludedEvidencePath(file)) continue;
1113
+ if (set.size >= threshold) foundation.add(file);
1114
+ else if (set.size >= 2) g00.add(file); }
1115
+ return { g00, foundation };
1116
+ }
1117
+
1118
+ /** Normalised + validated build parameters (Global Constraints defaults). */
1119
+ function planParams(params) {
1120
+ const p = params === undefined ? {} : params;
1121
+ if (p === null || typeof p !== "object") {
1122
+ throw new TypeError(`buildPlan: params must be an object, got ${p}`);
1123
+ }
1124
+ const out = {
1125
+ concurrency: p.concurrency ?? DEFAULT_CONCURRENCY,
1126
+ contractsPerGroup: p.contractsPerGroup ?? DEFAULT_CONTRACTS_PER_GROUP,
1127
+ maxPages: p.maxPages ?? DEFAULT_MAX_PAGES,
1128
+ };
1129
+ for (const [k, v] of Object.entries(out)) {
1130
+ if (!Number.isInteger(v) || v < 1) {
1131
+ throw new TypeError(`buildPlan: ${k} must be a positive integer, got ${v}`);
1132
+ }
1133
+ }
1134
+ return out;
1135
+ }
1136
+
1137
+ /**
1138
+ * key selection platform applicability, detected from the source root.
1139
+ *
1140
+ * `keysFor` takes these as `ctx` flags so it stays a pure function; `buildPlan`
1141
+ * has the source root and derives them once. Detection is deliberately here and
1142
+ * nowhere else — a caller-supplied flag and a detection rule would be two
1143
+ * sources of truth for the same gate, and the failure mode of getting it wrong
1144
+ * is silent (every page falls to `parent`, key selection "键有平台适用性"). Because it is
1145
+ * silent, the result is published in the Plan as `key_context`.
1146
+ *
1147
+ * Absent/unreadable `sourceProject` is a supported mode and yields both false —
1148
+ * it does NOT throw, so a caller without a source tree still gets a plan, with
1149
+ * every page as a `parent` group or an orphan.
1150
+ *
1151
+ * `hasPagesJson` uses the route artifact already present on UTG pages, plus the
1152
+ * existing root-file platform check. It never discovers or reparses app roots.
1153
+ */
1154
+ function keyContextOf(sourceProject, pages = []) {
1155
+ const none = { hasGradle: false, hasPagesJson: false };
1156
+ if (typeof sourceProject !== "string" || sourceProject === "") return none;
1157
+ let hasPagesJson = false;
1158
+ try {
1159
+ hasPagesJson = fs.existsSync(path.join(sourceProject, "pages.json"))
1160
+ || pages.some((page) => typeof page?.route === "string" && page.route !== "");
1161
+ } catch {
1162
+ hasPagesJson = false;
1163
+ }
1164
+ let hasGradle = false;
1165
+ try {
1166
+ hasGradle = fs.readdirSync(sourceProject)
1167
+ .some((e) => /^(settings\.gradle|build\.gradle)/i.test(e));
1168
+ } catch {
1169
+ hasGradle = false;
1170
+ }
1171
+ return { hasGradle, hasPagesJson };
1172
+ }
1173
+
1174
+ /**
1175
+ * `g<NN>-<slug>` for a page group (g00/foundation / output directory layout).
1176
+ *
1177
+ * `NN` comes from the group's position in the canonical (alphabetical) grouping,
1178
+ * so the same page set always numbers the same way. The prefix is unique per NN,
1179
+ * so two groups can never share a directory even when their names slugify
1180
+ * identically — and a shared directory would silently merge two coders'
1181
+ * worktrees (format).
1182
+ */
1183
+ function pageDirOf(n, name) {
1184
+ return `g${String(n).padStart(2, "0")}-${slugify(name) || "group"}`;
1185
+ }
1186
+
1187
+ // Built-ins that are object-shaped but are never a page-id index. Checked by
1188
+ // brand (`util.types`) rather than `instanceof` for the same reason
1189
+ // `isFootprintIndex` does: `instanceof` reads the prototype, and the prototype
1190
+ // is the thing a caller can change.
1191
+ //
1192
+ // Arrays are NOT in this list only because `node:util`'s `types` has no
1193
+ // `isArray`; they are rejected by an explicit `Array.isArray` in
1194
+ // `isFootprintIndex` before this table is consulted. `Array.isArray` is itself a
1195
+ // brand check and does not read the prototype, so a rearranged array is still
1196
+ // caught — see the comments there.
1197
+ //
1198
+ // `Map` is deliberately absent: `types.isMap(v)` returns true before this table
1199
+ // is reached, so an entry would be dead code that reads as if Maps were rejected.
1200
+ const NON_INDEX_BRANDS = [
1201
+ ["Set", types.isSet],
1202
+ ["Date", types.isDate],
1203
+ ["RegExp", types.isRegExp],
1204
+ ["Promise", types.isPromise],
1205
+ ["WeakMap", types.isWeakMap],
1206
+ ["WeakSet", types.isWeakSet],
1207
+ ["ArrayBuffer", types.isArrayBuffer],
1208
+ ["typed array", types.isTypedArray],
1209
+ ["Error", types.isNativeError],
1210
+ ];
1211
+
1212
+ /**
1213
+ * Is `v` an acceptable `footprint` argument?
1214
+ *
1215
+ * The rule, stated plainly: **a `Map`, or an object whose prototype is
1216
+ * `Object.prototype` or `null` and which carries none of the `NON_INDEX_BRANDS`
1217
+ * above and is not an array.** Nothing else is accepted, apart from the limits
1218
+ * recorded at the end of this comment.
1219
+ *
1220
+ * Why the bar is this narrow: `footprintOf` does exactly two lookups —
1221
+ * `map.get(id)` and `obj[id]`. Any other value is read as "every page
1222
+ * unresolved", which yields a valid-looking plan with no g00, no contract units
1223
+ * and no deps — the silent empty-plan failure this guard exists to prevent.
1224
+ *
1225
+ * Why `null`-prototype objects ARE accepted: `Object.create(null)` is the
1226
+ * ordinary way to build a lookup table in JS, and it is a legitimate page-id
1227
+ * index. But a `null` prototype alone does not mean "plain index" —
1228
+ * `Object.setPrototypeOf(new Set(), null)` also has one. So the prototype test
1229
+ * is paired with brand tests: a non-index built-in is rejected however its
1230
+ * prototype has been rearranged. `Object.create(null)` carries none of those
1231
+ * brands and passes; a `Set`, a `Date`, a `RegExp`, a `Promise` or an array
1232
+ * does not, prototype or no prototype. Arrays are caught by `Array.isArray`,
1233
+ * also a brand check, kept out of the table only because `node:util`'s `types`
1234
+ * has no `isArray`.
1235
+ *
1236
+ * `instanceof` is deliberately NOT used: it walks the prototype chain, so
1237
+ * `Object.setPrototypeOf(new Set(), Object.prototype)` claims to be a plain
1238
+ * object and `Object.setPrototypeOf(new Set(), null)` claims to have no
1239
+ * prototype.
1240
+ *
1241
+ * Recorded limit: a **class instance** whose prototype has been set to
1242
+ * `Object.prototype` or `null` IS accepted, and so are `arguments` objects and
1243
+ * module namespace objects, which pass with no spoofing at all. Classes have no
1244
+ * `util.types` brand, so the class case cannot be closed by brand checking, and
1245
+ * rejecting every such object would also reject the legitimate
1246
+ * `Object.create(null)` index.
1247
+ *
1248
+ * The cost of that limit is **unbounded, not bounded**: the instance's own
1249
+ * properties are read as page ids, and unless those properties happen to be
1250
+ * exact page ids the result is the same silent plan as an empty index — no g00,
1251
+ * no contract units, no deps — which is the failure this guard exists to
1252
+ * prevent. The guard narrows the hole to values that already look like plain
1253
+ * data; it does not close it. `NON_INDEX_BRANDS` is likewise curated rather
1254
+ * than exhaustive (`Proxy`-wrapped built-ins report no brand, and `DataView`,
1255
+ * `SharedArrayBuffer` and boxed primitives need spoofing to slip through). No
1256
+ * caller in this repo can produce any of these: `computeFootprint` always
1257
+ * returns a real `Map`.
1258
+ */
1259
+ function isFootprintIndex(v) {
1260
+ if (v === null || typeof v !== "object") return false;
1261
+ if (types.isMap(v)) return true;
1262
+ // Brand check for arrays: `Array.isArray` ignores the prototype, so a
1263
+ // rearranged array (`setPrototypeOf([], null)`) is still rejected. This must
1264
+ // come before the prototype test, which such an array would pass.
1265
+ if (Array.isArray(v)) return false;
1266
+ const proto = Object.getPrototypeOf(v);
1267
+ if (proto !== Object.prototype && proto !== null) return false;
1268
+ // A plain-object prototype is necessary but not sufficient: brand-check.
1269
+ return !NON_INDEX_BRANDS.some(([, test]) => test(v));
1270
+ }
1271
+
1272
+ /**
1273
+ * A value's shape for an error message: `null`, `array`, `Set`, `Date`, a
1274
+ * named class, `object with null prototype`, … Honest for a null-prototype
1275
+ * `Set`, which `typeof` and prototype-name lookup both report as "object".
1276
+ *
1277
+ * Best-effort beyond the brands: for a class instance whose prototype has been
1278
+ * set to `Object.prototype` or `null` there is no brand and no prototype name
1279
+ * left to read, so it is reported as `plain object` / `object with null
1280
+ * prototype`. The message describes what the value looks like, which by then is
1281
+ * what it is.
1282
+ */
1283
+ function describeValue(v) {
1284
+ if (v === null) return "null";
1285
+ if (v === undefined) return "undefined";
1286
+ if (typeof v !== "object") return typeof v;
1287
+ if (Array.isArray(v)) return "array";
1288
+ for (const [name, test] of NON_INDEX_BRANDS) {
1289
+ if (test(v)) return name;
1290
+ }
1291
+ const proto = Object.getPrototypeOf(v);
1292
+ const name = proto && proto.constructor && proto.constructor.name;
1293
+ if (typeof name === "string" && name !== "" && name !== "Object") {
1294
+ return `instance of ${name}`;
1295
+ }
1296
+ return proto === null ? "object with null prototype" : "plain object";
1297
+ }
1298
+
1299
+ /** `shared:<file-stem>` with a deterministic suffix on a stem collision (g00/foundation). */
1300
+ function sharedIdOf(file, taken) {
1301
+ const base = file.slice(file.lastIndexOf("/") + 1).replace(/\.[^.]+$/, "");
1302
+ let id = `shared:${base}`;
1303
+ let k = 2;
1304
+ while (taken.has(id)) id = `shared:${base}#${k++}`;
1305
+ taken.add(id);
1306
+ return id;
1307
+ }
1308
+
1309
+ /**
1310
+ * Stable `plan_version`: two runs whose grouping inputs and outputs agree
1311
+ * produce the same value, so the ledger can tell "same plan" from "new plan".
1312
+ *
1313
+ * Built from an explicit array, never from object key order, so the digest is a
1314
+ * function of the plan's content alone. Behavior evidence is content too: a
1315
+ * changed snapshot, profile, or run-level unknown must change the version even
1316
+ * when the grouping is byte-identical, or resume would reuse evidence the plan
1317
+ * no longer describes.
1318
+ *
1319
+ * `pages` is deduped first-wins and sorted by page id inside the payload, so the
1320
+ * digest does not depend on UTG enumeration order or on a duplicate record.
1321
+ */
1322
+ export function planVersionOf(params, groups, units, pages = [], behaviorUnknowns = []) {
1323
+ const payload = JSON.stringify({
1324
+ params,
1325
+ groups: groups.map((g) => [g.group_id, g.kind, g.deps, g.spec_ids]),
1326
+ units: units.map((u) => [u.spec_id, u.dir, u.est]),
1327
+ behavior: pages
1328
+ .filter((page, index, all) => all.findIndex((candidate) => candidate.page_id === page.page_id) === index)
1329
+ .slice()
1330
+ .sort((a, b) => a.page_id.localeCompare(b.page_id))
1331
+ .map((page) => [
1332
+ page.page_id,
1333
+ page.behavior?.schema_version ?? null,
1334
+ page.behavior?.profile ? stableDigest(page.behavior.profile) : null,
1335
+ page.behavior?.snapshot_digest ?? null,
1336
+ ]),
1337
+ behavior_unknowns: behaviorUnknowns.slice()
1338
+ .sort((a, b) => stableDigest(a).localeCompare(stableDigest(b))),
1339
+ });
1340
+ return `p-${crypto.createHash("sha256").update(payload).digest("hex").slice(0, 8)}`;
1341
+ }
1342
+
1343
+ /**
1344
+ * Prove that a plan document still describes the content its version was
1345
+ * derived from. Disk-facing audit entries call this before trusting either the
1346
+ * plan or the ledger: a plan whose pages, units, groups, or behavior evidence
1347
+ * moved after planning no longer matches its anchored version.
1348
+ */
1349
+ export function assertPlanContentVersion(plan) {
1350
+ const expected = planVersionOf(
1351
+ plan.params,
1352
+ plan.groups,
1353
+ plan.spec_units,
1354
+ plan.pages,
1355
+ plan.behavior_unknowns ?? [],
1356
+ );
1357
+ if (expected !== plan.plan_version) {
1358
+ throw new Error(`plan content digest mismatch: expected ${expected}, got ${plan.plan_version}`);
1359
+ }
1360
+ }
1361
+
1362
+ /**
1363
+ * Assemble the plan object.
1364
+ *
1365
+ * 1. Derive candidate keys and choose the grouping with the smallest computed span. If no key is
1366
+ * available, keep each page in its `orphan/<id>` group.
1367
+ * 2. Collect writable files owned by at least two groups, apply the foundation filter, and bucket
1368
+ * them by role. Each non-empty bucket is one `g00-<role>` group.
1369
+ * 3. Add deps only from buckets that a page group actually uses.
1370
+ * 4. Emit g00 units first, then one page unit per page clustered by canonical group and `pages[]`
1371
+ * order, preserving that order in `specs.json`.
1372
+ *
1373
+ * `pages`, `unclassified`, `orphan_overlays`, and `page_enumeration` come from the caller.
1374
+ * `foundation_files` and `key_context` make filtering and platform-gate decisions auditable.
1375
+ *
1376
+ * @param {object} args
1377
+ * @param {object[]} args.pages page records in emit order
1378
+ * @param {Map|object} args.footprint page id -> {all, writable, resolvedFile}; must be a Map or a
1379
+ * plain object index accepted by `isFootprintIndex`
1380
+ * @param {object} [args.params] concurrency, contractsPerGroup, and maxPages
1381
+ * @param {object} [args.inputs] passed through; `sourceProject` resolves source files and platform
1382
+ * gates. When absent, both gates are false and pages group by `parent`.
1383
+ * @returns {object} a byte-stable plan
1384
+ */
1385
+ export function buildPlan({ pages, footprint, params, inputs } = {}) {
1386
+ if (!Array.isArray(pages)) {
1387
+ throw new TypeError("buildPlan: pages must be an array");
1388
+ }
1389
+ const planParamsOut = planParams(params);
1390
+ const inputsOut = inputs === undefined || inputs === null ? {} : inputs;
1391
+ if (typeof inputsOut !== "object") {
1392
+ throw new TypeError(`buildPlan: inputs must be an object, got ${typeof inputsOut}`);
1393
+ }
1394
+ // An absent footprint is a caller bug, not "no writable files": substituting
1395
+ // an empty Map would return a valid-looking plan with no g00, no contract
1396
+ // units and no deps — every g00/foundation obligation silently dropped. An explicitly
1397
+ // empty Map (or `{}`) is that real "no writable files" result and stays valid.
1398
+ //
1399
+ // The accepted shapes are exactly a Map or a plain object: an index of page id
1400
+ // -> footprint. `[]` and `new Set()` are object-shaped but are not indexes,
1401
+ // and a bare `typeof === "object"` check let them through to produce the same
1402
+ // empty plan this guard exists to prevent — so they are rejected by name
1403
+ // rather than left to fail later as a silent empty lookup.
1404
+ if (!isFootprintIndex(footprint)) {
1405
+ throw new TypeError(
1406
+ `buildPlan: footprint must be a Map or object of page id -> footprint, got ${describeValue(footprint)}`,
1407
+ );
1408
+ }
1409
+ const fp = footprint;
1410
+ const sourceProject = inputsOut.sourceProject;
1411
+
1412
+ // Run-level unknowns are plan content, not diagnostics. Every unclassified or
1413
+ // orphan surface the inventory could not own stays visible in the
1414
+ // completeness denominator instead of vanishing from the fingerprint.
1415
+ const behaviorUnknownsById = new Map();
1416
+ for (const record of [
1417
+ ...(Array.isArray(inputsOut.unclassified) ? inputsOut.unclassified : []),
1418
+ ...(Array.isArray(inputsOut.orphanOverlays) ? inputsOut.orphanOverlays : []),
1419
+ ]) {
1420
+ const unknown = {
1421
+ id: `unk_${stableDigest(record)}`,
1422
+ reason: "unresolved-source-unit",
1423
+ source: record,
1424
+ next_action: "Resolve static composition ownership",
1425
+ };
1426
+ if (!behaviorUnknownsById.has(unknown.id)) behaviorUnknownsById.set(unknown.id, unknown);
1427
+ }
1428
+ // K3: a navigation precondition the architecture documents but the UTG never recorded is a run-level
1429
+ // gap, not silence: the run publishes with it instead of calling the page set complete.
1430
+ if (inputsOut.navigationGuardGap && typeof inputsOut.navigationGuardGap === "object") {
1431
+ const unknown = {
1432
+ id: `unk_${stableDigest({ navigationGuardGap: inputsOut.navigationGuardGap })}`,
1433
+ reason: "navigation-guards-absent",
1434
+ source: inputsOut.navigationGuardGap,
1435
+ next_action: "The architecture documents navigation interception (e.g. login) but the UTG records no guard: "
1436
+ + "re-run discover.utg_static so route_interceptor.mjs records it, or write the guarded scenarios by hand",
1437
+ };
1438
+ behaviorUnknownsById.set(unknown.id, unknown);
1439
+ }
1440
+ const behaviorUnknowns = [...behaviorUnknownsById.values()]
1441
+ .sort((a, b) => stableDigest(a).localeCompare(stableDigest(b)));
1442
+
1443
+ // A repeated page id is one page (SPEC-unit planning invariant 1: no page counted twice).
1444
+ // Both `ids` and `pageById` are first-wins, from the same loop, so they cannot
1445
+ // disagree about which record describes the page.
1446
+ const ids = [];
1447
+ const seen = new Set();
1448
+ for (const page of pages) {
1449
+ if (!page || typeof page !== "object") {
1450
+ throw new TypeError("buildPlan: every page must be an object");
1451
+ }
1452
+ if (seen.has(page.page_id)) continue;
1453
+ seen.add(page.page_id);
1454
+ ids.push(page.page_id);
1455
+ }
1456
+ const pageById = new Map();
1457
+ for (const page of pages) {
1458
+ if (!page || typeof page !== "object") continue;
1459
+ if (!pageById.has(page.page_id)) pageById.set(page.page_id, page);
1460
+ }
1461
+
1462
+ // `Map.prototype.get.call`, not `fp.get`: see `writableOf` — a brand-Map with
1463
+ // a rearranged prototype has no own `.get`.
1464
+ const fpIsMap = types.isMap(fp);
1465
+ const footprintOf = (id) => (fpIsMap ? Map.prototype.get.call(fp, id) : fp?.[id]);
1466
+ const resolvedOf = (id) => {
1467
+ const entry = footprintOf(id);
1468
+ return entry && typeof entry === "object" && typeof entry.resolvedFile === "string"
1469
+ ? entry.resolvedFile
1470
+ : null;
1471
+ };
1472
+ // The footprint stores a repo-relative path; resolve it
1473
+ // against the source root before reading. `path.resolve` keeps an absolute
1474
+ // `resolvedFile` as given, so a caller holding an absolute path still works.
1475
+ const estFileOf = (id) => {
1476
+ const rel = resolvedOf(id);
1477
+ if (rel === null) return null;
1478
+ if (typeof sourceProject !== "string" || sourceProject === "") return rel;
1479
+ return path.resolve(sourceProject, rel);
1480
+ };
1481
+
1482
+ const keyCtx = keyContextOf(sourceProject, pages);
1483
+ const keys = new Map(ids.map((id) => [
1484
+ id, keysFor(id, resolvedOf(id), keyCtx, pageById.get(id)?.route ?? null),
1485
+ ]));
1486
+
1487
+ const choice = chooseCandidate({ ids, keys, footprint: fp, params: planParamsOut });
1488
+ // With no key available at all there is nothing to group by; the orphan
1489
+ // grouping is what key selection assigns every key-less page anyway.
1490
+ const chosenGroups = choice.chosen === null
1491
+ ? groupsFrom(ids, () => null)
1492
+ : choice.chosen.groups;
1493
+ const groupNames = [...chosenGroups.keys()];
1494
+ const groupNameOf = new Map();
1495
+ for (const [name, members] of chosenGroups) for (const id of members) groupNameOf.set(id, name);
1496
+
1497
+ const dirs = new Map(groupNames.map((name, i) => [name, pageDirOf(i + 1, name)]));
1498
+
1499
+ // span/estimation est, once per page: it feeds the page unit and the group's est_scenarios.
1500
+ const est = new Map(ids.map((id) => [id, estOf(pageById.get(id), estFileOf(id))]));
1501
+
1502
+ // --- g00 -----------------------------------------------------------------
1503
+ const owners = new Map();
1504
+ const writableById = new Map();
1505
+ for (const id of ids) {
1506
+ const set = writableOf(fp, id);
1507
+ writableById.set(id, set);
1508
+ const name = groupNameOf.get(id);
1509
+ if (name === undefined) continue;
1510
+ for (const f of set) {
1511
+ if (!owners.has(f)) owners.set(f, new Set());
1512
+ owners.get(f).add(name);
1513
+ }
1514
+ }
1515
+ const { g00, foundation } = foundationFilter(owners, chosenGroups.size, {});
1516
+
1517
+ const buckets = new Map();
1518
+ for (const f of [...g00].sort()) {
1519
+ const b = bucketOf(f);
1520
+ if (!buckets.has(b)) buckets.set(b, []);
1521
+ buckets.get(b).push(f);
1522
+ }
1523
+ const bucketNames = [...buckets.keys()].sort();
1524
+ const sharedDirOf = new Map(bucketNames.map((b) => [b, `g00-${b}`]));
1525
+
1526
+ // --- spec_units: g00 contract units first (g00/foundation so-id from 1) -------------
1527
+ const units = [];
1528
+ const groupSpecIds = new Map();
1529
+ for (const name of groupNames) groupSpecIds.set(name, []);
1530
+ for (const b of bucketNames) groupSpecIds.set(`g00-${b}`, []);
1531
+ const takenIds = new Set();
1532
+ for (const b of bucketNames) {
1533
+ const groupId = sharedDirOf.get(b);
1534
+ for (const file of buckets.get(b)) {
1535
+ const specId = sharedIdOf(file, takenIds);
1536
+ units.push({
1537
+ spec_id: specId,
1538
+ page_id: specId,
1539
+ part: 1,
1540
+ parts: 1,
1541
+ dir: groupId,
1542
+ est: 1,
1543
+ status_domain: null,
1544
+ });
1545
+ groupSpecIds.get(groupId).push(specId);
1546
+ }
1547
+ }
1548
+
1549
+ // --- spec_units: page units, clustered by group (format rule 1) --------------
1550
+ //
1551
+ // Rows must be "按组聚集、组内按页面顺序排": `finalize` builds specs.json rows
1552
+ // in `spec_units` order, and output layout's resume detection refuses non-contiguous
1553
+ // so-id inputs. UTG emits nodes grouped by kind, so two pages of one group are
1554
+ // routinely far apart in `pages[]`; emitting in that order would give
1555
+ // g01, g02, g01, g02 for two groups. Iterate the canonical group order and,
1556
+ // inside a group, its members by `pages[]` index — `chosenGroups`' arrays are
1557
+ // sorted for determinism, which is NOT page order.
1558
+ const pageRank = new Map(ids.map((id, i) => [id, i]));
1559
+ for (const name of groupNames) {
1560
+ // Iterating `groupNames` (which holds every id, orphans included) preserves
1561
+ // SPEC-unit planning invariant 1 — every page is emitted exactly once.
1562
+ const members = [...chosenGroups.get(name)].sort((a, b) => pageRank.get(a) - pageRank.get(b));
1563
+ const dir = dirs.get(name);
1564
+ for (const id of members) {
1565
+ const total = est.get(id);
1566
+ units.push({
1567
+ spec_id: id,
1568
+ page_id: id,
1569
+ part: 1,
1570
+ parts: 1,
1571
+ dir,
1572
+ est: total,
1573
+ status_domain: null,
1574
+ });
1575
+ groupSpecIds.get(name).push(id);
1576
+ }
1577
+ }
1578
+
1579
+ // --- dependencies: only the buckets this group's pages actually write -------------------
1580
+ const groups = [];
1581
+ for (const b of bucketNames) {
1582
+ const groupId = sharedDirOf.get(b);
1583
+ groups.push({
1584
+ group_id: groupId,
1585
+ dir: groupId,
1586
+ kind: "shared",
1587
+ pages: [],
1588
+ spec_ids: groupSpecIds.get(groupId),
1589
+ deps: [],
1590
+ deps_reason: [],
1591
+ est_scenarios: buckets.get(b).length,
1592
+ });
1593
+ }
1594
+ for (const name of groupNames) {
1595
+ const members = chosenGroups.get(name);
1596
+ const hit = new Set();
1597
+ for (const id of members) {
1598
+ for (const f of writableById.get(id) ?? []) {
1599
+ if (g00.has(f)) hit.add(bucketOf(f));
1600
+ }
1601
+ }
1602
+ const deps = [...hit].sort().map((b) => `g00-${b}`);
1603
+ groups.push({
1604
+ group_id: dirs.get(name),
1605
+ dir: dirs.get(name),
1606
+ kind: "page",
1607
+ pages: [...members],
1608
+ spec_ids: groupSpecIds.get(name),
1609
+ deps,
1610
+ deps_reason: deps.map((groupId) => `Depends on: ${groupId}`),
1611
+ est_scenarios: members.reduce((sum, id) => sum + (est.get(id) ?? 0), 0),
1612
+ });
1613
+ }
1614
+
1615
+ return {
1616
+ plan_version: planVersionOf(planParamsOut, groups, units, pages, behaviorUnknowns),
1617
+ inputs: inputsOut,
1618
+ params: planParamsOut,
1619
+ page_enumeration: inputsOut.pageEnumeration ?? null,
1620
+ pages,
1621
+ unclassified: inputsOut.unclassified ?? [],
1622
+ orphan_overlays: inputsOut.orphanOverlays ?? [],
1623
+ // Sorted, content-addressed run-level unknowns. Fingerprinted above so a
1624
+ // changed unknown set cannot resume under an old version.
1625
+ behavior_unknowns: behaviorUnknowns,
1626
+ // g00/foundation: the foundation set is excluded from g00 but is not "unspecified" —
1627
+ // grouping-report.json lists it for human review, and nothing else produces
1628
+ // it. Sorted so the report is byte-stable across runs.
1629
+ foundation_files: [...foundation].sort(),
1630
+ // The key selection platform-gate detection, published so a wrong detection (or
1631
+ // an absent `sourceProject`, which disables `module` and `route`) is
1632
+ // auditable rather than invisible.
1633
+ key_context: keyCtx,
1634
+ spec_units: units,
1635
+ groups,
1636
+ // three outcome arrays are carried through unflattened; unifying
1637
+ // them into the flat `candidates[]` report.
1638
+ // `chosen.groups` is a Map and would serialise to `{}` in plan.json, so the
1639
+ // partition itself lives in `groups[]` (JSON-safe) and only the label and
1640
+ // the lossy slices are carried here.
1641
+ grouping: {
1642
+ chosen: choice.chosen === null
1643
+ ? null
1644
+ : { label: choice.chosen.label, artificial: choice.chosen.artificial },
1645
+ candidates: choice.candidates,
1646
+ unavailable: choice.unavailable,
1647
+ deduped: choice.deduped,
1648
+ },
1649
+ };
1650
+ }