@buaa_smat/hometrans 0.1.17 → 0.1.19

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.
Files changed (234) hide show
  1. package/README.md +120 -56
  2. package/agents/code-reviewer.md +321 -65
  3. package/agents/logic-coder.md +113 -88
  4. package/agents/logic-context-builder.md +47 -29
  5. package/agents/scripts/hmos-precheck/backends/arkts.mjs +567 -0
  6. package/agents/scripts/hmos-precheck/backends/arkts_diff.mjs +159 -0
  7. package/agents/scripts/hmos-precheck/backends/arkts_project_rules.mjs +398 -0
  8. package/agents/scripts/hmos-precheck/backends/codelinter.mjs +250 -0
  9. package/agents/scripts/hmos-precheck/backends/project_integrity.mjs +321 -0
  10. package/agents/scripts/hmos-precheck/backends/static_precheck.mjs +247 -0
  11. package/agents/scripts/hmos-precheck/core/config.mjs +184 -0
  12. package/agents/scripts/hmos-precheck/core/diagnostic_scope.mjs +20 -0
  13. package/agents/scripts/hmos-precheck/core/process_adapter.mjs +47 -0
  14. package/agents/scripts/hmos-precheck/core/project_catalog.mjs +50 -0
  15. package/agents/scripts/hmos-precheck/core/result_projection.mjs +147 -0
  16. package/agents/scripts/hmos-precheck/core/scope_plan.mjs +131 -0
  17. package/agents/scripts/hmos-precheck/core/sdk_context.mjs +67 -0
  18. package/agents/scripts/hmos-precheck/docs/architecture.md +37 -0
  19. package/agents/scripts/hmos-precheck/docs/performance-optimization.md +28 -0
  20. package/agents/scripts/hmos-precheck/docs/upstream-reference.json +19 -0
  21. package/agents/scripts/hmos-precheck/docs/validation.md +50 -0
  22. package/agents/scripts/hmos-precheck/index.mjs +17 -0
  23. package/agents/scripts/hmos-precheck/invocation.mjs +231 -0
  24. package/agents/scripts/hmos-precheck/rules/rule_case_matrix.csv +32 -0
  25. package/agents/scripts/hmos-precheck/rules/rule_inventory.csv +64 -0
  26. package/agents/scripts/hmos-precheck/rules/rule_inventory.mjs +59 -0
  27. package/agents/scripts/hmos-precheck/rules/rule_policy.mjs +54 -0
  28. package/agents/scripts/platform_query.mjs +626 -0
  29. package/agents/scripts/platform_query.test.mjs +422 -0
  30. package/agents/self-test-fixer.md +36 -34
  31. package/agents/self-tester.md +123 -143
  32. package/agents/test-case-generation-generator.md +317 -0
  33. package/agents/test-case-generation-validator.md +231 -0
  34. package/dist/cli/config-store.js +16 -63
  35. package/dist/cli/env-vars.js +1 -3
  36. package/dist/cli/index.js +0 -11
  37. package/dist/cli/init.js +123 -204
  38. package/dist/cli/uninstall.js +3 -127
  39. package/dist/utils/regex.js +8 -0
  40. package/env-requirements.json +55 -54
  41. package/package.json +6 -6
  42. package/resource/convert_pipeline_process.svg +103 -0
  43. package/resource/project_architecture.svg +122 -0
  44. package/resource/title_dark.png +0 -0
  45. package/skills/hmos-batch-ui-align/SKILL.md +345 -43
  46. package/skills/hmos-batch-ui-align/references/conversion-procedure.md +661 -180
  47. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
  48. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
  49. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
  50. package/skills/hmos-batch-ui-align/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -648
  51. package/skills/hmos-batch-ui-align/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2088 -2088
  52. package/skills/hmos-batch-ui-align/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -1033
  53. package/skills/hmos-batch-ui-align/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -1183
  54. package/skills/hmos-batch-ui-align/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -576
  55. package/skills/hmos-batch-ui-align/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -297
  56. package/skills/hmos-batch-ui-align/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -395
  57. package/skills/hmos-batch-ui-align/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +902 -902
  58. package/skills/hmos-batch-ui-align/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -106
  59. package/skills/hmos-batch-ui-align/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -1178
  60. package/skills/hmos-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -911
  61. package/skills/hmos-batch-ui-align/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +354 -354
  62. package/skills/hmos-batch-ui-align/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -11
  63. package/skills/hmos-batch-ui-align/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -0
  64. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -0
  65. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -0
  66. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -0
  67. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -0
  68. package/skills/hmos-batch-ui-align/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -0
  69. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -0
  70. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -0
  71. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -0
  72. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -0
  73. package/skills/hmos-batch-ui-align/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -0
  74. package/skills/hmos-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -0
  75. package/skills/hmos-batch-ui-align/references/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1220 -0
  76. package/skills/hmos-batch-ui-align/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -0
  77. package/skills/hmos-batch-ui-align/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +133 -0
  78. package/skills/hmos-batch-ui-align/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -0
  79. package/skills/hmos-batch-ui-align/scripts/android_parse_fast.ts +1798 -0
  80. package/skills/hmos-batch-ui-align/scripts/arkts_static_check.ts +1592 -0
  81. package/skills/hmos-batch-ui-align/scripts/measure_pack.ts +752 -0
  82. package/skills/hmos-convert-pipeline/SKILL.md +168 -121
  83. package/skills/hmos-fix-build-errors/SKILL.md +87 -67
  84. package/skills/hmos-fix-build-errors/references/arkts-strict-patterns.md +219 -219
  85. package/skills/hmos-fix-build-errors/references/known-patterns.md +157 -157
  86. package/skills/hmos-fix-build-errors/references/rdb-entity-pattern.md +131 -131
  87. package/skills/hmos-incremental-ui-align/README.md +53 -36
  88. package/skills/hmos-incremental-ui-align/SKILL.md +179 -23
  89. package/skills/hmos-incremental-ui-align/diff_analysis.md +52 -52
  90. package/skills/hmos-incremental-ui-align/page_align.md +62 -62
  91. package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +38 -2
  92. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -648
  93. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2088 -2088
  94. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -1033
  95. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -1183
  96. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -576
  97. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -297
  98. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -395
  99. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +902 -902
  100. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -106
  101. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -1178
  102. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +911 -911
  103. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +354 -354
  104. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -11
  105. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -0
  106. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -0
  107. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -0
  108. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -0
  109. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -0
  110. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -0
  111. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -0
  112. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -0
  113. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -0
  114. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -0
  115. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -0
  116. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -0
  117. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1220 -0
  118. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -0
  119. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -0
  120. package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +74 -0
  121. package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +34 -4
  122. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
  123. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
  124. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
  125. package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +937 -0
  126. package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +343 -0
  127. package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +44 -5
  128. package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +977 -0
  129. package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +188 -0
  130. package/skills/hmos-integration-test/README.md +61 -70
  131. package/skills/hmos-integration-test/SKILL.md +128 -111
  132. package/skills/hmos-resources-convert/SKILL.md +334 -66
  133. package/skills/hmos-resources-convert/references/code-vector-icon-rules.md +335 -0
  134. package/skills/hmos-resources-convert/references/conversion-rules.md +676 -663
  135. package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +410 -388
  136. package/skills/hmos-resources-convert/references/lottie-conversion-rules.md +219 -0
  137. package/skills/hmos-resources-convert/references/resource-mapping-rules.md +482 -457
  138. package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +592 -513
  139. package/skills/hmos-resources-convert/scripts/a2h_resource_convert.ts +2163 -0
  140. package/skills/hmos-resources-convert/scripts/code_vector_icons.ts +591 -0
  141. package/skills/hmos-resources-convert/scripts/svg_fidelity_check.ts +632 -0
  142. package/skills/hmos-spec-generate/SKILL.md +293 -214
  143. package/skills/hmos-spec-generate/scripts/parse_requirements.ts +515 -0
  144. package/skills/hmos-spec-generate/template/REQ.txt +22 -0
  145. package/skills/hmos-spec-generate/template/REQ.xlsx +0 -0
  146. package/skills/hmos-test-case-generation/README.md +241 -0
  147. package/skills/hmos-test-case-generation/SKILL.md +324 -0
  148. package/skills/hmos-test-case-generation/references/contract.md +315 -0
  149. package/skills/hmos-test-case-generation/references/review-notes-template.md +84 -0
  150. package/skills/hmos-test-case-generation/references/ui-elements-schema.md +142 -0
  151. package/skills/hmos-test-case-generation/tools/convert_to_ui_elements.ts +550 -0
  152. package/skills/hmos-test-case-generation/tools/validate.ts +1312 -0
  153. package/tools/bfs-crawl/README.md +73 -0
  154. package/tools/bfs-crawl/android_viewtree_bfs_crawler.ts +1662 -0
  155. package/tools/test-tools/autotest/config.ts +175 -0
  156. package/tools/test-tools/autotest/deps/autotest-agent-0.1.1.tgz +0 -0
  157. package/tools/test-tools/autotest/docs/README.md +266 -0
  158. package/tools/test-tools/autotest/{testcases_schema.md → docs/testcases_schema.md} +1 -1
  159. package/tools/test-tools/autotest/engine/batch-launcher.ts +327 -0
  160. package/tools/test-tools/autotest/engine/report-tool.ts +773 -0
  161. package/tools/test-tools/autotest/engine/self-test-runner.ts +961 -0
  162. package/tools/test-tools/autotest/engine/testcases-tool.ts +246 -0
  163. package/tools/test-tools/autotest/paths.ts +41 -0
  164. package/tools/test-tools/autotest/resolve-metadata-tool.ts +143 -0
  165. package/tools/test-tools/autotest/runner/logger.ts +45 -0
  166. package/tools/test-tools/autotest/runner/process-utils.ts +41 -0
  167. package/tools/test-tools/autotest/validate.ts +167 -0
  168. package/agents/build-fixer.md +0 -385
  169. package/agents/logic-coder/scripts/platform_context_query.py +0 -568
  170. package/agents/review-fixer.md +0 -405
  171. package/agents/spec-generator.md +0 -541
  172. package/dist/cli/mcp-setup.js +0 -258
  173. package/dist/cli/mcp.js +0 -94
  174. package/dist/context/index.js +0 -694
  175. package/resource/migration_process.svg +0 -94
  176. package/resource/migration_process_transparent.svg +0 -93
  177. package/skills/hmos-batch-ui-align/scripts/android_parse_fast.py +0 -1606
  178. package/skills/hmos-incremental-ui-align/scripts/__pycache__/app_feature_verify.cpython-314.pyc +0 -0
  179. package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.py +0 -542
  180. package/skills/hmos-incremental-ui-align/scripts/page_capture.py +0 -597
  181. package/skills/hmos-resources-convert/evals/evals.json +0 -171
  182. package/skills/hmos-resources-convert/template/AppScope/app.json5 +0 -10
  183. package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +0 -8
  184. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
  185. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
  186. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +0 -7
  187. package/skills/hmos-resources-convert/template/build-profile.json5 +0 -42
  188. package/skills/hmos-resources-convert/template/code-linter.json5 +0 -32
  189. package/skills/hmos-resources-convert/template/entry/build-profile.json5 +0 -33
  190. package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +0 -6
  191. package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +0 -23
  192. package/skills/hmos-resources-convert/template/entry/oh-package.json5 +0 -10
  193. package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +0 -48
  194. package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +0 -16
  195. package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +0 -23
  196. package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +0 -55
  197. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +0 -8
  198. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +0 -8
  199. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +0 -16
  200. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
  201. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
  202. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +0 -7
  203. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
  204. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +0 -3
  205. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +0 -5
  206. package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +0 -8
  207. package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +0 -2
  208. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +0 -35
  209. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +0 -5
  210. package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +0 -16
  211. package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +0 -5
  212. package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +0 -33
  213. package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +0 -23
  214. package/skills/hmos-resources-convert/template/hvigorfile.ts +0 -6
  215. package/skills/hmos-resources-convert/template/oh-package-lock.json5 +0 -28
  216. package/skills/hmos-resources-convert/template/oh-package.json5 +0 -10
  217. package/skills/hmos-resources-convert/tools/apktool_3.0.1.jar +0 -0
  218. package/skills/hmos-spec-generate/references/android-platform-tokens.md +0 -105
  219. package/skills/hmos-spec-generate/references/spec-sample-1.md +0 -78
  220. package/skills/hmos-spec-generate/references/spec-sample-2.md +0 -58
  221. package/skills/hmos-spec-generate/references/spec-sample-3.md +0 -116
  222. package/skills/hmos-spec-generate/references/step4-report-template.md +0 -33
  223. package/tools/test-tools/autotest/README.md +0 -238
  224. package/tools/test-tools/autotest/pyproject.toml +0 -26
  225. package/tools/test-tools/autotest/report_tool.py +0 -759
  226. package/tools/test-tools/autotest/self_test_runner.py +0 -895
  227. package/tools/test-tools/autotest/testcases_tool.py +0 -215
  228. package/tools/test-tools/autotest/uv.lock +0 -3156
  229. package/tools/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
  230. package/tools/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
  231. package/tools/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
  232. package/tools/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
  233. package/tools/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
  234. package/tools/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
