@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,259 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @tool validate-skill
4
+ * @description 校验SKILL目录是否符合Agent Skills规范,检查frontmatter、结构、渐进式披露。跨平台(Windows/macOS/Linux),仅需 Node.js。
5
+ * @param skillDir: string - SKILL目录绝对路径
6
+ * @hidden
7
+ * validate-skill.cjs
8
+ *
9
+ * 用法:
10
+ * # CLI 模式
11
+ * node validate-skill.cjs /path/to/skill
12
+ *
13
+ * # MCP Gateway 模式(第一个参数为 JSON 字符串)
14
+ * node validate-skill.cjs '{"skillDir":"/path/to/skill"}'
15
+ */
16
+
17
+ 'use strict';
18
+
19
+ const fs = require('node:fs');
20
+ const path = require('node:path');
21
+
22
+ // ── 参数解析(兼容 MCP Gateway JSON 模式与 CLI 模式) ──────
23
+
24
+ function parseArgs(argv) {
25
+ if (argv.length === 0) return {};
26
+ const first = argv[0];
27
+ if (typeof first === 'string' && first.startsWith('{')) {
28
+ try { return JSON.parse(first); } catch (e) { return {}; }
29
+ }
30
+ return { skillDir: first };
31
+ }
32
+
33
+ // ── 输出统计 ─────────────────────────────────────────────
34
+
35
+ let PASS = 0;
36
+ let FAIL = 0;
37
+ let WARNINGS = 0;
38
+
39
+ function checkPass(msg) { console.log(` ✅ ${msg}`); PASS += 1; }
40
+ function checkFail(msg) { console.log(` ❌ ${msg}`); FAIL += 1; }
41
+ function checkWarn(msg) { console.log(` ⚠️ ${msg}`); WARNINGS += 1; }
42
+
43
+ // ── Frontmatter 解析 ─────────────────────────────────────
44
+
45
+ /**
46
+ * 解析 SKILL.md 的 frontmatter 与 body。
47
+ * 返回 { frontmatter: object|null, bodyLines: string[] }
48
+ */
49
+ function parseFrontmatter(content) {
50
+ const lines = content.split(/\r?\n/);
51
+ if (!lines[0] || lines[0].trim() !== '---') {
52
+ return { frontmatter: null, bodyLines: lines };
53
+ }
54
+ let end = -1;
55
+ for (let i = 1; i < lines.length; i++) {
56
+ if (lines[i].trim() === '---') { end = i; break; }
57
+ }
58
+ if (end === -1) {
59
+ return { frontmatter: null, bodyLines: lines };
60
+ }
61
+ const fmLines = lines.slice(1, end);
62
+ const fm = {};
63
+ let currentKey = null;
64
+ for (const line of fmLines) {
65
+ const m = line.match(/^([a-zA-Z_][\w-]*):\s*(.*)$/);
66
+ if (m) {
67
+ currentKey = m[1];
68
+ fm[currentKey] = m[2].trim();
69
+ } else if (currentKey && /^\s+\S/.test(line)) {
70
+ fm[currentKey] += '\n' + line.trim();
71
+ }
72
+ }
73
+ return { frontmatter: fm, bodyLines: lines.slice(end + 1) };
74
+ }
75
+
76
+ // ── 主流程 ───────────────────────────────────────────────
77
+
78
+ function main() {
79
+ const args = parseArgs(process.argv.slice(2));
80
+ const skillDir = args.skillDir || '';
81
+
82
+ if (!skillDir) {
83
+ console.log('Usage: node validate-skill.cjs <skillDir>');
84
+ console.log('Error: skillDir parameter is required');
85
+ process.exit(1);
86
+ }
87
+
88
+ if (!fs.existsSync(skillDir) || !fs.statSync(skillDir).isDirectory()) {
89
+ console.log(`Error: Directory does not exist: ${skillDir}`);
90
+ process.exit(1);
91
+ }
92
+
93
+ console.log('=== SKILL 规范校验 ===');
94
+ console.log(`目录: ${skillDir}`);
95
+ console.log('');
96
+
97
+ // ─── 1. SKILL.md 存在性 ───
98
+ console.log('--- 1. 文件结构检查 ---');
99
+ const skillFile = path.join(skillDir, 'SKILL.md');
100
+ if (fs.existsSync(skillFile) && fs.statSync(skillFile).isFile()) {
101
+ checkPass('SKILL.md 存在');
102
+ } else {
103
+ checkFail('SKILL.md 不存在');
104
+ console.log('无法继续校验,SKILL.md 是必需文件');
105
+ process.exit(1);
106
+ }
107
+
108
+ const content = fs.readFileSync(skillFile, 'utf-8');
109
+ const { frontmatter, bodyLines } = parseFrontmatter(content);
110
+
111
+ // ─── 2. Frontmatter 检查 ───
112
+ console.log('');
113
+ console.log('--- 2. Frontmatter 检查 ---');
114
+
115
+ if (frontmatter) {
116
+ checkPass('YAML frontmatter 存在');
117
+ } else {
118
+ checkFail('缺少 YAML frontmatter(文件应以 --- 开头并以 --- 结束头部)');
119
+ }
120
+
121
+ const nameField = frontmatter ? String(frontmatter.name || '') : '';
122
+ if (nameField) {
123
+ checkPass(`name 字段存在: ${nameField}`);
124
+
125
+ // name 字符集校验
126
+ if (/^[a-z0-9]+(-[a-z0-9]+)*$/.test(nameField)) {
127
+ checkPass('name 字符集合规(仅小写字母/数字/连字符)');
128
+ } else {
129
+ checkFail('name 字符集不合规:应仅含 a-z/0-9/-,不能首尾连字符或连续连字符');
130
+ }
131
+
132
+ // name 长度校验
133
+ const nameLen = nameField.length;
134
+ if (nameLen >= 1 && nameLen <= 64) {
135
+ checkPass(`name 长度合规 (${nameLen} 字符)`);
136
+ } else {
137
+ checkFail(`name 长度不合规:应在 1-64 字符之间(当前 ${nameLen})`);
138
+ }
139
+
140
+ // name 匹配目录名
141
+ const dirName = path.basename(path.resolve(skillDir));
142
+ if (nameField === dirName) {
143
+ checkPass(`name 匹配父目录名 (${dirName})`);
144
+ } else {
145
+ checkFail(`name 不匹配父目录名:name='${nameField}' vs 目录='${dirName}'`);
146
+ }
147
+ } else {
148
+ checkFail('name 字段缺失');
149
+ }
150
+
151
+ const descField = frontmatter ? String(frontmatter.description || '') : '';
152
+ if (descField) {
153
+ const descLen = descField.length;
154
+ if (descLen <= 1024) {
155
+ checkPass(`description 长度合规 (${descLen} 字符)`);
156
+ } else {
157
+ checkFail(`description 过长:应 ≤1024 字符(当前 ${descLen})`);
158
+ }
159
+ } else {
160
+ checkFail('description 字段缺失或为空');
161
+ }
162
+
163
+ if (frontmatter && frontmatter.license) {
164
+ checkPass('license 字段存在');
165
+ } else {
166
+ checkWarn('license 字段缺失(推荐添加)');
167
+ }
168
+
169
+ if (frontmatter && frontmatter.metadata) {
170
+ checkPass('metadata 字段存在');
171
+ } else {
172
+ checkWarn('metadata 字段缺失(推荐添加 author/version)');
173
+ }
174
+
175
+ // ─── 3. Body 检查 ───
176
+ console.log('');
177
+ console.log('--- 3. Body 内容检查 ---');
178
+
179
+ const bodyLineCount = bodyLines.length;
180
+ if (bodyLineCount <= 500) {
181
+ checkPass(`body 行数合规 (${bodyLineCount} 行, ≤500)`);
182
+ } else {
183
+ checkWarn(`body 行数较多 (${bodyLineCount} 行,推荐 < 500,考虑拆分到 references/)`);
184
+ }
185
+
186
+ if (/任务参数|## .*参数|\|\s*参数/.test(content)) {
187
+ checkPass('包含任务参数说明');
188
+ } else {
189
+ checkWarn('未找到任务参数表(推荐添加)');
190
+ }
191
+
192
+ if (/工作流程|Phase|## Phase/.test(content)) {
193
+ checkPass('包含工作流程概览');
194
+ } else {
195
+ checkWarn('未找到工作流程概览(推荐添加)');
196
+ }
197
+
198
+ // ─── 4. 渐进式披露检查 ───
199
+ console.log('');
200
+ console.log('--- 4. 渐进式披露检查 ---');
201
+
202
+ const refsDir = path.join(skillDir, 'references');
203
+ if (fs.existsSync(refsDir) && fs.statSync(refsDir).isDirectory()) {
204
+ const refFiles = fs.readdirSync(refsDir)
205
+ .filter((f) => f.endsWith('.md') && fs.statSync(path.join(refsDir, f)).isFile());
206
+ checkPass(`references/ 目录存在 (${refFiles.length} 个文档)`);
207
+
208
+ // 检查引用深度(一层)
209
+ const nestedDirs = fs.readdirSync(refsDir, { withFileTypes: true })
210
+ .filter((d) => d.isDirectory()).length;
211
+ if (nestedDirs === 0) {
212
+ checkPass('references 保持一层深度');
213
+ } else {
214
+ checkFail(`references 存在嵌套子目录 (${nestedDirs} 个),应保持一层深度`);
215
+ }
216
+ } else {
217
+ checkWarn('无 references/ 目录(详细内容建议拆分到此目录)');
218
+ }
219
+
220
+ const assetsDir = path.join(skillDir, 'assets');
221
+ if (fs.existsSync(assetsDir) && fs.statSync(assetsDir).isDirectory()) {
222
+ checkPass('assets/ 目录存在');
223
+ } else {
224
+ checkWarn('无 assets/ 目录(如需模板/资源可添加)');
225
+ }
226
+
227
+ const scriptsDir = path.join(skillDir, 'scripts');
228
+ if (fs.existsSync(scriptsDir) && fs.statSync(scriptsDir).isDirectory()) {
229
+ checkPass('scripts/ 目录存在');
230
+ } else {
231
+ checkWarn('无 scripts/ 目录(如需可执行脚本可添加)');
232
+ }
233
+
234
+ // 检查文件引用使用相对路径
235
+ const absRefs = (content.match(/\]\(\/[^)]+\)/g) || []).length;
236
+ if (absRefs === 0) {
237
+ checkPass('文件引用使用相对路径');
238
+ } else {
239
+ checkFail(`发现 ${absRefs} 个绝对路径引用,应使用相对路径`);
240
+ }
241
+
242
+ // ─── 5. 总结 ───
243
+ console.log('');
244
+ console.log('=== 校验总结 ===');
245
+ console.log(` ✅ 通过: ${PASS}`);
246
+ console.log(` ❌ 失败: ${FAIL}`);
247
+ console.log(` ⚠️ 警告: ${WARNINGS}`);
248
+ console.log('');
249
+
250
+ if (FAIL === 0) {
251
+ console.log('ALL CHECKS PASSED');
252
+ process.exit(0);
253
+ } else {
254
+ console.log(`VALIDATION FAILED: ${FAIL} 个必须修复的问题`);
255
+ process.exit(1);
256
+ }
257
+ }
258
+
259
+ main();
@@ -0,0 +1,234 @@
1
+ ---
2
+ name: task-analysis
3
+ description: 分析自然语言任务描述,提取核心意图、领域、关键词、约束条件、技术栈,并生成结构化验收标准。当需要将一个高层任务描述拆解为意图分析与验收标准生成时使用此技能。适用于 AI Loop 系统中 Brain 模块的任务分析阶段,支持首轮分析与重规划场景。
4
+ license: Apache-2.0
5
+ compatibility: 由 Brain 模块通过 opencode CLI 调用(SkillExecutor),或降级为直接 LLM 调用。需要写入权限到任务工作目录,输出纯 JSON 格式分析结果。
6
+ metadata:
7
+ author: LoopEngine
8
+ version: "2.0.0"
9
+ category: task-planning
10
+ language: natural-language
11
+ invoked-by: AnalysisStrategies._analyzeViaCLI / _analyzeWithContextViaCLI
12
+ consumed-by: AnalysisStrategies.normalizeAnalysis → DecompositionStrategies → Brain.taskDef
13
+ ---
14
+
15
+ # 任务分析技能
16
+
17
+ 本技能通过 LLM 分析自然语言任务描述,提取任务的关键信息并生成结构化验收标准,为后续的任务拆解提供基础。
18
+
19
+ > ⚠️ **核心原则:分析结果必须包含可验证的验收标准,每条标准具体且可执行。输出必须为纯 JSON。**
20
+
21
+ ---
22
+
23
+ ## 调用方式
24
+
25
+ 本 SKILL 由 Brain 模块的 `AnalysisStrategies` 调用,通过 `SkillExecutor.invokeSkill` 执行:
26
+
27
+ - **首轮分析**:`AnalysisStrategies._analyzeViaCLI(taskDescription, userCriteria, ctx)`
28
+ - **重规划分析**:`AnalysisStrategies._analyzeWithContextViaCLI(taskDescription, userCriteria, context, ctx)`
29
+
30
+ 调用方会构建以下 prompt 段落传入:
31
+ - `## SKILL 目录` — 本 SKILL 目录路径(opencode 读取 SKILL.md 执行)
32
+ - `## 工作目录` — 任务工作目录
33
+ - `## 结果文件输出路径` — JSON 输出路径(`brain_analysis_loop{N}.json`)
34
+ - `## 任务描述` — 自然语言任务描述
35
+ - `## 用户提供的验收标准` 或 `## 验收标准`(未提供时自动生成)
36
+ - 重规划时额外注入:`## 重规划上下文` / `## 上一轮审核摘要` / `## 未满足的验收标准` / `## 改进建议` / `## 重分析要求`
37
+
38
+ > 完整调用链路与消费方式参见 [调用链路说明](references/INTEGRATION_CONTEXT.md)
39
+
40
+ ---
41
+
42
+ ## 任务参数
43
+
44
+ | 参数 | 类型 | 必填 | 说明 |
45
+ |------|------|------|------|
46
+ | `taskDescription` | string | ✅ | 自然语言任务描述(由调用方通过 prompt 注入) |
47
+ | `acceptanceCriteria` | string | ❌ | 用户提供的验收标准(自然语言),未提供时自动生成 |
48
+ | `workDir` | string | ✅ | 任务工作目录(由调用方指定) |
49
+ | `resultFilePath` | string | ✅ | 分析结果 JSON 输出路径(由调用方指定) |
50
+ | `context` | object | ❌ | 重规划上下文(仅重规划时提供,含 failedCriteria、improvementSuggestions、prevCheckSummary、loopCount 等) |
51
+
52
+ ---
53
+
54
+ ## 输入依赖
55
+
56
+ - **前置 SKILL**:无。作为任务拆解流程的第一步执行。
57
+ - **输入文件**:无(任务描述通过 prompt 注入)。
58
+ - **下游 SKILL**:`task-decomposition`(消费本 SKILL 的输出进行步骤拆解)。
59
+
60
+ ---
61
+
62
+ ## 工作流程概览
63
+
64
+ ```
65
+ Phase 1: 任务理解与上下文解析
66
+
67
+ Phase 2: 关键信息提取(intent/domain/keywords/constraints/techStack/complexity/estimatedSteps)
68
+
69
+ Phase 3: 验收标准生成(3-8 条,含 type 分类与 verification)
70
+
71
+ Phase 4: 结果输出(纯 JSON 写入 resultFilePath)
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Phase 1:任务理解与上下文解析
77
+
78
+ ### 1.1 解析任务描述
79
+
80
+ 读取 `## 任务描述` 段落,理解任务的核心目标和预期产出。提取:
81
+ - **核心目标**:任务要达成什么
82
+ - **预期产出**:最终交付什么(代码、文档、报告等)
83
+ - **领域线索**:技术领域、平台、语言等
84
+
85
+ ### 1.2 处理用户验收标准
86
+
87
+ 读取 `## 用户提供的验收标准` 段落(如果存在):
88
+ - 将用户自然语言标准作为基础
89
+ - 细化补充为结构化的验收标准(补全 type、verification 字段)
90
+ - 确保每条标准具体、可验证
91
+
92
+ 如果段落为 `## 验收标准`(未提供用户标准),则根据任务描述自动生成。
93
+
94
+ ### 1.3 处理重规划上下文(如果提供)
95
+
96
+ 如果 prompt 中包含 `## 重规划上下文` 段落,进入重规划模式:
97
+ - 读取 `## 未满足的验收标准` — 上一轮未通过的标准及其失败原因
98
+ - 读取 `## 改进建议` — 上一轮的改进方向
99
+ - 读取 `## 上一轮审核摘要` — 审核总结
100
+ - **保持原始任务目标不变**,仅调整策略和标准
101
+ - 分析失败原因,生成 `failureAnalysis` 字段
102
+ - 制定调整策略,生成 `adjustmentStrategy` 字段
103
+
104
+ > 详细处理流程参见 [重规划上下文处理指南](references/REPLAN_CONTEXT_GUIDE.md)
105
+
106
+ ---
107
+
108
+ ## Phase 2:关键信息提取
109
+
110
+ 提取以下字段:
111
+
112
+ | 字段 | 类型 | 说明 |
113
+ |------|------|------|
114
+ | `intent` | string | 任务核心意图(一句话概括,≤100 字符) |
115
+ | `domain` | string | 任务领域(kebab-case,如 `harmonyos-porting`、`code-quality`、`documentation`、`bug-fix`、`feature`、`refactoring`) |
116
+ | `keywords` | string[] | 关键词列表(用于后续 SKILL 匹配,≥1 个) |
117
+ | `constraints` | string[] | 约束条件列表 |
118
+ | `techStack` | string[] | 技术栈列表(≥1 个) |
119
+ | `complexity` | string | 复杂度:`low`(1-3步/单模块)/ `medium`(4-7步/2-3模块)/ `high`(8+步/跨系统) |
120
+ | `estimatedSteps` | number | 预估步骤数(≥1,供 task-decomposition SKILL 参考) |
121
+
122
+ ### 提取要点
123
+
124
+ - `keywords` 要包含技术名词、动作词、领域词,直接影响后续 SKILL 匹配准确性
125
+ - `techStack` 要完整列出所有涉及的技术栈,便于步骤拆解时匹配专用 SKILL
126
+ - `estimatedSteps` 应与 `complexity` 对应,重规划时可根据失败原因调整
127
+
128
+ > 完整字段规范参见 [输出 Schema](references/ANALYSIS_SCHEMA.md)
129
+
130
+ ---
131
+
132
+ ## Phase 3:验收标准生成
133
+
134
+ ### 3.1 生成原则
135
+
136
+ - **具体可验证**:每条标准必须能通过检查文件、执行命令或人工审查来判定 pass/fail
137
+ - **覆盖关键产出**:至少 1 条 `output` 类型 + 至少 1 条 `quality`/`compliance` 类型
138
+ - **数量合理**:3-8 条
139
+ - **避免模糊**:禁止"分析完成""代码质量好"等不可验证描述
140
+
141
+ ### 3.2 type 分类
142
+
143
+ | type | 说明 | 验证方式 |
144
+ |------|------|----------|
145
+ | `output` | 产物检查 — 文件/内容是否存在、是否完整 | 检查文件存在性、大小、格式 |
146
+ | `quality` | 质量要求 — 产物质量是否达标 | 内容审查、规则匹配 |
147
+ | `performance` | 性能指标 — 定量指标 | 执行命令获取数值 |
148
+ | `compliance` | 合规性 — 是否符合规范 | 规范比对、lint 检查 |
149
+
150
+ ### 3.3 每条标准必含字段
151
+
152
+ | 字段 | 必填 | 说明 |
153
+ |------|------|------|
154
+ | `id` | ✅ | 从 `ac1` 开始递增(ac1, ac2, ac3...) |
155
+ | `criterion` | ✅ | 具体标准描述,非空 |
156
+ | `type` | ✅ | `output`/`quality`/`performance`/`compliance` |
157
+ | `verification` | ✅ | 验证方式描述(具体到可执行命令或检查方法) |
158
+
159
+ ### 3.4 重规划时的额外处理
160
+
161
+ - 针对未满足标准调整验证方式(更明确)
162
+ - 补充新标准覆盖上轮遗漏维度
163
+ - 必须生成 `failureAnalysis` 和 `adjustmentStrategy` 字段
164
+
165
+ > 编写指南与示例参见 [验收标准编写指南](references/ACCEPTANCE_CRITERIA_GUIDE.md)
166
+
167
+ ---
168
+
169
+ ## Phase 4:结果输出
170
+
171
+ ### 4.1 输出文件
172
+
173
+ 将分析结果以 **纯 JSON** 格式写入 `## 结果文件输出路径` 指定的路径。
174
+
175
+ ### 4.2 JSON 结构(首轮)
176
+
177
+ ```json
178
+ {
179
+ "intent": "任务核心意图",
180
+ "domain": "任务领域",
181
+ "keywords": ["关键词1", "关键词2"],
182
+ "constraints": ["约束条件1"],
183
+ "techStack": ["技术栈1"],
184
+ "complexity": "low|medium|high",
185
+ "estimatedSteps": 3,
186
+ "acceptanceCriteria": [
187
+ {
188
+ "id": "ac1",
189
+ "criterion": "具体标准描述",
190
+ "type": "output|quality|performance|compliance",
191
+ "verification": "验证方式"
192
+ }
193
+ ]
194
+ }
195
+ ```
196
+
197
+ ### 4.3 重规划时额外字段
198
+
199
+ ```json
200
+ {
201
+ "failureAnalysis": "上一轮失败原因分析",
202
+ "adjustmentStrategy": "本轮调整策略"
203
+ }
204
+ ```
205
+
206
+ ### 4.4 输出规范
207
+
208
+ - ✅ 纯 JSON(无 markdown 代码块标记,无注释,无前后缀文字)
209
+ - ✅ 合法可解析格式
210
+ - ✅ 验收标准 `id` 从 `ac1` 递增
211
+ - ✅ 所有字符串字段非空
212
+
213
+ > 完整输出示例参见 [输出示例](assets/OUTPUT_EXAMPLES.md)
214
+
215
+ ---
216
+
217
+ ## 自检
218
+
219
+ 输出完成后,可运行校验脚本验证 JSON 合规性:
220
+
221
+ ```bash
222
+ bash scripts/validate-analysis-output.sh <resultFile>
223
+ ```
224
+
225
+ ---
226
+
227
+ ## 注意事项
228
+
229
+ 1. **不要修改任务目标** — `intent` 在重规划时保持不变,仅调整策略和标准
230
+ 2. **验收标准必须可验证** — 避免模糊描述,verification 要具体到可执行
231
+ 3. **关键词要准确** — 直接影响后续 SKILL 匹配的准确性
232
+ 4. **技术栈要完整** — 列出所有涉及的技术栈,便于步骤拆解时匹配专用 SKILL
233
+ 5. **重规划时保持目标一致** — 调整的是 `acceptanceCriteria`/`estimatedSteps`/`failureAnalysis`/`adjustmentStrategy`,不是 `intent`
234
+ 6. **输出纯 JSON** — 下游有容错机制但应输出纯 JSON,不依赖容错
@@ -0,0 +1,160 @@
1
+ # 任务分析输出示例
2
+
3
+ > 完整的分析结果 JSON 示例,供 SKILL 执行时参考格式。
4
+
5
+ ---
6
+
7
+ ## 1. 首轮分析输出示例
8
+
9
+ 以"鸿蒙 ArkTS 三方库内存泄漏检测"任务为例:
10
+
11
+ ```json
12
+ {
13
+ "intent": "分析鸿蒙 ArkTS 三方库的内存泄漏问题,生成结构化检测报告",
14
+ "domain": "harmonyos-porting",
15
+ "keywords": ["ArkTS", "内存泄漏", "生命周期", "OpenHarmony", "leak-detection"],
16
+ "constraints": [
17
+ "必须兼容 ArkTS 编译规则",
18
+ "分析结果输出为纯 JSON 格式",
19
+ "覆盖目标库所有源文件"
20
+ ],
21
+ "techStack": ["ArkTS", "OpenHarmony", "鸿蒙 SDK"],
22
+ "complexity": "medium",
23
+ "estimatedSteps": 5,
24
+ "acceptanceCriteria": [
25
+ {
26
+ "id": "ac1",
27
+ "criterion": "内存泄漏分析报告 JSON 文件已生成且可解析",
28
+ "type": "output",
29
+ "verification": "检查 {workDir}/leak-analysis.json 存在,JSON.parse 成功"
30
+ },
31
+ {
32
+ "id": "ac2",
33
+ "criterion": "报告包含 intent、domain、keywords、techStack 字段且均非空",
34
+ "type": "quality",
35
+ "verification": "读取 JSON,逐字段检查存在性和非空"
36
+ },
37
+ {
38
+ "id": "ac3",
39
+ "criterion": "扫描覆盖目标库所有源文件(覆盖率 100%)",
40
+ "type": "performance",
41
+ "verification": "对比源文件列表与扫描结果,确认无遗漏"
42
+ },
43
+ {
44
+ "id": "ac4",
45
+ "criterion": "每个疑似泄漏点包含位置、类型、严重等级信息",
46
+ "type": "quality",
47
+ "verification": "读取报告中 leakPoints 数组,每条含 file/line/level 字段"
48
+ },
49
+ {
50
+ "id": "ac5",
51
+ "criterion": "分析结果符合 JSON 输出规范(纯 JSON、字段完整)",
52
+ "type": "compliance",
53
+ "verification": "运行 validate-output.sh 校验脚本,检查通过"
54
+ }
55
+ ]
56
+ }
57
+ ```
58
+
59
+ ---
60
+
61
+ ## 2. 重规划分析输出示例
62
+
63
+ 第 1 轮重规划(loopCount=1),上一轮 ac3/ac4 未通过:
64
+
65
+ ```json
66
+ {
67
+ "intent": "分析鸿蒙 ArkTS 三方库的内存泄漏问题,生成结构化检测报告",
68
+ "domain": "harmonyos-porting",
69
+ "keywords": ["ArkTS", "内存泄漏", "生命周期", "OpenHarmony", "leak-detection", "utils-scan"],
70
+ "constraints": [
71
+ "必须兼容 ArkTS 编译规则",
72
+ "分析结果输出为纯 JSON 格式",
73
+ "覆盖目标库所有源文件"
74
+ ],
75
+ "techStack": ["ArkTS", "OpenHarmony", "鸿蒙 SDK"],
76
+ "complexity": "high",
77
+ "estimatedSteps": 7,
78
+ "acceptanceCriteria": [
79
+ {
80
+ "id": "ac1",
81
+ "criterion": "内存泄漏分析报告 JSON 文件已生成且可解析",
82
+ "type": "output",
83
+ "verification": "检查 {workDir}/leak-analysis.json 存在,JSON.parse 成功"
84
+ },
85
+ {
86
+ "id": "ac2",
87
+ "criterion": "报告包含 intent、domain、keywords、techStack 字段且均非空",
88
+ "type": "quality",
89
+ "verification": "读取 JSON,逐字段检查存在性和非空"
90
+ },
91
+ {
92
+ "id": "ac3",
93
+ "criterion": "扫描覆盖目标库所有源文件含 utils/ 目录(覆盖率 100%)",
94
+ "type": "performance",
95
+ "verification": "执行 find {srcDir} -name '*.ets' | wc -l 对比扫描结果条数,确认无遗漏"
96
+ },
97
+ {
98
+ "id": "ac4",
99
+ "criterion": "每个疑似泄漏点包含位置、类型、严重等级、修复建议信息",
100
+ "type": "quality",
101
+ "verification": "读取报告中 leakPoints 数组,每条含 file/line/level/suggestion 字段"
102
+ },
103
+ {
104
+ "id": "ac5",
105
+ "criterion": "分析结果符合 JSON 输出规范(纯 JSON、字段完整)",
106
+ "type": "compliance",
107
+ "verification": "运行 validate-output.sh 校验脚本,检查通过"
108
+ },
109
+ {
110
+ "id": "ac6",
111
+ "criterion": "utils/ 目录单独扫描且结果纳入主报告",
112
+ "type": "output",
113
+ "verification": "检查报告中 leakPoints 含 utils/ 路径下的条目"
114
+ }
115
+ ],
116
+ "failureAnalysis": "上一轮共 2 条标准未通过:ac3 失败原因:扫描未覆盖 utils/ 目录,estimatedSteps=3 过低未包含该目录扫描步骤 → 执行问题(步骤遗漏);ac4 失败原因:泄漏点缺少 suggestion 字段 → 标准问题(验证方式不够明确)。根因:首轮 estimatedSteps 过低,未覆盖全部源目录。",
117
+ "adjustmentStrategy": "1. ac3 重写 verification 为具体 find 命令对比;2. ac4 补充 suggestion 字段要求;3. estimatedSteps 从 3 调整为 7;4. 新增 ac6 覆盖 utils/ 目录扫描;5. keywords 补充 'utils-scan';6. complexity 从 medium 提升为 high。"
118
+ }
119
+ ```
120
+
121
+ ---
122
+
123
+ ## 3. 简单任务输出示例
124
+
125
+ 以"更新 README 文档"任务为例:
126
+
127
+ ```json
128
+ {
129
+ "intent": "更新项目 README 文档,补充安装说明和使用示例",
130
+ "domain": "documentation",
131
+ "keywords": ["README", "documentation", "markdown"],
132
+ "constraints": [
133
+ "保持原有文档结构",
134
+ "使用中文"
135
+ ],
136
+ "techStack": ["Markdown"],
137
+ "complexity": "low",
138
+ "estimatedSteps": 2,
139
+ "acceptanceCriteria": [
140
+ {
141
+ "id": "ac1",
142
+ "criterion": "README.md 文件已更新且包含安装说明章节",
143
+ "type": "output",
144
+ "verification": "检查 README.md 中存在 ## 安装 或 ## Installation 标题"
145
+ },
146
+ {
147
+ "id": "ac2",
148
+ "criterion": "README.md 包含至少 2 个使用示例",
149
+ "type": "quality",
150
+ "verification": "统计 README.md 中代码块数量 ≥ 2"
151
+ },
152
+ {
153
+ "id": "ac3",
154
+ "criterion": "文档使用中文编写",
155
+ "type": "compliance",
156
+ "verification": "检查 README.md 正文为中文"
157
+ }
158
+ ]
159
+ }
160
+ ```