@evolith/smart-cli 0.0.1-beta

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 (241) hide show
  1. package/ARCHITECTURE.md +121 -0
  2. package/README.es.md +425 -0
  3. package/README.md +419 -0
  4. package/dist/app.module.d.ts +2 -0
  5. package/dist/app.module.js +59 -0
  6. package/dist/app.module.js.map +1 -0
  7. package/dist/application/services/index.d.ts +54 -0
  8. package/dist/application/services/index.js +307 -0
  9. package/dist/application/services/index.js.map +1 -0
  10. package/dist/application/services/services.test.d.ts +1 -0
  11. package/dist/application/services/services.test.js +176 -0
  12. package/dist/application/services/services.test.js.map +1 -0
  13. package/dist/application/use-cases/validate-satellite.use-case.d.ts +18 -0
  14. package/dist/application/use-cases/validate-satellite.use-case.js +92 -0
  15. package/dist/application/use-cases/validate-satellite.use-case.js.map +1 -0
  16. package/dist/application/use-cases/validate-satellite.use-case.spec.d.ts +1 -0
  17. package/dist/application/use-cases/validate-satellite.use-case.spec.js +102 -0
  18. package/dist/application/use-cases/validate-satellite.use-case.spec.js.map +1 -0
  19. package/dist/commands/adr/adr.command.d.ts +28 -0
  20. package/dist/commands/adr/adr.command.js +357 -0
  21. package/dist/commands/adr/adr.command.js.map +1 -0
  22. package/dist/commands/architecture/scaffold.command.d.ts +7 -0
  23. package/dist/commands/architecture/scaffold.command.js +162 -0
  24. package/dist/commands/architecture/scaffold.command.js.map +1 -0
  25. package/dist/commands/commands.test.d.ts +1 -0
  26. package/dist/commands/commands.test.js +131 -0
  27. package/dist/commands/commands.test.js.map +1 -0
  28. package/dist/commands/completion/completion.command.d.ts +20 -0
  29. package/dist/commands/completion/completion.command.js +215 -0
  30. package/dist/commands/completion/completion.command.js.map +1 -0
  31. package/dist/commands/docs/docs.command.d.ts +9 -0
  32. package/dist/commands/docs/docs.command.js +77 -0
  33. package/dist/commands/docs/docs.command.js.map +1 -0
  34. package/dist/commands/history/history.command.d.ts +29 -0
  35. package/dist/commands/history/history.command.js +268 -0
  36. package/dist/commands/history/history.command.js.map +1 -0
  37. package/dist/commands/init/agents.command.d.ts +22 -0
  38. package/dist/commands/init/agents.command.js +502 -0
  39. package/dist/commands/init/agents.command.js.map +1 -0
  40. package/dist/commands/init/init.command.d.ts +20 -0
  41. package/dist/commands/init/init.command.js +329 -0
  42. package/dist/commands/init/init.command.js.map +1 -0
  43. package/dist/commands/init/upgrade.command.d.ts +9 -0
  44. package/dist/commands/init/upgrade.command.js +77 -0
  45. package/dist/commands/init/upgrade.command.js.map +1 -0
  46. package/dist/commands/mcp/mcp-serve.command.d.ts +15 -0
  47. package/dist/commands/mcp/mcp-serve.command.js +106 -0
  48. package/dist/commands/mcp/mcp-serve.command.js.map +1 -0
  49. package/dist/commands/sdlc/generate-domain.command.d.ts +5 -0
  50. package/dist/commands/sdlc/generate-domain.command.js +55 -0
  51. package/dist/commands/sdlc/generate-domain.command.js.map +1 -0
  52. package/dist/commands/sdlc/handoff.command.d.ts +22 -0
  53. package/dist/commands/sdlc/handoff.command.js +273 -0
  54. package/dist/commands/sdlc/handoff.command.js.map +1 -0
  55. package/dist/commands/sdlc/sdlc.command.d.ts +4 -0
  56. package/dist/commands/sdlc/sdlc.command.js +34 -0
  57. package/dist/commands/sdlc/sdlc.command.js.map +1 -0
  58. package/dist/commands/standards/standards.command.d.ts +27 -0
  59. package/dist/commands/standards/standards.command.js +308 -0
  60. package/dist/commands/standards/standards.command.js.map +1 -0
  61. package/dist/commands/validate/validate.command.d.ts +19 -0
  62. package/dist/commands/validate/validate.command.js +231 -0
  63. package/dist/commands/validate/validate.command.js.map +1 -0
  64. package/dist/config/runtimes.json +196 -0
  65. package/dist/config/tool-catalog.json +343 -0
  66. package/dist/core/abstractions/index.d.ts +6 -0
  67. package/dist/core/abstractions/index.js +23 -0
  68. package/dist/core/abstractions/index.js.map +1 -0
  69. package/dist/core/abstractions/interfaces.d.ts +60 -0
  70. package/dist/core/abstractions/interfaces.js +5 -0
  71. package/dist/core/abstractions/interfaces.js.map +1 -0
  72. package/dist/core/abstractions/providers/config-parser.provider.d.ts +15 -0
  73. package/dist/core/abstractions/providers/config-parser.provider.js +68 -0
  74. package/dist/core/abstractions/providers/config-parser.provider.js.map +1 -0
  75. package/dist/core/abstractions/providers/logger.provider.d.ts +10 -0
  76. package/dist/core/abstractions/providers/logger.provider.js +84 -0
  77. package/dist/core/abstractions/providers/logger.provider.js.map +1 -0
  78. package/dist/core/abstractions/providers/mock-filesystem.provider.d.ts +30 -0
  79. package/dist/core/abstractions/providers/mock-filesystem.provider.js +122 -0
  80. package/dist/core/abstractions/providers/mock-filesystem.provider.js.map +1 -0
  81. package/dist/core/abstractions/providers/node-filesystem.provider.d.ts +19 -0
  82. package/dist/core/abstractions/providers/node-filesystem.provider.js +104 -0
  83. package/dist/core/abstractions/providers/node-filesystem.provider.js.map +1 -0
  84. package/dist/core/architecture/nx-workspace.strategy.d.ts +11 -0
  85. package/dist/core/architecture/nx-workspace.strategy.js +107 -0
  86. package/dist/core/architecture/nx-workspace.strategy.js.map +1 -0
  87. package/dist/core/architecture/workspace-manager.strategy.d.ts +7 -0
  88. package/dist/core/architecture/workspace-manager.strategy.js +3 -0
  89. package/dist/core/architecture/workspace-manager.strategy.js.map +1 -0
  90. package/dist/core/config/config.service.d.ts +15 -0
  91. package/dist/core/config/config.service.js +55 -0
  92. package/dist/core/config/config.service.js.map +1 -0
  93. package/dist/core/config/config.service.spec.d.ts +1 -0
  94. package/dist/core/config/config.service.spec.js +43 -0
  95. package/dist/core/config/config.service.spec.js.map +1 -0
  96. package/dist/core/di/container.d.ts +25 -0
  97. package/dist/core/di/container.js +87 -0
  98. package/dist/core/di/container.js.map +1 -0
  99. package/dist/core/di/container.spec.d.ts +1 -0
  100. package/dist/core/di/container.spec.js +137 -0
  101. package/dist/core/di/container.spec.js.map +1 -0
  102. package/dist/core/errors/index.d.ts +26 -0
  103. package/dist/core/errors/index.js +67 -0
  104. package/dist/core/errors/index.js.map +1 -0
  105. package/dist/core/filesystem/file-manager.service.d.ts +4 -0
  106. package/dist/core/filesystem/file-manager.service.js +96 -0
  107. package/dist/core/filesystem/file-manager.service.js.map +1 -0
  108. package/dist/core/filesystem/file-manager.service.spec.d.ts +1 -0
  109. package/dist/core/filesystem/file-manager.service.spec.js +103 -0
  110. package/dist/core/filesystem/file-manager.service.spec.js.map +1 -0
  111. package/dist/core/mcp/mcp-server.service.d.ts +7 -0
  112. package/dist/core/mcp/mcp-server.service.js +31 -0
  113. package/dist/core/mcp/mcp-server.service.js.map +1 -0
  114. package/dist/core/mcp/metrics.service.d.ts +37 -0
  115. package/dist/core/mcp/metrics.service.js +72 -0
  116. package/dist/core/mcp/metrics.service.js.map +1 -0
  117. package/dist/core/mcp/prompts/index.d.ts +22 -0
  118. package/dist/core/mcp/prompts/index.js +175 -0
  119. package/dist/core/mcp/prompts/index.js.map +1 -0
  120. package/dist/core/mcp/resources/index.d.ts +11 -0
  121. package/dist/core/mcp/resources/index.js +193 -0
  122. package/dist/core/mcp/resources/index.js.map +1 -0
  123. package/dist/core/mcp/server.d.ts +25 -0
  124. package/dist/core/mcp/server.js +413 -0
  125. package/dist/core/mcp/server.js.map +1 -0
  126. package/dist/core/mcp/tools/agent.d.ts +41 -0
  127. package/dist/core/mcp/tools/agent.js +195 -0
  128. package/dist/core/mcp/tools/agent.js.map +1 -0
  129. package/dist/core/mcp/tools/architecture.d.ts +27 -0
  130. package/dist/core/mcp/tools/architecture.js +166 -0
  131. package/dist/core/mcp/tools/architecture.js.map +1 -0
  132. package/dist/core/mcp/tools/sdlc.d.ts +32 -0
  133. package/dist/core/mcp/tools/sdlc.js +189 -0
  134. package/dist/core/mcp/tools/sdlc.js.map +1 -0
  135. package/dist/core/mcp/tools/tool-utils.d.ts +4 -0
  136. package/dist/core/mcp/tools/tool-utils.js +18 -0
  137. package/dist/core/mcp/tools/tool-utils.js.map +1 -0
  138. package/dist/core/mcp/tools/validate.d.ts +18 -0
  139. package/dist/core/mcp/tools/validate.js +56 -0
  140. package/dist/core/mcp/tools/validate.js.map +1 -0
  141. package/dist/core/mcp/watcher.service.d.ts +8 -0
  142. package/dist/core/mcp/watcher.service.js +82 -0
  143. package/dist/core/mcp/watcher.service.js.map +1 -0
  144. package/dist/core/mcp/watcher.service.spec.d.ts +1 -0
  145. package/dist/core/mcp/watcher.service.spec.js +70 -0
  146. package/dist/core/mcp/watcher.service.spec.js.map +1 -0
  147. package/dist/core/observability/command-watcher.d.ts +45 -0
  148. package/dist/core/observability/command-watcher.js +168 -0
  149. package/dist/core/observability/command-watcher.js.map +1 -0
  150. package/dist/core/observability/error-reporter.d.ts +47 -0
  151. package/dist/core/observability/error-reporter.js +163 -0
  152. package/dist/core/observability/error-reporter.js.map +1 -0
  153. package/dist/core/observability/index.d.ts +4 -0
  154. package/dist/core/observability/index.js +24 -0
  155. package/dist/core/observability/index.js.map +1 -0
  156. package/dist/core/observability/observability.test.d.ts +1 -0
  157. package/dist/core/observability/observability.test.js +224 -0
  158. package/dist/core/observability/observability.test.js.map +1 -0
  159. package/dist/core/observability/structured-logger.d.ts +53 -0
  160. package/dist/core/observability/structured-logger.js +123 -0
  161. package/dist/core/observability/structured-logger.js.map +1 -0
  162. package/dist/core/observability/timing.d.ts +23 -0
  163. package/dist/core/observability/timing.js +140 -0
  164. package/dist/core/observability/timing.js.map +1 -0
  165. package/dist/core/services/command-executor.service.d.ts +3 -0
  166. package/dist/core/services/command-executor.service.js +12 -0
  167. package/dist/core/services/command-executor.service.js.map +1 -0
  168. package/dist/core/services/command-history.service.d.ts +38 -0
  169. package/dist/core/services/command-history.service.js +146 -0
  170. package/dist/core/services/command-history.service.js.map +1 -0
  171. package/dist/core/services/command-providers.d.ts +1 -0
  172. package/dist/core/services/command-providers.js +17 -0
  173. package/dist/core/services/command-providers.js.map +1 -0
  174. package/dist/core/services/runtime-catalog.service.d.ts +2 -0
  175. package/dist/core/services/runtime-catalog.service.js +7 -0
  176. package/dist/core/services/runtime-catalog.service.js.map +1 -0
  177. package/dist/core/sync/sync.service.d.ts +4 -0
  178. package/dist/core/sync/sync.service.js +81 -0
  179. package/dist/core/sync/sync.service.js.map +1 -0
  180. package/dist/core/sync/sync.service.spec.d.ts +1 -0
  181. package/dist/core/sync/sync.service.spec.js +63 -0
  182. package/dist/core/sync/sync.service.spec.js.map +1 -0
  183. package/dist/core/validators/ruleset-validator.service.d.ts +56 -0
  184. package/dist/core/validators/ruleset-validator.service.js +263 -0
  185. package/dist/core/validators/ruleset-validator.service.js.map +1 -0
  186. package/dist/core/validators/ruleset-validator.service.spec.d.ts +1 -0
  187. package/dist/core/validators/ruleset-validator.service.spec.js +121 -0
  188. package/dist/core/validators/ruleset-validator.service.spec.js.map +1 -0
  189. package/dist/domain/entities/index.d.ts +72 -0
  190. package/dist/domain/entities/index.js +119 -0
  191. package/dist/domain/entities/index.js.map +1 -0
  192. package/dist/domain/interfaces.d.ts +224 -0
  193. package/dist/domain/interfaces.js +3 -0
  194. package/dist/domain/interfaces.js.map +1 -0
  195. package/dist/domain/services/adr.service.d.ts +50 -0
  196. package/dist/domain/services/adr.service.js +125 -0
  197. package/dist/domain/services/adr.service.js.map +1 -0
  198. package/dist/domain/services/agent-registry.service.d.ts +26 -0
  199. package/dist/domain/services/agent-registry.service.js +152 -0
  200. package/dist/domain/services/agent-registry.service.js.map +1 -0
  201. package/dist/domain/services/index.d.ts +33 -0
  202. package/dist/domain/services/index.js +126 -0
  203. package/dist/domain/services/index.js.map +1 -0
  204. package/dist/domain/services/services.test.d.ts +1 -0
  205. package/dist/domain/services/services.test.js +236 -0
  206. package/dist/domain/services/services.test.js.map +1 -0
  207. package/dist/domain/services/standards.service.d.ts +47 -0
  208. package/dist/domain/services/standards.service.js +129 -0
  209. package/dist/domain/services/standards.service.js.map +1 -0
  210. package/dist/domain/services/tool-usage-telemetry.service.d.ts +46 -0
  211. package/dist/domain/services/tool-usage-telemetry.service.js +181 -0
  212. package/dist/domain/services/tool-usage-telemetry.service.js.map +1 -0
  213. package/dist/infrastructure/catalog/catalog-loader.d.ts +22 -0
  214. package/dist/infrastructure/catalog/catalog-loader.js +135 -0
  215. package/dist/infrastructure/catalog/catalog-loader.js.map +1 -0
  216. package/dist/infrastructure/catalog/catalog-loader.test.d.ts +1 -0
  217. package/dist/infrastructure/catalog/catalog-loader.test.js +184 -0
  218. package/dist/infrastructure/catalog/catalog-loader.test.js.map +1 -0
  219. package/dist/infrastructure/cli/command-executor.d.ts +20 -0
  220. package/dist/infrastructure/cli/command-executor.js +109 -0
  221. package/dist/infrastructure/cli/command-executor.js.map +1 -0
  222. package/dist/infrastructure/cli/command-executor.test.d.ts +1 -0
  223. package/dist/infrastructure/cli/command-executor.test.js +98 -0
  224. package/dist/infrastructure/cli/command-executor.test.js.map +1 -0
  225. package/dist/infrastructure/cli/providers/index.d.ts +52 -0
  226. package/dist/infrastructure/cli/providers/index.js +175 -0
  227. package/dist/infrastructure/cli/providers/index.js.map +1 -0
  228. package/dist/infrastructure/formatters/output-formatter.service.d.ts +28 -0
  229. package/dist/infrastructure/formatters/output-formatter.service.js +198 -0
  230. package/dist/infrastructure/formatters/output-formatter.service.js.map +1 -0
  231. package/dist/main.d.ts +2 -0
  232. package/dist/main.js +10 -0
  233. package/dist/main.js.map +1 -0
  234. package/dist/test/mocks/index.d.ts +44 -0
  235. package/dist/test/mocks/index.js +135 -0
  236. package/dist/test/mocks/index.js.map +1 -0
  237. package/package.json +80 -0
  238. package/shell/completion.bash +85 -0
  239. package/shell/completion.fish +72 -0
  240. package/shell/completion.zsh +83 -0
  241. package/templates/evolith.yaml.example +45 -0
