@deveco-test/deveco-cli-common 1.3.10-Test.2 → 1.3.11-Test.4

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 (223) hide show
  1. package/README.md +674 -52
  2. package/THIRD-PARTY-LICENSES +33 -3
  3. package/dist/cli.js +215 -167
  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/telemetry-upload-background.js +3 -3
  116. package/package.json +10 -5
  117. package/skills/deveco-cli/SKILL.md +144 -32
  118. package/skills/hmos-arkui-develop-skill/SKILL.md +77 -0
  119. package/skills/hmos-arkui-develop-skill/references/quick-apis/01-layout.md +634 -0
  120. package/skills/hmos-arkui-develop-skill/references/quick-apis/02-basic-components.md +649 -0
  121. package/skills/hmos-arkui-develop-skill/references/quick-apis/03-data-display.md +81 -0
  122. package/skills/hmos-arkui-develop-skill/references/quick-apis/04-selectors.md +109 -0
  123. package/skills/hmos-arkui-develop-skill/references/quick-apis/05-media.md +90 -0
  124. package/skills/hmos-arkui-develop-skill/references/quick-apis/06-advanced.md +32 -0
  125. package/skills/hmos-arkui-develop-skill/references/quick-apis/07-security.md +30 -0
  126. package/skills/hmos-arkui-develop-skill/references/quick-apis/08-state-decorators.md +120 -0
  127. package/skills/hmos-arkui-develop-skill/references/quick-apis/09-animation.md +118 -0
  128. package/skills/hmos-arkui-develop-skill/references/quick-apis/10-gesture.md +89 -0
  129. package/skills/hmos-arkui-develop-skill/references/quick-apis/11-dialog-menu.md +152 -0
  130. package/skills/hmos-arkui-develop-skill/references/quick-apis/12-navigation.md +127 -0
  131. package/skills/hmos-arkui-develop-skill/references/quick-apis/13-rendering.md +52 -0
  132. package/skills/hmos-arkui-develop-skill/references/quick-apis/14-extension.md +22 -0
  133. package/skills/hmos-arkui-develop-skill/references/quick-apis/15-theme-style.md +10 -0
  134. package/skills/hmos-arkui-develop-skill/references/quick-apis/16-enums.md +128 -0
  135. package/skills/hmos-arkui-develop-skill/references/quick-apis/17-resources.md +401 -0
  136. package/skills/hmos-arkui-develop-skill/references/quick-apis/18-error-code.md +24 -0
  137. package/skills/hmos-arkui-develop-skill/references/quick-apis/_index.md +76 -0
  138. package/skills/hmos-arkui-develop-skill/references/quick-rules/00-arkts-syntax.md +229 -0
  139. package/skills/hmos-arkui-develop-skill/references/quick-rules/01-import.md +116 -0
  140. package/skills/hmos-arkui-develop-skill/references/quick-rules/02-uicontext.md +56 -0
  141. package/skills/hmos-arkui-develop-skill/references/quick-rules/03-component.md +105 -0
  142. package/skills/hmos-arkui-develop-skill/references/quick-rules/04-build.md +41 -0
  143. package/skills/hmos-arkui-develop-skill/references/quick-rules/05-state.md +300 -0
  144. package/skills/hmos-arkui-develop-skill/references/quick-rules/06-rendering.md +67 -0
  145. package/skills/hmos-arkui-develop-skill/references/quick-rules/07-attribute-params.md +219 -0
  146. package/skills/hmos-arkui-develop-skill/references/quick-rules/08-navigation.md +102 -0
  147. package/skills/hmos-arkui-develop-skill/references/quick-rules/09-dialog.md +72 -0
  148. package/skills/hmos-arkui-develop-skill/references/quick-rules/10-style.md +90 -0
  149. package/skills/hmos-arkui-develop-skill/references/quick-rules/11-extension.md +54 -0
  150. package/skills/hmos-arkui-develop-skill/references/quick-rules/12-layout.md +69 -0
  151. package/skills/hmos-arkui-develop-skill/references/quick-rules/13-performance.md +27 -0
  152. package/skills/hmos-arkui-develop-skill/references/quick-rules/14-deprecated.md +28 -0
  153. package/skills/hmos-arkui-develop-skill/references/quick-rules/_index.md +79 -0
  154. package/skills/hmos-arkui-develop-skill/references/style-guide.md +491 -0
  155. package/skills/hmos-arkui-develop-skill/test-cases/code_gen_cases.json +292 -0
  156. package/skills/hmos-dfx-analyzer/SKILL.md +683 -0
  157. package/skills/hmos-dfx-analyzer/changelog/CHANGELOG.md +17 -0
  158. package/skills/hmos-dfx-analyzer/evals/evals.json +119 -0
  159. package/skills/hmos-dfx-analyzer/references/appfreeze/analyzer.md +471 -0
  160. package/skills/hmos-dfx-analyzer/references/appfreeze/references/fault-mode-library.md +94 -0
  161. package/skills/hmos-dfx-analyzer/references/appfreeze/references/ffrt-freeze-analysis.md +132 -0
  162. package/skills/hmos-dfx-analyzer/references/appfreeze/references/libuv-freeze-analysis.md +116 -0
  163. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/__init__.py +40 -0
  164. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/binder.py +343 -0
  165. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/collector.py +84 -0
  166. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/common.py +132 -0
  167. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/faultlog.py +212 -0
  168. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/main.py +81 -0
  169. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/report.py +675 -0
  170. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/sections.py +377 -0
  171. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/stack.py +165 -0
  172. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/llvm_addr2line.py +123 -0
  173. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/match_so.py +120 -0
  174. package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/sample_stack_analyzer.py +209 -0
  175. package/skills/hmos-dfx-analyzer/references/cppcrash/analyzer.md +470 -0
  176. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkdata.md +325 -0
  177. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkui.md +266 -0
  178. package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkweb.md +144 -0
  179. package/skills/hmos-dfx-analyzer/references/cppcrash/references/fault_mode.md +178 -0
  180. package/skills/hmos-dfx-analyzer/references/cppcrash/references/gwp_asan.md +300 -0
  181. package/skills/hmos-dfx-analyzer/references/cppcrash/references/jsruntime.md +339 -0
  182. package/skills/hmos-dfx-analyzer/references/cppcrash/references/jsvm.md +203 -0
  183. package/skills/hmos-dfx-analyzer/references/cppcrash/references/libuv.md +166 -0
  184. package/skills/hmos-dfx-analyzer/references/cppcrash/references/memory_corruption.md +348 -0
  185. package/skills/hmos-dfx-analyzer/references/cppcrash/references/memory_corruption_second_scene.md +74 -0
  186. package/skills/hmos-dfx-analyzer/references/cppcrash/references/multithreading.md +284 -0
  187. package/skills/hmos-dfx-analyzer/references/cppcrash/references/render_service.md +300 -0
  188. package/skills/hmos-dfx-analyzer/references/cppcrash/references/rosen_text.md +41 -0
  189. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/__init__.py +36 -0
  190. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/collector.py +93 -0
  191. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/common.py +68 -0
  192. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/crash_log.py +275 -0
  193. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/extract_hilog.py +69 -0
  194. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/hints.py +251 -0
  195. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/main.py +82 -0
  196. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/match_so.py +120 -0
  197. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/ohos_llvm_tools.py +279 -0
  198. package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/report.py +226 -0
  199. package/skills/hmos-dfx-analyzer/references/jscrash/analyzer.md +174 -0
  200. package/skills/hmos-dfx-analyzer/references/jscrash/references/fault-mode-library.md +107 -0
  201. package/skills/hmos-dfx-analyzer/references/jscrash/references/jscrash-patterns.md +92 -0
  202. package/skills/hmos-dfx-analyzer/references/jscrash/references/sourcemap-symbolication.md +67 -0
  203. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/bin/hstack +25 -0
  204. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/bin/hstack.bat +26 -0
  205. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/index.js +2 -0
  206. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/index.js.LICENSE.txt +1 -0
  207. package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/mappings.wasm +0 -0
  208. package/skills/hmos-dfx-analyzer/references/white-screen/analyzer.md +129 -0
  209. package/skills/hmos-dfx-analyzer/scripts/collect/collect-hilog.mjs +120 -0
  210. package/skills/hmos-dfx-analyzer/scripts/collect/jscrash-report.mjs +138 -0
  211. package/skills/hmos-dfx-analyzer/scripts/collect/parse-jscrash-log.mjs +126 -0
  212. package/skills/hmos-dfx-analyzer/scripts/collect/shared/deveco-cli.mjs +79 -0
  213. package/skills/hmos-dfx-analyzer/scripts/collect/shared/jscrash-parse.mjs +389 -0
  214. package/skills/hmos-dfx-analyzer/scripts/collect/shared/utils.mjs +27 -0
  215. package/skills/hmos-dfx-analyzer/scripts/export_report.py +373 -0
  216. package/skills/hmos-dfx-analyzer/scripts/identify_fault_log.py +500 -0
  217. package/skills/hmos-dfx-analyzer/scripts/report_template.html +103 -0
  218. package/skills/hmos-dfx-analyzer/test-cases/functional.md +112 -0
  219. package/skills/hmos-dfx-analyzer/test-cases/smoke.md +86 -0
  220. package/skills/hmos-dfx-analyzer/test-cases/test-prompts.md +35 -0
  221. package/skills/hmos-dfx-analyzer/test-cases/trigger.md +121 -0
  222. package/skills/index.json +17 -0
  223. package/src/resources/arkts-check.cjs +163 -1
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright (c) 2026 Huawei Device Co., Ltd.
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ import { pixsoToArkTs, pixsoToRawNewRoot } from './pixso-arkts.mjs';
6
+ const chunks = [];
7
+ for await (const chunk of process.stdin) chunks.push(chunk);
8
+ try {
9
+ const request = JSON.parse(Buffer.concat(chunks).toString('utf8'));
10
+ const result =
11
+ request.operation === 'layout'
12
+ ? describeLayout(pixsoToRawNewRoot(request.input))
13
+ : {
14
+ ...pixsoToArkTs(request.input, { structName: request.pageName }),
15
+ raw: pixsoToRawNewRoot(request.input),
16
+ };
17
+ process.stdout.write(JSON.stringify(result));
18
+ } catch (error) {
19
+ process.stderr.write(String(error?.stack || error));
20
+ process.exitCode = 1;
21
+ }
22
+
23
+ function describeLayout(root) {
24
+ const pending = [...root.content];
25
+ const types = {};
26
+ const zeroSize = [];
27
+ let count = 0;
28
+ while (pending.length) {
29
+ const node = pending.pop();
30
+ if (++count > 50000) throw new Error('Layout exceeds 50000 nodes.');
31
+ types[node.type ?? 'unknown'] = (types[node.type ?? 'unknown'] ?? 0) + 1;
32
+ if (node.box?.width === 0 || node.box?.height === 0)
33
+ zeroSize.push(node.key);
34
+ if (Array.isArray(node.children)) pending.push(...node.children);
35
+ }
36
+ return {
37
+ status: 'bounds-only',
38
+ nodeCount: count,
39
+ types,
40
+ roots: root.content.map((node) => ({ id: node.key, box: node.box })),
41
+ zeroSizeNodes: zeroSize,
42
+ visualComparisonPerformed: false,
43
+ };
44
+ }
@@ -1,9 +1,9 @@
1
- import Vt from"path";import*as b from"fs";import*as Y from"path";import{homedir as St}from"os";import*as H from"fs";import*as g from"path";function W(n){let t=g.resolve(n),e=[],r=t;for(;;)try{let i=H.realpathSync(r);return e.length===0?i:g.join(i,...e.reverse())}catch(i){if(i.code!=="ENOENT")throw i;let o=g.dirname(r);if(o===r)return t;e.push(g.basename(r)),r=o}}function N(n){let t=n.trim();return(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),t}function K(n){let t=N(n);if(!t)throw new Error("Path must not be empty.");return W(t)}var Et="deveco-cli",J,$=class extends Error{constructor(t){super(t),this.name="CliDataDirError"}};function Tt(){let n=process.env.DEVECO_CLI_DATA_DIR,e=(n===void 0||n===""?"":N(n))||Y.join(St(),".local","share",Et);try{return K(e)}catch(r){throw new $(r instanceof Error?r.message:String(r))}}function X(){if(J!==void 0)return J;let n=Tt();try{if(b.existsSync(n))return b.realpathSync(n)}catch{}return n}import vt from"crypto";import u from"fs";import I from"os";import m from"path";import wt from"https";var G={devecoApiTraceUpload:"https://cn.devecostudio.huawei.com/codeGenie/cli/trace/upload"};var D=class n{static ENDPOINT=G.devecoApiTraceUpload;static SENDER="deveco-cli";async upload(t,e){let r={"Content-Type":"application/json",sender:n.SENDER,deviceid:e.replace(/-/g,""),"Content-Length":String(Buffer.byteLength(t,"utf8"))};try{let{body:i}=await this.httpPost(n.ENDPOINT,r,Buffer.from(t,"utf8"),6e4);return n.isSuccess(i)}catch{return!1}}static isSuccess(t){try{let e=JSON.parse(t),r=e?.code??e?.errorCode;return String(r)==="200"}catch{return!1}}async httpPost(t,e,r,i){let o=new URL(t);return new Promise((s,l)=>{let p=wt.request({protocol:o.protocol,hostname:o.hostname,port:o.port||(o.protocol==="https:"?443:80),path:o.pathname+o.search,method:"POST",headers:e,timeout:i},h=>{let w=[];h.on("data",bt=>w.push(bt)),h.on("end",()=>{s({code:h.statusCode??0,body:Buffer.concat(w).toString("utf8")})})});p.on("timeout",()=>{p.destroy(new Error("request timeout"))}),p.on("error",l),p.write(r),p.end()})}};var q={identity:n=>n,camelCase:n=>n,snakeCase:n=>n.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase()},M=class{constructor(t={}){this.config=t}serialize(t){let e=this.transform(t);return this.config.pretty?JSON.stringify(e,null,2):JSON.stringify(e)}toObject(t){return this.transform(t)}transform(t){if(t==null)return t;if(Array.isArray(t))return t.map(o=>this.transform(o));if(typeof t!="object")return t;let e=this.config.namingStrategy??q.identity,r=this.config.fieldNames??{},i={};for(let[o,s]of Object.entries(t)){let l=r[o]??e(o);i[l]=this.transform(s)}return i}},Z=new M({namingStrategy:q.snakeCase,fieldNames:{}});import S from"crypto";import C from"fs";import Dt from"path";var _="aes-256-gcm",Ct=12,_t="deveco-cli-trace-file",Lt="trace-file-secret",tt=32;function Q(n){try{let t=C.readFileSync(n,"utf8").trim();return t&&Buffer.from(t,"base64").length===tt?t:null}catch{return null}}function et(n){let t=Dt.join(n,Lt),e=Q(t);if(e)return B(e);let r=S.randomBytes(tt).toString("base64");try{C.mkdirSync(n,{recursive:!0});try{C.writeFileSync(t,r,{flag:"wx"})}catch{let i=Q(t);if(i)return B(i);C.writeFileSync(t,r)}}catch{}return B(r)}function B(n){return S.createHash("sha256").update(_t).update(n).digest()}function rt(n,t){let e=S.randomBytes(Ct),r=S.createCipheriv(_,t,e),i=Buffer.concat([r.update(n,"utf8"),r.final()]),o={version:1,algorithm:_,ciphertext:i.toString("base64"),iv:e.toString("base64"),authTag:r.getAuthTag().toString("base64")};return JSON.stringify(o)}function nt(n,t){let e;try{e=JSON.parse(n)}catch{return null}if(!Ft(e))return n;try{let r=S.createDecipheriv(_,t,Buffer.from(e.iv,"base64"));return r.setAuthTag(Buffer.from(e.authTag,"base64")),Buffer.concat([r.update(Buffer.from(e.ciphertext,"base64")),r.final()]).toString("utf8")}catch{return null}}function Ft(n){if(!n||typeof n!="object")return!1;let t=n;return t.version===1&&t.algorithm===_&&typeof t.ciphertext=="string"&&typeof t.iv=="string"&&typeof t.authTag=="string"}import*as a from"fs";import*as A from"path";import*as L from"os";import*as y from"path";import ge from"json5";var ve=64*1024;function it(){if(process.platform==="win32"){let n=process.env.LOCALAPPDATA??y.join(L.homedir(),"AppData","Local");return y.join(n,"devecocli-mcp-server","logs")}return process.platform==="darwin"?y.join(L.homedir(),"Library","Logs","devecocli-mcp-server"):y.join(L.homedir(),".local","share","devecocli-mcp-server","logs")}var ot="mcp-server.log",At="mcp-server",kt={maxSize:10*1024*1024,maxFiles:4},j=class n{fd=null;logDir=null;currentLogFile=null;mode;rotationOptions;currentFileSize=0;currentDate="";isRotating=!1;minLevel;static LEVEL_ORDER={debug:0,info:1,warn:2,error:3};constructor(t,e){this.rotationOptions={...kt,...e},this.minLevel=t?"debug":"info",t?(this.mode="console",this.logDir=null,this.currentLogFile=null):(this.mode="file",this.logDir=it(),this.currentLogFile=A.join(this.logDir,ot),a.existsSync(this.logDir)||a.mkdirSync(this.logDir,{recursive:!0}),this.cleanupOrphanLogFiles(),this.openLogFile())}getCurrentDateString(){let t=new Date,e=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${e}-${r}-${i}`}getRotatedFileName(t,e){return A.join(this.logDir,`${At}-${t}.log.${e}`)}fileExists(t){try{return a.accessSync(t,a.constants.F_OK),!0}catch{return!1}}cleanupOrphanLogFiles(){if(this.logDir)try{let t=a.readdirSync(this.logDir),e=[];for(let i of t)if(i===ot||/^mcp-server-\d{4}-\d{2}-\d{2}\.log\.\d+$/.test(i)){let o=A.join(this.logDir,i),s=a.statSync(o);e.push({name:i,mtime:s.mtime,path:o})}e.sort((i,o)=>o.mtime.getTime()-i.mtime.getTime());let r=1+this.rotationOptions.maxFiles;for(let i=r;i<e.length;i++)try{a.unlinkSync(e[i].path)}catch{}}catch{}}rotateLog(){if(!(this.isRotating||!this.logDir||!this.currentLogFile)){this.isRotating=!0;try{if(this.closeLogFile(),!this.fileExists(this.currentLogFile)){this.isRotating=!1,this.openLogFile();return}let t=this.getCurrentDateString(),e=this.getRotatedFileName(t,this.rotationOptions.maxFiles);this.fileExists(e)&&a.unlinkSync(e);for(let i=this.rotationOptions.maxFiles-1;i>=1;i--){let o=this.getRotatedFileName(t,i),s=this.getRotatedFileName(t,i+1);this.fileExists(o)&&a.renameSync(o,s)}let r=this.getRotatedFileName(t,1);a.renameSync(this.currentLogFile,r),this.cleanupOrphanLogFiles(),this.openLogFile()}catch{this.openLogFile()}finally{this.isRotating=!1}}}openLogFile(){if(this.currentLogFile){this.currentDate=this.getCurrentDateString();try{if(this.fileExists(this.currentLogFile)){let t=a.statSync(this.currentLogFile);this.currentFileSize=t.size}else this.currentFileSize=0}catch{this.currentFileSize=0}try{this.fd=a.openSync(this.currentLogFile,"a")}catch{this.fd=null}}}closeLogFile(){if(this.fd!==null){try{a.closeSync(this.fd)}catch{}this.fd=null}}checkRotation(t){let e=this.getCurrentDateString();this.currentDate&&this.currentDate!==e&&(this.rotateLog(),this.currentDate=e),this.currentFileSize+=t,this.currentFileSize>=this.rotationOptions.maxSize&&this.rotateLog()}write(t,e,...r){if(this.mode==="silent"||n.LEVEL_ORDER[t]<n.LEVEL_ORDER[this.minLevel])return;let i=r.map(p=>p instanceof Error?`${p.name}: ${p.message}`:typeof p=="object"?JSON.stringify(p,null,2):String(p)).join(" "),o=i?`${e} ${i}`:e,l=`[${new Date().toLocaleString("sv-SE",{timeZone:"Asia/Shanghai",hour12:!1})+"."+String(new Date().getMilliseconds()).padStart(3,"0")}] [MCP/${t.toUpperCase()}] [pid=${process.pid}] ${o}
2
- `;if(this.mode==="file"&&this.currentLogFile){if(this.fd===null&&this.openLogFile(),this.fd!==null)try{let p=Buffer.from(l);a.writeSync(this.fd,p),this.checkRotation(p.byteLength)}catch{this.closeLogFile(),this.openLogFile()}}else this.mode==="console"&&process.stderr.write(l)}debug(t,...e){this.write("debug",t,...e)}info(t,...e){this.write("info",t,...e)}warn(t,...e){this.write("warn",t,...e)}error(t,...e){this.write("error",t,...e)}dispose(){this.closeLogFile()}flush(){if(!(this.mode!=="file"||this.fd===null))try{a.fsyncSync(this.fd)}catch{}}getLogFilePath(){return this.currentLogFile}getLogDirectory(){return this.logDir}},E=null;function Ot(n=!1){E&&E.dispose(),E=new j(n)}function F(){return E||Ot(!1),E}var c={debug:(n,...t)=>F().debug(n,...t),info:(n,...t)=>F().info(n,...t),warn:(n,...t)=>F().warn(n,...t),error:(n,...t)=>F().error(n,...t)};import at from"fs";import Pt from"path";var k=300*1e3,O=3600*1e3,lt=10080*60*1e3,v=8*1024*1024,ct=3600*1e3,st=".pending",Rt=/\.reclaim-\d+-\d+$/;function P(){let n=process.env.DEVECO_CLI_DISABLE_TELEMETRY;return n==="1"||n==="true"}var It="upload-state.json";function ut(n){return Pt.join(n,It)}function Nt(){return{firstEventAt:null,lastUploadAt:null,lastRetryAt:null}}function U(n){try{let t=at.readFileSync(ut(n),"utf8"),e=JSON.parse(t);return{firstEventAt:typeof e.firstEventAt=="number"?e.firstEventAt:null,lastUploadAt:typeof e.lastUploadAt=="number"?e.lastUploadAt:null,lastRetryAt:typeof e.lastRetryAt=="number"?e.lastRetryAt:null}}catch{return Nt()}}function V(n,t){try{at.writeFileSync(ut(n),JSON.stringify(t),"utf8")}catch{}}function pt(n){let t=U(n);t.firstEventAt===null&&(t.firstEventAt=Date.now(),V(n,t))}function ft(n){let t=U(n);t.lastUploadAt=Date.now(),t.firstEventAt=null,V(n,t)}function dt(n){let t=U(n);t.lastRetryAt=Date.now(),V(n,t)}function mt(n){let t=n.match(/^telemetry-(\d{4})-(\d{2})-(\d{2})\.txt$/);if(!t)return null;let e=Date.parse(`${t[1]}-${t[2]}-${t[3]}T00:00:00`);return Number.isFinite(e)?e:null}function z(n){if(!n.startsWith("telemetry-"))return null;let t=Rt.exec(n),e=t?n.slice(0,t.index):n;if(!e.endsWith(st))return null;let r=e.slice(0,-st.length);return r.endsWith(".txt")?r:null}function gt(n){return z(n)!==null}import $t from"crypto";import R from"fs";import Mt from"path";var Bt="install-id";function jt(n){return Mt.join(n,Bt)}function ht(n){try{let t=R.readFileSync(n,"utf8").trim();return Ut(t)?t:null}catch{return null}}function Ut(n){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n)}function yt(n){let t=jt(n),e=ht(t);if(e)return e;let r=$t.randomUUID();try{R.mkdirSync(n,{recursive:!0});try{R.writeFileSync(t,r,{flag:"wx"})}catch{let i=ht(t);if(i)return i;R.writeFileSync(t,r)}}catch{}return r}var T=class n{static MAX_BATCH=200;static MAX_PAYLOAD_BYTES=Math.floor(1.7*1024*1024);static TRACE_OS_VERSION="1.0";static COUNTRY_CODE="CN";static EVENT_PREFIX="devecocli_";uploader=new D;storageDir="";failedDir="";installId="";disabled=P();traceFileKey=Buffer.alloc(0);sessionId=vt.randomUUID();cliVersion="";devecoStudioVersion=null;sourceType="";cltVersion=null;nodeVersion="";initialTimer=null;intervalTimer=null;retryInitialTimer=null;retryTimer=null;flushChain=Promise.resolve();constructor(){c.debug(`[telemetry] instance created, sessionId=${this.sessionId}`)}init(t){this.storageDir=t,this.failedDir=m.join(t,"failed"),this.cliVersion="1.3.10-Test.2",this.nodeVersion=process.version,this.installId=yt(t).replace(/-/g,""),this.traceFileKey=et(t),u.mkdirSync(t,{recursive:!0}),u.mkdirSync(this.failedDir,{recursive:!0}),c.debug(`[telemetry] init: dir=${t}, failedDir=${this.failedDir}, cliVersion=${this.cliVersion}, os=${this.resolveOsName()}, arch=${this.resolveOsArch()}, node=${this.nodeVersion}`)}setStudioVersion(t){this.devecoStudioVersion=t,c.debug(`[telemetry] studio version set: ${t}`)}setSourceType(t){this.sourceType=t,c.debug(`[telemetry] sourceType set: ${t}`)}setCltVersion(t){this.cltVersion=t,c.debug(`[telemetry] CLT version set: ${t}`)}async track(t,e){if(this.disabled)return typeof e=="function"?e():void 0;if(!this.storageDir)throw new Error("Telemetry not initialized. Call init() first.");if(!e){await this.record(t,0,!0,null);return}if(typeof e!="function"){let o=e;await this.record(t,o.duration_ms,o.success,o.error_code);return}let r=e,i=Date.now();try{let o=await r(),s=Date.now()-i;return await this.record(t,s,!0,null),o}catch(o){let s=Date.now()-i,l=this.toErrorCode(o);throw await this.record(t,s,!1,l),o}}async record(t,e,r,i){let o=this.buildTraceEvent(t,e,r,i);try{let s=rt(JSON.stringify(o),this.traceFileKey);await u.promises.appendFile(this.currentFile(),s+`
1
+ import Vt from"path";import*as b from"fs";import*as Y from"path";import{homedir as St}from"os";import*as H from"fs";import*as g from"path";function W(n){let t=g.resolve(n),e=[],r=t;for(;;)try{let i=H.realpathSync(r);return e.length===0?i:g.join(i,...e.reverse())}catch(i){if(i.code!=="ENOENT")throw i;let o=g.dirname(r);if(o===r)return t;e.push(g.basename(r)),r=o}}function N(n){let t=n.trim();return(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),t}function K(n){let t=N(n);if(!t)throw new Error("Path must not be empty.");return W(t)}var Tt="deveco-cli",J,$=class extends Error{constructor(t){super(t),this.name="CliDataDirError"}};function Et(){let n=process.env.DEVECO_CLI_DATA_DIR,e=(n===void 0||n===""?"":N(n))||Y.join(St(),".local","share",Tt);try{return K(e)}catch(r){throw new $(r instanceof Error?r.message:String(r))}}function X(){if(J!==void 0)return J;let n=Et();try{if(b.existsSync(n))return b.realpathSync(n)}catch{}return n}import vt from"crypto";import u from"fs";import I from"os";import m from"path";import wt from"https";var G={devecoApiTraceUpload:"https://cn.devecostudio.huawei.com/codeGenie/cli/trace/upload"};var D=class n{static ENDPOINT=G.devecoApiTraceUpload;static SENDER="deveco-cli";async upload(t,e){let r={"Content-Type":"application/json",sender:n.SENDER,deviceid:e.replace(/-/g,""),"Content-Length":String(Buffer.byteLength(t,"utf8"))};try{let{body:i}=await this.httpPost(n.ENDPOINT,r,Buffer.from(t,"utf8"),6e4);return n.isSuccess(i)}catch{return!1}}static isSuccess(t){try{let e=JSON.parse(t),r=e?.code??e?.errorCode;return String(r)==="200"}catch{return!1}}async httpPost(t,e,r,i){let o=new URL(t);return new Promise((s,l)=>{let p=wt.request({protocol:o.protocol,hostname:o.hostname,port:o.port||(o.protocol==="https:"?443:80),path:o.pathname+o.search,method:"POST",headers:e,timeout:i},h=>{let w=[];h.on("data",bt=>w.push(bt)),h.on("end",()=>{s({code:h.statusCode??0,body:Buffer.concat(w).toString("utf8")})})});p.on("timeout",()=>{p.destroy(new Error("request timeout"))}),p.on("error",l),p.write(r),p.end()})}};var q={identity:n=>n,camelCase:n=>n,snakeCase:n=>n.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase()},M=class{constructor(t={}){this.config=t}serialize(t){let e=this.transform(t);return this.config.pretty?JSON.stringify(e,null,2):JSON.stringify(e)}toObject(t){return this.transform(t)}transform(t){if(t==null)return t;if(Array.isArray(t))return t.map(o=>this.transform(o));if(typeof t!="object")return t;let e=this.config.namingStrategy??q.identity,r=this.config.fieldNames??{},i={};for(let[o,s]of Object.entries(t)){let l=r[o]??e(o);i[l]=this.transform(s)}return i}},Z=new M({namingStrategy:q.snakeCase,fieldNames:{}});import S from"crypto";import C from"fs";import Dt from"path";var _="aes-256-gcm",Ct=12,_t="deveco-cli-trace-file",Lt="trace-file-secret",tt=32;function Q(n){try{let t=C.readFileSync(n,"utf8").trim();return t&&Buffer.from(t,"base64").length===tt?t:null}catch{return null}}function et(n){let t=Dt.join(n,Lt),e=Q(t);if(e)return B(e);let r=S.randomBytes(tt).toString("base64");try{C.mkdirSync(n,{recursive:!0});try{C.writeFileSync(t,r,{flag:"wx"})}catch{let i=Q(t);if(i)return B(i);C.writeFileSync(t,r)}}catch{}return B(r)}function B(n){return S.createHash("sha256").update(_t).update(n).digest()}function rt(n,t){let e=S.randomBytes(Ct),r=S.createCipheriv(_,t,e),i=Buffer.concat([r.update(n,"utf8"),r.final()]),o={version:1,algorithm:_,ciphertext:i.toString("base64"),iv:e.toString("base64"),authTag:r.getAuthTag().toString("base64")};return JSON.stringify(o)}function nt(n,t){let e;try{e=JSON.parse(n)}catch{return null}if(!Ft(e))return n;try{let r=S.createDecipheriv(_,t,Buffer.from(e.iv,"base64"));return r.setAuthTag(Buffer.from(e.authTag,"base64")),Buffer.concat([r.update(Buffer.from(e.ciphertext,"base64")),r.final()]).toString("utf8")}catch{return null}}function Ft(n){if(!n||typeof n!="object")return!1;let t=n;return t.version===1&&t.algorithm===_&&typeof t.ciphertext=="string"&&typeof t.iv=="string"&&typeof t.authTag=="string"}import*as a from"fs";import*as A from"path";import*as L from"os";import*as y from"path";import ge from"json5";var ve=64*1024;function it(){if(process.platform==="win32"){let n=process.env.LOCALAPPDATA??y.join(L.homedir(),"AppData","Local");return y.join(n,"devecocli-mcp-server","logs")}return process.platform==="darwin"?y.join(L.homedir(),"Library","Logs","devecocli-mcp-server"):y.join(L.homedir(),".local","share","devecocli-mcp-server","logs")}var ot="mcp-server.log",At="mcp-server",kt={maxSize:10*1024*1024,maxFiles:4},j=class n{fd=null;logDir=null;currentLogFile=null;mode;rotationOptions;currentFileSize=0;currentDate="";isRotating=!1;minLevel;static LEVEL_ORDER={debug:0,info:1,warn:2,error:3};constructor(t,e){this.rotationOptions={...kt,...e},this.minLevel=t?"debug":"info",t?(this.mode="console",this.logDir=null,this.currentLogFile=null):(this.mode="file",this.logDir=it(),this.currentLogFile=A.join(this.logDir,ot),a.existsSync(this.logDir)||a.mkdirSync(this.logDir,{recursive:!0}),this.cleanupOrphanLogFiles(),this.openLogFile())}getCurrentDateString(){let t=new Date,e=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${e}-${r}-${i}`}getRotatedFileName(t,e){return A.join(this.logDir,`${At}-${t}.log.${e}`)}fileExists(t){try{return a.accessSync(t,a.constants.F_OK),!0}catch{return!1}}cleanupOrphanLogFiles(){if(this.logDir)try{let t=a.readdirSync(this.logDir),e=[];for(let i of t)if(i===ot||/^mcp-server-\d{4}-\d{2}-\d{2}\.log\.\d+$/.test(i)){let o=A.join(this.logDir,i),s=a.statSync(o);e.push({name:i,mtime:s.mtime,path:o})}e.sort((i,o)=>o.mtime.getTime()-i.mtime.getTime());let r=1+this.rotationOptions.maxFiles;for(let i=r;i<e.length;i++)try{a.unlinkSync(e[i].path)}catch{}}catch{}}rotateLog(){if(!(this.isRotating||!this.logDir||!this.currentLogFile)){this.isRotating=!0;try{if(this.closeLogFile(),!this.fileExists(this.currentLogFile)){this.isRotating=!1,this.openLogFile();return}let t=this.getCurrentDateString(),e=this.getRotatedFileName(t,this.rotationOptions.maxFiles);this.fileExists(e)&&a.unlinkSync(e);for(let i=this.rotationOptions.maxFiles-1;i>=1;i--){let o=this.getRotatedFileName(t,i),s=this.getRotatedFileName(t,i+1);this.fileExists(o)&&a.renameSync(o,s)}let r=this.getRotatedFileName(t,1);a.renameSync(this.currentLogFile,r),this.cleanupOrphanLogFiles(),this.openLogFile()}catch{this.openLogFile()}finally{this.isRotating=!1}}}openLogFile(){if(this.currentLogFile){this.currentDate=this.getCurrentDateString();try{if(this.fileExists(this.currentLogFile)){let t=a.statSync(this.currentLogFile);this.currentFileSize=t.size}else this.currentFileSize=0}catch{this.currentFileSize=0}try{this.fd=a.openSync(this.currentLogFile,"a")}catch{this.fd=null}}}closeLogFile(){if(this.fd!==null){try{a.closeSync(this.fd)}catch{}this.fd=null}}checkRotation(t){let e=this.getCurrentDateString();this.currentDate&&this.currentDate!==e&&(this.rotateLog(),this.currentDate=e),this.currentFileSize+=t,this.currentFileSize>=this.rotationOptions.maxSize&&this.rotateLog()}write(t,e,...r){if(this.mode==="silent"||n.LEVEL_ORDER[t]<n.LEVEL_ORDER[this.minLevel])return;let i=r.map(p=>p instanceof Error?`${p.name}: ${p.message}`:typeof p=="object"?JSON.stringify(p,null,2):String(p)).join(" "),o=i?`${e} ${i}`:e,l=`[${new Date().toLocaleString("sv-SE",{timeZone:"Asia/Shanghai",hour12:!1})+"."+String(new Date().getMilliseconds()).padStart(3,"0")}] [MCP/${t.toUpperCase()}] [pid=${process.pid}] ${o}
2
+ `;if(this.mode==="file"&&this.currentLogFile){if(this.fd===null&&this.openLogFile(),this.fd!==null)try{let p=Buffer.from(l);a.writeSync(this.fd,p),this.checkRotation(p.byteLength)}catch{this.closeLogFile(),this.openLogFile()}}else this.mode==="console"&&process.stderr.write(l)}debug(t,...e){this.write("debug",t,...e)}info(t,...e){this.write("info",t,...e)}warn(t,...e){this.write("warn",t,...e)}error(t,...e){this.write("error",t,...e)}dispose(){this.closeLogFile()}flush(){if(!(this.mode!=="file"||this.fd===null))try{a.fsyncSync(this.fd)}catch{}}getLogFilePath(){return this.currentLogFile}getLogDirectory(){return this.logDir}},T=null;function Ot(n=!1){T&&T.dispose(),T=new j(n)}function F(){return T||Ot(!1),T}var c={debug:(n,...t)=>F().debug(n,...t),info:(n,...t)=>F().info(n,...t),warn:(n,...t)=>F().warn(n,...t),error:(n,...t)=>F().error(n,...t)};import at from"fs";import Pt from"path";var k=300*1e3,O=3600*1e3,lt=10080*60*1e3,v=8*1024*1024,ct=3600*1e3,st=".pending",Rt=/\.reclaim-\d+-\d+$/;function P(){let n=process.env.DEVECO_CLI_DISABLE_TELEMETRY;return n==="1"||n==="true"}var It="upload-state.json";function ut(n){return Pt.join(n,It)}function Nt(){return{firstEventAt:null,lastUploadAt:null,lastRetryAt:null}}function U(n){try{let t=at.readFileSync(ut(n),"utf8"),e=JSON.parse(t);return{firstEventAt:typeof e.firstEventAt=="number"?e.firstEventAt:null,lastUploadAt:typeof e.lastUploadAt=="number"?e.lastUploadAt:null,lastRetryAt:typeof e.lastRetryAt=="number"?e.lastRetryAt:null}}catch{return Nt()}}function V(n,t){try{at.writeFileSync(ut(n),JSON.stringify(t),"utf8")}catch{}}function pt(n){let t=U(n);t.firstEventAt===null&&(t.firstEventAt=Date.now(),V(n,t))}function ft(n){let t=U(n);t.lastUploadAt=Date.now(),t.firstEventAt=null,V(n,t)}function dt(n){let t=U(n);t.lastRetryAt=Date.now(),V(n,t)}function mt(n){let t=n.match(/^telemetry-(\d{4})-(\d{2})-(\d{2})\.txt$/);if(!t)return null;let e=Date.parse(`${t[1]}-${t[2]}-${t[3]}T00:00:00`);return Number.isFinite(e)?e:null}function z(n){if(!n.startsWith("telemetry-"))return null;let t=Rt.exec(n),e=t?n.slice(0,t.index):n;if(!e.endsWith(st))return null;let r=e.slice(0,-st.length);return r.endsWith(".txt")?r:null}function gt(n){return z(n)!==null}import $t from"crypto";import R from"fs";import Mt from"path";var Bt="install-id";function jt(n){return Mt.join(n,Bt)}function ht(n){try{let t=R.readFileSync(n,"utf8").trim();return Ut(t)?t:null}catch{return null}}function Ut(n){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(n)}function yt(n){let t=jt(n),e=ht(t);if(e)return e;let r=$t.randomUUID();try{R.mkdirSync(n,{recursive:!0});try{R.writeFileSync(t,r,{flag:"wx"})}catch{let i=ht(t);if(i)return i;R.writeFileSync(t,r)}}catch{}return r}var E=class n{static MAX_BATCH=200;static MAX_PAYLOAD_BYTES=Math.floor(1.7*1024*1024);static TRACE_OS_VERSION="1.0";static COUNTRY_CODE="CN";static EVENT_PREFIX="devecocli_";uploader=new D;storageDir="";failedDir="";installId="";disabled=P();traceFileKey=Buffer.alloc(0);sessionId=vt.randomUUID();cliVersion="";devecoStudioVersion=null;sourceType="";cltVersion=null;nodeVersion="";initialTimer=null;intervalTimer=null;retryInitialTimer=null;retryTimer=null;flushChain=Promise.resolve();constructor(){c.debug(`[telemetry] instance created, sessionId=${this.sessionId}`)}init(t){this.storageDir=t,this.failedDir=m.join(t,"failed"),this.cliVersion="1.3.11-Test.4",this.nodeVersion=process.version,this.installId=yt(t).replace(/-/g,""),this.traceFileKey=et(t),u.mkdirSync(t,{recursive:!0}),u.mkdirSync(this.failedDir,{recursive:!0}),c.debug(`[telemetry] init: dir=${t}, failedDir=${this.failedDir}, cliVersion=${this.cliVersion}, os=${this.resolveOsName()}, arch=${this.resolveOsArch()}, node=${this.nodeVersion}`)}setStudioVersion(t){this.devecoStudioVersion=t,c.debug(`[telemetry] studio version set: ${t}`)}setSourceType(t){this.sourceType=t,c.debug(`[telemetry] sourceType set: ${t}`)}setCltVersion(t){this.cltVersion=t,c.debug(`[telemetry] CLT version set: ${t}`)}async track(t,e){if(this.disabled)return typeof e=="function"?e():void 0;if(!this.storageDir)throw new Error("Telemetry not initialized. Call init() first.");if(!e){await this.record(t,0,!0,null);return}if(typeof e!="function"){let o=e;await this.record(t,o.duration_ms,o.success,o.error_code);return}let r=e,i=Date.now();try{let o=await r(),s=Date.now()-i;return await this.record(t,s,!0,null),o}catch(o){let s=Date.now()-i,l=this.toErrorCode(o);throw await this.record(t,s,!1,l),o}}async record(t,e,r,i){let o=this.buildTraceEvent(t,e,r,i);try{let s=rt(JSON.stringify(o),this.traceFileKey);await u.promises.appendFile(this.currentFile(),s+`
3
3
  `,"utf8"),pt(this.storageDir)}catch{}}buildTraceEvent(t,e,r,i){let o=`${n.EVENT_PREFIX}${t.event}`,s=Z.toObject(t);return s&&typeof s=="object"&&delete s.event,{countryCode:n.COUNTRY_CODE,event:o,eventtime:String(Date.now()),properties:{uid:this.installId,trace_uuid:vt.randomUUID(),trace_os_version:n.TRACE_OS_VERSION,os_arch:this.resolveOsArch(),action:o,trace_os_name:this.resolveOsName(),version:`${this.cliVersion}_${this.resolveOsSuffix()}`,deveco_studio_version:this.formatVersion(this.devecoStudioVersion),command_line_version:this.formatVersion(this.cltVersion),source_type:this.sourceType,session_id:this.sessionId,node_version:this.nodeVersion,ram:this.resolveTotalRam(),duration_ms:e,success:r,error_code:i,event_detail:s}}}toErrorCode(t){return t instanceof Error?t.code??t.name:"UnknownError"}resolveOsArch(){let t=I.arch();return t==="x64"?"amd64":t}resolveOsName(){switch(process.platform){case"win32":{let t=I.release().split(".");return(parseInt(t[t.length-1],10)||0)>=22e3?"Windows 11":"Windows 10"}case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}resolveOsSuffix(){switch(process.platform){case"win32":return"windows";case"darwin":return I.arch()==="arm64"?"mac_arm":"mac";default:return"linux"}}resolveTotalRam(){return`${Math.round(I.totalmem()/1024)}KB`}formatVersion(t){return t?`${t}_${this.resolveOsSuffix()}`:""}dateString(){let t=new Date,e=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${r}`}currentFile(){return m.join(this.storageDir,`telemetry-${this.dateString()}.txt`)}startScheduler(){if(this.stopScheduler(),this.disabled){c.debug("[telemetry] scheduler not started (telemetry disabled)");return}c.debug(`[telemetry] scheduler started (flush every ${k/1e3}s, retry failed every ${O/1e3}s)`),this.initialTimer=setTimeout(()=>{this.flush().catch(()=>{}),this.intervalTimer=setInterval(()=>{this.flush().catch(()=>{})},k)},k),this.retryInitialTimer=setTimeout(()=>{this.retryFailed().catch(()=>{}),this.retryTimer=setInterval(()=>{this.retryFailed().catch(()=>{})},O)},O)}stopScheduler(){this.initialTimer&&(clearTimeout(this.initialTimer),this.initialTimer=null),this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null),this.retryInitialTimer&&(clearTimeout(this.retryInitialTimer),this.retryInitialTimer=null),this.retryTimer&&(clearInterval(this.retryTimer),this.retryTimer=null),c.debug("[telemetry] scheduler stopped")}async flush(){return this.disabled?!0:this.runExclusive(()=>this.performFlush())}async performFlush(){if(!this.storageDir)throw new Error("Telemetry not initialized. Call init() first.");let t=await this.listPendingFiles(),e=!0;for(let r of t)await this.flushFile(r)||(e=!1);return ft(this.storageDir),e}async retryFailed(){return this.disabled?!0:this.runExclusive(()=>this.performRetryFailed())}async performRetryFailed(){if(!this.storageDir)throw new Error("Telemetry not initialized. Call init() first.");await this.reclaimStalePending();let t=Date.now(),e;try{e=await u.promises.readdir(this.failedDir)}catch{return!0}let r=e.filter(o=>o.startsWith("telemetry-")&&o.endsWith(".txt")).map(o=>m.join(this.failedDir,o)),i=!0;for(let o of r){let s=m.basename(o),l=mt(s);if(l!==null){if(t-l>lt){try{await u.promises.unlink(o)}catch{}continue}await this.flushFile(o)||(i=!1)}}return i||c.warn("[telemetry] retry failed"),dt(this.storageDir),i}async reclaimStalePending(){let t=Date.now();for(let e of[this.storageDir,this.failedDir]){let r;try{r=await u.promises.readdir(e)}catch{continue}for(let i of r)gt(i)&&await this.reclaimOrphan(m.join(e,i),t)}}async reclaimOrphan(t,e){let r;try{let h=await u.promises.stat(t);if(e-h.mtimeMs<ct)return;r=h.size}catch{return}let i=m.dirname(t),o=z(m.basename(t));if(o===null)return;let s=await this.claimOrphan(t,i,o);if(s===null)return;let l=m.join(i,o),p=v-await this.fileSize(l);if(r>p){try{await u.promises.unlink(s)}catch{}c.warn(`[telemetry] dropped stale orphan pending: ${s} (${r} bytes > budget ${p})`);return}if(await this.mergeOrphanInto(s,l)){c.warn(`[telemetry] reclaimed orphan pending: ${s} (${r} bytes)`);return}c.warn(`[telemetry] merge failed, kept orphan pending for retry: ${s} (${r} bytes)`)}async claimOrphan(t,e,r){let i=m.join(e,`${r}.pending.reclaim-${process.pid}-${Date.now()}`);try{await u.promises.rename(t,i)}catch{return null}return await this.touch(i),i}async mergeOrphanInto(t,e){try{await u.promises.appendFile(e,await u.promises.readFile(t))}catch(r){return c.warn(`[telemetry] merge orphan pending failed: ${t} -> ${e}: ${r instanceof Error?r.message:String(r)}`),!1}try{await u.promises.unlink(t)}catch(r){c.warn(`[telemetry] merged but failed to remove orphan pending: ${t}: ${r instanceof Error?r.message:String(r)}`)}return!0}async fileSize(t){try{return(await u.promises.stat(t)).size}catch{return 0}}async touch(t){let e=new Date;try{await u.promises.utimes(t,e,e)}catch{}}runExclusive(t){let e=()=>t(),r=this.flushChain.then(e,e);return this.flushChain=r.then(()=>{},()=>{}),r}async listPendingFiles(){let t;try{t=await u.promises.readdir(this.storageDir)}catch{return[]}return t.filter(e=>e.startsWith("telemetry-")&&e.endsWith(".txt")).map(e=>m.join(this.storageDir,e)).sort()}async flushFile(t){let e=await this.fileSize(t);if(e>v){c.warn(`[telemetry] ${m.basename(t)} is ${e} bytes (> ${v}), dropped without uploading`);try{await u.promises.unlink(t)}catch{}return!0}let r=t+".pending";try{await u.promises.rename(t,r)}catch{return!1}await this.touch(r);let i;try{i=await u.promises.readFile(r,"utf8")}catch{return!1}let o=i.split(`
4
4
  `).map(s=>s.trim()).filter(Boolean);if(o.length===0){try{await u.promises.unlink(r)}catch{}return!0}return this.uploadInBatches(r,o)}collectDecryptBatch(t,e){let r=[],i=16,o=e;for(;o<t.length&&r.length<n.MAX_BATCH;){let s=nt(t[o],this.traceFileKey);if(s===null){o++;continue}let l=Buffer.byteLength(s,"utf8")+1;if(r.length>0&&i+l>n.MAX_PAYLOAD_BYTES)break;r.push(s),i+=l,o++}return{batch:r,next:o}}async uploadInBatches(t,e){let r=0;for(;r<e.length;){let i=r,{batch:o,next:s}=this.collectDecryptBatch(e,r);r=s;let l=this.buildPayloadItems(o);if(l.length===0)continue;let p=JSON.stringify(l),h=!1;try{h=await this.uploader.upload(p,this.installId)}catch{}if(!h){c.warn("[telemetry] upload failed");let w=e.slice(i).join(`
5
5
  `)+`
6
6
  `;return await this.moveToFailed(t,w),!1}}try{await u.promises.unlink(t)}catch{}return!0}buildPayloadItems(t){let e=[];for(let r of t)try{let i=JSON.parse(r);e.push({action:i.event,detail:JSON.stringify(i.properties),timestamp:Number(i.eventtime)||Date.now()})}catch{}return e}async moveToFailed(t,e){let r=m.basename(t,".pending"),i=m.join(this.failedDir,r),o=e.split(`
7
7
  `).filter(Boolean),s=v-await this.fileSize(i),l=this.takeNewestWithinBudget(o,s);l.length<o.length&&c.warn(`[telemetry] failed file capped at ${v} bytes, dropped ${o.length-l.length} older events`);try{l.length>0&&await u.promises.appendFile(i,l.join(`
8
8
  `)+`
9
- `,"utf8")}catch{return}try{await u.promises.unlink(t)}catch{}}takeNewestWithinBudget(t,e){if(e<=0)return[];let r=[],i=0;for(let o=t.length-1;o>=0;o--){let s=Buffer.byteLength(t[o],"utf8")+1;if(i+s>e)break;i+=s,r.push(t[o])}return r.reverse(),r}};var x=new T;import{spawn as Ge}from"child_process";import{existsSync as Ze}from"fs";import{dirname as tr,join as er}from"path";import{fileURLToPath as nr}from"url";var zt=Vt.join(X(),"TraceLogData");x.init(zt);(async()=>{try{await x.flush(),await x.retryFailed()}catch(n){c.warn("[telemetry] background upload error:",n),process.exit(1)}})();
9
+ `,"utf8")}catch{return}try{await u.promises.unlink(t)}catch{}}takeNewestWithinBudget(t,e){if(e<=0)return[];let r=[],i=0;for(let o=t.length-1;o>=0;o--){let s=Buffer.byteLength(t[o],"utf8")+1;if(i+s>e)break;i+=s,r.push(t[o])}return r.reverse(),r}};var x=new E;import{spawn as Ge}from"child_process";import{existsSync as Ze}from"fs";import{dirname as tr,join as er}from"path";import{fileURLToPath as nr}from"url";var zt=Vt.join(X(),"TraceLogData");x.init(zt);(async()=>{try{await x.flush(),await x.retryFailed()}catch(n){c.warn("[telemetry] background upload error:",n),process.exit(1)}})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deveco-test/deveco-cli-common",
3
- "version": "1.3.10-Test.2",
3
+ "version": "1.3.11-Test.4",
4
4
  "description": "HarmonyOS application development command line tool",
5
5
  "supportedDocsApi": 1,
6
6
  "license": "MIT",
@@ -14,15 +14,19 @@
14
14
  ],
15
15
  "scripts": {
16
16
  "prebuild": "node ../../scripts/sync-cli-docs.mjs",
17
- "build": "tsup",
17
+ "build": "npm run build -w design2arkts-engine && tsup",
18
18
  "dev": "tsx watch src/cli.ts",
19
19
  "start": "tsx src/cli.ts",
20
+ "prebundle:skills": "node ../../scripts/sync-cli-docs.mjs",
21
+ "bundle:skills": "tsx scripts/bundle-skills.ts",
22
+ "precheck:skills": "node ../../scripts/sync-cli-docs.mjs",
23
+ "check:skills": "tsx scripts/bundle-skills.ts --check",
20
24
  "test": "vitest run",
21
25
  "lint": "eslint \"src/**/*.ts\"",
22
26
  "lint:fix": "eslint src --fix",
23
27
  "format": "prettier --write src",
24
28
  "prepack": "node ../../scripts/sync-cli-docs.mjs",
25
- "prepublishOnly": "npm run lint && npm run build"
29
+ "prepublishOnly": "npm run lint && npm run build && npm run check:skills"
26
30
  },
27
31
  "engines": {
28
32
  "node": ">=22"
@@ -64,7 +68,7 @@
64
68
  "ui-verification-mcp": "0.0.20",
65
69
  "xpath": "^0.0.35",
66
70
  "zod": "^4.4.3",
67
- "@deveco-test/deveco-cli-knowledgebase": "1.3.10-Test.2"
71
+ "@deveco-test/deveco-cli-knowledgebase": "1.3.11-Test.4"
68
72
  },
69
73
  "devDependencies": {
70
74
  "@types/adm-zip": "^0.5.8",
@@ -72,6 +76,7 @@
72
76
  "@types/global-agent": "^3.0.0",
73
77
  "@types/node-forge": "^1.3.14",
74
78
  "@types/proper-lockfile": "^4.1.4",
75
- "@types/semver": "^7.7.1"
79
+ "@types/semver": "^7.7.1",
80
+ "design2arkts-engine": "0.1.0"
76
81
  }
77
82
  }
@@ -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
 
@@ -31,14 +32,12 @@ Compile and package project/modules. (Defaults: `--product default`, `--build-mo
31
32
  | Single-module / single-`entry` | `devecocli build` |
32
33
  | Specific modules | `devecocli build --modules <m1> <m2>@<target>` |
33
34
  | Whole product bundle (.app) | `devecocli build --product <name>` |
34
- | Specific assemble type | `devecocli build --assemble-type <assembleHap\|assembleApp\|assembleHsp\|assembleHar>` |
35
35
  | Override signing config | `devecocli build --signing-config <name>` |
36
36
  | Clean build outputs | `devecocli build clean` |
37
37
  | Clean specific modules | `devecocli build clean --modules <m1> <m2>` |
38
38
  - **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
39
  - **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
40
  - **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
41
  - **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
42
 
44
43
  ### `devecocli check lint`
@@ -98,13 +97,71 @@ Search HarmonyOS developer documentation in the local HarmonyOS Knowledge Base
98
97
  Always use this tool to get the most up-to-date information about HarmonyOS concepts.
99
98
 
100
99
  ### `devecocli device`
101
- - `list`: Show active real devices and running emulators. Opt: `--format <table|json>` (default: `table`).
102
- - `view`: Detailed info. Req `-t <name|serial>` on multi-device hosts. Opt: `--format <table|json>` (default: `table`).
103
- - `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`.
104
- - `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...]`.
105
- - `location`: Mock device location. Two set modes (mutually exclusive): `set --latitude <degrees> --longitude <degrees>` builds a one-point GPX from lat/lon, or `set --gpx-file <path>` pushes a user-provided GPX file directly. Both played via testhelper. Opt: `--altitude <m>`, `--speed <m/s>`, `--direction <degrees>` (0-360, lat/lon mode only), `--interval <seconds>` (1-3600, default 1, both modes), `--device <name|serial>` (same multi-device rule). `enable` turns on location mock (also done automatically by `set`); `disable` turns it off and restores real location. Requires system version 7.0+ (testhelper).
106
- - `network-sim`: Simulate device network conditions via netcopilot (API 20+). Two start modes: `start --id <n>` enables netcopilot and starts a preset scenario (1-8: 进出电梯/离家断开WLAN/到家连上WLAN/人员拥挤的饭堂/信号弱的地库/乘坐地铁/乘坐高铁(多SIM切换)/高速公路自驾; needs matching radios — WLAN+cellular for 1-3, WLAN or cellular for 4-8); `start --name <n> --up-bandwidth <bps> --down-bandwidth <bps> --up-latency <ms> --down-latency <ms> --up-drop <0-1> --down-drop <0-1>` creates a custom scenario via `netcopilot -a`, starts it, and records it for cleanup. `--id` and custom options are mutually exclusive. `stop` (no args) clears the simulation, deletes any custom scenario created by the last start, and disables netcopilot (idempotent). `list` shows preset scenarios; `status` reports `enabled`/`disabled`. All accept `--device <name|serial>` (same multi-device rule).
107
- - `playback`: Control the media playback center via `ohos-avsession-manager` (system version 6.1+). `list` shows active media sessions (bundle name + session ID). `play`/`pause`/`next`/`previous` are simple controls. `forward`/`rewind` fast-forward/rewind by an app-defined step (the `--time` parameter is ignored by apps; step size is not configurable). `seek --position <seconds>` jumps to a position. All control commands require `--id <sessionID>` or `--bundle <bundleName>` (resolves session ID via list). All accept `--device <name|serial>` (same multi-device rule).
100
+ 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).
101
+
102
+ | Subcommand | Description | Key Options |
103
+ |---|---|---|
104
+ | `list` | Show active real devices and running emulators | `--format table\|json` (default: `table`) |
105
+ | `view` | Detailed device info | `-t <name\|serial>` (Req on multi-device), `--format table\|json` (default: `table`) |
106
+ | `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...]` |
107
+ | `app install [files...]` | Install hap/hsp packages | `--replace` (overwrite), `--shared <path>` (HSP libs, repeatable), `--wait <seconds>` (180–600), `--user <userId>` |
108
+ | `app uninstall` | Uninstall app by bundle name | `--bundle <name>` |
109
+ | `app list` | List installed apps | `--format default\|json` |
110
+ | `app info <bundleName>` | Show app details | `--format default\|json` |
111
+ | `app foreground` | Show current foreground app | `--format default\|json` |
112
+ | `app start` | Launch app ability | `--bundle <name>`, `--ability <name>`, `--action <action>`, `--uri <uri>` |
113
+ | `app stop` | Force-stop app | `--bundle <name>` |
114
+ | `app cleardata` | Clear app data | `--bundle <name>` |
115
+ | `app clearcache` | Clear app cache | `--bundle <name>` |
116
+ | `wake` | Wake screen | — |
117
+ | `sleep` | Suspend screen | — |
118
+ | `status` | Show screen state (AWAKE/SLEEP) | — |
119
+ | `unlock` | Wake + swipe-up to unlock (phone/tablet only, not 2in1) | — |
120
+ | `open-control-center` | Swipe to open control center (phone/tablet only) | — |
121
+ | `open-notification-center` | Swipe to open notification center (phone/tablet only) | — |
122
+ | `time [datetime]` | Get (no arg) or set system time | `[datetime]` positional arg |
123
+ | `timezone [timezone]` | Get (no arg) or set system timezone | `[timezone]` positional arg |
124
+ | `screen size` | Get screen resolution | `--format default\|json` (json: `{width, height}`) |
125
+ | `screen rotation` | Get current screen rotation | — |
126
+ | `screen rotate <angle>` | Set screen rotation angle | `<angle>`: `0\|90\|180\|270` |
127
+ | `screen rotation-lock <state>` | Lock/unlock auto-rotate | `<state>`: `on\|off` |
128
+ | `screen sleeptime <ms>` | Set screen-off timeout | `<ms>`: timeout in ms; `-1` = never sleep |
129
+ | `file send <local> <remote>` | Push file to device | `<local>` source path, `<remote>` dest path |
130
+ | `file recv <remote> <local>` | Pull file from device | `<remote>` source path, `<local>` dest path |
131
+ | `file exist <path>` | Check if file exists on device | `<path>` on-device file path |
132
+ | `file delete <path>` | Delete file on device | `<path>` on-device file path |
133
+ | `clipboard read` | Read clipboard text | — |
134
+ | `clipboard write <text>` | Write text to clipboard | `<text>` positional arg |
135
+ | `clipboard clear` | Clear clipboard | — |
136
+ | `font info <fontpath>` | Query font info | `<fontpath>` font file path |
137
+ | `font install <fontpath>` | Install font file | `<fontpath>` font file path |
138
+ | `font uninstall <name>` | Uninstall font by name | `<name>` font name |
139
+ | `viewmode` | Get current dark/light mode | — |
140
+ | `viewmode dark` | Set dark mode | — |
141
+ | `viewmode light` | Set light mode | — |
142
+ | `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) |
143
+ | `location set` (gpx) | Mock location from GPX file | `--gpx-file <path>`, `--interval <seconds>` (mutually exclusive with lat/lon mode) |
144
+ | `location enable` | Turn on location mock (also done automatically by `set`) | — |
145
+ | `location disable` | Turn off and restore real location | — |
146
+ | `network-sim start` (preset) | Start preset scenario (1–8) | `--id <n>` |
147
+ | `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) |
148
+ | `network-sim stop` | Clear simulation, delete custom scenario, disable netcopilot (idempotent) | — |
149
+ | `network-sim list` | Show preset scenarios | — |
150
+ | `network-sim status` | Report enabled/disabled | — |
151
+ | `playback list` | Show active media sessions (bundle name + session ID) | — |
152
+ | `playback play` | Play media | `--id <sessionID>` or `--bundle <bundleName>` |
153
+ | `playback pause` | Pause media | `--id <sessionID>` or `--bundle <bundleName>` |
154
+ | `playback next` | Next track | `--id <sessionID>` or `--bundle <bundleName>` |
155
+ | `playback previous` | Previous track | `--id <sessionID>` or `--bundle <bundleName>` |
156
+ | `playback forward` | Fast forward (step size app-defined) | `--id <sessionID>` or `--bundle <bundleName>` |
157
+ | `playback rewind` | Rewind (step size app-defined) | `--id <sessionID>` or `--bundle <bundleName>` |
158
+ | `playback seek` | Jump to position | `--position <seconds>`, `--id <sessionID>` or `--bundle <bundleName>` |
159
+
160
+ - `location`: requires system version 7.0+ (testhelper).
161
+ - `network-sim`: requires API 20+ (netcopilot).
162
+ - `playback`: requires system version 6.1+ (ohos-avsession-manager).
163
+
164
+
108
165
 
