@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
|
@@ -93,6 +93,88 @@ describe('Queue', () => {
|
|
|
93
93
|
progress({});
|
|
94
94
|
assert.equal(gq.initState(hp, prompts).groups.G002.state, 'skipped');
|
|
95
95
|
});
|
|
96
|
+
|
|
97
|
+
test('stop needs --by user|handoff and a reason; slow progress cannot stop the campaign', () => {
|
|
98
|
+
init();
|
|
99
|
+
assert.throws(() => gq.control(hp, { op: 'stop' }), /--by user\|handoff and --reason/);
|
|
100
|
+
// 'parent' is not in STOP_BY; the message also tells the parent that slow progress is no reason
|
|
101
|
+
assert.throws(() => gq.control(hp, { op: 'stop', by: 'parent', reason: '10/40 in 3 hours' }), /--by user\|handoff and --reason/);
|
|
102
|
+
assert.throws(() => gq.control(hp, { op: 'stop', by: 'user', reason: ' ' }), /--reason/);
|
|
103
|
+
assert.equal(load().stopping, false);
|
|
104
|
+
|
|
105
|
+
const out = gq.control(hp, { op: 'stop', by: 'user', reason: 'user aborted the UI batch' });
|
|
106
|
+
assert.equal(out.done.op, 'stop');
|
|
107
|
+
const st = load();
|
|
108
|
+
assert.equal(st.stopping, true);
|
|
109
|
+
assert.equal(st.stop.by, 'user');
|
|
110
|
+
assert.equal(st.stop.reason, 'user aborted the UI batch');
|
|
111
|
+
assert.deepEqual(st.stop.open, ['G001', 'G002', 'G003', 'G004', 'G005']);
|
|
112
|
+
// the stop record and the open groups travel with every status (Step 7 reports them)
|
|
113
|
+
const sum = gq.status(hp);
|
|
114
|
+
assert.deepEqual(sum.open, ['G001', 'G002', 'G003', 'G004', 'G005']);
|
|
115
|
+
assert.equal(sum.stop.reason, 'user aborted the UI batch');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('status lists open groups until every group is verified, skipped or failed', () => {
|
|
119
|
+
init();
|
|
120
|
+
const st = load();
|
|
121
|
+
st.groups.G001.state = 'verified';
|
|
122
|
+
st.groups.G002.state = 'failed';
|
|
123
|
+
st.groups.G003.state = 'blocked';
|
|
124
|
+
st.groups.G004.state = 'returned';
|
|
125
|
+
st.groups.G005.state = 'skipped';
|
|
126
|
+
gq._save(path.join(hp, '.hometrans', 'queue_state.json'), st);
|
|
127
|
+
assert.deepEqual(gq.status(hp).open, ['G003', 'G004']);
|
|
128
|
+
const done = load();
|
|
129
|
+
done.groups.G003.state = 'failed';
|
|
130
|
+
done.groups.G004.state = 'verified';
|
|
131
|
+
gq._save(path.join(hp, '.hometrans', 'queue_state.json'), done);
|
|
132
|
+
assert.deepEqual(gq.status(hp).open, []);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('status --assert-settled exits 1 with the open groups, 0 once every group is settled', async () => {
|
|
136
|
+
init();
|
|
137
|
+
const run = async () => {
|
|
138
|
+
const out = [];
|
|
139
|
+
const write = process.stdout.write;
|
|
140
|
+
const log = console.log;
|
|
141
|
+
process.stdout.write = (c) => { out.push(String(c)); return true; };
|
|
142
|
+
console.log = (...x) => { out.push(`${x.join(' ')}\n`); };
|
|
143
|
+
const before = process.exitCode;
|
|
144
|
+
try {
|
|
145
|
+
await gq.main(['status', hp, '--assert-settled']);
|
|
146
|
+
return { code: process.exitCode ?? 0, json: JSON.parse(out.join('')) };
|
|
147
|
+
} finally {
|
|
148
|
+
process.stdout.write = write;
|
|
149
|
+
console.log = log;
|
|
150
|
+
process.exitCode = before;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const open = await run();
|
|
154
|
+
assert.equal(open.code, 1);
|
|
155
|
+
assert.equal(open.json.settled, false);
|
|
156
|
+
assert.deepEqual(open.json.open, ['G001', 'G002', 'G003', 'G004', 'G005']);
|
|
157
|
+
const st = load();
|
|
158
|
+
for (const g of Object.values(st.groups)) g.state = 'verified';
|
|
159
|
+
gq._save(path.join(hp, '.hometrans', 'queue_state.json'), st);
|
|
160
|
+
const settled = await run();
|
|
161
|
+
assert.equal(settled.code, 0);
|
|
162
|
+
assert.deepEqual(settled.json.open, []);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test('re-running init after a stop leases the open groups again', () => {
|
|
166
|
+
init();
|
|
167
|
+
gq.control(hp, { op: 'stop', by: 'handoff', reason: 'host session handed off' });
|
|
168
|
+
assert.equal(gq.status(hp).idle, true);
|
|
169
|
+
init({ takeover: true });
|
|
170
|
+
const st = load();
|
|
171
|
+
assert.equal(st.stopping, false);
|
|
172
|
+
assert.equal(st.stop, undefined);
|
|
173
|
+
// kept on record, so a runner retry that already re-ran init can still see the stop
|
|
174
|
+
assert.equal(st.previous_stop.by, 'handoff');
|
|
175
|
+
assert.equal(gq.status(hp).previous_stop.reason, 'host session handed off');
|
|
176
|
+
assert.ok(gq.status(hp).ready_units > 0);
|
|
177
|
+
});
|
|
96
178
|
/** What a finished agent leaves on disk: its predicted files and its report file. */
|
|
97
179
|
function finish(gid, { files = true, report = true } = {}) {
|
|
98
180
|
const g = groups.find((x) => x.id === gid);
|
|
@@ -909,6 +991,38 @@ describe('Queue', () => {
|
|
|
909
991
|
return files;
|
|
910
992
|
}
|
|
911
993
|
|
|
994
|
+
test('review parts with no reviewer hold slots back, at most half of max-agents', () => {
|
|
995
|
+
init({ width: 6, max_agents: 4 });
|
|
996
|
+
const files = campaign({ reviews: ['direct_launch', 'direct_launch', 'direct_launch', 'direct_launch'] });
|
|
997
|
+
gq.reviewBind(hp, 'dl0', { answers: files[0] }); // one dispatched, three still waiting
|
|
998
|
+
const s = gq.status(hp);
|
|
999
|
+
assert.equal(s.reviews_running, 1);
|
|
1000
|
+
assert.equal(s.reviews_unbound.length, 3);
|
|
1001
|
+
assert.equal(s.free_slots, 1); // 4 - 1 running - min(3, half of 4 = 2) held
|
|
1002
|
+
gq.reviewBind(hp, 'dl1', { answers: files[1] });
|
|
1003
|
+
gq.reviewBind(hp, 'dl2', { answers: files[2] });
|
|
1004
|
+
gq.reviewBind(hp, 'dl3', { answers: files[3] });
|
|
1005
|
+
assert.equal(gq.status(hp).reviews_unbound.length, 0);
|
|
1006
|
+
assert.equal(gq.status(hp).free_slots, 0); // now they count as running reviewers
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
test('unbound review parts never take the last conversion slot (half rounded down)', () => {
|
|
1010
|
+
init({ width: 6, max_agents: 1 });
|
|
1011
|
+
const one = campaign({ reviews: ['direct_launch', 'direct_launch'] });
|
|
1012
|
+
gq.reviewBind(hp, 'dl0', { answers: one[0] });
|
|
1013
|
+
fs.writeFileSync(one[0], JSON.stringify([{ key: 'k0', verdict: 'skip' }])); // that reviewer finished
|
|
1014
|
+
const s = gq.status(hp);
|
|
1015
|
+
assert.equal(s.reviews_running, 0);
|
|
1016
|
+
assert.equal(s.reviews_unbound.length, 1);
|
|
1017
|
+
assert.equal(s.free_slots, 1); // 1 - min(1, floor(1/2) = 0) held
|
|
1018
|
+
init({ width: 6, max_agents: 3 });
|
|
1019
|
+
const three = campaign({ reviews: ['direct_launch', 'direct_launch', 'direct_launch', 'direct_launch'] });
|
|
1020
|
+
gq.reviewBind(hp, 'dl0', { answers: three[0] });
|
|
1021
|
+
fs.writeFileSync(three[0], JSON.stringify([{ key: 'k0', verdict: 'skip' }]));
|
|
1022
|
+
assert.equal(gq.status(hp).reviews_unbound.length, 3);
|
|
1023
|
+
assert.equal(gq.status(hp).free_slots, 2); // 3 - min(3, floor(3/2) = 1) held
|
|
1024
|
+
});
|
|
1025
|
+
|
|
912
1026
|
test('explorer reviewers at work count against --max-agents', () => {
|
|
913
1027
|
init({ width: 6, max_agents: 3 });
|
|
914
1028
|
const files = campaign({ reviews: ['direct_launch', 'direct_launch'] });
|
|
@@ -1158,6 +1272,17 @@ describe('Queue', () => {
|
|
|
1158
1272
|
fs.rmSync(path.join(hp, 'entry'), { recursive: true });
|
|
1159
1273
|
fs.mkdirSync(path.join(hp, 'phone', 'src', 'main', 'ets'), { recursive: true });
|
|
1160
1274
|
assert.equal(gw._uiModule(hp, {}), 'phone');
|
|
1275
|
+
// layered: products/phone (entry HAP) and features/x (HAR), no top-level ETS root
|
|
1276
|
+
fs.rmSync(path.join(hp, 'phone'), { recursive: true });
|
|
1277
|
+
for (const [m, type] of [['products/phone', 'entry'], ['features/x', 'har']]) {
|
|
1278
|
+
fs.mkdirSync(path.join(hp, m, 'src', 'main', 'ets'), { recursive: true });
|
|
1279
|
+
fs.writeFileSync(path.join(hp, m, 'src', 'main', 'module.json5'), `{ module: { name: "m", type: "${type}" } }`);
|
|
1280
|
+
}
|
|
1281
|
+
assert.equal(gw._uiModule(hp, {}), 'products/phone');
|
|
1282
|
+
// plus a single top-level HAR: still the entry HAP
|
|
1283
|
+
fs.mkdirSync(path.join(hp, 'common', 'src', 'main', 'ets'), { recursive: true });
|
|
1284
|
+
fs.writeFileSync(path.join(hp, 'common', 'src', 'main', 'module.json5'), '{ module: { name: "c", type: "har" } }');
|
|
1285
|
+
assert.equal(gw._uiModule(hp, {}), 'products/phone');
|
|
1161
1286
|
fs.writeFileSync(path.join(hp, '.hometrans', 'batch_progress.json'), JSON.stringify({ ui_module: 'entry' }));
|
|
1162
1287
|
assert.throws(() => init(), /ETS root not found/);
|
|
1163
1288
|
});
|
|
@@ -72,6 +72,18 @@ describe('Watch', () => {
|
|
|
72
72
|
assert.equal(g.state, 'complete');
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
+
test('a report naming only unpredicted files is off-target, not partial progress', () => {
|
|
76
|
+
// coolmall G027: "DONE" with an edit to CartRoutePage.ets while CartPage.ets was never written
|
|
77
|
+
write('pages/Other.ets', T0 - 3600);
|
|
78
|
+
const meta = path.join(hp, '.hometrans');
|
|
79
|
+
fs.mkdirSync(path.dirname(gw.reportPath(meta, 'G3')), { recursive: true });
|
|
80
|
+
fs.writeFileSync(gw.reportPath(meta, 'G3'), '## REPORT G3\nedited entry/src/main/ets/pages/Other.ets\n', 'utf8');
|
|
81
|
+
fs.utimesSync(gw.reportPath(meta, 'G3'), T0 + 90, T0 + 90);
|
|
82
|
+
const row = gw.triage(hp, ['G3'], {}, T0 + 3600).groups[0];
|
|
83
|
+
assert.deepEqual([row.state, row.action], ['off-target', 'redispatch']);
|
|
84
|
+
assert.deepEqual(row.missing, ['pages/C.ets']);
|
|
85
|
+
});
|
|
86
|
+
|
|
75
87
|
test('verify_only group is done by its report', () => {
|
|
76
88
|
write('pages/A.ets', T0 - 600); // G1's file, written before G4 was dispatched
|
|
77
89
|
let r = gw.triage(hp, ['G4'], { G4: '## REPORT G4 host shell verified' }, T0 + 600);
|
|
@@ -118,6 +130,50 @@ describe('Watch', () => {
|
|
|
118
130
|
assert.deepEqual(s.missing, ['components/x/Index.ets']);
|
|
119
131
|
});
|
|
120
132
|
|
|
133
|
+
test('a predicted file this attempt\'s report names at its own path counts, even when not touched again', () => {
|
|
134
|
+
// a re-attempt that only confirms finished code (requeued for a parent-side resource gap)
|
|
135
|
+
// leaves the file's mtime before the new dispatch: it was triaged off-target until it failed
|
|
136
|
+
const meta = path.join(hp, '.hometrans');
|
|
137
|
+
const feat = path.join(hp, 'features', 'market', 'src', 'main', 'ets');
|
|
138
|
+
const rel = 'features/market/src/main/ets/components/CouponModalDialog.ets';
|
|
139
|
+
const groups = [{ id: 'G8', predicted_writes: [rel] }, { id: 'G9', predicted_writes: ['components/B.ets'] }];
|
|
140
|
+
fs.writeFileSync(path.join(meta, 'ui_info', 'conversion_set.json'), JSON.stringify({ plan: { groups } }), 'utf8');
|
|
141
|
+
gw.dispatch(hp, ['G8', 'G9'], T0); // first attempt
|
|
142
|
+
const f = path.join(feat, 'components', 'CouponModalDialog.ets');
|
|
143
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
144
|
+
fs.writeFileSync(f, 'struct X {}', 'utf8');
|
|
145
|
+
fs.utimesSync(f, T0 + 60, T0 + 60); // written by the first attempt
|
|
146
|
+
write('components/B.ets', T0 + 60);
|
|
147
|
+
gw.dispatch(hp, ['G8', 'G9'], T0 + 600); // fresh re-attempt: the watermark moves past both files
|
|
148
|
+
assert.deepEqual(gw._status(hp, 'G8', T0 + 700).missing, [rel]); // no report yet: not progress
|
|
149
|
+
fs.mkdirSync(path.join(meta, 'queue_logs'), { recursive: true });
|
|
150
|
+
for (const [g, file] of [['G8', rel], ['G9', 'entry/src/main/ets/components/B.ets']]) {
|
|
151
|
+
fs.writeFileSync(gw.reportPath(meta, g), `## REPORT ${g}\nfiles: \`${file}\` (no change, blocking 0)\n`, 'utf8');
|
|
152
|
+
fs.utimesSync(gw.reportPath(meta, g), T0 + 650, T0 + 650);
|
|
153
|
+
}
|
|
154
|
+
const rows = Object.fromEntries(gw.triage(hp, ['G8', 'G9'], {}, T0 + 700).groups.map((x) => [x.group, x]));
|
|
155
|
+
assert.deepEqual([rows.G8.state, rows.G8.action, rows.G8.missing], ['complete', 'verify', []]); // was: off-target
|
|
156
|
+
assert.deepEqual([rows.G9.state, rows.G9.action, rows.G9.missing], ['complete', 'verify', []]); // UI-module path
|
|
157
|
+
// a report left from the earlier attempt does not count for this one
|
|
158
|
+
fs.utimesSync(gw.reportPath(meta, 'G8'), T0 + 100, T0 + 100);
|
|
159
|
+
assert.deepEqual(gw._status(hp, 'G8', T0 + 700).missing, [rel]);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('a predicted file older than the group\'s first dispatch does not count because a report names it', () => {
|
|
163
|
+
// a host-chain group's existing file (or a scaffold stub) the agent never edited, cited only in
|
|
164
|
+
// the report's UNWIRED section: still missing, still off-target
|
|
165
|
+
const meta = path.join(hp, '.hometrans');
|
|
166
|
+
write('pages/C.ets', T0 - 3600); // before G3 was ever dispatched (beforeEach: T0)
|
|
167
|
+
gw.dispatch(hp, ['G3'], T0 + 600); // a fresh re-attempt
|
|
168
|
+
fs.mkdirSync(path.join(meta, 'queue_logs'), { recursive: true });
|
|
169
|
+
fs.writeFileSync(gw.reportPath(meta, 'G3'), '## REPORT G3\nUNWIRED: `pages/C.ets:42` -> SettingsPage\n', 'utf8');
|
|
170
|
+
fs.utimesSync(gw.reportPath(meta, 'G3'), T0 + 650, T0 + 650);
|
|
171
|
+
const s = gw._status(hp, 'G3', T0 + 700);
|
|
172
|
+
assert.deepEqual([s.written, s.missing, s.reported], [[], ['pages/C.ets'], ['pages/C.ets']]);
|
|
173
|
+
const row = gw.triage(hp, ['G3'], {}, T0 + 700).groups[0];
|
|
174
|
+
assert.deepEqual([row.state, row.action], ['off-target', 'redispatch']);
|
|
175
|
+
});
|
|
176
|
+
|
|
121
177
|
const queueAttempt = (g, at) => fs.writeFileSync(path.join(hp, '.hometrans', 'queue_state.json'),
|
|
122
178
|
JSON.stringify({ groups: { [g]: { state: 'running', attempt_at: at } } }));
|
|
123
179
|
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// measure_pack icon_inventory beyond ImageView: Compose draws Image/Icon/AsyncImage as a bare android.view.View
|
|
2
|
+
// leaf, and content below the first viewport only exists in view_scroll_N.xml. Measured (weather home, page_0002):
|
|
3
|
+
// 12 life-index icons were android.view.View leaves in scroll frames 3/4, icon_inventory was [], the converter
|
|
4
|
+
// emitted empty Rows and phase5 [icons] stayed silent.
|
|
5
|
+
// Run from scripts/: node --test tests/measure_pack_icon_leaf.test.mjs
|
|
6
|
+
import { test } from 'node:test';
|
|
7
|
+
import assert from 'node:assert/strict';
|
|
8
|
+
import { spawnSync } from 'node:child_process';
|
|
9
|
+
import * as fs from 'node:fs';
|
|
10
|
+
import * as os from 'node:os';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import * as zlib from 'node:zlib';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
|
|
15
|
+
import { iconCoverage } from '../icon_coverage.mjs';
|
|
16
|
+
|
|
17
|
+
const SCRIPT = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'measure_pack.ts');
|
|
18
|
+
const W = 400; const H = 800;
|
|
19
|
+
|
|
20
|
+
function crc32(buf) {
|
|
21
|
+
let c; const t = [];
|
|
22
|
+
for (let n = 0; n < 256; n++) { c = n; for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; t[n] = c >>> 0; }
|
|
23
|
+
let crc = 0xffffffff;
|
|
24
|
+
for (const b of buf) crc = t[(crc ^ b) & 0xff] ^ (crc >>> 8);
|
|
25
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
26
|
+
}
|
|
27
|
+
function chunk(type, data) {
|
|
28
|
+
const len = Buffer.alloc(4); len.writeUInt32BE(data.length);
|
|
29
|
+
const td = Buffer.concat([Buffer.from(type, 'ascii'), data]);
|
|
30
|
+
const crc = Buffer.alloc(4); crc.writeUInt32BE(crc32(td));
|
|
31
|
+
return Buffer.concat([len, td, crc]);
|
|
32
|
+
}
|
|
33
|
+
/** White W x H PNG with black rectangles [x1,y1,x2,y2]. */
|
|
34
|
+
function png(rects) {
|
|
35
|
+
const raw = Buffer.alloc((W * 4 + 1) * H, 255);
|
|
36
|
+
for (let y = 0; y < H; y++) raw[y * (W * 4 + 1)] = 0;
|
|
37
|
+
for (const [x1, y1, x2, y2] of rects) {
|
|
38
|
+
for (let y = y1; y < y2; y++) for (let x = x1; x < x2; x++) {
|
|
39
|
+
const o = y * (W * 4 + 1) + 1 + x * 4; raw[o] = 0; raw[o + 1] = 0; raw[o + 2] = 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const ihdr = Buffer.alloc(13);
|
|
43
|
+
ihdr.writeUInt32BE(W, 0); ihdr.writeUInt32BE(H, 4); ihdr[8] = 8; ihdr[9] = 6;
|
|
44
|
+
return Buffer.concat([Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]), chunk('IHDR', ihdr),
|
|
45
|
+
chunk('IDAT', zlib.deflateSync(raw)), chunk('IEND', Buffer.alloc(0))]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const esc = (s) => s.replace(/&/g, '&').replace(/"/g, '"');
|
|
49
|
+
/** uiautomator node; `kids` present → nested element, else self-closing leaf. */
|
|
50
|
+
function n(cls, b, { text = '', desc = '', kids = null } = {}) {
|
|
51
|
+
const a = `class="${cls}" text="${esc(text)}" resource-id="" content-desc="${esc(desc)}" checkable="false" checked="false" ` +
|
|
52
|
+
`clickable="false" enabled="true" scrollable="false" bounds="[${b[0]},${b[1]}][${b[2]},${b[3]}]"`;
|
|
53
|
+
return kids === null ? `<node ${a} />` : `<node ${a}>${kids.join('')}</node>`;
|
|
54
|
+
}
|
|
55
|
+
const V = 'android.view.View';
|
|
56
|
+
const T = 'android.widget.TextView';
|
|
57
|
+
/** A glyph in the middle third of an icon box: ~11% ink on a white, uniform background. */
|
|
58
|
+
const glyph = ([x1, y1, x2, y2]) => {
|
|
59
|
+
const w = (x2 - x1) / 3; const h = (y2 - y1) / 3;
|
|
60
|
+
return [Math.round(x1 + w), Math.round(y1 + h), Math.round(x2 - w), Math.round(y2 - h)];
|
|
61
|
+
};
|
|
62
|
+
const root = (kids) => `<?xml version="1.0"?><hierarchy rotation="0">${n('android.widget.FrameLayout', [0, 0, W, H], { kids })}</hierarchy>`;
|
|
63
|
+
|
|
64
|
+
/** Write frames [{ kids, rects }] as one page (frame 0 = view.xml), run measure_pack, return { inv, ui, page }. */
|
|
65
|
+
function measure(frames) {
|
|
66
|
+
const ui = fs.mkdtempSync(path.join(os.tmpdir(), 'mpi-'));
|
|
67
|
+
const page = 'page_0001_Main';
|
|
68
|
+
const dir = path.join(ui, page);
|
|
69
|
+
fs.mkdirSync(dir);
|
|
70
|
+
const shots = []; const xmls = [];
|
|
71
|
+
frames.forEach((f, i) => {
|
|
72
|
+
const s = i ? `screenshot_scroll_${i}.png` : 'screenshot.png';
|
|
73
|
+
const x = i ? `view_scroll_${i}.xml` : 'view.xml';
|
|
74
|
+
fs.writeFileSync(path.join(dir, s), png(f.rects));
|
|
75
|
+
fs.writeFileSync(path.join(dir, x), root(f.kids));
|
|
76
|
+
shots.push(`${page}/${s}`); xmls.push(`${page}/${x}`);
|
|
77
|
+
});
|
|
78
|
+
fs.writeFileSync(path.join(dir, 'meta.json'), JSON.stringify({
|
|
79
|
+
page_id: page, screenshot: shots[0], view_xml: xmls[0], screenshots: shots, view_xmls: xmls,
|
|
80
|
+
device_info: { density: 2, width_px: W, height_px: H } }));
|
|
81
|
+
const r = spawnSync(process.execPath, [SCRIPT, '--ui-info', dir, '--quiet'], { encoding: 'utf8' });
|
|
82
|
+
assert.equal(r.status, 0, r.stderr);
|
|
83
|
+
const inv = JSON.parse(fs.readFileSync(path.join(dir, 'measure_pack.json'), 'utf8')).icon_inventory;
|
|
84
|
+
return { inv, ui, page };
|
|
85
|
+
}
|
|
86
|
+
const cleanup = (ui) => fs.rmSync(ui, { recursive: true, force: true });
|
|
87
|
+
|
|
88
|
+
test('a Compose image leaf (android.view.View, no text, no children) is an icon; containers, bars and backgrounds are not', () => {
|
|
89
|
+
const sun = [30, 100, 110, 180];
|
|
90
|
+
const { inv, ui } = measure([{
|
|
91
|
+
kids: [
|
|
92
|
+
n(V, [20, 100, 120, 240], { kids: [n(V, sun, { desc: 'Sun icon' }), n(T, [30, 190, 110, 230], { text: 'Sunny' })] }),
|
|
93
|
+
n(V, [200, 100, 260, 160]), // node4: image-sized leaf, nothing drawn (data-bound image not loaded yet)
|
|
94
|
+
n(V, [0, 300, 400, 340]), // full-width bar
|
|
95
|
+
n(V, [0, 400, 400, 800]), // background
|
|
96
|
+
n(V, [300, 100, 310, 160]), // thin, below 16dp
|
|
97
|
+
n(T, [140, 100, 200, 160]), // empty TextView
|
|
98
|
+
n(V, [200, 200, 260, 260], { kids: [n(T, [205, 205, 255, 255], { text: 'x' })] }) // container
|
|
99
|
+
],
|
|
100
|
+
rects: [glyph(sun), [0, 300, 400, 340], [0, 400, 400, 800], [300, 100, 310, 160], glyph([140, 100, 200, 160])]
|
|
101
|
+
}]);
|
|
102
|
+
try {
|
|
103
|
+
assert.deepEqual(inv.map((r) => r.key), ['Sun_icon', 'node4']);
|
|
104
|
+
const [s, b] = inv;
|
|
105
|
+
assert.equal(s.kind, 'leaf'); assert.equal(s.visible, true); assert.equal(s.frame, 0); assert.equal(s.desc, 'Sun icon');
|
|
106
|
+
assert.equal(b.visible, false, 'blank leaf stays a CAND, not a GATE');
|
|
107
|
+
} finally { cleanup(ui); }
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
/** Header and a toolbar icon fixed; content scrolls 200px per frame. */
|
|
111
|
+
function scrolled() {
|
|
112
|
+
const chrome = [340, 10, 380, 50];
|
|
113
|
+
const fixed = [n(T, [20, 20, 200, 60], { text: 'Header' }), n(V, chrome)];
|
|
114
|
+
return measure([
|
|
115
|
+
{ kids: [...fixed, n(T, [20, 300, 200, 340], { text: 'Row A' })], rects: [glyph(chrome)] },
|
|
116
|
+
{ kids: [...fixed, n(T, [20, 100, 200, 140], { text: 'Row A' }), n(T, [20, 400, 200, 440], { text: 'Row B' }),
|
|
117
|
+
n(V, [40, 500, 100, 560])], rects: [glyph(chrome), glyph([40, 500, 100, 560])] },
|
|
118
|
+
{ kids: [...fixed, n(T, [20, 200, 200, 240], { text: 'Row B' }), n(V, [40, 300, 100, 360]),
|
|
119
|
+
n(V, [200, 300, 260, 360], { desc: 'Moon' })], rects: [glyph(chrome), glyph([40, 300, 100, 360]), glyph([200, 300, 260, 360])] }
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
test('scroll frames join the inventory, merged by key: fixed chrome and scrolled content are not repeated', () => {
|
|
124
|
+
const { inv, ui } = scrolled();
|
|
125
|
+
try {
|
|
126
|
+
assert.deepEqual(inv.map((r) => [r.key, r.frame, r.frames ?? []]),
|
|
127
|
+
[['node2', 0, [1, 2]], ['s1_node5', 1, [2]], ['Moon', 2, []]]);
|
|
128
|
+
assert.ok(inv.every((r) => r.visible));
|
|
129
|
+
} finally { cleanup(ui); }
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('icon_coverage gates a visible icon that only a scroll frame shows, and an ICON marker covers it', () => {
|
|
133
|
+
const { ui, page } = scrolled();
|
|
134
|
+
try {
|
|
135
|
+
const bare = iconCoverage({ uiInfo: ui, pageDirs: [page], files: new Map([['A.ets', 'Row() {}']]) });
|
|
136
|
+
const moon = bare.gate.find((g) => / Moon /.test(g));
|
|
137
|
+
assert.ok(moon && /^icon-uncovered/.test(moon) && /in scroll frame 2/.test(moon), bare.gate.join('\n'));
|
|
138
|
+
assert.equal(bare.gate.length, 3);
|
|
139
|
+
const src = '// ICON: node2, s1_node5\nImage($r(\'app.media.a\'))\n// ICON: Moon\nImage(this.item.iconUrl)\n';
|
|
140
|
+
const ok = iconCoverage({ uiInfo: ui, pageDirs: [page], files: new Map([['A.ets', src]]) });
|
|
141
|
+
assert.deepEqual(ok.gate, []);
|
|
142
|
+
} finally { cleanup(ui); }
|
|
143
|
+
});
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// Module placement: the architecture's module per group (module_placement.mjs -> build_conversion_set.mjs -> group_queue.mjs).
|
|
2
|
+
// Run from scripts/: node --test tests/module_placement.test.mjs
|
|
3
|
+
import { test, describe, beforeEach, afterEach } from 'node:test';
|
|
4
|
+
import assert from 'node:assert/strict';
|
|
5
|
+
import * as fs from 'node:fs';
|
|
6
|
+
import * as os from 'node:os';
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
|
|
9
|
+
import * as bcs from '../build_conversion_set.mjs';
|
|
10
|
+
import * as mp from '../module_placement.mjs';
|
|
11
|
+
import { placementProblem } from '../group_queue.mjs';
|
|
12
|
+
|
|
13
|
+
const w = (p, data) => {
|
|
14
|
+
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
15
|
+
fs.writeFileSync(p, typeof data === 'string' ? data : JSON.stringify(data), 'utf8');
|
|
16
|
+
};
|
|
17
|
+
const read = (p) => JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
18
|
+
|
|
19
|
+
// WeatherApp 11-22 in miniature: an entry Activity, its main fragment hosting a search sheet, a settings page.
|
|
20
|
+
const NODES = [
|
|
21
|
+
{ id: 'activity:Main', kind: 'activity', status: 'static-only', is_launcher: true },
|
|
22
|
+
{ id: 'fragment:Main', kind: 'fragment', status: 'static-only' },
|
|
23
|
+
{ id: 'fragment:Search', kind: 'dialog', status: 'static-only' },
|
|
24
|
+
{ id: 'fragment:Settings', kind: 'fragment', status: 'static-only' },
|
|
25
|
+
];
|
|
26
|
+
const LINKS = [
|
|
27
|
+
{ source: 'activity:Main', target: 'fragment:Main', mechanism: 'fragment-transaction' },
|
|
28
|
+
{ source: 'fragment:Main', target: 'fragment:Search', mechanism: 'show-dialog' },
|
|
29
|
+
{ source: 'fragment:Main', target: 'fragment:Settings', mechanism: 'fragment-transaction', trigger: 'M:1' },
|
|
30
|
+
];
|
|
31
|
+
const DESIGN = `## 模块语义
|
|
32
|
+
|
|
33
|
+
| 模块路径 | 模块功能 |
|
|
34
|
+
|---|---|
|
|
35
|
+
| products/phone | 应用产品入口:承载应用启动与页面路由注册。 |
|
|
36
|
+
| features/weatherdisplay | 天气展示特性:提供主页面与今日天气详情的界面和交互。 |
|
|
37
|
+
| features/placesearch | 地点搜索特性:以半模态面板提供地点搜索交互。 |
|
|
38
|
+
| features/weatherforecast | 天气预报数据:调用预报接口并维护共享状态。 |
|
|
39
|
+
| features/settings | 设置特性:提供语言与单位的设置界面。 |
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
describe('module placement', () => {
|
|
43
|
+
let hp; let meta; let ws; let ui;
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
hp = fs.mkdtempSync(path.join(os.tmpdir(), 'mp-test-'));
|
|
46
|
+
meta = path.join(hp, '.hometrans');
|
|
47
|
+
ws = path.join(meta, 'utg_static');
|
|
48
|
+
ui = path.join(meta, 'ui_info');
|
|
49
|
+
w(path.join(ws, 'utg.json'), { nodes: NODES, links: LINKS });
|
|
50
|
+
w(path.join(ws, 'click_paths.json'), { paths: {} });
|
|
51
|
+
w(path.join(meta, 'project_design.md'), DESIGN);
|
|
52
|
+
w(path.join(meta, 'batch_progress.json'), { ui_module: 'products/phone', ui_info_root: ui });
|
|
53
|
+
});
|
|
54
|
+
afterEach(() => fs.rmSync(hp, { recursive: true, force: true }));
|
|
55
|
+
|
|
56
|
+
const groups = () => Object.fromEntries(read(path.join(ui, 'conversion_set.json')).plan.groups.map((g) => [g.anchor, g]));
|
|
57
|
+
const place = (groupsDoc, extra = {}) => w(mp.placementPath(hp),
|
|
58
|
+
{ schema: mp.SCHEMA, ui_module: 'products/phone', groups: groupsDoc, unassigned: {}, ...extra });
|
|
59
|
+
const full = {
|
|
60
|
+
'activity:Main': { module: 'products/phone' },
|
|
61
|
+
'fragment:Main': { module: 'features/weatherdisplay', members: { 'fragment:Search': 'features/placesearch' } },
|
|
62
|
+
'fragment:Settings': { module: 'features/settings' },
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
test('without a placement file the plan is unchanged and the summary says it is missing', () => {
|
|
66
|
+
bcs.build(ws, ui);
|
|
67
|
+
const g = groups();
|
|
68
|
+
assert.equal('module' in g['fragment:Main'], false);
|
|
69
|
+
assert.ok(g['fragment:Main'].predicted_writes.includes('pages/MainPage.ets'));
|
|
70
|
+
assert.equal(read(path.join(ui, 'conversion_set.json')).summary.placement, 'missing');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test('placed groups predict writes in their module; a member placed elsewhere keeps its own module', () => {
|
|
74
|
+
bcs.build(ws, ui);
|
|
75
|
+
place(full);
|
|
76
|
+
bcs.build(ws, ui);
|
|
77
|
+
const g = groups();
|
|
78
|
+
assert.equal(g['fragment:Main'].module, 'features/weatherdisplay');
|
|
79
|
+
assert.deepEqual(g['fragment:Main'].member_modules, { 'fragment:Search': 'features/placesearch' });
|
|
80
|
+
assert.ok(g['fragment:Main'].predicted_writes.includes('features/weatherdisplay/src/main/ets/pages/MainPage.ets'));
|
|
81
|
+
assert.ok(g['fragment:Main'].predicted_writes.includes('features/placesearch/src/main/ets/components/SearchDialog.ets'));
|
|
82
|
+
// the UI module's own writes stay ETS-relative (group_watch.etsSplit's first form)
|
|
83
|
+
assert.ok(g['activity:Main'].predicted_writes.includes('pages/MainPage.ets'));
|
|
84
|
+
assert.ok(g['fragment:Settings'].predicted_writes.includes('features/settings/src/main/ets/pages/SettingsPage.ets'));
|
|
85
|
+
// a host Activity and its default fragment in different modules no longer predict the same file
|
|
86
|
+
assert.equal(g['fragment:Main'].verify_only, false);
|
|
87
|
+
const plan = read(path.join(ui, 'conversion_set.json')).plan;
|
|
88
|
+
assert.deepEqual(plan.placement.unplaced, []);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('an overlay owned by a placed group is handed to its other hosts with its module path', () => {
|
|
92
|
+
w(path.join(ws, 'utg.json'), { nodes: NODES, links: [...LINKS,
|
|
93
|
+
{ source: 'fragment:Settings', target: 'fragment:Search', mechanism: 'show-dialog' }] });
|
|
94
|
+
bcs.build(ws, ui);
|
|
95
|
+
// opened from two groups, the search sheet is a group of its own
|
|
96
|
+
assert.ok(groups()['fragment:Search']);
|
|
97
|
+
place({ ...full, 'fragment:Main': { module: 'features/weatherdisplay' }, 'fragment:Search': { module: 'features/placesearch' } });
|
|
98
|
+
bcs.build(ws, ui);
|
|
99
|
+
const o = (groups()['fragment:Settings'].overlays_owned_elsewhere ?? []).find((x) => x.node === 'fragment:Search');
|
|
100
|
+
assert.ok(o, JSON.stringify(groups()['fragment:Settings']));
|
|
101
|
+
assert.equal(o.file, 'features/placesearch/src/main/ets/components/SearchDialog.ets');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('incremental: a placed write matches an existing file of its own module only', () => {
|
|
105
|
+
const byId = (pl, id) => pl.groups.find((g) => g.id === id);
|
|
106
|
+
const mk = () => ({ groups: [{ id: 'G1', class: 'page', lane: null,
|
|
107
|
+
predicted_writes: ['features/settings/src/main/ets/pages/SettingsPage.ets', 'features/settings/src/main/ets/viewmodel/SettingsViewModel.ets'] },
|
|
108
|
+
{ id: 'G2', class: 'page', lane: null, predicted_writes: ['pages/MainPage.ets'] }] });
|
|
109
|
+
// the file is in features/settings: edited in place
|
|
110
|
+
let plan = mk();
|
|
111
|
+
bcs.applyIncremental(plan, ['features/settings/src/main/ets/pages/SettingsPage.ets'], 'products/phone');
|
|
112
|
+
assert.deepEqual(byId(plan, 'G1').existing_writes, ['features/settings/src/main/ets/pages/SettingsPage.ets']);
|
|
113
|
+
// a same-named file in the UI module (a previous run's misplacement) is not this group's file
|
|
114
|
+
plan = mk();
|
|
115
|
+
bcs.applyIncremental(plan, ['products/phone/src/main/ets/pages/SettingsPage.ets', 'pages/MainPage.ets'], 'products/phone');
|
|
116
|
+
assert.equal(byId(plan, 'G1').existing_writes, undefined);
|
|
117
|
+
assert.equal(byId(plan, 'G1').class, 'page');
|
|
118
|
+
assert.deepEqual(byId(plan, 'G2').existing_writes, ['pages/MainPage.ets'], 'a bare path is the UI module');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('prepare refuses to overwrite a hand-filled placement that does not parse', () => {
|
|
122
|
+
bcs.build(ws, ui);
|
|
123
|
+
const broken = '{ "schema": "module-placement/1", "groups": { "fragment:Main": { "module": "features/weatherdisplay", }, } }';
|
|
124
|
+
w(mp.placementPath(hp), broken);
|
|
125
|
+
const err = process.stderr.write;
|
|
126
|
+
process.stderr.write = () => true;
|
|
127
|
+
try { assert.equal(mp.main(['prepare', '--hp', hp]), 2); } finally { process.stderr.write = err; }
|
|
128
|
+
assert.equal(fs.readFileSync(mp.placementPath(hp), 'utf8'), broken);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
test('readExisting takes the module-qualified files rows of list_existing', () => {
|
|
132
|
+
const f = path.join(hp, 'existing.json');
|
|
133
|
+
w(f, { existing: ['pages/SettingsPage.ets'], files: [{ module: 'products/phone', path: 'pages/SettingsPage.ets', kind: 'page' }] });
|
|
134
|
+
assert.deepEqual(bcs.readExisting(f), ['products/phone/src/main/ets/pages/SettingsPage.ets']);
|
|
135
|
+
w(f, { existing: ['pages/A.ets'] });
|
|
136
|
+
assert.deepEqual(bcs.readExisting(f), ['pages/A.ets']);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test('a placement without ui_module falls back to the project UI module, so entry writes stay unprefixed', () => {
|
|
140
|
+
w(mp.placementPath(hp), { schema: mp.SCHEMA, groups: {} });
|
|
141
|
+
w(path.join(meta, 'batch_progress.json'), { ui_info_root: ui });
|
|
142
|
+
fs.mkdirSync(path.join(hp, 'entry', 'src', 'main', 'ets'), { recursive: true });
|
|
143
|
+
assert.equal(bcs.loadPlacement(hp).ui_module, 'entry');
|
|
144
|
+
assert.equal(bcs.modulePath(bcs.loadPlacement(hp).ui_module, 'entry', 'pages/X.ets'), 'pages/X.ets');
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('check flags unplaced groups, unknown modules, stray members and empty UI modules', () => {
|
|
148
|
+
bcs.build(ws, ui);
|
|
149
|
+
place({ 'activity:Main': { module: 'products/phone' }, 'fragment:Main': { module: 'features/nope',
|
|
150
|
+
members: { 'fragment:Other': 'features/placesearch' } } });
|
|
151
|
+
const plan = read(path.join(ui, 'conversion_set.json')).plan;
|
|
152
|
+
const mods = mp.designModules(DESIGN);
|
|
153
|
+
const ps = mp.problems(read(mp.placementPath(hp)), plan, mods).join('\n');
|
|
154
|
+
assert.match(ps, /fragment:Settings\): no module/);
|
|
155
|
+
assert.match(ps, /features\/nope is not a module of the design/);
|
|
156
|
+
assert.match(ps, /member fragment:Other is not in this group/);
|
|
157
|
+
assert.match(ps, /design module features\/weatherdisplay describes UI/);
|
|
158
|
+
// a data-only module is not expected to receive UI
|
|
159
|
+
assert.doesNotMatch(ps, /features\/weatherforecast/);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test('check passes a full placement; an unused UI module needs a reason under unassigned', () => {
|
|
163
|
+
bcs.build(ws, ui);
|
|
164
|
+
const plan = read(path.join(ui, 'conversion_set.json')).plan;
|
|
165
|
+
const mods = mp.designModules(DESIGN);
|
|
166
|
+
place(full);
|
|
167
|
+
assert.deepEqual(mp.problems(read(mp.placementPath(hp)), plan, mods), []);
|
|
168
|
+
place({ ...full, 'fragment:Main': { module: 'features/weatherdisplay' } });
|
|
169
|
+
assert.equal(mp.problems(read(mp.placementPath(hp)), plan, mods).length, 1);
|
|
170
|
+
place({ ...full, 'fragment:Main': { module: 'features/weatherdisplay' } },
|
|
171
|
+
{ unassigned: { 'features/placesearch': 'search sheet merged into the main page by the user' } });
|
|
172
|
+
assert.deepEqual(mp.problems(read(mp.placementPath(hp)), plan, mods), []);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test('designModules reads the module table and ignores directory rows and the header', () => {
|
|
176
|
+
const mods = mp.designModules(DESIGN + '| features/settings/src | 源码目录 |\n');
|
|
177
|
+
assert.deepEqual([...mods.keys()], ['products/phone', 'features/weatherdisplay', 'features/placesearch',
|
|
178
|
+
'features/weatherforecast', 'features/settings']);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test('placementProblem: a placed prompt must declare TARGET_MODULE and must not hand the choice back', () => {
|
|
182
|
+
const g = { module: 'features/weatherdisplay', member_modules: { 'fragment:Search': 'features/placesearch' } };
|
|
183
|
+
assert.equal(placementProblem('anything', { module: null }), null);
|
|
184
|
+
assert.match(placementProblem('no declaration here', g), /no TARGET_MODULE/);
|
|
185
|
+
assert.match(placementProblem('TARGET_MODULE = features/weatherdisplay', g), /features\/placesearch/);
|
|
186
|
+
const ok = 'TARGET_MODULE = features/weatherdisplay\nTARGET_MODULE fragment:Search = features/placesearch';
|
|
187
|
+
assert.equal(placementProblem(ok, g), null);
|
|
188
|
+
assert.match(placementProblem(ok + '\nMainFragment 内容可放 features/weatherdisplay', g), /lets the agent choose/);
|
|
189
|
+
assert.match(placementProblem(ok + '\nPick the target module by function.', g), /lets the agent choose/);
|
|
190
|
+
assert.match(placementProblem(ok + '\n搜索面板可放在 `features/placesearch` 或 products/phone', g), /lets the agent choose/);
|
|
191
|
+
assert.match(placementProblem(ok + '\n由你自行选择模块', g), /lets the agent choose/);
|
|
192
|
+
// UI wording that only looks like a choice
|
|
193
|
+
for (const l of ['图片可放大查看', '列表项可放置拖拽手柄', '用户可选择城市', 'Rows are sorted by function name.',
|
|
194
|
+
'该弹窗可放在 `components/FooDialog.ets`', '页面可放到 pages/SettingsPage.ets', '可放在 features/weather/src/main/ets/pages/A.ets']) {
|
|
195
|
+
assert.equal(placementProblem(`${ok}\n${l}`, g), null, l);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// a2h-arch-generate's contract: one row per capability package, none for the module root
|
|
200
|
+
const CONTRACT = `## 模块语义
|
|
201
|
+
|
|
202
|
+
| 模块路径 | 模块功能 |
|
|
203
|
+
|---|---|
|
|
204
|
+
| products/phone/src/main/ets/entryability | 应用入口:承载应用启动。 |
|
|
205
|
+
| products/phone/src/main/ets/pages | 路由注册与壳页面。 |
|
|
206
|
+
| features/weatherdisplay/src/main/ets/pages | 主页面与今日天气详情的界面和交互。 |
|
|
207
|
+
| features/weatherdisplay/src/main/ets/components | 天气卡片组件。 |
|
|
208
|
+
| features/weatherforecast/src/main/ets/data | 调用预报接口并维护共享状态。 |
|
|
209
|
+
`;
|
|
210
|
+
|
|
211
|
+
test('designModules folds capability rows into their module root', () => {
|
|
212
|
+
const mods = mp.designModules(CONTRACT + '| features/settings/src/main/resources | 资源 |\n');
|
|
213
|
+
assert.deepEqual([...mods.keys()], ['products/phone', 'features/weatherdisplay', 'features/weatherforecast']);
|
|
214
|
+
assert.match(mods.get('features/weatherdisplay'), /^pages: .*; components: /);
|
|
215
|
+
// with a project tree only roots that are modules count
|
|
216
|
+
w(path.join(hp, 'build-profile.json5'), '{}');
|
|
217
|
+
w(path.join(hp, 'features/weatherdisplay/src/main/module.json5'), '{}');
|
|
218
|
+
assert.deepEqual([...mp.designModules(CONTRACT, hp).keys()], ['features/weatherdisplay']);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('a contract-shaped design still flags a UI module that receives no group', () => {
|
|
222
|
+
bcs.build(ws, ui);
|
|
223
|
+
const plan = read(path.join(ui, 'conversion_set.json')).plan;
|
|
224
|
+
place({ 'activity:Main': { module: 'products/phone' }, 'fragment:Main': { module: 'products/phone' },
|
|
225
|
+
'fragment:Settings': { module: 'products/phone' } });
|
|
226
|
+
const ps = mp.problems(read(mp.placementPath(hp)), plan, mp.designModules(CONTRACT)).join('\n');
|
|
227
|
+
assert.match(ps, /design module features\/weatherdisplay describes UI/);
|
|
228
|
+
assert.doesNotMatch(ps, /features\/weatherforecast/);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
test('designPath: the architecture baseline comes before the code-refreshed project_design.md', () => {
|
|
233
|
+
const hp = fs.mkdtempSync(path.join(os.tmpdir(), 'mp-dp-'));
|
|
234
|
+
try {
|
|
235
|
+
const meta = path.join(hp, '.hometrans');
|
|
236
|
+
w(path.join(meta, 'project_design.md'), 'refreshed from code');
|
|
237
|
+
assert.equal(mp.designPath(hp), path.join(meta, 'project_design.md'));
|
|
238
|
+
w(path.join(meta, 'arch_baseline', 'project_design.md'), 'baseline');
|
|
239
|
+
assert.equal(mp.designPath(hp), path.join(meta, 'arch_baseline', 'project_design.md'));
|
|
240
|
+
w(path.join(meta, 'arch_generate', 'formal_docs', 'PROJECT_DESIGN.md'), 'arch output');
|
|
241
|
+
assert.equal(mp.designPath(hp), path.join(meta, 'arch_generate', 'formal_docs', 'PROJECT_DESIGN.md'));
|
|
242
|
+
} finally { fs.rmSync(hp, { recursive: true, force: true }); }
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
test('designModules: backticked rows with ./ or a trailing slash are the same module', () => {
|
|
246
|
+
const t = '## 模块语义\n\n| 模块路径 | 模块功能 |\n|---|---|\n| `features/x/` | 设置界面 |\n| `./features/y` | 列表页面 |\n';
|
|
247
|
+
assert.deepEqual([...mp.designModules(t).keys()], ['features/x', 'features/y']);
|
|
248
|
+
});
|