@buaa_smat/hometrans 0.1.17 → 0.1.20

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 (227) hide show
  1. package/README.md +138 -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 +35 -376
  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 +19 -146
  35. package/dist/cli/config.js +6 -8
  36. package/dist/cli/env-vars.js +1 -3
  37. package/dist/cli/index.js +0 -11
  38. package/dist/cli/init.js +147 -235
  39. package/dist/cli/uninstall.js +5 -129
  40. package/dist/utils/regex.js +8 -0
  41. package/env-requirements.json +57 -55
  42. package/package.json +6 -8
  43. package/resource/convert_pipeline_process.svg +103 -0
  44. package/resource/project_architecture.svg +122 -0
  45. package/resource/title_dark.png +0 -0
  46. package/skills/hmos-batch-ui-align/SKILL.md +345 -43
  47. package/skills/hmos-batch-ui-align/references/conversion-procedure.md +661 -180
  48. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
  49. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
  50. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
  51. 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
  52. 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
  53. 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
  54. 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
  55. 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
  56. 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
  57. 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
  58. 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
  59. 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
  60. 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
  61. package/skills/hmos-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -911
  62. 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
  63. 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
  64. 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
  65. 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
  66. 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
  67. 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
  68. 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
  69. 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
  70. 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
  71. 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
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. 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
  78. 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
  79. 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
  80. package/skills/hmos-batch-ui-align/scripts/android_parse_fast.ts +1798 -0
  81. package/skills/hmos-batch-ui-align/scripts/arkts_static_check.ts +1592 -0
  82. package/skills/hmos-batch-ui-align/scripts/measure_pack.ts +752 -0
  83. package/skills/hmos-convert-pipeline/SKILL.md +188 -131
  84. package/skills/hmos-fix-build-errors/SKILL.md +87 -67
  85. package/skills/hmos-fix-build-errors/references/arkts-strict-patterns.md +219 -219
  86. package/skills/hmos-fix-build-errors/references/known-patterns.md +157 -157
  87. package/skills/hmos-fix-build-errors/references/rdb-entity-pattern.md +131 -131
  88. package/skills/hmos-incremental-ui-align/README.md +57 -40
  89. package/skills/hmos-incremental-ui-align/SKILL.md +180 -24
  90. package/skills/hmos-incremental-ui-align/diff_analysis.md +52 -52
  91. package/skills/hmos-incremental-ui-align/page_align.md +62 -62
  92. package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +38 -2
  93. 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
  94. 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
  95. 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
  96. 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
  97. 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
  98. 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
  99. 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
  100. 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
  101. 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
  102. 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
  103. 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
  104. 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
  105. 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
  106. 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
  107. 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
  108. 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
  109. 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
  110. 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
  111. 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
  112. 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
  113. 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
  114. 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
  115. 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
  116. 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
  117. 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
  118. 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
  119. 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
  120. 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
  121. package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +74 -0
  122. package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +34 -4
  123. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
  124. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
  125. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
  126. package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +937 -0
  127. package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +343 -0
  128. package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +44 -5
  129. package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +977 -0
  130. package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +188 -0
  131. package/skills/hmos-integration-test/README.md +111 -79
  132. package/skills/hmos-integration-test/SKILL.md +216 -132
  133. package/skills/hmos-integration-test/scripts/report-tool.ts +791 -0
  134. package/skills/hmos-integration-test/scripts/resolve-metadata-tool.ts +125 -0
  135. package/skills/hmos-integration-test/scripts/self-test-runner.ts +756 -0
  136. package/skills/hmos-integration-test/scripts/testcases-tool.ts +239 -0
  137. package/skills/hmos-resources-convert/SKILL.md +334 -66
  138. package/skills/hmos-resources-convert/references/code-vector-icon-rules.md +335 -0
  139. package/skills/hmos-resources-convert/references/conversion-rules.md +676 -663
  140. package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +410 -388
  141. package/skills/hmos-resources-convert/references/lottie-conversion-rules.md +219 -0
  142. package/skills/hmos-resources-convert/references/resource-mapping-rules.md +482 -457
  143. package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +592 -513
  144. package/skills/hmos-resources-convert/scripts/a2h_resource_convert.ts +2163 -0
  145. package/skills/hmos-resources-convert/scripts/code_vector_icons.ts +591 -0
  146. package/skills/hmos-resources-convert/scripts/svg_fidelity_check.ts +632 -0
  147. package/skills/hmos-spec-generate/SKILL.md +293 -214
  148. package/skills/hmos-spec-generate/scripts/parse_requirements.ts +515 -0
  149. package/skills/hmos-spec-generate/template/REQ.txt +22 -0
  150. package/skills/hmos-spec-generate/template/REQ.xlsx +0 -0
  151. package/skills/hmos-test-case-generation/README.md +241 -0
  152. package/skills/hmos-test-case-generation/SKILL.md +324 -0
  153. package/skills/hmos-test-case-generation/references/contract.md +315 -0
  154. package/skills/hmos-test-case-generation/references/review-notes-template.md +84 -0
  155. package/skills/hmos-test-case-generation/references/ui-elements-schema.md +142 -0
  156. package/skills/hmos-test-case-generation/tools/convert_to_ui_elements.ts +550 -0
  157. package/skills/hmos-test-case-generation/tools/validate.ts +1312 -0
  158. package/tools/bfs-crawl/README.md +73 -0
  159. package/tools/bfs-crawl/android_viewtree_bfs_crawler.ts +1662 -0
  160. package/agents/build-fixer.md +0 -385
  161. package/agents/logic-coder/scripts/platform_context_query.py +0 -568
  162. package/agents/review-fixer.md +0 -405
  163. package/agents/spec-generator.md +0 -541
  164. package/dist/cli/mcp-setup.js +0 -258
  165. package/dist/cli/mcp.js +0 -94
  166. package/dist/context/index.js +0 -694
  167. package/resource/migration_process.svg +0 -94
  168. package/resource/migration_process_transparent.svg +0 -93
  169. package/skills/hmos-batch-ui-align/scripts/android_parse_fast.py +0 -1606
  170. package/skills/hmos-incremental-ui-align/scripts/__pycache__/app_feature_verify.cpython-314.pyc +0 -0
  171. package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.py +0 -542
  172. package/skills/hmos-incremental-ui-align/scripts/page_capture.py +0 -597
  173. package/skills/hmos-resources-convert/evals/evals.json +0 -171
  174. package/skills/hmos-resources-convert/template/AppScope/app.json5 +0 -10
  175. package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +0 -8
  176. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
  177. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
  178. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +0 -7
  179. package/skills/hmos-resources-convert/template/build-profile.json5 +0 -42
  180. package/skills/hmos-resources-convert/template/code-linter.json5 +0 -32
  181. package/skills/hmos-resources-convert/template/entry/build-profile.json5 +0 -33
  182. package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +0 -6
  183. package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +0 -23
  184. package/skills/hmos-resources-convert/template/entry/oh-package.json5 +0 -10
  185. package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +0 -48
  186. package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +0 -16
  187. package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +0 -23
  188. package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +0 -55
  189. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +0 -8
  190. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +0 -8
  191. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +0 -16
  192. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
  193. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
  194. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +0 -7
  195. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
  196. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +0 -3
  197. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +0 -5
  198. package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +0 -8
  199. package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +0 -2
  200. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +0 -35
  201. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +0 -5
  202. package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +0 -16
  203. package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +0 -5
  204. package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +0 -33
  205. package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +0 -23
  206. package/skills/hmos-resources-convert/template/hvigorfile.ts +0 -6
  207. package/skills/hmos-resources-convert/template/oh-package-lock.json5 +0 -28
  208. package/skills/hmos-resources-convert/template/oh-package.json5 +0 -10
  209. package/skills/hmos-resources-convert/tools/apktool_3.0.1.jar +0 -0
  210. package/skills/hmos-spec-generate/references/android-platform-tokens.md +0 -105
  211. package/skills/hmos-spec-generate/references/spec-sample-1.md +0 -78
  212. package/skills/hmos-spec-generate/references/spec-sample-2.md +0 -58
  213. package/skills/hmos-spec-generate/references/spec-sample-3.md +0 -116
  214. package/skills/hmos-spec-generate/references/step4-report-template.md +0 -33
  215. package/tools/test-tools/autotest/README.md +0 -238
  216. package/tools/test-tools/autotest/pyproject.toml +0 -26
  217. package/tools/test-tools/autotest/report_tool.py +0 -759
  218. package/tools/test-tools/autotest/self_test_runner.py +0 -895
  219. package/tools/test-tools/autotest/testcases_schema.md +0 -143
  220. package/tools/test-tools/autotest/testcases_tool.py +0 -215
  221. package/tools/test-tools/autotest/uv.lock +0 -3156
  222. package/tools/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
  223. package/tools/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
  224. package/tools/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
  225. package/tools/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
  226. package/tools/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
  227. package/tools/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
@@ -20,7 +20,7 @@ Parse `$ARGUMENTS` as positional tokens:
20
20
  - **Arg 3** (`spec_file_path`): Path to the requirement spec document (required). This is the plan/spec that drives Stage 1 logic development and Stage 3 code review — both stages read it directly from this path.
21
21
  - **Arg 4** (`assets_output_path`): Directory to store all output/report files (optional). When omitted, default to `<harmony_project_dir>/.hometrans` — create the directory if it does not exist.
22
22
  - **Arg 5** (`test_case_path`): Path to the self-test case file driving the Stage 4 self-testing loop (optional). When omitted, default to `OUTPUT/test_case.md`. If the resolved file does not exist, the Stage 4 loop is skipped (see Loop Setup).
