@aiready/core 0.21.4 → 0.21.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +56 -52
- package/dist/index.d.ts +56 -52
- package/dist/index.js +99 -91
- package/dist/index.mjs +96 -89
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -100,6 +100,61 @@ declare function readFileContent(filePath: string): Promise<string>;
|
|
|
100
100
|
declare function getFileExtension(filePath: string): string;
|
|
101
101
|
declare function isSourceFile(filePath: string): boolean;
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Common CLI configuration interface
|
|
105
|
+
*/
|
|
106
|
+
interface CLIOptions {
|
|
107
|
+
rootDir: string;
|
|
108
|
+
include?: string[];
|
|
109
|
+
exclude?: string[];
|
|
110
|
+
[key: string]: any;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Resolve output file path, defaulting to .aiready directory
|
|
114
|
+
* Creates parent directories if they don't exist.
|
|
115
|
+
* @param userPath - User-provided output path (optional)
|
|
116
|
+
* @param defaultFilename - Default filename to use
|
|
117
|
+
* @param workingDir - Working directory (default: process.cwd())
|
|
118
|
+
* @returns Resolved absolute path
|
|
119
|
+
*/
|
|
120
|
+
declare function resolveOutputPath(userPath: string | undefined, defaultFilename: string, workingDir?: string): string;
|
|
121
|
+
/**
|
|
122
|
+
* Load and merge configuration with CLI options
|
|
123
|
+
*/
|
|
124
|
+
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): Promise<T & {
|
|
125
|
+
rootDir: string;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Handle JSON output for CLI commands
|
|
129
|
+
*/
|
|
130
|
+
declare function handleJSONOutput(data: any, outputFile?: string, successMessage?: string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Common error handler for CLI commands
|
|
133
|
+
*/
|
|
134
|
+
declare function handleCLIError(error: unknown, commandName: string): never;
|
|
135
|
+
/**
|
|
136
|
+
* Calculate elapsed time and format for display
|
|
137
|
+
*/
|
|
138
|
+
declare function getElapsedTime(startTime: number): string;
|
|
139
|
+
/**
|
|
140
|
+
* Generate a visual score bar for console output
|
|
141
|
+
*/
|
|
142
|
+
declare function getScoreBar(val: number): string;
|
|
143
|
+
/**
|
|
144
|
+
* Get status icon for safety ratings
|
|
145
|
+
*/
|
|
146
|
+
declare function getSafetyIcon(rating: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* Emit progress update with throttling to reduce log noise
|
|
149
|
+
*/
|
|
150
|
+
declare function emitProgress(processed: number, total: number, toolId: string, message: string, onProgress?: (processed: number, total: number, message: string) => void, throttleCount?: number): void;
|
|
151
|
+
/**
|
|
152
|
+
* Get chalk color function for a given severity
|
|
153
|
+
* @param severity severity level
|
|
154
|
+
* @param chalk chalk instance
|
|
155
|
+
*/
|
|
156
|
+
declare function getSeverityColor(severity: string, chalk: any): any;
|
|
157
|
+
|
|
103
158
|
interface ExportWithImports {
|
|
104
159
|
name: string;
|
|
105
160
|
type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default';
|
|
@@ -159,57 +214,6 @@ declare function estimateTokens(text: string): number;
|
|
|
159
214
|
declare function loadConfig(rootDir: string): Promise<AIReadyConfig | null>;
|
|
160
215
|
declare function mergeConfigWithDefaults(userConfig: AIReadyConfig | null, defaults: any): any;
|
|
161
216
|
|
|
162
|
-
/**
|
|
163
|
-
* Common CLI configuration interface
|
|
164
|
-
*/
|
|
165
|
-
interface CLIOptions {
|
|
166
|
-
rootDir: string;
|
|
167
|
-
include?: string[];
|
|
168
|
-
exclude?: string[];
|
|
169
|
-
[key: string]: any;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Resolve output file path, defaulting to .aiready directory
|
|
173
|
-
* Creates parent directories if they don't exist.
|
|
174
|
-
* @param userPath - User-provided output path (optional)
|
|
175
|
-
* @param defaultFilename - Default filename to use
|
|
176
|
-
* @param workingDir - Working directory (default: process.cwd())
|
|
177
|
-
* @returns Resolved absolute path
|
|
178
|
-
*/
|
|
179
|
-
declare function resolveOutputPath(userPath: string | undefined, defaultFilename: string, workingDir?: string): string;
|
|
180
|
-
/**
|
|
181
|
-
* Load and merge configuration with CLI options
|
|
182
|
-
*/
|
|
183
|
-
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): Promise<T & {
|
|
184
|
-
rootDir: string;
|
|
185
|
-
}>;
|
|
186
|
-
/**
|
|
187
|
-
* Handle JSON output for CLI commands
|
|
188
|
-
*/
|
|
189
|
-
declare function handleJSONOutput(data: any, outputFile?: string, successMessage?: string): void;
|
|
190
|
-
/**
|
|
191
|
-
* Common error handler for CLI commands
|
|
192
|
-
*/
|
|
193
|
-
declare function handleCLIError(error: unknown, commandName: string): never;
|
|
194
|
-
/**
|
|
195
|
-
* Calculate elapsed time and format for display
|
|
196
|
-
*/
|
|
197
|
-
declare function getElapsedTime(startTime: number): string;
|
|
198
|
-
/**
|
|
199
|
-
* Generate a visual score bar for console output
|
|
200
|
-
*/
|
|
201
|
-
declare function getScoreBar(val: number): string;
|
|
202
|
-
/**
|
|
203
|
-
* Get status icon for safety ratings
|
|
204
|
-
*/
|
|
205
|
-
declare function getSafetyIcon(rating: string): string;
|
|
206
|
-
/**
|
|
207
|
-
* Get chalk color function for a given severity
|
|
208
|
-
* @param severity severity level
|
|
209
|
-
* @param chalk chalk instance
|
|
210
|
-
*/
|
|
211
|
-
declare function getSeverityColor(severity: string, chalk: any): any;
|
|
212
|
-
|
|
213
217
|
/**
|
|
214
218
|
* AI model pricing presets for cost estimation.
|
|
215
219
|
* Prices are input token costs per 1K tokens (USD), as of Q1 2026.
|
|
@@ -851,4 +855,4 @@ declare function getRepoMetadata(directory: string): {
|
|
|
851
855
|
author?: string;
|
|
852
856
|
};
|
|
853
857
|
|
|
854
|
-
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 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, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput, validateWithSchema };
|
|
858
|
+
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 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, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput, validateWithSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,61 @@ declare function readFileContent(filePath: string): Promise<string>;
|
|
|
100
100
|
declare function getFileExtension(filePath: string): string;
|
|
101
101
|
declare function isSourceFile(filePath: string): boolean;
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Common CLI configuration interface
|
|
105
|
+
*/
|
|
106
|
+
interface CLIOptions {
|
|
107
|
+
rootDir: string;
|
|
108
|
+
include?: string[];
|
|
109
|
+
exclude?: string[];
|
|
110
|
+
[key: string]: any;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Resolve output file path, defaulting to .aiready directory
|
|
114
|
+
* Creates parent directories if they don't exist.
|
|
115
|
+
* @param userPath - User-provided output path (optional)
|
|
116
|
+
* @param defaultFilename - Default filename to use
|
|
117
|
+
* @param workingDir - Working directory (default: process.cwd())
|
|
118
|
+
* @returns Resolved absolute path
|
|
119
|
+
*/
|
|
120
|
+
declare function resolveOutputPath(userPath: string | undefined, defaultFilename: string, workingDir?: string): string;
|
|
121
|
+
/**
|
|
122
|
+
* Load and merge configuration with CLI options
|
|
123
|
+
*/
|
|
124
|
+
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): Promise<T & {
|
|
125
|
+
rootDir: string;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Handle JSON output for CLI commands
|
|
129
|
+
*/
|
|
130
|
+
declare function handleJSONOutput(data: any, outputFile?: string, successMessage?: string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Common error handler for CLI commands
|
|
133
|
+
*/
|
|
134
|
+
declare function handleCLIError(error: unknown, commandName: string): never;
|
|
135
|
+
/**
|
|
136
|
+
* Calculate elapsed time and format for display
|
|
137
|
+
*/
|
|
138
|
+
declare function getElapsedTime(startTime: number): string;
|
|
139
|
+
/**
|
|
140
|
+
* Generate a visual score bar for console output
|
|
141
|
+
*/
|
|
142
|
+
declare function getScoreBar(val: number): string;
|
|
143
|
+
/**
|
|
144
|
+
* Get status icon for safety ratings
|
|
145
|
+
*/
|
|
146
|
+
declare function getSafetyIcon(rating: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* Emit progress update with throttling to reduce log noise
|
|
149
|
+
*/
|
|
150
|
+
declare function emitProgress(processed: number, total: number, toolId: string, message: string, onProgress?: (processed: number, total: number, message: string) => void, throttleCount?: number): void;
|
|
151
|
+
/**
|
|
152
|
+
* Get chalk color function for a given severity
|
|
153
|
+
* @param severity severity level
|
|
154
|
+
* @param chalk chalk instance
|
|
155
|
+
*/
|
|
156
|
+
declare function getSeverityColor(severity: string, chalk: any): any;
|
|
157
|
+
|
|
103
158
|
interface ExportWithImports {
|
|
104
159
|
name: string;
|
|
105
160
|
type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default';
|
|
@@ -159,57 +214,6 @@ declare function estimateTokens(text: string): number;
|
|
|
159
214
|
declare function loadConfig(rootDir: string): Promise<AIReadyConfig | null>;
|
|
160
215
|
declare function mergeConfigWithDefaults(userConfig: AIReadyConfig | null, defaults: any): any;
|
|
161
216
|
|
|
162
|
-
/**
|
|
163
|
-
* Common CLI configuration interface
|
|
164
|
-
*/
|
|
165
|
-
interface CLIOptions {
|
|
166
|
-
rootDir: string;
|
|
167
|
-
include?: string[];
|
|
168
|
-
exclude?: string[];
|
|
169
|
-
[key: string]: any;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Resolve output file path, defaulting to .aiready directory
|
|
173
|
-
* Creates parent directories if they don't exist.
|
|
174
|
-
* @param userPath - User-provided output path (optional)
|
|
175
|
-
* @param defaultFilename - Default filename to use
|
|
176
|
-
* @param workingDir - Working directory (default: process.cwd())
|
|
177
|
-
* @returns Resolved absolute path
|
|
178
|
-
*/
|
|
179
|
-
declare function resolveOutputPath(userPath: string | undefined, defaultFilename: string, workingDir?: string): string;
|
|
180
|
-
/**
|
|
181
|
-
* Load and merge configuration with CLI options
|
|
182
|
-
*/
|
|
183
|
-
declare function loadMergedConfig<T extends Record<string, any>>(directory: string, defaults: T, cliOptions: Partial<T>): Promise<T & {
|
|
184
|
-
rootDir: string;
|
|
185
|
-
}>;
|
|
186
|
-
/**
|
|
187
|
-
* Handle JSON output for CLI commands
|
|
188
|
-
*/
|
|
189
|
-
declare function handleJSONOutput(data: any, outputFile?: string, successMessage?: string): void;
|
|
190
|
-
/**
|
|
191
|
-
* Common error handler for CLI commands
|
|
192
|
-
*/
|
|
193
|
-
declare function handleCLIError(error: unknown, commandName: string): never;
|
|
194
|
-
/**
|
|
195
|
-
* Calculate elapsed time and format for display
|
|
196
|
-
*/
|
|
197
|
-
declare function getElapsedTime(startTime: number): string;
|
|
198
|
-
/**
|
|
199
|
-
* Generate a visual score bar for console output
|
|
200
|
-
*/
|
|
201
|
-
declare function getScoreBar(val: number): string;
|
|
202
|
-
/**
|
|
203
|
-
* Get status icon for safety ratings
|
|
204
|
-
*/
|
|
205
|
-
declare function getSafetyIcon(rating: string): string;
|
|
206
|
-
/**
|
|
207
|
-
* Get chalk color function for a given severity
|
|
208
|
-
* @param severity severity level
|
|
209
|
-
* @param chalk chalk instance
|
|
210
|
-
*/
|
|
211
|
-
declare function getSeverityColor(severity: string, chalk: any): any;
|
|
212
|
-
|
|
213
217
|
/**
|
|
214
218
|
* AI model pricing presets for cost estimation.
|
|
215
219
|
* Prices are input token costs per 1K tokens (USD), as of Q1 2026.
|
|
@@ -851,4 +855,4 @@ declare function getRepoMetadata(directory: string): {
|
|
|
851
855
|
author?: string;
|
|
852
856
|
};
|
|
853
857
|
|
|
854
|
-
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 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, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput, validateWithSchema };
|
|
858
|
+
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 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, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, handleCLIError, handleJSONOutput, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, validateSpokeOutput, validateWithSchema };
|
package/dist/index.js
CHANGED
|
@@ -87,6 +87,7 @@ __export(index_exports, {
|
|
|
87
87
|
calculateTestabilityIndex: () => calculateTestabilityIndex,
|
|
88
88
|
calculateTokenBudget: () => calculateTokenBudget,
|
|
89
89
|
clearHistory: () => clearHistory,
|
|
90
|
+
emitProgress: () => emitProgress,
|
|
90
91
|
estimateCostFromBudget: () => estimateCostFromBudget,
|
|
91
92
|
estimateTokens: () => estimateTokens,
|
|
92
93
|
exportHistory: () => exportHistory,
|
|
@@ -663,6 +664,94 @@ function isSourceFile(filePath) {
|
|
|
663
664
|
return ["ts", "tsx", "js", "jsx", "py", "java", "go", "rs"].includes(ext);
|
|
664
665
|
}
|
|
665
666
|
|
|
667
|
+
// src/utils/cli-helpers.ts
|
|
668
|
+
var import_fs2 = require("fs");
|
|
669
|
+
var import_path2 = require("path");
|
|
670
|
+
function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
|
|
671
|
+
let outputPath;
|
|
672
|
+
if (userPath) {
|
|
673
|
+
outputPath = userPath;
|
|
674
|
+
} else {
|
|
675
|
+
const aireadyDir = (0, import_path2.join)(workingDir, ".aiready");
|
|
676
|
+
outputPath = (0, import_path2.join)(aireadyDir, defaultFilename);
|
|
677
|
+
}
|
|
678
|
+
const parentDir = (0, import_path2.dirname)(outputPath);
|
|
679
|
+
if (!(0, import_fs2.existsSync)(parentDir)) {
|
|
680
|
+
(0, import_fs2.mkdirSync)(parentDir, { recursive: true });
|
|
681
|
+
}
|
|
682
|
+
return outputPath;
|
|
683
|
+
}
|
|
684
|
+
async function loadMergedConfig(directory, defaults, cliOptions) {
|
|
685
|
+
const config = await loadConfig(directory);
|
|
686
|
+
const mergedConfig = mergeConfigWithDefaults(config, defaults);
|
|
687
|
+
const result = {
|
|
688
|
+
...mergedConfig,
|
|
689
|
+
...cliOptions,
|
|
690
|
+
rootDir: directory
|
|
691
|
+
};
|
|
692
|
+
return result;
|
|
693
|
+
}
|
|
694
|
+
function handleJSONOutput(data, outputFile, successMessage) {
|
|
695
|
+
if (outputFile) {
|
|
696
|
+
const dir = (0, import_path2.dirname)(outputFile);
|
|
697
|
+
if (!(0, import_fs2.existsSync)(dir)) {
|
|
698
|
+
(0, import_fs2.mkdirSync)(dir, { recursive: true });
|
|
699
|
+
}
|
|
700
|
+
(0, import_fs2.writeFileSync)(outputFile, JSON.stringify(data, null, 2));
|
|
701
|
+
console.log(successMessage || `\u2705 Results saved to ${outputFile}`);
|
|
702
|
+
} else {
|
|
703
|
+
console.log(JSON.stringify(data, null, 2));
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
function handleCLIError(error, commandName) {
|
|
707
|
+
console.error(`\u274C ${commandName} failed:`, error);
|
|
708
|
+
process.exit(1);
|
|
709
|
+
}
|
|
710
|
+
function getElapsedTime(startTime) {
|
|
711
|
+
return ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
712
|
+
}
|
|
713
|
+
function getScoreBar(val) {
|
|
714
|
+
return "\u2588".repeat(Math.round(val / 10)).padEnd(10, "\u2591");
|
|
715
|
+
}
|
|
716
|
+
function getSafetyIcon(rating) {
|
|
717
|
+
switch (rating) {
|
|
718
|
+
case "safe":
|
|
719
|
+
return "\u2705";
|
|
720
|
+
case "moderate-risk":
|
|
721
|
+
return "\u26A0\uFE0F ";
|
|
722
|
+
case "high-risk":
|
|
723
|
+
return "\u{1F534}";
|
|
724
|
+
case "blind-risk":
|
|
725
|
+
return "\u{1F480}";
|
|
726
|
+
default:
|
|
727
|
+
return "\u2753";
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
function emitProgress(processed, total, toolId, message, onProgress, throttleCount = 50) {
|
|
731
|
+
if (!onProgress) return;
|
|
732
|
+
if (processed % throttleCount === 0 || processed === total) {
|
|
733
|
+
onProgress(processed, total, `${message} (${processed}/${total})`);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function getSeverityColor(severity, chalk) {
|
|
737
|
+
switch (severity.toLowerCase()) {
|
|
738
|
+
case "critical":
|
|
739
|
+
case "high-risk":
|
|
740
|
+
case "blind-risk":
|
|
741
|
+
return chalk.red;
|
|
742
|
+
case "major":
|
|
743
|
+
case "moderate-risk":
|
|
744
|
+
return chalk.yellow;
|
|
745
|
+
case "minor":
|
|
746
|
+
case "safe":
|
|
747
|
+
return chalk.green;
|
|
748
|
+
case "info":
|
|
749
|
+
return chalk.blue;
|
|
750
|
+
default:
|
|
751
|
+
return chalk.white;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
666
755
|
// src/utils/ast-parser.ts
|
|
667
756
|
var import_typescript_estree = require("@typescript-eslint/typescript-estree");
|
|
668
757
|
function parseFileExports(code, filePath) {
|
|
@@ -843,8 +932,8 @@ function estimateTokens(text) {
|
|
|
843
932
|
}
|
|
844
933
|
|
|
845
934
|
// src/utils/config.ts
|
|
846
|
-
var
|
|
847
|
-
var
|
|
935
|
+
var import_fs3 = require("fs");
|
|
936
|
+
var import_path3 = require("path");
|
|
848
937
|
var import_url = require("url");
|
|
849
938
|
var CONFIG_FILES = [
|
|
850
939
|
"aiready.json",
|
|
@@ -855,11 +944,11 @@ var CONFIG_FILES = [
|
|
|
855
944
|
".aireadyrc.js"
|
|
856
945
|
];
|
|
857
946
|
async function loadConfig(rootDir) {
|
|
858
|
-
let currentDir = (0,
|
|
947
|
+
let currentDir = (0, import_path3.resolve)(rootDir);
|
|
859
948
|
while (true) {
|
|
860
949
|
for (const configFile of CONFIG_FILES) {
|
|
861
|
-
const configPath = (0,
|
|
862
|
-
if ((0,
|
|
950
|
+
const configPath = (0, import_path3.join)(currentDir, configFile);
|
|
951
|
+
if ((0, import_fs3.existsSync)(configPath)) {
|
|
863
952
|
try {
|
|
864
953
|
let config;
|
|
865
954
|
if (configFile.endsWith(".js")) {
|
|
@@ -867,7 +956,7 @@ async function loadConfig(rootDir) {
|
|
|
867
956
|
const module2 = await import(`${fileUrl}?t=${Date.now()}`);
|
|
868
957
|
config = module2.default || module2;
|
|
869
958
|
} else {
|
|
870
|
-
const content = (0,
|
|
959
|
+
const content = (0, import_fs3.readFileSync)(configPath, "utf-8");
|
|
871
960
|
config = JSON.parse(content);
|
|
872
961
|
}
|
|
873
962
|
if (typeof config !== "object" || config === null) {
|
|
@@ -887,7 +976,7 @@ async function loadConfig(rootDir) {
|
|
|
887
976
|
}
|
|
888
977
|
}
|
|
889
978
|
}
|
|
890
|
-
const parent = (0,
|
|
979
|
+
const parent = (0, import_path3.dirname)(currentDir);
|
|
891
980
|
if (parent === currentDir) {
|
|
892
981
|
break;
|
|
893
982
|
}
|
|
@@ -918,88 +1007,6 @@ function mergeConfigWithDefaults(userConfig, defaults) {
|
|
|
918
1007
|
return result;
|
|
919
1008
|
}
|
|
920
1009
|
|
|
921
|
-
// src/utils/cli-helpers.ts
|
|
922
|
-
var import_fs3 = require("fs");
|
|
923
|
-
var import_path3 = require("path");
|
|
924
|
-
function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
|
|
925
|
-
let outputPath;
|
|
926
|
-
if (userPath) {
|
|
927
|
-
outputPath = userPath;
|
|
928
|
-
} else {
|
|
929
|
-
const aireadyDir = (0, import_path3.join)(workingDir, ".aiready");
|
|
930
|
-
outputPath = (0, import_path3.join)(aireadyDir, defaultFilename);
|
|
931
|
-
}
|
|
932
|
-
const parentDir = (0, import_path3.dirname)(outputPath);
|
|
933
|
-
if (!(0, import_fs3.existsSync)(parentDir)) {
|
|
934
|
-
(0, import_fs3.mkdirSync)(parentDir, { recursive: true });
|
|
935
|
-
}
|
|
936
|
-
return outputPath;
|
|
937
|
-
}
|
|
938
|
-
async function loadMergedConfig(directory, defaults, cliOptions) {
|
|
939
|
-
const config = await loadConfig(directory);
|
|
940
|
-
const mergedConfig = mergeConfigWithDefaults(config, defaults);
|
|
941
|
-
const result = {
|
|
942
|
-
...mergedConfig,
|
|
943
|
-
...cliOptions,
|
|
944
|
-
rootDir: directory
|
|
945
|
-
};
|
|
946
|
-
return result;
|
|
947
|
-
}
|
|
948
|
-
function handleJSONOutput(data, outputFile, successMessage) {
|
|
949
|
-
if (outputFile) {
|
|
950
|
-
const dir = (0, import_path3.dirname)(outputFile);
|
|
951
|
-
if (!(0, import_fs3.existsSync)(dir)) {
|
|
952
|
-
(0, import_fs3.mkdirSync)(dir, { recursive: true });
|
|
953
|
-
}
|
|
954
|
-
(0, import_fs3.writeFileSync)(outputFile, JSON.stringify(data, null, 2));
|
|
955
|
-
console.log(successMessage || `\u2705 Results saved to ${outputFile}`);
|
|
956
|
-
} else {
|
|
957
|
-
console.log(JSON.stringify(data, null, 2));
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
function handleCLIError(error, commandName) {
|
|
961
|
-
console.error(`\u274C ${commandName} failed:`, error);
|
|
962
|
-
process.exit(1);
|
|
963
|
-
}
|
|
964
|
-
function getElapsedTime(startTime) {
|
|
965
|
-
return ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
966
|
-
}
|
|
967
|
-
function getScoreBar(val) {
|
|
968
|
-
return "\u2588".repeat(Math.round(val / 10)).padEnd(10, "\u2591");
|
|
969
|
-
}
|
|
970
|
-
function getSafetyIcon(rating) {
|
|
971
|
-
switch (rating) {
|
|
972
|
-
case "safe":
|
|
973
|
-
return "\u2705";
|
|
974
|
-
case "moderate-risk":
|
|
975
|
-
return "\u26A0\uFE0F ";
|
|
976
|
-
case "high-risk":
|
|
977
|
-
return "\u{1F534}";
|
|
978
|
-
case "blind-risk":
|
|
979
|
-
return "\u{1F480}";
|
|
980
|
-
default:
|
|
981
|
-
return "\u2753";
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
function getSeverityColor(severity, chalk) {
|
|
985
|
-
switch (severity.toLowerCase()) {
|
|
986
|
-
case "critical":
|
|
987
|
-
case "high-risk":
|
|
988
|
-
case "blind-risk":
|
|
989
|
-
return chalk.red;
|
|
990
|
-
case "major":
|
|
991
|
-
case "moderate-risk":
|
|
992
|
-
return chalk.yellow;
|
|
993
|
-
case "minor":
|
|
994
|
-
case "safe":
|
|
995
|
-
return chalk.green;
|
|
996
|
-
case "info":
|
|
997
|
-
return chalk.blue;
|
|
998
|
-
default:
|
|
999
|
-
return chalk.white;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
1010
|
// src/utils/visualization.ts
|
|
1004
1011
|
function generateHTML(graph) {
|
|
1005
1012
|
const payload = JSON.stringify(graph, null, 2);
|
|
@@ -2941,8 +2948,8 @@ function calculateChangeAmplification(params) {
|
|
|
2941
2948
|
const maxAmplification = hotspots[0].amplificationFactor;
|
|
2942
2949
|
const avgAmplification = hotspots.reduce((sum, h) => sum + h.amplificationFactor, 0) / hotspots.length;
|
|
2943
2950
|
const avgPenalty = Math.log2(avgAmplification + 1) * 15;
|
|
2944
|
-
const maxPenalty = maxAmplification > 30 ? (maxAmplification -
|
|
2945
|
-
const score = Math.max(
|
|
2951
|
+
const maxPenalty = maxAmplification > 30 ? Math.log10(maxAmplification - 29) * 30 : 0;
|
|
2952
|
+
const score = Math.max(5, Math.min(100, 100 - avgPenalty - maxPenalty));
|
|
2946
2953
|
let rating = "isolated";
|
|
2947
2954
|
if (score < 40) rating = "explosive";
|
|
2948
2955
|
else if (score < 70) rating = "amplified";
|
|
@@ -3313,6 +3320,7 @@ function getRepoMetadata(directory) {
|
|
|
3313
3320
|
calculateTestabilityIndex,
|
|
3314
3321
|
calculateTokenBudget,
|
|
3315
3322
|
clearHistory,
|
|
3323
|
+
emitProgress,
|
|
3316
3324
|
estimateCostFromBudget,
|
|
3317
3325
|
estimateTokens,
|
|
3318
3326
|
exportHistory,
|
package/dist/index.mjs
CHANGED
|
@@ -375,6 +375,94 @@ function isSourceFile(filePath) {
|
|
|
375
375
|
return ["ts", "tsx", "js", "jsx", "py", "java", "go", "rs"].includes(ext);
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
+
// src/utils/cli-helpers.ts
|
|
379
|
+
import { writeFileSync, mkdirSync, existsSync as existsSync2 } from "fs";
|
|
380
|
+
import { join as join2, dirname as dirname2 } from "path";
|
|
381
|
+
function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
|
|
382
|
+
let outputPath;
|
|
383
|
+
if (userPath) {
|
|
384
|
+
outputPath = userPath;
|
|
385
|
+
} else {
|
|
386
|
+
const aireadyDir = join2(workingDir, ".aiready");
|
|
387
|
+
outputPath = join2(aireadyDir, defaultFilename);
|
|
388
|
+
}
|
|
389
|
+
const parentDir = dirname2(outputPath);
|
|
390
|
+
if (!existsSync2(parentDir)) {
|
|
391
|
+
mkdirSync(parentDir, { recursive: true });
|
|
392
|
+
}
|
|
393
|
+
return outputPath;
|
|
394
|
+
}
|
|
395
|
+
async function loadMergedConfig(directory, defaults, cliOptions) {
|
|
396
|
+
const config = await loadConfig(directory);
|
|
397
|
+
const mergedConfig = mergeConfigWithDefaults(config, defaults);
|
|
398
|
+
const result = {
|
|
399
|
+
...mergedConfig,
|
|
400
|
+
...cliOptions,
|
|
401
|
+
rootDir: directory
|
|
402
|
+
};
|
|
403
|
+
return result;
|
|
404
|
+
}
|
|
405
|
+
function handleJSONOutput(data, outputFile, successMessage) {
|
|
406
|
+
if (outputFile) {
|
|
407
|
+
const dir = dirname2(outputFile);
|
|
408
|
+
if (!existsSync2(dir)) {
|
|
409
|
+
mkdirSync(dir, { recursive: true });
|
|
410
|
+
}
|
|
411
|
+
writeFileSync(outputFile, JSON.stringify(data, null, 2));
|
|
412
|
+
console.log(successMessage || `\u2705 Results saved to ${outputFile}`);
|
|
413
|
+
} else {
|
|
414
|
+
console.log(JSON.stringify(data, null, 2));
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function handleCLIError(error, commandName) {
|
|
418
|
+
console.error(`\u274C ${commandName} failed:`, error);
|
|
419
|
+
process.exit(1);
|
|
420
|
+
}
|
|
421
|
+
function getElapsedTime(startTime) {
|
|
422
|
+
return ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
423
|
+
}
|
|
424
|
+
function getScoreBar(val) {
|
|
425
|
+
return "\u2588".repeat(Math.round(val / 10)).padEnd(10, "\u2591");
|
|
426
|
+
}
|
|
427
|
+
function getSafetyIcon(rating) {
|
|
428
|
+
switch (rating) {
|
|
429
|
+
case "safe":
|
|
430
|
+
return "\u2705";
|
|
431
|
+
case "moderate-risk":
|
|
432
|
+
return "\u26A0\uFE0F ";
|
|
433
|
+
case "high-risk":
|
|
434
|
+
return "\u{1F534}";
|
|
435
|
+
case "blind-risk":
|
|
436
|
+
return "\u{1F480}";
|
|
437
|
+
default:
|
|
438
|
+
return "\u2753";
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
function emitProgress(processed, total, toolId, message, onProgress, throttleCount = 50) {
|
|
442
|
+
if (!onProgress) return;
|
|
443
|
+
if (processed % throttleCount === 0 || processed === total) {
|
|
444
|
+
onProgress(processed, total, `${message} (${processed}/${total})`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function getSeverityColor(severity, chalk) {
|
|
448
|
+
switch (severity.toLowerCase()) {
|
|
449
|
+
case "critical":
|
|
450
|
+
case "high-risk":
|
|
451
|
+
case "blind-risk":
|
|
452
|
+
return chalk.red;
|
|
453
|
+
case "major":
|
|
454
|
+
case "moderate-risk":
|
|
455
|
+
return chalk.yellow;
|
|
456
|
+
case "minor":
|
|
457
|
+
case "safe":
|
|
458
|
+
return chalk.green;
|
|
459
|
+
case "info":
|
|
460
|
+
return chalk.blue;
|
|
461
|
+
default:
|
|
462
|
+
return chalk.white;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
378
466
|
// src/utils/ast-parser.ts
|
|
379
467
|
import { parse } from "@typescript-eslint/typescript-estree";
|
|
380
468
|
function parseFileExports(code, filePath) {
|
|
@@ -555,8 +643,8 @@ function estimateTokens(text) {
|
|
|
555
643
|
}
|
|
556
644
|
|
|
557
645
|
// src/utils/config.ts
|
|
558
|
-
import { readFileSync, existsSync as
|
|
559
|
-
import { join as
|
|
646
|
+
import { readFileSync, existsSync as existsSync3 } from "fs";
|
|
647
|
+
import { join as join3, resolve, dirname as dirname3 } from "path";
|
|
560
648
|
import { pathToFileURL } from "url";
|
|
561
649
|
var CONFIG_FILES = [
|
|
562
650
|
"aiready.json",
|
|
@@ -570,8 +658,8 @@ async function loadConfig(rootDir) {
|
|
|
570
658
|
let currentDir = resolve(rootDir);
|
|
571
659
|
while (true) {
|
|
572
660
|
for (const configFile of CONFIG_FILES) {
|
|
573
|
-
const configPath =
|
|
574
|
-
if (
|
|
661
|
+
const configPath = join3(currentDir, configFile);
|
|
662
|
+
if (existsSync3(configPath)) {
|
|
575
663
|
try {
|
|
576
664
|
let config;
|
|
577
665
|
if (configFile.endsWith(".js")) {
|
|
@@ -599,7 +687,7 @@ async function loadConfig(rootDir) {
|
|
|
599
687
|
}
|
|
600
688
|
}
|
|
601
689
|
}
|
|
602
|
-
const parent =
|
|
690
|
+
const parent = dirname3(currentDir);
|
|
603
691
|
if (parent === currentDir) {
|
|
604
692
|
break;
|
|
605
693
|
}
|
|
@@ -630,88 +718,6 @@ function mergeConfigWithDefaults(userConfig, defaults) {
|
|
|
630
718
|
return result;
|
|
631
719
|
}
|
|
632
720
|
|
|
633
|
-
// src/utils/cli-helpers.ts
|
|
634
|
-
import { writeFileSync, mkdirSync, existsSync as existsSync3 } from "fs";
|
|
635
|
-
import { join as join3, dirname as dirname3 } from "path";
|
|
636
|
-
function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
|
|
637
|
-
let outputPath;
|
|
638
|
-
if (userPath) {
|
|
639
|
-
outputPath = userPath;
|
|
640
|
-
} else {
|
|
641
|
-
const aireadyDir = join3(workingDir, ".aiready");
|
|
642
|
-
outputPath = join3(aireadyDir, defaultFilename);
|
|
643
|
-
}
|
|
644
|
-
const parentDir = dirname3(outputPath);
|
|
645
|
-
if (!existsSync3(parentDir)) {
|
|
646
|
-
mkdirSync(parentDir, { recursive: true });
|
|
647
|
-
}
|
|
648
|
-
return outputPath;
|
|
649
|
-
}
|
|
650
|
-
async function loadMergedConfig(directory, defaults, cliOptions) {
|
|
651
|
-
const config = await loadConfig(directory);
|
|
652
|
-
const mergedConfig = mergeConfigWithDefaults(config, defaults);
|
|
653
|
-
const result = {
|
|
654
|
-
...mergedConfig,
|
|
655
|
-
...cliOptions,
|
|
656
|
-
rootDir: directory
|
|
657
|
-
};
|
|
658
|
-
return result;
|
|
659
|
-
}
|
|
660
|
-
function handleJSONOutput(data, outputFile, successMessage) {
|
|
661
|
-
if (outputFile) {
|
|
662
|
-
const dir = dirname3(outputFile);
|
|
663
|
-
if (!existsSync3(dir)) {
|
|
664
|
-
mkdirSync(dir, { recursive: true });
|
|
665
|
-
}
|
|
666
|
-
writeFileSync(outputFile, JSON.stringify(data, null, 2));
|
|
667
|
-
console.log(successMessage || `\u2705 Results saved to ${outputFile}`);
|
|
668
|
-
} else {
|
|
669
|
-
console.log(JSON.stringify(data, null, 2));
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
function handleCLIError(error, commandName) {
|
|
673
|
-
console.error(`\u274C ${commandName} failed:`, error);
|
|
674
|
-
process.exit(1);
|
|
675
|
-
}
|
|
676
|
-
function getElapsedTime(startTime) {
|
|
677
|
-
return ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
678
|
-
}
|
|
679
|
-
function getScoreBar(val) {
|
|
680
|
-
return "\u2588".repeat(Math.round(val / 10)).padEnd(10, "\u2591");
|
|
681
|
-
}
|
|
682
|
-
function getSafetyIcon(rating) {
|
|
683
|
-
switch (rating) {
|
|
684
|
-
case "safe":
|
|
685
|
-
return "\u2705";
|
|
686
|
-
case "moderate-risk":
|
|
687
|
-
return "\u26A0\uFE0F ";
|
|
688
|
-
case "high-risk":
|
|
689
|
-
return "\u{1F534}";
|
|
690
|
-
case "blind-risk":
|
|
691
|
-
return "\u{1F480}";
|
|
692
|
-
default:
|
|
693
|
-
return "\u2753";
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
function getSeverityColor(severity, chalk) {
|
|
697
|
-
switch (severity.toLowerCase()) {
|
|
698
|
-
case "critical":
|
|
699
|
-
case "high-risk":
|
|
700
|
-
case "blind-risk":
|
|
701
|
-
return chalk.red;
|
|
702
|
-
case "major":
|
|
703
|
-
case "moderate-risk":
|
|
704
|
-
return chalk.yellow;
|
|
705
|
-
case "minor":
|
|
706
|
-
case "safe":
|
|
707
|
-
return chalk.green;
|
|
708
|
-
case "info":
|
|
709
|
-
return chalk.blue;
|
|
710
|
-
default:
|
|
711
|
-
return chalk.white;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
721
|
// src/business/pricing-models.ts
|
|
716
722
|
var MODEL_PRICING_PRESETS = {
|
|
717
723
|
"gpt-5.3": {
|
|
@@ -2296,8 +2302,8 @@ function calculateChangeAmplification(params) {
|
|
|
2296
2302
|
const maxAmplification = hotspots[0].amplificationFactor;
|
|
2297
2303
|
const avgAmplification = hotspots.reduce((sum, h) => sum + h.amplificationFactor, 0) / hotspots.length;
|
|
2298
2304
|
const avgPenalty = Math.log2(avgAmplification + 1) * 15;
|
|
2299
|
-
const maxPenalty = maxAmplification > 30 ? (maxAmplification -
|
|
2300
|
-
const score = Math.max(
|
|
2305
|
+
const maxPenalty = maxAmplification > 30 ? Math.log10(maxAmplification - 29) * 30 : 0;
|
|
2306
|
+
const score = Math.max(5, Math.min(100, 100 - avgPenalty - maxPenalty));
|
|
2301
2307
|
let rating = "isolated";
|
|
2302
2308
|
if (score < 40) rating = "explosive";
|
|
2303
2309
|
else if (score < 70) rating = "amplified";
|
|
@@ -2667,6 +2673,7 @@ export {
|
|
|
2667
2673
|
calculateTestabilityIndex,
|
|
2668
2674
|
calculateTokenBudget,
|
|
2669
2675
|
clearHistory,
|
|
2676
|
+
emitProgress,
|
|
2670
2677
|
estimateCostFromBudget,
|
|
2671
2678
|
estimateTokens,
|
|
2672
2679
|
exportHistory,
|