@aiready/core 0.24.9 → 0.24.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +38 -21
- package/dist/index.d.ts +38 -21
- package/dist/index.js +42 -22
- package/dist/index.mjs +41 -22
- package/package.json +2 -1
- package/dist/chunk-2IUCKF4Z.mjs +0 -250
- package/dist/chunk-2IVEHLHX.mjs +0 -888
- package/dist/chunk-3FAI4YNO.mjs +0 -262
- package/dist/chunk-DHFOYNMW.mjs +0 -134
- package/dist/chunk-FAESSLG7.mjs +0 -887
- package/dist/chunk-Q4LOPVH6.mjs +0 -305
- package/dist/chunk-QWPJ6YNF.mjs +0 -888
- package/dist/chunk-X63YJX5G.mjs +0 -256
- package/dist/csharp-parser-C52DNAKT.mjs +0 -9
- package/dist/go-parser-GO4BIRDD.mjs +0 -9
- package/dist/index-ChiWzeQs.d.mts +0 -1307
- package/dist/index-ChiWzeQs.d.ts +0 -1307
- package/dist/index-DUnnB68N.d.mts +0 -1307
- package/dist/index-DUnnB68N.d.ts +0 -1307
- package/dist/index-McIRPbHO.d.mts +0 -1307
- package/dist/index-McIRPbHO.d.ts +0 -1307
- package/dist/index-PI6qMP2H.d.mts +0 -1305
- package/dist/index-PI6qMP2H.d.ts +0 -1305
- package/dist/java-parser-G47O53QP.mjs +0 -9
- package/dist/typescript-parser-WFGH52WB.mjs +0 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
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-DGbarGnr.mjs';
|
|
2
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-DGbarGnr.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { Command } from 'commander';
|
|
4
5
|
import * as chalk from 'chalk';
|
|
5
6
|
import * as Parser from 'web-tree-sitter';
|
|
6
7
|
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
@@ -487,6 +488,25 @@ interface ProviderFactoryConfig<TReport> {
|
|
|
487
488
|
*/
|
|
488
489
|
declare function createProvider<TReport>(config: ProviderFactoryConfig<TReport>): ToolProvider;
|
|
489
490
|
|
|
491
|
+
/**
|
|
492
|
+
* Calculate Jaccard similarity between two strings.
|
|
493
|
+
* Splitting by non-alphanumeric to be robust across different programming languages and formats.
|
|
494
|
+
*
|
|
495
|
+
* @param a - First string for comparison.
|
|
496
|
+
* @param b - Second string for comparison.
|
|
497
|
+
* @returns Similarity score between 0 and 1.
|
|
498
|
+
*/
|
|
499
|
+
declare function calculateStringSimilarity(a: string, b: string): number;
|
|
500
|
+
/**
|
|
501
|
+
* Calculate heuristic confidence score for a duplicate or pattern detection.
|
|
502
|
+
* Considers similarity, block size, and structural match.
|
|
503
|
+
*
|
|
504
|
+
* @param similarity - Similarity score (0-1).
|
|
505
|
+
* @param tokens - Token count of the code block.
|
|
506
|
+
* @param lines - Line count of the code block.
|
|
507
|
+
* @returns Confidence score between 0 and 1.
|
|
508
|
+
*/
|
|
509
|
+
declare function calculateHeuristicConfidence(similarity: number, tokens: number, lines: number): number;
|
|
490
510
|
/**
|
|
491
511
|
* Calculate import-based similarity between two exports using Jaccard index.
|
|
492
512
|
* Returns a score between 0 and 1 representing the overlap in imported symbols.
|
|
@@ -631,26 +651,12 @@ declare function buildFactorsFromDimensions(dimensions: Record<string, number>,
|
|
|
631
651
|
*/
|
|
632
652
|
declare function buildStandardToolScore(params: StandardScoringParams): ToolScoringOutput;
|
|
633
653
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
* @returns Similarity score between 0 and 1.
|
|
641
|
-
*/
|
|
642
|
-
declare function calculateStringSimilarity(a: string, b: string): number;
|
|
643
|
-
/**
|
|
644
|
-
* Calculate heuristic confidence score for a duplicate or pattern detection.
|
|
645
|
-
* Considers similarity, block size, and structural match.
|
|
646
|
-
*
|
|
647
|
-
* @param similarity - Similarity score (0-1).
|
|
648
|
-
* @param tokens - Token count of the code block.
|
|
649
|
-
* @param lines - Line count of the code block.
|
|
650
|
-
* @returns Confidence score between 0 and 1.
|
|
651
|
-
*/
|
|
652
|
-
declare function calculateHeuristicConfidence(similarity: number, tokens: number, lines: number): number;
|
|
653
|
-
|
|
654
|
+
interface CommandOptions {
|
|
655
|
+
output?: string;
|
|
656
|
+
include?: string[];
|
|
657
|
+
exclude?: string[];
|
|
658
|
+
json?: boolean;
|
|
659
|
+
}
|
|
654
660
|
/**
|
|
655
661
|
* Standard progress callback for AIReady spoke tools.
|
|
656
662
|
* Unified to remove structural duplication across spokes.
|
|
@@ -673,6 +679,17 @@ declare function runStandardCliAction(toolName: string, action: () => Promise<{
|
|
|
673
679
|
score: number;
|
|
674
680
|
issuesCount: number;
|
|
675
681
|
}>): Promise<void>;
|
|
682
|
+
/**
|
|
683
|
+
* Factory to create standardized Commander commands for AIReady spokes.
|
|
684
|
+
* This avoids duplicating the same boilerplate (setup, options, error handling)
|
|
685
|
+
* across 10+ different analysis tools, addressing context fragmentation and duplication.
|
|
686
|
+
*
|
|
687
|
+
* @param name - The name of the command (e.g., 'scan', 'context')
|
|
688
|
+
* @param description - Command description for help text
|
|
689
|
+
* @param runAction - The actual analysis logic to execute
|
|
690
|
+
* @returns A configured Commander Command object
|
|
691
|
+
*/
|
|
692
|
+
declare function createStandardCommand(name: string, description: string, runAction: (options: CommandOptions) => Promise<any>): Command;
|
|
676
693
|
|
|
677
694
|
/**
|
|
678
695
|
* Interface for standard CLI report data
|
|
@@ -1993,4 +2010,4 @@ declare function isIgnorableSourceFile(filePath: string): boolean;
|
|
|
1993
2010
|
*/
|
|
1994
2011
|
declare function isBuildArtifact(filePath: string): boolean;
|
|
1995
2012
|
|
|
1996
|
-
export { AIReadyConfig, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CodeBlock, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, ExportWithImports, FileImport, type FileTestability, type FileWithDomain, GoParser, type HtmlReportSection, Issue, type JSONOutputParams, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, 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, 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, createProvider, createStandardProgressCallback, 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, getFileCommitTimestamps, getFileExtension, getFilesByPattern, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getReportTimestamp, getSafetyIcon, getScoreBar, getScoreColor, getSeverityBadge, getSeverityColor, getSeverityEnum, getSeverityLabel, getSeverityLevel, getSeverityValue, getSupportedLanguages, getTerminalDivider, getWasmPath, 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, validateSpokeOutput, validateWithSchema, wrapInCard };
|
|
2013
|
+
export { AIReadyConfig, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CodeBlock, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, ExportWithImports, FileImport, type FileTestability, type FileWithDomain, GoParser, type HtmlReportSection, Issue, type JSONOutputParams, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, 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, 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, createProvider, createStandardCommand, createStandardProgressCallback, 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, getFileCommitTimestamps, getFileExtension, getFilesByPattern, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getReportTimestamp, getSafetyIcon, getScoreBar, getScoreColor, getSeverityBadge, getSeverityColor, getSeverityEnum, getSeverityLabel, getSeverityLevel, getSeverityValue, getSupportedLanguages, getTerminalDivider, getWasmPath, 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, validateSpokeOutput, validateWithSchema, wrapInCard };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
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-DGbarGnr.js';
|
|
2
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-DGbarGnr.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { Command } from 'commander';
|
|
4
5
|
import * as chalk from 'chalk';
|
|
5
6
|
import * as Parser from 'web-tree-sitter';
|
|
6
7
|
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
@@ -487,6 +488,25 @@ interface ProviderFactoryConfig<TReport> {
|
|
|
487
488
|
*/
|
|
488
489
|
declare function createProvider<TReport>(config: ProviderFactoryConfig<TReport>): ToolProvider;
|
|
489
490
|
|
|
491
|
+
/**
|
|
492
|
+
* Calculate Jaccard similarity between two strings.
|
|
493
|
+
* Splitting by non-alphanumeric to be robust across different programming languages and formats.
|
|
494
|
+
*
|
|
495
|
+
* @param a - First string for comparison.
|
|
496
|
+
* @param b - Second string for comparison.
|
|
497
|
+
* @returns Similarity score between 0 and 1.
|
|
498
|
+
*/
|
|
499
|
+
declare function calculateStringSimilarity(a: string, b: string): number;
|
|
500
|
+
/**
|
|
501
|
+
* Calculate heuristic confidence score for a duplicate or pattern detection.
|
|
502
|
+
* Considers similarity, block size, and structural match.
|
|
503
|
+
*
|
|
504
|
+
* @param similarity - Similarity score (0-1).
|
|
505
|
+
* @param tokens - Token count of the code block.
|
|
506
|
+
* @param lines - Line count of the code block.
|
|
507
|
+
* @returns Confidence score between 0 and 1.
|
|
508
|
+
*/
|
|
509
|
+
declare function calculateHeuristicConfidence(similarity: number, tokens: number, lines: number): number;
|
|
490
510
|
/**
|
|
491
511
|
* Calculate import-based similarity between two exports using Jaccard index.
|
|
492
512
|
* Returns a score between 0 and 1 representing the overlap in imported symbols.
|
|
@@ -631,26 +651,12 @@ declare function buildFactorsFromDimensions(dimensions: Record<string, number>,
|
|
|
631
651
|
*/
|
|
632
652
|
declare function buildStandardToolScore(params: StandardScoringParams): ToolScoringOutput;
|
|
633
653
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
* @returns Similarity score between 0 and 1.
|
|
641
|
-
*/
|
|
642
|
-
declare function calculateStringSimilarity(a: string, b: string): number;
|
|
643
|
-
/**
|
|
644
|
-
* Calculate heuristic confidence score for a duplicate or pattern detection.
|
|
645
|
-
* Considers similarity, block size, and structural match.
|
|
646
|
-
*
|
|
647
|
-
* @param similarity - Similarity score (0-1).
|
|
648
|
-
* @param tokens - Token count of the code block.
|
|
649
|
-
* @param lines - Line count of the code block.
|
|
650
|
-
* @returns Confidence score between 0 and 1.
|
|
651
|
-
*/
|
|
652
|
-
declare function calculateHeuristicConfidence(similarity: number, tokens: number, lines: number): number;
|
|
653
|
-
|
|
654
|
+
interface CommandOptions {
|
|
655
|
+
output?: string;
|
|
656
|
+
include?: string[];
|
|
657
|
+
exclude?: string[];
|
|
658
|
+
json?: boolean;
|
|
659
|
+
}
|
|
654
660
|
/**
|
|
655
661
|
* Standard progress callback for AIReady spoke tools.
|
|
656
662
|
* Unified to remove structural duplication across spokes.
|
|
@@ -673,6 +679,17 @@ declare function runStandardCliAction(toolName: string, action: () => Promise<{
|
|
|
673
679
|
score: number;
|
|
674
680
|
issuesCount: number;
|
|
675
681
|
}>): Promise<void>;
|
|
682
|
+
/**
|
|
683
|
+
* Factory to create standardized Commander commands for AIReady spokes.
|
|
684
|
+
* This avoids duplicating the same boilerplate (setup, options, error handling)
|
|
685
|
+
* across 10+ different analysis tools, addressing context fragmentation and duplication.
|
|
686
|
+
*
|
|
687
|
+
* @param name - The name of the command (e.g., 'scan', 'context')
|
|
688
|
+
* @param description - Command description for help text
|
|
689
|
+
* @param runAction - The actual analysis logic to execute
|
|
690
|
+
* @returns A configured Commander Command object
|
|
691
|
+
*/
|
|
692
|
+
declare function createStandardCommand(name: string, description: string, runAction: (options: CommandOptions) => Promise<any>): Command;
|
|
676
693
|
|
|
677
694
|
/**
|
|
678
695
|
* Interface for standard CLI report data
|
|
@@ -1993,4 +2010,4 @@ declare function isIgnorableSourceFile(filePath: string): boolean;
|
|
|
1993
2010
|
*/
|
|
1994
2011
|
declare function isBuildArtifact(filePath: string): boolean;
|
|
1995
2012
|
|
|
1996
|
-
export { AIReadyConfig, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CodeBlock, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, ExportWithImports, FileImport, type FileTestability, type FileWithDomain, GoParser, type HtmlReportSection, Issue, type JSONOutputParams, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, 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, 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, createProvider, createStandardProgressCallback, 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, getFileCommitTimestamps, getFileExtension, getFilesByPattern, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getReportTimestamp, getSafetyIcon, getScoreBar, getScoreColor, getSeverityBadge, getSeverityColor, getSeverityEnum, getSeverityLabel, getSeverityLevel, getSeverityValue, getSupportedLanguages, getTerminalDivider, getWasmPath, 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, validateSpokeOutput, validateWithSchema, wrapInCard };
|
|
2013
|
+
export { AIReadyConfig, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, AnalysisResult, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CodeBlock, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, ExportWithImports, FileImport, type FileTestability, type FileWithDomain, GoParser, type HtmlReportSection, Issue, type JSONOutputParams, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, 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, 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, createProvider, createStandardCommand, createStandardProgressCallback, 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, getFileCommitTimestamps, getFileExtension, getFilesByPattern, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getReportTimestamp, getSafetyIcon, getScoreBar, getScoreColor, getSeverityBadge, getSeverityColor, getSeverityEnum, getSeverityLabel, getSeverityLevel, getSeverityValue, getSupportedLanguages, getTerminalDivider, getWasmPath, 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, validateSpokeOutput, validateWithSchema, wrapInCard };
|
package/dist/index.js
CHANGED
|
@@ -2105,6 +2105,7 @@ __export(index_exports, {
|
|
|
2105
2105
|
calculateTokenBudget: () => calculateTokenBudget,
|
|
2106
2106
|
clearHistory: () => clearHistory,
|
|
2107
2107
|
createProvider: () => createProvider,
|
|
2108
|
+
createStandardCommand: () => createStandardCommand,
|
|
2108
2109
|
createStandardProgressCallback: () => createStandardProgressCallback,
|
|
2109
2110
|
detectTestFramework: () => detectTestFramework,
|
|
2110
2111
|
displayStandardConsoleReport: () => displayStandardConsoleReport,
|
|
@@ -3317,7 +3318,25 @@ function createProvider(config) {
|
|
|
3317
3318
|
};
|
|
3318
3319
|
}
|
|
3319
3320
|
|
|
3320
|
-
// src/utils/similarity
|
|
3321
|
+
// src/utils/similarity.ts
|
|
3322
|
+
function calculateStringSimilarity(a, b) {
|
|
3323
|
+
if (a === b) return 1;
|
|
3324
|
+
const tokensA = a.split(/[^a-zA-Z0-9]+/).filter((t) => t.length > 0);
|
|
3325
|
+
const tokensB = b.split(/[^a-zA-Z0-9]+/).filter((t) => t.length > 0);
|
|
3326
|
+
if (tokensA.length === 0 || tokensB.length === 0) return 0;
|
|
3327
|
+
const setA = new Set(tokensA);
|
|
3328
|
+
const setB = new Set(tokensB);
|
|
3329
|
+
const intersection = new Set([...setA].filter((x) => setB.has(x)));
|
|
3330
|
+
const union = /* @__PURE__ */ new Set([...setA, ...setB]);
|
|
3331
|
+
return intersection.size / union.size;
|
|
3332
|
+
}
|
|
3333
|
+
function calculateHeuristicConfidence(similarity, tokens, lines) {
|
|
3334
|
+
let confidence = similarity;
|
|
3335
|
+
if (lines > 20) confidence += 0.05;
|
|
3336
|
+
if (tokens > 200) confidence += 0.05;
|
|
3337
|
+
if (lines < 5) confidence -= 0.1;
|
|
3338
|
+
return Math.max(0, Math.min(1, confidence));
|
|
3339
|
+
}
|
|
3321
3340
|
function calculateImportSimilarity(export1, export2) {
|
|
3322
3341
|
if (export1.imports.length === 0 && export2.imports.length === 0) {
|
|
3323
3342
|
return 1;
|
|
@@ -4661,28 +4680,9 @@ function buildStandardToolScore(params) {
|
|
|
4661
4680
|
};
|
|
4662
4681
|
}
|
|
4663
4682
|
|
|
4664
|
-
// src/utils/similarity.ts
|
|
4665
|
-
function calculateStringSimilarity(a, b) {
|
|
4666
|
-
if (a === b) return 1;
|
|
4667
|
-
const tokensA = a.split(/[^a-zA-Z0-9]+/).filter((t) => t.length > 0);
|
|
4668
|
-
const tokensB = b.split(/[^a-zA-Z0-9]+/).filter((t) => t.length > 0);
|
|
4669
|
-
if (tokensA.length === 0 || tokensB.length === 0) return 0;
|
|
4670
|
-
const setA = new Set(tokensA);
|
|
4671
|
-
const setB = new Set(tokensB);
|
|
4672
|
-
const intersection = new Set([...setA].filter((x) => setB.has(x)));
|
|
4673
|
-
const union = /* @__PURE__ */ new Set([...setA, ...setB]);
|
|
4674
|
-
return intersection.size / union.size;
|
|
4675
|
-
}
|
|
4676
|
-
function calculateHeuristicConfidence(similarity, tokens, lines) {
|
|
4677
|
-
let confidence = similarity;
|
|
4678
|
-
if (lines > 20) confidence += 0.05;
|
|
4679
|
-
if (tokens > 200) confidence += 0.05;
|
|
4680
|
-
if (lines < 5) confidence -= 0.1;
|
|
4681
|
-
return Math.max(0, Math.min(1, confidence));
|
|
4682
|
-
}
|
|
4683
|
-
|
|
4684
4683
|
// src/utils/cli-factory.ts
|
|
4685
4684
|
var import_chalk4 = __toESM(require("chalk"));
|
|
4685
|
+
var import_commander = require("commander");
|
|
4686
4686
|
function createStandardProgressCallback(toolName) {
|
|
4687
4687
|
return (processed, total, message) => {
|
|
4688
4688
|
const percent = Math.round(processed / Math.max(1, total) * 100);
|
|
@@ -4715,6 +4715,25 @@ async function runStandardCliAction(toolName, action) {
|
|
|
4715
4715
|
process.exit(1);
|
|
4716
4716
|
}
|
|
4717
4717
|
}
|
|
4718
|
+
function createStandardCommand(name, description, runAction) {
|
|
4719
|
+
const command = new import_commander.Command(name);
|
|
4720
|
+
command.description(description).option("-o, --output <path>", "Output file path").option("-i, --include <patterns...>", "Include specific file patterns").option("-e, --exclude <patterns...>", "Exclude specific file patterns").option("--json", "Output strictly as JSON").action(async (options) => {
|
|
4721
|
+
try {
|
|
4722
|
+
const result = await runAction(options);
|
|
4723
|
+
if (options.json) {
|
|
4724
|
+
console.log(JSON.stringify(result, null, 2));
|
|
4725
|
+
} else {
|
|
4726
|
+
}
|
|
4727
|
+
} catch (error) {
|
|
4728
|
+
console.error(
|
|
4729
|
+
import_chalk4.default.red(`
|
|
4730
|
+
\u274C [${name}] critical error: ${error.message}`)
|
|
4731
|
+
);
|
|
4732
|
+
process.exit(1);
|
|
4733
|
+
}
|
|
4734
|
+
});
|
|
4735
|
+
return command;
|
|
4736
|
+
}
|
|
4718
4737
|
|
|
4719
4738
|
// src/utils/reporting.ts
|
|
4720
4739
|
var import_chalk5 = __toESM(require("chalk"));
|
|
@@ -6078,7 +6097,7 @@ function calculateTestabilityIndex(params) {
|
|
|
6078
6097
|
const dependencyInjectionScore = Math.round(
|
|
6079
6098
|
Math.min(
|
|
6080
6099
|
100,
|
|
6081
|
-
(totalClasses > 0 ? injectionPatterns / totalClasses :
|
|
6100
|
+
(totalClasses > 0 ? injectionPatterns / totalClasses : 1) * 100
|
|
6082
6101
|
)
|
|
6083
6102
|
);
|
|
6084
6103
|
const interfaceFocusScore = Math.max(
|
|
@@ -6748,6 +6767,7 @@ function isBuildArtifact(filePath) {
|
|
|
6748
6767
|
calculateTokenBudget,
|
|
6749
6768
|
clearHistory,
|
|
6750
6769
|
createProvider,
|
|
6770
|
+
createStandardCommand,
|
|
6751
6771
|
createStandardProgressCallback,
|
|
6752
6772
|
detectTestFramework,
|
|
6753
6773
|
displayStandardConsoleReport,
|
package/dist/index.mjs
CHANGED
|
@@ -877,7 +877,25 @@ function createProvider(config) {
|
|
|
877
877
|
};
|
|
878
878
|
}
|
|
879
879
|
|
|
880
|
-
// src/utils/similarity
|
|
880
|
+
// src/utils/similarity.ts
|
|
881
|
+
function calculateStringSimilarity(a, b) {
|
|
882
|
+
if (a === b) return 1;
|
|
883
|
+
const tokensA = a.split(/[^a-zA-Z0-9]+/).filter((t) => t.length > 0);
|
|
884
|
+
const tokensB = b.split(/[^a-zA-Z0-9]+/).filter((t) => t.length > 0);
|
|
885
|
+
if (tokensA.length === 0 || tokensB.length === 0) return 0;
|
|
886
|
+
const setA = new Set(tokensA);
|
|
887
|
+
const setB = new Set(tokensB);
|
|
888
|
+
const intersection = new Set([...setA].filter((x) => setB.has(x)));
|
|
889
|
+
const union = /* @__PURE__ */ new Set([...setA, ...setB]);
|
|
890
|
+
return intersection.size / union.size;
|
|
891
|
+
}
|
|
892
|
+
function calculateHeuristicConfidence(similarity, tokens, lines) {
|
|
893
|
+
let confidence = similarity;
|
|
894
|
+
if (lines > 20) confidence += 0.05;
|
|
895
|
+
if (tokens > 200) confidence += 0.05;
|
|
896
|
+
if (lines < 5) confidence -= 0.1;
|
|
897
|
+
return Math.max(0, Math.min(1, confidence));
|
|
898
|
+
}
|
|
881
899
|
function calculateImportSimilarity(export1, export2) {
|
|
882
900
|
if (export1.imports.length === 0 && export2.imports.length === 0) {
|
|
883
901
|
return 1;
|
|
@@ -1693,28 +1711,9 @@ function buildStandardToolScore(params) {
|
|
|
1693
1711
|
};
|
|
1694
1712
|
}
|
|
1695
1713
|
|
|
1696
|
-
// src/utils/similarity.ts
|
|
1697
|
-
function calculateStringSimilarity(a, b) {
|
|
1698
|
-
if (a === b) return 1;
|
|
1699
|
-
const tokensA = a.split(/[^a-zA-Z0-9]+/).filter((t) => t.length > 0);
|
|
1700
|
-
const tokensB = b.split(/[^a-zA-Z0-9]+/).filter((t) => t.length > 0);
|
|
1701
|
-
if (tokensA.length === 0 || tokensB.length === 0) return 0;
|
|
1702
|
-
const setA = new Set(tokensA);
|
|
1703
|
-
const setB = new Set(tokensB);
|
|
1704
|
-
const intersection = new Set([...setA].filter((x) => setB.has(x)));
|
|
1705
|
-
const union = /* @__PURE__ */ new Set([...setA, ...setB]);
|
|
1706
|
-
return intersection.size / union.size;
|
|
1707
|
-
}
|
|
1708
|
-
function calculateHeuristicConfidence(similarity, tokens, lines) {
|
|
1709
|
-
let confidence = similarity;
|
|
1710
|
-
if (lines > 20) confidence += 0.05;
|
|
1711
|
-
if (tokens > 200) confidence += 0.05;
|
|
1712
|
-
if (lines < 5) confidence -= 0.1;
|
|
1713
|
-
return Math.max(0, Math.min(1, confidence));
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
1714
|
// src/utils/cli-factory.ts
|
|
1717
1715
|
import chalk4 from "chalk";
|
|
1716
|
+
import { Command } from "commander";
|
|
1718
1717
|
function createStandardProgressCallback(toolName) {
|
|
1719
1718
|
return (processed, total, message) => {
|
|
1720
1719
|
const percent = Math.round(processed / Math.max(1, total) * 100);
|
|
@@ -1747,6 +1746,25 @@ async function runStandardCliAction(toolName, action) {
|
|
|
1747
1746
|
process.exit(1);
|
|
1748
1747
|
}
|
|
1749
1748
|
}
|
|
1749
|
+
function createStandardCommand(name, description, runAction) {
|
|
1750
|
+
const command = new Command(name);
|
|
1751
|
+
command.description(description).option("-o, --output <path>", "Output file path").option("-i, --include <patterns...>", "Include specific file patterns").option("-e, --exclude <patterns...>", "Exclude specific file patterns").option("--json", "Output strictly as JSON").action(async (options) => {
|
|
1752
|
+
try {
|
|
1753
|
+
const result = await runAction(options);
|
|
1754
|
+
if (options.json) {
|
|
1755
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1756
|
+
} else {
|
|
1757
|
+
}
|
|
1758
|
+
} catch (error) {
|
|
1759
|
+
console.error(
|
|
1760
|
+
chalk4.red(`
|
|
1761
|
+
\u274C [${name}] critical error: ${error.message}`)
|
|
1762
|
+
);
|
|
1763
|
+
process.exit(1);
|
|
1764
|
+
}
|
|
1765
|
+
});
|
|
1766
|
+
return command;
|
|
1767
|
+
}
|
|
1750
1768
|
|
|
1751
1769
|
// src/utils/reporting.ts
|
|
1752
1770
|
import chalk5 from "chalk";
|
|
@@ -3102,7 +3120,7 @@ function calculateTestabilityIndex(params) {
|
|
|
3102
3120
|
const dependencyInjectionScore = Math.round(
|
|
3103
3121
|
Math.min(
|
|
3104
3122
|
100,
|
|
3105
|
-
(totalClasses > 0 ? injectionPatterns / totalClasses :
|
|
3123
|
+
(totalClasses > 0 ? injectionPatterns / totalClasses : 1) * 100
|
|
3106
3124
|
)
|
|
3107
3125
|
);
|
|
3108
3126
|
const interfaceFocusScore = Math.max(
|
|
@@ -3771,6 +3789,7 @@ export {
|
|
|
3771
3789
|
calculateTokenBudget,
|
|
3772
3790
|
clearHistory,
|
|
3773
3791
|
createProvider,
|
|
3792
|
+
createStandardCommand,
|
|
3774
3793
|
createStandardProgressCallback,
|
|
3775
3794
|
detectTestFramework,
|
|
3776
3795
|
displayStandardConsoleReport,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/core",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.10",
|
|
4
4
|
"description": "Shared utilities for AIReady analysis tools",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@typescript-eslint/typescript-estree": "^8.53.0",
|
|
48
48
|
"@unit-mesh/treesitter-artifacts": "^1.7.7",
|
|
49
49
|
"chalk": "^5.4.1",
|
|
50
|
+
"commander": "^14.0.3",
|
|
50
51
|
"glob": "^13.0.0",
|
|
51
52
|
"ignore": "^7.0.0",
|
|
52
53
|
"tree-sitter-java": "^0.23.5",
|