@deveco/deveco-cli-common 1.3.9 → 1.3.11

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 (224) hide show
  1. package/README.md +888 -55
  2. package/THIRD-PARTY-LICENSES +33 -3
  3. package/dist/cli.js +281 -165
  4. package/dist/design2arkts-engine/LICENSE +21 -0
  5. package/dist/design2arkts-engine/dist/index.d.ts +2739 -0
  6. package/dist/design2arkts-engine/dist/index.js +6207 -0
  7. package/dist/design2arkts-engine/package.json +40 -0
  8. package/dist/design2arkts-engine/pixso-arkts.mjs +98 -0
  9. package/dist/design2arkts-engine/resources/skill/LICENSE +21 -0
  10. package/dist/design2arkts-engine/resources/skill/SKILL.md +176 -0
  11. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/INSTRUCTIONS.md +310 -0
  12. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/evals/evals.json +249 -0
  13. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/basics-and-display.md +146 -0
  14. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/containers-and-navigation.md +527 -0
  15. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/feedback-and-overlay.md +275 -0
  16. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/hds-components.md +667 -0
  17. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/input-and-selection.md +382 -0
  18. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/patterns/data-and-form.md +440 -0
  19. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/patterns/state-management.md +213 -0
  20. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui-scoring-workflow/INSTRUCTIONS.md +164 -0
  21. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/INSTRUCTIONS.md +138 -0
  22. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/references/components.md +777 -0
  23. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/references/migration-patterns.md +187 -0
  24. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/INSTRUCTIONS.md +350 -0
  25. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-basic-mapping.md +455 -0
  26. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-common-issues.md +516 -0
  27. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/button.md +104 -0
  28. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/flex.md +115 -0
  29. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/grid.md +121 -0
  30. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/image.md +118 -0
  31. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/list.md +152 -0
  32. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/location.md +160 -0
  33. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/richeditor.md +132 -0
  34. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/row-column.md +118 -0
  35. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/stack.md +106 -0
  36. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/swiper.md +117 -0
  37. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/tabs.md +163 -0
  38. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/text-input.md +147 -0
  39. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/text.md +145 -0
  40. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/waterflow.md +116 -0
  41. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/index.md +23 -0
  42. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/matching.md +127 -0
  43. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/clarification-template.md +53 -0
  44. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/INSTRUCTIONS.md +163 -0
  45. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/api-architecture.md +17 -0
  46. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/data-architecture.md +17 -0
  47. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/logic-architecture.md +17 -0
  48. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/ui-architecture.md +23 -0
  49. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/behavior-audit.md +143 -0
  50. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/diff-analysis.md +115 -0
  51. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/dimension-identification.md +86 -0
  52. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/output-format.md +347 -0
  53. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/understanding-modes.md +214 -0
  54. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/INSTRUCTIONS.md +86 -0
  55. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/breakpoints.md +86 -0
  56. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/chunks.md +48 -0
  57. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/dsl-schema.md +151 -0
  58. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/patterns.md +147 -0
  59. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/rules.md +115 -0
  60. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/INSTRUCTIONS.md +572 -0
  61. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/assets/template-ui-page.md +293 -0
  62. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/references/animation-design.md +84 -0
  63. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/INSTRUCTIONS.md +195 -0
  64. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/analysis_workflow.md +119 -0
  65. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/scoring_schema.md +83 -0
  66. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/vlm_prompt.md +61 -0
  67. package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/scripts/ui_score.py +691 -0
  68. package/dist/design2arkts-engine/resources/skill/references/cli-integration.md +94 -0
  69. package/dist/design2arkts-engine/resources/skill/references/design-doc-auto-recovery.md +91 -0
  70. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/01-acquire-figma-react-source.md +96 -0
  71. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/02-convert-react-to-arkui.md +92 -0
  72. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/03-complete-interaction-logic.md +26 -0
  73. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/04-quality-and-build.md +43 -0
  74. package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/05-summary.md +36 -0
  75. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/01-acquire-figma-react-source.md +161 -0
  76. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/02-convert-react-to-arkui.md +219 -0
  77. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/03-complete-interaction-logic.md +31 -0
  78. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/04-quality-and-build.md +28 -0
  79. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/05-visual-calibration.md +190 -0
  80. package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/06-summary.md +29 -0
  81. package/dist/design2arkts-engine/resources/skill/references/figma/stage-catalog-fast.json +40 -0
  82. package/dist/design2arkts-engine/resources/skill/references/figma/stage-catalog-full.json +47 -0
  83. package/dist/design2arkts-engine/resources/skill/references/host-vision.md +56 -0
  84. package/dist/design2arkts-engine/resources/skill/references/mcp-dependency.md +62 -0
  85. package/dist/design2arkts-engine/resources/skill/references/page-revisions.md +42 -0
  86. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/01-acquire-pixso-dsl.md +287 -0
  87. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/02-generate-skeleton-and-assets.md +245 -0
  88. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/03-understand-repository.md +133 -0
  89. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/05-design-component-tree.md +222 -0
  90. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/06-implement-static-layout.md +143 -0
  91. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/07-complete-interaction-logic.md +131 -0
  92. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/08-quality-build-and-audits.md +343 -0
  93. package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/09-summary.md +103 -0
  94. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/01-acquire-pixso-dsl.md +287 -0
  95. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/02-generate-skeleton-and-assets.md +245 -0
  96. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/03-understand-repository.md +133 -0
  97. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/05-design-and-confirm-component-tree.md +282 -0
  98. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/06-implement-static-layout.md +143 -0
  99. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/07-complete-interaction-logic.md +131 -0
  100. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/08-quality-build-and-audits.md +343 -0
  101. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/09-visual-calibration.md +190 -0
  102. package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/10-summary.md +105 -0
  103. package/dist/design2arkts-engine/resources/skill/references/pixso/stage-catalog-fast.json +58 -0
  104. package/dist/design2arkts-engine/resources/skill/references/pixso/stage-catalog-full.json +64 -0
  105. package/dist/design2arkts-engine/resources/skill/references/requirement-clarification.md +131 -0
  106. package/dist/design2arkts-engine/resources/skill/references/resource-revisions.md +13 -0
  107. package/dist/design2arkts-engine/resources/skill/references/runtime-contract.md +435 -0
  108. package/dist/design2arkts-engine/resources/skill/references/score-engine.json +5 -0
  109. package/dist/design2arkts-engine/resources/skill/references/source-tools.md +17 -0
  110. package/dist/design2arkts-engine/resources/skill/references/standalone-capabilities.md +63 -0
  111. package/dist/design2arkts-engine/resources/skill/references/workflow-origin.json +96 -0
  112. package/dist/design2arkts-engine/resources/skill/scripts/file-lock.mjs +131 -0
  113. package/dist/design2arkts-engine/resources/skill/scripts/workflow.mjs +3672 -0
  114. package/dist/design2arkts-engine/runner.mjs +44 -0
  115. package/dist/internal/plugin-hook-runner.js +1 -0
  116. package/dist/internal/telemetry-upload-background.js +44 -7
  117. package/package.json +22 -10
  118. package/skills/deveco-cli/SKILL.md +201 -34
  119. package/skills/hmos-arkui-develop-skill/SKILL.md +77 -0
  120. package/skills/hmos-arkui-develop-skill/references/quick-apis/01-layout.md +634 -0
  121. package/skills/hmos-arkui-develop-skill/references/quick-apis/02-basic-components.md +649 -0
  122. package/skills/hmos-arkui-develop-skill/references/quick-apis/03-data-display.md +81 -0
  123. package/skills/hmos-arkui-develop-skill/references/quick-apis/04-selectors.md +109 -0
  124. package/skills/hmos-arkui-develop-skill/references/quick-apis/05-media.md +90 -0
  125. package/skills/hmos-arkui-develop-skill/references/quick-apis/06-advanced.md +32 -0
  126. package/skills/hmos-arkui-develop-skill/references/quick-apis/07-security.md +30 -0
  127. package/skills/hmos-arkui-develop-skill/references/quick-apis/08-state-decorators.md +120 -0
  128. package/skills/hmos-arkui-develop-skill/references/quick-apis/09-animation.md +118 -0
  129. package/skills/hmos-arkui-develop-skill/references/quick-apis/10-gesture.md +89 -0
  130. package/skills/hmos-arkui-develop-skill/references/quick-apis/11-dialog-menu.md +152 -0
  131. package/skills/hmos-arkui-develop-skill/references/quick-apis/12-navigation.md +127 -0
  132. package/skills/hmos-arkui-develop-skill/references/quick-apis/13-rendering.md +52 -0
  133. package/skills/hmos-arkui-develop-skill/references/quick-apis/14-extension.md +22 -0
  134. package/skills/hmos-arkui-develop-skill/references/quick-apis/15-theme-style.md +10 -0
  135. package/skills/hmos-arkui-develop-skill/references/quick-apis/16-enums.md +128 -0
  136. package/skills/hmos-arkui-develop-skill/references/quick-apis/17-resources.md +401 -0
  137. package/skills/hmos-arkui-develop-skill/references/quick-apis/18-error-code.md +24 -0
  138. package/skills/hmos-arkui-develop-skill/references/quick-apis/_index.md +76 -0
  139. package/skills/hmos-arkui-develop-skill/references/quick-rules/00-arkts-syntax.md +229 -0
  140. package/skills/hmos-arkui-develop-skill/references/quick-rules/01-import.md +116 -0
  141. package/skills/hmos-arkui-develop-skill/references/quick-rules/02-uicontext.md +56 -0
  142. package/skills/hmos-arkui-develop-skill/references/quick-rules/03-component.md +105 -0
  143. package/skills/hmos-arkui-develop-skill/references/quick-rules/04-build.md +41 -0
  144. package/skills/hmos-arkui-develop-skill/references/quick-rules/05-state.md +300 -0
  145. package/skills/hmos-arkui-develop-skill/references/quick-rules/06-rendering.md +67 -0
  146. package/skills/hmos-arkui-develop-skill/references/quick-rules/07-attribute-params.md +219 -0
  147. package/skills/hmos-arkui-develop-skill/references/quick-rules/08-navigation.md +102 -0
  148. package/skills/hmos-arkui-develop-skill/references/quick-rules/09-dialog.md +72 -0
  149. package/skills/hmos-arkui-develop-skill/references/quick-rules/10-style.md +90 -0
  150. package/skills/hmos-arkui-develop-skill/references/quick-rules/11-extension.md +54 -0
  151. package/skills/hmos-arkui-develop-skill/references/quick-rules/12-layout.md +69 -0
  152. package/skills/hmos-arkui-develop-skill/references/quick-rules/13-performance.md +27 -0
  153. package/skills/hmos-arkui-develop-skill/references/quick-rules/14-deprecated.md +28 -0
  154. package/skills/hmos-arkui-develop-skill/references/quick-rules/_index.md +79 -0
  155. package/skills/hmos-arkui-develop-skill/references/style-guide.md +491 -0
  156. package/skills/hmos-arkui-develop-skill/test-cases/code_gen_cases.json +292 -0
  157. package/skills/hmos-dfx-analyzer/SKILL.md +683 -0
  158. package/skills/hmos-dfx-analyzer/changelog/CHANGELOG.md +17 -0
  159. package/skills/hmos-dfx-analyzer/evals/evals.json +119 -0
  160. package/skills/hmos-dfx-analyzer/references/appfreeze/analyzer.md +471 -0
  161. package/skills/hmos-dfx-analyzer/references/appfreeze/references/fault-mode-library.md +94 -0
  162. package/skills/hmos-dfx-analyzer/references/appfreeze/references/ffrt-freeze-analysis.md +132 -0
  163. package/skills/hmos-dfx-analyzer/references/appfreeze/references/libuv-freeze-analysis.md +116 -0
  164. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/__init__.py +40 -0
  165. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/binder.py +343 -0
  166. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/collector.py +84 -0
  167. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/common.py +132 -0
  168. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/faultlog.py +212 -0
  169. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/main.py +81 -0
  170. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/report.py +675 -0
  171. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/sections.py +377 -0
  172. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/stack.py +165 -0
  173. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/llvm_addr2line.py +123 -0
  174. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/match_so.py +120 -0
  175. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/sample_stack_analyzer.py +209 -0
  176. package/skills/hmos-dfx-analyzer/references/cppcrash/analyzer.md +470 -0
  177. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkdata.md +325 -0
  178. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkui.md +266 -0
  179. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkweb.md +144 -0
  180. package/skills/hmos-dfx-analyzer/references/cppcrash/references/fault_mode.md +178 -0
  181. package/skills/hmos-dfx-analyzer/references/cppcrash/references/gwp_asan.md +300 -0
  182. package/skills/hmos-dfx-analyzer/references/cppcrash/references/jsruntime.md +339 -0
  183. package/skills/hmos-dfx-analyzer/references/cppcrash/references/jsvm.md +203 -0
  184. package/skills/hmos-dfx-analyzer/references/cppcrash/references/libuv.md +166 -0
  185. package/skills/hmos-dfx-analyzer/references/cppcrash/references/memory_corruption.md +348 -0
  186. package/skills/hmos-dfx-analyzer/references/cppcrash/references/memory_corruption_second_scene.md +74 -0
  187. package/skills/hmos-dfx-analyzer/references/cppcrash/references/multithreading.md +284 -0
  188. package/skills/hmos-dfx-analyzer/references/cppcrash/references/render_service.md +300 -0
  189. package/skills/hmos-dfx-analyzer/references/cppcrash/references/rosen_text.md +41 -0
  190. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/__init__.py +36 -0
  191. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/collector.py +93 -0
  192. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/common.py +68 -0
  193. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/crash_log.py +275 -0
  194. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/extract_hilog.py +69 -0
  195. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/hints.py +251 -0
  196. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/main.py +82 -0
  197. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/match_so.py +120 -0
  198. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/ohos_llvm_tools.py +279 -0
  199. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/report.py +226 -0
  200. package/skills/hmos-dfx-analyzer/references/jscrash/analyzer.md +174 -0
  201. package/skills/hmos-dfx-analyzer/references/jscrash/references/fault-mode-library.md +107 -0
  202. package/skills/hmos-dfx-analyzer/references/jscrash/references/jscrash-patterns.md +92 -0
  203. package/skills/hmos-dfx-analyzer/references/jscrash/references/sourcemap-symbolication.md +67 -0
  204. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/bin/hstack +25 -0
  205. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/bin/hstack.bat +26 -0
  206. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/index.js +2 -0
  207. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/index.js.LICENSE.txt +1 -0
  208. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/mappings.wasm +0 -0
  209. package/skills/hmos-dfx-analyzer/references/white-screen/analyzer.md +129 -0
  210. package/skills/hmos-dfx-analyzer/scripts/collect/collect-hilog.mjs +120 -0
  211. package/skills/hmos-dfx-analyzer/scripts/collect/jscrash-report.mjs +138 -0
  212. package/skills/hmos-dfx-analyzer/scripts/collect/parse-jscrash-log.mjs +126 -0
  213. package/skills/hmos-dfx-analyzer/scripts/collect/shared/deveco-cli.mjs +79 -0
  214. package/skills/hmos-dfx-analyzer/scripts/collect/shared/jscrash-parse.mjs +389 -0
  215. package/skills/hmos-dfx-analyzer/scripts/collect/shared/utils.mjs +27 -0
  216. package/skills/hmos-dfx-analyzer/scripts/export_report.py +373 -0
  217. package/skills/hmos-dfx-analyzer/scripts/identify_fault_log.py +500 -0
  218. package/skills/hmos-dfx-analyzer/scripts/report_template.html +103 -0
  219. package/skills/hmos-dfx-analyzer/test-cases/functional.md +112 -0
  220. package/skills/hmos-dfx-analyzer/test-cases/smoke.md +86 -0
  221. package/skills/hmos-dfx-analyzer/test-cases/test-prompts.md +35 -0
  222. package/skills/hmos-dfx-analyzer/test-cases/trigger.md +121 -0
  223. package/skills/index.json +17 -0
  224. package/src/resources/arkts-check.cjs +196 -5