@@ -0,0 +1,121 @@
1
+ # Evolith CLI Architecture
2
+
3
+ ## Overview
4
+
5
+ The Evolith CLI is a NestJS-based command-line application that provides governance, standards validation, and tool selection capabilities for satellite repositories. It follows Clean Architecture principles with clear separation of concerns.
6
+
7
+ ## Architecture Layers
8
+
9
+ ```
10
+ src/
11
+ ├── commands/ # Presentation Layer (CLI commands)
12
+ ├── application/ # Application Layer (Use Cases)
13
+ ├── domain/ # Domain Layer (Entities, Services, Business Rules)
14
+ ├── infrastructure/ # Infrastructure Layer (External integrations)
15
+ └── core/ # Core Layer (Shared utilities, DI, abstractions)
16
+ ```
17
+
18
+ ### Presentation Layer (`commands/`)
19
+
20
+ Commands are the entry points that handle user interaction. Each command:
21
+ - Extends `CommandRunner` from nest-commander
22
+ - Uses `@clack/prompts` for interactive input
23
+ - Delegates business logic to application use cases
24
+ - Formats output for human or JSON consumption
25
+
26
+ **Commands:**
27
+ - `adr/` - ADR management (create, list, get, update, matrix)
28
+ - `standards/` - Standards management (init, list, get, validate, export)
29
+ - `validate/` - Repository validation against Evolith standards
30
+ - `handoff/` - Tool handoff between phases
31
+ - `init/` - Repository initialization
32
+
33
+ ### Application Layer (`application/use-cases/`)
34
+
35
+ Use cases orchestrate domain services to fulfill specific business operations:
36
+ - `ValidateSatelliteUseCase` - Validates satellite repository compliance
37
+ - `HandoffToolUseCase` - Manages tool handoff between phases
38
+
39
+ ### Domain Layer (`domain/`)
40
+
41
+ Domain services encapsulate business logic:
42
+ - `ADRService` - ADR CRUD operations and matrix generation
43
+ - `StandardsService` - Standards registration and validation
44
+ - `PhaseService` - Phase and tool selection logic
45
+ - `ToolSelectionService` - Runtime-aware tool selection
46
+ - `PlatformDetectionService` - Runtime environment detection
47
+
48
+ ### Infrastructure Layer (`infrastructure/`)
49
+
50
+ External integrations and platform-specific implementations:
51
+ - `cli/` - Command executor and prompt providers
52
+ - `catalog/` - JSON catalog loader for runtimes and tools
53
+ - `file-system/` - Node.js file system abstraction
54
+
55
+ ### Core Layer (`core/`)
56
+
57
+ Shared utilities and framework:
58
+ - `abstractions/` - Interfaces for dependency injection
59
+ - `interfaces/` - IFileSystem, ILogger, IConfigParser
60
+ - `providers/` - Node.js specific implementations
61
+ - `di/` - DIContainer for service registration and resolution
62
+ - `errors/` - EvolithError base class and error codes
63
+ - `observability/` - Structured logging, timing, error reporting
64
+
65
+ ## Dependency Injection
66
+
67
+ The `DIContainer` provides service location with singleton/transient scopes:
68
+
69
+ ```typescript
70
+ const container = getContainer();
71
+ container.registerSingleton('IService', () => new Service());
72
+ container.registerTransient('IFactory', () => new Factory());
73
+
74
+ const service = container.resolve('IService');
75
+ ```
76
+
77
+ ## Catalogs
78
+
79
+ Runtime and tool selection is driven by JSON catalogs:
80
+
81
+ - `config/runtimes.json` - Supported runtimes (nodejs, typescript, dotnet, python)
82
+ - `config/tool-catalog.json` - Tools grouped by phase (0-5)
83
+ - `config/cli-commands-matrix.json` - Command support matrix per runtime
84
+
85
+ ## Observability
86
+
87
+ AOP-based observability with:
88
+ - `StructuredLogger` - JSON structured logging with context
89
+ - `@Timed` decorator - Operation duration tracking
90
+ - `ErrorReporter` - Error aggregation with correlation IDs
91
+ - `CommandWatcher` - Command execution telemetry
92
+
93
+ ## Commands Pattern
94
+
95
+ All commands follow the same pattern:
96
+
97
+ 1. Parse options via `@Option` decorators
98
+ 2. Show intro with `p.intro()`
99
+ 3. Execute business logic via use cases
100
+ 4. Format and display results
101
+ 5. Show outro with status color (green/yellow/red)
102
+
103
+ ## Build and Test
104
+
105
+ ```bash
106
+ npm run build # Compile TypeScript
107
+ npm run test # Run Jest test suite
108
+ npm run lint # ESLint validation
109
+ npm run typecheck # TypeScript type checking
110
+ ```
111
+
112
+ ## Extending the CLI
113
+
114
+ To add a new command:
115
+
116
+ 1. Create `commands/<feature>/<feature>.command.ts`
117
+ 2. Implement `CommandRunner` interface
118
+ 3. Add use case in `application/use-cases/`
119
+ 4. Register any new domain services
120
+ 5. Add tests in `<feature>.command.spec.ts`
121
+ 6. Update catalogs if adding new tools/runtimes
package/README.es.md ADDED
@@ -0,0 +1,425 @@
1
+ # Evolith CLI
2
+
3
+ Interfaz de línea de comandos para gobernanza, validación de estándares e integración con agentes IA.
4
+
5
+ ## Características
6
+
7
+ - **Gobernanza**: Gestión de ADR, seguimiento de estándares, instalación de agentes
8
+ - **Validación**: Cumplimiento del repositorio contra los estándares de Evolith
9
+ - **Integración IA**: Servidor MCP para llamadas de herramientas de agentes IA
10
+ - **Observabilidad**: Logging estructurado, métricas, reporte de errores
11
+
12
+ ## Instalación
13
+
14
+ ### npm (Recomendado)
15
+
16
+ ```bash
17
+ npm install -g @evolith/smart-cli
18
+ ```
19
+
20
+ ### Manual
21
+
22
+ Descarga el binario más reciente desde [GitHub Releases](https://github.com/beyondnetcode/evolith_arch32/releases) y agrégalo a tu PATH.
23
+
24
+ ### Verificar Instalación
25
+
26
+ ```bash
27
+ smart-cli --version
28
+ # smart-cli version 0.0.1-beta
29
+ ```
30
+
31
+ ## Inicio Rápido
32
+
33
+ ### 1. Inicializar un Repositorio
34
+
35
+ ```bash
36
+ cd tu-proyecto
37
+ smart-cli init
38
+ ```
39
+
40
+ Esto crea un archivo `evolith.yaml` con la configuración por defecto.
41
+
42
+ ### 2. Ejecutar la Primera Validación
43
+
44
+ ```bash
45
+ smart-cli validate
46
+ ```
47
+
48
+ Salida:
49
+ ```
50
+ ✓ Validando repositorio...
51
+ ✓ El repositorio cumple con los estándares de Evolith
52
+ ```
53
+
54
+ ### 3. Instalar un Agente
55
+
56
+ ```bash
57
+ smart-cli agents install
58
+ # Seleccionar la plantilla "standard" cuando se solicite
59
+ ```
60
+
61
+ ## Comandos
62
+
63
+ ### validate
64
+
65
+ Valida el cumplimiento del repositorio contra los estándares de Evolith.
66
+
67
+ ```bash
68
+ smart-cli validate [opciones]
69
+
70
+ Opciones:
71
+ --satellite <ruta> Ruta al repositorio satélite (por defecto: cwd)
72
+ --core <ruta> Ruta a Evolith Core
73
+ --format <formato> Formato de salida: json, table, yaml, markdown
74
+ --output <archivo> Escribir salida a archivo
75
+ --ruleset <id> Validar ruleset específico (acl, open-core, inheritance)
76
+ ```
77
+
78
+ **Ejemplos:**
79
+
80
+ ```bash
81
+ # Validación básica
82
+ smart-cli validate
83
+
84
+ # Salida JSON para automatización
85
+ smart-cli validate --format json
86
+
87
+ # Salida en tabla para humanos
88
+ smart-cli validate --format table
89
+
90
+ # Validar ruleset específico
91
+ smart-cli validate --ruleset acl
92
+ ```
93
+
94
+ ### adr
95
+
96
+ Gestionar Registros de Decisiones de Arquitectura.
97
+
98
+ ```bash
99
+ smart-cli adr <comando>
100
+
101
+ Comandos:
102
+ create Crear nuevo ADR
103
+ list Listar todos los ADR
104
+ get Mostrar detalles del ADR
105
+ update Actualizar ADR existente
106
+ matrix Mostrar matriz de ADR
107
+ ```
108
+
109
+ **Ejemplos:**
110
+
111
+ ```bash
112
+ # Crear nuevo ADR
113
+ smart-cli adr create
114
+
115
+ # Listar todos los ADR
116
+ smart-cli adr list
117
+
118
+ # Obtener ADR específico
119
+ smart-cli adr get ADR-0002
120
+ ```
121
+
122
+ ### standards
123
+
124
+ Gestionar estándares de gobernanza.
125
+
126
+ ```bash
127
+ smart-cli standards <comando>
128
+
129
+ Comandos:
130
+ init Inicializar directorio de estándares
131
+ list Listar todos los estándares
132
+ get Mostrar detalles del estándar
133
+ validate Validar contra estándares
134
+ export Exportar estándar a markdown/json
135
+ ```
136
+
137
+ **Ejemplos:**
138
+
139
+ ```bash
140
+ # Inicializar estándares
141
+ smart-cli standards init
142
+
143
+ # Listar estándares
144
+ smart-cli standards list
145
+ ```
146
+
147
+ ### agents
148
+
149
+ Instalar y gestionar agentes de Evolith.
150
+
151
+ ```bash
152
+ smart-cli agents <comando>
153
+
154
+ Comandos:
155
+ install Instalar nuevo agente
156
+ list Listar agentes instalados
157
+ remove Eliminar agente
158
+ validate Validar ruleset del agente
159
+ upgrade Actualizar agente
160
+ ```
161
+
162
+ **Ejemplos:**
163
+
164
+ ```bash
165
+ # Instalación interactiva
166
+ smart-cli agents install
167
+
168
+ # Listar agentes
169
+ smart-cli agents list
170
+ ```
171
+
172
+ ### history
173
+
174
+ Ver y gestionar historial de comandos.
175
+
176
+ ```bash
177
+ smart-cli history [opciones]
178
+
179
+ Opciones:
180
+ --list Listar comandos recientes
181
+ --get <id> Mostrar detalles del comando
182
+ --search <consulta> Buscar comandos
183
+ --stats Mostrar estadísticas
184
+ --clear Limpiar historial
185
+ ```
186
+
187
+ **Ejemplos:**
188
+
189
+ ```bash
190
+ # Mostrar últimos 20 comandos
191
+ smart-cli history
192
+
193
+ # Mostrar estadísticas
194
+ smart-cli history --stats
195
+
196
+ # Buscar comandos
197
+ smart-cli history --search validate
198
+ ```
199
+
200
+ ### completion
201
+
202
+ Generar scripts de completado de shell.
203
+
204
+ ```bash
205
+ smart-cli completion --install <shell>
206
+
207
+ Shells soportados: bash, zsh, fish
208
+ ```
209
+
210
+ **Ejemplos:**
211
+
212
+ ```bash
213
+ # Instalar completado bash
214
+ smart-cli completion --install bash
215
+
216
+ # Instalar completado zsh
217
+ smart-cli completion --install zsh
218
+ ```
219
+
220
+ ## Servidor MCP (Integración con Agentes IA)
221
+
222
+ La CLI de Evolith incluye un servidor MCP para integración con agentes IA.
223
+
224
+ ### Iniciar el Servidor MCP
225
+
226
+ ```bash
227
+ smart-cli mcp serve
228
+ ```
229
+
230
+ El servidor se comunica vía stdio JSON-RPC.
231
+
232
+ También puedes iniciar en modo HTTP:
233
+
234
+ ```bash
235
+ smart-cli mcp serve --transport http --port 3000
236
+ ```
237
+
238
+ ### Herramientas MCP Disponibles
239
+
240
+ | Herramienta | Descripción |
241
+ |-------------|-------------|
242
+ | `evolith-validate` | Validar cumplimiento del repositorio |
243
+ | `evolith-agent-install` | Instalar nuevo agente |
244
+ | `evolith-agent-list` | Listar agentes instalados |
245
+ | `evolith-agent-validate` | Validar ruleset del agente |
246
+ | `evolith-architecture-validate` | Validar arquitectura |
247
+ | `evolith-sdlc-handoff` | Generar transición de fase |
248
+ | `evolith-sdlc-status` | Mostrar estado de fase SDLC |
249
+ | `evolith-config-get` | Obtener valor de configuración |
250
+ | `evolith-config-set` | Establecer valor de configuración |
251
+ | `evolith-metrics` | Obtener métricas del servidor MCP |
252
+
253
+ ### Configuración para Cursor AI
254
+
255
+ Agregar a `~/.cursor/mcp.json`:
256
+
257
+ ```json
258
+ {
259
+ "mcpServers": {
260
+ "evolith": {
261
+ "command": "smart-cli",
262
+ "args": ["mcp", "serve"]
263
+ }
264
+ }
265
+ }
266
+ ```
267
+
268
+ ### Configuración para Claude Desktop
269
+
270
+ Agregar a `~/Library/Application Support/Claude/claude_desktop_config.json`:
271
+
272
+ ```json
273
+ {
274
+ "mcpServers": {
275
+ "evolith": {
276
+ "command": "smart-cli",
277
+ "args": ["mcp", "serve"]
278
+ }
279
+ }
280
+ }
281
+ ```
282
+
283
+ ## Ejemplo de Flujo de Trabajo con Agente IA
284
+
285
+ Cuando está integrado con un agente IA, puedes tener conversaciones como:
286
+
287
+ ```
288
+ Tú: Valida mi repositorio
289
+ Agente: Déjame ejecutar la validación...
290
+
291
+ await mcp.callTool('evolith-validate', {
292
+ path: '/user/project',
293
+ format: 'summary'
294
+ })
295
+
296
+ Resultado: ✓ El repositorio cumple con los estándares de Evolith
297
+ Reglas verificadas: 12
298
+ Todas las puertas pasaron
299
+
300
+ Tú: Muéstrame los ADR
301
+ Agente: Déjame obtener la lista de ADR...
302
+
303
+ await mcp.callTool('evolith-adr-list', {})
304
+
305
+ Resultado: Se encontraron 5 ADR:
306
+ - ADR-0001: Plantilla de Registro de Decisión de Arquitectura
307
+ - ADR-0002: Arquitectura Hexagonal (aceptado)
308
+ - ADR-0003: Pirámide de Pruebas (aceptado)
309
+ ```
310
+
311
+ ## Configuración
312
+
313
+ Evolith usa un archivo `evolith.yaml` en la raíz del repositorio:
314
+
315
+ ```yaml
316
+ coreRef:
317
+ version: "1.0.0"
318
+ path: "../evolith"
319
+
320
+ governance:
321
+ version: "1.0"
322
+ adrRegistry:
323
+ - id: "ADR-0001"
324
+ status: "accepted"
325
+
326
+ product:
327
+ name: "mi-proyecto"
328
+ type: "library"
329
+ runtime: "typescript"
330
+ ```
331
+
332
+ ## Formatos de Salida
333
+
334
+ Todos los comandos soportan múltiples formatos de salida:
335
+
336
+ ```bash
337
+ # JSON (por defecto para automatización)
338
+ smart-cli validate --format json
339
+
340
+ # Tabla (legible para humanos)
341
+ smart-cli validate --format table
342
+
343
+ # YAML (integración en pipelines)
344
+ smart-cli validate --format yaml
345
+
346
+ # Markdown (documentación)
347
+ smart-cli validate --format markdown
348
+ ```
349
+
350
+ ## Solución de Problemas
351
+
352
+ ### Comando no encontrado
353
+
354
+ Si `evolith` no se encuentra después de la instalación, asegúrate de que el binario global de npm está en tu PATH:
355
+
356
+ ```bash
357
+ # Agregar a ~/.bashrc o ~/.zshrc
358
+ export PATH="$(npm config get prefix)/bin:$PATH"
359
+ ```
360
+
361
+ ### Servidor MCP no responde
362
+
363
+ Asegúrate de que el servidor MCP está corriendo:
364
+
365
+ ```bash
366
+ smart-cli mcp serve &
367
+ ```
368
+
369
+ ### La validación falla
370
+
371
+ Verifica que tu `evolith.yaml` existe y es válido:
372
+
373
+ ```bash
374
+ cat evolith.yaml
375
+ smart-cli validate --verbose
376
+ ```
377
+
378
+ ## Desarrollo
379
+
380
+ ### Construir desde el Código Fuente
381
+
382
+ ```bash
383
+ cd sdk/cli
384
+ npm install
385
+ npm run build
386
+ npm link # Enlazar globalmente para pruebas
387
+ ```
388
+
389
+ ### Ejecutar Pruebas
390
+
391
+ ```bash
392
+ npm test
393
+ ```
394
+
395
+ ### Estructura del Proyecto
396
+
397
+ ```
398
+ sdk/cli/
399
+ ├── src/
400
+ │ ├── commands/ # Comandos CLI (adr, validate, agents, etc.)
401
+ │ ├── application/ # Casos de uso
402
+ │ ├── domain/ # Lógica de negocio (servicios, entidades)
403
+ │ ├── infrastructure/# Integraciones externas (catálogo, CLI)
404
+ │ └── core/ # Compartido (DI, observabilidad, errores, MCP)
405
+ ├── shell/ # Scripts de completado de shell
406
+ ├── templates/ # Plantillas de configuración
407
+ └── docs/ # Documentación
408
+ ```
409
+
410
+ ## Contribuir
411
+
412
+ 1. Haz fork del repositorio
413
+ 2. Crea una rama de característica
414
+ 3. Haz cambios con pruebas
415
+ 4. Envía un pull request
416
+
417
+ ## Licencia
418
+
419
+ ISC
420
+
421
+ ## Soporte
422
+
423
+ - [Documentación](https://github.com/beyondnetcode/evolith_arch32#readme)
424
+ - [Rastreador de Incidencias](https://github.com/beyondnetcode/evolith_arch32/issues)
425
+ - [Discusiones](https://github.com/beyondnetcode/evolith_arch32/discussions)