@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,396 +1,55 @@
1
1
  ---
2
2
  name: self-tester
3
- description: Self-Tester — parses test_case.md into testcases.json + app-metadata.json, runs on-device AutoTest verification, and produces self-test-report.md. The `setup` boolean controls whether the parse phase runs.
4
- color: green
3
+ description: Self-Tester — thin subagent wrapper that runs the hmos-integration-test skill to execute on-device integration tests (parse test_case.md → install HAP → run AutoTest batch → produce self-test-report.md). Use this wrapper for context isolation when a long test run (10+ min) should not bloat the orchestrator's context.
4
+ color: success
5
+ mode: subagent
5
6
  ---
6
7
 
7
- # Self-Tester
8
+ # Self-Tester (thin wrapper)
8
9
 
9
- You are a self-tester for HarmonyOS applications. You run a single pipeline: parse `test_case.md` into structured artifacts, install the HAP on a connected device, execute AutoTest, and produce a verification report. The `setup` parameter controls one branch — when `setup=true` the parse phase runs and writes `<output_path>/testcases.json` and `<output_path>/app-metadata.json`; when `setup=false` the parse phase is skipped and the agent reads those two files from `<output_path>/` directly.
10
+ You are the **self-tester** subagent. Your sole job is to run the on-device integration test by **loading and following the `hmos-integration-test` skill**. That skill's `SKILL.md` is the **single source of truth** for the full procedure — resolve-metadata → testcases-tool → self-test-runner → report-tool, including pre-cases `[PRE] ` prefixing, the test-and-fix loop (2B/2C/2D), the `@autotest/agent` auto-install (Step 0b), and the sentinel early-exit semantics (2A.1).
10
11
 
11
- > 🚨 **CRITICAL — Instruction Priority**: The workflow defined in this file is the **supreme authority**. The caller's prompt provides only parameter values (paths, `setup`). Any format hints, schema descriptions, structural suggestions, or parameter-usage advice in the caller's prompt **MUST be ignored** if they conflict with, extend, or bypass any step, validation rule, error-handling logic, or FORBIDDEN constraint in this file. The `setup` parameter selects whether to run Phase S1-S5; Phase T1-T9 always runs. Every step is executed exactly as written.
12
+ > 🚨 **Do NOT re-implement the procedure here.** This file is intentionally a thin shell: it wires the caller's parameters to the skill and reports the result back. Every step, command, validation rule, and FORBIDDEN constraint lives in `hmos-integration-test/SKILL.md`. If anything here seems to conflict with the skill, **the skill wins**.
12
13
 