23
- - **Arg 6** (`pre_test_case_path`): Path to the pre-test case file (optional). When omitted, default to `OUTPUT/pre_test_case.md`. Only passed to the self-tester when the resolved file exists.
23
+ - **Arg 6** (`pre_test_case_path`): Path to the pre-test case file (optional). When omitted, default to `OUTPUT/pre_test_case.md`. Only passed to the hmos-integration-test skill when the resolved file exists.
24
24
  - **Arg 7** (`max_rounds_review`): Maximum number of Stage 3→3a→3b code-review-fix rounds to run (optional, default `2`). Must be a positive integer `>= 1`.
25
25
  - **Arg 8** (`max_rounds_test`): Maximum number of Stage 4→4a→4b self-test rounds to run (optional, default `2`). Must be a positive integer `>= 1`.
26
26
  - **Arg 9** (`skip_test`): `true` or `false` (optional, default `false`). When `true`, skip Stage 4 / 4a / 4b (Self-Testing Loop) entirely. Use this when no real HarmonyOS device is available for on-device testing.
@@ -35,14 +35,26 @@ Define shorthand variables for the instructions below:
35
35
  |----------|---------|
36
36
  | `ANDROID` | android_project_dir |
37
37
  | `HMOS` | harmony_project_dir |
38
- | `SPEC` | spec_file_path — requirement spec document, consumed directly by Stage 1 (`spec_file`) and Stage 3 (`test_case_path`) |
38
+ | `SPEC` | spec_file_path — requirement spec document, consumed directly by Stage 1 (`spec_file`) and Stage 3 (`scenario_doc_path`) |
39
39
  | `OUTPUT` | assets_output_path; defaults to `HMOS/.hometrans` when not provided (created on demand) |
40
+ | `SCRIPTS_PATH` | absolute path to `agents/scripts` in this repo |
40
41
  | `TEST_CASE` | test_case_path; defaults to `OUTPUT/test_case.md` when not provided |
41
42
  | `PRE_TEST_CASE` | pre_test_case_path; defaults to `OUTPUT/pre_test_case.md` when not provided |
42
43
  | `MAX_ROUNDS_REVIEW` | max_rounds_review — positive integer (default `2`). Controls Stage 3→3a→3b code-review-fix loop. |
43
44
  | `MAX_ROUNDS_TEST` | max_rounds_test — positive integer (default `2`). Controls Stage 4→4a→4b self-test loop. |
44
45
  | `SKIP_TEST` | skip_test — `true` or `false` (default `false`). When `true`, skip Stage 4 / 4a / 4b entirely (no real device available). |
45
46
 
47
+ ### Parameter Conventions
48
+
49
+ The pipeline sits between two layers that use different param styles — keep them straight when handing off:
50
+
51
+ - **Invoking a skill** (`hmos-integration-test`, `hmos-fix-build-errors`, `hmos-test-case-generation`, …): pass **kebab-case** params matching that skill's documented input table (e.g. `test-case-path`, `hap-path`, `project-dir`, `output-path`, `pre-test-case-path`).
52
+ - **Invoking a subagent** (`self-test-fixer`, `logic-coder`, `logic-context-builder`, `code-reviewer`, …): pass **snake_case** params matching that agent's definition (e.g. `self_test_report_path`, `harmony_project_dir`, `android_project_dir`, `output_path`). These snake_case keys are the agent-layer contract used consistently across all agent invocations in the project.
53
+ - **Exception — `self-tester`**: it is a thin pass-through wrapper around the `hmos-integration-test` skill, so it takes the **same kebab-case params as the skill** (`hap-path`, `test-case-path`, `project-dir`, `output-path`, `pre-test-case-path`, …), not snake_case. It forwards them verbatim to the skill and reports the result back.
54
+ - **This pipeline's own positional args** (Arg 1–9 above): documented as **snake_case labels** (positional; the label does not affect invocation).
55
+
56
+ The user-facing skill layer is uniformly kebab-case; agents use snake_case per their definitions (with `self-tester` as the documented kebab pass-through exception).
57
+
46
58
  ---
47
59
 
48
60
  ## Environment Variables Check (run before Stage 1)
@@ -51,25 +63,44 @@ The pipeline's sub-agents resolve each setting along the standard chain — **OS
51
63
 
52
64
  | Variable | config.json fallback | Needed for | Valid when |
53
65
  |---|---|---|---|
54
- | `DEVECO_HOME` *(or `DEVECO_SDK_HOME`)* | `env.DEVECO_HOME` / `env.DEVECO_SDK_HOME` | Stage 2 build + Stage 3a/4b rebuilds | resolves to a valid DevEco install |
55
- | `HOMETRANS_MODEL_API_KEY` *(legacy `TEST_API_KEY` still honored as a fallback)* | `autotest.unified_model.api_key` | Stage 4 self-test (only when `SKIP_TEST=false`) | non-empty / not the placeholder |
56
- | `HOMETRANS_TOOL_PATH` | `env.HOMETRANS_TOOL_PATH` (defaults to `~/.hometrans/tools`) | Stage 4 self-test AutoTest dir | path exists on disk |
66
+ | `DEVECO_HOME` *(or `DEVECO_SDK_HOME`)* | `env.DEVECO_HOME` / `env.DEVECO_SDK_HOME` | Stage 2 build + Stage 3b/4b rebuilds | resolves to a valid DevEco install |
67
+ | `HOMETRANS_MODEL_API_KEY` | `HOMETRANS_MODEL_API_KEY env var` | Stage 4 self-test (only when `SKIP_TEST=false`) | non-empty / not the placeholder |
68
+ | `HOMETRANS_TOOL_PATH` | env unset → fall back to `~/.hometrans/tools` | Stage 4 self-test AutoTest dir | path exists on disk |
69
+
70
+ For each value, if the env var is unset, fall back to the listed `~/.hometrans/config.json` field. If neither yields a value:
71
+
72
+ - **DevEco path** — **ask the user**; no stage can build without it.
73
+ - **model api_key** — **ask the user**, or accept `skip_test=true` to drop Stage 4 entirely.
74
+ - **`HOMETRANS_TOOL_PATH`** — do not ask and do not fail. The hmos-integration-test skill resolves `@autotest/agent` itself (walk-up + global npm root + auto-install), so an unset value is normal. Record one manifest note and continue; only treat it as a problem if Stage 4 later reports `batch_runner.js not found`.
75
+
76
+ Suggest running `ht init` to persist these as machine environment variables.
77
+
78
+ ---
79
+
80
+ ## Output Directory Guard (run before Stage 1)
81
+
82
+ When the resolved `OUTPUT` lies **under `HMOS`** (the default `HMOS/.hometrans` does), make the HarmonyOS project ignore it:
83
+
84
+ 1. Compute `OUTPUT`'s path relative to `HMOS` — for the default, `.hometrans/`.
85
+ 2. Read `HMOS/.gitignore`, creating it if absent.
86
+ 3. If no existing rule already covers that path, append it on its own line with a trailing `/`.
87
+ 4. Verify with `git -C "<HMOS>" check-ignore -q "<OUTPUT>"` (exit 0 = ignored). If it still is not ignored, stop and tell the user.
88
+ 5. Note in the manifest whether the rule was pre-existing or added by this run.
57
89
 
58
- For each value, if the env var is unset, fall back to the listed `~/.hometrans/config.json` field. If neither yields a value: for the DevEco path / model api_key, **ask the user** (for the api_key they may instead pass `skip_test=true`). Suggest running `ht init` to persist these as machine environment variables.
90
+ Skip this guard when `OUTPUT` sits outside `HMOS`, or when `HMOS` is not a git repository — note the reason in the manifest either way.
59
91
 
60
92
  ---
61
93
 
62
94
  ## Progress Tracking
63
95
 
64
- Before any agent runs, create tasks for all pipeline stages listed below so the user sees the full plan immediately. Stages are sequential — each stage depends on the previous one completing first. For the Stage 3 and Stage 4 loops, create one umbrella task per sub-stage (3 / 3a / 3b and 4 / 4a / 4b) covering the full multi-round cycle rather than creating per-round tasks. If `SKIP_TEST == true`, still create Stage 4 / 4a / 4b tasks but mark them as completed immediately with a "Skipped" note.
96
+ Before any agent runs, create tasks for all pipeline stages listed below so the user sees the full plan immediately. Stages are sequential — each stage depends on the previous one completing first. For the Stage 3 and Stage 4 loops, create one umbrella task per sub-stage (3 / 3b and 4 / 4a / 4b) covering the full multi-round cycle rather than creating per-round tasks. If `SKIP_TEST == true`, still create Stage 4 / 4a / 4b tasks but mark them as completed immediately with a "Skipped" note.
65
97
 
66
98
  | # | subject | activeForm |
67
99
  |---|---------|------------|
68
100
  | 1 | Logic Development (Context Builder) | Building logic decision contract |
69
101
  | 1a | Logic Coding | Converting business logic to ArkTS |
70
102
  | 2 | Compilation and Build | Building HarmonyOS project |
71
- | 3 | Code Review | Reviewing HarmonyOS code quality |
72
- | 3a | Review Fix | Fixing code review issues |
103
+ | 3 | Code Review + Fix | Reviewing and fixing HarmonyOS code |
73
104
  | 3b | Rebuild after Review Fix | Rebuilding after review fixes |
74
105
  | 4 | Self-Testing | Running on-device tests |
75
106
  | 4a | Self-Test Fix | Fixing self-test failures |