@@ -1,4 +1,4 @@
1
- # hmos-ui-align
1
+ # hmos-incremental-ui-align
2
2
 
3
3
  HarmonyOS-Android UI 自动对齐流水线。
4
4
 
@@ -13,7 +13,7 @@ HarmonyOS-Android UI 自动对齐流水线。
13
13
  每多一个页面/弹窗/tab,上述步骤都要重复一遍,非常费时。
14
14
 
15
15
  本 skill 做了三件事:
16
- - 用 phone-agent 自动**寻路**(根据自然语言点到指定页面,模型复用 `~/.hometrans/config.json` 统一配置)
16
+ - 自动**寻路**(视觉模型根据自然语言点到指定页面,模型复用 `~/.hometrans/config.json` 统一配置)
17
17
  - 自动**采集** view tree + 截图(安卓走 adb、鸿蒙走 hdc)
18
18
  - 自动**对比 + 改码**,并按 MVVM 模式把 mock 数据放到 Model 层
19
19
 
@@ -30,10 +30,10 @@ HarmonyOS-Android UI 自动对齐流水线。
30
30
  - 鸿蒙设备:已装目标 App,`hdc list targets` 能看到
31
31
  - 两台设备建议都保持亮屏解锁
32
32
 
33
- 2. **Python 依赖**
34
- 无需手动安装。脚本通过 `uv run` 调用,`openpyxl` / `phone-agent` 已在 `app_feature_verify.py` 顶部的 PEP 723 内联元数据里声明,uv 首次运行时自动解析安装(走清华镜像)。只需确保已安装 `uv`(`uv --version`)。
33
+ 2. **运行时依赖**
34
+ - 采集脚本 `page_capture.ts` 与寻路脚本 `app_feature_verify.ts` 均为 TypeScript 版,用 Node 直接运行(Node ≥ 22.18 或 ≥ 23.6,原生剥离类型,无需编译、零第三方依赖)。确认 `node --version` 即可,无需 Python / uv。
35
35
 
36
- 3. **模型配置**(phone-agent 导航用)
36
+ 3. **模型配置**(寻路导航用)
37
37
  与自测共用同一个多模态模型:`ht init` 把模型四要素(api_key / name / base_url / provider)写入 `~/.hometrans/config.json` 的 `autotest.unified_model`,并导出为 `HOMETRANS_MODEL_*` 环境变量。脚本优先读环境变量,缺失时回落 config.json;都没有时兼容老版本的 `GLM_API_KEY`(走智谱 GLM 端点)。无需单独设置 API Key。
38
38
 
39
39
  4. **鸿蒙 SDK 路径**(给改码阶段查 API 用)
