@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
|
@@ -31,6 +31,18 @@ writeFileSync(MAP_FILE, JSON.stringify({
|
|
|
31
31
|
module: '@kit.CameraKit',
|
|
32
32
|
permissions: [{ name: 'ohos.permission.CAMERA', since: 9, level: 'normal', grant: 'user_grant' }],
|
|
33
33
|
},
|
|
34
|
+
{
|
|
35
|
+
id: 'ohos-pasteboard',
|
|
36
|
+
module: '@ohos.pasteboard',
|
|
37
|
+
permissions: [
|
|
38
|
+
{ name: 'ohos.permission.READ_PASTEBOARD', since: 11, level: 'system_basic', grant: 'user_grant', restricted: true },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'ohos-telephony-call',
|
|
43
|
+
module: '@ohos.telephony.call',
|
|
44
|
+
permissions: [{ name: 'ohos.permission.PLACE_CALL', since: null, level: 'system_basic', grant: 'system_only', restricted: true }],
|
|
45
|
+
},
|
|
34
46
|
],
|
|
35
47
|
}), 'utf8');
|
|
36
48
|
process.env.HOMETRANS_API_PERMISSION_MAP = MAP_FILE;
|
|
@@ -98,6 +110,31 @@ function runCheck(root: string, scene: FakeSceneFile[]) {
|
|
|
98
110
|
return checker.issues;
|
|
99
111
|
}
|
|
100
112
|
|
|
113
|
+
/** Run `fn` against the shipped map, restoring any override afterwards. */
|
|
114
|
+
function withShippedMap<T>(fn: () => T): T {
|
|
115
|
+
const previous = process.env.HOMETRANS_API_PERMISSION_MAP;
|
|
116
|
+
process.env.HOMETRANS_API_PERMISSION_MAP = path.join(RULES_DIR, 'data', 'api-permission-map.json');
|
|
117
|
+
try {
|
|
118
|
+
return fn();
|
|
119
|
+
} finally {
|
|
120
|
+
if (previous === undefined) delete process.env.HOMETRANS_API_PERMISSION_MAP;
|
|
121
|
+
else process.env.HOMETRANS_API_PERMISSION_MAP = previous;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Findings for a one-page project whose only import is `spec`. */
|
|
126
|
+
function findingsFor(t: TestContext, spec: string) {
|
|
127
|
+
return withShippedMap(() => {
|
|
128
|
+
const file = 'entry/src/main/ets/pages/Module.ets';
|
|
129
|
+
const root = project(t, hapOnly([], { [file]: `import '${spec}';\n` }));
|
|
130
|
+
return runCheck(root, [{ file, imports: [{ spec, line: 1 }] }]);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function permissionNames(issues: Array<{ message: { en: string } }>): string[] {
|
|
135
|
+
return issues.map((issue) => /ohos\.permission\.[\w.]+/.exec(issue.message.en)?.[0] ?? '');
|
|
136
|
+
}
|
|
137
|
+
|
|
101
138
|
/** HAP whose pages import a sibling HAR that uses @kit.NetworkKit. */
|
|
102
139
|
function hapAndHar(entryPerms: string[], harPerms: string[] = []): Record<string, string> {
|
|
103
140
|
return {
|
|
@@ -151,6 +188,8 @@ test('reports a missing permission on the entry HAP, not on the HAR module.json5
|
|
|
151
188
|
assert.equal(issues.length, 1);
|
|
152
189
|
const issue = issues[0];
|
|
153
190
|
assert.match(issue.filePath.replace(/\\/g, '/'), /common\/networklib\/src\/main\/ets\/NetworkClient\.ets$/);
|
|
191
|
+
assert.match(issue.message.en, /may require permission ohos\.permission\.INTERNET/);
|
|
192
|
+
assert.match(issue.message.cn, /可能需要权限 ohos\.permission\.INTERNET/);
|
|
154
193
|
assert.match(issue.message.en, /entry\/src\/main\/module\.json5/);
|
|
155
194
|
assert.doesNotMatch(issue.message.en, /networklib\/src\/main\/module\.json5/);
|
|
156
195
|
assert.equal(issue.line, 1);
|
|
@@ -271,6 +310,253 @@ test('fallback parser still finds a real import in a non-scene file', (t) => {
|
|
|
271
310
|
assert.match(issues[0].filePath.replace(/\\/g, '/'), /shared\/Real\.ets$/);
|
|
272
311
|
});
|
|
273
312
|
|
|
313
|
+
// A restricted entry must point the reader at the signing profile: declaring it
|
|
314
|
+
// in module.json5 alone drops the permission or fails the install.
|
|
315
|
+
test('restricted permission finding mentions the signing profile ACL', (t) => {
|
|
316
|
+
const root = project(t, hapOnly([], {
|
|
317
|
+
'entry/src/main/ets/pages/Paste.ets': "import { pasteboard } from '@ohos.pasteboard';\n",
|
|
318
|
+
}));
|
|
319
|
+
const issues = runCheck(root, [{
|
|
320
|
+
file: 'entry/src/main/ets/pages/Paste.ets',
|
|
321
|
+
imports: [{ spec: '@ohos.pasteboard', line: 1 }],
|
|
322
|
+
}]);
|
|
323
|
+
assert.equal(issues.length, 1);
|
|
324
|
+
assert.match(issues[0].message.en, /signing configuration/);
|
|
325
|
+
assert.match(issues[0].message.en, /installation can fail/);
|
|
326
|
+
assert.match(issues[0].message.cn, /签名配置/);
|
|
327
|
+
assert.match(issues[0].message.cn, /安装失败/);
|
|
328
|
+
// An ACL row must point at the permission-free route before the gate is
|
|
329
|
+
// tempted to declare it.
|
|
330
|
+
assert.match(issues[0].message.en, /Picker or a security component/);
|
|
331
|
+
assert.match(issues[0].message.cn, /Picker 或安全控件/);
|
|
332
|
+
// An ACL user_grant permission gets both notes, install risk first.
|
|
333
|
+
const en = issues[0].message.en;
|
|
334
|
+
assert.match(en, /requestPermissionsFromUser/);
|
|
335
|
+
assert.ok(en.indexOf('signing configuration') < en.indexOf('requestPermissionsFromUser'), en);
|
|
336
|
+
const cn = issues[0].message.cn;
|
|
337
|
+
assert.match(cn, /用户确认弹窗/);
|
|
338
|
+
assert.ok(cn.indexOf('签名配置') < cn.indexOf('requestPermissionsFromUser'), cn);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
// system-only is a different failure mode from ACL: no signature trick helps,
|
|
342
|
+
// so the finding must send the reader to a permission-free alternative.
|
|
343
|
+
test('system-only permission finding points at a permission-free alternative', (t) => {
|
|
344
|
+
const root = project(t, hapOnly([], {
|
|
345
|
+
'entry/src/main/ets/pages/Call.ets': "import { call } from '@ohos.telephony.call';\n",
|
|
346
|
+
}));
|
|
347
|
+
const issues = runCheck(root, [{
|
|
348
|
+
file: 'entry/src/main/ets/pages/Call.ets',
|
|
349
|
+
imports: [{ spec: '@ohos.telephony.call', line: 1 }],
|
|
350
|
+
}]);
|
|
351
|
+
assert.equal(issues.length, 1);
|
|
352
|
+
assert.match(issues[0].message.en, /System-only permission/);
|
|
353
|
+
assert.doesNotMatch(issues[0].message.en, /signing configuration/);
|
|
354
|
+
assert.match(issues[0].message.cn, /系统应用专属权限/);
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// A user_grant permission also needs a runtime request, which is what shows the
|
|
358
|
+
// confirmation dialog, so the finding must point at that call.
|
|
359
|
+
test('user_grant permission finding mentions the runtime request dialog', (t) => {
|
|
360
|
+
const root = project(t, hapOnly([], {
|
|
361
|
+
'entry/src/main/ets/pages/Camera.ets': "import { camera } from '@kit.CameraKit';\n",
|
|
362
|
+
}));
|
|
363
|
+
const issues = runCheck(root, [{
|
|
364
|
+
file: 'entry/src/main/ets/pages/Camera.ets',
|
|
365
|
+
imports: [{ spec: '@kit.CameraKit', line: 1 }],
|
|
366
|
+
}]);
|
|
367
|
+
assert.equal(issues.length, 1);
|
|
368
|
+
assert.match(issues[0].message.en, /requestPermissionsFromUser/);
|
|
369
|
+
assert.match(issues[0].message.cn, /requestPermissionsFromUser/);
|
|
370
|
+
assert.match(issues[0].message.cn, /用户确认弹窗/);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
test('a system_grant permission finding carries no extra hint', (t) => {
|
|
374
|
+
const root = project(t, hapOnly([], {
|
|
375
|
+
'entry/src/main/ets/pages/Network.ets': "import { http } from '@kit.NetworkKit';\n",
|
|
376
|
+
}));
|
|
377
|
+
const issues = runCheck(root, [{
|
|
378
|
+
file: 'entry/src/main/ets/pages/Network.ets',
|
|
379
|
+
imports: [{ spec: '@kit.NetworkKit', line: 1 }],
|
|
380
|
+
}]);
|
|
381
|
+
assert.equal(issues.length, 1);
|
|
382
|
+
assert.doesNotMatch(issues[0].message.en, /signing configuration|System-only|requestPermissionsFromUser/);
|
|
383
|
+
assert.doesNotMatch(issues[0].message.cn, /签名配置|系统应用专属|requestPermissionsFromUser/);
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// Regression guard for the shipped map: a typical multi-page project
|
|
387
|
+
// (ArkUI + AbilityKit + NetworkKit) must not drown the gate in Kit-level noise.
|
|
388
|
+
// Base kits are excluded from the map, so only NetworkKit's actionable
|
|
389
|
+
// permissions may be reported.
|
|
390
|
+
test('a typical multi-page project stays within a small warning budget', (t) => {
|
|
391
|
+
withShippedMap(() => {
|
|
392
|
+
const pages = Array.from({ length: 5 }, (_, i) => `entry/src/main/ets/pages/Page${i}.ets`);
|
|
393
|
+
const extra: Record<string, string> = {
|
|
394
|
+
'entry/src/main/ets/entryability/EntryAbility.ets': "import { UIAbility } from '@kit.AbilityKit';\n",
|
|
395
|
+
};
|
|
396
|
+
for (const page of pages) {
|
|
397
|
+
extra[page] = "import { promptAction, router } from '@kit.ArkUI';\nimport { http } from '@kit.NetworkKit';\n";
|
|
398
|
+
}
|
|
399
|
+
const root = project(t, hapOnly([], extra));
|
|
400
|
+
const issues = runCheck(root, [
|
|
401
|
+
...pages.map((page) => ({
|
|
402
|
+
file: page,
|
|
403
|
+
imports: [
|
|
404
|
+
{ spec: '@kit.ArkUI', line: 1 },
|
|
405
|
+
{ spec: '@kit.NetworkKit', line: 2 },
|
|
406
|
+
],
|
|
407
|
+
})),
|
|
408
|
+
{
|
|
409
|
+
file: 'entry/src/main/ets/entryability/EntryAbility.ets',
|
|
410
|
+
imports: [{ spec: '@kit.AbilityKit', line: 1 }],
|
|
411
|
+
},
|
|
412
|
+
]);
|
|
413
|
+
assert.ok(
|
|
414
|
+
issues.length <= pages.length * 2,
|
|
415
|
+
`expected at most ${pages.length * 2} findings, got ${issues.length}`,
|
|
416
|
+
);
|
|
417
|
+
// Base Kit imports must never produce a finding.
|
|
418
|
+
assert.ok(issues.every((issue) => issue.line === 2), 'a base Kit import produced a finding');
|
|
419
|
+
assert.deepEqual([...new Set(permissionNames(issues))].sort(), [
|
|
420
|
+
'ohos.permission.GET_NETWORK_INFO',
|
|
421
|
+
'ohos.permission.INTERNET',
|
|
422
|
+
]);
|
|
423
|
+
// No page may absorb the whole budget while another stays silent.
|
|
424
|
+
for (const page of pages) {
|
|
425
|
+
const own = issues.filter((issue) => issue.filePath.replace(/\\/g, '/').endsWith(page));
|
|
426
|
+
assert.ok(own.length <= 2, `${page} produced ${own.length} findings`);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
// @kit.ArkWeb and @ohos.web.webview carried the whole Kit table's media/location
|
|
432
|
+
// rows, so a page with a Web component used to report camera, microphone and
|
|
433
|
+
// background location. Those are cross-domain rows, not Web requirements.
|
|
434
|
+
test('a Web page reports neither camera, microphone nor location permissions', (t) => {
|
|
435
|
+
withShippedMap(() => {
|
|
436
|
+
const files: Record<string, string> = {
|
|
437
|
+
'entry/src/main/ets/pages/WebKit.ets': "import { webview } from '@kit.ArkWeb';\n",
|
|
438
|
+
'entry/src/main/ets/pages/WebOhos.ets': "import { webview } from '@ohos.web.webview';\n",
|
|
439
|
+
};
|
|
440
|
+
const root = project(t, hapOnly([], files));
|
|
441
|
+
const issues = runCheck(root, [
|
|
442
|
+
{ file: 'entry/src/main/ets/pages/WebKit.ets', imports: [{ spec: '@kit.ArkWeb', line: 1 }] },
|
|
443
|
+
{ file: 'entry/src/main/ets/pages/WebOhos.ets', imports: [{ spec: '@ohos.web.webview', line: 1 }] },
|
|
444
|
+
]);
|
|
445
|
+
assert.equal(issues.length, 4, 'each Web page should report INTERNET + GET_NETWORK_INFO');
|
|
446
|
+
const names = permissionNames(issues);
|
|
447
|
+
assert.deepEqual([...new Set(names)].sort(), [
|
|
448
|
+
'ohos.permission.GET_NETWORK_INFO',
|
|
449
|
+
'ohos.permission.INTERNET',
|
|
450
|
+
]);
|
|
451
|
+
for (const name of names) {
|
|
452
|
+
assert.doesNotMatch(name, /LOCATION|CAMERA|MICROPHONE/, name);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
// Sandbox file IO needs no permission: the public-directory rows are PC/2in1
|
|
458
|
+
// only and live on @ohos.file.environment, the one module that actually exposes
|
|
459
|
+
// those directories. A Kit this common must not push readers into requesting
|
|
460
|
+
// a 2in1 permission (or an ACL) just for `fileIo`.
|
|
461
|
+
test('sandbox file imports report no permission', (t) => {
|
|
462
|
+
withShippedMap(() => {
|
|
463
|
+
assert.equal(findingsFor(t, '@kit.CoreFileKit').length, 0, '@kit.CoreFileKit should be silent');
|
|
464
|
+
assert.equal(findingsFor(t, '@ohos.file.fs').length, 0, '@ohos.file.fs should be silent');
|
|
465
|
+
|
|
466
|
+
const environment = findingsFor(t, '@ohos.file.environment');
|
|
467
|
+
assert.equal(environment.length, 2, 'the directory entry keeps its two rows');
|
|
468
|
+
for (const issue of environment) {
|
|
469
|
+
assert.doesNotMatch(
|
|
470
|
+
issue.message.en,
|
|
471
|
+
/Restricted \(ACL\)|FILE_ACCESS_PERSIST|DISTRIBUTED_DATASYNC|DESKTOP_DIRECTORY/,
|
|
472
|
+
issue.message.en,
|
|
473
|
+
);
|
|
474
|
+
assert.doesNotMatch(issue.message.cn, /签名配置/, issue.message.cn);
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
// High-frequency modules must not inherit another domain's rows from the Kit
|
|
480
|
+
// table: subscribing to a common event is not a location/bluetooth/wifi need,
|
|
481
|
+
// playing a video is not a camera need, and a background task is not background
|
|
482
|
+
// location. Direct @ohos.* imports keep their own dedicated entries.
|
|
483
|
+
test('common modules do not report cross-domain permissions', (t) => {
|
|
484
|
+
const cases = [
|
|
485
|
+
{ spec: '@ohos.commonEventManager', forbidden: /LOCATION|BLUETOOTH|WIFI|QUERY_VOLUME_ENCRYPTION_STATUS/ },
|
|
486
|
+
{ spec: '@ohos.commonEvent', forbidden: /LOCATION|BLUETOOTH|WIFI/ },
|
|
487
|
+
{ spec: '@kit.AudioKit', forbidden: /LOCATION|CAMERA|BLUETOOTH|VIBRATE|ACCESS_NOTIFICATION_POLICY/ },
|
|
488
|
+
{ spec: '@ohos.multimedia.audio', forbidden: /LOCATION|CAMERA|BLUETOOTH|VIBRATE|ACCESS_NOTIFICATION_POLICY/ },
|
|
489
|
+
{ spec: '@kit.MediaKit', forbidden: /LOCATION|CAMERA|MICROPHONE|READ_MEDIA/ },
|
|
490
|
+
{ spec: '@ohos.multimedia.media', forbidden: /LOCATION|CAMERA|MICROPHONE|READ_MEDIA/ },
|
|
491
|
+
{ spec: '@kit.BackgroundTasksKit', forbidden: /LOCATION/ },
|
|
492
|
+
{ spec: '@kit.ConnectivityKit', forbidden: /LOCATION|NFC|WIFI/ },
|
|
493
|
+
{ spec: '@kit.TelephonyKit', forbidden: /CONTACTS/ },
|
|
494
|
+
{ spec: '@kit.CalendarKit', forbidden: /WHOLE_CALENDAR/ },
|
|
495
|
+
{ spec: '@ohos.calendarManager', forbidden: /WHOLE_CALENDAR/ },
|
|
496
|
+
// BLE / socket are not the whole ConnectivityKit: no NearLink or legacy
|
|
497
|
+
// DISCOVER/USE bluetooth rows may leak through an alias.
|
|
498
|
+
{ spec: '@ohos.bluetooth.ble', forbidden: /NEARLINK|DISCOVER_BLUETOOTH|USE_BLUETOOTH/ },
|
|
499
|
+
{ spec: '@ohos.bluetooth.socket', forbidden: /NEARLINK|DISCOVER_BLUETOOTH|USE_BLUETOOTH/ },
|
|
500
|
+
];
|
|
501
|
+
for (const { spec, forbidden } of cases) {
|
|
502
|
+
const issues = findingsFor(t, spec);
|
|
503
|
+
assert.ok(issues.length > 0, `${spec} should still report a permission`);
|
|
504
|
+
assert.ok(issues.length <= 4, `${spec} produced ${issues.length} findings`);
|
|
505
|
+
for (const name of permissionNames(issues)) {
|
|
506
|
+
assert.doesNotMatch(name, forbidden, `${spec} reported ${name}`);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
// PushKit's only row was background location; the dedicated location-push
|
|
510
|
+
// module keeps it, so a plain push import must report nothing.
|
|
511
|
+
assert.equal(findingsFor(t, '@kit.PushKit').length, 0, '@kit.PushKit should report no permission');
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
// The shipped map is hand-maintained data consumed at runtime: a typo (an
|
|
515
|
+
// unknown level, a duplicate specifier, an unsorted entry) silently disables or
|
|
516
|
+
// misattributes findings, so guard its shape here.
|
|
517
|
+
test('the shipped permission map is well formed', () => {
|
|
518
|
+
const data = JSON.parse(readFileSync(path.join(RULES_DIR, 'data', 'api-permission-map.json'), 'utf8'));
|
|
519
|
+
assert.equal(typeof data.version, 'string');
|
|
520
|
+
assert.ok(Array.isArray(data.entries) && data.entries.length > 0);
|
|
521
|
+
const specifiers = new Set<string>();
|
|
522
|
+
const ids = new Set<string>();
|
|
523
|
+
let previousModule = '';
|
|
524
|
+
for (const entry of data.entries) {
|
|
525
|
+
assert.equal(typeof entry.id, 'string', 'entry.id');
|
|
526
|
+
assert.ok(!ids.has(entry.id), `duplicate entry id: ${entry.id}`);
|
|
527
|
+
ids.add(entry.id);
|
|
528
|
+
assert.equal(typeof entry.module, 'string', `entry.module for ${entry.id}`);
|
|
529
|
+
assert.ok(entry.module >= previousModule, `entries must stay sorted by module (${entry.module})`);
|
|
530
|
+
previousModule = entry.module;
|
|
531
|
+
const specs = [entry.module, ...(Array.isArray(entry.aliases) ? entry.aliases : [])];
|
|
532
|
+
for (const spec of specs) {
|
|
533
|
+
assert.ok(!specifiers.has(spec), `duplicate specifier: ${spec}`);
|
|
534
|
+
specifiers.add(spec);
|
|
535
|
+
}
|
|
536
|
+
assert.ok(Array.isArray(entry.permissions) && entry.permissions.length > 0, `permissions for ${entry.id}`);
|
|
537
|
+
let previousPermission = '';
|
|
538
|
+
for (const permission of entry.permissions) {
|
|
539
|
+
assert.match(permission.name, /^ohos\.permission\./, `${entry.id} permission name`);
|
|
540
|
+
assert.ok(
|
|
541
|
+
permission.name > previousPermission,
|
|
542
|
+
`permissions for ${entry.id} must stay sorted by name (${permission.name})`,
|
|
543
|
+
);
|
|
544
|
+
previousPermission = permission.name;
|
|
545
|
+
assert.ok(permission.since === null || typeof permission.since === 'number', `${permission.name} since`);
|
|
546
|
+
assert.ok(permission.level === 'normal' || permission.level === 'system_basic', `${permission.name} level`);
|
|
547
|
+
assert.ok(
|
|
548
|
+
['system_grant', 'user_grant', 'system_only', 'restricted'].includes(permission.grant),
|
|
549
|
+
`${permission.name} grant`,
|
|
550
|
+
);
|
|
551
|
+
assert.equal(typeof permission.restricted, 'boolean', `${permission.name} restricted`);
|
|
552
|
+
// A grant of "restricted" without the flag would silently skip the ACL hint.
|
|
553
|
+
if (permission.grant === 'restricted') {
|
|
554
|
+
assert.equal(permission.restricted, true, `${permission.name} needs restricted: true`);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
274
560
|
// Review 9: severity must be numeric in ruleMeta.json, like the existing rule.
|
|
275
561
|
test('rule metadata uses numeric severities', () => {
|
|
276
562
|
const meta = JSON.parse(readFileSync(path.join(RULES_DIR, 'config', 'ruleMeta.json'), 'utf8'));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Tests for rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js: the
|
|
2
|
-
//
|
|
1
|
+
// Tests for rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js: the runtime-contract
|
|
2
|
+
// sub-codes of @hometrans/arkui-runtime-pitfall — detection, per-issue severity
|
|
3
3
|
// (ERROR only when the site is a defect under every legal reading; intent-dependent findings
|
|
4
4
|
// are WARN), cross-file resolution, provenance checks, and idempotent re-runs.
|
|
5
5
|
import { mkdtempSync, rmSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
@@ -688,3 +688,167 @@ test('a component nested inside an if in an arrow slot is an ERROR (the body sca
|
|
|
688
688
|
['components/AppListItem.ets', 'components/PriceText.ets', 'pages/OrderPage.ets'])),
|
|
689
689
|
[[10, '[builder-param-arrow-inline-component]']]);
|
|
690
690
|
});
|
|
691
|
+
|
|
692
|
+
// ---------------------------------------------------------------- i18n-simple-datetime-format
|
|
693
|
+
|
|
694
|
+
test('an i18n.getSimpleDateTimeFormatByPattern call is an ERROR at the call line', (t) => {
|
|
695
|
+
const root = project(t, {
|
|
696
|
+
'pages/DetailPage.ets': [
|
|
697
|
+
"import { i18n } from '@kit.LocalizationKit';",
|
|
698
|
+
'@Entry',
|
|
699
|
+
'@Component',
|
|
700
|
+
'struct DetailPage {',
|
|
701
|
+
' private stamp(d: Date): string {',
|
|
702
|
+
" return i18n.getSimpleDateTimeFormatByPattern('HH:mm').format(d);",
|
|
703
|
+
' }',
|
|
704
|
+
'}',
|
|
705
|
+
].join('\n'),
|
|
706
|
+
});
|
|
707
|
+
assert.deepEqual(summary(issuesOf(root, ['pages/DetailPage.ets'])), [[6, '[i18n-simple-datetime-format]']]);
|
|
708
|
+
assert.equal(issuesOf(root, ['pages/DetailPage.ets'])[0].severity, ERROR);
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
test('an aliased receiver still fires; a mention inside a comment does not', (t) => {
|
|
712
|
+
const aliased = project(t, {
|
|
713
|
+
'pages/A.ets': [
|
|
714
|
+
"import { i18n as I } from '@kit.LocalizationKit';",
|
|
715
|
+
"const s = I.getSimpleDateTimeFormatByPattern('yyyy').format(new Date());",
|
|
716
|
+
].join('\n'),
|
|
717
|
+
});
|
|
718
|
+
assert.deepEqual(summary(issuesOf(aliased, ['pages/A.ets'])), [[2, '[i18n-simple-datetime-format]']]);
|
|
719
|
+
const commented = project(t, {
|
|
720
|
+
'pages/B.ets': [
|
|
721
|
+
'// i18n.getSimpleDateTimeFormatByPattern("HH:mm") is no longer used',
|
|
722
|
+
'const s = formatClock(new Date());',
|
|
723
|
+
].join('\n'),
|
|
724
|
+
});
|
|
725
|
+
assert.deepEqual(issuesOf(commented, ['pages/B.ets']), []);
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
// ---------------------------------------------------------------- self-refresh-feedback
|
|
729
|
+
|
|
730
|
+
const REFRESH_PAGE = (handler: string) => [
|
|
731
|
+
'@Entry',
|
|
732
|
+
'@Component',
|
|
733
|
+
'struct HomePage {',
|
|
734
|
+
' @Local refreshing: boolean = false;',
|
|
735
|
+
' private load(): void {',
|
|
736
|
+
' this.refreshing = true;',
|
|
737
|
+
' this.fetchWeather();',
|
|
738
|
+
' }',
|
|
739
|
+
' fetchWeather(): void {}',
|
|
740
|
+
' build() {',
|
|
741
|
+
" Refresh({ refreshing: this.refreshing }) { Text('x') }",
|
|
742
|
+
' .onRefreshing(() => {',
|
|
743
|
+
handler,
|
|
744
|
+
' })',
|
|
745
|
+
' }',
|
|
746
|
+
'}',
|
|
747
|
+
].join('\n');
|
|
748
|
+
|
|
749
|
+
test('an unguarded Refresh.onRefreshing whose state is written elsewhere is a WARN', (t) => {
|
|
750
|
+
const root = project(t, { 'pages/HomePage.ets': REFRESH_PAGE(' this.load();') });
|
|
751
|
+
const issues = issuesOf(root, ['pages/HomePage.ets']);
|
|
752
|
+
assert.equal(issues.length, 1);
|
|
753
|
+
assert.equal(issues[0].severity, WARN);
|
|
754
|
+
assert.match(issues[0].message.en as string, /^\[self-refresh-feedback\]/);
|
|
755
|
+
assert.match(issues[0].message.en as string, /self-feeding refresh loop/);
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
test('a first-line guard on the bound state keeps it silent', (t) => {
|
|
759
|
+
const root = project(t, {
|
|
760
|
+
'pages/HomePage.ets': REFRESH_PAGE(' if (this.refreshing) { return; }\n this.load();'),
|
|
761
|
+
});
|
|
762
|
+
assert.deepEqual(issuesOf(root, ['pages/HomePage.ets']), []);
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
test('a literal binding, a pure echo and SELF-REFRESH-OK all stay silent', (t) => {
|
|
766
|
+
const literal = project(t, {
|
|
767
|
+
'pages/A.ets': ['@Component', 'struct A {', ' build() {', ' Refresh({ refreshing: false }) {', " Text('x')", ' }', ' .onRefreshing(() => { this.load(); })', ' }', ' load(): void {}', '}'].join('\n'),
|
|
768
|
+
});
|
|
769
|
+
assert.deepEqual(issuesOf(literal, ['pages/A.ets']), []);
|
|
770
|
+
|
|
771
|
+
const echo = project(t, {
|
|
772
|
+
'pages/B.ets': ['@Component', 'struct B {', " @Local value: string = '';", ' build() {', ' Search({ value: this.value })', ' .onChange((v: string) => { this.value = v; })', ' }', '}'].join('\n'),
|
|
773
|
+
});
|
|
774
|
+
assert.deepEqual(issuesOf(echo, ['pages/B.ets']), []);
|
|
775
|
+
|
|
776
|
+
const closed = project(t, {
|
|
777
|
+
'pages/C.ets': REFRESH_PAGE(' this.load();').replace(' .onRefreshing(() => {', ' // SELF-REFRESH-OK: the flag is only written by this handler\n .onRefreshing(() => {'),
|
|
778
|
+
});
|
|
779
|
+
assert.deepEqual(issuesOf(closed, ['pages/C.ets']), []);
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
test('Toggle / Tabs / Slider / Swiper are covered by the same rule', (t) => {
|
|
783
|
+
const cases = [
|
|
784
|
+
['pages/T.ets', ['@Component', 'struct T {', ' @Local on: boolean = false;', ' build() {', ' Toggle({ type: ToggleType.Switch, isOn: this.on })', ' .onChange((v: boolean) => { this.on = v; this.save(); })', ' }', ' save(): void {}', '}'].join('\n')],
|
|
785
|
+
['pages/G.ets', ['@Component', 'struct G {', ' @Local idx: number = 0;', ' build() {', " Tabs({ index: this.idx }) { TabContent() { Text('a') } }", ' .onChange((i: number) => { this.idx = i; this.loadTab(); })', ' }', ' loadTab(): void {}', '}'].join('\n')],
|
|
786
|
+
['pages/S.ets', ['@Component', 'struct S {', ' @Local v: number = 0;', ' build() {', ' Slider({ value: this.v, min: 0, max: 100 })', ' .onChange((v: number) => { this.v = v; this.apply(); })', ' }', ' apply(): void {}', '}'].join('\n')],
|
|
787
|
+
['pages/W.ets', ['@Component', 'struct W {', ' @Local i: number = 0;', ' build() {', " Swiper({ index: this.i }) { Text('a') }", ' .onChange((i: number) => { this.i = i; this.loadSlide(); })', ' }', ' loadSlide(): void {}', '}'].join('\n')],
|
|
788
|
+
];
|
|
789
|
+
for (const [file, body] of cases) {
|
|
790
|
+
const root = project(t, { [file]: body });
|
|
791
|
+
const issues = issuesOf(root, [file]);
|
|
792
|
+
assert.equal(issues.length, 1, file);
|
|
793
|
+
assert.equal(issues[0].severity, WARN, file);
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
|
|
797
|
+
// ---------------------------------------------------------------- sql-identifier-quoting
|
|
798
|
+
|
|
799
|
+
const SQL_SCHEMA_QUOTED = [
|
|
800
|
+
"const DDL = 'CREATE TABLE IF NOT EXISTS \"sample_table\" (' +",
|
|
801
|
+
" '\"id\" INTEGER NOT NULL, \"content\" TEXT NOT NULL, \"from\" TEXT NOT NULL, ' +",
|
|
802
|
+
" 'PRIMARY KEY(\"id\"))';",
|
|
803
|
+
].join('\n');
|
|
804
|
+
|
|
805
|
+
const SQL_DAO = [
|
|
806
|
+
'class Dao {',
|
|
807
|
+
' save(e: E) {',
|
|
808
|
+
" const row: relationalStore.ValuesBucket = { 'id': e.id, 'content': e.content, 'from': e.from };",
|
|
809
|
+
" return this.store.insert('sample_table', row);",
|
|
810
|
+
' }',
|
|
811
|
+
'}',
|
|
812
|
+
].join('\n');
|
|
813
|
+
|
|
814
|
+
const sqlIssues = (issues: any[]) =>
|
|
815
|
+
issues.filter((i) => String(i.message.en).includes('[sql-identifier-quoting]'));
|
|
816
|
+
|
|
817
|
+
test('sql-identifier-quoting: quoted DDL, ValuesBucket key and raw insert are WARNed', (t) => {
|
|
818
|
+
const root = project(t, {
|
|
819
|
+
'common/DatabaseSchema.ets': SQL_SCHEMA_QUOTED,
|
|
820
|
+
'common/Dao.ets': SQL_DAO,
|
|
821
|
+
});
|
|
822
|
+
const found = sqlIssues(issuesOf(root, ['common/DatabaseSchema.ets', 'common/Dao.ets']));
|
|
823
|
+
assert.equal(found.length, 3);
|
|
824
|
+
assert.ok(found.every((i) => i.severity === WARN));
|
|
825
|
+
assert.deepEqual(found.map((i) => summary([i])[0][1]),
|
|
826
|
+
['[sql-identifier-quoting]', '[sql-identifier-quoting]', '[sql-identifier-quoting]']);
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
test('sql-identifier-quoting: an unquoted keyword column is reported, a fallback keyword is not', (t) => {
|
|
830
|
+
const root = project(t, {
|
|
831
|
+
'common/Schema.ets': "const DDL = 'CREATE TABLE t (id INTEGER, from TEXT)';",
|
|
832
|
+
'common/Schema2.ets': "const DDL = 'CREATE TABLE t2 (id INTEGER, explain TEXT)';",
|
|
833
|
+
});
|
|
834
|
+
const fromIssues = sqlIssues(issuesOf(root, ['common/Schema.ets']));
|
|
835
|
+
assert.equal(fromIssues.length, 1);
|
|
836
|
+
assert.match(fromIssues[0].message.en, /from/);
|
|
837
|
+
const explainIssues = sqlIssues(issuesOf(root, ['common/Schema2.ets']));
|
|
838
|
+
assert.deepEqual(explainIssues, []);
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
test('sql-identifier-quoting: a quoted executeSql write is clean', (t) => {
|
|
842
|
+
const root = project(t, {
|
|
843
|
+
'common/DatabaseSchema.ets': SQL_SCHEMA_QUOTED,
|
|
844
|
+
'common/Dao.ets': [
|
|
845
|
+
'class Dao {',
|
|
846
|
+
' save(id: number, from: string) {',
|
|
847
|
+
" return this.store.executeSql('INSERT OR REPLACE INTO \"sample_table\" (\"id\",\"from\") VALUES (?,?)', [id, from]);",
|
|
848
|
+
' }',
|
|
849
|
+
'}',
|
|
850
|
+
].join('\n'),
|
|
851
|
+
});
|
|
852
|
+
assert.deepEqual(sqlIssues(issuesOf(root, ['common/DatabaseSchema.ets', 'common/Dao.ets']))
|
|
853
|
+
.filter((i) => i.severity === WARN && String(i.message.en).includes('valuesbucket')), []);
|
|
854
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { test } from 'node:test';
|
|
6
|
+
import assert from 'node:assert/strict';
|
|
7
|
+
|
|
8
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
const file = (rel: string) => readFileSync(path.join(HERE, '..', rel), 'utf8');
|
|
10
|
+
|
|
11
|
+
test('the docs-refresh reply contract is defined exactly once in I5', () => {
|
|
12
|
+
const skill = file('SKILL.md');
|
|
13
|
+
const defs = skill.match(/^- \*\*Docs-refresh reply contract\*\*/gm) ?? [];
|
|
14
|
+
assert.equal(defs.length, 1, 'I5 must define the contract exactly once');
|
|
15
|
+
|
|
16
|
+
const line = (skill.match(/^- \*\*Docs-refresh reply contract\*\*.*$/m) ?? [''])[0];
|
|
17
|
+
assert.ok(line.includes('"modules_updated": N'), 'reply shape must define modules_updated');
|
|
18
|
+
assert.ok(line.includes('"modules_total": M'), 'reply shape must define modules_total');
|
|
19
|
+
// The failure shape matches I5 rule (2): `{ ok:false, note }` — no second free-form field.
|
|
20
|
+
assert.ok(line.includes('"ok": false, "note"'), 'failure shape must be {ok:false, note}');
|
|
21
|
+
assert.ok(!/"reason"\s*:/.test(line), 'failure shape must not add a reason field');
|
|
22
|
+
// The sub-agent never produces a commit hash; the orchestrator owns the docs commit.
|
|
23
|
+
assert.ok(!/"commit"\s*:/.test(line), 'reply shape must not include a commit field');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('every docs-refresh dispatch site references the single I5 definition', () => {
|
|
27
|
+
const skill = file('SKILL.md');
|
|
28
|
+
assert.match(skill, /docs-refresh reply contract in I5/i, 'B5 does not reference the contract');
|
|
29
|
+
for (const rel of ['references/shared-layer.md', 'references/initialization.md']) {
|
|
30
|
+
const md = file(rel);
|
|
31
|
+
assert.match(md, /docs-refresh reply contract in SKILL\.md I5/i, `${rel} does not point at I5`);
|
|
32
|
+
assert.ok(!md.includes('{ "ok": true'), `${rel} redefines the reply shape instead of referencing I5`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('docs_refresh.json no longer carries a mode', () => {
|
|
37
|
+
for (const rel of ['SKILL.md', 'references/state-and-resume.md']) {
|
|
38
|
+
assert.ok(!file(rel).includes('{wave, mode, result, at}'), `${rel} still documents the old shape`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -218,6 +218,8 @@ test('emit-state seeds v2 and refuses to overwrite', (t) => {
|
|
|
218
218
|
assert.equal(state.groups[0].G, 1);
|
|
219
219
|
assert.equal(state.config.wave_width, 10);
|
|
220
220
|
assert.equal(state.config.design_granularity, 'chunk');
|
|
221
|
+
// The state seed carries no docs_mode knob (the semantic-docs refresh has one path).
|
|
222
|
+
assert.equal('docs_mode' in state.config, false);
|
|
221
223
|
assert.ok(state.groups[0].chunks[0].design_file.endsWith('SPEC_DESIGN_G1_c1.md'));
|
|
222
224
|
assert.ok(state.groups[0].chunks[0].spec_file.endsWith('chunk_1_spec.md'));
|
|
223
225
|
// Idempotent: a second run without --force does not overwrite
|