@@ -1,14 +1,15 @@
1
1
  ---
2
2
  name: deveco-cli
3
3
  description: >-
4
- Use 'devecocli' for HarmonyOS apps (scaffold, build, run, debug, devices, emulators, logs, docs, UI inspection, 鸿蒙开发文档, skills). Use it if workspace has build-profile.json5 or oh-package.json5, or user mentions HarmonyOS, 鸿蒙, DevEco, ArkTS, ArkUI, docs, 鸿蒙文档, 知识, 搜索, skills, UI, UI测试, 组件调试. If user explicitly specifies another tool, skill, or workflow, follow that choice; otherwise use 'devecocli'.
4
+ Use 'devecocli' for HarmonyOS apps (scaffold, build, run, debug, devices, emulators, logs, docs, UI inspection, 鸿蒙开发文档, skills), including generating ArkUI pages from Pixso/Figma designs (设计稿还原). Use it if workspace has build-profile.json5 or oh-package.json5, or user mentions HarmonyOS, 鸿蒙, DevEco, ArkTS, ArkUI, docs, 鸿蒙文档, 知识, 搜索, skills, UI, UI测试, 组件调试. If user explicitly specifies another tool, skill, or workflow, follow that choice; otherwise use 'devecocli'.
5
+ Also covers on-device testing services: 测试, 检测, 内存泄漏, 稳定性, 性能, 功耗, 兼容性, DevEco Testing. When asked to test an app on a device (性能测试 / 内存泄漏 / 稳定性 / UX / 上架预检 — performance, memory leak, stability, UX, app-store precheck), run 'devecocli testing' instead of hand-rolling hdc, bm dump or SP_daemon commands.
5
6
  ---
6
7
 
7
8
  # DevEco CLI
