@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
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: hmos-integration-test
3
3
  description: "Run on-device self-test for a HarmonyOS app. Parse test_case.md, install the HAP, execute AutoTest, and produce a verification report. Optionally enters a test-and-fix loop. Triggers on phrases like '跑自测', '运行自测', '执行自测', '自动测试', '设备测试', '跑用例', '跑自动化测试', 'self test', 'run autotest'."
4
4
  allowed-tools:
@@ -11,28 +11,64 @@ allowed-tools:
11
11
 
12
12
  # Self-Test Skill
13
13
 
14
- You are a **Self-Test Runner**. Your job is to invoke the `self-tester` with the correct parameters, optionally drive a test-and-fix loop (test → fix → build → retest, default up to 3 rounds, configurable via `max_rounds`), and surface results to the user. You do NOT run test tools directly — you delegate all test work to `self-tester`.
14
+ You are a **Self-Test Runner**. Your job is to orchestrate test execution directly — parse test_case.md, install the HAP, run batch tests, generate reports — and optionally drive a test-and-fix loop (test → fix → build → retest, default up to 3 rounds, configurable via `max-rounds`). You invoke the skill's `scripts/` tools directly via `node`; `self-test-runner.ts` handles HAP install/uninstall, batch execution, polling, and timeout auto-kill in a single call.
15
15
 
16
16
  ---
17
17
 
18
18
  ## Prerequisites
19
19
 
