@buaa_smat/hometrans 26.0.2 → 26.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/agents/code-reviewer.md +25 -138
- package/dist/cli/index.js +4 -1
- package/dist/cli/init.js +131 -26
- package/dist/cli/uninstall.js +5 -5
- package/dist/platform/language.js +77 -0
- package/env-requirements.json +30 -5
- package/i18n/FILE-NAMES.md +9 -0
- package/i18n/agents/code-reviewer.md +364 -0
- package/i18n/agents/model-render-worker.md +38 -0
- package/i18n/agents/specgen-worker.md +18 -0
- package/i18n/commands/hometrans.md +17 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +198 -0
- package/i18n/skills/a2h-app-migrate/references/config.example.json +28 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +19 -0
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +50 -0
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +1760 -0
- package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +114 -0
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1588 -0
- package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +657 -0
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +541 -0
- package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +131 -0
- package/i18n/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
- package/i18n/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/i18n/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
- package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +698 -0
- package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
- package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/i18n/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +219 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +196 -0
- package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +488 -0
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +146 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +161 -0
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/i18n/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/i18n/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +171 -0
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/i18n/skills/a2h-arch-generate/SKILL.md +375 -0
- package/i18n/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
- package/i18n/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
- package/i18n/skills/a2h-arch-generate/references/arkts-mvvm-v2.md +1407 -0
- package/i18n/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
- package/i18n/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
- package/i18n/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
- package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
- package/i18n/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
- package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
- package/i18n/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
- package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +120 -0
- package/i18n/skills/a2h-arch-generate/references/source-baseline.md +93 -0
- package/i18n/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +360 -0
- package/i18n/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +798 -0
- package/i18n/skills/a2h-arch-generate/scripts/lib/contract_terms.mjs +40 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/generate.mjs +639 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
- package/i18n/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1261 -0
- package/i18n/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
- package/i18n/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +851 -0
- package/i18n/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +982 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +9 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +192 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +303 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/design/move_spec_technical_reference.mjs +162 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +298 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +587 -0
- package/i18n/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
- package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +352 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +323 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +31 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +80 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +22 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +87 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +57 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +29 -0
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +705 -0
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +417 -0
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +139 -0
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2549 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +560 -0
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +148 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +220 -0
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +28 -0
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +216 -0
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +203 -0
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +210 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +2005 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1748 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1787 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1836 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/image_probe.mjs +405 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1406 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1226 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +1220 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +412 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +18 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +173 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +629 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +67 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +136 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +551 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +374 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +119 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +80 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +137 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +97 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +123 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +67 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +427 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +560 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +324 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +325 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +48 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +387 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +470 -0
- package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +59 -0
- package/i18n/skills/a2h-dashboard-render/SKILL.md +73 -0
- package/i18n/skills/a2h-dashboard-render/references/artifact-contract.jsonc +117 -0
- package/i18n/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
- package/i18n/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
- package/i18n/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
- package/i18n/skills/a2h-dashboard-render/scripts/dashboard.mjs +3245 -0
- package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +2048 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/i18n/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/i18n/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +154 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
- package/i18n/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/i18n/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/i18n/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
- package/i18n/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/i18n/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
- package/i18n/skills/a2h-fix-build-errors/SKILL.md +304 -0
- package/i18n/skills/a2h-fix-build-errors/references/arkts-strict-patterns.md +219 -0
- package/i18n/skills/a2h-fix-build-errors/references/rdb-entity-pattern.md +131 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +227 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/i18n/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/i18n/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/i18n/skills/a2h-page-specgen/SKILL.md +136 -0
- package/i18n/skills/a2h-page-specgen/references/body-language.md +177 -0
- package/i18n/skills/a2h-page-specgen/references/gates.md +262 -0
- package/i18n/skills/a2h-page-specgen/references/page-inventory.md +173 -0
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +207 -0
- package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +1504 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +1528 -0
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +576 -0
- package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +138 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +262 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +176 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +248 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +506 -0
- package/i18n/skills/a2h-page-specgen/scripts/render.mjs +299 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +616 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +234 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1166 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +74 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +8 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +7 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +8 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +758 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +54 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +271 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +54 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +171 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +301 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +83 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +139 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +774 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1011 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +77 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +419 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +323 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +546 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +511 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +701 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1765 -0
- package/i18n/skills/a2h-resource-convert/SKILL.md +367 -0
- package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +335 -0
- package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +251 -0
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +219 -0
- package/i18n/skills/a2h-resource-convert/references/resource-mapping-rules.md +493 -0
- package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +249 -0
- package/i18n/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +2532 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +278 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +260 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +163 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +44 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +589 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +506 -0
- package/i18n/skills/a2h-spec-generate/SKILL.md +375 -0
- package/i18n/skills/a2h-spec-generate/references/batch-mode.md +215 -0
- package/i18n/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
- package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +184 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +27 -0
- package/i18n/skills/a2h-spec-generate/references/library-evidence.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/method-discipline.md +64 -0
- package/i18n/skills/a2h-spec-generate/references/optional-gates.json +45 -0
- package/i18n/skills/a2h-spec-generate/references/recall-guide.md +84 -0
- package/i18n/skills/a2h-spec-generate/references/recall-terse.md +3 -0
- package/i18n/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
- package/i18n/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
- package/i18n/skills/a2h-spec-generate/references/review-checklist.md +22 -0
- package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
- package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
- package/i18n/skills/a2h-spec-generate/references/spec-samples.md +65 -0
- package/i18n/skills/a2h-spec-generate/references/specs.schema.json +85 -0
- package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +145 -0
- package/i18n/skills/a2h-spec-generate/references/transfer-file.md +5 -0
- package/i18n/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
- package/i18n/skills/a2h-spec-generate/references/worker-rules.md +129 -0
- package/i18n/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +702 -0
- package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +515 -0
- package/i18n/skills/a2h-spec-generate/scripts/collect-specs.mjs +727 -0
- package/i18n/skills/a2h-spec-generate/scripts/feature-stem.mjs +151 -0
- package/i18n/skills/a2h-spec-generate/scripts/parse_requirements.ts +515 -0
- package/i18n/skills/a2h-spec-generate/scripts/prepare-facts.mjs +313 -0
- package/i18n/skills/a2h-spec-generate/scripts/publish-specs.mjs +354 -0
- package/i18n/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +669 -0
- package/i18n/skills/a2h-spec-generate/scripts/render-tasks.mjs +385 -0
- package/i18n/skills/a2h-spec-generate/scripts/report.mjs +136 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1265 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1057 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +565 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +544 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +317 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +707 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +436 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +608 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +650 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +178 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +912 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +279 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +163 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +256 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +340 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1857 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +262 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +722 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/i18n/skills/a2h-spec-generate/template/REQ.txt +22 -0
- package/i18n/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
- package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +847 -0
- package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +415 -0
- package/i18n/skills/a2h-spec-generate/test/collect-specs.test.mjs +808 -0
- package/i18n/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/i18n/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/i18n/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/i18n/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
- package/i18n/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
- package/i18n/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
- package/i18n/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
- package/i18n/skills/a2h-spec-generate/test/report.test.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/SKILL.md +120 -0
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +279 -0
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +918 -0
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +446 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hint_check.mjs +147 -0
- package/i18n/skills/a2h-utg-explorer/scripts/hint_source.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_b.mjs +550 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +380 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +492 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +199 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1412 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +2037 -0
- package/i18n/skills/a2h-utg-static/SKILL.md +368 -0
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
- package/i18n/skills/a2h-utg-static/references/view-interactions.md +215 -0
- package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +2120 -0
- package/i18n/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +609 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +250 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +374 -0
- package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
- package/i18n/skills/a2h-utg-static/scripts/fragment_nav.mjs +1137 -0
- package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -0
- package/i18n/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +913 -0
- package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +517 -0
- package/i18n/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
- package/i18n/skills/a2h-utg-static/scripts/static_prior.mjs +956 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +108 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +289 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_fresh_branch_guard.mjs +49 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +136 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +368 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +44 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_nl_hints_off_path.mjs +67 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +61 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_data_table.mjs +340 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_relative_url.mjs +125 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +340 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1351 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
- package/package.json +13 -160
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
- package/skills/a2h-app-migrate/SKILL.md +17 -6
- package/skills/a2h-app-migrate/references/config.example.json +1 -0
- package/skills/a2h-app-migrate/references/stage-map.md +3 -1
- package/skills/a2h-app-migrate/references/workflow.yaml +138 -47
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +1 -2
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +105 -39
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +7 -8
- package/skills/a2h-app-migrate/scripts/ledger.mjs +17 -5
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +43 -7
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +127 -41
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +2 -0
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +38 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +131 -0
- package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
- package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +98 -0
- package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/skills/a2h-app-migrate/test/test_devecocli_docs_preflight.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_ensure_utg_snapshot.mjs +147 -0
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +102 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +698 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
- package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +51 -0
- package/skills/a2h-app-migrate/test/test_image_probe.mjs +120 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +91 -0
- package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +111 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
- package/skills/a2h-app-migrate/test/test_preflight_report.mjs +93 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +219 -0
- package/skills/a2h-app-migrate/test/test_resume_summary.mjs +196 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +488 -0
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +144 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_acceptance.mjs +94 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +147 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +161 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +344 -0
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +83 -0
- package/skills/a2h-app-migrate/test/test_user_facing_progress.mjs +43 -0
- package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +41 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +178 -0
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +87 -0
- package/skills/a2h-arch-generate/SKILL.md +1 -1
- package/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
- package/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +15 -6
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +2 -2
- package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +35 -46
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +33 -40
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +2 -3
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1260 -0
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +191 -0
- package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
- package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
- package/skills/a2h-arch-generate/scripts/tests/test_module_templates.mjs +70 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +138 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +2 -5
- package/skills/a2h-arkts-logic-coder/SKILL.md +21 -2
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -0
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +62 -0
- package/skills/a2h-arkts-logic-coder/references/spec-design.md +4 -0
- package/skills/a2h-arkts-logic-coder/scripts/design/validate_spec_design_output.mjs +22 -25
- package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +583 -0
- package/skills/a2h-arkts-logic-coder/test/golden/inspect_happy.json +20 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_design.md +18 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_design_crlf.md +18 -0
- package/skills/a2h-arkts-logic-coder/test/golden/move_spec.md +7 -0
- package/skills/a2h-arkts-logic-coder/test/golden/resolve_cases.json +36 -0
- package/skills/a2h-arkts-logic-coder/test/golden/validate_issue_file.md +12 -0
- package/skills/a2h-arkts-logic-coder/test/golden/validate_issues.json +57 -0
- package/skills/a2h-arkts-logic-coder/test/test_spec_design_scripts.mjs +547 -0
- package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +352 -0
- package/skills/a2h-batch-ui-align/SKILL.md +6 -4
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +1 -1
- package/skills/a2h-batch-ui-align/references/cards/resources.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +22 -3
- package/skills/a2h-batch-ui-align/references/checker-rules.md +66 -3
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +45 -8
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -5
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +2 -2
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +4 -2
- package/skills/a2h-batch-ui-align/references/step5-convert.md +7 -5
- package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +6 -7
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +84 -7
- package/skills/a2h-batch-ui-align/scripts/draw_coverage.mjs +264 -0
- package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +229 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1 -2
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +4 -5
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +88 -26
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +305 -12
- package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +231 -54
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +8 -9
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +18 -5
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +103 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +1 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +14 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +8 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +3 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +84 -19
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +11 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_dialog.ts +110 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +5 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +66 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +119 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +81 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_delta.ts +178 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +123 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +2 -3
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +6 -0
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_a11y.test.mjs +598 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +312 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_blur.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_builder_calls.test.mjs +323 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +312 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +507 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +427 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_occlusion_offset_format.test.mjs +372 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +235 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_padding_raster.test.mjs +262 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_scroll_safearea.test.mjs +742 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +91 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +86 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +473 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +567 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +290 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +74 -0
- package/skills/a2h-batch-ui-align/scripts/tests/detect_paradigm.test.mjs +260 -0
- package/skills/a2h-batch-ui-align/scripts/tests/draw_coverage.test.mjs +244 -0
- package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +420 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +31 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +742 -0
- package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +363 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1628 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
- package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/image_probe.test.mjs +243 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +324 -0
- package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +325 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +297 -0
- package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +48 -0
- package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +387 -0
- package/skills/a2h-batch-ui-align/scripts/tests/static_check_registry.test.mjs +122 -0
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
- package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +250 -0
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +12 -14
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +29 -30
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
- package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +168 -0
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +118 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +93 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_i18n.mjs +203 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1369 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +318 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +411 -0
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +512 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/skills/a2h-page-specgen/SKILL.md +136 -0
- package/skills/a2h-page-specgen/references/body-language.md +177 -0
- package/skills/a2h-page-specgen/references/evidence.md +70 -0
- package/skills/a2h-page-specgen/references/execution-model.md +255 -0
- package/skills/a2h-page-specgen/references/footprint-and-grouping.md +250 -0
- package/skills/a2h-page-specgen/references/gates.md +255 -0
- package/skills/a2h-page-specgen/references/page-inventory.md +173 -0
- package/skills/a2h-page-specgen/references/spec-template.md +207 -0
- package/skills/a2h-page-specgen/scripts/dispatch.mjs +209 -0
- package/skills/a2h-page-specgen/scripts/facts-build.mjs +1504 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +422 -0
- package/skills/a2h-page-specgen/scripts/footprint.mjs +1528 -0
- package/skills/a2h-page-specgen/scripts/gate.mjs +558 -0
- package/skills/a2h-page-specgen/scripts/interactions.mjs +137 -0
- package/skills/a2h-page-specgen/scripts/inventory.mjs +269 -0
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +255 -0
- package/skills/a2h-page-specgen/scripts/lib/deps-source.mjs +399 -0
- package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +137 -0
- package/skills/a2h-page-specgen/scripts/lib/footprint-roles.mjs +278 -0
- package/skills/a2h-page-specgen/scripts/lib/fsx.mjs +79 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +175 -0
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +355 -0
- package/skills/a2h-page-specgen/scripts/lib/prose.mjs +234 -0
- package/skills/a2h-page-specgen/scripts/lib/reach.mjs +53 -0
- package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +391 -0
- package/skills/a2h-page-specgen/scripts/lib/symbols.mjs +125 -0
- package/skills/a2h-page-specgen/scripts/lib/utg-io.mjs +110 -0
- package/skills/a2h-page-specgen/scripts/lib/waker-event-store.mjs +658 -0
- package/skills/a2h-page-specgen/scripts/prepare.mjs +492 -0
- package/skills/a2h-page-specgen/scripts/render.mjs +317 -0
- package/skills/a2h-page-specgen/scripts/report.mjs +7 -0
- package/skills/a2h-page-specgen/scripts/submission.mjs +532 -0
- package/skills/a2h-page-specgen/scripts/submit.mjs +79 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/README.md +77 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +590 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/cases.example.json +57 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +207 -0
- package/skills/a2h-page-specgen/scripts/test/dispatch.test.mjs +258 -0
- package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +1164 -0
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +74 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Api.kt +20 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/BothAnnotations.kt +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Cache.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Comments.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Mmkv.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Models.kt +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Pair.kt +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Prefs.kt +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Room.kt +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Sample.kt +43 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Templates.kt +34 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/Timeouts.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/androidTest/Helper.kt +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/build.gradle.kts +16 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/en.js.txt +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/i18n/zh.js.txt +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/libs.versions.toml +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/package.json +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values/strings.xml +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-b+zh+Hans/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-land/strings.xml +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-night/strings.xml +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-v21/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/res/values-zh/strings.xml +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/test/Legacy.kt +4 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts/weather.proto +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/AppPreferences.kt +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-container/src/SettingsViewModel.kt +16 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-dao/src/UserDao.kt +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/base/strings.xml +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-moko/i18n/src/commonMain/moko-resources/fil/strings.xml +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/arrays.xml +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/values/strings.xml +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/res/xml/prefs.xml +27 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Api.java +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Datastore.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/Settings.java +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/forecast.js +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-pref/src/store.js +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/BasePreferences.kt +13 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/Screen.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-receiver/src/UiPreferences.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/facts-retrofit/src/AuthAPI.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/AndroidManifest.xml +20 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/feature/auth/navigation/ScreenRoute.kt +8 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/pages.json +19 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/components/Widget.vue +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/detail/detail.vue +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/pages/index/index.vue +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/store/userStore.js +11 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp/src/uni_modules/uview-ui/components/u-thing.js +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/fp.mkdb.mjs +144 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +94 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/MainFragment.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyListeners.java +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/PlainActivity.java +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/click_paths.json +28 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/fold-chain/utg.json +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/utg/utg.json +34 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +758 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-roles.test.mjs +172 -0
- package/skills/a2h-page-specgen/scripts/test/fsx.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +54 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +222 -0
- package/skills/a2h-page-specgen/scripts/test/helpers.mjs +54 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +171 -0
- package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +301 -0
- package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +45 -0
- package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +139 -0
- package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +774 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +464 -0
- package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +1011 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +120 -0
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +68 -0
- package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +390 -0
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +167 -0
- package/skills/a2h-page-specgen/scripts/test/reach.test.mjs +93 -0
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +323 -0
- package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +546 -0
- package/skills/a2h-page-specgen/scripts/test/render.test.mjs +503 -0
- package/skills/a2h-page-specgen/scripts/test/source-text.test.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +701 -0
- package/skills/a2h-page-specgen/scripts/test/utg-io.test.mjs +90 -0
- package/skills/a2h-page-specgen/scripts/test/waker-event-store.test.mjs +1365 -0
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +1765 -0
- package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +1979 -0
- package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +313 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +1234 -0
- package/skills/a2h-page-specgen/scripts/watchdog.mjs +298 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +49 -51
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
- package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
- package/skills/a2h-resource-convert/scripts/tests/docs_only_i18n.test.mjs +44 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +79 -78
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +51 -12
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +24 -6
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +3 -2
- package/skills/a2h-spec-design-pipeline/references/initialization.md +15 -4
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +82 -41
- package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +61 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +19 -10
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +267 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +61 -8
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +62 -13
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +8 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +8 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +55 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +60 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/HttpExtraDataEmptyStringCheck.js +488 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +11 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +17 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +12 -38
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +40 -5
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +18 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +74 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +2 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +128 -5
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +98 -35
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +218 -37
- package/skills/a2h-spec-design-pipeline/scripts/lib/shared_classes.ts +113 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/shared_docs.ts +202 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/wiring.ts +58 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +6 -7
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +3 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +348 -0
- package/skills/a2h-spec-design-pipeline/scripts/scan_shared.ts +642 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +15 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +7 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +104 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +24 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +394 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +24 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +14 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +163 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +15 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +14 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +350 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_scan_shared.ts +996 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_classes.ts +80 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_docs.ts +205 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +121 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_e2e.ts +85 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_validate_shared_manifest.ts +720 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_wiring.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/validate_shared_manifest.ts +566 -0
- package/skills/a2h-spec-generate/SKILL.md +87 -21
- package/skills/a2h-spec-generate/references/batch-mode.md +78 -17
- package/skills/a2h-spec-generate/references/dispatch-watchdog.md +150 -0
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +7 -0
- package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
- package/skills/a2h-spec-generate/references/synthesis-rules.md +4 -2
- package/skills/a2h-spec-generate/references/worker-rules.md +6 -3
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +4 -5
- package/skills/a2h-spec-generate/scripts/check_spec.ts +145 -14
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +261 -19
- package/skills/a2h-spec-generate/scripts/dispatch-watch.mjs +1168 -0
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +1 -2
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +25 -46
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +26 -27
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +3 -6
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +31 -32
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +2 -3
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +15 -26
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +102 -81
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +39 -19
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +12 -13
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/navigation-guard.ts +363 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +35 -196
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +3 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +22 -96
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +3 -4
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +1 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +74 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +51 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +42 -111
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +1 -20
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1 -2
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +3 -4
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/fusion-run.ts +243 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fixtures/zip.ts +63 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +650 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-detectors.test.ts +176 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +103 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-schema.test.ts +111 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-seed.test.ts +195 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-selfcheck.test.ts +307 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +347 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1948 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-library-evidence.test.ts +239 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-navigation-guard.test.ts +277 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +844 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +1253 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +608 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +411 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +300 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/zip.test.ts +61 -0
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +879 -0
- package/skills/a2h-spec-generate/test/check-spec.test.ts +430 -0
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +811 -0
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
- package/skills/a2h-spec-generate/test/dispatch-watch.test.mjs +606 -0
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +230 -0
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +157 -0
- package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
- package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
- package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/skills/a2h-spec-generate/test/prepare-facts.test.mjs +41 -0
- package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +182 -0
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +295 -0
- package/skills/a2h-spec-generate/test/regroup-by-page.test.mjs +354 -0
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +596 -0
- package/skills/a2h-spec-generate/test/report.test.mjs +47 -0
- package/skills/a2h-utg-explorer/references/architecture.md +4 -0
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +64 -80
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +1 -2
- package/skills/a2h-utg-explorer/scripts/recover.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +5 -3
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +244 -0
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +302 -0
- package/skills/a2h-utg-explorer/scripts/tests/content_wait.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +231 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +160 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_identity.test.mjs +77 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
- package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +137 -0
- package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
- package/skills/a2h-utg-explorer/scripts/tests/fresh_state_plan.test.mjs +78 -0
- package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +252 -0
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +129 -0
- package/skills/a2h-utg-explorer/scripts/tests/holds_without_data_parity.test.mjs +26 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +492 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +199 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_failure.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
- package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +327 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_identity.test.mjs +204 -0
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +393 -0
- package/skills/a2h-utg-explorer/scripts/tests/pager_navigation.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/panel_routes.test.mjs +208 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +280 -0
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
- package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +454 -0
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +194 -0
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +336 -0
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +142 -0
- package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +92 -0
- package/skills/a2h-utg-explorer/scripts/tests/string_tables_twin_ties.test.mjs +83 -0
- package/skills/a2h-utg-explorer/scripts/tests/tar_fixture.mjs +12 -0
- package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
- package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
- package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +13 -3
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +107 -65
- package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +155 -0
- package/skills/a2h-utg-static/scripts/assemble.mjs +28 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +19 -20
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +102 -2
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +2 -3
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +2 -3
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +1 -2
- package/skills/a2h-utg-static/scripts/route_interceptor.mjs +21 -7
- package/skills/a2h-utg-static/scripts/static_prior.mjs +26 -29
- package/skills/a2h-utg-static/scripts/tests/test_activity_gates.mjs +84 -0
- package/skills/a2h-utg-static/scripts/tests/test_login_interceptor.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +29 -1
- package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-app-migrate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-arch-generate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +0 -5
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +0 -54
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +0 -38
- package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-resource-convert/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +0 -70
- package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-generate/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +0 -5
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +0 -54
- package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-utg-static/scripts/i18n-term.d.mts +0 -5
- package/skills/a2h-utg-static/scripts/i18n-term.mjs +0 -54
- package/skills/a2h-utg-static/scripts/tests/test_i18n_term.mjs +0 -155
|
@@ -0,0 +1,1351 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* uniapp_nav.mjs — port of uniapp_nav.py: a uni-app / Vue SFC project's UTG, read from its
|
|
4
|
+
* SOURCE (pages.json route table, tabBar, uni.* navigation APIs, <navigator>, project routers
|
|
5
|
+
* resolved by seed + fixpoint + export aliases, component ownership with refusals).
|
|
6
|
+
*
|
|
7
|
+
* uniapp_nav.mjs <project> [--workspace WS] [--append] [--max-component-fanout N] [--dispatch-edges]
|
|
8
|
+
*
|
|
9
|
+
* Exports:
|
|
10
|
+
* _SKIP_DIRS(Set) _SFC_EXT _SCRIPT_EXT _NAV_APIS _NAV_API_ALT _UNI_FACADE _UNI_CALL_LITERAL
|
|
11
|
+
* _UNI_CALL_ANY _URL_LITERAL_AHEAD _NAVIGATOR_TAG _NAVIGATOR_URL _NAVIGATOR_OPEN_TYPE
|
|
12
|
+
* _OPEN_TYPE_API _ROUTE_LITERAL _FUNC_DECLS _GESTURE_ATTR _CJK _TEXT_RUN
|
|
13
|
+
* _rel _lineOf _stripJsonc findProjects _appidOf _styleOf _titleRenders readRouteTable
|
|
14
|
+
* walkSources _closeParen _bodyAfterParams indexFunctions _callsName forwarders
|
|
15
|
+
* _EXPORT_DEFAULT_OBJ _MODULE_EXPORTS_OBJ _EXPORT_NAMED _braceExtent exportAliases
|
|
16
|
+
* _FORWARD_CALL scanCallSites _templateSpan _labelNear _attrLabel resolveTrigger
|
|
17
|
+
* _TAG_USE _IMPORT_FROM _VIF_LITERAL_TEST _DISPATCH_MIN_BRANCHES dispatchComponents
|
|
18
|
+
* _DISPATCH_BRANCH dispatchBranchGuards _easycomTags buildEmbedGraph owningPages
|
|
19
|
+
* _MECH_LAUNCH _MECH_TAB _MECH_ROUTE _RUNTIME _nodeFor buildRecords main
|
|
20
|
+
*
|
|
21
|
+
* Shapes: findProjects -> [[app_root, pages_json]]; `sources` is a Map rel_path -> text;
|
|
22
|
+
* indexFunctions -> Map tupleKey(file, name) -> [lo, hi] (the property `funcs.names` maps each key
|
|
23
|
+
* back to [file, name]); forwarders -> [Map tupleKey(file,name) -> api (+ `.names`), Set seed];
|
|
24
|
+
* exportAliases -> Map prop -> api; buildEmbedGraph -> [Map file -> Set, Map tag -> Set];
|
|
25
|
+
* owningPages -> [Map comp -> Set pages, Map comp -> [table, var]]; dispatchComponents ->
|
|
26
|
+
* Map file -> [var, n]; dispatchBranchGuards -> Map tupleKey(table, child) -> guard;
|
|
27
|
+
* resolveTrigger -> [trigger, label, label_source, gesture]; buildRecords -> [nodes, edges, extra].
|
|
28
|
+
* Offsets are JS (UTF-16) offsets; the fixed look-ahead windows (300 / 200 chars, the 200 000
|
|
29
|
+
* body cap) count code points like Python.
|
|
30
|
+
*
|
|
31
|
+
* Determinism: owningPages iterates `page_files` / `frontier` / `embeds[f]` (Python str sets) in CPython
|
|
32
|
+
* PYTHONHASHSEED=0 order via _py.pySetIter, so `gated.setdefault` picks the same dispatch table
|
|
33
|
+
* as Python. The JS Sets themselves are kept in Python insertion order.
|
|
34
|
+
*/
|
|
35
|
+
import * as fs from 'node:fs';
|
|
36
|
+
import * as path from 'node:path';
|
|
37
|
+
import { pathToFileURL } from 'node:url';
|
|
38
|
+
import {
|
|
39
|
+
pyRe, reEscape, pyStrip, jsonLoads, jsonDumps, osRelpath, tupleKey, cmpStr, asFloat,
|
|
40
|
+
ArgumentParser, pyPrintErr, pyStr, sortedStr, pySetIter,
|
|
41
|
+
} from './_py.mjs';
|
|
42
|
+
import { readTextSmart } from './io_utils.mjs';
|
|
43
|
+
import { _normRoute } from './hybrid_pages.mjs';
|
|
44
|
+
import { pageId } from './hybrid_scope.mjs';
|
|
45
|
+
import { sanityFloor, _finditer } from './scope_utils.mjs';
|
|
46
|
+
import { _osWalk } from './layout_resolve.mjs';
|
|
47
|
+
import { guardMain } from './_spawn.mjs';
|
|
48
|
+
|
|
49
|
+
const IS_WIN = process.platform === 'win32';
|
|
50
|
+
const OSSEP = IS_WIN ? '\\' : '/';
|
|
51
|
+
const P = IS_WIN ? path.win32 : path.posix;
|
|
52
|
+
|
|
53
|
+
export const _SKIP_DIRS = new Set(['node_modules', '.git', '.svn', 'unpackage', 'dist', 'build',
|
|
54
|
+
'out', '.hbuilderx', '.idea', '__pycache__', '.nuxt', '.output']);
|
|
55
|
+
export const _SFC_EXT = ['.vue', '.nvue', '.uvue'];
|
|
56
|
+
export const _SCRIPT_EXT = ['.js', '.ts', '.mjs', '.cjs'];
|
|
57
|
+
const endsWithAny = (s, exts) => exts.some((e) => s.endsWith(e));
|
|
58
|
+
|
|
59
|
+
export const _NAV_APIS = ['navigateTo', 'redirectTo', 'reLaunch', 'switchTab'];
|
|
60
|
+
export const _NAV_API_ALT = _NAV_APIS.join('|');
|
|
61
|
+
export const _UNI_FACADE = String.raw`(?:uni|wx|my|tt|swan|qq|jd|plus)`;
|
|
62
|
+
|
|
63
|
+
const BT = '`';
|
|
64
|
+
export const _UNI_CALL_LITERAL = pyRe(
|
|
65
|
+
String.raw`\b` + _UNI_FACADE + String.raw`\s*\.\s*(` + _NAV_API_ALT + String.raw`)\s*\(` +
|
|
66
|
+
String.raw`[^)]{0,400}?url\s*:\s*["'` + BT + String.raw`]([^"'` + BT + String.raw`?]{1,200})`);
|
|
67
|
+
export const _UNI_CALL_ANY = pyRe(
|
|
68
|
+
String.raw`\b` + _UNI_FACADE + String.raw`\s*\.\s*(` + _NAV_API_ALT + String.raw`)\s*\(`);
|
|
69
|
+
export const _URL_LITERAL_AHEAD = pyRe(String.raw`url\s*:\s*["'` + BT + ']');
|
|
70
|
+
|
|
71
|
+
export const _NAVIGATOR_TAG = pyRe(String.raw`<navigator\b([^>]{0,600})>`, 'i');
|
|
72
|
+
export const _NAVIGATOR_URL = pyRe(String.raw`\burl\s*=\s*["']([^"']{1,200})["']`);
|
|
73
|
+
export const _NAVIGATOR_OPEN_TYPE = pyRe(String.raw`\bopen-type\s*=\s*["']([a-zA-Z]{1,20})["']`);
|
|
74
|
+
export const _OPEN_TYPE_API = { navigate: 'navigateTo', redirect: 'redirectTo', switchTab: 'switchTab', reLaunch: 'reLaunch' };
|
|
75
|
+
|
|
76
|
+
export const _ROUTE_LITERAL = pyRe(String.raw`["'` + BT + String.raw`](/?[A-Za-z0-9_][A-Za-z0-9_/.\-]{2,200})["'` + BT + ']');
|
|
77
|
+
|
|
78
|
+
export const _FUNC_DECLS = [
|
|
79
|
+
pyRe(String.raw`\bfunction\s*\*?\s*([A-Za-z_$][\w$]*)\s*\(`),
|
|
80
|
+
pyRe(String.raw`\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*` +
|
|
81
|
+
String.raw`(?:async\s+)?function\s*\*?\s*[A-Za-z_$]?[\w$]*\s*\(`),
|
|
82
|
+
pyRe(String.raw`\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s+)?\(`),
|
|
83
|
+
pyRe(String.raw`(?:^|[{,;]|\bstatic\s+|\basync\s+)\s*([A-Za-z_$][\w$]*)\s*\(`),
|
|
84
|
+
// Vue options-API / object-literal method: `name: function (` or `name: (`
|
|
85
|
+
pyRe(String.raw`(?:^|[{,;])\s*([A-Za-z_$][\w$]*)\s*:\s*(?:async\s+)?(?:function\s*\*?\s*[A-Za-z_$]?[\w$]*\s*)?\(`),
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
export const _GESTURE_ATTR = pyRe(
|
|
89
|
+
String.raw`(?:@|v-on:)(click|tap|longpress|longtap)(?:\.[\w.]+)?\s*=\s*` +
|
|
90
|
+
String.raw`(?:"([^"]{0,600})"|'([^']{0,600})')`);
|
|
91
|
+
|
|
92
|
+
export const _CJK = pyRe('[\u4e00-\u9fff]');
|
|
93
|
+
export const _TEXT_RUN = pyRe(String.raw`>([^<>{}]{1,40})<`);
|
|
94
|
+
|
|
95
|
+
// ------------------------------------------------------------------ small helpers
|
|
96
|
+
|
|
97
|
+
const SURR = new RegExp('[\\uD800-\\uDFFF]');
|
|
98
|
+
let _cpText = null; let _cpAstral = false;
|
|
99
|
+
/** Offset `n` code points after `i` (Python slice window), clamped to len. */
|
|
100
|
+
function cpFwd(text, i, n) {
|
|
101
|
+
if (text.length - i <= n) { return text.length; }
|
|
102
|
+
if (text !== _cpText) { _cpText = text; _cpAstral = SURR.test(text); }
|
|
103
|
+
if (!_cpAstral) { return i + n; }
|
|
104
|
+
let j = i;
|
|
105
|
+
while (n > 0 && j < text.length) {
|
|
106
|
+
const c = text.charCodeAt(j);
|
|
107
|
+
j += c >= 0xd800 && c <= 0xdbff && j + 1 < text.length ? 2 : 1;
|
|
108
|
+
n--;
|
|
109
|
+
}
|
|
110
|
+
return j;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** os.path.normpath. */
|
|
114
|
+
function normpath(p) {
|
|
115
|
+
let s = P.normalize(String(p));
|
|
116
|
+
const root = P.parse(s).root;
|
|
117
|
+
while (s.length > root.length && (s.endsWith('\\') || s.endsWith('/'))) { s = s.slice(0, -1); }
|
|
118
|
+
return s;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const isDict = (v) => v !== null && typeof v === 'object' && !Array.isArray(v) &&
|
|
122
|
+
!(v instanceof Map) && !(v instanceof Set) && typeof v.valueOf() === 'object';
|
|
123
|
+
const dget = (d, k) => (isDict(d) && Object.hasOwn(d, k) ? d[k] : null);
|
|
124
|
+
|
|
125
|
+
/** Python truthiness of a JSON value. */
|
|
126
|
+
function isTrue(v) {
|
|
127
|
+
if (v === null || v === undefined || v === false || v === '') { return false; }
|
|
128
|
+
if (typeof v === 'number') { return v !== 0; }
|
|
129
|
+
if (typeof v === 'bigint') { return v !== 0n; }
|
|
130
|
+
if (Array.isArray(v)) { return v.length > 0; }
|
|
131
|
+
if (typeof v === 'object' && typeof v.valueOf() === 'number') { return v.valueOf() !== 0; }
|
|
132
|
+
if (isDict(v)) { return Object.keys(v).length > 0; }
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Python `for x in v or ()` over a JSON value: list items, dict keys, str chars. */
|
|
137
|
+
function iterOr(v) {
|
|
138
|
+
if (!isTrue(v)) { return []; }
|
|
139
|
+
if (Array.isArray(v)) { return v; }
|
|
140
|
+
if (typeof v === 'string') { return [...v]; }
|
|
141
|
+
if (isDict(v)) { return Object.keys(v); }
|
|
142
|
+
throw new TypeError("'int' object is not iterable");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function _rel(p, root) {
|
|
146
|
+
try { return osRelpath(p, root).replace(/\\/g, '/'); } catch { return String(p).replace(/\\/g, '/'); }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** text.count("\n", 0, pos) + 1. */
|
|
150
|
+
export function _lineOf(text, pos) {
|
|
151
|
+
let n = 1;
|
|
152
|
+
for (let k = text.indexOf('\n'); k !== -1 && k < pos; k = text.indexOf('\n', k + 1)) { n++; }
|
|
153
|
+
return n;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const _TRAILING_COMMA = pyRe(String.raw`,(\s*[}\]])`, 'g');
|
|
157
|
+
|
|
158
|
+
/** `pages.json` with comments and trailing commas removed (line numbers preserved). */
|
|
159
|
+
export function _stripJsonc(raw) {
|
|
160
|
+
const out = [];
|
|
161
|
+
let i = 0;
|
|
162
|
+
const n = raw.length;
|
|
163
|
+
while (i < n) {
|
|
164
|
+
const c = raw[i];
|
|
165
|
+
if (c === '"' || c === "'") {
|
|
166
|
+
const quote = c;
|
|
167
|
+
let j = i + 1;
|
|
168
|
+
while (j < n && raw[j] !== quote) { j += raw[j] === '\\' ? 2 : 1; }
|
|
169
|
+
out.push(raw.slice(i, Math.min(j + 1, n)));
|
|
170
|
+
i = j + 1;
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (c === '/' && i + 1 < n) {
|
|
174
|
+
if (raw[i + 1] === '/') {
|
|
175
|
+
const j = raw.indexOf('\n', i);
|
|
176
|
+
i = j < 0 ? n : j;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (raw[i + 1] === '*') {
|
|
180
|
+
const j = raw.indexOf('*/', i + 2);
|
|
181
|
+
const end = j < 0 ? n : j + 2;
|
|
182
|
+
out.push('\n'.repeat(raw.slice(i, end).split('\n').length - 1));
|
|
183
|
+
i = end;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
out.push(c);
|
|
188
|
+
i += 1;
|
|
189
|
+
}
|
|
190
|
+
return out.join('').replace(_TRAILING_COMMA, (_m, g1) => g1);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** [[app_root, pages_json_path]] for every uni-app source tree under `root`. */
|
|
194
|
+
export function findProjects(root) {
|
|
195
|
+
const found = [];
|
|
196
|
+
for (const [dirpath, dirs, files] of _osWalk(root)) {
|
|
197
|
+
const kept = dirs.filter((d) => !_SKIP_DIRS.has(d));
|
|
198
|
+
dirs.length = 0; dirs.push(...kept);
|
|
199
|
+
if (!files.includes('pages.json')) { continue; }
|
|
200
|
+
const p = P.join(dirpath, 'pages.json');
|
|
201
|
+
let data;
|
|
202
|
+
try { data = jsonLoads(_stripJsonc(readTextSmart(p))); } catch { continue; }
|
|
203
|
+
if (!isDict(data)) { continue; }
|
|
204
|
+
const pages = dget(data, 'pages');
|
|
205
|
+
if (!(Array.isArray(pages) && pages.some((x) => isDict(x) && typeof dget(x, 'path') === 'string'))) { continue; }
|
|
206
|
+
found.push([normpath(dirpath), p]);
|
|
207
|
+
dirs.length = 0;
|
|
208
|
+
}
|
|
209
|
+
return found;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const _APPID_FALLBACK_RE = pyRe(String.raw`["']?appid["']?\s*:\s*["']([^"']{1,64})["']`);
|
|
213
|
+
|
|
214
|
+
/** The app's own id, from its `manifest.json` (or manifest.config.*). */
|
|
215
|
+
export function _appidOf(appRoot, fallback) {
|
|
216
|
+
for (const name of ['manifest.json', 'manifest.config.js', 'manifest.config.ts']) {
|
|
217
|
+
const p = P.join(appRoot, name);
|
|
218
|
+
if (!fs.existsSync(p)) { continue; }
|
|
219
|
+
const raw = readTextSmart(p);
|
|
220
|
+
let data;
|
|
221
|
+
try { data = jsonLoads(_stripJsonc(raw)); } catch {
|
|
222
|
+
const m = _APPID_FALLBACK_RE.exec(raw);
|
|
223
|
+
if (m) { return m[1]; }
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (isDict(data)) {
|
|
227
|
+
for (const key of ['appid', 'id']) {
|
|
228
|
+
const v = dget(data, key);
|
|
229
|
+
if (typeof v === 'string' && pyStrip(v)) { return pyStrip(v); }
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return fallback;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function _styleOf(rec) { return isDict(dget(rec, 'style')) ? rec.style : {}; }
|
|
237
|
+
|
|
238
|
+
/** False when the framework draws no native navigation bar for this page. */
|
|
239
|
+
export function _titleRenders(style, globalStyle) {
|
|
240
|
+
for (const scope of [style, globalStyle]) {
|
|
241
|
+
if (!isDict(scope)) { continue; }
|
|
242
|
+
const ns = dget(scope, 'navigationStyle');
|
|
243
|
+
if (typeof ns === 'string') { return ns !== 'custom'; }
|
|
244
|
+
for (const plat of ['app-plus', 'h5', 'mp-weixin']) {
|
|
245
|
+
const sub = dget(scope, plat);
|
|
246
|
+
if (isDict(sub)) {
|
|
247
|
+
if (dget(sub, 'titleNView') === false) { return false; }
|
|
248
|
+
if (typeof dget(sub, 'navigationStyle') === 'string') { return sub.navigationStyle !== 'custom'; }
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** {routes, launch, tabbar, global_style, pages_json} from a source `pages.json`. */
|
|
256
|
+
export function readRouteTable(pagesJson, appRoot) {
|
|
257
|
+
const raw = readTextSmart(pagesJson);
|
|
258
|
+
const data = jsonLoads(_stripJsonc(raw));
|
|
259
|
+
const relPages = _rel(pagesJson, appRoot);
|
|
260
|
+
const gstyle = isDict(dget(data, 'globalStyle')) ? data.globalStyle : {};
|
|
261
|
+
|
|
262
|
+
const lineOfPath = (pathValue) => {
|
|
263
|
+
const m = pyRe(String.raw`["']path["']\s*:\s*["']` + reEscape(pathValue) + `["']`).exec(raw);
|
|
264
|
+
return m ? _lineOf(raw, m.index) : 1;
|
|
265
|
+
};
|
|
266
|
+
const sourceFile = (route) => {
|
|
267
|
+
for (const ext of _SFC_EXT) {
|
|
268
|
+
const cand = P.join(appRoot, route.split('/').join(OSSEP) + ext);
|
|
269
|
+
if (fs.existsSync(cand)) { return route + ext; }
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const out = []; const seen = new Set();
|
|
275
|
+
const add = (route, rec, declaredPath) => {
|
|
276
|
+
route = _normRoute(route);
|
|
277
|
+
if (!route || seen.has(route)) { return; }
|
|
278
|
+
seen.add(route);
|
|
279
|
+
const style = _styleOf(rec);
|
|
280
|
+
// Only the page's OWN title names it. A globalStyle title is the app-wide default every untitled
|
|
281
|
+
// page shares, so it identifies none of them and is not a control anyone taps.
|
|
282
|
+
let title = dget(style, 'navigationBarTitleText');
|
|
283
|
+
title = typeof title === 'string' && pyStrip(title) ? pyStrip(title) : null;
|
|
284
|
+
out.push({
|
|
285
|
+
route,
|
|
286
|
+
title,
|
|
287
|
+
title_renders: _titleRenders(style, gstyle),
|
|
288
|
+
tab_text: null,
|
|
289
|
+
at: `${relPages}:${lineOfPath(declaredPath)}`,
|
|
290
|
+
source_file: sourceFile(route),
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
for (const rec of iterOr(dget(data, 'pages'))) {
|
|
295
|
+
if (isDict(rec) && typeof dget(rec, 'path') === 'string') { add(rec.path, rec, rec.path); }
|
|
296
|
+
}
|
|
297
|
+
const subs = dget(data, 'subPackages');
|
|
298
|
+
for (const sp of iterOr(isTrue(subs) ? subs : dget(data, 'subpackages'))) {
|
|
299
|
+
if (!isDict(sp)) { continue; }
|
|
300
|
+
const r = dget(sp, 'root');
|
|
301
|
+
const sroot = pyStrip(pyStr(isTrue(r) ? r : ''), '/');
|
|
302
|
+
for (const rec of iterOr(dget(sp, 'pages'))) {
|
|
303
|
+
if (isDict(rec) && typeof dget(rec, 'path') === 'string') {
|
|
304
|
+
const relp = pyStrip(rec.path, '/');
|
|
305
|
+
add(sroot ? sroot + '/' + relp : relp, rec, rec.path);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const tabbar = []; const tabText = new Map();
|
|
311
|
+
const tb = dget(data, 'tabBar');
|
|
312
|
+
if (isDict(tb)) {
|
|
313
|
+
for (const item of iterOr(dget(tb, 'list'))) {
|
|
314
|
+
if (!isDict(item)) { continue; }
|
|
315
|
+
const pp = dget(item, 'pagePath');
|
|
316
|
+
const r = _normRoute(isTrue(pp) ? pyStr(pp) : '');
|
|
317
|
+
if (!r || tabText.has(r)) { continue; }
|
|
318
|
+
const txt = dget(item, 'text');
|
|
319
|
+
tabText.set(r, typeof txt === 'string' && pyStrip(txt) ? pyStrip(txt) : null);
|
|
320
|
+
tabbar.push(r);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
for (const rec of out) {
|
|
324
|
+
if (tabText.has(rec.route)) { rec.tab_text = tabText.get(rec.route); }
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
routes: out,
|
|
328
|
+
launch: out.length ? out[0].route : null,
|
|
329
|
+
tabbar: tabbar.filter((r) => seen.has(r)),
|
|
330
|
+
global_style: gstyle,
|
|
331
|
+
pages_json: relPages,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// ── source walk ─────────────────────────────────────────────────────────────
|
|
336
|
+
|
|
337
|
+
/** Map rel_path -> text for every SFC and script file in the app. */
|
|
338
|
+
export function walkSources(appRoot) {
|
|
339
|
+
const out = new Map();
|
|
340
|
+
const exts = [..._SFC_EXT, ..._SCRIPT_EXT];
|
|
341
|
+
for (const [dirpath, dirs, files] of _osWalk(appRoot)) {
|
|
342
|
+
const kept = dirs.filter((d) => !_SKIP_DIRS.has(d));
|
|
343
|
+
dirs.length = 0; dirs.push(...kept);
|
|
344
|
+
for (const fn of files) {
|
|
345
|
+
if (!endsWithAny(fn, exts)) { continue; }
|
|
346
|
+
const full = P.join(dirpath, fn);
|
|
347
|
+
let t;
|
|
348
|
+
try { t = readTextSmart(full); } catch { continue; }
|
|
349
|
+
out.set(_rel(full, appRoot), t);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return out;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Offset of the `)` matching the `(` at `i`, or null. */
|
|
356
|
+
export function _closeParen(text, i) {
|
|
357
|
+
let depth = 0;
|
|
358
|
+
const n = text.length;
|
|
359
|
+
while (i < n) {
|
|
360
|
+
const c = text[i];
|
|
361
|
+
if (c === '(') { depth += 1; } else if (c === ')') {
|
|
362
|
+
depth -= 1;
|
|
363
|
+
if (depth === 0) { return i; }
|
|
364
|
+
}
|
|
365
|
+
i += 1;
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** [lo, hi] of the function body whose parameter list opens at `openParen`, or null. */
|
|
371
|
+
export function _bodyAfterParams(text, openParen, limit = 200_000) {
|
|
372
|
+
const cp = _closeParen(text, openParen);
|
|
373
|
+
if (cp === null) { return null; }
|
|
374
|
+
let k = cp + 1;
|
|
375
|
+
const n = text.length;
|
|
376
|
+
while (k < n && ' \t\r\n'.includes(text[k])) { k += 1; }
|
|
377
|
+
if (text.slice(k, k + 2) === '=>') {
|
|
378
|
+
k += 2;
|
|
379
|
+
while (k < n && ' \t\r\n'.includes(text[k])) { k += 1; }
|
|
380
|
+
}
|
|
381
|
+
if (k >= n || text[k] !== '{') { return null; }
|
|
382
|
+
let depth = 0; let j = k;
|
|
383
|
+
const hi = cpFwd(text, k, limit);
|
|
384
|
+
while (j < hi) {
|
|
385
|
+
const c = text[j];
|
|
386
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
387
|
+
const quote = c;
|
|
388
|
+
j += 1;
|
|
389
|
+
while (j < n && text[j] !== quote) { j += text[j] === '\\' ? 2 : 1; }
|
|
390
|
+
j += 1;
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
if (c === '{') { depth += 1; } else if (c === '}') {
|
|
394
|
+
depth -= 1;
|
|
395
|
+
if (depth === 0) { return [k, j]; }
|
|
396
|
+
}
|
|
397
|
+
j += 1;
|
|
398
|
+
}
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** Map tupleKey(file, name) -> [lo, hi] for every named function body; `.names` maps key -> [file, name]. */
|
|
403
|
+
export function indexFunctions(sources) {
|
|
404
|
+
const index = new Map();
|
|
405
|
+
index.names = new Map();
|
|
406
|
+
for (const [p, text] of sources) {
|
|
407
|
+
for (const rx of _FUNC_DECLS) {
|
|
408
|
+
for (const m of _finditer(rx, text)) {
|
|
409
|
+
const key = tupleKey(p, m[1]);
|
|
410
|
+
if (index.has(key)) { continue; }
|
|
411
|
+
const span = _bodyAfterParams(text, m.index + m[0].length - 1);
|
|
412
|
+
if (span) { index.set(key, span); index.names.set(key, [p, m[1]]); }
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return index;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const _CALLS_CACHE = new Map();
|
|
420
|
+
/** True when `body` calls `name(` — not `.name(`, and not a declaration. */
|
|
421
|
+
export function _callsName(body, name) {
|
|
422
|
+
let rx = _CALLS_CACHE.get(name);
|
|
423
|
+
if (!rx) { rx = pyRe(String.raw`(?<![\w$.])` + reEscape(name) + String.raw`\s*\(`); _CALLS_CACHE.set(name, rx); }
|
|
424
|
+
return rx.test(body);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/** [Map tupleKey(file, name) -> api (+ `.names`), Set seed keys] — functions that FORWARD a destination. */
|
|
428
|
+
export function forwarders(sources, funcs, maxRounds = 8) {
|
|
429
|
+
const fw = new Map();
|
|
430
|
+
const names = funcs.names;
|
|
431
|
+
fw.names = names;
|
|
432
|
+
for (const [key, [lo, hi]] of funcs) {
|
|
433
|
+
const [p] = names.get(key);
|
|
434
|
+
const body = sources.get(p).slice(lo, hi);
|
|
435
|
+
const apis = new Set();
|
|
436
|
+
for (const m of _finditer(_UNI_CALL_ANY, body)) {
|
|
437
|
+
const e = m.index + m[0].length;
|
|
438
|
+
const tail = body.slice(e, cpFwd(body, e, 300));
|
|
439
|
+
if (!_URL_LITERAL_AHEAD.test(tail)) { apis.add(m[1]); }
|
|
440
|
+
}
|
|
441
|
+
if (apis.size) { fw.set(key, apis.has('navigateTo') ? 'navigateTo' : sortedStr(apis)[0]); }
|
|
442
|
+
}
|
|
443
|
+
const seed = new Set(fw.keys());
|
|
444
|
+
// fw entries per file, in fw insertion order (the same view `list(fw.items())` filtered by file).
|
|
445
|
+
const byFile = new Map();
|
|
446
|
+
const note = (key, api) => {
|
|
447
|
+
const [f, n] = names.get(key);
|
|
448
|
+
if (!byFile.has(f)) { byFile.set(f, []); }
|
|
449
|
+
byFile.get(f).push([n, api]);
|
|
450
|
+
};
|
|
451
|
+
for (const [key, api] of fw) { note(key, api); }
|
|
452
|
+
for (let round = 0; round < maxRounds; round++) {
|
|
453
|
+
let grew = false;
|
|
454
|
+
for (const [key, [lo, hi]] of funcs) {
|
|
455
|
+
if (fw.has(key)) { continue; }
|
|
456
|
+
const [p, name] = names.get(key);
|
|
457
|
+
const cands = byFile.get(p);
|
|
458
|
+
if (!cands) { continue; }
|
|
459
|
+
const body = sources.get(p).slice(lo, hi);
|
|
460
|
+
for (const [n2, api] of [...cands]) {
|
|
461
|
+
if (n2 === name) { continue; }
|
|
462
|
+
if (_callsName(body, n2)) { fw.set(key, api); note(key, api); grew = true; break; }
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (!grew) { break; }
|
|
466
|
+
}
|
|
467
|
+
return [fw, seed];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export const _EXPORT_DEFAULT_OBJ = pyRe(String.raw`export\s+default\s*(\{)`);
|
|
471
|
+
export const _MODULE_EXPORTS_OBJ = pyRe(String.raw`module\s*\.\s*exports\s*=\s*(\{)`);
|
|
472
|
+
export const _EXPORT_NAMED = pyRe(String.raw`export\s*\{([^}]{0,600})\}`);
|
|
473
|
+
|
|
474
|
+
export function _braceExtent(text, openBrace) {
|
|
475
|
+
let depth = 0; let j = openBrace;
|
|
476
|
+
const n = text.length;
|
|
477
|
+
while (j < n) {
|
|
478
|
+
const c = text[j];
|
|
479
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
480
|
+
const quote = c;
|
|
481
|
+
j += 1;
|
|
482
|
+
while (j < n && text[j] !== quote) { j += text[j] === '\\' ? 2 : 1; }
|
|
483
|
+
j += 1;
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
if (c === '{') { depth += 1; } else if (c === '}') {
|
|
487
|
+
depth -= 1;
|
|
488
|
+
if (depth === 0) { return j; }
|
|
489
|
+
}
|
|
490
|
+
j += 1;
|
|
491
|
+
}
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
const _ALIAS_RE = pyRe(String.raw`([A-Za-z_$][\w$]*)\s*(?::\s*([A-Za-z_$][\w$]*))?\s*(?:,|\}|$|\n)`);
|
|
496
|
+
|
|
497
|
+
/** Map prop -> api — forwarders re-exported under a property name. `names` defaults to fw.names. */
|
|
498
|
+
export function exportAliases(sources, fw, names = fw.names) {
|
|
499
|
+
const aliases = new Map();
|
|
500
|
+
for (const [p, text] of sources) {
|
|
501
|
+
const local = new Map();
|
|
502
|
+
for (const [key, api] of fw) { const [f, n] = names.get(key); if (f === p) { local.set(n, api); } }
|
|
503
|
+
if (!local.size) { continue; }
|
|
504
|
+
const blobs = [];
|
|
505
|
+
for (const rx of [_EXPORT_DEFAULT_OBJ, _MODULE_EXPORTS_OBJ]) {
|
|
506
|
+
for (const m of _finditer(rx, text)) {
|
|
507
|
+
const s1 = m.index + m[0].length - 1;
|
|
508
|
+
const end = _braceExtent(text, s1);
|
|
509
|
+
if (end) { blobs.push(text.slice(s1, end + 1)); }
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
for (const m of _finditer(_EXPORT_NAMED, text)) { blobs.push(m[1]); }
|
|
513
|
+
for (const blob of blobs) {
|
|
514
|
+
for (const am of _finditer(_ALIAS_RE, blob)) {
|
|
515
|
+
const prop = am[1];
|
|
516
|
+
const val = am[2] || am[1];
|
|
517
|
+
if (!local.has(val)) { continue; }
|
|
518
|
+
let api = local.get(val);
|
|
519
|
+
if (aliases.has(prop) && aliases.get(prop) !== api) { api = 'navigateTo'; }
|
|
520
|
+
aliases.set(prop, api);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return aliases;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// ── call sites ──────────────────────────────────────────────────────────────
|
|
528
|
+
|
|
529
|
+
export const _FORWARD_CALL = pyRe(
|
|
530
|
+
String.raw`([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$#$][\w$]*)*)\s*\(\s*` +
|
|
531
|
+
String.raw`["'` + BT + String.raw`](/?[A-Za-z0-9_][A-Za-z0-9_/.\-]{2,200})["'` + BT + ']');
|
|
532
|
+
|
|
533
|
+
/** A forwarder call whose argument is a RELATIVE page URL (`goUrl('../info/index?x=' + i)`). */
|
|
534
|
+
export const _FORWARD_CALL_REL = pyRe(
|
|
535
|
+
String.raw`([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$#$][\w$]*)*)\s*\(\s*` +
|
|
536
|
+
String.raw`["'` + BT + String.raw`](\.\.?/[A-Za-z0-9_/.\-]{1,200})(?:\?[^"'` + BT + String.raw`]{0,200})?["'` + BT + ']');
|
|
537
|
+
|
|
538
|
+
/** Route for a relative uni-app URL, resolved against the calling PAGE's route (uni-app semantics). */
|
|
539
|
+
export function _resolveRel(fromRoute, url) {
|
|
540
|
+
const parts = String(fromRoute).split('/'); parts.pop();
|
|
541
|
+
for (const seg of String(url).split('?')[0].trim().split('/')) {
|
|
542
|
+
if (seg === '..') { parts.pop(); } else if (seg !== '.' && seg !== '') { parts.push(seg); }
|
|
543
|
+
}
|
|
544
|
+
return _normRoute(parts.join('/'));
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/** [site] for one file. `accept` is a Map callee_tail -> api (forwarders + aliases). */
|
|
548
|
+
export function scanCallSites(p, text, routeset, accept) {
|
|
549
|
+
const sites = [];
|
|
550
|
+
for (const m of _finditer(_UNI_CALL_LITERAL, text)) {
|
|
551
|
+
const dst = _normRoute(m[2]);
|
|
552
|
+
if (routeset.has(dst)) { sites.push({ pos: m.index, api: m[1], dst, how: 'uni-api' }); }
|
|
553
|
+
}
|
|
554
|
+
for (const m of _finditer(_NAVIGATOR_TAG, text)) {
|
|
555
|
+
const attrs = m[1];
|
|
556
|
+
const um = _NAVIGATOR_URL.exec(attrs);
|
|
557
|
+
if (!um) { continue; }
|
|
558
|
+
const dst = _normRoute(um[1]);
|
|
559
|
+
if (!routeset.has(dst)) { continue; }
|
|
560
|
+
const ot = _NAVIGATOR_OPEN_TYPE.exec(attrs);
|
|
561
|
+
const k = ot ? ot[1] : 'navigate';
|
|
562
|
+
const api = Object.hasOwn(_OPEN_TYPE_API, k) ? _OPEN_TYPE_API[k] : 'navigateTo';
|
|
563
|
+
sites.push({ pos: m.index, api, dst, how: 'navigator-tag' });
|
|
564
|
+
}
|
|
565
|
+
const seenUni = sites.map((s) => [s.pos, s.dst]);
|
|
566
|
+
for (const m of _finditer(_FORWARD_CALL, text)) {
|
|
567
|
+
const parts = m[1].split('.');
|
|
568
|
+
const tail = pyStrip(parts[parts.length - 1]);
|
|
569
|
+
if (!accept.has(tail)) { continue; }
|
|
570
|
+
const dst = _normRoute(m[2]);
|
|
571
|
+
if (!routeset.has(dst)) { continue; }
|
|
572
|
+
if (seenUni.some(([q, d]) => Math.abs(m.index - q) < 4 && d === dst)) { continue; }
|
|
573
|
+
sites.push({ pos: m.index, api: accept.get(tail), dst, how: 'forwarder', callee: m[1].split(' ').join('') });
|
|
574
|
+
}
|
|
575
|
+
for (const m of _finditer(_FORWARD_CALL_REL, text)) {
|
|
576
|
+
const parts = m[1].split('.');
|
|
577
|
+
const tail = pyStrip(parts[parts.length - 1]);
|
|
578
|
+
if (!accept.has(tail)) { continue; }
|
|
579
|
+
sites.push({ pos: m.index, api: accept.get(tail), dst: null, rel: m[2], how: 'forwarder-relative', callee: m[1].split(' ').join('') });
|
|
580
|
+
}
|
|
581
|
+
return sites;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// ── gesture + label, from the SFC template ──────────────────────────────────
|
|
585
|
+
|
|
586
|
+
const _TEMPLATE_OPEN = pyRe('<template[^>]*>', 'i');
|
|
587
|
+
|
|
588
|
+
/** [lo, hi] of the SFC's `<template>` block, or null. */
|
|
589
|
+
export function _templateSpan(text) {
|
|
590
|
+
const m = _TEMPLATE_OPEN.exec(text);
|
|
591
|
+
if (!m) { return null; }
|
|
592
|
+
const mend = m.index + m[0].length;
|
|
593
|
+
const end = text.toLowerCase().lastIndexOf('</template>');
|
|
594
|
+
return [mend, end > mend ? end : text.length];
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/** [label, tier] — on-screen wording for the control whose opening tag ends at `tagClose`. */
|
|
598
|
+
export function _labelNear(text, tagClose) {
|
|
599
|
+
const window = text.slice(tagClose, cpFwd(text, tagClose, 200));
|
|
600
|
+
const m = _TEXT_RUN.exec('>' + window);
|
|
601
|
+
if (m) {
|
|
602
|
+
const cand = pyStrip(m[1]);
|
|
603
|
+
if (cand && !cand.startsWith('{{') && (_CJK.test(cand) || pySplitLen(cand) <= 4)) {
|
|
604
|
+
return [cand, 'template-text'];
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return [null, null];
|
|
608
|
+
}
|
|
609
|
+
const _NONSPACE = pyRe(String.raw`\S+`, 'g');
|
|
610
|
+
const pySplitLen = (s) => (s.match(_NONSPACE) || []).length;
|
|
611
|
+
|
|
612
|
+
const _ATTR_LABEL_RES = ['text', 'title', 'label', 'name'].map((key) =>
|
|
613
|
+
[key, pyRe(key + String.raw`\s*=\s*["']([^"'{}]{1,40})["']`)]);
|
|
614
|
+
|
|
615
|
+
/** [label, `attr:<key>`] from a literal text/title/label/name attribute, or [null, null]. */
|
|
616
|
+
export function _attrLabel(attrs) {
|
|
617
|
+
for (const [key, rx] of _ATTR_LABEL_RES) {
|
|
618
|
+
const m = rx.exec(attrs);
|
|
619
|
+
if (m && pyStrip(m[1])) { return [pyStrip(m[1]), `attr:${key}`]; }
|
|
620
|
+
}
|
|
621
|
+
return [null, null];
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
const capitalize = (s) => (s ? s[0].toUpperCase() + s.slice(1).toLowerCase() : s);
|
|
625
|
+
const _ON_UPPER = /^on[A-Z]/;
|
|
626
|
+
|
|
627
|
+
const _DECL_CACHE = { text: null, byRx: null };
|
|
628
|
+
/** [[name, span]] per _FUNC_DECLS pattern for `text` (cached for the last text). */
|
|
629
|
+
function declSpans(text, k) {
|
|
630
|
+
if (_DECL_CACHE.text !== text) { _DECL_CACHE.text = text; _DECL_CACHE.byRx = new Map(); }
|
|
631
|
+
let got = _DECL_CACHE.byRx.get(k);
|
|
632
|
+
if (!got) {
|
|
633
|
+
got = _finditer(_FUNC_DECLS[k], text).map((m) => [m[1], _bodyAfterParams(text, m.index + m[0].length - 1)]);
|
|
634
|
+
_DECL_CACHE.byRx.set(k, got);
|
|
635
|
+
}
|
|
636
|
+
return got;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/** [trigger, label, label_source, gesture] for a navigation at `pos`. */
|
|
640
|
+
export function resolveTrigger(text, pos, p, tplSpan) {
|
|
641
|
+
const line = _lineOf(text, pos);
|
|
642
|
+
const at = `${p}:${line}`;
|
|
643
|
+
|
|
644
|
+
if (tplSpan && tplSpan[0] <= pos && pos < tplSpan[1]) {
|
|
645
|
+
for (const m of _finditer(_GESTURE_ATTR, text)) {
|
|
646
|
+
const mend = m.index + m[0].length;
|
|
647
|
+
if (!(m.index <= pos && pos <= mend)) { continue; }
|
|
648
|
+
const gesture = m[1];
|
|
649
|
+
const close = text.indexOf('>', mend);
|
|
650
|
+
const lo = m.index > 0 ? text.lastIndexOf('<', m.index - 1) : -1;
|
|
651
|
+
let [label, src] = _attrLabel(close > lo ? text.slice(lo < 0 ? text.length + lo : lo, close) : '');
|
|
652
|
+
if (!label && close > 0) { [label, src] = _labelNear(text, close + 1); }
|
|
653
|
+
return [`on${capitalize(gesture)}@${at}`, label, src, gesture];
|
|
654
|
+
}
|
|
655
|
+
for (const m of _finditer(_NAVIGATOR_TAG, text)) {
|
|
656
|
+
const mend = m.index + m[0].length;
|
|
657
|
+
if (m.index <= pos && pos <= mend) {
|
|
658
|
+
let [label, src] = _attrLabel(m[1]);
|
|
659
|
+
if (!label) { [label, src] = _labelNear(text, mend); }
|
|
660
|
+
return [`navigator@${at}`, label, src, 'tap'];
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return [`onTap@${at}`, null, null, 'tap'];
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
let handler = null;
|
|
667
|
+
for (let k = 0; k < _FUNC_DECLS.length; k++) {
|
|
668
|
+
for (const [name, span] of declSpans(text, k)) {
|
|
669
|
+
if (span && span[0] <= pos && pos < span[1]) { handler = name; break; }
|
|
670
|
+
}
|
|
671
|
+
if (handler) { break; }
|
|
672
|
+
}
|
|
673
|
+
let label = null; let src = null;
|
|
674
|
+
if (handler && tplSpan) {
|
|
675
|
+
const tpl = text.slice(tplSpan[0], tplSpan[1]);
|
|
676
|
+
const hre = pyRe(String.raw`\s*` + reEscape(handler) + String.raw`\s*(?:\(|$)`);
|
|
677
|
+
const sticky = new RegExp(hre.source, hre.flags + 'y');
|
|
678
|
+
for (const m of _finditer(_GESTURE_ATTR, tpl)) {
|
|
679
|
+
const val = m[2] !== undefined ? m[2] : m[3];
|
|
680
|
+
sticky.lastIndex = 0;
|
|
681
|
+
if (sticky.test(val || '')) {
|
|
682
|
+
const mend = m.index + m[0].length;
|
|
683
|
+
const close = tpl.indexOf('>', mend);
|
|
684
|
+
const lo = m.index > 0 ? tpl.lastIndexOf('<', m.index - 1) : -1;
|
|
685
|
+
[label, src] = _attrLabel(close > lo ? tpl.slice(lo < 0 ? tpl.length + lo : lo, close) : '');
|
|
686
|
+
if (!label && close > 0) { [label, src] = _labelNear(tpl, close + 1); }
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
let prefix;
|
|
692
|
+
if (handler) {
|
|
693
|
+
prefix = _ON_UPPER.test(handler) ? handler : `on${handler[0].toUpperCase()}${handler.slice(1)}`;
|
|
694
|
+
} else {
|
|
695
|
+
prefix = 'navigate';
|
|
696
|
+
}
|
|
697
|
+
return [`${prefix}@${at}`, label, src, 'tap'];
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// ── component ownership ─────────────────────────────────────────────────────
|
|
701
|
+
|
|
702
|
+
export const _TAG_USE = pyRe(String.raw`<([A-Za-z][\w.\-]{1,60})[\s/>]`);
|
|
703
|
+
export const _IMPORT_FROM = pyRe(String.raw`import\s+[^;'"]{0,200}?from\s*['"]([^'"]{1,300})['"]`);
|
|
704
|
+
export const _VIF_LITERAL_TEST = pyRe(
|
|
705
|
+
String.raw`v-(?:if|else-if)\s*=\s*["']\s*([A-Za-z_$][\w$.]*)\s*===?\s*` +
|
|
706
|
+
String.raw`[\\]?['"]([^'"\\]{1,60})[\\]?['"]\s*["']`);
|
|
707
|
+
export const _DISPATCH_MIN_BRANCHES = 3;
|
|
708
|
+
|
|
709
|
+
/** Map file -> [variable, branch_count] — components that are DISPATCH TABLES. */
|
|
710
|
+
export function dispatchComponents(sources) {
|
|
711
|
+
const out = new Map();
|
|
712
|
+
for (const [p, text] of sources) {
|
|
713
|
+
if (!endsWithAny(p, _SFC_EXT)) { continue; }
|
|
714
|
+
const span = _templateSpan(text);
|
|
715
|
+
if (!span) { continue; }
|
|
716
|
+
const byVar = new Map();
|
|
717
|
+
for (const m of _finditer(_VIF_LITERAL_TEST, text.slice(span[0], span[1]))) {
|
|
718
|
+
if (!byVar.has(m[1])) { byVar.set(m[1], new Set()); }
|
|
719
|
+
byVar.get(m[1]).add(m[2]);
|
|
720
|
+
}
|
|
721
|
+
if (!byVar.size) { continue; }
|
|
722
|
+
let bestVar = null; let bestLits = null;
|
|
723
|
+
for (const [v, lits] of byVar) { if (bestLits === null || lits.size > bestLits.size) { bestVar = v; bestLits = lits; } }
|
|
724
|
+
if (bestLits.size >= _DISPATCH_MIN_BRANCHES) { out.set(p, [bestVar, bestLits.size]); }
|
|
725
|
+
}
|
|
726
|
+
return out;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export const _DISPATCH_BRANCH = pyRe(
|
|
730
|
+
String.raw`<([A-Za-z][\w.\-]{1,60})\b([^>]{0,400}?)v-(?:if|else-if)\s*=\s*` +
|
|
731
|
+
String.raw`["']\s*([A-Za-z_$][\w$.]*)\s*===?\s*[\\]?['"]([^'"\\]{1,60})[\\]?['"]`);
|
|
732
|
+
|
|
733
|
+
/** Map tupleKey(table_file, child_file) -> guard_text for each branch of a dispatch table. */
|
|
734
|
+
export function dispatchBranchGuards(sources, dispatch, tag2file) {
|
|
735
|
+
const guards = new Map();
|
|
736
|
+
for (const [table, [v]] of dispatch) {
|
|
737
|
+
const text = sources.get(table) || '';
|
|
738
|
+
const span = _templateSpan(text);
|
|
739
|
+
if (!span) { continue; }
|
|
740
|
+
for (const m of _finditer(_DISPATCH_BRANCH, text.slice(span[0], span[1]))) {
|
|
741
|
+
const tag = m[1]; const tvar = m[3]; const lit = m[4];
|
|
742
|
+
if (tvar !== v) { continue; }
|
|
743
|
+
for (const f of tag2file.get(tag.toLowerCase()) || []) { guards.set(tupleKey(table, f), `${v} === '${lit}'`); }
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
return guards;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
export const _ELSE_BRANCH = pyRe(String.raw`<([A-Za-z][\w.\-]{1,60})\b(?:[^>]{0,400}?\s)?v-else(?![\w-])`);
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Map table -> Set of child files rendered by the table's bare `v-else` branch. That branch renders
|
|
753
|
+
* whenever no literal matches, so its child is reachable without knowing the dispatch value.
|
|
754
|
+
*/
|
|
755
|
+
export function dispatchDefaultChildren(sources, dispatch, tag2file) {
|
|
756
|
+
const out = new Map();
|
|
757
|
+
for (const table of dispatch.keys()) {
|
|
758
|
+
const text = sources.get(table) || '';
|
|
759
|
+
const span = _templateSpan(text);
|
|
760
|
+
if (!span) { continue; }
|
|
761
|
+
const got = new Set();
|
|
762
|
+
for (const m of _finditer(_ELSE_BRANCH, text.slice(span[0], span[1]))) {
|
|
763
|
+
// `<MenuLayoutSidebar>` names the file `menu-layout-sidebar.vue`; tag2file keys are kebab/lower.
|
|
764
|
+
const kebab = m[1].replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
765
|
+
const files = tag2file.get(m[1].toLowerCase()) || tag2file.get(kebab) || new Set();
|
|
766
|
+
if (files.size === 1) { for (const f of files) { got.add(f); } }
|
|
767
|
+
}
|
|
768
|
+
if (got.size) { out.set(table, got); }
|
|
769
|
+
}
|
|
770
|
+
return out;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/** Set of tag names (lower-cased) that resolve to the component file `relPath`. */
|
|
774
|
+
export function _easycomTags(relPath, custom) {
|
|
775
|
+
let base = P.basename(relPath);
|
|
776
|
+
for (const ext of _SFC_EXT) {
|
|
777
|
+
if (base.endsWith(ext)) { base = base.slice(0, -ext.length); break; }
|
|
778
|
+
}
|
|
779
|
+
const tags = new Set([base]);
|
|
780
|
+
const entries = isDict(custom) ? Object.keys(custom).map((k) => [k, custom[k]]) : [];
|
|
781
|
+
for (const [pat, tmpl] of entries) {
|
|
782
|
+
const target = pyStr(tmpl).split('@/').join('').replace(/^\/+/, '');
|
|
783
|
+
const rx = '^' + reEscape(target).split('\\$1').join('(.+)') + '$';
|
|
784
|
+
const m = pyRe(rx).exec(relPath);
|
|
785
|
+
if (m) {
|
|
786
|
+
if (m[1] === undefined) {
|
|
787
|
+
// literal rule ("^my-button$": "@/components/my-button.vue"): the tag is the pattern itself
|
|
788
|
+
if (!pat.includes('(')) { tags.add(pat.replace(/^\^+/, '').replace(/\$+$/, '')); }
|
|
789
|
+
continue;
|
|
790
|
+
}
|
|
791
|
+
tags.add(pat.replace(/^\^+/, '').replace(/\$+$/, '').split('(.*)').join(m[1]).split('(.+)').join(m[1]));
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
const out = new Set();
|
|
795
|
+
for (const t of tags) { if (t) { out.add(t.toLowerCase()); } }
|
|
796
|
+
return out;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/** [Map file -> Set of embedded component files, Map tag -> Set of files]. */
|
|
800
|
+
export function buildEmbedGraph(sources, custom, appRoot) { // eslint-disable-line no-unused-vars
|
|
801
|
+
const tag2file = new Map();
|
|
802
|
+
for (const p of sources.keys()) {
|
|
803
|
+
if (!endsWithAny(p, _SFC_EXT)) { continue; }
|
|
804
|
+
for (const t of _easycomTags(p, custom)) {
|
|
805
|
+
if (!tag2file.has(t)) { tag2file.set(t, new Set()); }
|
|
806
|
+
tag2file.get(t).add(p);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const ambiguousTags = new Set([...tag2file].filter(([, fs2]) => fs2.size > 1).map(([t]) => t));
|
|
810
|
+
const embeds = new Map();
|
|
811
|
+
for (const [p, text] of sources) {
|
|
812
|
+
const got = new Set();
|
|
813
|
+
const span = _templateSpan(text);
|
|
814
|
+
if (span) {
|
|
815
|
+
for (const m of _finditer(_TAG_USE, text.slice(span[0], span[1]))) {
|
|
816
|
+
const t = m[1].toLowerCase();
|
|
817
|
+
if (ambiguousTags.has(t)) { continue; }
|
|
818
|
+
for (const f of tag2file.get(t) || []) { if (f !== p) { got.add(f); } }
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
for (const m of _finditer(_IMPORT_FROM, text)) {
|
|
822
|
+
const spec = m[1];
|
|
823
|
+
if (!endsWithAny(spec, _SFC_EXT)) { continue; }
|
|
824
|
+
let cand;
|
|
825
|
+
if (spec.startsWith('@/')) { cand = spec.slice(2); }
|
|
826
|
+
else if (spec.startsWith('.')) { cand = normpath(P.join(P.dirname(p), spec)).replace(/\\/g, '/'); }
|
|
827
|
+
else { continue; }
|
|
828
|
+
if (sources.has(cand) && cand !== p) { got.add(cand); }
|
|
829
|
+
}
|
|
830
|
+
embeds.set(p, got);
|
|
831
|
+
}
|
|
832
|
+
return [embeds, tag2file];
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/** [Map component -> Set pages reaching it, Map component -> [table, var]]. */
|
|
836
|
+
export function owningPages(embeds, pageFiles, targets, dispatch = null, maxDepth = 4, defaults = null) {
|
|
837
|
+
const disp = dispatch instanceof Map ? dispatch : new Map();
|
|
838
|
+
const dflt = defaults instanceof Map ? defaults : new Map();
|
|
839
|
+
const targetSet = new Set(targets);
|
|
840
|
+
const reach = new Map([...targets].map((t) => [t, new Set()]));
|
|
841
|
+
const gated = new Map();
|
|
842
|
+
for (const page of pySetIter(pageFiles)) {
|
|
843
|
+
const seen = new Set();
|
|
844
|
+
let frontier = new Set([page]);
|
|
845
|
+
let depth = 0;
|
|
846
|
+
while (frontier.size && depth < maxDepth) {
|
|
847
|
+
const nxt = new Set();
|
|
848
|
+
for (const f of pySetIter(frontier)) {
|
|
849
|
+
for (const e of pySetIter(embeds.get(f) || [])) {
|
|
850
|
+
if (seen.has(e)) { continue; }
|
|
851
|
+
seen.add(e);
|
|
852
|
+
if (!disp.has(e)) { nxt.add(e); } else {
|
|
853
|
+
const open = dflt.get(e) || new Set();
|
|
854
|
+
for (const child of pySetIter(embeds.get(e) || [])) {
|
|
855
|
+
if (open.has(child)) {
|
|
856
|
+
if (!seen.has(child)) { seen.add(child); nxt.add(child); }
|
|
857
|
+
continue;
|
|
858
|
+
}
|
|
859
|
+
if (targetSet.has(child) && !gated.has(child)) { gated.set(child, [e, disp.get(e)[0]]); }
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
frontier = nxt;
|
|
865
|
+
depth += 1;
|
|
866
|
+
}
|
|
867
|
+
for (const t of seen) { if (targetSet.has(t)) { reach.get(t).add(page); } }
|
|
868
|
+
}
|
|
869
|
+
return [reach, gated];
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
// ── records ─────────────────────────────────────────────────────────────────
|
|
873
|
+
|
|
874
|
+
// ── data-table forwarders (a menu grid rendered from an imported JSON file) ─
|
|
875
|
+
|
|
876
|
+
export const _IMPORT_JSON = pyRe(String.raw`import\s+([A-Za-z_$][\w$]*)\s+from\s*['"]([^'"]{1,300}\.json)['"]`);
|
|
877
|
+
export const _ROW_URL_KEYS = ['url', 'path', 'route', 'pagePath'];
|
|
878
|
+
export const _ROW_LABEL_KEYS = ['name', 'title', 'text', 'label'];
|
|
879
|
+
/**
|
|
880
|
+
* A call whose single argument is a variable or member expression: `navigateToMenu(menu)` or
|
|
881
|
+
* `this.navigateToMenu(menu)` (options API). Any other receiver is a different object's method.
|
|
882
|
+
*/
|
|
883
|
+
export const _VAR_ARG_CALL = pyRe(String.raw`(?<![\w$.])(?:this\s*\.\s*)?([A-Za-z_$][\w$]*)\s*\(\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\s*\)`);
|
|
884
|
+
|
|
885
|
+
/** Project-relative file an import spec names (`@/x`, `./x`, `../x`), extension optional, or null. */
|
|
886
|
+
export function _resolveImport(fromFile, spec, has) {
|
|
887
|
+
let base;
|
|
888
|
+
if (spec.startsWith('@/')) { base = spec.slice(2); }
|
|
889
|
+
else if (spec.startsWith('.')) { base = normpath(P.join(P.dirname(fromFile), spec)).replace(/\\/g, '/'); }
|
|
890
|
+
else { return null; }
|
|
891
|
+
if (has(base)) { return base; }
|
|
892
|
+
for (const ext of [..._SCRIPT_EXT, ..._SFC_EXT]) {
|
|
893
|
+
if (has(base + ext)) { return base + ext; }
|
|
894
|
+
if (has(base + '/index' + ext)) { return base + '/index' + ext; }
|
|
895
|
+
}
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
const firstStr = (rec, keys) => {
|
|
900
|
+
for (const k of keys) { const v = dget(rec, k); if (typeof v === 'string' && v.trim()) { return [k, v.trim()]; } }
|
|
901
|
+
return [null, null];
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Map script file -> [{file, rows: [{route, label, group, at}]}]: one table per JSON file the
|
|
906
|
+
* script imports, holding the rows whose url names a pages.json route. `group` is the label of
|
|
907
|
+
* the nearest enclosing labelled record. A row with `visible: false` renders nothing and is skipped.
|
|
908
|
+
*/
|
|
909
|
+
export function dataTables(appRoot, sources, routeset) {
|
|
910
|
+
const out = new Map();
|
|
911
|
+
const onDisk = (f) => fs.existsSync(P.join(appRoot, f));
|
|
912
|
+
for (const [p, text] of sources) {
|
|
913
|
+
if (!endsWithAny(p, _SCRIPT_EXT) && !endsWithAny(p, _SFC_EXT)) { continue; }
|
|
914
|
+
for (const m of _finditer(_IMPORT_JSON, text)) {
|
|
915
|
+
const rel = _resolveImport(p, m[2], onDisk);
|
|
916
|
+
if (!rel) { continue; }
|
|
917
|
+
let raw; let data;
|
|
918
|
+
try { raw = readTextSmart(P.join(appRoot, rel)); data = jsonLoads(_stripJsonc(raw)); } catch { continue; }
|
|
919
|
+
// Walk order need not be document order (a parent's url may follow its children), so each
|
|
920
|
+
// row takes the first occurrence of its `key: url` pair that no earlier row has claimed.
|
|
921
|
+
const used = new Set();
|
|
922
|
+
const lineOf = (key, url) => {
|
|
923
|
+
const q = JSON.stringify(url);
|
|
924
|
+
const keyBefore = new RegExp(`${JSON.stringify(key)}\\s*:\\s*$`);
|
|
925
|
+
for (let at = raw.indexOf(q); at >= 0; at = raw.indexOf(q, at + 1)) {
|
|
926
|
+
if (used.has(at) || !keyBefore.test(raw.slice(Math.max(0, at - 40), at))) { continue; }
|
|
927
|
+
used.add(at);
|
|
928
|
+
return _lineOf(raw, at);
|
|
929
|
+
}
|
|
930
|
+
return 1;
|
|
931
|
+
};
|
|
932
|
+
const rows = [];
|
|
933
|
+
const walk = (v, group) => {
|
|
934
|
+
if (Array.isArray(v)) { for (const x of v) { walk(x, group); } return; }
|
|
935
|
+
if (!isDict(v)) { return; }
|
|
936
|
+
if (v.visible === false) { return; }
|
|
937
|
+
const [, label] = firstStr(v, _ROW_LABEL_KEYS);
|
|
938
|
+
const [uk, url] = firstStr(v, _ROW_URL_KEYS);
|
|
939
|
+
if (url) {
|
|
940
|
+
const route = _normRoute(url.split('?')[0]);
|
|
941
|
+
if (routeset.has(route)) { rows.push({ route, label, group, at: `${rel}:${lineOf(uk, url)}` }); }
|
|
942
|
+
}
|
|
943
|
+
for (const k of Object.keys(v)) { walk(v[k], label || group); }
|
|
944
|
+
};
|
|
945
|
+
walk(data, null);
|
|
946
|
+
// One table per imported file: rows of different JSON files are never merged.
|
|
947
|
+
if (rows.length) { out.set(p, [...(out.get(p) || []), { file: rel, rows }]); }
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
return out;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* [site] for calls of a data-table forwarder with a variable argument. `tableFw` is
|
|
955
|
+
* Map name -> [{file, api, rows}] (one entry per module defining that name); a call counts only
|
|
956
|
+
* in the forwarder's own module or in a file that imports it, so an unrelated function of the
|
|
957
|
+
* same name is never credited. A call that could be either of two same-name forwarders is skipped.
|
|
958
|
+
*/
|
|
959
|
+
export function scanTableCalls(p, text, tableFw, has) {
|
|
960
|
+
const sites = [];
|
|
961
|
+
if (!tableFw.size) { return sites; }
|
|
962
|
+
const imported = new Set();
|
|
963
|
+
for (const m of _finditer(_IMPORT_FROM, text)) {
|
|
964
|
+
const f = _resolveImport(p, m[1], has);
|
|
965
|
+
if (f) { imported.add(f); }
|
|
966
|
+
}
|
|
967
|
+
for (const m of _finditer(_VAR_ARG_CALL, text)) {
|
|
968
|
+
const cands = (tableFw.get(m[1]) || []).filter((t) => t.file === p || imported.has(t.file));
|
|
969
|
+
if (cands.length !== 1) { continue; }
|
|
970
|
+
const t = cands[0];
|
|
971
|
+
// A definition, not a call: `function f(x)`, or a method shorthand `f(x) {`.
|
|
972
|
+
const before = text.slice(Math.max(0, m.index - 12), m.index);
|
|
973
|
+
if (/function\s+$/.test(before)) { continue; }
|
|
974
|
+
if (/^\s*\{/.test(text.slice(m.index + m[0].length, m.index + m[0].length + 20))) { continue; }
|
|
975
|
+
for (const r of t.rows) {
|
|
976
|
+
sites.push({ pos: m.index, api: t.api, dst: r.route, how: 'data-table', callee: m[1], row: r });
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
return sites;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
export const _NAVBAR_TAG = pyRe(String.raw`<([A-Za-z][\w-]*nav-?bar)\b([^>]{0,800})>`, 'i');
|
|
983
|
+
const _NAVBAR_TITLE = pyRe(String.raw`(?:^|\s)title\s*=\s*(["'])([^"'{}<>]{1,30})\1`);
|
|
984
|
+
|
|
985
|
+
/** {title, line} of the first navigation-bar tag in the template with a literal `title`, or null. */
|
|
986
|
+
export function _navbarTitle(text) {
|
|
987
|
+
const span = _templateSpan(text);
|
|
988
|
+
if (!span) { return null; }
|
|
989
|
+
// A bar bound with `:title` (one branch of a v-if) may precede the one that names the page.
|
|
990
|
+
for (const m of _finditer(_NAVBAR_TAG, text.slice(span[0], span[1]))) {
|
|
991
|
+
const t = _NAVBAR_TITLE.exec(m[2]);
|
|
992
|
+
if (t && pyStrip(t[2])) { return { title: pyStrip(t[2]), line: _lineOf(text, span[0] + m.index) }; }
|
|
993
|
+
}
|
|
994
|
+
return null;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
export const _MECH_LAUNCH = 'hybrid-launch';
|
|
998
|
+
export const _MECH_TAB = 'hybrid-tabbar';
|
|
999
|
+
export const _MECH_ROUTE = 'hybrid-route';
|
|
1000
|
+
export const _RUNTIME = 'UniApp';
|
|
1001
|
+
|
|
1002
|
+
/** One route -> one UTG node. */
|
|
1003
|
+
export function _nodeFor(page, appid, pagesJsonRel) { // eslint-disable-line no-unused-vars
|
|
1004
|
+
const route = page.route;
|
|
1005
|
+
const renders = !!page.title_renders;
|
|
1006
|
+
const k = route.lastIndexOf('/');
|
|
1007
|
+
const n = {
|
|
1008
|
+
type: 'node',
|
|
1009
|
+
id: pageId(appid, route),
|
|
1010
|
+
kind: 'hybrid-page',
|
|
1011
|
+
label: page.title || (k < 0 ? route : route.slice(k + 1)),
|
|
1012
|
+
declared_at: page.at,
|
|
1013
|
+
launch_hint: `hybrid-page;runtime:${_RUNTIME};appid:${appid}`,
|
|
1014
|
+
runtime: _RUNTIME,
|
|
1015
|
+
appid,
|
|
1016
|
+
route,
|
|
1017
|
+
origin_kind: 'source',
|
|
1018
|
+
title_renders: renders,
|
|
1019
|
+
status: 'static-only',
|
|
1020
|
+
provenance: 'static:uniapp-source',
|
|
1021
|
+
confidence: CONF_1,
|
|
1022
|
+
};
|
|
1023
|
+
if (page.source_file) { n.source_file = page.source_file; }
|
|
1024
|
+
if (page.title) {
|
|
1025
|
+
n.title = page.title;
|
|
1026
|
+
if (!renders) {
|
|
1027
|
+
n.label_synthetic = true;
|
|
1028
|
+
n.expected = { hint_any: [page.title] };
|
|
1029
|
+
}
|
|
1030
|
+
} else {
|
|
1031
|
+
n.label_synthetic = true;
|
|
1032
|
+
}
|
|
1033
|
+
if (page.tab_text) { n.tab_text = page.tab_text; }
|
|
1034
|
+
return n;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
const CONF_1 = asFloat(1.0);
|
|
1038
|
+
const CONF_08 = 0.8;
|
|
1039
|
+
|
|
1040
|
+
/** [nodes, edges, extra] for one uni-app source tree; extra = [scope, stats, n_seed, n_fw, n_alias] or null. */
|
|
1041
|
+
export function buildRecords(appRoot, pagesJson, projectRoot = null, maxFanout = 8, dispatchEdges = false) {
|
|
1042
|
+
projectRoot = projectRoot || appRoot;
|
|
1043
|
+
const table = readRouteTable(pagesJson, appRoot);
|
|
1044
|
+
const routes = table.routes;
|
|
1045
|
+
if (!routes.length) { return [[], [], null]; }
|
|
1046
|
+
const routeset = new Set(routes.map((r) => r.route));
|
|
1047
|
+
const appid = _appidOf(appRoot, P.basename(appRoot));
|
|
1048
|
+
const launch = table.launch;
|
|
1049
|
+
|
|
1050
|
+
const nodes = routes.map((p) => _nodeFor(p, appid, table.pages_json));
|
|
1051
|
+
for (const n of nodes) {
|
|
1052
|
+
if (n.route === launch) { n.entry = true; n.is_launcher = true; }
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
const edges = [];
|
|
1056
|
+
for (const route of table.tabbar) {
|
|
1057
|
+
if (route === launch) { continue; }
|
|
1058
|
+
const page = routes.find((p) => p.route === route) ?? null;
|
|
1059
|
+
const args = { action: 'tap', via: 'uniapp-tabbar', hybrid: _RUNTIME, appid };
|
|
1060
|
+
if (page && page.tab_text) { args.label = page.tab_text; } else { args.needs_trigger = true; }
|
|
1061
|
+
edges.push({
|
|
1062
|
+
type: 'edge',
|
|
1063
|
+
source: pageId(appid, launch),
|
|
1064
|
+
target: pageId(appid, route),
|
|
1065
|
+
mechanism: _MECH_TAB,
|
|
1066
|
+
trigger: `tabBar@${table.pages_json}`,
|
|
1067
|
+
guard: null,
|
|
1068
|
+
args,
|
|
1069
|
+
provenance: 'static:uniapp-source',
|
|
1070
|
+
status: 'static-only',
|
|
1071
|
+
confidence: CONF_08,
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
const sources = walkSources(appRoot);
|
|
1076
|
+
// A page that draws its own navigation bar (`navigationStyle: custom`) names itself there. A page
|
|
1077
|
+
// with a native bar is already named by its pages.json title; a navbar tag there is not its title.
|
|
1078
|
+
let navTitled = 0;
|
|
1079
|
+
for (const n of nodes) {
|
|
1080
|
+
if (n.title_renders) { continue; }
|
|
1081
|
+
const text = n.source_file ? sources.get(n.source_file) : null;
|
|
1082
|
+
const got = text ? _navbarTitle(text) : null;
|
|
1083
|
+
if (!got) { continue; }
|
|
1084
|
+
n.identity_text = [got.title];
|
|
1085
|
+
n.identity_text_from = `${n.source_file}:${got.line}`;
|
|
1086
|
+
// The navbar paints this text on screen, so it is a real title, usable as tap text.
|
|
1087
|
+
n.label = got.title;
|
|
1088
|
+
delete n.label_synthetic;
|
|
1089
|
+
navTitled += 1;
|
|
1090
|
+
}
|
|
1091
|
+
const funcs = indexFunctions(sources);
|
|
1092
|
+
const [fw, seed] = forwarders(sources, funcs);
|
|
1093
|
+
const aliases = exportAliases(sources, fw);
|
|
1094
|
+
const accept = new Map();
|
|
1095
|
+
for (const [key, api] of fw) { accept.set(funcs.names.get(key)[1], api); }
|
|
1096
|
+
for (const [k, v] of aliases) { accept.set(k, v); }
|
|
1097
|
+
|
|
1098
|
+
const fileRoute = new Map();
|
|
1099
|
+
for (const p of routes) {
|
|
1100
|
+
if (p.source_file && sources.has(p.source_file)) { fileRoute.set(p.source_file, p.route); }
|
|
1101
|
+
}
|
|
1102
|
+
const pageFiles = new Set(fileRoute.keys());
|
|
1103
|
+
|
|
1104
|
+
// A seed forwarder (its url is not a literal) in a module that imports a JSON route table. The
|
|
1105
|
+
// forwarder reads the row from its argument, not from a named table, so a module importing two
|
|
1106
|
+
// route-bearing tables cannot say which one a call iterates: it is refused, never merged.
|
|
1107
|
+
const tables = dataTables(appRoot, sources, routeset);
|
|
1108
|
+
const tableFw = new Map();
|
|
1109
|
+
let tableAmbiguous = 0;
|
|
1110
|
+
// A seed whose body encloses another seed of the same file (`useMenuNavigate` returning
|
|
1111
|
+
// `navigateToMenu`) is a factory, not the call that navigates.
|
|
1112
|
+
const encloses = (key) => {
|
|
1113
|
+
const [f] = funcs.names.get(key); const [lo, hi] = funcs.get(key);
|
|
1114
|
+
return [...seed].some((k2) => k2 !== key && funcs.names.get(k2)[0] === f &&
|
|
1115
|
+
lo <= funcs.get(k2)[0] && funcs.get(k2)[1] <= hi);
|
|
1116
|
+
};
|
|
1117
|
+
for (const key of seed) {
|
|
1118
|
+
if (encloses(key)) { continue; }
|
|
1119
|
+
const [f, name] = funcs.names.get(key);
|
|
1120
|
+
const own = tables.get(f);
|
|
1121
|
+
if (!own) { continue; }
|
|
1122
|
+
if (own.length !== 1) { tableAmbiguous += 1; continue; }
|
|
1123
|
+
const list = tableFw.get(name) || [];
|
|
1124
|
+
if (!list.some((t) => t.file === f)) { list.push({ file: f, api: fw.get(key), rows: own[0].rows }); }
|
|
1125
|
+
tableFw.set(name, list);
|
|
1126
|
+
}
|
|
1127
|
+
const tableEntries = [...tableFw.values()].flat();
|
|
1128
|
+
const has = (f) => sources.has(f);
|
|
1129
|
+
|
|
1130
|
+
const sitesByFile = new Map();
|
|
1131
|
+
for (const [p, text] of sources) {
|
|
1132
|
+
const got = [...scanCallSites(p, text, routeset, accept), ...scanTableCalls(p, text, tableFw, has)];
|
|
1133
|
+
if (got.length) { sitesByFile.set(p, got); }
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
const compFiles = [...sitesByFile.keys()].filter((f) => !pageFiles.has(f));
|
|
1137
|
+
const pj = jsonLoads(_stripJsonc(readTextSmart(pagesJson)));
|
|
1138
|
+
const easy = dget(pj, 'easycom');
|
|
1139
|
+
const custom = isTrue(easy) ? easy : {};
|
|
1140
|
+
if (!isDict(custom)) { throw new TypeError(`'${Array.isArray(custom) ? 'list' : typeof custom}' object has no attribute 'get'`); }
|
|
1141
|
+
const [embeds, tag2file] = buildEmbedGraph(sources, dget(custom, 'custom'), appRoot);
|
|
1142
|
+
const dispatch = dispatchComponents(sources);
|
|
1143
|
+
const defaults = dispatchDefaultChildren(sources, dispatch, tag2file);
|
|
1144
|
+
const [reach, gated] = owningPages(embeds, pageFiles, compFiles, dispatch, 4, defaults);
|
|
1145
|
+
const branchGuards = dispatchEdges ? dispatchBranchGuards(sources, dispatch, tag2file) : new Map();
|
|
1146
|
+
let tablePages = new Map();
|
|
1147
|
+
if (dispatchEdges && dispatch.size) {
|
|
1148
|
+
const [tReach] = owningPages(embeds, pageFiles, [...dispatch.keys()], new Map());
|
|
1149
|
+
tablePages = new Map([...tReach].map(([t, v]) => [t, [...v].sort(cmpStr)]));
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
const stats = {
|
|
1153
|
+
attributed: 0, no_owner: 0, ambiguous: 0, dispatch_gated: 0, from_dispatch: 0,
|
|
1154
|
+
sites: [...sitesByFile.values()].reduce((a, v) => a + v.length, 0),
|
|
1155
|
+
labelled: 0, from_component: 0, dispatch_components: dispatch.size,
|
|
1156
|
+
navbar_titles: navTitled,
|
|
1157
|
+
table_forwarders: tableEntries.length, table_rows: tableEntries.reduce((a, t) => a + t.rows.length, 0), from_table: 0,
|
|
1158
|
+
table_ambiguous: tableAmbiguous,
|
|
1159
|
+
};
|
|
1160
|
+
const seenEdge = new Set();
|
|
1161
|
+
|
|
1162
|
+
for (const [p, sites] of sitesByFile) {
|
|
1163
|
+
const text = sources.get(p);
|
|
1164
|
+
const tpl = endsWithAny(p, _SFC_EXT) ? _templateSpan(text) : null;
|
|
1165
|
+
let gateGuard = null;
|
|
1166
|
+
let owners; let viaComp;
|
|
1167
|
+
if (pageFiles.has(p)) {
|
|
1168
|
+
owners = [fileRoute.get(p)]; viaComp = null;
|
|
1169
|
+
} else if (gated.has(p)) {
|
|
1170
|
+
const [gateFile] = gated.get(p);
|
|
1171
|
+
const guard = branchGuards.has(tupleKey(gateFile, p)) ? branchGuards.get(tupleKey(gateFile, p)) : null;
|
|
1172
|
+
const ownerFiles = tablePages.get(gateFile) || [];
|
|
1173
|
+
if (!(dispatchEdges && guard && ownerFiles.length)) {
|
|
1174
|
+
stats.dispatch_gated += sites.length;
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
owners = ownerFiles.map((f) => fileRoute.get(f));
|
|
1178
|
+
viaComp = p; gateGuard = guard;
|
|
1179
|
+
stats.from_dispatch += sites.length * owners.length;
|
|
1180
|
+
} else {
|
|
1181
|
+
const got = reach.get(p) || new Set();
|
|
1182
|
+
if (!got.size) { stats.no_owner += sites.length; continue; }
|
|
1183
|
+
if (got.size > maxFanout) { stats.ambiguous += sites.length; continue; }
|
|
1184
|
+
owners = [...got].sort(cmpStr).map((f) => fileRoute.get(f));
|
|
1185
|
+
viaComp = p;
|
|
1186
|
+
}
|
|
1187
|
+
for (const s of sites) {
|
|
1188
|
+
let [trigger, label, lsrc] = resolveTrigger(text, s.pos, p, tpl);
|
|
1189
|
+
// A data-table row carries its own on-screen text; the template binds it (`:text="menu.name"`).
|
|
1190
|
+
if (s.row && s.row.label) { label = s.row.label; lsrc = 'data-table'; }
|
|
1191
|
+
for (const srcRoute of owners) {
|
|
1192
|
+
const dstRoute = s.rel ? _resolveRel(srcRoute, s.rel) : s.dst;
|
|
1193
|
+
if (s.rel && !routeset.has(dstRoute)) { continue; }
|
|
1194
|
+
if (srcRoute === dstRoute) { continue; }
|
|
1195
|
+
const key = tupleKey(srcRoute, dstRoute, trigger);
|
|
1196
|
+
if (seenEdge.has(key)) { continue; }
|
|
1197
|
+
seenEdge.add(key);
|
|
1198
|
+
const args = { action: 'tap', via: 'uniapp-route', hybrid: _RUNTIME, appid, api: s.api, resolved_by: s.how };
|
|
1199
|
+
if (s.callee) { args.callee = s.callee; }
|
|
1200
|
+
if (s.row) {
|
|
1201
|
+
args.table_row = s.row.at;
|
|
1202
|
+
if (s.row.group) { args.context_label = s.row.group; }
|
|
1203
|
+
stats.from_table += 1;
|
|
1204
|
+
}
|
|
1205
|
+
if (label) {
|
|
1206
|
+
args.label = label;
|
|
1207
|
+
args.label_source = lsrc;
|
|
1208
|
+
stats.labelled += 1;
|
|
1209
|
+
} else {
|
|
1210
|
+
args.needs_trigger = true;
|
|
1211
|
+
}
|
|
1212
|
+
if (viaComp) {
|
|
1213
|
+
args.anchor = 'component';
|
|
1214
|
+
args.component = viaComp;
|
|
1215
|
+
args.component_fanout = owners.length;
|
|
1216
|
+
stats.from_component += 1;
|
|
1217
|
+
}
|
|
1218
|
+
edges.push({
|
|
1219
|
+
type: 'edge',
|
|
1220
|
+
source: pageId(appid, srcRoute),
|
|
1221
|
+
target: pageId(appid, dstRoute),
|
|
1222
|
+
mechanism: _MECH_ROUTE,
|
|
1223
|
+
trigger,
|
|
1224
|
+
guard: gateGuard,
|
|
1225
|
+
args,
|
|
1226
|
+
provenance: 'static:uniapp-source',
|
|
1227
|
+
status: 'static-only',
|
|
1228
|
+
confidence: gateGuard ? 0.5 : viaComp ? 0.7 : 0.85,
|
|
1229
|
+
});
|
|
1230
|
+
stats.attributed += 1;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
const scope = {
|
|
1236
|
+
runtime: _RUNTIME,
|
|
1237
|
+
host_activities: [],
|
|
1238
|
+
enumerable: true,
|
|
1239
|
+
reason: 'uni-app SOURCE project: routes read from pages.json',
|
|
1240
|
+
packages: [{
|
|
1241
|
+
appid,
|
|
1242
|
+
at: _rel(appRoot, projectRoot),
|
|
1243
|
+
origin_kind: 'source',
|
|
1244
|
+
sha256: null,
|
|
1245
|
+
pages: routes.length,
|
|
1246
|
+
launch,
|
|
1247
|
+
tabbar: table.tabbar,
|
|
1248
|
+
nav_attributed: stats.attributed,
|
|
1249
|
+
nav_ambiguous: stats.ambiguous,
|
|
1250
|
+
nav_dispatch_gated: stats.dispatch_gated,
|
|
1251
|
+
unattributed_nav: stats.no_owner + stats.ambiguous + stats.dispatch_gated,
|
|
1252
|
+
}],
|
|
1253
|
+
evidence: [table.pages_json],
|
|
1254
|
+
opened_from: [],
|
|
1255
|
+
opened_at: {},
|
|
1256
|
+
};
|
|
1257
|
+
return [nodes, edges, [scope, stats, seed.size, fw.size, aliases.size]];
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
const HELP_FANOUT = 'refuse to attribute a component\'s navigation when more than N ' +
|
|
1261
|
+
'pages embed it (default 8). A shared navbar reaching every page ' +
|
|
1262
|
+
'would otherwise assert that its tap navigates from all of them.';
|
|
1263
|
+
const HELP_DISPATCH = 'also emit navigation found behind a DATA-DRIVEN DISPATCH TABLE (a ' +
|
|
1264
|
+
'component whose children are gated on `v-if="x === \'literal\'"`, ' +
|
|
1265
|
+
'e.g. a server-configured \'decorated page\' renderer), each edge ' +
|
|
1266
|
+
'carrying that branch\'s own condition as its `guard`. Off by ' +
|
|
1267
|
+
'default: which branch renders comes from config the repository ' +
|
|
1268
|
+
'does not contain, so these edges are only true where a consumer ' +
|
|
1269
|
+
'HONOURS the guard. Turn it on to recover reachability for pages ' +
|
|
1270
|
+
'that no source literal reaches, and read the guards.';
|
|
1271
|
+
|
|
1272
|
+
const err = (s) => pyPrintErr(s);
|
|
1273
|
+
const toNative = (s) => (IS_WIN ? s.replace(/\n/g, '\r\n') : s);
|
|
1274
|
+
|
|
1275
|
+
export function main(argv = process.argv.slice(2)) {
|
|
1276
|
+
const ap = new ArgumentParser({ prog: 'uniapp_nav.mjs', description: "Build a UTG from a uni-app / Vue SFC project's SOURCE." });
|
|
1277
|
+
ap.add_argument('project');
|
|
1278
|
+
ap.add_argument('--workspace', { default: null });
|
|
1279
|
+
ap.add_argument('--append', { action: 'store_true' });
|
|
1280
|
+
ap.add_argument('--max-component-fanout', { type: 'int', default: 8, metavar: 'N', help: HELP_FANOUT });
|
|
1281
|
+
ap.add_argument('--dispatch-edges', { action: 'store_true', help: HELP_DISPATCH });
|
|
1282
|
+
const args = ap.parse_args(argv);
|
|
1283
|
+
|
|
1284
|
+
const project = path.resolve(args.project);
|
|
1285
|
+
const apps = findProjects(project);
|
|
1286
|
+
if (!apps.length) {
|
|
1287
|
+
err('[uniapp_nav] no uni-app project found (no pages.json with a `pages` route table) — nothing to do');
|
|
1288
|
+
return 0;
|
|
1289
|
+
}
|
|
1290
|
+
const allNodes = []; const allEdges = []; const scopes = [];
|
|
1291
|
+
for (const [appRoot, pagesJson] of apps) {
|
|
1292
|
+
const [nodes, edges, extra] = buildRecords(appRoot, pagesJson, project, args.max_component_fanout, args.dispatch_edges);
|
|
1293
|
+
if (!nodes.length) { continue; }
|
|
1294
|
+
allNodes.push(...nodes);
|
|
1295
|
+
allEdges.push(...edges);
|
|
1296
|
+
const [scope, stats, nSeed, nFw, nAlias] = extra;
|
|
1297
|
+
scopes.push(scope);
|
|
1298
|
+
const relRoot = _rel(appRoot, project);
|
|
1299
|
+
err(`[uniapp_nav] ${relRoot}: appid=${scope.packages[0].appid} routes=${nodes.length} edges=${edges.length}`);
|
|
1300
|
+
err(`[uniapp_nav] forwarders: seed=${nSeed} fixpoint=${nFw} aliases=${nAlias}`);
|
|
1301
|
+
err(`[uniapp_nav] navbar titles: ${stats.navbar_titles}/${nodes.length} page(s)`);
|
|
1302
|
+
err(`[uniapp_nav] data tables: forwarders=${stats.table_forwarders} rows=${stats.table_rows} edges=${stats.from_table} refused_multi_table=${stats.table_ambiguous}`);
|
|
1303
|
+
err(`[uniapp_nav] sites=${stats.sites} attributed=${stats.attributed} labelled=${stats.labelled} from_component=${stats.from_component}`);
|
|
1304
|
+
err(`[uniapp_nav] refused: no_owner=${stats.no_owner} ambiguous=${stats.ambiguous} dispatch_gated=${stats.dispatch_gated} (dispatch tables found: ${stats.dispatch_components})`);
|
|
1305
|
+
if (stats.from_dispatch) {
|
|
1306
|
+
err(`[uniapp_nav] from_dispatch=${stats.from_dispatch} GUARDED edge(s) — reachable only where the config branch is live; each carries its own \`v-if\` condition as guard`);
|
|
1307
|
+
} else if (stats.dispatch_gated) {
|
|
1308
|
+
err(`[uniapp_nav] ${stats.dispatch_gated} site(s) sit behind a config-driven dispatch table and were REFUSED. Pass --dispatch-edges to emit them as guarded edges instead.`);
|
|
1309
|
+
}
|
|
1310
|
+
sanityFloor('uniapp_nav', stats.sites, stats.attributed, {
|
|
1311
|
+
hint: 'Route table parsed but no navigation attributed. ' +
|
|
1312
|
+
'Check the forwarder counts above: seed=0 means no ' +
|
|
1313
|
+
'`uni.<navApi>({url: <variable>})` was found, i.e. ' +
|
|
1314
|
+
'the project\'s router uses a shape this scan does ' +
|
|
1315
|
+
'not model.',
|
|
1316
|
+
});
|
|
1317
|
+
if (nodes.length > 1 && !edges.length) {
|
|
1318
|
+
err('[uniapp_nav] SANITY: routes found but ZERO edges — every page is an orphan and the graph has no paths in it.');
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
if (args.workspace && scopes.length) {
|
|
1323
|
+
const p = P.join(args.workspace, 'hybrid_scope.json');
|
|
1324
|
+
let existing = [];
|
|
1325
|
+
if (fs.existsSync(p)) {
|
|
1326
|
+
let d; let ok = true;
|
|
1327
|
+
try { d = jsonLoads(STRICT.decode(fs.readFileSync(p)).replace(/\r\n?/g, '\n')); } catch { ok = false; }
|
|
1328
|
+
if (ok) {
|
|
1329
|
+
const h = isTrue(d) ? d : {};
|
|
1330
|
+
if (!isDict(h)) { throw new TypeError("'list' object has no attribute 'get'"); }
|
|
1331
|
+
const hosts = dget(h, 'hosts');
|
|
1332
|
+
existing = isTrue(hosts) ? hosts : [];
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
fs.writeFileSync(p, toNative(jsonDumps({ hosts: [...existing, ...scopes] }, { ensure_ascii: false, indent: 2 })), 'utf8');
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
if (args.append && args.workspace) {
|
|
1339
|
+
fs.appendFileSync(P.join(args.workspace, 'nodes.jsonl'), toNative(allNodes.map((n) => jsonDumps(n, { ensure_ascii: false }) + '\n').join('')), 'utf8');
|
|
1340
|
+
fs.appendFileSync(P.join(args.workspace, 'edges.jsonl'), toNative(allEdges.map((e) => jsonDumps(e, { ensure_ascii: false }) + '\n').join('')), 'utf8');
|
|
1341
|
+
err(`[uniapp_nav] appended ${allNodes.length} nodes, ${allEdges.length} edges -> ${args.workspace}`);
|
|
1342
|
+
} else {
|
|
1343
|
+
const out = [...allNodes, ...allEdges].map((r) => jsonDumps(r, { ensure_ascii: false }) + '\n').join('');
|
|
1344
|
+
if (out) { fs.writeSync(1, toNative(out)); }
|
|
1345
|
+
}
|
|
1346
|
+
return 0;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
const STRICT = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });
|
|
1350
|
+
|
|
1351
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { guardMain(() => main()); }
|