109
166
  ### `devecocli run` `[Outside sandbox]`
110
167
  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`.
@@ -151,7 +208,7 @@ Fetch hilog or crash logs. Req `--device <name|serial>` on multi-device hosts.
151
208
  - `--bundle-name` / `--keyword`: Filter output.
152
209
  - `--from <start>` / `--to <end>`: Relative offsets (`30s`, `5m`).
153
210
  - `--tail <num>` / `--follow`: Keep last N lines / stream real-time (no `--to`).
154
- - `--path <path>` + `--crash`: Analyze a local fault log file or directory (cpp_crash / js_error / app_freeze) instead of pulling from device; picks the most relevant candidate when given a directory.
211
+ - `--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.
155
212
  - `--stack` + `--path <file>`: Analyze a local sample stack file (enhanced log); mutually exclusive with `--crash`.
156
213
  - `--format default|json|report|hilog`: Output format for local analysis (`hilog` extracts the HiLog section, `--crash` only).
157
214
  - `--limit <num>`: Max hotspots shown by `--stack` (default 20).
@@ -219,23 +276,61 @@ Inspect UI on a connected device. All subcommands accept `--device <name|serial>
219
276
  | `window list` | List active windows | `--format default\|json`, `--all` (include system windows) |
220
277
  | `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) |
