@aiready/core 0.23.2 → 0.23.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +325 -103
  54. package/dist/index.d.ts +325 -103
  55. package/dist/index.js +307 -324
  56. package/dist/index.mjs +283 -306
  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
@@ -0,0 +1,1191 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Severity levels for all AIReady issues.
5
+ */
6
+ declare enum Severity {
7
+ Critical = 'critical',
8
+ Major = 'major',
9
+ Minor = 'minor',
10
+ Info = 'info',
11
+ }
12
+ /**
13
+ * Canonical Tool Names (IDs)
14
+ * Used everywhere as the single source of truth for tool identification.
15
+ */
16
+ declare enum ToolName {
17
+ PatternDetect = 'pattern-detect',
18
+ ContextAnalyzer = 'context-analyzer',
19
+ NamingConsistency = 'naming-consistency',
20
+ AiSignalClarity = 'ai-signal-clarity',
21
+ AgentGrounding = 'agent-grounding',
22
+ TestabilityIndex = 'testability-index',
23
+ DocDrift = 'doc-drift',
24
+ DependencyHealth = 'dependency-health',
25
+ ChangeAmplification = 'change-amplification',
26
+ CognitiveLoad = 'cognitive-load',
27
+ PatternEntropy = 'pattern-entropy',
28
+ ConceptCohesion = 'concept-cohesion',
29
+ SemanticDistance = 'semantic-distance',
30
+ }
31
+ /**
32
+ * Standardized issue types across all AIReady tools.
33
+ */
34
+ declare enum IssueType {
35
+ DuplicatePattern = 'duplicate-pattern',
36
+ PatternInconsistency = 'pattern-inconsistency',
37
+ ContextFragmentation = 'context-fragmentation',
38
+ DependencyHealth = 'dependency-health',
39
+ CircularDependency = 'circular-dependency',
40
+ DocDrift = 'doc-drift',
41
+ NamingInconsistency = 'naming-inconsistency',
42
+ NamingQuality = 'naming-quality',
43
+ ArchitectureInconsistency = 'architecture-inconsistency',
44
+ DeadCode = 'dead-code',
45
+ MissingTypes = 'missing-types',
46
+ MagicLiteral = 'magic-literal',
47
+ BooleanTrap = 'boolean-trap',
48
+ AiSignalClarity = 'ai-signal-clarity',
49
+ LowTestability = 'low-testability',
50
+ AgentNavigationFailure = 'agent-navigation-failure',
51
+ AmbiguousApi = 'ambiguous-api',
52
+ ChangeAmplification = 'change-amplification',
53
+ }
54
+ /**
55
+ * AI Model Context Tiers.
56
+ */
57
+ declare enum ModelTier {
58
+ Compact = 'compact',
59
+ Standard = 'standard',
60
+ Extended = 'extended',
61
+ Frontier = 'frontier',
62
+ }
63
+ /**
64
+ * Source code location schema.
65
+ */
66
+ /** Zod schema for Location object */
67
+ declare const LocationSchema: z.ZodObject<
68
+ {
69
+ file: z.ZodString;
70
+ line: z.ZodNumber;
71
+ column: z.ZodOptional<z.ZodNumber>;
72
+ endLine: z.ZodOptional<z.ZodNumber>;
73
+ endColumn: z.ZodOptional<z.ZodNumber>;
74
+ },
75
+ z.core.$strip
76
+ >;
77
+ type Location = z.infer<typeof LocationSchema>;
78
+ /**
79
+ * Standard Issue schema.
80
+ */
81
+ /** Zod schema for Issue object */
82
+ declare const IssueSchema: z.ZodObject<
83
+ {
84
+ type: z.ZodEnum<typeof IssueType>;
85
+ severity: z.ZodEnum<typeof Severity>;
86
+ message: z.ZodString;
87
+ location: z.ZodObject<
88
+ {
89
+ file: z.ZodString;
90
+ line: z.ZodNumber;
91
+ column: z.ZodOptional<z.ZodNumber>;
92
+ endLine: z.ZodOptional<z.ZodNumber>;
93
+ endColumn: z.ZodOptional<z.ZodNumber>;
94
+ },
95
+ z.core.$strip
96
+ >;
97
+ suggestion: z.ZodOptional<z.ZodString>;
98
+ },
99
+ z.core.$strip
100
+ >;
101
+ type Issue = z.infer<typeof IssueSchema>;
102
+ /**
103
+ * Standard Metrics schema.
104
+ */
105
+ /** Zod schema for Metrics object */
106
+ declare const MetricsSchema: z.ZodObject<
107
+ {
108
+ tokenCost: z.ZodOptional<z.ZodNumber>;
109
+ complexityScore: z.ZodOptional<z.ZodNumber>;
110
+ consistencyScore: z.ZodOptional<z.ZodNumber>;
111
+ docFreshnessScore: z.ZodOptional<z.ZodNumber>;
112
+ aiSignalClarityScore: z.ZodOptional<z.ZodNumber>;
113
+ agentGroundingScore: z.ZodOptional<z.ZodNumber>;
114
+ testabilityScore: z.ZodOptional<z.ZodNumber>;
115
+ docDriftScore: z.ZodOptional<z.ZodNumber>;
116
+ dependencyHealthScore: z.ZodOptional<z.ZodNumber>;
117
+ modelContextTier: z.ZodOptional<z.ZodEnum<typeof ModelTier>>;
118
+ estimatedMonthlyCost: z.ZodOptional<z.ZodNumber>;
119
+ estimatedDeveloperHours: z.ZodOptional<z.ZodNumber>;
120
+ comprehensionDifficultyIndex: z.ZodOptional<z.ZodNumber>;
121
+ totalSymbols: z.ZodOptional<z.ZodNumber>;
122
+ totalExports: z.ZodOptional<z.ZodNumber>;
123
+ },
124
+ z.core.$strip
125
+ >;
126
+ type Metrics = z.infer<typeof MetricsSchema>;
127
+ /**
128
+ * Individual file/module analysis result.
129
+ */
130
+ declare const AnalysisResultSchema: z.ZodObject<
131
+ {
132
+ fileName: z.ZodString;
133
+ issues: z.ZodArray<
134
+ z.ZodObject<
135
+ {
136
+ type: z.ZodEnum<typeof IssueType>;
137
+ severity: z.ZodEnum<typeof Severity>;
138
+ message: z.ZodString;
139
+ location: z.ZodObject<
140
+ {
141
+ file: z.ZodString;
142
+ line: z.ZodNumber;
143
+ column: z.ZodOptional<z.ZodNumber>;
144
+ endLine: z.ZodOptional<z.ZodNumber>;
145
+ endColumn: z.ZodOptional<z.ZodNumber>;
146
+ },
147
+ z.core.$strip
148
+ >;
149
+ suggestion: z.ZodOptional<z.ZodString>;
150
+ },
151
+ z.core.$strip
152
+ >
153
+ >;
154
+ metrics: z.ZodObject<
155
+ {
156
+ tokenCost: z.ZodOptional<z.ZodNumber>;
157
+ complexityScore: z.ZodOptional<z.ZodNumber>;
158
+ consistencyScore: z.ZodOptional<z.ZodNumber>;
159
+ docFreshnessScore: z.ZodOptional<z.ZodNumber>;
160
+ aiSignalClarityScore: z.ZodOptional<z.ZodNumber>;
161
+ agentGroundingScore: z.ZodOptional<z.ZodNumber>;
162
+ testabilityScore: z.ZodOptional<z.ZodNumber>;
163
+ docDriftScore: z.ZodOptional<z.ZodNumber>;
164
+ dependencyHealthScore: z.ZodOptional<z.ZodNumber>;
165
+ modelContextTier: z.ZodOptional<z.ZodEnum<typeof ModelTier>>;
166
+ estimatedMonthlyCost: z.ZodOptional<z.ZodNumber>;
167
+ estimatedDeveloperHours: z.ZodOptional<z.ZodNumber>;
168
+ comprehensionDifficultyIndex: z.ZodOptional<z.ZodNumber>;
169
+ totalSymbols: z.ZodOptional<z.ZodNumber>;
170
+ totalExports: z.ZodOptional<z.ZodNumber>;
171
+ },
172
+ z.core.$strip
173
+ >;
174
+ },
175
+ z.core.$strip
176
+ >;
177
+ type AnalysisResult = z.infer<typeof AnalysisResultSchema>;
178
+ /**
179
+ * Standard spoke tool output contract.
180
+ */
181
+ declare const SpokeOutputSchema: z.ZodObject<
182
+ {
183
+ results: z.ZodArray<
184
+ z.ZodObject<
185
+ {
186
+ fileName: z.ZodString;
187
+ issues: z.ZodArray<
188
+ z.ZodObject<
189
+ {
190
+ type: z.ZodEnum<typeof IssueType>;
191
+ severity: z.ZodEnum<typeof Severity>;
192
+ message: z.ZodString;
193
+ location: z.ZodObject<
194
+ {
195
+ file: z.ZodString;
196
+ line: z.ZodNumber;
197
+ column: z.ZodOptional<z.ZodNumber>;
198
+ endLine: z.ZodOptional<z.ZodNumber>;
199
+ endColumn: z.ZodOptional<z.ZodNumber>;
200
+ },
201
+ z.core.$strip
202
+ >;
203
+ suggestion: z.ZodOptional<z.ZodString>;
204
+ },
205
+ z.core.$strip
206
+ >
207
+ >;
208
+ metrics: z.ZodObject<
209
+ {
210
+ tokenCost: z.ZodOptional<z.ZodNumber>;
211
+ complexityScore: z.ZodOptional<z.ZodNumber>;
212
+ consistencyScore: z.ZodOptional<z.ZodNumber>;
213
+ docFreshnessScore: z.ZodOptional<z.ZodNumber>;
214
+ aiSignalClarityScore: z.ZodOptional<z.ZodNumber>;
215
+ agentGroundingScore: z.ZodOptional<z.ZodNumber>;
216
+ testabilityScore: z.ZodOptional<z.ZodNumber>;
217
+ docDriftScore: z.ZodOptional<z.ZodNumber>;
218
+ dependencyHealthScore: z.ZodOptional<z.ZodNumber>;
219
+ modelContextTier: z.ZodOptional<z.ZodEnum<typeof ModelTier>>;
220
+ estimatedMonthlyCost: z.ZodOptional<z.ZodNumber>;
221
+ estimatedDeveloperHours: z.ZodOptional<z.ZodNumber>;
222
+ comprehensionDifficultyIndex: z.ZodOptional<z.ZodNumber>;
223
+ totalSymbols: z.ZodOptional<z.ZodNumber>;
224
+ totalExports: z.ZodOptional<z.ZodNumber>;
225
+ },
226
+ z.core.$strip
227
+ >;
228
+ },
229
+ z.core.$strip
230
+ >
231
+ >;
232
+ summary: z.ZodObject<
233
+ {
234
+ totalFiles: z.ZodOptional<z.ZodNumber>;
235
+ totalIssues: z.ZodOptional<z.ZodNumber>;
236
+ criticalIssues: z.ZodOptional<z.ZodNumber>;
237
+ majorIssues: z.ZodOptional<z.ZodNumber>;
238
+ score: z.ZodOptional<z.ZodNumber>;
239
+ },
240
+ z.core.$catchall<z.ZodAny>
241
+ >;
242
+ metadata: z.ZodOptional<
243
+ z.ZodObject<
244
+ {
245
+ toolName: z.ZodString;
246
+ version: z.ZodOptional<z.ZodString>;
247
+ timestamp: z.ZodOptional<z.ZodString>;
248
+ config: z.ZodOptional<z.ZodAny>;
249
+ },
250
+ z.core.$catchall<z.ZodAny>
251
+ >
252
+ >;
253
+ },
254
+ z.core.$strip
255
+ >;
256
+ type SpokeOutput = z.infer<typeof SpokeOutputSchema>;
257
+ /**
258
+ * Master Unified Report contract (CLI -> Platform).
259
+ */
260
+ declare const UnifiedReportSchema: z.ZodObject<
261
+ {
262
+ summary: z.ZodObject<
263
+ {
264
+ totalFiles: z.ZodNumber;
265
+ totalIssues: z.ZodNumber;
266
+ criticalIssues: z.ZodNumber;
267
+ majorIssues: z.ZodNumber;
268
+ businessImpact: z.ZodOptional<
269
+ z.ZodObject<
270
+ {
271
+ estimatedMonthlyWaste: z.ZodOptional<z.ZodNumber>;
272
+ potentialSavings: z.ZodOptional<z.ZodNumber>;
273
+ productivityHours: z.ZodOptional<z.ZodNumber>;
274
+ },
275
+ z.core.$strip
276
+ >
277
+ >;
278
+ },
279
+ z.core.$strip
280
+ >;
281
+ results: z.ZodArray<
282
+ z.ZodObject<
283
+ {
284
+ fileName: z.ZodString;
285
+ issues: z.ZodArray<
286
+ z.ZodObject<
287
+ {
288
+ type: z.ZodEnum<typeof IssueType>;
289
+ severity: z.ZodEnum<typeof Severity>;
290
+ message: z.ZodString;
291
+ location: z.ZodObject<
292
+ {
293
+ file: z.ZodString;
294
+ line: z.ZodNumber;
295
+ column: z.ZodOptional<z.ZodNumber>;
296
+ endLine: z.ZodOptional<z.ZodNumber>;
297
+ endColumn: z.ZodOptional<z.ZodNumber>;
298
+ },
299
+ z.core.$strip
300
+ >;
301
+ suggestion: z.ZodOptional<z.ZodString>;
302
+ },
303
+ z.core.$strip
304
+ >
305
+ >;
306
+ metrics: z.ZodObject<
307
+ {
308
+ tokenCost: z.ZodOptional<z.ZodNumber>;
309
+ complexityScore: z.ZodOptional<z.ZodNumber>;
310
+ consistencyScore: z.ZodOptional<z.ZodNumber>;
311
+ docFreshnessScore: z.ZodOptional<z.ZodNumber>;
312
+ aiSignalClarityScore: z.ZodOptional<z.ZodNumber>;
313
+ agentGroundingScore: z.ZodOptional<z.ZodNumber>;
314
+ testabilityScore: z.ZodOptional<z.ZodNumber>;
315
+ docDriftScore: z.ZodOptional<z.ZodNumber>;
316
+ dependencyHealthScore: z.ZodOptional<z.ZodNumber>;
317
+ modelContextTier: z.ZodOptional<z.ZodEnum<typeof ModelTier>>;
318
+ estimatedMonthlyCost: z.ZodOptional<z.ZodNumber>;
319
+ estimatedDeveloperHours: z.ZodOptional<z.ZodNumber>;
320
+ comprehensionDifficultyIndex: z.ZodOptional<z.ZodNumber>;
321
+ totalSymbols: z.ZodOptional<z.ZodNumber>;
322
+ totalExports: z.ZodOptional<z.ZodNumber>;
323
+ },
324
+ z.core.$strip
325
+ >;
326
+ },
327
+ z.core.$strip
328
+ >
329
+ >;
330
+ scoring: z.ZodOptional<
331
+ z.ZodObject<
332
+ {
333
+ overall: z.ZodNumber;
334
+ rating: z.ZodString;
335
+ timestamp: z.ZodString;
336
+ breakdown: z.ZodArray<
337
+ z.ZodObject<
338
+ {
339
+ toolName: z.ZodUnion<
340
+ readonly [z.ZodEnum<typeof ToolName>, z.ZodString]
341
+ >;
342
+ score: z.ZodNumber;
343
+ },
344
+ z.core.$catchall<z.ZodAny>
345
+ >
346
+ >;
347
+ },
348
+ z.core.$strip
349
+ >
350
+ >;
351
+ },
352
+ z.core.$catchall<z.ZodAny>
353
+ >;
354
+ type UnifiedReport = z.infer<typeof UnifiedReportSchema>;
355
+
356
+ /**
357
+ * AST Parsing and Export Extraction Types
358
+ */
359
+ interface ExportWithImports {
360
+ name: string;
361
+ type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default';
362
+ imports: string[];
363
+ dependencies: string[];
364
+ typeReferences: string[];
365
+ loc?: {
366
+ start: {
367
+ line: number;
368
+ column: number;
369
+ };
370
+ end: {
371
+ line: number;
372
+ column: number;
373
+ };
374
+ };
375
+ }
376
+ interface FileImport {
377
+ source: string;
378
+ specifiers: string[];
379
+ isTypeOnly: boolean;
380
+ }
381
+ interface ASTNode {
382
+ type: string;
383
+ loc?: {
384
+ start: {
385
+ line: number;
386
+ column: number;
387
+ };
388
+ end: {
389
+ line: number;
390
+ column: number;
391
+ };
392
+ };
393
+ }
394
+ /**
395
+ * AI token budget unit economics (v0.13+)
396
+ */
397
+ interface TokenBudget {
398
+ totalContextTokens: number;
399
+ estimatedResponseTokens?: number;
400
+ wastedTokens: {
401
+ total: number;
402
+ bySource: {
403
+ duplication: number;
404
+ fragmentation: number;
405
+ chattiness: number;
406
+ };
407
+ };
408
+ efficiencyRatio: number;
409
+ potentialRetrievableTokens: number;
410
+ }
411
+
412
+ /**
413
+ * Shared types for graph-based visualizations
414
+ */
415
+ interface GraphNode {
416
+ id: string;
417
+ label: string;
418
+ path?: string;
419
+ size?: number;
420
+ value?: number;
421
+ color?: string;
422
+ group?: string;
423
+ title?: string;
424
+ x?: number;
425
+ y?: number;
426
+ duplicates?: number;
427
+ tokenCost?: number;
428
+ severity?: string;
429
+ }
430
+ interface GraphEdge {
431
+ source: string;
432
+ target: string;
433
+ type?: string;
434
+ weight?: number;
435
+ }
436
+ interface GraphData {
437
+ nodes: GraphNode[];
438
+ edges: GraphEdge[];
439
+ clusters?: {
440
+ id: string;
441
+ name: string;
442
+ nodeIds: string[];
443
+ }[];
444
+ issues?: {
445
+ id: string;
446
+ type: string;
447
+ severity: string;
448
+ nodeIds: string[];
449
+ message: string;
450
+ }[];
451
+ metadata?: any;
452
+ }
453
+
454
+ /**
455
+ * AI readiness configuration
456
+ */
457
+ interface AIReadyConfig {
458
+ threshold?: number;
459
+ include?: string[];
460
+ exclude?: string[];
461
+ scan?: {
462
+ include?: string[];
463
+ exclude?: string[];
464
+ parallel?: boolean;
465
+ deep?: boolean;
466
+ };
467
+ output?: {
468
+ format?: 'json' | 'console' | 'html';
469
+ path?: string;
470
+ saveTo?: string;
471
+ showBreakdown?: boolean;
472
+ compareBaseline?: string;
473
+ };
474
+ tools?: Record<string, any>;
475
+ scoring?: {
476
+ profile?: string;
477
+ weights?: Record<string, number>;
478
+ };
479
+ }
480
+ /**
481
+ * Legacy alias for Config
482
+ */
483
+ type Config = AIReadyConfig;
484
+ /**
485
+ * Common tool options
486
+ */
487
+ interface ToolOptions {
488
+ rootDir: string;
489
+ include?: string[];
490
+ exclude?: string[];
491
+ config?: any;
492
+ [key: string]: any;
493
+ }
494
+ /**
495
+ * Scan options for tool providers
496
+ */
497
+ interface ScanOptions extends ToolOptions {
498
+ output?: string;
499
+ format?: 'json' | 'console' | 'html';
500
+ parallel?: boolean;
501
+ }
502
+ /**
503
+ * Result of a single tool execution
504
+ */
505
+ interface ToolOutput {
506
+ toolName: ToolName | string;
507
+ success: boolean;
508
+ issues: IssueType[] | any[];
509
+ metrics: Metrics;
510
+ duration?: number;
511
+ }
512
+ /**
513
+ * Overall scan result
514
+ */
515
+ interface ScanResult {
516
+ timestamp: string;
517
+ rootDir: string;
518
+ filesAnalyzed: number;
519
+ totalIssues: number;
520
+ issuesByType: Record<string, number>;
521
+ issuesBySeverity: Record<Severity | string, number>;
522
+ score: number;
523
+ tools: ToolOutput[];
524
+ }
525
+ /**
526
+ * Cost configuration for business impact analysis
527
+ */
528
+ interface CostConfig {
529
+ pricePer1KTokens: number;
530
+ queriesPerDevPerDay: number;
531
+ developerCount: number;
532
+ daysPerMonth: number;
533
+ }
534
+ /**
535
+ * Productivity impact metrics
536
+ */
537
+ interface ProductivityImpact {
538
+ totalHours: number;
539
+ hourlyRate: number;
540
+ totalCost: number;
541
+ bySeverity: Record<
542
+ Severity | string,
543
+ {
544
+ hours: number;
545
+ cost: number;
546
+ }
547
+ >;
548
+ }
549
+ /**
550
+ * AI suggestion acceptance prediction
551
+ */
552
+ interface AcceptancePrediction {
553
+ rate: number;
554
+ confidence: number;
555
+ factors: Array<{
556
+ name: string;
557
+ impact: number;
558
+ }>;
559
+ }
560
+ /**
561
+ * Technical Value Chain summary
562
+ */
563
+ interface TechnicalValueChain {
564
+ score?: number;
565
+ density?: number;
566
+ complexity?: number;
567
+ surface?: number;
568
+ issueType?: string;
569
+ technicalMetric?: string;
570
+ technicalValue?: number;
571
+ aiImpact?: {
572
+ description: string;
573
+ scoreImpact: number;
574
+ };
575
+ developerImpact?: {
576
+ description: string;
577
+ productivityLoss: number;
578
+ };
579
+ businessOutcome?: {
580
+ directCost: number;
581
+ opportunityCost: number;
582
+ riskLevel: 'low' | 'moderate' | 'high' | 'critical';
583
+ };
584
+ }
585
+ /**
586
+ * Compatibility alias
587
+ */
588
+ type TechnicalValueChainSummary = TechnicalValueChain;
589
+ /**
590
+ * Code comprehension difficulty metrics
591
+ */
592
+ interface ComprehensionDifficulty {
593
+ score: number;
594
+ rating: 'trivial' | 'easy' | 'moderate' | 'difficult' | 'expert';
595
+ factors: {
596
+ budgetRatio: number;
597
+ depthRatio: number;
598
+ fragmentation: number;
599
+ };
600
+ }
601
+ /**
602
+ * Business impact metrics (v0.10+)
603
+ */
604
+ interface BusinessMetrics {
605
+ estimatedMonthlyCost?: number;
606
+ estimatedDeveloperHours?: number;
607
+ aiAcceptanceRate?: number;
608
+ aiReadinessScore?: number;
609
+ }
610
+ /**
611
+ * Constants for tests and configuration stability
612
+ */
613
+ declare const GLOBAL_INFRA_OPTIONS: string[];
614
+ declare const COMMON_FINE_TUNING_OPTIONS: string[];
615
+
616
+ /**
617
+ * Analysis issue mapping to graph
618
+ */
619
+ type GraphIssueSeverity = Severity;
620
+ /**
621
+ * Graph metadata
622
+ */
623
+ interface GraphMetadata {
624
+ projectName?: string;
625
+ timestamp: string;
626
+ totalFiles: number;
627
+ totalDependencies: number;
628
+ analysisTypes: string[];
629
+ criticalIssues: number;
630
+ majorIssues: number;
631
+ minorIssues: number;
632
+ infoIssues: number;
633
+ /** AI token budget unit economics (v0.13+) */
634
+ tokenBudget?: TokenBudget;
635
+ /** Execution time in milliseconds */
636
+ executionTime?: number;
637
+ }
638
+
639
+ /**
640
+ * Language-agnostic AST and parser interfaces for multi-language support
641
+ *
642
+ * This module provides abstractions for parsing different programming languages
643
+ * while maintaining a consistent interface for analysis tools.
644
+ */
645
+ /**
646
+ * Supported programming languages
647
+ */
648
+ declare enum Language {
649
+ TypeScript = 'typescript',
650
+ JavaScript = 'javascript',
651
+ Python = 'python',
652
+ Java = 'java',
653
+ Go = 'go',
654
+ Rust = 'rust',
655
+ CSharp = 'csharp',
656
+ }
657
+ /**
658
+ * File extensions mapped to languages
659
+ */
660
+ declare const LANGUAGE_EXTENSIONS: Record<string, Language>;
661
+ /**
662
+ * Location information in source code
663
+ */
664
+ interface SourceLocation {
665
+ line: number;
666
+ column: number;
667
+ }
668
+ interface SourceRange {
669
+ start: SourceLocation;
670
+ end: SourceLocation;
671
+ }
672
+ /**
673
+ * Common AST node type (language-agnostic)
674
+ */
675
+ interface CommonASTNode {
676
+ type: string;
677
+ loc?: SourceRange;
678
+ raw?: any;
679
+ }
680
+ /**
681
+ * Export information (function, class, variable, etc.)
682
+ */
683
+ interface ExportInfo {
684
+ name: string;
685
+ type:
686
+ | 'function'
687
+ | 'class'
688
+ | 'const'
689
+ | 'type'
690
+ | 'interface'
691
+ | 'default'
692
+ | 'variable';
693
+ loc?: SourceRange;
694
+ /** Imports used within this export */
695
+ imports?: string[];
696
+ /** Dependencies on other exports in same file */
697
+ dependencies?: string[];
698
+ /** TypeScript types referenced */
699
+ typeReferences?: string[];
700
+ /** For methods: parent class name */
701
+ parentClass?: string;
702
+ /** For functions/methods: parameters */
703
+ parameters?: string[];
704
+ /** For classes/interfaces: number of methods and properties */
705
+ methodCount?: number;
706
+ propertyCount?: number;
707
+ /** Visibility (public, private, protected) */
708
+ visibility?: 'public' | 'private' | 'protected';
709
+ /** Behavioral metadata for advanced metrics */
710
+ isPure?: boolean;
711
+ hasSideEffects?: boolean;
712
+ /** Associated documentation */
713
+ documentation?: {
714
+ content: string;
715
+ type: 'jsdoc' | 'docstring' | 'comment' | 'xml-doc';
716
+ isStale?: boolean;
717
+ };
718
+ }
719
+ /**
720
+ * Import information
721
+ */
722
+ interface ImportInfo {
723
+ /** Module being imported from */
724
+ source: string;
725
+ /** What's being imported */
726
+ specifiers: string[];
727
+ /** Is this a type-only import (TypeScript) */
728
+ isTypeOnly?: boolean;
729
+ /** Location in source */
730
+ loc?: SourceRange;
731
+ }
732
+ /**
733
+ * Parse result containing exports and imports
734
+ */
735
+ interface ParseResult {
736
+ exports: ExportInfo[];
737
+ imports: ImportInfo[];
738
+ /** Language of the parsed file */
739
+ language: Language;
740
+ /** Any parse warnings (non-fatal) */
741
+ warnings?: string[];
742
+ }
743
+ /**
744
+ * Naming convention rules per language
745
+ */
746
+ interface NamingConvention {
747
+ /** Allowed variable naming patterns */
748
+ variablePattern: RegExp;
749
+ /** Allowed function naming patterns */
750
+ functionPattern: RegExp;
751
+ /** Allowed class naming patterns */
752
+ classPattern: RegExp;
753
+ /** Allowed constant naming patterns */
754
+ constantPattern: RegExp;
755
+ /** Allowed type naming patterns */
756
+ typePattern?: RegExp;
757
+ /** Allowed interface naming patterns */
758
+ interfacePattern?: RegExp;
759
+ /** Language-specific exceptions (e.g., __init__ in Python) */
760
+ exceptions?: string[];
761
+ }
762
+ /**
763
+ * Language-specific configuration
764
+ */
765
+ interface LanguageConfig {
766
+ language: Language;
767
+ /** File extensions for this language */
768
+ extensions: string[];
769
+ /** Naming conventions */
770
+ namingConventions: NamingConvention;
771
+ /** Common abbreviations allowed */
772
+ allowedAbbreviations?: string[];
773
+ /** Language-specific keywords to ignore */
774
+ keywords?: string[];
775
+ }
776
+ /**
777
+ * Abstract interface for language parsers
778
+ * Each language implementation should implement this interface
779
+ */
780
+ interface LanguageParser {
781
+ /** Language this parser handles */
782
+ readonly language: Language;
783
+ /** File extensions this parser supports */
784
+ readonly extensions: string[];
785
+ /**
786
+ * Parse source code and extract structure
787
+ * @param code - Source code to parse
788
+ * @param filePath - Path to the file (for context)
789
+ * @returns Parse result with exports and imports
790
+ * @throws ParseError if code has syntax errors
791
+ */
792
+ parse(code: string, filePath: string): ParseResult;
793
+ /**
794
+ * Get naming conventions for this language
795
+ */
796
+ getNamingConventions(): NamingConvention;
797
+ /**
798
+ * Initialize the parser (e.g. load WASM)
799
+ */
800
+ initialize(): Promise<void>;
801
+ /**
802
+ * Check if this parser can handle a file
803
+ * @param filePath - File path to check
804
+ */
805
+ canHandle(filePath: string): boolean;
806
+ /**
807
+ * Get the raw AST for advanced querying
808
+ * @param code - Source code to parse
809
+ * @param filePath - Path to the file
810
+ */
811
+ getAST(code: string, filePath: string): Promise<any>;
812
+ /**
813
+ * Analyze structural metadata for a node (e.g. purity)
814
+ * @param node - The AST node to analyze (language specific)
815
+ * @param code - The original source code
816
+ */
817
+ analyzeMetadata(node: any, code: string): Partial<ExportInfo>;
818
+ }
819
+ /**
820
+ * Parser error with location information
821
+ */
822
+ declare class ParseError extends Error {
823
+ readonly filePath: string;
824
+ readonly loc?: SourceLocation | undefined;
825
+ constructor(
826
+ message: string,
827
+ filePath: string,
828
+ loc?: SourceLocation | undefined
829
+ );
830
+ }
831
+ /**
832
+ * Statistics about parsed code
833
+ */
834
+ interface ParseStatistics {
835
+ language: Language;
836
+ filesAnalyzed: number;
837
+ totalExports: number;
838
+ totalImports: number;
839
+ parseErrors: number;
840
+ warnings: number;
841
+ }
842
+
843
+ /**
844
+ * Priority levels for actionable recommendations
845
+ */
846
+ declare enum RecommendationPriority {
847
+ High = 'high',
848
+ Medium = 'medium',
849
+ Low = 'low',
850
+ }
851
+ /**
852
+ * AI Readiness Rating categories
853
+ */
854
+ declare enum ReadinessRating {
855
+ Excellent = 'Excellent',
856
+ Good = 'Good',
857
+ Fair = 'Fair',
858
+ NeedsWork = 'Needs Work',
859
+ Critical = 'Critical',
860
+ }
861
+ /**
862
+ * Output structure for a single tool's scoring analysis
863
+ */
864
+ interface ToolScoringOutput {
865
+ /** Unique tool identifier (e.g., "pattern-detect") */
866
+ toolName: string;
867
+ /** Normalized 0-100 score for this tool */
868
+ score: number;
869
+ /** AI token budget unit economics (v0.13+) */
870
+ tokenBudget?: TokenBudget;
871
+ /** Raw metrics used to calculate the score */
872
+ rawMetrics: Record<string, any>;
873
+ /** Factors that influenced the score */
874
+ factors: Array<{
875
+ /** Human-readable name of the factor */
876
+ name: string;
877
+ /** Points contribution (positive or negative) */
878
+ impact: number;
879
+ /** Explanation of the factor's impact */
880
+ description: string;
881
+ }>;
882
+ /** Actionable recommendations with estimated impact */
883
+ recommendations: Array<{
884
+ /** The recommended action to take */
885
+ action: string;
886
+ /** Potential points increase if implemented */
887
+ estimatedImpact: number;
888
+ /** Implementation priority */
889
+ priority: RecommendationPriority | 'high' | 'medium' | 'low';
890
+ }>;
891
+ }
892
+ /**
893
+ * Consolidated scoring result across all tools
894
+ */
895
+ interface ScoringResult {
896
+ /** Overall AI Readiness Score (0-100) */
897
+ overall: number;
898
+ /** Rating category representing the overall readiness */
899
+ rating: ReadinessRating | string;
900
+ /** Timestamp of score calculation */
901
+ timestamp: string;
902
+ /** Tools that contributed to this score */
903
+ toolsUsed: string[];
904
+ /** Breakdown by individual tool */
905
+ breakdown: ToolScoringOutput[];
906
+ /** Internal calculation details for transparency */
907
+ calculation: {
908
+ /** Textual representation of the calculation formula */
909
+ formula: string;
910
+ /** Weights applied to each tool */
911
+ weights: Record<string, number>;
912
+ /** Simplified normalized formula output */
913
+ normalized: string;
914
+ };
915
+ }
916
+ /**
917
+ * Configuration options for the scoring system
918
+ */
919
+ interface ScoringConfig {
920
+ /** Minimum passing score (CLI will exit with non-zero if below) */
921
+ threshold?: number;
922
+ /** Whether to show the detailed tool-by-tool breakdown */
923
+ showBreakdown?: boolean;
924
+ /** Path to a baseline report JSON for trend comparison */
925
+ compareBaseline?: string;
926
+ /** Target file path to persist the calculated score */
927
+ saveTo?: string;
928
+ }
929
+ /**
930
+ * Default weights for known tools. Weights sum to 100 and read directly as
931
+ * percentage contribution to the overall score.
932
+ * New tools get weight of 5 if not specified.
933
+ */
934
+ /**
935
+ * Default weights for known tools. Weights sum to 100 and read directly as
936
+ * percentage contribution to the overall score.
937
+ * New tools get weight of 5 if not specified.
938
+ */
939
+ declare const DEFAULT_TOOL_WEIGHTS: Record<string, number>;
940
+ /**
941
+ * Tool name normalization map (shorthand -> canonical name)
942
+ */
943
+ /**
944
+ * Tool name normalization map (shorthand -> canonical name)
945
+ */
946
+ declare const TOOL_NAME_MAP: Record<string, string>;
947
+ /**
948
+ * Model context tiers for context-aware threshold calibration.
949
+ */
950
+ type ModelContextTier = 'compact' | 'standard' | 'extended' | 'frontier';
951
+ /**
952
+ * Scoring profiles for project-type-aware weighting.
953
+ */
954
+ declare enum ScoringProfile {
955
+ Default = 'default',
956
+ Agentic = 'agentic', // Focus on AI agent navigation and signal
957
+ Logic = 'logic', // Focus on testability and complexity
958
+ UI = 'ui', // Focus on consistency and context (lower penalty for magic literals)
959
+ Cost = 'cost', // Focus on token waste (duplication and fragmentation)
960
+ Security = 'security',
961
+ }
962
+ /**
963
+ * Project-type-aware tool weight presets.
964
+ */
965
+ /**
966
+ * Project-type-aware tool weight presets.
967
+ */
968
+ declare const SCORING_PROFILES: Record<ScoringProfile, Record<string, number>>;
969
+ /**
970
+ * Context budget thresholds per tier.
971
+ */
972
+ /**
973
+ * Context budget thresholds per tier.
974
+ */
975
+ declare const CONTEXT_TIER_THRESHOLDS: Record<
976
+ ModelContextTier,
977
+ {
978
+ idealTokens: number;
979
+ criticalTokens: number;
980
+ idealDepth: number;
981
+ }
982
+ >;
983
+ /**
984
+ * Project-size-adjusted minimum thresholds.
985
+ */
986
+ /**
987
+ * Project-size-adjusted minimum thresholds.
988
+ */
989
+ declare const SIZE_ADJUSTED_THRESHOLDS: Record<string, number>;
990
+ /**
991
+ * Determine project size tier based on the total number of files
992
+ *
993
+ * @param fileCount Total number of files in the project
994
+ * @returns A string identifier for the project size tier (xs, small, medium, large, enterprise)
995
+ */
996
+ declare function getProjectSizeTier(
997
+ fileCount: number
998
+ ): keyof typeof SIZE_ADJUSTED_THRESHOLDS;
999
+ /**
1000
+ * Calculate the recommended minimum AI readiness threshold for a project
1001
+ *
1002
+ * @param fileCount Total number of files in the project
1003
+ * @param modelTier The model context tier targeted (compact, standard, extended, frontier)
1004
+ * @returns The recommended score threshold (0-100)
1005
+ */
1006
+ declare function getRecommendedThreshold(
1007
+ fileCount: number,
1008
+ modelTier?: ModelContextTier
1009
+ ): number;
1010
+ /**
1011
+ * Normalize a tool name from a shorthand or alias to its canonical ID
1012
+ *
1013
+ * @param shortName The tool shorthand or alias name
1014
+ * @returns The canonical tool ID
1015
+ */
1016
+ declare function normalizeToolName(shortName: string): string;
1017
+ /**
1018
+ * Retrieve the weight for a specific tool, considering overrides and profiles
1019
+ *
1020
+ * @param toolName The canonical tool ID
1021
+ * @param toolConfig Optional configuration for the tool containing a weight
1022
+ * @param cliOverride Optional weight override from the CLI
1023
+ * @param profile Optional scoring profile to use
1024
+ * @returns The weight to be used for this tool in overall scoring
1025
+ */
1026
+ declare function getToolWeight(
1027
+ toolName: string,
1028
+ toolConfig?: {
1029
+ scoreWeight?: number;
1030
+ },
1031
+ cliOverride?: number,
1032
+ profile?: ScoringProfile
1033
+ ): number;
1034
+ /**
1035
+ * Parse a comma-separated weight string (e.g. "patterns:30,context:10")
1036
+ *
1037
+ * @param weightStr The raw weight string from the CLI or config
1038
+ * @returns A Map of tool IDs to their parsed weights
1039
+ */
1040
+ declare function parseWeightString(weightStr?: string): Map<string, number>;
1041
+ /**
1042
+ * Calculate the overall consolidated AI Readiness Score
1043
+ *
1044
+ * @param toolOutputs Map of tool IDs to their individual scoring outputs
1045
+ * @param config Optional global configuration
1046
+ * @param cliWeights Optional weight overrides from the CLI
1047
+ * @returns Consolidate ScoringResult including overall score and rating
1048
+ */
1049
+ declare function calculateOverallScore(
1050
+ toolOutputs: Map<string, ToolScoringOutput>,
1051
+ config?: any,
1052
+ cliWeights?: Map<string, number>
1053
+ ): ScoringResult;
1054
+ /**
1055
+ * Convert numeric score to rating category
1056
+ *
1057
+ * @param score The numerical AI readiness score (0-100)
1058
+ * @returns The corresponding ReadinessRating category
1059
+ */
1060
+ declare function getRating(score: number): ReadinessRating;
1061
+ /**
1062
+ * Get a URL-friendly slug representing the rating
1063
+ *
1064
+ * @param score The numerical score
1065
+ * @returns A kebab-case string (e.g., 'excellent', 'needs-work')
1066
+ */
1067
+ declare function getRatingSlug(score: number): string;
1068
+ /**
1069
+ * Convert score to rating with project-size awareness.
1070
+ *
1071
+ * @param score The numerical AI readiness score
1072
+ * @param fileCount Total number of files in the project
1073
+ * @param modelTier The model context tier being targeted
1074
+ * @returns The size-adjusted ReadinessRating
1075
+ */
1076
+ declare function getRatingWithContext(
1077
+ score: number,
1078
+ fileCount: number,
1079
+ modelTier?: ModelContextTier
1080
+ ): ReadinessRating;
1081
+ /**
1082
+ * Get rating display properties (emoji and color)
1083
+ *
1084
+ * @param rating The readiness rating category
1085
+ * @returns Object containing display emoji and color string
1086
+ */
1087
+ declare function getRatingDisplay(rating: ReadinessRating | string): {
1088
+ emoji: string;
1089
+ color: string;
1090
+ };
1091
+ /**
1092
+ * Format score for human-readable console display
1093
+ *
1094
+ * @param result The consolidated scoring result
1095
+ * @returns Formatted string for display
1096
+ */
1097
+ declare function formatScore(result: ScoringResult): string;
1098
+ /**
1099
+ * Format individual tool score for detailed console display
1100
+ *
1101
+ * @param output The scoring output for a single tool
1102
+ * @returns Formatted string with factors and recommendations
1103
+ */
1104
+ declare function formatToolScore(output: ToolScoringOutput): string;
1105
+
1106
+ /**
1107
+ * Visualization utilities for generating HTML from graph data
1108
+ */
1109
+
1110
+ /**
1111
+ * Generate HTML visualization from graph data
1112
+ * Creates an interactive HTML page with a canvas-based graph visualization
1113
+ *
1114
+ * @param graph - The graph data to visualize
1115
+ * @returns HTML string representing the interactive visualization
1116
+ */
1117
+ declare function generateHTML(graph: GraphData): string;
1118
+
1119
+ export {
1120
+ type SourceRange as $,
1121
+ type AnalysisResult as A,
1122
+ type BusinessMetrics as B,
1123
+ type CostConfig as C,
1124
+ DEFAULT_TOOL_WEIGHTS as D,
1125
+ type ExportWithImports as E,
1126
+ type FileImport as F,
1127
+ GLOBAL_INFRA_OPTIONS as G,
1128
+ type Metrics as H,
1129
+ type ImportInfo as I,
1130
+ ParseError as J,
1131
+ type ParseStatistics as K,
1132
+ type LanguageParser as L,
1133
+ type ModelContextTier as M,
1134
+ type NamingConvention as N,
1135
+ RecommendationPriority as O,
1136
+ type ProductivityImpact as P,
1137
+ SCORING_PROFILES as Q,
1138
+ ReadinessRating as R,
1139
+ type ScanOptions as S,
1140
+ ToolName as T,
1141
+ SIZE_ADJUSTED_THRESHOLDS as U,
1142
+ type ScanResult as V,
1143
+ type ScoringConfig as W,
1144
+ ScoringProfile as X,
1145
+ type ScoringResult as Y,
1146
+ Severity as Z,
1147
+ type SourceLocation as _,
1148
+ type SpokeOutput as a,
1149
+ TOOL_NAME_MAP as a0,
1150
+ type ToolOptions as a1,
1151
+ type ToolOutput as a2,
1152
+ type UnifiedReport as a3,
1153
+ calculateOverallScore as a4,
1154
+ formatScore as a5,
1155
+ formatToolScore as a6,
1156
+ generateHTML as a7,
1157
+ getProjectSizeTier as a8,
1158
+ getRating as a9,
1159
+ getRatingDisplay as aa,
1160
+ getRatingSlug as ab,
1161
+ getRatingWithContext as ac,
1162
+ getRecommendedThreshold as ad,
1163
+ getToolWeight as ae,
1164
+ normalizeToolName as af,
1165
+ parseWeightString as ag,
1166
+ type ToolScoringOutput as b,
1167
+ type ASTNode as c,
1168
+ type AIReadyConfig as d,
1169
+ type TokenBudget as e,
1170
+ type AcceptancePrediction as f,
1171
+ type ComprehensionDifficulty as g,
1172
+ type TechnicalValueChainSummary as h,
1173
+ type TechnicalValueChain as i,
1174
+ Language as j,
1175
+ type ExportInfo as k,
1176
+ type ParseResult as l,
1177
+ COMMON_FINE_TUNING_OPTIONS as m,
1178
+ CONTEXT_TIER_THRESHOLDS as n,
1179
+ type CommonASTNode as o,
1180
+ type Config as p,
1181
+ type GraphData as q,
1182
+ type GraphEdge as r,
1183
+ type GraphIssueSeverity as s,
1184
+ type GraphMetadata as t,
1185
+ type GraphNode as u,
1186
+ type Issue as v,
1187
+ IssueType as w,
1188
+ LANGUAGE_EXTENSIONS as x,
1189
+ type LanguageConfig as y,
1190
+ type Location as z,
1191
+ };