monomind 1.9.17 → 1.10.0

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 (701) hide show
  1. package/.claude/commands/mastermind/_repeat.md +182 -39
  2. package/.claude/commands/mastermind/architect.md +17 -11
  3. package/.claude/commands/mastermind/brain.md +4 -0
  4. package/.claude/commands/mastermind/build.md +4 -0
  5. package/.claude/commands/mastermind/content.md +4 -0
  6. package/.claude/commands/mastermind/createorg.md +5 -3
  7. package/.claude/commands/mastermind/finance.md +4 -0
  8. package/.claude/commands/mastermind/idea.md +4 -0
  9. package/.claude/commands/mastermind/marketing.md +4 -0
  10. package/.claude/commands/mastermind/master.md +63 -37
  11. package/.claude/commands/mastermind/ops.md +4 -0
  12. package/.claude/commands/mastermind/release.md +4 -0
  13. package/.claude/commands/mastermind/research.md +4 -0
  14. package/.claude/commands/mastermind/review.md +4 -0
  15. package/.claude/commands/mastermind/runorg.md +5 -3
  16. package/.claude/commands/mastermind/sales.md +4 -0
  17. package/.claude/commands/mastermind/techport.md +9 -0
  18. package/.claude/commands/monomind/do.md +5 -1
  19. package/.claude/commands/monomind/idea.md +5 -1
  20. package/.claude/commands/monomind/improve.md +5 -1
  21. package/.claude/commands/monomind/repeat.md +85 -29
  22. package/.claude/commands/monomind/review.md +6 -2
  23. package/.claude/commands/monomind/understand.md +10 -8
  24. package/.claude/helpers/extras-registry.json +235 -235
  25. package/.claude/helpers/graphify-freshen.cjs +13 -1
  26. package/.claude/helpers/hook-handler.cjs +1 -1
  27. package/.claude/helpers/router.cjs +4 -1
  28. package/.claude/scheduled_tasks.lock +1 -1
  29. package/.claude/settings.json +3 -3
  30. package/.claude/settings.local.json +3 -3
  31. package/.claude/skills/.monomind/sessions/current.json +1 -1
  32. package/.claude/skills/.monomind/sessions/session-1777829336455.json +1 -1
  33. package/.claude/skills/.monomind/sessions/session-1777831614725.json +1 -1
  34. package/.claude/skills/.monomind/sessions/session-1777832095857.json +1 -1
  35. package/.claude/skills/.monomind/sessions/session-1777839814183.json +1 -1
  36. package/.claude/skills/.monomind/sessions/session-1777841847131.json +1 -1
  37. package/.claude/skills/.monomind/sessions/session-1777843309463.json +1 -1
  38. package/.claude/skills/.monomind/sessions/session-1777880867159.json +1 -1
  39. package/.claude/skills/.monomind/sessions/session-1777881884593.json +1 -1
  40. package/.claude/skills/.monomind/sessions/session-1777884090471.json +1 -1
  41. package/.claude/skills/.monomind/sessions/session-1777884808221.json +1 -1
  42. package/.claude/skills/.monomind/sessions/session-1777885672155.json +1 -1
  43. package/.claude/skills/.monomind/sessions/session-1777886852818.json +1 -1
  44. package/.claude/skills/.monomind/sessions/session-1777896532690.json +1 -1
  45. package/.claude/skills/mastermind/_protocol.md +28 -21
  46. package/.claude/skills/mastermind/access.md +236 -0
  47. package/.claude/skills/mastermind/activity.md +191 -0
  48. package/.claude/skills/mastermind/adapter-manager.md +259 -0
  49. package/.claude/skills/mastermind/adapters.md +204 -0
  50. package/.claude/skills/mastermind/agent-detail.md +242 -0
  51. package/.claude/skills/mastermind/agents.md +178 -0
  52. package/.claude/skills/mastermind/approval-detail.md +259 -0
  53. package/.claude/skills/mastermind/approve.md +181 -0
  54. package/.claude/skills/mastermind/architect.md +24 -8
  55. package/.claude/skills/mastermind/backup.md +197 -0
  56. package/.claude/skills/mastermind/bootstrap.md +190 -0
  57. package/.claude/skills/mastermind/budgets.md +237 -0
  58. package/.claude/skills/mastermind/companies.md +256 -0
  59. package/.claude/skills/mastermind/costs.md +151 -0
  60. package/.claude/skills/mastermind/createorg.md +23 -5
  61. package/.claude/skills/mastermind/diagnose.md +249 -0
  62. package/.claude/skills/mastermind/env.md +198 -0
  63. package/.claude/skills/mastermind/environments.md +250 -0
  64. package/.claude/skills/mastermind/export.md +324 -0
  65. package/.claude/skills/mastermind/goal-detail.md +255 -0
  66. package/.claude/skills/mastermind/goals.md +149 -0
  67. package/.claude/skills/mastermind/heartbeat.md +164 -0
  68. package/.claude/skills/mastermind/idea.md +250 -122
  69. package/.claude/skills/mastermind/import.md +281 -0
  70. package/.claude/skills/mastermind/inbox.md +214 -0
  71. package/.claude/skills/mastermind/instance-settings.md +315 -0
  72. package/.claude/skills/mastermind/instance.md +231 -0
  73. package/.claude/skills/mastermind/invite-landing.md +227 -0
  74. package/.claude/skills/mastermind/invites.md +254 -0
  75. package/.claude/skills/mastermind/issue-detail.md +291 -0
  76. package/.claude/skills/mastermind/issues.md +235 -0
  77. package/.claude/skills/mastermind/join-queue.md +170 -0
  78. package/.claude/skills/mastermind/liveness.md +392 -0
  79. package/.claude/skills/mastermind/memory.md +321 -0
  80. package/.claude/skills/mastermind/my-issues.md +146 -0
  81. package/.claude/skills/mastermind/new-agent.md +241 -0
  82. package/.claude/skills/mastermind/org-chart.md +207 -0
  83. package/.claude/skills/mastermind/org-settings.md +217 -0
  84. package/.claude/skills/mastermind/plan-to-tasks.md +136 -0
  85. package/.claude/skills/mastermind/plugin-manager.md +241 -0
  86. package/.claude/skills/mastermind/plugin-settings.md +273 -0
  87. package/.claude/skills/mastermind/plugins.md +190 -0
  88. package/.claude/skills/mastermind/profile.md +187 -0
  89. package/.claude/skills/mastermind/project-detail.md +249 -0
  90. package/.claude/skills/mastermind/project-workspace.md +244 -0
  91. package/.claude/skills/mastermind/projects.md +164 -0
  92. package/.claude/skills/mastermind/routine-detail.md +253 -0
  93. package/.claude/skills/mastermind/routines.md +202 -0
  94. package/.claude/skills/mastermind/runorg.md +74 -9
  95. package/.claude/skills/mastermind/search.md +186 -0
  96. package/.claude/skills/mastermind/secrets.md +199 -0
  97. package/.claude/skills/mastermind/skills.md +156 -0
  98. package/.claude/skills/mastermind/tasks.md +149 -0
  99. package/.claude/skills/mastermind/techport.md +5 -5
  100. package/.claude/skills/mastermind/threads.md +259 -0
  101. package/.claude/skills/mastermind/tree-control.md +250 -0
  102. package/.claude/skills/mastermind/wiki.md +314 -0
  103. package/.claude/skills/mastermind/workspace-detail.md +317 -0
  104. package/.claude/skills/mastermind/workspaces.md +261 -0
  105. package/.claude/skills/mastermind/worktree.md +187 -0
  106. package/LICENSE +1 -1
  107. package/package.json +1 -1
  108. package/packages/@monomind/cli/package.json +1 -1
  109. package/packages/@monomind/cli/bundled-graph/dist/src/analyze.d.ts +0 -32
  110. package/packages/@monomind/cli/bundled-graph/dist/src/analyze.d.ts.map +0 -1
  111. package/packages/@monomind/cli/bundled-graph/dist/src/analyze.js +0 -297
  112. package/packages/@monomind/cli/bundled-graph/dist/src/analyze.js.map +0 -1
  113. package/packages/@monomind/cli/bundled-graph/dist/src/build.d.ts +0 -8
  114. package/packages/@monomind/cli/bundled-graph/dist/src/build.d.ts.map +0 -1
  115. package/packages/@monomind/cli/bundled-graph/dist/src/build.js +0 -73
  116. package/packages/@monomind/cli/bundled-graph/dist/src/build.js.map +0 -1
  117. package/packages/@monomind/cli/bundled-graph/dist/src/cache.d.ts +0 -12
  118. package/packages/@monomind/cli/bundled-graph/dist/src/cache.d.ts.map +0 -1
  119. package/packages/@monomind/cli/bundled-graph/dist/src/cache.js +0 -43
  120. package/packages/@monomind/cli/bundled-graph/dist/src/cache.js.map +0 -1
  121. package/packages/@monomind/cli/bundled-graph/dist/src/cluster.d.ts +0 -5
  122. package/packages/@monomind/cli/bundled-graph/dist/src/cluster.d.ts.map +0 -1
  123. package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js +0 -120
  124. package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js.map +0 -1
  125. package/packages/@monomind/cli/bundled-graph/dist/src/detect.d.ts +0 -21
  126. package/packages/@monomind/cli/bundled-graph/dist/src/detect.d.ts.map +0 -1
  127. package/packages/@monomind/cli/bundled-graph/dist/src/detect.js +0 -195
  128. package/packages/@monomind/cli/bundled-graph/dist/src/detect.js.map +0 -1
  129. package/packages/@monomind/cli/bundled-graph/dist/src/export.d.ts +0 -21
  130. package/packages/@monomind/cli/bundled-graph/dist/src/export.d.ts.map +0 -1
  131. package/packages/@monomind/cli/bundled-graph/dist/src/export.js +0 -68
  132. package/packages/@monomind/cli/bundled-graph/dist/src/export.js.map +0 -1
  133. package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.d.ts +0 -20
  134. package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.d.ts.map +0 -1
  135. package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.js +0 -158
  136. package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.js.map +0 -1
  137. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.d.ts +0 -3
  138. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.d.ts.map +0 -1
  139. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.js +0 -88
  140. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.js.map +0 -1
  141. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.d.ts +0 -3
  142. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.d.ts.map +0 -1
  143. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.js +0 -121
  144. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.js.map +0 -1
  145. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.d.ts +0 -3
  146. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.d.ts.map +0 -1
  147. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.js +0 -121
  148. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.js.map +0 -1
  149. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.d.ts +0 -3
  150. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.d.ts.map +0 -1
  151. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.js +0 -181
  152. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.js.map +0 -1
  153. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.d.ts +0 -3
  154. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.d.ts.map +0 -1
  155. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.js +0 -117
  156. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.js.map +0 -1
  157. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.d.ts +0 -3
  158. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.d.ts.map +0 -1
  159. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.js +0 -112
  160. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.js.map +0 -1
  161. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.d.ts +0 -3
  162. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.d.ts.map +0 -1
  163. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.js +0 -130
  164. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.js.map +0 -1
  165. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.d.ts +0 -3
  166. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.d.ts.map +0 -1
  167. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.js +0 -230
  168. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.js.map +0 -1
  169. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.d.ts +0 -3
  170. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.d.ts.map +0 -1
  171. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.js +0 -120
  172. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.js.map +0 -1
  173. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.d.ts +0 -3
  174. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.d.ts.map +0 -1
  175. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.js +0 -195
  176. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.js.map +0 -1
  177. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.d.ts +0 -3
  178. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.d.ts.map +0 -1
  179. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.js +0 -110
  180. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.js.map +0 -1
  181. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.d.ts +0 -3
  182. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.d.ts.map +0 -1
  183. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.js +0 -122
  184. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.js.map +0 -1
  185. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.d.ts +0 -3
  186. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.d.ts.map +0 -1
  187. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.js +0 -295
  188. package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.js.map +0 -1
  189. package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.d.ts +0 -38
  190. package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.d.ts.map +0 -1
  191. package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.js +0 -242
  192. package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.js.map +0 -1
  193. package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.d.ts +0 -48
  194. package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.d.ts.map +0 -1
  195. package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.js +0 -137
  196. package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.js.map +0 -1
  197. package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.d.ts +0 -7
  198. package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.d.ts.map +0 -1
  199. package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.js +0 -2
  200. package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.js.map +0 -1
  201. package/packages/@monomind/cli/bundled-graph/dist/src/index.d.ts +0 -28
  202. package/packages/@monomind/cli/bundled-graph/dist/src/index.d.ts.map +0 -1
  203. package/packages/@monomind/cli/bundled-graph/dist/src/index.js +0 -26
  204. package/packages/@monomind/cli/bundled-graph/dist/src/index.js.map +0 -1
  205. package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.d.ts +0 -27
  206. package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.d.ts.map +0 -1
  207. package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.js +0 -269
  208. package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.js.map +0 -1
  209. package/packages/@monomind/cli/bundled-graph/dist/src/report.d.ts +0 -26
  210. package/packages/@monomind/cli/bundled-graph/dist/src/report.d.ts.map +0 -1
  211. package/packages/@monomind/cli/bundled-graph/dist/src/report.js +0 -214
  212. package/packages/@monomind/cli/bundled-graph/dist/src/report.js.map +0 -1
  213. package/packages/@monomind/cli/bundled-graph/dist/src/types.d.ts +0 -124
  214. package/packages/@monomind/cli/bundled-graph/dist/src/types.d.ts.map +0 -1
  215. package/packages/@monomind/cli/bundled-graph/dist/src/types.js +0 -2
  216. package/packages/@monomind/cli/bundled-graph/dist/src/types.js.map +0 -1
  217. package/packages/@monomind/cli/bundled-graph/dist/src/visualize.d.ts +0 -4
  218. package/packages/@monomind/cli/bundled-graph/dist/src/visualize.d.ts.map +0 -1
  219. package/packages/@monomind/cli/bundled-graph/dist/src/visualize.js +0 -574
  220. package/packages/@monomind/cli/bundled-graph/dist/src/visualize.js.map +0 -1
  221. package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +0 -25
  222. package/packages/@monomind/cli/dist/src/agents/halt-signal.js +0 -76
  223. package/packages/@monomind/cli/dist/src/agents/index.d.ts +0 -18
  224. package/packages/@monomind/cli/dist/src/agents/index.js +0 -13
  225. package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +0 -41
  226. package/packages/@monomind/cli/dist/src/agents/managed-agent.js +0 -69
  227. package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +0 -23
  228. package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +0 -49
  229. package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +0 -22
  230. package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +0 -80
  231. package/packages/@monomind/cli/dist/src/agents/registry-builder.d.ts +0 -36
  232. package/packages/@monomind/cli/dist/src/agents/registry-builder.js +0 -200
  233. package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +0 -71
  234. package/packages/@monomind/cli/dist/src/agents/registry-query.js +0 -125
  235. package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +0 -19
  236. package/packages/@monomind/cli/dist/src/agents/score-decay.js +0 -22
  237. package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +0 -13
  238. package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +0 -40
  239. package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +0 -54
  240. package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +0 -212
  241. package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +0 -30
  242. package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +0 -84
  243. package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +0 -20
  244. package/packages/@monomind/cli/dist/src/agents/trigger-index.js +0 -38
  245. package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +0 -64
  246. package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +0 -308
  247. package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +0 -18
  248. package/packages/@monomind/cli/dist/src/agents/version-diff.js +0 -64
  249. package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +0 -60
  250. package/packages/@monomind/cli/dist/src/agents/version-store.js +0 -235
  251. package/packages/@monomind/cli/dist/src/autopilot-state.d.ts +0 -77
  252. package/packages/@monomind/cli/dist/src/autopilot-state.js +0 -330
  253. package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.d.ts +0 -87
  254. package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.js +0 -273
  255. package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.d.ts +0 -36
  256. package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.js +0 -114
  257. package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +0 -58
  258. package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +0 -404
  259. package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +0 -14
  260. package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +0 -333
  261. package/packages/@monomind/cli/dist/src/commands/agent.d.ts +0 -8
  262. package/packages/@monomind/cli/dist/src/commands/agent.js +0 -943
  263. package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +0 -19
  264. package/packages/@monomind/cli/dist/src/commands/analyze.js +0 -2048
  265. package/packages/@monomind/cli/dist/src/commands/appliance-advanced.d.ts +0 -9
  266. package/packages/@monomind/cli/dist/src/commands/appliance-advanced.js +0 -238
  267. package/packages/@monomind/cli/dist/src/commands/appliance.d.ts +0 -8
  268. package/packages/@monomind/cli/dist/src/commands/appliance.js +0 -406
  269. package/packages/@monomind/cli/dist/src/commands/autopilot.d.ts +0 -15
  270. package/packages/@monomind/cli/dist/src/commands/autopilot.js +0 -362
  271. package/packages/@monomind/cli/dist/src/commands/benchmark.d.ts +0 -10
  272. package/packages/@monomind/cli/dist/src/commands/benchmark.js +0 -571
  273. package/packages/@monomind/cli/dist/src/commands/claims.d.ts +0 -10
  274. package/packages/@monomind/cli/dist/src/commands/claims.js +0 -632
  275. package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +0 -13
  276. package/packages/@monomind/cli/dist/src/commands/cleanup.js +0 -218
  277. package/packages/@monomind/cli/dist/src/commands/completions.d.ts +0 -10
  278. package/packages/@monomind/cli/dist/src/commands/completions.js +0 -539
  279. package/packages/@monomind/cli/dist/src/commands/config.d.ts +0 -8
  280. package/packages/@monomind/cli/dist/src/commands/config.js +0 -460
  281. package/packages/@monomind/cli/dist/src/commands/daemon.d.ts +0 -8
  282. package/packages/@monomind/cli/dist/src/commands/daemon.js +0 -671
  283. package/packages/@monomind/cli/dist/src/commands/deployment.d.ts +0 -10
  284. package/packages/@monomind/cli/dist/src/commands/deployment.js +0 -691
  285. package/packages/@monomind/cli/dist/src/commands/doctor.d.ts +0 -10
  286. package/packages/@monomind/cli/dist/src/commands/doctor.js +0 -647
  287. package/packages/@monomind/cli/dist/src/commands/embeddings.d.ts +0 -18
  288. package/packages/@monomind/cli/dist/src/commands/embeddings.js +0 -1652
  289. package/packages/@monomind/cli/dist/src/commands/guidance.d.ts +0 -8
  290. package/packages/@monomind/cli/dist/src/commands/guidance.js +0 -560
  291. package/packages/@monomind/cli/dist/src/commands/hive-mind.d.ts +0 -11
  292. package/packages/@monomind/cli/dist/src/commands/hive-mind.js +0 -1238
  293. package/packages/@monomind/cli/dist/src/commands/hooks.d.ts +0 -8
  294. package/packages/@monomind/cli/dist/src/commands/hooks.js +0 -4446
  295. package/packages/@monomind/cli/dist/src/commands/index.d.ts +0 -119
  296. package/packages/@monomind/cli/dist/src/commands/index.js +0 -404
  297. package/packages/@monomind/cli/dist/src/commands/init.d.ts +0 -8
  298. package/packages/@monomind/cli/dist/src/commands/init.js +0 -853
  299. package/packages/@monomind/cli/dist/src/commands/issues.d.ts +0 -21
  300. package/packages/@monomind/cli/dist/src/commands/issues.js +0 -567
  301. package/packages/@monomind/cli/dist/src/commands/mcp.d.ts +0 -11
  302. package/packages/@monomind/cli/dist/src/commands/mcp.js +0 -705
  303. package/packages/@monomind/cli/dist/src/commands/memory.d.ts +0 -8
  304. package/packages/@monomind/cli/dist/src/commands/memory.js +0 -1596
  305. package/packages/@monomind/cli/dist/src/commands/migrate.d.ts +0 -8
  306. package/packages/@monomind/cli/dist/src/commands/migrate.js +0 -790
  307. package/packages/@monomind/cli/dist/src/commands/monograph.d.ts +0 -8
  308. package/packages/@monomind/cli/dist/src/commands/monograph.js +0 -526
  309. package/packages/@monomind/cli/dist/src/commands/neural.d.ts +0 -10
  310. package/packages/@monomind/cli/dist/src/commands/neural.js +0 -1494
  311. package/packages/@monomind/cli/dist/src/commands/performance.d.ts +0 -10
  312. package/packages/@monomind/cli/dist/src/commands/performance.js +0 -601
  313. package/packages/@monomind/cli/dist/src/commands/plugins.d.ts +0 -11
  314. package/packages/@monomind/cli/dist/src/commands/plugins.js +0 -796
  315. package/packages/@monomind/cli/dist/src/commands/process.d.ts +0 -10
  316. package/packages/@monomind/cli/dist/src/commands/process.js +0 -718
  317. package/packages/@monomind/cli/dist/src/commands/progress.d.ts +0 -11
  318. package/packages/@monomind/cli/dist/src/commands/progress.js +0 -259
  319. package/packages/@monomind/cli/dist/src/commands/providers.d.ts +0 -10
  320. package/packages/@monomind/cli/dist/src/commands/providers.js +0 -391
  321. package/packages/@monomind/cli/dist/src/commands/replay.d.ts +0 -8
  322. package/packages/@monomind/cli/dist/src/commands/replay.js +0 -60
  323. package/packages/@monomind/cli/dist/src/commands/route.d.ts +0 -16
  324. package/packages/@monomind/cli/dist/src/commands/route.js +0 -939
  325. package/packages/@monomind/cli/dist/src/commands/ruvector/backup.d.ts +0 -11
  326. package/packages/@monomind/cli/dist/src/commands/ruvector/backup.js +0 -746
  327. package/packages/@monomind/cli/dist/src/commands/ruvector/benchmark.d.ts +0 -11
  328. package/packages/@monomind/cli/dist/src/commands/ruvector/benchmark.js +0 -489
  329. package/packages/@monomind/cli/dist/src/commands/ruvector/import.d.ts +0 -18
  330. package/packages/@monomind/cli/dist/src/commands/ruvector/import.js +0 -359
  331. package/packages/@monomind/cli/dist/src/commands/ruvector/index.d.ts +0 -29
  332. package/packages/@monomind/cli/dist/src/commands/ruvector/index.js +0 -129
  333. package/packages/@monomind/cli/dist/src/commands/ruvector/init.d.ts +0 -11
  334. package/packages/@monomind/cli/dist/src/commands/ruvector/init.js +0 -481
  335. package/packages/@monomind/cli/dist/src/commands/ruvector/migrate.d.ts +0 -11
  336. package/packages/@monomind/cli/dist/src/commands/ruvector/migrate.js +0 -497
  337. package/packages/@monomind/cli/dist/src/commands/ruvector/optimize.d.ts +0 -11
  338. package/packages/@monomind/cli/dist/src/commands/ruvector/optimize.js +0 -504
  339. package/packages/@monomind/cli/dist/src/commands/ruvector/setup.d.ts +0 -18
  340. package/packages/@monomind/cli/dist/src/commands/ruvector/setup.js +0 -765
  341. package/packages/@monomind/cli/dist/src/commands/ruvector/status.d.ts +0 -11
  342. package/packages/@monomind/cli/dist/src/commands/ruvector/status.js +0 -491
  343. package/packages/@monomind/cli/dist/src/commands/security.d.ts +0 -10
  344. package/packages/@monomind/cli/dist/src/commands/security.js +0 -943
  345. package/packages/@monomind/cli/dist/src/commands/session.d.ts +0 -8
  346. package/packages/@monomind/cli/dist/src/commands/session.js +0 -793
  347. package/packages/@monomind/cli/dist/src/commands/start.d.ts +0 -8
  348. package/packages/@monomind/cli/dist/src/commands/start.js +0 -432
  349. package/packages/@monomind/cli/dist/src/commands/status.d.ts +0 -8
  350. package/packages/@monomind/cli/dist/src/commands/status.js +0 -591
  351. package/packages/@monomind/cli/dist/src/commands/swarm.d.ts +0 -8
  352. package/packages/@monomind/cli/dist/src/commands/swarm.js +0 -812
  353. package/packages/@monomind/cli/dist/src/commands/task.d.ts +0 -8
  354. package/packages/@monomind/cli/dist/src/commands/task.js +0 -671
  355. package/packages/@monomind/cli/dist/src/commands/tokens.d.ts +0 -8
  356. package/packages/@monomind/cli/dist/src/commands/tokens.js +0 -107
  357. package/packages/@monomind/cli/dist/src/commands/transfer-store.d.ts +0 -13
  358. package/packages/@monomind/cli/dist/src/commands/transfer-store.js +0 -428
  359. package/packages/@monomind/cli/dist/src/commands/ui.js +0 -68
  360. package/packages/@monomind/cli/dist/src/commands/update.d.ts +0 -8
  361. package/packages/@monomind/cli/dist/src/commands/update.js +0 -276
  362. package/packages/@monomind/cli/dist/src/commands/workflow.d.ts +0 -8
  363. package/packages/@monomind/cli/dist/src/commands/workflow.js +0 -644
  364. package/packages/@monomind/cli/dist/src/config-adapter.d.ts +0 -16
  365. package/packages/@monomind/cli/dist/src/config-adapter.js +0 -186
  366. package/packages/@monomind/cli/dist/src/consensus/audit-writer.d.ts +0 -50
  367. package/packages/@monomind/cli/dist/src/consensus/audit-writer.js +0 -142
  368. package/packages/@monomind/cli/dist/src/consensus/index.d.ts +0 -7
  369. package/packages/@monomind/cli/dist/src/consensus/index.js +0 -6
  370. package/packages/@monomind/cli/dist/src/consensus/vote-signer.d.ts +0 -36
  371. package/packages/@monomind/cli/dist/src/consensus/vote-signer.js +0 -71
  372. package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +0 -44
  373. package/packages/@monomind/cli/dist/src/context/context-provider.js +0 -25
  374. package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +0 -12
  375. package/packages/@monomind/cli/dist/src/context/git-state-provider.js +0 -34
  376. package/packages/@monomind/cli/dist/src/context/index.d.ts +0 -12
  377. package/packages/@monomind/cli/dist/src/context/index.js +0 -12
  378. package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +0 -15
  379. package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +0 -19
  380. package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +0 -26
  381. package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +0 -93
  382. package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +0 -24
  383. package/packages/@monomind/cli/dist/src/context/task-history-provider.js +0 -32
  384. package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +0 -14
  385. package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +0 -27
  386. package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +0 -31
  387. package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +0 -81
  388. package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.d.ts +0 -27
  389. package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.js +0 -90
  390. package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +0 -24
  391. package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +0 -65
  392. package/packages/@monomind/cli/dist/src/dlq/index.d.ts +0 -10
  393. package/packages/@monomind/cli/dist/src/dlq/index.js +0 -7
  394. package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +0 -33
  395. package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +0 -107
  396. package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +0 -23
  397. package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +0 -59
  398. package/packages/@monomind/cli/dist/src/eval/index.d.ts +0 -10
  399. package/packages/@monomind/cli/dist/src/eval/index.js +0 -7
  400. package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +0 -40
  401. package/packages/@monomind/cli/dist/src/eval/trace-collector.js +0 -102
  402. package/packages/@monomind/cli/dist/src/index.d.ts +0 -82
  403. package/packages/@monomind/cli/dist/src/index.js +0 -580
  404. package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
  405. package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +0 -264
  406. package/packages/@monomind/cli/dist/src/init/claudemd-generator.d.ts +0 -25
  407. package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +0 -558
  408. package/packages/@monomind/cli/dist/src/init/executor.d.ts +0 -38
  409. package/packages/@monomind/cli/dist/src/init/executor.js +0 -2172
  410. package/packages/@monomind/cli/dist/src/init/helpers-generator.d.ts +0 -60
  411. package/packages/@monomind/cli/dist/src/init/helpers-generator.js +0 -1235
  412. package/packages/@monomind/cli/dist/src/init/index.d.ts +0 -13
  413. package/packages/@monomind/cli/dist/src/init/index.js +0 -15
  414. package/packages/@monomind/cli/dist/src/init/mcp-generator.d.ts +0 -26
  415. package/packages/@monomind/cli/dist/src/init/mcp-generator.js +0 -99
  416. package/packages/@monomind/cli/dist/src/init/settings-generator.d.ts +0 -14
  417. package/packages/@monomind/cli/dist/src/init/settings-generator.js +0 -417
  418. package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.d.ts +0 -38
  419. package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.js +0 -586
  420. package/packages/@monomind/cli/dist/src/init/statusline-generator.d.ts +0 -25
  421. package/packages/@monomind/cli/dist/src/init/statusline-generator.js +0 -1159
  422. package/packages/@monomind/cli/dist/src/init/types.d.ts +0 -315
  423. package/packages/@monomind/cli/dist/src/init/types.js +0 -254
  424. package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +0 -22
  425. package/packages/@monomind/cli/dist/src/interactive/interrupt.js +0 -71
  426. package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +0 -25
  427. package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +0 -48
  428. package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +0 -61
  429. package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +0 -246
  430. package/packages/@monomind/cli/dist/src/mcp-client.d.ts +0 -92
  431. package/packages/@monomind/cli/dist/src/mcp-client.js +0 -270
  432. package/packages/@monomind/cli/dist/src/mcp-server.d.ts +0 -170
  433. package/packages/@monomind/cli/dist/src/mcp-server.js +0 -829
  434. package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.d.ts +0 -14
  435. package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.js +0 -244
  436. package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.d.ts +0 -9
  437. package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +0 -607
  438. package/packages/@monomind/cli/dist/src/mcp-tools/agentdb-tools.d.ts +0 -30
  439. package/packages/@monomind/cli/dist/src/mcp-tools/agentdb-tools.js +0 -596
  440. package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.d.ts +0 -38
  441. package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.js +0 -326
  442. package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +0 -83
  443. package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +0 -129
  444. package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.d.ts +0 -12
  445. package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.js +0 -237
  446. package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.d.ts +0 -13
  447. package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.js +0 -729
  448. package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.d.ts +0 -12
  449. package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +0 -797
  450. package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.d.ts +0 -8
  451. package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +0 -381
  452. package/packages/@monomind/cli/dist/src/mcp-tools/coordination-tools.d.ts +0 -13
  453. package/packages/@monomind/cli/dist/src/mcp-tools/coordination-tools.js +0 -728
  454. package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.d.ts +0 -13
  455. package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.js +0 -509
  456. package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.d.ts +0 -9
  457. package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +0 -823
  458. package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.d.ts +0 -9
  459. package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +0 -485
  460. package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.d.ts +0 -10
  461. package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.js +0 -49
  462. package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.d.ts +0 -15
  463. package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +0 -646
  464. package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +0 -8
  465. package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +0 -957
  466. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.d.ts +0 -44
  467. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +0 -3440
  468. package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -39
  469. package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -41
  470. package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.d.ts +0 -14
  471. package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +0 -530
  472. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.d.ts +0 -9
  473. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +0 -6306
  474. package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +0 -16
  475. package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +0 -718
  476. package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.d.ts +0 -16
  477. package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +0 -656
  478. package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.d.ts +0 -14
  479. package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.js +0 -350
  480. package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.d.ts +0 -17
  481. package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.js +0 -30
  482. package/packages/@monomind/cli/dist/src/mcp-tools/ruvllm-tools.d.ts +0 -9
  483. package/packages/@monomind/cli/dist/src/mcp-tools/ruvllm-tools.js +0 -295
  484. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.d.ts +0 -18
  485. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +0 -434
  486. package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.d.ts +0 -8
  487. package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +0 -378
  488. package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.d.ts +0 -9
  489. package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +0 -317
  490. package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.d.ts +0 -13
  491. package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +0 -552
  492. package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.d.ts +0 -8
  493. package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +0 -446
  494. package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.d.ts +0 -8
  495. package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +0 -309
  496. package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.d.ts +0 -14
  497. package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.js +0 -401
  498. package/packages/@monomind/cli/dist/src/mcp-tools/types.d.ts +0 -37
  499. package/packages/@monomind/cli/dist/src/mcp-tools/types.js +0 -14
  500. package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +0 -9
  501. package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +0 -230
  502. package/packages/@monomind/cli/dist/src/mcp-tools/workflow-tools.d.ts +0 -8
  503. package/packages/@monomind/cli/dist/src/mcp-tools/workflow-tools.js +0 -631
  504. package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.d.ts +0 -295
  505. package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +0 -632
  506. package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +0 -338
  507. package/packages/@monomind/cli/dist/src/memory/intelligence.js +0 -1049
  508. package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +0 -410
  509. package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +0 -1654
  510. package/packages/@monomind/cli/dist/src/memory/memory-initializer.d.ts +0 -414
  511. package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +0 -2284
  512. package/packages/@monomind/cli/dist/src/memory/sona-optimizer.d.ts +0 -234
  513. package/packages/@monomind/cli/dist/src/memory/sona-optimizer.js +0 -650
  514. package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +0 -21
  515. package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +0 -106
  516. package/packages/@monomind/cli/dist/src/model/index.d.ts +0 -4
  517. package/packages/@monomind/cli/dist/src/model/index.js +0 -4
  518. package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +0 -22
  519. package/packages/@monomind/cli/dist/src/model/model-settings.js +0 -33
  520. package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +0 -24
  521. package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +0 -65
  522. package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +0 -40
  523. package/packages/@monomind/cli/dist/src/observability/replay-reader.js +0 -138
  524. package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +0 -7
  525. package/packages/@monomind/cli/dist/src/orchestration/index.js +0 -6
  526. package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +0 -11
  527. package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +0 -31
  528. package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +0 -68
  529. package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +0 -180
  530. package/packages/@monomind/cli/dist/src/output.d.ts +0 -133
  531. package/packages/@monomind/cli/dist/src/output.js +0 -514
  532. package/packages/@monomind/cli/dist/src/parser.d.ts +0 -59
  533. package/packages/@monomind/cli/dist/src/parser.js +0 -459
  534. package/packages/@monomind/cli/dist/src/plugins/manager.d.ts +0 -133
  535. package/packages/@monomind/cli/dist/src/plugins/manager.js +0 -493
  536. package/packages/@monomind/cli/dist/src/plugins/store/discovery.d.ts +0 -88
  537. package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +0 -859
  538. package/packages/@monomind/cli/dist/src/plugins/store/index.d.ts +0 -76
  539. package/packages/@monomind/cli/dist/src/plugins/store/index.js +0 -141
  540. package/packages/@monomind/cli/dist/src/plugins/store/search.d.ts +0 -46
  541. package/packages/@monomind/cli/dist/src/plugins/store/search.js +0 -230
  542. package/packages/@monomind/cli/dist/src/plugins/store/types.d.ts +0 -274
  543. package/packages/@monomind/cli/dist/src/plugins/store/types.js +0 -7
  544. package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +0 -7
  545. package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +0 -126
  546. package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +0 -12
  547. package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +0 -188
  548. package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +0 -7
  549. package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +0 -206
  550. package/packages/@monomind/cli/dist/src/production/circuit-breaker.d.ts +0 -101
  551. package/packages/@monomind/cli/dist/src/production/circuit-breaker.js +0 -248
  552. package/packages/@monomind/cli/dist/src/production/error-handler.d.ts +0 -94
  553. package/packages/@monomind/cli/dist/src/production/error-handler.js +0 -321
  554. package/packages/@monomind/cli/dist/src/production/index.d.ts +0 -23
  555. package/packages/@monomind/cli/dist/src/production/index.js +0 -18
  556. package/packages/@monomind/cli/dist/src/production/monitoring.d.ts +0 -161
  557. package/packages/@monomind/cli/dist/src/production/monitoring.js +0 -360
  558. package/packages/@monomind/cli/dist/src/production/rate-limiter.d.ts +0 -80
  559. package/packages/@monomind/cli/dist/src/production/rate-limiter.js +0 -209
  560. package/packages/@monomind/cli/dist/src/production/retry.d.ts +0 -48
  561. package/packages/@monomind/cli/dist/src/production/retry.js +0 -179
  562. package/packages/@monomind/cli/dist/src/prompt.d.ts +0 -44
  563. package/packages/@monomind/cli/dist/src/prompt.js +0 -501
  564. package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +0 -60
  565. package/packages/@monomind/cli/dist/src/runtime/headless.js +0 -284
  566. package/packages/@monomind/cli/dist/src/ruvector/agent-wasm.d.ts +0 -182
  567. package/packages/@monomind/cli/dist/src/ruvector/agent-wasm.js +0 -316
  568. package/packages/@monomind/cli/dist/src/ruvector/ast-analyzer.d.ts +0 -67
  569. package/packages/@monomind/cli/dist/src/ruvector/ast-analyzer.js +0 -277
  570. package/packages/@monomind/cli/dist/src/ruvector/coverage-router.d.ts +0 -160
  571. package/packages/@monomind/cli/dist/src/ruvector/coverage-router.js +0 -539
  572. package/packages/@monomind/cli/dist/src/ruvector/coverage-tools.d.ts +0 -33
  573. package/packages/@monomind/cli/dist/src/ruvector/coverage-tools.js +0 -157
  574. package/packages/@monomind/cli/dist/src/ruvector/diff-classifier.d.ts +0 -176
  575. package/packages/@monomind/cli/dist/src/ruvector/diff-classifier.js +0 -718
  576. package/packages/@monomind/cli/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
  577. package/packages/@monomind/cli/dist/src/ruvector/enhanced-model-router.js +0 -551
  578. package/packages/@monomind/cli/dist/src/ruvector/flash-attention.d.ts +0 -195
  579. package/packages/@monomind/cli/dist/src/ruvector/flash-attention.js +0 -643
  580. package/packages/@monomind/cli/dist/src/ruvector/graph-analyzer.d.ts +0 -187
  581. package/packages/@monomind/cli/dist/src/ruvector/graph-analyzer.js +0 -929
  582. package/packages/@monomind/cli/dist/src/ruvector/index.d.ts +0 -39
  583. package/packages/@monomind/cli/dist/src/ruvector/index.js +0 -76
  584. package/packages/@monomind/cli/dist/src/ruvector/lora-adapter.d.ts +0 -218
  585. package/packages/@monomind/cli/dist/src/ruvector/lora-adapter.js +0 -455
  586. package/packages/@monomind/cli/dist/src/ruvector/model-router.d.ts +0 -222
  587. package/packages/@monomind/cli/dist/src/ruvector/model-router.js +0 -512
  588. package/packages/@monomind/cli/dist/src/ruvector/moe-router.d.ts +0 -213
  589. package/packages/@monomind/cli/dist/src/ruvector/moe-router.js +0 -649
  590. package/packages/@monomind/cli/dist/src/ruvector/q-learning-router.d.ts +0 -217
  591. package/packages/@monomind/cli/dist/src/ruvector/q-learning-router.js +0 -712
  592. package/packages/@monomind/cli/dist/src/ruvector/ruvllm-wasm.d.ts +0 -179
  593. package/packages/@monomind/cli/dist/src/ruvector/ruvllm-wasm.js +0 -363
  594. package/packages/@monomind/cli/dist/src/ruvector/semantic-router.d.ts +0 -77
  595. package/packages/@monomind/cli/dist/src/ruvector/semantic-router.js +0 -178
  596. package/packages/@monomind/cli/dist/src/ruvector/vector-db.d.ts +0 -69
  597. package/packages/@monomind/cli/dist/src/ruvector/vector-db.js +0 -243
  598. package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +0 -50
  599. package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +0 -95
  600. package/packages/@monomind/cli/dist/src/services/claim-service.d.ts +0 -206
  601. package/packages/@monomind/cli/dist/src/services/claim-service.js +0 -849
  602. package/packages/@monomind/cli/dist/src/services/config-file-manager.d.ts +0 -51
  603. package/packages/@monomind/cli/dist/src/services/config-file-manager.js +0 -312
  604. package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +0 -197
  605. package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +0 -623
  606. package/packages/@monomind/cli/dist/src/services/headless-worker-executor.d.ts +0 -311
  607. package/packages/@monomind/cli/dist/src/services/headless-worker-executor.js +0 -1167
  608. package/packages/@monomind/cli/dist/src/services/index.d.ts +0 -13
  609. package/packages/@monomind/cli/dist/src/services/index.js +0 -11
  610. package/packages/@monomind/cli/dist/src/services/registry-api.d.ts +0 -58
  611. package/packages/@monomind/cli/dist/src/services/registry-api.js +0 -199
  612. package/packages/@monomind/cli/dist/src/services/ruvector-training.d.ts +0 -222
  613. package/packages/@monomind/cli/dist/src/services/ruvector-training.js +0 -696
  614. package/packages/@monomind/cli/dist/src/services/worker-daemon.d.ts +0 -248
  615. package/packages/@monomind/cli/dist/src/services/worker-daemon.js +0 -1083
  616. package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +0 -201
  617. package/packages/@monomind/cli/dist/src/services/worker-queue.js +0 -594
  618. package/packages/@monomind/cli/dist/src/suggest.d.ts +0 -53
  619. package/packages/@monomind/cli/dist/src/suggest.js +0 -209
  620. package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +0 -25
  621. package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +0 -77
  622. package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +0 -31
  623. package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +0 -61
  624. package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +0 -19
  625. package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +0 -68
  626. package/packages/@monomind/cli/dist/src/transfer/anonymization/index.d.ts +0 -25
  627. package/packages/@monomind/cli/dist/src/transfer/anonymization/index.js +0 -177
  628. package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +0 -13
  629. package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +0 -205
  630. package/packages/@monomind/cli/dist/src/transfer/export.d.ts +0 -25
  631. package/packages/@monomind/cli/dist/src/transfer/export.js +0 -115
  632. package/packages/@monomind/cli/dist/src/transfer/index.d.ts +0 -12
  633. package/packages/@monomind/cli/dist/src/transfer/index.js +0 -31
  634. package/packages/@monomind/cli/dist/src/transfer/ipfs/client.d.ts +0 -109
  635. package/packages/@monomind/cli/dist/src/transfer/ipfs/client.js +0 -384
  636. package/packages/@monomind/cli/dist/src/transfer/ipfs/upload.d.ts +0 -95
  637. package/packages/@monomind/cli/dist/src/transfer/ipfs/upload.js +0 -420
  638. package/packages/@monomind/cli/dist/src/transfer/models/seraphine.d.ts +0 -72
  639. package/packages/@monomind/cli/dist/src/transfer/models/seraphine.js +0 -373
  640. package/packages/@monomind/cli/dist/src/transfer/serialization/cfp.d.ts +0 -49
  641. package/packages/@monomind/cli/dist/src/transfer/serialization/cfp.js +0 -183
  642. package/packages/@monomind/cli/dist/src/transfer/storage/gcs.d.ts +0 -82
  643. package/packages/@monomind/cli/dist/src/transfer/storage/gcs.js +0 -281
  644. package/packages/@monomind/cli/dist/src/transfer/storage/index.d.ts +0 -6
  645. package/packages/@monomind/cli/dist/src/transfer/storage/index.js +0 -6
  646. package/packages/@monomind/cli/dist/src/transfer/store/discovery.d.ts +0 -91
  647. package/packages/@monomind/cli/dist/src/transfer/store/discovery.js +0 -437
  648. package/packages/@monomind/cli/dist/src/transfer/store/download.d.ts +0 -79
  649. package/packages/@monomind/cli/dist/src/transfer/store/download.js +0 -423
  650. package/packages/@monomind/cli/dist/src/transfer/store/index.d.ts +0 -84
  651. package/packages/@monomind/cli/dist/src/transfer/store/index.js +0 -153
  652. package/packages/@monomind/cli/dist/src/transfer/store/publish.d.ts +0 -76
  653. package/packages/@monomind/cli/dist/src/transfer/store/publish.js +0 -293
  654. package/packages/@monomind/cli/dist/src/transfer/store/registry.d.ts +0 -58
  655. package/packages/@monomind/cli/dist/src/transfer/store/registry.js +0 -301
  656. package/packages/@monomind/cli/dist/src/transfer/store/search.d.ts +0 -54
  657. package/packages/@monomind/cli/dist/src/transfer/store/search.js +0 -232
  658. package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +0 -12
  659. package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +0 -190
  660. package/packages/@monomind/cli/dist/src/transfer/store/types.d.ts +0 -193
  661. package/packages/@monomind/cli/dist/src/transfer/store/types.js +0 -6
  662. package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +0 -6
  663. package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +0 -105
  664. package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +0 -7
  665. package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +0 -214
  666. package/packages/@monomind/cli/dist/src/transfer/types.d.ts +0 -245
  667. package/packages/@monomind/cli/dist/src/transfer/types.js +0 -6
  668. package/packages/@monomind/cli/dist/src/types.d.ts +0 -198
  669. package/packages/@monomind/cli/dist/src/types.js +0 -38
  670. package/packages/@monomind/cli/dist/src/update/checker.d.ts +0 -34
  671. package/packages/@monomind/cli/dist/src/update/checker.js +0 -198
  672. package/packages/@monomind/cli/dist/src/update/executor.d.ts +0 -32
  673. package/packages/@monomind/cli/dist/src/update/executor.js +0 -186
  674. package/packages/@monomind/cli/dist/src/update/index.d.ts +0 -33
  675. package/packages/@monomind/cli/dist/src/update/index.js +0 -64
  676. package/packages/@monomind/cli/dist/src/update/rate-limiter.d.ts +0 -31
  677. package/packages/@monomind/cli/dist/src/update/rate-limiter.js +0 -116
  678. package/packages/@monomind/cli/dist/src/update/validator.d.ts +0 -17
  679. package/packages/@monomind/cli/dist/src/update/validator.js +0 -118
  680. package/packages/@monomind/cli/dist/src/utils/parse-jsonl.d.ts +0 -6
  681. package/packages/@monomind/cli/dist/src/utils/parse-jsonl.js +0 -22
  682. package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +0 -10
  683. package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +0 -82
  684. package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +0 -12
  685. package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +0 -23
  686. package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +0 -17
  687. package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +0 -129
  688. package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +0 -9
  689. package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +0 -116
  690. package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +0 -41
  691. package/packages/@monomind/cli/dist/src/workflow/dag-types.js +0 -8
  692. package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +0 -12
  693. package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +0 -20
  694. package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +0 -165
  695. package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +0 -82
  696. package/packages/@monomind/cli/dist/src/workflow/index.d.ts +0 -13
  697. package/packages/@monomind/cli/dist/src/workflow/index.js +0 -11
  698. package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +0 -11
  699. package/packages/@monomind/cli/dist/src/workflow/template-engine.js +0 -40
  700. package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +0 -29
  701. package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +0 -227
