@buaa_smat/hometrans 26.0.0-devecocli.2 → 26.0.0-devecocli.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (497) hide show
  1. package/LICENSE +21 -21
  2. package/package.json +1 -1
  3. package/plugin.jsonc +1 -1
  4. package/skills/a2h-app-migrate/references/specs.example.json +19 -19
  5. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +38 -14
  6. package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +3 -3
  7. package/skills/a2h-app-migrate/scripts/json_io.mjs +35 -35
  8. package/skills/a2h-app-migrate/scripts/lib-yaml-lite.mjs +288 -288
  9. package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +183 -15
  10. package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -54
  11. package/skills/a2h-app-migrate/test/test_env_requirements.mjs +40 -1
  12. package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -146
  13. package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -68
  14. package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -32
  15. package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +53 -53
  16. package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -69
  17. package/skills/a2h-app-migrate/test/test_preflight_report.mjs +11 -1
  18. package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +181 -181
  19. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +53 -53
  20. package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -226
  21. package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +83 -0
  22. package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +39 -39
  23. package/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -107
  24. package/skills/a2h-arch-generate/examples/simple-conversion-android.md +103 -103
  25. package/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -70
  26. package/skills/a2h-arch-generate/examples/simple-conversion-uniapp.md +106 -106
  27. package/skills/a2h-arch-generate/references/arkts-mvvm-v2.md +1407 -1407
  28. package/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -120
  29. package/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -123
  30. package/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +87 -87
  31. package/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -107
  32. package/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -68
  33. package/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -150
  34. package/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -94
  35. package/skills/a2h-arch-generate/references/reconciliation-model.md +204 -204
  36. package/skills/a2h-arch-generate/references/scope-policy.md +28 -28
  37. package/skills/a2h-arch-generate/references/semantic-review.md +65 -65
  38. package/skills/a2h-arch-generate/references/source-ecosystems.md +54 -54
  39. package/skills/a2h-arch-generate/references/transformation-model.md +78 -78
  40. package/skills/a2h-arch-generate/scripts/create_project.mjs +149 -149
  41. package/skills/a2h-arch-generate/scripts/generate_state.mjs +60 -60
  42. package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +326 -326
  43. package/skills/a2h-arch-generate/scripts/inspect_uniapp_project.mjs +809 -809
  44. package/skills/a2h-arch-generate/scripts/lib/py_compat.mjs +1454 -1454
  45. package/skills/a2h-arch-generate/scripts/module_create/create.mjs +136 -136
  46. package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +636 -636
  47. package/skills/a2h-arch-generate/scripts/module_create/hap/build-profile.json5 +32 -32
  48. package/skills/a2h-arch-generate/scripts/module_create/hap/hvigorfile.ts +5 -5
  49. package/skills/a2h-arch-generate/scripts/module_create/hap/obfuscation-rules.txt +22 -22
  50. package/skills/a2h-arch-generate/scripts/module_create/hap/oh-package.json5 +10 -10
  51. package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/applicationability/ApplicationAbility.ets +43 -43
  52. package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/pages/Index.ets +22 -22
  53. package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/module.json5 +25 -25
  54. package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/color.json +7 -7
  55. package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/float.json +8 -8
  56. package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/string.json +15 -15
  57. package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/layered_image.json +6 -6
  58. package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/profile/main_pages.json +5 -5
  59. package/skills/a2h-arch-generate/scripts/module_create/hap/src/mock/mock-config.json5 +1 -1
  60. package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/Ability.test.ets +34 -34
  61. package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/List.test.ets +4 -4
  62. package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/module.json5 +11 -11
  63. package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/List.test.ets +4 -4
  64. package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/LocalUnit.test.ets +32 -32
  65. package/skills/a2h-arch-generate/scripts/module_create/har/Index.ets +1 -1
  66. package/skills/a2h-arch-generate/scripts/module_create/har/build-profile.json5 +36 -36
  67. package/skills/a2h-arch-generate/scripts/module_create/har/hvigorfile.ts +5 -5
  68. package/skills/a2h-arch-generate/scripts/module_create/har/obfuscation-rules.txt +22 -22
  69. package/skills/a2h-arch-generate/scripts/module_create/har/oh-package.json5 +9 -9
  70. package/skills/a2h-arch-generate/scripts/module_create/har/src/main/ets/components/MainPage.ets +19 -19
  71. package/skills/a2h-arch-generate/scripts/module_create/har/src/main/module.json5 +9 -9
  72. package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/float.json +8 -8
  73. package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/string.json +8 -8
  74. package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/Ability.test.ets +34 -34
  75. package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/List.test.ets +4 -4
  76. package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/module.json5 +11 -11
  77. package/skills/a2h-arch-generate/scripts/module_create/har/src/test/List.test.ets +4 -4
  78. package/skills/a2h-arch-generate/scripts/module_create/har/src/test/LocalUnit.test.ets +32 -32
  79. package/skills/a2h-arch-generate/scripts/module_create/hsp/build-profile.json5 +35 -35
  80. package/skills/a2h-arch-generate/scripts/module_create/hsp/hvigorfile.ts +5 -5
  81. package/skills/a2h-arch-generate/scripts/module_create/hsp/obfuscation-rules.txt +22 -22
  82. package/skills/a2h-arch-generate/scripts/module_create/hsp/oh-package.json5 +9 -9
  83. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/pages/Index.ets +19 -19
  84. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/utils/Calc.ets +2 -2
  85. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/module.json5 +11 -11
  86. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/float.json +8 -8
  87. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/string.json +7 -7
  88. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/profile/main_pages.json +5 -5
  89. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/Ability.test.ets +34 -34
  90. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/List.test.ets +4 -4
  91. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/module.json5 +10 -10
  92. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/List.test.ets +4 -4
  93. package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/LocalUnit.test.ets +32 -32
  94. package/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -47
  95. package/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -15
  96. package/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -36
  97. package/skills/a2h-arch-generate/scripts/resolve_android_stores.mjs +529 -529
  98. package/skills/a2h-arch-generate/scripts/scaffold_project.mjs +230 -230
  99. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -11
  100. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -12
  101. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -8
  102. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -17
  103. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -3
  104. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -1
  105. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -8
  106. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -14
  107. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -7
  108. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -1
  109. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -3
  110. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -7
  111. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -1
  112. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -3
  113. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -7
  114. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -1
  115. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -3
  116. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -1
  117. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -1
  118. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -7
  119. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -9
  120. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -7
  121. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -10
  122. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -6
  123. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -16
  124. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -5
  125. package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -52
  126. package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -34
  127. package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +138 -138
  128. package/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +937 -937
  129. package/skills/a2h-arch-generate/scripts/validate_homegraph_artifacts.mjs +542 -542
  130. package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +415 -415
  131. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +6 -6
  132. package/skills/a2h-arkts-logic-coder/scripts/check_module_scope.ts +224 -224
  133. package/skills/a2h-arkts-logic-coder/scripts/check_mvvm.ts +377 -377
  134. package/skills/a2h-arkts-logic-coder/scripts/stop_check_hook.ts +443 -443
  135. package/skills/a2h-arkts-logic-coder/scripts/test_check_scripts.ts +211 -211
  136. package/skills/a2h-arkts-logic-coder/scripts/test_worktree_compat.ts +81 -81
  137. package/skills/a2h-batch-ui-align/SKILL.md +19 -7
  138. package/skills/a2h-batch-ui-align/flowchart.html +271 -271
  139. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +57 -8
  140. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2535 -2533
  141. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +558 -558
  142. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
  143. package/skills/a2h-batch-ui-align/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -648
  144. package/skills/a2h-batch-ui-align/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2088 -2088
  145. package/skills/a2h-batch-ui-align/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -1033
  146. package/skills/a2h-batch-ui-align/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -1183
  147. package/skills/a2h-batch-ui-align/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -576
  148. package/skills/a2h-batch-ui-align/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -297
  149. package/skills/a2h-batch-ui-align/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -395
  150. package/skills/a2h-batch-ui-align/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +902 -902
  151. package/skills/a2h-batch-ui-align/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -106
  152. package/skills/a2h-batch-ui-align/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -1178
  153. package/skills/a2h-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -911
  154. package/skills/a2h-batch-ui-align/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +354 -354
  155. package/skills/a2h-batch-ui-align/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -11
  156. package/skills/a2h-batch-ui-align/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -206
  157. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -373
  158. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -158
  159. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -750
  160. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -1704
  161. package/skills/a2h-batch-ui-align/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -1012
  162. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -164
  163. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -840
  164. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -856
  165. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -83
  166. package/skills/a2h-batch-ui-align/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -294
  167. package/skills/a2h-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -1407
  168. package/skills/a2h-batch-ui-align/references/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1220 -1220
  169. package/skills/a2h-batch-ui-align/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -47
  170. package/skills/a2h-batch-ui-align/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +133 -133
  171. package/skills/a2h-batch-ui-align/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -840
  172. package/skills/a2h-batch-ui-align/references/step3-capture.md +4 -1
  173. package/skills/a2h-batch-ui-align/references/step4-prepare.md +7 -3
  174. package/skills/a2h-batch-ui-align/references/step5-convert.md +8 -5
  175. package/skills/a2h-batch-ui-align/scripts/answers_check.mjs +86 -86
  176. package/skills/a2h-batch-ui-align/scripts/arkts_static_check.ts +1171 -2
  177. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1675 -1656
  178. package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -79
  179. package/skills/a2h-batch-ui-align/scripts/detach.mjs +258 -258
  180. package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +130 -10
  181. package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -612
  182. package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +166 -166
  183. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1627 -1437
  184. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +1869 -1869
  185. package/skills/a2h-batch-ui-align/scripts/harmony_index.mjs +218 -218
  186. package/skills/a2h-batch-ui-align/scripts/host_env.mjs +208 -208
  187. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1179 -1124
  188. package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1036 -996
  189. package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +217 -217
  190. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +253 -253
  191. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +312 -0
  192. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +241 -0
  193. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +341 -0
  194. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
  195. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -365
  196. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +91 -72
  197. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +92 -0
  198. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +356 -345
  199. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +290 -290
  200. package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +31 -0
  201. package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +57 -0
  202. package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -123
  203. package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -126
  204. package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +241 -189
  205. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1451 -1451
  206. package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -215
  207. package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -95
  208. package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -115
  209. package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +244 -244
  210. package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +166 -130
  211. package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -49
  212. package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +219 -0
  213. package/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +470 -0
  214. package/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -67
  215. package/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -19
  216. package/skills/a2h-dashboard-render/scripts/artifact_contract.mjs +138 -138
  217. package/skills/a2h-dashboard-render/scripts/check-registry.mjs +87 -87
  218. package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +155 -155
  219. package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -1
  220. package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -1
  221. package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -1
  222. package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -99
  223. package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +64 -64
  224. package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -147
  225. package/skills/a2h-fix-build-errors/references/arkts-strict-patterns.md +219 -219
  226. package/skills/a2h-fix-build-errors/references/known-patterns.md +157 -157
  227. package/skills/a2h-fix-build-errors/references/rdb-entity-pattern.md +131 -131
  228. package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +168 -168
  229. package/skills/a2h-module-semantic-docs/scripts/lib/py_compat.mjs +688 -688
  230. package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +1021 -1021
  231. package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -187
  232. package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -351
  233. package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -495
  234. package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -157
  235. package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -388
  236. package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +335 -335
  237. package/skills/a2h-resource-convert/references/conversion-rules.md +687 -687
  238. package/skills/a2h-resource-convert/references/dependency-analysis-rules.md +410 -410
  239. package/skills/a2h-resource-convert/references/incremental-page-migration.md +250 -250
  240. package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +219 -219
  241. package/skills/a2h-resource-convert/references/resource-mapping-rules.md +493 -493
  242. package/skills/a2h-resource-convert/references/step3_5-dependency-filter.md +54 -54
  243. package/skills/a2h-resource-convert/references/step4-qualifiers-and-values.md +142 -142
  244. package/skills/a2h-resource-convert/references/step4-resource-types.md +249 -249
  245. package/skills/a2h-resource-convert/references/step5-reference-resolution.md +154 -154
  246. package/skills/a2h-resource-convert/references/step7-report-template.md +217 -217
  247. package/skills/a2h-resource-convert/references/xml-drawable-to-svg-rules.md +630 -630
  248. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +2529 -2529
  249. package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +1072 -1072
  250. package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +607 -607
  251. package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +989 -989
  252. package/skills/a2h-resource-convert/scripts/extract_project_resources.ts +1464 -1464
  253. package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +632 -632
  254. package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -182
  255. package/skills/a2h-spec-design/scripts/inspect_spec_design_inputs.mjs +146 -146
  256. package/skills/a2h-spec-design/scripts/lib/py_compat.mjs +481 -481
  257. package/skills/a2h-spec-design/scripts/move_spec_technical_reference.mjs +159 -159
  258. package/skills/a2h-spec-design/scripts/resolve_module_design.mjs +102 -102
  259. package/skills/a2h-spec-design/scripts/validate_spec_design_output.mjs +285 -285
  260. package/skills/a2h-spec-design/test/golden/inspect_happy.json +20 -20
  261. package/skills/a2h-spec-design/test/golden/move_design.md +18 -18
  262. package/skills/a2h-spec-design/test/golden/move_spec.md +7 -7
  263. package/skills/a2h-spec-design/test/golden/resolve_cases.json +36 -36
  264. package/skills/a2h-spec-design/test/golden/validate_issue_file.md +12 -12
  265. package/skills/a2h-spec-design/test/golden/validate_issues.json +57 -57
  266. package/skills/a2h-spec-design/test/test_spec_design_scripts.mjs +381 -381
  267. package/skills/a2h-spec-design-pipeline/package.json +4 -4
  268. package/skills/a2h-spec-design-pipeline/references/execution-model.md +69 -69
  269. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +24 -24
  270. package/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -19
  271. package/skills/a2h-spec-design-pipeline/scripts/atomic_write.ts +42 -42
  272. package/skills/a2h-spec-design-pipeline/scripts/audit_claims.ts +252 -252
  273. package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +77 -77
  274. package/skills/a2h-spec-design-pipeline/scripts/deps_ready.ts +195 -195
  275. package/skills/a2h-spec-design-pipeline/scripts/git_baseline.ts +124 -124
  276. package/skills/a2h-spec-design-pipeline/scripts/lib/bgcli.mjs +95 -95
  277. package/skills/a2h-spec-design-pipeline/scripts/plan_waves.ts +475 -475
  278. package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +164 -164
  279. package/skills/a2h-spec-design-pipeline/scripts/test_atomic_write.ts +44 -44
  280. package/skills/a2h-spec-design-pipeline/scripts/test_audit_claims.ts +301 -301
  281. package/skills/a2h-spec-design-pipeline/scripts/test_bgcli.mjs +64 -64
  282. package/skills/a2h-spec-design-pipeline/scripts/test_branch_landed.ts +87 -87
  283. package/skills/a2h-spec-design-pipeline/scripts/test_deps_ready.ts +265 -265
  284. package/skills/a2h-spec-design-pipeline/scripts/test_git_baseline.ts +105 -105
  285. package/skills/a2h-spec-design-pipeline/scripts/test_plan_waves.ts +561 -561
  286. package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +138 -138
  287. package/skills/a2h-spec-design-pipeline/scripts/test_watchdog.mjs +289 -289
  288. package/skills/a2h-spec-design-pipeline/scripts/watchdog.mjs +441 -441
  289. package/skills/a2h-spec-generate/scripts/parse_requirements.ts +515 -515
  290. package/skills/a2h-spec-generate/template/REQ.txt +22 -22
  291. package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -37
  292. package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -3
  293. package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -3
  294. package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -3
  295. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -9
  296. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -8
  297. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -9
  298. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -1
  299. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -6
  300. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -4
  301. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -1
  302. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -33
  303. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -1
  304. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -23
  305. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -3
  306. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -8
  307. package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -1
  308. package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -54
  309. package/skills/a2h-utg-explorer/SKILL.md +1 -1
  310. package/skills/a2h-utg-explorer/assets/final_viewer.html +64 -64
  311. package/skills/a2h-utg-explorer/assets/u2.LICENSE +21 -21
  312. package/skills/a2h-utg-explorer/assets/u2.NOTICE +25 -25
  313. package/skills/a2h-utg-explorer/references/protocol.md +9 -9
  314. package/skills/a2h-utg-explorer/scripts/app_settings.mjs +143 -143
  315. package/skills/a2h-utg-explorer/scripts/close_phases.mjs +66 -66
  316. package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +597 -597
  317. package/skills/a2h-utg-explorer/scripts/device_health.mjs +227 -227
  318. package/skills/a2h-utg-explorer/scripts/evidence.mjs +108 -108
  319. package/skills/a2h-utg-explorer/scripts/final_utg.mjs +61 -9
  320. package/skills/a2h-utg-explorer/scripts/hint_check.mjs +89 -89
  321. package/skills/a2h-utg-explorer/scripts/plan.mjs +258 -258
  322. package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +170 -170
  323. package/skills/a2h-utg-explorer/scripts/recover_d.mjs +369 -302
  324. package/skills/a2h-utg-explorer/scripts/report.mjs +143 -143
  325. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +13 -0
  326. package/skills/a2h-utg-explorer/scripts/run_device.mjs +137 -137
  327. package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -66
  328. package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -45
  329. package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +37 -1
  330. package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -104
  331. package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +223 -223
  332. package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +88 -88
  333. package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -187
  334. package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -130
  335. package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +136 -136
  336. package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -135
  337. package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +251 -251
  338. package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +42 -42
  339. package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +162 -162
  340. package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -193
  341. package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +204 -204
  342. package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +355 -355
  343. package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -240
  344. package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -173
  345. package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +267 -207
  346. package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -213
  347. package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -345
  348. package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +131 -131
  349. package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -229
  350. package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +336 -321
  351. package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -102
  352. package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
  353. package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -346
  354. package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -24
  355. package/skills/a2h-utg-explorer/scripts/utg_explorer/_device_io.mjs +244 -244
  356. package/skills/a2h-utg-explorer/scripts/utg_explorer/_py.mjs +2097 -2097
  357. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +18 -0
  358. package/skills/a2h-utg-explorer/scripts/utg_explorer/attest.mjs +63 -63
  359. package/skills/a2h-utg-explorer/scripts/utg_explorer/chain.mjs +63 -63
  360. package/skills/a2h-utg-explorer/scripts/utg_explorer/coverage.mjs +89 -89
  361. package/skills/a2h-utg-explorer/scripts/utg_explorer/device_lock.mjs +46 -46
  362. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +66 -2
  363. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +49 -4
  364. package/skills/a2h-utg-explorer/scripts/variant.mjs +75 -75
  365. package/skills/a2h-utg-explorer/scripts/worklist_parts.mjs +122 -122
  366. package/skills/a2h-utg-static/config.json +19 -19
  367. package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -248
  368. package/skills/a2h-utg-static/references/view-interactions.md +215 -215
  369. package/skills/a2h-utg-static/scripts/_graph.mjs +361 -361
  370. package/skills/a2h-utg-static/scripts/_py.mjs +2177 -2177
  371. package/skills/a2h-utg-static/scripts/_spawn.mjs +45 -45
  372. package/skills/a2h-utg-static/scripts/activity_widgets.mjs +254 -254
  373. package/skills/a2h-utg-static/scripts/adapter_nav.mjs +229 -229
  374. package/skills/a2h-utg-static/scripts/androidfragment_nav.mjs +208 -208
  375. package/skills/a2h-utg-static/scripts/audit.mjs +268 -268
  376. package/skills/a2h-utg-static/scripts/carry_answers.mjs +201 -201
  377. package/skills/a2h-utg-static/scripts/compose_body_text.mjs +54 -0
  378. package/skills/a2h-utg-static/scripts/dialog_listener_nav.mjs +237 -237
  379. package/skills/a2h-utg-static/scripts/guard_subjects.mjs +162 -162
  380. package/skills/a2h-utg-static/scripts/hg_query.mjs +137 -137
  381. package/skills/a2h-utg-static/scripts/hybrid_bundle.mjs +165 -165
  382. package/skills/a2h-utg-static/scripts/hybrid_pages.mjs +713 -713
  383. package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -660
  384. package/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -267
  385. package/skills/a2h-utg-static/scripts/io_utils.mjs +59 -59
  386. package/skills/a2h-utg-static/scripts/measure/measure_corpus.mjs +297 -297
  387. package/skills/a2h-utg-static/scripts/measure/measure_guards.mjs +98 -98
  388. package/skills/a2h-utg-static/scripts/media_browse_nav.mjs +356 -356
  389. package/skills/a2h-utg-static/scripts/orphan_overlay_nav.mjs +89 -89
  390. package/skills/a2h-utg-static/scripts/phase_plan.mjs +108 -108
  391. package/skills/a2h-utg-static/scripts/phase_planner.mjs +119 -119
  392. package/skills/a2h-utg-static/scripts/plaindialog_nav.mjs +411 -411
  393. package/skills/a2h-utg-static/scripts/preference_widgets.mjs +142 -142
  394. package/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -490
  395. package/skills/a2h-utg-static/scripts/registry_nav.mjs +288 -288
  396. package/skills/a2h-utg-static/scripts/run_pipeline.mjs +870 -870
  397. package/skills/a2h-utg-static/scripts/screen_merge.mjs +287 -287
  398. package/skills/a2h-utg-static/scripts/screen_nav.mjs +279 -279
  399. package/skills/a2h-utg-static/scripts/starter_nav.mjs +198 -198
  400. package/skills/a2h-utg-static/scripts/static_prior.mjs +904 -904
  401. package/skills/a2h-utg-static/scripts/tests/_zipw.mjs +28 -28
  402. package/skills/a2h-utg-static/scripts/tests/probe_autoload.mjs +108 -108
  403. package/skills/a2h-utg-static/scripts/tests/probe_layout_fragments.mjs +90 -90
  404. package/skills/a2h-utg-static/scripts/tests/probe_unknown_scope.mjs +61 -61
  405. package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -1261
  406. package/skills/a2h-utg-static/scripts/tests/test_activity_alias_launcher.mjs +90 -90
  407. package/skills/a2h-utg-static/scripts/tests/test_bottom_sheet_container.mjs +58 -58
  408. package/skills/a2h-utg-static/scripts/tests/test_branch_guard.mjs +19 -19
  409. package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +103 -103
  410. package/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -60
  411. package/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -111
  412. package/skills/a2h-utg-static/scripts/tests/test_commit_scope.mjs +113 -113
  413. package/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +17 -0
  414. package/skills/a2h-utg-static/scripts/tests/test_defensive_null_guard.mjs +77 -77
  415. package/skills/a2h-utg-static/scripts/tests/test_dialog_orphan_entries.mjs +99 -99
  416. package/skills/a2h-utg-static/scripts/tests/test_dialog_page_owner.mjs +69 -69
  417. package/skills/a2h-utg-static/scripts/tests/test_dialogshow_java_factory.mjs +37 -37
  418. package/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -42
  419. package/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -140
  420. package/skills/a2h-utg-static/scripts/tests/test_edge_dedupe_by_gesture.mjs +111 -111
  421. package/skills/a2h-utg-static/scripts/tests/test_edge_provenance_lint.mjs +70 -70
  422. package/skills/a2h-utg-static/scripts/tests/test_enclosing_gesture.mjs +69 -69
  423. package/skills/a2h-utg-static/scripts/tests/test_external_surface_roots.mjs +43 -43
  424. package/skills/a2h-utg-static/scripts/tests/test_find_package_indirect.mjs +67 -67
  425. package/skills/a2h-utg-static/scripts/tests/test_forwarding_wrapper.mjs +38 -38
  426. package/skills/a2h-utg-static/scripts/tests/test_fragment_containment.mjs +85 -85
  427. package/skills/a2h-utg-static/scripts/tests/test_fragment_helper_trigger.mjs +92 -92
  428. package/skills/a2h-utg-static/scripts/tests/test_graph.mjs +55 -55
  429. package/skills/a2h-utg-static/scripts/tests/test_guard_clause.mjs +86 -86
  430. package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -74
  431. package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -181
  432. package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -293
  433. package/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -118
  434. package/skills/a2h-utg-static/scripts/tests/test_interaction_sites.mjs +272 -272
  435. package/skills/a2h-utg-static/scripts/tests/test_item_data_instance.mjs +51 -51
  436. package/skills/a2h-utg-static/scripts/tests/test_kotlin_fn_spans.mjs +69 -69
  437. package/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -187
  438. package/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -70
  439. package/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -67
  440. package/skills/a2h-utg-static/scripts/tests/test_layout_declared_fragment.mjs +103 -103
  441. package/skills/a2h-utg-static/scripts/tests/test_listener_call_forms.mjs +79 -79
  442. package/skills/a2h-utg-static/scripts/tests/test_listener_receiver_binding.mjs +47 -47
  443. package/skills/a2h-utg-static/scripts/tests/test_manifest_exported_default.mjs +40 -40
  444. package/skills/a2h-utg-static/scripts/tests/test_manifest_filters_modules.mjs +84 -84
  445. package/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -172
  446. package/skills/a2h-utg-static/scripts/tests/test_module_namespace.mjs +33 -33
  447. package/skills/a2h-utg-static/scripts/tests/test_multiple_entry_contracts.mjs +80 -80
  448. package/skills/a2h-utg-static/scripts/tests/test_nav_graph_xml.mjs +35 -35
  449. package/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -85
  450. package/skills/a2h-utg-static/scripts/tests/test_node_id_collision.mjs +57 -57
  451. package/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -62
  452. package/skills/a2h-utg-static/scripts/tests/test_out_of_scope_and_settings.mjs +72 -72
  453. package/skills/a2h-utg-static/scripts/tests/test_overload_and_climb.mjs +86 -86
  454. package/skills/a2h-utg-static/scripts/tests/test_pager_page_source.mjs +78 -78
  455. package/skills/a2h-utg-static/scripts/tests/test_pager_position_zero.mjs +65 -65
  456. package/skills/a2h-utg-static/scripts/tests/test_pager_variant_guard.mjs +172 -172
  457. package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +107 -107
  458. package/skills/a2h-utg-static/scripts/tests/test_plain_dialog_nodes.mjs +167 -167
  459. package/skills/a2h-utg-static/scripts/tests/test_plaindialog_shared_anchor.mjs +117 -117
  460. package/skills/a2h-utg-static/scripts/tests/test_preference_click_nav.mjs +98 -98
  461. package/skills/a2h-utg-static/scripts/tests/test_preference_nesting.mjs +183 -183
  462. package/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -48
  463. package/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -41
  464. package/skills/a2h-utg-static/scripts/tests/test_resolver_tier_parity.mjs +126 -126
  465. package/skills/a2h-utg-static/scripts/tests/test_review_fixes.mjs +135 -135
  466. package/skills/a2h-utg-static/scripts/tests/test_scope_utils.mjs +85 -85
  467. package/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -148
  468. package/skills/a2h-utg-static/scripts/tests/test_shared_overlay_split.mjs +63 -63
  469. package/skills/a2h-utg-static/scripts/tests/test_slug_parity.mjs +58 -58
  470. package/skills/a2h-utg-static/scripts/tests/test_starter_node_id.mjs +41 -41
  471. package/skills/a2h-utg-static/scripts/tests/test_state_guard_arity.mjs +109 -109
  472. package/skills/a2h-utg-static/scripts/tests/test_state_guard_commented_candidates.mjs +68 -68
  473. package/skills/a2h-utg-static/scripts/tests/test_state_guard_model_gates.mjs +127 -127
  474. package/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -130
  475. package/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -51
  476. package/skills/a2h-utg-static/scripts/tests/test_template_method_layout.mjs +81 -81
  477. package/skills/a2h-utg-static/scripts/tests/test_trigger_id_spelling.mjs +68 -68
  478. package/skills/a2h-utg-static/scripts/tests/test_ui_elements_action_override.mjs +91 -91
  479. package/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -110
  480. package/skills/a2h-utg-static/scripts/tests/test_ui_elements_nl_hint_key.mjs +89 -89
  481. package/skills/a2h-utg-static/scripts/tests/test_uiless_host_fold.mjs +98 -98
  482. package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -231
  483. package/skills/a2h-utg-static/scripts/tests/test_view_click_refs.mjs +104 -104
  484. package/skills/a2h-utg-static/scripts/tests/test_view_id_label.mjs +69 -69
  485. package/skills/a2h-utg-static/scripts/tests/test_view_interactions.mjs +346 -346
  486. package/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +340 -273
  487. package/skills/a2h-utg-static/scripts/tests/test_widget_class_scope.mjs +92 -92
  488. package/skills/a2h-utg-static/scripts/tests/test_window_nav_kotlin.mjs +158 -158
  489. package/skills/a2h-utg-static/scripts/tests/test_worklist_parts.mjs +65 -65
  490. package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1119 -1119
  491. package/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -244
  492. package/skills/a2h-utg-static/scripts/utg_html.mjs +721 -721
  493. package/skills/a2h-utg-static/scripts/viewpage_nav.mjs +589 -485
  494. package/skills/a2h-utg-static/scripts/window_nav.mjs +240 -240
  495. package/skills/a2h-utg-static/scripts/worklist_parts.mjs +154 -154
  496. package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -769
  497. package/skills/a2h-utg-static/tools/package.json +3 -3