8
9
 
9
10
  `devecocli` wraps DevEco Studio's `hvigor`, `ohpm`, `hdc`, emulator toolchain, and bundled skills installer.
10
11
 
11
- Available commands: `build`, `check`, `run`, `update`, `device`, `emulator`, `ui`, `skills`, `log`, `verify`, `create`, `init`, `serve`, `docs`, `signature`, `auth`.
12
+ Available commands: `build`, `check`, `run`, `update`, `device`, `emulator`, `ui`, `skills`, `log`, `verify`, `create`, `init`, `serve`, `docs`, `signature`, `auth`, `design2arkts` (alias `d2a`), `testing`.
12
13
 
13
14
  **Sandbox Rule**: Commands tagged `[Outside sandbox]` must be run outside the sandbox.
14
15
 
@@ -26,19 +27,19 @@ Scaffold a new HarmonyOS project.
26
27
 
27
28
  ### `devecocli build` `[Outside sandbox]`
28
29
  Compile and package project/modules. (Defaults: `--product default`, `--build-mode debug`)
30
+ - **AI agent invocation (Windows only)**: `devecocli build` must be launched inside a Start-Process wrapper; running it directly in the agent shell lets the `hvigor` daemon hold the console output pipe, so the agent cannot detect command completion and the window waits forever.
29
31
  | Goal | Command |
30
32
  |---|---|
31
33
  | Single-module / single-`entry` | `devecocli build` |
32
34
  | Specific modules | `devecocli build --modules <m1> <m2>@<target>` |
33
35
  | Whole product bundle (.app) | `devecocli build --product <name>` |
34
- | Specific assemble type | `devecocli build --assemble-type <assembleHap\|assembleApp\|assembleHsp\|assembleHar>` |
35
36
  | Override signing config | `devecocli build --signing-config <name>` |
36
37
  | Clean build outputs | `devecocli build clean` |
37
38
  | Clean specific modules | `devecocli build clean --modules <m1> <m2>` |
38
39
  - **Build efficiency**: if build/clean is slow, consult https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-build-optimize-practices for build optimization practices.
39
40
  - **Clean mode**: `devecocli build clean [--mode <mode>] [--modules <m1> <m2>]` runs in module mode by default and reads build options (analyze/parallel/incremental/daemon) from `hvigor-config.json5` `execution`, matching DevEco Studio.
40
41
  - **Build artifacts**: on success, prints absolute paths of all produced `.hap`/`.hsp`/`.har`/`.app` files for direct use.
41
- - **Assemble type**: `--assemble-type` lets you explicitly choose the hvigor task (`assembleHap`, `assembleApp`, `assembleHsp`, `assembleHar`) instead of auto-detecting by module type. Use `assembleApp` for whole-project builds; `assembleHap`/`assembleHsp`/`assembleHar` for module-level builds.
42
+ - **debugLine**: disabled by default. Pass `--debug-line` to build to forward `-p debugLine=true` to hvigor.
42
43
  - **Signing config**: `--signing-config <name>` overrides the product's default signing config from `build-profile.json5`, enabling release builds with a release signing config.
43
44
 
44
45
  ### `devecocli check lint`
@@ -89,17 +90,80 @@ Inspect UI on a connected physical device or running emulator.
89
90
  *Ex*: `devecocli ui screenrecord start --device Phone --path ./recordings/` → `devecocli ui screenrecord stop --device Phone`
90
91
 
91
92
  ### `devecocli docs`
92
- Search, read, catalog, and update local HarmonyOS docs.
93
+ Search HarmonyOS developer documentation in the local HarmonyOS Knowledge Base — returns articles with examples and guidance on HarmonyOS APIs, ArkTS, and libraries. Typical use cases: finding API migration guides, examples for HarmonyOS APIs/ArkTS, up-to-date API references, and best practices for HarmonyOS development.
93
94
  - `search <keywords...>`: Match any keyword. Opts: `--catalog <name>`, `--format <default|json>`, `--limit <n>`.
94
- - `read <documentId>`: Read full content by ID (e.g. `devecocli docs read 开发指南/冷启动_Launch分析/Launch模板基本操作/ide-insight-session-launch`).
95
+ - `read <documentId>`: Read full content by ID (e.g. `devecocli docs read guides/harmonyos-guides/指南/系统/网络/网络`).
95
96
  - `catalog`: List available catalogs.
96
97
  - `update`: Update docs to the latest compatible version — downloads, sha512-verifies, and installs the docs-data package with atomic version switching; falls back to the bundled baseline if missing/corrupted. Opts: `--force`, `--check`.
97
98
 
99
+ Always use this tool to get the most up-to-date information about HarmonyOS concepts.
100
+
98
101
  ### `devecocli device`
