@aiready/core 0.19.3 → 0.21.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/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, 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, FRIENDLY_TOOL_NAMES, 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, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -8,6 +8,22 @@ import { z } from 'zod';
8
8
  * changes in spokes don't break the CLI, Platform, or Visualizer.
9
9
  */
10
10
 
11
+ /**
12
+ * Tool Provider Interface
13
+ * Every AIReady spoke must implement this interface to be integrated into the CLI registry.
14
+ */
15
+ interface ToolProvider {
16
+ /** Canonical tool ID */
17
+ id: ToolName;
18
+ /** CLI aliases/shorthand for this tool */
19
+ alias: string[];
20
+ /** Primary analysis logic */
21
+ analyze: (options: ScanOptions) => Promise<SpokeOutput>;
22
+ /** Scoring logic for this tool's output */
23
+ score: (output: SpokeOutput, options: ScanOptions) => ToolScoringOutput;
24
+ /** Optional weight override for this tool */
25
+ defaultWeight?: number;
26
+ }
11
27
  /**
12
28
  * Validation utility to ensure a spoke's output matches the expected contract.
13
29
  * Used in spoke tests to catch breakages early.
@@ -25,6 +41,41 @@ declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: any): {
25
41
  errors?: string[];
26
42
  };
27
43
 
44
+ /**
45
+ * AIReady Tool Registry
46
+ *
47
+ * Central registry for all analysis tools. Decouples the CLI from
48
+ * individual tool packages and allows for easier extension.
49
+ */
50
+ declare class ToolRegistry {
51
+ private static getProviders;
52
+ static instanceId: number;
53
+ /**
54
+ * Register a new tool provider.
55
+ */
56
+ static register(provider: ToolProvider): void;
57
+ /**
58
+ * Get a provider by its canonical ID.
59
+ */
60
+ static get(id: ToolName): ToolProvider | undefined;
61
+ /**
62
+ * Get a provider by name or alias.
63
+ */
64
+ static find(nameOrAlias: string): ToolProvider | undefined;
65
+ /**
66
+ * Get all registered tool providers.
67
+ */
68
+ static getAll(): ToolProvider[];
69
+ /**
70
+ * Get all available tool IDs from the ToolName enum.
71
+ */
72
+ static getAvailableIds(): ToolName[];
73
+ /**
74
+ * Clear the registry (primarily for testing).
75
+ */
76
+ static clear(): void;
77
+ }
78
+
28
79
  declare const DEFAULT_EXCLUDE: string[];
29
80
  declare const VAGUE_FILE_NAMES: Set<string>;
30
81
  /**
@@ -800,4 +851,4 @@ declare function getRepoMetadata(directory: string): {
800
851
  author?: string;
801
852
  };
802
853
 
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 };
854
+ 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, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, 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,5 @@
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';
1
+ import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, 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, FRIENDLY_TOOL_NAMES, 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, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -8,6 +8,22 @@ import { z } from 'zod';
8
8
  * changes in spokes don't break the CLI, Platform, or Visualizer.
9
9
  */
10
10
 
11
+ /**
12
+ * Tool Provider Interface
13
+ * Every AIReady spoke must implement this interface to be integrated into the CLI registry.
14
+ */
15
+ interface ToolProvider {
16
+ /** Canonical tool ID */
17
+ id: ToolName;
18
+ /** CLI aliases/shorthand for this tool */
19
+ alias: string[];
20
+ /** Primary analysis logic */
21
+ analyze: (options: ScanOptions) => Promise<SpokeOutput>;
22
+ /** Scoring logic for this tool's output */
23
+ score: (output: SpokeOutput, options: ScanOptions) => ToolScoringOutput;
24
+ /** Optional weight override for this tool */
25
+ defaultWeight?: number;
26
+ }
11
27
  /**
12
28
  * Validation utility to ensure a spoke's output matches the expected contract.
13
29
  * Used in spoke tests to catch breakages early.
@@ -25,6 +41,41 @@ declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: any): {
25
41
  errors?: string[];
26
42
  };
27
43
 
44
+ /**
45
+ * AIReady Tool Registry
46
+ *
47
+ * Central registry for all analysis tools. Decouples the CLI from
48
+ * individual tool packages and allows for easier extension.
49
+ */
50
+ declare class ToolRegistry {
51
+ private static getProviders;
52
+ static instanceId: number;
53
+ /**
54
+ * Register a new tool provider.
55
+ */
56
+ static register(provider: ToolProvider): void;
57
+ /**
58
+ * Get a provider by its canonical ID.
59
+ */
60
+ static get(id: ToolName): ToolProvider | undefined;
61
+ /**
62
+ * Get a provider by name or alias.
63
+ */
64
+ static find(nameOrAlias: string): ToolProvider | undefined;
65
+ /**
66
+ * Get all registered tool providers.
67
+ */
68
+ static getAll(): ToolProvider[];
69
+ /**
70
+ * Get all available tool IDs from the ToolName enum.
71
+ */
72
+ static getAvailableIds(): ToolName[];
73
+ /**
74
+ * Clear the registry (primarily for testing).
75
+ */
76
+ static clear(): void;
77
+ }
78
+
28
79
  declare const DEFAULT_EXCLUDE: string[];
