@buaa_smat/hometrans 26.0.5 → 26.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +249 -279
- package/agents/code-reviewer.md +1 -1
- package/dist/cli/editors.json +20 -0
- package/dist/platform/registry.js +1 -0
- package/dist/platform/validate.js +2 -1
- package/i18n/agents/code-reviewer.md +1 -1
- package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
- package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
- package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/package.json +2 -1
- package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/skills/a2h-app-migrate/SKILL.md +31 -14
- package/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
- package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
- package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
- package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
- package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
- package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
- package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +1 -1
- package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
- package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
- package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
- package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
- package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
- package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
- package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
- package/skills/a2h-page-specgen/SKILL.md +36 -5
- package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
- package/skills/a2h-page-specgen/references/evidence.md +2 -1
- package/skills/a2h-page-specgen/references/execution-model.md +13 -5
- package/skills/a2h-page-specgen/references/gates.md +33 -7
- package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
- package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
- package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
- package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
- package/skills/a2h-resource-convert/SKILL.md +1 -1
- package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
- package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
- package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
- package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
- package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
- package/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
- package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
- package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
- package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
- package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
- package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
- package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
- package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
- package/skills/a2h-utg-static/SKILL.md +3 -3
- package/skills/a2h-utg-static/references/extractors.md +7 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
- package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
- package/resource/convert_pipeline_process.svg +0 -114
- package/resource/project_architecture.svg +0 -120
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// overlay_effects: host effects of overlay edges in the group pack and the phase5_check gate
|
|
2
|
+
// (overlay-effect-uncovered / effect-marker-detached).
|
|
3
|
+
// Lead case: ydweather ds-1126, opening the daily detail from MainPage dropped
|
|
4
|
+
// WeatherDailyPanel.kt:189 showHideWeatherContent?.invoke(false) (the weather cards fade to the background).
|
|
5
|
+
// Run from scripts/: node --test tests/overlay_effects.test.mjs
|
|
6
|
+
import { test } from 'node:test';
|
|
7
|
+
import assert from 'node:assert/strict';
|
|
8
|
+
import * as fs from 'node:fs';
|
|
9
|
+
import * as os from 'node:os';
|
|
10
|
+
import * as path from 'node:path';
|
|
11
|
+
|
|
12
|
+
import { effectCoverage, loadEffects, realStatement, renderEffectsSection } from '../overlay_effects.mjs';
|
|
13
|
+
import * as pc from '../phase5_check.mjs';
|
|
14
|
+
|
|
15
|
+
const OPEN = 'fx:WeatherDailyPanel.kt:189';
|
|
16
|
+
const DISMISS = 'fx:WeatherDailyPanel.kt:94';
|
|
17
|
+
const EDGE = { source: 'activity:Main', target: 'overlay:DailyDetail', mechanism: 'open-overlay', trigger: 'WeatherDailyPanel.kt:186',
|
|
18
|
+
host_effects: {
|
|
19
|
+
open: [{ id: OPEN, stmt: 'showHideWeatherContent?.invoke(false)', at: 'w/WeatherDailyPanel.kt:189',
|
|
20
|
+
resolved: [{ stmt: 'contentOpacity = if (show) 1f else 0f', at: 'w/WeatherContentList.kt:59' }] }],
|
|
21
|
+
dismiss: [{ id: DISMISS, stmt: 'showHideWeatherContent?.invoke(true)', at: 'w/WeatherDailyPanel.kt:94', resolved: [] }],
|
|
22
|
+
} };
|
|
23
|
+
|
|
24
|
+
const MAIN = (openMark, dismissMark) => `@Entry
|
|
25
|
+
@ComponentV2
|
|
26
|
+
struct MainPage {
|
|
27
|
+
@Local contentOpacity: number = 1;
|
|
28
|
+
build() {
|
|
29
|
+
Column() {
|
|
30
|
+
DailyPanel({
|
|
31
|
+
onRowClick: (index: number) => {
|
|
32
|
+
this.showDailyDetail = true;
|
|
33
|
+
${openMark}
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
if (this.showDailyDetail) {
|
|
37
|
+
DailyDetail({ onDismiss: () => {
|
|
38
|
+
this.showDailyDetail = false;
|
|
39
|
+
${dismissMark}
|
|
40
|
+
} })
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const BOTH = MAIN(` // EFFECT: ${OPEN}\n this.contentOpacity = 0;`, ` this.contentOpacity = 1; // EFFECT: ${DISMISS}`);
|
|
47
|
+
const cov = (src, opts = {}) => effectCoverage({ edges: [EDGE], files: [['pages/MainPage.ets', src]], ...opts });
|
|
48
|
+
|
|
49
|
+
test('both effects marked on their statements: nothing to report', () => {
|
|
50
|
+
const r = cov(BOTH);
|
|
51
|
+
assert.deepEqual([r.gate, r.cand, r.checked], [[], [], 2]);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('the ydweather shape (only the overlay flag set) is GATE overlay-effect-uncovered for each effect', () => {
|
|
55
|
+
const r = cov(MAIN('', ''));
|
|
56
|
+
assert.equal(r.gate.length, 2);
|
|
57
|
+
assert.match(r.gate[0], /^overlay-effect-uncovered {2}fx:WeatherDailyPanel\.kt:189 \(activity:Main → overlay:DailyDetail open\)/);
|
|
58
|
+
assert.match(r.gate[1], /fx:WeatherDailyPanel\.kt:94 .*dismiss/);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('a marker with no statement after it is GATE effect-marker-detached and covers nothing', () => {
|
|
62
|
+
const r = cov(MAIN(` // EFFECT: ${OPEN}\n // TODO fade the cards\n\n `, ` this.contentOpacity = 1; // EFFECT: ${DISMISS}`));
|
|
63
|
+
assert.equal(r.gate.length, 2);
|
|
64
|
+
assert.match(r.gate[0], /^effect-marker-detached {2}pages\/MainPage\.ets:\d+ \/\/ EFFECT: fx:WeatherDailyPanel\.kt:189/);
|
|
65
|
+
assert.match(r.gate[1], /^overlay-effect-uncovered {2}fx:WeatherDailyPanel\.kt:189/);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('EFFECT-OMIT with a basis waives an effect; without one it does not', () => {
|
|
69
|
+
const ok = cov(MAIN(` // EFFECT-OMIT: ${OPEN} — HarmonyOS detail is a full-screen sheet, nothing shows through`,
|
|
70
|
+
` this.contentOpacity = 1; // EFFECT: ${DISMISS}`));
|
|
71
|
+
assert.deepEqual(ok.gate, []);
|
|
72
|
+
const bare = cov(MAIN(` // EFFECT-OMIT: ${OPEN}`, ` this.contentOpacity = 1; // EFFECT: ${DISMISS}`));
|
|
73
|
+
assert.equal(bare.gate.length, 1);
|
|
74
|
+
assert.match(bare.gate[0], /EFFECT-OMIT at pages\/MainPage\.ets:\d+ has no basis/);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test('group mode: only edges touching members; an opener outside the group is a candidate; shared files cover', () => {
|
|
78
|
+
assert.deepEqual(cov(MAIN('', ''), { members: new Set(['activity:Other']) }).checked, 0);
|
|
79
|
+
const overlayGroup = cov('', { members: new Set(['overlay:DailyDetail']) });
|
|
80
|
+
assert.deepEqual([overlayGroup.gate.length, overlayGroup.cand.length], [0, 2]);
|
|
81
|
+
const viaShared = effectCoverage({ edges: [EDGE], members: new Set(['activity:Main']), files: [['components/X.ets', '']],
|
|
82
|
+
shared: [['pages/MainPage.ets', BOTH]] });
|
|
83
|
+
assert.deepEqual(viaShared.gate, []);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('realStatement: assignments and calls count; comments, braces, control heads and UI components do not', () => {
|
|
87
|
+
for (const s of ['this.a = 0;', 'this.vm.show(false)', 'this.n++', 'this.cb?.(true)', "animateTo({ duration: 200 }, () => {"]) { assert.ok(realStatement(s), s); }
|
|
88
|
+
for (const s of ['', '// x', '})', '} else {', 'if (this.a) {', "Column() {", ' * doc']) { assert.ok(!realStatement(s), s); }
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('an old UTG (no host_effects) is skipped silently', () => {
|
|
92
|
+
const r = effectCoverage({ edges: [{ ...EDGE, host_effects: undefined }], files: [['pages/MainPage.ets', MAIN('', '')]] });
|
|
93
|
+
assert.deepEqual([r.gate, r.cand, r.checked], [[], [], 0]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('the group pack section lists id, stmt, at and resolved statements with the marker rule', () => {
|
|
97
|
+
const md = renderEffectsSection([EDGE]).join('\n');
|
|
98
|
+
assert.match(md, /## Overlay host effects/);
|
|
99
|
+
assert.match(md, /- open `fx:WeatherDailyPanel\.kt:189`: `showHideWeatherContent\?\.invoke\(false\)` at `w\/WeatherDailyPanel\.kt:189`/);
|
|
100
|
+
assert.match(md, /resolves to `contentOpacity = if \(show\) 1f else 0f` at `w\/WeatherContentList\.kt:59`/);
|
|
101
|
+
assert.match(md, /not resolved upstream/);
|
|
102
|
+
assert.match(md, /\/\/ EFFECT: <id>/);
|
|
103
|
+
assert.match(md, /\/\/ EFFECT-OMIT: <id> — <basis>/);
|
|
104
|
+
assert.deepEqual(renderEffectsSection([{ ...EDGE, host_effects: { open: [], dismiss: [] } }]), []);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('loadEffects reads conversion_set.json, else the page meta.json edge views', () => {
|
|
108
|
+
const ui = fs.mkdtempSync(path.join(os.tmpdir(), 'fx-ui-'));
|
|
109
|
+
try {
|
|
110
|
+
fs.mkdirSync(path.join(ui, 'page_0002_DailyDetail'));
|
|
111
|
+
fs.writeFileSync(path.join(ui, 'page_0002_DailyDetail', 'meta.json'), JSON.stringify({ static_node: 'overlay:DailyDetail',
|
|
112
|
+
reached_from: [{ source: 'activity:Main', mechanism: 'open-overlay', trigger: EDGE.trigger, host_effects: EDGE.host_effects }] }));
|
|
113
|
+
assert.deepEqual(loadEffects(ui).map((e) => [e.source, e.target]), [['activity:Main', 'overlay:DailyDetail']]);
|
|
114
|
+
fs.writeFileSync(path.join(ui, 'conversion_set.json'), JSON.stringify({ nodes: [], overlay_effects: [] }));
|
|
115
|
+
assert.deepEqual(loadEffects(ui), []);
|
|
116
|
+
} finally {
|
|
117
|
+
fs.rmSync(ui, { recursive: true, force: true });
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('phase5_check --group gates the group, --files gates every converted page, and render prints [effects]', () => {
|
|
122
|
+
const hp = fs.mkdtempSync(path.join(os.tmpdir(), 'fx-p5-'));
|
|
123
|
+
const realGate = pc.hooks.staticGate;
|
|
124
|
+
try {
|
|
125
|
+
const meta = path.join(hp, '.hometrans');
|
|
126
|
+
fs.mkdirSync(path.join(meta, 'ui_info'), { recursive: true });
|
|
127
|
+
fs.writeFileSync(path.join(meta, 'batch_progress.json'), JSON.stringify({ ui_module: 'entry', paradigm: 'V2' }));
|
|
128
|
+
fs.writeFileSync(path.join(meta, 'ui_info', 'conversion_set.json'), JSON.stringify({
|
|
129
|
+
nodes: [{ node: 'activity:Main', role: 'page' }, { node: 'overlay:DailyDetail', role: 'page' }],
|
|
130
|
+
plan: { groups: [{ id: 'G1', members: [{ node: 'activity:Main' }], page_dirs: [] }] }, overlay_effects: [EDGE] }));
|
|
131
|
+
const ets = path.join(hp, 'entry', 'src', 'main', 'ets', 'pages');
|
|
132
|
+
fs.mkdirSync(ets, { recursive: true });
|
|
133
|
+
fs.writeFileSync(path.join(ets, 'MainPage.ets'), MAIN('', ''));
|
|
134
|
+
pc.hooks.staticGate = () => [{ mine: [], batch_level: 0 }, null];
|
|
135
|
+
const g = pc.check(hp, ['pages/MainPage.ets'], null, 'G1');
|
|
136
|
+
assert.equal(g.effects.gate.length, 2);
|
|
137
|
+
assert.match(pc.render(g), /\[effects\] overlay host effects vs \/\/ EFFECT markers \(2 effects\): GATE 2/);
|
|
138
|
+
const before = pc.check(hp, ['pages/MainPage.ets']).blocking;
|
|
139
|
+
fs.writeFileSync(path.join(ets, 'MainPage.ets'), BOTH);
|
|
140
|
+
const f = pc.check(hp, ['pages/MainPage.ets']);
|
|
141
|
+
assert.deepEqual(f.effects.gate, []);
|
|
142
|
+
assert.equal(before - f.blocking, 2);
|
|
143
|
+
} finally {
|
|
144
|
+
pc.hooks.staticGate = realGate;
|
|
145
|
+
fs.rmSync(hp, { recursive: true, force: true });
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('phase5_check --files finds an EFFECT marker in a feature module it was not given', () => {
|
|
150
|
+
const hp = fs.mkdtempSync(path.join(os.tmpdir(), 'fx-p5m-'));
|
|
151
|
+
const realGate = pc.hooks.staticGate;
|
|
152
|
+
try {
|
|
153
|
+
const meta = path.join(hp, '.hometrans');
|
|
154
|
+
fs.mkdirSync(path.join(meta, 'ui_info'), { recursive: true });
|
|
155
|
+
fs.writeFileSync(path.join(meta, 'batch_progress.json'), JSON.stringify({ ui_module: 'entry', paradigm: 'V2' }));
|
|
156
|
+
fs.writeFileSync(path.join(meta, 'ui_info', 'conversion_set.json'), JSON.stringify({
|
|
157
|
+
nodes: [{ node: 'activity:Main', role: 'page' }, { node: 'overlay:DailyDetail', role: 'page' }],
|
|
158
|
+
plan: { groups: [{ id: 'G1', members: [{ node: 'activity:Main' }], page_dirs: [] }] }, overlay_effects: [EDGE] }));
|
|
159
|
+
const ui = path.join(hp, 'entry', 'src', 'main', 'ets', 'pages');
|
|
160
|
+
const feat = path.join(hp, 'features', 'weather', 'src', 'main', 'ets', 'pages');
|
|
161
|
+
fs.mkdirSync(ui, { recursive: true });
|
|
162
|
+
fs.mkdirSync(feat, { recursive: true });
|
|
163
|
+
fs.writeFileSync(path.join(ui, 'Index.ets'), '@Entry\n@Component\nstruct Index { build() { Column() {} } }\n');
|
|
164
|
+
// same file name in both modules: the UI one has no marker, the feature one has both
|
|
165
|
+
fs.writeFileSync(path.join(ui, 'MainPage.ets'), MAIN('', ''));
|
|
166
|
+
fs.writeFileSync(path.join(feat, 'MainPage.ets'), BOTH);
|
|
167
|
+
pc.hooks.staticGate = () => [{ mine: [], batch_level: 0 }, null];
|
|
168
|
+
const f = pc.check(hp, ['pages/Index.ets']);
|
|
169
|
+
assert.deepEqual(f.effects.gate, []);
|
|
170
|
+
} finally {
|
|
171
|
+
pc.hooks.staticGate = realGate;
|
|
172
|
+
fs.rmSync(hp, { recursive: true, force: true });
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('an EFFECT id followed by punctuation still matches its effect', () => {
|
|
177
|
+
const src = MAIN(` // EFFECT: ${OPEN},隐藏内容\n this.contentOpacity = 0;`, ` this.contentOpacity = 1; // EFFECT: ${DISMISS}.`);
|
|
178
|
+
assert.deepEqual(cov(src).gate, []);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test('a path:line:column id is matched; its trailing punctuation is not part of it', () => {
|
|
182
|
+
const id = 'fx:app/src/main/java/w/WeatherDailyPanel.kt:189:13';
|
|
183
|
+
const e = { ...EDGE, host_effects: { open: [{ ...EDGE.host_effects.open[0], id }], dismiss: [] } };
|
|
184
|
+
const src = MAIN(` // EFFECT: ${id},隐藏内容\n this.contentOpacity = 0;`, '');
|
|
185
|
+
assert.deepEqual(effectCoverage({ edges: [e], files: [['pages/MainPage.ets', src]] }).gate, []);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test('one id on two edges: a member opener decides GATE, whichever edge comes first', () => {
|
|
189
|
+
const other = { ...EDGE, source: 'activity:Other' };
|
|
190
|
+
for (const edges of [[other, EDGE], [EDGE, other]]) {
|
|
191
|
+
// the group converts the host and the overlay: the other host's edge is in scope too, through the overlay
|
|
192
|
+
const r = effectCoverage({ edges, members: new Set(['activity:Main', 'overlay:DailyDetail']), files: [['pages/MainPage.ets', MAIN('', '')]] });
|
|
193
|
+
assert.equal(r.gate.length, 2, JSON.stringify(edges.map((x) => x.source)));
|
|
194
|
+
assert.equal(r.cand.length, 0);
|
|
195
|
+
assert.equal(r.checked, 2);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test('ids whose path has non-ASCII, +, @ or a drive letter are still matched; the line number ends them', () => {
|
|
200
|
+
for (const id of ['fx:app/src/天气/Panel.kt:12:3', 'fx:app/src/a+b@c/Panel.kt:12:3', 'fx:C:/w/app/Panel.kt:12:3']) {
|
|
201
|
+
const e = { ...EDGE, host_effects: { open: [{ ...EDGE.host_effects.open[0], id }], dismiss: [] } };
|
|
202
|
+
const src = MAIN(` // EFFECT: ${id}。\n this.contentOpacity = 0;`, '');
|
|
203
|
+
assert.deepEqual(effectCoverage({ edges: [e], files: [['pages/MainPage.ets', src]] }).gate, [], id);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test('EFFECT-OMIT with a colon after the id still reads the id and its basis', () => {
|
|
208
|
+
const id = 'fx:app/w/WeatherDailyPanel.kt:189:13';
|
|
209
|
+
const e = { ...EDGE, host_effects: { open: [{ ...EDGE.host_effects.open[0], id }], dismiss: [] } };
|
|
210
|
+
const src = MAIN(` // EFFECT-OMIT: ${id}: HarmonyOS 的详情页是全屏页面,宿主卡片不可见`, '');
|
|
211
|
+
assert.deepEqual(effectCoverage({ edges: [e], files: [['pages/MainPage.ets', src]] }).gate, []);
|
|
212
|
+
const old = MAIN(` // EFFECT-OMIT: ${OPEN}: 详情页全屏覆盖宿主`, '');
|
|
213
|
+
assert.ok(!cov(old).gate.some((g) => g.includes(OPEN)), 'the older fx:<file>:<line> form too');
|
|
214
|
+
});
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
- **Date**: 2026-03-27
|
|
24
24
|
- **Error code**: `arkts-identifiers-as-prop-names`
|
|
25
25
|
- **Frequency**: 85 occurrences
|
|
26
|
-
- **Source**:
|
|
26
|
+
- **Source**: a V1 migration retrospective (a2h-retrospect-report-2026-03-27)
|
|
27
27
|
|
|
28
28
|
**Error code**:
|
|
29
29
|
```typescript
|
|
@@ -49,7 +49,7 @@ bucket[ColumnName.URL] = url;
|
|
|
49
49
|
- **Date**: 2026-03-27
|
|
50
50
|
- **Error code**: type mismatch
|
|
51
51
|
- **Frequency**: 16 occurrences
|
|
52
|
-
- **Source**:
|
|
52
|
+
- **Source**: a V1 migration retrospective (a2h-retrospect-report-2026-03-27)
|
|
53
53
|
|
|
54
54
|
**Error code**:
|
|
55
55
|
```typescript
|
|
@@ -75,7 +75,7 @@ emitter.on({ eventId: 1 }, (data: emitter.EventData) => {
|
|
|
75
75
|
- **Date**: 2026-03-27
|
|
76
76
|
- **Error code**: `arkts-no-untyped-obj-literals`
|
|
77
77
|
- **Frequency**: 9 occurrences
|
|
78
|
-
- **Source**:
|
|
78
|
+
- **Source**: a V1 migration retrospective (a2h-retrospect-report-2026-03-27)
|
|
79
79
|
|
|
80
80
|
**Error code**:
|
|
81
81
|
```typescript
|
|
@@ -106,7 +106,7 @@ const options: DialogOptions = {
|
|
|
106
106
|
- **Date**: 2026-03-27
|
|
107
107
|
- **Error code**: type mismatch
|
|
108
108
|
- **Frequency**: 8 occurrences
|
|
109
|
-
- **Source**:
|
|
109
|
+
- **Source**: a V1 migration retrospective (a2h-retrospect-report-2026-03-27)
|
|
110
110
|
|
|
111
111
|
**Error code**:
|
|
112
112
|
```typescript
|
|
@@ -136,7 +136,7 @@ promptAction.showDialog({
|
|
|
136
136
|
- **Date**: 2026-03-27
|
|
137
137
|
- **Error code**: type error
|
|
138
138
|
- **Frequency**: 3 occurrences
|
|
139
|
-
- **Source**:
|
|
139
|
+
- **Source**: a V1 migration retrospective (a2h-retrospect-report-2026-03-27)
|
|
140
140
|
|
|
141
141
|
**Error code**:
|
|
142
142
|
```typescript
|
|
@@ -200,8 +200,9 @@ Rules:
|
|
|
200
200
|
- keep every existing tree line, with its type comment, including directories not yet present in code;
|
|
201
201
|
- add directories from `project_structure_tree` that the existing tree lacks, under their parent, without a type comment unless the new directory is itself a registered module root;
|
|
202
202
|
- never collapse or re-nest existing capability packages to match the code's current layout;
|
|
203
|
-
- treat `incremental_mode` as `preserve` for the `模块语义` table (existing rows kept; rows added only for new targets; an existing row's 模块功能 may be refreshed from code, its path may not change).
|
|
203
|
+
- treat `incremental_mode` as `preserve` for the `模块语义` table (existing rows kept; rows added only for new targets; an existing row's 模块功能 may be refreshed from code, its path may not change; when an architecture baseline exists, rule 7 applies instead and the baseline's rows are kept verbatim).
|
|
204
204
|
Without type comments (a project_design.md this skill wrote itself, or a reconcile document of an existing project) rule 1 applies unchanged.
|
|
205
|
+
7. **The architecture baseline's `模块语义` rows are kept verbatim.** Before writing, run `node "${SKILL_DIR}/scripts/design_baseline.mjs" snapshot "<target_directory>"`. It copies the current `project_design.md` to `.hometrans/arch_baseline/project_design.md`, but only when no baseline exists yet and this skill has never committed a refresh. When a baseline exists, keep each of its `模块语义` rows, path and 模块功能 text alike, even where the code does not implement the module yet (for example a "脚手架占位:…当前实现暂落位于产品入口模块" text must not replace the design's text). New rows may still be added. `commit_module_state.mjs` refuses a refresh that drops or rewrites a baseline row, and records modules the design gives code but whose `src/main/ets` holds no `.ets` file in `.hometrans/design_drift.json`. A drift belongs in that report, never in the design.
|
|
205
206
|
|
|
206
207
|
### Step 6: Generate `module_design.md`
|
|
207
208
|
|
|
@@ -243,7 +244,7 @@ node "${SKILL_DIR}/scripts/commit_module_state.mjs" \
|
|
|
243
244
|
"<target_directory>"
|
|
244
245
|
```
|
|
245
246
|
|
|
246
|
-
This script validates generated documents, backs up the previous state when present, and atomically writes:
|
|
247
|
+
This script validates generated documents, checks `project_design.md` against the architecture baseline when one exists (Step 5 rule 7: exit 1 on a dropped or rewritten baseline row; `design_drift` in its output lists the empty design modules), backs up the previous state when present, and atomically writes:
|
|
247
248
|
|
|
248
249
|
```text
|
|
249
250
|
.hometrans/module_understanding/.module_semantic_docs_state.json
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
resolveLikePython,
|
|
20
20
|
expanduser,
|
|
21
21
|
} from "./lib/py_compat.mjs";
|
|
22
|
+
import { check as checkDesignBaseline } from "./design_baseline.mjs";
|
|
22
23
|
|
|
23
24
|
const MODULE_UNDERSTANDING_DIR = "module_understanding";
|
|
24
25
|
const MODULE_UPDATE_PLAN_JSON = "module_update_plan.json";
|
|
@@ -136,6 +137,14 @@ function main() {
|
|
|
136
137
|
|
|
137
138
|
validateGeneratedDocs(hometransDir, plan);
|
|
138
139
|
|
|
140
|
+
// The refresh must keep the architecture baseline's 模块语义 rows (design_baseline.mjs); code that
|
|
141
|
+
// drifted from the design is reported in design_drift.json, never written into the design.
|
|
142
|
+
const baseline = checkDesignBaseline(targetDir);
|
|
143
|
+
if (baseline.problems.length > 0) {
|
|
144
|
+
systemExit(`project_design.md departs from the architecture baseline ${baseline.baseline}:\n`
|
|
145
|
+
+ baseline.problems.map((p) => ` ${p}`).join("\n"));
|
|
146
|
+
}
|
|
147
|
+
|
|
139
148
|
const nextState = plan.next_state;
|
|
140
149
|
if (nextState === null || typeof nextState !== "object" || Array.isArray(nextState)) {
|
|
141
150
|
process.stdout.write(`${pyJsonDump({
|
|
@@ -161,6 +170,7 @@ function main() {
|
|
|
161
170
|
state_path: String(statePath),
|
|
162
171
|
backup_path: pathExists(backupPath) ? String(backupPath) : null,
|
|
163
172
|
modules_to_update: (plan.modules_to_update === undefined ? [] : plan.modules_to_update).length,
|
|
173
|
+
design_drift: baseline.drift.map((d) => d.module),
|
|
164
174
|
})}\n`);
|
|
165
175
|
return 0;
|
|
166
176
|
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// design_baseline.mjs — keep the architecture's design as the target while project_design.md is refreshed from code.
|
|
3
|
+
//
|
|
4
|
+
// node design_baseline.mjs snapshot <target_directory> [--force]
|
|
5
|
+
// Copy .hometrans/project_design.md to .hometrans/arch_baseline/project_design.md.
|
|
6
|
+
// --force (a2h-app-migrate, right after discover.arch wrote a fresh design): always copy.
|
|
7
|
+
// Without --force: copy only when no baseline exists and this skill has never committed a refresh
|
|
8
|
+
// (no .module_semantic_docs_state.json). The file is then still the architecture's own; once refreshed it
|
|
9
|
+
// may already describe the code, so it is not snapshotted then (prints a warning, exit 0).
|
|
10
|
+
//
|
|
11
|
+
// node design_baseline.mjs check <target_directory>
|
|
12
|
+
// Exit 1 when the refreshed project_design.md lost a baseline 模块语义 row or changed its text.
|
|
13
|
+
// Always rewrites .hometrans/design_drift.json: baseline module roots with no .ets file in their
|
|
14
|
+
// src/main/ets (the design gives them code, the code put it elsewhere or never wrote it).
|
|
15
|
+
//
|
|
16
|
+
// Why: the refresh rewrote features/weatherdisplay's row to "脚手架占位:…当前实现暂落位于产品入口模块"
|
|
17
|
+
// (WeatherApp 11-22), because the arch tree had no `# HAP/HAR` comments, so Step 5 rule 6 did not apply, and rule 6 lets
|
|
18
|
+
// 模块功能 be refreshed anyway. The spec stage copies that text, so the data layer followed the drift. A drift
|
|
19
|
+
// belongs in a report, never in the design.
|
|
20
|
+
import fs from "node:fs";
|
|
21
|
+
import path from "node:path";
|
|
22
|
+
import { fileURLToPath } from "node:url";
|
|
23
|
+
|
|
24
|
+
export const BASELINE_REL = path.join("arch_baseline", "project_design.md");
|
|
25
|
+
export const DRIFT_REL = "design_drift.json";
|
|
26
|
+
const STATE_REL = path.join("module_understanding", ".module_semantic_docs_state.json");
|
|
27
|
+
|
|
28
|
+
const isFile = (p) => { try { return fs.statSync(p).isFile(); } catch { return false; } };
|
|
29
|
+
const read = (p) => fs.readFileSync(p, "utf8").replace(/^/, "");
|
|
30
|
+
|
|
31
|
+
/** The 模块语义 table of a project_design.md: Map(path -> 模块功能), in file order. */
|
|
32
|
+
export function semanticsRows(text) {
|
|
33
|
+
const rows = new Map();
|
|
34
|
+
let inTable = false;
|
|
35
|
+
for (const line of String(text).split(/\r?\n/)) {
|
|
36
|
+
// the English SKILL.md names the same table "Module Semantics"; a reconcile document puts it under
|
|
37
|
+
// ###, and some designs number their sections ("## 3. 模块语义")
|
|
38
|
+
if (/^#{2,3}\s/.test(line)) { inTable = /^#{2,3}\s*(?:\d+[.、]\s*)?(?:模块语义|Module Semantics)/i.test(line); continue; }
|
|
39
|
+
if (!inTable) continue;
|
|
40
|
+
const m = /^\s*\|\s*([^|]+?)\s*\|\s*(.*?)\s*\|\s*$/.exec(line);
|
|
41
|
+
if (!m) continue;
|
|
42
|
+
const p = m[1].replace(/^`|`$/g, "").replace(/\\/g, "/").replace(/\/+$/, "");
|
|
43
|
+
if (/^-+$/.test(p.replace(/:/g, "")) || p === "模块路径" || /^module path$/i.test(p)) continue;
|
|
44
|
+
if (!rows.has(p)) rows.set(p, m[2]);
|
|
45
|
+
}
|
|
46
|
+
return rows;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function snapshot(target, { force = false } = {}) {
|
|
50
|
+
const meta = path.join(target, ".hometrans");
|
|
51
|
+
const src = path.join(meta, "project_design.md");
|
|
52
|
+
const dst = path.join(meta, BASELINE_REL);
|
|
53
|
+
if (!isFile(src)) return { snapshot: false, reason: `no ${src}` };
|
|
54
|
+
if (!force && isFile(dst)) return { snapshot: false, reason: "baseline exists", baseline: dst };
|
|
55
|
+
if (!force && isFile(path.join(meta, STATE_REL))) {
|
|
56
|
+
return { snapshot: false, reason: "project_design.md was already refreshed from code: not a design baseline", warning: true };
|
|
57
|
+
}
|
|
58
|
+
fs.mkdirSync(path.dirname(dst), { recursive: true });
|
|
59
|
+
fs.copyFileSync(src, dst);
|
|
60
|
+
return { snapshot: true, baseline: dst };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Row text as compared: backticks dropped, full-width ASCII and the ideographic space folded to their
|
|
65
|
+
* ASCII forms, whitespace ignored. A re-typed row that only changed those is the same row.
|
|
66
|
+
*/
|
|
67
|
+
export function normRowText(s) {
|
|
68
|
+
return String(s)
|
|
69
|
+
.replace(/[!-~]/g, (c) => String.fromCharCode(c.charCodeAt(0) - 0xFEE0))
|
|
70
|
+
.replace(/ /g, " ")
|
|
71
|
+
.replace(/`/g, "")
|
|
72
|
+
.replace(/\s+/g, "");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Baseline rows the refreshed document dropped or rewrote. */
|
|
76
|
+
export function preservationProblems(baselineText, currentText) {
|
|
77
|
+
const want = semanticsRows(baselineText);
|
|
78
|
+
const have = semanticsRows(currentText);
|
|
79
|
+
const out = [];
|
|
80
|
+
for (const [p, text] of want) {
|
|
81
|
+
if (!have.has(p)) out.push(`row ${p} of the architecture baseline is missing`);
|
|
82
|
+
else if (normRowText(have.get(p)) !== normRowText(text)) out.push(`row ${p} changed: keep the baseline text "${text.slice(0, 60)}"; report the code state in design_drift.json instead`);
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function countEts(dir) {
|
|
88
|
+
let n = 0;
|
|
89
|
+
let entries;
|
|
90
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return 0; }
|
|
91
|
+
for (const e of entries) {
|
|
92
|
+
if (e.isDirectory()) n += countEts(path.join(dir, e.name));
|
|
93
|
+
else if (e.name.endsWith(".ets")) n += 1;
|
|
94
|
+
}
|
|
95
|
+
return n;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The module root of a 模块语义 row: a2h-arch-generate gives every capability package
|
|
100
|
+
* `<module>/src/main/ets/<capability>` a row and the module root none; older designs list module roots.
|
|
101
|
+
*/
|
|
102
|
+
export function moduleRootOf(p) {
|
|
103
|
+
const m = /^(.+?)\/src\/main\/ets(?:\/.*)?$/.exec(p);
|
|
104
|
+
return m ? m[1] : p;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Baseline module roots (a module.json5 on disk) that hold no .ets file; capability rows fold into their root. */
|
|
108
|
+
export function drift(target, baselineText) {
|
|
109
|
+
const roots = new Map();
|
|
110
|
+
for (const [p, text] of semanticsRows(baselineText)) {
|
|
111
|
+
const r = moduleRootOf(p);
|
|
112
|
+
roots.set(r, roots.has(r) ? `${roots.get(r)}; ${text}` : text);
|
|
113
|
+
}
|
|
114
|
+
const out = [];
|
|
115
|
+
for (const [p, text] of roots) {
|
|
116
|
+
const root = path.join(target, p);
|
|
117
|
+
if (!isFile(path.join(root, "src", "main", "module.json5"))) continue;
|
|
118
|
+
if (countEts(path.join(root, "src", "main", "ets")) === 0) out.push({ module: p, kind: "empty_design_module", design: text });
|
|
119
|
+
}
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function check(target) {
|
|
124
|
+
const meta = path.join(target, ".hometrans");
|
|
125
|
+
const base = path.join(meta, BASELINE_REL);
|
|
126
|
+
if (!isFile(base)) return { baseline: null, problems: [], drift: [] };
|
|
127
|
+
const baseText = read(base);
|
|
128
|
+
const cur = path.join(meta, "project_design.md");
|
|
129
|
+
const problems = isFile(cur) ? preservationProblems(baseText, read(cur)) : [`missing ${cur}`];
|
|
130
|
+
// a heading the parser does not know would leave nothing to preserve: say so, never pass silently
|
|
131
|
+
if (!semanticsRows(baseText).size) problems.push(`${base} has no 模块语义 / Module Semantics table rows the check can read`);
|
|
132
|
+
const d = drift(target, baseText);
|
|
133
|
+
fs.writeFileSync(path.join(meta, DRIFT_REL), JSON.stringify({ schema: "design-drift/1", baseline: base, drift: d }, null, 2) + "\n", "utf8");
|
|
134
|
+
return { baseline: base, problems, drift: d };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function main(argv) {
|
|
138
|
+
const [cmd, target] = argv;
|
|
139
|
+
if (!["snapshot", "check"].includes(cmd) || !target) {
|
|
140
|
+
process.stderr.write("usage: design_baseline.mjs snapshot|check <target_directory> [--force]\n");
|
|
141
|
+
return 2;
|
|
142
|
+
}
|
|
143
|
+
const t = path.resolve(target);
|
|
144
|
+
if (cmd === "snapshot") {
|
|
145
|
+
const r = snapshot(t, { force: argv.includes("--force") });
|
|
146
|
+
process.stdout.write(JSON.stringify(r) + "\n");
|
|
147
|
+
return 0;
|
|
148
|
+
}
|
|
149
|
+
const r = check(t);
|
|
150
|
+
for (const p of r.problems) process.stdout.write(`[BASELINE] ${p}\n`);
|
|
151
|
+
process.stdout.write(JSON.stringify({ baseline: r.baseline, problems: r.problems.length, drift: r.drift.map((x) => x.module) }) + "\n");
|
|
152
|
+
return r.problems.length ? 1 : 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const self = fileURLToPath(import.meta.url);
|
|
156
|
+
let invoked = "";
|
|
157
|
+
try { invoked = process.argv[1] ? fs.realpathSync(process.argv[1]) : ""; } catch { invoked = ""; }
|
|
158
|
+
if (invoked !== "" && path.resolve(invoked) === path.resolve(self)) process.exitCode = main(process.argv.slice(2));
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The architecture baseline survives a refresh of project_design.md (SKILL.md Step 5 rule 7).
|
|
3
|
+
// Run: node --test test/
|
|
4
|
+
import { test } from "node:test";
|
|
5
|
+
import assert from "node:assert/strict";
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import os from "node:os";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { spawnSync } from "node:child_process";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
|
|
12
|
+
import * as db from "../scripts/design_baseline.mjs";
|
|
13
|
+
|
|
14
|
+
const SKILL_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
15
|
+
const COMMIT = path.join(SKILL_DIR, "scripts", "commit_module_state.mjs");
|
|
16
|
+
|
|
17
|
+
const ARCH = `## 项目结构
|
|
18
|
+
|
|
19
|
+
\`\`\`text
|
|
20
|
+
products/
|
|
21
|
+
└── phone/
|
|
22
|
+
features/
|
|
23
|
+
├── weatherdisplay/
|
|
24
|
+
└── settings/
|
|
25
|
+
\`\`\`
|
|
26
|
+
|
|
27
|
+
## 模块语义
|
|
28
|
+
|
|
29
|
+
| 模块路径 | 模块功能 |
|
|
30
|
+
|---|---|
|
|
31
|
+
| products/phone | 应用产品入口:承载应用启动与页面路由注册。 |
|
|
32
|
+
| features/weatherdisplay | 天气展示特性:提供主页面与今日天气详情的界面和交互。 |
|
|
33
|
+
| features/settings | 设置特性:提供语言与单位的设置界面。 |
|
|
34
|
+
`;
|
|
35
|
+
// what the refresh wrote in WeatherApp 11-22
|
|
36
|
+
const DRIFTED = ARCH.replace("天气展示特性:提供主页面与今日天气详情的界面和交互。",
|
|
37
|
+
"天气展示特性模块(脚手架占位):当前实现暂落位于产品入口模块。");
|
|
38
|
+
|
|
39
|
+
function project(t) {
|
|
40
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "msd-baseline-"));
|
|
41
|
+
t.after(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
42
|
+
const w = (rel, s) => { fs.mkdirSync(path.dirname(path.join(root, rel)), { recursive: true }); fs.writeFileSync(path.join(root, rel), s); };
|
|
43
|
+
for (const m of ["products/phone", "features/weatherdisplay", "features/settings"]) w(`${m}/src/main/module.json5`, "{}");
|
|
44
|
+
w("products/phone/src/main/ets/pages/MainPage.ets", "");
|
|
45
|
+
w("features/settings/src/main/ets/pages/SettingsPage.ets", "");
|
|
46
|
+
w(".hometrans/project_design.md", ARCH);
|
|
47
|
+
w(".hometrans/module_understanding/module_update_plan.json", JSON.stringify({ modules_to_update: [], next_state: { modules: {} } }));
|
|
48
|
+
return { root, w };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
test("semanticsRows reads only the 模块语义 table", () => {
|
|
52
|
+
const rows = db.semanticsRows(ARCH);
|
|
53
|
+
assert.deepEqual([...rows.keys()], ["products/phone", "features/weatherdisplay", "features/settings"]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("snapshot: taken before the first refresh, never once a refresh was committed (unless --force)", (t) => {
|
|
57
|
+
const { root, w } = project(t);
|
|
58
|
+
assert.equal(db.snapshot(root).snapshot, true);
|
|
59
|
+
assert.equal(db.snapshot(root).snapshot, false); // exists
|
|
60
|
+
fs.rmSync(path.join(root, ".hometrans", db.BASELINE_REL));
|
|
61
|
+
w(".hometrans/module_understanding/.module_semantic_docs_state.json", "{}");
|
|
62
|
+
const r = db.snapshot(root);
|
|
63
|
+
assert.equal(r.snapshot, false);
|
|
64
|
+
assert.equal(r.warning, true);
|
|
65
|
+
assert.equal(db.snapshot(root, { force: true }).snapshot, true);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("commit refuses a refresh that rewrote a baseline row, and records the empty module as drift", (t) => {
|
|
69
|
+
const { root, w } = project(t);
|
|
70
|
+
db.snapshot(root);
|
|
71
|
+
w(".hometrans/project_design.md", DRIFTED);
|
|
72
|
+
const bad = spawnSync(process.execPath, [COMMIT, root], { encoding: "utf8" });
|
|
73
|
+
assert.equal(bad.status, 1);
|
|
74
|
+
assert.match(bad.stderr, /row features\/weatherdisplay changed/);
|
|
75
|
+
|
|
76
|
+
w(".hometrans/project_design.md", ARCH + "| features/settings/src/main/ets/pages | 设置页面目录。 |\n");
|
|
77
|
+
const ok = spawnSync(process.execPath, [COMMIT, root], { encoding: "utf8" });
|
|
78
|
+
assert.equal(ok.status, 0, ok.stderr);
|
|
79
|
+
assert.deepEqual(JSON.parse(ok.stdout).design_drift, ["features/weatherdisplay"]);
|
|
80
|
+
const drift = JSON.parse(fs.readFileSync(path.join(root, ".hometrans", db.DRIFT_REL), "utf8"));
|
|
81
|
+
assert.equal(drift.drift[0].kind, "empty_design_module");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test("without a baseline commit behaves as before", (t) => {
|
|
85
|
+
const { root, w } = project(t);
|
|
86
|
+
w(".hometrans/project_design.md", DRIFTED);
|
|
87
|
+
const r = spawnSync(process.execPath, [COMMIT, root], { encoding: "utf8" });
|
|
88
|
+
assert.equal(r.status, 0, r.stderr);
|
|
89
|
+
assert.deepEqual(JSON.parse(r.stdout).design_drift, []);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// a2h-arch-generate's contract (artifact-contracts.generate.md rule 4): capability rows, no module-root rows
|
|
93
|
+
const CONTRACT = `## 模块语义
|
|
94
|
+
|
|
95
|
+
| 模块路径 | 模块功能 |
|
|
96
|
+
|---|---|
|
|
97
|
+
| products/phone/src/main/ets/pages | 应用入口与路由注册。 |
|
|
98
|
+
| features/weatherdisplay/src/main/ets/pages | 主页面与今日天气详情的界面。 |
|
|
99
|
+
| features/weatherdisplay/src/main/ets/components | 天气卡片组件。 |
|
|
100
|
+
| features/settings/src/main/ets/pages | 设置界面。 |
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
test("drift folds capability rows into their module root", (t) => {
|
|
104
|
+
const { root } = project(t);
|
|
105
|
+
assert.equal(db.moduleRootOf("features/weatherdisplay/src/main/ets/pages"), "features/weatherdisplay");
|
|
106
|
+
assert.equal(db.moduleRootOf("features/settings"), "features/settings");
|
|
107
|
+
const d = db.drift(root, CONTRACT);
|
|
108
|
+
assert.deepEqual(d.map((x) => x.module), ["features/weatherdisplay"]);
|
|
109
|
+
assert.match(d[0].design, /主页面.*; 天气卡片组件/);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("a row that only changed whitespace, backticks or full-width punctuation is preserved", () => {
|
|
113
|
+
const base = ARCH;
|
|
114
|
+
const retyped = ARCH.replace("设置特性:提供语言与单位的设置界面。", "设置特性: 提供`语言`与单位的设置界面。");
|
|
115
|
+
assert.deepEqual(db.preservationProblems(base, retyped), []);
|
|
116
|
+
assert.equal(db.preservationProblems(base, DRIFTED).length, 1);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test("semanticsRows reads ### and numbered headings; a baseline with no readable rows is a problem", (t) => {
|
|
120
|
+
for (const h of ["### 模块语义", "## 3. 模块语义", "## 3、模块语义", "### Module Semantics"]) {
|
|
121
|
+
assert.deepEqual([...db.semanticsRows(ARCH.replace("## 模块语义", h)).keys()],
|
|
122
|
+
["products/phone", "features/weatherdisplay", "features/settings"], h);
|
|
123
|
+
}
|
|
124
|
+
const { root, w } = project(t);
|
|
125
|
+
db.snapshot(root);
|
|
126
|
+
w(".hometrans/arch_baseline/project_design.md", "## 模块说明\n\n| a | b |\n");
|
|
127
|
+
assert.match(db.check(root).problems.join("\n"), /no 模块语义/);
|
|
128
|
+
});
|