99
- - `list`: Show active real devices and running emulators. Opt: `--format <table|json>` (default: `table`).
100
- - `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts. Opt: `--format <table|json>` (default: `table`).
101
- - `file`: Transfer files between the host and a device. Opt: `--device <name|serial>` (optional when exactly one device is connected, required when multiple). `send <local> <remote>` pushes a local file onto the device; `recv <remote> <local>` pulls a file back. Maps to `hdc -t <serial> file send/recv <src> <dst>`; the operation only succeeds when hdc reports `FileTransfer finish`.
102
- - `sqlite3`: Run `sqlite3` on a device. Opt: `--device <name|serial>` (optional when exactly one device is connected, required when multiple). `db-path` is the on-device SQLite file; all further args are forwarded to the device `sqlite3` as-is (e.g. `-json`, `-readonly`, SQL strings, dot-commands). Maps to `hdc -t <serial> shell sqlite3 <db-path> [args...]`.
102
+ Manage connected devices — device info, app management, system control, screen, files, clipboard, fonts, view mode, location mock, network simulation, and media playback. All subcommands accept `--device <name|serial>` (Req on multi-device hosts).
103
+
104
+ | Subcommand | Description | Key Options |
105
+ |---|---|---|
106
+ | `list` | Show active real devices and running emulators | `--format table\|json` (default: `table`) |
107
+ | `view` | Detailed device info | `-t <name\|serial>` (Req on multi-device), `--format table\|json` (default: `table`) |
108
+ | `sqlite3 <db-path>` | Run `sqlite3` on a device; all args after `db-path` forwarded as-is | Maps to `hdc -t <serial> shell sqlite3 <db-path> [args...]` |
109
+ | `app install [files...]` | Install hap/hsp packages | `--replace` (overwrite), `--shared <path>` (HSP libs, repeatable), `--wait <seconds>` (180–600), `--user <userId>` |
110
+ | `app uninstall` | Uninstall app by bundle name | `--bundle <name>` |
111
+ | `app list` | List installed apps | `--format default\|json` |
112
+ | `app info <bundleName>` | Show app details | `--format default\|json` |
113
+ | `app foreground` | Show current foreground app | `--format default\|json` |
114
+ | `app start` | Launch app ability | `--bundle <name>`, `--ability <name>`, `--action <action>`, `--uri <uri>` |
115
+ | `app stop` | Force-stop app | `--bundle <name>` |
116
+ | `app cleardata` | Clear app data | `--bundle <name>` |
117
+ | `app clearcache` | Clear app cache | `--bundle <name>` |
118
+ | `wake` | Wake screen | — |
119
+ | `sleep` | Suspend screen | — |
120
+ | `status` | Show screen state (AWAKE/SLEEP) | — |
121
+ | `unlock` | Wake + swipe-up to unlock (phone/tablet only, not 2in1) | — |
122
+ | `open-control-center` | Swipe to open control center (phone/tablet only) | — |
123
+ | `open-notification-center` | Swipe to open notification center (phone/tablet only) | — |
124
+ | `time [datetime]` | Get (no arg) or set system time | `[datetime]` positional arg |
125
+ | `timezone [timezone]` | Get (no arg) or set system timezone | `[timezone]` positional arg |
126
+ | `screen size` | Get screen resolution | `--format default\|json` (json: `{width, height}`) |
127
+ | `screen rotation` | Get current screen rotation | — |
128
+ | `screen rotate <angle>` | Set screen rotation angle | `<angle>`: `0\|90\|180\|270` |
129
+ | `screen rotation-lock <state>` | Lock/unlock auto-rotate | `<state>`: `on\|off` |
130
+ | `screen sleeptime <ms>` | Set screen-off timeout | `<ms>`: timeout in ms; `-1` = never sleep |
131
+ | `file send <local> <remote>` | Push file to device | `<local>` source path, `<remote>` dest path |
132
+ | `file recv <remote> <local>` | Pull file from device | `<remote>` source path, `<local>` dest path |
133
+ | `file exist <path>` | Check if file exists on device | `<path>` on-device file path |
134
+ | `file delete <path>` | Delete file on device | `<path>` on-device file path |
135
+ | `clipboard read` | Read clipboard text | — |
136
+ | `clipboard write <text>` | Write text to clipboard | `<text>` positional arg |
137
+ | `clipboard clear` | Clear clipboard | — |
138
+ | `font info <fontpath>` | Query font info | `<fontpath>` font file path |
139
+ | `font install <fontpath>` | Install font file | `<fontpath>` font file path |
140
+ | `font uninstall <name>` | Uninstall font by name | `<name>` font name |
141
+ | `viewmode` | Get current dark/light mode | — |
142
+ | `viewmode dark` | Set dark mode | — |
143
+ | `viewmode light` | Set light mode | — |
144
+ | `location set` | Mock location from coordinates | `--latitude <degrees>`, `--longitude <degrees>`, `--altitude <m>`, `--speed <m/s>`, `--direction <degrees>` (0–360), `--interval <seconds>` (1–3600, default 1) |
145
+ | `location set` (gpx) | Mock location from GPX file | `--gpx-file <path>`, `--interval <seconds>` (mutually exclusive with lat/lon mode) |
146
+ | `location enable` | Turn on location mock (also done automatically by `set`) | — |
147
+ | `location disable` | Turn off and restore real location | — |
148
+ | `network-sim start` (preset) | Start preset scenario (1–8) | `--id <n>` |
149
+ | `network-sim start` (custom) | Start custom network scenario | `--name <n>`, `--up-bandwidth <bps>`, `--down-bandwidth <bps>`, `--up-latency <ms>`, `--down-latency <ms>`, `--up-drop <0-1>`, `--down-drop <0-1>` (`--id` and custom options mutually exclusive) |
150
+ | `network-sim stop` | Clear simulation, delete custom scenario, disable netcopilot (idempotent) | — |
151
+ | `network-sim list` | Show preset scenarios | — |
152
+ | `network-sim status` | Report enabled/disabled | — |
153
+ | `playback list` | Show active media sessions (bundle name + session ID) | — |
154
+ | `playback play` | Play media | `--id <sessionID>` or `--bundle <bundleName>` |
155
+ | `playback pause` | Pause media | `--id <sessionID>` or `--bundle <bundleName>` |
156
+ | `playback next` | Next track | `--id <sessionID>` or `--bundle <bundleName>` |
157
+ | `playback previous` | Previous track | `--id <sessionID>` or `--bundle <bundleName>` |
158
+ | `playback forward` | Fast forward (step size app-defined) | `--id <sessionID>` or `--bundle <bundleName>` |
159
+ | `playback rewind` | Rewind (step size app-defined) | `--id <sessionID>` or `--bundle <bundleName>` |
160
+ | `playback seek` | Jump to position | `--position <seconds>`, `--id <sessionID>` or `--bundle <bundleName>` |
161
+
162
+ - `location`: requires system version 7.0+ (testhelper).
163
+ - `network-sim`: requires API 20+ (netcopilot).
164
+ - `playback`: requires system version 6.1+ (ohos-avsession-manager).
165
+
166
+
103
167
 
104
168
  ### `devecocli run` `[Outside sandbox]`
105
169
  Build, install, and launch. After a successful ability launch (and after a successful `--apply`), runs a **default smoke check**. Success prints `Smoke: PASS`; failures print `Smoke: FAIL_CRASH` or `Smoke: FAIL_BLANK` (crash log path via `crash_log:`, blank screenshot via `screenshot:`) and exit non-zero. Smoke is skipped when there is no ability to launch, and for `--hotreload` / `--hotreload-apply`.
@@ -109,11 +173,12 @@ Build, install, and launch. After a successful ability launch (and after a succe
109
173
  - `--ability <ability>`: Default from `module.json5`.
110
174
  - `--uninstall`: Uninstall existing app first (Fixes signing key issues).
111
175
  - `--skip-build`: Deploy existing artifacts.
176
+ - `--debug-line`: Forward `-p debugLine=true` to hvigor for the full build, `--apply`, and hot-reload compiles (default: disabled).
112
177
  - `--apply <fileName>`: **Fast incremental deploy** — rebuilds only changed files into a signed hqf, installs via `bm quickfix -a -f -o`, then restarts the app. Much faster than a full `devecocli run` for iterating on code changes. Modules are auto-detected from the file paths in `<fileName>` (no `--module` needed).
113
178
  - `<fileName>`: a plain file name (no path separators) under the project's `.hvigor/` directory; the caller writes the changed-file list there. File name is sanitized to prevent path traversal. Content: list of **source file paths changed this round** (one per line, relative to project root or absolute; `#` comments and blank lines ignored; typically `.ets`/`.ts`/`.cpp`/resource files). The changeFileList is **incrementally merged** — only list files changed since the last apply; previously listed files are retained automatically.
114
- - **Prereq**: DevEco Studio ≥6.1.1 (hvigor `assembleDevHqf` support; below is rejected with an upgrade hint); run `devecocli run` once first (full build + deploy — `--apply` reuses its build intermediates and generates its own short-lived `buildConfig.json` per apply).
179
+ - **Prereq**: DevEco Studio ≥6.1.1 (hvigor `assembleDevHqf` support; below is rejected with an upgrade hint); run `devecocli run` once first (full build + deploy — `--apply` reuses its build intermediates and generates its own short-lived `buildConfig.json` per apply). Normal `run`/`build` clears the symbol table required by cold-reload ArkTS patches; the first `--apply` with ArkTS changes after a normal build automatically runs a full `assembleHap`/`assembleHsp` bootstrap (by module type) to regenerate it (may take tens of seconds on a cold cache; resource-only applies skip this). Consecutive applies without an intervening normal build reuse the symbol table and are fast.
115
180
  - **Do not mix with an active `--hotreload` watch session**: both drive patch builds over the same per-module `buildConfig.json`; stop the session (`--hotreload stop`) first.
116
- - **If changes don't take effect**: on any apply failure, fall back to a full `devecocli run`.
181
+ - **If changes don't take effect**: on any apply failure, fall back to a full `devecocli run`. Note: the bootstrap rebuild produces a hap containing `ets/symbolMap.map` (hot-reload compilation side effect); this is harmless for `--apply` (only the hqf is installed, not the hap) and the next normal `run`/`build` cleans it — a later `run --skip-build` would deploy that regenerated hap as-is.
117
182
  *Ex*: `devecocli run` → edit code → write `.hvigor/changes.txt` → `devecocli run --apply changes.txt`
118
183
  - `--hotreload [action]`: **Hot-reload watch session** — must be started as a **background process** (the process holds a persistent socket to the hvigor daemon). It builds the hap in hot-reload mode (`hotReload=true debuggable=true`), deploys+launches the app, then the process itself connects a socket to the daemon and sends `CommonBuild assembleHap --hot-reload-build --watch`, **staying connected** so the daemon's watch worker (rollup watch) stays alive for `--hotreload-apply` to reuse. The process stays alive (onBuildOutput streams to its stdout). **Must be stopped (kill the background process) when the hot-reload debug session ends** — otherwise the watch worker/daemon leaks. `--hotreload stop` additionally stops the hvigor daemon.
119
184
  - **Usage**: start `devecocli run --module <m> --hotreload` as a background process; wait for the `.hotreload-mode` marker (or "watch session active" on its stdout) = ready; then run `devecocli run --module <m> --hotreload-apply <file>` (foreground). When done: kill the background process + `devecocli run --hotreload stop`.
@@ -146,7 +211,12 @@ Fetch hilog or crash logs. Req `--device <name|serial>` on multi-device hosts.
146
211
  - `--bundle-name` / `--keyword`: Filter output.
147
212
  - `--from <start>` / `--to <end>`: Relative offsets (`30s`, `5m`).
148
213
  - `--tail <num>` / `--follow`: Keep last N lines / stream real-time (no `--to`).
149
- *Ex*: `devecocli log --crash --bundle-name com.example.app`, `devecocli log --level E --from 5m --tail 200`
214
+ - `--path <path>` + `--crash`: Analyze a local fault log file or directory (cpp_crash / js_crash / app_freeze) instead of pulling from device; picks the most relevant candidate when given a directory.
215
+ - `--stack` + `--path <file>`: Analyze a local sample stack file (enhanced log); mutually exclusive with `--crash`.
216
+ - `--format default|json|report|hilog`: Output format for local analysis (`hilog` extracts the HiLog section, `--crash` only).
217
+ - `--limit <num>`: Max hotspots shown by `--stack` (default 20).
218
+ - `--path` cannot be combined with device log options (`--device`, `--level`, `--bundle-name`, `--keyword`, `--tail`, `--from`, `--to`, `--follow`).
219
+ *Ex*: `devecocli log --crash --bundle-name com.example.app`, `devecocli log --level E --from 5m --tail 200`, `devecocli log --crash --path ./faultlog --format report`, `devecocli log --stack --path sample_stacks.txt --limit 20`
150
220
 
151
221
  ### `devecocli verify`
152
222
  Run UI verification on a connected device. Based on natural-language functional steps, the tool launches the app, uses screenshots to judge the current UI state, performs UI operations, and verifies whether the functionality completes correctly. This is the standard tool for UI testing and issue reproduction.