20
- The skill requires two user inputs: `test_case_path` and `hap_path`. `output_path` is optional — if omitted, it defaults to the directory containing `test_case_path`. After the initial test the skill can optionally enter a test-and-fix loop. Each round writes outputs into `<output_path>/round-{n}/` as a snapshot for history; the canonical "latest" copies live at `<output_path>/` root.
20
+ The skill requires two user inputs: `test-case-path` and `hap-path`. `project-dir` (the HarmonyOS project root containing `AppScope/app.json5` — the skill resolves `bundle_name`/`app_name` from it via the resolve-metadata tool during round 1 setup) is derived automatically when omitted: walk up from each `hap-path` entry (directory entries first, then file entries' parent dirs), then from `test-case-path`'s directory, looking for a directory containing `AppScope/app.json5`. Ask the user only if derivation finds nothing. `output-path` is optional — if omitted, it defaults to the directory containing `test-case-path`. After the initial test the skill can optionally enter a test-and-fix loop. Each round's outputs are snapshotted into `<output-path>/round-{n}/` (the skill always writes to `<output-path>/` root; round dirs are populated by the snapshot step); the canonical "latest" copies live at `<output-path>/` root.
21
21
 
22
- A signed `.hap` file is required (this is a device test — the HAP will be installed on a real HarmonyOS device). Confirm the HAP source with the user before proceeding.
22
+ A package is required (this test installs the app on a connected real HarmonyOS device or emulator). `hap-path` accepts **one or more** comma-separated paths; **each entry may be a single `.hap`/`.hsp` file or a directory**. The union of all entries must form the full package set — exactly one entry HAP plus any feature HAPs and **in-app HSPs** (Harmony Shared Packages built together with the app). In-app HSPs cannot install standalone — they depend on the main HAP — so every listed path is gathered and installed together in one `hdc install -r` transaction; the entry HAP and the HSPs **need not live in the same directory**. Confirm the package source(s) with the user before proceeding.
23
23
 
24
24
  ---
25
25
 
26
26
  ## Step 0 — Environment Variables Check (run first)
27
27
 
28
- This skill (via `self-tester`) resolves each setting along the standard chain — **OS environment variable first, then `~/.hometrans/config.json`, then ask the user**. Before parsing inputs, verify (read env vars with `echo "$VAR"` on macOS/Linux; `$env:VAR` in PowerShell on Windows):
28
+ Verify (read env vars with `$env:VAR` in PowerShell on Windows; `echo "$VAR"` on macOS/Linux):
29
+
30
+ | Variable | Purpose | Valid when |
31
+ |---|---|---|
32
+ | `HOMETRANS_MODEL_API_KEY` | LLM api key (shared with UI alignment, set by `ht init`) | non-empty |
33
+ | `HOMETRANS_MODEL_NAME` | Model name (e.g. `qwen3.7-plus`) | non-empty |
34
+ | `HOMETRANS_MODEL_BASE_URL` | Model API base URL | non-empty |
35
+ | `HOMETRANS_TOOL_PATH` | HomeTrans tools dir (default `~/.hometrans/tools`) | path exists |
36
+
37
+ If `HOMETRANS_MODEL_API_KEY` is missing or empty, **stop and ask the user** to run `ht init` first.
38
+
39
+ ### Step 0a — Generate autotest.yaml (if not exists)
40
+
41
+ If `~/.hometrans/autotest.yaml` does **not** exist, generate it from the env vars above:
42
+
43
+ ```yaml
44
+ model:
45
+ unified:
46
+ name: "<HOMETRANS_MODEL_NAME>"
47
+ base_url: "<HOMETRANS_MODEL_BASE_URL>"
48
+ api_key: "<HOMETRANS_MODEL_API_KEY>"
49
+ provider: "openai"
50
+
51
+ agent:
52
+ mode: "single"
53
+ ```
54
+
55
+ Write it to `~/.hometrans/autotest.yaml`. Then tell the user:
56
+
57
+ > autotest.yaml 已生成到 `~/.hometrans/autotest.yaml`。当前为 single 模式。如需启用 layered(Planner+Executor 双 Agent)模式,请编辑此文件添加 `execute`/`decision` 模型配置并将 `mode` 改为 `"layered"`。
58
+
59
+ If `autotest.yaml` already exists, skip generation — the user may have manually configured layered mode. Do **not** overwrite their settings.
60
+
61
+ This yaml is passed to AutoTestAgent's `batch_runner.js` via `--config` flag, read directly by `ConfigManager` — no translation layer needed.
29
62
 
30
- | Variable | config.json fallback | Purpose | Valid when |
31
- |---|---|---|---|
32
- | `HOMETRANS_MODEL_API_KEY` *(legacy `TEST_API_KEY` still honored as a fallback)* | `autotest.unified_model.api_key` | multimodal LLM key AutoTest uses to drive test cases (shared with UI alignment) | non-empty / not the placeholder |
33
- | `HOMETRANS_TOOL_PATH` | `env.HOMETRANS_TOOL_PATH` | HomeTrans tools dir (`<HOMETRANS_TOOL_PATH>/test-tools/autotest`) | path exists on disk; if unset everywhere, falls back to `~/.hometrans/tools` |
63
+ ### Step 0b — @autotest/agent 检查(自动安装)
34
64
 
35
- The runner (`self_test_runner.py`) applies this same chain at run time (env `HOMETRANS_MODEL_API_KEY` overrides `autotest.unified_model.api_key`). If **neither** the env var **nor** `autotest.unified_model.api_key` in `~/.hometrans/config.json` provides a real key, **stop and ask the user to provide it** before proceeding (suggest running `ht init` to persist it as a machine environment variable). `HOMETRANS_TOOL_PATH` may be left unset (it defaults to `~/.hometrans/tools`).
65
+ `self-test-runner.ts` 在启动 batch_runner 前会先定位 `@autotest/agent` 的 `batch_runner.js`(从脚本自身位置向上查找 node_modules,再回退到全局 npm root)。**若找不到,自动安装**:
66
+
67
+ - 先从 `@buaa_smat/hometrans` 的 `package.json` 读取它依赖的 `@autotest/agent` 版本(避免装错成 `latest` 而漏掉所需修复)。
68
+ - 执行 `npm install -g @autotest/agent@<版本>`,然后重试定位。
69
+ - 仍找不到则报错并提示手动安装:`npm install -g <autotest-agent-tarball.tgz>` 或重装 `npm install -g @buaa_smat/hometrans`。
70
+
71
+ > 因此本 skill **不需要**在 Step 0 手动校验 `@autotest/agent`——runner 自愈。仅当 runner 报"auto-install failed"时才需人工介入(典型原因:该版本未发布到 npm,需装 tarball)。
36
72
 
37
73
  ## Step 1 — Parse Inputs
38
74
 
@@ -40,12 +76,13 @@ Extract the following from the user's message. If any required input is missing,
40
76
 
41
77
  | Variable | Required | Meaning | Typical Phrasing |
42
78
  |----------|----------|---------|------------------|
43
- | `test_case_path` | yes | Path to test_case.md | "测试用例在...", "用例文件...", "test case path" |
44
- | `hap_path` | yes | Path to the signed .hap file | "HAP路径...", "安装包在...", "hap file..." |
45
- | `output_path` | no (default: directory of `test_case_path`) | Directory for all output artifacts | "输出到...", "产物目录...", "output to..." |
46
- | `pre_test_case_path` | no | Path to pre_test_case.md | "前置用例...", "pre test case..." |
47
- | `android_project_dir` | no (for fix loop) | Path to Android source project for reference-based fixing | "Android路径...", "android project..." |
48
- | `max_rounds` | no (default `3`) | Max iterations for the test-and-fix loop. Must be a positive integer (`>= 1`). Only meaningful when the fix loop is enabled. | "最多 X 轮", "max rounds X", "迭代 X 次" |
79
+ | `test-case-path` | yes | Path to test_case.md | "测试用例在...", "用例文件...", "test case path" |
80
+ | `hap-path` | yes | **One or more** comma-separated `.hap`/`.hsp` files or dirs forming the full package set (see **Prerequisites**): one entry HAP + any feature HAPs / in-app HSPs, possibly in different dirs, installed in one transaction. | "HAP路径...", "安装包在...", "包目录...", "hap和hsp在...", "hap/hsp...", "hap file..." |
81
+ | `project-dir` | no (derived from `hap-path` / `test-case-path`; ask only if derivation fails) | Path to the HarmonyOS project root (the directory containing `AppScope/app.json5`). The skill resolves `bundle_name`/`app_name` from it via the resolve-metadata tool during round 1 setup. | "工程目录...", "HarmonyOS工程...", "项目根...", "project dir..." |
82
+ | `output-path` | no (default: directory of `test-case-path`) | Directory for all output artifacts | "输出到...", "产物目录...", "output to..." |
83
+ | `pre-test-case-path` | no | Path to pre_test_case.md | "前置用例...", "pre test case..." |
84
+ | `android-project-path` | no (for fix loop) | Path to Android source project for reference-based fixing | "Android路径...", "android project..." |
85
+ | `max-rounds` | no (default `3`) | Max iterations for the test-and-fix loop. Must be a positive integer (`>= 1`). Only meaningful when the fix loop is enabled. | "最多 X 轮", "max rounds X", "迭代 X 次" |
49
86
 
50
87
  **AskUserQuestion template (use this exact shape — do NOT ad-lib free-form questions):**
51
88
 
@@ -57,11 +94,11 @@ choices:
57
94
 
58
95
  Map the user's reply back to the variable.
59
96
 
60
- **Default `output_path`**: If the user did not provide `output_path`, set it to the parent directory of `test_case_path` (the directory portion, without the filename). Use this resolved value everywhere downstream.
97
+ **Default `output-path`**: If the user did not provide `output-path`, set it to the parent directory of `test-case-path` (the directory portion, without the filename). Use this resolved value everywhere downstream.
61
98
 
62
99
  **Validation command** (platform-agnostic — adapt to OS):
63
100
 
64
- Verify that `test_case_path` and `hap_path` point to readable files and `output_path` is an existing directory (create if missing).
101
+ Verify that `test-case-path` points to a readable file; that **every** comma-separated entry in `hap-path` points to a readable file **or directory**; and that, across all entries, the aggregated package set contains **at least one `.hap`** (the entry package). `output-path` is an existing directory (create if missing).
65
102
 
66
103
  | OS | Example check |
67
104
  |----|---------------|
@@ -70,6 +107,8 @@ Verify that `test_case_path` and `hap_path` point to readable files and `output_
70
107
 
71
108
  Pick whichever shell is available — the operation, not the syntax, is what matters.
72
109
 
110
+ **HSP auto-discovery guard**: After validating `hap-path`, scan the **parent directory of the entry HAP** and any listed **directory entries** for `*.hsp` files and an `hsp/` subdirectory — this catches the common failure where only the entry HAP is passed but the app needs its in-app HSPs at runtime. For any `*.hsp` **not already covered** by `hap-path`, append its containing directory (or the individual files) to `hap-path` as extra comma-separated entries, and warn the user: "Auto-discovered N in-app HSP(s) in `<path>` and appended to hap-path — omitting them makes the app malfunction on the device." If none are found → proceed normally (single-module project).
111
+
73
112
  ---
74
113
 
75
114
  ## Step 2 — Test-and-Fix Loop
@@ -91,58 +130,101 @@ Substitute `<MAX_ROUNDS>` in the question text with the parsed value (default `3
91
130
 
92
131
  ### 2.0 — Loop Setup
93
132
 
94
- 1. Record `CURRENT_HAP = <hap_path>`.
95
- 2. Initialize `round = 1`, `MAX_ROUNDS = <max_rounds from Step 1, default 3>`. If the parsed value is missing or not a positive integer, use `3`.
96
- 3. Set `ROUND_DIR = <output_path>/round-1`. Create the directory.
97
- 4. `PROJECT_ROOT` is **unset** at this point — it will be read after round 1's agent invocation produces `<output_path>/app-metadata.json`.
98
- 5. Mark step description with round info (e.g., "**Round 1/<MAX_ROUNDS>**").
133
+ 1. Record `CURRENT_HAP = <hap-path>` (the full comma-separated list as the user gave it) and keep an immutable copy `ORIGINAL_HAP_PATH = <hap-path>`. `CURRENT_HAP` is passed verbatim as `hap-path` to the skill (package-set format: see **Prerequisites**).
134
+ 2. Initialize `round = 1`, `MAX_ROUNDS = <max-rounds from Step 1, default 3>`. If the parsed value is missing or not a positive integer, use `3`.
135
+ 3. Set `ROUND_DIR = <output-path>/round-1`. Create the directory.
136
+ 4. **Resolve `project-dir`** (if the user did not provide it): walk up from each `hap-path` entry — for directory entries, check the entry itself then each parent; for file entries, start from the file's parent — looking for a directory containing `AppScope/app.json5`. If no `hap-path` entry yields it, repeat the walk from `test-case-path`'s directory. If still nothing, use `AskUserQuestion` to get it. Store as `<project-dir>`.
137
+ 5. `PROJECT_ROOT` is **unset** at this point — it will be read after round 1's agent invocation produces `<output-path>/app-metadata.json`.
138
+ 6. Mark step description with round info (e.g., "**Round 1/<MAX_ROUNDS>**").
99
139
 
100
140
  ---
101
141
 
102
142
  ### 2A — Test (per round)
103
143
 
104
- **Round 1 invocation** — runs the parse phase plus the test phase:
144
+ The skill orchestrates everything via the tool scripts bundled in its own `scripts/` directory (NOT the legacy `$HOMETRANS_TOOL_PATH` copy). Before running any `node` command below, resolve `SKILL_SCRIPTS` to the absolute path of this skill's `scripts/` directory — for opencode that is `~/.config/opencode/skills/hmos-integration-test/scripts`. The scripts locate `@autotest/agent`'s `batch_runner.js` by walking up from their own location and falling back to the global npm root, so they run correctly whether invoked from the repo, the skill dir, or a project.
105
145
 
106
- ```
107
- Agent(
108
- subagent_type="self-tester",
109
- description="Run Device Tests (Round 1)",
110
- prompt="<assembled prompt>"
111
- )
112
- ```
146
+ The skill calls `self-test-runner.ts` to orchestrate: HAP install/uninstall + batch execution + polling. `self-test-runner.ts` automatically reads `agent.mode` from `autotest.yaml` and forwards it to `batch_runner` via `--mode` (you do not pass `--mode` yourself).
113
147
 
114
- Assemble the prompt by joining these lines with `\n`, skipping any line whose value is unset:
148
+ **Round 1 — Setup phase (parse + metadata)**:
115
149
 
116
- - `hap_path: <CURRENT_HAP>`
117
- - `output_path: <output_path>` (the ROOT — the agent always writes here)
118
- - `test_case_path: <test_case_path>`
119
- - `pre_test_case_path: <pre_test_case_path>` (only if provided / resolved)
120
- - `setup: true`
150
+ 1. **Resolve app metadata**:
151
+ ```bash
152
+ node "$SKILL_SCRIPTS/resolve-metadata-tool.ts" --project-dir "<project-dir>" --output "<output-path>/app-metadata.json"
153
+ ```
154
+ Read the JSON from stdout → store `bundle_name`, `app_name`, and `project_root` (→ `PROJECT_ROOT`).
121
155
 
122
- After the agent returns, read `<output_path>/app-metadata.json` and extract `project_root` → store as `PROJECT_ROOT`. This is the canonical source from now on.
156
+ 2. **Parse test_case.md** → `<output-path>/_extracted.json` → **Generate testcases.json**:
157
+ ```bash
158
+ node "$SKILL_SCRIPTS/testcases-tool.ts" "<output-path>/_extracted.json" "<output-path>/testcases.json" --validate
159
+ ```
123
160
 
124
- **Round 2+ invocation** — skips the parse phase and reuses the JSONs round 1 produced:
161
+ **Pre-cases** (run first in the batch): if `pre-test-case-path` was provided (or `pre_test_case.md` was auto-discovered in the same directory as `test-case-path`), parse its `### Scenario` blocks too — same `{case_name, actions, expected_results}` shape — and **prepend each pre-case to the `cases` array of `_extracted.json` with its `case_name` prefixed by `[PRE] `** (so `testcases-tool.ts` composes them into `testcases.json` and `report-tool.ts` flags them as pre-cases via the `[PRE] ` prefix). Pre-cases thus run first in the same batch; their failures are treated as environment/setup issues, not application defects.
125
162
 
126
- ```
127
- Agent(
128
- subagent_type="self-tester",
129
- description="Run Device Tests (Round {round})",
130
- prompt="hap_path: <CURRENT_HAP>\noutput_path: <output_path>\nsetup: false"
131
- )
163
+ **Round 2+ — skip setup phase**, reuse `<output-path>/testcases.json` and `<output-path>/app-metadata.json`.
164
+
165
+ **All rounds — Run self-test-runner (install + execute + poll)**:
166
+
167
+ ```bash
168
+ node "$SKILL_SCRIPTS/self-test-runner.ts" \
169
+ --testcases "<output-path>/testcases.json" \
170
+ --hap "<CURRENT_HAP>" \
171
+ --bundle-name "<bundle_name>" \
172
+ --task-dir "<output-path>/task" \
173
+ --output-dir "<output-path>" \
174
+ --category "<app_name>" \
175
+ --config ~/.hometrans/autotest.yaml \
176
+ --timeout auto
132
177
  ```
133
178
 
134
- Before each round 2+ invocation, apply the **PROJECT_ROOT refresh rule**: re-read `<output_path>/app-metadata.json` (canonical source). If the previous round's `<PREV_ROUND_DIR>/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.
179
+ > `--mode` is read automatically from `autotest.yaml`'s `agent.mode`, so do not pass it manually.
180
+
181
+ This single command handles:
182
+ - `hdc uninstall` + `hdc install -r` (HAP installation)
183
+ - Spawn `batch_runner.js` (resolved from `@autotest/agent`) as a detached background process, forwarding `--mode` read from `autotest.yaml`
184
+ - Poll every 60s for `summary.json` (COMPLETED) or process death (CRASHED)
185
+ - Auto-kill on timeout
186
+
187
+ Parse the last line of stdout as terminal status JSON. Branch on `status`:
188
+
189
+ | `status` | Action |
190
+ |-----------|--------|
191
+ | `COMPLETED` | Read `<output-path>/task/task_*/task_results.jsonl` for per-case results; proceed to generate report |
192
+ | `CRASHED` | Write error to user; stop |
193
+ | `TIMEOUT` | Write timeout to user; stop |
194
+ | `FAILED` | Write error to user; stop |
195
+
196
+ 5. **Generate report** — after COMPLETED:
197
+ ```bash
198
+ node "$SKILL_SCRIPTS/report-tool.ts" \
199
+ --task-subdir "<latest task_* subdir>" \
200
+ --app-metadata "<output-path>/app-metadata.json" \
201
+ --hap "<entry-hap-basename>" \
202
+ --device "<device-serial>" \
203
+ --suite "<suite-name>" \
204
+ --out "<output-path>/self-test-report.md" \
205
+ --validate
206
+ ```
135
207
 
136
208
  ---
137
209
 
138
210
  ### 2A.1 — Detect early-exit (sentinel) reports first
139
211
 
140
- The agent writes a degraded sentinel report when T1 / T3 / T4 / T7 fail before the case table is rendered. Look at the first two non-frontmatter lines of `<output_path>/self-test-report.md`:
212
+ The agent writes a degraded sentinel report when T1 / T3 / T4 / T6 fail before the case table is rendered. First, guard the empty-suite case — the batch launcher returns early without writing `summary.json` when there are 0 cases, which the sentinel check below would otherwise misreport as a batch crash:
141
213
 
142
- ```bash
143
- grep -m1 -E '^status:' "<output_path>/self-test-report.md"
144
- grep -m1 -E '^reason:' "<output_path>/self-test-report.md"
145
- ```
214
+ - If `<output-path>/testcases.json` exists and contains 0 cases → set `stop_reason = no_testcases`, surface a clear message to the user (`<output-path>/testcases.json contains 0 cases — nothing to run`), snapshot the round (2.5), and exit the loop. Do NOT enter 2B. (The 2A.2 `total == 0` guard remains as a secondary safety net.)
215
+
216
+ Then check that the report exists:
217
+
218
+ - If `<output-path>/self-test-report.md` does **not** exist (e.g., T8 failure or a hard error not covered by the sentinel set) → set `stop_reason = agent_early_exit`, `early_exit_reason = "no self-test-report.md written — agent failed before producing a report"`, snapshot the round (2.5), and exit the loop. Do NOT enter 2B.
219
+
220
+ Then grep the report for the first `status:` line and the first `reason:` line:
221
+
222
+ | Shell | Example |
223
+ |-------|---------|
224
+ | bash / sh | `grep -m1 -E '^status:' "<output-path>/self-test-report.md"` |
225
+ | PowerShell | `Select-String -Path "<output-path>/self-test-report.md" -Pattern '^status:' | Select-Object -First 1` |
226
+
227
+ Run both `status:` and `reason:` checks.
146
228
 
147
229
  - If the first line matches `status: FAIL` → this is a sentinel report. Set `stop_reason = agent_early_exit`, capture the `reason:` line for the user (`early_exit_reason = <reason>`), snapshot the round (2.5), and exit the loop. Do NOT enter 2B (the fixer cannot fix an environment / connectivity / config issue).
148
230
  - Otherwise → proceed to 2A.2 below.
@@ -151,12 +233,12 @@ grep -m1 -E '^reason:' "<output_path>/self-test-report.md"
151
233
 
152
234
  ### 2A.2 — Parse the normal case table
153
235
 
154
- Read `<output_path>/self-test-report.md` (first 80 lines). Extract:
236
+ Read `<output-path>/self-test-report.md` (first 80 lines). Extract:
155
237
  - `total` — total test cases
156
238
  - `passed` — passed count
157
239
  - `failed` — failed count
158
240
 
159
- **Empty-suite guard**: If `total == 0` (e.g., `testcases.json` happened to be empty), set `stop_reason = no_testcases`, surface a clear message to the user (`<output_path>/testcases.json contains 0 cases — nothing to run`), snapshot the round (2.5), and exit the loop. Do NOT enter the fix loop.
241
+ **Empty-suite guard**: If `total == 0` (e.g., `testcases.json` happened to be empty), set `stop_reason = no_testcases`, surface a clear message to the user (`<output-path>/testcases.json contains 0 cases — nothing to run`), snapshot the round (2.5), and exit the loop. Do NOT enter the fix loop.
160
242
 
161
243
  Otherwise: Set `round_all_passed = true` if `failed == 0` and `passed == total` (and `total > 0`, which the guard above ensures).
162
244
 
@@ -177,17 +259,17 @@ Launch `self-test-fixer`. Use `PROJECT_ROOT`:
177
259
  Agent(
178
260
  subagent_type="self-test-fixer",
179
261
  description="Fix Self-Test Failures (Round {round})",
180
- prompt="self_test_report_path: <output_path>/self-test-report.md\nharmony_project_dir: <PROJECT_ROOT>\noutput_path: <ROUND_DIR>"
262
+ prompt="self_test_report_path: <output-path>/self-test-report.md\nharmony_project_dir: <PROJECT_ROOT>\noutput_path: <ROUND_DIR>"
181
263
  )
182
264
  ```
183
265
 
184
- > `android_project_dir` is optional — if the user mentioned an Android source path, add the line `android_project_dir: <android_project_dir>` to the prompt. Omit otherwise.
266
+ > `android_project_dir` is optional — if the user mentioned an Android source path, add the line `android_project_dir: <android-project-path>` to the prompt. Omit otherwise.
185
267
 
186
- After completion, read `<ROUND_DIR>/self-test-fix-report.md` (first 60 lines). Extract:
187
- - `confirmed` — white-box confirmed defect count
188
- - `false_positives` — false positive count
189
- - `fixed` — successfully fixed count
190
- - `failed_to_fix` — failed to fix count
268
+ After completion, read `<ROUND_DIR>/self-test-fix-report.md` (first 60 lines). Extract from its 概览 section (Chinese field names per self-test-fixer.md, English semantics in parentheses):
269
+ - `白盒确认问题存在` (confirmed — white-box confirmed defect count)
270
+ - `白盒判定为误报` (false positives count)
271
+ - `修复成功` (successfully fixed count)
272
+ - `修复失败(2次尝试后)` (failed to fix count)
191
273
 
192
274
  Set `round_no_confirmed_defects = true` if `confirmed == 0` (all failures are false positives).
193
275
 
@@ -206,24 +288,33 @@ If `round_no_confirmed_defects`:
206
288
 
207
289
  If `confirmed > 0`:
208
290
 
209
- Launch `build-fixer` with `--signed`:
291
+ **Capture `BUILD_START`** immediately before invoking `hmos-fix-build-errors` — e.g. `touch "<ROUND_DIR>/.build_start_marker"` (or record a timestamp). This marks the moment the rebuild begins, so the re-collection step below can tell freshly-rebuilt module outputs from stale ones left by a prior build.
210
292
 
211
- ```
212
- Agent(
213
- subagent_type="build-fixer",
214
- description="Rebuild Signed HAP After Fix (Round {round})",
215
- prompt="harmony_project_dir: <PROJECT_ROOT>\noutput_path: <ROUND_DIR>\n--signed"
216
- )
217
- ```
293
+ **Determine signing mode**: Check `ORIGINAL_HAP_PATH` (the user's original input). If it contains `*-signed.hap` or `*-signed.hsp` entries → the original packages were signed (real device path) → pass `--signed` to assert signed output. If not (emulator path, unsigned packages) → omit `--signed` so the skill produces unsigned output. This prevents the rebuilt HAP from failing `hdc install -r` on a real device while allowing unsigned testing on emulators.
294
+
295
+ Then invoke the `hmos-fix-build-errors` skill with `<PROJECT_ROOT>` (and `--signed` if determined above) for a rebuild.
296
+
297
+ After completion, locate the authoritative entry directly from `<PROJECT_ROOT>/entry/build/default/outputs/default/`. Identify `ENTRY_HAP` in this priority order:
298
+
299
+ 1. `<PROJECT_ROOT>/entry/build/default/outputs/default/entry-default-*.hap`
300
+ 2. First `*.hap` under `<PROJECT_ROOT>/entry/build/default/outputs/default/`
301
+
302
+ If no `.hap` is found → report "Build did not produce a HAP — cannot re-test." Set `stop_reason = no_hap`. Snapshot the round (2.5) and exit the loop.
218
303
 
219
- After completion, find the new signed HAP in `ROUND_DIR`:
304
+ **Assemble the next round's install set into `<ROUND_DIR>/package-set/`** — the rebuilt entry + freshly-rebuilt in-app HSPs + any original packages the rebuild did not reproduce, all in ONE directory. Use `<ROUND_DIR>/package-set/` (a dedicated subdir), **not** `<ROUND_DIR>` itself, because step 1 clears the destination and `<ROUND_DIR>` holds the round's reports and `.build_start_marker`.
220
305
 
221
- 1. `<ROUND_DIR>/entry-default-signed.hap`
222
- 2. First `<ROUND_DIR>/*-signed.hap`
306
+ 1. **Clear/create** `<ROUND_DIR>/package-set/`, then copy `ENTRY_HAP` into it. The entry is placed **unconditionally** (it is authoritative; the freshness gate below does NOT apply to it).
307
+ 2. **Re-collect freshly-rebuilt in-app HSPs** from the build tree `<PROJECT_ROOT>/*/build/default/outputs/default/` into `<ROUND_DIR>/package-set/`, admitting **only `*.hsp` whose mtime ≥ `BUILD_START`** (cross-platform: `find "<dir>" -newer "<ROUND_DIR>/.build_start_marker"`, or compare `stat` mtimes). The mtime gate is essential: incremental rebuilds run no clean, so non-entry module dirs still hold *stale* `.hsp` from prior builds — only the ones rebuilt *this* round (mtime ≥ `BUILD_START`) are admitted. **Do NOT re-collect feature HAPs here** (leave them entirely to the carry-forward in step 3). Skip `*ohosTest*` / `*-test-*`.
308
+ 3. **Carry-forward gap-fill** from the **original** package set (`ORIGINAL_HAP_PATH`, expanded: every `.hap`/`.hsp` across all its files/dirs), copying into `<ROUND_DIR>/package-set/` only basenames **still absent** after steps 1–2. **The rebuilt entry is always authoritative — never let an original entry HAP survive next to it:**
309
+ - **In-app HSPs** (`.hsp`): copy forward every one whose basename is not already in `package-set/`. (A freshly-rebuilt HSP from step 2 already occupies its basename → its stale original is correctly skipped.)
310
+ - **The original entry HAP: never carry it forward.** Identify it deterministically: a `.hap` named `entry-*`; else, if there is **exactly one** `.hap` among the original packages, that one. Copying it would leave **two entry HAPs** and install stale code.
311
+ - **Feature HAPs** (any other, clearly non-entry, module `.hap`): copy forward those whose basename is not already in `package-set/`. **If there are multiple non-`entry-*` `.hap` files and none is the sole `.hap`** — you cannot confidently tell feature from entry — **do NOT copy any of them and log that they were dropped.**
223
312
 
224
- If no HAP found → report "Build did not produce a signed HAP — cannot re-test." Set `stop_reason = no_signed_hap`. Snapshot the round (2.5) and exit the loop.
313
+ Use the cross-platform copy syntax from 2.5.
314
+ 4. **Entry-uniqueness fallback:** if `package-set/` does not end with exactly one `entry-*.hap` (or assembly otherwise failed), discard `package-set/` and fall back to **today's** behavior — copy `ENTRY_HAP` from the build tree into `<ROUND_DIR>`, carry the originals forward directly into `<ROUND_DIR>`, and set `CURRENT_HAP = <ROUND_DIR>`. This keeps the loop no-worse-than-before on a malformed build.
315
+ 5. Otherwise set `CURRENT_HAP = <ROUND_DIR>/package-set/`.
225
316
 
226
- Update `CURRENT_HAP` to the new HAP path.
317
+ This yields one directory holding exactly one entry HAP (the rebuilt one) + freshly-rebuilt in-app HSPs + carried-forward originals for anything not rebuilt — collision-free, installed together by the next round's `hdc install -r`. If the original input was a lone `.hap` with no extras and no HSP was rebuilt, `package-set/` simply holds the rebuilt entry.
227
318
 
228
319
  ---
229
320
 
@@ -231,13 +322,13 @@ Update `CURRENT_HAP` to the new HAP path.
231
322
 
232
323
  ```
233
324
  # stop_reason may already be set by 2A.1 (agent_early_exit), 2A.2 (no_testcases),
234
- # 2B (all_passed / no_confirmed_defects), or 2C (no_signed_hap).
325
+ # 2B (all_passed / no_confirmed_defects), or 2C (no_hap).
235
326
  if stop_reason is set: snapshot (2.5) and exit loop
236
327
  elif round >= MAX_ROUNDS: stop_reason = max_rounds_reached; snapshot (2.5); exit loop
237
328
  else:
238
329
  snapshot (2.5) # snapshot the just-completed round
239
330
  round += 1
240
- ROUND_DIR = <output_path>/round-{round}
331
+ ROUND_DIR = <output-path>/round-{round}
241
332
  create ROUND_DIR
242
333
  go to 2A
243
334
  ```
@@ -246,19 +337,19 @@ else:
246
337
 
247
338
  ### 2.5 — Per-round Snapshot
248
339
 
249
- After every round's 2A returns (round 1 and rounds 2+), snapshot these files from `<output_path>/` to `<ROUND_DIR>`. Each copy follows the rule **"skip if source missing"**.
340
+ After every round's 2A returns (round 1 and rounds 2+), snapshot these files from `<output-path>/` to `<ROUND_DIR>`. Each copy follows the rule **"skip if source missing"**.
250
341
 
251
342
  | Source | Destination | Notes |
252
343
  |--------|-------------|-------|
253
- | `<output_path>/self-test-report.md` | `<ROUND_DIR>/self-test-report.md` | Always expected after a successful T9. If missing, sentinel-FAIL detection in 2A.1 already routed via `agent_early_exit`. |
254
- | `<output_path>/task/` | `<ROUND_DIR>/task/` | Per-round runner artifacts. Skip if missing (e.g., agent FAILed before T6 created the dir). |
255
- | `<output_path>/_extracted.json` | `<ROUND_DIR>/_extracted.json` | Only present after round 1 (S4.2 wrote it). Skip in rounds 2+. |
344
+ | `<output-path>/self-test-report.md` | `<ROUND_DIR>/self-test-report.md` | Always expected after a successful T8. If missing, sentinel-FAIL detection in 2A.1 already routed via `agent_early_exit`. |
345
+ | `<output-path>/task/` | `<ROUND_DIR>/task/` | Per-round runner artifacts. Skip if missing (e.g., agent FAILed before T6 created the dir). |
346
+ | `<output-path>/_extracted.json` | `<ROUND_DIR>/_extracted.json` | Only present after round 1 (round 1 setup phase step 2 wrote it). Skip in rounds 2+. |
256
347
 
257
348
  **NOT snapshotted** (these stay at root only as the canonical, cross-round artifacts):
258
- - `<output_path>/testcases.json` — written once by round 1; rounds 2+ read it in place.
259
- - `<output_path>/app-metadata.json` — written once by round 1; rounds 2+ read it in place.
349
+ - `<output-path>/testcases.json` — written once by round 1; rounds 2+ read it in place.
350
+ - `<output-path>/app-metadata.json` — written once by round 1; rounds 2+ read it in place.
260
351
 
261
- **`task/` cleanup ordering**: T5 (inside the agent) cleans `<output_path>/task/` at the start of each test invocation. The invariant: by the time T5 wipes the root `task/` at the start of round N, the previous round's `task/` has already been snapshotted into `<output_path>/round-{N-1}/task/`.
352
+ **`task/` cleanup ordering**: T5 (inside the agent) cleans `<output-path>/task/` at the start of each test invocation. The invariant: by the time T5 wipes the root `task/` at the start of round N, the previous round's `task/` has already been snapshotted into `<output-path>/round-{N-1}/task/`.
262
353
 
263
354
  **Cross-platform copy syntax**:
264
355
 
@@ -271,37 +362,44 @@ Use forward slashes for cross-platform safety; both shells accept them.
271
362
 
272
363
  ---
273
364
 
274
- ### 2.6 — Loop Finalization (HAP mirror only)
365
+ ### 2.6 — Loop Finalization (package mirror only)
275
366
 
276
- When the loop exits, mirror the final HAP from `CURRENT_HAP` (which may live under the last `<ROUND_DIR>`) to `<output_path>/entry-default-signed.hap`. This is the only "latest" artifact whose primary location is a round dir; `self-test-report.md`, `testcases.json`, `app-metadata.json`, and `task/` already live at `<output_path>/` as canonical copies.
367
+ When the loop exits, mirror the final package(s) from `CURRENT_HAP` (which may live under the last `<ROUND_DIR>`) to `<output-path>/`. This is the only "latest" artifact whose primary location is a round dir; `self-test-report.md`, `testcases.json`, `app-metadata.json`, and `task/` already live at `<output-path>/` as canonical copies.
277
368
 
278
- Copy `CURRENT_HAP` → `<output_path>/entry-default-signed.hap` using the same cross-platform syntax above. Skip if `CURRENT_HAP` is already at `<output_path>/entry-default-signed.hap`.
369
+ `CURRENT_HAP` may be a single file, a directory, or a comma-separated list of files/dirs. Walk **every** entry:
370
+ - For each entry that is a **directory** → copy every `.hap`/`.hsp` in it to `<output-path>/` (keep filenames). Do not copy non-package files.
371
+ - For each entry that is a **`.hap`/`.hsp` file** → copy it to `<output-path>/` (a lone single-`.hap` entry is copied to `<output-path>/entry-default.hap`; any other entry keeps its filename).
372
+
373
+ The goal: after finalization, `<output-path>/` holds the **complete installable set** (entry HAP + all HSPs / feature HAPs) so a later `hdc install -r` of every `.hap`/`.hsp` under `<output-path>/` (the engine expands a directory into its `.hap`/`.hsp` file list) reproduces the tested install.
374
+
375
+ Use the same cross-platform copy syntax as above. Skip any copy whose source already resides at the destination.
279
376
 
280
377
  ---
281
378
 
282
379
  ## Step 3 — Surface Results
283
380
 
284
- Read `<output_path>/self-test-report.md` (first 80 lines) and extract the overview section:
381
+ Read `<output-path>/self-test-report.md` (first 80 lines) and extract the overview section:
285
382
 
286
383
  ```
287
- ## 自测报告
288
-
289
- | 指标 | 值 |
290
- |------|-----|
291
- | 设备 | <device-serial> |
292
- | HAP | <hap-basename> |
293
- | 测试套件 | <suite-name> |
294
- | 总用例 | <total> |
295
- | 通过 | <passed> |
296
- | 失败 | <failed> |
297
- | 常规通过率 | <pass-rate>% |
384
+ ## 测试概览
385
+
386
+ - **测试套件**: <suite-name>
387
+ - **测试时间**: <time-range>
388
+ - **设备**: <device-serial>
389
+ - **应用**: <app-name> (<bundle-name>)
390
+ - **HAP**: <entry-hap-basename>
391
+ - **总用例数**: <total>(前置 <pre-total> + 常规 <regular-total>)
392
+ - **通过**: <passed>(前置 <pre-pass> / 常规 <regular-pass>)
393
+ - **失败**: <failed>(FAIL <fail-count> + UNKNOWN <unknown-count>)
394
+ - **常规通过率**: <regular-pass-rate>(仅功能场景,反映本次需求质量)
395
+ - **含前置通过率**: <pass-rate>(仅供整体参考;前置用例属于数据/环境准备,与本次需求功能无关)
298
396
  ```
299
397
 
300
- > If the report file is missing or malformed, report the error to the user with the agent's output path — do NOT fabricate results. If the report exists but is truncated or unexpectedly formatted, read up to the first 80 lines for the overview section, and point the user to the full file at `<output_path>/self-test-report.md`.
398
+ > If the report file is missing or malformed, report the error to the user with the agent's output path — do NOT fabricate results. If the report exists but is truncated or unexpectedly formatted, read up to the first 80 lines for the overview section, and point the user to the full file at `<output-path>/self-test-report.md`.
301
399
 
302
400
  **Pre-case reminder**: If pre-cases failed, note that these are environment/setup issues (permissions, media imports, tutorial skipping), NOT application defects. The regular pass rate (常规通过率) is the primary quality metric.
303
401
 
304
- **Point the user to the full report**: `<output_path>/self-test-report.md` and per-round artifacts at `<output_path>/round-{N}/`.
402
+ **Point the user to the full report**: `<output-path>/self-test-report.md` and per-round artifacts at `<output-path>/round-{N}/`.
305
403
 
306
404
  ### Loop Summary (if loop ran)
307
405
 
@@ -320,12 +418,12 @@ After the report, present:
320
418
  `<stop_reason>` is one of:
321
419
  - `all_passed` — all cases passed, loop exited successfully.
322
420
  - `no_confirmed_defects` — failures exist but fixer judged them all as false positives.
323
- - `no_signed_hap` — build-fixer did not produce a signed HAP, loop cannot continue.
421
+ - `no_hap` — the rebuild did not produce an entry HAP in the build output, so the loop cannot continue.
324
422
  - `max_rounds_reached` — hit the configured `MAX_ROUNDS` cap (default 3) with failures remaining.
325
- - `no_testcases` — `<output_path>/testcases.json` contained 0 cases; nothing to run. Surface the path so the user can inspect.
326
- - `agent_early_exit` — `self-tester` wrote a sentinel FAIL report (config / device / autotest-dir / batch crash / `setup: false` precondition failure). Surface the captured `early_exit_reason` so the user knows what to fix manually.
423
+ - `no_testcases` — `<output-path>/testcases.json` contained 0 cases; nothing to run. Surface the path so the user can inspect.
424
+ - `agent_early_exit` — the skill wrote a sentinel FAIL report (config / device / autotest-dir / batch crash / precondition failure), or no `self-test-report.md` was written (skill failed before producing a report). Surface the captured `early_exit_reason` so the user knows what to fix manually.
327
425
 
328
- If failures remain (for `max_rounds_reached`), list them briefly (scenario names from the report overview). Also surface paths to `<ROUND_DIR>/self-test-fix-report.md` and `<ROUND_DIR>/build-fix-report.md` (from the final round, when those reports exist).
426
+ If failures remain (for `max_rounds_reached`), list them briefly (scenario names from the report overview). Also surface `<ROUND_DIR>/self-test-fix-report.md` when it exists, and describe the final rebuild outcome from the loop summary instead of relying on a removed build-stage report artifact.
329
427
 
330
428
  ---
331
429
 
@@ -333,48 +431,34 @@ If failures remain (for `max_rounds_reached`), list them briefly (scenario names
333
431
 
334
432
  | Scenario | Action |
335
433
  |----------|--------|
336
- | `test_case_path` does not exist | Ask user for correct path, do not proceed |
337
- | `hap_path` does not exist | Ask user for correct HAP path, do not proceed |
338
- | `output_path` parent does not exist | Create it, proceed |
339
- | Agent returns error / times out | Report the error to user. Suggest: check device connection (`hdc list targets`), verify HAP is valid, check the `HOMETRANS_MODEL_API_KEY` env var or `autotest.unified_model.api_key` in `~/.hometrans/config.json` has a real api_key |
340
- | `<output_path>/self-test-report.md` missing after agent completes | Report: "Agent completed but no report was generated. Check agent output at <output_path>." |
434
+ | `test-case-path` does not exist | Ask user for correct path, do not proceed |
435
+ | any `hap-path` entry does not exist | Name the missing entry, ask user for the correct path, do not proceed |
436
+ | `hap-path` entries all exist but none contributes a `.hap` (no entry package) | Report: "No entry HAP found across the given paths — at least one `.hap` is required." Do not proceed |
437
+ | `output-path` parent does not exist | Create it, proceed |
438
+ | Agent returns error / times out | Report the error to user. Suggest: check device connection (`npx --yes devecocli device list`), verify the HAP is valid, check the `HOMETRANS_MODEL_API_KEY` env var, and confirm `~/.hometrans/autotest.yaml` has a real `api_key` |
439
+ | `<output-path>/self-test-report.md` missing after agent completes | Report: "Agent completed but no report was generated. Check agent output at <output-path>." |
341
440
  | `self-test-report.md` exists but format is unrecognizable | Show the file path, report the first 80 lines as context, let user investigate |
342
- | Device not found (agent reports "No device") | Remind user: connect device via USB, verify `hdc list targets` shows the device |
441
+ | Device not found (agent reports "No device") | Remind user: connect a HarmonyOS device or emulator, verify `npx --yes devecocli device list` shows it |
343
442
  | Pre-case failures in report | Note: these are environment issues, not app defects. Highlight regular pass rate |
344
- | `<output_path>/testcases.json` or `app-metadata.json` missing after round 1 | Round 1 setup may have failed; inspect agent output at `<output_path>/` |
345
- | `<output_path>/testcases.json` is empty (`total == 0` in 2A) | Report: "testcases.json contains 0 cases — nothing to run." Exit loop with `stop_reason = no_testcases`. Do NOT enter the fix loop. |
346
- | `self-tester` writes a sentinel FAIL report (first line `status: FAIL`) | Capture the `reason:` line. Exit loop with `stop_reason = agent_early_exit` and surface the captured reason. Do NOT enter the fix loop — these failures (config / device / autotest-dir / crash / timeout / setup=false preconditions) are not application defects. |
443
+ | `<output-path>/testcases.json` or `app-metadata.json` missing after round 1 | Round 1 setup may have failed; inspect agent output at `<output-path>/` |
444
+ | `<output-path>/testcases.json` is empty (`total == 0` in 2A) | Report: "testcases.json contains 0 cases — nothing to run." Exit loop with `stop_reason = no_testcases`. Do NOT enter the fix loop. |
445
+ | The skill writes a sentinel FAIL report (first line `status: FAIL`), or no `self-test-report.md` was written (skill failed before producing a report) | Capture the `reason:` line. Exit loop with `stop_reason = agent_early_exit` and surface the captured reason. Do NOT enter the fix loop — these failures (config / device / autotest-dir / crash / timeout / precondition failures / report not produced) are not application defects. |
347
446
  | Fixer returns `confirmed == 0` (all false positives) | Exit loop with `stop_reason = no_confirmed_defects`. Surface the fix report summary. |
348
- | Build-fixer produces no signed HAP in ROUND_DIR | Report: "Build did not produce a signed HAP — cannot re-test." Exit loop with `stop_reason = no_signed_hap`. |
447
+ | hmos-fix-build-errors produces no HAP in build output | Report: "Build did not produce a HAP — cannot re-test." Exit loop with `stop_reason = no_hap`. |
349
448
  | Loop reaches `MAX_ROUNDS` (default 3) with failures remaining | Report `stop_reason = max_rounds_reached`. Surface final pass rate and remaining failures. |
350
449
  | `app-metadata.json` missing after round 1 (PROJECT_ROOT unknown) | Surface agent error; PROJECT_ROOT cannot be resolved. Do NOT enter 2B. |
351
- | Signing config missing in `build-profile.json5` before build | Report: "Signing configuration not found. Please open project in DevEco Studio, go to File → Project Structure → Signing Configs, enable Automatically generate signature, then re-run." Exit loop. |
352
450
 
353
451
  ---
354
452
 
355
453
  ## Key Constraints
356
454
 
357
- - **Delegation only**: Do NOT run test tools directly. Never call `hdc`, `self_test_runner.py`, `AutoTest.batch`, or `report_tool.py` yourself. All test work goes through `self-tester`.
455
+ - **Direct orchestration**: The skill runs test tools directly via `node "$SKILL_SCRIPTS/..."` (scripts bundled in the skill's own `scripts/` directory) and resolves `batch_runner.js` from `@autotest/agent` internally (walk-up + global npm root fallback + auto-install). This SKILL.md is the **single source of truth** for the procedure. The `self-tester` **subagent** (`agents/self-tester.md`) is a thin wrapper that loads this skill — callers (e.g. `hmos-convert-pipeline` Stage 4) may launch it for context isolation on long runs; it forwards the same kebab params and reports the result back, without duplicating any procedure. The legacy `$HOMETRANS_TOOL_PATH` scripts (tools/test-tools/autotest) are no longer used.
358
456
  - **Parameter purity**: Pass only parameter values to the agent's prompt in `key: value` format. Do NOT add extra instructions, format descriptions, schema hints, or implementation suggestions. The agent has its own built-in workflow.
359
- - **Do NOT read full reports**: Self-test reports can be very large (10KB–200KB). Only read the overview (first 80 lines for test report, first 60 lines for fix report). Point the user to the full file.
457
+ - **Do NOT read full reports**: Self-test reports can be very large (10KB–200KB). Only read the overview (first 80 lines for test report, first 60 lines for fix report). Point the user to the full file; never fabricate results when a report is missing or unreadable.
360
458
  - **Quote all paths**: Paths may contain spaces. Always wrap paths in double quotes in commands.
361
459
  - **Pre-cases are environment scripts**: Their failures indicate testing-environment issues, not app bugs. The regular pass rate is the primary quality metric.
362
460
  - **Fix-and-retest loop is opt-in**: Follow Step 2 Entry — ask the user unless they already opted in with "自动修复".
363
461
  - **Test → Fix → Build is the mandatory order**: Never re-test without rebuilding after a fix (would test old code). Never skip the build step in the loop.
364
- - **`CURRENT_HAP` must track the latest build**: After each 2C rebuild, update `CURRENT_HAP` to the new signed HAP from `ROUND_DIR`. Never re-test with the old HAP.
365
- - **Per-round snapshots**: Each round writes its latest artifacts to `<output_path>/` (root), then the SKILL snapshots per-round outputs to `<output_path>/round-{N}/`. The persistent JSONs (`testcases.json`, `app-metadata.json`) are written exactly once by round 1 and consumed unchanged by rounds 2+.
366
- - **Loop stop conditions**: Normal exits (3) — `all_passed`, `no_confirmed_defects`, `max_rounds_reached`. Error exits (3) — `no_signed_hap` (build did not produce HAP), `no_testcases` (empty testcases.json), `agent_early_exit` (self-tester sentinel FAIL: config / device / autotest-dir / crash / timeout / `setup: false` precondition failure).
462
+ - **`CURRENT_HAP` must track the latest build**: After each 2C rebuild, update `CURRENT_HAP` to the new HAP from `ROUND_DIR`. Never re-test with the old HAP.
463
+ - **Per-round snapshots**: Each round writes its latest artifacts to `<output-path>/` (root), then the SKILL snapshots per-round outputs to `<output-path>/round-{N}/`. The persistent JSONs (`testcases.json`, `app-metadata.json`) are written exactly once by round 1 and consumed unchanged by rounds 2+. Never pass `output_path: <output-path>/round-N` to the agent — it always writes to `<output-path>/` root; round dirs are populated only by this snapshot step.
367
464
  - **Loop iterations are strictly sequential**: Never launch more than one fixer or tester at a time.
368
-
369
- ## Forbidden
370
-
371
- - ❌ Running `hdc list targets`, `hdc install`, or any `hdc` command directly
372
- - ❌ Calling `self_test_runner.py` or `report_tool.py` directly
373
- - ❌ Reading `test_case.md` or modifying test cases — the agent handles this
374
- - ❌ Reading the full `self-test-report.md` (read only first 80 lines for summary)
375
- - ❌ Reading the full `self-test-fix-report.md` (read only first 60 lines for summary)
376
- - ❌ Fabricating results when the report is missing or unreadable
377
- - ❌ Passing `output_path: <output_path>/round-N` to the agent — the agent always writes to `<output_path>/` root; per-round directories are populated by the SKILL's snapshot step
378
- - ❌ Skipping the build step in the loop (rebuild is mandatory after each confirmed fix)
379
- - ❌ Re-testing with an old HAP after a build
380
- - ❌ Launching more than one fixer or tester at a time — loop rounds are strictly sequential