@aiready/core 0.9.20 → 0.9.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,274 +1,5 @@
1
- interface AnalysisResult {
2
- fileName: string;
3
- issues: Issue[];
4
- metrics: Metrics;
5
- }
6
- interface Issue {
7
- type: IssueType;
8
- severity: 'critical' | 'major' | 'minor' | 'info';
9
- message: string;
10
- location: Location;
11
- suggestion?: string;
12
- }
13
- type IssueType = 'duplicate-pattern' | 'context-fragmentation' | 'doc-drift' | 'naming-inconsistency' | 'naming-quality' | 'pattern-inconsistency' | 'architecture-inconsistency' | 'dead-code' | 'circular-dependency' | 'missing-types';
14
- interface Location {
15
- file: string;
16
- line: number;
17
- column?: number;
18
- endLine?: number;
19
- endColumn?: number;
20
- }
21
- interface Metrics {
22
- tokenCost?: number;
23
- complexityScore?: number;
24
- consistencyScore?: number;
25
- docFreshnessScore?: number;
26
- }
27
- interface ScanOptions {
28
- rootDir: string;
29
- include?: string[];
30
- exclude?: string[];
31
- maxDepth?: number;
32
- }
33
- interface AIReadyConfig {
34
- scan?: {
35
- include?: string[];
36
- exclude?: string[];
37
- tools?: string[];
38
- };
39
- tools?: {
40
- 'pattern-detect'?: {
41
- enabled?: boolean;
42
- scoreWeight?: number;
43
- minSimilarity?: number;
44
- minLines?: number;
45
- batchSize?: number;
46
- approx?: boolean;
47
- minSharedTokens?: number;
48
- maxCandidatesPerBlock?: number;
49
- streamResults?: boolean;
50
- maxResults?: number;
51
- };
52
- 'context-analyzer'?: {
53
- enabled?: boolean;
54
- scoreWeight?: number;
55
- maxDepth?: number;
56
- maxContextBudget?: number;
57
- minCohesion?: number;
58
- maxFragmentation?: number;
59
- focus?: 'fragmentation' | 'cohesion' | 'depth' | 'all';
60
- includeNodeModules?: boolean;
61
- maxResults?: number;
62
- domainKeywords?: string[];
63
- domainPatterns?: string[];
64
- pathDomainMap?: Record<string, string>;
65
- };
66
- 'consistency'?: {
67
- enabled?: boolean;
68
- scoreWeight?: number;
69
- acceptedAbbreviations?: string[];
70
- shortWords?: string[];
71
- disableChecks?: ('single-letter' | 'abbreviation' | 'convention-mix' | 'unclear' | 'poor-naming')[];
72
- };
73
- [toolName: string]: {
74
- enabled?: boolean;
75
- scoreWeight?: number;
76
- [key: string]: any;
77
- } | undefined;
78
- };
79
- scoring?: {
80
- threshold?: number;
81
- showBreakdown?: boolean;
82
- compareBaseline?: string;
83
- saveTo?: string;
84
- };
85
- output?: {
86
- format?: 'console' | 'json' | 'html';
87
- file?: string;
88
- };
89
- visualizer?: {
90
- groupingDirs?: string[];
91
- graph?: {
92
- maxNodes?: number;
93
- maxEdges?: number;
94
- };
95
- };
96
- }
97
- interface Report {
98
- summary: {
99
- totalFiles: number;
100
- totalIssues: number;
101
- criticalIssues: number;
102
- majorIssues: number;
103
- };
104
- results: AnalysisResult[];
105
- metrics: {
106
- overallScore: number;
107
- tokenCostTotal: number;
108
- avgConsistency: number;
109
- };
110
- }
111
-
112
- /**
113
- * Language-agnostic AST and parser interfaces for multi-language support
114
- *
115
- * This module provides abstractions for parsing different programming languages
116
- * while maintaining a consistent interface for analysis tools.
117
- */
118
- /**
119
- * Supported programming languages
120
- */
121
- declare enum Language {
122
- TypeScript = "typescript",
123
- JavaScript = "javascript",
124
- Python = "python",
125
- Java = "java",
126
- Go = "go",
127
- Rust = "rust",
128
- CSharp = "csharp"
129
- }
130
- /**
131
- * File extensions mapped to languages
132
- */
133
- declare const LANGUAGE_EXTENSIONS: Record<string, Language>;
134
- /**
135
- * Location information in source code
136
- */
137
- interface SourceLocation {
138
- line: number;
139
- column: number;
140
- }
141
- interface SourceRange {
142
- start: SourceLocation;
143
- end: SourceLocation;
144
- }
145
- /**
146
- * Common AST node type (language-agnostic)
147
- */
148
- interface CommonASTNode {
149
- type: string;
150
- loc?: SourceRange;
151
- raw?: any;
152
- }
153
- /**
154
- * Export information (function, class, variable, etc.)
155
- */
156
- interface ExportInfo {
157
- name: string;
158
- type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default' | 'variable';
159
- loc?: SourceRange;
160
- /** Imports used within this export */
161
- imports?: string[];
162
- /** Dependencies on other exports in same file */
163
- dependencies?: string[];
164
- /** TypeScript types referenced */
165
- typeReferences?: string[];
166
- /** For methods: parent class name */
167
- parentClass?: string;
168
- /** For functions/methods: parameters */
169
- parameters?: string[];
170
- /** Visibility (public, private, protected) */
171
- visibility?: 'public' | 'private' | 'protected';
172
- }
173
- /**
174
- * Import information
175
- */
176
- interface ImportInfo {
177
- /** Module being imported from */
178
- source: string;
179
- /** What's being imported */
180
- specifiers: string[];
181
- /** Is this a type-only import (TypeScript) */
182
- isTypeOnly?: boolean;
183
- /** Location in source */
184
- loc?: SourceRange;
185
- }
186
- /**
187
- * Parse result containing exports and imports
188
- */
189
- interface ParseResult {
190
- exports: ExportInfo[];
191
- imports: ImportInfo[];
192
- /** Language of the parsed file */
193
- language: Language;
194
- /** Any parse warnings (non-fatal) */
195
- warnings?: string[];
196
- }
197
- /**
198
- * Naming convention rules per language
199
- */
200
- interface NamingConvention {
201
- /** Allowed variable naming patterns */
202
- variablePattern: RegExp;
203
- /** Allowed function naming patterns */
204
- functionPattern: RegExp;
205
- /** Allowed class naming patterns */
206
- classPattern: RegExp;
207
- /** Allowed constant naming patterns */
208
- constantPattern: RegExp;
209
- /** Language-specific exceptions (e.g., __init__ in Python) */
210
- exceptions?: string[];
211
- }
212
- /**
213
- * Language-specific configuration
214
- */
215
- interface LanguageConfig {
216
- language: Language;
217
- /** File extensions for this language */
218
- extensions: string[];
219
- /** Naming conventions */
220
- namingConventions: NamingConvention;
221
- /** Common abbreviations allowed */
222
- allowedAbbreviations?: string[];
223
- /** Language-specific keywords to ignore */
224
- keywords?: string[];
225
- }
226
- /**
227
- * Abstract interface for language parsers
228
- * Each language implementation should implement this interface
229
- */
230
- interface LanguageParser {
231
- /** Language this parser handles */
232
- readonly language: Language;
233
- /** File extensions this parser supports */
234
- readonly extensions: string[];
235
- /**
236
- * Parse source code and extract structure
237
- * @param code - Source code to parse
238
- * @param filePath - Path to the file (for context)
239
- * @returns Parse result with exports and imports
240
- * @throws ParseError if code has syntax errors
241
- */
242
- parse(code: string, filePath: string): ParseResult;
243
- /**
244
- * Get naming conventions for this language
245
- */
246
- getNamingConventions(): NamingConvention;
247
- /**
248
- * Check if this parser can handle a file
249
- * @param filePath - File path to check
250
- */
251
- canHandle(filePath: string): boolean;
252
- }
253
- /**
254
- * Parser error with location information
255
- */
256
- declare class ParseError extends Error {
257
- readonly filePath: string;
258
- readonly loc?: SourceLocation | undefined;
259
- constructor(message: string, filePath: string, loc?: SourceLocation | undefined);
260
- }
261
- /**
262
- * Statistics about parsed code
263
- */
264
- interface ParseStatistics {
265
- language: Language;
266
- filesAnalyzed: number;
267
- totalExports: number;
268
- totalImports: number;
269
- parseErrors: number;
270
- warnings: number;
271
- }
1
+ import { ScanOptions, AIReadyConfig, LanguageParser, Language, ParseResult, NamingConvention } from './client.mjs';
2
+ export { AnalysisResult, CommonASTNode, DEFAULT_TOOL_WEIGHTS, ExportInfo, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueType, LANGUAGE_EXTENSIONS, LanguageConfig, Location, Metrics, ParseError, ParseStatistics, Report, ScoringConfig, ScoringResult, SourceLocation, SourceRange, TOOL_NAME_MAP, ToolScoringOutput, calculateOverallScore, formatScore, formatToolScore, generateHTML, getRating, getRatingDisplay, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
272
3
 
273
4
  declare const DEFAULT_EXCLUDE: string[];
274
5
  /**
@@ -381,116 +112,6 @@ declare function handleCLIError(error: unknown, commandName: string): never;
381
112
  */
382
113
  declare function getElapsedTime(startTime: number): string;
383
114
 
384
- /**
385
- * AI Readiness Scoring System
386
- *
387
- * Provides dynamic, composable scoring across multiple analysis tools.
388
- * Each tool contributes a 0-100 score with configurable weights.
389
- */
390
- interface ToolScoringOutput {
391
- /** Unique tool identifier (e.g., "pattern-detect") */
392
- toolName: string;
393
- /** Normalized 0-100 score for this tool */
394
- score: number;
395
- /** Raw metrics used to calculate the score */
396
- rawMetrics: Record<string, any>;
397
- /** Factors that influenced the score */
398
- factors: Array<{
399
- name: string;
400
- impact: number;
401
- description: string;
402
- }>;
403
- /** Actionable recommendations with estimated impact */
404
- recommendations: Array<{
405
- action: string;
406
- estimatedImpact: number;
407
- priority: 'high' | 'medium' | 'low';
408
- }>;
409
- }
410
- interface ScoringResult {
411
- /** Overall AI Readiness Score (0-100) */
412
- overall: number;
413
- /** Rating category */
414
- rating: 'Excellent' | 'Good' | 'Fair' | 'Needs Work' | 'Critical';
415
- /** Timestamp of score calculation */
416
- timestamp: string;
417
- /** Tools that contributed to this score */
418
- toolsUsed: string[];
419
- /** Breakdown by tool */
420
- breakdown: ToolScoringOutput[];
421
- /** Calculation details */
422
- calculation: {
423
- formula: string;
424
- weights: Record<string, number>;
425
- normalized: string;
426
- };
427
- }
428
- interface ScoringConfig {
429
- /** Minimum passing score (exit code 1 if below) */
430
- threshold?: number;
431
- /** Show detailed breakdown in output */
432
- showBreakdown?: boolean;
433
- /** Path to baseline JSON for comparison */
434
- compareBaseline?: string;
435
- /** Auto-save score to this path */
436
- saveTo?: string;
437
- }
438
- /**
439
- * Default weights for known tools.
440
- * New tools get weight of 10 if not specified.
441
- */
442
- declare const DEFAULT_TOOL_WEIGHTS: Record<string, number>;
443
- /**
444
- * Tool name normalization map (shorthand -> full name)
445
- */
446
- declare const TOOL_NAME_MAP: Record<string, string>;
447
- /**
448
- * Normalize tool name from shorthand to full name
449
- */
450
- declare function normalizeToolName(shortName: string): string;
451
- /**
452
- * Get tool weight with fallback priority:
453
- * 1. CLI override
454
- * 2. Tool config scoreWeight
455
- * 3. Default weight
456
- * 4. 10 (for unknown tools)
457
- */
458
- declare function getToolWeight(toolName: string, toolConfig?: {
459
- scoreWeight?: number;
460
- }, cliOverride?: number): number;
461
- /**
462
- * Parse weight string from CLI (e.g., "patterns:50,context:30")
463
- */
464
- declare function parseWeightString(weightStr?: string): Map<string, number>;
465
- /**
466
- * Calculate overall AI Readiness Score from multiple tool scores.
467
- *
468
- * Formula: Σ(tool_score × tool_weight) / Σ(active_tool_weights)
469
- *
470
- * This allows dynamic composition - score adjusts automatically
471
- * based on which tools actually ran.
472
- */
473
- declare function calculateOverallScore(toolOutputs: Map<string, ToolScoringOutput>, config?: any, cliWeights?: Map<string, number>): ScoringResult;
474
- /**
475
- * Convert numeric score to rating category
476
- */
477
- declare function getRating(score: number): ScoringResult['rating'];
478
- /**
479
- * Get rating emoji and color for display
480
- */
481
- declare function getRatingDisplay(rating: ScoringResult['rating']): {
482
- emoji: string;
483
- color: string;
484
- };
485
- /**
486
- * Format score for display with rating
487
- */
488
- declare function formatScore(result: ScoringResult): string;
489
- /**
490
- * Format individual tool score for display
491
- */
492
- declare function formatToolScore(output: ToolScoringOutput): string;
493
-
494
115
  /**
495
116
  * Parser Factory - Manages language-specific parsers
496
117
  *
@@ -619,4 +240,4 @@ declare class PythonParser implements LanguageParser {
619
240
  private extractExportsRegex;
620
241
  }
621
242
 
622
- export { type AIReadyConfig, type ASTNode, type AnalysisResult, type CLIOptions, type CommonASTNode, DEFAULT_EXCLUDE, DEFAULT_TOOL_WEIGHTS, type ExportInfo, type ExportWithImports, type FileImport, type ImportInfo, type Issue, type IssueType, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, type Metrics, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, ParserFactory, PythonParser, type Report, type ScanOptions, type ScoringConfig, type ScoringResult, type SourceLocation, type SourceRange, TOOL_NAME_MAP, type ToolScoringOutput, TypeScriptParser, calculateImportSimilarity, calculateOverallScore, estimateTokens, extractFunctions, extractImports, formatScore, formatToolScore, getElapsedTime, getFileExtension, getParser, getRating, getRatingDisplay, getSupportedLanguages, getToolWeight, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, mergeConfigWithDefaults, normalizeToolName, parseCode, parseFileExports, parseWeightString, readFileContent, resolveOutputPath, scanFiles };
243
+ export { AIReadyConfig, type ASTNode, type CLIOptions, DEFAULT_EXCLUDE, type ExportWithImports, type FileImport, Language, LanguageParser, NamingConvention, ParseResult, ParserFactory, PythonParser, ScanOptions, TypeScriptParser, calculateImportSimilarity, estimateTokens, extractFunctions, extractImports, getElapsedTime, getFileExtension, getParser, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, mergeConfigWithDefaults, parseCode, parseFileExports, readFileContent, resolveOutputPath, scanFiles };