@@ -164,7 +234,7 @@ Supported operations include tap, double-tap, swipe, long press, key input, mous
164
234
  - `--no-fresh-start` — Skip relaunching the app before verification; omit to relaunch by default.
165
235
  - `--device <name|serial>` — device name (substring) or serial; auto-selected on single-device hosts, **required on multi-device hosts**. Quote names with spaces (e.g. `--device "Mate 70 Pro"`).
166
236
 
167
- Output JSON contains `success`, `reason` (failure cause), `successPart`, `failPart`, and `id` (unique task ID for log and screenshot retrieval).
237
+ Output JSON contains `success`, `reason` (failure cause), `successPart`, `failPart`, `failType`, and `id` (unique task ID for log and screenshot retrieval). `failType` is `''` when verification passed. Otherwise it is `verification_failed` (a step did not meet its expectation), `unsupported` (a required action is outside the tool, including sound, haptics, and acting on a moving target), `invalid_plan` (the plan is not a valid test, or this device cannot run it), `execution_error` (the run stopped before a conclusion), or `inconclusive` (the evidence cannot separate an app failure from a tool limit, including the round limit).
168
238
 
169
239
  Each UI verification run is limited to 10 minutes.
170
240
 
@@ -180,6 +250,33 @@ Examples:
180
250
  - `devecocli verify --test-plan '1. 启动应用,预期:进入应用主界面' --no-fresh-start`
181
251
  - `devecocli verify --test-plan '1. 启动应用,预期:进入应用主界面' --device 127.0.0.1:5555`
182
252
 
253
+ ### `devecocli verify appanalyzer` `[Outside sandbox]`
254
+ Run local health checks for apps and atomic services through the bundled AppAnalyzer CLI: it inspects the running app, then reports analysis guidance and fix suggestions.
255
+ - **Prereq**: Command Line Tools install source (not available in DevEco Studio) with the AppAnalyzer component. Run `devecocli verify appanalyzer init` before any check to initialize the environment.
256
+
257
+ | Subcommand | Description |
258
+ |---|---|
259
+ | `init` | Initialize the tool environment (installs Python dependencies). |
260
+ | `autoAnalyze` | Automated page traversal + detection. |
261
+ | `uxAnalyze` | Manual single-page UX detection; put the device on the target page and keep the screen on first. |
262
+ | `powerAnalyze` | Manual power-consumption detection: records ~15s of the app standing by in the foreground, then reports. Real devices only. |
263
+
264
+ - **Common options**: `-b/--bundleName` (Req), `-p/--projectPath` (Req), `-s/--scenes` (default: recommended scenes), `-d/--device <serial|IP:port>` (default: first available real device, else first emulator), `-o/--output <reportPath>` (default: cwd), `-m/--hapPaths` (only with the basic scene, for icon checks).
265
+ - `autoAnalyze` also takes `-t/--duration <minutes>` (5–240, default `10`).
266
+ - Reports are written as both JSON and ZIP to the output path.
267
+
268
+ **Scenes** — `-s` takes a category (`Dxx`, runs every scene under it) or individual scenes (`Sxx`, comma-separated):
269
+
270
+ | Category | Meaning | Scenes |
271
+ |---|---|---|
272
+ | `D03` | UX — multi-device layout adaptation | `S14` truncation, `S15` large image/large font, `S16` white space, `S17` avoid-area occlusion, `S18` foundation |
273
+ | `D04` | Power consumption | `S11` foreground standby |
274
+
275
+ *Ex*: `devecocli verify appanalyzer init`
276
+ *Ex*: `devecocli verify appanalyzer autoAnalyze -b com.example.app -p ./MyApp -s D03 -t 5 -o ./output`
277
+ *Ex*: `devecocli verify appanalyzer uxAnalyze -b com.example.app -p ./MyApp -s S14,S15 -d 127.0.0.1:5555`
278
+ *Ex*: `devecocli verify appanalyzer powerAnalyze -b com.example.app -p ./MyApp`
279
+
183
280
  ### `devecocli verify log`
184
281
  Retrieve the execution log of a verification task by ID.
185
282
 
@@ -209,23 +306,63 @@ Inspect UI on a connected device. All subcommands accept `--device <name|serial>
209
306
  | `window list` | List active windows | `--format default\|json`, `--all` (include system windows) |
210
307
  | `screenshot` | Capture a screenshot of the device screen | `--display <displayId>`, required `--path <path>` (existing directory or PNG file path; relative paths supported; writable destination; no overwrite) |
211
308
  | `screenrecord` | Record the screen to an MP4 file (physical devices only; emulators are rejected) | interactive by default, or `start` / `stop` / `status`; required `--path <dir|file.mp4>` for interactive and `start`; `stop --force` stops a recording not started by this CLI; `status --format table\|json` |
212
- | `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
213
- | `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
214
- | `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
215
- | `swipe <x1> <y1> <x2> <y2>` | Swipe from one point to another (precise coordinates, custom speed) | `--speed <n>` (200–40000, px/s) |
309
+ | `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--selector <expr>`, `--window <windowId>` (used with `--id` or `--selector`) |
310
+ | `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--selector <expr>`, `--window <windowId>` |
311
+ | `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--selector <expr>`, `--duration <ms>` (500–60000, default 1000), `--window <windowId>` |
312
+ | `swipe <x1> <y1> <x2> <y2>` | Swipe from one point to another (coordinates or element mode) | `--start <expr> --end <expr>` (element mode; both required together), `--speed <n>` (200–40000, px/s) |
216
313
  | `fling <x1> <y1> <x2> <y2>` | Fling from one point to another | `--speed <n>` (200–40000, px/s) |
217
- | `drag <x1> <y1> <x2> <y2>` | Drag from one point to another | `--speed <n>` (200–40000, px/s) |
314
+ | `drag <x1> <y1> <x2> <y2>` | Drag from one point to another (coordinates or element mode) | `--start <expr> --end <expr>` (element mode; both required together), `--speed <n>` (200–40000, px/s) |
218
315
  | `dircfling <direction>` | Quick directional fling (system default speed, ideal for scrolling) | `direction`: `up`, `down`, `left`, `right` |
219
- | `text <text> [x] [y]` | Input text at a target location or the currently focused field | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
220
-
221
- - **Coordinates vs `--id`**: Mutually exclusive. Provide either `x y` or `--id <id>`. For `text`, if neither is given, text goes to the currently focused field.
222
- - **`--window`**: May only be used together with `--id`. Default is focused window. Secondary display operations via `--id` + `--window` are not supported.
223
- - **`swipe` vs `dircfling`**: `swipe` requires exact start/end coordinates and supports `--speed`; `dircfling` only needs a direction (`up/down/left/right`) and uses system default speed (ideal for page/list scrolling).
316
+ | `text <text> [x] [y]` | Input text at a target location or the currently focused field | `--id <id>` (auto-resolves to center), `--selector <expr>`, `--window <windowId>` (used with `--id` or `--selector`) |
317
+ | `cleartext` | Clear text via Ctrl+A + Del (optionally click target element first) | `--selector <expr>` (click before clearing; default: focused field), `--window <windowId>` |
318
+ | `scrolltostart` | Scroll a scrollable container to the start (top) | `--selector <expr>` (default: first scrollable element), `--speed <n>` (200–40000, default 1500), `--timeout <ms>` (1–3600000, default 60000) |
319
+ | `scrolltoend` | Scroll a scrollable container to the end (bottom) | `--selector <expr>` (default: first scrollable element), `--speed <n>` (200–40000, default 1500), `--timeout <ms>` (1–3600000, default 60000) |
320
+ | `scrollsearch <selector>` | Scroll within a container and search for a target element | `--scroll-selector <expr>` (default: first scrollable element), `--vertical <true\|false>` (default true), `--offset <n>` (≥0, default 80), `--timeout <ms>` (1–3600000, default 60000) |
321
+ | `pinch <scale> [x] [y]` | Pinch (zoom) at an element or coordinates | `--selector <expr>`, `--area-radius <n>` (integer ≥50; default: 300 for coords, 90% of area for element/screen), `--speed <n>` (600–3000, default 600), `--window <windowId>` |
322
+ | `rotate <angle> [x] [y]` | Two-finger rotation at an element or coordinates | `--direction <cw\|ccw>` (default cw), `--selector <expr>`, `--radius <n>` (50–500, default 300), `--speed <n>` (200–40000, default 1500), `--window <windowId>` (used with `--selector`) |
323
+ | `press_key <key1> [key2] [key3]` | Press hardware/system key(s), up to 3 for combos | keys: string name (`back`/`enter`/`ctrl_left`) or numeric keycode |
324
+ | `find [selector]` | Find UI element(s) by selector DSL, XPath, or base64 — polls until match or timeout | `--device`, `--window <windowId>`, `--all` (return all matches), `--timeout <ms>` (default 3000, max 360000), `--format default\|json` |
325
+ | `wait [timeoutMs]` | Wait for element to appear/disappear, or pure sleep if no selector | `--device`, `--window <windowId>`, `--disappear` (wait for element to disappear; requires selector); `<selector>` as positional arg triggers element wait mode |
326
+
327
+ - **Coordinates vs `--id`/`--selector`**: Mutually exclusive. Provide either `x y`, `--id <id>`, or `--selector <expr>`. For `text`, if none is given, text goes to the currently focused field. For `swipe`/`drag`, use either coordinates or `--start <expr> --end <expr>` (both required together).
328
+ - **`--window`**: Default is focused window. May be used with `--id`, `--selector`, or coordinate mode.
329
+ - **Selector DSL**: `key op value` clauses, `,`-separated for AND, `[n]` for index. Operators: `=` (exact), `*=` (contains), `^=` (prefix), `$=` (suffix), `/=` (regex). Also supports `xpath=` prefix for XPath 1.0 expressions and `base64=` prefix to escape shell/DSL special characters. Duplicate property keys (including `desc`/`description` aliases) are rejected.
330
+ - **`swipe`/`drag` element mode**: `--start <expr> --end <expr>` resolves each selector to bounds center, then performs the swipe/drag. Both must be provided together.
331
+ - **`find`/`wait`**: `find` polls the UI tree every 300ms until a match is found or `--timeout` expires. `wait` without a selector is a pure sleep; with a selector, polls for appearance (default) or disappearance (`--disappear`).
332
+ - **`swipe` vs `dircfling`**: `swipe` requires exact start/end coordinates (or `--start`/`--end`) and supports `--speed`; `dircfling` only needs a direction (`up/down/left/right`) and uses system default speed (ideal for page/list scrolling).
333
+ - **`scrollsearch`**: The target `<selector>` does not support an index (`[n]`); passing one triggers an error.
224
334
  - **Text encoding**: Special characters in `text` are Base64-encoded internally to safely pass through device shell.
