@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
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/*
|
|
4
4
|
* @hometrans/arkui-runtime-pitfall
|
|
5
5
|
*
|
|
6
|
-
* One rule
|
|
7
|
-
* pass every built-in HomeCheck rule, then break 100% at run time.
|
|
8
|
-
* prefix so one rule id stays greppable:
|
|
6
|
+
* One rule per failure mode — the ArkUI framework-contract and cross-page result-carrier errors
|
|
7
|
+
* that compile 100% clean and pass every built-in HomeCheck rule, then break 100% at run time.
|
|
8
|
+
* The sub-code is the message-key prefix so one rule id stays greppable:
|
|
9
9
|
*
|
|
10
10
|
* [alpha-scale-mismatch] setAlphaComponent(color, 0<n<=1) — the alpha channel is
|
|
11
11
|
* 0..255; the fraction truncates to a (near-)zero alpha byte.
|
|
@@ -52,6 +52,44 @@
|
|
|
52
52
|
* exists anywhere — the mode never reaches rendering. A
|
|
53
53
|
* state-only design on resource qualifiers is legal, so this
|
|
54
54
|
* is routed to review. (WARN)
|
|
55
|
+
* [route-param-v2-instance] router params carry an @ObservedV2/@Observed class instance
|
|
56
|
+
* (directly, through a local object literal, or through an
|
|
57
|
+
* interface/type alias whose field is typed as that class).
|
|
58
|
+
* Router params are serialized at the page boundary, so the
|
|
59
|
+
* instance arrives with __ob_* keys or undefined fields. (ERROR)
|
|
60
|
+
* [route-param-v2-new] `new Xxx(...)` built inline inside router params — the same
|
|
61
|
+
* boundary and the same field loss. (ERROR)
|
|
62
|
+
* [route-param-v2-stringify] `JSON.stringify(v)` where v is an @ObservedV2/@Observed
|
|
63
|
+
* instance — the decorated fields serialize as __ob_* keys. (ERROR)
|
|
64
|
+
* [route-param-unrebuilt-receive] `getParams()` cast to a contract whose field is still the
|
|
65
|
+
* decorated class, without a typeof validation or new Xxx(...)
|
|
66
|
+
* rebuild — the arriving plain object keeps no @Trace. (WARN)
|
|
67
|
+
* [route-back-index-base] an indexed `back(index)` whose index is not derived from
|
|
68
|
+
* router.getState().index (docs say [0,+∞), the runtime counts
|
|
69
|
+
* from 1 and rejects 0). Compute the target explicitly and guard
|
|
70
|
+
* `< 1` with a plain back(). (WARN)
|
|
71
|
+
*
|
|
72
|
+
* [i18n-simple-datetime-format] `i18n.getSimpleDateTimeFormatByPattern(...)` — the platform
|
|
73
|
+
* rejects valid patterns at run time ("IsValidPattern ... is an
|
|
74
|
+
* invalid pattern", 890001) even when the argument is correct, and
|
|
75
|
+
* the failed creation leaves a native formatter peer that the GC
|
|
76
|
+
* finalizer walks. Self-implement the formatting. (ERROR)
|
|
77
|
+
* [self-refresh-feedback] a component that takes a state variable as input (Refresh.refreshing,
|
|
78
|
+
* Search.value, Toggle.isOn, Tabs.index, Slider.value, Swiper.index)
|
|
79
|
+
* and registers the matching user-action callback (onRefreshing /
|
|
80
|
+
* onChange) whose body has no first-line guard: the platform fires
|
|
81
|
+
* that callback on programmatic writes too, so a load re-enters
|
|
82
|
+
* itself. (WARN)
|
|
83
|
+
* [sql-identifier-quoting] a column/key name is a SQLite keyword outside the `%fallback`
|
|
84
|
+
* list (`from`, `index`, `order`, `group`, `values`, `where`, …)
|
|
85
|
+
* or not a regular identifier, and the SQL / ValuesBucket does not
|
|
86
|
+
* quote it. `store.insert/batchInsert` build `INSERT … (key,…)`
|
|
87
|
+
* from the ValuesBucket keys verbatim, so writing such a row fails
|
|
88
|
+
* with RDB 14800021 (SQLite "near \"from\": syntax error"). The
|
|
89
|
+
* schema is usually in another file and may already quote the DDL,
|
|
90
|
+
* so this is a WARN advisory that also inspects the values-bucket
|
|
91
|
+
* keys and raw insert calls; a quoted executeSql primitive is clean.
|
|
92
|
+
* (WARN)
|
|
55
93
|
*
|
|
56
94
|
* The checker is text-based on purpose: it works on every ArkTS file the scene reports, needs no
|
|
57
95
|
* CFG, and decides cross-file relations (the struct table by declaration origin, the
|
|
@@ -74,6 +112,9 @@ const path = require('path');
|
|
|
74
112
|
const hc = require(process.env.HOMECHECK_MODULE_PATH || 'homecheck');
|
|
75
113
|
const { GlobalChecker, Rule, AlertLevel } = hc;
|
|
76
114
|
|
|
115
|
+
const { RouteParamCarrierSubCheck } = require('./arkui/RouteParamCarrierSubCheck');
|
|
116
|
+
const sqlAnalysis = require('./sql/SqlIdentifierAnalysis');
|
|
117
|
+
|
|
77
118
|
const RULE_ID = '@hometrans/arkui-runtime-pitfall';
|
|
78
119
|
|
|
79
120
|
const BACKTICK = String.fromCharCode(96);
|
|
@@ -154,6 +195,71 @@ function maskStrings(code) {
|
|
|
154
195
|
return out;
|
|
155
196
|
}
|
|
156
197
|
|
|
198
|
+
/** Escape a literal token for use inside a RegExp. */
|
|
199
|
+
function escapeRe(text) {
|
|
200
|
+
return String(text).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Like maskStrings, but keeps `${...}` template expressions as code. Rendered field reads often
|
|
205
|
+
* live inside template literals (`Text(`${this.item.count}`)`); masking the whole template would
|
|
206
|
+
* hide them from the field scan. Positions are preserved (same length).
|
|
207
|
+
*/
|
|
208
|
+
function maskStringsKeepTemplates(code) {
|
|
209
|
+
let out = '';
|
|
210
|
+
let i = 0;
|
|
211
|
+
const n = code.length;
|
|
212
|
+
const maskPlain = (quote) => {
|
|
213
|
+
out += quote;
|
|
214
|
+
i += 1;
|
|
215
|
+
while (i < n) {
|
|
216
|
+
const c = code[i];
|
|
217
|
+
if (c === '\\') { out += ' '; i += 2; continue; }
|
|
218
|
+
if (c === quote) { out += quote; i += 1; return; }
|
|
219
|
+
out += c === '\n' ? '\n' : ' ';
|
|
220
|
+
i += 1;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
while (i < n) {
|
|
224
|
+
const c = code[i];
|
|
225
|
+
if (c === '"' || c === "'") { maskPlain(c); continue; }
|
|
226
|
+
if (c === BACKTICK) {
|
|
227
|
+
out += c;
|
|
228
|
+
i += 1;
|
|
229
|
+
while (i < n) {
|
|
230
|
+
const t = code[i];
|
|
231
|
+
if (t === '\\') { out += ' '; i += 2; continue; }
|
|
232
|
+
if (t === BACKTICK) { out += t; i += 1; break; }
|
|
233
|
+
if (t === '$' && code[i + 1] === '{') {
|
|
234
|
+
out += ' ';
|
|
235
|
+
i += 2;
|
|
236
|
+
let depth = 1;
|
|
237
|
+
while (i < n && depth > 0) {
|
|
238
|
+
const e = code[i];
|
|
239
|
+
if (e === '{') { depth += 1; out += e; i += 1; continue; }
|
|
240
|
+
if (e === '}') {
|
|
241
|
+
depth -= 1;
|
|
242
|
+
out += depth === 0 ? ' ' : e;
|
|
243
|
+
i += 1;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (e === '"' || e === "'") { maskPlain(e); continue; }
|
|
247
|
+
out += e;
|
|
248
|
+
i += 1;
|
|
249
|
+
}
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
out += t === '\n' ? '\n' : ' ';
|
|
253
|
+
i += 1;
|
|
254
|
+
}
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
out += c;
|
|
258
|
+
i += 1;
|
|
259
|
+
}
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
262
|
+
|
|
157
263
|
/**
|
|
158
264
|
* When code[i] is /, return the closing / if it opens a regex literal, otherwise (division) -1.
|
|
159
265
|
* Comments are already stripped; decided by the previous non-whitespace character.
|
|
@@ -307,6 +413,25 @@ function chainHead(s, dot) {
|
|
|
307
413
|
return null;
|
|
308
414
|
}
|
|
309
415
|
|
|
416
|
+
/** State-bound components whose user-action callback also fires on programmatic writes. */
|
|
417
|
+
const SELF_REFRESH_COMPONENTS = [
|
|
418
|
+
{ name: 'Refresh', state: 'refreshing', event: 'onRefreshing' },
|
|
419
|
+
{ name: 'Search', state: 'value', event: 'onChange' },
|
|
420
|
+
{ name: 'Toggle', state: 'isOn', event: 'onChange' },
|
|
421
|
+
{ name: 'Tabs', state: 'index', event: 'onChange' },
|
|
422
|
+
{ name: 'Slider', state: 'value', event: 'onChange' },
|
|
423
|
+
{ name: 'Swiper', state: 'index', event: 'onChange' },
|
|
424
|
+
];
|
|
425
|
+
|
|
426
|
+
/** Does `marker` appear on the reported line or within the three lines above it? */
|
|
427
|
+
function commentMarkerAbove(raw, line, marker) {
|
|
428
|
+
const lines = String(raw || '').split('\n');
|
|
429
|
+
for (let i = Math.max(0, line - 4); i < Math.min(lines.length, line); i++) {
|
|
430
|
+
if (lines[i].includes(marker)) { return true; }
|
|
431
|
+
}
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
|
|
310
435
|
/* ------------------------------------------------------------------ */
|
|
311
436
|
/* ArkUI pattern helpers */
|
|
312
437
|
/* ------------------------------------------------------------------ */
|
|
@@ -334,8 +459,13 @@ function decoratorsAbove(text, structIdx) {
|
|
|
334
459
|
return out;
|
|
335
460
|
}
|
|
336
461
|
|
|
337
|
-
/**
|
|
338
|
-
|
|
462
|
+
/**
|
|
463
|
+
* All struct declarations of one file: name, @ComponentV2 / @CustomDialog flags, @BuilderParam members,
|
|
464
|
+
* the struct body (masked + template-expression-readable) and the @Param member names. `readable` is the
|
|
465
|
+
* same text with strings masked but `${...}` expressions kept (positions match).
|
|
466
|
+
*/
|
|
467
|
+
function structDecls(masked, readable) {
|
|
468
|
+
const source = typeof readable === 'string' ? readable : masked;
|
|
339
469
|
const out = [];
|
|
340
470
|
const re = /\bstruct\s+([A-Za-z_$][\w$]*)/g;
|
|
341
471
|
let m = null;
|
|
@@ -343,16 +473,31 @@ function structDecls(masked) {
|
|
|
343
473
|
const decos = decoratorsAbove(masked, m.index);
|
|
344
474
|
const braceIdx = masked.indexOf('{', m.index + m[0].length);
|
|
345
475
|
const builderParams = new Set();
|
|
476
|
+
const params = new Map();
|
|
477
|
+
let body = '';
|
|
478
|
+
let bodyReadable = '';
|
|
346
479
|
if (braceIdx >= 0 && braceIdx < m.index + m[0].length + 200) {
|
|
347
480
|
const close = matchBracket(masked, braceIdx);
|
|
348
481
|
if (close > 0) {
|
|
349
|
-
|
|
482
|
+
body = masked.slice(braceIdx + 1, close);
|
|
483
|
+
bodyReadable = source.slice(braceIdx + 1, close);
|
|
350
484
|
for (const pm of body.matchAll(/@BuilderParam\s+(?:(?:private|public|protected)\s+)?([A-Za-z_$][\w$]*)/g)) {
|
|
351
485
|
builderParams.add(pm[1]);
|
|
352
486
|
}
|
|
487
|
+
for (const pm of body.matchAll(/@Param\s+(?:(?:private|public|protected)\s+)?([A-Za-z_$][\w$]*)\s*:\s*([^\n=;]+)/g)) {
|
|
488
|
+
params.set(pm[1], pm[2].trim());
|
|
489
|
+
}
|
|
353
490
|
}
|
|
354
491
|
}
|
|
355
|
-
out.push({
|
|
492
|
+
out.push({
|
|
493
|
+
name: m[1],
|
|
494
|
+
v2: decos.includes('@ComponentV2'),
|
|
495
|
+
customDialog: decos.includes('@CustomDialog'),
|
|
496
|
+
builderParams,
|
|
497
|
+
body,
|
|
498
|
+
bodyReadable,
|
|
499
|
+
params,
|
|
500
|
+
});
|
|
356
501
|
}
|
|
357
502
|
return out;
|
|
358
503
|
}
|
|
@@ -463,11 +608,86 @@ function structDeclsOfFile(filePath, cache) {
|
|
|
463
608
|
if (cache.has(filePath)) { return cache.get(filePath); }
|
|
464
609
|
let decls = [];
|
|
465
610
|
const raw = safe(() => fs.readFileSync(filePath, 'utf8'), null);
|
|
466
|
-
if (raw !== null) {
|
|
611
|
+
if (raw !== null) {
|
|
612
|
+
const stripped = stripComments(raw);
|
|
613
|
+
decls = structDecls(maskStrings(stripped), maskStringsKeepTemplates(stripped));
|
|
614
|
+
}
|
|
467
615
|
cache.set(filePath, decls);
|
|
468
616
|
return decls;
|
|
469
617
|
}
|
|
470
618
|
|
|
619
|
+
/**
|
|
620
|
+
* Component instantiations in a body that receive the whole object `token`:
|
|
621
|
+
* `Child({ item: item, … })` → { name: 'Child', prop: 'item' }, `Child({ item })` → prop: 'item'.
|
|
622
|
+
* Only top-level properties count, and the value must be exactly `token` — a nested literal
|
|
623
|
+
* (`Child({ data: { item } })`) or an interpolation inside a string is not a match. Pass a
|
|
624
|
+
* string-masked body. Only leading-uppercase callees are considered; built-ins are skipped by the
|
|
625
|
+
* caller's struct lookup.
|
|
626
|
+
*/
|
|
627
|
+
function itemReceivers(body, token) {
|
|
628
|
+
const out = [];
|
|
629
|
+
const re = /\b([A-Z][A-Za-z0-9_$]*)\s*\(\s*\{/g;
|
|
630
|
+
let m = null;
|
|
631
|
+
while ((m = re.exec(body)) !== null) {
|
|
632
|
+
const open = body.indexOf('{', m.index);
|
|
633
|
+
const close = matchBracket(body, open);
|
|
634
|
+
if (close < 0) { continue; }
|
|
635
|
+
const literal = body.slice(open + 1, close);
|
|
636
|
+
for (const rawPart of splitTopLevel(literal)) {
|
|
637
|
+
const part = rawPart.trim();
|
|
638
|
+
if (part === '') { continue; }
|
|
639
|
+
const named = /^([A-Za-z_$][\w$]*)\s*:\s*([\s\S]+)$/.exec(part);
|
|
640
|
+
if (named !== null && named[2].trim() === token) {
|
|
641
|
+
out.push({ name: m[1], prop: named[1] });
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
if (part === token) {
|
|
645
|
+
out.push({ name: m[1], prop: token });
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
return out;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/** Fields a child struct reads from one @Param: `this.item.count` → 'count' (template expressions kept). */
|
|
654
|
+
function childRenderedFields(child, prop) {
|
|
655
|
+
const out = [];
|
|
656
|
+
const body = typeof child.bodyReadable === 'string' && child.bodyReadable !== ''
|
|
657
|
+
? child.bodyReadable
|
|
658
|
+
: child.body;
|
|
659
|
+
if (typeof body !== 'string' || body === '') { return out; }
|
|
660
|
+
const escaped = escapeRe(prop);
|
|
661
|
+
const re = new RegExp(
|
|
662
|
+
String.raw`\bthis\s*\.\s*` + escaped + String.raw`\s*\.\s*([A-Za-z_$][\w$]*)`, 'g'
|
|
663
|
+
);
|
|
664
|
+
let m = null;
|
|
665
|
+
while ((m = re.exec(body)) !== null) { out.push(m[1]); }
|
|
666
|
+
return out;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Fields rendered by a child component and by the components it hands the same object to (one more
|
|
671
|
+
* level, bounded): `Child({ item })` where Child renders `this.item.a` and passes `this.item` to
|
|
672
|
+
* `GrandChild({ item: this.item })` which renders `this.item.b` → ['a', 'b'].
|
|
673
|
+
*/
|
|
674
|
+
function renderedFieldsOfChild(child, prop, scan, scanDecls, cache, depth, visited, receiverList) {
|
|
675
|
+
const out = [];
|
|
676
|
+
const key = `${child.name}#${prop}`;
|
|
677
|
+
if (visited.has(key)) { return out; }
|
|
678
|
+
visited.add(key);
|
|
679
|
+
if (receiverList !== null) { receiverList.push(`${child.name}.${prop}`); }
|
|
680
|
+
for (const f of childRenderedFields(child, prop)) { out.push(f); }
|
|
681
|
+
if (depth > 0 && typeof child.body === 'string' && child.body !== '') {
|
|
682
|
+
for (const r of itemReceivers(child.body, 'this.' + prop)) {
|
|
683
|
+
const grandChild = structInfoFor(r.name, scan, scanDecls, cache);
|
|
684
|
+
if (grandChild === null) { continue; }
|
|
685
|
+
out.push(...renderedFieldsOfChild(grandChild, r.prop, scan, scanDecls, cache, depth - 1, visited, null));
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
return out;
|
|
689
|
+
}
|
|
690
|
+
|
|
471
691
|
/**
|
|
472
692
|
* The struct a component-instantiation name refers to: the same-file declaration, else the file a
|
|
473
693
|
* relative import binding resolves to (alias-aware). null when unresolvable (built-in component,
|
|
@@ -487,10 +707,12 @@ function structInfoFor(name, scan, scanDecls, cache) {
|
|
|
487
707
|
}
|
|
488
708
|
|
|
489
709
|
/**
|
|
490
|
-
* Member @Builder / @LocalBuilder methods of one file: name → { local, body }
|
|
710
|
+
* Member @Builder / @LocalBuilder methods of one file: name → { local, params, body, bodyReadable }
|
|
711
|
+
* (`body` is string-masked, `bodyReadable` keeps `${…}` template expressions; positions match).
|
|
491
712
|
* A global `@Builder function x(` does not match: `function` is never followed by `(`.
|
|
492
713
|
*/
|
|
493
|
-
function memberBuildersOf(masked) {
|
|
714
|
+
function memberBuildersOf(masked, readable) {
|
|
715
|
+
const source = typeof readable === 'string' ? readable : masked;
|
|
494
716
|
const out = new Map();
|
|
495
717
|
for (const m of masked.matchAll(/@(Builder|LocalBuilder)\s+(?:(?:private|public|protected)\s+)*([A-Za-z_$][\w$]*)\s*\(/g)) {
|
|
496
718
|
const paren = m.index + m[0].length - 1;
|
|
@@ -501,7 +723,12 @@ function memberBuildersOf(masked) {
|
|
|
501
723
|
const open = parenClose + bm[0].length;
|
|
502
724
|
const close = matchBracket(masked, open);
|
|
503
725
|
if (close < 0) { continue; }
|
|
504
|
-
out.set(m[2], {
|
|
726
|
+
out.set(m[2], {
|
|
727
|
+
local: m[1] === 'LocalBuilder',
|
|
728
|
+
params: masked.slice(paren + 1, parenClose),
|
|
729
|
+
body: masked.slice(open + 1, close),
|
|
730
|
+
bodyReadable: source.slice(open + 1, close),
|
|
731
|
+
});
|
|
505
732
|
}
|
|
506
733
|
return out;
|
|
507
734
|
}
|
|
@@ -721,6 +948,18 @@ class ArkUIRuntimePitfallCheck extends GlobalChecker {
|
|
|
721
948
|
en: '[appstoragev2-connect-creator] AppStorageV2/PersistenceV2 key %s is connected by different classes declared in different files (%s) — classes declared in separate files are different types even with the same name, and the same key must always be connected by one class or connect throws at runtime (uncaught it kills the page; caught, the feature silently degrades). Consolidate the connection class into a single shared module.',
|
|
722
949
|
cn: '[appstoragev2-connect-creator] AppStorageV2/PersistenceV2 的 key %s 被不同文件声明的不同的类连接(%s)——不同文件里声明的类即使同名也是不同类型,同一 key 必须始终由一个类连接,否则 connect 运行期抛异常(未捕获则页面被杀,被捕获则功能静默劣化)。把连接类收敛到唯一共享模块。',
|
|
723
950
|
},
|
|
951
|
+
i18nFormat: {
|
|
952
|
+
en: '[i18n-simple-datetime-format] i18n.getSimpleDateTimeFormatByPattern rejects valid patterns at run time ("IsValidPattern ... is an invalid pattern", 890001) even when the argument is correct; the failed creation also leaves a native formatter peer that the GC finalizer walks, so the call throws and the rendered text silently loses a segment. Do not use this API — format the value yourself (manual HH:mm padding, a month table from resources, or Intl.DateTimeFormat).',
|
|
953
|
+
cn: '[i18n-simple-datetime-format] i18n.getSimpleDateTimeFormatByPattern 在运行期会把合法模式判为非法("IsValidPattern ... is an invalid pattern",890001),参数写对也直接抛错;创建失败还会留下 native formatter 对象,GC finalizer 处理时可能崩溃,界面上只表现为该段文本缺失。不要用这个 API——自实现格式化(手写 HH:mm 补零、月份查资源表,或 Intl.DateTimeFormat)。',
|
|
954
|
+
},
|
|
955
|
+
selfRefresh: {
|
|
956
|
+
en: '[self-refresh-feedback] %s is bound to `%s` and its `%s` handler has no first-line guard. ArkUI fires that callback when the bound state is written programmatically too, so every non-gesture write can re-enter the same business path - a load loop or a silent duplicate request. Enumerate every write site of `%s`: keep gesture-only writes, and either guard the body (`if (%s) { return; }`) or split the gesture state from the business state. Close a deliberate case with `// SELF-REFRESH-OK: <reason>`.',
|
|
957
|
+
cn: '[self-refresh-feedback] %s 绑定了状态 `%s`,而它的 `%s` 回调首句没有守卫。ArkUI 在该状态被程序化写入时也会触发这个回调,于是任何非用户操作的写入都可能重入同一条业务路径——形成加载回环或静默重复请求。请列出 `%s` 的全部写入点:只保留用户操作写入,或给回调体加守卫(`if (%s) { return; }`),或把手势态与业务态拆成两个变量。确属有意为之,在该处上方写 `// SELF-REFRESH-OK: <理由>` 关闭。',
|
|
958
|
+
},
|
|
959
|
+
selfRefreshLoop: {
|
|
960
|
+
en: '[self-refresh-feedback] %s is bound to `%s`; `%s` is also assigned outside this handler, and the handler body has no first-line guard. The programmatic write fires `%s`, which re-runs the business path and writes again - a self-feeding refresh loop. Guard the body (`if (%s) { return; }`) or split the gesture state from the business state; close a deliberate case with `// SELF-REFRESH-OK: <reason>`.',
|
|
961
|
+
cn: '[self-refresh-feedback] %s 绑定了状态 `%s`;`%s` 在该回调之外还有赋值,而回调体首句没有守卫。程序化写入会触发 `%s`,回调再跑一遍业务并再次写入——形成自馈刷新回环。给回调体加守卫(`if (%s) { return; }`)或把手势态与业务态拆成两个变量;确属有意为之,在该处上方写 `// SELF-REFRESH-OK: <理由>` 关闭。',
|
|
962
|
+
},
|
|
724
963
|
input: {
|
|
725
964
|
en: '[input-type-decimal-domain] .type(InputType.Number) on a field whose name says decimal domain (%s) — ArkUI\'s InputType.Number is a character whitelist that silently strips ".", so 99.9 becomes 999 whenever the value really is a decimal. If this field is integer-only by design, close this as intended; otherwise use InputType.NUMBER_DECIMAL.',
|
|
726
965
|
cn: '[input-type-decimal-domain] 命名属于小数域的输入框(%s)用了 .type(InputType.Number)——ArkUI 的 InputType.Number 是字符白名单,会静默剔掉 ".",值真带小数时 99.9 变成 999。若该字段本就只收整数,按预期关闭本告警;否则改用 InputType.NUMBER_DECIMAL。',
|
|
@@ -729,23 +968,53 @@ class ArkUIRuntimePitfallCheck extends GlobalChecker {
|
|
|
729
968
|
en: '[theme-mode-closure] ThemeMode is written here (%s) but no setColorMode() call exists in any scanned file, so the written mode never reaches the rendering pipeline. If state-only + resource-qualifier rendering is the intended design, close this as intended; otherwise apply it — getApplicationContext().setColorMode(...) on write, plus restore from storage on startup.',
|
|
730
969
|
cn: '[theme-mode-closure] 这里写入了 ThemeMode(%s),但所有扫描文件里没有任何 setColorMode() 调用,写入的模式到不了渲染管线。若“只持状态、深浅渲染归资源限定词”是有意设计,按预期关闭本告警;否则需要生效——写时调 getApplicationContext().setColorMode(...),并在启动时从存储恢复。',
|
|
731
970
|
},
|
|
971
|
+
foreachKey: {
|
|
972
|
+
en: '[foreach-key-stale-render] %s: ForEach keys on identity only while the row renders %s; a row whose key is unchanged is not rebuilt, so those fields stay stale. Put the changing fields into the key (e.g. `${it.id}:${it.status}`) or use LazyForEach + notifyDataChange; a @ComponentV2 + @Param row does not help unless the key also changes. Close a deliberate case with `// FOREACH-KEY: <reason>`.',
|
|
973
|
+
cn: '[foreach-key-stale-render] %s:ForEach 只用身份字段做 key,却渲染了 %s;key 不变时该行不会被重建,这些字段会停留在旧值。把会变的字段拼进 key(如 `${it.id}:${it.status}`),或改用 LazyForEach + notifyDataChange;只改成 @ComponentV2 + @Param 而 key 不变并不解决问题。确属有意为之,写 `// FOREACH-KEY: <理由>` 关闭。',
|
|
974
|
+
},
|
|
975
|
+
foreachKeyWhole: {
|
|
976
|
+
en: '[foreach-key-stale-render] %s: ForEach passes the whole object to %s, which renders %s; while the key is unchanged the row is not rebuilt, so the values it receives stay stale — @ObservedV2/@Trace on the item does not cross a reused row. Key the rendered fields or use LazyForEach + notifyDataChange; close a deliberate static list with `// FOREACH-KEY: <reason>`.',
|
|
977
|
+
cn: '[foreach-key-stale-render] %s:ForEach 把整个对象交给了 %s,由它渲染 %s;key 不变时该行不会被重建,它接收到的值会停留在旧值——条目的 @ObservedV2/@Trace 跨不过被复用的行。把渲染字段拼进 key,或改用 LazyForEach + notifyDataChange;确属静态列表,写 `// FOREACH-KEY: <理由>` 关闭。',
|
|
978
|
+
},
|
|
979
|
+
sqlDdl: {
|
|
980
|
+
en: '[sql-identifier-quoting] table %s declares %s, which SQLite requires to be quoted (keyword or non-regular name). The DDL quotes it, but every statement that references the column must quote it too: store.insert/batchInsert build the INSERT column list from ValuesBucket keys verbatim, so a write through them fails with 14800021. Prefer an executeSql primitive that quotes the table and every column.',
|
|
981
|
+
cn: '[sql-identifier-quoting] 表 %s 声明了 %s,这类名字在 SQLite 中必须加引号(关键字或非常规标识符)。建表时已引用,但所有引用该列的语句也必须引用:store.insert/batchInsert 用 ValuesBucket 的键拼 INSERT 列名时不会加引号,写入会报 14800021。建议统一走对表名/列名加双引号的 executeSql 写原语。',
|
|
982
|
+
},
|
|
983
|
+
sqlIdentifier: {
|
|
984
|
+
en: '[sql-identifier-quoting] SQL identifier %s needs quoting (keyword or non-regular name) but is written bare; SQLite parses it as a keyword and reports a syntax error. Write "%s".',
|
|
985
|
+
cn: '[sql-identifier-quoting] SQL 里的标识符 %s 需要加引号(关键字或非常规名字),当前是裸写;SQLite 会把它当关键字解析并报语法错误。应写成 "%s"。',
|
|
986
|
+
},
|
|
987
|
+
sqlValuesKey: {
|
|
988
|
+
en: '[sql-identifier-quoting] the ValuesBucket key %s needs quoting; store.insert/batchInsert generate INSERT … (key,…) verbatim, so this row cannot be written (near "%s": syntax error; RDB 14800021). Quote the identifiers in an executeSql primitive, or rename the column.',
|
|
989
|
+
cn: '[sql-identifier-quoting] ValuesBucket 的键 %s 需要加引号;store.insert/batchInsert 会把它原样拼进 INSERT … (键,…),该行无法写入(near "%s": syntax error;RDB 14800021)。请改用对标识符加双引号的 executeSql 写原语,或给列改名。',
|
|
990
|
+
},
|
|
991
|
+
sqlRawInsert: {
|
|
992
|
+
en: '[sql-identifier-quoting] this project schema has columns that need quoting (%s), and store.%s builds the INSERT column list without quoting. If the row includes one of those columns the write fails with 14800021; use an executeSql primitive that quotes the table and every column.',
|
|
993
|
+
cn: '[sql-identifier-quoting] 本工程 schema 含需要加引号的列(%s),而这里调用了 store.%s——它拼 INSERT 列名时不加引号。只要该行包含这些列,写入就会报 14800021;请改用对表名/列名加双引号的 executeSql 写原语。',
|
|
994
|
+
},
|
|
732
995
|
};
|
|
733
996
|
this.reported = new Set();
|
|
997
|
+
this.routeParamCarrier = new RouteParamCarrierSubCheck(this);
|
|
734
998
|
}
|
|
735
999
|
|
|
736
1000
|
reset() {
|
|
737
1001
|
super.reset();
|
|
738
1002
|
this.reported = new Set();
|
|
1003
|
+
this.routeParamCarrier.reset();
|
|
739
1004
|
}
|
|
740
1005
|
|
|
741
1006
|
report(filePath, line, messageKey, values, severity) {
|
|
742
|
-
const key = `${messageKey}|${filePath}|${line}|${values
|
|
1007
|
+
const key = `${messageKey}|${filePath}|${line}|${values
|
|
1008
|
+
.map((v) => (v !== null && typeof v === 'object' ? `${v.en}|${v.cn}` : v)).join('§')}`;
|
|
743
1009
|
if (this.reported.has(key)) return;
|
|
744
1010
|
this.reported.add(key);
|
|
745
1011
|
const template = this.messages[messageKey];
|
|
746
|
-
const build = (text) => {
|
|
1012
|
+
const build = (text, lang) => {
|
|
747
1013
|
let result = text;
|
|
748
|
-
for (const value of values) {
|
|
1014
|
+
for (const value of values) {
|
|
1015
|
+
const v = value !== null && typeof value === 'object' ? value[lang] : value;
|
|
1016
|
+
result = result.replace('%s', String(v));
|
|
1017
|
+
}
|
|
749
1018
|
return result;
|
|
750
1019
|
};
|
|
751
1020
|
this.addIssue({
|
|
@@ -753,7 +1022,7 @@ class ArkUIRuntimePitfallCheck extends GlobalChecker {
|
|
|
753
1022
|
line,
|
|
754
1023
|
colStart: 0,
|
|
755
1024
|
colEnd: 0,
|
|
756
|
-
message: { en: build(template.en), cn: build(template.cn) },
|
|
1025
|
+
message: { en: build(template.en, 'en'), cn: build(template.cn, 'cn') },
|
|
757
1026
|
severity,
|
|
758
1027
|
});
|
|
759
1028
|
}
|
|
@@ -775,13 +1044,67 @@ class ArkUIRuntimePitfallCheck extends GlobalChecker {
|
|
|
775
1044
|
}
|
|
776
1045
|
if (scans.length === 0) return;
|
|
777
1046
|
this.checkScans(scans);
|
|
1047
|
+
this.routeParamCarrier.check(scans);
|
|
778
1048
|
}
|
|
779
1049
|
|
|
780
|
-
/** All
|
|
1050
|
+
/** All sub-codes over one project pass (cross-file tables are project-wide). */
|
|
781
1051
|
checkScans(scans) {
|
|
782
1052
|
const structFileCache = new Map();
|
|
783
1053
|
const alphaCache = new Map();
|
|
784
1054
|
|
|
1055
|
+
// ---- [i18n-simple-datetime-format] (ERROR): the native formatter API rejects valid patterns
|
|
1056
|
+
for (const scan of scans) {
|
|
1057
|
+
const re = /\bgetSimpleDateTimeFormatByPattern\s*\(/g; // fresh per file: lastIndex never leaks
|
|
1058
|
+
let m;
|
|
1059
|
+
while ((m = re.exec(scan.code)) !== null) {
|
|
1060
|
+
this.report(scan.filePath, lineOfIndex(scan.code, m.index), 'i18nFormat', [], AlertLevel.ERROR);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// ---- [self-refresh-feedback] (WARN): a state-bound component whose user-action callback is unguarded
|
|
1065
|
+
for (const scan of scans) {
|
|
1066
|
+
const handlerRe = /(^|[^\w$.])(\.\s*)(onRefreshing|onChange)\s*\(/g;
|
|
1067
|
+
let h = null;
|
|
1068
|
+
while ((h = handlerRe.exec(scan.code)) !== null) {
|
|
1069
|
+
const dot = h.index + h[1].length;
|
|
1070
|
+
const head = chainHead(scan.code, dot);
|
|
1071
|
+
if (head === null) { continue; }
|
|
1072
|
+
const spec = SELF_REFRESH_COMPONENTS.find((c) => c.name === head.name && c.event === h[3]);
|
|
1073
|
+
if (spec === undefined) { continue; }
|
|
1074
|
+
const boundMatch = new RegExp('\\b' + spec.state + '\\s*:\\s*([^,}\\n]+)').exec(head.args);
|
|
1075
|
+
if (boundMatch === null) { continue; }
|
|
1076
|
+
const bound = boundMatch[1].trim();
|
|
1077
|
+
if (bound === '' || /^(?:true|false|\d|'|"|`)/.test(bound)) { continue; }
|
|
1078
|
+
const open = scan.code.indexOf('(', h.index + h[0].length - 1);
|
|
1079
|
+
if (open < 0) { continue; }
|
|
1080
|
+
const close = matchBracket(scan.code, open);
|
|
1081
|
+
if (close < 0) { continue; }
|
|
1082
|
+
const handlerText = scan.code.slice(open + 1, close);
|
|
1083
|
+
const arrow = handlerText.indexOf('=>');
|
|
1084
|
+
if (arrow < 0) { continue; }
|
|
1085
|
+
let body = handlerText.slice(arrow + 2).trim();
|
|
1086
|
+
if (body.startsWith('{')) { body = body.slice(1, body.lastIndexOf('}')).trim(); }
|
|
1087
|
+
if (body === '' || !/[\w$)\]]\s*\(/.test(body)) { continue; }
|
|
1088
|
+
const ident = (/([A-Za-z_$][\w$]*)\s*$/.exec(bound) || ['', ''])[1];
|
|
1089
|
+
const guard = /^if\s*\(([^)]*)\)\s*\{?\s*return\b/.exec(body);
|
|
1090
|
+
if (guard !== null && (ident === '' || guard[1].includes(ident))) { continue; }
|
|
1091
|
+
const line = lineOfIndex(scan.code, dot);
|
|
1092
|
+
if (commentMarkerAbove(scan.raw, line, 'SELF-REFRESH-OK')) { continue; }
|
|
1093
|
+
let programmatic = false;
|
|
1094
|
+
if (ident !== '') {
|
|
1095
|
+
const writeRe = new RegExp('\\b' + ident + '\\s*=(?!=)', 'g');
|
|
1096
|
+
let w = null;
|
|
1097
|
+
while ((w = writeRe.exec(scan.code)) !== null) {
|
|
1098
|
+
if (w.index < open || w.index > close) { programmatic = true; break; }
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
const values = programmatic
|
|
1102
|
+
? [spec.name, bound, ident, spec.event, bound]
|
|
1103
|
+
: [spec.name, bound, spec.event, bound, bound];
|
|
1104
|
+
this.report(scan.filePath, line, programmatic ? 'selfRefreshLoop' : 'selfRefresh', values, AlertLevel.WARN);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
|
|
785
1108
|
// ---- [theme-mode-closure] (WARN): no setColorMode anywhere + at least one ThemeMode write → one finding
|
|
786
1109
|
let hasSetColorMode = false;
|
|
787
1110
|
for (const scan of scans) {
|
|
@@ -807,9 +1130,10 @@ class ArkUIRuntimePitfallCheck extends GlobalChecker {
|
|
|
807
1130
|
const masked = maskStrings(code);
|
|
808
1131
|
scan.masked = masked;
|
|
809
1132
|
scan.bindings = importBindings(code);
|
|
810
|
-
const
|
|
1133
|
+
const readable = maskStringsKeepTemplates(code);
|
|
1134
|
+
const scanDecls = structDecls(masked, readable);
|
|
811
1135
|
structFileCache.set(scan.filePath, scanDecls);
|
|
812
|
-
const builders = memberBuildersOf(masked);
|
|
1136
|
+
const builders = memberBuildersOf(masked, readable);
|
|
813
1137
|
|
|
814
1138
|
// ---- [alpha-scale-mismatch]
|
|
815
1139
|
for (const m of masked.matchAll(/\bsetAlphaComponent\s*\(/g)) {
|
|
@@ -1005,6 +1329,110 @@ class ArkUIRuntimePitfallCheck extends GlobalChecker {
|
|
|
1005
1329
|
[structName || 'this input'], AlertLevel.WARN);
|
|
1006
1330
|
}
|
|
1007
1331
|
}
|
|
1332
|
+
|
|
1333
|
+
// ---- [foreach-key-stale-render] (WARN) — an identity-only key cannot follow the
|
|
1334
|
+
// content: ForEach does not re-run the item generator while the key is unchanged, so
|
|
1335
|
+
// data replaced with the same id (new content) never re-renders. Reported only when
|
|
1336
|
+
// the key carries at most one member of the item (the `${item}-${id}` shape), which
|
|
1337
|
+
// keeps the signal on the risky pattern and off keys that already mix in changing
|
|
1338
|
+
// fields. When the generator hands the whole object to a child component, the message
|
|
1339
|
+
// resolves that child's @Param reads (same file or relative import) and lists the
|
|
1340
|
+
// fields it actually renders; an unresolved child keeps the generic phrase.
|
|
1341
|
+
for (const m of masked.matchAll(/\bForEach\s*\(/g)) {
|
|
1342
|
+
const open = m.index + m[0].length - 1;
|
|
1343
|
+
const close = matchBracket(code, open);
|
|
1344
|
+
if (close < 0) { continue; }
|
|
1345
|
+
const parts = splitTopLevelAt(code.slice(open + 1, close));
|
|
1346
|
+
if (parts.length < 3) { continue; } // no keyGenerator: another rule covers it
|
|
1347
|
+
if (/^\s*\[/.test(parts[0].text)) { continue; } // array literal: no identity updates
|
|
1348
|
+
const keyExpr = parts[2].text;
|
|
1349
|
+
if (/JSON\s*\.\s*stringify|=>\s*this\s*\.|=>\s*[A-Za-z_$][\w$]*\s*\.\s*[A-Za-z_$][\w$]*\s*\(/.test(keyExpr)) {
|
|
1350
|
+
continue; // opaque key helper: cannot judge
|
|
1351
|
+
}
|
|
1352
|
+
const gen = parts[1].text;
|
|
1353
|
+
const pm = /^\s*\(\s*([A-Za-z_$][\w$]*)/.exec(gen) || /^\s*([A-Za-z_$][\w$]*)\s*=>/.exec(gen);
|
|
1354
|
+
const arrow = gen.indexOf('=>');
|
|
1355
|
+
if (pm === null || arrow < 0) { continue; }
|
|
1356
|
+
const item = pm[1];
|
|
1357
|
+
const body = gen.slice(arrow + 2);
|
|
1358
|
+
const escaped = item.replace(/\$/g, '\\$');
|
|
1359
|
+
if (new RegExp(String.raw`\$\{\s*` + escaped + String.raw`\s*\}`).test(keyExpr)) {
|
|
1360
|
+
continue; // whole item interpolated: key always varies
|
|
1361
|
+
}
|
|
1362
|
+
const keyMembers = new Set();
|
|
1363
|
+
for (const km of keyExpr.matchAll(/([A-Za-z_$][\w$]*)\s*\.\s*([A-Za-z_$][\w$]*)/g)) {
|
|
1364
|
+
if (km[1] !== 'this') { keyMembers.add(km[2]); }
|
|
1365
|
+
}
|
|
1366
|
+
if (keyMembers.size > 1) { continue; } // key already mixes several fields
|
|
1367
|
+
const keyIds = new Set();
|
|
1368
|
+
for (const t of keyExpr.matchAll(/[A-Za-z_$][\w$]*/g)) { keyIds.add(t[0]); }
|
|
1369
|
+
const structural = maskStrings(body);
|
|
1370
|
+
const bodyReadable = maskStringsKeepTemplates(body);
|
|
1371
|
+
const fields = new Set();
|
|
1372
|
+
for (const f of bodyReadable.matchAll(new RegExp(String.raw`\b` + escaped + String.raw`\s*\.\s*([A-Za-z_$][\w$]*)`, 'g'))) {
|
|
1373
|
+
fields.add(f[1]);
|
|
1374
|
+
}
|
|
1375
|
+
const whole = new RegExp(String.raw`\b` + escaped + String.raw`\b(?!\s*\.)`).test(structural);
|
|
1376
|
+
const missing = [...fields].filter((f) => !keyIds.has(f));
|
|
1377
|
+
if (missing.length === 0 && !whole) { continue; }
|
|
1378
|
+
const line = lineOfIndex(code, open);
|
|
1379
|
+
const rawLines = scan.raw.split(/\r?\n/);
|
|
1380
|
+
const closed = [line, line - 1].some((l) =>
|
|
1381
|
+
rawLines[l - 1] !== undefined && /\/\/\s*FOREACH-KEY\s*[::]/.test(rawLines[l - 1]));
|
|
1382
|
+
if (closed) { continue; }
|
|
1383
|
+
const structName = enclosingStructName(masked, open) || 'this component';
|
|
1384
|
+
if (missing.length > 0) {
|
|
1385
|
+
this.report(scan.filePath, line, 'foreachKey',
|
|
1386
|
+
[structName, missing.slice(0, 5).join(', ')], AlertLevel.WARN);
|
|
1387
|
+
} else {
|
|
1388
|
+
// Whole-object hand-off: name the receiver and the fields it renders. A child component
|
|
1389
|
+
// is resolved through its @Param; an in-file @Builder through its parameter; anything
|
|
1390
|
+
// else degrades to a generic phrase (still reported — see the rule doc).
|
|
1391
|
+
const receivers = itemReceivers(structural, item);
|
|
1392
|
+
const labels = [];
|
|
1393
|
+
const rendered = new Set();
|
|
1394
|
+
const visited = new Set();
|
|
1395
|
+
for (const r of receivers) {
|
|
1396
|
+
const child = structInfoFor(r.name, scan, scanDecls, structFileCache);
|
|
1397
|
+
if (child === null) { continue; }
|
|
1398
|
+
const isParam = child.params !== undefined && child.params.has(r.prop);
|
|
1399
|
+
const before = labels.length;
|
|
1400
|
+
for (const f of renderedFieldsOfChild(
|
|
1401
|
+
child, r.prop, scan, scanDecls, structFileCache, 1, visited, labels
|
|
1402
|
+
)) {
|
|
1403
|
+
if (!keyIds.has(f)) { rendered.add(f); }
|
|
1404
|
+
}
|
|
1405
|
+
if (!isParam && labels.length > before) { labels[before] = r.name; }
|
|
1406
|
+
}
|
|
1407
|
+
let builderDesc = '';
|
|
1408
|
+
if (receivers.length === 0) {
|
|
1409
|
+
const bm = new RegExp(
|
|
1410
|
+
String.raw`\bthis\s*\.\s*([A-Za-z_$][\w$]*)\s*\(\s*` + escapeRe(item) + String.raw`\s*[,)]`
|
|
1411
|
+
).exec(structural);
|
|
1412
|
+
const builder = bm === null ? undefined : builders.get(bm[1]);
|
|
1413
|
+
if (builder !== undefined) {
|
|
1414
|
+
builderDesc = `this.${bm[1]}`;
|
|
1415
|
+
const param = /^\s*(?:\(\s*)?([A-Za-z_$][\w$]*)/.exec(builder.params !== undefined ? builder.params : '');
|
|
1416
|
+
if (param !== null) {
|
|
1417
|
+
const pre = new RegExp(String.raw`\b` + escapeRe(param[1]) + String.raw`\s*\.\s*([A-Za-z_$][\w$]*)`, 'g');
|
|
1418
|
+
let fm = null;
|
|
1419
|
+
while ((fm = pre.exec(builder.bodyReadable !== undefined ? builder.bodyReadable : builder.body)) !== null) {
|
|
1420
|
+
if (!keyIds.has(fm[1])) { rendered.add(fm[1]); }
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
const childDesc = labels.length > 0
|
|
1426
|
+
? labels.slice(0, 3).join(' / ')
|
|
1427
|
+
: builderDesc !== '' ? builderDesc
|
|
1428
|
+
: { en: 'a child component', cn: '子组件' };
|
|
1429
|
+
const fieldDesc = rendered.size > 0
|
|
1430
|
+
? [...rendered].slice(0, 6).join(', ')
|
|
1431
|
+
: { en: 'content derived from that object', cn: '与该对象相关的内容' };
|
|
1432
|
+
this.report(scan.filePath, line, 'foreachKeyWhole',
|
|
1433
|
+
[structName, childDesc, fieldDesc], AlertLevel.WARN);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1008
1436
|
}
|
|
1009
1437
|
|
|
1010
1438
|
// ---- 2-arg connects graded with project knowledge (see the collection comment above):
|
|
@@ -1049,6 +1477,35 @@ class ArkUIRuntimePitfallCheck extends GlobalChecker {
|
|
|
1049
1477
|
[site.key, who], insideTryBlock(site) ? AlertLevel.WARN : AlertLevel.ERROR);
|
|
1050
1478
|
}
|
|
1051
1479
|
}
|
|
1480
|
+
|
|
1481
|
+
// ---- [sql-identifier-quoting] (WARN): SQLite only accepts a keyword as an identifier when it
|
|
1482
|
+
// is in its %fallback list. `store.insert/batchInsert` build `INSERT … (key,…)` from the
|
|
1483
|
+
// ValuesBucket keys verbatim, so a column/key named `from` (or `index`, `order`, …) can never
|
|
1484
|
+
// be written. The schema is project-wide, so it is collected once from every scanned file.
|
|
1485
|
+
const sqlSchema = [];
|
|
1486
|
+
const sqlConsts = new Map();
|
|
1487
|
+
for (const scan of scans) {
|
|
1488
|
+
for (const [name, value] of sqlAnalysis.stringConstants(scan.code)) {
|
|
1489
|
+
if (!sqlConsts.has(name)) { sqlConsts.set(name, value); }
|
|
1490
|
+
}
|
|
1491
|
+
if (/CREATE\s+TABLE/i.test(scan.code)) {
|
|
1492
|
+
for (const table of sqlAnalysis.ddlTables(scan.code)) { sqlSchema.push(table); }
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
for (const scan of scans) {
|
|
1496
|
+
for (const finding of sqlAnalysis.analyzeText(scan.code, sqlSchema, sqlConsts)) {
|
|
1497
|
+
const ids = (finding.identifiers || []).join(', ');
|
|
1498
|
+
if (finding.code === 'ddl-column-needs-quote') {
|
|
1499
|
+
this.report(scan.filePath, finding.line, 'sqlDdl', [finding.table, ids], AlertLevel.WARN);
|
|
1500
|
+
} else if (finding.code === 'valuesbucket-key-needs-quote') {
|
|
1501
|
+
this.report(scan.filePath, finding.line, 'sqlValuesKey', [ids, ids], AlertLevel.WARN);
|
|
1502
|
+
} else if (finding.code === 'rdb-raw-insert') {
|
|
1503
|
+
this.report(scan.filePath, finding.line, 'sqlRawInsert', [ids, finding.api], AlertLevel.WARN);
|
|
1504
|
+
} else {
|
|
1505
|
+
this.report(scan.filePath, finding.line, 'sqlIdentifier', [ids, ids], AlertLevel.WARN);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1052
1509
|
}
|
|
1053
1510
|
}
|
|
1054
1511
|
|