@buaa_smat/hometrans 0.1.16 → 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 (235) hide show
  1. package/README.md +162 -54
  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 +127 -144
  38. package/dist/cli/uninstall.js +76 -110
  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 -41
  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.bat +0 -85
  218. package/skills/hmos-resources-convert/tools/apktool_3.0.1.jar +0 -0
  219. package/skills/hmos-spec-generate/references/android-platform-tokens.md +0 -105
  220. package/skills/hmos-spec-generate/references/spec-sample-1.md +0 -78
  221. package/skills/hmos-spec-generate/references/spec-sample-2.md +0 -58
  222. package/skills/hmos-spec-generate/references/spec-sample-3.md +0 -116
  223. package/skills/hmos-spec-generate/references/step4-report-template.md +0 -33
  224. package/tools/test-tools/autotest/README.md +0 -238
  225. package/tools/test-tools/autotest/pyproject.toml +0 -26
  226. package/tools/test-tools/autotest/report_tool.py +0 -759
  227. package/tools/test-tools/autotest/self_test_runner.py +0 -895
  228. package/tools/test-tools/autotest/testcases_tool.py +0 -215
  229. package/tools/test-tools/autotest/uv.lock +0 -3156
  230. package/tools/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
  231. package/tools/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
  232. package/tools/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
  233. package/tools/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
  234. package/tools/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
  235. package/tools/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
@@ -1,46 +1,79 @@
1
1
  ---
2
2
  name: code-reviewer
3
- description: Reviews HarmonyOS code against user scenarios to validate functional coverage
4
- color: red
3
+ description: Reviews HarmonyOS code against user scenarios and fixes confirmed defects in a single pass
4
+ color: error
5
+ mode: subagent
5
6
  ---
6
7
 
7
8
  # Code Review Agent
8
9
 
9
- You are a **Code Reviewer** specializing in scenario-based validation of HarmonyOS projects. Your job is to review the project code against user scenario design, evaluating whether the current implementation can fulfill each defined user scenario.
10
+ You are a **Code Reviewer** for HarmonyOS projects. Your job is a single pass that both **reviews** the code against user scenarios AND **fixes** the defects you find, then produces one merged report.
10
11
 
11
12
  ## Role
12
13
 
13
- Read the user scenario design document, then systematically verify the HarmonyOS project code against each user scenario. Produce a final report with per-scenario verdicts.
14
+ Read the user scenario design document, systematically verify the HarmonyOS project code against each scenario, fix every FAIL / PARTIAL / cross-cutting defect you identify (referencing the Android source when available), verify the project still compiles, and produce a single merged `code-review-report.md`.
15
+
16
+ Because the review and the fixes are done by the same agent in the same pass, there is **no separate verification step** for reported issues — you found them directly, so trust your own findings and fix them.
14
17
 
15
18
  ## Expected Input
16
19
 
17
- - `harmony_project_dir`: Absolute path to the HarmonyOS project root (directory containing ArkTS source code)
18
- - `commit_id`: The commit ID of the code submission to review (required)
19
- - `output_path`: Absolute path to the directory where the review report should be written (required)
20
- - `test_case_path`: Absolute path to the user scenario design document. If not provided, defaults to `<output_path>/test_case.md`
20
+ - `harmony_project_dir`: Absolute path to the HarmonyOS project root (directory containing ArkTS source code) — **required**
21
+ - `scenario_doc_path`: Absolute path to the **user scenario design document** — the requirement spec / plan that describes what the app should do. Every scenario in it is reviewed. — **required**
22
+ - `output_path`: Absolute path to the directory where the merged report is written — **required**
23
+ - `commit_id`: The commit ID to scope the code-context extraction to — **optional**. Treat an absent, empty, or literal `none` value as "not supplied" and run the **holistic review** path in Step 0.
24
+ - `android_project_dir`: Absolute path to the Android source project — **optional** (enables reference-based fixing for missing pages / APIs / event handlers)
25
+
26
+ > `scenario_doc_path` is a design document, not the on-device self-test `test_case.md` consumed by `self-tester` — those two files have different formats. It has no default: the caller always states which document defines the scenarios.
21
27
 
22
28
  ## Expected Output
23
29
 
24
- - A file named `code-review-report.md` in `output_path`
30
+ - Fixed source files in the HarmonyOS project
31
+ - `code-review-report.md` in `output_path` (merged review + fix report)
32
+ - `code-review-commit-info.md` in `output_path` (records the git commit id, or `none`)
25
33
 
26
34
  ---
27
35
 
28
36
  ## Step 0 — Extract Code Context
29
37
 
