@buaa_smat/hometrans 26.0.1 → 26.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -7
- package/agents/code-reviewer.md +25 -138
- package/dist/cli/index.js +4 -1
- package/dist/cli/init.js +131 -26
- package/dist/cli/uninstall.js +5 -5
- package/dist/platform/language.js +77 -0
- package/env-requirements.json +30 -5
- package/i18n/FILE-NAMES.md +9 -0
- package/i18n/agents/code-reviewer.md +364 -0
- package/i18n/agents/model-render-worker.md +38 -0
- package/i18n/agents/specgen-worker.md +18 -0
- package/i18n/commands/hometrans.md +17 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +198 -0
- package/i18n/skills/a2h-app-migrate/references/config.example.json +28 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +19 -0
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +50 -0
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +1760 -0
- package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +114 -0
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1588 -0
- package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +657 -0
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +541 -0
- package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +131 -0
- package/i18n/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
- package/i18n/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/i18n/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
- package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +698 -0
- package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
- package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/i18n/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +219 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +196 -0
- package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +488 -0
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +146 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +161 -0
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/i18n/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/i18n/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +171 -0
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/i18n/skills/a2h-arch-generate/SKILL.md +375 -0
- package/i18n/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
- package/i18n/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
- package/i18n/skills/a2h-arch-generate/references/arkts-mvvm-v2.md +1407 -0
- package/i18n/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
- package/i18n/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
- package/i18n/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
- package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
- package/i18n/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
- package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
- package/i18n/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
- package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +120 -0
- package/i18n/skills/a2h-arch-generate/references/source-baseline.md +93 -0
- package/i18n/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +360 -0
- package/i18n/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +798 -0
- package/i18n/skills/a2h-arch-generate/scripts/lib/contract_terms.mjs +40 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/generate.mjs +639 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1261 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
- package/i18n/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +851 -0
- package/i18n/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +982 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +9 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +192 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +303 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/design/move_spec_technical_reference.mjs +162 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +298 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +587 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +352 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +323 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +31 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +80 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +22 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +87 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +57 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +29 -0
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +705 -0
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +417 -0
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +139 -0
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2549 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +560 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +148 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +220 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +28 -0
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +216 -0
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +203 -0
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +210 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +2005 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1748 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1787 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1836 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/image_probe.mjs +405 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1406 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1226 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1220 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +412 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +18 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +173 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +629 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +67 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +136 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +551 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +374 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +119 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +80 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +137 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +97 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +123 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +67 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +427 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +560 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +324 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +325 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +48 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +387 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +470 -0
- package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +59 -0
- package/i18n/skills/a2h-dashboard-render/SKILL.md +73 -0
- package/i18n/skills/a2h-dashboard-render/references/artifact-contract.jsonc +117 -0
- package/i18n/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
- package/i18n/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
- package/i18n/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
- package/i18n/skills/a2h-dashboard-render/scripts/dashboard.mjs +3245 -0
- package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +2048 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/i18n/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +154 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/i18n/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/i18n/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
- package/i18n/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/i18n/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
- package/i18n/skills/a2h-fix-build-errors/SKILL.md +304 -0
- package/i18n/skills/a2h-fix-build-errors/references/arkts-strict-patterns.md +219 -0
- package/i18n/skills/a2h-fix-build-errors/references/rdb-entity-pattern.md +131 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +227 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/i18n/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/i18n/skills/a2h-page-specgen/SKILL.md +136 -0
- package/i18n/skills/a2h-page-specgen/references/body-language.md +177 -0
- package/i18n/skills/a2h-page-specgen/references/gates.md +262 -0
- package/i18n/skills/a2h-page-specgen/references/page-inventory.md +173 -0
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +207 -0
- package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +1504 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +1528 -0
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +576 -0
- package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +138 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +262 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +176 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +248 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +506 -0
- package/i18n/skills/a2h-page-specgen/scripts/render.mjs +299 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +616 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +234 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1166 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +74 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +8 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +7 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +8 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +758 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +54 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +271 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +54 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +171 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +301 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +83 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +139 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +774 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1011 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +77 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +419 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +323 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +546 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +511 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +701 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1765 -0
- package/i18n/skills/a2h-resource-convert/SKILL.md +367 -0
- package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +335 -0
- package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +251 -0
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +219 -0
- package/i18n/skills/a2h-resource-convert/references/resource-mapping-rules.md +493 -0
- package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +249 -0
- package/i18n/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +2532 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +278 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +260 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +163 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +44 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +589 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +506 -0
- package/i18n/skills/a2h-spec-generate/SKILL.md +375 -0
- package/i18n/skills/a2h-spec-generate/references/batch-mode.md +215 -0
- package/i18n/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
- package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +184 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +27 -0
- package/i18n/skills/a2h-spec-generate/references/library-evidence.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/method-discipline.md +64 -0
- package/i18n/skills/a2h-spec-generate/references/optional-gates.json +45 -0
- package/i18n/skills/a2h-spec-generate/references/recall-guide.md +84 -0
- package/i18n/skills/a2h-spec-generate/references/recall-terse.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
- package/i18n/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
- package/i18n/skills/a2h-spec-generate/references/review-checklist.md +22 -0
- package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
- package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
- package/i18n/skills/a2h-spec-generate/references/spec-samples.md +65 -0
- package/i18n/skills/a2h-spec-generate/references/specs.schema.json +85 -0
- package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +145 -0
- package/i18n/skills/a2h-spec-generate/references/transfer-file.md +5 -0
- package/i18n/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
- package/i18n/skills/a2h-spec-generate/references/worker-rules.md +129 -0
- package/i18n/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +702 -0
- package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +515 -0
- package/i18n/skills/a2h-spec-generate/scripts/collect-specs.mjs +727 -0
- package/i18n/skills/a2h-spec-generate/scripts/feature-stem.mjs +151 -0
- package/i18n/skills/a2h-spec-generate/scripts/parse_requirements.ts +515 -0
- package/i18n/skills/a2h-spec-generate/scripts/prepare-facts.mjs +313 -0
- package/i18n/skills/a2h-spec-generate/scripts/publish-specs.mjs +354 -0
- package/i18n/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +669 -0
- package/i18n/skills/a2h-spec-generate/scripts/render-tasks.mjs +385 -0
- package/i18n/skills/a2h-spec-generate/scripts/report.mjs +136 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1265 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1057 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +565 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +544 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +317 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +707 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +436 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +608 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +650 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +178 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +912 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +279 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +163 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +256 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +340 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1857 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +262 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +722 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/i18n/skills/a2h-spec-generate/template/REQ.txt +22 -0
- package/i18n/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
- package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +847 -0
- package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +415 -0
- package/i18n/skills/a2h-spec-generate/test/collect-specs.test.mjs +808 -0
- package/i18n/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/i18n/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/i18n/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
- package/i18n/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
- package/i18n/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
- package/i18n/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
- package/i18n/skills/a2h-spec-generate/test/report.test.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/SKILL.md +120 -0
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +279 -0
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +918 -0
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +446 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hint_check.mjs +147 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hint_source.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_b.mjs +550 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +380 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +492 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +199 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1412 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +2037 -0
- package/i18n/skills/a2h-utg-static/SKILL.md +368 -0
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
- package/i18n/skills/a2h-utg-static/references/view-interactions.md +215 -0
- package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +2120 -0
- package/i18n/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +609 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +250 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +374 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
- package/i18n/skills/a2h-utg-static/scripts/fragment_nav.mjs +1137 -0
- package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -0
- package/i18n/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +913 -0
- package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +517 -0
- package/i18n/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
- package/i18n/skills/a2h-utg-static/scripts/static_prior.mjs +956 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +108 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +289 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_fresh_branch_guard.mjs +49 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +136 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +368 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +44 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_off_path.mjs +67 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +61 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_data_table.mjs +340 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_relative_url.mjs +125 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +340 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1351 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
- package/package.json +13 -160
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
- package/skills/a2h-app-migrate/SKILL.md +17 -6
- package/skills/a2h-app-migrate/references/config.example.json +1 -0
- package/skills/a2h-app-migrate/references/stage-map.md +3 -1
- package/skills/a2h-app-migrate/references/workflow.yaml +138 -47
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +1 -2
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +105 -39
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +7 -8
- package/skills/a2h-app-migrate/scripts/ledger.mjs +17 -5
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +43 -7
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +127 -41
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +2 -0
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +38 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +131 -0
- package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
- package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
- package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/skills/a2h-app-migrate/test/test_devecocli_docs_preflight.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +102 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +698 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
- package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +51 -0
- package/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +91 -0
- package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +111 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
- package/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +219 -0
- package/skills/a2h-app-migrate/test/test_resume_summary.mjs +196 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +488 -0
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_acceptance.mjs +94 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +147 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +161 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +344 -0
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +83 -0
- package/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
- package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +41 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +178 -0
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/skills/a2h-arch-generate/SKILL.md +1 -1
- package/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
- package/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +15 -6
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +2 -2
- package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +35 -46
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +33 -40
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +2 -3
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1260 -0
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +191 -0
- package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
- package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
- package/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +138 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +2 -5
- package/skills/a2h-arkts-logic-coder/SKILL.md +21 -2
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -0
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +62 -0
- package/skills/a2h-arkts-logic-coder/references/spec-design.md +4 -0
- package/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +22 -25
- package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +583 -0
- package/skills/a2h-arkts-logic-coder/test/golden/inspect_happy.json +20 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
- package/skills/a2h-arkts-logic-coder/test/golden/resolve_cases.json +36 -0
- package/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
- package/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
- package/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
- package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +352 -0
- package/skills/a2h-batch-ui-align/SKILL.md +6 -4
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +1 -1
- package/skills/a2h-batch-ui-align/references/cards/resources.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +22 -3
- package/skills/a2h-batch-ui-align/references/checker-rules.md +66 -3
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +45 -8
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -5
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +2 -2
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +4 -2
- package/skills/a2h-batch-ui-align/references/step5-convert.md +7 -5
- package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +6 -7
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +84 -7
- package/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +229 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1 -2
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +4 -5
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +88 -26
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +305 -12
- package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +231 -54
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +8 -9
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +18 -5
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +103 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +1 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +14 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +8 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +3 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +84 -19
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +11 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +5 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +66 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +119 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +81 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +123 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +2 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +6 -0
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +312 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +312 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +427 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +235 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_safearea.test.mjs +742 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +91 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +86 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +567 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +290 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +74 -0
- package/skills/a2h-batch-ui-align/scripts/tests/detect_paradigm.test.mjs +260 -0
- package/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +244 -0
- package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +420 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +31 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
- package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1628 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
- package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +324 -0
- package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +325 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +297 -0
- package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +48 -0
- package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +387 -0
- package/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
- package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +12 -14
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +29 -30
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
- package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +203 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/skills/a2h-page-specgen/SKILL.md +136 -0
- package/skills/a2h-page-specgen/references/body-language.md +177 -0
- package/skills/a2h-page-specgen/references/evidence.md +70 -0
- package/skills/a2h-page-specgen/references/execution-model.md +255 -0
- package/skills/a2h-page-specgen/references/footprint-and-grouping.md +250 -0
- package/skills/a2h-page-specgen/references/gates.md +255 -0
- package/skills/a2h-page-specgen/references/page-inventory.md +173 -0
- package/skills/a2h-page-specgen/references/spec-template.md +207 -0
- package/skills/a2h-page-specgen/scripts/dispatch.mjs +209 -0
- package/skills/a2h-page-specgen/scripts/facts-build.mjs +1504 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +422 -0
- package/skills/a2h-page-specgen/scripts/footprint.mjs +1528 -0
- package/skills/a2h-page-specgen/scripts/gate.mjs +558 -0
- package/skills/a2h-page-specgen/scripts/interactions.mjs +137 -0
- package/skills/a2h-page-specgen/scripts/inventory.mjs +269 -0
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +255 -0
- package/skills/a2h-page-specgen/scripts/lib/deps-source.mjs +399 -0
- package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +137 -0
- package/skills/a2h-page-specgen/scripts/lib/footprint-roles.mjs +278 -0
- package/skills/a2h-page-specgen/scripts/lib/fsx.mjs +79 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +175 -0
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +355 -0
- package/skills/a2h-page-specgen/scripts/lib/prose.mjs +234 -0
- package/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +391 -0
- package/skills/a2h-page-specgen/scripts/lib/symbols.mjs +125 -0
- package/skills/a2h-page-specgen/scripts/lib/utg-io.mjs +110 -0
- package/skills/a2h-page-specgen/scripts/lib/waker-event-store.mjs +658 -0
- package/skills/a2h-page-specgen/scripts/prepare.mjs +492 -0
- package/skills/a2h-page-specgen/scripts/render.mjs +317 -0
- package/skills/a2h-page-specgen/scripts/report.mjs +7 -0
- package/skills/a2h-page-specgen/scripts/submission.mjs +532 -0
- package/skills/a2h-page-specgen/scripts/submit.mjs +79 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/README.md +77 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +590 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/cases.example.json +57 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +207 -0
- package/skills/a2h-page-specgen/scripts/test/dispatch.test.mjs +258 -0
- package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1164 -0
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +74 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Api.kt +20 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/BothAnnotations.kt +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Cache.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Comments.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Mmkv.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Models.kt +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Pair.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Prefs.kt +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Room.kt +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Sample.kt +43 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Templates.kt +34 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Timeouts.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/androidTest/Helper.kt +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/build.gradle.kts +16 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/en.js.txt +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/libs.versions.toml +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/package.json +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values/strings.xml +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-land/strings.xml +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-night/strings.xml +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-v21/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/test/Legacy.kt +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/weather.proto +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/AppPreferences.kt +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/SettingsViewModel.kt +16 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-dao/src/UserDao.kt +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/base/strings.xml +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/fil/strings.xml +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/arrays.xml +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/strings.xml +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/xml/prefs.xml +27 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Api.java +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Datastore.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Settings.java +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/forecast.js +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/store.js +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/BasePreferences.kt +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/Screen.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/UiPreferences.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-retrofit/src/AuthAPI.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/AndroidManifest.xml +20 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/feature/auth/navigation/ScreenRoute.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/pages.json +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/components/Widget.vue +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/detail/detail.vue +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/index/index.vue +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/store/userStore.js +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/uni_modules/uview-ui/components/u-thing.js +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp.mkdb.mjs +144 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +94 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/MainFragment.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyListeners.java +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/PlainActivity.java +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/fold-chain/utg.json +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/utg.json +34 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +758 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-roles.test.mjs +172 -0
- package/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +54 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +222 -0
- package/skills/a2h-page-specgen/scripts/test/helpers.mjs +54 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +171 -0
- package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +301 -0
- package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +45 -0
- package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +139 -0
- package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +774 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +464 -0
- package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1011 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +120 -0
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +68 -0
- package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +390 -0
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +167 -0
- package/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +323 -0
- package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +546 -0
- package/skills/a2h-page-specgen/scripts/test/render.test.mjs +503 -0
- package/skills/a2h-page-specgen/scripts/test/source-text.test.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +701 -0
- package/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
- package/skills/a2h-page-specgen/scripts/test/waker-event-store.test.mjs +1365 -0
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1765 -0
- package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +1979 -0
- package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +313 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +1234 -0
- package/skills/a2h-page-specgen/scripts/watchdog.mjs +298 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +49 -51
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
- package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
- package/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +79 -78
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +51 -12
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +24 -6
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +3 -2
- package/skills/a2h-spec-design-pipeline/references/initialization.md +15 -4
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +82 -41
- package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +61 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +19 -10
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +267 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +61 -8
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +62 -13
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +8 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +8 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +55 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +60 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/HttpExtraDataEmptyStringCheck.js +488 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +11 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +17 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +12 -38
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +40 -5
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +18 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +74 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +2 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +128 -5
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +98 -35
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +218 -37
- package/skills/a2h-spec-design-pipeline/scripts/lib/shared_classes.ts +113 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/shared_docs.ts +202 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/wiring.ts +58 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +6 -7
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +3 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +348 -0
- package/skills/a2h-spec-design-pipeline/scripts/scan_shared.ts +642 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +15 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +7 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +104 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +24 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +394 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +24 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +14 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +163 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +15 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +14 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +350 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_scan_shared.ts +996 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_classes.ts +80 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_docs.ts +205 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +121 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_e2e.ts +85 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_validate_shared_manifest.ts +720 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_wiring.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/validate_shared_manifest.ts +566 -0
- package/skills/a2h-spec-generate/SKILL.md +87 -21
- package/skills/a2h-spec-generate/references/batch-mode.md +78 -17
- package/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +7 -0
- package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
- package/skills/a2h-spec-generate/references/synthesis-rules.md +4 -2
- package/skills/a2h-spec-generate/references/worker-rules.md +6 -3
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +4 -5
- package/skills/a2h-spec-generate/scripts/check_spec.ts +145 -14
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +261 -19
- package/skills/a2h-spec-generate/scripts/dispatch-watch.mjs +1168 -0
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +25 -46
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +26 -27
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +3 -6
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +31 -32
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +2 -3
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +15 -26
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +102 -81
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +39 -19
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +12 -13
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +35 -196
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +3 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +22 -96
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +3 -4
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +1 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +74 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +51 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +42 -111
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +1 -20
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1 -2
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +3 -4
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/zip.ts +63 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +650 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-seed.test.ts +195 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +347 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1948 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-library-evidence.test.ts +239 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +277 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +844 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/zip.test.ts +61 -0
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +879 -0
- package/skills/a2h-spec-generate/test/check-spec.test.ts +430 -0
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +811 -0
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
- package/skills/a2h-spec-generate/test/dispatch-watch.test.mjs +606 -0
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +230 -0
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
- package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
- package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
- package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
- package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +182 -0
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
- package/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
- package/skills/a2h-spec-generate/test/report.test.mjs +47 -0
- package/skills/a2h-utg-explorer/references/architecture.md +4 -0
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +64 -80
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +1 -2
- package/skills/a2h-utg-explorer/scripts/recover.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +5 -3
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +244 -0
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
- package/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +231 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +160 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_identity.test.mjs +77 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
- package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +137 -0
- package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
- package/skills/a2h-utg-explorer/scripts/tests/fresh_state_plan.test.mjs +78 -0
- package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
- package/skills/a2h-utg-explorer/scripts/tests/holds_without_data_parity.test.mjs +26 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +492 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +199 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_failure.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
- package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
- package/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
- package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +454 -0
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +336 -0
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +142 -0
- package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
- package/skills/a2h-utg-explorer/scripts/tests/string_tables_twin_ties.test.mjs +83 -0
- package/skills/a2h-utg-explorer/scripts/tests/tar_fixture.mjs +12 -0
- package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
- package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
- package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +13 -3
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +107 -65
- package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +155 -0
- package/skills/a2h-utg-static/scripts/assemble.mjs +28 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +19 -20
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +102 -2
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +2 -3
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +2 -3
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +1 -2
- package/skills/a2h-utg-static/scripts/route_interceptor.mjs +21 -7
- package/skills/a2h-utg-static/scripts/static_prior.mjs +26 -29
- package/skills/a2h-utg-static/scripts/tests/test_activity_gates.mjs +84 -0
- package/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +29 -1
- package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-app-migrate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-arch-generate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +0 -5
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +0 -54
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +0 -38
- package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-resource-convert/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +0 -70
- package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-generate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +0 -54
- package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-utg-static/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-utg-static/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-utg-static/scripts/tests/test_i18n_term.mjs +0 -155
|
@@ -0,0 +1,1137 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* fragment_nav.mjs — port of fragment_nav.py: Fragment & DialogFragment pages +
|
|
4
|
+
* fragment-transaction / nav-action edges.
|
|
5
|
+
*
|
|
6
|
+
* fragment_nav.mjs <project_path> [--package PKG] [--workspace WS] [--append]
|
|
7
|
+
*
|
|
8
|
+
* Exports:
|
|
9
|
+
* HERE _SKIP_DIRS(Set) _FRAMEWORK_PKG_PREFIXES _FRAMEWORK_FRAGMENT_NAMES(Set) _DIALOG_BASE_MARKERS
|
|
10
|
+
* _CLASS_DECL_RE _PKG_RE walkSources rel lineOf _pkgIsFramework buildFragmentSet
|
|
11
|
+
* _TXN_RE _TXN_CONTAINER_RE _LOCAL_DECL_RE _resolveLocalType _DRAWER_OPEN_RE _DRAWER_GRAVITY_RE
|
|
12
|
+
* _drawerContainerIds _bottomSheetContainerIds _NEWINSTANCE_RE _NEW_FRAG_RE _KT_CTOR_FRAG_RE
|
|
13
|
+
* _CLASS_HEADER_RE _EXTENDS_RE _supertypeSpans _inSupertypePosition _SHOW_NEW_RE _NAV_VERB
|
|
14
|
+
* _NAV_ID_RE _NAV_DIR_RE _CHILD_FM_RE _statementSlice _LAYOUT_ID_RE _CDESC_RE _TEXT_RE
|
|
15
|
+
* _STRING_REF_RE _TAG_NAME_RE _SRC_RE _ICON_PREFIX_RE _iconFromTag _resolveStr
|
|
16
|
+
* _LAYOUT_FRAG_TAG_RE _LAYOUT_FRAG_NAME_RE _LAYOUT_W_RE _LAYOUT_H_RE _LAYOUT_WEIGHT_RE _fillsHost
|
|
17
|
+
* layoutDeclaredFragments _SETLAYOUT_RE _BINDING_RE _CTOR_LAYOUT_RE _layoutToHosts
|
|
18
|
+
* detectLayoutEdges buildWidgetLabels _LISTENER_RE _FIELD_BIND_RE listenerWidgetId _braceSpan
|
|
19
|
+
* _LIFECYCLE_FNS(Set) _ASYNC_FNS(Set) _BACKSTACK_RE _txnChainSlice classifyCommit
|
|
20
|
+
* buildListenerSpans stampTriggerId _triggerFor _helperCallerEvidence _owningClass
|
|
21
|
+
* _LAZY_NON_PAGE _NAV_UNRESOLVED _NAV_DEST_ELEM_RE _NAV_ACTION_ELEM_RE _NAV_ATTR_RE
|
|
22
|
+
* _NAV_ID_REF_RE buildNavGraph _camelToSnake _makeHostResolver _srcIds _DRAWER_LABEL
|
|
23
|
+
* _IF_HEAD_RE _DRAWER_DISABLE_RE _matchPair _enclosingIfCondition _drawerDisabledCondition
|
|
24
|
+
* detectEdges buildRecords main
|
|
25
|
+
*
|
|
26
|
+
* Conventions: walkSources returns an array of [path, text] (Python: generator of tuples).
|
|
27
|
+
* buildFragmentSet returns [frags(Map name->info), parents(Map)]. Sets of names are JS Sets;
|
|
28
|
+
* Python dicts that callers read by key are Maps here (buildWidgetLabels: Map; its `icons` /
|
|
29
|
+
* `low_signal` out-params are Map / Set). Offsets are JS (UTF-16) string offsets; no raw offset
|
|
30
|
+
* reaches an output file (only line numbers).
|
|
31
|
+
* The lazy `from plaindialog_nav import build_dialog_set` is a static ESM import used only
|
|
32
|
+
* inside a function (live binding), so the fragment_nav <-> plaindialog_nav <-> activity_nav
|
|
33
|
+
* cycle resolves synchronously; no module uses a cyclic binding at top level.
|
|
34
|
+
*/
|
|
35
|
+
import * as fs from 'node:fs';
|
|
36
|
+
import * as path from 'node:path';
|
|
37
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
38
|
+
import {
|
|
39
|
+
pyRe, reEscape, reFindall, reSub, reFullmatch, pyStrip, pyRsplit, sortedBy, sortedStr, reprTuple,
|
|
40
|
+
jsonDumps, pyPrintBuf, pyPrintErr, appendText, get, tupleKey, osRelpath, ArgumentParser, errStr,
|
|
41
|
+
} from './_py.mjs';
|
|
42
|
+
import { readTextSmart } from './io_utils.mjs';
|
|
43
|
+
import { loadProjectStrings, isLowSignal } from './label_resolve.mjs';
|
|
44
|
+
import { ActivityChain, HostResolver, blankCommentsAndStrings, buildClassIndex, voyagerPage } from './host_resolve.mjs';
|
|
45
|
+
import { buildViewIdIndex, resolveViewId, _osWalk } from './layout_resolve.mjs';
|
|
46
|
+
import { fnRanges, innermostFnAt, isShippingDir, _finditer } from './scope_utils.mjs';
|
|
47
|
+
import { findLayoutFiles } from './view_widgets.mjs';
|
|
48
|
+
// Cyclic (plaindialog_nav imports this module): only used inside functions, never at top level.
|
|
49
|
+
import { buildDialogSet } from './plaindialog_nav.mjs';
|
|
50
|
+
|
|
51
|
+
export const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
52
|
+
|
|
53
|
+
export const _SKIP_DIRS = new Set(['build', '.git', 'test', 'androidTest', '.gradle', '.idea',
|
|
54
|
+
'node_modules', 'sample', 'samples']);
|
|
55
|
+
|
|
56
|
+
export const _FRAMEWORK_PKG_PREFIXES = [
|
|
57
|
+
'androidx.', 'android.', 'com.google.android.', 'com.google.common.',
|
|
58
|
+
'kotlin.', 'kotlinx.', 'java.', 'javax.', 'dagger.', 'org.jetbrains.',
|
|
59
|
+
'com.bumptech.glide', 'io.reactivex', 'retrofit2', 'okhttp3',
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
export const _FRAMEWORK_FRAGMENT_NAMES = new Set([
|
|
63
|
+
'Fragment', 'DialogFragment', 'BottomSheetDialogFragment',
|
|
64
|
+
'PreferenceFragmentCompat', 'PreferenceFragment', 'ListFragment',
|
|
65
|
+
'BrowseSupportFragment', 'BrowseFragment', 'RowsSupportFragment',
|
|
66
|
+
'RowsFragment', 'DetailsSupportFragment', 'DetailsFragment',
|
|
67
|
+
'PlaybackSupportFragment', 'PlaybackFragment', 'VerticalGridSupportFragment',
|
|
68
|
+
'VerticalGridFragment', 'SearchSupportFragment', 'SearchFragment',
|
|
69
|
+
'GuidedStepSupportFragment', 'GuidedStepFragment', 'HeadersSupportFragment',
|
|
70
|
+
'VideoSupportFragment', 'BaseRowSupportFragment', 'BaseRowFragment',
|
|
71
|
+
'BrandedSupportFragment', 'OnboardingSupportFragment', 'ErrorSupportFragment',
|
|
72
|
+
'BackgroundFragment', 'BaseSupportFragment', 'BaseFragment',
|
|
73
|
+
'NavHostFragment', 'MediaRouteDiscoveryFragment',
|
|
74
|
+
// preference dialogs: the AndroidX names end in `Compat`, so the `*Fragment` suffix test misses them
|
|
75
|
+
'PreferenceDialogFragmentCompat', 'EditTextPreferenceDialogFragmentCompat',
|
|
76
|
+
'ListPreferenceDialogFragmentCompat', 'MultiSelectListPreferenceDialogFragmentCompat',
|
|
77
|
+
'LeanbackPreferenceDialogFragmentCompat', 'LeanbackListPreferenceDialogFragmentCompat',
|
|
78
|
+
'PreferenceDialogFragment', 'EditTextPreferenceDialogFragment',
|
|
79
|
+
'ListPreferenceDialogFragment', 'MultiSelectListPreferenceDialogFragment',
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
export const _DIALOG_BASE_MARKERS = ['DialogFragment', 'BottomSheetDialogFragment', 'AppCompatDialogFragment',
|
|
83
|
+
'DialogFragmentCompat'];
|
|
84
|
+
|
|
85
|
+
export const _CLASS_DECL_RE = pyRe(
|
|
86
|
+
'\\b(?:public\\s+|final\\s+|abstract\\s+|open\\s+|internal\\s+|sealed\\s+)*' +
|
|
87
|
+
'class\\s+([A-Z]\\w*)\\s*' +
|
|
88
|
+
'(?:<[^>]*>\\s*)?' +
|
|
89
|
+
// Kotlin `@Inject constructor` / `private constructor` ahead of the primary ctor
|
|
90
|
+
'(?:(?:@\\w+(?:\\([^()]*\\))?\\s*)*(?:(?:public|private|protected|internal)\\s+)?constructor\\s*)?' +
|
|
91
|
+
// primary ctor; default args may nest parens up to two levels (`x: Int = f(g())`)
|
|
92
|
+
'(?:\\((?:[^()]|\\((?:[^()]|\\([^()]*\\))*\\))*\\)\\s*)?' +
|
|
93
|
+
// supertype = the LAST segment of a qualified name (`a.b.DialogFragment`, `Outer.Callback`); stopping
|
|
94
|
+
// at the first `.` read `extends Dialog.Callback` as `extends Dialog` and fabricated a dialog page.
|
|
95
|
+
// A nested `Builder` is the exception: `extends AlertDialog.Builder` builds an AlertDialog, so the
|
|
96
|
+
// supertype that decides what the class shows is the OUTER type.
|
|
97
|
+
'(?::\\s*|extends\\s+)(?:\\w+\\s*\\.\\s*)*?([A-Z]\\w*)(?:\\s*\\.\\s*Builder)?(?![\\w.])', 'd');
|
|
98
|
+
export const _PKG_RE = pyRe('^\\s*package\\s+([\\w.]+)', 'm');
|
|
99
|
+
|
|
100
|
+
const SEP = process.platform === 'win32' ? '\\' : '/';
|
|
101
|
+
/** os.path.join(a, b) for a relative b. */
|
|
102
|
+
export function _osJoin(a, b) { return a.endsWith('/') || a.endsWith(SEP) ? a + b : a + SEP + b; }
|
|
103
|
+
const endsWithAny = (s, xs) => xs.some((x) => s.endsWith(x));
|
|
104
|
+
const search = (rx, s) => { rx.lastIndex = 0; return rx.exec(s); };
|
|
105
|
+
const mEnd = (m) => m.index + m[0].length;
|
|
106
|
+
|
|
107
|
+
/** [[path, text]] for every main-source .java/.kt under `project` (os.walk order). */
|
|
108
|
+
export function walkSources(project) {
|
|
109
|
+
const out = [];
|
|
110
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
111
|
+
const keep = dirs.filter((d) => !_SKIP_DIRS.has(d));
|
|
112
|
+
dirs.length = 0; dirs.push(...keep);
|
|
113
|
+
const norm = dirpath.replace(/\\/g, '/');
|
|
114
|
+
if (!isShippingDir(norm)) { continue; }
|
|
115
|
+
for (const fn of files) {
|
|
116
|
+
if (!endsWithAny(fn, ['.java', '.kt'])) { continue; }
|
|
117
|
+
const p = _osJoin(dirpath, fn);
|
|
118
|
+
let text;
|
|
119
|
+
try { text = readTextSmart(p); } catch { continue; }
|
|
120
|
+
out.push([p, text]);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** os.path.relpath(path, project) with forward slashes (path itself on ValueError). */
|
|
127
|
+
export function rel(p, project) {
|
|
128
|
+
try { return osRelpath(p, project).replace(/\\/g, '/'); } catch { return String(p).replace(/\\/g, '/'); }
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** 1-based line of offset `pos`. */
|
|
132
|
+
export function lineOf(text, pos) {
|
|
133
|
+
let n = 1;
|
|
134
|
+
const end = Math.min(pos, text.length);
|
|
135
|
+
for (let i = text.indexOf('\n'); i !== -1 && i < end; i = text.indexOf('\n', i + 1)) { n++; }
|
|
136
|
+
return n;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function _pkgIsFramework(pkg) { return _FRAMEWORK_PKG_PREFIXES.some((p) => pkg.startsWith(p)); }
|
|
140
|
+
|
|
141
|
+
/** [frags Map{name: {file,line,base,pkg,kind,abstract}}, parents Map{child: base}]. */
|
|
142
|
+
export function buildFragmentSet(sources, project) {
|
|
143
|
+
const decl = new Map();
|
|
144
|
+
const parents = new Map();
|
|
145
|
+
for (const [p, text] of sources) {
|
|
146
|
+
const pkgm = search(_PKG_RE, text);
|
|
147
|
+
const pkg = pkgm ? pkgm[1] : '';
|
|
148
|
+
for (const m of _finditer(_CLASS_DECL_RE, text)) {
|
|
149
|
+
const name = m[1]; const base = m[2];
|
|
150
|
+
const isAbstract = text.slice(m.index, m.indices[1][0]).includes('abstract');
|
|
151
|
+
parents.set(name, base);
|
|
152
|
+
const prior = decl.get(name);
|
|
153
|
+
if (prior === undefined || (_pkgIsFramework(prior[3]) && !_pkgIsFramework(pkg))) {
|
|
154
|
+
decl.set(name, [p, lineOf(text, m.index), base, pkg, isAbstract]);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const extendsFragment = (name, seen = null) => {
|
|
159
|
+
seen = seen && seen.size ? seen : new Set();
|
|
160
|
+
if (seen.has(name)) { return false; }
|
|
161
|
+
seen.add(name);
|
|
162
|
+
const base = parents.get(name);
|
|
163
|
+
if (!base) { return name.endsWith('Fragment') && _FRAMEWORK_FRAGMENT_NAMES.has(name); }
|
|
164
|
+
if (base.endsWith('Fragment') || _FRAMEWORK_FRAGMENT_NAMES.has(base)) { return true; }
|
|
165
|
+
return extendsFragment(base, seen);
|
|
166
|
+
};
|
|
167
|
+
const dialogKind = (name, seen = null) => {
|
|
168
|
+
seen = seen && seen.size ? seen : new Set();
|
|
169
|
+
if (seen.has(name)) { return false; }
|
|
170
|
+
seen.add(name);
|
|
171
|
+
const base = parents.get(name) ?? '';
|
|
172
|
+
if (_DIALOG_BASE_MARKERS.some((mk) => base.endsWith(mk))) { return true; }
|
|
173
|
+
if (base && base !== name) { return dialogKind(base, seen); }
|
|
174
|
+
return false;
|
|
175
|
+
};
|
|
176
|
+
const frags = new Map();
|
|
177
|
+
for (const [name, [p, line, base, pkg, isAbstract]] of decl) {
|
|
178
|
+
if (_FRAMEWORK_FRAGMENT_NAMES.has(name) && _pkgIsFramework(pkg)) { continue; }
|
|
179
|
+
if (_pkgIsFramework(pkg)) { continue; }
|
|
180
|
+
if (!extendsFragment(name)) { continue; }
|
|
181
|
+
frags.set(name, {
|
|
182
|
+
file: rel(p, project), line, base, pkg,
|
|
183
|
+
kind: dialogKind(name) ? 'dialog' : 'fragment',
|
|
184
|
+
abstract: !!isAbstract,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
return [frags, parents];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// --- transaction / navigation call-site detection ------------------------ //
|
|
191
|
+
export const _TXN_RE = pyRe('\\.(replace|add)\\s*\\(\\s*[^,]+,\\s*(?:new\\s+)?([A-Z]\\w*)');
|
|
192
|
+
export const _TXN_CONTAINER_RE = pyRe('\\.(?:replace|add)\\s*\\(\\s*R\\.id\\.(\\w+)\\s*,\\s*(?:new\\s+)?(\\w+)');
|
|
193
|
+
export const _LOCAL_DECL_RE = pyRe(
|
|
194
|
+
'(?:\\b([A-Z]\\w*)\\s+(\\w+)\\s*=\\s*(?:new\\s+)?[A-Z]\\w*\\s*\\(' +
|
|
195
|
+
'|\\b(?:val|var)\\s+(\\w+)\\s*(?::\\s*([A-Z]\\w*))?\\s*=\\s*([A-Z]\\w*)\\s*\\()');
|
|
196
|
+
|
|
197
|
+
/** Declared class of local `name`, `name` itself when it looks like a class, else null. */
|
|
198
|
+
export function _resolveLocalType(text, name) {
|
|
199
|
+
if (reFullmatch('[A-Z]\\w*', name)) { return name; }
|
|
200
|
+
for (const m of _finditer(_LOCAL_DECL_RE, text)) {
|
|
201
|
+
const [jt, jn, kn, kt, kc] = m.slice(1, 6).map((x) => x ?? null);
|
|
202
|
+
if (jn === name && jt) { return jt; }
|
|
203
|
+
if (kn === name) { return kt || kc; }
|
|
204
|
+
}
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export const _DRAWER_OPEN_RE = pyRe('<(?:[\\w.]*\\.)?DrawerLayout\\b', 'i');
|
|
209
|
+
export const _DRAWER_GRAVITY_RE = pyRe('\\blayout_gravity\\s*=\\s*"([^"]*)"');
|
|
210
|
+
const _ANY_TAG_RE_S = pyRe('<(/?)([A-Za-z][\\w.]*)\\b([^>]*?)(/?)>', 's');
|
|
211
|
+
const _ID_ATTR_RE = pyRe('\\bandroid:id\\s*=\\s*"@\\+?id/(\\w+)"');
|
|
212
|
+
|
|
213
|
+
/** Map{container view-id: gravity} for every drawer child of a DrawerLayout. */
|
|
214
|
+
export function _drawerContainerIds(project) {
|
|
215
|
+
const out = new Map();
|
|
216
|
+
let layouts;
|
|
217
|
+
try { layouts = findLayoutFiles(project); } catch { return out; }
|
|
218
|
+
for (const [, p] of layouts) {
|
|
219
|
+
let text;
|
|
220
|
+
try { text = readTextSmart(p); } catch { continue; }
|
|
221
|
+
if (!search(_DRAWER_OPEN_RE, text)) { continue; }
|
|
222
|
+
let depth = 0; let drawerDepth = null;
|
|
223
|
+
for (const m of _finditer(_ANY_TAG_RE_S, text)) {
|
|
224
|
+
const [closing, tag, attrs, selfclose] = [m[1], m[2], m[3], m[4]];
|
|
225
|
+
if (closing) {
|
|
226
|
+
depth -= 1;
|
|
227
|
+
if (drawerDepth !== null && depth <= drawerDepth) { drawerDepth = null; }
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
const isChild = drawerDepth !== null && depth === drawerDepth + 1;
|
|
231
|
+
if (isChild) {
|
|
232
|
+
const g = search(_DRAWER_GRAVITY_RE, attrs);
|
|
233
|
+
const vid = search(_ID_ATTR_RE, attrs);
|
|
234
|
+
if (g && vid) {
|
|
235
|
+
const grav = pyStrip(g[1].split('|')[0]).toLowerCase();
|
|
236
|
+
if (['start', 'end', 'left', 'right'].includes(grav)) { out.set(vid[1], grav); }
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (pyRsplit(tag, '.', 1).at(-1).toLowerCase() === 'drawerlayout') { drawerDepth = depth; }
|
|
240
|
+
if (!selfclose) { depth += 1; }
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return out;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const _SHEET_CLASS_RE = pyRe('\\bclass\\s+(\\w+)\\s*(?:<[^>]*>)?\\s*(?:\\([^)]*\\))?\\s*(?:extends|:)\\s*([\\w.]*BottomSheetBehavior)\\b');
|
|
247
|
+
const _OPEN_TAG_RE_S = pyRe('<[A-Za-z][\\w.]*\\b([^>]*?)/?>', 's');
|
|
248
|
+
const _BEHAVIOR_RE = pyRe('layout_behavior\\s*=\\s*"([^"]+)"');
|
|
249
|
+
|
|
250
|
+
/** Set of view ids whose `app:layout_behavior` is a bottom sheet. */
|
|
251
|
+
export function _bottomSheetContainerIds(project) {
|
|
252
|
+
const out = new Set();
|
|
253
|
+
let layouts;
|
|
254
|
+
try { layouts = findLayoutFiles(project); } catch { return out; }
|
|
255
|
+
const sheetClasses = new Set(['BottomSheetBehavior']);
|
|
256
|
+
for (const [dp, dirs, files] of _osWalk(project)) {
|
|
257
|
+
const keep = dirs.filter((d) => !_SKIP_DIRS.has(d));
|
|
258
|
+
dirs.length = 0; dirs.push(...keep);
|
|
259
|
+
for (const fn of files) {
|
|
260
|
+
if (!endsWithAny(fn, ['.java', '.kt'])) { continue; }
|
|
261
|
+
let t;
|
|
262
|
+
try { t = readTextSmart(_osJoin(dp, fn)); } catch { continue; }
|
|
263
|
+
for (const m of _finditer(_SHEET_CLASS_RE, t)) { sheetClasses.add(m[1]); }
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
for (const [, p] of layouts) {
|
|
267
|
+
let text;
|
|
268
|
+
try { text = readTextSmart(p); } catch { continue; }
|
|
269
|
+
if (!text.includes('layout_behavior')) { continue; }
|
|
270
|
+
for (const m of _finditer(_OPEN_TAG_RE_S, text)) {
|
|
271
|
+
const attrs = m[1];
|
|
272
|
+
const b = search(_BEHAVIOR_RE, attrs);
|
|
273
|
+
const vid = search(_ID_ATTR_RE, attrs);
|
|
274
|
+
if (b && vid && sheetClasses.has(pyRsplit(b[1], '.', 1).at(-1).split('$').at(-1))) { out.add(vid[1]); }
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return out;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export const _NEWINSTANCE_RE = pyRe(
|
|
281
|
+
'\\b([A-Z]\\w*)\\s*\\.\\s*(?:newInstance|getInstance|instance|create|of)\\s*\\(');
|
|
282
|
+
export const _NEW_FRAG_RE = pyRe('\\bnew\\s+([A-Z]\\w*)\\s*\\(');
|
|
283
|
+
export const _KT_CTOR_FRAG_RE = pyRe('(?<![.\\w])([A-Z]\\w*)\\s*\\(\\s*\\)');
|
|
284
|
+
|
|
285
|
+
export const _CLASS_HEADER_RE = pyRe('\\b(?:class|object|interface)\\s+\\w+[^{;=]{0,400}?:[^{;]{0,400}', 's');
|
|
286
|
+
export const _EXTENDS_RE = pyRe('\\b(?:extends|implements)\\s+[\\w.,<>\\s]{0,200}');
|
|
287
|
+
|
|
288
|
+
/** [[start, end]] of every class-header supertype list in `text`. */
|
|
289
|
+
export function _supertypeSpans(text) {
|
|
290
|
+
const spans = [];
|
|
291
|
+
for (const m of _finditer(_CLASS_HEADER_RE, text)) {
|
|
292
|
+
const seg = m[0];
|
|
293
|
+
const colon = seg.indexOf(':');
|
|
294
|
+
if (colon === -1) { continue; }
|
|
295
|
+
const body = text.indexOf('{', m.index + colon);
|
|
296
|
+
const end = body !== -1 ? body : mEnd(m);
|
|
297
|
+
spans.push([m.index + colon, end]);
|
|
298
|
+
}
|
|
299
|
+
for (const m of _finditer(_EXTENDS_RE, text)) { spans.push([m.index, mEnd(m)]); }
|
|
300
|
+
return spans;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export function _inSupertypePosition(spans, pos) { return spans.some(([s, e]) => s <= pos && pos < e); }
|
|
304
|
+
|
|
305
|
+
export const _SHOW_NEW_RE = pyRe(
|
|
306
|
+
'(?:new\\s+)?([A-Z]\\w*(?:Dialog|DialogFragment|Fragment))\\s*\\([^;]{0,200}?\\)\\s*\\.\\s*show\\s*\\(');
|
|
307
|
+
export const _NAV_VERB = 'navigate(?!Up\\b|Back\\b)\\w*';
|
|
308
|
+
export const _NAV_ID_RE = pyRe(_NAV_VERB + '\\s*\\(\\s*R\\.id\\.(\\w+)');
|
|
309
|
+
export const _NAV_DIR_RE = pyRe(_NAV_VERB + '\\s*\\(\\s*(?:(\\w+Directions)\\s*\\.\\s*)?' +
|
|
310
|
+
'(action\\w+)\\s*\\(');
|
|
311
|
+
export const _CHILD_FM_RE = pyRe('getChildFragmentManager\\s*\\(\\s*\\)|\\bchildFragmentManager\\b');
|
|
312
|
+
|
|
313
|
+
/** str.rfind(sub, 0, end). */
|
|
314
|
+
function rfindBefore(s, sub, end) {
|
|
315
|
+
if (end - sub.length < 0) { return -1; }
|
|
316
|
+
return s.lastIndexOf(sub, end - sub.length);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** Receiver chain preceding the call at `pos` (from the last `;`/`{`/`}`). */
|
|
320
|
+
export function _statementSlice(text, pos) {
|
|
321
|
+
const start = Math.max(rfindBefore(text, ';', pos), rfindBefore(text, '{', pos), rfindBefore(text, '}', pos));
|
|
322
|
+
return text.slice(start + 1, pos);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// --- layout-XML widget label index --------------------------------------- //
|
|
326
|
+
export const _LAYOUT_ID_RE = pyRe('android:id\\s*=\\s*"@\\+?id/(\\w+)"');
|
|
327
|
+
export const _CDESC_RE = pyRe('android:contentDescription\\s*=\\s*"([^"]+)"');
|
|
328
|
+
export const _TEXT_RE = pyRe('android:text\\s*=\\s*"([^"]+)"');
|
|
329
|
+
export const _STRING_REF_RE = pyRe('^@string/(\\w+)$');
|
|
330
|
+
export const _TAG_NAME_RE = pyRe('<\\s*([\\w.]+)');
|
|
331
|
+
export const _SRC_RE = pyRe('(?:app:srcCompat|android:src)\\s*=\\s*"@drawable/(\\w+)"');
|
|
332
|
+
export const _ICON_PREFIX_RE = pyRe('^(?:ic_|icon_|img_)+');
|
|
333
|
+
|
|
334
|
+
/** [icon_only, icon_name] for one opening layout tag. */
|
|
335
|
+
export function _iconFromTag(tag) {
|
|
336
|
+
const sm = search(_SRC_RE, tag);
|
|
337
|
+
if (!sm) { return [false, null]; }
|
|
338
|
+
if (search(_TEXT_RE, tag)) { return [false, null]; }
|
|
339
|
+
const icon = pyStrip(reSub(_ICON_PREFIX_RE, '', sm[1]).replace(/_/g, ' '));
|
|
340
|
+
return [true, icon || null];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** `@string/x` -> strings[x]; a literal passes unless it is a ref/template. */
|
|
344
|
+
export function _resolveStr(val, strings) {
|
|
345
|
+
const m = new RegExp(_STRING_REF_RE.source, _STRING_REF_RE.flags + 'y').exec(pyStrip(val));
|
|
346
|
+
if (m) { return get(strings, m[1]); }
|
|
347
|
+
return val.startsWith('@') || val.includes('%') ? null : val;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// --- layout-declared fragments ---------------------------------------------- //
|
|
351
|
+
export const _LAYOUT_FRAG_TAG_RE = pyRe('<(?:(?:[\\w.]*\\.)?FragmentContainerView|fragment)\\b[^>]*?>', 's');
|
|
352
|
+
export const _LAYOUT_FRAG_NAME_RE = pyRe('android:name\\s*=\\s*"([^"]+)"');
|
|
353
|
+
export const _LAYOUT_W_RE = pyRe('android:layout_width\\s*=\\s*"([^"]+)"');
|
|
354
|
+
export const _LAYOUT_H_RE = pyRe('android:layout_height\\s*=\\s*"([^"]+)"');
|
|
355
|
+
export const _LAYOUT_WEIGHT_RE = pyRe('android:layout_weight\\s*=\\s*"([\\d.]+)"');
|
|
356
|
+
|
|
357
|
+
/** True when this container occupies the host's whole content area. */
|
|
358
|
+
export function _fillsHost(tag) {
|
|
359
|
+
const axis = (m) => {
|
|
360
|
+
if (!m) { return false; }
|
|
361
|
+
const v = pyStrip(m[1]);
|
|
362
|
+
return ['match_parent', 'fill_parent', '0dp', '0px', '0dip'].includes(v);
|
|
363
|
+
};
|
|
364
|
+
const w = axis(search(_LAYOUT_W_RE, tag));
|
|
365
|
+
const h = axis(search(_LAYOUT_H_RE, tag));
|
|
366
|
+
return w && h;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** [[layout_rel_path, line, class_simple_name, view_id, fills, qualifier]]. */
|
|
370
|
+
export function layoutDeclaredFragments(project) {
|
|
371
|
+
const out = [];
|
|
372
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
373
|
+
const keep = dirs.filter((d) => !_SKIP_DIRS.has(d));
|
|
374
|
+
dirs.length = 0; dirs.push(...keep);
|
|
375
|
+
const norm = dirpath.replace(/\\/g, '/');
|
|
376
|
+
if (!norm.includes('/res/layout') || !isShippingDir(norm)) { continue; }
|
|
377
|
+
const leaf = pyRsplit(norm, '/res/', 1).at(-1).split('/')[0];
|
|
378
|
+
const qualifier = leaf.slice('layout'.length).replace(/^-+/, '') || null;
|
|
379
|
+
for (const fn of sortedStr(files)) {
|
|
380
|
+
if (!fn.endsWith('.xml')) { continue; }
|
|
381
|
+
const p = _osJoin(dirpath, fn);
|
|
382
|
+
let text;
|
|
383
|
+
try { text = readTextSmart(p); } catch { continue; }
|
|
384
|
+
if (!text.includes('android:name')) { continue; }
|
|
385
|
+
for (const m of _finditer(_LAYOUT_FRAG_TAG_RE, text)) {
|
|
386
|
+
const tag = m[0];
|
|
387
|
+
const nm = search(_LAYOUT_FRAG_NAME_RE, tag);
|
|
388
|
+
if (!nm) { continue; }
|
|
389
|
+
const cls = pyStrip(nm[1]).split('.').at(-1);
|
|
390
|
+
if (!cls) { continue; }
|
|
391
|
+
const idm = search(_LAYOUT_ID_RE, tag);
|
|
392
|
+
const line = lineOf(text, m.index);
|
|
393
|
+
const r = osRelpath(p, project).replace(/\\/g, '/');
|
|
394
|
+
out.push([r, line, cls, idm ? idm[1] : null, _fillsHost(tag), qualifier]);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return out;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export const _SETLAYOUT_RE = pyRe('(?:setContentView|inflate)\\s*\\([^)]*R\\.layout\\.(\\w+)');
|
|
402
|
+
export const _BINDING_RE = pyRe('\\b([A-Z]\\w*)Binding\\s*\\.\\s*inflate\\s*\\(');
|
|
403
|
+
export const _CTOR_LAYOUT_RE = pyRe('R\\.layout\\.(\\w+)');
|
|
404
|
+
const _CLASS_COLON_RE = pyRe('\\bclass\\s+\\w+[^{]{0,400}?:');
|
|
405
|
+
const _CAMEL_SPLIT_RE = pyRe('(?<!^)(?=[A-Z])');
|
|
406
|
+
|
|
407
|
+
/** Map{layout_name: [owning class simple name, ...]}. */
|
|
408
|
+
export function _layoutToHosts(sources) {
|
|
409
|
+
const out = new Map();
|
|
410
|
+
for (const [, text] of sources) {
|
|
411
|
+
const owner = _owningClass(text);
|
|
412
|
+
if (!owner) { continue; }
|
|
413
|
+
// Python: a set (hash order) -> only membership/out[nm] list order matters. Iterated in
|
|
414
|
+
// first-occurrence order here (DETERMINISM: fragment_nav.py _layout_to_hosts `for nm in names`).
|
|
415
|
+
const names = new Set(reFindall(_SETLAYOUT_RE, text));
|
|
416
|
+
for (const m of _finditer(_BINDING_RE, text)) {
|
|
417
|
+
names.add(reSub(_CAMEL_SPLIT_RE, '_', m[1]).toLowerCase());
|
|
418
|
+
}
|
|
419
|
+
for (const cm of _finditer(_CLASS_COLON_RE, text)) {
|
|
420
|
+
const body = text.indexOf('{', mEnd(cm));
|
|
421
|
+
const header = text.slice(mEnd(cm), body !== -1 ? body : Math.min(text.length, mEnd(cm) + 400));
|
|
422
|
+
for (const lm of _finditer(_CTOR_LAYOUT_RE, header)) { names.add(lm[1]); }
|
|
423
|
+
}
|
|
424
|
+
for (const nm of names) {
|
|
425
|
+
if (!out.has(nm)) { out.set(nm, []); }
|
|
426
|
+
if (!out.get(nm).includes(owner)) { out.get(nm).push(owner); }
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return out;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/** Edges for fragments the framework instantiates from a layout. */
|
|
433
|
+
export function detectLayoutEdges(sources, project, fragNames, dialogNames = null) {
|
|
434
|
+
dialogNames = dialogNames && dialogNames.size ? dialogNames : new Set();
|
|
435
|
+
const hostsByLayout = _layoutToHosts(sources);
|
|
436
|
+
const edges = [];
|
|
437
|
+
const seen = new Set();
|
|
438
|
+
for (const [r, line, cls, vid, fills, qualifier] of layoutDeclaredFragments(project)) {
|
|
439
|
+
if (!fragNames.has(cls)) { continue; }
|
|
440
|
+
const layoutName = pyRsplit(path.basename(r), '.', 1)[0];
|
|
441
|
+
for (const host of hostsByLayout.get(layoutName) ?? []) {
|
|
442
|
+
if (host === cls) { continue; }
|
|
443
|
+
const srcId = fragNames.has(host) ? `fragment:${host}` : `activity:${host}`;
|
|
444
|
+
let mech = 'fragment-transaction';
|
|
445
|
+
const args = { action: 'default', via: 'layout-inflate' };
|
|
446
|
+
if (vid) { args.container_id = vid; }
|
|
447
|
+
if (dialogNames.has(cls)) {
|
|
448
|
+
mech = 'open-overlay';
|
|
449
|
+
args.modal = true;
|
|
450
|
+
} else if (!fills) {
|
|
451
|
+
mech = 'fragment-embed';
|
|
452
|
+
args.relation = 'containment';
|
|
453
|
+
args.via = 'layout-inflate-region';
|
|
454
|
+
}
|
|
455
|
+
const key = tupleKey(srcId, `fragment:${cls}`, mech);
|
|
456
|
+
if (seen.has(key)) { continue; }
|
|
457
|
+
seen.add(key);
|
|
458
|
+
edges.push({
|
|
459
|
+
source: srcId,
|
|
460
|
+
target: `fragment:${cls}`,
|
|
461
|
+
mechanism: mech,
|
|
462
|
+
trigger: `layout-inflate@${r}:${line}`,
|
|
463
|
+
guard: qualifier ? `resource qualifier ${qualifier}` : null,
|
|
464
|
+
args,
|
|
465
|
+
provenance: 'static:structural',
|
|
466
|
+
status: 'static-only',
|
|
467
|
+
confidence: 0.9,
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return edges;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const _OPEN_ANY_TAG_RE_S = pyRe('<[^/!?][^>]*?>', 's');
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Map{view_id: on_screen_label} across every res/layout*\/*.xml. `icons` (Map) collects
|
|
478
|
+
* {view_id: icon_name}; `low_signal` (Set) collects placeholder-label view ids.
|
|
479
|
+
*/
|
|
480
|
+
export function buildWidgetLabels(project, strings, icons = null, lowSignal = null) {
|
|
481
|
+
icons = icons ?? new Map();
|
|
482
|
+
lowSignal = lowSignal ?? new Set();
|
|
483
|
+
const labels = new Map();
|
|
484
|
+
const refKey = (v) => {
|
|
485
|
+
const km = new RegExp(_STRING_REF_RE.source, _STRING_REF_RE.flags + 'y').exec(pyStrip(v));
|
|
486
|
+
return km ? km[1] : null;
|
|
487
|
+
};
|
|
488
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
489
|
+
const keep = dirs.filter((d) => !_SKIP_DIRS.has(d));
|
|
490
|
+
dirs.length = 0; dirs.push(...keep);
|
|
491
|
+
const norm = dirpath.replace(/\\/g, '/');
|
|
492
|
+
if (!norm.includes('/res/layout') || !isShippingDir(norm)) { continue; }
|
|
493
|
+
for (const fn of files) {
|
|
494
|
+
if (!fn.endsWith('.xml')) { continue; }
|
|
495
|
+
let text;
|
|
496
|
+
try { text = readTextSmart(_osJoin(dirpath, fn)); } catch { continue; }
|
|
497
|
+
for (const tm0 of _finditer(_OPEN_ANY_TAG_RE_S, text)) {
|
|
498
|
+
const tag = tm0[0];
|
|
499
|
+
const idm = search(_LAYOUT_ID_RE, tag);
|
|
500
|
+
if (!idm) { continue; }
|
|
501
|
+
const vid = idm[1];
|
|
502
|
+
if (labels.has(vid)) { continue; }
|
|
503
|
+
let lab = null; let srcKey = null;
|
|
504
|
+
const cm = search(_CDESC_RE, tag);
|
|
505
|
+
if (cm) { lab = _resolveStr(cm[1], strings); srcKey = refKey(cm[1]); }
|
|
506
|
+
if (!lab) {
|
|
507
|
+
const tm = search(_TEXT_RE, tag);
|
|
508
|
+
if (tm) { lab = _resolveStr(tm[1], strings); srcKey = refKey(tm[1]); }
|
|
509
|
+
}
|
|
510
|
+
if (lab) {
|
|
511
|
+
labels.set(vid, lab);
|
|
512
|
+
if (isLowSignal(srcKey, lab)) { lowSignal.add(vid); }
|
|
513
|
+
}
|
|
514
|
+
const [iconOnly, icon] = _iconFromTag(tag);
|
|
515
|
+
if (iconOnly && !icons.has(vid)) { icons.set(vid, icon || ''); }
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return labels;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export const _LISTENER_RE = pyRe(
|
|
523
|
+
'(?:' +
|
|
524
|
+
'(?:\\b\\w+\\s*\\.\\s*)*(?:findViewById|getViewById)\\s*\\(\\s*R\\.id\\.(?P<vid>\\w+)\\s*\\)' +
|
|
525
|
+
'|' +
|
|
526
|
+
'(?:\\b\\w+\\s*\\.\\s*)*?(?P<vid2>\\w+)(?:\\s*\\([^()]*\\))?' +
|
|
527
|
+
')' +
|
|
528
|
+
'\\s*\\.\\s*setOn\\w*(?:Click|MenuItemClick)Listener\\s*[({]');
|
|
529
|
+
|
|
530
|
+
export const _FIELD_BIND_RE = pyRe(
|
|
531
|
+
'\\b(\\w+)\\s*=\\s*(?:\\(\\s*[\\w.<>]+\\s*\\)\\s*)?(?:[\\w.()]+\\s*\\.\\s*)?' +
|
|
532
|
+
'(?:findViewById|requireViewById)\\s*(?:<[\\w.]+>)?\\s*\\(\\s*R\\.id\\.(\\w+)\\s*\\)');
|
|
533
|
+
|
|
534
|
+
/** The widget id from a `_LISTENER_RE` match, whichever branch matched. */
|
|
535
|
+
export function listenerWidgetId(m) { return m.groups.vid || m.groups.vid2 || null; }
|
|
536
|
+
|
|
537
|
+
/** End offset of the listener body opened after `openParenPos`. */
|
|
538
|
+
export function _braceSpan(text, openParenPos) {
|
|
539
|
+
const n = text.length;
|
|
540
|
+
let depthPar = 0;
|
|
541
|
+
let i = openParenPos;
|
|
542
|
+
while (i < n) {
|
|
543
|
+
const c = text[i];
|
|
544
|
+
if (c === '(') { depthPar += 1; } else if (c === ')') {
|
|
545
|
+
depthPar -= 1;
|
|
546
|
+
if (depthPar === 0) { return i; }
|
|
547
|
+
} else if (c === '{') {
|
|
548
|
+
let d = 0; let j = i;
|
|
549
|
+
while (j < n) {
|
|
550
|
+
if (text[j] === '{') { d += 1; } else if (text[j] === '}') {
|
|
551
|
+
d -= 1;
|
|
552
|
+
if (d === 0) { return j; }
|
|
553
|
+
}
|
|
554
|
+
j += 1;
|
|
555
|
+
}
|
|
556
|
+
return n;
|
|
557
|
+
}
|
|
558
|
+
i += 1;
|
|
559
|
+
}
|
|
560
|
+
return n;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export const _LIFECYCLE_FNS = new Set([
|
|
564
|
+
'onCreate', 'onCreateView', 'onViewCreated', 'onStart', 'onResume',
|
|
565
|
+
'onActivityCreated', 'onPostCreate', 'onAttach', 'onInflate',
|
|
566
|
+
'onNewIntent',
|
|
567
|
+
'onRestoreInstanceState', 'onFinishInflate', 'onConfigurationChanged',
|
|
568
|
+
'onCreateOptionsMenu', 'onPrepareOptionsMenu',
|
|
569
|
+
'init', 'initialize', 'initViews', 'initView', 'setupViews', 'setUpViews',
|
|
570
|
+
'initUi', 'initUI', 'setupUi', 'setUpUi', 'initFragments', 'setupFragments',
|
|
571
|
+
'initLayout', 'setupLayout', 'onRestoreView',
|
|
572
|
+
]);
|
|
573
|
+
export const _ASYNC_FNS = new Set([
|
|
574
|
+
'run', 'doInBackground', 'onPostExecute', 'onSuccess', 'onFailure',
|
|
575
|
+
'onResponse', 'onError', 'onComplete', 'onNext', 'accept', 'invoke',
|
|
576
|
+
'onChanged', 'observe', 'collect', 'emit',
|
|
577
|
+
]);
|
|
578
|
+
export const _BACKSTACK_RE = pyRe('\\baddToBackStack\\s*\\(');
|
|
579
|
+
|
|
580
|
+
/** Text around a transaction call, bounded to its own commit chain. */
|
|
581
|
+
export function _txnChainSlice(text, pos, back = 500, fwd = 500) {
|
|
582
|
+
const lo = Math.max(0, pos - back);
|
|
583
|
+
const hi = Math.min(text.length, pos + fwd);
|
|
584
|
+
let seg = text.slice(lo, hi);
|
|
585
|
+
let r = pos - lo;
|
|
586
|
+
const cut = rfindBefore(seg, 'commit', r);
|
|
587
|
+
if (cut !== -1) { seg = seg.slice(cut); r -= cut; }
|
|
588
|
+
const end = seg.indexOf('commit', Math.max(0, r));
|
|
589
|
+
if (end !== -1) { seg = seg.slice(0, end); }
|
|
590
|
+
return seg;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/** ['lifecycle'|'dispatched'|'unknown', reason] for a transaction at `pos`. */
|
|
594
|
+
export function classifyCommit(text, pos, fnRangeList) {
|
|
595
|
+
if (search(_BACKSTACK_RE, _txnChainSlice(text, pos))) { return ['dispatched', 'addToBackStack']; }
|
|
596
|
+
const fn = innermostFnAt(fnRangeList, pos);
|
|
597
|
+
if (!fn) { return ['unknown', 'no-enclosing-fn']; }
|
|
598
|
+
if (_LIFECYCLE_FNS.has(fn)) { return ['lifecycle', `lifecycle-fn:${fn}`]; }
|
|
599
|
+
if (_ASYNC_FNS.has(fn)) { return ['dispatched', `async-fn:${fn}`]; }
|
|
600
|
+
return ['dispatched', `non-lifecycle-fn:${fn}`];
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/** [[widget_id, start, end]] for every click-listener body in `text`. */
|
|
604
|
+
export function buildListenerSpans(text, project = null) {
|
|
605
|
+
const viewIds = project ? buildViewIdIndex(project) : null;
|
|
606
|
+
const bound = new Map();
|
|
607
|
+
for (const b of _finditer(_FIELD_BIND_RE, text)) {
|
|
608
|
+
if (!bound.has(b[1])) { bound.set(b[1], new Set()); }
|
|
609
|
+
bound.get(b[1]).add(b[2]);
|
|
610
|
+
}
|
|
611
|
+
const spans = [];
|
|
612
|
+
for (const m of _finditer(_LISTENER_RE, text)) {
|
|
613
|
+
const e = mEnd(m);
|
|
614
|
+
const delim = text[e - 1];
|
|
615
|
+
const p = delim === '{' ? e - 1 : text.indexOf('(', e - 1);
|
|
616
|
+
if (p < 0) { continue; }
|
|
617
|
+
const end = _braceSpan(text, p);
|
|
618
|
+
let vid = listenerWidgetId(m);
|
|
619
|
+
if (vid && m.groups.vid2 && (bound.get(vid)?.size ?? 0) === 1) { vid = [...bound.get(vid)][0]; }
|
|
620
|
+
if (vid && viewIds && viewIds.size) { vid = resolveViewId(vid, viewIds); }
|
|
621
|
+
spans.push([vid, m.index, end]);
|
|
622
|
+
}
|
|
623
|
+
return spans;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/** Write args.trigger_id only when `vid` is a declared view id (else trigger_receiver). */
|
|
627
|
+
export function stampTriggerId(args, vid, project = null) {
|
|
628
|
+
if (!vid) { return; }
|
|
629
|
+
const viewIds = project ? buildViewIdIndex(project) : null;
|
|
630
|
+
if (viewIds && viewIds.size && !viewIds.has(vid)) {
|
|
631
|
+
args.trigger_receiver = vid;
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
args.trigger_id = vid;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/** widget_id whose listener body contains `pos`, else null. */
|
|
638
|
+
export function _triggerFor(spans, pos) {
|
|
639
|
+
for (const [vid, start, end] of spans) {
|
|
640
|
+
if (start <= pos && pos <= end) { return vid; }
|
|
641
|
+
}
|
|
642
|
+
return null;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
const _DECL_TAIL_RE = pyRe('\\)\\s*(?:throws\\s+[^{]+)?\\s*\\{\\s*$');
|
|
646
|
+
|
|
647
|
+
/** One bounded caller hop for a navigation inside a helper (see fragment_nav.py). */
|
|
648
|
+
export function _helperCallerEvidence(text, sitePos, fnRangeList, listenerSpans) {
|
|
649
|
+
const hasBackstack = !!search(_BACKSTACK_RE, _txnChainSlice(text, sitePos));
|
|
650
|
+
const siteFn = innermostFnAt(fnRangeList, sitePos);
|
|
651
|
+
if (!siteFn) { return null; }
|
|
652
|
+
const callRe = pyRe('\\b' + reEscape(siteFn) + '\\s*\\(');
|
|
653
|
+
const callers = [];
|
|
654
|
+
for (const m of _finditer(callRe, text)) {
|
|
655
|
+
const callPos = m.index;
|
|
656
|
+
const caller = innermostFnAt(fnRangeList, callPos);
|
|
657
|
+
let isDecl = false;
|
|
658
|
+
for (const [s, , name] of fnRangeList || []) {
|
|
659
|
+
if (name !== siteFn || s <= callPos) { continue; }
|
|
660
|
+
const between = text.slice(callPos, s);
|
|
661
|
+
if (between.length <= 1200 && search(_DECL_TAIL_RE, between)) { isDecl = true; break; }
|
|
662
|
+
}
|
|
663
|
+
if (isDecl) { continue; }
|
|
664
|
+
if (caller === siteFn) { continue; }
|
|
665
|
+
if (!caller) { continue; }
|
|
666
|
+
const trigger = _triggerFor(listenerSpans, callPos);
|
|
667
|
+
if (trigger !== null) { callers.push(['listener', caller, trigger]); }
|
|
668
|
+
else if (_LIFECYCLE_FNS.has(caller)) { callers.push(['lifecycle', caller, null]); }
|
|
669
|
+
else { callers.push(['unknown', caller, null]); }
|
|
670
|
+
}
|
|
671
|
+
if (!callers.length) { return null; }
|
|
672
|
+
const kinds = new Set(callers.map((c) => c[0]));
|
|
673
|
+
if (kinds.size === 1 && kinds.has('lifecycle')) {
|
|
674
|
+
if (hasBackstack) { return null; }
|
|
675
|
+
const names = sortedStr(new Set(callers.map((c) => c[1])));
|
|
676
|
+
return { kind: 'lifecycle', reason: 'caller-lifecycle:' + names.join(',') };
|
|
677
|
+
}
|
|
678
|
+
if (kinds.size === 1 && kinds.has('listener')) {
|
|
679
|
+
const triggers = new Set(callers.map((c) => c[2]));
|
|
680
|
+
if (triggers.size === 1) { return { kind: 'listener', trigger_id: [...triggers][0], reason: 'caller-listener' }; }
|
|
681
|
+
}
|
|
682
|
+
return null;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
const _OWNING_FALLBACK_RE = pyRe(
|
|
686
|
+
'\\b(?:public\\s+|final\\s+|abstract\\s+|open\\s+|internal\\s+|sealed\\s+)*' +
|
|
687
|
+
'class\\s+([A-Z]\\w*)\\b');
|
|
688
|
+
|
|
689
|
+
/** Which top-level class owns a source file (first class declaration). */
|
|
690
|
+
let _OWNING_MEMO = [null, null];
|
|
691
|
+
export function _owningClass(text) {
|
|
692
|
+
// a class named only in a comment (a Javadoc usage example) does not own this file
|
|
693
|
+
if (_OWNING_MEMO[0] !== text) { _OWNING_MEMO = [text, blankCommentsAndStrings(text)]; }
|
|
694
|
+
text = _OWNING_MEMO[1];
|
|
695
|
+
let m = search(_CLASS_DECL_RE, text);
|
|
696
|
+
if (m) { return m[1]; }
|
|
697
|
+
m = search(_OWNING_FALLBACK_RE, text);
|
|
698
|
+
return m ? m[1] : null;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/** Sentinel: this file's owner is not a page (resolved lazily through the HostResolver). */
|
|
702
|
+
export const _LAZY_NON_PAGE = Symbol('LAZY_NON_PAGE');
|
|
703
|
+
/** Safe Args-shaped call sites whose action id is in no nav graph: [[owner, method]]. */
|
|
704
|
+
export const _NAV_UNRESOLVED = [];
|
|
705
|
+
|
|
706
|
+
export const _NAV_DEST_ELEM_RE = pyRe('<\\s*(fragment|dialog|activity|navigation)\\b([^>]*)>', 's');
|
|
707
|
+
export const _NAV_ACTION_ELEM_RE = pyRe('<\\s*action\\b([^>]*)>', 's');
|
|
708
|
+
export const _NAV_ATTR_RE = pyRe('(?:android|app):(\\w+)\\s*=\\s*"([^"]*)"');
|
|
709
|
+
export const _NAV_ID_REF_RE = pyRe('@\\+?id/(\\w+)');
|
|
710
|
+
|
|
711
|
+
/** dict(findall) of attribute pairs (last wins, first-insertion order). */
|
|
712
|
+
function attrDict(blob) {
|
|
713
|
+
const d = new Map();
|
|
714
|
+
for (const [k, v] of reFindall(_NAV_ATTR_RE, blob)) { d.set(k, v); }
|
|
715
|
+
return d;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/** [Map{dest_id: class_simple_name}, Map{action_id: dest_id}] from res/navigation. */
|
|
719
|
+
export function buildNavGraph(project) {
|
|
720
|
+
const dests = new Map(); const actions = new Map();
|
|
721
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
722
|
+
const keep = dirs.filter((d) => !_SKIP_DIRS.has(d));
|
|
723
|
+
dirs.length = 0; dirs.push(...keep);
|
|
724
|
+
const norm = dirpath.replace(/\\/g, '/');
|
|
725
|
+
if (!norm.includes('/res/navigation')) { continue; }
|
|
726
|
+
if (!isShippingDir(norm)) { continue; }
|
|
727
|
+
for (const fn of files) {
|
|
728
|
+
if (!fn.endsWith('.xml')) { continue; }
|
|
729
|
+
let text;
|
|
730
|
+
try { text = readTextSmart(_osJoin(dirpath, fn)); } catch { continue; }
|
|
731
|
+
for (const m of _finditer(_NAV_DEST_ELEM_RE, text)) {
|
|
732
|
+
const attrs = attrDict(m[2]);
|
|
733
|
+
const did = search(_NAV_ID_REF_RE, attrs.get('id') || '');
|
|
734
|
+
const name = attrs.get('name') || '';
|
|
735
|
+
if (did && name) { dests.set(did[1], pyRsplit(name, '.', 1).at(-1)); }
|
|
736
|
+
}
|
|
737
|
+
for (const m of _finditer(_NAV_ACTION_ELEM_RE, text)) {
|
|
738
|
+
const attrs = attrDict(m[1]);
|
|
739
|
+
const aid = search(_NAV_ID_REF_RE, attrs.get('id') || '');
|
|
740
|
+
const dst = search(_NAV_ID_REF_RE, attrs.get('destination') || '');
|
|
741
|
+
if (aid && dst) { actions.set(aid[1], dst[1]); }
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return [dests, actions];
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** `actionMainSettingsToSync` -> `action_main_settings_to_sync`. */
|
|
749
|
+
export function _camelToSnake(name) { return reSub(_CAMEL_SPLIT_RE, '_', name).toLowerCase(); }
|
|
750
|
+
|
|
751
|
+
/** A HostResolver in this extractor's own id scheme (fragment/voyager-screen/dialog/activity). */
|
|
752
|
+
/** Simple names of the Activities `<ws>/manifest.jsonl` declares (empty when absent). */
|
|
753
|
+
export function manifestActivityNames(ws) {
|
|
754
|
+
const out = new Set();
|
|
755
|
+
if (!ws) { return out; }
|
|
756
|
+
let raw;
|
|
757
|
+
try { raw = fs.readFileSync(_osJoin(ws, 'manifest.jsonl'), 'utf-8'); } catch { return out; }
|
|
758
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
759
|
+
if (!line.trim()) { continue; }
|
|
760
|
+
try {
|
|
761
|
+
const r = JSON.parse(line);
|
|
762
|
+
if (r && r.type === 'activity' && r.name) { out.add(String(r.name).split('.').pop()); }
|
|
763
|
+
} catch { /* skip a malformed line */ }
|
|
764
|
+
}
|
|
765
|
+
return out;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
export function _makeHostResolver(sources, fragNames, project = null, manifest = null) {
|
|
769
|
+
const voyagerByName = new Set();
|
|
770
|
+
for (const [, t] of sources) {
|
|
771
|
+
const vp = voyagerPage(t);
|
|
772
|
+
if (vp) { voyagerByName.add(vp); }
|
|
773
|
+
}
|
|
774
|
+
let dialogNames;
|
|
775
|
+
try {
|
|
776
|
+
dialogNames = new Set(buildDialogSet(sources, project || '')[0].keys());
|
|
777
|
+
} catch (exc) {
|
|
778
|
+
pyPrintErr(`# dialog page set unavailable (${exc?.name ?? 'Error'}: ${errStr(exc)})` +
|
|
779
|
+
' — a plain-Dialog owner will fall back to the non-page resolver');
|
|
780
|
+
dialogNames = new Set();
|
|
781
|
+
}
|
|
782
|
+
for (const f of fragNames) { dialogNames.delete(f); }
|
|
783
|
+
// Activity-ness is read from the OWNER's supertype chain (never the file text): a constructor
|
|
784
|
+
// parameter or a Javadoc example is not a supertype, and `ActivityMain extends ActivityBase` is one.
|
|
785
|
+
const chain = new ActivityChain(buildClassIndex(sources), manifest);
|
|
786
|
+
const isPage = (owner) => fragNames.has(owner) || voyagerByName.has(owner) ||
|
|
787
|
+
dialogNames.has(owner) || chain.isPage(owner);
|
|
788
|
+
const idFor = (name) => {
|
|
789
|
+
if (fragNames.has(name)) { return `fragment:${name}`; }
|
|
790
|
+
if (voyagerByName.has(name)) { return `voyager-screen:${name}`; }
|
|
791
|
+
if (dialogNames.has(name)) { return `dialog:${name}`; }
|
|
792
|
+
return `activity:${name}`;
|
|
793
|
+
};
|
|
794
|
+
return new HostResolver(sources, isPage, idFor, { activity_chain: chain });
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/** [node_id] for a site, resolving the non-page sentinel through `resolver`. */
|
|
798
|
+
export function _srcIds(srcId, owner, resolver, method = null) {
|
|
799
|
+
if (srcId !== _LAZY_NON_PAGE) { return [srcId]; }
|
|
800
|
+
return resolver.sourcesFor(owner, method);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// Synthetic label in the installed language; lower-case in English so _isCodeName keeps it.
|
|
804
|
+
export const _DRAWER_LABEL = "drawer menu";
|
|
805
|
+
export const _IF_HEAD_RE = pyRe('\\bif\\s*\\(');
|
|
806
|
+
export const _DRAWER_DISABLE_RE = pyRe(
|
|
807
|
+
'setDrawerLockMode\\s*\\(\\s*[^)]*LOCK_MODE_LOCKED_CLOSED' +
|
|
808
|
+
'|setDrawerLockMode\\s*\\(\\s*[^)]*LOCK_MODE_LOCKED_OPEN');
|
|
809
|
+
|
|
810
|
+
/** Index of the closer matching the opener at `start`, or null. */
|
|
811
|
+
export function _matchPair(text, start, opener, closer) {
|
|
812
|
+
if (start >= text.length || text[start] !== opener) { return null; }
|
|
813
|
+
let depth = 0;
|
|
814
|
+
for (let i = start; i < text.length; i++) {
|
|
815
|
+
const c = text[i];
|
|
816
|
+
if (c === opener) { depth += 1; } else if (c === closer) {
|
|
817
|
+
depth -= 1;
|
|
818
|
+
if (depth === 0) { return i; }
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
return null;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/** Condition of the innermost `if (...)` whose body contains `pos`, else null. */
|
|
825
|
+
export function _enclosingIfCondition(text, pos, window = 2000) {
|
|
826
|
+
const start = Math.max(0, pos - window);
|
|
827
|
+
let best = null;
|
|
828
|
+
for (const m of _finditer(_IF_HEAD_RE, text, start, pos)) {
|
|
829
|
+
const lp = mEnd(m) - 1;
|
|
830
|
+
const rp = _matchPair(text, lp, '(', ')');
|
|
831
|
+
if (rp === null) { continue; }
|
|
832
|
+
const cond = pyStrip(text.slice(lp + 1, rp));
|
|
833
|
+
const brace = text.indexOf('{', rp);
|
|
834
|
+
if (brace < 0 || brace > pos) { continue; }
|
|
835
|
+
if (pyStrip(text.slice(rp + 1, brace))) { continue; }
|
|
836
|
+
const end = _matchPair(text, brace, '{', '}');
|
|
837
|
+
if (end !== null && brace < pos && pos < end) { best = cond; }
|
|
838
|
+
}
|
|
839
|
+
return best;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/** The condition under which this source DISABLES its drawer, else null. */
|
|
843
|
+
export function _drawerDisabledCondition(text) {
|
|
844
|
+
for (const m of _finditer(_DRAWER_DISABLE_RE, text)) {
|
|
845
|
+
const cond = _enclosingIfCondition(text, m.index);
|
|
846
|
+
if (cond) { return cond; }
|
|
847
|
+
}
|
|
848
|
+
return null;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/** dict.setdefault(k, v) on a plain object. */
|
|
852
|
+
function sdef(o, k, v) { if (!Object.hasOwn(o, k)) { o[k] = v; } return o[k]; }
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Fragment-transaction / fragment-embed / open-overlay / nav-component-action edges.
|
|
856
|
+
* opts (Python kwargs / positional order): widget_labels(Map) dialog_names(Set)
|
|
857
|
+
* widget_icons(Map) widget_low_signal(Set) drawer_ids(Map) host_resolver nav_graph sheet_ids(Set).
|
|
858
|
+
*/
|
|
859
|
+
export function detectEdges(sources, project, fragNames, opts = {}) {
|
|
860
|
+
const widgetLabels = opts.widget_labels ?? new Map();
|
|
861
|
+
const dialogNames = opts.dialog_names ?? new Set();
|
|
862
|
+
const widgetIcons = opts.widget_icons ?? new Map();
|
|
863
|
+
const widgetLowSignal = opts.widget_low_signal ?? new Set();
|
|
864
|
+
const drawerIds = opts.drawer_ids ?? new Map();
|
|
865
|
+
const sheetIds = opts.sheet_ids ?? new Set();
|
|
866
|
+
const hostResolver = opts.host_resolver ?? _makeHostResolver(sources, fragNames, project);
|
|
867
|
+
const [navDests, navActions] = opts.nav_graph ? opts.nav_graph : buildNavGraph(project);
|
|
868
|
+
const edges = [];
|
|
869
|
+
for (const [p, text] of sources) {
|
|
870
|
+
const owner = _owningClass(text);
|
|
871
|
+
if (!owner) { continue; }
|
|
872
|
+
let srcId = hostResolver.pageId(owner, text);
|
|
873
|
+
if (srcId === null) { srcId = _LAZY_NON_PAGE; }
|
|
874
|
+
const spans = buildListenerSpans(text, project);
|
|
875
|
+
const fnRangesCached = fnRanges(text, p);
|
|
876
|
+
const drawerTargets = new Map();
|
|
877
|
+
if (drawerIds.size) {
|
|
878
|
+
for (const m of _finditer(_TXN_CONTAINER_RE, text)) {
|
|
879
|
+
const grav = drawerIds.get(m[1]);
|
|
880
|
+
if (!grav) { continue; }
|
|
881
|
+
const cls = _resolveLocalType(text, m[2]);
|
|
882
|
+
if (cls) { drawerTargets.set(cls, grav); }
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
const drawerBlock = drawerTargets.size ? _drawerDisabledCondition(text) : null;
|
|
886
|
+
const sheetTargets = new Set();
|
|
887
|
+
if (sheetIds.size) {
|
|
888
|
+
for (const m of _finditer(_TXN_CONTAINER_RE, text)) {
|
|
889
|
+
if (sheetIds.has(m[1])) {
|
|
890
|
+
const cls = _resolveLocalType(text, m[2]);
|
|
891
|
+
if (cls) { sheetTargets.add(cls); }
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
const trig = (pos) => `${owner}@${rel(p, project)}:${lineOf(text, pos)}`;
|
|
896
|
+
|
|
897
|
+
const emit = (target, mech, pos, extra = null) => {
|
|
898
|
+
if (!fragNames.has(target)) { return; }
|
|
899
|
+
if (target === owner) { return; }
|
|
900
|
+
const args = { ...(extra || {}) };
|
|
901
|
+
if (dialogNames.has(target)) {
|
|
902
|
+
mech = 'open-overlay';
|
|
903
|
+
sdef(args, 'modal', true);
|
|
904
|
+
}
|
|
905
|
+
const isEmbed = mech !== 'open-overlay' && !!search(_CHILD_FM_RE, _statementSlice(text, pos));
|
|
906
|
+
if (isEmbed) {
|
|
907
|
+
mech = 'fragment-embed';
|
|
908
|
+
args.relation = 'containment';
|
|
909
|
+
sdef(args, 'action', 'default');
|
|
910
|
+
sdef(args, 'via', 'child-fragment');
|
|
911
|
+
} else {
|
|
912
|
+
let vid = _triggerFor(spans, pos);
|
|
913
|
+
if (vid === null) {
|
|
914
|
+
const callerEv = _helperCallerEvidence(text, pos, fnRangesCached, spans);
|
|
915
|
+
if (callerEv && callerEv.kind === 'listener') {
|
|
916
|
+
vid = callerEv.trigger_id ?? null;
|
|
917
|
+
sdef(args, 'commit_scope', callerEv.reason ?? null);
|
|
918
|
+
} else if (callerEv && callerEv.kind === 'lifecycle') {
|
|
919
|
+
sdef(args, 'commit_scope', callerEv.reason ?? null);
|
|
920
|
+
sdef(args, 'action', 'default');
|
|
921
|
+
sdef(args, 'via', 'auto-load');
|
|
922
|
+
} else {
|
|
923
|
+
const [how, why] = classifyCommit(text, pos, fnRangesCached);
|
|
924
|
+
sdef(args, 'commit_scope', why);
|
|
925
|
+
if (how === 'dispatched') {
|
|
926
|
+
sdef(args, 'action', 'tap');
|
|
927
|
+
sdef(args, 'via', 'dispatched');
|
|
928
|
+
sdef(args, 'needs_trigger', true);
|
|
929
|
+
} else {
|
|
930
|
+
sdef(args, 'action', 'default');
|
|
931
|
+
sdef(args, 'via', 'auto-load');
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
if (vid !== null) {
|
|
936
|
+
const lab = widgetLabels.get(vid);
|
|
937
|
+
if (lab) { sdef(args, 'label', lab); }
|
|
938
|
+
if (!Object.hasOwn(args, 'trigger_id')) { stampTriggerId(args, vid, project); }
|
|
939
|
+
if (widgetIcons.has(vid)) {
|
|
940
|
+
args.icon_only = true;
|
|
941
|
+
const icon = widgetIcons.get(vid);
|
|
942
|
+
if (icon) { args.icon = icon; }
|
|
943
|
+
}
|
|
944
|
+
if (widgetLowSignal.has(vid)) { args.low_signal = true; }
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
let guard = null;
|
|
948
|
+
if (sheetTargets.has(target) && args.action === 'default') {
|
|
949
|
+
args.action = 'tap';
|
|
950
|
+
args.via = 'bottom-sheet';
|
|
951
|
+
args.needs_trigger = true;
|
|
952
|
+
}
|
|
953
|
+
if (drawerTargets.has(target)) {
|
|
954
|
+
const grav = drawerTargets.get(target);
|
|
955
|
+
args.action = 'swipe';
|
|
956
|
+
args.gesture = 'open-drawer';
|
|
957
|
+
args.drawer_gravity = grav;
|
|
958
|
+
args.via = 'drawer-panel';
|
|
959
|
+
delete args.relation;
|
|
960
|
+
sdef(args, 'label', _DRAWER_LABEL);
|
|
961
|
+
if (drawerBlock) {
|
|
962
|
+
guard = { text: `requires ${drawerBlock} to be false (otherwise the drawer is locked closed or hidden)`,
|
|
963
|
+
kind: 'device-env', condition: drawerBlock, need: false };
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
for (const resolvedSrc of _srcIds(srcId, owner, hostResolver, innermostFnAt(fnRangesCached, pos))) {
|
|
967
|
+
if (resolvedSrc === `fragment:${target}`) { continue; }
|
|
968
|
+
const e = { source: resolvedSrc, target: `fragment:${target}`, mechanism: mech,
|
|
969
|
+
trigger: trig(pos), guard, args: { ...args },
|
|
970
|
+
provenance: 'static:homegraph', status: 'static-only', confidence: 0.8 };
|
|
971
|
+
if (srcId === _LAZY_NON_PAGE) { e.args.via_helper = owner; }
|
|
972
|
+
edges.push(e);
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
for (const m of _finditer(_TXN_RE, text)) { emit(m[2], 'fragment-transaction', m.index); }
|
|
977
|
+
for (const m of _finditer(_NEWINSTANCE_RE, text)) { emit(m[1], 'fragment-transaction', m.index); }
|
|
978
|
+
for (const m of _finditer(_SHOW_NEW_RE, text)) { emit(m[1], 'open-overlay', m.index, { modal: true }); }
|
|
979
|
+
const superSpans = _supertypeSpans(text);
|
|
980
|
+
for (const m of _finditer(_NEW_FRAG_RE, text)) {
|
|
981
|
+
emit(m[1], 'fragment-transaction', m.index, { via: 'instantiation' });
|
|
982
|
+
}
|
|
983
|
+
for (const m of _finditer(_KT_CTOR_FRAG_RE, text)) {
|
|
984
|
+
if (_inSupertypePosition(superSpans, m.index)) { continue; }
|
|
985
|
+
emit(m[1], 'fragment-transaction', m.index, { via: 'instantiation' });
|
|
986
|
+
}
|
|
987
|
+
const navSites = _finditer(_NAV_ID_RE, text).map((m) => [m.index, m[1], 'R.id']);
|
|
988
|
+
for (const m of _finditer(_NAV_DIR_RE, text)) {
|
|
989
|
+
const aid = _camelToSnake(m[2]);
|
|
990
|
+
if (navActions.has(aid) || navDests.has(aid)) { navSites.push([m.index, aid, 'safe-args']); }
|
|
991
|
+
else { _NAV_UNRESOLVED.push([owner, m[2]]); }
|
|
992
|
+
}
|
|
993
|
+
for (const [pos, actionId, how] of navSites) {
|
|
994
|
+
let dest = navActions.has(actionId) ? navActions.get(actionId) : null;
|
|
995
|
+
if (dest === null && navDests.has(actionId)) { dest = actionId; }
|
|
996
|
+
const targetCls = dest ? (navDests.get(dest) ?? null) : null;
|
|
997
|
+
let targetId; let mech; let prov; let conf;
|
|
998
|
+
if (targetCls && fragNames.has(targetCls)) {
|
|
999
|
+
targetId = `fragment:${targetCls}`;
|
|
1000
|
+
mech = dialogNames.has(targetCls) ? 'open-overlay' : 'nav-component-action';
|
|
1001
|
+
prov = 'static:homegraph'; conf = 0.8;
|
|
1002
|
+
} else {
|
|
1003
|
+
targetId = `nav-action:${actionId}`;
|
|
1004
|
+
mech = 'nav-component-action'; prov = 'static:llm'; conf = 0.5;
|
|
1005
|
+
}
|
|
1006
|
+
for (const navSrc of _srcIds(srcId, owner, hostResolver, innermostFnAt(fnRangesCached, pos))) {
|
|
1007
|
+
if (navSrc === targetId) { continue; }
|
|
1008
|
+
const navArgs = { action_id: actionId, via: how };
|
|
1009
|
+
if (srcId === _LAZY_NON_PAGE) { navArgs.via_helper = owner; }
|
|
1010
|
+
const vid = _triggerFor(spans, pos);
|
|
1011
|
+
if (vid !== null) {
|
|
1012
|
+
stampTriggerId(navArgs, vid, project);
|
|
1013
|
+
const lbl = widgetLabels.get(vid);
|
|
1014
|
+
if (lbl) { navArgs.label = lbl; }
|
|
1015
|
+
}
|
|
1016
|
+
edges.push({ source: navSrc, target: targetId, mechanism: mech, trigger: trig(pos),
|
|
1017
|
+
guard: null, args: navArgs, provenance: prov, status: 'static-only', confidence: conf });
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return edges;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/** [nodes, edges, stats] — stats.host_resolver is the HostResolver used. */
|
|
1025
|
+
export function buildRecords(project, pkg, strings, opts = {}) {
|
|
1026
|
+
void pkg;
|
|
1027
|
+
const sources = walkSources(project);
|
|
1028
|
+
const [frags] = buildFragmentSet(sources, project);
|
|
1029
|
+
const fragNames = new Set(frags.keys());
|
|
1030
|
+
const nodes = [];
|
|
1031
|
+
for (const [name, info] of frags) {
|
|
1032
|
+
const node = {
|
|
1033
|
+
id: `fragment:${name}`, kind: info.kind, label: name,
|
|
1034
|
+
declared_at: `${info.file}:${info.line}`,
|
|
1035
|
+
launch_hint: `fragment;base:${info.base}`,
|
|
1036
|
+
status: 'static-only', provenance: 'static:homegraph',
|
|
1037
|
+
};
|
|
1038
|
+
if (info.abstract) { node.abstract = true; }
|
|
1039
|
+
nodes.push(node);
|
|
1040
|
+
}
|
|
1041
|
+
const widgetIcons = new Map();
|
|
1042
|
+
const widgetLowSignal = new Set();
|
|
1043
|
+
const widgetLabels = buildWidgetLabels(project, strings, widgetIcons, widgetLowSignal);
|
|
1044
|
+
const dialogNames = new Set([...frags].filter(([, i]) => i.kind === 'dialog').map(([n]) => n));
|
|
1045
|
+
const drawerIds = _drawerContainerIds(project);
|
|
1046
|
+
const hostResolver = _makeHostResolver(sources, fragNames, project, opts.manifest ?? null);
|
|
1047
|
+
const navGraph = buildNavGraph(project);
|
|
1048
|
+
let edges = detectEdges(sources, project, fragNames, {
|
|
1049
|
+
widget_labels: widgetLabels, dialog_names: dialogNames, widget_icons: widgetIcons,
|
|
1050
|
+
widget_low_signal: widgetLowSignal, drawer_ids: drawerIds, host_resolver: hostResolver,
|
|
1051
|
+
nav_graph: navGraph, sheet_ids: _bottomSheetContainerIds(project),
|
|
1052
|
+
});
|
|
1053
|
+
edges = edges.concat(detectLayoutEdges(sources, project, fragNames, dialogNames));
|
|
1054
|
+
const best = new Map();
|
|
1055
|
+
for (let e of edges) {
|
|
1056
|
+
const key = tupleKey(e.source, e.target, e.mechanism);
|
|
1057
|
+
let cur = best.get(key);
|
|
1058
|
+
if (cur === undefined) { best.set(key, e); continue; }
|
|
1059
|
+
const curHas = !!(cur.args || {}).label;
|
|
1060
|
+
const newHas = !!(e.args || {}).label;
|
|
1061
|
+
if (newHas && !curHas) {
|
|
1062
|
+
best.set(key, e);
|
|
1063
|
+
[cur, e] = [e, cur];
|
|
1064
|
+
}
|
|
1065
|
+
const winner = best.get(key);
|
|
1066
|
+
if (!winner.guard && e.guard) { winner.guard = e.guard; }
|
|
1067
|
+
if (!Object.hasOwn(winner, 'args')) { winner.args = {}; }
|
|
1068
|
+
const wArgs = winner.args;
|
|
1069
|
+
for (const k of ['container_id', 'label', 'trigger_id', 'commit_scope']) {
|
|
1070
|
+
const v = (e.args || {})[k];
|
|
1071
|
+
if (v !== null && v !== undefined && (wArgs[k] === null || wArgs[k] === undefined)) { wArgs[k] = v; }
|
|
1072
|
+
}
|
|
1073
|
+
const eVia = (e.args || {}).via;
|
|
1074
|
+
if (eVia && eVia !== wArgs.via) {
|
|
1075
|
+
if (!Object.hasOwn(wArgs, 'also_via')) { wArgs.also_via = []; }
|
|
1076
|
+
if (!wArgs.also_via.includes(eVia)) { wArgs.also_via.push(eVia); }
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
edges = [...best.values()];
|
|
1080
|
+
return [nodes, edges, {
|
|
1081
|
+
fragments: frags.size,
|
|
1082
|
+
dialog_fragments: [...frags.values()].filter((f) => f.kind === 'dialog').length,
|
|
1083
|
+
edges: edges.length,
|
|
1084
|
+
host_summary: hostResolver.summary(),
|
|
1085
|
+
host_resolver: hostResolver,
|
|
1086
|
+
}];
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
const dumpLine = (o) => jsonDumps(o, { ensure_ascii: false });
|
|
1090
|
+
|
|
1091
|
+
export function main(argv = process.argv.slice(2)) {
|
|
1092
|
+
const ap = new ArgumentParser({ prog: 'fragment_nav.mjs' });
|
|
1093
|
+
ap.add_argument('project');
|
|
1094
|
+
ap.add_argument('--package', { default: null });
|
|
1095
|
+
ap.add_argument('--workspace', { default: null });
|
|
1096
|
+
ap.add_argument('--append', { action: 'store_true' });
|
|
1097
|
+
const args = ap.parse_args(argv);
|
|
1098
|
+
|
|
1099
|
+
const strings = loadProjectStrings(args.project);
|
|
1100
|
+
const [nodes, edges, stats] = buildRecords(args.project, args.package, strings,
|
|
1101
|
+
{ manifest: manifestActivityNames(args.workspace) });
|
|
1102
|
+
if (args.append && args.workspace) {
|
|
1103
|
+
appendText(_osJoin(args.workspace, 'nodes.jsonl'), nodes.map((n) => dumpLine(n) + '\n').join(''));
|
|
1104
|
+
appendText(_osJoin(args.workspace, 'edges.jsonl'), edges.map((e) => dumpLine(e) + '\n').join(''));
|
|
1105
|
+
pyPrintErr(`appended ${nodes.length} nodes, ${edges.length} edges -> ${args.workspace}`);
|
|
1106
|
+
} else {
|
|
1107
|
+
for (const n of nodes) { pyPrintBuf(dumpLine({ type: 'node', ...n })); }
|
|
1108
|
+
for (const e of edges) { pyPrintBuf(dumpLine({ type: 'edge', ...e })); }
|
|
1109
|
+
}
|
|
1110
|
+
const A = (e) => e.args || {};
|
|
1111
|
+
const auto = edges.filter((e) => A(e).via === 'auto-load').length;
|
|
1112
|
+
const click = edges.filter((e) => A(e).trigger_id || A(e).trigger_receiver).length;
|
|
1113
|
+
const drawer = edges.filter((e) => A(e).via === 'drawer-panel');
|
|
1114
|
+
const dispatched = edges.filter((e) => A(e).via === 'dispatched').length;
|
|
1115
|
+
const lay = edges.filter((e) => A(e).via === 'layout-inflate').length;
|
|
1116
|
+
const layRegion = edges.filter((e) => A(e).via === 'layout-inflate-region').length;
|
|
1117
|
+
const layGuarded = edges.filter((e) => String(A(e).via ?? '').startsWith('layout-inflate') && e.guard).length;
|
|
1118
|
+
const unknownScope = edges.filter((e) => A(e).commit_scope === 'no-enclosing-fn').length;
|
|
1119
|
+
pyPrintErr(`[fragment_nav] fragments=${stats.fragments} ` +
|
|
1120
|
+
`dialog_fragments=${stats.dialog_fragments} edges=${stats.edges} ` +
|
|
1121
|
+
`auto_load=${auto} click_triggered=${click} ` +
|
|
1122
|
+
`dispatched=${dispatched} unknown_scope=${unknownScope} ` +
|
|
1123
|
+
`layout_inflate=${lay} layout_region=${layRegion} ` +
|
|
1124
|
+
`layout_guarded=${layGuarded} ` +
|
|
1125
|
+
`drawer_panel=${drawer.length} ` +
|
|
1126
|
+
`drawer_guarded=${drawer.filter((e) => e.guard).length} ` +
|
|
1127
|
+
`${stats.host_summary ?? ''}`);
|
|
1128
|
+
if (_NAV_UNRESOLVED.length) {
|
|
1129
|
+
const uniq = new Map(_NAV_UNRESOLVED.map((t) => [tupleKey(...t), t]));
|
|
1130
|
+
pyPrintErr('# `navigate(actionX())` whose action id is in NO nav graph — ' +
|
|
1131
|
+
'not Safe Args, so no edge emitted: ' +
|
|
1132
|
+
`[${sortedBy([...uniq.values()]).map(reprTuple).join(', ')}]`);
|
|
1133
|
+
}
|
|
1134
|
+
if (stats.host_resolver) { stats.host_resolver.report(process.stderr); }
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { main(); }
|