225
335
  - `--format json` pairs well with `jq`.
226
336
  - `--mode full`: full layout tree, no filtering.
227
337
  - `--mode simplified` (default): folds meaningless wrapper containers (non-root, no `id`, no text, not interactive) by lifting their surviving children up. `--depth` truncates after folding.
228
338
 
339
+ ### `devecocli testing` `[Outside sandbox]`
340
+
341
+ Run DevEco Testing detection services on a connected device.
342
+
343
+ | Sub-command | Parameters |
344
+ |---|---|
345
+ | `list` | — (`ServiceKey`, `Status`) |
346
+ | `install` | `--service <serviceKey>` |
347
+ | `update` | `--service <serviceKey>` |
348
+ | `run <serviceKey>` | `--package <bundleName>`, `--sn <serial[,serial]>`, `--duration <minutes>`, `--yes` |
349
+ | `stop` | `--task-id <taskId>` |
350
+ | `userinfo`, `exit` | — |
351
+
352
+ Parameter reference: `devecocli testing <sub-command> --help`.
353
+
354
+ ```powershell
355
+ devecocli testing list
356
+ devecocli testing install --service MemLeakTest
357
+ devecocli testing update --service MemLeakTest
358
+ devecocli testing run MemLeakTest --package com.example.myapp --sn <serial> --duration 10 --yes
359
+ ```
360
+
361
+ **Device**: `--sn` must be the device the user confirmed. With several devices connected (`devecocli device list`), ask which one to test and wait for the answer; never default to the first serial.
362
+
363
+ **Progress**: run `testing run` with the globally installed CLI (`& "$env:APPDATA\npm\devecocli.cmd"` on Windows, `"$(npm prefix -g)/bin/devecocli"` elsewhere) so output streams.
364
+
365
+ **Result**: the run ends with `[REPORT] 报告已生成: <dir>`; read `<dir>/export/2d_report_data.json` (`isTaskPass`, `expandData[].resultSummary`, `expandData[].resultDetails[].status`) or `<dir>/export/Task-*.html` — never print the JSON. Services that write no `2d_report_data.json` keep the verdict in `<dir>/report/<taskId>_report.json` (`taskResult.taskPass`). Exit code stays `0` even when the task fails; on failure read `[ERROR]` / `[SUGGEST]`.
229
366
 
230
367
  ## 2. Setup
231
368
 
@@ -235,16 +372,17 @@ When this skill is provided by an agent plugin, follow its injected Runtime guid
235
372
 
236
373
  ### `devecocli init`
237
374
  MUTUALLY EXCLUSIVE modes for setup:
238
- 1. `--skill` (Default): Install `deveco-cli` skill to AI agents.
375
+ 1. `--skill` (Default): Install all bundled skills (`deveco-cli`, `hmos-arkui-develop-skill`, `hmos-dfx-analyzer`) to AI agents; each skill is linked into the agent skill paths pointing to the CLI package.
239
376
  2. `--mcp`: Configure `deveco-mcp` server (ArkTS/C++ syntax checking).
240
377
  *Options*:
241
378
  - `--agent <agents>`: Comma-separated (e.g. `opencode,pi,cursor`). Defaults to detected agents.
242
379
  - `--project <path>`: Project-level config (Abs path for MCP).
243
380
  - `--path <path>`: Direct skill install path; cannot combine with `--agent`, `--project` or `--mcp`.
381
+ - `--with-homegraph`: With `--mcp` only. Also install the `homegraph` CLI and write a sibling `homegraph` MCP entry; records an opt-in marker so `devecocli update` can upgrade it later. Errors if used without `--mcp`.
244
382
  *MCP Rules*: Configured MCP agents support global (no `--project`) and project-level setup; `qoder` is unsupported.
245
383
  *Skill agents*: See README.md, “Skill 支持的智能体”. All supported agents allow global and project installation. If an agent is not detected, specify `--agent`.
246
384
 
247
- **Existing Skill paths and MCP entries are skipped by default. To update them or convert copied Skill installations to symlinks, rerun `devecocli init -f` (or `--force`); old content and local edits will be deleted.** This flag also allows missing target directories to be created. Correct links are kept and follow CLI updates; failed linking falls back to copying. `skills remove` keeps the npm bundled Skill.
385
+ **Existing Skill paths and MCP entries are skipped by default. To update them or convert copied Skill installations to symlinks, rerun `devecocli init -f` (or `--force`); old content and local edits will be deleted.** This flag also allows missing target directories to be created. Correct links are kept and follow CLI updates; failed linking falls back to copying. `skills remove` rejects bundled skill names and never touches the npm package. Bundled skills newly added by a CLI upgrade are installed by rerunning `devecocli init` (already-installed links follow package updates automatically).
248
386
 
249
387
  ### `devecocli auth login`
250
388
  Sign in to your Huawei Developer account. Opens a browser for OAuth authentication. Required before `signature generate`. On an interactive terminal it waits for Enter before opening the browser; pass `--no-prompt` to open it immediately (also auto-skipped when stdin is not a TTY).
@@ -261,20 +399,33 @@ Show the current logged-in user.
261
399
  List team accounts the current user has joined.
262
400
 
263
401
  ### `devecocli skills`
264
- Manage HarmonyOS skills in AI agents/projects.
265
- - `list [-l|--long]` / `find <keyword>`: List or search skills.
266
- - `add (--all | --skill <name>) [--agent <a,b…>] [--project <path>] [--path <path>] [-f]`: Install.
267
- - `remove --skill <name> [...]`: Uninstall.
402
+ The skills command manages HarmonyOS skills for AI agents and projects, supporting listing, keyword search, installation and uninstallation. Use this tool when you need to view, search, add or remove HarmonyOS skills bound to AI agents or projects.
403
+ - `list [-l|--long]` / `find <keyword>`: List or search skills; bundled skills are shown first with the `[built-in]` marker and remain visible when the marketplace is unreachable.
404
+ - `add (--all | --skill <name>) [--agent <a,b…>] [--project <path>] [--path <path>] [-f]`: Install. A `--skill` name that is bundled in `packages/cli/skills` is rejected — use `devecocli init` (those skills update with the CLI package). `--all` installs marketplace skills only. (`hmos-design2arkts`, shipped with the design2arkts engine, is the exception: it is bundled but installed on demand through `add`.)
405
+ - `remove --skill <name> [...]`: Uninstall (marketplace skills; names bundled in `packages/cli/skills` are rejected — they follow the CLI package). `-f` also removes modified managed Skills, deleting their local edits.
268
406
  - Ordinary project paths such as `skills/` and `data/` require an explicit `--agent` for installation or removal; automatic selection ignores them.
407
+ A minimum set is bundled with the CLI and installed by `devecocli init`: `hmos-arkui-develop-skill` (ArkTS red-line rules, fatal pitfalls + accurate API entry) and `hmos-dfx-analyzer` (DFX fault triage: input normalization, deterministic fault classification and routed analysis for crashes, freezes and faultlogs) — covering pre-coding constraints and fault diagnosis.
408
+
409
+ Routing: load `hmos-arkui-develop-skill` before writing or modifying `.ets` UI code, `hmos-dfx-analyzer` for fault analysis (crash/freeze/ANR, CppCrash, JSCrash, AppFreeze, faultlogs), and use `deveco-cli` commands for build/run/device/log work. `hmos-one-sdk-skill` is not bundled with the CLI; install it on demand with `devecocli skills add --skill hmos-one-sdk-skill`.
269
410
 
