aiyou-dev 3.5.15

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 (853) hide show
  1. package/.claude/agents/analysis/analyze-code-quality.md +179 -0
  2. package/.claude/agents/analysis/code-analyzer.md +210 -0
  3. package/.claude/agents/analysis/code-review/analyze-code-quality.md +179 -0
  4. package/.claude/agents/architecture/arch-system-design.md +157 -0
  5. package/.claude/agents/architecture/system-design/arch-system-design.md +155 -0
  6. package/.claude/agents/browser/browser-agent.yaml +182 -0
  7. package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
  8. package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
  9. package/.claude/agents/consensus/gossip-coordinator.md +63 -0
  10. package/.claude/agents/consensus/performance-benchmarker.md +851 -0
  11. package/.claude/agents/consensus/quorum-manager.md +823 -0
  12. package/.claude/agents/consensus/raft-manager.md +63 -0
  13. package/.claude/agents/consensus/security-manager.md +622 -0
  14. package/.claude/agents/core/coder.md +453 -0
  15. package/.claude/agents/core/planner.md +375 -0
  16. package/.claude/agents/core/researcher.md +369 -0
  17. package/.claude/agents/core/reviewer.md +520 -0
  18. package/.claude/agents/core/tester.md +512 -0
  19. package/.claude/agents/custom/test-long-runner.md +44 -0
  20. package/.claude/agents/data/data-ml-model.md +445 -0
  21. package/.claude/agents/data/ml/data-ml-model.md +193 -0
  22. package/.claude/agents/development/backend/dev-backend-api.md +142 -0
  23. package/.claude/agents/development/dev-backend-api.md +345 -0
  24. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  25. package/.claude/agents/devops/ops-cicd-github.md +165 -0
  26. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  27. package/.claude/agents/documentation/docs-api-openapi.md +355 -0
  28. package/.claude/agents/flow-nexus/app-store.md +88 -0
  29. package/.claude/agents/flow-nexus/authentication.md +69 -0
  30. package/.claude/agents/flow-nexus/challenges.md +81 -0
  31. package/.claude/agents/flow-nexus/neural-network.md +88 -0
  32. package/.claude/agents/flow-nexus/payments.md +83 -0
  33. package/.claude/agents/flow-nexus/sandbox.md +76 -0
  34. package/.claude/agents/flow-nexus/swarm.md +76 -0
  35. package/.claude/agents/flow-nexus/user-tools.md +96 -0
  36. package/.claude/agents/flow-nexus/workflow.md +84 -0
  37. package/.claude/agents/github/code-review-swarm.md +377 -0
  38. package/.claude/agents/github/github-modes.md +173 -0
  39. package/.claude/agents/github/issue-tracker.md +576 -0
  40. package/.claude/agents/github/multi-repo-swarm.md +553 -0
  41. package/.claude/agents/github/pr-manager.md +438 -0
  42. package/.claude/agents/github/project-board-sync.md +509 -0
  43. package/.claude/agents/github/release-manager.md +605 -0
  44. package/.claude/agents/github/release-swarm.md +583 -0
  45. package/.claude/agents/github/repo-architect.md +398 -0
  46. package/.claude/agents/github/swarm-issue.md +573 -0
  47. package/.claude/agents/github/swarm-pr.md +428 -0
  48. package/.claude/agents/github/sync-coordinator.md +452 -0
  49. package/.claude/agents/github/workflow-automation.md +903 -0
  50. package/.claude/agents/goal/agent.md +816 -0
  51. package/.claude/agents/goal/goal-planner.md +73 -0
  52. package/.claude/agents/optimization/benchmark-suite.md +665 -0
  53. package/.claude/agents/optimization/load-balancer.md +431 -0
  54. package/.claude/agents/optimization/performance-monitor.md +672 -0
  55. package/.claude/agents/optimization/resource-allocator.md +674 -0
  56. package/.claude/agents/optimization/topology-optimizer.md +808 -0
  57. package/.claude/agents/payments/agentic-payments.md +126 -0
  58. package/.claude/agents/sona/sona-learning-optimizer.md +74 -0
  59. package/.claude/agents/sparc/architecture.md +699 -0
  60. package/.claude/agents/sparc/pseudocode.md +520 -0
  61. package/.claude/agents/sparc/refinement.md +802 -0
  62. package/.claude/agents/sparc/specification.md +478 -0
  63. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +225 -0
  64. package/.claude/agents/specialized/spec-mobile-react-native.md +227 -0
  65. package/.claude/agents/sublinear/consensus-coordinator.md +338 -0
  66. package/.claude/agents/sublinear/matrix-optimizer.md +185 -0
  67. package/.claude/agents/sublinear/pagerank-analyzer.md +299 -0
  68. package/.claude/agents/sublinear/performance-optimizer.md +368 -0
  69. package/.claude/agents/sublinear/trading-predictor.md +246 -0
  70. package/.claude/agents/swarm/adaptive-coordinator.md +1127 -0
  71. package/.claude/agents/swarm/hierarchical-coordinator.md +710 -0
  72. package/.claude/agents/swarm/mesh-coordinator.md +963 -0
  73. package/.claude/agents/templates/automation-smart-agent.md +205 -0
  74. package/.claude/agents/templates/base-template-generator.md +268 -0
  75. package/.claude/agents/templates/coordinator-swarm-init.md +90 -0
  76. package/.claude/agents/templates/github-pr-manager.md +177 -0
  77. package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  78. package/.claude/agents/templates/memory-coordinator.md +187 -0
  79. package/.claude/agents/templates/orchestrator-task.md +139 -0
  80. package/.claude/agents/templates/performance-analyzer.md +199 -0
  81. package/.claude/agents/templates/sparc-coordinator.md +514 -0
  82. package/.claude/agents/testing/production-validator.md +395 -0
  83. package/.claude/agents/testing/tdd-london-swarm.md +244 -0
  84. package/.claude/agents/v3/adr-architect.md +184 -0
  85. package/.claude/agents/v3/aidefence-guardian.md +282 -0
  86. package/.claude/agents/v3/claims-authorizer.md +208 -0
  87. package/.claude/agents/v3/collective-intelligence-coordinator.md +993 -0
  88. package/.claude/agents/v3/ddd-domain-expert.md +220 -0
  89. package/.claude/agents/v3/injection-analyst.md +236 -0
  90. package/.claude/agents/v3/memory-specialist.md +995 -0
  91. package/.claude/agents/v3/performance-engineer.md +1233 -0
  92. package/.claude/agents/v3/pii-detector.md +151 -0
  93. package/.claude/agents/v3/reasoningbank-learner.md +213 -0
  94. package/.claude/agents/v3/security-architect-aidefence.md +410 -0
  95. package/.claude/agents/v3/security-architect.md +867 -0
  96. package/.claude/agents/v3/security-auditor.md +771 -0
  97. package/.claude/agents/v3/sparc-orchestrator.md +182 -0
  98. package/.claude/agents/v3/swarm-memory-manager.md +157 -0
  99. package/.claude/agents/v3/v3-integration-architect.md +205 -0
  100. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
  101. package/.claude/commands/analysis/README.md +9 -0
  102. package/.claude/commands/analysis/bottleneck-detect.md +162 -0
  103. package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
  104. package/.claude/commands/analysis/performance-report.md +25 -0
  105. package/.claude/commands/analysis/token-efficiency.md +45 -0
  106. package/.claude/commands/analysis/token-usage.md +25 -0
  107. package/.claude/commands/automation/README.md +9 -0
  108. package/.claude/commands/automation/auto-agent.md +122 -0
  109. package/.claude/commands/automation/self-healing.md +106 -0
  110. package/.claude/commands/automation/session-memory.md +90 -0
  111. package/.claude/commands/automation/smart-agents.md +73 -0
  112. package/.claude/commands/automation/smart-spawn.md +25 -0
  113. package/.claude/commands/automation/workflow-select.md +25 -0
  114. package/.claude/commands/claude-flow-help.md +103 -0
  115. package/.claude/commands/claude-flow-memory.md +107 -0
  116. package/.claude/commands/claude-flow-swarm.md +205 -0
  117. package/.claude/commands/github/README.md +11 -0
  118. package/.claude/commands/github/code-review-swarm.md +514 -0
  119. package/.claude/commands/github/code-review.md +25 -0
  120. package/.claude/commands/github/github-modes.md +147 -0
  121. package/.claude/commands/github/github-swarm.md +121 -0
  122. package/.claude/commands/github/issue-tracker.md +292 -0
  123. package/.claude/commands/github/issue-triage.md +25 -0
  124. package/.claude/commands/github/multi-repo-swarm.md +519 -0
  125. package/.claude/commands/github/pr-enhance.md +26 -0
  126. package/.claude/commands/github/pr-manager.md +170 -0
  127. package/.claude/commands/github/project-board-sync.md +471 -0
  128. package/.claude/commands/github/release-manager.md +338 -0
  129. package/.claude/commands/github/release-swarm.md +544 -0
  130. package/.claude/commands/github/repo-analyze.md +25 -0
  131. package/.claude/commands/github/repo-architect.md +367 -0
  132. package/.claude/commands/github/swarm-issue.md +482 -0
  133. package/.claude/commands/github/swarm-pr.md +285 -0
  134. package/.claude/commands/github/sync-coordinator.md +301 -0
  135. package/.claude/commands/github/workflow-automation.md +442 -0
  136. package/.claude/commands/hooks/README.md +11 -0
  137. package/.claude/commands/hooks/overview.md +58 -0
  138. package/.claude/commands/hooks/post-edit.md +117 -0
  139. package/.claude/commands/hooks/post-task.md +112 -0
  140. package/.claude/commands/hooks/pre-edit.md +113 -0
  141. package/.claude/commands/hooks/pre-task.md +111 -0
  142. package/.claude/commands/hooks/session-end.md +118 -0
  143. package/.claude/commands/hooks/setup.md +103 -0
  144. package/.claude/commands/monitoring/README.md +9 -0
  145. package/.claude/commands/monitoring/agent-metrics.md +25 -0
  146. package/.claude/commands/monitoring/agents.md +44 -0
  147. package/.claude/commands/monitoring/real-time-view.md +25 -0
  148. package/.claude/commands/monitoring/status.md +46 -0
  149. package/.claude/commands/monitoring/swarm-monitor.md +25 -0
  150. package/.claude/commands/optimization/README.md +9 -0
  151. package/.claude/commands/optimization/auto-topology.md +62 -0
  152. package/.claude/commands/optimization/cache-manage.md +25 -0
  153. package/.claude/commands/optimization/parallel-execute.md +25 -0
  154. package/.claude/commands/optimization/parallel-execution.md +50 -0
  155. package/.claude/commands/optimization/topology-optimize.md +25 -0
  156. package/.claude/commands/sparc/analyzer.md +52 -0
  157. package/.claude/commands/sparc/architect.md +53 -0
  158. package/.claude/commands/sparc/ask.md +97 -0
  159. package/.claude/commands/sparc/batch-executor.md +54 -0
  160. package/.claude/commands/sparc/code.md +89 -0
  161. package/.claude/commands/sparc/coder.md +54 -0
  162. package/.claude/commands/sparc/debug.md +83 -0
  163. package/.claude/commands/sparc/debugger.md +54 -0
  164. package/.claude/commands/sparc/designer.md +53 -0
  165. package/.claude/commands/sparc/devops.md +109 -0
  166. package/.claude/commands/sparc/docs-writer.md +80 -0
  167. package/.claude/commands/sparc/documenter.md +54 -0
  168. package/.claude/commands/sparc/innovator.md +54 -0
  169. package/.claude/commands/sparc/integration.md +83 -0
  170. package/.claude/commands/sparc/mcp.md +117 -0
  171. package/.claude/commands/sparc/memory-manager.md +54 -0
  172. package/.claude/commands/sparc/optimizer.md +54 -0
  173. package/.claude/commands/sparc/orchestrator.md +132 -0
  174. package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -0
  175. package/.claude/commands/sparc/refinement-optimization-mode.md +83 -0
  176. package/.claude/commands/sparc/researcher.md +54 -0
  177. package/.claude/commands/sparc/reviewer.md +54 -0
  178. package/.claude/commands/sparc/security-review.md +80 -0
  179. package/.claude/commands/sparc/sparc-modes.md +174 -0
  180. package/.claude/commands/sparc/sparc.md +111 -0
  181. package/.claude/commands/sparc/spec-pseudocode.md +80 -0
  182. package/.claude/commands/sparc/supabase-admin.md +348 -0
  183. package/.claude/commands/sparc/swarm-coordinator.md +54 -0
  184. package/.claude/commands/sparc/tdd.md +54 -0
  185. package/.claude/commands/sparc/tester.md +54 -0
  186. package/.claude/commands/sparc/tutorial.md +79 -0
  187. package/.claude/commands/sparc/workflow-manager.md +54 -0
  188. package/.claude/helpers/README.md +97 -0
  189. package/.claude/helpers/adr-compliance.sh +186 -0
  190. package/.claude/helpers/auto-commit.sh +178 -0
  191. package/.claude/helpers/auto-memory-hook.mjs +365 -0
  192. package/.claude/helpers/checkpoint-manager.sh +251 -0
  193. package/.claude/helpers/daemon-manager.sh +252 -0
  194. package/.claude/helpers/ddd-tracker.sh +144 -0
  195. package/.claude/helpers/github-safe.js +106 -0
  196. package/.claude/helpers/github-setup.sh +28 -0
  197. package/.claude/helpers/guidance-hook.sh +13 -0
  198. package/.claude/helpers/guidance-hooks.sh +102 -0
  199. package/.claude/helpers/health-monitor.sh +108 -0
  200. package/.claude/helpers/hook-handler.cjs +271 -0
  201. package/.claude/helpers/intelligence.cjs +916 -0
  202. package/.claude/helpers/learning-hooks.sh +329 -0
  203. package/.claude/helpers/learning-optimizer.sh +127 -0
  204. package/.claude/helpers/learning-service.mjs +1144 -0
  205. package/.claude/helpers/memory.js +83 -0
  206. package/.claude/helpers/metrics-db.mjs +488 -0
  207. package/.claude/helpers/pattern-consolidator.sh +86 -0
  208. package/.claude/helpers/perf-worker.sh +160 -0
  209. package/.claude/helpers/post-commit +16 -0
  210. package/.claude/helpers/pre-commit +26 -0
  211. package/.claude/helpers/quick-start.sh +19 -0
  212. package/.claude/helpers/router.js +66 -0
  213. package/.claude/helpers/security-scanner.sh +127 -0
  214. package/.claude/helpers/session.js +135 -0
  215. package/.claude/helpers/setup-mcp.sh +18 -0
  216. package/.claude/helpers/standard-checkpoint-hooks.sh +189 -0
  217. package/.claude/helpers/statusline-hook.sh +21 -0
  218. package/.claude/helpers/statusline.cjs +758 -0
  219. package/.claude/helpers/statusline.js +316 -0
  220. package/.claude/helpers/swarm-comms.sh +353 -0
  221. package/.claude/helpers/swarm-hooks.sh +761 -0
  222. package/.claude/helpers/swarm-monitor.sh +211 -0
  223. package/.claude/helpers/sync-v3-metrics.sh +245 -0
  224. package/.claude/helpers/update-v3-progress.sh +166 -0
  225. package/.claude/helpers/v3-quick-status.sh +58 -0
  226. package/.claude/helpers/v3.sh +111 -0
  227. package/.claude/helpers/validate-v3-config.sh +216 -0
  228. package/.claude/helpers/worker-manager.sh +170 -0
  229. package/.claude/settings.json +319 -0
  230. package/.claude/settings.local.json +18 -0
  231. package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
  232. package/.claude/skills/agentdb-learning/SKILL.md +545 -0
  233. package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
  234. package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
  235. package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
  236. package/.claude/skills/browser/SKILL.md +204 -0
  237. package/.claude/skills/github-code-review/SKILL.md +1140 -0
  238. package/.claude/skills/github-multi-repo/SKILL.md +874 -0
  239. package/.claude/skills/github-project-management/SKILL.md +1277 -0
  240. package/.claude/skills/github-release-management/SKILL.md +1081 -0
  241. package/.claude/skills/github-workflow-automation/SKILL.md +1065 -0
  242. package/.claude/skills/hooks-automation/SKILL.md +1201 -0
  243. package/.claude/skills/pair-programming/SKILL.md +1202 -0
  244. package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
  245. package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
  246. package/.claude/skills/skill-builder/SKILL.md +910 -0
  247. package/.claude/skills/sparc-methodology/SKILL.md +1115 -0
  248. package/.claude/skills/stream-chain/SKILL.md +563 -0
  249. package/.claude/skills/swarm-advanced/SKILL.md +973 -0
  250. package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
  251. package/.claude/skills/v3-cli-modernization/SKILL.md +872 -0
  252. package/.claude/skills/v3-core-implementation/SKILL.md +797 -0
  253. package/.claude/skills/v3-ddd-architecture/SKILL.md +442 -0
  254. package/.claude/skills/v3-integration-deep/SKILL.md +241 -0
  255. package/.claude/skills/v3-mcp-optimization/SKILL.md +777 -0
  256. package/.claude/skills/v3-memory-unification/SKILL.md +174 -0
  257. package/.claude/skills/v3-performance-optimization/SKILL.md +390 -0
  258. package/.claude/skills/v3-security-overhaul/SKILL.md +82 -0
  259. package/.claude/skills/v3-swarm-coordination/SKILL.md +340 -0
  260. package/.claude/skills/verification-quality/SKILL.md +649 -0
  261. package/.claude-plugin/README.md +720 -0
  262. package/.claude-plugin/docs/INSTALLATION.md +261 -0
  263. package/.claude-plugin/docs/PLUGIN_SUMMARY.md +361 -0
  264. package/.claude-plugin/docs/QUICKSTART.md +361 -0
  265. package/.claude-plugin/docs/STRUCTURE.md +128 -0
  266. package/.claude-plugin/hooks/hooks.json +74 -0
  267. package/.claude-plugin/marketplace.json +96 -0
  268. package/.claude-plugin/plugin.json +71 -0
  269. package/.claude-plugin/scripts/install.sh +234 -0
  270. package/.claude-plugin/scripts/uninstall.sh +36 -0
  271. package/.claude-plugin/scripts/verify.sh +108 -0
  272. package/LICENSE +24 -0
  273. package/README.md +99 -0
  274. package/bin/cli.js +11 -0
  275. package/bin/npx-repair.js +7 -0
  276. package/bin/npx-safe-launch.js +9 -0
  277. package/package.json +131 -0
  278. package/v3/@aiyou-dev/cli/bin/cli.js +156 -0
  279. package/v3/@aiyou-dev/cli/bin/mcp-server.js +189 -0
  280. package/v3/@aiyou-dev/cli/bin/preinstall.cjs +2 -0
  281. package/v3/@aiyou-dev/cli/dist/src/appliance/gguf-engine.d.ts +91 -0
  282. package/v3/@aiyou-dev/cli/dist/src/appliance/gguf-engine.js +425 -0
  283. package/v3/@aiyou-dev/cli/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
  284. package/v3/@aiyou-dev/cli/dist/src/appliance/ruvllm-bridge.js +292 -0
  285. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-builder.d.ts +44 -0
  286. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-builder.js +329 -0
  287. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-distribution.d.ts +97 -0
  288. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-distribution.js +370 -0
  289. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-format.d.ts +111 -0
  290. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-format.js +393 -0
  291. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-runner.d.ts +69 -0
  292. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-runner.js +237 -0
  293. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-signing.d.ts +123 -0
  294. package/v3/@aiyou-dev/cli/dist/src/appliance/rvfa-signing.js +347 -0
  295. package/v3/@aiyou-dev/cli/dist/src/benchmarks/pretrain/index.d.ts +58 -0
  296. package/v3/@aiyou-dev/cli/dist/src/benchmarks/pretrain/index.js +404 -0
  297. package/v3/@aiyou-dev/cli/dist/src/commands/agent.d.ts +8 -0
  298. package/v3/@aiyou-dev/cli/dist/src/commands/agent.js +819 -0
  299. package/v3/@aiyou-dev/cli/dist/src/commands/analyze.d.ts +19 -0
  300. package/v3/@aiyou-dev/cli/dist/src/commands/analyze.js +1823 -0
  301. package/v3/@aiyou-dev/cli/dist/src/commands/appliance-advanced.d.ts +9 -0
  302. package/v3/@aiyou-dev/cli/dist/src/commands/appliance-advanced.js +215 -0
  303. package/v3/@aiyou-dev/cli/dist/src/commands/appliance.d.ts +8 -0
  304. package/v3/@aiyou-dev/cli/dist/src/commands/appliance.js +406 -0
  305. package/v3/@aiyou-dev/cli/dist/src/commands/benchmark.d.ts +10 -0
  306. package/v3/@aiyou-dev/cli/dist/src/commands/benchmark.js +459 -0
  307. package/v3/@aiyou-dev/cli/dist/src/commands/claims.d.ts +10 -0
  308. package/v3/@aiyou-dev/cli/dist/src/commands/claims.js +373 -0
  309. package/v3/@aiyou-dev/cli/dist/src/commands/completions.d.ts +10 -0
  310. package/v3/@aiyou-dev/cli/dist/src/commands/completions.js +539 -0
  311. package/v3/@aiyou-dev/cli/dist/src/commands/config.d.ts +8 -0
  312. package/v3/@aiyou-dev/cli/dist/src/commands/config.js +406 -0
  313. package/v3/@aiyou-dev/cli/dist/src/commands/daemon.d.ts +8 -0
  314. package/v3/@aiyou-dev/cli/dist/src/commands/daemon.js +609 -0
  315. package/v3/@aiyou-dev/cli/dist/src/commands/deployment.d.ts +10 -0
  316. package/v3/@aiyou-dev/cli/dist/src/commands/deployment.js +289 -0
  317. package/v3/@aiyou-dev/cli/dist/src/commands/doctor.d.ts +10 -0
  318. package/v3/@aiyou-dev/cli/dist/src/commands/doctor.js +602 -0
  319. package/v3/@aiyou-dev/cli/dist/src/commands/embeddings.d.ts +18 -0
  320. package/v3/@aiyou-dev/cli/dist/src/commands/embeddings.js +1576 -0
  321. package/v3/@aiyou-dev/cli/dist/src/commands/gcc.d.ts +10 -0
  322. package/v3/@aiyou-dev/cli/dist/src/commands/gcc.js +197 -0
  323. package/v3/@aiyou-dev/cli/dist/src/commands/guidance.d.ts +8 -0
  324. package/v3/@aiyou-dev/cli/dist/src/commands/guidance.js +560 -0
  325. package/v3/@aiyou-dev/cli/dist/src/commands/hive-mind.d.ts +11 -0
  326. package/v3/@aiyou-dev/cli/dist/src/commands/hive-mind.js +1230 -0
  327. package/v3/@aiyou-dev/cli/dist/src/commands/hooks.d.ts +8 -0
  328. package/v3/@aiyou-dev/cli/dist/src/commands/hooks.js +3759 -0
  329. package/v3/@aiyou-dev/cli/dist/src/commands/index.d.ts +114 -0
  330. package/v3/@aiyou-dev/cli/dist/src/commands/index.js +375 -0
  331. package/v3/@aiyou-dev/cli/dist/src/commands/init.d.ts +8 -0
  332. package/v3/@aiyou-dev/cli/dist/src/commands/init.js +976 -0
  333. package/v3/@aiyou-dev/cli/dist/src/commands/issues.d.ts +21 -0
  334. package/v3/@aiyou-dev/cli/dist/src/commands/issues.js +567 -0
  335. package/v3/@aiyou-dev/cli/dist/src/commands/mcp.d.ts +11 -0
  336. package/v3/@aiyou-dev/cli/dist/src/commands/mcp.js +715 -0
  337. package/v3/@aiyou-dev/cli/dist/src/commands/memory.d.ts +8 -0
  338. package/v3/@aiyou-dev/cli/dist/src/commands/memory.js +1292 -0
  339. package/v3/@aiyou-dev/cli/dist/src/commands/migrate.d.ts +8 -0
  340. package/v3/@aiyou-dev/cli/dist/src/commands/migrate.js +410 -0
  341. package/v3/@aiyou-dev/cli/dist/src/commands/neural.d.ts +10 -0
  342. package/v3/@aiyou-dev/cli/dist/src/commands/neural.js +1448 -0
  343. package/v3/@aiyou-dev/cli/dist/src/commands/performance.d.ts +10 -0
  344. package/v3/@aiyou-dev/cli/dist/src/commands/performance.js +579 -0
  345. package/v3/@aiyou-dev/cli/dist/src/commands/plugins.d.ts +11 -0
  346. package/v3/@aiyou-dev/cli/dist/src/commands/plugins.js +820 -0
  347. package/v3/@aiyou-dev/cli/dist/src/commands/process.d.ts +10 -0
  348. package/v3/@aiyou-dev/cli/dist/src/commands/process.js +641 -0
  349. package/v3/@aiyou-dev/cli/dist/src/commands/progress.d.ts +11 -0
  350. package/v3/@aiyou-dev/cli/dist/src/commands/progress.js +259 -0
  351. package/v3/@aiyou-dev/cli/dist/src/commands/providers.d.ts +10 -0
  352. package/v3/@aiyou-dev/cli/dist/src/commands/providers.js +232 -0
  353. package/v3/@aiyou-dev/cli/dist/src/commands/route.d.ts +16 -0
  354. package/v3/@aiyou-dev/cli/dist/src/commands/route.js +813 -0
  355. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/backup.d.ts +11 -0
  356. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/backup.js +746 -0
  357. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/benchmark.d.ts +11 -0
  358. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/benchmark.js +480 -0
  359. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/import.d.ts +18 -0
  360. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/import.js +349 -0
  361. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/index.d.ts +29 -0
  362. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/index.js +129 -0
  363. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/init.d.ts +11 -0
  364. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/init.js +431 -0
  365. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/migrate.d.ts +11 -0
  366. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/migrate.js +481 -0
  367. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/optimize.d.ts +11 -0
  368. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/optimize.js +503 -0
  369. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/setup.d.ts +18 -0
  370. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/setup.js +765 -0
  371. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/status.d.ts +11 -0
  372. package/v3/@aiyou-dev/cli/dist/src/commands/ruvector/status.js +456 -0
  373. package/v3/@aiyou-dev/cli/dist/src/commands/security.d.ts +10 -0
  374. package/v3/@aiyou-dev/cli/dist/src/commands/security.js +575 -0
  375. package/v3/@aiyou-dev/cli/dist/src/commands/session.d.ts +8 -0
  376. package/v3/@aiyou-dev/cli/dist/src/commands/session.js +750 -0
  377. package/v3/@aiyou-dev/cli/dist/src/commands/start.d.ts +8 -0
  378. package/v3/@aiyou-dev/cli/dist/src/commands/start.js +418 -0
  379. package/v3/@aiyou-dev/cli/dist/src/commands/status.d.ts +8 -0
  380. package/v3/@aiyou-dev/cli/dist/src/commands/status.js +591 -0
  381. package/v3/@aiyou-dev/cli/dist/src/commands/swarm.d.ts +8 -0
  382. package/v3/@aiyou-dev/cli/dist/src/commands/swarm.js +748 -0
  383. package/v3/@aiyou-dev/cli/dist/src/commands/task.d.ts +8 -0
  384. package/v3/@aiyou-dev/cli/dist/src/commands/task.js +671 -0
  385. package/v3/@aiyou-dev/cli/dist/src/commands/transfer-store.d.ts +13 -0
  386. package/v3/@aiyou-dev/cli/dist/src/commands/transfer-store.js +428 -0
  387. package/v3/@aiyou-dev/cli/dist/src/commands/update.d.ts +8 -0
  388. package/v3/@aiyou-dev/cli/dist/src/commands/update.js +276 -0
  389. package/v3/@aiyou-dev/cli/dist/src/commands/workflow.d.ts +8 -0
  390. package/v3/@aiyou-dev/cli/dist/src/commands/workflow.js +617 -0
  391. package/v3/@aiyou-dev/cli/dist/src/config-adapter.d.ts +15 -0
  392. package/v3/@aiyou-dev/cli/dist/src/config-adapter.js +186 -0
  393. package/v3/@aiyou-dev/cli/dist/src/gcc/core.d.ts +98 -0
  394. package/v3/@aiyou-dev/cli/dist/src/gcc/core.js +504 -0
  395. package/v3/@aiyou-dev/cli/dist/src/gcc/index.d.ts +10 -0
  396. package/v3/@aiyou-dev/cli/dist/src/gcc/index.js +9 -0
  397. package/v3/@aiyou-dev/cli/dist/src/gcc/toon-bridge.d.ts +19 -0
  398. package/v3/@aiyou-dev/cli/dist/src/gcc/toon-bridge.js +51 -0
  399. package/v3/@aiyou-dev/cli/dist/src/index.d.ts +76 -0
  400. package/v3/@aiyou-dev/cli/dist/src/index.js +470 -0
  401. package/v3/@aiyou-dev/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
  402. package/v3/@aiyou-dev/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
  403. package/v3/@aiyou-dev/cli/dist/src/init/claudemd-generator.d.ts +25 -0
  404. package/v3/@aiyou-dev/cli/dist/src/init/claudemd-generator.js +525 -0
  405. package/v3/@aiyou-dev/cli/dist/src/init/executor.d.ts +41 -0
  406. package/v3/@aiyou-dev/cli/dist/src/init/executor.js +1767 -0
  407. package/v3/@aiyou-dev/cli/dist/src/init/gemini-config-generator.d.ts +24 -0
  408. package/v3/@aiyou-dev/cli/dist/src/init/gemini-config-generator.js +89 -0
  409. package/v3/@aiyou-dev/cli/dist/src/init/geminimd-generator.d.ts +15 -0
  410. package/v3/@aiyou-dev/cli/dist/src/init/geminimd-generator.js +222 -0
  411. package/v3/@aiyou-dev/cli/dist/src/init/helpers-generator.d.ts +60 -0
  412. package/v3/@aiyou-dev/cli/dist/src/init/helpers-generator.js +1166 -0
  413. package/v3/@aiyou-dev/cli/dist/src/init/index.d.ts +13 -0
  414. package/v3/@aiyou-dev/cli/dist/src/init/index.js +15 -0
  415. package/v3/@aiyou-dev/cli/dist/src/init/mcp-generator.d.ts +26 -0
  416. package/v3/@aiyou-dev/cli/dist/src/init/mcp-generator.js +116 -0
  417. package/v3/@aiyou-dev/cli/dist/src/init/settings-generator.d.ts +14 -0
  418. package/v3/@aiyou-dev/cli/dist/src/init/settings-generator.js +437 -0
  419. package/v3/@aiyou-dev/cli/dist/src/init/statusline-generator.d.ts +28 -0
  420. package/v3/@aiyou-dev/cli/dist/src/init/statusline-generator.js +817 -0
  421. package/v3/@aiyou-dev/cli/dist/src/init/types.d.ts +291 -0
  422. package/v3/@aiyou-dev/cli/dist/src/init/types.js +260 -0
  423. package/v3/@aiyou-dev/cli/dist/src/mcp-client.d.ts +92 -0
  424. package/v3/@aiyou-dev/cli/dist/src/mcp-client.js +241 -0
  425. package/v3/@aiyou-dev/cli/dist/src/mcp-server.d.ts +161 -0
  426. package/v3/@aiyou-dev/cli/dist/src/mcp-server.js +627 -0
  427. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/agent-tools.d.ts +9 -0
  428. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/agent-tools.js +549 -0
  429. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
  430. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/agentdb-tools.js +557 -0
  431. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
  432. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/analyze-tools.js +317 -0
  433. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/auto-install.d.ts +83 -0
  434. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/auto-install.js +131 -0
  435. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/browser-tools.d.ts +13 -0
  436. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/browser-tools.js +550 -0
  437. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/claims-tools.d.ts +12 -0
  438. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/claims-tools.js +732 -0
  439. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/config-tools.d.ts +8 -0
  440. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/config-tools.js +343 -0
  441. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
  442. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/coordination-tools.js +486 -0
  443. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/daa-tools.d.ts +13 -0
  444. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/daa-tools.js +426 -0
  445. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
  446. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/embeddings-tools.js +782 -0
  447. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/gcc-tools.d.ts +9 -0
  448. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/gcc-tools.js +152 -0
  449. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/github-tools.d.ts +13 -0
  450. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/github-tools.js +373 -0
  451. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
  452. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/hive-mind-tools.js +583 -0
  453. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/hooks-tools.d.ts +44 -0
  454. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/hooks-tools.js +2969 -0
  455. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/index.d.ts +24 -0
  456. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/index.js +23 -0
  457. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/memory-tools.d.ts +14 -0
  458. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/memory-tools.js +499 -0
  459. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/neural-tools.d.ts +16 -0
  460. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/neural-tools.js +461 -0
  461. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/performance-tools.d.ts +16 -0
  462. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/performance-tools.js +534 -0
  463. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/progress-tools.d.ts +14 -0
  464. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/progress-tools.js +348 -0
  465. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/security-tools.d.ts +18 -0
  466. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/security-tools.js +434 -0
  467. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/session-tools.d.ts +8 -0
  468. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/session-tools.js +315 -0
  469. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/swarm-tools.d.ts +8 -0
  470. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/swarm-tools.js +102 -0
  471. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/system-tools.d.ts +13 -0
  472. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/system-tools.js +417 -0
  473. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/task-tools.d.ts +8 -0
  474. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/task-tools.js +338 -0
  475. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/terminal-tools.d.ts +13 -0
  476. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/terminal-tools.js +246 -0
  477. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
  478. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/transfer-tools.js +396 -0
  479. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/types.d.ts +31 -0
  480. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/types.js +7 -0
  481. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
  482. package/v3/@aiyou-dev/cli/dist/src/mcp-tools/workflow-tools.js +572 -0
  483. package/v3/@aiyou-dev/cli/dist/src/memory/ewc-consolidation.d.ts +271 -0
  484. package/v3/@aiyou-dev/cli/dist/src/memory/ewc-consolidation.js +542 -0
  485. package/v3/@aiyou-dev/cli/dist/src/memory/intelligence.d.ts +285 -0
  486. package/v3/@aiyou-dev/cli/dist/src/memory/intelligence.js +794 -0
  487. package/v3/@aiyou-dev/cli/dist/src/memory/memory-bridge.d.ts +407 -0
  488. package/v3/@aiyou-dev/cli/dist/src/memory/memory-bridge.js +1494 -0
  489. package/v3/@aiyou-dev/cli/dist/src/memory/memory-initializer.d.ts +405 -0
  490. package/v3/@aiyou-dev/cli/dist/src/memory/memory-initializer.js +2105 -0
  491. package/v3/@aiyou-dev/cli/dist/src/memory/sona-optimizer.d.ts +227 -0
  492. package/v3/@aiyou-dev/cli/dist/src/memory/sona-optimizer.js +633 -0
  493. package/v3/@aiyou-dev/cli/dist/src/output.d.ts +133 -0
  494. package/v3/@aiyou-dev/cli/dist/src/output.js +514 -0
  495. package/v3/@aiyou-dev/cli/dist/src/parser.d.ts +41 -0
  496. package/v3/@aiyou-dev/cli/dist/src/parser.js +377 -0
  497. package/v3/@aiyou-dev/cli/dist/src/plugins/manager.d.ts +133 -0
  498. package/v3/@aiyou-dev/cli/dist/src/plugins/manager.js +400 -0
  499. package/v3/@aiyou-dev/cli/dist/src/plugins/store/discovery.d.ts +88 -0
  500. package/v3/@aiyou-dev/cli/dist/src/plugins/store/discovery.js +1147 -0
  501. package/v3/@aiyou-dev/cli/dist/src/plugins/store/index.d.ts +76 -0
  502. package/v3/@aiyou-dev/cli/dist/src/plugins/store/index.js +141 -0
  503. package/v3/@aiyou-dev/cli/dist/src/plugins/store/search.d.ts +46 -0
  504. package/v3/@aiyou-dev/cli/dist/src/plugins/store/search.js +230 -0
  505. package/v3/@aiyou-dev/cli/dist/src/plugins/store/types.d.ts +274 -0
  506. package/v3/@aiyou-dev/cli/dist/src/plugins/store/types.js +7 -0
  507. package/v3/@aiyou-dev/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
  508. package/v3/@aiyou-dev/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
  509. package/v3/@aiyou-dev/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
  510. package/v3/@aiyou-dev/cli/dist/src/plugins/tests/standalone-test.js +188 -0
  511. package/v3/@aiyou-dev/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
  512. package/v3/@aiyou-dev/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
  513. package/v3/@aiyou-dev/cli/dist/src/production/circuit-breaker.d.ts +101 -0
  514. package/v3/@aiyou-dev/cli/dist/src/production/circuit-breaker.js +241 -0
  515. package/v3/@aiyou-dev/cli/dist/src/production/error-handler.d.ts +92 -0
  516. package/v3/@aiyou-dev/cli/dist/src/production/error-handler.js +299 -0
  517. package/v3/@aiyou-dev/cli/dist/src/production/index.d.ts +23 -0
  518. package/v3/@aiyou-dev/cli/dist/src/production/index.js +18 -0
  519. package/v3/@aiyou-dev/cli/dist/src/production/monitoring.d.ts +161 -0
  520. package/v3/@aiyou-dev/cli/dist/src/production/monitoring.js +356 -0
  521. package/v3/@aiyou-dev/cli/dist/src/production/rate-limiter.d.ts +80 -0
  522. package/v3/@aiyou-dev/cli/dist/src/production/rate-limiter.js +201 -0
  523. package/v3/@aiyou-dev/cli/dist/src/production/retry.d.ts +48 -0
  524. package/v3/@aiyou-dev/cli/dist/src/production/retry.js +179 -0
  525. package/v3/@aiyou-dev/cli/dist/src/prompt.d.ts +44 -0
  526. package/v3/@aiyou-dev/cli/dist/src/prompt.js +501 -0
  527. package/v3/@aiyou-dev/cli/dist/src/runtime/headless.d.ts +60 -0
  528. package/v3/@aiyou-dev/cli/dist/src/runtime/headless.js +284 -0
  529. package/v3/@aiyou-dev/cli/dist/src/ruvector/ast-analyzer.d.ts +67 -0
  530. package/v3/@aiyou-dev/cli/dist/src/ruvector/ast-analyzer.js +277 -0
  531. package/v3/@aiyou-dev/cli/dist/src/ruvector/coverage-router.d.ts +160 -0
  532. package/v3/@aiyou-dev/cli/dist/src/ruvector/coverage-router.js +529 -0
  533. package/v3/@aiyou-dev/cli/dist/src/ruvector/coverage-tools.d.ts +33 -0
  534. package/v3/@aiyou-dev/cli/dist/src/ruvector/coverage-tools.js +157 -0
  535. package/v3/@aiyou-dev/cli/dist/src/ruvector/diff-classifier.d.ts +175 -0
  536. package/v3/@aiyou-dev/cli/dist/src/ruvector/diff-classifier.js +698 -0
  537. package/v3/@aiyou-dev/cli/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
  538. package/v3/@aiyou-dev/cli/dist/src/ruvector/enhanced-model-router.js +529 -0
  539. package/v3/@aiyou-dev/cli/dist/src/ruvector/flash-attention.d.ts +195 -0
  540. package/v3/@aiyou-dev/cli/dist/src/ruvector/flash-attention.js +643 -0
  541. package/v3/@aiyou-dev/cli/dist/src/ruvector/graph-analyzer.d.ts +187 -0
  542. package/v3/@aiyou-dev/cli/dist/src/ruvector/graph-analyzer.js +929 -0
  543. package/v3/@aiyou-dev/cli/dist/src/ruvector/index.d.ts +34 -0
  544. package/v3/@aiyou-dev/cli/dist/src/ruvector/index.js +60 -0
  545. package/v3/@aiyou-dev/cli/dist/src/ruvector/lora-adapter.d.ts +218 -0
  546. package/v3/@aiyou-dev/cli/dist/src/ruvector/lora-adapter.js +455 -0
  547. package/v3/@aiyou-dev/cli/dist/src/ruvector/model-router.d.ts +220 -0
  548. package/v3/@aiyou-dev/cli/dist/src/ruvector/model-router.js +488 -0
  549. package/v3/@aiyou-dev/cli/dist/src/ruvector/moe-router.d.ts +206 -0
  550. package/v3/@aiyou-dev/cli/dist/src/ruvector/moe-router.js +626 -0
  551. package/v3/@aiyou-dev/cli/dist/src/ruvector/q-learning-router.d.ts +211 -0
  552. package/v3/@aiyou-dev/cli/dist/src/ruvector/q-learning-router.js +681 -0
  553. package/v3/@aiyou-dev/cli/dist/src/ruvector/semantic-router.d.ts +77 -0
  554. package/v3/@aiyou-dev/cli/dist/src/ruvector/semantic-router.js +178 -0
  555. package/v3/@aiyou-dev/cli/dist/src/ruvector/vector-db.d.ts +69 -0
  556. package/v3/@aiyou-dev/cli/dist/src/ruvector/vector-db.js +243 -0
  557. package/v3/@aiyou-dev/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
  558. package/v3/@aiyou-dev/cli/dist/src/services/agentic-flow-bridge.js +95 -0
  559. package/v3/@aiyou-dev/cli/dist/src/services/claim-service.d.ts +204 -0
  560. package/v3/@aiyou-dev/cli/dist/src/services/claim-service.js +818 -0
  561. package/v3/@aiyou-dev/cli/dist/src/services/container-worker-pool.d.ts +197 -0
  562. package/v3/@aiyou-dev/cli/dist/src/services/container-worker-pool.js +583 -0
  563. package/v3/@aiyou-dev/cli/dist/src/services/headless-worker-executor.d.ts +304 -0
  564. package/v3/@aiyou-dev/cli/dist/src/services/headless-worker-executor.js +999 -0
  565. package/v3/@aiyou-dev/cli/dist/src/services/index.d.ts +13 -0
  566. package/v3/@aiyou-dev/cli/dist/src/services/index.js +11 -0
  567. package/v3/@aiyou-dev/cli/dist/src/services/registry-api.d.ts +58 -0
  568. package/v3/@aiyou-dev/cli/dist/src/services/registry-api.js +146 -0
  569. package/v3/@aiyou-dev/cli/dist/src/services/ruvector-training.d.ts +214 -0
  570. package/v3/@aiyou-dev/cli/dist/src/services/ruvector-training.js +497 -0
  571. package/v3/@aiyou-dev/cli/dist/src/services/worker-daemon.d.ts +203 -0
  572. package/v3/@aiyou-dev/cli/dist/src/services/worker-daemon.js +756 -0
  573. package/v3/@aiyou-dev/cli/dist/src/services/worker-queue.d.ts +194 -0
  574. package/v3/@aiyou-dev/cli/dist/src/services/worker-queue.js +513 -0
  575. package/v3/@aiyou-dev/cli/dist/src/suggest.d.ts +53 -0
  576. package/v3/@aiyou-dev/cli/dist/src/suggest.js +200 -0
  577. package/v3/@aiyou-dev/cli/dist/src/transfer/anonymization/index.d.ts +25 -0
  578. package/v3/@aiyou-dev/cli/dist/src/transfer/anonymization/index.js +175 -0
  579. package/v3/@aiyou-dev/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
  580. package/v3/@aiyou-dev/cli/dist/src/transfer/deploy-seraphine.js +205 -0
  581. package/v3/@aiyou-dev/cli/dist/src/transfer/export.d.ts +25 -0
  582. package/v3/@aiyou-dev/cli/dist/src/transfer/export.js +113 -0
  583. package/v3/@aiyou-dev/cli/dist/src/transfer/index.d.ts +12 -0
  584. package/v3/@aiyou-dev/cli/dist/src/transfer/index.js +31 -0
  585. package/v3/@aiyou-dev/cli/dist/src/transfer/ipfs/client.d.ts +109 -0
  586. package/v3/@aiyou-dev/cli/dist/src/transfer/ipfs/client.js +307 -0
  587. package/v3/@aiyou-dev/cli/dist/src/transfer/ipfs/upload.d.ts +95 -0
  588. package/v3/@aiyou-dev/cli/dist/src/transfer/ipfs/upload.js +411 -0
  589. package/v3/@aiyou-dev/cli/dist/src/transfer/models/seraphine.d.ts +72 -0
  590. package/v3/@aiyou-dev/cli/dist/src/transfer/models/seraphine.js +373 -0
  591. package/v3/@aiyou-dev/cli/dist/src/transfer/serialization/cfp.d.ts +49 -0
  592. package/v3/@aiyou-dev/cli/dist/src/transfer/serialization/cfp.js +183 -0
  593. package/v3/@aiyou-dev/cli/dist/src/transfer/storage/gcs.d.ts +82 -0
  594. package/v3/@aiyou-dev/cli/dist/src/transfer/storage/gcs.js +256 -0
  595. package/v3/@aiyou-dev/cli/dist/src/transfer/storage/index.d.ts +6 -0
  596. package/v3/@aiyou-dev/cli/dist/src/transfer/storage/index.js +6 -0
  597. package/v3/@aiyou-dev/cli/dist/src/transfer/store/discovery.d.ts +84 -0
  598. package/v3/@aiyou-dev/cli/dist/src/transfer/store/discovery.js +382 -0
  599. package/v3/@aiyou-dev/cli/dist/src/transfer/store/download.d.ts +70 -0
  600. package/v3/@aiyou-dev/cli/dist/src/transfer/store/download.js +334 -0
  601. package/v3/@aiyou-dev/cli/dist/src/transfer/store/index.d.ts +84 -0
  602. package/v3/@aiyou-dev/cli/dist/src/transfer/store/index.js +153 -0
  603. package/v3/@aiyou-dev/cli/dist/src/transfer/store/publish.d.ts +76 -0
  604. package/v3/@aiyou-dev/cli/dist/src/transfer/store/publish.js +294 -0
  605. package/v3/@aiyou-dev/cli/dist/src/transfer/store/registry.d.ts +58 -0
  606. package/v3/@aiyou-dev/cli/dist/src/transfer/store/registry.js +285 -0
  607. package/v3/@aiyou-dev/cli/dist/src/transfer/store/search.d.ts +54 -0
  608. package/v3/@aiyou-dev/cli/dist/src/transfer/store/search.js +232 -0
  609. package/v3/@aiyou-dev/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
  610. package/v3/@aiyou-dev/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
  611. package/v3/@aiyou-dev/cli/dist/src/transfer/store/types.d.ts +193 -0
  612. package/v3/@aiyou-dev/cli/dist/src/transfer/store/types.js +6 -0
  613. package/v3/@aiyou-dev/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
  614. package/v3/@aiyou-dev/cli/dist/src/transfer/test-seraphine.js +105 -0
  615. package/v3/@aiyou-dev/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
  616. package/v3/@aiyou-dev/cli/dist/src/transfer/tests/test-store.js +214 -0
  617. package/v3/@aiyou-dev/cli/dist/src/transfer/types.d.ts +245 -0
  618. package/v3/@aiyou-dev/cli/dist/src/transfer/types.js +6 -0
  619. package/v3/@aiyou-dev/cli/dist/src/types.d.ts +198 -0
  620. package/v3/@aiyou-dev/cli/dist/src/types.js +38 -0
  621. package/v3/@aiyou-dev/cli/dist/src/update/checker.d.ts +34 -0
  622. package/v3/@aiyou-dev/cli/dist/src/update/checker.js +190 -0
  623. package/v3/@aiyou-dev/cli/dist/src/update/executor.d.ts +32 -0
  624. package/v3/@aiyou-dev/cli/dist/src/update/executor.js +181 -0
  625. package/v3/@aiyou-dev/cli/dist/src/update/index.d.ts +33 -0
  626. package/v3/@aiyou-dev/cli/dist/src/update/index.js +64 -0
  627. package/v3/@aiyou-dev/cli/dist/src/update/rate-limiter.d.ts +20 -0
  628. package/v3/@aiyou-dev/cli/dist/src/update/rate-limiter.js +96 -0
  629. package/v3/@aiyou-dev/cli/dist/src/update/validator.d.ts +17 -0
  630. package/v3/@aiyou-dev/cli/dist/src/update/validator.js +123 -0
  631. package/v3/@aiyou-dev/cli/package.json +111 -0
  632. package/v3/@aiyou-dev/guidance/dist/adversarial.d.ts +284 -0
  633. package/v3/@aiyou-dev/guidance/dist/adversarial.js +572 -0
  634. package/v3/@aiyou-dev/guidance/dist/analyzer.d.ts +530 -0
  635. package/v3/@aiyou-dev/guidance/dist/analyzer.js +2518 -0
  636. package/v3/@aiyou-dev/guidance/dist/artifacts.d.ts +283 -0
  637. package/v3/@aiyou-dev/guidance/dist/artifacts.js +356 -0
  638. package/v3/@aiyou-dev/guidance/dist/authority.d.ts +290 -0
  639. package/v3/@aiyou-dev/guidance/dist/authority.js +558 -0
  640. package/v3/@aiyou-dev/guidance/dist/capabilities.d.ts +209 -0
  641. package/v3/@aiyou-dev/guidance/dist/capabilities.js +485 -0
  642. package/v3/@aiyou-dev/guidance/dist/coherence.d.ts +233 -0
  643. package/v3/@aiyou-dev/guidance/dist/coherence.js +372 -0
  644. package/v3/@aiyou-dev/guidance/dist/compiler.d.ts +87 -0
  645. package/v3/@aiyou-dev/guidance/dist/compiler.js +419 -0
  646. package/v3/@aiyou-dev/guidance/dist/conformance-kit.d.ts +225 -0
  647. package/v3/@aiyou-dev/guidance/dist/conformance-kit.js +629 -0
  648. package/v3/@aiyou-dev/guidance/dist/continue-gate.d.ts +214 -0
  649. package/v3/@aiyou-dev/guidance/dist/continue-gate.js +353 -0
  650. package/v3/@aiyou-dev/guidance/dist/crypto-utils.d.ts +17 -0
  651. package/v3/@aiyou-dev/guidance/dist/crypto-utils.js +24 -0
  652. package/v3/@aiyou-dev/guidance/dist/evolution.d.ts +282 -0
  653. package/v3/@aiyou-dev/guidance/dist/evolution.js +500 -0
  654. package/v3/@aiyou-dev/guidance/dist/gates.d.ts +79 -0
  655. package/v3/@aiyou-dev/guidance/dist/gates.js +302 -0
  656. package/v3/@aiyou-dev/guidance/dist/gateway.d.ts +206 -0
  657. package/v3/@aiyou-dev/guidance/dist/gateway.js +452 -0
  658. package/v3/@aiyou-dev/guidance/dist/generators.d.ts +153 -0
  659. package/v3/@aiyou-dev/guidance/dist/generators.js +682 -0
  660. package/v3/@aiyou-dev/guidance/dist/headless.d.ts +177 -0
  661. package/v3/@aiyou-dev/guidance/dist/headless.js +342 -0
  662. package/v3/@aiyou-dev/guidance/dist/hooks.d.ts +154 -0
  663. package/v3/@aiyou-dev/guidance/dist/hooks.js +361 -0
  664. package/v3/@aiyou-dev/guidance/dist/index.d.ts +205 -0
  665. package/v3/@aiyou-dev/guidance/dist/index.js +321 -0
  666. package/v3/@aiyou-dev/guidance/dist/ledger.d.ts +162 -0
  667. package/v3/@aiyou-dev/guidance/dist/ledger.js +375 -0
  668. package/v3/@aiyou-dev/guidance/dist/manifest-validator.d.ts +289 -0
  669. package/v3/@aiyou-dev/guidance/dist/manifest-validator.js +838 -0
  670. package/v3/@aiyou-dev/guidance/dist/memory-gate.d.ts +222 -0
  671. package/v3/@aiyou-dev/guidance/dist/memory-gate.js +382 -0
  672. package/v3/@aiyou-dev/guidance/dist/meta-governance.d.ts +265 -0
  673. package/v3/@aiyou-dev/guidance/dist/meta-governance.js +348 -0
  674. package/v3/@aiyou-dev/guidance/dist/optimizer.d.ts +104 -0
  675. package/v3/@aiyou-dev/guidance/dist/optimizer.js +329 -0
  676. package/v3/@aiyou-dev/guidance/dist/persistence.d.ts +189 -0
  677. package/v3/@aiyou-dev/guidance/dist/persistence.js +464 -0
  678. package/v3/@aiyou-dev/guidance/dist/proof.d.ts +185 -0
  679. package/v3/@aiyou-dev/guidance/dist/proof.js +238 -0
  680. package/v3/@aiyou-dev/guidance/dist/retriever.d.ts +116 -0
  681. package/v3/@aiyou-dev/guidance/dist/retriever.js +394 -0
  682. package/v3/@aiyou-dev/guidance/dist/ruvbot-integration.d.ts +370 -0
  683. package/v3/@aiyou-dev/guidance/dist/ruvbot-integration.js +738 -0
  684. package/v3/@aiyou-dev/guidance/dist/temporal.d.ts +426 -0
  685. package/v3/@aiyou-dev/guidance/dist/temporal.js +658 -0
  686. package/v3/@aiyou-dev/guidance/dist/trust.d.ts +283 -0
  687. package/v3/@aiyou-dev/guidance/dist/trust.js +473 -0
  688. package/v3/@aiyou-dev/guidance/dist/truth-anchors.d.ts +276 -0
  689. package/v3/@aiyou-dev/guidance/dist/truth-anchors.js +488 -0
  690. package/v3/@aiyou-dev/guidance/dist/types.d.ts +378 -0
  691. package/v3/@aiyou-dev/guidance/dist/types.js +10 -0
  692. package/v3/@aiyou-dev/guidance/dist/uncertainty.d.ts +372 -0
  693. package/v3/@aiyou-dev/guidance/dist/uncertainty.js +619 -0
  694. package/v3/@aiyou-dev/guidance/dist/wasm-kernel.d.ts +48 -0
  695. package/v3/@aiyou-dev/guidance/dist/wasm-kernel.js +158 -0
  696. package/v3/@aiyou-dev/guidance/package.json +198 -0
  697. package/v3/@aiyou-dev/shared/dist/core/config/defaults.d.ts +41 -0
  698. package/v3/@aiyou-dev/shared/dist/core/config/defaults.js +186 -0
  699. package/v3/@aiyou-dev/shared/dist/core/config/index.d.ts +8 -0
  700. package/v3/@aiyou-dev/shared/dist/core/config/index.js +12 -0
  701. package/v3/@aiyou-dev/shared/dist/core/config/loader.d.ts +45 -0
  702. package/v3/@aiyou-dev/shared/dist/core/config/loader.js +222 -0
  703. package/v3/@aiyou-dev/shared/dist/core/config/schema.d.ts +1134 -0
  704. package/v3/@aiyou-dev/shared/dist/core/config/schema.js +158 -0
  705. package/v3/@aiyou-dev/shared/dist/core/config/validator.d.ts +92 -0
  706. package/v3/@aiyou-dev/shared/dist/core/config/validator.js +147 -0
  707. package/v3/@aiyou-dev/shared/dist/core/event-bus.d.ts +31 -0
  708. package/v3/@aiyou-dev/shared/dist/core/event-bus.js +197 -0
  709. package/v3/@aiyou-dev/shared/dist/core/index.d.ts +15 -0
  710. package/v3/@aiyou-dev/shared/dist/core/index.js +19 -0
  711. package/v3/@aiyou-dev/shared/dist/core/interfaces/agent.interface.d.ts +200 -0
  712. package/v3/@aiyou-dev/shared/dist/core/interfaces/agent.interface.js +6 -0
  713. package/v3/@aiyou-dev/shared/dist/core/interfaces/coordinator.interface.d.ts +310 -0
  714. package/v3/@aiyou-dev/shared/dist/core/interfaces/coordinator.interface.js +7 -0
  715. package/v3/@aiyou-dev/shared/dist/core/interfaces/event.interface.d.ts +224 -0
  716. package/v3/@aiyou-dev/shared/dist/core/interfaces/event.interface.js +46 -0
  717. package/v3/@aiyou-dev/shared/dist/core/interfaces/index.d.ts +10 -0
  718. package/v3/@aiyou-dev/shared/dist/core/interfaces/index.js +15 -0
  719. package/v3/@aiyou-dev/shared/dist/core/interfaces/memory.interface.d.ts +298 -0
  720. package/v3/@aiyou-dev/shared/dist/core/interfaces/memory.interface.js +7 -0
  721. package/v3/@aiyou-dev/shared/dist/core/interfaces/task.interface.d.ts +185 -0
  722. package/v3/@aiyou-dev/shared/dist/core/interfaces/task.interface.js +6 -0
  723. package/v3/@aiyou-dev/shared/dist/core/orchestrator/event-coordinator.d.ts +35 -0
  724. package/v3/@aiyou-dev/shared/dist/core/orchestrator/event-coordinator.js +101 -0
  725. package/v3/@aiyou-dev/shared/dist/core/orchestrator/health-monitor.d.ts +60 -0
  726. package/v3/@aiyou-dev/shared/dist/core/orchestrator/health-monitor.js +166 -0
  727. package/v3/@aiyou-dev/shared/dist/core/orchestrator/index.d.ts +46 -0
  728. package/v3/@aiyou-dev/shared/dist/core/orchestrator/index.js +64 -0
  729. package/v3/@aiyou-dev/shared/dist/core/orchestrator/lifecycle-manager.d.ts +56 -0
  730. package/v3/@aiyou-dev/shared/dist/core/orchestrator/lifecycle-manager.js +195 -0
  731. package/v3/@aiyou-dev/shared/dist/core/orchestrator/session-manager.d.ts +83 -0
  732. package/v3/@aiyou-dev/shared/dist/core/orchestrator/session-manager.js +193 -0
  733. package/v3/@aiyou-dev/shared/dist/core/orchestrator/task-manager.d.ts +49 -0
  734. package/v3/@aiyou-dev/shared/dist/core/orchestrator/task-manager.js +253 -0
  735. package/v3/@aiyou-dev/shared/dist/events/domain-events.d.ts +282 -0
  736. package/v3/@aiyou-dev/shared/dist/events/domain-events.js +165 -0
  737. package/v3/@aiyou-dev/shared/dist/events/event-store.d.ts +126 -0
  738. package/v3/@aiyou-dev/shared/dist/events/event-store.js +416 -0
  739. package/v3/@aiyou-dev/shared/dist/events/event-store.test.d.ts +8 -0
  740. package/v3/@aiyou-dev/shared/dist/events/event-store.test.js +293 -0
  741. package/v3/@aiyou-dev/shared/dist/events/example-usage.d.ts +10 -0
  742. package/v3/@aiyou-dev/shared/dist/events/example-usage.js +193 -0
  743. package/v3/@aiyou-dev/shared/dist/events/index.d.ts +21 -0
  744. package/v3/@aiyou-dev/shared/dist/events/index.js +22 -0
  745. package/v3/@aiyou-dev/shared/dist/events/projections.d.ts +177 -0
  746. package/v3/@aiyou-dev/shared/dist/events/projections.js +421 -0
  747. package/v3/@aiyou-dev/shared/dist/events/rvf-event-log.d.ts +82 -0
  748. package/v3/@aiyou-dev/shared/dist/events/rvf-event-log.js +340 -0
  749. package/v3/@aiyou-dev/shared/dist/events/state-reconstructor.d.ts +101 -0
  750. package/v3/@aiyou-dev/shared/dist/events/state-reconstructor.js +263 -0
  751. package/v3/@aiyou-dev/shared/dist/events.d.ts +80 -0
  752. package/v3/@aiyou-dev/shared/dist/events.js +249 -0
  753. package/v3/@aiyou-dev/shared/dist/hooks/example-usage.d.ts +42 -0
  754. package/v3/@aiyou-dev/shared/dist/hooks/example-usage.js +351 -0
  755. package/v3/@aiyou-dev/shared/dist/hooks/executor.d.ts +100 -0
  756. package/v3/@aiyou-dev/shared/dist/hooks/executor.js +264 -0
  757. package/v3/@aiyou-dev/shared/dist/hooks/hooks.test.d.ts +9 -0
  758. package/v3/@aiyou-dev/shared/dist/hooks/hooks.test.js +322 -0
  759. package/v3/@aiyou-dev/shared/dist/hooks/index.d.ts +52 -0
  760. package/v3/@aiyou-dev/shared/dist/hooks/index.js +51 -0
  761. package/v3/@aiyou-dev/shared/dist/hooks/registry.d.ts +133 -0
  762. package/v3/@aiyou-dev/shared/dist/hooks/registry.js +277 -0
  763. package/v3/@aiyou-dev/shared/dist/hooks/safety/bash-safety.d.ts +105 -0
  764. package/v3/@aiyou-dev/shared/dist/hooks/safety/bash-safety.js +481 -0
  765. package/v3/@aiyou-dev/shared/dist/hooks/safety/file-organization.d.ts +144 -0
  766. package/v3/@aiyou-dev/shared/dist/hooks/safety/file-organization.js +328 -0
  767. package/v3/@aiyou-dev/shared/dist/hooks/safety/git-commit.d.ts +158 -0
  768. package/v3/@aiyou-dev/shared/dist/hooks/safety/git-commit.js +450 -0
  769. package/v3/@aiyou-dev/shared/dist/hooks/safety/index.d.ts +17 -0
  770. package/v3/@aiyou-dev/shared/dist/hooks/safety/index.js +17 -0
  771. package/v3/@aiyou-dev/shared/dist/hooks/session-hooks.d.ts +234 -0
  772. package/v3/@aiyou-dev/shared/dist/hooks/session-hooks.js +334 -0
  773. package/v3/@aiyou-dev/shared/dist/hooks/task-hooks.d.ts +163 -0
  774. package/v3/@aiyou-dev/shared/dist/hooks/task-hooks.js +326 -0
  775. package/v3/@aiyou-dev/shared/dist/hooks/types.d.ts +267 -0
  776. package/v3/@aiyou-dev/shared/dist/hooks/types.js +62 -0
  777. package/v3/@aiyou-dev/shared/dist/hooks/verify-exports.test.d.ts +9 -0
  778. package/v3/@aiyou-dev/shared/dist/hooks/verify-exports.test.js +93 -0
  779. package/v3/@aiyou-dev/shared/dist/index.d.ts +20 -0
  780. package/v3/@aiyou-dev/shared/dist/index.js +50 -0
  781. package/v3/@aiyou-dev/shared/dist/mcp/connection-pool.d.ts +98 -0
  782. package/v3/@aiyou-dev/shared/dist/mcp/connection-pool.js +364 -0
  783. package/v3/@aiyou-dev/shared/dist/mcp/index.d.ts +69 -0
  784. package/v3/@aiyou-dev/shared/dist/mcp/index.js +84 -0
  785. package/v3/@aiyou-dev/shared/dist/mcp/server.d.ts +166 -0
  786. package/v3/@aiyou-dev/shared/dist/mcp/server.js +593 -0
  787. package/v3/@aiyou-dev/shared/dist/mcp/session-manager.d.ts +136 -0
  788. package/v3/@aiyou-dev/shared/dist/mcp/session-manager.js +335 -0
  789. package/v3/@aiyou-dev/shared/dist/mcp/tool-registry.d.ts +178 -0
  790. package/v3/@aiyou-dev/shared/dist/mcp/tool-registry.js +439 -0
  791. package/v3/@aiyou-dev/shared/dist/mcp/transport/http.d.ts +104 -0
  792. package/v3/@aiyou-dev/shared/dist/mcp/transport/http.js +476 -0
  793. package/v3/@aiyou-dev/shared/dist/mcp/transport/index.d.ts +102 -0
  794. package/v3/@aiyou-dev/shared/dist/mcp/transport/index.js +238 -0
  795. package/v3/@aiyou-dev/shared/dist/mcp/transport/stdio.d.ts +104 -0
  796. package/v3/@aiyou-dev/shared/dist/mcp/transport/stdio.js +263 -0
  797. package/v3/@aiyou-dev/shared/dist/mcp/transport/websocket.d.ts +133 -0
  798. package/v3/@aiyou-dev/shared/dist/mcp/transport/websocket.js +396 -0
  799. package/v3/@aiyou-dev/shared/dist/mcp/types.d.ts +438 -0
  800. package/v3/@aiyou-dev/shared/dist/mcp/types.js +54 -0
  801. package/v3/@aiyou-dev/shared/dist/plugin-interface.d.ts +544 -0
  802. package/v3/@aiyou-dev/shared/dist/plugin-interface.js +23 -0
  803. package/v3/@aiyou-dev/shared/dist/plugin-loader.d.ts +139 -0
  804. package/v3/@aiyou-dev/shared/dist/plugin-loader.js +434 -0
  805. package/v3/@aiyou-dev/shared/dist/plugin-registry.d.ts +183 -0
  806. package/v3/@aiyou-dev/shared/dist/plugin-registry.js +457 -0
  807. package/v3/@aiyou-dev/shared/dist/plugins/index.d.ts +10 -0
  808. package/v3/@aiyou-dev/shared/dist/plugins/index.js +10 -0
  809. package/v3/@aiyou-dev/shared/dist/plugins/official/hive-mind-plugin.d.ts +106 -0
  810. package/v3/@aiyou-dev/shared/dist/plugins/official/hive-mind-plugin.js +241 -0
  811. package/v3/@aiyou-dev/shared/dist/plugins/official/index.d.ts +10 -0
  812. package/v3/@aiyou-dev/shared/dist/plugins/official/index.js +10 -0
  813. package/v3/@aiyou-dev/shared/dist/plugins/official/maestro-plugin.d.ts +121 -0
  814. package/v3/@aiyou-dev/shared/dist/plugins/official/maestro-plugin.js +355 -0
  815. package/v3/@aiyou-dev/shared/dist/plugins/types.d.ts +93 -0
  816. package/v3/@aiyou-dev/shared/dist/plugins/types.js +9 -0
  817. package/v3/@aiyou-dev/shared/dist/resilience/bulkhead.d.ts +105 -0
  818. package/v3/@aiyou-dev/shared/dist/resilience/bulkhead.js +206 -0
  819. package/v3/@aiyou-dev/shared/dist/resilience/circuit-breaker.d.ts +132 -0
  820. package/v3/@aiyou-dev/shared/dist/resilience/circuit-breaker.js +233 -0
  821. package/v3/@aiyou-dev/shared/dist/resilience/index.d.ts +19 -0
  822. package/v3/@aiyou-dev/shared/dist/resilience/index.js +19 -0
  823. package/v3/@aiyou-dev/shared/dist/resilience/rate-limiter.d.ts +168 -0
  824. package/v3/@aiyou-dev/shared/dist/resilience/rate-limiter.js +314 -0
  825. package/v3/@aiyou-dev/shared/dist/resilience/retry.d.ts +91 -0
  826. package/v3/@aiyou-dev/shared/dist/resilience/retry.js +159 -0
  827. package/v3/@aiyou-dev/shared/dist/security/index.d.ts +10 -0
  828. package/v3/@aiyou-dev/shared/dist/security/index.js +12 -0
  829. package/v3/@aiyou-dev/shared/dist/security/input-validation.d.ts +73 -0
  830. package/v3/@aiyou-dev/shared/dist/security/input-validation.js +201 -0
  831. package/v3/@aiyou-dev/shared/dist/security/secure-random.d.ts +92 -0
  832. package/v3/@aiyou-dev/shared/dist/security/secure-random.js +142 -0
  833. package/v3/@aiyou-dev/shared/dist/services/index.d.ts +7 -0
  834. package/v3/@aiyou-dev/shared/dist/services/index.js +7 -0
  835. package/v3/@aiyou-dev/shared/dist/services/v3-progress.service.d.ts +124 -0
  836. package/v3/@aiyou-dev/shared/dist/services/v3-progress.service.js +402 -0
  837. package/v3/@aiyou-dev/shared/dist/types/agent.types.d.ts +137 -0
  838. package/v3/@aiyou-dev/shared/dist/types/agent.types.js +6 -0
  839. package/v3/@aiyou-dev/shared/dist/types/index.d.ts +11 -0
  840. package/v3/@aiyou-dev/shared/dist/types/index.js +17 -0
  841. package/v3/@aiyou-dev/shared/dist/types/mcp.types.d.ts +266 -0
  842. package/v3/@aiyou-dev/shared/dist/types/mcp.types.js +7 -0
  843. package/v3/@aiyou-dev/shared/dist/types/memory.types.d.ts +236 -0
  844. package/v3/@aiyou-dev/shared/dist/types/memory.types.js +7 -0
  845. package/v3/@aiyou-dev/shared/dist/types/swarm.types.d.ts +186 -0
  846. package/v3/@aiyou-dev/shared/dist/types/swarm.types.js +65 -0
  847. package/v3/@aiyou-dev/shared/dist/types/task.types.d.ts +178 -0
  848. package/v3/@aiyou-dev/shared/dist/types/task.types.js +32 -0
  849. package/v3/@aiyou-dev/shared/dist/types.d.ts +197 -0
  850. package/v3/@aiyou-dev/shared/dist/types.js +21 -0
  851. package/v3/@aiyou-dev/shared/dist/utils/secure-logger.d.ts +69 -0
  852. package/v3/@aiyou-dev/shared/dist/utils/secure-logger.js +208 -0
  853. package/v3/@aiyou-dev/shared/package.json +42 -0
