@company-semantics/contracts 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -325,6 +325,62 @@ export interface EvolutionBaselines {
325
325
  subdirectoryAffinity?: SubdirectoryAffinityBaseline;
326
326
  }
327
327
 
328
+ // =============================================================================
329
+ // Aggregate Evolution Types
330
+ // =============================================================================
331
+
332
+ /**
333
+ * Domain-level aggregate baseline for evolution tracking.
334
+ * Replaces per-file baselines with domain-aggregated metrics.
335
+ *
336
+ * Design: Domains are extracted from file paths (first 2 segments).
337
+ * Example: 'src/chat/execution/types.ts' → domain 'chat/execution'
338
+ */
339
+ export interface DomainAggregateBaseline {
340
+ /** Total exports across all files in domain */
341
+ exports: number;
342
+ /** Total imports across all files in domain */
343
+ imports: number;
344
+ /** Diagnostic only, not thresholded */
345
+ fileCount: number;
346
+ /** ISO timestamp when baseline was captured */
347
+ capturedAt?: string;
348
+ }
349
+
350
+ /**
351
+ * Configuration for aggregate evolution guard.
352
+ * Uses domain-level metrics instead of per-file tracking.
353
+ *
354
+ * Benefits over per-file:
355
+ * - ~22 entries vs ~300 entries
356
+ * - Stable under refactors within domains
357
+ * - Grows O(domains) not O(files)
358
+ */
359
+ export interface AggregateEvolutionConfig {
360
+ /** Source directory to scan */
361
+ srcDir: string;
362
+ /** Domain baselines keyed by domain path */
363
+ domains: Record<string, DomainAggregateBaseline>;
364
+ /** Global totals for sanity checking */
365
+ totals?: {
366
+ exports: number;
367
+ imports: number;
368
+ files: number;
369
+ capturedAt?: string;
370
+ };
371
+ /** Warning thresholds (sensible defaults applied if omitted) */
372
+ thresholds?: {
373
+ /** Absolute export growth before warning (default: 10) */
374
+ domainExportGrowth?: number;
375
+ /** Percentage growth before warning (default: 0.25 = 25%) */
376
+ domainGrowthPercent?: number;
377
+ };
378
+ }
379
+
380
+ // =============================================================================
381
+ // Coverage Baseline Types
382
+ // =============================================================================
383
+
328
384
  /**
329
385
  * Coverage baseline configuration.
330
386
  * Used by CI orchestrator to inject coverage drift guard.
@@ -54,6 +54,9 @@ export type {
54
54
  FileClusterBaseline,
55
55
  SubdirectoryAffinityBaseline,
56
56
  MetaBaselines,
57
+ // Aggregate evolution types
58
+ DomainAggregateBaseline,
59
+ AggregateEvolutionConfig,
57
60
  // SOC 2 Guard Configuration types
58
61
  SecretsDetectionConfig,
59
62
  StructuredLoggingConfig,
package/src/index.ts CHANGED
@@ -70,6 +70,9 @@ export type {
70
70
  ContractsFreshnessBaseline,
71
71
  CoverageBaseline,
72
72
  MetaBaselines,
73
+ // Aggregate evolution types
74
+ DomainAggregateBaseline,
75
+ AggregateEvolutionConfig,
73
76
  // SOC 2 Compliance types
74
77
  Soc2ControlArea,
75
78
  Soc2ControlStatus,