@@ -1,2048 +0,0 @@
1
- /**
2
- * CLI Analyze Command
3
- * Code analysis, diff classification, AST analysis, and change risk assessment
4
- *
5
- * Features:
6
- * - AST analysis using ruvector (tree-sitter) with graceful fallback
7
- * - Symbol extraction (functions, classes, variables, types)
8
- * - Cyclomatic complexity scoring
9
- * - Diff classification and risk assessment
10
- * - Graph boundaries using MinCut algorithm
11
- * - Module communities using Louvain algorithm
12
- * - Circular dependency detection
13
- *
14
- * github.com/nokhodian/monomind
15
- */
16
- import { output } from '../output.js';
17
- import { callMCPTool, MCPClientError } from '../mcp-client.js';
18
- import * as path from 'path';
19
- import * as fs from 'fs/promises';
20
- import { writeFile } from 'fs/promises';
21
- import { resolve } from 'path';
22
- import { execSync } from 'child_process';
23
- // Dynamic import for AST analyzer
24
- async function getASTAnalyzer() {
25
- try {
26
- return await import('../ruvector/ast-analyzer.js');
27
- }
28
- catch {
29
- return null;
30
- }
31
- }
32
- // Dynamic import for graph analyzer
33
- async function getGraphAnalyzer() {
34
- try {
35
- return await import('../ruvector/graph-analyzer.js');
36
- }
37
- catch {
38
- return null;
39
- }
40
- }
41
- // Diff subcommand
42
- const diffCommand = {
43
- name: 'diff',
44
- description: 'Analyze git diff for change risk assessment and classification',
45
- options: [
46
- {
47
- name: 'risk',
48
- short: 'r',
49
- description: 'Show risk assessment',
50
- type: 'boolean',
51
- default: false,
52
- },
53
- {
54
- name: 'classify',
55
- short: 'c',
56
- description: 'Classify change type',
57
- type: 'boolean',
58
- default: false,
59
- },
60
- {
61
- name: 'reviewers',
62
- description: 'Show recommended reviewers',
63
- type: 'boolean',
64
- default: false,
65
- },
66
- {
67
- name: 'format',
68
- short: 'f',
69
- description: 'Output format: text, json, table',
70
- type: 'string',
71
- default: 'text',
72
- choices: ['text', 'json', 'table'],
73
- },
74
- {
75
- name: 'verbose',
76
- short: 'v',
77
- description: 'Show detailed file-level analysis',
78
- type: 'boolean',
79
- default: false,
80
- },
81
- ],
82
- examples: [
83
- { command: 'monomind analyze diff --risk', description: 'Analyze current diff with risk assessment' },
84
- { command: 'monomind analyze diff HEAD~1 --classify', description: 'Classify changes from last commit' },
85
- { command: 'monomind analyze diff main..feature --format json', description: 'Compare branches with JSON output' },
86
- { command: 'monomind analyze diff --reviewers', description: 'Get recommended reviewers for changes' },
87
- ],
88
- action: async (ctx) => {
89
- const ref = ctx.args[0] || 'HEAD';
90
- const showRisk = ctx.flags.risk;
91
- const showClassify = ctx.flags.classify;
92
- const showReviewers = ctx.flags.reviewers;
93
- const formatType = ctx.flags.format || 'text';
94
- const verbose = ctx.flags.verbose;
95
- // If no specific flag, show all
96
- const showAll = !showRisk && !showClassify && !showReviewers;
97
- output.printInfo(`Analyzing diff: ${output.highlight(ref)}`);
98
- try {
99
- // Call MCP tool for diff analysis
100
- const result = await callMCPTool('analyze_diff', {
101
- ref,
102
- includeFileRisks: verbose,
103
- includeReviewers: showReviewers || showAll,
104
- });
105
- // JSON output
106
- if (formatType === 'json') {
107
- output.printJson(result);
108
- return { success: true, data: result };
109
- }
110
- output.writeln();
111
- // Summary box
112
- const files = result.files || [];
113
- const risk = result.risk || { overall: 'unknown', score: 0, breakdown: { fileCount: 0, totalChanges: 0, highRiskFiles: [], securityConcerns: [], breakingChanges: [], testCoverage: 'unknown' } };
114
- const classification = result.classification || { category: 'unknown', confidence: 0, reasoning: '' };
115
- output.printBox([
116
- `Ref: ${result.ref || 'HEAD'}`,
117
- `Files: ${files.length}`,
118
- `Risk: ${getRiskDisplay(risk.overall)} (${risk.score}/100)`,
119
- `Type: ${classification.category}${classification.subcategory ? ` (${classification.subcategory})` : ''}`,
120
- ``,
121
- result.summary || 'No summary available',
122
- ].join('\n'), 'Diff Analysis');
123
- // Risk assessment
124
- if (showRisk || showAll) {
125
- output.writeln();
126
- output.writeln(output.bold('Risk Assessment'));
127
- output.writeln(output.dim('-'.repeat(50)));
128
- output.printTable({
129
- columns: [
130
- { key: 'metric', header: 'Metric', width: 25 },
131
- { key: 'value', header: 'Value', width: 30 },
132
- ],
133
- data: [
134
- { metric: 'Overall Risk', value: getRiskDisplay(risk.overall) },
135
- { metric: 'Risk Score', value: `${risk.score}/100` },
136
- { metric: 'Files Changed', value: risk.breakdown.fileCount },
137
- { metric: 'Total Lines Changed', value: risk.breakdown.totalChanges },
138
- { metric: 'Test Coverage', value: risk.breakdown.testCoverage },
139
- ],
140
- });
141
- // Security concerns
142
- if (risk.breakdown.securityConcerns.length > 0) {
143
- output.writeln();
144
- output.writeln(output.bold(output.warning('Security Concerns')));
145
- output.printList(risk.breakdown.securityConcerns.map(c => output.warning(c)));
146
- }
147
- // Breaking changes
148
- if (risk.breakdown.breakingChanges.length > 0) {
149
- output.writeln();
150
- output.writeln(output.bold(output.error('Potential Breaking Changes')));
151
- output.printList(risk.breakdown.breakingChanges.map(c => output.error(c)));
152
- }
153
- // High risk files
154
- if (risk.breakdown.highRiskFiles.length > 0) {
155
- output.writeln();
156
- output.writeln(output.bold('High Risk Files'));
157
- output.printList(risk.breakdown.highRiskFiles.map(f => output.warning(f)));
158
- }
159
- }
160
- // Classification
161
- if (showClassify || showAll) {
162
- output.writeln();
163
- output.writeln(output.bold('Classification'));
164
- output.writeln(output.dim('-'.repeat(50)));
165
- output.printTable({
166
- columns: [
167
- { key: 'field', header: 'Field', width: 15 },
168
- { key: 'value', header: 'Value', width: 40 },
169
- ],
170
- data: [
171
- { field: 'Category', value: classification.category },
172
- { field: 'Subcategory', value: classification.subcategory || '-' },
173
- { field: 'Confidence', value: `${(classification.confidence * 100).toFixed(0)}%` },
174
- ],
175
- });
176
- output.writeln();
177
- output.writeln(output.dim(`Reasoning: ${classification.reasoning}`));
178
- }
179
- // Reviewers
180
- if (showReviewers || showAll) {
181
- output.writeln();
182
- output.writeln(output.bold('Recommended Reviewers'));
183
- output.writeln(output.dim('-'.repeat(50)));
184
- const reviewers = result.recommendedReviewers || [];
185
- if (reviewers.length > 0) {
186
- output.printNumberedList(reviewers.map(r => output.highlight(r)));
187
- }
188
- else {
189
- output.writeln(output.dim('No specific reviewers recommended'));
190
- }
191
- }
192
- // Verbose file-level details
193
- if (verbose && result.fileRisks) {
194
- output.writeln();
195
- output.writeln(output.bold('File-Level Analysis'));
196
- output.writeln(output.dim('-'.repeat(50)));
197
- output.printTable({
198
- columns: [
199
- { key: 'path', header: 'File', width: 40 },
200
- { key: 'risk', header: 'Risk', width: 12, format: (v) => getRiskDisplay(String(v)) },
201
- { key: 'score', header: 'Score', width: 8, align: 'right' },
202
- { key: 'reasons', header: 'Reasons', width: 30, format: (v) => {
203
- const reasons = v;
204
- return reasons.slice(0, 2).join('; ');
205
- } },
206
- ],
207
- data: result.fileRisks,
208
- });
209
- }
210
- // Files changed table
211
- if (formatType === 'table' || showAll) {
212
- output.writeln();
213
- output.writeln(output.bold('Files Changed'));
214
- output.writeln(output.dim('-'.repeat(50)));
215
- output.printTable({
216
- columns: [
217
- { key: 'status', header: 'Status', width: 10, format: (v) => getStatusDisplay(String(v)) },
218
- { key: 'path', header: 'File', width: 45 },
219
- { key: 'additions', header: '+', width: 8, align: 'right', format: (v) => output.success(`+${v}`) },
220
- { key: 'deletions', header: '-', width: 8, align: 'right', format: (v) => output.error(`-${v}`) },
221
- ],
222
- data: files.slice(0, 20),
223
- });
224
- if (files.length > 20) {
225
- output.writeln(output.dim(` ... and ${files.length - 20} more files`));
226
- }
227
- }
228
- return { success: true, data: result };
229
- }
230
- catch (error) {
231
- if (error instanceof MCPClientError) {
232
- output.printError(`Diff analysis failed: ${error.message}`);
233
- }
234
- else {
235
- output.printError(`Unexpected error: ${String(error)}`);
236
- }
237
- return { success: false, exitCode: 1 };
238
- }
239
- },
240
- };
241
- // Code subcommand (placeholder for future code analysis)
242
- const codeCommand = {
243
- name: 'code',
244
- description: 'Static code analysis and quality assessment',
245
- options: [
246
- { name: 'path', short: 'p', type: 'string', description: 'Path to analyze', default: '.' },
247
- { name: 'type', short: 't', type: 'string', description: 'Analysis type: quality, complexity, security', default: 'quality' },
248
- { name: 'format', short: 'f', type: 'string', description: 'Output format: text, json', default: 'text' },
249
- ],
250
- examples: [
251
- { command: 'monomind analyze code -p ./src', description: 'Analyze source directory' },
252
- { command: 'monomind analyze code --type complexity', description: 'Run complexity analysis' },
253
- ],
254
- action: async (ctx) => {
255
- const targetPath = resolve(ctx.flags.path || '.');
256
- const analysisType = ctx.flags.type || 'quality';
257
- const formatJson = ctx.flags.format === 'json';
258
- output.writeln();
259
- output.writeln(output.bold('Code Analysis'));
260
- output.writeln(output.dim('-'.repeat(50)));
261
- const spinner = output.createSpinner({ text: `Analyzing ${targetPath}...`, spinner: 'dots' });
262
- spinner.start();
263
- try {
264
- const files = await scanSourceFiles(targetPath);
265
- if (files.length === 0) {
266
- spinner.stop();
267
- output.printWarning('No source files found');
268
- return { success: true };
269
- }
270
- const fileStats = [];
271
- for (const filePath of files) {
272
- const content = await fs.readFile(filePath, 'utf-8');
273
- const lines = content.split('\n');
274
- const nonEmpty = lines.filter(l => l.trim().length > 0 && !/^\s*(\/\/|\/\*|\*\s|#)/.test(l)).length;
275
- const todos = (content.match(/\b(TODO|FIXME|HACK|XXX)\b/gi) || []).length;
276
- const fns = (content.match(/(?:export\s+)?(?:async\s+)?function\s+\w+|(?:const|let|var)\s+\w+\s*=\s*(?:async\s+)?\([^)]*\)\s*=>/g) || []).length;
277
- const imps = (content.match(/^import\s+/gm) || []).length + (content.match(/require\s*\(/g) || []).length;
278
- let maxNesting = 0;
279
- let nesting = 0;
280
- for (const line of lines) {
281
- nesting += (line.match(/\{/g) || []).length;
282
- nesting -= (line.match(/\}/g) || []).length;
283
- if (nesting > maxNesting)
284
- maxNesting = nesting;
285
- }
286
- const securityIssues = [];
287
- if (/\beval\s*\(/.test(content))
288
- securityIssues.push('eval()');
289
- if (/\bexec\s*\(/.test(content))
290
- securityIssues.push('exec()');
291
- if (/\.innerHTML\s*=/.test(content))
292
- securityIssues.push('innerHTML');
293
- if (/dangerouslySetInnerHTML/.test(content))
294
- securityIssues.push('dangerouslySetInnerHTML');
295
- if (/['"](?:password|secret|api[_-]?key|token)\s*[:=]\s*['"][^'"]{3,}['"]/i.test(content))
296
- securityIssues.push('hardcoded secret');
297
- if (/new\s+Function\s*\(/.test(content))
298
- securityIssues.push('new Function()');
299
- fileStats.push({
300
- file: filePath,
301
- loc: nonEmpty,
302
- todos,
303
- functions: fns,
304
- imports: imps,
305
- maxNesting,
306
- securityIssues,
307
- });
308
- }
309
- spinner.stop();
310
- const totalLoc = fileStats.reduce((s, f) => s + f.loc, 0);
311
- const totalTodos = fileStats.reduce((s, f) => s + f.todos, 0);
312
- const totalFunctions = fileStats.reduce((s, f) => s + f.functions, 0);
313
- const totalImports = fileStats.reduce((s, f) => s + f.imports, 0);
314
- const avgFileSize = Math.round(totalLoc / files.length);
315
- const longestFile = fileStats.reduce((a, b) => a.loc > b.loc ? a : b);
316
- const avgFnPerFile = (totalFunctions / files.length).toFixed(1);
317
- const deepestNesting = fileStats.reduce((a, b) => a.maxNesting > b.maxNesting ? a : b);
318
- const allSecurityIssues = fileStats.filter(f => f.securityIssues.length > 0);
319
- if (formatJson) {
320
- const jsonData = { type: analysisType, path: targetPath, files: files.length, totalLoc, totalTodos, totalFunctions, totalImports, avgFileSize, fileStats: fileStats.map(f => ({ relativePath: path.relative(targetPath, f.file), loc: f.loc, todos: f.todos, functions: f.functions, imports: f.imports, maxNesting: f.maxNesting, securityIssues: f.securityIssues })) };
321
- output.printJson(jsonData);
322
- return { success: true, data: jsonData };
323
- }
324
- if (analysisType === 'quality') {
325
- output.printBox([`Files: ${files.length}`, `Lines of Code: ${totalLoc.toLocaleString()}`, `Avg File Size: ${avgFileSize} LOC`, `TODO/FIXME: ${totalTodos}`, `Functions: ${totalFunctions}`, `Imports: ${totalImports}`].join('\n'), 'Quality Summary');
326
- output.writeln();
327
- output.writeln(output.bold('Largest Files'));
328
- output.writeln(output.dim('-'.repeat(60)));
329
- const top10 = [...fileStats].sort((a, b) => b.loc - a.loc).slice(0, 10);
330
- output.printTable({
331
- columns: [
332
- { key: 'file', header: 'File', width: 45 },
333
- { key: 'loc', header: 'LOC', width: 8, align: 'right' },
334
- { key: 'fns', header: 'Fns', width: 6, align: 'right' },
335
- { key: 'todos', header: 'TODOs', width: 7, align: 'right' },
336
- ],
337
- data: top10.map(f => ({ file: path.relative(targetPath, f.file), loc: f.loc, fns: f.functions, todos: f.todos })),
338
- });
339
- if (totalTodos > 0) {
340
- output.writeln();
341
- output.printWarning(`${totalTodos} TODO/FIXME comments found across ${fileStats.filter(f => f.todos > 0).length} files`);
342
- }
343
- }
344
- else if (analysisType === 'complexity') {
345
- output.printBox([`Files: ${files.length}`, `Total Functions: ${totalFunctions}`, `Avg Functions/File: ${avgFnPerFile}`, `Deepest Nesting: ${deepestNesting.maxNesting} levels (${path.relative(targetPath, deepestNesting.file)})`, `Longest File: ${longestFile.loc} LOC (${path.relative(targetPath, longestFile.file)})`].join('\n'), 'Complexity Summary');
346
- output.writeln();
347
- output.writeln(output.bold('High Complexity Files (nesting > 5)'));
348
- output.writeln(output.dim('-'.repeat(60)));
349
- const complex = fileStats.filter(f => f.maxNesting > 5).sort((a, b) => b.maxNesting - a.maxNesting);
350
- if (complex.length === 0) {
351
- output.printSuccess('No files with excessive nesting detected');
352
- }
353
- else {
354
- output.printTable({
355
- columns: [
356
- { key: 'file', header: 'File', width: 45 },
357
- { key: 'nesting', header: 'Max Nest', width: 10, align: 'right' },
358
- { key: 'fns', header: 'Fns', width: 6, align: 'right' },
359
- { key: 'loc', header: 'LOC', width: 8, align: 'right' },
360
- ],
361
- data: complex.slice(0, 15).map(f => ({ file: path.relative(targetPath, f.file), nesting: f.maxNesting, fns: f.functions, loc: f.loc })),
362
- });
363
- }
364
- }
365
- else if (analysisType === 'security') {
366
- output.printBox([`Files Scanned: ${files.length}`, `Files with Issues: ${allSecurityIssues.length}`, `Total Issues: ${allSecurityIssues.reduce((s, f) => s + f.securityIssues.length, 0)}`].join('\n'), 'Security Summary');
367
- if (allSecurityIssues.length === 0) {
368
- output.writeln();
369
- output.printSuccess('No common security patterns detected');
370
- }
371
- else {
372
- output.writeln();
373
- output.writeln(output.bold('Security Concerns'));
374
- output.writeln(output.dim('-'.repeat(60)));
375
- output.printTable({
376
- columns: [
377
- { key: 'file', header: 'File', width: 40 },
378
- { key: 'issues', header: 'Issues', width: 35 },
379
- ],
380
- data: allSecurityIssues.map(f => ({ file: path.relative(targetPath, f.file), issues: f.securityIssues.join(', ') })),
381
- });
382
- }
383
- }
384
- else {
385
- output.printWarning(`Unknown analysis type: ${analysisType}. Use quality, complexity, or security.`);
386
- }
387
- return { success: true };
388
- }
389
- catch (error) {
390
- spinner.stop();
391
- const message = error instanceof Error ? error.message : String(error);
392
- output.printError(`Code analysis failed: ${message}`);
393
- return { success: false, exitCode: 1 };
394
- }
395
- },
396
- };
397
- // ============================================================================
398
- // AST Analysis Subcommands (using ruvector tree-sitter with fallback)
399
- // ============================================================================
400
- /**
401
- * Helper: Truncate file path for display
402
- */
403
- function truncatePathAst(filePath, maxLen = 45) {
404
- if (filePath.length <= maxLen)
405
- return filePath;
406
- return '...' + filePath.slice(-(maxLen - 3));
407
- }
408
- /**
409
- * Helper: Format complexity value with color coding
410
- */
411
- function formatComplexityValueAst(value) {
412
- if (value <= 5)
413
- return output.success(String(value));
414
- if (value <= 10)
415
- return output.warning(String(value));
416
- return output.error(String(value));
417
- }
418
- /**
419
- * Helper: Get type marker for symbols
420
- */
421
- function getTypeMarkerAst(type) {
422
- switch (type) {
423
- case 'function': return output.success('fn');
424
- case 'class': return output.info('class');
425
- case 'variable': return output.dim('var');
426
- case 'type': return output.highlight('type');
427
- case 'interface': return output.highlight('iface');
428
- default: return output.dim(type.slice(0, 5));
429
- }
430
- }
431
- /**
432
- * Helper: Get complexity rating text
433
- */
434
- function getComplexityRatingAst(value) {
435
- if (value <= 5)
436
- return output.success('Simple');
437
- if (value <= 10)
438
- return output.warning('Moderate');
439
- if (value <= 20)
440
- return output.error('Complex');
441
- return output.error(output.bold('Very Complex'));
442
- }
443
- /**
444
- * AST analysis subcommand
445
- */
446
- const astCommand = {
447
- name: 'ast',
448
- description: 'Analyze code using AST parsing (tree-sitter via ruvector)',
449
- options: [
450
- {
451
- name: 'complexity',
452
- short: 'c',
453
- description: 'Include complexity metrics',
454
- type: 'boolean',
455
- default: false,
456
- },
457
- {
458
- name: 'symbols',
459
- short: 's',
460
- description: 'Include symbol extraction',
461
- type: 'boolean',
462
- default: false,
463
- },
464
- {
465
- name: 'format',
466
- short: 'f',
467
- description: 'Output format (text, json, table)',
468
- type: 'string',
469
- default: 'text',
470
- choices: ['text', 'json', 'table'],
471
- },
472
- {
473
- name: 'output',
474
- short: 'o',
475
- description: 'Output file path',
476
- type: 'string',
477
- },
478
- {
479
- name: 'verbose',
480
- short: 'v',
481
- description: 'Show detailed analysis',
482
- type: 'boolean',
483
- default: false,
484
- },
485
- ],
486
- examples: [
487
- { command: 'monomind analyze ast src/', description: 'Analyze all files in src/' },
488
- { command: 'monomind analyze ast src/index.ts --complexity', description: 'Analyze with complexity' },
489
- { command: 'monomind analyze ast . --format json', description: 'JSON output' },
490
- { command: 'monomind analyze ast src/ --symbols', description: 'Extract symbols' },
491
- ],
492
- action: async (ctx) => {
493
- const targetPath = ctx.args[0] || ctx.cwd;
494
- const showComplexity = ctx.flags.complexity;
495
- const showSymbols = ctx.flags.symbols;
496
- const formatType = ctx.flags.format || 'text';
497
- const outputFile = ctx.flags.output;
498
- const verbose = ctx.flags.verbose;
499
- // If no specific flags, show summary
500
- const showAll = !showComplexity && !showSymbols;
501
- output.printInfo(`Analyzing: ${output.highlight(targetPath)}`);
502
- output.writeln();
503
- const spinner = output.createSpinner({ text: 'Parsing AST...', spinner: 'dots' });
504
- spinner.start();
505
- try {
506
- const astModule = await getASTAnalyzer();
507
- if (!astModule) {
508
- spinner.stop();
509
- output.printWarning('AST analyzer not available, using regex fallback');
510
- }
511
- // Resolve path and check if file or directory
512
- const resolvedPath = resolve(targetPath);
513
- const stat = await fs.stat(resolvedPath);
514
- const isDirectory = stat.isDirectory();
515
- let results = [];
516
- if (isDirectory) {
517
- // Scan directory for source files
518
- const files = await scanSourceFiles(resolvedPath);
519
- spinner.stop();
520
- output.printInfo(`Found ${files.length} source files`);
521
- spinner.start();
522
- for (const file of files.slice(0, 100)) {
523
- try {
524
- const content = await fs.readFile(file, 'utf-8');
525
- if (astModule) {
526
- const analyzer = astModule.createASTAnalyzer();
527
- const analysis = analyzer.analyze(content, file);
528
- results.push(analysis);
529
- }
530
- else {
531
- // Fallback analysis
532
- results.push(fallbackAnalyze(content, file));
533
- }
534
- }
535
- catch {
536
- // Skip files that can't be analyzed
537
- }
538
- }
539
- }
540
- else {
541
- // Single file
542
- const content = await fs.readFile(resolvedPath, 'utf-8');
543
- if (astModule) {
544
- const analyzer = astModule.createASTAnalyzer();
545
- const analysis = analyzer.analyze(content, resolvedPath);
546
- results.push(analysis);
547
- }
548
- else {
549
- results.push(fallbackAnalyze(content, resolvedPath));
550
- }
551
- }
552
- spinner.stop();
553
- if (results.length === 0) {
554
- output.printWarning('No files analyzed');
555
- return { success: true };
556
- }
557
- // Calculate totals
558
- const totals = {
559
- files: results.length,
560
- functions: results.reduce((sum, r) => sum + r.functions.length, 0),
561
- classes: results.reduce((sum, r) => sum + r.classes.length, 0),
562
- imports: results.reduce((sum, r) => sum + r.imports.length, 0),
563
- avgComplexity: results.reduce((sum, r) => sum + r.complexity.cyclomatic, 0) / results.length,
564
- totalLoc: results.reduce((sum, r) => sum + r.complexity.loc, 0),
565
- };
566
- // JSON output
567
- if (formatType === 'json') {
568
- const jsonOutput = { files: results, totals };
569
- if (outputFile) {
570
- await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
571
- output.printSuccess(`Results written to ${outputFile}`);
572
- }
573
- else {
574
- output.printJson(jsonOutput);
575
- }
576
- return { success: true, data: jsonOutput };
577
- }
578
- // Summary box
579
- output.printBox([
580
- `Files analyzed: ${totals.files}`,
581
- `Functions: ${totals.functions}`,
582
- `Classes: ${totals.classes}`,
583
- `Total LOC: ${totals.totalLoc}`,
584
- `Avg Complexity: ${formatComplexityValueAst(Math.round(totals.avgComplexity))}`,
585
- ].join('\n'), 'AST Analysis Summary');
586
- // Complexity view
587
- if (showComplexity || showAll) {
588
- output.writeln();
589
- output.writeln(output.bold('Complexity by File'));
590
- output.writeln(output.dim('-'.repeat(60)));
591
- const complexityData = results
592
- .map(r => ({
593
- file: truncatePathAst(r.filePath),
594
- cyclomatic: r.complexity.cyclomatic,
595
- cognitive: r.complexity.cognitive,
596
- loc: r.complexity.loc,
597
- rating: getComplexityRatingAst(r.complexity.cyclomatic),
598
- }))
599
- .sort((a, b) => b.cyclomatic - a.cyclomatic)
600
- .slice(0, 15);
601
- output.printTable({
602
- columns: [
603
- { key: 'file', header: 'File', width: 40 },
604
- { key: 'cyclomatic', header: 'Cyclo', width: 8, align: 'right', format: (v) => formatComplexityValueAst(v) },
605
- { key: 'cognitive', header: 'Cogni', width: 8, align: 'right' },
606
- { key: 'loc', header: 'LOC', width: 8, align: 'right' },
607
- { key: 'rating', header: 'Rating', width: 15 },
608
- ],
609
- data: complexityData,
610
- });
611
- if (results.length > 15) {
612
- output.writeln(output.dim(` ... and ${results.length - 15} more files`));
613
- }
614
- }
615
- // Symbols view
616
- if (showSymbols || showAll) {
617
- output.writeln();
618
- output.writeln(output.bold('Extracted Symbols'));
619
- output.writeln(output.dim('-'.repeat(60)));
620
- const allSymbols = [];
621
- for (const r of results) {
622
- for (const fn of r.functions) {
623
- allSymbols.push({ name: fn.name, type: 'function', file: truncatePathAst(r.filePath, 30), line: fn.startLine });
624
- }
625
- for (const cls of r.classes) {
626
- allSymbols.push({ name: cls.name, type: 'class', file: truncatePathAst(r.filePath, 30), line: cls.startLine });
627
- }
628
- }
629
- const displaySymbols = allSymbols.slice(0, 20);
630
- output.printTable({
631
- columns: [
632
- { key: 'type', header: 'Type', width: 8, format: (v) => getTypeMarkerAst(v) },
633
- { key: 'name', header: 'Symbol', width: 30 },
634
- { key: 'file', header: 'File', width: 35 },
635
- { key: 'line', header: 'Line', width: 8, align: 'right' },
636
- ],
637
- data: displaySymbols,
638
- });
639
- if (allSymbols.length > 20) {
640
- output.writeln(output.dim(` ... and ${allSymbols.length - 20} more symbols`));
641
- }
642
- }
643
- // Verbose output
644
- if (verbose) {
645
- output.writeln();
646
- output.writeln(output.bold('Import Analysis'));
647
- output.writeln(output.dim('-'.repeat(60)));
648
- const importCounts = new Map();
649
- for (const r of results) {
650
- for (const imp of r.imports) {
651
- importCounts.set(imp, (importCounts.get(imp) || 0) + 1);
652
- }
653
- }
654
- const topImports = Array.from(importCounts.entries())
655
- .sort((a, b) => b[1] - a[1])
656
- .slice(0, 10);
657
- for (const [imp, count] of topImports) {
658
- output.writeln(` ${output.highlight(count.toString().padStart(3))} ${imp}`);
659
- }
660
- }
661
- if (outputFile) {
662
- await writeFile(outputFile, JSON.stringify({ files: results, totals }, null, 2));
663
- output.printSuccess(`Results written to ${outputFile}`);
664
- }
665
- return { success: true, data: { files: results, totals } };
666
- }
667
- catch (error) {
668
- spinner.stop();
669
- const message = error instanceof Error ? error.message : String(error);
670
- output.printError(`AST analysis failed: ${message}`);
671
- return { success: false, exitCode: 1 };
672
- }
673
- },
674
- };
675
- /**
676
- * Complexity analysis subcommand
677
- */
678
- const complexityAstCommand = {
679
- name: 'complexity',
680
- aliases: ['cx'],
681
- description: 'Analyze code complexity metrics',
682
- options: [
683
- {
684
- name: 'threshold',
685
- short: 't',
686
- description: 'Complexity threshold to flag (default: 10)',
687
- type: 'number',
688
- default: 10,
689
- },
690
- {
691
- name: 'format',
692
- short: 'f',
693
- description: 'Output format (text, json)',
694
- type: 'string',
695
- default: 'text',
696
- choices: ['text', 'json'],
697
- },
698
- {
699
- name: 'output',
700
- short: 'o',
701
- description: 'Output file path',
702
- type: 'string',
703
- },
704
- ],
705
- examples: [
706
- { command: 'monomind analyze complexity src/', description: 'Analyze complexity' },
707
- { command: 'monomind analyze complexity src/ --threshold 15', description: 'Flag high complexity' },
708
- ],
709
- action: async (ctx) => {
710
- const targetPath = ctx.args[0] || ctx.cwd;
711
- const threshold = ctx.flags.threshold || 10;
712
- const formatType = ctx.flags.format || 'text';
713
- const outputFile = ctx.flags.output;
714
- output.printInfo(`Analyzing complexity: ${output.highlight(targetPath)}`);
715
- output.writeln();
716
- const spinner = output.createSpinner({ text: 'Calculating complexity...', spinner: 'dots' });
717
- spinner.start();
718
- try {
719
- const astModule = await getASTAnalyzer();
720
- const resolvedPath = resolve(targetPath);
721
- const stat = await fs.stat(resolvedPath);
722
- const files = stat.isDirectory() ? await scanSourceFiles(resolvedPath) : [resolvedPath];
723
- const results = [];
724
- for (const file of files.slice(0, 100)) {
725
- try {
726
- const content = await fs.readFile(file, 'utf-8');
727
- let analysis;
728
- if (astModule) {
729
- const analyzer = astModule.createASTAnalyzer();
730
- analysis = analyzer.analyze(content, file);
731
- }
732
- else {
733
- analysis = fallbackAnalyze(content, file);
734
- }
735
- const flagged = analysis.complexity.cyclomatic > threshold;
736
- const rating = analysis.complexity.cyclomatic <= 5 ? 'Simple' :
737
- analysis.complexity.cyclomatic <= 10 ? 'Moderate' :
738
- analysis.complexity.cyclomatic <= 20 ? 'Complex' : 'Very Complex';
739
- results.push({
740
- file: file,
741
- cyclomatic: analysis.complexity.cyclomatic,
742
- cognitive: analysis.complexity.cognitive,
743
- loc: analysis.complexity.loc,
744
- commentDensity: analysis.complexity.commentDensity,
745
- rating,
746
- flagged,
747
- });
748
- }
749
- catch {
750
- // Skip files that can't be analyzed
751
- }
752
- }
753
- spinner.stop();
754
- // Sort by complexity descending
755
- results.sort((a, b) => b.cyclomatic - a.cyclomatic);
756
- const flaggedCount = results.filter(r => r.flagged).length;
757
- const avgComplexity = results.length > 0
758
- ? results.reduce((sum, r) => sum + r.cyclomatic, 0) / results.length
759
- : 0;
760
- if (formatType === 'json') {
761
- const jsonOutput = { files: results, summary: { total: results.length, flagged: flaggedCount, avgComplexity, threshold } };
762
- if (outputFile) {
763
- await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
764
- output.printSuccess(`Results written to ${outputFile}`);
765
- }
766
- else {
767
- output.printJson(jsonOutput);
768
- }
769
- return { success: true, data: jsonOutput };
770
- }
771
- // Summary
772
- output.printBox([
773
- `Files analyzed: ${results.length}`,
774
- `Threshold: ${threshold}`,
775
- `Flagged files: ${flaggedCount > 0 ? output.error(String(flaggedCount)) : output.success('0')}`,
776
- `Average complexity: ${formatComplexityValueAst(Math.round(avgComplexity))}`,
777
- ].join('\n'), 'Complexity Analysis');
778
- // Show flagged files first
779
- if (flaggedCount > 0) {
780
- output.writeln();
781
- output.writeln(output.bold(output.warning(`High Complexity Files (>${threshold})`)));
782
- output.writeln(output.dim('-'.repeat(60)));
783
- const flaggedFiles = results.filter(r => r.flagged).slice(0, 10);
784
- output.printTable({
785
- columns: [
786
- { key: 'file', header: 'File', width: 40, format: (v) => truncatePathAst(v) },
787
- { key: 'cyclomatic', header: 'Cyclo', width: 8, align: 'right', format: (v) => output.error(String(v)) },
788
- { key: 'cognitive', header: 'Cogni', width: 8, align: 'right' },
789
- { key: 'loc', header: 'LOC', width: 8, align: 'right' },
790
- { key: 'rating', header: 'Rating', width: 15 },
791
- ],
792
- data: flaggedFiles,
793
- });
794
- }
795
- // Show all files in table format
796
- output.writeln();
797
- output.writeln(output.bold('All Files'));
798
- output.writeln(output.dim('-'.repeat(60)));
799
- const displayFiles = results.slice(0, 15);
800
- output.printTable({
801
- columns: [
802
- { key: 'file', header: 'File', width: 40, format: (v) => truncatePathAst(v) },
803
- { key: 'cyclomatic', header: 'Cyclo', width: 8, align: 'right', format: (v) => formatComplexityValueAst(v) },
804
- { key: 'cognitive', header: 'Cogni', width: 8, align: 'right' },
805
- { key: 'loc', header: 'LOC', width: 8, align: 'right' },
806
- ],
807
- data: displayFiles,
808
- });
809
- if (results.length > 15) {
810
- output.writeln(output.dim(` ... and ${results.length - 15} more files`));
811
- }
812
- if (outputFile) {
813
- await writeFile(outputFile, JSON.stringify({ files: results, summary: { total: results.length, flagged: flaggedCount, avgComplexity, threshold } }, null, 2));
814
- output.printSuccess(`Results written to ${outputFile}`);
815
- }
816
- return { success: true, data: { files: results, flaggedCount } };
817
- }
818
- catch (error) {
819
- spinner.stop();
820
- const message = error instanceof Error ? error.message : String(error);
821
- output.printError(`Complexity analysis failed: ${message}`);
822
- return { success: false, exitCode: 1 };
823
- }
824
- },
825
- };
826
- /**
827
- * Symbol extraction subcommand
828
- */
829
- const symbolsCommand = {
830
- name: 'symbols',
831
- aliases: ['sym'],
832
- description: 'Extract and list code symbols (functions, classes, types)',
833
- options: [
834
- {
835
- name: 'type',
836
- short: 't',
837
- description: 'Filter by symbol type (function, class, all)',
838
- type: 'string',
839
- default: 'all',
840
- choices: ['function', 'class', 'all'],
841
- },
842
- {
843
- name: 'format',
844
- short: 'f',
845
- description: 'Output format (text, json)',
846
- type: 'string',
847
- default: 'text',
848
- choices: ['text', 'json'],
849
- },
850
- {
851
- name: 'output',
852
- short: 'o',
853
- description: 'Output file path',
854
- type: 'string',
855
- },
856
- ],
857
- examples: [
858
- { command: 'monomind analyze symbols src/', description: 'Extract all symbols' },
859
- { command: 'monomind analyze symbols src/ --type function', description: 'Only functions' },
860
- { command: 'monomind analyze symbols src/ --format json', description: 'JSON output' },
861
- ],
862
- action: async (ctx) => {
863
- const targetPath = ctx.args[0] || ctx.cwd;
864
- const symbolType = ctx.flags.type || 'all';
865
- const formatType = ctx.flags.format || 'text';
866
- const outputFile = ctx.flags.output;
867
- output.printInfo(`Extracting symbols: ${output.highlight(targetPath)}`);
868
- output.writeln();
869
- const spinner = output.createSpinner({ text: 'Parsing code...', spinner: 'dots' });
870
- spinner.start();
871
- try {
872
- const astModule = await getASTAnalyzer();
873
- const resolvedPath = resolve(targetPath);
874
- const stat = await fs.stat(resolvedPath);
875
- const files = stat.isDirectory() ? await scanSourceFiles(resolvedPath) : [resolvedPath];
876
- const symbols = [];
877
- for (const file of files.slice(0, 100)) {
878
- try {
879
- const content = await fs.readFile(file, 'utf-8');
880
- let analysis;
881
- if (astModule) {
882
- const analyzer = astModule.createASTAnalyzer();
883
- analysis = analyzer.analyze(content, file);
884
- }
885
- else {
886
- analysis = fallbackAnalyze(content, file);
887
- }
888
- if (symbolType === 'all' || symbolType === 'function') {
889
- for (const fn of analysis.functions) {
890
- symbols.push({
891
- name: fn.name,
892
- type: 'function',
893
- file,
894
- startLine: fn.startLine,
895
- endLine: fn.endLine,
896
- });
897
- }
898
- }
899
- if (symbolType === 'all' || symbolType === 'class') {
900
- for (const cls of analysis.classes) {
901
- symbols.push({
902
- name: cls.name,
903
- type: 'class',
904
- file,
905
- startLine: cls.startLine,
906
- endLine: cls.endLine,
907
- });
908
- }
909
- }
910
- }
911
- catch {
912
- // Skip files that can't be parsed
913
- }
914
- }
915
- spinner.stop();
916
- // Sort by file then name
917
- symbols.sort((a, b) => a.file.localeCompare(b.file) || a.name.localeCompare(b.name));
918
- if (formatType === 'json') {
919
- if (outputFile) {
920
- await writeFile(outputFile, JSON.stringify(symbols, null, 2));
921
- output.printSuccess(`Results written to ${outputFile}`);
922
- }
923
- else {
924
- output.printJson(symbols);
925
- }
926
- return { success: true, data: symbols };
927
- }
928
- // Summary
929
- const functionCount = symbols.filter(s => s.type === 'function').length;
930
- const classCount = symbols.filter(s => s.type === 'class').length;
931
- output.printBox([
932
- `Total symbols: ${symbols.length}`,
933
- `Functions: ${functionCount}`,
934
- `Classes: ${classCount}`,
935
- `Files: ${files.length}`,
936
- ].join('\n'), 'Symbol Extraction');
937
- output.writeln();
938
- output.writeln(output.bold('Symbols'));
939
- output.writeln(output.dim('-'.repeat(60)));
940
- const displaySymbols = symbols.slice(0, 30);
941
- output.printTable({
942
- columns: [
943
- { key: 'type', header: 'Type', width: 10, format: (v) => getTypeMarkerAst(v) },
944
- { key: 'name', header: 'Name', width: 30 },
945
- { key: 'file', header: 'File', width: 35, format: (v) => truncatePathAst(v, 33) },
946
- { key: 'startLine', header: 'Line', width: 8, align: 'right' },
947
- ],
948
- data: displaySymbols,
949
- });
950
- if (symbols.length > 30) {
951
- output.writeln(output.dim(` ... and ${symbols.length - 30} more symbols`));
952
- }
953
- if (outputFile) {
954
- await writeFile(outputFile, JSON.stringify(symbols, null, 2));
955
- output.printSuccess(`Results written to ${outputFile}`);
956
- }
957
- return { success: true, data: symbols };
958
- }
959
- catch (error) {
960
- spinner.stop();
961
- const message = error instanceof Error ? error.message : String(error);
962
- output.printError(`Symbol extraction failed: ${message}`);
963
- return { success: false, exitCode: 1 };
964
- }
965
- },
966
- };
967
- /**
968
- * Imports analysis subcommand
969
- */
970
- const importsCommand = {
971
- name: 'imports',
972
- aliases: ['imp'],
973
- description: 'Analyze import dependencies across files',
974
- options: [
975
- {
976
- name: 'format',
977
- short: 'f',
978
- description: 'Output format (text, json)',
979
- type: 'string',
980
- default: 'text',
981
- choices: ['text', 'json'],
982
- },
983
- {
984
- name: 'output',
985
- short: 'o',
986
- description: 'Output file path',
987
- type: 'string',
988
- },
989
- {
990
- name: 'external',
991
- short: 'e',
992
- description: 'Show only external (npm) imports',
993
- type: 'boolean',
994
- default: false,
995
- },
996
- ],
997
- examples: [
998
- { command: 'monomind analyze imports src/', description: 'Analyze all imports' },
999
- { command: 'monomind analyze imports src/ --external', description: 'Only npm packages' },
1000
- ],
1001
- action: async (ctx) => {
1002
- const targetPath = ctx.args[0] || ctx.cwd;
1003
- const formatType = ctx.flags.format || 'text';
1004
- const outputFile = ctx.flags.output;
1005
- const externalOnly = ctx.flags.external;
1006
- output.printInfo(`Analyzing imports: ${output.highlight(targetPath)}`);
1007
- output.writeln();
1008
- const spinner = output.createSpinner({ text: 'Scanning imports...', spinner: 'dots' });
1009
- spinner.start();
1010
- try {
1011
- const astModule = await getASTAnalyzer();
1012
- const resolvedPath = resolve(targetPath);
1013
- const stat = await fs.stat(resolvedPath);
1014
- const files = stat.isDirectory() ? await scanSourceFiles(resolvedPath) : [resolvedPath];
1015
- const importCounts = new Map();
1016
- const fileImports = new Map();
1017
- for (const file of files.slice(0, 100)) {
1018
- try {
1019
- const content = await fs.readFile(file, 'utf-8');
1020
- let analysis;
1021
- if (astModule) {
1022
- const analyzer = astModule.createASTAnalyzer();
1023
- analysis = analyzer.analyze(content, file);
1024
- }
1025
- else {
1026
- analysis = fallbackAnalyze(content, file);
1027
- }
1028
- const imports = analysis.imports.filter(imp => {
1029
- if (externalOnly) {
1030
- return !imp.startsWith('.') && !imp.startsWith('/');
1031
- }
1032
- return true;
1033
- });
1034
- fileImports.set(file, imports);
1035
- for (const imp of imports) {
1036
- const existing = importCounts.get(imp) || { count: 0, files: [] };
1037
- existing.count++;
1038
- existing.files.push(file);
1039
- importCounts.set(imp, existing);
1040
- }
1041
- }
1042
- catch {
1043
- // Skip files that can't be parsed
1044
- }
1045
- }
1046
- spinner.stop();
1047
- // Sort by count
1048
- const sortedImports = Array.from(importCounts.entries())
1049
- .sort((a, b) => b[1].count - a[1].count);
1050
- if (formatType === 'json') {
1051
- const jsonOutput = {
1052
- imports: Object.fromEntries(sortedImports),
1053
- fileImports: Object.fromEntries(fileImports),
1054
- };
1055
- if (outputFile) {
1056
- await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
1057
- output.printSuccess(`Results written to ${outputFile}`);
1058
- }
1059
- else {
1060
- output.printJson(jsonOutput);
1061
- }
1062
- return { success: true, data: jsonOutput };
1063
- }
1064
- // Summary
1065
- const externalImports = sortedImports.filter(([imp]) => !imp.startsWith('.') && !imp.startsWith('/'));
1066
- const localImports = sortedImports.filter(([imp]) => imp.startsWith('.') || imp.startsWith('/'));
1067
- output.printBox([
1068
- `Total unique imports: ${sortedImports.length}`,
1069
- `External (npm): ${externalImports.length}`,
1070
- `Local (relative): ${localImports.length}`,
1071
- `Files scanned: ${files.length}`,
1072
- ].join('\n'), 'Import Analysis');
1073
- // Most used imports
1074
- output.writeln();
1075
- output.writeln(output.bold('Most Used Imports'));
1076
- output.writeln(output.dim('-'.repeat(60)));
1077
- const topImports = sortedImports.slice(0, 20);
1078
- output.printTable({
1079
- columns: [
1080
- { key: 'count', header: 'Uses', width: 8, align: 'right' },
1081
- { key: 'import', header: 'Import', width: 50 },
1082
- { key: 'type', header: 'Type', width: 10 },
1083
- ],
1084
- data: topImports.map(([imp, data]) => ({
1085
- count: data.count,
1086
- import: imp,
1087
- type: imp.startsWith('.') || imp.startsWith('/') ? output.dim('local') : output.highlight('npm'),
1088
- })),
1089
- });
1090
- if (sortedImports.length > 20) {
1091
- output.writeln(output.dim(` ... and ${sortedImports.length - 20} more imports`));
1092
- }
1093
- if (outputFile) {
1094
- await writeFile(outputFile, JSON.stringify({
1095
- imports: Object.fromEntries(sortedImports),
1096
- fileImports: Object.fromEntries(fileImports),
1097
- }, null, 2));
1098
- output.printSuccess(`Results written to ${outputFile}`);
1099
- }
1100
- return { success: true, data: { imports: sortedImports } };
1101
- }
1102
- catch (error) {
1103
- spinner.stop();
1104
- const message = error instanceof Error ? error.message : String(error);
1105
- output.printError(`Import analysis failed: ${message}`);
1106
- return { success: false, exitCode: 1 };
1107
- }
1108
- },
1109
- };
1110
- /**
1111
- * Helper: Scan directory for source files
1112
- */
1113
- async function scanSourceFiles(dir, maxDepth = 10) {
1114
- const files = [];
1115
- const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'];
1116
- const excludeDirs = ['node_modules', 'dist', 'build', '.git', 'coverage', '__pycache__'];
1117
- async function scan(currentDir, depth) {
1118
- if (depth > maxDepth)
1119
- return;
1120
- try {
1121
- const entries = await fs.readdir(currentDir, { withFileTypes: true });
1122
- for (const entry of entries) {
1123
- const fullPath = path.join(currentDir, entry.name);
1124
- if (entry.isDirectory()) {
1125
- if (!excludeDirs.includes(entry.name)) {
1126
- await scan(fullPath, depth + 1);
1127
- }
1128
- }
1129
- else if (entry.isFile()) {
1130
- const ext = path.extname(entry.name);
1131
- if (extensions.includes(ext)) {
1132
- files.push(fullPath);
1133
- }
1134
- }
1135
- }
1136
- }
1137
- catch {
1138
- // Skip directories we can't read
1139
- }
1140
- }
1141
- await scan(dir, 0);
1142
- return files;
1143
- }
1144
- /**
1145
- * Fallback analysis when ruvector is not available
1146
- */
1147
- function fallbackAnalyze(code, filePath) {
1148
- const lines = code.split('\n');
1149
- const functions = [];
1150
- const classes = [];
1151
- const imports = [];
1152
- const exports = [];
1153
- // Extract functions
1154
- const funcPattern = /(?:export\s+)?(?:async\s+)?function\s+(\w+)|(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\([^)]*\)\s*=>|^\s*(?:async\s+)?(\w+)\s*\([^)]*\)\s*(?::\s*\w+)?\s*\{/gm;
1155
- let match;
1156
- while ((match = funcPattern.exec(code)) !== null) {
1157
- const name = match[1] || match[2] || match[3];
1158
- if (name && !['if', 'while', 'for', 'switch'].includes(name)) {
1159
- const lineNum = code.substring(0, match.index).split('\n').length;
1160
- functions.push({ name, startLine: lineNum, endLine: lineNum + 10 });
1161
- }
1162
- }
1163
- // Extract classes
1164
- const classPattern = /(?:export\s+)?class\s+(\w+)/gm;
1165
- while ((match = classPattern.exec(code)) !== null) {
1166
- const lineNum = code.substring(0, match.index).split('\n').length;
1167
- classes.push({ name: match[1], startLine: lineNum, endLine: lineNum + 20 });
1168
- }
1169
- // Extract imports
1170
- const importPattern = /import\s+(?:.*\s+from\s+)?['"]([^'"]+)['"]/gm;
1171
- while ((match = importPattern.exec(code)) !== null) {
1172
- imports.push(match[1]);
1173
- }
1174
- const requirePattern = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/gm;
1175
- while ((match = requirePattern.exec(code)) !== null) {
1176
- imports.push(match[1]);
1177
- }
1178
- // Extract exports
1179
- const exportPattern = /export\s+(?:default\s+)?(?:const|let|var|function|class|interface|type|enum)\s+(\w+)/gm;
1180
- while ((match = exportPattern.exec(code)) !== null) {
1181
- exports.push(match[1]);
1182
- }
1183
- // Calculate complexity
1184
- const nonEmptyLines = lines.filter(l => l.trim().length > 0).length;
1185
- const commentLines = lines.filter(l => /^\s*(\/\/|\/\*|\*|#)/.test(l)).length;
1186
- const decisionPoints = (code.match(/\b(if|else|for|while|switch|case|catch|&&|\|\||\?)\b/g) || []).length;
1187
- let cognitive = 0;
1188
- let nestingLevel = 0;
1189
- for (const line of lines) {
1190
- const opens = (line.match(/\{/g) || []).length;
1191
- const closes = (line.match(/\}/g) || []).length;
1192
- if (/\b(if|for|while|switch)\b/.test(line)) {
1193
- cognitive += 1 + nestingLevel;
1194
- }
1195
- nestingLevel = Math.max(0, nestingLevel + opens - closes);
1196
- }
1197
- // Detect language
1198
- const ext = path.extname(filePath).toLowerCase();
1199
- const language = ext === '.ts' || ext === '.tsx' ? 'typescript' :
1200
- ext === '.js' || ext === '.jsx' || ext === '.mjs' || ext === '.cjs' ? 'javascript' :
1201
- ext === '.py' ? 'python' : 'unknown';
1202
- return {
1203
- filePath,
1204
- language,
1205
- functions,
1206
- classes,
1207
- imports,
1208
- exports,
1209
- complexity: {
1210
- cyclomatic: decisionPoints + 1,
1211
- cognitive,
1212
- loc: nonEmptyLines,
1213
- commentDensity: lines.length > 0 ? commentLines / lines.length : 0,
1214
- },
1215
- };
1216
- }
1217
- // Dependencies subcommand
1218
- const depsCommand = {
1219
- name: 'deps',
1220
- description: 'Analyze project dependencies',
1221
- options: [
1222
- { name: 'outdated', short: 'o', type: 'boolean', description: 'Show only outdated dependencies' },
1223
- { name: 'security', short: 's', type: 'boolean', description: 'Check for security vulnerabilities' },
1224
- { name: 'format', short: 'f', type: 'string', description: 'Output format: text, json', default: 'text' },
1225
- ],
1226
- examples: [
1227
- { command: 'monomind analyze deps --outdated', description: 'Show outdated dependencies' },
1228
- { command: 'monomind analyze deps --security', description: 'Check for vulnerabilities' },
1229
- ],
1230
- action: async (ctx) => {
1231
- const showOutdated = ctx.flags.outdated;
1232
- const checkSecurity = ctx.flags.security;
1233
- const formatJson = ctx.flags.format === 'json';
1234
- output.writeln();
1235
- output.writeln(output.bold('Dependency Analysis'));
1236
- output.writeln(output.dim('-'.repeat(50)));
1237
- try {
1238
- const pkgPath = resolve('package.json');
1239
- let pkgContent;
1240
- try {
1241
- pkgContent = await fs.readFile(pkgPath, 'utf-8');
1242
- }
1243
- catch {
1244
- output.printError('No package.json found in current directory');
1245
- return { success: false, exitCode: 1 };
1246
- }
1247
- const pkg = JSON.parse(pkgContent);
1248
- const deps = Object.entries(pkg.dependencies || {});
1249
- const devDeps = Object.entries(pkg.devDependencies || {});
1250
- const optDeps = Object.entries(pkg.optionalDependencies || {});
1251
- const peerDeps = Object.entries(pkg.peerDependencies || {});
1252
- const total = deps.length + devDeps.length + optDeps.length + peerDeps.length;
1253
- if (formatJson && !showOutdated && !checkSecurity) {
1254
- const jsonData = { name: pkg.name, version: pkg.version, dependencies: deps.length, devDependencies: devDeps.length, optionalDependencies: optDeps.length, peerDependencies: peerDeps.length, total };
1255
- output.printJson(jsonData);
1256
- return { success: true, data: jsonData };
1257
- }
1258
- output.printBox([`Package: ${pkg.name || 'unknown'} @ ${pkg.version || '0.0.0'}`, `Dependencies: ${deps.length}`, `Dev Dependencies: ${devDeps.length}`, `Optional: ${optDeps.length}`, `Peer: ${peerDeps.length}`, `Total: ${total}`].join('\n'), 'Dependency Summary');
1259
- if (showOutdated) {
1260
- output.writeln();
1261
- output.writeln(output.bold('Outdated Check'));
1262
- output.writeln(output.dim('-'.repeat(60)));
1263
- const outdated = [];
1264
- const checkDeps = async (entries, category) => {
1265
- for (const [name, declared] of entries) {
1266
- try {
1267
- const installedPkg = resolve('node_modules', name, 'package.json');
1268
- const raw = await fs.readFile(installedPkg, 'utf-8');
1269
- const installedContent = JSON.parse(raw);
1270
- const installed = installedContent.version || 'unknown';
1271
- const cleanDeclared = declared.replace(/^[\^~>=<]+/, '');
1272
- if (installed !== cleanDeclared) {
1273
- outdated.push({ name, declared: declared, installed, category });
1274
- }
1275
- }
1276
- catch {
1277
- outdated.push({ name, declared: declared, installed: 'not installed', category });
1278
- }
1279
- }
1280
- };
1281
- await checkDeps(deps, 'prod');
1282
- await checkDeps(devDeps, 'dev');
1283
- if (outdated.length === 0) {
1284
- output.printSuccess('All dependencies match declared versions');
1285
- }
1286
- else {
1287
- output.printTable({
1288
- columns: [
1289
- { key: 'name', header: 'Package', width: 30 },
1290
- { key: 'declared', header: 'Declared', width: 14 },
1291
- { key: 'installed', header: 'Installed', width: 14 },
1292
- { key: 'category', header: 'Type', width: 6 },
1293
- ],
1294
- data: outdated.slice(0, 30),
1295
- });
1296
- if (outdated.length > 30) {
1297
- output.writeln(output.dim(` ... and ${outdated.length - 30} more`));
1298
- }
1299
- }
1300
- }
1301
- if (checkSecurity) {
1302
- output.writeln();
1303
- output.writeln(output.bold('Security Audit'));
1304
- output.writeln(output.dim('-'.repeat(60)));
1305
- try {
1306
- const auditRaw = execSync('npm audit --json 2>/dev/null', { encoding: 'utf-8', maxBuffer: 10 * 1024 * 1024 });
1307
- const audit = JSON.parse(auditRaw);
1308
- const vulns = audit.metadata?.vulnerabilities || audit.vulnerabilities || {};
1309
- const info = vulns.info || 0;
1310
- const low = vulns.low || 0;
1311
- const moderate = vulns.moderate || 0;
1312
- const high = vulns.high || 0;
1313
- const critical = vulns.critical || 0;
1314
- const totalVulns = info + low + moderate + high + critical;
1315
- if (totalVulns === 0) {
1316
- output.printSuccess('No known vulnerabilities found');
1317
- }
1318
- else {
1319
- output.printTable({
1320
- columns: [
1321
- { key: 'severity', header: 'Severity', width: 12 },
1322
- { key: 'count', header: 'Count', width: 8, align: 'right' },
1323
- ],
1324
- data: [
1325
- ...(critical > 0 ? [{ severity: 'Critical', count: critical }] : []),
1326
- ...(high > 0 ? [{ severity: 'High', count: high }] : []),
1327
- ...(moderate > 0 ? [{ severity: 'Moderate', count: moderate }] : []),
1328
- ...(low > 0 ? [{ severity: 'Low', count: low }] : []),
1329
- ...(info > 0 ? [{ severity: 'Info', count: info }] : []),
1330
- { severity: 'Total', count: totalVulns },
1331
- ],
1332
- });
1333
- if (critical > 0 || high > 0) {
1334
- output.printWarning(`${critical + high} high/critical vulnerabilities found. Run 'npm audit' for details.`);
1335
- }
1336
- }
1337
- }
1338
- catch {
1339
- output.printWarning('npm audit failed. Ensure npm is available and node_modules is installed.');
1340
- }
1341
- }
1342
- return { success: true };
1343
- }
1344
- catch (error) {
1345
- const message = error instanceof Error ? error.message : String(error);
1346
- output.printError(`Dependency analysis failed: ${message}`);
1347
- return { success: false, exitCode: 1 };
1348
- }
1349
- },
1350
- };
1351
- // ============================================================================
1352
- // Graph Analysis Subcommands (MinCut, Louvain, Circular Dependencies)
1353
- // ============================================================================
1354
- /**
1355
- * Analyze code boundaries using MinCut algorithm
1356
- */
1357
- const boundariesCommand = {
1358
- name: 'boundaries',
1359
- aliases: ['boundary', 'mincut'],
1360
- description: 'Find natural code boundaries using MinCut algorithm',
1361
- options: [
1362
- {
1363
- name: 'partitions',
1364
- short: 'p',
1365
- description: 'Number of partitions to find',
1366
- type: 'number',
1367
- default: 2,
1368
- },
1369
- {
1370
- name: 'output',
1371
- short: 'o',
1372
- description: 'Output file path',
1373
- type: 'string',
1374
- },
1375
- {
1376
- name: 'format',
1377
- short: 'f',
1378
- description: 'Output format (text, json, dot)',
1379
- type: 'string',
1380
- default: 'text',
1381
- choices: ['text', 'json', 'dot'],
1382
- },
1383
- ],
1384
- examples: [
1385
- { command: 'monomind analyze boundaries src/', description: 'Find code boundaries in src/' },
1386
- { command: 'monomind analyze boundaries -p 3 src/', description: 'Find 3 partitions' },
1387
- { command: 'monomind analyze boundaries -f dot -o graph.dot src/', description: 'Export to DOT format' },
1388
- ],
1389
- action: async (ctx) => {
1390
- const targetDir = ctx.args[0] || ctx.cwd;
1391
- const numPartitions = ctx.flags.partitions || 2;
1392
- const outputFile = ctx.flags.output;
1393
- const format = ctx.flags.format || 'text';
1394
- output.printInfo(`Analyzing code boundaries in: ${output.highlight(targetDir)}`);
1395
- output.writeln();
1396
- const spinner = output.createSpinner({ text: 'Building dependency graph...', spinner: 'dots' });
1397
- spinner.start();
1398
- try {
1399
- const analyzer = await getGraphAnalyzer();
1400
- if (!analyzer) {
1401
- spinner.stop();
1402
- output.printError('Graph analyzer module not available');
1403
- return { success: false, exitCode: 1 };
1404
- }
1405
- const result = await analyzer.analyzeGraph(resolve(targetDir), {
1406
- includeBoundaries: true,
1407
- includeModules: false,
1408
- numPartitions,
1409
- });
1410
- spinner.stop();
1411
- // Handle different output formats
1412
- if (format === 'json') {
1413
- const jsonOutput = {
1414
- boundaries: result.boundaries,
1415
- statistics: result.statistics,
1416
- circularDependencies: result.circularDependencies,
1417
- };
1418
- if (outputFile) {
1419
- await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
1420
- output.printSuccess(`Results written to ${outputFile}`);
1421
- }
1422
- else {
1423
- output.printJson(jsonOutput);
1424
- }
1425
- return { success: true, data: jsonOutput };
1426
- }
1427
- if (format === 'dot') {
1428
- const dotOutput = analyzer.exportToDot(result, {
1429
- includeLabels: true,
1430
- highlightCycles: true,
1431
- });
1432
- if (outputFile) {
1433
- await writeFile(outputFile, dotOutput);
1434
- output.printSuccess(`DOT graph written to ${outputFile}`);
1435
- output.writeln(output.dim('Visualize with: dot -Tpng -o graph.png ' + outputFile));
1436
- }
1437
- else {
1438
- output.writeln(dotOutput);
1439
- }
1440
- return { success: true };
1441
- }
1442
- // Text format (default)
1443
- output.printBox([
1444
- `Files analyzed: ${result.statistics.nodeCount}`,
1445
- `Dependencies: ${result.statistics.edgeCount}`,
1446
- `Avg degree: ${result.statistics.avgDegree.toFixed(2)}`,
1447
- `Density: ${(result.statistics.density * 100).toFixed(2)}%`,
1448
- `Components: ${result.statistics.componentCount}`,
1449
- ].join('\n'), 'Graph Statistics');
1450
- if (result.boundaries && result.boundaries.length > 0) {
1451
- output.writeln();
1452
- output.writeln(output.bold('MinCut Boundaries'));
1453
- output.writeln();
1454
- for (let i = 0; i < result.boundaries.length; i++) {
1455
- const boundary = result.boundaries[i];
1456
- output.writeln(output.bold(`Boundary ${i + 1} (cut value: ${boundary.cutValue})`));
1457
- output.writeln();
1458
- output.writeln(output.dim('Partition 1:'));
1459
- const p1Display = boundary.partition1.slice(0, 10);
1460
- output.printList(p1Display);
1461
- if (boundary.partition1.length > 10) {
1462
- output.writeln(output.dim(` ... and ${boundary.partition1.length - 10} more files`));
1463
- }
1464
- output.writeln();
1465
- output.writeln(output.dim('Partition 2:'));
1466
- const p2Display = boundary.partition2.slice(0, 10);
1467
- output.printList(p2Display);
1468
- if (boundary.partition2.length > 10) {
1469
- output.writeln(output.dim(` ... and ${boundary.partition2.length - 10} more files`));
1470
- }
1471
- output.writeln();
1472
- output.writeln(output.success('Suggestion:'));
1473
- output.writeln(` ${boundary.suggestion}`);
1474
- output.writeln();
1475
- }
1476
- }
1477
- // Show circular dependencies
1478
- if (result.circularDependencies.length > 0) {
1479
- output.writeln();
1480
- output.writeln(output.bold(output.warning('Circular Dependencies Detected')));
1481
- output.writeln();
1482
- for (const cycle of result.circularDependencies.slice(0, 5)) {
1483
- const severityColor = cycle.severity === 'high' ? output.error : cycle.severity === 'medium' ? output.warning : output.dim;
1484
- output.writeln(`${severityColor(`[${cycle.severity.toUpperCase()}]`)} ${cycle.cycle.join(' -> ')}`);
1485
- output.writeln(output.dim(` ${cycle.suggestion}`));
1486
- output.writeln();
1487
- }
1488
- if (result.circularDependencies.length > 5) {
1489
- output.writeln(output.dim(`... and ${result.circularDependencies.length - 5} more cycles`));
1490
- }
1491
- }
1492
- if (outputFile) {
1493
- await writeFile(outputFile, JSON.stringify(result, null, 2));
1494
- output.printSuccess(`Full results written to ${outputFile}`);
1495
- }
1496
- return { success: true, data: result };
1497
- }
1498
- catch (error) {
1499
- spinner.stop();
1500
- const message = error instanceof Error ? error.message : String(error);
1501
- output.printError(`Analysis failed: ${message}`);
1502
- return { success: false, exitCode: 1 };
1503
- }
1504
- },
1505
- };
1506
- /**
1507
- * Analyze modules/communities using Louvain algorithm
1508
- */
1509
- const modulesCommand = {
1510
- name: 'modules',
1511
- aliases: ['communities', 'louvain'],
1512
- description: 'Detect module communities using Louvain algorithm',
1513
- options: [
1514
- {
1515
- name: 'output',
1516
- short: 'o',
1517
- description: 'Output file path',
1518
- type: 'string',
1519
- },
1520
- {
1521
- name: 'format',
1522
- short: 'f',
1523
- description: 'Output format (text, json, dot)',
1524
- type: 'string',
1525
- default: 'text',
1526
- choices: ['text', 'json', 'dot'],
1527
- },
1528
- {
1529
- name: 'min-size',
1530
- short: 'm',
1531
- description: 'Minimum community size to display',
1532
- type: 'number',
1533
- default: 2,
1534
- },
1535
- ],
1536
- examples: [
1537
- { command: 'monomind analyze modules src/', description: 'Detect module communities' },
1538
- { command: 'monomind analyze modules -f dot -o modules.dot src/', description: 'Export colored DOT graph' },
1539
- { command: 'monomind analyze modules -m 3 src/', description: 'Only show communities with 3+ files' },
1540
- ],
1541
- action: async (ctx) => {
1542
- const targetDir = ctx.args[0] || ctx.cwd;
1543
- const outputFile = ctx.flags.output;
1544
- const format = ctx.flags.format || 'text';
1545
- const minSize = ctx.flags['min-size'] || 2;
1546
- output.printInfo(`Detecting module communities in: ${output.highlight(targetDir)}`);
1547
- output.writeln();
1548
- const spinner = output.createSpinner({ text: 'Building dependency graph...', spinner: 'dots' });
1549
- spinner.start();
1550
- try {
1551
- const analyzer = await getGraphAnalyzer();
1552
- if (!analyzer) {
1553
- spinner.stop();
1554
- output.printError('Graph analyzer module not available');
1555
- return { success: false, exitCode: 1 };
1556
- }
1557
- const result = await analyzer.analyzeGraph(resolve(targetDir), {
1558
- includeBoundaries: false,
1559
- includeModules: true,
1560
- });
1561
- spinner.stop();
1562
- // Filter communities by size
1563
- const communities = result.communities?.filter(c => c.members.length >= minSize) || [];
1564
- // Handle different output formats
1565
- if (format === 'json') {
1566
- const jsonOutput = {
1567
- communities,
1568
- statistics: result.statistics,
1569
- };
1570
- if (outputFile) {
1571
- await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
1572
- output.printSuccess(`Results written to ${outputFile}`);
1573
- }
1574
- else {
1575
- output.printJson(jsonOutput);
1576
- }
1577
- return { success: true, data: jsonOutput };
1578
- }
1579
- if (format === 'dot') {
1580
- const dotOutput = analyzer.exportToDot(result, {
1581
- includeLabels: true,
1582
- colorByCommunity: true,
1583
- highlightCycles: true,
1584
- });
1585
- if (outputFile) {
1586
- await writeFile(outputFile, dotOutput);
1587
- output.printSuccess(`DOT graph written to ${outputFile}`);
1588
- output.writeln(output.dim('Visualize with: dot -Tpng -o modules.png ' + outputFile));
1589
- }
1590
- else {
1591
- output.writeln(dotOutput);
1592
- }
1593
- return { success: true };
1594
- }
1595
- // Text format (default)
1596
- output.printBox([
1597
- `Files analyzed: ${result.statistics.nodeCount}`,
1598
- `Dependencies: ${result.statistics.edgeCount}`,
1599
- `Communities found: ${result.communities?.length || 0}`,
1600
- `Showing: ${communities.length} (min size: ${minSize})`,
1601
- ].join('\n'), 'Module Detection Results');
1602
- if (communities.length > 0) {
1603
- output.writeln();
1604
- output.writeln(output.bold('Detected Communities'));
1605
- output.writeln();
1606
- for (const community of communities.slice(0, 10)) {
1607
- const cohesionIndicator = community.cohesion > 0.5 ? output.success('High') :
1608
- community.cohesion > 0.2 ? output.warning('Medium') : output.dim('Low');
1609
- output.writeln(output.bold(`Community ${community.id}: ${community.suggestedName || 'unnamed'}`));
1610
- output.writeln(` ${output.dim('Cohesion:')} ${cohesionIndicator} (${(community.cohesion * 100).toFixed(1)}%)`);
1611
- output.writeln(` ${output.dim('Central node:')} ${community.centralNode || 'none'}`);
1612
- output.writeln(` ${output.dim('Members:')} ${community.members.length} files`);
1613
- const displayMembers = community.members.slice(0, 5);
1614
- for (const member of displayMembers) {
1615
- output.writeln(` - ${member}`);
1616
- }
1617
- if (community.members.length > 5) {
1618
- output.writeln(output.dim(` ... and ${community.members.length - 5} more`));
1619
- }
1620
- output.writeln();
1621
- }
1622
- if (communities.length > 10) {
1623
- output.writeln(output.dim(`... and ${communities.length - 10} more communities`));
1624
- }
1625
- }
1626
- if (outputFile) {
1627
- await writeFile(outputFile, JSON.stringify(result, null, 2));
1628
- output.printSuccess(`Full results written to ${outputFile}`);
1629
- }
1630
- return { success: true, data: result };
1631
- }
1632
- catch (error) {
1633
- spinner.stop();
1634
- const message = error instanceof Error ? error.message : String(error);
1635
- output.printError(`Analysis failed: ${message}`);
1636
- return { success: false, exitCode: 1 };
1637
- }
1638
- },
1639
- };
1640
- /**
1641
- * Build and export dependency graph
1642
- */
1643
- const dependenciesCommand = {
1644
- name: 'dependencies',
1645
- aliases: ['graph'],
1646
- description: 'Build and export full dependency graph',
1647
- options: [
1648
- {
1649
- name: 'output',
1650
- short: 'o',
1651
- description: 'Output file path',
1652
- type: 'string',
1653
- },
1654
- {
1655
- name: 'format',
1656
- short: 'f',
1657
- description: 'Output format (text, json, dot)',
1658
- type: 'string',
1659
- default: 'text',
1660
- choices: ['text', 'json', 'dot'],
1661
- },
1662
- {
1663
- name: 'include',
1664
- short: 'i',
1665
- description: 'File extensions to include (comma-separated)',
1666
- type: 'string',
1667
- default: '.ts,.tsx,.js,.jsx,.mjs,.cjs',
1668
- },
1669
- {
1670
- name: 'exclude',
1671
- short: 'e',
1672
- description: 'Patterns to exclude (comma-separated)',
1673
- type: 'string',
1674
- default: 'node_modules,dist,build,.git',
1675
- },
1676
- {
1677
- name: 'depth',
1678
- short: 'd',
1679
- description: 'Maximum directory depth',
1680
- type: 'number',
1681
- default: 10,
1682
- },
1683
- ],
1684
- examples: [
1685
- { command: 'monomind analyze dependencies src/', description: 'Build dependency graph' },
1686
- { command: 'monomind analyze dependencies -f dot -o deps.dot src/', description: 'Export to DOT' },
1687
- { command: 'monomind analyze dependencies -i .ts,.tsx src/', description: 'Only TypeScript files' },
1688
- ],
1689
- action: async (ctx) => {
1690
- const targetDir = ctx.args[0] || ctx.cwd;
1691
- const outputFile = ctx.flags.output;
1692
- const format = ctx.flags.format || 'text';
1693
- const include = (ctx.flags.include || '.ts,.tsx,.js,.jsx,.mjs,.cjs').split(',');
1694
- const exclude = (ctx.flags.exclude || 'node_modules,dist,build,.git').split(',');
1695
- const maxDepth = ctx.flags.depth || 10;
1696
- output.printInfo(`Building dependency graph for: ${output.highlight(targetDir)}`);
1697
- output.writeln();
1698
- const spinner = output.createSpinner({ text: 'Scanning files...', spinner: 'dots' });
1699
- spinner.start();
1700
- try {
1701
- const analyzer = await getGraphAnalyzer();
1702
- if (!analyzer) {
1703
- spinner.stop();
1704
- output.printError('Graph analyzer module not available');
1705
- return { success: false, exitCode: 1 };
1706
- }
1707
- const graph = await analyzer.buildDependencyGraph(resolve(targetDir), {
1708
- include,
1709
- exclude,
1710
- maxDepth,
1711
- });
1712
- spinner.stop();
1713
- // Detect circular dependencies
1714
- const circularDeps = analyzer.detectCircularDependencies(graph);
1715
- // Handle different output formats
1716
- if (format === 'json') {
1717
- const jsonOutput = {
1718
- nodes: Array.from(graph.nodes.values()),
1719
- edges: graph.edges,
1720
- metadata: graph.metadata,
1721
- circularDependencies: circularDeps,
1722
- };
1723
- if (outputFile) {
1724
- await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
1725
- output.printSuccess(`Graph written to ${outputFile}`);
1726
- }
1727
- else {
1728
- output.printJson(jsonOutput);
1729
- }
1730
- return { success: true, data: jsonOutput };
1731
- }
1732
- if (format === 'dot') {
1733
- const result = { graph, circularDependencies: circularDeps, statistics: {
1734
- nodeCount: graph.nodes.size,
1735
- edgeCount: graph.edges.length,
1736
- avgDegree: 0,
1737
- maxDegree: 0,
1738
- density: 0,
1739
- componentCount: 0,
1740
- } };
1741
- const dotOutput = analyzer.exportToDot(result, {
1742
- includeLabels: true,
1743
- highlightCycles: true,
1744
- });
1745
- if (outputFile) {
1746
- await writeFile(outputFile, dotOutput);
1747
- output.printSuccess(`DOT graph written to ${outputFile}`);
1748
- output.writeln(output.dim('Visualize with: dot -Tpng -o deps.png ' + outputFile));
1749
- }
1750
- else {
1751
- output.writeln(dotOutput);
1752
- }
1753
- return { success: true };
1754
- }
1755
- // Text format (default)
1756
- output.printBox([
1757
- `Files: ${graph.metadata.totalFiles}`,
1758
- `Dependencies: ${graph.metadata.totalEdges}`,
1759
- `Build time: ${graph.metadata.buildTime}ms`,
1760
- `Root: ${graph.metadata.rootDir}`,
1761
- ].join('\n'), 'Dependency Graph');
1762
- // Show top files by imports
1763
- output.writeln();
1764
- output.writeln(output.bold('Most Connected Files'));
1765
- output.writeln();
1766
- const nodesByDegree = Array.from(graph.nodes.values())
1767
- .map(n => ({
1768
- ...n,
1769
- degree: graph.edges.filter(e => e.source === n.id || e.target === n.id).length,
1770
- }))
1771
- .sort((a, b) => b.degree - a.degree)
1772
- .slice(0, 10);
1773
- output.printTable({
1774
- columns: [
1775
- { key: 'path', header: 'File', width: 50 },
1776
- { key: 'degree', header: 'Connections', width: 12, align: 'right' },
1777
- { key: 'complexity', header: 'Complexity', width: 12, align: 'right' },
1778
- ],
1779
- data: nodesByDegree.map(n => ({
1780
- path: n.path.length > 48 ? '...' + n.path.slice(-45) : n.path,
1781
- degree: n.degree,
1782
- complexity: n.complexity || 0,
1783
- })),
1784
- });
1785
- // Show circular dependencies
1786
- if (circularDeps.length > 0) {
1787
- output.writeln();
1788
- output.writeln(output.bold(output.warning(`Circular Dependencies: ${circularDeps.length}`)));
1789
- output.writeln();
1790
- for (const cycle of circularDeps.slice(0, 3)) {
1791
- output.writeln(` ${cycle.cycle.join(' -> ')}`);
1792
- }
1793
- if (circularDeps.length > 3) {
1794
- output.writeln(output.dim(` ... and ${circularDeps.length - 3} more`));
1795
- }
1796
- }
1797
- if (outputFile) {
1798
- const fullOutput = {
1799
- nodes: Array.from(graph.nodes.values()),
1800
- edges: graph.edges,
1801
- metadata: graph.metadata,
1802
- circularDependencies: circularDeps,
1803
- };
1804
- await writeFile(outputFile, JSON.stringify(fullOutput, null, 2));
1805
- output.printSuccess(`Full results written to ${outputFile}`);
1806
- }
1807
- return { success: true };
1808
- }
1809
- catch (error) {
1810
- spinner.stop();
1811
- const message = error instanceof Error ? error.message : String(error);
1812
- output.printError(`Analysis failed: ${message}`);
1813
- return { success: false, exitCode: 1 };
1814
- }
1815
- },
1816
- };
1817
- /**
1818
- * Detect circular dependencies
1819
- */
1820
- const circularCommand = {
1821
- name: 'circular',
1822
- aliases: ['cycles'],
1823
- description: 'Detect circular dependencies in codebase',
1824
- options: [
1825
- {
1826
- name: 'output',
1827
- short: 'o',
1828
- description: 'Output file path',
1829
- type: 'string',
1830
- },
1831
- {
1832
- name: 'format',
1833
- short: 'f',
1834
- description: 'Output format (text, json)',
1835
- type: 'string',
1836
- default: 'text',
1837
- choices: ['text', 'json'],
1838
- },
1839
- {
1840
- name: 'severity',
1841
- short: 's',
1842
- description: 'Minimum severity to show (low, medium, high)',
1843
- type: 'string',
1844
- default: 'low',
1845
- choices: ['low', 'medium', 'high'],
1846
- },
1847
- ],
1848
- examples: [
1849
- { command: 'monomind analyze circular src/', description: 'Find circular dependencies' },
1850
- { command: 'monomind analyze circular -s high src/', description: 'Only high severity cycles' },
1851
- ],
1852
- action: async (ctx) => {
1853
- const targetDir = ctx.args[0] || ctx.cwd;
1854
- const outputFile = ctx.flags.output;
1855
- const format = ctx.flags.format || 'text';
1856
- const minSeverity = ctx.flags.severity || 'low';
1857
- output.printInfo(`Detecting circular dependencies in: ${output.highlight(targetDir)}`);
1858
- output.writeln();
1859
- const spinner = output.createSpinner({ text: 'Analyzing dependencies...', spinner: 'dots' });
1860
- spinner.start();
1861
- try {
1862
- const analyzer = await getGraphAnalyzer();
1863
- if (!analyzer) {
1864
- spinner.stop();
1865
- output.printError('Graph analyzer module not available');
1866
- return { success: false, exitCode: 1 };
1867
- }
1868
- const graph = await analyzer.buildDependencyGraph(resolve(targetDir));
1869
- const cycles = analyzer.detectCircularDependencies(graph);
1870
- spinner.stop();
1871
- // Filter by severity
1872
- const severityOrder = { low: 0, medium: 1, high: 2 };
1873
- const minLevel = severityOrder[minSeverity] || 0;
1874
- const filtered = cycles.filter(c => severityOrder[c.severity] >= minLevel);
1875
- if (format === 'json') {
1876
- const jsonOutput = { cycles: filtered, total: cycles.length, filtered: filtered.length };
1877
- if (outputFile) {
1878
- await writeFile(outputFile, JSON.stringify(jsonOutput, null, 2));
1879
- output.printSuccess(`Results written to ${outputFile}`);
1880
- }
1881
- else {
1882
- output.printJson(jsonOutput);
1883
- }
1884
- return { success: true, data: jsonOutput };
1885
- }
1886
- // Text format
1887
- if (filtered.length === 0) {
1888
- output.printSuccess('No circular dependencies found!');
1889
- return { success: true };
1890
- }
1891
- output.printBox([
1892
- `Total cycles: ${cycles.length}`,
1893
- `Shown (${minSeverity}+): ${filtered.length}`,
1894
- `High severity: ${cycles.filter(c => c.severity === 'high').length}`,
1895
- `Medium severity: ${cycles.filter(c => c.severity === 'medium').length}`,
1896
- `Low severity: ${cycles.filter(c => c.severity === 'low').length}`,
1897
- ].join('\n'), 'Circular Dependencies');
1898
- output.writeln();
1899
- // Group by severity
1900
- const grouped = {
1901
- high: filtered.filter(c => c.severity === 'high'),
1902
- medium: filtered.filter(c => c.severity === 'medium'),
1903
- low: filtered.filter(c => c.severity === 'low'),
1904
- };
1905
- for (const [severity, items] of Object.entries(grouped)) {
1906
- if (items.length === 0)
1907
- continue;
1908
- const color = severity === 'high' ? output.error : severity === 'medium' ? output.warning : output.dim;
1909
- output.writeln(color(output.bold(`${severity.toUpperCase()} SEVERITY (${items.length})`)));
1910
- output.writeln();
1911
- for (const cycle of items.slice(0, 5)) {
1912
- output.writeln(` ${cycle.cycle.join(' -> ')}`);
1913
- output.writeln(output.dim(` Fix: ${cycle.suggestion}`));
1914
- output.writeln();
1915
- }
1916
- if (items.length > 5) {
1917
- output.writeln(output.dim(` ... and ${items.length - 5} more ${severity} cycles`));
1918
- output.writeln();
1919
- }
1920
- }
1921
- if (outputFile) {
1922
- await writeFile(outputFile, JSON.stringify({ cycles: filtered }, null, 2));
1923
- output.printSuccess(`Results written to ${outputFile}`);
1924
- }
1925
- return { success: true, data: { cycles: filtered } };
1926
- }
1927
- catch (error) {
1928
- spinner.stop();
1929
- const message = error instanceof Error ? error.message : String(error);
1930
- output.printError(`Analysis failed: ${message}`);
1931
- return { success: false, exitCode: 1 };
1932
- }
1933
- },
1934
- };
1935
- // Helper functions
1936
- function getRiskDisplay(risk) {
1937
- switch (risk) {
1938
- case 'critical':
1939
- return output.color(output.bold('CRITICAL'), 'bgRed', 'white');
1940
- case 'high-risk':
1941
- return output.error('HIGH');
1942
- case 'medium-risk':
1943
- return output.warning('MEDIUM');
1944
- case 'low-risk':
1945
- return output.success('LOW');
1946
- default:
1947
- return risk;
1948
- }
1949
- }
1950
- function getStatusDisplay(status) {
1951
- switch (status) {
1952
- case 'added':
1953
- return output.success('A');
1954
- case 'modified':
1955
- return output.warning('M');
1956
- case 'deleted':
1957
- return output.error('D');
1958
- case 'renamed':
1959
- return output.info('R');
1960
- default:
1961
- return status;
1962
- }
1963
- }
1964
- // Main analyze command
1965
- export const analyzeCommand = {
1966
- name: 'analyze',
1967
- description: 'Code analysis, diff classification, graph boundaries, and change risk assessment',
1968
- aliases: ['an'],
1969
- subcommands: [
1970
- diffCommand,
1971
- codeCommand,
1972
- depsCommand,
1973
- astCommand,
1974
- complexityAstCommand,
1975
- symbolsCommand,
1976
- importsCommand,
1977
- boundariesCommand,
1978
- modulesCommand,
1979
- dependenciesCommand,
1980
- circularCommand,
1981
- ],
1982
- options: [
1983
- {
1984
- name: 'format',
1985
- short: 'f',
1986
- description: 'Output format: text, json, table',
1987
- type: 'string',
1988
- default: 'text',
1989
- },
1990
- ],
1991
- examples: [
1992
- { command: 'monomind analyze ast src/', description: 'Analyze code with AST parsing' },
1993
- { command: 'monomind analyze complexity src/ --threshold 15', description: 'Find high-complexity files' },
1994
- { command: 'monomind analyze symbols src/ --type function', description: 'Extract all functions' },
1995
- { command: 'monomind analyze imports src/ --external', description: 'List npm dependencies' },
1996
- { command: 'monomind analyze diff --risk', description: 'Analyze diff with risk assessment' },
1997
- { command: 'monomind analyze boundaries src/', description: 'Find code boundaries using MinCut' },
1998
- { command: 'monomind analyze modules src/', description: 'Detect module communities with Louvain' },
1999
- { command: 'monomind analyze dependencies src/ --format dot', description: 'Export dependency graph as DOT' },
2000
- { command: 'monomind analyze circular src/', description: 'Find circular dependencies' },
2001
- { command: 'monomind analyze deps --security', description: 'Check dependency vulnerabilities' },
2002
- ],
2003
- action: async (ctx) => {
2004
- // If no subcommand, show help
2005
- output.writeln();
2006
- output.writeln(output.bold('Analyze Commands'));
2007
- output.writeln(output.dim('-'.repeat(50)));
2008
- output.writeln();
2009
- output.writeln(output.bold('Available subcommands:'));
2010
- output.writeln();
2011
- output.writeln(` ${output.highlight('diff')} Analyze git diff for change risk and classification`);
2012
- output.writeln(` ${output.highlight('code')} Static code analysis and quality assessment`);
2013
- output.writeln(` ${output.highlight('deps')} Analyze project dependencies`);
2014
- output.writeln(` ${output.highlight('ast')} AST analysis with symbol extraction and complexity`);
2015
- output.writeln(` ${output.highlight('complexity')} Analyze cyclomatic and cognitive complexity`);
2016
- output.writeln(` ${output.highlight('symbols')} Extract functions, classes, and types`);
2017
- output.writeln(` ${output.highlight('imports')} Analyze import dependencies`);
2018
- output.writeln(` ${output.highlight('boundaries')} Find code boundaries using MinCut algorithm`);
2019
- output.writeln(` ${output.highlight('modules')} Detect module communities using Louvain algorithm`);
2020
- output.writeln(` ${output.highlight('dependencies')} Build and export full dependency graph`);
2021
- output.writeln(` ${output.highlight('circular')} Detect circular dependencies in codebase`);
2022
- output.writeln();
2023
- output.writeln(output.bold('AST Analysis Examples:'));
2024
- output.writeln();
2025
- output.writeln(` ${output.dim('monomind analyze ast src/')} # Full AST analysis`);
2026
- output.writeln(` ${output.dim('monomind analyze ast src/index.ts -c')} # Include complexity`);
2027
- output.writeln(` ${output.dim('monomind analyze complexity src/ -t 15')} # Flag high complexity`);
2028
- output.writeln(` ${output.dim('monomind analyze symbols src/ --type fn')} # Extract functions`);
2029
- output.writeln(` ${output.dim('monomind analyze imports src/ --external')} # Only npm imports`);
2030
- output.writeln();
2031
- output.writeln(output.bold('Graph Analysis Examples:'));
2032
- output.writeln();
2033
- output.writeln(` ${output.dim('monomind analyze boundaries src/')} # Find natural code boundaries`);
2034
- output.writeln(` ${output.dim('monomind analyze modules src/')} # Detect module communities`);
2035
- output.writeln(` ${output.dim('monomind analyze dependencies -f dot src/')} # Export to DOT format`);
2036
- output.writeln(` ${output.dim('monomind analyze circular src/')} # Find circular deps`);
2037
- output.writeln();
2038
- output.writeln(output.bold('Diff Analysis Examples:'));
2039
- output.writeln();
2040
- output.writeln(` ${output.dim('monomind analyze diff --risk')} # Risk assessment`);
2041
- output.writeln(` ${output.dim('monomind analyze diff HEAD~1 --classify')} # Classify changes`);
2042
- output.writeln(` ${output.dim('monomind analyze diff main..feature')} # Compare branches`);
2043
- output.writeln();
2044
- return { success: true };
2045
- },
2046
- };
2047
- export default analyzeCommand;
2048
- //# sourceMappingURL=analyze.js.map