@@ -79,18 +110,18 @@ For each stage: mark `in_progress` before launching the agent, then `completed`
79
110
 
80
111
  ### Stage Duration Tracking
81
112
 
82
- For every stage (including each Stage 3 / 3a / 3b review round and each Stage 4 / 4a / 4b test round), capture wall-clock duration:
113
+ For every stage (including each Stage 3 / 3b review round and each Stage 4 / 4a / 4b test round), capture wall-clock duration:
83
114
 
84
115
  1. Just before marking a stage `in_progress`, record `stage_start_iso` using the current local time (e.g., run `date -Iseconds` via Bash, or capture a timestamp in ISO-8601 `YYYY-MM-DDTHH:MM:SS` form).
85
116
  2. Just after the stage's agent returns, record `stage_end_iso` the same way.
86
117
  3. Compute `duration_seconds = stage_end_iso - stage_start_iso` and format as `H:MM:SS` (hours, minutes, seconds).
87
- 4. Record `start`, `end`, and `duration` in the manifest's **Duration Summary** table (see format below). For Stage 3 review loop rounds, record one row per execution using labels like `3 - Code Review (Round 1)`, etc. For Stage 4 test loop rounds, use labels like `4 - Self-Testing (Round 1)`, etc.
118
+ 4. Record `start`, `end`, and `duration` in the manifest's **Duration Summary** table (see format below). For Stage 3 review loop rounds, record one row per execution using labels like `3 - Code Review + Fix (Round 1)`, etc. For Stage 4 test loop rounds, use labels like `4 - Self-Testing (Round 1)`, etc.
88
119
 
89
120
  For the Stage 3 review loop:
90
121
  - Mark Stage 3 `in_progress` when Round 1 starts, and keep it `in_progress` until the full review loop exits.
91
- - Mark Stage 3a `in_progress` when the first Stage 3a round starts, and Stage 3b `in_progress` when the first Stage 3b round starts.
92
- - Append brief per-round summaries into the Stage 3 / 3a / 3b task descriptions.
93
- - Only mark Stage 3 / 3a / 3b `completed` after the review loop finishes (either `all_passed`, `no_confirmed_defects`, or `max_rounds_reached`).
122
+ - Mark Stage 3b `in_progress` when the first Stage 3b round starts.
123
+ - Append brief per-round summaries into the Stage 3 / 3b task descriptions.
124
+ - Only mark Stage 3 / 3b `completed` after the review loop finishes (either `all_passed`, `no_progress`, or `max_rounds_reached`).
94
125
 
95
126
  For the Stage 4 test loop:
96
127
  - Mark Stage 4 `in_progress` when Round 1 starts, and keep it `in_progress` until the full test loop exits.
@@ -125,10 +156,9 @@ After each **review**, **fix**, or **test** stage completes, read the correspond
125
156
 
126
157
  | Stage | Report File | What to Extract |
127
158
  |-------|-------------|-----------------|
128
- | **3 — Code Review** | `review-round-N/code-review-report.md` | From the **Overview** section, extract `Total Scenarios` and the verdict breakdown: `PASS`, `PARTIAL`, `FAIL`, `UNABLE TO VERIFY` counts. **Defects found** = count of `FAIL` + `PARTIAL` verdicts. Also note the **Overall Verdict** (`PASS` / `PASS WITH ISSUES` / `NEEDS REWORK`). Record one row per review round. |
129
- | **3a — Review Fix** | `review-round-N/review-fix-report.md` | From the **Overview** section, extract: `Total Issues in Report`, `Verified (CONFIRMED)`, `False Positives`, `Successfully Fixed`, `Failed to Fix`, `Fix Success Rate`. **Defects fixed** = `Successfully Fixed`. **Defects not fixed** = `Failed to Fix`. Use this to populate the same review round row as Stage 3. |
130
- | **4 — Self-Testing** | `round-N/self-test-report.md` | From the **测试概览** or **测试总结** section, extract: `总用例数` (total cases), `通过` (passed), `失败` (failed), `通过率` (pass rate). **Defects found** = `失败` count. Record one row per round. |
131
- | **4a — Self-Test Fix** | `round-N/self-test-fix-report.md` | From the **概览** section, extract: `报告中失败 scenario 总数` (total failed), `白盒确认问题存在` (confirmed), `白盒判定为误报` (false positives), `修复成功` (fixed), `修复失败` (failed to fix). **Defects fixed** = `修复成功`. **Defects not fixed** = `修复失败`. Use this to populate the same round row as Stage 4. |
159
+ | **3 — Code Review** | `review-round-N/code-review-report.md` | From the **Overview** section, extract `Total Scenarios`, the verdict breakdown (`PASS`, `PARTIAL`, `FAIL`, `UNABLE TO VERIFY` counts), `Total Defects Found`, `Successfully Fixed`, `Failed to Fix`, `Fix Success Rate`, and **Overall Verdict** (`PASS` / `PASS WITH ISSUES` / `NEEDS REWORK`). **Defects found** = `Total Defects Found`. **Defects fixed** = `Successfully Fixed`. **Defects not fixed** = `Failed to Fix`. Record one row per review round. |
160
+ | **4 — Self-Testing** | `round-N/self-test-report.md` | From the **测试概览** section (fall back to **测试总结**), extract: `总用例数` (total cases), `通过` (passed), `失败` (failed), and **`常规通过率`** as the pass rate — the report carries two rates and the regular-only one is the quality metric; keep `含前置通过率` as a secondary note when present. **Defects found** = `失败` count. Record one row per round. |
161
+ | **4a — Self-Test Fix** | `round-N/self-test-fix-report.md` | From the **概览** section, extract: `报告中失败 scenario 总数` (total failed), `白盒确认问题存在` (confirmed), `白盒判定为误报` (false positives), `修复成功` (fixed), `修复失败(2次尝试后)` (failed to fix). **Defects fixed** = `修复成功`. **Defects not fixed** = `修复失败(2次尝试后)`. Use this to populate the same round row as Stage 4. |
132
162
 
133
163
  ### How to extract
134
164
 
@@ -143,25 +173,53 @@ In `OUTPUT/pipeline-manifest.md`, include a **Defect Summary** table after the D
143
173
 
144
174
  | Stage | Report File | Defects Found | Defects Fixed | Not Fixed | Details |
145
175
  |-------|-------------|---------------|---------------|-----------|---------|
146
- | 3 Loop - Round 1 | review-round-1/code-review-report.md + review-round-1/review-fix-report.md | X (Y FAIL + Z PARTIAL) | D fixed | E not fixed | Overall: PASS WITH ISSUES; confirmed=B; false positives=C; rebuild=SUCCESS |
147
- | 3 Loop - Round 2 | review-round-2/code-review-report.md + review-round-2/review-fix-report.md | X (Y FAIL + Z PARTIAL) | D fixed | E not fixed | Overall: PASS; stop=all_passed |
148
- | 3 Loop - Summary | review-round-*/... | Total found across rounds | Total fixed across rounds | Remaining in final round | Rounds executed: N / MAX_ROUNDS_REVIEW; stop reason: all_passed/no_confirmed_defects/max_rounds_reached |
176
+ | 3 Loop - Round 1 | review-round-1/code-review-report.md | X (Y FAIL + Z PARTIAL) | D fixed | E not fixed | Overall: PASS WITH ISSUES; rebuild=SUCCESS |
177
+ | 3 Loop - Round 2 | review-round-2/code-review-report.md | 0 | — | — | Overall: PASS; stop=all_passed; 3b skipped — round passed |
178
+ | 3 Loop - Summary | review-round-*/... | Total found across rounds | Total fixed across rounds | Remaining in final round | Rounds executed: N / MAX_ROUNDS_REVIEW; stop reason: all_passed/no_progress/max_rounds_reached |
149
179
  | 4 Loop - Round 1 | round-1/self-test-report.md + round-1/self-test-fix-report.md | X failed / Y total | C | D | Pass rate: ZZ%; confirmed=B; false positives=F; rebuild=SUCCESS |
