@aiready/core 0.21.18 → 0.21.21
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/chunk-CKVKHN3G.mjs +643 -0
- package/dist/chunk-LTNXTXRI.mjs +642 -0
- package/dist/chunk-SWTDBVYJ.mjs +645 -0
- package/dist/client.d.mts +206 -92
- package/dist/client.d.ts +206 -92
- package/dist/client.js +45 -15
- package/dist/client.mjs +5 -1
- package/dist/index.d.mts +63 -12
- package/dist/index.d.ts +63 -12
- package/dist/index.js +151 -48
- package/dist/index.mjs +111 -34
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.mjs';
|
|
2
|
-
export { AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
|
|
2
|
+
export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as Parser from 'web-tree-sitter';
|
|
5
5
|
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
@@ -48,33 +48,78 @@ declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: any): {
|
|
|
48
48
|
*
|
|
49
49
|
* Central registry for all analysis tools. Decouples the CLI from
|
|
50
50
|
* individual tool packages and allows for easier extension.
|
|
51
|
+
*
|
|
52
|
+
* Supports both singleton usage and multiple instances for test isolation.
|
|
51
53
|
*/
|
|
52
54
|
declare class ToolRegistry {
|
|
53
|
-
private
|
|
54
|
-
|
|
55
|
+
private providers;
|
|
56
|
+
readonly id: string;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new ToolRegistry instance
|
|
59
|
+
*
|
|
60
|
+
* @param id Optional identifier for the registry (e.g. for debugging)
|
|
61
|
+
*/
|
|
62
|
+
constructor(id?: string);
|
|
55
63
|
/**
|
|
56
64
|
* Register a new tool provider.
|
|
65
|
+
*
|
|
66
|
+
* @param provider The tool provider to register
|
|
57
67
|
*/
|
|
58
|
-
|
|
68
|
+
register(provider: ToolProvider): void;
|
|
59
69
|
/**
|
|
60
70
|
* Get a provider by its canonical ID.
|
|
71
|
+
*
|
|
72
|
+
* @param id The tool ID
|
|
73
|
+
* @returns The provider if found
|
|
61
74
|
*/
|
|
62
|
-
|
|
75
|
+
get(id: ToolName): ToolProvider | undefined;
|
|
63
76
|
/**
|
|
64
77
|
* Get a provider by name or alias.
|
|
78
|
+
*
|
|
79
|
+
* @param nameOrAlias The tool name or alias string
|
|
80
|
+
* @returns The provider if found
|
|
65
81
|
*/
|
|
66
|
-
|
|
82
|
+
find(nameOrAlias: string): ToolProvider | undefined;
|
|
67
83
|
/**
|
|
68
84
|
* Get all registered tool providers.
|
|
85
|
+
*
|
|
86
|
+
* @returns Array of all registered tool providers
|
|
69
87
|
*/
|
|
70
|
-
|
|
88
|
+
getAll(): ToolProvider[];
|
|
71
89
|
/**
|
|
72
90
|
* Get all available tool IDs from the ToolName enum.
|
|
91
|
+
*
|
|
92
|
+
* @returns Array of valid ToolName identifiers
|
|
73
93
|
*/
|
|
74
|
-
|
|
94
|
+
getAvailableIds(): ToolName[];
|
|
75
95
|
/**
|
|
76
96
|
* Clear the registry (primarily for testing).
|
|
77
97
|
*/
|
|
98
|
+
clear(): void;
|
|
99
|
+
private static getGlobalRegistry;
|
|
100
|
+
/**
|
|
101
|
+
* Static register (Singleton compatibility)
|
|
102
|
+
*/
|
|
103
|
+
static register(provider: ToolProvider): void;
|
|
104
|
+
/**
|
|
105
|
+
* Static get (Singleton compatibility)
|
|
106
|
+
*/
|
|
107
|
+
static get(id: ToolName): ToolProvider | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Static find (Singleton compatibility)
|
|
110
|
+
*/
|
|
111
|
+
static find(nameOrAlias: string): ToolProvider | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Static getAll (Singleton compatibility)
|
|
114
|
+
*/
|
|
115
|
+
static getAll(): ToolProvider[];
|
|
116
|
+
/**
|
|
117
|
+
* Static getAvailableIds (Singleton compatibility)
|
|
118
|
+
*/
|
|
119
|
+
static getAvailableIds(): ToolName[];
|
|
120
|
+
/**
|
|
121
|
+
* Static clear (Singleton compatibility)
|
|
122
|
+
*/
|
|
78
123
|
static clear(): void;
|
|
79
124
|
}
|
|
80
125
|
|
|
@@ -240,7 +285,6 @@ declare function getModelPreset(modelId: string): ModelPricingPreset;
|
|
|
240
285
|
declare const DEFAULT_COST_CONFIG: CostConfig;
|
|
241
286
|
/**
|
|
242
287
|
* Calculate estimated monthly cost of AI context waste
|
|
243
|
-
* @deprecated Since v0.13
|
|
244
288
|
*/
|
|
245
289
|
declare function calculateMonthlyCost(tokenWaste: number, config?: Partial<CostConfig>): {
|
|
246
290
|
total: number;
|
|
@@ -406,15 +450,22 @@ declare function generateValueChain(params: {
|
|
|
406
450
|
*/
|
|
407
451
|
|
|
408
452
|
/**
|
|
409
|
-
* Factory for creating and managing language parsers
|
|
453
|
+
* Factory for creating and managing language parsers.
|
|
454
|
+
*
|
|
455
|
+
* Supports both singleton usage and multiple instances for test isolation.
|
|
410
456
|
*/
|
|
411
457
|
declare class ParserFactory {
|
|
412
458
|
private static instance;
|
|
413
459
|
private parsers;
|
|
414
460
|
private extensionMap;
|
|
415
|
-
private constructor();
|
|
416
461
|
/**
|
|
417
|
-
*
|
|
462
|
+
* Create a new ParserFactory instance
|
|
463
|
+
*/
|
|
464
|
+
constructor();
|
|
465
|
+
/**
|
|
466
|
+
* Get the global singleton instance
|
|
467
|
+
*
|
|
468
|
+
* @returns The singleton ParserFactory instance
|
|
418
469
|
*/
|
|
419
470
|
static getInstance(): ParserFactory;
|
|
420
471
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.js';
|
|
2
|
-
export { AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
|
|
2
|
+
export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as Parser from 'web-tree-sitter';
|
|
5
5
|
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
@@ -48,33 +48,78 @@ declare function validateWithSchema<T>(schema: z.ZodSchema<T>, data: any): {
|
|
|
48
48
|
*
|
|
49
49
|
* Central registry for all analysis tools. Decouples the CLI from
|
|
50
50
|
* individual tool packages and allows for easier extension.
|
|
51
|
+
*
|
|
52
|
+
* Supports both singleton usage and multiple instances for test isolation.
|
|
51
53
|
*/
|
|
52
54
|
declare class ToolRegistry {
|
|
53
|
-
private
|
|
54
|
-
|
|
55
|
+
private providers;
|
|
56
|
+
readonly id: string;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new ToolRegistry instance
|
|
59
|
+
*
|
|
60
|
+
* @param id Optional identifier for the registry (e.g. for debugging)
|
|
61
|
+
*/
|
|
62
|
+
constructor(id?: string);
|
|
55
63
|
/**
|
|
56
64
|
* Register a new tool provider.
|
|
65
|
+
*
|
|
66
|
+
* @param provider The tool provider to register
|
|
57
67
|
*/
|
|
58
|
-
|
|
68
|
+
register(provider: ToolProvider): void;
|
|
59
69
|
/**
|
|
60
70
|
* Get a provider by its canonical ID.
|
|
71
|
+
*
|
|
72
|
+
* @param id The tool ID
|
|
73
|
+
* @returns The provider if found
|
|
61
74
|
*/
|
|
62
|
-
|
|
75
|
+
get(id: ToolName): ToolProvider | undefined;
|
|
63
76
|
/**
|
|
64
77
|
* Get a provider by name or alias.
|
|
78
|
+
*
|
|
79
|
+
* @param nameOrAlias The tool name or alias string
|
|
80
|
+
* @returns The provider if found
|
|
65
81
|
*/
|
|
66
|
-
|
|
82
|
+
find(nameOrAlias: string): ToolProvider | undefined;
|
|
67
83
|
/**
|
|
68
84
|
* Get all registered tool providers.
|
|
85
|
+
*
|
|
86
|
+
* @returns Array of all registered tool providers
|
|
69
87
|
*/
|
|
70
|
-
|
|
88
|
+
getAll(): ToolProvider[];
|
|
71
89
|
/**
|
|
72
90
|
* Get all available tool IDs from the ToolName enum.
|
|
91
|
+
*
|
|
92
|
+
* @returns Array of valid ToolName identifiers
|
|
73
93
|
*/
|
|
74
|
-
|
|
94
|
+
getAvailableIds(): ToolName[];
|
|
75
95
|
/**
|
|
76
96
|
* Clear the registry (primarily for testing).
|
|
77
97
|
*/
|
|
98
|
+
clear(): void;
|
|
99
|
+
private static getGlobalRegistry;
|
|
100
|
+
/**
|
|
101
|
+
* Static register (Singleton compatibility)
|
|
102
|
+
*/
|
|
103
|
+
static register(provider: ToolProvider): void;
|
|
104
|
+
/**
|
|
105
|
+
* Static get (Singleton compatibility)
|
|
106
|
+
*/
|
|
107
|
+
static get(id: ToolName): ToolProvider | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* Static find (Singleton compatibility)
|
|
110
|
+
*/
|
|
111
|
+
static find(nameOrAlias: string): ToolProvider | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Static getAll (Singleton compatibility)
|
|
114
|
+
*/
|
|
115
|
+
static getAll(): ToolProvider[];
|
|
116
|
+
/**
|
|
117
|
+
* Static getAvailableIds (Singleton compatibility)
|
|
118
|
+
*/
|
|
119
|
+
static getAvailableIds(): ToolName[];
|
|
120
|
+
/**
|
|
121
|
+
* Static clear (Singleton compatibility)
|
|
122
|
+
*/
|
|
78
123
|
static clear(): void;
|
|
79
124
|
}
|
|
80
125
|
|
|
@@ -240,7 +285,6 @@ declare function getModelPreset(modelId: string): ModelPricingPreset;
|
|
|
240
285
|
declare const DEFAULT_COST_CONFIG: CostConfig;
|
|
241
286
|
/**
|
|
242
287
|
* Calculate estimated monthly cost of AI context waste
|
|
243
|
-
* @deprecated Since v0.13
|
|
244
288
|
*/
|
|
245
289
|
declare function calculateMonthlyCost(tokenWaste: number, config?: Partial<CostConfig>): {
|
|
246
290
|
total: number;
|
|
@@ -406,15 +450,22 @@ declare function generateValueChain(params: {
|
|
|
406
450
|
*/
|
|
407
451
|
|
|
408
452
|
/**
|
|
409
|
-
* Factory for creating and managing language parsers
|
|
453
|
+
* Factory for creating and managing language parsers.
|
|
454
|
+
*
|
|
455
|
+
* Supports both singleton usage and multiple instances for test isolation.
|
|
410
456
|
*/
|
|
411
457
|
declare class ParserFactory {
|
|
412
458
|
private static instance;
|
|
413
459
|
private parsers;
|
|
414
460
|
private extensionMap;
|
|
415
|
-
private constructor();
|
|
416
461
|
/**
|
|
417
|
-
*
|
|
462
|
+
* Create a new ParserFactory instance
|
|
463
|
+
*/
|
|
464
|
+
constructor();
|
|
465
|
+
/**
|
|
466
|
+
* Get the global singleton instance
|
|
467
|
+
*
|
|
468
|
+
* @returns The singleton ParserFactory instance
|
|
418
469
|
*/
|
|
419
470
|
static getInstance(): ParserFactory;
|
|
420
471
|
/**
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,8 @@ __export(index_exports, {
|
|
|
57
57
|
ParseError: () => ParseError,
|
|
58
58
|
ParserFactory: () => ParserFactory,
|
|
59
59
|
PythonParser: () => PythonParser,
|
|
60
|
+
ReadinessRating: () => ReadinessRating,
|
|
61
|
+
RecommendationPriority: () => RecommendationPriority,
|
|
60
62
|
SEVERITY_TIME_ESTIMATES: () => SEVERITY_TIME_ESTIMATES,
|
|
61
63
|
SIZE_ADJUSTED_THRESHOLDS: () => SIZE_ADJUSTED_THRESHOLDS,
|
|
62
64
|
Severity: () => Severity,
|
|
@@ -291,7 +293,12 @@ var UnifiedReportSchema = import_zod.z.object({
|
|
|
291
293
|
totalFiles: import_zod.z.number(),
|
|
292
294
|
totalIssues: import_zod.z.number(),
|
|
293
295
|
criticalIssues: import_zod.z.number(),
|
|
294
|
-
majorIssues: import_zod.z.number()
|
|
296
|
+
majorIssues: import_zod.z.number(),
|
|
297
|
+
businessImpact: import_zod.z.object({
|
|
298
|
+
estimatedMonthlyWaste: import_zod.z.number().optional(),
|
|
299
|
+
potentialSavings: import_zod.z.number().optional(),
|
|
300
|
+
productivityHours: import_zod.z.number().optional()
|
|
301
|
+
}).optional()
|
|
295
302
|
}),
|
|
296
303
|
results: import_zod.z.array(AnalysisResultSchema),
|
|
297
304
|
scoring: import_zod.z.object({
|
|
@@ -428,51 +435,61 @@ function validateWithSchema(schema, data) {
|
|
|
428
435
|
}
|
|
429
436
|
|
|
430
437
|
// src/registry.ts
|
|
431
|
-
var ToolRegistry = class {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
+
var ToolRegistry = class _ToolRegistry {
|
|
439
|
+
/**
|
|
440
|
+
* Create a new ToolRegistry instance
|
|
441
|
+
*
|
|
442
|
+
* @param id Optional identifier for the registry (e.g. for debugging)
|
|
443
|
+
*/
|
|
444
|
+
constructor(id = "default") {
|
|
445
|
+
this.providers = /* @__PURE__ */ new Map();
|
|
446
|
+
this.id = `registry-${id}-${Math.random().toString(36).substring(2, 9)}`;
|
|
438
447
|
}
|
|
439
448
|
/**
|
|
440
449
|
* Register a new tool provider.
|
|
450
|
+
*
|
|
451
|
+
* @param provider The tool provider to register
|
|
441
452
|
*/
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
`[ToolRegistry#${this.instanceId}] Registering tool: ${provider.id} (${provider.alias.join(", ")})`
|
|
445
|
-
);
|
|
446
|
-
this.getProviders().set(provider.id, provider);
|
|
453
|
+
register(provider) {
|
|
454
|
+
this.providers.set(provider.id, provider);
|
|
447
455
|
}
|
|
448
456
|
/**
|
|
449
457
|
* Get a provider by its canonical ID.
|
|
458
|
+
*
|
|
459
|
+
* @param id The tool ID
|
|
460
|
+
* @returns The provider if found
|
|
450
461
|
*/
|
|
451
|
-
|
|
452
|
-
return this.
|
|
462
|
+
get(id) {
|
|
463
|
+
return this.providers.get(id);
|
|
453
464
|
}
|
|
454
465
|
/**
|
|
455
466
|
* Get a provider by name or alias.
|
|
467
|
+
*
|
|
468
|
+
* @param nameOrAlias The tool name or alias string
|
|
469
|
+
* @returns The provider if found
|
|
456
470
|
*/
|
|
457
|
-
|
|
458
|
-
const
|
|
459
|
-
const exact = providers.get(nameOrAlias);
|
|
471
|
+
find(nameOrAlias) {
|
|
472
|
+
const exact = this.providers.get(nameOrAlias);
|
|
460
473
|
if (exact) return exact;
|
|
461
|
-
for (const p of providers.values()) {
|
|
474
|
+
for (const p of this.providers.values()) {
|
|
462
475
|
if (p.alias.includes(nameOrAlias)) return p;
|
|
463
476
|
}
|
|
464
477
|
return void 0;
|
|
465
478
|
}
|
|
466
479
|
/**
|
|
467
480
|
* Get all registered tool providers.
|
|
481
|
+
*
|
|
482
|
+
* @returns Array of all registered tool providers
|
|
468
483
|
*/
|
|
469
|
-
|
|
470
|
-
return Array.from(this.
|
|
484
|
+
getAll() {
|
|
485
|
+
return Array.from(this.providers.values());
|
|
471
486
|
}
|
|
472
487
|
/**
|
|
473
488
|
* Get all available tool IDs from the ToolName enum.
|
|
489
|
+
*
|
|
490
|
+
* @returns Array of valid ToolName identifiers
|
|
474
491
|
*/
|
|
475
|
-
|
|
492
|
+
getAvailableIds() {
|
|
476
493
|
return Object.values(ToolName).filter(
|
|
477
494
|
(v) => typeof v === "string"
|
|
478
495
|
);
|
|
@@ -480,11 +497,54 @@ var ToolRegistry = class {
|
|
|
480
497
|
/**
|
|
481
498
|
* Clear the registry (primarily for testing).
|
|
482
499
|
*/
|
|
500
|
+
clear() {
|
|
501
|
+
this.providers.clear();
|
|
502
|
+
}
|
|
503
|
+
// --- Static Compatibility Layer ---
|
|
504
|
+
static getGlobalRegistry() {
|
|
505
|
+
const g = globalThis;
|
|
506
|
+
if (!g.__AIRE_TOOL_REGISTRY_INSTANCE__) {
|
|
507
|
+
g.__AIRE_TOOL_REGISTRY_INSTANCE__ = new _ToolRegistry("global");
|
|
508
|
+
}
|
|
509
|
+
return g.__AIRE_TOOL_REGISTRY_INSTANCE__;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Static register (Singleton compatibility)
|
|
513
|
+
*/
|
|
514
|
+
static register(provider) {
|
|
515
|
+
this.getGlobalRegistry().register(provider);
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Static get (Singleton compatibility)
|
|
519
|
+
*/
|
|
520
|
+
static get(id) {
|
|
521
|
+
return this.getGlobalRegistry().get(id);
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Static find (Singleton compatibility)
|
|
525
|
+
*/
|
|
526
|
+
static find(nameOrAlias) {
|
|
527
|
+
return this.getGlobalRegistry().find(nameOrAlias);
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Static getAll (Singleton compatibility)
|
|
531
|
+
*/
|
|
532
|
+
static getAll() {
|
|
533
|
+
return this.getGlobalRegistry().getAll();
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Static getAvailableIds (Singleton compatibility)
|
|
537
|
+
*/
|
|
538
|
+
static getAvailableIds() {
|
|
539
|
+
return this.getGlobalRegistry().getAvailableIds();
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Static clear (Singleton compatibility)
|
|
543
|
+
*/
|
|
483
544
|
static clear() {
|
|
484
|
-
this.
|
|
545
|
+
this.getGlobalRegistry().clear();
|
|
485
546
|
}
|
|
486
547
|
};
|
|
487
|
-
ToolRegistry.instanceId = globalThis.Math.random();
|
|
488
548
|
|
|
489
549
|
// src/utils/file-scanner.ts
|
|
490
550
|
var import_glob = require("glob");
|
|
@@ -596,7 +656,8 @@ async function scanFiles(options) {
|
|
|
596
656
|
});
|
|
597
657
|
const gitignoreFiles = await (0, import_glob.glob)("**/.gitignore", {
|
|
598
658
|
cwd: rootDir,
|
|
599
|
-
ignore:
|
|
659
|
+
ignore: (exclude || []).concat(["**/node_modules/**", "**/.git/**"]),
|
|
660
|
+
// Minimal ignore for gitignore discovery
|
|
600
661
|
absolute: true
|
|
601
662
|
});
|
|
602
663
|
if (gitignoreFiles.length > 0) {
|
|
@@ -663,7 +724,7 @@ async function scanEntries(options) {
|
|
|
663
724
|
});
|
|
664
725
|
const gitignoreFiles = await (0, import_glob.glob)("**/.gitignore", {
|
|
665
726
|
cwd: rootDir,
|
|
666
|
-
ignore:
|
|
727
|
+
ignore: (exclude || []).concat(["**/node_modules/**", "**/.git/**"]),
|
|
667
728
|
absolute: true
|
|
668
729
|
});
|
|
669
730
|
if (gitignoreFiles.length > 0) {
|
|
@@ -687,8 +748,9 @@ async function scanEntries(options) {
|
|
|
687
748
|
}
|
|
688
749
|
}
|
|
689
750
|
const filteredDirs = dirs.filter((d) => {
|
|
690
|
-
|
|
751
|
+
let rel = (0, import_path.relative)(rootDir || ".", d).replace(/\\/g, "/");
|
|
691
752
|
if (rel === "") return true;
|
|
753
|
+
if (!rel.endsWith("/")) rel += "/";
|
|
692
754
|
return !ig.ignores(rel);
|
|
693
755
|
});
|
|
694
756
|
return { files, dirs: filteredDirs };
|
|
@@ -753,7 +815,8 @@ function getElapsedTime(startTime) {
|
|
|
753
815
|
return ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
754
816
|
}
|
|
755
817
|
function getScoreBar(val) {
|
|
756
|
-
|
|
818
|
+
const clamped = Math.max(0, Math.min(100, val));
|
|
819
|
+
return "\u2588".repeat(Math.round(clamped / 10)).padEnd(10, "\u2591");
|
|
757
820
|
}
|
|
758
821
|
function getSafetyIcon(rating) {
|
|
759
822
|
switch (rating) {
|
|
@@ -1014,7 +1077,7 @@ var TypeScriptParser = class {
|
|
|
1014
1077
|
extractFromDeclaration(declaration, importedNames, code, parentNode) {
|
|
1015
1078
|
const exports2 = [];
|
|
1016
1079
|
const metadata = this.analyzeMetadata(parentNode || declaration, code);
|
|
1017
|
-
if (declaration.type === "FunctionDeclaration" && declaration.id) {
|
|
1080
|
+
if ((declaration.type === "FunctionDeclaration" || declaration.type === "TSDeclareFunction") && declaration.id) {
|
|
1018
1081
|
exports2.push({
|
|
1019
1082
|
name: declaration.id.name,
|
|
1020
1083
|
type: "function",
|
|
@@ -1042,11 +1105,21 @@ var TypeScriptParser = class {
|
|
|
1042
1105
|
const body = declaration.body.body;
|
|
1043
1106
|
const methods = body.filter((m) => m.type === "MethodDefinition");
|
|
1044
1107
|
const properties = body.filter((m) => m.type === "PropertyDefinition");
|
|
1108
|
+
const constructor = methods.find(
|
|
1109
|
+
(m) => m.kind === "constructor"
|
|
1110
|
+
);
|
|
1111
|
+
const parameters = constructor ? constructor.value.params.map((p) => {
|
|
1112
|
+
if (p.type === "Identifier") return p.name;
|
|
1113
|
+
if (p.type === "TSParameterProperty" && p.parameter.type === "Identifier")
|
|
1114
|
+
return p.parameter.name;
|
|
1115
|
+
return "unknown";
|
|
1116
|
+
}) : [];
|
|
1045
1117
|
exports2.push({
|
|
1046
1118
|
name: declaration.id.name,
|
|
1047
1119
|
type: "class",
|
|
1048
1120
|
methodCount: methods.length,
|
|
1049
1121
|
propertyCount: properties.length,
|
|
1122
|
+
parameters,
|
|
1050
1123
|
loc: declaration.loc ? {
|
|
1051
1124
|
start: {
|
|
1052
1125
|
line: declaration.loc.start.line,
|
|
@@ -2493,6 +2566,9 @@ var GoParser = class {
|
|
|
2493
2566
|
|
|
2494
2567
|
// src/parsers/parser-factory.ts
|
|
2495
2568
|
var ParserFactory = class _ParserFactory {
|
|
2569
|
+
/**
|
|
2570
|
+
* Create a new ParserFactory instance
|
|
2571
|
+
*/
|
|
2496
2572
|
constructor() {
|
|
2497
2573
|
this.parsers = /* @__PURE__ */ new Map();
|
|
2498
2574
|
this.extensionMap = new Map(
|
|
@@ -2505,7 +2581,9 @@ var ParserFactory = class _ParserFactory {
|
|
|
2505
2581
|
this.registerParser(new GoParser());
|
|
2506
2582
|
}
|
|
2507
2583
|
/**
|
|
2508
|
-
* Get singleton instance
|
|
2584
|
+
* Get the global singleton instance
|
|
2585
|
+
*
|
|
2586
|
+
* @returns The singleton ParserFactory instance
|
|
2509
2587
|
*/
|
|
2510
2588
|
static getInstance() {
|
|
2511
2589
|
if (!_ParserFactory.instance) {
|
|
@@ -3052,6 +3130,20 @@ function generateHTML(graph) {
|
|
|
3052
3130
|
}
|
|
3053
3131
|
|
|
3054
3132
|
// src/scoring.ts
|
|
3133
|
+
var RecommendationPriority = /* @__PURE__ */ ((RecommendationPriority2) => {
|
|
3134
|
+
RecommendationPriority2["High"] = "high";
|
|
3135
|
+
RecommendationPriority2["Medium"] = "medium";
|
|
3136
|
+
RecommendationPriority2["Low"] = "low";
|
|
3137
|
+
return RecommendationPriority2;
|
|
3138
|
+
})(RecommendationPriority || {});
|
|
3139
|
+
var ReadinessRating = /* @__PURE__ */ ((ReadinessRating2) => {
|
|
3140
|
+
ReadinessRating2["Excellent"] = "Excellent";
|
|
3141
|
+
ReadinessRating2["Good"] = "Good";
|
|
3142
|
+
ReadinessRating2["Fair"] = "Fair";
|
|
3143
|
+
ReadinessRating2["NeedsWork"] = "Needs Work";
|
|
3144
|
+
ReadinessRating2["Critical"] = "Critical";
|
|
3145
|
+
return ReadinessRating2;
|
|
3146
|
+
})(ReadinessRating || {});
|
|
3055
3147
|
var DEFAULT_TOOL_WEIGHTS = {
|
|
3056
3148
|
["pattern-detect" /* PatternDetect */]: 22,
|
|
3057
3149
|
["context-analyzer" /* ContextAnalyzer */]: 19,
|
|
@@ -3126,10 +3218,10 @@ function parseWeightString(weightStr) {
|
|
|
3126
3218
|
if (!weightStr) return weights;
|
|
3127
3219
|
const pairs = weightStr.split(",");
|
|
3128
3220
|
for (const pair of pairs) {
|
|
3129
|
-
const [toolShortName,
|
|
3130
|
-
if (toolShortName &&
|
|
3221
|
+
const [toolShortName, weightValueStr] = pair.split(":");
|
|
3222
|
+
if (toolShortName && weightValueStr) {
|
|
3131
3223
|
const toolName = normalizeToolName(toolShortName.trim());
|
|
3132
|
-
const weight = parseInt(
|
|
3224
|
+
const weight = parseInt(weightValueStr.trim(), 10);
|
|
3133
3225
|
if (!isNaN(weight) && weight > 0) {
|
|
3134
3226
|
weights.set(toolName, weight);
|
|
3135
3227
|
}
|
|
@@ -3184,11 +3276,11 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
3184
3276
|
};
|
|
3185
3277
|
}
|
|
3186
3278
|
function getRating(score) {
|
|
3187
|
-
if (score >= 90) return "Excellent"
|
|
3188
|
-
if (score >= 75) return "Good"
|
|
3189
|
-
if (score >= 60) return "Fair"
|
|
3190
|
-
if (score >= 40) return "Needs Work"
|
|
3191
|
-
return "Critical"
|
|
3279
|
+
if (score >= 90) return "Excellent" /* Excellent */;
|
|
3280
|
+
if (score >= 75) return "Good" /* Good */;
|
|
3281
|
+
if (score >= 60) return "Fair" /* Fair */;
|
|
3282
|
+
if (score >= 40) return "Needs Work" /* NeedsWork */;
|
|
3283
|
+
return "Critical" /* Critical */;
|
|
3192
3284
|
}
|
|
3193
3285
|
function getRatingWithContext(score, fileCount, modelTier = "standard") {
|
|
3194
3286
|
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
@@ -3197,16 +3289,18 @@ function getRatingWithContext(score, fileCount, modelTier = "standard") {
|
|
|
3197
3289
|
}
|
|
3198
3290
|
function getRatingDisplay(rating) {
|
|
3199
3291
|
switch (rating) {
|
|
3200
|
-
case "Excellent"
|
|
3292
|
+
case "Excellent" /* Excellent */:
|
|
3201
3293
|
return { emoji: "\u2705", color: "green" };
|
|
3202
|
-
case "Good"
|
|
3294
|
+
case "Good" /* Good */:
|
|
3203
3295
|
return { emoji: "\u{1F44D}", color: "blue" };
|
|
3204
|
-
case "Fair"
|
|
3296
|
+
case "Fair" /* Fair */:
|
|
3205
3297
|
return { emoji: "\u26A0\uFE0F", color: "yellow" };
|
|
3206
|
-
case "Needs Work"
|
|
3298
|
+
case "Needs Work" /* NeedsWork */:
|
|
3207
3299
|
return { emoji: "\u{1F528}", color: "orange" };
|
|
3208
|
-
case "Critical"
|
|
3300
|
+
case "Critical" /* Critical */:
|
|
3209
3301
|
return { emoji: "\u274C", color: "red" };
|
|
3302
|
+
default:
|
|
3303
|
+
return { emoji: "\u2753", color: "gray" };
|
|
3210
3304
|
}
|
|
3211
3305
|
}
|
|
3212
3306
|
function formatScore(result) {
|
|
@@ -3231,7 +3325,12 @@ function formatToolScore(output) {
|
|
|
3231
3325
|
result += ` Recommendations:
|
|
3232
3326
|
`;
|
|
3233
3327
|
output.recommendations.forEach((rec, i) => {
|
|
3234
|
-
|
|
3328
|
+
let priorityIcon = "\u{1F535}";
|
|
3329
|
+
const prio = rec.priority;
|
|
3330
|
+
if (prio === "high" /* High */ || prio === "high")
|
|
3331
|
+
priorityIcon = "\u{1F534}";
|
|
3332
|
+
else if (prio === "medium" /* Medium */ || prio === "medium")
|
|
3333
|
+
priorityIcon = "\u{1F7E1}";
|
|
3235
3334
|
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
3236
3335
|
`;
|
|
3237
3336
|
result += ` Impact: +${rec.estimatedImpact} points
|
|
@@ -3313,15 +3412,17 @@ var DEFAULT_COST_CONFIG = {
|
|
|
3313
3412
|
daysPerMonth: 30
|
|
3314
3413
|
};
|
|
3315
3414
|
function calculateMonthlyCost(tokenWaste, config = {}) {
|
|
3415
|
+
const multiplier = tokenWaste > 5e4 ? 5 : tokenWaste > 1e4 ? 3.5 : 2.5;
|
|
3316
3416
|
const budget = calculateTokenBudget({
|
|
3317
|
-
totalContextTokens: tokenWaste *
|
|
3417
|
+
totalContextTokens: tokenWaste * multiplier,
|
|
3318
3418
|
wastedTokens: {
|
|
3319
3419
|
duplication: tokenWaste * 0.7,
|
|
3320
3420
|
fragmentation: tokenWaste * 0.3,
|
|
3321
|
-
chattiness: 0
|
|
3421
|
+
chattiness: 0.1 * tokenWaste
|
|
3422
|
+
// Added baseline chattiness
|
|
3322
3423
|
}
|
|
3323
3424
|
});
|
|
3324
|
-
const preset = getModelPreset("claude-
|
|
3425
|
+
const preset = getModelPreset("claude-3.5-sonnet");
|
|
3325
3426
|
return estimateCostFromBudget(budget, preset, config);
|
|
3326
3427
|
}
|
|
3327
3428
|
function calculateTokenBudget(params) {
|
|
@@ -3803,7 +3904,7 @@ function calculatePatternEntropy(files) {
|
|
|
3803
3904
|
}
|
|
3804
3905
|
const dirGroups = /* @__PURE__ */ new Map();
|
|
3805
3906
|
for (const file of files) {
|
|
3806
|
-
const parts = file.path.split("/").slice(0,
|
|
3907
|
+
const parts = file.path.split("/").slice(0, -1).join("/") || "root";
|
|
3807
3908
|
dirGroups.set(parts, (dirGroups.get(parts) || 0) + 1);
|
|
3808
3909
|
}
|
|
3809
3910
|
const counts = Array.from(dirGroups.values());
|
|
@@ -4659,6 +4760,8 @@ function getRepoMetadata(directory) {
|
|
|
4659
4760
|
ParseError,
|
|
4660
4761
|
ParserFactory,
|
|
4661
4762
|
PythonParser,
|
|
4763
|
+
ReadinessRating,
|
|
4764
|
+
RecommendationPriority,
|
|
4662
4765
|
SEVERITY_TIME_ESTIMATES,
|
|
4663
4766
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
4664
4767
|
Severity,
|