29
80
  declare const VAGUE_FILE_NAMES: Set<string>;
30
81
  /**
@@ -800,4 +851,4 @@ declare function getRepoMetadata(directory: string): {
800
851
  author?: string;
801
852
  };
802
853
 
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 };
854
+ 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, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, 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.js CHANGED
@@ -37,6 +37,7 @@ __export(index_exports, {
37
37
  DEFAULT_COST_CONFIG: () => DEFAULT_COST_CONFIG,
38
38
  DEFAULT_EXCLUDE: () => DEFAULT_EXCLUDE,
39
39
  DEFAULT_TOOL_WEIGHTS: () => DEFAULT_TOOL_WEIGHTS,
40
+ FRIENDLY_TOOL_NAMES: () => FRIENDLY_TOOL_NAMES,
40
41
  IssueSchema: () => IssueSchema,
41
42
  IssueType: () => IssueType,
42
43
  IssueTypeSchema: () => IssueTypeSchema,
@@ -55,7 +56,11 @@ __export(index_exports, {
55
56
  Severity: () => Severity,
56
57
  SeveritySchema: () => SeveritySchema,
57
58
  SpokeOutputSchema: () => SpokeOutputSchema,
59
+ SpokeSummarySchema: () => SpokeSummarySchema,
58
60
  TOOL_NAME_MAP: () => TOOL_NAME_MAP,
61
+ ToolName: () => ToolName,
62
+ ToolNameSchema: () => ToolNameSchema,
63
+ ToolRegistry: () => ToolRegistry,
59
64
  TypeScriptParser: () => TypeScriptParser,
60
65
  UnifiedReportSchema: () => UnifiedReportSchema,
61
66
  VAGUE_FILE_NAMES: () => VAGUE_FILE_NAMES,
@@ -145,6 +150,38 @@ var Severity = /* @__PURE__ */ ((Severity2) => {
145
150
  return Severity2;
146
151
  })(Severity || {});
147
152
  var SeveritySchema = import_zod.z.nativeEnum(Severity);