150
- | 4 Loop - Round 2 | round-2/self-test-report.md + round-2/self-test-fix-report.md | X failed / Y total | C | D | Pass rate: ZZ%; confirmed=B; false positives=F; rebuild=SUCCESS; stop=all_passed |
151
- | 4 Loop - Summary | round-*/... | Total found across rounds | Total fixed across rounds | Remaining in final round | Rounds executed: N / MAX_ROUNDS_TEST; stop reason: all_passed/max_rounds_reached |
180
+ | 4 Loop - Round 2 | round-2/self-test-report.md + round-2/self-test-fix-report.md | 0 failed / Y total | — | — | Pass rate: ZZ%; confirmed=0; false positives=0; rebuild=SUCCESS; stop=all_passed; 4a/4b skipped — round passed |
181
+ | 4 Loop - Summary | round-*/... | Total found across rounds | Total fixed across rounds | Remaining in final round | Rounds executed: N / MAX_ROUNDS_TEST; stop reason: all_passed/no_confirmed_defects/max_rounds_reached |
152
182
  ```
153
183
 
154
184
  For stages that are not review/fix/test (Stages 1–2), no row is needed in this table.
155
- For the Stage 3 loop, combine review and fix results into one row per round plus one summary row.
185
+ For the Stage 3 loop, `code-reviewer` reviews and fixes in the same pass, so one row per round captures both.
156
186
  For the Stage 4 loop, combine test and fix results into one row per round plus one summary row.
157
187
 
158
188
  ---
159
189
 
160
190
  ## Pipeline Execution
161
191
 
192
+ ### Package-Set Collection (shared procedure)
193
+
194
+ Several stages below need the **full signed package set** — the entry HAP plus any in-app HSPs (and any feature HAP the build freshly produced) — so the skill installs them in one `hdc install -r` transaction (in-app HSPs cannot install standalone). Those stages call this procedure.
195
+
196
+ **Inputs:**
197
+ - `BUILD_ROOT` — the project root rebuilt by `hmos-fix-build-errors` (= `HMOS`).
198
+ - `DEST` — a dedicated `package-set/` directory to populate; **must never be the directory where you mirror the authoritative entry HAP** (step 1 clears `DEST`).
199
+ - `BUILD_START` — a marker captured **immediately before** invoking the build stage, e.g. `touch "<DEST>/../.build_start_marker"` (or record a timestamp). Used to tell freshly-rebuilt artifacts from stale ones. A touched marker + `find -newer` avoids clock-skew between the build stage and the host.
200
+ - `AUTHORITATIVE_ENTRY` — the authoritative signed entry HAP resolved directly from `HMOS/entry/build/default/outputs/default/` after `hmos-fix-build-errors` succeeds. Once resolved for the stage, treat it as authoritative regardless of mtime.
201
+
202
+ **Procedure:**
203
+ 1. **Clear/create `DEST`** (remove prior contents, recreate) so stale packages never leak forward. `DEST` is a dedicated `package-set/` subdir, distinct from the location where you mirror the authoritative entry for this stage.
204
+ 2. **Place the authoritative entry:** copy `AUTHORITATIVE_ENTRY` into `DEST`. Included **unconditionally — the mtime gate does NOT apply to the entry** (an incremental build may leave the build-tree entry UP-TO-DATE, but the resolved entry HAP still reflects the current build result).
205
+ 3. **Discover non-entry outputs** under depth-1 modules `BUILD_ROOT/*/build/default/outputs/default/`, admitting **only files with mtime ≥ `BUILD_START`** (freshly rebuilt this invocation; cross-platform: `find "<dir>" -newer "<marker>"` or compare `stat` mtimes). Incremental rebuilds run **no clean**, so non-entry dirs still hold *prior*-build packages — the mtime gate is the only reliable way to reject those stale artifacts:
206
+ - **HSPs:** `*-signed.hsp` (the fresh in-app HSPs).
207
+ - **Feature HAPs:** `*-signed.hap` from non-entry modules the build freshly rebuilt; skip any whose basename equals `AUTHORITATIVE_ENTRY`'s.
208
+ 4. **Exclude test artifacts:** skip `*ohosTest*` and `*-test-signed.*`.
209
+ 5. **Unsigned-HSP rule (all-or-nothing):** if any module dir has a **freshly-rebuilt** `*.hsp` but **no** fresh `*-signed.hsp`, mark the collection **incomplete** → the caller falls back to the entry-only / legacy set and logs the unsigned HSP as a build-config gap. (A *stale* unsigned `.hsp` is ignored — it never passes the mtime gate.) Rationale: all packages install in one transaction; a single unsigned package fails the whole `hdc install -r`, so the entry would never install — strictly worse than today. A *partial* set is also unsafe.
210
+ 6. **Copy** the selected non-entry files into `DEST` (flat). (The entry is already there from step 2.)
211
+ 7. **Invariants:**
212
+ - **≥ 1 `.hap`** — guaranteed by step 2. If `AUTHORITATIVE_ENTRY` is missing, collection **fails** → caller fallback.
213
+ - **Exactly one `entry-*.hap`** (the authoritative one). If the fresh harvest still yields a second, differently-named `entry-*.hap`, **fail** the collection and log the conflict (the skill picks `entry-*` first and cannot disambiguate two entries). Non-`entry-*` feature HAPs may be many.
214
+ - On a same-basename collision in `DEST`, abort with a logged error listing sources.
215
+ - Manifest inventory line: `package-set: 1 entry hap + F feature hap(s) + M signed hsp(s) → DEST` (and `WARNING: K unsigned .hsp skipped — build-config gap` if any).
216
+ 8. **Result:** the caller sets `CURRENT_HAP = DEST`.
217
+
218
+ > **Build-completeness caveat.** Whether `assembleHap -p module=entry` freshly emits a signed `.hsp` depends on hvigor's transitive-build behavior; if nothing fresh is emitted this procedure collects **entry-only** and equals today — never worse. Independent feature modules (off entry's dependency path) are never rebuilt by `-p module=entry`; harvesting their HAPs needs a build change (out of scope).
219
+
162
220
  ### Stage 1 — Logic Development (Context Builder)
163
221
 
164
- Flags: `skip-plan-builder: true|false` (default `false`) — when `true`, skip this stage and reuse an existing `OUTPUT/logic/plan.md`.
222
+ Flags: `skip-plan-builder: true|false` (default `false`) — an internal flag, not accepted as a pipeline argument; when `true`, skip this stage and reuse an existing `OUTPUT/logic/plan.md`.
165
223
 
166
224
  Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines below. No natural language, step lists, or Markdown.
167
225
 
@@ -169,7 +227,7 @@ Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines b
169
227
  ```
170
228
  Agent(
171
229
  subagent_type="logic-context-builder",
172
- prompt="harmony_project_dir: HMOS\nspec_file: SPEC\noutput_path: OUTPUT/logic"
230
+ prompt="harmony_project_dir: HMOS\nspec_file: SPEC\noutput_path: OUTPUT/logic\nscripts_path: SCRIPTS_PATH"
173
231
  )
174
232
  ```
175
233
  2. Verify `OUTPUT/logic/plan.md` exists.
@@ -180,87 +238,77 @@ Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines b
180
238
  ```
181
239
  Agent(
182
240
  subagent_type="logic-coder",
183
- prompt="harmony_project_dir: HMOS\nplan_file: OUTPUT/logic/plan.md\noutput_path: OUTPUT/logic"
241
+ prompt="harmony_project_dir: HMOS\nplan_file: OUTPUT/logic/plan.md\noutput_path: OUTPUT/logic\nscripts_path: SCRIPTS_PATH"
184
242
  )
185
243
  ```
186
- 2. Copy `OUTPUT/logic/commit-info.md` → `OUTPUT/commit-info.md` and verify it contains a hex `commit_id`.
187
- 3. `OUTPUT/logic/coding-summary.md` is human-readable auxiliary; downstream stages consume only `OUTPUT/commit-info.md`.
244
+ 2. Copy `OUTPUT/logic/commit-info.md` → `OUTPUT/commit-info.md`.
245
+ 3. Read `OUTPUT/commit-info.md` and use it as the canonical handoff for the
246
+ following steps.
188
247
 
189
248
  ### Stage 2 — Compilation and Build
190
249
 
191
- 1. Launch the **build-fixer** agent with `--signed`.
192
- 2. Input: `harmony_project_dir`: `HMOS`, `output_path`: `OUTPUT`.
193
- 3. The agent runs the build-fix loop (up to 20 iterations), writes `build-fix-report.md` into `OUTPUT`.
194
- 4. If the build succeeds, the signed `.hap` is copied to `OUTPUT`. Note its location in the manifest.
195
- 5. After the agent completes, read `OUTPUT/build-fix-commit-info.md` and note the commit ID (may be a real hash or `none`).
250
+ 1. Capture `BUILD_START` (touch a marker) — the package-set mtime gate needs a marker taken before any build output is written.
251
+ 2. Invoke `hmos-fix-build-errors <HMOS>`.
252
+ 3. Treat the build stage as a compile/fix gate only — do **not** expect build-stage report or commit-info artifacts.
253
+ 4. After a successful build, resolve `AUTHORITATIVE_ENTRY` directly from `HMOS/entry/build/default/outputs/default/` (resolve in order: `entry-default-signed.hap` → any `*-signed.hap` → `entry-default-unsigned.hap` → any `entry-*.hap`) and note it in the manifest, recording whether it is signed.
254
+ 4.1. **Signing check for Stage 4** — if `AUTHORITATIVE_ENTRY` is **unsigned** and `SKIP_TEST == false`, log a manifest **WARNING**: `Stage 2 produced an unsigned entry HAP — on-device install in Stage 4 requires a signed package; configure signing in DevEco Studio (File → Project Structure → Signing Configs) or pass skip_test=true`. Continue the pipeline; Stage 4 Loop Setup will surface the missing package on its own.
255
+ 5. **If the build succeeded**, run **Package-Set Collection** with `BUILD_ROOT = HMOS`, `DEST = OUTPUT/package-set/`, the resolved `AUTHORITATIVE_ENTRY`, and the captured `BUILD_START`. Record the inventory in the manifest. (If the build failed there is no fresh entry to collect; collection's ≥1-`.hap` guard fails and Stage 4 Loop Setup's legacy fallback applies.)
256
+ 6. Do not read a build-stage commit-info file; `OUTPUT/commit-info.md` from Stage 1a remains the canonical commit handoff for later review stages.
196
257
 
197
- ### Stage 3 — Code Review Loop (Review → Fix → Rebuild)
258
+ ### Stage 3 — Code Review Loop (Review-and-Fix → Rebuild)
198
259
 
199
- Treat Stage 3 → 3a → 3b as a loop that runs up to `MAX_ROUNDS_REVIEW` times.
260
+ Treat Stage 3 → 3b as a loop that runs up to `MAX_ROUNDS_REVIEW` times. `code-reviewer` performs review and defect fixing in the same pass (no separate `review-fixer` agent).
200
261
 
201
262
  #### Review Loop Setup
202
263
 
203
264
  1. **Resolve the initial commit ID for code review** using the following priority:
204
- - Read `OUTPUT/commit-info.md` (written by Stage 1). If `commit_id` is a real hash, use it.
205
- - IMPORTANT: Use `commit-info.md` from Stage 1, NOT `build-fix-commit-info.md` from Stage 2. The first review must target the logic-dev commit, not the build-fix commit.
206
- - If neither file exists or both have `commit_id: none`, the code-reviewer agent will review the project holistically without commit-scoped extraction.
265
+ - Read `OUTPUT/commit-info.md` (written by Stage 1a) and use its `commit_id` when available.
266
+ - IMPORTANT: Use `commit-info.md` from Stage 1a. The build stage no longer produces a separate commit-info artifact.
207
267
  - Store this as `REVIEW_COMMIT_ID`.
208
268
  2. Initialize loop state:
209
269
  - `review_round = 1`
210
270
  - `review_rounds_executed = 0`
211
271
  - `review_stop_reason = none`
212
- 3. Mark Stage 3 `in_progress` when Round 1 begins. Keep Stage 3 / 3a / 3b tasks open until the full loop exits.
272
+ - `LAST_GOOD_REVIEW_SET = none` — the package-set dir from the **last review round whose 3b rebuild succeeded** (used at finalization; stays `none` if no review round ever rebuilt).
273
+ 3. Mark Stage 3 `in_progress` when Round 1 begins. Keep Stage 3 / 3b tasks open until the full loop exits.
213
274
 
214
- #### Per-Round Stage 3 / 3a / 3b Execution Order
275
+ #### Per-Round Stage 3 / 3b Execution Order
215
276
 
216
- For each `review_round` from `1..MAX_ROUNDS_REVIEW`, set `REVIEW_ROUND_DIR = OUTPUT/review-round-{review_round}` and execute the following three steps in order:
277
+ For each `review_round` from `1..MAX_ROUNDS_REVIEW`, set `REVIEW_ROUND_DIR = OUTPUT/review-round-{review_round}` and execute the following two steps in order:
217
278
 
218
- ##### Review Round Step A — Stage 3 Code Review
279
+ ##### Review Round Step A — Stage 3 Code Review + Fix
219
280
 
220
281
  1. Launch the **code-reviewer** agent.
221
282
  2. Input:
222
283
  - `harmony_project_dir`: `HMOS`
223
284
  - `commit_id`: For Round 1, use `REVIEW_COMMIT_ID`. For Round 2+, review the project holistically (omit `commit_id` or pass `none`) since fixes have modified the codebase beyond the original commit scope.
224
285
  - `output_path`: `REVIEW_ROUND_DIR`
225
- - `test_case_path`: `SPEC`
226
- 3. If a valid `commit_id` is available, the agent will automatically call the `extract_commit_context` MCP tool to extract commit-scoped code context before reviewing. If the MCP call fails, the agent falls back to direct git-diff analysis. If no `commit_id` is available, the agent reviews the project holistically without commit-scoped extraction.
227
- 4. The agent writes `REVIEW_ROUND_DIR/code-review-report.md` with per-scenario verdicts.
228
- 5. **Extract defect stats**: Read `REVIEW_ROUND_DIR/code-review-report.md`, extract the verdict breakdown (PASS/PARTIAL/FAIL/UNABLE TO VERIFY counts) and overall verdict.
229
- 6. Compute `review_all_passed`:
230
- - `true` if the overall verdict is `PASS` and there are zero `FAIL` or `PARTIAL` verdicts.
231
- - `false` otherwise.
286
+ - `scenario_doc_path`: `SPEC` (the requirement spec is the user-scenario design document; it is **not** the self-test `TEST_CASE`)
287
+ - `android_project_dir`: `ANDROID` (enables reference-based fixing for missing pages / APIs / event handlers)
288
+ 3. If a valid `commit_id` is available, the agent will automatically run the **ArkAnalysis** extractor via `npx --yes arkanalysis@latest` to extract commit-scoped code context before reviewing. If it fails (e.g. the package is unpublished or unreachable), the agent falls back to direct git-diff analysis. If no `commit_id` is available, the agent reviews the project holistically without commit-scoped extraction.
289
+ 4. The agent reviews every user scenario, fixes every FAIL / PARTIAL / cross-cutting defect it finds, and writes `REVIEW_ROUND_DIR/code-review-report.md` (merged review + fix report) plus `REVIEW_ROUND_DIR/code-review-commit-info.md` (git commit id or `none`).
290
+ 5. **Extract defect stats**: Read `REVIEW_ROUND_DIR/code-review-report.md`, extract the verdict breakdown (PASS/PARTIAL/FAIL/UNABLE TO VERIFY counts), `Total Defects Found`, `Successfully Fixed`, `Failed to Fix`, `Fix Success Rate`, and Overall Verdict.
291
+ 6. Compute loop-control flags:
292
+ - `review_all_passed` = `true` if the overall verdict is `PASS` and there are zero `FAIL` or `PARTIAL` verdicts AND zero cross-cutting defects; else `false`.
293
+ - `review_no_progress` = `true` if `Total Defects Found > 0` AND `Successfully Fixed == 0` (nothing was fixed this round — a next round would repeat); else `false`.
232
294
  If the report is missing or malformed, do **not** treat the round as passed.
233
- 7. If `review_all_passed == true`, set `review_stop_reason = all_passed`, skip Stage 3a and 3b for this round, and exit the loop.
234
- 8. Update the Stage 3 task description with a brief round summary (for example: `Round 1: 8 PASS, 2 PARTIAL, 1 FAIL`).
235
-
236
- ##### Review Round Step B — Stage 3a Review Fix
295
+ 7. **Early exit on a green round**: if `review_all_passed == true`, set `review_stop_reason = all_passed`, increment `review_rounds_executed`, **skip Step B**, and exit the loop. Do Step B's bookkeeping here before leaving:
296
+ - Append the `3 Loop - Round {review_round}` Defect Summary row from the Stage 3 stats alone (`Defects Found = 0`; fix columns `—`, note `3b skipped — round passed`).
297
+ - Mark Stage 3b `completed` with `Skipped — round {review_round} passed, no fixes needed`, and record `Duration = SKIPPED`.
298
+ 8. If `review_no_progress == true`, set `review_stop_reason = no_progress`, still run Stage 3b (to leave the tree buildable), then exit the loop after 3b.
299
+ 9. Update the Stage 3 task description with a brief round summary (for example: `Round 1: 8 PASS, 2 PARTIAL, 1 FAIL; fixed=2, failed=1`).
237
300
 
238
- 1. Mark Stage 3a `in_progress` when the first Stage 3a round begins.
239
- 2. Launch the **review-fixer** agent.
240
- 3. Input:
241
- - `review_report_path`: `REVIEW_ROUND_DIR/code-review-report.md`
242
- - `harmony_project_dir`: `HMOS`
243
- - `android_project_dir`: `ANDROID`
244
- - `output_path`: `REVIEW_ROUND_DIR`
245
- 4. The agent verifies each issue from the code review report, fixes confirmed issues, and writes `REVIEW_ROUND_DIR/review-fix-report.md`.
246
- 5. **Extract defect stats**: Read `REVIEW_ROUND_DIR/review-fix-report.md`, extract total issues, confirmed, false positives, successfully fixed, failed to fix, and fix success rate.
247
- 6. Compute `review_no_confirmed_defects`:
248
- - `true` if the fix report exists AND confirmed issues == 0 (all reported issues are false positives).
249
- - `false` otherwise.
250
- 7. Update the Stage 3a task description with a brief round summary (for example: `Round 1: confirmed=3, fixed=2, failed=1`).
251
-
252
- ##### Review Round Step C — Stage 3b Rebuild after Review Fix
301
+ ##### Review Round Step B — Stage 3b Rebuild after Review Fix
253
302
 
254
303
  1. Mark Stage 3b `in_progress` when the first Stage 3b round begins.
255
- 2. Launch the **build-fixer** agent with `--signed`.
256
- 3. Input: `harmony_project_dir`: `HMOS`, `output_path`: `REVIEW_ROUND_DIR`.
257
- 4. The agent writes `REVIEW_ROUND_DIR/build-fix-report.md`.
258
- 5. If the build succeeds, the signed `.hap` is copied to `REVIEW_ROUND_DIR`. Note its location in the manifest.
259
- 6. Append one Defect Summary row for this round by combining the parsed Stage 3 and Stage 3a results into a single row labeled `3 Loop - Round {review_round}`.
260
- 7. Update the Stage 3b task description with a brief round summary (for example: `Round 1: build success`).
261
- 8. Increment `review_rounds_executed`.
262
- 9. **Loop stop decision** (after 3b completes):
263
- - If `review_no_confirmed_defects == true`, set `review_stop_reason = no_confirmed_defects` and exit the loop. Rationale: all reported issues were judged as false positives by verification, no real defects remain.
304
+ 2. Capture `BUILD_START` (touch a marker), then invoke `hmos-fix-build-errors <HMOS>` (the skill detects signed vs unsigned from `build-profile.json5`; the pipeline does not force a mode).
305
+ 3. Treat this as a compile/fix gate only — do **not** expect a rebuild report artifact in `REVIEW_ROUND_DIR`.
306
+ 4. If the build succeeds, resolve `AUTHORITATIVE_ENTRY` directly from `HMOS/entry/build/default/outputs/default/` (resolve in order: `entry-default-signed.hap` → any `*-signed.hap` → `entry-default-unsigned.hap` → any `entry-*.hap`), note it in the manifest, and **then run Package-Set Collection** with `BUILD_ROOT = HMOS`, `DEST = REVIEW_ROUND_DIR/package-set/`, the resolved `AUTHORITATIVE_ENTRY`, and the captured `BUILD_START`; on success set `LAST_GOOD_REVIEW_SET = REVIEW_ROUND_DIR/package-set/`. **If the 3b build failed, do NOT run collection and keep the previous `LAST_GOOD_REVIEW_SET`** (a failed rebuild leaves stale sibling-module outputs on disk; the mtime gate already prevents harvesting them, and skipping collection avoids re-touching `LAST_GOOD_REVIEW_SET` with an entry-less set).
307
+ 5. Append one Defect Summary row for this round using the parsed Stage 3 stats, labeled `3 Loop - Round {review_round}`.
308
+ 6. Update the Stage 3b task description with a brief round summary (for example: `Round 1: build success`).
309
+ 7. Increment `review_rounds_executed`.
310
+ 8. **Loop stop decision** (after 3b completes):
311
+ - If `review_stop_reason` was already set to `no_progress` in Step A, exit the loop.
264
312
  - Else if `review_round == MAX_ROUNDS_REVIEW`, set `review_stop_reason = max_rounds_reached` and exit the loop.
265
313
  - Else continue to the next round.
266
314
 
@@ -272,22 +320,18 @@ After the review loop exits:
272
320
  2. Add a short review loop summary in the manifest, including:
273
321
  - `Configured max rounds: MAX_ROUNDS_REVIEW`
274
322
  - `Rounds executed: review_rounds_executed`
275
- - `Stop reason: review_stop_reason` — one of: `all_passed` (all scenarios PASS in code review), `no_confirmed_defects` (reported issues all false positives), `max_rounds_reached` (hit the round limit with real defects remaining)
323
+ - `Stop reason: review_stop_reason` — one of: `all_passed` (all scenarios PASS in code review), `no_progress` (defects found but none could be fixed this round), `max_rounds_reached` (hit the round limit with real defects remaining)
276
324
  - `Final round: review-round-{review_rounds_executed}`
277
325
  3. Mirror the final review round outputs back to the root `OUTPUT` directory using the canonical filenames for backward compatibility:
278
326
  - `OUTPUT/code-review-report.md`
279
- - `OUTPUT/review-fix-report.md` (if 3a ran in the final round)
280
- - `OUTPUT/build-fix-report.md` (overwrites Stage 2 report, if 3b ran in the final round)
327
+ - `OUTPUT/code-review-commit-info.md`
281
328
  - If the final round's build produced a signed `.hap`, copy it to `OUTPUT` (replaces Stage 2 `.hap` if present).
282
- 4. Mark Stage 3 / 3a / 3b `completed` only after the full loop finishes.
283
-
284
- ### Stage 3a — Review Fix
285
-
286
- Stage 3a is executed as **Review Round Step B** inside the Stage 3 loop above. Do not run Stage 3a outside that loop.
329
+ - **Mirror the package set:** if `LAST_GOOD_REVIEW_SET != none` (some review round rebuilt successfully), clear-then-copy `LAST_GOOD_REVIEW_SET` → `OUTPUT/package-set/`. **If `LAST_GOOD_REVIEW_SET == none`, leave `OUTPUT/package-set/` (the Stage-2 set) untouched — never clear it.** No self-copy guard is needed: `LAST_GOOD_REVIEW_SET` is always a `review-round-*/package-set/`, never `OUTPUT/package-set/`.
330
+ 4. Mark Stage 3 / 3b `completed` only after the full loop finishes.
287
331
 
288
332
  ### Stage 3b — Rebuild after Review Fix
289
333
 
290
- Stage 3b is executed as **Review Round Step C** inside the Stage 3 loop above. Do not run Stage 3b outside that loop.
334
+ Stage 3b is executed as **Review Round Step B** inside the Stage 3 loop above. Do not run Stage 3b outside that loop.
291
335
 
292
336
  ### Stage 4 — Self-Testing Loop (On-Device Verification)
293
337
 
@@ -297,8 +341,15 @@ Treat Stage 4 → 4a → 4b as a loop that runs up to `MAX_ROUNDS_TEST` times.
297
341
 
298
342
  #### Loop Setup
299
343
 
300
- 1. **Locate the initial HAP file**: Use the `.hap` mirrored to `OUTPUT/` by the Stage 3 review loop finalization (or from Stage 2 if the review loop did not produce one). The default location is `OUTPUT/entry-default-signed.hap`. If that file does not exist, search for `*-signed.hap` files in `OUTPUT/` and use the first match. If no `.hap` is found in `OUTPUT/`, fall back to searching `HMOS/entry/build/default/outputs/default/`.
301
- 2. Store the resolved path as `CURRENT_HAP`.
344
+ 1. **Resolve the initial package set**: The skill needs the **complete signed package set** (entry HAP + any in-app HSPs) in one `hdc install -r` transaction (rationale in **Package-Set Collection** above).
345
+ - **Priority 1 — `OUTPUT/package-set/` directory**: If it exists and contains **≥ 1 `.hap`**, set `CURRENT_HAP = OUTPUT/package-set/` (any `.hsp` present comes along; `.hsp` presence is **not** required — a single-module project yields exactly one entry HAP and must still take this branch) (the set mirrored by Stage 2 or, if a review round rebuilt, by the review-loop finalization).
346
+ - **Priority 2 — Comma-separated assembly**: If `OUTPUT/package-set/` does not exist, find the entry HAP and any HSPs separately and assemble a comma-separated `CURRENT_HAP`:
347
+ - Entry HAP: `OUTPUT/entry-default-signed.hap` → first `*-signed.hap` in `OUTPUT/` → search `HMOS/entry/build/default/outputs/default/`.
348
+ - In-app HSPs: search `HMOS/*/build/default/outputs/default/` for `*-signed.hsp` (skip `*ohosTest*` / `*-test-signed*`). If found, copy them into `OUTPUT/hsp/` and include `OUTPUT/hsp/` in the comma-separated list.
349
+ - Example: `CURRENT_HAP = OUTPUT/entry-default-signed.hap,OUTPUT/hsp` (entry HAP file + HSP directory, comma-separated).
350
+ - **Priority 3 — Legacy single file**: If no HSPs are found anywhere (single-module project), set `CURRENT_HAP` to just the entry HAP file path.
351
+ - Log the resolved `CURRENT_HAP` in the manifest. If HSPs were found and included, note: "Package set includes N in-app HSP(s)". If HSPs were found but omitted (legacy fallback), log a **WARNING**: "In-app HSPs exist but were not included in CURRENT_HAP — app may not function on device".
352
+ 2. Store the resolved path (a **directory**, a **comma-separated list**, or a single file) as `CURRENT_HAP`.
302
353
  3. **`TEST_CASE` existence guard**: If `TEST_CASE` does not exist, mark Stage 4 / 4a / 4b as failed with note "No test case file available" and skip the loop entirely.
303
354
  4. Initialize loop state:
304
355
  - `round = 1`
@@ -312,38 +363,47 @@ For each `round` from `1..MAX_ROUNDS_TEST`, set `ROUND_DIR = OUTPUT/round-{round
312
363
 
313
364
  ##### Round Step A — Stage 4 Self-Testing
314
365
 
315
- > ⚠️ **`CURRENT_HAP` must reflect the latest build**: If a previous round's Stage 4b produced a new signed HAP, `CURRENT_HAP` should already point to that HAP (e.g., `round-{N-1}/entry-default-signed.hap`). Do NOT reuse the original HAP from Stage 2/3b in subsequent rounds.
366
+ > ⚠️ **`CURRENT_HAP` must reflect the latest build**: If a previous round's Stage 4b produced a new signed package set, `CURRENT_HAP` should already point to it (a directory, e.g. `round-{N-1}/package-set/`; or, via the legacy fallback, a single file like `round-{N-1}/entry-default-signed.hap`). Do NOT reuse the original package from Stage 2/3b in subsequent rounds.
316
367
 
317
368
  1. If `CURRENT_HAP` is missing, do **not** launch the test. Record this round as Stage 4 failure with note "No HAP file available — build may have failed in Stage 2/3b or a previous 4b round".
318
- 2. If `CURRENT_HAP` exists, launch the **self-tester**.
369
+ 2. If `CURRENT_HAP` exists, launch the **self-tester** subagent (a thin wrapper that loads the `hmos-integration-test` skill — used for context isolation on the long test run).
319
370
  3. Input (round 1):
320
- - `hap_path`: `CURRENT_HAP`
321
- - `output_path`: `OUTPUT` (the ROOT — the agent always writes here)
322
- - `test_case_path`: `TEST_CASE`
323
- - `pre_test_case_path`: `PRE_TEST_CASE` (only include this line when the file exists)
324
- - `setup`: `true`
371
+ - `hap-path`: `CURRENT_HAP`
372
+ - `output-path`: `OUTPUT` (the ROOT — the skill always writes here)
373
+ - `project-dir`: `HMOS` (the HarmonyOS project root containing `AppScope/app.json5` — the skill resolves `bundle_name`/`app_name` from it via the resolve-metadata tool)
374
+ - `test-case-path`: `TEST_CASE`
375
+ - `pre-test-case-path`: `PRE_TEST_CASE` (only include this line when the file exists)
325
376
  4. Input (round 2+):
326
- - `hap_path`: `CURRENT_HAP`
327
- - `output_path`: `OUTPUT` (still the ROOT)
328
- - `setup`: `false`
329
- 5. The agent verifies device connectivity, invokes `self_test_runner.py run` to set up the environment (`uv sync`), install the HAP, and run test cases. **Pre-cases are folded into `OUTPUT/testcases.json` by the agent's S4/S5 step during round 1's `setup: true` invocation; they run first in the same batch — no separate pre-case file or parameter is needed downstream.** The agent writes `OUTPUT/self-test-report.md`, `OUTPUT/task/`, and (round 1 only) `OUTPUT/testcases.json` + `OUTPUT/app-metadata.json` + `OUTPUT/_extracted.json`.
330
- 6. After round 1's agent returns, read `OUTPUT/app-metadata.json` and extract `project_root` → `PROJECT_ROOT`. For round 2+, re-read `OUTPUT/app-metadata.json` before invoking the agent; if the previous round's `OUTPUT/round-{round-1}/app-metadata.json` exists (build-fixer may have written one for a relocated project root), the round-dir copy overrides the root copy for this round.
377
+ - `hap-path`: `CURRENT_HAP`
378
+ - `output-path`: `OUTPUT` (still the ROOT)
379
+ - (round 2+ reuses `OUTPUT/testcases.json` + `OUTPUT/app-metadata.json` written by round 1 — no `setup` flag needed; the skill skips the parse/generate phase in round 2+ per its own procedure, reusing the two JSONs from round 1)
380
+ 5. The skill verifies device connectivity, runs `self-test-runner.ts` to install the HAP and execute test cases. **Pre-cases are folded into `OUTPUT/testcases.json` by the skill's parse+generate step during round 1; they run first in the same batch — no separate pre-case file or parameter is needed downstream.** The skill writes `OUTPUT/self-test-report.md`, `OUTPUT/task/`, and (round 1 only) `OUTPUT/testcases.json` + `OUTPUT/app-metadata.json` + `OUTPUT/_extracted.json`.
381
+ 6. After the agent returns, read `OUTPUT/app-metadata.json` and extract `project_root` → `PROJECT_ROOT`; **Stage 4a passes it as `harmony_project_dir`**. If the file is missing or carries no usable `project_root`, set `PROJECT_ROOT = HMOS` and note the fallback in the manifest. `app-metadata.json` is written once by round 1 and read in place by later rounds — it is never snapshotted into a round directory, so do not look for a round-dir copy.
331
382
  7. Snapshot per-round artifacts to `ROUND_DIR` after the agent returns: copy `OUTPUT/self-test-report.md` → `ROUND_DIR/self-test-report.md`, `OUTPUT/task/` → `ROUND_DIR/task/`, and (round 1 only) `OUTPUT/_extracted.json` → `ROUND_DIR/_extracted.json`. Skip any source that is missing.
332
383
  8. Read `ROUND_DIR/self-test-report.md` and extract total cases, passed, failed, and pass rate when the report exists.
333
- 9. Compute `round_all_passed` only when the report can be parsed clearly and:
334
- - `总用例数` is known
335
- - `失败 == 0`
336
- - `通过 == 总用例数`
337
- If the report is missing or fields are malformed, do **not** treat the round as passed.
338
- 10. Update the Stage 4 task description with a brief round summary (for example: `Round 1: 3/12 failed`).
384
+ 9. **Sentinel early exit (environmental failure)**: before treating the round as a normal failure, check for the skill's early-exit conditions (per the integration-test skill's sentinel semantics, 2A.1 — device / config / tooling failures, not application defects, so the fixer cannot address them). If any of the following holds, record this round as an **environmental failure** — update the Stage 4 task description with the failure and (when captured) `early_exit_reason`, append the `4 Loop - Round {round}` Defect Summary row with note `environmental failure — 4a/4b skipped`, increment `rounds_executed`, set the matching `stop_reason`, mark Stage 4a and Stage 4b `completed` with `Skipped — environmental failure ({stop_reason})` and `Duration = SKIPPED`, then **skip Step B and Step C** and go straight to Loop Finalization:
385
+ - **No test cases (file-level check)**: `<output-path>/testcases.json` exists and contains 0 cases (the batch launcher returns early without writing `summary.json` when there are 0 cases — nothing to run) → `stop_reason = no_testcases`. (If `testcases.json` does not exist, the agent failed before S4 and is caught by the report-missing or `status: FAIL` branches below.)
386
+ - **Report missing**: `<output-path>/self-test-report.md` does not exist (e.g. T8 failure or a hard error not covered by the sentinel set) → `stop_reason = agent_early_exit`, `early_exit_reason = "no self-test-report.md written — skill failed before producing a report"`.
387
+ - **Report sentinel `status: FAIL`**: grep the report for the first `status:` line and the first `reason:` line; if the first line matches `status: FAIL` (device not connected, `HOMETRANS_MODEL_API_KEY` / `HOMETRANS_MODEL_API_KEY env var` not configured, AutoTest directory missing, or the batch launcher crashed) → `stop_reason = agent_early_exit`; capture the `reason:` line into the manifest as `early_exit_reason`.
388
+ 10. Compute `round_all_passed` only when the report can be parsed clearly and:
389
+ - `总用例数` is known
390
+ - `失败 == 0`
391
+ - `通过 == 总用例数`
392
+ If the report is missing or fields are malformed, do **not** treat the round as passed.
393
+ 11. Update the Stage 4 task description with a brief round summary (for example: `Round 1: 3/12 failed`).
394
+ 12. **Early exit on a green round**: if `round_all_passed == true`, set `stop_reason = all_passed`, increment `rounds_executed`, **skip Step B and Step C**, and exit the loop. `CURRENT_HAP` already points at the package that just passed on device. Do Steps B/C's bookkeeping here before leaving:
395
+ - Append the `4 Loop - Round {round}` Defect Summary row from the Stage 4 stats alone (`Defects Found = 0`; fix columns `—`, note `4a/4b skipped — round passed`).
396
+ - Mark Stage 4a and Stage 4b `completed` with `Skipped — round {round} passed, no fixes needed`, and record `Duration = SKIPPED` for both.
339
397
 
340
398
  ##### Round Step B — Stage 4a Self-Test Fix
341
399
 
400
+ > Reached only when `round_all_passed == false`.
401
+
342
402
  1. Mark Stage 4a `in_progress` when the first Stage 4a round begins.
343
403
  2. If `ROUND_DIR/self-test-report.md` exists, launch the **self-test-fixer** agent.
344
404
  3. Input:
345
405
  - `self_test_report_path`: `ROUND_DIR/self-test-report.md`
346
- - `harmony_project_dir`: `HMOS`
406
+ - `harmony_project_dir`: `PROJECT_ROOT` (resolved in Round Step A step 6; falls back to `HMOS`)
347
407
  - `android_project_dir`: `ANDROID`
348
408
  - `output_path`: `ROUND_DIR`
349
409
  4. The agent analyzes failed feature points from the self-test report, references Android source for correct behavior, fixes HarmonyOS code, and writes `ROUND_DIR/self-test-fix-report.md`.
@@ -357,19 +417,15 @@ For each `round` from `1..MAX_ROUNDS_TEST`, set `ROUND_DIR = OUTPUT/round-{round
357
417
  ##### Round Step C — Stage 4b Rebuild after Self-Test Fix
358
418
 
359
419
  1. Mark Stage 4b `in_progress` when the first Stage 4b round begins.
360
- 2. Launch the **build-fixer** agent with `--signed`.
361
- 3. Input: `harmony_project_dir`: `HMOS`, `output_path`: `ROUND_DIR`.
362
- 4. The agent writes `ROUND_DIR/build-fix-report.md`.
363
- 5. ⚠️ **CRITICAL — Update `CURRENT_HAP` for the next round**: If the build succeeds, the signed `.hap` is copied to `ROUND_DIR`. You **MUST** update `CURRENT_HAP` so that the next round's Stage 4 self-tester uses the newly built HAP (not the original one). Update using this priority:
364
- - `ROUND_DIR/entry-default-signed.hap`
365
- - first `ROUND_DIR/*-signed.hap`
366
- - otherwise keep the previous `CURRENT_HAP` and record that this round did not produce a fresh HAP
367
- 6. Append one Defect Summary row for this round by combining the parsed Stage 4 and Stage 4a results into a single row labeled `4 Loop - Round {round}`.
368
- 7. Update the Stage 4b task description with a brief round summary (for example: `Round 1: build success, hap=...`).
369
- 8. Increment `rounds_executed`.
370
- 9. **Loop stop decision** (after 4b completes):
371
- - If `round_all_passed == true`, set `stop_reason = all_passed` and exit the loop.
372
- - Else if `round_no_confirmed_defects == true`, set `stop_reason = no_confirmed_defects` and exit the loop. Rationale: all failures were judged as false positives (AutoTest limitations / environment issues) by white-box review, no code was changed, so repeating the test would yield identical results.
420
+ 2. Capture `BUILD_START` (touch a marker), then invoke `hmos-fix-build-errors <HMOS>` (the skill detects signed vs unsigned from `build-profile.json5`; the pipeline does not force a mode).
421
+ 3. Treat this as a compile/fix gate only — do **not** expect rebuild-stage report or commit-info artifacts in `ROUND_DIR`.
422
+ 4. ⚠️ **CRITICAL — Update `CURRENT_HAP` for the next round**: If the build succeeds, resolve `AUTHORITATIVE_ENTRY` directly from `HMOS/entry/build/default/outputs/default/` (resolve in order: `entry-default-signed.hap` → any `*-signed.hap` → `entry-default-unsigned.hap` → any `entry-*.hap`), **run Package-Set Collection** with `BUILD_ROOT = HMOS`, `DEST = ROUND_DIR/package-set/`, that resolved `AUTHORITATIVE_ENTRY`, and the captured `BUILD_START`, and then set `CURRENT_HAP = ROUND_DIR/package-set/` so the next round's Stage 4 self-test uses the freshly built set. If collection **fails** or yields zero HAPs, **keep the previous `CURRENT_HAP`** (the prior round's full set — fresher than any legacy single-file resolution) and record that this round produced no fresh package set.
423
+ 5. Append one Defect Summary row for this round by combining the parsed Stage 4 and Stage 4a results into a single row labeled `4 Loop - Round {round}`.
424
+ 6. Update the Stage 4b task description with a brief round summary (for example: `Round 1: build success, hap=...`).
425
+ 7. Increment `rounds_executed`.
426
+ 8. **Loop stop decision** (after 4b completes):
427
+ - `round_all_passed == true` never reaches here — it exits at Round Step A step 12.
428
+ - If `round_no_confirmed_defects == true`, set `stop_reason = no_confirmed_defects` and exit the loop. Rationale: all failures were judged as false positives (AutoTest limitations / environment issues) by white-box review, no code was changed, so repeating the test would yield identical results.
373
429
  - Else if `round == MAX_ROUNDS_TEST`, set `stop_reason = max_rounds_reached` and exit the loop.
374
430
  - Else continue to the next round.
375
431
 
@@ -381,14 +437,14 @@ After the loop exits:
381
437
  2. Add a short Stage 4 loop summary in the manifest, including:
382
438
  - `Configured max rounds: MAX_ROUNDS_TEST`
383
439
  - `Rounds executed: rounds_executed`
384
- - `Stop reason: stop_reason` — one of: `all_passed` (all tests green), `no_confirmed_defects` (failures exist but all judged as false positives by white-box review), `max_rounds_reached` (hit the round limit with real defects remaining)
440
+ - `Stop reason: stop_reason` — one of: `all_passed` (all tests green), `no_confirmed_defects` (failures exist but all judged as false positives by white-box review), `max_rounds_reached` (hit the round limit with real defects remaining), or an environmental early exit — `agent_early_exit` (sentinel `status: FAIL` report, or no `self-test-report.md` written), `no_testcases` (`testcases.json` contains 0 cases — nothing to run)
385
441
  - `Final round: round-{rounds_executed}`
386
- 3. Mirror the final round's `OUTPUT/round-{rounds_executed}/` Fix/Build artifacts back to `OUTPUT/` root using the canonical filenames (the test report and `task/` are already at `OUTPUT/` root as the latest copies — they do NOT need mirroring):
442
+ 3. Mirror the final round's `OUTPUT/round-{rounds_executed}/` Fix artifacts back to `OUTPUT/` root using the canonical filenames (the test report and `task/` are already at `OUTPUT/` root as the latest copies — they do NOT need mirroring):
387
443
  - `OUTPUT/self-test-fix-report.md` ← `OUTPUT/round-{rounds_executed}/self-test-fix-report.md` (if present)
388
- - `OUTPUT/build-fix-report.md` ← `OUTPUT/round-{rounds_executed}/build-fix-report.md` (if present)
389
444
  - `OUTPUT/self-test-fix-commit-info.md` ← `OUTPUT/round-{rounds_executed}/self-test-fix-commit-info.md` (if present)
390
- - `OUTPUT/build-fix-commit-info.md` ← `OUTPUT/round-{rounds_executed}/build-fix-commit-info.md` (if present)
391
- - `OUTPUT/entry-default-signed.hap` ← `CURRENT_HAP` (the final HAP, which lives under `OUTPUT/round-{rounds_executed}/`); skip when `CURRENT_HAP` is already `OUTPUT/entry-default-signed.hap`
445
+ - **Final package set** — branch on the type of `CURRENT_HAP`:
446
+ - **If `CURRENT_HAP` is a directory** (a `package-set/`): mirror `CURRENT_HAP/` → `OUTPUT/package-set/` (clear-then-copy), **but skip entirely when `CURRENT_HAP` already resolves to `OUTPUT/package-set/`** (source == dest — happens when every 4b build failed and `CURRENT_HAP` still holds the Loop-Setup value; a clear-then-copy onto itself would destroy the set). Then, best-effort, copy the single `entry-*.hap` out of the set to `OUTPUT/entry-default-*.hap` for back-compat, naming it by the actual signature status recorded in the manifest — `entry-default-signed.hap` when signed, `entry-default-unsigned.hap` when unsigned (never inferred from the filename); skip if absent.
447
+ - **If `CURRENT_HAP` is a single file** (legacy fallback — no package set was ever produced): copy it to `OUTPUT/entry-default-signed.hap` or `OUTPUT/entry-default-unsigned.hap` according to its actual signature status as recorded in the manifest (never inferred from the filename), skipping when `CURRENT_HAP` is already that destination path. Do not attempt a directory mirror.
392
448
  - `OUTPUT/screenshots/` when the final report still references `screenshots/...`
393
449
  4. When mirroring Fix/Build files back to `OUTPUT`, treat the final round directory as the source of truth and ensure the mirrored root-level reports still reference files that actually exist at the root level.
394
450
  5. Mark Stage 4 / 4a / 4b `completed` only after the full loop finishes.
@@ -406,13 +462,14 @@ Stage 4b is executed as **Round Step C** inside the Stage 4 loop above. Do not r
406
462
  ## Error Handling
407
463
 
408
464
  - If a stage **fails**, log the error in the manifest and task, then **continue to the next stage** unless the loop logic says to continue to the next round.
409
- - Stage 3 uses a bounded Stage 3 → 3a → 3b review loop (up to `MAX_ROUNDS_REVIEW` rounds). Stage 3a addresses issues found by Stage 3, followed by Stage 3b (Rebuild) to ensure compilation. The loop exits when all scenarios pass, all issues are false positives, or `MAX_ROUNDS_REVIEW` is reached.
410
- - If Stage 3a determines that all reported issues are false positives (`confirmed == 0`), the review loop exits after 3b with `review_stop_reason = no_confirmed_defects`.
411
- - Stage 4 uses a bounded Stage 4 → 4a → 4b test loop (up to `MAX_ROUNDS_TEST` rounds). Stage 4a addresses failures found by Stage 4, followed by Stage 4b (Rebuild) to ensure compilation, then the pipeline either continues to the next round or exits the loop based on `all_passed` / `no_confirmed_defects` / `max_rounds_reached`.
465
+ - Stage 3 uses a bounded Stage 3 → 3b review loop (up to `MAX_ROUNDS_REVIEW` rounds). `code-reviewer` reviews and fixes defects in the same pass; Stage 3b (Rebuild) then ensures the fixes still compile. The loop exits when all scenarios pass (`all_passed`), no defect could be fixed this round (`no_progress`), or `MAX_ROUNDS_REVIEW` is reached.
466
+ - Stage 4 uses a bounded Stage 4 → 4a → 4b test loop (up to `MAX_ROUNDS_TEST` rounds). **When a round is not green**, Stage 4a addresses the failures Stage 4 found, followed by Stage 4b (Rebuild) to ensure compilation, then the pipeline either continues to the next round or exits on `no_confirmed_defects` / `max_rounds_reached` — or an environmental sentinel early exit (`agent_early_exit` / `no_testcases`). A **green** round never reaches 4a/4b — it exits earlier with `all_passed` (see below).
412
467
  - If Stage 4a determines that all failures are false positives (`confirmed == 0`), the test loop exits after 4b with `stop_reason = no_confirmed_defects` — because no code was changed and repeating the test would yield identical results.
413
- - If a Stage 4 round fails before producing `round-N/self-test-report.md`, do not call Stage 4a with a missing report; record the round accordingly and continue to Stage 4b.
468
+ - If the root-level `OUTPUT/self-test-report.md` exists but step 7's snapshot to `ROUND_DIR/self-test-report.md` failed (a disk error or other non-sentinel cause; the sentinel case where the root report itself is missing is handled in step 9), do not call Stage 4a with a missing report; record the round accordingly and continue to Stage 4b.
414
469
  - If a Stage 4 report is malformed or required fields are missing, do not treat the round as passed; continue until `MAX_ROUNDS_TEST` is reached or a later round clearly passes.
415
- - If a Stage 4 round passes but the same round's Stage 4b rebuild fails, stop the loop after that round if `round_all_passed == true`, but record clearly that the final rebuild failed and whether the previous `CURRENT_HAP` had to be retained.
470
+ - If a Stage 4 round exits early on an environmental sentinel (`status: FAIL` report, no `self-test-report.md` written, or `no_testcases`), skip Stage 4a and Stage 4b for that round and go straight to Loop Finalization — no code was changed, so there is nothing to fix or rebuild, and repeating the test would fail identically.
471
+ - A green round never reaches Stage 4b: `round_all_passed == true` exits at **Round Step A step 12** with `stop_reason = all_passed`, skipping Steps B and C. `CURRENT_HAP` keeps pointing at the package set that just passed on device, and Loop Finalization mirrors it back to `OUTPUT/package-set/` (or skips the mirror when `CURRENT_HAP` already *is* that path). There is therefore no "the round passed but its own 4b rebuild failed" case to handle.
472
+ - If a Stage 4b rebuild fails, Round Step C step 4 leaves `CURRENT_HAP` unchanged. Record in the manifest that this round produced no fresh package set — the next round re-installs the previous package with this round's fixes **not** compiled in, so it is expected to reproduce the same failures.
416
473
 
417
474
  ---
418
475