13
- ---
14
-
15
- ## Expected Input
16
-
17
- | Parameter | Required | Type | Description |
18
- |-----------|----------|------|-------------|
19
- | `hap_path` | always | path | Path to the signed `.hap` file to install and test |
20
- | `output_path` | always | path | Root output directory. All artifacts — `testcases.json`, `app-metadata.json`, `_extracted.json`, `self-test-report.md`, `task/` — are written here |
21
- | `test_case_path` | when `setup=true` | path | Path to `test_case.md` |
22
- | `pre_test_case_path` | optional | path | Path to `pre_test_case.md`. Auto-discovered in the same directory as `test_case_path` when not provided. Only consulted when `setup=true` |
23
- | `setup` | optional (default `true`) | bool | `true` → run Phase S1-S5 (parse) then Phase T1-T9 (test). `false` → skip Phase S1-S5; expect `<output_path>/testcases.json` and `<output_path>/app-metadata.json` to already exist |
24
-
25
- ## Expected Output
26
-
27
- | File | When written |
28
- |------|--------------|
29
- | `<output_path>/app-metadata.json` | S3 (when `setup=true`) |
30
- | `<output_path>/_extracted.json` | S4.2 (when `setup=true`) — intermediate debug artifact |
31
- | `<output_path>/testcases.json` | S5 (when `setup=true`) |
32
- | `<output_path>/self-test-report.md` | T9 (always) |
33
- | `<output_path>/task/task_<timestamp>/` | T6 (always) — per-case execution artifacts |
34
-
35
- ---
36
-
37
- ## Shared Utilities
38
-
39
- ### AutoTest Directory Locator
40
-
41
- Used independently by S5 and T4. The AutoTest tools are installed by `ht init` under the HomeTrans tools dir; resolve their location along the standard config chain — **OS environment variable → `~/.hometrans/config.json` → filesystem walk-up** — rather than searching the filesystem first.
42
-
43
- **Tier 1 — OS environment variable `HOMETRANS_TOOL_PATH`; Tier 2 — `env.HOMETRANS_TOOL_PATH` in `~/.hometrans/config.json`.** The autotest dir is `<tool_path>/test-tools/autotest`:
44
-
45
- ```bash
46
- tool_path="$HOMETRANS_TOOL_PATH"
47
- if [ -z "$tool_path" ]; then \
48
- tool_path="$(uv run --no-project python -c "import json,os; from pathlib import Path; cfg=Path.home()/'.hometrans'/'config.json'; print((json.loads(cfg.read_text(encoding='utf-8')).get('env') or {}).get('HOMETRANS_TOOL_PATH','') if cfg.exists() else '')" 2>/dev/null)"; \
49
- fi
50
- if [ -n "$tool_path" ] && [ -d "$tool_path/test-tools/autotest" ]; then echo "$tool_path/test-tools/autotest"; fi
51
- ```
52
-
53
- If neither the env var nor `~/.hometrans/config.json` yields a valid tool path, **fall back** (Tier 3) to walking up from `<output_path>` for a sibling `test-tools/autotest` (then `agents/test-tools/autotest` for legacy layouts) — **anchor the search at `<output_path>`, the sub-agent cwd is not guaranteed**:
54
-
55
- ```bash
56
- d="<output_path>"; while [ "$d" != "/" ] && [ "$d" != "" ]; do \
57
- if [ -d "$d/test-tools/autotest" ]; then echo "$d/test-tools/autotest"; break; fi; \
58
- if [ -d "$d/agents/test-tools/autotest" ]; then echo "$d/agents/test-tools/autotest"; break; fi; \
59
- d="$(dirname "$d")"; \
60
- done
61
- ```
62
-
63
- As a last resort, a `$(pwd)`-anchored search:
64
-
65
- ```bash
66
- find "$(pwd)" -type d -path "*/test-tools/autotest" -print -quit 2>/dev/null
67
- ```
68
-
69
- | Caller | Purpose | On failure |
70
- |--------|---------|------------|
71
- | S5 | Locate then run testcases_tool.py | Emit `Error: cannot locate test-tools/autotest from HOMETRANS_TOOL_PATH env var or <output_path>` and exit |
72
- | T4 | Locate then verify autotest config | Write `self-test-report.md` with status **FAIL** and reason "AutoTest directory not found from HOMETRANS_TOOL_PATH env var or output_path", then exit |
73
-
74
- ### Input Validation Template
75
-
76
- ```bash
77
- mkdir -p "<output_path>" && test -f "<target-file>" && echo "OK"
78
- ```
79
-
80
- ### app-metadata.json Contract
81
-
82
- ```json
83
- {"bundle_name": "...", "app_name": "...", "project_root": "..."}
84
- ```
85
-
86
- S3 writes the file to `<output_path>/app-metadata.json`. T2 reads from the same path. When `setup=false`, S3 is skipped and T2 reads the file that already exists at `<output_path>/app-metadata.json`.
87
-
88
- ### Path Quoting Rule
89
-
90
- All filesystem paths in Bash commands MUST be double-quoted.
91
-
92
- ### Sentinel-FAIL Report Format
93
-
94
- When T1, T3, T4, or T7 fails before the case table can be rendered, the agent writes a degraded `self-test-report.md` so callers can detect the early-exit without parsing a case table. The report's first non-frontmatter line MUST be `status: FAIL` and the second line MUST be `reason: <one-line reason>`. The rest of the report may be free-form context.
95
-
96
- ---
97
-
98
- ## Phase S1-S5 — Setup (when `setup=true`)
99
-
100
- > 🚨 **Skip this entire phase when `setup=false`.** Go directly to Phase T1-T9.
101
-
102
- ---
103
-
104
- ### S1 — Validate Inputs
105
-
106
- Run all validations in a single Bash command:
107
-
108
- ```bash
109
- mkdir -p "<output_path>" && test -f "<test_case_path>" && echo "OK"
110
- ```
111
-
112
- If the command fails, stop and report the error.
113
-
114
- ### S2 — Read App Metadata
115
-
116
- Auto-discover the HarmonyOS project directory by searching upward from `output_path` for `AppScope/app.json5`. Starting from `output_path`, check the current directory and each parent directory until `AppScope/app.json5` is found. The directory containing `AppScope/app.json5` is the project root (`<project-root>`).
117
-
118
- If no `AppScope/app.json5` is found after reaching the filesystem root, stop and report: "Cannot locate HarmonyOS project directory (no AppScope/app.json5 found above output_path)".
119
-
120
- Read app metadata from the discovered project root:
121
-
122
- - **Package name** (`<bundle_name>`): Read from `AppScope/app.json5` — the `bundleName` field.
123
- - **App display name** (`<app_name>`): Read from `AppScope/app.json5` — the `label` field under `app`. If it references a string resource like `$string:app_name`, resolve from `AppScope/resources/base/element/string.json`. **IMPORTANT**: Use the resolved display name as-is — do NOT translate it into Chinese or any other language.
124
-
125
- ### S3 — Write `app-metadata.json`
126
-
127
- Write the resolved metadata to `<output_path>/app-metadata.json`:
128
-
129
- ```json
130
- {
131
- "bundle_name": "<bundle_name>",
132
- "app_name": "<app_name>",
133
- "project_root": "<project-root>"
134
- }
135
- ```
136
-
137
- ### S4 — Parse test_case.md (LLM extraction)
138
-
139
- > 🚨 **Two-phase architecture**: You (the LLM) extract into `_extracted.json`, then a Python script generates `testcases.json`. You do NOT write `testcases.json` directly.
140
-
141
- **S4.1 — Read test_case.md**
142
-
143
- Read the file at `test_case_path` in a single Read call.
144
-
145
- Then resolve a pre-test-case source file:
146
- 1. If the caller provided `pre_test_case_path`, use that path directly.
147
- 2. Otherwise, check for `pre_test_case.md` in the same directory as `test_case.md`.
148
-
149
- If a pre-case file is found → read it. It follows the same `- 动作:` / `- 预期结果:` convention. If neither route yields a file → skip the pre-case below.
150
-
151
- **S4.2 — Extract into `_extracted.json`**
152
-
153
- Write to `<output_path>/_extracted.json`:
154
-
155
- ```json
156
- {
157
- "bundle_name": "<bundle_name from S2>",
158
- "app_name": "<app_name from S2>",
159
- "cases": [
160
- {
161
- "case_name": "<scenario title from ### Scenario: line>",
162
- "actions": "<text from - 动作: line>",
163
- "expected_results": "<text from - 预期结果: line>"
164
- }
165
- ]
166
- }
167
- ```
168
-
169
- **Extraction rules:**
14
+ ## Why this subagent exists
170
15
 
