@aiready/core 0.23.2 → 0.23.4

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 (79) hide show
  1. package/dist/__tests__/parser-factory.test.d.ts +1 -1
  2. package/dist/__tests__/parser-factory.test.js +62 -50
  3. package/dist/__tests__/python-parser.test.d.ts +1 -1
  4. package/dist/__tests__/python-parser.test.js +111 -109
  5. package/dist/__tests__/scoring.test.d.ts +1 -1
  6. package/dist/__tests__/scoring.test.js +193 -176
  7. package/dist/chunk-3YI4IS3D.mjs +191 -173
  8. package/dist/chunk-5HIXDC3X.mjs +273 -251
  9. package/dist/chunk-5V3L53AE.mjs +805 -0
  10. package/dist/chunk-CKVKHN3G.mjs +228 -211
  11. package/dist/chunk-COHIBX3Q.mjs +213 -195
  12. package/dist/chunk-CWRCDSKZ.mjs +91 -82
  13. package/dist/chunk-D3D3NCRR.mjs +147 -129
  14. package/dist/chunk-HCFYP7UD.mjs +805 -0
  15. package/dist/chunk-HFLFBA6F.mjs +79 -72
  16. package/dist/chunk-HKSARRCD.mjs +66 -58
  17. package/dist/chunk-JJ5JL5FX.mjs +91 -82
  18. package/dist/chunk-KDSTXVLQ.mjs +724 -0
  19. package/dist/chunk-KI7XORTN.mjs +91 -82
  20. package/dist/chunk-LTMHFNFK.mjs +690 -0
  21. package/dist/chunk-LTNXTXRI.mjs +228 -211
  22. package/dist/chunk-M22BXHBR.mjs +805 -0
  23. package/dist/chunk-MH3A3LX6.mjs +200 -182
  24. package/dist/chunk-NGHT7JOG.mjs +697 -0
  25. package/dist/chunk-OQ6IGDXG.mjs +147 -129
  26. package/dist/chunk-QAFB3HXQ.mjs +181 -165
  27. package/dist/chunk-QQBKXHLU.mjs +678 -0
  28. package/dist/chunk-RDHYGES7.mjs +678 -0
  29. package/dist/chunk-SWTDBVYJ.mjs +228 -213
  30. package/dist/chunk-UIWL5JQB.mjs +79 -72
  31. package/dist/chunk-UQGI67WR.mjs +79 -72
  32. package/dist/chunk-UTZOO4XO.mjs +147 -131
  33. package/dist/chunk-X4F46I5L.mjs +213 -195
  34. package/dist/chunk-XKK7YHPX.mjs +204 -186
  35. package/dist/chunk-YCA4FTEK.mjs +190 -172
  36. package/dist/chunk-ZSZRRTJM.mjs +719 -0
  37. package/dist/client-BgmiMoil.d.mts +1344 -0
  38. package/dist/client-BgmiMoil.d.ts +1344 -0
  39. package/dist/client-BxGrPuuN.d.mts +1191 -0
  40. package/dist/client-BxGrPuuN.d.ts +1191 -0
  41. package/dist/client-D-cn9ydj.d.mts +1136 -0
  42. package/dist/client-D-cn9ydj.d.ts +1136 -0
  43. package/dist/client-D9seCH4K.d.mts +1334 -0
  44. package/dist/client-D9seCH4K.d.ts +1334 -0
  45. package/dist/client-DIXIh7rw.d.mts +1193 -0
  46. package/dist/client-DIXIh7rw.d.ts +1193 -0
  47. package/dist/client-DVHXWOHw.d.mts +1245 -0
  48. package/dist/client-DVHXWOHw.d.ts +1245 -0
  49. package/dist/client.d.mts +2 -1098
  50. package/dist/client.d.ts +2 -1098
  51. package/dist/client.js +23 -43
  52. package/dist/client.mjs +3 -25
  53. package/dist/index.d.mts +329 -107
  54. package/dist/index.d.ts +329 -107
  55. package/dist/index.js +329 -340
  56. package/dist/index.mjs +305 -322
  57. package/dist/parsers/parser-factory.d.ts +45 -45
  58. package/dist/parsers/parser-factory.js +86 -84
  59. package/dist/parsers/python-parser.d.ts +33 -28
  60. package/dist/parsers/python-parser.js +224 -222
  61. package/dist/parsers/typescript-parser.d.ts +15 -10
  62. package/dist/parsers/typescript-parser.js +223 -197
  63. package/dist/scoring.d.ts +59 -49
  64. package/dist/scoring.js +129 -127
  65. package/dist/types/language.d.ts +104 -93
  66. package/dist/types/language.js +23 -23
  67. package/dist/types.d.ts +105 -87
  68. package/dist/types.js +1 -1
  69. package/dist/utils/ast-parser.d.ts +42 -33
  70. package/dist/utils/ast-parser.js +159 -162
  71. package/dist/utils/cli-helpers.d.ts +27 -10
  72. package/dist/utils/cli-helpers.js +45 -43
  73. package/dist/utils/config.d.ts +8 -3
  74. package/dist/utils/config.js +67 -69
  75. package/dist/utils/file-scanner.d.ts +1 -1
  76. package/dist/utils/file-scanner.js +80 -76
  77. package/dist/utils/metrics.d.ts +1 -1
  78. package/dist/utils/metrics.js +2 -2
  79. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AnalysisResult, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.js';
