@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,424 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # RNOH 三方库自动检测集成脚本
4
+ #
5
+ # 只需提供 npm 包名或 git URL,脚本会自动解析库的文件结构,
6
+ # 推导出所有集成参数,然后调用 add-library.sh 完成集成。
7
+ #
8
+ # 用法:
9
+ # ./scripts/auto-integrate.sh --npm-name <npm-package-name> [--npm-version <version>]
10
+ # ./scripts/auto-integrate.sh --git-url <git-url> --branch <branch>
11
+ #
12
+ # 示例:
13
+ # # 自动集成 image-picker (从 npm 安装)
14
+ # ./scripts/auto-integrate.sh --npm-name @react-native-ohos/react-native-image-picker
15
+ #
16
+ # # 自动集成 lottie (指定版本)
17
+ # ./scripts/auto-integrate.sh --npm-name @react-native-ohos/lottie-react-native --npm-version 7.2.7-rc.6
18
+ #
19
+ # # 从 git 仓库克隆并自动集成
20
+ # ./scripts/auto-integrate.sh --git-url https://gitcode.com/CPF-RN/rntpc_react-native-image-picker --branch br_rnoh0.77
21
+ #
22
+ # # 从 git 仓库克隆,指定子目录 (monorepo 场景)
23
+ # ./scripts/auto-integrate.sh --git-url https://gitcode.com/xxx/mono-repo --branch main --subdir packages/lib-name
24
+ #
25
+
26
+ set -euo pipefail
27
+
28
+ # ── 颜色输出 ──────────────────────────────────────────────
29
+ RED='\033[0;31m'
30
+ GREEN='\033[0;32m'
31
+ YELLOW='\033[1;33m'
32
+ BLUE='\033[0;34m'
33
+ CYAN='\033[0;36m'
34
+ NC='\033[0m'
35
+
36
+ info() { echo -e "${BLUE}[INFO]${NC} $*"; }
37
+ ok() { echo -e "${GREEN}[OK]${NC} $*"; }
38
+ warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
39
+ error() { echo -e "${RED}[ERROR]${NC} $*" >&2; exit 1; }
40
+ debug() { [[ "${VERBOSE:-false}" == "true" ]] && echo -e "${CYAN}[DEBUG]${NC} $*" || true; }
41
+
42
+ # ── 默认值 ────────────────────────────────────────────────
43
+ NPM_NAME=""
44
+ NPM_VERSION=""
45
+ GIT_URL=""
46
+ GIT_BRANCH=""
47
+ GIT_SUBDIR=""
48
+ NPM_INSTALL_FLAGS=""
49
+ VERBOSE=false
50
+ DRY_RUN=false
51
+
52
+ # 脚本所在目录 (scripts/)
53
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
54
+ # 模板根目录 (包含 0.77/ 0.82/ scripts/ 等)
55
+ TEMPLATE_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
56
+ ADD_LIBRARY_SCRIPT="${SCRIPT_DIR}/add-library.sh"
57
+ PARSE_LIBRARY_SCRIPT="${SCRIPT_DIR}/parse-library.py"
58
+
59
+ # 工程目录: 优先使用当前工作目录 (用户 cd 到 0.77/ 或 0.82/ 后运行脚本)
60
+ # 如果 CWD 中有 package.json 则视为工程目录
61
+ # 否则回退到 CWD
62
+ if [[ -f "$(pwd)/package.json" ]]; then
63
+ PROJECT_DIR="$(pwd)"
64
+ else
65
+ # 尝试向上查找 package.json
66
+ PROJECT_DIR="$(pwd)"
67
+ for i in $(seq 1 5); do
68
+ if [[ -f "${PROJECT_DIR}/package.json" ]]; then
69
+ break
70
+ fi
71
+ PROJECT_DIR="$(dirname "${PROJECT_DIR}")"
72
+ done
73
+ if [[ ! -f "${PROJECT_DIR}/package.json" ]]; then
74
+ error "未找到工程目录 (需要包含 package.json), 请 cd 到 0.77/ 或 0.82/ 目录后运行"
75
+ fi
76
+ fi
77
+
78
+ # ── 参数解析 ──────────────────────────────────────────────
79
+ usage() {
80
+ cat <<'EOF'
81
+ RNOH 三方库自动检测集成脚本
82
+
83
+ 用法:
84
+ ./scripts/auto-integrate.sh [选项]
85
+
86
+ 数据源 (二选一):
87
+ --npm-name <name> npm 包名 (如 @react-native-ohos/react-native-image-picker)
88
+ --git-url <url> git 仓库 URL (如 https://gitcode.com/CPF-RN/rntpc_react-native-image-picker)
89
+
90
+ 可选参数:
91
+ --npm-version <version> npm 包版本
92
+ --branch <branch> git 分支名 (配合 --git-url 使用)
93
+ --subdir <path> 库在 monorepo 中的子目录路径
94
+ --legacy-peer-deps npm install 时使用 --legacy-peer-deps
95
+ --force npm install 时使用 --force
96
+ --verbose 显示详细调试信息
97
+ --dry-run 只解析不实际集成
98
+ --help, -h 显示帮助
99
+
100
+ 示例:
101
+ # 自动集成 image-picker
102
+ ./scripts/auto-integrate.sh --npm-name @react-native-ohos/react-native-image-picker
103
+
104
+ # 自动集成 lottie (指定版本)
105
+ ./scripts/auto-integrate.sh --npm-name @react-native-ohos/lottie-react-native --npm-version 7.2.7-rc.6
106
+
107
+ # 从 git 仓库克隆并集成
108
+ ./scripts/auto-integrate.sh --git-url https://gitcode.com/CPF-RN/rntpc_react-native-image-picker --branch br_rnoh0.77
109
+ EOF
110
+ exit 0
111
+ }
112
+
113
+ while [[ $# -gt 0 ]]; do
114
+ case "$1" in
115
+ --npm-name) NPM_NAME="$2"; shift 2;;
116
+ --npm-version) NPM_VERSION="$2"; shift 2;;
117
+ --git-url) GIT_URL="$2"; shift 2;;
118
+ --branch) GIT_BRANCH="$2"; shift 2;;
119
+ --subdir) GIT_SUBDIR="$2"; shift 2;;
120
+ --legacy-peer-deps) NPM_INSTALL_FLAGS="$NPM_INSTALL_FLAGS --legacy-peer-deps"; shift;;
121
+ --force) NPM_INSTALL_FLAGS="$NPM_INSTALL_FLAGS --force"; shift;;
122
+ --verbose) VERBOSE=true; shift;;
123
+ --dry-run) DRY_RUN=true; shift;;
124
+ --help|-h) usage;;
125
+ *) error "未知参数: $1 (使用 --help 查看用法)";;
126
+ esac
127
+ done
128
+
129
+ # ── 参数校验 ──────────────────────────────────────────────
130
+ if [[ -z "$NPM_NAME" && -z "$GIT_URL" ]]; then
131
+ error "必须指定 --npm-name 或 --git-url"
132
+ fi
133
+
134
+ if [[ -n "$GIT_URL" && -z "$GIT_BRANCH" ]]; then
135
+ warn "未指定 --branch, 将使用默认分支"
136
+ GIT_BRANCH="--"
137
+ fi
138
+
139
+ # ── 检查依赖 ──────────────────────────────────────────────
140
+ for cmd in python3 npm git; do
141
+ command -v "$cmd" >/dev/null 2>&1 || error "未找到命令: $cmd, 请先安装"
142
+ done
143
+
144
+ [[ -x "$ADD_LIBRARY_SCRIPT" ]] || error "add-library.sh 不存在或不可执行: $ADD_LIBRARY_SCRIPT"
145
+ [[ -f "$PARSE_LIBRARY_SCRIPT" ]] || error "parse-library.py 不存在: $PARSE_LIBRARY_SCRIPT"
146
+
147
+ # ════════════════════════════════════════════════════════════
148
+ # 阶段 1: 安装/获取库
149
+ # ════════════════════════════════════════════════════════════
150
+
151
+ echo ""
152
+ echo "=========================================="
153
+ echo " RNOH 三方库自动检测集成"
154
+ echo "=========================================="
155
+ echo ""
156
+
157
+ # ── 1a. 从 git 克隆 ──────────────────────────────────────
158
+ if [[ -n "$GIT_URL" ]]; then
159
+ info "从 git 仓库获取库..."
160
+
161
+ TMP_GIT_DIR="/tmp/rnoh-auto-integrate-$(date +%s)"
162
+ info " 克隆 ${GIT_URL} (分支: ${GIT_BRANCH})"
163
+
164
+ if [[ "$GIT_BRANCH" == "--" ]]; then
165
+ git clone --depth=1 "$GIT_URL" "$TMP_GIT_DIR" 2>&1 | tail -3
166
+ else
167
+ git clone --depth=1 -b "$GIT_BRANCH" "$GIT_URL" "$TMP_GIT_DIR" 2>&1 | tail -3
168
+ fi
169
+
170
+ [[ -d "$TMP_GIT_DIR" ]] || error "git clone 失败"
171
+
172
+ # 如果有子目录
173
+ if [[ -n "$GIT_SUBDIR" ]]; then
174
+ LIB_SRC_DIR="${TMP_GIT_DIR}/${GIT_SUBDIR}"
175
+ else
176
+ LIB_SRC_DIR="$TMP_GIT_DIR"
177
+ fi
178
+
179
+ [[ -f "${LIB_SRC_DIR}/package.json" ]] || error "未在 ${LIB_SRC_DIR} 找到 package.json"
180
+
181
+ # 从 package.json 读取 npm 包名
182
+ NPM_NAME=$(python3 -c "
183
+ import json
184
+ with open('${LIB_SRC_DIR}/package.json') as f:
185
+ data = json.load(f)
186
+ print(data.get('name', ''))
187
+ ")
188
+
189
+ [[ -z "$NPM_NAME" ]] && error "无法从 package.json 读取包名"
190
+ info " 库包名: ${NPM_NAME}"
191
+
192
+ # 将库复制到 node_modules
193
+ NODE_MODULES_DIR="${PROJECT_DIR}/node_modules/${NPM_NAME}"
194
+ info " 复制库到 node_modules/${NPM_NAME}"
195
+ mkdir -p "$(dirname "$NODE_MODULES_DIR")"
196
+ rm -rf "$NODE_MODULES_DIR"
197
+ cp -r "$LIB_SRC_DIR" "$NODE_MODULES_DIR"
198
+
199
+ # 在 package.json 中添加依赖声明 (如果还没有)
200
+ LIB_VERSION=$(python3 -c "
201
+ import json
202
+ with open('${LIB_SRC_DIR}/package.json') as f:
203
+ data = json.load(f)
204
+ print(data.get('version', '*'))
205
+ ")
206
+ info " 库版本: ${LIB_VERSION}"
207
+
208
+ # 添加到 package.json dependencies
209
+ python3 -c "
210
+ import json, sys
211
+ pkg_path = '${PROJECT_DIR}/package.json'
212
+ with open(pkg_path) as f:
213
+ pkg = json.load(f)
214
+ deps = pkg.setdefault('dependencies', {})
215
+ if '${NPM_NAME}' not in deps:
216
+ deps['${NPM_NAME}'] = '${LIB_VERSION}'
217
+ with open(pkg_path, 'w') as f:
218
+ json.dump(pkg, f, indent=2, ensure_ascii=False)
219
+ f.write('\n')
220
+ print('added')
221
+ else:
222
+ print('exists')
223
+ " || warn "无法更新 package.json"
224
+
225
+ # 运行 npm install 解析依赖 (库本身已在 node_modules 中, 这步主要安装库的 peer deps)
226
+ info " 解析依赖..."
227
+ (cd "$PROJECT_DIR" && npm install $NPM_INSTALL_FLAGS 2>&1 | tail -5) || warn "npm install 可能部分失败 (可忽略 peer dependency 警告)"
228
+
229
+ else
230
+ # ── 1b. 从 npm 安装 ──────────────────────────────────────
231
+ info "从 npm 安装库..."
232
+
233
+ if [[ -n "$NPM_VERSION" ]]; then
234
+ info " npm install ${NPM_NAME}@${NPM_VERSION}${NPM_INSTALL_FLAGS}"
235
+ (cd "$PROJECT_DIR" && npm install "${NPM_NAME}@${NPM_VERSION}" --save $NPM_INSTALL_FLAGS)
236
+ else
237
+ info " npm install ${NPM_NAME}${NPM_INSTALL_FLAGS}"
238
+ (cd "$PROJECT_DIR" && npm install "$NPM_NAME" --save $NPM_INSTALL_FLAGS)
239
+ fi
240
+ fi
241
+
242
+ # ── 确定库目录 ────────────────────────────────────────────
243
+ LIB_DIR="${PROJECT_DIR}/node_modules/${NPM_NAME}"
244
+ [[ -d "$LIB_DIR" ]] || error "库目录不存在: ${LIB_DIR}"
245
+ [[ -f "${LIB_DIR}/package.json" ]] || error "package.json 不存在: ${LIB_DIR}/package.json"
246
+
247
+ ok "库已就绪: ${LIB_DIR}"
248
+
249
+ # ════════════════════════════════════════════════════════════
250
+ # 阶段 2: 自动解析库结构 (调用 parse-library.py)
251
+ # ════════════════════════════════════════════════════════════
252
+
253
+ echo ""
254
+ info "开始自动解析库结构..."
255
+
256
+ PARSE_FLAGS=""
257
+ [[ "$VERBOSE" == "true" ]] && PARSE_FLAGS="--verbose"
258
+
259
+ PARSED_JSON=$(python3 "$PARSE_LIBRARY_SCRIPT" "$LIB_DIR" $PARSE_FLAGS 2>/dev/null) || {
260
+ # 如果失败, 重新运行并显示 stderr
261
+ python3 "$PARSE_LIBRARY_SCRIPT" "$LIB_DIR" $PARSE_FLAGS
262
+ error "库解析失败"
263
+ }
264
+
265
+ debug "解析结果 (JSON):"
266
+ debug "$PARSED_JSON"
267
+
268
+ # 从 JSON 提取各字段
269
+ extract_json() {
270
+ local key="$1"
271
+ python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('${key}',''))" <<< "$PARSED_JSON"
272
+ }
273
+
274
+ PARSED_NPM_NAME=$(extract_json "npm_name")
275
+ PARSED_ALIAS=$(extract_json "harmony_alias")
276
+ LIB_TYPE=$(extract_json "lib_type")
277
+ HAS_FABRIC=$(extract_json "has_fabric_component")
278
+ HAS_TURBO=$(extract_json "has_turbo_module")
279
+
280
+ HAR_DEP_NAME=$(extract_json "har_dep_name")
281
+ HAR_DEP_PATH=$(extract_json "har_dep_path")
282
+
283
+ ETS_PKG_CLASS=$(extract_json "ets_package_class")
284
+ ETS_IMPORT_PATH=$(extract_json "ets_import_path")
285
+
286
+ CPP_PKG_CLASS=$(extract_json "cpp_package_class")
287
+ CPP_PKG_HEADER=$(extract_json "cpp_package_header")
288
+ CPP_CMAKE_TARGET=$(extract_json "cpp_cmake_target")
289
+ CPP_CMAKE_SUBDIR=$(extract_json "cpp_cmake_subdir")
290
+
291
+ COMPONENT_NAME=$(extract_json "component_name")
292
+ ARKTS_COMP_STRUCT=$(extract_json "arkts_component_struct")
293
+ ARKTS_COMP_NAME=$(extract_json "arkts_component_name")
294
+ ARKTS_COMP_IMPORT=$(extract_json "arkts_component_import")
295
+
296
+ AUTOLINKING_PRESENT=$(extract_json "autolinking_present")
297
+
298
+ # ════════════════════════════════════════════════════════════
299
+ # 阶段 3: 输出解析结果
300
+ # ════════════════════════════════════════════════════════════
301
+
302
+ echo ""
303
+ echo "──────────────────────────────────────────"
304
+ echo " 自动解析结果"
305
+ echo "──────────────────────────────────────────"
306
+ echo ""
307
+
308
+ print_field() {
309
+ local label="$1"
310
+ local value="$2"
311
+ if [[ -n "$value" && "$value" != "null" ]]; then
312
+ echo -e " ${GREEN}✓${NC} ${label}: ${value}"
313
+ else
314
+ echo -e " ${NC}-${NC} ${label}: (未检测到)${NC}"
315
+ fi
316
+ }
317
+
318
+ print_field "npm 包名" "$PARSED_NPM_NAME"
319
+ print_field "harmony alias" "$PARSED_ALIAS"
320
+ print_field "库类型" "$LIB_TYPE"
321
+ if [[ "$AUTOLINKING_PRESENT" == "True" ]]; then
322
+ print_field "解析来源" "package.json autolinking + 文件扫描"
323
+ else
324
+ print_field "解析来源" "纯文件结构扫描"
325
+ fi
326
+ echo ""
327
+ print_field "HAR 依赖名" "$HAR_DEP_NAME"
328
+ print_field "HAR 文件路径" "$HAR_DEP_PATH"
329
+ echo ""
330
+ print_field "ArkTS Package 类名" "$ETS_PKG_CLASS"
331
+ print_field "ArkTS import 路径" "$ETS_IMPORT_PATH"
332
+ echo ""
333
+ print_field "C++ Package 类名" "$CPP_PKG_CLASS"
334
+ print_field "C++ 头文件名" "$CPP_PKG_HEADER"
335
+ print_field "CMake target" "$CPP_CMAKE_TARGET"
336
+ print_field "CMake 子目录" "$CPP_CMAKE_SUBDIR"
337
+ echo ""
338
+
339
+ if [[ "$HAS_FABRIC" == "True" ]]; then
340
+ print_field "组件名" "$COMPONENT_NAME"
341
+ print_field "组件 struct" "$ARKTS_COMP_STRUCT"
342
+ print_field "组件类型常量" "$ARKTS_COMP_NAME"
343
+ print_field "组件 import 路径" "$ARKTS_COMP_IMPORT"
344
+ else
345
+ echo -e " ${NC}-${NC} Fabric 组件: 无 (TurboModule 库不需要注册 ArkTS 组件)${NC}"
346
+ fi
347
+
348
+ echo ""
349
+ echo "──────────────────────────────────────────"
350
+ echo ""
351
+
352
+ # ════════════════════════════════════════════════════════════
353
+ # 阶段 4: 调用 add-library.sh 完成集成
354
+ # ════════════════════════════════════════════════════════════
355
+
356
+ if [[ "$DRY_RUN" == "true" ]]; then
357
+ info "dry-run 模式: 不执行实际集成"
358
+ echo ""
359
+ echo "等价命令:"
360
+ echo ""
361
+
362
+ # 构建等效的 add-library.sh 命令
363
+ CMD="./scripts/add-library.sh"
364
+ CMD+=" --npm-name '${PARSED_NPM_NAME}'"
365
+ [[ -n "$NPM_VERSION" ]] && CMD+=" --npm-version '${NPM_VERSION}'"
366
+ [[ -n "$PARSED_ALIAS" ]] && CMD+=" --harmony-alias '${PARSED_ALIAS}'"
367
+ [[ -n "$ETS_PKG_CLASS" ]] && CMD+=" --ets-package-class '${ETS_PKG_CLASS}'"
368
+ [[ -n "$ETS_IMPORT_PATH" ]] && CMD+=" --ets-package-import-path '${ETS_IMPORT_PATH}'"
369
+ [[ -n "$CPP_PKG_CLASS" ]] && CMD+=" --cpp-package-class '${CPP_PKG_CLASS}'"
370
+ [[ -n "$CPP_PKG_HEADER" ]] && CMD+=" --cpp-package-header '${CPP_PKG_HEADER}'"
371
+ [[ -n "$CPP_CMAKE_TARGET" ]] && CMD+=" --cpp-cmake-target '${CPP_CMAKE_TARGET}'"
372
+ [[ -n "$CPP_CMAKE_SUBDIR" ]] && CMD+=" --cpp-cmake-subdir '${CPP_CMAKE_SUBDIR}'"
373
+ [[ -n "$HAR_DEP_NAME" ]] && CMD+=" --har-dep-name '${HAR_DEP_NAME}'"
374
+ [[ -n "$HAR_DEP_PATH" ]] && CMD+=" --har-dep-path '${HAR_DEP_PATH}'"
375
+ [[ -n "$ARKTS_COMP_NAME" ]] && CMD+=" --arkts-component-name '${ARKTS_COMP_NAME}'"
376
+ [[ -n "$ARKTS_COMP_IMPORT" ]] && CMD+=" --arkts-component-import-path '${ARKTS_COMP_IMPORT}'"
377
+ [[ -n "$ARKTS_COMP_STRUCT" ]] && CMD+=" --arkts-component-struct '${ARKTS_COMP_STRUCT}'"
378
+
379
+ # 美化输出 (每行一个参数)
380
+ echo "$CMD" | sed 's/ --/\n --/g' | sed 's/^/ /'
381
+ echo ""
382
+ exit 0
383
+ fi
384
+
385
+ # 构建参数数组
386
+ ARGS=()
387
+ ARGS+=(--npm-name "$PARSED_NPM_NAME")
388
+ ARGS+=(--skip-npm-install) # 库已在阶段1安装
389
+ [[ -n "$NPM_VERSION" ]] && ARGS+=(--npm-version "$NPM_VERSION")
390
+ [[ -n "$PARSED_ALIAS" ]] && ARGS+=(--harmony-alias "$PARSED_ALIAS")
391
+ [[ -n "$ETS_PKG_CLASS" ]] && ARGS+=(--ets-package-class "$ETS_PKG_CLASS")
392
+ [[ -n "$ETS_IMPORT_PATH" ]] && ARGS+=(--ets-package-import-path "$ETS_IMPORT_PATH")
393
+ [[ -n "$CPP_PKG_CLASS" ]] && ARGS+=(--cpp-package-class "$CPP_PKG_CLASS")
394
+ [[ -n "$CPP_PKG_HEADER" ]] && ARGS+=(--cpp-package-header "$CPP_PKG_HEADER")
395
+ [[ -n "$CPP_CMAKE_TARGET" ]] && ARGS+=(--cpp-cmake-target "$CPP_CMAKE_TARGET")
396
+ [[ -n "$CPP_CMAKE_SUBDIR" ]] && ARGS+=(--cpp-cmake-subdir "$CPP_CMAKE_SUBDIR")
397
+ [[ -n "$HAR_DEP_NAME" ]] && ARGS+=(--har-dep-name "$HAR_DEP_NAME")
398
+ [[ -n "$HAR_DEP_PATH" ]] && ARGS+=(--har-dep-path "$HAR_DEP_PATH")
399
+ [[ -n "$ARKTS_COMP_NAME" ]] && ARGS+=(--arkts-component-name "$ARKTS_COMP_NAME")
400
+ [[ -n "$ARKTS_COMP_IMPORT" ]] && ARGS+=(--arkts-component-import-path "$ARKTS_COMP_IMPORT")
401
+ [[ -n "$ARKTS_COMP_STRUCT" ]] && ARGS+=(--arkts-component-struct "$ARKTS_COMP_STRUCT")
402
+
403
+ info "调用 add-library.sh 执行集成..."
404
+ echo ""
405
+
406
+ # 因为库已经安装, add-library.sh 的步骤 1 (npm install) 会重新执行
407
+ # 但 npm 有缓存所以很快, 且能正确写入 package.json
408
+ "$ADD_LIBRARY_SCRIPT" "${ARGS[@]}" || error "add-library.sh 执行失败"
409
+
410
+ echo ""
411
+ ok "自动检测集成完成!"
412
+ echo ""
413
+ echo "解析来源汇总:"
414
+ if [[ "$AUTOLINKING_PRESENT" == "True" ]]; then
415
+ echo " - package.json harmony.autolinking: 有 (优先使用)"
416
+ echo " - 文件结构扫描: 补充验证"
417
+ else
418
+ echo " - package.json harmony.autolinking: 无"
419
+ echo " - 文件结构扫描: ArkTS(*Package.ts) + C++(*Package.h) + CMake(CMakeLists.txt)"
420
+ fi
421
+
422
+ if [[ "$HAS_FABRIC" == "True" ]]; then
423
+ echo " - 组件名解析: *NativeComponent.ts → codegenNativeComponent()"
424
+ fi
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: rnoh-lib-demo-coverage
3
+ description: 分析 RN 鸿蒙三方库现有 Demo 对接口的覆盖情况。通过 rn-analyze-demo-coverage.cjs 脚本一步完成接口提取、Demo 覆盖率匹配和 Markdown 报告生成。当需要对 RN 鸿蒙三方库的 Demo 进行接口覆盖率分析时调用。
4
+ license: Apache-2.0
5
+ compatibility: 需要 Node.js 运行环境
6
+ metadata:
7
+ author: rnoh-team
8
+ version: "1.0.0"
9
+ category: rn-testing
10
+ language: JavaScript/TypeScript
11
+ useWhen: 分析 RN 鸿蒙三方库 Demo 对接口的覆盖情况
12
+ consumed-by: rnohLibTestAlignSkill
13
+ ---
14
+
15
+ # RN 鸿蒙三方库 Demo 接口覆盖率分析
16
+
17
+ 通过 `rn-analyze-demo-coverage.cjs` 脚本一步完成接口提取、Demo 覆盖率匹配和 Markdown 报告生成,无需中间文件。
18
+
19
+ > ⚠️ **核心约束**:基于静态 import 和接口调用分析,动态调用(`obj[methodName]()`)无法识别。
20
+
21
+ ---
22
+
23
+ ## 脚本依赖
24
+
25
+ 本 Skill 直接调用以下本地脚本完成全部分析工作:
26
+
27
+ ```
28
+ 3rdLibraryLoop/MCP/scripts/rn-analyze-demo-coverage.cjs
29
+ ```
30
+
31
+ **调用方式**:通过 `node` 命令行直接执行,使用 `--` 参数传参。
32
+
33
+ ---
34
+
35
+ ## 任务参数
36
+
37
+ | 参数 | 类型 | 必填 | 说明 |
38
+ |------|------|------|------|
39
+ | `libroot` | string | ✅* | 库根目录路径(RN 三方库的鸿蒙化仓库目录,包含 `package.json`) |
40
+ | `spec` | string | ✅* | 已有的 interface-spec.json 路径(与 `libroot` 二选一) |
41
+ | `output` | string | ❌ | 输出 Markdown 报告路径,默认 `02-{库名}-Demo覆盖率报告.md` |
42
+ | `title` | string | ❌ | 报告标题 |
43
+ | `mode` | string | ❌ | 匹配模式: `auto`(默认) \| `ast` \| `regex` |
44
+ | `version` | string | ❌ | 上游 npm 版本号(如 `2.2.0`),未指定时自动从 dependencies/README 推断 |
45
+ | `src` | string | ❌ | Demo 源码目录覆盖,默认自动检测 |
46
+
47
+ > `libroot` 与 `spec` 至少提供一个。提供 `spec` 时跳过接口提取步骤直接使用;仅提供 `libroot` 时脚本自动从源码提取接口(必要时拉取上游 npm 源码)。
48
+
49
+ **派生变量**:
50
+ - `skillDir`:本 Skill 所在目录
51
+ - `scriptPath`:分析脚本路径 = `{{skillDir}}/../../../MCP/scripts/rn-analyze-demo-coverage.cjs`
52
+
53
+ ---
54
+
55
+ ## 执行命令
56
+
57
+ ```bash
58
+ node "{{skillDir}}/../../../MCP/scripts/rn-analyze-demo-coverage.cjs" \
59
+ --libroot "{{libroot}}" \
60
+ [--output "{{output}}"] [--title "{{title}}"] [--mode auto|ast|regex] [--version "{{上游版本}}"]
61
+ ```
62
+
63
+ 或从已有 interface-spec.json 生成:
64
+
65
+ ```bash
66
+ node "{{skillDir}}/../../../MCP/scripts/rn-analyze-demo-coverage.cjs" \
67
+ --spec "{{spec}}" --libroot "{{libroot}}" [--output "{{output}}"]
68
+ ```
69
+
70
+ 其中:
71
+ - `{{skillDir}}` = SKILL.md 所在目录
72
+ - `{{libroot}}` = RN 三方库的鸿蒙化仓库根目录
73
+ - `{{workspaceRoot}}` = `3rdLibraryLoop` 工作区根目录
74
+
75
+ ---
76
+
77
+ ## 脚本自动完成
78
+
79
+ 1. 获取接口规格(从 `--spec` 指定的 JSON 读取,或从 `libroot` 源码自动提取,必要时拉取上游 npm 源码 `index.js`/`index.d.ts` 及本地 TurboModule Spec `Native*.ts`)
80
+ 2. 自动检测 Demo 源码目录(按优先级查找):
81
+ - `example/src`、`demo/src`、`examples/src`
82
+ - `example`、`demo`
83
+ 3. 递归扫描 Demo 源码目录下所有 `.ts`、`.tsx`、`.js`、`.jsx` 文件(排除 `node_modules`、`harmony`、`android`、`ios`、`__tests__`、`__mocks__`、`tests`、`test`)
84
+ 4. 提取 `import { ... } from 'lib'` 语句(ES Module 默认/命名/别名/混合导入、CommonJS require、side-effect import)
85
+ 5. AST/正则双层匹配:静态方法、实例方法(追踪变量声明与类型)、链式调用、对象字面量属性、默认导入命名空间宽松兜底
86
+ 6. 直接渲染输出 Markdown 覆盖率报告
87
+
88
+ ---
89
+
90
+ ## 库源码目录结构约定
91
+
92
+ ```
93
+ {{libroot}}/
94
+ ├── package.json ← 库 package.json(依赖中含上游 npm 包名)
95
+ ├── src/ ← JS 层导出源码
96
+ ├── harmony/ ← 鸿蒙化原生代码(ArkTS/C++,扫描时排除)
97
+ └── example/
98
+ ├── src/ ← Demo 源码(自动检测目录之一)
99
+ └── ...
100
+ ```
101
+
102
+ > 脚本自动检测 Demo 目录,无需手动指定 `--src`;如自动检测失败或多目录共存,可用 `--src` 显式指定。
103
+
104
+ ---
105
+
106
+ ## 输入依赖
107
+
108
+ - **前置SKILL**: rnoh-lib-code-adapt(可选;Demo 源码通常来自鸿蒙化仓库的 example 目录)
109
+ - **输入文件**: 库源码目录(含 `package.json` 和 Demo 源码目录)
110
+ - **输出文件**: Markdown 覆盖率报告(脚本直接生成)
111
+
112
+ ---
113
+
114
+ ## 输出
115
+
116
+ 生成 Markdown 报告,包含以下章节:
117
+ - **基本信息**:库名、源文件数、生成时间
118
+ - **覆盖率总览**:方法级覆盖率百分比、S/N/M 统计、进度条
119
+ - **按接口类型统计**:method/constructor/property/field/enumValue/function/variable/type 分类别覆盖率
120
+ - **类级覆盖率**:按类分组的覆盖明细(按覆盖率升序排列)
121
+ - **未覆盖接口详情**:按类分组的未覆盖接口清单(含参数、返回类型、说明)
122
+ - **已覆盖接口详情**:按类分组的已覆盖接口清单(含签名和覆盖来源文件)
123
+ - **文件覆盖详情**:每个 Demo 文件覆盖的接口数和接口列表
124
+ - **覆盖率提升建议**:按优先级排列的未覆盖接口补充清单
125
+
126
+ > 当未找到 Demo 源文件时,报告会标注「无 Demo 文档声明」并列出所有接口为未覆盖。
127
+
128
+ ---
129
+
130
+ ## 注意事项
131
+
132
+ 1. **确定性**:所有计数和匹配由脚本完成,同一组输入必定产生相同输出
133
+ 2. **子目录排除**:自动排除 `node_modules`、`harmony`、`android`、`ios`、`__tests__`、`__mocks__`、`tests`、`test` 等目录
134
+ 3. **构造函数和枚举**:已在接口提取阶段排除
135
+ 4. **动态调用限制**:`obj[methodName]()` 无法识别
136
+ 5. **模式选择**:`auto` 优先 AST 匹配(需 TypeScript 模块),失败时降级正则;`ast` 强制 AST;`regex` 强制正则
137
+ 6. **版本推断**:未传 `--version` 时,脚本从 `package.json` 的 `dependencies` 或 README 自动推断上游 npm 版本号