@aiready/core 0.19.0 → 0.19.3

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/dist/client.js CHANGED
@@ -20,13 +20,27 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/client.ts
21
21
  var client_exports = {};
22
22
  __export(client_exports, {
23
+ AnalysisResultSchema: () => AnalysisResultSchema,
24
+ AnalysisStatus: () => AnalysisStatus,
25
+ AnalysisStatusSchema: () => AnalysisStatusSchema,
23
26
  CONTEXT_TIER_THRESHOLDS: () => CONTEXT_TIER_THRESHOLDS,
24
27
  DEFAULT_TOOL_WEIGHTS: () => DEFAULT_TOOL_WEIGHTS,
28
+ IssueSchema: () => IssueSchema,
29
+ IssueType: () => IssueType,
30
+ IssueTypeSchema: () => IssueTypeSchema,
25
31
  LANGUAGE_EXTENSIONS: () => LANGUAGE_EXTENSIONS,
26
32
  Language: () => Language,
33
+ LocationSchema: () => LocationSchema,
34
+ MetricsSchema: () => MetricsSchema,
35
+ ModelTier: () => ModelTier,
36
+ ModelTierSchema: () => ModelTierSchema,
27
37
  ParseError: () => ParseError,
28
38
  SIZE_ADJUSTED_THRESHOLDS: () => SIZE_ADJUSTED_THRESHOLDS,
39
+ Severity: () => Severity,
40
+ SeveritySchema: () => SeveritySchema,
41
+ SpokeOutputSchema: () => SpokeOutputSchema,
29
42
  TOOL_NAME_MAP: () => TOOL_NAME_MAP,
43
+ UnifiedReportSchema: () => UnifiedReportSchema,
30
44
  calculateOverallScore: () => calculateOverallScore,
31
45
  formatScore: () => formatScore,
32
46
  formatToolScore: () => formatToolScore,
@@ -42,6 +56,120 @@ __export(client_exports, {
42
56
  });
43
57
  module.exports = __toCommonJS(client_exports);
44
58
 
59
+ // src/types/schema.ts
60
+ var import_zod = require("zod");
61
+ var Severity = /* @__PURE__ */ ((Severity2) => {
62
+ Severity2["Critical"] = "critical";
63
+ Severity2["Major"] = "major";
64
+ Severity2["Minor"] = "minor";
65
+ Severity2["Info"] = "info";
66
+ return Severity2;
67
+ })(Severity || {});
68
+ var SeveritySchema = import_zod.z.nativeEnum(Severity);
69
+ var IssueType = /* @__PURE__ */ ((IssueType2) => {
70
+ IssueType2["DuplicatePattern"] = "duplicate-pattern";
71
+ IssueType2["PatternInconsistency"] = "pattern-inconsistency";
72
+ IssueType2["ContextFragmentation"] = "context-fragmentation";
73
+ IssueType2["DependencyHealth"] = "dependency-health";
74
+ IssueType2["CircularDependency"] = "circular-dependency";
75
+ IssueType2["DocDrift"] = "doc-drift";
76
+ IssueType2["NamingInconsistency"] = "naming-inconsistency";
77
+ IssueType2["NamingQuality"] = "naming-quality";
78
+ IssueType2["ArchitectureInconsistency"] = "architecture-inconsistency";
79
+ IssueType2["DeadCode"] = "dead-code";
80
+ IssueType2["MissingTypes"] = "missing-types";
81
+ IssueType2["MagicLiteral"] = "magic-literal";
82
+ IssueType2["BooleanTrap"] = "boolean-trap";
83
+ IssueType2["AiSignalClarity"] = "ai-signal-clarity";
84
+ IssueType2["LowTestability"] = "low-testability";
85
+ IssueType2["AgentNavigationFailure"] = "agent-navigation-failure";
86
+ IssueType2["AmbiguousApi"] = "ambiguous-api";
87
+ IssueType2["ChangeAmplification"] = "change-amplification";
88
+ return IssueType2;
89
+ })(IssueType || {});
90
+ var IssueTypeSchema = import_zod.z.nativeEnum(IssueType);
91
+ var AnalysisStatus = /* @__PURE__ */ ((AnalysisStatus2) => {
92
+ AnalysisStatus2["Processing"] = "processing";
93
+ AnalysisStatus2["Completed"] = "completed";
94
+ AnalysisStatus2["Failed"] = "failed";
95
+ return AnalysisStatus2;
96
+ })(AnalysisStatus || {});
97
+ var AnalysisStatusSchema = import_zod.z.nativeEnum(AnalysisStatus);
98
+ var ModelTier = /* @__PURE__ */ ((ModelTier2) => {
99
+ ModelTier2["Compact"] = "compact";
100
+ ModelTier2["Standard"] = "standard";
101
+ ModelTier2["Extended"] = "extended";
102
+ ModelTier2["Frontier"] = "frontier";
103
+ return ModelTier2;
104
+ })(ModelTier || {});
105
+ var ModelTierSchema = import_zod.z.nativeEnum(ModelTier);
106
+ var LocationSchema = import_zod.z.object({
107
+ file: import_zod.z.string(),
108
+ line: import_zod.z.number(),
109
+ column: import_zod.z.number().optional(),
110
+ endLine: import_zod.z.number().optional(),
111
+ endColumn: import_zod.z.number().optional()
112
+ });
113
+ var IssueSchema = import_zod.z.object({
114
+ type: IssueTypeSchema,
115
+ severity: SeveritySchema,
116
+ message: import_zod.z.string(),
117
+ location: LocationSchema,
118
+ suggestion: import_zod.z.string().optional()
119
+ });
120
+ var MetricsSchema = import_zod.z.object({
121
+ tokenCost: import_zod.z.number().optional(),
122
+ complexityScore: import_zod.z.number().optional(),
123
+ consistencyScore: import_zod.z.number().optional(),
124
+ docFreshnessScore: import_zod.z.number().optional(),
125
+ // AI agent readiness metrics (v0.12+)
126
+ aiSignalClarityScore: import_zod.z.number().optional(),
127
+ agentGroundingScore: import_zod.z.number().optional(),
128
+ testabilityScore: import_zod.z.number().optional(),
129
+ docDriftScore: import_zod.z.number().optional(),
130
+ dependencyHealthScore: import_zod.z.number().optional(),
131
+ modelContextTier: ModelTierSchema.optional(),
132
+ // Business value metrics
133
+ estimatedMonthlyCost: import_zod.z.number().optional(),
134
+ estimatedDeveloperHours: import_zod.z.number().optional(),
135
+ comprehensionDifficultyIndex: import_zod.z.number().optional(),
136
+ // Extended metrics for specific spokes
137
+ totalSymbols: import_zod.z.number().optional(),
138
+ totalExports: import_zod.z.number().optional()
139
+ });
140
+ var AnalysisResultSchema = import_zod.z.object({
141
+ fileName: import_zod.z.string(),
142
+ issues: import_zod.z.array(IssueSchema),
143
+ metrics: MetricsSchema
144
+ });
145
+ var SpokeOutputSchema = import_zod.z.object({
146
+ results: import_zod.z.array(AnalysisResultSchema),
147
+ summary: import_zod.z.any(),
148
+ metadata: import_zod.z.object({
149
+ toolName: import_zod.z.string(),
150
+ version: import_zod.z.string(),
151
+ timestamp: import_zod.z.string()
152
+ }).catchall(import_zod.z.any()).optional()
153
+ });
154
+ var UnifiedReportSchema = import_zod.z.object({
155
+ summary: import_zod.z.object({
156
+ totalFiles: import_zod.z.number(),
157
+ totalIssues: import_zod.z.number(),
158
+ criticalIssues: import_zod.z.number(),
159
+ majorIssues: import_zod.z.number()
160
+ }),
161
+ results: import_zod.z.array(AnalysisResultSchema),
162
+ scoring: import_zod.z.object({
163
+ overall: import_zod.z.number(),
164
+ rating: import_zod.z.string(),
165
+ timestamp: import_zod.z.string(),
166
+ breakdown: import_zod.z.array(import_zod.z.object({
167
+ toolName: import_zod.z.string(),
168
+ score: import_zod.z.number()
169
+ }).catchall(import_zod.z.any()))
170
+ }).optional()
171
+ }).catchall(import_zod.z.any());
172
+
45
173
  // src/types/language.ts
46
174
  var Language = /* @__PURE__ */ ((Language2) => {
47
175
  Language2["TypeScript"] = "typescript";
@@ -432,13 +560,27 @@ function generateHTML(graph) {
432
560
  }
433
561
  // Annotate the CommonJS export names for ESM import in node:
434
562
  0 && (module.exports = {
563
+ AnalysisResultSchema,
564
+ AnalysisStatus,
565
+ AnalysisStatusSchema,
435
566
  CONTEXT_TIER_THRESHOLDS,
436
567
  DEFAULT_TOOL_WEIGHTS,
568
+ IssueSchema,
569
+ IssueType,
570
+ IssueTypeSchema,
437
571
  LANGUAGE_EXTENSIONS,
438
572
  Language,
573
+ LocationSchema,
574
+ MetricsSchema,
575
+ ModelTier,
576
+ ModelTierSchema,
439
577
  ParseError,
440
578
  SIZE_ADJUSTED_THRESHOLDS,
579
+ Severity,
580
+ SeveritySchema,
581
+ SpokeOutputSchema,
441
582
  TOOL_NAME_MAP,
583
+ UnifiedReportSchema,
442
584
  calculateOverallScore,
443
585
  formatScore,
444
586
  formatToolScore,
package/dist/client.mjs CHANGED
@@ -1,11 +1,25 @@
1
1
  import {
2
+ AnalysisResultSchema,
3
+ AnalysisStatus,
4
+ AnalysisStatusSchema,
2
5
  CONTEXT_TIER_THRESHOLDS,
3
6
  DEFAULT_TOOL_WEIGHTS,
7
+ IssueSchema,
8
+ IssueType,
9
+ IssueTypeSchema,
4
10
  LANGUAGE_EXTENSIONS,
5
11
  Language,
12
+ LocationSchema,
13
+ MetricsSchema,
14
+ ModelTier,
15
+ ModelTierSchema,
6
16
  ParseError,
7
17
  SIZE_ADJUSTED_THRESHOLDS,
18
+ Severity,
19
+ SeveritySchema,
20
+ SpokeOutputSchema,
8
21
  TOOL_NAME_MAP,
22
+ UnifiedReportSchema,
9
23
  calculateOverallScore,
10
24
  formatScore,
11
25
  formatToolScore,
@@ -18,15 +32,29 @@ import {
18
32
  getToolWeight,
19
33
  normalizeToolName,
20
34
  parseWeightString
21
- } from "./chunk-UQGI67WR.mjs";
35
+ } from "./chunk-D3D3NCRR.mjs";
22
36
  export {
37
+ AnalysisResultSchema,
38
+ AnalysisStatus,
39
+ AnalysisStatusSchema,
23
40
  CONTEXT_TIER_THRESHOLDS,
24
41
  DEFAULT_TOOL_WEIGHTS,
42
+ IssueSchema,
43
+ IssueType,
44
+ IssueTypeSchema,
25
45
  LANGUAGE_EXTENSIONS,
26
46
  Language,
47
+ LocationSchema,
48
+ MetricsSchema,
49
+ ModelTier,
50
+ ModelTierSchema,
27
51
  ParseError,
28
52
  SIZE_ADJUSTED_THRESHOLDS,
53
+ Severity,
54
+ SeveritySchema,
55
+ SpokeOutputSchema,
29
56
  TOOL_NAME_MAP,
57
+ UnifiedReportSchema,
30
58
  calculateOverallScore,
31
59
  formatScore,
32
60
  formatToolScore,
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import { AnalysisResult, ScanOptions, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, ToolScoringOutput, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ParseResult, NamingConvention } from './client.mjs';
2
- export { BusinessReport, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, ExportInfo, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueType, LANGUAGE_EXTENSIONS, LanguageConfig, Location, Metrics, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, SourceLocation, SourceRange, TOOL_NAME_MAP, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
1
+ import { ScanOptions, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, ToolScoringOutput, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ParseResult, NamingConvention } from './client.mjs';
2
+ export { AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BusinessReport, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, ExportInfo, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutput, SpokeOutputSchema, TOOL_NAME_MAP, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
3
+ import { z } from 'zod';
3
4
 
4
5
  /**
5
6
  * Spoke-to-Hub Contract Definitions
@@ -7,20 +8,6 @@ export { BusinessReport, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WE
7
8
  * changes in spokes don't break the CLI, Platform, or Visualizer.
8
9
  */
9
10
 
10
- /**
11
- * The standard output every spoke MUST provide when analyzed.
12
- * Some fields are optional depending on the tool's focus.
13
- */
14
- interface SpokeOutput {
15
- results: AnalysisResult[];
16
- summary: any;
17
- metadata?: {
18
- toolName: string;
19
- version: string;
20
- timestamp: string;
21
- [key: string]: any;
22
- };
23
- }
24
11
  /**
25
12
  * Validation utility to ensure a spoke's output matches the expected contract.
26
13
  * Used in spoke tests to catch breakages early.
@@ -30,29 +17,13 @@ declare function validateSpokeOutput(toolName: string, output: any): {
30
17
  errors: string[];
31
18
  };
32
19
  /**
33
- * The unified report format produced by the CLI and consumed by the Platform.
34
- * This is the master contract for the entire system.
20
+ * Zod-based validation (Round 1 improvement)
35
21
  */
36
- interface UnifiedReport {
37
- summary: {
38
- totalFiles: number;
39
- totalIssues: number;
40
- criticalIssues: number;
41
- majorIssues: number;
42
- };
43
- results: AnalysisResult[];
44
- scoring?: {
45
- overall: number;
46
- rating: string;
47
- timestamp: string;
48
- breakdown: Array<{
49
- toolName: string;
50
- score: number;
51
- [key: string]: any;
52
- }>;
53
- };
54
- [toolKey: string]: any;
55
- }
22
+ declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: any): {
23
+ valid: boolean;
24
+ data?: T;
25
+ errors?: string[];
26
+ };
56
27
 
57
28
  declare const DEFAULT_EXCLUDE: string[];
58
29
  declare const VAGUE_FILE_NAMES: Set<string>;
@@ -829,4 +800,4 @@ declare function getRepoMetadata(directory: string): {
829
800
  author?: string;
830
801
  };
831
802
 
832
- export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, type ExportWithImports, type FileImport, type FileWithDomain, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, type SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolScoringOutput, TypeScriptParser, type UnifiedReport, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput };
803
+ export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, type ExportWithImports, type FileImport, type FileWithDomain, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput, validateWithSchema };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { AnalysisResult, ScanOptions, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, ToolScoringOutput, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ParseResult, NamingConvention } from './client.js';
2
- export { BusinessReport, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, ExportInfo, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueType, LANGUAGE_EXTENSIONS, LanguageConfig, Location, Metrics, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, SourceLocation, SourceRange, TOOL_NAME_MAP, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
1
+ import { ScanOptions, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, ToolScoringOutput, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ParseResult, NamingConvention } from './client.js';
2
+ export { AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BusinessReport, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, ExportInfo, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutput, SpokeOutputSchema, TOOL_NAME_MAP, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
3
+ import { z } from 'zod';
3
4
 
4
5
  /**
5
6
  * Spoke-to-Hub Contract Definitions
@@ -7,20 +8,6 @@ export { BusinessReport, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WE
7
8
  * changes in spokes don't break the CLI, Platform, or Visualizer.
8
9
  */
9
10
 
10
- /**
11
- * The standard output every spoke MUST provide when analyzed.
12
- * Some fields are optional depending on the tool's focus.
13
- */
14
- interface SpokeOutput {
15
- results: AnalysisResult[];
16
- summary: any;
17
- metadata?: {
18
- toolName: string;
19
- version: string;
20
- timestamp: string;
21
- [key: string]: any;
22
- };
23
- }
24
11
  /**
25
12
  * Validation utility to ensure a spoke's output matches the expected contract.
26
13
  * Used in spoke tests to catch breakages early.
@@ -30,29 +17,13 @@ declare function validateSpokeOutput(toolName: string, output: any): {
30
17
  errors: string[];
31
18
  };
32
19
  /**
33
- * The unified report format produced by the CLI and consumed by the Platform.
34
- * This is the master contract for the entire system.
20
+ * Zod-based validation (Round 1 improvement)
35
21
  */
36
- interface UnifiedReport {
37
- summary: {
38
- totalFiles: number;
39
- totalIssues: number;
40
- criticalIssues: number;
41
- majorIssues: number;
42
- };
43
- results: AnalysisResult[];
44
- scoring?: {
45
- overall: number;
46
- rating: string;
47
- timestamp: string;
48
- breakdown: Array<{
49
- toolName: string;
50
- score: number;
51
- [key: string]: any;
52
- }>;
53
- };
54
- [toolKey: string]: any;
55
- }
22
+ declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: any): {
23
+ valid: boolean;
24
+ data?: T;
25
+ errors?: string[];
26
+ };
56
27
 
57
28
  declare const DEFAULT_EXCLUDE: string[];
58
29
  declare const VAGUE_FILE_NAMES: Set<string>;
@@ -829,4 +800,4 @@ declare function getRepoMetadata(directory: string): {
829
800
  author?: string;
830
801
  };
831
802
 
832
- export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, type ExportWithImports, type FileImport, type FileWithDomain, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, type SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolScoringOutput, TypeScriptParser, type UnifiedReport, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput };
803
+ export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, type ExportWithImports, type FileImport, type FileWithDomain, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput, validateWithSchema };