2
- export { AiSignalClarityConfig, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringProfile, 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';
1
+ import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as Severity, A as AnalysisResult, E as ExportWithImports, d as ASTNode, F as FileImport, e as AIReadyConfig, M as ModelContextTier, C as CostConfig, f as TokenBudget, P as ProductivityImpact, g as AcceptancePrediction, h as ComprehensionDifficulty, i as TechnicalValueChainSummary, j as TechnicalValueChain, L as LanguageParser, k as Language, l as ExportInfo, m as ParseResult, N as NamingConvention, I as ImportInfo } from './client-D-cn9ydj.js';
2
+ export { n as AnalysisResultSchema, o as AnalysisStatus, p as AnalysisStatusSchema, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, t as Config, D as DEFAULT_TOOL_WEIGHTS, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, K as Issue, O as IssueSchema, Q as IssueType, R as IssueTypeSchema, U as LANGUAGE_EXTENSIONS, V as LanguageConfig, W as Location, X as LocationSchema, Y as Metrics, Z as MetricsSchema, _ as ModelTier, $ as ModelTierSchema, a0 as ParseError, a1 as ParseStatistics, a2 as ReadinessRating, a3 as RecommendationPriority, a4 as SCORING_PROFILES, a5 as SIZE_ADJUSTED_THRESHOLDS, a6 as ScanResult, a7 as ScoringConfig, a8 as ScoringProfile, a9 as ScoringResult, aa as SeveritySchema, ab as SourceLocation, ac as SourceRange, ad as SpokeOutputSchema, ae as SpokeSummary, af as SpokeSummarySchema, ag as TOOL_NAME_MAP, ah as ToolNameSchema, ai as ToolOptions, aj as ToolOutput, ak as UnifiedReport, al as UnifiedReportSchema, am as calculateOverallScore, an as formatScore, ao as formatToolScore, ap as generateHTML, aq as getProjectSizeTier, ar as getRating, as as getRatingDisplay, at as getRatingSlug, au as getRatingWithContext, av as getRecommendedThreshold, aw as getToolWeight, ax as normalizeToolName, ay as parseWeightString } from './client-D-cn9ydj.js';
3
3
  import { z } from 'zod';
4
4
  import * as Parser from 'web-tree-sitter';
5
5
  import { TSESTree } from '@typescript-eslint/typescript-estree';
@@ -123,7 +123,17 @@ declare class ToolRegistry {
123
123
  static clear(): void;
124
124
  }
125
125
 
126
+ /**
127
+ * Default file exclusion patterns for AIReady scans.
128
+ * These patterns are applied to exclude build artifacts, dependencies,
129
+ * test files, and other non-source files from analysis.
130
+ */
126
131
  declare const DEFAULT_EXCLUDE: string[];
132
+ /**
133
+ * Set of vague/abiguous file names that indicate poor code organization.
134
+ * These names don't convey the file's purpose and make it harder for AI
135
+ * to understand the codebase structure.
136
+ */
127
137
  declare const VAGUE_FILE_NAMES: Set<string>;
128
138
  /**
129
139
  * Scan files in a directory using glob patterns
@@ -143,17 +153,53 @@ declare function scanEntries(options: ScanOptions): Promise<{
143
153
  files: string[];
144
154
  dirs: string[];
145
155
  }>;
156
+ /**
157
+ * Read the contents of a file as a UTF-8 string.
158
+ * @param filePath - Absolute path to the file to read
159
+ * @returns The file contents as a string
160
+ */
161
+ /**
162
+ * Read the contents of a file as a UTF-8 string.
163
+ * @param filePath - Absolute path to the file to read
164
+ * @returns The file contents as a string
165
+ */
146
166
  declare function readFileContent(filePath: string): Promise<string>;
167
+ /**
168
+ * Extract the file extension from a file path.
169
+ * @param filePath - The file path to extract extension from
170
+ * @returns The file extension without the dot (e.g., 'ts', 'js', 'py')
171
+ */
172
+ /**
173
+ * Extract the file extension from a file path.
174
+ * @param filePath - The file path to extract extension from
175
+ * @returns The file extension without the dot (e.g., 'ts', 'js', 'py')
176
+ */
147
177
  declare function getFileExtension(filePath: string): string;
