@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
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import { DatabaseSync } from "node:sqlite";
|
|
7
|
+
import { classifyContractSignals, collectContractCalls } from "../contract-calls.mjs";
|
|
8
|
+
|
|
9
|
+
function makeGraph(root, nodes, edges) {
|
|
10
|
+
const dir = path.join(root, ".homegraph");
|
|
11
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
12
|
+
const db = new DatabaseSync(path.join(dir, "homegraph.db"));
|
|
13
|
+
db.exec(`
|
|
14
|
+
DROP TABLE IF EXISTS nodes;
|
|
15
|
+
DROP TABLE IF EXISTS edges;
|
|
16
|
+
CREATE TABLE nodes (id TEXT PRIMARY KEY, kind TEXT, name TEXT, file_path TEXT);
|
|
17
|
+
CREATE TABLE edges (source TEXT NOT NULL, target TEXT NOT NULL, kind TEXT NOT NULL, line INTEGER, col INTEGER);
|
|
18
|
+
`);
|
|
19
|
+
for (const node of nodes) {
|
|
20
|
+
db.prepare("INSERT INTO nodes VALUES (?, ?, ?, ?)")
|
|
21
|
+
.run(node.id, node.kind ?? "file", node.name ?? node.id, node.file ?? null);
|
|
22
|
+
}
|
|
23
|
+
for (const edge of edges) {
|
|
24
|
+
db.prepare("INSERT INTO edges VALUES (?, ?, ?, ?, ?)")
|
|
25
|
+
.run(edge.source, edge.target, edge.kind ?? "calls", edge.line ?? null, edge.col ?? null);
|
|
26
|
+
}
|
|
27
|
+
return db;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function write(root, rel, text) {
|
|
31
|
+
const file = path.join(root, rel);
|
|
32
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
33
|
+
fs.writeFileSync(file, text, "utf8");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function page(id = "page:Main") {
|
|
37
|
+
return { page_id: id, fqn: "com.example.Main", label: "Main" };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
test("keeps a call-only HTTP client and rejects a plain utility", () => {
|
|
41
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-jvm-"));
|
|
42
|
+
write(root, "Main.kt", "class Main { fun run() { Repo().load(); Util().noop() } }");
|
|
43
|
+
write(root, "Repo.kt", "class Repo { fun load() { OpenMeteoClient().fetch() } }");
|
|
44
|
+
write(root, "OpenMeteoClient.kt", `
|
|
45
|
+
class OpenMeteoClient {
|
|
46
|
+
val base = "https://api.open-meteo.com/v1/forecast"
|
|
47
|
+
fun fetch() {
|
|
48
|
+
Request.Builder().url(base)
|
|
49
|
+
.addQueryParameter("temperature_unit", "celsius")
|
|
50
|
+
.build()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`);
|
|
54
|
+
write(root, "Util.kt", "class Util { fun noop() {} }");
|
|
55
|
+
const db = makeGraph(root, [
|
|
56
|
+
{ id: "m", file: "Main.kt" },
|
|
57
|
+
{ id: "r", file: "Repo.kt" },
|
|
58
|
+
{ id: "o", file: "OpenMeteoClient.kt", kind: "class", name: "OpenMeteoClient" },
|
|
59
|
+
{ id: "u", file: "Util.kt", kind: "class", name: "Util" },
|
|
60
|
+
], [
|
|
61
|
+
{ source: "m", target: "r", line: 1, col: 20 },
|
|
62
|
+
{ source: "r", target: "o", line: 1, col: 24 },
|
|
63
|
+
{ source: "m", target: "u", line: 1, col: 45 },
|
|
64
|
+
]);
|
|
65
|
+
|
|
66
|
+
const result = collectContractCalls({
|
|
67
|
+
db,
|
|
68
|
+
sourceProject: root,
|
|
69
|
+
page: page(),
|
|
70
|
+
entry: {
|
|
71
|
+
resolvedFile: "Main.kt",
|
|
72
|
+
composition: new Set(["Repo.kt"]),
|
|
73
|
+
bodyInheritance: new Set(),
|
|
74
|
+
directInheritance: new Set(),
|
|
75
|
+
origin_units: [],
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
assert.deepEqual(result.targets.map(target => target.locator), ["OpenMeteoClient.kt"]);
|
|
80
|
+
assert.equal(result.targets[0].kinds.includes("transport"), true);
|
|
81
|
+
assert.equal(result.dispositions.some(item => item.locator === "Util.kt"), true);
|
|
82
|
+
assert.equal(result.dispositions.find(item => item.locator === "Util.kt").disposition, "not-contract");
|
|
83
|
+
assert.deepEqual(result.source_contracts.urls, ["https://api.open-meteo.com/v1/forecast"]);
|
|
84
|
+
assert.deepEqual(result.source_contracts.query_params, ["temperature_unit"]);
|
|
85
|
+
db.close();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("keeps a call-only uni.request module for a Vue page", () => {
|
|
89
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-vue-"));
|
|
90
|
+
write(root, "pages/list/index.vue", "<template><view/></template><script>import api from '@/api/weather'; api.load()</script>");
|
|
91
|
+
write(root, "api/weather.js", `
|
|
92
|
+
export default {
|
|
93
|
+
load() {
|
|
94
|
+
return uni.request({
|
|
95
|
+
url: "https://api.example.test/weather",
|
|
96
|
+
data: { temperature_unit: "celsius" }
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
`);
|
|
101
|
+
const db = makeGraph(root, [
|
|
102
|
+
{ id: "p", file: "pages/list/index.vue" },
|
|
103
|
+
{ id: "a", file: "api/weather.js" },
|
|
104
|
+
], [{ source: "p", target: "a", line: 1, col: 40 }]);
|
|
105
|
+
|
|
106
|
+
const result = collectContractCalls({
|
|
107
|
+
db,
|
|
108
|
+
sourceProject: root,
|
|
109
|
+
page: page("page:List"),
|
|
110
|
+
entry: {
|
|
111
|
+
resolvedFile: "pages/list/index.vue",
|
|
112
|
+
composition: new Set(),
|
|
113
|
+
bodyInheritance: new Set(),
|
|
114
|
+
directInheritance: new Set(),
|
|
115
|
+
origin_units: [],
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
assert.deepEqual(result.targets.map(target => target.locator), ["api/weather.js"]);
|
|
120
|
+
assert.equal(result.targets[0].kinds.includes("transport"), true);
|
|
121
|
+
assert.deepEqual(result.source_contracts.urls, ["https://api.example.test/weather"]);
|
|
122
|
+
assert.deepEqual(result.source_contracts.query_params, ["temperature_unit"]);
|
|
123
|
+
db.close();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test("caps contract targets and records the overflow instead of dropping it", () => {
|
|
127
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-cap-"));
|
|
128
|
+
write(root, "Main.kt", "class Main { fun run() {} }");
|
|
129
|
+
const nodes = [{ id: "m", file: "Main.kt" }];
|
|
130
|
+
const edges = [];
|
|
131
|
+
for (let i = 0; i < 5; i += 1) {
|
|
132
|
+
const locator = `Client${i}.kt`;
|
|
133
|
+
write(root, locator, `class Client${i} { val url = "https://api.test/${i}"; fun f(){ Request.Builder() } }`);
|
|
134
|
+
nodes.push({ id: `c${i}`, file: locator, kind: "class", name: `Client${i}` });
|
|
135
|
+
edges.push({ source: "m", target: `c${i}` });
|
|
136
|
+
}
|
|
137
|
+
const db = makeGraph(root, nodes, edges);
|
|
138
|
+
const result = collectContractCalls({
|
|
139
|
+
db,
|
|
140
|
+
sourceProject: root,
|
|
141
|
+
page: page(),
|
|
142
|
+
entry: {
|
|
143
|
+
resolvedFile: "Main.kt",
|
|
144
|
+
composition: new Set(),
|
|
145
|
+
bodyInheritance: new Set(),
|
|
146
|
+
directInheritance: new Set(),
|
|
147
|
+
origin_units: [],
|
|
148
|
+
},
|
|
149
|
+
maxTargets: 3,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
assert.equal(result.targets.length, 3);
|
|
153
|
+
assert.equal(result.omitted.length, 2);
|
|
154
|
+
assert.equal(result.dispositions.filter(item => item.disposition === "omitted").length, 2);
|
|
155
|
+
assert.equal(result.counts.kept + result.counts.omitted, 5);
|
|
156
|
+
db.close();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test("an unresolved call target is deferred, never silently dropped", () => {
|
|
160
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-unresolved-"));
|
|
161
|
+
write(root, "Main.kt", "class Main { fun run() { Missing().run() } }");
|
|
162
|
+
const db = makeGraph(root, [
|
|
163
|
+
{ id: "m", file: "Main.kt" },
|
|
164
|
+
{ id: "missing", file: null, kind: "class", name: "MissingClient" },
|
|
165
|
+
], [{ source: "m", target: "missing" }]);
|
|
166
|
+
|
|
167
|
+
const result = collectContractCalls({
|
|
168
|
+
db,
|
|
169
|
+
sourceProject: root,
|
|
170
|
+
page: page(),
|
|
171
|
+
entry: {
|
|
172
|
+
resolvedFile: "Main.kt",
|
|
173
|
+
composition: new Set(),
|
|
174
|
+
bodyInheritance: new Set(),
|
|
175
|
+
directInheritance: new Set(),
|
|
176
|
+
origin_units: [],
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
assert.equal(result.dispositions.length, 1);
|
|
181
|
+
assert.equal(result.dispositions[0].disposition, "deferred");
|
|
182
|
+
assert.equal(result.dispositions[0].reason, "unresolved-call-target");
|
|
183
|
+
db.close();
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test("a thin call wrapper is traversed so the real HTTP client is kept", () => {
|
|
187
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-wrapper-"));
|
|
188
|
+
write(root, "Main.kt", "class Main { fun run() { Repo().load() } }");
|
|
189
|
+
write(root, "Repo.kt", "class Repo { fun load() { WeatherClient().fetch() } }");
|
|
190
|
+
write(root, "WeatherClient.kt", "class WeatherClient { fun fetch() { OpenMeteoClient().fetch() } }");
|
|
191
|
+
write(root, "OpenMeteoClient.kt", `
|
|
192
|
+
class OpenMeteoClient {
|
|
193
|
+
fun fetch() {
|
|
194
|
+
Request.Builder().url("https://api.open-meteo.com/v1/forecast")
|
|
195
|
+
.addQueryParameter("temperature_unit", "celsius")
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
`);
|
|
199
|
+
const db = makeGraph(root, [
|
|
200
|
+
{ id: "m", file: "Main.kt" },
|
|
201
|
+
{ id: "r", file: "Repo.kt" },
|
|
202
|
+
{ id: "w", file: "WeatherClient.kt", kind: "class", name: "WeatherClient" },
|
|
203
|
+
{ id: "o", file: "OpenMeteoClient.kt", kind: "class", name: "OpenMeteoClient" },
|
|
204
|
+
], [
|
|
205
|
+
{ source: "m", target: "r" },
|
|
206
|
+
{ source: "r", target: "w" },
|
|
207
|
+
{ source: "w", target: "o" },
|
|
208
|
+
]);
|
|
209
|
+
|
|
210
|
+
const result = collectContractCalls({
|
|
211
|
+
db,
|
|
212
|
+
sourceProject: root,
|
|
213
|
+
page: page(),
|
|
214
|
+
entry: {
|
|
215
|
+
resolvedFile: "Main.kt",
|
|
216
|
+
composition: new Set(["Repo.kt"]),
|
|
217
|
+
bodyInheritance: new Set(),
|
|
218
|
+
directInheritance: new Set(),
|
|
219
|
+
origin_units: [],
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
assert.deepEqual(result.targets.map(target => target.locator), ["OpenMeteoClient.kt"]);
|
|
224
|
+
assert.equal(result.dispositions.find(item => item.locator === "WeatherClient.kt").disposition, "contract-path");
|
|
225
|
+
assert.deepEqual(result.source_contracts.query_params, ["temperature_unit"]);
|
|
226
|
+
db.close();
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("a URL inside a license comment is not a transport contract", () => {
|
|
230
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-comment-"));
|
|
231
|
+
write(root, "Main.kt", "class Main { fun run() { Util().noop() } }");
|
|
232
|
+
write(root, "Util.kt", `
|
|
233
|
+
// Licensed under http://www.apache.org/licenses/LICENSE-2.0
|
|
234
|
+
class Util { fun noop() {} }
|
|
235
|
+
`);
|
|
236
|
+
const db = makeGraph(root, [
|
|
237
|
+
{ id: "m", file: "Main.kt" },
|
|
238
|
+
{ id: "u", file: "Util.kt", kind: "class", name: "Util" },
|
|
239
|
+
], [{ source: "m", target: "u" }]);
|
|
240
|
+
|
|
241
|
+
const result = collectContractCalls({
|
|
242
|
+
db,
|
|
243
|
+
sourceProject: root,
|
|
244
|
+
page: page(),
|
|
245
|
+
entry: {
|
|
246
|
+
resolvedFile: "Main.kt",
|
|
247
|
+
composition: new Set(),
|
|
248
|
+
bodyInheritance: new Set(),
|
|
249
|
+
directInheritance: new Set(),
|
|
250
|
+
origin_units: [],
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
assert.deepEqual(result.targets, []);
|
|
255
|
+
assert.deepEqual(result.source_contracts.urls, []);
|
|
256
|
+
assert.equal(result.dispositions[0].disposition, "not-contract");
|
|
257
|
+
db.close();
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test("a dead-end wrapper stays deferred instead of disappearing", () => {
|
|
261
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-dead-end-"));
|
|
262
|
+
write(root, "Main.kt", "class Main { fun run() { WeatherClient().fetch() } }");
|
|
263
|
+
write(root, "WeatherClient.kt", "class WeatherClient { fun fetch() { Util().noop() } }");
|
|
264
|
+
write(root, "Util.kt", "class Util { fun noop() {} }");
|
|
265
|
+
const db = makeGraph(root, [
|
|
266
|
+
{ id: "m", file: "Main.kt" },
|
|
267
|
+
{ id: "w", file: "WeatherClient.kt", kind: "class", name: "WeatherClient" },
|
|
268
|
+
{ id: "u", file: "Util.kt", kind: "class", name: "Util" },
|
|
269
|
+
], [
|
|
270
|
+
{ source: "m", target: "w" },
|
|
271
|
+
{ source: "w", target: "u" },
|
|
272
|
+
]);
|
|
273
|
+
const result = collectContractCalls({
|
|
274
|
+
db,
|
|
275
|
+
sourceProject: root,
|
|
276
|
+
page: page(),
|
|
277
|
+
entry: {
|
|
278
|
+
resolvedFile: "Main.kt",
|
|
279
|
+
composition: new Set(),
|
|
280
|
+
bodyInheritance: new Set(),
|
|
281
|
+
directInheritance: new Set(),
|
|
282
|
+
origin_units: [],
|
|
283
|
+
},
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
assert.equal(result.targets.length, 0);
|
|
287
|
+
assert.equal(result.deferred.length, 1);
|
|
288
|
+
assert.equal(result.deferred[0].target, "WeatherClient.kt");
|
|
289
|
+
assert.equal(result.dispositions.find(item => item.locator === "WeatherClient.kt").disposition, "deferred");
|
|
290
|
+
db.close();
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
test("Vue template and style URLs are not transport contracts, but script URLs are", () => {
|
|
294
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-vue-url-"));
|
|
295
|
+
write(root, "pages/a.vue", `
|
|
296
|
+
<template><a href="https://shop.example.test/item">x</a></template>
|
|
297
|
+
<style>.bg { background: url("https://cdn.example.test/bg.png") }</style>
|
|
298
|
+
<script>const url = "https://api.example.test/weather"</script>
|
|
299
|
+
`);
|
|
300
|
+
const db = makeGraph(root, [
|
|
301
|
+
{ id: "p", file: "pages/a.vue" },
|
|
302
|
+
{ id: "t", file: "pages/target.js", kind: "function", name: "target" },
|
|
303
|
+
], [{ source: "p", target: "t" }]);
|
|
304
|
+
const result = collectContractCalls({
|
|
305
|
+
db,
|
|
306
|
+
sourceProject: root,
|
|
307
|
+
page: page(),
|
|
308
|
+
entry: {
|
|
309
|
+
resolvedFile: "pages/a.vue",
|
|
310
|
+
composition: new Set(),
|
|
311
|
+
bodyInheritance: new Set(),
|
|
312
|
+
directInheritance: new Set(),
|
|
313
|
+
origin_units: [],
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
assert.deepEqual(result.source_contracts.urls, ["https://api.example.test/weather"]);
|
|
317
|
+
db.close();
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
test("omitted targets still contribute their source contracts", () => {
|
|
321
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-omitted-contract-"));
|
|
322
|
+
write(root, "Main.kt", "class Main { fun run() {} }");
|
|
323
|
+
const nodes = [{ id: "m", file: "Main.kt" }];
|
|
324
|
+
const edges = [];
|
|
325
|
+
for (let i = 0; i < 3; i += 1) {
|
|
326
|
+
const locator = `Client${i}.kt`;
|
|
327
|
+
write(root, locator, `class Client${i} { val url = "https://api.test/${i}"; fun f(){ Request.Builder() } }`);
|
|
328
|
+
nodes.push({ id: `c${i}`, file: locator, kind: "class", name: `Client${i}` });
|
|
329
|
+
edges.push({ source: "m", target: `c${i}` });
|
|
330
|
+
}
|
|
331
|
+
const db = makeGraph(root, nodes, edges);
|
|
332
|
+
const result = collectContractCalls({
|
|
333
|
+
db,
|
|
334
|
+
sourceProject: root,
|
|
335
|
+
page: page(),
|
|
336
|
+
entry: {
|
|
337
|
+
resolvedFile: "Main.kt",
|
|
338
|
+
composition: new Set(),
|
|
339
|
+
bodyInheritance: new Set(),
|
|
340
|
+
directInheritance: new Set(),
|
|
341
|
+
origin_units: [],
|
|
342
|
+
},
|
|
343
|
+
maxTargets: 1,
|
|
344
|
+
});
|
|
345
|
+
assert.equal(result.targets.length, 1);
|
|
346
|
+
assert.equal(result.omitted.length, 2);
|
|
347
|
+
assert.equal(result.source_contracts.urls.length, 3);
|
|
348
|
+
db.close();
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
test("a file path outside the source root is never read", () => {
|
|
352
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-escape-"));
|
|
353
|
+
write(root, "Main.kt", "class Main { fun run() {} }");
|
|
354
|
+
fs.writeFileSync(path.join(root, "..", "secret.kt"), "class Secret { val url = \"https://leak.example/SECRET\" }");
|
|
355
|
+
const db = makeGraph(root, [
|
|
356
|
+
{ id: "m", file: "Main.kt" },
|
|
357
|
+
{ id: "s", file: "../secret.kt", kind: "class", name: "Secret" },
|
|
358
|
+
], [{ source: "m", target: "s" }]);
|
|
359
|
+
const result = collectContractCalls({
|
|
360
|
+
db,
|
|
361
|
+
sourceProject: root,
|
|
362
|
+
page: page(),
|
|
363
|
+
entry: {
|
|
364
|
+
resolvedFile: "Main.kt",
|
|
365
|
+
composition: new Set(),
|
|
366
|
+
bodyInheritance: new Set(),
|
|
367
|
+
directInheritance: new Set(),
|
|
368
|
+
origin_units: [],
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
assert.deepEqual(result.source_contracts.urls, []);
|
|
372
|
+
assert.equal(result.dispositions[0].disposition, "deferred");
|
|
373
|
+
db.close();
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
test("an odd filename never aborts classification", () => {
|
|
377
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-odd-name-"));
|
|
378
|
+
write(root, "Main.kt", "class Main { fun run() {} }");
|
|
379
|
+
write(root, "Foo(Adapter.kt", "class Foo { }");
|
|
380
|
+
const db = makeGraph(root, [
|
|
381
|
+
{ id: "m", file: "Main.kt" },
|
|
382
|
+
{ id: "f", file: "Foo(Adapter.kt" },
|
|
383
|
+
], [{ source: "m", target: "f" }]);
|
|
384
|
+
const result = collectContractCalls({
|
|
385
|
+
db,
|
|
386
|
+
sourceProject: root,
|
|
387
|
+
page: page(),
|
|
388
|
+
entry: {
|
|
389
|
+
resolvedFile: "Main.kt",
|
|
390
|
+
composition: new Set(),
|
|
391
|
+
bodyInheritance: new Set(),
|
|
392
|
+
directInheritance: new Set(),
|
|
393
|
+
origin_units: [],
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
assert.equal(Array.isArray(result.dispositions), true);
|
|
397
|
+
db.close();
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
test("a leaf *Request DTO is not a deferred contract gap", () => {
|
|
401
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-leaf-request-"));
|
|
402
|
+
write(root, "Main.kt", "class Main { fun run() { SubmitRequest().x() } }");
|
|
403
|
+
write(root, "SubmitRequest.kt", "class SubmitRequest { val id = 1 }");
|
|
404
|
+
const db = makeGraph(root, [
|
|
405
|
+
{ id: "m", file: "Main.kt" },
|
|
406
|
+
{ id: "r", file: "SubmitRequest.kt", kind: "class", name: "SubmitRequest" },
|
|
407
|
+
], [{ source: "m", target: "r" }]);
|
|
408
|
+
const result = collectContractCalls({
|
|
409
|
+
db,
|
|
410
|
+
sourceProject: root,
|
|
411
|
+
page: page(),
|
|
412
|
+
entry: {
|
|
413
|
+
resolvedFile: "Main.kt",
|
|
414
|
+
composition: new Set(),
|
|
415
|
+
bodyInheritance: new Set(),
|
|
416
|
+
directInheritance: new Set(),
|
|
417
|
+
origin_units: [],
|
|
418
|
+
},
|
|
419
|
+
});
|
|
420
|
+
assert.equal(result.deferred.length, 0);
|
|
421
|
+
assert.equal(result.dispositions[0].disposition, "not-contract");
|
|
422
|
+
assert.equal(result.dispositions[0].reason, "leaf-no-delegation");
|
|
423
|
+
db.close();
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
test("a symbol hint defers a delegator whose file stem carries no hint", () => {
|
|
427
|
+
// The callee node is `obtainWeatherClient` in `Factories.kt`: the symbol ends with Client,
|
|
428
|
+
// the file stem does not. Only a symbol check can classify it.
|
|
429
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-symbol-hint-"));
|
|
430
|
+
write(root, "Main.kt", "class Main { fun run() { Factory.obtainWeatherClient() } }");
|
|
431
|
+
write(root, "Factories.kt", "class Factories { fun obtainWeatherClient() { Leaf().go() } }");
|
|
432
|
+
write(root, "Leaf.kt", "class Leaf { fun go() = 1 }");
|
|
433
|
+
const db = makeGraph(root, [
|
|
434
|
+
{ id: "m", file: "Main.kt" },
|
|
435
|
+
{ id: "f", file: "Factories.kt", kind: "method", name: "obtainWeatherClient" },
|
|
436
|
+
{ id: "l", file: "Leaf.kt", kind: "method", name: "go" },
|
|
437
|
+
], [
|
|
438
|
+
{ source: "m", target: "f" },
|
|
439
|
+
{ source: "f", target: "l" },
|
|
440
|
+
]);
|
|
441
|
+
const result = collectContractCalls({
|
|
442
|
+
db,
|
|
443
|
+
sourceProject: root,
|
|
444
|
+
page: page(),
|
|
445
|
+
entry: {
|
|
446
|
+
resolvedFile: "Main.kt",
|
|
447
|
+
composition: new Set(),
|
|
448
|
+
bodyInheritance: new Set(),
|
|
449
|
+
directInheritance: new Set(),
|
|
450
|
+
origin_units: [],
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
assert.equal(result.deferred.length, 1, JSON.stringify(result.dispositions, null, 2));
|
|
454
|
+
assert.equal(result.deferred[0].reason, "contract-target-unclassified");
|
|
455
|
+
assert.equal(result.deferred[0].target_symbol, "obtainWeatherClient");
|
|
456
|
+
db.close();
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
test("an unhinted delegator is traversed to the real HTTP client", () => {
|
|
460
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-delegator-"));
|
|
461
|
+
write(root, "Main.kt", "class Main { fun run() { WeatherFactory().load() } }");
|
|
462
|
+
write(root, "util/WeatherFactory.kt", "class WeatherFactory { fun load() { OpenMeteoClient().fetch() } }");
|
|
463
|
+
write(root, "OpenMeteoClient.kt", "class OpenMeteoClient { val url = \"https://api.open-meteo.com/v1/forecast\"; fun f(){ Request.Builder() } }");
|
|
464
|
+
const db = makeGraph(root, [
|
|
465
|
+
{ id: "m", file: "Main.kt" },
|
|
466
|
+
{ id: "f", file: "util/WeatherFactory.kt", kind: "class", name: "WeatherFactory" },
|
|
467
|
+
{ id: "o", file: "OpenMeteoClient.kt", kind: "class", name: "OpenMeteoClient" },
|
|
468
|
+
], [
|
|
469
|
+
{ source: "m", target: "f" },
|
|
470
|
+
{ source: "f", target: "o" },
|
|
471
|
+
]);
|
|
472
|
+
const result = collectContractCalls({
|
|
473
|
+
db,
|
|
474
|
+
sourceProject: root,
|
|
475
|
+
page: page(),
|
|
476
|
+
entry: {
|
|
477
|
+
resolvedFile: "Main.kt",
|
|
478
|
+
composition: new Set(),
|
|
479
|
+
bodyInheritance: new Set(),
|
|
480
|
+
directInheritance: new Set(),
|
|
481
|
+
origin_units: [],
|
|
482
|
+
},
|
|
483
|
+
});
|
|
484
|
+
assert.deepEqual(result.targets.map(target => target.locator), ["OpenMeteoClient.kt"]);
|
|
485
|
+
assert.deepEqual(result.source_contracts.urls, ["https://api.open-meteo.com/v1/forecast"]);
|
|
486
|
+
db.close();
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
test("a strong transport signal keeps a URL-only API file", () => {
|
|
490
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-strong-transport-"));
|
|
491
|
+
write(root, "Main.kt", "class Main { fun run() { Api().load() } }");
|
|
492
|
+
write(root, "Api.kt", "interface Api { @GET(\"v1/forecast\") fun load() } val base = \"https://api.test\"");
|
|
493
|
+
const db = makeGraph(root, [
|
|
494
|
+
{ id: "m", file: "Main.kt" },
|
|
495
|
+
{ id: "a", file: "Api.kt", kind: "interface", name: "Api" },
|
|
496
|
+
], [{ source: "m", target: "a" }]);
|
|
497
|
+
const result = collectContractCalls({
|
|
498
|
+
db,
|
|
499
|
+
sourceProject: root,
|
|
500
|
+
page: page(),
|
|
501
|
+
entry: {
|
|
502
|
+
resolvedFile: "Main.kt",
|
|
503
|
+
composition: new Set(),
|
|
504
|
+
bodyInheritance: new Set(),
|
|
505
|
+
directInheritance: new Set(),
|
|
506
|
+
origin_units: [],
|
|
507
|
+
},
|
|
508
|
+
});
|
|
509
|
+
assert.equal(result.targets[0].locator, "Api.kt");
|
|
510
|
+
assert.ok(result.targets[0].signals.includes("retrofit-annotation"));
|
|
511
|
+
db.close();
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
test("a template-only Vue SFC never invents a transport URL", () => {
|
|
515
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-vue-template-only-"));
|
|
516
|
+
write(root, "pages/a.vue", `<template><image src="https://cdn.test/banner.png" /></template>`);
|
|
517
|
+
const db = makeGraph(root, [{ id: "p", file: "pages/a.vue" }], []);
|
|
518
|
+
const result = collectContractCalls({
|
|
519
|
+
db,
|
|
520
|
+
sourceProject: root,
|
|
521
|
+
page: page(),
|
|
522
|
+
entry: {
|
|
523
|
+
resolvedFile: "pages/a.vue",
|
|
524
|
+
composition: new Set(),
|
|
525
|
+
bodyInheritance: new Set(),
|
|
526
|
+
directInheritance: new Set(),
|
|
527
|
+
origin_units: [],
|
|
528
|
+
},
|
|
529
|
+
});
|
|
530
|
+
assert.deepEqual(result.source_contracts.urls, []);
|
|
531
|
+
db.close();
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
test("NULL line/column edges keep distinct callees and stable digests", () => {
|
|
535
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-null-lines-"));
|
|
536
|
+
write(root, "Main.kt", "class Main { fun run() {} }");
|
|
537
|
+
write(root, "Cli.kt", "class AClient; class BClient; val url = \"https://api.test\"; fun f(){ Request.Builder() }");
|
|
538
|
+
const nodes = [
|
|
539
|
+
{ id: "m", file: "Main.kt" },
|
|
540
|
+
{ id: "a", file: "Cli.kt", kind: "class", name: "AClient" },
|
|
541
|
+
{ id: "b", file: "Cli.kt", kind: "class", name: "BClient" },
|
|
542
|
+
];
|
|
543
|
+
const run = (edges) => {
|
|
544
|
+
const db = makeGraph(root, nodes, edges);
|
|
545
|
+
const result = collectContractCalls({
|
|
546
|
+
db,
|
|
547
|
+
sourceProject: root,
|
|
548
|
+
page: page(),
|
|
549
|
+
entry: {
|
|
550
|
+
resolvedFile: "Main.kt",
|
|
551
|
+
composition: new Set(),
|
|
552
|
+
bodyInheritance: new Set(),
|
|
553
|
+
directInheritance: new Set(),
|
|
554
|
+
origin_units: [],
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
db.close();
|
|
558
|
+
return result;
|
|
559
|
+
};
|
|
560
|
+
const forward = run([{ source: "m", target: "a" }, { source: "m", target: "b" }]);
|
|
561
|
+
const reverse = run([{ source: "m", target: "b" }, { source: "m", target: "a" }]);
|
|
562
|
+
assert.deepEqual(forward.calls.map(call => call.target_symbol).sort(), ["AClient", "BClient"]);
|
|
563
|
+
assert.equal(forward.digest, reverse.digest);
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
test("the inventory digest is independent of edge insertion order", () => {
|
|
567
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-edge-order-"));
|
|
568
|
+
write(root, "Main.kt", "class Main { fun run() {} }");
|
|
569
|
+
write(root, "A.kt", "class A { val url = \"https://a.test\"; fun f(){ Request.Builder() } }");
|
|
570
|
+
write(root, "B.kt", "class B { val url = \"https://b.test\"; fun f(){ Request.Builder() } }");
|
|
571
|
+
const nodes = [
|
|
572
|
+
{ id: "m", file: "Main.kt" },
|
|
573
|
+
{ id: "a", file: "A.kt", kind: "class", name: "A" },
|
|
574
|
+
{ id: "b", file: "B.kt", kind: "class", name: "B" },
|
|
575
|
+
];
|
|
576
|
+
const make = (edges) => {
|
|
577
|
+
const db = makeGraph(root, nodes, edges);
|
|
578
|
+
const result = collectContractCalls({
|
|
579
|
+
db,
|
|
580
|
+
sourceProject: root,
|
|
581
|
+
page: page(),
|
|
582
|
+
entry: {
|
|
583
|
+
resolvedFile: "Main.kt",
|
|
584
|
+
composition: new Set(),
|
|
585
|
+
bodyInheritance: new Set(),
|
|
586
|
+
directInheritance: new Set(),
|
|
587
|
+
origin_units: [],
|
|
588
|
+
},
|
|
589
|
+
});
|
|
590
|
+
db.close();
|
|
591
|
+
return result.digest;
|
|
592
|
+
};
|
|
593
|
+
assert.equal(
|
|
594
|
+
make([{ source: "m", target: "a", line: 10 }, { source: "m", target: "b", line: 20 }]),
|
|
595
|
+
make([{ source: "m", target: "b", line: 20 }, { source: "m", target: "a", line: 10 }]),
|
|
596
|
+
);
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
test("a Compose function named like a dialog is UI, not a deferred gap", () => {
|
|
600
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-compose-dialog-"));
|
|
601
|
+
write(root, "Main.kt", "class Main { fun run() { BottomSheetDialog() } }");
|
|
602
|
+
write(root, "BottomSheetDialog.kt", "@Composable fun BottomSheetDialog() { Text(\"x\") }");
|
|
603
|
+
const db = makeGraph(root, [
|
|
604
|
+
{ id: "m", file: "Main.kt" },
|
|
605
|
+
{ id: "d", file: "BottomSheetDialog.kt", kind: "function", name: "BottomSheetDialog" },
|
|
606
|
+
], [{ source: "m", target: "d" }]);
|
|
607
|
+
const result = collectContractCalls({
|
|
608
|
+
db,
|
|
609
|
+
sourceProject: root,
|
|
610
|
+
page: page(),
|
|
611
|
+
entry: {
|
|
612
|
+
resolvedFile: "Main.kt",
|
|
613
|
+
composition: new Set(),
|
|
614
|
+
bodyInheritance: new Set(),
|
|
615
|
+
directInheritance: new Set(),
|
|
616
|
+
origin_units: [],
|
|
617
|
+
},
|
|
618
|
+
});
|
|
619
|
+
assert.equal(result.deferred.length, 0);
|
|
620
|
+
assert.equal(result.targets[0].locator, "BottomSheetDialog.kt");
|
|
621
|
+
assert.ok(result.targets[0].kinds.includes("ui-construction"));
|
|
622
|
+
db.close();
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
test("a contract beyond the traversal bound is deferred, not silently lost", () => {
|
|
626
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-depth-"));
|
|
627
|
+
write(root, "Main.kt", "class Main { fun run() { Transport().go() } }");
|
|
628
|
+
write(root, "network/Transport.kt", "class Transport { fun go() { Deep().go() } }");
|
|
629
|
+
write(root, "network/Deep.kt", "class Deep { fun go() { Deeper().go() } }");
|
|
630
|
+
write(root, "network/Deeper.kt", "class Deeper { fun go() { Real().go() } }");
|
|
631
|
+
write(root, "network/Real.kt", "class Real { val url = \"https://api.real.test/x\"; fun f(){ Request.Builder() } }");
|
|
632
|
+
const db = makeGraph(root, [
|
|
633
|
+
{ id: "m", file: "Main.kt" },
|
|
634
|
+
{ id: "t", file: "network/Transport.kt", kind: "class", name: "Transport" },
|
|
635
|
+
{ id: "d", file: "network/Deep.kt", kind: "class", name: "Deep" },
|
|
636
|
+
{ id: "d2", file: "network/Deeper.kt", kind: "class", name: "Deeper" },
|
|
637
|
+
{ id: "r", file: "network/Real.kt", kind: "class", name: "Real" },
|
|
638
|
+
], [
|
|
639
|
+
{ source: "m", target: "t" },
|
|
640
|
+
{ source: "t", target: "d" },
|
|
641
|
+
{ source: "d", target: "d2" },
|
|
642
|
+
{ source: "d2", target: "r" },
|
|
643
|
+
]);
|
|
644
|
+
const result = collectContractCalls({
|
|
645
|
+
db,
|
|
646
|
+
sourceProject: root,
|
|
647
|
+
page: page(),
|
|
648
|
+
entry: {
|
|
649
|
+
resolvedFile: "Main.kt",
|
|
650
|
+
composition: new Set(),
|
|
651
|
+
bodyInheritance: new Set(),
|
|
652
|
+
directInheritance: new Set(),
|
|
653
|
+
origin_units: [],
|
|
654
|
+
},
|
|
655
|
+
});
|
|
656
|
+
assert.equal(result.targets.length, 0);
|
|
657
|
+
assert.equal(result.deferred.length, 1);
|
|
658
|
+
assert.equal(result.deferred[0].reason, "traversal-depth-limit");
|
|
659
|
+
db.close();
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
test("progress propagates through an indirect wrapper chain", () => {
|
|
663
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-indirect-"));
|
|
664
|
+
write(root, "Main.kt", "class Main { fun run() { WeatherClient().load() } }");
|
|
665
|
+
write(root, "WeatherClient.kt", "class WeatherClient { fun load() { Factory().create() } }");
|
|
666
|
+
write(root, "data/Factory.kt", "class Factory { fun create() { Real().go() } }");
|
|
667
|
+
write(root, "data/Real.kt", "class Real { val url = \"https://api.real.test/x\"; fun f(){ Request.Builder() } }");
|
|
668
|
+
const db = makeGraph(root, [
|
|
669
|
+
{ id: "m", file: "Main.kt" },
|
|
670
|
+
{ id: "c", file: "WeatherClient.kt", kind: "class", name: "WeatherClient" },
|
|
671
|
+
{ id: "f", file: "data/Factory.kt", kind: "class", name: "Factory" },
|
|
672
|
+
{ id: "r", file: "data/Real.kt", kind: "class", name: "Real" },
|
|
673
|
+
], [
|
|
674
|
+
{ source: "m", target: "c" },
|
|
675
|
+
{ source: "c", target: "f" },
|
|
676
|
+
{ source: "f", target: "r" },
|
|
677
|
+
]);
|
|
678
|
+
const result = collectContractCalls({
|
|
679
|
+
db,
|
|
680
|
+
sourceProject: root,
|
|
681
|
+
page: page(),
|
|
682
|
+
entry: {
|
|
683
|
+
resolvedFile: "Main.kt",
|
|
684
|
+
composition: new Set(),
|
|
685
|
+
bodyInheritance: new Set(),
|
|
686
|
+
directInheritance: new Set(),
|
|
687
|
+
origin_units: [],
|
|
688
|
+
},
|
|
689
|
+
});
|
|
690
|
+
assert.deepEqual(result.targets.map(target => target.locator), ["data/Real.kt"]);
|
|
691
|
+
assert.equal(result.deferred.length, 0);
|
|
692
|
+
assert.equal(result.dispositions.find(item => item.locator === "WeatherClient.kt").disposition, "contract-path");
|
|
693
|
+
db.close();
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
test("each strong transport family keeps transport without a bare URL", () => {
|
|
697
|
+
const cases = [
|
|
698
|
+
["JsonObjectRequest req = new JsonObjectRequest(url, null, listener, error)", "Transport.kt"],
|
|
699
|
+
["val client = HttpClient(); client.get(url)", "Transport.kt"],
|
|
700
|
+
["$http.get(url, { params })", "Transport.js"],
|
|
701
|
+
["uniCloud.callFunction({ name: 'weather' })", "Transport.js"],
|
|
702
|
+
["@GET(\"v1/forecast\") fun load()", "Transport.kt"],
|
|
703
|
+
];
|
|
704
|
+
for (const [code, locator] of cases) {
|
|
705
|
+
const result = classifyContractSignals(code, locator);
|
|
706
|
+
assert.ok(result.kinds.includes("transport"), code);
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
test("the inventory digest is independent of scope order", () => {
|
|
711
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "contract-calls-order-"));
|
|
712
|
+
write(root, "Main.kt", "class Main { fun run() {} }");
|
|
713
|
+
write(root, "A.kt", "class A { val url = \"https://a.test\"; fun f(){ Request.Builder() } }");
|
|
714
|
+
write(root, "B.kt", "class B { val url = \"https://b.test\"; fun f(){ Request.Builder() } }");
|
|
715
|
+
const db = makeGraph(root, [
|
|
716
|
+
{ id: "m", file: "Main.kt" },
|
|
717
|
+
{ id: "a", file: "A.kt", kind: "class", name: "A" },
|
|
718
|
+
{ id: "b", file: "B.kt", kind: "class", name: "B" },
|
|
719
|
+
], [
|
|
720
|
+
{ source: "m", target: "a" },
|
|
721
|
+
{ source: "m", target: "b" },
|
|
722
|
+
]);
|
|
723
|
+
const make = (composition) => collectContractCalls({
|
|
724
|
+
db,
|
|
725
|
+
sourceProject: root,
|
|
726
|
+
page: page(),
|
|
727
|
+
entry: {
|
|
728
|
+
resolvedFile: "Main.kt",
|
|
729
|
+
composition: new Set(composition),
|
|
730
|
+
bodyInheritance: new Set(),
|
|
731
|
+
directInheritance: new Set(),
|
|
732
|
+
origin_units: [],
|
|
733
|
+
},
|
|
734
|
+
});
|
|
735
|
+
assert.equal(make(["A.kt", "B.kt"]).digest, make(["B.kt", "A.kt"]).digest);
|
|
736
|
+
db.close();
|
|
737
|
+
});
|