@aiready/core 0.9.33 → 0.9.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.mts +65 -3
- package/dist/client.d.ts +65 -3
- package/dist/index.d.mts +70 -7
- package/dist/index.d.ts +70 -7
- package/dist/index.js +319 -58
- package/dist/index.mjs +319 -66
- package/package.json +1 -1
package/dist/client.d.mts
CHANGED
|
@@ -52,6 +52,29 @@ interface CostConfig {
|
|
|
52
52
|
/** Days per month (default: 30) */
|
|
53
53
|
daysPerMonth: number;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Token budget metrics (v0.13+)
|
|
57
|
+
* Technology-agnostic unit economics for AI impact.
|
|
58
|
+
*/
|
|
59
|
+
interface TokenBudget {
|
|
60
|
+
/** Total tokens required for full task context */
|
|
61
|
+
totalContextTokens: number;
|
|
62
|
+
/** Estimated tokens generated in response */
|
|
63
|
+
estimatedResponseTokens: number;
|
|
64
|
+
/** Tokens wasted on redundant/duplicated context */
|
|
65
|
+
wastedTokens: {
|
|
66
|
+
total: number;
|
|
67
|
+
bySource: {
|
|
68
|
+
duplication: number;
|
|
69
|
+
fragmentation: number;
|
|
70
|
+
chattiness: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/** Context efficiency ratio (0-1). 1.0 = perfect efficiency. */
|
|
74
|
+
efficiencyRatio: number;
|
|
75
|
+
/** Estimated tokens saved if recommendations are followed */
|
|
76
|
+
potentialRetrievableTokens: number;
|
|
77
|
+
}
|
|
55
78
|
/**
|
|
56
79
|
* Productivity impact estimates
|
|
57
80
|
*/
|
|
@@ -109,19 +132,52 @@ interface ComprehensionDifficulty {
|
|
|
109
132
|
/** Interpretation */
|
|
110
133
|
rating: 'trivial' | 'easy' | 'moderate' | 'difficult' | 'expert';
|
|
111
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
/**
|
|
137
|
+
* Technical Value Chain
|
|
138
|
+
* Traces a technical issue through its impact on AI and developer outcomes.
|
|
139
|
+
*/
|
|
140
|
+
interface TechnicalValueChain {
|
|
141
|
+
issueType: string;
|
|
142
|
+
technicalMetric: string;
|
|
143
|
+
technicalValue: number;
|
|
144
|
+
aiImpact: {
|
|
145
|
+
description: string;
|
|
146
|
+
scoreImpact: number;
|
|
147
|
+
};
|
|
148
|
+
developerImpact: {
|
|
149
|
+
description: string;
|
|
150
|
+
productivityLoss: number;
|
|
151
|
+
};
|
|
152
|
+
businessOutcome: {
|
|
153
|
+
directCost: number;
|
|
154
|
+
opportunityCost: number;
|
|
155
|
+
riskLevel: 'low' | 'moderate' | 'high' | 'critical';
|
|
156
|
+
};
|
|
157
|
+
}
|
|
112
158
|
/**
|
|
113
159
|
* Extended report with business metrics
|
|
114
160
|
*/
|
|
115
161
|
interface BusinessReport extends Report {
|
|
116
162
|
businessMetrics: {
|
|
117
|
-
/**
|
|
118
|
-
|
|
163
|
+
/** Token-based unit economics (v0.13+) */
|
|
164
|
+
tokenBudget: TokenBudget;
|
|
165
|
+
/** @deprecated Use tokenBudget instead. Estimated monthly cost impact of AI context waste */
|
|
166
|
+
estimatedMonthlyCost: {
|
|
167
|
+
total: number;
|
|
168
|
+
range: [number, number];
|
|
169
|
+
confidence: number;
|
|
170
|
+
};
|
|
171
|
+
/** Opportunity cost of project delay due to technical debt */
|
|
172
|
+
opportunityCost: number;
|
|
119
173
|
/** Estimated developer hours to address issues */
|
|
120
174
|
estimatedDeveloperHours: number;
|
|
121
175
|
/** Predicted AI suggestion acceptance rate */
|
|
122
176
|
aiAcceptanceRate: number;
|
|
123
177
|
/** Comprehension difficulty assessment */
|
|
124
178
|
comprehensionDifficulty: ComprehensionDifficulty;
|
|
179
|
+
/** Traces for specific critical issues */
|
|
180
|
+
valueChains?: TechnicalValueChain[];
|
|
125
181
|
/** Timestamp for trend tracking */
|
|
126
182
|
period?: string;
|
|
127
183
|
};
|
|
@@ -131,6 +187,8 @@ interface ScanOptions {
|
|
|
131
187
|
include?: string[];
|
|
132
188
|
exclude?: string[];
|
|
133
189
|
maxDepth?: number;
|
|
190
|
+
onProgress?: (processed: number, total: number, message: string) => void;
|
|
191
|
+
includeTests?: boolean;
|
|
134
192
|
}
|
|
135
193
|
interface AIReadyConfig {
|
|
136
194
|
scan?: {
|
|
@@ -250,6 +308,8 @@ interface GraphMetadata {
|
|
|
250
308
|
majorIssues: number;
|
|
251
309
|
minorIssues: number;
|
|
252
310
|
infoIssues: number;
|
|
311
|
+
/** AI token budget unit economics (v0.13+) */
|
|
312
|
+
tokenBudget?: TokenBudget;
|
|
253
313
|
}
|
|
254
314
|
/**
|
|
255
315
|
* Complete graph data structure for visualization
|
|
@@ -444,6 +504,8 @@ interface ToolScoringOutput {
|
|
|
444
504
|
toolName: string;
|
|
445
505
|
/** Normalized 0-100 score for this tool */
|
|
446
506
|
score: number;
|
|
507
|
+
/** AI token budget unit economics (v0.13+) */
|
|
508
|
+
tokenBudget?: TokenBudget;
|
|
447
509
|
/** Raw metrics used to calculate the score */
|
|
448
510
|
rawMetrics: Record<string, any>;
|
|
449
511
|
/** Factors that influenced the score */
|
|
@@ -613,4 +675,4 @@ declare function formatToolScore(output: ToolScoringOutput): string;
|
|
|
613
675
|
*/
|
|
614
676
|
declare function generateHTML(graph: GraphData): string;
|
|
615
677
|
|
|
616
|
-
export { type AIReadyConfig, type AcceptancePrediction, type AnalysisResult, type BusinessReport, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, type IssueType, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, type Metrics, type ModelContextTier, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type ProductivityImpact, type Report, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, type ScoringResult, type SourceLocation, type SourceRange, TOOL_NAME_MAP, type ToolScoringOutput, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
|
|
678
|
+
export { type AIReadyConfig, type AcceptancePrediction, type AnalysisResult, type BusinessReport, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, type IssueType, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, type Metrics, type ModelContextTier, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type ProductivityImpact, type Report, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, type ScoringResult, type SourceLocation, type SourceRange, TOOL_NAME_MAP, type TechnicalValueChain, type TokenBudget, type ToolScoringOutput, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
|
package/dist/client.d.ts
CHANGED
|
@@ -52,6 +52,29 @@ interface CostConfig {
|
|
|
52
52
|
/** Days per month (default: 30) */
|
|
53
53
|
daysPerMonth: number;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Token budget metrics (v0.13+)
|
|
57
|
+
* Technology-agnostic unit economics for AI impact.
|
|
58
|
+
*/
|
|
59
|
+
interface TokenBudget {
|
|
60
|
+
/** Total tokens required for full task context */
|
|
61
|
+
totalContextTokens: number;
|
|
62
|
+
/** Estimated tokens generated in response */
|
|
63
|
+
estimatedResponseTokens: number;
|
|
64
|
+
/** Tokens wasted on redundant/duplicated context */
|
|
65
|
+
wastedTokens: {
|
|
66
|
+
total: number;
|
|
67
|
+
bySource: {
|
|
68
|
+
duplication: number;
|
|
69
|
+
fragmentation: number;
|
|
70
|
+
chattiness: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/** Context efficiency ratio (0-1). 1.0 = perfect efficiency. */
|
|
74
|
+
efficiencyRatio: number;
|
|
75
|
+
/** Estimated tokens saved if recommendations are followed */
|
|
76
|
+
potentialRetrievableTokens: number;
|
|
77
|
+
}
|
|
55
78
|
/**
|
|
56
79
|
* Productivity impact estimates
|
|
57
80
|
*/
|
|
@@ -109,19 +132,52 @@ interface ComprehensionDifficulty {
|
|
|
109
132
|
/** Interpretation */
|
|
110
133
|
rating: 'trivial' | 'easy' | 'moderate' | 'difficult' | 'expert';
|
|
111
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
/**
|
|
137
|
+
* Technical Value Chain
|
|
138
|
+
* Traces a technical issue through its impact on AI and developer outcomes.
|
|
139
|
+
*/
|
|
140
|
+
interface TechnicalValueChain {
|
|
141
|
+
issueType: string;
|
|
142
|
+
technicalMetric: string;
|
|
143
|
+
technicalValue: number;
|
|
144
|
+
aiImpact: {
|
|
145
|
+
description: string;
|
|
146
|
+
scoreImpact: number;
|
|
147
|
+
};
|
|
148
|
+
developerImpact: {
|
|
149
|
+
description: string;
|
|
150
|
+
productivityLoss: number;
|
|
151
|
+
};
|
|
152
|
+
businessOutcome: {
|
|
153
|
+
directCost: number;
|
|
154
|
+
opportunityCost: number;
|
|
155
|
+
riskLevel: 'low' | 'moderate' | 'high' | 'critical';
|
|
156
|
+
};
|
|
157
|
+
}
|
|
112
158
|
/**
|
|
113
159
|
* Extended report with business metrics
|
|
114
160
|
*/
|
|
115
161
|
interface BusinessReport extends Report {
|
|
116
162
|
businessMetrics: {
|
|
117
|
-
/**
|
|
118
|
-
|
|
163
|
+
/** Token-based unit economics (v0.13+) */
|
|
164
|
+
tokenBudget: TokenBudget;
|
|
165
|
+
/** @deprecated Use tokenBudget instead. Estimated monthly cost impact of AI context waste */
|
|
166
|
+
estimatedMonthlyCost: {
|
|
167
|
+
total: number;
|
|
168
|
+
range: [number, number];
|
|
169
|
+
confidence: number;
|
|
170
|
+
};
|
|
171
|
+
/** Opportunity cost of project delay due to technical debt */
|
|
172
|
+
opportunityCost: number;
|
|
119
173
|
/** Estimated developer hours to address issues */
|
|
120
174
|
estimatedDeveloperHours: number;
|
|
121
175
|
/** Predicted AI suggestion acceptance rate */
|
|
122
176
|
aiAcceptanceRate: number;
|
|
123
177
|
/** Comprehension difficulty assessment */
|
|
124
178
|
comprehensionDifficulty: ComprehensionDifficulty;
|
|
179
|
+
/** Traces for specific critical issues */
|
|
180
|
+
valueChains?: TechnicalValueChain[];
|
|
125
181
|
/** Timestamp for trend tracking */
|
|
126
182
|
period?: string;
|
|
127
183
|
};
|
|
@@ -131,6 +187,8 @@ interface ScanOptions {
|
|
|
131
187
|
include?: string[];
|
|
132
188
|
exclude?: string[];
|
|
133
189
|
maxDepth?: number;
|
|
190
|
+
onProgress?: (processed: number, total: number, message: string) => void;
|
|
191
|
+
includeTests?: boolean;
|
|
134
192
|
}
|
|
135
193
|
interface AIReadyConfig {
|
|
136
194
|
scan?: {
|
|
@@ -250,6 +308,8 @@ interface GraphMetadata {
|
|
|
250
308
|
majorIssues: number;
|
|
251
309
|
minorIssues: number;
|
|
252
310
|
infoIssues: number;
|
|
311
|
+
/** AI token budget unit economics (v0.13+) */
|
|
312
|
+
tokenBudget?: TokenBudget;
|
|
253
313
|
}
|
|
254
314
|
/**
|
|
255
315
|
* Complete graph data structure for visualization
|
|
@@ -444,6 +504,8 @@ interface ToolScoringOutput {
|
|
|
444
504
|
toolName: string;
|
|
445
505
|
/** Normalized 0-100 score for this tool */
|
|
446
506
|
score: number;
|
|
507
|
+
/** AI token budget unit economics (v0.13+) */
|
|
508
|
+
tokenBudget?: TokenBudget;
|
|
447
509
|
/** Raw metrics used to calculate the score */
|
|
448
510
|
rawMetrics: Record<string, any>;
|
|
449
511
|
/** Factors that influenced the score */
|
|
@@ -613,4 +675,4 @@ declare function formatToolScore(output: ToolScoringOutput): string;
|
|
|
613
675
|
*/
|
|
614
676
|
declare function generateHTML(graph: GraphData): string;
|
|
615
677
|
|
|
616
|
-
export { type AIReadyConfig, type AcceptancePrediction, type AnalysisResult, type BusinessReport, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, type IssueType, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, type Metrics, type ModelContextTier, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type ProductivityImpact, type Report, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, type ScoringResult, type SourceLocation, type SourceRange, TOOL_NAME_MAP, type ToolScoringOutput, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
|
|
678
|
+
export { type AIReadyConfig, type AcceptancePrediction, type AnalysisResult, type BusinessReport, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, type IssueType, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, type Metrics, type ModelContextTier, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type ProductivityImpact, type Report, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, type ScoringResult, type SourceLocation, type SourceRange, TOOL_NAME_MAP, type TechnicalValueChain, type TokenBudget, type ToolScoringOutput, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ScanOptions, AIReadyConfig, CostConfig, ModelContextTier, ComprehensionDifficulty, ProductivityImpact, ToolScoringOutput, AcceptancePrediction, LanguageParser, Language, ParseResult, NamingConvention } from './client.mjs';
|
|
1
|
+
import { ScanOptions, AIReadyConfig, CostConfig, ModelContextTier, ComprehensionDifficulty, ProductivityImpact, TokenBudget, TechnicalValueChain, ToolScoringOutput, AcceptancePrediction, LanguageParser, Language, ParseResult, NamingConvention } from './client.mjs';
|
|
2
2
|
export { AnalysisResult, BusinessReport, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, ExportInfo, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueType, LANGUAGE_EXTENSIONS, LanguageConfig, Location, Metrics, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, SourceLocation, SourceRange, TOOL_NAME_MAP, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
|
|
3
3
|
|
|
4
4
|
declare const DEFAULT_EXCLUDE: string[];
|
|
5
|
+
declare const VAGUE_FILE_NAMES: Set<string>;
|
|
5
6
|
/**
|
|
6
7
|
* Scan files in a directory using glob patterns
|
|
7
8
|
*
|
|
@@ -12,6 +13,14 @@ declare const DEFAULT_EXCLUDE: string[];
|
|
|
12
13
|
* @returns Array of absolute file paths matching the patterns
|
|
13
14
|
*/
|
|
14
15
|
declare function scanFiles(options: ScanOptions): Promise<string[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Scan for both files and directories, respecting ignore rules.
|
|
18
|
+
* Useful for tools that need to analyze directory structure.
|
|
19
|
+
*/
|
|
20
|
+
declare function scanEntries(options: ScanOptions): Promise<{
|
|
21
|
+
files: string[];
|
|
22
|
+
dirs: string[];
|
|
23
|
+
}>;
|
|
15
24
|
declare function readFileContent(filePath: string): Promise<string>;
|
|
16
25
|
declare function getFileExtension(filePath: string): string;
|
|
17
26
|
declare function isSourceFile(filePath: string): boolean;
|
|
@@ -139,7 +148,7 @@ interface ModelPricingPreset {
|
|
|
139
148
|
}
|
|
140
149
|
declare const MODEL_PRICING_PRESETS: Record<string, ModelPricingPreset>;
|
|
141
150
|
/**
|
|
142
|
-
* Get a model pricing preset by ID, with fallback to
|
|
151
|
+
* Get a model pricing preset by ID, with fallback to claude-4.6 (2026 default)
|
|
143
152
|
*/
|
|
144
153
|
declare function getModelPreset(modelId: string): ModelPricingPreset;
|
|
145
154
|
/**
|
|
@@ -228,11 +237,38 @@ interface DebtBreakdown {
|
|
|
228
237
|
*/
|
|
229
238
|
declare const DEFAULT_COST_CONFIG: CostConfig;
|
|
230
239
|
/**
|
|
231
|
-
*
|
|
240
|
+
* @deprecated Since v0.13. Use calculateTokenBudget() + estimateCostFromBudget() instead.
|
|
241
|
+
* Dollar costs are volatile based on technology; token budgets are stable unit economics.
|
|
232
242
|
*
|
|
233
|
-
*
|
|
243
|
+
* Calculate estimated monthly cost of AI context waste with confidence intervals.
|
|
234
244
|
*/
|
|
235
|
-
declare function calculateMonthlyCost(tokenWaste: number, config?: Partial<CostConfig>):
|
|
245
|
+
declare function calculateMonthlyCost(tokenWaste: number, config?: Partial<CostConfig>): {
|
|
246
|
+
total: number;
|
|
247
|
+
range: [number, number];
|
|
248
|
+
confidence: number;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Calculate token budget and unit economics for AI interactions.
|
|
252
|
+
* Technology-agnostic metric that remains valid across model generations.
|
|
253
|
+
*/
|
|
254
|
+
declare function calculateTokenBudget(params: {
|
|
255
|
+
totalContextTokens: number;
|
|
256
|
+
estimatedResponseTokens?: number;
|
|
257
|
+
wastedTokens: {
|
|
258
|
+
duplication: number;
|
|
259
|
+
fragmentation: number;
|
|
260
|
+
chattiness: number;
|
|
261
|
+
};
|
|
262
|
+
}): TokenBudget;
|
|
263
|
+
/**
|
|
264
|
+
* Estimate dollar cost from a token budget using model presets.
|
|
265
|
+
* Note: Use this for presentation only. Token budgets are the primary metric.
|
|
266
|
+
*/
|
|
267
|
+
declare function estimateCostFromBudget(budget: TokenBudget, model: ModelPricingPreset, config?: Partial<CostConfig>): {
|
|
268
|
+
total: number;
|
|
269
|
+
range: [number, number];
|
|
270
|
+
confidence: number;
|
|
271
|
+
};
|
|
236
272
|
/**
|
|
237
273
|
* Calculate productivity impact from issues
|
|
238
274
|
*/
|
|
@@ -244,9 +280,10 @@ declare function calculateProductivityImpact(issues: {
|
|
|
244
280
|
*
|
|
245
281
|
* Calibration notes (v0.12):
|
|
246
282
|
* - GitHub Copilot reports ~30% industry average acceptance rate (2023 blog)
|
|
283
|
+
* - Research (Ziegler et al., 2022) indicates acceptance rate is a proxy for productivity
|
|
247
284
|
* - Internal teams with high-consistency codebases report 40-55%
|
|
248
285
|
* - Teams with semantic duplication report 20-25% (AI suggests wrong variant)
|
|
249
|
-
* - Context efficiency is the strongest single predictor
|
|
286
|
+
* - Context efficiency is the strongest single predictor (empirical correlation: r=0.68)
|
|
250
287
|
*
|
|
251
288
|
* Confidence levels:
|
|
252
289
|
* - 3 tools: 0.75 (triangulated estimate)
|
|
@@ -316,6 +353,14 @@ declare function calculateTechnicalDebtInterest(params: {
|
|
|
316
353
|
* Get debt breakdown by category
|
|
317
354
|
*/
|
|
318
355
|
declare function getDebtBreakdown(patternCost: number, contextCost: number, consistencyCost: number): DebtBreakdown[];
|
|
356
|
+
/**
|
|
357
|
+
* Generate a Technical Value Chain for a specific issue
|
|
358
|
+
*/
|
|
359
|
+
declare function generateValueChain(params: {
|
|
360
|
+
issueType: string;
|
|
361
|
+
count: number;
|
|
362
|
+
severity: 'critical' | 'major' | 'minor';
|
|
363
|
+
}): TechnicalValueChain;
|
|
319
364
|
|
|
320
365
|
/**
|
|
321
366
|
* Parser Factory - Manages language-specific parsers
|
|
@@ -826,4 +871,22 @@ declare function exportHistory(rootDir: string, format?: 'json' | 'csv'): string
|
|
|
826
871
|
*/
|
|
827
872
|
declare function clearHistory(rootDir: string): void;
|
|
828
873
|
|
|
829
|
-
|
|
874
|
+
/**
|
|
875
|
+
* Get git commit timestamps for each line in a file
|
|
876
|
+
*/
|
|
877
|
+
declare function getFileCommitTimestamps(file: string): Record<number, number>;
|
|
878
|
+
/**
|
|
879
|
+
* Get the latest commit timestamp for a line range
|
|
880
|
+
*/
|
|
881
|
+
declare function getLineRangeLastModifiedCached(lineStamps: Record<number, number>, startLine: number, endLine: number): number;
|
|
882
|
+
/**
|
|
883
|
+
* Get repository metadata (URL, branch, commit, author)
|
|
884
|
+
*/
|
|
885
|
+
declare function getRepoMetadata(directory: string): {
|
|
886
|
+
url?: string;
|
|
887
|
+
branch?: string;
|
|
888
|
+
commit?: string;
|
|
889
|
+
author?: string;
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DebtBreakdown, type DependencyHealthScore, type DocDriftRisk, type ExportWithImports, type FileImport, type FileWithDomain, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, type RemediationVelocity, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, type TechnicalDebtInterest, TechnicalValueChain, type TestabilityIndex, TokenBudget, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateRemediationVelocity, calculateScoreTrend, calculateSemanticDistance, calculateTechnicalDebtInterest, calculateTestabilityIndex, calculateTokenBudget, clearHistory, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getDebtBreakdown, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ScanOptions, AIReadyConfig, CostConfig, ModelContextTier, ComprehensionDifficulty, ProductivityImpact, ToolScoringOutput, AcceptancePrediction, LanguageParser, Language, ParseResult, NamingConvention } from './client.js';
|
|
1
|
+
import { ScanOptions, AIReadyConfig, CostConfig, ModelContextTier, ComprehensionDifficulty, ProductivityImpact, TokenBudget, TechnicalValueChain, ToolScoringOutput, AcceptancePrediction, LanguageParser, Language, ParseResult, NamingConvention } from './client.js';
|
|
2
2
|
export { AnalysisResult, BusinessReport, CONTEXT_TIER_THRESHOLDS, CommonASTNode, DEFAULT_TOOL_WEIGHTS, ExportInfo, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueType, LANGUAGE_EXTENSIONS, LanguageConfig, Location, Metrics, ParseError, ParseStatistics, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, SourceLocation, SourceRange, TOOL_NAME_MAP, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
|
|
3
3
|
|
|
4
4
|
declare const DEFAULT_EXCLUDE: string[];
|
|
5
|
+
declare const VAGUE_FILE_NAMES: Set<string>;
|
|
5
6
|
/**
|
|
6
7
|
* Scan files in a directory using glob patterns
|
|
7
8
|
*
|
|
@@ -12,6 +13,14 @@ declare const DEFAULT_EXCLUDE: string[];
|
|
|
12
13
|
* @returns Array of absolute file paths matching the patterns
|
|
13
14
|
*/
|
|
14
15
|
declare function scanFiles(options: ScanOptions): Promise<string[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Scan for both files and directories, respecting ignore rules.
|
|
18
|
+
* Useful for tools that need to analyze directory structure.
|
|
19
|
+
*/
|
|
20
|
+
declare function scanEntries(options: ScanOptions): Promise<{
|
|
21
|
+
files: string[];
|
|
22
|
+
dirs: string[];
|
|
23
|
+
}>;
|
|
15
24
|
declare function readFileContent(filePath: string): Promise<string>;
|
|
16
25
|
declare function getFileExtension(filePath: string): string;
|
|
17
26
|
declare function isSourceFile(filePath: string): boolean;
|
|
@@ -139,7 +148,7 @@ interface ModelPricingPreset {
|
|
|
139
148
|
}
|
|
140
149
|
declare const MODEL_PRICING_PRESETS: Record<string, ModelPricingPreset>;
|
|
141
150
|
/**
|
|
142
|
-
* Get a model pricing preset by ID, with fallback to
|
|
151
|
+
* Get a model pricing preset by ID, with fallback to claude-4.6 (2026 default)
|
|
143
152
|
*/
|
|
144
153
|
declare function getModelPreset(modelId: string): ModelPricingPreset;
|
|
145
154
|
/**
|
|
@@ -228,11 +237,38 @@ interface DebtBreakdown {
|
|
|
228
237
|
*/
|
|
229
238
|
declare const DEFAULT_COST_CONFIG: CostConfig;
|
|
230
239
|
/**
|
|
231
|
-
*
|
|
240
|
+
* @deprecated Since v0.13. Use calculateTokenBudget() + estimateCostFromBudget() instead.
|
|
241
|
+
* Dollar costs are volatile based on technology; token budgets are stable unit economics.
|
|
232
242
|
*
|
|
233
|
-
*
|
|
243
|
+
* Calculate estimated monthly cost of AI context waste with confidence intervals.
|
|
234
244
|
*/
|
|
235
|
-
declare function calculateMonthlyCost(tokenWaste: number, config?: Partial<CostConfig>):
|
|
245
|
+
declare function calculateMonthlyCost(tokenWaste: number, config?: Partial<CostConfig>): {
|
|
246
|
+
total: number;
|
|
247
|
+
range: [number, number];
|
|
248
|
+
confidence: number;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Calculate token budget and unit economics for AI interactions.
|
|
252
|
+
* Technology-agnostic metric that remains valid across model generations.
|
|
253
|
+
*/
|
|
254
|
+
declare function calculateTokenBudget(params: {
|
|
255
|
+
totalContextTokens: number;
|
|
256
|
+
estimatedResponseTokens?: number;
|
|
257
|
+
wastedTokens: {
|
|
258
|
+
duplication: number;
|
|
259
|
+
fragmentation: number;
|
|
260
|
+
chattiness: number;
|
|
261
|
+
};
|
|
262
|
+
}): TokenBudget;
|
|
263
|
+
/**
|
|
264
|
+
* Estimate dollar cost from a token budget using model presets.
|
|
265
|
+
* Note: Use this for presentation only. Token budgets are the primary metric.
|
|
266
|
+
*/
|
|
267
|
+
declare function estimateCostFromBudget(budget: TokenBudget, model: ModelPricingPreset, config?: Partial<CostConfig>): {
|
|
268
|
+
total: number;
|
|
269
|
+
range: [number, number];
|
|
270
|
+
confidence: number;
|
|
271
|
+
};
|
|
236
272
|
/**
|
|
237
273
|
* Calculate productivity impact from issues
|
|
238
274
|
*/
|
|
@@ -244,9 +280,10 @@ declare function calculateProductivityImpact(issues: {
|
|
|
244
280
|
*
|
|
245
281
|
* Calibration notes (v0.12):
|
|
246
282
|
* - GitHub Copilot reports ~30% industry average acceptance rate (2023 blog)
|
|
283
|
+
* - Research (Ziegler et al., 2022) indicates acceptance rate is a proxy for productivity
|
|
247
284
|
* - Internal teams with high-consistency codebases report 40-55%
|
|
248
285
|
* - Teams with semantic duplication report 20-25% (AI suggests wrong variant)
|
|
249
|
-
* - Context efficiency is the strongest single predictor
|
|
286
|
+
* - Context efficiency is the strongest single predictor (empirical correlation: r=0.68)
|
|
250
287
|
*
|
|
251
288
|
* Confidence levels:
|
|
252
289
|
* - 3 tools: 0.75 (triangulated estimate)
|
|
@@ -316,6 +353,14 @@ declare function calculateTechnicalDebtInterest(params: {
|
|
|
316
353
|
* Get debt breakdown by category
|
|
317
354
|
*/
|
|
318
355
|
declare function getDebtBreakdown(patternCost: number, contextCost: number, consistencyCost: number): DebtBreakdown[];
|
|
356
|
+
/**
|
|
357
|
+
* Generate a Technical Value Chain for a specific issue
|
|
358
|
+
*/
|
|
359
|
+
declare function generateValueChain(params: {
|
|
360
|
+
issueType: string;
|
|
361
|
+
count: number;
|
|
362
|
+
severity: 'critical' | 'major' | 'minor';
|
|
363
|
+
}): TechnicalValueChain;
|
|
319
364
|
|
|
320
365
|
/**
|
|
321
366
|
* Parser Factory - Manages language-specific parsers
|
|
@@ -826,4 +871,22 @@ declare function exportHistory(rootDir: string, format?: 'json' | 'csv'): string
|
|
|
826
871
|
*/
|
|
827
872
|
declare function clearHistory(rootDir: string): void;
|
|
828
873
|
|
|
829
|
-
|
|
874
|
+
/**
|
|
875
|
+
* Get git commit timestamps for each line in a file
|
|
876
|
+
*/
|
|
877
|
+
declare function getFileCommitTimestamps(file: string): Record<number, number>;
|
|
878
|
+
/**
|
|
879
|
+
* Get the latest commit timestamp for a line range
|
|
880
|
+
*/
|
|
881
|
+
declare function getLineRangeLastModifiedCached(lineStamps: Record<number, number>, startLine: number, endLine: number): number;
|
|
882
|
+
/**
|
|
883
|
+
* Get repository metadata (URL, branch, commit, author)
|
|
884
|
+
*/
|
|
885
|
+
declare function getRepoMetadata(directory: string): {
|
|
886
|
+
url?: string;
|
|
887
|
+
branch?: string;
|
|
888
|
+
commit?: string;
|
|
889
|
+
author?: string;
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DebtBreakdown, type DependencyHealthScore, type DocDriftRisk, type ExportWithImports, type FileImport, type FileWithDomain, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, type RemediationVelocity, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, type TechnicalDebtInterest, TechnicalValueChain, type TestabilityIndex, TokenBudget, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateRemediationVelocity, calculateScoreTrend, calculateSemanticDistance, calculateTechnicalDebtInterest, calculateTestabilityIndex, calculateTokenBudget, clearHistory, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getDebtBreakdown, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles };
|