221
278
  | `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` |
222
- | `click [x] [y]` | Tap at the specified coordinates or node | `--id <id>` (auto-resolves to center), `--window <windowId>` (used with `--id`) |
223
- | `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
224
- | `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--window <windowId>` |
225
- | `swipe <x1> <y1> <x2> <y2>` | Swipe from one point to another (precise coordinates, custom speed) | `--speed <n>` (200–40000, px/s) |
279
+ | `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`) |
280
+ | `doubleclick [x] [y]` | Double-tap at the specified coordinates or node | `--id <id>`, `--selector <expr>`, `--window <windowId>` |
281
+ | `longclick [x] [y]` | Long-press at the specified coordinates or node | `--id <id>`, `--selector <expr>`, `--duration <ms>` (500–60000, default 1000), `--window <windowId>` |
282
+ | `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) |
226
283
  | `fling <x1> <y1> <x2> <y2>` | Fling from one point to another | `--speed <n>` (200–40000, px/s) |
227
- | `drag <x1> <y1> <x2> <y2>` | Drag from one point to another | `--speed <n>` (200–40000, px/s) |
284
+ | `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) |
228
285
  | `dircfling <direction>` | Quick directional fling (system default speed, ideal for scrolling) | `direction`: `up`, `down`, `left`, `right` |
229
- | `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`) |
230
-
231
- - **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.
232
- - **`--window`**: May only be used together with `--id`. Default is focused window. Secondary display operations via `--id` + `--window` are not supported.
233
- - **`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).
286
+ | `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`) |
287
+ | `cleartext` | Clear text via Ctrl+A + Del (optionally click target element first) | `--selector <expr>` (click before clearing; default: focused field), `--window <windowId>` |
288
+ | `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) |
289
+ | `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) |
290
+ | `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) |
291
+ | `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>` |
292
+ | `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`) |
293
+ | `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 |
294
+ | `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` |
295
+ | `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 |
296
+
297
+ - **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).
298
+ - **`--window`**: Default is focused window. May be used with `--id`, `--selector`, or coordinate mode.
299
+ - **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.
300
+ - **`swipe`/`drag` element mode**: `--start <expr> --end <expr>` resolves each selector to bounds center, then performs the swipe/drag. Both must be provided together.
301
+ - **`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`).
302
+ - **`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).
303
+ - **`scrollsearch`**: The target `<selector>` does not support an index (`[n]`); passing one triggers an error.
234
304
  - **Text encoding**: Special characters in `text` are Base64-encoded internally to safely pass through device shell.