@@ -73,14 +73,14 @@ HarmonyOS-Android UI 自动对齐流水线。
73
73
  在 Claude Code 里直接调用 skill,**把两个工程目录附在需求里**(可作为命名参数,也可在自然语言里说明):
74
74
 
75
75
  ```
76
- /hmos-ui-align android_project_dir: <安卓工程绝对路径> harmony_project_dir: <鸿蒙工程绝对路径>
76
+ /hmos-incremental-ui-align android_project_dir: <安卓工程绝对路径> harmony_project_dir: <鸿蒙工程绝对路径>
77
77
  <自然语言需求,描述要对齐的页面+点击路径>
78
78
  ```
79
79
 
80
80
  ### 写需求的三个要点
81
81
 
82
82
  1. **页面路径写清楚**
83
- 用「→」或「-」标注一级一级的点击步骤,比如 `首页 → 点击"AI智能填报" → 点击"专业"筛选按钮`。路径越具体,phone-agent 寻路成功率越高。
83
+ 用「→」或「-」标注一级一级的点击步骤,比如 `首页 → 点击"AI智能填报" → 点击"专业"筛选按钮`。路径越具体,寻路成功率越高。
84
84
 
85
85
  2. **说明是否要覆盖交互态**
86
86
  默认会自动扫描 tab、弹窗、下拉等交互元素并逐个采集。如果只想对齐主页面,请明确说「只对齐主页面,不管弹窗和 tab」。
@@ -92,20 +92,20 @@ HarmonyOS-Android UI 自动对齐流水线。
92
92
 
93
93
  **例 1(单个弹窗对齐)**
94
94
  ```
95
- /hmos-ui-align 鸿蒙版本app(登录状态下,进入首页-点击"AI智能填报"-点击"专业"筛选按钮)
95
+ /hmos-incremental-ui-align 鸿蒙版本app(登录状态下,进入首页-点击"AI智能填报"-点击"专业"筛选按钮)
96
96
  得到的弹窗样式和安卓同样路径得到的页面不一致,请修改鸿蒙源码将上述页面与安卓版本完全对齐
97
97
  ```
98
98
 
99
99
  **例 2(补齐缺失页面 + 调真实后台)**
100
100
  ```
101
- /hmos-ui-align 鸿蒙版本app(点击我的-超级会员组件)显示与安卓不一致,且安卓版本在超级会员
101
+ /hmos-incremental-ui-align 鸿蒙版本app(点击我的-超级会员组件)显示与安卓不一致,且安卓版本在超级会员
102
102
  上点击"会员中心"会跳到超级会员弹窗页,鸿蒙也没有这页。请修改鸿蒙源码将这些页面与安卓版本
103
103
  完全对齐,不要mock数据,调用真实后台数据
104
104
  ```
105
105
 
106
106
  **例 3(多级路径 + 多个页面)**
107
107
  ```
108
- /hmos-ui-align 鸿蒙版本(点击底部高考按钮 -> 带年纪查专业 -> 点击某一具体专业(如临床医学)
108
+ /hmos-incremental-ui-align 鸿蒙版本(点击底部高考按钮 -> 带年纪查专业 -> 点击某一具体专业(如临床医学)
109
109
  -> 点击就业分析,到达"专业就业健康度"展示页面)以及在"专业就业健康度"页面上点击"完整数
110
110
  据指标"到达的就业健康度详情页都和安卓同一路径的不一致。比较这些页面的差别并将他们在视觉
111
111
  效果上完全对齐,不要用mock数据,调用后台真实逻辑
@@ -115,16 +115,18 @@ HarmonyOS-Android UI 自动对齐流水线。
115
115
 
116
116
  ## 运行过程中会发生什么
117
117
 
118
- skill 会严格按 `SKILL.md` 里的 5 步流水线跑:
118
+ skill 会严格按 `SKILL.md` 里的流水线跑:
119
119
 
120
120
  ### Step 0 · 解析入参
121
121
  读取调用入参 `android_project_dir` / `harmony_project_dir` / `capture_output_dir`,并按统一链路「环境变量 → config.json → 询问」解析 `HOMETRANS_MODEL_*`(统一模型,回落 `~/.hometrans/config.json` 的 `autotest.unified_model`)与 `OHOS_SDK_PATH` / `HMS_SDK_PATH`(回落 config.json 的 `env.*`;**Step 0.0** 会先做存在性检查,两层都缺失才要求用户输入)。随后 **Step 0.1** 按两个工程目录自动解析两端的 App 显示名与包名(无需手动配置)。
122
122
 
123
123
  ### Step 1 · 双端页面采集
124
124
  1.1 解析你的需求,拆成一组「基础页」,每个基础页有 `android_nav_path` 和 `hmos_nav_path`
125
- 1.2 对每个基础页,两端分别:phone-agent 寻路 → 成功后 `page_capture.py` 截图 + dump view tree
125
+ 1.2 对每个基础页,两端分别:`app_feature_verify.ts` 寻路 → 成功后 `page_capture.ts` 截图 + dump view tree
126
126
  1.3 扫描基础页 view tree,发现 tab、弹窗、下拉等交互元素,自动对每个子状态再采集一遍
127
- 1.4 鸿蒙端页面不存在时,寻路会失败,对应目录留空(Step 2 会改从源码读)
127
+ 1.4 扫描安卓源码里的动画/Toast/语音传感器等 API,产出 `dynamic_ui_inventory.md`(截图和 view tree 抓不到这些效果)
128
+ 1.5 识别多状态组件(如语音输入的 idle/recording/cancelling),读源码建 `state_model.md`,用 `page_capture_burst.ts` 连续采帧捕捉每个状态的代表帧
129
+ 1.6 鸿蒙端页面不存在时,寻路会失败,对应目录留空(Step 2 会改从源码读)
128
130
 
129
131
  产物目录结构:
130
132
  ```
@@ -133,27 +135,32 @@ skill 会严格按 `SKILL.md` 里的 5 步流水线跑:
133
135
  android_page_1_{name}/
134
136
  screenshot.png
135
137
  view_tree.xml
138
+ meta.json # 含 dpi / density_factor,供换算用
136
139
  hmos_page_1_{name}/
137
140
  screenshot.png
138
141
  view_tree.xml
142
+ meta.json
139
143
  android_page_1_{name}_popup_filter/
140
144
  ...
