@buaa_smat/hometrans 26.0.1 → 26.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -7
- package/agents/code-reviewer.md +25 -138
- package/dist/cli/index.js +4 -1
- package/dist/cli/init.js +131 -26
- package/dist/cli/uninstall.js +5 -5
- package/dist/platform/language.js +77 -0
- package/env-requirements.json +30 -5
- package/i18n/FILE-NAMES.md +9 -0
- package/i18n/agents/code-reviewer.md +364 -0
- package/i18n/agents/model-render-worker.md +38 -0
- package/i18n/agents/specgen-worker.md +18 -0
- package/i18n/commands/hometrans.md +17 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +198 -0
- package/i18n/skills/a2h-app-migrate/references/config.example.json +28 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +19 -0
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +50 -0
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +1760 -0
- package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +114 -0
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1588 -0
- package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +657 -0
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +541 -0
- package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +131 -0
- package/i18n/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
- package/i18n/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/i18n/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
- package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +698 -0
- package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
- package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/i18n/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +219 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +196 -0
- package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +488 -0
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +146 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +161 -0
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/i18n/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/i18n/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +171 -0
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/i18n/skills/a2h-arch-generate/SKILL.md +375 -0
- package/i18n/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
- package/i18n/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
- package/i18n/skills/a2h-arch-generate/references/arkts-mvvm-v2.md +1407 -0
- package/i18n/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
- package/i18n/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
- package/i18n/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
- package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
- package/i18n/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
- package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
- package/i18n/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
- package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +120 -0
- package/i18n/skills/a2h-arch-generate/references/source-baseline.md +93 -0
- package/i18n/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +360 -0
- package/i18n/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +798 -0
- package/i18n/skills/a2h-arch-generate/scripts/lib/contract_terms.mjs +40 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/generate.mjs +639 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1261 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
- package/i18n/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +851 -0
- package/i18n/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +982 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +9 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +192 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +303 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/design/move_spec_technical_reference.mjs +162 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +298 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +587 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +352 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +323 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +31 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +80 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +22 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +87 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +57 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +29 -0
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +705 -0
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +417 -0
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +139 -0
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2549 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +560 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +148 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +220 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +28 -0
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +216 -0
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +203 -0
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +210 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +2005 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1748 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1787 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1836 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/image_probe.mjs +405 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1406 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1226 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1220 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +412 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +18 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +173 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +629 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +67 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +136 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +551 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +374 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +119 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +80 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +137 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +97 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +123 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +67 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +427 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +560 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +324 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +325 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +48 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +387 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +470 -0
- package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +59 -0
- package/i18n/skills/a2h-dashboard-render/SKILL.md +73 -0
- package/i18n/skills/a2h-dashboard-render/references/artifact-contract.jsonc +117 -0
- package/i18n/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
- package/i18n/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
- package/i18n/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
- package/i18n/skills/a2h-dashboard-render/scripts/dashboard.mjs +3245 -0
- package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +2048 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/i18n/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +154 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/i18n/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/i18n/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
- package/i18n/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/i18n/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
- package/i18n/skills/a2h-fix-build-errors/SKILL.md +304 -0
- package/i18n/skills/a2h-fix-build-errors/references/arkts-strict-patterns.md +219 -0
- package/i18n/skills/a2h-fix-build-errors/references/rdb-entity-pattern.md +131 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +227 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/i18n/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/i18n/skills/a2h-page-specgen/SKILL.md +136 -0
- package/i18n/skills/a2h-page-specgen/references/body-language.md +177 -0
- package/i18n/skills/a2h-page-specgen/references/gates.md +262 -0
- package/i18n/skills/a2h-page-specgen/references/page-inventory.md +173 -0
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +207 -0
- package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +1504 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +1528 -0
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +576 -0
- package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +138 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +262 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +176 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +248 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +506 -0
- package/i18n/skills/a2h-page-specgen/scripts/render.mjs +299 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +616 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +234 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1166 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +74 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +8 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +7 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +8 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +758 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +54 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +271 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +54 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +171 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +301 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +83 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +139 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +774 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1011 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +77 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +419 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +323 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +546 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +511 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +701 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1765 -0
- package/i18n/skills/a2h-resource-convert/SKILL.md +367 -0
- package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +335 -0
- package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +251 -0
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +219 -0
- package/i18n/skills/a2h-resource-convert/references/resource-mapping-rules.md +493 -0
- package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +249 -0
- package/i18n/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +2532 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +278 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +260 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +163 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +44 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +589 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +506 -0
- package/i18n/skills/a2h-spec-generate/SKILL.md +375 -0
- package/i18n/skills/a2h-spec-generate/references/batch-mode.md +215 -0
- package/i18n/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
- package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +184 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +27 -0
- package/i18n/skills/a2h-spec-generate/references/library-evidence.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/method-discipline.md +64 -0
- package/i18n/skills/a2h-spec-generate/references/optional-gates.json +45 -0
- package/i18n/skills/a2h-spec-generate/references/recall-guide.md +84 -0
- package/i18n/skills/a2h-spec-generate/references/recall-terse.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
- package/i18n/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
- package/i18n/skills/a2h-spec-generate/references/review-checklist.md +22 -0
- package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
- package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
- package/i18n/skills/a2h-spec-generate/references/spec-samples.md +65 -0
- package/i18n/skills/a2h-spec-generate/references/specs.schema.json +85 -0
- package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +145 -0
- package/i18n/skills/a2h-spec-generate/references/transfer-file.md +5 -0
- package/i18n/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
- package/i18n/skills/a2h-spec-generate/references/worker-rules.md +129 -0
- package/i18n/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +702 -0
- package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +515 -0
- package/i18n/skills/a2h-spec-generate/scripts/collect-specs.mjs +727 -0
- package/i18n/skills/a2h-spec-generate/scripts/feature-stem.mjs +151 -0
- package/i18n/skills/a2h-spec-generate/scripts/parse_requirements.ts +515 -0
- package/i18n/skills/a2h-spec-generate/scripts/prepare-facts.mjs +313 -0
- package/i18n/skills/a2h-spec-generate/scripts/publish-specs.mjs +354 -0
- package/i18n/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +669 -0
- package/i18n/skills/a2h-spec-generate/scripts/render-tasks.mjs +385 -0
- package/i18n/skills/a2h-spec-generate/scripts/report.mjs +136 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1265 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1057 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +565 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +544 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +317 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +707 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +436 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +608 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +650 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +178 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +912 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +279 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +163 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +256 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +340 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1857 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +262 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +722 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/i18n/skills/a2h-spec-generate/template/REQ.txt +22 -0
- package/i18n/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
- package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +847 -0
- package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +415 -0
- package/i18n/skills/a2h-spec-generate/test/collect-specs.test.mjs +808 -0
- package/i18n/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/i18n/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/i18n/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
- package/i18n/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
- package/i18n/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
- package/i18n/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
- package/i18n/skills/a2h-spec-generate/test/report.test.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/SKILL.md +120 -0
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +279 -0
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +918 -0
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +446 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hint_check.mjs +147 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hint_source.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_b.mjs +550 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +380 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +492 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +199 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1412 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +2037 -0
- package/i18n/skills/a2h-utg-static/SKILL.md +368 -0
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
- package/i18n/skills/a2h-utg-static/references/view-interactions.md +215 -0
- package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +2120 -0
- package/i18n/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +609 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +250 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +374 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
- package/i18n/skills/a2h-utg-static/scripts/fragment_nav.mjs +1137 -0
- package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -0
- package/i18n/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +913 -0
- package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +517 -0
- package/i18n/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
- package/i18n/skills/a2h-utg-static/scripts/static_prior.mjs +956 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +108 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +289 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_fresh_branch_guard.mjs +49 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +136 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +368 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +44 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_off_path.mjs +67 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +61 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_data_table.mjs +340 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_relative_url.mjs +125 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +340 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1351 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
- package/package.json +13 -160
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
- package/skills/a2h-app-migrate/SKILL.md +17 -6
- package/skills/a2h-app-migrate/references/config.example.json +1 -0
- package/skills/a2h-app-migrate/references/stage-map.md +3 -1
- package/skills/a2h-app-migrate/references/workflow.yaml +138 -47
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +1 -2
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +105 -39
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +7 -8
- package/skills/a2h-app-migrate/scripts/ledger.mjs +17 -5
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +43 -7
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +127 -41
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +2 -0
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +38 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +131 -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 +98 -0
- package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/skills/a2h-app-migrate/test/test_devecocli_docs_preflight.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +102 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +698 -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_i18n_engine_mirror.mjs +51 -0
- package/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -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 +111 -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 +93 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +219 -0
- package/skills/a2h-app-migrate/test/test_resume_summary.mjs +196 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +488 -0
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_acceptance.mjs +94 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +147 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +161 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +344 -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_uniapp_preflight.mjs +83 -0
- package/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
- package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +41 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +178 -0
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/skills/a2h-arch-generate/SKILL.md +1 -1
- package/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
- package/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +15 -6
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +2 -2
- package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +35 -46
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +33 -40
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +2 -3
- 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 +1260 -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_module_templates.mjs +70 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +138 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +2 -5
- package/skills/a2h-arkts-logic-coder/SKILL.md +21 -2
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -0
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +62 -0
- package/skills/a2h-arkts-logic-coder/references/spec-design.md +4 -0
- package/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +22 -25
- package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +583 -0
- package/skills/a2h-arkts-logic-coder/test/golden/inspect_happy.json +20 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
- package/skills/a2h-arkts-logic-coder/test/golden/resolve_cases.json +36 -0
- package/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
- package/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
- package/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
- package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +352 -0
- package/skills/a2h-batch-ui-align/SKILL.md +6 -4
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +1 -1
- package/skills/a2h-batch-ui-align/references/cards/resources.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +22 -3
- package/skills/a2h-batch-ui-align/references/checker-rules.md +66 -3
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +45 -8
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -5
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +2 -2
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +4 -2
- package/skills/a2h-batch-ui-align/references/step5-convert.md +7 -5
- package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +6 -7
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +84 -7
- package/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +229 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1 -2
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +4 -5
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +88 -26
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +305 -12
- package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +231 -54
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +8 -9
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +18 -5
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +103 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +1 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +14 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +8 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +3 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +84 -19
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +11 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +5 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +66 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +119 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +81 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +123 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +2 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +6 -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_a11y.test.mjs +598 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +312 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +312 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +427 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +235 -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_scroll_padding_raster.test.mjs +262 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_safearea.test.mjs +742 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +91 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +86 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +567 -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/detect_paradigm.test.mjs +260 -0
- package/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +244 -0
- package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +420 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +31 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -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 +363 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1628 -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/image_probe.test.mjs +243 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +324 -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 +325 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +297 -0
- package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +48 -0
- package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +387 -0
- package/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
- package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +12 -14
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +29 -30
- 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 +168 -0
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +203 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -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 +411 -0
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -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-page-specgen/SKILL.md +136 -0
- package/skills/a2h-page-specgen/references/body-language.md +177 -0
- package/skills/a2h-page-specgen/references/evidence.md +70 -0
- package/skills/a2h-page-specgen/references/execution-model.md +255 -0
- package/skills/a2h-page-specgen/references/footprint-and-grouping.md +250 -0
- package/skills/a2h-page-specgen/references/gates.md +255 -0
- package/skills/a2h-page-specgen/references/page-inventory.md +173 -0
- package/skills/a2h-page-specgen/references/spec-template.md +207 -0
- package/skills/a2h-page-specgen/scripts/dispatch.mjs +209 -0
- package/skills/a2h-page-specgen/scripts/facts-build.mjs +1504 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +422 -0
- package/skills/a2h-page-specgen/scripts/footprint.mjs +1528 -0
- package/skills/a2h-page-specgen/scripts/gate.mjs +558 -0
- package/skills/a2h-page-specgen/scripts/interactions.mjs +137 -0
- package/skills/a2h-page-specgen/scripts/inventory.mjs +269 -0
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +255 -0
- package/skills/a2h-page-specgen/scripts/lib/deps-source.mjs +399 -0
- package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +137 -0
- package/skills/a2h-page-specgen/scripts/lib/footprint-roles.mjs +278 -0
- package/skills/a2h-page-specgen/scripts/lib/fsx.mjs +79 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +175 -0
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +355 -0
- package/skills/a2h-page-specgen/scripts/lib/prose.mjs +234 -0
- package/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +391 -0
- package/skills/a2h-page-specgen/scripts/lib/symbols.mjs +125 -0
- package/skills/a2h-page-specgen/scripts/lib/utg-io.mjs +110 -0
- package/skills/a2h-page-specgen/scripts/lib/waker-event-store.mjs +658 -0
- package/skills/a2h-page-specgen/scripts/prepare.mjs +492 -0
- package/skills/a2h-page-specgen/scripts/render.mjs +317 -0
- package/skills/a2h-page-specgen/scripts/report.mjs +7 -0
- package/skills/a2h-page-specgen/scripts/submission.mjs +532 -0
- package/skills/a2h-page-specgen/scripts/submit.mjs +79 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/README.md +77 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +590 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/cases.example.json +57 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +207 -0
- package/skills/a2h-page-specgen/scripts/test/dispatch.test.mjs +258 -0
- package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1164 -0
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +74 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Api.kt +20 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/BothAnnotations.kt +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Cache.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Comments.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Mmkv.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Models.kt +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Pair.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Prefs.kt +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Room.kt +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Sample.kt +43 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Templates.kt +34 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Timeouts.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/androidTest/Helper.kt +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/build.gradle.kts +16 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/en.js.txt +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/libs.versions.toml +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/package.json +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values/strings.xml +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-land/strings.xml +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-night/strings.xml +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-v21/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/test/Legacy.kt +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/weather.proto +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/AppPreferences.kt +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/SettingsViewModel.kt +16 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-dao/src/UserDao.kt +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/base/strings.xml +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/fil/strings.xml +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/arrays.xml +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/strings.xml +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/xml/prefs.xml +27 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Api.java +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Datastore.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Settings.java +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/forecast.js +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/store.js +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/BasePreferences.kt +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/Screen.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/UiPreferences.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-retrofit/src/AuthAPI.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/AndroidManifest.xml +20 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/feature/auth/navigation/ScreenRoute.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/pages.json +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/components/Widget.vue +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/detail/detail.vue +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/index/index.vue +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/store/userStore.js +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/uni_modules/uview-ui/components/u-thing.js +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp.mkdb.mjs +144 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +94 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/MainFragment.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyListeners.java +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/PlainActivity.java +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/fold-chain/utg.json +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/utg.json +34 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +758 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-roles.test.mjs +172 -0
- package/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +54 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +222 -0
- package/skills/a2h-page-specgen/scripts/test/helpers.mjs +54 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +171 -0
- package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +301 -0
- package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +45 -0
- package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +139 -0
- package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +774 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +464 -0
- package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1011 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +120 -0
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +68 -0
- package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +390 -0
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +167 -0
- package/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +323 -0
- package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +546 -0
- package/skills/a2h-page-specgen/scripts/test/render.test.mjs +503 -0
- package/skills/a2h-page-specgen/scripts/test/source-text.test.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +701 -0
- package/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
- package/skills/a2h-page-specgen/scripts/test/waker-event-store.test.mjs +1365 -0
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1765 -0
- package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +1979 -0
- package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +313 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +1234 -0
- package/skills/a2h-page-specgen/scripts/watchdog.mjs +298 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +49 -51
- 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-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +79 -78
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +51 -12
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +24 -6
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +3 -2
- package/skills/a2h-spec-design-pipeline/references/initialization.md +15 -4
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +82 -41
- package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +61 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +19 -10
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +267 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +61 -8
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +62 -13
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +8 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +8 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +55 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +60 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/HttpExtraDataEmptyStringCheck.js +488 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +11 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +17 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +12 -38
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +40 -5
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +18 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +74 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +2 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +128 -5
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +98 -35
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +218 -37
- package/skills/a2h-spec-design-pipeline/scripts/lib/shared_classes.ts +113 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/shared_docs.ts +202 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/wiring.ts +58 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +6 -7
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +3 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +348 -0
- package/skills/a2h-spec-design-pipeline/scripts/scan_shared.ts +642 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +15 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +7 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +104 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +24 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +394 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +24 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +14 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +163 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +15 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +14 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +350 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_scan_shared.ts +996 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_classes.ts +80 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_docs.ts +205 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +121 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_e2e.ts +85 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_validate_shared_manifest.ts +720 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_wiring.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/validate_shared_manifest.ts +566 -0
- package/skills/a2h-spec-generate/SKILL.md +87 -21
- package/skills/a2h-spec-generate/references/batch-mode.md +78 -17
- package/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +7 -0
- package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
- package/skills/a2h-spec-generate/references/synthesis-rules.md +4 -2
- package/skills/a2h-spec-generate/references/worker-rules.md +6 -3
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +4 -5
- package/skills/a2h-spec-generate/scripts/check_spec.ts +145 -14
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +261 -19
- package/skills/a2h-spec-generate/scripts/dispatch-watch.mjs +1168 -0
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +25 -46
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +26 -27
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +3 -6
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +31 -32
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +2 -3
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +15 -26
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +102 -81
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +39 -19
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +12 -13
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +35 -196
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +3 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +22 -96
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +3 -4
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +1 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +74 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +51 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +42 -111
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +1 -20
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1 -2
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +3 -4
- 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/fixtures/fusion-run.ts +243 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/zip.ts +63 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +650 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-seed.test.ts +195 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +347 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1948 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-library-evidence.test.ts +239 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +277 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +844 -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 +1253 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -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 +411 -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 +300 -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/test/zip.test.ts +61 -0
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +879 -0
- package/skills/a2h-spec-generate/test/check-spec.test.ts +430 -0
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +811 -0
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
- package/skills/a2h-spec-generate/test/dispatch-watch.test.mjs +606 -0
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +230 -0
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -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/prepare-facts.test.mjs +41 -0
- package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +182 -0
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
- package/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
- package/skills/a2h-spec-generate/test/report.test.mjs +47 -0
- package/skills/a2h-utg-explorer/references/architecture.md +4 -0
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +64 -80
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +1 -2
- package/skills/a2h-utg-explorer/scripts/recover.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +5 -3
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +244 -0
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
- package/skills/a2h-utg-explorer/scripts/tests/content_wait.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 +231 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +160 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_identity.test.mjs +77 -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 +137 -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/fresh_state_plan.test.mjs +78 -0
- package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
- package/skills/a2h-utg-explorer/scripts/tests/holds_without_data_parity.test.mjs +26 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +492 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +199 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_failure.test.mjs +40 -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 +327 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
- package/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -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 +280 -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 +454 -0
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +336 -0
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +142 -0
- package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
- package/skills/a2h-utg-explorer/scripts/tests/string_tables_twin_ties.test.mjs +83 -0
- package/skills/a2h-utg-explorer/scripts/tests/tar_fixture.mjs +12 -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/adapters.mjs +13 -3
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +107 -65
- package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +155 -0
- package/skills/a2h-utg-static/scripts/assemble.mjs +28 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +19 -20
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +102 -2
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +2 -3
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +2 -3
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +1 -2
- package/skills/a2h-utg-static/scripts/route_interceptor.mjs +21 -7
- package/skills/a2h-utg-static/scripts/static_prior.mjs +26 -29
- package/skills/a2h-utg-static/scripts/tests/test_activity_gates.mjs +84 -0
- package/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +29 -1
- package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-app-migrate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-arch-generate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +0 -5
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +0 -54
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +0 -38
- package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-resource-convert/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +0 -70
- package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-generate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +0 -54
- package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-utg-static/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-utg-static/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-utg-static/scripts/tests/test_i18n_term.mjs +0 -155
|
@@ -0,0 +1,1412 @@
|
|
|
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, _overlayLeadTitleCandidates, OVERLAY_KINDS, androidUnescape, androidValue, decodeAndroidString,
|
|
9
|
+
* panelHost, observationMatchesStatic
|
|
10
|
+
*
|
|
11
|
+
* Python sets become JS Sets in insertion order. Where Python iterated a set of strings to
|
|
12
|
+
* build an ordered result (only `_toolbarTitleCandidates`, whose order Python leaves to the
|
|
13
|
+
* per-process string hash), the JS order is the node order of the capture.
|
|
14
|
+
*/
|
|
15
|
+
import {
|
|
16
|
+
get, truthy, pyStr, nfkc, pyStrip, pyRstrip, sortedStr, sortedBy, pyMax, pyRe, reEscape,
|
|
17
|
+
pathStr, pJoin, pResolve, pIsFile, pIsDir, pSuffix, pName, pParent, pParents, pStem, pGlob,
|
|
18
|
+
pOrder, pKey, pRelativeParts, pIsRelativeTo, etParse, XmlParseError, readText, dset, reFindall,
|
|
19
|
+
} from './_py.mjs';
|
|
20
|
+
|
|
21
|
+
export const ANDROID = '{http://schemas.android.com/apk/res/android}';
|
|
22
|
+
|
|
23
|
+
const WS_RUN = pyRe('\\s+', 'g');
|
|
24
|
+
const S = (v) => pyStr(v);
|
|
25
|
+
const g = (o, k, d = null) => get(o, k, d);
|
|
26
|
+
const vis = (n) => truthy(g(n, 'visible', true));
|
|
27
|
+
const tail = (rid) => S(rid).split('/').pop();
|
|
28
|
+
const endsWithAny = (s, xs) => xs.some((x) => s.endsWith(x));
|
|
29
|
+
const setOf = (it) => new Set(it);
|
|
30
|
+
const inter = (a, b) => new Set([...a].filter((x) => b.has(x)));
|
|
31
|
+
const inRange = (i, nodes) => i !== null && i !== undefined && i >= 0 && i < nodes.length;
|
|
32
|
+
const parentOf = (n) => { const p = g(n, 'parent_index'); return p === undefined ? null : p; };
|
|
33
|
+
|
|
34
|
+
/** A text input (EditText and subclasses, AutoCompleteTextView, SearchView's SearchAutoComplete): its text is the user's. */
|
|
35
|
+
export const isInputNode = (n) => /(?:EditText|AutoCompleteTextView|SearchAutoComplete)$/.test(S(g(n, 'class', '')));
|
|
36
|
+
|
|
37
|
+
/** normalized(text): NFKC, whitespace runs -> ' ', strip, then rstrip('.…'). */
|
|
38
|
+
export function normalized(text) {
|
|
39
|
+
const s = S(truthy(text) ? text : '');
|
|
40
|
+
return pyRstrip(pyStrip(nfkc(s).replace(WS_RUN, ' ')), '.…');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const isBuildPath = (p, project) => (pRelativeParts(p, project) ?? []).includes('build');
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* aapt's backslash escapes in an (already entity-decoded) strings.xml value: `\n`, `\t`, `\'`, `\"`,
|
|
47
|
+
* `\@`, `\uXXXX`. Only `\'` was undone before, so a title such as `Hello,\nWelcome to Qing Mall` kept a literal
|
|
48
|
+
* backslash-n and never equalled the rendered two-line text.
|
|
49
|
+
*/
|
|
50
|
+
export function androidUnescape(value) {
|
|
51
|
+
return S(value).replace(/\\(u[0-9a-fA-F]{4}|[\s\S])/g, (m, c) => {
|
|
52
|
+
if (c.length === 5) { return String.fromCharCode(parseInt(c.slice(1), 16)); }
|
|
53
|
+
return c === 'n' ? '\n' : c === 't' ? '\t' : c;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* aapt's one pass over an (already entity-decoded, markup-free) strings.xml value: an unescaped
|
|
59
|
+
* `"` toggles a quoted run and is dropped (`Tap "OK" now` shows `Tap OK now`); outside quotes
|
|
60
|
+
* whitespace runs collapse to one space and the ends are trimmed; a backslash escape is always
|
|
61
|
+
* literal (`"C:\\"` shows `C:\`). Same rule as a2h-utg-static label_resolve.aaptText (a test
|
|
62
|
+
* compares the two), so the explorer catalog and the static UTG read every value alike.
|
|
63
|
+
*/
|
|
64
|
+
export function androidValue(value) {
|
|
65
|
+
const s = S(value);
|
|
66
|
+
let out = ''; let quoted = false; let space = false;
|
|
67
|
+
for (let i = 0; i < s.length; i++) {
|
|
68
|
+
const c = s[i];
|
|
69
|
+
if (c === '\\' && i + 1 < s.length) {
|
|
70
|
+
const u = /^u([0-9a-fA-F]{4})/.exec(s.slice(i + 1, i + 6));
|
|
71
|
+
if (u) { out += String.fromCharCode(parseInt(u[1], 16)); i += 5; }
|
|
72
|
+
else { const d = s[i + 1]; out += d === 'n' ? '\n' : d === 't' ? '\t' : d; i += 1; }
|
|
73
|
+
space = false;
|
|
74
|
+
} else if (c === '"') {
|
|
75
|
+
quoted = !quoted;
|
|
76
|
+
} else if (!quoted && /\s/.test(c)) {
|
|
77
|
+
if (out && !space) { out += ' '; space = true; }
|
|
78
|
+
} else {
|
|
79
|
+
out += c; space = false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return space ? out.slice(0, -1) : out;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const _XML_ENTITY = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'" };
|
|
86
|
+
|
|
87
|
+
/** A raw strings.xml value (CDATA, inline markup, entities) as aapt renders it. */
|
|
88
|
+
export function decodeAndroidString(raw) {
|
|
89
|
+
// one pass: CDATA content is literal text, untouched by the markup strip and entity decoding
|
|
90
|
+
const s = S(raw).replace(/<!\[CDATA\[([\s\S]*?)\]\]>|<[^>]*>|&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g, (m, cdata, e) => {
|
|
91
|
+
if (cdata !== undefined) { return cdata; }
|
|
92
|
+
if (e === undefined) { return ''; }
|
|
93
|
+
if (e[0] !== '#') { return _XML_ENTITY[e]; }
|
|
94
|
+
const cp = e[1] === 'x' ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
|
|
95
|
+
return Number.isFinite(cp) && cp >= 0 && cp <= 0x10ffff ? String.fromCodePoint(cp) : m;
|
|
96
|
+
});
|
|
97
|
+
return androidValue(s);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** build_catalog(graph, project=None, locale='en'). */
|
|
101
|
+
const _STRING_ROW = /<string\s+name="([^"]+)"[^>]*>([\s\S]*?)<\/string>/g;
|
|
102
|
+
|
|
103
|
+
/** Map(main-source-set value -> [values the same key takes in another source set]), e.g. a debug
|
|
104
|
+
* build type's `app_name`. Only the default-language `values` dirs: locales are buildCatalog's job. */
|
|
105
|
+
export function _variantOverrides(project) {
|
|
106
|
+
const main = new Map(); const other = new Map();
|
|
107
|
+
for (const file of pGlob(project, '**/src/*/res/values/*.xml')) {
|
|
108
|
+
if (pRelativeParts(file, project).includes('build')) { continue; }
|
|
109
|
+
const set = pName(pParent(pParent(pParent(file))));
|
|
110
|
+
let text;
|
|
111
|
+
try { text = readText(file); } catch { continue; }
|
|
112
|
+
for (const m of text.matchAll(_STRING_ROW)) {
|
|
113
|
+
const v = decodeAndroidString(m[2]).trim();
|
|
114
|
+
if (!v) { continue; }
|
|
115
|
+
const tbl = set === 'main' ? main : other;
|
|
116
|
+
if (!tbl.has(m[1])) { tbl.set(m[1], new Set()); }
|
|
117
|
+
tbl.get(m[1]).add(v);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const out = new Map();
|
|
121
|
+
for (const [k, alts] of other) {
|
|
122
|
+
for (const mv of main.get(k) ?? []) {
|
|
123
|
+
for (const a of alts) {
|
|
124
|
+
if (a === mv) { continue; }
|
|
125
|
+
if (!out.has(mv)) { out.set(mv, []); }
|
|
126
|
+
if (!out.get(mv).includes(a)) { out.get(mv).push(a); }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return out;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function buildCatalog(graph, project = null, locale = 'en') {
|
|
134
|
+
const nodes = g(graph, 'nodes', []);
|
|
135
|
+
project = truthy(project) ? pResolve(project) : null;
|
|
136
|
+
const stringCache = new Map(); const xmlCache = new Map();
|
|
137
|
+
|
|
138
|
+
const resources = (res) => {
|
|
139
|
+
// Project-wide string lookup (the XML's own `res` first so a local override wins).
|
|
140
|
+
const key = project ? 'project' : pKey(res);
|
|
141
|
+
if (stringCache.has(key)) { return stringCache.get(key); }
|
|
142
|
+
const strings = {};
|
|
143
|
+
const lang = locale.replace(/_/g, '-').split('-')[0];
|
|
144
|
+
const variants = ['values', 'values-' + lang, 'values-' + locale.replace(/-/g, '-r')];
|
|
145
|
+
if (lang === 'zh') { variants.push(!locale.includes('TW') ? 'values-zh-rCN' : 'values-zh-rTW'); }
|
|
146
|
+
let resDirs = [res];
|
|
147
|
+
if (project) {
|
|
148
|
+
resDirs = resDirs.concat(sortedBy(pGlob(project, '**/src/main/res'), pOrder)
|
|
149
|
+
.filter((d) => !isBuildPath(d, project) && pKey(d) !== pKey(res)));
|
|
150
|
+
}
|
|
151
|
+
for (const variant of [...new Set(variants)]) {
|
|
152
|
+
for (const rd of [...resDirs].reverse()) {
|
|
153
|
+
for (const file of sortedBy(pGlob(pJoin(rd, variant), '*.xml'), pOrder)) {
|
|
154
|
+
let root;
|
|
155
|
+
try { root = etParse(file); } catch (e) { if (e instanceof XmlParseError) { continue; } throw e; }
|
|
156
|
+
for (const el of root) {
|
|
157
|
+
// a nameless <string> lands under None in Python: unreachable by any str key
|
|
158
|
+
if (el.tag === 'string' && el.get('name') !== null) { dset(strings, el.get('name'), androidValue([...el.itertext()].join(''))); }
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
stringCache.set(key, strings);
|
|
164
|
+
return strings;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const resolve = (value, res) => {
|
|
168
|
+
if (!truthy(value)) { return ''; }
|
|
169
|
+
if (value.startsWith('@string/')) { return g(resources(res), value.split('/').slice(1).join('/'), ''); }
|
|
170
|
+
return !value.startsWith('@') ? value : '';
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const parse = (p) => {
|
|
174
|
+
const k = pKey(p);
|
|
175
|
+
if (!xmlCache.has(k)) {
|
|
176
|
+
try { xmlCache.set(k, etParse(p)); } catch (e) {
|
|
177
|
+
if (e instanceof XmlParseError || (e && e.code)) { xmlCache.set(k, null); } else { throw e; }
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return xmlCache.get(k);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const rows = (el, res) => {
|
|
184
|
+
const result = [];
|
|
185
|
+
for (const child of el) {
|
|
186
|
+
if (child.tag.endsWith('PreferenceCategory')) { result.push(...rows(child, res)); }
|
|
187
|
+
else {
|
|
188
|
+
const title = resolve(child.get(ANDROID + 'title'), res);
|
|
189
|
+
if (title) { result.push(title); }
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return sortedStr(new Set(result));
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const catalog = {};
|
|
196
|
+
for (const n of nodes) {
|
|
197
|
+
const ident = n.id;
|
|
198
|
+
const expected = g(n, 'expected') || {};
|
|
199
|
+
let titles = truthy(g(expected, 'title_any')) ? g(expected, 'title_any') : [];
|
|
200
|
+
if (typeof titles === 'string') { titles = [titles]; }
|
|
201
|
+
let component = truthy(g(expected, 'component')) ? g(expected, 'component') : g(expected, 'activity');
|
|
202
|
+
if (!truthy(component) && ['activity', 'host-activity'].includes(g(n, 'kind'))) { component = g(n, 'fqn'); }
|
|
203
|
+
const item = { id: ident, kind: g(n, 'kind'), label: g(n, 'label', ident), titles: [...titles], row_titles: [],
|
|
204
|
+
component: truthy(g(expected, 'component')) ? g(expected, 'component') : g(expected, 'activity'),
|
|
205
|
+
basis: [], entry_labels: [] };
|
|
206
|
+
item.component = component;
|
|
207
|
+
const links = g(graph, 'links', g(graph, 'edges', []));
|
|
208
|
+
item.hosts_static_pages = links.some((e) => g(e, 'source') === ident && g(e, 'target') !== ident
|
|
209
|
+
&& !S(g(e, 'target', '')).startsWith('activity:'));
|
|
210
|
+
// Static openers: the pages with an edge into this one (used to tell layout twins apart).
|
|
211
|
+
item.opened_from = sortedStr(new Set(links.filter((e) => g(e, 'target') === ident && truthy(g(e, 'source'))
|
|
212
|
+
&& g(e, 'source') !== ident).map((e) => S(g(e, 'source')))));
|
|
213
|
+
item.default_children = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident && g(e, 'target') !== ident
|
|
214
|
+
&& !S(g(e, 'target', '')).startsWith('activity:')
|
|
215
|
+
&& (g(g(e, 'args') || {}, 'action') === 'default' || g(e, 'mechanism') === 'fragment-embed')
|
|
216
|
+
&& !truthy(g(e, 'guard') || {})).map((e) => g(e, 'target'))));
|
|
217
|
+
if (g(n, 'kind') === 'dialog' && truthy(g(n, 'label')) && !/^[A-Za-z][A-Za-z0-9_]*$/.test(n.label)) {
|
|
218
|
+
item.titles.push(n.label);
|
|
219
|
+
}
|
|
220
|
+
const location = S(g(n, 'declared_at', '')).replace(/:\d+$/, '');
|
|
221
|
+
const file = project && location ? pResolve(pJoin(project, location)) : null;
|
|
222
|
+
if (file && pIsRelativeTo(file, project) && pIsFile(file)) {
|
|
223
|
+
if (pSuffix(file) === '.xml' && pName(pParent(file)) === 'xml') {
|
|
224
|
+
const root = parse(file);
|
|
225
|
+
const res = pParent(pParent(file));
|
|
226
|
+
const key = ident.split('/').pop().split(':').pop();
|
|
227
|
+
const candidates = root === null ? [] : [...root.iter()].filter((e) => e.get(ANDROID + 'key') === key);
|
|
228
|
+
if (!candidates.length) {
|
|
229
|
+
const comments = reFindall(pyRe('<!--(.*?)-->', 's'), readText(file));
|
|
230
|
+
const kre = pyRe('android:key\\s*=\\s*["\']' + reEscape(key) + '["\']');
|
|
231
|
+
if (comments.some((c) => kre.test(c))) {
|
|
232
|
+
item.source_gap = 'preference-defined-only-in-XML-comment';
|
|
233
|
+
item.basis.push(pathStr(file) + '#' + key);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (candidates.length === 1) {
|
|
237
|
+
const element = candidates[0];
|
|
238
|
+
const entry = resolve(element.get(ANDROID + 'title'), res);
|
|
239
|
+
const title = resolve(element.get(ANDROID + 'dialogTitle'), res) || entry;
|
|
240
|
+
item.entry_labels = entry ? [entry] : [];
|
|
241
|
+
item.titles = title ? [title] : item.titles;
|
|
242
|
+
item.basis.push(pathStr(file) + '#' + key);
|
|
243
|
+
item.preference_type = element.tag.split('.').pop();
|
|
244
|
+
if (element.tag.endsWith('PreferenceScreen')) {
|
|
245
|
+
item.row_titles = rows(element, res);
|
|
246
|
+
item.row_source = 'preference-xml';
|
|
247
|
+
}
|
|
248
|
+
if (!title) { dynamicTitle(item, key, res, project, resources); }
|
|
249
|
+
}
|
|
250
|
+
} else if (['.java', '.kt'].includes(pSuffix(file)) && ident.split(':').pop() === pStem(file)) {
|
|
251
|
+
const text = readText(file);
|
|
252
|
+
const refs = new Set(reFindall(pyRe('(?:add|set)PreferencesFromResource\\(\\s*R\\.xml\\.(\\w+)'), text));
|
|
253
|
+
if (refs.size === 1) {
|
|
254
|
+
const name = [...refs][0] + '.xml';
|
|
255
|
+
const roots = pParents(file).map((p) => pJoin(p, 'res')).filter((p) => pIsDir(p)).slice(0, 1);
|
|
256
|
+
let found = roots.filter((r) => pIsFile(pJoin(r, 'xml', name)));
|
|
257
|
+
if (!found.length) {
|
|
258
|
+
found = pGlob(project, '**/src/main/res/xml/' + name).filter((x) => !isBuildPath(x, project))
|
|
259
|
+
.map((x) => pParent(pParent(x)));
|
|
260
|
+
}
|
|
261
|
+
if (found.length === 1) {
|
|
262
|
+
const resource = found[0];
|
|
263
|
+
const xml = pJoin(resource, 'xml', name);
|
|
264
|
+
const element = parse(xml);
|
|
265
|
+
if (element !== null) {
|
|
266
|
+
item.row_titles = rows(element, resource);
|
|
267
|
+
item.row_source = 'preference-xml';
|
|
268
|
+
item.basis.push(pathStr(xml) + '#root');
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (g(n, 'kind') === 'activity' && !truthy(item.component) && ident.startsWith('activity:')) {
|
|
274
|
+
for (const manifest of pGlob(project, '**/src/main/AndroidManifest.xml')) {
|
|
275
|
+
const root = parse(manifest);
|
|
276
|
+
if (root === null) { continue; }
|
|
277
|
+
for (const el of root.iter('activity')) {
|
|
278
|
+
const name = el.get(ANDROID + 'name', '');
|
|
279
|
+
if (name.split('.').pop() === ident.split(':').pop()) {
|
|
280
|
+
const pkg = root.get('package', '');
|
|
281
|
+
item.component = name.startsWith('.') ? pkg + name : (!name.includes('.') ? pkg + '.' + name : name);
|
|
282
|
+
item.basis.push(pathStr(manifest));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (g(n, 'kind') === 'menu') {
|
|
289
|
+
item.row_titles = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident
|
|
290
|
+
&& truthy(g(g(e, 'args') || {}, 'label')) && g(g(e, 'args') || {}, 'label_key') !== 'widget:')
|
|
291
|
+
.map((e) => S(g(g(e, 'args') || {}, 'label')))));
|
|
292
|
+
if (project) {
|
|
293
|
+
const resName = ident.slice(ident.indexOf(':') + 1).split('@')[0];
|
|
294
|
+
const files = pGlob(project, '**/src/main/res/menu/' + resName + '.xml').filter((x) => !isBuildPath(x, project));
|
|
295
|
+
if (files.length === 1) {
|
|
296
|
+
const root = parse(files[0]);
|
|
297
|
+
const resdir = pParent(pParent(files[0]));
|
|
298
|
+
if (root !== null) {
|
|
299
|
+
const extra = new Set();
|
|
300
|
+
for (const el of root.iter('item')) {
|
|
301
|
+
const show = el.get('{http://schemas.android.com/apk/res-auto}showAsAction', '') || el.get(ANDROID + 'showAsAction', '');
|
|
302
|
+
if (show.includes('always') || show.includes('ifRoom')) { continue; }
|
|
303
|
+
const t = resolve(el.get(ANDROID + 'title'), resdir);
|
|
304
|
+
if (t) { extra.add(t); }
|
|
305
|
+
}
|
|
306
|
+
item.row_titles = sortedStr(new Set([...item.row_titles, ...extra]));
|
|
307
|
+
item.basis.push(pathStr(files[0]));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
item.titles = item.titles.filter((t) => !t.endsWith('(overflow)'));
|
|
312
|
+
}
|
|
313
|
+
item.titles = sortedStr(new Set(item.titles.filter((t) => truthy(t))));
|
|
314
|
+
const hints = truthy(g(expected, 'hint_any')) ? g(expected, 'hint_any') : [];
|
|
315
|
+
item.hint_titles = sortedStr(new Set(typeof hints === 'string' ? [hints] : hints));
|
|
316
|
+
item.widget_ids = ident.includes('@') ? [] : sortedStr(new Set([
|
|
317
|
+
...(truthy(g(n, 'layout_ids', [])) ? g(n, 'layout_ids', []) : []).map(S),
|
|
318
|
+
...(truthy(g(n, 'widgets', [])) ? g(n, 'widgets', []) : [])
|
|
319
|
+
.filter((w) => w && typeof w === 'object' && !Array.isArray(w) && truthy(g(w, 'view_id'))).map((w) => S(w.view_id)),
|
|
320
|
+
]));
|
|
321
|
+
const wid = new Set(item.widget_ids);
|
|
322
|
+
item.hidden_ids = sortedStr(new Set((truthy(g(n, 'layout_hidden_ids')) ? n.layout_hidden_ids : []).filter((x) => wid.has(x))));
|
|
323
|
+
// Fixed texts the page's own source renders (a2h-utg-static compose_body_text); kept below
|
|
324
|
+
// only when no other page claims them.
|
|
325
|
+
const bodyText = ident.includes('@') ? [] : (truthy(g(n, 'body_text')) ? n.body_text : []);
|
|
326
|
+
const isPrefix = (t) => typeof t === 'object' && t !== null && truthy(g(t, 'prefix'));
|
|
327
|
+
item.body_titles = sortedStr(new Set(bodyText.filter((t) => !isPrefix(t))
|
|
328
|
+
.map((t) => normalized(typeof t === 'string' ? t : g(t, 'text', ''))).filter((t) => truthy(t))));
|
|
329
|
+
// Fixed leads of template strings (`"From ${x}"`): matched as the start of a rendered text.
|
|
330
|
+
item.body_prefixes = sortedStr(new Set(bodyText.filter(isPrefix).map((t) => normalized(g(t, 'text', ''))).filter((t) => truthy(t))));
|
|
331
|
+
// A folded host Activity (assemble._foldUilessHosts) still names the component that shows this page.
|
|
332
|
+
const host = g(n, 'host_activity');
|
|
333
|
+
if (!truthy(item.component) && truthy(g(host, 'fqn'))) { item.component = host.fqn; }
|
|
334
|
+
item.transient = truthy(g(n, 'transient'));
|
|
335
|
+
// An in-page state (a mode tab: calendar day/week/month/year) is told apart only by content
|
|
336
|
+
// its host shows in that state; `state_anchors` names it ({all: [selector], none: [selector]}).
|
|
337
|
+
if (STATE_KINDS.includes(item.kind)) {
|
|
338
|
+
item.host_node = truthy(g(n, 'host_node')) ? n.host_node : stateHost(ident);
|
|
339
|
+
const rule = _stateRule(g(n, 'state_anchors'), 'static');
|
|
340
|
+
if (rule) { item.state_rules = [rule]; }
|
|
341
|
+
}
|
|
342
|
+
item.auto_targets = sortedStr(new Set(links.filter((e) => g(e, 'source') === ident && g(e, 'target') !== ident
|
|
343
|
+
&& (['lifecycle', 'startDestination'].includes(S(g(e, 'trigger', '')).split('@')[0])
|
|
344
|
+
|| g(g(e, 'args') || {}, 'action') === 'default')).map((e) => S(g(e, 'target')))));
|
|
345
|
+
dset(catalog, ident, item);
|
|
346
|
+
}
|
|
347
|
+
// A static title is the MAIN source set's string; the installed build may override that resource in a
|
|
348
|
+
// build-type / flavor source set (`src/debug/res/values/strings.xml` renaming `app_name` to "AppDebug").
|
|
349
|
+
// The overriding value is what the device renders, so it joins the titles: without it a page titled
|
|
350
|
+
// by such a string was never recognised on the debug build every campaign installs.
|
|
351
|
+
if (project) {
|
|
352
|
+
const variants = _variantOverrides(project);
|
|
353
|
+
if (variants.size) {
|
|
354
|
+
for (const item of Object.values(catalog)) {
|
|
355
|
+
for (const t of [...item.titles]) {
|
|
356
|
+
for (const alt of variants.get(t) ?? []) { if (!item.titles.includes(alt)) { item.titles.push(alt); } }
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
// Shared titles: a title / hint title / own body text that 2+ screens render (twins built on one
|
|
362
|
+
// scaffold: every feature's "Bookmarks" page). Not an anchor by itself -- resolvePage offers the
|
|
363
|
+
// sharers as `shared-title-twin` candidates only when nothing unique matched, and
|
|
364
|
+
// resolveTwinByOpener settles them by the verified page shown before. Computed before the
|
|
365
|
+
// unique-claim filter below, which it leaves unchanged.
|
|
366
|
+
// A bar title is matched against shared TITLES only (a page's body button "Bookmarks" that opens the
|
|
367
|
+
// twin is not that page's title); a search placeholder also against shared body texts.
|
|
368
|
+
const sharersOf = (textsOf) => {
|
|
369
|
+
const m = new Map();
|
|
370
|
+
for (const [ident, item] of Object.entries(catalog)) {
|
|
371
|
+
if (!_SCREEN_KINDS.includes(item.kind)) { continue; }
|
|
372
|
+
for (const t of new Set(textsOf(item))) {
|
|
373
|
+
if (!truthy(t)) { continue; }
|
|
374
|
+
if (!m.has(t)) { m.set(t, new Set()); }
|
|
375
|
+
m.get(t).add(ident);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return (ident) => sortedStr([...m].filter(([, ids]) => ids.size >= 2 && ids.has(ident)).map(([t]) => t));
|
|
379
|
+
};
|
|
380
|
+
const titleShare = sharersOf((it) => [...it.titles, ...it.hint_titles].map(normalized));
|
|
381
|
+
const textShare = sharersOf((it) => [...it.titles, ...it.hint_titles].map(normalized).concat(it.body_titles));
|
|
382
|
+
for (const [ident, item] of Object.entries(catalog)) {
|
|
383
|
+
item.shared_titles = titleShare(ident);
|
|
384
|
+
item.shared_texts = textShare(ident);
|
|
385
|
+
}
|
|
386
|
+
// Overlay titles no screen renders (as title, row, hint or own body text, before the unique-claim
|
|
387
|
+
// filter below): a sheet / dialog whose window shows such a title first is that overlay
|
|
388
|
+
// (_overlayLeadTitleCandidates). A title a screen also renders (the opener's "Get Coupons" button)
|
|
389
|
+
// is no proof of the overlay.
|
|
390
|
+
const screenTexts = new Map();
|
|
391
|
+
for (const [ident, item] of Object.entries(catalog)) {
|
|
392
|
+
if (OVERLAY_KINDS.includes(item.kind)) { continue; }
|
|
393
|
+
for (const t of [...item.titles, ...item.hint_titles, ...item.row_titles].map(normalized).concat(item.body_titles)) {
|
|
394
|
+
if (!screenTexts.has(t)) { screenTexts.set(t, new Set()); }
|
|
395
|
+
screenTexts.get(t).add(ident);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
// An overlay's own body text leads its window too (ThemeModeModal: title "Night Mode" is a Text, its
|
|
399
|
+
// `title_any` holds the options). A lead a screen also renders -- the opener's row, coolmall
|
|
400
|
+
// Settings "Theme Color" / "Night Mode" -- goes to `lead_shared` with those screens: it names the
|
|
401
|
+
// overlay only in a dump that shows none of their other texts (the overlay's own window).
|
|
402
|
+
for (const item of Object.values(catalog)) {
|
|
403
|
+
if (!OVERLAY_KINDS.includes(item.kind)) { continue; }
|
|
404
|
+
const leads = new Set([...item.titles.map(normalized), ...item.body_titles].filter((t) => [...t].length >= 2));
|
|
405
|
+
item.lead_titles = sortedStr([...leads].filter((t) => !screenTexts.has(t)));
|
|
406
|
+
item.lead_shared = Object.fromEntries(sortedStr([...leads].filter((t) => screenTexts.has(t)))
|
|
407
|
+
.map((t) => [t, sortedStr(screenTexts.get(t))]));
|
|
408
|
+
}
|
|
409
|
+
// A body text is an anchor only for its single claimant, and never one that is some page's title.
|
|
410
|
+
const claims = new Map();
|
|
411
|
+
for (const item of Object.values(catalog)) {
|
|
412
|
+
for (const t of new Set([...item.body_titles, ...item.titles.map(normalized), ...item.row_titles.map(normalized)])) {
|
|
413
|
+
claims.set(t, (claims.get(t) ?? 0) + 1);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
for (const item of Object.values(catalog)) {
|
|
417
|
+
item.body_titles = item.body_titles.filter((t) => claims.get(t) === 1 && !item.titles.map(normalized).includes(t));
|
|
418
|
+
}
|
|
419
|
+
// A prefix is an anchor only when no text or prefix of another page starts with it.
|
|
420
|
+
const allTexts = Object.entries(catalog).map(([id, it]) => [id, [...it.body_titles, ...it.titles.map(normalized),
|
|
421
|
+
...it.row_titles.map(normalized), ...it.body_prefixes]]);
|
|
422
|
+
for (const [ident, item] of Object.entries(catalog)) {
|
|
423
|
+
item.body_prefixes = item.body_prefixes.filter((p) => !allTexts.some(([id, ts]) => id !== ident && ts.some((t) => t.startsWith(p) || p.startsWith(t))));
|
|
424
|
+
}
|
|
425
|
+
return catalog;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** Fewest body anchors that identify a page: two, or one of at least this many characters. */
|
|
429
|
+
export const BODY_ANCHOR_MIN_CHARS = 4;
|
|
430
|
+
/** Shared source texts of the same page that must be on screen to back one short own text. */
|
|
431
|
+
export const BODY_CORROBORATION = 2;
|
|
432
|
+
|
|
433
|
+
/** Catalog kinds shown in a window of their own over a page. */
|
|
434
|
+
export const OVERLAY_KINDS = ['dialog', 'sheet', 'menu'];
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Overlays whose catalog `lead_titles` holds the dump's first visible text. A Compose bottom sheet
|
|
438
|
+
* (ModalBottomSheet) or dialog is its own window: the dump is the overlay alone, title first, and has
|
|
439
|
+
* no `alertTitle` / `dialog_title` id for the modal branch to read. Measured (coolmall): the goods
|
|
440
|
+
* page's coupon sheet showed "Get Coupons" first, matched no rule, and its 5 captures stayed unmapped.
|
|
441
|
+
* Only the FIRST text counts: an option row (ThemeModeModal's "Dark Mode") a settings page may also
|
|
442
|
+
* show as its current value is never the lead.
|
|
443
|
+
*/
|
|
444
|
+
export function _overlayLeadTitleCandidates(nodes, catalog, observation) {
|
|
445
|
+
const first = nodes.find((n) => vis(n) && truthy(g(n, 'text')) && !isInputNode(n));
|
|
446
|
+
if (!first) { return []; }
|
|
447
|
+
const lead = normalized(g(first, 'text'));
|
|
448
|
+
const shown = new Set(nodes.filter((n) => vis(n)).flatMap((n) => [g(n, 'text'), g(n, 'content_desc')])
|
|
449
|
+
.filter((t) => truthy(t)).map(normalized));
|
|
450
|
+
const screenShown = (sid) => {
|
|
451
|
+
const p = g(catalog, sid, {});
|
|
452
|
+
return [...g(p, 'titles', []), ...g(p, 'hint_titles', []), ...g(p, 'row_titles', [])].map(normalized)
|
|
453
|
+
.concat(g(p, 'body_titles', [])).some((t) => t !== lead && shown.has(t));
|
|
454
|
+
};
|
|
455
|
+
const out = [];
|
|
456
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
457
|
+
if (!OVERLAY_KINDS.includes(g(page, 'kind'))) { continue; }
|
|
458
|
+
const owners = g(g(page, 'lead_shared', {}) ?? {}, lead);
|
|
459
|
+
const own = (g(page, 'lead_titles', []) || []).includes(lead);
|
|
460
|
+
if (!own && !(Array.isArray(owners) && owners.length && !owners.some(screenShown))) { continue; }
|
|
461
|
+
if (_hostCompatible(page, catalog, observation)) {
|
|
462
|
+
out.push({ static_id: ident, reason: own ? 'overlay-lead-title' : 'overlay-lead-title-alone', anchors: [lead] });
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return out;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* _body_text_candidates(nodes, catalog, observation): pages whose own fixed source texts are on
|
|
470
|
+
* screen. The page with the most visible anchors wins; a tie is ambiguous.
|
|
471
|
+
*/
|
|
472
|
+
export function _bodyTextCandidates(nodes, catalog, observation, tabBar = null) {
|
|
473
|
+
const shown = new Set();
|
|
474
|
+
tabBar ??= _composeTabBarNodes(nodes, catalog); // resolvePage passes the set it already built
|
|
475
|
+
for (const n of nodes) {
|
|
476
|
+
if (!vis(n) || tabBar.has(n)) { continue; }
|
|
477
|
+
for (const k of ['text', 'content_desc']) { if (truthy(g(n, k))) { shown.add(normalized(n[k])); } }
|
|
478
|
+
}
|
|
479
|
+
if (!shown.size) { return []; }
|
|
480
|
+
const scored = []; const weak = [];
|
|
481
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
482
|
+
const hits = (g(page, 'body_titles', []) || []).filter((t) => shown.has(t));
|
|
483
|
+
for (const p of (g(page, 'body_prefixes', []) || [])) { if ([...shown].some((t) => t.startsWith(p))) { hits.push(p + '…'); } }
|
|
484
|
+
if (!hits.length) { continue; }
|
|
485
|
+
if (!_hostCompatible(page, catalog, observation)) { continue; }
|
|
486
|
+
if (hits.length < 2 && !hits.some((t) => [...t.replace(/…$/, '')].length >= BODY_ANCHOR_MIN_CHARS)) {
|
|
487
|
+
// A short own text (the splash's 3-character app name "Qing Mall") still identifies the page when
|
|
488
|
+
// BODY_CORROBORATION of the page's own source texts that other pages also render are on screen
|
|
489
|
+
// with it (its "Logo" and copyright line, shared with About). Alone it stays weak: an empty
|
|
490
|
+
// cart shows "Cart", the goods page's short own text, and nothing else of that page.
|
|
491
|
+
const backing = (g(page, 'shared_texts', []) || []).filter((t) => shown.has(normalized(t)));
|
|
492
|
+
if (backing.length < BODY_CORROBORATION) {
|
|
493
|
+
weak.push({ static_id: ident, reason: 'weak-body-text', anchors: sortedStr(hits) });
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
// ranked by its own texts only: the shared backing must not outrank a page with two own texts
|
|
497
|
+
scored.push([hits.length, ident, sortedStr([...hits, ...backing.map(normalized)])]);
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
scored.push([hits.length, ident, sortedStr(hits)]);
|
|
501
|
+
}
|
|
502
|
+
// Too weak alone: handed back unverified, for resolveTwinByOpener to settle by the opener.
|
|
503
|
+
if (!scored.length) { return weak.length ? [{ weak }] : []; }
|
|
504
|
+
scored.sort((a, b) => b[0] - a[0] || (a[1] < b[1] ? -1 : 1));
|
|
505
|
+
const top = scored.filter((x) => x[0] === scored[0][0]);
|
|
506
|
+
return top.map(([, ident, hits]) => ({ static_id: ident, reason: 'source-body-text', anchors: hits }));
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/** The "dynamic Preference title from localized R.string constants" block of build_catalog. */
|
|
510
|
+
function dynamicTitle(item, key, res, project, resources) {
|
|
511
|
+
// Offsets are UTF-16 here (Python: code points); they differ only for astral chars in Java source.
|
|
512
|
+
for (const java of pGlob(project, '**/src/main/java/**/*.java')) {
|
|
513
|
+
const code = readText(java);
|
|
514
|
+
const binding = pyRe('\\b(\\w+)\\s*=\\s*[^;]*findPreference\\("' + reEscape(key) + '"\\)\\s*;').exec(code);
|
|
515
|
+
if (!binding) { continue; }
|
|
516
|
+
const variable = binding[1];
|
|
517
|
+
const bEnd = binding.index + binding[0].length;
|
|
518
|
+
let tl = code.slice(bEnd, bEnd + 2600);
|
|
519
|
+
const rebound = pyRe('\\b' + reEscape(variable) + '\\s*=').exec(tl);
|
|
520
|
+
if (rebound) { tl = tl.slice(0, rebound.index); }
|
|
521
|
+
const setter = pyRe('\\b' + reEscape(variable) + '\\.setTitle\\((\\w+)\\)').exec(tl);
|
|
522
|
+
if (!setter) { continue; }
|
|
523
|
+
const assignment = pyRe('\\b' + reEscape(setter[1]) + '\\s*=([^;]+);').exec(tl.slice(0, setter.index));
|
|
524
|
+
if (!assignment) { continue; }
|
|
525
|
+
const refs = reFindall(pyRe('R\\.string\\.(\\w+)'), assignment[1]);
|
|
526
|
+
if (refs.length && (new Set(refs).size === 1 || refs.filter((r) => r === refs[0]).length > 1)) {
|
|
527
|
+
const dynamic = g(resources(res), refs[0]);
|
|
528
|
+
if (truthy(dynamic)) {
|
|
529
|
+
item.titles = [dynamic]; item.entry_labels = [dynamic];
|
|
530
|
+
item.basis.push(pathStr(java) + '#' + variable + '.setTitle');
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** _selector_hits(nodes, sel): visible nodes matching a learned-rule selector. */
|
|
537
|
+
export function _selectorHits(nodes, sel) {
|
|
538
|
+
const out = [];
|
|
539
|
+
for (const n of nodes) {
|
|
540
|
+
if (!vis(n)) { continue; }
|
|
541
|
+
let ok = true;
|
|
542
|
+
for (const [k, v] of Object.entries(sel)) {
|
|
543
|
+
if (k === 'resource_name') { ok = tail(truthy(g(n, 'resource_id')) ? g(n, 'resource_id') : '') === v; }
|
|
544
|
+
else if (k === 'modal_title') {
|
|
545
|
+
ok = ['alertTitle', 'dialog_title'].includes(tail(truthy(g(n, 'resource_id')) ? g(n, 'resource_id') : ''))
|
|
546
|
+
&& normalized(g(n, 'text')) === normalized(v);
|
|
547
|
+
} else if (k === 'text' || k === 'content_desc') { ok = normalized(g(n, k)) === normalized(v); }
|
|
548
|
+
else if (k === 'selected') { ok = truthy(g(n, 'selected')) === truthy(v); }
|
|
549
|
+
else { ok = false; }
|
|
550
|
+
if (!ok) { break; }
|
|
551
|
+
}
|
|
552
|
+
if (ok) { out.push(n); }
|
|
553
|
+
}
|
|
554
|
+
return out;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** learned_rule_matches(nodes, rule): all positive selectors present, no negative present. */
|
|
558
|
+
export function learnedRuleMatches(nodes, rule) {
|
|
559
|
+
if (!truthy(g(rule, 'all'))) { return false; }
|
|
560
|
+
return rule.all.every((s) => _selectorHits(nodes, s).length > 0)
|
|
561
|
+
&& !g(rule, 'none', []).some((s) => _selectorHits(nodes, s).length > 0);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const bnds = (n) => { const b = g(n, 'bounds'); return truthy(b) ? b : []; };
|
|
565
|
+
|
|
566
|
+
/** occluded_indices(nodes) -> Set of indices painted over by a covering sibling. */
|
|
567
|
+
export function occludedIndices(nodes) {
|
|
568
|
+
const children = new Map();
|
|
569
|
+
nodes.forEach((n, i) => {
|
|
570
|
+
const p = parentOf(n);
|
|
571
|
+
if (!children.has(p)) { children.set(p, []); }
|
|
572
|
+
children.get(p).push(i);
|
|
573
|
+
});
|
|
574
|
+
const kidsOf = (j) => children.get(j) ?? [];
|
|
575
|
+
const tops = nodes.map(bnds).filter((b) => b.length === 4);
|
|
576
|
+
const screenH = (tops.length ? Math.max(...tops.map((b) => b[3])) : 0) - (tops.length ? Math.min(...tops.map((b) => b[1])) : 0);
|
|
577
|
+
const area = (b) => (b[2] - b[0]) * (b[3] - b[1]);
|
|
578
|
+
const hasContent = (j) => {
|
|
579
|
+
const stack = [...kidsOf(j)];
|
|
580
|
+
while (stack.length) {
|
|
581
|
+
const k = stack.pop();
|
|
582
|
+
if (truthy(g(nodes[k], 'text')) || truthy(g(nodes[k], 'clickable'))) { return true; }
|
|
583
|
+
stack.push(...kidsOf(k));
|
|
584
|
+
}
|
|
585
|
+
return false;
|
|
586
|
+
};
|
|
587
|
+
const hasContentOver = (j, bi) => {
|
|
588
|
+
const stack = [...kidsOf(j)];
|
|
589
|
+
while (stack.length) {
|
|
590
|
+
const k = stack.pop();
|
|
591
|
+
if (truthy(g(nodes[k], 'text')) || truthy(g(nodes[k], 'clickable'))) {
|
|
592
|
+
const bk = bnds(nodes[k]);
|
|
593
|
+
if (bk.length === 4 && bk[0] < bi[2] && bk[2] > bi[0] && bk[1] < bi[3] && bk[3] > bi[1]) { return true; }
|
|
594
|
+
}
|
|
595
|
+
stack.push(...kidsOf(k));
|
|
596
|
+
}
|
|
597
|
+
return false;
|
|
598
|
+
};
|
|
599
|
+
const hideTree = (hidden, root) => {
|
|
600
|
+
const stack = [root];
|
|
601
|
+
while (stack.length) { const m = stack.pop(); hidden.add(m); stack.push(...kidsOf(m)); }
|
|
602
|
+
};
|
|
603
|
+
const hidden = new Set();
|
|
604
|
+
for (const [parent, kids] of children) {
|
|
605
|
+
const pcls = parent !== null && parent >= 0 && parent < nodes.length ? S(g(nodes[parent], 'class', '')) : '';
|
|
606
|
+
if (pcls.endsWith('DrawerLayout') && kids.length >= 2) {
|
|
607
|
+
const pb = bnds(nodes[parent]);
|
|
608
|
+
const drawers = kids.filter((k) => {
|
|
609
|
+
const b = bnds(nodes[k]);
|
|
610
|
+
return b.length === 4 && pb.length === 4 && (b[0] === pb[0] || b[2] === pb[2])
|
|
611
|
+
&& b[2] - b[0] < pb[2] - pb[0] && b[2] > b[0] && hasContent(k);
|
|
612
|
+
});
|
|
613
|
+
if (drawers.length === 1) {
|
|
614
|
+
for (const k of kids) { if (k !== drawers[0]) { hideTree(hidden, k); } }
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
for (const i of kids) {
|
|
619
|
+
const bi = bnds(nodes[i]);
|
|
620
|
+
if (bi.length !== 4 || bi[2] <= bi[0] || bi[3] <= bi[1]) { continue; }
|
|
621
|
+
if (screenH && bi[3] - bi[1] < 0.25 * screenH) { continue; }
|
|
622
|
+
for (const j of kids) {
|
|
623
|
+
if (j === i) { continue; }
|
|
624
|
+
const bj = bnds(nodes[j]);
|
|
625
|
+
// A clickable cover (a scrim, a loading mask) takes every touch on its area, wherever its
|
|
626
|
+
// content sits; any other cover hides only what its content actually overlaps.
|
|
627
|
+
if (bj.length === 4 && bj[0] <= bi[0] && bj[1] <= bi[1] && bj[2] >= bi[2] && bj[3] >= bi[3]
|
|
628
|
+
&& area(bj) > area(bi) && screenH && bj[3] - bj[1] >= 0.5 * screenH
|
|
629
|
+
&& (truthy(g(nodes[j], 'clickable')) ? hasContent(j) : hasContentOver(j, bi))) {
|
|
630
|
+
hideTree(hidden, i);
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
return hidden;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/** tree_package(nodes): majority `package` of a dumped tree (first maximal on ties), or null. */
|
|
640
|
+
export function treePackage(nodes) {
|
|
641
|
+
const counts = new Map();
|
|
642
|
+
for (const n of nodes || []) {
|
|
643
|
+
if (truthy(g(n, 'package'))) { counts.set(n.package, (counts.get(n.package) ?? 0) + 1); }
|
|
644
|
+
}
|
|
645
|
+
return counts.size ? pyMax(counts.keys(), (k) => counts.get(k)) : null;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
const textSet = (nodes, pred) => {
|
|
649
|
+
const out = new Set();
|
|
650
|
+
nodes.forEach((n) => { if (truthy(g(n, 'text')) && pred(n)) { out.add(normalized(g(n, 'text'))); } });
|
|
651
|
+
return out;
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
/** resolve_page(observation, catalog, configured_identity=None, app_package=None). */
|
|
655
|
+
// Call forms: resolvePage(obs, catalog, identity, {app_package}) (Python keyword), or
|
|
656
|
+
// resolvePage(obs, catalog, identity, 'pkg') (positional), or resolvePage(obs, catalog, {configured_identity, app_package}).
|
|
657
|
+
export function resolvePage(observation, catalog, configuredIdentity = null, opts = null) {
|
|
658
|
+
let appPackage = null;
|
|
659
|
+
if (typeof opts === 'string') { appPackage = opts; } else if (opts && typeof opts === 'object') { appPackage = opts.app_package ?? null; }
|
|
660
|
+
if (configuredIdentity && typeof configuredIdentity === 'object' && !Array.isArray(configuredIdentity)
|
|
661
|
+
&& ('configured_identity' in configuredIdentity || 'app_package' in configuredIdentity)) {
|
|
662
|
+
appPackage = configuredIdentity.app_package ?? appPackage;
|
|
663
|
+
configuredIdentity = configuredIdentity.configured_identity ?? null;
|
|
664
|
+
}
|
|
665
|
+
const ci = truthy(configuredIdentity) ? configuredIdentity : (truthy(g(observation, 'identity')) ? observation.identity : {});
|
|
666
|
+
const configuredId = g(ci, 'family');
|
|
667
|
+
const pkgTree = treePackage(g(observation, 'nodes'));
|
|
668
|
+
const pkg = truthy(pkgTree) ? pkgTree : g(observation, 'package');
|
|
669
|
+
if (truthy(appPackage) && truthy(pkg) && pkg !== appPackage) {
|
|
670
|
+
return { status: 'foreign-package', candidates: [], package: pkg };
|
|
671
|
+
}
|
|
672
|
+
if (g(ci, 'status') === 'verified' && Object.hasOwn(catalog, configuredId)) {
|
|
673
|
+
return { status: 'verified', static_id: configuredId, reason: 'configured-positive-anchor', anchors: [...g(ci, 'basis', [])] };
|
|
674
|
+
}
|
|
675
|
+
const allNodes = g(observation, 'nodes', []);
|
|
676
|
+
const hidden = occludedIndices(allNodes);
|
|
677
|
+
const nodes = allNodes.map((n, i) => (vis(n) && !hidden.has(i) ? n : { parent_index: g(n, 'parent_index'), visible: false }));
|
|
678
|
+
observation = { ...observation, nodes };
|
|
679
|
+
// in-page states never compete for the page identity (uiStatesOf reads their rules)
|
|
680
|
+
const learned = Object.keys(catalog).filter((ident) => !STATE_KINDS.includes(g(catalog[ident], 'kind'))
|
|
681
|
+
&& g(catalog[ident], 'learned_rules', []).some((r) => learnedRuleMatches(nodes, r)));
|
|
682
|
+
if (learned.length === 1) {
|
|
683
|
+
const rule = catalog[learned[0]].learned_rules.find((r) => learnedRuleMatches(nodes, r));
|
|
684
|
+
return { status: 'verified', static_id: learned[0], reason: 'learned-rule:' + rule.id,
|
|
685
|
+
anchors: rule.all.map((s) => Object.values(s)[0]) };
|
|
686
|
+
}
|
|
687
|
+
if (learned.length > 1) {
|
|
688
|
+
return { status: 'ambiguous', candidates: learned.map((i) => ({ static_id: i, reason: 'learned-rule' })) };
|
|
689
|
+
}
|
|
690
|
+
const rid = (n) => S(g(n, 'resource_id', ''));
|
|
691
|
+
const modalTitles = textSet(nodes, (n) => ['alertTitle', 'dialog_title'].includes(tail(rid(n))));
|
|
692
|
+
const frameworkRows = textSet(nodes, (n) => tail(rid(n)) === 'title' && rid(n).endsWith(':id/title'));
|
|
693
|
+
const inNavBar = (n) => {
|
|
694
|
+
let idx = parentOf(n);
|
|
695
|
+
for (let k = 0; k < 6; k++) {
|
|
696
|
+
if (!inRange(idx, nodes)) { return false; }
|
|
697
|
+
const p = nodes[idx];
|
|
698
|
+
const cls = S(g(p, 'class', ''));
|
|
699
|
+
if (endsWithAny(cls, ['BottomNavigationView', 'NavigationBarView', 'TabLayout', 'BottomNavigationItemView', 'NavigationBarItemView'])
|
|
700
|
+
|| S(g(p, 'resource_id', '')).includes('navigation_bar_item')) { return true; }
|
|
701
|
+
idx = parentOf(p);
|
|
702
|
+
}
|
|
703
|
+
return false;
|
|
704
|
+
};
|
|
705
|
+
const tabBar = _composeTabBarNodes(nodes, catalog);
|
|
706
|
+
const bodyText = textSet(nodes, (n) => !inNavBar(n) && !tabBar.has(n) && !endsWithAny(S(g(n, 'class', '')), ['.Button', 'MaterialButton', 'ImageButton']));
|
|
707
|
+
const prefRows = frameworkRows.size >= 2 ? frameworkRows : bodyText;
|
|
708
|
+
let candidates = []; let weakBody = null;
|
|
709
|
+
if (modalTitles.size) {
|
|
710
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
711
|
+
const hits = inter(modalTitles, setOf(page.titles.map(normalized)));
|
|
712
|
+
if (page.kind === 'dialog' && hits.size) {
|
|
713
|
+
candidates.push({ static_id: ident, reason: 'unique-modal-title', anchors: sortedStr(hits) });
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
if (!candidates.length) {
|
|
717
|
+
const modalCatalog = {};
|
|
718
|
+
for (const [k, v] of Object.entries(catalog)) { if (['dialog', 'sheet', 'menu'].includes(g(v, 'kind'))) { dset(modalCatalog, k, v); } }
|
|
719
|
+
candidates = _ownWidgetCandidates(nodes, modalCatalog, observation);
|
|
720
|
+
}
|
|
721
|
+
} else {
|
|
722
|
+
const counts = new Map();
|
|
723
|
+
for (const page of Object.values(catalog)) {
|
|
724
|
+
for (const title of setOf(g(page, 'row_titles', []).map(normalized))) { counts.set(title, (counts.get(title) ?? 0) + 1); }
|
|
725
|
+
}
|
|
726
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
727
|
+
const sourceRows = g(page, 'row_source') === 'preference-xml' ? frameworkRows : prefRows;
|
|
728
|
+
const hits = inter(sourceRows, setOf(g(page, 'row_titles', []).map(normalized)));
|
|
729
|
+
const unique = [...hits].filter((h) => counts.get(h) === 1);
|
|
730
|
+
const single = g(page, 'row_titles', []).length === 1 && unique.length === 1
|
|
731
|
+
&& g(page, 'kind') === 'menu' && frameworkRows.has(unique[0]);
|
|
732
|
+
if (!frameworkRows.size && hits.size >= 2 && !_shareRowContainer(nodes, hits)) { continue; }
|
|
733
|
+
if ((hits.size >= 2 && unique.length) || single) {
|
|
734
|
+
candidates.push({ static_id: ident, reason: 'source-owned-preference-rows', anchors: sortedStr(hits) });
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
if (!candidates.length) { candidates = _selectedTabCandidates(nodes, catalog, observation); }
|
|
738
|
+
if (!candidates.length) { candidates = _tabTitleCandidates(nodes, catalog, observation); }
|
|
739
|
+
if (!candidates.length) { candidates = _toolbarTitleCandidates(nodes, catalog, observation); }
|
|
740
|
+
if (!candidates.length) { candidates = _ownWidgetCandidates(nodes, catalog, observation); }
|
|
741
|
+
if (!candidates.length) { candidates = _overlayLeadTitleCandidates(nodes, catalog, observation); }
|
|
742
|
+
if (!candidates.length) {
|
|
743
|
+
candidates = _bodyTextCandidates(nodes, catalog, observation, tabBar);
|
|
744
|
+
if (candidates.length === 1 && candidates[0].weak) {
|
|
745
|
+
weakBody = candidates[0].weak; candidates = [];
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
if (!candidates.length) {
|
|
749
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
750
|
+
const hasList = nodes.some((n) => g(n, 'resource_id') === 'android:id/list');
|
|
751
|
+
if (page.kind === 'activity' && g(page, 'component') === g(observation, 'activity')
|
|
752
|
+
&& (!hasList || g(page, 'hosts_static_pages') === false)) {
|
|
753
|
+
candidates.push({ static_id: ident, reason: 'exact-activity', anchors: [page.component] });
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
// Twins sharing every source anchor: nothing unique matched (or only a weak text of a page that is
|
|
759
|
+
// not one of them), but the bar title / search placeholder is a title several pages share.
|
|
760
|
+
if (!modalTitles.size && !candidates.length) {
|
|
761
|
+
const twins = _sharedTitleCandidates(nodes, catalog, observation);
|
|
762
|
+
const ids = new Set(twins.map((c) => c.static_id));
|
|
763
|
+
if (twins.length >= 2 && !(weakBody || []).some((c) => ids.has(g(c, 'static_id')))) {
|
|
764
|
+
return { status: 'ambiguous', candidates: twins };
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
if (candidates.length === 1) { return { status: 'verified', ...candidates[0] }; }
|
|
768
|
+
const out = { status: candidates.length ? 'ambiguous' : 'unmapped', candidates };
|
|
769
|
+
if (!candidates.length && weakBody) { out.weak_candidates = weakBody; }
|
|
770
|
+
return out;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
export const _SCREEN_KINDS = ['fragment', 'activity', 'screen', 'compose-route', 'panel', 'view-page'];
|
|
774
|
+
|
|
775
|
+
/** _share_row_container(nodes, texts): >=2 of `texts` are rows of ONE list. */
|
|
776
|
+
export function _shareRowContainer(nodes, texts) {
|
|
777
|
+
const rowList = (n) => {
|
|
778
|
+
const chain = [];
|
|
779
|
+
let idx = parentOf(n);
|
|
780
|
+
for (let k = 0; k < 8; k++) {
|
|
781
|
+
if (!inRange(idx, nodes)) { return null; }
|
|
782
|
+
const p = nodes[idx];
|
|
783
|
+
if (truthy(g(p, 'scrollable')) || endsWithAny(S(g(p, 'class', '')), ['ListView', 'RecyclerView'])) {
|
|
784
|
+
let depth = chain.length;
|
|
785
|
+
if (S(g(p, 'class', '')).endsWith('ScrollView')) { depth -= 1; }
|
|
786
|
+
return depth <= 2 ? idx : null;
|
|
787
|
+
}
|
|
788
|
+
chain.push(idx);
|
|
789
|
+
idx = parentOf(p);
|
|
790
|
+
}
|
|
791
|
+
return null;
|
|
792
|
+
};
|
|
793
|
+
const owners = new Map();
|
|
794
|
+
for (const n of nodes) {
|
|
795
|
+
const t = normalized(g(n, 'text'));
|
|
796
|
+
if (texts.has(t)) {
|
|
797
|
+
const c = rowList(n);
|
|
798
|
+
if (c !== null) { if (!owners.has(c)) { owners.set(c, new Set()); } owners.get(c).add(t); }
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return [...owners.values()].some((v) => v.size >= 2);
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/** _host_compatible(page, catalog, observation). */
|
|
805
|
+
export function _hostCompatible(page, catalog, observation) {
|
|
806
|
+
const component = g(page, 'component');
|
|
807
|
+
return !truthy(component) || component === g(observation, 'activity');
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/** _toolbar_title_candidates(nodes, catalog, observation). */
|
|
811
|
+
export function _toolbarTitleCandidates(nodes, catalog, observation) {
|
|
812
|
+
const shown = _barTitles(nodes);
|
|
813
|
+
if (!shown.size) { return []; }
|
|
814
|
+
const owners = new Map();
|
|
815
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
816
|
+
if (!_SCREEN_KINDS.includes(g(page, 'kind'))) { continue; }
|
|
817
|
+
for (const title of setOf([...g(page, 'titles', []), ...g(page, 'hint_titles', [])].map(normalized))) {
|
|
818
|
+
if (!owners.has(title)) { owners.set(title, new Set()); }
|
|
819
|
+
owners.get(title).add(ident);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
const found = new Map();
|
|
823
|
+
for (const title of shown) {
|
|
824
|
+
const ids = owners.get(title) ?? new Set();
|
|
825
|
+
if (ids.size === 1) {
|
|
826
|
+
const ident = [...ids][0];
|
|
827
|
+
if (_hostCompatible(catalog[ident], catalog, observation)) {
|
|
828
|
+
if (!found.has(ident)) { found.set(ident, []); }
|
|
829
|
+
found.get(ident).push(title);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
return [...found].map(([ident, t]) => ({ static_id: ident, reason: 'unique-toolbar-title', anchors: sortedStr(t) }));
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Pages that share the screen's bar title or search-field placeholder (catalog `shared_titles`):
|
|
838
|
+
* `shared-title-twin` candidates, host-compatible ones only. Several shared texts shown narrow the
|
|
839
|
+
* set to the pages sharing all of them. Never a verdict: resolveTwinByOpener settles it by the opener.
|
|
840
|
+
*/
|
|
841
|
+
export function _sharedTitleCandidates(nodes, catalog, observation) {
|
|
842
|
+
const index = (key) => {
|
|
843
|
+
const m = new Map();
|
|
844
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
845
|
+
for (const t of (g(page, key, []) || [])) { if (!m.has(t)) { m.set(t, new Set()); } m.get(t).add(ident); }
|
|
846
|
+
}
|
|
847
|
+
return m;
|
|
848
|
+
};
|
|
849
|
+
const byTitle = index('shared_titles'); const byText = index('shared_texts');
|
|
850
|
+
const sets = [];
|
|
851
|
+
for (const t of _barTitles(nodes)) { if (byTitle.has(t)) { sets.push([t, byTitle.get(t)]); } }
|
|
852
|
+
for (const t of _placeholders(nodes)) { if (byText.has(t)) { sets.push([t, byText.get(t)]); } }
|
|
853
|
+
if (!sets.length) { return []; }
|
|
854
|
+
const shown = new Set(sets.map(([t]) => t));
|
|
855
|
+
let ids = null;
|
|
856
|
+
for (const [, s] of sets) { ids = ids === null ? new Set(s) : inter(ids, s); }
|
|
857
|
+
const anchors = sortedStr(shown);
|
|
858
|
+
return sortedStr(ids).filter((i) => _hostCompatible(catalog[i], catalog, observation))
|
|
859
|
+
.map((i) => ({ static_id: i, reason: 'shared-title-twin', anchors }));
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
/** Bar titles on screen: a TextView in a Toolbar (3 levels) or a Compose top bar title. */
|
|
863
|
+
function _barTitles(nodes) {
|
|
864
|
+
const inToolbar = (n) => {
|
|
865
|
+
let idx = parentOf(n);
|
|
866
|
+
for (let k = 0; k < 3; k++) {
|
|
867
|
+
if (!inRange(idx, nodes)) { return false; }
|
|
868
|
+
const parent = nodes[idx];
|
|
869
|
+
const cls = S(g(parent, 'class', ''));
|
|
870
|
+
const r = tail(S(g(parent, 'resource_id', ''))).toLowerCase();
|
|
871
|
+
if (cls.endsWith('Toolbar') || ['toolbar', 'action_bar', 'toolbar_title'].includes(r)) { return true; }
|
|
872
|
+
idx = parentOf(parent);
|
|
873
|
+
}
|
|
874
|
+
return false;
|
|
875
|
+
};
|
|
876
|
+
if (nodes.some((n) => S(g(n, 'resource_id', '')) === 'android:id/title')) { return new Set(); }
|
|
877
|
+
return textSet(nodes, (n) => g(n, 'class') === 'android.widget.TextView' && (inToolbar(n) || _composeTopBarTitle(nodes, n)));
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
/** Search-field placeholders: an empty EditText's hint, or a TextView drawn inside an EditText (Compose). */
|
|
881
|
+
function _placeholders(nodes) {
|
|
882
|
+
const out = new Set();
|
|
883
|
+
nodes.forEach((n) => {
|
|
884
|
+
if (!vis(n)) { return; }
|
|
885
|
+
if (isInputNode(n) && !truthy(g(n, 'text')) && truthy(g(n, 'hint'))) { out.add(normalized(n.hint)); }
|
|
886
|
+
if (g(n, 'class') !== 'android.widget.TextView' || !truthy(g(n, 'text'))) { return; }
|
|
887
|
+
let idx = parentOf(n);
|
|
888
|
+
for (let k = 0; k < 3 && inRange(idx, nodes); k++) {
|
|
889
|
+
if (isInputNode(nodes[idx])) { out.add(normalized(n.text)); return; }
|
|
890
|
+
idx = parentOf(nodes[idx]);
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
return out;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* A Compose top bar has no Toolbar class and no ids: its title is a plain TextView under an
|
|
898
|
+
* android.view.View, next to a clickable navigation icon (back / menu) in the same row.
|
|
899
|
+
* Measured (Salt Player 10-18): SETTINGS / ABOUT / MEDIA_SOURCE were reached 46 times and all
|
|
900
|
+
* resolved unmapped. The title must sit in the top band of the window, outside any scrollable
|
|
901
|
+
* container, with a clickable sibling to its left that overlaps it vertically.
|
|
902
|
+
*/
|
|
903
|
+
export function _composeTopBarTitle(nodes, n) {
|
|
904
|
+
const b = bnds(n);
|
|
905
|
+
if (b.length !== 4 || !truthy(g(n, 'text'))) { return false; }
|
|
906
|
+
const height = _extent(nodes)[1];
|
|
907
|
+
if (!(height > 0) || b[3] > TOP_BAR_BAND * height) { return false; }
|
|
908
|
+
let idx = parentOf(n);
|
|
909
|
+
for (let k = 0; k < 8 && inRange(idx, nodes); k++) {
|
|
910
|
+
if (truthy(g(nodes[idx], 'scrollable'))) { return false; }
|
|
911
|
+
idx = parentOf(nodes[idx]);
|
|
912
|
+
}
|
|
913
|
+
// A centered top bar (Material CenterAlignedTopAppBar and look-alikes) puts its navigation icon
|
|
914
|
+
// in another branch of the tree: a title centered on the window, with a clickable control
|
|
915
|
+
// beside it in the same band, is the bar's title.
|
|
916
|
+
const width = _extent(nodes)[0];
|
|
917
|
+
if (width > 0 && Math.abs((b[0] + b[2]) / 2 - width / 2) <= CENTERED_TITLE_TOLERANCE * width
|
|
918
|
+
&& nodes.some((c) => {
|
|
919
|
+
if (c === n || !truthy(g(c, 'clickable')) || !vis(c)) { return false; }
|
|
920
|
+
const cb = bnds(c);
|
|
921
|
+
return cb.length === 4 && cb[1] < b[3] && cb[3] > b[1] && (cb[2] <= b[0] + 2 || cb[0] >= b[2] - 2);
|
|
922
|
+
})) { return true; }
|
|
923
|
+
const pi = parentOf(n);
|
|
924
|
+
if (!inRange(pi, nodes)) { return false; }
|
|
925
|
+
// The navigation icon is a sibling of the title, or (Material3 TopAppBar wraps the title and the
|
|
926
|
+
// icon in their own slot boxes) a descendant of the row one or two levels up.
|
|
927
|
+
const within = (c, anc) => {
|
|
928
|
+
let i = parentOf(c);
|
|
929
|
+
for (let k = 0; k < 3 && inRange(i, nodes); k++) { if (i === anc) { return true; } i = parentOf(nodes[i]); }
|
|
930
|
+
return false;
|
|
931
|
+
};
|
|
932
|
+
let scope = pi;
|
|
933
|
+
for (let lvl = 0; lvl < 3 && inRange(scope, nodes); lvl++) {
|
|
934
|
+
if (nodes.some((c) => {
|
|
935
|
+
if (c === n || !truthy(g(c, 'clickable')) || !vis(c) || !within(c, scope)) { return false; }
|
|
936
|
+
const cb = bnds(c);
|
|
937
|
+
return cb.length === 4 && cb[2] <= b[0] + 2 && cb[1] < b[3] && cb[3] > b[1];
|
|
938
|
+
})) { return true; }
|
|
939
|
+
scope = parentOf(nodes[scope]);
|
|
940
|
+
}
|
|
941
|
+
// A ROOT page's bar (a home screen, a main tab) has no navigation icon: the title starts the row and
|
|
942
|
+
// the bar's action icons follow it on the right, one level up (the title sits in its own slot). It is
|
|
943
|
+
// the bar's title when it is the row's only text and every clickable in the row lies to its right.
|
|
944
|
+
const row = parentOf(nodes[pi]);
|
|
945
|
+
if (!inRange(row, nodes)) { return false; }
|
|
946
|
+
const under = (c, anc) => {
|
|
947
|
+
let i = parentOf(c);
|
|
948
|
+
for (let k = 0; k < 4 && inRange(i, nodes); k++) { if (i === anc) { return true; } i = parentOf(nodes[i]); }
|
|
949
|
+
return false;
|
|
950
|
+
};
|
|
951
|
+
const inRow = nodes.filter((c) => c !== n && vis(c) && under(c, row));
|
|
952
|
+
const overlaps = (cb) => cb.length === 4 && cb[1] < b[3] && cb[3] > b[1];
|
|
953
|
+
if (inRow.some((c) => g(c, 'class') === 'android.widget.TextView' && truthy(g(c, 'text')) && overlaps(bnds(c)))) { return false; }
|
|
954
|
+
const actions = inRow.filter((c) => truthy(g(c, 'clickable')) && overlaps(bnds(c)));
|
|
955
|
+
return actions.length > 0 && actions.every((c) => bnds(c)[0] >= b[2] - 2);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/** How far (as a share of the window width) a centered top-bar title's center may sit off center. */
|
|
959
|
+
export const CENTERED_TITLE_TOLERANCE = 0.03;
|
|
960
|
+
|
|
961
|
+
const _EXTENTS = new WeakMap();
|
|
962
|
+
/** [width, height] of the window a tree covers (rightmost / lowest bound), computed once per tree. */
|
|
963
|
+
function _extent(nodes) {
|
|
964
|
+
let e = _EXTENTS.get(nodes);
|
|
965
|
+
if (e === undefined) {
|
|
966
|
+
let w = 0; let h = 0;
|
|
967
|
+
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]); } }
|
|
968
|
+
e = [w, h]; _EXTENTS.set(nodes, e);
|
|
969
|
+
}
|
|
970
|
+
return e;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/** Fraction of the window height a top-bar title may reach down to. */
|
|
974
|
+
export const TOP_BAR_BAND = 0.12;
|
|
975
|
+
|
|
976
|
+
/** _selected_tab_candidates(nodes, catalog, observation). */
|
|
977
|
+
export function _selectedTabCandidates(nodes, catalog, observation) {
|
|
978
|
+
const strips = [];
|
|
979
|
+
nodes.forEach((n, i) => {
|
|
980
|
+
if (endsWithAny(S(g(n, 'class', '')), ['HorizontalScrollView', 'TabLayout'])
|
|
981
|
+
|| ['tabs', 'tab_layout', 'sliding_tabs', 'tabLayout'].includes(tail(S(g(n, 'resource_id', ''))))) { strips.push(i); }
|
|
982
|
+
});
|
|
983
|
+
if (!strips.length) { return []; }
|
|
984
|
+
const under = (i, root) => {
|
|
985
|
+
for (let k = 0; k < 6; k++) {
|
|
986
|
+
i = i >= 0 && i < nodes.length ? parentOf(nodes[i]) : null;
|
|
987
|
+
if (i === null) { return false; }
|
|
988
|
+
if (i === root) { return true; }
|
|
989
|
+
}
|
|
990
|
+
return false;
|
|
991
|
+
};
|
|
992
|
+
const selected = new Set();
|
|
993
|
+
nodes.forEach((n, i) => {
|
|
994
|
+
const cap = truthy(g(n, 'text')) ? g(n, 'text') : g(n, 'content_desc');
|
|
995
|
+
if (truthy(g(n, 'selected')) && truthy(cap) && strips.some((s) => under(i, s))) { selected.add(normalized(cap)); }
|
|
996
|
+
});
|
|
997
|
+
if (selected.size !== 1) { return []; }
|
|
998
|
+
const cap = [...selected][0];
|
|
999
|
+
const hits = Object.keys(catalog).filter((ident) => normalized(g(catalog[ident], 'tab_label')) === cap && truthy(g(catalog[ident], 'tab_label')));
|
|
1000
|
+
if (hits.length !== 1) { return []; }
|
|
1001
|
+
return [{ static_id: hits[0], reason: 'selected-tab', anchors: [cap] }];
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/** Fewest labels a bottom row needs to be a tab bar. */
|
|
1005
|
+
export const TAB_BAR_MIN_LABELS = 3;
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* A top-level tab page of a Compose pager: a centered top-bar title (no back icon, so not a bar
|
|
1009
|
+
* title by _composeTopBarTitle) that is also one label of the bottom tab row. A Compose
|
|
1010
|
+
* NavigationBar reports no `selected`, so the bar title is what names the current tab. Measured
|
|
1011
|
+
* (coolmall 2026-11-08): "Categories" / "Cart" tabs captured with only server data on screen stayed
|
|
1012
|
+
* unmapped. Among the pages titled that way, pager pages win: the standalone route sharing the
|
|
1013
|
+
* title (compose-route:Cart, with a back icon) does not show the tab row.
|
|
1014
|
+
*/
|
|
1015
|
+
/** Text nodes of the bottom tab row: ≥ TAB_BAR_MIN_LABELS labels on one line, outside any scroller. */
|
|
1016
|
+
export function _bottomTabRow(nodes) {
|
|
1017
|
+
const [, height] = _extent(nodes);
|
|
1018
|
+
if (!(height > 0)) { return []; }
|
|
1019
|
+
const free = (n) => {
|
|
1020
|
+
let idx = parentOf(n);
|
|
1021
|
+
for (let k = 0; k < 8 && inRange(idx, nodes); k++) { if (truthy(g(nodes[idx], 'scrollable'))) { return false; } idx = parentOf(nodes[idx]); }
|
|
1022
|
+
return true;
|
|
1023
|
+
};
|
|
1024
|
+
// The tab row sits outside the pager; the title is the page's own, inside the (scrollable) pager.
|
|
1025
|
+
const bottom = nodes.filter((n) => vis(n) && truthy(g(n, 'text')) && bnds(n).length === 4
|
|
1026
|
+
&& bnds(n)[1] >= (1 - TOP_BAR_BAND) * height && free(n));
|
|
1027
|
+
const mid = (n) => (bnds(n)[1] + bnds(n)[3]) / 2;
|
|
1028
|
+
const out = new Set();
|
|
1029
|
+
for (const n of bottom) {
|
|
1030
|
+
const row = bottom.filter((c) => Math.abs(mid(c) - mid(n)) <= 0.01 * height);
|
|
1031
|
+
if (row.length >= TAB_BAR_MIN_LABELS) { row.forEach((c) => out.add(c)); }
|
|
1032
|
+
}
|
|
1033
|
+
return [...out];
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* The bottom tab row's nodes when at least two of its labels are catalog tab labels: a Compose
|
|
1038
|
+
* NavigationBar, which inNavBar (View classes) cannot see. Measured (CoolMall 11-07): its "Cart"
|
|
1039
|
+
* label counted as body text of GoodsRoutes.Detail, so the reached Category tab verified as the goods
|
|
1040
|
+
* page and neither exact-page nor attestedArrival held. A goods page's own bottom bar
|
|
1041
|
+
* (Cart / Add to cart / Buy now) shares at most one tab label and stays body text.
|
|
1042
|
+
*/
|
|
1043
|
+
export function _composeTabBarNodes(nodes, catalog) {
|
|
1044
|
+
const labels = new Set(Object.values(catalog).map((p) => g(p, 'tab_label')).filter((t) => truthy(t)).map(normalized));
|
|
1045
|
+
if (labels.size < 2) { return new Set(); }
|
|
1046
|
+
const row = _bottomTabRow(nodes);
|
|
1047
|
+
const known = row.filter((n) => labels.has(normalized(n.text)));
|
|
1048
|
+
return known.length >= 2 ? new Set(row) : new Set();
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
export function _tabTitleCandidates(nodes, catalog, observation) {
|
|
1052
|
+
const [width, height] = _extent(nodes);
|
|
1053
|
+
if (!(width > 0 && height > 0)) { return []; }
|
|
1054
|
+
const texts = nodes.filter((n) => vis(n) && truthy(g(n, 'text')) && bnds(n).length === 4);
|
|
1055
|
+
const tabs = new Set(_bottomTabRow(nodes).map((c) => normalized(c.text)));
|
|
1056
|
+
if (!tabs.size) { return []; }
|
|
1057
|
+
const titles = new Set(texts.filter((n) => bnds(n)[3] <= TOP_BAR_BAND * height
|
|
1058
|
+
&& Math.abs((bnds(n)[0] + bnds(n)[2]) / 2 - width / 2) <= CENTERED_TITLE_TOLERANCE * width)
|
|
1059
|
+
.map((n) => normalized(n.text)).filter((t) => tabs.has(t)));
|
|
1060
|
+
if (titles.size !== 1) { return []; }
|
|
1061
|
+
const title = [...titles][0];
|
|
1062
|
+
const hits = Object.keys(catalog).filter((ident) => g(catalog[ident], 'kind') === 'pager-page'
|
|
1063
|
+
&& [...g(catalog[ident], 'titles', []), ...g(catalog[ident], 'hint_titles', []), g(catalog[ident], 'tab_label')]
|
|
1064
|
+
.some((t) => truthy(t) && normalized(t) === title)
|
|
1065
|
+
&& _hostCompatible(catalog[ident], catalog, observation));
|
|
1066
|
+
return hits.length === 1 ? [{ static_id: hits[0], reason: 'tab-bar-title', anchors: [title] }] : [];
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
const setKey = (xs) => JSON.stringify(sortedStr(new Set(xs)));
|
|
1070
|
+
|
|
1071
|
+
/** _own_widget_candidates(nodes, catalog, observation): identify a page by ids only its layout declares. */
|
|
1072
|
+
export function _ownWidgetCandidates(nodes, catalog, observation) {
|
|
1073
|
+
const overlay = new Set();
|
|
1074
|
+
const kidsOf = new Map();
|
|
1075
|
+
nodes.forEach((c, k) => { const p = parentOf(c); if (!kidsOf.has(p)) { kidsOf.set(p, []); } kidsOf.get(p).push(k); });
|
|
1076
|
+
nodes.forEach((n, i) => {
|
|
1077
|
+
const pi = parentOf(n);
|
|
1078
|
+
const p = pi !== null && pi >= 0 && pi < nodes.length ? nodes[pi] : {};
|
|
1079
|
+
if (!endsWithAny(S(g(p, 'class', '')), ['CoordinatorLayout', 'ViewGroup', 'FrameLayout'])) { return; }
|
|
1080
|
+
const siblings = (kidsOf.get(pi) ?? []).filter((k) => nodes[k] !== n).map((k) => nodes[k]);
|
|
1081
|
+
const nb = truthy(g(n, 'bounds')) ? n.bounds : [0, 0, 0, 0];
|
|
1082
|
+
const pbA = truthy(g(p, 'bounds')) ? p.bounds : [0, 0, 0, 1];
|
|
1083
|
+
const pbB = truthy(g(p, 'bounds')) ? p.bounds : [0, 0, 0, 0];
|
|
1084
|
+
if (!siblings.some((c) => bnds(c).length === 4 && c.bounds[3] <= nb[1] + 2
|
|
1085
|
+
&& c.bounds[3] - c.bounds[1] > 0.5 * (pbA[3] - pbB[1]))) { return; }
|
|
1086
|
+
const pb = bnds(p); const b = bnds(n);
|
|
1087
|
+
if (pb.length === 4 && b.length === 4 && pb[3] - pb[1] > 0 && b[1] >= pb[1] + 0.75 * (pb[3] - pb[1])
|
|
1088
|
+
&& b[3] - b[1] < 0.25 * (pb[3] - pb[1]) && Math.abs(b[3] - pb[3]) <= 2) {
|
|
1089
|
+
const stack = [i];
|
|
1090
|
+
while (stack.length) { const j = stack.pop(); overlay.add(j); stack.push(...(kidsOf.get(j) ?? [])); }
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1093
|
+
const visible = new Set();
|
|
1094
|
+
nodes.forEach((n, i) => { if (truthy(g(n, 'resource_id')) && !overlay.has(i)) { visible.add(tail(S(g(n, 'resource_id', '')))); } });
|
|
1095
|
+
const counts = new Map(); const groups = new Map();
|
|
1096
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
1097
|
+
const ids = g(page, 'widget_ids', []);
|
|
1098
|
+
if (ids.length) {
|
|
1099
|
+
const k = setKey(ids);
|
|
1100
|
+
if (!groups.has(k)) { groups.set(k, { ids: new Set(ids), members: [] }); }
|
|
1101
|
+
groups.get(k).members.push(ident);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
for (const { ids } of groups.values()) { for (const r of ids) { counts.set(r, (counts.get(r) ?? 0) + 1); } }
|
|
1105
|
+
const modalOpen = g(observation, 'window') === 'dialog' || nodes.some((n) =>
|
|
1106
|
+
['alertTitle', 'parentPanel', 'design_bottom_sheet'].includes(tail(S(g(n, 'resource_id', '')))));
|
|
1107
|
+
let scored = [];
|
|
1108
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
1109
|
+
if (['dialog', 'sheet'].includes(g(page, 'kind')) && !modalOpen) { continue; }
|
|
1110
|
+
const unique = sortedStr(g(page, 'widget_ids', []).filter((r) => counts.get(r) === 1 && visible.has(r)));
|
|
1111
|
+
const hiddenIds = g(page, 'hidden_ids', []);
|
|
1112
|
+
const shown = g(page, 'widget_ids', []).filter((r) => !hiddenIds.includes(r));
|
|
1113
|
+
const need = shown.filter((r) => counts.get(r) === 1).length === 1 ? 1 : 2;
|
|
1114
|
+
if (unique.length >= need && _hostCompatible(page, catalog, observation)) { scored.push([unique.length, ident, unique]); }
|
|
1115
|
+
}
|
|
1116
|
+
if (!scored.length) {
|
|
1117
|
+
const own = [];
|
|
1118
|
+
for (const [ident, page] of Object.entries(catalog)) {
|
|
1119
|
+
if (['dialog', 'sheet'].includes(g(page, 'kind')) && !modalOpen) { continue; }
|
|
1120
|
+
if (!_hostCompatible(page, catalog, observation)) { continue; }
|
|
1121
|
+
const ids = new Set(g(page, 'widget_ids', []));
|
|
1122
|
+
const informative = new Set([...ids].filter((r) => visible.has(r) && (counts.get(r) ?? 0) <= 5));
|
|
1123
|
+
if (informative.size >= 3) { own.push([ident, informative, ids]); }
|
|
1124
|
+
}
|
|
1125
|
+
const best = sortedBy(own, (x) => x[1].size, true);
|
|
1126
|
+
if (best.length) {
|
|
1127
|
+
const [ident, hit] = best[0];
|
|
1128
|
+
const superset = (a, b) => [...b].every((x) => a.has(x));
|
|
1129
|
+
const rivals = best.slice(1).filter(([, h, i]) => superset(h, hit) || [...i].every((x) => h.has(x)) || h.size === hit.size);
|
|
1130
|
+
if (!rivals.length) { return [{ static_id: ident, reason: 'best-layout-cover', anchors: sortedStr(hit) }]; }
|
|
1131
|
+
}
|
|
1132
|
+
return [];
|
|
1133
|
+
}
|
|
1134
|
+
scored = sortedBy(scored, (x) => [x[0], x[1]], true);
|
|
1135
|
+
const top = scored.filter((x) => x[0] === scored[0][0]);
|
|
1136
|
+
if (top.length > 1 && new Set(top.map(([, i]) => setKey(g(catalog[i], 'widget_ids', [])))).size === 1) {
|
|
1137
|
+
return top.map(([, i, u]) => ({ static_id: i, reason: 'layout-twin', anchors: u }));
|
|
1138
|
+
}
|
|
1139
|
+
if (scored.length > 1 && scored[0][0] === scored[1][0]) {
|
|
1140
|
+
return scored.filter((x) => x[0] === scored[0][0]).map(([, i, u]) => ({ static_id: i, reason: 'own-layout-ids', anchors: u }));
|
|
1141
|
+
}
|
|
1142
|
+
const best = scored[0];
|
|
1143
|
+
return [{ static_id: best[1], reason: 'own-layout-ids', anchors: best[2] }];
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* resolve_twin_by_opener(resolution, prior, catalog): layout twins (several pages inflating the
|
|
1148
|
+
* same layout) cannot be told apart by the screen alone, but the static graph knows which page
|
|
1149
|
+
* OPENS each of them. When the screen shown just before was verified as page P (or P's host /
|
|
1150
|
+
* panel host) and exactly one twin is opened from P, that twin is the page. Otherwise the
|
|
1151
|
+
* resolution is returned unchanged.
|
|
1152
|
+
*/
|
|
1153
|
+
export function resolveTwinByOpener(resolution, prior, catalog) {
|
|
1154
|
+
const weak = g(resolution, 'status') === 'unmapped' ? (g(resolution, 'weak_candidates') || []) : [];
|
|
1155
|
+
if (weak.length) { return _weakByOpener(resolution, weak, prior, catalog); }
|
|
1156
|
+
const cands = truthy(g(resolution, 'candidates')) ? resolution.candidates : [];
|
|
1157
|
+
const kind = cands.length ? g(cands[0], 'reason') : null;
|
|
1158
|
+
if (g(resolution, 'status') !== 'ambiguous' || cands.length < 2 || !['layout-twin', 'shared-title-twin'].includes(kind)
|
|
1159
|
+
|| !cands.every((c) => g(c, 'reason') === kind)) {
|
|
1160
|
+
return resolution;
|
|
1161
|
+
}
|
|
1162
|
+
const pr = g(prior || {}, 'static_resolution', {});
|
|
1163
|
+
if (g(pr, 'status') !== 'verified' || !truthy(g(pr, 'static_id'))) { return resolution; }
|
|
1164
|
+
const p = S(pr.static_id);
|
|
1165
|
+
// A shared-title twin captured again (content loaded, scrolled) is still the twin verified before
|
|
1166
|
+
// -- unless another twin is opened FROM it: then "stayed" and "navigated to the child" look the
|
|
1167
|
+
// same (measured, jingmo: riddle index and riddle read share only the title "Riddles"; after tapping
|
|
1168
|
+
// "Read more" the read page was kept as the index). Leave that ambiguous rather than guess.
|
|
1169
|
+
const childOfPrior = (c) => g(c, 'static_id') !== p
|
|
1170
|
+
&& (g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []) || []).includes(p);
|
|
1171
|
+
if (kind === 'shared-title-twin' && cands.some((c) => g(c, 'static_id') === p)) {
|
|
1172
|
+
if (cands.some(childOfPrior)) { return resolution; }
|
|
1173
|
+
const c = cands.find((x) => g(x, 'static_id') === p);
|
|
1174
|
+
return { status: 'verified', static_id: p, reason: 'shared-title-continued',
|
|
1175
|
+
anchors: [...(g(c, 'anchors', []) || []), 'continued-from:' + p] };
|
|
1176
|
+
}
|
|
1177
|
+
// The opener as recorded statically: the page itself, a menu's/panel's host page.
|
|
1178
|
+
const openers = new Set([p]);
|
|
1179
|
+
const host = panelHost(p); if (host) { openers.add(host); }
|
|
1180
|
+
const at = p.lastIndexOf('@');
|
|
1181
|
+
if (p.startsWith('menu:') && at > 0) {
|
|
1182
|
+
const owner = p.slice(at + 1);
|
|
1183
|
+
for (const ident of Object.keys(catalog)) { if (ident.split(':').pop() === owner) { openers.add(ident); } }
|
|
1184
|
+
}
|
|
1185
|
+
const hit = cands.filter((c) => g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []).some((o) => openers.has(o)));
|
|
1186
|
+
if (hit.length !== 1) { return resolution; }
|
|
1187
|
+
// The opener rule assumes the device went FORWARD from P. A shared-title twin that P itself was
|
|
1188
|
+
// opened from may be the screen just as well -- Back (or a relaunch's replay) lands on it
|
|
1189
|
+
// (measured, jingmo: back from a *_bookmarks page to its index was taken as the bookmark's *_show).
|
|
1190
|
+
if (kind === 'shared-title-twin') {
|
|
1191
|
+
const parents = new Set(g(g(catalog, p, {}), 'opened_from', []) || []);
|
|
1192
|
+
if (cands.some((c) => parents.has(g(c, 'static_id')))) { return resolution; }
|
|
1193
|
+
}
|
|
1194
|
+
return { status: 'verified', static_id: hit[0].static_id, reason: kind === 'layout-twin' ? 'layout-twin-opener' : 'shared-title-opener',
|
|
1195
|
+
anchors: [...(g(hit[0], 'anchors', []) || []), 'opened-from:' + p] };
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* A screen whose only anchor is one short unique source text (an "Add" button) is that page when
|
|
1200
|
+
* the screen just before was verified as a page with a static edge to exactly one such candidate.
|
|
1201
|
+
*/
|
|
1202
|
+
export function _weakByOpener(resolution, weak, prior, catalog) {
|
|
1203
|
+
const pr = g(prior || {}, 'static_resolution', {});
|
|
1204
|
+
if (g(pr, 'status') !== 'verified' || !truthy(g(pr, 'static_id'))) { return resolution; }
|
|
1205
|
+
const p = S(pr.static_id);
|
|
1206
|
+
// The opener, or the page itself on the capture before (its content finished loading, it
|
|
1207
|
+
// scrolled): the weak anchor is still the one it showed when verified.
|
|
1208
|
+
const hit = weak.filter((c) => g(c, 'static_id') === p
|
|
1209
|
+
|| (g(g(catalog, g(c, 'static_id'), {}), 'opened_from', []) || []).includes(p));
|
|
1210
|
+
if (hit.length !== 1) { return resolution; }
|
|
1211
|
+
const same = hit[0].static_id === p;
|
|
1212
|
+
return { status: 'verified', static_id: hit[0].static_id, reason: same ? 'weak-body-text-continued' : 'weak-body-text-opener',
|
|
1213
|
+
anchors: [...(g(hit[0], 'anchors', []) || []), (same ? 'continued-from:' : 'opened-from:') + p] };
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
export const BACK_MAX_DEPTH = 6;
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* back_can_reach(observation, target, catalog): may a Back press from this screen land on
|
|
1220
|
+
* `target`? Back can only return to a page the current one was opened from, so the target must be
|
|
1221
|
+
* a static ancestor (via `opened_from`, a menu's owner page, a panel's host) within
|
|
1222
|
+
* BACK_MAX_DEPTH hops. Unknown evidence -- screen not verified, or a catalog built without
|
|
1223
|
+
* `opened_from` -- answers true, keeping the plain Back-then-relaunch behaviour.
|
|
1224
|
+
*/
|
|
1225
|
+
export function backCanReach(observation, target, catalog) {
|
|
1226
|
+
const r = g(observation || {}, 'static_resolution', {});
|
|
1227
|
+
if (g(r, 'status') !== 'verified' || !truthy(g(r, 'static_id')) || !truthy(target)) { return true; }
|
|
1228
|
+
if (!Object.values(catalog || {}).some((p) => Array.isArray(g(p, 'opened_from')))) { return true; }
|
|
1229
|
+
const owners = (ident) => {
|
|
1230
|
+
const out = new Set(g(g(catalog, ident, {}), 'opened_from', []) || []);
|
|
1231
|
+
const host = panelHost(ident); if (host) { out.add(host); }
|
|
1232
|
+
const at = S(ident).lastIndexOf('@');
|
|
1233
|
+
if (S(ident).startsWith('menu:') && at > 0) {
|
|
1234
|
+
const owner = S(ident).slice(at + 1);
|
|
1235
|
+
for (const k of Object.keys(catalog)) { if (k.split(':').pop() === owner) { out.add(k); } }
|
|
1236
|
+
}
|
|
1237
|
+
return out;
|
|
1238
|
+
};
|
|
1239
|
+
let frontier = new Set([S(r.static_id)]); const seen = new Set(frontier);
|
|
1240
|
+
for (let d = 0; d < BACK_MAX_DEPTH && frontier.size; d++) {
|
|
1241
|
+
const next = new Set();
|
|
1242
|
+
for (const id of frontier) {
|
|
1243
|
+
for (const o of owners(id)) {
|
|
1244
|
+
if (o === target) { return true; }
|
|
1245
|
+
if (!seen.has(o)) { seen.add(o); next.add(o); }
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
frontier = next;
|
|
1249
|
+
}
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/** Kinds that are a state of a host page, not a screen: identified by `state_rules`, never by resolvePage. */
|
|
1254
|
+
export const STATE_KINDS = ['ui-state', 'mode'];
|
|
1255
|
+
|
|
1256
|
+
/** state_host(ident): `ui-state:<host id>#<name>` / `mode:<host id>#<name>` -> host id, else null. */
|
|
1257
|
+
export function stateHost(ident) {
|
|
1258
|
+
const s = S(ident);
|
|
1259
|
+
const kind = STATE_KINDS.find((k) => s.startsWith(k + ':'));
|
|
1260
|
+
if (!kind || !s.includes('#')) { return null; }
|
|
1261
|
+
const rest = s.slice(kind.length + 1);
|
|
1262
|
+
return rest.slice(0, rest.lastIndexOf('#')) || null;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/** A state anchor rule ({all, none}) with at least one positive selector, else null. */
|
|
1266
|
+
export function _stateRule(spec, id) {
|
|
1267
|
+
if (!spec || typeof spec !== 'object' || Array.isArray(spec)) { return null; }
|
|
1268
|
+
const sel = (xs) => (Array.isArray(xs) ? xs : []).filter((s) => s && typeof s === 'object' && !Array.isArray(s) && Object.keys(s).length);
|
|
1269
|
+
const all = sel(g(spec, 'all'));
|
|
1270
|
+
return all.length ? { id, all, none: sel(g(spec, 'none')) } : null;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/**
|
|
1274
|
+
* apply_state_anchors(catalog, anchors): campaign/config anchors ({<state id>: {all, none}}) replace
|
|
1275
|
+
* the static ones for that state. Returns the ids that got a rule; unknown or non-state ids are ignored.
|
|
1276
|
+
*/
|
|
1277
|
+
export function applyStateAnchors(catalog, anchors) {
|
|
1278
|
+
const applied = [];
|
|
1279
|
+
for (const [ident, spec] of Object.entries(anchors && typeof anchors === 'object' ? anchors : {})) {
|
|
1280
|
+
const item = g(catalog, ident);
|
|
1281
|
+
if (!item || !STATE_KINDS.includes(item.kind)) { continue; }
|
|
1282
|
+
const rule = _stateRule(spec, 'configured');
|
|
1283
|
+
if (!rule) { continue; }
|
|
1284
|
+
// a catalog compiled before states carried `host_node`: the id names it (`ui-state:<host>#<name>`)
|
|
1285
|
+
if (!truthy(item.host_node)) { item.host_node = stateHost(ident); }
|
|
1286
|
+
if (!truthy(item.host_node)) { continue; }
|
|
1287
|
+
item.state_rules = [rule]; applied.push(ident);
|
|
1288
|
+
}
|
|
1289
|
+
return applied;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* ui_states_of(observation, catalog): the in-page states the observation shows -- each one's host is
|
|
1294
|
+
* the page shown and its anchor rule holds on the visible, unoccluded tree. Two states of one host
|
|
1295
|
+
* holding at once say nothing about either, so neither is returned.
|
|
1296
|
+
*/
|
|
1297
|
+
export function uiStatesOf(observation, catalog) {
|
|
1298
|
+
return sortedStr([...uiStateCandidates(observation, catalog).values()].filter((ids) => ids.length === 1).flat());
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* ui_state_candidates(observation, catalog): host id -> every in-page state of that host whose anchor
|
|
1303
|
+
* rule holds on the observation (uiStatesOf keeps only hosts with exactly one). final_utg resolves the
|
|
1304
|
+
* hosts with several across the whole run: a state whose anchor holds wherever a sibling's does (its
|
|
1305
|
+
* anchor is the mode-tab strip, visible in every mode) is not evidence for itself there.
|
|
1306
|
+
*/
|
|
1307
|
+
export function uiStateCandidates(observation, catalog) {
|
|
1308
|
+
const allNodes = g(observation, 'nodes', []) || [];
|
|
1309
|
+
if (!allNodes.length) { return new Map(); }
|
|
1310
|
+
const hidden = occludedIndices(allNodes);
|
|
1311
|
+
const nodes = allNodes.map((n, i) => (vis(n) && !hidden.has(i) ? n : { parent_index: g(n, 'parent_index'), visible: false }));
|
|
1312
|
+
const byHost = new Map();
|
|
1313
|
+
for (const [ident, item] of Object.entries(catalog || {})) {
|
|
1314
|
+
if (!truthy(g(item, 'state_rules')) || !truthy(g(item, 'host_node'))) { continue; }
|
|
1315
|
+
// a state of a state is not resolved (its host check would recurse into this one)
|
|
1316
|
+
if (truthy(g(g(catalog, item.host_node, {}), 'state_rules'))) { continue; }
|
|
1317
|
+
if (!item.state_rules.some((r) => learnedRuleMatches(nodes, r))) { continue; }
|
|
1318
|
+
if (!observationMatchesStatic(observation, item.host_node, catalog)[0]) { continue; }
|
|
1319
|
+
if (!byHost.has(item.host_node)) { byHost.set(item.host_node, []); }
|
|
1320
|
+
byHost.get(item.host_node).push(ident);
|
|
1321
|
+
}
|
|
1322
|
+
for (const [h, ids] of byHost) { byHost.set(h, sortedStr(ids)); }
|
|
1323
|
+
return byHost;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* resolve_state_ambiguity(perCapture): perCapture = [{ cid, byHost: Map(host -> [state ids]) }].
|
|
1328
|
+
* Returns { assign: Map(cid -> [state ids]), nonExclusive: [{ host, state, with: [ids], captures }] }.
|
|
1329
|
+
*
|
|
1330
|
+
* A state s is non-exclusive w.r.t. a sibling t when s's anchor holds on **every** capture where
|
|
1331
|
+
* t's holds: s's anchor is chrome shown in t's mode too (measured: `course_current_tab`, the
|
|
1332
|
+
* mode-tab strip itself, anchored "My Courses" and held under Grades/Exams/Assignments too, so those three
|
|
1333
|
+
* captures matched two states, were assigned to none and fell back to the host as its "default").
|
|
1334
|
+
* The test is per sibling, so a mode that hides the strip (rows {A,B},{A,D},{C}) does not clear A.
|
|
1335
|
+
* s is weak when, over the siblings it is non-exclusive w.r.t., it co-holds on >= 2 captures: one
|
|
1336
|
+
* co-hold alone ({A},{A},{A},{A,B} with B a transient overlay of A's page) cannot tell chrome from
|
|
1337
|
+
* a coincidence, so that capture stays unassigned (ambiguous) instead of going to B. The threshold
|
|
1338
|
+
* is counted across those siblings, not per pair: each mode is often captured once (Grades/Exams/Assignments).
|
|
1339
|
+
* A weak s is dropped from a capture only where one of those siblings also holds; it keeps the
|
|
1340
|
+
* captures where it holds alone. Two states that both remain stay unassigned, as before.
|
|
1341
|
+
*/
|
|
1342
|
+
export function resolveStateAmbiguity(perCapture) {
|
|
1343
|
+
const assign = new Map();
|
|
1344
|
+
const nonExclusive = [];
|
|
1345
|
+
const hosts = new Map();
|
|
1346
|
+
for (const { cid, byHost } of perCapture) {
|
|
1347
|
+
for (const [h, ids] of byHost) {
|
|
1348
|
+
if (!hosts.has(h)) { hosts.set(h, []); }
|
|
1349
|
+
hosts.get(h).push({ cid, ids });
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
for (const [h, rows] of hosts) {
|
|
1353
|
+
const over = new Map(); // weak s -> siblings s is non-exclusive w.r.t.
|
|
1354
|
+
if (rows.some((r) => r.ids.length > 1)) {
|
|
1355
|
+
const states = sortedStr([...new Set(rows.flatMap((r) => r.ids))]);
|
|
1356
|
+
for (const s of states) {
|
|
1357
|
+
const ts = states.filter((t) => t !== s && rows.every((r) => !r.ids.includes(t) || r.ids.includes(s)));
|
|
1358
|
+
const coRows = rows.filter((r) => r.ids.includes(s) && r.ids.some((x) => ts.includes(x)));
|
|
1359
|
+
if (!ts.length || coRows.length < 2) { continue; }
|
|
1360
|
+
over.set(s, new Set(ts));
|
|
1361
|
+
nonExclusive.push({ host: h, state: s, with: ts, captures: coRows.length });
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
for (const r of rows) {
|
|
1365
|
+
let ids = r.ids;
|
|
1366
|
+
if (ids.length > 1) { ids = ids.filter((x) => !(over.has(x) && r.ids.some((t) => over.get(x).has(t)))); }
|
|
1367
|
+
if (ids.length === 1) {
|
|
1368
|
+
if (!assign.has(r.cid)) { assign.set(r.cid, []); }
|
|
1369
|
+
assign.get(r.cid).push(ids[0]);
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
for (const [c, ids] of assign) { assign.set(c, sortedStr(ids)); }
|
|
1374
|
+
return { assign, nonExclusive };
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
/** panel_host(ident): `panel:<host id>#<name>` -> host id, else null. */
|
|
1378
|
+
export function panelHost(ident) {
|
|
1379
|
+
const s = S(truthy(ident) ? ident : '');
|
|
1380
|
+
if (!s.startsWith('panel:') || !s.includes('#')) { return null; }
|
|
1381
|
+
const h = s.slice('panel:'.length);
|
|
1382
|
+
return h.slice(0, h.lastIndexOf('#')) || null;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/** observation_matches_static(observation, ident, catalog) -> [matched, how]. */
|
|
1386
|
+
export function observationMatchesStatic(observation, ident, catalog) {
|
|
1387
|
+
const resolution = g(observation, 'static_resolution', {});
|
|
1388
|
+
const verified = g(resolution, 'status') === 'verified';
|
|
1389
|
+
const rsid = g(resolution, 'static_id');
|
|
1390
|
+
if (verified && rsid === ident) { return [true, 'exact-page']; }
|
|
1391
|
+
const page = g(catalog, ident, {});
|
|
1392
|
+
if (truthy(g(page, 'state_rules')) && truthy(g(page, 'host_node'))) {
|
|
1393
|
+
// Per-observation only: a capture where two states of the host hold is a mismatch here, though
|
|
1394
|
+
// final_utg may still assign it run-wide (resolveStateAmbiguity, a non-exclusive anchor yields).
|
|
1395
|
+
return uiStatesOf(observation, catalog).includes(ident) ? [true, 'ui-state-anchor'] : [false, 'ui-state-anchor-mismatch'];
|
|
1396
|
+
}
|
|
1397
|
+
if (g(page, 'kind') === 'host-activity' && g(page, 'component') === g(observation, 'activity')) { return [true, 'host-component']; }
|
|
1398
|
+
if (verified && g(page, 'default_children', []).includes(rsid)) { return [true, 'host-default-child']; }
|
|
1399
|
+
if (verified && panelHost(rsid) === ident) { return [true, 'host-of-panel']; }
|
|
1400
|
+
const shown = verified ? g(catalog, rsid, {}) : {};
|
|
1401
|
+
if (g(shown, 'default_children', []).includes(ident)) { return [true, 'default-child-of-host']; }
|
|
1402
|
+
const ownIds = g(page, 'widget_ids', []);
|
|
1403
|
+
if (ownIds.length && truthy(shown) && g(shown, 'kind') === g(page, 'kind') && setKey(g(shown, 'widget_ids', [])) === setKey(ownIds)) {
|
|
1404
|
+
return [true, 'layout-twin'];
|
|
1405
|
+
}
|
|
1406
|
+
const cands = truthy(g(resolution, 'candidates')) ? resolution.candidates : [];
|
|
1407
|
+
if (g(resolution, 'status') === 'ambiguous' && cands.length && cands.every((c) => g(c, 'reason') === 'layout-twin')
|
|
1408
|
+
&& cands.some((c) => g(c, 'static_id') === ident)) {
|
|
1409
|
+
return [true, 'layout-twin'];
|
|
1410
|
+
}
|
|
1411
|
+
return [false, 'static-context-mismatch'];
|
|
1412
|
+
}
|