270
- **Existing Skill paths are skipped by default. Use `-f` / `--force` to replace them, deleting old content and local edits. To convert copied agent installations to symlinks, rerun `devecocli init -f` for `deveco-cli` or `devecocli skills add --skill <name> -f` for other Skills.** This flag also allows missing target directories to be created. Correct links are kept; failed linking falls back to copying. Batch installation continues after failures, prints a summary and exits nonzero if any Skill fails.
411
+ **Existing Skill paths are skipped by default. Use `-f` / `--force` to replace them, deleting old content and local edits. To convert copied agent installations to symlinks, rerun `devecocli init -f` for bundled skills or `devecocli skills add --skill <name> -f` for other Skills.** This flag also allows missing target directories to be created. Correct links are kept; failed linking falls back to copying. Batch installation continues after failures, prints a summary and exits nonzero if any Skill fails.
271
412
 
272
- Extracted skills are stored in <CLI data directory>/skills/store/<name> globally or <project>/.deveco-cli/skills/store/<name> per project (consider ignoring .deveco-cli/skills/ in version control). Agent skill entries like .agents/skills/<name> link directly to this store, reusing existing files for new Agents. Note that -f updates affect every linked Agent in that scope.
413
+ Extracted skills are stored in <CLI data directory>/skills/store/<name> globally or <project>/.deveco-cli/skills/store/<name> per project (consider ignoring .deveco-cli/skills/ in version control). Agent skill entries like .agents/skills/<name> link directly to this store, reusing existing files for new Agents. Bundled skills skip the store: their agent entries link directly into the CLI package, so they update with `npm update` of the CLI. Note that -f updates affect every linked Agent in that scope.
273
414
 
274
415
  *Ex*: `devecocli skills add --skill <name> --agent opencode --project ./MyApp`
275
416
 
417
+ ### `devecocli plugin`
418
+ Manage whitelisted npm-packaged AI agent plugins (official registry only; the whitelist `npmPackage` coordinate may carry a `@tag` suffix to select a dist-tag, e.g. `@scope/pkg@cli` — defaults to `latest`).
419
+ - `list [-l|--long]`: List whitelisted plugins and locally downloaded versions in a `Name / Version / Status` table (one row per cached version, ascending; `not installed` when none); `--long` appends `NpmPackage` and `Desc` columns.
420
+ - `install <name> [--agent <a,b…>] [--project <path>] [-f]`: Download the package into the CLI data directory, then run the plugin's `install` hook per target agent (detected agents ∩ plugin `supportedAgents`; a plugin omitting `supportedAgents` defaults to all known agents, while an explicitly empty/unknown list fails contract validation). `--force` runs the previous version's `uninstall` hook first. With an explicit `--agent` plus `--project`, missing target skills dirs (including the `.<agent>` root) are created before hooks run, matching `init --project --agent`.
421
+ - `update <name> [--agent <a,b…>] [--project <path>]`: Fetch the latest version and run the `update` hook (`from`/`to` provided; `from` is the highest pre-download store version — `from === to` means no local version or latest already cached, treat as repair/first install). With an explicit `--agent` plus `--project`, missing target skills dirs (including the `.<agent>` root) are created before hooks run, same as `install`.
422
+ - `uninstall <name> [--agent <a,b…>] [--project <path>]`: Run the `uninstall` hook of the highest loadable local version. Never deletes cached packages (`<dataDir>/plugins/store/<name>/`) or plugin data (`<dataDir>/plugins/data/<name>/`); remove those manually if needed.
423
+ - Hook execution is capped at 120s (override with `DEVECO_CLI_PLUGIN_HOOK_TIMEOUT_MS`).
424
+
425
+ *Ex*: `devecocli plugin install example-plugin --agent opencode --project ./MyApp`
426
+
276
427
  ### `devecocli check compat` `[Outside sandbox]`
277
- Scan source code for breaking API changes between two SDK versions. Built on top of DevEco Studio's `arkanalyzer-apiscan` plugin.
428
+ Scan source code for breaking API changes between two SDK versions. Built on top of DevEco Studio's `arkanalyzer-apiscan` plugin (Studio ≥ 26.0.0.810) or Command Line Tools' `apicompat` component (CLT ≥ 26.0.1). On Linux, CLT is required.
278
429
  - `versions`: List available target SDK versions. Opts: `--format <default|json>` (default: `default`).
279
430
  - Default (no args): project-level scan.
280
431
  - `--modules <m1> [m2...]`: Module-level scan.
@@ -288,6 +439,12 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
288
439
 
289
440
  *Ex*: `devecocli check compat --source-version "<source_version>" --target-version "<target_version>" --output-path ./report`
290
441
 
442
+ ### `devecocli design2arkts` (alias: `d2a`)
443
+
444
+ Use `devecocli d2a --help` for Pixso/Figma design-to-ArkTS workflows and standalone capabilities accepting local images or code without a prior D2A run.
445
+
446
+ Solution design supports UI pages only; repository analysis covers the target page and its dependencies. The Pixso workflow proceeds from repository understanding to page design. Follow the Controller-returned stage IDs; they are not guaranteed to be consecutive.
447
+
291
448
  ## 3. Maintenance
292
449
 
293
450
  - **`devecocli update`** `[Outside sandbox]`: Update CLI to latest version.
@@ -304,11 +461,15 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
304
461
  - **Fresh checkout to emulator**:
305
462
  `devecocli build` -> `devecocli emulator list` -> `devecocli emulator start "Name"` -> `devecocli run`
306
463
  - **Diagnose crash**:
307
- `devecocli log --crash --bundle-name <bundle>`
464
+ `devecocli log --crash --bundle-name <bundle>` (device), or `devecocli log --crash --path <faultlog file|dir> --format report` (local analysis), or `devecocli log --stack --path <sample_stacks file>` (freeze hotspot analysis)
308
465
  - **Release build**:
309
466
  `devecocli build --product oversea --build-mode release`
310
467
  - **First-time signing setup** (login authorized; user completes browser authentication):
311
468
  `devecocli auth login --no-prompt` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
469
+ - **One-sentence detection run** (e.g. "测试商城应用内存泄漏"):
470
+ read `AppScope/app.json5` for the bundle name and `devecocli device list` for the serial ->
471
+ `devecocli testing list` -> `devecocli testing install --service MemLeakTest` if `Not installed` ->
472
+ `devecocli testing run MemLeakTest --package <bundleName> --sn <serial> --duration 240 --yes` -> summarize `[REPORT]`
312
473
 
313
474
  ## Troubleshooting
314
475
 
@@ -325,3 +486,9 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
325
486
  - **`emulator create` timeout**: Treat as user-action step. Ask user to open DevEco Studio -> Device Manager. Check `emulator list` after user confirms. Do NOT auto-retry or edit SDK files.
326
487
  - **`image list` duplicate OS rows**: `phone`/`foldable`/`widefold`/`triplefold` share the same image. Download/remove ONCE per OS version.
327
488
  - **`ui layout` missing expected node**: `layout` only returns on-screen nodes. Use `devecocli ui dircfling <direction>` or `devecocli ui swipe <x1> <y1> <x2> <y2>` to scroll the target into view, then retry `ui layout`. Specify `--device <name|serial>` when multiple devices are connected.
