1+ import type { z } from 'zod' ;
2+
3+ import type {
4+ jsonReporterConfigSchema ,
5+ ModestBenchConfig ,
6+ reporterConfigSchema ,
7+ } from '../config/schema.js' ;
18// Budget-related types
29import type {
310 AbsoluteBudget ,
@@ -13,30 +20,6 @@ import type {
1320 TaskId ,
1421} from './budgets.js' ;
1522
16- export type {
17- AbsoluteBudget ,
18- BaselineReference ,
19- BaselineStorage ,
20- BaselineSummaryData ,
21- Budget ,
22- BudgetResult ,
23- BudgetSummary ,
24- BudgetViolation ,
25- RelativeBudget ,
26- RunId ,
27- TaskId ,
28- } ;
29-
30- // Re-export schema-derived types
31- export type {
32- BenchmarkDefinition ,
33- BenchmarkDefinitionInput ,
34- BenchmarkSuite ,
35- BenchmarkSuiteInput ,
36- BenchmarkTask ,
37- BenchmarkTaskInput ,
38- } from '../core/benchmark-schema.js' ;
39-
4023/**
4124 * Benchmark file structure after parsing
4225 */
@@ -51,21 +34,6 @@ export interface BenchmarkFile {
5134 readonly metadata : FileMetadata ;
5235}
5336
54- /**
55- * ModestBench Core Types
56- *
57- * Defines the fundamental data structures used throughout the ModestBench
58- * system. These types represent benchmark results, metadata, configuration, and
59- * system state.
60- *
61- * Note: BenchmarkDefinition, BenchmarkSuite, and BenchmarkTask types are
62- * derived from Zod schemas and re-exported from benchmark-schema.ts for type
63- * safety and consistency.
64- */
65-
66- // Re-export identifier helper functions
67- export { createRunId , createTaskId } from '../utils/identifiers.js' ;
68-
6937/**
7038 * Represents a complete benchmark run across multiple files
7139 */
@@ -98,6 +66,22 @@ export interface BenchmarkRun {
9866 readonly tags ?: string [ ] ;
9967}
10068
69+ export type {
70+ AbsoluteBudget ,
71+ BaselineReference ,
72+ BaselineStorage ,
73+ BaselineSummaryData ,
74+ Budget ,
75+ BudgetResult ,
76+ BudgetSummary ,
77+ BudgetViolation ,
78+ RelativeBudget ,
79+ RunId ,
80+ TaskId ,
81+ } ;
82+
83+ export type { ModestBenchConfig } ;
84+
10185/**
10286 * CI/CD environment information
10387 */
@@ -116,6 +100,28 @@ export interface CiInfo {
116100 readonly pullRequest ?: string ;
117101}
118102
103+ /**
104+ * ModestBench Core Types
105+ *
106+ * Defines the fundamental data structures used throughout the ModestBench
107+ * system. These types represent benchmark results, metadata, configuration, and
108+ * system state.
109+ *
110+ * Note: BenchmarkDefinition, BenchmarkSuite, and BenchmarkTask types are
111+ * derived from Zod schemas and re-exported from benchmark-schema.ts for type
112+ * safety and consistency.
113+ */
114+
115+ // Re-export schema-derived types
116+ export type {
117+ BenchmarkDefinition ,
118+ BenchmarkDefinitionInput ,
119+ BenchmarkSuite ,
120+ BenchmarkSuiteInput ,
121+ BenchmarkTask ,
122+ BenchmarkTaskInput ,
123+ } from '../core/benchmark-schema.js' ;
124+
119125/**
120126 * CPU information
121127 */
@@ -277,6 +283,11 @@ export interface GitInfo {
277283 readonly timestamp : Date ;
278284}
279285
286+ /**
287+ * Configuration options for the JSON reporter
288+ */
289+ export type JsonReporterConfig = z . infer < typeof jsonReporterConfigSchema > ;
290+
280291/**
281292 * Memory information
282293 */
@@ -289,69 +300,15 @@ export interface MemoryInfo {
289300 readonly used : number ;
290301}
291302
303+ // Re-export identifier helper functions
304+ export { createRunId , createTaskId } from '../utils/identifiers.js' ;
292305/**
293- * Benchmark configuration
294- *
295- * The JSON Schema for this configuration is available at
296- * `dist/schema/modestbench-config.schema.json` after building the project.
306+ * Reporter-specific configuration
297307 *
298- * Config files can optionally include a `$schema` property pointing to the
299- * schema file for IDE autocomplete and validation support.
300- *
301- * @example
302- *
303- * ```json
304- * {
305- * "$schema": "./node_modules/modestbench/dist/schema/modestbench-config.schema.json",
306- * "iterations": 1000,
307- * "reporters": ["human", "json"],
308- * "time": 5000
309- * }
310- * ```
308+ * Provides typed configuration for known reporters. Unknown reporter configs
309+ * are allowed via index signature.
311310 */
312- export interface ModestBenchConfig {
313- readonly $schema ?: string | undefined ;
314- /** Whether to stop on first failure */
315- readonly bail : boolean ;
316- /** Name of baseline to use for relative budget comparisons */
317- readonly baseline ?: string | undefined ;
318- /** How to handle budget violations: 'fail', 'warn', or 'report' */
319- readonly budgetMode ?: 'fail' | 'report' | 'warn' | undefined ;
320- /** Performance budgets mapped by task identifier */
321- readonly budgets ?: Record < string , unknown > | undefined ;
322- /** Patterns to exclude from discovery */
323- readonly exclude : string [ ] ;
324- /** Tags to exclude from execution */
325- readonly excludeTags : string [ ] ;
326- /** Default number of iterations per task */
327- readonly iterations : number ;
328- /** How to limit benchmark execution: 'time', 'iterations', 'any', or 'all' */
329- readonly limitBy : 'all' | 'any' | 'iterations' | 'time' ;
330- /** Custom metadata to attach to runs */
331- readonly metadata : Record < string , unknown > ;
332- /** Output directory for reports (undefined means stdout for data reporters) */
333- readonly outputDir ?: string ;
334- /** Pattern(s) for discovering benchmark files */
335- readonly pattern : string | string [ ] ;
336- /** Whether to run in quiet mode */
337- readonly quiet : boolean ;
338- /** Configuration for specific reporters */
339- readonly reporterConfig : Record < string , unknown > ;
340- /** Reporters to use for output */
341- readonly reporters : string [ ] ;
342- /** Tags to include (if empty, include all) */
343- readonly tags : string [ ] ;
344- /** Threshold configuration for performance assertions */
345- readonly thresholds : ThresholdConfig ;
346- /** Maximum time to spend on each task in milliseconds */
347- readonly time : number ;
348- /** Timeout for individual tasks in milliseconds */
349- readonly timeout : number ;
350- /** Whether to run in verbose mode */
351- readonly verbose : boolean ;
352- /** Number of warmup iterations before measurement */
353- readonly warmup : number ;
354- }
311+ export type ReporterConfig = z . infer < typeof reporterConfigSchema > ;
355312
356313/**
357314 * Summary statistics for a benchmark run
@@ -441,6 +398,8 @@ export interface TaskResult {
441398
442399/**
443400 * Threshold configuration for performance assertions
401+ *
402+ * TODO: Derive from thresholdConfigSchema via z.infer (see #15)
444403 */
445404export interface ThresholdConfig {
446405 /** Maximum allowed margin of error percentage */
0 commit comments