235
305
  - `--format json` pairs well with `jq`.
236
306
  - `--mode full`: full layout tree, no filtering.
237
307
  - `--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.
238
308
 
309
+ ### `devecocli testing` `[Outside sandbox]`
310
+
311
+ Run DevEco Testing detection services on a connected device.
312
+
313
+ | Sub-command | Parameters |
314
+ |---|---|
315
+ | `list` | — (`ServiceKey`, `Status`) |
316
+ | `install` | `--service <serviceKey>` |
317
+ | `update` | `--service <serviceKey>` |
318
+ | `run <serviceKey>` | `--package <bundleName>`, `--sn <serial[,serial]>`, `--duration <minutes>`, `--yes` |
319
+ | `stop` | `--task-id <taskId>` |
320
+ | `userinfo`, `exit` | — |
321
+
322
+ Parameter reference: `devecocli testing <sub-command> --help`.
323
+
324
+ ```powershell
325
+ devecocli testing list
326
+ devecocli testing install --service MemLeakTest
327
+ devecocli testing update --service MemLeakTest
328
+ devecocli testing run MemLeakTest --package com.example.myapp --sn <serial> --duration 10 --yes
329
+ ```
330
+
331
+ **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.
332
+
333
+ **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]`.
239
334
 
240
335
  ## 2. Setup
