@aiready/core 0.24.16 → 0.24.19
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-3NEZ5M7Y.mjs +892 -0
- package/dist/chunk-GQMKSUA4.mjs +888 -0
- package/dist/chunk-MOM3IXCA.mjs +307 -0
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +6 -2
- 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-slasaNzr.d.mts +1309 -0
- package/dist/index-slasaNzr.d.ts +1309 -0
- package/dist/index.d.mts +159 -3
- package/dist/index.d.ts +159 -3
- package/dist/index.js +204 -6
- package/dist/index.mjs +190 -7
- package/dist/typescript-parser-FOUPHVFI.mjs +7 -0
- package/package.json +4 -2
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 };
|