@@ -0,0 +1,1767 @@
1
+ /**
2
+ * Init Executor
3
+ * Main execution logic for V3 initialization
4
+ */
5
+ import * as fs from 'fs';
6
+ import * as path from 'path';
7
+ import { fileURLToPath } from 'url';
8
+ import { createRequire } from 'module';
9
+ import { dirname } from 'path';
10
+ // ESM-compatible __dirname
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+ import { detectPlatform, DEFAULT_INIT_OPTIONS } from './types.js';
14
+ import { generateSettingsJson, generateSettings } from './settings-generator.js';
15
+ import { generateMCPJson } from './mcp-generator.js';
16
+ import { generateStatuslineScript } from './statusline-generator.js';
17
+ import { generatePreCommitHook, generatePostCommitHook, generateSessionManager, generateAgentRouter, generateMemoryHelper, generateHookHandler, generateIntelligenceStub, generateAutoMemoryHook, } from './helpers-generator.js';
18
+ import { generateClaudeMd } from './claudemd-generator.js';
19
+ import { generateGeminiMd } from './geminimd-generator.js';
20
+ import { configureGeminiMCP } from './gemini-config-generator.js';
21
+ /**
22
+ * Skills to copy based on configuration
23
+ */
24
+ const SKILLS_MAP = {
25
+ core: [
26
+ 'swarm-orchestration',
27
+ 'swarm-advanced',
28
+ 'sparc-methodology',
29
+ 'hooks-automation',
30
+ 'pair-programming',
31
+ 'verification-quality',
32
+ 'stream-chain',
33
+ 'skill-builder',
34
+ ],
35
+ browser: ['browser'], // agent-browser integration
36
+ dualMode: ['dual-mode'], // Claude Code + Codex hybrid execution
37
+ agentdb: [
38
+ 'agentdb-advanced',
39
+ 'agentdb-learning',
40
+ 'agentdb-memory-patterns',
41
+ 'agentdb-optimization',
42
+ 'agentdb-vector-search',
43
+ 'reasoningbank-agentdb',
44
+ 'reasoningbank-intelligence',
45
+ ],
46
+ github: [
47
+ 'github-code-review',
48
+ 'github-multi-repo',
49
+ 'github-project-management',
50
+ 'github-release-management',
51
+ 'github-workflow-automation',
52
+ ],
53
+ flowNexus: [
54
+ 'flow-nexus-neural',
55
+ 'flow-nexus-platform',
56
+ 'flow-nexus-swarm',
57
+ ],
58
+ v3: [
59
+ 'v3-cli-modernization',
60
+ 'v3-core-implementation',
61
+ 'v3-ddd-architecture',
62
+ 'v3-integration-deep',
63
+ 'v3-mcp-optimization',
64
+ 'v3-memory-unification',
65
+ 'v3-performance-optimization',
66
+ 'v3-security-overhaul',
67
+ 'v3-swarm-coordination',
68
+ ],
69
+ };
70
+ /**
71
+ * Commands to copy based on configuration
72
+ */
73
+ const COMMANDS_MAP = {
74
+ core: ['aiyou-dev-help.md', 'aiyou-dev-swarm.md', 'aiyou-dev-memory.md'],
75
+ analysis: ['analysis'],
76
+ automation: ['automation'],
77
+ github: ['github'],
78
+ hooks: ['hooks'],
79
+ monitoring: ['monitoring'],
80
+ optimization: ['optimization'],
81
+ sparc: ['sparc'],
82
+ };
83
+ /**
84
+ * Agents to copy based on configuration
85
+ */
86
+ const AGENTS_MAP = {
87
+ core: ['core'],
88
+ consensus: ['consensus'],
89
+ github: ['github'],
90
+ hiveMind: ['hive-mind'],
91
+ sparc: ['sparc'],
92
+ swarm: ['swarm'],
93
+ browser: ['browser'], // agent-browser integration
94
+ dualMode: ['dual-mode'], // Claude Code + Codex hybrid execution
95
+ // V3-specific agents
96
+ v3: ['v3'],
97
+ optimization: ['optimization'],
98
+ templates: ['templates'],
99
+ testing: ['testing'],
100
+ sublinear: ['sublinear'],
101
+ flowNexus: ['flow-nexus'],
102
+ analysis: ['analysis'],
103
+ architecture: ['architecture'],
104
+ development: ['development'],
105
+ devops: ['devops'],
106
+ documentation: ['documentation'],
107
+ specialized: ['specialized'],
108
+ goal: ['goal'],
109
+ sona: ['sona'],
110
+ payments: ['payments'],
111
+ data: ['data'],
112
+ custom: ['custom'],
113
+ };
114
+ /**
115
+ * Directory structure to create
116
+ */
117
+ const DIRECTORIES = {
118
+ claude: [
119
+ '.claude',
120
+ '.claude/skills',
121
+ '.claude/commands',
122
+ '.claude/agents',
123
+ '.claude/helpers',
124
+ ],
125
+ runtime: [
126
+ '.aiyou-dev',
127
+ '.aiyou-dev/data',
128
+ '.aiyou-dev/logs',
129
+ '.aiyou-dev/sessions',
130
+ '.aiyou-dev/hooks',
131
+ '.aiyou-dev/agents',
132
+ '.aiyou-dev/workflows',
133
+ ],
134
+ };
135
+ /**
136
+ * Execute initialization
137
+ */
138
+ export async function executeInit(options) {
139
+ // Detect platform
140
+ const platform = detectPlatform();
141
+ const result = {
142
+ success: true,
143
+ platform,
144
+ created: {
145
+ directories: [],
146
+ files: [],
147
+ },
148
+ skipped: [],
149
+ errors: [],
150
+ summary: {
151
+ skillsCount: 0,
152
+ commandsCount: 0,
153
+ agentsCount: 0,
154
+ hooksEnabled: 0,
155
+ },
156
+ };
157
+ const targetDir = options.targetDir;
158
+ try {
159
+ // Create directory structure
160
+ await createDirectories(targetDir, options, result);
161
+ // Generate and write settings.json
162
+ if (options.components.settings) {
163
+ await writeSettings(targetDir, options, result);
164
+ }
165
+ // Generate and write .mcp.json
166
+ if (options.components.mcp) {
167
+ await writeMCPConfig(targetDir, options, result);
168
+ }
169
+ // Copy skills
170
+ if (options.components.skills) {
171
+ await copySkills(targetDir, options, result);
172
+ }
173
+ // Copy commands
174
+ if (options.components.commands) {
175
+ await copyCommands(targetDir, options, result);
176
+ }
177
+ // Copy agents
178
+ if (options.components.agents) {
179
+ await copyAgents(targetDir, options, result);
180
+ }
181
+ // Generate helpers
182
+ if (options.components.helpers) {
183
+ await writeHelpers(targetDir, options, result);
184
+ }
185
+ // Generate statusline
186
+ if (options.components.statusline) {
187
+ await writeStatusline(targetDir, options, result);
188
+ }
189
+ // Generate runtime config
190
+ if (options.components.runtime) {
191
+ await writeRuntimeConfig(targetDir, options, result);
192
+ }
193
+ // Create initial metrics for statusline (prevents "all zeros" display)
194
+ if (options.components.statusline) {
195
+ await writeInitialMetrics(targetDir, options, result);
196
+ }
197
+ // Generate instruction files based on target
198
+ if (options.components.claudeMd) {
199
+ const target = options.target || 'all';
200
+ if (target === 'claude' || target === 'all') {
201
+ await writeClaudeMd(targetDir, options, result);
202
+ }
203
+ if (target === 'gemini' || target === 'all') {
204
+ await writeGeminiMd(targetDir, options, result);
205
+ const geminiResult = configureGeminiMCP({ force: options.force });
206
+ if (geminiResult.success) {
207
+ result.created.files.push(geminiResult.path);
208
+ }
209
+ }
210
+ }
211
+ // Count enabled hooks
212
+ result.summary.hooksEnabled = countEnabledHooks(options);
213
+ }
214
+ catch (error) {
215
+ result.success = false;
216
+ result.errors.push(error instanceof Error ? error.message : String(error));
217
+ }
218
+ return result;
219
+ }
220
+ /**
221
+ * Merge new settings into existing settings.json
222
+ * Preserves user customizations while adding new features like Agent Teams
223
+ * Uses platform-specific commands for Mac, Linux, and Windows
224
+ */
225
+ function mergeSettingsForUpgrade(existing) {
226
+ const merged = { ...existing };
227
+ const platform = detectPlatform();
228
+ const isWindows = platform.os === 'windows';
229
+ // Platform-specific command wrappers
230
+ // Windows: Use PowerShell-compatible commands
231
+ // Mac/Linux: Use bash-compatible commands with 2>/dev/null
232
+ // NOTE: teammateIdleCmd and taskCompletedCmd were removed.
233
+ // TeammateIdle/TaskCompleted are not valid Claude Code hook events and caused warnings.
234
+ // Agent Teams hook config lives in claudeFlow.agentTeams.hooks instead.
235
+ // 1. Merge env vars (preserve existing, add new)
236
+ const existingEnv = existing.env || {};
237
+ merged.env = {
238
+ ...existingEnv,
239
+ CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1',
240
+ CLAUDE_FLOW_V3_ENABLED: existingEnv.CLAUDE_FLOW_V3_ENABLED || 'true',
241
+ CLAUDE_FLOW_HOOKS_ENABLED: existingEnv.CLAUDE_FLOW_HOOKS_ENABLED || 'true',
242
+ };
243
+ // 2. Merge hooks (preserve existing, add new Agent Teams + auto-memory hooks)
244
+ const existingHooks = existing.hooks || {};
245
+ merged.hooks = { ...existingHooks };
246
+ // Cross-platform auto-memory hook commands that resolve paths via git root.
247
+ // Uses node -e with git rev-parse so hooks work regardless of CWD (#1259, #1284).
248
+ const gitRootResolver = "var c=require('child_process'),p=require('path'),u=require('url'),r;"
249
+ + "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}"
250
+ + 'catch(e){r=process.cwd()}';
251
+ const autoMemoryScript = '.claude/helpers/auto-memory-hook.mjs';
252
+ const autoMemoryImportCmd = `node -e "${gitRootResolver}var f=p.join(r,'${autoMemoryScript}');import(u.pathToFileURL(f).href)" import`;
253
+ const autoMemorySyncCmd = `node -e "${gitRootResolver}var f=p.join(r,'${autoMemoryScript}');import(u.pathToFileURL(f).href)" sync`;
254
+ // Add auto-memory import to SessionStart (if not already present)
255
+ const sessionStartHooks = existingHooks.SessionStart;
256
+ const hasAutoMemoryImport = sessionStartHooks?.some(group => group.hooks?.some(h => h.command?.includes('auto-memory-hook')));
257
+ if (!hasAutoMemoryImport) {
258
+ const startHooks = merged.hooks;
259
+ if (!startHooks.SessionStart) {
260
+ startHooks.SessionStart = [{ hooks: [] }];
261
+ }
262
+ const startGroup = startHooks.SessionStart[0];
263
+ if (!startGroup.hooks)
264
+ startGroup.hooks = [];
265
+ startGroup.hooks.push({
266
+ type: 'command',
267
+ command: autoMemoryImportCmd,
268
+ timeout: 6000,
269
+ continueOnError: true,
270
+ });
271
+ }
272
+ // Add auto-memory sync to SessionEnd (if not already present)
273
+ const sessionEndHooks = existingHooks.SessionEnd;
274
+ const hasAutoMemorySync = sessionEndHooks?.some(group => group.hooks?.some(h => h.command?.includes('auto-memory-hook')));
275
+ if (!hasAutoMemorySync) {
276
+ const endHooks = merged.hooks;
277
+ if (!endHooks.SessionEnd) {
278
+ endHooks.SessionEnd = [{ hooks: [] }];
279
+ }
280
+ const endGroup = endHooks.SessionEnd[0];
281
+ if (!endGroup.hooks)
282
+ endGroup.hooks = [];
283
+ // Insert at beginning so sync runs before other cleanup
284
+ endGroup.hooks.unshift({
285
+ type: 'command',
286
+ command: autoMemorySyncCmd,
287
+ timeout: 8000,
288
+ continueOnError: true,
289
+ });
290
+ }
291
+ // NOTE: TeammateIdle and TaskCompleted are NOT valid Claude Code hook events.
292
+ // They cause warnings when present in settings.json hooks.
293
+ // Remove them if they exist from a previous init.
294
+ delete merged.hooks.TeammateIdle;
295
+ delete merged.hooks.TaskCompleted;
296
+ // Their configuration lives in claudeFlow.agentTeams.hooks instead.
297
+ // 3. Fix statusLine config (remove invalid fields, ensure correct format)
298
+ // Claude Code only supports: type, command, padding
299
+ const existingStatusLine = existing.statusLine;
300
+ if (existingStatusLine) {
301
+ merged.statusLine = {
302
+ type: 'command',
303
+ command: existingStatusLine.command || `node -e "var c=require('child_process'),p=require('path'),r;try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}catch(e){r=process.cwd()}var s=p.join(r,'.claude/helpers/statusline.cjs');process.argv.splice(1,0,s);require(s)"`,
304
+ // Remove invalid fields: refreshMs, enabled (not supported by Claude Code)
305
+ };
306
+ }
307
+ // 4. Merge claudeFlow settings (preserve existing, add agentTeams + memory)
308
+ const existingClaudeFlow = existing.claudeFlow || {};
309
+ const existingMemory = existingClaudeFlow.memory || {};
310
+ merged.claudeFlow = {
311
+ ...existingClaudeFlow,
312
+ version: existingClaudeFlow.version || '3.0.0',
313
+ enabled: existingClaudeFlow.enabled !== false,
314
+ agentTeams: {
315
+ enabled: true,
316
+ teammateMode: 'auto',
317
+ taskListEnabled: true,
318
+ mailboxEnabled: true,
319
+ coordination: {
320
+ autoAssignOnIdle: true,
321
+ trainPatternsOnComplete: true,
322
+ notifyLeadOnComplete: true,
323
+ sharedMemoryNamespace: 'agent-teams',
324
+ },
325
+ hooks: {
326
+ teammateIdle: { enabled: true, autoAssign: true, checkTaskList: true },
327
+ taskCompleted: { enabled: true, trainPatterns: true, notifyLead: true },
328
+ },
329
+ },
330
+ memory: {
331
+ ...existingMemory,
332
+ learningBridge: existingMemory.learningBridge ?? { enabled: true },
333
+ memoryGraph: existingMemory.memoryGraph ?? { enabled: true },
334
+ agentScopes: existingMemory.agentScopes ?? { enabled: true },
335
+ },
336
+ };
337
+ return merged;
338
+ }
339
+ /**
340
+ * Execute upgrade - updates helpers and creates missing metrics without losing data
341
+ * This is safe for existing users who want the latest statusline fixes
342
+ * @param targetDir - Target directory
343
+ * @param upgradeSettings - If true, merge new settings into existing settings.json
344
+ */
345
+ export async function executeUpgrade(targetDir, upgradeSettings = false) {
346
+ const result = {
347
+ success: true,
348
+ updated: [],
349
+ created: [],
350
+ preserved: [],
351
+ errors: [],
352
+ settingsUpdated: [],
353
+ };
354
+ try {
355
+ // Ensure required directories exist
356
+ const dirs = [
357
+ '.claude/helpers',
358
+ '.aiyou-dev/metrics',
359
+ '.aiyou-dev/security',
360
+ '.aiyou-dev/learning',
361
+ ];
362
+ for (const dir of dirs) {
363
+ const fullPath = path.join(targetDir, dir);
364
+ if (!fs.existsSync(fullPath)) {
365
+ fs.mkdirSync(fullPath, { recursive: true });
366
+ }
367
+ }
368
+ // 0. ALWAYS update critical helpers (force overwrite)
369
+ const sourceHelpersForUpgrade = findSourceHelpersDir();
370
+ if (sourceHelpersForUpgrade) {
371
+ const criticalHelpers = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs'];
372
+ for (const helperName of criticalHelpers) {
373
+ const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
374
+ const sourcePath = path.join(sourceHelpersForUpgrade, helperName);
375
+ if (fs.existsSync(sourcePath)) {
376
+ if (fs.existsSync(targetPath)) {
377
+ result.updated.push(`.claude/helpers/${helperName}`);
378
+ }
379
+ else {
380
+ result.created.push(`.claude/helpers/${helperName}`);
381
+ }
382
+ fs.copyFileSync(sourcePath, targetPath);
383
+ try {
384
+ fs.chmodSync(targetPath, '755');
385
+ }
386
+ catch { }
387
+ }
388
+ }
389
+ }
390
+ else {
391
+ // Source not found (npx with broken paths) — use generated fallbacks
392
+ const generatedCritical = {
393
+ 'hook-handler.cjs': generateHookHandler(),
394
+ 'intelligence.cjs': generateIntelligenceStub(),
395
+ 'auto-memory-hook.mjs': generateAutoMemoryHook(),
396
+ };
397
+ for (const [helperName, content] of Object.entries(generatedCritical)) {
398
+ const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
399
+ if (fs.existsSync(targetPath)) {
400
+ result.updated.push(`.claude/helpers/${helperName}`);
401
+ }
402
+ else {
403
+ result.created.push(`.claude/helpers/${helperName}`);
404
+ }
405
+ fs.writeFileSync(targetPath, content, 'utf-8');
406
+ try {
407
+ fs.chmodSync(targetPath, '755');
408
+ }
409
+ catch { }
410
+ }
411
+ }
412
+ // 1. ALWAYS update statusline helper (force overwrite)
413
+ const statuslinePath = path.join(targetDir, '.claude', 'helpers', 'statusline.cjs');
414
+ // Use default options with statusline config
415
+ const upgradeOptions = {
416
+ ...DEFAULT_INIT_OPTIONS,
417
+ targetDir,
418
+ force: true,
419
+ statusline: {
420
+ ...DEFAULT_INIT_OPTIONS.statusline,
421
+ refreshInterval: 5000,
422
+ },
423
+ };
424
+ const statuslineContent = generateStatuslineScript(upgradeOptions);
425
+ if (fs.existsSync(statuslinePath)) {
426
+ result.updated.push('.claude/helpers/statusline.cjs');
427
+ }
428
+ else {
429
+ result.created.push('.claude/helpers/statusline.cjs');
430
+ }
431
+ fs.writeFileSync(statuslinePath, statuslineContent, 'utf-8');
432
+ // 2. Create MISSING metrics files only (preserve existing data)
433
+ const metricsDir = path.join(targetDir, '.aiyou-dev', 'metrics');
434
+ const securityDir = path.join(targetDir, '.aiyou-dev', 'security');
435
+ // v3-progress.json
436
+ const progressPath = path.join(metricsDir, 'v3-progress.json');
437
+ if (!fs.existsSync(progressPath)) {
438
+ const progress = {
439
+ version: '3.0.0',
440
+ initialized: new Date().toISOString(),
441
+ domains: { completed: 0, total: 5, status: 'INITIALIZING' },
442
+ ddd: { progress: 0, modules: 0, totalFiles: 0, totalLines: 0 },
443
+ swarm: { activeAgents: 0, maxAgents: 15, topology: 'hierarchical-mesh' },
444
+ learning: { status: 'READY', patternsLearned: 0, sessionsCompleted: 0 },
445
+ _note: 'Metrics will update as you use Claude Flow'
446
+ };
447
+ fs.writeFileSync(progressPath, JSON.stringify(progress, null, 2), 'utf-8');
448
+ result.created.push('.aiyou-dev/metrics/v3-progress.json');
449
+ }
450
+ else {
451
+ result.preserved.push('.aiyou-dev/metrics/v3-progress.json');
452
+ }
453
+ // swarm-activity.json
454
+ const activityPath = path.join(metricsDir, 'swarm-activity.json');
455
+ if (!fs.existsSync(activityPath)) {
456
+ const activity = {
457
+ timestamp: new Date().toISOString(),
458
+ processes: { agentic_flow: 0, mcp_server: 0, estimated_agents: 0 },
459
+ swarm: { active: false, agent_count: 0, coordination_active: false },
460
+ integration: { agentic_flow_active: false, mcp_active: false },
461
+ _initialized: true
462
+ };
463
+ fs.writeFileSync(activityPath, JSON.stringify(activity, null, 2), 'utf-8');
464
+ result.created.push('.aiyou-dev/metrics/swarm-activity.json');
465
+ }
466
+ else {
467
+ result.preserved.push('.aiyou-dev/metrics/swarm-activity.json');
468
+ }
469
+ // learning.json
470
+ const learningPath = path.join(metricsDir, 'learning.json');
471
+ if (!fs.existsSync(learningPath)) {
472
+ const learning = {
473
+ initialized: new Date().toISOString(),
474
+ routing: { accuracy: 0, decisions: 0 },
475
+ patterns: { shortTerm: 0, longTerm: 0, quality: 0 },
476
+ sessions: { total: 0, current: null },
477
+ _note: 'Intelligence grows as you use Claude Flow'
478
+ };
479
+ fs.writeFileSync(learningPath, JSON.stringify(learning, null, 2), 'utf-8');
480
+ result.created.push('.aiyou-dev/metrics/learning.json');
481
+ }
482
+ else {
483
+ result.preserved.push('.aiyou-dev/metrics/learning.json');
484
+ }
485
+ // audit-status.json
486
+ const auditPath = path.join(securityDir, 'audit-status.json');
487
+ if (!fs.existsSync(auditPath)) {
488
+ const audit = {
489
+ initialized: new Date().toISOString(),
490
+ status: 'PENDING',
491
+ cvesFixed: 0,
492
+ totalCves: 3,
493
+ lastScan: null,
494
+ _note: 'Run: npx @aiyou-dev/cli@latest security scan'
495
+ };
496
+ fs.writeFileSync(auditPath, JSON.stringify(audit, null, 2), 'utf-8');
497
+ result.created.push('.aiyou-dev/security/audit-status.json');
498
+ }
499
+ else {
500
+ result.preserved.push('.aiyou-dev/security/audit-status.json');
501
+ }
502
+ // 3. Merge settings if requested
503
+ if (upgradeSettings) {
504
+ const settingsPath = path.join(targetDir, '.claude', 'settings.json');
505
+ if (fs.existsSync(settingsPath)) {
506
+ try {
507
+ const existingSettings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
508
+ const mergedSettings = mergeSettingsForUpgrade(existingSettings);
509
+ fs.writeFileSync(settingsPath, JSON.stringify(mergedSettings, null, 2), 'utf-8');
510
+ result.updated.push('.claude/settings.json');
511
+ result.settingsUpdated = [
512
+ 'env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS',
513
+ 'hooks.SessionStart (auto-memory import)',
514
+ 'hooks.SessionEnd (auto-memory sync)',
515
+ 'hooks.TeammateIdle (removed — not a valid Claude Code hook)',
516
+ 'hooks.TaskCompleted (removed — not a valid Claude Code hook)',
517
+ 'claudeFlow.agentTeams',
518
+ 'claudeFlow.memory (learningBridge, memoryGraph, agentScopes)',
519
+ ];
520
+ }
521
+ catch (settingsError) {
522
+ result.errors.push(`Settings merge failed: ${settingsError instanceof Error ? settingsError.message : String(settingsError)}`);
523
+ }
524
+ }
525
+ else {
526
+ // Create new settings.json with defaults
527
+ const defaultSettings = generateSettings(DEFAULT_INIT_OPTIONS);
528
+ fs.writeFileSync(settingsPath, JSON.stringify(defaultSettings, null, 2), 'utf-8');
529
+ result.created.push('.claude/settings.json');
530
+ result.settingsUpdated = ['Created new settings.json with Agent Teams'];
531
+ }
532
+ }
533
+ }
534
+ catch (error) {
535
+ result.success = false;
536
+ result.errors.push(error instanceof Error ? error.message : String(error));
537
+ }
538
+ return result;
539
+ }
540
+ /**
541
+ * Execute upgrade with --add-missing flag
542
+ * Adds any new skills, agents, and commands that don't exist yet
543
+ * @param targetDir - Target directory
544
+ * @param upgradeSettings - If true, merge new settings into existing settings.json
545
+ */
546
+ export async function executeUpgradeWithMissing(targetDir, upgradeSettings = false) {
547
+ // First do the normal upgrade (pass through upgradeSettings)
548
+ const result = await executeUpgrade(targetDir, upgradeSettings);
549
+ if (!result.success) {
550
+ return result;
551
+ }
552
+ // Initialize tracking arrays
553
+ result.addedSkills = [];
554
+ result.addedAgents = [];
555
+ result.addedCommands = [];
556
+ try {
557
+ // Ensure target directories exist
558
+ const skillsDir = path.join(targetDir, '.claude', 'skills');
559
+ const agentsDir = path.join(targetDir, '.claude', 'agents');
560
+ const commandsDir = path.join(targetDir, '.claude', 'commands');
561
+ for (const dir of [skillsDir, agentsDir, commandsDir]) {
562
+ if (!fs.existsSync(dir)) {
563
+ fs.mkdirSync(dir, { recursive: true });
564
+ }
565
+ }
566
+ // Find source directories
567
+ const sourceSkillsDir = findSourceDir('skills');
568
+ const sourceAgentsDir = findSourceDir('agents');
569
+ const sourceCommandsDir = findSourceDir('commands');
570
+ // Debug: Log source directories found
571
+ if (process.env.DEBUG || process.env.CLAUDE_FLOW_DEBUG) {
572
+ console.log('[DEBUG] Source directories:');
573
+ console.log(` Skills: ${sourceSkillsDir || 'NOT FOUND'}`);
574
+ console.log(` Agents: ${sourceAgentsDir || 'NOT FOUND'}`);
575
+ console.log(` Commands: ${sourceCommandsDir || 'NOT FOUND'}`);
576
+ }
577
+ // Add missing skills
578
+ if (sourceSkillsDir) {
579
+ const allSkills = Object.values(SKILLS_MAP).flat();
580
+ const debugMode = process.env.DEBUG || process.env.CLAUDE_FLOW_DEBUG;
581
+ if (debugMode) {
582
+ console.log(`[DEBUG] Checking ${allSkills.length} skills from SKILLS_MAP`);
583
+ }
584
+ for (const skillName of [...new Set(allSkills)]) {
585
+ const sourcePath = path.join(sourceSkillsDir, skillName);
586
+ const targetPath = path.join(skillsDir, skillName);
587
+ const sourceExists = fs.existsSync(sourcePath);
588
+ const targetExists = fs.existsSync(targetPath);
589
+ if (debugMode) {
590
+ console.log(`[DEBUG] Skill '${skillName}': source=${sourceExists}, target=${targetExists}`);
591
+ }
592
+ if (sourceExists && !targetExists) {
593
+ copyDirRecursive(sourcePath, targetPath);
594
+ result.addedSkills.push(skillName);
595
+ result.created.push(`.claude/skills/${skillName}`);
596
+ }
597
+ }
598
+ }
599
+ // Add missing agents
600
+ if (sourceAgentsDir) {
601
+ const allAgents = Object.values(AGENTS_MAP).flat();
602
+ for (const agentCategory of [...new Set(allAgents)]) {
603
+ const sourcePath = path.join(sourceAgentsDir, agentCategory);
604
+ const targetPath = path.join(agentsDir, agentCategory);
605
+ if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
606
+ copyDirRecursive(sourcePath, targetPath);
607
+ result.addedAgents.push(agentCategory);
608
+ result.created.push(`.claude/agents/${agentCategory}`);
609
+ }
610
+ }
611
+ }
612
+ // Add missing commands
613
+ if (sourceCommandsDir) {
614
+ const allCommands = Object.values(COMMANDS_MAP).flat();
615
+ for (const cmdName of [...new Set(allCommands)]) {
616
+ const sourcePath = path.join(sourceCommandsDir, cmdName);
617
+ const targetPath = path.join(commandsDir, cmdName);
618
+ if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
619
+ if (fs.statSync(sourcePath).isDirectory()) {
620
+ copyDirRecursive(sourcePath, targetPath);
621
+ }
622
+ else {
623
+ fs.copyFileSync(sourcePath, targetPath);
624
+ }
625
+ result.addedCommands.push(cmdName);
626
+ result.created.push(`.claude/commands/${cmdName}`);
627
+ }
628
+ }
629
+ }
630
+ }
631
+ catch (error) {
632
+ result.errors.push(`Add missing failed: ${error instanceof Error ? error.message : String(error)}`);
633
+ }
634
+ return result;
635
+ }
636
+ /**
637
+ * Create directory structure
638
+ */
639
+ async function createDirectories(targetDir, options, result) {
640
+ const dirs = [
641
+ ...DIRECTORIES.claude,
642
+ ...(options.components.runtime ? DIRECTORIES.runtime : []),
643
+ ];
644
+ for (const dir of dirs) {
645
+ const fullPath = path.join(targetDir, dir);
646
+ if (!fs.existsSync(fullPath)) {
647
+ fs.mkdirSync(fullPath, { recursive: true });
648
+ result.created.directories.push(dir);
649
+ }
650
+ }
651
+ }
652
+ /**
653
+ * Write settings.json
654
+ */
655
+ async function writeSettings(targetDir, options, result) {
656
+ const settingsPath = path.join(targetDir, '.claude', 'settings.json');
657
+ if (fs.existsSync(settingsPath) && !options.force) {
658
+ result.skipped.push('.claude/settings.json');
659
+ return;
660
+ }
661
+ const content = generateSettingsJson(options);
662
+ fs.writeFileSync(settingsPath, content, 'utf-8');
663
+ result.created.files.push('.claude/settings.json');
664
+ }
665
+ /**
666
+ * Write .mcp.json
667
+ */
668
+ async function writeMCPConfig(targetDir, options, result) {
669
+ const mcpPath = path.join(targetDir, '.mcp.json');
670
+ if (fs.existsSync(mcpPath) && !options.force) {
671
+ result.skipped.push('.mcp.json');
672
+ return;
673
+ }
674
+ const content = generateMCPJson(options);
675
+ fs.writeFileSync(mcpPath, content, 'utf-8');
676
+ result.created.files.push('.mcp.json');
677
+ }
678
+ /**
679
+ * Copy skills from source
680
+ */
681
+ async function copySkills(targetDir, options, result) {
682
+ const skillsConfig = options.skills;
683
+ const targetSkillsDir = path.join(targetDir, '.claude', 'skills');
684
+ // Determine which skills to copy
685
+ const skillsToCopy = [];
686
+ if (skillsConfig.all) {
687
+ // Copy all available skills
688
+ Object.values(SKILLS_MAP).forEach(skills => skillsToCopy.push(...skills));
689
+ }
690
+ else {
691
+ if (skillsConfig.core)
692
+ skillsToCopy.push(...SKILLS_MAP.core);
693
+ if (skillsConfig.agentdb)
694
+ skillsToCopy.push(...SKILLS_MAP.agentdb);
695
+ if (skillsConfig.github)
696
+ skillsToCopy.push(...SKILLS_MAP.github);
697
+ if (skillsConfig.flowNexus)
698
+ skillsToCopy.push(...SKILLS_MAP.flowNexus);
699
+ if (skillsConfig.browser)
700
+ skillsToCopy.push(...SKILLS_MAP.browser);
701
+ if (skillsConfig.v3)
702
+ skillsToCopy.push(...SKILLS_MAP.v3);
703
+ if (skillsConfig.dualMode)
704
+ skillsToCopy.push(...SKILLS_MAP.dualMode);
705
+ }
706
+ // Find source skills directory
707
+ const sourceSkillsDir = findSourceDir('skills', options.sourceBaseDir);
708
+ if (!sourceSkillsDir) {
709
+ result.errors.push('Could not find source skills directory');
710
+ return;
711
+ }
712
+ // Copy each skill
713
+ for (const skillName of [...new Set(skillsToCopy)]) {
714
+ const sourcePath = path.join(sourceSkillsDir, skillName);
715
+ const targetPath = path.join(targetSkillsDir, skillName);
716
+ if (fs.existsSync(sourcePath)) {
717
+ if (!fs.existsSync(targetPath) || options.force) {
718
+ copyDirRecursive(sourcePath, targetPath);
719
+ result.created.files.push(`.claude/skills/${skillName}`);
720
+ result.summary.skillsCount++;
721
+ }
722
+ else {
723
+ result.skipped.push(`.claude/skills/${skillName}`);
724
+ }
725
+ }
726
+ }
727
+ }
728
+ /**
729
+ * Copy commands from source
730
+ */
731
+ async function copyCommands(targetDir, options, result) {
732
+ const commandsConfig = options.commands;
733
+ const targetCommandsDir = path.join(targetDir, '.claude', 'commands');
734
+ // Determine which commands to copy
735
+ const commandsToCopy = [];
736
+ if (commandsConfig.all) {
737
+ Object.values(COMMANDS_MAP).forEach(cmds => commandsToCopy.push(...cmds));
738
+ }
739
+ else {
740
+ if (commandsConfig.core)
741
+ commandsToCopy.push(...COMMANDS_MAP.core);
742
+ if (commandsConfig.analysis)
743
+ commandsToCopy.push(...COMMANDS_MAP.analysis);
744
+ if (commandsConfig.automation)
745
+ commandsToCopy.push(...COMMANDS_MAP.automation);
746
+ if (commandsConfig.github)
747
+ commandsToCopy.push(...COMMANDS_MAP.github);
748
+ if (commandsConfig.hooks)
749
+ commandsToCopy.push(...COMMANDS_MAP.hooks);
750
+ if (commandsConfig.monitoring)
751
+ commandsToCopy.push(...COMMANDS_MAP.monitoring);
752
+ if (commandsConfig.optimization)
753
+ commandsToCopy.push(...COMMANDS_MAP.optimization);
754
+ if (commandsConfig.sparc)
755
+ commandsToCopy.push(...COMMANDS_MAP.sparc);
756
+ }
757
+ // Find source commands directory
758
+ const sourceCommandsDir = findSourceDir('commands', options.sourceBaseDir);
759
+ if (!sourceCommandsDir) {
760
+ result.errors.push('Could not find source commands directory');
761
+ return;
762
+ }
763
+ // Copy each command/directory
764
+ for (const cmdName of [...new Set(commandsToCopy)]) {
765
+ const sourcePath = path.join(sourceCommandsDir, cmdName);
766
+ const targetPath = path.join(targetCommandsDir, cmdName);
767
+ if (fs.existsSync(sourcePath)) {
768
+ if (!fs.existsSync(targetPath) || options.force) {
769
+ if (fs.statSync(sourcePath).isDirectory()) {
770
+ copyDirRecursive(sourcePath, targetPath);
771
+ }
772
+ else {
773
+ fs.copyFileSync(sourcePath, targetPath);
774
+ }
775
+ result.created.files.push(`.claude/commands/${cmdName}`);
776
+ result.summary.commandsCount++;
777
+ }
778
+ else {
779
+ result.skipped.push(`.claude/commands/${cmdName}`);
780
+ }
781
+ }
782
+ }
783
+ }
784
+ /**
785
+ * Copy agents from source
786
+ */
787
+ async function copyAgents(targetDir, options, result) {
788
+ const agentsConfig = options.agents;
789
+ const targetAgentsDir = path.join(targetDir, '.claude', 'agents');
790
+ // Determine which agents to copy
791
+ const agentsToCopy = [];
792
+ if (agentsConfig.all) {
793
+ Object.values(AGENTS_MAP).forEach(agents => agentsToCopy.push(...agents));
794
+ }
795
+ else {
796
+ if (agentsConfig.core)
797
+ agentsToCopy.push(...AGENTS_MAP.core);
798
+ if (agentsConfig.consensus)
799
+ agentsToCopy.push(...AGENTS_MAP.consensus);
800
+ if (agentsConfig.github)
801
+ agentsToCopy.push(...AGENTS_MAP.github);
802
+ if (agentsConfig.hiveMind)
803
+ agentsToCopy.push(...AGENTS_MAP.hiveMind);
804
+ if (agentsConfig.sparc)
805
+ agentsToCopy.push(...AGENTS_MAP.sparc);
806
+ if (agentsConfig.swarm)
807
+ agentsToCopy.push(...AGENTS_MAP.swarm);
808
+ if (agentsConfig.browser)
809
+ agentsToCopy.push(...AGENTS_MAP.browser);
810
+ // V3-specific agent categories
811
+ if (agentsConfig.v3)
812
+ agentsToCopy.push(...(AGENTS_MAP.v3 || []));
813
+ if (agentsConfig.optimization)
814
+ agentsToCopy.push(...(AGENTS_MAP.optimization || []));
815
+ if (agentsConfig.testing)
816
+ agentsToCopy.push(...(AGENTS_MAP.testing || []));
817
+ // Dual-mode agents (Claude Code + Codex hybrid)
818
+ if (agentsConfig.dualMode)
819
+ agentsToCopy.push(...(AGENTS_MAP.dualMode || []));
820
+ }
821
+ // Find source agents directory
822
+ const sourceAgentsDir = findSourceDir('agents', options.sourceBaseDir);
823
+ if (!sourceAgentsDir) {
824
+ result.errors.push('Could not find source agents directory');
825
+ return;
826
+ }
827
+ // Copy each agent category
828
+ for (const agentCategory of [...new Set(agentsToCopy)]) {
829
+ const sourcePath = path.join(sourceAgentsDir, agentCategory);
830
+ const targetPath = path.join(targetAgentsDir, agentCategory);
831
+ if (fs.existsSync(sourcePath)) {
832
+ if (!fs.existsSync(targetPath) || options.force) {
833
+ copyDirRecursive(sourcePath, targetPath);
834
+ // Count agent files (.yaml and .md)
835
+ const yamlFiles = countFiles(sourcePath, '.yaml');
836
+ const mdFiles = countFiles(sourcePath, '.md');
837
+ result.summary.agentsCount += yamlFiles + mdFiles;
838
+ result.created.files.push(`.claude/agents/${agentCategory}`);
839
+ }
840
+ else {
841
+ result.skipped.push(`.claude/agents/${agentCategory}`);
842
+ }
843
+ }
844
+ }
845
+ }
846
+ /**
847
+ * Find source helpers directory.
848
+ * Validates that the directory contains hook-handler.cjs to avoid
849
+ * returning the target directory or an incomplete source.
850
+ */
851
+ function findSourceHelpersDir(sourceBaseDir) {
852
+ const possiblePaths = [];
853
+ const SENTINEL_FILE = 'hook-handler.cjs'; // Must exist in valid source
854
+ // If explicit source base directory is provided, check it first
855
+ if (sourceBaseDir) {
856
+ possiblePaths.push(path.join(sourceBaseDir, '.claude', 'helpers'));
857
+ }
858
+ // Strategy 1: require.resolve to find package root (most reliable for npx)
859
+ try {
860
+ const esmRequire = createRequire(import.meta.url);
861
+ const pkgJsonPath = esmRequire.resolve('@aiyou-dev/cli/package.json');
862
+ const pkgRoot = path.dirname(pkgJsonPath);
863
+ possiblePaths.push(path.join(pkgRoot, '.claude', 'helpers'));
864
+ }
865
+ catch {
866
+ // Not installed as a package — skip
867
+ }
868
+ // Strategy 2: __dirname-based (dist/src/init -> package root)
869
+ const packageRoot = path.resolve(__dirname, '..', '..', '..');
870
+ const packageHelpers = path.join(packageRoot, '.claude', 'helpers');
871
+ possiblePaths.push(packageHelpers);
872
+ // Strategy 3: Walk up from __dirname looking for package root
873
+ let currentDir = __dirname;
874
+ for (let i = 0; i < 10; i++) {
875
+ const parentDir = path.dirname(currentDir);
876
+ if (parentDir === currentDir)
877
+ break; // hit filesystem root
878
+ const helpersPath = path.join(parentDir, '.claude', 'helpers');
879
+ possiblePaths.push(helpersPath);
880
+ currentDir = parentDir;
881
+ }
882
+ // Strategy 4: Check cwd-relative paths (for local dev)
883
+ const cwdBased = [
884
+ path.join(process.cwd(), '.claude', 'helpers'),
885
+ path.join(process.cwd(), '..', '.claude', 'helpers'),
886
+ path.join(process.cwd(), '..', '..', '.claude', 'helpers'),
887
+ ];
888
+ possiblePaths.push(...cwdBased);
889
+ // Return first path that exists AND contains the sentinel file
890
+ for (const p of possiblePaths) {
891
+ if (fs.existsSync(p) && fs.existsSync(path.join(p, SENTINEL_FILE))) {
892
+ return p;
893
+ }
894
+ }
895
+ return null;
896
+ }
897
+ /**
898
+ * Write helper scripts
899
+ */
900
+ async function writeHelpers(targetDir, options, result) {
901
+ const helpersDir = path.join(targetDir, '.claude', 'helpers');
902
+ // Find source helpers directory (works for npm package and local dev)
903
+ const sourceHelpersDir = findSourceHelpersDir(options.sourceBaseDir);
904
+ // Try to copy existing helpers from source first
905
+ if (sourceHelpersDir && fs.existsSync(sourceHelpersDir)) {
906
+ const helperFiles = fs.readdirSync(sourceHelpersDir);
907
+ let copiedCount = 0;
908
+ for (const file of helperFiles) {
909
+ const sourcePath = path.join(sourceHelpersDir, file);
910
+ const destPath = path.join(helpersDir, file);
911
+ // Skip directories and only copy files
912
+ if (!fs.statSync(sourcePath).isFile())
913
+ continue;
914
+ if (!fs.existsSync(destPath) || options.force) {
915
+ fs.copyFileSync(sourcePath, destPath);
916
+ // Make shell scripts and mjs files executable
917
+ if (file.endsWith('.sh') || file.endsWith('.mjs')) {
918
+ fs.chmodSync(destPath, '755');
919
+ }
920
+ result.created.files.push(`.claude/helpers/${file}`);
921
+ copiedCount++;
922
+ }
923
+ else {
924
+ result.skipped.push(`.claude/helpers/${file}`);
925
+ }
926
+ }
927
+ if (copiedCount > 0) {
928
+ return; // Skip generating if we copied from source
929
+ }
930
+ }
931
+ // Fall back to generating helpers if source not available
932
+ const helpers = {
933
+ 'pre-commit': generatePreCommitHook(),
934
+ 'post-commit': generatePostCommitHook(),
935
+ 'session.js': generateSessionManager(),
936
+ 'router.js': generateAgentRouter(),
937
+ 'memory.js': generateMemoryHelper(),
938
+ 'hook-handler.cjs': generateHookHandler(),
939
+ 'intelligence.cjs': generateIntelligenceStub(),
940
+ 'auto-memory-hook.mjs': generateAutoMemoryHook(),
941
+ };
942
+ for (const [name, content] of Object.entries(helpers)) {
943
+ const filePath = path.join(helpersDir, name);
944
+ if (!fs.existsSync(filePath) || options.force) {
945
+ fs.writeFileSync(filePath, content, 'utf-8');
946
+ // Make shell scripts executable
947
+ if (!name.endsWith('.js')) {
948
+ fs.chmodSync(filePath, '755');
949
+ }
950
+ result.created.files.push(`.claude/helpers/${name}`);
951
+ }
952
+ else {
953
+ result.skipped.push(`.claude/helpers/${name}`);
954
+ }
955
+ }
956
+ }
957
+ /**
958
+ * Find source .claude directory for statusline files
959
+ */
960
+ function findSourceClaudeDir(sourceBaseDir) {
961
+ const possiblePaths = [];
962
+ // If explicit source base directory is provided, check it first
963
+ if (sourceBaseDir) {
964
+ possiblePaths.push(path.join(sourceBaseDir, '.claude'));
965
+ }
966
+ // IMPORTANT: Check the package's own .claude directory
967
+ // Go up 3 levels: dist/src/init -> dist/src -> dist -> root
968
+ const packageRoot = path.resolve(__dirname, '..', '..', '..');
969
+ const packageClaude = path.join(packageRoot, '.claude');
970
+ if (fs.existsSync(packageClaude)) {
971
+ possiblePaths.unshift(packageClaude); // Add to beginning (highest priority)
972
+ }
973
+ // From dist/src/init -> go up to project root
974
+ let currentDir = __dirname;
975
+ for (let i = 0; i < 10; i++) {
976
+ const parentDir = path.dirname(currentDir);
977
+ const claudePath = path.join(parentDir, '.claude');
978
+ if (fs.existsSync(claudePath)) {
979
+ possiblePaths.push(claudePath);
980
+ }
981
+ currentDir = parentDir;
982
+ }
983
+ for (const p of possiblePaths) {
984
+ if (fs.existsSync(p)) {
985
+ return p;
986
+ }
987
+ }
988
+ return null;
989
+ }
990
+ /**
991
+ * Write statusline configuration
992
+ */
993
+ async function writeStatusline(targetDir, options, result) {
994
+ const claudeDir = path.join(targetDir, '.claude');
995
+ const helpersDir = path.join(targetDir, '.claude', 'helpers');
996
+ // Find source .claude directory (works for npm package and local dev)
997
+ const sourceClaudeDir = findSourceClaudeDir(options.sourceBaseDir);
998
+ // Try to copy existing advanced statusline files from source
999
+ const advancedStatuslineFiles = [
1000
+ { src: 'statusline.sh', dest: 'statusline.sh', dir: claudeDir },
1001
+ { src: 'statusline.mjs', dest: 'statusline.mjs', dir: claudeDir },
1002
+ ];
1003
+ if (sourceClaudeDir) {
1004
+ for (const file of advancedStatuslineFiles) {
1005
+ const sourcePath = path.join(sourceClaudeDir, file.src);
1006
+ const destPath = path.join(file.dir, file.dest);
1007
+ if (fs.existsSync(sourcePath)) {
1008
+ if (!fs.existsSync(destPath) || options.force) {
1009
+ fs.copyFileSync(sourcePath, destPath);
1010
+ // Make shell scripts and mjs executable
1011
+ if (file.src.endsWith('.sh') || file.src.endsWith('.mjs')) {
1012
+ fs.chmodSync(destPath, '755');
1013
+ }
1014
+ result.created.files.push(`.claude/${file.dest}`);
1015
+ }
1016
+ else {
1017
+ result.skipped.push(`.claude/${file.dest}`);
1018
+ }
1019
+ }
1020
+ }
1021
+ }
1022
+ // ALWAYS generate statusline.cjs — settings.json references this path
1023
+ // regardless of whether advanced statusline files were also copied.
1024
+ const statuslineScript = generateStatuslineScript(options);
1025
+ const statuslinePath = path.join(helpersDir, 'statusline.cjs');
1026
+ if (!fs.existsSync(statuslinePath) || options.force) {
1027
+ fs.writeFileSync(statuslinePath, statuslineScript, 'utf-8');
1028
+ result.created.files.push('.claude/helpers/statusline.cjs');
1029
+ }
1030
+ else {
1031
+ result.skipped.push('.claude/helpers/statusline.cjs');
1032
+ }
1033
+ }
1034
+ /**
1035
+ * Write runtime configuration (.aiyou-dev/)
1036
+ */
1037
+ async function writeRuntimeConfig(targetDir, options, result) {
1038
+ const configPath = path.join(targetDir, '.aiyou-dev', 'config.yaml');
1039
+ if (fs.existsSync(configPath) && !options.force) {
1040
+ result.skipped.push('.aiyou-dev/config.yaml');
1041
+ return;
1042
+ }
1043
+ const config = `# RuFlo V3 Runtime Configuration
1044
+ # Generated: ${new Date().toISOString()}
1045
+
1046
+ version: "3.0.0"
1047
+
1048
+ swarm:
1049
+ topology: ${options.runtime.topology}
1050
+ maxAgents: ${options.runtime.maxAgents}
1051
+ autoScale: true
1052
+ coordinationStrategy: consensus
1053
+
1054
+ memory:
1055
+ backend: ${options.runtime.memoryBackend}
1056
+ enableHNSW: ${options.runtime.enableHNSW}
1057
+ persistPath: .aiyou-dev/data
1058
+ cacheSize: 100
1059
+ # ADR-049: Self-Learning Memory
1060
+ learningBridge:
1061
+ enabled: ${options.runtime.enableLearningBridge ?? options.runtime.enableNeural}
1062
+ sonaMode: balanced
1063
+ confidenceDecayRate: 0.005
1064
+ accessBoostAmount: 0.03
1065
+ consolidationThreshold: 10
1066
+ memoryGraph:
1067
+ enabled: ${options.runtime.enableMemoryGraph ?? true}
1068
+ pageRankDamping: 0.85
1069
+ maxNodes: 5000
1070
+ similarityThreshold: 0.8
1071
+ agentScopes:
1072
+ enabled: ${options.runtime.enableAgentScopes ?? true}
1073
+ defaultScope: project
1074
+
1075
+ neural:
1076
+ enabled: ${options.runtime.enableNeural}
1077
+ modelPath: .aiyou-dev/neural
1078
+
1079
+ hooks:
1080
+ enabled: true
1081
+ autoExecute: true
1082
+
1083
+ mcp:
1084
+ autoStart: ${options.mcp.autoStart}
1085
+ port: ${options.mcp.port}
1086
+ `;
1087
+ fs.writeFileSync(configPath, config, 'utf-8');
1088
+ result.created.files.push('.aiyou-dev/config.yaml');
1089
+ // Write .gitignore
1090
+ const gitignorePath = path.join(targetDir, '.aiyou-dev', '.gitignore');
1091
+ const gitignore = `# Claude Flow runtime files
1092
+ data/
1093
+ logs/
1094
+ sessions/
1095
+ neural/
1096
+ *.log
1097
+ *.tmp
1098
+ `;
1099
+ if (!fs.existsSync(gitignorePath) || options.force) {
1100
+ fs.writeFileSync(gitignorePath, gitignore, 'utf-8');
1101
+ result.created.files.push('.aiyou-dev/.gitignore');
1102
+ }
1103
+ // Write CAPABILITIES.md with full system overview
1104
+ await writeCapabilitiesDoc(targetDir, options, result);
1105
+ }
1106
+ /**
1107
+ * Write initial metrics files for statusline
1108
+ * Creates baseline data so statusline shows meaningful state instead of all zeros
1109
+ */
1110
+ async function writeInitialMetrics(targetDir, options, result) {
1111
+ const metricsDir = path.join(targetDir, '.aiyou-dev', 'metrics');
1112
+ const learningDir = path.join(targetDir, '.aiyou-dev', 'learning');
1113
+ const securityDir = path.join(targetDir, '.aiyou-dev', 'security');
1114
+ // Ensure directories exist
1115
+ for (const dir of [metricsDir, learningDir, securityDir]) {
1116
+ if (!fs.existsSync(dir)) {
1117
+ fs.mkdirSync(dir, { recursive: true });
1118
+ }
1119
+ }
1120
+ // Create initial v3-progress.json
1121
+ const progressPath = path.join(metricsDir, 'v3-progress.json');
1122
+ if (!fs.existsSync(progressPath) || options.force) {
1123
+ const progress = {
1124
+ version: '3.0.0',
1125
+ initialized: new Date().toISOString(),
1126
+ domains: {
1127
+ completed: 0,
1128
+ total: 5,
1129
+ status: 'INITIALIZING'
1130
+ },
1131
+ ddd: {
1132
+ progress: 0,
1133
+ modules: 0,
1134
+ totalFiles: 0,
1135
+ totalLines: 0
1136
+ },
1137
+ swarm: {
1138
+ activeAgents: 0,
1139
+ maxAgents: options.runtime.maxAgents,
1140
+ topology: options.runtime.topology
1141
+ },
1142
+ learning: {
1143
+ status: 'READY',
1144
+ patternsLearned: 0,
1145
+ sessionsCompleted: 0
1146
+ },
1147
+ _note: 'Metrics will update as you use Claude Flow. Run: npx @aiyou-dev/cli@latest daemon start'
1148
+ };
1149
+ fs.writeFileSync(progressPath, JSON.stringify(progress, null, 2), 'utf-8');
1150
+ result.created.files.push('.aiyou-dev/metrics/v3-progress.json');
1151
+ }
1152
+ // Create initial swarm-activity.json
1153
+ const activityPath = path.join(metricsDir, 'swarm-activity.json');
1154
+ if (!fs.existsSync(activityPath) || options.force) {
1155
+ const activity = {
1156
+ timestamp: new Date().toISOString(),
1157
+ processes: {
1158
+ agentic_flow: 0,
1159
+ mcp_server: 0,
1160
+ estimated_agents: 0
1161
+ },
1162
+ swarm: {
1163
+ active: false,
1164
+ agent_count: 0,
1165
+ coordination_active: false
1166
+ },
1167
+ integration: {
1168
+ agentic_flow_active: false,
1169
+ mcp_active: false
1170
+ },
1171
+ _initialized: true
1172
+ };
1173
+ fs.writeFileSync(activityPath, JSON.stringify(activity, null, 2), 'utf-8');
1174
+ result.created.files.push('.aiyou-dev/metrics/swarm-activity.json');
1175
+ }
1176
+ // Create initial learning.json
1177
+ const learningPath = path.join(metricsDir, 'learning.json');
1178
+ if (!fs.existsSync(learningPath) || options.force) {
1179
+ const learning = {
1180
+ initialized: new Date().toISOString(),
1181
+ routing: {
1182
+ accuracy: 0,
1183
+ decisions: 0
1184
+ },
1185
+ patterns: {
1186
+ shortTerm: 0,
1187
+ longTerm: 0,
1188
+ quality: 0
1189
+ },
1190
+ sessions: {
1191
+ total: 0,
1192
+ current: null
1193
+ },
1194
+ _note: 'Intelligence grows as you use Claude Flow'
1195
+ };
1196
+ fs.writeFileSync(learningPath, JSON.stringify(learning, null, 2), 'utf-8');
1197
+ result.created.files.push('.aiyou-dev/metrics/learning.json');
1198
+ }
1199
+ // Create initial audit-status.json
1200
+ const auditPath = path.join(securityDir, 'audit-status.json');
1201
+ if (!fs.existsSync(auditPath) || options.force) {
1202
+ const audit = {
1203
+ initialized: new Date().toISOString(),
1204
+ status: 'PENDING',
1205
+ cvesFixed: 0,
1206
+ totalCves: 3,
1207
+ lastScan: null,
1208
+ _note: 'Run: npx @aiyou-dev/cli@latest security scan'
1209
+ };
1210
+ fs.writeFileSync(auditPath, JSON.stringify(audit, null, 2), 'utf-8');
1211
+ result.created.files.push('.aiyou-dev/security/audit-status.json');
1212
+ }
1213
+ }
1214
+ /**
1215
+ * Write CAPABILITIES.md - comprehensive overview of all Claude Flow features
1216
+ */
1217
+ async function writeCapabilitiesDoc(targetDir, options, result) {
1218
+ const capabilitiesPath = path.join(targetDir, '.aiyou-dev', 'CAPABILITIES.md');
1219
+ if (fs.existsSync(capabilitiesPath) && !options.force) {
1220
+ result.skipped.push('.aiyou-dev/CAPABILITIES.md');
1221
+ return;
1222
+ }
1223
+ const capabilities = `# RuFlo V3 - Complete Capabilities Reference
1224
+ > Generated: ${new Date().toISOString()}
1225
+ > Full documentation: https://github.com/ruvnet/aiyou-dev
1226
+
1227
+ ## 📋 Table of Contents
1228
+
1229
+ 1. [Overview](#overview)
1230
+ 2. [Swarm Orchestration](#swarm-orchestration)
1231
+ 3. [Available Agents (60+)](#available-agents)
1232
+ 4. [CLI Commands (26 Commands, 140+ Subcommands)](#cli-commands)
1233
+ 5. [Hooks System (27 Hooks + 12 Workers)](#hooks-system)
1234
+ 6. [Memory & Intelligence (RuVector)](#memory--intelligence)
1235
+ 7. [Hive-Mind Consensus](#hive-mind-consensus)
1236
+ 8. [Performance Targets](#performance-targets)
1237
+ 9. [Integration Ecosystem](#integration-ecosystem)
1238
+
1239
+ ---
1240
+
1241
+ ## Overview
1242
+
1243
+ RuFlo V3 is a domain-driven design architecture for multi-agent AI coordination with:
1244
+
1245
+ - **15-Agent Swarm Coordination** with hierarchical and mesh topologies
1246
+ - **HNSW Vector Search** - 150x-12,500x faster pattern retrieval
1247
+ - **SONA Neural Learning** - Self-optimizing with <0.05ms adaptation
1248
+ - **Byzantine Fault Tolerance** - Queen-led consensus mechanisms
1249
+ - **MCP Server Integration** - Model Context Protocol support
1250
+
1251
+ ### Current Configuration
1252
+ | Setting | Value |
1253
+ |---------|-------|
1254
+ | Topology | ${options.runtime.topology} |
1255
+ | Max Agents | ${options.runtime.maxAgents} |
1256
+ | Memory Backend | ${options.runtime.memoryBackend} |
1257
+ | HNSW Indexing | ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'} |
1258
+ | Neural Learning | ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'} |
1259
+ | LearningBridge | ${options.runtime.enableLearningBridge ? 'Enabled (SONA + ReasoningBank)' : 'Disabled'} |
1260
+ | Knowledge Graph | ${options.runtime.enableMemoryGraph ? 'Enabled (PageRank + Communities)' : 'Disabled'} |
1261
+ | Agent Scopes | ${options.runtime.enableAgentScopes ? 'Enabled (project/local/user)' : 'Disabled'} |
1262
+
1263
+ ---
1264
+
1265
+ ## Swarm Orchestration
1266
+
1267
+ ### Topologies
1268
+ | Topology | Description | Best For |
1269
+ |----------|-------------|----------|
1270
+ | \`hierarchical\` | Queen controls workers directly | Anti-drift, tight control |
1271
+ | \`mesh\` | Fully connected peer network | Distributed tasks |
1272
+ | \`hierarchical-mesh\` | V3 hybrid (recommended) | 10+ agents |
1273
+ | \`ring\` | Circular communication | Sequential workflows |
1274
+ | \`star\` | Central coordinator | Simple coordination |
1275
+ | \`adaptive\` | Dynamic based on load | Variable workloads |
1276
+
1277
+ ### Strategies
1278
+ - \`balanced\` - Even distribution across agents
1279
+ - \`specialized\` - Clear roles, no overlap (anti-drift)
1280
+ - \`adaptive\` - Dynamic task routing
1281
+
1282
+ ### Quick Commands
1283
+ \`\`\`bash
1284
+ # Initialize swarm
1285
+ npx @aiyou-dev/cli@latest swarm init --topology hierarchical --max-agents 8 --strategy specialized
1286
+
1287
+ # Check status
1288
+ npx @aiyou-dev/cli@latest swarm status
1289
+
1290
+ # Monitor activity
1291
+ npx @aiyou-dev/cli@latest swarm monitor
1292
+ \`\`\`
1293
+
1294
+ ---
1295
+
1296
+ ## Available Agents
1297
+
1298
+ ### Core Development (5)
1299
+ \`coder\`, \`reviewer\`, \`tester\`, \`planner\`, \`researcher\`
1300
+
1301
+ ### V3 Specialized (4)
1302
+ \`security-architect\`, \`security-auditor\`, \`memory-specialist\`, \`performance-engineer\`
1303
+
1304
+ ### Swarm Coordination (5)
1305
+ \`hierarchical-coordinator\`, \`mesh-coordinator\`, \`adaptive-coordinator\`, \`collective-intelligence-coordinator\`, \`swarm-memory-manager\`
1306
+
1307
+ ### Consensus & Distributed (7)
1308
+ \`byzantine-coordinator\`, \`raft-manager\`, \`gossip-coordinator\`, \`consensus-builder\`, \`crdt-synchronizer\`, \`quorum-manager\`, \`security-manager\`
1309
+
1310
+ ### Performance & Optimization (5)
1311
+ \`perf-analyzer\`, \`performance-benchmarker\`, \`task-orchestrator\`, \`memory-coordinator\`, \`smart-agent\`
1312
+
1313
+ ### GitHub & Repository (9)
1314
+ \`github-modes\`, \`pr-manager\`, \`code-review-swarm\`, \`issue-tracker\`, \`release-manager\`, \`workflow-automation\`, \`project-board-sync\`, \`repo-architect\`, \`multi-repo-swarm\`
1315
+
1316
+ ### SPARC Methodology (6)
1317
+ \`sparc-coord\`, \`sparc-coder\`, \`specification\`, \`pseudocode\`, \`architecture\`, \`refinement\`
1318
+
1319
+ ### Specialized Development (8)
1320
+ \`backend-dev\`, \`mobile-dev\`, \`ml-developer\`, \`cicd-engineer\`, \`api-docs\`, \`system-architect\`, \`code-analyzer\`, \`base-template-generator\`
1321
+
1322
+ ### Testing & Validation (2)
1323
+ \`tdd-london-swarm\`, \`production-validator\`
1324
+
1325
+ ### Agent Routing by Task
1326
+ | Task Type | Recommended Agents | Topology |
1327
+ |-----------|-------------------|----------|
1328
+ | Bug Fix | researcher, coder, tester | mesh |
1329
+ | New Feature | coordinator, architect, coder, tester, reviewer | hierarchical |
1330
+ | Refactoring | architect, coder, reviewer | mesh |
1331
+ | Performance | researcher, perf-engineer, coder | hierarchical |
1332
+ | Security | security-architect, auditor, reviewer | hierarchical |
1333
+ | Docs | researcher, api-docs | mesh |
1334
+
1335
+ ---
1336
+
1337
+ ## CLI Commands
1338
+
1339
+ ### Core Commands (12)
1340
+ | Command | Subcommands | Description |
1341
+ |---------|-------------|-------------|
1342
+ | \`init\` | 4 | Project initialization |
1343
+ | \`agent\` | 8 | Agent lifecycle management |
1344
+ | \`swarm\` | 6 | Multi-agent coordination |
1345
+ | \`memory\` | 11 | AgentDB with HNSW search |
1346
+ | \`mcp\` | 9 | MCP server management |
1347
+ | \`task\` | 6 | Task assignment |
1348
+ | \`session\` | 7 | Session persistence |
1349
+ | \`config\` | 7 | Configuration |
1350
+ | \`status\` | 3 | System monitoring |
1351
+ | \`workflow\` | 6 | Workflow templates |
1352
+ | \`hooks\` | 17 | Self-learning hooks |
1353
+ | \`hive-mind\` | 6 | Consensus coordination |
1354
+
1355
+ ### Advanced Commands (14)
1356
+ | Command | Subcommands | Description |
1357
+ |---------|-------------|-------------|
1358
+ | \`daemon\` | 5 | Background workers |
1359
+ | \`neural\` | 5 | Pattern training |
1360
+ | \`security\` | 6 | Security scanning |
1361
+ | \`performance\` | 5 | Profiling & benchmarks |
1362
+ | \`providers\` | 5 | AI provider config |
1363
+ | \`plugins\` | 5 | Plugin management |
1364
+ | \`deployment\` | 5 | Deploy management |
1365
+ | \`embeddings\` | 4 | Vector embeddings |
1366
+ | \`claims\` | 4 | Authorization |
1367
+ | \`migrate\` | 5 | V2→V3 migration |
1368
+ | \`process\` | 4 | Process management |
1369
+ | \`doctor\` | 1 | Health diagnostics |
1370
+ | \`completions\` | 4 | Shell completions |
1371
+
1372
+ ### Example Commands
1373
+ \`\`\`bash
1374
+ # Initialize
1375
+ npx @aiyou-dev/cli@latest init --wizard
1376
+
1377
+ # Spawn agent
1378
+ npx @aiyou-dev/cli@latest agent spawn -t coder --name my-coder
1379
+
1380
+ # Memory operations
1381
+ npx @aiyou-dev/cli@latest memory store --key "pattern" --value "data" --namespace patterns
1382
+ npx @aiyou-dev/cli@latest memory search --query "authentication"
1383
+
1384
+ # Diagnostics
1385
+ npx @aiyou-dev/cli@latest doctor --fix
1386
+ \`\`\`
1387
+
1388
+ ---
1389
+
1390
+ ## Hooks System
1391
+
1392
+ ### 27 Available Hooks
1393
+
1394
+ #### Core Hooks (6)
1395
+ | Hook | Description |
1396
+ |------|-------------|
1397
+ | \`pre-edit\` | Context before file edits |
1398
+ | \`post-edit\` | Record edit outcomes |
1399
+ | \`pre-command\` | Risk assessment |
1400
+ | \`post-command\` | Command metrics |
1401
+ | \`pre-task\` | Task start + agent suggestions |
1402
+ | \`post-task\` | Task completion learning |
1403
+
1404
+ #### Session Hooks (4)
1405
+ | Hook | Description |
1406
+ |------|-------------|
1407
+ | \`session-start\` | Start/restore session |
1408
+ | \`session-end\` | Persist state |
1409
+ | \`session-restore\` | Restore previous |
1410
+ | \`notify\` | Cross-agent notifications |
1411
+
1412
+ #### Intelligence Hooks (5)
1413
+ | Hook | Description |
1414
+ |------|-------------|
1415
+ | \`route\` | Optimal agent routing |
1416
+ | \`explain\` | Routing decisions |
1417
+ | \`pretrain\` | Bootstrap intelligence |
1418
+ | \`build-agents\` | Generate configs |
1419
+ | \`transfer\` | Pattern transfer |
1420
+
1421
+ #### Coverage Hooks (3)
1422
+ | Hook | Description |
1423
+ |------|-------------|
1424
+ | \`coverage-route\` | Coverage-based routing |
1425
+ | \`coverage-suggest\` | Improvement suggestions |
1426
+ | \`coverage-gaps\` | Gap analysis |
1427
+
1428
+ ### 12 Background Workers
1429
+ | Worker | Priority | Purpose |
1430
+ |--------|----------|---------|
1431
+ | \`ultralearn\` | normal | Deep knowledge |
1432
+ | \`optimize\` | high | Performance |
1433
+ | \`consolidate\` | low | Memory consolidation |
1434
+ | \`predict\` | normal | Predictive preload |
1435
+ | \`audit\` | critical | Security |
1436
+ | \`map\` | normal | Codebase mapping |
1437
+ | \`preload\` | low | Resource preload |
1438
+ | \`deepdive\` | normal | Deep analysis |
1439
+ | \`document\` | normal | Auto-docs |
1440
+ | \`refactor\` | normal | Suggestions |
1441
+ | \`benchmark\` | normal | Benchmarking |
1442
+ | \`testgaps\` | normal | Coverage gaps |
1443
+
1444
+ ---
1445
+
1446
+ ## Memory & Intelligence
1447
+
1448
+ ### RuVector Intelligence System
1449
+ - **SONA**: Self-Optimizing Neural Architecture (<0.05ms)
1450
+ - **MoE**: Mixture of Experts routing
1451
+ - **HNSW**: 150x-12,500x faster search
1452
+ - **EWC++**: Prevents catastrophic forgetting
1453
+ - **Flash Attention**: 2.49x-7.47x speedup
1454
+ - **Int8 Quantization**: 3.92x memory reduction
1455
+
1456
+ ### 4-Step Intelligence Pipeline
1457
+ 1. **RETRIEVE** - HNSW pattern search
1458
+ 2. **JUDGE** - Success/failure verdicts
1459
+ 3. **DISTILL** - LoRA learning extraction
1460
+ 4. **CONSOLIDATE** - EWC++ preservation
1461
+
1462
+ ### Self-Learning Memory (ADR-049)
1463
+
1464
+ | Component | Status | Description |
1465
+ |-----------|--------|-------------|
1466
+ | **LearningBridge** | ${options.runtime.enableLearningBridge ? '✅ Enabled' : '⏸ Disabled'} | Connects insights to SONA/ReasoningBank neural pipeline |
1467
+ | **MemoryGraph** | ${options.runtime.enableMemoryGraph ? '✅ Enabled' : '⏸ Disabled'} | PageRank knowledge graph + community detection |
1468
+ | **AgentMemoryScope** | ${options.runtime.enableAgentScopes ? '✅ Enabled' : '⏸ Disabled'} | 3-scope agent memory (project/local/user) |
1469
+
1470
+ **LearningBridge** - Insights trigger learning trajectories. Confidence evolves: +0.03 on access, -0.005/hour decay. Consolidation runs the JUDGE/DISTILL/CONSOLIDATE pipeline.
1471
+
1472
+ **MemoryGraph** - Builds a knowledge graph from entry references. PageRank identifies influential insights. Communities group related knowledge. Graph-aware ranking blends vector + structural scores.
1473
+
1474
+ **AgentMemoryScope** - Maps Claude Code 3-scope directories:
1475
+ - \`project\`: \`<gitRoot>/.claude/agent-memory/<agent>/\`
1476
+ - \`local\`: \`<gitRoot>/.claude/agent-memory-local/<agent>/\`
1477
+ - \`user\`: \`~/.claude/agent-memory/<agent>/\`
1478
+
1479
+ High-confidence insights (>0.8) can transfer between agents.
1480
+
1481
+ ### Memory Commands
1482
+ \`\`\`bash
1483
+ # Store pattern
1484
+ npx @aiyou-dev/cli@latest memory store --key "name" --value "data" --namespace patterns
1485
+
1486
+ # Semantic search
1487
+ npx @aiyou-dev/cli@latest memory search --query "authentication"
1488
+
1489
+ # List entries
1490
+ npx @aiyou-dev/cli@latest memory list --namespace patterns
1491
+
1492
+ # Initialize database
1493
+ npx @aiyou-dev/cli@latest memory init --force
1494
+ \`\`\`
1495
+
1496
+ ---
1497
+
1498
+ ## Hive-Mind Consensus
1499
+
1500
+ ### Queen Types
1501
+ | Type | Role |
1502
+ |------|------|
1503
+ | Strategic Queen | Long-term planning |
1504
+ | Tactical Queen | Execution coordination |
1505
+ | Adaptive Queen | Dynamic optimization |
1506
+
1507
+ ### Worker Types (8)
1508
+ \`researcher\`, \`coder\`, \`analyst\`, \`tester\`, \`architect\`, \`reviewer\`, \`optimizer\`, \`documenter\`
1509
+
1510
+ ### Consensus Mechanisms
1511
+ | Mechanism | Fault Tolerance | Use Case |
1512
+ |-----------|-----------------|----------|
1513
+ | \`byzantine\` | f < n/3 faulty | Adversarial |
1514
+ | \`raft\` | f < n/2 failed | Leader-based |
1515
+ | \`gossip\` | Eventually consistent | Large scale |
1516
+ | \`crdt\` | Conflict-free | Distributed |
1517
+ | \`quorum\` | Configurable | Flexible |
1518
+
1519
+ ### Hive-Mind Commands
1520
+ \`\`\`bash
1521
+ # Initialize
1522
+ npx @aiyou-dev/cli@latest hive-mind init --queen-type strategic
1523
+
1524
+ # Status
1525
+ npx @aiyou-dev/cli@latest hive-mind status
1526
+
1527
+ # Spawn workers
1528
+ npx @aiyou-dev/cli@latest hive-mind spawn --count 5 --type worker
1529
+
1530
+ # Consensus
1531
+ npx @aiyou-dev/cli@latest hive-mind consensus --propose "task"
1532
+ \`\`\`
1533
+
1534
+ ---
1535
+
1536
+ ## Performance Targets
1537
+
1538
+ | Metric | Target | Status |
1539
+ |--------|--------|--------|
1540
+ | HNSW Search | 150x-12,500x faster | ✅ Implemented |
1541
+ | Memory Reduction | 50-75% | ✅ Implemented (3.92x) |
1542
+ | SONA Integration | Pattern learning | ✅ Implemented |
1543
+ | Flash Attention | 2.49x-7.47x | 🔄 In Progress |
1544
+ | MCP Response | <100ms | ✅ Achieved |
1545
+ | CLI Startup | <500ms | ✅ Achieved |
1546
+ | SONA Adaptation | <0.05ms | 🔄 In Progress |
1547
+ | Graph Build (1k) | <200ms | ✅ 2.78ms (71.9x headroom) |
1548
+ | PageRank (1k) | <100ms | ✅ 12.21ms (8.2x headroom) |
1549
+ | Insight Recording | <5ms/each | ✅ 0.12ms (41x headroom) |
1550
+ | Consolidation | <500ms | ✅ 0.26ms (1,955x headroom) |
1551
+ | Knowledge Transfer | <100ms | ✅ 1.25ms (80x headroom) |
1552
+
1553
+ ---
1554
+
1555
+ ## Integration Ecosystem
1556
+
1557
+ ### Integrated Packages
1558
+ | Package | Version | Purpose |
1559
+ |---------|---------|---------|
1560
+ | agentic-flow | 3.0.0-alpha.1 | Core coordination + ReasoningBank + Router |
1561
+ | agentdb | 3.0.0-alpha.10 | Vector database + 8 controllers |
1562
+ | @ruvector/attention | 0.1.3 | Flash attention |
1563
+ | @ruvector/sona | 0.1.5 | Neural learning |
1564
+
1565
+ ### Optional Integrations
1566
+ | Package | Command |
1567
+ |---------|---------|
1568
+ | ruv-swarm | \`npx ruv-swarm mcp start\` |
1569
+ | flow-nexus | \`npx flow-nexus@latest mcp start\` |
1570
+ | agentic-jujutsu | \`npx agentic-jujutsu@latest\` |
1571
+
1572
+ ### MCP Server Setup
1573
+ \`\`\`bash
1574
+ # Add Claude Flow MCP
1575
+ claude mcp add aiyou-dev -- npx -y @aiyou-dev/cli@latest
1576
+
1577
+ # Optional servers
1578
+ claude mcp add ruv-swarm -- npx -y ruv-swarm mcp start
1579
+ claude mcp add flow-nexus -- npx -y flow-nexus@latest mcp start
1580
+ \`\`\`
1581
+
1582
+ ---
1583
+
1584
+ ## Quick Reference
1585
+
1586
+ ### Essential Commands
1587
+ \`\`\`bash
1588
+ # Setup
1589
+ npx @aiyou-dev/cli@latest init --wizard
1590
+ npx @aiyou-dev/cli@latest daemon start
1591
+ npx @aiyou-dev/cli@latest doctor --fix
1592
+
1593
+ # Swarm
1594
+ npx @aiyou-dev/cli@latest swarm init --topology hierarchical --max-agents 8
1595
+ npx @aiyou-dev/cli@latest swarm status
1596
+
1597
+ # Agents
1598
+ npx @aiyou-dev/cli@latest agent spawn -t coder
1599
+ npx @aiyou-dev/cli@latest agent list
1600
+
1601
+ # Memory
1602
+ npx @aiyou-dev/cli@latest memory search --query "patterns"
1603
+
1604
+ # Hooks
1605
+ npx @aiyou-dev/cli@latest hooks pre-task --description "task"
1606
+ npx @aiyou-dev/cli@latest hooks worker dispatch --trigger optimize
1607
+ \`\`\`
1608
+
1609
+ ### File Structure
1610
+ \`\`\`
1611
+ .aiyou-dev/
1612
+ ├── config.yaml # Runtime configuration
1613
+ ├── CAPABILITIES.md # This file
1614
+ ├── data/ # Memory storage
1615
+ ├── logs/ # Operation logs
1616
+ ├── sessions/ # Session state
1617
+ ├── hooks/ # Custom hooks
1618
+ ├── agents/ # Agent configs
1619
+ └── workflows/ # Workflow templates
1620
+ \`\`\`
1621
+
1622
+ ---
1623
+
1624
+ **Full Documentation**: https://github.com/ruvnet/aiyou-dev
1625
+ **Issues**: https://github.com/ruvnet/aiyou-dev/issues
1626
+ `;
1627
+ fs.writeFileSync(capabilitiesPath, capabilities, 'utf-8');
1628
+ result.created.files.push('.aiyou-dev/CAPABILITIES.md');
1629
+ }
1630
+ /**
1631
+ * Write CLAUDE.md with swarm guidance
1632
+ */
1633
+ async function writeClaudeMd(targetDir, options, result) {
1634
+ const claudeMdPath = path.join(targetDir, 'CLAUDE.md');
1635
+ if (fs.existsSync(claudeMdPath) && !options.force) {
1636
+ result.skipped.push('CLAUDE.md');
1637
+ return;
1638
+ }
1639
+ // Determine template: explicit option > infer from components > 'standard'
1640
+ const inferredTemplate = (!options.components.commands && !options.components.agents) ? 'minimal' : undefined;
1641
+ const content = generateClaudeMd(options, inferredTemplate);
1642
+ fs.writeFileSync(claudeMdPath, content, 'utf-8');
1643
+ result.created.files.push('CLAUDE.md');
1644
+ }
1645
+ /**
1646
+ * Write GEMINI.md with project instructions for Gemini CLI
1647
+ */
1648
+ async function writeGeminiMd(targetDir, options, result) {
1649
+ const geminiMdPath = path.join(targetDir, 'GEMINI.md');
1650
+ if (fs.existsSync(geminiMdPath) && !options.force) {
1651
+ result.skipped.push('GEMINI.md');
1652
+ return;
1653
+ }
1654
+ const inferredTemplate = (!options.components.commands && !options.components.agents) ? 'minimal' : undefined;
1655
+ const content = generateGeminiMd(options, inferredTemplate);
1656
+ fs.writeFileSync(geminiMdPath, content, 'utf-8');
1657
+ result.created.files.push('GEMINI.md');
1658
+ }
1659
+ /**
1660
+ * Find source directory for skills/commands/agents
1661
+ */
1662
+ function findSourceDir(type, sourceBaseDir) {
1663
+ // Build list of possible paths to check
1664
+ const possiblePaths = [];
1665
+ // If explicit source base directory is provided, use it first
1666
+ if (sourceBaseDir) {
1667
+ possiblePaths.push(path.join(sourceBaseDir, '.claude', type));
1668
+ }
1669
+ // IMPORTANT: Check the package's own .claude directory first
1670
+ // This is the primary path when running as an npm package
1671
+ // __dirname is typically /path/to/node_modules/@aiyou-dev/cli/dist/src/init
1672
+ // We need to go up 3 levels to reach the package root (dist/src/init -> dist/src -> dist -> root)
1673
+ const packageRoot = path.resolve(__dirname, '..', '..', '..');
1674
+ const packageDotClaude = path.join(packageRoot, '.claude', type);
1675
+ if (fs.existsSync(packageDotClaude)) {
1676
+ possiblePaths.unshift(packageDotClaude); // Add to beginning (highest priority)
1677
+ }
1678
+ // From dist/src/init -> go up to project root
1679
+ const distPath = __dirname;
1680
+ // Try to find the project root by looking for .claude directory
1681
+ let currentDir = distPath;
1682
+ for (let i = 0; i < 10; i++) {
1683
+ const parentDir = path.dirname(currentDir);
1684
+ const dotClaudePath = path.join(parentDir, '.claude', type);
1685
+ if (fs.existsSync(dotClaudePath)) {
1686
+ possiblePaths.push(dotClaudePath);
1687
+ }
1688
+ currentDir = parentDir;
1689
+ }
1690
+ // Also check relative to process.cwd() for development
1691
+ const cwdBased = [
1692
+ path.join(process.cwd(), '.claude', type),
1693
+ path.join(process.cwd(), '..', '.claude', type),
1694
+ path.join(process.cwd(), '..', '..', '.claude', type),
1695
+ ];
1696
+ possiblePaths.push(...cwdBased);
1697
+ // Check v2 directory for agents
1698
+ if (type === 'agents') {
1699
+ possiblePaths.push(path.join(process.cwd(), 'v2', '.claude', type), path.join(process.cwd(), '..', 'v2', '.claude', type));
1700
+ }
1701
+ // Plugin directory
1702
+ possiblePaths.push(path.join(process.cwd(), 'plugin', type), path.join(process.cwd(), '..', 'plugin', type));
1703
+ for (const p of possiblePaths) {
1704
+ if (fs.existsSync(p)) {
1705
+ return p;
1706
+ }
1707
+ }
1708
+ return null;
1709
+ }
1710
+ /**
1711
+ * Copy directory recursively
1712
+ */
1713
+ function copyDirRecursive(src, dest) {
1714
+ fs.mkdirSync(dest, { recursive: true });
1715
+ const entries = fs.readdirSync(src, { withFileTypes: true });
1716
+ for (const entry of entries) {
1717
+ const srcPath = path.join(src, entry.name);
1718
+ const destPath = path.join(dest, entry.name);
1719
+ if (entry.isDirectory()) {
1720
+ copyDirRecursive(srcPath, destPath);
1721
+ }
1722
+ else {
1723
+ fs.copyFileSync(srcPath, destPath);
1724
+ }
1725
+ }
1726
+ }
1727
+ /**
1728
+ * Count files with extension in directory
1729
+ */
1730
+ function countFiles(dir, ext) {
1731
+ let count = 0;
1732
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
1733
+ for (const entry of entries) {
1734
+ const fullPath = path.join(dir, entry.name);
1735
+ if (entry.isDirectory()) {
1736
+ count += countFiles(fullPath, ext);
1737
+ }
1738
+ else if (entry.name.endsWith(ext)) {
1739
+ count++;
1740
+ }
1741
+ }
1742
+ return count;
1743
+ }
1744
+ /**
1745
+ * Count enabled hooks
1746
+ */
1747
+ function countEnabledHooks(options) {
1748
+ const hooks = options.hooks;
1749
+ let count = 0;
1750
+ if (hooks.preToolUse)
1751
+ count++;
1752
+ if (hooks.postToolUse)
1753
+ count++;
1754
+ if (hooks.userPromptSubmit)
1755
+ count++;
1756
+ if (hooks.sessionStart)
1757
+ count++;
1758
+ if (hooks.stop)
1759
+ count++;
1760
+ if (hooks.preCompact)
1761
+ count++;
1762
+ if (hooks.notification)
1763
+ count++;
1764
+ return count;
1765
+ }
1766
+ export default executeInit;
1767
+ //# sourceMappingURL=executor.js.map