@buaa_smat/hometrans 26.0.5 → 26.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +249 -279
- package/agents/code-reviewer.md +1 -1
- package/dist/cli/editors.json +20 -0
- package/dist/platform/registry.js +1 -0
- package/dist/platform/validate.js +2 -1
- package/i18n/agents/code-reviewer.md +1 -1
- package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
- package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
- package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/package.json +2 -1
- package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/skills/a2h-app-migrate/SKILL.md +31 -14
- package/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
- package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
- package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
- package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
- package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
- package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
- package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +1 -1
- package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
- package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
- package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
- package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
- package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
- package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
- package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
- package/skills/a2h-page-specgen/SKILL.md +36 -5
- package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
- package/skills/a2h-page-specgen/references/evidence.md +2 -1
- package/skills/a2h-page-specgen/references/execution-model.md +13 -5
- package/skills/a2h-page-specgen/references/gates.md +33 -7
- package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
- package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
- package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
- package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
- package/skills/a2h-resource-convert/SKILL.md +1 -1
- package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
- package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
- package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
- package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
- package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
- package/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
- package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
- package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
- package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
- package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
- package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
- package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
- package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
- package/skills/a2h-utg-static/SKILL.md +3 -3
- package/skills/a2h-utg-static/references/extractors.md +7 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
- package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
- package/resource/convert_pipeline_process.svg +0 -114
- package/resource/project_architecture.svg +0 -120
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
|
@@ -5,10 +5,11 @@ import fs from "node:fs";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { types } from "node:util";
|
|
7
7
|
import { slugify, toPosix } from "./lib/fsx.mjs";
|
|
8
|
-
import { bfsFileEvidence, findLabelFile, declarationReferrers } from "./lib/hg.mjs";
|
|
8
|
+
import { bfsFileEvidence, findLabelFile, declarationReferrers, declarationInheritanceTargets, declarationInheritanceChain, COMPOSITION_EDGE_KINDS } from "./lib/hg.mjs";
|
|
9
9
|
import { RUNTIME_RE, roleOf, bucketOf } from "./lib/footprint-roles.mjs";
|
|
10
10
|
import { isExcludedEvidencePath } from "./facts-build.mjs";
|
|
11
11
|
import { stableDigest } from "./behavior-model.mjs";
|
|
12
|
+
import { collectContractCalls } from "./contract-calls.mjs";
|
|
12
13
|
|
|
13
14
|
// source resolution rung 1/2: a `declared_at` that already names a source file.
|
|
14
15
|
const SOURCE_EXT_RE = /\.(java|kt|kts|vue|nvue|uvue|ets|js|mjs|cjs|jsx|ts|tsx)$/i;
|
|
@@ -38,6 +39,7 @@ function hasCompleteResolvedUniAppArtifact(page) {
|
|
|
38
39
|
|
|
39
40
|
// BFS depth for footprint traversal.
|
|
40
41
|
export const FOOTPRINT_DEPTH = 3;
|
|
42
|
+
export const COMPOSITION_DEPTH = 2;
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* The five values `resolvePageFiles` returns in `by`, as the single source of
|
|
@@ -261,6 +263,14 @@ function sortUnresolved(records) {
|
|
|
261
263
|
});
|
|
262
264
|
}
|
|
263
265
|
|
|
266
|
+
function sortByLocator(entries) {
|
|
267
|
+
return entries.sort((left, right) => {
|
|
268
|
+
const a = `${left.locator}\u0000${left.reason ?? ""}`;
|
|
269
|
+
const b = `${right.locator}\u0000${right.reason ?? ""}`;
|
|
270
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
264
274
|
/**
|
|
265
275
|
* Resolve a page's composition origins while the graph is still open.
|
|
266
276
|
*
|
|
@@ -348,6 +358,17 @@ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
|
|
|
348
358
|
const sharedDeclaredAt = sharedDeclaredAtOf(pages);
|
|
349
359
|
|
|
350
360
|
const out = new Map();
|
|
361
|
+
const contractCache = { rows: new Map(), text: new Map() };
|
|
362
|
+
const isExcludedContractTarget = value => {
|
|
363
|
+
const role = roleOf(value, roleCtx);
|
|
364
|
+
return role === "runtime" || role === "wiring";
|
|
365
|
+
};
|
|
366
|
+
const importsStmt = db.prepare(`
|
|
367
|
+
SELECT DISTINCT n2.file_path AS fp
|
|
368
|
+
FROM nodes n1 JOIN edges e ON e.source = n1.id
|
|
369
|
+
JOIN nodes n2 ON n2.id = e.target
|
|
370
|
+
WHERE n1.file_path = ? AND e.kind = 'imports' AND n2.file_path IS NOT NULL
|
|
371
|
+
`);
|
|
351
372
|
for (const page of pages) {
|
|
352
373
|
const { originUnits, originUnresolved } = compositionOrigins({
|
|
353
374
|
page, sourceProject, db, sharedDeclaredAt,
|
|
@@ -362,12 +383,36 @@ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
|
|
|
362
383
|
resolvedFile: null,
|
|
363
384
|
origin_units: originUnits,
|
|
364
385
|
unresolved: sortUnresolved(originUnresolved),
|
|
386
|
+
composition: new Set(),
|
|
387
|
+
bodyInheritance: new Set(),
|
|
388
|
+
compositionUnresolved: sortUnresolved(originUnresolved),
|
|
389
|
+
behaviorReachUnresolved: sortUnresolved(originUnresolved),
|
|
390
|
+
compositionFrontier: [],
|
|
391
|
+
reachOnly: [],
|
|
392
|
+
imports: [],
|
|
393
|
+
distance: {},
|
|
394
|
+
directInheritance: new Set(),
|
|
395
|
+
contractCalls: collectContractCalls({
|
|
396
|
+
db,
|
|
397
|
+
sourceProject,
|
|
398
|
+
page,
|
|
399
|
+
entry: {
|
|
400
|
+
resolvedFile: null,
|
|
401
|
+
composition: new Set(),
|
|
402
|
+
bodyInheritance: new Set(),
|
|
403
|
+
directInheritance: new Set(),
|
|
404
|
+
origin_units: originUnits,
|
|
405
|
+
},
|
|
406
|
+
isExcludedTarget: isExcludedContractTarget,
|
|
407
|
+
cache: contractCache,
|
|
408
|
+
}),
|
|
365
409
|
});
|
|
366
410
|
continue;
|
|
367
411
|
}
|
|
368
412
|
|
|
369
413
|
const all = new Set();
|
|
370
414
|
const writable = new Set();
|
|
415
|
+
const distance = {};
|
|
371
416
|
const reached = bfsFileEvidence(db, [file], { depth: FOOTPRINT_DEPTH });
|
|
372
417
|
for (const raw of reached.resolved) {
|
|
373
418
|
const f = normalize(raw);
|
|
@@ -381,12 +426,84 @@ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
|
|
|
381
426
|
all.add(f);
|
|
382
427
|
if (role === "writable") writable.add(f);
|
|
383
428
|
}
|
|
429
|
+
for (const [raw, hops] of reached.distances ?? new Map()) {
|
|
430
|
+
const f = normalize(raw);
|
|
431
|
+
if (!Number.isInteger(hops) || hops < 0) continue;
|
|
432
|
+
if (!(f in distance) || hops < distance[f]) distance[f] = hops;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const stem = path.basename(file).replace(/\.[^.]+$/, "");
|
|
436
|
+
const inheritanceNames = [page.fqn, page.label, stem];
|
|
437
|
+
const directInheritance = new Set();
|
|
438
|
+
for (const raw of declarationInheritanceTargets(db, file, inheritanceNames)) {
|
|
439
|
+
const f = normalize(raw);
|
|
440
|
+
if (roleOf(f, roleCtx) === "runtime") continue;
|
|
441
|
+
directInheritance.add(f);
|
|
442
|
+
}
|
|
443
|
+
const bodyInheritance = new Set();
|
|
444
|
+
for (const raw of declarationInheritanceChain(db, file, inheritanceNames)) {
|
|
445
|
+
const f = normalize(raw);
|
|
446
|
+
if (roleOf(f, roleCtx) === "runtime" || f === file) continue;
|
|
447
|
+
bodyInheritance.add(f);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const compositionReached = bfsFileEvidence(db, [file], {
|
|
451
|
+
depth: COMPOSITION_DEPTH,
|
|
452
|
+
edgeKinds: COMPOSITION_EDGE_KINDS,
|
|
453
|
+
includeFrontier: true,
|
|
454
|
+
});
|
|
455
|
+
const composition = new Set();
|
|
456
|
+
for (const raw of compositionReached.resolved) {
|
|
457
|
+
const f = normalize(raw);
|
|
458
|
+
if (f === file || roleOf(f, roleCtx) === "runtime") continue;
|
|
459
|
+
composition.add(f);
|
|
460
|
+
}
|
|
461
|
+
const compositionFrontier = [];
|
|
462
|
+
for (const entry of compositionReached.frontier ?? []) {
|
|
463
|
+
const f = normalize(entry.locator);
|
|
464
|
+
if (f === file || roleOf(f, roleCtx) === "runtime") continue;
|
|
465
|
+
compositionFrontier.push({ locator: f, reason: entry.reason ?? "depth" });
|
|
466
|
+
}
|
|
467
|
+
for (const f of bodyInheritance) {
|
|
468
|
+
if (!all.has(f)) compositionFrontier.push({ locator: f, reason: "inheritance" });
|
|
469
|
+
}
|
|
470
|
+
const imports = new Set();
|
|
471
|
+
for (const row of importsStmt.all(file)) {
|
|
472
|
+
const f = normalize(row.fp);
|
|
473
|
+
if (f === file || roleOf(f, roleCtx) === "runtime") continue;
|
|
474
|
+
imports.add(f);
|
|
475
|
+
}
|
|
476
|
+
const reachOnly = [...all].filter(f =>
|
|
477
|
+
f !== file
|
|
478
|
+
&& !composition.has(f)
|
|
479
|
+
&& !bodyInheritance.has(f)
|
|
480
|
+
&& !imports.has(f));
|
|
384
481
|
|
|
385
482
|
const unresolvedByKey = new Map();
|
|
386
483
|
for (const record of [...reached.unresolved, ...originUnresolved]) {
|
|
387
484
|
const key = unresolvedKey(record);
|
|
388
485
|
if (!unresolvedByKey.has(key)) unresolvedByKey.set(key, record);
|
|
389
486
|
}
|
|
487
|
+
const compositionUnresolvedByKey = new Map();
|
|
488
|
+
for (const record of [...compositionReached.unresolved, ...originUnresolved]) {
|
|
489
|
+
const key = unresolvedKey(record);
|
|
490
|
+
if (!compositionUnresolvedByKey.has(key)) compositionUnresolvedByKey.set(key, record);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const contractCalls = collectContractCalls({
|
|
494
|
+
db,
|
|
495
|
+
sourceProject,
|
|
496
|
+
page,
|
|
497
|
+
entry: {
|
|
498
|
+
resolvedFile: file,
|
|
499
|
+
composition,
|
|
500
|
+
bodyInheritance,
|
|
501
|
+
directInheritance,
|
|
502
|
+
origin_units: originUnits,
|
|
503
|
+
},
|
|
504
|
+
isExcludedTarget: isExcludedContractTarget,
|
|
505
|
+
cache: contractCache,
|
|
506
|
+
});
|
|
390
507
|
|
|
391
508
|
out.set(page.page_id, {
|
|
392
509
|
all: new Set([...all].sort()),
|
|
@@ -394,6 +511,16 @@ export function computeFootprint({ pages, sourceProject, db, ctx } = {}) {
|
|
|
394
511
|
resolvedFile: file,
|
|
395
512
|
origin_units: originUnits,
|
|
396
513
|
unresolved: sortUnresolved([...unresolvedByKey.values()]),
|
|
514
|
+
composition: new Set([...composition].sort()),
|
|
515
|
+
bodyInheritance: new Set([...bodyInheritance].sort()),
|
|
516
|
+
compositionUnresolved: sortUnresolved([...compositionUnresolvedByKey.values()]),
|
|
517
|
+
behaviorReachUnresolved: sortUnresolved([...unresolvedByKey.values()]),
|
|
518
|
+
compositionFrontier: sortByLocator(compositionFrontier),
|
|
519
|
+
reachOnly: [...new Set(reachOnly)].sort(),
|
|
520
|
+
imports: [...imports].sort(),
|
|
521
|
+
distance,
|
|
522
|
+
directInheritance: new Set([...directInheritance].sort()),
|
|
523
|
+
contractCalls,
|
|
397
524
|
});
|
|
398
525
|
}
|
|
399
526
|
return out;
|
|
@@ -512,7 +639,7 @@ const FEATURE_MARKERS = new Map([
|
|
|
512
639
|
]);
|
|
513
640
|
|
|
514
641
|
/** Gradle module root of `file`: the path before its first `src/<sourceSet>/`. */
|
|
515
|
-
function moduleRootOf(file) {
|
|
642
|
+
export function moduleRootOf(file) {
|
|
516
643
|
const m = /^(?:(.*?)\/)?src\/[^/]+\//.exec(file);
|
|
517
644
|
if (!m) return null; // decompiled trees have no `src/<set>/` layer
|
|
518
645
|
return m[1] === undefined || m[1] === "" ? "." : m[1];
|
|
@@ -613,17 +613,25 @@ function runGates(opts, { partial }) {
|
|
|
613
613
|
continue;
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
-
//
|
|
616
|
+
// A draft may name the claim itself. Compose routes and overlay names derive a
|
|
617
|
+
// meaningless trailing segment, so a supplied token wins. It is matched as written
|
|
618
|
+
// (case-insensitively, like every other token) in the claimed scenario's steps;
|
|
619
|
+
// without one, derive it from the item as before.
|
|
620
|
+
const supplied = typeof claim.claim_token === "string" ? claim.claim_token.trim() : "";
|
|
617
621
|
let token;
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
622
|
+
if (supplied === "") {
|
|
623
|
+
try {
|
|
624
|
+
token = claimToken(claim.item, "edges", nodesById);
|
|
625
|
+
} catch (err) {
|
|
626
|
+
failures.push({
|
|
627
|
+
gate: "G4",
|
|
628
|
+
spec_id,
|
|
629
|
+
message: `edge ${claim.item}: ${err.message}`,
|
|
630
|
+
});
|
|
631
|
+
continue;
|
|
632
|
+
}
|
|
633
|
+
} else {
|
|
634
|
+
token = supplied.toLowerCase();
|
|
627
635
|
}
|
|
628
636
|
|
|
629
637
|
const scenario = draft.scenarios[scenarioIdx];
|
|
@@ -854,6 +862,7 @@ function runGates(opts, { partial }) {
|
|
|
854
862
|
requireAuditArtifacts,
|
|
855
863
|
});
|
|
856
864
|
if (behavior) failures.push(...behavior.failures);
|
|
865
|
+
if (behavior) warnings.push(...(behavior.warnings ?? []));
|
|
857
866
|
|
|
858
867
|
return {
|
|
859
868
|
ok: failures.length === 0,
|
|
@@ -126,12 +126,64 @@ function pushToken(out, kind, label, value) {
|
|
|
126
126
|
out.push({ kind, label, value: v });
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
// A rule statement is free prose, so only its Arabic literals can be gated. They are normalized
|
|
130
|
+
// to the shape the steps would state: grouped digits lose their separator ("10,000" -> 10000), a
|
|
131
|
+
// signed literal keeps its magnitude ("-32" -> 32, because the step says "subtract 32"), and an
|
|
132
|
+
// exponent is expanded ("1e3" -> 1000).
|
|
133
|
+
//
|
|
134
|
+
// The start lookbehind has two layers: `(?<![\w.])` avoids identifiers and decimals, and
|
|
135
|
+
// `(?<![A-Za-z_]-)` avoids letter-hyphen-digit labels ("UTF-8", "SHA-1", "AES-256") that the
|
|
136
|
+
// sign normalization would otherwise admit.
|
|
137
|
+
const RULE_NUMBER_RE = /(?<![\w.])(?<![A-Za-z_]-)([+-]?(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?(?:[eE][+-]?\d+)?)(?![\w.])/g;
|
|
138
|
+
|
|
139
|
+
// A date or clock time is structural, not a constant a rule can get wrong: a step writes
|
|
140
|
+
// "January 15, 2024" or "12 o'clock", so requiring the zero-padded parts would be unsatisfiable.
|
|
141
|
+
// The mask keeps the length, so `trailing` still slices the original statement.
|
|
142
|
+
const DATE_OR_TIME_RE = /(?<![\w])(?:\d{4}-\d{1,2}-\d{1,2}|\d{1,2}:\d{2}(?::\d{2})?)(?![\w])/g;
|
|
143
|
+
|
|
144
|
+
// U+4F4D U+5C0F U+6570 is the Chinese word for "decimal places". The escape keeps this overlay
|
|
145
|
+
// ASCII-only while matching the same statements as the Chinese source tree.
|
|
146
|
+
const DECIMAL_PLACES_RE = /^\s*(?:\u4f4d\u5c0f\u6570|decimals?(?:\s+places?)?(?![A-Za-z]))/i;
|
|
147
|
+
|
|
148
|
+
// A literal that states how a value is printed is not a fact the steps can be wrong about:
|
|
149
|
+
// changing it changes the display, not the rule's result. These classes are skipped; anything
|
|
150
|
+
// else stays required, so a dropped coefficient, offset, threshold, or enum value still fails.
|
|
151
|
+
// Add a class here when a new display shape appears.
|
|
152
|
+
const RULE_DISPLAY_FORMATS = Object.freeze([
|
|
153
|
+
// Field width: "the decimals are fixed at 00" pads to two digits; it is not a value.
|
|
154
|
+
(value) => /^0+$/.test(value) && value.length > 1,
|
|
155
|
+
// Precision: "keep 2 decimal places" counts places, not a value.
|
|
156
|
+
(value, trailing) => DECIMAL_PLACES_RE.test(trailing),
|
|
157
|
+
]);
|
|
158
|
+
|
|
159
|
+
function normalizeRuleNumber(literal) {
|
|
160
|
+
const unsigned = literal.replace(/^[+-]/, "").replace(/,/g, "");
|
|
161
|
+
if (!/[eE]/.test(unsigned)) return unsigned;
|
|
162
|
+
const expanded = String(Number(unsigned));
|
|
163
|
+
return /[eE]/.test(expanded) ? null : expanded;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function ruleNumberTokens(statement) {
|
|
167
|
+
const out = [];
|
|
168
|
+
const scan = statement.replace(DATE_OR_TIME_RE, (match) => " ".repeat(match.length));
|
|
169
|
+
for (const match of scan.matchAll(RULE_NUMBER_RE)) {
|
|
170
|
+
const literal = match[0];
|
|
171
|
+
const value = normalizeRuleNumber(literal);
|
|
172
|
+
if (value === null) continue;
|
|
173
|
+
const trailing = statement.slice(match.index + literal.length);
|
|
174
|
+
if (RULE_DISPLAY_FORMATS.some((isFormat) => isFormat(value, trailing))) continue;
|
|
175
|
+
out.push(value);
|
|
176
|
+
}
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
|
|
129
180
|
/**
|
|
130
181
|
* Every token the merged steps must contain, in authoring order, de-duplicated.
|
|
131
182
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
183
|
+
* Endpoint/persistence/data contract values are read field by field. A `rules` statement is
|
|
184
|
+
* free-form prose, so it is not matched word by word; its numeric constants are. That keeps a
|
|
185
|
+
* conversion formula from being summarised as "apply the conversion rule" while the derived
|
|
186
|
+
* numbers never reach the SPEC.
|
|
135
187
|
*
|
|
136
188
|
* @param {object|null|undefined} contracts
|
|
137
189
|
* @returns {Array<{kind: string, label: string, value: string}>}
|
|
@@ -145,6 +197,13 @@ export function factTokens(contracts) {
|
|
|
145
197
|
out.push(...entryTokens(kind, entry));
|
|
146
198
|
}
|
|
147
199
|
}
|
|
200
|
+
for (const entry of entriesOf(contracts.rules)) {
|
|
201
|
+
const statement = text(entry?.statement);
|
|
202
|
+
if (statement === "") continue;
|
|
203
|
+
for (const value of ruleNumberTokens(statement)) {
|
|
204
|
+
pushToken(out, "rules", "number", value);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
148
207
|
const seen = new Set();
|
|
149
208
|
return out.filter((token) => {
|
|
150
209
|
const key = `${token.kind}|${token.label}|${token.value}`;
|
|
@@ -123,6 +123,21 @@ export function loadEvidenceFromDisk(root, pageId) {
|
|
|
123
123
|
const dir = path.join(root, "evidence", stemOf(pageId));
|
|
124
124
|
const composition = readJson(path.join(dir, "composition.json"));
|
|
125
125
|
const schemaVersion = composition.schema_version ?? LEGACY_BEHAVIOR_SCHEMA_VERSION;
|
|
126
|
+
const contractEvidence = asArray(composition.contract_evidence);
|
|
127
|
+
const contractInventory = composition.contract_inventory ?? null;
|
|
128
|
+
const contractDispositions = asArray(composition.contract_dispositions);
|
|
129
|
+
const contractsFile = path.join(dir, "contracts.json");
|
|
130
|
+
if (fs.existsSync(contractsFile)) {
|
|
131
|
+
const contracts = readJson(contractsFile);
|
|
132
|
+
const sameContracts = stableDigest(contracts.evidence ?? []) === stableDigest(contractEvidence)
|
|
133
|
+
&& stableDigest(contracts.inventory ?? null) === stableDigest(contractInventory)
|
|
134
|
+
&& stableDigest(contracts.dispositions ?? []) === stableDigest(contractDispositions);
|
|
135
|
+
if (!sameContracts) {
|
|
136
|
+
throw new Error(`contract evidence mismatch for ${pageId}`);
|
|
137
|
+
}
|
|
138
|
+
} else if (contractEvidence.length > 0 || contractInventory !== null || contractDispositions.length > 0) {
|
|
139
|
+
throw new Error(`contract evidence missing for ${pageId}`);
|
|
140
|
+
}
|
|
126
141
|
return {
|
|
127
142
|
schema_version: schemaVersion,
|
|
128
143
|
profile: composition.profile,
|
|
@@ -141,6 +156,18 @@ export function loadEvidenceFromDisk(root, pageId) {
|
|
|
141
156
|
?? (schemaVersion === LEGACY_BEHAVIOR_SCHEMA_VERSION ? legacyGraphEvidence() : null),
|
|
142
157
|
operation_candidates: asArray(composition.operation_candidates),
|
|
143
158
|
outbound_evidence: asArray(composition.outbound_evidence),
|
|
159
|
+
composition: asArray(composition.composition),
|
|
160
|
+
body_inheritance: asArray(composition.body_inheritance),
|
|
161
|
+
composition_unresolved: asArray(composition.composition_unresolved),
|
|
162
|
+
behavior_reach_unresolved: composition.behavior_reach_unresolved ?? null,
|
|
163
|
+
composition_frontier: asArray(composition.composition_frontier),
|
|
164
|
+
reach_only: composition.reach_only ?? null,
|
|
165
|
+
imports: asArray(composition.imports),
|
|
166
|
+
contract_evidence: contractEvidence,
|
|
167
|
+
contract_inventory: contractInventory,
|
|
168
|
+
contract_dispositions: contractDispositions,
|
|
169
|
+
scope_exclusions: asArray(composition.scope_exclusions),
|
|
170
|
+
trim_exclusions: asArray(composition.trim_exclusions),
|
|
144
171
|
candidates: readJson(path.join(dir, "candidates.json")),
|
|
145
172
|
assertions: readJson(path.join(dir, "assertions.json")),
|
|
146
173
|
unknowns: readJson(path.join(dir, "unknowns.json")),
|
|
@@ -24,6 +24,11 @@ const require = createRequire(import.meta.url);
|
|
|
24
24
|
/** Edge kinds excluded from BFS traversal. */
|
|
25
25
|
export const EXCLUDED_EDGE_KINDS = ["contains"];
|
|
26
26
|
|
|
27
|
+
/** Edge kinds traversed by BFS (every kind except `contains`). */
|
|
28
|
+
export const COMPOSITION_EDGE_KINDS = Object.freeze([
|
|
29
|
+
"imports", "references", "instantiates",
|
|
30
|
+
]);
|
|
31
|
+
|
|
27
32
|
/** Edge kinds traversed by BFS (every kind except `contains`). */
|
|
28
33
|
export const TRAVERSED_EDGE_KINDS = [
|
|
29
34
|
"calls",
|
|
@@ -458,12 +463,16 @@ export function openReadOnly(sourceProject) {
|
|
|
458
463
|
*
|
|
459
464
|
* @param {import("node:sqlite").DatabaseSync} db
|
|
460
465
|
* @param {string[]} startFiles — file_path seeds (included in `resolved`)
|
|
461
|
-
* @param {{ depth?: number }} [opts] — max edge hops (default 3)
|
|
466
|
+
* @param {{ depth?: number, edgeKinds?: string[], includeFrontier?: boolean }} [opts] — max edge hops (default 3)
|
|
462
467
|
* @returns {{resolved: Set<string>, unresolved: Array<{referring_file: string,
|
|
463
468
|
* locator: string, target_node_id: string, kind: string}>}}
|
|
464
469
|
*/
|
|
465
|
-
export function bfsFileEvidence(db, startFiles, {
|
|
466
|
-
|
|
470
|
+
export function bfsFileEvidence(db, startFiles, {
|
|
471
|
+
depth = 3,
|
|
472
|
+
edgeKinds = TRAVERSED_EDGE_KINDS,
|
|
473
|
+
includeFrontier = false,
|
|
474
|
+
} = {}) {
|
|
475
|
+
const placeholders = edgeKinds.map(() => "?").join(",");
|
|
467
476
|
const expand = db.prepare(`
|
|
468
477
|
SELECT DISTINCT n1.file_path AS referring_file, e.target AS target_node_id, e.kind, n2.file_path AS fp
|
|
469
478
|
FROM nodes n1
|
|
@@ -484,21 +493,31 @@ export function bfsFileEvidence(db, startFiles, { depth = 3 } = {}) {
|
|
|
484
493
|
const projectIndex = hasUnresolvedRefs ? projectSourceNames(db) : null;
|
|
485
494
|
|
|
486
495
|
const visited = new Set();
|
|
496
|
+
const distances = new Map();
|
|
497
|
+
const frontier = new Map();
|
|
487
498
|
const queue = [];
|
|
488
499
|
const unresolvedByKey = new Map();
|
|
489
500
|
|
|
490
501
|
for (const f of startFiles) {
|
|
491
502
|
if (f !== null && f !== undefined && !visited.has(f)) {
|
|
492
503
|
visited.add(f);
|
|
504
|
+
distances.set(f, 0);
|
|
493
505
|
queue.push({ file: f, dist: 0 });
|
|
494
506
|
}
|
|
495
507
|
}
|
|
496
508
|
|
|
497
509
|
while (queue.length > 0) {
|
|
498
510
|
const { file, dist } = queue.shift();
|
|
499
|
-
if (dist >= depth)
|
|
511
|
+
if (dist >= depth) {
|
|
512
|
+
if (includeFrontier) {
|
|
513
|
+
for (const row of expand.all(file, ...edgeKinds)) {
|
|
514
|
+
if (row.fp) frontier.set(row.fp, { locator: row.fp, reason: "depth" });
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
500
519
|
|
|
501
|
-
const rows = expand.all(file, ...
|
|
520
|
+
const rows = expand.all(file, ...edgeKinds);
|
|
502
521
|
for (const row of expandUnresolved?.all(file) ?? []) {
|
|
503
522
|
if (!SOURCE_UNIT_REFERENCE_KIND_SET.has(row.reference_kind)) continue;
|
|
504
523
|
if (!namesKnownProjectSymbol(row.reference_name, projectIndex, row.file_path)) continue;
|
|
@@ -529,6 +548,7 @@ export function bfsFileEvidence(db, startFiles, { depth = 3 } = {}) {
|
|
|
529
548
|
}
|
|
530
549
|
if (!visited.has(fp)) {
|
|
531
550
|
visited.add(fp);
|
|
551
|
+
distances.set(fp, dist + 1);
|
|
532
552
|
queue.push({ file: fp, dist: dist + 1 });
|
|
533
553
|
}
|
|
534
554
|
}
|
|
@@ -544,7 +564,12 @@ export function bfsFileEvidence(db, startFiles, { depth = 3 } = {}) {
|
|
|
544
564
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
545
565
|
});
|
|
546
566
|
|
|
547
|
-
return {
|
|
567
|
+
return {
|
|
568
|
+
resolved: visited,
|
|
569
|
+
unresolved,
|
|
570
|
+
distances,
|
|
571
|
+
frontier: [...frontier.values()].sort((a, b) => (a.locator < b.locator ? -1 : a.locator > b.locator ? 1 : 0)),
|
|
572
|
+
};
|
|
548
573
|
}
|
|
549
574
|
|
|
550
575
|
/**
|
|
@@ -566,6 +591,91 @@ export function bfsFiles(db, startFiles, opts = {}) {
|
|
|
566
591
|
return bfsFileEvidence(db, startFiles, opts).resolved;
|
|
567
592
|
}
|
|
568
593
|
|
|
594
|
+
/**
|
|
595
|
+
* Direct `extends`/`implements` targets of a page body's declaring class.
|
|
596
|
+
*
|
|
597
|
+
* File-scoped inheritance edges also carry inner/anonymous classes, so the
|
|
598
|
+
* caller supplies the page's class names. When no declaration matches (for
|
|
599
|
+
* example a Compose or uni-app body), the file-scoped set is returned as a
|
|
600
|
+
* conservative fallback.
|
|
601
|
+
*
|
|
602
|
+
* @param {import("node:sqlite").DatabaseSync} db
|
|
603
|
+
* @param {string} file - page body file_path
|
|
604
|
+
* @param {string[]} [names] - page fqn/label/stem candidates
|
|
605
|
+
* @returns {Set<string>} target file_path values
|
|
606
|
+
*/
|
|
607
|
+
export function declarationInheritanceTargets(db, file, names = []) {
|
|
608
|
+
const rows = db.prepare(`
|
|
609
|
+
SELECT DISTINCT n1.name AS source_name, n1.kind AS source_kind, n2.file_path AS fp
|
|
610
|
+
FROM nodes n1
|
|
611
|
+
JOIN edges e ON e.source = n1.id
|
|
612
|
+
JOIN nodes n2 ON n2.id = e.target
|
|
613
|
+
WHERE n1.file_path = ?
|
|
614
|
+
AND n1.kind IN ('class', 'interface', 'struct')
|
|
615
|
+
AND e.kind IN ('extends', 'implements')
|
|
616
|
+
AND n2.file_path IS NOT NULL
|
|
617
|
+
`).all(file);
|
|
618
|
+
const wanted = names.filter(name => typeof name === "string" && name !== "");
|
|
619
|
+
const matches = wanted.length === 0 ? rows : rows.filter(row =>
|
|
620
|
+
wanted.some(name =>
|
|
621
|
+
row.source_name === name
|
|
622
|
+
|| name.endsWith(`.${row.source_name}`)
|
|
623
|
+
|| row.source_name.endsWith(`.${name}`)));
|
|
624
|
+
const chosen = matches.length > 0 ? matches : rows;
|
|
625
|
+
return new Set(chosen.map(row => row.fp).filter(Boolean));
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Transitive `extends`/`implements` chain from a page body's declaring class.
|
|
630
|
+
* Each hop is declaration-scoped, so inner/anonymous classes never contribute.
|
|
631
|
+
*
|
|
632
|
+
* @param {import("node:sqlite").DatabaseSync} db
|
|
633
|
+
* @param {string} file — page body file_path
|
|
634
|
+
* @param {string[]} names — page fqn/label/stem candidates
|
|
635
|
+
* @param {{ maxDepth?: number }} [opts]
|
|
636
|
+
* @returns {Set<string>} inherited file_path values (the body itself excluded)
|
|
637
|
+
*/
|
|
638
|
+
export function declarationInheritanceChain(db, file, names = [], { maxDepth = 8 } = {}) {
|
|
639
|
+
const stmt = db.prepare(`
|
|
640
|
+
SELECT DISTINCT n1.name AS source_name, n2.name AS target_name, n2.file_path AS fp
|
|
641
|
+
FROM nodes n1
|
|
642
|
+
JOIN edges e ON e.source = n1.id
|
|
643
|
+
JOIN nodes n2 ON n2.id = e.target
|
|
644
|
+
WHERE n1.file_path = ?
|
|
645
|
+
AND n1.kind IN ('class', 'interface', 'struct')
|
|
646
|
+
AND e.kind IN ('extends', 'implements')
|
|
647
|
+
AND n2.file_path IS NOT NULL
|
|
648
|
+
`);
|
|
649
|
+
const chain = new Set();
|
|
650
|
+
const seen = new Set();
|
|
651
|
+
let queue = [{ file, names }];
|
|
652
|
+
let depth = 0;
|
|
653
|
+
while (queue.length > 0 && depth < maxDepth) {
|
|
654
|
+
depth += 1;
|
|
655
|
+
const next = [];
|
|
656
|
+
for (const item of queue) {
|
|
657
|
+
if (seen.has(item.file)) continue;
|
|
658
|
+
seen.add(item.file);
|
|
659
|
+
const rows = stmt.all(item.file);
|
|
660
|
+
const wanted = item.names.filter(name => typeof name === "string" && name !== "");
|
|
661
|
+
const matches = wanted.length === 0 ? rows : rows.filter(row =>
|
|
662
|
+
wanted.some(name =>
|
|
663
|
+
row.source_name === name
|
|
664
|
+
|| name.endsWith(`.${row.source_name}`)
|
|
665
|
+
|| row.source_name.endsWith(`.${name}`)));
|
|
666
|
+
const chosen = matches.length > 0 ? matches : rows;
|
|
667
|
+
for (const row of chosen) {
|
|
668
|
+
const fp = row.fp;
|
|
669
|
+
if (!fp || fp === file) continue;
|
|
670
|
+
chain.add(fp);
|
|
671
|
+
next.push({ file: fp, names: [row.target_name] });
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
queue = next;
|
|
675
|
+
}
|
|
676
|
+
return chain;
|
|
677
|
+
}
|
|
678
|
+
|
|
569
679
|
/**
|
|
570
680
|
* Files that reference a *declaration* (type or top-level function) declared in
|
|
571
681
|
* `file` through an ownership edge, one hop away.
|