@aiready/core 0.23.6 → 0.23.7
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-BrIMPk89.d.mts +1214 -0
- package/dist/client-BrIMPk89.d.ts +1214 -0
- package/dist/client-C5BuGX4F.d.mts +1205 -0
- package/dist/client-C5BuGX4F.d.ts +1205 -0
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.d.mts +458 -136
- package/dist/index.d.ts +458 -136
- package/dist/index.js +137 -34
- package/dist/index.mjs +137 -31
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as Severity, A as AnalysisResult, E as ExportWithImports,
|
|
2
|
-
export { n as
|
|
1
|
+
import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as ToolOptions, d as Severity, A as AnalysisResult, E as ExportWithImports, 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-C5BuGX4F.js';
|
|
2
|
+
export { n as ASTNode, o as AnalysisResultSchema, p as AnalysisStatus, q as AnalysisStatusSchema, B as BusinessMetrics, r as COMMON_FINE_TUNING_OPTIONS, s as CONTEXT_TIER_THRESHOLDS, t as CommonASTNode, u as Config, D as DEFAULT_TOOL_WEIGHTS, v as FRIENDLY_TOOL_NAMES, w as FileContent, G as GLOBAL_INFRA_OPTIONS, x as GLOBAL_SCAN_OPTIONS, y as GraphData, z as GraphEdge, H as GraphIssueSeverity, J as GraphMetadata, K as GraphNode, O as Issue, Q as IssueSchema, R as IssueType, U as IssueTypeSchema, V as LANGUAGE_EXTENSIONS, W as LanguageConfig, X as Lead, Y as LeadSchema, Z as LeadSource, _ as LeadSourceSchema, $ as LeadSubmission, a0 as LeadSubmissionSchema, a1 as Location, a2 as LocationSchema, a3 as ManagedAccount, a4 as ManagedAccountSchema, a5 as Metrics, a6 as MetricsSchema, a7 as ModelTier, a8 as ModelTierSchema, a9 as ParseError, aa as ParseStatistics, ab as ReadinessRating, ac as RecommendationPriority, ad as SCORING_PROFILES, ae as SIZE_ADJUSTED_THRESHOLDS, af as ScanResult, ag as ScoringConfig, ah as ScoringProfile, ai as ScoringResult, aj as SeveritySchema, ak as SourceLocation, al as SourceRange, am as SpokeOutputSchema, an as SpokeSummary, ao as SpokeSummarySchema, ap as TOOL_NAME_MAP, aq as ToolNameSchema, ar as ToolOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-C5BuGX4F.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';
|
|
@@ -29,13 +29,22 @@ interface ToolProvider {
|
|
|
29
29
|
/**
|
|
30
30
|
* Validation utility to ensure a spoke's output matches the expected contract.
|
|
31
31
|
* Used in spoke tests to catch breakages early.
|
|
32
|
+
*
|
|
33
|
+
* @param toolName - Name of the tool being validated.
|
|
34
|
+
* @param output - The raw output data to check.
|
|
35
|
+
* @returns Validation result with boolean flag and any errors found.
|
|
32
36
|
*/
|
|
33
37
|
declare function validateSpokeOutput(toolName: string, output: any): {
|
|
34
38
|
valid: boolean;
|
|
35
39
|
errors: string[];
|
|
36
40
|
};
|
|
37
41
|
/**
|
|
38
|
-
* Zod-based validation (Round 1 improvement)
|
|
42
|
+
* Zod-based validation (Round 1 improvement).
|
|
43
|
+
*
|
|
44
|
+
* @param schema - Zod schema to validate against.
|
|
45
|
+
* @param data - Raw data to parse.
|
|
46
|
+
* @returns Result object with valid flag and typed data or errors.
|
|
47
|
+
* @lastUpdated 2026-03-18
|
|
39
48
|
*/
|
|
40
49
|
declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: any): {
|
|
41
50
|
valid: boolean;
|
|
@@ -136,18 +145,19 @@ declare const DEFAULT_EXCLUDE: string[];
|
|
|
136
145
|
*/
|
|
137
146
|
declare const VAGUE_FILE_NAMES: Set<string>;
|
|
138
147
|
/**
|
|
139
|
-
* Scan files in a directory using glob patterns
|
|
140
|
-
*
|
|
141
|
-
* Note: This scanner supports multiple languages (.ts, .tsx, .js, .jsx, .py, .java, etc.)
|
|
142
|
-
* Individual tools can filter to their supported languages if needed.
|
|
148
|
+
* Scan files in a directory using glob patterns, respecting .aireadyignore and defaults.
|
|
143
149
|
*
|
|
144
|
-
* @param options - Scan configuration
|
|
145
|
-
* @returns Array of absolute file paths matching the patterns
|
|
150
|
+
* @param options - Scan configuration including rootDir, include/exclude, and includeTests.
|
|
151
|
+
* @returns Array of absolute file paths matching the patterns.
|
|
146
152
|
*/
|
|
147
153
|
declare function scanFiles(options: ScanOptions): Promise<string[]>;
|
|
148
154
|
/**
|
|
149
|
-
* Scan for both files and directories, respecting ignore rules.
|
|
155
|
+
* Scan for both files and directories, respecting ignore rules and .gitignore.
|
|
150
156
|
* Useful for tools that need to analyze directory structure.
|
|
157
|
+
*
|
|
158
|
+
* @param options - Scan configuration.
|
|
159
|
+
* @returns Object containing arrays of files and directories.
|
|
160
|
+
* @lastUpdated 2026-03-18
|
|
151
161
|
*/
|
|
152
162
|
declare function scanEntries(options: ScanOptions): Promise<{
|
|
153
163
|
files: string[];
|
|
@@ -191,32 +201,28 @@ declare function isSourceFile(filePath: string): boolean;
|
|
|
191
201
|
|
|
192
202
|
/**
|
|
193
203
|
* Common CLI configuration interface
|
|
204
|
+
* @deprecated Use ToolOptions from @aiready/core instead
|
|
194
205
|
*/
|
|
195
|
-
|
|
196
|
-
/** Root directory for analysis */
|
|
197
|
-
rootDir: string;
|
|
198
|
-
/** Glob patterns to include */
|
|
199
|
-
include?: string[];
|
|
200
|
-
/** Glob patterns to exclude */
|
|
201
|
-
exclude?: string[];
|
|
202
|
-
/** Any other tool-specific options */
|
|
203
|
-
[key: string]: any;
|
|
204
|
-
}
|
|
206
|
+
type CLIOptions = ToolOptions;
|
|
205
207
|
/**
|
|
206
|
-
* Resolve output file path, defaulting to .aiready directory
|
|
208
|
+
* Resolve output file path, defaulting to .aiready directory.
|
|
207
209
|
* Creates parent directories if they don't exist.
|
|
208
|
-
*
|
|
209
|
-
* @param
|
|
210
|
-
* @param
|
|
211
|
-
* @
|
|
210
|
+
*
|
|
211
|
+
* @param userPath - User-provided output path (optional).
|
|
212
|
+
* @param defaultFilename - Default filename to use.
|
|
213
|
+
* @param workingDir - Working directory (default: process.cwd()).
|
|
214
|
+
* @returns Resolved absolute path.
|
|
215
|
+
* @lastUpdated 2026-03-18
|
|
212
216
|
*/
|
|
213
217
|
declare function resolveOutputPath(userPath: string | undefined, defaultFilename: string, workingDir?: string): string;
|
|
214
218
|
/**
|
|
215
|
-
* Load and merge configuration with CLI options
|
|
216
|
-
*
|
|
217
|
-
* @param
|
|
218
|
-
* @param
|
|
219
|
-
* @
|
|
219
|
+
* Load and merge configuration with CLI options.
|
|
220
|
+
*
|
|
221
|
+
* @param directory - Root directory to load config from.
|
|
222
|
+
* @param defaults - Default configuration values.
|
|
223
|
+
* @param cliOptions - Configuration overrides from CLI arguments.
|
|
224
|
+
* @returns Merged configuration object.
|
|
225
|
+
* @lastUpdated 2026-03-18
|
|
220
226
|
*/
|
|
221
227
|
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): Promise<T & {
|
|
222
228
|
rootDir: string;
|
|
@@ -224,34 +230,45 @@ declare function loadMergedConfig<T extends Record<string, any>>(directory: stri
|
|
|
224
230
|
/**
|
|
225
231
|
* Handle JSON output for CLI commands.
|
|
226
232
|
* Writes to file if outputFile is provided, otherwise logs to console.
|
|
227
|
-
*
|
|
228
|
-
* @param
|
|
229
|
-
* @param
|
|
233
|
+
*
|
|
234
|
+
* @param data - Data to output.
|
|
235
|
+
* @param outputFile - Optional path to save JSON file.
|
|
236
|
+
* @param successMessage - Optional message to show on success.
|
|
237
|
+
* @lastUpdated 2026-03-18
|
|
230
238
|
*/
|
|
231
239
|
declare function handleJSONOutput(data: any, outputFile?: string, successMessage?: string): void;
|
|
232
240
|
/**
|
|
233
241
|
* Common error handler for CLI commands.
|
|
234
242
|
* Logs error and exits process with code 1.
|
|
235
|
-
*
|
|
236
|
-
* @param
|
|
243
|
+
*
|
|
244
|
+
* @param error - Error object or message.
|
|
245
|
+
* @param commandName - Name of the command that failed.
|
|
246
|
+
* @returns Never returns as it exits the process.
|
|
247
|
+
* @lastUpdated 2026-03-18
|
|
237
248
|
*/
|
|
238
249
|
declare function handleCLIError(error: unknown, commandName: string): never;
|
|
239
250
|
/**
|
|
240
251
|
* Calculate elapsed time and format for display
|
|
241
|
-
*
|
|
242
|
-
* @
|
|
252
|
+
*
|
|
253
|
+
* @param startTime - Start timestamp in milliseconds.
|
|
254
|
+
* @returns Formatted duration string in seconds.
|
|
255
|
+
* @lastUpdated 2026-03-18
|
|
243
256
|
*/
|
|
244
257
|
declare function getElapsedTime(startTime: number): string;
|
|
245
258
|
/**
|
|
246
259
|
* Generate a visual score bar for console output
|
|
247
|
-
*
|
|
248
|
-
* @
|
|
260
|
+
*
|
|
261
|
+
* @param val - Score value between 0 and 100.
|
|
262
|
+
* @returns String representation of the bar (e.g., "█████░░░░░").
|
|
263
|
+
* @lastUpdated 2026-03-18
|
|
249
264
|
*/
|
|
250
265
|
declare function getScoreBar(val: number): string;
|
|
251
266
|
/**
|
|
252
267
|
* Get status icon for safety ratings
|
|
253
|
-
*
|
|
254
|
-
* @
|
|
268
|
+
*
|
|
269
|
+
* @param rating - The safety rating slug.
|
|
270
|
+
* @returns Emoji icon representing the rating.
|
|
271
|
+
* @lastUpdated 2026-03-18
|
|
255
272
|
*/
|
|
256
273
|
declare function getSafetyIcon(rating: string): string;
|
|
257
274
|
/**
|
|
@@ -266,9 +283,11 @@ declare function getSafetyIcon(rating: string): string;
|
|
|
266
283
|
declare function emitProgress(processed: number, total: number, toolId: string, message: string, onProgress?: (processed: number, total: number, message: string) => void, throttleCount?: number): void;
|
|
267
284
|
/**
|
|
268
285
|
* Get chalk color function for a given severity
|
|
269
|
-
*
|
|
270
|
-
* @param
|
|
271
|
-
* @
|
|
286
|
+
*
|
|
287
|
+
* @param severity - Severity level string.
|
|
288
|
+
* @param chalkInstance - Optional chalk instance to use.
|
|
289
|
+
* @returns Chalk color function.
|
|
290
|
+
* @lastUpdated 2026-03-18
|
|
272
291
|
*/
|
|
273
292
|
declare function getSeverityColor(severity: string, chalkInstance?: any): any;
|
|
274
293
|
/**
|
|
@@ -299,15 +318,19 @@ declare function getSeverityEnum(s: string | undefined): any;
|
|
|
299
318
|
/**
|
|
300
319
|
* Find the latest aiready report in a directory by modification time.
|
|
301
320
|
* Searches for both new format (aiready-report-*) and legacy format (aiready-scan-*).
|
|
302
|
-
*
|
|
303
|
-
* @
|
|
321
|
+
*
|
|
322
|
+
* @param dirPath - The directory path to search for .aiready directory.
|
|
323
|
+
* @returns The path to the latest report or null if not found.
|
|
324
|
+
* @lastUpdated 2026-03-18
|
|
304
325
|
*/
|
|
305
326
|
declare function findLatestReport(dirPath: string): string | null;
|
|
306
327
|
/**
|
|
307
328
|
* Find the latest scan report file with a specific prefix.
|
|
308
|
-
*
|
|
309
|
-
* @param
|
|
310
|
-
* @
|
|
329
|
+
*
|
|
330
|
+
* @param scanReportsDir - Directory containing reports.
|
|
331
|
+
* @param reportFilePrefix - Filename prefix to match (e.g. "report-").
|
|
332
|
+
* @returns Path to the latest matching report or null.
|
|
333
|
+
* @lastUpdated 2026-03-18
|
|
311
334
|
*/
|
|
312
335
|
declare function findLatestScanReport(scanReportsDir: string, reportFilePrefix: string): string | null;
|
|
313
336
|
|
|
@@ -320,14 +343,26 @@ declare function findLatestScanReport(scanReportsDir: string, reportFilePrefix:
|
|
|
320
343
|
*/
|
|
321
344
|
declare function groupIssuesByFile(issues: any[]): AnalysisResult[];
|
|
322
345
|
/**
|
|
323
|
-
* Builds a simple
|
|
346
|
+
* Builds a simple ToolScoringOutput from a spoke summary object.
|
|
324
347
|
* Shared across providers whose scoring logic is purely pass-through
|
|
325
348
|
* (score and recommendations are already computed in the analyzer).
|
|
349
|
+
*
|
|
350
|
+
* @param toolName - Identifier for the tool.
|
|
351
|
+
* @param summary - The tool's summary object containing score and recs.
|
|
352
|
+
* @param rawData - Additional raw metrics to include.
|
|
353
|
+
* @returns Standardized scoring output.
|
|
326
354
|
*/
|
|
327
355
|
declare function buildSimpleProviderScore(toolName: string, summary: any, rawData?: any): ToolScoringOutput;
|
|
328
356
|
/**
|
|
329
|
-
* Builds and validates a
|
|
357
|
+
* Builds and validates a SpokeOutput with common provider metadata.
|
|
330
358
|
* This removes repeated schema/metadata boilerplate from spoke providers.
|
|
359
|
+
*
|
|
360
|
+
* @param toolName - Identifier for the tool.
|
|
361
|
+
* @param version - Current version of the spoke.
|
|
362
|
+
* @param summary - Consolidated summary metrics.
|
|
363
|
+
* @param results - Array of file-level analysis results.
|
|
364
|
+
* @param metadata - Optional additional metadata.
|
|
365
|
+
* @returns Validated spoke output object.
|
|
331
366
|
*/
|
|
332
367
|
declare function buildSpokeOutput(toolName: string, version: string, summary: any, results: AnalysisResult[], metadata?: Record<string, unknown>): SpokeOutput;
|
|
333
368
|
interface ProviderFactoryConfig<TReport> {
|
|
@@ -344,21 +379,13 @@ interface ProviderFactoryConfig<TReport> {
|
|
|
344
379
|
/**
|
|
345
380
|
* Creates a tool provider from shared analyze/score plumbing.
|
|
346
381
|
* Spokes only provide report adapters and scoring behavior.
|
|
382
|
+
*
|
|
383
|
+
* @param config - Provider factory configuration with analyze/score logic.
|
|
384
|
+
* @returns A complete ToolProvider implementation.
|
|
385
|
+
* @lastUpdated 2026-03-18
|
|
347
386
|
*/
|
|
348
387
|
declare function createProvider<TReport>(config: ProviderFactoryConfig<TReport>): ToolProvider;
|
|
349
388
|
|
|
350
|
-
/**
|
|
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
|
|
357
|
-
*/
|
|
358
|
-
declare function parseFileExports(code: string, filePath: string): {
|
|
359
|
-
exports: ExportWithImports[];
|
|
360
|
-
imports: FileImport[];
|
|
361
|
-
};
|
|
362
389
|
/**
|
|
363
390
|
* Calculate import-based similarity between two exports using Jaccard index.
|
|
364
391
|
* Returns a score between 0 and 1 representing the overlap in imported symbols.
|
|
@@ -368,31 +395,19 @@ declare function parseFileExports(code: string, filePath: string): {
|
|
|
368
395
|
* @returns Similarity score (0 = no overlap, 1 = identical imports)
|
|
369
396
|
*/
|
|
370
397
|
declare function calculateImportSimilarity(export1: ExportWithImports, export2: ExportWithImports): number;
|
|
398
|
+
|
|
371
399
|
/**
|
|
372
|
-
* Parse
|
|
373
|
-
*
|
|
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.
|
|
400
|
+
* Parse TypeScript/JavaScript file and extract exports with their import dependencies.
|
|
401
|
+
* Automatically handles different languages via the parser factory.
|
|
391
402
|
*
|
|
392
|
-
* @param
|
|
393
|
-
* @
|
|
403
|
+
* @param code - The source code to parse
|
|
404
|
+
* @param filePath - Path to the file (used for language detection and AST metadata)
|
|
405
|
+
* @returns Object containing all identified exports and imports
|
|
394
406
|
*/
|
|
395
|
-
declare function
|
|
407
|
+
declare function parseFileExports(code: string, filePath: string): {
|
|
408
|
+
exports: ExportWithImports[];
|
|
409
|
+
imports: FileImport[];
|
|
410
|
+
};
|
|
396
411
|
|
|
397
412
|
/**
|
|
398
413
|
* Estimate token count for text (rough approximation)
|
|
@@ -533,9 +548,11 @@ declare function calculateTechnicalValueChain(params: {
|
|
|
533
548
|
declare function calculateComprehensionDifficulty(contextBudget: number, importDepth: number, fragmentation: number, modelTier?: ModelContextTier | string): ComprehensionDifficulty;
|
|
534
549
|
|
|
535
550
|
/**
|
|
536
|
-
* Business Value Metrics Module
|
|
551
|
+
* Business Value Metrics Module.
|
|
537
552
|
*
|
|
538
553
|
* Provides business-aligned metrics that quantify ROI and survive technology changes.
|
|
554
|
+
*
|
|
555
|
+
* @lastUpdated 2026-03-18
|
|
539
556
|
*/
|
|
540
557
|
|
|
541
558
|
/**
|
|
@@ -619,8 +636,9 @@ declare function formatHours(hours: number): string;
|
|
|
619
636
|
|
|
620
637
|
/**
|
|
621
638
|
* Format AI acceptance rate as a human-readable percentage string.
|
|
622
|
-
*
|
|
623
|
-
* @
|
|
639
|
+
*
|
|
640
|
+
* @param rate - Rate value between 0 and 1 (e.g. 0.85).
|
|
641
|
+
* @returns Formatted percentage string (e.g. "85%").
|
|
624
642
|
*/
|
|
625
643
|
declare function formatAcceptanceRate(rate: number): string;
|
|
626
644
|
/**
|
|
@@ -650,8 +668,9 @@ declare function generateValueChain(params: {
|
|
|
650
668
|
|
|
651
669
|
/**
|
|
652
670
|
* Factory for creating and managing language parsers.
|
|
653
|
-
*
|
|
654
671
|
* Supports both singleton usage and multiple instances for test isolation.
|
|
672
|
+
*
|
|
673
|
+
* @lastUpdated 2026-03-18
|
|
655
674
|
*/
|
|
656
675
|
declare class ParserFactory {
|
|
657
676
|
private static instance;
|
|
@@ -709,7 +728,11 @@ declare class ParserFactory {
|
|
|
709
728
|
initializeAll(): Promise<void>;
|
|
710
729
|
}
|
|
711
730
|
/**
|
|
712
|
-
* Convenience function to get parser for a file
|
|
731
|
+
* Convenience function to get parser for a file.
|
|
732
|
+
*
|
|
733
|
+
* @param filePath - Path to the file to get a parser for.
|
|
734
|
+
* @returns LanguageParser instance or null if unsupported.
|
|
735
|
+
* @lastUpdated 2026-03-18
|
|
713
736
|
*/
|
|
714
737
|
declare function getParser(filePath: string): LanguageParser | null;
|
|
715
738
|
/**
|
|
@@ -717,7 +740,11 @@ declare function getParser(filePath: string): LanguageParser | null;
|
|
|
717
740
|
*/
|
|
718
741
|
declare function initializeParsers(): Promise<void>;
|
|
719
742
|
/**
|
|
720
|
-
* Convenience function to check if file is supported
|
|
743
|
+
* Convenience function to check if file is supported.
|
|
744
|
+
*
|
|
745
|
+
* @param filePath - Path to the file to check.
|
|
746
|
+
* @returns True if the file extension is supported.
|
|
747
|
+
* @lastUpdated 2026-03-18
|
|
721
748
|
*/
|
|
722
749
|
declare function isFileSupported(filePath: string): boolean;
|
|
723
750
|
/**
|
|
@@ -785,16 +812,52 @@ declare abstract class BaseLanguageParser implements LanguageParser {
|
|
|
785
812
|
}
|
|
786
813
|
|
|
787
814
|
/**
|
|
788
|
-
* Python Parser implementation using tree-sitter
|
|
815
|
+
* Python Parser implementation using tree-sitter.
|
|
816
|
+
* Handles AST-based and Regex-based extraction of imports and exports.
|
|
817
|
+
*
|
|
818
|
+
* @lastUpdated 2026-03-18
|
|
789
819
|
*/
|
|
790
820
|
declare class PythonParser extends BaseLanguageParser {
|
|
791
821
|
readonly language = Language.Python;
|
|
792
822
|
readonly extensions: string[];
|
|
793
823
|
protected getParserName(): string;
|
|
824
|
+
/**
|
|
825
|
+
* Analyze metadata for a Python node (purity, side effects).
|
|
826
|
+
*
|
|
827
|
+
* @param node - Tree-sitter node to analyze.
|
|
828
|
+
* @param code - Source code for context.
|
|
829
|
+
* @returns Partial ExportInfo containing discovered metadata.
|
|
830
|
+
*/
|
|
794
831
|
analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
|
|
832
|
+
/**
|
|
833
|
+
* Extract import information using AST walk.
|
|
834
|
+
*
|
|
835
|
+
* @param rootNode - Root node of the Python AST.
|
|
836
|
+
* @returns Array of discovered ImportInfo objects.
|
|
837
|
+
*/
|
|
795
838
|
protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
|
|
839
|
+
/**
|
|
840
|
+
* Extract export information using AST walk.
|
|
841
|
+
*
|
|
842
|
+
* @param rootNode - Root node of the Python AST.
|
|
843
|
+
* @param code - Source code for documentation extraction.
|
|
844
|
+
* @returns Array of discovered ExportInfo objects.
|
|
845
|
+
*/
|
|
796
846
|
protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
|
|
847
|
+
/**
|
|
848
|
+
* Extract parameter names from a function definition node.
|
|
849
|
+
*
|
|
850
|
+
* @param node - Function definition node.
|
|
851
|
+
* @returns Array of parameter name strings.
|
|
852
|
+
*/
|
|
797
853
|
private extractParameters;
|
|
854
|
+
/**
|
|
855
|
+
* Fallback regex-based parsing when tree-sitter is unavailable.
|
|
856
|
+
*
|
|
857
|
+
* @param code - Source code content.
|
|
858
|
+
* @param filePath - Path to the file being parsed.
|
|
859
|
+
* @returns Consolidated ParseResult.
|
|
860
|
+
*/
|
|
798
861
|
protected parseRegex(code: string, filePath: string): ParseResult;
|
|
799
862
|
getNamingConventions(): NamingConvention;
|
|
800
863
|
canHandle(filePath: string): boolean;
|
|
@@ -803,17 +866,54 @@ declare class PythonParser extends BaseLanguageParser {
|
|
|
803
866
|
}
|
|
804
867
|
|
|
805
868
|
/**
|
|
806
|
-
* Java Parser implementation using tree-sitter
|
|
869
|
+
* Java Parser implementation using tree-sitter.
|
|
870
|
+
* Supports AST-based and Regex-based extraction of class and method metadata.
|
|
871
|
+
*
|
|
872
|
+
* @lastUpdated 2026-03-18
|
|
807
873
|
*/
|
|
808
874
|
declare class JavaParser extends BaseLanguageParser {
|
|
809
875
|
readonly language = Language.Java;
|
|
810
876
|
readonly extensions: string[];
|
|
811
877
|
protected getParserName(): string;
|
|
878
|
+
/**
|
|
879
|
+
* Analyze metadata for a Java node (purity, side effects).
|
|
880
|
+
*
|
|
881
|
+
* @param node - Tree-sitter node to analyze.
|
|
882
|
+
* @param code - Source code for context.
|
|
883
|
+
* @returns Partial ExportInfo containing discovered metadata.
|
|
884
|
+
*/
|
|
812
885
|
analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
|
|
813
886
|
protected parseRegex(code: string): ParseResult;
|
|
887
|
+
/**
|
|
888
|
+
* Extract import information using AST walk.
|
|
889
|
+
*
|
|
890
|
+
* @param rootNode - Root node of the Java AST.
|
|
891
|
+
* @returns Array of discovered ImportInfo objects.
|
|
892
|
+
*/
|
|
814
893
|
protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
|
|
894
|
+
/**
|
|
895
|
+
* Extract export information (classes, interfaces, methods) using AST walk.
|
|
896
|
+
*
|
|
897
|
+
* @param rootNode - Root node of the Java AST.
|
|
898
|
+
* @param code - Source code for documentation extraction.
|
|
899
|
+
* @returns Array of discovered ExportInfo objects.
|
|
900
|
+
*/
|
|
815
901
|
protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
|
|
902
|
+
/**
|
|
903
|
+
* Extract modifiers (visibility, static, etc.) from a node.
|
|
904
|
+
*
|
|
905
|
+
* @param node - AST node to extract modifiers from.
|
|
906
|
+
* @returns Array of modifier strings.
|
|
907
|
+
*/
|
|
816
908
|
private getModifiers;
|
|
909
|
+
/**
|
|
910
|
+
* Extract methods and nested exports from a class or interface body.
|
|
911
|
+
*
|
|
912
|
+
* @param parentNode - Class or interface declaration node.
|
|
913
|
+
* @param parentName - Name of the parent class/interface.
|
|
914
|
+
* @param exports - Array to collect discovered exports into.
|
|
915
|
+
* @param code - Source code for context.
|
|
916
|
+
*/
|
|
817
917
|
private extractSubExports;
|
|
818
918
|
private extractParameters;
|
|
819
919
|
getNamingConventions(): NamingConvention;
|
|
@@ -821,15 +921,45 @@ declare class JavaParser extends BaseLanguageParser {
|
|
|
821
921
|
}
|
|
822
922
|
|
|
823
923
|
/**
|
|
824
|
-
* C# Parser implementation using tree-sitter
|
|
924
|
+
* C# Parser implementation using tree-sitter.
|
|
925
|
+
* Supports AST-based and Regex-based extraction of namespace-scoped classes and methods.
|
|
926
|
+
*
|
|
927
|
+
* @lastUpdated 2026-03-18
|
|
825
928
|
*/
|
|
826
929
|
declare class CSharpParser extends BaseLanguageParser {
|
|
827
930
|
readonly language = Language.CSharp;
|
|
828
931
|
readonly extensions: string[];
|
|
829
932
|
protected getParserName(): string;
|
|
933
|
+
/**
|
|
934
|
+
* Analyze metadata for a C# node (purity, side effects).
|
|
935
|
+
*
|
|
936
|
+
* @param node - Tree-sitter node to analyze.
|
|
937
|
+
* @param code - Source code for context.
|
|
938
|
+
* @returns Partial ExportInfo containing discovered metadata.
|
|
939
|
+
*/
|
|
830
940
|
analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
|
|
941
|
+
/**
|
|
942
|
+
* Fallback regex-based parsing when tree-sitter is unavailable.
|
|
943
|
+
*
|
|
944
|
+
* @param code - Source code content.
|
|
945
|
+
* @returns Consolidated ParseResult.
|
|
946
|
+
*/
|
|
831
947
|
protected parseRegex(code: string): ParseResult;
|
|
948
|
+
/**
|
|
949
|
+
* Extract import information (usings) using AST walk.
|
|
950
|
+
*
|
|
951
|
+
* @param rootNode - Root node of the C# AST.
|
|
952
|
+
* @returns Array of discovered ImportInfo objects.
|
|
953
|
+
*/
|
|
832
954
|
protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
|
|
955
|
+
/**
|
|
956
|
+
* Extract export information (classes, methods, properties) using AST walk.
|
|
957
|
+
* Handles nested namespaces and classes.
|
|
958
|
+
*
|
|
959
|
+
* @param rootNode - Root node of the C# AST.
|
|
960
|
+
* @param code - Source code for documentation extraction.
|
|
961
|
+
* @returns Array of discovered ExportInfo objects.
|
|
962
|
+
*/
|
|
833
963
|
protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
|
|
834
964
|
private getModifiers;
|
|
835
965
|
private extractParameters;
|
|
@@ -838,15 +968,44 @@ declare class CSharpParser extends BaseLanguageParser {
|
|
|
838
968
|
}
|
|
839
969
|
|
|
840
970
|
/**
|
|
841
|
-
* Go Parser implementation using tree-sitter
|
|
971
|
+
* Go Parser implementation using tree-sitter.
|
|
972
|
+
* Handles AST-based and Regex-based extraction of functions and types.
|
|
973
|
+
*
|
|
974
|
+
* @lastUpdated 2026-03-18
|
|
842
975
|
*/
|
|
843
976
|
declare class GoParser extends BaseLanguageParser {
|
|
844
977
|
readonly language = Language.Go;
|
|
845
978
|
readonly extensions: string[];
|
|
846
979
|
protected getParserName(): string;
|
|
980
|
+
/**
|
|
981
|
+
* Analyze metadata for a Go node (purity, side effects).
|
|
982
|
+
*
|
|
983
|
+
* @param node - Tree-sitter node to analyze.
|
|
984
|
+
* @param code - Source code for context.
|
|
985
|
+
* @returns Partial ExportInfo containing discovered metadata.
|
|
986
|
+
*/
|
|
847
987
|
analyzeMetadata(node: Parser.Node, code: string): Partial<ExportInfo>;
|
|
988
|
+
/**
|
|
989
|
+
* Fallback regex-based parsing when tree-sitter is unavailable.
|
|
990
|
+
*
|
|
991
|
+
* @param code - Source code content.
|
|
992
|
+
* @returns Consolidated ParseResult.
|
|
993
|
+
*/
|
|
848
994
|
protected parseRegex(code: string): ParseResult;
|
|
995
|
+
/**
|
|
996
|
+
* Extract import information using AST walk.
|
|
997
|
+
*
|
|
998
|
+
* @param rootNode - Root node of the Go AST.
|
|
999
|
+
* @returns Array of discovered ImportInfo objects.
|
|
1000
|
+
*/
|
|
849
1001
|
protected extractImportsAST(rootNode: Parser.Node): ImportInfo[];
|
|
1002
|
+
/**
|
|
1003
|
+
* Extract export information (functions, types, vars) using AST walk.
|
|
1004
|
+
*
|
|
1005
|
+
* @param rootNode - Root node of the Go AST.
|
|
1006
|
+
* @param code - Source code for documentation extraction.
|
|
1007
|
+
* @returns Array of discovered ExportInfo objects.
|
|
1008
|
+
*/
|
|
850
1009
|
protected extractExportsAST(rootNode: Parser.Node, code: string): ExportInfo[];
|
|
851
1010
|
private extractParameters;
|
|
852
1011
|
getNamingConventions(): NamingConvention;
|
|
@@ -854,8 +1013,13 @@ declare class GoParser extends BaseLanguageParser {
|
|
|
854
1013
|
}
|
|
855
1014
|
|
|
856
1015
|
/**
|
|
857
|
-
* Cognitive Load Metrics
|
|
1016
|
+
* Cognitive Load Metrics.
|
|
858
1017
|
* Measures how much mental effort is required for an AI to understand a file.
|
|
1018
|
+
*
|
|
1019
|
+
* @lastUpdated 2026-03-18
|
|
1020
|
+
*/
|
|
1021
|
+
/**
|
|
1022
|
+
* Individual factor contributing to total cognitive load.
|
|
859
1023
|
*/
|
|
860
1024
|
interface LoadFactor {
|
|
861
1025
|
name: string;
|
|
@@ -863,6 +1027,9 @@ interface LoadFactor {
|
|
|
863
1027
|
weight: number;
|
|
864
1028
|
description: string;
|
|
865
1029
|
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Consolidated Cognitive Load measurement for a source file.
|
|
1032
|
+
*/
|
|
866
1033
|
interface CognitiveLoad {
|
|
867
1034
|
score: number;
|
|
868
1035
|
rating: 'trivial' | 'easy' | 'moderate' | 'difficult' | 'expert';
|
|
@@ -874,6 +1041,17 @@ interface CognitiveLoad {
|
|
|
874
1041
|
conceptCount: number;
|
|
875
1042
|
};
|
|
876
1043
|
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Calculate the Cognitive Load for a file based on its structural properties.
|
|
1046
|
+
*
|
|
1047
|
+
* @param params - Metrics gathered from parsing the file.
|
|
1048
|
+
* @param params.linesOfCode - Number of lines of code.
|
|
1049
|
+
* @param params.exportCount - Number of public exports.
|
|
1050
|
+
* @param params.importCount - Number of external dependencies.
|
|
1051
|
+
* @param params.uniqueConcepts - Number of unique semantic concepts.
|
|
1052
|
+
* @param params.cyclomaticComplexity - Optional complexity score.
|
|
1053
|
+
* @returns Comprehensive CognitiveLoad analysis.
|
|
1054
|
+
*/
|
|
877
1055
|
declare function calculateCognitiveLoad(params: {
|
|
878
1056
|
linesOfCode: number;
|
|
879
1057
|
exportCount: number;
|
|
@@ -883,8 +1061,10 @@ declare function calculateCognitiveLoad(params: {
|
|
|
883
1061
|
}): CognitiveLoad;
|
|
884
1062
|
|
|
885
1063
|
/**
|
|
886
|
-
* Semantic Distance Metrics
|
|
887
|
-
* Measures the conceptual distance between files or domains.
|
|
1064
|
+
* Semantic Distance Metrics.
|
|
1065
|
+
* Measures the conceptual distance between files or domains using import overlap.
|
|
1066
|
+
*
|
|
1067
|
+
* @lastUpdated 2026-03-18
|
|
888
1068
|
*/
|
|
889
1069
|
interface SemanticDistance {
|
|
890
1070
|
between: [string, string];
|
|
@@ -893,6 +1073,19 @@ interface SemanticDistance {
|
|
|
893
1073
|
path: string[];
|
|
894
1074
|
reason: string;
|
|
895
1075
|
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Calculate the semantic distance between two files based on domain and dependency overlap.
|
|
1078
|
+
*
|
|
1079
|
+
* @param params - Comparison parameters.
|
|
1080
|
+
* @param params.file1 - Path to the first file.
|
|
1081
|
+
* @param params.file2 - Path to the second file.
|
|
1082
|
+
* @param params.file1Domain - Logical domain of the first file.
|
|
1083
|
+
* @param params.file2Domain - Logical domain of the second file.
|
|
1084
|
+
* @param params.file1Imports - Set of imports in the first file.
|
|
1085
|
+
* @param params.file2Imports - Set of imports in the second file.
|
|
1086
|
+
* @param params.sharedDependencies - Intersection of imports between both files.
|
|
1087
|
+
* @returns Calculated semantic distance and relationship assessment.
|
|
1088
|
+
*/
|
|
896
1089
|
declare function calculateSemanticDistance(params: {
|
|
897
1090
|
file1: string;
|
|
898
1091
|
file2: string;
|
|
@@ -904,8 +1097,10 @@ declare function calculateSemanticDistance(params: {
|
|
|
904
1097
|
}): SemanticDistance;
|
|
905
1098
|
|
|
906
1099
|
/**
|
|
907
|
-
* Structural Metrics
|
|
1100
|
+
* Structural Metrics.
|
|
908
1101
|
* Measures pattern entropy and concept cohesion.
|
|
1102
|
+
*
|
|
1103
|
+
* @lastUpdated 2026-03-18
|
|
909
1104
|
*/
|
|
910
1105
|
/**
|
|
911
1106
|
* Represents the entropy of patterns in a domain
|
|
@@ -932,8 +1127,13 @@ interface PatternEntropy {
|
|
|
932
1127
|
/**
|
|
933
1128
|
* A file path with its inferred domain
|
|
934
1129
|
*/
|
|
1130
|
+
/**
|
|
1131
|
+
* Represents a file path associated with its inferred domain.
|
|
1132
|
+
*/
|
|
935
1133
|
interface FileWithDomain {
|
|
1134
|
+
/** Relative or absolute path to the file. */
|
|
936
1135
|
path: string;
|
|
1136
|
+
/** Logical domain the file belongs to (e.g., "auth", "api"). */
|
|
937
1137
|
domain: string;
|
|
938
1138
|
}
|
|
939
1139
|
/**
|
|
@@ -943,20 +1143,21 @@ interface FileWithDomain {
|
|
|
943
1143
|
*/
|
|
944
1144
|
declare function calculatePatternEntropy(files: FileWithDomain[]): PatternEntropy;
|
|
945
1145
|
/**
|
|
946
|
-
* Measures how focused a set of concepts is within a domain
|
|
1146
|
+
* Measures how focused a set of concepts is within a domain.
|
|
1147
|
+
* Higher cohesion indicates better semantic alignment.
|
|
947
1148
|
*/
|
|
948
1149
|
interface ConceptCohesion {
|
|
949
|
-
/** Normalized score (0-1) where 1 is perfect cohesion */
|
|
1150
|
+
/** Normalized score (0-1) where 1 is perfect cohesion. */
|
|
950
1151
|
score: number;
|
|
951
|
-
/** Human-readable rating */
|
|
1152
|
+
/** Human-readable rating. */
|
|
952
1153
|
rating: 'excellent' | 'good' | 'moderate' | 'poor';
|
|
953
|
-
/** Detailed cohesion metrics */
|
|
1154
|
+
/** Detailed cohesion metrics. */
|
|
954
1155
|
analysis: {
|
|
955
|
-
/** Number of distinct domains involved */
|
|
1156
|
+
/** Number of distinct domains involved. */
|
|
956
1157
|
uniqueDomains: number;
|
|
957
|
-
/** Percentage of exports belonging to the dominant domain */
|
|
1158
|
+
/** Percentage of exports belonging to the dominant domain. */
|
|
958
1159
|
domainConcentration: number;
|
|
959
|
-
/** Ratio of unique domains to total exports */
|
|
1160
|
+
/** Ratio of unique domains to total exports. */
|
|
960
1161
|
exportPurposeClarity: number;
|
|
961
1162
|
};
|
|
962
1163
|
}
|
|
@@ -974,8 +1175,10 @@ declare function calculateConceptCohesion(params: {
|
|
|
974
1175
|
}): ConceptCohesion;
|
|
975
1176
|
|
|
976
1177
|
/**
|
|
977
|
-
* AI Signal Clarity Metrics
|
|
1178
|
+
* AI Signal Clarity Metrics.
|
|
978
1179
|
* Measures code patterns that increase the likelihood of AI generating incorrect code.
|
|
1180
|
+
*
|
|
1181
|
+
* @lastUpdated 2026-03-18
|
|
979
1182
|
*/
|
|
980
1183
|
/**
|
|
981
1184
|
* Represents a single risk signal affecting AI clarity
|
|
@@ -1008,9 +1211,20 @@ interface AiSignalClarity {
|
|
|
1008
1211
|
recommendations: string[];
|
|
1009
1212
|
}
|
|
1010
1213
|
/**
|
|
1011
|
-
* Calculate AI Signal Clarity metrics based on various code patterns
|
|
1012
|
-
*
|
|
1013
|
-
* @
|
|
1214
|
+
* Calculate AI Signal Clarity metrics based on various documented and undocumented code patterns.
|
|
1215
|
+
*
|
|
1216
|
+
* @param params - Counts of various problematic or beneficial patterns detected during scanning.
|
|
1217
|
+
* @param params.overloadedSymbols - Count of symbols with identical names in different scopes.
|
|
1218
|
+
* @param params.magicLiterals - Count of unnamed constant values.
|
|
1219
|
+
* @param params.booleanTraps - Count of functions with multiple boolean parameters.
|
|
1220
|
+
* @param params.implicitSideEffects - Count of functions with undocumented side effects.
|
|
1221
|
+
* @param params.deepCallbacks - Count of nested callback structures.
|
|
1222
|
+
* @param params.ambiguousNames - Count of non-descriptive identifiers (e.g., 'data', 'info').
|
|
1223
|
+
* @param params.undocumentedExports - Count of public exports missing JSDoc/docstrings.
|
|
1224
|
+
* @param params.largeFiles - Optional count of files exceeding size limits.
|
|
1225
|
+
* @param params.totalSymbols - Total number of symbols analyzed.
|
|
1226
|
+
* @param params.totalExports - Total number of public exports analyzed.
|
|
1227
|
+
* @returns Comprehensive AiSignalClarity analysis.
|
|
1014
1228
|
*/
|
|
1015
1229
|
declare function calculateAiSignalClarity(params: {
|
|
1016
1230
|
overloadedSymbols: number;
|
|
@@ -1026,8 +1240,10 @@ declare function calculateAiSignalClarity(params: {
|
|
|
1026
1240
|
}): AiSignalClarity;
|
|
1027
1241
|
|
|
1028
1242
|
/**
|
|
1029
|
-
* Agent Grounding Metrics
|
|
1030
|
-
* Measures how well an AI agent can navigate a codebase independently.
|
|
1243
|
+
* Agent Grounding Metrics.
|
|
1244
|
+
* Measures how well an AI agent can navigate and understand a codebase independently.
|
|
1245
|
+
*
|
|
1246
|
+
* @lastUpdated 2026-03-18
|
|
1031
1247
|
*/
|
|
1032
1248
|
interface AgentGroundingScore {
|
|
1033
1249
|
score: number;
|
|
@@ -1041,6 +1257,23 @@ interface AgentGroundingScore {
|
|
|
1041
1257
|
};
|
|
1042
1258
|
recommendations: string[];
|
|
1043
1259
|
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Calculate Agent Grounding metrics based on repository structure and documentation quality.
|
|
1262
|
+
*
|
|
1263
|
+
* @param params - Structural and documentation metrics gathered during scanning.
|
|
1264
|
+
* @param params.deepDirectories - Count of directories nested deeper than recommended.
|
|
1265
|
+
* @param params.totalDirectories - Total number of directories analyzed.
|
|
1266
|
+
* @param params.vagueFileNames - Count of files with non-descriptive names.
|
|
1267
|
+
* @param params.totalFiles - Total number of files analyzed.
|
|
1268
|
+
* @param params.hasRootReadme - Whether a README exists in the repository root.
|
|
1269
|
+
* @param params.readmeIsFresh - Whether the root README has been updated recently.
|
|
1270
|
+
* @param params.barrelExports - Count of 'index' files providing consolidated exports.
|
|
1271
|
+
* @param params.untypedExports - Count of exports missing explicit type annotations.
|
|
1272
|
+
* @param params.totalExports - Total number of public exports analyzed.
|
|
1273
|
+
* @param params.inconsistentDomainTerms - Count of terms that conflict with the domain vocabulary.
|
|
1274
|
+
* @param params.domainVocabularySize - Total number of unique domain terms identified.
|
|
1275
|
+
* @returns Comprehensive AgentGroundingScore.
|
|
1276
|
+
*/
|
|
1044
1277
|
declare function calculateAgentGrounding(params: {
|
|
1045
1278
|
deepDirectories: number;
|
|
1046
1279
|
totalDirectories: number;
|
|
@@ -1056,8 +1289,10 @@ declare function calculateAgentGrounding(params: {
|
|
|
1056
1289
|
}): AgentGroundingScore;
|
|
1057
1290
|
|
|
1058
1291
|
/**
|
|
1059
|
-
* Testability Index Metrics
|
|
1060
|
-
* Measures how verifiable AI-generated changes are.
|
|
1292
|
+
* Testability Index Metrics.
|
|
1293
|
+
* Measures how verifiable AI-generated changes are based on local testing infrastructure.
|
|
1294
|
+
*
|
|
1295
|
+
* @lastUpdated 2026-03-18
|
|
1061
1296
|
*/
|
|
1062
1297
|
interface TestabilityIndex {
|
|
1063
1298
|
score: number;
|
|
@@ -1072,6 +1307,22 @@ interface TestabilityIndex {
|
|
|
1072
1307
|
aiChangeSafetyRating: 'safe' | 'moderate-risk' | 'high-risk' | 'blind-risk';
|
|
1073
1308
|
recommendations: string[];
|
|
1074
1309
|
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Calculate the Testability Index for a project.
|
|
1312
|
+
*
|
|
1313
|
+
* @param params - Metrics including coverage, purity, and dependency patterns.
|
|
1314
|
+
* @param params.testFiles - Count of identifiable test files.
|
|
1315
|
+
* @param params.sourceFiles - Total number of source files.
|
|
1316
|
+
* @param params.pureFunctions - Count of functions without side effects.
|
|
1317
|
+
* @param params.totalFunctions - Total number of functions analyzed.
|
|
1318
|
+
* @param params.injectionPatterns - Count of classes using dependency injection.
|
|
1319
|
+
* @param params.totalClasses - Total number of classes analyzed.
|
|
1320
|
+
* @param params.bloatedInterfaces - Count of interfaces with too many methods.
|
|
1321
|
+
* @param params.totalInterfaces - Total number of interfaces analyzed.
|
|
1322
|
+
* @param params.externalStateMutations - Count of nodes that mutate external state.
|
|
1323
|
+
* @param params.hasTestFramework - Whether a testing framework (e.g., Vitest) is detected.
|
|
1324
|
+
* @returns Comprehensive TestabilityIndex analysis.
|
|
1325
|
+
*/
|
|
1075
1326
|
declare function calculateTestabilityIndex(params: {
|
|
1076
1327
|
testFiles: number;
|
|
1077
1328
|
sourceFiles: number;
|
|
@@ -1086,8 +1337,10 @@ declare function calculateTestabilityIndex(params: {
|
|
|
1086
1337
|
}): TestabilityIndex;
|
|
1087
1338
|
|
|
1088
1339
|
/**
|
|
1089
|
-
* Documentation Drift Metrics
|
|
1340
|
+
* Documentation Drift Metrics.
|
|
1090
1341
|
* Measures the risk of documentation becoming out of sync with code.
|
|
1342
|
+
*
|
|
1343
|
+
* @lastUpdated 2026-03-18
|
|
1091
1344
|
*/
|
|
1092
1345
|
interface DocDriftRisk {
|
|
1093
1346
|
score: number;
|
|
@@ -1103,8 +1356,13 @@ interface DocDriftRisk {
|
|
|
1103
1356
|
/**
|
|
1104
1357
|
* Calculate the documentation drift risk score based on various metrics.
|
|
1105
1358
|
*
|
|
1106
|
-
* @param params - The raw metrics for doc-drift analysis
|
|
1107
|
-
* @
|
|
1359
|
+
* @param params - The raw metrics for doc-drift analysis gathered during scanning.
|
|
1360
|
+
* @param params.uncommentedExports - Number of public exports missing documentation.
|
|
1361
|
+
* @param params.totalExports - Total number of public exports analyzed.
|
|
1362
|
+
* @param params.outdatedComments - Count of comments that conflict with recent code changes.
|
|
1363
|
+
* @param params.undocumentedComplexity - Count of complex nodes without explanatory comments.
|
|
1364
|
+
* @param params.actualDrift - Raw drift metric calculated from temporal analysis.
|
|
1365
|
+
* @returns The calculated risk score and prioritized recommendations.
|
|
1108
1366
|
*/
|
|
1109
1367
|
declare function calculateDocDrift(params: {
|
|
1110
1368
|
uncommentedExports: number;
|
|
@@ -1115,8 +1373,10 @@ declare function calculateDocDrift(params: {
|
|
|
1115
1373
|
}): DocDriftRisk;
|
|
1116
1374
|
|
|
1117
1375
|
/**
|
|
1118
|
-
* Dependency Health Metrics
|
|
1119
|
-
* Measures the health and
|
|
1376
|
+
* Dependency Health Metrics.
|
|
1377
|
+
* Measures the health, recency, and security of project dependencies.
|
|
1378
|
+
*
|
|
1379
|
+
* @lastUpdated 2026-03-18
|
|
1120
1380
|
*/
|
|
1121
1381
|
interface DependencyHealthScore {
|
|
1122
1382
|
score: number;
|
|
@@ -1129,6 +1389,16 @@ interface DependencyHealthScore {
|
|
|
1129
1389
|
aiKnowledgeConfidence: 'high' | 'moderate' | 'low' | 'blind';
|
|
1130
1390
|
recommendations: string[];
|
|
1131
1391
|
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Calculate Dependency Health metrics based on version freshness and package metadata.
|
|
1394
|
+
*
|
|
1395
|
+
* @param params - Metrics gathered from package.json and registry lookups.
|
|
1396
|
+
* @param params.totalPackages - Total number of dependencies analyzed.
|
|
1397
|
+
* @param params.outdatedPackages - Count of packages with newer versions available.
|
|
1398
|
+
* @param params.deprecatedPackages - Count of packages marked as deprecated by maintainers.
|
|
1399
|
+
* @param params.trainingCutoffSkew - Normalized skew between dependency release dates and AI training cutoffs.
|
|
1400
|
+
* @returns Comprehensive DependencyHealthScore.
|
|
1401
|
+
*/
|
|
1132
1402
|
declare function calculateDependencyHealth(params: {
|
|
1133
1403
|
totalPackages: number;
|
|
1134
1404
|
outdatedPackages: number;
|
|
@@ -1136,6 +1406,11 @@ declare function calculateDependencyHealth(params: {
|
|
|
1136
1406
|
trainingCutoffSkew: number;
|
|
1137
1407
|
}): DependencyHealthScore;
|
|
1138
1408
|
|
|
1409
|
+
/**
|
|
1410
|
+
* Parameters for generating comprehensive future-proof recommendations.
|
|
1411
|
+
*
|
|
1412
|
+
* @lastUpdated 2026-03-18
|
|
1413
|
+
*/
|
|
1139
1414
|
interface FutureProofRecommendationParams {
|
|
1140
1415
|
cognitiveLoad: CognitiveLoad;
|
|
1141
1416
|
patternEntropy: PatternEntropy;
|
|
@@ -1148,8 +1423,10 @@ interface FutureProofRecommendationParams {
|
|
|
1148
1423
|
}
|
|
1149
1424
|
|
|
1150
1425
|
/**
|
|
1151
|
-
* Change Amplification Metrics
|
|
1152
|
-
* Measures how a change in one file ripples through the system.
|
|
1426
|
+
* Change Amplification Metrics.
|
|
1427
|
+
* Measures how a change in one file ripples through the system via dependency fan-out.
|
|
1428
|
+
*
|
|
1429
|
+
* @lastUpdated 2026-03-18
|
|
1153
1430
|
*/
|
|
1154
1431
|
interface ChangeAmplificationScore {
|
|
1155
1432
|
score: number;
|
|
@@ -1164,6 +1441,13 @@ interface ChangeAmplificationScore {
|
|
|
1164
1441
|
}>;
|
|
1165
1442
|
recommendations: string[];
|
|
1166
1443
|
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Calculate Change Amplification metrics for a set of files in a dependency graph.
|
|
1446
|
+
*
|
|
1447
|
+
* @param params - Structural metrics gathered from link analysis.
|
|
1448
|
+
* @param params.files - List of files with their fan-in/fan-out counts.
|
|
1449
|
+
* @returns Comprehensive ChangeAmplificationScore.
|
|
1450
|
+
*/
|
|
1167
1451
|
declare function calculateChangeAmplification(params: {
|
|
1168
1452
|
files: Array<{
|
|
1169
1453
|
file: string;
|
|
@@ -1173,12 +1457,14 @@ declare function calculateChangeAmplification(params: {
|
|
|
1173
1457
|
}): ChangeAmplificationScore;
|
|
1174
1458
|
|
|
1175
1459
|
/**
|
|
1176
|
-
* Future-Proof AI Metrics Abstraction Layer
|
|
1460
|
+
* Future-Proof AI Metrics Abstraction Layer.
|
|
1177
1461
|
*
|
|
1178
1462
|
* This module provides technology-agnostic metric primitives that will
|
|
1179
1463
|
* remain valid across changes in AI models, tokenization, and paradigms.
|
|
1180
1464
|
*
|
|
1181
1465
|
* It focuses on cognitive load, semantic cohesion, and structural entropy.
|
|
1466
|
+
*
|
|
1467
|
+
* @lastUpdated 2026-03-18
|
|
1182
1468
|
*/
|
|
1183
1469
|
|
|
1184
1470
|
/**
|
|
@@ -1206,8 +1492,8 @@ declare function calculateFutureProofScore(params: {
|
|
|
1206
1492
|
* Incorporates secondary signals like documentation drift, dependency health,
|
|
1207
1493
|
* and testability index to provide a holistic view of the repository's AI readiness.
|
|
1208
1494
|
*
|
|
1209
|
-
* @param params - Comprehensive set of metric outputs
|
|
1210
|
-
* @returns ToolScoringOutput with extended analysis results
|
|
1495
|
+
* @param params - Comprehensive set of metric outputs including grounding and testability.
|
|
1496
|
+
* @returns ToolScoringOutput with extended analysis results and prioritized fixes.
|
|
1211
1497
|
*/
|
|
1212
1498
|
declare function calculateExtendedFutureProofScore(params: FutureProofRecommendationParams & {
|
|
1213
1499
|
semanticDistances?: SemanticDistance[];
|
|
@@ -1220,11 +1506,18 @@ declare function calculateExtendedFutureProofScore(params: FutureProofRecommenda
|
|
|
1220
1506
|
* Stores data in .aiready/history/ directory.
|
|
1221
1507
|
*/
|
|
1222
1508
|
/**
|
|
1223
|
-
* Load score history from disk
|
|
1509
|
+
* Load score history from disk.
|
|
1510
|
+
*
|
|
1511
|
+
* @param rootDir - The project root directory.
|
|
1512
|
+
* @returns Array of history entries.
|
|
1224
1513
|
*/
|
|
1225
1514
|
declare function loadScoreHistory(rootDir: string): any[];
|
|
1226
1515
|
/**
|
|
1227
|
-
* Save score entry to history
|
|
1516
|
+
* Save a new score entry to history.
|
|
1517
|
+
*
|
|
1518
|
+
* @param rootDir - The project root directory.
|
|
1519
|
+
* @param entry - The score data to persist.
|
|
1520
|
+
* @lastUpdated 2026-03-18
|
|
1228
1521
|
*/
|
|
1229
1522
|
declare function saveScoreEntry(rootDir: string, entry: {
|
|
1230
1523
|
overallScore: number;
|
|
@@ -1233,7 +1526,10 @@ declare function saveScoreEntry(rootDir: string, entry: {
|
|
|
1233
1526
|
totalTokens: number;
|
|
1234
1527
|
}): void;
|
|
1235
1528
|
/**
|
|
1236
|
-
* Get summary of recent history
|
|
1529
|
+
* Get a summary of recent history metrics.
|
|
1530
|
+
*
|
|
1531
|
+
* @param rootDir - The project root directory.
|
|
1532
|
+
* @returns Summary object with totals and averages.
|
|
1237
1533
|
*/
|
|
1238
1534
|
declare function getHistorySummary(rootDir: string): {
|
|
1239
1535
|
totalScans: number;
|
|
@@ -1242,24 +1538,42 @@ declare function getHistorySummary(rootDir: string): {
|
|
|
1242
1538
|
avgScore: number;
|
|
1243
1539
|
};
|
|
1244
1540
|
/**
|
|
1245
|
-
* Export history for external analysis
|
|
1541
|
+
* Export history for external analysis.
|
|
1542
|
+
*
|
|
1543
|
+
* @param rootDir - The project root directory.
|
|
1544
|
+
* @param format - Export format ('json' or 'csv').
|
|
1545
|
+
* @returns Formatted history string.
|
|
1246
1546
|
*/
|
|
1247
1547
|
declare function exportHistory(rootDir: string, format?: 'json' | 'csv'): string;
|
|
1248
1548
|
/**
|
|
1249
|
-
* Clear history (for testing or reset)
|
|
1549
|
+
* Clear history (for testing or reset).
|
|
1550
|
+
*
|
|
1551
|
+
* @param rootDir - The project root directory.
|
|
1250
1552
|
*/
|
|
1251
1553
|
declare function clearHistory(rootDir: string): void;
|
|
1252
1554
|
|
|
1253
1555
|
/**
|
|
1254
|
-
* Get git commit timestamps for each line in a file
|
|
1556
|
+
* Get git commit timestamps for each line in a file using git blame.
|
|
1557
|
+
*
|
|
1558
|
+
* @param file - Absolute path to the file to blame.
|
|
1559
|
+
* @returns Map of line numbers to unix timestamps.
|
|
1255
1560
|
*/
|
|
1256
1561
|
declare function getFileCommitTimestamps(file: string): Record<number, number>;
|
|
1257
1562
|
/**
|
|
1258
|
-
* Get the latest commit timestamp for a line range
|
|
1563
|
+
* Get the latest commit timestamp for a specific line range.
|
|
1564
|
+
*
|
|
1565
|
+
* @param lineStamps - Pre-computed map of line timestamps.
|
|
1566
|
+
* @param startLine - Start of the range (1-indexed).
|
|
1567
|
+
* @param endLine - End of the range (inclusive).
|
|
1568
|
+
* @returns The most recent unix timestamp in the range.
|
|
1259
1569
|
*/
|
|
1260
1570
|
declare function getLineRangeLastModifiedCached(lineStamps: Record<number, number>, startLine: number, endLine: number): number;
|
|
1261
1571
|
/**
|
|
1262
|
-
* Get repository metadata
|
|
1572
|
+
* Get repository metadata including URL, branch, commit, and last author.
|
|
1573
|
+
*
|
|
1574
|
+
* @param directory - The repository root directory.
|
|
1575
|
+
* @returns Metadata object with git details.
|
|
1576
|
+
* @lastUpdated 2026-03-18
|
|
1263
1577
|
*/
|
|
1264
1578
|
declare function getRepoMetadata(directory: string): {
|
|
1265
1579
|
url?: string;
|
|
@@ -1272,8 +1586,10 @@ declare function getRepoMetadata(directory: string): {
|
|
|
1272
1586
|
* Utilities for GitHub Actions integration
|
|
1273
1587
|
*/
|
|
1274
1588
|
/**
|
|
1275
|
-
* Emit a GitHub Action annotation
|
|
1589
|
+
* Emit a GitHub Action annotation.
|
|
1276
1590
|
* Format: ::(error|warning|notice) file={file},line={line},col={col},title={title}::{message}
|
|
1591
|
+
*
|
|
1592
|
+
* @param params - Annotation parameters including level, file, and message.
|
|
1277
1593
|
*/
|
|
1278
1594
|
declare function emitAnnotation(params: {
|
|
1279
1595
|
level: 'error' | 'warning' | 'notice';
|
|
@@ -1284,12 +1600,18 @@ declare function emitAnnotation(params: {
|
|
|
1284
1600
|
message: string;
|
|
1285
1601
|
}): void;
|
|
1286
1602
|
/**
|
|
1287
|
-
* Map AIReady severity to GitHub Action annotation level
|
|
1603
|
+
* Map AIReady severity to GitHub Action annotation level.
|
|
1604
|
+
*
|
|
1605
|
+
* @param severity - AIReady severity string (e.g., 'critical', 'major').
|
|
1606
|
+
* @returns GitHub Action annotation level ('error', 'warning', or 'notice').
|
|
1288
1607
|
*/
|
|
1289
1608
|
declare function severityToAnnotationLevel(severity: string): 'error' | 'warning' | 'notice';
|
|
1290
1609
|
/**
|
|
1291
|
-
* Emit multiple annotations from an array of issues
|
|
1610
|
+
* Emit multiple annotations from an array of issues.
|
|
1611
|
+
*
|
|
1612
|
+
* @param issues - Array of issue objects to annotate.
|
|
1613
|
+
* @lastUpdated 2026-03-18
|
|
1292
1614
|
*/
|
|
1293
1615
|
declare function emitIssuesAsAnnotations(issues: any[]): void;
|
|
1294
1616
|
|
|
1295
|
-
export { AIReadyConfig,
|
|
1617
|
+
export { AIReadyConfig, 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, ToolOptions, 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, 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, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, severityToAnnotationLevel, validateSpokeOutput, validateWithSchema };
|