@aiready/core 0.21.4 → 0.21.9
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-3YI4IS3D.mjs +583 -0
- package/dist/client.d.mts +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +2 -1
- package/dist/client.mjs +1 -1
- package/dist/index.d.mts +56 -52
- package/dist/index.d.ts +56 -52
- package/dist/index.js +101 -92
- package/dist/index.mjs +97 -90
- 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,
|
|
@@ -271,7 +272,8 @@ var SpokeOutputSchema = import_zod.z.object({
|
|
|
271
272
|
metadata: import_zod.z.object({
|
|
272
273
|
toolName: import_zod.z.string(),
|
|
273
274
|
version: import_zod.z.string().optional(),
|
|
274
|
-
timestamp: import_zod.z.string().optional()
|
|
275
|
+
timestamp: import_zod.z.string().optional(),
|
|
276
|
+
config: import_zod.z.any().optional()
|
|
275
277
|
}).catchall(import_zod.z.any()).optional()
|
|
276
278
|
});
|
|
277
279
|
var UnifiedReportSchema = import_zod.z.object({
|
|
@@ -663,6 +665,94 @@ function isSourceFile(filePath) {
|
|
|
663
665
|
return ["ts", "tsx", "js", "jsx", "py", "java", "go", "rs"].includes(ext);
|
|
664
666
|
}
|
|
665
667
|
|
|
668
|
+
// src/utils/cli-helpers.ts
|
|
669
|
+
var import_fs2 = require("fs");
|
|
670
|
+
var import_path2 = require("path");
|
|
671
|
+
function resolveOutputPath(userPath, defaultFilename, workingDir = process.cwd()) {
|
|
672
|
+
let outputPath;
|
|
673
|
+
if (userPath) {
|
|
674
|
+
outputPath = userPath;
|
|
675
|
+
} else {
|
|
676
|
+
const aireadyDir = (0, import_path2.join)(workingDir, ".aiready");
|
|
677
|
+
outputPath = (0, import_path2.join)(aireadyDir, defaultFilename);
|
|
678
|
+
}
|
|
679
|
+
const parentDir = (0, import_path2.dirname)(outputPath);
|
|
680
|
+
if (!(0, import_fs2.existsSync)(parentDir)) {
|
|
681
|
+
(0, import_fs2.mkdirSync)(parentDir, { recursive: true });
|
|
682
|
+
}
|
|
683
|
+
return outputPath;
|
|
684
|
+
}
|
|
685
|
+
async function loadMergedConfig(directory, defaults, cliOptions) {
|
|
686
|
+
const config = await loadConfig(directory);
|
|
687
|
+
const mergedConfig = mergeConfigWithDefaults(config, defaults);
|
|
688
|
+
const result = {
|
|
689
|
+
...mergedConfig,
|
|
690
|
+
...cliOptions,
|
|
691
|
+
rootDir: directory
|
|
692
|
+
};
|
|
693
|
+
return result;
|
|
694
|
+
}
|
|
695
|
+
function handleJSONOutput(data, outputFile, successMessage) {
|
|
696
|
+
if (outputFile) {
|
|
697
|
+
const dir = (0, import_path2.dirname)(outputFile);
|
|
698
|
+
if (!(0, import_fs2.existsSync)(dir)) {
|
|
699
|
+
(0, import_fs2.mkdirSync)(dir, { recursive: true });
|
|
700
|
+
}
|
|
701
|
+
(0, import_fs2.writeFileSync)(outputFile, JSON.stringify(data, null, 2));
|
|
702
|
+
console.log(successMessage || `\u2705 Results saved to ${outputFile}`);
|
|
703
|
+
} else {
|
|
704
|
+
console.log(JSON.stringify(data, null, 2));
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function handleCLIError(error, commandName) {
|
|
708
|
+
console.error(`\u274C ${commandName} failed:`, error);
|
|
709
|
+
process.exit(1);
|
|
710
|
+
}
|
|
711
|
+
function getElapsedTime(startTime) {
|
|
712
|
+
return ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
713
|
+
}
|
|
714
|
+
function getScoreBar(val) {
|
|
715
|
+
return "\u2588".repeat(Math.round(val / 10)).padEnd(10, "\u2591");
|
|
716
|
+
}
|
|
717
|
+
function getSafetyIcon(rating) {
|
|
718
|
+
switch (rating) {
|
|
719
|
+
case "safe":
|
|
720
|
+
return "\u2705";
|
|
721
|
+
case "moderate-risk":
|
|
722
|
+
return "\u26A0\uFE0F ";
|
|
723
|
+
case "high-risk":
|
|
724
|
+
return "\u{1F534}";
|
|
725
|
+
case "blind-risk":
|
|
726
|
+
return "\u{1F480}";
|
|
727
|
+
default:
|
|
728
|
+
return "\u2753";
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
function emitProgress(processed, total, toolId, message, onProgress, throttleCount = 50) {
|
|
732
|
+
if (!onProgress) return;
|
|
733
|
+
if (processed % throttleCount === 0 || processed === total) {
|
|
734
|
+
onProgress(processed, total, `${message} (${processed}/${total})`);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function getSeverityColor(severity, chalk) {
|
|
738
|
+
switch (severity.toLowerCase()) {
|
|
739
|
+
case "critical":
|
|
740
|
+
case "high-risk":
|
|
741
|
+
case "blind-risk":
|
|
742
|
+
return chalk.red;
|
|
743
|
+
case "major":
|
|
744
|
+
case "moderate-risk":
|
|
745
|
+
return chalk.yellow;
|
|
746
|
+
case "minor":
|
|
747
|
+
case "safe":
|
|
748
|
+
return chalk.green;
|
|
749
|
+
case "info":
|
|
750
|
+
return chalk.blue;
|
|
751
|
+
default:
|
|
752
|
+
return chalk.white;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
666
756
|
// src/utils/ast-parser.ts
|
|
667
757
|
var import_typescript_estree = require("@typescript-eslint/typescript-estree");
|
|
668
758
|
function parseFileExports(code, filePath) {
|
|
@@ -843,8 +933,8 @@ function estimateTokens(text) {
|
|
|
843
933
|
}
|
|
844
934
|
|
|
845
935
|
// src/utils/config.ts
|
|
846
|
-
var
|
|
847
|
-
var
|
|
936
|
+
var import_fs3 = require("fs");
|
|
937
|
+
var import_path3 = require("path");
|
|
848
938
|
var import_url = require("url");
|
|
849
939
|
var CONFIG_FILES = [
|
|
850
940
|
"aiready.json",
|
|
@@ -855,11 +945,11 @@ var CONFIG_FILES = [
|
|
|
855
945
|
".aireadyrc.js"
|
|
856
946
|
];
|
|
857
947
|
async function loadConfig(rootDir) {
|
|
858
|
-
let currentDir = (0,
|
|
948
|
+
let currentDir = (0, import_path3.resolve)(rootDir);
|
|
859
949
|
while (true) {
|
|
860
950
|
for (const configFile of CONFIG_FILES) {
|
|
861
|
-
const configPath = (0,
|
|
862
|
-
if ((0,
|
|
951
|
+
const configPath = (0, import_path3.join)(currentDir, configFile);
|
|
952
|
+
if ((0, import_fs3.existsSync)(configPath)) {
|
|
863
953
|
try {
|
|
864
954
|
let config;
|
|
865
955
|
if (configFile.endsWith(".js")) {
|
|
@@ -867,7 +957,7 @@ async function loadConfig(rootDir) {
|
|
|
867
957
|
const module2 = await import(`${fileUrl}?t=${Date.now()}`);
|
|
868
958
|
config = module2.default || module2;
|
|
869
959
|
} else {
|
|
870
|
-
const content = (0,
|
|
960
|
+
const content = (0, import_fs3.readFileSync)(configPath, "utf-8");
|
|
871
961
|
config = JSON.parse(content);
|
|
872
962
|
}
|
|
873
963
|
if (typeof config !== "object" || config === null) {
|
|
@@ -887,7 +977,7 @@ async function loadConfig(rootDir) {
|
|
|
887
977
|
}
|
|
888
978
|
}
|
|
889
979
|
}
|
|
890
|
-
const parent = (0,
|
|
980
|
+
const parent = (0, import_path3.dirname)(currentDir);
|
|
891
981
|
if (parent === currentDir) {
|
|
892
982
|
break;
|
|
893
983
|
}
|
|
@@ -918,88 +1008,6 @@ function mergeConfigWithDefaults(userConfig, defaults) {
|
|
|
918
1008
|
return result;
|
|
919
1009
|
}
|
|
920
1010
|
|
|
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
1011
|
// src/utils/visualization.ts
|
|
1004
1012
|
function generateHTML(graph) {
|
|
1005
1013
|
const payload = JSON.stringify(graph, null, 2);
|
|
@@ -2941,8 +2949,8 @@ function calculateChangeAmplification(params) {
|
|
|
2941
2949
|
const maxAmplification = hotspots[0].amplificationFactor;
|
|
2942
2950
|
const avgAmplification = hotspots.reduce((sum, h) => sum + h.amplificationFactor, 0) / hotspots.length;
|
|
2943
2951
|
const avgPenalty = Math.log2(avgAmplification + 1) * 15;
|
|
2944
|
-
const maxPenalty = maxAmplification > 30 ? (maxAmplification -
|
|
2945
|
-
const score = Math.max(
|
|
2952
|
+
const maxPenalty = maxAmplification > 30 ? Math.log10(maxAmplification - 29) * 30 : 0;
|
|
2953
|
+
const score = Math.max(5, Math.min(100, 100 - avgPenalty - maxPenalty));
|
|
2946
2954
|
let rating = "isolated";
|
|
2947
2955
|
if (score < 40) rating = "explosive";
|
|
2948
2956
|
else if (score < 70) rating = "amplified";
|
|
@@ -3313,6 +3321,7 @@ function getRepoMetadata(directory) {
|
|
|
3313
3321
|
calculateTestabilityIndex,
|
|
3314
3322
|
calculateTokenBudget,
|
|
3315
3323
|
clearHistory,
|
|
3324
|
+
emitProgress,
|
|
3316
3325
|
estimateCostFromBudget,
|
|
3317
3326
|
estimateTokens,
|
|
3318
3327
|
exportHistory,
|