153
+ var ToolName = /* @__PURE__ */ ((ToolName2) => {
154
+ ToolName2["PatternDetect"] = "pattern-detect";
155
+ ToolName2["ContextAnalyzer"] = "context-analyzer";
156
+ ToolName2["NamingConsistency"] = "naming-consistency";
157
+ ToolName2["AiSignalClarity"] = "ai-signal-clarity";
158
+ ToolName2["AgentGrounding"] = "agent-grounding";
159
+ ToolName2["TestabilityIndex"] = "testability-index";
160
+ ToolName2["DocDrift"] = "doc-drift";
161
+ ToolName2["DependencyHealth"] = "dependency-health";
162
+ ToolName2["ChangeAmplification"] = "change-amplification";
163
+ ToolName2["CognitiveLoad"] = "cognitive-load";
164
+ ToolName2["PatternEntropy"] = "pattern-entropy";
165
+ ToolName2["ConceptCohesion"] = "concept-cohesion";
166
+ ToolName2["SemanticDistance"] = "semantic-distance";
167
+ return ToolName2;
168
+ })(ToolName || {});
169
+ var ToolNameSchema = import_zod.z.nativeEnum(ToolName);
170
+ var FRIENDLY_TOOL_NAMES = {
171
+ ["pattern-detect" /* PatternDetect */]: "Semantic Duplicates",
172
+ ["context-analyzer" /* ContextAnalyzer */]: "Context Fragmentation",
173
+ ["naming-consistency" /* NamingConsistency */]: "Naming Consistency",
174
+ ["ai-signal-clarity" /* AiSignalClarity */]: "AI Signal Clarity",
175
+ ["agent-grounding" /* AgentGrounding */]: "Agent Grounding",
176
+ ["testability-index" /* TestabilityIndex */]: "Testability Index",
177
+ ["doc-drift" /* DocDrift */]: "Documentation Health",
178
+ ["dependency-health" /* DependencyHealth */]: "Dependency Health",
179
+ ["change-amplification" /* ChangeAmplification */]: "Change Amplification",
180
+ ["cognitive-load" /* CognitiveLoad */]: "Cognitive Load",
181
+ ["pattern-entropy" /* PatternEntropy */]: "Pattern Entropy",
182
+ ["concept-cohesion" /* ConceptCohesion */]: "Concept Cohesion",
183
+ ["semantic-distance" /* SemanticDistance */]: "Semantic Distance"
184
+ };
148
185
  var IssueType = /* @__PURE__ */ ((IssueType2) => {
149
186
  IssueType2["DuplicatePattern"] = "duplicate-pattern";
150
187
  IssueType2["PatternInconsistency"] = "pattern-inconsistency";
@@ -221,13 +258,20 @@ var AnalysisResultSchema = import_zod.z.object({
221
258
  issues: import_zod.z.array(IssueSchema),
222
259
  metrics: MetricsSchema
223
260
  });
261
+ var SpokeSummarySchema = import_zod.z.object({
262
+ totalFiles: import_zod.z.number().optional(),
263
+ totalIssues: import_zod.z.number().optional(),
264
+ criticalIssues: import_zod.z.number().optional(),
265
+ majorIssues: import_zod.z.number().optional(),
266
+ score: import_zod.z.number().optional()
267
+ }).catchall(import_zod.z.any());
224
268
  var SpokeOutputSchema = import_zod.z.object({
225
269
  results: import_zod.z.array(AnalysisResultSchema),
226
- summary: import_zod.z.any(),
270
+ summary: SpokeSummarySchema,
227
271
  metadata: import_zod.z.object({
228
272
  toolName: import_zod.z.string(),
229
- version: import_zod.z.string(),
230
- timestamp: import_zod.z.string()
273
+ version: import_zod.z.string().optional(),
274
+ timestamp: import_zod.z.string().optional()
231
275
  }).catchall(import_zod.z.any()).optional()
232
276
  });
233
277
  var UnifiedReportSchema = import_zod.z.object({
@@ -242,10 +286,12 @@ var UnifiedReportSchema = import_zod.z.object({
242
286
  overall: import_zod.z.number(),
243
287
  rating: import_zod.z.string(),
244
288
  timestamp: import_zod.z.string(),
245
- breakdown: import_zod.z.array(import_zod.z.object({
246
- toolName: import_zod.z.string(),
247
- score: import_zod.z.number()
248
- }).catchall(import_zod.z.any()))
289
+ breakdown: import_zod.z.array(
290
+ import_zod.z.object({
291
+ toolName: import_zod.z.union([ToolNameSchema, import_zod.z.string()]),
292
+ score: import_zod.z.number()
293
+ }).catchall(import_zod.z.any())
294
+ )
249
295
  }).optional()
250
296
  }).catchall(import_zod.z.any());
251
297
 
@@ -338,6 +384,65 @@ function validateWithSchema(schema, data) {
338
384
  };
339
385
  }
340
386
 
387
+ // src/registry.ts
388
+ var ToolRegistry = class {
389
+ static getProviders() {
390
+ const g = globalThis;
391
+ if (!g.__AIRE_TOOL_REGISTRY__) {
392
+ g.__AIRE_TOOL_REGISTRY__ = /* @__PURE__ */ new Map();
393
+ }
394
+ return g.__AIRE_TOOL_REGISTRY__;
395
+ }
396
+ /**
397
+ * Register a new tool provider.
398
+ */
399
+ static register(provider) {
400
+ console.log(
401
+ `[ToolRegistry#${this.instanceId}] Registering tool: ${provider.id} (${provider.alias.join(", ")})`
402
+ );
403
+ this.getProviders().set(provider.id, provider);
404
+ }
405
+ /**
406
+ * Get a provider by its canonical ID.
407
+ */
408
+ static get(id) {
409
+ return this.getProviders().get(id);
410
+ }
411
+ /**
412
+ * Get a provider by name or alias.
413
+ */
414
+ static find(nameOrAlias) {
415
+ const providers = this.getProviders();
416
+ const exact = providers.get(nameOrAlias);
417
+ if (exact) return exact;
418
+ for (const p of providers.values()) {
419
+ if (p.alias.includes(nameOrAlias)) return p;
420
+ }
421
+ return void 0;
422
+ }
423
+ /**
424
+ * Get all registered tool providers.
425
+ */
426
+ static getAll() {
427
+ return Array.from(this.getProviders().values());
428
+ }
429
+ /**
430
+ * Get all available tool IDs from the ToolName enum.
431
+ */
432
+ static getAvailableIds() {
433
+ return Object.values(ToolName).filter(
434
+ (v) => typeof v === "string"
435
+ );
436
+ }
437
+ /**
438
+ * Clear the registry (primarily for testing).
439
+ */
440
+ static clear() {
441
+ this.getProviders().clear();
442
+ }
443
+ };
444
+ ToolRegistry.instanceId = globalThis.Math.random();
445
+
341
446
  // src/utils/file-scanner.ts
342
447
  var import_glob = require("glob");
343
448
  var import_promises = require("fs/promises");
@@ -430,7 +535,13 @@ async function scanFiles(options) {
430
535
  ignoreFromFile = [];
431
536
  }
432
537
  }
