@ohos-cpf/3rdloop 0.0.1

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 (389) hide show
  1. package/README.md +425 -0
  2. package/bin/3rdloop.mjs +48 -0
  3. package/lib/cli.js +741 -0
  4. package/lib/config.js +318 -0
  5. package/lib/doctor.js +114 -0
  6. package/lib/exit-codes.js +31 -0
  7. package/lib/opencode.js +156 -0
  8. package/lib/orch.js +427 -0
  9. package/lib/queries.js +264 -0
  10. package/lib/runner.js +979 -0
  11. package/lib/step.js +326 -0
  12. package/lib/ui.js +223 -0
  13. package/lib/workflow.js +291 -0
  14. package/lib/workflows.js +132 -0
  15. package/package.json +50 -0
  16. package/vendor/Server/Agent/SkillSelector/README.md +344 -0
  17. package/vendor/Server/Agent/SkillSelector/core/Agent.js +207 -0
  18. package/vendor/Server/Agent/SkillSelector/index.js +14 -0
  19. package/vendor/Server/Agent/SkillSelector/llm/llmClient.js +313 -0
  20. package/vendor/Server/Agent/SkillSelector/llm/prompts.js +161 -0
  21. package/vendor/Server/Agent/SkillSelector/llm/reactSteps.js +144 -0
  22. package/vendor/Server/Agent/SkillSelector/matcher/fuzzyMatcher.js +433 -0
  23. package/vendor/Server/Agent/SkillSelector/scanner/skillScanner.js +382 -0
  24. package/vendor/Server/Agent/SkillSelector/types.js +63 -0
  25. package/vendor/Server/Agent/SkillSelector/utils/actionWords.js +60 -0
  26. package/vendor/Server/Brain/AnalysisStrategies.js +422 -0
  27. package/vendor/Server/Brain/Brain.js +686 -0
  28. package/vendor/Server/Brain/DecompositionStrategies.js +621 -0
  29. package/vendor/Server/Brain/PlanPersistence.js +196 -0
  30. package/vendor/Server/Brain/SkillExecutor.js +251 -0
  31. package/vendor/Server/Brain/index.js +11 -0
  32. package/vendor/Server/CLI/cli.js +243 -0
  33. package/vendor/Server/CLI/opencode/index.js +804 -0
  34. package/vendor/Server/CLI/opencode.js +5 -0
  35. package/vendor/Server/DbUse/MessageArchive.js +61 -0
  36. package/vendor/Server/DbUse/StorageManager.js +107 -0
  37. package/vendor/Server/DbUse/adapters/BaseAdapter.js +94 -0
  38. package/vendor/Server/DbUse/adapters/FileAdapter.js +138 -0
  39. package/vendor/Server/DbUse/adapters/JsonAdapter.js +138 -0
  40. package/vendor/Server/DbUse/adapters/JsonlAdapter.js +114 -0
  41. package/vendor/Server/DbUse/adapters/SqliteAdapter.js +157 -0
  42. package/vendor/Server/DbUse/index.js +160 -0
  43. package/vendor/Server/DbUse/stores/SessionStore.js +279 -0
  44. package/vendor/Server/DbUse/stores/TaskExecutionStore.js +133 -0
  45. package/vendor/Server/DbUse/stores/TaskRegistryStore.js +262 -0
  46. package/vendor/Server/DbUse/stores/TaskStepStore.js +279 -0
  47. package/vendor/Server/FlexRunner/FlexRunner.js +1759 -0
  48. package/vendor/Server/FlexRunner/index.js +12 -0
  49. package/vendor/Server/Knowledge/KnowledgeImporter.js +523 -0
  50. package/vendor/Server/Knowledge/KnowledgeManager.js +341 -0
  51. package/vendor/Server/Knowledge/index.js +33 -0
  52. package/vendor/Server/LoopEngine/LoopEngine.js +1133 -0
  53. package/vendor/Server/LoopEngine/index.js +11 -0
  54. package/vendor/Server/Orchestrator/Orchestrator.js +1425 -0
  55. package/vendor/Server/Orchestrator/StepNode.js +312 -0
  56. package/vendor/Server/Orchestrator/index.js +13 -0
  57. package/vendor/Server/Routes/controllers/BrainController.js +241 -0
  58. package/vendor/Server/Routes/controllers/FlexRunnerController.js +1125 -0
  59. package/vendor/Server/Routes/controllers/HealthController.js +44 -0
  60. package/vendor/Server/Routes/controllers/KnowledgeImportController.js +355 -0
  61. package/vendor/Server/Routes/controllers/LoopEngineController.js +788 -0
  62. package/vendor/Server/Routes/controllers/OrchestratorController.js +911 -0
  63. package/vendor/Server/Routes/controllers/StatsController.js +57 -0
  64. package/vendor/Server/Routes/controllers/StreamController.js +67 -0
  65. package/vendor/Server/Routes/library/logger.js +179 -0
  66. package/vendor/Server/Routes/library/zipArchive.js +172 -0
  67. package/vendor/Server/Routes/router/Router.js +204 -0
  68. package/vendor/Server/Routes/routes/brain.js +47 -0
  69. package/vendor/Server/Routes/routes/flexrunner.js +72 -0
  70. package/vendor/Server/Routes/routes/health.js +28 -0
  71. package/vendor/Server/Routes/routes/index.js +57 -0
  72. package/vendor/Server/Routes/routes/knowledge.js +55 -0
  73. package/vendor/Server/Routes/routes/loopengine.js +58 -0
  74. package/vendor/Server/Routes/routes/orchestrator.js +61 -0
  75. package/vendor/Server/Routes/routes/registry.js +98 -0
  76. package/vendor/Server/Routes/routes/stats.js +23 -0
  77. package/vendor/Server/Routes/routes/stream.js +30 -0
  78. package/vendor/Server/Routes/server.js +202 -0
  79. package/vendor/Server/Routes/sse/SseHub.js +308 -0
  80. package/vendor/Server/Skills/acceptance-check/SKILL.md +174 -0
  81. package/vendor/Server/Skills/acceptance-check/references/PHASE1_ARTIFACT_COLLECTION.md +52 -0
  82. package/vendor/Server/Skills/acceptance-check/references/PHASE2_CRITERIA_EVALUATION.md +77 -0
  83. package/vendor/Server/Skills/arkts-code-check/SKILL.md +314 -0
  84. package/vendor/Server/Skills/arkts-code-check/references/CODE_CHECK_GUIDE.md +160 -0
  85. package/vendor/Server/Skills/arkts-code-check/references/FILE_TYPE_GUIDE.md +29 -0
  86. package/vendor/Server/Skills/arkts-code-check/references/PHASE1_INFO_COLLECTION.md +222 -0
  87. package/vendor/Server/Skills/arkts-code-check/references/REPORT_TEMPLATE.md +220 -0
  88. package/vendor/Server/Skills/arkts-library-compile-validate/SKILL.md +329 -0
  89. package/vendor/Server/Skills/arkts-library-compile-validate/scripts/build.ps1 +93 -0
  90. package/vendor/Server/Skills/arkts-library-compile-validate/scripts/code-linter.cjs +433 -0
  91. package/vendor/Server/Skills/arkts-library-compile-validate/scripts/migrate.cjs +851 -0
  92. package/vendor/Server/Skills/arkts-library-compile-validate/scripts/ohpm-switch.cjs +789 -0
  93. package/vendor/Server/Skills/arkts-library-demo-code/SKILL.md +291 -0
  94. package/vendor/Server/Skills/arkts-library-demo-code/references/API_SIGNATURE_CHECKS.md +68 -0
  95. package/vendor/Server/Skills/arkts-library-demo-code/references/BUILD_VALIDATION.md +184 -0
  96. package/vendor/Server/Skills/arkts-library-demo-code/references/CODE_STANDARDS.md +337 -0
  97. package/vendor/Server/Skills/arkts-library-demo-code/references/EXAMPLES.md +400 -0
  98. package/vendor/Server/Skills/arkts-library-demo-code/references/SYSTEM_API_LOOKUP.md +99 -0
  99. package/vendor/Server/Skills/arkts-library-demo-code/references/TEMPLATE.md +544 -0
  100. package/vendor/Server/Skills/arkts-library-demo-code/scripts/build.ps1 +93 -0
  101. package/vendor/Server/Skills/arkts-library-demo-code/scripts/code-linter.cjs +433 -0
  102. package/vendor/Server/Skills/arkts-library-demo-code/scripts/migrate.cjs +851 -0
  103. package/vendor/Server/Skills/arkts-library-demo-code/scripts/ohpm-switch.cjs +789 -0
  104. package/vendor/Server/Skills/arkts-library-demo-coverage/SKILL.md +174 -0
  105. package/vendor/Server/Skills/arkts-library-demo-scenario/SKILL.md +321 -0
  106. package/vendor/Server/Skills/arkts-library-demo-scenario/references/EXAMPLES.md +100 -0
  107. package/vendor/Server/Skills/arkts-library-demo-scenario/references/TEMPLATE.md +185 -0
  108. package/vendor/Server/Skills/arkts-library-documentation-quality-check/SKILL.md +234 -0
  109. package/vendor/Server/Skills/arkts-library-documentation-quality-check/assets/REPORT_TEMPLATE.md +103 -0
  110. package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/CHECK_DIMENSIONS.md +89 -0
  111. package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/COMPLIANCE_CHECKLIST.md +62 -0
  112. package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/KB_QUERY_GUIDE.md +108 -0
  113. package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/MCP_TOOL_DISCOVERY.md +124 -0
  114. package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/REPORT_TEMPLATE.md +90 -0
  115. package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/SCORING_FORMULA.md +57 -0
  116. package/vendor/Server/Skills/arkts-library-documentation-quality-check/scripts/validate-skill.cjs +259 -0
  117. package/vendor/Server/Skills/arkts-library-interface-spec/SKILL.md +97 -0
  118. package/vendor/Server/Skills/arkts-library-memory-leak-check/SKILL.md +392 -0
  119. package/vendor/Server/Skills/arkts-library-source-clone/SKILL.md +113 -0
  120. package/vendor/Server/Skills/arkts-library-stability-check/SKILL.md +313 -0
  121. package/vendor/Server/Skills/arkts-library-stability-check/assets/REPORT_TEMPLATE.md +154 -0
  122. package/vendor/Server/Skills/arkts-library-stability-check/references/CHECKLIST.md +166 -0
  123. package/vendor/Server/Skills/arkts-library-stability-check/references/CODE_EXAMPLES.md +309 -0
  124. package/vendor/Server/Skills/arkts-library-stability-check/references/SCORING_RULES.md +90 -0
  125. package/vendor/Server/Skills/arkts-library-stability-check/scripts/validate-skill.cjs +282 -0
  126. package/vendor/Server/Skills/arkts-library-test-coverage-check/SKILL.md +361 -0
  127. package/vendor/Server/Skills/arkts-library-test-coverage-check/assets/REPORT_TEMPLATE.md +146 -0
  128. package/vendor/Server/Skills/arkts-library-test-coverage-check/references/CHECKLIST.md +253 -0
  129. package/vendor/Server/Skills/arkts-library-test-coverage-check/references/MCP_TOOL_USAGE.md +115 -0
  130. package/vendor/Server/Skills/arkts-library-test-coverage-check/scripts/validate-skill.cjs +263 -0
  131. package/vendor/Server/Skills/arkts-library-xts-code/SKILL.md +455 -0
  132. package/vendor/Server/Skills/arkts-library-xts-code/assets/report-template.md +60 -0
  133. package/vendor/Server/Skills/arkts-library-xts-code/references/ACCESS_MODIFIER_PRECHECK.md +76 -0
  134. package/vendor/Server/Skills/arkts-library-xts-code/references/BUILD_VERIFICATION.md +200 -0
  135. package/vendor/Server/Skills/arkts-library-xts-code/references/CODE_STANDARDS.md +519 -0
  136. package/vendor/Server/Skills/arkts-library-xts-code/references/SUBAGENT_PROMPT_TEMPLATE.md +276 -0
  137. package/vendor/Server/Skills/arkts-library-xts-code/references/SYSTEM_API_LOOKUP.md +93 -0
  138. package/vendor/Server/Skills/arkts-library-xts-code/references/XTS_TEMPLATE.md +767 -0
  139. package/vendor/Server/Skills/arkts-library-xts-code/scripts/build.ps1 +93 -0
  140. package/vendor/Server/Skills/arkts-library-xts-code/scripts/code-linter.cjs +433 -0
  141. package/vendor/Server/Skills/arkts-library-xts-code/scripts/migrate.cjs +851 -0
  142. package/vendor/Server/Skills/arkts-library-xts-code/scripts/ohpm-switch.cjs +789 -0
  143. package/vendor/Server/Skills/arkts-library-xts-code/scripts/precheck-access-modifiers.cjs +221 -0
  144. package/vendor/Server/Skills/arkts-library-xts-code-fix/SKILL.md +229 -0
  145. package/vendor/Server/Skills/arkts-library-xts-coverage/SKILL.md +97 -0
  146. package/vendor/Server/Skills/arkts-library-xts-doc/SKILL.md +194 -0
  147. package/vendor/Server/Skills/arkts-library-xts-doc/references/EXAMPLES.md +576 -0
  148. package/vendor/Server/Skills/arkts-library-xts-doc/references/TEMPLATE.md +575 -0
  149. package/vendor/Server/Skills/arkts-library-xts-doc/references/TESTABILITY_GUIDE.md +182 -0
  150. package/vendor/Server/Skills/arkts-library-xts-execution/SKILL.md +491 -0
  151. package/vendor/Server/Skills/arkts-library-xts-execution/references/error-fixing-examples.md +217 -0
  152. package/vendor/Server/Skills/arkts-library-xts-execution/scripts/build.ps1 +93 -0
  153. package/vendor/Server/Skills/arkts-library-xts-execution/scripts/code-linter.cjs +433 -0
  154. package/vendor/Server/Skills/arkts-library-xts-execution/scripts/migrate.cjs +851 -0
  155. package/vendor/Server/Skills/arkts-library-xts-execution/scripts/ohpm-switch.cjs +789 -0
  156. package/vendor/Server/Skills/flutter-code-check/SKILL.md +299 -0
  157. package/vendor/Server/Skills/flutter-code-check/assets/OUTPUT_TEMPLATE.md +312 -0
  158. package/vendor/Server/Skills/flutter-code-check/references/CHECKLIST.md +190 -0
  159. package/vendor/Server/Skills/flutter-code-check/references/PLATFORMS.md +134 -0
  160. package/vendor/Server/Skills/flutter-code-check/scripts/validate-skill.cjs +259 -0
  161. package/vendor/Server/Skills/flutter-interface/README.md +75 -0
  162. package/vendor/Server/Skills/flutter-interface/SKILL.md +291 -0
  163. package/vendor/Server/Skills/flutter-interface/references/EXAMPLES.md +336 -0
  164. package/vendor/Server/Skills/flutter-interface/references/GIT_CLONE_GUIDE.md +190 -0
  165. package/vendor/Server/Skills/flutter-interface/references/SCRIPT_REFERENCE.md +258 -0
  166. package/vendor/Server/Skills/flutter-interface/references/TEMPLATE.md +254 -0
  167. package/vendor/Server/Skills/flutter-library-consistency-check/SKILL.md +518 -0
  168. package/vendor/Server/Skills/flutter-library-consistency-check/references/CHECKLIST.md +382 -0
  169. package/vendor/Server/Skills/flutter-library-consistency-check/references/FUNCTION_COMPARISON_GUIDE.md +342 -0
  170. package/vendor/Server/Skills/flutter-library-consistency-check/references/PLATFORM_LIMITATION_GUIDE.md +71 -0
  171. package/vendor/Server/Skills/flutter-library-documentation-quality-check/SKILL.md +519 -0
  172. package/vendor/Server/Skills/flutter-library-documentation-quality-check/references/CHECKLIST.md +407 -0
  173. package/vendor/Server/Skills/flutter-library-memory-leak-check/SKILL.md +653 -0
  174. package/vendor/Server/Skills/flutter-library-memory-leak-check/references/CHECKLIST.md +397 -0
  175. package/vendor/Server/Skills/flutter-library-stability-check/SKILL.md +745 -0
  176. package/vendor/Server/Skills/flutter-library-stability-check/references/CHECKLIST.md +721 -0
  177. package/vendor/Server/Skills/flutter-library-test-coverage-check/SKILL.md +414 -0
  178. package/vendor/Server/Skills/flutter-library-test-coverage-check/assets/REPORT_TEMPLATE.md +150 -0
  179. package/vendor/Server/Skills/flutter-library-test-coverage-check/references/CHECKLIST.md +304 -0
  180. package/vendor/Server/Skills/flutter-library-test-coverage-check/references/SCORING_RULES.md +265 -0
  181. package/vendor/Server/Skills/flutter-library-test-coverage-check/references/SCRIPT_USAGE.md +286 -0
  182. package/vendor/Server/Skills/knowledge-import/SKILL.md +383 -0
  183. package/vendor/Server/Skills/knowledge-import/references/MCP_TOOL_USAGE.md +165 -0
  184. package/vendor/Server/Skills/knowledge-import/references/SKILL_LOCATOR_GUIDE.md +91 -0
  185. package/vendor/Server/Skills/knowledge-import/references/SKILL_OPTIMIZATION_GUIDE.md +127 -0
  186. package/vendor/Server/Skills/ohos-lib-pr-push/SKILL.md +301 -0
  187. package/vendor/Server/Skills/ohos-lib-pr-push/assets/PR_ISSUE_TEMPLATE.md +105 -0
  188. package/vendor/Server/Skills/ohos-lib-pr-push/references/GITCODE_API.md +127 -0
  189. package/vendor/Server/Skills/ohos-lib-pr-push/scripts/gitcode-api.cjs +208 -0
  190. package/vendor/Server/Skills/rn-code-check/SKILL.md +321 -0
  191. package/vendor/Server/Skills/rn-code-check/references/API-GUIDE.md +235 -0
  192. package/vendor/Server/Skills/rn-code-check/references/CHECKLIST.md +189 -0
  193. package/vendor/Server/Skills/rn-code-check/references/REPORT-TEMPLATE.md +247 -0
  194. package/vendor/Server/Skills/rn-lib-add-example/SKILL.md +198 -0
  195. package/vendor/Server/Skills/rn-lib-add-example/references/APP_RENAME_GUIDE.md +40 -0
  196. package/vendor/Server/Skills/rn-lib-add-example/references/SHELL_ADAPTATION_CHECKLIST.md +78 -0
  197. package/vendor/Server/Skills/rn-lib-add-example/references/TEMPLATE_REPO_GUIDE.md +70 -0
  198. package/vendor/Server/Skills/rn-lib-add-example/references/VERIFICATION_GUIDE.md +47 -0
  199. package/vendor/Server/Skills/rn-lib-add-example/scripts/create-example.cjs +252 -0
  200. package/vendor/Server/Skills/rn-lib-update-doc/SKILL.md +176 -0
  201. package/vendor/Server/Skills/rn-lib-update-doc/config.json +5 -0
  202. package/vendor/Server/Skills/rn-lib-update-doc/references/changelog-template.md +35 -0
  203. package/vendor/Server/Skills/rn-lib-update-doc/references/format-diff.md +137 -0
  204. package/vendor/Server/Skills/rn-lib-update-doc/references/link-registry.json +33 -0
  205. package/vendor/Server/Skills/rn-lib-update-doc/references/model-0.4.2-overview.md +40 -0
  206. package/vendor/Server/Skills/rn-lib-update-doc/references/model-0.4.2.md +429 -0
  207. package/vendor/Server/Skills/rn-lib-update-doc/scripts/detect-readme-format.cjs +105 -0
  208. package/vendor/Server/Skills/rn-lib-update-doc/scripts/find-usage-doc.cjs +90 -0
  209. package/vendor/Server/Skills/rn-lib-update-doc/scripts/link-verify.cjs +213 -0
  210. package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-changelog.cjs +73 -0
  211. package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-package-meta.cjs +258 -0
  212. package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-readme-links.cjs +341 -0
  213. package/vendor/Server/Skills/rn-lib-update-doc/scripts/resolve-usage-docs.cjs +67 -0
  214. package/vendor/Server/Skills/rn-library-consistency-check/SKILL.md +299 -0
  215. package/vendor/Server/Skills/rn-library-consistency-check/assets/REPORT_TEMPLATE.md +293 -0
  216. package/vendor/Server/Skills/rn-library-consistency-check/references/ARKTS_COMPONENT_CHECK_GUIDE.md +857 -0
  217. package/vendor/Server/Skills/rn-library-consistency-check/references/ARKTS_TURBOMODULE_CHECK_GUIDE.md +856 -0
  218. package/vendor/Server/Skills/rn-library-consistency-check/references/CHECKLIST.md +157 -0
  219. package/vendor/Server/Skills/rn-library-consistency-check/references/CPP_COMPONENT_CHECK_GUIDE.md +801 -0
  220. package/vendor/Server/Skills/rn-library-consistency-check/references/CPP_TURBOMODULE_CHECK_GUIDE.md +684 -0
  221. package/vendor/Server/Skills/rn-library-consistency-check/references/FUNCTION_COMPARISON_GUIDE.md +233 -0
  222. package/vendor/Server/Skills/rn-library-consistency-check/references/NATIVE_COMPONENT_IDENTIFICATION.md +1373 -0
  223. package/vendor/Server/Skills/rn-library-consistency-check/references/SCORING_STANDARD.md +220 -0
  224. package/vendor/Server/Skills/rn-library-consistency-check/scripts/validate-skill.py +245 -0
  225. package/vendor/Server/Skills/rn-library-documentation-quality-check/SKILL.md +263 -0
  226. package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/MODEL.md +414 -0
  227. package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/MODEL_en.md +413 -0
  228. package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/REPORT_TEMPLATE.md +311 -0
  229. package/vendor/Server/Skills/rn-library-documentation-quality-check/references/CHECK_CHECKLIST.md +355 -0
  230. package/vendor/Server/Skills/rn-library-documentation-quality-check/references/CROSS_VALIDATION_GUIDE.md +115 -0
  231. package/vendor/Server/Skills/rn-library-documentation-quality-check/references/DOC_COLLECTION_GUIDE.md +139 -0
  232. package/vendor/Server/Skills/rn-library-documentation-quality-check/references/EXAMPLES.md +586 -0
  233. package/vendor/Server/Skills/rn-library-documentation-quality-check/references/GOTCHAS.md +57 -0
  234. package/vendor/Server/Skills/rn-library-documentation-quality-check/scripts/validate-skill.py +259 -0
  235. package/vendor/Server/Skills/rn-library-interface-analyzer/SKILL.md +301 -0
  236. package/vendor/Server/Skills/rn-library-interface-analyzer/assets/REPORT_TEMPLATE.md +148 -0
  237. package/vendor/Server/Skills/rn-library-interface-analyzer/references/DOC_ANNOTATION_GUIDE.md +118 -0
  238. package/vendor/Server/Skills/rn-library-interface-analyzer/references/SCRIPT_USAGE_GUIDE.md +168 -0
  239. package/vendor/Server/Skills/rn-library-interface-analyzer/references/URL_PARSING_RULES.md +176 -0
  240. package/vendor/Server/Skills/rn-library-issue-generalizer/SKILL.md +274 -0
  241. package/vendor/Server/Skills/rn-library-issue-generalizer/assets/case-template.md +45 -0
  242. package/vendor/Server/Skills/rn-library-issue-generalizer/assets/rule-template.md +25 -0
  243. package/vendor/Server/Skills/rn-library-issue-generalizer/references/PR_FETCH_GUIDE.md +61 -0
  244. package/vendor/Server/Skills/rn-library-issue-generalizer/references/RULE_TEMPLATE_GUIDE.md +165 -0
  245. package/vendor/Server/Skills/rn-library-issue-generalizer/scripts/fetch-pr-info.py +239 -0
  246. package/vendor/Server/Skills/rn-library-known-issue-check/SKILL.md +263 -0
  247. package/vendor/Server/Skills/rn-library-known-issue-check/assets/REPORT_TEMPLATE.md +96 -0
  248. package/vendor/Server/Skills/rn-library-known-issue-check/references/COMPLIANCE_CHECKLIST.md +58 -0
  249. package/vendor/Server/Skills/rn-library-known-issue-check/references/INSPECTION_GUIDE.md +99 -0
  250. package/vendor/Server/Skills/rn-library-known-issue-check/references/PRESCREEN_GUIDE.md +64 -0
  251. package/vendor/Server/Skills/rn-library-known-issue-check/references/SOURCE_PREP_GUIDE.md +75 -0
  252. package/vendor/Server/Skills/rn-library-known-issue-check/scripts/validate-known-issue-report.py +164 -0
  253. package/vendor/Server/Skills/rn-library-memory-leak-check/SKILL.md +339 -0
  254. package/vendor/Server/Skills/rn-library-memory-leak-check/assets/REPORT_TEMPLATE.md +83 -0
  255. package/vendor/Server/Skills/rn-library-memory-leak-check/references/CHECKLIST.md +859 -0
  256. package/vendor/Server/Skills/rn-library-memory-leak-check/references/HARMONY_CODE_PATTERNS.md +122 -0
  257. package/vendor/Server/Skills/rn-library-memory-leak-check/scripts/scan_harmony_code.py +279 -0
  258. package/vendor/Server/Skills/rn-library-stability-check/SKILL.md +273 -0
  259. package/vendor/Server/Skills/rn-library-stability-check/assets/REPORT_TEMPLATE.md +129 -0
  260. package/vendor/Server/Skills/rn-library-stability-check/references/CHECKLIST.md +581 -0
  261. package/vendor/Server/Skills/rn-library-stability-check/references/SCORING_RULES.md +138 -0
  262. package/vendor/Server/Skills/rn-library-stability-check/scripts/scan-harmony-code.py +168 -0
  263. package/vendor/Server/Skills/rn-library-test-coverage-check/SKILL.md +506 -0
  264. package/vendor/Server/Skills/rn-library-test-coverage-check/references/CHECKLIST.md +280 -0
  265. package/vendor/Server/Skills/rn-library-test-coverage-check/references/DEMO_LOCATION.md +221 -0
  266. package/vendor/Server/Skills/rn-library-test-coverage-check/references/REPORT_TEMPLATE.md +209 -0
  267. package/vendor/Server/Skills/rn-library-test-coverage-check/references/SCRIPT_USAGE.md +325 -0
  268. package/vendor/Server/Skills/rn-ohos-xts-generator/SKILL.md +279 -0
  269. package/vendor/Server/Skills/rn-ohos-xts-generator/assets/TEST_FILE_TEMPLATES.md +404 -0
  270. package/vendor/Server/Skills/rn-ohos-xts-generator/references/BUILD_TROUBLESHOOTING.md +185 -0
  271. package/vendor/Server/Skills/rn-ohos-xts-generator/references/BUILD_WORKFLOW.md +265 -0
  272. package/vendor/Server/Skills/rn-ohos-xts-generator/references/COMMON_CONFIG.md +189 -0
  273. package/vendor/Server/Skills/rn-ohos-xts-generator/references/CONFIG_GUIDE.md +203 -0
  274. package/vendor/Server/Skills/rn-ohos-xts-generator/references/COVERAGE_ANALYZER.md +147 -0
  275. package/vendor/Server/Skills/rn-ohos-xts-generator/references/DESIGN_DOC_GUIDE.md +148 -0
  276. package/vendor/Server/Skills/rn-ohos-xts-generator/references/GENERATION_FLOW.md +165 -0
  277. package/vendor/Server/Skills/rn-ohos-xts-generator/references/GENERATION_STRATEGY.md +195 -0
  278. package/vendor/Server/Skills/rn-ohos-xts-generator/references/HARMONY_SCANNER.md +249 -0
  279. package/vendor/Server/Skills/rn-ohos-xts-generator/references/JEST_FRAMEWORK.md +235 -0
  280. package/vendor/Server/Skills/rn-ohos-xts-generator/references/PLATFORM_COMPAT.md +161 -0
  281. package/vendor/Server/Skills/rn-ohos-xts-generator/references/RN_TEST_PATTERNS.md +413 -0
  282. package/vendor/Server/Skills/rn-ohos-xts-generator/references/SOURCE_PARSER.md +235 -0
  283. package/vendor/Server/Skills/rn-ohos-xts-generator/references/TEST_CONVENTIONS.md +245 -0
  284. package/vendor/Server/Skills/rn-ohos-xts-generator/references/TROUBLESHOOTING.md +282 -0
  285. package/vendor/Server/Skills/rn-ohos-xts-generator/references/USAGE_GUIDE.md +251 -0
  286. package/vendor/Server/Skills/rnoh-cptf-api-test/SKILL.md +469 -0
  287. package/vendor/Server/Skills/rnoh-cptf-api-test/assets/CPTF_TEST_TEMPLATE.md +310 -0
  288. package/vendor/Server/Skills/rnoh-cptf-api-test/assets/DEMO_PAGE_TEMPLATE.md +303 -0
  289. package/vendor/Server/Skills/rnoh-cptf-api-test/references/CPTF_TEST_GENERATION_GUIDE.md +421 -0
  290. package/vendor/Server/Skills/rnoh-cptf-api-test/references/DEMO_GENERATION_GUIDE.md +358 -0
  291. package/vendor/Server/Skills/rnoh-cptf-api-test/references/QUALITY_CHECKLIST.md +114 -0
  292. package/vendor/Server/Skills/rnoh-cptf-api-test/references/SPEC_PARSING_GUIDE.md +274 -0
  293. package/vendor/Server/Skills/rnoh-cptf-api-test/scripts/validate-rnoh-cptf-api-test.sh +185 -0
  294. package/vendor/Server/Skills/rnoh-cptf-demo-test/SKILL.md +191 -0
  295. package/vendor/Server/Skills/rnoh-cptf-demo-test/assets/TEST_TEMPLATE.md +216 -0
  296. package/vendor/Server/Skills/rnoh-cptf-demo-test/references/CPTF_SETUP.md +107 -0
  297. package/vendor/Server/Skills/rnoh-cptf-demo-test/references/DEMO_ANALYSIS.md +120 -0
  298. package/vendor/Server/Skills/rnoh-cptf-demo-test/scripts/validate-rnoh-cptf-test.sh +108 -0
  299. package/vendor/Server/Skills/rnoh-cptf-test-run/SKILL.md +237 -0
  300. package/vendor/Server/Skills/rnoh-cptf-test-run/references/DEBUG_PLAYBOOK.md +261 -0
  301. package/vendor/Server/Skills/rnoh-cptf-test-run/scripts/validate-run-env.sh +112 -0
  302. package/vendor/Server/Skills/rnoh-lib-code-adapt/SKILL.md +498 -0
  303. package/vendor/Server/Skills/rnoh-lib-code-adapt/references/adapt-checklist.md +270 -0
  304. package/vendor/Server/Skills/rnoh-lib-code-adapt/references/api-migration-checklist.md +164 -0
  305. package/vendor/Server/Skills/rnoh-lib-code-adapt/references/common-compile-errors.md +556 -0
  306. package/vendor/Server/Skills/rnoh-lib-code-adapt/references/deveco-cli-tools.md +459 -0
  307. package/vendor/Server/Skills/rnoh-lib-code-adapt/references/edge-cases.md +65 -0
  308. package/vendor/Server/Skills/rnoh-lib-code-adapt/references/har-tgz-build.md +512 -0
  309. package/vendor/Server/Skills/rnoh-lib-code-adapt/references/version-compat-matrix.md +132 -0
  310. package/vendor/Server/Skills/rnoh-lib-code-adapt/scripts/auto-integrate.sh +424 -0
  311. package/vendor/Server/Skills/rnoh-lib-demo-coverage/SKILL.md +137 -0
  312. package/vendor/Server/Skills/rnoh-lib-demo-create/SKILL.md +306 -0
  313. package/vendor/Server/Skills/rnoh-lib-demo-create/assets/DEMO_PAGE_TEMPLATE.md +485 -0
  314. package/vendor/Server/Skills/rnoh-lib-demo-create/assets/INDEX_TEMPLATE.md +172 -0
  315. package/vendor/Server/Skills/rnoh-lib-demo-create/references/DEMO_CODE_RULES.md +422 -0
  316. package/vendor/Server/Skills/rnoh-lib-demo-create/references/QUALITY_CHECKLIST.md +95 -0
  317. package/vendor/Server/Skills/rnoh-lib-demo-create/references/SOURCE_EXPLORATION.md +169 -0
  318. package/vendor/Server/Skills/rnoh-lib-demo-doc/SKILL.md +554 -0
  319. package/vendor/Server/Skills/rnoh-lib-demo-doc/assets/DEMO_DOC_TEMPLATE.md +106 -0
  320. package/vendor/Server/Skills/rnoh-lib-demo-doc/references/COVERAGE_INCREMENTAL.md +216 -0
  321. package/vendor/Server/Skills/rnoh-lib-demo-doc/references/DEMO_DESIGN_RULES.md +413 -0
  322. package/vendor/Server/Skills/rnoh-lib-demo-doc/references/OUTPUT_FORMAT.md +269 -0
  323. package/vendor/Server/Skills/rnoh-lib-demo-doc/references/QUALITY_CHECKLIST.md +98 -0
  324. package/vendor/Server/Skills/rnoh-lib-func-test/SKILL.md +337 -0
  325. package/vendor/Server/Skills/rnoh-lib-rnt-search/SKILL.md +722 -0
  326. package/vendor/Server/Skills/rnoh-lib-rnt-search/assets/PORT_REPORT_TEMPLATE.md +219 -0
  327. package/vendor/Server/Skills/rnoh-lib-rnt-search/references/DEMO_PORTING_GUIDE.md +345 -0
  328. package/vendor/Server/Skills/rnoh-lib-rnt-search/references/PORT_VERIFICATION.md +269 -0
  329. package/vendor/Server/Skills/rnoh-lib-rnt-search/references/RNT_PROJECT_STRUCTURE.md +173 -0
  330. package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/analyze-demo-deps.cjs +267 -0
  331. package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/detect-rnoh-version.cjs +174 -0
  332. package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/find-rnt-demo.sh +111 -0
  333. package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/port-demo.sh +186 -0
  334. package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/read-lib-meta.cjs +150 -0
  335. package/vendor/Server/Skills/rnoh-lib-test-align/SKILL.md +296 -0
  336. package/vendor/Server/Skills/rnoh-lib-test-align/references/jest-troubleshooting.md +371 -0
  337. package/vendor/Server/Skills/rnoh-lib-test-align/references/port-test-demo-guide.md +212 -0
  338. package/vendor/Server/Skills/rnoh-lib-test-align/references/runtime-troubleshooting.md +345 -0
  339. package/vendor/Server/Skills/rnoh-lib-test-align/references/unit-test-template.md +223 -0
  340. package/vendor/Server/Skills/rnoh-lib-test-align/scripts/port-test-demo.sh +1053 -0
  341. package/vendor/Server/Skills/rnoh-lib-version-diff/SKILL.md +255 -0
  342. package/vendor/Server/Skills/rnoh-lib-version-diff/references/OHOS_ADAPTATION.md +77 -0
  343. package/vendor/Server/Skills/rnoh-lib-version-diff/references/OHOS_API_LOOKUP.md +224 -0
  344. package/vendor/Server/Skills/rnoh-lib-version-diff/references/script-reference.md +174 -0
  345. package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/detect-upstream-version.js +967 -0
  346. package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/generate-diff.js +1798 -0
  347. package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/package.json +5 -0
  348. package/vendor/Server/Skills/rnoh-lib-version-diff/templates/report-template.md +137 -0
  349. package/vendor/Server/Skills/rnoh-lib-xts-coverage/SKILL.md +145 -0
  350. package/vendor/Server/Skills/skill-generator/SKILL.md +365 -0
  351. package/vendor/Server/Skills/skill-generator/assets/SKILL_TEMPLATE.md +183 -0
  352. package/vendor/Server/Skills/skill-generator/references/COMPLIANCE_CHECKLIST.md +82 -0
  353. package/vendor/Server/Skills/skill-generator/references/KB_QUERY_GUIDE.md +110 -0
  354. package/vendor/Server/Skills/skill-generator/references/MCP_TOOL_DISCOVERY.md +122 -0
  355. package/vendor/Server/Skills/skill-generator/references/SKILL_SPEC.md +121 -0
  356. package/vendor/Server/Skills/skill-generator/scripts/validate-skill.cjs +259 -0
  357. package/vendor/Server/Skills/task-analysis/SKILL.md +234 -0
  358. package/vendor/Server/Skills/task-analysis/assets/OUTPUT_EXAMPLES.md +160 -0
  359. package/vendor/Server/Skills/task-analysis/references/ACCEPTANCE_CRITERIA_GUIDE.md +190 -0
  360. package/vendor/Server/Skills/task-analysis/references/ANALYSIS_SCHEMA.md +224 -0
  361. package/vendor/Server/Skills/task-analysis/references/INTEGRATION_CONTEXT.md +162 -0
  362. package/vendor/Server/Skills/task-analysis/references/LESSONS_LEARNED.md +55 -0
  363. package/vendor/Server/Skills/task-analysis/references/REPLAN_CONTEXT_GUIDE.md +126 -0
  364. package/vendor/Server/Skills/task-analysis/scripts/validate-analysis-output.sh +256 -0
  365. package/vendor/Server/Skills/task-decomposition/SKILL.md +529 -0
  366. package/vendor/Server/Skills/task-decomposition/assets/OUTPUT_EXAMPLES.md +451 -0
  367. package/vendor/Server/Skills/task-decomposition/references/ACCEPTANCE_CRITERIA_GUIDE.md +179 -0
  368. package/vendor/Server/Skills/task-decomposition/references/DEPENDENCY_GRAPH_GUIDE.md +152 -0
  369. package/vendor/Server/Skills/task-decomposition/references/INTEGRATION_CONTEXT.md +175 -0
  370. package/vendor/Server/Skills/task-decomposition/references/REPLAN_CONTEXT_GUIDE.md +195 -0
  371. package/vendor/Server/Skills/task-decomposition/references/TASK_DECOMPOSITION_TEMPLATES.md +226 -0
  372. package/vendor/Server/Skills/task-decomposition/scripts/list-available-skills.cjs +263 -0
  373. package/vendor/Server/Skills/task-decomposition/scripts/skill-blacklist.json +29 -0
  374. package/vendor/Server/Skills/task-decomposition/scripts/validate-decomposition-output.cjs +376 -0
  375. package/vendor/Server/Skills/task-decomposition/scripts/validate-param-consistency.cjs +259 -0
  376. package/vendor/Server/Skills/task-decomposition/scripts/validate-specified-skills.cjs +216 -0
  377. package/vendor/Server/Skills/task-decomposition/scripts/validate-step-graph.cjs +425 -0
  378. package/vendor/Server/Skills/tpc-cpp-check/SKILL.md +427 -0
  379. package/vendor/Server/Skills/tpc-cpp-check/references/CHECKLIST.md +214 -0
  380. package/vendor/Server/Skills/tpc-cpp-check/references/HPKBUILD_GUIDE.md +235 -0
  381. package/vendor/Server/Skills/tpc-cpp-check/references/REPORT_TEMPLATE.md +250 -0
  382. package/vendor/Server/TestCheck/TestCheck.js +775 -0
  383. package/vendor/Server/TestCheck/index.js +11 -0
  384. package/vendor/Server/library/McpToolGuide.js +280 -0
  385. package/vendor/Server/library/StatsService.js +127 -0
  386. package/vendor/Server/library/cstTime.js +16 -0
  387. package/vendor/Server/package.json +17 -0
  388. package/vendor/VERSION +3 -0
  389. package/workflows/pr-check.mjs +106 -0
