@aiready/core 0.24.16 → 0.24.18
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-GQMKSUA4.mjs +888 -0
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/index-CcP12wb-.d.mts +1307 -0
- package/dist/index-CcP12wb-.d.ts +1307 -0
- package/dist/index-c5MKV8s5.d.mts +1309 -0
- package/dist/index-c5MKV8s5.d.ts +1309 -0
- package/dist/index.d.mts +159 -3
- package/dist/index.d.ts +159 -3
- package/dist/index.js +178 -1
- package/dist/index.mjs +170 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as Severity, d as ToolOptions, A as AnalysisResult, E as ExportWithImports, F as FileImport, e as AIReadyConfig, I as Issue, M as Metrics, f as TechnicalValueChain, g as ModelContextTier, C as CostConfig, h as TokenBudget, P as ProductivityImpact, i as AcceptancePrediction, j as ComprehensionDifficulty, k as TechnicalValueChainSummary, L as Language, l as LanguageParser, m as ParseResult, N as NamingConvention, n as ExportInfo } from './index-
|
|
2
|
-
export { o as AIReadyConfigSchema, p as ASTNode, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, w as Config, D as DEFAULT_TOOL_WEIGHTS, x as FRIENDLY_TOOL_NAMES, y as FileContent, G as GLOBAL_INFRA_OPTIONS, z as GLOBAL_SCAN_OPTIONS, H as GraphData, J as GraphEdge, K as GraphIssueSeverity, O as GraphMetadata, Q as GraphNode, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, Y as LanguageConfig, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, a5 as ManagedAccount, a6 as ManagedAccountSchema, a7 as MetricsSchema, a8 as ModelTier, a9 as ModelTierSchema, aa as ParseError, ab as ParseStatistics, ac as ReadinessRating, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, ak as SeveritySchema, al as SourceLocation, am as SourceRange, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, ar as ToolNameSchema, as as ToolOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, az as getPriorityIcon, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aD as getRatingEmoji, aE as getRatingLabel, aF as getRatingMetadata, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aJ as getToolEmoji, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from './index-
|
|
1
|
+
import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as Severity, d as ToolOptions, A as AnalysisResult, E as ExportWithImports, F as FileImport, e as AIReadyConfig, I as Issue, M as Metrics, f as TechnicalValueChain, g as ModelContextTier, C as CostConfig, h as TokenBudget, P as ProductivityImpact, i as AcceptancePrediction, j as ComprehensionDifficulty, k as TechnicalValueChainSummary, L as Language, l as LanguageParser, m as ParseResult, N as NamingConvention, n as ExportInfo } from './index-c5MKV8s5.mjs';
|
|
2
|
+
export { o as AIReadyConfigSchema, p as ASTNode, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, w as Config, D as DEFAULT_TOOL_WEIGHTS, x as FRIENDLY_TOOL_NAMES, y as FileContent, G as GLOBAL_INFRA_OPTIONS, z as GLOBAL_SCAN_OPTIONS, H as GraphData, J as GraphEdge, K as GraphIssueSeverity, O as GraphMetadata, Q as GraphNode, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, Y as LanguageConfig, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, a5 as ManagedAccount, a6 as ManagedAccountSchema, a7 as MetricsSchema, a8 as ModelTier, a9 as ModelTierSchema, aa as ParseError, ab as ParseStatistics, ac as ReadinessRating, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, ak as SeveritySchema, al as SourceLocation, am as SourceRange, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, ar as ToolNameSchema, as as ToolOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, az as getPriorityIcon, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aD as getRatingEmoji, aE as getRatingLabel, aF as getRatingMetadata, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aJ as getToolEmoji, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from './index-c5MKV8s5.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { Command } from 'commander';
|
|
5
5
|
import * as chalk from 'chalk';
|
|
@@ -1849,6 +1849,127 @@ declare function calculateExtendedFutureProofScore(params: FutureProofRecommenda
|
|
|
1849
1849
|
semanticDistances?: SemanticDistance[];
|
|
1850
1850
|
}): ToolScoringOutput;
|
|
1851
1851
|
|
|
1852
|
+
/**
|
|
1853
|
+
* Lightweight Dependency Injection Container for @aiready/core.
|
|
1854
|
+
*
|
|
1855
|
+
* Provides a simple, type-safe DI pattern that makes classes mockable
|
|
1856
|
+
* and AI-generated code verifiable through interface-based injection.
|
|
1857
|
+
*
|
|
1858
|
+
* @example
|
|
1859
|
+
* ```typescript
|
|
1860
|
+
* // Define an interface
|
|
1861
|
+
* interface Logger {
|
|
1862
|
+
* info(message: string): void;
|
|
1863
|
+
* error(message: string): void;
|
|
1864
|
+
* }
|
|
1865
|
+
*
|
|
1866
|
+
* // Register an implementation
|
|
1867
|
+
* const container = new DIContainer();
|
|
1868
|
+
* container.register('Logger', { info: console.log, error: console.error });
|
|
1869
|
+
*
|
|
1870
|
+
* // Resolve and use
|
|
1871
|
+
* const logger = container.resolve<Logger>('Logger');
|
|
1872
|
+
* logger.info('Hello from DI!');
|
|
1873
|
+
* ```
|
|
1874
|
+
*/
|
|
1875
|
+
type Factory<T> = () => T;
|
|
1876
|
+
type Token = string | symbol;
|
|
1877
|
+
/**
|
|
1878
|
+
* Simple Dependency Injection Container.
|
|
1879
|
+
* Supports singleton and transient lifetimes.
|
|
1880
|
+
*/
|
|
1881
|
+
declare class DIContainer {
|
|
1882
|
+
private registrations;
|
|
1883
|
+
private singletons;
|
|
1884
|
+
/**
|
|
1885
|
+
* Register a dependency with a factory function.
|
|
1886
|
+
*
|
|
1887
|
+
* @param token - Unique identifier for the dependency
|
|
1888
|
+
* @param factory - Factory function that creates the dependency
|
|
1889
|
+
* @param singleton - If true, the same instance is returned on each resolve (default: true)
|
|
1890
|
+
*/
|
|
1891
|
+
register<T>(token: Token, factory: Factory<T>, singleton?: boolean): void;
|
|
1892
|
+
/**
|
|
1893
|
+
* Register an existing instance as a singleton.
|
|
1894
|
+
*
|
|
1895
|
+
* @param token - Unique identifier for the dependency
|
|
1896
|
+
* @param instance - The instance to register
|
|
1897
|
+
*/
|
|
1898
|
+
registerInstance<T>(token: Token, instance: T): void;
|
|
1899
|
+
/**
|
|
1900
|
+
* Resolve a dependency by its token.
|
|
1901
|
+
*
|
|
1902
|
+
* @param token - The token to resolve
|
|
1903
|
+
* @returns The resolved dependency
|
|
1904
|
+
* @throws Error if token is not registered
|
|
1905
|
+
*/
|
|
1906
|
+
resolve<T>(token: Token): T;
|
|
1907
|
+
/**
|
|
1908
|
+
* Check if a token is registered.
|
|
1909
|
+
*/
|
|
1910
|
+
has(token: Token): boolean;
|
|
1911
|
+
/**
|
|
1912
|
+
* Clear all registrations and singletons.
|
|
1913
|
+
*/
|
|
1914
|
+
clear(): void;
|
|
1915
|
+
/**
|
|
1916
|
+
* Create a child container that inherits registrations from parent.
|
|
1917
|
+
* Child can override parent registrations without affecting parent.
|
|
1918
|
+
*/
|
|
1919
|
+
createChild(): DIContainer;
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Well-known dependency tokens for @aiready/core.
|
|
1923
|
+
*/
|
|
1924
|
+
declare const DI_TOKENS: {
|
|
1925
|
+
/** File system operations (fs/promises compatible) */
|
|
1926
|
+
readonly FileSystem: symbol;
|
|
1927
|
+
/** Logger instance */
|
|
1928
|
+
readonly Logger: symbol;
|
|
1929
|
+
/** AST parser factory */
|
|
1930
|
+
readonly ParserFactory: symbol;
|
|
1931
|
+
/** Configuration provider */
|
|
1932
|
+
readonly ConfigProvider: symbol;
|
|
1933
|
+
/** Metrics collector */
|
|
1934
|
+
readonly MetricsCollector: symbol;
|
|
1935
|
+
};
|
|
1936
|
+
/**
|
|
1937
|
+
* Standard interfaces for core dependencies.
|
|
1938
|
+
*/
|
|
1939
|
+
interface FileSystem {
|
|
1940
|
+
readFile(path: string): Promise<string>;
|
|
1941
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
1942
|
+
exists(path: string): Promise<boolean>;
|
|
1943
|
+
readdir(path: string): Promise<string[]>;
|
|
1944
|
+
}
|
|
1945
|
+
interface Logger {
|
|
1946
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
1947
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
1948
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
1949
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
1950
|
+
}
|
|
1951
|
+
interface ConfigProvider {
|
|
1952
|
+
get<T>(key: string, defaultValue?: T): T;
|
|
1953
|
+
set(key: string, value: unknown): void;
|
|
1954
|
+
has(key: string): boolean;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Default implementations for testing and production.
|
|
1958
|
+
*/
|
|
1959
|
+
declare const defaultImplementations: {
|
|
1960
|
+
/** Console-based logger (production default) */
|
|
1961
|
+
consoleLogger: () => Logger;
|
|
1962
|
+
/** No-op logger (test default) */
|
|
1963
|
+
noopLogger: () => Logger;
|
|
1964
|
+
/** In-memory config provider (test default) */
|
|
1965
|
+
memoryConfig: (initial?: Record<string, unknown>) => ConfigProvider;
|
|
1966
|
+
};
|
|
1967
|
+
/**
|
|
1968
|
+
* Global container instance for convenience.
|
|
1969
|
+
* Prefer creating scoped containers in tests.
|
|
1970
|
+
*/
|
|
1971
|
+
declare const globalContainer: DIContainer;
|
|
1972
|
+
|
|
1852
1973
|
/**
|
|
1853
1974
|
* Temporal Tracking Utilities
|
|
1854
1975
|
*
|
|
@@ -2010,4 +2131,39 @@ declare function isIgnorableSourceFile(filePath: string): boolean;
|
|
|
2010
2131
|
*/
|
|
2011
2132
|
declare function isBuildArtifact(filePath: string): boolean;
|
|
2012
2133
|
|
|
2013
|
-
|
|
2134
|
+
/**
|
|
2135
|
+
* Common error handling utilities to reduce code duplication.
|
|
2136
|
+
* These patterns appear in 23+ files across the codebase.
|
|
2137
|
+
*/
|
|
2138
|
+
/**
|
|
2139
|
+
* Extract error message from unknown error type.
|
|
2140
|
+
* Replaces: error instanceof Error ? error.message : String(error)
|
|
2141
|
+
*/
|
|
2142
|
+
declare function getErrorMessage(error: unknown): string;
|
|
2143
|
+
/**
|
|
2144
|
+
* Extract error message with fallback for unknown errors.
|
|
2145
|
+
* Replaces: error instanceof Error ? error.message : 'Unknown error'
|
|
2146
|
+
*/
|
|
2147
|
+
declare function toErrorMessage(error: unknown, fallback?: string): string;
|
|
2148
|
+
/**
|
|
2149
|
+
* Create a standardized API error response.
|
|
2150
|
+
* Replaces duplicated error response formatting patterns.
|
|
2151
|
+
*/
|
|
2152
|
+
declare function createErrorResponse(message: string, status: number, details?: unknown): {
|
|
2153
|
+
error: string;
|
|
2154
|
+
status: number;
|
|
2155
|
+
details?: unknown;
|
|
2156
|
+
};
|
|
2157
|
+
/**
|
|
2158
|
+
* Wrap an async function with standardized error handling.
|
|
2159
|
+
* Replaces duplicated try-catch patterns.
|
|
2160
|
+
*/
|
|
2161
|
+
declare function withErrorHandling<T>(operation: () => Promise<T>, context?: string): Promise<{
|
|
2162
|
+
success: true;
|
|
2163
|
+
data: T;
|
|
2164
|
+
} | {
|
|
2165
|
+
success: false;
|
|
2166
|
+
error: string;
|
|
2167
|
+
}>;
|
|
2168
|
+
|
|
2169
|
+
export { AIReadyConfig, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CodeBlock, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, type ConfigProvider, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, DIContainer, DI_TOKENS, type DependencyHealthScore, type DocDriftRisk, ExportInfo, ExportWithImports, type Factory, FileImport, type FileSystem, type FileTestability, type FileWithDomain, GoParser, type HtmlReportSection, Issue, type JSONOutputParams, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, type Logger, MODEL_PRICING_PRESETS, Metrics, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, type ProviderFactoryConfig, PythonParser, type ReportOptions, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, Severity, Severity as SeverityType, SpokeOutput, type StandardReportData, type StandardScoringParams, type StatCard, TEST_PATTERNS, type TableConfig, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, type Token, TokenBudget, ToolName, ToolOptions, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, buildFactorsFromDimensions, buildSimpleProviderScore, buildSpokeOutput, buildStandardToolScore, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDetailedTokenROI, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateHeuristicConfidence, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateStringSimilarity, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, createErrorResponse, createProvider, createStandardCommand, createStandardProgressCallback, defaultImplementations, detectTestFramework, displayStandardConsoleReport, emitAnnotation, emitIssuesAsAnnotations, emitProgress, ensureDir, estimateCostFromBudget, estimateTokens, executeSpokeCli, exportHistory, extractCodeBlocks, filterBySeverity, findLatestReport, findLatestScanReport, formatAcceptanceRate, formatCost, formatHours, formatStandardCliResult, formatStandardReport, generateCompleteReport, generateIssueSummary, generateReportFooter, generateReportHead, generateReportHero, generateStandardHtmlReport, generateStatCards, generateTable, generateValueChain, getElapsedTime, getErrorMessage, getFileCommitTimestamps, getFileExtension, getFilesByPattern, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getReportTimestamp, getSafetyIcon, getScoreBar, getScoreColor, getSeverityBadge, getSeverityColor, getSeverityEnum, getSeverityLabel, getSeverityLevel, getSeverityValue, getSupportedLanguages, getTerminalDivider, getWasmPath, globalContainer, groupIssuesByFile, handleCLIError, handleJSONOutput, handleStandardJSONOutput, inferPatternType, initTreeSitter, initializeParsers, isBuildArtifact, isFileSupported, isIgnorableSourceFile, isSourceFile, isTestFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, normalizeAnalysisResult, normalizeIssue, normalizeMetrics, normalizeSeverity, normalizeSpokeOutput, parseFileExports, predictAcceptanceRate, prepareActionConfig, printTerminalHeader, readFileContent, resolveOutputFormat, resolveOutputPath, runBatchAnalysis, runStandardCliAction, saveScoreEntry, scanEntries, scanFiles, setupParser, severityToAnnotationLevel, toErrorMessage, validateSpokeOutput, validateWithSchema, withErrorHandling, wrapInCard };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as Severity, d as ToolOptions, A as AnalysisResult, E as ExportWithImports, F as FileImport, e as AIReadyConfig, I as Issue, M as Metrics, f as TechnicalValueChain, g as ModelContextTier, C as CostConfig, h as TokenBudget, P as ProductivityImpact, i as AcceptancePrediction, j as ComprehensionDifficulty, k as TechnicalValueChainSummary, L as Language, l as LanguageParser, m as ParseResult, N as NamingConvention, n as ExportInfo } from './index-
|
|
2
|
-
export { o as AIReadyConfigSchema, p as ASTNode, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, w as Config, D as DEFAULT_TOOL_WEIGHTS, x as FRIENDLY_TOOL_NAMES, y as FileContent, G as GLOBAL_INFRA_OPTIONS, z as GLOBAL_SCAN_OPTIONS, H as GraphData, J as GraphEdge, K as GraphIssueSeverity, O as GraphMetadata, Q as GraphNode, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, Y as LanguageConfig, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, a5 as ManagedAccount, a6 as ManagedAccountSchema, a7 as MetricsSchema, a8 as ModelTier, a9 as ModelTierSchema, aa as ParseError, ab as ParseStatistics, ac as ReadinessRating, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, ak as SeveritySchema, al as SourceLocation, am as SourceRange, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, ar as ToolNameSchema, as as ToolOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, az as getPriorityIcon, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aD as getRatingEmoji, aE as getRatingLabel, aF as getRatingMetadata, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aJ as getToolEmoji, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from './index-
|
|
1
|
+
import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as Severity, d as ToolOptions, A as AnalysisResult, E as ExportWithImports, F as FileImport, e as AIReadyConfig, I as Issue, M as Metrics, f as TechnicalValueChain, g as ModelContextTier, C as CostConfig, h as TokenBudget, P as ProductivityImpact, i as AcceptancePrediction, j as ComprehensionDifficulty, k as TechnicalValueChainSummary, L as Language, l as LanguageParser, m as ParseResult, N as NamingConvention, n as ExportInfo } from './index-c5MKV8s5.js';
|
|
2
|
+
export { o as AIReadyConfigSchema, p as ASTNode, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, w as Config, D as DEFAULT_TOOL_WEIGHTS, x as FRIENDLY_TOOL_NAMES, y as FileContent, G as GLOBAL_INFRA_OPTIONS, z as GLOBAL_SCAN_OPTIONS, H as GraphData, J as GraphEdge, K as GraphIssueSeverity, O as GraphMetadata, Q as GraphNode, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, Y as LanguageConfig, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, a5 as ManagedAccount, a6 as ManagedAccountSchema, a7 as MetricsSchema, a8 as ModelTier, a9 as ModelTierSchema, aa as ParseError, ab as ParseStatistics, ac as ReadinessRating, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, ak as SeveritySchema, al as SourceLocation, am as SourceRange, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, ar as ToolNameSchema, as as ToolOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, az as getPriorityIcon, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aD as getRatingEmoji, aE as getRatingLabel, aF as getRatingMetadata, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aJ as getToolEmoji, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from './index-c5MKV8s5.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { Command } from 'commander';
|
|
5
5
|
import * as chalk from 'chalk';
|
|
@@ -1849,6 +1849,127 @@ declare function calculateExtendedFutureProofScore(params: FutureProofRecommenda
|
|
|
1849
1849
|
semanticDistances?: SemanticDistance[];
|
|
1850
1850
|
}): ToolScoringOutput;
|
|
1851
1851
|
|
|
1852
|
+
/**
|
|
1853
|
+
* Lightweight Dependency Injection Container for @aiready/core.
|
|
1854
|
+
*
|
|
1855
|
+
* Provides a simple, type-safe DI pattern that makes classes mockable
|
|
1856
|
+
* and AI-generated code verifiable through interface-based injection.
|
|
1857
|
+
*
|
|
1858
|
+
* @example
|
|
1859
|
+
* ```typescript
|
|
1860
|
+
* // Define an interface
|
|
1861
|
+
* interface Logger {
|
|
1862
|
+
* info(message: string): void;
|
|
1863
|
+
* error(message: string): void;
|
|
1864
|
+
* }
|
|
1865
|
+
*
|
|
1866
|
+
* // Register an implementation
|
|
1867
|
+
* const container = new DIContainer();
|
|
1868
|
+
* container.register('Logger', { info: console.log, error: console.error });
|
|
1869
|
+
*
|
|
1870
|
+
* // Resolve and use
|
|
1871
|
+
* const logger = container.resolve<Logger>('Logger');
|
|
1872
|
+
* logger.info('Hello from DI!');
|
|
1873
|
+
* ```
|
|
1874
|
+
*/
|
|
1875
|
+
type Factory<T> = () => T;
|
|
1876
|
+
type Token = string | symbol;
|
|
1877
|
+
/**
|
|
1878
|
+
* Simple Dependency Injection Container.
|
|
1879
|
+
* Supports singleton and transient lifetimes.
|
|
1880
|
+
*/
|
|
1881
|
+
declare class DIContainer {
|
|
1882
|
+
private registrations;
|
|
1883
|
+
private singletons;
|
|
1884
|
+
/**
|
|
1885
|
+
* Register a dependency with a factory function.
|
|
1886
|
+
*
|
|
1887
|
+
* @param token - Unique identifier for the dependency
|
|
1888
|
+
* @param factory - Factory function that creates the dependency
|
|
1889
|
+
* @param singleton - If true, the same instance is returned on each resolve (default: true)
|
|
1890
|
+
*/
|
|
1891
|
+
register<T>(token: Token, factory: Factory<T>, singleton?: boolean): void;
|
|
1892
|
+
/**
|
|
1893
|
+
* Register an existing instance as a singleton.
|
|
1894
|
+
*
|
|
1895
|
+
* @param token - Unique identifier for the dependency
|
|
1896
|
+
* @param instance - The instance to register
|
|
1897
|
+
*/
|
|
1898
|
+
registerInstance<T>(token: Token, instance: T): void;
|
|
1899
|
+
/**
|
|
1900
|
+
* Resolve a dependency by its token.
|
|
1901
|
+
*
|
|
1902
|
+
* @param token - The token to resolve
|
|
1903
|
+
* @returns The resolved dependency
|
|
1904
|
+
* @throws Error if token is not registered
|
|
1905
|
+
*/
|
|
1906
|
+
resolve<T>(token: Token): T;
|
|
1907
|
+
/**
|
|
1908
|
+
* Check if a token is registered.
|
|
1909
|
+
*/
|
|
1910
|
+
has(token: Token): boolean;
|
|
1911
|
+
/**
|
|
1912
|
+
* Clear all registrations and singletons.
|
|
1913
|
+
*/
|
|
1914
|
+
clear(): void;
|
|
1915
|
+
/**
|
|
1916
|
+
* Create a child container that inherits registrations from parent.
|
|
1917
|
+
* Child can override parent registrations without affecting parent.
|
|
1918
|
+
*/
|
|
1919
|
+
createChild(): DIContainer;
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Well-known dependency tokens for @aiready/core.
|
|
1923
|
+
*/
|
|
1924
|
+
declare const DI_TOKENS: {
|
|
1925
|
+
/** File system operations (fs/promises compatible) */
|
|
1926
|
+
readonly FileSystem: symbol;
|
|
1927
|
+
/** Logger instance */
|
|
1928
|
+
readonly Logger: symbol;
|
|
1929
|
+
/** AST parser factory */
|
|
1930
|
+
readonly ParserFactory: symbol;
|
|
1931
|
+
/** Configuration provider */
|
|
1932
|
+
readonly ConfigProvider: symbol;
|
|
1933
|
+
/** Metrics collector */
|
|
1934
|
+
readonly MetricsCollector: symbol;
|
|
1935
|
+
};
|
|
1936
|
+
/**
|
|
1937
|
+
* Standard interfaces for core dependencies.
|
|
1938
|
+
*/
|
|
1939
|
+
interface FileSystem {
|
|
1940
|
+
readFile(path: string): Promise<string>;
|
|
1941
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
1942
|
+
exists(path: string): Promise<boolean>;
|
|
1943
|
+
readdir(path: string): Promise<string[]>;
|
|
1944
|
+
}
|
|
1945
|
+
interface Logger {
|
|
1946
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
1947
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
1948
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
1949
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
1950
|
+
}
|
|
1951
|
+
interface ConfigProvider {
|
|
1952
|
+
get<T>(key: string, defaultValue?: T): T;
|
|
1953
|
+
set(key: string, value: unknown): void;
|
|
1954
|
+
has(key: string): boolean;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Default implementations for testing and production.
|
|
1958
|
+
*/
|
|
1959
|
+
declare const defaultImplementations: {
|
|
1960
|
+
/** Console-based logger (production default) */
|
|
1961
|
+
consoleLogger: () => Logger;
|
|
1962
|
+
/** No-op logger (test default) */
|
|
1963
|
+
noopLogger: () => Logger;
|
|
1964
|
+
/** In-memory config provider (test default) */
|
|
1965
|
+
memoryConfig: (initial?: Record<string, unknown>) => ConfigProvider;
|
|
1966
|
+
};
|
|
1967
|
+
/**
|
|
1968
|
+
* Global container instance for convenience.
|
|
1969
|
+
* Prefer creating scoped containers in tests.
|
|
1970
|
+
*/
|
|
1971
|
+
declare const globalContainer: DIContainer;
|
|
1972
|
+
|
|
1852
1973
|
/**
|
|
1853
1974
|
* Temporal Tracking Utilities
|
|
1854
1975
|
*
|
|
@@ -2010,4 +2131,39 @@ declare function isIgnorableSourceFile(filePath: string): boolean;
|
|
|
2010
2131
|
*/
|
|
2011
2132
|
declare function isBuildArtifact(filePath: string): boolean;
|
|
2012
2133
|
|
|
2013
|
-
|
|
2134
|
+
/**
|
|
2135
|
+
* Common error handling utilities to reduce code duplication.
|
|
2136
|
+
* These patterns appear in 23+ files across the codebase.
|
|
2137
|
+
*/
|
|
2138
|
+
/**
|
|
2139
|
+
* Extract error message from unknown error type.
|
|
2140
|
+
* Replaces: error instanceof Error ? error.message : String(error)
|
|
2141
|
+
*/
|
|
2142
|
+
declare function getErrorMessage(error: unknown): string;
|
|
2143
|
+
/**
|
|
2144
|
+
* Extract error message with fallback for unknown errors.
|
|
2145
|
+
* Replaces: error instanceof Error ? error.message : 'Unknown error'
|
|
2146
|
+
*/
|
|
2147
|
+
declare function toErrorMessage(error: unknown, fallback?: string): string;
|
|
2148
|
+
/**
|
|
2149
|
+
* Create a standardized API error response.
|
|
2150
|
+
* Replaces duplicated error response formatting patterns.
|
|
2151
|
+
*/
|
|
2152
|
+
declare function createErrorResponse(message: string, status: number, details?: unknown): {
|
|
2153
|
+
error: string;
|
|
2154
|
+
status: number;
|
|
2155
|
+
details?: unknown;
|
|
2156
|
+
};
|
|
2157
|
+
/**
|
|
2158
|
+
* Wrap an async function with standardized error handling.
|
|
2159
|
+
* Replaces duplicated try-catch patterns.
|
|
2160
|
+
*/
|
|
2161
|
+
declare function withErrorHandling<T>(operation: () => Promise<T>, context?: string): Promise<{
|
|
2162
|
+
success: true;
|
|
2163
|
+
data: T;
|
|
2164
|
+
} | {
|
|
2165
|
+
success: false;
|
|
2166
|
+
error: string;
|
|
2167
|
+
}>;
|
|
2168
|
+
|
|
2169
|
+
export { AIReadyConfig, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CodeBlock, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, type ConfigProvider, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, DIContainer, DI_TOKENS, type DependencyHealthScore, type DocDriftRisk, ExportInfo, ExportWithImports, type Factory, FileImport, type FileSystem, type FileTestability, type FileWithDomain, GoParser, type HtmlReportSection, Issue, type JSONOutputParams, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, type Logger, MODEL_PRICING_PRESETS, Metrics, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, type ProviderFactoryConfig, PythonParser, type ReportOptions, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, Severity, Severity as SeverityType, SpokeOutput, type StandardReportData, type StandardScoringParams, type StatCard, TEST_PATTERNS, type TableConfig, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, type Token, TokenBudget, ToolName, ToolOptions, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, buildFactorsFromDimensions, buildSimpleProviderScore, buildSpokeOutput, buildStandardToolScore, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDetailedTokenROI, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateHeuristicConfidence, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateStringSimilarity, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, createErrorResponse, createProvider, createStandardCommand, createStandardProgressCallback, defaultImplementations, detectTestFramework, displayStandardConsoleReport, emitAnnotation, emitIssuesAsAnnotations, emitProgress, ensureDir, estimateCostFromBudget, estimateTokens, executeSpokeCli, exportHistory, extractCodeBlocks, filterBySeverity, findLatestReport, findLatestScanReport, formatAcceptanceRate, formatCost, formatHours, formatStandardCliResult, formatStandardReport, generateCompleteReport, generateIssueSummary, generateReportFooter, generateReportHead, generateReportHero, generateStandardHtmlReport, generateStatCards, generateTable, generateValueChain, getElapsedTime, getErrorMessage, getFileCommitTimestamps, getFileExtension, getFilesByPattern, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getReportTimestamp, getSafetyIcon, getScoreBar, getScoreColor, getSeverityBadge, getSeverityColor, getSeverityEnum, getSeverityLabel, getSeverityLevel, getSeverityValue, getSupportedLanguages, getTerminalDivider, getWasmPath, globalContainer, groupIssuesByFile, handleCLIError, handleJSONOutput, handleStandardJSONOutput, inferPatternType, initTreeSitter, initializeParsers, isBuildArtifact, isFileSupported, isIgnorableSourceFile, isSourceFile, isTestFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, normalizeAnalysisResult, normalizeIssue, normalizeMetrics, normalizeSeverity, normalizeSpokeOutput, parseFileExports, predictAcceptanceRate, prepareActionConfig, printTerminalHeader, readFileContent, resolveOutputFormat, resolveOutputPath, runBatchAnalysis, runStandardCliAction, saveScoreEntry, scanEntries, scanFiles, setupParser, severityToAnnotationLevel, toErrorMessage, validateSpokeOutput, validateWithSchema, withErrorHandling, wrapInCard };
|
package/dist/index.js
CHANGED
|
@@ -2033,6 +2033,8 @@ __export(index_exports, {
|
|
|
2033
2033
|
DEFAULT_COST_CONFIG: () => DEFAULT_COST_CONFIG,
|
|
2034
2034
|
DEFAULT_EXCLUDE: () => DEFAULT_EXCLUDE,
|
|
2035
2035
|
DEFAULT_TOOL_WEIGHTS: () => DEFAULT_TOOL_WEIGHTS,
|
|
2036
|
+
DIContainer: () => DIContainer,
|
|
2037
|
+
DI_TOKENS: () => DI_TOKENS,
|
|
2036
2038
|
FRIENDLY_TOOL_NAMES: () => FRIENDLY_TOOL_NAMES,
|
|
2037
2039
|
GLOBAL_INFRA_OPTIONS: () => GLOBAL_INFRA_OPTIONS,
|
|
2038
2040
|
GLOBAL_SCAN_OPTIONS: () => GLOBAL_SCAN_OPTIONS,
|
|
@@ -2104,9 +2106,11 @@ __export(index_exports, {
|
|
|
2104
2106
|
calculateTestabilityIndex: () => calculateTestabilityIndex,
|
|
2105
2107
|
calculateTokenBudget: () => calculateTokenBudget,
|
|
2106
2108
|
clearHistory: () => clearHistory,
|
|
2109
|
+
createErrorResponse: () => createErrorResponse,
|
|
2107
2110
|
createProvider: () => createProvider,
|
|
2108
2111
|
createStandardCommand: () => createStandardCommand,
|
|
2109
2112
|
createStandardProgressCallback: () => createStandardProgressCallback,
|
|
2113
|
+
defaultImplementations: () => defaultImplementations,
|
|
2110
2114
|
detectTestFramework: () => detectTestFramework,
|
|
2111
2115
|
displayStandardConsoleReport: () => displayStandardConsoleReport,
|
|
2112
2116
|
emitAnnotation: () => emitAnnotation,
|
|
@@ -2139,6 +2143,7 @@ __export(index_exports, {
|
|
|
2139
2143
|
generateTable: () => generateTable,
|
|
2140
2144
|
generateValueChain: () => generateValueChain,
|
|
2141
2145
|
getElapsedTime: () => getElapsedTime,
|
|
2146
|
+
getErrorMessage: () => getErrorMessage,
|
|
2142
2147
|
getFileCommitTimestamps: () => getFileCommitTimestamps,
|
|
2143
2148
|
getFileExtension: () => getFileExtension,
|
|
2144
2149
|
getFilesByPattern: () => getFilesByPattern,
|
|
@@ -2172,6 +2177,7 @@ __export(index_exports, {
|
|
|
2172
2177
|
getToolEmoji: () => getToolEmoji,
|
|
2173
2178
|
getToolWeight: () => getToolWeight,
|
|
2174
2179
|
getWasmPath: () => getWasmPath,
|
|
2180
|
+
globalContainer: () => globalContainer,
|
|
2175
2181
|
groupIssuesByFile: () => groupIssuesByFile,
|
|
2176
2182
|
handleCLIError: () => handleCLIError,
|
|
2177
2183
|
handleJSONOutput: () => handleJSONOutput,
|
|
@@ -2209,8 +2215,10 @@ __export(index_exports, {
|
|
|
2209
2215
|
scanFiles: () => scanFiles,
|
|
2210
2216
|
setupParser: () => setupParser,
|
|
2211
2217
|
severityToAnnotationLevel: () => severityToAnnotationLevel,
|
|
2218
|
+
toErrorMessage: () => toErrorMessage,
|
|
2212
2219
|
validateSpokeOutput: () => validateSpokeOutput,
|
|
2213
2220
|
validateWithSchema: () => validateWithSchema,
|
|
2221
|
+
withErrorHandling: () => withErrorHandling,
|
|
2214
2222
|
wrapInCard: () => wrapInCard
|
|
2215
2223
|
});
|
|
2216
2224
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -2471,7 +2479,7 @@ var ManagedAccountSchema = import_zod7.z.object({
|
|
|
2471
2479
|
accountId: import_zod7.z.string(),
|
|
2472
2480
|
// AWS Account ID
|
|
2473
2481
|
userId: import_zod7.z.string(),
|
|
2474
|
-
// Owner (
|
|
2482
|
+
// Owner (team@getaiready.dev)
|
|
2475
2483
|
stripeSubscriptionId: import_zod7.z.string(),
|
|
2476
2484
|
// AI Token Management
|
|
2477
2485
|
tokenStrategy: import_zod7.z.enum(["managed", "byok"]).default("managed"),
|
|
@@ -3821,6 +3829,7 @@ function mergeConfigWithDefaults(userConfig, defaults) {
|
|
|
3821
3829
|
if (userConfig.scan) {
|
|
3822
3830
|
if (userConfig.scan.include) mergedConfig.include = userConfig.scan.include;
|
|
3823
3831
|
if (userConfig.scan.exclude) mergedConfig.exclude = userConfig.scan.exclude;
|
|
3832
|
+
if (userConfig.scan.tools) mergedConfig.tools = userConfig.scan.tools;
|
|
3824
3833
|
}
|
|
3825
3834
|
if (userConfig.threshold !== void 0)
|
|
3826
3835
|
mergedConfig.threshold = userConfig.threshold;
|
|
@@ -3843,6 +3852,12 @@ function mergeConfigWithDefaults(userConfig, defaults) {
|
|
|
3843
3852
|
...userConfig.output
|
|
3844
3853
|
};
|
|
3845
3854
|
}
|
|
3855
|
+
if (userConfig.scoring) {
|
|
3856
|
+
mergedConfig.scoring = {
|
|
3857
|
+
...mergedConfig.scoring,
|
|
3858
|
+
...userConfig.scoring
|
|
3859
|
+
};
|
|
3860
|
+
}
|
|
3846
3861
|
return mergedConfig;
|
|
3847
3862
|
}
|
|
3848
3863
|
|
|
@@ -6206,6 +6221,123 @@ function calculateTestabilityIndex(params) {
|
|
|
6206
6221
|
};
|
|
6207
6222
|
}
|
|
6208
6223
|
|
|
6224
|
+
// src/utils/di-container.ts
|
|
6225
|
+
var DIContainer = class _DIContainer {
|
|
6226
|
+
constructor() {
|
|
6227
|
+
this.registrations = /* @__PURE__ */ new Map();
|
|
6228
|
+
this.singletons = /* @__PURE__ */ new Map();
|
|
6229
|
+
}
|
|
6230
|
+
/**
|
|
6231
|
+
* Register a dependency with a factory function.
|
|
6232
|
+
*
|
|
6233
|
+
* @param token - Unique identifier for the dependency
|
|
6234
|
+
* @param factory - Factory function that creates the dependency
|
|
6235
|
+
* @param singleton - If true, the same instance is returned on each resolve (default: true)
|
|
6236
|
+
*/
|
|
6237
|
+
register(token, factory, singleton = true) {
|
|
6238
|
+
this.registrations.set(token, { factory, singleton });
|
|
6239
|
+
}
|
|
6240
|
+
/**
|
|
6241
|
+
* Register an existing instance as a singleton.
|
|
6242
|
+
*
|
|
6243
|
+
* @param token - Unique identifier for the dependency
|
|
6244
|
+
* @param instance - The instance to register
|
|
6245
|
+
*/
|
|
6246
|
+
registerInstance(token, instance) {
|
|
6247
|
+
this.registrations.set(token, { factory: () => instance, singleton: true });
|
|
6248
|
+
this.singletons.set(token, instance);
|
|
6249
|
+
}
|
|
6250
|
+
/**
|
|
6251
|
+
* Resolve a dependency by its token.
|
|
6252
|
+
*
|
|
6253
|
+
* @param token - The token to resolve
|
|
6254
|
+
* @returns The resolved dependency
|
|
6255
|
+
* @throws Error if token is not registered
|
|
6256
|
+
*/
|
|
6257
|
+
resolve(token) {
|
|
6258
|
+
const registration = this.registrations.get(token);
|
|
6259
|
+
if (!registration) {
|
|
6260
|
+
throw new Error(`DI: No registration found for token: ${String(token)}`);
|
|
6261
|
+
}
|
|
6262
|
+
if (registration.singleton) {
|
|
6263
|
+
if (!this.singletons.has(token)) {
|
|
6264
|
+
this.singletons.set(token, registration.factory());
|
|
6265
|
+
}
|
|
6266
|
+
return this.singletons.get(token);
|
|
6267
|
+
}
|
|
6268
|
+
return registration.factory();
|
|
6269
|
+
}
|
|
6270
|
+
/**
|
|
6271
|
+
* Check if a token is registered.
|
|
6272
|
+
*/
|
|
6273
|
+
has(token) {
|
|
6274
|
+
return this.registrations.has(token);
|
|
6275
|
+
}
|
|
6276
|
+
/**
|
|
6277
|
+
* Clear all registrations and singletons.
|
|
6278
|
+
*/
|
|
6279
|
+
clear() {
|
|
6280
|
+
this.registrations.clear();
|
|
6281
|
+
this.singletons.clear();
|
|
6282
|
+
}
|
|
6283
|
+
/**
|
|
6284
|
+
* Create a child container that inherits registrations from parent.
|
|
6285
|
+
* Child can override parent registrations without affecting parent.
|
|
6286
|
+
*/
|
|
6287
|
+
createChild() {
|
|
6288
|
+
const child = new _DIContainer();
|
|
6289
|
+
for (const [token, registration] of this.registrations) {
|
|
6290
|
+
child.registrations.set(token, registration);
|
|
6291
|
+
}
|
|
6292
|
+
for (const [token, instance] of this.singletons) {
|
|
6293
|
+
child.singletons.set(token, instance);
|
|
6294
|
+
}
|
|
6295
|
+
return child;
|
|
6296
|
+
}
|
|
6297
|
+
};
|
|
6298
|
+
var DI_TOKENS = {
|
|
6299
|
+
/** File system operations (fs/promises compatible) */
|
|
6300
|
+
FileSystem: /* @__PURE__ */ Symbol("FileSystem"),
|
|
6301
|
+
/** Logger instance */
|
|
6302
|
+
Logger: /* @__PURE__ */ Symbol("Logger"),
|
|
6303
|
+
/** AST parser factory */
|
|
6304
|
+
ParserFactory: /* @__PURE__ */ Symbol("ParserFactory"),
|
|
6305
|
+
/** Configuration provider */
|
|
6306
|
+
ConfigProvider: /* @__PURE__ */ Symbol("ConfigProvider"),
|
|
6307
|
+
/** Metrics collector */
|
|
6308
|
+
MetricsCollector: /* @__PURE__ */ Symbol("MetricsCollector")
|
|
6309
|
+
};
|
|
6310
|
+
var defaultImplementations = {
|
|
6311
|
+
/** Console-based logger (production default) */
|
|
6312
|
+
consoleLogger: () => ({
|
|
6313
|
+
info: (msg, meta) => console.log(`[INFO] ${msg}`, meta || ""),
|
|
6314
|
+
warn: (msg, meta) => console.warn(`[WARN] ${msg}`, meta || ""),
|
|
6315
|
+
error: (msg, meta) => console.error(`[ERROR] ${msg}`, meta || ""),
|
|
6316
|
+
debug: (msg, meta) => console.debug(`[DEBUG] ${msg}`, meta || "")
|
|
6317
|
+
}),
|
|
6318
|
+
/** No-op logger (test default) */
|
|
6319
|
+
noopLogger: () => ({
|
|
6320
|
+
info: () => {
|
|
6321
|
+
},
|
|
6322
|
+
warn: () => {
|
|
6323
|
+
},
|
|
6324
|
+
error: () => {
|
|
6325
|
+
},
|
|
6326
|
+
debug: () => {
|
|
6327
|
+
}
|
|
6328
|
+
}),
|
|
6329
|
+
/** In-memory config provider (test default) */
|
|
6330
|
+
memoryConfig: (initial) => {
|
|
6331
|
+
const store = new Map(Object.entries(initial || {}));
|
|
6332
|
+
return {
|
|
6333
|
+
get: (key, defaultValue) => store.get(key) ?? defaultValue,
|
|
6334
|
+
set: (key, value) => store.set(key, value),
|
|
6335
|
+
has: (key) => store.has(key)
|
|
6336
|
+
};
|
|
6337
|
+
}
|
|
6338
|
+
};
|
|
6339
|
+
var globalContainer = new DIContainer();
|
|
6340
|
+
|
|
6209
6341
|
// src/metrics/doc-drift.ts
|
|
6210
6342
|
function calculateDocDrift(params) {
|
|
6211
6343
|
const {
|
|
@@ -6698,6 +6830,43 @@ function isBuildArtifact(filePath) {
|
|
|
6698
6830
|
const lower = filePath.toLowerCase();
|
|
6699
6831
|
return lower.includes("/node_modules/") || lower.includes("/dist/") || lower.includes("/build/") || lower.includes("/out/") || lower.includes("/.next/") || lower.includes("/target/") || lower.includes("/bin/");
|
|
6700
6832
|
}
|
|
6833
|
+
|
|
6834
|
+
// src/utils/error-utils.ts
|
|
6835
|
+
function getErrorMessage(error) {
|
|
6836
|
+
if (error instanceof Error) {
|
|
6837
|
+
return error.message;
|
|
6838
|
+
}
|
|
6839
|
+
if (typeof error === "string") {
|
|
6840
|
+
return error;
|
|
6841
|
+
}
|
|
6842
|
+
return String(error);
|
|
6843
|
+
}
|
|
6844
|
+
function toErrorMessage(error, fallback = "Unknown error") {
|
|
6845
|
+
if (error instanceof Error) {
|
|
6846
|
+
return error.message;
|
|
6847
|
+
}
|
|
6848
|
+
if (typeof error === "string" && error.length > 0) {
|
|
6849
|
+
return error;
|
|
6850
|
+
}
|
|
6851
|
+
return fallback;
|
|
6852
|
+
}
|
|
6853
|
+
function createErrorResponse(message, status, details) {
|
|
6854
|
+
return {
|
|
6855
|
+
error: message,
|
|
6856
|
+
status,
|
|
6857
|
+
...details !== void 0 && { details }
|
|
6858
|
+
};
|
|
6859
|
+
}
|
|
6860
|
+
async function withErrorHandling(operation, context) {
|
|
6861
|
+
try {
|
|
6862
|
+
const data = await operation();
|
|
6863
|
+
return { success: true, data };
|
|
6864
|
+
} catch (error) {
|
|
6865
|
+
const message = getErrorMessage(error);
|
|
6866
|
+
const contextPrefix = context ? `${context}: ` : "";
|
|
6867
|
+
return { success: false, error: `${contextPrefix}${message}` };
|
|
6868
|
+
}
|
|
6869
|
+
}
|
|
6701
6870
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6702
6871
|
0 && (module.exports = {
|
|
6703
6872
|
AIReadyConfigSchema,
|
|
@@ -6710,6 +6879,8 @@ function isBuildArtifact(filePath) {
|
|
|
6710
6879
|
DEFAULT_COST_CONFIG,
|
|
6711
6880
|
DEFAULT_EXCLUDE,
|
|
6712
6881
|
DEFAULT_TOOL_WEIGHTS,
|
|
6882
|
+
DIContainer,
|
|
6883
|
+
DI_TOKENS,
|
|
6713
6884
|
FRIENDLY_TOOL_NAMES,
|
|
6714
6885
|
GLOBAL_INFRA_OPTIONS,
|
|
6715
6886
|
GLOBAL_SCAN_OPTIONS,
|
|
@@ -6781,9 +6952,11 @@ function isBuildArtifact(filePath) {
|
|
|
6781
6952
|
calculateTestabilityIndex,
|
|
6782
6953
|
calculateTokenBudget,
|
|
6783
6954
|
clearHistory,
|
|
6955
|
+
createErrorResponse,
|
|
6784
6956
|
createProvider,
|
|
6785
6957
|
createStandardCommand,
|
|
6786
6958
|
createStandardProgressCallback,
|
|
6959
|
+
defaultImplementations,
|
|
6787
6960
|
detectTestFramework,
|
|
6788
6961
|
displayStandardConsoleReport,
|
|
6789
6962
|
emitAnnotation,
|
|
@@ -6816,6 +6989,7 @@ function isBuildArtifact(filePath) {
|
|
|
6816
6989
|
generateTable,
|
|
6817
6990
|
generateValueChain,
|
|
6818
6991
|
getElapsedTime,
|
|
6992
|
+
getErrorMessage,
|
|
6819
6993
|
getFileCommitTimestamps,
|
|
6820
6994
|
getFileExtension,
|
|
6821
6995
|
getFilesByPattern,
|
|
@@ -6849,6 +7023,7 @@ function isBuildArtifact(filePath) {
|
|
|
6849
7023
|
getToolEmoji,
|
|
6850
7024
|
getToolWeight,
|
|
6851
7025
|
getWasmPath,
|
|
7026
|
+
globalContainer,
|
|
6852
7027
|
groupIssuesByFile,
|
|
6853
7028
|
handleCLIError,
|
|
6854
7029
|
handleJSONOutput,
|
|
@@ -6886,7 +7061,9 @@ function isBuildArtifact(filePath) {
|
|
|
6886
7061
|
scanFiles,
|
|
6887
7062
|
setupParser,
|
|
6888
7063
|
severityToAnnotationLevel,
|
|
7064
|
+
toErrorMessage,
|
|
6889
7065
|
validateSpokeOutput,
|
|
6890
7066
|
validateWithSchema,
|
|
7067
|
+
withErrorHandling,
|
|
6891
7068
|
wrapInCard
|
|
6892
7069
|
});
|