modestbench 0.0.1

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 (275) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/LICENSE.md +55 -0
  3. package/README.md +699 -0
  4. package/dist/bootstrap.cjs +37 -0
  5. package/dist/bootstrap.cjs.map +1 -0
  6. package/dist/bootstrap.d.cts +17 -0
  7. package/dist/bootstrap.d.cts.map +1 -0
  8. package/dist/bootstrap.d.ts +17 -0
  9. package/dist/bootstrap.d.ts.map +1 -0
  10. package/dist/bootstrap.js +33 -0
  11. package/dist/bootstrap.js.map +1 -0
  12. package/dist/cli/commands/history.cjs +459 -0
  13. package/dist/cli/commands/history.cjs.map +1 -0
  14. package/dist/cli/commands/history.d.cts +34 -0
  15. package/dist/cli/commands/history.d.cts.map +1 -0
  16. package/dist/cli/commands/history.d.ts +34 -0
  17. package/dist/cli/commands/history.d.ts.map +1 -0
  18. package/dist/cli/commands/history.js +422 -0
  19. package/dist/cli/commands/history.js.map +1 -0
  20. package/dist/cli/commands/init.cjs +566 -0
  21. package/dist/cli/commands/init.cjs.map +1 -0
  22. package/dist/cli/commands/init.d.cts +26 -0
  23. package/dist/cli/commands/init.d.cts.map +1 -0
  24. package/dist/cli/commands/init.d.ts +26 -0
  25. package/dist/cli/commands/init.d.ts.map +1 -0
  26. package/dist/cli/commands/init.js +562 -0
  27. package/dist/cli/commands/init.js.map +1 -0
  28. package/dist/cli/commands/run.cjs +285 -0
  29. package/dist/cli/commands/run.cjs.map +1 -0
  30. package/dist/cli/commands/run.d.cts +37 -0
  31. package/dist/cli/commands/run.d.cts.map +1 -0
  32. package/dist/cli/commands/run.d.ts +37 -0
  33. package/dist/cli/commands/run.d.ts.map +1 -0
  34. package/dist/cli/commands/run.js +248 -0
  35. package/dist/cli/commands/run.js.map +1 -0
  36. package/dist/cli/index.cjs +523 -0
  37. package/dist/cli/index.cjs.map +1 -0
  38. package/dist/cli/index.d.cts +58 -0
  39. package/dist/cli/index.d.cts.map +1 -0
  40. package/dist/cli/index.d.ts +58 -0
  41. package/dist/cli/index.d.ts.map +1 -0
  42. package/dist/cli/index.js +515 -0
  43. package/dist/cli/index.js.map +1 -0
  44. package/dist/config/manager.cjs +370 -0
  45. package/dist/config/manager.cjs.map +1 -0
  46. package/dist/config/manager.d.cts +46 -0
  47. package/dist/config/manager.d.cts.map +1 -0
  48. package/dist/config/manager.d.ts +46 -0
  49. package/dist/config/manager.d.ts.map +1 -0
  50. package/dist/config/manager.js +333 -0
  51. package/dist/config/manager.js.map +1 -0
  52. package/dist/config/schema.cjs +182 -0
  53. package/dist/config/schema.cjs.map +1 -0
  54. package/dist/config/schema.d.cts +51 -0
  55. package/dist/config/schema.d.cts.map +1 -0
  56. package/dist/config/schema.d.ts +51 -0
  57. package/dist/config/schema.d.ts.map +1 -0
  58. package/dist/config/schema.js +145 -0
  59. package/dist/config/schema.js.map +1 -0
  60. package/dist/constants.cjs +22 -0
  61. package/dist/constants.cjs.map +1 -0
  62. package/dist/constants.d.cts +10 -0
  63. package/dist/constants.d.cts.map +1 -0
  64. package/dist/constants.d.ts +10 -0
  65. package/dist/constants.d.ts.map +1 -0
  66. package/dist/constants.js +19 -0
  67. package/dist/constants.js.map +1 -0
  68. package/dist/core/benchmark-schema.cjs +135 -0
  69. package/dist/core/benchmark-schema.cjs.map +1 -0
  70. package/dist/core/benchmark-schema.d.cts +139 -0
  71. package/dist/core/benchmark-schema.d.cts.map +1 -0
  72. package/dist/core/benchmark-schema.d.ts +139 -0
  73. package/dist/core/benchmark-schema.d.ts.map +1 -0
  74. package/dist/core/benchmark-schema.js +132 -0
  75. package/dist/core/benchmark-schema.js.map +1 -0
  76. package/dist/core/engine.cjs +669 -0
  77. package/dist/core/engine.cjs.map +1 -0
  78. package/dist/core/engine.d.cts +128 -0
  79. package/dist/core/engine.d.cts.map +1 -0
  80. package/dist/core/engine.d.ts +128 -0
  81. package/dist/core/engine.d.ts.map +1 -0
  82. package/dist/core/engine.js +632 -0
  83. package/dist/core/engine.js.map +1 -0
  84. package/dist/core/engines/accurate-engine.cjs +292 -0
  85. package/dist/core/engines/accurate-engine.cjs.map +1 -0
  86. package/dist/core/engines/accurate-engine.d.cts +63 -0
  87. package/dist/core/engines/accurate-engine.d.cts.map +1 -0
  88. package/dist/core/engines/accurate-engine.d.ts +63 -0
  89. package/dist/core/engines/accurate-engine.d.ts.map +1 -0
  90. package/dist/core/engines/accurate-engine.js +288 -0
  91. package/dist/core/engines/accurate-engine.js.map +1 -0
  92. package/dist/core/engines/index.cjs +21 -0
  93. package/dist/core/engines/index.cjs.map +1 -0
  94. package/dist/core/engines/index.d.cts +16 -0
  95. package/dist/core/engines/index.d.cts.map +1 -0
  96. package/dist/core/engines/index.d.ts +16 -0
  97. package/dist/core/engines/index.d.ts.map +1 -0
  98. package/dist/core/engines/index.js +16 -0
  99. package/dist/core/engines/index.js.map +1 -0
  100. package/dist/core/engines/tinybench-engine.cjs +286 -0
  101. package/dist/core/engines/tinybench-engine.cjs.map +1 -0
  102. package/dist/core/engines/tinybench-engine.d.cts +18 -0
  103. package/dist/core/engines/tinybench-engine.d.cts.map +1 -0
  104. package/dist/core/engines/tinybench-engine.d.ts +18 -0
  105. package/dist/core/engines/tinybench-engine.d.ts.map +1 -0
  106. package/dist/core/engines/tinybench-engine.js +282 -0
  107. package/dist/core/engines/tinybench-engine.js.map +1 -0
  108. package/dist/core/error-manager.cjs +303 -0
  109. package/dist/core/error-manager.cjs.map +1 -0
  110. package/dist/core/error-manager.d.cts +77 -0
  111. package/dist/core/error-manager.d.cts.map +1 -0
  112. package/dist/core/error-manager.d.ts +77 -0
  113. package/dist/core/error-manager.d.ts.map +1 -0
  114. package/dist/core/error-manager.js +299 -0
  115. package/dist/core/error-manager.js.map +1 -0
  116. package/dist/core/loader.cjs +287 -0
  117. package/dist/core/loader.cjs.map +1 -0
  118. package/dist/core/loader.d.cts +55 -0
  119. package/dist/core/loader.d.cts.map +1 -0
  120. package/dist/core/loader.d.ts +55 -0
  121. package/dist/core/loader.d.ts.map +1 -0
  122. package/dist/core/loader.js +250 -0
  123. package/dist/core/loader.js.map +1 -0
  124. package/dist/core/stats-utils.cjs +99 -0
  125. package/dist/core/stats-utils.cjs.map +1 -0
  126. package/dist/core/stats-utils.d.cts +50 -0
  127. package/dist/core/stats-utils.d.cts.map +1 -0
  128. package/dist/core/stats-utils.d.ts +50 -0
  129. package/dist/core/stats-utils.d.ts.map +1 -0
  130. package/dist/core/stats-utils.js +94 -0
  131. package/dist/core/stats-utils.js.map +1 -0
  132. package/dist/index.cjs +64 -0
  133. package/dist/index.cjs.map +1 -0
  134. package/dist/index.d.cts +22 -0
  135. package/dist/index.d.cts.map +1 -0
  136. package/dist/index.d.ts +22 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +30 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/progress/manager.cjs +325 -0
  141. package/dist/progress/manager.cjs.map +1 -0
  142. package/dist/progress/manager.d.cts +125 -0
  143. package/dist/progress/manager.d.cts.map +1 -0
  144. package/dist/progress/manager.d.ts +125 -0
  145. package/dist/progress/manager.d.ts.map +1 -0
  146. package/dist/progress/manager.js +321 -0
  147. package/dist/progress/manager.js.map +1 -0
  148. package/dist/reporters/csv.cjs +250 -0
  149. package/dist/reporters/csv.cjs.map +1 -0
  150. package/dist/reporters/csv.d.cts +92 -0
  151. package/dist/reporters/csv.d.cts.map +1 -0
  152. package/dist/reporters/csv.d.ts +92 -0
  153. package/dist/reporters/csv.d.ts.map +1 -0
  154. package/dist/reporters/csv.js +246 -0
  155. package/dist/reporters/csv.js.map +1 -0
  156. package/dist/reporters/human.cjs +516 -0
  157. package/dist/reporters/human.cjs.map +1 -0
  158. package/dist/reporters/human.d.cts +86 -0
  159. package/dist/reporters/human.d.cts.map +1 -0
  160. package/dist/reporters/human.d.ts +86 -0
  161. package/dist/reporters/human.d.ts.map +1 -0
  162. package/dist/reporters/human.js +509 -0
  163. package/dist/reporters/human.js.map +1 -0
  164. package/dist/reporters/index.cjs +17 -0
  165. package/dist/reporters/index.cjs.map +1 -0
  166. package/dist/reporters/index.d.cts +10 -0
  167. package/dist/reporters/index.d.cts.map +1 -0
  168. package/dist/reporters/index.d.ts +10 -0
  169. package/dist/reporters/index.d.ts.map +1 -0
  170. package/dist/reporters/index.js +10 -0
  171. package/dist/reporters/index.js.map +1 -0
  172. package/dist/reporters/json.cjs +215 -0
  173. package/dist/reporters/json.cjs.map +1 -0
  174. package/dist/reporters/json.d.cts +79 -0
  175. package/dist/reporters/json.d.cts.map +1 -0
  176. package/dist/reporters/json.d.ts +79 -0
  177. package/dist/reporters/json.d.ts.map +1 -0
  178. package/dist/reporters/json.js +211 -0
  179. package/dist/reporters/json.js.map +1 -0
  180. package/dist/reporters/registry.cjs +255 -0
  181. package/dist/reporters/registry.cjs.map +1 -0
  182. package/dist/reporters/registry.d.cts +155 -0
  183. package/dist/reporters/registry.d.cts.map +1 -0
  184. package/dist/reporters/registry.d.ts +155 -0
  185. package/dist/reporters/registry.d.ts.map +1 -0
  186. package/dist/reporters/registry.js +249 -0
  187. package/dist/reporters/registry.js.map +1 -0
  188. package/dist/reporters/simple.cjs +328 -0
  189. package/dist/reporters/simple.cjs.map +1 -0
  190. package/dist/reporters/simple.d.cts +51 -0
  191. package/dist/reporters/simple.d.cts.map +1 -0
  192. package/dist/reporters/simple.d.ts +51 -0
  193. package/dist/reporters/simple.d.ts.map +1 -0
  194. package/dist/reporters/simple.js +321 -0
  195. package/dist/reporters/simple.js.map +1 -0
  196. package/dist/schema/modestbench-config.schema.json +162 -0
  197. package/dist/storage/history.cjs +456 -0
  198. package/dist/storage/history.cjs.map +1 -0
  199. package/dist/storage/history.d.cts +99 -0
  200. package/dist/storage/history.d.cts.map +1 -0
  201. package/dist/storage/history.d.ts +99 -0
  202. package/dist/storage/history.d.ts.map +1 -0
  203. package/dist/storage/history.js +452 -0
  204. package/dist/storage/history.js.map +1 -0
  205. package/dist/types/cli.cjs +21 -0
  206. package/dist/types/cli.cjs.map +1 -0
  207. package/dist/types/cli.d.cts +296 -0
  208. package/dist/types/cli.d.cts.map +1 -0
  209. package/dist/types/cli.d.ts +296 -0
  210. package/dist/types/cli.d.ts.map +1 -0
  211. package/dist/types/cli.js +18 -0
  212. package/dist/types/cli.js.map +1 -0
  213. package/dist/types/core.cjs +14 -0
  214. package/dist/types/core.cjs.map +1 -0
  215. package/dist/types/core.d.cts +380 -0
  216. package/dist/types/core.d.cts.map +1 -0
  217. package/dist/types/core.d.ts +380 -0
  218. package/dist/types/core.d.ts.map +1 -0
  219. package/dist/types/core.js +13 -0
  220. package/dist/types/core.js.map +1 -0
  221. package/dist/types/index.cjs +27 -0
  222. package/dist/types/index.cjs.map +1 -0
  223. package/dist/types/index.d.cts +11 -0
  224. package/dist/types/index.d.cts.map +1 -0
  225. package/dist/types/index.d.ts +11 -0
  226. package/dist/types/index.d.ts.map +1 -0
  227. package/dist/types/index.js +11 -0
  228. package/dist/types/index.js.map +1 -0
  229. package/dist/types/interfaces.cjs +10 -0
  230. package/dist/types/interfaces.cjs.map +1 -0
  231. package/dist/types/interfaces.d.cts +381 -0
  232. package/dist/types/interfaces.d.cts.map +1 -0
  233. package/dist/types/interfaces.d.ts +381 -0
  234. package/dist/types/interfaces.d.ts.map +1 -0
  235. package/dist/types/interfaces.js +9 -0
  236. package/dist/types/interfaces.js.map +1 -0
  237. package/dist/types/utility.cjs +92 -0
  238. package/dist/types/utility.cjs.map +1 -0
  239. package/dist/types/utility.d.cts +330 -0
  240. package/dist/types/utility.d.cts.map +1 -0
  241. package/dist/types/utility.d.ts +330 -0
  242. package/dist/types/utility.d.ts.map +1 -0
  243. package/dist/types/utility.js +78 -0
  244. package/dist/types/utility.js.map +1 -0
  245. package/package.json +211 -0
  246. package/src/bootstrap.ts +35 -0
  247. package/src/cli/commands/history.ts +569 -0
  248. package/src/cli/commands/init.ts +658 -0
  249. package/src/cli/commands/run.ts +346 -0
  250. package/src/cli/index.ts +642 -0
  251. package/src/config/manager.ts +387 -0
  252. package/src/config/schema.ts +188 -0
  253. package/src/constants.ts +21 -0
  254. package/src/core/benchmark-schema.ts +185 -0
  255. package/src/core/engine.ts +888 -0
  256. package/src/core/engines/accurate-engine.ts +408 -0
  257. package/src/core/engines/index.ts +16 -0
  258. package/src/core/engines/tinybench-engine.ts +335 -0
  259. package/src/core/error-manager.ts +372 -0
  260. package/src/core/loader.ts +324 -0
  261. package/src/core/stats-utils.ts +135 -0
  262. package/src/index.ts +46 -0
  263. package/src/progress/manager.ts +415 -0
  264. package/src/reporters/csv.ts +368 -0
  265. package/src/reporters/human.ts +707 -0
  266. package/src/reporters/index.ts +10 -0
  267. package/src/reporters/json.ts +302 -0
  268. package/src/reporters/registry.ts +349 -0
  269. package/src/reporters/simple.ts +459 -0
  270. package/src/storage/history.ts +600 -0
  271. package/src/types/cli.ts +312 -0
  272. package/src/types/core.ts +414 -0
  273. package/src/types/index.ts +18 -0
  274. package/src/types/interfaces.ts +451 -0
  275. package/src/types/utility.ts +446 -0