145
+ dynamic_ui_inventory.md # Step 1.4 产物
146
+ state_model.md # Step 1.5 产物(仅多状态组件存在时)
141
147
  ```
142
148
 
143
149
  ### Step 2 · UI 差异分析
144
150
  主 agent 串行执行,不会下放给子 agent(保证质量):
145
- - **2.1** 读安卓 screenshot + view tree,写 `android_page_*/UI_Analysis.md`(组件清单 + 位置 / 颜色 / icon / 尺寸 / 对齐方式等)
151
+ - **2.1** 读安卓 screenshot + view tree,写 `android_page_*/UI_Analysis.md`(组件清单 + 位置 / 颜色 / icon / 尺寸 / 对齐方式等),并附加 `dynamic_ui_inventory.md` 里与该页相关的动态效果
146
152
  - **2.2** 读鸿蒙 screenshot + view tree,写 `hmos_page_*/UI_Analysis.md`;鸿蒙页不存在时改读源码写 `UI_Analysis_from_code.md`
147
- - **2.3** 两份 Analysis 对比,按 `references/Comparison_Template.md` 生成 `UI_comparison.md`(markdown diff 表)
153
+ - **2.3** 两份 Analysis 对比,按 `references/Comparison_Template.md` 生成 `UI_comparison.md`(静态组件 diff 表 + 动态UI diff 表 + 状态机 diff 表)
148
154
  - **2.4** 验证所有 `UI_Analysis*.md` 和 `UI_comparison.md` 都已写全
149
155
 
150
- 所有尺寸都会以 `126px (3x → 42vp)` 的格式同时给出原始 px、设备密度、换算后的 vp。
156
+ 所有尺寸都会以 `126px (3.0x → 42vp)` 的格式同时给出原始 px、**从各自 `meta.json` 读到的真实设备密度**、换算后的 vp(不再假设固定 3x)。
151
157
 
152
158
  ### Step 3 · 改鸿蒙源码
153
- - 把每个 `UI_comparison.md` 里的 diff 项汇总到 `{task_dir}/fix_checklist.md`(唯一 source of truth)
154
- - 读 `references/MVVM开发文档/` 学习 MVVM 模式
159
+ - 跑 `node ./scripts/extract_checklist.ts --task-dir "{task_dir}"` 确定性地从所有 `UI_comparison.md` 抽取 diff 项,生成 `{task_dir}/fix_checklist.md`(唯一 source of truth),并核对脚本输出的 `items >= diff_rows` 对账报告,避免人工枚举漏项
160
+ - 先探测工程状态管理范式(V1/V2,工程级判定一次):新工程/0→1 转换默认 V2,已有 V1 的工程沿用 V1
161
+ - 按范式读对应文档:V1 读 `references/MVVM开发文档/`,V2 读 `references/MVVM开发文档V2/`(详见 `references/MVVM开发文档V2/_范式选择说明.md`)
155
162
  - 读 `page_align.md` 学习转换规则
156
- - 逐条修 diff,每修一个把 `- [ ]` 改成 `- [x]`
163
+ - 逐条修 diff,每修一个把 `- [ ]` 改成 `- [x]`;`[STATE]`/`[TRANSITION]`/`[ANIMATION]` 类条目需按 `state_model.md` 精确复制手势阈值和动画参数
157
164
  - 每个尺寸 / icon / alignment 都要回溯到安卓源码的 XML 或资源值,不允许"看起来差不多"
158
165
 
159
166
  ### Step 4 · 编译校验
@@ -164,19 +171,23 @@ skill 会严格按 `SKILL.md` 里的 5 步流水线跑:
164
171
  ## 目录结构
165
172
 
166
173
  ```
167
- Agents/hmos-ui-align/
174
+ skills/hmos-incremental-ui-align/
168
175
  ├── SKILL.md # 流水线定义(主 agent 执行逻辑)
169
- ├── readme.md # 本文档
176
+ ├── README.md # 本文档
170
177
  ├── page_align.md # Step 3 的转换规则
171
- ├── diff_analysis.md # 内部说明
178
+ ├── diff_analysis.md # Step 2.3 的对比分析细则
172
179
  ├── scripts/
173
- │ ├── app_feature_verify.py # phone-agent 寻路工具
174
- │ ├── page_capture.py # view tree + 截图采集工具
175
- │ └── navigation-capure.md # 两个脚本的调用约定
180
+ │ ├── app_feature_verify.ts # 寻路工具(TypeScript,Node 直跑)
181
+ │ ├── page_capture.ts # view tree + 截图采集工具(TypeScript,Node 直跑,含密度换算)
182
+ │ ├── page_capture_burst.ts # 连续帧采集工具(多状态组件用,TypeScript,Node 直跑)
183
+ │ ├── extract_checklist.ts # 确定性 diff→checklist 抽取工具(TypeScript,Node 直跑)
184
+ │ └── navigation-capure.md # 各脚本的调用约定
176
185
  └── references/
177
- ├── UI_Analysis_Template.md # Step 2 分析模板
178
- ├── Comparison_Template.md # Step 2.3 对比模板
179
- ├── MVVM开发文档/ # 鸿蒙 MVVM 参考
186
+ ├── UI_Analysis_Template.md # Step 2 分析模板(含动态UI/多状态章节)
187
+ ├── Comparison_Template.md # Step 2.3 对比模板(含动态UI/状态机对比章节)
188
+ ├── State_Model_Template.md # Step 1.5 状态机建模模板
189
+ ├── MVVM开发文档/ # 鸿蒙 MVVM 参考(V1 状态管理)
190
+ ├── MVVM开发文档V2/ # 鸿蒙 MVVM 参考(V2 状态管理 + 范式选择说明)
180
191
  ├── android-to-harmonyOS-ui-layout-mapping-reference.md
181
192
  ├── android-to-harmonyOS-ui-atomic-component-mapping-reference.md
182
193
  └── android-to-harmonyOS-ui-interaction-mapping-reference.md
@@ -189,17 +200,16 @@ Agents/hmos-ui-align/
189
200
  跳过 skill 手动跑采集:
190
201
 
191
202
  ```powershell
192
- # 安卓寻路
193
- $env:PYTHONIOENCODING="utf-8"
194
- uv run Agents/hmos-ui-align/scripts/app_feature_verify.py `
203
+ # 安卓寻路(TypeScript 版,Node ≥ 22.18/23.6 直跑,无需 uv / PYTHONIOENCODING)
204
+ node skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts `
195
205
  --device adb `
196
206
  --app "Salt Player" `
197
207
  --package "com.salt.music" `
198
208
  --prompt "进入首页-点击AI智能填报-点击专业筛选按钮" `
199
209
  --max-steps 15
200
210
 
201
- # 安卓采集
202
- uv run Agents/hmos-ui-align/scripts/page_capture.py --device adb -o ./tmp/android_page_1_xxx
211
+ # 安卓采集(TypeScript 版,Node ≥ 22.18/23.6 直跑,无需 uv / PYTHONIOENCODING)
212
+ node skills/hmos-incremental-ui-align/scripts/page_capture.ts --device adb -o ./tmp/android_page_1_xxx
203
213
 
204
214
  # 鸿蒙同理,把 --device adb 换成 --device hdc
205
215
  ```
@@ -210,7 +220,7 @@ uv run Agents/hmos-ui-align/scripts/page_capture.py --device adb -o ./tmp/androi
210
220
 
211
221
  ## 常见问题
212
222
 
213
- **Q: phone-agent 寻路失败怎么办?**
223
+ **Q: 寻路失败怎么办?**
214
224
  A: skill 默认重试两次。流水线的内部规则:①先看页面是否存在;②路径错了就 force-stop 重试;③路径对但工具报错就让 agent 自己看截图判断是否到了。超过两次仍失败才会跳过该页。
215
225
 
216
226
  **Q: 鸿蒙端页面根本不存在,能新建吗?**
