@evolith/smart-cli 0.0.3-beta → 1.0.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 (531) hide show
  1. package/ARCHITECTURE.md +1 -1
  2. package/LICENSE +21 -0
  3. package/README.es.md +1024 -171
  4. package/README.md +1018 -166
  5. package/dist/.tsbuildinfo +1 -0
  6. package/dist/CoreApiClient.d.ts +5 -0
  7. package/dist/CoreApiClient.js +25 -0
  8. package/dist/CoreApiClient.js.map +1 -0
  9. package/dist/app.module.js +97 -10
  10. package/dist/app.module.js.map +1 -1
  11. package/dist/commands/adr/adr.command.d.ts +9 -3
  12. package/dist/commands/adr/adr.command.js +82 -88
  13. package/dist/commands/adr/adr.command.js.map +1 -1
  14. package/dist/commands/agents/agents.command.d.ts +27 -0
  15. package/dist/commands/agents/agents.command.js +373 -0
  16. package/dist/commands/agents/agents.command.js.map +1 -0
  17. package/dist/commands/agents/index.d.ts +1 -0
  18. package/dist/commands/agents/index.js +6 -0
  19. package/dist/commands/agents/index.js.map +1 -0
  20. package/dist/commands/alias/alias.command.d.ts +16 -0
  21. package/dist/commands/alias/alias.command.js +95 -0
  22. package/dist/commands/alias/alias.command.js.map +1 -0
  23. package/dist/commands/api/api.catalog.d.ts +38 -0
  24. package/dist/commands/api/api.catalog.js +167 -0
  25. package/dist/commands/api/api.catalog.js.map +1 -0
  26. package/dist/commands/api/api.command.d.ts +21 -0
  27. package/dist/commands/api/api.command.js +162 -0
  28. package/dist/commands/api/api.command.js.map +1 -0
  29. package/dist/commands/architecture/scaffold/index.d.ts +2 -0
  30. package/dist/commands/architecture/scaffold/index.js +6 -0
  31. package/dist/commands/architecture/scaffold/index.js.map +1 -0
  32. package/dist/commands/architecture/scaffold/scaffold-strategy.d.ts +15 -0
  33. package/dist/commands/architecture/scaffold/scaffold-strategy.js +20 -0
  34. package/dist/commands/architecture/scaffold/scaffold-strategy.js.map +1 -0
  35. package/dist/commands/architecture/scaffold.command.d.ts +12 -3
  36. package/dist/commands/architecture/scaffold.command.js +222 -56
  37. package/dist/commands/architecture/scaffold.command.js.map +1 -1
  38. package/dist/commands/chat/chat.command.d.ts +7 -0
  39. package/dist/commands/chat/chat.command.js +64 -0
  40. package/dist/commands/chat/chat.command.js.map +1 -0
  41. package/dist/commands/completion/completion.command.d.ts +12 -4
  42. package/dist/commands/completion/completion.command.js +159 -53
  43. package/dist/commands/completion/completion.command.js.map +1 -1
  44. package/dist/commands/docs/docs.command.d.ts +6 -3
  45. package/dist/commands/docs/docs.command.js +75 -16
  46. package/dist/commands/docs/docs.command.js.map +1 -1
  47. package/dist/commands/drift/drift.command.d.ts +7 -3
  48. package/dist/commands/drift/drift.command.js +94 -52
  49. package/dist/commands/drift/drift.command.js.map +1 -1
  50. package/dist/commands/evaluate/evaluate.command.d.ts +28 -0
  51. package/dist/commands/evaluate/evaluate.command.js +197 -0
  52. package/dist/commands/evaluate/evaluate.command.js.map +1 -0
  53. package/dist/commands/fixtures/fixtures.command.d.ts +21 -0
  54. package/dist/commands/fixtures/fixtures.command.js +310 -0
  55. package/dist/commands/fixtures/fixtures.command.js.map +1 -0
  56. package/dist/commands/gate/gate.command.d.ts +29 -0
  57. package/dist/commands/gate/gate.command.js +193 -0
  58. package/dist/commands/gate/gate.command.js.map +1 -0
  59. package/dist/commands/history/history.command.d.ts +3 -3
  60. package/dist/commands/history/history.command.js +24 -55
  61. package/dist/commands/history/history.command.js.map +1 -1
  62. package/dist/commands/init/init.command.d.ts +9 -3
  63. package/dist/commands/init/init.command.js +39 -198
  64. package/dist/commands/init/init.command.js.map +1 -1
  65. package/dist/commands/init/init.wizard.d.ts +19 -0
  66. package/dist/commands/init/init.wizard.js +181 -0
  67. package/dist/commands/init/init.wizard.js.map +1 -0
  68. package/dist/commands/phase/phase-advance.command.d.ts +30 -0
  69. package/dist/commands/phase/phase-advance.command.js +206 -0
  70. package/dist/commands/phase/phase-advance.command.js.map +1 -0
  71. package/dist/commands/plan/index.d.ts +1 -0
  72. package/dist/commands/plan/index.js +133 -0
  73. package/dist/commands/plan/index.js.map +1 -0
  74. package/dist/commands/profile/profile.command.d.ts +18 -0
  75. package/dist/commands/profile/profile.command.js +198 -0
  76. package/dist/commands/profile/profile.command.js.map +1 -0
  77. package/dist/commands/satellite/index.d.ts +2 -0
  78. package/dist/commands/satellite/index.js +8 -0
  79. package/dist/commands/satellite/index.js.map +1 -0
  80. package/dist/commands/satellite/satellite-adopt.command.d.ts +21 -0
  81. package/dist/commands/satellite/satellite-adopt.command.js +193 -0
  82. package/dist/commands/satellite/satellite-adopt.command.js.map +1 -0
  83. package/dist/commands/satellite/satellite-create.command.d.ts +26 -0
  84. package/dist/commands/satellite/satellite-create.command.js +192 -0
  85. package/dist/commands/satellite/satellite-create.command.js.map +1 -0
  86. package/dist/commands/sdlc/gate-status.command.d.ts +8 -3
  87. package/dist/commands/sdlc/gate-status.command.js +114 -66
  88. package/dist/commands/sdlc/gate-status.command.js.map +1 -1
  89. package/dist/commands/sdlc/generate-domain.command.d.ts +6 -3
  90. package/dist/commands/sdlc/generate-domain.command.js +126 -16
  91. package/dist/commands/sdlc/generate-domain.command.js.map +1 -1
  92. package/dist/commands/sdlc/handoff.command.d.ts +9 -4
  93. package/dist/commands/sdlc/handoff.command.js +106 -104
  94. package/dist/commands/sdlc/handoff.command.js.map +1 -1
  95. package/dist/commands/sdlc/sdlc.command.d.ts +4 -3
  96. package/dist/commands/sdlc/sdlc.command.js +17 -9
  97. package/dist/commands/sdlc/sdlc.command.js.map +1 -1
  98. package/dist/commands/standards/standards.command.d.ts +6 -3
  99. package/dist/commands/standards/standards.command.js +52 -77
  100. package/dist/commands/standards/standards.command.js.map +1 -1
  101. package/dist/commands/topology/phase-artifacts.command.d.ts +23 -0
  102. package/dist/commands/topology/phase-artifacts.command.js +167 -0
  103. package/dist/commands/topology/phase-artifacts.command.js.map +1 -0
  104. package/dist/commands/topology/recommend.command.d.ts +36 -0
  105. package/dist/commands/topology/recommend.command.js +236 -0
  106. package/dist/commands/topology/recommend.command.js.map +1 -0
  107. package/dist/commands/topology/topology.command.d.ts +5 -0
  108. package/dist/commands/topology/topology.command.js +41 -0
  109. package/dist/commands/topology/topology.command.js.map +1 -0
  110. package/dist/commands/update/update.command.d.ts +21 -0
  111. package/dist/commands/update/update.command.js +214 -0
  112. package/dist/commands/update/update.command.js.map +1 -0
  113. package/dist/commands/upgrade/upgrade.command.d.ts +22 -0
  114. package/dist/commands/{init → upgrade}/upgrade.command.js +34 -66
  115. package/dist/commands/upgrade/upgrade.command.js.map +1 -0
  116. package/dist/commands/validate/validate.command.d.ts +24 -6
  117. package/dist/commands/validate/validate.command.js +301 -63
  118. package/dist/commands/validate/validate.command.js.map +1 -1
  119. package/dist/config/alias.service.d.ts +14 -0
  120. package/dist/{core/sync/sync.service.js → config/alias.service.js} +54 -32
  121. package/dist/config/alias.service.js.map +1 -0
  122. package/dist/contributions/contribution-validator.d.ts +16 -0
  123. package/dist/contributions/contribution-validator.js +34 -0
  124. package/dist/contributions/contribution-validator.js.map +1 -0
  125. package/dist/contributions/index.d.ts +1 -0
  126. package/dist/contributions/index.js +6 -0
  127. package/dist/contributions/index.js.map +1 -0
  128. package/dist/{domain/services → infrastructure/adapters}/agent-registry.service.d.ts +6 -2
  129. package/dist/{domain/services → infrastructure/adapters}/agent-registry.service.js +33 -10
  130. package/dist/infrastructure/adapters/agent-registry.service.js.map +1 -0
  131. package/dist/infrastructure/agent/agent-runtime.factory.d.ts +9 -0
  132. package/dist/infrastructure/agent/agent-runtime.factory.js +47 -0
  133. package/dist/infrastructure/agent/agent-runtime.factory.js.map +1 -0
  134. package/dist/{core → infrastructure}/architecture/nx-workspace.strategy.d.ts +9 -1
  135. package/dist/infrastructure/architecture/nx-workspace.strategy.js +125 -0
  136. package/dist/infrastructure/architecture/nx-workspace.strategy.js.map +1 -0
  137. package/dist/infrastructure/architecture/topology-catalog.d.ts +15 -0
  138. package/dist/infrastructure/architecture/topology-catalog.js +50 -0
  139. package/dist/infrastructure/architecture/topology-catalog.js.map +1 -0
  140. package/dist/infrastructure/catalog/catalog-loader.d.ts +1 -2
  141. package/dist/infrastructure/catalog/catalog-loader.js +14 -5
  142. package/dist/infrastructure/catalog/catalog-loader.js.map +1 -1
  143. package/dist/infrastructure/cli/base-command.d.ts +14 -0
  144. package/dist/infrastructure/cli/base-command.js +41 -0
  145. package/dist/infrastructure/cli/base-command.js.map +1 -0
  146. package/dist/infrastructure/cli/command-executor.d.ts +2 -1
  147. package/dist/infrastructure/cli/command-executor.js +20 -3
  148. package/dist/infrastructure/cli/command-executor.js.map +1 -1
  149. package/dist/infrastructure/cli/providers/index.js +32 -29
  150. package/dist/infrastructure/cli/providers/index.js.map +1 -1
  151. package/dist/infrastructure/config/config.service.d.ts +34 -0
  152. package/dist/infrastructure/config/config.service.js +126 -0
  153. package/dist/infrastructure/config/config.service.js.map +1 -0
  154. package/dist/infrastructure/filesystem/file-manager.service.d.ts +12 -0
  155. package/dist/{core → infrastructure}/filesystem/file-manager.service.js +8 -25
  156. package/dist/infrastructure/filesystem/file-manager.service.js.map +1 -0
  157. package/dist/infrastructure/formatters/output-formatter.service.js +2 -1
  158. package/dist/infrastructure/formatters/output-formatter.service.js.map +1 -1
  159. package/dist/{core → infrastructure}/observability/command-watcher.js +31 -0
  160. package/dist/infrastructure/observability/command-watcher.js.map +1 -0
  161. package/dist/{core → infrastructure}/observability/error-reporter.js +5 -5
  162. package/dist/infrastructure/observability/error-reporter.js.map +1 -0
  163. package/dist/infrastructure/observability/index.d.ts +11 -0
  164. package/dist/{core → infrastructure}/observability/index.js +8 -1
  165. package/dist/infrastructure/observability/index.js.map +1 -0
  166. package/dist/infrastructure/observability/otel-tracing.d.ts +4 -0
  167. package/dist/infrastructure/observability/otel-tracing.js +34 -0
  168. package/dist/infrastructure/observability/otel-tracing.js.map +1 -0
  169. package/dist/infrastructure/observability/structured-logger.js.map +1 -0
  170. package/dist/infrastructure/observability/timing.js.map +1 -0
  171. package/dist/infrastructure/observability/tool-usage-telemetry.service.js.map +1 -0
  172. package/dist/infrastructure/plugins/plugin-loader.d.ts +10 -0
  173. package/dist/infrastructure/plugins/plugin-loader.js +145 -0
  174. package/dist/infrastructure/plugins/plugin-loader.js.map +1 -0
  175. package/dist/infrastructure/plugins/plugin.module.d.ts +4 -0
  176. package/dist/infrastructure/plugins/plugin.module.js +28 -0
  177. package/dist/infrastructure/plugins/plugin.module.js.map +1 -0
  178. package/dist/infrastructure/prompts/init-prompt-group.d.ts +3 -0
  179. package/dist/infrastructure/prompts/init-prompt-group.js +115 -0
  180. package/dist/infrastructure/prompts/init-prompt-group.js.map +1 -0
  181. package/dist/infrastructure/prompts/init-prompt-options.d.ts +10 -0
  182. package/dist/infrastructure/prompts/init-prompt-options.js +40 -0
  183. package/dist/infrastructure/prompts/init-prompt-options.js.map +1 -0
  184. package/dist/infrastructure/prompts/progress.service.d.ts +24 -0
  185. package/dist/infrastructure/prompts/progress.service.js +180 -0
  186. package/dist/infrastructure/prompts/progress.service.js.map +1 -0
  187. package/dist/infrastructure/prompts/prompt.service.d.ts +42 -0
  188. package/dist/infrastructure/prompts/prompt.service.js +142 -0
  189. package/dist/infrastructure/prompts/prompt.service.js.map +1 -0
  190. package/dist/infrastructure/prompts/wizard.service.d.ts +27 -0
  191. package/dist/infrastructure/prompts/wizard.service.js +163 -0
  192. package/dist/infrastructure/prompts/wizard.service.js.map +1 -0
  193. package/dist/{core/abstractions → infrastructure}/providers/config-parser.provider.d.ts +1 -1
  194. package/dist/infrastructure/providers/config-parser.provider.js.map +1 -0
  195. package/dist/{core/abstractions → infrastructure}/providers/logger.provider.d.ts +1 -1
  196. package/dist/infrastructure/providers/logger.provider.js.map +1 -0
  197. package/dist/{core/abstractions → infrastructure}/providers/mock-filesystem.provider.d.ts +6 -2
  198. package/dist/{core/abstractions → infrastructure}/providers/mock-filesystem.provider.js +8 -1
  199. package/dist/infrastructure/providers/mock-filesystem.provider.js.map +1 -0
  200. package/dist/{core/abstractions → infrastructure}/providers/node-filesystem.provider.d.ts +6 -2
  201. package/dist/{core/abstractions → infrastructure}/providers/node-filesystem.provider.js +13 -0
  202. package/dist/infrastructure/providers/node-filesystem.provider.js.map +1 -0
  203. package/dist/main.js +30 -2
  204. package/dist/main.js.map +1 -1
  205. package/dist/plugins/index.d.ts +1 -0
  206. package/dist/plugins/index.js +6 -0
  207. package/dist/plugins/index.js.map +1 -0
  208. package/dist/plugins/plugin-registry.d.ts +22 -0
  209. package/dist/plugins/plugin-registry.js +33 -0
  210. package/dist/plugins/plugin-registry.js.map +1 -0
  211. package/package.json +58 -27
  212. package/shell/hooks.bash +68 -0
  213. package/shell/hooks.fish +57 -0
  214. package/shell/hooks.zsh +68 -0
  215. package/dist/app.module.spec.d.ts +0 -1
  216. package/dist/app.module.spec.js +0 -305
  217. package/dist/app.module.spec.js.map +0 -1
  218. package/dist/application/services/index.d.ts +0 -63
  219. package/dist/application/services/index.js +0 -345
  220. package/dist/application/services/index.js.map +0 -1
  221. package/dist/application/services/phase-transition.use-case.spec.d.ts +0 -1
  222. package/dist/application/services/phase-transition.use-case.spec.js +0 -297
  223. package/dist/application/services/phase-transition.use-case.spec.js.map +0 -1
  224. package/dist/application/services/services.test.d.ts +0 -1
  225. package/dist/application/services/services.test.js +0 -176
  226. package/dist/application/services/services.test.js.map +0 -1
  227. package/dist/application/use-cases/validate-satellite.use-case.d.ts +0 -18
  228. package/dist/application/use-cases/validate-satellite.use-case.js +0 -92
  229. package/dist/application/use-cases/validate-satellite.use-case.js.map +0 -1
  230. package/dist/application/use-cases/validate-satellite.use-case.spec.d.ts +0 -1
  231. package/dist/application/use-cases/validate-satellite.use-case.spec.js +0 -102
  232. package/dist/application/use-cases/validate-satellite.use-case.spec.js.map +0 -1
  233. package/dist/commands/adr/adr.command.spec.d.ts +0 -1
  234. package/dist/commands/adr/adr.command.spec.js +0 -409
  235. package/dist/commands/adr/adr.command.spec.js.map +0 -1
  236. package/dist/commands/architecture/scaffold.command.spec.d.ts +0 -1
  237. package/dist/commands/architecture/scaffold.command.spec.js +0 -207
  238. package/dist/commands/architecture/scaffold.command.spec.js.map +0 -1
  239. package/dist/commands/commands.test.d.ts +0 -1
  240. package/dist/commands/commands.test.js +0 -131
  241. package/dist/commands/commands.test.js.map +0 -1
  242. package/dist/commands/completion/completion.command.spec.d.ts +0 -1
  243. package/dist/commands/completion/completion.command.spec.js +0 -240
  244. package/dist/commands/completion/completion.command.spec.js.map +0 -1
  245. package/dist/commands/docs/docs.command.spec.d.ts +0 -1
  246. package/dist/commands/docs/docs.command.spec.js +0 -87
  247. package/dist/commands/docs/docs.command.spec.js.map +0 -1
  248. package/dist/commands/drift/drift.command.spec.d.ts +0 -1
  249. package/dist/commands/drift/drift.command.spec.js +0 -327
  250. package/dist/commands/drift/drift.command.spec.js.map +0 -1
  251. package/dist/commands/history/history.command.spec.d.ts +0 -1
  252. package/dist/commands/history/history.command.spec.js +0 -392
  253. package/dist/commands/history/history.command.spec.js.map +0 -1
  254. package/dist/commands/init/agents.command.d.ts +0 -22
  255. package/dist/commands/init/agents.command.js +0 -502
  256. package/dist/commands/init/agents.command.js.map +0 -1
  257. package/dist/commands/init/agents.command.spec.d.ts +0 -1
  258. package/dist/commands/init/agents.command.spec.js +0 -550
  259. package/dist/commands/init/agents.command.spec.js.map +0 -1
  260. package/dist/commands/init/init.command.spec.d.ts +0 -1
  261. package/dist/commands/init/init.command.spec.js +0 -272
  262. package/dist/commands/init/init.command.spec.js.map +0 -1
  263. package/dist/commands/init/upgrade.command.d.ts +0 -19
  264. package/dist/commands/init/upgrade.command.js.map +0 -1
  265. package/dist/commands/init/upgrade.command.spec.d.ts +0 -1
  266. package/dist/commands/init/upgrade.command.spec.js +0 -378
  267. package/dist/commands/init/upgrade.command.spec.js.map +0 -1
  268. package/dist/commands/mcp/mcp-serve.command.d.ts +0 -15
  269. package/dist/commands/mcp/mcp-serve.command.js +0 -106
  270. package/dist/commands/mcp/mcp-serve.command.js.map +0 -1
  271. package/dist/commands/mcp/mcp-serve.command.spec.d.ts +0 -1
  272. package/dist/commands/mcp/mcp-serve.command.spec.js +0 -58
  273. package/dist/commands/mcp/mcp-serve.command.spec.js.map +0 -1
  274. package/dist/commands/sdlc/generate-domain.command.spec.d.ts +0 -1
  275. package/dist/commands/sdlc/generate-domain.command.spec.js +0 -47
  276. package/dist/commands/sdlc/generate-domain.command.spec.js.map +0 -1
  277. package/dist/commands/sdlc/handoff.command.spec.d.ts +0 -1
  278. package/dist/commands/sdlc/handoff.command.spec.js +0 -395
  279. package/dist/commands/sdlc/handoff.command.spec.js.map +0 -1
  280. package/dist/commands/sdlc/sdlc.command.spec.d.ts +0 -1
  281. package/dist/commands/sdlc/sdlc.command.spec.js +0 -45
  282. package/dist/commands/sdlc/sdlc.command.spec.js.map +0 -1
  283. package/dist/commands/standards/standards.command.spec.d.ts +0 -1
  284. package/dist/commands/standards/standards.command.spec.js +0 -311
  285. package/dist/commands/standards/standards.command.spec.js.map +0 -1
  286. package/dist/commands/validate/validate.command.spec.d.ts +0 -1
  287. package/dist/commands/validate/validate.command.spec.js +0 -368
  288. package/dist/commands/validate/validate.command.spec.js.map +0 -1
  289. package/dist/config/runtimes.json +0 -196
  290. package/dist/config/tool-catalog.json +0 -343
  291. package/dist/core/abstractions/index.d.ts +0 -6
  292. package/dist/core/abstractions/index.js +0 -23
  293. package/dist/core/abstractions/index.js.map +0 -1
  294. package/dist/core/abstractions/interfaces.d.ts +0 -60
  295. package/dist/core/abstractions/interfaces.js +0 -5
  296. package/dist/core/abstractions/interfaces.js.map +0 -1
  297. package/dist/core/abstractions/providers/config-parser.provider.js.map +0 -1
  298. package/dist/core/abstractions/providers/logger.provider.js.map +0 -1
  299. package/dist/core/abstractions/providers/logger.provider.spec.d.ts +0 -1
  300. package/dist/core/abstractions/providers/logger.provider.spec.js +0 -212
  301. package/dist/core/abstractions/providers/logger.provider.spec.js.map +0 -1
  302. package/dist/core/abstractions/providers/mock-filesystem.provider.js.map +0 -1
  303. package/dist/core/abstractions/providers/node-filesystem.provider.js.map +0 -1
  304. package/dist/core/agents/agent-ruleset-builder.d.ts +0 -30
  305. package/dist/core/agents/agent-ruleset-builder.js +0 -75
  306. package/dist/core/agents/agent-ruleset-builder.js.map +0 -1
  307. package/dist/core/agents/agent-ruleset-builder.spec.d.ts +0 -1
  308. package/dist/core/agents/agent-ruleset-builder.spec.js +0 -135
  309. package/dist/core/agents/agent-ruleset-builder.spec.js.map +0 -1
  310. package/dist/core/architecture/nx-workspace.strategy.js +0 -107
  311. package/dist/core/architecture/nx-workspace.strategy.js.map +0 -1
  312. package/dist/core/architecture/workspace-manager.strategy.d.ts +0 -7
  313. package/dist/core/architecture/workspace-manager.strategy.js +0 -3
  314. package/dist/core/architecture/workspace-manager.strategy.js.map +0 -1
  315. package/dist/core/config/config.service.d.ts +0 -15
  316. package/dist/core/config/config.service.js +0 -55
  317. package/dist/core/config/config.service.js.map +0 -1
  318. package/dist/core/config/config.service.spec.d.ts +0 -1
  319. package/dist/core/config/config.service.spec.js +0 -43
  320. package/dist/core/config/config.service.spec.js.map +0 -1
  321. package/dist/core/di/container.d.ts +0 -25
  322. package/dist/core/di/container.js +0 -87
  323. package/dist/core/di/container.js.map +0 -1
  324. package/dist/core/di/container.spec.d.ts +0 -1
  325. package/dist/core/di/container.spec.js +0 -301
  326. package/dist/core/di/container.spec.js.map +0 -1
  327. package/dist/core/errors/index.d.ts +0 -26
  328. package/dist/core/errors/index.js +0 -67
  329. package/dist/core/errors/index.js.map +0 -1
  330. package/dist/core/filesystem/file-manager.service.d.ts +0 -4
  331. package/dist/core/filesystem/file-manager.service.js.map +0 -1
  332. package/dist/core/filesystem/file-manager.service.spec.d.ts +0 -1
  333. package/dist/core/filesystem/file-manager.service.spec.js +0 -103
  334. package/dist/core/filesystem/file-manager.service.spec.js.map +0 -1
  335. package/dist/core/mcp/mcp-server.service.d.ts +0 -7
  336. package/dist/core/mcp/mcp-server.service.js +0 -31
  337. package/dist/core/mcp/mcp-server.service.js.map +0 -1
  338. package/dist/core/mcp/metrics.service.d.ts +0 -37
  339. package/dist/core/mcp/metrics.service.js +0 -72
  340. package/dist/core/mcp/metrics.service.js.map +0 -1
  341. package/dist/core/mcp/metrics.service.spec.d.ts +0 -1
  342. package/dist/core/mcp/metrics.service.spec.js +0 -159
  343. package/dist/core/mcp/metrics.service.spec.js.map +0 -1
  344. package/dist/core/mcp/prompts/index.d.ts +0 -22
  345. package/dist/core/mcp/prompts/index.js +0 -211
  346. package/dist/core/mcp/prompts/index.js.map +0 -1
  347. package/dist/core/mcp/prompts/index.spec.d.ts +0 -1
  348. package/dist/core/mcp/prompts/index.spec.js +0 -150
  349. package/dist/core/mcp/prompts/index.spec.js.map +0 -1
  350. package/dist/core/mcp/resources/index.d.ts +0 -11
  351. package/dist/core/mcp/resources/index.js +0 -209
  352. package/dist/core/mcp/resources/index.js.map +0 -1
  353. package/dist/core/mcp/resources/index.spec.d.ts +0 -1
  354. package/dist/core/mcp/resources/index.spec.js +0 -212
  355. package/dist/core/mcp/resources/index.spec.js.map +0 -1
  356. package/dist/core/mcp/server.d.ts +0 -31
  357. package/dist/core/mcp/server.js +0 -719
  358. package/dist/core/mcp/server.js.map +0 -1
  359. package/dist/core/mcp/server.spec.d.ts +0 -1
  360. package/dist/core/mcp/server.spec.js +0 -563
  361. package/dist/core/mcp/server.spec.js.map +0 -1
  362. package/dist/core/mcp/tools/agent.d.ts +0 -41
  363. package/dist/core/mcp/tools/agent.js +0 -195
  364. package/dist/core/mcp/tools/agent.js.map +0 -1
  365. package/dist/core/mcp/tools/agent.spec.d.ts +0 -1
  366. package/dist/core/mcp/tools/agent.spec.js +0 -171
  367. package/dist/core/mcp/tools/agent.spec.js.map +0 -1
  368. package/dist/core/mcp/tools/architecture.d.ts +0 -29
  369. package/dist/core/mcp/tools/architecture.js +0 -234
  370. package/dist/core/mcp/tools/architecture.js.map +0 -1
  371. package/dist/core/mcp/tools/architecture.spec.d.ts +0 -1
  372. package/dist/core/mcp/tools/architecture.spec.js +0 -145
  373. package/dist/core/mcp/tools/architecture.spec.js.map +0 -1
  374. package/dist/core/mcp/tools/moscow.d.ts +0 -30
  375. package/dist/core/mcp/tools/moscow.js +0 -113
  376. package/dist/core/mcp/tools/moscow.js.map +0 -1
  377. package/dist/core/mcp/tools/moscow.spec.d.ts +0 -1
  378. package/dist/core/mcp/tools/moscow.spec.js +0 -209
  379. package/dist/core/mcp/tools/moscow.spec.js.map +0 -1
  380. package/dist/core/mcp/tools/sdlc.d.ts +0 -32
  381. package/dist/core/mcp/tools/sdlc.js +0 -190
  382. package/dist/core/mcp/tools/sdlc.js.map +0 -1
  383. package/dist/core/mcp/tools/sdlc.spec.d.ts +0 -1
  384. package/dist/core/mcp/tools/sdlc.spec.js +0 -170
  385. package/dist/core/mcp/tools/sdlc.spec.js.map +0 -1
  386. package/dist/core/mcp/tools/tool-utils.d.ts +0 -4
  387. package/dist/core/mcp/tools/tool-utils.js +0 -18
  388. package/dist/core/mcp/tools/tool-utils.js.map +0 -1
  389. package/dist/core/mcp/tools/validate.d.ts +0 -18
  390. package/dist/core/mcp/tools/validate.js +0 -56
  391. package/dist/core/mcp/tools/validate.js.map +0 -1
  392. package/dist/core/mcp/tools/validate.spec.d.ts +0 -1
  393. package/dist/core/mcp/tools/validate.spec.js +0 -130
  394. package/dist/core/mcp/tools/validate.spec.js.map +0 -1
  395. package/dist/core/mcp/watcher.service.d.ts +0 -8
  396. package/dist/core/mcp/watcher.service.js +0 -82
  397. package/dist/core/mcp/watcher.service.js.map +0 -1
  398. package/dist/core/mcp/watcher.service.spec.d.ts +0 -1
  399. package/dist/core/mcp/watcher.service.spec.js +0 -171
  400. package/dist/core/mcp/watcher.service.spec.js.map +0 -1
  401. package/dist/core/observability/command-watcher.js.map +0 -1
  402. package/dist/core/observability/error-reporter.js.map +0 -1
  403. package/dist/core/observability/error-reporter.spec.d.ts +0 -1
  404. package/dist/core/observability/error-reporter.spec.js +0 -291
  405. package/dist/core/observability/error-reporter.spec.js.map +0 -1
  406. package/dist/core/observability/index.d.ts +0 -4
  407. package/dist/core/observability/index.js.map +0 -1
  408. package/dist/core/observability/observability.test.d.ts +0 -1
  409. package/dist/core/observability/observability.test.js +0 -224
  410. package/dist/core/observability/observability.test.js.map +0 -1
  411. package/dist/core/observability/structured-logger.js.map +0 -1
  412. package/dist/core/observability/structured-logger.spec.d.ts +0 -1
  413. package/dist/core/observability/structured-logger.spec.js +0 -197
  414. package/dist/core/observability/structured-logger.spec.js.map +0 -1
  415. package/dist/core/observability/timing.js.map +0 -1
  416. package/dist/core/observability/timing.spec.d.ts +0 -1
  417. package/dist/core/observability/timing.spec.js +0 -216
  418. package/dist/core/observability/timing.spec.js.map +0 -1
  419. package/dist/core/services/command-executor.service.d.ts +0 -3
  420. package/dist/core/services/command-executor.service.js +0 -12
  421. package/dist/core/services/command-executor.service.js.map +0 -1
  422. package/dist/core/services/command-history.service.d.ts +0 -38
  423. package/dist/core/services/command-history.service.js +0 -146
  424. package/dist/core/services/command-history.service.js.map +0 -1
  425. package/dist/core/services/command-history.service.spec.d.ts +0 -1
  426. package/dist/core/services/command-history.service.spec.js +0 -166
  427. package/dist/core/services/command-history.service.spec.js.map +0 -1
  428. package/dist/core/services/command-providers.d.ts +0 -1
  429. package/dist/core/services/command-providers.js +0 -17
  430. package/dist/core/services/command-providers.js.map +0 -1
  431. package/dist/core/services/runtime-catalog.service.d.ts +0 -2
  432. package/dist/core/services/runtime-catalog.service.js +0 -7
  433. package/dist/core/services/runtime-catalog.service.js.map +0 -1
  434. package/dist/core/sync/sync.service.d.ts +0 -4
  435. package/dist/core/sync/sync.service.js.map +0 -1
  436. package/dist/core/sync/sync.service.spec.d.ts +0 -1
  437. package/dist/core/sync/sync.service.spec.js +0 -63
  438. package/dist/core/sync/sync.service.spec.js.map +0 -1
  439. package/dist/core/upgrade/satellite-upgrade.service.d.ts +0 -48
  440. package/dist/core/upgrade/satellite-upgrade.service.js +0 -358
  441. package/dist/core/upgrade/satellite-upgrade.service.js.map +0 -1
  442. package/dist/core/upgrade/satellite-upgrade.service.spec.d.ts +0 -1
  443. package/dist/core/upgrade/satellite-upgrade.service.spec.js +0 -163
  444. package/dist/core/upgrade/satellite-upgrade.service.spec.js.map +0 -1
  445. package/dist/core/validators/architecture-drift.service.d.ts +0 -68
  446. package/dist/core/validators/architecture-drift.service.js +0 -266
  447. package/dist/core/validators/architecture-drift.service.js.map +0 -1
  448. package/dist/core/validators/architecture-drift.service.spec.d.ts +0 -1
  449. package/dist/core/validators/architecture-drift.service.spec.js +0 -315
  450. package/dist/core/validators/architecture-drift.service.spec.js.map +0 -1
  451. package/dist/core/validators/deep-architecture-analyzer.d.ts +0 -58
  452. package/dist/core/validators/deep-architecture-analyzer.js +0 -333
  453. package/dist/core/validators/deep-architecture-analyzer.js.map +0 -1
  454. package/dist/core/validators/deep-architecture-analyzer.spec.d.ts +0 -1
  455. package/dist/core/validators/deep-architecture-analyzer.spec.js +0 -216
  456. package/dist/core/validators/deep-architecture-analyzer.spec.js.map +0 -1
  457. package/dist/core/validators/phase-gate-validator.service.d.ts +0 -71
  458. package/dist/core/validators/phase-gate-validator.service.js +0 -273
  459. package/dist/core/validators/phase-gate-validator.service.js.map +0 -1
  460. package/dist/core/validators/phase-gate-validator.service.spec.d.ts +0 -1
  461. package/dist/core/validators/phase-gate-validator.service.spec.js +0 -326
  462. package/dist/core/validators/phase-gate-validator.service.spec.js.map +0 -1
  463. package/dist/core/validators/ruleset-validator-architecture.spec.d.ts +0 -1
  464. package/dist/core/validators/ruleset-validator-architecture.spec.js +0 -178
  465. package/dist/core/validators/ruleset-validator-architecture.spec.js.map +0 -1
  466. package/dist/core/validators/ruleset-validator.service.d.ts +0 -80
  467. package/dist/core/validators/ruleset-validator.service.js +0 -657
  468. package/dist/core/validators/ruleset-validator.service.js.map +0 -1
  469. package/dist/core/validators/ruleset-validator.service.spec.d.ts +0 -1
  470. package/dist/core/validators/ruleset-validator.service.spec.js +0 -469
  471. package/dist/core/validators/ruleset-validator.service.spec.js.map +0 -1
  472. package/dist/domain/entities/index.d.ts +0 -72
  473. package/dist/domain/entities/index.js +0 -119
  474. package/dist/domain/entities/index.js.map +0 -1
  475. package/dist/domain/interfaces.d.ts +0 -224
  476. package/dist/domain/interfaces.js +0 -3
  477. package/dist/domain/interfaces.js.map +0 -1
  478. package/dist/domain/services/adr.service.d.ts +0 -50
  479. package/dist/domain/services/adr.service.js +0 -125
  480. package/dist/domain/services/adr.service.js.map +0 -1
  481. package/dist/domain/services/adr.service.spec.d.ts +0 -1
  482. package/dist/domain/services/adr.service.spec.js +0 -141
  483. package/dist/domain/services/adr.service.spec.js.map +0 -1
  484. package/dist/domain/services/agent-registry.service.js.map +0 -1
  485. package/dist/domain/services/agent-registry.service.spec.d.ts +0 -1
  486. package/dist/domain/services/agent-registry.service.spec.js +0 -162
  487. package/dist/domain/services/agent-registry.service.spec.js.map +0 -1
  488. package/dist/domain/services/index.d.ts +0 -34
  489. package/dist/domain/services/index.js +0 -128
  490. package/dist/domain/services/index.js.map +0 -1
  491. package/dist/domain/services/moscow-prioritization.service.d.ts +0 -44
  492. package/dist/domain/services/moscow-prioritization.service.js +0 -213
  493. package/dist/domain/services/moscow-prioritization.service.js.map +0 -1
  494. package/dist/domain/services/moscow-prioritization.service.spec.d.ts +0 -1
  495. package/dist/domain/services/moscow-prioritization.service.spec.js +0 -285
  496. package/dist/domain/services/moscow-prioritization.service.spec.js.map +0 -1
  497. package/dist/domain/services/services.test.d.ts +0 -1
  498. package/dist/domain/services/services.test.js +0 -236
  499. package/dist/domain/services/services.test.js.map +0 -1
  500. package/dist/domain/services/standards.service.d.ts +0 -47
  501. package/dist/domain/services/standards.service.js +0 -129
  502. package/dist/domain/services/standards.service.js.map +0 -1
  503. package/dist/domain/services/standards.service.spec.d.ts +0 -1
  504. package/dist/domain/services/standards.service.spec.js +0 -600
  505. package/dist/domain/services/standards.service.spec.js.map +0 -1
  506. package/dist/domain/services/tool-usage-telemetry.service.js.map +0 -1
  507. package/dist/domain/services/tool-usage-telemetry.service.spec.d.ts +0 -1
  508. package/dist/domain/services/tool-usage-telemetry.service.spec.js +0 -180
  509. package/dist/domain/services/tool-usage-telemetry.service.spec.js.map +0 -1
  510. package/dist/infrastructure/catalog/catalog-loader.test.d.ts +0 -1
  511. package/dist/infrastructure/catalog/catalog-loader.test.js +0 -184
  512. package/dist/infrastructure/catalog/catalog-loader.test.js.map +0 -1
  513. package/dist/infrastructure/cli/command-executor.test.d.ts +0 -1
  514. package/dist/infrastructure/cli/command-executor.test.js +0 -98
  515. package/dist/infrastructure/cli/command-executor.test.js.map +0 -1
  516. package/dist/infrastructure/formatters/output-formatter.service.spec.d.ts +0 -1
  517. package/dist/infrastructure/formatters/output-formatter.service.spec.js +0 -164
  518. package/dist/infrastructure/formatters/output-formatter.service.spec.js.map +0 -1
  519. package/dist/test/mocks/index.d.ts +0 -44
  520. package/dist/test/mocks/index.js +0 -135
  521. package/dist/test/mocks/index.js.map +0 -1
  522. /package/dist/{core → infrastructure}/observability/command-watcher.d.ts +0 -0
  523. /package/dist/{core → infrastructure}/observability/error-reporter.d.ts +0 -0
  524. /package/dist/{core → infrastructure}/observability/structured-logger.d.ts +0 -0
  525. /package/dist/{core → infrastructure}/observability/structured-logger.js +0 -0
  526. /package/dist/{core → infrastructure}/observability/timing.d.ts +0 -0
  527. /package/dist/{core → infrastructure}/observability/timing.js +0 -0
  528. /package/dist/{domain/services → infrastructure/observability}/tool-usage-telemetry.service.d.ts +0 -0
  529. /package/dist/{domain/services → infrastructure/observability}/tool-usage-telemetry.service.js +0 -0
  530. /package/dist/{core/abstractions → infrastructure}/providers/config-parser.provider.js +0 -0
  531. /package/dist/{core/abstractions → infrastructure}/providers/logger.provider.js +0 -0
