android2harmony 0.1.7 → 0.1.8

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 (226) hide show
  1. package/agents/api-analyzer.md +113 -0
  2. package/agents/app-action.md +122 -0
  3. package/agents/code-reviewer.md +191 -295
  4. package/agents/coder.md +377 -0
  5. package/agents/self-tester.md +8 -8
  6. package/agents/spec-designer.md +56 -0
  7. package/package.json +1 -1
  8. package/skills/a2h-app-req-gen/SKILL.md +174 -0
  9. package/skills/a2h-app-req-gen/references/spec-handoff.md +99 -0
  10. package/skills/a2h-app-req-gen/references/subagent-render.md +115 -0
  11. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/build.gradle.kts +41 -0
  12. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradle/wrapper/gradle-wrapper.jar +0 -0
  13. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradle/wrapper/gradle-wrapper.properties +8 -0
  14. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradle.properties +3 -0
  15. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradlew +251 -0
  16. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/gradlew.bat +94 -0
  17. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/settings.gradle.kts +17 -0
  18. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawAnalysisDetector.java +1911 -0
  19. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawIssueRegistry.java +37 -0
  20. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawJson.java +146 -0
  21. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawLocation.java +96 -0
  22. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/java/dev/reqgen/analyzer/jvm/RawRecordWriter.java +227 -0
  23. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/resources/META-INF/services/com.android.tools.lint.client.api.IssueRegistry +1 -0
  24. package/skills/a2h-app-req-gen/scripts/reqgen/analyzer-jvm/src/main/resources/dev/reqgen/analyzer/jvm/raw-record-v1.schema.json +93 -0
  25. package/skills/a2h-app-req-gen/scripts/reqgen/assets/dashboard.html +151 -0
  26. package/skills/a2h-app-req-gen/scripts/reqgen/gradle/reqgen-lint.init.gradle +60 -0
  27. package/skills/a2h-app-req-gen/scripts/reqgen/gradle/reqgen-model.init.gradle +204 -0
  28. package/skills/a2h-app-req-gen/scripts/reqgen/package.json +14 -0
  29. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/backend.js +323 -0
  30. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/cli.js +811 -0
  31. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/gap-audit-link.js +62 -0
  32. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/index.js +66 -0
  33. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/merge.js +605 -0
  34. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/name-trace.js +153 -0
  35. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/orchestrate.js +1324 -0
  36. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/output-parse.js +50 -0
  37. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/overview.js +10 -0
  38. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/pool.js +23 -0
  39. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/post-merge-fix.js +146 -0
  40. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/prompt-loader.js +51 -0
  41. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/prompt.js +967 -0
  42. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/prompts.md +301 -0
  43. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/serve.js +78 -0
  44. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/short-id.js +46 -0
  45. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/snapshot.js +267 -0
  46. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/types.js +1 -0
  47. package/skills/a2h-app-req-gen/scripts/reqgen/src/agent-render/validate.js +122 -0
  48. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/callback-call-sites.js +62 -0
  49. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/gap-audit/build.js +1291 -0
  50. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/gap-audit/index.js +1 -0
  51. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/area-ownership.js +392 -0
  52. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/build.js +1995 -0
  53. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/callback-flow.js +277 -0
  54. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/component-variants.js +725 -0
  55. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/graph/index.js +15 -0
  56. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/names/index.js +12 -0
  57. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/names/policy.js +469 -0
  58. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/names/traceability.js +468 -0
  59. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/req-model/build.js +1066 -0
  60. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/req-model/index.js +1 -0
  61. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/android-interaction-registry.js +174 -0
  62. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/android.js +1062 -0
  63. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/area-titles.js +678 -0
  64. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/builder.js +350 -0
  65. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/compose-api-registry.js +395 -0
  66. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/compose-call-sites.js +2008 -0
  67. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/compose.js +9059 -0
  68. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/dynamic-repeated-call-sites.js +529 -0
  69. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/index.js +1 -0
  70. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/interaction-effects.js +1149 -0
  71. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/jvm.js +6272 -0
  72. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/normalize.js +33 -0
  73. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/pending-intents.js +565 -0
  74. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/resource-id.js +42 -0
  75. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/route-state-variants.js +781 -0
  76. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/state.js +234 -0
  77. package/skills/a2h-app-req-gen/scripts/reqgen/src/analysis/source-facts/types.js +1 -0
  78. package/skills/a2h-app-req-gen/scripts/reqgen/src/android/extract.js +40 -0
  79. package/skills/a2h-app-req-gen/scripts/reqgen/src/android/index.js +6 -0
  80. package/skills/a2h-app-req-gen/scripts/reqgen/src/android/manifest.js +513 -0
  81. package/skills/a2h-app-req-gen/scripts/reqgen/src/android/resources.js +398 -0
  82. package/skills/a2h-app-req-gen/scripts/reqgen/src/android/types.js +1 -0
  83. package/skills/a2h-app-req-gen/scripts/reqgen/src/android/views.js +447 -0
  84. package/skills/a2h-app-req-gen/scripts/reqgen/src/android/xml-parser.js +175 -0
  85. package/skills/a2h-app-req-gen/scripts/reqgen/src/cli.js +398 -0
  86. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/area-graph.js +1 -0
  87. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/artifact.js +1 -0
  88. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/common.js +16 -0
  89. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/diagnostic.js +10 -0
  90. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/gap-audit.js +14 -0
  91. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/index.js +11 -0
  92. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/name-traceability.js +26 -0
  93. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/raw-fact.js +40 -0
  94. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/req-model.js +1 -0
  95. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/run.js +19 -0
  96. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/semantic-completeness.js +11 -0
  97. package/skills/a2h-app-req-gen/scripts/reqgen/src/contracts/source-facts.js +1 -0
  98. package/skills/a2h-app-req-gen/scripts/reqgen/src/core/output-guard.js +41 -0
  99. package/skills/a2h-app-req-gen/scripts/reqgen/src/core/stable-id.js +92 -0
  100. package/skills/a2h-app-req-gen/scripts/reqgen/src/dashboard-cli.js +169 -0
  101. package/skills/a2h-app-req-gen/scripts/reqgen/src/diagnostics.js +104 -0
  102. package/skills/a2h-app-req-gen/scripts/reqgen/src/dump/dump.js +1028 -0
  103. package/skills/a2h-app-req-gen/scripts/reqgen/src/dump/index.js +1 -0
  104. package/skills/a2h-app-req-gen/scripts/reqgen/src/dump-cli.js +251 -0
  105. package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/artifacts.js +49 -0
  106. package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/index.js +18 -0
  107. package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/quality-report.js +125 -0
  108. package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/render.js +353 -0
  109. package/skills/a2h-app-req-gen/scripts/reqgen/src/generation/types.js +2 -0
  110. package/skills/a2h-app-req-gen/scripts/reqgen/src/graph/paths.js +474 -0
  111. package/skills/a2h-app-req-gen/scripts/reqgen/src/jvm/index.js +15 -0
  112. package/skills/a2h-app-req-gen/scripts/reqgen/src/jvm/protocol.js +408 -0
  113. package/skills/a2h-app-req-gen/scripts/reqgen/src/jvm/runner.js +452 -0
  114. package/skills/a2h-app-req-gen/scripts/reqgen/src/pipeline/index.js +8 -0
  115. package/skills/a2h-app-req-gen/scripts/reqgen/src/pipeline/output.js +165 -0
  116. package/skills/a2h-app-req-gen/scripts/reqgen/src/pipeline/run-stage1.js +891 -0
  117. package/skills/a2h-app-req-gen/scripts/reqgen/src/project/discovery.js +299 -0
  118. package/skills/a2h-app-req-gen/scripts/reqgen/src/project/gradle-model.js +358 -0
  119. package/skills/a2h-app-req-gen/scripts/reqgen/src/project/gradle-runner.js +165 -0
  120. package/skills/a2h-app-req-gen/scripts/reqgen/src/project/resource-profile.js +60 -0
  121. package/skills/a2h-app-req-gen/scripts/reqgen/src/project/types.js +1 -0
  122. package/skills/a2h-app-req-gen/scripts/reqgen/src/spec-handoff-cli.js +151 -0
  123. package/skills/a2h-app-req-gen/scripts/reqgen/src/spec-handoff.js +1004 -0
  124. package/skills/a2h-app-req-gen/scripts/reqgen/src/stage2-cli.js +109 -0
  125. package/skills/a2h-app-req-gen/scripts/reqgen/src/stage2-input.js +419 -0
  126. package/skills/a2h-app-req-gen/scripts/reqgen/src/stage2-name-trace-input.js +95 -0
  127. package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/area-graph.js +444 -0
  128. package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/index.js +7 -0
  129. package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/req-model.js +580 -0
  130. package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/req-text.js +195 -0
  131. package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/semantic-area-graph.js +1431 -0
  132. package/skills/a2h-app-req-gen/scripts/reqgen/src/validation/types.js +1 -0
  133. package/skills/a2h-app-req-gen/scripts/reqgen-audit.mjs +298 -0
  134. package/skills/a2h-app-req-gen/scripts/reqgen-selfcheck.mjs +555 -0
  135. package/skills/a2h-code-review/SKILL.md +379 -0
  136. package/skills/{hmos-integration-test → a2h-integration-test}/README.md +6 -6
  137. package/skills/{hmos-integration-test → a2h-integration-test}/SKILL.md +6 -6
  138. package/skills/{hmos-integration-test → a2h-integration-test}/scripts/report-tool.mjs +1 -1
  139. package/skills/a2h-spec-design/SKILL.md +330 -0
  140. package/skills/a2h-spec-design/scripts/inspect_spec_design_inputs.mjs +207 -0
  141. package/skills/a2h-spec-design/scripts/move_spec_technical_reference.mjs +198 -0
  142. package/skills/a2h-spec-design/scripts/validate_spec_design_output.mjs +256 -0
  143. package/skills/a2h-spec-generate/SKILL.md +696 -0
  144. package/skills/a2h-spec-generate/references/trace-template.md +115 -0
  145. package/skills/a2h-spec-generate/scripts/parse_requirements.mjs +537 -0
  146. package/skills/a2h-spec-generate/template/REQ.txt +22 -0
  147. package/skills/a2h-spec-generate/template/REQ.xlsx +0 -0
  148. package/skills/a2h-spec-implement/SKILL.md +548 -0
  149. package/skills/a2h-spec-implement/references/harmony-pitfalls.md +186 -0
  150. package/skills/a2h-spec-implement/references/l1-unit-test.md +185 -0
  151. package/skills/a2h-spec-implement/references/l3-e2e-uitest.md +167 -0
  152. package/skills/a2h-spec-implement/references/test-core.md +132 -0
  153. package/skills/a2h-spec-implement/rules/arkts/arkts-standards.md +184 -0
  154. package/skills/a2h-spec-implement/rules/arkts/conventions/coding-style.md +96 -0
  155. package/skills/a2h-spec-implement/rules/arkts/conventions/security.md +126 -0
  156. package/skills/a2h-spec-implement/rules/arkts/language/arkts-rules.md +650 -0
  157. package/skills/a2h-spec-implement/rules/arkts/language/arkui-structure-rules.md +173 -0
  158. package/skills/a2h-spec-implement/rules/arkts/language/ts-to-arkts-rewrites.md +58 -0
  159. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@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 -0
  160. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@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 +2089 -0
  161. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@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 -0
  162. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@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 -0
  163. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@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 -0
  164. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@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 -0
  165. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/@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 -0
  166. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/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 +903 -0
  167. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
  168. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/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 -0
  169. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
  170. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1/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 +355 -0
  171. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v1//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 -0
  172. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +216 -0
  173. package/skills/a2h-spec-implement/rules/arkts/official/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 +442 -0
  174. package/skills/a2h-spec-implement/rules/arkts/official/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 +169 -0
  175. package/skills/a2h-spec-implement/rules/arkts/official/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 +763 -0
  176. package/skills/a2h-spec-implement/rules/arkts/official/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 +2088 -0
  177. package/skills/a2h-spec-implement/rules/arkts/official/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 +1258 -0
  178. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Once/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 +175 -0
  179. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/@Param/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +850 -0
  180. package/skills/a2h-spec-implement/rules/arkts/official/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 +862 -0
  181. package/skills/a2h-spec-implement/rules/arkts/official/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 +110 -0
  182. package/skills/a2h-spec-implement/rules/arkts/official/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 +301 -0
  183. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1411 -0
  184. package/skills/a2h-spec-implement/rules/arkts/official/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 +1392 -0
  185. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/getTarget/346/216/245/345/217/243/357/274/232/350/216/267/345/217/226/347/212/266/346/200/201/347/256/241/347/220/206/346/241/206/346/236/266/344/273/243/347/220/206/345/211/215/347/232/204/345/216/237/345/247/213/345/257/271/350/261/241.md +288 -0
  186. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2/makeObserved/346/216/245/345/217/243/357/274/232/345/260/206/351/235/236/350/247/202/345/257/237/346/225/260/346/215/256/345/217/230/344/270/272/345/217/257/350/247/202/345/257/237/346/225/260/346/215/256.md +768 -0
  187. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/222/214V2/346/267/267/347/224/250/346/214/207/345/257/274/357/274/210API version 19/345/217/212/344/271/213/345/220/216/357/274/211.md" +829 -0
  188. package/skills/a2h-spec-implement/rules/arkts/official/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206/346/246/202/350/277/260.md +184 -0
  189. package/skills/a2h-spec-implement/rules/arkts/ui/component-cookbook.md +431 -0
  190. package/skills/a2h-spec-implement/rules/arkts/ui/state-management.md +152 -0
  191. package/skills/a2h-spec-implement/rules/arkts/ui/ui-quality.md +67 -0
  192. package/skills/a2h-spec-implement/rules/arkts/ui/ui-runtime-diagnosis.md +32 -0
  193. package/skills/a2h-spec-implement/rules/pipeline/build/package-set-collection.md +43 -0
  194. package/skills/a2h-spec-implement/scripts/_lib/common.mjs +97 -0
  195. package/skills/a2h-spec-implement/scripts/_lib/config.mjs +70 -0
  196. package/skills/a2h-spec-implement/scripts/_lib/lessons_cli.mjs +48 -0
  197. package/skills/a2h-spec-implement/scripts/build_lessons.mjs +24 -0
  198. package/skills/a2h-spec-implement/scripts/code_pattern_lessons.mjs +26 -0
  199. package/skills/a2h-spec-implement/scripts/device_ui.mjs +433 -0
  200. package/skills/a2h-spec-implement/scripts/device_ui_core.mjs +895 -0
  201. package/skills/a2h-spec-implement/scripts/ledger/aggregate_run.mjs +207 -0
  202. package/skills/a2h-spec-implement/scripts/manifest/emit_summary_line.mjs +37 -0
  203. package/skills/a2h-spec-implement/scripts/manifest/finalize_run.mjs +115 -0
  204. package/skills/a2h-spec-implement/scripts/manifest/render_final_summary.mjs +78 -0
  205. package/skills/a2h-spec-implement/scripts/manifest/root_mirror.mjs +137 -0
  206. package/skills/a2h-spec-implement/scripts/package.json +12 -0
  207. package/skills/a2h-spec-implement/scripts/state_propagation_check.mjs +676 -0
  208. package/skills/a2h-spec-implement/scripts/test/l2_run.mjs +244 -0
  209. package/skills/a2h-spec-implement/scripts/test/tp_coverage.mjs +231 -0
  210. package/skills/a2h-spec-implement/scripts/ui_memory.mjs +161 -0
  211. package/skills/a2h-spec-implement/scripts/utils/ensure_app.mjs +134 -0
  212. package/skills/a2h-ui-transfer/SKILL.md +2 -2
  213. package/skills/hmos-convert-pipeline/SKILL.md +7 -5
  214. package/skills/hmos-incremental-ui-align/README.md +7 -7
  215. package/skills/hmos-incremental-ui-align/SKILL.md +1 -1
  216. package/skills/hmos-incremental-ui-align/page_align.md +1 -1
  217. package/skills/hmos-spec-generate/SKILL.md +2 -2
  218. package/skills/hmos-spec-generate/scripts/parse_requirements.mjs +537 -0
  219. package/skills/hmos-fix-build-errors/SKILL.md +0 -266
  220. package/skills/hmos-fix-build-errors/references/arkts-strict-patterns.md +0 -219
  221. package/skills/hmos-fix-build-errors/references/known-patterns.md +0 -157
  222. package/skills/hmos-fix-build-errors/references/rdb-entity-pattern.md +0 -131
  223. package/skills/hmos-spec-generate/scripts/parse_requirements.ts +0 -515
  224. /package/skills/{hmos-integration-test → a2h-integration-test}/scripts/resolve-metadata-tool.mjs +0 -0
  225. /package/skills/{hmos-integration-test → a2h-integration-test}/scripts/self-test-runner.mjs +0 -0
  226. /package/skills/{hmos-integration-test → a2h-integration-test}/scripts/testcases-tool.mjs +0 -0
