@aiready/core 0.23.1 → 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 -1094
  50. package/dist/client.d.ts +2 -1094
  51. package/dist/client.js +23 -43
  52. package/dist/client.mjs +3 -25
  53. package/dist/index.d.mts +380 -108
  54. package/dist/index.d.ts +380 -108
  55. package/dist/index.js +609 -445
  56. package/dist/index.mjs +587 -429
  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 +2 -2
@@ -0,0 +1,1193 @@
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 GLOBAL_SCAN_OPTIONS: string[];
615
+ declare const COMMON_FINE_TUNING_OPTIONS: string[];
616
+
617
+ /**
618
+ * Analysis issue mapping to graph
619
+ */
620
+ type GraphIssueSeverity = Severity;
621
+ /**
622
+ * Graph metadata
623
+ */
624
+ interface GraphMetadata {
625
+ projectName?: string;
626
+ timestamp: string;
627
+ totalFiles: number;
628
+ totalDependencies: number;
629
+ analysisTypes: string[];
630
+ criticalIssues: number;
631
+ majorIssues: number;
632
+ minorIssues: number;
633
+ infoIssues: number;
634
+ /** AI token budget unit economics (v0.13+) */
635
+ tokenBudget?: TokenBudget;
636
+ /** Execution time in milliseconds */
637
+ executionTime?: number;
638
+ }
639
+
640
+ /**
641
+ * Language-agnostic AST and parser interfaces for multi-language support
642
+ *
643
+ * This module provides abstractions for parsing different programming languages
644
+ * while maintaining a consistent interface for analysis tools.
645
+ */
646
+ /**
647
+ * Supported programming languages
648
+ */
649
+ declare enum Language {
650
+ TypeScript = 'typescript',
651
+ JavaScript = 'javascript',
652
+ Python = 'python',
653
+ Java = 'java',
654
+ Go = 'go',
655
+ Rust = 'rust',
656
+ CSharp = 'csharp',
657
+ }
658
+ /**
659
+ * File extensions mapped to languages
660
+ */
661
+ declare const LANGUAGE_EXTENSIONS: Record<string, Language>;
662
+ /**
663
+ * Location information in source code
664
+ */
665
+ interface SourceLocation {
666
+ line: number;
667
+ column: number;
668
+ }
669
+ interface SourceRange {
670
+ start: SourceLocation;
671
+ end: SourceLocation;
672
+ }
673
+ /**
674
+ * Common AST node type (language-agnostic)
675
+ */
676
+ interface CommonASTNode {
677
+ type: string;
678
+ loc?: SourceRange;
679
+ raw?: any;
680
+ }
681
+ /**
682
+ * Export information (function, class, variable, etc.)
683
+ */
684
+ interface ExportInfo {
685
+ name: string;
686
+ type:
687
+ | 'function'
688
+ | 'class'
689
+ | 'const'
690
+ | 'type'
691
+ | 'interface'
692
+ | 'default'
693
+ | 'variable';
694
+ loc?: SourceRange;
695
+ /** Imports used within this export */
696
+ imports?: string[];
697
+ /** Dependencies on other exports in same file */
698
+ dependencies?: string[];
699
+ /** TypeScript types referenced */
700
+ typeReferences?: string[];
701
+ /** For methods: parent class name */
702
+ parentClass?: string;
703
+ /** For functions/methods: parameters */
704
+ parameters?: string[];
705
+ /** For classes/interfaces: number of methods and properties */
706
+ methodCount?: number;
707
+ propertyCount?: number;
708
+ /** Visibility (public, private, protected) */
709
+ visibility?: 'public' | 'private' | 'protected';
710
+ /** Behavioral metadata for advanced metrics */
711
+ isPure?: boolean;
712
+ hasSideEffects?: boolean;
713
+ /** Associated documentation */
714
+ documentation?: {
715
+ content: string;
716
+ type: 'jsdoc' | 'docstring' | 'comment' | 'xml-doc';
717
+ isStale?: boolean;
718
+ };
719
+ }
720
+ /**
721
+ * Import information
722
+ */
723
+ interface ImportInfo {
724
+ /** Module being imported from */
725
+ source: string;
726
+ /** What's being imported */
727
+ specifiers: string[];
728
+ /** Is this a type-only import (TypeScript) */
729
+ isTypeOnly?: boolean;
730
+ /** Location in source */
731
+ loc?: SourceRange;
732
+ }
733
+ /**
734
+ * Parse result containing exports and imports
735
+ */
736
+ interface ParseResult {
737
+ exports: ExportInfo[];
738
+ imports: ImportInfo[];
739
+ /** Language of the parsed file */
740
+ language: Language;
741
+ /** Any parse warnings (non-fatal) */
742
+ warnings?: string[];
743
+ }
744
+ /**
745
+ * Naming convention rules per language
746
+ */
747
+ interface NamingConvention {
748
+ /** Allowed variable naming patterns */
749
+ variablePattern: RegExp;
750
+ /** Allowed function naming patterns */
751
+ functionPattern: RegExp;
752
+ /** Allowed class naming patterns */
753
+ classPattern: RegExp;
754
+ /** Allowed constant naming patterns */
755
+ constantPattern: RegExp;
756
+ /** Allowed type naming patterns */
757
+ typePattern?: RegExp;
758
+ /** Allowed interface naming patterns */
759
+ interfacePattern?: RegExp;
760
+ /** Language-specific exceptions (e.g., __init__ in Python) */
761
+ exceptions?: string[];
762
+ }
763
+ /**
764
+ * Language-specific configuration
765
+ */
766
+ interface LanguageConfig {
767
+ language: Language;
768
+ /** File extensions for this language */
769
+ extensions: string[];
770
+ /** Naming conventions */
771
+ namingConventions: NamingConvention;
772
+ /** Common abbreviations allowed */
773
+ allowedAbbreviations?: string[];
774
+ /** Language-specific keywords to ignore */
775
+ keywords?: string[];
776
+ }
777
+ /**
778
+ * Abstract interface for language parsers
779
+ * Each language implementation should implement this interface
780
+ */
781
+ interface LanguageParser {
782
+ /** Language this parser handles */
783
+ readonly language: Language;
784
+ /** File extensions this parser supports */
785
+ readonly extensions: string[];
786
+ /**
787
+ * Parse source code and extract structure
788
+ * @param code - Source code to parse
789
+ * @param filePath - Path to the file (for context)
790
+ * @returns Parse result with exports and imports
791
+ * @throws ParseError if code has syntax errors
792
+ */
793
+ parse(code: string, filePath: string): ParseResult;
794
+ /**
795
+ * Get naming conventions for this language
796
+ */
797
+ getNamingConventions(): NamingConvention;
798
+ /**
799
+ * Initialize the parser (e.g. load WASM)
800
+ */
801
+ initialize(): Promise<void>;
802
+ /**
803
+ * Check if this parser can handle a file
804
+ * @param filePath - File path to check
805
+ */
806
+ canHandle(filePath: string): boolean;
807
+ /**
808
+ * Get the raw AST for advanced querying
809
+ * @param code - Source code to parse
810
+ * @param filePath - Path to the file
811
+ */
812
+ getAST(code: string, filePath: string): Promise<any>;
813
+ /**
814
+ * Analyze structural metadata for a node (e.g. purity)
815
+ * @param node - The AST node to analyze (language specific)
816
+ * @param code - The original source code
817
+ */
818
+ analyzeMetadata(node: any, code: string): Partial<ExportInfo>;
819
+ }
820
+ /**
821
+ * Parser error with location information
822
+ */
823
+ declare class ParseError extends Error {
824
+ readonly filePath: string;
825
+ readonly loc?: SourceLocation | undefined;
826
+ constructor(
827
+ message: string,
828
+ filePath: string,
829
+ loc?: SourceLocation | undefined
830
+ );
831
+ }
832
+ /**
833
+ * Statistics about parsed code
834
+ */
835
+ interface ParseStatistics {
836
+ language: Language;
837
+ filesAnalyzed: number;
838
+ totalExports: number;
839
+ totalImports: number;
840
+ parseErrors: number;
841
+ warnings: number;
842
+ }
843
+
844
+ /**
845
+ * Priority levels for actionable recommendations
846
+ */
847
+ declare enum RecommendationPriority {
848
+ High = 'high',
849
+ Medium = 'medium',
850
+ Low = 'low',
851
+ }
852
+ /**
853
+ * AI Readiness Rating categories
854
+ */
855
+ declare enum ReadinessRating {
856
+ Excellent = 'Excellent',
857
+ Good = 'Good',
858
+ Fair = 'Fair',
859
+ NeedsWork = 'Needs Work',
860
+ Critical = 'Critical',
861
+ }
862
+ /**
863
+ * Output structure for a single tool's scoring analysis
864
+ */
865
+ interface ToolScoringOutput {
866
+ /** Unique tool identifier (e.g., "pattern-detect") */
867
+ toolName: string;
868
+ /** Normalized 0-100 score for this tool */
869
+ score: number;
870
+ /** AI token budget unit economics (v0.13+) */
871
+ tokenBudget?: TokenBudget;
872
+ /** Raw metrics used to calculate the score */
873
+ rawMetrics: Record<string, any>;
874
+ /** Factors that influenced the score */
875
+ factors: Array<{
876
+ /** Human-readable name of the factor */
877
+ name: string;
878
+ /** Points contribution (positive or negative) */
879
+ impact: number;
880
+ /** Explanation of the factor's impact */
881
+ description: string;
882
+ }>;
883
+ /** Actionable recommendations with estimated impact */
884
+ recommendations: Array<{
885
+ /** The recommended action to take */
886
+ action: string;
887
+ /** Potential points increase if implemented */
888
+ estimatedImpact: number;
889
+ /** Implementation priority */
890
+ priority: RecommendationPriority | 'high' | 'medium' | 'low';
891
+ }>;
892
+ }
893
+ /**
894
+ * Consolidated scoring result across all tools
895
+ */
896
+ interface ScoringResult {
897
+ /** Overall AI Readiness Score (0-100) */
898
+ overall: number;
899
+ /** Rating category representing the overall readiness */
900
+ rating: ReadinessRating | string;
901
+ /** Timestamp of score calculation */
902
+ timestamp: string;
903
+ /** Tools that contributed to this score */
904
+ toolsUsed: string[];
905
+ /** Breakdown by individual tool */
906
+ breakdown: ToolScoringOutput[];
907
+ /** Internal calculation details for transparency */
908
+ calculation: {
909
+ /** Textual representation of the calculation formula */
910
+ formula: string;
911
+ /** Weights applied to each tool */
912
+ weights: Record<string, number>;
913
+ /** Simplified normalized formula output */
914
+ normalized: string;
915
+ };
916
+ }
917
+ /**
918
+ * Configuration options for the scoring system
919
+ */
920
+ interface ScoringConfig {
921
+ /** Minimum passing score (CLI will exit with non-zero if below) */
922
+ threshold?: number;
923
+ /** Whether to show the detailed tool-by-tool breakdown */
924
+ showBreakdown?: boolean;
925
+ /** Path to a baseline report JSON for trend comparison */
926
+ compareBaseline?: string;
927
+ /** Target file path to persist the calculated score */
928
+ saveTo?: string;
929
+ }
930
+ /**
931
+ * Default weights for known tools. Weights sum to 100 and read directly as
932
+ * percentage contribution to the overall score.
933
+ * New tools get weight of 5 if not specified.
934
+ */
935
+ /**
936
+ * Default weights for known tools. Weights sum to 100 and read directly as
937
+ * percentage contribution to the overall score.
938
+ * New tools get weight of 5 if not specified.
939
+ */
940
+ declare const DEFAULT_TOOL_WEIGHTS: Record<string, number>;
941
+ /**
942
+ * Tool name normalization map (shorthand -> canonical name)
943
+ */
944
+ /**
945
+ * Tool name normalization map (shorthand -> canonical name)
946
+ */
947
+ declare const TOOL_NAME_MAP: Record<string, string>;
948
+ /**
949
+ * Model context tiers for context-aware threshold calibration.
950
+ */
951
+ type ModelContextTier = 'compact' | 'standard' | 'extended' | 'frontier';
952
+ /**
953
+ * Scoring profiles for project-type-aware weighting.
954
+ */
955
+ declare enum ScoringProfile {
956
+ Default = 'default',
957
+ Agentic = 'agentic', // Focus on AI agent navigation and signal
958
+ Logic = 'logic', // Focus on testability and complexity
959
+ UI = 'ui', // Focus on consistency and context (lower penalty for magic literals)
960
+ Cost = 'cost', // Focus on token waste (duplication and fragmentation)
961
+ Security = 'security',
962
+ }
963
+ /**
964
+ * Project-type-aware tool weight presets.
965
+ */
966
+ /**
967
+ * Project-type-aware tool weight presets.
968
+ */
969
+ declare const SCORING_PROFILES: Record<ScoringProfile, Record<string, number>>;
970
+ /**
971
+ * Context budget thresholds per tier.
972
+ */
973
+ /**
974
+ * Context budget thresholds per tier.
975
+ */
976
+ declare const CONTEXT_TIER_THRESHOLDS: Record<
977
+ ModelContextTier,
978
+ {
979
+ idealTokens: number;
980
+ criticalTokens: number;
981
+ idealDepth: number;
982
+ }
983
+ >;
984
+ /**
985
+ * Project-size-adjusted minimum thresholds.
986
+ */
987
+ /**
988
+ * Project-size-adjusted minimum thresholds.
989
+ */
990
+ declare const SIZE_ADJUSTED_THRESHOLDS: Record<string, number>;
991
+ /**
992
+ * Determine project size tier based on the total number of files
993
+ *
994
+ * @param fileCount Total number of files in the project
995
+ * @returns A string identifier for the project size tier (xs, small, medium, large, enterprise)
996
+ */
997
+ declare function getProjectSizeTier(
998
+ fileCount: number
999
+ ): keyof typeof SIZE_ADJUSTED_THRESHOLDS;
1000
+ /**
1001
+ * Calculate the recommended minimum AI readiness threshold for a project
1002
+ *
1003
+ * @param fileCount Total number of files in the project
1004
+ * @param modelTier The model context tier targeted (compact, standard, extended, frontier)
1005
+ * @returns The recommended score threshold (0-100)
1006
+ */
1007
+ declare function getRecommendedThreshold(
1008
+ fileCount: number,
1009
+ modelTier?: ModelContextTier
1010
+ ): number;
1011
+ /**
1012
+ * Normalize a tool name from a shorthand or alias to its canonical ID
1013
+ *
1014
+ * @param shortName The tool shorthand or alias name
1015
+ * @returns The canonical tool ID
1016
+ */
1017
+ declare function normalizeToolName(shortName: string): string;
1018
+ /**
1019
+ * Retrieve the weight for a specific tool, considering overrides and profiles
1020
+ *
1021
+ * @param toolName The canonical tool ID
1022
+ * @param toolConfig Optional configuration for the tool containing a weight
1023
+ * @param cliOverride Optional weight override from the CLI
1024
+ * @param profile Optional scoring profile to use
1025
+ * @returns The weight to be used for this tool in overall scoring
1026
+ */
1027
+ declare function getToolWeight(
1028
+ toolName: string,
1029
+ toolConfig?: {
1030
+ scoreWeight?: number;
1031
+ },
1032
+ cliOverride?: number,
1033
+ profile?: ScoringProfile
1034
+ ): number;
1035
+ /**
1036
+ * Parse a comma-separated weight string (e.g. "patterns:30,context:10")
1037
+ *
1038
+ * @param weightStr The raw weight string from the CLI or config
1039
+ * @returns A Map of tool IDs to their parsed weights
1040
+ */
1041
+ declare function parseWeightString(weightStr?: string): Map<string, number>;
1042
+ /**
1043
+ * Calculate the overall consolidated AI Readiness Score
1044
+ *
1045
+ * @param toolOutputs Map of tool IDs to their individual scoring outputs
1046
+ * @param config Optional global configuration
1047
+ * @param cliWeights Optional weight overrides from the CLI
1048
+ * @returns Consolidate ScoringResult including overall score and rating
1049
+ */
1050
+ declare function calculateOverallScore(
1051
+ toolOutputs: Map<string, ToolScoringOutput>,
1052
+ config?: any,
1053
+ cliWeights?: Map<string, number>
1054
+ ): ScoringResult;
1055
+ /**
1056
+ * Convert numeric score to rating category
1057
+ *
1058
+ * @param score The numerical AI readiness score (0-100)
1059
+ * @returns The corresponding ReadinessRating category
1060
+ */
1061
+ declare function getRating(score: number): ReadinessRating;
1062
+ /**
1063
+ * Get a URL-friendly slug representing the rating
1064
+ *
1065
+ * @param score The numerical score
1066
+ * @returns A kebab-case string (e.g., 'excellent', 'needs-work')
1067
+ */
1068
+ declare function getRatingSlug(score: number): string;
1069
+ /**
1070
+ * Convert score to rating with project-size awareness.
1071
+ *
1072
+ * @param score The numerical AI readiness score
1073
+ * @param fileCount Total number of files in the project
1074
+ * @param modelTier The model context tier being targeted
1075
+ * @returns The size-adjusted ReadinessRating
1076
+ */
1077
+ declare function getRatingWithContext(
1078
+ score: number,
1079
+ fileCount: number,
1080
+ modelTier?: ModelContextTier
1081
+ ): ReadinessRating;
1082
+ /**
1083
+ * Get rating display properties (emoji and color)
1084
+ *
1085
+ * @param rating The readiness rating category
1086
+ * @returns Object containing display emoji and color string
1087
+ */
1088
+ declare function getRatingDisplay(rating: ReadinessRating | string): {
1089
+ emoji: string;
1090
+ color: string;
1091
+ };
1092
+ /**
1093
+ * Format score for human-readable console display
1094
+ *
1095
+ * @param result The consolidated scoring result
1096
+ * @returns Formatted string for display
1097
+ */
1098
+ declare function formatScore(result: ScoringResult): string;
1099
+ /**
1100
+ * Format individual tool score for detailed console display
1101
+ *
1102
+ * @param output The scoring output for a single tool
1103
+ * @returns Formatted string with factors and recommendations
1104
+ */
1105
+ declare function formatToolScore(output: ToolScoringOutput): string;
1106
+
1107
+ /**
1108
+ * Visualization utilities for generating HTML from graph data
1109
+ */
1110
+
1111
+ /**
1112
+ * Generate HTML visualization from graph data
1113
+ * Creates an interactive HTML page with a canvas-based graph visualization
1114
+ *
1115
+ * @param graph - The graph data to visualize
1116
+ * @returns HTML string representing the interactive visualization
1117
+ */
1118
+ declare function generateHTML(graph: GraphData): string;
1119
+
1120
+ export {
1121
+ type SourceLocation as $,
1122
+ type AnalysisResult as A,
1123
+ type BusinessMetrics as B,
1124
+ type CostConfig as C,
1125
+ DEFAULT_TOOL_WEIGHTS as D,
1126
+ type ExportWithImports as E,
1127
+ type FileImport as F,
1128
+ GLOBAL_INFRA_OPTIONS as G,
1129
+ type Location as H,
1130
+ type ImportInfo as I,
1131
+ type Metrics as J,
1132
+ ParseError as K,
1133
+ type LanguageParser as L,
1134
+ type ModelContextTier as M,
1135
+ type NamingConvention as N,
1136
+ type ParseStatistics as O,
1137
+ type ProductivityImpact as P,
1138
+ RecommendationPriority as Q,
1139
+ ReadinessRating as R,
1140
+ type ScanOptions as S,
1141
+ ToolName as T,
1142
+ SCORING_PROFILES as U,
1143
+ SIZE_ADJUSTED_THRESHOLDS as V,
1144
+ type ScanResult as W,
1145
+ type ScoringConfig as X,
1146
+ ScoringProfile as Y,
1147
+ type ScoringResult as Z,
1148
+ Severity as _,
1149
+ type SpokeOutput as a,
1150
+ type SourceRange as a0,
1151
+ TOOL_NAME_MAP as a1,
1152
+ type ToolOptions as a2,
1153
+ type ToolOutput as a3,
1154
+ type UnifiedReport as a4,
1155
+ calculateOverallScore as a5,
1156
+ formatScore as a6,
1157
+ formatToolScore as a7,
1158
+ generateHTML as a8,
1159
+ getProjectSizeTier as a9,
1160
+ getRating as aa,
1161
+ getRatingDisplay as ab,
1162
+ getRatingSlug as ac,
1163
+ getRatingWithContext as ad,
1164
+ getRecommendedThreshold as ae,
1165
+ getToolWeight as af,
1166
+ normalizeToolName as ag,
1167
+ parseWeightString as ah,
1168
+ type ToolScoringOutput as b,
1169
+ type ASTNode as c,
1170
+ type AIReadyConfig as d,
1171
+ type TokenBudget as e,
1172
+ type AcceptancePrediction as f,
1173
+ type ComprehensionDifficulty as g,
1174
+ type TechnicalValueChainSummary as h,
1175
+ type TechnicalValueChain as i,
1176
+ Language as j,
1177
+ type ExportInfo as k,
1178
+ type ParseResult as l,
1179
+ COMMON_FINE_TUNING_OPTIONS as m,
1180
+ CONTEXT_TIER_THRESHOLDS as n,
1181
+ type CommonASTNode as o,
1182
+ type Config as p,
1183
+ GLOBAL_SCAN_OPTIONS as q,
1184
+ type GraphData as r,
1185
+ type GraphEdge as s,
1186
+ type GraphIssueSeverity as t,
1187
+ type GraphMetadata as u,
1188
+ type GraphNode as v,
1189
+ type Issue as w,
1190
+ IssueType as x,
1191
+ LANGUAGE_EXTENSIONS as y,
1192
+ type LanguageConfig as z,
1193
+ };