178
+ /**
179
+ * Check if a file is a source code file based on its extension.
180
+ * Supports TypeScript, JavaScript, Python, Java, Go, Rust, and C#.
181
+ * @param filePath - The file path to check
182
+ * @returns True if the file has a source code extension
183
+ */
184
+ /**
185
+ * Check if a file is a source code file based on its extension.
186
+ * Supports TypeScript, JavaScript, Python, Java, Go, Rust, and C#.
187
+ * @param filePath - The file path to check
188
+ * @returns True if the file has a source code extension
189
+ */
148
190
  declare function isSourceFile(filePath: string): boolean;
149
191
 
150
192
  /**
151
193
  * Common CLI configuration interface
152
194
  */
153
195
  interface CLIOptions {
196
+ /** Root directory for analysis */
154
197
  rootDir: string;
198
+ /** Glob patterns to include */
155
199
  include?: string[];
200
+ /** Glob patterns to exclude */
156
201
  exclude?: string[];
202
+ /** Any other tool-specific options */
157
203
  [key: string]: any;
158
204
  }
159
205
  /**
@@ -167,49 +213,101 @@ interface CLIOptions {
167
213
  declare function resolveOutputPath(userPath: string | undefined, defaultFilename: string, workingDir?: string): string;
168
214
  /**
169
215
  * Load and merge configuration with CLI options
216
+ * @param directory Root directory to load config from
217
+ * @param defaults Default configuration values
218
+ * @param cliOptions Configuration overrides from CLI arguments
219
+ * @returns Merged configuration object
170
220
  */
171
221
  declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): Promise<T & {
172
222
  rootDir: string;
173
223
  }>;
174
224
  /**
175
- * Handle JSON output for CLI commands
225
+ * Handle JSON output for CLI commands.
226
+ * Writes to file if outputFile is provided, otherwise logs to console.
227
+ * @param data Data to output
228
+ * @param outputFile Optional path to save JSON file
229
+ * @param successMessage Optional message to show on success
176
230
  */
177
231
  declare function handleJSONOutput(data: any, outputFile?: string, successMessage?: string): void;
178
232
  /**
179
- * Common error handler for CLI commands
233
+ * Common error handler for CLI commands.
234
+ * Logs error and exits process with code 1.
235
+ * @param error Error object or message
236
+ * @param commandName Name of the command that failed
180
237
  */
181
238
  declare function handleCLIError(error: unknown, commandName: string): never;
182
239
  /**
183
240
  * Calculate elapsed time and format for display
241
+ * @param startTime timestamp in milliseconds
242
+ * @returns Formatted seconds (e.g. "1.23")
184
243
  */
185
244
  declare function getElapsedTime(startTime: number): string;
186
245
  /**
187
246
  * Generate a visual score bar for console output
247
+ * @param val Score value (0-100)
248
+ * @returns String representation of the bar (e.g. "█████░░░░░")
188
249
  */
189
250
  declare function getScoreBar(val: number): string;
190
251
  /**
191
252
  * Get status icon for safety ratings
253
+ * @param rating Safety rating slug
254
+ * @returns Emoji icon representating the rating
192
255
  */
193
256
  declare function getSafetyIcon(rating: string): string;
194
257
  /**
195
258
  * Emit progress update with throttling to reduce log noise
259
+ * @param processed Number of items processed
260
+ * @param total Total items to process
261
+ * @param toolId Tool identifier
262
+ * @param message Progress message
263
+ * @param onProgress Global progress callback
264
+ * @param throttleCount Frequency of updates (every N items)
196
265
  */
197
266
  declare function emitProgress(processed: number, total: number, toolId: string, message: string, onProgress?: (processed: number, total: number, message: string) => void, throttleCount?: number): void;
198
267
  /**
199
268
  * Get chalk color function for a given severity
200
- * @param severity severity level
201
- * @param chalk chalk instance
269
+ * @param severity Severity level string
270
+ * @param chalkInstance Chalk instance to use
271
+ * @returns Chalk color function
272
+ */
273
+ declare function getSeverityColor(severity: string, chalkInstance?: any): any;
274
+ /**
275
+ * Get numeric severity value for comparison (4-1)
276
+ * @param s Severity level string
277
+ * @returns Numeric value (4: critical, 3: major, 2: minor, 1: info)
278
+ */
279
+ declare function getSeverityValue(s: string | undefined): number;
280
+ /**
281
+ * Get numeric severity level (alias for getSeverityValue)
282
+ * @param s Severity level string
283
+ * @returns Numeric value
202
284
  */