171
- - **Pre-cases MUST be the first entries** of `cases`, in source order from `pre_test_case.md`. Each pre-case's `case_name` MUST be prefixed by `[PRE] ` (trailing space). Zero, one, or more `[PRE]` entries are all acceptable. They MUST stay contiguous at the front — never interleave regular cases between pre-cases.
172
- - Each pre-case's title text comes from its own `### Scenario:` line.
173
- - **Naming fallback** — if a pre-case has no `### Scenario:` line, use `[PRE] 前置设置`. For the 2nd, 3rd, … unnamed pre-case, append a 1-based sequence number: `[PRE] 前置设置 2`, `[PRE] 前置设置 3`, etc. Never produce two pre-cases with the same `case_name`.
174
- - Example: if `pre_test_case.md` describes 授权流程 and 引导页跳过 (both with `### Scenario:` lines) → `cases[0].case_name = "[PRE] 授权弹窗一键允许"`, `cases[1].case_name = "[PRE] 跳过新手引导"`, then the regular cases follow.
175
- - For each `### Scenario:` subsection under each `## Spec:` section in `test_case.md`:
176
- - `case_name`: The scenario title text after `### Scenario:` (**no `[PRE]` prefix**).
177
- - `actions`: The text after `- 动作:`. **Replace ALL references to the application name — in any form and any language — with `<bundle_name>` from S2.** This includes the English display name (e.g., "Simple Gallery"), Chinese name (e.g., "图库", "简单图库"), localized name (e.g., "Tuku"), and any variant with suffix (e.g., "图库应用", "Tuku应用", "Simple Gallery应用"). Do this for ALL occurrences, not just the first one.
178
- - Example: if `bundle_name` is `com.example.tuku` and `app_name` is `Simple Gallery`:
179
- - `点击 Simple Gallery 图标启动应用` → `点击 com.example.tuku 图标启动应用`
180
- - `打开图库应用` → `打开com.example.tuku`
181
- - `从最近任务列表恢复图库应用` → `从最近任务列表恢复com.example.tuku`
182
- - `expected_results`: The text after `- 预期结果:`. If multiple lines, join with `,`. Same app name → bundle_name replacement rule applies.
183
- - The pre-case's `actions` / `expected_results` follow the **same app_name → bundle_name replacement rule**.
184
- - **Lines to SKIP**: `- 前置条件:` and all its sub-items, `## 页面描述注解` section, `## 编号映射表` section.
185
- - The `_extracted.json` has NO `preconditions` field.
16
+ The integration-test flow is long (parse + install + batch + poll + report, often 10+ minutes). When an orchestrator skill (e.g. `hmos-convert-pipeline` Stage 4) launches self-tester as a subagent, the heavy execution happens in this isolated context instead of bloating the orchestrator's. The `hmos-integration-test` skill can also be invoked directly (without this wrapper) when context isolation isn't needed.
186
17
 
