@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
|
@@ -11,6 +11,7 @@ import { canonicalDraftPath, createRecoveryBatch, readDraftWithHash, scanAttempt
|
|
|
11
11
|
import {
|
|
12
12
|
commitSubmission,
|
|
13
13
|
loadCanonicalDrafts,
|
|
14
|
+
precheckDrafts,
|
|
14
15
|
readSubmissionSnapshot,
|
|
15
16
|
submitDrafts,
|
|
16
17
|
validateSubmission,
|
|
@@ -384,22 +385,65 @@ test("a retry cannot rewrite an already-published part of a partial submission",
|
|
|
384
385
|
assert.equal(fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8"), ledgerBefore);
|
|
385
386
|
});
|
|
386
387
|
|
|
387
|
-
test("
|
|
388
|
+
test("a corrected draft submits after a precheck failure without an abandon", () => {
|
|
388
389
|
const d = seededPlan(["p1"]);
|
|
389
390
|
const { token } = claim(d, "g1");
|
|
390
391
|
const bad = path.join(d, "bad-terminal.json");
|
|
391
392
|
writeJsonAtomic(bad, { ...compliantDraft("p1", "p1"), summary: "Too short" });
|
|
392
|
-
submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: bad }] });
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
393
|
+
const failed = submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: bad }] });
|
|
394
|
+
assert.equal(failed.precheckFailed, true);
|
|
395
|
+
assert.equal(failed.retryable, true);
|
|
396
|
+
assert.equal(fold(d).groups.get("g1").state, "live");
|
|
397
|
+
assert.equal(fs.existsSync(canonicalDraftPath(d, 1, "p1")), false);
|
|
397
398
|
|
|
398
|
-
const
|
|
399
|
+
const good = writeInputDraft(d, "good-after-precheck.json", "p1", "p1");
|
|
400
|
+
const retry = submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: good }] });
|
|
399
401
|
|
|
400
|
-
assert.deepEqual(retry.accepted, []);
|
|
401
|
-
assert.equal(
|
|
402
|
-
assert.equal(fs.
|
|
402
|
+
assert.deepEqual(retry.accepted, ["p1"]);
|
|
403
|
+
assert.equal(fold(d).groups.get("g1").state, "submitted");
|
|
404
|
+
assert.equal(fs.existsSync(canonicalDraftPath(d, 1, "p1")), true);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
test("a dry-run precheck reports failures without writing the ledger", () => {
|
|
408
|
+
const d = seededPlan(["p1"]);
|
|
409
|
+
const { token } = claim(d, "g1");
|
|
410
|
+
const bad = path.join(d, "dry-bad.json");
|
|
411
|
+
writeJsonAtomic(bad, { ...compliantDraft("p1", "p1"), summary: "Too short" });
|
|
412
|
+
const before = fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8");
|
|
413
|
+
|
|
414
|
+
const result = precheckDrafts(d, "g1", { token, drafts: [{ path: bad }] });
|
|
415
|
+
|
|
416
|
+
assert.equal(result.ok, false);
|
|
417
|
+
assert.equal(result.attempt, 1);
|
|
418
|
+
assert.ok(result.failures.some(failure => failure.gate === "G6"));
|
|
419
|
+
assert.equal(fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8"), before);
|
|
420
|
+
assert.equal(fold(d).groups.get("g1").state, "claimed");
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
test("a dry-run precheck passes a compliant draft without writing the ledger", () => {
|
|
424
|
+
const d = seededPlan(["p1"]);
|
|
425
|
+
const { token } = claim(d, "g1");
|
|
426
|
+
const good = writeInputDraft(d, "dry-good.json", "p1", "p1");
|
|
427
|
+
const before = fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8");
|
|
428
|
+
|
|
429
|
+
const result = precheckDrafts(d, "g1", { token, drafts: [{ path: good }] });
|
|
430
|
+
|
|
431
|
+
assert.equal(result.ok, true);
|
|
432
|
+
assert.deepEqual(result.failures, []);
|
|
433
|
+
assert.equal(fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8"), before);
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
test("a dry-run precheck allows a valid partial group just like submit", () => {
|
|
437
|
+
const d = seededPlan(["p1", "p2"]);
|
|
438
|
+
const { token } = claim(d, "g1");
|
|
439
|
+
const partial = writeInputDraft(d, "dry-partial.json", "p1", "p1");
|
|
440
|
+
const before = fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8");
|
|
441
|
+
|
|
442
|
+
const result = precheckDrafts(d, "g1", { token, drafts: [{ path: partial }] });
|
|
443
|
+
|
|
444
|
+
assert.equal(result.ok, true);
|
|
445
|
+
assert.equal(result.complete, false);
|
|
446
|
+
assert.equal(fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8"), before);
|
|
403
447
|
});
|
|
404
448
|
|
|
405
449
|
test("split page parts use distinct canonical stems and complete only together", () => {
|
|
@@ -442,7 +486,7 @@ test("one bad input does not fail a valid partial submission", () => {
|
|
|
442
486
|
assert.equal(events(d).some(e => e.ev === "abandon"), false);
|
|
443
487
|
});
|
|
444
488
|
|
|
445
|
-
test("
|
|
489
|
+
test("a content precheck failure keeps the attempt alive and records a budget event", () => {
|
|
446
490
|
const d = seededPlan(["p1", "p2"]);
|
|
447
491
|
const { token } = claim(d, "g1");
|
|
448
492
|
const badDraft = compliantDraft("p1", "p1");
|
|
@@ -450,18 +494,47 @@ test("real content failure abandons precheck instead of blaming a missing siblin
|
|
|
450
494
|
const bad = path.join(d, "bad-content.json");
|
|
451
495
|
writeJsonAtomic(bad, badDraft);
|
|
452
496
|
|
|
453
|
-
submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: bad }] });
|
|
497
|
+
const result = submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: bad }] });
|
|
454
498
|
|
|
499
|
+
assert.equal(result.precheckFailed, true);
|
|
500
|
+
assert.equal(result.retryable, true);
|
|
501
|
+
assert.equal(result.precheckFailures, 1);
|
|
455
502
|
const ledger = events(d);
|
|
456
503
|
assert.equal(ledger.some(e => e.ev === "submit"), false);
|
|
457
|
-
|
|
504
|
+
assert.equal(ledger.some(e => e.ev === "abandon"), false);
|
|
505
|
+
assert.equal(ledger.filter(e => e.ev === "precheck-failed").length, 1);
|
|
506
|
+
assert.match(ledger.find(e => e.ev === "precheck-failed").failure_reason, /G6/);
|
|
507
|
+
const group = fold(d).groups.get("g1");
|
|
508
|
+
assert.equal(group.state, "live");
|
|
509
|
+
assert.equal(group.precheckFailures, 1);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
test("the attempt abandons only after the precheck failure budget is exhausted", () => {
|
|
513
|
+
const d = seededPlan(["p1"]);
|
|
514
|
+
const { token } = claim(d, "g1");
|
|
515
|
+
const bad = path.join(d, "bad-budget.json");
|
|
516
|
+
writeJsonAtomic(bad, { ...compliantDraft("p1", "p1"), summary: "Too short" });
|
|
517
|
+
|
|
518
|
+
for (let i = 1; i <= 3; i += 1) {
|
|
519
|
+
const result = submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: bad }] });
|
|
520
|
+
assert.equal(result.precheckFailures, i);
|
|
521
|
+
assert.equal(result.retryable, true);
|
|
522
|
+
assert.equal(fold(d).groups.get("g1").state, "live");
|
|
523
|
+
}
|
|
524
|
+
assert.equal(events(d).filter(e => e.ev === "precheck-failed").length, 3);
|
|
525
|
+
assert.equal(events(d).some(e => e.ev === "abandon"), false);
|
|
526
|
+
|
|
527
|
+
const exhausted = submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: bad }] });
|
|
528
|
+
assert.equal(exhausted.precheckFailed, true);
|
|
529
|
+
assert.equal(exhausted.exhausted, true);
|
|
530
|
+
const abandons = events(d).filter(e => e.ev === "abandon");
|
|
458
531
|
assert.equal(abandons.length, 1);
|
|
459
532
|
assert.equal(abandons[0].reason, "precheck-failed");
|
|
460
533
|
assert.match(abandons[0].failure_reason, /G6/);
|
|
461
534
|
assert.equal(fold(d).groups.get("g1").state, "failed");
|
|
462
535
|
});
|
|
463
536
|
|
|
464
|
-
test("the submit CLI
|
|
537
|
+
test("the submit CLI reports a precheck failure with the remaining budget and no abandon", () => {
|
|
465
538
|
const d = seededPlan(["p1"]);
|
|
466
539
|
const { token } = claim(d, "g1");
|
|
467
540
|
const bad = path.join(d, "cli-bad-content.json");
|
|
@@ -475,11 +548,67 @@ test("the submit CLI exits nonzero and reports precheck failure without a succes
|
|
|
475
548
|
assert.notEqual(result.status, 0);
|
|
476
549
|
assert.doesNotMatch(`${result.stdout}\n${result.stderr}`, /Submitted:/);
|
|
477
550
|
assert.match(`${result.stdout}\n${result.stderr}`, /precheck|G6|summary/i);
|
|
551
|
+
assert.match(`${result.stdout}\n${result.stderr}`, /1\/3/);
|
|
552
|
+
assert.equal(fold(d).groups.get("g1").state, "live");
|
|
553
|
+
assert.equal(events(d).filter(event => event.ev === "precheck-failed").length, 1);
|
|
554
|
+
assert.equal(events(d).some(event => event.ev === "abandon"), false);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
test("the submit CLI never reports success for an abandoned attempt", () => {
|
|
558
|
+
const d = seededPlan(["p1"]);
|
|
559
|
+
const { token } = claim(d, "g1");
|
|
560
|
+
appendEvent(d, { ev: "abandon", group: "g1", attempt: 1, reason: "dispatch-error" });
|
|
561
|
+
const input = writeInputDraft(d, "cli-terminal.json", "p1", "p1");
|
|
562
|
+
const cli = fileURLToPath(new URL("../submit.mjs", import.meta.url));
|
|
563
|
+
const before = events(d).filter(event => event.ev === "submit").length;
|
|
564
|
+
|
|
565
|
+
const result = spawnSync(process.execPath, [
|
|
566
|
+
cli, d, "g1", "--token", token, "--draft", input,
|
|
567
|
+
], { encoding: "utf8", timeout: 5000 });
|
|
568
|
+
|
|
569
|
+
const output = `${result.stdout}\n${result.stderr}`;
|
|
570
|
+
assert.notEqual(result.status, 0, output);
|
|
571
|
+
assert.doesNotMatch(output, /Submitted:/);
|
|
572
|
+
assert.equal(events(d).filter(event => event.ev === "submit").length, before);
|
|
478
573
|
assert.equal(fold(d).groups.get("g1").state, "failed");
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
test("the submit CLI dry-run reports gate failures without touching the ledger", () => {
|
|
577
|
+
const d = seededPlan(["p1"]);
|
|
578
|
+
const { token } = claim(d, "g1");
|
|
579
|
+
const bad = path.join(d, "cli-dry-run.json");
|
|
580
|
+
writeJsonAtomic(bad, { ...compliantDraft("p1", "p1"), summary: "Too short" });
|
|
581
|
+
const cli = fileURLToPath(new URL("../submit.mjs", import.meta.url));
|
|
582
|
+
const before = fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8");
|
|
583
|
+
|
|
584
|
+
const result = spawnSync(process.execPath, [
|
|
585
|
+
cli, d, "g1", "--token", token, "--dry-run", "--draft", bad,
|
|
586
|
+
], { encoding: "utf8", timeout: 5000 });
|
|
587
|
+
|
|
588
|
+
assert.notEqual(result.status, 0);
|
|
589
|
+
assert.match(`${result.stdout}\n${result.stderr}`, /Precheck failed/i);
|
|
590
|
+
assert.match(`${result.stdout}\n${result.stderr}`, /G6/);
|
|
591
|
+
assert.equal(fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8"), before);
|
|
592
|
+
assert.equal(fold(d).groups.get("g1").state, "claimed");
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
test("a stale token explains the abandon and tells the worker to stop", () => {
|
|
596
|
+
const d = seededPlan(["p1"]);
|
|
597
|
+
const { token: staleToken } = claim(d, "g1");
|
|
598
|
+
appendEvent(d, { ev: "abandon", group: "g1", attempt: 1, reason: "dispatch-error" });
|
|
599
|
+
appendEvent(d, { ev: "retry", group: "g1", attempt: 1, force: false });
|
|
600
|
+
claim(d, "g1");
|
|
601
|
+
const input = writeInputDraft(d, "cli-stale.json", "p1", "p1");
|
|
602
|
+
const cli = fileURLToPath(new URL("../submit.mjs", import.meta.url));
|
|
603
|
+
|
|
604
|
+
const result = spawnSync(process.execPath, [
|
|
605
|
+
cli, d, "g1", "--token", staleToken, "--draft", input,
|
|
606
|
+
], { encoding: "utf8", timeout: 5000 });
|
|
607
|
+
|
|
608
|
+
assert.equal(result.status, 2);
|
|
609
|
+
assert.match(`${result.stdout}\n${result.stderr}`, /Token mismatch/i);
|
|
610
|
+
assert.match(`${result.stdout}\n${result.stderr}`, /abandoned/i);
|
|
611
|
+
assert.match(`${result.stdout}\n${result.stderr}`, /Stop editing drafts\/attempt-1/i);
|
|
483
612
|
});
|
|
484
613
|
|
|
485
614
|
test("commit rejects a canonical hash change without submit or abandon", () => {
|
|
@@ -544,7 +673,7 @@ test("commit rejects an identity change before publishing", () => {
|
|
|
544
673
|
assert.equal(fs.readFileSync(path.join(d, "ledger.jsonl"), "utf8"), before);
|
|
545
674
|
});
|
|
546
675
|
|
|
547
|
-
test("
|
|
676
|
+
test("repeated identical precheck failures consume the budget without writing canonical", () => {
|
|
548
677
|
const d = seededPlan(["p1"]);
|
|
549
678
|
const { token } = claim(d, "g1");
|
|
550
679
|
const badDraft = compliantDraft("p1", "p1");
|
|
@@ -552,14 +681,17 @@ test("same token retry after precheck failure is terminal without more events",
|
|
|
552
681
|
const bad = path.join(d, "bad-content.json");
|
|
553
682
|
writeJsonAtomic(bad, badDraft);
|
|
554
683
|
submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: bad }] });
|
|
555
|
-
assert.equal(fold(d).groups.get("g1").state, "
|
|
556
|
-
const before =
|
|
684
|
+
assert.equal(fold(d).groups.get("g1").state, "live");
|
|
685
|
+
const before = events(d).filter(event => event.ev === "precheck-failed").length;
|
|
557
686
|
|
|
558
687
|
const result = submitDrafts(d, "g1", { mode: "explicit", token, drafts: [{ path: bad }] });
|
|
559
688
|
|
|
560
|
-
assert.
|
|
561
|
-
assert.equal(
|
|
562
|
-
assert.equal(
|
|
689
|
+
assert.equal(result.precheckFailed, true);
|
|
690
|
+
assert.equal(result.retryable, true);
|
|
691
|
+
assert.equal(result.precheckFailures, before + 1);
|
|
692
|
+
assert.equal(events(d).filter(event => event.ev === "precheck-failed").length, before + 1);
|
|
693
|
+
assert.equal(fold(d).groups.get("g1").state, "live");
|
|
694
|
+
assert.equal(fs.existsSync(canonicalDraftPath(d, 1, "p1")), false);
|
|
563
695
|
});
|
|
564
696
|
|
|
565
697
|
test("commit rejects an abandon after validation without stale events", () => {
|
|
@@ -1050,9 +1182,9 @@ test("a missing assertion link fails precheck and never submits", () => {
|
|
|
1050
1182
|
assert.deepEqual(result.accepted, []);
|
|
1051
1183
|
assert.match(result.failureReason, /G4/);
|
|
1052
1184
|
assert.equal(events(d).some(event => event.ev === "submit"), false);
|
|
1053
|
-
|
|
1054
|
-
assert.equal(
|
|
1055
|
-
assert.equal(
|
|
1185
|
+
assert.equal(events(d).filter(event => event.ev === "precheck-failed").length, 1);
|
|
1186
|
+
assert.equal(events(d).some(event => event.ev === "abandon"), false);
|
|
1187
|
+
assert.equal(fold(d).groups.get("g1").state, "live");
|
|
1056
1188
|
assert.equal(fs.existsSync(canonicalDraftPath(d, 1, "page:Alpha")), false);
|
|
1057
1189
|
});
|
|
1058
1190
|
|
|
@@ -247,7 +247,7 @@ The checks are:
|
|
|
247
247
|
b. For any referenced but missing media resource, **create a placeholder SVG** file: a simple 24x24 SVG with a colored rectangle and the resource name as text, placed in `base/media/`. This ensures the project compiles.
|
|
248
248
|
c. Log all placeholder-created resources prominently in the conversion report under a dedicated "Placeholder Resources Created" section, so the developer knows these need to be replaced with real assets
|
|
249
249
|
d. Also scan for `$r('app.string.xxx')`, `$r('app.color.xxx')`, `$r('app.float.xxx')` references and verify those exist in the corresponding element JSON files
|
|
250
|
-
e. For any `lottie.loadAnimation({ path: 'lottie/xxx.json' })`
|
|
250
|
+
e. For any Lottie JSON reference found in `.ets` files (`getRawFileContentSync('lottie/xxx.json')` feeding `animationData`, or a legacy `lottie.loadAnimation({ path: 'lottie/xxx.json' })`), verify that `xxx.json` exists at `rawfile/lottie/xxx.json`. If missing, do NOT create a placeholder — Lottie animations have no meaningful placeholder — instead log it as an unresolved Lottie reference in the report so the developer can drop in the correct JSON or fix the path.
|
|
251
251
|
9. Before finishing verification, ensure every Android resource inventory row and every mapping row has the required metadata fields from `references/resource-mapping-rules.md`. If some fields cannot be proven, populate them with the rule-defined fallback labels (`Unknown`, `Common`, `Global`, `N/A`) rather than leaving them blank.
|
|
252
252
|
10. **Vector content fidelity (static, required)**: steps 1-9 above all check *existence* — that a file or key is present. **A file that exists and parses can still be visually wrong**, and existence checks cannot detect a dropped `clip-path` or a `fill` injected onto a stroke-only path. Run the bundled checker:
|
|
253
253
|
|
|
@@ -17,7 +17,7 @@ This document defines how to migrate Lottie animation resources from an Android
|
|
|
17
17
|
|
|
18
18
|
## Scope and Runtime Context
|
|
19
19
|
|
|
20
|
-
On HarmonyOS the animation library is `@ohos/lottie` (installed via `ohpm install @ohos/lottie`). The JSON files
|
|
20
|
+
On HarmonyOS the animation library is `@ohos/lottie` (installed via `ohpm install @ohos/lottie`). The JSON files land under `<ui_module>/src/main/resources/rawfile/lottie/`. `@ohos/lottie`'s `path` option reads only the module's `ets/` directory, so the hosting screen reads the JSON with `resourceManager.getRawFileContentSync('lottie/animation.json')`, decodes and `JSON.parse`s it, and passes it as `animationData` (a2h-batch-ui-align `references/lottie-integration.md` 4.5.2); a `path: 'lottie/animation.json'` yields a blank animation. This skill handles **only** the JSON asset migration and its reference bookkeeping — it does NOT generate ArkTS UI code. The developer rewrites the hosting screen(s) in ArkUI and calls `@ohos/lottie` from that screen using the paths this skill produced.
|
|
21
21
|
|
|
22
22
|
## How to Identify a Lottie JSON File
|
|
23
23
|
|
|
@@ -223,4 +223,4 @@ Also add these summary counters to the "Summary" section:
|
|
|
223
223
|
|
|
224
224
|
- Verify every migrated Lottie file is present under `rawfile/lottie/` in the HarmonyOS output.
|
|
225
225
|
- Verify every `lottie_fileName` / `lottie_rawRes` reference discovered in XML has a corresponding entry in the report's Lottie table.
|
|
226
|
-
- If `harmony_project_dir` already contains ArkTS code and any `.ets` file already
|
|
226
|
+
- If `harmony_project_dir` already contains ArkTS code and any `.ets` file already reads a Lottie JSON (`getRawFileContentSync('lottie/xxx.json')` for `animationData`, or a legacy `lottie.loadAnimation({ path: 'lottie/xxx.json' })`), verify the file exists at `rawfile/lottie/xxx.json`. If missing, do **not** create a placeholder SVG (that's the drawable rule) — instead log it prominently as an unresolved Lottie reference so the developer can either drop in the JSON manually or fix the path.
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
import * as fs from 'node:fs';
|
|
41
41
|
import * as path from 'node:path';
|
|
42
42
|
import * as zlib from 'node:zlib';
|
|
43
|
+
import { fileURLToPath } from 'node:url';
|
|
43
44
|
|
|
44
45
|
// ─────────────────────────────────────────────
|
|
45
46
|
// Constant tables
|
|
@@ -104,13 +105,47 @@ const ANDROID_SYSTEM_DIMENS: Record<string, string> = {
|
|
|
104
105
|
notification_large_icon_height: '64vp',
|
|
105
106
|
};
|
|
106
107
|
|
|
107
|
-
/**
|
|
108
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Android framework strings used by framework widgets (dialogs, preference dialogs, action bars,
|
|
110
|
+
* text selection). Android resolves them on the device, so an app never owns the text; once the
|
|
111
|
+
* HarmonyOS side draws the same control itself, the values must be carried over per language.
|
|
112
|
+
*
|
|
113
|
+
* data/framework-strings/strings.json holds one table per HarmonyOS language directory
|
|
114
|
+
* (`en` is the default/base config). A language without a value falls back to the base entry and
|
|
115
|
+
* records a warning - never silently writes the English text into a localized resource.
|
|
116
|
+
*/
|
|
117
|
+
const FRAMEWORK_STRINGS_FILE = path.join(
|
|
118
|
+
path.dirname(fileURLToPath(import.meta.url)), '..', 'data', 'framework-strings', 'strings.json',
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
function loadFrameworkStrings(): Record<string, Record<string, string>> {
|
|
122
|
+
const tables: Record<string, Record<string, string>> = {};
|
|
123
|
+
let doc: Record<string, unknown> = {};
|
|
124
|
+
try {
|
|
125
|
+
doc = JSON.parse(fs.readFileSync(FRAMEWORK_STRINGS_FILE, 'utf8')) as Record<string, unknown>;
|
|
126
|
+
} catch (_e) { return tables; }
|
|
127
|
+
for (const [lang, table] of Object.entries(doc)) {
|
|
128
|
+
if (table !== null && typeof table === 'object') tables[lang] = table as Record<string, string>;
|
|
129
|
+
}
|
|
130
|
+
return tables;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const FRAMEWORK_STRINGS: Record<string, Record<string, string>> = loadFrameworkStrings();
|
|
134
|
+
|
|
135
|
+
/** Framework strings of the default (English) config; also the fallback for a missing translation. */
|
|
136
|
+
const ANDROID_SYSTEM_STRINGS: Record<string, string> = FRAMEWORK_STRINGS.en ?? {
|
|
109
137
|
ok: 'OK', cancel: 'Cancel', yes: 'Yes', no: 'No',
|
|
110
138
|
copy: 'Copy', cut: 'Cut', paste: 'Paste', selectAll: 'Select all',
|
|
111
139
|
search_go: 'Search', unknownName: 'Unknown',
|
|
112
140
|
};
|
|
113
141
|
|
|
142
|
+
/** The language part of a HarmonyOS qualifier dir: `base` -> '', `ru` -> 'ru', `zh_CN-dark` -> 'zh_CN'. */
|
|
143
|
+
function qualifierLanguage(qdir: string): string {
|
|
144
|
+
if (!qdir || qdir === 'base') return '';
|
|
145
|
+
const head = qdir.split('-')[0];
|
|
146
|
+
return /^[a-z]{2,3}(?:_[A-Za-z0-9]+)?$/.test(head) ? head : '';
|
|
147
|
+
}
|
|
148
|
+
|
|
114
149
|
/** Fallback values by type when resolution fails. See SKILL.md Step 5.2 "Fallback values by type". */
|
|
115
150
|
const FALLBACK_BY_KEY: Record<string, unknown> = {
|
|
116
151
|
color: '#ff000000', float: '0vp', string: '', integer: 0, boolean: false,
|
|
@@ -895,7 +930,7 @@ class Converter {
|
|
|
895
930
|
|
|
896
931
|
/** Resolves one raw Android text into a concrete value; null means it cannot be resolved. */
|
|
897
932
|
const resolve = (
|
|
898
|
-
key: string, raw: string, chain: string[], depth: number,
|
|
933
|
+
key: string, raw: string, chain: string[], depth: number, lang: string,
|
|
899
934
|
): { value: unknown; kind: ResolutionRecord['kind'] } | null => {
|
|
900
935
|
const v = raw.trim();
|
|
901
936
|
if (depth >= 5) return null;
|
|
@@ -904,10 +939,19 @@ class Converter {
|
|
|
904
939
|
|
|
905
940
|
const sys = /^@android:([a-z]+)\/(.+)$/.exec(v);
|
|
906
941
|
if (sys) {
|
|
942
|
+
const isString = sys[1] === 'string';
|
|
907
943
|
const table = sys[1] === 'color' ? ANDROID_SYSTEM_COLORS
|
|
908
944
|
: sys[1] === 'dimen' ? ANDROID_SYSTEM_DIMENS
|
|
909
|
-
:
|
|
910
|
-
|
|
945
|
+
: isString ? ANDROID_SYSTEM_STRINGS : null;
|
|
946
|
+
let hit = table?.[sys[2]];
|
|
947
|
+
if (isString) {
|
|
948
|
+
const localized = lang === '' ? undefined : FRAMEWORK_STRINGS[lang]?.[sys[2]];
|
|
949
|
+
if (localized !== undefined) {
|
|
950
|
+
hit = localized;
|
|
951
|
+
} else if (hit !== undefined && lang !== '') {
|
|
952
|
+
this.warnings.push(`@android:string/${sys[2]}: no ${lang} value in the framework table, fell back to base ("${hit}")`);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
911
955
|
if (hit !== undefined) {
|
|
912
956
|
chain.push(v);
|
|
913
957
|
return { value: key === 'integer' ? Number(hit) : hit, kind: 'system' };
|
|
@@ -922,7 +966,7 @@ class Converter {
|
|
|
922
966
|
const next = rawOf[targetKey]?.get(ref[2]);
|
|
923
967
|
if (next === undefined) return null;
|
|
924
968
|
chain.push(v);
|
|
925
|
-
return resolve(key, next, chain, depth + 1);
|
|
969
|
+
return resolve(key, next, chain, depth + 1, lang);
|
|
926
970
|
}
|
|
927
971
|
|
|
928
972
|
// Reached a literal: do the final conversion by target type
|
|
@@ -963,7 +1007,7 @@ class Converter {
|
|
|
963
1007
|
// `$type:name` (produced by toHarmonyRef) is written back as `@type/name` and goes through the same resolution chain
|
|
964
1008
|
const asAndroid = t.startsWith('$') ? `@${t.slice(1).replace(':', '/')}` : t;
|
|
965
1009
|
const chain: string[] = [];
|
|
966
|
-
const got = resolve(scalarKey, asAndroid, chain, 0);
|
|
1010
|
+
const got = resolve(scalarKey, asAndroid, chain, 0, qualifierLanguage(qdir));
|
|
967
1011
|
if (got) {
|
|
968
1012
|
this.counts.referencesResolved++;
|
|
969
1013
|
if (got.kind === 'system') this.counts.systemReferencesResolved++;
|
|
@@ -1001,7 +1045,7 @@ class Converter {
|
|
|
1001
1045
|
if (!unresolved) continue;
|
|
1002
1046
|
|
|
1003
1047
|
const chain: string[] = [];
|
|
1004
|
-
const got = resolve(key, entry.raw, chain, 0);
|
|
1048
|
+
const got = resolve(key, entry.raw, chain, 0, qualifierLanguage(qdir));
|
|
1005
1049
|
const loc = `${qdir}/element/${file}`;
|
|
1006
1050
|
|
|
1007
1051
|
if (got) {
|
|
@@ -1944,6 +1988,77 @@ class Converter {
|
|
|
1944
1988
|
|
|
1945
1989
|
// ── Directory traversal ──
|
|
1946
1990
|
|
|
1991
|
+
/**
|
|
1992
|
+
* Framework strings referenced only inside unmappable XML (styles, layouts, menus) never reach an
|
|
1993
|
+
* element file on their own: Android renders them on the device and the app owns no string for
|
|
1994
|
+
* them. Emit `fw_<name>` for the base directory and for every language directory this run
|
|
1995
|
+
* produced, so a self-drawn HarmonyOS control can reuse one localized value instead of inventing
|
|
1996
|
+
* an English-only key. Each emitted entry is recorded as a system-reference resolution.
|
|
1997
|
+
*/
|
|
1998
|
+
synthesizeFrameworkStrings(): void {
|
|
1999
|
+
const referenced = new Map<string, string>();
|
|
2000
|
+
const visit = (dir: string): void => {
|
|
2001
|
+
let entries: fs.Dirent[] = [];
|
|
2002
|
+
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch (_e) { return; }
|
|
2003
|
+
for (const entry of entries) {
|
|
2004
|
+
const full = path.join(dir, entry.name);
|
|
2005
|
+
if (entry.isDirectory()) { visit(full); continue; }
|
|
2006
|
+
if (!/\.xml$/i.test(entry.name)) continue;
|
|
2007
|
+
let text = '';
|
|
2008
|
+
try { text = fs.readFileSync(full, 'utf8'); } catch (_e) { continue; }
|
|
2009
|
+
const body = text.replace(/<!--[\s\S]*?-->/g, '');
|
|
2010
|
+
for (const m of body.matchAll(/@android:string\/([A-Za-z0-9_.]+)/g)) {
|
|
2011
|
+
if (!referenced.has(m[1])) referenced.set(m[1], path.relative(this.resDir, full).replace(/\\/g, '/'));
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
visit(this.resDir);
|
|
2016
|
+
|
|
2017
|
+
const wanted = [...referenced.keys()].filter((name) => name in ANDROID_SYSTEM_STRINGS).sort();
|
|
2018
|
+
if (wanted.length === 0) return;
|
|
2019
|
+
|
|
2020
|
+
// Target every language the source actually declares, not only the ones that produced a
|
|
2021
|
+
// mappable value: a page can have translations and still reference framework text from a style.
|
|
2022
|
+
const targets = new Set<string>();
|
|
2023
|
+
for (const qdir of this.elements.keys()) {
|
|
2024
|
+
if (qdir === 'base' || qualifierLanguage(qdir) !== '') targets.add(qdir);
|
|
2025
|
+
}
|
|
2026
|
+
targets.add('base');
|
|
2027
|
+
for (const entry of fs.readdirSync(this.resDir, { withFileTypes: true })) {
|
|
2028
|
+
if (!entry.isDirectory() || !/^values($|-)/.test(entry.name)) continue;
|
|
2029
|
+
const plan = planQualifiers(entry.name).plan;
|
|
2030
|
+
if (plan.skip) continue;
|
|
2031
|
+
if (plan.dir === 'base' || qualifierLanguage(plan.dir) !== '') targets.add(plan.dir);
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
const file = ELEMENT_KIND.string.file;
|
|
2035
|
+
for (const qdir of [...targets].sort()) {
|
|
2036
|
+
let byFile = this.elements.get(qdir);
|
|
2037
|
+
if (byFile === undefined) { byFile = new Map(); this.elements.set(qdir, byFile); }
|
|
2038
|
+
let byName = byFile.get(file);
|
|
2039
|
+
if (byName === undefined) { byName = new Map(); byFile.set(file, byName); }
|
|
2040
|
+
const lang = qualifierLanguage(qdir);
|
|
2041
|
+
for (const name of wanted) {
|
|
2042
|
+
const key = `fw_${name}`;
|
|
2043
|
+
if (byName.has(key)) continue;
|
|
2044
|
+
const base = ANDROID_SYSTEM_STRINGS[name];
|
|
2045
|
+
let value: string = base;
|
|
2046
|
+
if (lang !== '') {
|
|
2047
|
+
const localized = FRAMEWORK_STRINGS[lang]?.[name];
|
|
2048
|
+
if (localized !== undefined) value = localized;
|
|
2049
|
+
else this.warnings.push(`@android:string/${name}: no ${lang} value in the framework table, fell back to base ("${base}")`);
|
|
2050
|
+
}
|
|
2051
|
+
byName.set(key, { name: key, value, raw: `@android:string/${name}`, sourcePath: `${qdir}/element/${file}` });
|
|
2052
|
+
this.counts.referencesResolved++;
|
|
2053
|
+
this.counts.systemReferencesResolved++;
|
|
2054
|
+
this.resolutions.push({
|
|
2055
|
+
file: `${qdir}/element/${file}`, name: key, reference: `@android:string/${name}`,
|
|
2056
|
+
resolved: value, chain: `${referenced.get(name)} -> @android:string/${name}`, kind: 'system',
|
|
2057
|
+
});
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
|
|
1947
2062
|
run(): void {
|
|
1948
2063
|
const dirs = fs.readdirSync(this.resDir, { withFileTypes: true })
|
|
1949
2064
|
.filter((d) => d.isDirectory())
|
|
@@ -2017,6 +2132,7 @@ class Converter {
|
|
|
2017
2132
|
}
|
|
2018
2133
|
|
|
2019
2134
|
this.resolveReferences();
|
|
2135
|
+
this.synthesizeFrameworkStrings();
|
|
2020
2136
|
this.flushElements();
|
|
2021
2137
|
}
|
|
2022
2138
|
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Regenerate data/framework-strings/strings.json from an Android framework resource table.
|
|
4
|
+
*
|
|
5
|
+
* Android renders `@android:string/*` on the device, so an app owns neither the text nor its
|
|
6
|
+
* translations. Once HarmonyOS draws the same control itself (a preference dialog, a text-selection
|
|
7
|
+
* bar), the value has to be carried over per language - this tool produces that table.
|
|
8
|
+
*
|
|
9
|
+
* Source of truth is the AOSP resource XML (Apache-2.0). This tool reads a compiled framework table
|
|
10
|
+
* (`android.jar`) because every Android build environment already has one; regenerate from an AOSP
|
|
11
|
+
* checkout before redistribution and record the tag in manifest.json.
|
|
12
|
+
*
|
|
13
|
+
* node scripts/sync-framework-strings.mjs [--jar <android.jar>] [--aapt2 <aapt2>]
|
|
14
|
+
* [--out <dir>] [--api <level>]
|
|
15
|
+
*
|
|
16
|
+
* --jar defaults to $ANDROID_HOME/platforms/android-<latest>/android.jar
|
|
17
|
+
* --aapt2 defaults to $ANDROID_HOME/build-tools/<latest>/aapt2(.exe)
|
|
18
|
+
*/
|
|
19
|
+
import fs from 'node:fs';
|
|
20
|
+
import path from 'node:path';
|
|
21
|
+
import crypto from 'node:crypto';
|
|
22
|
+
import { spawnSync } from 'node:child_process';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
|
|
25
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const DEFAULT_OUT = path.join(HERE, '..', 'data', 'framework-strings');
|
|
27
|
+
|
|
28
|
+
/** HarmonyOS language directory -> Android resource config (`en` is the default config). */
|
|
29
|
+
const LANGUAGES = {
|
|
30
|
+
en: '',
|
|
31
|
+
ru: 'ru',
|
|
32
|
+
zh_CN: 'zh-rCN',
|
|
33
|
+
zh_TW: 'zh-rTW',
|
|
34
|
+
ja: 'ja',
|
|
35
|
+
ko: 'ko',
|
|
36
|
+
fr: 'fr',
|
|
37
|
+
de: 'de',
|
|
38
|
+
es: 'es',
|
|
39
|
+
pt: 'pt',
|
|
40
|
+
it: 'it',
|
|
41
|
+
ar: 'ar',
|
|
42
|
+
hi: 'hi',
|
|
43
|
+
th: 'th',
|
|
44
|
+
vi: 'vi',
|
|
45
|
+
id: 'in', // legacy AOSP config name for Indonesian
|
|
46
|
+
tr: 'tr',
|
|
47
|
+
nl: 'nl',
|
|
48
|
+
pl: 'pl',
|
|
49
|
+
uk: 'uk',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Strings a framework widget can surface. Only names that exist in the framework table are kept, so
|
|
54
|
+
* adding a speculative name here is harmless.
|
|
55
|
+
*/
|
|
56
|
+
const KEYS = [
|
|
57
|
+
'ok', 'cancel', 'yes', 'no',
|
|
58
|
+
'copy', 'cut', 'paste', 'selectAll', 'search_go', 'delete', 'undo', 'redo',
|
|
59
|
+
'action_menu_overflow_description', 'toolbar_collapse_description',
|
|
60
|
+
'capital_on', 'capital_off', 'unknownName',
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
function arg(argv, name) {
|
|
64
|
+
const i = argv.indexOf(`--${name}`);
|
|
65
|
+
return i >= 0 && argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[i + 1] : null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function latestVersioned(dir) {
|
|
69
|
+
if (!fs.existsSync(dir)) return null;
|
|
70
|
+
const entries = fs.readdirSync(dir)
|
|
71
|
+
.filter((n) => /^\d+/.test(n))
|
|
72
|
+
.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
|
|
73
|
+
return entries.length > 0 ? path.join(dir, entries[entries.length - 1]) : null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const sdk = process.env.ANDROID_HOME || process.env.ANDROID_SDK_ROOT || '';
|
|
77
|
+
const platformDir = latestVersioned(path.join(sdk, 'platforms'));
|
|
78
|
+
const jar = arg(process.argv, 'jar') || (platformDir ? path.join(platformDir, 'android.jar') : null);
|
|
79
|
+
const aapt2Dir = latestVersioned(path.join(sdk, 'build-tools'));
|
|
80
|
+
const aapt2 = arg(process.argv, 'aapt2') ||
|
|
81
|
+
(aapt2Dir ? path.join(aapt2Dir, process.platform === 'win32' ? 'aapt2.exe' : 'aapt2') : 'aapt2');
|
|
82
|
+
const outDir = arg(process.argv, 'out') || DEFAULT_OUT;
|
|
83
|
+
const api = arg(process.argv, 'api') || (jar ? (path.basename(path.dirname(jar)).replace(/\D/g, '') || 'unknown') : 'unknown');
|
|
84
|
+
|
|
85
|
+
if (!jar || !fs.existsSync(jar)) {
|
|
86
|
+
console.error(`[sync-framework-strings] android.jar not found: ${jar || '(no ANDROID_HOME)'}`);
|
|
87
|
+
process.exit(2);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const dump = spawnSync(aapt2, ['dump', 'resources', jar], { encoding: 'utf8', maxBuffer: 512 * 1024 * 1024 });
|
|
91
|
+
if (dump.status !== 0) {
|
|
92
|
+
console.error(`[sync-framework-strings] aapt2 failed: ${dump.stderr || dump.status}`);
|
|
93
|
+
process.exit(2);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const strings = {};
|
|
97
|
+
const reRes = /^\s+resource 0x[0-9a-f]+ string\/([A-Za-z0-9_.]+)/;
|
|
98
|
+
const reVal = /^\s+\(([^)]*)\) "(.*)"$/;
|
|
99
|
+
let cur = null;
|
|
100
|
+
for (const line of dump.stdout.split(/\r?\n/)) {
|
|
101
|
+
const r = reRes.exec(line);
|
|
102
|
+
if (r) { cur = r[1]; strings[cur] = strings[cur] || {}; continue; }
|
|
103
|
+
if (/^\s+resource /.test(line)) { cur = null; continue; }
|
|
104
|
+
if (cur === null) continue;
|
|
105
|
+
const v = reVal.exec(line);
|
|
106
|
+
if (v) strings[cur][v[1] || ''] = v[2];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const tables = {};
|
|
110
|
+
const missing = {};
|
|
111
|
+
for (const [lang, config] of Object.entries(LANGUAGES)) {
|
|
112
|
+
const table = {};
|
|
113
|
+
let absent = 0;
|
|
114
|
+
for (const key of KEYS) {
|
|
115
|
+
const value = strings[key]?.[config];
|
|
116
|
+
if (value === undefined) { absent++; continue; }
|
|
117
|
+
table[key] = value;
|
|
118
|
+
}
|
|
119
|
+
if (lang === 'en' && Object.keys(table).length === 0) {
|
|
120
|
+
console.error('[sync-framework-strings] no English values parsed - wrong jar or aapt2 output');
|
|
121
|
+
process.exit(2);
|
|
122
|
+
}
|
|
123
|
+
tables[lang] = table;
|
|
124
|
+
missing[lang] = absent;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
128
|
+
const tableFile = path.join(outDir, 'strings.json');
|
|
129
|
+
fs.writeFileSync(tableFile, `${JSON.stringify(tables, null, 2)}\n`, 'utf8');
|
|
130
|
+
|
|
131
|
+
const manifest = {
|
|
132
|
+
source: 'Android framework resource table (aapt2 dump resources)',
|
|
133
|
+
aospTag: null,
|
|
134
|
+
apiLevel: api,
|
|
135
|
+
note: 'Values are Android Open Source Project strings (Apache-2.0). Regenerate from an AOSP tag before redistribution and record it in aospTag.',
|
|
136
|
+
languages: Object.keys(LANGUAGES),
|
|
137
|
+
keys: Object.keys(tables.en),
|
|
138
|
+
requestedKeys: KEYS,
|
|
139
|
+
missingByLanguage: missing,
|
|
140
|
+
generatedAt: new Date().toISOString().slice(0, 10),
|
|
141
|
+
sha256: crypto.createHash('sha256').update(fs.readFileSync(tableFile)).digest('hex'),
|
|
142
|
+
};
|
|
143
|
+
fs.writeFileSync(path.join(outDir, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`, 'utf8');
|
|
144
|
+
|
|
145
|
+
console.log(`[sync-framework-strings] api=${api} languages=${Object.keys(LANGUAGES).length} keys=${manifest.keys.length}`);
|
|
146
|
+
console.log(` out: ${tableFile} (${fs.statSync(tableFile).size} B)`);
|
|
147
|
+
console.log(` missing by language: ${JSON.stringify(missing)}`);
|