203
- declare function getSeverityColor(severity: string, chalk: any): any;
285
+ declare function getSeverityLevel(s: string | undefined): number;
204
286
  /**
205
- * Find the latest aiready report in a directory by modification time
206
- * Searches for both new format (aiready-report-*) and legacy format (aiready-scan-*)
287
+ * Get colored severity badge for console output
288
+ * @param severity Severity level
289
+ * @param chalkInstance Chalk instance (optional)
290
+ * @returns Formatted badge string
291
+ */
292
+ declare function getSeverityBadge(severity: Severity | string, chalkInstance?: any): string;
293
+ /**
294
+ * Get Severity enum from string for internal logic
295
+ * @param s Severity level string
296
+ * @returns Normalized severity string
297
+ */
298
+ declare function getSeverityEnum(s: string | undefined): any;
299
+ /**
300
+ * Find the latest aiready report in a directory by modification time.
301
+ * Searches for both new format (aiready-report-*) and legacy format (aiready-scan-*).
207
302
  * @param dirPath - The directory path to search for .aiready directory
208
303
  * @returns The path to the latest report or null if not found
209
304
  */
210
305
  declare function findLatestReport(dirPath: string): string | null;
211
306
  /**
212
- * Find the latest scan report file in a directory
307
+ * Find the latest scan report file with a specific prefix.
308
+ * @param scanReportsDir Directory containing reports
309
+ * @param reportFilePrefix Filename prefix to match (e.g. "report-")
310
+ * @returns Path to the latest matching report or null
213
311
  */
214
312
  declare function findLatestScanReport(scanReportsDir: string, reportFilePrefix: string): string | null;
215
313
 