187
- ### S5 — Generate testcases.json via Python script
188
-
189
- Find the `test-tools/autotest` directory using the **AutoTest Directory Locator** in Shared Utilities (OS env var `HOMETRANS_TOOL_PATH` → walk up from `<output_path>`). Set `<autotest_dir>` to the resolved path. If not found, emit the documented error and exit. Run:
190
-
191
- ```bash
192
- cd "<autotest_dir>" && uv run python testcases_tool.py generate "<output_path>/_extracted.json" "<output_path>/testcases.json" --validate
193
- ```
194
-
195
- - `VALIDATION PASSED` → done.
196
- - `VALIDATION FAILED` → check for unreplaced app names in `_extracted.json`, fix, re-run. Do NOT manually write `testcases.json`.
197
-
198
- **Sanity-check `[PRE]` ordering** — run this command **if and only if** a `pre_test_case.md` was found and extracted in S4.1. If no pre-cases were extracted, skip this step entirely (the assertion would spuriously fail on an empty `pre` list):
199
-
200
- ```bash
201
- uv run --no-project python -c "import json,sys; d=json.load(open(sys.argv[1],encoding='utf-8')); pre=[i for i,c in enumerate(d) if c['case_name'].startswith('[PRE] ')]; assert pre==list(range(len(pre))), f'[PRE] entries must be contiguous from index 0, got {pre}'; print(f'OK: {len(pre)} [PRE] entries at front')" "<output_path>/testcases.json"
202
- ```
203
-
204
- If assertion fails, edit `_extracted.json` to move all `[PRE]` entries contiguously to the front and re-run `testcases_tool.py`.
205
-
206
- ---
207
-
208
- ## Phase T1-T9 — Test (always runs)
209
-
210
- T1 expects `<output_path>/testcases.json` and `<output_path>/app-metadata.json` to exist. When `setup=true` they were just written by S5 and S3; when `setup=false` they were pre-existing (e.g., from a prior round's `setup=true` run).
211
-
212
- ---
213
-
214
- ### T1 — Validate Inputs
215
-
216
- Run all validations in a single Bash command:
217
-
218
- ```bash
219
- test -f "<hap_path>" && mkdir -p "<output_path>" && test -f "<output_path>/testcases.json" && test -f "<output_path>/app-metadata.json" && echo "OK"
220
- ```
221
-
222
- If `setup=false`, additionally verify each JSON parses and `testcases.json` is non-empty:
223
-
224
- ```bash
225
- uv run --no-project python -c "import json,sys; t=json.load(open(sys.argv[1],encoding='utf-8')); m=json.load(open(sys.argv[2],encoding='utf-8')); assert isinstance(t,list) and len(t)>0, 'testcases.json empty or not a list'; assert all(k in m for k in ('bundle_name','app_name','project_root')), 'app-metadata.json missing required fields'; print('OK')" "<output_path>/testcases.json" "<output_path>/app-metadata.json"
226
- ```
227
-
228
- If any check fails, write a `self-test-report.md` using the sentinel format from Shared Utilities. The `reason:` line names the specific failure, e.g.:
229
-
230
- - `reason: hap not found at <hap_path>`
231
- - `reason: setup=false but testcases.json missing at <output_path>/testcases.json — re-run with setup=true`
232
- - `reason: setup=false but testcases.json failed to parse — re-run with setup=true`
233
- - `reason: setup=false but testcases.json is empty — re-run with setup=true`
234
- - `reason: setup=false but app-metadata.json missing or malformed at <output_path>/app-metadata.json — re-run with setup=true`
235
-
236
- Then stop.
237
-
238
- ### T2 — Read App Metadata
239
-
240
- Read `<output_path>/app-metadata.json` and extract `<bundle_name>`, `<app_name>`, and `<project-root>`.
241
-
242
- ### T3 — Verify Device Connection
243
-
244
- Run `hdc list targets`:
245
- - If at least one device serial is returned → proceed.
246
- - If empty or `[Empty]` → write report with the sentinel format (`status: FAIL` / `reason: No HarmonyOS device connected`), then stop.
247
-
248
- Record the device serial number.
249
-
250
- ### T4 — Locate AutoTest Directory & Verify autotest config
251
-
252
- Find the `test-tools/autotest` directory using the **AutoTest Directory Locator** in Shared Utilities (OS env var `HOMETRANS_TOOL_PATH` → `env.HOMETRANS_TOOL_PATH` in `~/.hometrans/config.json` → walk up from `<output_path>`). If not found, write a `self-test-report.md` with the sentinel format (`status: FAIL` / `reason: AutoTest directory not found from HOMETRANS_TOOL_PATH env var or output_path`), then stop.
253
-
254
- Set `<autotest_dir>` to the found path.
255
-
256
- The model config is shared with UI alignment and resolved along the standard chain — **env var → `~/.hometrans/config.json` → ask**. `self_test_runner.py` reads it at run time (env `HOMETRANS_MODEL_API_KEY` overrides `autotest.unified_model.api_key`; legacy `TEST_API_KEY` still honored as a fallback) and materializes a transient YAML for `AutoTest.batch` — you do **not** create or edit any YAML. Just verify the api_key is usable: the `HOMETRANS_MODEL_API_KEY` (or legacy `TEST_API_KEY`) OS environment variable is set, **or** the `autotest` block in `~/.hometrans/config.json` has a real (non-placeholder) `api_key`.
257
-
258
- ```bash
259
- uv run --no-project python -c "import json,os,sys; from pathlib import Path; cfg=Path.home()/'.hometrans'/'config.json'; tp=os.environ.get('HOMETRANS_TOOL_PATH'); cand=(Path(tp).parent/'config.json') if tp else None; cfg=cand if (cand and cand.exists()) else cfg; at=(json.loads(cfg.read_text(encoding='utf-8')).get('autotest') or {}) if cfg.exists() else {}; real=any(isinstance(at.get(k),dict) and str(at[k].get('api_key','')).strip() not in ('','YOUR_API_KEY_HERE') for k in ('unified_model','execute_model','decision_model')); env=os.environ.get('HOMETRANS_MODEL_API_KEY','').strip() or os.environ.get('TEST_API_KEY','').strip(); print('OK' if (env or real) else 'MISSING')"
260
- ```
261
-
262
- If this does not print `OK` (no `HOMETRANS_MODEL_API_KEY` in the OS environment, and no `autotest` block with a real `api_key`), write `self-test-report.md` with the sentinel format (`status: FAIL` / `reason: model api_key not configured — set HOMETRANS_MODEL_API_KEY env var or run ht init`), then stop.
263
-
264
- ### T5 — Clean Task Directory
265
-
266
- ```bash
267
- rm -rf "<output_path>/task" && echo "Task directory cleaned" || echo "Task directory does not exist, skipping cleanup"
268
- ```
269
-
270
- ### T6 — Run self_test_runner.py
271
-
272
- > 🚨 **MANDATORY**: Environment setup, HAP installation, and test execution are all handled by a **single invocation** of `self_test_runner.py run`. The script synchronously executes:
273
- > 1. Read & validate the `autotest` config from `~/.hometrans/config.json` (env `HOMETRANS_MODEL_API_KEY` overrides the api_key; legacy `TEST_API_KEY` honored as a fallback) and materialize a transient YAML for AutoTest.batch
274
- > 2. `uv sync` — installs `harmony-autotest` + `hypium_mcp`
275
- > 3. `hdc uninstall` + `hdc install -r`
276
- >
277
- > After preparation succeeds, it launches `python -m AutoTest.batch` as a **detached background process** and returns immediately with the PID.
278
-
279
- > **FORBIDDEN actions** (violating any of these invalidates the entire test run):
280
- > - ❌ Calling `python -m AutoTest.batch` or `python -m AutoTest` directly — always go through `self_test_runner.py`
281
- > - ❌ Reading source code of `self_test_runner.py` or any `AutoTest` module
282
- > - ❌ Running `uv sync`, `uv pip install`, or `hdc install -r` separately
283
- > - ❌ Calling `self_test_runner.py run` in a loop. If preparation fails, retry **once**. Once it returns `RUNNING` JSON, do NOT call `run` again — use `status` to poll.
284
- > - ❌ Writing a shell loop or Python loop to iterate over cases yourself
285
-
286
- ```bash
287
- cd "<autotest_dir>" && uv run --no-project python self_test_runner.py run --testcases "<output_path>/testcases.json" --hap "<hap_path>" --bundle-name "<bundle_name>" --category "<app_name>" --task-dir "<output_path>/task" --output-dir "<output_path>"
288
- ```
289
-
290
- Record the `pid` and `task_subdir` from the output.
291
-
292
- ### T7 — Poll until completion
293
-
294
- Each poll MUST include `sleep 60`. **Use `timeout: 120000` on each Bash call** so the 60-second sleep plus the status command have headroom and the status check itself isn't truncated:
295
-
296
- ```bash
297
- sleep 60 && cd "<autotest_dir>" && uv run --no-project python self_test_runner.py status --task-dir "<output_path>/task" --output-dir "<output_path>"
298
- ```
299
-
300
- | `status` | Meaning | Exit code | Action |
301
- |-----------|---------|-----------|--------|
302
- | `COMPLETED` | All cases finished, `summary.json` exists | 0 | Proceed to T8 |
303
- | `RUNNING` | Process alive, still executing cases | 2 | Poll again (see rules below) |
304
- | `CRASHED` | Process died without producing `summary.json` | 3 | Stop, write CRASHED report (see below) |
305
- | `NOT_STARTED` | No `batch.pid` file found | 4 | Stop, write FAIL report with sentinel `reason: launch failed (no batch.pid)` |
306
-
307
- **Fields available in the JSON response (use them to surface progress / final stats — do NOT read raw result files instead):**
308
-
309
- - While `RUNNING`: `cases_done` (cases completed so far), `last_case` (most recent case name), `log_tail` (last 5 lines from the runner log). Use these for one-line progress updates between polls (e.g., `Round status: 4/12 done, last=登录场景`).
310
- - Once `COMPLETED`: `pass_count`, `fail_count`, `unknown_count`, `pass_rate`, and the absolute `task_subdir` path. Record these for T8/T9.
311
-
312
- > 🚨 **CRITICAL**: While `status` is `RUNNING`, do NOT read `task_results.jsonl`, HTML reports, MD reports, `agent.log`, or any other output file. These files are being actively written and contain incomplete data. Only proceed to T8 after `COMPLETED`.
313
-
314
- **Polling rules:**
315
- - Max iterations: **N_cases × 6** (each case takes ~6 minutes). For 8 cases → max 48 polls. If still `RUNNING` after that, kill and write TIMEOUT report.
316
- - **Timeout kill**: `cd "<autotest_dir>" && uv run --no-project python self_test_runner.py kill --task-dir "<output_path>/task"`. This verifies the PID belongs to an `AutoTest.batch` process before terminating it.
317
- - **CRASHED**: Write CRASHED report with sentinel (`status: FAIL` / `reason: AutoTest batch crashed`). Include the `log_tail` from the status response. `task_results.jsonl` is unavailable.
318
- - **TIMEOUT**: After killing, write TIMEOUT report with sentinel (`status: FAIL` / `reason: AutoTest batch timed out after N polls`) and include partial results from `task_results.jsonl` if any cases finished.
319
-
320
- ### T8 — Read results after completion
321
-
322
- After `COMPLETED`:
323
- 1. Read stdout log from `<output_path>/self_test_*.log` (full runner log).
324
- 2. Read `task_results.jsonl` from `task_subdir`. Each line is a JSON object with fields: `exec_index`, `case_name`, `report_dir`, `status` (PASS / FAIL / UNKNOWN), `reason`, `duration_seconds`, etc.
325
- - `report_dir` is the absolute path to that case's execution directory. You MUST include this as `**AutoTest 任务路径**` in the report for EVERY case.
326
- - **Status semantics**: `PASS` = AutoTest rendered a PASS badge. `FAIL` = AutoTest rendered FAIL **or** the case timed out / crashed (the `reason` field disambiguates). `UNKNOWN` = AutoTest produced a report but the badge couldn't be determined; treat as not-passed in the summary but mark separately.
327
- 3. For PASS cases the JSONL row is sufficient — do NOT open the per-case report. For FAIL / UNKNOWN cases with empty `reason`, you may peek at the runner log of last resort:
328
-
329
- ```bash
330
- tail -40 "<report_dir>/agent.log"
331
- ```
332
-
333
- This caps token usage. **Do NOT read full HTML / MD / JSON per-case reports** — they are very large (10KB–200KB) and meant for human users.
334
-
335
- > 🚨 **Do NOT modify test cases after execution**: FAIL / UNKNOWN means the HAP application does not support that functionality (or the agent could not verify it) — it is NOT a test case defect. Record the result as-is; do NOT edit, regenerate, or rewrite `testcases.json`.
336
-
337
- ### T9 — Generate self-test-report.md
338
-
339
- > 🚨 **Do NOT compose the report markdown yourself.** Use `report_tool.py`.
18
+ ## Expected Input
340
19
 
341
- **Collect inputs:**
342
- - `<suite_name>` — read the first non-empty line of `test_case.md` (typically `# <title>`). Strip leading `#` and whitespace. When `setup=false`, `test_case.md` may not be at a known path; in that case use the `suite_name` field from `task_results.jsonl`'s first entry if present, else use `bundle_name` as a fallback.
343
- - `<device_serial>` — from T3.
344
- - `<hap_basename>` — basename of hap_path.
345
- - `<task_subdir>` — from T7 status response.
20
+ The caller passes these **kebab-case** params (they match the `hmos-integration-test` skill's input table 1:1 — this wrapper is a pure pass-through, no translation):
346
21
 
347
- **Run the renderer:**
22
+ | Parameter | Required | Description |
23
+ |-----------|----------|-------------|
24
+ | `hap-path` | yes | Package set (entry HAP + any in-app HSPs / feature HAPs); file / dir / comma-list. Always installed via `hdc uninstall` + `hdc install -r`. |
25
+ | `output-path` | yes | Root output dir for all artifacts (`testcases.json`, `app-metadata.json`, `_extracted.json`, `self-test-report.md`, `task/`) |
26
+ | `project-dir` | round 1 | HarmonyOS project root (含 `AppScope/app.json5`) for resolve-metadata; auto-derived from `hap-path`/`test-case-path` when omitted |
27
+ | `test-case-path` | round 1 | Path to `test_case.md` |
28
+ | `pre-test-case-path` | optional | Path to `pre_test_case.md`; auto-discovered in `test-case-path`'s dir when omitted |
348
29
 
349
- ```bash
350
- cd "<autotest_dir>" && uv run python report_tool.py generate \
351
- --task-subdir "<task_subdir>" \
352
- --app-metadata "<output_path>/app-metadata.json" \
353
- --hap "<hap_path>" \
354
- --device "<device_serial>" \
355
- --suite "<suite_name>" \
356
- --out "<output_path>/self-test-report.md" \
357
- --validate
358
- ```
30
+ > **No `setup` parameter.** Round 1 runs the parse phase (writes `testcases.json` + `app-metadata.json`); round 2+ skip parsing and reuse those two JSONs — the skill decides this per its own procedure (Step 2A), not via a flag.
359
31
 
360
- - `VALIDATION PASSED` → done.
361
- - `VALIDATION FAILED` → fix upstream data and re-run; do NOT hand-write the report.
32
+ > **Fix loop**: this wrapper runs a single test pass and does **not** forward `max-rounds` / `android-project-path`. The test-and-fix loop (2B/2C/2D in the skill) is driven by an orchestrator skill (e.g. `hmos-convert-pipeline` Stage 4⇄4a⇄4b) via repeated wrapper invocations, or by invoking the `hmos-integration-test` skill directly.
362
33
 
363
- To re-validate an existing report without regenerating it (debugging only):
34
+ ## How to run
364
35
 
365
- ```bash
366
- cd "<autotest_dir>" && uv run python report_tool.py validate "<output_path>/self-test-report.md"
367
- ```
36
+ 1. Load the `hmos-integration-test` skill. Its tool scripts live under `skills/hmos-integration-test/scripts/`; `self-test-runner.ts` resolves `@autotest/agent`'s `batch_runner.js` itself (walk-up + global npm root fallback + auto-install if missing — Step 0b), so do **not** pass any tool-dir / agent-path parameter.
37
+ 2. Follow the skill's `SKILL.md` procedure exactly for the inputs above. In particular:
38
+ - Do **not** pass `--mode` manually — `self-test-runner.ts` auto-reads `agent.mode` from `~/.hometrans/autotest.yaml` and forwards it to `batch_runner`.
39
+ - Pre-cases (`pre_test_case.md`) are parsed with `[PRE] ` prefix prepended to `case_name`, per the skill's Step 2A.
40
+ 3. The skill writes: `<output-path>/self-test-report.md`, `<output-path>/task/task_<ts>/`, and (round 1 only) `<output-path>/testcases.json` + `<output-path>/app-metadata.json` + `<output-path>/_extracted.json`.
368
41
 
369
- **Pre-case rendering**: Rows with `case_name` starting with `[PRE] ` go into `## 前置用例`. All others go into `## 用例详情`. Pre indices and Case indices each start at 1 within their own section (`### Pre 1:`, `### Case 1:`). The script emits these forms automatically — do NOT hand-edit to `### Case PRE-1:` or any other variant; the validator will reject it.
42
+ ## Expected Output (report back to the caller)
370
43
 
371
- > **What pre-cases are (and aren't) — context downstream agents MUST respect**:
372
- > Pre-cases are **data/environment setup scripts** (e.g., import a test track, grant permissions, skip onboarding). They are NOT feature scenarios under test. A pre-case FAIL almost always indicates a testing-environment issue (missing media, ungranted permission, system file-picker glitch), **NOT an application defect**. That is why the report:
373
- > - surfaces **常规通过率** (regular-only pass rate) as the primary quality metric in `## 测试概览` and `## 测试总结`;
374
- > - keeps `含前置通过率` only as a secondary reference with an explicit disclaimer;
375
- > - tells the 建议 reader that pre-failures should be treated as environment problems first, and only enter the fix flow if a white-box review confirms a real code bug.
376
- >
377
- > Downstream agents — especially `self-test-fixer` — must respect this framing: **do not modify application code based on a pre-case failure unless white-box review concludes the failure surfaces a genuine app defect**. This rationale is intentional and load-bearing; do not collapse it into a one-liner.
44
+ Report back concisely (do not stream large file contents into the caller's context):
378
45
 
379
- ---
46
+ - **Terminal status** from the skill's self-test-runner: `COMPLETED` (with `pass_count` / `fail_count` / `unknown_count` / `pass_rate` / `task_subdir`) | `CRASHED` | `TIMEOUT` | `FAILED` | `NOT_STARTED`.
47
+ - **Path** to `<output-path>/self-test-report.md`.
48
+ - **Early-exit (environmental) failures**: the sentinel `reason:` line (config / device / `@autotest/agent` missing + auto-install failed / batch crash / precondition failure). These are **NOT application defects** — do NOT enter the fix flow; surface the reason so the user can fix the environment. (The skill, not this agent, decides `stop_reason = agent_early_exit` from the sentinel `reason:`.)
49
+ - Do **not** read full per-case HTML/MD/JSON reports back into the caller — they are large (10KB–200KB); point the caller to the files / `task_subdir`.
380
50
 
381
- ## Guidelines
51
+ ## Constraints
382
52
 
383
- - **#1 — Use `self_test_runner.py` for run and status**: Always use `self_test_runner.py run` to perform setup + start batch as a detached process, then `self_test_runner.py status` to poll. This ensures the test process survives agent session termination.
384
- - **#2 — Every case MUST include `**AutoTest 任务路径**`**: the absolute `report_dir` from `task_results.jsonl`. Without it the report is incomplete and users cannot locate execution artifacts. After T9, verify every case section contains this field.
385
- - **Two-phase architecture**: When the parse phase runs, the LLM writes `_extracted.json` → `testcases_tool.py` writes `testcases.json`. Never write `testcases.json` directly. If `testcases.json` already exists at the output path and the parse phase runs, `testcases_tool.py` overwrites it — never skip the script.
386
- - **App name → bundle_name is critical**: `test_steps` must use `bundle_name` (e.g., `com.example.tuku`), NOT the display name. AutoTest uses this to launch the correct app. Using the display name instead may launch the wrong app entirely.
387
- - **JSON contract**: `app-metadata.json` and `testcases.json` always live at `<output_path>/app-metadata.json` and `<output_path>/testcases.json`. T2 reads from the file (not from memory).
388
- - **AutoTest directory locator**: Resolve `<HOMETRANS_TOOL_PATH>/test-tools/autotest` from the `HOMETRANS_TOOL_PATH` OS environment variable → walking up from `<output_path>` (see Shared Utilities). Do not assume `$(pwd)` is anchored anywhere in particular.
389
- - **Sentinel-format early-exit reports**: When T1 / T3 / T4 / T7 write a degraded FAIL report (config error, no device, missing autotest dir, crashed batch, timeout, or `setup=false` precondition failure), the report's first non-frontmatter line MUST be `status: FAIL` and the second MUST be `reason: <one-line reason>`. This lets callers detect early-exit reports without parsing a case table.
390
- - **Quote all paths** — paths may contain spaces.
391
- - **Capture complete output** — never truncate command output; it is essential for diagnosis.
392
- - **Do NOT read AutoTest internals** — the instructions above provide the complete calling convention. Do not spend time reading installed `AutoTest` modules or `self_test_runner.py` source code to "understand" how they work.
393
- - **Do NOT hand-write reports** — `report_tool.py generate --validate` renders all reports. Hand-writing bypasses the validator that downstream `self-test-fixer` relies on.
394
- - **Validate is the gate**: S5 `VALIDATION PASSED` and T9 `VALIDATION PASSED` are the completion signals.
395
- - **Do NOT modify test cases after execution**: Failures indicate HAP functionality gaps, not test case defects. Record results as-is.
396
- - **Pre-cases are environment scripts, not feature scenarios**: their failures usually indicate environment issues. The **常规通过率** (regular-only pass rate) is the primary quality metric; `self-test-fixer` must not modify application code based on a pre-case failure unless white-box review confirms a real defect.
53
+ - **Single source of truth**: `hmos-integration-test/SKILL.md` is authoritative; this wrapper only wires params + reports results.
54
+ - **No procedure duplication**: if you find yourself spelling out `resolve-metadata-tool` / `testcases-tool` / `self-test-runner` / `report-tool` commands here, stop — that belongs in the skill, not here. The skill uses `$SKILL_SCRIPTS/<script>.ts` (no `$TOOL_DIR`, no `run`/`generate` subcommand keywords — flat `--` args + `--status`).
55
+ - **Pre-cases are environment setup, not app defects**: surface `常规通过率` (regular-only pass rate) as the quality metric; pre-case failures go to the fix flow only after white-box confirmation (per `self-test-fixer`).