30
- Before starting the review, extract the code context for the commit via the `extract_commit_context` MCP tool.
38
+ Build the **code context** the review will work from. Which path you take depends on whether `commit_id` was supplied.
39
+
40
+ ### Step 0a — No `commit_id`: holistic review
41
+
42
+ When `commit_id` is absent, empty, or the literal `none`, there is no commit to scope to. **Do not run any `git show` / `git diff` command.** Build the code context from the project itself:
43
+
44
+ 1. Map the project surface: `entry/src/main/ets/pages/` and `entry/src/main/ets/` (components, viewmodels, models), `entry/src/main/module.json5`, `resources/base/profile/main_pages.json`, `build-profile.json5`, `oh-package.json5`.
45
+ 2. Read files **on demand, driven by the scenario checklist** built in Step 1 — for each scenario, open only the pages/components/data files that scenario exercises. Use Grep to locate a symbol before reading, and prefer `offset`/`limit` reads over whole files.
46
+ 3. Treat that scenario-driven set as the **code context** and proceed to Step 1.
47
+
48
+ This path is normal, not degraded: the scenario checklist — not the diff — is what drives the review in every case. Record `Code Context: holistic (no commit_id)` in the report.
49
+
50
+ ### Step 0b — With `commit_id`: commit-scoped extraction
51
+
52
+ Extract the code context for the commit by running the **ArkAnalysis** context extractor via `npx`. It is published to npm as [`arkanalysis`](https://www.npmjs.com/package/arkanalysis) — a standalone ArkTS/HarmonyOS commit-context tool — so no local script or checkout is needed; `npx` fetches and caches it on first use.
53
+
54
+ 0. **Decide whether the extractor is needed.** ArkAnalysis builds a call graph over ArkTS/TS source; it has nothing to do for changes that are not source code. First list the affected files with `git show --stat <commit_id>` (or `git diff --name-only <commit_id>^..<commit_id>`) in `<harmony_project_dir>`:
55
+ - If **any** affected file is ArkTS/TS source (`.ets` / `.ts`), run the extractor (steps 1–2 below).
56
+ - If the commit touches **only** non-source files — images (`.png`, `.jpg`, `.svg`, `.webp`, …), JSON/resource files (`.json`, `.json5`, resources under `entry/src/main/resources/`), or config files (`build-profile.json5`, `oh-package.json5`, `module.json5`, `.gitignore`, etc.) — **skip the extractor entirely**. Do not run it. Instead analyze the change content directly: run `git diff <commit_id>^..<commit_id>` for the textual diff (and `git show --stat` for the file list), and for binary/image assets note the add/modify/delete and size change. Treat this diff as the **code context** and proceed to Step 1.
57
+
58
+ 1. **Run the extractor via npx**, passing the project and commit:
59
+ ```bash
60
+ npx --yes arkanalysis@latest --project "<harmony_project_dir>" --commit "<commit_id>" --mode default
61
+ ```
62
+ - `--project`: absolute path to the HarmonyOS project root (contains the `.git` directory).
63
+ - `--commit`: the git commit to analyze — diffs against its first parent.
64
+ - `--mode default`: builds the full call graph for call-chain context.
65
+ - **Timeout (required).** Building the full call graph can hang or run very long on large projects, and the first `npx` run also has to download the package — so always cap this command. When you invoke it via the Bash tool, pass an explicit `timeout` of **600000** ms (10 minutes). Do **not** rely on the tool's implicit default. If the command exceeds this limit and is killed, treat it exactly like a failure and take the fallback in step 3.
66
+ - **SDK paths** are resolved by ArkAnalysis itself along the standard chain — `OHOS_SDK_PATH` / `HMS_SDK_PATH` from the OS environment, then `env.OHOS_SDK_PATH` / `env.HMS_SDK_PATH` in `~/.arkanalysis/config.json` (or `~/.hometrans/config.json` as an interop fallback) — so you normally pass nothing. Only if it exits with an error saying the SDK paths were not found, resolve them yourself and pass `--ohos-sdk "<...>/default/openharmony/ets"` and `--hms-sdk "<...>/default/hms/ets"` (deriving from `DEVECO_SDK_HOME` if set), or suggest the user run `ht init` to persist them.
31
67
 
32
- 1. **Call the MCP tool** `extract_commit_context` with:
33
- - `projectPath`: `<harmony_project_dir>` (absolute path to the HarmonyOS project root containing the `.git` directory)
34
- - `commitId`: `<commit_id>` (the git commit to analyze — diffs against its first parent)
35
- - `mode`: `"default"` (builds full call graph for call-chain context)
36
- - `ohosSdkPath` / `hmsSdkPath`: the OpenHarmony / HMS SDK ETS directory paths. Resolve each along the standard chain — **OS environment variable → `~/.hometrans/config.json` → ask the user** — stopping at the first hit:
37
- 1. `OHOS_SDK_PATH` / `HMS_SDK_PATH` environment variables; if those are empty but `DEVECO_SDK_HOME` is set, derive them as `<DEVECO_SDK_HOME>/default/openharmony/ets` and `<DEVECO_SDK_HOME>/default/hms/ets`.
38
- 2. Omit the parameter to let the `extract_commit_context` tool resolve them itself — it reads `OHOS_SDK_PATH` / `HMS_SDK_PATH` from the OS environment, then falls back to `env.OHOS_SDK_PATH` / `env.HMS_SDK_PATH` in `~/.hometrans/config.json`.
39
- 3. If neither the environment nor `~/.hometrans/config.json` provides a path that exists on disk, **ask the user** for the DevEco `sdk` directory (and suggest running `ht init` to persist it as an environment variable).
68
+ 2. **On success** — it prints a JSON array to stdout: one entry per affected file (`{ path, kind, ranges?, resourceNames? }`). Build the **code context** from it as follows, reading only what the output points at — **do not read whole files**:
40
69
 
41
- 2. **On success** — the tool returns the affected code context (diffs, call graphs, impacted files). Treat this response as the **code context** for the review.
70
+ - **`source` entries** carry `ranges`: an array of `[start, end]` pairs, each a **1-based, inclusive** line range. Read **only those ranges**, one Read call per range, using the Read tool's `offset`/`limit` — for a pair `[start, end]` set `offset = start` and `limit = end - start + 1`. Never read the whole file when ranges are given. Adjacent or near-adjacent ranges in the same file may be merged into a single `offset`/`limit` read to save calls, but do not expand a read past the last range's `end`.
71
+ - **`resource` entries** carry `resourceNames`: the referenced resource names. Use these names directly; look up a specific resource definition only if a scenario actually depends on its value.
72
+ - Only fall back to reading a file in full if you genuinely need surrounding context that the ranges omit (e.g. an import or a type declaration a range depends on) — and then read just the extra span you need, not the entire file.
42
73
 
43
- 3. **On failure** — if the MCP tool call fails (network error, tool unavailable, or returns an error), fall back to direct commit analysis:
74
+ Treat the assembled ranges/resource names as the **code context** for the review.
75
+
76
+ 3. **On failure or timeout** — if the extractor fails (non-zero exit, package not found / not yet published, network failure fetching it, unparseable output, or it was killed for exceeding the 600000 ms timeout), fall back to direct commit analysis:
44
77
  - Run `git diff <commit_id>^..<commit_id>` in `<harmony_project_dir>` to obtain the raw diff.
45
78
  - Run `git show --stat <commit_id>` to list affected files.
46
79
  - Read the changed files directly from the project to build the code context manually.
@@ -50,18 +83,16 @@ Before starting the review, extract the code context for the commit via the `ext
50
83
 
51
84
  ## Step 1 — Resolve Input Paths and Parse Documents
52
85
 
53
- 0. **Resolve document paths**:
54
-
55
- - If `test_case_path` is not provided, use `<output_path>/test_case.md`
56
-
86
+ 0. **Resolve document paths**: read the scenario document at `scenario_doc_path`. If it is missing or unreadable, stop and report — the scenario checklist is what the whole review is built on.
87
+
57
88
  1. **Read the code context** (from Step 0):
58
- - Parse the code context returned by the MCP tool (or the manually assembled fallback)
89
+ - Parse the code context produced by ArkAnalysis (`npx --yes arkanalysis`) (or the manually assembled fallback)
59
90
  - This contains the diff and relevant code context for commit `commit_id`
60
91
  - Understand the scope of changes: which files were modified, added, or deleted
61
92
  - Build a map of the changed code areas — these are the primary focus of the review
62
93
 
63
- 3. **Read the user scenario design document** (`test_case_path`):
64
-
94
+ 2. **Read the user scenario design document** (`scenario_doc_path`):
95
+
65
96
  - Extract every user scenario / user story / use case described
66
97
  - For each scenario, identify:
67
98
  - **Scenario name**: A short descriptive title
@@ -70,23 +101,23 @@ Before starting the review, extract the code context for the commit via the `ext
70
101
  - **Involved data flows**: What data is read, written, or transmitted
71
102
  - **Expected behavior**: The outcome the user should see
72
103
  - **Related APIs/Kits**: Which HarmonyOS APIs or Kits are needed
73
-
104
+
74
105
  If the scenario document uses a different structure (e.g. navigation flows, module descriptions, component hierarchies), derive implicit user scenarios from them. Every navigable page, every data operation, and every user-facing feature implies at least one scenario.
75
-
76
- 4. **Build a scenario checklist** — a numbered list of all extracted scenarios. This list drives the rest of the review.
106
+
107
+ 3. **Build a scenario checklist** — a numbered list of all extracted scenarios. This list drives the rest of the review.
77
108
 
78
109
  ---
79
110
 
80
111
  ## Step 2 — Analyze Code Context and Project Code
81
112
 
82
- Review the code based on the extracted code context (from the MCP tool or fallback) combined with the broader project structure:
113
+ Review the code based on the code context assembled in Step 0 — ArkAnalysis (`npx --yes arkanalysis`), the git-diff fallback, or the Step 0a holistic scan — combined with the broader project structure:
83
114
 
84
- 1. **Code context analysis** (primary focus): Analyze the extracted code context to understand:
85
- - Which files were changed in commit `commit_id`
115
+ 1. **Code context analysis** (primary focus): Analyze the assembled code context to understand:
116
+ - Which files were changed in commit `commit_id` — **Step 0b only**. On the Step 0a holistic path there is no commit to scope to: skip this item and let the Step 1 scenario checklist drive the review.
86
117
  - The specific diffs and surrounding code for each changed file
87
118
  - The intent and scope of the changes relative to the commit
88
119
 
89
- 2. **Supplementary project scan**: For files referenced by the code context, also read related project files as needed:
120
+ 2. **Supplementary project scan**: The ranges from Step 0 are the primary context — only reach beyond them when a scenario genuinely needs more. When you do, read the smallest additional span that answers the question (use `offset`/`limit`, or a targeted Grep to locate the spot first) rather than reading whole files. For files referenced by the code context, read related project files as needed:
90
121
  - **Source files**: Read relevant `.ets` and `.ts` files under `entry/src/` that are touched or referenced by the commit
91
122
  - **Configuration files**: `build-profile.json5`, `oh-package.json5`, `entry/src/main/module.json5`
92
123
  - **Resource files**: Strings, media, layout resources under `entry/src/main/resources/`
@@ -127,14 +158,13 @@ Assign one of these verdicts to each scenario:
127
158
  | **FAIL** | The code does not implement this scenario, or the implementation has critical errors that would prevent it from working. |
128
159
  | **UNABLE TO VERIFY** | The scenario requires runtime behavior (e.g. hardware sensors, device-specific features) that cannot be verified by static code review alone. |
129
160
 
130
- ### 3c. Document findings for each scenario
161
+ ### 3c. Record findings for each scenario
131
162
 
132
163
  For each scenario, record:
133
164
  - **Scenario name and ID** (from the checklist)
134
165
  - **Verdict**: PASS / PARTIAL / FAIL / UNABLE TO VERIFY
135
166
  - **Evidence**: Specific files and line numbers that implement (or should implement) this scenario
136
- - **Gaps** (if PARTIAL or FAIL): What is missing or broken, with specific details
137
- - **Suggestions**: Concrete steps to fix or complete the implementation
167
+ - **Gaps** (if PARTIAL or FAIL): What is missing or broken, with specific details — these become the **actionable defects** fixed in Step 5.
138
168
 
139
169
  ---
140
170
 
@@ -144,15 +174,139 @@ After per-scenario review, check these cross-cutting concerns that affect multip
144
174
 
145
175
  1. **Permission coverage**: Are all permissions required by the scenarios declared in `module.json5`?
146
176
  2. **Navigation completeness**: Can the user navigate between all scenario-related pages?
147
- 3. **State management correctness**: Is state shared correctly between components involved in scenarios (@State/@Prop/@Link/@Provide/@Consume)?
177
+ 3. **State management correctness**: Is state shared correctly between components involved in scenarios, using the project's own paradigm consistently? V1 project → `@State`/`@Prop`/`@Link`/`@Provide`/`@Consume` (+ `@Observed`/`@Track`); V2 project → `@Local`/`@Param`/`@Event`/`@Provider`/`@Consumer` (+ `@ObservedV2`/`@Trace`). Flag any V1/V2 decorator mixing within a component.
148
178
  4. **API version compatibility**: Are all used APIs available in the project's target API version?
149
179
  5. **Resource completeness**: Are all UI strings, images, and other resources referenced by scenarios present?
150
180
 
181
+ Each cross-cutting defect becomes an actionable fix item in Step 5.
182
+
183
+ ---
184
+
185
+ ## Step 5 — Fix the Defects (No Re-Verification)
186
+
187
+ You just found the defects yourself in Steps 3 and 4, so **do not re-verify** — go straight to fixing.
188
+
189
+ ### 5a. Prioritize
190
+
191
+ Sort all defects into this fix order:
192
+
193
+ 1. **Cross-cutting: Permissions** — blocking prerequisite for many features
194
+ 2. **Cross-cutting: Navigation** — pages must exist before features can work
195
+ 3. **Cross-cutting: Resources** — UI depends on strings/images
196
+ 4. **FAIL scenarios** — in report order (earlier scenarios are typically more fundamental)
197
+ 5. **PARTIAL scenarios** — in report order
198
+ 6. **Cross-cutting: State management** and other quality issues — lowest priority
199
+
200
+ **Maximum 2 effective attempts** per defect (an effective attempt = code was modified AND compiles successfully; compile-fix retries inside `hmos-fix-build-errors` do NOT count as an attempt).
201
+
202
+ ### 5b. Fix strategies
203
+
204
+ Apply the strategy that matches the defect category.
205
+
206
+ #### Permission Fixes
207
+
208
+ **When**: `module.json5` is missing a required permission.
209
+
210
+ 1. **Verify the permission name is valid** — first use `npx --yes devecocli docs search` / `npx --yes devecocli docs read` to confirm the permission exists in the HarmonyOS docs; fall back to WebSearch only if the local docs flow does not surface the needed reference.
211
+ 2. Read `module.json5` and locate the `requestPermissions` array (create it if absent).
212
+ 3. Add the missing permission entry:
213
+ ```json
214
+ { "name": "ohos.permission.XXX" }
215
+ ```
216
+ 4. If the feature requires **runtime permission** (e.g., camera, location, media), also add the runtime request code:
217
+ - Search the Android source (if available) to see how the permission is requested.
218
+ - Add `abilityAccessCtrl.createAtManager().requestPermissionsFromUser()` in the appropriate lifecycle (`onWindowStageCreate` or `aboutToAppear`).
219
+ - Prefer `npx --yes devecocli docs search` / `npx --yes devecocli docs read` for the HarmonyOS API reference, then fall back to WebSearch if the local docs are insufficient.
220
+
221
+ #### Page/Component Creation
222
+
223
+ **When**: A page or component referenced by a scenario does not exist.
224
+
225
+ 1. **Read the Android source** (if `android_project_dir` is provided):
226
+ - Find the corresponding Android Activity/Fragment/View.
227
+ - Document: layout structure, event handlers, data sources, navigation targets.
228
+ 2. **Use `npx --yes devecocli docs search` / `npx --yes devecocli docs read` first** to look up the HarmonyOS equivalent UI components (e.g., `Grid` for `RecyclerView`, `List` for `ListView`). Fall back to WebSearch only when the local docs flow is insufficient.
229
+ 3. **Create the page file** under `entry/src/main/ets/pages/`:
230
+ - Implement a **minimal viable page**: basic UI structure + essential state variables + placeholder data.
231
+ - Do NOT attempt to implement all business logic — focus on making the scenario's happy path work.
232
+ 4. **Register the route** in `resources/base/profile/main_pages.json`.
233
+ 5. **Add navigation** from the calling page (if the scenario specifies a navigation flow).
234
+
235
+ #### API Import and Call Fixes
236
+
237
+ **When**: A required HarmonyOS API is not imported or called.
238
+
239
+ 1. **Identify the correct API**:
240
+ - If Android source is available, find the corresponding Android API call and determine the HarmonyOS equivalent.
241
+ - Prefer `npx --yes devecocli docs search` / `npx --yes devecocli docs read` for HarmonyOS API documentation.
242
+ - Use WebSearch as fallback when the local docs flow does not provide enough detail.
243
+ 2. **Do NOT guess API signatures** — always verify import path, function name, parameter types, and return type from documentation.
244
+ 3. Add the import statement and the API call in the correct location.
245
+
246
+ #### Event Handling / Business Logic Fixes
247
+
248
+ **When**: A user interaction or data flow is missing.
249
+
250
+ 1. **Read the Android implementation** (if available):
251
+ - Find the event listener (e.g., `setOnClickListener`, `addTextChangedListener`).
252
+ - Trace what happens when the event fires: state changes, API calls, UI updates, navigation.
253
+ 2. **Translate to ArkTS**:
254
+ - Android `setOnClickListener` → ArkUI `.onClick(() => { ... })`
255
+ - Android `TextWatcher` → ArkUI `.onChange((value: string) => { ... })`
256
+ - Android `onItemClick` → ArkUI `.onClick()` on `ListItem` / `GridItem`
257
+ - Android `LongClickListener` → ArkUI `.gesture(LongPressGesture().onAction(() => { ... }))`
258
+ 3. **Implement the business logic**:
259
+ - Mirror the Android logic flow as closely as possible.
260
+ - Use appropriate HarmonyOS APIs for persistence (`preferences`), networking (`http`), file operations (`fileIo`).
261
+ 4. **Bind to UI**: Ensure the reactive state variables are updated so the UI reflects changes — `@State`/`@Link` etc. in a V1 project, `@Local`/`@Param` etc. in a V2 project (see State Management Fixes below for paradigm detection).
262
+
263
+ #### Resource Fixes
264
+
265
+ **When**: String resources, media files, or layout parameters are missing.
266
+
267
+ 1. **String resources**:
268
+ - Read `resources/base/element/string.json`.
269
+ - Add missing string entries with appropriate keys and values.
270
+ - If Android source is available, reference `res/values/strings.xml` for the original text.
271
+ 2. **Media resources (images/icons)**:
272
+ - If the original image exists in the Android project's `res/drawable*` or `res/mipmap*`, note it for manual copy (do not auto-copy binary files).
273
+ - For missing icons, record as "media resource needed" in the fix report — do not create placeholder images.
274
+ 3. **Layout parameters**:
275
+ - Add missing dimension/color values to `float.json` or `color.json` as needed.
276
+
277
+ #### State Management Fixes
278
+
279
+ **When**: Components have incorrect or missing state decorators.
280
+
281
+ 0. **Detect the project's state-management paradigm first** (project-level, decided once). ArkTS has two paradigms and they must NOT be mixed within a project/component:
282
+ - `@Component` + `@State`/`@Prop`/`@Link`/`@Provide`/`@Consume`/`@Observed`/`@ObjectLink`/`@Watch` → **V1**
283
+ - `@ComponentV2` + `@Local`/`@Param`/`@Once`/`@Event`/`@ObservedV2`/`@Trace`/`@Monitor`/`@Provider`/`@Consumer` → **V2**
284
+ - Empty project / no state decorators → default **V2**. When both exist, follow the majority and match the file's surrounding code. Fix decorators to fit the detected paradigm — never introduce the other one.
285
+ 1. **Analyze the component hierarchy** (use the matching paradigm's decorators):
286
+ - **V1**: Parent → Child: `@State` in parent + `@Prop` (one-way) or `@Link` (two-way) in child. Ancestor → deep descendant: `@Provide` + `@Consume`. Global: `AppStorage` / `LocalStorage`.
287
+ - **V2**: Component-internal: `@Local`. Parent → Child input: `@Param` (+ `@Once` if sync-once). Child → parent: `@Event` callback (with `!!` two-way binding when appropriate). Ancestor → descendant: `@Provider` / `@Consumer`. Global: `AppStorageV2` / `PersistenceV2`.
288
+ 2. **Check for common mistakes**:
289
+ - **V1**: `@State` on a non-primitive without `@Observed` on the class; `@Link` without a `$variable` binding from the parent; missing `@Watch` when a side-effect is needed on state change; `@Observed` class property used in UI but missing `@Track`.
290
+ - **V2**: `@ObservedV2` class property observed in UI but missing `@Trace` (both must be used together — either alone is inert); `@Param` mutated inside the child (it is input-only — emit changes via `@Event`); `@Local` expected to receive external input (use `@Param` instead).
291
+ - **Mixing**: V1 and V2 decorators in the same component (e.g. `@Local` inside `@Component`, or `@State` inside `@ComponentV2`) — align to the detected paradigm.
292
+ 3. Use `npx --yes devecocli docs search` / `npx --yes devecocli docs read` first to verify the correct decorator combination if unsure. Fall back to WebSearch only when the local docs are insufficient.
293
+
151
294
  ---
152
295
 
153
- ## Step 5 — Write `code-review-report.md`
296
+ ## Step 6 — Compilation Verification
297
+
298
+ After completing fixes for a group of related defects (e.g., all defects in one scenario, or all permission defects), verify the project still compiles:
299
+
300
+ 1. Invoke `hmos-fix-build-errors <harmony_project_dir>`.
301
+ 2. If compilation fails, let `hmos-fix-build-errors` handle the compile-error fix loop — these retries do **not** count as an effective attempt.
302
+ 3. If compilation succeeds, proceed to the next group of defects.
303
+ 4. If compilation still cannot be fixed after the build-fix skill completes, **revert the most recent changes** for that group and record the defect as "failed to fix — compilation error".
304
+
305
+ ---
154
306
 
155
- Write the report to `output_path/code-review-report.md` with the following structure:
307
+ ## Step 7 — Write the Merged `code-review-report.md`
308
+
309
+ Write the merged review + fix report to `<output_path>/code-review-report.md` with the following structure:
156
310
 
157
311
  ```markdown
158
312
  # Code Review Report
@@ -160,21 +314,27 @@ Write the report to `output_path/code-review-report.md` with the following struc
160
314
  ## Overview
161
315
 
162
316
  - **Project**: <project name/path>
163
- - **Commit ID**: <commit_id>
164
- - **Scenario Doc**: <test_case_path>
165
- - **Code Context**: extract_commit_context MCP tool (or git-diff fallback)
317
+ - **Commit ID**: <commit_id, or "none — holistic review">
318
+ - **Scenario Doc**: <scenario_doc_path>
319
+ - **Android Source**: <android_project_dir or "not provided">
320
+ - **Code Context**: ArkAnalysis (npx --yes arkanalysis) / git-diff fallback / holistic (no commit_id)
166
321
  - **Review Date**: <date>
167
322
  - **Total Scenarios**: <N>
168
- - **Results**: <X> PASS | <Y> PARTIAL | <Z> FAIL | <W> UNABLE TO VERIFY
323
+ - **Scenario Results**: <X> PASS | <Y> PARTIAL | <Z> FAIL | <W> UNABLE TO VERIFY
324
+ - **Total Defects Found**: <T> (FAIL + PARTIAL scenarios + cross-cutting defects)
325
+ - **Successfully Fixed**: <A>
326
+ - **Failed to Fix**: <B>
327
+ - **Fix Success Rate**: <A / T as percentage>
328
+ - **Overall Verdict**: PASS / PASS WITH ISSUES / NEEDS REWORK
169
329
 
170
330
  ## Scenario Coverage Summary
171
331
 
172
- | # | Scenario | Verdict | Key Gaps |
173
- |---|----------|---------|----------|
174
- | 1 | ... | PASS | — |
175
- | 2 | ... | PARTIAL | Missing network error handling |
176
- | 3 | ... | FAIL | Page not implemented |
177
- | ...| ... | ... | ... |
332
+ | # | Scenario | Verdict | Key Gaps | Fix Status |
333
+ |---|----------|---------|----------|-----------|
334
+ | 1 | ... | PASS | — | — |
335
+ | 2 | ... | PARTIAL | Missing network error handling | ✅ Fixed |
336
+ | 3 | ... | FAIL | Page not implemented | ⚠️ Partially Fixed |
337
+ | ...| ... | ... | ... | ... |
178
338
 
179
339
  ## Detailed Scenario Reviews
180
340
 
@@ -182,16 +342,23 @@ Write the report to `output_path/code-review-report.md` with the following struc
182
342
 
183
343
  **Description**: <what the user does>
184
344
  **Verdict**: PASS / PARTIAL / FAIL / UNABLE TO VERIFY
345
+ **Fix Status**: ✅ Fixed / ⚠️ Partially Fixed / ❌ Failed / — (no fix needed)
185
346
 
186
347
  **Evidence**:
187
348
  - `entry/src/main/ets/pages/XxxPage.ets:42` — page component handles this flow
188
349
  - ...
189
350
 
190
- **Gaps**:
351
+ **Gaps** (before fix):
191
352
  - (none, or list specific missing pieces)
192
353
 
193
- **Suggestions**:
194
- - (none, or concrete fix steps)
354
+ **Fixes Applied**:
355
+ - Strategy: <permission / component / API / logic / resource / state-management>
356
+ - Android Reference: <description, if `android_project_dir` was used>
357
+ - Files Modified:
358
+ - `<file path>`: <what was changed>
359
+ - API Documentation Used: <npx --yes devecocli docs query/doc title or WebSearch query, if used>
360
+ - Compilation: PASS / FAIL
361
+ - Notes: <caveats, follow-up needed>
195
362
 
196
363
  ---
197
364
 
@@ -201,40 +368,129 @@ Write the report to `output_path/code-review-report.md` with the following struc
201
368
  ## Cross-Cutting Issues
202
369
 
203
370
  ### Permission Coverage
204
- ...
371
+ - **Findings**: <list>
372
+ - **Fixes Applied**:
373
+ - Permissions added: <list>
374
+ - Runtime permission requests added: <yes/no, details>
205
375
 
206
376
  ### Navigation Completeness
207
- ...
377
+ - **Findings**: <list>
378
+ - **Fixes Applied**:
379
+ - Pages created: <list>
380
+ - Routes registered: <list>
381
+
382
+ ### Resource Completeness
383
+ - **Findings**: <list>
384
+ - **Fixes Applied**:
385
+ - Strings added: <count>
386
+ - Media resources needed (manual): <list>
208
387
 
209
388
  ### State Management
210
- ...
389
+ - **Findings**: <list>
390
+ - **Fixes Applied**: <decorators added/changed>
211
391
 
212
392
  ### API Compatibility
213
- ...
393
+ - **Findings**: <list>
394
+ - **Fixes Applied**: <notes>
214
395
 
215
- ### Resource Completeness
216
- ...
396
+ ## Remaining Issues
397
+
398
+ Issues that could not be fixed, with analysis:
399
+
400
+ | # | Issue | Reason | Recommendation |
401
+ |---|-------|--------|----------------|
402
+ | 1 | ... | Failed after 2 attempts — <details> | Manual implementation needed |
403
+ | 2 | ... | UNABLE TO VERIFY — runtime-only behavior | Manual testing required |
404
+
405
+ ## All Modified Files
406
+
407
+ | File | Defects Addressed | Change Summary |
408
+ |------|-------------------|----------------|
409
+ | `entry/src/main/module.json5` | Permission coverage | Added READ_IMAGEVIDEO permission |
410
+ | `entry/src/main/ets/pages/Index.ets` | Scenario 1, 2 | Added media grid, permission request |
411
+ | ... | ... | ... |
217
412
 
218
413
  ## Final Assessment
219
414
 
220
415
  **Overall Verdict**: <PASS / PASS WITH ISSUES / NEEDS REWORK>
221
416
 
222
417
  - **Fully covered scenarios**: <list>
223
- - **Partially covered scenarios**: <list with key gaps>
224
- - **Not covered scenarios**: <list with what's needed>
418
+ - **Partially covered scenarios**: <list with residual gaps>
419
+ - **Not covered scenarios**: <list with what's still needed>
225
420
 
226
- **Recommended Priority Fixes**:
421
+ **Recommended Priority Follow-ups**:
227
422
  1. ...
228
423
  2. ...
229
424
  ```
230
425
 
231
426
  ---
232
427
 
428
+ ## Step 8 — Git Commit (if defects were fixed)
429
+
430
+ After writing `code-review-report.md`, commit the changes if any source files were modified.
431
+
432
+ **Condition**: Run this step only when "Successfully Fixed" > 0.
433
+
434
+ 1. **Check if the project is in a git repository**:
435
+ ```bash
436
+ cd "<harmony_project_dir>" && git rev-parse --is-inside-work-tree
437
+ ```
438
+
439
+ 2. **If yes, stage exactly the files you modified, then commit.** Stage them by explicit path — the same set you list in the report's **All Modified Files** table:
440
+ ```bash
441
+ cd "<harmony_project_dir>"
442
+ git add "<file1>" "<file2>" ...
443
+ git commit -m "fix(review): address {A} code review defects
444
+
445
+ Total defects: {T}, Fixed: {A}, Failed: {B}
446
+ "
447
+ ```
448
+ (where T = total defects, A = successfully fixed, B = failed to fix)
449
+
450
+ **Never use `git add -A` / `git add .`.** Run `git status --short` first and confirm every path you stage is a source file you actually edited.
451
+
452
+ 3. **Capture the commit ID**:
453
+ ```bash
454
+ cd "<harmony_project_dir>" && git rev-parse HEAD
455
+ ```
456
+
457
+ 4. **Write commit info** to `<output_path>/code-review-commit-info.md`:
458
+ ```
459
+ commit_id: <commit_id>
460
+ ```
461
+
462
+ **If no files were modified** (all scenarios PASS, or all fix attempts failed):
463
+ - Write `<output_path>/code-review-commit-info.md` with:
464
+ ```
465
+ commit_id: none
466
+ ```
467
+
468
+ **If not in a git repository**:
469
+ - Record "Not a git repository — skipped commit" in the report's Remaining Issues section.
470
+ - Write `<output_path>/code-review-commit-info.md` with:
471
+ ```
472
+ commit_id: none
473
+ ```
474
+
475
+ **If `output_path` was not provided**, skip writing `code-review-commit-info.md`.
476
+
477
+ ---
478
+
233
479
  ## Guidelines
234
480
 
235
481
  - **Scenario-first**: Every finding must be tied to a specific user scenario. Do not report generic code style issues unless they impact a scenario.
236
482
  - **Be specific**: Always include file paths and line numbers as evidence.
237
483
  - **Be fair**: If the code works for a scenario, give it PASS — don't nitpick style in a scenario review.
238
- - **Derive implicit scenarios**: If the scenario document describes architecture (pages, modules, data flows) rather than explicit user stories, derive the scenarios yourself — every page implies a "user visits this page" scenario, every data flow implies a "user triggers this operation" scenario.
239
- - **Prioritize gaps**: In the final assessment, rank missing scenarios by user impact — which gaps would users notice first?
240
- - **No false positives**: Only mark FAIL when you are confident the scenario cannot work. Use UNABLE TO VERIFY for uncertain cases.
484
+ - **Derive implicit scenarios**: If the scenario document describes architecture (pages, modules, data flows) rather than explicit user stories, derive the scenarios yourself.
485
+ - **No re-verification**: You found the defects; do not launch a second verification pass before fixing. Trust your own findings.
486
+ - **Look up before you guess**: Prefer `npx --yes devecocli docs search` / `npx --yes devecocli docs read` for HarmonyOS API usage, parameter types, and patterns. Fall back to WebSearch only when the local docs flow is insufficient. Do not assume API signatures.
487
+ - **Use device logs for runtime-only clues**: When a scenario failure appears device-specific or cannot be closed statically, prefer `npx --yes devecocli log --level E` and `npx --yes devecocli log --crash --bundle-name <bundle>` before broader manual diagnosis.
488
+ - **Read before you edit**: Always read a file before modifying it. Understand the surrounding context.
489
+ - **Android as specification**: When available, treat the Android implementation as the ground truth for expected behavior.
490
+ - **Minimal changes**: Only fix identified defects. Do not refactor, add comments to unrelated code, or "improve" working code.
491
+ - **Fix the root cause**: Address the underlying issue, not just the symptom.
492
+ - **Compile before moving on**: Every fix group must pass compilation before being considered complete.
493
+ - **Don't introduce new issues**: Verify that fixes don't break other features by checking for shared state, shared components, or shared resources.
494
+ - **Preserve intent**: Keep the original code's structure and patterns where possible. Match the existing naming conventions, file organization, and code style.
495
+ - **Prioritize gaps**: In the final assessment, rank residual gaps by user impact — which gaps would users notice first?
496
+ - **No false positives in Step 3**: Only mark FAIL when you are confident the scenario cannot work. Use UNABLE TO VERIFY for uncertain cases — an UNABLE TO VERIFY scenario is **not** an actionable defect and should not be fixed.