@buaa_smat/hometrans 0.1.19 → 26.0.0-devecocli.2
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.
- package/agents/build-fixer.md +406 -0
- package/agents/code-reviewer.md +461 -496
- package/agents/model-render-worker.md +34 -0
- package/agents/model-worker.md +23 -0
- package/agents/specgen-worker.md +18 -0
- package/commands/hometrans.md +17 -0
- package/devecocli-plugin/common.ts +2203 -0
- package/devecocli-plugin/install.ts +61 -0
- package/devecocli-plugin/uninstall.ts +26 -0
- package/devecocli-plugin/update.ts +66 -0
- package/index.js +1418 -0
- package/package.json +81 -66
- package/platforms/atomcode/agents/build-fixer.frontmatter.md +6 -0
- package/platforms/atomcode/agents/code-reviewer.frontmatter.md +6 -0
- package/platforms/atomcode/agents/model-render-worker.frontmatter.md +6 -0
- package/platforms/atomcode/agents/model-worker.frontmatter.md +6 -0
- package/platforms/atomcode/agents/specgen-worker.frontmatter.md +6 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +5 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +5 -0
- package/plugin.jsonc +12 -0
- package/skills/a2h-app-migrate/SKILL.md +181 -0
- package/skills/a2h-app-migrate/references/config.example.json +27 -0
- package/skills/a2h-app-migrate/references/specs.example.json +19 -0
- package/skills/a2h-app-migrate/references/stage-map.md +33 -0
- package/skills/a2h-app-migrate/references/workflow.yaml +1600 -0
- package/skills/a2h-app-migrate/scripts/android_index.mjs +109 -0
- package/skills/a2h-app-migrate/scripts/check_arch_done.mjs +80 -0
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +95 -0
- package/skills/a2h-app-migrate/scripts/check_signing.mjs +152 -0
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +114 -0
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +277 -0
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +77 -0
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +147 -0
- package/skills/a2h-app-migrate/scripts/cli_values.mjs +32 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1388 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +651 -0
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +53 -0
- package/skills/a2h-app-migrate/scripts/json_io.mjs +35 -0
- package/skills/a2h-app-migrate/scripts/ledger.mjs +104 -0
- package/skills/a2h-app-migrate/scripts/lib-yaml-lite.mjs +288 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +713 -0
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +205 -0
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +121 -0
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +212 -0
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +30 -0
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +455 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +80 -0
- package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
- package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +92 -0
- package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +93 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +505 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
- package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +91 -0
- package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +109 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
- package/skills/a2h-app-migrate/test/test_preflight_report.mjs +83 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +144 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +315 -0
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +133 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +133 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +158 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +181 -0
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +39 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +168 -0
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
- package/skills/a2h-arch-generate/SKILL.md +375 -0
- package/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-android.md +103 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-uniapp.md +106 -0
- package/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
- package/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
- package/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
- package/skills/a2h-arch-generate/references/clustering-guidance.md +33 -0
- package/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
- package/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
- package/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
- package/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +120 -0
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +45 -0
- package/skills/a2h-arch-generate/references/reconciliation-model.md +204 -0
- package/skills/a2h-arch-generate/references/scope-policy.md +28 -0
- package/skills/a2h-arch-generate/references/semantic-review.md +65 -0
- package/skills/a2h-arch-generate/references/source-baseline.md +93 -0
- package/skills/a2h-arch-generate/references/source-ecosystems.md +54 -0
- package/skills/a2h-arch-generate/references/transformation-model.md +78 -0
- package/skills/a2h-arch-generate/scripts/check_module_staleness.mjs +284 -0
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +260 -0
- package/skills/a2h-arch-generate/scripts/compute_processing_order.mjs +325 -0
- package/skills/a2h-arch-generate/scripts/create_project.mjs +149 -0
- package/skills/a2h-arch-generate/scripts/dump_core_facts.mjs +151 -0
- package/skills/a2h-arch-generate/scripts/extract_core_components.mjs +167 -0
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +363 -0
- package/skills/a2h-arch-generate/scripts/generate_state.mjs +60 -0
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +326 -0
- package/skills/a2h-arch-generate/scripts/inspect_android_project.mjs +3739 -0
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +800 -0
- package/skills/a2h-arch-generate/scripts/inspect_project.mjs +251 -0
- package/skills/a2h-arch-generate/scripts/inspect_uniapp_project.mjs +809 -0
- package/skills/a2h-arch-generate/scripts/lib/py_compat.mjs +1454 -0
- package/skills/a2h-arch-generate/scripts/module_create/create.mjs +136 -0
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +636 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/build-profile.json5 +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/oh-package.json5 +10 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/applicationability/ApplicationAbility.ets +43 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/pages/Index.ets +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/module.json5 +26 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/color.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/string.json +16 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/background.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/foreground.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/layered_image.json +7 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/startIcon.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/mock/mock-config.json5 +2 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/Index.ets +1 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/build-profile.json5 +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/ets/components/MainPage.ets +19 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/module.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/string.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/Index.ets +1 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/build-profile.json5 +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/consumer-rules.txt +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/oh-package.json5 +10 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/pages/Index.ets +20 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/utils/Calc.ets +3 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/module.json5 +12 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/string.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
- package/skills/a2h-arch-generate/scripts/resolve_android_stores.mjs +529 -0
- package/skills/a2h-arch-generate/scripts/scaffold_project.mjs +230 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1122 -0
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +191 -0
- package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
- package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +138 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +829 -0
- package/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +937 -0
- package/skills/a2h-arch-generate/scripts/validate_homegraph_artifacts.mjs +542 -0
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +415 -0
- package/skills/a2h-arkts-logic-coder/SKILL.md +125 -0
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +6 -0
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +124 -0
- package/skills/a2h-arkts-logic-coder/scripts/check_module_scope.ts +224 -0
- package/skills/a2h-arkts-logic-coder/scripts/check_mvvm.ts +377 -0
- package/skills/a2h-arkts-logic-coder/scripts/stop_check_hook.ts +443 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_check_scripts.ts +211 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_worktree_compat.ts +81 -0
- package/skills/a2h-batch-ui-align/SKILL.md +309 -0
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +81 -0
- package/skills/a2h-batch-ui-align/flowchart.html +271 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/conversion-procedure.md +523 -661
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +139 -0
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +8 -8
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +3 -0
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +32 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +211 -0
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +192 -0
- package/skills/a2h-batch-ui-align/references/step5-convert.md +202 -0
- package/skills/a2h-batch-ui-align/scripts/agent_cli.mjs +572 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/scripts/android_parse_fast.ts +246 -39
- package/skills/a2h-batch-ui-align/scripts/answers_check.mjs +86 -0
- package/skills/a2h-batch-ui-align/scripts/arkts_static_check.ts +2689 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1656 -0
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +258 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1524 -0
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +166 -0
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1437 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +1869 -0
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +696 -0
- package/skills/a2h-batch-ui-align/scripts/harmony_index.mjs +218 -0
- package/skills/a2h-batch-ui-align/scripts/host_env.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1229 -0
- package/skills/a2h-batch-ui-align/scripts/occlusion.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1124 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +996 -0
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +253 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +72 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +353 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +345 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +290 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +74 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +507 -0
- package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1451 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
- package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +170 -0
- package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +244 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +130 -0
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +57 -0
- package/skills/a2h-dashboard-render/SKILL.md +65 -0
- package/skills/a2h-dashboard-render/references/artifact-contract.jsonc +147 -0
- package/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
- package/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
- package/skills/a2h-dashboard-render/references//347/234/213/346/235/277/350/257/264/346/230/216.md +83 -0
- package/skills/a2h-dashboard-render/scripts/artifact_contract.mjs +138 -0
- package/skills/a2h-dashboard-render/scripts/check-registry.mjs +87 -0
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +3215 -0
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +2010 -0
- package/skills/a2h-dashboard-render/scripts/page_capture.mjs +828 -0
- package/skills/a2h-dashboard-render/scripts/usage_readers.mjs +459 -0
- package/skills/a2h-dashboard-render/scripts/usage_worker.mjs +13 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
- package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +170 -0
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +182 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +64 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1172 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +251 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +303 -0
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +444 -0
- package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/SKILL.md +305 -293
- package/skills/a2h-module-semantic-docs/SKILL.md +227 -0
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +168 -0
- package/skills/a2h-module-semantic-docs/scripts/lib/py_compat.mjs +688 -0
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +1021 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/skills/a2h-resource-convert/SKILL.md +369 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/code-vector-icon-rules.md +4 -4
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/conversion-rules.md +16 -5
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +251 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/lottie-conversion-rules.md +17 -17
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/resource-mapping-rules.md +15 -4
- package/skills/a2h-resource-convert/references/step3_5-dependency-filter.md +54 -0
- package/skills/a2h-resource-convert/references/step4-qualifiers-and-values.md +142 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +249 -0
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +154 -0
- package/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/xml-drawable-to-svg-rules.md +38 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/a2h_resource_convert.ts +456 -90
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +1072 -0
- package/skills/a2h-resource-convert/scripts/app_identity.ts +947 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/code_vector_icons.ts +19 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +989 -0
- package/skills/a2h-resource-convert/scripts/extract_project_resources.ts +1464 -0
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
- package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
- package/skills/a2h-spec-design/SKILL.md +336 -0
- package/skills/a2h-spec-design/scripts/inspect_spec_design_inputs.mjs +146 -0
- package/skills/a2h-spec-design/scripts/lib/py_compat.mjs +481 -0
- package/skills/a2h-spec-design/scripts/move_spec_technical_reference.mjs +159 -0
- package/skills/a2h-spec-design/scripts/resolve_module_design.mjs +102 -0
- package/skills/a2h-spec-design/scripts/validate_spec_design_output.mjs +285 -0
- package/skills/a2h-spec-design/test/golden/inspect_happy.json +20 -0
- package/skills/a2h-spec-design/test/golden/move_design.md +18 -0
- package/skills/a2h-spec-design/test/golden/move_design_crlf.md +18 -0
- package/skills/a2h-spec-design/test/golden/move_spec.md +7 -0
- package/skills/a2h-spec-design/test/golden/resolve_cases.json +36 -0
- package/skills/a2h-spec-design/test/golden/validate_issue_file.md +12 -0
- package/skills/a2h-spec-design/test/golden/validate_issues.json +57 -0
- package/skills/a2h-spec-design/test/test_spec_design_scripts.mjs +381 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +228 -0
- package/skills/a2h-spec-design-pipeline/package.json +4 -0
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +63 -0
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +69 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +24 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +57 -0
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +21 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +27 -0
- package/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +21 -0
- package/skills/a2h-spec-design-pipeline/scripts/atomic_write.ts +42 -0
- package/skills/a2h-spec-design-pipeline/scripts/audit_claims.ts +252 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +77 -0
- package/skills/a2h-spec-design-pipeline/scripts/deps_ready.ts +195 -0
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +651 -0
- package/skills/a2h-spec-design-pipeline/scripts/git_baseline.ts +124 -0
- package/skills/a2h-spec-design-pipeline/scripts/inflight.mjs +944 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/bgcli.mjs +95 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +502 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_waves.ts +475 -0
- package/skills/a2h-spec-design-pipeline/scripts/reconcile.mjs +218 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +164 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_atomic_write.ts +44 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_audit_claims.ts +301 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_bgcli.mjs +64 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_branch_landed.ts +87 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_deps_ready.ts +265 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +675 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_git_baseline.ts +105 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_inflight.mjs +452 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +375 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_waves.ts +561 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_reconcile.mjs +182 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +138 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_watchdog.mjs +289 -0
- package/skills/a2h-spec-design-pipeline/scripts/watchdog.mjs +441 -0
- package/skills/a2h-spec-generate/SKILL.md +285 -0
- package/skills/a2h-spec-generate/package.json +9 -0
- package/skills/a2h-spec-generate/references/batch-mode.md +151 -0
- package/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +114 -0
- package/skills/a2h-spec-generate/references/input-formats.md +27 -0
- package/skills/a2h-spec-generate/references/library-evidence.md +3 -0
- package/skills/a2h-spec-generate/references/method-discipline.md +64 -0
- package/skills/a2h-spec-generate/references/optional-gates.json +45 -0
- package/skills/a2h-spec-generate/references/recall-guide.md +83 -0
- package/skills/a2h-spec-generate/references/recall-terse.md +3 -0
- package/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
- package/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
- package/skills/a2h-spec-generate/references/review-checklist.md +21 -0
- package/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
- package/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
- package/skills/a2h-spec-generate/references/spec-samples.md +65 -0
- package/skills/a2h-spec-generate/references/specs.schema.json +79 -0
- package/skills/a2h-spec-generate/references/synthesis-rules.md +143 -0
- package/skills/a2h-spec-generate/references/transfer-file.md +5 -0
- package/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
- package/skills/a2h-spec-generate/references/worker-rules.md +126 -0
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +514 -0
- package/skills/a2h-spec-generate/scripts/check_spec.ts +361 -0
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +470 -0
- package/skills/a2h-spec-generate/scripts/detect-project.mjs +271 -0
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +188 -0
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +150 -0
- package/skills/a2h-spec-generate/scripts/inspect-uniapp.mjs +733 -0
- package/skills/{hmos-spec-generate → a2h-spec-generate}/scripts/parse_requirements.ts +1 -1
- package/skills/a2h-spec-generate/scripts/prepare-facts.mjs +307 -0
- package/skills/a2h-spec-generate/scripts/publication-verdict.mjs +171 -0
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +280 -0
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +399 -0
- package/skills/a2h-spec-generate/scripts/report.mjs +132 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/dashboard.html +149 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-api.js +49 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-code-view.js +140 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-format.js +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-handoff.js +42 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-splitters.js +78 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-state.js +47 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-tree.js +194 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-virtual-list.js +118 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.css +245 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.html +99 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.js +220 -0
- package/skills/a2h-spec-generate/scripts/reqgen/package-lock.json +47 -0
- package/skills/a2h-spec-generate/scripts/reqgen/package.json +23 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/agent-render/serve.ts +95 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/callback-call-sites.ts +82 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/area-ownership.ts +496 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/callback-flow.ts +386 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/index.ts +24 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/index.ts +22 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1270 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/index.ts +10 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/projection.ts +804 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/render-projection.ts +51 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/android-interaction-registry.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/builder.ts +453 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/compose-api-registry.ts +526 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/index.ts +15 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/connector/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/connector/utg-inbound.ts +763 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/area-graph.ts +383 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/artifact.ts +68 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/common.ts +88 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/diagnostic.ts +64 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/gap-audit.ts +113 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/index.ts +12 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/name-traceability.ts +108 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/raw-fact.ts +377 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/req-model.ts +238 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/run.ts +134 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/semantic-completeness.ts +35 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/source-facts.ts +48 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/utg.ts +133 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/core/output-guard.ts +42 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/core/stable-id.ts +118 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/cross-area-tally-cli.ts +179 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dashboard-cli.ts +188 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump/dump.ts +1184 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump-cli.ts +373 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1014 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-output.ts +32 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +142 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +312 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +310 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +685 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/graph/paths.ts +575 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/homegraph-cli.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/android-resource-resolver.ts +391 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/androidx-preference-contracts.ts +44 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +640 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/cross-area.ts +207 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/finalizer.ts +1297 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/identity.ts +186 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/index.ts +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/planner.ts +312 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/preference-enrichment.ts +793 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/raw-facts.ts +355 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/rules.ts +271 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/scanner.ts +666 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/schema.ts +365 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/stable-key.ts +144 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +301 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/uniapp-utg-adapter.ts +543 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/xml-adapter.ts +262 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/assemble.ts +2079 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +157 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +809 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/index.ts +17 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/io.ts +165 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +806 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/query.ts +360 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/seeds.ts +218 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/spec-bindings-sidecar.ts +240 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +359 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model-cli.ts +500 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/pipeline/index.ts +7 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/pipeline/output.ts +307 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +172 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-cov/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-cov/source-cov.ts +176 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/area-graph.ts +490 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/index.ts +23 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-model.ts +957 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +248 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/semantic-area-graph.ts +1600 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/types.ts +10 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/artifact-data.ts +201 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-api.ts +74 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-code-view.ts +180 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-format.ts +18 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-handoff.ts +55 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-splitters.ts +78 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-state.ts +66 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-tree.ts +232 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-virtual-list.ts +179 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz.ts +240 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/contracts.d.ts +86 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/index.ts +3 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/server.ts +239 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/source-project.ts +316 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz-cli.ts +200 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +290 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1323 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +574 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +831 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +548 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +396 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +298 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/skills/a2h-spec-generate/scripts/reqgen/tsconfig.json +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/tsconfig.viz-client.json +12 -0
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +632 -0
- package/skills/a2h-spec-generate/test/check-spec.test.ts +200 -0
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +538 -0
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +45 -0
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +147 -0
- package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
- package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
- package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +157 -0
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +282 -0
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +593 -0
- package/skills/a2h-utg-explorer/SKILL.md +120 -0
- package/skills/a2h-utg-explorer/assets/final_viewer.html +64 -0
- package/skills/a2h-utg-explorer/assets/u2.LICENSE +21 -0
- package/skills/a2h-utg-explorer/assets/u2.NOTICE +25 -0
- package/skills/a2h-utg-explorer/assets/u2.jar +0 -0
- package/skills/a2h-utg-explorer/references/architecture.md +270 -0
- package/skills/a2h-utg-explorer/references/protocol.md +9 -0
- package/skills/a2h-utg-explorer/scripts/app_settings.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +749 -0
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +597 -0
- package/skills/a2h-utg-explorer/scripts/device_health.mjs +227 -0
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +276 -0
- package/skills/a2h-utg-explorer/scripts/evidence.mjs +108 -0
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +258 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +170 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +467 -0
- package/skills/a2h-utg-explorer/scripts/recover_b.mjs +542 -0
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +302 -0
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +203 -0
- package/skills/a2h-utg-explorer/scripts/report.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +831 -0
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +137 -0
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +223 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +88 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
- package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +136 -0
- package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
- package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +251 -0
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +42 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +162 -0
- package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
- package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +204 -0
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +355 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
- package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +453 -0
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +131 -0
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +321 -0
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
- package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
- package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/_device_io.mjs +244 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/_py.mjs +2097 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +1213 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/attest.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/chain.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/coverage.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/device_lock.mjs +46 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1136 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +1513 -0
- package/skills/a2h-utg-explorer/scripts/variant.mjs +75 -0
- package/skills/a2h-utg-explorer/scripts/worklist_parts.mjs +122 -0
- package/skills/a2h-utg-static/SKILL.md +361 -0
- package/skills/a2h-utg-static/config.json +19 -0
- package/skills/a2h-utg-static/references/extractors.md +217 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
- package/skills/a2h-utg-static/references/view-interactions.md +215 -0
- package/skills/a2h-utg-static/scripts/_graph.mjs +361 -0
- package/skills/a2h-utg-static/scripts/_py.mjs +2177 -0
- package/skills/a2h-utg-static/scripts/_spawn.mjs +45 -0
- package/skills/a2h-utg-static/scripts/activity_nav.mjs +738 -0
- package/skills/a2h-utg-static/scripts/activity_widgets.mjs +254 -0
- package/skills/a2h-utg-static/scripts/adapter_nav.mjs +229 -0
- package/skills/a2h-utg-static/scripts/androidfragment_nav.mjs +208 -0
- package/skills/a2h-utg-static/scripts/assemble.mjs +2065 -0
- package/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/skills/a2h-utg-static/scripts/carry_answers.mjs +201 -0
- package/skills/a2h-utg-static/scripts/click_paths.mjs +594 -0
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +172 -0
- package/skills/a2h-utg-static/scripts/compose_merge.mjs +263 -0
- package/skills/a2h-utg-static/scripts/compose_nav.mjs +1216 -0
- package/skills/a2h-utg-static/scripts/compose_navbar_nav.mjs +238 -0
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +2760 -0
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +365 -0
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
- package/skills/a2h-utg-static/scripts/dialog_listener_nav.mjs +237 -0
- package/skills/a2h-utg-static/scripts/dialogshow_nav.mjs +308 -0
- package/skills/a2h-utg-static/scripts/fragfactory_nav.mjs +170 -0
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +1136 -0
- package/skills/a2h-utg-static/scripts/guard_subjects.mjs +162 -0
- package/skills/a2h-utg-static/scripts/hg_query.mjs +137 -0
- package/skills/a2h-utg-static/scripts/host_resolve.mjs +393 -0
- package/skills/a2h-utg-static/scripts/hybrid_bundle.mjs +165 -0
- package/skills/a2h-utg-static/scripts/hybrid_pages.mjs +713 -0
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -0
- package/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/skills/a2h-utg-static/scripts/io_utils.mjs +59 -0
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +864 -0
- package/skills/a2h-utg-static/scripts/launch_extras.mjs +91 -0
- package/skills/a2h-utg-static/scripts/layout_resolve.mjs +148 -0
- package/skills/a2h-utg-static/scripts/manifest.mjs +483 -0
- package/skills/a2h-utg-static/scripts/measure/measure_corpus.mjs +297 -0
- package/skills/a2h-utg-static/scripts/measure/measure_guards.mjs +98 -0
- package/skills/a2h-utg-static/scripts/media_browse_nav.mjs +356 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +603 -0
- package/skills/a2h-utg-static/scripts/navactions_nav.mjs +255 -0
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +453 -0
- package/skills/a2h-utg-static/scripts/orphan_overlay_nav.mjs +89 -0
- package/skills/a2h-utg-static/scripts/phase_plan.mjs +108 -0
- package/skills/a2h-utg-static/scripts/phase_planner.mjs +119 -0
- package/skills/a2h-utg-static/scripts/plaindialog_nav.mjs +411 -0
- package/skills/a2h-utg-static/scripts/preference_nav.mjs +761 -0
- package/skills/a2h-utg-static/scripts/preference_widgets.mjs +142 -0
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
- package/skills/a2h-utg-static/scripts/registry_nav.mjs +288 -0
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +870 -0
- package/skills/a2h-utg-static/scripts/scope_utils.mjs +430 -0
- package/skills/a2h-utg-static/scripts/screen_merge.mjs +287 -0
- package/skills/a2h-utg-static/scripts/screen_nav.mjs +279 -0
- package/skills/a2h-utg-static/scripts/single_host_nav.mjs +291 -0
- package/skills/a2h-utg-static/scripts/starter_nav.mjs +198 -0
- package/skills/a2h-utg-static/scripts/state_guard.mjs +579 -0
- package/skills/a2h-utg-static/scripts/static_prior.mjs +904 -0
- package/skills/a2h-utg-static/scripts/tests/_zipw.mjs +28 -0
- package/skills/a2h-utg-static/scripts/tests/probe_autoload.mjs +108 -0
- package/skills/a2h-utg-static/scripts/tests/probe_layout_fragments.mjs +90 -0
- package/skills/a2h-utg-static/scripts/tests/probe_unknown_scope.mjs +61 -0
- package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
- package/skills/a2h-utg-static/scripts/tests/test_activity_alias_launcher.mjs +90 -0
- package/skills/a2h-utg-static/scripts/tests/test_activity_supertype_chain.mjs +106 -0
- package/skills/a2h-utg-static/scripts/tests/test_bottom_sheet_container.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_branch_guard.mjs +19 -0
- package/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +103 -0
- package/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
- package/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
- package/skills/a2h-utg-static/scripts/tests/test_commit_scope.mjs +113 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_file_private_route.mjs +117 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_nested_graph.mjs +166 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_route_holder_collision.mjs +112 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +267 -0
- package/skills/a2h-utg-static/scripts/tests/test_custom_source_root.mjs +71 -0
- package/skills/a2h-utg-static/scripts/tests/test_defensive_null_guard.mjs +77 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialog_orphan_entries.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialog_page_owner.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_builder_forms.mjs +96 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_java_factory.mjs +37 -0
- package/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
- package/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
- package/skills/a2h-utg-static/scripts/tests/test_edge_dedupe_by_gesture.mjs +111 -0
- package/skills/a2h-utg-static/scripts/tests/test_edge_provenance_lint.mjs +70 -0
- package/skills/a2h-utg-static/scripts/tests/test_enclosing_gesture.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_external_surface_roots.mjs +43 -0
- package/skills/a2h-utg-static/scripts/tests/test_find_package_indirect.mjs +67 -0
- package/skills/a2h-utg-static/scripts/tests/test_forwarding_wrapper.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_fragment_containment.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_fragment_helper_trigger.mjs +92 -0
- package/skills/a2h-utg-static/scripts/tests/test_graph.mjs +55 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_clause.mjs +86 -0
- package/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +119 -0
- package/skills/a2h-utg-static/scripts/tests/test_host_kind_by_chain.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
- package/skills/a2h-utg-static/scripts/tests/test_interaction_sites.mjs +272 -0
- package/skills/a2h-utg-static/scripts/tests/test_item_data_instance.mjs +51 -0
- package/skills/a2h-utg-static/scripts/tests/test_kotlin_fn_spans.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
- package/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
- package/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
- package/skills/a2h-utg-static/scripts/tests/test_layout_declared_fragment.mjs +103 -0
- package/skills/a2h-utg-static/scripts/tests/test_listener_call_forms.mjs +79 -0
- package/skills/a2h-utg-static/scripts/tests/test_listener_receiver_binding.mjs +47 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_exported_default.mjs +40 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_filters_modules.mjs +84 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_srcfile.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_namespace.mjs +33 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +44 -0
- package/skills/a2h-utg-static/scripts/tests/test_multiple_entry_contracts.mjs +80 -0
- package/skills/a2h-utg-static/scripts/tests/test_nav_graph_xml.mjs +35 -0
- package/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_node_id_collision.mjs +57 -0
- package/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
- package/skills/a2h-utg-static/scripts/tests/test_out_of_scope_and_settings.mjs +72 -0
- package/skills/a2h-utg-static/scripts/tests/test_overload_and_climb.mjs +86 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_page_source.mjs +78 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_position_zero.mjs +65 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_variant_guard.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +107 -0
- package/skills/a2h-utg-static/scripts/tests/test_plain_dialog_nodes.mjs +167 -0
- package/skills/a2h-utg-static/scripts/tests/test_plaindialog_shared_anchor.mjs +117 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_click_nav.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_host_binding.mjs +87 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_nesting.mjs +183 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
- package/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
- package/skills/a2h-utg-static/scripts/tests/test_resolver_tier_parity.mjs +126 -0
- package/skills/a2h-utg-static/scripts/tests/test_result_launcher.mjs +142 -0
- package/skills/a2h-utg-static/scripts/tests/test_review_fixes.mjs +135 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +66 -0
- package/skills/a2h-utg-static/scripts/tests/test_same_name_decl_scope.mjs +236 -0
- package/skills/a2h-utg-static/scripts/tests/test_scope_utils.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_overlay_split.mjs +63 -0
- package/skills/a2h-utg-static/scripts/tests/test_slug_parity.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_starter_node_id.mjs +41 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_arity.mjs +109 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_commented_candidates.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_model_gates.mjs +127 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
- package/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
- package/skills/a2h-utg-static/scripts/tests/test_template_method_layout.mjs +81 -0
- package/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_trigger_id_spelling.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_action_override.mjs +91 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_nl_hint_key.mjs +89 -0
- package/skills/a2h-utg-static/scripts/tests/test_uiless_host_fold.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_click_refs.mjs +104 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_id_label.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_interactions.mjs +346 -0
- package/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +273 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_widget_class_scope.mjs +92 -0
- package/skills/a2h-utg-static/scripts/tests/test_window_nav_kotlin.mjs +158 -0
- package/skills/a2h-utg-static/scripts/tests/test_worklist_parts.mjs +65 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1119 -0
- package/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +721 -0
- package/skills/a2h-utg-static/scripts/view_interactions.mjs +799 -0
- package/skills/a2h-utg-static/scripts/view_widgets.mjs +512 -0
- package/skills/a2h-utg-static/scripts/viewpage_nav.mjs +485 -0
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +422 -0
- package/skills/a2h-utg-static/scripts/window_nav.mjs +240 -0
- package/skills/a2h-utg-static/scripts/worklist_parts.mjs +154 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
- package/skills/a2h-utg-static/tools/package.json +3 -0
- package/README.md +0 -427
- package/agents/logic-coder.md +0 -224
- package/agents/logic-context-builder.md +0 -212
- package/agents/scripts/hmos-precheck/backends/arkts.mjs +0 -567
- package/agents/scripts/hmos-precheck/backends/arkts_diff.mjs +0 -159
- package/agents/scripts/hmos-precheck/backends/arkts_project_rules.mjs +0 -398
- package/agents/scripts/hmos-precheck/backends/codelinter.mjs +0 -250
- package/agents/scripts/hmos-precheck/backends/project_integrity.mjs +0 -321
- package/agents/scripts/hmos-precheck/backends/static_precheck.mjs +0 -247
- package/agents/scripts/hmos-precheck/core/config.mjs +0 -184
- package/agents/scripts/hmos-precheck/core/diagnostic_scope.mjs +0 -20
- package/agents/scripts/hmos-precheck/core/process_adapter.mjs +0 -47
- package/agents/scripts/hmos-precheck/core/project_catalog.mjs +0 -50
- package/agents/scripts/hmos-precheck/core/result_projection.mjs +0 -147
- package/agents/scripts/hmos-precheck/core/scope_plan.mjs +0 -131
- package/agents/scripts/hmos-precheck/core/sdk_context.mjs +0 -67
- package/agents/scripts/hmos-precheck/docs/architecture.md +0 -37
- package/agents/scripts/hmos-precheck/docs/performance-optimization.md +0 -28
- package/agents/scripts/hmos-precheck/docs/upstream-reference.json +0 -19
- package/agents/scripts/hmos-precheck/docs/validation.md +0 -50
- package/agents/scripts/hmos-precheck/index.mjs +0 -17
- package/agents/scripts/hmos-precheck/invocation.mjs +0 -231
- package/agents/scripts/hmos-precheck/rules/rule_case_matrix.csv +0 -32
- package/agents/scripts/hmos-precheck/rules/rule_inventory.csv +0 -64
- package/agents/scripts/hmos-precheck/rules/rule_inventory.mjs +0 -59
- package/agents/scripts/hmos-precheck/rules/rule_policy.mjs +0 -54
- package/agents/scripts/platform_query.mjs +0 -626
- package/agents/scripts/platform_query.test.mjs +0 -422
- package/agents/self-test-fixer.md +0 -298
- package/agents/self-tester.md +0 -376
- package/agents/test-case-generation-generator.md +0 -317
- package/agents/test-case-generation-validator.md +0 -231
- package/dist/cli/config-store.js +0 -390
- package/dist/cli/config.js +0 -46
- package/dist/cli/env-vars.js +0 -127
- package/dist/cli/index.js +0 -56
- package/dist/cli/init.js +0 -1194
- package/dist/cli/uninstall.js +0 -427
- package/dist/utils/regex.js +0 -8
- package/env-requirements.json +0 -178
- package/resource/choose_editor.png +0 -0
- package/resource/convert_pipeline_process.svg +0 -103
- package/resource/project_architecture.svg +0 -122
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/resource/set_sdk.png +0 -0
- package/resource/title_dark.png +0 -0
- package/skills/hmos-batch-ui-align/SKILL.md +0 -413
- package/skills/hmos-batch-ui-align/scripts/arkts_static_check.ts +0 -1592
- package/skills/hmos-batch-ui-align/scripts/measure_pack.ts +0 -752
- package/skills/hmos-convert-pipeline/SKILL.md +0 -476
- package/skills/hmos-incremental-ui-align/README.md +0 -251
- package/skills/hmos-incremental-ui-align/SKILL.md +0 -375
- package/skills/hmos-incremental-ui-align/diff_analysis.md +0 -53
- package/skills/hmos-incremental-ui-align/page_align.md +0 -62
- package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +0 -38
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +0 -648
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +0 -2089
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +0 -1033
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +0 -1183
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +0 -576
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +0 -297
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +0 -395
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/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 +0 -903
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +0 -106
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/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 +0 -1178
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +0 -911
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/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 +0 -355
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//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 +0 -11
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +0 -206
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -373
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -158
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -750
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -1704
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -1012
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -164
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -840
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -856
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@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 +0 -83
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/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 +0 -294
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/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 +0 -1220
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +0 -47
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2//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 +0 -840
- package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +0 -74
- package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +0 -34
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +0 -2533
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +0 -555
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -117
- package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +0 -937
- package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +0 -343
- package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +0 -76
- package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +0 -977
- package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +0 -188
- package/skills/hmos-integration-test/README.md +0 -300
- package/skills/hmos-integration-test/SKILL.md +0 -397
- package/skills/hmos-resources-convert/SKILL.md +0 -891
- package/skills/hmos-spec-generate/SKILL.md +0 -404
- package/skills/hmos-test-case-generation/README.md +0 -241
- package/skills/hmos-test-case-generation/SKILL.md +0 -324
- package/skills/hmos-test-case-generation/references/contract.md +0 -315
- package/skills/hmos-test-case-generation/references/review-notes-template.md +0 -84
- package/skills/hmos-test-case-generation/references/ui-elements-schema.md +0 -142
- package/skills/hmos-test-case-generation/tools/convert_to_ui_elements.ts +0 -550
- package/skills/hmos-test-case-generation/tools/validate.ts +0 -1312
- package/tools/bfs-crawl/README.md +0 -73
- package/tools/bfs-crawl/android_viewtree_bfs_crawler.ts +0 -1662
- package/tools/test-tools/autotest/config.ts +0 -175
- package/tools/test-tools/autotest/deps/autotest-agent-0.1.1.tgz +0 -0
- package/tools/test-tools/autotest/docs/README.md +0 -266
- package/tools/test-tools/autotest/docs/testcases_schema.md +0 -143
- package/tools/test-tools/autotest/engine/batch-launcher.ts +0 -327
- package/tools/test-tools/autotest/engine/report-tool.ts +0 -773
- package/tools/test-tools/autotest/engine/self-test-runner.ts +0 -961
- package/tools/test-tools/autotest/engine/testcases-tool.ts +0 -246
- package/tools/test-tools/autotest/paths.ts +0 -41
- package/tools/test-tools/autotest/resolve-metadata-tool.ts +0 -143
- package/tools/test-tools/autotest/runner/logger.ts +0 -45
- package/tools/test-tools/autotest/runner/process-utils.ts +0 -41
- package/tools/test-tools/autotest/validate.ts +0 -167
- /package/skills/{hmos-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" → a2h-arch-generate/references/arkts-mvvm-v2.md} +0 -0
- /package/{README.en.md → skills/a2h-arch-generate/scripts/module_create/har/consumer-rules.txt} +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2 → a2h-batch-ui-align/references/mvvm-v2}/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → 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" +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/arkts-strict-patterns.md +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/known-patterns.md +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/rdb-entity-pattern.md +0 -0
- /package/skills/{hmos-resources-convert → a2h-resource-convert}/references/dependency-analysis-rules.md +0 -0
- /package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/svg_fidelity_check.ts +0 -0
- /package/skills/{hmos-spec-generate → a2h-spec-generate}/template/REQ.txt +0 -0
- /package/skills/{hmos-spec-generate → a2h-spec-generate}/template/REQ.xlsx +0 -0
|
@@ -0,0 +1,1136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* semantics.mjs — port of semantics.py. Source-backed page identities. Incoming click labels
|
|
3
|
+
* are NOT landing evidence.
|
|
4
|
+
*
|
|
5
|
+
* Exports: ANDROID, normalized, buildCatalog, _selectorHits, learnedRuleMatches,
|
|
6
|
+
* occludedIndices, treePackage, resolvePage, _SCREEN_KINDS, _shareRowContainer,
|
|
7
|
+
* _hostCompatible, _toolbarTitleCandidates, _selectedTabCandidates,
|
|
8
|
+
* _ownWidgetCandidates, panelHost, observationMatchesStatic
|
|
9
|
+
*
|
|
10
|
+
* Python sets become JS Sets in insertion order. Where Python iterated a set of strings to
|
|
11
|
+
* build an ordered result (only `_toolbarTitleCandidates`, whose order Python leaves to the
|
|
12
|
+
* per-process string hash), the JS order is the node order of the capture.
|
|
13
|
+
*/
|
|
14
|
+
import {
|
|
15
|
+
get, truthy, pyStr, nfkc, pyStrip, pyRstrip, sortedStr, sortedBy, pyMax, pyRe, reEscape,
|
|
16
|
+
pathStr, pJoin, pResolve, pIsFile, pIsDir, pSuffix, pName, pParent, pParents, pStem, pGlob,
|
|
17
|
+
pOrder, pKey, pRelativeParts, pIsRelativeTo, etParse, XmlParseError, readText, dset, reFindall,
|
|
18
|
+
} from './_py.mjs';
|
|
19
|
+
|
|
20
|
+
export const ANDROID = '{http://schemas.android.com/apk/res/android}';
|
|
21
|
+
|
|
22
|
+
const WS_RUN = pyRe('\\s+', 'g');
|
|
23
|
+
const S = (v) => pyStr(v);
|
|
24
|
+
const g = (o, k, d = null) => get(o, k, d);
|
|
25
|
+
const vis = (n) => truthy(g(n, 'visible', true));
|
|
26
|
+
const tail = (rid) => S(rid).split('/').pop();
|
|
27
|
+
const endsWithAny = (s, xs) => xs.some((x) => s.endsWith(x));
|
|
28
|
+
const setOf = (it) => new Set(it);
|
|
29
|
+
const inter = (a, b) => new Set([...a].filter((x) => b.has(x)));
|
|
30
|
+
const inRange = (i, nodes) => i !== null && i !== undefined && i >= 0 && i < nodes.length;
|
|
31
|
+
const parentOf = (n) => { const p = g(n, 'parent_index'); return p === undefined ? null : p; };
|
|
32
|
+
|
|
33
|
+
/** normalized(text): NFKC, whitespace runs -> ' ', strip, then rstrip('.…'). */
|
|
34
|
+
export function normalized(text) {
|
|
35
|
+
const s = S(truthy(text) ? text : '');
|
|
36
|
+
return pyRstrip(pyStrip(nfkc(s).replace(WS_RUN, ' ')), '.…');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const isBuildPath = (p, project) => (pRelativeParts(p, project) ?? []).includes('build');
|
|
40
|
+
|
|
41
|
+
/** build_catalog(graph, project=None, locale='en'). */
|
|
42
|
+
const _STRING_ROW = /<string\s+name="([^"]+)"[^>]*>([\s\S]*?)<\/string>/g;
|
|
43
|
+
|
|
44
|
+
/** Map(main-source-set value -> [values the same key takes in another source set]), e.g. a debug
|
|
45
|
+
* build type's `app_name`. Only the default-language `values` dirs: locales are buildCatalog's job. */
|
|
46
|
+
export function _variantOverrides(project) {
|
|
47
|
+
const main = new Map(); const other = new Map();
|
|
48
|
+
for (const file of pGlob(project, '**/src/*/res/values/*.xml')) {
|
|
49
|
+
if (pRelativeParts(file, project).includes('build')) { continue; }
|
|
50
|
+
const set = pName(pParent(pParent(pParent(file))));
|
|
51
|
+
let text;
|
|
52
|
+
try { text = readText(file); } catch { continue; }
|
|
53
|
+
for (const m of text.matchAll(_STRING_ROW)) {
|
|
54
|
+
const v = m[2].replaceAll("\\'", "'").trim();
|
|
55
|
+
if (!v) { continue; }
|
|
56
|
+
const tbl = set === 'main' ? main : other;
|
|
57
|
+
if (!tbl.has(m[1])) { tbl.set(m[1], new Set()); }
|
|
58
|
+
tbl.get(m[1]).add(v);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const out = new Map();
|
|
62
|
+
for (const [k, alts] of other) {
|
|
63
|
+
for (const mv of main.get(k) ?? []) {
|
|
64
|
+
for (const a of alts) {
|
|
65
|
+
if (a === mv) { continue; }
|
|
66
|
+
if (!out.has(mv)) { out.set(mv, []); }
|
|
67
|
+
if (!out.get(mv).includes(a)) { out.get(mv).push(a); }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function buildCatalog(graph, project = null, locale = 'en') {
|
|
75
|
+
const nodes = g(graph, 'nodes', []);
|
|
76
|
+
project = truthy(project) ? pResolve(project) : null;
|
|
77
|
+
const stringCache = new Map(); const xmlCache = new Map();
|
|
78
|
+
|
|
79
|
+
const resources = (res) => {
|
|
80
|
+
// Project-wide string lookup (the XML's own `res` first so a local override wins).
|
|
81
|
+
const key = project ? 'project' : pKey(res);
|
|
82
|
+
if (stringCache.has(key)) { return stringCache.get(key); }
|
|
83
|
+
const strings = {};
|
|
84
|
+
const lang = locale.replace(/_/g, '-').split('-')[0];
|
|
85
|
+
const variants = ['values', 'values-' + lang, 'values-' + locale.replace(/-/g, '-r')];
|
|
86
|
+
if (lang === 'zh') { variants.push(!locale.includes('TW') ? 'values-zh-rCN' : 'values-zh-rTW'); }
|
|
87
|
+
let resDirs = [res];
|
|
88
|
+
if (project) {
|
|
89
|
+
resDirs = resDirs.concat(sortedBy(pGlob(project, '**/src/main/res'), pOrder)
|
|
90
|
+
.filter((d) => !isBuildPath(d, project) && pKey(d) !== pKey(res)));
|
|
91
|
+
}
|
|
92
|
+
for (const variant of [...new Set(variants)]) {
|
|
93
|
+
for (const rd of [...resDirs].reverse()) {
|
|
94
|
+
for (const file of sortedBy(pGlob(pJoin(rd, variant), '*.xml'), pOrder)) {
|
|
95
|
+
let root;
|
|
96
|
+
try { root = etParse(file); } catch (e) { if (e instanceof XmlParseError) { continue; } throw e; }
|
|
97
|
+
for (const el of root) {
|
|
98
|
+
// a nameless <string> lands under None in Python: unreachable by any str key
|
|
99
|
+
if (el.tag === 'string' && el.get('name') !== null) { dset(strings, el.get('name'), [...el.itertext()].join('').replaceAll("\\'", "'")); }
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
stringCache.set(key, strings);
|
|
105
|
+
return strings;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const resolve = (value, res) => {
|
|
109
|
+
if (!truthy(value)) { return ''; }
|
|
110
|
+
if (value.startsWith('@string/')) { return g(resources(res), value.split('/').slice(1).join('/'), ''); }
|
|
111
|
+
return !value.startsWith('@') ? value : '';
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const parse = (p) => {
|
|
115
|
+
const k = pKey(p);
|
|
116
|
+
if (!xmlCache.has(k)) {
|
|
117
|
+
try { xmlCache.set(k, etParse(p)); } catch (e) {
|
|
118
|
+
if (e instanceof XmlParseError || (e && e.code)) { xmlCache.set(k, null); } else { throw e; }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return xmlCache.get(k);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const rows = (el, res) => {
|
|
125
|
+
const result = [];
|
|
126
|
+
for (const child of el) {
|
|
127
|
+
if (child.tag.endsWith('PreferenceCategory')) { result.push(...rows(child, res)); }
|
|
128
|
+
else {
|
|
129
|
+
const title = resolve(child.get(ANDROID + 'title'), res);
|
|
130
|
+
if (title) { result.push(title); }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return sortedStr(new Set(result));
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const catalog = {};
|
|
137
|
+
for (const n of nodes) {
|
|
138
|
+
const ident = n.id;
|
|
139
|
+
const expected = g(n, 'expected') || {};
|
|
140
|
+
let titles = truthy(g(expected, 'title_any')) ? g(expected, 'title_any') : [];
|
|
141
|
+
if (typeof titles === 'string') { titles = [titles]; }
|
|
142
|
+
let component = truthy(g(expected, 'component')) ? g(expected, 'component') : g(expected, 'activity');
|
|
143
|
+
if (!truthy(component) && ['activity', 'host-activity'].includes(g(n, 'kind'))) { component = g(n, 'fqn'); }
|
|
144
|
+
const item = { id: ident, kind: g(n, 'kind'), label: g(n, 'label', ident), titles: [...titles], row_titles: [],
|
|
145
|
+
component: truthy(g(expected, 'component')) ? g(expected, 'component') : g(expected, 'activity'),
|
|
146
|
+
basis: [], entry_labels: [] };
|
|
147
|
+
item.component = component;
|
|
148
|
+
const links = g(graph, 'links', g(graph, 'edges', []));
|
|
149
|
+
item.hosts_static_pages = links.some((e) => g(e, 'source') === ident && g(e, 'target') !== ident
|
|
150
|
+
&& !S(g(e, 'target', '')).startsWith('activity:'));
|
|
151
|
+
// Static openers: the pages with an edge into this one (used to tell layout twins apart).
|
|
152
|
+
item.opened_from = sortedStr(new Set(links.filter((e) => g(e, 'target') === ident && truthy(g(e, 'source'))
|
|
153
|
+
&& g(e, 'source') !== ident).map((e) => S(g(e, 'source')))));
|
|
154
|
+
item.default_children = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident && g(e, 'target') !== ident
|
|
155
|
+
&& !S(g(e, 'target', '')).startsWith('activity:')
|
|
156
|
+
&& (g(g(e, 'args') || {}, 'action') === 'default' || g(e, 'mechanism') === 'fragment-embed')
|
|
157
|
+
&& !truthy(g(e, 'guard') || {})).map((e) => g(e, 'target'))));
|
|
158
|
+
if (g(n, 'kind') === 'dialog' && truthy(g(n, 'label')) && !/^[A-Za-z][A-Za-z0-9_]*$/.test(n.label)) {
|
|
159
|
+
item.titles.push(n.label);
|
|
160
|
+
}
|
|
161
|
+
const location = S(g(n, 'declared_at', '')).replace(/:\d+$/, '');
|
|
162
|
+
const file = project && location ? pResolve(pJoin(project, location)) : null;
|
|
163
|
+
if (file && pIsRelativeTo(file, project) && pIsFile(file)) {
|
|
164
|
+
if (pSuffix(file) === '.xml' && pName(pParent(file)) === 'xml') {
|
|
165
|
+
const root = parse(file);
|
|
166
|
+
const res = pParent(pParent(file));
|
|
167
|
+
const key = ident.split('/').pop().split(':').pop();
|
|
168
|
+
const candidates = root === null ? [] : [...root.iter()].filter((e) => e.get(ANDROID + 'key') === key);
|
|
169
|
+
if (!candidates.length) {
|
|
170
|
+
const comments = reFindall(pyRe('<!--(.*?)-->', 's'), readText(file));
|
|
171
|
+
const kre = pyRe('android:key\\s*=\\s*["\']' + reEscape(key) + '["\']');
|
|
172
|
+
if (comments.some((c) => kre.test(c))) {
|
|
173
|
+
item.source_gap = 'preference-defined-only-in-XML-comment';
|
|
174
|
+
item.basis.push(pathStr(file) + '#' + key);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (candidates.length === 1) {
|
|
178
|
+
const element = candidates[0];
|
|
179
|
+
const entry = resolve(element.get(ANDROID + 'title'), res);
|
|
180
|
+
const title = resolve(element.get(ANDROID + 'dialogTitle'), res) || entry;
|
|
181
|
+
item.entry_labels = entry ? [entry] : [];
|
|
182
|
+
item.titles = title ? [title] : item.titles;
|
|
183
|
+
item.basis.push(pathStr(file) + '#' + key);
|
|
184
|
+
item.preference_type = element.tag.split('.').pop();
|
|
185
|
+
if (element.tag.endsWith('PreferenceScreen')) {
|
|
186
|
+
item.row_titles = rows(element, res);
|
|
187
|
+
item.row_source = 'preference-xml';
|
|
188
|
+
}
|
|
189
|
+
if (!title) { dynamicTitle(item, key, res, project, resources); }
|
|
190
|
+
}
|
|
191
|
+
} else if (['.java', '.kt'].includes(pSuffix(file)) && ident.split(':').pop() === pStem(file)) {
|
|
192
|
+
const text = readText(file);
|
|
193
|
+
const refs = new Set(reFindall(pyRe('(?:add|set)PreferencesFromResource\\(\\s*R\\.xml\\.(\\w+)'), text));
|
|
194
|
+
if (refs.size === 1) {
|
|
195
|
+
const name = [...refs][0] + '.xml';
|
|
196
|
+
const roots = pParents(file).map((p) => pJoin(p, 'res')).filter((p) => pIsDir(p)).slice(0, 1);
|
|
197
|
+
let found = roots.filter((r) => pIsFile(pJoin(r, 'xml', name)));
|
|
198
|
+
if (!found.length) {
|
|
199
|
+
found = pGlob(project, '**/src/main/res/xml/' + name).filter((x) => !isBuildPath(x, project))
|
|
200
|
+
.map((x) => pParent(pParent(x)));
|
|
201
|
+
}
|
|
202
|
+
if (found.length === 1) {
|
|
203
|
+
const resource = found[0];
|
|
204
|
+
const xml = pJoin(resource, 'xml', name);
|
|
205
|
+
const element = parse(xml);
|
|
206
|
+
if (element !== null) {
|
|
207
|
+
item.row_titles = rows(element, resource);
|
|
208
|
+
item.row_source = 'preference-xml';
|
|
209
|
+
item.basis.push(pathStr(xml) + '#root');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (g(n, 'kind') === 'activity' && !truthy(item.component) && ident.startsWith('activity:')) {
|
|
215
|
+
for (const manifest of pGlob(project, '**/src/main/AndroidManifest.xml')) {
|
|
216
|
+
const root = parse(manifest);
|
|
217
|
+
if (root === null) { continue; }
|
|
218
|
+
for (const el of root.iter('activity')) {
|
|
219
|
+
const name = el.get(ANDROID + 'name', '');
|
|
220
|
+
if (name.split('.').pop() === ident.split(':').pop()) {
|
|
221
|
+
const pkg = root.get('package', '');
|
|
222
|
+
item.component = name.startsWith('.') ? pkg + name : (!name.includes('.') ? pkg + '.' + name : name);
|
|
223
|
+
item.basis.push(pathStr(manifest));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (g(n, 'kind') === 'menu') {
|
|
230
|
+
item.row_titles = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident
|
|
231
|
+
&& truthy(g(g(e, 'args') || {}, 'label')) && g(g(e, 'args') || {}, 'label_key') !== 'widget:')
|
|
232
|
+
.map((e) => S(g(g(e, 'args') || {}, 'label')))));
|
|
233
|
+
if (project) {
|
|
234
|
+
const resName = ident.slice(ident.indexOf(':') + 1).split('@')[0];
|
|
235
|
+
const files = pGlob(project, '**/src/main/res/menu/' + resName + '.xml').filter((x) => !isBuildPath(x, project));
|
|
236
|
+
if (files.length === 1) {
|
|
237
|
+
const root = parse(files[0]);
|
|
238
|
+
const resdir = pParent(pParent(files[0]));
|
|
239
|
+
if (root !== null) {
|
|
240
|
+
const extra = new Set();
|
|
241
|
+
for (const el of root.iter('item')) {
|
|
242
|
+
const show = el.get('{http://schemas.android.com/apk/res-auto}showAsAction', '') || el.get(ANDROID + 'showAsAction', '');
|
|
243
|
+
if (show.includes('always') || show.includes('ifRoom')) { continue; }
|
|
244
|
+
const t = resolve(el.get(ANDROID + 'title'), resdir);
|
|
245
|
+
if (t) { extra.add(t); }
|
|
246
|
+
}
|
|
247
|
+
item.row_titles = sortedStr(new Set([...item.row_titles, ...extra]));
|
|
248
|
+
item.basis.push(pathStr(files[0]));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
item.titles = item.titles.filter((t) => !t.endsWith('(overflow)'));
|
|
253
|
+
}
|
|
254
|
+
item.titles = sortedStr(new Set(item.titles.filter((t) => truthy(t))));
|
|
255
|
+
const hints = truthy(g(expected, 'hint_any')) ? g(expected, 'hint_any') : [];
|
|
256
|
+
item.hint_titles = sortedStr(new Set(typeof hints === 'string' ? [hints] : hints));
|
|
257
|
+
item.widget_ids = ident.includes('@') ? [] : sortedStr(new Set([
|
|
258
|
+
...(truthy(g(n, 'layout_ids', [])) ? g(n, 'layout_ids', []) : []).map(S),
|
|
259
|
+
...(truthy(g(n, 'widgets', [])) ? g(n, 'widgets', []) : [])
|
|
260
|
+
.filter((w) => w && typeof w === 'object' && !Array.isArray(w) && truthy(g(w, 'view_id'))).map((w) => S(w.view_id)),
|
|
261
|
+
]));
|
|
262
|
+
const wid = new Set(item.widget_ids);
|
|
263
|
+
item.hidden_ids = sortedStr(new Set((truthy(g(n, 'layout_hidden_ids')) ? n.layout_hidden_ids : []).filter((x) => wid.has(x))));
|
|
264
|
+
// Fixed texts the page's own source renders (a2h-utg-static compose_body_text); kept below
|
|
265
|
+
// only when no other page claims them.
|
|
266
|
+
const bodyText = ident.includes('@') ? [] : (truthy(g(n, 'body_text')) ? n.body_text : []);
|
|
267
|
+
const isPrefix = (t) => typeof t === 'object' && t !== null && truthy(g(t, 'prefix'));
|
|
268
|
+
item.body_titles = sortedStr(new Set(bodyText.filter((t) => !isPrefix(t))
|
|
269
|
+
.map((t) => normalized(typeof t === 'string' ? t : g(t, 'text', ''))).filter((t) => truthy(t))));
|
|
270
|
+
// Fixed leads of template strings (`"来自${x}"`): matched as the start of a rendered text.
|
|
271
|
+
item.body_prefixes = sortedStr(new Set(bodyText.filter(isPrefix).map((t) => normalized(g(t, 'text', ''))).filter((t) => truthy(t))));
|
|
272
|
+
// A folded host Activity (assemble._foldUilessHosts) still names the component that shows this page.
|
|
273
|
+
const host = g(n, 'host_activity');
|
|
274
|
+
if (!truthy(item.component) && truthy(g(host, 'fqn'))) { item.component = host.fqn; }
|
|
275
|
+
item.transient = truthy(g(n, 'transient'));
|
|
276
|
+
// An in-page state (a mode tab: calendar day/week/month/year) is told apart only by content
|
|
277
|
+
// its host shows in that state; `state_anchors` names it ({all: [selector], none: [selector]}).
|
|
278
|
+
if (STATE_KINDS.includes(item.kind)) {
|
|
279
|
+
item.host_node = truthy(g(n, 'host_node')) ? n.host_node : stateHost(ident);
|
|
280
|
+
const rule = _stateRule(g(n, 'state_anchors'), 'static');
|
|
281
|
+
if (rule) { item.state_rules = [rule]; }
|
|
282
|
+
}
|
|
283
|
+
item.auto_targets = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident && g(e, 'target') !== ident
|
|
284
|
+
&& (['lifecycle', 'startDestination'].includes(S(g(e, 'trigger', '')).split('@')[0])
|
|
285
|
+
|| g(g(e, 'args') || {}, 'action') === 'default')).map((e) => S(g(e, 'target')))));
|
|
286
|
+
dset(catalog, ident, item);
|
|
287
|
+
}
|
|
288
|
+
// A static title is the MAIN source set's string; the installed build may override that resource in a
|
|
289
|
+
// build-type / flavor source set (`src/debug/res/values/strings.xml` renaming `app_name` to "AppDebug").
|
|
290
|
+
// The overriding value is what the device renders, so it joins the titles: without it a page titled
|
|
291
|
+
// by such a string was never recognised on the debug build every campaign installs.
|
|
292
|
+
if (project) {
|
|
293
|
+
const variants = _variantOverrides(project);
|
|
294
|
+
if (variants.size) {
|
|
295
|
+
for (const item of Object.values(catalog)) {
|
|
296
|
+
for (const t of [...item.titles]) {
|
|
297
|
+
for (const alt of variants.get(t) ?? []) { if (!item.titles.includes(alt)) { item.titles.push(alt); } }
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// Shared titles: a title / hint title / own body text that 2+ screens render (twins built on one
|
|
303
|
+
// scaffold: every feature's "Bookmarks" page). Not an anchor by itself -- resolvePage offers the
|
|
304
|
+
// sharers as `shared-title-twin` candidates only when nothing unique matched, and
|
|
305
|
+
// resolveTwinByOpener settles them by the verified page shown before. Computed before the
|
|
306
|
+
// unique-claim filter below, which it leaves unchanged.
|
|
307
|
+
// A bar title is matched against shared TITLES only (a page's body button "Bookmarks" that opens the
|
|
308
|
+
// twin is not that page's title); a search placeholder also against shared body texts.
|
|
309
|
+
const sharersOf = (textsOf) => {
|
|
310
|
+
const m = new Map();
|
|
311
|
+
for (const [ident, item] of Object.entries(catalog)) {
|
|
312
|
+
if (!_SCREEN_KINDS.includes(item.kind)) { continue; }
|
|
313
|
+
for (const t of new Set(textsOf(item))) {
|
|
314
|
+
if (!truthy(t)) { continue; }
|
|
315
|
+
if (!m.has(t)) { m.set(t, new Set()); }
|
|
316
|
+
m.get(t).add(ident);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return (ident) => sortedStr([...m].filter(([, ids]) => ids.size >= 2 && ids.has(ident)).map(([t]) => t));
|
|
320
|
+
};
|
|
321
|
+
const titleShare = sharersOf((it) => [...it.titles, ...it.hint_titles].map(normalized));
|
|
322
|
+
const textShare = sharersOf((it) => [...it.titles, ...it.hint_titles].map(normalized).concat(it.body_titles));
|
|
323
|
+
for (const [ident, item] of Object.entries(catalog)) {
|
|
324
|
+
item.shared_titles = titleShare(ident);
|
|
325
|
+
item.shared_texts = textShare(ident);
|
|
326
|
+
}
|
|
327
|
+
// A body text is an anchor only for its single claimant, and never one that is some page's title.
|
|
328
|
+
const claims = new Map();
|
|
329
|
+
for (const item of Object.values(catalog)) {
|
|
330
|
+
for (const t of new Set([...item.body_titles, ...item.titles.map(normalized), ...item.row_titles.map(normalized)])) {
|
|
331
|
+
claims.set(t, (claims.get(t) ?? 0) + 1);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
for (const item of Object.values(catalog)) {
|
|
335
|
+
item.body_titles = item.body_titles.filter((t) => claims.get(t) === 1 && !item.titles.map(normalized).includes(t));
|
|
336
|
+
}
|
|
337
|
+
// A prefix is an anchor only when no text or prefix of another page starts with it.
|
|
338
|
+
const allTexts = Object.entries(catalog).map(([id, it]) => [id, [...it.body_titles, ...it.titles.map(normalized),
|
|
339
|
+
...it.row_titles.map(normalized), ...it.body_prefixes]]);
|
|
340
|
+
for (const [ident, item] of Object.entries(catalog)) {
|
|
341
|
+
item.body_prefixes = item.body_prefixes.filter((p) => !allTexts.some(([id, ts]) => id !== ident && ts.some((t) => t.startsWith(p) || p.startsWith(t))));
|
|
342
|
+
}
|
|
343
|
+
return catalog;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Fewest body anchors that identify a page: two, or one of at least this many characters. */
|
|
347
|
+
export const BODY_ANCHOR_MIN_CHARS = 4;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* _body_text_candidates(nodes, catalog, observation): pages whose own fixed source texts are on
|
|
351
|
+
* screen. The page with the most visible anchors wins; a tie is ambiguous.
|
|
352
|
+
*/
|
|
353
|
+
export function _bodyTextCandidates(nodes, catalog, observation) {
|
|
354
|
+
const shown = new Set();
|
|
355
|
+
for (const n of nodes) {
|
|
356
|
+
if (!vis(n)) { continue; }
|
|
357
|
+
for (const k of ['text', 'content_desc']) { if (truthy(g(n, k))) { shown.add(normalized(n[k])); } }
|
|
358
|
+
}
|
|
359
|
+
if (!shown.size) { return []; }
|
|
360
|
+
const scored = []; const weak = [];
|
|
361
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
362
|
+
const hits = (g(page, 'body_titles', []) || []).filter((t) => shown.has(t));
|
|
363
|
+
for (const p of (g(page, 'body_prefixes', []) || [])) { if ([...shown].some((t) => t.startsWith(p))) { hits.push(p + '…'); } }
|
|
364
|
+
if (!hits.length) { continue; }
|
|
365
|
+
if (!_hostCompatible(page, catalog, observation)) { continue; }
|
|
366
|
+
if (hits.length < 2 && !hits.some((t) => [...t.replace(/…$/, '')].length >= BODY_ANCHOR_MIN_CHARS)) {
|
|
367
|
+
weak.push({ static_id: ident, reason: 'weak-body-text', anchors: sortedStr(hits) });
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
scored.push([hits.length, ident, sortedStr(hits)]);
|
|
371
|
+
}
|
|
372
|
+
// Too weak alone: handed back unverified, for resolveTwinByOpener to settle by the opener.
|
|
373
|
+
if (!scored.length) { return weak.length ? [{ weak }] : []; }
|
|
374
|
+
scored.sort((a, b) => b[0] - a[0] || (a[1] < b[1] ? -1 : 1));
|
|
375
|
+
const top = scored.filter((x) => x[0] === scored[0][0]);
|
|
376
|
+
return top.map(([, ident, hits]) => ({ static_id: ident, reason: 'source-body-text', anchors: hits }));
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** The "dynamic Preference title from localized R.string constants" block of build_catalog. */
|
|
380
|
+
function dynamicTitle(item, key, res, project, resources) {
|
|
381
|
+
// Offsets are UTF-16 here (Python: code points); they differ only for astral chars in Java source.
|
|
382
|
+
for (const java of pGlob(project, '**/src/main/java/**/*.java')) {
|
|
383
|
+
const code = readText(java);
|
|
384
|
+
const binding = pyRe('\\b(\\w+)\\s*=\\s*[^;]*findPreference\\("' + reEscape(key) + '"\\)\\s*;').exec(code);
|
|
385
|
+
if (!binding) { continue; }
|
|
386
|
+
const variable = binding[1];
|
|
387
|
+
const bEnd = binding.index + binding[0].length;
|
|
388
|
+
let tl = code.slice(bEnd, bEnd + 2600);
|
|
389
|
+
const rebound = pyRe('\\b' + reEscape(variable) + '\\s*=').exec(tl);
|
|
390
|
+
if (rebound) { tl = tl.slice(0, rebound.index); }
|
|
391
|
+
const setter = pyRe('\\b' + reEscape(variable) + '\\.setTitle\\((\\w+)\\)').exec(tl);
|
|
392
|
+
if (!setter) { continue; }
|
|
393
|
+
const assignment = pyRe('\\b' + reEscape(setter[1]) + '\\s*=([^;]+);').exec(tl.slice(0, setter.index));
|
|
394
|
+
if (!assignment) { continue; }
|
|
395
|
+
const refs = reFindall(pyRe('R\\.string\\.(\\w+)'), assignment[1]);
|
|
396
|
+
if (refs.length && (new Set(refs).size === 1 || refs.filter((r) => r === refs[0]).length > 1)) {
|
|
397
|
+
const dynamic = g(resources(res), refs[0]);
|
|
398
|
+
if (truthy(dynamic)) {
|
|
399
|
+
item.titles = [dynamic]; item.entry_labels = [dynamic];
|
|
400
|
+
item.basis.push(pathStr(java) + '#' + variable + '.setTitle');
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** _selector_hits(nodes, sel): visible nodes matching a learned-rule selector. */
|
|
407
|
+
export function _selectorHits(nodes, sel) {
|
|
408
|
+
const out = [];
|
|
409
|
+
for (const n of nodes) {
|
|
410
|
+
if (!vis(n)) { continue; }
|
|
411
|
+
let ok = true;
|
|
412
|
+
for (const [k, v] of Object.entries(sel)) {
|
|
413
|
+
if (k === 'resource_name') { ok = tail(truthy(g(n, 'resource_id')) ? g(n, 'resource_id') : '') === v; }
|
|
414
|
+
else if (k === 'modal_title') {
|
|
415
|
+
ok = ['alertTitle', 'dialog_title'].includes(tail(truthy(g(n, 'resource_id')) ? g(n, 'resource_id') : ''))
|
|
416
|
+
&& normalized(g(n, 'text')) === normalized(v);
|
|
417
|
+
} else if (k === 'text' || k === 'content_desc') { ok = normalized(g(n, k)) === normalized(v); }
|
|
418
|
+
else if (k === 'selected') { ok = truthy(g(n, 'selected')) === truthy(v); }
|
|
419
|
+
else { ok = false; }
|
|
420
|
+
if (!ok) { break; }
|
|
421
|
+
}
|
|
422
|
+
if (ok) { out.push(n); }
|
|
423
|
+
}
|
|
424
|
+
return out;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/** learned_rule_matches(nodes, rule): all positive selectors present, no negative present. */
|
|
428
|
+
export function learnedRuleMatches(nodes, rule) {
|
|
429
|
+
if (!truthy(g(rule, 'all'))) { return false; }
|
|
430
|
+
return rule.all.every((s) => _selectorHits(nodes, s).length > 0)
|
|
431
|
+
&& !g(rule, 'none', []).some((s) => _selectorHits(nodes, s).length > 0);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const bnds = (n) => { const b = g(n, 'bounds'); return truthy(b) ? b : []; };
|
|
435
|
+
|
|
436
|
+
/** occluded_indices(nodes) -> Set of indices painted over by a covering sibling. */
|
|
437
|
+
export function occludedIndices(nodes) {
|
|
438
|
+
const children = new Map();
|
|
439
|
+
nodes.forEach((n, i) => {
|
|
440
|
+
const p = parentOf(n);
|
|
441
|
+
if (!children.has(p)) { children.set(p, []); }
|
|
442
|
+
children.get(p).push(i);
|
|
443
|
+
});
|
|
444
|
+
const kidsOf = (j) => children.get(j) ?? [];
|
|
445
|
+
const tops = nodes.map(bnds).filter((b) => b.length === 4);
|
|
446
|
+
const screenH = (tops.length ? Math.max(...tops.map((b) => b[3])) : 0) - (tops.length ? Math.min(...tops.map((b) => b[1])) : 0);
|
|
447
|
+
const area = (b) => (b[2] - b[0]) * (b[3] - b[1]);
|
|
448
|
+
const hasContent = (j) => {
|
|
449
|
+
const stack = [...kidsOf(j)];
|
|
450
|
+
while (stack.length) {
|
|
451
|
+
const k = stack.pop();
|
|
452
|
+
if (truthy(g(nodes[k], 'text')) || truthy(g(nodes[k], 'clickable'))) { return true; }
|
|
453
|
+
stack.push(...kidsOf(k));
|
|
454
|
+
}
|
|
455
|
+
return false;
|
|
456
|
+
};
|
|
457
|
+
const hideTree = (hidden, root) => {
|
|
458
|
+
const stack = [root];
|
|
459
|
+
while (stack.length) { const m = stack.pop(); hidden.add(m); stack.push(...kidsOf(m)); }
|
|
460
|
+
};
|
|
461
|
+
const hidden = new Set();
|
|
462
|
+
for (const [parent, kids] of children) {
|
|
463
|
+
const pcls = parent !== null && parent >= 0 && parent < nodes.length ? S(g(nodes[parent], 'class', '')) : '';
|
|
464
|
+
if (pcls.endsWith('DrawerLayout') && kids.length >= 2) {
|
|
465
|
+
const pb = bnds(nodes[parent]);
|
|
466
|
+
const drawers = kids.filter((k) => {
|
|
467
|
+
const b = bnds(nodes[k]);
|
|
468
|
+
return b.length === 4 && pb.length === 4 && (b[0] === pb[0] || b[2] === pb[2])
|
|
469
|
+
&& b[2] - b[0] < pb[2] - pb[0] && b[2] > b[0] && hasContent(k);
|
|
470
|
+
});
|
|
471
|
+
if (drawers.length === 1) {
|
|
472
|
+
for (const k of kids) { if (k !== drawers[0]) { hideTree(hidden, k); } }
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
for (const i of kids) {
|
|
477
|
+
const bi = bnds(nodes[i]);
|
|
478
|
+
if (bi.length !== 4 || bi[2] <= bi[0] || bi[3] <= bi[1]) { continue; }
|
|
479
|
+
if (screenH && bi[3] - bi[1] < 0.25 * screenH) { continue; }
|
|
480
|
+
for (const j of kids) {
|
|
481
|
+
if (j === i) { continue; }
|
|
482
|
+
const bj = bnds(nodes[j]);
|
|
483
|
+
if (bj.length === 4 && bj[0] <= bi[0] && bj[1] <= bi[1] && bj[2] >= bi[2] && bj[3] >= bi[3]
|
|
484
|
+
&& area(bj) > area(bi) && screenH && bj[3] - bj[1] >= 0.5 * screenH && hasContent(j)) {
|
|
485
|
+
hideTree(hidden, i);
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return hidden;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** tree_package(nodes): majority `package` of a dumped tree (first maximal on ties), or null. */
|
|
495
|
+
export function treePackage(nodes) {
|
|
496
|
+
const counts = new Map();
|
|
497
|
+
for (const n of nodes || []) {
|
|
498
|
+
if (truthy(g(n, 'package'))) { counts.set(n.package, (counts.get(n.package) ?? 0) + 1); }
|
|
499
|
+
}
|
|
500
|
+
return counts.size ? pyMax(counts.keys(), (k) => counts.get(k)) : null;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
const textSet = (nodes, pred) => {
|
|
504
|
+
const out = new Set();
|
|
505
|
+
nodes.forEach((n) => { if (truthy(g(n, 'text')) && pred(n)) { out.add(normalized(g(n, 'text'))); } });
|
|
506
|
+
return out;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
/** resolve_page(observation, catalog, configured_identity=None, app_package=None). */
|
|
510
|
+
// Call forms: resolvePage(obs, catalog, identity, {app_package}) (Python keyword), or
|
|
511
|
+
// resolvePage(obs, catalog, identity, 'pkg') (positional), or resolvePage(obs, catalog, {configured_identity, app_package}).
|
|
512
|
+
export function resolvePage(observation, catalog, configuredIdentity = null, opts = null) {
|
|
513
|
+
let appPackage = null;
|
|
514
|
+
if (typeof opts === 'string') { appPackage = opts; } else if (opts && typeof opts === 'object') { appPackage = opts.app_package ?? null; }
|
|
515
|
+
if (configuredIdentity && typeof configuredIdentity === 'object' && !Array.isArray(configuredIdentity)
|
|
516
|
+
&& ('configured_identity' in configuredIdentity || 'app_package' in configuredIdentity)) {
|
|
517
|
+
appPackage = configuredIdentity.app_package ?? appPackage;
|
|
518
|
+
configuredIdentity = configuredIdentity.configured_identity ?? null;
|
|
519
|
+
}
|
|
520
|
+
const ci = truthy(configuredIdentity) ? configuredIdentity : (truthy(g(observation, 'identity')) ? observation.identity : {});
|
|
521
|
+
const configuredId = g(ci, 'family');
|
|
522
|
+
const pkgTree = treePackage(g(observation, 'nodes'));
|
|
523
|
+
const pkg = truthy(pkgTree) ? pkgTree : g(observation, 'package');
|
|
524
|
+
if (truthy(appPackage) && truthy(pkg) && pkg !== appPackage) {
|
|
525
|
+
return { status: 'foreign-package', candidates: [], package: pkg };
|
|
526
|
+
}
|
|
527
|
+
if (g(ci, 'status') === 'verified' && Object.hasOwn(catalog, configuredId)) {
|
|
528
|
+
return { status: 'verified', static_id: configuredId, reason: 'configured-positive-anchor', anchors: [...g(ci, 'basis', [])] };
|
|
529
|
+
}
|
|
530
|
+
const allNodes = g(observation, 'nodes', []);
|
|
531
|
+
const hidden = occludedIndices(allNodes);
|
|
532
|
+
const nodes = allNodes.map((n, i) => (vis(n) && !hidden.has(i) ? n : { parent_index: g(n, 'parent_index'), visible: false }));
|
|
533
|
+
observation = { ...observation, nodes };
|
|
534
|
+
// in-page states never compete for the page identity (uiStatesOf reads their rules)
|
|
535
|
+
const learned = Object.keys(catalog).filter((ident) => !STATE_KINDS.includes(g(catalog[ident], 'kind'))
|
|
536
|
+
&& g(catalog[ident], 'learned_rules', []).some((r) => learnedRuleMatches(nodes, r)));
|
|
537
|
+
if (learned.length === 1) {
|
|
538
|
+
const rule = catalog[learned[0]].learned_rules.find((r) => learnedRuleMatches(nodes, r));
|
|
539
|
+
return { status: 'verified', static_id: learned[0], reason: 'learned-rule:' + rule.id,
|
|
540
|
+
anchors: rule.all.map((s) => Object.values(s)[0]) };
|
|
541
|
+
}
|
|
542
|
+
if (learned.length > 1) {
|
|
543
|
+
return { status: 'ambiguous', candidates: learned.map((i) => ({ static_id: i, reason: 'learned-rule' })) };
|
|
544
|
+
}
|
|
545
|
+
const rid = (n) => S(g(n, 'resource_id', ''));
|
|
546
|
+
const modalTitles = textSet(nodes, (n) => ['alertTitle', 'dialog_title'].includes(tail(rid(n))));
|
|
547
|
+
const frameworkRows = textSet(nodes, (n) => tail(rid(n)) === 'title' && rid(n).endsWith(':id/title'));
|
|
548
|
+
const inNavBar = (n) => {
|
|
549
|
+
let idx = parentOf(n);
|
|
550
|
+
for (let k = 0; k < 6; k++) {
|
|
551
|
+
if (!inRange(idx, nodes)) { return false; }
|
|
552
|
+
const p = nodes[idx];
|
|
553
|
+
const cls = S(g(p, 'class', ''));
|
|
554
|
+
if (endsWithAny(cls, ['BottomNavigationView', 'NavigationBarView', 'TabLayout', 'BottomNavigationItemView', 'NavigationBarItemView'])
|
|
555
|
+
|| S(g(p, 'resource_id', '')).includes('navigation_bar_item')) { return true; }
|
|
556
|
+
idx = parentOf(p);
|
|
557
|
+
}
|
|
558
|
+
return false;
|
|
559
|
+
};
|
|
560
|
+
const bodyText = textSet(nodes, (n) => !inNavBar(n) && !endsWithAny(S(g(n, 'class', '')), ['.Button', 'MaterialButton', 'ImageButton']));
|
|
561
|
+
const prefRows = frameworkRows.size >= 2 ? frameworkRows : bodyText;
|
|
562
|
+
let candidates = []; let weakBody = null;
|
|
563
|
+
if (modalTitles.size) {
|
|
564
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
565
|
+
const hits = inter(modalTitles, setOf(page.titles.map(normalized)));
|
|
566
|
+
if (page.kind === 'dialog' && hits.size) {
|
|
567
|
+
candidates.push({ static_id: ident, reason: 'unique-modal-title', anchors: sortedStr(hits) });
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (!candidates.length) {
|
|
571
|
+
const modalCatalog = {};
|
|
572
|
+
for (const [k, v] of Object.entries(catalog)) { if (['dialog', 'sheet', 'menu'].includes(g(v, 'kind'))) { dset(modalCatalog, k, v); } }
|
|
573
|
+
candidates = _ownWidgetCandidates(nodes, modalCatalog, observation);
|
|
574
|
+
}
|
|
575
|
+
} else {
|
|
576
|
+
const counts = new Map();
|
|
577
|
+
for (const page of Object.values(catalog)) {
|
|
578
|
+
for (const title of setOf(g(page, 'row_titles', []).map(normalized))) { counts.set(title, (counts.get(title) ?? 0) + 1); }
|
|
579
|
+
}
|
|
580
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
581
|
+
const sourceRows = g(page, 'row_source') === 'preference-xml' ? frameworkRows : prefRows;
|
|
582
|
+
const hits = inter(sourceRows, setOf(g(page, 'row_titles', []).map(normalized)));
|
|
583
|
+
const unique = [...hits].filter((h) => counts.get(h) === 1);
|
|
584
|
+
const single = g(page, 'row_titles', []).length === 1 && unique.length === 1
|
|
585
|
+
&& g(page, 'kind') === 'menu' && frameworkRows.has(unique[0]);
|
|
586
|
+
if (!frameworkRows.size && hits.size >= 2 && !_shareRowContainer(nodes, hits)) { continue; }
|
|
587
|
+
if ((hits.size >= 2 && unique.length) || single) {
|
|
588
|
+
candidates.push({ static_id: ident, reason: 'source-owned-preference-rows', anchors: sortedStr(hits) });
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
if (!candidates.length) { candidates = _selectedTabCandidates(nodes, catalog, observation); }
|
|
592
|
+
if (!candidates.length) { candidates = _toolbarTitleCandidates(nodes, catalog, observation); }
|
|
593
|
+
if (!candidates.length) { candidates = _ownWidgetCandidates(nodes, catalog, observation); }
|
|
594
|
+
if (!candidates.length) {
|
|
595
|
+
candidates = _bodyTextCandidates(nodes, catalog, observation);
|
|
596
|
+
if (candidates.length === 1 && candidates[0].weak) {
|
|
597
|
+
weakBody = candidates[0].weak; candidates = [];
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if (!candidates.length) {
|
|
601
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
602
|
+
const hasList = nodes.some((n) => g(n, 'resource_id') === 'android:id/list');
|
|
603
|
+
if (page.kind === 'activity' && g(page, 'component') === g(observation, 'activity')
|
|
604
|
+
&& (!hasList || g(page, 'hosts_static_pages') === false)) {
|
|
605
|
+
candidates.push({ static_id: ident, reason: 'exact-activity', anchors: [page.component] });
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
// Twins sharing every source anchor: nothing unique matched (or only a weak text of a page that is
|
|
611
|
+
// not one of them), but the bar title / search placeholder is a title several pages share.
|
|
612
|
+
if (!modalTitles.size && !candidates.length) {
|
|
613
|
+
const twins = _sharedTitleCandidates(nodes, catalog, observation);
|
|
614
|
+
const ids = new Set(twins.map((c) => c.static_id));
|
|
615
|
+
if (twins.length >= 2 && !(weakBody || []).some((c) => ids.has(g(c, 'static_id')))) {
|
|
616
|
+
return { status: 'ambiguous', candidates: twins };
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
if (candidates.length === 1) { return { status: 'verified', ...candidates[0] }; }
|
|
620
|
+
const out = { status: candidates.length ? 'ambiguous' : 'unmapped', candidates };
|
|
621
|
+
if (!candidates.length && weakBody) { out.weak_candidates = weakBody; }
|
|
622
|
+
return out;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export const _SCREEN_KINDS = ['fragment', 'activity', 'screen', 'compose-route', 'panel', 'view-page'];
|
|
626
|
+
|
|
627
|
+
/** _share_row_container(nodes, texts): >=2 of `texts` are rows of ONE list. */
|
|
628
|
+
export function _shareRowContainer(nodes, texts) {
|
|
629
|
+
const rowList = (n) => {
|
|
630
|
+
const chain = [];
|
|
631
|
+
let idx = parentOf(n);
|
|
632
|
+
for (let k = 0; k < 8; k++) {
|
|
633
|
+
if (!inRange(idx, nodes)) { return null; }
|
|
634
|
+
const p = nodes[idx];
|
|
635
|
+
if (truthy(g(p, 'scrollable')) || endsWithAny(S(g(p, 'class', '')), ['ListView', 'RecyclerView'])) {
|
|
636
|
+
let depth = chain.length;
|
|
637
|
+
if (S(g(p, 'class', '')).endsWith('ScrollView')) { depth -= 1; }
|
|
638
|
+
return depth <= 2 ? idx : null;
|
|
639
|
+
}
|
|
640
|
+
chain.push(idx);
|
|
641
|
+
idx = parentOf(p);
|
|
642
|
+
}
|
|
643
|
+
return null;
|
|
644
|
+
};
|
|
645
|
+
const owners = new Map();
|
|
646
|
+
for (const n of nodes) {
|
|
647
|
+
const t = normalized(g(n, 'text'));
|
|
648
|
+
if (texts.has(t)) {
|
|
649
|
+
const c = rowList(n);
|
|
650
|
+
if (c !== null) { if (!owners.has(c)) { owners.set(c, new Set()); } owners.get(c).add(t); }
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return [...owners.values()].some((v) => v.size >= 2);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** _host_compatible(page, catalog, observation). */
|
|
657
|
+
export function _hostCompatible(page, catalog, observation) {
|
|
658
|
+
const component = g(page, 'component');
|
|
659
|
+
return !truthy(component) || component === g(observation, 'activity');
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/** _toolbar_title_candidates(nodes, catalog, observation). */
|
|
663
|
+
export function _toolbarTitleCandidates(nodes, catalog, observation) {
|
|
664
|
+
const shown = _barTitles(nodes);
|
|
665
|
+
if (!shown.size) { return []; }
|
|
666
|
+
const owners = new Map();
|
|
667
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
668
|
+
if (!_SCREEN_KINDS.includes(g(page, 'kind'))) { continue; }
|
|
669
|
+
for (const title of setOf([...g(page, 'titles', []), ...g(page, 'hint_titles', [])].map(normalized))) {
|
|
670
|
+
if (!owners.has(title)) { owners.set(title, new Set()); }
|
|
671
|
+
owners.get(title).add(ident);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
const found = new Map();
|
|
675
|
+
for (const title of shown) {
|
|
676
|
+
const ids = owners.get(title) ?? new Set();
|
|
677
|
+
if (ids.size === 1) {
|
|
678
|
+
const ident = [...ids][0];
|
|
679
|
+
if (_hostCompatible(catalog[ident], catalog, observation)) {
|
|
680
|
+
if (!found.has(ident)) { found.set(ident, []); }
|
|
681
|
+
found.get(ident).push(title);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
return [...found].map(([ident, t]) => ({ static_id: ident, reason: 'unique-toolbar-title', anchors: sortedStr(t) }));
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Pages that share the screen's bar title or search-field placeholder (catalog `shared_titles`):
|
|
690
|
+
* `shared-title-twin` candidates, host-compatible ones only. Several shared texts shown narrow the
|
|
691
|
+
* set to the pages sharing all of them. Never a verdict: resolveTwinByOpener settles it by the opener.
|
|
692
|
+
*/
|
|
693
|
+
export function _sharedTitleCandidates(nodes, catalog, observation) {
|
|
694
|
+
const index = (key) => {
|
|
695
|
+
const m = new Map();
|
|
696
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
697
|
+
for (const t of (g(page, key, []) || [])) { if (!m.has(t)) { m.set(t, new Set()); } m.get(t).add(ident); }
|
|
698
|
+
}
|
|
699
|
+
return m;
|
|
700
|
+
};
|
|
701
|
+
const byTitle = index('shared_titles'); const byText = index('shared_texts');
|
|
702
|
+
const sets = [];
|
|
703
|
+
for (const t of _barTitles(nodes)) { if (byTitle.has(t)) { sets.push([t, byTitle.get(t)]); } }
|
|
704
|
+
for (const t of _placeholders(nodes)) { if (byText.has(t)) { sets.push([t, byText.get(t)]); } }
|
|
705
|
+
if (!sets.length) { return []; }
|
|
706
|
+
const shown = new Set(sets.map(([t]) => t));
|
|
707
|
+
let ids = null;
|
|
708
|
+
for (const [, s] of sets) { ids = ids === null ? new Set(s) : inter(ids, s); }
|
|
709
|
+
const anchors = sortedStr(shown);
|
|
710
|
+
return sortedStr(ids).filter((i) => _hostCompatible(catalog[i], catalog, observation))
|
|
711
|
+
.map((i) => ({ static_id: i, reason: 'shared-title-twin', anchors }));
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/** Bar titles on screen: a TextView in a Toolbar (3 levels) or a Compose top bar title. */
|
|
715
|
+
function _barTitles(nodes) {
|
|
716
|
+
const inToolbar = (n) => {
|
|
717
|
+
let idx = parentOf(n);
|
|
718
|
+
for (let k = 0; k < 3; k++) {
|
|
719
|
+
if (!inRange(idx, nodes)) { return false; }
|
|
720
|
+
const parent = nodes[idx];
|
|
721
|
+
const cls = S(g(parent, 'class', ''));
|
|
722
|
+
const r = tail(S(g(parent, 'resource_id', ''))).toLowerCase();
|
|
723
|
+
if (cls.endsWith('Toolbar') || ['toolbar', 'action_bar', 'toolbar_title'].includes(r)) { return true; }
|
|
724
|
+
idx = parentOf(parent);
|
|
725
|
+
}
|
|
726
|
+
return false;
|
|
727
|
+
};
|
|
728
|
+
if (nodes.some((n) => S(g(n, 'resource_id', '')) === 'android:id/title')) { return new Set(); }
|
|
729
|
+
return textSet(nodes, (n) => g(n, 'class') === 'android.widget.TextView' && (inToolbar(n) || _composeTopBarTitle(nodes, n)));
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
/** Search-field placeholders: an empty EditText's hint, or a TextView drawn inside an EditText (Compose). */
|
|
733
|
+
function _placeholders(nodes) {
|
|
734
|
+
const isEdit = (n) => S(g(n, 'class', '')).endsWith('EditText');
|
|
735
|
+
const out = new Set();
|
|
736
|
+
nodes.forEach((n) => {
|
|
737
|
+
if (!vis(n)) { return; }
|
|
738
|
+
if (isEdit(n) && !truthy(g(n, 'text')) && truthy(g(n, 'hint'))) { out.add(normalized(n.hint)); }
|
|
739
|
+
if (g(n, 'class') !== 'android.widget.TextView' || !truthy(g(n, 'text'))) { return; }
|
|
740
|
+
let idx = parentOf(n);
|
|
741
|
+
for (let k = 0; k < 3 && inRange(idx, nodes); k++) {
|
|
742
|
+
if (isEdit(nodes[idx])) { out.add(normalized(n.text)); return; }
|
|
743
|
+
idx = parentOf(nodes[idx]);
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
return out;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* A Compose top bar has no Toolbar class and no ids: its title is a plain TextView under an
|
|
751
|
+
* android.view.View, next to a clickable navigation icon (back / menu) in the same row.
|
|
752
|
+
* Measured (Salt Player 10-18): SETTINGS / ABOUT / MEDIA_SOURCE were reached 46 times and all
|
|
753
|
+
* resolved unmapped. The title must sit in the top band of the window, outside any scrollable
|
|
754
|
+
* container, with a clickable sibling to its left that overlaps it vertically.
|
|
755
|
+
*/
|
|
756
|
+
export function _composeTopBarTitle(nodes, n) {
|
|
757
|
+
const b = bnds(n);
|
|
758
|
+
if (b.length !== 4 || !truthy(g(n, 'text'))) { return false; }
|
|
759
|
+
const height = _extent(nodes)[1];
|
|
760
|
+
if (!(height > 0) || b[3] > TOP_BAR_BAND * height) { return false; }
|
|
761
|
+
let idx = parentOf(n);
|
|
762
|
+
for (let k = 0; k < 8 && inRange(idx, nodes); k++) {
|
|
763
|
+
if (truthy(g(nodes[idx], 'scrollable'))) { return false; }
|
|
764
|
+
idx = parentOf(nodes[idx]);
|
|
765
|
+
}
|
|
766
|
+
// A centered top bar (Material CenterAlignedTopAppBar and look-alikes) puts its navigation icon
|
|
767
|
+
// in another branch of the tree: a title centered on the window, with a clickable control
|
|
768
|
+
// beside it in the same band, is the bar's title.
|
|
769
|
+
const width = _extent(nodes)[0];
|
|
770
|
+
if (width > 0 && Math.abs((b[0] + b[2]) / 2 - width / 2) <= CENTERED_TITLE_TOLERANCE * width
|
|
771
|
+
&& nodes.some((c) => {
|
|
772
|
+
if (c === n || !truthy(g(c, 'clickable')) || !vis(c)) { return false; }
|
|
773
|
+
const cb = bnds(c);
|
|
774
|
+
return cb.length === 4 && cb[1] < b[3] && cb[3] > b[1] && (cb[2] <= b[0] + 2 || cb[0] >= b[2] - 2);
|
|
775
|
+
})) { return true; }
|
|
776
|
+
const pi = parentOf(n);
|
|
777
|
+
if (!inRange(pi, nodes)) { return false; }
|
|
778
|
+
// The navigation icon is a sibling of the title, or (Material3 TopAppBar wraps the title and the
|
|
779
|
+
// icon in their own slot boxes) a descendant of the row one or two levels up.
|
|
780
|
+
const within = (c, anc) => {
|
|
781
|
+
let i = parentOf(c);
|
|
782
|
+
for (let k = 0; k < 3 && inRange(i, nodes); k++) { if (i === anc) { return true; } i = parentOf(nodes[i]); }
|
|
783
|
+
return false;
|
|
784
|
+
};
|
|
785
|
+
let scope = pi;
|
|
786
|
+
for (let lvl = 0; lvl < 3 && inRange(scope, nodes); lvl++) {
|
|
787
|
+
if (nodes.some((c) => {
|
|
788
|
+
if (c === n || !truthy(g(c, 'clickable')) || !vis(c) || !within(c, scope)) { return false; }
|
|
789
|
+
const cb = bnds(c);
|
|
790
|
+
return cb.length === 4 && cb[2] <= b[0] + 2 && cb[1] < b[3] && cb[3] > b[1];
|
|
791
|
+
})) { return true; }
|
|
792
|
+
scope = parentOf(nodes[scope]);
|
|
793
|
+
}
|
|
794
|
+
// A ROOT page's bar (a home screen, a main tab) has no navigation icon: the title starts the row and
|
|
795
|
+
// the bar's action icons follow it on the right, one level up (the title sits in its own slot). It is
|
|
796
|
+
// the bar's title when it is the row's only text and every clickable in the row lies to its right.
|
|
797
|
+
const row = parentOf(nodes[pi]);
|
|
798
|
+
if (!inRange(row, nodes)) { return false; }
|
|
799
|
+
const under = (c, anc) => {
|
|
800
|
+
let i = parentOf(c);
|
|
801
|
+
for (let k = 0; k < 4 && inRange(i, nodes); k++) { if (i === anc) { return true; } i = parentOf(nodes[i]); }
|
|
802
|
+
return false;
|
|
803
|
+
};
|
|
804
|
+
const inRow = nodes.filter((c) => c !== n && vis(c) && under(c, row));
|
|
805
|
+
const overlaps = (cb) => cb.length === 4 && cb[1] < b[3] && cb[3] > b[1];
|
|
806
|
+
if (inRow.some((c) => g(c, 'class') === 'android.widget.TextView' && truthy(g(c, 'text')) && overlaps(bnds(c)))) { return false; }
|
|
807
|
+
const actions = inRow.filter((c) => truthy(g(c, 'clickable')) && overlaps(bnds(c)));
|
|
808
|
+
return actions.length > 0 && actions.every((c) => bnds(c)[0] >= b[2] - 2);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/** How far (as a share of the window width) a centered top-bar title's center may sit off center. */
|
|
812
|
+
export const CENTERED_TITLE_TOLERANCE = 0.03;
|
|
813
|
+
|
|
814
|
+
const _EXTENTS = new WeakMap();
|
|
815
|
+
/** [width, height] of the window a tree covers (rightmost / lowest bound), computed once per tree. */
|
|
816
|
+
function _extent(nodes) {
|
|
817
|
+
let e = _EXTENTS.get(nodes);
|
|
818
|
+
if (e === undefined) {
|
|
819
|
+
let w = 0; let h = 0;
|
|
820
|
+
for (const x of nodes) { const xb = bnds(x); if (xb.length === 4) { w = Math.max(w, xb[2]); h = Math.max(h, xb[3]); } }
|
|
821
|
+
e = [w, h]; _EXTENTS.set(nodes, e);
|
|
822
|
+
}
|
|
823
|
+
return e;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/** Fraction of the window height a top-bar title may reach down to. */
|
|
827
|
+
export const TOP_BAR_BAND = 0.12;
|
|
828
|
+
|
|
829
|
+
/** _selected_tab_candidates(nodes, catalog, observation). */
|
|
830
|
+
export function _selectedTabCandidates(nodes, catalog, observation) {
|
|
831
|
+
const strips = [];
|
|
832
|
+
nodes.forEach((n, i) => {
|
|
833
|
+
if (endsWithAny(S(g(n, 'class', '')), ['HorizontalScrollView', 'TabLayout'])
|
|
834
|
+
|| ['tabs', 'tab_layout', 'sliding_tabs', 'tabLayout'].includes(tail(S(g(n, 'resource_id', ''))))) { strips.push(i); }
|
|
835
|
+
});
|
|
836
|
+
if (!strips.length) { return []; }
|
|
837
|
+
const under = (i, root) => {
|
|
838
|
+
for (let k = 0; k < 6; k++) {
|
|
839
|
+
i = i >= 0 && i < nodes.length ? parentOf(nodes[i]) : null;
|
|
840
|
+
if (i === null) { return false; }
|
|
841
|
+
if (i === root) { return true; }
|
|
842
|
+
}
|
|
843
|
+
return false;
|
|
844
|
+
};
|
|
845
|
+
const selected = new Set();
|
|
846
|
+
nodes.forEach((n, i) => {
|
|
847
|
+
const cap = truthy(g(n, 'text')) ? g(n, 'text') : g(n, 'content_desc');
|
|
848
|
+
if (truthy(g(n, 'selected')) && truthy(cap) && strips.some((s) => under(i, s))) { selected.add(normalized(cap)); }
|
|
849
|
+
});
|
|
850
|
+
if (selected.size !== 1) { return []; }
|
|
851
|
+
const cap = [...selected][0];
|
|
852
|
+
const hits = Object.keys(catalog).filter((ident) => normalized(g(catalog[ident], 'tab_label')) === cap && truthy(g(catalog[ident], 'tab_label')));
|
|
853
|
+
if (hits.length !== 1) { return []; }
|
|
854
|
+
return [{ static_id: hits[0], reason: 'selected-tab', anchors: [cap] }];
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
const setKey = (xs) => JSON.stringify(sortedStr(new Set(xs)));
|
|
858
|
+
|
|
859
|
+
/** _own_widget_candidates(nodes, catalog, observation): identify a page by ids only its layout declares. */
|
|
860
|
+
export function _ownWidgetCandidates(nodes, catalog, observation) {
|
|
861
|
+
const overlay = new Set();
|
|
862
|
+
const kidsOf = new Map();
|
|
863
|
+
nodes.forEach((c, k) => { const p = parentOf(c); if (!kidsOf.has(p)) { kidsOf.set(p, []); } kidsOf.get(p).push(k); });
|
|
864
|
+
nodes.forEach((n, i) => {
|
|
865
|
+
const pi = parentOf(n);
|
|
866
|
+
const p = pi !== null && pi >= 0 && pi < nodes.length ? nodes[pi] : {};
|
|
867
|
+
if (!endsWithAny(S(g(p, 'class', '')), ['CoordinatorLayout', 'ViewGroup', 'FrameLayout'])) { return; }
|
|
868
|
+
const siblings = (kidsOf.get(pi) ?? []).filter((k) => nodes[k] !== n).map((k) => nodes[k]);
|
|
869
|
+
const nb = truthy(g(n, 'bounds')) ? n.bounds : [0, 0, 0, 0];
|
|
870
|
+
const pbA = truthy(g(p, 'bounds')) ? p.bounds : [0, 0, 0, 1];
|
|
871
|
+
const pbB = truthy(g(p, 'bounds')) ? p.bounds : [0, 0, 0, 0];
|
|
872
|
+
if (!siblings.some((c) => bnds(c).length === 4 && c.bounds[3] <= nb[1] + 2
|
|
873
|
+
&& c.bounds[3] - c.bounds[1] > 0.5 * (pbA[3] - pbB[1]))) { return; }
|
|
874
|
+
const pb = bnds(p); const b = bnds(n);
|
|
875
|
+
if (pb.length === 4 && b.length === 4 && pb[3] - pb[1] > 0 && b[1] >= pb[1] + 0.75 * (pb[3] - pb[1])
|
|
876
|
+
&& b[3] - b[1] < 0.25 * (pb[3] - pb[1]) && Math.abs(b[3] - pb[3]) <= 2) {
|
|
877
|
+
const stack = [i];
|
|
878
|
+
while (stack.length) { const j = stack.pop(); overlay.add(j); stack.push(...(kidsOf.get(j) ?? [])); }
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
const visible = new Set();
|
|
882
|
+
nodes.forEach((n, i) => { if (truthy(g(n, 'resource_id')) && !overlay.has(i)) { visible.add(tail(S(g(n, 'resource_id', '')))); } });
|
|
883
|
+
const counts = new Map(); const groups = new Map();
|
|
884
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
885
|
+
const ids = g(page, 'widget_ids', []);
|
|
886
|
+
if (ids.length) {
|
|
887
|
+
const k = setKey(ids);
|
|
888
|
+
if (!groups.has(k)) { groups.set(k, { ids: new Set(ids), members: [] }); }
|
|
889
|
+
groups.get(k).members.push(ident);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
for (const { ids } of groups.values()) { for (const r of ids) { counts.set(r, (counts.get(r) ?? 0) + 1); } }
|
|
893
|
+
const modalOpen = g(observation, 'window') === 'dialog' || nodes.some((n) =>
|
|
894
|
+
['alertTitle', 'parentPanel', 'design_bottom_sheet'].includes(tail(S(g(n, 'resource_id', '')))));
|
|
895
|
+
let scored = [];
|
|
896
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
897
|
+
if (['dialog', 'sheet'].includes(g(page, 'kind')) && !modalOpen) { continue; }
|
|
898
|
+
const unique = sortedStr(g(page, 'widget_ids', []).filter((r) => counts.get(r) === 1 && visible.has(r)));
|
|
899
|
+
const hiddenIds = g(page, 'hidden_ids', []);
|
|
900
|
+
const shown = g(page, 'widget_ids', []).filter((r) => !hiddenIds.includes(r));
|
|
901
|
+
const need = shown.filter((r) => counts.get(r) === 1).length === 1 ? 1 : 2;
|
|
902
|
+
if (unique.length >= need && _hostCompatible(page, catalog, observation)) { scored.push([unique.length, ident, unique]); }
|
|
903
|
+
}
|
|
904
|
+
if (!scored.length) {
|
|
905
|
+
const own = [];
|
|
906
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
907
|
+
if (['dialog', 'sheet'].includes(g(page, 'kind')) && !modalOpen) { continue; }
|
|
908
|
+
if (!_hostCompatible(page, catalog, observation)) { continue; }
|
|
909
|
+
const ids = new Set(g(page, 'widget_ids', []));
|
|
910
|
+
const informative = new Set([...ids].filter((r) => visible.has(r) && (counts.get(r) ?? 0) <= 5));
|
|
911
|
+
if (informative.size >= 3) { own.push([ident, informative, ids]); }
|
|
912
|
+
}
|
|
913
|
+
const best = sortedBy(own, (x) => x[1].size, true);
|
|
914
|
+
if (best.length) {
|
|
915
|
+
const [ident, hit] = best[0];
|
|
916
|
+
const superset = (a, b) => [...b].every((x) => a.has(x));
|
|
917
|
+
const rivals = best.slice(1).filter(([, h, i]) => superset(h, hit) || [...i].every((x) => h.has(x)) || h.size === hit.size);
|
|
918
|
+
if (!rivals.length) { return [{ static_id: ident, reason: 'best-layout-cover', anchors: sortedStr(hit) }]; }
|
|
919
|
+
}
|
|
920
|
+
return [];
|
|
921
|
+
}
|
|
922
|
+
scored = sortedBy(scored, (x) => [x[0], x[1]], true);
|
|
923
|
+
const top = scored.filter((x) => x[0] === scored[0][0]);
|
|
924
|
+
if (top.length > 1 && new Set(top.map(([, i]) => setKey(g(catalog[i], 'widget_ids', [])))).size === 1) {
|
|
925
|
+
return top.map(([, i, u]) => ({ static_id: i, reason: 'layout-twin', anchors: u }));
|
|
926
|
+
}
|
|
927
|
+
if (scored.length > 1 && scored[0][0] === scored[1][0]) {
|
|
928
|
+
return scored.filter((x) => x[0] === scored[0][0]).map(([, i, u]) => ({ static_id: i, reason: 'own-layout-ids', anchors: u }));
|
|
929
|
+
}
|
|
930
|
+
const best = scored[0];
|
|
931
|
+
return [{ static_id: best[1], reason: 'own-layout-ids', anchors: best[2] }];
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* resolve_twin_by_opener(resolution, prior, catalog): layout twins (several pages inflating the
|
|
936
|
+
* same layout) cannot be told apart by the screen alone, but the static graph knows which page
|
|
937
|
+
* OPENS each of them. When the screen shown just before was verified as page P (or P's host /
|
|
938
|
+
* panel host) and exactly one twin is opened from P, that twin is the page. Otherwise the
|
|
939
|
+
* resolution is returned unchanged.
|
|
940
|
+
*/
|
|
941
|
+
export function resolveTwinByOpener(resolution, prior, catalog) {
|
|
942
|
+
const weak = g(resolution, 'status') === 'unmapped' ? (g(resolution, 'weak_candidates') || []) : [];
|
|
943
|
+
if (weak.length) { return _weakByOpener(resolution, weak, prior, catalog); }
|
|
944
|
+
const cands = truthy(g(resolution, 'candidates')) ? resolution.candidates : [];
|
|
945
|
+
const kind = cands.length ? g(cands[0], 'reason') : null;
|
|
946
|
+
if (g(resolution, 'status') !== 'ambiguous' || cands.length < 2 || !['layout-twin', 'shared-title-twin'].includes(kind)
|
|
947
|
+
|| !cands.every((c) => g(c, 'reason') === kind)) {
|
|
948
|
+
return resolution;
|
|
949
|
+
}
|
|
950
|
+
const pr = g(prior || {}, 'static_resolution', {});
|
|
951
|
+
if (g(pr, 'status') !== 'verified' || !truthy(g(pr, 'static_id'))) { return resolution; }
|
|
952
|
+
const p = S(pr.static_id);
|
|
953
|
+
// A shared-title twin captured again (content loaded, scrolled) is still the twin verified before
|
|
954
|
+
// -- unless another twin is opened FROM it: then "stayed" and "navigated to the child" look the
|
|
955
|
+
// same (measured, jingmo: riddle index and riddle read share only the title 谜语; after tapping
|
|
956
|
+
// 阅读更多 the read page was kept as the index). Leave that ambiguous rather than guess.
|
|
957
|
+
const childOfPrior = (c) => g(c, 'static_id') !== p
|
|
958
|
+
&& (g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []) || []).includes(p);
|
|
959
|
+
if (kind === 'shared-title-twin' && cands.some((c) => g(c, 'static_id') === p)) {
|
|
960
|
+
if (cands.some(childOfPrior)) { return resolution; }
|
|
961
|
+
const c = cands.find((x) => g(x, 'static_id') === p);
|
|
962
|
+
return { status: 'verified', static_id: p, reason: 'shared-title-continued',
|
|
963
|
+
anchors: [...(g(c, 'anchors', []) || []), 'continued-from:' + p] };
|
|
964
|
+
}
|
|
965
|
+
// The opener as recorded statically: the page itself, a menu's/panel's host page.
|
|
966
|
+
const openers = new Set([p]);
|
|
967
|
+
const host = panelHost(p); if (host) { openers.add(host); }
|
|
968
|
+
const at = p.lastIndexOf('@');
|
|
969
|
+
if (p.startsWith('menu:') && at > 0) {
|
|
970
|
+
const owner = p.slice(at + 1);
|
|
971
|
+
for (const ident of Object.keys(catalog)) { if (ident.split(':').pop() === owner) { openers.add(ident); } }
|
|
972
|
+
}
|
|
973
|
+
const hit = cands.filter((c) => g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []).some((o) => openers.has(o)));
|
|
974
|
+
if (hit.length !== 1) { return resolution; }
|
|
975
|
+
// The opener rule assumes the device went FORWARD from P. A shared-title twin that P itself was
|
|
976
|
+
// opened from may be the screen just as well -- Back (or a relaunch's replay) lands on it
|
|
977
|
+
// (measured, jingmo: back from a *_bookmarks page to its index was taken as the bookmark's *_show).
|
|
978
|
+
if (kind === 'shared-title-twin') {
|
|
979
|
+
const parents = new Set(g(g(catalog, p, {}), 'opened_from', []) || []);
|
|
980
|
+
if (cands.some((c) => parents.has(g(c, 'static_id')))) { return resolution; }
|
|
981
|
+
}
|
|
982
|
+
return { status: 'verified', static_id: hit[0].static_id, reason: kind === 'layout-twin' ? 'layout-twin-opener' : 'shared-title-opener',
|
|
983
|
+
anchors: [...(g(hit[0], 'anchors', []) || []), 'opened-from:' + p] };
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* A screen whose only anchor is one short unique source text (a "添加" button) is that page when
|
|
988
|
+
* the screen just before was verified as a page with a static edge to exactly one such candidate.
|
|
989
|
+
*/
|
|
990
|
+
export function _weakByOpener(resolution, weak, prior, catalog) {
|
|
991
|
+
const pr = g(prior || {}, 'static_resolution', {});
|
|
992
|
+
if (g(pr, 'status') !== 'verified' || !truthy(g(pr, 'static_id'))) { return resolution; }
|
|
993
|
+
const p = S(pr.static_id);
|
|
994
|
+
// The opener, or the page itself on the capture before (its content finished loading, it
|
|
995
|
+
// scrolled): the weak anchor is still the one it showed when verified.
|
|
996
|
+
const hit = weak.filter((c) => g(c, 'static_id') === p
|
|
997
|
+
|| (g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []) || []).includes(p));
|
|
998
|
+
if (hit.length !== 1) { return resolution; }
|
|
999
|
+
const same = hit[0].static_id === p;
|
|
1000
|
+
return { status: 'verified', static_id: hit[0].static_id, reason: same ? 'weak-body-text-continued' : 'weak-body-text-opener',
|
|
1001
|
+
anchors: [...(g(hit[0], 'anchors', []) || []), (same ? 'continued-from:' : 'opened-from:') + p] };
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
export const BACK_MAX_DEPTH = 6;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* back_can_reach(observation, target, catalog): may a Back press from this screen land on
|
|
1008
|
+
* `target`? Back can only return to a page the current one was opened from, so the target must be
|
|
1009
|
+
* a static ancestor (via `opened_from`, a menu's owner page, a panel's host) within
|
|
1010
|
+
* BACK_MAX_DEPTH hops. Unknown evidence -- screen not verified, or a catalog built without
|
|
1011
|
+
* `opened_from` -- answers true, keeping the plain Back-then-relaunch behaviour.
|
|
1012
|
+
*/
|
|
1013
|
+
export function backCanReach(observation, target, catalog) {
|
|
1014
|
+
const r = g(observation || {}, 'static_resolution', {});
|
|
1015
|
+
if (g(r, 'status') !== 'verified' || !truthy(g(r, 'static_id')) || !truthy(target)) { return true; }
|
|
1016
|
+
if (!Object.values(catalog || {}).some((p) => Array.isArray(g(p, 'opened_from')))) { return true; }
|
|
1017
|
+
const owners = (ident) => {
|
|
1018
|
+
const out = new Set(g(g(catalog, ident, {}), 'opened_from', []) || []);
|
|
1019
|
+
const host = panelHost(ident); if (host) { out.add(host); }
|
|
1020
|
+
const at = S(ident).lastIndexOf('@');
|
|
1021
|
+
if (S(ident).startsWith('menu:') && at > 0) {
|
|
1022
|
+
const owner = S(ident).slice(at + 1);
|
|
1023
|
+
for (const k of Object.keys(catalog)) { if (k.split(':').pop() === owner) { out.add(k); } }
|
|
1024
|
+
}
|
|
1025
|
+
return out;
|
|
1026
|
+
};
|
|
1027
|
+
let frontier = new Set([S(r.static_id)]); const seen = new Set(frontier);
|
|
1028
|
+
for (let d = 0; d < BACK_MAX_DEPTH && frontier.size; d++) {
|
|
1029
|
+
const next = new Set();
|
|
1030
|
+
for (const id of frontier) {
|
|
1031
|
+
for (const o of owners(id)) {
|
|
1032
|
+
if (o === target) { return true; }
|
|
1033
|
+
if (!seen.has(o)) { seen.add(o); next.add(o); }
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
frontier = next;
|
|
1037
|
+
}
|
|
1038
|
+
return false;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/** Kinds that are a state of a host page, not a screen: identified by `state_rules`, never by resolvePage. */
|
|
1042
|
+
export const STATE_KINDS = ['ui-state', 'mode'];
|
|
1043
|
+
|
|
1044
|
+
/** state_host(ident): `ui-state:<host id>#<name>` / `mode:<host id>#<name>` -> host id, else null. */
|
|
1045
|
+
export function stateHost(ident) {
|
|
1046
|
+
const s = S(ident);
|
|
1047
|
+
const kind = STATE_KINDS.find((k) => s.startsWith(k + ':'));
|
|
1048
|
+
if (!kind || !s.includes('#')) { return null; }
|
|
1049
|
+
const rest = s.slice(kind.length + 1);
|
|
1050
|
+
return rest.slice(0, rest.lastIndexOf('#')) || null;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/** A state anchor rule ({all, none}) with at least one positive selector, else null. */
|
|
1054
|
+
export function _stateRule(spec, id) {
|
|
1055
|
+
if (!spec || typeof spec !== 'object' || Array.isArray(spec)) { return null; }
|
|
1056
|
+
const sel = (xs) => (Array.isArray(xs) ? xs : []).filter((s) => s && typeof s === 'object' && !Array.isArray(s) && Object.keys(s).length);
|
|
1057
|
+
const all = sel(g(spec, 'all'));
|
|
1058
|
+
return all.length ? { id, all, none: sel(g(spec, 'none')) } : null;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* apply_state_anchors(catalog, anchors): campaign/config anchors ({<state id>: {all, none}}) replace
|
|
1063
|
+
* the static ones for that state. Returns the ids that got a rule; unknown or non-state ids are ignored.
|
|
1064
|
+
*/
|
|
1065
|
+
export function applyStateAnchors(catalog, anchors) {
|
|
1066
|
+
const applied = [];
|
|
1067
|
+
for (const [ident, spec] of Object.entries(anchors && typeof anchors === 'object' ? anchors : {})) {
|
|
1068
|
+
const item = g(catalog, ident);
|
|
1069
|
+
if (!item || !STATE_KINDS.includes(item.kind)) { continue; }
|
|
1070
|
+
const rule = _stateRule(spec, 'configured');
|
|
1071
|
+
if (!rule) { continue; }
|
|
1072
|
+
// a catalog compiled before states carried `host_node`: the id names it (`ui-state:<host>#<name>`)
|
|
1073
|
+
if (!truthy(item.host_node)) { item.host_node = stateHost(ident); }
|
|
1074
|
+
if (!truthy(item.host_node)) { continue; }
|
|
1075
|
+
item.state_rules = [rule]; applied.push(ident);
|
|
1076
|
+
}
|
|
1077
|
+
return applied;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* ui_states_of(observation, catalog): the in-page states the observation shows -- each one's host is
|
|
1082
|
+
* the page shown and its anchor rule holds on the visible, unoccluded tree. Two states of one host
|
|
1083
|
+
* holding at once say nothing about either, so neither is returned.
|
|
1084
|
+
*/
|
|
1085
|
+
export function uiStatesOf(observation, catalog) {
|
|
1086
|
+
const allNodes = g(observation, 'nodes', []) || [];
|
|
1087
|
+
if (!allNodes.length) { return []; }
|
|
1088
|
+
const hidden = occludedIndices(allNodes);
|
|
1089
|
+
const nodes = allNodes.map((n, i) => (vis(n) && !hidden.has(i) ? n : { parent_index: g(n, 'parent_index'), visible: false }));
|
|
1090
|
+
const byHost = new Map();
|
|
1091
|
+
for (const [ident, item] of Object.entries(catalog || {})) {
|
|
1092
|
+
if (!truthy(g(item, 'state_rules')) || !truthy(g(item, 'host_node'))) { continue; }
|
|
1093
|
+
// a state of a state is not resolved (its host check would recurse into this one)
|
|
1094
|
+
if (truthy(g(g(catalog, item.host_node, {}), 'state_rules'))) { continue; }
|
|
1095
|
+
if (!item.state_rules.some((r) => learnedRuleMatches(nodes, r))) { continue; }
|
|
1096
|
+
if (!observationMatchesStatic(observation, item.host_node, catalog)[0]) { continue; }
|
|
1097
|
+
if (!byHost.has(item.host_node)) { byHost.set(item.host_node, []); }
|
|
1098
|
+
byHost.get(item.host_node).push(ident);
|
|
1099
|
+
}
|
|
1100
|
+
return sortedStr([...byHost.values()].filter((ids) => ids.length === 1).flat());
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/** panel_host(ident): `panel:<host id>#<name>` -> host id, else null. */
|
|
1104
|
+
export function panelHost(ident) {
|
|
1105
|
+
const s = S(truthy(ident) ? ident : '');
|
|
1106
|
+
if (!s.startsWith('panel:') || !s.includes('#')) { return null; }
|
|
1107
|
+
const h = s.slice('panel:'.length);
|
|
1108
|
+
return h.slice(0, h.lastIndexOf('#')) || null;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
/** observation_matches_static(observation, ident, catalog) -> [matched, how]. */
|
|
1112
|
+
export function observationMatchesStatic(observation, ident, catalog) {
|
|
1113
|
+
const resolution = g(observation, 'static_resolution', {});
|
|
1114
|
+
const verified = g(resolution, 'status') === 'verified';
|
|
1115
|
+
const rsid = g(resolution, 'static_id');
|
|
1116
|
+
if (verified && rsid === ident) { return [true, 'exact-page']; }
|
|
1117
|
+
const page = g(catalog, ident, {});
|
|
1118
|
+
if (truthy(g(page, 'state_rules')) && truthy(g(page, 'host_node'))) {
|
|
1119
|
+
return uiStatesOf(observation, catalog).includes(ident) ? [true, 'ui-state-anchor'] : [false, 'ui-state-anchor-mismatch'];
|
|
1120
|
+
}
|
|
1121
|
+
if (g(page, 'kind') === 'host-activity' && g(page, 'component') === g(observation, 'activity')) { return [true, 'host-component']; }
|
|
1122
|
+
if (verified && g(page, 'default_children', []).includes(rsid)) { return [true, 'host-default-child']; }
|
|
1123
|
+
if (verified && panelHost(rsid) === ident) { return [true, 'host-of-panel']; }
|
|
1124
|
+
const shown = verified ? g(catalog, rsid, {}) : {};
|
|
1125
|
+
if (g(shown, 'default_children', []).includes(ident)) { return [true, 'default-child-of-host']; }
|
|
1126
|
+
const ownIds = g(page, 'widget_ids', []);
|
|
1127
|
+
if (ownIds.length && truthy(shown) && g(shown, 'kind') === g(page, 'kind') && setKey(g(shown, 'widget_ids', [])) === setKey(ownIds)) {
|
|
1128
|
+
return [true, 'layout-twin'];
|
|
1129
|
+
}
|
|
1130
|
+
const cands = truthy(g(resolution, 'candidates')) ? resolution.candidates : [];
|
|
1131
|
+
if (g(resolution, 'status') === 'ambiguous' && cands.length && cands.every((c) => g(c, 'reason') === 'layout-twin')
|
|
1132
|
+
&& cands.some((c) => g(c, 'static_id') === ident)) {
|
|
1133
|
+
return [true, 'layout-twin'];
|
|
1134
|
+
}
|
|
1135
|
+
return [false, 'static-context-mismatch'];
|
|
1136
|
+
}
|