241
336
 
@@ -245,16 +340,17 @@ When this skill is provided by an agent plugin, follow its injected Runtime guid
245
340
 
246
341
  ### `devecocli init`
247
342
  MUTUALLY EXCLUSIVE modes for setup:
248
- 1. `--skill` (Default): Install `deveco-cli` skill to AI agents.
343
+ 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.
249
344
  2. `--mcp`: Configure `deveco-mcp` server (ArkTS/C++ syntax checking).
250
345
  *Options*:
251
346
  - `--agent <agents>`: Comma-separated (e.g. `opencode,pi,cursor`). Defaults to detected agents.
252
347
  - `--project <path>`: Project-level config (Abs path for MCP).
253
348
  - `--path <path>`: Direct skill install path; cannot combine with `--agent`, `--project` or `--mcp`.
349
+ - `--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`.
254
350
  *MCP Rules*: Configured MCP agents support global (no `--project`) and project-level setup; `qoder` is unsupported.
255
351
  *Skill agents*: See README.md, “Skill 支持的智能体”. All supported agents allow global and project installation. If an agent is not detected, specify `--agent`.
256
352
 
257
- **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.
353
+ **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).
258
354
 
259
355
  ### `devecocli auth login`
260
356
  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).
@@ -272,15 +368,17 @@ List team accounts the current user has joined.
272
368
 