@@ -0,0 +1,451 @@
1
+ /**
2
+ * ModestBench Interface Types
3
+ *
4
+ * Defines the contract interfaces for all major components in the ModestBench
5
+ * system. These interfaces establish the public APIs that implementations must
6
+ * satisfy.
7
+ */
8
+
9
+ import type {
10
+ BenchmarkFile,
11
+ BenchmarkRun,
12
+ ErrorContext,
13
+ ErrorStats,
14
+ ExecutionError,
15
+ FileResult,
16
+ ModestBenchConfig,
17
+ SuiteResult,
18
+ TaskResult,
19
+ } from './core.js';
20
+
21
+ /**
22
+ * Main benchmark engine interface
23
+ */
24
+ export interface BenchmarkEngine {
25
+ /**
26
+ * Discover benchmark files matching patterns
27
+ */
28
+ discover(pattern: string | string[], exclude?: string[]): Promise<string[]>;
29
+
30
+ /**
31
+ * Execute benchmarks with the given configuration
32
+ */
33
+ execute(
34
+ config: RunConfiguration,
35
+ reporters?: Reporter[],
36
+ signal?: AbortSignal,
37
+ ): Promise<BenchmarkRun>;
38
+
39
+ /**
40
+ * Get all registered reporters
41
+ */
42
+ getReporters(): Record<string, Reporter>;
43
+
44
+ /**
45
+ * Register a reporter for benchmark output
46
+ */
47
+ registerReporter(name: string, reporter: Reporter): void;
48
+
49
+ /**
50
+ * Validate benchmark files
51
+ */
52
+ validate(files: string[]): Promise<ValidationResult>;
53
+ }
54
+
55
+ /**
56
+ * Result of a cleanup operation
57
+ */
58
+ export interface CleanupResult {
59
+ /** Amount of disk space freed in bytes */
60
+ readonly freedBytes: number;
61
+ /** Files that were removed */
62
+ readonly removedFiles: string[];
63
+ /** Number of runs removed */
64
+ readonly removedRuns: number;
65
+ }
66
+
67
+ /**
68
+ * Configuration management interface
69
+ */
70
+ export interface ConfigurationManager {
71
+ /**
72
+ * Get default configuration values
73
+ */
74
+ getDefaults(): ModestBenchConfig;
75
+
76
+ /**
77
+ * Load configuration from various sources
78
+ */
79
+ load(
80
+ configPath?: string,
81
+ cliArgs?: Record<string, unknown>,
82
+ ): Promise<ModestBenchConfig>;
83
+
84
+ /**
85
+ * Merge multiple configuration objects with precedence
86
+ */
87
+ merge(...configs: Partial<ModestBenchConfig>[]): ModestBenchConfig;
88
+
89
+ /**
90
+ * Validate a configuration object
91
+ */
92
+ validate(config: Partial<ModestBenchConfig>): ValidationResult;
93
+ }
94
+
95
+ /**
96
+ * CSV output reporter interface
97
+ */
98
+ export interface CsvReporter extends Reporter {
99
+ /** CSV delimiter character */
100
+ readonly delimiter: string;
101
+ /** Include CSV headers */
102
+ readonly includeHeaders: boolean;
103
+ }
104
+
105
+ /**
106
+ * Error management interface for handling execution errors
107
+ */
108
+ export interface ErrorManager {
109
+ /**
110
+ * Clear error history
111
+ */
112
+ clearStats(): void;
113
+
114
+ /**
115
+ * Format error for display
116
+ */
117
+ formatError(error: ExecutionError): string;
118
+
119
+ /**
120
+ * Get error code for a given error
121
+ */
122
+ getErrorCode(error: Error, context: ErrorContext): string;
123
+
124
+ /**
125
+ * Get error statistics
126
+ */
127
+ getStats(): ErrorStats;
128
+
129
+ /**
130
+ * Handle an execution error
131
+ */
132
+ handleError(error: Error, context: ErrorContext): ExecutionError;
133
+
134
+ /**
135
+ * Check if an error is recoverable
136
+ */
137
+ isRecoverable(error: ExecutionError): boolean;
138
+
139
+ /**
140
+ * Register error handler callback
141
+ */
142
+ onError(handler: (error: ExecutionError) => void): void;
143
+ }
144
+
145
+ /**
146
+ * File loader interface for benchmark discovery and loading
147
+ */
148
+ export interface FileLoader {
149
+ /**
150
+ * Discover benchmark files matching patterns
151
+ */
152
+ discover(pattern: string | string[], exclude?: string[]): Promise<string[]>;
153
+
154
+ /**
155
+ * Load a benchmark file
156
+ */
157
+ load(filePath: string): Promise<BenchmarkFile>;
158
+
159
+ /**
160
+ * Validate a benchmark file
161
+ */
162
+ validate(filePath: string): Promise<ValidationResult>;
163
+ }
164
+
165
+ /**
166
+ * Query interface for historical benchmark data
167
+ */
168
+ export interface HistoryQuery {
169
+ /** Maximum number of results */
170
+ readonly limit?: number;
171
+ /** Results offset for pagination */
172
+ readonly offset?: number;
173
+ /** Pattern to match benchmark names */
174
+ readonly pattern?: string;
175
+ /** Start date for filtering */
176
+ readonly since?: Date;
177
+ /** Sort order */
178
+ readonly sort?: 'asc' | 'desc';
179
+ /** Field to sort by */
180
+ readonly sortBy?: 'date' | 'duration' | 'name';
181
+ /** Tags to filter by */
182
+ readonly tags?: string[];
183
+ /** End date for filtering */
184
+ readonly until?: Date;
185
+ }
186
+
187
+ /**
188
+ * Historical data storage interface
189
+ */
190
+ export interface HistoryStorage {
191
+ /**
192
+ * Clean up old data according to retention policy
193
+ */
194
+ cleanup(policy: RetentionPolicy): Promise<CleanupResult>;
195
+
196
+ /**
197
+ * Export historical data
198
+ */
199
+ export(format: 'csv' | 'json', query?: HistoryQuery): Promise<string>;
200
+
201
+ /**
202
+ * Get index of all stored runs
203
+ */
204
+ getIndex(): Promise<Array<{ date: Date; id: string; summary: string }>>;
205
+
206
+ /**
207
+ * Load a specific benchmark run
208
+ */
209
+ loadRun(id: string): Promise<BenchmarkRun | null>;
210
+
211
+ /**
212
+ * Query historical runs
213
+ */
214
+ queryRuns(query: HistoryQuery): Promise<BenchmarkRun[]>;
215
+
216
+ /**
217
+ * Save a benchmark run to storage
218
+ */
219
+ saveRun(run: BenchmarkRun): Promise<void>;
220
+ }
221
+
222
+ /**
223
+ * Human-readable reporter interface
224
+ */
225
+ export interface HumanReporter extends Reporter {
226
+ /** Displays progress bars */
227
+ readonly showProgress: boolean;
228
+ /** Uses colors and formatting for terminal output */
229
+ readonly supportsColor: boolean;
230
+ }
231
+
232
+ /**
233
+ * JSON output reporter interface
234
+ */
235
+ export interface JsonReporter extends Reporter {
236
+ /** Pretty-print JSON output */
237
+ readonly prettyPrint: boolean;
238
+ /** Supports streaming output */
239
+ readonly streaming: boolean;
240
+ }
241
+
242
+ /**
243
+ * Progress management interface
244
+ */
245
+ export interface ProgressManager {
246
+ /**
247
+ * Clean up progress tracking resources
248
+ */
249
+ cleanup(): void;
250
+
251
+ /**
252
+ * Estimate completion time
253
+ */
254
+ estimateCompletion(): Date | null;
255
+
256
+ /**
257
+ * Force an immediate progress update (bypassing throttling)
258
+ */
259
+ forceUpdate(): void;
260
+
261
+ /**
262
+ * Get current progress state
263
+ */
264
+ getState(): ProgressState;
265
+
266
+ /**
267
+ * Initialize progress tracking for a benchmark run
268
+ */
269
+ initialize(run: BenchmarkRun): void;
270
+
271
+ /**
272
+ * Register a callback for progress updates
273
+ */
274
+ onProgress(callback: (state: ProgressState) => void): void;
275
+
276
+ /**
277
+ * Update progress state
278
+ */
279
+ update(state: Partial<ProgressState>): void;
280
+ }
281
+
282
+ /**
283
+ * Progress tracking state
284
+ */
285
+ export interface ProgressState {
286
+ /** Current file being processed */
287
+ readonly currentFile?: string;
288
+ /** Current suite being processed */
289
+ readonly currentSuite?: string;
290
+ /** Current task being processed */
291
+ readonly currentTask?: string;
292
+ /** Elapsed time in milliseconds */
293
+ readonly elapsed: number;
294
+ /** Number of files completed */
295
+ readonly filesCompleted: number;
296
+ /** Progress percentage (0-100) */
297
+ readonly percentage: number;
298
+ /** Number of suites completed */
299
+ readonly suitesCompleted: number;
300
+ /** Number of tasks completed */
301
+ readonly tasksCompleted: number;
302
+ /** Total number of files */
303
+ readonly totalFiles: number;
304
+ /** Total number of suites */
305
+ readonly totalSuites: number;
306
+ /** Total number of tasks */
307
+ readonly totalTasks: number;
308
+ }
309
+
310
+ /**
311
+ * Base reporter interface for benchmark output
312
+ */
313
+ export interface Reporter {
314
+ /**
315
+ * Called when benchmark run completes
316
+ */
317
+ onEnd(run: BenchmarkRun): Promise<void> | void;
318
+
319
+ /**
320
+ * Called when an error occurs
321
+ */
322
+ onError(error: Error): Promise<void> | void;
323
+
324
+ /**
325
+ * Called when a file completes
326
+ */
327
+ onFileEnd(result: FileResult): Promise<void> | void;
328
+
329
+ /**
330
+ * Called when a file starts execution
331
+ */
332
+ onFileStart(file: string): Promise<void> | void;
333
+
334
+ /**
335
+ * Called for progress updates
336
+ */
337
+ onProgress(state: ProgressState): Promise<void> | void;
338
+
339
+ /**
340
+ * Called when benchmark run starts
341
+ */
342
+ onStart(run: BenchmarkRun): Promise<void> | void;
343
+
344
+ /**
345
+ * Called when a suite completes
346
+ */
347
+ onSuiteEnd(result: SuiteResult): Promise<void> | void;
348
+
349
+ /**
350
+ * Called when a suite starts execution
351
+ */
352
+ onSuiteStart(suite: string): Promise<void> | void;
353
+
354
+ /**
355
+ * Called when a task completes
356
+ */
357
+ onTaskResult(result: TaskResult): Promise<void> | void;
358
+
359
+ /**
360
+ * Called when a task starts execution
361
+ */
362
+ onTaskStart(task: string): Promise<void> | void;
363
+ }
364
+
365
+ /**
366
+ * Reporter registry interface
367
+ */
368
+ export interface ReporterRegistry {
369
+ /**
370
+ * Get a reporter by name
371
+ */
372
+ get(name: string): Reporter | undefined;
373
+
374
+ /**
375
+ * Get all registered reporters
376
+ */
377
+ getAll(): Record<string, Reporter>;
378
+
379
+ /**
380
+ * Get reporters by multiple names
381
+ */
382
+ getByNames(names: string[]): Reporter[];
383
+
384
+ /**
385
+ * Register a reporter
386
+ */
387
+ register(name: string, reporter: Reporter): void;
388
+ }
389
+
390
+ /**
391
+ * Retention policy for historical data
392
+ */
393
+ export interface RetentionPolicy {
394
+ /** Maximum age of data to keep */
395
+ readonly maxAge?: number;
396
+ /** Maximum number of runs to keep */
397
+ readonly maxRuns?: number;
398
+ /** Maximum size of history data in bytes */
399
+ readonly maxSize?: number;
400
+ }
401
+
402
+ /**
403
+ * Configuration for a benchmark run execution
404
+ */
405
+ export interface RunConfiguration extends Partial<ModestBenchConfig> {
406
+ /** Working directory for execution */
407
+ readonly cwd?: string;
408
+ /** Environment variables to set */
409
+ readonly env?: Record<string, string>;
410
+ /** Files to execute (overrides pattern discovery) */
411
+ readonly files?: string[];
412
+ }
413
+
414
+ /**
415
+ * A validation error
416
+ */
417
+ export interface ValidationError {
418
+ /** Error code for programmatic handling */
419
+ readonly code: string;
420
+ /** Column number where error occurred */
421
+ readonly column?: number;
422
+ /** File where error occurred */
423
+ readonly file: string;
424
+ /** Line number where error occurred */
425
+ readonly line?: number;
426
+ /** Error message */
427
+ readonly message: string;
428
+ /** Severity level */
429
+ readonly severity: 'error' | 'warning';
430
+ }
431
+
432
+ /**
433
+ * Result of a validation operation
434
+ */
435
+ export interface ValidationResult {
436
+ /** Validation errors found */
437
+ readonly errors: ValidationError[];
438
+ /** Files that were validated */
439
+ readonly files: string[];
440
+ /** Whether validation passed */
441
+ readonly valid: boolean;
442
+ /** Validation warnings */
443
+ readonly warnings: ValidationWarning[];
444
+ }
445
+
446
+ /**
447
+ * A validation warning
448
+ */
449
+ export interface ValidationWarning extends ValidationError {
450
+ readonly severity: 'warning';
451
+ }