@buaa_smat/hometrans 26.0.2 → 26.0.4
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 +8 -7
- package/agents/code-reviewer.md +111 -154
- 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 +436 -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 +206 -0
- package/i18n/skills/a2h-app-migrate/references/config.example.json +28 -0
- package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -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 +2007 -0
- package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +187 -0
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1656 -0
- package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +728 -0
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +541 -0
- package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +143 -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 +713 -0
- package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +117 -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 +271 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +222 -0
- package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +136 -0
- package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +552 -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 +263 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +165 -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 +207 -0
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/i18n/skills/a2h-arch-generate/SKILL.md +378 -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 +131 -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/SKILL.md +304 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +10 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +249 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +344 -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 +877 -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 +597 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +372 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +35 -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 +85 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +23 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +89 -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 +62 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +30 -0
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +930 -0
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +420 -0
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +158 -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 +2552 -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 +175 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +251 -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 +232 -0
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +206 -0
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +232 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +2005 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +2118 -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 +1805 -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 +1959 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -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 +1632 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1300 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1234 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +417 -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 +216 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +615 -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 +49 -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/dialog_backboard.ts +91 -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/event_default_click.ts +179 -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/hit_test.ts +339 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +780 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -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 +408 -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/overlay_binds.ts +56 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +179 -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 +81 -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/relative_container_height.ts +102 -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 +147 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -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 +127 -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/swiper_index.ts +65 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +184 -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/waterflow_sections.ts +231 -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_input_runtime.test.mjs +514 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +651 -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_overlay_lottie.test.mjs +199 -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/branch_coverage.test.mjs +116 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +693 -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 +326 -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 +356 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +395 -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 +62 -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 +2050 -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 +265 -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 +239 -0
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
- package/i18n/skills/a2h-page-specgen/references/body-language.md +179 -0
- package/i18n/skills/a2h-page-specgen/references/gates.md +329 -0
- package/i18n/skills/a2h-page-specgen/references/page-inventory.md +220 -0
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +210 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +1613 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +1650 -0
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +864 -0
- package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +346 -0
- package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +155 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +684 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +252 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +864 -0
- package/i18n/skills/a2h-page-specgen/scripts/render.mjs +276 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +897 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +205 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1205 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +271 -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/uniapp-source/App.vue +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -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 +1029 -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 +143 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +1121 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +188 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +549 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +368 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +348 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +250 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +776 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1103 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +240 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +427 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -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 +418 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1782 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +536 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +1239 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -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 +1801 -0
- package/i18n/skills/a2h-resource-convert/SKILL.md +375 -0
- package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +336 -0
- package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +272 -0
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +226 -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 +251 -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 +2596 -0
- package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +238 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +358 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +266 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +55 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +752 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +661 -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 +126 -0
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +282 -0
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +908 -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/hybrid_route_cdp.mjs +376 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_b.mjs +550 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +647 -0
- package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -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/diagnostics.test.mjs +252 -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/hybrid_route_identity.test.mjs +146 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +614 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +214 -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/seed_recipes.test.mjs +261 -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/diagnostics.mjs +196 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1562 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +2714 -0
- package/i18n/skills/a2h-utg-static/SKILL.md +372 -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 +2190 -0
- package/i18n/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +720 -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/data_model.mjs +590 -0
- package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/i18n/skills/a2h-utg-static/scripts/fragment_nav.mjs +1137 -0
- package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +705 -0
- package/i18n/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +958 -0
- package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +545 -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 +125 -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_data_model.mjs +120 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -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_provenance.mjs +150 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +457 -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 +78 -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_routes.mjs +161 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +330 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -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 +1394 -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 +11 -161
- 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 +31 -12
- package/skills/a2h-app-migrate/references/config.example.json +1 -0
- package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +427 -103
- package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -6
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
- package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +178 -44
- package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +81 -11
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +80 -10
- package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +72 -12
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +137 -41
- package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
- package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
- package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
- 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 +143 -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 +713 -0
- package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +117 -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_incremental_acceptance.mjs +145 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
- package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +101 -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 +150 -0
- package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +86 -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 +271 -0
- package/skills/a2h-app-migrate/test/test_resume_summary.mjs +222 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +136 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +552 -0
- package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -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 +155 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +263 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +165 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +511 -0
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +65 -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 +214 -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 +20 -17
- 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 +25 -14
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +2 -2
- package/skills/a2h-arch-generate/references/source-baseline.md +4 -4
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
- package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +35 -46
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
- 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 +208 -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 +164 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +2 -5
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +163 -15
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +3 -1
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +120 -1
- package/skills/a2h-arkts-logic-coder/references/spec-design.md +46 -11
- 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 +873 -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 +596 -0
- package/skills/a2h-batch-ui-align/SKILL.md +78 -26
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +6 -1
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
- package/skills/a2h-batch-ui-align/references/cards/resources.md +9 -3
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +27 -3
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
- package/skills/a2h-batch-ui-align/references/checker-rules.md +301 -13
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +53 -13
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +14 -9
- 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/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
- package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +30 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +7 -2
- package/skills/a2h-batch-ui-align/references/step5-convert.md +33 -9
- package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +6 -7
- package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +463 -22
- package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
- package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
- package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
- package/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +263 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +20 -3
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +4 -5
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +220 -35
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +517 -41
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +231 -54
- package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +239 -14
- package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +98 -11
- package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +118 -4
- package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
- package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +1 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +61 -12
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +32 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
- 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/attr_chain.ts +1 -19
- 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/dialog_backboard.ts +91 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- 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/hit_test.ts +339 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- 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 +110 -12
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +179 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
- 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/relative_container_height.ts +102 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
- 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/swiper_index.ts +65 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +184 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
- 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 +30 -2
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +231 -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_baseline.test.mjs +129 -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_coolmall_runtime2.test.mjs +697 -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_hit_test.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +651 -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_overlay_lottie.test.mjs +199 -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 +269 -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_runtime_api.test.mjs +346 -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_theme_runtime.test.mjs +95 -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/branch_coverage.test.mjs +116 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +693 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +291 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +93 -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 +435 -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/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -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_pack_evidence.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1782 -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/icon_coverage.test.mjs +314 -0
- package/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
- package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +326 -0
- package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +356 -0
- package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +302 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
- package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +60 -0
- package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +395 -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-coldstart-smoke-gate/SKILL.md +7 -4
- 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_device_locale_dialogs.mjs +17 -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/SKILL.md +51 -13
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
- 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_incremental_fingerprint.mjs +94 -0
- package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/skills/a2h-page-specgen/SKILL.md +240 -0
- package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
- package/skills/a2h-page-specgen/references/body-language.md +179 -0
- package/skills/a2h-page-specgen/references/evidence.md +105 -0
- package/skills/a2h-page-specgen/references/execution-model.md +364 -0
- package/skills/a2h-page-specgen/references/footprint-and-grouping.md +255 -0
- package/skills/a2h-page-specgen/references/gates.md +323 -0
- package/skills/a2h-page-specgen/references/page-inventory.md +220 -0
- package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
- package/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/skills/a2h-page-specgen/references/spec-template.md +210 -0
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/skills/a2h-page-specgen/scripts/dispatch.mjs +212 -0
- package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/skills/a2h-page-specgen/scripts/facts-build.mjs +1613 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +825 -0
- package/skills/a2h-page-specgen/scripts/footprint.mjs +1650 -0
- package/skills/a2h-page-specgen/scripts/gate.mjs +848 -0
- package/skills/a2h-page-specgen/scripts/interactions.mjs +344 -0
- package/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +155 -0
- package/skills/a2h-page-specgen/scripts/lib/deps-source.mjs +399 -0
- package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +229 -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/graph-evidence.mjs +235 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +683 -0
- package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +478 -0
- package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/skills/a2h-page-specgen/scripts/lib/prose.mjs +238 -0
- package/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
- package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
- package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -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/operation-evidence.mjs +1542 -0
- package/skills/a2h-page-specgen/scripts/prepare.mjs +840 -0
- package/skills/a2h-page-specgen/scripts/render.mjs +294 -0
- package/skills/a2h-page-specgen/scripts/report.mjs +340 -0
- package/skills/a2h-page-specgen/scripts/submission.mjs +697 -0
- package/skills/a2h-page-specgen/scripts/submit.mjs +85 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/README.md +77 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +871 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/cases.example.json +57 -0
- package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +205 -0
- package/skills/a2h-page-specgen/scripts/test/dispatch.test.mjs +258 -0
- package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1203 -0
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +243 -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 +112 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/MainFragment.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -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/src/RefreshOnResume.java +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -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 +1029 -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 +143 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +1078 -0
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/skills/a2h-page-specgen/scripts/test/helpers.mjs +188 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +549 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +368 -0
- package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +310 -0
- package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +250 -0
- package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +776 -0
- package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +464 -0
- package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1103 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +160 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +236 -0
- package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +398 -0
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
- package/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +418 -0
- package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1782 -0
- package/skills/a2h-page-specgen/scripts/test/render.test.mjs +546 -0
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
- package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
- package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/skills/a2h-page-specgen/scripts/test/source-text.test.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +1231 -0
- package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -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 +1801 -0
- package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +1993 -0
- package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +342 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +1301 -0
- package/skills/a2h-page-specgen/scripts/watchdog.mjs +299 -0
- package/skills/a2h-resource-convert/SKILL.md +9 -1
- package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +115 -53
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
- package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
- package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
- package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
- package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
- 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/code_vector_guard.test.mjs +75 -0
- package/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
- package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +98 -121
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +170 -45
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +62 -12
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -4
- package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +49 -6
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +198 -54
- package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +67 -0
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +47 -14
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +390 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +148 -29
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +104 -24
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +18 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +16 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/platform/ExtraDataSubCheck.js +485 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +13 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +18 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +12 -38
- package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +95 -7
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +156 -7
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +71 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +22 -3
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +33 -3
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +2 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +232 -13
- package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
- package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +220 -44
- 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 +178 -14
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +3 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +368 -0
- package/skills/a2h-spec-design-pipeline/scripts/scan_shared.ts +642 -0
- package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +42 -8
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +27 -9
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +242 -9
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +192 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +531 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +49 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +51 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +17 -10
- package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +14 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +401 -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 +165 -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 +89 -23
- 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/specs.schema.json +24 -11
- 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/ensure-index.mjs +1 -2
- 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 +229 -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/SKILL.md +9 -3
- package/skills/a2h-utg-explorer/references/architecture.md +7 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +120 -85
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +1 -2
- package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +5 -3
- package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
- package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -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/default_override.test.mjs +109 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +160 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -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/diagnostics.test.mjs +254 -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/foreground_spelling.test.mjs +155 -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/hybrid_route.test.mjs +120 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +614 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +214 -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/pr169_review_fixes.test.mjs +218 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -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/recover_d_grounding.test.mjs +164 -0
- package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -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 +458 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -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/seed_recipes.test.mjs +261 -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 +135 -7
- package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +245 -69
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +164 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
- package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
- package/skills/a2h-utg-static/SKILL.md +6 -2
- package/skills/a2h-utg-static/scripts/assemble.mjs +93 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +135 -25
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +110 -3
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
- package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +2 -3
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
- package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +34 -7
- 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/run_pipeline.mjs +86 -4
- 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_carry_answers.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
- package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
- package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +29 -1
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -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/ensure_wt_index.ts +0 -885
- 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_ensure_wt_index.ts +0 -856
- 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,1632 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* measure_pack.ts — moves the reference measurements that "every page recomputes" up into the parent flow, computed once.
|
|
3
|
+
*
|
|
4
|
+
* Usage (Node >= 22.18 / 23.6 native type stripping, no compilation, no external dependencies):
|
|
5
|
+
* node measure_pack.ts --ui-info <page_NNNN_X dir> [--out <file.json>] [--quiet]
|
|
6
|
+
* (also writes a UTF-8 measure_summary.txt into the --out directory; do not generate it via shell redirection)
|
|
7
|
+
*
|
|
8
|
+
* ── Why it exists ────────────────────────────────────────────────────────────
|
|
9
|
+
* One measured single-page conversion (96 tool calls / 61.4 min): **actual tool execution totalled 17.9 s, 0.5%**,
|
|
10
|
+
* while "model thinking + generation after receiving tool results" took 71.3% (96 rounds × mean 27.4 s).
|
|
11
|
+
* In other words cost ≈ rounds × per-round latency, so cutting rounds is the only meaningful speed-up.
|
|
12
|
+
*
|
|
13
|
+
* In that run the sub-agent spent 11 rounds of PIL (about 5 min) measuring density, ink bbox and colors.
|
|
14
|
+
* These measurements have two properties: (a) **identical on every page** for the same capture device, (b) criteria are pure arithmetic and reproducible.
|
|
15
|
+
* So they belong to "computed once on the parent side, amortized across the batch", not recomputed over several rounds per page.
|
|
16
|
+
*
|
|
17
|
+
* ── Responsibility boundary (important) ──────────────────────────────────────────────────────
|
|
18
|
+
* This script **only measures and computes, it does not judge**. It does not infer immersion, anchoring direction, or grade icons —
|
|
19
|
+
* those require reading Android source and constraint declarations back, which is Phase 4/5's job.
|
|
20
|
+
* Every output value carries a `source` field naming its origin, so sub-agents can cite it and the parent side can re-check it.
|
|
21
|
+
*
|
|
22
|
+
* See: conversion-procedure.md Phase 4.1 "LAYOUT_EVIDENCE" and Phase 4.2 "Coordinate and window-mode rules".
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import * as fs from 'fs';
|
|
26
|
+
import * as path from 'path';
|
|
27
|
+
// Static import, not require: under Node's native type stripping this file is treated as ESM and require is undefined.
|
|
28
|
+
// require would make PNG decoding fail entirely, and the failure sits inside a try/catch — the symptom is that density is computed
|
|
29
|
+
// while image/edge_colors/ink are all empty, easily mistaken for "the screenshot is broken".
|
|
30
|
+
import * as zlib from 'zlib';
|
|
31
|
+
import { coveredBy, xmlRow } from './occlusion.mjs';
|
|
32
|
+
|
|
33
|
+
// measure_summary labels share one column: 10 display columns (a CJK character counts 2) in zh,
|
|
34
|
+
// 15 in en so the longer English labels ("text right edge") still line up.
|
|
35
|
+
const SUMMARY_EN: boolean = true;
|
|
36
|
+
const LABEL_W: number = SUMMARY_EN ? 15 : 10;
|
|
37
|
+
function col(label: string): string {
|
|
38
|
+
const w: number = [...label].reduce((n, ch) => n + (/[\u3000-\u9fff\uff00-\uffef]/.test(ch) ? 2 : 1), 0);
|
|
39
|
+
return label + ' '.repeat(Math.max(0, LABEL_W - w));
|
|
40
|
+
}
|
|
41
|
+
/** An evidence name as the docs quote it: 「name」 in zh, "name" in en. */
|
|
42
|
+
const quoteName = (s: string): string => (SUMMARY_EN ? `"${s}"` : `「${s}」`);
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------- types
|
|
45
|
+
|
|
46
|
+
interface Node {
|
|
47
|
+
idx: number;
|
|
48
|
+
cls: string;
|
|
49
|
+
text: string;
|
|
50
|
+
rid: string;
|
|
51
|
+
desc: string;
|
|
52
|
+
clickable: boolean;
|
|
53
|
+
scrollable: boolean;
|
|
54
|
+
enabled: boolean;
|
|
55
|
+
checkable: boolean;
|
|
56
|
+
checked: boolean;
|
|
57
|
+
x1: number;
|
|
58
|
+
y1: number;
|
|
59
|
+
x2: number;
|
|
60
|
+
y2: number;
|
|
61
|
+
w: number;
|
|
62
|
+
h: number;
|
|
63
|
+
/** Index in the returned array of the nearest ancestor with bounds; null for the root. */
|
|
64
|
+
parent: number | null;
|
|
65
|
+
/** Input row of the occlusion criterion (occlusion.mjs xmlRow). */
|
|
66
|
+
row: ReturnType<typeof xmlRow>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface Png {
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
/** RGBA, 4 bytes per pixel */
|
|
73
|
+
px: Uint8Array;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface InkBox {
|
|
77
|
+
x1: number;
|
|
78
|
+
y1: number;
|
|
79
|
+
x2: number;
|
|
80
|
+
y2: number;
|
|
81
|
+
w: number;
|
|
82
|
+
h: number;
|
|
83
|
+
cx: number;
|
|
84
|
+
cy: number;
|
|
85
|
+
/**
|
|
86
|
+
* Set when the background is uneven (gradient/image). This ink bbox is then **untrustworthy** —
|
|
87
|
+
* the "differs from background" criterion also counts the gradient itself as ink, so the result is often the whole region.
|
|
88
|
+
*/
|
|
89
|
+
unreliable?: boolean;
|
|
90
|
+
reason?: string;
|
|
91
|
+
/** Span of the four corners on the worst channel. 0 means a solid background; larger means more likely a gradient/image. */
|
|
92
|
+
bgSpread?: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ---------------------------------------------------------------- view.xml
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Parse a uiautomator dump. Regex rather than an XML parser: the format mixes flat <node .../> and nested
|
|
99
|
+
* <node ...>, the attribute set is fixed, so a regex suffices with no dependency. Attribute order cannot be assumed; each is taken by name.
|
|
100
|
+
*/
|
|
101
|
+
function parseNodes(xml: string): Node[] {
|
|
102
|
+
const out: Node[] = [];
|
|
103
|
+
const re = /<node ([^>]*?)(\/?)>|<\/node>/g;
|
|
104
|
+
// Open <node>: a node without bounds is represented by its nearest ancestor with bounds, and its children attach there
|
|
105
|
+
const open: (number | null)[] = [];
|
|
106
|
+
let m: RegExpExecArray | null;
|
|
107
|
+
let i = 0;
|
|
108
|
+
while ((m = re.exec(xml)) !== null) {
|
|
109
|
+
if (m[1] === undefined) {
|
|
110
|
+
open.pop();
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const a: string = m[1];
|
|
114
|
+
const selfClosing: boolean = m[2] === '/';
|
|
115
|
+
const get = (k: string): string => {
|
|
116
|
+
const r = new RegExp(k + '="([^"]*)"').exec(a);
|
|
117
|
+
return r ? r[1] : '';
|
|
118
|
+
};
|
|
119
|
+
const parent: number | null = open.length ? open[open.length - 1] : null;
|
|
120
|
+
const b = /bounds="\[(-?\d+),(-?\d+)\]\[(-?\d+),(-?\d+)\]"/.exec(a);
|
|
121
|
+
if (!b) {
|
|
122
|
+
i++;
|
|
123
|
+
if (!selfClosing) { open.push(parent); }
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const x1: number = parseInt(b[1], 10);
|
|
127
|
+
const y1: number = parseInt(b[2], 10);
|
|
128
|
+
const x2: number = parseInt(b[3], 10);
|
|
129
|
+
const y2: number = parseInt(b[4], 10);
|
|
130
|
+
const n: Node = {
|
|
131
|
+
idx: i++,
|
|
132
|
+
cls: get('class'),
|
|
133
|
+
text: get('text'),
|
|
134
|
+
rid: get('resource-id'),
|
|
135
|
+
desc: get('content-desc'),
|
|
136
|
+
clickable: get('clickable') === 'true',
|
|
137
|
+
scrollable: get('scrollable') === 'true',
|
|
138
|
+
enabled: get('enabled') === 'true',
|
|
139
|
+
checkable: get('checkable') === 'true',
|
|
140
|
+
checked: get('checked') === 'true',
|
|
141
|
+
x1, y1, x2, y2,
|
|
142
|
+
w: x2 - x1,
|
|
143
|
+
h: y2 - y1,
|
|
144
|
+
parent,
|
|
145
|
+
row: xmlRow(get, parent)
|
|
146
|
+
};
|
|
147
|
+
out.push(n);
|
|
148
|
+
if (!selfClosing) { open.push(out.length - 1); }
|
|
149
|
+
}
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ---------------------------------------------------------------- occlusion
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Node fully covered by an upper sibling branch → the covering node. Criterion shared with export_ui_info.mjs
|
|
157
|
+
* (occlusion.mjs): in single-Activity apps a new page stacked on an old Fragment leaves the old Fragment's
|
|
158
|
+
* nodes in the dump with `visible-to-user="true"`; unless excluded, color sampling measures the upper layer's pixels (measured: weather
|
|
159
|
+
* settings page reported "#000000 on #000000" for 30+ regions). uiautomator does not tell whether a background is opaque,
|
|
160
|
+
* and a full-screen transparent layer with content would be misjudged, so nodes are only flagged, not removed.
|
|
161
|
+
*/
|
|
162
|
+
function occluders(nodes: Node[]): Map<Node, Node> {
|
|
163
|
+
const hit: Map<number, number> = coveredBy(nodes.map((n) => n.row));
|
|
164
|
+
return new Map([...hit].map(([i, o]) => [nodes[i], nodes[o]]));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ---------------------------------------------------------------- density inference
|
|
168
|
+
|
|
169
|
+
interface DensityEvidence {
|
|
170
|
+
node: number;
|
|
171
|
+
sidePx: number;
|
|
172
|
+
dp: number;
|
|
173
|
+
density: number;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface KnownDensity {
|
|
177
|
+
value: number;
|
|
178
|
+
/** 'device' = true value recorded via `wm density` in meta.json at capture time / 'cli' = passed explicitly via --density */
|
|
179
|
+
source: 'device' | 'cli';
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface ScreenSize {
|
|
183
|
+
widthPx: number;
|
|
184
|
+
heightPx: number;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
interface DensityResult {
|
|
188
|
+
density: number | null;
|
|
189
|
+
/** 'device' = meta.json true value / 'cli' = passed explicitly via --density / 'inferred' = inferred from node side lengths */
|
|
190
|
+
source: 'device' | 'cli' | 'inferred';
|
|
191
|
+
/** Whether the inference is trustworthy: hits >= 2 distinct dp sizes and clearly beats the runner-up. Always true for true-value sources. */
|
|
192
|
+
confident: boolean;
|
|
193
|
+
/** Runner-up candidate (usually the harmonic alias). null = no competitor. */
|
|
194
|
+
rival: { density: number; hits: number } | null;
|
|
195
|
+
/** Warning when the true value conflicts with inference, or when the gate was relaxed; normally null. */
|
|
196
|
+
crosscheck: string | null;
|
|
197
|
+
/** When the inference is null or low-confidence, explains **why** — otherwise the caller only sees a number/empty value and cannot act on it. */
|
|
198
|
+
reason: string | null;
|
|
199
|
+
evidence: DensityEvidence[];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Standard density buckets. Includes 1.75 (280dpi) and 3.2 — both exist on real devices; omitting them yields confidently wrong values. */
|
|
203
|
+
const STD_DENSITIES: number[] = [1, 1.5, 1.75, 2, 2.25, 2.5, 2.625, 2.75, 3, 3.2, 3.5, 4];
|
|
204
|
+
/** Intrinsic Material/AndroidX size steps (dp). */
|
|
205
|
+
const COMMON_DP: number[] = [16, 20, 24, 28, 32, 36, 40, 44, 48, 56, 64, 72, 80, 96];
|
|
206
|
+
|
|
207
|
+
interface DensityScore {
|
|
208
|
+
d: number;
|
|
209
|
+
hits: number;
|
|
210
|
+
residual: number;
|
|
211
|
+
dpKinds: number;
|
|
212
|
+
std: boolean;
|
|
213
|
+
evidence: DensityEvidence[];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Score each candidate density. `sides` is already deduplicated by **distinct side length** (see deriveDensity).
|
|
218
|
+
*
|
|
219
|
+
* Ranking: hit count → standard bucket → residual → **larger density first**.
|
|
220
|
+
* The last criterion cannot be reversed: a smaller density can always alias the same px with a larger dp (px=72 → 72dp@1.0),
|
|
221
|
+
* and breaking ties toward the smaller density is exactly why the old implementation judged 3.0/2.0 as 1.0.
|
|
222
|
+
*/
|
|
223
|
+
function scoreDensities(
|
|
224
|
+
sides: { px: number; idx: number }[], shortPx: number, longPx: number, useGate: boolean
|
|
225
|
+
): DensityScore[] {
|
|
226
|
+
const cands: Set<number> = new Set(STD_DENSITIES);
|
|
227
|
+
// The candidate table cannot be hard-coded: buckets "derived back from the data itself" are added too, to cover non-standard buckets and
|
|
228
|
+
// devices with a modified `wm density`. Off-table, the old implementation did not report "cannot measure" but gave a confidently wrong value.
|
|
229
|
+
for (const s of sides) {
|
|
230
|
+
for (const dp of COMMON_DP) {
|
|
231
|
+
const dd: number = Math.round((s.px / dp) * 1000) / 1000;
|
|
232
|
+
if (dd >= 0.9 && dd <= 4.5) { cands.add(dd); }
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const out: DensityScore[] = [];
|
|
236
|
+
for (const d of [...cands].sort((a, b) => a - b)) {
|
|
237
|
+
// Screen-size sanity gate — node sizes can only pin density to a **harmonic family** (px=72 is
|
|
238
|
+
// explained equally by 24dp@3.0 / 36dp@2.0 / 48dp@1.5 / 72dp@1.0, pure arithmetic cannot tell them apart);
|
|
239
|
+
// the only independent information is that the screen converted to dp must physically exist. Both edges must be gated; the short edge alone is not enough
|
|
240
|
+
// (see the 1080x2274 counterexample in the deriveDensity comment below).
|
|
241
|
+
if (useGate && shortPx > 0 && longPx > 0) {
|
|
242
|
+
const sDp: number = shortPx / d;
|
|
243
|
+
const lDp: number = longPx / d;
|
|
244
|
+
if (sDp < 300 || sDp > 840) { continue; }
|
|
245
|
+
if (lDp < 480 || lDp > 1400) { continue; }
|
|
246
|
+
}
|
|
247
|
+
let residual: number = 0;
|
|
248
|
+
const dpKinds: Set<number> = new Set();
|
|
249
|
+
const evidence: DensityEvidence[] = [];
|
|
250
|
+
for (const s of sides) {
|
|
251
|
+
let bestR: number = Infinity;
|
|
252
|
+
let bestDp: number = 0;
|
|
253
|
+
for (const dp of COMMON_DP) {
|
|
254
|
+
// Compare in **px space** with ±1px tolerance: Android uses px = round(dp × density), so the inferred
|
|
255
|
+
// dp error can reach 0.5/d. A fixed small tolerance in dp space would wrongly reject many true hits for non-integer densities,
|
|
256
|
+
// while integer densities never suffer — a systematic bias toward 1/2/3/4.
|
|
257
|
+
const r: number = Math.abs(s.px - Math.round(dp * d));
|
|
258
|
+
if (r < bestR) { bestR = r; bestDp = dp; }
|
|
259
|
+
}
|
|
260
|
+
if (bestR <= 1) {
|
|
261
|
+
residual += bestR;
|
|
262
|
+
dpKinds.add(bestDp);
|
|
263
|
+
evidence.push({ node: s.idx, sidePx: s.px, dp: bestDp, density: d });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (evidence.length > 0) {
|
|
267
|
+
out.push({ d, hits: evidence.length, residual, dpKinds: dpKinds.size, std: STD_DENSITIES.includes(d), evidence });
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// Merge candidates within a relative distance <= 1.5% into one cluster — they describe the **same physical density**, differing only by
|
|
271
|
+
// round() noise. The cluster representative prefers a standard bucket, otherwise a three-decimal pseudo-bucket would beat the true value.
|
|
272
|
+
out.sort((a, b) => a.d - b.d);
|
|
273
|
+
const clusters: DensityScore[] = [];
|
|
274
|
+
let group: DensityScore[] = [];
|
|
275
|
+
const flush = (): void => {
|
|
276
|
+
if (group.length === 0) { return; }
|
|
277
|
+
const stdReps: DensityScore[] = group.filter((g) => g.std);
|
|
278
|
+
const rep: DensityScore = stdReps.length > 0 ? stdReps[0]
|
|
279
|
+
: [...group].sort((a, b) => b.hits - a.hits || a.residual - b.residual || b.d - a.d)[0];
|
|
280
|
+
const bestHits: DensityScore = [...group].sort((a, b) => b.hits - a.hits)[0];
|
|
281
|
+
clusters.push({
|
|
282
|
+
d: rep.d,
|
|
283
|
+
hits: bestHits.hits,
|
|
284
|
+
residual: Math.min(...group.map((g) => g.residual)),
|
|
285
|
+
dpKinds: Math.max(...group.map((g) => g.dpKinds)),
|
|
286
|
+
std: group.some((g) => g.std),
|
|
287
|
+
evidence: rep.hits >= bestHits.hits ? rep.evidence : bestHits.evidence
|
|
288
|
+
});
|
|
289
|
+
group = [];
|
|
290
|
+
};
|
|
291
|
+
for (const c of out) {
|
|
292
|
+
if (group.length > 0 && (c.d - group[group.length - 1].d) / group[group.length - 1].d > 0.015) {
|
|
293
|
+
flush();
|
|
294
|
+
}
|
|
295
|
+
group.push(c);
|
|
296
|
+
}
|
|
297
|
+
flush();
|
|
298
|
+
// Hit count → **standard bucket** → residual → larger density first.
|
|
299
|
+
// Standard bucket must rank before residual: a data-derived candidate always has residual 0 on the px that produced it,
|
|
300
|
+
// so comparing residual first lets the pseudo-bucket and its harmonics beat the true value together. Larger-density-first cannot be reversed either: a smaller density can always
|
|
301
|
+
// alias the same px with a larger dp (px=72 → 72dp@1.0).
|
|
302
|
+
clusters.sort((a, b) =>
|
|
303
|
+
b.hits - a.hits ||
|
|
304
|
+
(b.std ? 1 : 0) - (a.std ? 1 : 0) ||
|
|
305
|
+
a.residual - b.residual ||
|
|
306
|
+
b.d - a.d);
|
|
307
|
+
return clusters;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Determine screen density: **use the true value when there is one**, infer from bounds only otherwise.
|
|
312
|
+
*
|
|
313
|
+
* The true value (`device_info.density` in `meta.json`, recorded by page_capture.mjs via `wm density` at capture time;
|
|
314
|
+
* or passed explicitly via `--density`) wins, because inference is mathematically non-unique — once wrong, every vp on the page is off by
|
|
315
|
+
* 2~3x, while compilation, reference checks and cross-page consistency all still pass (every page is equally wrong): the hardest kind of defect to attribute.
|
|
316
|
+
*
|
|
317
|
+
* Inference only looks at **square** nodes: rectangle width/height mostly come from constraint solving, not declared values. The four hard rules are in
|
|
318
|
+
* the scoreDensities comment (score by distinct side length / ±1px in px space / screen-width gate / candidate table not hard-coded).
|
|
319
|
+
*
|
|
320
|
+
* Outputs evidence + confident + rival rather than a single number — Phase 5 requires every size to be traceable,
|
|
321
|
+
* and a "5-way tie" must look different in the output from a "12:2 landslide".
|
|
322
|
+
*/
|
|
323
|
+
function deriveDensity(nodes: Node[], known: KnownDensity | null, screen: ScreenSize | null): DensityResult {
|
|
324
|
+
// Deduplicate by **distinct side length**: 10 same-size toolbar icons provide 1 piece of evidence, not 10.
|
|
325
|
+
// Scoring by node count would push all aliasing candidates to 10 together, locking the tie and falling to the smallest density.
|
|
326
|
+
// Tolerate a 1px non-square error: round() + constraint solving occasionally makes a view declared square come out 63x64.
|
|
327
|
+
const seen: Set<number> = new Set();
|
|
328
|
+
const sides: { px: number; idx: number }[] = [];
|
|
329
|
+
for (const n of nodes) {
|
|
330
|
+
if (n.w <= 0 || Math.abs(n.w - n.h) > 1) { continue; }
|
|
331
|
+
const p: number = Math.max(n.w, n.h);
|
|
332
|
+
if (seen.has(p)) { continue; }
|
|
333
|
+
seen.add(p);
|
|
334
|
+
sides.push({ px: p, idx: n.idx });
|
|
335
|
+
}
|
|
336
|
+
// Screen size prefers meta.json's device_info (the `wm size` true value at capture time); only without it use the node bounding box —
|
|
337
|
+
// uiautomator only dumps the focused window, so a dialog page's bounding box is **not the full screen** and the gate would misjudge.
|
|
338
|
+
const boundsW: number = nodes.length > 0 ? Math.max(...nodes.map((n) => n.x2)) : 0;
|
|
339
|
+
const boundsH: number = nodes.length > 0 ? Math.max(...nodes.map((n) => n.y2)) : 0;
|
|
340
|
+
const scrW: number = screen ? screen.widthPx : boundsW;
|
|
341
|
+
const scrH: number = screen ? screen.heightPx : boundsH;
|
|
342
|
+
const shortPx: number = Math.min(scrW, scrH);
|
|
343
|
+
const longPx: number = Math.max(scrW, scrH);
|
|
344
|
+
|
|
345
|
+
// Without square nodes inference has nothing to work with — but **the true value is still usable** and must not be dropped just because it cannot be cross-validated.
|
|
346
|
+
if (sides.length === 0) {
|
|
347
|
+
if (known) {
|
|
348
|
+
return {
|
|
349
|
+
density: known.value, source: known.source, confident: true,
|
|
350
|
+
rival: null, crosscheck: null, evidence: [],
|
|
351
|
+
reason: `no square node in the view tree (${nodes.length} in total), so the true value cannot be verified by back-substitution — ` +
|
|
352
|
+
'the value itself is trustworthy, but this page has no density evidence row to cite'
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
density: null, source: 'inferred', confident: false, rival: null, crosscheck: null,
|
|
357
|
+
evidence: [],
|
|
358
|
+
reason: `no square node in the view tree (${nodes.length} nodes in total), cannot infer the density — ` +
|
|
359
|
+
'pass it explicitly with `--density <value>` (`adb shell wm density` shows it), ' +
|
|
360
|
+
'or re-run the capture so device_info.density is written into meta.json. ' +
|
|
361
|
+
'Without a density every vp field of this pack is null and the downstream size gate silently skips the whole page.'
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
let scored: DensityScore[] = scoreDensities(sides, shortPx, longPx, true);
|
|
366
|
+
let gateRelaxed: boolean = false;
|
|
367
|
+
if (scored.length === 0) {
|
|
368
|
+
// In dialog/split-screen/PiP dumps the bounding box is not the full screen and the gate may filter out every candidate — relax and retry with lower confidence
|
|
369
|
+
scored = scoreDensities(sides, shortPx, longPx, false);
|
|
370
|
+
gateRelaxed = true;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const top: DensityScore | null = scored[0] ?? null;
|
|
374
|
+
const rival: DensityScore | null = top
|
|
375
|
+
? (scored.find((s) => Math.abs(s.d - top.d) / top.d > 0.02) ?? null)
|
|
376
|
+
: null;
|
|
377
|
+
const rivalOut: { density: number; hits: number } | null =
|
|
378
|
+
rival ? { density: rival.d, hits: rival.hits } : null;
|
|
379
|
+
// Enforce "two independent hits are needed to support a density conclusion": must hit two **distinct dp sizes**,
|
|
380
|
+
// and clearly beat the nearest non-family candidate (more hits, or smaller residual).
|
|
381
|
+
const inferredConfident: boolean = !!top && !gateRelaxed && top.dpKinds >= 2 &&
|
|
382
|
+
(!rival || rival.hits < top.hits || rival.residual > top.residual);
|
|
383
|
+
|
|
384
|
+
if (known) {
|
|
385
|
+
const match: DensityScore | undefined =
|
|
386
|
+
scored.find((s) => Math.abs(s.d - known.value) / known.value <= 0.02);
|
|
387
|
+
let crosscheck: string | null = null;
|
|
388
|
+
if (top && inferredConfident && Math.abs(top.d - known.value) / known.value > 0.02) {
|
|
389
|
+
crosscheck = `true value ${known.value} (${known.source}) disagrees with the node inference ${top.d}` +
|
|
390
|
+
` (${top.hits}/${sides.length} hits, ${top.dpKinds} dp steps) — ` +
|
|
391
|
+
'check that meta.json and view.xml come from the same capture and that wm density was not run after it';
|
|
392
|
+
}
|
|
393
|
+
return {
|
|
394
|
+
density: known.value,
|
|
395
|
+
source: known.source,
|
|
396
|
+
confident: true,
|
|
397
|
+
rival: rivalOut,
|
|
398
|
+
crosscheck,
|
|
399
|
+
evidence: (match?.evidence ?? top?.evidence ?? []).slice(0, 8),
|
|
400
|
+
reason: match ? null : 'no square node verifies the true value by back-substitution (this page\'s size steps may not be in COMMON_DP); the true value itself is still trustworthy'
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
let reason: string | null = null;
|
|
404
|
+
if (!top) {
|
|
405
|
+
reason = `none of the ${sides.length} distinct side lengths fits a common dp step, cannot infer the density — pass it explicitly with --density`;
|
|
406
|
+
} else if (!inferredConfident) {
|
|
407
|
+
reason = top.dpKinds < 2
|
|
408
|
+
? `only 1 dp step hit (${top.evidence.length} side lengths), not enough to fix the step — ` +
|
|
409
|
+
'the same px values are self-consistent across the whole harmonic family; use --density or re-capture to write device_info.density'
|
|
410
|
+
: rival
|
|
411
|
+
? `runner-up ${rival.d} is about as good (hits ${rival.hits} vs ${top.hits}, residual ${rival.residual} vs ${top.residual})`
|
|
412
|
+
: 'did not pass the confidence criterion';
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
density: top ? top.d : null,
|
|
416
|
+
source: 'inferred',
|
|
417
|
+
confident: inferredConfident,
|
|
418
|
+
rival: rivalOut,
|
|
419
|
+
crosscheck: null,
|
|
420
|
+
reason,
|
|
421
|
+
evidence: (top?.evidence ?? []).slice(0, 8)
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// ---------------------------------------------------------------- PNG decoding
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Minimal PNG decoder: zlib inflate + per-row unfiltering. Only supports 8-bit non-interlaced
|
|
429
|
+
* grayscale/RGB/palette/grayscale+A/RGBA (colorType 0/2/3/4/6).
|
|
430
|
+
*
|
|
431
|
+
* Unsupported variants **throw explicitly with a PIL fallback command**, never silently degrade —
|
|
432
|
+
* a measurer that quietly returns wrong pixels is more dangerous than no measurer at all.
|
|
433
|
+
*/
|
|
434
|
+
function decodePng(file: string): Png {
|
|
435
|
+
const buf: Buffer = fs.readFileSync(file);
|
|
436
|
+
const SIG: number[] = [137, 80, 78, 71, 13, 10, 26, 10];
|
|
437
|
+
for (let i = 0; i < 8; i++) {
|
|
438
|
+
if (buf[i] !== SIG[i]) {
|
|
439
|
+
throw new Error(`not a PNG file: ${file}`);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
let off: number = 8;
|
|
443
|
+
let w: number = 0;
|
|
444
|
+
let h: number = 0;
|
|
445
|
+
let depth: number = 0;
|
|
446
|
+
let ctype: number = 0;
|
|
447
|
+
let interlace: number = 0;
|
|
448
|
+
const idat: Buffer[] = [];
|
|
449
|
+
let plte: Buffer | null = null;
|
|
450
|
+
let trns: Buffer | null = null;
|
|
451
|
+
while (off < buf.length) {
|
|
452
|
+
const len: number = buf.readUInt32BE(off);
|
|
453
|
+
const type: string = buf.toString('ascii', off + 4, off + 8);
|
|
454
|
+
const data: Buffer = buf.subarray(off + 8, off + 8 + len);
|
|
455
|
+
if (type === 'IHDR') {
|
|
456
|
+
w = data.readUInt32BE(0);
|
|
457
|
+
h = data.readUInt32BE(4);
|
|
458
|
+
depth = data[8];
|
|
459
|
+
ctype = data[9];
|
|
460
|
+
interlace = data[12];
|
|
461
|
+
} else if (type === 'IDAT') {
|
|
462
|
+
idat.push(data);
|
|
463
|
+
} else if (type === 'PLTE') {
|
|
464
|
+
plte = Buffer.from(data);
|
|
465
|
+
} else if (type === 'tRNS') {
|
|
466
|
+
trns = Buffer.from(data);
|
|
467
|
+
} else if (type === 'IEND') {
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
off += 12 + len;
|
|
471
|
+
}
|
|
472
|
+
if (depth !== 8 || interlace !== 0 || ![0, 2, 3, 4, 6].includes(ctype)) {
|
|
473
|
+
throw new Error(
|
|
474
|
+
`unsupported PNG variant (bitDepth=${depth}, colorType=${ctype}, interlace=${interlace}).\n` +
|
|
475
|
+
'This decoder only supports 8-bit non-interlaced colorType 0/2/3/4/6.\n' +
|
|
476
|
+
'Fallback (needs Pillow):\n' +
|
|
477
|
+
` python -c "from PIL import Image; im=Image.open(r'${file}').convert('RGBA'); ` +
|
|
478
|
+
`im.save(r'${file}.rgba8.png')"\n` +
|
|
479
|
+
'then re-run this script on the converted file.'
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
const CH: Record<number, number> = { 0: 1, 2: 3, 3: 1, 4: 2, 6: 4 };
|
|
483
|
+
const ch: number = CH[ctype];
|
|
484
|
+
const raw: Buffer = zlib.inflateSync(Buffer.concat(idat));
|
|
485
|
+
const stride: number = w * ch;
|
|
486
|
+
const px: Uint8Array = new Uint8Array(w * h * 4);
|
|
487
|
+
const prev: Uint8Array = new Uint8Array(stride);
|
|
488
|
+
const cur: Uint8Array = new Uint8Array(stride);
|
|
489
|
+
let rp: number = 0;
|
|
490
|
+
for (let y = 0; y < h; y++) {
|
|
491
|
+
const filter: number = raw[rp++];
|
|
492
|
+
for (let i = 0; i < stride; i++) {
|
|
493
|
+
cur[i] = raw[rp + i];
|
|
494
|
+
}
|
|
495
|
+
rp += stride;
|
|
496
|
+
// Unfiltering (PNG spec 9.2)
|
|
497
|
+
for (let i = 0; i < stride; i++) {
|
|
498
|
+
const a: number = i >= ch ? cur[i - ch] : 0;
|
|
499
|
+
const b: number = prev[i];
|
|
500
|
+
const c: number = i >= ch ? prev[i - ch] : 0;
|
|
501
|
+
let v: number = cur[i];
|
|
502
|
+
if (filter === 1) {
|
|
503
|
+
v = v + a;
|
|
504
|
+
} else if (filter === 2) {
|
|
505
|
+
v = v + b;
|
|
506
|
+
} else if (filter === 3) {
|
|
507
|
+
v = v + ((a + b) >> 1);
|
|
508
|
+
} else if (filter === 4) {
|
|
509
|
+
const p: number = a + b - c;
|
|
510
|
+
const pa: number = Math.abs(p - a);
|
|
511
|
+
const pb: number = Math.abs(p - b);
|
|
512
|
+
const pc: number = Math.abs(p - c);
|
|
513
|
+
v = v + (pa <= pb && pa <= pc ? a : (pb <= pc ? b : c));
|
|
514
|
+
}
|
|
515
|
+
cur[i] = v & 0xff;
|
|
516
|
+
}
|
|
517
|
+
// Convert to RGBA
|
|
518
|
+
for (let x = 0; x < w; x++) {
|
|
519
|
+
const o: number = (y * w + x) * 4;
|
|
520
|
+
const s: number = x * ch;
|
|
521
|
+
if (ctype === 3) {
|
|
522
|
+
const pi: number = cur[s];
|
|
523
|
+
if (plte) {
|
|
524
|
+
px[o] = plte[pi * 3];
|
|
525
|
+
px[o + 1] = plte[pi * 3 + 1];
|
|
526
|
+
px[o + 2] = plte[pi * 3 + 2];
|
|
527
|
+
}
|
|
528
|
+
px[o + 3] = trns && pi < trns.length ? trns[pi] : 255;
|
|
529
|
+
} else if (ctype === 0 || ctype === 4) {
|
|
530
|
+
px[o] = px[o + 1] = px[o + 2] = cur[s];
|
|
531
|
+
px[o + 3] = ctype === 4 ? cur[s + 1] : 255;
|
|
532
|
+
} else {
|
|
533
|
+
px[o] = cur[s];
|
|
534
|
+
px[o + 1] = cur[s + 1];
|
|
535
|
+
px[o + 2] = cur[s + 2];
|
|
536
|
+
px[o + 3] = ctype === 6 ? cur[s + 3] : 255;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
prev.set(cur);
|
|
540
|
+
}
|
|
541
|
+
return { width: w, height: h, px };
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// ---------------------------------------------------------------- pixel measurement
|
|
545
|
+
|
|
546
|
+
function px(im: Png, x: number, y: number): number[] {
|
|
547
|
+
const o: number = (y * im.width + x) * 4;
|
|
548
|
+
return [im.px[o], im.px[o + 1], im.px[o + 2], im.px[o + 3]];
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Compute the "ink" bounding box within a rectangle — the bounding rectangle of pixels differing from the background by more than tol.
|
|
553
|
+
*
|
|
554
|
+
* Purpose: in a reference screenshot an element's **declared box** (view.xml bounds / semantic box) and the **graphic it actually draws**
|
|
555
|
+
* often differ in size. Telling them apart is a hard requirement: measured in this project, the SeekBar's semantic box is inset 58px (22.1dp) on the left,
|
|
556
|
+
* while the actually drawn track (including rounded end caps) starts at 75px — taking 58px as declared padding gives the wrong conclusion of 22dp,
|
|
557
|
+
* while the source says 32dp. The ink bbox is the only measurement that separates the two.
|
|
558
|
+
*
|
|
559
|
+
* The background color defaults to the median of the rectangle's four corners, to avoid sampling the element itself.
|
|
560
|
+
*/
|
|
561
|
+
function inkBox(im: Png, x1: number, y1: number, x2: number, y2: number,
|
|
562
|
+
tol: number = 12, bg?: number[]): InkBox | null {
|
|
563
|
+
const corners: number[][] = [
|
|
564
|
+
px(im, x1, y1), px(im, x2 - 1, y1), px(im, x1, y2 - 1), px(im, x2 - 1, y2 - 1)
|
|
565
|
+
];
|
|
566
|
+
const base: number[] = bg || [
|
|
567
|
+
median(corners.map((c) => c[0])),
|
|
568
|
+
median(corners.map((c) => c[1])),
|
|
569
|
+
median(corners.map((c) => c[2]))
|
|
570
|
+
];
|
|
571
|
+
// Background uniformity self-check: if the corners' span on any channel approaches/exceeds the tolerance, the background is not solid
|
|
572
|
+
// (gradient, image, blurred backdrop), and the "differs from background" criterion itself breaks down.
|
|
573
|
+
// Measured: this project's record area has a pink gradient background, corner green channel 248→237 (span 11, tolerance 12);
|
|
574
|
+
// the generic ink bbox measured 861x818 (almost the whole block), while filtering by the graphic's color measured 655x724.
|
|
575
|
+
// Rather than tuning the tolerance until it happens to hit a known answer, let the tool **report itself untrustworthy** —
|
|
576
|
+
// the former fits the tool to one sample; only the latter still holds on other pages.
|
|
577
|
+
let spread: number = 0;
|
|
578
|
+
for (let c = 0; c < 3; c++) {
|
|
579
|
+
const vals: number[] = corners.map((q) => q[c]);
|
|
580
|
+
spread = Math.max(spread, Math.max(...vals) - Math.min(...vals));
|
|
581
|
+
}
|
|
582
|
+
const shaky: boolean = spread >= tol * 0.8;
|
|
583
|
+
let mnx: number = Number.MAX_SAFE_INTEGER;
|
|
584
|
+
let mny: number = Number.MAX_SAFE_INTEGER;
|
|
585
|
+
let mxx: number = -1;
|
|
586
|
+
let mxy: number = -1;
|
|
587
|
+
for (let y = y1; y < y2; y++) {
|
|
588
|
+
for (let x = x1; x < x2; x++) {
|
|
589
|
+
const p: number[] = px(im, x, y);
|
|
590
|
+
if (Math.abs(p[0] - base[0]) > tol ||
|
|
591
|
+
Math.abs(p[1] - base[1]) > tol ||
|
|
592
|
+
Math.abs(p[2] - base[2]) > tol) {
|
|
593
|
+
if (x < mnx) { mnx = x; }
|
|
594
|
+
if (x > mxx) { mxx = x; }
|
|
595
|
+
if (y < mny) { mny = y; }
|
|
596
|
+
if (y > mxy) { mxy = y; }
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if (mxx < 0) {
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
const box: InkBox = {
|
|
604
|
+
x1: mnx, y1: mny, x2: mxx, y2: mxy,
|
|
605
|
+
w: mxx - mnx + 1,
|
|
606
|
+
h: mxy - mny + 1,
|
|
607
|
+
cx: (mnx + mxx) / 2,
|
|
608
|
+
cy: (mny + mxy) / 2
|
|
609
|
+
};
|
|
610
|
+
// Uneven background means untrustworthy. **Do not** try to subdivide trustworthiness further by "is the ink smaller than the declared box" —
|
|
611
|
+
// this project measured that idea false: the SeekBar region's ink measured 928x42, and its width x 75..1002 matched
|
|
612
|
+
// the color-filtered result point for point, looking "trustworthy"; but height 42 is exactly the declared box's full height, while the actually drawn
|
|
613
|
+
// track is only 26px — the width was right because the track is nearly full width anyway, **pure coincidence**.
|
|
614
|
+
// That is: one ink bbox can be right in one dimension and polluted by the gradient in the other; no overall criterion can separate the two.
|
|
615
|
+
//
|
|
616
|
+
// So when the whole page has a gradient, most regions being flagged is **fact, not noise**. Report it as is, with the measured span,
|
|
617
|
+
// and let the user color-filter specific elements as needed — far more honest than a precise-looking wrong number.
|
|
618
|
+
box.bgSpread = spread;
|
|
619
|
+
if (shaky) {
|
|
620
|
+
box.unreliable = true;
|
|
621
|
+
box.reason = `region background is not uniform (corner channel spread ${spread}, tolerance ${tol}), likely a gradient/image/blurred backdrop. ` +
|
|
622
|
+
'The ink bbox counts background differences as ink too, so **either dimension may be polluted** (measured: width right, height wrong), ' +
|
|
623
|
+
'so do not assert the drawn size from it. Filter by the shape\'s own color first, then measure.';
|
|
624
|
+
}
|
|
625
|
+
return box;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function median(a: number[]): number {
|
|
629
|
+
const s: number[] = a.slice().sort((p, q) => p - q);
|
|
630
|
+
return s[Math.floor(s.length / 2)];
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
interface ImgRect { x1: number; y1: number; x2: number; y2: number; }
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Convert a node rectangle in view-tree coordinate space to screenshot pixel coordinates, clipped to the image.
|
|
637
|
+
*
|
|
638
|
+
* Why the two cannot be assumed to share a space: uiautomator reports the **logical resolution** (the value after `wm size`
|
|
639
|
+
* override), while `screencap` produces the **physical frame** — on devices such as dev boards with `wm size` overridden the two
|
|
640
|
+
* often differ (measured: a 1920x1200 view tree root with a 1280x800 screenshot, scale=0.667).
|
|
641
|
+
* The old implementation used view-tree coordinates directly as image pixel indices: nodes outside the image were **silently skipped**,
|
|
642
|
+
* and the ink/color sampling points of the remaining nodes were shifted wholesale — a defect class confirmed by measurement in this project, not a hypothesis.
|
|
643
|
+
*
|
|
644
|
+
* Returns null when the converted rectangle degenerates (width or height < 2px); the caller should skip pixel measurement for that node.
|
|
645
|
+
*/
|
|
646
|
+
interface CoordSpace { ox: number; oy: number; sx: number; sy: number; windowed: boolean; }
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Conversion parameters from view-tree coordinates → screenshot pixels.
|
|
650
|
+
*
|
|
651
|
+
* Two cases must be distinguished:
|
|
652
|
+
* - Full-screen window: root is the logical screen, the screenshot is the physical frame → origin at root, scaled by root size;
|
|
653
|
+
* - Sub-window (dialog/popup/PopupWindow): uiautomator only dumps the focused window, root is the window itself,
|
|
654
|
+
* and its bounds are already **absolute screen coordinates**. Scaling by root size here would stretch a 1024x765
|
|
655
|
+
* dialog to the full screen (~3x in y), and all ink/color sampling would land in the wrong place.
|
|
656
|
+
* Test: root's origin is not (0,0) or its size is smaller than the screen, and it lies entirely within the screen → sub-window.
|
|
657
|
+
* Screen size comes from meta's `wm size` true value; without it the screenshot size is used (then scale=1).
|
|
658
|
+
*/
|
|
659
|
+
function coordSpace(im: Png, root: Node, screen: ScreenSize | null): CoordSpace {
|
|
660
|
+
const sw: number = screen ? screen.widthPx : im.width;
|
|
661
|
+
const sh: number = screen ? screen.heightPx : im.height;
|
|
662
|
+
const tol = 2;
|
|
663
|
+
const inside = root.x1 >= -tol && root.y1 >= -tol && root.x2 <= sw + tol && root.y2 <= sh + tol;
|
|
664
|
+
const fullScreen = Math.abs(root.x1) <= tol && Math.abs(root.y1) <= tol &&
|
|
665
|
+
Math.abs(root.w - sw) <= tol && Math.abs(root.h - sh) <= tol;
|
|
666
|
+
// Without a `wm size` true value, a root starting at (0,0) is more likely a full screen overridden by `wm size`
|
|
667
|
+
// (logical resolution ≠ physical frame) and cannot be treated as a sub-window; sub-windows almost always have a non-zero origin.
|
|
668
|
+
const offOrigin = root.x1 > tol || root.y1 > tol;
|
|
669
|
+
if (inside && !fullScreen && (screen !== null || offOrigin)) {
|
|
670
|
+
return { ox: 0, oy: 0, sx: im.width / sw, sy: im.height / sh, windowed: true };
|
|
671
|
+
}
|
|
672
|
+
return { ox: root.x1, oy: root.y1, sx: im.width / root.w, sy: im.height / root.h, windowed: false };
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function toImgRect(im: Png, cs: CoordSpace, n: Node): ImgRect | null {
|
|
676
|
+
const x1: number = Math.max(0, Math.round((n.x1 - cs.ox) * cs.sx));
|
|
677
|
+
const y1: number = Math.max(0, Math.round((n.y1 - cs.oy) * cs.sy));
|
|
678
|
+
const x2: number = Math.min(im.width, Math.round((n.x2 - cs.ox) * cs.sx));
|
|
679
|
+
const y2: number = Math.min(im.height, Math.round((n.y2 - cs.oy) * cs.sy));
|
|
680
|
+
if (x2 - x1 < 2 || y2 - y1 < 2) { return null; }
|
|
681
|
+
return { x1, y1, x2, y2 };
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// ---------------------------------------------------------------- main
|
|
685
|
+
|
|
686
|
+
interface RegionOut {
|
|
687
|
+
node: number;
|
|
688
|
+
role: string;
|
|
689
|
+
boundsPx: string;
|
|
690
|
+
wPx: number;
|
|
691
|
+
hPx: number;
|
|
692
|
+
wVp: number | null;
|
|
693
|
+
hVp: number | null;
|
|
694
|
+
xRatio: number;
|
|
695
|
+
yRatio: number;
|
|
696
|
+
wRatio: number;
|
|
697
|
+
hRatio: number;
|
|
698
|
+
clickable: boolean;
|
|
699
|
+
text: string;
|
|
700
|
+
desc: string;
|
|
701
|
+
ink: InkBox | null;
|
|
702
|
+
inkNote?: string;
|
|
703
|
+
/** The region's foreground color (mode of the pixels farthest from the background) and background color (most frequent pixel), in hex. */
|
|
704
|
+
inkColor?: string;
|
|
705
|
+
bgColor?: string;
|
|
706
|
+
/** Index of the upper node covering this region (see occlusion.mjs). When set, no ink/color sampling: the pixels belong to the upper layer. */
|
|
707
|
+
occludedBy?: number;
|
|
708
|
+
/** Top edge in vp in safe-area coordinates (screen y minus status bar height); see coordinate_frame. */
|
|
709
|
+
safeTopVp?: number | null;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Region color sampling — background takes the **most frequent** pixel; foreground takes the **most frequent color among the pixels farthest from the background**.
|
|
714
|
+
*
|
|
715
|
+
* Why the inkBox four-corner median cannot be reused: the corners always land on the **background**, so it can give the background color but
|
|
716
|
+
* never the color of text/strokes. And "what color is this text" is a question every Text must answer
|
|
717
|
+
* (M3's onSurface / onSurfaceVariant / primary / tertiary differ by only a few dozen gray levels in a screenshot,
|
|
718
|
+
* indistinguishable by eye), so not building it in means an extra round of pixel probing per page.
|
|
719
|
+
*
|
|
720
|
+
* Why the foreground is not the "darkest pixel": with light text on a dark background (black settings pages, night theme) the darkest pixel is the background itself,
|
|
721
|
+
* foreground == background. Measured: one black settings page needed 10 extra PowerShell histograms (about 20 minutes) because of this.
|
|
722
|
+
* "Farthest from the background" holds for both dark-on-light and light-on-dark; taking the **mode** of that pixel set rather than a single extreme
|
|
723
|
+
* keeps anti-aliased edges and noise from being taken as the text color. `darkest` is kept for old callers that rely on it.
|
|
724
|
+
*
|
|
725
|
+
* Cost is nearly zero: inkBox already walks these pixels; this just records a few more values in the same pass.
|
|
726
|
+
*/
|
|
727
|
+
function contrastColors(im: Png, x1: number, y1: number, x2: number, y2: number):
|
|
728
|
+
{ ink: string; bg: string; darkest: string; inkShare: number; bgUniform: boolean } {
|
|
729
|
+
const hex = (k: number): string =>
|
|
730
|
+
'#' + [(k >> 16) & 255, (k >> 8) & 255, k & 255].map((v) => v.toString(16).padStart(2, '0').toUpperCase()).join('');
|
|
731
|
+
let dk: number = 0xFFFFFF, dl: number = 1e9;
|
|
732
|
+
const hist: Map<number, number> = new Map<number, number>();
|
|
733
|
+
for (let y = y1; y < y2; y++) {
|
|
734
|
+
for (let x = x1; x < x2; x++) {
|
|
735
|
+
const o: number = (y * im.width + x) * 4;
|
|
736
|
+
const r: number = im.px[o], g: number = im.px[o + 1], b: number = im.px[o + 2];
|
|
737
|
+
const l: number = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
738
|
+
const k: number = (r << 16) | (g << 8) | b;
|
|
739
|
+
if (l < dl) { dl = l; dk = k; }
|
|
740
|
+
hist.set(k, (hist.get(k) || 0) + 1);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
// Background takes the **border pixels**: a control rectangle's edges almost always land on the background, whereas large text (more text
|
|
744
|
+
// pixels than background in the region) or a photo background (scattered colors, no single mode) would make the region-wide mode land on the text.
|
|
745
|
+
// If the border has a mode (≥30% of border pixels) use it; otherwise use the per-channel median as reference and flag a non-solid background.
|
|
746
|
+
const border: Map<number, number> = new Map<number, number>();
|
|
747
|
+
const rs: number[] = [], gs: number[] = [], bs: number[] = [];
|
|
748
|
+
const edge = (x: number, y: number): void => {
|
|
749
|
+
const o: number = (y * im.width + x) * 4;
|
|
750
|
+
const k: number = (im.px[o] << 16) | (im.px[o + 1] << 8) | im.px[o + 2];
|
|
751
|
+
border.set(k, (border.get(k) || 0) + 1);
|
|
752
|
+
rs.push(im.px[o]); gs.push(im.px[o + 1]); bs.push(im.px[o + 2]);
|
|
753
|
+
};
|
|
754
|
+
if (x2 > x1 && y2 > y1) {
|
|
755
|
+
for (let x = x1; x < x2; x++) { edge(x, y1); if (y2 - 1 > y1) { edge(x, y2 - 1); } }
|
|
756
|
+
for (let y = y1 + 1; y < y2 - 1; y++) { edge(x1, y); if (x2 - 1 > x1) { edge(x2 - 1, y); } }
|
|
757
|
+
}
|
|
758
|
+
let bk: number = 0, bn: number = -1, nb: number = 0;
|
|
759
|
+
for (const [k, n] of border) { nb += n; if (n > bn) { bn = n; bk = k; } }
|
|
760
|
+
let bgUniform: boolean = nb > 0 && bn >= 0.3 * nb;
|
|
761
|
+
if (nb === 0) {
|
|
762
|
+
for (const [k, n] of hist) { if (n > bn) { bn = n; bk = k; } }
|
|
763
|
+
bgUniform = true;
|
|
764
|
+
} else if (!bgUniform) {
|
|
765
|
+
const med = (a: number[]): number => a.slice().sort((p, q) => p - q)[a.length >> 1];
|
|
766
|
+
bk = (med(rs) << 16) | (med(gs) << 8) | med(bs);
|
|
767
|
+
}
|
|
768
|
+
const dist = (k: number): number => {
|
|
769
|
+
const dr = ((k >> 16) & 255) - ((bk >> 16) & 255);
|
|
770
|
+
const dg = ((k >> 8) & 255) - ((bk >> 8) & 255);
|
|
771
|
+
const db = (k & 255) - (bk & 255);
|
|
772
|
+
return Math.sqrt(dr * dr + dg * dg + db * db);
|
|
773
|
+
};
|
|
774
|
+
let maxD: number = 0;
|
|
775
|
+
for (const k of hist.keys()) { maxD = Math.max(maxD, dist(k)); }
|
|
776
|
+
// Foreground candidates: at least 60% of maxD from the background (and absolute difference ≥ 24, excluding near-background noise)
|
|
777
|
+
let ik: number = bk, inN: number = 0, total: number = 0, far: number = 0;
|
|
778
|
+
for (const [k, n] of hist) {
|
|
779
|
+
total += n;
|
|
780
|
+
const d: number = dist(k);
|
|
781
|
+
if (maxD >= 24 && d >= 0.6 * maxD) {
|
|
782
|
+
far += n;
|
|
783
|
+
if (n > inN) { inN = n; ik = k; }
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return { ink: hex(ik), bg: hex(bk), darkest: hex(dk), inkShare: total ? far / total : 0, bgUniform };
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
function regionColors(im: Png, x1: number, y1: number, x2: number, y2: number):
|
|
790
|
+
{ ink: string; bg: string } {
|
|
791
|
+
const c = contrastColors(im, x1, y1, x2, y2);
|
|
792
|
+
return { ink: c.ink, bg: c.bg };
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// ---------------------------------------------------------------- registration (screenshot ↔ view tree)
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Does the screenshot show the same frame the view tree describes? uiautomator dumps the **final** layout bounds, while
|
|
799
|
+
* screencap can land mid-animation. Measured (weather search sheet, page_0002): the BottomSheet was still sliding in, every
|
|
800
|
+
* node of the sheet sat 81px lower in view.xml than in the PNG; a probe of the search bar at view.xml bounds caught only
|
|
801
|
+
* the bottom rim of the magnifier icon (`ink 0.0%`), the sub-agent concluded "white-on-white, invisible" and dropped the icon.
|
|
802
|
+
*
|
|
803
|
+
* Anchors are large solid blocks (cards, bars): along 5 columns inside the node, find the solid-color run whose length
|
|
804
|
+
* matches the node height and that starts nearest the declared top; ≥3 columns agreeing within ±3px give the anchor's dy.
|
|
805
|
+
* Only vertical drift is measured (sheets, snackbars, collapsing headers all move vertically).
|
|
806
|
+
*/
|
|
807
|
+
interface RegAnchor { node: number; rid: string; declaredPx: string; foundTopPx: number; dy: number; color: string; columns: number; }
|
|
808
|
+
interface Registration { checked: number; anchors: RegAnchor[]; dy: number | null; ok: boolean | null; tolPx: number; note: string; }
|
|
809
|
+
|
|
810
|
+
const REG_TOL_PX = 8;
|
|
811
|
+
|
|
812
|
+
function columnRuns(im: Png, x: number, y1: number, y2: number): { y1: number; y2: number; c: number[] }[] {
|
|
813
|
+
const runs: { y1: number; y2: number; c: number[] }[] = [];
|
|
814
|
+
let s = y1, c0 = px(im, x, y1);
|
|
815
|
+
for (let y = y1 + 1; y <= y2; y++) {
|
|
816
|
+
const c = y < y2 ? px(im, x, y) : null;
|
|
817
|
+
if (c && Math.abs(c[0] - c0[0]) <= 6 && Math.abs(c[1] - c0[1]) <= 6 && Math.abs(c[2] - c0[2]) <= 6) { continue; }
|
|
818
|
+
runs.push({ y1: s, y2: y, c: c0 });
|
|
819
|
+
if (c) { s = y; c0 = c; }
|
|
820
|
+
}
|
|
821
|
+
return runs;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* A run that keeps its color just outside the node on **both** sides is the surrounding background seen through the
|
|
826
|
+
* node's box (a gap between cards whose height happens to equal the card's), not the node's own fill. Only checked
|
|
827
|
+
* when the node is inset from the screen edge on both sides; otherwise there is no outside to look at.
|
|
828
|
+
*/
|
|
829
|
+
function continuesOutside(im: Png, r: ImgRect, u: { y1: number; y2: number; c: number[] }): boolean {
|
|
830
|
+
if (r.x1 < 3 || r.x2 > im.width - 3) { return false; }
|
|
831
|
+
const y = Math.round((u.y1 + u.y2) / 2);
|
|
832
|
+
const same = (c: number[]): boolean => c.every((v, i) => Math.abs(v - u.c[i]) <= 6);
|
|
833
|
+
return same(px(im, r.x1 - 3, y)) && same(px(im, r.x2 + 2, y));
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
function anchorDy(im: Png, r: ImgRect, claimed: ImgRect[] = []): { dy: number; top: number; color: number[]; columns: number } | null {
|
|
837
|
+
const h = r.y2 - r.y1, w = r.x2 - r.x1;
|
|
838
|
+
const shift = Math.round(im.height * 0.15);
|
|
839
|
+
const lo = Math.max(0, r.y1 - shift), hi = Math.min(im.height, r.y2 + shift);
|
|
840
|
+
const hits: { dy: number; c: number[] }[] = [];
|
|
841
|
+
for (const f of [0.2, 0.35, 0.5, 0.65, 0.8]) {
|
|
842
|
+
const x = Math.min(im.width - 1, Math.round(r.x1 + w * f));
|
|
843
|
+
const cand = columnRuns(im, x, lo, hi)
|
|
844
|
+
.filter((u) => u.y1 > lo && u.y2 < hi && Math.abs((u.y2 - u.y1) - h) <= Math.max(4, h * 0.06))
|
|
845
|
+
.filter((u) => !continuesOutside(im, r, u))
|
|
846
|
+
// a block sitting exactly on another wide node's declared box is that node, already in place
|
|
847
|
+
.filter((u) => !claimed.some((o) => !(o.y1 === r.y1 && o.y2 === r.y2) && Math.abs(o.y1 - u.y1) <= 2 && Math.abs(o.y2 - u.y2) <= 2 && o.x1 <= x && x < o.x2))
|
|
848
|
+
.sort((a, b) => Math.abs(a.y1 - r.y1) - Math.abs(b.y1 - r.y1));
|
|
849
|
+
if (cand.length) { hits.push({ dy: cand[0].y1 - r.y1, c: cand[0].c }); }
|
|
850
|
+
}
|
|
851
|
+
if (hits.length < 3) { return null; }
|
|
852
|
+
const m = median(hits.map((v) => v.dy));
|
|
853
|
+
const agree = hits.filter((v) => Math.abs(v.dy - m) <= 3 &&
|
|
854
|
+
v.c.every((ch, i) => Math.abs(ch - hits[0].c[i]) <= 12));
|
|
855
|
+
return agree.length >= 3 ? { dy: Math.round(m), top: r.y1 + Math.round(m), color: agree[0].c, columns: agree.length } : null;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
const hex6 = (c: number[]): string => '#' + c.slice(0, 3).map((v) => v.toString(16).padStart(2, '0').toUpperCase()).join('');
|
|
859
|
+
|
|
860
|
+
function registration(im: Png, cs: CoordSpace, nodes: Node[], skip: (n: Node) => boolean): Registration {
|
|
861
|
+
const anchors: RegAnchor[] = [];
|
|
862
|
+
let checked = 0;
|
|
863
|
+
const wide: { n: Node; r: ImgRect }[] = [];
|
|
864
|
+
for (const n of nodes) {
|
|
865
|
+
if (skip(n)) { continue; }
|
|
866
|
+
const r = toImgRect(im, cs, n);
|
|
867
|
+
if (!r || r.x2 - r.x1 < im.width * 0.3 || r.y2 - r.y1 < 24 || r.y2 - r.y1 > im.height * 0.35) { continue; }
|
|
868
|
+
wide.push({ n, r });
|
|
869
|
+
}
|
|
870
|
+
const claimed = wide.map((w) => w.r);
|
|
871
|
+
for (const { n, r } of wide) {
|
|
872
|
+
checked++;
|
|
873
|
+
const a = anchorDy(im, r, claimed);
|
|
874
|
+
if (a) {
|
|
875
|
+
anchors.push({ node: n.idx, rid: n.rid, declaredPx: `[${r.x1},${r.y1}][${r.x2},${r.y2}]`,
|
|
876
|
+
foundTopPx: a.top, dy: a.dy, color: hex6(a.color), columns: a.columns });
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
if (!anchors.length) {
|
|
880
|
+
return { checked, anchors, dy: null, ok: null, tolPx: REG_TOL_PX,
|
|
881
|
+
note: 'no solid block to anchor on; registration not verified (not a pass)' };
|
|
882
|
+
}
|
|
883
|
+
// No majority vote: a sheet sliding in is usually one subtree with one anchor, outvoted by the static blocks of the
|
|
884
|
+
// page beneath it. Any drifted anchor flags the capture; each icon then takes the dy of its own subtree (iconInventory).
|
|
885
|
+
const off = anchors.filter((a) => Math.abs(a.dy) > REG_TOL_PX);
|
|
886
|
+
const ok = off.length === 0;
|
|
887
|
+
const list = off.map((a) => `${a.rid.replace(/^.*:id\//, '') || 'node' + a.node} dy=${a.dy}`).join(', ');
|
|
888
|
+
return { checked, anchors, dy: ok ? 0 : median(off.map((a) => a.dy)), ok, tolPx: REG_TOL_PX,
|
|
889
|
+
note: ok ? 'screenshot matches view-tree bounds'
|
|
890
|
+
: `screenshot drifts from view.xml in part of the tree (${list}): the capture is likely mid-animation. ` +
|
|
891
|
+
'Pixels at view.xml bounds are wrong inside those subtrees only; icon_inventory samples are already shifted per subtree. ' +
|
|
892
|
+
'Shift a --probe rectangle by the dy of the anchor whose subtree contains it, not by a page-wide value' };
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Every visible ImageView/ImageButton the reference shows, sampled at its **registered** position. phase5_check's
|
|
897
|
+
* [icons] stage requires each key to be covered by an `// ICON: <key>` marker on an image-rendering line; an
|
|
898
|
+
* `// ICON-OMIT:` is refused when the sample here says the icon is drawn on a solid background.
|
|
899
|
+
*/
|
|
900
|
+
interface IconRow {
|
|
901
|
+
key: string; node: number; rid: string; declaredPx: string; sampledPx: string; dy: number;
|
|
902
|
+
ink: string; bg: string; inkShare: number; bgUniform: boolean; visible: boolean;
|
|
903
|
+
/** subtree = dy of an anchor sharing a sub-window ancestor; fallback = drifted dy tried after a blank read; none = declared position. */
|
|
904
|
+
dySource: 'subtree' | 'fallback' | 'none';
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function iconKey(n: Node): string {
|
|
908
|
+
const m = /:id\/(.+)$/.exec(n.rid);
|
|
909
|
+
if (m) { return m[1]; }
|
|
910
|
+
// No id: content-desc is stable across re-captures, the node index is not. Either way the key written in code is
|
|
911
|
+
// copied from measure_pack's output (summary "icons" / icon_inventory), never derived by hand.
|
|
912
|
+
const d = n.desc.trim().replace(/[^\w.]+/g, '_').replace(/^_+|_+$/g, '');
|
|
913
|
+
return d ? d : `node${n.idx}`;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function iconInventory(im: Png, cs: CoordSpace, nodes: Node[], tree: Node[], reg: Registration,
|
|
917
|
+
minPx: number, skip: (n: Node) => boolean, root: Node): IconRow[] {
|
|
918
|
+
const rows: IconRow[] = [];
|
|
919
|
+
for (const n of nodes) {
|
|
920
|
+
if (!/Image(View|Button)$/.test(n.cls) || skip(n) || Math.min(n.w, n.h) < minPx) { continue; }
|
|
921
|
+
const r = toImgRect(im, cs, n);
|
|
922
|
+
if (!r) { continue; }
|
|
923
|
+
const sample = (dy: number): { c: ReturnType<typeof contrastColors>; y1: number; y2: number; visible: boolean } | null => {
|
|
924
|
+
const y1 = Math.max(0, r.y1 + dy), y2 = Math.min(im.height, r.y2 + dy);
|
|
925
|
+
if (y2 - y1 < 2) { return null; }
|
|
926
|
+
const c = contrastColors(im, r.x1, y1, r.x2, y2);
|
|
927
|
+
const ic = hexRgbArr(c.ink), bc = hexRgbArr(c.bg);
|
|
928
|
+
const diff = Math.max(...ic.map((v, k) => Math.abs(v - bc[k])));
|
|
929
|
+
return { c, y1, y2, visible: c.inkShare >= 0.01 && diff >= 40 };
|
|
930
|
+
};
|
|
931
|
+
const a = anchorFor(n, tree, reg.anchors, root);
|
|
932
|
+
let dy = a && Math.abs(a.dy) > REG_TOL_PX ? a.dy : 0;
|
|
933
|
+
let dySource: IconRow['dySource'] = a ? 'subtree' : 'none';
|
|
934
|
+
let s = sample(dy);
|
|
935
|
+
// No anchor in the icon's own subtree: its drift is unknown. Keep the declared position unless it reads blank while
|
|
936
|
+
// some subtree drifted; then try those dy values (the icon may sit in a drifting window that has no solid block).
|
|
937
|
+
if (!a && s && !s.visible && reg.ok === false) {
|
|
938
|
+
for (const dd of [...new Set(reg.anchors.filter((x) => Math.abs(x.dy) > REG_TOL_PX).map((x) => x.dy))]) {
|
|
939
|
+
const s2 = sample(dd);
|
|
940
|
+
if (s2 && s2.visible) { s = s2; dy = dd; dySource = 'fallback'; break; }
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (!s) { continue; }
|
|
944
|
+
const c = s.c, y1 = s.y1, y2 = s.y2;
|
|
945
|
+
rows.push({ key: iconKey(n), node: n.idx, rid: n.rid, declaredPx: `[${r.x1},${r.y1}][${r.x2},${r.y2}]`,
|
|
946
|
+
sampledPx: `[${r.x1},${y1}][${r.x2},${y2}]`, dy, ink: c.ink, bg: c.bg,
|
|
947
|
+
inkShare: Math.round(c.inkShare * 1e4) / 1e4, bgUniform: c.bgUniform,
|
|
948
|
+
visible: s.visible, dySource });
|
|
949
|
+
}
|
|
950
|
+
return rows;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function hexRgbArr(h: string): number[] {
|
|
954
|
+
return [1, 3, 5].map((i) => parseInt(h.slice(i, i + 2), 16));
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Anchor whose subtree the icon shares: the deepest common ancestor wins, and an ancestor that spans (nearly) the whole
|
|
959
|
+
* window does not count. Every node shares the root, so matching there would hand a drifting sheet's dy to a static
|
|
960
|
+
* toolbar icon. Returns null when no anchor shares a sub-window ancestor.
|
|
961
|
+
*/
|
|
962
|
+
function anchorFor(n: Node, tree: Node[], anchors: RegAnchor[], root: Node): RegAnchor | null {
|
|
963
|
+
const chain = (x: Node): number[] => {
|
|
964
|
+
const ids: number[] = [];
|
|
965
|
+
for (let i: number | null = tree.indexOf(x); i !== null && i >= 0; i = tree[i].parent) { ids.push(i); }
|
|
966
|
+
return ids;
|
|
967
|
+
};
|
|
968
|
+
const windowLevel = (x: Node): boolean => x.w * x.h >= 0.9 * root.w * root.h;
|
|
969
|
+
const mine = chain(n);
|
|
970
|
+
let best: RegAnchor | null = null, bestDepth = -1;
|
|
971
|
+
for (const a of anchors) {
|
|
972
|
+
const an = tree.find((t) => t.idx === a.node);
|
|
973
|
+
if (!an) { continue; }
|
|
974
|
+
const theirs = new Set(chain(an));
|
|
975
|
+
const lca = mine.findIndex((i) => theirs.has(i));
|
|
976
|
+
if (lca < 0 || windowLevel(tree[mine[lca]])) { continue; }
|
|
977
|
+
const depth = mine.length - lca;
|
|
978
|
+
if (depth > bestDepth) { bestDepth = depth; best = a; }
|
|
979
|
+
}
|
|
980
|
+
return best;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
// ---------------------------------------------------------------- probe mode
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* `--probe` — **per-pixel interrogation** of a rectangle, answering questions the default ink bbox output cannot.
|
|
987
|
+
*
|
|
988
|
+
* Why it must be built in: this package already has a PNG decoder (decodePng) but only used it for the ink bbox.
|
|
989
|
+
* So whenever "what is this icon's actual geometry", "what is this color value", "how big is this rounded pill" came up,
|
|
990
|
+
* the sub-agent had to rewrite a decoder in /tmp itself — measured: **rewritten 7 times in one single-page conversion**,
|
|
991
|
+
* byte-identical inflate + unfiltering boilerplate, each taking a tool round trip.
|
|
992
|
+
* And these measurements are pure arithmetic, constant for the same capture device — exactly why this package exists.
|
|
993
|
+
*
|
|
994
|
+
* Each of the four outputs answers one class of question:
|
|
995
|
+
* colors true color values of some points/a whole region (background + contrasting foreground + frequency histogram,
|
|
996
|
+
* not corner sampling — the "main color" of text/strokes is never in the corners)
|
|
997
|
+
* runs dark-pixel runs per row. Vertex coordinates of line icons (check, bar, arrow) can only be read from here;
|
|
998
|
+
* the ink bbox only gives the bounding rectangle, from which the polyline cannot be recovered.
|
|
999
|
+
* ascii renders the region as ASCII art, to **see the shape first** before deciding what to measure.
|
|
1000
|
+
* filter bounding box by a **given color**, rather than "differs from background". On gradient/image backgrounds
|
|
1001
|
+
* bgSpread marks ink as unreliable (see InkBox.unreliable); then only
|
|
1002
|
+
* color filtering measures the real size — e.g. the M3 selected-state pill.
|
|
1003
|
+
*
|
|
1004
|
+
* Usage (single):
|
|
1005
|
+
* node measure_pack.ts --probe <png> --rect x1,y1,x2,y2 --mode colors|runs|ascii|filter
|
|
1006
|
+
* [--color RRGGBB] [--tol 14] [--density 2.625]
|
|
1007
|
+
*
|
|
1008
|
+
* Usage (batch — ask all of a page's questions in one call, PNG decoded once):
|
|
1009
|
+
* --rect is repeatable: each --rect uses the global --mode/--color/--tol
|
|
1010
|
+
* --spec "x1,y1,x2,y2 mode [RRGGBB] [tol]" is repeatable: each entry sets its own mode/color
|
|
1011
|
+
* --batch <file.json>:[{"rect":"x1,y1,x2,y2","mode":"filter","color":"3D5AFE","tol":20,"label":"pill"}, ...]
|
|
1012
|
+
* The three can be mixed; outputs are numbered in order, each preceded by `### [i] label rect mode`.
|
|
1013
|
+
* Measured: one conversion averaged 15 probe calls per group, each asking about 1 rectangle, each a full model round trip.
|
|
1014
|
+
*/
|
|
1015
|
+
interface ProbeSpec {
|
|
1016
|
+
rect: string | null;
|
|
1017
|
+
mode: string;
|
|
1018
|
+
color: string | null;
|
|
1019
|
+
tol: number;
|
|
1020
|
+
label: string;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
function probeSpecs(argv: string[], arg: (k: string) => string | null): ProbeSpec[] {
|
|
1024
|
+
const mode: string = arg('--mode') || 'colors';
|
|
1025
|
+
const color: string | null = arg('--color');
|
|
1026
|
+
const tol: number = parseInt(arg('--tol') || '14', 10);
|
|
1027
|
+
const specs: ProbeSpec[] = [];
|
|
1028
|
+
for (let i = 0; i < argv.length - 1; i++) {
|
|
1029
|
+
if (argv[i] === '--rect') {
|
|
1030
|
+
specs.push({ rect: argv[i + 1], mode, color, tol, label: '' });
|
|
1031
|
+
} else if (argv[i] === '--spec') {
|
|
1032
|
+
const f: string[] = argv[i + 1].trim().split(/\s+/);
|
|
1033
|
+
specs.push({ rect: f[0], mode: f[1] || mode, color: f[2] && f[2] !== '-' ? f[2] : color,
|
|
1034
|
+
tol: f[3] ? parseInt(f[3], 10) : tol, label: f.slice(4).join(' ') });
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
const batch: string | null = arg('--batch');
|
|
1038
|
+
if (batch) {
|
|
1039
|
+
const rows: Array<Record<string, unknown>> = JSON.parse(fs.readFileSync(batch, 'utf8'));
|
|
1040
|
+
for (const r of rows) {
|
|
1041
|
+
specs.push({ rect: (r.rect as string) || null, mode: (r.mode as string) || mode,
|
|
1042
|
+
color: (r.color as string) || color, tol: r.tol !== undefined ? Number(r.tol) : tol,
|
|
1043
|
+
label: (r.label as string) || '' });
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
if (specs.length === 0) { specs.push({ rect: null, mode, color, tol, label: '' }); }
|
|
1047
|
+
return specs;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
function runProbe(argv: string[], arg: (k: string) => string | null): void {
|
|
1051
|
+
const file: string | null = arg('--probe');
|
|
1052
|
+
if (!file || !fs.existsSync(file)) {
|
|
1053
|
+
console.error('--probe needs an existing png path');
|
|
1054
|
+
process.exit(2);
|
|
1055
|
+
}
|
|
1056
|
+
const im: Png = decodePng(file as string);
|
|
1057
|
+
const dens: number = parseFloat(arg('--density') || '0');
|
|
1058
|
+
const specs: ProbeSpec[] = probeSpecs(argv, arg);
|
|
1059
|
+
// A pack next to the screenshot that found drift: rectangles copied from view.xml miss the drawn content
|
|
1060
|
+
try {
|
|
1061
|
+
const pk = JSON.parse(fs.readFileSync(path.join(path.dirname(file as string), 'measure_pack.json'), 'utf8'));
|
|
1062
|
+
const rg = pk && pk.registration;
|
|
1063
|
+
if (rg && rg.ok === false) {
|
|
1064
|
+
const moved = (rg.anchors || []).filter((a: RegAnchor) => Math.abs(a.dy) > rg.tolPx);
|
|
1065
|
+
console.log('!! registration DRIFT: part of this screenshot is offset from view.xml (mid-animation capture). Drifted anchors:');
|
|
1066
|
+
for (const a of moved) { console.log(`!! ${a.rid || 'node' + a.node} declared ${a.declaredPx} dy=${a.dy}px`); }
|
|
1067
|
+
console.log('!! a rectangle copied from view.xml inside one of those subtrees must be shifted by that dy; elsewhere it is as declared.');
|
|
1068
|
+
}
|
|
1069
|
+
} catch { /* no pack beside the screenshot */ }
|
|
1070
|
+
let bad: number = 0;
|
|
1071
|
+
specs.forEach((s: ProbeSpec, i: number) => {
|
|
1072
|
+
if (specs.length > 1) {
|
|
1073
|
+
console.log(`### [${i + 1}/${specs.length}]${s.label ? ' ' + s.label : ''} ${s.rect || 'full'} ${s.mode}${s.color ? ' #' + s.color.replace('#', '') : ''}`);
|
|
1074
|
+
}
|
|
1075
|
+
if (!probeOne(im, s, dens)) { bad++; }
|
|
1076
|
+
});
|
|
1077
|
+
if (bad > 0 && specs.length === 1) { process.exit(2); }
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/** One rectangle question. Returns false on a bad spec (printed to stderr). */
|
|
1081
|
+
function probeOne(im: Png, s: ProbeSpec, dens: number): boolean {
|
|
1082
|
+
const r: number[] = (s.rect || `0,0,${im.width},${im.height}`).split(',').map((v) => parseInt(v, 10));
|
|
1083
|
+
if (r.length !== 4 || r.some((v) => isNaN(v))) {
|
|
1084
|
+
console.error(` bad rect: ${s.rect} (expected x1,y1,x2,y2)`);
|
|
1085
|
+
return false;
|
|
1086
|
+
}
|
|
1087
|
+
const x1: number = Math.max(0, r[0]);
|
|
1088
|
+
const y1: number = Math.max(0, r[1]);
|
|
1089
|
+
const x2: number = Math.min(im.width - 1, r[2]);
|
|
1090
|
+
const y2: number = Math.min(im.height - 1, r[3]);
|
|
1091
|
+
const mode: string = s.mode;
|
|
1092
|
+
const tol: number = s.tol;
|
|
1093
|
+
const hex = (c: number[]): string =>
|
|
1094
|
+
'#' + c.slice(0, 3).map((v) => v.toString(16).padStart(2, '0').toUpperCase()).join('');
|
|
1095
|
+
const lum = (c: number[]): number => 0.299 * c[0] + 0.587 * c[1] + 0.114 * c[2];
|
|
1096
|
+
const vp = (n: number): string => (dens > 0 ? ` (${(n / dens).toFixed(2)}vp)` : '');
|
|
1097
|
+
|
|
1098
|
+
if (mode === 'colors') {
|
|
1099
|
+
const hist: Map<string, number> = new Map<string, number>();
|
|
1100
|
+
for (let y = y1; y <= y2; y++) {
|
|
1101
|
+
for (let x = x1; x <= x2; x++) {
|
|
1102
|
+
const k: string = hex(px(im, x, y));
|
|
1103
|
+
hist.set(k, (hist.get(k) || 0) + 1);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
const top: string[] = [...hist.entries()].sort((a, b) => b[1] - a[1]).slice(0, 4)
|
|
1107
|
+
.map((e) => `${e[0]}×${e[1]}`);
|
|
1108
|
+
const cc = contrastColors(im, x1, y1, x2 + 1, y2 + 1);
|
|
1109
|
+
console.log(`rect [${x1},${y1}][${x2},${y2}]`);
|
|
1110
|
+
console.log(` bg : ${cc.bg}${cc.bgUniform ? '' : ' (non-solid background: the border has no mode, the median is used as reference)'}`);
|
|
1111
|
+
console.log(` ink : ${cc.ink} (${(cc.inkShare * 100).toFixed(1)}% of pixels)`);
|
|
1112
|
+
console.log(` darkest : ${cc.darkest}`);
|
|
1113
|
+
if (cc.inkShare < 0.005 && cc.ink !== cc.bg) {
|
|
1114
|
+
console.log(` !! ink ${cc.ink} exists but covers <0.5% of the rect: the rect likely clips the element's edge. ` +
|
|
1115
|
+
'This is NOT evidence that the element is invisible; re-aim the rect (check measure_pack registration) before concluding.');
|
|
1116
|
+
}
|
|
1117
|
+
console.log(` top : ${top.join(' ')}`);
|
|
1118
|
+
console.log(' note: for text/strokes use ink (mode of the pixels farthest from the background, also holds for light-on-dark), for the background use bg');
|
|
1119
|
+
} else if (mode === 'runs') {
|
|
1120
|
+
console.log(`rect [${x1},${y1}][${x2},${y2}] dark-pixel runs per row (lum<${170})`);
|
|
1121
|
+
for (let y = y1; y <= y2; y++) {
|
|
1122
|
+
const runs: string[] = [];
|
|
1123
|
+
let s: number = -1;
|
|
1124
|
+
for (let x = x1; x <= x2 + 1; x++) {
|
|
1125
|
+
const d: boolean = x <= x2 && lum(px(im, x, y)) < 170;
|
|
1126
|
+
if (d && s < 0) { s = x; }
|
|
1127
|
+
if (!d && s >= 0) { runs.push(`${s}-${x - 1}`); s = -1; }
|
|
1128
|
+
}
|
|
1129
|
+
if (runs.length > 0) { console.log(` y=${y} ${runs.join(' ')}`); }
|
|
1130
|
+
}
|
|
1131
|
+
console.log(' note: read the vertex coordinates of polyline/bar icons from the run endpoints; the ink bbox only gives the bounding rectangle');
|
|
1132
|
+
} else if (mode === 'ascii') {
|
|
1133
|
+
const ramp: string = ' .:-=+*#%@';
|
|
1134
|
+
for (let y = y1; y <= y2; y++) {
|
|
1135
|
+
let line: string = '';
|
|
1136
|
+
for (let x = x1; x <= x2; x++) {
|
|
1137
|
+
const l: number = lum(px(im, x, y)) / 255;
|
|
1138
|
+
line += ramp[Math.min(9, Math.max(0, Math.round((1 - l) * 9)))];
|
|
1139
|
+
}
|
|
1140
|
+
console.log(String(y).padStart(5) + ' ' + line);
|
|
1141
|
+
}
|
|
1142
|
+
} else if (mode === 'filter') {
|
|
1143
|
+
const want: string | null = s.color;
|
|
1144
|
+
if (!want) {
|
|
1145
|
+
console.error('--mode filter needs --color RRGGBB');
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1148
|
+
const t: string = (want as string).replace('#', '');
|
|
1149
|
+
const tgt: number[] = [0, 2, 4].map((i) => parseInt(t.slice(i, i + 2), 16));
|
|
1150
|
+
let mnx: number = 1e9, mxx: number = -1, mny: number = 1e9, mxy: number = -1, n: number = 0;
|
|
1151
|
+
for (let y = y1; y <= y2; y++) {
|
|
1152
|
+
for (let x = x1; x <= x2; x++) {
|
|
1153
|
+
const c: number[] = px(im, x, y);
|
|
1154
|
+
if (Math.abs(c[0] - tgt[0]) <= tol && Math.abs(c[1] - tgt[1]) <= tol
|
|
1155
|
+
&& Math.abs(c[2] - tgt[2]) <= tol) {
|
|
1156
|
+
n++;
|
|
1157
|
+
if (x < mnx) { mnx = x; } if (x > mxx) { mxx = x; }
|
|
1158
|
+
if (y < mny) { mny = y; } if (y > mxy) { mxy = y; }
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
if (n === 0) {
|
|
1163
|
+
console.log(`no pixel matches color #${t.toUpperCase()} (tol=${tol}) — use --mode colors first to see the real colors`);
|
|
1164
|
+
return true;
|
|
1165
|
+
}
|
|
1166
|
+
const w: number = mxx - mnx + 1;
|
|
1167
|
+
const h: number = mxy - mny + 1;
|
|
1168
|
+
console.log(`color #${t.toUpperCase()} (tol=${tol}) matched ${n}px`);
|
|
1169
|
+
console.log(` bbox [${mnx},${mny}][${mxx},${mxy}]`);
|
|
1170
|
+
console.log(` size w=${w}${vp(w)} h=${h}${vp(h)}`);
|
|
1171
|
+
console.log(' note: this mode filters by color and is not affected by bgSpread / a non-uniform background');
|
|
1172
|
+
} else {
|
|
1173
|
+
console.error(`unknown --mode: ${mode} (one of colors|runs|ascii|filter)`);
|
|
1174
|
+
return false;
|
|
1175
|
+
}
|
|
1176
|
+
return true;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
function main(): void {
|
|
1180
|
+
const argv: string[] = process.argv.slice(2);
|
|
1181
|
+
const arg = (k: string): string | null => {
|
|
1182
|
+
const i: number = argv.indexOf(k);
|
|
1183
|
+
return i >= 0 && i + 1 < argv.length ? argv[i + 1] : null;
|
|
1184
|
+
};
|
|
1185
|
+
if (argv.includes('--probe')) { runProbe(argv, arg); return; }
|
|
1186
|
+
const dir: string | null = arg('--ui-info');
|
|
1187
|
+
const quiet: boolean = argv.includes('--quiet');
|
|
1188
|
+
if (!dir) {
|
|
1189
|
+
console.error('usage: node measure_pack.ts --ui-info <page_NNNN_X dir> [--out f.json] [--quiet]');
|
|
1190
|
+
process.exit(2);
|
|
1191
|
+
}
|
|
1192
|
+
// Take the screenshot/view tree from the exact paths declared in meta.json (no Glob guessing)
|
|
1193
|
+
let shot: string = path.join(dir, 'screenshot.png');
|
|
1194
|
+
let vx: string = path.join(dir, 'view.xml');
|
|
1195
|
+
const metaP: string = path.join(dir, 'meta.json');
|
|
1196
|
+
let pageId: string = path.basename(dir);
|
|
1197
|
+
// True values recorded via `wm density`/`wm size` at capture time (written to device_info by page_capture.mjs).
|
|
1198
|
+
// With them no inference is needed — inference is non-unique, one wrong solve puts the whole page's vp off by 2~3x, and compilation and reference checks
|
|
1199
|
+
// all still pass, very hard to attribute. An explicit --density ranks higher (a value manually verified by the parent flow).
|
|
1200
|
+
let metaDensity: number | null = null;
|
|
1201
|
+
let metaScreen: ScreenSize | null = null;
|
|
1202
|
+
let metaStatusBarPx: number | null = null;
|
|
1203
|
+
const cliDensity: number = parseFloat(arg('--density') || '0');
|
|
1204
|
+
if (fs.existsSync(metaP)) {
|
|
1205
|
+
try {
|
|
1206
|
+
const meta = JSON.parse(fs.readFileSync(metaP, 'utf8')) as Record<string, unknown>;
|
|
1207
|
+
if (typeof meta.page_id === 'string') { pageId = meta.page_id; }
|
|
1208
|
+
const root: string = path.dirname(dir);
|
|
1209
|
+
if (typeof meta.screenshot === 'string') { shot = path.resolve(root, meta.screenshot); }
|
|
1210
|
+
if (typeof meta.view_xml === 'string') { vx = path.resolve(root, meta.view_xml); }
|
|
1211
|
+
const dev = meta.device_info as Record<string, unknown> | undefined;
|
|
1212
|
+
if (dev && typeof dev.density === 'number' && dev.density > 0) {
|
|
1213
|
+
metaDensity = dev.density;
|
|
1214
|
+
}
|
|
1215
|
+
// Full-screen size true value: uiautomator only dumps the focused window, so a dialog page's node bounding box is not the full screen,
|
|
1216
|
+
// and running it through the screen-size gate would misjudge. Use the `wm size` true value when available.
|
|
1217
|
+
if (dev && typeof dev.status_bar_px === 'number' && dev.status_bar_px >= 0) {
|
|
1218
|
+
metaStatusBarPx = dev.status_bar_px;
|
|
1219
|
+
}
|
|
1220
|
+
if (dev && typeof dev.width_px === 'number' && typeof dev.height_px === 'number'
|
|
1221
|
+
&& dev.width_px > 0 && dev.height_px > 0) {
|
|
1222
|
+
metaScreen = { widthPx: dev.width_px, heightPx: dev.height_px };
|
|
1223
|
+
}
|
|
1224
|
+
} catch (e) {
|
|
1225
|
+
console.error('meta.json parse failed, falling back to the default file names: ' + String(e));
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
if (!fs.existsSync(vx)) {
|
|
1229
|
+
console.error('view tree not found: ' + vx);
|
|
1230
|
+
process.exit(2);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
// The whole tree (including out-of-bounds nodes with negative coordinates) is only used for occlusion; measurement, density and regions only consider nodes with non-negative coordinates
|
|
1234
|
+
// (an out-of-bounds node's box is not something on the screenshot).
|
|
1235
|
+
const tree: Node[] = parseNodes(fs.readFileSync(vx, 'utf8'));
|
|
1236
|
+
const nodes: Node[] = tree.filter((n) => n.x1 >= 0 && n.y1 >= 0 && n.x2 >= 0 && n.y2 >= 0);
|
|
1237
|
+
const root: Node = nodes[0];
|
|
1238
|
+
// Priority: --density > meta.json device_info.density > node inference
|
|
1239
|
+
const known: KnownDensity | null =
|
|
1240
|
+
cliDensity > 0 ? { value: cliDensity, source: 'cli' }
|
|
1241
|
+
: metaDensity !== null ? { value: metaDensity, source: 'device' }
|
|
1242
|
+
: null;
|
|
1243
|
+
const den: DensityResult = deriveDensity(nodes, known, metaScreen);
|
|
1244
|
+
const d: number | null = den.density;
|
|
1245
|
+
const toVp = (v: number): number | null => (d ? Math.round((v / d) * 100) / 100 : null);
|
|
1246
|
+
if (!den.confident) {
|
|
1247
|
+
console.error(`!! low density confidence (source=${den.source}) — ${den.reason ?? 'unknown reason'}`);
|
|
1248
|
+
}
|
|
1249
|
+
if (den.crosscheck) {
|
|
1250
|
+
console.error('!! ' + den.crosscheck);
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
let im: Png | null = null;
|
|
1254
|
+
let imErr: string = '';
|
|
1255
|
+
if (fs.existsSync(shot)) {
|
|
1256
|
+
try {
|
|
1257
|
+
im = decodePng(shot);
|
|
1258
|
+
} catch (e) {
|
|
1259
|
+
imErr = String(e);
|
|
1260
|
+
}
|
|
1261
|
+
} else {
|
|
1262
|
+
imErr = 'screenshot not found: ' + shot;
|
|
1263
|
+
}
|
|
1264
|
+
// Decode failure must be **loud and explicit**, not just sit in a JSON field: the symptom would be density computed
|
|
1265
|
+
// while ink/edge_colors are all empty, which looks like "nothing measurable on this page" rather than "the measurer is broken".
|
|
1266
|
+
if (imErr) {
|
|
1267
|
+
console.error('!! pixel measurement unavailable — ' + imErr);
|
|
1268
|
+
console.error('!! this pack holds view tree measurements only; ink bbox and color samples are missing, do not assert drawn sizes from it.');
|
|
1269
|
+
}
|
|
1270
|
+
// View tree root and screenshot pixel size differ — convert sampling coordinates by scale (see toImgRect),
|
|
1271
|
+
// instead of silently skipping out-of-image nodes as the old implementation did.
|
|
1272
|
+
const cs: CoordSpace | null = im ? coordSpace(im, root, metaScreen) : null;
|
|
1273
|
+
if (im && cs && (Math.abs(cs.sx - 1) > 0.02 || Math.abs(cs.sy - 1) > 0.02)) {
|
|
1274
|
+
console.error(`!! view tree ${cs.windowed ? 'screen' : 'root'} coordinates do not match the screenshot (${im.width}x${im.height})` +
|
|
1275
|
+
` (scale x=${cs.sx.toFixed(4)} y=${cs.sy.toFixed(4)}); ink/color sample coordinates were scaled — ` +
|
|
1276
|
+
'common on devices whose logical resolution was overridden with `wm size` (e.g. dev boards).');
|
|
1277
|
+
}
|
|
1278
|
+
if (cs && cs.windowed && !quiet) {
|
|
1279
|
+
console.error(` view tree root [${root.x1},${root.y1}][${root.x2},${root.y2}] is a sub-window (dialog/popup): ` +
|
|
1280
|
+
'coordinates are sampled as absolute screen coordinates, not scaled by the root size.');
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
// Main regions = interactive / has text or description / scrollable / known widget classes.
|
|
1284
|
+
//
|
|
1285
|
+
// The last item cannot be dropped: measured, `android.widget.SeekBar` has clickable=false, empty text and
|
|
1286
|
+
// content-desc, scrollable=false — filtering only by the first three would miss the progress bar entirely,
|
|
1287
|
+
// and it is exactly one of the regions on this page needing precise measurement (declared box 42px high, drawn track 26px).
|
|
1288
|
+
// Any filter that "judges importance by interaction attributes" has this blind spot, hence an extra widget-class allowlist.
|
|
1289
|
+
const WIDGET = /\.(SeekBar|ProgressBar|Switch|CheckBox|RadioButton|EditText|ImageView|ImageButton|RatingBar|Spinner|ToggleButton|Button|TextView)$/;
|
|
1290
|
+
const picked: Node[] = nodes.filter((n) =>
|
|
1291
|
+
n.clickable || n.scrollable || n.checkable ||
|
|
1292
|
+
n.text.length > 0 || n.desc.length > 0 || WIDGET.test(n.cls));
|
|
1293
|
+
|
|
1294
|
+
// ---- Coordinate system: Android bounds count from the screen top. HarmonyOS content stays in the safe area (shell contract system_bars),
|
|
1295
|
+
// so offsets must be converted to safe-area coordinates = screen y - status bar height. Measured weather home: under EdgeToEdge root starts at y=0,
|
|
1296
|
+
// the toolbar measured marginTop 50 in screen coordinates; copied verbatim into the header inside the safe area, the whole row shifted down 24vp and overlapped the temperature.
|
|
1297
|
+
// Status bar height source: meta status_bar_px > content top edge of a non-immersive page > 24dp estimate (Android default).
|
|
1298
|
+
// Dialogs/popups are detected by **horizontal inset**: a full-width non-immersive page root is also shorter than the screen (coordSpace samples it by absolute coordinates as well),
|
|
1299
|
+
// but it is not a dialog.
|
|
1300
|
+
// Screen width is compared with root in the same view-tree coordinate system: when coordSpace judges full screen (including no wm size, scaled screenshot) root
|
|
1301
|
+
// is the screen; when judged a sub-window, screen width takes the wm size true value, and without it coordSpace already treats screenshot = screen (scale 1).
|
|
1302
|
+
const screenW: number = metaScreen ? metaScreen.widthPx : (im ? im.width : root.w);
|
|
1303
|
+
// Sub-window: horizontally inset, or full width with the top edge far below any status bar (bottom-sheet BottomSheetDialog, full-width PopupWindow).
|
|
1304
|
+
const windowedRoot: boolean = (cs ? cs.windowed : metaScreen !== null) &&
|
|
1305
|
+
(root.x1 > 2 || root.x2 < screenW - 2 || (d !== null && d > 0 && root.y1 / d > 48));
|
|
1306
|
+
// A non-immersive page's DecorView (uiautomator root) usually also starts at y=0 with content below the status bar: look at the top edge of android:id/content.
|
|
1307
|
+
const content: Node | undefined = nodes.find((n) => n.rid === 'android:id/content');
|
|
1308
|
+
const contentTop: number = content ? content.y1 : root.y1;
|
|
1309
|
+
let barPx: number | null = null;
|
|
1310
|
+
let barSource: string = '';
|
|
1311
|
+
if (metaStatusBarPx !== null) { barPx = metaStatusBarPx; barSource = 'device_info.status_bar_px'; }
|
|
1312
|
+
else if (!windowedRoot && contentTop > 2 && d && contentTop / d <= 48) { barPx = contentTop; barSource = 'content top edge (non-immersive page)'; }
|
|
1313
|
+
else if (d) { barPx = Math.round(24 * d); barSource = 'estimate: Android default 24dp, may be taller on notched screens'; }
|
|
1314
|
+
const edgeToEdge: boolean = !windowedRoot && contentTop <= 2;
|
|
1315
|
+
const safeTop = (y: number): number | null =>
|
|
1316
|
+
(barPx === null || !d) ? null : Math.round(((y - barPx) / d) * 100) / 100;
|
|
1317
|
+
// Dialog: the window root carries a background inset; the drawn panel is android:id/content (or the first narrower child)
|
|
1318
|
+
let panel: Node | null = null;
|
|
1319
|
+
if (windowedRoot) {
|
|
1320
|
+
panel = nodes.find((n) => /:id\/content$/.test(n.rid)) ||
|
|
1321
|
+
nodes.find((n) => n !== root && n.w < root.w - 4 && n.w > root.w / 2) || null;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
// ---- Navigation bar: the DecorView chain (nodes sharing root's box) often draws to the screen bottom, while the app's own layout stops at the nav bar's top edge.
|
|
1325
|
+
// Measured weather settings page: root/content/placeHolder are all [0,0][1080,2400], fragment_container ends at 2274,
|
|
1326
|
+
// the bottom 126px = 48dp is the three-button nav bar (white). Without subtracting it, app bounds gain 48vp, and bottom-edge color sampling hits
|
|
1327
|
+
// the nav bar's white, from which the parent flow misread a black page as "a popup/dim scrim overlay on the screenshot".
|
|
1328
|
+
// Criterion: the gap between the screen bottom and the app layout's bottom edge is within (0, 64dp]. Sub-windows are not at the screen bottom and are not judged.
|
|
1329
|
+
// A non-immersive page's root itself stops at the nav bar's top edge, so the bottom edge is root.y2; blank space between the lowest in-page control and root's bottom belongs to the page.
|
|
1330
|
+
// Only when root draws to the screen bottom, look for the lowest bottom edge among nodes outside the DecorView chain.
|
|
1331
|
+
const screenBottom: number = metaScreen ? metaScreen.heightPx : root.y2;
|
|
1332
|
+
let contentBottom: number = root.y2;
|
|
1333
|
+
let navPx: number = 0;
|
|
1334
|
+
if (!windowedRoot && d) {
|
|
1335
|
+
let bottom: number = root.y2;
|
|
1336
|
+
let fullWidth: boolean = true;
|
|
1337
|
+
if (root.y2 >= screenBottom) {
|
|
1338
|
+
const own: Node[] = nodes.filter((n) =>
|
|
1339
|
+
!(n.x1 === root.x1 && n.y1 === root.y1 && n.x2 === root.x2 && n.y2 === root.y2));
|
|
1340
|
+
bottom = own.length ? Math.min(root.y2, Math.max(...own.map((n) => n.y2))) : root.y2;
|
|
1341
|
+
// Ending at that bottom edge requires a full-width container (clMain / content): a page whose content is merely short with its lowest control near the bottom is not a nav bar.
|
|
1342
|
+
fullWidth = own.some((n) => n.y2 === bottom && n.w >= root.w - 2);
|
|
1343
|
+
}
|
|
1344
|
+
const gap: number = screenBottom - bottom;
|
|
1345
|
+
if (fullWidth && gap > 2 && gap / d <= 64) {
|
|
1346
|
+
navPx = gap;
|
|
1347
|
+
contentBottom = bottom;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
const appH: number = contentBottom - root.y1;
|
|
1351
|
+
|
|
1352
|
+
const coverOf: Map<Node, Node> = occluders(tree);
|
|
1353
|
+
const covering = new Map<number, Node>();
|
|
1354
|
+
const regions: RegionOut[] = picked.map((n) => {
|
|
1355
|
+
const over: Node | undefined = coverOf.get(n);
|
|
1356
|
+
const r: RegionOut = {
|
|
1357
|
+
node: n.idx,
|
|
1358
|
+
role: n.cls.replace(/^android\.(widget|view)\./, ''),
|
|
1359
|
+
boundsPx: `[${n.x1},${n.y1}][${n.x2},${n.y2}]`,
|
|
1360
|
+
wPx: n.w,
|
|
1361
|
+
hPx: n.h,
|
|
1362
|
+
wVp: toVp(n.w),
|
|
1363
|
+
hVp: toVp(n.h),
|
|
1364
|
+
xRatio: Math.round(((n.x1 - root.x1) / root.w) * 1e4) / 1e4,
|
|
1365
|
+
yRatio: Math.round(((n.y1 - root.y1) / appH) * 1e4) / 1e4,
|
|
1366
|
+
wRatio: Math.round((n.w / root.w) * 1e4) / 1e4,
|
|
1367
|
+
hRatio: Math.round((n.h / appH) * 1e4) / 1e4,
|
|
1368
|
+
clickable: n.clickable,
|
|
1369
|
+
text: n.text,
|
|
1370
|
+
desc: n.desc,
|
|
1371
|
+
ink: null,
|
|
1372
|
+
safeTopVp: safeTop(n.y1)
|
|
1373
|
+
};
|
|
1374
|
+
if (over) {
|
|
1375
|
+
r.occludedBy = over.idx;
|
|
1376
|
+
covering.set(over.idx, over);
|
|
1377
|
+
} else if (im) {
|
|
1378
|
+
const ir: ImgRect | null = cs ? toImgRect(im, cs, n) : null;
|
|
1379
|
+
if (ir) {
|
|
1380
|
+
r.ink = inkBox(im, ir.x1, ir.y1, ir.x2, ir.y2);
|
|
1381
|
+
if (r.ink && (r.ink.w !== n.w || r.ink.h !== n.h)) {
|
|
1382
|
+
r.inkNote = 'drawn shape is smaller than the declared box — the declared box may be a semantic/touch box, do not use it as the drawn size';
|
|
1383
|
+
}
|
|
1384
|
+
const c = regionColors(im, ir.x1, ir.y1, ir.x2, ir.y2);
|
|
1385
|
+
r.inkColor = c.ink;
|
|
1386
|
+
r.bgColor = c.bg;
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
return r;
|
|
1390
|
+
});
|
|
1391
|
+
|
|
1392
|
+
// Screenshot ↔ view-tree registration, then every visible icon sampled at its registered position
|
|
1393
|
+
const skipOcc = (n: Node): boolean => coverOf.has(n);
|
|
1394
|
+
const reg: Registration | null = im && cs ? registration(im, cs, nodes, skipOcc) : null;
|
|
1395
|
+
const icons: IconRow[] = im && cs && reg
|
|
1396
|
+
? iconInventory(im, cs, nodes, tree, reg, d ? Math.round(16 * d) : 32, skipOcc, root) : [];
|
|
1397
|
+
if (reg && reg.ok === false) { console.error('!! ' + reg.note); }
|
|
1398
|
+
|
|
1399
|
+
// Four-edge color sampling: for judging background/scrim compositing and edge tinting under immersion (values only, no judgment).
|
|
1400
|
+
// With a nav bar, bottom/center are sampled within the app content area, and the nav bar itself is listed separately as nav_bar.
|
|
1401
|
+
const edges: Record<string, number[]> = {};
|
|
1402
|
+
if (im) {
|
|
1403
|
+
// Same conversion as toImgRect: for sub-windows oy=0, sy is still the screenshot/screen ratio
|
|
1404
|
+
const imgY = (y: number): number => Math.min(im!.height - 1, Math.max(0,
|
|
1405
|
+
cs ? Math.round((y - cs.oy) * cs.sy) : y));
|
|
1406
|
+
// Convert the bottom edge first, then subtract 1: after scaling, contentBottom - 1 may round onto the nav bar's first row
|
|
1407
|
+
const bottomY: number = navPx > 0 ? Math.max(0, imgY(contentBottom) - 1) : im.height - 1;
|
|
1408
|
+
const mid: number = Math.floor(bottomY / 2);
|
|
1409
|
+
const midx: number = Math.floor(im.width / 2);
|
|
1410
|
+
edges.top = px(im, midx, 0);
|
|
1411
|
+
edges.bottom = px(im, midx, bottomY);
|
|
1412
|
+
edges.left = px(im, 0, mid);
|
|
1413
|
+
edges.right = px(im, im.width - 1, mid);
|
|
1414
|
+
edges.center = px(im, midx, mid);
|
|
1415
|
+
if (navPx > 0) {
|
|
1416
|
+
// Sample the left edge: the centerline has the three-button nav icons
|
|
1417
|
+
edges.nav_bar = px(im, 2, Math.floor((bottomY + 1 + im.height) / 2));
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// Left/right edges of text boxes (relative to the app content box; for dialogs relative to the panel); texts with the same indent form a group.
|
|
1422
|
+
// The parent flow pastes the summary into the prompt: when x stayed only in regions, sub-agents read bounds line by line and, measured, missed
|
|
1423
|
+
// that category titles and items share 72vp (Preference's iconSpaceReserved), so categories were written flush to the edge.
|
|
1424
|
+
const box: Node = panel ?? root;
|
|
1425
|
+
const texts: RegionOut[] = regions.filter((r) => r.occludedBy === undefined && r.text.length > 0);
|
|
1426
|
+
const byNode = new Map<number, Node>(nodes.map((n) => [n.idx, n]));
|
|
1427
|
+
const edgeGroups = (offset: (n: Node) => number, keep: (n: Node) => boolean = () => true):
|
|
1428
|
+
{ px: number; vp: number | null; texts: string[] }[] => {
|
|
1429
|
+
const items = texts.filter((r) => keep(byNode.get(r.node)!)).map((r) => ({ off: offset(byNode.get(r.node)!), text: r.text.replace(/\s+/g, ' ') }))
|
|
1430
|
+
.sort((a, b) => a.off - b.off);
|
|
1431
|
+
const groups: { px: number; vp: number | null; texts: string[] }[] = [];
|
|
1432
|
+
for (const it of items) {
|
|
1433
|
+
const g = groups[groups.length - 1];
|
|
1434
|
+
if (g && it.off - g.px <= 2) { g.texts.push(it.text); continue; }
|
|
1435
|
+
groups.push({ px: it.off, vp: toVp(it.off), texts: [it.text] });
|
|
1436
|
+
}
|
|
1437
|
+
return groups;
|
|
1438
|
+
};
|
|
1439
|
+
const textEdges = {
|
|
1440
|
+
left: edgeGroups((n) => n.x1 - box.x1),
|
|
1441
|
+
// A wrap_content box's right edge varies with text length and is not layout intent: only boxes at least half the width count
|
|
1442
|
+
right: edgeGroups((n) => box.x2 - n.x2, (n) => n.w >= box.w / 2)
|
|
1443
|
+
};
|
|
1444
|
+
|
|
1445
|
+
const out = {
|
|
1446
|
+
page_id: pageId,
|
|
1447
|
+
generated_by: 'measure_pack.ts',
|
|
1448
|
+
inputs: {
|
|
1449
|
+
view_xml: vx,
|
|
1450
|
+
screenshot: fs.existsSync(shot) ? shot : null,
|
|
1451
|
+
screenshot_error: imErr || null
|
|
1452
|
+
},
|
|
1453
|
+
image: im ? { width: im.width, height: im.height } : null,
|
|
1454
|
+
density: {
|
|
1455
|
+
value: d,
|
|
1456
|
+
source: den.source,
|
|
1457
|
+
confident: den.confident,
|
|
1458
|
+
rival: den.rival,
|
|
1459
|
+
crosscheck: den.crosscheck,
|
|
1460
|
+
reason: den.reason,
|
|
1461
|
+
evidence: den.evidence.slice(0, 8)
|
|
1462
|
+
},
|
|
1463
|
+
app_content_bounds: {
|
|
1464
|
+
boundsPx: `[${root.x1},${root.y1}][${root.x2},${contentBottom}]`,
|
|
1465
|
+
wPx: root.w,
|
|
1466
|
+
hPx: appH,
|
|
1467
|
+
wVp: toVp(root.w),
|
|
1468
|
+
hVp: toVp(appH)
|
|
1469
|
+
},
|
|
1470
|
+
nav_bar: navPx > 0 ? {
|
|
1471
|
+
boundsPx: `[${root.x1},${contentBottom}][${root.x2},${screenBottom}]`,
|
|
1472
|
+
hPx: navPx,
|
|
1473
|
+
hVp: toVp(navPx),
|
|
1474
|
+
source: 'screen bottom minus the lowest bottom edge of the app layout',
|
|
1475
|
+
note: 'system navigation bar, already subtracted from app_content_bounds, not part of this page; the bottom edge color is sampled inside its upper edge'
|
|
1476
|
+
} : null,
|
|
1477
|
+
coordinate_frame: {
|
|
1478
|
+
edge_to_edge: edgeToEdge,
|
|
1479
|
+
status_bar_px: barPx,
|
|
1480
|
+
status_bar_vp: barPx !== null ? toVp(barPx) : null,
|
|
1481
|
+
status_bar_source: barSource || null,
|
|
1482
|
+
note: 'region boundsPx are screen coordinates (status bar included). HarmonyOS content lives inside the safe area, so use safeTopVp for offsets/heights; ' +
|
|
1483
|
+
'take a control\'s position from its own bounds, never borrow a neighbouring control\'s margin'
|
|
1484
|
+
},
|
|
1485
|
+
...(panel ? { dialog_panel: {
|
|
1486
|
+
node: panel.idx,
|
|
1487
|
+
boundsPx: `[${panel.x1},${panel.y1}][${panel.x2},${panel.y2}]`,
|
|
1488
|
+
wVp: toVp(panel.w),
|
|
1489
|
+
hVp: toVp(panel.h),
|
|
1490
|
+
screenWidthRatio: Math.round((panel.w / screenW) * 1e4) / 1e4,
|
|
1491
|
+
windowWidthRatio: Math.round((root.w / screenW) * 1e4) / 1e4,
|
|
1492
|
+
insetVp: toVp(panel.x1 - root.x1),
|
|
1493
|
+
note: 'the dialog backboard IS the panel: openCustomDialog / CustomDialogController options width(screenWidthRatio as a percentage), ' +
|
|
1494
|
+
"backgroundBlurStyle BlurStyle.NONE, backgroundColor = panel colour, cornerRadius = panel radius; the builder root is width('100%') " +
|
|
1495
|
+
'with no padding / background. The window-to-panel inset (insetVp) is transparent on Android: do not turn it into a container. ' +
|
|
1496
|
+
"Do not write wVp as a constant (the reference device's screen width differs from the target's)"
|
|
1497
|
+
} } : {}),
|
|
1498
|
+
edge_colors: edges,
|
|
1499
|
+
text_edges: {
|
|
1500
|
+
reference: panel ? 'dialog_panel' : 'app_content_bounds',
|
|
1501
|
+
note: 'distance from the TextView box (not ink) to the left/right edge of the reference box, grouped within ±2px. right only lists boxes at least half as wide as the reference (a wrap_content box\'s right edge moves with the text length)',
|
|
1502
|
+
...textEdges
|
|
1503
|
+
},
|
|
1504
|
+
...(covering.size ? { occluded_note: 'regions with occludedBy are fully covered by the upper node of that index (usually a new page stacked over a lower Fragment): ' +
|
|
1505
|
+
'invisible in the screenshot, not part of this page\'s structure, colors not sampled. The criterion cannot tell whether the upper layer is transparent; when it contradicts the screenshot, the screenshot wins' } : {}),
|
|
1506
|
+
registration: reg,
|
|
1507
|
+
icon_inventory: icons,
|
|
1508
|
+
node_count: nodes.length,
|
|
1509
|
+
regions
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1512
|
+
const outFile: string = arg('--out') || path.join(dir, 'measure_pack.json');
|
|
1513
|
+
fs.writeFileSync(outFile, JSON.stringify(out, null, 2), 'utf8');
|
|
1514
|
+
|
|
1515
|
+
// The summary is also written as a UTF-8 file measure_summary.txt (same directory as measure_pack.json):
|
|
1516
|
+
// the parent flow's PowerShell `> file` redirection produces UTF-16LE, which the sub-agent's Read tool cannot read;
|
|
1517
|
+
// measured: two groups failed to read 5 times in total and each re-read with Get-Content.
|
|
1518
|
+
const summary: string[] = [];
|
|
1519
|
+
const realLog = console.log;
|
|
1520
|
+
console.log = (...a: unknown[]): void => { summary.push(a.map(String).join(' ')); };
|
|
1521
|
+
try {
|
|
1522
|
+
{
|
|
1523
|
+
console.log(`measure_pack —— ${pageId}`);
|
|
1524
|
+
console.log(` ${col('view tree')}: ${vx}`);
|
|
1525
|
+
console.log(` ${col('screenshot')}: ${fs.existsSync(shot) ? shot : '(missing) ' + imErr}`);
|
|
1526
|
+
if (im) { console.log(` ${col('image')}: ${im.width}x${im.height}`); }
|
|
1527
|
+
const confLabel: string = den.confident ? 'trustworthy' : 'not trustworthy, do not cite directly';
|
|
1528
|
+
console.log(` ${col('density')}: ${d === null ? '(cannot infer)' : d}` +
|
|
1529
|
+
` (source=${den.source}, confident=${den.confident} — ${confLabel})`);
|
|
1530
|
+
if (!den.confident && den.reason) { console.log(` reason: ${den.reason}`); }
|
|
1531
|
+
if (den.rival) { console.log(` runner-up: ${den.rival.density} (${den.rival.hits} hits)`); }
|
|
1532
|
+
if (den.crosscheck) { console.log(` !! ${den.crosscheck}`); }
|
|
1533
|
+
for (const e of den.evidence.slice(0, 4)) {
|
|
1534
|
+
console.log(` evidence: node ${e.node} side ${e.sidePx}px / ${e.dp}dp = ${e.density}`);
|
|
1535
|
+
}
|
|
1536
|
+
console.log(` ${col(panel ? 'window' : 'app bounds')}: ${out.app_content_bounds.boundsPx}` +
|
|
1537
|
+
` = ${out.app_content_bounds.wVp}x${out.app_content_bounds.hVp} vp` +
|
|
1538
|
+
(panel ? ' (dialog window, includes the transparent background inset, not the panel)' : ''));
|
|
1539
|
+
if (out.nav_bar) {
|
|
1540
|
+
console.log(` ${col("nav bar")}: ${out.nav_bar.boundsPx} = ${out.nav_bar.hVp}vp (${out.nav_bar.source}), ` +
|
|
1541
|
+
'already subtracted from app bounds, not part of this page');
|
|
1542
|
+
}
|
|
1543
|
+
if (panel) {
|
|
1544
|
+
const dp = out.dialog_panel!;
|
|
1545
|
+
console.log(` ${col('dialog panel')}: node ${dp.node} ${dp.boundsPx} = ${dp.wVp}x${dp.hVp} vp,` +
|
|
1546
|
+
` ${(dp.screenWidthRatio * 100).toFixed(1)}% of screen width; window ${(dp.windowWidthRatio * 100).toFixed(1)}% of screen width,` +
|
|
1547
|
+
` panel inset ${dp.insetVp}vp on each side`);
|
|
1548
|
+
console.log(` recipe: dialog options width: '${Math.round(dp.screenWidthRatio * 100)}%', backgroundBlurStyle: BlurStyle.NONE,` +
|
|
1549
|
+
" backgroundColor: <panel colour>, cornerRadius: <panel radius>; builder root width('100%'), no padding / background" +
|
|
1550
|
+
` (the ${dp.insetVp}vp window inset is transparent, not a layer) — never a constant width`);
|
|
1551
|
+
}
|
|
1552
|
+
if (!windowedRoot) {
|
|
1553
|
+
console.log(` ${col("coord frame")}: ${edgeToEdge ? 'immersive (EdgeToEdge), root starts at the top of the screen' : 'non-immersive, root sits below the status bar'}; ` +
|
|
1554
|
+
`status bar ${barPx ?? '?'}px = ${barPx !== null ? toVp(barPx) : '?'}vp (${barSource || 'none'})`);
|
|
1555
|
+
console.log(' conversion: y inside the safe area (vp) = (screen y px - status bar px) / density, i.e. each region\'s safeTopVp; ' +
|
|
1556
|
+
'HarmonyOS content lives inside the safe area, so offsets use it, not the screen y');
|
|
1557
|
+
}
|
|
1558
|
+
if (im) {
|
|
1559
|
+
console.log(` ${col('edge color')}: ` + Object.keys(edges)
|
|
1560
|
+
.map((k) => `${k}=(${edges[k].slice(0, 3).join(',')})`).join(' '));
|
|
1561
|
+
}
|
|
1562
|
+
if (reg) {
|
|
1563
|
+
console.log(` ${col('registration')}: ${reg.ok === false ? '!! DRIFT ' : reg.ok ? 'ok ' : 'unverified '}` +
|
|
1564
|
+
`(${reg.anchors.length} anchors) — ${reg.note}`);
|
|
1565
|
+
}
|
|
1566
|
+
if (icons.length) {
|
|
1567
|
+
console.log(` ${col('icons')}: ${icons.length} ImageView(s); each needs an "// ICON: <key>" marker in code (phase5 [icons])`);
|
|
1568
|
+
for (const ic of icons) {
|
|
1569
|
+
console.log(` ${ic.key.padEnd(24)} ${ic.visible ? 'VISIBLE' : 'blank '} ink ${ic.ink} ${(ic.inkShare * 100).toFixed(1)}% on ${ic.bg}` +
|
|
1570
|
+
` at ${ic.sampledPx}${ic.dy ? ' (shifted dy ' + ic.dy + (ic.dySource === 'fallback' ? ', fallback' : '') + ')' : ''}`);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
console.log(` ${col('regions')}: ${regions.length} / all nodes ${nodes.length}`);
|
|
1574
|
+
const hidden: number = regions.filter((r) => r.occludedBy !== undefined).length;
|
|
1575
|
+
if (hidden > 0) {
|
|
1576
|
+
const by: string = [...covering.values()]
|
|
1577
|
+
.map((o) => `node ${o.idx}${o.rid ? ' ' + o.rid.replace(/^.*:id\//, 'id/') : ''} [${o.x1},${o.y1}][${o.x2},${o.y2}]`)
|
|
1578
|
+
.join('; ');
|
|
1579
|
+
console.log(` ${col("occluded")}: ${hidden} region(s) covered by an upper layer (${by}), invisible in the screenshot, not part of this page; ` +
|
|
1580
|
+
'colors not sampled, see occludedBy in measure_pack.json');
|
|
1581
|
+
}
|
|
1582
|
+
// Color samples of text regions must go into the **printed summary**: the parent flow pastes this summary into the prompt,
|
|
1583
|
+
// so leaving them only in JSON saves nothing — the sub-agent would still start another round to probe colors.
|
|
1584
|
+
// Only regions with text/desc are listed, to avoid dumping all 37 regions.
|
|
1585
|
+
const painted: RegionOut[] = regions.filter(
|
|
1586
|
+
(r) => r.inkColor !== undefined && (r.text.length > 0 || r.desc.length > 0));
|
|
1587
|
+
if (painted.length > 0) {
|
|
1588
|
+
console.log(` ${col("text colors")}: (foreground = mode of the pixels farthest from the background, background = most frequent pixel; M3 on* roles differ by only a few dozen gray levels, do not judge by eye)`);
|
|
1589
|
+
for (const r of painted.slice(0, 14)) {
|
|
1590
|
+
const label: string = (r.text || r.desc).replace(/\s+/g, ' ').slice(0, 30);
|
|
1591
|
+
console.log(` node ${String(r.node).padStart(3)} ${r.inkColor} on ${r.bgColor} ${r.role} "${label}"`);
|
|
1592
|
+
}
|
|
1593
|
+
if (painted.length > 14) {
|
|
1594
|
+
console.log(` ... ${painted.length - 14} more, see inkColor/bgColor in measure_pack.json`);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
// Same group = same indent: Phase 5 "Horizontal Inset Evidence" compares group by group; same-group texts must land on the same left margin on the HarmonyOS side.
|
|
1598
|
+
if (texts.length > 0) {
|
|
1599
|
+
const unit: string = d ? 'vp' : 'px';
|
|
1600
|
+
const fmt = (g: { px: number; vp: number | null; texts: string[] }): string => {
|
|
1601
|
+
const shown: string = g.texts.slice(0, 6).map((t) => `"${t.slice(0, 24)}"`).join(', ');
|
|
1602
|
+
return ` ${String(d ? g.vp : g.px).padStart(7)}${unit}: ${shown}` +
|
|
1603
|
+
(g.texts.length > 6 ? ` … ${g.texts.length} in total` : '');
|
|
1604
|
+
};
|
|
1605
|
+
const ref: string = panel ? 'panel' : 'app content';
|
|
1606
|
+
console.log(` ${col("text left edge")}: (TextView box to the ${ref} left edge; same group = same indent, compared group by group in Phase 5 ${quoteName("Horizontal Inset Evidence")})`);
|
|
1607
|
+
for (const g of textEdges.left.slice(0, 10)) { console.log(fmt(g)); }
|
|
1608
|
+
console.log(` ${col("text right edge")}: (TextView box to the ${ref} right edge; only boxes at least half as wide are listed)`);
|
|
1609
|
+
for (const g of textEdges.right.slice(0, 10)) { console.log(fmt(g)); }
|
|
1610
|
+
if (textEdges.left.length > 10 || textEdges.right.length > 10) {
|
|
1611
|
+
console.log(' ... remaining groups: see text_edges in measure_pack.json');
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
console.log(` ${col('written')}: ${outFile}`);
|
|
1615
|
+
console.log('');
|
|
1616
|
+
console.log(`Note: this pack gives **measured values** only. Whether the page is immersive, whether an anchor is ${"fixed-offset"} or ${"parent-derived"},`);
|
|
1617
|
+
console.log('and the icon L1/L2/L3 tier must all be decided by re-reading the Android source (Phase 4.2 / 4.3); they are outside this pack.');
|
|
1618
|
+
}
|
|
1619
|
+
} finally {
|
|
1620
|
+
console.log = realLog;
|
|
1621
|
+
}
|
|
1622
|
+
const summaryFile: string = path.join(path.dirname(outFile), 'measure_summary.txt');
|
|
1623
|
+
const EOL: string = String.fromCharCode(10);
|
|
1624
|
+
fs.writeFileSync(summaryFile, summary.join(EOL) + EOL, 'utf8');
|
|
1625
|
+
if (!quiet) {
|
|
1626
|
+
for (const l of summary) { console.log(l); }
|
|
1627
|
+
console.log(` ${col('summary')}: ${summaryFile}`);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
main();
|
|
1632
|
+
|