@buaa_smat/hometrans 26.0.2 → 26.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/agents/code-reviewer.md +111 -154
- package/dist/cli/index.js +4 -1
- package/dist/cli/init.js +131 -26
- package/dist/cli/uninstall.js +5 -5
- package/dist/platform/language.js +77 -0
- package/env-requirements.json +30 -5
- package/i18n/FILE-NAMES.md +9 -0
- package/i18n/agents/code-reviewer.md +436 -0
- package/i18n/agents/model-render-worker.md +38 -0
- package/i18n/agents/specgen-worker.md +18 -0
- package/i18n/commands/hometrans.md +17 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +206 -0
- package/i18n/skills/a2h-app-migrate/references/config.example.json +28 -0
- package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +19 -0
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +50 -0
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +2007 -0
- package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +187 -0
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1656 -0
- package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +728 -0
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +541 -0
- package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +143 -0
- package/i18n/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
- package/i18n/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/i18n/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
- package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +713 -0
- package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +117 -0
- package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/i18n/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +271 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +222 -0
- package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +136 -0
- package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +552 -0
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +263 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +165 -0
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/i18n/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/i18n/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +207 -0
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/i18n/skills/a2h-arch-generate/SKILL.md +378 -0
- package/i18n/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
- package/i18n/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
- package/i18n/skills/a2h-arch-generate/references/arkts-mvvm-v2.md +1407 -0
- package/i18n/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
- package/i18n/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
- package/i18n/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
- package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
- package/i18n/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
- package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
- package/i18n/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
- package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +131 -0
- package/i18n/skills/a2h-arch-generate/references/source-baseline.md +93 -0
- package/i18n/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +360 -0
- package/i18n/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +798 -0
- package/i18n/skills/a2h-arch-generate/scripts/lib/contract_terms.mjs +40 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/generate.mjs +639 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1261 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
- package/i18n/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +851 -0
- package/i18n/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +982 -0
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +304 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +10 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +249 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +344 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/design/move_spec_technical_reference.mjs +162 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +298 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +877 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +597 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +372 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +35 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +85 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +23 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +89 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +62 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +30 -0
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +930 -0
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +420 -0
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +158 -0
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2552 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +560 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +175 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +251 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +28 -0
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +232 -0
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +206 -0
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +232 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +2005 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +2118 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1805 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1959 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/image_probe.mjs +405 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1632 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1300 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1234 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +417 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +18 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +216 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +615 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +49 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +136 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +780 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +408 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +179 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +81 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +137 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +147 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +127 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +184 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +67 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +651 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +693 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +326 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +356 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +395 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +470 -0
- package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +62 -0
- package/i18n/skills/a2h-dashboard-render/SKILL.md +73 -0
- package/i18n/skills/a2h-dashboard-render/references/artifact-contract.jsonc +117 -0
- package/i18n/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
- package/i18n/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
- package/i18n/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
- package/i18n/skills/a2h-dashboard-render/scripts/dashboard.mjs +3245 -0
- package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +2050 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/i18n/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +154 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/i18n/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/i18n/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
- package/i18n/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/i18n/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
- package/i18n/skills/a2h-fix-build-errors/SKILL.md +304 -0
- package/i18n/skills/a2h-fix-build-errors/references/arkts-strict-patterns.md +219 -0
- package/i18n/skills/a2h-fix-build-errors/references/rdb-entity-pattern.md +131 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +265 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/i18n/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/i18n/skills/a2h-page-specgen/SKILL.md +239 -0
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
- package/i18n/skills/a2h-page-specgen/references/body-language.md +179 -0
- package/i18n/skills/a2h-page-specgen/references/gates.md +329 -0
- package/i18n/skills/a2h-page-specgen/references/page-inventory.md +220 -0
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +210 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +1613 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +1650 -0
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +864 -0
- package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +346 -0
- package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +155 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +684 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +252 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +864 -0
- package/i18n/skills/a2h-page-specgen/scripts/render.mjs +276 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +897 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +205 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1205 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +271 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +8 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +7 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +8 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +1029 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +143 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +1121 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +188 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +549 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +368 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +348 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +250 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +776 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1103 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +240 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +427 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +418 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1782 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +536 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +1239 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1801 -0
- package/i18n/skills/a2h-resource-convert/SKILL.md +375 -0
- package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +336 -0
- package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +272 -0
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +226 -0
- package/i18n/skills/a2h-resource-convert/references/resource-mapping-rules.md +493 -0
- package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +251 -0
- package/i18n/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +2596 -0
- package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +238 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +358 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +266 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +55 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +752 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +661 -0
- package/i18n/skills/a2h-spec-generate/SKILL.md +375 -0
- package/i18n/skills/a2h-spec-generate/references/batch-mode.md +215 -0
- package/i18n/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
- package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +184 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +27 -0
- package/i18n/skills/a2h-spec-generate/references/library-evidence.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/method-discipline.md +64 -0
- package/i18n/skills/a2h-spec-generate/references/optional-gates.json +45 -0
- package/i18n/skills/a2h-spec-generate/references/recall-guide.md +84 -0
- package/i18n/skills/a2h-spec-generate/references/recall-terse.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
- package/i18n/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
- package/i18n/skills/a2h-spec-generate/references/review-checklist.md +22 -0
- package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
- package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
- package/i18n/skills/a2h-spec-generate/references/spec-samples.md +65 -0
- package/i18n/skills/a2h-spec-generate/references/specs.schema.json +85 -0
- package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +145 -0
- package/i18n/skills/a2h-spec-generate/references/transfer-file.md +5 -0
- package/i18n/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
- package/i18n/skills/a2h-spec-generate/references/worker-rules.md +129 -0
- package/i18n/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +702 -0
- package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +515 -0
- package/i18n/skills/a2h-spec-generate/scripts/collect-specs.mjs +727 -0
- package/i18n/skills/a2h-spec-generate/scripts/feature-stem.mjs +151 -0
- package/i18n/skills/a2h-spec-generate/scripts/parse_requirements.ts +515 -0
- package/i18n/skills/a2h-spec-generate/scripts/prepare-facts.mjs +313 -0
- package/i18n/skills/a2h-spec-generate/scripts/publish-specs.mjs +354 -0
- package/i18n/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +669 -0
- package/i18n/skills/a2h-spec-generate/scripts/render-tasks.mjs +385 -0
- package/i18n/skills/a2h-spec-generate/scripts/report.mjs +136 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1265 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1057 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +565 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +544 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +317 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +707 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +436 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +608 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +650 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +178 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +912 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +279 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +163 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +256 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +340 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1857 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +262 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +722 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/i18n/skills/a2h-spec-generate/template/REQ.txt +22 -0
- package/i18n/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
- package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +847 -0
- package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +415 -0
- package/i18n/skills/a2h-spec-generate/test/collect-specs.test.mjs +808 -0
- package/i18n/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/i18n/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/i18n/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
- package/i18n/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
- package/i18n/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
- package/i18n/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
- package/i18n/skills/a2h-spec-generate/test/report.test.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/SKILL.md +126 -0
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +282 -0
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +908 -0
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +446 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hint_check.mjs +147 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hint_source.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_b.mjs +550 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +647 -0
- package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +252 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +614 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +214 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1562 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +2714 -0
- package/i18n/skills/a2h-utg-static/SKILL.md +372 -0
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
- package/i18n/skills/a2h-utg-static/references/view-interactions.md +215 -0
- package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +2190 -0
- package/i18n/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +720 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +250 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +374 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
- package/i18n/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/i18n/skills/a2h-utg-static/scripts/fragment_nav.mjs +1137 -0
- package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +705 -0
- package/i18n/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +958 -0
- package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +545 -0
- package/i18n/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
- package/i18n/skills/a2h-utg-static/scripts/static_prior.mjs +956 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +125 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +289 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_fresh_branch_guard.mjs +49 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +136 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +457 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +368 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +78 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_off_path.mjs +67 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +61 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_data_table.mjs +340 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_relative_url.mjs +125 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +330 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +340 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1394 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
- package/package.json +11 -161
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
- package/skills/a2h-app-migrate/SKILL.md +31 -12
- package/skills/a2h-app-migrate/references/config.example.json +1 -0
- package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +427 -103
- package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -6
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
- package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +178 -44
- package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +81 -11
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +80 -10
- package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +72 -12
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +137 -41
- package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
- package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
- package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +2 -0
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +38 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +143 -0
- package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
- package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
- package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/skills/a2h-app-migrate/test/test_devecocli_docs_preflight.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +102 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +713 -0
- package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +117 -0
- package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +51 -0
- package/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
- package/skills/a2h-app-migrate/test/test_incremental_acceptance.mjs +145 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
- package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +101 -0
- package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +150 -0
- package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +86 -0
- package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
- package/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +271 -0
- package/skills/a2h-app-migrate/test/test_resume_summary.mjs +222 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +136 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +552 -0
- package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -0
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_acceptance.mjs +94 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +155 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +263 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +165 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +511 -0
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +65 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +83 -0
- package/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
- package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +41 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +214 -0
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/skills/a2h-arch-generate/SKILL.md +20 -17
- package/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
- package/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +25 -14
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +2 -2
- package/skills/a2h-arch-generate/references/source-baseline.md +4 -4
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
- package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +35 -46
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +33 -40
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +2 -3
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1260 -0
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +208 -0
- package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
- package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
- package/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +164 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +2 -5
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +163 -15
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +3 -1
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +120 -1
- package/skills/a2h-arkts-logic-coder/references/spec-design.md +46 -11
- package/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +22 -25
- package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +873 -0
- package/skills/a2h-arkts-logic-coder/test/golden/inspect_happy.json +20 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
- package/skills/a2h-arkts-logic-coder/test/golden/resolve_cases.json +36 -0
- package/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
- package/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
- package/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
- package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +596 -0
- package/skills/a2h-batch-ui-align/SKILL.md +78 -26
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +6 -1
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
- package/skills/a2h-batch-ui-align/references/cards/resources.md +9 -3
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +27 -3
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
- package/skills/a2h-batch-ui-align/references/checker-rules.md +301 -13
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +53 -13
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +14 -9
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +2 -2
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
- package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +30 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +7 -2
- package/skills/a2h-batch-ui-align/references/step5-convert.md +33 -9
- package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +6 -7
- package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +463 -22
- package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
- package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
- package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
- package/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +263 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +20 -3
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +4 -5
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +220 -35
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +517 -41
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +231 -54
- package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +239 -14
- package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +98 -11
- package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +118 -4
- package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
- package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +1 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +61 -12
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +32 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +3 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +84 -19
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +11 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +5 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +110 -12
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +179 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +81 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +184 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +2 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +30 -2
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +231 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +312 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_baseline.test.mjs +129 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +312 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_runtime2.test.mjs +697 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +651 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +269 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +346 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_safearea.test.mjs +742 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +91 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +86 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme_runtime.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
- package/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +693 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +291 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +93 -0
- package/skills/a2h-batch-ui-align/scripts/tests/detect_paradigm.test.mjs +260 -0
- package/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +244 -0
- package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +435 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +31 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -0
- package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack_evidence.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1782 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
- package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/icon_coverage.test.mjs +314 -0
- package/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
- package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +326 -0
- package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +356 -0
- package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +302 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
- package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +60 -0
- package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +395 -0
- package/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
- package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +12 -14
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +29 -30
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
- package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +203 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
- package/skills/a2h-dashboard-render/test/test_device_locale_dialogs.mjs +17 -0
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
- package/skills/a2h-module-semantic-docs/SKILL.md +51 -13
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
- package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/skills/a2h-module-semantic-docs/test/test_incremental_fingerprint.mjs +94 -0
- package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/skills/a2h-page-specgen/SKILL.md +240 -0
- package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
- package/skills/a2h-page-specgen/references/body-language.md +179 -0
- package/skills/a2h-page-specgen/references/evidence.md +105 -0
- package/skills/a2h-page-specgen/references/execution-model.md +364 -0
- package/skills/a2h-page-specgen/references/footprint-and-grouping.md +255 -0
- package/skills/a2h-page-specgen/references/gates.md +323 -0
- package/skills/a2h-page-specgen/references/page-inventory.md +220 -0
- package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
- package/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/skills/a2h-page-specgen/references/spec-template.md +210 -0
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/skills/a2h-page-specgen/scripts/dispatch.mjs +212 -0
- package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/skills/a2h-page-specgen/scripts/facts-build.mjs +1613 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +825 -0
- package/skills/a2h-page-specgen/scripts/footprint.mjs +1650 -0
- package/skills/a2h-page-specgen/scripts/gate.mjs +848 -0
- package/skills/a2h-page-specgen/scripts/interactions.mjs +344 -0
- package/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +155 -0
- package/skills/a2h-page-specgen/scripts/lib/deps-source.mjs +399 -0
- package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +229 -0
- package/skills/a2h-page-specgen/scripts/lib/footprint-roles.mjs +278 -0
- package/skills/a2h-page-specgen/scripts/lib/fsx.mjs +79 -0
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +683 -0
- package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +478 -0
- package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/skills/a2h-page-specgen/scripts/lib/prose.mjs +238 -0
- package/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
- package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
- package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
- package/skills/a2h-page-specgen/scripts/lib/symbols.mjs +125 -0
- package/skills/a2h-page-specgen/scripts/lib/utg-io.mjs +110 -0
- package/skills/a2h-page-specgen/scripts/lib/waker-event-store.mjs +658 -0
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/skills/a2h-page-specgen/scripts/prepare.mjs +840 -0
- package/skills/a2h-page-specgen/scripts/render.mjs +294 -0
- package/skills/a2h-page-specgen/scripts/report.mjs +340 -0
- package/skills/a2h-page-specgen/scripts/submission.mjs +697 -0
- package/skills/a2h-page-specgen/scripts/submit.mjs +85 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/README.md +77 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +871 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/cases.example.json +57 -0
- package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +205 -0
- package/skills/a2h-page-specgen/scripts/test/dispatch.test.mjs +258 -0
- package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1203 -0
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +243 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Api.kt +20 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/BothAnnotations.kt +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Cache.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Comments.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Mmkv.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Models.kt +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Pair.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Prefs.kt +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Room.kt +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Sample.kt +43 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Templates.kt +34 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Timeouts.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/androidTest/Helper.kt +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/build.gradle.kts +16 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/en.js.txt +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/libs.versions.toml +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/package.json +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values/strings.xml +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-land/strings.xml +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-night/strings.xml +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-v21/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/test/Legacy.kt +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/weather.proto +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/AppPreferences.kt +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/SettingsViewModel.kt +16 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-dao/src/UserDao.kt +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/base/strings.xml +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/fil/strings.xml +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/arrays.xml +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/strings.xml +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/xml/prefs.xml +27 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Api.java +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Datastore.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Settings.java +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/forecast.js +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/store.js +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/BasePreferences.kt +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/Screen.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/UiPreferences.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-retrofit/src/AuthAPI.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/AndroidManifest.xml +20 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/feature/auth/navigation/ScreenRoute.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/pages.json +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/components/Widget.vue +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/detail/detail.vue +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/index/index.vue +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/store/userStore.js +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/uni_modules/uview-ui/components/u-thing.js +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp.mkdb.mjs +144 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +112 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/MainFragment.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyListeners.java +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/PlainActivity.java +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshOnResume.java +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/fold-chain/utg.json +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/utg.json +34 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +1029 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-roles.test.mjs +172 -0
- package/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +143 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +1078 -0
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/skills/a2h-page-specgen/scripts/test/helpers.mjs +188 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +549 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +368 -0
- package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +310 -0
- package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +250 -0
- package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +776 -0
- package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +464 -0
- package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1103 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +160 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +236 -0
- package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +398 -0
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
- package/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +418 -0
- package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1782 -0
- package/skills/a2h-page-specgen/scripts/test/render.test.mjs +546 -0
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
- package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
- package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/skills/a2h-page-specgen/scripts/test/source-text.test.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +1231 -0
- package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
- package/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
- package/skills/a2h-page-specgen/scripts/test/waker-event-store.test.mjs +1365 -0
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1801 -0
- package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +1993 -0
- package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +342 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +1301 -0
- package/skills/a2h-page-specgen/scripts/watchdog.mjs +299 -0
- package/skills/a2h-resource-convert/SKILL.md +9 -1
- package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +115 -53
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
- package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
- package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
- package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
- package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
- package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
- package/skills/a2h-resource-convert/scripts/tests/code_vector_guard.test.mjs +75 -0
- package/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
- package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +98 -121
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +170 -45
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +62 -12
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -4
- package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +49 -6
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +198 -54
- package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +67 -0
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +47 -14
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +390 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +148 -29
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +104 -24
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +18 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +16 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/platform/ExtraDataSubCheck.js +485 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +13 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +18 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +12 -38
- package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +95 -7
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +156 -7
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +71 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +22 -3
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +33 -3
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +2 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +232 -13
- package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
- package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +220 -44
- package/skills/a2h-spec-design-pipeline/scripts/lib/shared_classes.ts +113 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/shared_docs.ts +202 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/wiring.ts +58 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +178 -14
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +3 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +368 -0
- package/skills/a2h-spec-design-pipeline/scripts/scan_shared.ts +642 -0
- package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +42 -8
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +27 -9
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +242 -9
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +192 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +531 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +49 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +51 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +17 -10
- package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +14 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +401 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_scan_shared.ts +996 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_classes.ts +80 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_docs.ts +205 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +165 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_e2e.ts +85 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_validate_shared_manifest.ts +720 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_wiring.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/validate_shared_manifest.ts +566 -0
- package/skills/a2h-spec-generate/SKILL.md +89 -23
- package/skills/a2h-spec-generate/references/batch-mode.md +78 -17
- package/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +7 -0
- package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
- package/skills/a2h-spec-generate/references/specs.schema.json +24 -11
- package/skills/a2h-spec-generate/references/synthesis-rules.md +4 -2
- package/skills/a2h-spec-generate/references/worker-rules.md +6 -3
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +4 -5
- package/skills/a2h-spec-generate/scripts/check_spec.ts +145 -14
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +261 -19
- package/skills/a2h-spec-generate/scripts/dispatch-watch.mjs +1168 -0
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +25 -46
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +26 -27
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +3 -6
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +31 -32
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +2 -3
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +15 -26
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +102 -81
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +39 -19
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +12 -13
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +35 -196
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +3 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +22 -96
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +3 -4
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +1 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +74 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +51 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +42 -111
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +1 -20
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1 -2
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +3 -4
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/zip.ts +63 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +650 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-seed.test.ts +195 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +347 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1948 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-library-evidence.test.ts +239 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +277 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +844 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/zip.test.ts +61 -0
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +879 -0
- package/skills/a2h-spec-generate/test/check-spec.test.ts +430 -0
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +811 -0
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
- package/skills/a2h-spec-generate/test/dispatch-watch.test.mjs +606 -0
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +229 -0
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
- package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
- package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
- package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
- package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +182 -0
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
- package/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
- package/skills/a2h-spec-generate/test/report.test.mjs +47 -0
- package/skills/a2h-utg-explorer/SKILL.md +9 -3
- package/skills/a2h-utg-explorer/references/architecture.md +7 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +120 -85
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +1 -2
- package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +5 -3
- package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
- package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +244 -0
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
- package/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +231 -0
- package/skills/a2h-utg-explorer/scripts/tests/default_override.test.mjs +109 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +160 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_identity.test.mjs +77 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +254 -0
- package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +137 -0
- package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
- package/skills/a2h-utg-explorer/scripts/tests/foreground_spelling.test.mjs +155 -0
- package/skills/a2h-utg-explorer/scripts/tests/fresh_state_plan.test.mjs +78 -0
- package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
- package/skills/a2h-utg-explorer/scripts/tests/holds_without_data_parity.test.mjs +26 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +120 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +614 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +214 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_failure.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
- package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
- package/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +218 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d_grounding.test.mjs +164 -0
- package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
- package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +458 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -0
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +336 -0
- package/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +142 -0
- package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
- package/skills/a2h-utg-explorer/scripts/tests/string_tables_twin_ties.test.mjs +83 -0
- package/skills/a2h-utg-explorer/scripts/tests/tar_fixture.mjs +12 -0
- package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
- package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
- package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +135 -7
- package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +245 -69
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +164 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
- package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
- package/skills/a2h-utg-static/SKILL.md +6 -2
- package/skills/a2h-utg-static/scripts/assemble.mjs +93 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +135 -25
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +110 -3
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
- package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +2 -3
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
- package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +34 -7
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +1 -2
- package/skills/a2h-utg-static/scripts/route_interceptor.mjs +21 -7
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +86 -4
- package/skills/a2h-utg-static/scripts/static_prior.mjs +26 -29
- package/skills/a2h-utg-static/scripts/tests/test_activity_gates.mjs +84 -0
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
- package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
- package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +29 -1
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -1
- package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-app-migrate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-arch-generate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +0 -5
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +0 -54
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +0 -38
- package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-resource-convert/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +0 -885
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +0 -856
- package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +0 -70
- package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-generate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +0 -54
- package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-utg-static/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-utg-static/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-utg-static/scripts/tests/test_i18n_term.mjs +0 -155
|
@@ -0,0 +1,2190 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* assemble.mjs — port of assemble.py: merge nodes.jsonl + edges.jsonl into the UTG deliverables.
|
|
4
|
+
*
|
|
5
|
+
* assemble.mjs <workspace> [--project P]
|
|
6
|
+
*
|
|
7
|
+
* Writes utg.json (node-link MultiDiGraph), utg.mermaid, utg.graphml.
|
|
8
|
+
*
|
|
9
|
+
* Exports:
|
|
10
|
+
* HERE _LOGIN_TEST_RE _FUN_DECL_RE load sid _SOURCE_CALLSITE _compressSourcePath slug _GUARD_KINDS
|
|
11
|
+
* normalizeGuard _inferGuardKind _INSTANCE_ROUTE_SUFFIXES _PAY_ROUTE_TOKENS _ENV_ROUTE_TOKENS
|
|
12
|
+
* _LOGIN_ROUTE_TOKENS _AUTH_ENTRY_ROUTE_TOKENS _isAuthEntryRoute _identWords _hasToken _cjk _CODE_NAME_TAIL_A _isCodeName _isScreenText
|
|
13
|
+
* _buildFnDeclarationIndex(-> Map name -> [path, offset]) _TOOLBAR_TAG_RE _XML_TITLE_ATTR_RE
|
|
14
|
+
* _XML_TEXT_ATTR_RE _STRING_REF_RE_A _resolveXmlString _findLayoutFiles(-> Map) _layoutTitle
|
|
15
|
+
* _viewOwnTitle _BARE_LAYOUT_TAGS _LAYOUT_HOST_TAGS _XML_TAG_RE _isBareContainerLayout
|
|
16
|
+
* _nodeLayoutPaths _TRANSPARENT_WRAPPERS _CONTAINER_COMPOSABLES _OWN_CHROME_RE _SET_CONTENT_RE
|
|
17
|
+
* _balancedBlock _sourceIndex _statementCalls _isBareComposeHost _isLauncherShell _foldUilessHosts
|
|
18
|
+
* _TIME_CALL_RE _TIME_CMP_RE _IF_HEAD _extractBalanced _pagerPositionZero DEFENSIVE_FILTER(get/set
|
|
19
|
+
* via setDefensiveFilter) _RANGES_CACHE _defensive _INTENT_TEST_RE _BUILD_CALL_RE _CONTENT_TEST_RE
|
|
20
|
+
* _enclosingFunName _FN_HEAD_RE _LEAVES_RE _fnBodyStart _fnDeclPos _fnBodyEnd _negateCond
|
|
21
|
+
* _earlyReturnConditions _enclosingIfConditions _CALLER_SCAN_MAX_FILES _CALLER_AGREE_MAX
|
|
22
|
+
* _KT_SRC_RE _CALLER_CACHE _projectSources _crossFileGate _disabledExpr _branchGuard _ROLE_KINDS
|
|
23
|
+
* _DECL_RE_TMPL _markOutOfScope _GETTER_CALL_RE _PREF_READ_RE _resolveAppSetting
|
|
24
|
+
* _promoteAppSettings mergeNodeRecords enrichNodesAndEdges _backfillFrameworkLabels
|
|
25
|
+
* _loadBaseStrings _stampLabelVariants _MENTION_TRIGGER_PREFIXES lintEdgeProvenance _parseArgs main
|
|
26
|
+
*
|
|
27
|
+
* Node/edge records are plain objects (Python dicts, insertion order kept via dset/keysOf).
|
|
28
|
+
* `nodes` passed between helpers is an object {id: node} (Python dict). `file_text_cache` is a
|
|
29
|
+
* Map (path -> text, plus the '__project__' / '__src__' sentinels). Text offsets are JS UTF-16
|
|
30
|
+
* internally; none are written to files.
|
|
31
|
+
*/
|
|
32
|
+
import * as fs from 'node:fs';
|
|
33
|
+
import * as path from 'node:path';
|
|
34
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
35
|
+
import {
|
|
36
|
+
pyRe, reSearch, reMatch, reFindall, reSub, reEscape, reFullmatch, jsonLoads, jsonDumps, get, dset, keysOf,
|
|
37
|
+
truthy, pyStrip, pyRstrip, pyRsplit, pySplit, cpLen, cpSlice, md5Hex, pyPrintErr, pyPrintBuf, pyPrint, sortedBy,
|
|
38
|
+
sortedStr, pyCmp, pyEq, pyIn, pyStr, pyRepr, counter, tupleKey, readText, writeText, splitlines,
|
|
39
|
+
pyStrSetOrder, pySetIter, deepCopy, isFloat, PyFloat, asFloat, floatRepr, time, IS_WIN, SP, W, WC, osRelpath,
|
|
40
|
+
} from './_py.mjs';
|
|
41
|
+
import { readTextSmart } from './io_utils.mjs';
|
|
42
|
+
import { decodeAndroidString, loadProjectStrings, pageOwnTitle } from './label_resolve.mjs';
|
|
43
|
+
import { allLayoutNames, declaresOwnLayout, _osWalk } from './layout_resolve.mjs';
|
|
44
|
+
import { fnRanges } from './scope_utils.mjs';
|
|
45
|
+
import { isDefensive } from './guard_subjects.mjs';
|
|
46
|
+
import { parse as parseExtras } from './launch_extras.mjs';
|
|
47
|
+
import { ActivityChain, HostResolver, buildClassIndex } from './host_resolve.mjs';
|
|
48
|
+
import { walkSources, manifestActivityNames } from './fragment_nav.mjs';
|
|
49
|
+
import { findLoginInterceptor, applyLoginInterceptor, loginPolarity, routeResolver } from './route_interceptor.mjs';
|
|
50
|
+
import {
|
|
51
|
+
assembleHybridRecords,
|
|
52
|
+
mergeHybridNodeRecords,
|
|
53
|
+
} from './lib/hybrid-provenance.mjs';
|
|
54
|
+
|
|
55
|
+
export { assembleHybridRecords };
|
|
56
|
+
|
|
57
|
+
export const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
58
|
+
const SEP = IS_WIN ? '\\' : '/';
|
|
59
|
+
/** os.path.join(a, b) for a single relative segment. */
|
|
60
|
+
const osJoin = (a, b) => (a.endsWith('/') || a.endsWith(SEP) || a === '' ? a + b : a + SEP + b);
|
|
61
|
+
const osExists = (p) => { try { fs.statSync(p); return true; } catch { return false; } };
|
|
62
|
+
const osIsDir = (p) => { try { return fs.statSync(p).isDirectory(); } catch { return false; } };
|
|
63
|
+
const isObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v) && !(v instanceof Map) && !(v instanceof Set);
|
|
64
|
+
/** isinstance(v, int) (bool counts, like Python). */
|
|
65
|
+
const isInt = (v) => typeof v === 'boolean' || typeof v === 'bigint' || (typeof v === 'number' && Number.isInteger(v) && !(v instanceof PyFloat));
|
|
66
|
+
/** str.isalnum() for one character. */
|
|
67
|
+
const isAlnumCh = (c) => /^[\p{L}\p{N}]$/u.test(c);
|
|
68
|
+
/** str.isupper() for one character. */
|
|
69
|
+
const isUpperCh = (c) => /^\p{Lu}$/u.test(c);
|
|
70
|
+
/** str.isupper() for a string: has a cased char and all cased chars upper. */
|
|
71
|
+
const strIsUpper = (s) => s !== s.toLowerCase() && s === s.toUpperCase();
|
|
72
|
+
/** Advance `n` code points from UTF-16 offset `pos` (Python text[pos:pos+n]). */
|
|
73
|
+
export function _cpFwd(text, pos, n) {
|
|
74
|
+
let i = pos; let k = 0;
|
|
75
|
+
while (i < text.length && k < n) { const c = text.charCodeAt(i); i += (c >= 0xd800 && c < 0xdc00 && i + 1 < text.length) ? 2 : 1; k++; }
|
|
76
|
+
return i;
|
|
77
|
+
}
|
|
78
|
+
/** Step back `n` code points from UTF-16 offset `pos` (max(0, pos-n) in Python). */
|
|
79
|
+
export function _cpBack(text, pos, n) {
|
|
80
|
+
let i = pos; let k = 0;
|
|
81
|
+
while (i > 0 && k < n) { const c = text.charCodeAt(i - 1); i -= (c >= 0xdc00 && c < 0xe000 && i - 2 >= 0) ? 2 : 1; k++; }
|
|
82
|
+
return i;
|
|
83
|
+
}
|
|
84
|
+
/** All matches of a global RegExp (finditer). */
|
|
85
|
+
function* finditer(re, s, pos = 0) {
|
|
86
|
+
const g = new RegExp(re.source, re.flags.includes('g') ? re.flags : re.flags + 'g');
|
|
87
|
+
g.lastIndex = pos; let m;
|
|
88
|
+
while ((m = g.exec(s)) !== null) { yield m; if (m[0] === '') { g.lastIndex++; } }
|
|
89
|
+
}
|
|
90
|
+
/** int(s) for a str (whitespace, sign, underscores), or null on ValueError. */
|
|
91
|
+
function pyIntOrNull(s) {
|
|
92
|
+
const t = pyStrip(String(s));
|
|
93
|
+
if (!/^[+-]?\d+(?:_\d+)*$/u.test(t)) { return null; }
|
|
94
|
+
return Number(t.replace(/_/g, ''));
|
|
95
|
+
}
|
|
96
|
+
/** os.path.isabs (CPython 3.13 on Windows: needs drive+root or UNC). */
|
|
97
|
+
export function pIsAbs(p) {
|
|
98
|
+
if (!IS_WIN) { return p.startsWith('/'); }
|
|
99
|
+
return /^[A-Za-z]:[\\/]/.test(p) || /^[\\/]{2}[^\\/]/.test(p);
|
|
100
|
+
}
|
|
101
|
+
const SKIP_WALK = ['build', '.git', 'test', 'androidTest'];
|
|
102
|
+
|
|
103
|
+
export const _LOGIN_TEST_RE = pyRe(
|
|
104
|
+
String.raw`\b(?:is|has|get|check)\w*(?:Login|LoggedIn|SignedIn|Session|Token|` +
|
|
105
|
+
String.raw`Account|Auth)\w*\s*\(|` +
|
|
106
|
+
String.raw`\b\w*(?:login|loggedIn|signedIn)\w*\s*(?:!=|==|<|>)\s*\w+|` +
|
|
107
|
+
// a bare login flag read as a property: `!appState.isLoggedIn.value` (StateFlow/LiveData),
|
|
108
|
+
// `if (isLogin)`. The whole identifier must be the flag: `isLoggedInRequired` is not one.
|
|
109
|
+
String.raw`\b_?(?:is|has)(?:logged|signed)in\b|\b_?islogin\b`, 'i');
|
|
110
|
+
// Rebound below (line 869 of the Python) — the later definition is the live one.
|
|
111
|
+
const _FUN_DECL_RE_EARLY = pyRe( // eslint-disable-line no-unused-vars
|
|
112
|
+
String.raw`(?:@\w+\s+)*(?:private\s+|internal\s+|public\s+|inline\s+)*` +
|
|
113
|
+
String.raw`fun\s+([A-Za-z_]\w*)\s*\(`);
|
|
114
|
+
|
|
115
|
+
/** Read a JSONL file into a list (missing file -> []). */
|
|
116
|
+
export function load(p) {
|
|
117
|
+
if (!osExists(p)) { return []; }
|
|
118
|
+
const out = [];
|
|
119
|
+
for (let ln of splitKeepLines(readText(p))) {
|
|
120
|
+
ln = pyStrip(ln);
|
|
121
|
+
if (ln) { out.push(jsonLoads(ln)); }
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
/** Python file iteration lines (universal newlines already applied by readText). */
|
|
126
|
+
function splitKeepLines(s) { return s.split('\n'); }
|
|
127
|
+
|
|
128
|
+
export function sid(s) {
|
|
129
|
+
let out = '';
|
|
130
|
+
for (const c of String(s)) { out += isAlnumCh(c) ? c : '_'; }
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const _SOURCE_CALLSITE = pyRe(
|
|
135
|
+
String.raw`^(?P<head>.*@)(?P<dirs>(?:[^@\s]*/)+)(?P<file>[^/@\s]+\.[A-Za-z0-9]+)(?P<line>:\d+)?$`);
|
|
136
|
+
|
|
137
|
+
export function _compressSourcePath(s) {
|
|
138
|
+
const m = reMatch(_SOURCE_CALLSITE, s);
|
|
139
|
+
if (!m) { return [s, false]; }
|
|
140
|
+
return [`${m.groups.head}${m.groups.file}${m.groups.line || ''}`, true];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function slug(nodeId) {
|
|
144
|
+
let s = pyStr(nodeId);
|
|
145
|
+
if (s.startsWith('activity:')) {
|
|
146
|
+
const parts = s.slice('activity:'.length).split('.');
|
|
147
|
+
return `activity_${parts[parts.length - 1]}`;
|
|
148
|
+
}
|
|
149
|
+
s = s.split('compose-route:').join('route_').split('overlay:').join('overlay_').split('mode:').join('mode_');
|
|
150
|
+
let lossy;
|
|
151
|
+
[s, lossy] = _compressSourcePath(s);
|
|
152
|
+
s = s.split('@').join('_at_');
|
|
153
|
+
for (const ch of '#:./\\ ') { s = s.split(ch).join('_'); }
|
|
154
|
+
if (cpLen(s) <= 80 && !lossy) { return s; }
|
|
155
|
+
const digest = md5Hex(Buffer.from(pyStr(nodeId), 'utf8')).slice(0, 8);
|
|
156
|
+
if (cpLen(s) + 9 <= 80) { return `${s}_${digest}`; }
|
|
157
|
+
return `${cpSlice(s, 0, 71)}_${digest}`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export const _GUARD_KINDS = [
|
|
161
|
+
// Guard text comes from the Android app's code and strings, which keep their own language whatever
|
|
162
|
+
// the build language: the English build keeps the Chinese keywords and adds English ones.
|
|
163
|
+
[['scan', 'songs', 'library', 'empty', 'populated', '扫描', '曲库', '!= null', 'isnotempty', 'isempty', '已导入',
|
|
164
|
+
'content', 'music library', 'imported'], 'data-state'],
|
|
165
|
+
[['oauth', 'authorize', '授权', '第三方', 'third-party', 'access token', 'authorization', 'third party'], 'oauth'],
|
|
166
|
+
[['登录', 'login', 'sign in', '注册', 'signin', 'logged in', 'account', '账号', '已登录', 'register'], 'login'],
|
|
167
|
+
[['支付', 'pay', 'payment', '充值', 'vip', 'purchase', 'premium', '订阅', 'subscribe', '付费', 'top up', 'subscription',
|
|
168
|
+
'paid'], 'pay'],
|
|
169
|
+
[['baseurl', 'base_url', 'server', '服务器', 'endpoint', 'host', 'webdav', 'smb', '自建', '配置地址', 'self-hosted',
|
|
170
|
+
'configure address'], 'server-config'],
|
|
171
|
+
[['role', 'default app', 'default sms', 'default dialer', 'assistant', 'rolemanager', 'inputmethod', '输入法',
|
|
172
|
+
'accessibility', '无障碍', 'notification listener', '默认应用', 'write_settings', 'device admin', 'input method'], 'system-role'],
|
|
173
|
+
[['bluetooth', '蓝牙', 'telephony', 'sensor', '传感器', 'camera', '摄像头', 'nfc', 'gps', '定位硬件', 'location hardware'], 'hardware'],
|
|
174
|
+
[['network', '联网', '网络', 'online', 'http', 'retrofit', 'okhttp', 'connectivity', '无网络', 'connected', 'no network'], 'network'],
|
|
175
|
+
[['flavor', 'build', 'google', 'flyme', 'meizu', 'channel', 'gplay'], 'build-flavor'],
|
|
176
|
+
[['device', '机型', 'tablet', 'car', '平板', '车载', 'usb', 'sdk', 'device model', 'in-vehicle'], 'device-env'],
|
|
177
|
+
[['currenttimemillis', 'time-window', '过期', 'expired', 'seasonal'], 'time-window'],
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
export function normalizeGuard(guard) {
|
|
181
|
+
if (!truthy(guard)) { return null; }
|
|
182
|
+
if (isObj(guard)) {
|
|
183
|
+
const gg = {}; for (const k of keysOf(guard)) { dset(gg, k, guard[k]); }
|
|
184
|
+
if (!Object.hasOwn(gg, 'text')) { dset(gg, 'text', ''); }
|
|
185
|
+
if (!truthy(get(gg, 'kind'))) { dset(gg, 'kind', _inferGuardKind(get(gg, 'text', ''))); }
|
|
186
|
+
return gg;
|
|
187
|
+
}
|
|
188
|
+
const text = pyStr(guard);
|
|
189
|
+
return { text, kind: _inferGuardKind(text) };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Python str.lower() (JS toLowerCase is close enough; differs only for İ). */
|
|
193
|
+
const lower = (s) => s.toLowerCase();
|
|
194
|
+
|
|
195
|
+
export function _inferGuardKind(text) {
|
|
196
|
+
const low = lower(truthy(text) ? text : '');
|
|
197
|
+
for (const [terms, kind] of _GUARD_KINDS) {
|
|
198
|
+
if (terms.some((t) => low.includes(t))) { return kind; }
|
|
199
|
+
}
|
|
200
|
+
return 'condition';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export const _INSTANCE_ROUTE_SUFFIXES = ['_CONTENT', '_DETAIL', '_PATH', '_INFO'];
|
|
204
|
+
export const _PAY_ROUTE_TOKENS = ['PRO', 'PAY', 'PAYMENT', 'PAYWALL', 'ACTIVATE', 'PURCHASE', 'PREMIUM', 'VIP',
|
|
205
|
+
'DONATE', 'DONATION', 'SUBSCRIBE', 'SUBSCRIPTION'];
|
|
206
|
+
export const _ENV_ROUTE_TOKENS = ['GOOGLE_PLAY', 'GPLAY', 'FLYME', 'MEIZU', 'WINDOWS_PLATFORM'];
|
|
207
|
+
export const _LOGIN_ROUTE_TOKENS = ['LOGIN', 'REGISTER', 'SIGN_IN', 'SIGNIN', 'ACCOUNT'];
|
|
208
|
+
/** Auth-entry words: a route named this way IS the login / sign-up flow, shown to a logged-out user,
|
|
209
|
+
* so its in-edge guard is `logged-out` (a fresh install reaches it). `ACCOUNT` alone (`account_settings`)
|
|
210
|
+
* stays a needs-login page. Matched only as the name's LAST word (see _isAuthEntryRoute). */
|
|
211
|
+
export const _AUTH_ENTRY_ROUTE_TOKENS = ['LOGIN', 'REGISTER', 'SIGN_IN', 'SIGNIN'];
|
|
212
|
+
const _PAGE_SUFFIX_WORDS = new Set(['SCREEN', 'ROUTE', 'ACTIVITY', 'FRAGMENT', 'PAGE', 'VIEW']);
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Whether `routeKey` names the login / sign-up page itself: an auth-entry token must END the last
|
|
216
|
+
* dotted member, after dropping page suffixes (`Screen`, `Route`, `Activity`, …). `AccountLogin`,
|
|
217
|
+
* `SmsLoginScreen`, `AuthRoutes.Register` qualify; `LoginHistory`, `LoginDevices`, `ChangeLoginPassword`,
|
|
218
|
+
* `RegisterDevice`, `SignInCalendar` (daily check-in) do not — the word only qualifies what they are,
|
|
219
|
+
* and they need a logged-in user. A bare `DailySignIn` check-in page is indistinguishable by name.
|
|
220
|
+
*/
|
|
221
|
+
export function _isAuthEntryRoute(routeKey) {
|
|
222
|
+
const words = _identWords(pyStr(truthy(routeKey) ? routeKey : '').split('.').at(-1), true);
|
|
223
|
+
while (words.length > 1 && _PAGE_SUFFIX_WORDS.has(words.at(-1))) { words.pop(); }
|
|
224
|
+
return _AUTH_ENTRY_ROUTE_TOKENS.some((t) => {
|
|
225
|
+
const tw = _identWords(t, false);
|
|
226
|
+
return words.length >= tw.length && tw.every((w, j) => words[words.length - tw.length + j] === w);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Upper-cased words of an identifier: split on every non-alphanumeric run (snake_case, kebab-case,
|
|
232
|
+
* dots, slashes) and, unless `camel` is false, on camelCase/PascalCase humps (`VIPCenter` -> VIP, CENTER).
|
|
233
|
+
*/
|
|
234
|
+
export function _identWords(s, camel = true) {
|
|
235
|
+
let t = truthy(s) ? String(s) : '';
|
|
236
|
+
if (camel) { t = t.replace(/([a-z0-9])([A-Z])/g, '$1_$2').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2'); }
|
|
237
|
+
return t.toUpperCase().split(/[^A-Z0-9]+/).filter((w) => w);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Whether `routeKey` contains one of `tokens` as WHOLE words (a multi-word token such as GOOGLE_PLAY
|
|
242
|
+
* matches consecutive words; a trailing plural `S` is tolerated). Substring hits do not count:
|
|
243
|
+
* `chinese_proverb` / `Profile` contain "PRO" but are not pay pages. A token written `_X` (an instance
|
|
244
|
+
* suffix like `_DETAIL`) must follow a real `_`/`-` separator inside the last dotted member (never a camel
|
|
245
|
+
* hump nor the first word), with no plural.
|
|
246
|
+
*/
|
|
247
|
+
export function _hasToken(routeKey, tokens) {
|
|
248
|
+
const camelWords = _identWords(routeKey, true);
|
|
249
|
+
// instance suffixes read the member only: a `Holder.` qualifier (`GoodsRoutes.Detail`) is not a `_DETAIL`
|
|
250
|
+
const sepWords = _identWords(pyStr(truthy(routeKey) ? routeKey : '').split('.').at(-1), false);
|
|
251
|
+
return tokens.some((t) => {
|
|
252
|
+
const suffix = t.startsWith('_');
|
|
253
|
+
const tw = _identWords(t, false);
|
|
254
|
+
const words = suffix ? sepWords : camelWords;
|
|
255
|
+
if (!tw.length) { return false; }
|
|
256
|
+
for (let i = suffix ? 1 : 0; i + tw.length <= words.length; i++) {
|
|
257
|
+
if (tw.every((w, j) => {
|
|
258
|
+
const x = words[i + j];
|
|
259
|
+
return x === w || (!suffix && j === tw.length - 1 && x === w + 'S');
|
|
260
|
+
})) { return true; }
|
|
261
|
+
}
|
|
262
|
+
return false;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function _cjk(s) {
|
|
267
|
+
for (const c of (truthy(s) ? s : '')) { if (c >= '一' && c <= '鿿') { return true; } }
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export const _CODE_NAME_TAIL_A = pyRe('(Fragment|Activity|Screen|Dialog|Sheet|Menu)$');
|
|
272
|
+
|
|
273
|
+
export function _isCodeName(s) {
|
|
274
|
+
if (!truthy(s)) { return true; }
|
|
275
|
+
if (_cjk(s)) { return false; }
|
|
276
|
+
if (reSearch(_CODE_NAME_TAIL_A, s)) { return true; }
|
|
277
|
+
if (strIsUpper(s) || s.includes('_')) { return true; }
|
|
278
|
+
if (reMatch(pyRe(String.raw`^[A-Za-z]\w*$`), s) && [...s].slice(1).some(isUpperCh)) { return true; }
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export function _isScreenText(s) {
|
|
283
|
+
if (!truthy(s) || cpLen(s) > 30) { return false; }
|
|
284
|
+
return _cjk(s) || !_isCodeName(s);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const _FUN_DECL_RE = pyRe(String.raw`\bfun\s+(?:<[^>]*>\s*)?(?:[\w.]+\.)?(\w+)\s*\(`);
|
|
288
|
+
|
|
289
|
+
/** {fn_name: [absolute_file_path, decl_offset]} (Map) for every fun in the project. */
|
|
290
|
+
export function _buildFnDeclarationIndex(project) {
|
|
291
|
+
const index = new Map();
|
|
292
|
+
if (!truthy(project) || !osIsDir(project)) { return index; }
|
|
293
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
294
|
+
const keep = dirs.filter((d) => !SKIP_WALK.includes(d));
|
|
295
|
+
dirs.length = 0; dirs.push(...keep);
|
|
296
|
+
for (const fn of files) {
|
|
297
|
+
if (!(fn.endsWith('.kt') || fn.endsWith('.java'))) { continue; }
|
|
298
|
+
const p = osJoin(dirpath, fn);
|
|
299
|
+
let text;
|
|
300
|
+
try { text = readTextSmart(p); } catch { continue; }
|
|
301
|
+
for (const m of finditer(_FUN_DECL_RE, text)) {
|
|
302
|
+
if (!index.has(m[1])) { index.set(m[1], [p, m.index]); }
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return index;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// --- View-based (non-Compose) page-title resolution ---------------------- //
|
|
310
|
+
export const _TOOLBAR_TAG_RE = pyRe(String.raw`<[\w.]*(?:Toolbar|AppBarLayout|ActionBar)\b[^>]*>`, 's');
|
|
311
|
+
export const _XML_TITLE_ATTR_RE = pyRe(String.raw`(?:app|android):title\s*=\s*"([^"]+)"`);
|
|
312
|
+
export const _XML_TEXT_ATTR_RE = pyRe(String.raw`android:text\s*=\s*"([^"]+)"`);
|
|
313
|
+
export const _STRING_REF_RE_A = pyRe(String.raw`^@string/(\w+)$`);
|
|
314
|
+
|
|
315
|
+
export function _resolveXmlString(val, strings) {
|
|
316
|
+
const m = reMatch(_STRING_REF_RE_A, pyStrip(truthy(val) ? val : ''));
|
|
317
|
+
if (m) { return get(strings, m[1]); }
|
|
318
|
+
if (truthy(val) && !val.startsWith('@') && !val.includes('%')) { return val; }
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** os.path.splitext(fn)[0] for a bare file name. */
|
|
323
|
+
function splitextStem(fn) {
|
|
324
|
+
const i = fn.lastIndexOf('.');
|
|
325
|
+
if (i <= 0) { return fn; }
|
|
326
|
+
let j = 0; while (j < fn.length && fn[j] === '.') { j++; }
|
|
327
|
+
return i < j ? fn : fn.slice(0, i);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/** {layout_name: absolute_path} (Map) for every res/layout* xml. */
|
|
331
|
+
export function _findLayoutFiles(project) {
|
|
332
|
+
const out = new Map();
|
|
333
|
+
if (!truthy(project) || !osIsDir(project)) { return out; }
|
|
334
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
335
|
+
const keep = dirs.filter((d) => !SKIP_WALK.includes(d));
|
|
336
|
+
dirs.length = 0; dirs.push(...keep);
|
|
337
|
+
const norm = dirpath.split('\\').join('/');
|
|
338
|
+
if (!norm.includes('/res/layout')) { continue; }
|
|
339
|
+
for (const fn of files) {
|
|
340
|
+
if (fn.endsWith('.xml')) {
|
|
341
|
+
const stem = splitextStem(fn);
|
|
342
|
+
if (!out.has(stem)) { out.set(stem, osJoin(dirpath, fn)); }
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return out;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export function _layoutTitle(layoutPath, strings) {
|
|
350
|
+
let text;
|
|
351
|
+
try { text = readTextSmart(layoutPath); } catch { return null; }
|
|
352
|
+
const tm = reSearch(_TOOLBAR_TAG_RE, text);
|
|
353
|
+
if (tm) {
|
|
354
|
+
const window = text.slice(tm.index, _cpFwd(text, tm.index, 800));
|
|
355
|
+
const am = reSearch(_XML_TITLE_ATTR_RE, window);
|
|
356
|
+
if (am) { const v = _resolveXmlString(am[1], strings); if (truthy(v)) { return v; } }
|
|
357
|
+
const txt = reSearch(_XML_TEXT_ATTR_RE, window);
|
|
358
|
+
if (txt) { const v = _resolveXmlString(txt[1], strings); if (truthy(v)) { return v; } }
|
|
359
|
+
}
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** Python `a or b`. */
|
|
364
|
+
const or0 = (a, b) => (truthy(a) ? a : b);
|
|
365
|
+
|
|
366
|
+
/** [path, text] of a node's declared_at source (cached in file_text_cache), or [null, null]. */
|
|
367
|
+
function _nodeSourceText(node, fileTextCache) {
|
|
368
|
+
const da = pyStr(or0(get(node, 'declared_at'), ''));
|
|
369
|
+
const srcRel = pySplit(da, ':', 1)[0];
|
|
370
|
+
if (!srcRel || !(srcRel.endsWith('.java') || srcRel.endsWith('.kt'))) { return [null, null]; }
|
|
371
|
+
const proj = fileTextCache.get('__project__');
|
|
372
|
+
if (!truthy(proj)) { return [null, null]; }
|
|
373
|
+
const cand = osJoin(proj, srcRel.split('/').join(SEP));
|
|
374
|
+
if (!osExists(cand)) { return [null, null]; }
|
|
375
|
+
let text = fileTextCache.has(cand) ? fileTextCache.get(cand) : null;
|
|
376
|
+
if (text === null || text === undefined) {
|
|
377
|
+
try { text = readTextSmart(cand); } catch { text = ''; }
|
|
378
|
+
fileTextCache.set(cand, text);
|
|
379
|
+
}
|
|
380
|
+
return [cand, text];
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export function _viewOwnTitle(node, layouts, strings, fileTextCache) {
|
|
384
|
+
const [p, text] = _nodeSourceText(node, fileTextCache);
|
|
385
|
+
if (!p || !text) { return null; }
|
|
386
|
+
const seen = new Set();
|
|
387
|
+
for (const ln of allLayoutNames(text)) {
|
|
388
|
+
if (seen.has(ln)) { continue; }
|
|
389
|
+
seen.add(ln);
|
|
390
|
+
const lp = layouts.get(ln);
|
|
391
|
+
if (!lp) { continue; }
|
|
392
|
+
const t = _layoutTitle(lp, strings);
|
|
393
|
+
if (truthy(t)) { return t; }
|
|
394
|
+
}
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export const _BARE_LAYOUT_TAGS = new Set(['FrameLayout', 'FragmentContainerView', 'fragment',
|
|
399
|
+
'ConstraintLayout', 'LinearLayout', 'RelativeLayout', 'CoordinatorLayout', 'merge']);
|
|
400
|
+
export const _LAYOUT_HOST_TAGS = new Set(['FrameLayout', 'FragmentContainerView', 'fragment']);
|
|
401
|
+
export const _XML_TAG_RE = pyRe(String.raw`<([\w.]+)[\s/>]`);
|
|
402
|
+
|
|
403
|
+
export function _isBareContainerLayout(layoutPath) {
|
|
404
|
+
let text;
|
|
405
|
+
try { text = readTextSmart(layoutPath); } catch { return false; }
|
|
406
|
+
text = reSub(pyRe('<!--.*?-->', 's'), '', text);
|
|
407
|
+
const tags = reFindall(_XML_TAG_RE, text);
|
|
408
|
+
if (!tags.length) { return false; }
|
|
409
|
+
let sawHost = false;
|
|
410
|
+
for (const t of tags) {
|
|
411
|
+
const tail = pyRsplit(t, '.', 1).at(-1);
|
|
412
|
+
if (!_BARE_LAYOUT_TAGS.has(tail)) { return false; }
|
|
413
|
+
if (_LAYOUT_HOST_TAGS.has(tail)) { sawHost = true; }
|
|
414
|
+
}
|
|
415
|
+
return sawHost;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export function _nodeLayoutPaths(node, layouts, fileTextCache) {
|
|
419
|
+
const [p, text] = _nodeSourceText(node, fileTextCache);
|
|
420
|
+
if (!p || !text) { return []; }
|
|
421
|
+
const out = []; const seen = new Set();
|
|
422
|
+
for (const ln of allLayoutNames(text)) {
|
|
423
|
+
if (seen.has(ln)) { continue; }
|
|
424
|
+
seen.add(ln);
|
|
425
|
+
const lp = layouts.get(ln);
|
|
426
|
+
if (lp) { out.push(lp); }
|
|
427
|
+
}
|
|
428
|
+
return out;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export const _TRANSPARENT_WRAPPERS = new Set(['CompositionLocalProvider', 'MaterialTheme', 'AppTheme', 'Theme',
|
|
432
|
+
'BoxWithConstraints', 'Box', 'Surface', 'ProvideTextStyle', 'SharedTransitionLayout', 'KoinContext']);
|
|
433
|
+
export const _CONTAINER_COMPOSABLES = new Set(['NavHost', 'AnimatedNavHost', 'HorizontalPager', 'VerticalPager',
|
|
434
|
+
'Navigator', 'CurrentScreen', 'SlideTransition', 'FadeTransition']);
|
|
435
|
+
export const _OWN_CHROME_RE = pyRe(
|
|
436
|
+
String.raw`\b(?:TopAppBar|BottomAppBar|NavigationBar|BottomNavigation|` +
|
|
437
|
+
String.raw`ModalNavigationDrawer|PermanentNavigationDrawer|NavigationRail)\s*\(`);
|
|
438
|
+
export const _SET_CONTENT_RE = pyRe(String.raw`\bsetContent\s*(?:\([^)]*\))?\s*\{`);
|
|
439
|
+
|
|
440
|
+
export function _balancedBlock(text, bracePos) {
|
|
441
|
+
let depth = 0; let i = bracePos; const n = text.length;
|
|
442
|
+
while (i < n) {
|
|
443
|
+
const c = text[i];
|
|
444
|
+
if (c === '{') { depth++; } else if (c === '}') { depth--; if (depth === 0) { return text.slice(bracePos + 1, i); } }
|
|
445
|
+
i++;
|
|
446
|
+
}
|
|
447
|
+
return '';
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** {simple class name: source text} (Map) for .kt/.java, built once (cache key '__src__'). */
|
|
451
|
+
export function _sourceIndex(project, cache) {
|
|
452
|
+
if (cache.has('__src__')) { return cache.get('__src__'); }
|
|
453
|
+
const idx = new Map();
|
|
454
|
+
if (truthy(project)) {
|
|
455
|
+
for (const [dp, dirs, files] of _osWalk(project)) {
|
|
456
|
+
const keep = dirs.filter((d) => !SKIP_WALK.includes(d));
|
|
457
|
+
dirs.length = 0; dirs.push(...keep);
|
|
458
|
+
for (const fn of files) {
|
|
459
|
+
if (fn.endsWith('.kt') || fn.endsWith('.java')) {
|
|
460
|
+
const stem = pyRsplit(fn, '.', 1)[0];
|
|
461
|
+
if (idx.has(stem)) { continue; }
|
|
462
|
+
try { idx.set(stem, readText(osJoin(dp, fn), { errors: 'replace' })); } catch { /* OSError */ }
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
cache.set('__src__', idx);
|
|
468
|
+
return idx;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export function _statementCalls(body) {
|
|
472
|
+
const out = []; let depth = 0; let i = 0; const n = body.length;
|
|
473
|
+
const capRe = pyRe(String.raw`[A-Z]\w*`, 'y');
|
|
474
|
+
while (i < n) {
|
|
475
|
+
const c = body[i];
|
|
476
|
+
if (c === '(') { depth++; } else if (c === ')') { depth = Math.max(0, depth - 1); }
|
|
477
|
+
else if (depth === 0 && isUpperCh(c) && (i === 0 || !(isAlnumCh(body[i - 1]) || '_.'.includes(body[i - 1])))) {
|
|
478
|
+
capRe.lastIndex = i;
|
|
479
|
+
const m = capRe.exec(body);
|
|
480
|
+
if (m) {
|
|
481
|
+
let j = i + m[0].length;
|
|
482
|
+
while (j < n && ' \t\r\n'.includes(body[j])) { j++; }
|
|
483
|
+
if (j < n && '({'.includes(body[j])) { out.push(m[0]); }
|
|
484
|
+
i += m[0].length;
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
i++;
|
|
489
|
+
}
|
|
490
|
+
return out;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export function _isBareComposeHost(node, project, cache) {
|
|
494
|
+
let short = get(node, 'name');
|
|
495
|
+
if (!truthy(short)) { short = pyRsplit(pyStr(or0(get(node, 'fqn'), '')), '.', 1).at(-1); }
|
|
496
|
+
if (!truthy(short)) { short = pySplit(pyStr(or0(get(node, 'id'), '')), ':', 1).at(-1); }
|
|
497
|
+
const src = _sourceIndex(project, cache).get(or0(short, ''));
|
|
498
|
+
if (!truthy(src)) { return false; }
|
|
499
|
+
const m = reSearch(_SET_CONTENT_RE, src);
|
|
500
|
+
if (!m) { return false; }
|
|
501
|
+
const body = _balancedBlock(src, src.indexOf('{', m.index));
|
|
502
|
+
if (!body || reSearch(_OWN_CHROME_RE, body)) { return false; }
|
|
503
|
+
const calls = _statementCalls(body);
|
|
504
|
+
if (!calls.length) { return false; }
|
|
505
|
+
return calls.some((c) => !_TRANSPARENT_WRAPPERS.has(c));
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export function _isLauncherShell(n) {
|
|
509
|
+
if (truthy(get(n, 'is_launcher'))) { return true; }
|
|
510
|
+
const hint = get(n, 'launch_hint');
|
|
511
|
+
return !!(isObj(hint) && truthy(get(hint, 'is_launcher')));
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/** Python setdefault on a plain object. */
|
|
515
|
+
function setdefault(o, k, v) { if (!Object.hasOwn(o, k)) { dset(o, k, v); } return o[k]; }
|
|
516
|
+
/** d.get(k) or {} as an object (Python `e.get("args") or {}`). */
|
|
517
|
+
const argsOf = (e) => { const a = get(e, 'args'); return truthy(a) ? a : {}; };
|
|
518
|
+
/** Remove key k from object (Python `del d[k]`, keeping KEY_ORDER coherent). */
|
|
519
|
+
function delKey(o, k) { delete o[k]; }
|
|
520
|
+
|
|
521
|
+
export function _foldUilessHosts(nodes, edges, layouts, fileTextCache, project = null) {
|
|
522
|
+
if (!truthy(project) && !truthy(layouts)) { return; }
|
|
523
|
+
const trace = truthy(process.env.UTG_FOLD_TRACE);
|
|
524
|
+
for (const nid of keysOf(nodes)) {
|
|
525
|
+
const n = get(nodes, nid);
|
|
526
|
+
if (!truthy(n) || !['activity', 'host-activity'].includes(get(n, 'kind'))) { continue; }
|
|
527
|
+
if (get(n, 'status') === 'unreachable') { continue; }
|
|
528
|
+
const bareView = _nodeLayoutPaths(n, layouts, fileTextCache).some((lp) => _isBareContainerLayout(lp));
|
|
529
|
+
const bareCompose = _isBareComposeHost(n, project, fileTextCache);
|
|
530
|
+
if (trace) {
|
|
531
|
+
pyPrintErr(`[fold] ${nid} kind=${pyStr(get(n, 'kind'))} status=${pyStr(get(n, 'status'))} ` +
|
|
532
|
+
`bare_view=${pyStr(bareView)} bare_compose=${pyStr(bareCompose)}`);
|
|
533
|
+
}
|
|
534
|
+
if (!(bareView || bareCompose)) { continue; }
|
|
535
|
+
const content = []; let entryEdge = null;
|
|
536
|
+
for (const e of edges) {
|
|
537
|
+
if (get(e, 'source') !== nid) { continue; }
|
|
538
|
+
const args = argsOf(e);
|
|
539
|
+
const mech = pyStr(get(e, 'mechanism', ''));
|
|
540
|
+
const trig = pyStr(or0(get(e, 'trigger'), ''));
|
|
541
|
+
const tnode = get(nodes, get(e, 'target'), {});
|
|
542
|
+
const kind = pyStr(get(tnode, 'kind', ''));
|
|
543
|
+
const isAuto = mech === 'fragment-transaction' && (get(args, 'via') === 'auto-load' || get(args, 'action') === 'default');
|
|
544
|
+
const isStartDest = mech.startsWith('compose-navigate') && trig.startsWith('startDestination@');
|
|
545
|
+
const isPager = mech === 'pager-swipe';
|
|
546
|
+
if (!(isAuto || isStartDest || isPager)) { continue; }
|
|
547
|
+
if (!['fragment', 'compose-route', 'compose-route-variant', 'pager-page', 'voyager-screen'].includes(kind)) { continue; }
|
|
548
|
+
content.push(e);
|
|
549
|
+
if (isAuto || isStartDest) {
|
|
550
|
+
if (truthy(get(e, 'guard'))) { continue; }
|
|
551
|
+
if (entryEdge !== null && entryEdge !== false && entryEdge !== e) { entryEdge = false; }
|
|
552
|
+
else if (entryEdge !== false) { entryEdge = e; }
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
if (trace) {
|
|
556
|
+
const ent = entryEdge === null ? 'None' : entryEdge === false ? 'False' : pyStr(get(entryEdge, 'target'));
|
|
557
|
+
pyPrintErr(`[fold] ${nid} content=${pyRepr(content.map((e) => get(e, 'target')))} entry=${ent}`);
|
|
558
|
+
}
|
|
559
|
+
if (!content.length) { continue; }
|
|
560
|
+
if (entryEdge === null || entryEdge === false) {
|
|
561
|
+
if (entryEdge === false) { continue; }
|
|
562
|
+
const _idx = (e) => {
|
|
563
|
+
const a = argsOf(e);
|
|
564
|
+
for (const k of ['pager_index', 'index', 'page_index']) { if (isInt(get(a, k))) { return get(a, k); } }
|
|
565
|
+
return null;
|
|
566
|
+
};
|
|
567
|
+
const pagers = content.filter((e) => get(e, 'mechanism') === 'pager-swipe' && _idx(e) !== null);
|
|
568
|
+
if (!pagers.length) { continue; }
|
|
569
|
+
let best = pagers[0];
|
|
570
|
+
for (const e of pagers.slice(1)) { if (pyCmp(_idx(e), _idx(best)) < 0) { best = e; } }
|
|
571
|
+
entryEdge = best;
|
|
572
|
+
}
|
|
573
|
+
const contentEdge = entryEdge;
|
|
574
|
+
const fid = get(contentEdge, 'target');
|
|
575
|
+
const f = get(nodes, fid);
|
|
576
|
+
if (f === null || f === undefined || fid === nid) { continue; }
|
|
577
|
+
const host = {};
|
|
578
|
+
for (const k of ['id', 'declared_at', 'exported', 'deep_links', 'launch_hint', 'is_launcher', 'fqn']) {
|
|
579
|
+
const v = get(n, k);
|
|
580
|
+
if (v !== null && v !== undefined) { dset(host, k, v); }
|
|
581
|
+
}
|
|
582
|
+
setdefault(host, 'id', nid);
|
|
583
|
+
dset(f, 'host_activity', host);
|
|
584
|
+
if (_isLauncherShell(n)) { dset(f, 'entry', true); }
|
|
585
|
+
const contentIds = new Set(content);
|
|
586
|
+
const rewired = [];
|
|
587
|
+
for (const e of edges) {
|
|
588
|
+
if (e === contentEdge) { continue; }
|
|
589
|
+
if (get(e, 'source') === nid) {
|
|
590
|
+
dset(e, 'source', fid);
|
|
591
|
+
if (contentIds.has(e)) { dset(setdefault(e, 'args', {}), 'via_host', nid); }
|
|
592
|
+
}
|
|
593
|
+
if (get(e, 'target') === nid) { dset(e, 'target', fid); }
|
|
594
|
+
if (pyEq(get(e, 'source'), get(e, 'target'))) { continue; }
|
|
595
|
+
rewired.push(e);
|
|
596
|
+
}
|
|
597
|
+
edges.length = 0; edges.push(...rewired);
|
|
598
|
+
delKey(nodes, nid);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* An entry page that leaves by itself and removes itself from the back stack (a splash whose
|
|
604
|
+
* ViewModel navigates from `init` with `popUpTo(self, inclusive)`) is never on screen once the
|
|
605
|
+
* app is ready: it can be converted from source but not captured. Stamp `transient: true` (the
|
|
606
|
+
* node stays in the denominator of the static graph; the explorer does not wait for a capture).
|
|
607
|
+
* Every out-edge must be non-gesture and close the source; one tap-driven edge keeps it a page.
|
|
608
|
+
*/
|
|
609
|
+
export function _markTransientEntries(nodes, edges) {
|
|
610
|
+
const NON_GESTURE = ['lifecycle', 'startDestination'];
|
|
611
|
+
for (const nid of keysOf(nodes)) {
|
|
612
|
+
const n = get(nodes, nid);
|
|
613
|
+
if (!truthy(n) || !truthy(get(n, 'entry'))) { continue; }
|
|
614
|
+
const out = edges.filter((e) => get(e, 'source') === nid && get(e, 'target') !== nid);
|
|
615
|
+
if (!out.length) { continue; }
|
|
616
|
+
const auto = out.every((e) => NON_GESTURE.includes(pyStr(or0(get(e, 'trigger'), '')).split('@')[0])
|
|
617
|
+
&& truthy(get(argsOf(e), 'closes_source')));
|
|
618
|
+
if (!auto) { continue; }
|
|
619
|
+
dset(n, 'transient', true);
|
|
620
|
+
dset(n, 'transient_evidence', out.map((e) => pyStr(get(e, 'trigger'))));
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export const _TIME_CALL_RE = pyRe(
|
|
625
|
+
String.raw`(?:System\.currentTimeMillis\(\)|Instant\.now\(\)\.toEpochMilli\(\)|` +
|
|
626
|
+
String.raw`Date\(\)\.getTime\(\)|System\.nanoTime\(\))`);
|
|
627
|
+
export const _TIME_CMP_RE = pyRe(
|
|
628
|
+
String.raw`(?:System\.currentTimeMillis\(\)|Instant\.now\(\)\.toEpochMilli\(\)|` +
|
|
629
|
+
String.raw`Date\(\)\.getTime\(\))\s*(<=?|>=?)\s*(\d{12,14})[Ll]?`);
|
|
630
|
+
export const _IF_HEAD = pyRe(String.raw`\bif\s*\(`);
|
|
631
|
+
|
|
632
|
+
export function _extractBalanced(text, start, openCh = '(', closeCh = ')', cap = 40000) {
|
|
633
|
+
if (start >= text.length || text[start] !== openCh) { return null; }
|
|
634
|
+
let depth = 0; let i = start; const end = Math.min(text.length, start + cap);
|
|
635
|
+
while (i < end) {
|
|
636
|
+
const c = text[i];
|
|
637
|
+
if (c === openCh) { depth++; } else if (c === closeCh) { depth--; if (depth === 0) { return text.slice(start + 1, i); } }
|
|
638
|
+
i++;
|
|
639
|
+
}
|
|
640
|
+
return null;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export function _pagerPositionZero(edges, src, project, pagerFns) {
|
|
644
|
+
const sites = edges.filter((e) => e.source === src &&
|
|
645
|
+
pagerFns.some((f) => pyStr(get(argsOf(e), 'commit_scope', '')).endsWith(':' + f)));
|
|
646
|
+
if (!sites.length) { return null; }
|
|
647
|
+
const m = reSearch(pyRe('@(.+?):(\\d+)$'), pyStr(or0(get(sites[0], 'trigger'), '')));
|
|
648
|
+
if (!m) { return null; }
|
|
649
|
+
const p = osJoin(project, m[1].split('/').join(SEP));
|
|
650
|
+
let text;
|
|
651
|
+
try { text = readTextSmart(p); } catch { return null; }
|
|
652
|
+
const zero = new Set(reFindall(pyRe(String.raw`\b([A-Z][A-Z0-9_]*)\s*=\s*0\s*[;\n]`), text));
|
|
653
|
+
const targets = new Map();
|
|
654
|
+
for (const e of sites) { targets.set(pySplit(e.target, ':', 1).at(-1), e.target); }
|
|
655
|
+
const armRe = pyRe(String.raw`(?:\bcase\s+([\w.]+)\s*:|^\s*([\w.]+)\s*->)((?:.|\n)*?)(?=\bcase\b|^\s*[\w.]+\s*->|\bdefault\b|\belse\s*->|\Z)`, 'm');
|
|
656
|
+
for (const fn of pagerFns) {
|
|
657
|
+
for (const fm of finditer(pyRe(String.raw`\b` + fn + String.raw`\s*\([^)]*\)\s*(?::\s*\w+\s*)?\{`), text)) {
|
|
658
|
+
const fe = fm.index + fm[0].length;
|
|
659
|
+
const body = text.slice(fe, _cpFwd(text, fe, 3000));
|
|
660
|
+
for (const arm of finditer(armRe, body)) {
|
|
661
|
+
const label = (arm[1] || arm[2] || '').split('.').at(-1);
|
|
662
|
+
if (label !== '0' && !zero.has(label)) { continue; }
|
|
663
|
+
for (const [cls, ident] of targets) {
|
|
664
|
+
if (reSearch(pyRe(String.raw`\b` + reEscape(cls) + String.raw`\b`), arm[3])) { return ident; }
|
|
665
|
+
}
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return null;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Demote defensive null tests (guard_subjects). A module flag so the corpus harness can
|
|
674
|
+
// compare verdicts with it off; always on in the pipeline.
|
|
675
|
+
export let DEFENSIVE_FILTER = true;
|
|
676
|
+
/** Set DEFENSIVE_FILTER (ESM bindings are read-only for importers). */
|
|
677
|
+
export function setDefensiveFilter(v) { DEFENSIVE_FILTER = !!v; }
|
|
678
|
+
export const _RANGES_CACHE = new Map();
|
|
679
|
+
|
|
680
|
+
export function _defensive(cond, text, pos, p) {
|
|
681
|
+
const key = tupleKey(p, text.length);
|
|
682
|
+
if (!_RANGES_CACHE.has(key)) { _RANGES_CACHE.set(key, fnRanges(text, p)); }
|
|
683
|
+
return isDefensive(cond, text, pos, _RANGES_CACHE.get(key));
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
export const _INTENT_TEST_RE = pyRe(
|
|
687
|
+
String.raw`\b(?:getIntent\s*\(\s*\)|intent)\s*\.\s*(?:hasExtra|get\w*Extra|getAction|` +
|
|
688
|
+
String.raw`getData|getDataString|hasCategory|action|data)\b`);
|
|
689
|
+
export const _BUILD_CALL_RE = pyRe(
|
|
690
|
+
String.raw`\bBuildConfig\.\w+|\b(?:is|has)\w*(?:GooglePlay|Gplay|Fdroid|Flavor|` +
|
|
691
|
+
String.raw`Channel|Debug|Release|Pro|Premium)\w*\s*\(`);
|
|
692
|
+
export const _CONTENT_TEST_RE = pyRe(
|
|
693
|
+
String.raw`\b(?!on[A-Z])(\w+(?:\.\w+)*)\s*\.\s*(?:isNotEmpty|isEmpty)\b\s*(?:\(\s*\))?|` +
|
|
694
|
+
String.raw`\b(?!on[A-Z])(\w+(?:\.\w+)*)\s*\.\s*(?:size|count)\b\s*[<>=!]|` +
|
|
695
|
+
String.raw`\b(?!on[A-Z])(\w+(?:\.\w+)*)\s*(?:!=|==)\s*null`);
|
|
696
|
+
|
|
697
|
+
export function _enclosingFunName(text, pos) {
|
|
698
|
+
let name = null;
|
|
699
|
+
for (const m of finditer(_FUN_DECL_RE, text)) {
|
|
700
|
+
if (m.index > pos) { break; }
|
|
701
|
+
name = m[1];
|
|
702
|
+
}
|
|
703
|
+
return name;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
export const _FN_HEAD_RE = pyRe(
|
|
707
|
+
String.raw`(?:^|\n)[ \t]*(?:@\w+[ \t]*\n[ \t]*)*` +
|
|
708
|
+
String.raw`(?:public|private|protected|internal|final|static|override|suspend|fun|` +
|
|
709
|
+
String.raw`[\w<>\[\]., ?]+?)[ \t]+(\w+)[ \t]*\([^;{)]*\)[^;{]*\{`);
|
|
710
|
+
export const _LEAVES_RE = pyRe(String.raw`\b(?:return|throw)\b`);
|
|
711
|
+
|
|
712
|
+
export function _fnBodyStart(text, pos) {
|
|
713
|
+
let best = null;
|
|
714
|
+
for (const m of finditer(_FN_HEAD_RE, text)) {
|
|
715
|
+
if (m.index > pos) { break; }
|
|
716
|
+
const brace = text.indexOf('{', m.index + m[0].length - 1);
|
|
717
|
+
if (brace === -1) { continue; }
|
|
718
|
+
const body = _extractBalanced(text, brace, '{', '}');
|
|
719
|
+
if (body === null) { continue; }
|
|
720
|
+
const end = brace + 1 + body.length + 1;
|
|
721
|
+
if (brace < pos && pos < end) { best = brace + 1; }
|
|
722
|
+
}
|
|
723
|
+
return best;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
export function _fnDeclPos(text, name) {
|
|
727
|
+
const hits = [...finditer(_FN_HEAD_RE, text)].filter((m) => m[1] === name);
|
|
728
|
+
return hits.length === 1 ? hits[0].index : null;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export function _fnBodyEnd(text, bodyLo) {
|
|
732
|
+
const body = _extractBalanced(text, bodyLo - 1, '{', '}');
|
|
733
|
+
return body !== null ? bodyLo + body.length : bodyLo;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
export function _negateCond(cond) {
|
|
737
|
+
const c = pyStrip(cond);
|
|
738
|
+
if (c.startsWith('!') && !c.startsWith('!=')) {
|
|
739
|
+
let inner = pyStrip(c.slice(1));
|
|
740
|
+
if (inner.startsWith('(') && inner.endsWith(')')) { inner = pyStrip(inner.slice(1, -1)); }
|
|
741
|
+
return inner;
|
|
742
|
+
}
|
|
743
|
+
const m = reFullmatch(pyRe(String.raw`(.+?)\s*!=\s*(.+)`), c);
|
|
744
|
+
if (m) { return `${pyStrip(m[1])} == ${pyStrip(m[2])}`; }
|
|
745
|
+
return `not (${c})`;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** Python text.rfind(sub, 0, end). */
|
|
749
|
+
const rfind0 = (text, sub, end) => (end <= 0 ? (sub === '' ? 0 : -1) : text.lastIndexOf(sub, end - sub.length));
|
|
750
|
+
/** " ".join(s.split()). */
|
|
751
|
+
const flatWs = (s) => pySplit(s).join(' ');
|
|
752
|
+
const _STMT_LEAVES_RE = pyRe(String.raw`\s*(?:return|throw)\b`);
|
|
753
|
+
const _ELSE_RE = pyRe(String.raw`\s*else\s*(\{)`);
|
|
754
|
+
|
|
755
|
+
export function _earlyReturnConditions(text, pos, limit = 6) {
|
|
756
|
+
const out = [];
|
|
757
|
+
const fnLo = _fnBodyStart(text, pos);
|
|
758
|
+
if (fnLo === null) { return out; }
|
|
759
|
+
for (const hm of finditer(_IF_HEAD, text, fnLo)) {
|
|
760
|
+
if (hm.index >= pos) { break; }
|
|
761
|
+
const paren = hm.index + hm[0].length - 1;
|
|
762
|
+
const cond = _extractBalanced(text, paren, '(', ')');
|
|
763
|
+
if (cond === null) { continue; }
|
|
764
|
+
const after = paren + 1 + cond.length + 1;
|
|
765
|
+
const seg = text.slice(after, _cpFwd(text, after, 160));
|
|
766
|
+
const bm = seg.indexOf('{');
|
|
767
|
+
if (bm === -1) {
|
|
768
|
+
const stmt = pySplit(seg, ';', 1)[0];
|
|
769
|
+
if (reMatch(_STMT_LEAVES_RE, stmt)) { out.push(_negateCond(pyStrip(cond))); }
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
const bodyStart = after + bm;
|
|
773
|
+
const body = _extractBalanced(text, bodyStart, '{', '}');
|
|
774
|
+
if (body === null) { continue; }
|
|
775
|
+
const bodyEnd = bodyStart + 1 + body.length + 1;
|
|
776
|
+
if (bodyEnd > pos) { continue; }
|
|
777
|
+
if (!reSearch(_LEAVES_RE, body)) { continue; }
|
|
778
|
+
out.push(_negateCond(pyStrip(cond)));
|
|
779
|
+
if (out.length >= limit) { break; }
|
|
780
|
+
}
|
|
781
|
+
return out;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
export function _enclosingIfConditions(text, pos, limit = 6) {
|
|
785
|
+
const out = [];
|
|
786
|
+
for (const hm of finditer(_IF_HEAD, text)) {
|
|
787
|
+
if (hm.index > pos) { break; }
|
|
788
|
+
const paren = hm.index + hm[0].length - 1;
|
|
789
|
+
const cond = _extractBalanced(text, paren, '(', ')');
|
|
790
|
+
if (cond === null) { continue; }
|
|
791
|
+
const after = paren + 1 + cond.length + 1;
|
|
792
|
+
const seg = text.slice(after, _cpFwd(text, after, 160));
|
|
793
|
+
const bm = seg.indexOf('{');
|
|
794
|
+
if (bm === -1) { continue; }
|
|
795
|
+
const bodyStart = after + bm;
|
|
796
|
+
const body = _extractBalanced(text, bodyStart, '{', '}');
|
|
797
|
+
if (body === null) { continue; }
|
|
798
|
+
const bodyEnd = bodyStart + 1 + body.length + 1;
|
|
799
|
+
if (bodyStart <= pos && pos < bodyEnd) { out.push(pyStrip(cond)); continue; }
|
|
800
|
+
const tail = text.slice(bodyEnd, _cpFwd(text, bodyEnd, 40));
|
|
801
|
+
const em = reMatch(_ELSE_RE, tail);
|
|
802
|
+
if (!em) { continue; }
|
|
803
|
+
const ebodyStart = bodyEnd + em[0].length - 1;
|
|
804
|
+
const ebody = _extractBalanced(text, ebodyStart, '{', '}');
|
|
805
|
+
if (ebody === null) { continue; }
|
|
806
|
+
if (ebodyStart <= pos && pos < ebodyStart + 1 + ebody.length + 1) { out.push('!(' + pyStrip(cond) + ')'); }
|
|
807
|
+
}
|
|
808
|
+
return out.slice(-limit);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
export const _CALLER_SCAN_MAX_FILES = 4000;
|
|
812
|
+
export const _CALLER_AGREE_MAX = 6;
|
|
813
|
+
export const _KT_SRC_RE = pyRe(String.raw`\.(?:kt|java)$`);
|
|
814
|
+
export const _CALLER_CACHE = new Map();
|
|
815
|
+
|
|
816
|
+
export function _projectSources(project) {
|
|
817
|
+
if (_CALLER_CACHE.has(project)) { return _CALLER_CACHE.get(project); }
|
|
818
|
+
const skip = new Set(['build', '.git', '.gradle', '.idea', 'node_modules', 'generated']);
|
|
819
|
+
const out = [];
|
|
820
|
+
for (const [dirpath, dirnames, filenames] of _osWalk(project)) {
|
|
821
|
+
const keep = dirnames.filter((d) => !skip.has(d));
|
|
822
|
+
dirnames.length = 0; dirnames.push(...keep);
|
|
823
|
+
for (const fn of filenames) {
|
|
824
|
+
if (reSearch(_KT_SRC_RE, fn)) {
|
|
825
|
+
out.push(osJoin(dirpath, fn));
|
|
826
|
+
if (out.length >= _CALLER_SCAN_MAX_FILES) { _CALLER_CACHE.set(project, out); return out; }
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
_CALLER_CACHE.set(project, out);
|
|
831
|
+
return out;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
export function _crossFileGate(fname, project) {
|
|
835
|
+
if (!truthy(fname) || !truthy(project)) { return []; }
|
|
836
|
+
const callRe = pyRe(String.raw`\b` + reEscape(fname) + String.raw`\s*\(`);
|
|
837
|
+
const declRe = pyRe(String.raw`\bfun\s+(?:<[^>]*>\s*)?(?:[\w.]+\.)?` + reEscape(fname) + String.raw`\s*\(`);
|
|
838
|
+
const found = [];
|
|
839
|
+
for (const p of _projectSources(project)) {
|
|
840
|
+
let txt;
|
|
841
|
+
try { txt = readTextSmart(p); } catch { continue; }
|
|
842
|
+
if (!txt || !txt.includes(fname)) { continue; }
|
|
843
|
+
for (const m of finditer(callRe, txt)) {
|
|
844
|
+
const lineStart = rfind0(txt, '\n', m.index) + 1;
|
|
845
|
+
if (reSearch(declRe, txt.slice(lineStart, m.index + m[0].length))) { continue; }
|
|
846
|
+
found.push([txt, m.index]);
|
|
847
|
+
if (found.length > _CALLER_AGREE_MAX) { return []; }
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (!found.length) { return []; }
|
|
851
|
+
const verdicts = new Set(); let first = null;
|
|
852
|
+
for (const [txt, at] of found) {
|
|
853
|
+
const conds = _enclosingIfConditions(txt, at);
|
|
854
|
+
let kind = null;
|
|
855
|
+
for (const cond of [...conds].reverse()) {
|
|
856
|
+
const flat = flatWs(cond);
|
|
857
|
+
if (reSearch(_BUILD_CALL_RE, flat)) { kind = 'build-flavor'; break; }
|
|
858
|
+
if (reSearch(_CONTENT_TEST_RE, flat)) { kind = 'data-state'; break; }
|
|
859
|
+
}
|
|
860
|
+
verdicts.add(kind);
|
|
861
|
+
if (first === null) { first = conds; }
|
|
862
|
+
}
|
|
863
|
+
if (verdicts.size !== 1 || verdicts.has(null)) { return []; }
|
|
864
|
+
return first;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const _ENABLED_TOK_RE = pyRe(String.raw`[(){}\[\]]|\benabled\s*=\s*([^,\n]+)`);
|
|
868
|
+
const _IDENT_RE = pyRe(String.raw`\b([A-Za-z_]\w*)\b`);
|
|
869
|
+
|
|
870
|
+
export function _disabledExpr(text, pos) {
|
|
871
|
+
let depth = 0; let openAt = -1;
|
|
872
|
+
for (let i = pos - 1; i > Math.max(0, pos - 4000) - 1; i--) {
|
|
873
|
+
const c = text[i];
|
|
874
|
+
if (c === ')') { depth++; } else if (c === '(') {
|
|
875
|
+
if (depth === 0) { openAt = i; break; }
|
|
876
|
+
depth--;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
if (openAt < 0) { return ''; }
|
|
880
|
+
const args = _extractBalanced(text, openAt);
|
|
881
|
+
if (!truthy(args)) { return ''; }
|
|
882
|
+
let d = 0;
|
|
883
|
+
for (const m of finditer(_ENABLED_TOK_RE, args)) {
|
|
884
|
+
const tok = m[0];
|
|
885
|
+
if (m[1] !== undefined) {
|
|
886
|
+
if (d === 0) {
|
|
887
|
+
let expr = pyRstrip(pyStrip(m[1]), ',');
|
|
888
|
+
for (const nm of reFindall(_IDENT_RE, expr)) {
|
|
889
|
+
const am = reSearch(pyRe(String.raw`\bval\s+` + reEscape(nm) + String.raw`\s*(?::[^=\n]+)?=\s*([^\n]+)`), text);
|
|
890
|
+
if (am) { expr += ' || ' + pyStrip(am[1]); }
|
|
891
|
+
}
|
|
892
|
+
return expr;
|
|
893
|
+
}
|
|
894
|
+
continue;
|
|
895
|
+
}
|
|
896
|
+
d += '({['.includes(tok) ? 1 : -1;
|
|
897
|
+
}
|
|
898
|
+
return '';
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/** str.splitlines(True) (Python line boundaries). */
|
|
902
|
+
function splitlinesKeep(s) {
|
|
903
|
+
const out = []; const re = /\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/g;
|
|
904
|
+
let last = 0; let m;
|
|
905
|
+
while ((m = re.exec(s)) !== null) { out.push(s.slice(last, m.index + m[0].length)); last = m.index + m[0].length; }
|
|
906
|
+
if (last < s.length) { out.push(s.slice(last)); }
|
|
907
|
+
return out;
|
|
908
|
+
}
|
|
909
|
+
const _TRIG_AT_RE = pyRe(String.raw`@(.+?):(\d+)$`);
|
|
910
|
+
const _FUN_LINE_RE = pyRe(String.raw`\s*(?:private\s+|internal\s+)?fun\b`);
|
|
911
|
+
/** Seconds since epoch -> 'YYYY-MM-DD' (time.strftime('%Y-%m-%d', time.gmtime(s))). */
|
|
912
|
+
const gmDate = (ms) => new Date(Math.floor(ms / 1000) * 1000).toISOString().slice(0, 10);
|
|
913
|
+
const head100 = (s) => cpSlice(s, 0, 100);
|
|
914
|
+
|
|
915
|
+
export function _branchGuard(edge, project) {
|
|
916
|
+
if (!truthy(project)) { return null; }
|
|
917
|
+
const trig = or0(get(edge, 'trigger'), '');
|
|
918
|
+
const m = reSearch(_TRIG_AT_RE, trig);
|
|
919
|
+
if (!m) { return null; }
|
|
920
|
+
const relPath = m[1]; const lineNo = Number(m[2]);
|
|
921
|
+
const hop = pyStr(or0(get(argsOf(edge), 'hop'), ''));
|
|
922
|
+
const hopFn = hop.startsWith('helper:') ? pyStrip(pySplit(hop, ':', 1)[1]) : '';
|
|
923
|
+
const p = osJoin(project, relPath.split('/').join(SEP));
|
|
924
|
+
let st; try { st = fs.statSync(p); } catch { st = null; }
|
|
925
|
+
if (!st || !st.isFile()) { return null; }
|
|
926
|
+
let text;
|
|
927
|
+
try { text = readTextSmart(p); } catch { return null; }
|
|
928
|
+
if (!text) { return null; }
|
|
929
|
+
const lines = splitlinesKeep(text);
|
|
930
|
+
if (lineNo > lines.length) { return null; }
|
|
931
|
+
let pos = 0;
|
|
932
|
+
for (const l of lines.slice(0, lineNo - 1)) { pos += l.length; }
|
|
933
|
+
let conds = _enclosingIfConditions(text, pos);
|
|
934
|
+
for (const cond of conds) {
|
|
935
|
+
const flat = flatWs(cond);
|
|
936
|
+
if (reSearch(_INTENT_TEST_RE, flat)) {
|
|
937
|
+
const guard = { text: `launch-intent:${head100(flat)}`, kind: 'device-env' };
|
|
938
|
+
const extras = parseExtras(flat, project);
|
|
939
|
+
if (truthy(extras)) { dset(guard, 'launch_extras', extras); }
|
|
940
|
+
return guard;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (!conds.length) {
|
|
944
|
+
const fname = _enclosingFunName(text, pos);
|
|
945
|
+
if (truthy(fname)) {
|
|
946
|
+
const sites = [...finditer(pyRe(String.raw`\b` + reEscape(fname) + String.raw`\s*\(`), text)]
|
|
947
|
+
.filter((mm) => !reMatch(_FUN_LINE_RE, text.slice(Math.max(0, rfind0(text, '\n', mm.index)), mm.index)))
|
|
948
|
+
.map((mm) => mm.index);
|
|
949
|
+
if (sites.length === 1) { conds = _enclosingIfConditions(text, sites[0]); }
|
|
950
|
+
else if (!sites.length) { conds = _crossFileGate(fname, project); }
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
conds = [...conds, ..._earlyReturnConditions(text, pos)];
|
|
954
|
+
if (hopFn && !conds.length) {
|
|
955
|
+
const hpos = _fnDeclPos(text, hopFn);
|
|
956
|
+
if (hpos !== null) {
|
|
957
|
+
const brace = text.indexOf('{', hpos);
|
|
958
|
+
if (brace !== -1) { conds = _earlyReturnConditions(text, _fnBodyEnd(text, brace + 1)); }
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
const dis = _disabledExpr(text, pos);
|
|
962
|
+
if (dis) { conds = [...conds, dis]; }
|
|
963
|
+
const nowMs = Math.trunc(time() * 1000);
|
|
964
|
+
for (const cond of conds) {
|
|
965
|
+
if (!reSearch(_TIME_CALL_RE, cond)) { continue; }
|
|
966
|
+
const cm = reSearch(_TIME_CMP_RE, cond);
|
|
967
|
+
if (!cm) { continue; }
|
|
968
|
+
const op = cm[1]; const bound = Number(cm[2]);
|
|
969
|
+
const openNow = op.startsWith('<') ? nowMs < bound : nowMs > bound;
|
|
970
|
+
if (openNow) { return null; }
|
|
971
|
+
const when = gmDate(bound);
|
|
972
|
+
return { text: `time-window closed ${when}: ${head100(flatWs(cond))}`, kind: 'time-window' };
|
|
973
|
+
}
|
|
974
|
+
for (const cond of [...conds].reverse()) {
|
|
975
|
+
if (reSearch(_TIME_CALL_RE, cond)) { continue; }
|
|
976
|
+
const flat = flatWs(cond);
|
|
977
|
+
if (reSearch(_BUILD_CALL_RE, flat)) { return { text: `branch:${head100(flat)}`, kind: 'build-flavor' }; }
|
|
978
|
+
if (reSearch(_CONTENT_TEST_RE, flat)) {
|
|
979
|
+
if (DEFENSIVE_FILTER && _defensive(flat, text, pos, p)) { continue; }
|
|
980
|
+
return { text: `branch:${head100(flat)}`, kind: 'data-state' };
|
|
981
|
+
}
|
|
982
|
+
if (reSearch(_LOGIN_TEST_RE, flat)) {
|
|
983
|
+
// `if (!isLoggedIn()) navigate(Login)` holds only while logged OUT — the state a fresh install
|
|
984
|
+
// is in — so it must not read as "needs login" (static_prior._axisOf drops it).
|
|
985
|
+
const guard = { text: `branch:${head100(flat)}`, kind: 'login' };
|
|
986
|
+
if (loginPolarity(flat, _LOGIN_TEST_RE) === 'logged-out') { dset(guard, 'polarity', 'logged-out'); }
|
|
987
|
+
return guard;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
return null;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
export const _ROLE_KINDS = new Set(['pager-page']);
|
|
994
|
+
export const _DECL_RE_TMPL = String.raw`\b(?:class|interface|object|enum)\s+%s\b`;
|
|
995
|
+
|
|
996
|
+
/** {**a, **b, ...}: Python dict-merge order (first-seen key position, last value). */
|
|
997
|
+
function merge(...objs) {
|
|
998
|
+
const o = {};
|
|
999
|
+
for (const x of objs) { for (const k of keysOf(x)) { dset(o, k, x[k]); } }
|
|
1000
|
+
return o;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
export function _markOutOfScope(nodes, edges, project) {
|
|
1004
|
+
for (const n of Object.values(nodes)) {
|
|
1005
|
+
if (get(n, 'denominator') === false) { continue; }
|
|
1006
|
+
const hint = isObj(get(n, 'launch_hint')) ? get(n, 'launch_hint') : {};
|
|
1007
|
+
const surface = or0(get(n, 'surface'), get(hint, 'surface'));
|
|
1008
|
+
if (truthy(surface)) {
|
|
1009
|
+
dset(n, 'denominator', false);
|
|
1010
|
+
dset(n, 'out_of_scope', 'external-surface:' + (Array.isArray(surface) ? surface[0] : pyStr(surface)));
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
if (!truthy(project)) { return; }
|
|
1014
|
+
const sources = new Map();
|
|
1015
|
+
for (const p of _projectSources(project)) {
|
|
1016
|
+
try { sources.set(p, readTextSmart(p)); } catch { /* OSError */ }
|
|
1017
|
+
}
|
|
1018
|
+
const blob = [...sources.values()].join('\n');
|
|
1019
|
+
const declared = (name) => reSearch(pyRe(_DECL_RE_TMPL.replace('%s', reEscape(name))), blob) !== null;
|
|
1020
|
+
const nodeOrder = keysOf(nodes);
|
|
1021
|
+
for (const nid of nodeOrder) {
|
|
1022
|
+
const n = nodes[nid];
|
|
1023
|
+
if (get(n, 'denominator') === false) { continue; }
|
|
1024
|
+
if (!['dialog', 'overlay'].includes(get(n, 'kind')) || get(n, 'provenance') !== 'static:llm') { continue; }
|
|
1025
|
+
const own = pySplit(pySplit(nid, ':', 1).at(-1), '@', 1)[0];
|
|
1026
|
+
if (!reFullmatch(pyRe(String.raw`[A-Za-z_]\w*`), own) || declared(own)) { continue; }
|
|
1027
|
+
const at = pyStr(or0(get(n, 'declared_at'), ''));
|
|
1028
|
+
const m = reMatch(pyRe(String.raw`(.+?):(\d+)$`), at);
|
|
1029
|
+
if (!m) { continue; }
|
|
1030
|
+
const p = osJoin(project, m[1]);
|
|
1031
|
+
let text = sources.has(p) ? sources.get(p) : null;
|
|
1032
|
+
if (text === null) {
|
|
1033
|
+
try { text = readTextSmart(p); } catch { continue; }
|
|
1034
|
+
}
|
|
1035
|
+
const lines = splitlines(text);
|
|
1036
|
+
const i = Number(m[2]) - 1;
|
|
1037
|
+
const window = (i >= 0 && i < lines.length) ? lines.slice(Math.max(0, i), i + 2).join(' ') : '';
|
|
1038
|
+
if (reSearch(pyRe(String.raw`\b` + reEscape(own) + String.raw`\s*\(`), window) &&
|
|
1039
|
+
reSearch(pyRe(String.raw`\b(?:private|public|protected|static|fun|override|suspend)\b`), window) &&
|
|
1040
|
+
!reSearch(pyRe(String.raw`\b(?:show|Builder|Dialog)\b`), window)) {
|
|
1041
|
+
dset(n, 'denominator', false);
|
|
1042
|
+
dset(n, 'out_of_scope', 'pseudo-page: declared_at is method ' + own + '()');
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
for (const nid of nodeOrder) {
|
|
1046
|
+
const n = nodes[nid];
|
|
1047
|
+
if (get(n, 'denominator') === false || !['dialog', 'fragment'].includes(get(n, 'kind'))) { continue; }
|
|
1048
|
+
const simple = pySplit(nid, ':', 1).at(-1);
|
|
1049
|
+
if (!reFullmatch(pyRe(String.raw`[A-Z]\w*`), simple)) { continue; }
|
|
1050
|
+
const q = reEscape(simple);
|
|
1051
|
+
const sub = reSearch(pyRe(String.raw`\b(?:extends\s+|:\s*)` + q + String.raw`\s*[({]` +
|
|
1052
|
+
String.raw`|\bextends\s+` + q + String.raw`\b`), blob);
|
|
1053
|
+
if (!sub) { continue; }
|
|
1054
|
+
if (reSearch(pyRe(`\\bnew\\s+${q}\\s*[(<]|\\b${q}\\s*\\.\\s*(?:newInstance|Companion)\\b|\\b${q}::class|\\b${q}\\.class\\b`), blob)) { continue; }
|
|
1055
|
+
let ktBuilt = false;
|
|
1056
|
+
const beforeRe = pyRe(String.raw`(?::|extends|class|fun|public|private|protected|super)\s*$`);
|
|
1057
|
+
for (const mm of finditer(pyRe(String.raw`\b` + q + String.raw`\s*\(`), blob)) {
|
|
1058
|
+
const before = blob.slice(_cpBack(blob, mm.index, 24), mm.index);
|
|
1059
|
+
if (reSearch(beforeRe, before)) { continue; }
|
|
1060
|
+
ktBuilt = true; break;
|
|
1061
|
+
}
|
|
1062
|
+
if (ktBuilt) { continue; }
|
|
1063
|
+
dset(n, 'denominator', false);
|
|
1064
|
+
dset(n, 'out_of_scope', 'base-only: ' + simple + ' is only subclassed, never shown itself');
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
const _GETTER_CALL_SRC = String.raw`(?:\b([A-Z]\w*)\.)?\b(\w+)\s*\(\s*\)`;
|
|
1069
|
+
export const _GETTER_CALL_RE = pyRe(_GETTER_CALL_SRC);
|
|
1070
|
+
export const _PREF_READ_RE = String.raw`\bget(Boolean|String|Int|Long)\s*\(\s*([\w.]+|\"[^\"]+\")\s*,\s*([^)]*)\)`;
|
|
1071
|
+
|
|
1072
|
+
export function _resolveAppSetting(cond, need, project, nodes) {
|
|
1073
|
+
const m = reFullmatch(pyRe(String.raw`\s*(!?)\s*` + _GETTER_CALL_SRC + String.raw`\s*`), pyStr(or0(cond, '')));
|
|
1074
|
+
if (!m || !truthy(project)) { return null; }
|
|
1075
|
+
const negated = m[1] === '!'; const owner = m[2] ?? null; const getter = m[3];
|
|
1076
|
+
const want = negated ? !truthy(need) : truthy(need);
|
|
1077
|
+
const bodies = [];
|
|
1078
|
+
for (const p of _projectSources(project)) {
|
|
1079
|
+
const fwd = p.split('\\').join('/');
|
|
1080
|
+
if (owner && !fwd.endsWith('/' + owner + '.java') && !fwd.endsWith('/' + owner + '.kt')) { continue; }
|
|
1081
|
+
let text;
|
|
1082
|
+
try { text = readTextSmart(p); } catch { continue; }
|
|
1083
|
+
for (const fm of finditer(pyRe(String.raw`\b` + reEscape(getter) + String.raw`\s*\(\s*\)\s*(?::\s*\w+\s*)?\{`), text)) {
|
|
1084
|
+
const fe = fm.index + fm[0].length;
|
|
1085
|
+
const end = text.indexOf('}', fe);
|
|
1086
|
+
bodies.push([text, end === -1 ? text.slice(fe, -1) : text.slice(fe, end)]);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
if (bodies.length !== 1) { return null; }
|
|
1090
|
+
const [text, body] = bodies[0];
|
|
1091
|
+
const rm = reFullmatch(pyRe(String.raw`\s*return\s+\w+\s*\.\s*` + _PREF_READ_RE + String.raw`\s*;?\s*`), body);
|
|
1092
|
+
if (!rm || rm[1] !== 'Boolean') { return null; }
|
|
1093
|
+
let key = rm[2];
|
|
1094
|
+
if (!key.startsWith('"')) {
|
|
1095
|
+
const km = reSearch(pyRe(String.raw`\b` + reEscape(key.split('.').at(-1)) + String.raw`\s*=\s*\"([^\"]+)\"`), text);
|
|
1096
|
+
if (!km) { return null; }
|
|
1097
|
+
key = km[1];
|
|
1098
|
+
}
|
|
1099
|
+
key = pyStrip(key, '"');
|
|
1100
|
+
const rows = [];
|
|
1101
|
+
const keyRe = pyRe(String.raw`android:key\s*=\s*\"` + reEscape(key) + String.raw`\"`);
|
|
1102
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
1103
|
+
const keep = dirs.filter((d) => !['build', '.git', '.gradle'].includes(d));
|
|
1104
|
+
dirs.length = 0; dirs.push(...keep);
|
|
1105
|
+
if (!dirpath.split('\\').join('/').endsWith('/res/xml')) { continue; }
|
|
1106
|
+
for (const fn of files) {
|
|
1107
|
+
if (!fn.endsWith('.xml')) { continue; }
|
|
1108
|
+
let xml;
|
|
1109
|
+
try { xml = readTextSmart(osJoin(dirpath, fn)); } catch { continue; }
|
|
1110
|
+
for (const el of finditer(pyRe(String.raw`<([\w.]*(?:Switch|CheckBox)\w*)\b([^>]*?)/?>`, 's'), xml)) {
|
|
1111
|
+
if (reSearch(keyRe, el[2])) {
|
|
1112
|
+
const title = reSearch(pyRe(String.raw`android:title\s*=\s*\"([^\"]+)\"`), el[2]);
|
|
1113
|
+
const dflt = reSearch(pyRe(String.raw`android:defaultValue\s*=\s*\"(\w+)\"`), el[2]);
|
|
1114
|
+
rows.push([cpSlice(fn, 0, -4), title ? title[1] : null, dflt ? dflt[1] : null]);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
if (rows.length !== 1 || !truthy(rows[0][1])) { return null; }
|
|
1120
|
+
const [xmlName, titleRef, dflt] = rows[0];
|
|
1121
|
+
const hosts = [];
|
|
1122
|
+
const hostRe = pyRe(String.raw`PreferencesFromResource\s*\(\s*R\.xml\.` + reEscape(xmlName) + String.raw`\b`);
|
|
1123
|
+
for (const p of _projectSources(project)) {
|
|
1124
|
+
let t;
|
|
1125
|
+
try { t = readTextSmart(p); } catch { continue; }
|
|
1126
|
+
if (reSearch(hostRe, t)) {
|
|
1127
|
+
const cls = reSearch(pyRe(String.raw`\bclass\s+([A-Z]\w*)`), t);
|
|
1128
|
+
if (cls) { hosts.push(cls[1]); }
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
const screen = keysOf(nodes).filter((nid) => hosts.includes(pySplit(nid, ':', 1).at(-1)));
|
|
1132
|
+
if (screen.length !== 1) { return null; }
|
|
1133
|
+
const isStr = titleRef.startsWith('@string/');
|
|
1134
|
+
const strings = isStr ? loadProjectStrings(project) : {};
|
|
1135
|
+
const title = isStr ? get(strings, pySplit(titleRef, '/', 1)[1]) : titleRef;
|
|
1136
|
+
return { kind: 'app-setting', pref_key: key, value: want, control: 'toggle', row_title: title,
|
|
1137
|
+
row_title_key: titleRef, screen: screen[0], default: dflt,
|
|
1138
|
+
basis: [`${owner || ''}.${getter}()`, `res/xml/${xmlName}.xml#${key}`] };
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
export function _promoteAppSettings(nodes, edges, project) {
|
|
1142
|
+
for (const e of edges) {
|
|
1143
|
+
const g = get(e, 'guard');
|
|
1144
|
+
if (!isObj(g) || get(g, 'kind') !== 'device-env' || !Object.hasOwn(g, 'condition')) { continue; }
|
|
1145
|
+
const facts = _resolveAppSetting(g.condition, get(g, 'need', true), project, nodes);
|
|
1146
|
+
if (truthy(facts)) { dset(e, 'guard', merge(facts, { text: get(g, 'text', '') })); }
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
export function mergeNodeRecords(prev, cur, collisions = null) {
|
|
1151
|
+
if (!truthy(prev)) { return cur; }
|
|
1152
|
+
const pk = pyStr(get(prev, 'kind', '')); const ck = pyStr(get(cur, 'kind', ''));
|
|
1153
|
+
if (pk === 'hybrid-page' && ck === 'hybrid-page') {
|
|
1154
|
+
return mergeHybridNodeRecords(prev, cur);
|
|
1155
|
+
}
|
|
1156
|
+
if (pk === ck || !pk || !ck) { return merge(prev, cur); }
|
|
1157
|
+
let role = null; let ident = null;
|
|
1158
|
+
if (_ROLE_KINDS.has(pk) && !_ROLE_KINDS.has(ck)) { role = prev; ident = cur; }
|
|
1159
|
+
else if (_ROLE_KINDS.has(ck) && !_ROLE_KINDS.has(pk)) { role = cur; ident = prev; }
|
|
1160
|
+
if (role !== null) {
|
|
1161
|
+
const merged = merge(role, ident);
|
|
1162
|
+
dset(merged, 'kind', ident.kind);
|
|
1163
|
+
dset(merged, 'pager_child', true);
|
|
1164
|
+
if (truthy(get(role, 'declared_at'))) { dset(merged, 'pager_declared_at', role.declared_at); }
|
|
1165
|
+
if (collisions !== null) {
|
|
1166
|
+
collisions.push([pyStr(get(cur, 'id', '')), `${pyStr(role.kind)}+${pyStr(ident.kind)}`, 'role folded to attribute']);
|
|
1167
|
+
}
|
|
1168
|
+
return merged;
|
|
1169
|
+
}
|
|
1170
|
+
if (collisions !== null) { collisions.push([pyStr(get(cur, 'id', '')), `${pk}+${ck}`, 'UNRESOLVED']); }
|
|
1171
|
+
return merge(cur, prev);
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/** Python str(x).partition(sep). */
|
|
1175
|
+
function partition(s, sep) {
|
|
1176
|
+
const i = s.indexOf(sep);
|
|
1177
|
+
return i < 0 ? [s, '', ''] : [s.slice(0, i), sep, s.slice(i + sep.length)];
|
|
1178
|
+
}
|
|
1179
|
+
/** os.path.splitext(os.path.basename(p))[0] (Windows: both separators). */
|
|
1180
|
+
function baseStem(p) {
|
|
1181
|
+
const parts = p.split(IS_WIN ? /[\\/]/ : /\//);
|
|
1182
|
+
let b = parts.at(-1);
|
|
1183
|
+
if (IS_WIN && /^[A-Za-z]:/.test(b) && parts.length === 1) { b = b.slice(2); }
|
|
1184
|
+
return splitextStem(b);
|
|
1185
|
+
}
|
|
1186
|
+
const startsWithAny = (s, prefixes) => prefixes.some((p) => s.startsWith(p));
|
|
1187
|
+
const _PAGE_CLASS_RE = pyRe('[A-Z][A-Za-z0-9]*');
|
|
1188
|
+
const _SETCONTENT_ANY_RE = pyRe(String.raw`\b(?:setContentView|setContent)\s*[({]`);
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* _markLibraryActivities(nodes, project): an Activity a manifest declares whose package has no
|
|
1192
|
+
* source directory anywhere in the project comes from a dependency (an SDK's AAR or JAR), so it
|
|
1193
|
+
* is no screen this app owns or migrates: out of the denominator with the reason. Measured
|
|
1194
|
+
* (coolmall): `com.tencent.tauth.AuthActivity`, the QQ login SDK's deep-link entry, declared in
|
|
1195
|
+
* core/common's manifest, stayed an uncovered page with "no observed incoming path".
|
|
1196
|
+
* Only the package is tested (a source file declaring `package com.tencent.tauth`, or that directory under a java/kotlin root), never
|
|
1197
|
+
* names or vendors; a class the project does define, in any module, is kept.
|
|
1198
|
+
*/
|
|
1199
|
+
export function _markLibraryActivities(nodes, project) {
|
|
1200
|
+
if (!truthy(project)) { return []; }
|
|
1201
|
+
const cands = keysOf(nodes).filter((nid) => get(nodes[nid], 'kind') === 'activity'
|
|
1202
|
+
&& get(nodes[nid], 'denominator') !== false && /^[a-z]\w*(?:\.\w+)+\.[A-Z]\w*$/.test(pyStr(or0(get(nodes[nid], 'fqn'), ''))));
|
|
1203
|
+
if (!cands.length) { return []; }
|
|
1204
|
+
// Packages the project's sources declare (`package a.b.c`), so legacy roots (`srcDirs = ['src']`) and
|
|
1205
|
+
// Kotlin dirs that drop the common root package count; plus package dirs under a java/kotlin root,
|
|
1206
|
+
// searched below the project root so a project path that itself contains `/java/` never shifts them.
|
|
1207
|
+
const root = String(project).replace(/\\/g, '/').replace(/\/+$/, '');
|
|
1208
|
+
const pkgDirs = new Set(); const declared = new Set();
|
|
1209
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
1210
|
+
const keep = dirs.filter((d) => !SKIP_WALK.includes(d) && !d.startsWith('.'));
|
|
1211
|
+
dirs.length = 0; dirs.push(...keep);
|
|
1212
|
+
const norm = String(dirpath).replace(/\\/g, '/');
|
|
1213
|
+
const rel = norm.startsWith(root) ? norm.slice(root.length) : norm;
|
|
1214
|
+
const at = rel.search(/\/(?:java|kotlin)\//);
|
|
1215
|
+
if (at >= 0) { pkgDirs.add(rel.slice(at).replace(/^\/(?:java|kotlin)\//, '')); }
|
|
1216
|
+
for (const f of files) {
|
|
1217
|
+
if (!/\.(?:java|kt)$/.test(f)) { continue; }
|
|
1218
|
+
let head = '';
|
|
1219
|
+
try { head = readTextSmart(path.join(dirpath, f)).slice(0, 4096); } catch { continue; }
|
|
1220
|
+
const m = /^\s*package\s+([\w.]+)/m.exec(head);
|
|
1221
|
+
if (m) { declared.add(m[1]); }
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
const marked = [];
|
|
1225
|
+
for (const nid of cands) {
|
|
1226
|
+
const n = nodes[nid];
|
|
1227
|
+
const fqn = pyStr(n.fqn);
|
|
1228
|
+
const pkgName = fqn.slice(0, fqn.lastIndexOf('.'));
|
|
1229
|
+
if (declared.has(pkgName) || pkgDirs.has(pkgName.replace(/\./g, '/'))) { continue; }
|
|
1230
|
+
dset(n, 'denominator', false);
|
|
1231
|
+
dset(n, 'out_of_scope', `library activity: ${fqn} is declared in a manifest but its package has no source in the project (an SDK / dependency screen)`);
|
|
1232
|
+
marked.push(nid);
|
|
1233
|
+
}
|
|
1234
|
+
if (marked.length) { pyPrintErr(`[assemble] ${marked.length} library/SDK activit${marked.length === 1 ? 'y' : 'ies'} excluded from the denominator: ${pyRepr(sortedStr(marked))}`); }
|
|
1235
|
+
return marked;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
export function enrichNodesAndEdges(nodes, edges, project = null, strings = null) {
|
|
1239
|
+
const _fileTextCache = new Map();
|
|
1240
|
+
const _layouts = truthy(project) ? _findLayoutFiles(project) : new Map();
|
|
1241
|
+
if (truthy(project)) { _fileTextCache.set('__project__', project); }
|
|
1242
|
+
|
|
1243
|
+
// --- 0. cross-extractor node alias merge (ONE class = ONE node) ----------
|
|
1244
|
+
const _aliasGroups = new Map();
|
|
1245
|
+
for (const nid of keysOf(nodes)) {
|
|
1246
|
+
const n = nodes[nid];
|
|
1247
|
+
const [prefix, , rest] = partition(pyStr(nid), ':');
|
|
1248
|
+
if (!['fragment', 'dialog', 'overlay'].includes(prefix) || !rest) { continue; }
|
|
1249
|
+
const simple = rest.split('@')[0];
|
|
1250
|
+
if (!reFullmatch(_PAGE_CLASS_RE, simple)) { continue; }
|
|
1251
|
+
const k = tupleKey(simple, pyStr(get(n, 'kind')));
|
|
1252
|
+
if (!_aliasGroups.has(k)) { _aliasGroups.set(k, [simple, []]); }
|
|
1253
|
+
_aliasGroups.get(k)[1].push(nid);
|
|
1254
|
+
}
|
|
1255
|
+
const _aliasOf = new Map();
|
|
1256
|
+
for (const [simple, ids] of _aliasGroups.values()) {
|
|
1257
|
+
if (ids.length < 2) { continue; }
|
|
1258
|
+
const _declFile = (i) => pyRsplit(pyStr(or0(get(nodes[i], 'declared_at'), '')), ':', 1)[0];
|
|
1259
|
+
const own = ids.filter((i) => baseStem(_declFile(i)) === simple);
|
|
1260
|
+
const files = new Set(ids.map(_declFile));
|
|
1261
|
+
let canon;
|
|
1262
|
+
if (own.length) {
|
|
1263
|
+
const _rank = { fragment: 0, dialog: 1, overlay: 2 };
|
|
1264
|
+
canon = sortedBy(own, (i) => get(_rank, pyStr(i).split(':')[0], 9))[0];
|
|
1265
|
+
} else if (files.size === 1) {
|
|
1266
|
+
canon = sortedStr(ids)[0];
|
|
1267
|
+
} else { continue; }
|
|
1268
|
+
for (const i of ids) { if (i !== canon) { _aliasOf.set(i, canon); } }
|
|
1269
|
+
}
|
|
1270
|
+
if (_aliasOf.size) {
|
|
1271
|
+
for (const e of edges) {
|
|
1272
|
+
for (const end of ['source', 'target']) {
|
|
1273
|
+
if (_aliasOf.has(get(e, end))) { dset(e, end, _aliasOf.get(e[end])); }
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
for (const [dup, canon] of _aliasOf) {
|
|
1277
|
+
for (const k of keysOf(nodes[dup])) {
|
|
1278
|
+
const v = nodes[dup][k];
|
|
1279
|
+
if (k !== 'id' && k !== 'kind' && !truthy(get(nodes[canon], k)) && truthy(v)) { dset(nodes[canon], k, v); }
|
|
1280
|
+
}
|
|
1281
|
+
delete nodes[dup];
|
|
1282
|
+
}
|
|
1283
|
+
const al = sortedStr(_aliasOf.keys());
|
|
1284
|
+
pyPrintErr(`[assemble] merged ${_aliasOf.size} duplicate node(s) emitted for the ` +
|
|
1285
|
+
`same class under different id prefixes (edges re-pointed): ` +
|
|
1286
|
+
`${pyRepr(al.slice(0, 8))}${_aliasOf.size > 8 ? ' …' : ''}`);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// --- 1. host-activity downgrade -----------------------------------------
|
|
1290
|
+
const _CONTENT_MECHANISMS = ['fragment-transaction', 'fragment-embed', 'compose-navigate',
|
|
1291
|
+
'compose-navigate-param', 'nav-component-action', 'voyager-push', 'view-swap'];
|
|
1292
|
+
const _CONTENT_KINDS = ['compose-route', 'fragment', 'voyager-screen', 'view-page'];
|
|
1293
|
+
const _hosted = new Map();
|
|
1294
|
+
for (const e of edges) {
|
|
1295
|
+
const src = get(e, 'source'); const tgt = get(e, 'target');
|
|
1296
|
+
if (!pyIn(src, nodes) || !pyIn(tgt, nodes) || src === tgt) { continue; }
|
|
1297
|
+
if (pyStr(get(nodes[src], 'kind', '')) !== 'activity') { continue; }
|
|
1298
|
+
if (!_CONTENT_MECHANISMS.includes(get(e, 'mechanism'))) { continue; }
|
|
1299
|
+
if (startsWithAny(pyStr(get(nodes[tgt], 'kind', '')), _CONTENT_KINDS)) {
|
|
1300
|
+
if (!_hosted.has(src)) { _hosted.set(src, new Set()); }
|
|
1301
|
+
_hosted.get(src).add(tgt);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
for (const nid of keysOf(nodes)) {
|
|
1305
|
+
const n = nodes[nid];
|
|
1306
|
+
if (get(n, 'kind') !== 'activity') { continue; }
|
|
1307
|
+
if ((_hosted.get(nid)?.size ?? 0) >= 3) {
|
|
1308
|
+
dset(n, 'kind', 'host-activity');
|
|
1309
|
+
dset(n, 'denominator', false);
|
|
1310
|
+
dset(n, 'page_like', false);
|
|
1311
|
+
dset(n, 'hosts_pages', _hosted.get(nid).size);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
// --- 1a-pre. UI-less LAUNCH SHELL (splash) ------------------------------
|
|
1316
|
+
if (truthy(project)) {
|
|
1317
|
+
const _shellSrc = _sourceIndex(project, _fileTextCache);
|
|
1318
|
+
const _shells = [];
|
|
1319
|
+
for (const nid of keysOf(nodes)) {
|
|
1320
|
+
const n = nodes[nid];
|
|
1321
|
+
if (!['activity', 'host-activity'].includes(get(n, 'kind'))) { continue; }
|
|
1322
|
+
if (get(n, 'denominator') === false) { continue; }
|
|
1323
|
+
const short = pySplit(pyStr(nid), ':', 1).at(-1);
|
|
1324
|
+
const src = _shellSrc.get(short);
|
|
1325
|
+
if (!truthy(src)) { continue; }
|
|
1326
|
+
if (reSearch(_SETCONTENT_ANY_RE, src)) { continue; }
|
|
1327
|
+
if (declaresOwnLayout(src)) { continue; }
|
|
1328
|
+
if (!edges.some((e) => get(e, 'source') === nid)) { continue; }
|
|
1329
|
+
dset(n, 'denominator', false);
|
|
1330
|
+
dset(n, 'page_like', false);
|
|
1331
|
+
dset(n, 'ui_less_shell', true);
|
|
1332
|
+
_shells.push(nid);
|
|
1333
|
+
}
|
|
1334
|
+
if (_shells.length) {
|
|
1335
|
+
pyPrintErr(`[assemble] ${_shells.length} UI-less launch shell(s) excluded from the ` +
|
|
1336
|
+
`denominator (renders no layout of its own — nothing to ` +
|
|
1337
|
+
`screenshot): ${pyRepr(sortedStr(_shells))}`);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
// --- 1a-sdk. library / SDK Activity: declared in a manifest, no source of its own ----------
|
|
1342
|
+
_markLibraryActivities(nodes, project);
|
|
1343
|
+
|
|
1344
|
+
// --- 1a. dead Activity: non-launcher, not exported, with NO inbound edge --
|
|
1345
|
+
const indeg = new Map();
|
|
1346
|
+
for (const e of edges) { indeg.set(e.target, (indeg.get(e.target) ?? 0) + 1); }
|
|
1347
|
+
for (const nid of keysOf(nodes)) {
|
|
1348
|
+
const n = nodes[nid];
|
|
1349
|
+
if (get(n, 'kind') !== 'activity') { continue; }
|
|
1350
|
+
if (get(n, 'status') === 'unreachable') { continue; }
|
|
1351
|
+
const hint = or0(get(n, 'launch_hint'), {});
|
|
1352
|
+
const isLauncher = (isObj(hint) && Object.hasOwn(hint, 'is_launcher')) ? truthy(hint.is_launcher)
|
|
1353
|
+
: pyStr(hint).toUpperCase().includes('LAUNCHER');
|
|
1354
|
+
let exported = get(n, 'exported');
|
|
1355
|
+
if (isObj(hint) && (exported === null || exported === undefined)) { exported = get(hint, 'exported'); }
|
|
1356
|
+
if (!isLauncher && !truthy(exported) && (indeg.get(nid) ?? 0) === 0) {
|
|
1357
|
+
dset(n, 'status', 'unreachable');
|
|
1358
|
+
dset(n, 'unreachable_reason', 'non-launcher, not exported, no inbound edge (only in-app ' +
|
|
1359
|
+
'launch site removed/commented in current source)');
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
// --- 1b. multi-page container Activities (ViewPager2 / pager fragments) ---
|
|
1365
|
+
const pagerChildCount = new Map();
|
|
1366
|
+
for (const e of edges) {
|
|
1367
|
+
if (get(e, 'mechanism') === 'pager-swipe') {
|
|
1368
|
+
const tgt = get(nodes, get(e, 'target'), {});
|
|
1369
|
+
if (pyStr(get(tgt, 'kind', '')) === 'pager-page' || get(tgt, 'pager_child') === true) {
|
|
1370
|
+
const s = get(e, 'source');
|
|
1371
|
+
pagerChildCount.set(s, (pagerChildCount.get(s) ?? 0) + 1);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
for (const [nid, cnt] of pagerChildCount) {
|
|
1376
|
+
const n = get(nodes, nid);
|
|
1377
|
+
if (truthy(n) && get(n, 'kind') === 'activity' && cnt >= 2) {
|
|
1378
|
+
dset(n, 'kind', 'host-activity');
|
|
1379
|
+
dset(n, 'denominator', false);
|
|
1380
|
+
dset(n, 'page_like', false);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
// --- 1c. shared dialog-host Activities (host-indirection architecture) ---
|
|
1385
|
+
const dialogPageCount = Object.values(nodes).filter((n) => ['dialog', 'sheet', 'menu'].includes(pyStr(get(n, 'kind', '')))).length;
|
|
1386
|
+
if (dialogPageCount >= 3) {
|
|
1387
|
+
for (const nid of keysOf(nodes)) {
|
|
1388
|
+
const n = nodes[nid];
|
|
1389
|
+
if (get(n, 'kind') !== 'activity') { continue; }
|
|
1390
|
+
const name = pyStr(get(n, 'id', '')) + ' ' + pyStr(get(n, 'launch_hint', ''));
|
|
1391
|
+
if (nid.includes('DialogActivity') || lower(name).includes('host-indirection')) {
|
|
1392
|
+
dset(n, 'kind', 'host-activity');
|
|
1393
|
+
dset(n, 'denominator', false);
|
|
1394
|
+
dset(n, 'page_like', false);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
// --- 1d. abstract Fragment nodes: NOT a page — remove, record as attribute -
|
|
1400
|
+
const _abstractIds = new Set(keysOf(nodes).filter((nid) => truthy(get(nodes[nid], 'abstract')) &&
|
|
1401
|
+
['fragment', 'dialog'].includes(pyStr(get(nodes[nid], 'kind', '')))));
|
|
1402
|
+
if (_abstractIds.size) {
|
|
1403
|
+
const _baseSimple = new Set([..._abstractIds].map((nid) => pySplit(nid, ':', 1).at(-1)));
|
|
1404
|
+
for (const nid of keysOf(nodes)) {
|
|
1405
|
+
if (_abstractIds.has(nid)) { continue; }
|
|
1406
|
+
const n = nodes[nid];
|
|
1407
|
+
const hint = get(n, 'launch_hint');
|
|
1408
|
+
if (typeof hint !== 'string' || !hint.includes('base:')) { continue; }
|
|
1409
|
+
const base = pyStrip(pySplit(hint, 'base:', 1).at(-1).split(';')[0]);
|
|
1410
|
+
if (_baseSimple.has(base)) { dset(n, 'extends_base', base); }
|
|
1411
|
+
}
|
|
1412
|
+
const _keptEdges = []; let _dropped = 0;
|
|
1413
|
+
for (const e of edges) {
|
|
1414
|
+
if (_abstractIds.has(get(e, 'source')) || _abstractIds.has(get(e, 'target'))) {
|
|
1415
|
+
_dropped++;
|
|
1416
|
+
pyPrintErr(`[assemble] drop CHA-noise edge touching abstract ` +
|
|
1417
|
+
`${pyStr(get(e, 'source'))} -> ${pyStr(get(e, 'target'))} (${pyStr(get(e, 'mechanism'))})`);
|
|
1418
|
+
continue;
|
|
1419
|
+
}
|
|
1420
|
+
_keptEdges.push(e);
|
|
1421
|
+
}
|
|
1422
|
+
edges.length = 0; edges.push(..._keptEdges);
|
|
1423
|
+
for (const nid of _abstractIds) { delete nodes[nid]; }
|
|
1424
|
+
pyPrintErr(`[assemble] removed ${_abstractIds.size} abstract Fragment node(s) ` +
|
|
1425
|
+
`(not a page); dropped ${_dropped} edge(s) touching them`);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
_markOutOfScope(nodes, edges, project);
|
|
1429
|
+
_promoteAppSettings(nodes, edges, project);
|
|
1430
|
+
|
|
1431
|
+
// --- 1e. fragment containment fold (embedded child = same screen) --------
|
|
1432
|
+
for (const e of edges) {
|
|
1433
|
+
if (get(e, 'mechanism') !== 'fragment-embed') { continue; }
|
|
1434
|
+
if (pyStr(get(argsOf(e), 'relation')) !== 'containment') { continue; }
|
|
1435
|
+
const hostId = get(e, 'source'); const childId = get(e, 'target');
|
|
1436
|
+
const host = get(nodes, hostId); const child = get(nodes, childId);
|
|
1437
|
+
if (child !== null && child !== undefined) {
|
|
1438
|
+
dset(child, 'role', 'embedded');
|
|
1439
|
+
dset(child, 'denominator', false);
|
|
1440
|
+
dset(child, 'page_like', false);
|
|
1441
|
+
dset(child, 'fullscreen', false);
|
|
1442
|
+
dset(child, 'embedded_in', hostId);
|
|
1443
|
+
}
|
|
1444
|
+
if (host !== null && host !== undefined) {
|
|
1445
|
+
setdefault(host, 'contains', []);
|
|
1446
|
+
if (!pyIn(childId, host.contains)) { host.contains.push(childId); }
|
|
1447
|
+
dset(host, 'fullscreen', true);
|
|
1448
|
+
if (['fragment', 'activity'].includes(pyStr(get(host, 'kind', ''))) && get(host, 'denominator') !== false) {
|
|
1449
|
+
dset(host, 'role', 'screen');
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
// --- 1f. UI-less container Activity fold --------------------------------
|
|
1455
|
+
_foldUilessHosts(nodes, edges, _layouts, _fileTextCache, project);
|
|
1456
|
+
_markTransientEntries(nodes, edges);
|
|
1457
|
+
|
|
1458
|
+
// --- 1g. shared-primitive overlay fold (wrapper != page) ------------------
|
|
1459
|
+
const _MANDATORY_COMPOSABLE_PARAM_RE = pyRe(String.raw`^\s*\w+\s*:\s*@Composable\b`);
|
|
1460
|
+
const _splitTopLevelParams = (params) => {
|
|
1461
|
+
const segs = []; let depth = 0; let start = 0;
|
|
1462
|
+
for (let i = 0; i < params.length; i++) {
|
|
1463
|
+
const c = params[i];
|
|
1464
|
+
if ('([{'.includes(c)) { depth++; } else if (')]}'.includes(c)) { depth--; }
|
|
1465
|
+
else if (c === ',' && depth === 0) { segs.push(params.slice(start, i)); start = i + 1; }
|
|
1466
|
+
}
|
|
1467
|
+
segs.push(params.slice(start));
|
|
1468
|
+
return segs;
|
|
1469
|
+
};
|
|
1470
|
+
const _paramIsMandatoryComposable = (seg) => {
|
|
1471
|
+
if (!reMatch(_MANDATORY_COMPOSABLE_PARAM_RE, seg)) { return false; }
|
|
1472
|
+
let depth = 0;
|
|
1473
|
+
for (const c of seg) {
|
|
1474
|
+
if ('([{'.includes(c)) { depth++; } else if (')]}'.includes(c)) { depth--; }
|
|
1475
|
+
else if (c === '=' && depth === 0) { return false; }
|
|
1476
|
+
}
|
|
1477
|
+
return true;
|
|
1478
|
+
};
|
|
1479
|
+
const _isContentWrapper = (n) => {
|
|
1480
|
+
const decl = or0(get(n, 'declared_at'), '');
|
|
1481
|
+
if (!decl.includes(':')) { return false; }
|
|
1482
|
+
const ci = decl.lastIndexOf(':');
|
|
1483
|
+
const p = decl.slice(0, ci); const lineS = decl.slice(ci + 1);
|
|
1484
|
+
const line = pyIntOrNull(lineS);
|
|
1485
|
+
if (line === null) { return false; }
|
|
1486
|
+
const fullPath = pIsAbs(p) ? p : (truthy(project) ? osJoin(project, p) : null);
|
|
1487
|
+
if (!fullPath || !osExists(fullPath)) { return false; }
|
|
1488
|
+
let text = _fileTextCache.has(fullPath) ? _fileTextCache.get(fullPath) : null;
|
|
1489
|
+
if (text === null || text === undefined) {
|
|
1490
|
+
try { text = readTextSmart(fullPath); } catch { text = ''; }
|
|
1491
|
+
_fileTextCache.set(fullPath, text);
|
|
1492
|
+
}
|
|
1493
|
+
if (!text) { return false; }
|
|
1494
|
+
const lines = text.split('\n');
|
|
1495
|
+
if (line < 1 || line > lines.length) { return false; }
|
|
1496
|
+
let charPos = 0;
|
|
1497
|
+
for (const l of lines.slice(0, line - 1)) { charPos += l.length + 1; }
|
|
1498
|
+
const paren = text.indexOf('(', charPos);
|
|
1499
|
+
if (paren === -1) { return false; }
|
|
1500
|
+
let depth = 0; let i = paren; let params = null;
|
|
1501
|
+
while (i < text.length) {
|
|
1502
|
+
if (text[i] === '(') { depth++; } else if (text[i] === ')') {
|
|
1503
|
+
depth--;
|
|
1504
|
+
if (depth === 0) { params = text.slice(paren + 1, i); break; }
|
|
1505
|
+
}
|
|
1506
|
+
i++;
|
|
1507
|
+
}
|
|
1508
|
+
if (params === null) { return false; }
|
|
1509
|
+
return _splitTopLevelParams(params).some(_paramIsMandatoryComposable);
|
|
1510
|
+
};
|
|
1511
|
+
const _primitiveFolded = [];
|
|
1512
|
+
for (const nid of keysOf(nodes)) {
|
|
1513
|
+
const n = nodes[nid];
|
|
1514
|
+
if (!['dialog', 'sheet', 'menu'].includes(pyStr(get(n, 'kind', '')))) { continue; }
|
|
1515
|
+
if (_isContentWrapper(n)) {
|
|
1516
|
+
dset(n, 'role', 'primitive');
|
|
1517
|
+
dset(n, 'denominator', false);
|
|
1518
|
+
dset(n, 'page_like', false);
|
|
1519
|
+
_primitiveFolded.push(nid);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
if (_primitiveFolded.length) {
|
|
1523
|
+
pyPrintErr(`[assemble] folded ${_primitiveFolded.length} shared-primitive ` +
|
|
1524
|
+
`overlay node(s) (wrapper, not a page): ${pyRepr(_primitiveFolded)}`);
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
// --- 2. parameterized-route instance metadata ---------------------------
|
|
1528
|
+
for (const nid of keysOf(nodes)) {
|
|
1529
|
+
const n = nodes[nid];
|
|
1530
|
+
const kind = get(n, 'kind', '');
|
|
1531
|
+
if (!pyStr(kind).startsWith('compose-route')) { continue; }
|
|
1532
|
+
const routeKey = pySplit(pyStr(nid), ':', 1).at(-1).split('#')[0];
|
|
1533
|
+
if (_hasToken(routeKey, _INSTANCE_ROUTE_SUFFIXES)) {
|
|
1534
|
+
dset(n, 'requires_instance', true);
|
|
1535
|
+
dset(n, 'do_not_crawl_directly', true);
|
|
1536
|
+
const base = routeKey.split('_CONTENT').join('').split('_DETAIL').join('').split('_PATH').join('').split('_INFO').join('');
|
|
1537
|
+
dset(n, 'instance_collection', lower(base));
|
|
1538
|
+
setdefault(n, 'required_state', []);
|
|
1539
|
+
if (!pyIn('content', n.required_state)) { n.required_state.push('content'); }
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
// --- 2b. the View/Activity form of the same fact -------------------------
|
|
1544
|
+
for (const e of edges) {
|
|
1545
|
+
const args = argsOf(e);
|
|
1546
|
+
if (!truthy(get(args, 'passes_item_data'))) { continue; }
|
|
1547
|
+
const tgt = get(nodes, get(e, 'target'));
|
|
1548
|
+
if (!truthy(tgt) || truthy(get(tgt, 'requires_instance'))) { continue; }
|
|
1549
|
+
dset(tgt, 'requires_instance', true);
|
|
1550
|
+
dset(tgt, 'do_not_crawl_directly', true);
|
|
1551
|
+
const coll = pyStr(or0(get(args, 'item_collection'), ''));
|
|
1552
|
+
if (coll) { dset(tgt, 'instance_collection', coll); }
|
|
1553
|
+
dset(tgt, 'instance_evidence', or0(get(e, 'trigger'), or0(get(args, 'trigger'), '')));
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
// --- 3. page-identity invariant -----------------------------------------
|
|
1557
|
+
const inboundLabels = new Map();
|
|
1558
|
+
for (const e of edges) {
|
|
1559
|
+
const tgt = get(e, 'target');
|
|
1560
|
+
const args = argsOf(e);
|
|
1561
|
+
const lab = get(args, 'label');
|
|
1562
|
+
if (truthy(get(args, 'label_ambiguous')) || pyStr(or0(get(args, 'label_source'), '')).endsWith('-ambiguous')) { continue; }
|
|
1563
|
+
if (truthy(tgt) && truthy(lab) && _isScreenText(lab)) {
|
|
1564
|
+
if (!inboundLabels.has(tgt)) { inboundLabels.set(tgt, []); }
|
|
1565
|
+
if (!pyIn(lab, inboundLabels.get(tgt))) { inboundLabels.get(tgt).push(lab); }
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
const fnIndex = truthy(project) ? _buildFnDeclarationIndex(project) : new Map();
|
|
1570
|
+
strings = strings !== null && strings !== undefined ? strings : (truthy(project) ? loadProjectStrings(project) : {});
|
|
1571
|
+
|
|
1572
|
+
const _ownTitle = (n) => {
|
|
1573
|
+
const label = or0(get(n, 'label'), '');
|
|
1574
|
+
const loc = fnIndex.get(label);
|
|
1575
|
+
if (!truthy(loc)) { return null; }
|
|
1576
|
+
const [p, declPos] = loc;
|
|
1577
|
+
let text = _fileTextCache.has(p) ? _fileTextCache.get(p) : null;
|
|
1578
|
+
if (text === null || text === undefined) {
|
|
1579
|
+
try { text = readTextSmart(p); } catch { text = ''; }
|
|
1580
|
+
_fileTextCache.set(p, text);
|
|
1581
|
+
}
|
|
1582
|
+
if (!text) { return null; }
|
|
1583
|
+
const [val] = pageOwnTitle(text, declPos, strings);
|
|
1584
|
+
return val;
|
|
1585
|
+
};
|
|
1586
|
+
const _ownTitleAny = (n) => {
|
|
1587
|
+
const v = _ownTitle(n);
|
|
1588
|
+
if (truthy(v)) { return v; }
|
|
1589
|
+
return _viewOwnTitle(n, _layouts, strings, _fileTextCache);
|
|
1590
|
+
};
|
|
1591
|
+
const _declaredTitleClaim = new Map();
|
|
1592
|
+
const expOf = (n) => or0(get(n, 'expected'), {});
|
|
1593
|
+
const listOf = (v) => (truthy(v) ? v : []);
|
|
1594
|
+
|
|
1595
|
+
for (const nid of keysOf(nodes)) {
|
|
1596
|
+
const n = nodes[nid];
|
|
1597
|
+
const kind = get(n, 'kind', '');
|
|
1598
|
+
if (['host-activity', 'unknown', 'sentinel'].includes(kind)) { continue; }
|
|
1599
|
+
const existing = listOf(get(expOf(n), 'title_any'));
|
|
1600
|
+
const pos = [];
|
|
1601
|
+
const own = _ownTitleAny(n);
|
|
1602
|
+
if (truthy(own) && cpLen(own) <= 30) {
|
|
1603
|
+
pos.push(own);
|
|
1604
|
+
if (!_declaredTitleClaim.has(own)) { _declaredTitleClaim.set(own, new Set()); }
|
|
1605
|
+
_declaredTitleClaim.get(own).add(nid);
|
|
1606
|
+
}
|
|
1607
|
+
for (const e of existing) { if (!pyIn(e, pos)) { pos.push(e); } }
|
|
1608
|
+
let lab = or0(get(n, 'label'), '');
|
|
1609
|
+
if (truthy(get(n, 'label_synthetic'))) { lab = ''; }
|
|
1610
|
+
if (_isScreenText(lab) && !pyIn(lab, pos)) { pos.push(lab); }
|
|
1611
|
+
for (const tok of listOf(get(n, 'identity_text'))) {
|
|
1612
|
+
if (_isScreenText(tok) && !pyIn(tok, pos)) { pos.push(tok); }
|
|
1613
|
+
}
|
|
1614
|
+
const hints = [];
|
|
1615
|
+
for (const il of listOf(get(expOf(n), 'hint_any'))) {
|
|
1616
|
+
if (truthy(il) && !pyIn(il, pos) && !pyIn(il, hints)) { hints.push(il); }
|
|
1617
|
+
}
|
|
1618
|
+
for (const il of (inboundLabels.get(nid) ?? [])) {
|
|
1619
|
+
if (!pyIn(il, pos) && !pyIn(il, hints)) { hints.push(il); }
|
|
1620
|
+
}
|
|
1621
|
+
if (pos.length || hints.length) {
|
|
1622
|
+
const exp = {};
|
|
1623
|
+
if (pos.length) { exp.title_any = pos; }
|
|
1624
|
+
if (hints.length) { exp.hint_any = hints; }
|
|
1625
|
+
dset(n, 'expected', exp);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
// --- 3c. STRONG-tier uniqueness -----------------------------------------
|
|
1630
|
+
const _claims = new Map();
|
|
1631
|
+
for (const nid of keysOf(nodes)) {
|
|
1632
|
+
for (const tok of listOf(get(expOf(nodes[nid]), 'title_any'))) {
|
|
1633
|
+
if (!_claims.has(tok)) { _claims.set(tok, []); }
|
|
1634
|
+
_claims.get(tok).push(nid);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
let _demotedTokens = 0; const _demotedNodes = new Set();
|
|
1638
|
+
for (const [tok, claimants] of _claims) {
|
|
1639
|
+
if (claimants.length < 2) { continue; }
|
|
1640
|
+
// Instances of one parameterized template that pass it the same title (a cancel-reason sheet
|
|
1641
|
+
// opened from three pages) are twins the explorer settles by their opener (shared-title-twin);
|
|
1642
|
+
// demoting the title left each with only a review hint (measured, coolmall 2026-11-16).
|
|
1643
|
+
const tpl = new Set(claimants.map((nid) => get(nodes[nid], 'template_of') ?? null));
|
|
1644
|
+
if (tpl.size === 1 && !tpl.has(null)) { continue; }
|
|
1645
|
+
const owners = _declaredTitleClaim.get(tok) ?? new Set();
|
|
1646
|
+
const keeper = owners.size === 1 ? [...owners][0] : null;
|
|
1647
|
+
for (const nid of claimants) {
|
|
1648
|
+
if (nid === keeper) { continue; }
|
|
1649
|
+
const n = nodes[nid];
|
|
1650
|
+
const exp = copyDict(expOf(n));
|
|
1651
|
+
const strong = listOf(get(exp, 'title_any')).filter((t) => !pyEq(t, tok));
|
|
1652
|
+
const hints = [...listOf(get(exp, 'hint_any'))];
|
|
1653
|
+
if (!pyIn(tok, hints)) { hints.push(tok); }
|
|
1654
|
+
if (strong.length) { dset(exp, 'title_any', strong); } else { delete exp.title_any; }
|
|
1655
|
+
dset(exp, 'hint_any', hints);
|
|
1656
|
+
dset(n, 'expected', exp);
|
|
1657
|
+
_demotedTokens++;
|
|
1658
|
+
_demotedNodes.add(nid);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
if (_demotedTokens) {
|
|
1662
|
+
pyPrintErr(` [identity] demoted ${_demotedTokens} non-unique STRONG token(s) ` +
|
|
1663
|
+
`across ${_demotedNodes.size} node(s) to hint_any`);
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
// --- 3b. identity inheritance for variant / parameterized routes --------
|
|
1667
|
+
const _titleAny = (nodeId) => [...listOf(get(expOf(or0(get(nodes, nodeId), {})), 'title_any'))];
|
|
1668
|
+
const _baseRouteId = (nid) => {
|
|
1669
|
+
const n = or0(get(nodes, nid), {});
|
|
1670
|
+
const vof = get(n, 'variant_of');
|
|
1671
|
+
if (truthy(vof)) { return vof; }
|
|
1672
|
+
if (pyStr(nid).startsWith('compose-route:')) {
|
|
1673
|
+
const key = pySplit(pyStr(nid), ':', 1).at(-1).split('#')[0];
|
|
1674
|
+
let baseKey = key;
|
|
1675
|
+
for (const suf of _INSTANCE_ROUTE_SUFFIXES) {
|
|
1676
|
+
if (baseKey.endsWith(suf)) { baseKey = baseKey.slice(0, -suf.length); break; }
|
|
1677
|
+
}
|
|
1678
|
+
if (baseKey !== key) {
|
|
1679
|
+
const cand = 'compose-route:' + baseKey;
|
|
1680
|
+
if (pyIn(cand, nodes)) { return cand; }
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
return null;
|
|
1684
|
+
};
|
|
1685
|
+
for (const nid of keysOf(nodes)) {
|
|
1686
|
+
const n = nodes[nid];
|
|
1687
|
+
const ownTokens = listOf(get(expOf(n), 'title_any'));
|
|
1688
|
+
if (ownTokens.length && !truthy(get(n, 'label_synthetic'))) { continue; }
|
|
1689
|
+
const base = _baseRouteId(nid);
|
|
1690
|
+
if (!truthy(base)) { continue; }
|
|
1691
|
+
const inherited = _titleAny(base);
|
|
1692
|
+
if (inherited.length) {
|
|
1693
|
+
const exp = copyDict(expOf(n));
|
|
1694
|
+
const hints = [...listOf(get(exp, 'hint_any'))];
|
|
1695
|
+
for (const tok of inherited) { if (!pyIn(tok, hints) && !pyIn(tok, ownTokens)) { hints.push(tok); } }
|
|
1696
|
+
if (hints.length) { dset(exp, 'hint_any', hints); }
|
|
1697
|
+
dset(n, 'expected', exp);
|
|
1698
|
+
setdefault(n, 'expected_from', base);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
// --- 3z. uniform pager page ---------------------------------------------
|
|
1703
|
+
const _pagerFns = ['createFragment', 'getItem', 'instantiateItem'];
|
|
1704
|
+
const _bySrc = new Map();
|
|
1705
|
+
for (const e of edges) {
|
|
1706
|
+
const scope = pyStr(get(argsOf(e), 'commit_scope', ''));
|
|
1707
|
+
if (_pagerFns.some((f) => scope.endsWith(':' + f))) {
|
|
1708
|
+
if (!_bySrc.has(e.source)) { _bySrc.set(e.source, new Set()); }
|
|
1709
|
+
_bySrc.get(e.source).add(e.target);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
let _uniform = 0; const _pos0 = new Map();
|
|
1713
|
+
for (const src of _bySrc.keys()) {
|
|
1714
|
+
if (_bySrc.get(src).size > 1 && truthy(project)) {
|
|
1715
|
+
const first = _pagerPositionZero(edges, src, project, _pagerFns);
|
|
1716
|
+
if (truthy(first)) { _pos0.set(src, first); }
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
for (const e of edges) {
|
|
1720
|
+
const a = argsOf(e);
|
|
1721
|
+
const scope = pyStr(get(a, 'commit_scope', ''));
|
|
1722
|
+
if (!_pagerFns.some((f) => scope.endsWith(':' + f)) || get(a, 'action') === 'default') { continue; }
|
|
1723
|
+
if ((_bySrc.get(e.source)?.size ?? 0) === 1) { dset(a, 'via', 'pager-uniform'); }
|
|
1724
|
+
else if (_pos0.get(e.source) === e.target) { dset(a, 'via', 'pager-position-0'); }
|
|
1725
|
+
else { continue; }
|
|
1726
|
+
dset(a, 'action', 'default');
|
|
1727
|
+
delete a.needs_trigger;
|
|
1728
|
+
dset(e, 'args', a);
|
|
1729
|
+
_uniform++;
|
|
1730
|
+
}
|
|
1731
|
+
if (_uniform) { pyPrintErr(`[assemble] pager default pages marked: ${_uniform}`); }
|
|
1732
|
+
|
|
1733
|
+
// --- 4. guard backfill from route key -----------------------------------
|
|
1734
|
+
const _MODAL_KINDS = ['sheet-screen', 'dialog', 'sheet', 'menu', 'mode'];
|
|
1735
|
+
for (const e of edges) {
|
|
1736
|
+
if (truthy(get(e, 'guard'))) { continue; }
|
|
1737
|
+
const tw = _branchGuard(e, project);
|
|
1738
|
+
if (truthy(tw)) { dset(e, 'guard', tw); continue; }
|
|
1739
|
+
const mech = get(e, 'mechanism');
|
|
1740
|
+
if (mech === 'enter-mode') {
|
|
1741
|
+
dset(e, 'guard', { text: 'inferred:selection-mode-needs-content', kind: 'data-state' });
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1744
|
+
if (mech === 'pager-swipe') {
|
|
1745
|
+
const srcKind = pyStr(get(get(nodes, get(e, 'source'), {}), 'kind', ''));
|
|
1746
|
+
if (_MODAL_KINDS.includes(srcKind)) {
|
|
1747
|
+
dset(e, 'guard', { text: 'inferred:media-session-pager', kind: 'data-state' });
|
|
1748
|
+
continue;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
const tgt = get(e, 'target', '');
|
|
1752
|
+
const routeKey = pySplit(pyStr(tgt), ':', 1).at(-1).split('#')[0];
|
|
1753
|
+
let kind = null;
|
|
1754
|
+
if (_hasToken(routeKey, _PAY_ROUTE_TOKENS)) { kind = 'pay'; }
|
|
1755
|
+
else if (_hasToken(routeKey, _ENV_ROUTE_TOKENS)) { kind = 'build-flavor'; }
|
|
1756
|
+
else if (_hasToken(routeKey, _LOGIN_ROUTE_TOKENS)) { kind = 'login'; }
|
|
1757
|
+
else if (_hasToken(routeKey, _INSTANCE_ROUTE_SUFFIXES)) { kind = 'data-state'; }
|
|
1758
|
+
if (kind) {
|
|
1759
|
+
const guard = { text: `inferred:${routeKey}`, kind };
|
|
1760
|
+
if (kind === 'login' && _isAuthEntryRoute(routeKey)) { dset(guard, 'polarity', 'logged-out'); }
|
|
1761
|
+
dset(e, 'guard', guard);
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
// --- 4b. centralized login interceptor (route_interceptor.mjs) ----------
|
|
1766
|
+
// Runs after the backfill so a pay / data-state guard an edge already earned is kept; the login
|
|
1767
|
+
// precondition then rides on the protected node's required_state instead.
|
|
1768
|
+
if (truthy(project)) {
|
|
1769
|
+
const found = findLoginInterceptor(_projectSources(project), _LOGIN_TEST_RE, readTextSmart, routeResolver(nodes), project);
|
|
1770
|
+
if (found && found.refused) {
|
|
1771
|
+
pyPrintErr(`[assemble] login interceptor refused: ${found.refused}`);
|
|
1772
|
+
} else if (found) {
|
|
1773
|
+
const r = applyLoginInterceptor(nodes, edges, found, project);
|
|
1774
|
+
if (r.skipped) { pyPrintErr(`[assemble] login interceptor skipped: ${r.skipped}`); }
|
|
1775
|
+
else {
|
|
1776
|
+
pyPrintErr(`[assemble] login interceptor: ${r.nodes.length} protected route(s), ${r.edges} edge guard(s)` +
|
|
1777
|
+
(r.unmatched.length ? `, unmatched: ${r.unmatched.join(', ')}` : ''));
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
// --- 5. label backfill from framework-declared sources -------------------
|
|
1783
|
+
_backfillFrameworkLabels(nodes, edges, project);
|
|
1784
|
+
// --- 6. locale variants --------------------------------------------------
|
|
1785
|
+
_stampLabelVariants(edges, project);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
/** Shallow dict(d) keeping Python key order. */
|
|
1789
|
+
function copyDict(d) { const o = {}; for (const k of keysOf(d)) { dset(o, k, d[k]); } return o; }
|
|
1790
|
+
|
|
1791
|
+
export function _backfillFrameworkLabels(nodes, edges, project) {
|
|
1792
|
+
const strings = truthy(project) ? _loadBaseStrings(project) : {};
|
|
1793
|
+
let localized = {};
|
|
1794
|
+
if (truthy(project)) {
|
|
1795
|
+
try { localized = or0(loadProjectStrings(project), {}); } catch { localized = {}; }
|
|
1796
|
+
}
|
|
1797
|
+
const actLabel = new Map();
|
|
1798
|
+
if (truthy(project)) {
|
|
1799
|
+
const actRe = pyRe(String.raw`<activity\b(.*?)(?:/>|</activity>)`, 's');
|
|
1800
|
+
for (const [dp, dirs, files] of _osWalk(project)) {
|
|
1801
|
+
const keep = dirs.filter((d) => !SKIP_WALK.includes(d));
|
|
1802
|
+
dirs.length = 0; dirs.push(...keep);
|
|
1803
|
+
if (!files.includes('AndroidManifest.xml')) { continue; }
|
|
1804
|
+
let t;
|
|
1805
|
+
try { t = readTextSmart(osJoin(dp, 'AndroidManifest.xml')); } catch { continue; }
|
|
1806
|
+
for (const m of finditer(actRe, t)) {
|
|
1807
|
+
const b = m[1];
|
|
1808
|
+
const nm = reSearch(pyRe('android:name="([^"]+)"'), b);
|
|
1809
|
+
const lb = reSearch(pyRe(String.raw`android:label="@string/(\w+)"`), b);
|
|
1810
|
+
if (!nm || !lb) { continue; }
|
|
1811
|
+
const key = lb[1];
|
|
1812
|
+
const val = or0(get(localized, key), get(strings, key));
|
|
1813
|
+
if (truthy(val)) { actLabel.set(pyRsplit(nm[1], '.', 1).at(-1), [val, key]); }
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
let nOf = 0; let nAc = 0;
|
|
1818
|
+
for (const e of edges) {
|
|
1819
|
+
const a = setdefault(e, 'args', {});
|
|
1820
|
+
if (truthy(get(a, 'label'))) { continue; }
|
|
1821
|
+
const tgt = pyStr(get(e, 'target', ''));
|
|
1822
|
+
const tnode = or0(get(nodes, tgt), {});
|
|
1823
|
+
if (pyStr(get(tnode, 'kind', '')) === 'menu' || tgt.startsWith('menu:')) {
|
|
1824
|
+
dset(a, 'label', or0(get(localized, 'abc_action_menu_overflow_description'), 'More options'));
|
|
1825
|
+
dset(a, 'label_base', 'More options');
|
|
1826
|
+
dset(a, 'label_source', 'framework:abc_action_menu_overflow_description');
|
|
1827
|
+
nOf++;
|
|
1828
|
+
continue;
|
|
1829
|
+
}
|
|
1830
|
+
if (pyStr(get(e, 'mechanism', '')).startsWith('startActivity') && tgt.startsWith('activity:')) {
|
|
1831
|
+
const hit = actLabel.get(pySplit(tgt, ':', 1)[1]);
|
|
1832
|
+
if (truthy(hit)) {
|
|
1833
|
+
dset(a, 'label', hit[0]); dset(a, 'label_key', hit[1]);
|
|
1834
|
+
dset(a, 'label_source', 'manifest:android:label');
|
|
1835
|
+
nAc++;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
if (nOf || nAc) { pyPrintErr(`[assemble] framework labels backfilled: overflow=${nOf} manifest-activity=${nAc}`); }
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
const _WS_RUN_RE = pyRe(String.raw`\s+`);
|
|
1843
|
+
const squash = (s) => pyStrip(reSub(_WS_RUN_RE, ' ', s));
|
|
1844
|
+
|
|
1845
|
+
export function _loadBaseStrings(project) {
|
|
1846
|
+
if (!truthy(project)) { return {}; }
|
|
1847
|
+
const merged = {};
|
|
1848
|
+
const strRe = pyRe('<string name="([^"]+)"[^>]*>(.*?)</string>', 's');
|
|
1849
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
1850
|
+
const keep = dirs.filter((d) => !['build', '.git', 'test', 'androidTest', '.gradle', '.idea'].includes(d));
|
|
1851
|
+
dirs.length = 0; dirs.push(...keep);
|
|
1852
|
+
if (!files.includes('strings.xml')) { continue; }
|
|
1853
|
+
const norm = dirpath.split('\\').join('/');
|
|
1854
|
+
if (norm.split('/').at(-1) !== 'values' || !(norm + '/').includes('/res/')) { continue; }
|
|
1855
|
+
let t;
|
|
1856
|
+
try { t = readTextSmart(osJoin(dirpath, 'strings.xml')); } catch { continue; }
|
|
1857
|
+
for (const [k, v] of reFindall(strRe, t)) { setdefault(merged, k, squash(decodeAndroidString(v))); }
|
|
1858
|
+
}
|
|
1859
|
+
return merged;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
export function _stampLabelVariants(edges, project) {
|
|
1863
|
+
const base = _loadBaseStrings(project);
|
|
1864
|
+
if (!truthy(base)) { return; }
|
|
1865
|
+
let localized;
|
|
1866
|
+
try { localized = truthy(project) ? loadProjectStrings(project) : {}; } catch { localized = {}; }
|
|
1867
|
+
const rev = new Map();
|
|
1868
|
+
const loc = or0(localized, {});
|
|
1869
|
+
for (const k of keysOf(loc)) {
|
|
1870
|
+
const v = loc[k];
|
|
1871
|
+
if (truthy(v)) { const s = squash(pyStr(v)); if (!rev.has(s)) { rev.set(s, k); } }
|
|
1872
|
+
}
|
|
1873
|
+
let stamped = 0;
|
|
1874
|
+
for (const e of edges) {
|
|
1875
|
+
const a = get(e, 'args');
|
|
1876
|
+
if (!isObj(a)) { continue; }
|
|
1877
|
+
const lab = get(a, 'label');
|
|
1878
|
+
if (!truthy(lab) || truthy(get(a, 'label_base'))) { continue; }
|
|
1879
|
+
const key = or0(get(a, 'label_key'), rev.get(squash(pyStr(lab))) ?? null);
|
|
1880
|
+
if (!truthy(key)) { continue; }
|
|
1881
|
+
const bv = get(base, key);
|
|
1882
|
+
if (truthy(bv) && !pyEq(bv, lab)) {
|
|
1883
|
+
dset(a, 'label_base', bv);
|
|
1884
|
+
setdefault(a, 'label_key', key);
|
|
1885
|
+
stamped++;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
if (stamped) { pyPrintErr(`[assemble] label_base stamped on ${stamped} edge(s) (device-language independence)`); }
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
// --- provenance lint ------------------------------------------------------
|
|
1892
|
+
export const _MENTION_TRIGGER_PREFIXES = ['ref@'];
|
|
1893
|
+
|
|
1894
|
+
/** Counter.most_common(n) over a Map built in insertion order. */
|
|
1895
|
+
function mostCommon(c, n) {
|
|
1896
|
+
return sortedBy([...c], (kv) => kv[1], true).slice(0, n);
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
export function lintEdgeProvenance(edges, nodes) {
|
|
1900
|
+
const kept = []; const quarantined = [];
|
|
1901
|
+
for (const e of edges) {
|
|
1902
|
+
const trig = pyStr(or0(get(e, 'trigger'), ''));
|
|
1903
|
+
if (_MENTION_TRIGGER_PREFIXES.some((p) => trig.startsWith(p))) { quarantined.push(e); continue; }
|
|
1904
|
+
kept.push(e);
|
|
1905
|
+
}
|
|
1906
|
+
if (quarantined.length) {
|
|
1907
|
+
const byTarget = counter(quarantined.map((e) => e.target));
|
|
1908
|
+
const top = new Map(mostCommon(byTarget, 5));
|
|
1909
|
+
pyPrintBuf(`[assemble] LINT dropped ${quarantined.length} mention-derived ` +
|
|
1910
|
+
`edge(s) (trigger not a call site — likely built from ` +
|
|
1911
|
+
`\`refs-to\`; see SKILL.md step 3.1). Top targets: ${pyRepr(top)}`);
|
|
1912
|
+
}
|
|
1913
|
+
const entryIds = new Set(keysOf(nodes).filter((nid) => {
|
|
1914
|
+
const n = nodes[nid];
|
|
1915
|
+
return truthy(get(n, 'entry')) || truthy(get(n, 'is_launcher')) ||
|
|
1916
|
+
(isObj(get(n, 'launch_hint')) && truthy(get(n.launch_hint, 'is_launcher')));
|
|
1917
|
+
}));
|
|
1918
|
+
const forward = ['startActivity-explicit', 'startActivity-implicit', 'compose-navigate', 'compose-navigate-param',
|
|
1919
|
+
'voyager-push', 'fragment-transaction', 'nav-component-action'];
|
|
1920
|
+
const fanIn = counter(kept.filter((e) => entryIds.has(e.target) && forward.includes(get(e, 'mechanism'))).map((e) => e.target));
|
|
1921
|
+
for (const [nid, cnt] of fanIn) {
|
|
1922
|
+
if (cnt >= 3) {
|
|
1923
|
+
pyPrintBuf(`[assemble] LINT WARN ${nid} is an entry/launcher node but ` +
|
|
1924
|
+
`has ${cnt} inbound forward-navigation edge(s). A launcher ` +
|
|
1925
|
+
`is where you START, not somewhere you tap into — verify ` +
|
|
1926
|
+
`these are real CLEAR_TOP returns, not mention-derived.`);
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
return kept;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
export function _parseArgs(argv) {
|
|
1933
|
+
let ws = '.'; let project = null; const positional = [];
|
|
1934
|
+
let i = 0;
|
|
1935
|
+
while (i < argv.length) {
|
|
1936
|
+
if (argv[i] === '--project' && i + 1 < argv.length) { project = argv[i + 1]; i += 2; continue; }
|
|
1937
|
+
positional.push(argv[i]); i++;
|
|
1938
|
+
}
|
|
1939
|
+
if (positional.length) { ws = positional[0]; }
|
|
1940
|
+
return [ws, project];
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
/** xml.sax.saxutils.escape(data): & < > only. */
|
|
1944
|
+
const xmlEscape = (s) => s.split('&').join('&').split('>').join('>').split('<').join('<');
|
|
1945
|
+
/** repr of {k: v for k, v in sorted(d.items())} for a str->str Map. */
|
|
1946
|
+
const sortedDictRepr = (m) => pyRepr(new Map(sortedBy([...m], (kv) => kv)));
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* Edges whose SOURCE is an id no extractor declared, named after a project class that is not a
|
|
1950
|
+
* page: several extractors fall back to `activity:<owner>` for any non-fragment owner, so a
|
|
1951
|
+
* listener written in an adapter / helper / abstract base Activity became an `unknown` node no
|
|
1952
|
+
* path can reach. Re-credit by the owner's supertype chain: a BASE Activity (abstract, or not in
|
|
1953
|
+
* the manifest and extended by other Activities) fans out to its concrete subclass pages; any
|
|
1954
|
+
* other non-page class goes through the HostResolver (the page that constructs it / dispatches
|
|
1955
|
+
* its override / calls its static helper). Unresolvable ones are dropped and counted rather than
|
|
1956
|
+
* left on a fabricated endpoint. Ids that are Activities the manifest missed are left untouched.
|
|
1957
|
+
* Returns [edges, stats].
|
|
1958
|
+
*/
|
|
1959
|
+
export function _recreditNonPageSources(nodes, edgesIn, project, ws) {
|
|
1960
|
+
const stats = { base_subclassed: 0, host_resolved: 0, dropped: 0, dropped_owners: new Set() };
|
|
1961
|
+
if (!truthy(project)) { return [edgesIn, stats]; }
|
|
1962
|
+
const undeclared = (id) => !Object.hasOwn(nodes, id);
|
|
1963
|
+
const ownerOf = (id) => { const s = pyStr(id); return /^(?:activity:)?[A-Z]\w*$/.test(s) ? s.replace(/^activity:/, '') : null; };
|
|
1964
|
+
const cands = edgesIn.filter((e) => undeclared(e.source) && ownerOf(e.source) !== null);
|
|
1965
|
+
if (!cands.length) { return [edgesIn, stats]; }
|
|
1966
|
+
const sources = walkSources(project);
|
|
1967
|
+
const chain = new ActivityChain(buildClassIndex(sources), manifestActivityNames(ws));
|
|
1968
|
+
const byName = new Map();
|
|
1969
|
+
for (const id of keysOf(nodes)) {
|
|
1970
|
+
const m = /^(activity|fragment|dialog|voyager-screen|host-activity):([\w.$]+)$/.exec(pyStr(id));
|
|
1971
|
+
if (!m) { continue; }
|
|
1972
|
+
const nm = m[2].split('.').at(-1);
|
|
1973
|
+
if (!byName.has(nm) || m[1] === 'activity') { byName.set(nm, id); }
|
|
1974
|
+
}
|
|
1975
|
+
const resolver = new HostResolver(sources, (o) => byName.has(o), (o) => byName.get(o));
|
|
1976
|
+
const out = [];
|
|
1977
|
+
for (const e of edgesIn) {
|
|
1978
|
+
const owner = undeclared(e.source) ? ownerOf(e.source) : null;
|
|
1979
|
+
if (owner === null || !chain.idx.has(owner)) { out.push(e); continue; }
|
|
1980
|
+
let hosts; let via;
|
|
1981
|
+
if (chain.isBase(owner)) {
|
|
1982
|
+
hosts = chain.concretePages(owner).filter((n) => byName.has(n)).map((n) => byName.get(n));
|
|
1983
|
+
via = 'base-activity-subclass';
|
|
1984
|
+
} else if (chain.isActivity(owner)) {
|
|
1985
|
+
out.push(e); continue; // a real Activity page no manifest record declared: not ours to move
|
|
1986
|
+
} else {
|
|
1987
|
+
hosts = resolver.sourcesFor(owner);
|
|
1988
|
+
via = 'host-resolve';
|
|
1989
|
+
}
|
|
1990
|
+
hosts = [...new Set(hosts)].filter((h) => h !== e.target);
|
|
1991
|
+
if (!hosts.length) { stats.dropped++; stats.dropped_owners.add(owner); continue; }
|
|
1992
|
+
if (via === 'base-activity-subclass') { stats.base_subclassed++; } else { stats.host_resolved++; }
|
|
1993
|
+
for (const h of hosts) {
|
|
1994
|
+
out.push({ ...e, source: h, args: { ...argsOf(e), written_in: owner, credited_via: via } });
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
return [out, stats];
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
export function main(argv = process.argv.slice(2)) {
|
|
2001
|
+
const [ws, project] = _parseArgs(argv);
|
|
2002
|
+
const nodesIn = load(osJoin(ws, 'nodes.jsonl'));
|
|
2003
|
+
const _kindCollisions = [];
|
|
2004
|
+
const nodes = {};
|
|
2005
|
+
for (const n of nodesIn) {
|
|
2006
|
+
setdefault(n, 'status', 'static-only');
|
|
2007
|
+
setdefault(n, 'provenance', []);
|
|
2008
|
+
dset(nodes, n.id, mergeNodeRecords(get(nodes, n.id), n, _kindCollisions));
|
|
2009
|
+
}
|
|
2010
|
+
const [edgesIn, _rc] = _recreditNonPageSources(nodes, load(osJoin(ws, 'edges.jsonl')), project, ws);
|
|
2011
|
+
if (_rc.base_subclassed || _rc.host_resolved || _rc.dropped) {
|
|
2012
|
+
pyPrintBuf(`[assemble] nonpage_source base_subclassed=${_rc.base_subclassed} ` +
|
|
2013
|
+
`host_resolved=${_rc.host_resolved} dropped=${_rc.dropped}`);
|
|
2014
|
+
if (_rc.dropped) {
|
|
2015
|
+
pyPrintBuf(`# edges written in a non-page class no page owns — DROPPED (no fabricated source): ${pyRepr(sortedStr(_rc.dropped_owners))}`);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
for (const [cid, kinds, how] of _kindCollisions) {
|
|
2019
|
+
pyPrintBuf(`[assemble] LINT id-collision ${cid} kinds=${kinds} (${how})`);
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
const _gestureKey = (e) => { const a = argsOf(e); return or0(get(a, 'trigger_id'), get(a, 'trigger_receiver')); };
|
|
2023
|
+
const baseKey = (e) => tupleKey(e.source, e.target, get(e, 'mechanism'), get(e, 'trigger'));
|
|
2024
|
+
const _tidSeen = new Set();
|
|
2025
|
+
for (const e of edgesIn) { if (truthy(_gestureKey(e))) { _tidSeen.add(baseKey(e)); } }
|
|
2026
|
+
let edges = []; const seen = new Set();
|
|
2027
|
+
for (const e of edgesIn) {
|
|
2028
|
+
const base = baseKey(e);
|
|
2029
|
+
const tid = _gestureKey(e);
|
|
2030
|
+
if (!truthy(tid) && _tidSeen.has(base)) { continue; }
|
|
2031
|
+
const key = tupleKey(e.source, e.target, get(e, 'mechanism'), get(e, 'trigger'), tid);
|
|
2032
|
+
if (seen.has(key)) { continue; }
|
|
2033
|
+
seen.add(key);
|
|
2034
|
+
setdefault(e, 'status', 'static-only');
|
|
2035
|
+
setdefault(e, 'confidence', asFloat(1.0));
|
|
2036
|
+
dset(e, 'guard', normalizeGuard(get(e, 'guard')));
|
|
2037
|
+
edges.push(e);
|
|
2038
|
+
for (const end of [e.source, e.target]) {
|
|
2039
|
+
if (!Object.hasOwn(nodes, end)) {
|
|
2040
|
+
dset(nodes, end, {
|
|
2041
|
+
id: end, kind: 'unknown', label: end, status: 'unreachable', provenance: 'auto-endpoint',
|
|
2042
|
+
denominator: false,
|
|
2043
|
+
audit_note: 'endpoint auto-created by assemble.py: no extractor declared this id as a page',
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
// --- resolve *Starter endpoints to the Activity they actually launch -------
|
|
2050
|
+
const _starterAction = new Map(); const _actionActivity = new Map();
|
|
2051
|
+
for (const rec of load(osJoin(ws, 'starters.jsonl'))) {
|
|
2052
|
+
if (get(rec, 'type') === 'starter' && truthy(get(rec, 'class')) && truthy(get(rec, 'action'))) {
|
|
2053
|
+
_starterAction.set(rec.class, rec.action);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
for (const rec of load(osJoin(ws, 'manifest.jsonl'))) {
|
|
2057
|
+
if (get(rec, 'type') !== 'activity') { continue; }
|
|
2058
|
+
for (const act of or0(get(rec, 'actions'), [])) {
|
|
2059
|
+
if (!_actionActivity.has(act)) { _actionActivity.set(act, new Set()); }
|
|
2060
|
+
_actionActivity.get(act).add(or0(get(rec, 'node_id'), 'activity:' + pyStr(rec.name).split('.').at(-1)));
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
const _starterFix = new Map();
|
|
2064
|
+
for (const nid of keysOf(nodes)) {
|
|
2065
|
+
const simple = pyStr(nid).split(':').at(-1);
|
|
2066
|
+
const act = _starterAction.get(simple);
|
|
2067
|
+
if (!truthy(act)) { continue; }
|
|
2068
|
+
const cands = _actionActivity.get(act) ?? new Set();
|
|
2069
|
+
if (cands.size === 1) {
|
|
2070
|
+
const tgt = [...cands][0];
|
|
2071
|
+
if (Object.hasOwn(nodes, tgt) && tgt !== nid) { _starterFix.set(nid, tgt); }
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
if (_starterFix.size) {
|
|
2075
|
+
for (const e of edges) {
|
|
2076
|
+
for (const end of ['source', 'target']) {
|
|
2077
|
+
if (_starterFix.has(get(e, end))) {
|
|
2078
|
+
dset(e, end, _starterFix.get(e[end]));
|
|
2079
|
+
if (end === 'target') { dset(e, 'mechanism', 'startActivity-implicit'); }
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
for (const nid of _starterFix.keys()) { delete nodes[nid]; }
|
|
2084
|
+
pyPrintErr(`[assemble] resolved ${_starterFix.size} *Starter pseudo-page(s) to the ` +
|
|
2085
|
+
`Activity their intent action launches: ${sortedDictRepr(_starterFix)}`);
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
// --- re-point an edge whose SOURCE is a RecyclerView adapter --------------
|
|
2089
|
+
if (truthy(project)) {
|
|
2090
|
+
const _undeclared = keysOf(nodes).filter((nid) => get(nodes[nid], 'provenance') === 'auto-endpoint');
|
|
2091
|
+
const _pageFile = new Map();
|
|
2092
|
+
for (const nid of keysOf(nodes)) {
|
|
2093
|
+
const n = nodes[nid];
|
|
2094
|
+
const da = pyStr(or0(get(n, 'declared_at'), ''));
|
|
2095
|
+
if (da && get(n, 'provenance') !== 'auto-endpoint') {
|
|
2096
|
+
const k = pyRsplit(da, ':', 1)[0].split('\\').join('/');
|
|
2097
|
+
if (!_pageFile.has(k)) { _pageFile.set(k, []); }
|
|
2098
|
+
_pageFile.get(k).push(nid);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
const _hosts = new Map(_undeclared.map((nid) => [nid, new Set()]));
|
|
2102
|
+
if (_undeclared.length) {
|
|
2103
|
+
const _pat = new Map(_undeclared.map((nid) => {
|
|
2104
|
+
const s = reEscape(pyStr(nid).split(':').at(-1));
|
|
2105
|
+
return [nid, pyRe(String.raw`\b(?:new\s+` + s + String.raw`\s*[\(<]|extends\s+` + s + String.raw`\b|:\s*` + s + String.raw`\s*\()`)];
|
|
2106
|
+
}));
|
|
2107
|
+
for (const [dirpath, dirs, files] of _osWalk(project)) {
|
|
2108
|
+
const keep = dirs.filter((d) => !['build', '.git', '.gradle', '.idea', 'test', 'androidTest', 'node_modules'].includes(d));
|
|
2109
|
+
dirs.length = 0; dirs.push(...keep);
|
|
2110
|
+
for (const fn of files) {
|
|
2111
|
+
if (!(fn.endsWith('.java') || fn.endsWith('.kt'))) { continue; }
|
|
2112
|
+
const full = osJoin(dirpath, fn);
|
|
2113
|
+
const key = osRelpath(full, project).split('\\').join('/');
|
|
2114
|
+
const pagesHere = _pageFile.get(key);
|
|
2115
|
+
if (!pagesHere || !pagesHere.length) { continue; }
|
|
2116
|
+
let txt;
|
|
2117
|
+
try { txt = readTextSmart(full); } catch { continue; }
|
|
2118
|
+
for (const [nid, rx] of _pat) {
|
|
2119
|
+
if (reSearch(rx, txt)) { for (const p of pagesHere) { _hosts.get(nid).add(p); } }
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
const _adapterFix = new Map();
|
|
2125
|
+
for (const [nid, h] of _hosts) { if (h.size === 1) { _adapterFix.set(nid, [...h][0]); } }
|
|
2126
|
+
if (_adapterFix.size) {
|
|
2127
|
+
for (const e of edges) {
|
|
2128
|
+
for (const end of ['source', 'target']) {
|
|
2129
|
+
if (_adapterFix.has(get(e, end))) { dset(e, end, _adapterFix.get(e[end])); }
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
for (const nid of _adapterFix.keys()) { delete nodes[nid]; }
|
|
2133
|
+
pyPrintErr(`[assemble] re-pointed ${_adapterFix.size} adapter pseudo-page(s) to ` +
|
|
2134
|
+
`the single page that instantiates them: ${sortedDictRepr(_adapterFix)}`);
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
const _touched = new Set([...edges.map((e) => get(e, 'source')), ...edges.map((e) => get(e, 'target'))]);
|
|
2139
|
+
for (const nid of keysOf(nodes).filter((k) => get(nodes[k], 'provenance') === 'auto-endpoint' && !_touched.has(k))) {
|
|
2140
|
+
delete nodes[nid];
|
|
2141
|
+
}
|
|
2142
|
+
const autoEps = sortedStr(keysOf(nodes).filter((nid) => get(nodes[nid], 'provenance') === 'auto-endpoint'));
|
|
2143
|
+
if (autoEps.length) {
|
|
2144
|
+
pyPrintErr(`[assemble] ${autoEps.length} auto-created endpoint node(s) ` +
|
|
2145
|
+
`(kind=unknown, excluded from the denominator) — these are ` +
|
|
2146
|
+
`edge endpoints no extractor declared, usually non-page ` +
|
|
2147
|
+
`classes: ${pyRepr(autoEps.slice(0, 12))}`);
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
edges = lintEdgeProvenance(edges, nodes);
|
|
2151
|
+
for (const nid of keysOf(nodes)) { dset(nodes[nid], 'slug', slug(nid)); }
|
|
2152
|
+
enrichNodesAndEdges(nodes, edges, project);
|
|
2153
|
+
|
|
2154
|
+
const nodeList = keysOf(nodes).map((k) => nodes[k]);
|
|
2155
|
+
const doc = { directed: true, multigraph: true, nodes: nodeList, links: edges };
|
|
2156
|
+
writeText(osJoin(ws, 'utg.json'), jsonDumps(doc, { ensure_ascii: false, indent: 2 }));
|
|
2157
|
+
|
|
2158
|
+
// Labels come from decoded string resources: a `"` would end the quoted label and a newline the
|
|
2159
|
+
// line. Mermaid takes `#quot;` / `<br/>` inside a quoted label.
|
|
2160
|
+
const mermaidLabel = (s) => pyStr(s).replace(/"/g, '#quot;').replace(/\r?\n/g, '<br/>');
|
|
2161
|
+
const lines = ['graph LR'];
|
|
2162
|
+
for (const n of nodeList) { lines.push(` ${sid(n.id)}["${mermaidLabel(get(n, 'label', n.id))}"]`); }
|
|
2163
|
+
for (const e of edges) { lines.push(` ${sid(e.source)} -->|${pyStr(get(e, 'mechanism', ''))}| ${sid(e.target)}`); }
|
|
2164
|
+
writeText(osJoin(ws, 'utg.mermaid'), lines.join('\n'));
|
|
2165
|
+
|
|
2166
|
+
const gm = ['<?xml version="1.0" encoding="UTF-8"?>',
|
|
2167
|
+
'<graphml xmlns="http://graphml.graphdrawing.org/xmlns">',
|
|
2168
|
+
'<key id="label" for="node" attr.name="label" attr.type="string"/>',
|
|
2169
|
+
'<key id="mech" for="edge" attr.name="mechanism" attr.type="string"/>',
|
|
2170
|
+
'<graph edgedefault="directed">'];
|
|
2171
|
+
for (const n of nodeList) {
|
|
2172
|
+
gm.push(`<node id="${xmlEscape(n.id)}"><data key="label">${xmlEscape(pyStr(get(n, 'label', n.id)))}</data></node>`);
|
|
2173
|
+
}
|
|
2174
|
+
for (const e of edges) {
|
|
2175
|
+
gm.push(`<edge source="${xmlEscape(e.source)}" target="${xmlEscape(e.target)}">` +
|
|
2176
|
+
`<data key="mech">${xmlEscape(pyStr(get(e, 'mechanism', '')))}</data></edge>`);
|
|
2177
|
+
}
|
|
2178
|
+
gm.push('</graph>', '</graphml>');
|
|
2179
|
+
writeText(osJoin(ws, 'utg.graphml'), gm.join('\n'));
|
|
2180
|
+
|
|
2181
|
+
const byKind = counter(nodeList.map((n) => get(n, 'kind')));
|
|
2182
|
+
const byMech = counter(edges.map((e) => get(e, 'mechanism')));
|
|
2183
|
+
const llm = edges.filter((e) => get(e, 'provenance') === 'static:llm').length;
|
|
2184
|
+
pyPrintBuf(`nodes=${keysOf(nodes).length} edges=${edges.length} llm_inferred=${llm}`);
|
|
2185
|
+
pyPrintBuf(' by kind:', byKind);
|
|
2186
|
+
pyPrintBuf(' by mechanism:', byMech);
|
|
2187
|
+
pyPrintBuf(` written to ${ws}/utg.json, utg.mermaid, utg.graphml`);
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { main(); }
|