@@ -249,55 +347,52 @@ interface ProviderFactoryConfig<TReport> {
249
347
  */
250
348
  declare function createProvider<TReport>(config: ProviderFactoryConfig<TReport>): ToolProvider;
251
349
 
252
- interface ExportWithImports {
253
- name: string;
254
- type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default';
255
- imports: string[];
256
- dependencies: string[];
257
- typeReferences: string[];
258
- loc?: {
259
- start: {
260
- line: number;
261
- column: number;
262
- };
263
- end: {
264
- line: number;
265
- column: number;
266
- };
267
- };
268
- }
269
- interface FileImport {
270
- source: string;
271
- specifiers: string[];
272
- isTypeOnly: boolean;
273
- }
274
350
  /**
275
- * Parse TypeScript/JavaScript file and extract exports with their import dependencies
351
+ * Parse TypeScript/JavaScript file and extract exports with their import dependencies.
352
+ * Automatically handles different languages via the parser factory.
353
+ *
354
+ * @param code - The source code to parse
355
+ * @param filePath - Path to the file (used for language detection and AST metadata)
356
+ * @returns Object containing all identified exports and imports
276
357
  */
277
358
  declare function parseFileExports(code: string, filePath: string): {
278
359
  exports: ExportWithImports[];
279
360
  imports: FileImport[];
280
361
  };
281
362
  /**
282
- * Calculate import-based similarity between two exports (Jaccard index)
363
+ * Calculate import-based similarity between two exports using Jaccard index.
364
+ * Returns a score between 0 and 1 representing the overlap in imported symbols.
365
+ *
366
+ * @param export1 - First export to compare
367
+ * @param export2 - Second export to compare
368
+ * @returns Similarity score (0 = no overlap, 1 = identical imports)
283
369
  */
284
370
  declare function calculateImportSimilarity(export1: ExportWithImports, export2: ExportWithImports): number;
285
- interface ASTNode {
286
- type: string;
287
- loc?: {
288
- start: {
289
- line: number;
290
- column: number;
291
- };
292
- end: {
293
- line: number;
294
- column: number;
295
- };
296
- };
297
- }
298
- declare function parseCode(code: string, language: string): ASTNode | null;
299
- declare function extractFunctions(ast: ASTNode): ASTNode[];
300
- declare function extractImports(ast: ASTNode): string[];
371
+ /**
372
+ * Parse code into an AST node.
373
+ * @deprecated Use parseFileExports instead for full dependency analysis.
374
+ *
375
+ * @param code - Source code to parse
376
+ * @param language - Target language
377
+ * @returns Generic AST node or null if unsupported
378
+ */
379
+ declare function parseCode(_code: string, _language: string): ASTNode | null;
380
+ /**
381
+ * Extract functions from an AST.
382
+ * @deprecated Use parseFileExports instead for complete export metadata.
383
+ *
384
+ * @param ast - The AST to scan
385
+ * @returns Array of function nodes
386
+ */
387
+ declare function extractFunctions(_ast: ASTNode): ASTNode[];
388
+ /**
389
+ * Extract imports from an AST.
390
+ * @deprecated Use parseFileExports instead for structured import info.
391
+ *
392
+ * @param ast - The AST to scan
393
+ * @returns Array of imported module names
394
+ */
395
+ declare function extractImports(_ast: ASTNode): string[];
301
396
 
302
397
  /**
303
398
  * Estimate token count for text (rough approximation)
@@ -305,7 +400,18 @@ declare function extractImports(ast: ASTNode): string[];
305
400
  */
306
401
  declare function estimateTokens(text: string): number;
307
402
 
403
+ /**
404
+ * Search upwards for AIReady configuration files and load the first one found.
405
+ * @param rootDir Starting directory for the search
406
+ * @returns Parsed configuration object or null if not found
407
+ */
308
408
  declare function loadConfig(rootDir: string): Promise<AIReadyConfig | null>;
409
+ /**
410
+ * Merge user-provided configuration with default settings.
411
+ * @param userConfig The configuration loaded from file
412
+ * @param defaults The default configuration object
413
+ * @returns Merged configuration with all defaults applied
414
+ */
309
415
  declare function mergeConfigWithDefaults(userConfig: AIReadyConfig | null, defaults: any): any;
310
416
 
311
417
  /**
@@ -433,27 +539,49 @@ declare function calculateComprehensionDifficulty(contextBudget: number, importD
433
539
  */
434
540
 
435
541
  /**
436
- * Historical score entry for trend tracking
542
+ * Historical score entry for trend tracking.
543
+ * Used to store and compare results across different points in time.
437
544
  */
438
545
  interface ScoreHistoryEntry {
546
+ /** ISO timestamp of the scan */
439
547
  timestamp: string;
548
+ /** Overall score (0-100) */
440
549
  overallScore: number;
550
+ /** Breakdown of scores by tool */
441
551
  breakdown: Record<string, number>;
552
+ /** Total number of issues detected */
442
553
  totalIssues: number;
554
+ /** Total tokens analyzed */
443
555
  totalTokens: number;
444
556
  }
445
557
  /**
446
- * Trend analysis comparing current vs historical scores
558
+ * Trend analysis comparing current vs historical scores.
559
+ * Helps teams understand if their AI-readiness is improving or degrading.
447
560
  */
448
561
  interface ScoreTrend {
562
+ /** Overall trend direction */
449
563
  direction: 'improving' | 'stable' | 'degrading';
564
+ /** Percentage change in score over last 30 days */
450
565
  change30Days: number;
566
+ /** Percentage change in score over last 90 days */
451
567
  change90Days: number;
568
+ /** Rate of change (points per week) */
452
569
  velocity: number;
570
+ /** Projected score in 30 days based on current velocity */
453
571
  projectedScore: number;
454
572
  }
455
573
  /**
456
- * Calculate Aggregate Business ROI
574
+ * Calculate Aggregate Business ROI from code analysis results.
575
+ *
576
+ * This high-level function combines token waste and productivity impact
577
+ * to produce a monthly and annual dollar value of the issues found.
578
+ *
579
+ * @param params - Parameters for ROI calculation
580
+ * @param params.tokenWaste - Estimated total tokens wasted on context inefficiencies
581
+ * @param params.issues - Array of issues with severity levels for productivity impact
582
+ * @param params.developerCount - Number of developers in the team (default: 5)
583
+ * @param params.modelId - AI model ID for pricing model selection (default: 'claude-4.6')
584
+ * @returns Business ROI metrics including savings and recommendations
457
585
  */
458
586
  declare function calculateBusinessROI(params: {
459
587
  tokenWaste: number;
@@ -463,25 +591,49 @@ declare function calculateBusinessROI(params: {
463
591
  developerCount?: number;
464
592
  modelId?: string;
465
593
  }): {
594
+ /** Estimated monthly savings if issues are resolved */
466
595
  monthlySavings: number;
596
+ /** Total developer hours gained per month */
467
597
  productivityGainHours: number;
598
+ /** Projected total annual business value gained */
468
599
  annualValue: number;
469
600
  };
470
601
  /**
471
- * Format cost for display
602
+ * Format currency value for display in console or reports.
603
+ *
604
+ * Handles small values with decimals and large values with 'k' suffix.
605
+ *
606
+ * @param cost Cost in USD
607
+ * @returns Formatted currency string (e.g. "$0.50", "$500", "$1.2k")
472
608
  */
473
609
  declare function formatCost(cost: number): string;
474
610
  /**
475
- * Format hours for display
611
+ * Format time duration in hours for display in console or reports.
612
+ *
613
+ * Automatically switches between minutes, hours, and weeks based on magnitude.
614
+ *
615
+ * @param hours Number of hours
616
+ * @returns Formatted duration string (e.g. "30min", "4.5h", "2.1 weeks")
476
617
  */
477
618
  declare function formatHours(hours: number): string;
478
619
 
479
620
  /**
480
- * Format acceptance rate for display
621
+ * Format AI acceptance rate as a human-readable percentage string.
622
+ * @param rate Rate value between 0 and 1
623
+ * @returns Formatted percentage (e.g. "85%")
481
624
  */
482
625
  declare function formatAcceptanceRate(rate: number): string;
483
626
  /**
484
- * Generate technical value chain for an issue (v0.12 legacy)
627
+ * Generate a technical value chain map for a specific issue category.
628
+ *
629
+ * maps technical metrics (like duplication count) to business outcomes
630
+ * by explaining the impact on AI models and developer workflow.
631
+ *
632
+ * @param params Issue information
633
+ * @param params.issueType Unique identifier for the issue type
634
+ * @param params.count Total occurrences of this issue
635
+ * @param params.severity Severity level of the issues
636
+ * @returns A structured technical value chain object
485
637
  */
486
638
  declare function generateValueChain(params: {
487
639
  issueType: string;
@@ -607,24 +759,43 @@ declare class TypeScriptParser implements LanguageParser {
607
759
  }
608
760
 
609
761
  /**
610
- * Python Parser implementation using tree-sitter
762
+ * Base Language Parser implementation to consolidate shared logic
611
763
  */
612
- declare class PythonParser implements LanguageParser {
613
- readonly language = Language.Python;
614
- readonly extensions: string[];
615
- private parser;
616
- private initialized;
764
+ declare abstract class BaseLanguageParser implements LanguageParser {
765
+ abstract readonly language: Language;
766
+ abstract readonly extensions: string[];
767
+ protected parser: Parser.Parser | null;
768
+ protected initialized: boolean;
617
769
  /**
618
770
  * Initialize the tree-sitter parser
619
771
  */
620
772
  initialize(): Promise<void>;
621
- getAST(code: string, filePath: string): Promise<Parser.Tree | null>;
622
- analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
773
+ /**
774
+ * Get the parser name for tree-sitter setup
775
+ */
776
+ protected abstract getParserName(): string;
777
+ getAST(code: string, _filePath?: string): Promise<Parser.Tree | null>;
778
+ abstract analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
623
779
  parse(code: string, filePath: string): ParseResult;
624
- private extractImportsAST;
625
- private extractExportsAST;
780
+ protected abstract extractImportsAST(rootNode: Parser.Node): ImportInfo[];
781
+ protected abstract extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
782
+ protected abstract parseRegex(code: string, filePath: string): ParseResult;
783
+ abstract getNamingConventions(): NamingConvention;
784
+ canHandle(filePath: string): boolean;
785
+ }
786
+
787
+ /**
788
+ * Python Parser implementation using tree-sitter
789
+ */
790
+ declare class PythonParser extends BaseLanguageParser {
791
+ readonly language = Language.Python;
792
+ readonly extensions: string[];
793
+ protected getParserName(): string;
794
+ analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
795
+ protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
796
+ protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
626
797
  private extractParameters;
627
- private parseRegex;
798
+ protected parseRegex(code: string, filePath: string): ParseResult;
628
799
  getNamingConventions(): NamingConvention;
629
800
  canHandle(filePath: string): boolean;
630
801
  private extractImportsRegex;
@@ -634,21 +805,14 @@ declare class PythonParser implements LanguageParser {
634
805
  /**
635
806
  * Java Parser implementation using tree-sitter
636
807
  */
637
- declare class JavaParser implements LanguageParser {
808
+ declare class JavaParser extends BaseLanguageParser {
638
809
  readonly language = Language.Java;
639
810
  readonly extensions: string[];
640
- private parser;
641
- private initialized;
642
- /**
643
- * Initialize the tree-sitter parser
644
- */
645
- initialize(): Promise<void>;
646
- getAST(code: string, filePath: string): Promise<Parser.Tree | null>;
811
+ protected getParserName(): string;
647
812
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
648
- parse(code: string, filePath: string): ParseResult;
649
- private parseRegex;
650
- private extractImportsAST;
651
- private extractExportsAST;
813
+ protected parseRegex(code: string): ParseResult;
814
+ protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
815
+ protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
652
816
  private getModifiers;
653
817
  private extractSubExports;
654
818
  private extractParameters;
@@ -659,21 +823,14 @@ declare class JavaParser implements LanguageParser {
659
823
  /**
660
824
  * C# Parser implementation using tree-sitter
661
825
  */
662
- declare class CSharpParser implements LanguageParser {
826
+ declare class CSharpParser extends BaseLanguageParser {
663
827
  readonly language = Language.CSharp;
664
828
  readonly extensions: string[];
665
- private parser;
666
- private initialized;
667
- /**
668
- * Initialize the tree-sitter parser
669
- */
670
- initialize(): Promise<void>;
671
- getAST(code: string, filePath: string): Promise<Parser.Tree | null>;
829
+ protected getParserName(): string;
672
830
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
673
- parse(code: string, filePath: string): ParseResult;
674
- private parseRegex;
675
- private extractImportsAST;
676
- private extractExportsAST;
831
+ protected parseRegex(code: string): ParseResult;
832
+ protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
833
+ protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
677
834
  private getModifiers;
678
835
  private extractParameters;
679
836
  getNamingConventions(): NamingConvention;
@@ -683,21 +840,14 @@ declare class CSharpParser implements LanguageParser {
683
840
  /**
684
841
  * Go Parser implementation using tree-sitter
685
842
  */
686
- declare class GoParser implements LanguageParser {
843
+ declare class GoParser extends BaseLanguageParser {
687
844
  readonly language = Language.Go;
688
845
  readonly extensions: string[];
689
- private parser;
690
- private initialized;
691
- /**
692
- * Initialize the tree-sitter parser
693
- */
694
- initialize(): Promise<void>;
695
- getAST(code: string, filePath: string): Promise<Parser.Tree | null>;
846
+ protected getParserName(): string;
696
847
  analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
697
- parse(code: string, filePath: string): ParseResult;
698
- private parseRegex;
699
- private extractImportsAST;
700
- private extractExportsAST;
848
+ protected parseRegex(code: string): ParseResult;
849
+ protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
850
+ protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
701
851
  private extractParameters;
702
852
  getNamingConventions(): NamingConvention;
703
853
  canHandle(filePath: string): boolean;
@@ -757,31 +907,64 @@ declare function calculateSemanticDistance(params: {
757
907
  * Structural Metrics
758
908
  * Measures pattern entropy and concept cohesion.
759
909
  */
910
+ /**
911
+ * Represents the entropy of patterns in a domain
912
+ */
760
913
  interface PatternEntropy {
914
+ /** Domain identifier */
761
915
  domain: string;
916
+ /** Entropy score (0-1) where higher mean more fragmented */
762
917
  entropy: number;
918
+ /** Human-readable structural rating */
763
919
  rating: 'crystalline' | 'well-structured' | 'moderate' | 'fragmented' | 'chaotic';
920
+ /** Distribution metrics */
764
921
  distribution: {
922
+ /** Number of distinct locations */
765
923
  locationCount: number;
924
+ /** Single most frequent location */
766
925
  dominantLocation: string;
926
+ /** Gini coefficient of concentration (0-1) */
767
927
  giniCoefficient: number;
768
928
  };
929
+ /** Recommendations for structural improvement */
769
930
  recommendations: string[];
770
931
  }
932
+ /**
933
+ * A file path with its inferred domain
934
+ */
771
935
  interface FileWithDomain {
772
936
  path: string;
773
937
  domain: string;
774
938
  }
939
+ /**
940
+ * Calculate pattern entropy (degree of fragmentation) for a set of files
941
+ * @param files Array of files with their domains
942
+ * @returns Entropy analysis result
943
+ */
775
944
  declare function calculatePatternEntropy(files: FileWithDomain[]): PatternEntropy;
945
+ /**
946
+ * Measures how focused a set of concepts is within a domain
947
+ */
776
948
  interface ConceptCohesion {
949
+ /** Normalized score (0-1) where 1 is perfect cohesion */
777
950
  score: number;
951
+ /** Human-readable rating */
778
952
  rating: 'excellent' | 'good' | 'moderate' | 'poor';
953
+ /** Detailed cohesion metrics */
779
954
  analysis: {
955
+ /** Number of distinct domains involved */
780
956
  uniqueDomains: number;
957
+ /** Percentage of exports belonging to the dominant domain */
781
958
  domainConcentration: number;
959
+ /** Ratio of unique domains to total exports */
782
960
  exportPurposeClarity: number;
783
961
  };
784
962
  }
963
+ /**
964
+ * Calculate concept cohesion for a set of exports
965
+ * @param params Object containing exports to analyze
966
+ * @returns Cohesion analysis result
967
+ */
785
968
  declare function calculateConceptCohesion(params: {
786
969
  exports: Array<{
787
970
  name: string;
@@ -794,20 +977,41 @@ declare function calculateConceptCohesion(params: {
794
977
  * AI Signal Clarity Metrics
795
978
  * Measures code patterns that increase the likelihood of AI generating incorrect code.
796
979
  */
980
+ /**
981
+ * Represents a single risk signal affecting AI clarity
982
+ */
797
983
  interface AiSignalClaritySignal {
984
+ /** Name of the signal */
798
985
  name: string;
986
+ /** Occurrences of this signal */
799
987
  count: number;
988
+ /** Numerical contribution to the risk score */
800
989
  riskContribution: number;
990
+ /** Human-readable description of the risk */
801
991
  description: string;
992
+ /** Examples of problematic patterns */
802
993
  examples?: string[];
803
994
  }
995
+ /**
996
+ * Complete AI Signal Clarity analysis result
997
+ */
804
998
  interface AiSignalClarity {
999
+ /** Normalized risk score (0-100) where higher means more confusion risk */
805
1000
  score: number;
1001
+ /** Human-readable risk rating */
806
1002
  rating: 'minimal' | 'low' | 'moderate' | 'high' | 'severe';
1003
+ /** Individual signals detected */
807
1004
  signals: AiSignalClaritySignal[];
1005
+ /** The single highest risk factor identified */
808
1006
  topRisk: string;
1007
+ /** Actionable recommendations to improve clarity */
809
1008
  recommendations: string[];
810
1009
  }
1010
+ /**
1011
+ * Calculate AI Signal Clarity metrics based on various code patterns
1012
+ * @param params Object containing counts of various problematic patterns
1013
+ * @returns Clarity analysis result
1014
+ */
811
1015
  declare function calculateAiSignalClarity(params: {
812
1016
  overloadedSymbols: number;
813
1017
  magicLiterals: number;
@@ -965,10 +1169,22 @@ declare function calculateChangeAmplification(params: {
965
1169
  *
966
1170
  * This module provides technology-agnostic metric primitives that will
967
1171
  * remain valid across changes in AI models, tokenization, and paradigms.
1172
+ *
1173
+ * It focuses on cognitive load, semantic cohesion, and structural entropy.
968
1174
  */
969
1175
 
970
1176
  /**
971
- * Aggregate Future-Proof Score (Base)
1177
+ * Calculate the Aggregate Future-Proof Score based on core structural metrics.
1178
+ *
1179
+ * Combines cognitive load, pattern entropy, and concept cohesion into a single
1180
+ * normalized score that predicts how well AI systems can handle this code in the long term.
1181
+ *
1182
+ * @param params - Configuration for score calculation
1183
+ * @param params.cognitiveLoad - Cognitive load metrics (file size, depth, fragmentation)
1184
+ * @param params.patternEntropy - Structural randomness vs consistency
1185
+ * @param params.conceptCohesion - Semantic alignment within logical blocks
1186
+ * @param params.semanticDistances - Optional measurements of conceptual drift
1187
+ * @returns ToolScoringOutput containing the final score and influencing factors
972
1188
  */
973
1189
  declare function calculateFutureProofScore(params: {
974
1190
  cognitiveLoad: CognitiveLoad;
@@ -977,7 +1193,13 @@ declare function calculateFutureProofScore(params: {
977
1193
  semanticDistances?: SemanticDistance[];
978
1194
  }): ToolScoringOutput;
979
1195
  /**
980
- * Complete Extended Future-Proof Score
1196
+ * Calculate a Comprehensive Extended Future-Proof Score.
1197
+ *
1198
+ * Incorporates secondary signals like documentation drift, dependency health,
1199
+ * and testability index to provide a holistic view of the repository's AI readiness.
1200
+ *
1201
+ * @param params - Comprehensive set of metric outputs
1202
+ * @returns ToolScoringOutput with extended analysis results
981
1203
  */
982
1204
  declare function calculateExtendedFutureProofScore(params: FutureProofRecommendationParams & {
983
1205
  semanticDistances?: SemanticDistance[];
@@ -1062,4 +1284,4 @@ declare function severityToAnnotationLevel(severity: string): 'error' | 'warning
1062
1284
  */
1063
1285
  declare function emitIssuesAsAnnotations(issues: any[]): void;
1064
1286
 
1065
- export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, type ProviderFactoryConfig, 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, buildSimpleProviderScore, buildSpokeOutput, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, createProvider, emitAnnotation, emitIssuesAsAnnotations, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, findLatestReport, findLatestScanReport, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, getWasmPath, groupIssuesByFile, handleCLIError, handleJSONOutput, initTreeSitter, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, severityToAnnotationLevel, validateSpokeOutput, validateWithSchema };
1287
+ export { AIReadyConfig, ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, ExportWithImports, FileImport, type FileWithDomain, GoParser, ImportInfo, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, type ProviderFactoryConfig, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, Severity, Severity as SeverityType, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, buildSimpleProviderScore, buildSpokeOutput, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, createProvider, emitAnnotation, emitIssuesAsAnnotations, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, findLatestReport, findLatestScanReport, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityBadge, getSeverityColor, getSeverityEnum, getSeverityLevel, getSeverityValue, getSupportedLanguages, getWasmPath, groupIssuesByFile, handleCLIError, handleJSONOutput, initTreeSitter, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, severityToAnnotationLevel, validateSpokeOutput, validateWithSchema };