@@ -0,0 +1,221 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * precheck-access-modifiers.cjs — 库源码 private/protected 成员扫描脚本
4
+ *
5
+ * 背景:
6
+ * 接口规格文档(interface-spec.md)列出所有类的方法和属性,但不包含访问修饰符
7
+ * (private/protected/public)。代码生成时若直接调用 private/protected 成员,
8
+ * ArkTS 编译会报 "Property 'X' is private and only accessible within class" 错误。
9
+ * 本脚本在代码生成之前扫描库源码,提取 private/protected 成员列表,供生成阶段
10
+ * 预先排除直接调用,跳过这些成员的用例。
11
+ *
12
+ * 用法:
13
+ * node precheck-access-modifiers.cjs --source <工程根> [--libDir <库源码相对路径>]
14
+ *
15
+ * 示例:
16
+ * node precheck-access-modifiers.cjs --source D:/proj/ohos_dataorm
17
+ * node precheck-access-modifiers.cjs --source D:/proj/ohos_dataorm --libDir library/src/main/ets
18
+ *
19
+ * 输出:
20
+ * 1. stdout: JSON 格式的 private/protected 成员列表
21
+ * 2. 文件: <工程根>/precheck-access-modifiers.json
22
+ *
23
+ * 退出码:
24
+ * 0 — 扫描成功
25
+ * 1 — 参数错误或源码目录不存在
26
+ */
27
+
28
+ 'use strict';
29
+
30
+ const fs = require('fs');
31
+ const path = require('path');
32
+
33
+ // ── 参数解析 ──────────────────────────────────────────────────
34
+
35
+ function parseArgs() {
36
+ const args = process.argv.slice(2);
37
+ const opts = { source: '', libDir: 'library/src/main/ets' };
38
+ for (let i = 0; i < args.length; i++) {
39
+ if (args[i] === '--source' && args[i + 1]) {
40
+ opts.source = args[i + 1];
41
+ i++;
42
+ } else if (args[i] === '--libDir' && args[i + 1]) {
43
+ opts.libDir = args[i + 1];
44
+ i++;
45
+ } else if (args[i] === '--help' || args[i] === '-h') {
46
+ console.log('Usage: node precheck-access-modifiers.cjs --source <工程根> [--libDir <库源码相对路径>]');
47
+ process.exit(0);
48
+ }
49
+ }
50
+ if (!opts.source) {
51
+ console.error('[precheck] 错误: --source 参数必填');
52
+ process.exit(1);
53
+ }
54
+ return opts;
55
+ }
56
+
57
+ // ── 递归扫描 .ts/.ets 文件 ────────────────────────────────────
58
+
59
+ function scanFiles(dir, exts, results) {
60
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
61
+ for (const entry of entries) {
62
+ const fullPath = path.join(dir, entry.name);
63
+ if (entry.isDirectory()) {
64
+ // 跳过 node_modules、oh_modules、build 等目录
65
+ if (['node_modules', 'oh_modules', 'build', '.git', 'test'].includes(entry.name)) continue;
66
+ scanFiles(fullPath, exts, results);
67
+ } else if (entry.isFile()) {
68
+ const ext = path.extname(entry.name);
69
+ if (exts.includes(ext)) {
70
+ results.push(fullPath);
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ // ── 解析单个文件的 private/protected 成员 ─────────────────────
77
+
78
+ function parseAccessModifiers(filePath) {
79
+ const content = fs.readFileSync(filePath, 'utf-8');
80
+ const lines = content.split('\n');
81
+ const members = [];
82
+ let currentClass = '';
83
+
84
+ for (let i = 0; i < lines.length; i++) {
85
+ const line = lines[i];
86
+ const trimmed = line.trim();
87
+
88
+ // 匹配 class 声明
89
+ const classMatch = trimmed.match(/^(?:export\s+)?(?:abstract\s+)?class\s+(\w+)/);
90
+ if (classMatch) {
91
+ currentClass = classMatch[1];
92
+ continue;
93
+ }
94
+
95
+ // 匹配 private/protected 属性
96
+ // 格式: private static readonly X: type = value;
97
+ // 格式: protected config: DaoConfig;
98
+ const propMatch = trimmed.match(/^(private|protected)\s+(?:static\s+)?(?:readonly\s+)?(\w+)\s*(?:[:?]|=)/);
99
+ if (propMatch && currentClass) {
100
+ members.push({
101
+ class: currentClass,
102
+ member: propMatch[2],
103
+ modifier: propMatch[1],
104
+ kind: 'property',
105
+ file: path.basename(filePath),
106
+ line: i + 1
107
+ });
108
+ continue;
109
+ }
110
+
111
+ // 匹配 private/protected 方法
112
+ // 格式: private async executeInsert(...): Promise<...> {
113
+ // 格式: protected loadUnique(cursor: any): T {
114
+ const methodMatch = trimmed.match(/^(private|protected)\s+(?:async\s+)?(?:static\s+)?(\w+)\s*\(/);
115
+ if (methodMatch && currentClass) {
116
+ members.push({
117
+ class: currentClass,
118
+ member: methodMatch[2],
119
+ modifier: methodMatch[1],
120
+ kind: 'method',
121
+ file: path.basename(filePath),
122
+ line: i + 1
123
+ });
124
+ continue;
125
+ }
126
+
127
+ // 匹配 private/protected constructor
128
+ const ctorMatch = trimmed.match(/^(private|protected)\s+constructor\s*\(/);
129
+ if (ctorMatch && currentClass) {
130
+ members.push({
131
+ class: currentClass,
132
+ member: 'constructor',
133
+ modifier: ctorMatch[1],
134
+ kind: 'constructor',
135
+ file: path.basename(filePath),
136
+ line: i + 1
137
+ });
138
+ continue;
139
+ }
140
+ }
141
+
142
+ return members;
143
+ }
144
+
145
+ // ── 主流程 ────────────────────────────────────────────────────
146
+
147
+ function main() {
148
+ const opts = parseArgs();
149
+ const libRoot = path.resolve(opts.source, opts.libDir);
150
+
151
+ if (!fs.existsSync(libRoot)) {
152
+ console.error(`[precheck] 错误: 库源码目录不存在: ${libRoot}`);
153
+ process.exit(1);
154
+ }
155
+
156
+ console.log(`[precheck] 扫描库源码: ${libRoot}`);
157
+
158
+ // 递归扫描所有 .ts 和 .ets 文件
159
+ const files = [];
160
+ scanFiles(libRoot, ['.ts', '.ets'], files);
161
+
162
+ console.log(`[precheck] 扫描 ${files.length} 个源文件`);
163
+
164
+ // 解析每个文件的 private/protected 成员
165
+ const allMembers = [];
166
+ for (const file of files) {
167
+ const members = parseAccessModifiers(file);
168
+ allMembers.push(...members);
169
+ }
170
+
171
+ // 按类分组
172
+ const byClass = {};
173
+ for (const m of allMembers) {
174
+ if (!byClass[m.class]) {
175
+ byClass[m.class] = { properties: [], methods: [] };
176
+ }
177
+ if (m.kind === 'property') {
178
+ byClass[m.class].properties.push(m);
179
+ } else {
180
+ byClass[m.class].methods.push(m);
181
+ }
182
+ }
183
+
184
+ // 输出统计
185
+ const totalProps = allMembers.filter(m => m.kind === 'property').length;
186
+ const totalMethods = allMembers.filter(m => m.kind === 'method').length;
187
+ const classCount = Object.keys(byClass).length;
188
+
189
+ console.log(`[precheck] 发现 ${classCount} 个类,${totalProps} 个 private/protected 属性,${totalMethods} 个 private/protected 方法`);
190
+
191
+ // 输出每个类的成员列表
192
+ for (const [cls, members] of Object.entries(byClass)) {
193
+ console.log(`[precheck] ${cls}: ${members.properties.length} 属性, ${members.methods.length} 方法`);
194
+ }
195
+
196
+ // 生成输出 JSON
197
+ const output = {
198
+ scanTime: new Date().toISOString(),
199
+ sourcePath: opts.source,
200
+ libDir: opts.libDir,
201
+ fileCount: files.length,
202
+ classCount,
203
+ totalPrivateProtected: allMembers.length,
204
+ summary: {
205
+ properties: totalProps,
206
+ methods: totalMethods,
207
+ constructors: allMembers.filter(m => m.kind === 'constructor').length
208
+ },
209
+ classes: byClass
210
+ };
211
+
212
+ // 写入 JSON 文件
213
+ const outputPath = path.join(opts.source, 'precheck-access-modifiers.json');
214
+ fs.writeFileSync(outputPath, JSON.stringify(output, null, 2), 'utf-8');
215
+ console.log(`[precheck] 报告已写入: ${outputPath}`);
216
+
217
+ // stdout 输出 JSON 供调用方读取
218
+ console.log('\n' + JSON.stringify(output, null, 2));
219
+ }
220
+
221
+ main();
@@ -0,0 +1,229 @@
1
+ ---
2
+ name: arkts-library-xts-code-fix
3
+ description: 依据失败报告修正有缺陷的 XTS 测试用例代码,使其通过编译与执行验证。Use when 已有待修复的测试代码和下游失败报告,需要根据失败原因针对性修正。本技能只纠错,不创作新用例。
4
+ license: Apache-2.0
5
+ metadata:
6
+ version: "1.0.0"
7
+ category: ohos-testing
8
+ language: ArkTS/ETS
9
+ ---
10
+
11
+ # ArkTS XTS 测试用例代码纠错
12
+
13
+ 本 Skill 用于**修正有缺陷的 XTS 测试用例代码**(`.test.ets`),使其通过编译并在设备上执行通过。它与"创作新用例"(`arkts-library-xts-code`)职责分离:本 Skill 的输入是**已有待修正的测试代码 + 下游失败报告**,输出是**修正后的测试代码 + 纠错报告**。
14
+
15
+ > ⚠️ **核心约束**:
16
+ > 1. **职责边界**:只修正"本次写入的测试代码",不改源库业务逻辑、不改源库源码(`library/`、`entry/src/main/ets/pages/` 等)
17
+ > 2. **代码归属识别**:必须能区分"哪些测试代码是本次写入的、哪些是源库原有的",只改本次写入的
18
+ > 3. **失败来源分类**:先判断失败是"测试代码缺陷"还是"源库构建问题"还是"环境/设备问题",只修复可修复项
19
+ > 4. 修正后必须重新编译验证,输出 `## 执行状态` 字段(`成功` / `失败`)供编排器判断
20
+
21
+ ---
22
+
23
+ ## 适用场景
24
+
25
+ - XTS 测试执行步骤(`ArkTsLibraryXTSExecutionSkill`)失败后,通过 `failStepId` 回到本步骤修复测试代码
26
+ - 编译失败且错误定位在测试代码(`entry/src/ohosTest/ets/test/*.test.ets`)
27
+ - 测试执行发现断言不匹配(fail)或运行时异常(error),需修正测试代码
28
+
29
+ ---
30
+
31
+ ## 任务参数
32
+
33
+ | 参数 | 必需 | 说明 |
34
+ |------|------|------|
35
+ | `sourcePath` | ✅ | 目标鸿蒙工程根目录(含 `entry/` 和测试模块) |
36
+ | `outputDir` | ✅ | 输出目录(XTS 用例文档、覆盖率报告、执行报告所在目录) |
37
+ | `inputReportPath` | ✅ | **下游失败报告路径**(由编排器通过 `## 输入报告路径` 注入,通常是执行报告 `arktscoverage-xts-exec-report.md` 或编译失败日志) |
38
+ | `xtsDocPath` | 可选 | XTS 用例描述文档路径;若未提供,从 `outputDir` 搜索 `*XTS用例描述*.md` 或 `arktscoverage-xts-doc.md` |
39
+
40
+ > 本 Skill 依赖的规范与脚本(`CODE_STANDARDS.md`、`XTS_TEMPLATE.md`、`build.ps1`、`migrate.cjs`)位于生成代码技能 `arkts-library-xts-code` 目录下,本目录通过 `references/` 与 `scripts/` 以**相对引用**方式复用,避免重复维护。若 `{{skillDir}}` 指向本目录且其中缺少某文件,请到 `{{skillDir}}/../../arkts-library-xts-code/` 下查找。
41
+
42
+ ---
43
+
44
+ ## 工作流程
45
+
46
+ ### 0. 前置准备:梳理上下文
47
+
48
+ 开始修复前,先建立对当前状态的完整认知:
49
+
50
+ 1. **读取失败报告**:`read_file` `{{inputReportPath}}`(即 `## 输入报告路径`),完整解析:
51
+ - 报告状态:`成功` / `部分通过` / `源库构建问题` / `环境不可用` / `设备不可用`
52
+ - 编译结果:`成功` / `失败(修复N轮后)` / `环境不可用`
53
+ - 测试结果统计:总数 / 通过 / 失败(fail)/ 错误(error)
54
+ - 失败/错误用例清单及原因分析
55
+ - 源库问题诊断表(依赖缺失 / SDK 版本 / 类型错误等)
56
+
57
+ 2. **识别本次生成的测试代码**(代码归属识别的关键步骤):
58
+ - `glob` `{{sourcePath}}/entry/src/ohosTest/ets/test/*.test.ets` 列出所有测试文件
59
+ - 排除 `List.test.ets`(入口文件)
60
+ - 用 `git status` / `git diff --name-only` 找出**未提交/新修改**的 `.test.ets` 文件 = 本次生成的
61
+ - 若无 git 仓库,根据文件时间戳 + 名称模式(`{LibraryName}XtsTest.test.ets`)识别
62
+ - `read_file` 生成时留下的报告(`arktscoverage-xts-code-report.md`)确认"生成测试文件"清单
63
+ - **只修改确认属于本次生成的测试文件**,源库已有的测试文件原则上不动
64
+
65
+ 3. **读取测试代码**:`read_file` 本次生成的 `.test.ets` 全文,理解现有断言与接口调用。
66
+
67
+ 4. **读取接口规格**:`read_file`(`interfaceSpecPath` 或从 `outputDir` 搜索 `arktscoverage-interface-spec.md`),用于核对接口签名、类型、返回值守卫。
68
+
69
+ ---
70
+
71
+ ### 1. 失败分类与修复决策
72
+
73
+ 根据失败报告,将失败归入以下类别,决定是否修复:
74
+
75
+ | 失败类别 | 判定依据 | 是否本次可修复 | 修复动作 |
76
+ |---------|---------|--------------|---------|
77
+ | **编译错误(测试代码)** | 错误路径在 `entry/src/ohosTest/ets/test/*.test.ets` | ✅ | 对照规范修复(见步骤 2) |
78
+ | **编译错误(源库)** | 错误路径在 `library/`、`CMakeLists.txt`、`build-profile.json5` 等 | ⚠️ 仅机械性 | 仅修 SDK 版本、依赖、构建配置;不改业务逻辑 |
79
+ | **断言不匹配(fail)** | 报告中 `Failure: F`,`fail` = 断言不匹配 | ✅ | 修正期望值 / 断言逻辑(见步骤 4) |
80
+ | **运行时异常(error)** | 报告中 `Error: E`,`error` = 运行时异常 | ✅(测试代码引起) | 修正调用方式 / 状态管理 / 异步处理 |
81
+ | **源库不可修复** | 连续 2 轮均为源库不可修复错误 | ❌ | 不修复,报告中标注"需源库作者修复" |
82
+ | **环境/设备不可用** | `环境不可用` / `设备不可用` | ❌ | 不修复,报告中标注,任务状态为"完成"(非失败) |
83
+
84
+ **关键判定**:只有当失败**可归因于本次生成的测试代码**且**可修复**时,本 Skill 才真正修改代码并重新编译。若失败为源库问题或环境问题,本 Skill 不做无效修复,直接输出报告并标记 `## 执行状态: 成功`(因为不是测试代码的缺陷),并在报告中说明。
85
+
86
+ ---
87
+
88
+ ### 2. 修复编译错误(测试代码)
89
+
90
+ 错误定位在 `entry/src/ohosTest/ets/test/*.test.ets` 时的修复策略,对照规范表逐条修复:
91
+
92
+ | 错误类型 | 修复方式 |
93
+ |---------|---------|
94
+ | `arkts-no-any` | 定义具体类型或 interface |
95
+ | `arkts-no-esobj` | 定义命名 interface |
96
+ | `arkts-no-unsafe-cast` | 正确定义类型,避免双重 `as unknown as` |
97
+ | `arkts-no-dynamic-property` | 改用类型安全访问 `obj.key` |
98
+ | `arkts-limited-throw` | catch 中禁止 `throw e`,改用 try-catch + 布尔标记 |
99
+ | 接口签名/类型不匹配 | 对照接口规格文档 + 源码修正 |
100
+ | 导入路径错误 | 检查库导出入口 `Index.ets` 的实际路径 |
101
+ | `\| undefined` 返回值守卫 | 签名含 `\| undefined` 或 `?:` 的接口,访问属性前必须 `if (result)` 判空 |
102
+ | 缺少权限 | 在 ohosTest 的 `module.json5` 中声明 |
103
+ | 表外新错误 | 分析 → 修复 → 记录到本规范,供后续复用 |
104
+
105
+ > 完整规范参考生成代码技能的 [CODE_STANDARDS.md]({{skillDir}}/../../arkts-library-xts-code/references/CODE_STANDARDS.md)(二、八章节为 ArkTS 禁止项与编译错误修复表)。
106
+
107
+ ---
108
+
109
+ ### 3. 修复断言不匹配(fail)
110
+
111
+ `fail` 表示测试代码的**断言逻辑/期望值**与库实际行为不符。修复步骤:
112
+
113
+ 1. **复核期望值**:对照接口规格文档与实际运行逻辑,判断期望值是否正确
114
+ - **程序化数据期望值**:测试数据通过 `for` 循环、取余、映射生成时,期望值必须用表达式计算或手动计算后注释(如 `9999 % 256 = 15`),禁止从语义联想硬编码
115
+ 2. **复核断言 API**:确认使用 hypium 断言(`assertEqual`/`assertNull`/`assertTrue`/`assertFalse`/`assertLarger`/`assertContain`),**禁止** Jest 风格(`toBe`/`toEqual`/`toThrow`/`toBeTruthy`)
116
+ 3. **区分"测试错" vs "库行为"**:若期望值与库真实行为不符,且库行为是合理的,则修正测试期望值;若库行为本身有缺陷,标注"源库问题",不强制让测试通过
117
+ 4. **`toThrow()` 替代**:预期异常用 try-catch + 布尔标记模式
118
+
119
+ ---
120
+
121
+ ### 4. 修复运行时异常(error)
122
+
123
+ `error` 表示测试代码执行时抛出异常。常见原因与修复:
124
+
125
+ | 异常原因 | 修复方式 |
126
+ |---------|---------|
127
+ | **单例状态污染** | 库使用 `getInstance()` 单例时,断言状态前必须重置;用 `beforeEach`(而非 `beforeAll`)重置 |
128
+ | **异步未等待** | 同步方法内部委托异步方法时,测试必须 `async` + `await` |
129
+ | 空值/undefined 访问 | 访问返回值属性前判空,或用 null 检查 + `throw new Error()` |
130
+ | `@ObservedV2` + `@State` 冲突 | V2 装饰器类不能用于 V1 `@State`/`@Prop`/`@Link`,改用 `@Local`/`@Param` 或 `!!` 语法 |
131
+ | 组件名/类名不准确 | 与库 `Index.ets` 导出名逐字符一致,禁止自行追加后缀 |
132
+ | 沙箱路径不可访问 | 通过 `abilityDelegatorRegistry` 获取 `tempDir`/`filesDir`,禁止硬编码路径 |
133
+
134
+ ---
135
+
136
+ ### 5. 修复源库机械性问题(可选)
137
+
138
+ 若编译错误定位在源库且属于**机械性**问题,可修复(不改变业务逻辑):
139
+
140
+ | 错误类型 | 修复方式 | 可修复? |
141
+ |---------|---------|---------|
142
+ | SDK 版本不匹配 | 修正 `build-profile.json5` | ✅ |
143
+ | 依赖缺失(如 @ohos/hypium) | 补充 `oh-package.json5` | ✅ |
144
+ | CMake 选项冲突 | 修改 `externalNativeOptions` | ✅ |
145
+ | 源库 ArkTS 类型错误 | 修正类型注解/补充 @Observed | ⚠️ 仅机械性 |
146
+ | 源库业务逻辑错误 | 不修复,标注 | ❌ |
147
+
148
+ ---
149
+
150
+ ### 6. 重新编译验证
151
+
152
+ > 🔴 **必须通过 `build.ps1` 执行**,直接调用 `devecocli build` 会导致 session 永久阻塞。测试 HAP 构建需要 `-JavaHome` 参数。
153
+
154
+ 首次编译:
155
+ ```powershell
156
+ powershell -ExecutionPolicy Bypass -File "{{skillDir}}/../../arkts-library-xts-code/scripts/build.ps1" -Cmd "devecocli build clean"
157
+ powershell -ExecutionPolicy Bypass -File "{{skillDir}}/../../arkts-library-xts-code/scripts/build.ps1" -JavaHome -Cmd "devecocli build --modules entry@ohosTest"
158
+ ```
159
+
160
+ **修复循环(最多 5 轮)**:每轮逐条读取编译错误 → 按步骤 2/3/4 分类修复 → 重新编译。编译通过则进入步骤 7。
161
+
162
+ **终止判定**:连续 2 轮错误均为源库不可修复错误(❌ 行)→ 立即终止,标注"编译跳过原因 + 修复建议"。
163
+
164
+ ---
165
+
166
+ ### 7. 输出与总结
167
+
168
+ #### 7.1 输出文件
169
+
170
+ `write_file` `{{outputDir}}/arktscoverage-xts-code-fix-report.md`,内容:
171
+
172
+ ```markdown
173
+ # XTS 测试代码修复报告
174
+
175
+ ## 1. 修复概述
176
+ - 下游失败报告:{{inputReportPath}}
177
+ - 失败类别:{编译错误-测试代码 / 编译错误-源库 / 断言不匹配 / 运行时异常 / 源库不可修复 / 环境不可用}
178
+ - 修复的测试文件:{文件清单}
179
+
180
+ ## 2. 代码归属识别
181
+ - 本次生成的测试文件:{文件清单}
182
+ - 源库已有测试文件:{文件清单}
183
+ - 本次修改的文件:{文件清单}
184
+
185
+ ## 3. 失败根因与修复
186
+ | 失败位置 | 根因 | 修复动作 | 结果 |
187
+ |---------|------|---------|------|
188
+ | ... | ... | ... | ✅ / ❌ |
189
+
190
+ ## 4. 重新编译验证
191
+ {编译结果:通过 / 失败(X 轮修复后)}
192
+
193
+ ## 5. 未修复项
194
+ - 源库不可修复错误 → 标注"需源库作者修复"
195
+ - 环境/设备问题 → 标注"环境不可用/设备不可用"
196
+
197
+ ---
198
+ 状态: {成功 / 部分通过 / 源库构建问题 / 环境不可用 / 设备不可用}
199
+ ```
200
+
201
+ #### 7.2 结果文件
202
+
203
+ 在 `## 结果文件输出路径` 指定的文件中写入并包含:
204
+
205
+ ```
206
+ ## 执行状态
207
+ 成功
208
+ ```
209
+
210
+ > 只有当"本次生成的测试代码已修复且编译通过"、或"失败可归因为源库/环境问题"时,才标记 `成功`。若测试代码存在无法修复的错误,标记 `失败`,让编排器走终止逻辑。
211
+
212
+ ---
213
+
214
+ ## 设计原则
215
+
216
+ - **职责单一**:只修复,不生成新用例;生成新用例由 `arkts-library-xts-code` 负责
217
+ - **代码归属第一**:先识别"哪些是我生成的",只改自己的代码,避免污染源库
218
+ - **失败归因**:先判断失败来源(测试代码 / 源库 / 环境),只修复可修复项,不为源库问题担责
219
+ - **规范复用**:编译规范与脚本复用生成代码技能,避免规则漂移
220
+
221
+ ---
222
+
223
+ ## 参考文档
224
+
225
+ | 文档 | 内容说明 |
226
+ |------|---------|
227
+ | [CODE_STANDARDS.md](../arkts-library-xts-code/references/CODE_STANDARDS.md) | 编码规范完整参考:ArkTS 禁止项、hypium 断言、编译错误修复、测试隔离、期望值验证 |
228
+ | [XTS_TEMPLATE.md](../arkts-library-xts-code/references/XTS_TEMPLATE.md) | 各类型测试函数模板(修复时参考正确写法) |
229
+ | [error-fixing-examples.md](../ArkTsLibraryXTSExecutionSkill/references/error-fixing-examples.md) | 编译错误修复示例(执行技能诊断参考) |
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: arkts-library-xts-coverage
3
+ description: 分析鸿蒙ArkTs原生库现有 XTS 测试用例对接口的覆盖情况。通过 analyze-xts-coverage.cjs 脚本一步完成接口提取、覆盖率匹配和 Markdown 报告生成。当需要对鸿蒙ArkTs原生库的 XTS 测试用例进行接口覆盖率分析时调用。
4
+ license: Apache-2.0
5
+ compatibility: 需要Node.js运行环境
6
+ metadata:
7
+ version: "1.1.0"
8
+ category: ohos-testing
9
+ language: ArkTS/ETS
10
+ ---
11
+
12
+ # 鸿蒙ArkTs原生库 XTS 接口覆盖率分析
13
+
14
+ 通过 `analyze-xts-coverage.cjs` 脚本一步完成接口提取、XTS 覆盖率匹配和 Markdown 报告生成,无需中间文件。
15
+
16
+ > ⚠️ **核心约束**:基于静态 import 和接口调用分析,动态调用(`obj[methodName]()`)无法识别。
17
+
18
+ ---
19
+
20
+ ## 任务参数
21
+
22
+ | 参数 | 类型 | 必填 | 说明 |
23
+ |------|------|------|------|
24
+ | `libroot` | string | ✅* | 库源码根目录路径(含 `library/` 和 `entry/src/ohosTest/`) |
25
+ | `spec` | string | ✅* | 已有的 interface-spec.json 路径(与 `libroot` 二选一) |
26
+ | `output` | string | ❌ | 输出 Markdown 报告路径,默认 `03-{库名}-XTS覆盖率报告.md` |
27
+ | `title` | string | ❌ | 报告标题 |
28
+ | `mode` | string | ❌ | 匹配模式: `auto`(默认) \| `ast` \| `regex` |
29
+ | `lib` | string | ❌ | 库名覆盖,默认从 spec 或源码中读取 |
30
+
31
+ > `libroot` 与 `spec` 至少提供一个。提供 `spec` 时跳过接口提取步骤直接使用;仅提供 `libroot` 时脚本自动从源码提取接口。
32
+
33
+ ---
34
+
35
+ ## 执行命令
36
+
37
+ ```bash
38
+ node "{{workspaceRoot}}/MCP/scripts/analyze-xts-coverage.cjs" --libroot "{{libroot}}" [--output "{{output}}"] [--title "{{title}}"] [--mode auto|ast|regex] [--lib "{{库名}}"]
39
+ ```
40
+
41
+ 或从已有 interface-spec.json 生成:
42
+
43
+ ```bash
44
+ node "{{workspaceRoot}}/MCP/scripts/analyze-xts-coverage.cjs" --spec "{{spec}}" --libroot "{{libroot}}" [--output "{{output}}"]
45
+ ```
46
+
47
+ 其中 `{{workspaceRoot}}` = `3rdLibraryLoop` 工作区根目录。
48
+
49
+ ---
50
+
51
+ ## 脚本自动完成
52
+
53
+ 1. 从 `library/` 源码提取接口规格(或读取 `--spec` 指定的 JSON)
54
+ 2. 递归扫描 `entry/src/ohosTest/` 下所有 `.ets` 和 `.ts` 测试文件
55
+ 3. 提取 `import { ... } from 'lib'` 语句(单行/多行/别名/混合导入,兼容深层路径导入 `@pkg/name/src/main/ets/.../ClassName`)
56
+ 4. AST/正则双层匹配:静态方法、实例方法(追踪变量声明)、链式调用、对象字面量属性
57
+ 5. 直接渲染输出 Markdown 覆盖率报告
58
+
59
+ ---
60
+
61
+ ## 库源码目录结构约定
62
+
63
+ ```
64
+ {{libroot}}/
65
+ ├── library/ ← 库源码(Index.ets 入口)
66
+ │ ├── Index.ets
67
+ │ ├── src/main/ets/
68
+ │ └── src/main/cpp/types/.../Index.d.ts ← Native .so 声明
69
+ └── entry/src/ohosTest/ ← XTS 测试源码(被分析的目录)
70
+ ```
71
+
72
+ ---
73
+
74
+ ## 输出
75
+
76
+ 生成 Markdown 报告,包含以下章节:
77
+ - **基本信息**:库名、源文件数、生成时间
78
+ - **覆盖率总览**:方法级覆盖率百分比、S/N/M 统计、进度条
79
+ - **按接口类型统计**:method/property/field/function/variable 分类别覆盖率
80
+ - **类级覆盖率**:按类分组的覆盖明细
81
+ - **未覆盖接口详情**:按类分组的未覆盖接口清单
82
+ - **已覆盖接口详情**:按类分组的已覆盖接口清单(含覆盖来源文件)
83
+ - **文件覆盖详情**:每个 XTS 测试文件覆盖的接口数和接口列表
84
+
85
+ ---
86
+
87
+ ## 注意事项
88
+
89
+ 1. **确定性**:所有计数和匹配由脚本完成,同一组输入必定产生相同输出
90
+ 2. **子目录排除**:自动排除扫描目录第一层的 `entryability/`、`model/`、`util/` 等子目录
91
+ 3. **构造函数和枚举**:已在接口提取阶段排除
92
+ 4. **动态调用限制**:`obj[methodName]()` 无法识别
93
+ 5. **模式选择**:`auto` 优先 AST 匹配(需 TypeScript 模块),失败时降级正则;`ast` 强制 AST;`regex` 强制正则
94
+ 6. **深层路径导入**:测试文件可能通过深层路径导入类(`import { X } from '@ohos/pkg/src/main/ets/.../X'`)而非包名导入,AST/正则匹配引擎与 AST 模块解析均已兼容
95
+ 7. **入口文件大小写**:macOS/Windows 大小写不敏感文件系统上库入口文件可能为 `Index.ets` 或 `index.ets`,脚本已做大小写归一;否则模块解析会静默失败,导致类型推断全面失效、实例方法类覆盖率全部为 0
96
+ 8. **结果合理性检查**:覆盖率 <5% 且测试代码总量 >500 行时脚本输出告警;此时必须先用 grep 盘点实例方法调用(`变量名.方法名(`)与静态方法调用(`类名.方法名(`)并按类对账,确认无匹配缺陷后再写入正式报告
97
+ 9. **`--lib` 慎用**:传入短名(如 `mp3agic`)会覆盖 spec/oh-package.json5 推断的真实包名(`@ohos/mp3agic`),导致 import 匹配条件全部失效;无特殊需要不要覆盖库名