@buaa_smat/hometrans 0.1.19 → 26.0.0-devecocli.2
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/agents/build-fixer.md +406 -0
- package/agents/code-reviewer.md +461 -496
- package/agents/model-render-worker.md +34 -0
- package/agents/model-worker.md +23 -0
- package/agents/specgen-worker.md +18 -0
- package/commands/hometrans.md +17 -0
- package/devecocli-plugin/common.ts +2203 -0
- package/devecocli-plugin/install.ts +61 -0
- package/devecocli-plugin/uninstall.ts +26 -0
- package/devecocli-plugin/update.ts +66 -0
- package/index.js +1418 -0
- package/package.json +81 -66
- package/platforms/atomcode/agents/build-fixer.frontmatter.md +6 -0
- package/platforms/atomcode/agents/code-reviewer.frontmatter.md +6 -0
- package/platforms/atomcode/agents/model-render-worker.frontmatter.md +6 -0
- package/platforms/atomcode/agents/model-worker.frontmatter.md +6 -0
- package/platforms/atomcode/agents/specgen-worker.frontmatter.md +6 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +5 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +5 -0
- package/plugin.jsonc +12 -0
- package/skills/a2h-app-migrate/SKILL.md +181 -0
- package/skills/a2h-app-migrate/references/config.example.json +27 -0
- package/skills/a2h-app-migrate/references/specs.example.json +19 -0
- package/skills/a2h-app-migrate/references/stage-map.md +33 -0
- package/skills/a2h-app-migrate/references/workflow.yaml +1600 -0
- package/skills/a2h-app-migrate/scripts/android_index.mjs +109 -0
- package/skills/a2h-app-migrate/scripts/check_arch_done.mjs +80 -0
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +95 -0
- package/skills/a2h-app-migrate/scripts/check_signing.mjs +152 -0
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +114 -0
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +277 -0
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +77 -0
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +147 -0
- package/skills/a2h-app-migrate/scripts/cli_values.mjs +32 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1388 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +651 -0
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +53 -0
- package/skills/a2h-app-migrate/scripts/json_io.mjs +35 -0
- package/skills/a2h-app-migrate/scripts/ledger.mjs +104 -0
- package/skills/a2h-app-migrate/scripts/lib-yaml-lite.mjs +288 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +713 -0
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +205 -0
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +121 -0
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +212 -0
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +30 -0
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +455 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +80 -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 +92 -0
- package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +93 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +505 -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_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 +109 -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 +83 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +144 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +315 -0
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +133 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +133 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +158 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +181 -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_utg_dirs.mjs +39 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +168 -0
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
- package/skills/a2h-arch-generate/SKILL.md +375 -0
- package/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-android.md +103 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-uniapp.md +106 -0
- package/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
- package/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
- package/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
- package/skills/a2h-arch-generate/references/clustering-guidance.md +33 -0
- package/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
- package/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
- package/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
- package/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +120 -0
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +45 -0
- package/skills/a2h-arch-generate/references/reconciliation-model.md +204 -0
- package/skills/a2h-arch-generate/references/scope-policy.md +28 -0
- package/skills/a2h-arch-generate/references/semantic-review.md +65 -0
- package/skills/a2h-arch-generate/references/source-baseline.md +93 -0
- package/skills/a2h-arch-generate/references/source-ecosystems.md +54 -0
- package/skills/a2h-arch-generate/references/transformation-model.md +78 -0
- package/skills/a2h-arch-generate/scripts/check_module_staleness.mjs +284 -0
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +260 -0
- package/skills/a2h-arch-generate/scripts/compute_processing_order.mjs +325 -0
- package/skills/a2h-arch-generate/scripts/create_project.mjs +149 -0
- package/skills/a2h-arch-generate/scripts/dump_core_facts.mjs +151 -0
- package/skills/a2h-arch-generate/scripts/extract_core_components.mjs +167 -0
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +363 -0
- package/skills/a2h-arch-generate/scripts/generate_state.mjs +60 -0
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +326 -0
- package/skills/a2h-arch-generate/scripts/inspect_android_project.mjs +3739 -0
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +800 -0
- package/skills/a2h-arch-generate/scripts/inspect_project.mjs +251 -0
- package/skills/a2h-arch-generate/scripts/inspect_uniapp_project.mjs +809 -0
- package/skills/a2h-arch-generate/scripts/lib/py_compat.mjs +1454 -0
- package/skills/a2h-arch-generate/scripts/module_create/create.mjs +136 -0
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +636 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/build-profile.json5 +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/oh-package.json5 +10 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/applicationability/ApplicationAbility.ets +43 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/pages/Index.ets +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/module.json5 +26 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/color.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/string.json +16 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/background.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/foreground.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/layered_image.json +7 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/startIcon.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/mock/mock-config.json5 +2 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/Index.ets +1 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/build-profile.json5 +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/ets/components/MainPage.ets +19 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/module.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/string.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/Index.ets +1 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/build-profile.json5 +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/consumer-rules.txt +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/oh-package.json5 +10 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/pages/Index.ets +20 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/utils/Calc.ets +3 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/module.json5 +12 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/string.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
- package/skills/a2h-arch-generate/scripts/resolve_android_stores.mjs +529 -0
- package/skills/a2h-arch-generate/scripts/scaffold_project.mjs +230 -0
- 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 +1122 -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_router.mjs +138 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +829 -0
- package/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +937 -0
- package/skills/a2h-arch-generate/scripts/validate_homegraph_artifacts.mjs +542 -0
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +415 -0
- package/skills/a2h-arkts-logic-coder/SKILL.md +125 -0
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +6 -0
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +124 -0
- package/skills/a2h-arkts-logic-coder/scripts/check_module_scope.ts +224 -0
- package/skills/a2h-arkts-logic-coder/scripts/check_mvvm.ts +377 -0
- package/skills/a2h-arkts-logic-coder/scripts/stop_check_hook.ts +443 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_check_scripts.ts +211 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_worktree_compat.ts +81 -0
- package/skills/a2h-batch-ui-align/SKILL.md +309 -0
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +81 -0
- package/skills/a2h-batch-ui-align/flowchart.html +271 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/conversion-procedure.md +523 -661
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +139 -0
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +8 -8
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +3 -0
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +32 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +211 -0
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +192 -0
- package/skills/a2h-batch-ui-align/references/step5-convert.md +202 -0
- package/skills/a2h-batch-ui-align/scripts/agent_cli.mjs +572 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/scripts/android_parse_fast.ts +246 -39
- package/skills/a2h-batch-ui-align/scripts/answers_check.mjs +86 -0
- package/skills/a2h-batch-ui-align/scripts/arkts_static_check.ts +2689 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1656 -0
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +258 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1524 -0
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +166 -0
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1437 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +1869 -0
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +696 -0
- package/skills/a2h-batch-ui-align/scripts/harmony_index.mjs +218 -0
- package/skills/a2h-batch-ui-align/scripts/host_env.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1229 -0
- package/skills/a2h-batch-ui-align/scripts/occlusion.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1124 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +996 -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_align_tint.test.mjs +253 -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_shell.test.mjs +72 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +353 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +345 -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/export_ui_info.test.mjs +507 -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 +189 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1451 -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/measure_pack.test.mjs +170 -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 +244 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +130 -0
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +57 -0
- package/skills/a2h-dashboard-render/SKILL.md +65 -0
- package/skills/a2h-dashboard-render/references/artifact-contract.jsonc +147 -0
- package/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
- package/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
- package/skills/a2h-dashboard-render/references//347/234/213/346/235/277/350/257/264/346/230/216.md +83 -0
- package/skills/a2h-dashboard-render/scripts/artifact_contract.mjs +138 -0
- package/skills/a2h-dashboard-render/scripts/check-registry.mjs +87 -0
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +3215 -0
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +2010 -0
- package/skills/a2h-dashboard-render/scripts/page_capture.mjs +828 -0
- package/skills/a2h-dashboard-render/scripts/usage_readers.mjs +459 -0
- package/skills/a2h-dashboard-render/scripts/usage_worker.mjs +13 -0
- 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 +170 -0
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +182 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +64 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1172 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +251 -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 +303 -0
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +444 -0
- package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/SKILL.md +305 -293
- package/skills/a2h-module-semantic-docs/SKILL.md +227 -0
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +168 -0
- package/skills/a2h-module-semantic-docs/scripts/lib/py_compat.mjs +688 -0
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +1021 -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-resource-convert/SKILL.md +369 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/code-vector-icon-rules.md +4 -4
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/conversion-rules.md +16 -5
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +251 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/lottie-conversion-rules.md +17 -17
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/resource-mapping-rules.md +15 -4
- package/skills/a2h-resource-convert/references/step3_5-dependency-filter.md +54 -0
- package/skills/a2h-resource-convert/references/step4-qualifiers-and-values.md +142 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +249 -0
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +154 -0
- package/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/xml-drawable-to-svg-rules.md +38 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/a2h_resource_convert.ts +456 -90
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +1072 -0
- package/skills/a2h-resource-convert/scripts/app_identity.ts +947 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/code_vector_icons.ts +19 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +989 -0
- package/skills/a2h-resource-convert/scripts/extract_project_resources.ts +1464 -0
- 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-spec-design/SKILL.md +336 -0
- package/skills/a2h-spec-design/scripts/inspect_spec_design_inputs.mjs +146 -0
- package/skills/a2h-spec-design/scripts/lib/py_compat.mjs +481 -0
- package/skills/a2h-spec-design/scripts/move_spec_technical_reference.mjs +159 -0
- package/skills/a2h-spec-design/scripts/resolve_module_design.mjs +102 -0
- package/skills/a2h-spec-design/scripts/validate_spec_design_output.mjs +285 -0
- package/skills/a2h-spec-design/test/golden/inspect_happy.json +20 -0
- package/skills/a2h-spec-design/test/golden/move_design.md +18 -0
- package/skills/a2h-spec-design/test/golden/move_design_crlf.md +18 -0
- package/skills/a2h-spec-design/test/golden/move_spec.md +7 -0
- package/skills/a2h-spec-design/test/golden/resolve_cases.json +36 -0
- package/skills/a2h-spec-design/test/golden/validate_issue_file.md +12 -0
- package/skills/a2h-spec-design/test/golden/validate_issues.json +57 -0
- package/skills/a2h-spec-design/test/test_spec_design_scripts.mjs +381 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +228 -0
- package/skills/a2h-spec-design-pipeline/package.json +4 -0
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +63 -0
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +69 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +24 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +57 -0
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +21 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +27 -0
- package/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +21 -0
- package/skills/a2h-spec-design-pipeline/scripts/atomic_write.ts +42 -0
- package/skills/a2h-spec-design-pipeline/scripts/audit_claims.ts +252 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +77 -0
- package/skills/a2h-spec-design-pipeline/scripts/deps_ready.ts +195 -0
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +651 -0
- package/skills/a2h-spec-design-pipeline/scripts/git_baseline.ts +124 -0
- package/skills/a2h-spec-design-pipeline/scripts/inflight.mjs +944 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/bgcli.mjs +95 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +502 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_waves.ts +475 -0
- package/skills/a2h-spec-design-pipeline/scripts/reconcile.mjs +218 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +164 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_atomic_write.ts +44 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_audit_claims.ts +301 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_bgcli.mjs +64 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_branch_landed.ts +87 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_deps_ready.ts +265 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +675 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_git_baseline.ts +105 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_inflight.mjs +452 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +375 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_waves.ts +561 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_reconcile.mjs +182 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +138 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_watchdog.mjs +289 -0
- package/skills/a2h-spec-design-pipeline/scripts/watchdog.mjs +441 -0
- package/skills/a2h-spec-generate/SKILL.md +285 -0
- package/skills/a2h-spec-generate/package.json +9 -0
- package/skills/a2h-spec-generate/references/batch-mode.md +151 -0
- package/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +114 -0
- package/skills/a2h-spec-generate/references/input-formats.md +27 -0
- package/skills/a2h-spec-generate/references/library-evidence.md +3 -0
- package/skills/a2h-spec-generate/references/method-discipline.md +64 -0
- package/skills/a2h-spec-generate/references/optional-gates.json +45 -0
- package/skills/a2h-spec-generate/references/recall-guide.md +83 -0
- package/skills/a2h-spec-generate/references/recall-terse.md +3 -0
- package/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
- package/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
- package/skills/a2h-spec-generate/references/review-checklist.md +21 -0
- package/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
- package/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
- package/skills/a2h-spec-generate/references/spec-samples.md +65 -0
- package/skills/a2h-spec-generate/references/specs.schema.json +79 -0
- package/skills/a2h-spec-generate/references/synthesis-rules.md +143 -0
- package/skills/a2h-spec-generate/references/transfer-file.md +5 -0
- package/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
- package/skills/a2h-spec-generate/references/worker-rules.md +126 -0
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +514 -0
- package/skills/a2h-spec-generate/scripts/check_spec.ts +361 -0
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +470 -0
- package/skills/a2h-spec-generate/scripts/detect-project.mjs +271 -0
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +188 -0
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +150 -0
- package/skills/a2h-spec-generate/scripts/inspect-uniapp.mjs +733 -0
- package/skills/{hmos-spec-generate → a2h-spec-generate}/scripts/parse_requirements.ts +1 -1
- package/skills/a2h-spec-generate/scripts/prepare-facts.mjs +307 -0
- package/skills/a2h-spec-generate/scripts/publication-verdict.mjs +171 -0
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +280 -0
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +399 -0
- package/skills/a2h-spec-generate/scripts/report.mjs +132 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/dashboard.html +149 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-api.js +49 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-code-view.js +140 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-format.js +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-handoff.js +42 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-splitters.js +78 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-state.js +47 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-tree.js +194 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-virtual-list.js +118 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.css +245 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.html +99 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.js +220 -0
- package/skills/a2h-spec-generate/scripts/reqgen/package-lock.json +47 -0
- package/skills/a2h-spec-generate/scripts/reqgen/package.json +23 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/agent-render/serve.ts +95 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/callback-call-sites.ts +82 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/area-ownership.ts +496 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/callback-flow.ts +386 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/index.ts +24 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/index.ts +22 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1270 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/index.ts +10 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/projection.ts +804 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/render-projection.ts +51 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/android-interaction-registry.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/builder.ts +453 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/compose-api-registry.ts +526 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/index.ts +15 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/connector/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/connector/utg-inbound.ts +763 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/area-graph.ts +383 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/artifact.ts +68 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/common.ts +88 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/diagnostic.ts +64 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/gap-audit.ts +113 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/index.ts +12 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/name-traceability.ts +108 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/raw-fact.ts +377 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/req-model.ts +238 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/run.ts +134 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/semantic-completeness.ts +35 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/source-facts.ts +48 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/utg.ts +133 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/core/output-guard.ts +42 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/core/stable-id.ts +118 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/cross-area-tally-cli.ts +179 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dashboard-cli.ts +188 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump/dump.ts +1184 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump-cli.ts +373 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1014 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-output.ts +32 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +142 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +312 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +310 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +685 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/graph/paths.ts +575 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/homegraph-cli.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/android-resource-resolver.ts +391 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/androidx-preference-contracts.ts +44 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +640 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/cross-area.ts +207 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/finalizer.ts +1297 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/identity.ts +186 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/index.ts +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/planner.ts +312 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/preference-enrichment.ts +793 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/raw-facts.ts +355 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/rules.ts +271 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/scanner.ts +666 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/schema.ts +365 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/stable-key.ts +144 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +301 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/uniapp-utg-adapter.ts +543 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/xml-adapter.ts +262 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/assemble.ts +2079 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +157 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +809 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/index.ts +17 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/io.ts +165 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +806 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/query.ts +360 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/seeds.ts +218 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/spec-bindings-sidecar.ts +240 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +359 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model-cli.ts +500 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/pipeline/index.ts +7 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/pipeline/output.ts +307 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +172 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-cov/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-cov/source-cov.ts +176 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/area-graph.ts +490 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/index.ts +23 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-model.ts +957 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +248 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/semantic-area-graph.ts +1600 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/types.ts +10 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/artifact-data.ts +201 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-api.ts +74 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-code-view.ts +180 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-format.ts +18 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-handoff.ts +55 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-splitters.ts +78 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-state.ts +66 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-tree.ts +232 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-virtual-list.ts +179 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz.ts +240 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/contracts.d.ts +86 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/index.ts +3 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/server.ts +239 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/source-project.ts +316 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz-cli.ts +200 -0
- 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/fusion-area-facts.test.ts +576 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +290 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1323 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +574 -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 +831 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +548 -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 +396 -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 +298 -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/tsconfig.json +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/tsconfig.viz-client.json +12 -0
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +632 -0
- package/skills/a2h-spec-generate/test/check-spec.test.ts +200 -0
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +538 -0
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +45 -0
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +147 -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/publication-verdict.test.mjs +157 -0
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +282 -0
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +593 -0
- package/skills/a2h-utg-explorer/SKILL.md +120 -0
- package/skills/a2h-utg-explorer/assets/final_viewer.html +64 -0
- package/skills/a2h-utg-explorer/assets/u2.LICENSE +21 -0
- package/skills/a2h-utg-explorer/assets/u2.NOTICE +25 -0
- package/skills/a2h-utg-explorer/assets/u2.jar +0 -0
- package/skills/a2h-utg-explorer/references/architecture.md +270 -0
- package/skills/a2h-utg-explorer/references/protocol.md +9 -0
- package/skills/a2h-utg-explorer/scripts/app_settings.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +749 -0
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +597 -0
- package/skills/a2h-utg-explorer/scripts/device_health.mjs +227 -0
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +276 -0
- package/skills/a2h-utg-explorer/scripts/evidence.mjs +108 -0
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +258 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +170 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +467 -0
- package/skills/a2h-utg-explorer/scripts/recover_b.mjs +542 -0
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +302 -0
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +203 -0
- package/skills/a2h-utg-explorer/scripts/report.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +831 -0
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +137 -0
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.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 +223 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +88 -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 +136 -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/generalization_fixes.test.mjs +251 -0
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +42 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +162 -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 +204 -0
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +355 -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 +207 -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 +453 -0
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +131 -0
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +321 -0
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -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/_device_io.mjs +244 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/_py.mjs +2097 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +1213 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/attest.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/chain.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/coverage.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/device_lock.mjs +46 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1136 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +1513 -0
- package/skills/a2h-utg-explorer/scripts/variant.mjs +75 -0
- package/skills/a2h-utg-explorer/scripts/worklist_parts.mjs +122 -0
- package/skills/a2h-utg-static/SKILL.md +361 -0
- package/skills/a2h-utg-static/config.json +19 -0
- package/skills/a2h-utg-static/references/extractors.md +217 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
- package/skills/a2h-utg-static/references/view-interactions.md +215 -0
- package/skills/a2h-utg-static/scripts/_graph.mjs +361 -0
- package/skills/a2h-utg-static/scripts/_py.mjs +2177 -0
- package/skills/a2h-utg-static/scripts/_spawn.mjs +45 -0
- package/skills/a2h-utg-static/scripts/activity_nav.mjs +738 -0
- package/skills/a2h-utg-static/scripts/activity_widgets.mjs +254 -0
- package/skills/a2h-utg-static/scripts/adapter_nav.mjs +229 -0
- package/skills/a2h-utg-static/scripts/androidfragment_nav.mjs +208 -0
- package/skills/a2h-utg-static/scripts/assemble.mjs +2065 -0
- package/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/skills/a2h-utg-static/scripts/carry_answers.mjs +201 -0
- package/skills/a2h-utg-static/scripts/click_paths.mjs +594 -0
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +172 -0
- package/skills/a2h-utg-static/scripts/compose_merge.mjs +263 -0
- package/skills/a2h-utg-static/scripts/compose_nav.mjs +1216 -0
- package/skills/a2h-utg-static/scripts/compose_navbar_nav.mjs +238 -0
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +2760 -0
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +365 -0
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
- package/skills/a2h-utg-static/scripts/dialog_listener_nav.mjs +237 -0
- package/skills/a2h-utg-static/scripts/dialogshow_nav.mjs +308 -0
- package/skills/a2h-utg-static/scripts/fragfactory_nav.mjs +170 -0
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +1136 -0
- package/skills/a2h-utg-static/scripts/guard_subjects.mjs +162 -0
- package/skills/a2h-utg-static/scripts/hg_query.mjs +137 -0
- package/skills/a2h-utg-static/scripts/host_resolve.mjs +393 -0
- package/skills/a2h-utg-static/scripts/hybrid_bundle.mjs +165 -0
- package/skills/a2h-utg-static/scripts/hybrid_pages.mjs +713 -0
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -0
- package/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/skills/a2h-utg-static/scripts/io_utils.mjs +59 -0
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +864 -0
- package/skills/a2h-utg-static/scripts/launch_extras.mjs +91 -0
- package/skills/a2h-utg-static/scripts/layout_resolve.mjs +148 -0
- package/skills/a2h-utg-static/scripts/manifest.mjs +483 -0
- package/skills/a2h-utg-static/scripts/measure/measure_corpus.mjs +297 -0
- package/skills/a2h-utg-static/scripts/measure/measure_guards.mjs +98 -0
- package/skills/a2h-utg-static/scripts/media_browse_nav.mjs +356 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +603 -0
- package/skills/a2h-utg-static/scripts/navactions_nav.mjs +255 -0
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +453 -0
- package/skills/a2h-utg-static/scripts/orphan_overlay_nav.mjs +89 -0
- package/skills/a2h-utg-static/scripts/phase_plan.mjs +108 -0
- package/skills/a2h-utg-static/scripts/phase_planner.mjs +119 -0
- package/skills/a2h-utg-static/scripts/plaindialog_nav.mjs +411 -0
- package/skills/a2h-utg-static/scripts/preference_nav.mjs +761 -0
- package/skills/a2h-utg-static/scripts/preference_widgets.mjs +142 -0
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
- package/skills/a2h-utg-static/scripts/registry_nav.mjs +288 -0
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +870 -0
- package/skills/a2h-utg-static/scripts/scope_utils.mjs +430 -0
- package/skills/a2h-utg-static/scripts/screen_merge.mjs +287 -0
- package/skills/a2h-utg-static/scripts/screen_nav.mjs +279 -0
- package/skills/a2h-utg-static/scripts/single_host_nav.mjs +291 -0
- package/skills/a2h-utg-static/scripts/starter_nav.mjs +198 -0
- package/skills/a2h-utg-static/scripts/state_guard.mjs +579 -0
- package/skills/a2h-utg-static/scripts/static_prior.mjs +904 -0
- package/skills/a2h-utg-static/scripts/tests/_zipw.mjs +28 -0
- package/skills/a2h-utg-static/scripts/tests/probe_autoload.mjs +108 -0
- package/skills/a2h-utg-static/scripts/tests/probe_layout_fragments.mjs +90 -0
- package/skills/a2h-utg-static/scripts/tests/probe_unknown_scope.mjs +61 -0
- package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
- package/skills/a2h-utg-static/scripts/tests/test_activity_alias_launcher.mjs +90 -0
- package/skills/a2h-utg-static/scripts/tests/test_activity_supertype_chain.mjs +106 -0
- package/skills/a2h-utg-static/scripts/tests/test_bottom_sheet_container.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_branch_guard.mjs +19 -0
- package/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +103 -0
- package/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
- package/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
- package/skills/a2h-utg-static/scripts/tests/test_commit_scope.mjs +113 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_file_private_route.mjs +117 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_nested_graph.mjs +166 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_route_holder_collision.mjs +112 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +267 -0
- package/skills/a2h-utg-static/scripts/tests/test_custom_source_root.mjs +71 -0
- package/skills/a2h-utg-static/scripts/tests/test_defensive_null_guard.mjs +77 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialog_orphan_entries.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialog_page_owner.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_builder_forms.mjs +96 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_java_factory.mjs +37 -0
- package/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
- package/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
- package/skills/a2h-utg-static/scripts/tests/test_edge_dedupe_by_gesture.mjs +111 -0
- package/skills/a2h-utg-static/scripts/tests/test_edge_provenance_lint.mjs +70 -0
- package/skills/a2h-utg-static/scripts/tests/test_enclosing_gesture.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_external_surface_roots.mjs +43 -0
- package/skills/a2h-utg-static/scripts/tests/test_find_package_indirect.mjs +67 -0
- package/skills/a2h-utg-static/scripts/tests/test_forwarding_wrapper.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_fragment_containment.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_fragment_helper_trigger.mjs +92 -0
- package/skills/a2h-utg-static/scripts/tests/test_graph.mjs +55 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_clause.mjs +86 -0
- package/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +119 -0
- package/skills/a2h-utg-static/scripts/tests/test_host_kind_by_chain.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
- package/skills/a2h-utg-static/scripts/tests/test_interaction_sites.mjs +272 -0
- package/skills/a2h-utg-static/scripts/tests/test_item_data_instance.mjs +51 -0
- package/skills/a2h-utg-static/scripts/tests/test_kotlin_fn_spans.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
- package/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
- package/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
- package/skills/a2h-utg-static/scripts/tests/test_layout_declared_fragment.mjs +103 -0
- package/skills/a2h-utg-static/scripts/tests/test_listener_call_forms.mjs +79 -0
- package/skills/a2h-utg-static/scripts/tests/test_listener_receiver_binding.mjs +47 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_exported_default.mjs +40 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_filters_modules.mjs +84 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_srcfile.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_namespace.mjs +33 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +44 -0
- package/skills/a2h-utg-static/scripts/tests/test_multiple_entry_contracts.mjs +80 -0
- package/skills/a2h-utg-static/scripts/tests/test_nav_graph_xml.mjs +35 -0
- package/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_node_id_collision.mjs +57 -0
- package/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
- package/skills/a2h-utg-static/scripts/tests/test_out_of_scope_and_settings.mjs +72 -0
- package/skills/a2h-utg-static/scripts/tests/test_overload_and_climb.mjs +86 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_page_source.mjs +78 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_position_zero.mjs +65 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_variant_guard.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +107 -0
- package/skills/a2h-utg-static/scripts/tests/test_plain_dialog_nodes.mjs +167 -0
- package/skills/a2h-utg-static/scripts/tests/test_plaindialog_shared_anchor.mjs +117 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_click_nav.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_host_binding.mjs +87 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_nesting.mjs +183 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
- package/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
- package/skills/a2h-utg-static/scripts/tests/test_resolver_tier_parity.mjs +126 -0
- package/skills/a2h-utg-static/scripts/tests/test_result_launcher.mjs +142 -0
- package/skills/a2h-utg-static/scripts/tests/test_review_fixes.mjs +135 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +66 -0
- package/skills/a2h-utg-static/scripts/tests/test_same_name_decl_scope.mjs +236 -0
- package/skills/a2h-utg-static/scripts/tests/test_scope_utils.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_overlay_split.mjs +63 -0
- package/skills/a2h-utg-static/scripts/tests/test_slug_parity.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_starter_node_id.mjs +41 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_arity.mjs +109 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_commented_candidates.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_model_gates.mjs +127 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
- package/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
- package/skills/a2h-utg-static/scripts/tests/test_template_method_layout.mjs +81 -0
- package/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_trigger_id_spelling.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_action_override.mjs +91 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_nl_hint_key.mjs +89 -0
- package/skills/a2h-utg-static/scripts/tests/test_uiless_host_fold.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_click_refs.mjs +104 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_id_label.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_interactions.mjs +346 -0
- package/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +273 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_widget_class_scope.mjs +92 -0
- package/skills/a2h-utg-static/scripts/tests/test_window_nav_kotlin.mjs +158 -0
- package/skills/a2h-utg-static/scripts/tests/test_worklist_parts.mjs +65 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1119 -0
- package/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +721 -0
- package/skills/a2h-utg-static/scripts/view_interactions.mjs +799 -0
- package/skills/a2h-utg-static/scripts/view_widgets.mjs +512 -0
- package/skills/a2h-utg-static/scripts/viewpage_nav.mjs +485 -0
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +422 -0
- package/skills/a2h-utg-static/scripts/window_nav.mjs +240 -0
- package/skills/a2h-utg-static/scripts/worklist_parts.mjs +154 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
- package/skills/a2h-utg-static/tools/package.json +3 -0
- package/README.md +0 -427
- package/agents/logic-coder.md +0 -224
- package/agents/logic-context-builder.md +0 -212
- package/agents/scripts/hmos-precheck/backends/arkts.mjs +0 -567
- package/agents/scripts/hmos-precheck/backends/arkts_diff.mjs +0 -159
- package/agents/scripts/hmos-precheck/backends/arkts_project_rules.mjs +0 -398
- package/agents/scripts/hmos-precheck/backends/codelinter.mjs +0 -250
- package/agents/scripts/hmos-precheck/backends/project_integrity.mjs +0 -321
- package/agents/scripts/hmos-precheck/backends/static_precheck.mjs +0 -247
- package/agents/scripts/hmos-precheck/core/config.mjs +0 -184
- package/agents/scripts/hmos-precheck/core/diagnostic_scope.mjs +0 -20
- package/agents/scripts/hmos-precheck/core/process_adapter.mjs +0 -47
- package/agents/scripts/hmos-precheck/core/project_catalog.mjs +0 -50
- package/agents/scripts/hmos-precheck/core/result_projection.mjs +0 -147
- package/agents/scripts/hmos-precheck/core/scope_plan.mjs +0 -131
- package/agents/scripts/hmos-precheck/core/sdk_context.mjs +0 -67
- package/agents/scripts/hmos-precheck/docs/architecture.md +0 -37
- package/agents/scripts/hmos-precheck/docs/performance-optimization.md +0 -28
- package/agents/scripts/hmos-precheck/docs/upstream-reference.json +0 -19
- package/agents/scripts/hmos-precheck/docs/validation.md +0 -50
- package/agents/scripts/hmos-precheck/index.mjs +0 -17
- package/agents/scripts/hmos-precheck/invocation.mjs +0 -231
- package/agents/scripts/hmos-precheck/rules/rule_case_matrix.csv +0 -32
- package/agents/scripts/hmos-precheck/rules/rule_inventory.csv +0 -64
- package/agents/scripts/hmos-precheck/rules/rule_inventory.mjs +0 -59
- package/agents/scripts/hmos-precheck/rules/rule_policy.mjs +0 -54
- package/agents/scripts/platform_query.mjs +0 -626
- package/agents/scripts/platform_query.test.mjs +0 -422
- package/agents/self-test-fixer.md +0 -298
- package/agents/self-tester.md +0 -376
- package/agents/test-case-generation-generator.md +0 -317
- package/agents/test-case-generation-validator.md +0 -231
- package/dist/cli/config-store.js +0 -390
- package/dist/cli/config.js +0 -46
- package/dist/cli/env-vars.js +0 -127
- package/dist/cli/index.js +0 -56
- package/dist/cli/init.js +0 -1194
- package/dist/cli/uninstall.js +0 -427
- package/dist/utils/regex.js +0 -8
- package/env-requirements.json +0 -178
- package/resource/choose_editor.png +0 -0
- package/resource/convert_pipeline_process.svg +0 -103
- package/resource/project_architecture.svg +0 -122
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/resource/set_sdk.png +0 -0
- package/resource/title_dark.png +0 -0
- package/skills/hmos-batch-ui-align/SKILL.md +0 -413
- package/skills/hmos-batch-ui-align/scripts/arkts_static_check.ts +0 -1592
- package/skills/hmos-batch-ui-align/scripts/measure_pack.ts +0 -752
- package/skills/hmos-convert-pipeline/SKILL.md +0 -476
- package/skills/hmos-incremental-ui-align/README.md +0 -251
- package/skills/hmos-incremental-ui-align/SKILL.md +0 -375
- package/skills/hmos-incremental-ui-align/diff_analysis.md +0 -53
- package/skills/hmos-incremental-ui-align/page_align.md +0 -62
- package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +0 -38
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -648
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +0 -2089
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +0 -1033
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -1183
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +0 -576
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +0 -297
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +0 -395
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -903
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +0 -106
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -1178
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +0 -911
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +0 -355
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +0 -11
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +0 -206
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +0 -373
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +0 -158
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +0 -750
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +0 -1704
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +0 -1012
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +0 -164
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +0 -840
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -856
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +0 -83
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -294
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +0 -1220
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +0 -47
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +0 -840
- package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +0 -74
- package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +0 -34
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +0 -2533
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +0 -555
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -117
- package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +0 -937
- package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +0 -343
- package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +0 -76
- package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +0 -977
- package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +0 -188
- package/skills/hmos-integration-test/README.md +0 -300
- package/skills/hmos-integration-test/SKILL.md +0 -397
- package/skills/hmos-resources-convert/SKILL.md +0 -891
- package/skills/hmos-spec-generate/SKILL.md +0 -404
- package/skills/hmos-test-case-generation/README.md +0 -241
- package/skills/hmos-test-case-generation/SKILL.md +0 -324
- package/skills/hmos-test-case-generation/references/contract.md +0 -315
- package/skills/hmos-test-case-generation/references/review-notes-template.md +0 -84
- package/skills/hmos-test-case-generation/references/ui-elements-schema.md +0 -142
- package/skills/hmos-test-case-generation/tools/convert_to_ui_elements.ts +0 -550
- package/skills/hmos-test-case-generation/tools/validate.ts +0 -1312
- package/tools/bfs-crawl/README.md +0 -73
- package/tools/bfs-crawl/android_viewtree_bfs_crawler.ts +0 -1662
- package/tools/test-tools/autotest/config.ts +0 -175
- package/tools/test-tools/autotest/deps/autotest-agent-0.1.1.tgz +0 -0
- package/tools/test-tools/autotest/docs/README.md +0 -266
- package/tools/test-tools/autotest/docs/testcases_schema.md +0 -143
- package/tools/test-tools/autotest/engine/batch-launcher.ts +0 -327
- package/tools/test-tools/autotest/engine/report-tool.ts +0 -773
- package/tools/test-tools/autotest/engine/self-test-runner.ts +0 -961
- package/tools/test-tools/autotest/engine/testcases-tool.ts +0 -246
- package/tools/test-tools/autotest/paths.ts +0 -41
- package/tools/test-tools/autotest/resolve-metadata-tool.ts +0 -143
- package/tools/test-tools/autotest/runner/logger.ts +0 -45
- package/tools/test-tools/autotest/runner/process-utils.ts +0 -41
- package/tools/test-tools/autotest/validate.ts +0 -167
- /package/skills/{hmos-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" → a2h-arch-generate/references/arkts-mvvm-v2.md} +0 -0
- /package/{README.en.md → skills/a2h-arch-generate/scripts/module_create/har/consumer-rules.txt} +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2 → a2h-batch-ui-align/references/mvvm-v2}/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md" +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/arkts-strict-patterns.md +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/known-patterns.md +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/rdb-entity-pattern.md +0 -0
- /package/skills/{hmos-resources-convert → a2h-resource-convert}/references/dependency-analysis-rules.md +0 -0
- /package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/svg_fidelity_check.ts +0 -0
- /package/skills/{hmos-spec-generate → a2h-spec-generate}/template/REQ.txt +0 -0
- /package/skills/{hmos-spec-generate → a2h-spec-generate}/template/REQ.xlsx +0 -0
|
@@ -0,0 +1,2079 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AnalysisContext,
|
|
3
|
+
UnresolvedItem
|
|
4
|
+
} from "../contracts/artifact.ts";
|
|
5
|
+
import type {
|
|
6
|
+
Action,
|
|
7
|
+
Area,
|
|
8
|
+
AreaGraphArtifact,
|
|
9
|
+
AreaGraphView,
|
|
10
|
+
AreaPath,
|
|
11
|
+
Edge,
|
|
12
|
+
Effect,
|
|
13
|
+
EntryPoint,
|
|
14
|
+
NavigationEvidence
|
|
15
|
+
} from "../contracts/area-graph.ts";
|
|
16
|
+
import {
|
|
17
|
+
isReqProjectedAction,
|
|
18
|
+
toAreaGraphDocument,
|
|
19
|
+
withAreaGraphFlatViews
|
|
20
|
+
} from "../contracts/area-graph.ts";
|
|
21
|
+
import {
|
|
22
|
+
GAP_AUDIT_CONTRACT_VERSION,
|
|
23
|
+
type GapAuditArtifact,
|
|
24
|
+
type GapAuditCandidate,
|
|
25
|
+
type GapAuditCategory
|
|
26
|
+
} from "../contracts/gap-audit.ts";
|
|
27
|
+
import type {
|
|
28
|
+
RawFactDataByKind,
|
|
29
|
+
RawFactInput,
|
|
30
|
+
RawFactKind
|
|
31
|
+
} from "../contracts/raw-fact.ts";
|
|
32
|
+
import type { ReqFeature, ReqModelArtifact } from "../contracts/req-model.ts";
|
|
33
|
+
import type { SemanticLimitation } from "../contracts/semantic-completeness.ts";
|
|
34
|
+
import type { SourceFactsArtifact } from "../contracts/source-facts.ts";
|
|
35
|
+
import type {
|
|
36
|
+
ImportedUtgLink,
|
|
37
|
+
ImportedUtgNode,
|
|
38
|
+
ImportedUtgPath,
|
|
39
|
+
ImportedUtgTopology,
|
|
40
|
+
ImportedUtgWorkspace
|
|
41
|
+
} from "../contracts/utg.ts";
|
|
42
|
+
import { buildAreaGraph } from "../analysis/graph/index.ts";
|
|
43
|
+
import {
|
|
44
|
+
assembleReqProjection,
|
|
45
|
+
buildReqModel
|
|
46
|
+
} from "../analysis/req-model/index.ts";
|
|
47
|
+
import { SourceFactsBuilder } from "../analysis/source-facts/builder.ts";
|
|
48
|
+
import { createStableId } from "../core/stable-id.ts";
|
|
49
|
+
import type {
|
|
50
|
+
FinalizedInteractionAnalysis,
|
|
51
|
+
InteractionEffectDraft,
|
|
52
|
+
InteractionFinalizeDiagnostic
|
|
53
|
+
} from "../interaction-analysis/contracts.ts";
|
|
54
|
+
import {
|
|
55
|
+
buildInteractionRawFactPlan,
|
|
56
|
+
type KeyedRawFactPatch
|
|
57
|
+
} from "../interaction-analysis/raw-facts.ts";
|
|
58
|
+
import { validateAreaGraph } from "../validation/area-graph.ts";
|
|
59
|
+
|
|
60
|
+
export interface AssembleModelInput {
|
|
61
|
+
readonly requirementScope?: import("../requirement-scope.ts").ReqGenerationScope;
|
|
62
|
+
readonly caseId: string;
|
|
63
|
+
readonly analysisContext: AnalysisContext;
|
|
64
|
+
readonly utg: ImportedUtgWorkspace;
|
|
65
|
+
readonly interactions: FinalizedInteractionAnalysis;
|
|
66
|
+
readonly sourceAvailability?: {
|
|
67
|
+
readonly treeSitter: boolean;
|
|
68
|
+
readonly homeGraph: boolean;
|
|
69
|
+
};
|
|
70
|
+
/** Stable identifier used by gap-audit; defaults to the input fingerprint. */
|
|
71
|
+
readonly runId?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface ModelAssemblyStatistics {
|
|
75
|
+
readonly areas: number;
|
|
76
|
+
readonly utgLinks: number;
|
|
77
|
+
readonly utgLinksWithEvidence: number;
|
|
78
|
+
readonly topologySeeds: number;
|
|
79
|
+
readonly sourceControls: number;
|
|
80
|
+
readonly visibleFeatures: number;
|
|
81
|
+
readonly canonicalPaths: number;
|
|
82
|
+
readonly unreachablePaths: number;
|
|
83
|
+
readonly unresolvedPathAreas: number;
|
|
84
|
+
readonly internalEdgesWithoutUtgEvidence: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface AssembledModelArtifacts {
|
|
88
|
+
readonly sourceFacts: SourceFactsArtifact;
|
|
89
|
+
readonly areaGraph: AreaGraphView;
|
|
90
|
+
readonly areaGraphArtifact: AreaGraphArtifact;
|
|
91
|
+
readonly reqModel: ReqModelArtifact;
|
|
92
|
+
readonly gapAudit: GapAuditArtifact;
|
|
93
|
+
readonly statistics: ModelAssemblyStatistics;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface SourceInteractionEffect {
|
|
97
|
+
readonly areaRef: string;
|
|
98
|
+
readonly actionSemanticKey: string;
|
|
99
|
+
readonly effect: InteractionEffectDraft;
|
|
100
|
+
readonly callbackKey: string;
|
|
101
|
+
readonly effectKey: string;
|
|
102
|
+
readonly callbackFactRef: string;
|
|
103
|
+
readonly effectFactRef: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface TopologySeed {
|
|
107
|
+
readonly link: ImportedUtgLink;
|
|
108
|
+
readonly callbackFactRef: string;
|
|
109
|
+
readonly effectFactRef: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface UtgFactIndex {
|
|
113
|
+
readonly componentKeyByArea: ReadonlyMap<string, string>;
|
|
114
|
+
readonly componentFactByArea: ReadonlyMap<string, string>;
|
|
115
|
+
readonly titleFactByArea: ReadonlyMap<string, string>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function stableId(
|
|
119
|
+
caseId: string,
|
|
120
|
+
namespace: string,
|
|
121
|
+
entityKind: string,
|
|
122
|
+
identity: string
|
|
123
|
+
): string {
|
|
124
|
+
return createStableId({
|
|
125
|
+
namespace,
|
|
126
|
+
caseId,
|
|
127
|
+
entityKind,
|
|
128
|
+
identity: [{ kind: "semantic-key", value: identity }]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function compareId(left: { readonly id: string }, right: { readonly id: string }): number {
|
|
133
|
+
return left.id.localeCompare(right.id, "en");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function unique(values: readonly string[]): string[] {
|
|
137
|
+
return [...new Set(values)].sort((left, right) =>
|
|
138
|
+
left.localeCompare(right, "en")
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function encoded(value: string): string {
|
|
143
|
+
return encodeURIComponent(value.normalize("NFC"));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function utgEvidence(index: number, anchor: string) {
|
|
147
|
+
return {
|
|
148
|
+
sourceKind: "generated" as const,
|
|
149
|
+
path: "utg/utg.json",
|
|
150
|
+
anchor,
|
|
151
|
+
range: { startLine: index + 1, endLine: index + 1 }
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function componentType(node: ImportedUtgNode): RawFactDataByKind["component"]["componentType"] {
|
|
156
|
+
switch (node.kind) {
|
|
157
|
+
case "activity":
|
|
158
|
+
case "activity-content":
|
|
159
|
+
case "host-activity":
|
|
160
|
+
return "activity";
|
|
161
|
+
case "fragment":
|
|
162
|
+
return "fragment";
|
|
163
|
+
case "dialog":
|
|
164
|
+
return "dialog";
|
|
165
|
+
case "sheet":
|
|
166
|
+
case "sheet-screen":
|
|
167
|
+
return "bottom-sheet";
|
|
168
|
+
case "menu":
|
|
169
|
+
return "popup";
|
|
170
|
+
case "pager-page":
|
|
171
|
+
return "pager-page";
|
|
172
|
+
case "app-widget":
|
|
173
|
+
return "widget";
|
|
174
|
+
default:
|
|
175
|
+
// UTG nodes, including modes, variants, dynamic nodes and external
|
|
176
|
+
// screens, are authoritative Areas. compose-destination is the generic
|
|
177
|
+
// Area-capable source-fact type; the final Area.kind remains node.kind.
|
|
178
|
+
return "compose-destination";
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function displayName(node: ImportedUtgNode): string {
|
|
183
|
+
for (const value of [node.label, node.name, node.fqn, node.id]) {
|
|
184
|
+
if (value?.trim()) return value.trim();
|
|
185
|
+
}
|
|
186
|
+
return node.id;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function addUtgNodeFacts(
|
|
190
|
+
builder: SourceFactsBuilder,
|
|
191
|
+
topology: ImportedUtgTopology,
|
|
192
|
+
applicationModule: string
|
|
193
|
+
): UtgFactIndex {
|
|
194
|
+
const componentKeyByArea = new Map<string, string>();
|
|
195
|
+
const componentFactByArea = new Map<string, string>();
|
|
196
|
+
const titleFactByArea = new Map<string, string>();
|
|
197
|
+
topology.nodes.forEach((node, index) => {
|
|
198
|
+
const semanticKey = `utg-component:${encoded(node.id)}`;
|
|
199
|
+
const evidence = utgEvidence(index, `node:${node.id}`);
|
|
200
|
+
const componentFactRef = builder.addFact("component", {
|
|
201
|
+
identity: [{ kind: "component", value: node.id }],
|
|
202
|
+
confidence: node.confidence !== undefined && node.confidence < 0.7
|
|
203
|
+
? "medium"
|
|
204
|
+
: "high",
|
|
205
|
+
support: [{ location: evidence, role: "frozen UTG Area" }],
|
|
206
|
+
data: {
|
|
207
|
+
componentType: componentType(node),
|
|
208
|
+
qualifiedName: node.fqn ?? node.name ?? `utg:${node.id}`,
|
|
209
|
+
applicationModule
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
const titleFactRef = builder.addFact("ui-property", {
|
|
213
|
+
identity: [
|
|
214
|
+
{ kind: "component", value: node.id },
|
|
215
|
+
{ kind: "semantic-key", value: "utg-display-name" }
|
|
216
|
+
],
|
|
217
|
+
confidence: "high",
|
|
218
|
+
support: [{ location: evidence, role: "frozen UTG Area label" }],
|
|
219
|
+
data: {
|
|
220
|
+
ownerKey: componentFactRef,
|
|
221
|
+
property: "title",
|
|
222
|
+
value: displayName(node)
|
|
223
|
+
},
|
|
224
|
+
relatedFactRefs: [componentFactRef]
|
|
225
|
+
});
|
|
226
|
+
componentKeyByArea.set(node.id, semanticKey);
|
|
227
|
+
componentFactByArea.set(node.id, componentFactRef);
|
|
228
|
+
titleFactByArea.set(node.id, titleFactRef);
|
|
229
|
+
});
|
|
230
|
+
return { componentKeyByArea, componentFactByArea, titleFactByArea };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function addEntryFacts(
|
|
234
|
+
builder: SourceFactsBuilder,
|
|
235
|
+
topology: ImportedUtgTopology,
|
|
236
|
+
facts: UtgFactIndex
|
|
237
|
+
): void {
|
|
238
|
+
topology.entryRootAreaRefs.forEach((root, index) => {
|
|
239
|
+
const componentRef = facts.componentFactByArea.get(root);
|
|
240
|
+
if (!componentRef) throw new Error(`UTG entry root has no Area: ${root}`);
|
|
241
|
+
builder.addFact("entry-point", {
|
|
242
|
+
identity: [
|
|
243
|
+
{ kind: "entry", value: root },
|
|
244
|
+
{ kind: "component", value: root }
|
|
245
|
+
],
|
|
246
|
+
confidence: "high",
|
|
247
|
+
support: [{
|
|
248
|
+
location: utgEvidence(index, `entry-root:${root}`),
|
|
249
|
+
role: "frozen UTG entry root"
|
|
250
|
+
}],
|
|
251
|
+
data: {
|
|
252
|
+
entryKind: "launcher",
|
|
253
|
+
category: root === topology.rootAreaRef ? "normal" : "alternate",
|
|
254
|
+
componentKey: componentRef,
|
|
255
|
+
conditionKeys: [],
|
|
256
|
+
startupRole: "default"
|
|
257
|
+
},
|
|
258
|
+
relatedFactRefs: [componentRef]
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function resolveRef(mapping: ReadonlyMap<string, string>, key: string): string {
|
|
264
|
+
const ref = mapping.get(key);
|
|
265
|
+
if (!ref) throw new Error(`Raw-fact plan references unknown key ${key}`);
|
|
266
|
+
return ref;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function resolveFactData<K extends RawFactKind>(
|
|
270
|
+
kind: K,
|
|
271
|
+
data: RawFactDataByKind[K],
|
|
272
|
+
mapping: ReadonlyMap<string, string>
|
|
273
|
+
): RawFactDataByKind[K] {
|
|
274
|
+
switch (kind) {
|
|
275
|
+
case "component":
|
|
276
|
+
case "resource-value":
|
|
277
|
+
return data;
|
|
278
|
+
case "component-variant": {
|
|
279
|
+
const value = data as RawFactDataByKind["component-variant"];
|
|
280
|
+
return {
|
|
281
|
+
...value,
|
|
282
|
+
componentKey: resolveRef(mapping, value.componentKey),
|
|
283
|
+
conditionKeys: value.conditionKeys.map((key) => resolveRef(mapping, key)),
|
|
284
|
+
entryCallbackKeys: value.entryCallbackKeys.map((key) => resolveRef(mapping, key)),
|
|
285
|
+
...(value.visibleElementKeys
|
|
286
|
+
? { visibleElementKeys: value.visibleElementKeys.map((key) => resolveRef(mapping, key)) }
|
|
287
|
+
: {})
|
|
288
|
+
} as unknown as RawFactDataByKind[K];
|
|
289
|
+
}
|
|
290
|
+
case "entry-point": {
|
|
291
|
+
const value = data as RawFactDataByKind["entry-point"];
|
|
292
|
+
return {
|
|
293
|
+
...value,
|
|
294
|
+
componentKey: resolveRef(mapping, value.componentKey),
|
|
295
|
+
conditionKeys: value.conditionKeys.map((key) => resolveRef(mapping, key)),
|
|
296
|
+
...(value.preconditionKeys
|
|
297
|
+
? { preconditionKeys: value.preconditionKeys.map((key) => resolveRef(mapping, key)) }
|
|
298
|
+
: {}),
|
|
299
|
+
...(value.parentEntryKey
|
|
300
|
+
? { parentEntryKey: resolveRef(mapping, value.parentEntryKey) }
|
|
301
|
+
: {})
|
|
302
|
+
} as unknown as RawFactDataByKind[K];
|
|
303
|
+
}
|
|
304
|
+
case "ui-element":
|
|
305
|
+
case "ui-property":
|
|
306
|
+
case "callback":
|
|
307
|
+
case "condition": {
|
|
308
|
+
const value = data as RawFactDataByKind[
|
|
309
|
+
"ui-element" | "ui-property" | "callback" | "condition"
|
|
310
|
+
];
|
|
311
|
+
return { ...value, ownerKey: resolveRef(mapping, value.ownerKey) } as RawFactDataByKind[K];
|
|
312
|
+
}
|
|
313
|
+
case "container-binding": {
|
|
314
|
+
const value = data as RawFactDataByKind["container-binding"];
|
|
315
|
+
return {
|
|
316
|
+
...value,
|
|
317
|
+
hostKey: resolveRef(mapping, value.hostKey),
|
|
318
|
+
contentKeys: value.contentKeys.map((key) => resolveRef(mapping, key)) as unknown as
|
|
319
|
+
RawFactDataByKind["container-binding"]["contentKeys"],
|
|
320
|
+
...(value.initialContentKey
|
|
321
|
+
? { initialContentKey: resolveRef(mapping, value.initialContentKey) }
|
|
322
|
+
: {})
|
|
323
|
+
} as RawFactDataByKind[K];
|
|
324
|
+
}
|
|
325
|
+
case "interaction-binding": {
|
|
326
|
+
const value = data as RawFactDataByKind["interaction-binding"];
|
|
327
|
+
return {
|
|
328
|
+
...value,
|
|
329
|
+
elementKey: resolveRef(mapping, value.elementKey),
|
|
330
|
+
callbackKey: resolveRef(mapping, value.callbackKey)
|
|
331
|
+
} as RawFactDataByKind[K];
|
|
332
|
+
}
|
|
333
|
+
case "callback-flow": {
|
|
334
|
+
const value = data as RawFactDataByKind["callback-flow"];
|
|
335
|
+
return {
|
|
336
|
+
...value,
|
|
337
|
+
fromCallbackKey: resolveRef(mapping, value.fromCallbackKey),
|
|
338
|
+
toCallbackKey: resolveRef(mapping, value.toCallbackKey),
|
|
339
|
+
...(value.conditionKeys
|
|
340
|
+
? { conditionKeys: value.conditionKeys.map((key) => resolveRef(mapping, key)) }
|
|
341
|
+
: {})
|
|
342
|
+
} as RawFactDataByKind[K];
|
|
343
|
+
}
|
|
344
|
+
case "behavior-effect": {
|
|
345
|
+
const value = data as RawFactDataByKind["behavior-effect"];
|
|
346
|
+
return {
|
|
347
|
+
...value,
|
|
348
|
+
callbackKey: resolveRef(mapping, value.callbackKey),
|
|
349
|
+
...(value.targetKey ? { targetKey: resolveRef(mapping, value.targetKey) } : {}),
|
|
350
|
+
...(value.conditionKeys
|
|
351
|
+
? { conditionKeys: value.conditionKeys.map((key) => resolveRef(mapping, key)) }
|
|
352
|
+
: {})
|
|
353
|
+
} as RawFactDataByKind[K];
|
|
354
|
+
}
|
|
355
|
+
case "navigation-target": {
|
|
356
|
+
const value = data as RawFactDataByKind["navigation-target"];
|
|
357
|
+
return {
|
|
358
|
+
...value,
|
|
359
|
+
effectKey: resolveRef(mapping, value.effectKey),
|
|
360
|
+
...(value.targetKey ? { targetKey: resolveRef(mapping, value.targetKey) } : {})
|
|
361
|
+
} as RawFactDataByKind[K];
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function addPlannedFact<K extends RawFactKind>(
|
|
367
|
+
builder: SourceFactsBuilder,
|
|
368
|
+
patch: { readonly semanticKey: string; readonly fact: RawFactInput<K> },
|
|
369
|
+
mapping: Map<string, string>
|
|
370
|
+
): string {
|
|
371
|
+
const id = builder.addFact(patch.fact.kind, {
|
|
372
|
+
identity: patch.fact.identity,
|
|
373
|
+
confidence: patch.fact.confidence,
|
|
374
|
+
support: patch.fact.evidence.map((location) => ({
|
|
375
|
+
location,
|
|
376
|
+
role: "Tree-sitter/HomeGraph interaction evidence"
|
|
377
|
+
})) as [{
|
|
378
|
+
readonly location: RawFactInput<K>["evidence"][number];
|
|
379
|
+
readonly role: string;
|
|
380
|
+
}, ...{
|
|
381
|
+
readonly location: RawFactInput<K>["evidence"][number];
|
|
382
|
+
readonly role: string;
|
|
383
|
+
}[]],
|
|
384
|
+
data: resolveFactData(patch.fact.kind, patch.fact.data, mapping),
|
|
385
|
+
...(patch.fact.relatedKeys
|
|
386
|
+
? { relatedFactRefs: patch.fact.relatedKeys.map((key) => resolveRef(mapping, key)) }
|
|
387
|
+
: {})
|
|
388
|
+
});
|
|
389
|
+
mapping.set(patch.semanticKey, id);
|
|
390
|
+
return id;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function applyInteractionPlan(
|
|
394
|
+
builder: SourceFactsBuilder,
|
|
395
|
+
interactions: FinalizedInteractionAnalysis,
|
|
396
|
+
componentKeyByArea: ReadonlyMap<string, string>,
|
|
397
|
+
componentFactByArea: ReadonlyMap<string, string>
|
|
398
|
+
): readonly SourceInteractionEffect[] {
|
|
399
|
+
const mapping = new Map<string, string>();
|
|
400
|
+
for (const [area, key] of componentKeyByArea) {
|
|
401
|
+
mapping.set(key, resolveRef(componentFactByArea, area));
|
|
402
|
+
}
|
|
403
|
+
const plan = buildInteractionRawFactPlan({
|
|
404
|
+
analysis: interactions,
|
|
405
|
+
componentKeyByArea
|
|
406
|
+
});
|
|
407
|
+
for (const patch of plan) {
|
|
408
|
+
addPlannedFact(
|
|
409
|
+
builder,
|
|
410
|
+
patch as KeyedRawFactPatch & { readonly fact: RawFactInput },
|
|
411
|
+
mapping
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
return interactions.controls.flatMap((control) =>
|
|
415
|
+
control.actions.flatMap((action) => {
|
|
416
|
+
const callbackKey = `interaction-callback:${encoded(control.areaRef)}:${encoded(action.semanticKey)}`;
|
|
417
|
+
const callbackFactRef = resolveRef(mapping, callbackKey);
|
|
418
|
+
return action.effects.map((effect): SourceInteractionEffect => {
|
|
419
|
+
const effectKey = `interaction-effect:${encoded(control.areaRef)}:` +
|
|
420
|
+
`${encoded(action.semanticKey)}:${encoded(effect.semanticKey)}`;
|
|
421
|
+
return {
|
|
422
|
+
areaRef: control.areaRef,
|
|
423
|
+
actionSemanticKey: action.semanticKey,
|
|
424
|
+
effect,
|
|
425
|
+
callbackKey,
|
|
426
|
+
effectKey,
|
|
427
|
+
callbackFactRef,
|
|
428
|
+
effectFactRef: resolveRef(mapping, effectKey)
|
|
429
|
+
};
|
|
430
|
+
});
|
|
431
|
+
})
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const UTG_CONTROL_ID_ARGUMENTS = new Set([
|
|
436
|
+
"controlid",
|
|
437
|
+
"resourceid",
|
|
438
|
+
"triggerid",
|
|
439
|
+
"viewid",
|
|
440
|
+
"widgetid"
|
|
441
|
+
]);
|
|
442
|
+
|
|
443
|
+
function normalizedControlIdentifier(value: string): string | undefined {
|
|
444
|
+
const text = value.trim();
|
|
445
|
+
for (const pattern of [
|
|
446
|
+
/^@\+?id\/([A-Za-z_][A-Za-z0-9_]*)$/u,
|
|
447
|
+
/(?:^|\.)R?\.id\.([A-Za-z_][A-Za-z0-9_]*)$/u,
|
|
448
|
+
/(?:^|\.)binding\.([A-Za-z_][A-Za-z0-9_]*)$/u,
|
|
449
|
+
/^([A-Za-z_][A-Za-z0-9_]*)$/u
|
|
450
|
+
]) {
|
|
451
|
+
const match = pattern.exec(text);
|
|
452
|
+
if (match?.[1]) return match[1];
|
|
453
|
+
}
|
|
454
|
+
return undefined;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function controlIdentifiers(
|
|
458
|
+
control: FinalizedInteractionAnalysis["controls"][number]["control"]
|
|
459
|
+
): ReadonlySet<string> {
|
|
460
|
+
const result = new Set<string>();
|
|
461
|
+
for (const value of [control.resourceId, control.symbol]) {
|
|
462
|
+
if (!value) continue;
|
|
463
|
+
const identifier = normalizedControlIdentifier(value);
|
|
464
|
+
if (identifier) result.add(identifier);
|
|
465
|
+
}
|
|
466
|
+
const sourceId = /#id:([A-Za-z_][A-Za-z0-9_]*)/u.exec(
|
|
467
|
+
control.semanticKey
|
|
468
|
+
)?.[1];
|
|
469
|
+
if (sourceId) result.add(sourceId);
|
|
470
|
+
return result;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function normalizedArgumentName(value: string): string {
|
|
474
|
+
return value.toLocaleLowerCase("en-US").replaceAll("_", "").replaceAll("-", "");
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Returns structural Android control ids carried by a frozen UTG link.
|
|
479
|
+
* `label_key` is a control id only when the UTG producer explicitly says the
|
|
480
|
+
* label came from a view id. A code-name or text label remains presentation
|
|
481
|
+
* evidence and must not become an identity join.
|
|
482
|
+
*/
|
|
483
|
+
export function linkControlIdentifiers(link: ImportedUtgLink): ReadonlySet<string> {
|
|
484
|
+
const result = new Set<string>();
|
|
485
|
+
const labelSource = Object.entries(link.args).find(([key]) =>
|
|
486
|
+
normalizedArgumentName(key) === "labelsource"
|
|
487
|
+
)?.[1];
|
|
488
|
+
const labelKeyIsViewId = typeof labelSource === "string" &&
|
|
489
|
+
normalizedArgumentName(labelSource) === "viewid";
|
|
490
|
+
for (const [key, value] of Object.entries(link.args)) {
|
|
491
|
+
const normalizedKey = normalizedArgumentName(key);
|
|
492
|
+
const isStructuralId = UTG_CONTROL_ID_ARGUMENTS.has(normalizedKey) ||
|
|
493
|
+
(normalizedKey === "labelkey" && labelKeyIsViewId);
|
|
494
|
+
if (!isStructuralId || typeof value !== "string") {
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
const identifier = normalizedControlIdentifier(value);
|
|
498
|
+
if (identifier) result.add(identifier);
|
|
499
|
+
}
|
|
500
|
+
return result;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function sameEvidenceRange(
|
|
504
|
+
left: InteractionEffectDraft,
|
|
505
|
+
right: InteractionEffectDraft
|
|
506
|
+
): boolean {
|
|
507
|
+
const key = (location: InteractionEffectDraft["evidence"][number]): string =>
|
|
508
|
+
JSON.stringify([
|
|
509
|
+
location.path,
|
|
510
|
+
location.range.startLine,
|
|
511
|
+
location.range.endLine,
|
|
512
|
+
location.range.startColumn ?? 0,
|
|
513
|
+
location.range.endColumn ?? 0
|
|
514
|
+
]);
|
|
515
|
+
const leftKeys = unique(left.evidence.map(key));
|
|
516
|
+
const rightKeys = unique(right.evidence.map(key));
|
|
517
|
+
return leftKeys.length === rightKeys.length &&
|
|
518
|
+
leftKeys.every((value, index) => value === rightKeys[index]);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/** True when source analysis has not already resolved a concrete target. */
|
|
522
|
+
export function hasNoResolvedInteractionTarget(effect: InteractionEffectDraft): boolean {
|
|
523
|
+
return effect.target === undefined || effect.target.kind === "unresolved";
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function effectCanCorroborateUtgLink(
|
|
527
|
+
effect: InteractionEffectDraft,
|
|
528
|
+
expectedKind: "navigate-area" | "show-surface",
|
|
529
|
+
link: Pick<ImportedUtgLink, "targetAreaRef">
|
|
530
|
+
): boolean {
|
|
531
|
+
if (effect.kind !== expectedKind || effect.utgEdgeRef !== undefined) return false;
|
|
532
|
+
if (hasNoResolvedInteractionTarget(effect)) return true;
|
|
533
|
+
return effect.target?.kind === "area" && effect.target.areaRef === link.targetAreaRef;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Expands one source navigation into the frozen conditional links
|
|
537
|
+
* of the same structural Control while keeping every Effect identity unique. */
|
|
538
|
+
export function bindInteractionEffectToUtgLinks(
|
|
539
|
+
effect: InteractionEffectDraft,
|
|
540
|
+
links: readonly Pick<ImportedUtgLink, "id" | "targetAreaRef">[],
|
|
541
|
+
evidence: InteractionEffectDraft["evidence"] = effect.evidence
|
|
542
|
+
): readonly InteractionEffectDraft[] {
|
|
543
|
+
return links.map((link) => ({
|
|
544
|
+
...effect,
|
|
545
|
+
semanticKey: links.length === 1
|
|
546
|
+
? effect.semanticKey
|
|
547
|
+
: `${effect.semanticKey}#${link.id}`,
|
|
548
|
+
target: { kind: "area" as const, areaRef: link.targetAreaRef },
|
|
549
|
+
utgEdgeRef: link.id,
|
|
550
|
+
evidence
|
|
551
|
+
}));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
function nonEmptySourceLocations(
|
|
555
|
+
values: readonly InteractionEffectDraft["evidence"][number][]
|
|
556
|
+
): InteractionEffectDraft["evidence"] {
|
|
557
|
+
const byKey = new Map(values.map((location) => [JSON.stringify([
|
|
558
|
+
location.path,
|
|
559
|
+
location.range.startLine,
|
|
560
|
+
location.range.endLine,
|
|
561
|
+
location.range.startColumn ?? 0,
|
|
562
|
+
location.range.endColumn ?? 0,
|
|
563
|
+
location.anchor,
|
|
564
|
+
location.symbol ?? ""
|
|
565
|
+
]), location]));
|
|
566
|
+
const result = [...byKey.values()].sort((left, right) =>
|
|
567
|
+
JSON.stringify(left).localeCompare(JSON.stringify(right), "en")
|
|
568
|
+
);
|
|
569
|
+
if (result.length === 0) {
|
|
570
|
+
throw new Error("An exact UTG trigger binding has no source evidence");
|
|
571
|
+
}
|
|
572
|
+
return [result[0] as InteractionEffectDraft["evidence"][number], ...result.slice(1)];
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
interface UtgTriggerSourceLocation {
|
|
576
|
+
readonly path: string;
|
|
577
|
+
readonly line: number;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/** Extracts the source call site carried by triggers such as
|
|
581
|
+
* `onClick@app/src/main/Foo.java:42`. The source path may itself contain a
|
|
582
|
+
* colon, so the final numeric segment is treated as the line number. */
|
|
583
|
+
export function utgTriggerSourceLocation(
|
|
584
|
+
link: Pick<ImportedUtgLink, "trigger">
|
|
585
|
+
): UtgTriggerSourceLocation | undefined {
|
|
586
|
+
const separator = link.trigger.lastIndexOf("@");
|
|
587
|
+
if (separator < 0) return undefined;
|
|
588
|
+
const source = link.trigger.slice(separator + 1);
|
|
589
|
+
const match = /^(.+):(\d+)$/u.exec(source);
|
|
590
|
+
if (!match?.[1] || !match[2]) return undefined;
|
|
591
|
+
const line = Number.parseInt(match[2], 10);
|
|
592
|
+
return Number.isSafeInteger(line) && line > 0
|
|
593
|
+
? { path: match[1].replaceAll("\\", "/"), line }
|
|
594
|
+
: undefined;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function actionCoversTriggerSource(
|
|
598
|
+
action: FinalizedInteractionAnalysis["controls"][number]["actions"][number],
|
|
599
|
+
source: UtgTriggerSourceLocation
|
|
600
|
+
): boolean {
|
|
601
|
+
return action.evidence.some((location) =>
|
|
602
|
+
location.path.replaceAll("\\", "/") === source.path &&
|
|
603
|
+
location.range.startLine <= source.line &&
|
|
604
|
+
location.range.endLine >= source.line
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function compatibleActivationTrigger(
|
|
609
|
+
source: FinalizedInteractionAnalysis["controls"][number]["actions"][number]["trigger"],
|
|
610
|
+
topology: RawFactDataByKind["interaction-binding"]["trigger"]
|
|
611
|
+
): boolean {
|
|
612
|
+
if (source === topology) return true;
|
|
613
|
+
return (source === "select" && topology === "click") ||
|
|
614
|
+
(source === "click" && topology === "select");
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function sourceBindingKey(
|
|
618
|
+
control: FinalizedInteractionAnalysis["controls"][number],
|
|
619
|
+
action: FinalizedInteractionAnalysis["controls"][number]["actions"][number]
|
|
620
|
+
): string {
|
|
621
|
+
return `${control.control.semanticKey}\u0000${action.semanticKey}`;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Returns only unambiguous link-to-source Action matches. This is a second
|
|
626
|
+
* structural join for UTG producers that do not expose a view id: the frozen
|
|
627
|
+
* UTG call-site line must fall inside exactly one same-Area source Action that
|
|
628
|
+
* also contains an unresolved navigation Effect of the required kind.
|
|
629
|
+
*/
|
|
630
|
+
function exactSourceActionBindings(
|
|
631
|
+
interactions: FinalizedInteractionAnalysis,
|
|
632
|
+
topology: ImportedUtgTopology,
|
|
633
|
+
nodeById: ReadonlyMap<string, ImportedUtgNode>
|
|
634
|
+
): ReadonlyMap<string, string> {
|
|
635
|
+
const result = new Map<string, string>();
|
|
636
|
+
for (const link of topology.links) {
|
|
637
|
+
if (link.transitionClass !== "user") continue;
|
|
638
|
+
const source = utgTriggerSourceLocation(link);
|
|
639
|
+
if (!source) continue;
|
|
640
|
+
const expectedKind = isSurface(nodeById.get(link.targetAreaRef))
|
|
641
|
+
? "show-surface" as const
|
|
642
|
+
: "navigate-area" as const;
|
|
643
|
+
const candidates = interactions.controls.flatMap((control) =>
|
|
644
|
+
control.areaRef !== link.sourceAreaRef
|
|
645
|
+
? []
|
|
646
|
+
: control.actions.flatMap((action) =>
|
|
647
|
+
compatibleActivationTrigger(action.trigger, actionForLink(link)) &&
|
|
648
|
+
actionCoversTriggerSource(action, source) &&
|
|
649
|
+
action.effects.some((effect) =>
|
|
650
|
+
effectCanCorroborateUtgLink(effect, expectedKind, link)
|
|
651
|
+
)
|
|
652
|
+
? [sourceBindingKey(control, action)]
|
|
653
|
+
: []
|
|
654
|
+
)
|
|
655
|
+
);
|
|
656
|
+
if (candidates.length === 1) {
|
|
657
|
+
result.set(link.id, candidates[0] as string);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
return result;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function canonicalControlHint(
|
|
664
|
+
link: ImportedUtgLink,
|
|
665
|
+
topology: ImportedUtgTopology
|
|
666
|
+
): string | undefined {
|
|
667
|
+
for (const path of topology.canonicalPaths) {
|
|
668
|
+
const step = path.steps.find((candidate) => candidate.linkRefs.includes(link.id));
|
|
669
|
+
if (!step) continue;
|
|
670
|
+
const values = step.labelSource?.trim().toLocaleLowerCase("en-US") === "code-name"
|
|
671
|
+
? [step.nlHint, step.labelAlt]
|
|
672
|
+
: [step.nlHint, step.label, step.labelAlt];
|
|
673
|
+
for (const value of values) {
|
|
674
|
+
if (value?.trim()) return value.trim();
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
for (const key of ["nl_hint", "nlHint"] as const) {
|
|
678
|
+
const value = link.args[key];
|
|
679
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
680
|
+
}
|
|
681
|
+
return undefined;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
function isViewListenerBinding(bindingApi: string): boolean {
|
|
685
|
+
return /^setOn[A-Za-z0-9_]*Listener$/u.test(bindingApi);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Some upstream UTG producers expose an exact Android control id even when
|
|
690
|
+
* source analysis cannot resolve the destination class expression. A unique
|
|
691
|
+
* same-Area id match is a deterministic join: bind that source Action to the
|
|
692
|
+
* frozen link so assembly does not also synthesize a topology-only Control.
|
|
693
|
+
* Labels are deliberately excluded from this relation.
|
|
694
|
+
*/
|
|
695
|
+
export function bindExactUtgTriggerControls(
|
|
696
|
+
interactions: FinalizedInteractionAnalysis,
|
|
697
|
+
topology: ImportedUtgTopology
|
|
698
|
+
): FinalizedInteractionAnalysis {
|
|
699
|
+
const nodeById = new Map(topology.nodes.map((node) => [node.id, node]));
|
|
700
|
+
const sourceActionByLink = exactSourceActionBindings(
|
|
701
|
+
interactions,
|
|
702
|
+
topology,
|
|
703
|
+
nodeById
|
|
704
|
+
);
|
|
705
|
+
return {
|
|
706
|
+
...interactions,
|
|
707
|
+
controls: interactions.controls.map((controlPatch) => {
|
|
708
|
+
const identifiers = controlIdentifiers(controlPatch.control);
|
|
709
|
+
const actions = controlPatch.actions.map((action) => {
|
|
710
|
+
let effects: readonly InteractionEffectDraft[] = action.effects;
|
|
711
|
+
for (const expectedKind of ["navigate-area", "show-surface"] as const) {
|
|
712
|
+
const matchingLinks = topology.links.filter((link) => {
|
|
713
|
+
if (
|
|
714
|
+
link.transitionClass !== "user" ||
|
|
715
|
+
link.sourceAreaRef !== controlPatch.areaRef
|
|
716
|
+
) return false;
|
|
717
|
+
const exactSourceAction = sourceActionByLink.get(link.id) ===
|
|
718
|
+
sourceBindingKey(controlPatch, action);
|
|
719
|
+
const exactControlId = action.trigger === actionForLink(link) &&
|
|
720
|
+
[...linkControlIdentifiers(link)].some((identifier) =>
|
|
721
|
+
identifiers.has(identifier)
|
|
722
|
+
);
|
|
723
|
+
return (exactSourceAction || exactControlId) &&
|
|
724
|
+
!effects.some((effect) => effect.utgEdgeRef === link.id) &&
|
|
725
|
+
(isSurface(nodeById.get(link.targetAreaRef))
|
|
726
|
+
? "show-surface"
|
|
727
|
+
: "navigate-area") === expectedKind;
|
|
728
|
+
});
|
|
729
|
+
if (matchingLinks.length === 0) continue;
|
|
730
|
+
const resolvedLinkIds = new Set<string>();
|
|
731
|
+
const linksByResolvedEffect = new Map<
|
|
732
|
+
InteractionEffectDraft,
|
|
733
|
+
ImportedUtgLink[]
|
|
734
|
+
>();
|
|
735
|
+
for (const link of matchingLinks) {
|
|
736
|
+
const candidates = effects.filter((effect) =>
|
|
737
|
+
effect.kind === expectedKind && effect.utgEdgeRef === undefined &&
|
|
738
|
+
effect.target?.kind === "area" &&
|
|
739
|
+
effect.target.areaRef === link.targetAreaRef
|
|
740
|
+
);
|
|
741
|
+
if (candidates.length !== 1) continue;
|
|
742
|
+
const selected = candidates[0] as InteractionEffectDraft;
|
|
743
|
+
const links = linksByResolvedEffect.get(selected) ?? [];
|
|
744
|
+
links.push(link);
|
|
745
|
+
linksByResolvedEffect.set(selected, links);
|
|
746
|
+
resolvedLinkIds.add(link.id);
|
|
747
|
+
}
|
|
748
|
+
if (linksByResolvedEffect.size > 0) {
|
|
749
|
+
effects = effects.flatMap((effect) => {
|
|
750
|
+
const links = linksByResolvedEffect.get(effect);
|
|
751
|
+
return links
|
|
752
|
+
? bindInteractionEffectToUtgLinks(effect, links, effect.evidence)
|
|
753
|
+
: [effect];
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
const remainingLinks = matchingLinks.filter((link) =>
|
|
757
|
+
!resolvedLinkIds.has(link.id)
|
|
758
|
+
);
|
|
759
|
+
if (remainingLinks.length === 0) continue;
|
|
760
|
+
const unresolvedCandidates = effects.filter((effect) =>
|
|
761
|
+
effect.kind === expectedKind && hasNoResolvedInteractionTarget(effect) &&
|
|
762
|
+
effect.utgEdgeRef === undefined
|
|
763
|
+
);
|
|
764
|
+
if (unresolvedCandidates.length !== 1) continue;
|
|
765
|
+
const selected = unresolvedCandidates[0] as InteractionEffectDraft;
|
|
766
|
+
const redundant = new Set(effects.flatMap((effect) =>
|
|
767
|
+
effect !== selected && hasNoResolvedInteractionTarget(effect) &&
|
|
768
|
+
effect.utgEdgeRef === undefined &&
|
|
769
|
+
(effect.kind === "navigate-area" || effect.kind === "show-surface") &&
|
|
770
|
+
sameEvidenceRange(effect, selected)
|
|
771
|
+
? [effect.semanticKey]
|
|
772
|
+
: []
|
|
773
|
+
));
|
|
774
|
+
const redundantEvidence = effects
|
|
775
|
+
.filter((effect) => redundant.has(effect.semanticKey))
|
|
776
|
+
.flatMap((effect) => effect.evidence);
|
|
777
|
+
const selectedEvidence = nonEmptySourceLocations([
|
|
778
|
+
...selected.evidence,
|
|
779
|
+
...redundantEvidence
|
|
780
|
+
]);
|
|
781
|
+
effects = effects.flatMap((effect) => {
|
|
782
|
+
if (redundant.has(effect.semanticKey)) return [];
|
|
783
|
+
if (effect !== selected) return [effect];
|
|
784
|
+
return bindInteractionEffectToUtgLinks(
|
|
785
|
+
effect,
|
|
786
|
+
remainingLinks,
|
|
787
|
+
selectedEvidence
|
|
788
|
+
);
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
return {
|
|
792
|
+
...action,
|
|
793
|
+
effects: effects as typeof action.effects
|
|
794
|
+
};
|
|
795
|
+
});
|
|
796
|
+
const sourceBoundLinks = topology.links.filter((link) =>
|
|
797
|
+
controlPatch.actions.some((action) =>
|
|
798
|
+
sourceActionByLink.get(link.id) === sourceBindingKey(controlPatch, action)
|
|
799
|
+
)
|
|
800
|
+
);
|
|
801
|
+
const sourceHints = unique(sourceBoundLinks.flatMap((link) => {
|
|
802
|
+
const hint = canonicalControlHint(link, topology);
|
|
803
|
+
return hint ? [hint] : [];
|
|
804
|
+
}));
|
|
805
|
+
const sourceHint = sourceHints.length === 1 ? sourceHints[0] : undefined;
|
|
806
|
+
const removeCallbackLiteral = sourceHint !== undefined &&
|
|
807
|
+
controlPatch.control.resourceId === undefined &&
|
|
808
|
+
controlPatch.actions.every((action) => isViewListenerBinding(action.bindingApi));
|
|
809
|
+
const control = sourceHint
|
|
810
|
+
? {
|
|
811
|
+
...controlPatch.control,
|
|
812
|
+
...(removeCallbackLiteral ? { visibleText: undefined } : {}),
|
|
813
|
+
associatedLabel: sourceHint
|
|
814
|
+
}
|
|
815
|
+
: controlPatch.control;
|
|
816
|
+
return {
|
|
817
|
+
...controlPatch,
|
|
818
|
+
control,
|
|
819
|
+
actions: [actions[0] as typeof actions[number], ...actions.slice(1)]
|
|
820
|
+
};
|
|
821
|
+
})
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
function actionForLink(link: ImportedUtgLink): RawFactDataByKind["interaction-binding"]["trigger"] {
|
|
826
|
+
const values = [link.args.action, link.args.gesture, link.trigger.split("@", 1)[0]];
|
|
827
|
+
for (const raw of values) {
|
|
828
|
+
if (typeof raw !== "string") continue;
|
|
829
|
+
const value = raw.toLocaleLowerCase("en-US").replaceAll("_", "-");
|
|
830
|
+
if (value === "double-tap" || value === "double-click") return "click";
|
|
831
|
+
if (value === "tap" || value === "onclick" || value === "click") return "click";
|
|
832
|
+
if (value === "longpress" || value === "long-click") return "long-press";
|
|
833
|
+
if (
|
|
834
|
+
value === "long-press" || value === "select" || value === "toggle" ||
|
|
835
|
+
value === "text-input" || value === "text-submit" || value === "back" ||
|
|
836
|
+
value === "swipe" || value === "drag"
|
|
837
|
+
) return value;
|
|
838
|
+
}
|
|
839
|
+
return "click";
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
function controlName(link: ImportedUtgLink, topology: ImportedUtgTopology): string {
|
|
843
|
+
for (const path of topology.canonicalPaths) {
|
|
844
|
+
const step = path.steps.find((candidate) => candidate.linkRefs.includes(link.id));
|
|
845
|
+
// `code-name` is an upstream locator such as a widget or symbol name. It
|
|
846
|
+
// is useful evidence, but it is not proof of text visible to the user.
|
|
847
|
+
const pathLabels = step?.labelSource?.trim().toLocaleLowerCase("en-US") === "code-name"
|
|
848
|
+
? [step.labelAlt, step.nlHint]
|
|
849
|
+
: [step?.label, step?.labelAlt, step?.nlHint];
|
|
850
|
+
for (const value of pathLabels) {
|
|
851
|
+
if (value?.trim()) return value.trim();
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
const widgetCodeName = Object.entries(link.args).some(([key, value]) =>
|
|
855
|
+
key.toLocaleLowerCase("en-US").replaceAll("_", "").replaceAll("-", "") ===
|
|
856
|
+
"labelkey" &&
|
|
857
|
+
typeof value === "string" && /^\s*widget:/iu.test(value)
|
|
858
|
+
);
|
|
859
|
+
const argumentKeys = widgetCodeName
|
|
860
|
+
? ["label_alt", "labelAlt", "nl_hint", "nlHint", "text", "title"] as const
|
|
861
|
+
: [
|
|
862
|
+
"label",
|
|
863
|
+
"label_base",
|
|
864
|
+
"label_en",
|
|
865
|
+
"label_alt",
|
|
866
|
+
"labelAlt",
|
|
867
|
+
"nl_hint",
|
|
868
|
+
"nlHint",
|
|
869
|
+
"text",
|
|
870
|
+
"title"
|
|
871
|
+
] as const;
|
|
872
|
+
for (const key of argumentKeys) {
|
|
873
|
+
const value = link.args[key];
|
|
874
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
875
|
+
}
|
|
876
|
+
const trigger = link.trigger.split("@", 1)[0]?.trim();
|
|
877
|
+
if (trigger) return trigger;
|
|
878
|
+
return `${link.mechanism}: ${link.targetAreaRef}`;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
function isSurface(node: ImportedUtgNode | undefined): boolean {
|
|
882
|
+
return node !== undefined && /dialog|sheet|menu|popup|drawer|overlay/iu.test(node.kind);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
function addGuardFact(
|
|
886
|
+
builder: SourceFactsBuilder,
|
|
887
|
+
link: ImportedUtgLink,
|
|
888
|
+
callbackFactRef: string,
|
|
889
|
+
linkIndex: number
|
|
890
|
+
): string | undefined {
|
|
891
|
+
if (!link.guard) return undefined;
|
|
892
|
+
return builder.addFact("condition", {
|
|
893
|
+
identity: [
|
|
894
|
+
{ kind: "component", value: link.sourceAreaRef },
|
|
895
|
+
{ kind: "semantic-key", value: `utg-guard:${link.id}` }
|
|
896
|
+
],
|
|
897
|
+
confidence: link.confidence < 0.7 ? "medium" : "high",
|
|
898
|
+
support: [{
|
|
899
|
+
location: utgEvidence(linkIndex, `link:${link.id}:guard`),
|
|
900
|
+
role: "frozen UTG transition guard"
|
|
901
|
+
}],
|
|
902
|
+
data: {
|
|
903
|
+
ownerKey: callbackFactRef,
|
|
904
|
+
expressionAnchor: link.guard.text,
|
|
905
|
+
plainLanguage: link.guard.text,
|
|
906
|
+
valueKind: /config|variant/iu.test(link.guard.kind)
|
|
907
|
+
? "configuration"
|
|
908
|
+
: "runtime",
|
|
909
|
+
pathRequirement: "runtime-availability"
|
|
910
|
+
},
|
|
911
|
+
relatedFactRefs: [callbackFactRef]
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
function addTopologySeed(
|
|
916
|
+
builder: SourceFactsBuilder,
|
|
917
|
+
link: ImportedUtgLink,
|
|
918
|
+
linkIndex: number,
|
|
919
|
+
topology: ImportedUtgTopology,
|
|
920
|
+
facts: UtgFactIndex
|
|
921
|
+
): TopologySeed {
|
|
922
|
+
const ownerRef = resolveRef(facts.componentFactByArea, link.sourceAreaRef);
|
|
923
|
+
const targetRef = resolveRef(facts.componentFactByArea, link.targetAreaRef);
|
|
924
|
+
const location = utgEvidence(linkIndex, `link:${link.id}`);
|
|
925
|
+
const uiRef = builder.addFact("ui-element", {
|
|
926
|
+
identity: [
|
|
927
|
+
{ kind: "component", value: link.sourceAreaRef },
|
|
928
|
+
{ kind: "control", value: `utg:${link.id}` }
|
|
929
|
+
],
|
|
930
|
+
confidence: link.confidence < 0.7 ? "medium" : "high",
|
|
931
|
+
support: [{ location, role: "frozen UTG transition control" }],
|
|
932
|
+
data: {
|
|
933
|
+
ownerKey: ownerRef,
|
|
934
|
+
elementType: link.transitionClass === "user" ? "utg-control" : "utg-transition",
|
|
935
|
+
actionable: true,
|
|
936
|
+
associatedLabel: controlName(link, topology),
|
|
937
|
+
dynamicIdentity: link.id
|
|
938
|
+
},
|
|
939
|
+
relatedFactRefs: [ownerRef]
|
|
940
|
+
});
|
|
941
|
+
const callbackRef = builder.addFact("callback", {
|
|
942
|
+
identity: [
|
|
943
|
+
{ kind: "component", value: link.sourceAreaRef },
|
|
944
|
+
{ kind: "callback", value: `utg:${link.id}` }
|
|
945
|
+
],
|
|
946
|
+
confidence: link.confidence < 0.7 ? "medium" : "high",
|
|
947
|
+
support: [{ location, role: "frozen UTG transition callback" }],
|
|
948
|
+
data: {
|
|
949
|
+
ownerKey: ownerRef,
|
|
950
|
+
callableSymbol: `utg:${link.mechanism}:${link.id}`,
|
|
951
|
+
callbackKind: "function"
|
|
952
|
+
},
|
|
953
|
+
relatedFactRefs: [ownerRef]
|
|
954
|
+
});
|
|
955
|
+
const bindingRef = builder.addFact("interaction-binding", {
|
|
956
|
+
identity: [
|
|
957
|
+
{ kind: "control", value: `utg:${link.id}` },
|
|
958
|
+
{ kind: "callback", value: `utg:${link.id}` }
|
|
959
|
+
],
|
|
960
|
+
confidence: link.confidence < 0.7 ? "medium" : "high",
|
|
961
|
+
support: [{ location, role: "frozen UTG transition binding" }],
|
|
962
|
+
data: {
|
|
963
|
+
elementKey: uiRef,
|
|
964
|
+
callbackKey: callbackRef,
|
|
965
|
+
trigger: actionForLink(link),
|
|
966
|
+
bindingApi: `utg:${link.mechanism}`
|
|
967
|
+
},
|
|
968
|
+
relatedFactRefs: [uiRef, callbackRef]
|
|
969
|
+
});
|
|
970
|
+
const guardRef = addGuardFact(builder, link, callbackRef, linkIndex);
|
|
971
|
+
const targetNode = topology.nodes.find((node) => node.id === link.targetAreaRef);
|
|
972
|
+
const effectRef = builder.addFact("behavior-effect", {
|
|
973
|
+
identity: [
|
|
974
|
+
{ kind: "callback", value: `utg:${link.id}` },
|
|
975
|
+
{ kind: "semantic-key", value: `transition:${link.id}` }
|
|
976
|
+
],
|
|
977
|
+
confidence: link.confidence < 0.7 ? "medium" : "high",
|
|
978
|
+
support: [{ location, role: "frozen UTG transition effect" }],
|
|
979
|
+
data: {
|
|
980
|
+
callbackKey: callbackRef,
|
|
981
|
+
effectKind: isSurface(targetNode) ? "show-surface" : "navigate-area",
|
|
982
|
+
targetKey: targetRef,
|
|
983
|
+
transitionMode: link.transitionClass === "user" ? "user" : "startup-auto",
|
|
984
|
+
conditionKeys: guardRef ? [guardRef] : []
|
|
985
|
+
},
|
|
986
|
+
relatedFactRefs: [callbackRef, targetRef, ...(guardRef ? [guardRef] : [])]
|
|
987
|
+
});
|
|
988
|
+
builder.addFact("navigation-target", {
|
|
989
|
+
identity: [
|
|
990
|
+
{ kind: "semantic-key", value: `transition:${link.id}` },
|
|
991
|
+
{ kind: "component", value: link.targetAreaRef }
|
|
992
|
+
],
|
|
993
|
+
confidence: link.confidence < 0.7 ? "medium" : "high",
|
|
994
|
+
support: [{ location, role: "frozen UTG transition target" }],
|
|
995
|
+
data: {
|
|
996
|
+
effectKey: effectRef,
|
|
997
|
+
targetKind: "component",
|
|
998
|
+
targetKey: targetRef
|
|
999
|
+
},
|
|
1000
|
+
relatedFactRefs: [effectRef, targetRef]
|
|
1001
|
+
});
|
|
1002
|
+
void bindingRef;
|
|
1003
|
+
return { link, callbackFactRef: callbackRef, effectFactRef: effectRef };
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
function addCoveredLinkGuards(
|
|
1007
|
+
builder: SourceFactsBuilder,
|
|
1008
|
+
topology: ImportedUtgTopology,
|
|
1009
|
+
effectsByLink: ReadonlyMap<string, readonly SourceInteractionEffect[]>
|
|
1010
|
+
): void {
|
|
1011
|
+
topology.links.forEach((link, index) => {
|
|
1012
|
+
const covered = effectsByLink.get(link.id) ?? [];
|
|
1013
|
+
if (covered.length === 0 || !link.guard) return;
|
|
1014
|
+
const guardRef = addGuardFact(
|
|
1015
|
+
builder,
|
|
1016
|
+
link,
|
|
1017
|
+
covered[0].callbackFactRef,
|
|
1018
|
+
index
|
|
1019
|
+
);
|
|
1020
|
+
if (!guardRef) return;
|
|
1021
|
+
for (const item of covered) {
|
|
1022
|
+
const fact = builder.fact(item.effectFactRef);
|
|
1023
|
+
if (fact?.kind !== "behavior-effect") {
|
|
1024
|
+
throw new Error(`Missing source behavior effect ${item.effectFactRef}`);
|
|
1025
|
+
}
|
|
1026
|
+
builder.mergeFactData("behavior-effect", item.effectFactRef, {
|
|
1027
|
+
conditionKeys: unique([...(fact.data.conditionKeys ?? []), guardRef])
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
function navigationEvidence(link: ImportedUtgLink): NavigationEvidence {
|
|
1034
|
+
return {
|
|
1035
|
+
source: "utg",
|
|
1036
|
+
utgEdgeId: link.id,
|
|
1037
|
+
mechanism: link.mechanism,
|
|
1038
|
+
trigger: link.trigger,
|
|
1039
|
+
...(link.guard ? { guard: link.guard } : {}),
|
|
1040
|
+
confidence: link.confidence
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
function upstreamNonGestureAction(
|
|
1045
|
+
topology: ImportedUtgTopology,
|
|
1046
|
+
link: ImportedUtgLink
|
|
1047
|
+
): string | undefined {
|
|
1048
|
+
for (const path of topology.canonicalPaths) {
|
|
1049
|
+
const step = path.steps.find((candidate) =>
|
|
1050
|
+
candidate.linkRefs.includes(link.id) && candidate.nonGesture === true
|
|
1051
|
+
);
|
|
1052
|
+
if (step) return step.action;
|
|
1053
|
+
}
|
|
1054
|
+
return link.transitionClass === "user"
|
|
1055
|
+
? undefined
|
|
1056
|
+
: typeof link.args.action === "string"
|
|
1057
|
+
? link.args.action
|
|
1058
|
+
: undefined;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* The limitations that still leave the Model incomplete.
|
|
1063
|
+
*
|
|
1064
|
+
* `INTERACTION_CROSS_AREA_DUPLICATE_ANCHOR` records a decision the pipeline
|
|
1065
|
+
* already made: one Area keeps the end-to-end Feature for a project-global
|
|
1066
|
+
* anchor and every non-owner copy is excluded from the ReqModel. It is worth
|
|
1067
|
+
* reporting — it says where a control was described twice — but nothing is left
|
|
1068
|
+
* open for a caller to resolve, so it cannot be the reason a run whose every
|
|
1069
|
+
* Area was reviewed is refused by Render and the SPEC publication. An
|
|
1070
|
+
* UNRESOLVED duplicate (`INTERACTION_CROSS_AREA_DUPLICATE_UNRESOLVED`, no
|
|
1071
|
+
* dialog/transient owner to break the tie, both copies retained) IS open.
|
|
1072
|
+
*/
|
|
1073
|
+
export function openSemanticLimitations(
|
|
1074
|
+
limitations: readonly SemanticLimitation[]
|
|
1075
|
+
): readonly SemanticLimitation[] {
|
|
1076
|
+
return limitations.filter((item) =>
|
|
1077
|
+
item.code !== "INTERACTION_CROSS_AREA_DUPLICATE_ANCHOR"
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
function semanticLimitations(
|
|
1082
|
+
caseId: string,
|
|
1083
|
+
interactions: FinalizedInteractionAnalysis,
|
|
1084
|
+
pathGapAreaRefs: readonly string[]
|
|
1085
|
+
): SemanticLimitation[] { const result: SemanticLimitation[] = [];
|
|
1086
|
+
const add = (
|
|
1087
|
+
code: string,
|
|
1088
|
+
message: string,
|
|
1089
|
+
critical: boolean,
|
|
1090
|
+
candidateRefs: readonly string[]
|
|
1091
|
+
) => result.push({
|
|
1092
|
+
id: stableId(caseId, "limitation", code, candidateRefs.join("|") || code),
|
|
1093
|
+
code,
|
|
1094
|
+
message,
|
|
1095
|
+
critical,
|
|
1096
|
+
candidateRefs: unique(candidateRefs),
|
|
1097
|
+
supportRefs: []
|
|
1098
|
+
});
|
|
1099
|
+
if (interactions.failedShardIds.length > 0) {
|
|
1100
|
+
add(
|
|
1101
|
+
"INTERACTION_SHARD_FAILED",
|
|
1102
|
+
`${interactions.failedShardIds.length} interaction shard(s) failed; successful shards were retained.`,
|
|
1103
|
+
false,
|
|
1104
|
+
interactions.failedShardIds
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
if (interactions.unresolved.length > 0) {
|
|
1108
|
+
add(
|
|
1109
|
+
"INTERACTION_CANDIDATE_UNRESOLVED",
|
|
1110
|
+
`${interactions.unresolved.length} interaction candidate(s) remain unresolved.`,
|
|
1111
|
+
false,
|
|
1112
|
+
interactions.unresolved.map((item) => item.candidateKey)
|
|
1113
|
+
);
|
|
1114
|
+
}
|
|
1115
|
+
if (interactions.incompleteAreaRefs.length > 0) {
|
|
1116
|
+
add(
|
|
1117
|
+
"INTERACTION_AREA_INCOMPLETE",
|
|
1118
|
+
`${interactions.incompleteAreaRefs.length} frozen UTG Area(s) have incomplete interaction coverage.`,
|
|
1119
|
+
false,
|
|
1120
|
+
interactions.incompleteAreaRefs
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
1123
|
+
const unknownEffects = interactions.controls.flatMap((control) =>
|
|
1124
|
+
control.actions.flatMap((action) =>
|
|
1125
|
+
action.effects.flatMap((effect) => effect.kind === "unknown"
|
|
1126
|
+
? [{ effect, candidateRefs: action.candidateRefs }]
|
|
1127
|
+
: [])
|
|
1128
|
+
)
|
|
1129
|
+
);
|
|
1130
|
+
if (unknownEffects.length > 0) {
|
|
1131
|
+
add(
|
|
1132
|
+
"INTERACTION_EFFECT_UNRESOLVED",
|
|
1133
|
+
`${unknownEffects.length} retained interaction effect(s) have an unknown semantic result.`,
|
|
1134
|
+
false,
|
|
1135
|
+
unknownEffects.flatMap((item) => item.candidateRefs)
|
|
1136
|
+
);
|
|
1137
|
+
}
|
|
1138
|
+
if (interactions.utgNavConflicts > 0) {
|
|
1139
|
+
add(
|
|
1140
|
+
"UTG_NAV_CONFLICT",
|
|
1141
|
+
`${interactions.utgNavConflicts} source-backed navigation interaction(s) have no matching frozen UTG link; their existing-Area target is retained as a semantic Edge, while canonical breadcrumbs remain unchanged.`,
|
|
1142
|
+
false,
|
|
1143
|
+
interactions.diagnostics.flatMap((item) =>
|
|
1144
|
+
item.code === "UTG_NAV_CONFLICT" && item.candidateKey ? [item.candidateKey] : []
|
|
1145
|
+
)
|
|
1146
|
+
);
|
|
1147
|
+
}
|
|
1148
|
+
const duplicateAnchorDiagnostics = interactions.diagnostics.filter((item) =>
|
|
1149
|
+
item.code === "CROSS_AREA_DUPLICATE_ANCHOR" && item.suggestedOwnerAreaRef !== undefined
|
|
1150
|
+
);
|
|
1151
|
+
if (duplicateAnchorDiagnostics.length > 0) {
|
|
1152
|
+
const demotedCount = interactions.excludedDuplicateControls.length;
|
|
1153
|
+
add(
|
|
1154
|
+
"INTERACTION_CROSS_AREA_DUPLICATE_ANCHOR",
|
|
1155
|
+
`${crossAreaAffectedControlCount(duplicateAnchorDiagnostics)} Control(s) claimed the same project-global identity anchor as a Control in another Area; ${demotedCount} non-owner copy/copies were excluded from the ReqModel automatically (the dialog/transient owner Area retains the end-to-end Feature).`,
|
|
1156
|
+
false,
|
|
1157
|
+
involvedCandidateRefs(interactions, duplicateAnchorDiagnostics)
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
const unresolvedDuplicateDiagnostics = interactions.diagnostics.filter((item) =>
|
|
1161
|
+
item.code === "CROSS_AREA_DUPLICATE_ANCHOR" && item.suggestedOwnerAreaRef === undefined
|
|
1162
|
+
);
|
|
1163
|
+
if (unresolvedDuplicateDiagnostics.length > 0) {
|
|
1164
|
+
// Ambiguous members (no dialog/transient owner to break the tie): nothing
|
|
1165
|
+
// was demoted, both copies are retained. That is an OPEN gap — reporting it
|
|
1166
|
+
// as decided would let a two-Features-for-one-control run through as
|
|
1167
|
+
// `complete`.
|
|
1168
|
+
add(
|
|
1169
|
+
"INTERACTION_CROSS_AREA_DUPLICATE_UNRESOLVED",
|
|
1170
|
+
`${crossAreaAffectedControlCount(unresolvedDuplicateDiagnostics)} Control(s) claimed the same project-global identity anchor as a Control in another Area with no dialog/transient owner to break the tie; both copies are retained. Decide the owning Area (or exclude one deliberately) and re-run the affected Areas.`,
|
|
1171
|
+
false,
|
|
1172
|
+
involvedCandidateRefs(interactions, unresolvedDuplicateDiagnostics)
|
|
1173
|
+
);
|
|
1174
|
+
}
|
|
1175
|
+
const anchorCollisionDiagnostics = interactions.diagnostics.filter((item) =>
|
|
1176
|
+
item.code === "CROSS_AREA_ANCHOR_COLLISION"
|
|
1177
|
+
);
|
|
1178
|
+
if (anchorCollisionDiagnostics.length > 0) {
|
|
1179
|
+
add(
|
|
1180
|
+
"INTERACTION_CROSS_AREA_ANCHOR_COLLISION",
|
|
1181
|
+
`${crossAreaAffectedControlCount(anchorCollisionDiagnostics)} retained Control(s) share an instance-scoped identity anchor with a Control in another Area; confirm whether they are distinct instances of a shared layout before treating them as duplicates.`,
|
|
1182
|
+
false,
|
|
1183
|
+
involvedCandidateRefs(interactions, anchorCollisionDiagnostics)
|
|
1184
|
+
);
|
|
1185
|
+
}
|
|
1186
|
+
if (pathGapAreaRefs.length > 0) {
|
|
1187
|
+
add(
|
|
1188
|
+
"UTG_BREADCRUMB_UNAVAILABLE",
|
|
1189
|
+
`${pathGapAreaRefs.length} UTG Area(s) have no compilable upstream breadcrumb.`,
|
|
1190
|
+
false,
|
|
1191
|
+
pathGapAreaRefs
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
return result.sort(compareId);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
function crossAreaAffectedControlCount(
|
|
1198
|
+
diagnostics: readonly InteractionFinalizeDiagnostic[]
|
|
1199
|
+
): number {
|
|
1200
|
+
return new Set(
|
|
1201
|
+
diagnostics
|
|
1202
|
+
.map((item) => item.controlRef)
|
|
1203
|
+
.filter((controlRef): controlRef is string => Boolean(controlRef))
|
|
1204
|
+
).size;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
function involvedCandidateRefs(
|
|
1208
|
+
interactions: FinalizedInteractionAnalysis,
|
|
1209
|
+
diagnostics: readonly InteractionFinalizeDiagnostic[]
|
|
1210
|
+
): readonly string[] {
|
|
1211
|
+
const demotedByControlRef = new Map(
|
|
1212
|
+
interactions.excludedDuplicateControls.map((item) => [item.controlRef, item])
|
|
1213
|
+
);
|
|
1214
|
+
return diagnostics.flatMap((item) => {
|
|
1215
|
+
if (!item.controlRef) return [];
|
|
1216
|
+
const control = interactions.controls.find((candidate) =>
|
|
1217
|
+
candidate.areaRef === item.areaRef &&
|
|
1218
|
+
candidate.control.semanticKey === item.controlRef
|
|
1219
|
+
);
|
|
1220
|
+
if (control) return control.actions.flatMap((action) => action.candidateRefs);
|
|
1221
|
+
// The Control was demoted as a duplicate; fall back to its audit record.
|
|
1222
|
+
return demotedByControlRef.get(item.controlRef)?.candidateKeys ?? [];
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
function exactAreaMapping(
|
|
1227
|
+
base: AreaGraphView,
|
|
1228
|
+
topology: ImportedUtgTopology,
|
|
1229
|
+
facts: UtgFactIndex
|
|
1230
|
+
): ReadonlyMap<string, string> {
|
|
1231
|
+
const result = new Map<string, string>();
|
|
1232
|
+
for (const node of topology.nodes) {
|
|
1233
|
+
const componentRef = resolveRef(facts.componentFactByArea, node.id);
|
|
1234
|
+
const matches = base.areas.filter((area) => area.sourceFactRefs.includes(componentRef));
|
|
1235
|
+
if (matches.length !== 1) {
|
|
1236
|
+
throw new Error(
|
|
1237
|
+
`Frozen UTG node ${node.id} maps to ${matches.length} Areas instead of exactly one`
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
result.set(node.id, matches[0].id);
|
|
1241
|
+
}
|
|
1242
|
+
if (new Set(result.values()).size !== topology.nodes.length ||
|
|
1243
|
+
base.areas.length !== topology.nodes.length) {
|
|
1244
|
+
throw new Error(
|
|
1245
|
+
`UTG Area conservation failed: nodes=${topology.nodes.length}, areas=${base.areas.length}`
|
|
1246
|
+
);
|
|
1247
|
+
}
|
|
1248
|
+
return result;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
function effectForFact(graph: AreaGraphView, factRef: string): Effect {
|
|
1252
|
+
const matches = graph.effects.filter((effect) => effect.sourceFactRefs.includes(factRef));
|
|
1253
|
+
if (matches.length !== 1) {
|
|
1254
|
+
throw new Error(`Source effect ${factRef} maps to ${matches.length} graph Effects`);
|
|
1255
|
+
}
|
|
1256
|
+
return matches[0];
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
function synthesizedEdge(
|
|
1260
|
+
caseId: string,
|
|
1261
|
+
link: ImportedUtgLink,
|
|
1262
|
+
effect: Effect,
|
|
1263
|
+
graph: AreaGraphView,
|
|
1264
|
+
areaRefByUtg: ReadonlyMap<string, string>
|
|
1265
|
+
): Edge {
|
|
1266
|
+
const action = graph.actions.find((item) => item.id === effect.actionRef);
|
|
1267
|
+
const control = action
|
|
1268
|
+
? graph.controls.find((item) => item.id === action.controlRef)
|
|
1269
|
+
: undefined;
|
|
1270
|
+
if (!action || !control) {
|
|
1271
|
+
throw new Error(`Cannot materialize UTG link ${link.id}: missing action/control`);
|
|
1272
|
+
}
|
|
1273
|
+
const sourceAreaRef = resolveRef(areaRefByUtg, link.sourceAreaRef);
|
|
1274
|
+
const targetAreaRef = resolveRef(areaRefByUtg, link.targetAreaRef);
|
|
1275
|
+
if (control.areaRef !== sourceAreaRef) {
|
|
1276
|
+
throw new Error(`UTG link ${link.id} source does not match its semantic Control`);
|
|
1277
|
+
}
|
|
1278
|
+
return {
|
|
1279
|
+
id: stableId(caseId, "edge", "utg", `${link.id}:${action.id}`),
|
|
1280
|
+
sourceAreaRef,
|
|
1281
|
+
controlRef: control.id,
|
|
1282
|
+
actionRef: action.id,
|
|
1283
|
+
target: { kind: "area", ref: targetAreaRef },
|
|
1284
|
+
conditions: unique(effect.conditionAlternatives?.flatMap((item) => item.conditionRefs) ?? []),
|
|
1285
|
+
preconditions: action.preconditionRefs,
|
|
1286
|
+
sourceFactRefs: unique(effect.sourceFactRefs),
|
|
1287
|
+
navigationEvidence: [navigationEvidence(link)]
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
function entryPoints(
|
|
1292
|
+
caseId: string,
|
|
1293
|
+
topology: ImportedUtgTopology,
|
|
1294
|
+
areaRefByUtg: ReadonlyMap<string, string>,
|
|
1295
|
+
facts: UtgFactIndex,
|
|
1296
|
+
source: SourceFactsArtifact
|
|
1297
|
+
): readonly EntryPoint[] {
|
|
1298
|
+
return topology.entryRootAreaRefs.map((root): EntryPoint => {
|
|
1299
|
+
const componentRef = resolveRef(facts.componentFactByArea, root);
|
|
1300
|
+
const entryFact = source.facts.find((fact) =>
|
|
1301
|
+
fact.kind === "entry-point" && fact.data.componentKey === componentRef
|
|
1302
|
+
);
|
|
1303
|
+
if (!entryFact) throw new Error(`Missing entry SourceFact for ${root}`);
|
|
1304
|
+
return {
|
|
1305
|
+
id: stableId(caseId, "entry", "utg", root),
|
|
1306
|
+
kind: "launcher",
|
|
1307
|
+
category: root === topology.rootAreaRef ? "normal" : "alternate",
|
|
1308
|
+
rootAreaRefs: [resolveRef(areaRefByUtg, root)],
|
|
1309
|
+
conditions: [],
|
|
1310
|
+
preconditions: [],
|
|
1311
|
+
startupRole: "default",
|
|
1312
|
+
sourceFactRefs: [entryFact.id]
|
|
1313
|
+
};
|
|
1314
|
+
}).sort(compareId);
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
interface CompiledPaths {
|
|
1318
|
+
readonly paths: readonly AreaPath[];
|
|
1319
|
+
readonly canonicalPathByArea: ReadonlyMap<string, string>;
|
|
1320
|
+
readonly unresolved: readonly UnresolvedItem[];
|
|
1321
|
+
readonly gapAreaRefs: readonly string[];
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
function compilePaths(
|
|
1325
|
+
caseId: string,
|
|
1326
|
+
topology: ImportedUtgTopology,
|
|
1327
|
+
areaRefByUtg: ReadonlyMap<string, string>,
|
|
1328
|
+
entryByUtg: ReadonlyMap<string, string>,
|
|
1329
|
+
edgeByUtgLink: ReadonlyMap<string, Edge>
|
|
1330
|
+
): CompiledPaths {
|
|
1331
|
+
const paths: AreaPath[] = [];
|
|
1332
|
+
const canonicalPathByArea = new Map<string, string>();
|
|
1333
|
+
const unresolved: UnresolvedItem[] = [];
|
|
1334
|
+
const gapAreaRefs = new Set<string>();
|
|
1335
|
+
const importedByTarget = new Map(
|
|
1336
|
+
topology.canonicalPaths.map((path) => [path.targetAreaRef, path])
|
|
1337
|
+
);
|
|
1338
|
+
const unreachable = new Set(topology.unreachableAreaRefs);
|
|
1339
|
+
|
|
1340
|
+
const markGap = (node: ImportedUtgNode, reason: string): void => {
|
|
1341
|
+
const areaRef = resolveRef(areaRefByUtg, node.id);
|
|
1342
|
+
const id = stableId(caseId, "unresolved", "utg-path", node.id);
|
|
1343
|
+
unresolved.push({
|
|
1344
|
+
id,
|
|
1345
|
+
ownerRef: areaRef,
|
|
1346
|
+
fieldPath: "canonicalPathRef",
|
|
1347
|
+
reasonCode: node.status === "dynamic-only"
|
|
1348
|
+
? "UTG_DYNAMIC_BREADCRUMB_UNAVAILABLE"
|
|
1349
|
+
: "UTG_BREADCRUMB_UNAVAILABLE",
|
|
1350
|
+
message: reason,
|
|
1351
|
+
evidenceRefs: [],
|
|
1352
|
+
candidates: [],
|
|
1353
|
+
impact: ["area-path"]
|
|
1354
|
+
});
|
|
1355
|
+
gapAreaRefs.add(node.id);
|
|
1356
|
+
};
|
|
1357
|
+
|
|
1358
|
+
for (const node of topology.nodes) {
|
|
1359
|
+
const targetAreaRef = resolveRef(areaRefByUtg, node.id);
|
|
1360
|
+
if (unreachable.has(node.id)) {
|
|
1361
|
+
const id = stableId(caseId, "path", "utg-unreachable", node.id);
|
|
1362
|
+
paths.push({
|
|
1363
|
+
id,
|
|
1364
|
+
kind: "unreachable",
|
|
1365
|
+
reachability: "unreachable",
|
|
1366
|
+
targetAreaRef,
|
|
1367
|
+
preconditions: [],
|
|
1368
|
+
steps: [],
|
|
1369
|
+
selectionReasons: ["classified unreachable by upstream UTG click_paths.json"],
|
|
1370
|
+
unresolvedRefs: []
|
|
1371
|
+
});
|
|
1372
|
+
canonicalPathByArea.set(targetAreaRef, id);
|
|
1373
|
+
continue;
|
|
1374
|
+
}
|
|
1375
|
+
const imported = importedByTarget.get(node.id);
|
|
1376
|
+
if (!imported) {
|
|
1377
|
+
markGap(
|
|
1378
|
+
node,
|
|
1379
|
+
node.status === "dynamic-only"
|
|
1380
|
+
? "The reconciled dynamic-only UTG Area has no static breadcrumb."
|
|
1381
|
+
: "The upstream UTG did not provide a canonical breadcrumb for this Area."
|
|
1382
|
+
);
|
|
1383
|
+
continue;
|
|
1384
|
+
}
|
|
1385
|
+
const launch = imported.steps[0];
|
|
1386
|
+
const root = imported.entryRootAreaRef ?? launch?.targetAreaRef ?? topology.rootAreaRef;
|
|
1387
|
+
const rootEntryRef = entryByUtg.get(root);
|
|
1388
|
+
if (!rootEntryRef) {
|
|
1389
|
+
markGap(node, `The upstream path uses unknown entry root ${root}.`);
|
|
1390
|
+
continue;
|
|
1391
|
+
}
|
|
1392
|
+
const selected: Edge[] = [];
|
|
1393
|
+
let failedReason: string | undefined;
|
|
1394
|
+
for (const [index, step] of imported.steps.entries()) {
|
|
1395
|
+
if (index === 0 && step.action === "launch") continue;
|
|
1396
|
+
const compatible = step.linkRefs.flatMap((ref) => {
|
|
1397
|
+
const edge = edgeByUtgLink.get(ref);
|
|
1398
|
+
return edge ? [{ ref, edge }] : [];
|
|
1399
|
+
}).sort((left, right) => left.ref.localeCompare(right.ref, "en"));
|
|
1400
|
+
const chosen = compatible[0];
|
|
1401
|
+
if (!chosen) {
|
|
1402
|
+
failedReason =
|
|
1403
|
+
`The upstream breadcrumb step ${index} (${step.sourceAreaRef ?? "?"} -> ${step.targetAreaRef}) has no frozen UTG Edge.`;
|
|
1404
|
+
break;
|
|
1405
|
+
}
|
|
1406
|
+
selected.push(chosen.edge);
|
|
1407
|
+
}
|
|
1408
|
+
if (failedReason) {
|
|
1409
|
+
markGap(node, failedReason);
|
|
1410
|
+
continue;
|
|
1411
|
+
}
|
|
1412
|
+
const preconditions = unique(selected.flatMap((edge) => [
|
|
1413
|
+
...edge.conditions,
|
|
1414
|
+
...edge.preconditions
|
|
1415
|
+
]));
|
|
1416
|
+
const id = stableId(
|
|
1417
|
+
caseId,
|
|
1418
|
+
"path",
|
|
1419
|
+
"utg-canonical",
|
|
1420
|
+
`${node.id}:${selected.map((edge) => edge.id).join("|")}`
|
|
1421
|
+
);
|
|
1422
|
+
const containsNonGesture = imported.steps.some((step) => step.nonGesture === true);
|
|
1423
|
+
paths.push({
|
|
1424
|
+
id,
|
|
1425
|
+
kind: "canonical",
|
|
1426
|
+
reachability: preconditions.length > 0 ? "conditional" : "unconditional",
|
|
1427
|
+
targetAreaRef,
|
|
1428
|
+
rootEntryRef,
|
|
1429
|
+
preconditions,
|
|
1430
|
+
steps: selected.map((edge) => {
|
|
1431
|
+
if ("status" in edge.target || edge.target.kind !== "area") {
|
|
1432
|
+
throw new Error(`Canonical UTG Edge ${edge.id} is not an internal Area transition`);
|
|
1433
|
+
}
|
|
1434
|
+
return {
|
|
1435
|
+
edgeRef: edge.id,
|
|
1436
|
+
sourceAreaRef: edge.sourceAreaRef,
|
|
1437
|
+
controlRef: edge.controlRef,
|
|
1438
|
+
actionRef: edge.actionRef,
|
|
1439
|
+
targetAreaRef: edge.target.ref
|
|
1440
|
+
};
|
|
1441
|
+
}),
|
|
1442
|
+
selectionReasons: unique([
|
|
1443
|
+
"copied from upstream UTG click_paths.json",
|
|
1444
|
+
imported.pathText,
|
|
1445
|
+
...(containsNonGesture ? ["contains an upstream non-gesture transition"] : [])
|
|
1446
|
+
]),
|
|
1447
|
+
unresolvedRefs: []
|
|
1448
|
+
});
|
|
1449
|
+
canonicalPathByArea.set(targetAreaRef, id);
|
|
1450
|
+
}
|
|
1451
|
+
return {
|
|
1452
|
+
paths: paths.sort(compareId),
|
|
1453
|
+
canonicalPathByArea,
|
|
1454
|
+
unresolved: unresolved.sort(compareId),
|
|
1455
|
+
gapAreaRefs: [...gapAreaRefs].sort()
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
function filterTopologyOnlyFeatures(
|
|
1460
|
+
req: ReqModelArtifact,
|
|
1461
|
+
graph: AreaGraphView
|
|
1462
|
+
): ReqModelArtifact {
|
|
1463
|
+
const effectById = new Map(graph.effects.map((effect) => [effect.id, effect]));
|
|
1464
|
+
const hiddenActions = new Set(graph.actions
|
|
1465
|
+
.filter((action) => !isReqProjectedAction(action, effectById))
|
|
1466
|
+
.map((action) => action.id));
|
|
1467
|
+
const filterFeature = (feature: ReqFeature): ReqFeature | undefined => {
|
|
1468
|
+
const interactions = feature.interactions?.filter((item) =>
|
|
1469
|
+
!hiddenActions.has(item.actionRef)
|
|
1470
|
+
);
|
|
1471
|
+
if (!interactions || interactions.length === 0) return undefined;
|
|
1472
|
+
const first = interactions[0];
|
|
1473
|
+
return {
|
|
1474
|
+
...feature,
|
|
1475
|
+
interactions,
|
|
1476
|
+
trigger: first.trigger,
|
|
1477
|
+
conditions: first.conditions,
|
|
1478
|
+
effects: first.effects,
|
|
1479
|
+
...(first.target ? { target: first.target } : { target: undefined })
|
|
1480
|
+
};
|
|
1481
|
+
};
|
|
1482
|
+
return {
|
|
1483
|
+
...req,
|
|
1484
|
+
areas: req.areas.map((area) => ({
|
|
1485
|
+
...area,
|
|
1486
|
+
features: area.features.flatMap((feature) => {
|
|
1487
|
+
const filtered = filterFeature(feature);
|
|
1488
|
+
return filtered ? [filtered] : [];
|
|
1489
|
+
})
|
|
1490
|
+
}))
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
function category(
|
|
1495
|
+
id: GapAuditCategory["id"],
|
|
1496
|
+
label: string,
|
|
1497
|
+
candidates: readonly GapAuditCandidate[],
|
|
1498
|
+
expectedFactKinds: GapAuditCategory["expectedFactKinds"]
|
|
1499
|
+
): GapAuditCategory {
|
|
1500
|
+
const recognized = candidates.filter((item) => item.status === "recognized").length;
|
|
1501
|
+
const unresolved = candidates.filter((item) => item.status === "unresolved").length;
|
|
1502
|
+
const excludedWithReason = candidates.filter(
|
|
1503
|
+
(item) => item.status === "excluded-with-reason"
|
|
1504
|
+
).length;
|
|
1505
|
+
const limited = candidates.filter((item) => item.status === "limited").length;
|
|
1506
|
+
return {
|
|
1507
|
+
id,
|
|
1508
|
+
label,
|
|
1509
|
+
assessment: unresolved > 0 ? "partially-assessed" : "assessed",
|
|
1510
|
+
observed: candidates.length,
|
|
1511
|
+
normalized: recognized,
|
|
1512
|
+
possibleGap: unresolved,
|
|
1513
|
+
unassessed: 0,
|
|
1514
|
+
recognized,
|
|
1515
|
+
unresolved,
|
|
1516
|
+
excludedWithReason,
|
|
1517
|
+
limited,
|
|
1518
|
+
expectedFactKinds,
|
|
1519
|
+
candidates
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
function buildGapAudit(
|
|
1524
|
+
input: AssembleModelInput,
|
|
1525
|
+
source: SourceFactsArtifact,
|
|
1526
|
+
graph: AreaGraphView,
|
|
1527
|
+
effects: readonly SourceInteractionEffect[],
|
|
1528
|
+
limitations: readonly SemanticLimitation[],
|
|
1529
|
+
pathGapAreaRefs: readonly string[]
|
|
1530
|
+
): GapAuditArtifact {
|
|
1531
|
+
const { topology } = input.utg;
|
|
1532
|
+
const areaByAnchor = new Map(graph.areas.flatMap((area) =>
|
|
1533
|
+
(area.navigationAnchors ?? []).map((anchor) => [anchor, area] as const)
|
|
1534
|
+
));
|
|
1535
|
+
const edgeByLink = new Map<string, Edge[]>();
|
|
1536
|
+
for (const edge of graph.edges) {
|
|
1537
|
+
for (const evidence of edge.navigationEvidence ?? []) {
|
|
1538
|
+
const values = edgeByLink.get(evidence.utgEdgeId) ?? [];
|
|
1539
|
+
values.push(edge);
|
|
1540
|
+
edgeByLink.set(evidence.utgEdgeId, values);
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
const componentByArea = new Map(topology.nodes.map((node) => {
|
|
1544
|
+
const area = areaByAnchor.get(node.id);
|
|
1545
|
+
const component = area?.sourceFactRefs.find((ref) =>
|
|
1546
|
+
source.facts.some((fact) => fact.id === ref && fact.kind === "component")
|
|
1547
|
+
);
|
|
1548
|
+
return [node.id, component] as const;
|
|
1549
|
+
}));
|
|
1550
|
+
const areaCandidates: GapAuditCandidate[] = topology.nodes.map((node) => ({
|
|
1551
|
+
id: `utg-area:${node.id}`,
|
|
1552
|
+
category: "utg-areas",
|
|
1553
|
+
source: "utg",
|
|
1554
|
+
semanticKey: node.id,
|
|
1555
|
+
rawRecordRef: node.id,
|
|
1556
|
+
expectedFactKinds: ["component"],
|
|
1557
|
+
normalizedFactRefs: unique([
|
|
1558
|
+
...(componentByArea.get(node.id) ? [componentByArea.get(node.id) as string] : []),
|
|
1559
|
+
...(areaByAnchor.get(node.id) ? [areaByAnchor.get(node.id)!.id] : [])
|
|
1560
|
+
]),
|
|
1561
|
+
status: "recognized",
|
|
1562
|
+
critical: true,
|
|
1563
|
+
outcome: "normalized"
|
|
1564
|
+
}));
|
|
1565
|
+
const linkCandidates: GapAuditCandidate[] = topology.links.map((link) => ({
|
|
1566
|
+
id: `utg-link:${link.id}`,
|
|
1567
|
+
category: "utg-links",
|
|
1568
|
+
source: "utg",
|
|
1569
|
+
semanticKey: link.id,
|
|
1570
|
+
rawRecordRef: link.id,
|
|
1571
|
+
expectedFactKinds: ["behavior-effect", "navigation-target"],
|
|
1572
|
+
normalizedFactRefs: unique((edgeByLink.get(link.id) ?? []).flatMap((edge) => [
|
|
1573
|
+
edge.id,
|
|
1574
|
+
...edge.sourceFactRefs
|
|
1575
|
+
])),
|
|
1576
|
+
status: "recognized",
|
|
1577
|
+
critical: true,
|
|
1578
|
+
outcome: "normalized"
|
|
1579
|
+
}));
|
|
1580
|
+
|
|
1581
|
+
const retainedCandidateRefs = unique(input.interactions.controls.flatMap((control) =>
|
|
1582
|
+
control.actions.flatMap((action) => action.candidateRefs)
|
|
1583
|
+
));
|
|
1584
|
+
const unresolvedByKey = new Map(
|
|
1585
|
+
input.interactions.unresolved.map((item) => [item.candidateKey, item])
|
|
1586
|
+
);
|
|
1587
|
+
const discoveryRefs = retainedCandidateRefs.filter((ref) =>
|
|
1588
|
+
ref.startsWith("agent-discovery:")
|
|
1589
|
+
);
|
|
1590
|
+
const originalRetained = retainedCandidateRefs.filter((ref) =>
|
|
1591
|
+
!ref.startsWith("agent-discovery:")
|
|
1592
|
+
);
|
|
1593
|
+
const interactionCandidates: GapAuditCandidate[] = [
|
|
1594
|
+
...originalRetained.map((ref): GapAuditCandidate => ({
|
|
1595
|
+
id: `interaction:${ref}`,
|
|
1596
|
+
category: "interaction-candidates",
|
|
1597
|
+
source: "tree-sitter",
|
|
1598
|
+
semanticKey: ref,
|
|
1599
|
+
expectedFactKinds: ["ui-element", "callback", "interaction-binding", "behavior-effect"],
|
|
1600
|
+
normalizedFactRefs: unique(effects.flatMap((item) =>
|
|
1601
|
+
item.effectFactRef.includes(ref) ? [item.effectFactRef] : []
|
|
1602
|
+
)),
|
|
1603
|
+
status: "recognized",
|
|
1604
|
+
critical: true,
|
|
1605
|
+
outcome: "normalized"
|
|
1606
|
+
})),
|
|
1607
|
+
...input.interactions.unresolved
|
|
1608
|
+
.filter((item) => !originalRetained.includes(item.candidateKey))
|
|
1609
|
+
.map((item): GapAuditCandidate => ({
|
|
1610
|
+
id: `interaction:${item.candidateKey}`,
|
|
1611
|
+
category: "interaction-candidates",
|
|
1612
|
+
source: "agent",
|
|
1613
|
+
semanticKey: item.candidateKey,
|
|
1614
|
+
expectedFactKinds: ["ui-element", "callback", "interaction-binding", "behavior-effect"],
|
|
1615
|
+
normalizedFactRefs: [],
|
|
1616
|
+
status: "unresolved",
|
|
1617
|
+
critical: true,
|
|
1618
|
+
reason: item.message,
|
|
1619
|
+
outcome: "possible-gap"
|
|
1620
|
+
}))
|
|
1621
|
+
];
|
|
1622
|
+
for (const candidateKey of input.interactions.scopeExcludedCandidateKeys ?? []) {
|
|
1623
|
+
interactionCandidates.push({
|
|
1624
|
+
id: `interaction:${candidateKey}`,
|
|
1625
|
+
category: "interaction-candidates",
|
|
1626
|
+
source: "agent",
|
|
1627
|
+
semanticKey: candidateKey,
|
|
1628
|
+
expectedFactKinds: ["ui-element", "interaction-binding", "behavior-effect"],
|
|
1629
|
+
normalizedFactRefs: [],
|
|
1630
|
+
status: "excluded-with-reason",
|
|
1631
|
+
critical: false,
|
|
1632
|
+
reason: "scope-excluded: not generated in this run; not a claim that the source behavior is absent.",
|
|
1633
|
+
outcome: "normalized"
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
const originalCount = interactionCandidates.length;
|
|
1637
|
+
const missingOriginal = Math.max(
|
|
1638
|
+
0,
|
|
1639
|
+
input.interactions.conservation.candidateTotal - originalCount
|
|
1640
|
+
);
|
|
1641
|
+
const demotedDuplicateCount =
|
|
1642
|
+
input.interactions.conservation.demotedDuplicate ?? 0;
|
|
1643
|
+
for (let index = 0; index < missingOriginal; index += 1) {
|
|
1644
|
+
const demoted = index < demotedDuplicateCount;
|
|
1645
|
+
const excluded = !demoted && index < demotedDuplicateCount + input.interactions.conservation.excluded;
|
|
1646
|
+
interactionCandidates.push({
|
|
1647
|
+
id: `interaction:conservation-slot:${index + 1}`,
|
|
1648
|
+
category: "interaction-candidates",
|
|
1649
|
+
source: "agent",
|
|
1650
|
+
semanticKey: `conservation-slot:${index + 1}`,
|
|
1651
|
+
expectedFactKinds: ["ui-element", "callback", "interaction-binding", "behavior-effect"],
|
|
1652
|
+
normalizedFactRefs: [],
|
|
1653
|
+
status: demoted || excluded ? "excluded-with-reason" : "limited",
|
|
1654
|
+
critical: !(demoted || excluded),
|
|
1655
|
+
reason: demoted
|
|
1656
|
+
? "Demoted as a cross-Area duplicate anchor; the suggested-owner Area retains the end-to-end Feature."
|
|
1657
|
+
: excluded
|
|
1658
|
+
? "Agent deliberately excluded the candidate; the finalizer retains only the conservation count."
|
|
1659
|
+
: "The finalizer retains this disposition in aggregate conservation counts.",
|
|
1660
|
+
outcome: "normalized"
|
|
1661
|
+
});
|
|
1662
|
+
}
|
|
1663
|
+
for (const ref of discoveryRefs) {
|
|
1664
|
+
interactionCandidates.push({
|
|
1665
|
+
id: `interaction:${ref}`,
|
|
1666
|
+
category: "interaction-candidates",
|
|
1667
|
+
source: "agent",
|
|
1668
|
+
semanticKey: ref,
|
|
1669
|
+
expectedFactKinds: ["ui-element", "callback", "interaction-binding", "behavior-effect"],
|
|
1670
|
+
normalizedFactRefs: [],
|
|
1671
|
+
status: "recognized",
|
|
1672
|
+
critical: true,
|
|
1673
|
+
outcome: "normalized"
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
void unresolvedByKey;
|
|
1677
|
+
const incomplete = new Set(input.interactions.incompleteAreaRefs);
|
|
1678
|
+
const pathGaps = new Set(pathGapAreaRefs);
|
|
1679
|
+
const coverageCandidates: GapAuditCandidate[] = topology.nodes.map((node) => {
|
|
1680
|
+
const scopeExcluded = input.interactions.scopeExcludedAreaRefs?.includes(node.id) ?? false;
|
|
1681
|
+
const interactionIncomplete = incomplete.has(node.id);
|
|
1682
|
+
const pathLimited = pathGaps.has(node.id);
|
|
1683
|
+
return {
|
|
1684
|
+
id: `interaction-area:${node.id}`,
|
|
1685
|
+
category: "interaction-area-coverage",
|
|
1686
|
+
source: "agent",
|
|
1687
|
+
semanticKey: node.id,
|
|
1688
|
+
expectedFactKinds: ["ui-element", "interaction-binding", "behavior-effect"],
|
|
1689
|
+
normalizedFactRefs: areaByAnchor.get(node.id)?.controlRefs ?? [],
|
|
1690
|
+
status: scopeExcluded ? "excluded-with-reason" : interactionIncomplete ? "unresolved" : pathLimited ? "limited" : "recognized",
|
|
1691
|
+
critical: interactionIncomplete,
|
|
1692
|
+
...(scopeExcluded
|
|
1693
|
+
? { reason: "scope-excluded: this frozen UTG Area was not selected for deep analysis." }
|
|
1694
|
+
: interactionIncomplete
|
|
1695
|
+
? { reason: "Agent interaction coverage is incomplete for this frozen UTG Area." }
|
|
1696
|
+
: pathLimited
|
|
1697
|
+
? { reason: "Interaction coverage completed, but the upstream UTG breadcrumb is unavailable." }
|
|
1698
|
+
: {}),
|
|
1699
|
+
outcome: interactionIncomplete ? "possible-gap" : "normalized"
|
|
1700
|
+
} satisfies GapAuditCandidate;
|
|
1701
|
+
});
|
|
1702
|
+
const categories = [
|
|
1703
|
+
category("utg-areas", "Frozen UTG Areas", areaCandidates, ["component"]),
|
|
1704
|
+
category("utg-links", "Frozen UTG links", linkCandidates, ["behavior-effect", "navigation-target"]),
|
|
1705
|
+
category(
|
|
1706
|
+
"interaction-candidates",
|
|
1707
|
+
"Tree-sitter/HomeGraph/Agent interaction candidates",
|
|
1708
|
+
interactionCandidates,
|
|
1709
|
+
["ui-element", "callback", "interaction-binding", "behavior-effect"]
|
|
1710
|
+
),
|
|
1711
|
+
category(
|
|
1712
|
+
"interaction-area-coverage",
|
|
1713
|
+
"Per-Area interaction coverage",
|
|
1714
|
+
coverageCandidates,
|
|
1715
|
+
["ui-element", "interaction-binding", "behavior-effect"]
|
|
1716
|
+
)
|
|
1717
|
+
];
|
|
1718
|
+
const summary = categories.reduce((sum, item) => ({
|
|
1719
|
+
observed: sum.observed + item.observed,
|
|
1720
|
+
normalized: sum.normalized + item.normalized,
|
|
1721
|
+
possibleGap: sum.possibleGap + item.possibleGap,
|
|
1722
|
+
unassessed: sum.unassessed + item.unassessed,
|
|
1723
|
+
recognized: sum.recognized + item.recognized,
|
|
1724
|
+
unresolved: sum.unresolved + item.unresolved,
|
|
1725
|
+
excludedWithReason: sum.excludedWithReason + item.excludedWithReason,
|
|
1726
|
+
limited: sum.limited + item.limited
|
|
1727
|
+
}), {
|
|
1728
|
+
observed: 0,
|
|
1729
|
+
normalized: 0,
|
|
1730
|
+
possibleGap: 0,
|
|
1731
|
+
unassessed: 0,
|
|
1732
|
+
recognized: 0,
|
|
1733
|
+
unresolved: 0,
|
|
1734
|
+
excludedWithReason: 0,
|
|
1735
|
+
limited: 0
|
|
1736
|
+
});
|
|
1737
|
+
const semanticCompleteness = openSemanticLimitations(limitations).length > 0
|
|
1738
|
+
? "incomplete-known" as const
|
|
1739
|
+
: "complete" as const;
|
|
1740
|
+
return {
|
|
1741
|
+
contractVersion: GAP_AUDIT_CONTRACT_VERSION,
|
|
1742
|
+
artifactKind: "gap-audit",
|
|
1743
|
+
runId: input.runId ?? input.interactions.inputFingerprint,
|
|
1744
|
+
caseId: input.caseId,
|
|
1745
|
+
target: input.analysisContext,
|
|
1746
|
+
sourceAvailability: {
|
|
1747
|
+
sourceFacts: true,
|
|
1748
|
+
utg: true,
|
|
1749
|
+
treeSitter: input.sourceAvailability?.treeSitter ?? true,
|
|
1750
|
+
homeGraph: input.sourceAvailability?.homeGraph ?? true,
|
|
1751
|
+
agentShards: true
|
|
1752
|
+
},
|
|
1753
|
+
categories,
|
|
1754
|
+
summary,
|
|
1755
|
+
semanticCompleteness,
|
|
1756
|
+
semanticLimitations: limitations,
|
|
1757
|
+
limitations: limitations.map((item) => `${item.code}: ${item.message}`)
|
|
1758
|
+
};
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Deterministically combines the frozen upstream UTG with finalized source
|
|
1763
|
+
* interactions. It never discovers an Area. A source-proven transition may
|
|
1764
|
+
* add an internal semantic Edge to an existing Area even when frozen UTG has
|
|
1765
|
+
* no matching link; canonical paths remain compiled from UTG topology only.
|
|
1766
|
+
*/
|
|
1767
|
+
export function assembleModel(input: AssembleModelInput): AssembledModelArtifacts {
|
|
1768
|
+
if (input.caseId !== input.interactions.caseId) {
|
|
1769
|
+
throw new Error("Model inputs use different case IDs");
|
|
1770
|
+
}
|
|
1771
|
+
const { topology } = input.utg;
|
|
1772
|
+
const builder = new SourceFactsBuilder(input.caseId, input.analysisContext);
|
|
1773
|
+
const utgFacts = addUtgNodeFacts(
|
|
1774
|
+
builder,
|
|
1775
|
+
topology,
|
|
1776
|
+
input.analysisContext.applicationModule
|
|
1777
|
+
);
|
|
1778
|
+
addEntryFacts(builder, topology, utgFacts);
|
|
1779
|
+
const boundInteractions = bindExactUtgTriggerControls(
|
|
1780
|
+
input.interactions,
|
|
1781
|
+
topology
|
|
1782
|
+
);
|
|
1783
|
+
const sourceEffects = applyInteractionPlan(
|
|
1784
|
+
builder,
|
|
1785
|
+
boundInteractions,
|
|
1786
|
+
utgFacts.componentKeyByArea,
|
|
1787
|
+
utgFacts.componentFactByArea
|
|
1788
|
+
);
|
|
1789
|
+
const sourceEffectsByLink = new Map<string, SourceInteractionEffect[]>();
|
|
1790
|
+
for (const item of sourceEffects) {
|
|
1791
|
+
const edgeRef = item.effect.utgEdgeRef;
|
|
1792
|
+
if (!edgeRef) continue;
|
|
1793
|
+
if (!topology.links.some((link) => link.id === edgeRef)) {
|
|
1794
|
+
throw new Error(`Finalized interaction references unknown UTG link ${edgeRef}`);
|
|
1795
|
+
}
|
|
1796
|
+
const values = sourceEffectsByLink.get(edgeRef) ?? [];
|
|
1797
|
+
values.push(item);
|
|
1798
|
+
sourceEffectsByLink.set(edgeRef, values);
|
|
1799
|
+
}
|
|
1800
|
+
addCoveredLinkGuards(builder, topology, sourceEffectsByLink);
|
|
1801
|
+
const topologySeeds = topology.links.flatMap((link, index) =>
|
|
1802
|
+
sourceEffectsByLink.has(link.id)
|
|
1803
|
+
? []
|
|
1804
|
+
: [addTopologySeed(builder, link, index, topology, utgFacts)]
|
|
1805
|
+
);
|
|
1806
|
+
|
|
1807
|
+
const preliminarySource = builder.finish();
|
|
1808
|
+
const baseGraph = buildAreaGraph(preliminarySource);
|
|
1809
|
+
const areaRefByUtg = exactAreaMapping(baseGraph, topology, utgFacts);
|
|
1810
|
+
const nodeById = new Map(topology.nodes.map((node) => [node.id, node]));
|
|
1811
|
+
const linkById = new Map(topology.links.map((link) => [link.id, link]));
|
|
1812
|
+
const edgeList = [...baseGraph.edges];
|
|
1813
|
+
const edgeByUtgLink = new Map<string, Edge>();
|
|
1814
|
+
const effectFactRefsByLink = new Map<string, string[]>(
|
|
1815
|
+
topologySeeds.map((seed) => [seed.link.id, [seed.effectFactRef]])
|
|
1816
|
+
);
|
|
1817
|
+
for (const [linkRef, effects] of sourceEffectsByLink) {
|
|
1818
|
+
effectFactRefsByLink.set(linkRef, effects.map((item) => item.effectFactRef));
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
for (const link of topology.links) {
|
|
1822
|
+
const factRefs = effectFactRefsByLink.get(link.id) ?? [];
|
|
1823
|
+
if (factRefs.length === 0) {
|
|
1824
|
+
throw new Error(`UTG link ${link.id} has neither source coverage nor topology seed`);
|
|
1825
|
+
}
|
|
1826
|
+
const candidates: Edge[] = [];
|
|
1827
|
+
for (const factRef of factRefs) {
|
|
1828
|
+
const effect = effectForFact(baseGraph, factRef);
|
|
1829
|
+
if (link.transitionClass !== "user") {
|
|
1830
|
+
const effectIndex = baseGraph.effects.findIndex((item) => item.id === effect.id);
|
|
1831
|
+
if (effectIndex >= 0) {
|
|
1832
|
+
(baseGraph.effects as Effect[])[effectIndex] = {
|
|
1833
|
+
...effect,
|
|
1834
|
+
transitionMode: "startup-auto"
|
|
1835
|
+
};
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
const nonGestureAction = upstreamNonGestureAction(topology, link);
|
|
1839
|
+
if (nonGestureAction) {
|
|
1840
|
+
const actionIndex = baseGraph.actions.findIndex((item) =>
|
|
1841
|
+
item.id === effect.actionRef
|
|
1842
|
+
);
|
|
1843
|
+
const action = baseGraph.actions[actionIndex];
|
|
1844
|
+
if (action) {
|
|
1845
|
+
(baseGraph.actions as Action[])[actionIndex] = {
|
|
1846
|
+
...action,
|
|
1847
|
+
trigger: nonGestureAction
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
const existing = edgeList.filter((edge) =>
|
|
1852
|
+
edge.sourceFactRefs.includes(factRef) &&
|
|
1853
|
+
edge.sourceAreaRef === resolveRef(areaRefByUtg, link.sourceAreaRef) &&
|
|
1854
|
+
!("status" in edge.target) && edge.target.kind === "area" &&
|
|
1855
|
+
edge.target.ref === resolveRef(areaRefByUtg, link.targetAreaRef)
|
|
1856
|
+
);
|
|
1857
|
+
if (existing.length === 0) {
|
|
1858
|
+
const created = synthesizedEdge(
|
|
1859
|
+
input.caseId,
|
|
1860
|
+
link,
|
|
1861
|
+
effect,
|
|
1862
|
+
baseGraph,
|
|
1863
|
+
areaRefByUtg
|
|
1864
|
+
);
|
|
1865
|
+
edgeList.push(created);
|
|
1866
|
+
candidates.push(created);
|
|
1867
|
+
} else {
|
|
1868
|
+
for (const edge of existing) {
|
|
1869
|
+
const index = edgeList.findIndex((item) => item.id === edge.id);
|
|
1870
|
+
const updated: Edge = {
|
|
1871
|
+
...edge,
|
|
1872
|
+
navigationEvidence: [
|
|
1873
|
+
...(edge.navigationEvidence ?? []),
|
|
1874
|
+
navigationEvidence(link)
|
|
1875
|
+
]
|
|
1876
|
+
};
|
|
1877
|
+
edgeList[index] = updated;
|
|
1878
|
+
candidates.push(updated);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
const selected = [...candidates].sort(compareId)[0];
|
|
1883
|
+
if (!selected) throw new Error(`UTG link ${link.id} did not produce an Edge`);
|
|
1884
|
+
edgeByUtgLink.set(link.id, selected);
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
const conflictEffectRefs = new Set(sourceEffects.flatMap((item) =>
|
|
1888
|
+
item.effect.target?.kind === "unresolved" &&
|
|
1889
|
+
item.effect.target.reasonCode === "UTG_NAV_CONFLICT"
|
|
1890
|
+
? [item.effectFactRef]
|
|
1891
|
+
: []
|
|
1892
|
+
));
|
|
1893
|
+
const retainedEdges = edgeList.filter((edge) => {
|
|
1894
|
+
if (edge.sourceFactRefs.some((ref) => conflictEffectRefs.has(ref))) return false;
|
|
1895
|
+
return true;
|
|
1896
|
+
}).sort(compareId);
|
|
1897
|
+
for (const [linkId, selected] of edgeByUtgLink) {
|
|
1898
|
+
const retained = retainedEdges.find((edge) => edge.id === selected.id) ??
|
|
1899
|
+
retainedEdges.find((edge) => edge.navigationEvidence?.some((item) =>
|
|
1900
|
+
item.utgEdgeId === linkId
|
|
1901
|
+
));
|
|
1902
|
+
if (!retained) throw new Error(`UTG link evidence was lost for ${linkId}`);
|
|
1903
|
+
edgeByUtgLink.set(linkId, retained);
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
const entries = entryPoints(
|
|
1907
|
+
input.caseId,
|
|
1908
|
+
topology,
|
|
1909
|
+
areaRefByUtg,
|
|
1910
|
+
utgFacts,
|
|
1911
|
+
preliminarySource
|
|
1912
|
+
);
|
|
1913
|
+
const entryByUtg = new Map(topology.entryRootAreaRefs.map((root) => {
|
|
1914
|
+
const entry = entries.find((item) =>
|
|
1915
|
+
item.rootAreaRefs.includes(resolveRef(areaRefByUtg, root))
|
|
1916
|
+
);
|
|
1917
|
+
if (!entry) throw new Error(`Missing assembled entry for ${root}`);
|
|
1918
|
+
return [root, entry.id] as const;
|
|
1919
|
+
}));
|
|
1920
|
+
const compiledPaths = compilePaths(
|
|
1921
|
+
input.caseId,
|
|
1922
|
+
topology,
|
|
1923
|
+
areaRefByUtg,
|
|
1924
|
+
entryByUtg,
|
|
1925
|
+
edgeByUtgLink
|
|
1926
|
+
);
|
|
1927
|
+
const limitations = semanticLimitations(
|
|
1928
|
+
input.caseId,
|
|
1929
|
+
input.interactions,
|
|
1930
|
+
compiledPaths.gapAreaRefs
|
|
1931
|
+
);
|
|
1932
|
+
const semanticCompleteness = openSemanticLimitations(limitations).length > 0
|
|
1933
|
+
? "incomplete-known" as const
|
|
1934
|
+
: "complete" as const;
|
|
1935
|
+
const sourceFacts: SourceFactsArtifact = {
|
|
1936
|
+
...preliminarySource,
|
|
1937
|
+
semanticCompleteness,
|
|
1938
|
+
limitations
|
|
1939
|
+
};
|
|
1940
|
+
const unresolvedByArea = new Map(compiledPaths.unresolved.map((item) => [
|
|
1941
|
+
item.ownerRef,
|
|
1942
|
+
item.id
|
|
1943
|
+
]));
|
|
1944
|
+
const areas: Area[] = topology.nodes.map((node): Area => {
|
|
1945
|
+
const areaRef = resolveRef(areaRefByUtg, node.id);
|
|
1946
|
+
const base = baseGraph.areas.find((item) => item.id === areaRef);
|
|
1947
|
+
if (!base) throw new Error(`Missing assembled Area for ${node.id}`);
|
|
1948
|
+
const { canonicalPathRef: _baseCanonicalPathRef, ...baseWithoutPath } = base;
|
|
1949
|
+
const componentRef = resolveRef(utgFacts.componentFactByArea, node.id);
|
|
1950
|
+
const titleRef = resolveRef(utgFacts.titleFactByArea, node.id);
|
|
1951
|
+
const pathRef = compiledPaths.canonicalPathByArea.get(areaRef);
|
|
1952
|
+
const pathGap = unresolvedByArea.get(areaRef);
|
|
1953
|
+
return {
|
|
1954
|
+
...baseWithoutPath,
|
|
1955
|
+
identityAnchors: unique([...base.identityAnchors, node.id]),
|
|
1956
|
+
navigationAnchors: [node.id],
|
|
1957
|
+
kind: node.kind,
|
|
1958
|
+
name: {
|
|
1959
|
+
status: "resolved",
|
|
1960
|
+
value: displayName(node),
|
|
1961
|
+
confidence: "high",
|
|
1962
|
+
supportRefs: [componentRef, titleRef]
|
|
1963
|
+
},
|
|
1964
|
+
sourceFactRefs: unique([...base.sourceFactRefs, componentRef, titleRef]),
|
|
1965
|
+
...(pathRef ? { canonicalPathRef: pathRef } : {}),
|
|
1966
|
+
unresolvedRefs: unique([...base.unresolvedRefs, ...(pathGap ? [pathGap] : [])])
|
|
1967
|
+
};
|
|
1968
|
+
}).sort(compareId);
|
|
1969
|
+
const selectedSourceEffectRefs = new Set(sourceEffects.map((item) => item.effectFactRef));
|
|
1970
|
+
const baseEffects = new Map(baseGraph.effects.map((effect) => [effect.id, effect]));
|
|
1971
|
+
const document: AreaGraphArtifact = {
|
|
1972
|
+
schemaVersion: "2.0.0",
|
|
1973
|
+
artifactKind: "area-graph",
|
|
1974
|
+
caseId: input.caseId,
|
|
1975
|
+
analysisContext: input.analysisContext,
|
|
1976
|
+
semanticCompleteness,
|
|
1977
|
+
limitations,
|
|
1978
|
+
areaControl: {
|
|
1979
|
+
areas,
|
|
1980
|
+
controls: [...baseGraph.controls].sort(compareId),
|
|
1981
|
+
externalEndpoints: [...baseGraph.externalEndpoints].sort(compareId),
|
|
1982
|
+
entryPoints: entries,
|
|
1983
|
+
excludedAreaCandidates: []
|
|
1984
|
+
},
|
|
1985
|
+
actionEffect: {
|
|
1986
|
+
actions: baseGraph.actions.map((action) => input.requirementScope &&
|
|
1987
|
+
!action.effectRefs.some((ref) => baseEffects.get(ref)?.sourceFactRefs.some((factRef) => selectedSourceEffectRefs.has(factRef)))
|
|
1988
|
+
? { ...action, requirementScopeExcluded: true as const }
|
|
1989
|
+
: action).sort(compareId),
|
|
1990
|
+
effects: [...baseGraph.effects].sort(compareId),
|
|
1991
|
+
edges: retainedEdges,
|
|
1992
|
+
paths: compiledPaths.paths
|
|
1993
|
+
},
|
|
1994
|
+
unresolved: uniqueUnresolved([
|
|
1995
|
+
...baseGraph.unresolved,
|
|
1996
|
+
...compiledPaths.unresolved
|
|
1997
|
+
])
|
|
1998
|
+
};
|
|
1999
|
+
const areaGraph = withAreaGraphFlatViews(document);
|
|
2000
|
+
const validation = validateAreaGraph(areaGraph);
|
|
2001
|
+
if (!validation.ok) {
|
|
2002
|
+
throw new Error(
|
|
2003
|
+
`Assembled AreaGraph is invalid: ${validation.issues.map((item) =>
|
|
2004
|
+
`${item.code}@${item.path}: ${item.message}`
|
|
2005
|
+
).join(", ")}`
|
|
2006
|
+
);
|
|
2007
|
+
}
|
|
2008
|
+
const evidenceIds = new Set(retainedEdges.flatMap((edge) =>
|
|
2009
|
+
edge.navigationEvidence?.map((item) => item.utgEdgeId) ?? []
|
|
2010
|
+
));
|
|
2011
|
+
const internalEdgesWithoutUtgEvidence = retainedEdges.filter((edge) =>
|
|
2012
|
+
!("status" in edge.target) &&
|
|
2013
|
+
edge.target.kind === "area" &&
|
|
2014
|
+
(edge.navigationEvidence?.length ?? 0) === 0
|
|
2015
|
+
).length;
|
|
2016
|
+
// Conservation is directional: every frozen UTG link must remain evidenced.
|
|
2017
|
+
// Additional source-proven semantic edges are valid and counted separately.
|
|
2018
|
+
if (
|
|
2019
|
+
evidenceIds.size !== topology.links.length ||
|
|
2020
|
+
[...evidenceIds].some((id) => !linkById.has(id))
|
|
2021
|
+
) {
|
|
2022
|
+
throw new Error(
|
|
2023
|
+
`UTG link evidence conservation failed: links=${topology.links.length}, evidence=${evidenceIds.size}`
|
|
2024
|
+
);
|
|
2025
|
+
}
|
|
2026
|
+
if (areas.some((area) => (area.navigationAnchors?.length ?? 0) !== 1)) {
|
|
2027
|
+
throw new Error("Every assembled Area must retain exactly one raw UTG node anchor");
|
|
2028
|
+
}
|
|
2029
|
+
const rawReqModel = buildReqModel(areaGraph, sourceFacts);
|
|
2030
|
+
const projectedReqModel = assembleReqProjection(
|
|
2031
|
+
filterTopologyOnlyFeatures(rawReqModel, areaGraph),
|
|
2032
|
+
areaGraph,
|
|
2033
|
+
sourceFacts
|
|
2034
|
+
);
|
|
2035
|
+
const reqModel: ReqModelArtifact = input.requirementScope ? {
|
|
2036
|
+
...projectedReqModel,
|
|
2037
|
+
requirementScope: input.requirementScope,
|
|
2038
|
+
areas: projectedReqModel.areas.map((area) => {
|
|
2039
|
+
const utgNodeId = areaGraph.areas.find((item) => item.id === area.areaRef)?.navigationAnchors?.[0];
|
|
2040
|
+
if (!utgNodeId) throw new Error(`Scoped Area ${area.areaRef} has no frozen UTG node identity`);
|
|
2041
|
+
return {
|
|
2042
|
+
...area,
|
|
2043
|
+
utgNodeId,
|
|
2044
|
+
features: input.requirementScope?.selectedNodeIds.includes(utgNodeId) ? area.features : []
|
|
2045
|
+
};
|
|
2046
|
+
})
|
|
2047
|
+
} : projectedReqModel;
|
|
2048
|
+
const gapAudit = buildGapAudit(
|
|
2049
|
+
input,
|
|
2050
|
+
sourceFacts,
|
|
2051
|
+
areaGraph,
|
|
2052
|
+
sourceEffects,
|
|
2053
|
+
limitations,
|
|
2054
|
+
compiledPaths.gapAreaRefs
|
|
2055
|
+
);
|
|
2056
|
+
return {
|
|
2057
|
+
sourceFacts,
|
|
2058
|
+
areaGraph,
|
|
2059
|
+
areaGraphArtifact: toAreaGraphDocument(areaGraph),
|
|
2060
|
+
reqModel,
|
|
2061
|
+
gapAudit,
|
|
2062
|
+
statistics: {
|
|
2063
|
+
areas: areas.length,
|
|
2064
|
+
utgLinks: topology.links.length,
|
|
2065
|
+
utgLinksWithEvidence: evidenceIds.size,
|
|
2066
|
+
topologySeeds: topologySeeds.length,
|
|
2067
|
+
sourceControls: input.interactions.controls.length,
|
|
2068
|
+
visibleFeatures: reqModel.areas.reduce((sum, area) => sum + area.features.length, 0),
|
|
2069
|
+
canonicalPaths: compiledPaths.paths.filter((path) => path.kind === "canonical").length,
|
|
2070
|
+
unreachablePaths: compiledPaths.paths.filter((path) => path.kind === "unreachable").length,
|
|
2071
|
+
unresolvedPathAreas: compiledPaths.gapAreaRefs.length,
|
|
2072
|
+
internalEdgesWithoutUtgEvidence
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
function uniqueUnresolved(values: readonly UnresolvedItem[]): UnresolvedItem[] {
|
|
2078
|
+
return [...new Map(values.map((item) => [item.id, item])).values()].sort(compareId);
|
|
2079
|
+
}
|