@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,224 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const structured_logger_1 = require("./structured-logger");
4
+ const timing_1 = require("./timing");
5
+ const error_reporter_1 = require("./error-reporter");
6
+ describe('StructuredLogger', () => {
7
+ let testLogger;
8
+ beforeEach(() => {
9
+ testLogger = new structured_logger_1.StructuredLogger({ level: structured_logger_1.LogLevel.DEBUG });
10
+ });
11
+ afterEach(() => {
12
+ testLogger.clearBuffer();
13
+ });
14
+ describe('log levels', () => {
15
+ it('should log debug messages', () => {
16
+ testLogger.debug('debug message');
17
+ const buffer = testLogger.getBuffer();
18
+ expect(buffer).toHaveLength(1);
19
+ expect(buffer[0].level).toBe(structured_logger_1.LogLevel.DEBUG);
20
+ expect(buffer[0].message).toBe('debug message');
21
+ });
22
+ it('should log info messages', () => {
23
+ testLogger.info('info message');
24
+ const buffer = testLogger.getBuffer();
25
+ expect(buffer).toHaveLength(1);
26
+ expect(buffer[0].level).toBe(structured_logger_1.LogLevel.INFO);
27
+ });
28
+ it('should log warn messages', () => {
29
+ testLogger.warn('warn message');
30
+ const buffer = testLogger.getBuffer();
31
+ expect(buffer).toHaveLength(1);
32
+ expect(buffer[0].level).toBe(structured_logger_1.LogLevel.WARN);
33
+ });
34
+ it('should log error messages', () => {
35
+ testLogger.error('error message');
36
+ const buffer = testLogger.getBuffer();
37
+ expect(buffer).toHaveLength(1);
38
+ expect(buffer[0].level).toBe(structured_logger_1.LogLevel.ERROR);
39
+ });
40
+ it('should log fatal messages', () => {
41
+ testLogger.fatal('fatal message');
42
+ const buffer = testLogger.getBuffer();
43
+ expect(buffer).toHaveLength(1);
44
+ expect(buffer[0].level).toBe(structured_logger_1.LogLevel.FATAL);
45
+ });
46
+ it('should filter messages below configured level', () => {
47
+ const filteredLogger = new structured_logger_1.StructuredLogger({ level: structured_logger_1.LogLevel.ERROR });
48
+ filteredLogger.debug('debug message');
49
+ filteredLogger.info('info message');
50
+ filteredLogger.warn('warn message');
51
+ filteredLogger.error('error message');
52
+ const buffer = filteredLogger.getBuffer();
53
+ expect(buffer).toHaveLength(1);
54
+ expect(buffer[0].level).toBe(structured_logger_1.LogLevel.ERROR);
55
+ });
56
+ });
57
+ describe('context', () => {
58
+ it('should include context in log entry', () => {
59
+ testLogger.info('message with context', { key: 'value', number: 42 });
60
+ const buffer = testLogger.getBuffer();
61
+ expect(buffer[0].context).toEqual({ key: 'value', number: 42 });
62
+ });
63
+ it('should include operation in log entry', () => {
64
+ testLogger.startOperation('test-operation');
65
+ testLogger.info('inside operation');
66
+ const buffer = testLogger.getBuffer();
67
+ expect(buffer[1].operation).toBe('test-operation');
68
+ });
69
+ });
70
+ describe('startOperation/endOperation', () => {
71
+ it('should track operation stack', () => {
72
+ testLogger.startOperation('op1');
73
+ testLogger.startOperation('op2');
74
+ testLogger.endOperation('op2', 100);
75
+ testLogger.endOperation('op1', 200);
76
+ const buffer = testLogger.getBuffer();
77
+ expect(buffer).toHaveLength(4);
78
+ });
79
+ });
80
+ describe('getErrorCount', () => {
81
+ it('should count error and fatal messages', () => {
82
+ testLogger.error('error 1');
83
+ testLogger.error('error 2');
84
+ testLogger.fatal('fatal');
85
+ testLogger.info('info');
86
+ expect(testLogger.getErrorCount()).toBe(3);
87
+ });
88
+ });
89
+ describe('getWarningCount', () => {
90
+ it('should count warn messages', () => {
91
+ testLogger.warn('warn 1');
92
+ testLogger.warn('warn 2');
93
+ testLogger.error('error');
94
+ expect(testLogger.getWarningCount()).toBe(2);
95
+ });
96
+ });
97
+ });
98
+ describe('OperationTimer', () => {
99
+ it('should measure operation duration', async () => {
100
+ const timer = new timing_1.OperationTimer();
101
+ timer.start('test-operation');
102
+ await new Promise(resolve => setTimeout(resolve, 50));
103
+ const duration = timer.end();
104
+ expect(duration).toBeGreaterThanOrEqual(50);
105
+ expect(duration).toBeLessThan(200);
106
+ });
107
+ it('should get current duration without ending', () => {
108
+ const timer = new timing_1.OperationTimer();
109
+ timer.start('test-operation');
110
+ const currentDuration = timer.getDuration();
111
+ expect(currentDuration).toBeGreaterThanOrEqual(0);
112
+ timer.end();
113
+ });
114
+ });
115
+ describe('measureTime', () => {
116
+ it('should measure async operation duration', async () => {
117
+ const operation = async () => {
118
+ await new Promise(resolve => setTimeout(resolve, 30));
119
+ return 'result';
120
+ };
121
+ const { result, duration } = await (0, timing_1.measureTime)(operation, 'async-op');
122
+ expect(result).toBe('result');
123
+ expect(duration).toBeGreaterThanOrEqual(30);
124
+ });
125
+ it('should throw error if operation fails', async () => {
126
+ const failingOperation = async () => {
127
+ await new Promise(resolve => setTimeout(resolve, 10));
128
+ throw new Error('operation failed');
129
+ };
130
+ await expect((0, timing_1.measureTime)(failingOperation, 'failing-op')).rejects.toThrow('operation failed');
131
+ });
132
+ });
133
+ describe('measureTimeSync', () => {
134
+ it('should measure sync operation duration', () => {
135
+ const operation = () => {
136
+ return 'result';
137
+ };
138
+ const { result, duration } = (0, timing_1.measureTimeSync)(operation, 'sync-op');
139
+ expect(result).toBe('result');
140
+ expect(duration).toBeGreaterThanOrEqual(0);
141
+ });
142
+ });
143
+ describe('ErrorReporter', () => {
144
+ let reporter;
145
+ beforeEach(() => {
146
+ reporter = new error_reporter_1.ErrorReporter();
147
+ });
148
+ describe('report', () => {
149
+ it('should create error report for Error object', () => {
150
+ const error = new Error('test error');
151
+ const report = reporter.report(error, { operation: 'test-op' });
152
+ expect(report.id).toBeDefined();
153
+ expect(report.error.name).toBe('Error');
154
+ expect(report.error.message).toBe('test error');
155
+ expect(report.operation).toBe('test-op');
156
+ expect(report.context).toEqual({ operation: 'test-op' });
157
+ });
158
+ it('should create error report with any error object', () => {
159
+ const error = new Error('custom error message');
160
+ const report = reporter.report(error, { operation: 'test' });
161
+ expect(report.id).toBeDefined();
162
+ expect(report.error.message).toBe('custom error message');
163
+ });
164
+ it('should include duration if operation was started', () => {
165
+ reporter.startOperation('timed-op');
166
+ const error = new Error('test');
167
+ const report = reporter.report(error);
168
+ expect(report.durationMs).toBeDefined();
169
+ expect(report.durationMs).toBeGreaterThanOrEqual(0);
170
+ });
171
+ });
172
+ describe('getReports', () => {
173
+ it('should return all reports', () => {
174
+ reporter.report(new Error('error 1'));
175
+ reporter.report(new Error('error 2'));
176
+ const reports = reporter.getReports();
177
+ expect(reports).toHaveLength(2);
178
+ });
179
+ it('should return copy of reports array', () => {
180
+ reporter.report(new Error('error'));
181
+ const reports = reporter.getReports();
182
+ reports.push({});
183
+ expect(reporter.getReports()).toHaveLength(1);
184
+ });
185
+ });
186
+ describe('getLastReport', () => {
187
+ it('should return last report', () => {
188
+ reporter.report(new Error('first'));
189
+ reporter.report(new Error('second'));
190
+ const last = reporter.getLastReport();
191
+ expect(last?.error.message).toBe('second');
192
+ });
193
+ it('should return undefined if no reports', () => {
194
+ const last = reporter.getLastReport();
195
+ expect(last).toBeUndefined();
196
+ });
197
+ });
198
+ describe('clearReports', () => {
199
+ it('should clear all reports', () => {
200
+ reporter.report(new Error('error'));
201
+ reporter.clearReports();
202
+ expect(reporter.getReports()).toHaveLength(0);
203
+ });
204
+ });
205
+ describe('suggestions', () => {
206
+ it('should provide suggestion based on error message patterns', () => {
207
+ const error = new Error('npm not found in PATH');
208
+ const report = reporter.report(error);
209
+ expect(report.suggestion).toBeDefined();
210
+ expect(typeof report.suggestion).toBe('string');
211
+ });
212
+ it('should provide suggestion for ENOENT errors', () => {
213
+ const error = new Error('ENOENT: file not found');
214
+ const report = reporter.report(error);
215
+ expect(report.suggestion).toContain('not found');
216
+ });
217
+ it('should provide suggestion for EACCES errors', () => {
218
+ const error = new Error('EACCES: permission denied');
219
+ const report = reporter.report(error);
220
+ expect(report.suggestion).toContain('Permission');
221
+ });
222
+ });
223
+ });
224
+ //# sourceMappingURL=observability.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observability.test.js","sourceRoot":"","sources":["../../../src/core/observability/observability.test.ts"],"names":[],"mappings":";;AAAA,2DAAmF;AACnF,qCAAwE;AACxE,qDAA+D;AAE/D,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,UAA4B,CAAC;IAEjC,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG,IAAI,oCAAgB,CAAC,EAAE,KAAK,EAAE,4BAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,UAAU,CAAC,WAAW,EAAE,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,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAEtC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,53 @@
1
+ export declare enum LogLevel {
2
+ DEBUG = 0,
3
+ INFO = 1,
4
+ WARN = 2,
5
+ ERROR = 3,
6
+ FATAL = 4
7
+ }
8
+ export interface LogEntry {
9
+ timestamp: string;
10
+ level: LogLevel;
11
+ levelName: string;
12
+ message: string;
13
+ context?: Record<string, unknown>;
14
+ operation?: string;
15
+ duration?: number;
16
+ error?: LogError;
17
+ }
18
+ export interface LogError {
19
+ name: string;
20
+ message: string;
21
+ stack?: string;
22
+ code?: string;
23
+ }
24
+ export interface LoggerConfig {
25
+ level: LogLevel;
26
+ enableColors: boolean;
27
+ enableTimestamp: boolean;
28
+ enableContext: boolean;
29
+ output: 'console' | 'file' | 'both';
30
+ filePath?: string;
31
+ }
32
+ export declare class StructuredLogger {
33
+ private config;
34
+ private buffer;
35
+ private operationStack;
36
+ constructor(config?: Partial<LoggerConfig>);
37
+ debug(message: string, context?: Record<string, unknown>): void;
38
+ info(message: string, context?: Record<string, unknown>): void;
39
+ warn(message: string, context?: Record<string, unknown>): void;
40
+ error(message: string, context?: Record<string, unknown>): void;
41
+ fatal(message: string, context?: Record<string, unknown>): void;
42
+ private log;
43
+ private emit;
44
+ startOperation(name: string): void;
45
+ endOperation(name: string, duration: number): void;
46
+ getBuffer(): LogEntry[];
47
+ clearBuffer(): void;
48
+ setLevel(level: LogLevel): void;
49
+ getLastError(): LogError | undefined;
50
+ getErrorCount(): number;
51
+ getWarningCount(): number;
52
+ }
53
+ export declare const logger: StructuredLogger;
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logger = exports.StructuredLogger = exports.LogLevel = void 0;
4
+ var LogLevel;
5
+ (function (LogLevel) {
6
+ LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
7
+ LogLevel[LogLevel["INFO"] = 1] = "INFO";
8
+ LogLevel[LogLevel["WARN"] = 2] = "WARN";
9
+ LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
10
+ LogLevel[LogLevel["FATAL"] = 4] = "FATAL";
11
+ })(LogLevel || (exports.LogLevel = LogLevel = {}));
12
+ const defaultConfig = {
13
+ level: LogLevel.INFO,
14
+ enableColors: true,
15
+ enableTimestamp: true,
16
+ enableContext: true,
17
+ output: 'console',
18
+ };
19
+ class StructuredLogger {
20
+ constructor(config = {}) {
21
+ this.buffer = [];
22
+ this.operationStack = [];
23
+ this.config = { ...defaultConfig, ...config };
24
+ }
25
+ debug(message, context) {
26
+ this.log(LogLevel.DEBUG, message, context);
27
+ }
28
+ info(message, context) {
29
+ this.log(LogLevel.INFO, message, context);
30
+ }
31
+ warn(message, context) {
32
+ this.log(LogLevel.WARN, message, context);
33
+ }
34
+ error(message, context) {
35
+ this.log(LogLevel.ERROR, message, context);
36
+ }
37
+ fatal(message, context) {
38
+ this.log(LogLevel.FATAL, message, context);
39
+ }
40
+ log(level, message, context) {
41
+ if (level < this.config.level)
42
+ return;
43
+ const entry = {
44
+ timestamp: new Date().toISOString(),
45
+ level,
46
+ levelName: LogLevel[level],
47
+ message,
48
+ context,
49
+ operation: this.operationStack[this.operationStack.length - 1],
50
+ };
51
+ this.buffer.push(entry);
52
+ this.emit(entry);
53
+ }
54
+ emit(entry) {
55
+ const parts = [];
56
+ if (this.config.enableTimestamp) {
57
+ parts.push(`[${entry.timestamp}]`);
58
+ }
59
+ parts.push(`[${entry.levelName.padEnd(5)}]`);
60
+ if (entry.operation) {
61
+ parts.push(`{${entry.operation}}`);
62
+ }
63
+ parts.push(entry.message);
64
+ if (this.config.enableContext && entry.context) {
65
+ parts.push(JSON.stringify(entry.context));
66
+ }
67
+ if (entry.error) {
68
+ parts.push(`ERROR: ${entry.error.name}: ${entry.error.message}`);
69
+ if (entry.error.stack) {
70
+ parts.push(entry.error.stack);
71
+ }
72
+ }
73
+ const output = parts.join(' ');
74
+ switch (entry.level) {
75
+ case LogLevel.DEBUG:
76
+ console.debug(output);
77
+ break;
78
+ case LogLevel.INFO:
79
+ console.info(output);
80
+ break;
81
+ case LogLevel.WARN:
82
+ console.warn(output);
83
+ break;
84
+ case LogLevel.ERROR:
85
+ case LogLevel.FATAL:
86
+ console.error(output);
87
+ break;
88
+ }
89
+ }
90
+ startOperation(name) {
91
+ this.operationStack.push(name);
92
+ this.info(`Started: ${name}`, { operation: name, depth: this.operationStack.length });
93
+ }
94
+ endOperation(name, duration) {
95
+ const currentOp = this.operationStack.pop();
96
+ if (currentOp !== name) {
97
+ this.warn(`Operation mismatch: expected ${name}, got ${currentOp}`);
98
+ }
99
+ this.info(`Completed: ${name}`, { operation: name, durationMs: duration });
100
+ }
101
+ getBuffer() {
102
+ return [...this.buffer];
103
+ }
104
+ clearBuffer() {
105
+ this.buffer = [];
106
+ }
107
+ setLevel(level) {
108
+ this.config.level = level;
109
+ }
110
+ getLastError() {
111
+ const errorEntries = this.buffer.filter(e => e.level >= LogLevel.ERROR);
112
+ return errorEntries[errorEntries.length - 1]?.error;
113
+ }
114
+ getErrorCount() {
115
+ return this.buffer.filter(e => e.level >= LogLevel.ERROR).length;
116
+ }
117
+ getWarningCount() {
118
+ return this.buffer.filter(e => e.level === LogLevel.WARN).length;
119
+ }
120
+ }
121
+ exports.StructuredLogger = StructuredLogger;
122
+ exports.logger = new StructuredLogger({ level: LogLevel.INFO });
123
+ //# sourceMappingURL=structured-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-logger.js","sourceRoot":"","sources":["../../../src/core/observability/structured-logger.ts"],"names":[],"mappings":";;;AAAA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IAC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EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,SAAS;QACP,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,WAAW;QACT,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,KAAe;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED,YAAY;QACV,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;QACxE,OAAO,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC;IACtD,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;IACnE,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IACnE,CAAC;CACF;AA/HD,4CA+HC;AAEY,QAAA,MAAM,GAAG,IAAI,gBAAgB,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ export interface TimingResult {
2
+ duration: number;
3
+ success: boolean;
4
+ error?: Error;
5
+ }
6
+ export declare function Timed(operationName?: string): (target: unknown, propertyKey: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor;
7
+ export declare function TimedSync(operationName?: string): (target: unknown, propertyKey: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor;
8
+ export declare function measureTime<T>(operation: () => Promise<T>, operationName?: string): Promise<{
9
+ result: T;
10
+ duration: number;
11
+ }>;
12
+ export declare function measureTimeSync<T>(operation: () => T, operationName?: string): {
13
+ result: T;
14
+ duration: number;
15
+ };
16
+ export declare class OperationTimer {
17
+ private startTime;
18
+ private operationName;
19
+ start(operationName: string): void;
20
+ end(): number;
21
+ getDuration(): number;
22
+ }
23
+ export declare function profile<T extends (...args: unknown[]) => unknown>(fn: T, operationName?: string): T;
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OperationTimer = void 0;
4
+ exports.Timed = Timed;
5
+ exports.TimedSync = TimedSync;
6
+ exports.measureTime = measureTime;
7
+ exports.measureTimeSync = measureTimeSync;
8
+ exports.profile = profile;
9
+ const structured_logger_1 = require("./structured-logger");
10
+ function Timed(operationName) {
11
+ return function (target, propertyKey, descriptor) {
12
+ const originalMethod = descriptor.value;
13
+ descriptor.value = async function (...args) {
14
+ const opName = operationName || `${target.constructor.name}.${String(propertyKey)}`;
15
+ const startTime = performance.now();
16
+ structured_logger_1.logger.startOperation(opName);
17
+ try {
18
+ const result = await originalMethod.apply(this, args);
19
+ const duration = performance.now() - startTime;
20
+ structured_logger_1.logger.endOperation(opName, duration);
21
+ return result;
22
+ }
23
+ catch (error) {
24
+ const duration = performance.now() - startTime;
25
+ const err = error;
26
+ structured_logger_1.logger.error(`Operation failed: ${opName}`, {
27
+ durationMs: duration,
28
+ error: err.message,
29
+ stack: err.stack,
30
+ });
31
+ throw error;
32
+ }
33
+ };
34
+ return descriptor;
35
+ };
36
+ }
37
+ function TimedSync(operationName) {
38
+ return function (target, propertyKey, descriptor) {
39
+ const originalMethod = descriptor.value;
40
+ descriptor.value = function (...args) {
41
+ const opName = operationName || `${target.constructor.name}.${String(propertyKey)}`;
42
+ const startTime = performance.now();
43
+ structured_logger_1.logger.startOperation(opName);
44
+ try {
45
+ const result = originalMethod.apply(this, args);
46
+ const duration = performance.now() - startTime;
47
+ structured_logger_1.logger.endOperation(opName, duration);
48
+ return result;
49
+ }
50
+ catch (error) {
51
+ const duration = performance.now() - startTime;
52
+ const err = error;
53
+ structured_logger_1.logger.error(`Operation failed: ${opName}`, {
54
+ durationMs: duration,
55
+ error: err.message,
56
+ stack: err.stack,
57
+ });
58
+ throw error;
59
+ }
60
+ };
61
+ return descriptor;
62
+ };
63
+ }
64
+ async function measureTime(operation, operationName) {
65
+ const name = operationName || 'anonymous-operation';
66
+ const startTime = performance.now();
67
+ structured_logger_1.logger.startOperation(name);
68
+ try {
69
+ const result = await operation();
70
+ const duration = performance.now() - startTime;
71
+ structured_logger_1.logger.endOperation(name, duration);
72
+ return { result, duration };
73
+ }
74
+ catch (error) {
75
+ const duration = performance.now() - startTime;
76
+ const err = error;
77
+ structured_logger_1.logger.error(`Operation failed: ${name}`, {
78
+ durationMs: duration,
79
+ error: err.message,
80
+ });
81
+ throw error;
82
+ }
83
+ }
84
+ function measureTimeSync(operation, operationName) {
85
+ const name = operationName || 'anonymous-operation';
86
+ const startTime = performance.now();
87
+ structured_logger_1.logger.startOperation(name);
88
+ try {
89
+ const result = operation();
90
+ const duration = performance.now() - startTime;
91
+ structured_logger_1.logger.endOperation(name, duration);
92
+ return { result, duration };
93
+ }
94
+ catch (error) {
95
+ const duration = performance.now() - startTime;
96
+ const err = error;
97
+ structured_logger_1.logger.error(`Operation failed: ${name}`, {
98
+ durationMs: duration,
99
+ error: err.message,
100
+ });
101
+ throw error;
102
+ }
103
+ }
104
+ class OperationTimer {
105
+ constructor() {
106
+ this.startTime = 0;
107
+ this.operationName = '';
108
+ }
109
+ start(operationName) {
110
+ this.operationName = operationName;
111
+ this.startTime = performance.now();
112
+ structured_logger_1.logger.startOperation(operationName);
113
+ }
114
+ end() {
115
+ const duration = performance.now() - this.startTime;
116
+ structured_logger_1.logger.endOperation(this.operationName, duration);
117
+ return duration;
118
+ }
119
+ getDuration() {
120
+ return performance.now() - this.startTime;
121
+ }
122
+ }
123
+ exports.OperationTimer = OperationTimer;
124
+ function profile(fn, operationName) {
125
+ const name = operationName || fn.name;
126
+ return (async (...args) => {
127
+ const timer = new OperationTimer();
128
+ timer.start(name);
129
+ try {
130
+ const result = await fn(...args);
131
+ timer.end();
132
+ return result;
133
+ }
134
+ catch (error) {
135
+ timer.end();
136
+ throw error;
137
+ }
138
+ });
139
+ }
140
+ //# sourceMappingURL=timing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.js","sourceRoot":"","sources":["../../../src/core/observability/timing.ts"],"names":[],"mappings":";;;AAQA,sBAqCC;AAED,8BAqCC;AAED,kCA2BC;AAED,0CA2BC;AAuBD,0BAmBC;AAxLD,2DAA6C;AAQ7C,SAAgB,KAAK,CAAC,aAAsB;IAC1C,OAAO,UACL,MAAe,EACf,WAA4B,EAC5B,UAA8B;QAE9B,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,KAAK,WAAW,GAAG,IAAe;YACnD,MAAM,MAAM,GAAG,aAAa,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YACpF,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;YAEpC,0BAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAE9B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACtD,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;gBAE/C,0BAAM,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAEtC,OAAO,MAAM,CAAC;YAChB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;gBAC/C,MAAM,GAAG,GAA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AG,IAAe,EAAE,EAAE;QACnC,MAAM,KAAK,GAAG,IAAI,cAAc,EAAE,CAAC;QACnC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;YACjC,KAAK,CAAC,GAAG,EAAE,CAAC;YACZ,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,CAAC,GAAG,EAAE,CAAC;YACZ,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAM,CAAC;AACV,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { CommandExecutor, commandExecutor, CommandResult } from '../../infrastructure/cli/command-executor';
2
+ export { CommandWatcher, commandWatcher, CommandTrace, CommandBuilder } from '../../core/observability/command-watcher';
3
+ export type { PlatformCheck } from '../../domain/interfaces';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommandBuilder = exports.commandWatcher = exports.CommandWatcher = exports.CommandResult = exports.commandExecutor = exports.CommandExecutor = void 0;
4
+ var command_executor_1 = require("../../infrastructure/cli/command-executor");
5
+ Object.defineProperty(exports, "CommandExecutor", { enumerable: true, get: function () { return command_executor_1.CommandExecutor; } });
6
+ Object.defineProperty(exports, "commandExecutor", { enumerable: true, get: function () { return command_executor_1.commandExecutor; } });
7
+ Object.defineProperty(exports, "CommandResult", { enumerable: true, get: function () { return command_executor_1.CommandResult; } });
8
+ var command_watcher_1 = require("../../core/observability/command-watcher");
9
+ Object.defineProperty(exports, "CommandWatcher", { enumerable: true, get: function () { return command_watcher_1.CommandWatcher; } });
10
+ Object.defineProperty(exports, "commandWatcher", { enumerable: true, get: function () { return command_watcher_1.commandWatcher; } });
11
+ Object.defineProperty(exports, "CommandBuilder", { enumerable: true, get: function () { return command_watcher_1.CommandBuilder; } });
12
+ //# sourceMappingURL=command-executor.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-executor.service.js","sourceRoot":"","sources":["../../../src/core/services/command-executor.service.ts"],"names":[],"mappings":";;;AAAA,8EAA4G;AAAnG,mHAAA,eAAe,OAAA;AAAE,mHAAA,eAAe,OAAA;AAAE,iHAAA,aAAa,OAAA;AACxD,4EAAwH;AAA/G,iHAAA,cAAc,OAAA;AAAE,iHAAA,cAAc,OAAA;AAAgB,iHAAA,cAAc,OAAA"}
@@ -0,0 +1,38 @@
1
+ export interface HistoryEntry {
2
+ id: string;
3
+ timestamp: string;
4
+ command: string;
5
+ args: string[];
6
+ exitCode: number;
7
+ durationMs: number;
8
+ success: boolean;
9
+ }
10
+ export interface CommandHistory {
11
+ entries: HistoryEntry[];
12
+ lastUpdated: string;
13
+ }
14
+ export declare class CommandHistoryService {
15
+ private readonly historyFile;
16
+ private history;
17
+ private entryCounter;
18
+ constructor(repoPath?: string);
19
+ initialize(): Promise<void>;
20
+ record(command: string, args: string[], exitCode: number, durationMs: number): Promise<string>;
21
+ list(limit?: number, offset?: number): Promise<HistoryEntry[]>;
22
+ get(id: string): Promise<HistoryEntry | undefined>;
23
+ search(query: string): Promise<HistoryEntry[]>;
24
+ clear(): Promise<void>;
25
+ stats(): Promise<{
26
+ totalCommands: number;
27
+ successRate: string;
28
+ mostUsed: Array<{
29
+ command: string;
30
+ count: number;
31
+ }>;
32
+ recentCommands: number;
33
+ }>;
34
+ replay(id: string): Promise<{
35
+ command: string;
36
+ args: string[];
37
+ } | undefined>;
38
+ }