273
369
  ### `devecocli skills`
274
370
  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.
275
- - `list [-l|--long]` / `find <keyword>`: List or search skills.
276
- - `add (--all | --skill <name>) [--agent <a,b…>] [--project <path>] [--path <path>] [-f]`: Install.
277
- - `remove --skill <name> [...]`: Uninstall.
371
+ - `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.
372
+ - `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`.)
373
+ - `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.
278
374
  - Ordinary project paths such as `skills/` and `data/` require an explicit `--agent` for installation or removal; automatic selection ignores them.
279
- A minimum set: the ArkTS red-line rules (mandatory review before writing ArkTS) plus `hmos-arkui-develop-skill` (fatal pitfalls + accurate API entry), `hmos-one-sdk-skill` (searchable official-doc knowledge base), and `hmos-runtime-fix-skill` (anchor-based minimal fix) — covering pre-coding constraints, API accuracy, doc lookup, and crash diagnosis.
375
+ 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.
280
376
 
281
- **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.
377
+ 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`.
282
378
 
283
- 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.
379
+ **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.
380
+
381
+ 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.
284
382
 
285
383
  *Ex*: `devecocli skills add --skill <name> --agent opencode --project ./MyApp`
286
384
 
@@ -295,7 +393,7 @@ Manage whitelisted npm-packaged AI agent plugins (official registry only; the wh
295
393
  *Ex*: `devecocli plugin install example-plugin --agent opencode --project ./MyApp`
296
394
 
297
395
  ### `devecocli check compat` `[Outside sandbox]`
298
- Scan source code for breaking API changes between two SDK versions. Built on top of DevEco Studio's `arkanalyzer-apiscan` plugin.
396
+ 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.
299
397
  - `versions`: List available target SDK versions. Opts: `--format <default|json>` (default: `default`).
300
398
  - Default (no args): project-level scan.
301
399
  - `--modules <m1> [m2...]`: Module-level scan.
@@ -309,9 +407,15 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
309
407
 
310
408
  *Ex*: `devecocli check compat --source-version "<source_version>" --target-version "<target_version>" --output-path ./report`
311
409
 
410
+ ### `devecocli design2arkts` (alias: `d2a`)
411
+
412
+ Use `devecocli d2a --help` for Pixso/Figma design-to-ArkTS workflows and standalone capabilities accepting local images or code without a prior D2A run.
413
+
414
+ 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.
415
+
312
416
  ## 3. Maintenance
313
417
 
314
- - **`devecocli update`** `[Outside sandbox]`: Update CLI to latest version; also syncs the docs knowledgebase to the latest compatible version (downloads it only when docs is outdated).
418
+ - **`devecocli update`** `[Outside sandbox]`: Update CLI to latest version.
315
419
  - **`devecocli serve mcp`**: Host stdio MCP server (`check` tool for `.ets`/C/C++). Used via `init --mcp`. (Env: `PROJECT_PATH`, `DEVECO_PATH`, `NODE_MAX_OLD_SPACE_SIZE`, `DEBUG=1`).
316
420
  - **`devecocli serve lsp`**: Host a bundled stdio **LSP** language server — `--arkts` (ArkTS, ace-server) or `--cpp` (clangd). Standard LSP protocol: completion, go-to-definition, hover, references, diagnostics. Opts: `--project-path <path>` (used as-is), `--auto-detect` (search cwd and subdirs for project root; ignored when `--project-path` given).
317
421
  - Agents/editors with a built-in LSP client drive it directly — e.g. **opencode** (`lsp` config in `opencode.json`), **Zed**, **Neovim**, **VS Code**, **Emacs**:
@@ -330,6 +434,10 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
330
434
  `devecocli build --product oversea --build-mode release`
331
435
  - **First-time signing setup** (login authorized; user completes browser authentication):
332
436
  `devecocli auth login --no-prompt` -> `devecocli signature generate --product default` -> `devecocli build` -> `devecocli run`
437
+ - **One-sentence detection run** (e.g. "测试商城应用内存泄漏"):
438
+ read `AppScope/app.json5` for the bundle name and `devecocli device list` for the serial ->
439
+ `devecocli testing list` -> `devecocli testing install --service MemLeakTest` if `Not installed` ->
440
+ `devecocli testing run MemLeakTest --package <bundleName> --sn <serial> --duration 240 --yes` -> summarize `[REPORT]`
333
441
 
334
442
  ## Troubleshooting
335
443
 
@@ -346,3 +454,7 @@ Validation order: `files` + `--modules` mutually exclusive → `--source-version
346
454
  - **`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.
347
455
  - **`image list` duplicate OS rows**: `phone`/`foldable`/`widefold`/`triplefold` share the same image. Download/remove ONCE per OS version.
348
456
  - **`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.
457
+ - **`未找到 DevEco Testing 安装`**: Install the DevEco Testing client or point `DEVECO_TESTING_HOME` at its install root; `devecocli testing help` confirms the path works.
458
+ - **`当前 DevEco Testing 版本不支持 testing`**: The installed client is too old. Run `devecocli testing update`, then retry.
459
+ - **`[ERROR] 前置确认未通过`**: `run` hit the confirmation prompt in a non-interactive shell. Add `--yes`.
460
+ - **`run` killed mid-test**: The bash timeout was shorter than the test. Re-run with a longer timeout; a killed run produces no report.
@@ -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`。