489
+ - **`未找到 DevEco Testing 安装`**: Install the DevEco Testing client or point `DEVECO_TESTING_HOME` at its install root; `devecocli testing help` confirms the path works.
490
+ - **`当前 DevEco Testing 版本不支持 testing`**: The installed client is too old. Run `devecocli testing update`, then retry.
491
+ - **`[ERROR] 前置确认未通过`**: `run` hit the confirmation prompt in a non-interactive shell. Add `--yes`.
492
+ - **`run` killed mid-test**: The bash timeout was shorter than the test. Re-run with a longer timeout; a killed run produces no report.
493
+ - **"Skills marketplace is not available in your region"**: Expected when running `skills list/find/add` outside Chinese mainland (incl. HK/MO). Installed skills still work; `skills remove` and `init` don't touch the network.
494
+ - **"CLI online services are not available in your region"**: Commands needing cloud services (login/signature/agreement) abort when GRS is unreachable or the region has no config; local-only commands (`create`/`build`/`device`) are unaffected. Suggest checking `HTTP_PROXY`/`HTTPS_PROXY`. GRS verifies server certificates on every connection, proxied or not — a proxy that re-signs TLS (corporate inspection) fails closed unless its CA is listed in a `NODE_EXTRA_CA_CERTS` PEM file. Use `DEVECO_CLI_DEBUG=1` to inspect country-code detection and GRS resolution. Telemetry is CN-only (silently disabled elsewhere).
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: hmos-arkui-develop-skill
3
+ description: REQUIRED before writing the first .ets file of a session. Fatal gotchas list + API quick-reference for HarmonyOS ArkTS/ArkUI development. Load this skill when writing or modifying .ets files, porting TypeScript to ArkTS, or building any ArkUI page, component, layout, navigation, dialog, state-driven UI, or animation. Covers ArkTS linter rules, forbidden syntax, null safety, struct/@Component constraints, V1/V2 state management, rendering control, API parameter correctness, and UI quality. Triggers — .ets, ArkTS, ArkUI, HarmonyOS, struct, @Component, TS-to-ArkTS migration, ArkUI build error, runtime crash.
4
+ ---
5
+
6
+ # ArkTS/ArkUI 编码约束
7
+
8
+ 为 agent 写 ArkTS/ArkUI 代码提供致命陷阱清单和准确的 API 参考入口。
9
+
10
+ ## API 和约束查表优先
11
+
12
+ 1. **写任何组件前,必须同时查两类文件**:
13
+ - **API 签名**:在 `references/quick-apis/_index.md` 定位组件所在文件,用 Grep 取卡片(勿整读大文件)。签名必须照搬,不得凭记忆改写、增减参数或改变参数类型
14
+ - **约束规则**:在 `references/quick-rules/_index.md` 按任务特征查对应规则文件,提前预防错误
15
+ 2. **组件→规则文件交叉索引**(写某组件时,必查对应的规则文件):
16
+
17
+ | 写这些组件/功能时 | 必查 API 文件 | 必查规则文件 |
18
+ |---|---|---|
19
+ | List / Grid / WaterFlow / Tabs / Scroll | 01-layout | 12-layout(子组件约束)+ 06-rendering(ForEach/LazyForEach/Repeat) |
20
+ | Navigation / NavDestination | 12-navigation | 08-navigation(路由栈、pushPath param) |
21
+ | @State/@Link/@Prop/@Local/@Param 等 | 08-state-decorators | 05-state(V1/V2 混用、@Builder 传参、@ObjectLink 限制) |
22
+ | Button / Text / Image / TextInput | 02-basic-components | 07-attribute-params(臆造 API 清单) |
23
+ | DatePicker / TimePicker / TextPicker | 04-selectors | 07-attribute-params(构造参数字段名高发错) |
24
+ | AlertDialog / ActionSheet / bindSheet | 11-dialog-menu | 09-dialog(堆叠规则) |
25
+ | animateTo / transition | 09-animation | 07-attribute-params(curve 必须枚举等) |
26
+ | 手势 / 拖拽 | 10-gesture | 11-extension(手势绑定、拖拽冲突) |
27
+ | import / router / promptAction | — | 01-import(kit 路径)+ 02-uicontext(全局接口替换) |
28
+
29
+ ## 高频错误及约束
30
+
31
+ ### ArkTS 语法
32
+
33
+ 1. 不使用 any/unknown 类型、以及...解构赋值
34
+ 2. 从回调 / Map.get / Array.find / 可选属性取值时做空安全处理(`??` 默认值或判空)
35
+ 3. 函数与箭头函数参数必须显式标注类型;泛型函数调用必须显式指定类型参数——`arr.map(x => x.id)` ❌、`arr.map((x: Item): string => x.id)` ✅;`new Map()` ❌、`new Map<string, number>()` ✅;`arr.find(x => x.id === 1)` ❌、`arr.find((x: Item): boolean => x.id === 1)` ✅(依赖推断会报 `arkts-no-any-unknown` 或 `arkts-no-inferred-generic-params`)
36
+
37
+ ### 命名与作用域
38
+
39
+ 4. ArkTS 不支持声明合并(arkts-no-decl-merging),同一项目中不同文件的顶层 interface/class/struct 名不能重复,也不能与系统组件/全局类型重名——自定义名称一律加业务前缀
40
+ - WRONG: 文件A声明 `interface Item`,文件B也声明 `interface Item`
41
+ - RIGHT: 文件A用 `interface CartItem`,文件B用 `interface OrderItem`,按业务语义区分命名
42
+ 5. 变量名/参数名/方法名避开框架保留字(如 `builder`/`create`/`value`),否则报 `arkts-unique-names` 或 `10505001`——见 `references/quick-rules/03-component.md` 保留字全表
43
+ 6. **@State/@Prop/@Local 等成员名禁止与链式方法重名**——`value`/`width`/`height`/`margin`/`padding`/`offset`/`position`/`border`/`backgroundColor`/`opacity`/`visibility`/`scale`/`rotate`/`size`/`direction`/`enabled`/`zIndex`/`layoutWeight`/`alignItems`/`justifyContent`/`alignContent` 等通用属性名均为禁区 → **10505001**。用业务前缀消歧义:`currentValue` 而非 `value`
44
+
45
+ ### build() 与组件结构
46
+
47
+ 7. @Entry 根节点必须是单个容器组件(Column/Row/Stack 等);@Component 根节点可为非容器,但必须是唯一节点,但 **`ForEach` 仍不可作为根节点**
48
+ 8. build() 中不声明本地变量、不用 console、不直接改变状态变量
49
+ 9. ForEach / LazyForEach / Repeat 必须显式提供 key(用业务 ID 不用索引);省略时 ForEach 默认 `JSON.stringify`(bigint/循环引用会 jscrash),Repeat 生成随机值(每次更新全量重建)
50
+ 10. `@Entry` 不能用 `@ObjectLink`,必须抽子组件
51
+ 11. **Button('label') 与子组件互斥**——`Button('OK') { Text('x') }` ❌ → **10905202**;`Button('OK')` ✅ 或 `Button() { Text('x') }` ✅
52
+ 12. **@Builder 返回 void,调用处不可链式**——`myBuilder().onClick(...)` ❌
53
+ 13. **嵌套 ForEach 参数名必须不同**——外层 `row` 内层 `cell`,不用 `item`/`item`
54
+
55
+ ### 状态管理
56
+
57
+ 14. V1/V2 状态管理不混用——@Component 内只能用 @State/@Prop/@Link/@Provide/@Consume/@Watch/@ObjectLink/@Observed;@ComponentV2 内只能用 @Local/@Param/@Provider/@Consumer/@Monitor/@Computed/@ObservedV2/@Trace;AppStorageV2/PersistenceV2 只能在@ComponentV2 内使用;@Link/@ObjectLink 不本地初始化(值从父组件传入)
58
+ 15. `@State` 只代理第一层;嵌套属性变化不刷新,需 `@Observed` 类 + 子组件 `@ObjectLink` 逐层代理
59
+ 16. `@Builder` 按引用传递:形参用 `$$: InterfaceType` 接收,调用时传单参数对象字面量 `myBuilder({ key: this.val })`;多参数不刷新;@Builder 方法定义在 build() 之前;参数类型必须用显式声明的 interface/class,禁止内联对象字面量类型 → **10605040**
60
+ 17. **@Param 只读**——`this.x = ...` 在 @ComponentV2 内报 `Cannot assign to 'x' because it is a read-only property`;@Local 只能内部初始化,调用处传值不生效
61
+ 18. **@ObjectLink 禁止整体赋值**——`this.objLink = new Info()` ❌,只能改属性
62
+
63
+ ### 布局与渲染
64
+
65
+ 19. 部分容器组件内部只允许放对应的子组件,如`List与ListItem、Grid与GridItem`等
66
+ 20. `ForEach`/`LazyForEach`/`Repeat` **不是真实组件**,返回的 `ForEachAttribute` 等不支持 `.layoutWeight()`/`.width()` 等通用布局属性
67
+ 21. Repeat (V2)设置了virtualScroll懒加载情况下仅 `@ComponentV2` 内可用
68
+ 22. **Repeat 的 cachedCount 放滚动容器上**——`Repeat(arr).cachedCount(3)` ❌ → **10505001**;`List() { Repeat(arr) }.cachedCount(3)` ✅
69
+ 23. **LazyForEach 的 dataSource 不可重新赋值**,修改数据后必须通过 DataChangeListener 通知更新
70
+
71
+ ### API 参数(编译必挂高频)
72
+
73
+ 24. 传给组件构造/API 的对象字面量,字段名与 Options 类型逐字一致
74
+ 25. 回调参数类型用编译器声明的联合类型,不自行收窄(如 `onChange(index: number)` → 实际签名是 `onChange(index: number | string)`)
75
+ 26. **构造参数字段名不能凭记忆编造**——实测高发:`TimePicker({ useMilitaryTime: true })` ❌(useMilitaryTime 是 TimePickerDialog 的字段);`Tabs(this.tabsController)` ❌(构造参数是 `{ controller: ... }`);`MenuItem({ value: '复制', icon: $r(...) })` ❌(正确字段是 content + startIcon);`Shape({ viewPort: {...} })` ❌(viewPort 是链式方法);`PersistentStorage.persistProps([{ key: 'k', default: 'v' }])` ❌(正确字段是 defaultValue)
76
+
77
+ 详细规则文件索引见 `references/quick-rules/_index.md`。