@@ -1,719 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.startMcpServer = startMcpServer;
37
- const common_1 = require("@nestjs/common");
38
- const http = __importStar(require("node:http"));
39
- const ruleset_validator_service_1 = require("../validators/ruleset-validator.service");
40
- const validate_1 = require("./tools/validate");
41
- const agent_1 = require("./tools/agent");
42
- const architecture_1 = require("./tools/architecture");
43
- const sdlc_1 = require("./tools/sdlc");
44
- const moscow_1 = require("./tools/moscow");
45
- const metrics_service_1 = require("./metrics.service");
46
- class MinimalStdioTransport {
47
- constructor(stdin, stdout) {
48
- this.readBuffer = '';
49
- this.stdin = stdin || process.stdin;
50
- this.stdout = stdout || process.stdout;
51
- this.readBuffer = '';
52
- this.started = false;
53
- }
54
- async start() {
55
- if (this.started)
56
- return;
57
- this.started = true;
58
- this.stdin.on('data', (chunk) => {
59
- this.readBuffer += chunk.toString();
60
- let newlineIndex;
61
- while ((newlineIndex = this.readBuffer.indexOf('\n')) !== -1) {
62
- const line = this.readBuffer.slice(0, newlineIndex).trim();
63
- this.readBuffer = this.readBuffer.slice(newlineIndex + 1);
64
- if (line) {
65
- try {
66
- const message = JSON.parse(line);
67
- if (this.onmessage) {
68
- this.onmessage(message);
69
- }
70
- }
71
- catch (e) {
72
- if (this.onerror) {
73
- this.onerror(new Error(`Invalid JSON: ${line}`));
74
- }
75
- }
76
- }
77
- }
78
- });
79
- this.stdin.on('end', () => {
80
- if (this.onclose) {
81
- this.onclose();
82
- }
83
- });
84
- this.stdin.on('error', (err) => {
85
- if (this.onerror) {
86
- this.onerror(err);
87
- }
88
- });
89
- }
90
- async close() {
91
- this.started = false;
92
- }
93
- async send(message) {
94
- return new Promise((resolve, reject) => {
95
- const json = JSON.stringify(message) + '\n';
96
- this.stdout.write(json, (err) => {
97
- if (err)
98
- reject(err);
99
- else
100
- resolve();
101
- });
102
- });
103
- }
104
- }
105
- class MinimalHttpTransport {
106
- constructor(port, apiKey) {
107
- this.server = null;
108
- this.logger = new common_1.Logger(MinimalHttpTransport.name);
109
- this.sseClients = [];
110
- this.started = false;
111
- this.port = port;
112
- this.apiKey = apiKey;
113
- }
114
- async start() {
115
- if (this.started)
116
- return;
117
- this.started = true;
118
- this.server = http.createServer((req, res) => {
119
- this.handleRequest(req, res);
120
- });
121
- this.server.on('error', (error) => {
122
- this.logger.error(`HTTP server error: ${error.message}`);
123
- if (this.onerror) {
124
- this.onerror(error);
125
- }
126
- });
127
- this.server.on('close', () => {
128
- if (this.onclose) {
129
- this.onclose();
130
- }
131
- });
132
- await new Promise((resolve, reject) => {
133
- this.server.listen(this.port, '127.0.0.1', () => {
134
- this.logger.log(`Evolith MCP HTTP server listening on http://127.0.0.1:${this.port}`);
135
- resolve();
136
- });
137
- this.server.on('error', reject);
138
- });
139
- }
140
- async close() {
141
- this.started = false;
142
- for (const client of this.sseClients) {
143
- client.res.end();
144
- }
145
- this.sseClients = [];
146
- if (this.server) {
147
- await new Promise((resolve) => {
148
- this.server.close(() => resolve());
149
- });
150
- this.server = null;
151
- }
152
- }
153
- async send(message) {
154
- const data = `event: message\ndata: ${JSON.stringify(message)}\n\n`;
155
- const clientsToRemove = [];
156
- for (const client of this.sseClients) {
157
- try {
158
- client.res.write(data);
159
- }
160
- catch {
161
- clientsToRemove.push(client);
162
- }
163
- }
164
- for (const client of clientsToRemove) {
165
- const index = this.sseClients.indexOf(client);
166
- if (index > -1) {
167
- this.sseClients.splice(index, 1);
168
- }
169
- }
170
- }
171
- handleRequest(req, res) {
172
- const url = new URL(req.url || '/', `http://127.0.0.1:${this.port}`);
173
- if (!this.validateAuth(req, res)) {
174
- return;
175
- }
176
- if (req.method === 'POST' && url.pathname === '/message') {
177
- this.handlePostMessage(req, res);
178
- }
179
- else if (req.method === 'GET' && url.pathname === '/sse') {
180
- this.handleSseConnection(req, res);
181
- }
182
- else if (req.method === 'GET' && url.pathname === '/health') {
183
- res.writeHead(200, { 'Content-Type': 'application/json' });
184
- res.end(JSON.stringify({ status: 'ok', transport: 'http', protocol: 'mcp' }));
185
- }
186
- else {
187
- res.writeHead(404, { 'Content-Type': 'application/json' });
188
- res.end(JSON.stringify({ error: 'Not found' }));
189
- }
190
- }
191
- validateAuth(req, res) {
192
- if (!this.apiKey)
193
- return true;
194
- const authHeader = req.headers.authorization || '';
195
- const bearerToken = authHeader.startsWith('Bearer ') ? authHeader.slice(7) : '';
196
- const apiKeyHeader = req.headers['x-api-key'];
197
- if (bearerToken !== this.apiKey && apiKeyHeader !== this.apiKey) {
198
- res.writeHead(401, { 'Content-Type': 'application/json' });
199
- res.end(JSON.stringify({ error: 'Unauthorized', message: 'Invalid or missing API key' }));
200
- return false;
201
- }
202
- return true;
203
- }
204
- async handlePostMessage(req, res) {
205
- let body = '';
206
- req.on('data', (chunk) => {
207
- body += chunk.toString();
208
- });
209
- req.on('end', async () => {
210
- try {
211
- const message = JSON.parse(body);
212
- if (this.onmessage) {
213
- await this.onmessage(message);
214
- }
215
- res.writeHead(202, { 'Content-Type': 'application/json' });
216
- res.end(JSON.stringify({ status: 'accepted' }));
217
- }
218
- catch (error) {
219
- this.logger.error(`Invalid POST message: ${error}`);
220
- res.writeHead(400, { 'Content-Type': 'application/json' });
221
- res.end(JSON.stringify({ error: 'Invalid JSON' }));
222
- }
223
- });
224
- req.on('error', (error) => {
225
- this.logger.error(`Request error: ${error.message}`);
226
- if (this.onerror) {
227
- this.onerror(error);
228
- }
229
- if (!res.headersSent) {
230
- res.writeHead(500, { 'Content-Type': 'application/json' });
231
- res.end(JSON.stringify({ error: 'Internal server error' }));
232
- }
233
- });
234
- }
235
- handleSseConnection(req, res) {
236
- const clientId = `client-${Date.now()}-${Math.random().toString(36).substring(2, 7)}`;
237
- res.writeHead(200, {
238
- 'Content-Type': 'text/event-stream',
239
- 'Cache-Control': 'no-cache',
240
- 'Connection': 'keep-alive',
241
- 'Access-Control-Allow-Origin': '*',
242
- });
243
- res.write(': connected\n\n');
244
- this.sseClients.push({ id: clientId, res });
245
- req.on('close', () => {
246
- const index = this.sseClients.findIndex(c => c.id === clientId);
247
- if (index > -1) {
248
- this.sseClients.splice(index, 1);
249
- }
250
- this.logger.debug(`SSE client disconnected: ${clientId}`);
251
- });
252
- this.logger.debug(`SSE client connected: ${clientId}`);
253
- }
254
- }
255
- class DirectMcpServer {
256
- constructor(transportType = 'stdio', port = 49100, apiKey, rulesetValidator, metricsService) {
257
- this.logger = new common_1.Logger(DirectMcpServer.name);
258
- this.transportType = transportType;
259
- this.rulesetValidator = rulesetValidator || new ruleset_validator_service_1.RulesetValidatorService();
260
- this.metricsService = metricsService || new metrics_service_1.McpMetricsService();
261
- if (transportType === 'http') {
262
- this.transport = new MinimalHttpTransport(port, apiKey);
263
- }
264
- else {
265
- this.transport = new MinimalStdioTransport();
266
- }
267
- }
268
- async start() {
269
- const transport = this.transport;
270
- transport.onmessage = async (message) => {
271
- await this.handleMessage(message);
272
- };
273
- transport.onerror = (error) => {
274
- this.logger.error(`Transport error: ${error.message}`);
275
- };
276
- await transport.start();
277
- this.logger.log(`Evolith MCP Server started on ${this.transportType}`);
278
- }
279
- async stop() {
280
- await this.transport.close();
281
- }
282
- async handleMessage(rawMessage) {
283
- try {
284
- const request = rawMessage;
285
- this.logger.debug(`Received: ${JSON.stringify(request)}`);
286
- if (request.method === 'initialize') {
287
- const response = {
288
- jsonrpc: '2.0',
289
- id: request.id,
290
- result: {
291
- protocolVersion: '2024-11-05',
292
- capabilities: {
293
- tools: {},
294
- resources: {},
295
- prompts: {},
296
- },
297
- serverInfo: {
298
- name: 'evolith-mcp-server',
299
- version: '1.0.0',
300
- },
301
- },
302
- };
303
- await this.transport.send(response);
304
- return;
305
- }
306
- let result;
307
- try {
308
- result = await this.dispatchRequest(request.method, request.params || {});
309
- }
310
- catch (error) {
311
- const errorResponse = {
312
- jsonrpc: '2.0',
313
- id: request.id,
314
- error: {
315
- code: -32603,
316
- message: error instanceof Error ? error.message : String(error),
317
- },
318
- };
319
- await this.transport.send(errorResponse);
320
- return;
321
- }
322
- const response = {
323
- jsonrpc: '2.0',
324
- id: request.id,
325
- result,
326
- };
327
- await this.transport.send(response);
328
- }
329
- catch (error) {
330
- this.logger.error(`Error handling message: ${error}`);
331
- const errorResponse = {
332
- jsonrpc: '2.0',
333
- id: null,
334
- error: {
335
- code: -32603,
336
- message: error instanceof Error ? error.message : String(error),
337
- },
338
- };
339
- await this.transport.send(errorResponse);
340
- }
341
- }
342
- async dispatchRequest(method, params) {
343
- switch (method) {
344
- case 'tools/list':
345
- return this.handleListTools();
346
- case 'tools/call':
347
- return this.handleCallTool(params);
348
- case 'resources/list':
349
- return this.handleListResources();
350
- case 'resources/read':
351
- return this.handleReadResource(params);
352
- case 'prompts/list':
353
- return this.handleListPrompts();
354
- case 'prompts/get':
355
- return this.handleGetPrompt(params);
356
- default:
357
- throw new Error(`Method not found: ${method}`);
358
- }
359
- }
360
- handleListTools() {
361
- return {
362
- tools: [
363
- {
364
- name: 'evolith-validate',
365
- description: 'Validate a repository against Evolith governance rules',
366
- inputSchema: {
367
- type: 'object',
368
- properties: {
369
- path: { type: 'string', description: 'Path to the repository to validate' },
370
- format: { type: 'string', description: 'Output format: json, summary, table', default: 'json' },
371
- ruleset: { type: 'string', description: 'Specific ruleset to validate' },
372
- corePath: { type: 'string', description: 'Path to Evolith Core' },
373
- },
374
- required: ['path'],
375
- },
376
- },
377
- {
378
- name: 'evolith-agent-install',
379
- description: 'Install a new Evolith agent',
380
- inputSchema: {
381
- type: 'object',
382
- properties: {
383
- name: { type: 'string', description: 'Name of the agent to install' },
384
- template: { type: 'string', description: 'Template: standard, minimal, enterprise', default: 'standard' },
385
- dir: { type: 'string', description: 'Directory to install into' },
386
- },
387
- required: ['name'],
388
- },
389
- },
390
- {
391
- name: 'evolith-agent-list',
392
- description: 'List all installed Evolith agents',
393
- inputSchema: {
394
- type: 'object',
395
- properties: {
396
- dir: { type: 'string', description: 'Directory to search' },
397
- },
398
- },
399
- },
400
- {
401
- name: 'evolith-agent-validate',
402
- description: 'Validate a specific agent ruleset',
403
- inputSchema: {
404
- type: 'object',
405
- properties: {
406
- name: { type: 'string' },
407
- dir: { type: 'string' },
408
- },
409
- required: ['name'],
410
- },
411
- },
412
- {
413
- name: 'evolith-agent-upgrade',
414
- description: 'Upgrade an existing Evolith agent',
415
- inputSchema: {
416
- type: 'object',
417
- properties: {
418
- name: { type: 'string' },
419
- dir: { type: 'string' },
420
- },
421
- required: ['name'],
422
- },
423
- },
424
- {
425
- name: 'evolith-agent-remove',
426
- description: 'Remove an Evolith agent',
427
- inputSchema: {
428
- type: 'object',
429
- properties: {
430
- name: { type: 'string' },
431
- dir: { type: 'string' },
432
- },
433
- required: ['name'],
434
- },
435
- },
436
- {
437
- name: 'evolith-architecture-validate',
438
- description: 'Validate repository architecture against F1/F2/F3 rules. Use deep=true for import graph analysis, layer violations, and coupling metrics.',
439
- inputSchema: {
440
- type: 'object',
441
- properties: {
442
- path: { type: 'string' },
443
- level: { type: 'string', description: 'F1, F2, or F3' },
444
- deep: { type: 'boolean', description: 'Enable deep static analysis (import graph, layer violations, coupling metrics)', default: false },
445
- },
446
- required: ['path'],
447
- },
448
- },
449
- {
450
- name: 'evolith-sdlc-handoff',
451
- description: 'Generate SDLC phase handoff artifact manifest',
452
- inputSchema: {
453
- type: 'object',
454
- properties: {
455
- path: { type: 'string' },
456
- fromPhase: { type: 'string' },
457
- toPhase: { type: 'string' },
458
- },
459
- required: ['path', 'fromPhase', 'toPhase'],
460
- },
461
- },
462
- {
463
- name: 'evolith-sdlc-status',
464
- description: 'Show current SDLC phase gate status',
465
- inputSchema: {
466
- type: 'object',
467
- properties: {
468
- path: { type: 'string' },
469
- },
470
- required: ['path'],
471
- },
472
- },
473
- {
474
- name: 'evolith-config-get',
475
- description: 'Get Evolith configuration value',
476
- inputSchema: {
477
- type: 'object',
478
- properties: {
479
- key: { type: 'string' },
480
- dir: { type: 'string' },
481
- },
482
- required: ['key'],
483
- },
484
- },
485
- {
486
- name: 'evolith-config-set',
487
- description: 'Set Evolith configuration value',
488
- inputSchema: {
489
- type: 'object',
490
- properties: {
491
- key: { type: 'string' },
492
- value: { type: 'string' },
493
- dir: { type: 'string' },
494
- },
495
- required: ['key', 'value'],
496
- },
497
- },
498
- {
499
- name: 'evolith-metrics',
500
- description: 'Get MCP server metrics',
501
- inputSchema: {
502
- type: 'object',
503
- properties: {},
504
- },
505
- },
506
- {
507
- name: 'evolith-moscow-create',
508
- description: 'Create a new MoSCoW prioritization analysis for a phase',
509
- inputSchema: {
510
- type: 'object',
511
- properties: {
512
- path: { type: 'string', description: 'Path to the repository' },
513
- phase: { type: 'string', description: 'Phase identifier (e.g., phase-0)', default: 'phase-0' },
514
- items: { type: 'array', description: 'Array of MoSCoW items with description, priority, category, rationale' },
515
- },
516
- required: ['path', 'items'],
517
- },
518
- },
519
- {
520
- name: 'evolith-moscow-load',
521
- description: 'Load an existing MoSCoW analysis for a phase',
522
- inputSchema: {
523
- type: 'object',
524
- properties: {
525
- path: { type: 'string' },
526
- phase: { type: 'string', default: 'phase-0' },
527
- },
528
- required: ['path'],
529
- },
530
- },
531
- {
532
- name: 'evolith-moscow-update',
533
- description: 'Update an item in a MoSCoW analysis',
534
- inputSchema: {
535
- type: 'object',
536
- properties: {
537
- path: { type: 'string' },
538
- phase: { type: 'string', default: 'phase-0' },
539
- itemId: { type: 'string' },
540
- updates: { type: 'object' },
541
- },
542
- required: ['path', 'itemId'],
543
- },
544
- },
545
- {
546
- name: 'evolith-moscow-remove',
547
- description: 'Remove an item from a MoSCoW analysis',
548
- inputSchema: {
549
- type: 'object',
550
- properties: {
551
- path: { type: 'string' },
552
- phase: { type: 'string', default: 'phase-0' },
553
- itemId: { type: 'string' },
554
- },
555
- required: ['path', 'itemId'],
556
- },
557
- },
558
- {
559
- name: 'evolith-moscow-list',
560
- description: 'List all MoSCoW analyses for a repository',
561
- inputSchema: {
562
- type: 'object',
563
- properties: {
564
- path: { type: 'string' },
565
- },
566
- required: ['path'],
567
- },
568
- },
569
- {
570
- name: 'evolith-moscow-validate',
571
- description: 'Validate a MoSCoW analysis for correctness',
572
- inputSchema: {
573
- type: 'object',
574
- properties: {
575
- path: { type: 'string' },
576
- phase: { type: 'string', default: 'phase-0' },
577
- },
578
- required: ['path'],
579
- },
580
- },
581
- {
582
- name: 'evolith-moscow-report',
583
- description: 'Generate a markdown report from a MoSCoW analysis',
584
- inputSchema: {
585
- type: 'object',
586
- properties: {
587
- path: { type: 'string' },
588
- phase: { type: 'string', default: 'phase-0' },
589
- },
590
- required: ['path'],
591
- },
592
- },
593
- ],
594
- };
595
- }
596
- async handleCallTool(params) {
597
- const name = params.name;
598
- const args = params.arguments || {};
599
- const startTime = Date.now();
600
- try {
601
- let result;
602
- if (name === 'evolith-validate') {
603
- result = await (0, validate_1.handleValidateTool)(args, this.rulesetValidator);
604
- }
605
- else if (name.startsWith('evolith-agent')) {
606
- result = await (0, agent_1.handleAgentTools)(name, args);
607
- }
608
- else if (name === 'evolith-architecture-validate') {
609
- result = await (0, architecture_1.handleArchitectureTools)(args);
610
- }
611
- else if (name.startsWith('evolith-sdlc')) {
612
- result = await (0, sdlc_1.handleSdlcTools)(name, args);
613
- }
614
- else if (name === 'evolith-config-get' || name === 'evolith-config-set') {
615
- result = await this.handleConfigTools(name, args);
616
- }
617
- else if (name === 'evolith-metrics') {
618
- result = this.metricsService.getMetrics();
619
- }
620
- else if (name.startsWith('evolith-moscow')) {
621
- result = await (0, moscow_1.handleMoscowTools)(name, args);
622
- }
623
- else {
624
- throw new Error(`Unknown tool: ${name}`);
625
- }
626
- const latencyMs = Date.now() - startTime;
627
- this.metricsService.recordToolCall(name, latencyMs, true);
628
- return {
629
- content: [
630
- {
631
- type: 'text',
632
- text: typeof result === 'string' ? result : JSON.stringify(result, null, 2),
633
- },
634
- ],
635
- };
636
- }
637
- catch (error) {
638
- const latencyMs = Date.now() - startTime;
639
- const message = error instanceof Error ? error.message : String(error);
640
- this.metricsService.recordToolCall(name, latencyMs, false);
641
- this.metricsService.recordError(message.substring(0, 50));
642
- return {
643
- content: [
644
- {
645
- type: 'text',
646
- text: JSON.stringify({ error: true, message }),
647
- },
648
- ],
649
- isError: true,
650
- };
651
- }
652
- }
653
- async handleConfigTools(name, args) {
654
- const fs = await Promise.resolve().then(() => __importStar(require('fs-extra')));
655
- const path = await Promise.resolve().then(() => __importStar(require('path')));
656
- const yaml = await Promise.resolve().then(() => __importStar(require('yaml')));
657
- const dir = args.dir || process.cwd();
658
- const configPath = path.join(dir, 'evolith.yaml');
659
- if (!(await fs.pathExists(configPath))) {
660
- throw new Error('evolith.yaml not found');
661
- }
662
- const config = yaml.parse(await fs.readFile(configPath, 'utf-8'));
663
- if (name === 'evolith-config-get') {
664
- const key = args.key;
665
- const keys = key.split('.');
666
- let value = config;
667
- for (const k of keys) {
668
- value = value?.[k];
669
- }
670
- return { key, value: value ?? null };
671
- }
672
- else {
673
- const key = args.key;
674
- const value = args.value;
675
- const keys = key.split('.');
676
- let target = config;
677
- for (let i = 0; i < keys.length - 1; i++) {
678
- if (!target[keys[i]]) {
679
- target[keys[i]] = {};
680
- }
681
- target = target[keys[i]];
682
- }
683
- target[keys[keys.length - 1]] = value;
684
- await fs.writeFile(configPath, yaml.stringify(config));
685
- return { key, value, updated: true };
686
- }
687
- }
688
- async handleListResources() {
689
- const { listResources } = await Promise.resolve().then(() => __importStar(require('./resources')));
690
- return listResources();
691
- }
692
- async handleReadResource(params) {
693
- const { readResource } = await Promise.resolve().then(() => __importStar(require('./resources')));
694
- return readResource(params);
695
- }
696
- async handleListPrompts() {
697
- const { listPrompts } = await Promise.resolve().then(() => __importStar(require('./prompts')));
698
- return listPrompts();
699
- }
700
- async handleGetPrompt(params) {
701
- const { getPrompt } = await Promise.resolve().then(() => __importStar(require('./prompts')));
702
- return getPrompt(params);
703
- }
704
- }
705
- function validateApiKey(apiKey, validKey) {
706
- if (!validKey)
707
- return true;
708
- if (!apiKey)
709
- return false;
710
- return apiKey === validKey;
711
- }
712
- async function startMcpServer(options = {}) {
713
- const transport = options.transport || 'stdio';
714
- const port = options.port || 49100;
715
- const server = new DirectMcpServer(transport, port, options.apiKey, options.rulesetValidator, options.metricsService);
716
- await server.start();
717
- return server;
718
- }
719
- //# sourceMappingURL=server.js.map