@@ -1,266 +0,0 @@
1
- ---
2
- name: hmos-fix-build-errors
3
- description: Build a HarmonyOS project via CLI and automatically fix compile errors in a loop until the build succeeds. Default unsigned HAP; pass --signed to build a signed HAP (signing config must already exist in the project's build-profile.json5). Allowed to be called only in Android-to-HarmonyOS migration scenarios.
4
- argument-hint: <harmony_project_dir> [deveco-studio-path] [--signed]
5
- allowed-tools: Agent, Read, Write, Edit, Glob, Grep, Bash
6
- type: tool
7
- domain: engineering
8
- ---
9
-
10
- # HarmonyOS Auto Build & Fix
11
-
12
- Automatically build a HarmonyOS NEXT project from the command line, parse compile errors, fix them, and retry — repeating until the build succeeds.
13
-
14
- ## Inputs
15
-
16
- Declare all inputs up front as explicit `snake_case` variables, bound to the positional `$ARGUMENTS`:
17
-
18
- | Variable | Positional | Required | Meaning |
19
- |---|---|---|---|
20
- | `harmony_project_dir` | `$ARGUMENTS[0]` | yes | HarmonyOS project root, e.g. `D:/MyHmosApp` |
21
- | `deveco_studio_path` | `$ARGUMENTS[1]` | no | DevEco Studio installation root, e.g. `D:/DevEco Studio`. When omitted, resolved automatically (see Step 0.2) |
22
- | `signed` | `--signed` flag | no | If any argument equals `--signed`, build a **signed HAP**; otherwise build an **unsigned HAP** (default) |
23
-
24
- Note: `--signed` is a positional-order-independent flag — when `deveco_studio_path` is omitted it may appear as `$ARGUMENTS[1]`, and when provided it appears as `$ARGUMENTS[2]`.
25
-
26
- ---
27
-
28
- ## Step 0: Validate Inputs & Setup Environment
29
-
30
- 1. **Verify project exists** — Check that `harmony_project_dir` contains a valid HarmonyOS project (look for `build-profile.json5`, `entry/src` directory, `oh-package.json5`).
31
-
32
- 2. **Resolve `<deveco-path>`** — follow the resolution chain, stopping at the first source that yields a valid path (environment variable only, else ask):
33
- 1. `deveco_studio_path` if provided (and not `--signed`).
34
- 2. **OS environment variable** `DEVECO_SDK_HOME` (`echo "$DEVECO_SDK_HOME"` on macOS/Linux; `$env:DEVECO_SDK_HOME` in PowerShell on Windows) — the DevEco SDK root (e.g. `D:/DevEco Studio/sdk`); derive `<deveco-path>` as its parent directory (the DevEco Studio install root).
35
- 3. **Ask the user** for the DevEco Studio install path (suggest setting `DEVECO_SDK_HOME` as a machine environment variable).
36
-
37
- **Verify the resolved `<deveco-path>`** contains:
38
- - `tools/node/node.exe`
39
- - `tools/hvigor/bin/hvigorw.js`
40
- - `tools/ohpm/bin/ohpm`
41
- - `sdk/` directory
42
-
43
- If verification fails for an env-sourced path, treat that source as invalid and continue down the list; if it fails for a user-supplied path, report what is missing and ask again.
44
-
45
- 3. **Set up `local.properties`** — Ensure the project root has `local.properties` with:
46
- ```properties
47
- hwsdk.dir=<deveco-path>/sdk
48
- ```
49
- Create it if missing. Use forward slashes in the path.
50
-
51
- 4. **Use `npx --yes devecocli build` as the build entrypoint** — The build-fix loop should call `npx --yes devecocli build` rather than invoking `ohpm` or `hvigorw.js` directly. `npx --yes devecocli build` wraps dependency install (`ohpm install`) and the underlying hvigor build.
52
-
53
- 5. **Determine Build Mode** — Check if any argument equals `--signed` (it may be `$ARGUMENTS[1]` when the DevEco path is omitted, or `$ARGUMENTS[2]` when it is provided):
54
- - **If NOT `--signed`** → **Unsigned build mode**. Ensure `build-profile.json5` does NOT have `signingConfigs` or `signingConfig` references in products (remove them if present). Go to Step 1.
55
- - **If `--signed`** → **Signed build mode**. Proceed to Step 0.5 to validate signing config before the Step 1 build loop invokes `npx --yes devecocli build`.
56
-
57
- ---
58
-
59
- ## Step 0.5: Validate Signing Config (Only for --signed Builds)
60
-
61
- This step is ONLY executed when `--signed` is specified.
62
-
63
- Signing information is read directly from the project's own `build-profile.json5`. The user must have already configured signing in DevEco Studio before running this skill.
64
-
65
- ### Steps:
66
-
67
- 1. **Read `build-profile.json5`** in the project root.
68
-
69
- 2. **Check for `signingConfigs`** — Look for `app.signingConfigs` array in the file.
70
- - If `signingConfigs` exists and has at least one entry with valid `material` fields (`certpath`, `storeFile`, `profile`), proceed to step 3.
71
- - If `signingConfigs` is missing or empty, **STOP and report to the user**:
72
- > Signing configuration not found in `build-profile.json5`.
73
- > Please open the project in DevEco Studio, go to **File → Project Structure → Signing Configs**, enable **Automatically generate signature**, then re-run this skill with `--signed`.
74
-
75
- 3. **Validate signing material files exist** — For the first entry in `signingConfigs`, check that the files referenced by `material.certpath`, `material.storeFile`, and `material.profile` actually exist on disk.
76
- - If any file is missing, **STOP and report** which files are missing. Suggest the user re-open DevEco Studio and re-generate the signing config.
77
-
78
- 4. **Ensure product references signing** — Check that the product entry in `products` array has `"signingConfig": "default"` (or matching the signing config name). Add it if missing.
79
-
80
- 5. Proceed to Step 1.
81
-
82
- ---
83
-
84
- ## Step 1: Build-Fix Loop
85
-
86
- Execute the following loop. **Maximum 20 iterations** to prevent infinite loops.
87
-
88
- ### 1.1 Run CLI Build
89
-
90
- Use `npx --yes devecocli build` as the build command inside the fix loop. It is the supported wrapper for dependency install and hvigor execution, so the skill should not instruct raw `hvigorw.js` calls.
91
-
92
- 1. **Invoke `npx --yes devecocli build` from the project root**:
93
-
94
- **For unsigned builds** (no `--signed`):
95
- ```bash
96
- cd "<project-dir>"
97
- npx --yes devecocli build
98
- ```
99
- If the project needs an explicit module target, prefer:
100
- ```bash
101
- cd "<project-dir>"
102
- npx --yes devecocli build --modules entry
103
- ```
104
-
105
- **For signed builds** (`--signed`):
106
- ```bash
107
- cd "<project-dir>"
108
- npx --yes devecocli build
109
- ```
110
- Run this only after Step 0.5 verifies the signing config in `build-profile.json5`. Preserve any required signed-build environment setup (for example `JAVA_HOME` on Windows) before invoking `npx --yes devecocli build`, but do not bypass the CLI wrapper.
111
-
112
- 2. **Capture the full output** into a variable.
113
-
114
- - The build command may take 1-3 minutes. Use a timeout of 300000ms (5 minutes).
115
-
116
- ### 1.2 Check Build Result
117
-
118
- - If output contains `BUILD SUCCESSFUL` → **Build succeeded!** Exit the loop, go to Step 2.
119
- - If output contains `ERROR` or `BUILD FAILED` → Parse errors and continue to 1.3.
120
-
121
- ### 1.3 Parse Errors
122
-
123
- Extract error information from the build output. Errors typically appear in these formats:
124
-
125
- ```
126
- ERROR: <file-path>:<line>:<col> - <error-code>: <message>
127
- ```
128
-
129
- or
130
-
131
- ```
132
- ArkTS:ERROR File: <file-path>:<line>:<col>
133
- <error message>
134
- ```
135
-
136
- Group errors by file. Focus on **actual errors**, not warnings.
137
-
138
- ### 1.4 Fix Errors
139
-
140
- Read each file that has errors and apply fixes. Use the error reference table below to identify and fix common issues:
141
-
142
- | Error Code / Pattern | Message | Fix |
143
- |---|---|---|
144
- | `arkts-limited-throw` | "throw statements cannot accept values of arbitrary types" | Change `throw err` to `throw (err instanceof Error) ? err : new Error(String(err))` |
145
- | `arkts-no-obj-literals-as-types` | "Object literals cannot be used as type declarations" | Define a named `interface` instead of inline `{ key: Type }` |
146
- | `arkts-no-untyped-obj-literals` | "Object literal must correspond to some explicitly declared class or interface" | Assign to typed variable: `const r: MyInterface = {...}; return r;` |
147
- | `arkts-no-any-type` / `any` type usage | "Use explicit types instead of any" | Replace `any` with the correct concrete type or `object` |
148
- | `arkts-no-var` | "Use 'let' or 'const' instead of 'var'" | Replace `var` with `let` or `const` |
149
- | `10903329` | "Unknown resource name 'xxx'" | Verify resource exists in `resources/base/media/` or `element/*.json`. Use `layered_image` as fallback for missing images. **Special case**: `$r('sys.media.ohos_ic_public_xxx')` references system icons by SDK-specific names that may not exist in the build SDK — replace with `$r('app.media.ic_public_xxx')` and add the icon file to `resources/base/media/` |
150
- | `10505001` | "Resource[] is not assignable to ResourceColor" | Remove array brackets: `.fontColor($r('app.color.x'))` not `.fontColor([$r('app.color.x')])` |
151
- | `00303221` | "permission must be a value that is predefined within the SDK" | Remove invalid permission from `module.json5`. See valid permissions list below |
152
- | Missing import | "Cannot find name 'xxx'" | Add the correct import (see import reference below) |
153
- | Missing `async` | "await expression requires async function" | Add `async` to the enclosing function |
154
- | Missing `build()` | "@Component must have build() method" | Add a `build() {}` method to the @Component struct |
155
- | Type mismatch | Various type errors | Fix the type annotation or cast appropriately |
156
- | Duplicate identifier | "Duplicate identifier 'xxx'" | Remove or rename the duplicate declaration |
157
-
158
- **For errors NOT in the table above**: Read the error message carefully, read the relevant source file, understand the context, and apply an appropriate fix. Use your knowledge of ArkTS/HarmonyOS to determine the correct solution.
159
-
160
- ### 1.5 Log Progress
161
-
162
- After each fix iteration, briefly report:
163
- - Iteration number
164
- - Number of errors found
165
- - Summary of fixes applied
166
- - Whether re-building
167
-
168
- Then go back to **1.1** and rebuild.
169
-
170
- ---
171
-
172
- ## Step 2: Build Success Report
173
-
174
- When the build succeeds, present a summary:
175
-
176
- 1. **Build Status**: SUCCESS
177
- 2. **Build Type**: Signed HAP or Unsigned HAP
178
- 3. **Signing** (if signed): Confirm signing config from `build-profile.json5` was used
179
- 4. **Iterations**: How many build-fix cycles were needed
180
- 5. **Total Errors Fixed**: Count of errors fixed across all iterations
181
- 6. **Summary of Changes**: List of files modified and what was fixed in each
182
- 7. **Output HAP Path**:
183
- - Signed: `<project>/entry/build/default/outputs/default/entry-default-signed.hap`
184
- - Unsigned: `<project>/entry/build/default/outputs/default/entry-default-unsigned.hap`
185
-
186
- ---
187
-
188
- ## Reference: Common HarmonyOS Imports
189
-
190
- ```typescript
191
- // Network
192
- import { http } from '@kit.NetworkKit';
193
-
194
- // Data persistence
195
- import { preferences } from '@kit.ArkData';
196
- import { relationalStore } from '@kit.ArkData';
197
-
198
- // UI utilities
199
- import { router } from '@kit.ArkUI';
200
- import { promptAction } from '@kit.ArkUI';
201
-
202
- // Ability & Context
203
- import { UIAbility, AbilityConstant, Want } from '@kit.AbilityKit';
204
- import { common } from '@kit.AbilityKit';
205
-
206
- // File I/O
207
- import { fileIo } from '@kit.CoreFileKit';
208
-
209
- // Logging
210
- import { hilog } from '@kit.PerformanceAnalysisKit';
211
-
212
- // JSON parsing — built-in, no import needed
213
- // ArkUI built-in components (Text, Column, Row, List, Button, Image, etc.) — NO import needed
214
- ```
215
-
216
- ## Reference: Valid Permission Names
217
-
218
- Commonly used SDK-validated permissions for `module.json5`:
219
-
220
- - `ohos.permission.INTERNET`
221
- - `ohos.permission.GET_NETWORK_INFO`
222
- - `ohos.permission.GET_WIFI_INFO`
223
- - `ohos.permission.KEEP_BACKGROUND_RUNNING`
224
- - `ohos.permission.PUBLISH_AGENT_REMINDER`
225
- - `ohos.permission.CAMERA`
226
- - `ohos.permission.MICROPHONE`
227
- - `ohos.permission.APPROXIMATELY_LOCATION`
228
- - `ohos.permission.LOCATION`
229
- - `ohos.permission.READ_MEDIA`
230
- - `ohos.permission.WRITE_MEDIA`
231
- - `ohos.permission.USE_BLUETOOTH`
232
- - `ohos.permission.VIBRATE`
233
-
234
- **Note**: `ohos.permission.NOTIFICATION` does NOT exist. When in doubt, omit the permission.
235
-
236
- ## Reference: ArkTS Strict Mode Rules
237
-
238
- All code must comply with ArkTS strict mode:
239
-
240
- 1. **No `any` type** — Use explicit types or `object`
241
- 2. **No `var`** — Only `let` and `const`
242
- 3. **No dynamic property access** — Use typed interfaces instead of `obj['key']` on typed objects
243
- 4. **`throw` must throw Error instances** — Never `throw 'string'` or `throw unknownVar`
244
- 5. **All object literals must match declared interfaces** — No anonymous `{ key: val }` returns without a matching interface
245
- 6. **No inline object literal types** — `function(): { a: string }` is forbidden; define a named `interface`
246
- 7. **All `@Component` structs must have `build()`** — Missing build method is a compile error
247
- 8. **`$r()` resource references validated at compile time** — All referenced resources must exist
248
- 9. **`fontColor()` expects `ResourceColor`**, not `Resource[]` — Don't wrap in array brackets (exception: `SymbolGlyph`)
249
- 10. **Permission names in `module.json5`** — Must be SDK-predefined values
250
-
251
- ## Important Notes
252
-
253
- - **Timeout**: Individual build commands may take up to 5 minutes. Use a 300000ms timeout.
254
- - **Max iterations**: Stop after 20 iterations to prevent infinite loops. If build still fails after 20 attempts, report the remaining errors to the user.
255
- - **Don't over-fix**: Only fix errors reported by the compiler. Don't proactively refactor unrelated code.
256
- - **Read before edit**: Always read a file before modifying it. Understand the surrounding context.
257
- - **One error can cause many**: A single root-cause fix (like adding a missing interface) may resolve multiple reported errors. After fixing root causes, rebuild to see remaining issues.
258
- - **ohpm errors**: If the build fails because of missing packages, rerun `npx --yes devecocli build` so it can retry dependency install before you investigate deeper.
259
-
260
- ---
261
-
262
- ## References
263
-
264
- - `references/arkts-strict-patterns.md` — ArkTS 严格模式编译错误的确定性修复 Pattern(throw/any/var/interface 等)
265
- - `references/known-patterns.md` — 已知常见编译错误 Pattern 及修复方案
266
- - `references/rdb-entity-pattern.md` — RDB 实体类编译错误 Pattern(数据库实体相关)
@@ -1,219 +0,0 @@
1
- # ArkTS 严格模式确定性修复 Pattern
2
- # 适用于: ArkTS 严格模式编译错误
3
- # 触发场景: 编译报错 arkts-no-xxx 系列
4
- # 经验来源: EinkBro 迁移 (2026-03-26)
5
-
6
- ---
7
-
8
- ## Pattern 1: throw 语句
9
-
10
- ### 错误写法
11
- ```typescript
12
- throw err; // ERROR: arkts-limited-throw
13
- throw 'error string'; // ERROR: arkts-limited-throw
14
- throw unknownVariable; // ERROR: arkts-limited-throw
15
- ```
16
-
17
- ### 正确写法
18
- ```typescript
19
- throw new Error(String(error));
20
- ```
21
-
22
- ### 不需要修改的情况
23
- ```typescript
24
- throw new Error('specific message'); // OK - 已经是 Error 实例
25
- ```
26
-
27
- ---
28
-
29
- ## Pattern 2: 对象字面量作为参数 (arkts-no-untyped-obj-literals)
30
-
31
- ### 错误写法
32
- ```typescript
33
- // ERROR: Object literal must correspond to some explicitly declared class or interface
34
- const response = await this.sendRequest(url, { contents });
35
- ```
36
-
37
- ### 正确写法 — 先声明变量
38
- ```typescript
39
- interface GeminiRequestBody {
40
- contents: GeminiContent[];
41
- }
42
-
43
- const requestBody: GeminiRequestBody = { contents };
44
- const response = await this.sendRequest(url, requestBody);
45
- ```
46
-
47
- ### 内联参数场景
48
- ```typescript
49
- // 方法参数也是对象字面量,同样需要处理
50
- httpRequest.request(url, {
51
- method: http.RequestMethod.POST,
52
- header: { 'Content-Type': 'application/json' },
53
- extraData: JSON.stringify(body),
54
- connectTimeout: 30000,
55
- readTimeout: 30000
56
- });
57
- // ^ 这种场景 SDK 方法签名本身接受 object 类型,通常 OK
58
- // 但自定义方法调用时必须用已声明接口的变量
59
- ```
60
-
61
- ---
62
-
63
- ## Pattern 3: Margin vertical 简写不支持
64
-
65
- ### 错误写法
66
- ```typescript
67
- .margin({ vertical: 8 }); // ERROR: 'vertical' does not exist in type
68
- ```
69
-
70
- ### 正确写法
71
- ```typescript
72
- .margin({ top: 8, bottom: 8 });
73
- ```
74
-
75
- ### 常见场景
76
- | 错误 | 正确 |
77
- |------|------|
78
- | `.margin({ vertical: 8 })` | `.margin({ top: 8, bottom: 8 })` |
79
- | `.margin({ horizontal: 16 })` | `.margin({ left: 16, right: 16 })` |
80
-
81
- ---
82
-
83
- ## Pattern 4: List 内不能直接放 Divider
84
-
85
- ### 错误写法
86
- ```typescript
87
- List() {
88
- ForEach(items, (item) => {
89
- ListItem() { /* ... */ }
90
- })
91
- Divider() // ERROR: List children must be ListItem only
92
- }
93
- ```
94
-
95
- ### 正确写法 — 用 ListItem + border
96
- ```typescript
97
- List() {
98
- ForEach(items, (item) => {
99
- ListItem() {
100
- Column() {
101
- Text(item.name)
102
- }
103
- .width('100%')
104
- .padding(12)
105
- .border({ width: { bottom: 1 }, color: '#E0E0E0' }) // 替代 Divider 分隔线
106
- }
107
- })
108
- }
109
- ```
110
-
111
- ### 另一种方案 — border 直接在 ListItem 上
112
- ```typescript
113
- ListItem() {
114
- // content
115
- }
116
- .border({ width: { bottom: 1 }, color: '#E0E0E0' })
117
- ```
118
-
119
- ---
120
-
121
- ## Pattern 5: 数组字面量类型推断 (arkts-no-noninferrable-arr-literals)
122
-
123
- ### 错误写法
124
- ```typescript
125
- const arr = [1, 2, 3].map(x => ({ val: x }));
126
- // ERROR: Array literals must contain elements of only inferrable types
127
- ```
128
-
129
- ### 正确写法 — 显式类型
130
- ```typescript
131
- interface Item { val: number; }
132
- const arr: Item[] = [1, 2, 3].map((x): Item => ({ val: x }));
133
- ```
134
-
135
- ---
136
-
137
- ## Pattern 6: TextDecoder 不存在
138
-
139
- ### 错误写法
140
- ```typescript
141
- const decoder = new TextDecoder(); // ERROR: Cannot find name 'TextDecoder'
142
- const str = decoder.decode(data);
143
- ```
144
-
145
- ### 正确写法
146
- ```typescript
147
- const bytes = new Uint8Array(data);
148
- let chunk = '';
149
- for (let i = 0; i < bytes.length; i++) {
150
- chunk += String.fromCharCode(bytes[i]);
151
- }
152
- ```
153
-
154
- ---
155
-
156
- ## Pattern 7: HTTP 组件事件名
157
-
158
- | 错误事件 | 正确事件 | 说明 |
159
- |---------|---------|------|
160
- | `request.on('requestEnd', ...)` | `request.on('dataEnd', ...)` | 请求结束事件 |
161
- | `request.on('error', ...)` | 改用 Promise 的 catch | HTTP 组件 error 事件签名不标准 |
162
-
163
- ---
164
-
165
- ## Pattern 8: GeminiService 等自定义类缺少成员
166
-
167
- ### 错误场景
168
- ```typescript
169
- class GeminiService {
170
- private async sendRequest(url: string, body: object): Promise<Object> {
171
- httpRequest.request(url, { extraData: JSON.stringify(body),
172
- connectTimeout: this.timeout, // ERROR: Property 'timeout' does not exist
173
- readTimeout: this.timeout
174
- });
175
- }
176
- // timeout 属性忘记声明
177
- }
178
- ```
179
-
180
- ### 正确 — 确保所有成员都在类体内声明
181
- ```typescript
182
- class GeminiService {
183
- private timeout: number = 30000; // 在类体内声明
184
- private async sendRequest(...) { ... }
185
- }
186
- ```
187
-
188
- ---
189
-
190
- ## Pattern 9: Button 不支持 emoji
191
-
192
- ### 错误写法
193
- ```typescript
194
- Button('X') // 有时 emoji 渲染异常
195
- Button('🗑')
196
- ```
197
-
198
- ### 正确写法
199
- ```typescript
200
- Button('Del') // 纯文本
201
- Button('Copy')
202
- Button('Back')
203
- ```
204
-
205
- ---
206
-
207
- ## 快速检查清单
208
-
209
- 遇到 ArkTS 编译错误时,按序检查:
210
-
211
- 1. throw → `throw new Error(String(x))`
212
- 2. 对象字面量作为参数 → 先赋值给显式类型变量
213
- 3. any / unknown → `Object` + `as Function` / `as SomeType`
214
- 4. // @ts-ignore → 禁止,必须用类型操作替代
215
- 5. ValuesBucket → 普通对象字面量 `{}`
216
- 6. margin { vertical } → `{ top, bottom }`
217
- 7. List 内 Divider → ListItem + border
218
- 8. TextDecoder → Uint8Array 遍历
219
- 9. `new SomeType()` 报错 → 检查是否是 type alias 而非 class
@@ -1,157 +0,0 @@
1
- # Known Compile Error Patterns
2
-
3
- > **This file is auto-maintained by `a2h-retrospect`.**
4
- > Manual edits are allowed but may be overwritten when retrospect detects updated patterns.
5
- > Last updated: 2026-03-27
6
-
7
- ---
8
-
9
- ## Pattern Index
10
-
11
- | # | Error Code / Type | Frequency | Short Description |
12
- |---|-------------------|-----------|-------------------|
13
- | 1 | arkts-identifiers-as-prop-names | 85 | ValuesBucket computed property name |
14
- | 2 | type mismatch (EventData) | 16 | EventData double type cast |
15
- | 3 | arkts-no-untyped-obj-literals | 9 | Untyped object literal |
16
- | 4 | type mismatch (promptAction) | 8 | promptAction button color type |
17
- | 5 | type error (@Prop) | 3 | @Prop naming conflict |
18
-
19
- ---
20
-
21
- ## 1. ValuesBucket Computed Property Name
22
-
23
- - **Date**: 2026-03-27
24
- - **Error code**: `arkts-identifiers-as-prop-names`
25
- - **Frequency**: 85 occurrences
26
- - **Source**: AntennaPod V1 migration (a2h-retrospect-report-2026-03-27)
27
-
28
- **Error code**:
29
- ```typescript
30
- const bucket: ValuesBucket = {
31
- [ColumnName.TITLE]: title, // ERROR: computed property name not allowed
32
- [ColumnName.URL]: url,
33
- };
34
- ```
35
-
36
- **Correct code**:
37
- ```typescript
38
- const bucket: ValuesBucket = {};
39
- bucket[ColumnName.TITLE] = title;
40
- bucket[ColumnName.URL] = url;
41
- ```
42
-
43
- **Rule**: ArkTS forbids computed property names (`[expr]: value`) in object literals. Build the object first, then assign properties via bracket notation.
44
-
45
- ---
46
-
47
- ## 2. EventData Double Type Cast
48
-
49
- - **Date**: 2026-03-27
50
- - **Error code**: type mismatch
51
- - **Frequency**: 16 occurrences
52
- - **Source**: AntennaPod V1 migration (a2h-retrospect-report-2026-03-27)
53
-
54
- **Error code**:
55
- ```typescript
56
- emitter.on({ eventId: 1 }, (data: emitter.EventData) => {
57
- const value = data.data?.['key'] as string; // ERROR: data.data is optional Record, direct cast fails
58
- });
59
- ```
60
-
61
- **Correct code**:
62
- ```typescript
63
- emitter.on({ eventId: 1 }, (data: emitter.EventData) => {
64
- const raw = data.data as Record<string, Object>;
65
- const value = raw['key'] as string;
66
- });
67
- ```
68
-
69
- **Rule**: `EventData.data` is typed `Record<string, Object> | undefined`. Access requires two steps: (1) cast to `Record<string, Object>`, (2) cast the extracted value to the target type.
70
-
71
- ---
72
-
73
- ## 3. Untyped Object Literal
74
-
75
- - **Date**: 2026-03-27
76
- - **Error code**: `arkts-no-untyped-obj-literals`
77
- - **Frequency**: 9 occurrences
78
- - **Source**: AntennaPod V1 migration (a2h-retrospect-report-2026-03-27)
79
-
80
- **Error code**:
81
- ```typescript
82
- const options = {
83
- title: 'Hello',
84
- message: 'World',
85
- }; // ERROR: object literal without explicit type annotation
86
- ```
87
-
88
- **Correct code**:
89
- ```typescript
90
- interface DialogOptions {
91
- title: string;
92
- message: string;
93
- }
94
- const options: DialogOptions = {
95
- title: 'Hello',
96
- message: 'World',
97
- };
98
- ```
99
-
100
- **Rule**: ArkTS requires all object literals to have an explicit type. Define an `interface` or `class` and annotate the variable.
101
-
102
- ---
103
-
104
- ## 4. promptAction Button Color Type
105
-
106
- - **Date**: 2026-03-27
107
- - **Error code**: type mismatch
108
- - **Frequency**: 8 occurrences
109
- - **Source**: AntennaPod V1 migration (a2h-retrospect-report-2026-03-27)
110
-
111
- **Error code**:
112
- ```typescript
113
- promptAction.showDialog({
114
- buttons: [
115
- { text: 'OK', color: '#ff0000' } // ERROR: color expects ResourceColor, not string
116
- ]
117
- });
118
- ```
119
-
120
- **Correct code**:
121
- ```typescript
122
- promptAction.showDialog({
123
- buttons: [
124
- { text: 'OK', color: Color.Red }
125
- ]
126
- });
127
- // Or use $r('app.color.xxx') for resource reference
128
- ```
129
-
130
- **Rule**: `promptAction.showDialog` button `color` property expects `ResourceColor` type (Color enum or `$r()` resource reference), not a raw hex string.
131
-
132
- ---
133
-
134
- ## 5. @Prop Naming Conflict
135
-
136
- - **Date**: 2026-03-27
137
- - **Error code**: type error
138
- - **Frequency**: 3 occurrences
139
- - **Source**: AntennaPod V1 migration (a2h-retrospect-report-2026-03-27)
140
-
141
- **Error code**:
142
- ```typescript
143
- @Component
144
- struct MyComponent {
145
- @Prop title: string = ''; // ERROR: 'title' conflicts with built-in component property
146
- }
147
- ```
148
-
149
- **Correct code**:
150
- ```typescript
151
- @Component
152
- struct MyComponent {
153
- @Prop itemTitle: string = ''; // Renamed to avoid conflict
154
- }
155
- ```
156
-
157
- **Rule**: Certain property names (`title`, `content`, `action`, etc.) conflict with built-in component attributes. Prefix with a domain-specific qualifier (e.g., `itemTitle`, `feedTitle`).