433
- const TEST_PATTERNS = ["**/*.test.*", "**/*.spec.*", "**/__tests__/**", "**/test/**", "**/tests/**"];
538
+ const TEST_PATTERNS = [
539
+ "**/*.test.*",
540
+ "**/*.spec.*",
541
+ "**/__tests__/**",
542
+ "**/test/**",
543
+ "**/tests/**"
544
+ ];
434
545
  const baseExclude = options.includeTests ? DEFAULT_EXCLUDE.filter((p) => !TEST_PATTERNS.includes(p)) : DEFAULT_EXCLUDE;
435
546
  const finalExclude = [
436
547
  .../* @__PURE__ */ new Set([...exclude || [], ...ignoreFromFile, ...baseExclude])
@@ -451,12 +562,19 @@ async function scanFiles(options) {
451
562
  for (const gitignorePath of gitignoreFiles) {
452
563
  const gitTxt = await (0, import_promises.readFile)(gitignorePath, "utf-8");
453
564
  const gitignoreDir = (0, import_path.dirname)(gitignorePath);
454
- const relativePrefix = (0, import_path.relative)(rootDir || ".", gitignoreDir).replace(/\\/g, "/");
565
+ const relativePrefix = (0, import_path.relative)(rootDir || ".", gitignoreDir).replace(
566
+ /\\/g,
567
+ "/"
568
+ );
455
569
  const patterns = gitTxt.split(/\r?\n/).map((s) => s.trim()).filter(Boolean).filter((l) => !l.startsWith("#"));
456
570
  if (relativePrefix === "." || relativePrefix === "") {
457
571
  ig.add(patterns);
458
572
  } else {
459
- ig.add(patterns.map((p) => p.startsWith("/") ? `${relativePrefix}${p}` : `${relativePrefix}/**/${p}`));
573
+ ig.add(
574
+ patterns.map(
575
+ (p) => p.startsWith("/") ? `${relativePrefix}${p}` : `${relativePrefix}/**/${p}`
576
+ )
577
+ );
460
578
  }
461
579
  }
462
580
  const filtered = files.filter((f) => {
@@ -484,9 +602,17 @@ async function scanEntries(options) {
484
602
  ignoreFromFile = [];
485
603
  }
486
604
  }
487
- const TEST_PATTERNS = ["**/*.test.*", "**/*.spec.*", "**/__tests__/**", "**/test/**", "**/tests/**"];
605
+ const TEST_PATTERNS = [
606
+ "**/*.test.*",
607
+ "**/*.spec.*",
608
+ "**/__tests__/**",
609
+ "**/test/**",
610
+ "**/tests/**"
611
+ ];
488
612
  const baseExclude = includeTests ? DEFAULT_EXCLUDE.filter((p) => !TEST_PATTERNS.includes(p)) : DEFAULT_EXCLUDE;
489
- const finalExclude = [.../* @__PURE__ */ new Set([...exclude || [], ...ignoreFromFile, ...baseExclude])];
613
+ const finalExclude = [
614
+ .../* @__PURE__ */ new Set([...exclude || [], ...ignoreFromFile, ...baseExclude])
615
+ ];
490
616
  const dirs = await (0, import_glob.glob)("**/", {
491
617
  cwd: rootDir,
492
618
  ignore: finalExclude,
@@ -502,16 +628,23 @@ async function scanEntries(options) {
502
628
  for (const gitignorePath of gitignoreFiles) {
503
629
  const gitTxt = await (0, import_promises.readFile)(gitignorePath, "utf-8");
504
630
  const gitignoreDir = (0, import_path.dirname)(gitignorePath);
505
- const relativePrefix = (0, import_path.relative)(rootDir || ".", gitignoreDir).replace(/\\/g, "/");
631
+ const relativePrefix = (0, import_path.relative)(rootDir || ".", gitignoreDir).replace(
632
+ /\\/g,
633
+ "/"
634
+ );
506
635
  const patterns = gitTxt.split(/\r?\n/).map((s) => s.trim()).filter(Boolean).filter((l) => !l.startsWith("#"));
507
636
  if (relativePrefix === "." || relativePrefix === "") {
508
637
  ig.add(patterns);
509
638
  } else {
510
- ig.add(patterns.map((p) => p.startsWith("/") ? `${relativePrefix}${p}` : `${relativePrefix}/**/${p}`));
639
+ ig.add(
640
+ patterns.map(
641
+ (p) => p.startsWith("/") ? `${relativePrefix}${p}` : `${relativePrefix}/**/${p}`
642
+ )
643
+ );
511
644
  }
512
645
  }
513
646
  const filteredDirs = dirs.filter((d) => {
514
- let rel = (0, import_path.relative)(rootDir || ".", d).replace(/\\/g, "/").replace(/\/$/, "");
647
+ const rel = (0, import_path.relative)(rootDir || ".", d).replace(/\\/g, "/").replace(/\/$/, "");
515
648
  if (rel === "") return true;
516
649
  return !ig.ignores(rel);
517
650
  });
@@ -1035,28 +1168,34 @@ function generateHTML(graph) {
1035
1168
 
1036
1169
  // src/scoring.ts
1037
1170
  var DEFAULT_TOOL_WEIGHTS = {
1038
- "pattern-detect": 22,
1039
- "context-analyzer": 19,
1040
- consistency: 14,
1041
- "ai-signal-clarity": 11,
1042
- "agent-grounding": 10,
1043
- testability: 10,
1044
- "doc-drift": 8,
1045
- deps: 6
1171
+ ["pattern-detect" /* PatternDetect */]: 22,
1172
+ ["context-analyzer" /* ContextAnalyzer */]: 19,
1173
+ ["naming-consistency" /* NamingConsistency */]: 14,
1174
+ ["ai-signal-clarity" /* AiSignalClarity */]: 11,
1175
+ ["agent-grounding" /* AgentGrounding */]: 10,
1176
+ ["testability-index" /* TestabilityIndex */]: 10,
1177
+ ["doc-drift" /* DocDrift */]: 8,
1178
+ ["dependency-health" /* DependencyHealth */]: 6,
1179
+ ["change-amplification" /* ChangeAmplification */]: 8
1046
1180
  };
1047
1181
  var TOOL_NAME_MAP = {
1048
- patterns: "pattern-detect",
1049
- context: "context-analyzer",
1050
- consistency: "consistency",
1051
- "AI signal clarity": "ai-signal-clarity",
1052
- "ai-signal-clarity": "ai-signal-clarity",
1053
- grounding: "agent-grounding",
1054
- "agent-grounding": "agent-grounding",
1055
- testability: "testability",
1056
- tests: "testability",
1057
- "doc-drift": "doc-drift",
1058
- docs: "doc-drift",
1059
- deps: "deps"
1182
+ patterns: "pattern-detect" /* PatternDetect */,
1183
+ "pattern-detect": "pattern-detect" /* PatternDetect */,
1184
+ context: "context-analyzer" /* ContextAnalyzer */,
1185
+ "context-analyzer": "context-analyzer" /* ContextAnalyzer */,
1186
+ consistency: "naming-consistency" /* NamingConsistency */,
1187
+ "naming-consistency": "naming-consistency" /* NamingConsistency */,
1188
+ "ai-signal": "ai-signal-clarity" /* AiSignalClarity */,
1189
+ "ai-signal-clarity": "ai-signal-clarity" /* AiSignalClarity */,
1190
+ grounding: "agent-grounding" /* AgentGrounding */,
1191
+ "agent-grounding": "agent-grounding" /* AgentGrounding */,
1192
+ testability: "testability-index" /* TestabilityIndex */,
1193
+ "testability-index": "testability-index" /* TestabilityIndex */,
1194
+ "doc-drift": "doc-drift" /* DocDrift */,
1195
+ "deps-health": "dependency-health" /* DependencyHealth */,
1196
+ "dependency-health": "dependency-health" /* DependencyHealth */,
1197
+ "change-amp": "change-amplification" /* ChangeAmplification */,
1198
+ "change-amplification": "change-amplification" /* ChangeAmplification */
1060
1199
  };
1061
1200
  var CONTEXT_TIER_THRESHOLDS = {
1062
1201
  compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
@@ -1090,22 +1229,16 @@ function getRecommendedThreshold(fileCount, modelTier = "standard") {
1090
1229
  return base + modelBonus;
1091
1230
  }
1092
1231
  function normalizeToolName(shortName) {
1093
- return TOOL_NAME_MAP[shortName] || shortName;
1232
+ return TOOL_NAME_MAP[shortName.toLowerCase()] || shortName;
1094
1233
  }
1095
1234
  function getToolWeight(toolName, toolConfig, cliOverride) {
1096
- if (cliOverride !== void 0) {
1097
- return cliOverride;
1098
- }
1099
- if (toolConfig?.scoreWeight !== void 0) {
1100
- return toolConfig.scoreWeight;
1101
- }
1235
+ if (cliOverride !== void 0) return cliOverride;
1236
+ if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
1102
1237
  return DEFAULT_TOOL_WEIGHTS[toolName] || 5;
1103
1238
  }
1104
1239
  function parseWeightString(weightStr) {
1105
1240
  const weights = /* @__PURE__ */ new Map();
1106
- if (!weightStr) {
1107
- return weights;
1108
- }
1241
+ if (!weightStr) return weights;
1109
1242
  const pairs = weightStr.split(",");
1110
1243
  for (const pair of pairs) {
1111
1244
  const [toolShortName, weightStr2] = pair.split(":");
@@ -1137,8 +1270,7 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
1137
1270
  const calculationWeights = {};
1138
1271
  for (const [toolName, output] of toolOutputs.entries()) {
1139
1272
  const weight = weights.get(toolName) || 5;
1140
- const weightedScore = output.score * weight;
1141
- weightedSum += weightedScore;
1273
+ weightedSum += output.score * weight;
1142
1274
  totalWeight += weight;
1143
1275
  toolsUsed.push(toolName);
1144
1276
  calculationWeights[toolName] = weight;
@@ -2808,7 +2940,7 @@ function calculateChangeAmplification(params) {
2808
2940
  const hotspots = files.map((f) => ({ ...f, amplificationFactor: f.fanOut + f.fanIn * 0.5 })).sort((a, b) => b.amplificationFactor - a.amplificationFactor);
2809
2941
  const maxAmplification = hotspots[0].amplificationFactor;
2810
2942
  const avgAmplification = hotspots.reduce((sum, h) => sum + h.amplificationFactor, 0) / hotspots.length;
2811
- let score = Math.max(
2943
+ const score = Math.max(
2812
2944
  0,
2813
2945
  Math.min(
2814
2946
  100,
@@ -3135,6 +3267,7 @@ function getRepoMetadata(directory) {
3135
3267
  DEFAULT_COST_CONFIG,
3136
3268
  DEFAULT_EXCLUDE,
3137
3269
  DEFAULT_TOOL_WEIGHTS,
3270
+ FRIENDLY_TOOL_NAMES,
3138
3271
  IssueSchema,
3139
3272
  IssueType,
3140
3273
  IssueTypeSchema,
@@ -3153,7 +3286,11 @@ function getRepoMetadata(directory) {
3153
3286
  Severity,
3154
3287
  SeveritySchema,
3155
3288
  SpokeOutputSchema,
3289
+ SpokeSummarySchema,
3156
3290
  TOOL_NAME_MAP,
3291
+ ToolName,
3292
+ ToolNameSchema,
3293
+ ToolRegistry,
3157
3294
  TypeScriptParser,
3158
3295
  UnifiedReportSchema,
3159
3296
  VAGUE_FILE_NAMES,