@@ -1,64 +1,64 @@
1
- <!doctype html>
2
- <html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
3
- <title>UTG · 静态结构与动态证据</title>
4
- <style>
5
- *{box-sizing:border-box}body{margin:0;font:14px system-ui,sans-serif;color:#223047;background:#f3f5f8}header{padding:16px 22px;background:#14263f;color:white}h1{font-size:20px;margin:0 0 8px}header p{margin:0;color:#c4d6ec}button,input,select{font:inherit;padding:7px;border:1px solid #b8c6d6;border-radius:5px;background:white}button,a{cursor:pointer}button:hover{background:#e9f2ff}nav{display:flex;gap:12px;align-items:center;padding:10px 20px;flex-wrap:wrap}main{display:grid;grid-template-columns:minmax(460px,1fr) minmax(420px,44%);height:calc(100vh - 155px);min-height:500px}.graph{position:relative;overflow:hidden;background:#fff;border:1px solid #d7dfe8}svg{width:100%;height:100%;touch-action:none}aside{overflow:auto;padding:20px;border-left:1px solid #ccd7e4;background:#f8fafc}h2{font-size:18px;overflow-wrap:anywhere}h3{font-size:15px}code{overflow-wrap:anywhere;font-size:12px}small,.muted{color:#63758b}.legend{position:absolute;bottom:10px;left:12px;background:#ffffffed;padding:8px;border-radius:6px;pointer-events:none}.node{cursor:pointer}.node text{font:12px system-ui;fill:#263b53}.edge{stroke:#c9d2df;stroke-width:1.2}.confirmed{stroke:#24977c;stroke-width:2}.observed{stroke:#c48a37;stroke-dasharray:5 4}.selected circle{stroke:#14263f;stroke-width:4}.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.thumbs{display:flex;overflow:auto;gap:8px;margin:12px 0}.thumbs button{min-width:84px;max-width:110px}.thumbs img{width:72px;height:90px;object-fit:contain}.thumbs .active{border:2px solid #2872ba}.shot{width:100%;max-height:580px;object-fit:contain;background:#e7edf3;border-radius:8px}.card{background:white;border:1px solid #d8e0e9;border-radius:7px;padding:12px;margin:12px 0}.notice{background:#fff4da;padding:10px;border-radius:5px;line-height:1.6}pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px;max-height:400px;overflow:auto}a{color:#175b9b}.tree{max-height:390px;overflow:auto;font:12px ui-monospace,monospace}.tree summary{padding:4px;overflow-wrap:anywhere}.tree details{margin-left:12px}label{display:inline-flex;align-items:center;gap:5px}#count{font-size:12px}#zoom{min-width:65px}@media(max-width:850px){main{display:block;height:auto}.graph{height:450px}aside{max-height:none}nav{padding:8px}}
6
- </style>
7
- <header><h1>UTG · 静态结构与动态证据</h1><p id="summary"></p></header>
8
- <nav><input id="search" placeholder="搜索页面名称或 ID" aria-label="搜索节点"><select id="filter" aria-label="节点过滤"><option value="all">全部静态节点</option><option value="captured">有抓取证据</option><option value="missing">静态未抓到</option></select><label><input type="checkbox" id="dynamic">动态未映射节点</label><label><input type="checkbox" id="runtime">显示运行时连线</label><button id="fit">适应画布</button><button id="plus">放大</button><button id="minus">缩小</button><span id="count"></span></nav>
9
- <main><div class="graph"><svg id="graph" aria-label="UTG 节点图"><defs><marker id="arrow" viewBox="0 0 10 10" refX="25" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" fill="#8798ae"/></marker></defs><g id="scene"></g></svg><div class="legend">● 绿色:有证据 ● 灰色:静态候选 ● 橙色:动态未映射<br>实线:静态边(绿线已确认) 虚线:观察到的运行时跳转<br>滚轮缩放 · 拖动画布 · 点击节点查看截图</div></div><aside id="detail"><h2>选择一个节点</h2><p>查看状态、滚动视口、截图和对应组件树。</p></aside></main>
10
- <script id="utg-data" type="application/json">__UTG_DATA__</script>
11
- <script>
12
- 'use strict';
13
- const data=JSON.parse(document.getElementById('utg-data').textContent),byId=new Map(data.nodes.map(n=>[n.id,n])),caps=data.captures;
14
- const $=id=>document.getElementById(id),NS='http://www.w3.org/2000/svg';
15
- const el=(tag,text,cls)=>{const e=document.createElement(tag);if(text!==undefined)e.textContent=text;if(cls)e.className=cls;return e};
16
- const svgEl=(tag,attrs)=>{const e=document.createElementNS(NS,tag);for(const[k,v]of Object.entries(attrs))e.setAttribute(k,v);return e};
17
- const safeURL=value=>{if(!value)return '';try{const u=new URL(value,location.href);return ['file:','http:','https:'].includes(u.protocol)?u.href:''}catch{return ''}};
18
- function assetLink(asset,label){if(!asset?.exists)return el('span',label+':文件缺失','muted');const a=el('a',label);a.href=safeURL(asset.url);a.target='_blank';a.rel='noopener';return a}
19
- const meta=data.metadata;
20
- $('summary').textContent=`静态节点并集 ${meta.static_union_nodes} · 有抓取证据 ${meta.captured_static_nodes} · 原始观察 ${meta.capture_count} · 动态未映射候选 ${meta.dynamic_nodes}`;
21
- let selected=null,panX=30,panY=30,scale=1,positions=new Map(),shown=[];
22
- function transform(){$('scene').setAttribute('transform',`translate(${panX},${panY}) scale(${scale})`)}
23
- function draw(){
24
- const query=$('search').value.toLowerCase(),filter=$('filter').value;
25
- shown=data.nodes.filter(n=>($('dynamic').checked||n.evidence.origin!=='dynamic-only')&&(!query||(n.id+' '+n.label).toLowerCase().includes(query))&&(filter==='all'||(filter==='captured'?n.evidence.capture_count>0:n.evidence.capture_count===0)));
26
- const ids=new Set(shown.map(n=>n.id)),edges=data.links.filter(e=>ids.has(e.source)&&ids.has(e.target)&&($('runtime').checked||e.mechanism!=='runtime-observed'));
27
- // Directed breadth layers; disconnected/cyclic components get their own roots.
28
- const adj=new Map(shown.map(n=>[n.id,[]])),incoming=new Map(shown.map(n=>[n.id,0]));
29
- for(const e of edges){if(e.source===e.target||e.mechanism==='runtime-observed')continue;adj.get(e.source).push(e.target);incoming.set(e.target,incoming.get(e.target)+1)}
30
- const depth=new Map(),queue=[];for(const n of shown)if(incoming.get(n.id)===0){depth.set(n.id,0);queue.push(n.id)}
31
- function traverse(){for(let i=0;i<queue.length;i++){const id=queue[i];for(const next of adj.get(id))if(!depth.has(next)){depth.set(next,depth.get(id)+1);queue.push(next)}}}
32
- traverse();for(const n of shown)if(!depth.has(n.id)){depth.set(n.id,0);queue.length=0;queue.push(n.id);traverse()}
33
- const rows=new Map();positions=new Map();for(const n of shown){const d=depth.get(n.id),row=rows.get(d)||0;rows.set(d,row+1);positions.set(n.id,{x:60+d*300,y:40+row*66})}
34
- const scene=$('scene');scene.replaceChildren();for(const e of edges){const a=positions.get(e.source),b=positions.get(e.target);if(a===b)continue;const line=svgEl('line',{x1:a.x,y1:a.y,x2:b.x,y2:b.y,class:'edge '+(e.evidence.coverage||''),'marker-end':'url(#arrow)'});const title=svgEl('title',{});title.textContent=`${e.source} → ${e.target}\n${e.mechanism||''} / ${e.evidence.coverage}`;line.append(title);scene.append(line)}
35
- for(const n of shown){const p=positions.get(n.id),g=svgEl('g',{class:'node'+(n.id===selected?' selected':''),transform:`translate(${p.x},${p.y})`,tabindex:0,role:'button','aria-label':n.label||n.id,'data-node-id':n.id});const color=n.evidence.origin==='dynamic-only'?'#d79a39':n.evidence.capture_count?'#259c80':'#aab5c3';g.append(svgEl('circle',{r:11,fill:color}));const txt=svgEl('text',{x:18,y:4});const label=n.label||n.id;txt.textContent=label.length>31?label.slice(0,30)+'…':label;g.append(txt);const title=svgEl('title',{});title.textContent=n.id;g.append(title);g.onclick=e=>{e.stopPropagation();selectNode(n.id)};g.onkeydown=e=>{if(e.key==='Enter')selectNode(n.id)};scene.append(g)}
36
- $('count').textContent=`显示 ${shown.length} 个节点 / ${edges.length} 条边`;transform();
37
- }
38
- function fit(){if(!positions.size)return;const box=$('graph').getBoundingClientRect(),w=Math.max(...[...positions.values()].map(p=>p.x))+250,h=Math.max(...[...positions.values()].map(p=>p.y))+40;scale=Math.min(1.3,(box.width-35)/w,(box.height-30)/h);panX=20;panY=15;transform()}
39
- function selectNode(id){selected=id;draw();const n=byId.get(id),panel=$('detail');panel.replaceChildren(el('h2',n.label||id),el('code',id));panel.append(el('p',`${n.kind||''} · ${n.evidence.coverage} · ${n.evidence.capture_count} 次观察 / ${n.evidence.viewport_count} 个去重视口`));
40
- const notice=el('div','每张截图对应一次现场组件树。视口按采集先后排列,不保证从页顶到页底;未证明整页已遍历完。不同状态不拼接,所有原始观察均保留。','notice');panel.append(notice);
41
- if(n.evidence.origin==='campaign-snapshot')panel.append(el('p','此节点只在抓取时的静态快照中存在,所选新静态图中未找到同 ID。','notice'));
42
- if(!n.evidence.capture_ids.length){panel.append(el('p','尚无匹配的抓取证据;保留静态节点。'));}else{
43
- const selector=el('select');selector.id='variant';selector.setAttribute('aria-label','选择状态');for(const v of n.evidence.variants){const o=el('option',`${v.environment_id} · ${JSON.stringify(v.state)} · ${v.viewports.length} 个视口`);o.value=v.id;selector.append(o)}panel.append(selector);const box=el('div');panel.append(box);selector.onchange=()=>showVariant(n,n.evidence.variants.find(v=>v.id===selector.value),box);showVariant(n,n.evidence.variants[0],box);
44
- }
45
- const connections=el('details'),sum=el('summary','相邻节点');connections.append(sum);const neighbors=new Set();for(const edge of data.links){if(edge.source===id)neighbors.add(edge.target);if(edge.target===id)neighbors.add(edge.source)}for(const other of neighbors){if(other===id)continue;const b=el('button',byId.get(other)?.label||other);b.onclick=()=>selectNode(other);connections.append(b)}panel.append(connections);
46
- const details=el('details');details.append(el('summary','静态属性及版本来源'),el('pre',JSON.stringify(n.evidence.static_versions,null,2)));panel.append(details);
47
- if(n.runtime_widget_status){
48
- const wd=el('details'),ws=Object.values(n.runtime_widget_status),matched=ws.filter(x=>x.status==='matched').length,ambiguous=ws.filter(x=>x.status==='ambiguous').length;
49
- wd.append(el('summary',`静态控件对齐(${matched}/${ws.length} 已匹配,${ambiguous} 个歧义)`));
50
- const table=el('div','');
51
- for(const s of ws){const item=el('details','');const title=s.static.widget||s.static.view_id||`控件 ${s.widget_index}`;item.append(el('summary',`${title} · ${s.status} · ${Math.round(s.confidence*100)}%`));const p=el('p',`采集:${s.capture_ids.length} · 未匹配:${s.unmatched_capture_ids.length} · 歧义:${s.ambiguous.length}`,'muted');item.append(p);const pre=el('pre',JSON.stringify({static:s.static,matches:s.matches,enabled_states:s.enabled_states,clickable_states:s.clickable_states,checked_states:s.checked_states,selected_states:s.selected_states,ambiguous:s.ambiguous},null,2));item.append(pre);table.append(item)}
52
- wd.append(table);panel.append(wd);
53
- }
54
- }
55
- function showVariant(node,variant,box){box.replaceChildren();const toolbar=el('div',undefined,'toolbar'),mode=el('select');mode.id='capture-mode';for(const [value,label] of [['views','去重视口'],['all','所有原始观察']]){const o=el('option',label);o.value=value;mode.append(o)}toolbar.append(mode);box.append(toolbar);const thumbs=el('div',undefined,'thumbs'),detail=el('div');box.append(thumbs,detail);
56
- function render(){const ids=mode.value==='all'?node.evidence.capture_ids.filter(id=>caps[id].variant_id===variant.id):variant.viewports.map(v=>v.representative_capture);thumbs.replaceChildren();ids.forEach((id,i)=>{const c=caps[id],b=el('button');b.setAttribute('aria-label',`视口 ${i+1}`);if(c.screenshot?.exists){const img=el('img');img.src=safeURL(c.screenshot.url);img.loading='lazy';img.alt=`视口 ${i+1}`;b.append(img)}b.append(el('div',String(i+1)));b.onclick=()=>{for(const sibling of thumbs.children)sibling.classList.remove('active');b.classList.add('active');showCapture(c,detail,i,ids.length)};thumbs.append(b)});thumbs.firstChild?.click()}mode.onchange=render;render();
57
- }
58
- function showCapture(c,box,index,count){box.replaceChildren(el('p',`${index+1} / ${count} · ${c.observation_id}`,'muted'));if(c.screenshot?.exists){const a=assetLink(c.screenshot,'');const img=el('img',undefined,'shot');img.id='screenshot';img.src=safeURL(c.screenshot.url);img.alt=`${c.node_id} 截图`;a.append(img);box.append(a)}else box.append(el('p','截图文件缺失','notice'));const links=el('div',undefined,'toolbar');links.append(assetLink(c.screenshot,'打开原图'),assetLink(c.tree,'打开原始组件树'));box.append(links);box.append(el('p','进入动作:'+JSON.stringify(c.incoming_action||{})+' · '+(c.resolution.reason||'未映射'),'muted'));
59
- const tree=el('details');tree.id='component-tree';tree.append(el('summary',`组件树(${c.nodes.length} 个组件)`));const content=el('div',undefined,'tree');tree.append(content);tree.addEventListener('toggle',()=>{if(!tree.open||content.childNodes.length)return;const entries=c.nodes.map((n,i)=>{const d=el('details'),title=[n.class?.split('.').pop(),n.resource_id,n.text||n.content_desc].filter(Boolean).join(' · ');d.append(el('summary',title||`组件 ${i}`),el('pre',JSON.stringify(n,null,2)));return d});entries.forEach((d,i)=>{const p=c.nodes[i].parent_index;if(Number.isInteger(p)&&p>=0&&p<i)entries[p].append(d);else content.append(d)});});box.append(tree);
60
- }
61
- $('search').oninput=draw;$('filter').onchange=draw;$('dynamic').onchange=draw;$('runtime').onchange=draw;$('fit').onclick=fit;$('plus').onclick=()=>{scale=Math.min(4,scale*1.3);transform()};$('minus').onclick=()=>{scale=Math.max(.02,scale/1.3);transform()};
62
- let drag=null;const svg=$('graph');svg.addEventListener('pointerdown',e=>{if(e.target.closest('.node'))return;drag={x:e.clientX,y:e.clientY,px:panX,py:panY};svg.setPointerCapture(e.pointerId)});svg.addEventListener('pointermove',e=>{if(drag){panX=drag.px+e.clientX-drag.x;panY=drag.py+e.clientY-drag.y;transform()}});svg.addEventListener('pointerup',()=>drag=null);svg.addEventListener('pointercancel',()=>drag=null);svg.addEventListener('wheel',e=>{e.preventDefault();const r=svg.getBoundingClientRect(),x=e.clientX-r.left,y=e.clientY-r.top,next=Math.max(.02,Math.min(4,scale*Math.exp(-e.deltaY*.001)));panX=x-(x-panX)*next/scale;panY=y-(y-panY)*next/scale;scale=next;transform()},{passive:false});
63
- draw();fit();const first=shown.find(n=>n.evidence.capture_count);if(first)selectNode(first.id);
64
- </script></html>
1
+ <!doctype html>
2
+ <html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
3
+ <title>UTG · 静态结构与动态证据</title>
4
+ <style>
5
+ *{box-sizing:border-box}body{margin:0;font:14px system-ui,sans-serif;color:#223047;background:#f3f5f8}header{padding:16px 22px;background:#14263f;color:white}h1{font-size:20px;margin:0 0 8px}header p{margin:0;color:#c4d6ec}button,input,select{font:inherit;padding:7px;border:1px solid #b8c6d6;border-radius:5px;background:white}button,a{cursor:pointer}button:hover{background:#e9f2ff}nav{display:flex;gap:12px;align-items:center;padding:10px 20px;flex-wrap:wrap}main{display:grid;grid-template-columns:minmax(460px,1fr) minmax(420px,44%);height:calc(100vh - 155px);min-height:500px}.graph{position:relative;overflow:hidden;background:#fff;border:1px solid #d7dfe8}svg{width:100%;height:100%;touch-action:none}aside{overflow:auto;padding:20px;border-left:1px solid #ccd7e4;background:#f8fafc}h2{font-size:18px;overflow-wrap:anywhere}h3{font-size:15px}code{overflow-wrap:anywhere;font-size:12px}small,.muted{color:#63758b}.legend{position:absolute;bottom:10px;left:12px;background:#ffffffed;padding:8px;border-radius:6px;pointer-events:none}.node{cursor:pointer}.node text{font:12px system-ui;fill:#263b53}.edge{stroke:#c9d2df;stroke-width:1.2}.confirmed{stroke:#24977c;stroke-width:2}.observed{stroke:#c48a37;stroke-dasharray:5 4}.selected circle{stroke:#14263f;stroke-width:4}.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}.thumbs{display:flex;overflow:auto;gap:8px;margin:12px 0}.thumbs button{min-width:84px;max-width:110px}.thumbs img{width:72px;height:90px;object-fit:contain}.thumbs .active{border:2px solid #2872ba}.shot{width:100%;max-height:580px;object-fit:contain;background:#e7edf3;border-radius:8px}.card{background:white;border:1px solid #d8e0e9;border-radius:7px;padding:12px;margin:12px 0}.notice{background:#fff4da;padding:10px;border-radius:5px;line-height:1.6}pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px;max-height:400px;overflow:auto}a{color:#175b9b}.tree{max-height:390px;overflow:auto;font:12px ui-monospace,monospace}.tree summary{padding:4px;overflow-wrap:anywhere}.tree details{margin-left:12px}label{display:inline-flex;align-items:center;gap:5px}#count{font-size:12px}#zoom{min-width:65px}@media(max-width:850px){main{display:block;height:auto}.graph{height:450px}aside{max-height:none}nav{padding:8px}}
6
+ </style>
7
+ <header><h1>UTG · 静态结构与动态证据</h1><p id="summary"></p></header>
8
+ <nav><input id="search" placeholder="搜索页面名称或 ID" aria-label="搜索节点"><select id="filter" aria-label="节点过滤"><option value="all">全部静态节点</option><option value="captured">有抓取证据</option><option value="missing">静态未抓到</option></select><label><input type="checkbox" id="dynamic">动态未映射节点</label><label><input type="checkbox" id="runtime">显示运行时连线</label><button id="fit">适应画布</button><button id="plus">放大</button><button id="minus">缩小</button><span id="count"></span></nav>
9
+ <main><div class="graph"><svg id="graph" aria-label="UTG 节点图"><defs><marker id="arrow" viewBox="0 0 10 10" refX="25" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" fill="#8798ae"/></marker></defs><g id="scene"></g></svg><div class="legend">● 绿色:有证据 ● 灰色:静态候选 ● 橙色:动态未映射<br>实线:静态边(绿线已确认) 虚线:观察到的运行时跳转<br>滚轮缩放 · 拖动画布 · 点击节点查看截图</div></div><aside id="detail"><h2>选择一个节点</h2><p>查看状态、滚动视口、截图和对应组件树。</p></aside></main>
10
+ <script id="utg-data" type="application/json">__UTG_DATA__</script>
11
+ <script>
12
+ 'use strict';
13
+ const data=JSON.parse(document.getElementById('utg-data').textContent),byId=new Map(data.nodes.map(n=>[n.id,n])),caps=data.captures;
14
+ const $=id=>document.getElementById(id),NS='http://www.w3.org/2000/svg';
15
+ const el=(tag,text,cls)=>{const e=document.createElement(tag);if(text!==undefined)e.textContent=text;if(cls)e.className=cls;return e};
16
+ const svgEl=(tag,attrs)=>{const e=document.createElementNS(NS,tag);for(const[k,v]of Object.entries(attrs))e.setAttribute(k,v);return e};
17
+ const safeURL=value=>{if(!value)return '';try{const u=new URL(value,location.href);return ['file:','http:','https:'].includes(u.protocol)?u.href:''}catch{return ''}};
18
+ function assetLink(asset,label){if(!asset?.exists)return el('span',label+':文件缺失','muted');const a=el('a',label);a.href=safeURL(asset.url);a.target='_blank';a.rel='noopener';return a}
19
+ const meta=data.metadata;
20
+ $('summary').textContent=`静态节点并集 ${meta.static_union_nodes} · 有抓取证据 ${meta.captured_static_nodes} · 原始观察 ${meta.capture_count} · 动态未映射候选 ${meta.dynamic_nodes}`;
21
+ let selected=null,panX=30,panY=30,scale=1,positions=new Map(),shown=[];
22
+ function transform(){$('scene').setAttribute('transform',`translate(${panX},${panY}) scale(${scale})`)}
23
+ function draw(){
24
+ const query=$('search').value.toLowerCase(),filter=$('filter').value;
25
+ shown=data.nodes.filter(n=>($('dynamic').checked||n.evidence.origin!=='dynamic-only')&&(!query||(n.id+' '+n.label).toLowerCase().includes(query))&&(filter==='all'||(filter==='captured'?n.evidence.capture_count>0:n.evidence.capture_count===0)));
26
+ const ids=new Set(shown.map(n=>n.id)),edges=data.links.filter(e=>ids.has(e.source)&&ids.has(e.target)&&($('runtime').checked||e.mechanism!=='runtime-observed'));
27
+ // Directed breadth layers; disconnected/cyclic components get their own roots.
28
+ const adj=new Map(shown.map(n=>[n.id,[]])),incoming=new Map(shown.map(n=>[n.id,0]));
29
+ for(const e of edges){if(e.source===e.target||e.mechanism==='runtime-observed')continue;adj.get(e.source).push(e.target);incoming.set(e.target,incoming.get(e.target)+1)}
30
+ const depth=new Map(),queue=[];for(const n of shown)if(incoming.get(n.id)===0){depth.set(n.id,0);queue.push(n.id)}
31
+ function traverse(){for(let i=0;i<queue.length;i++){const id=queue[i];for(const next of adj.get(id))if(!depth.has(next)){depth.set(next,depth.get(id)+1);queue.push(next)}}}
32
+ traverse();for(const n of shown)if(!depth.has(n.id)){depth.set(n.id,0);queue.length=0;queue.push(n.id);traverse()}
33
+ const rows=new Map();positions=new Map();for(const n of shown){const d=depth.get(n.id),row=rows.get(d)||0;rows.set(d,row+1);positions.set(n.id,{x:60+d*300,y:40+row*66})}
34
+ const scene=$('scene');scene.replaceChildren();for(const e of edges){const a=positions.get(e.source),b=positions.get(e.target);if(a===b)continue;const line=svgEl('line',{x1:a.x,y1:a.y,x2:b.x,y2:b.y,class:'edge '+(e.evidence.coverage||''),'marker-end':'url(#arrow)'});const title=svgEl('title',{});title.textContent=`${e.source} → ${e.target}\n${e.mechanism||''} / ${e.evidence.coverage}`;line.append(title);scene.append(line)}
35
+ for(const n of shown){const p=positions.get(n.id),g=svgEl('g',{class:'node'+(n.id===selected?' selected':''),transform:`translate(${p.x},${p.y})`,tabindex:0,role:'button','aria-label':n.label||n.id,'data-node-id':n.id});const color=n.evidence.origin==='dynamic-only'?'#d79a39':n.evidence.capture_count?'#259c80':'#aab5c3';g.append(svgEl('circle',{r:11,fill:color}));const txt=svgEl('text',{x:18,y:4});const label=n.label||n.id;txt.textContent=label.length>31?label.slice(0,30)+'…':label;g.append(txt);const title=svgEl('title',{});title.textContent=n.id;g.append(title);g.onclick=e=>{e.stopPropagation();selectNode(n.id)};g.onkeydown=e=>{if(e.key==='Enter')selectNode(n.id)};scene.append(g)}
36
+ $('count').textContent=`显示 ${shown.length} 个节点 / ${edges.length} 条边`;transform();
37
+ }
38
+ function fit(){if(!positions.size)return;const box=$('graph').getBoundingClientRect(),w=Math.max(...[...positions.values()].map(p=>p.x))+250,h=Math.max(...[...positions.values()].map(p=>p.y))+40;scale=Math.min(1.3,(box.width-35)/w,(box.height-30)/h);panX=20;panY=15;transform()}
39
+ function selectNode(id){selected=id;draw();const n=byId.get(id),panel=$('detail');panel.replaceChildren(el('h2',n.label||id),el('code',id));panel.append(el('p',`${n.kind||''} · ${n.evidence.coverage} · ${n.evidence.capture_count} 次观察 / ${n.evidence.viewport_count} 个去重视口`));
40
+ const notice=el('div','每张截图对应一次现场组件树。视口按采集先后排列,不保证从页顶到页底;未证明整页已遍历完。不同状态不拼接,所有原始观察均保留。','notice');panel.append(notice);
41
+ if(n.evidence.origin==='campaign-snapshot')panel.append(el('p','此节点只在抓取时的静态快照中存在,所选新静态图中未找到同 ID。','notice'));
42
+ if(!n.evidence.capture_ids.length){panel.append(el('p','尚无匹配的抓取证据;保留静态节点。'));}else{
43
+ const selector=el('select');selector.id='variant';selector.setAttribute('aria-label','选择状态');for(const v of n.evidence.variants){const o=el('option',`${v.environment_id} · ${JSON.stringify(v.state)} · ${v.viewports.length} 个视口`);o.value=v.id;selector.append(o)}panel.append(selector);const box=el('div');panel.append(box);selector.onchange=()=>showVariant(n,n.evidence.variants.find(v=>v.id===selector.value),box);showVariant(n,n.evidence.variants[0],box);
44
+ }
45
+ const connections=el('details'),sum=el('summary','相邻节点');connections.append(sum);const neighbors=new Set();for(const edge of data.links){if(edge.source===id)neighbors.add(edge.target);if(edge.target===id)neighbors.add(edge.source)}for(const other of neighbors){if(other===id)continue;const b=el('button',byId.get(other)?.label||other);b.onclick=()=>selectNode(other);connections.append(b)}panel.append(connections);
46
+ const details=el('details');details.append(el('summary','静态属性及版本来源'),el('pre',JSON.stringify(n.evidence.static_versions,null,2)));panel.append(details);
47
+ if(n.runtime_widget_status){
48
+ const wd=el('details'),ws=Object.values(n.runtime_widget_status),matched=ws.filter(x=>x.status==='matched').length,ambiguous=ws.filter(x=>x.status==='ambiguous').length;
49
+ wd.append(el('summary',`静态控件对齐(${matched}/${ws.length} 已匹配,${ambiguous} 个歧义)`));
50
+ const table=el('div','');
51
+ for(const s of ws){const item=el('details','');const title=s.static.widget||s.static.view_id||`控件 ${s.widget_index}`;item.append(el('summary',`${title} · ${s.status} · ${Math.round(s.confidence*100)}%`));const p=el('p',`采集:${s.capture_ids.length} · 未匹配:${s.unmatched_capture_ids.length} · 歧义:${s.ambiguous.length}`,'muted');item.append(p);const pre=el('pre',JSON.stringify({static:s.static,matches:s.matches,enabled_states:s.enabled_states,clickable_states:s.clickable_states,checked_states:s.checked_states,selected_states:s.selected_states,ambiguous:s.ambiguous},null,2));item.append(pre);table.append(item)}
52
+ wd.append(table);panel.append(wd);
53
+ }
54
+ }
55
+ function showVariant(node,variant,box){box.replaceChildren();const toolbar=el('div',undefined,'toolbar'),mode=el('select');mode.id='capture-mode';for(const [value,label] of [['views','去重视口'],['all','所有原始观察']]){const o=el('option',label);o.value=value;mode.append(o)}toolbar.append(mode);box.append(toolbar);const thumbs=el('div',undefined,'thumbs'),detail=el('div');box.append(thumbs,detail);
56
+ function render(){const ids=mode.value==='all'?node.evidence.capture_ids.filter(id=>caps[id].variant_id===variant.id):variant.viewports.map(v=>v.representative_capture);thumbs.replaceChildren();ids.forEach((id,i)=>{const c=caps[id],b=el('button');b.setAttribute('aria-label',`视口 ${i+1}`);if(c.screenshot?.exists){const img=el('img');img.src=safeURL(c.screenshot.url);img.loading='lazy';img.alt=`视口 ${i+1}`;b.append(img)}b.append(el('div',String(i+1)));b.onclick=()=>{for(const sibling of thumbs.children)sibling.classList.remove('active');b.classList.add('active');showCapture(c,detail,i,ids.length)};thumbs.append(b)});thumbs.firstChild?.click()}mode.onchange=render;render();
57
+ }
58
+ function showCapture(c,box,index,count){box.replaceChildren(el('p',`${index+1} / ${count} · ${c.observation_id}`,'muted'));if(c.screenshot?.exists){const a=assetLink(c.screenshot,'');const img=el('img',undefined,'shot');img.id='screenshot';img.src=safeURL(c.screenshot.url);img.alt=`${c.node_id} 截图`;a.append(img);box.append(a)}else box.append(el('p','截图文件缺失','notice'));const links=el('div',undefined,'toolbar');links.append(assetLink(c.screenshot,'打开原图'),assetLink(c.tree,'打开原始组件树'));box.append(links);box.append(el('p','进入动作:'+JSON.stringify(c.incoming_action||{})+' · '+(c.resolution.reason||'未映射'),'muted'));
59
+ const tree=el('details');tree.id='component-tree';tree.append(el('summary',`组件树(${c.nodes.length} 个组件)`));const content=el('div',undefined,'tree');tree.append(content);tree.addEventListener('toggle',()=>{if(!tree.open||content.childNodes.length)return;const entries=c.nodes.map((n,i)=>{const d=el('details'),title=[n.class?.split('.').pop(),n.resource_id,n.text||n.content_desc].filter(Boolean).join(' · ');d.append(el('summary',title||`组件 ${i}`),el('pre',JSON.stringify(n,null,2)));return d});entries.forEach((d,i)=>{const p=c.nodes[i].parent_index;if(Number.isInteger(p)&&p>=0&&p<i)entries[p].append(d);else content.append(d)});});box.append(tree);
60
+ }
61
+ $('search').oninput=draw;$('filter').onchange=draw;$('dynamic').onchange=draw;$('runtime').onchange=draw;$('fit').onclick=fit;$('plus').onclick=()=>{scale=Math.min(4,scale*1.3);transform()};$('minus').onclick=()=>{scale=Math.max(.02,scale/1.3);transform()};
62
+ let drag=null;const svg=$('graph');svg.addEventListener('pointerdown',e=>{if(e.target.closest('.node'))return;drag={x:e.clientX,y:e.clientY,px:panX,py:panY};svg.setPointerCapture(e.pointerId)});svg.addEventListener('pointermove',e=>{if(drag){panX=drag.px+e.clientX-drag.x;panY=drag.py+e.clientY-drag.y;transform()}});svg.addEventListener('pointerup',()=>drag=null);svg.addEventListener('pointercancel',()=>drag=null);svg.addEventListener('wheel',e=>{e.preventDefault();const r=svg.getBoundingClientRect(),x=e.clientX-r.left,y=e.clientY-r.top,next=Math.max(.02,Math.min(4,scale*Math.exp(-e.deltaY*.001)));panX=x-(x-panX)*next/scale;panY=y-(y-panY)*next/scale;scale=next;transform()},{passive:false});
63
+ draw();fit();const first=shown.find(n=>n.evidence.capture_count);if(first)selectNode(first.id);
64
+ </script></html>
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 openatx
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2017 openatx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,25 +1,25 @@
1
- u2.jar — third-party notice
2
-
3
- Origin
4
- The uiautomator2 Python package (openatx), release 3.7.0:
5
- https://github.com/openatx/uiautomator2/tree/3.7.0 (uiautomator2/assets/u2.jar)
6
- assets/version.json in that release lists "u2.jar": "0.4.0".
7
- Server source: https://github.com/openatx/android-uiautomator-server
8
- Copied unmodified.
9
- sha256 0b74e83c55f443539a9f76f5ce023a51466b764b1100e4097a897053fdfc0eb6
10
- size 3,707,333 bytes
11
-
12
- Licenses
13
- uiautomator2 / android-uiautomator-server MIT see u2.LICENSE
14
- The jar also bundles, under their own licenses:
15
- JUnit 4 EPL-1.0 LICENSE-junit.txt inside the jar
16
- AndroidX (activity, appcompat, core, fragment, lifecycle, ...; versions in
17
- META-INF/androidx.*.version inside the jar)
18
- Apache-2.0 https://www.apache.org/licenses/LICENSE-2.0
19
- jsonrpc4j 1.5.0 (briandilley/jsonrpc4j) MIT https://github.com/briandilley/jsonrpc4j
20
- Jackson (jackson-core / databind / annotations)
21
- Apache-2.0 https://github.com/FasterXML/jackson
22
- NanoHTTPD BSD-3-Clause https://github.com/NanoHttpd/nanohttpd
23
-
24
- The jar is redistributed as-is. It is pushed to the Android device under test
25
- (/data/local/tmp/u2.jar) and run there; nothing in this skill links against it.
1
+ u2.jar — third-party notice
2
+
3
+ Origin
4
+ The uiautomator2 Python package (openatx), release 3.7.0:
5
+ https://github.com/openatx/uiautomator2/tree/3.7.0 (uiautomator2/assets/u2.jar)
6
+ assets/version.json in that release lists "u2.jar": "0.4.0".
7
+ Server source: https://github.com/openatx/android-uiautomator-server
8
+ Copied unmodified.
9
+ sha256 0b74e83c55f443539a9f76f5ce023a51466b764b1100e4097a897053fdfc0eb6
10
+ size 3,707,333 bytes
11
+
12
+ Licenses
13
+ uiautomator2 / android-uiautomator-server MIT see u2.LICENSE
14
+ The jar also bundles, under their own licenses:
15
+ JUnit 4 EPL-1.0 LICENSE-junit.txt inside the jar
16
+ AndroidX (activity, appcompat, core, fragment, lifecycle, ...; versions in
17
+ META-INF/androidx.*.version inside the jar)
18
+ Apache-2.0 https://www.apache.org/licenses/LICENSE-2.0
19
+ jsonrpc4j 1.5.0 (briandilley/jsonrpc4j) MIT https://github.com/briandilley/jsonrpc4j
20
+ Jackson (jackson-core / databind / annotations)
21
+ Apache-2.0 https://github.com/FasterXML/jackson
22
+ NanoHTTPD BSD-3-Clause https://github.com/NanoHttpd/nanohttpd
23
+
24
+ The jar is redistributed as-is. It is pushed to the Android device under test
25
+ (/data/local/tmp/u2.jar) and run there; nothing in this skill links against it.
@@ -1,9 +1,9 @@
1
- # Protocol and plan
2
-
3
- The campaign is `static contract -> state/phase obligations -> serialized adapters -> evidence store -> fused UTG -> audit`.
4
-
5
- An event is `{schema:"utg-event/1", id, kind, environment_id, payload, evidence[]}`. `observation` contains `observation_id`, package/activity/window, normalized `nodes`, `identity` and artifact paths. `action_result` contains `task_id`, `outcome`, `before`, `after`, and `reason`. `mapping` and `edge_mapping` retain source and confidence. A dynamic edge is confirmed only when both observations and the action are present.
6
-
7
- An environment is an abstract state vector such as `auth=logged_out`, `content=empty`, `camera=granted`, `network=offline`. Create a new environment only when a static guard or runtime evidence requires it; do not enumerate a Cartesian product. Each phase has prerequisites, fixtures, obligations, a bounded retry budget, and an explicit terminal reason (`completed`, `blocked`, `unsupported`, `budget-exhausted`, or `pending`).
8
-
9
- External tools use a wrapper with separate request/response JSON files. Their observations are `unmapped` until a configured positive rule or deterministic replay proves identity. Preserve raw traces and provenance.
1
+ # Protocol and plan
2
+
3
+ The campaign is `static contract -> state/phase obligations -> serialized adapters -> evidence store -> fused UTG -> audit`.
4
+
5
+ An event is `{schema:"utg-event/1", id, kind, environment_id, payload, evidence[]}`. `observation` contains `observation_id`, package/activity/window, normalized `nodes`, `identity` and artifact paths. `action_result` contains `task_id`, `outcome`, `before`, `after`, and `reason`. `mapping` and `edge_mapping` retain source and confidence. A dynamic edge is confirmed only when both observations and the action are present.
6
+
7
+ An environment is an abstract state vector such as `auth=logged_out`, `content=empty`, `camera=granted`, `network=offline`. Create a new environment only when a static guard or runtime evidence requires it; do not enumerate a Cartesian product. Each phase has prerequisites, fixtures, obligations, a bounded retry budget, and an explicit terminal reason (`completed`, `blocked`, `unsupported`, `budget-exhausted`, or `pending`).
8
+
9
+ External tools use a wrapper with separate request/response JSON files. Their observations are `unmapped` until a configured positive rule or deterministic replay proves identity. Preserve raw traces and provenance.
@@ -1,143 +1,143 @@
1
- #!/usr/bin/env node
2
- /**
3
- * app_settings.mjs — port of app_settings.py. Build `app-setting` state phases from the static
4
- * guard facts (see the Python docstring: one titled two-state preference row per phase, opened by
5
- * the campaign's compiled screen task, tapped by text, proven by the row's switch after relaunch).
6
- *
7
- * app_settings.mjs <campaign> --config <config.json> [--base <requirement>=<fixture phase id> ...]
8
- *
9
- * Exports: SETTING_KIND, parseReq, screenTask, rowToggleSteps, build, main
10
- * `bases` is a Map keyed by tupleKey(...sorted requirements) -> phase id.
11
- */
12
- import * as path from 'node:path';
13
- import { pathToFileURL } from 'node:url';
14
- import {
15
- ArgumentParser, dset, get, jsonDumps, jsonLoads, keysOf, mget, or, pJoin, pyEq, pyPrint, pyRepr, pyStr,
16
- readText, runMain, sortedBy, sortedStr, truthy, tupleKey,
17
- } from './utg_explorer/_py.mjs';
18
- import { atomicWriteJson } from './utg_explorer/adapters.mjs';
19
-
20
- export const SETTING_KIND = 'app-setting';
21
-
22
- const isDict = (v) => v !== null && typeof v === 'object' && !Array.isArray(v) && !(v instanceof Map);
23
- const setdefault = (d, k, v) => (Object.hasOwn(d, k) ? d[k] : dset(d, k, v));
24
- /** dict(s): shallow copy keeping key order. */
25
- const dictCopy = (s) => { const o = {}; for (const k of keysOf(s)) { dset(o, k, s[k]); } return o; };
26
-
27
- export function parseReq(r) {
28
- if (typeof r !== 'string') { return null; }
29
- try {
30
- const j = jsonLoads(r);
31
- return isDict(j) ? j : null;
32
- } catch { return null; }
33
- }
34
-
35
- /** The compiled task that opens `screen`, preferring a device-confirmed one. */
36
- export function screenTask(doc, screen) {
37
- const confirmed = new Set();
38
- for (const e of mget(doc, 'events')) {
39
- if (mget(e, 'kind') === 'task_result' && get(mget(e, 'payload'), 'outcome') === 'confirmed') {
40
- confirmed.add(mget(e.payload, 'task_id').split('@')[0]);
41
- }
42
- }
43
- let cands = mget(doc, 'tasks').filter((t) => !mget(t, 'task_id').includes('@') && mget(t, 'target_static') === screen &&
44
- mget(t, 'status') === 'compiled');
45
- cands = sortedBy(cands, (t) => [confirmed.has(t.task_id) ? 0 : 1, (or(get(t, 'replay'), []) ).length]);
46
- return cands.length ? cands[0] : null;
47
- }
48
-
49
- /** Tap the row only while it shows the other value. */
50
- export function rowToggleSteps(fact) {
51
- const title = get(fact, 'row_title');
52
- return [{ type: 'click_candidates', selectors: [{ text: title }], static_label: title,
53
- reveal: { text: title },
54
- when: { all: [{ text: title }], rows: [{ title, checked: !truthy(mget(fact, 'value')) }] } }];
55
- }
56
-
57
- const reqsOf = (p) => or(get(p, 'requires'), []);
58
- const isSettingFact = (f) => truthy(f) && get(f, 'kind') === SETTING_KIND;
59
-
60
- export function build(doc, config, bases) {
61
- const fixtures = setdefault(config, 'fixtures', {}); const probes = setdefault(config, 'phase_probes', {});
62
- const cleanup = setdefault(config, 'cleanup', {});
63
- const launch = { type: 'launch', component: mget(config, 'launch_component'), restart: true };
64
- const report = [];
65
- for (const p of mget(doc, 'phases')) {
66
- let facts = reqsOf(p).map(parseReq).filter(isSettingFact);
67
- const plain = reqsOf(p).filter((r) => r !== SETTING_KIND && !(get(or(parseReq(r), {}), 'kind') === SETTING_KIND));
68
- if (!reqsOf(p).includes(SETTING_KIND) && !facts.length) { continue; }
69
- if (Object.hasOwn(fixtures, mget(p, 'id'))) { report.push({ phase: p.id, status: 'exists' }); continue; }
70
- if (!facts.length) {
71
- facts = mget(doc, 'phases').flatMap((q) => reqsOf(q).map(parseReq)).filter(isSettingFact);
72
- const uniq = new Map();
73
- for (const f of facts) { uniq.set(jsonDumps(f, { sort_keys: true }), f); }
74
- facts = [...uniq.values()];
75
- }
76
- if (facts.length !== 1) {
77
- report.push({ phase: p.id, status: 'skipped', why: `${facts.length} settings named` }); continue;
78
- }
79
- const fact = facts[0];
80
- if (get(fact, 'control') !== 'toggle' || get(fact, 'value') === null || !truthy(get(fact, 'row_title'))) {
81
- report.push({ phase: p.id, status: 'skipped', why: 'not a titled toggle' }); continue;
82
- }
83
- const plainSorted = sortedStr(plain);
84
- let baseId = bases.get(tupleKey(...plainSorted)) ?? null;
85
- if (baseId === null) {
86
- const q = mget(doc, 'phases').find((x) => pyEq(sortedStr(reqsOf(x)), plainSorted) && Object.hasOwn(fixtures, mget(x, 'id')));
87
- baseId = q ? q.id : null;
88
- }
89
- if (baseId === null || !Object.hasOwn(fixtures, baseId)) {
90
- report.push({ phase: p.id, status: 'skipped', why: `no fixture for base ${pyRepr(plain)}` }); continue;
91
- }
92
- const st = screenTask(doc, mget(fact, 'screen'));
93
- if (st === null) {
94
- report.push({ phase: p.id, status: 'skipped', why: 'no compiled task opens ' + fact.screen }); continue;
95
- }
96
- const steps = [
97
- ...fixtures[baseId].map(dictCopy),
98
- dictCopy(or(mget(st, 'source_launch'), launch)), { type: 'wait', seconds: 2 },
99
- ...or(get(st, 'replay'), []).map(dictCopy), ...or(get(st, 'prelude'), []).map(dictCopy),
100
- dictCopy(mget(st, 'action')), { type: 'wait', seconds: 1 },
101
- ...rowToggleSteps(fact),
102
- { type: 'wait', seconds: 1 },
103
- { type: 'back', when: { any: [{ resource_name: 'button1' }, { resource_name: 'alertTitle' }],
104
- none: [{ text: mget(fact, 'row_title') }] } },
105
- { type: 'wait', seconds: 0.5, reveal: { text: fact.row_title } },
106
- { type: 'assert', rule: { all: [{ text: fact.row_title }],
107
- rows: [{ title: fact.row_title, checked: truthy(fact.value) }] } },
108
- launch, { type: 'wait', seconds: 3 },
109
- ];
110
- dset(fixtures, p.id, steps);
111
- const baseProbes = get(probes, baseId, []).map(dictCopy);
112
- const comp = mget(config, 'launch_component');
113
- const i = comp.indexOf('/');
114
- dset(probes, p.id, baseProbes.length ? baseProbes : [{ activity: i < 0 ? comp : comp.slice(i + 1), all: [] }]);
115
- dset(cleanup, p.id, [{ type: 'wait', seconds: 0.5 }]);
116
- setdefault(p, 'basis', []).push(`app-setting ${pyStr(mget(fact, 'pref_key'))}=${pyStr(fact.value)} via row '${pyStr(fact.row_title)}' on ${pyStr(fact.screen)} (${get(fact, 'basis', []).join(', ')})`);
117
- report.push({ phase: p.id, status: 'scheduled', base: baseId, screen_task: st.task_id });
118
- }
119
- return report;
120
- }
121
-
122
- export function main(argv = process.argv.slice(2)) {
123
- const ap = new ArgumentParser();
124
- ap.add_argument('campaign'); ap.add_argument('--config', { required: true });
125
- ap.add_argument('--base', { action: 'append', default: [], help: 'req1,req2=<phase id>' });
126
- const a = ap.parse_args(argv);
127
- const root = a.campaign;
128
- const doc = jsonLoads(readText(pJoin(root, 'campaign.json'), { encoding: 'utf-8' }));
129
- const config = jsonLoads(readText(a.config, { encoding: 'utf-8' }));
130
- const bases = new Map();
131
- for (const b of a.base) {
132
- const i = b.indexOf('=');
133
- if (i < 0) { throw new Error('not enough values to unpack (expected 2, got 1)'); }
134
- const k = b.slice(0, i); const v = b.slice(i + 1);
135
- bases.set(tupleKey(...sortedStr(k.split(',').filter((x) => x))), v);
136
- }
137
- const report = build(doc, config, bases);
138
- atomicWriteJson(pJoin(root, 'campaign.json'), doc);
139
- atomicWriteJson(a.config, config);
140
- pyPrint(jsonDumps(report, { ensure_ascii: false }));
141
- }
142
-
143
- if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { runMain(main); }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * app_settings.mjs — port of app_settings.py. Build `app-setting` state phases from the static
4
+ * guard facts (see the Python docstring: one titled two-state preference row per phase, opened by
5
+ * the campaign's compiled screen task, tapped by text, proven by the row's switch after relaunch).
6
+ *
7
+ * app_settings.mjs <campaign> --config <config.json> [--base <requirement>=<fixture phase id> ...]
8
+ *
9
+ * Exports: SETTING_KIND, parseReq, screenTask, rowToggleSteps, build, main
10
+ * `bases` is a Map keyed by tupleKey(...sorted requirements) -> phase id.
11
+ */
12
+ import * as path from 'node:path';
13
+ import { pathToFileURL } from 'node:url';
14
+ import {
15
+ ArgumentParser, dset, get, jsonDumps, jsonLoads, keysOf, mget, or, pJoin, pyEq, pyPrint, pyRepr, pyStr,
16
+ readText, runMain, sortedBy, sortedStr, truthy, tupleKey,
17
+ } from './utg_explorer/_py.mjs';
18
+ import { atomicWriteJson } from './utg_explorer/adapters.mjs';
19
+
20
+ export const SETTING_KIND = 'app-setting';
21
+
22
+ const isDict = (v) => v !== null && typeof v === 'object' && !Array.isArray(v) && !(v instanceof Map);
23
+ const setdefault = (d, k, v) => (Object.hasOwn(d, k) ? d[k] : dset(d, k, v));
24
+ /** dict(s): shallow copy keeping key order. */
25
+ const dictCopy = (s) => { const o = {}; for (const k of keysOf(s)) { dset(o, k, s[k]); } return o; };
26
+
27
+ export function parseReq(r) {
28
+ if (typeof r !== 'string') { return null; }
29
+ try {
30
+ const j = jsonLoads(r);
31
+ return isDict(j) ? j : null;
32
+ } catch { return null; }
33
+ }
34
+
35
+ /** The compiled task that opens `screen`, preferring a device-confirmed one. */
36
+ export function screenTask(doc, screen) {
37
+ const confirmed = new Set();
38
+ for (const e of mget(doc, 'events')) {
39
+ if (mget(e, 'kind') === 'task_result' && get(mget(e, 'payload'), 'outcome') === 'confirmed') {
40
+ confirmed.add(mget(e.payload, 'task_id').split('@')[0]);
41
+ }
42
+ }
43
+ let cands = mget(doc, 'tasks').filter((t) => !mget(t, 'task_id').includes('@') && mget(t, 'target_static') === screen &&
44
+ mget(t, 'status') === 'compiled');
45
+ cands = sortedBy(cands, (t) => [confirmed.has(t.task_id) ? 0 : 1, (or(get(t, 'replay'), []) ).length]);
46
+ return cands.length ? cands[0] : null;
47
+ }
48
+
49
+ /** Tap the row only while it shows the other value. */
50
+ export function rowToggleSteps(fact) {
51
+ const title = get(fact, 'row_title');
52
+ return [{ type: 'click_candidates', selectors: [{ text: title }], static_label: title,
53
+ reveal: { text: title },
54
+ when: { all: [{ text: title }], rows: [{ title, checked: !truthy(mget(fact, 'value')) }] } }];
55
+ }
56
+
57
+ const reqsOf = (p) => or(get(p, 'requires'), []);
58
+ const isSettingFact = (f) => truthy(f) && get(f, 'kind') === SETTING_KIND;
59
+
60
+ export function build(doc, config, bases) {
61
+ const fixtures = setdefault(config, 'fixtures', {}); const probes = setdefault(config, 'phase_probes', {});
62
+ const cleanup = setdefault(config, 'cleanup', {});
63
+ const launch = { type: 'launch', component: mget(config, 'launch_component'), restart: true };
64
+ const report = [];
65
+ for (const p of mget(doc, 'phases')) {
66
+ let facts = reqsOf(p).map(parseReq).filter(isSettingFact);
67
+ const plain = reqsOf(p).filter((r) => r !== SETTING_KIND && !(get(or(parseReq(r), {}), 'kind') === SETTING_KIND));
68
+ if (!reqsOf(p).includes(SETTING_KIND) && !facts.length) { continue; }
69
+ if (Object.hasOwn(fixtures, mget(p, 'id'))) { report.push({ phase: p.id, status: 'exists' }); continue; }
70
+ if (!facts.length) {
71
+ facts = mget(doc, 'phases').flatMap((q) => reqsOf(q).map(parseReq)).filter(isSettingFact);
72
+ const uniq = new Map();
73
+ for (const f of facts) { uniq.set(jsonDumps(f, { sort_keys: true }), f); }
74
+ facts = [...uniq.values()];
75
+ }
76
+ if (facts.length !== 1) {
77
+ report.push({ phase: p.id, status: 'skipped', why: `${facts.length} settings named` }); continue;
78
+ }
79
+ const fact = facts[0];
80
+ if (get(fact, 'control') !== 'toggle' || get(fact, 'value') === null || !truthy(get(fact, 'row_title'))) {
81
+ report.push({ phase: p.id, status: 'skipped', why: 'not a titled toggle' }); continue;
82
+ }
83
+ const plainSorted = sortedStr(plain);
84
+ let baseId = bases.get(tupleKey(...plainSorted)) ?? null;
85
+ if (baseId === null) {
86
+ const q = mget(doc, 'phases').find((x) => pyEq(sortedStr(reqsOf(x)), plainSorted) && Object.hasOwn(fixtures, mget(x, 'id')));
87
+ baseId = q ? q.id : null;
88
+ }
89
+ if (baseId === null || !Object.hasOwn(fixtures, baseId)) {
90
+ report.push({ phase: p.id, status: 'skipped', why: `no fixture for base ${pyRepr(plain)}` }); continue;
91
+ }
92
+ const st = screenTask(doc, mget(fact, 'screen'));
93
+ if (st === null) {
94
+ report.push({ phase: p.id, status: 'skipped', why: 'no compiled task opens ' + fact.screen }); continue;
95
+ }
96
+ const steps = [
97
+ ...fixtures[baseId].map(dictCopy),
98
+ dictCopy(or(mget(st, 'source_launch'), launch)), { type: 'wait', seconds: 2 },
99
+ ...or(get(st, 'replay'), []).map(dictCopy), ...or(get(st, 'prelude'), []).map(dictCopy),
100
+ dictCopy(mget(st, 'action')), { type: 'wait', seconds: 1 },
101
+ ...rowToggleSteps(fact),
102
+ { type: 'wait', seconds: 1 },
103
+ { type: 'back', when: { any: [{ resource_name: 'button1' }, { resource_name: 'alertTitle' }],
104
+ none: [{ text: mget(fact, 'row_title') }] } },
105
+ { type: 'wait', seconds: 0.5, reveal: { text: fact.row_title } },
106
+ { type: 'assert', rule: { all: [{ text: fact.row_title }],
107
+ rows: [{ title: fact.row_title, checked: truthy(fact.value) }] } },
108
+ launch, { type: 'wait', seconds: 3 },
109
+ ];
110
+ dset(fixtures, p.id, steps);
111
+ const baseProbes = get(probes, baseId, []).map(dictCopy);
112
+ const comp = mget(config, 'launch_component');
113
+ const i = comp.indexOf('/');
114
+ dset(probes, p.id, baseProbes.length ? baseProbes : [{ activity: i < 0 ? comp : comp.slice(i + 1), all: [] }]);
115
+ dset(cleanup, p.id, [{ type: 'wait', seconds: 0.5 }]);
116
+ setdefault(p, 'basis', []).push(`app-setting ${pyStr(mget(fact, 'pref_key'))}=${pyStr(fact.value)} via row '${pyStr(fact.row_title)}' on ${pyStr(fact.screen)} (${get(fact, 'basis', []).join(', ')})`);
117
+ report.push({ phase: p.id, status: 'scheduled', base: baseId, screen_task: st.task_id });
118
+ }
119
+ return report;
120
+ }
121
+
122
+ export function main(argv = process.argv.slice(2)) {
123
+ const ap = new ArgumentParser();
124
+ ap.add_argument('campaign'); ap.add_argument('--config', { required: true });
125
+ ap.add_argument('--base', { action: 'append', default: [], help: 'req1,req2=<phase id>' });
126
+ const a = ap.parse_args(argv);
127
+ const root = a.campaign;
128
+ const doc = jsonLoads(readText(pJoin(root, 'campaign.json'), { encoding: 'utf-8' }));
129
+ const config = jsonLoads(readText(a.config, { encoding: 'utf-8' }));
130
+ const bases = new Map();
131
+ for (const b of a.base) {
132
+ const i = b.indexOf('=');
133
+ if (i < 0) { throw new Error('not enough values to unpack (expected 2, got 1)'); }
134
+ const k = b.slice(0, i); const v = b.slice(i + 1);
135
+ bases.set(tupleKey(...sortedStr(k.split(',').filter((x) => x))), v);
136
+ }
137
+ const report = build(doc, config, bases);
138
+ atomicWriteJson(pJoin(root, 'campaign.json'), doc);
139
+ atomicWriteJson(a.config, config);
140
+ pyPrint(jsonDumps(report, { ensure_ascii: false }));
141
+ }
142
+
143
+ if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { runMain(main); }