@@ -225,10 +235,17 @@ A: 不会。Step 4 只跑编译验证(如果 `hmos-fix-build-errors` skill 可
225
235
  **Q: 能不能只做差异分析、不改码?**
226
236
  A: 目前流水线是端到端的。如果只想要分析产物,跑完 Step 2 后手动中断即可,所有 `UI_Analysis.md` 和 `UI_comparison.md` 都会落盘在 `{capture_output_dir}/task_{timestamp}/` 下。
227
237
 
238
+ **Q: 动画、Toast 这类瞬态效果能对齐吗?**
239
+ A: 能。Step 1.4 会扫描安卓源码里的动画/Toast/语音传感器 API,产出 `dynamic_ui_inventory.md`;Step 2.3 会生成对应的「Dynamic / Transient UI Comparison」diff 表;Step 3 逐条修复时会写入真实的 ArkUI `animateTo()` / `promptAction.showToast()` 等实现。
240
+
241
+ **Q: 像"按住说话"这种有多个状态的组件怎么对齐?**
242
+ A: Step 1.5 会先建 `state_model.md`(状态枚举 + 转移条件 + 每状态属性,均需溯源到源码行号),再用 `page_capture_burst.ts` 连续采帧抓每个状态的代表帧。单击、松开长按等手势可自动触发;长按保持/拖拽/语音等手势需要人工在设备上操作,skill 会打印操作说明等你确认。
243
+
228
244
  ---
229
245
 
230
246
  ## 已知限制
231
247
 
232
248
  - 只对齐 UI,不对齐功能/数据流
233
- - phone-agent 寻路依赖 GLM 模型对页面文本的识别,小字体或非标准控件可能识别不准
234
- - 双端设备的分辨率/密度差异会影响像素到 vp 的换算,流水线已显式带上 density,但同一个 Figma 规格下仍可能出现 ±1vp 偏差
249
+ - 寻路依赖多模态模型对页面文本的识别,小字体或非标准控件可能识别不准
250
+ - 双端设备的分辨率/密度差异会影响像素到 vp 的换算,流水线已从各自 `meta.json` 读取真实 `density_factor`,但同一个 Figma 规格下仍可能出现 ±1vp 偏差
251
+ - 需要长按保持、拖拽、语音、传感器等物理输入触发的状态,无法全自动采集,需要用户配合手动操作
@@ -13,9 +13,15 @@ You are writing ArkTS codes.
13
13
  - you can not start Step 2 until Step 1 is completely finished
14
14
  - Do not proceed to Step 3 until every page pair has its `UI_comparison.md` written in Step 2
15
15
  - Step 2 MUST be executed by the main agent sequentially (not delegated to background agents). Each sub-step (2.1 → 2.2 → 2.3) must complete and be verified before the next begins.
16
- - If mock data is required, write them in `{harmony_project_dir}/entry/src/main/ets/model/` according to the hmos MVVM mode.
16
+ - If mock data is required, write them in `{harmony_project_dir}/entry/src/main/ets/model/` according to the hmos MVVM mode (V1 or V2, per the paradigm detected in Step 3.1).
17
17
  - Do not make any other changes unrelated to the user's requirements.
18
18
 
19
+ **Skill scripts** (TypeScript, run directly with `node` — Node ≥ 22.18/23.6, no build step, no third-party deps; all paths relative to this skill's root):
20
+ - `navigation_tool` = `./scripts/app_feature_verify.ts`
21
+ - `capture_tool` = `./scripts/page_capture.ts`
22
+ - `burst_capture_tool` = `./scripts/page_capture_burst.ts` — continuous view-tree+screenshot capture at ~1s intervals, for multi-state components (Step 1.5)
23
+ - `checklist_tool` = `./scripts/extract_checklist.ts` — deterministically extracts all diffs from `UI_comparison.md` files into `fix_checklist.md` (used in Step 3)
24
+
19
25
  ## Step 0: Resolve Inputs
20
26
 
21
27
  This skill takes three path inputs from the invocation and resolves its other settings along the standard chain — **OS environment variable → `~/.hometrans/config.json` → ask the user** (see Step 0.0).
@@ -40,15 +46,15 @@ Resolve each value along the standard chain — **OS environment variable first,
40
46
  | `OHOS_SDK_PATH` | `env.OHOS_SDK_PATH` | HarmonyOS SDK ETS API reference (Step 3) | path exists on disk |
41
47
  | `HMS_SDK_PATH` | `env.HMS_SDK_PATH` | HMS SDK ETS API reference (Step 3) | path exists on disk |
42
48
 
43
- The model config is resolved automatically by `scripts/app_feature_verify.py` (env → config.json), so you don't read it by hand — just confirm `HOMETRANS_MODEL_API_KEY` or `autotest.unified_model.api_key` is set. For `OHOS_SDK_PATH` / `HMS_SDK_PATH`, if both the env var and `~/.hometrans/config.json` are empty but `DEVECO_SDK_HOME` is set (env or `env.DEVECO_SDK_HOME` in config.json), derive them as `<DEVECO_SDK_HOME>/default/openharmony/ets` and `<DEVECO_SDK_HOME>/default/hms/ets`.
49
+ The model config is resolved automatically by `scripts/app_feature_verify.ts` (env → config.json), so you don't read it by hand — just confirm `HOMETRANS_MODEL_API_KEY` or `autotest.unified_model.api_key` is set. For `OHOS_SDK_PATH` / `HMS_SDK_PATH`, if both the env var and `~/.hometrans/config.json` are empty but `DEVECO_SDK_HOME` is set (env or `env.DEVECO_SDK_HOME` in config.json), derive them as `<DEVECO_SDK_HOME>/default/openharmony/ets` and `<DEVECO_SDK_HOME>/default/hms/ets`.
44
50
 
45
51
  For each value that is still missing/empty (or a path that does not exist) after both the env var and `~/.hometrans/config.json`, **stop and ask the user to provide a value**, then use what they give for this run. Suggest running `ht init` to persist them as machine environment variables for next time.
46
52
 
47
53
  ### Step 0.1: Auto-derive App Names & Package Names
48
54
 
49
- `android.app_name` / `android.package` / `harmony.app_name` / `harmony.package` are required for navigation (passed to `scripts/app_feature_verify.py` as `--app` / `--package`). They are not provided as inputs — resolve them from the project dirs (`android_project_dir` / `harmony_project_dir`) as follows.
55
+ `android.app_name` / `android.package` / `harmony.app_name` / `harmony.package` are required for navigation (passed to `scripts/app_feature_verify.ts` as `--app` / `--package`). They are not provided as inputs — resolve them from the project dirs (`android_project_dir` / `harmony_project_dir`) as follows.
50
56
 
51
- **`app_name` matters because it is the launcher label phone-agent taps to open the app** — when the resolved label is a localized resource and a Chinese (`zh`) variant exists, prefer the Chinese value (devices are typically zh-CN).
57
+ **`app_name` matters because it is the launcher label the navigator taps to open the app** — when the resolved label is a localized resource and a Chinese (`zh`) variant exists, prefer the Chinese value (devices are typically zh-CN).
52
58
 
53
59
  #### Android (from `android_project_dir`)
54
60
  1. **`android.package`** — locate the application module (the module whose Gradle file applies `com.android.application`, usually `app/`):
@@ -68,7 +74,7 @@ After resolving all four, briefly echo them to the user (e.g. `android.app_name=
68
74
 
69
75
  ## Step 1: Capture All Related Pages on Android & HarmonyOS Devices
70
76
 
71
- Read `scripts/navigation-capure.md` to learn the usage of `scripts/app_feature_verify.py` (navigation) and `scripts/page_capture.py` (capture).
77
+ Read `scripts/navigation-capure.md` to learn the usage of `scripts/app_feature_verify.ts` (navigation) and `scripts/page_capture.ts` (capture).
72
78
 
73
79
  ### Step 1.1: Parse User Request and Build Capture Plan
74
80
  Analyze the user's description and build a list of **base pages** to capture.
@@ -79,12 +85,20 @@ For each base page, define:
79
85
  - `page_name`: short identifier (e.g., `enterprise_detail`)
80
86
  - `android_nav_path` / `hmos_nav_path`: the navigation prompt for each device
81
87
 
82
- Create the timestamped output directory and per-page sub-directories following the pattern in `scripts/navigation-capure.md`.
88
+ Create the timestamped output directory and per-page sub-directories following the pattern in `scripts/navigation-capure.md`:
89
+
90
+ ```
91
+ task_dir = capture_output_dir / "task_{timestamp}"
92
+ android_capture_dir = task_dir / "android_page_{i}_{name}"
93
+ hmos_capture_dir = task_dir / "hmos_page_{i}_{name}"
94
+ ```
95
+
96
+ `{task_dir}` is referenced throughout Step 1.4, Step 1.5, Step 2 and Step 3 — it always means this directory, resolved once here. A paired hmos/android page pair shares the same `{i}`.
83
97
 
84
98
  ### Step 1.2: Capture Base Pages
85
99
  For each base page in the plan, on **both** Android and HarmonyOS devices:
86
- 1. Use `scripts/app_feature_verify.py` to navigate to the page.
87
- 2. On success, use `scripts/page_capture.py` to capture the view tree and screenshot.
100
+ 1. Use `scripts/app_feature_verify.ts` to navigate to the page.
101
+ 2. On success, use `scripts/page_capture.ts` to capture the view tree and screenshot.
88
102
  3. For HarmonyOS pages that don't exist yet, navigation will fail — leave the directory empty (expected).
89
103
 
90
104
  ### Step 1.3: Discover and Capture Interactive States
@@ -96,12 +110,112 @@ After capturing each base page, scan its view tree for **interactive elements th
96
110
 
97
111
  **For each interactive element found:**
98
112
  1. Create a separate capture directory: `{platform}_page_{i}_{base_name}_{state_type}_{state_name}` (e.g., `android_page_1_detail_tab_city`, `android_page_1_detail_popup_filter_identity`).
99
- 2. Navigate to the base page (reuse the same nav path), then append the click action to trigger the state change. Capture with `scripts/page_capture.py`.
113
+ 2. Navigate to the base page (reuse the same nav path), then append the click action to trigger the state change. Capture with `scripts/page_capture.ts`.
100
114
  3. Repeat for **both** Android and HarmonyOS devices.
101
115
  4. Each captured state is treated as a separate page pair in Step 2 and Step 3.
102
116
 
103
117
  **Skip condition**: Only skip this step for a specific page if the user explicitly says to ignore interactive states (e.g., "只对齐主页面,不管弹窗和tab").
104
118
 
119
+ ### Step 1.4: Source Code Scan for Dynamic / Transient / Non-Touch UI
120
+
121
+ Static screenshots and view trees cannot capture animations, transient UI (Toast, Snackbar), or UI triggered by voice/sensors. This step extracts those effects from source code.
122
+
123
+ **Scan scope**: Only scan source files related to the pages captured in Step 1.2/1.3 (use Activity/Fragment names from navigation to locate relevant files).
124
+
125
+ **Search patterns** (in `android_project_dir`):
126
+
127
+ | Category | Grep patterns |
128
+ |----------|--------------|
129
+ | Animation | `ObjectAnimator`, `ValueAnimator`, `AnimatorSet`, `@anim/`, `animateLayoutChanges`, `MotionLayout`, `Transition`, `LottieAnimationView`, `setAnimation` |
130
+ | Transient UI | `Toast.makeText`, `Snackbar.make`, `PopupWindow`, `ToolTip`, `postDelayed.*GONE\|VISIBLE`, `CountDownTimer` |
131
+ | Voice/Sensor | `SpeechRecognizer`, `VoiceInteractionService`, `SensorManager`, `MediaRecorder` |
132
+ | External event UI | `BroadcastReceiver`+UI updates, `onMessageReceived` (FCM/JPush) |
133
+
134
+ **Output**: Write `{task_dir}/dynamic_ui_inventory.md` with this format:
135
+ ```markdown
136
+ # Dynamic UI Inventory
137
+ | Type | Trigger | Source File:Line | Target UI Component | Effect Description | Duration/Timing |
138
+ |------|---------|-----------------|--------------------|--------------------|-----------------|
139
+ | animation | page enter | LoginActivity.kt:45 | logo_image | scale 0→1 + fade in | 400ms, overshoot |
140
+ | Toast | login success | LoginActivity.kt:112 | — | "登录成功" | 2000ms auto-dismiss |
141
+ | voice input | mic button click | SearchActivity.kt:78 | voice_wave_view | shows waveform animation | until recognition ends |
142
+ ```
143
+
144
+ **Skip condition**: If grep finds zero matches across all patterns for a page's related source files, note "No dynamic UI found" for that page and proceed.
145
+
146
+ ### Step 1.5: Stateful Component Analysis (Multi-State UI)
147
+
148
+ This step identifies components with multiple distinct UI states driven by user interaction (e.g., voice input: idle → recording → cancelling → recognized) and builds a state transition model from source code.
149
+
150
+ #### Step 1.5.1: Identify Multi-State Components
151
+
152
+ **Trigger conditions** (any one):
153
+ - User description explicitly mentions state changes ("语音输入各状态", "按住说话的录音和取消", "各个弹窗状态")
154
+ - Step 1.4 source scan discovers ≥3 distinct UI state values in the same component
155
+
156
+ **Grep patterns (Android)**:
157
+ - `enum.*State` / `sealed class.*State` / `companion object.*STATE`
158
+ - `when.*state` / `switch.*state` / `if.*state ==`
159
+ - `setVisibility.*GONE|VISIBLE` (multiple occurrences in same method)
160
+ - `LiveData<.*State>` / `MutableStateFlow<.*State>`
161
+
162
+ **Grep patterns (HarmonyOS)**:
163
+ - `@State.*state` / `enum.*State`
164
+ - `if.*this.state` / `switch.*this.state`
165
+ - `.visibility(this.state ===`
166
+ - `@Watch` decorators on state variables
167
+
168
+ **Output**: List of multi-state components to analyze.
169
+
170
+ #### Step 1.5.2: Build State Transition Model
171
+
172
+ For each identified multi-state component, read the relevant source code and produce a state model following the template in `references/State_Model_Template.md`.
173
+
174
+ The model MUST include:
175
+ 1. **State enumeration** — all possible states with UI descriptions
176
+ 2. **Transitions** — from/to/trigger/gesture type/threshold/duration, each with source file:line
177
+ 3. **Per-state UI properties** — visibility, background, text, color, border, animation, all traced to source
178
+ 4. **Animations between states** — property/from/to/duration/easing
179
+
180
+ **Key constraint**: Every UI property and transition condition MUST reference a source code location. No estimation from screenshots.
181
+
182
+ **Output**: Write `{task_dir}/state_model.md`
183
+
184
+ #### Step 1.5.3: Capture State Snapshots
185
+
186
+ **For auto-capturable states** (single tap, simple long-press then release):
187
+ 1. Navigate to the component's page
188
+ 2. Start `scripts/page_capture_burst.ts` (see `scripts/navigation-capure.md` for burst workflow)
189
+ 3. Trigger the state via `scripts/app_feature_verify.ts`
190
+ 4. Select representative frames from burst output
191
+
192
+ **For non-auto-capturable states** (long-press hold, drag, pan, sensor, voice):
193
+ Generate manual capture instructions and present them to the user. Wait for user confirmation before proceeding.
194
+
195
+ **Auto-capture feasibility rules**:
196
+ | Gesture | Auto? | Reason |
197
+ |---------|-------|--------|
198
+ | Single tap | Yes | phone-agent supports directly |
199
+ | Long-press then release | Yes | decompose to press → wait → release |
200
+ | Long-press and hold | **No** | must maintain pressure during burst |
201
+ | Drag/Pan with threshold | **No** | requires precise coordinates + simultaneous capture |
202
+ | Sensor/Voice input | **No** | requires physical input |
203
+
204
+ #### Step 1.5.4: Expand States into Virtual Page Pairs
205
+
206
+ Each captured state becomes a standalone page pair for Step 2:
207
+ ```
208
+ {platform}_page_{i}_{base_name}_state_{state_id}_{state_name}/
209
+ screenshot_001.png (representative frame from burst or manual capture)
210
+ view_001.xml
211
+ state_context.md (state's entry from state_model.md)
212
+ ```
213
+
214
+ These virtual page pairs follow the same naming convention and enter Step 2 identically to base pages.
215
+
216
+ #### Step 1.5.5: Skip Condition
217
+ If no multi-state components are identified (neither from user description nor from Step 1.4 grep results), skip Step 1.5 entirely and proceed to Navigation Rules → Step 2.
218
+
105
219
  ### Navigation Rules (apply to all capture operations in Step 1)
106
220
 
107
221
  **Click path extraction**: do not replace or translate key operations of hdc/adb (such as drag, swipe).
@@ -122,34 +236,41 @@ Firstly, make sure whether the page exists, then:
122
236
  **Dimension rule (applies to Step 2.1, 2.2, and 2.3)**:
123
237
  All size/position values must include:
124
238
  - raw px value (from view tree bounds)
125
- - device density (e.g. 3x)
126
- - converted dp/vp value (px ÷ density)
127
- Format: "126px (3x → 42vp)". Never write bare px or vp without the other.
239
+ - device density (read from the page's `meta.json` → `density_factor`; e.g. 3.0)
240
+ - converted dp/vp value (px ÷ density_factor)
241
+ Format: "126px (3.0x → 42vp)". Never write bare px or vp without the other.
242
+ **Density source**: `scripts/page_capture.ts` records the real device density into each capture directory's `meta.json` (`dpi` and `density_factor`). Read `density_factor` from there per page — do NOT assume 3x. Android and HarmonyOS captures may have different densities, so convert each side using its own `meta.json`. If a page's `meta.json` is missing `density_factor`, fall back to 3.0 and note the assumption.
128
243
  **MANDATORY OUTPUT**: Write the result to `android_page_{i}_{name}/UI_Analysis.md`,写完后确认文件已创建。
129
244
  **This step is NEVER skippable** — even if the HarmonyOS counterpart is empty, the Android analysis must still be written.
130
245
 
131
246
  For each page <`android_page_{i}_{name}`,`hmos_page_{i}_{name}`> collected in {Step 1}, write UI Analysis using the Analysis Template in `references/UI_Analysis_Template.md`:
132
247
  ### Step 2.1 UI Analysis of `android_page_{i}_{name}`
133
248
  Read `android_page_{i}_{name}` 目录下的 screenshot(_n) 和 view tree(_n) 信息,以 table 形式列举出该页面所有组件,每个组件包含位置、颜色、icon、大小、形状、文字内容、alignment(居中、靠左、靠右等)等一切视觉要素。
249
+ Additionally, check `{task_dir}/dynamic_ui_inventory.md` for any dynamic/transient effects related to this page and include them in the analysis under a "Dynamic / Transient UI Effects" section (see template).
134
250
  **MANDATORY OUTPUT**: following the template `references/UI_Analysis_Template.md` to write the result to `android_page_{i}_{name}/UI_Analysis.md`,写完后确认文件已创建。
135
251
 
136
252
  ### Step 2.2 UI Analysis of `hmos_page_{i}_{name}`
137
253
  if `hmos_page_{i}_{name}` has screenshots and view trees:
138
254
  Read `hmos_page_{i}_{name}` 目录下的 screenshot 和 view tree 信息,以 table 形式列举出该页面所有组件,每个组件包含位置、颜色、icon、大小、形状、文字内容、alignment(居中、靠左、靠右等)等一切视觉要素。
255
+ Additionally, analyze the HarmonyOS source code for any dynamic/transient effects (e.g., `animateTo()`, `promptAction.showToast()`, `.transition()`) and include them in the "Dynamic / Transient UI Effects" section.
139
256
  **MANDATORY OUTPUT**: following the template `references/UI_Analysis_Template.md` to Write the result to `hmos_page_{i}_{name}/UI_Analysis.md`,写完后确认文件已创建。
140
257
  if `hmos_page_{i}_{name}` is empty (no screenshots/view trees captured):
141
- Read the HarmonyOS source code at `harmony_project_dir` to find the corresponding page implementation. Analyze the source code to extract all UI components, their properties, layout structure, colors, dimensions, and text content. Create a comprehensive component table from the code analysis.
258
+ Read the HarmonyOS source code at `harmony_project_dir` to find the corresponding page implementation. Analyze the source code to extract all UI components, their properties, layout structure, colors, dimensions, and text content. Also extract any dynamic/transient effects from the code. Create a comprehensive component table from the code analysis.
142
259
  **MANDATORY OUTPUT**: following the template `references/UI_Analysis_Template.md` to Write the result to `hmos_page_{i}_{name}/UI_Analysis_from_code.md`,写完后确认文件已创建。
143
260
  **DO NOT** write a placeholder like "page not captured" — you must actually read the source code and produce a real analysis.
144
261
  ### Step 2.3 Make UI Diff Analysis and Write the Comparison Table
145
262
  **Input requirement**: You MUST Read the already-written `android_page_{i}_{name}/UI_Analysis.md` and `hmos_page_{i}_{name}/UI_Analysis.md` (or `UI_Analysis_from_code.md`) files using the Read tool before writing the comparison. Do NOT generate the comparison from raw view trees, screenshots, or source code directly — the comparison must be derived from the two Analysis documents.
146
263
 
264
+ Read `diff_analysis.md` for the detailed comparison procedure (how to merge `view_scroll_n` captures, which structural and visual dimensions to cover, and how to stay robust to cross-device differences in spacing and screenshot colour).
265
+
147
266
  Using `android_page_{i}_{name}/UI_Analysis.md` as the ground truth, compare the detailed differences of each component between `android_page_{i}_{name}/UI_Analysis.md` and `hmos_page_{i}_{name}/UI_Analysis.md` (or `hmos_page_{i}_{name}/UI_Analysis_from_code.md` if hmos page was empty), and list them in a table like `references/Comparison_Template.md`
148
267
 
149
268
  **Quality requirement for UI_comparison.md**:
150
269
  - The file MUST contain a markdown table with `|` delimiters listing every component
151
270
  - If HarmonyOS page is missing entirely, each diff column must state the Android target value as the implementation spec, not just "缺失". Format: "HarmonyOS: 缺失 → 目标: {Android的具体值}". Example: Alignment Diff = "HarmonyOS: 缺失 → 目标: 左对齐". Example: Text Color Diff = "HarmonyOS: 缺失 → 目标: #333333". A column that only says "缺失" without a target value is INVALID.
152
271
  - A comparison that only says "page not captured" or "needs implementation" without a component-level table is INVALID
272
+ - **Dynamic UI Diff**: After the static component table, include a separate "Dynamic / Transient UI Comparison" table comparing animation parameters (duration, easing, properties), transient UI (Toast text, duration, trigger condition), and non-touch input support (voice, sensor). Format same as static diff: "HarmonyOS: {current} → 目标: {Android value}".
273
+ - **State Machine Diff** (for Step 1.5 components only): After the Dynamic UI table, include a "State Machine Comparison" section following `references/Comparison_Template.md`. This must cover: state count diff, per-transition trigger/threshold diff, and per-state visual property diff. Each diff must reference the source line from `state_model.md`.
153
274
 
154
275
  **MANDATORY OUTPUT**: Write the comparison table into `hmos_page_{i}_{name}/UI_comparison.md`
155
276
 
@@ -165,23 +286,50 @@ MUST verify:
165
286
  **CHECKPOINT — before proceeding, you MUST**:
166
287
  1. For every page pair, use the Read tool to open `hmos_page_{i}_{name}/UI_comparison.md` and confirm it exists and contains a markdown diff table (has `|` delimiters with component rows).
167
288
  2. If any `UI_comparison.md` is missing or contains only a status note without a component table, go back to Step 2 and complete it. For pages where HarmonyOS was not captured, read the source code to generate `UI_Analysis_from_code.md` first, then regenerate the comparison with a proper component-level diff table.
168
- 3. Extract EVERY diff items from ALL comparison tables and write them into `{task_dir}/fix_checklist.md` in this format:
289
+ 3. Generate `{task_dir}/fix_checklist.md` **deterministically** by running the extraction script — do NOT hand-enumerate diffs from the comparison tables (manual enumeration is the main cause of missed items):
290
+ ```bash
291
+ node ./scripts/extract_checklist.ts --task-dir "{task_dir}"
292
+ ```
293
+ The script parses ALL five table types in every `UI_comparison.md` (main static component table, Dynamic / Transient UI, State Machine, Per-Transition, Per-State Visual), skips rows whose Diff cell is empty / "一致" / "-", splits a row carrying multiple diffs (separated by `;`, `;`, or `<br>`) into separate items, and tags items with `[DYNAMIC]` / `[STATE]` / `[TRANSITION]` prefixes. It prints a per-page reconciliation table (`diff_rows` vs `items`).
294
+
295
+ 4. **Reconciliation gate** — read the script's stdout report and the generated `fix_checklist.md`:
296
+ - For every page, confirm `items >= diff_rows`. Any row flagged `<-- CHECK` means a diff row produced no item → open that `UI_comparison.md` and find why (malformed Diff cell, missing Diff column). Fix the comparison file and re-run the script.
297
+ - If the report shows `total diff rows: 0` or a page shows `tables=0` (only a status note, no real table), that page's Step 2 is incomplete → go back to Step 2, generate `UI_Analysis_from_code.md` from HarmonyOS source if the page was not captured, regenerate the comparison with a real component-level diff table, then re-run the script.
298
+ - Only after the script output covers every page with no `<-- CHECK` flags is the checklist trustworthy.
299
+
300
+ 5. **Review pass (human-readable refinement)** — the script output is a faithful but raw draft. Edit `fix_checklist.md` to: merge exact duplicates, make terse cells read as actionable instructions, and keep the auto-generated `<!-- source: ... -->` comment line under each page heading (it records the provenance and row/item counts for the final review in Step 3.4). Do NOT delete any item during this pass — only merge true duplicates.
301
+
302
+ This checklist is your single source of truth for what needs to be fixed. The format is:
169
303
  ```
170
304
  # Fix Checklist
171
- ## Page 1: {name}
172
- - [ ] {diff description 1}
173
- - [ ] {diff description 2}
174
- - [ ] {diff description 3}
175
- ## Page 2: {name}
305
+ ## hmos_page_{i}_{name}
306
+ <!-- source: ... | tables=N | diff_rows=N | items=N -->
176
307
  - [ ] {diff description 1}
308
+ - [ ] [DYNAMIC] {effect}: {diff}
309
+ - [ ] [STATE] {state}: {diff}
177
310
  ...
178
311
  ```
179
- This checklist is your single source of truth for what needs to be fixed.
312
+
313
+ For **multi-state components** (from Step 1.5), use tagged prefixes in the checklist:
314
+ ```
315
+ ## Component: {name} (Stateful)
316
+ - [ ] [STATE] 实现 {state_name} 状态 ({state_id}): {UI description}
317
+ - [ ] [TRANSITION] {from}→{to}: {gesture type} {threshold/condition}
318
+ - [ ] [ANIMATION] {state}: {animation description with params}
319
+ ```
180
320
 
181
321
  ### Step 3.1: Analyze Project Architecture and load knowledge (Main Agent)
182
322
  1. understand the existing HarmonyOS project's architecture, analyze existing patterns and identify {reusable components}.
183
- 2. read `./references/MVVM开发文档/MVVM模式V1.md` to understand the MVVM mode
184
- **Note**: If mock data is required, add them in **Model Layer** according to the MVVM mode.
323
+ 2. **Detect the project's state-management paradigm (V1 vs V2)** before loading MVVM docs — decide once at project level and keep it for the whole task:
324
+ - Scan existing `.ets` under `{harmony_project_dir}/entry/src/main/ets/` for decorators:
325
+ - `@Component` + `@State`/`@Prop`/`@Link`/`@Provide`/`@Consume`/`@Observed`/`@ObjectLink`/`@Watch` → **V1**
326
+ - `@ComponentV2` + `@Local`/`@Param`/`@Once`/`@Event`/`@ObservedV2`/`@Trace`/`@Monitor`/`@Provider`/`@Consumer` → **V2**
327
+ - Empty project / 0→1 fresh conversion / no state decorators → **default V2**; only-V1 → V1; only-V2 → V2; both → follow the majority and match the target page's existing directory, note it in the report.
328
+ - Do NOT mix V1 and V2 decorators in the same project/component. Detection rule detailed in `./references/MVVM开发文档V2/_范式选择说明.md`.
329
+ 3. Load the matching MVVM docs:
330
+ - **V1** → read `./references/MVVM开发文档/MVVM模式V1.md` (and other V1 decorator docs in that dir as needed)
331
+ - **V2** → read `./references/MVVM开发文档V2/MVVM模式(V2).md` (and other V2 decorator docs in that dir as needed)
332
+ **Note**: If mock data is required, add them in **Model Layer** according to the detected MVVM paradigm.
185
333
 
186
334
  ### Step 3.2: Learn typical transformation rules
187
335
  read `page_align.md` to learn typical transformation rules
@@ -193,6 +341,12 @@ This checklist is your single source of truth for what needs to be fixed.
193
341
 
194
342
  **Value tracing rule**: Before fixing any dimension/size/icon-size/alignment diff, you MUST trace the target value back to Android source code (layout XML `layout_width`/`layout_height`/`padding`/`src`, drawable intrinsic size, or style definition). Write the source reference (file:line or resource name) next to the checklist item. Estimating from screenshots or "looks about right" is NOT acceptable — if the Android source cannot be located, flag the item and ask the user.
195
343
  **Alignment rule**: When implementing a new component or fixing an existing one, explicitly set alignment/justification for EVERY text and container element. Copy the alignment value directly from the Android UI_Analysis.md (e.g., "左对齐" → `.textAlign(TextAlign.Start)` + `.width('100%')`). Never rely on default alignment — always set it explicitly.
344
+ **Stateful component rule** (for [STATE]/[TRANSITION]/[ANIMATION] items):
345
+ - State enumerations must map 1:1 with Android states (same count, same semantics)
346
+ - Transition conditions (gesture type, threshold in vp, delay in ms) must be traced to Android source — copy values exactly
347
+ - Animation parameters (duration, easing, property, from/to values) must match Android precisely — refer to `state_model.md` for source references
348
+ - Implement state changes with conditional rendering or `.visibility()` per the MVVM pattern, holding the state in **the decorator of the paradigm detected in Step 3.1** — `@Local` in a `@ComponentV2` (V2), `@State` in a `@Component` (V1). Never mix the two in one component
349
+ - For gesture-triggered transitions, use ArkUI gesture APIs: `LongPressGesture`, `PanGesture`, `TapGesture` per `references/android-to-harmonyOS-ui-interaction-mapping-reference.md`
196
350
  **After fixing each diff, update `fix_checklist.md`**: change `- [ ]` to `- [x]` for the completed item.
197
351
  **CRITICAL RULE**:
198
352
  - Do not skip any diff item in `fix_checklist.md`, regardless of the priority.
@@ -204,6 +358,8 @@ Read `fix_checklist.md` and verify every item is marked `[x]`. If any items rema
204
358
  2. For each, explain why it was not fixed (blocked by missing API, requires backend, etc.) or fix it now
205
359
  3. Items that genuinely cannot be fixed should be marked with `- [~]` and a reason
206
360
 
361
+ **Coverage re-check**: For each page, the `<!-- source: ... | items=N -->` comment records how many items the script extracted. Confirm the number of `- [x]`/`- [~]` lines under each page heading still matches that `items=N` count — if fewer, items were silently dropped during the review pass; recover them from the page's `UI_comparison.md`.
362
+
207
363
  ## Step 4 validate and build (Main Agent)
208
364
  if available, use `hmos-fix-build-errors` skill to verify the project is compilable, do not deploy.
209
365
 
@@ -216,4 +372,4 @@ if available, use `hmos-fix-build-errors` skill to verify the project is compila
216
372
  - Handle responsive layouts: prefer percentage widths and `Flex` over fixed dimensions where appropriate.
217
373
  - Maintain accessibility: convert `content-desc` to `.accessibilityText()`, convert meaningful `text` to proper labels.
218
374
  - Group related UI into `@Component` sub-components when the hierarchy is deep (> 5 nesting levels).
219
- - **鸿蒙 API 可参考 `OHOS_SDK_PATH` / `HMS_SDK_PATH`(HarmonyOS SDK 的 ETS 目录,取自 OS 环境变量),鸿蒙MVVM开发模式可参考`./references/MVVM开发文档/`**
375
+ - **鸿蒙 API 可参考 `OHOS_SDK_PATH` / `HMS_SDK_PATH`(HarmonyOS SDK 的 ETS 目录,取自 OS 环境变量);鸿蒙 MVVM 开发模式:V1 参考 `./references/MVVM开发文档/`,V2 参考 `./references/MVVM开发文档V2/`(按 Step 3.1 探测到的工程范式二选一,详见 `./references/MVVM开发文档V2/_范式选择说明.md`)**