@aiready/core 0.23.5 → 0.23.6
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/{client-BF9NjhE8.d.mts → client-CKcjnPXt.d.mts} +1 -0
- package/dist/{client-BF9NjhE8.d.ts → client-CKcjnPXt.d.ts} +1 -0
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +74 -13
- package/dist/index.mjs +74 -13
- package/package.json +1 -1
- package/dist/__tests__/parser-factory.test.d.ts +0 -5
- package/dist/__tests__/parser-factory.test.d.ts.map +0 -1
- package/dist/__tests__/parser-factory.test.js +0 -70
- package/dist/__tests__/parser-factory.test.js.map +0 -1
- package/dist/__tests__/python-parser.test.d.ts +0 -5
- package/dist/__tests__/python-parser.test.d.ts.map +0 -1
- package/dist/__tests__/python-parser.test.js +0 -194
- package/dist/__tests__/python-parser.test.js.map +0 -1
- package/dist/__tests__/scoring.test.d.ts +0 -2
- package/dist/__tests__/scoring.test.d.ts.map +0 -1
- package/dist/__tests__/scoring.test.js +0 -197
- package/dist/__tests__/scoring.test.js.map +0 -1
- package/dist/chunk-3YI4IS3D.mjs +0 -601
- package/dist/chunk-5HIXDC3X.mjs +0 -716
- package/dist/chunk-5V3L53AE.mjs +0 -805
- package/dist/chunk-CKVKHN3G.mjs +0 -660
- package/dist/chunk-COHIBX3Q.mjs +0 -635
- package/dist/chunk-CWRCDSKZ.mjs +0 -417
- package/dist/chunk-D3D3NCRR.mjs +0 -556
- package/dist/chunk-HCFYP7UD.mjs +0 -805
- package/dist/chunk-HFLFBA6F.mjs +0 -417
- package/dist/chunk-HKSARRCD.mjs +0 -365
- package/dist/chunk-JJ5JL5FX.mjs +0 -417
- package/dist/chunk-KDSTXVLQ.mjs +0 -724
- package/dist/chunk-KI7XORTN.mjs +0 -417
- package/dist/chunk-LTMHFNFK.mjs +0 -690
- package/dist/chunk-LTNXTXRI.mjs +0 -659
- package/dist/chunk-M22BXHBR.mjs +0 -805
- package/dist/chunk-MH3A3LX6.mjs +0 -615
- package/dist/chunk-NGHT7JOG.mjs +0 -697
- package/dist/chunk-OQ6IGDXG.mjs +0 -553
- package/dist/chunk-QAFB3HXQ.mjs +0 -590
- package/dist/chunk-QQBKXHLU.mjs +0 -678
- package/dist/chunk-RDHYGES7.mjs +0 -678
- package/dist/chunk-SWTDBVYJ.mjs +0 -660
- package/dist/chunk-UIWL5JQB.mjs +0 -417
- package/dist/chunk-UQGI67WR.mjs +0 -417
- package/dist/chunk-UTZOO4XO.mjs +0 -553
- package/dist/chunk-X4F46I5L.mjs +0 -635
- package/dist/chunk-XKK7YHPX.mjs +0 -619
- package/dist/chunk-YCA4FTEK.mjs +0 -600
- package/dist/chunk-ZSZRRTJM.mjs +0 -719
- package/dist/client-BgmiMoil.d.mts +0 -1344
- package/dist/client-BgmiMoil.d.ts +0 -1344
- package/dist/client-BxGrPuuN.d.mts +0 -1191
- package/dist/client-BxGrPuuN.d.ts +0 -1191
- package/dist/client-D-cn9ydj.d.mts +0 -1136
- package/dist/client-D-cn9ydj.d.ts +0 -1136
- package/dist/client-D9seCH4K.d.mts +0 -1334
- package/dist/client-D9seCH4K.d.ts +0 -1334
- package/dist/client-DIXIh7rw.d.mts +0 -1193
- package/dist/client-DIXIh7rw.d.ts +0 -1193
- package/dist/client-DVHXWOHw.d.mts +0 -1245
- package/dist/client-DVHXWOHw.d.ts +0 -1245
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/parsers/parser-factory.d.ts +0 -69
- package/dist/parsers/parser-factory.d.ts.map +0 -1
- package/dist/parsers/parser-factory.js +0 -116
- package/dist/parsers/parser-factory.js.map +0 -1
- package/dist/parsers/python-parser.d.ts +0 -47
- package/dist/parsers/python-parser.d.ts.map +0 -1
- package/dist/parsers/python-parser.js +0 -243
- package/dist/parsers/python-parser.js.map +0 -1
- package/dist/parsers/typescript-parser.d.ts +0 -22
- package/dist/parsers/typescript-parser.d.ts.map +0 -1
- package/dist/parsers/typescript-parser.js +0 -242
- package/dist/parsers/typescript-parser.js.map +0 -1
- package/dist/scoring.d.ts +0 -120
- package/dist/scoring.d.ts.map +0 -1
- package/dist/scoring.js +0 -197
- package/dist/scoring.js.map +0 -1
- package/dist/types/language.d.ts +0 -172
- package/dist/types/language.d.ts.map +0 -1
- package/dist/types/language.js +0 -45
- package/dist/types/language.js.map +0 -1
- package/dist/types.d.ts +0 -122
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/ast-parser.d.ts +0 -59
- package/dist/utils/ast-parser.d.ts.map +0 -1
- package/dist/utils/ast-parser.js +0 -213
- package/dist/utils/ast-parser.js.map +0 -1
- package/dist/utils/cli-helpers.d.ts +0 -54
- package/dist/utils/cli-helpers.d.ts.map +0 -1
- package/dist/utils/cli-helpers.js +0 -78
- package/dist/utils/cli-helpers.js.map +0 -1
- package/dist/utils/config.d.ts +0 -9
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -80
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/file-scanner.d.ts +0 -16
- package/dist/utils/file-scanner.d.ts.map +0 -1
- package/dist/utils/file-scanner.js +0 -104
- package/dist/utils/file-scanner.js.map +0 -1
- package/dist/utils/metrics.d.ts +0 -6
- package/dist/utils/metrics.d.ts.map +0 -1
- package/dist/utils/metrics.js +0 -8
- package/dist/utils/metrics.js.map +0 -1
package/dist/client.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as AIReadyConfig, g as AcceptancePrediction, A as AnalysisResult, o as AnalysisStatus, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, h as ComprehensionDifficulty, t as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, l as ExportInfo, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, I as ImportInfo, K as Issue, Q as IssueType, U as LANGUAGE_EXTENSIONS, k as Language, V as LanguageConfig, L as LanguageParser, W as Lead, X as LeadSchema, Y as LeadSource, Z as LeadSourceSchema, _ as LeadSubmission, $ as LeadSubmissionSchema, a0 as Location, a4 as Metrics, M as ModelContextTier, N as NamingConvention, a8 as ParseError, m as ParseResult, a9 as ParseStatistics, P as ProductivityImpact, aa as ReadinessRating, ab as RecommendationPriority, ac as SCORING_PROFILES, ad as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ae as ScanResult, af as ScoringConfig, ag as ScoringProfile, ah as ScoringResult, c as Severity, c as SeverityType, aj as SourceLocation, ak as SourceRange, a as SpokeOutput, ao as TOOL_NAME_MAP, j as TechnicalValueChain, i as TechnicalValueChainSummary, f as TokenBudget, T as ToolName, aq as ToolOptions, ar as ToolOutput, b as ToolScoringOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-
|
|
1
|
+
export { e as AIReadyConfig, g as AcceptancePrediction, A as AnalysisResult, o as AnalysisStatus, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, h as ComprehensionDifficulty, t as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, l as ExportInfo, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, I as ImportInfo, K as Issue, Q as IssueType, U as LANGUAGE_EXTENSIONS, k as Language, V as LanguageConfig, L as LanguageParser, W as Lead, X as LeadSchema, Y as LeadSource, Z as LeadSourceSchema, _ as LeadSubmission, $ as LeadSubmissionSchema, a0 as Location, a4 as Metrics, M as ModelContextTier, N as NamingConvention, a8 as ParseError, m as ParseResult, a9 as ParseStatistics, P as ProductivityImpact, aa as ReadinessRating, ab as RecommendationPriority, ac as SCORING_PROFILES, ad as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ae as ScanResult, af as ScoringConfig, ag as ScoringProfile, ah as ScoringResult, c as Severity, c as SeverityType, aj as SourceLocation, ak as SourceRange, a as SpokeOutput, ao as TOOL_NAME_MAP, j as TechnicalValueChain, i as TechnicalValueChainSummary, f as TokenBudget, T as ToolName, aq as ToolOptions, ar as ToolOutput, b as ToolScoringOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-CKcjnPXt.mjs';
|
|
2
2
|
import 'zod';
|
package/dist/client.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as AIReadyConfig, g as AcceptancePrediction, A as AnalysisResult, o as AnalysisStatus, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, h as ComprehensionDifficulty, t as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, l as ExportInfo, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, I as ImportInfo, K as Issue, Q as IssueType, U as LANGUAGE_EXTENSIONS, k as Language, V as LanguageConfig, L as LanguageParser, W as Lead, X as LeadSchema, Y as LeadSource, Z as LeadSourceSchema, _ as LeadSubmission, $ as LeadSubmissionSchema, a0 as Location, a4 as Metrics, M as ModelContextTier, N as NamingConvention, a8 as ParseError, m as ParseResult, a9 as ParseStatistics, P as ProductivityImpact, aa as ReadinessRating, ab as RecommendationPriority, ac as SCORING_PROFILES, ad as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ae as ScanResult, af as ScoringConfig, ag as ScoringProfile, ah as ScoringResult, c as Severity, c as SeverityType, aj as SourceLocation, ak as SourceRange, a as SpokeOutput, ao as TOOL_NAME_MAP, j as TechnicalValueChain, i as TechnicalValueChainSummary, f as TokenBudget, T as ToolName, aq as ToolOptions, ar as ToolOutput, b as ToolScoringOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-
|
|
1
|
+
export { e as AIReadyConfig, g as AcceptancePrediction, A as AnalysisResult, o as AnalysisStatus, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, h as ComprehensionDifficulty, t as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, l as ExportInfo, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, I as ImportInfo, K as Issue, Q as IssueType, U as LANGUAGE_EXTENSIONS, k as Language, V as LanguageConfig, L as LanguageParser, W as Lead, X as LeadSchema, Y as LeadSource, Z as LeadSourceSchema, _ as LeadSubmission, $ as LeadSubmissionSchema, a0 as Location, a4 as Metrics, M as ModelContextTier, N as NamingConvention, a8 as ParseError, m as ParseResult, a9 as ParseStatistics, P as ProductivityImpact, aa as ReadinessRating, ab as RecommendationPriority, ac as SCORING_PROFILES, ad as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ae as ScanResult, af as ScoringConfig, ag as ScoringProfile, ah as ScoringResult, c as Severity, c as SeverityType, aj as SourceLocation, ak as SourceRange, a as SpokeOutput, ao as TOOL_NAME_MAP, j as TechnicalValueChain, i as TechnicalValueChainSummary, f as TokenBudget, T as ToolName, aq as ToolOptions, ar as ToolOutput, b as ToolScoringOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-CKcjnPXt.js';
|
|
2
2
|
import 'zod';
|
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, A as AnalysisResult, E as ExportWithImports, d as ASTNode, F as FileImport, e as AIReadyConfig, M as ModelContextTier, C as CostConfig, f as TokenBudget, P as ProductivityImpact, g as AcceptancePrediction, h as ComprehensionDifficulty, i as TechnicalValueChainSummary, j as TechnicalValueChain, L as LanguageParser, k as Language, l as ExportInfo, m as ParseResult, N as NamingConvention, I as ImportInfo } from './client-
|
|
2
|
-
export { n as AnalysisResultSchema, o as AnalysisStatus, p as AnalysisStatusSchema, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, t as Config, D as DEFAULT_TOOL_WEIGHTS, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, K as Issue, O as IssueSchema, Q as IssueType, R as IssueTypeSchema, U as LANGUAGE_EXTENSIONS, V as LanguageConfig, W as Lead, X as LeadSchema, Y as LeadSource, Z as LeadSourceSchema, _ as LeadSubmission, $ as LeadSubmissionSchema, a0 as Location, a1 as LocationSchema, a2 as ManagedAccount, a3 as ManagedAccountSchema, a4 as Metrics, a5 as MetricsSchema, a6 as ModelTier, a7 as ModelTierSchema, a8 as ParseError, a9 as ParseStatistics, aa as ReadinessRating, ab as RecommendationPriority, ac as SCORING_PROFILES, ad as SIZE_ADJUSTED_THRESHOLDS, ae as ScanResult, af as ScoringConfig, ag as ScoringProfile, ah as ScoringResult, ai as SeveritySchema, aj as SourceLocation, ak as SourceRange, al as SpokeOutputSchema, am as SpokeSummary, an as SpokeSummarySchema, ao as TOOL_NAME_MAP, ap as ToolNameSchema, aq as ToolOptions, ar as ToolOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-
|
|
1
|
+
import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as Severity, A as AnalysisResult, E as ExportWithImports, d as ASTNode, F as FileImport, e as AIReadyConfig, M as ModelContextTier, C as CostConfig, f as TokenBudget, P as ProductivityImpact, g as AcceptancePrediction, h as ComprehensionDifficulty, i as TechnicalValueChainSummary, j as TechnicalValueChain, L as LanguageParser, k as Language, l as ExportInfo, m as ParseResult, N as NamingConvention, I as ImportInfo } from './client-CKcjnPXt.mjs';
|
|
2
|
+
export { n as AnalysisResultSchema, o as AnalysisStatus, p as AnalysisStatusSchema, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, t as Config, D as DEFAULT_TOOL_WEIGHTS, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, K as Issue, O as IssueSchema, Q as IssueType, R as IssueTypeSchema, U as LANGUAGE_EXTENSIONS, V as LanguageConfig, W as Lead, X as LeadSchema, Y as LeadSource, Z as LeadSourceSchema, _ as LeadSubmission, $ as LeadSubmissionSchema, a0 as Location, a1 as LocationSchema, a2 as ManagedAccount, a3 as ManagedAccountSchema, a4 as Metrics, a5 as MetricsSchema, a6 as ModelTier, a7 as ModelTierSchema, a8 as ParseError, a9 as ParseStatistics, aa as ReadinessRating, ab as RecommendationPriority, ac as SCORING_PROFILES, ad as SIZE_ADJUSTED_THRESHOLDS, ae as ScanResult, af as ScoringConfig, ag as ScoringProfile, ah as ScoringResult, ai as SeveritySchema, aj as SourceLocation, ak as SourceRange, al as SpokeOutputSchema, am as SpokeSummary, an as SpokeSummarySchema, ao as TOOL_NAME_MAP, ap as ToolNameSchema, aq as ToolOptions, ar as ToolOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-CKcjnPXt.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as Parser from 'web-tree-sitter';
|
|
5
5
|
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
@@ -1096,14 +1096,22 @@ interface DocDriftRisk {
|
|
|
1096
1096
|
uncommentedExports: number;
|
|
1097
1097
|
outdatedComments: number;
|
|
1098
1098
|
undocumentedComplexity: number;
|
|
1099
|
+
actualDrift: number;
|
|
1099
1100
|
};
|
|
1100
1101
|
recommendations: string[];
|
|
1101
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Calculate the documentation drift risk score based on various metrics.
|
|
1105
|
+
*
|
|
1106
|
+
* @param params - The raw metrics for doc-drift analysis
|
|
1107
|
+
* @returns The calculated risk score and recommendations
|
|
1108
|
+
*/
|
|
1102
1109
|
declare function calculateDocDrift(params: {
|
|
1103
1110
|
uncommentedExports: number;
|
|
1104
1111
|
totalExports: number;
|
|
1105
1112
|
outdatedComments: number;
|
|
1106
1113
|
undocumentedComplexity: number;
|
|
1114
|
+
actualDrift: number;
|
|
1107
1115
|
}): DocDriftRisk;
|
|
1108
1116
|
|
|
1109
1117
|
/**
|
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, A as AnalysisResult, E as ExportWithImports, d as ASTNode, F as FileImport, e as AIReadyConfig, M as ModelContextTier, C as CostConfig, f as TokenBudget, P as ProductivityImpact, g as AcceptancePrediction, h as ComprehensionDifficulty, i as TechnicalValueChainSummary, j as TechnicalValueChain, L as LanguageParser, k as Language, l as ExportInfo, m as ParseResult, N as NamingConvention, I as ImportInfo } from './client-
|
|
2
|
-
export { n as AnalysisResultSchema, o as AnalysisStatus, p as AnalysisStatusSchema, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, t as Config, D as DEFAULT_TOOL_WEIGHTS, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, K as Issue, O as IssueSchema, Q as IssueType, R as IssueTypeSchema, U as LANGUAGE_EXTENSIONS, V as LanguageConfig, W as Lead, X as LeadSchema, Y as LeadSource, Z as LeadSourceSchema, _ as LeadSubmission, $ as LeadSubmissionSchema, a0 as Location, a1 as LocationSchema, a2 as ManagedAccount, a3 as ManagedAccountSchema, a4 as Metrics, a5 as MetricsSchema, a6 as ModelTier, a7 as ModelTierSchema, a8 as ParseError, a9 as ParseStatistics, aa as ReadinessRating, ab as RecommendationPriority, ac as SCORING_PROFILES, ad as SIZE_ADJUSTED_THRESHOLDS, ae as ScanResult, af as ScoringConfig, ag as ScoringProfile, ah as ScoringResult, ai as SeveritySchema, aj as SourceLocation, ak as SourceRange, al as SpokeOutputSchema, am as SpokeSummary, an as SpokeSummarySchema, ao as TOOL_NAME_MAP, ap as ToolNameSchema, aq as ToolOptions, ar as ToolOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-
|
|
1
|
+
import { T as ToolName, S as ScanOptions, a as SpokeOutput, b as ToolScoringOutput, c as Severity, A as AnalysisResult, E as ExportWithImports, d as ASTNode, F as FileImport, e as AIReadyConfig, M as ModelContextTier, C as CostConfig, f as TokenBudget, P as ProductivityImpact, g as AcceptancePrediction, h as ComprehensionDifficulty, i as TechnicalValueChainSummary, j as TechnicalValueChain, L as LanguageParser, k as Language, l as ExportInfo, m as ParseResult, N as NamingConvention, I as ImportInfo } from './client-CKcjnPXt.js';
|
|
2
|
+
export { n as AnalysisResultSchema, o as AnalysisStatus, p as AnalysisStatusSchema, B as BusinessMetrics, q as COMMON_FINE_TUNING_OPTIONS, r as CONTEXT_TIER_THRESHOLDS, s as CommonASTNode, t as Config, D as DEFAULT_TOOL_WEIGHTS, u as FRIENDLY_TOOL_NAMES, v as FileContent, G as GLOBAL_INFRA_OPTIONS, w as GLOBAL_SCAN_OPTIONS, x as GraphData, y as GraphEdge, z as GraphIssueSeverity, H as GraphMetadata, J as GraphNode, K as Issue, O as IssueSchema, Q as IssueType, R as IssueTypeSchema, U as LANGUAGE_EXTENSIONS, V as LanguageConfig, W as Lead, X as LeadSchema, Y as LeadSource, Z as LeadSourceSchema, _ as LeadSubmission, $ as LeadSubmissionSchema, a0 as Location, a1 as LocationSchema, a2 as ManagedAccount, a3 as ManagedAccountSchema, a4 as Metrics, a5 as MetricsSchema, a6 as ModelTier, a7 as ModelTierSchema, a8 as ParseError, a9 as ParseStatistics, aa as ReadinessRating, ab as RecommendationPriority, ac as SCORING_PROFILES, ad as SIZE_ADJUSTED_THRESHOLDS, ae as ScanResult, af as ScoringConfig, ag as ScoringProfile, ah as ScoringResult, ai as SeveritySchema, aj as SourceLocation, ak as SourceRange, al as SpokeOutputSchema, am as SpokeSummary, an as SpokeSummarySchema, ao as TOOL_NAME_MAP, ap as ToolNameSchema, aq as ToolOptions, ar as ToolOutput, as as UnifiedReport, at as UnifiedReportSchema, au as calculateOverallScore, av as formatScore, aw as formatToolScore, ax as generateHTML, ay as getProjectSizeTier, az as getRating, aA as getRatingDisplay, aB as getRatingSlug, aC as getRatingWithContext, aD as getRecommendedThreshold, aE as getToolWeight, aF as normalizeToolName, aG as parseWeightString } from './client-CKcjnPXt.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as Parser from 'web-tree-sitter';
|
|
5
5
|
import { TSESTree } from '@typescript-eslint/typescript-estree';
|
|
@@ -1096,14 +1096,22 @@ interface DocDriftRisk {
|
|
|
1096
1096
|
uncommentedExports: number;
|
|
1097
1097
|
outdatedComments: number;
|
|
1098
1098
|
undocumentedComplexity: number;
|
|
1099
|
+
actualDrift: number;
|
|
1099
1100
|
};
|
|
1100
1101
|
recommendations: string[];
|
|
1101
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Calculate the documentation drift risk score based on various metrics.
|
|
1105
|
+
*
|
|
1106
|
+
* @param params - The raw metrics for doc-drift analysis
|
|
1107
|
+
* @returns The calculated risk score and recommendations
|
|
1108
|
+
*/
|
|
1102
1109
|
declare function calculateDocDrift(params: {
|
|
1103
1110
|
uncommentedExports: number;
|
|
1104
1111
|
totalExports: number;
|
|
1105
1112
|
outdatedComments: number;
|
|
1106
1113
|
undocumentedComplexity: number;
|
|
1114
|
+
actualDrift: number;
|
|
1107
1115
|
}): DocDriftRisk;
|
|
1108
1116
|
|
|
1109
1117
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1125,7 +1125,7 @@ var TypeScriptParser = class {
|
|
|
1125
1125
|
hasSideEffects: false
|
|
1126
1126
|
};
|
|
1127
1127
|
const start = node.range?.[0] ?? 0;
|
|
1128
|
-
const preceding = code.slice(Math.max(0, start -
|
|
1128
|
+
const preceding = code.slice(Math.max(0, start - 1e3), start);
|
|
1129
1129
|
const jsdocMatches = Array.from(
|
|
1130
1130
|
preceding.matchAll(/\/\*\*([\s\S]*?)\*\//g)
|
|
1131
1131
|
);
|
|
@@ -1134,9 +1134,24 @@ var TypeScriptParser = class {
|
|
|
1134
1134
|
const matchEndIndex = (lastMatch.index || 0) + lastMatch[0].length;
|
|
1135
1135
|
const between = preceding.slice(matchEndIndex);
|
|
1136
1136
|
if (/^\s*$/.test(between)) {
|
|
1137
|
+
const precedingStartOffset = Math.max(0, start - 1e3);
|
|
1138
|
+
const absoluteStartOffset = precedingStartOffset + (lastMatch.index || 0);
|
|
1139
|
+
const absoluteEndOffset = precedingStartOffset + matchEndIndex;
|
|
1140
|
+
const codeBeforeStart = code.slice(0, absoluteStartOffset);
|
|
1141
|
+
const startLines = codeBeforeStart.split("\n");
|
|
1142
|
+
const startLine = startLines.length;
|
|
1143
|
+
const startColumn = startLines[startLines.length - 1].length;
|
|
1144
|
+
const codeBeforeEnd = code.slice(0, absoluteEndOffset);
|
|
1145
|
+
const endLines = codeBeforeEnd.split("\n");
|
|
1146
|
+
const endLine = endLines.length;
|
|
1147
|
+
const endColumn = endLines[endLines.length - 1].length;
|
|
1137
1148
|
metadata.documentation = {
|
|
1138
1149
|
content: lastMatch[1].replace(/^\s*\*+/gm, "").trim(),
|
|
1139
|
-
type: "jsdoc"
|
|
1150
|
+
type: "jsdoc",
|
|
1151
|
+
loc: {
|
|
1152
|
+
start: { line: startLine, column: startColumn },
|
|
1153
|
+
end: { line: endLine, column: endColumn }
|
|
1154
|
+
}
|
|
1140
1155
|
};
|
|
1141
1156
|
}
|
|
1142
1157
|
}
|
|
@@ -1445,37 +1460,60 @@ function analyzeNodeMetadata(node, code, options) {
|
|
|
1445
1460
|
let prev = node.previousSibling || null;
|
|
1446
1461
|
while (prev && /comment/i.test(prev.type)) {
|
|
1447
1462
|
const text = prev.text || "";
|
|
1463
|
+
const loc = {
|
|
1464
|
+
start: {
|
|
1465
|
+
line: prev.startPosition.row + 1,
|
|
1466
|
+
column: prev.startPosition.column
|
|
1467
|
+
},
|
|
1468
|
+
end: {
|
|
1469
|
+
line: prev.endPosition.row + 1,
|
|
1470
|
+
column: prev.endPosition.column
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1448
1473
|
if (text.trim().startsWith("/**") || text.trim().startsWith("/*")) {
|
|
1449
1474
|
metadata.documentation = {
|
|
1450
1475
|
content: text.replace(/^[/*]+|[/*]+$/g, "").trim(),
|
|
1451
|
-
type: "comment"
|
|
1476
|
+
type: "comment",
|
|
1477
|
+
loc
|
|
1452
1478
|
};
|
|
1453
1479
|
break;
|
|
1454
1480
|
}
|
|
1455
1481
|
if (text.trim().startsWith("///")) {
|
|
1456
1482
|
metadata.documentation = {
|
|
1457
1483
|
content: text.replace(/^\/\/\//, "").trim(),
|
|
1458
|
-
type: "xml-doc"
|
|
1484
|
+
type: "xml-doc",
|
|
1485
|
+
loc
|
|
1459
1486
|
};
|
|
1460
1487
|
break;
|
|
1461
1488
|
}
|
|
1462
1489
|
if (text.trim().startsWith("//")) {
|
|
1463
1490
|
metadata.documentation = {
|
|
1464
1491
|
content: text.replace(/^\/\//, "").trim(),
|
|
1465
|
-
type: "comment"
|
|
1492
|
+
type: "comment",
|
|
1493
|
+
loc
|
|
1466
1494
|
};
|
|
1467
1495
|
break;
|
|
1468
1496
|
}
|
|
1469
1497
|
prev = prev.previousSibling;
|
|
1470
1498
|
}
|
|
1471
|
-
if (node.type === "function_definition") {
|
|
1499
|
+
if (node.type === "function_definition" || node.type === "class_definition") {
|
|
1472
1500
|
const body2 = node.childForFieldName ? node.childForFieldName("body") : node.children.find((c) => c.type === "block");
|
|
1473
1501
|
if (body2 && body2.children.length > 0) {
|
|
1474
1502
|
const firstStmt = body2.children[0];
|
|
1475
1503
|
if (firstStmt.type === "expression_statement" && firstStmt.firstChild?.type === "string") {
|
|
1476
1504
|
metadata.documentation = {
|
|
1477
1505
|
content: firstStmt.firstChild.text.replace(/['"`]/g, "").trim(),
|
|
1478
|
-
type: "docstring"
|
|
1506
|
+
type: "docstring",
|
|
1507
|
+
loc: {
|
|
1508
|
+
start: {
|
|
1509
|
+
line: firstStmt.startPosition.row + 1,
|
|
1510
|
+
column: firstStmt.startPosition.column
|
|
1511
|
+
},
|
|
1512
|
+
end: {
|
|
1513
|
+
line: firstStmt.endPosition.row + 1,
|
|
1514
|
+
column: firstStmt.endPosition.column
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1479
1517
|
};
|
|
1480
1518
|
}
|
|
1481
1519
|
}
|
|
@@ -4619,14 +4657,32 @@ function calculateDocDrift(params) {
|
|
|
4619
4657
|
uncommentedExports,
|
|
4620
4658
|
totalExports,
|
|
4621
4659
|
outdatedComments,
|
|
4622
|
-
undocumentedComplexity
|
|
4660
|
+
undocumentedComplexity,
|
|
4661
|
+
actualDrift
|
|
4623
4662
|
} = params;
|
|
4624
4663
|
const uncommentedRatio = totalExports > 0 ? uncommentedExports / totalExports : 0;
|
|
4625
|
-
const
|
|
4626
|
-
const
|
|
4627
|
-
const
|
|
4664
|
+
const outdatedRatio = totalExports > 0 ? outdatedComments / totalExports : 0;
|
|
4665
|
+
const complexityRatio = totalExports > 0 ? undocumentedComplexity / totalExports : 0;
|
|
4666
|
+
const driftRatio = totalExports > 0 ? actualDrift / totalExports : 0;
|
|
4667
|
+
const DRIFT_THRESHOLD = 0.2;
|
|
4668
|
+
const OUTDATED_THRESHOLD = 0.4;
|
|
4669
|
+
const COMPLEXITY_THRESHOLD = 0.2;
|
|
4670
|
+
const UNCOMMENTED_THRESHOLD = 0.8;
|
|
4671
|
+
const driftRisk = Math.min(100, driftRatio / DRIFT_THRESHOLD * 100);
|
|
4672
|
+
const outdatedRisk = Math.min(
|
|
4673
|
+
100,
|
|
4674
|
+
outdatedRatio / OUTDATED_THRESHOLD * 100
|
|
4675
|
+
);
|
|
4676
|
+
const complexityRisk = Math.min(
|
|
4677
|
+
100,
|
|
4678
|
+
complexityRatio / COMPLEXITY_THRESHOLD * 100
|
|
4679
|
+
);
|
|
4680
|
+
const uncommentedRisk = Math.min(
|
|
4681
|
+
100,
|
|
4682
|
+
uncommentedRatio / UNCOMMENTED_THRESHOLD * 100
|
|
4683
|
+
);
|
|
4628
4684
|
const risk = Math.round(
|
|
4629
|
-
|
|
4685
|
+
driftRisk * 0.4 + complexityRisk * 0.3 + outdatedRisk * 0.2 + uncommentedRisk * 0.1
|
|
4630
4686
|
);
|
|
4631
4687
|
const finalRisk = Math.min(100, Math.max(0, risk));
|
|
4632
4688
|
const score = totalExports > 0 ? 100 - finalRisk : 100;
|
|
@@ -4638,6 +4694,10 @@ function calculateDocDrift(params) {
|
|
|
4638
4694
|
else if (score >= 40) rating = "high";
|
|
4639
4695
|
else rating = "severe";
|
|
4640
4696
|
const recommendations = [];
|
|
4697
|
+
if (actualDrift > 0)
|
|
4698
|
+
recommendations.push(
|
|
4699
|
+
`Review ${actualDrift} functions where code was changed after documentation was last updated.`
|
|
4700
|
+
);
|
|
4641
4701
|
if (outdatedComments > 0)
|
|
4642
4702
|
recommendations.push(
|
|
4643
4703
|
`Update or remove ${outdatedComments} outdated comments that contradict the code.`
|
|
@@ -4656,7 +4716,8 @@ function calculateDocDrift(params) {
|
|
|
4656
4716
|
dimensions: {
|
|
4657
4717
|
uncommentedExports,
|
|
4658
4718
|
outdatedComments,
|
|
4659
|
-
undocumentedComplexity
|
|
4719
|
+
undocumentedComplexity,
|
|
4720
|
+
actualDrift
|
|
4660
4721
|
},
|
|
4661
4722
|
recommendations
|
|
4662
4723
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -732,7 +732,7 @@ var TypeScriptParser = class {
|
|
|
732
732
|
hasSideEffects: false
|
|
733
733
|
};
|
|
734
734
|
const start = node.range?.[0] ?? 0;
|
|
735
|
-
const preceding = code.slice(Math.max(0, start -
|
|
735
|
+
const preceding = code.slice(Math.max(0, start - 1e3), start);
|
|
736
736
|
const jsdocMatches = Array.from(
|
|
737
737
|
preceding.matchAll(/\/\*\*([\s\S]*?)\*\//g)
|
|
738
738
|
);
|
|
@@ -741,9 +741,24 @@ var TypeScriptParser = class {
|
|
|
741
741
|
const matchEndIndex = (lastMatch.index || 0) + lastMatch[0].length;
|
|
742
742
|
const between = preceding.slice(matchEndIndex);
|
|
743
743
|
if (/^\s*$/.test(between)) {
|
|
744
|
+
const precedingStartOffset = Math.max(0, start - 1e3);
|
|
745
|
+
const absoluteStartOffset = precedingStartOffset + (lastMatch.index || 0);
|
|
746
|
+
const absoluteEndOffset = precedingStartOffset + matchEndIndex;
|
|
747
|
+
const codeBeforeStart = code.slice(0, absoluteStartOffset);
|
|
748
|
+
const startLines = codeBeforeStart.split("\n");
|
|
749
|
+
const startLine = startLines.length;
|
|
750
|
+
const startColumn = startLines[startLines.length - 1].length;
|
|
751
|
+
const codeBeforeEnd = code.slice(0, absoluteEndOffset);
|
|
752
|
+
const endLines = codeBeforeEnd.split("\n");
|
|
753
|
+
const endLine = endLines.length;
|
|
754
|
+
const endColumn = endLines[endLines.length - 1].length;
|
|
744
755
|
metadata.documentation = {
|
|
745
756
|
content: lastMatch[1].replace(/^\s*\*+/gm, "").trim(),
|
|
746
|
-
type: "jsdoc"
|
|
757
|
+
type: "jsdoc",
|
|
758
|
+
loc: {
|
|
759
|
+
start: { line: startLine, column: startColumn },
|
|
760
|
+
end: { line: endLine, column: endColumn }
|
|
761
|
+
}
|
|
747
762
|
};
|
|
748
763
|
}
|
|
749
764
|
}
|
|
@@ -1052,37 +1067,60 @@ function analyzeNodeMetadata(node, code, options) {
|
|
|
1052
1067
|
let prev = node.previousSibling || null;
|
|
1053
1068
|
while (prev && /comment/i.test(prev.type)) {
|
|
1054
1069
|
const text = prev.text || "";
|
|
1070
|
+
const loc = {
|
|
1071
|
+
start: {
|
|
1072
|
+
line: prev.startPosition.row + 1,
|
|
1073
|
+
column: prev.startPosition.column
|
|
1074
|
+
},
|
|
1075
|
+
end: {
|
|
1076
|
+
line: prev.endPosition.row + 1,
|
|
1077
|
+
column: prev.endPosition.column
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1055
1080
|
if (text.trim().startsWith("/**") || text.trim().startsWith("/*")) {
|
|
1056
1081
|
metadata.documentation = {
|
|
1057
1082
|
content: text.replace(/^[/*]+|[/*]+$/g, "").trim(),
|
|
1058
|
-
type: "comment"
|
|
1083
|
+
type: "comment",
|
|
1084
|
+
loc
|
|
1059
1085
|
};
|
|
1060
1086
|
break;
|
|
1061
1087
|
}
|
|
1062
1088
|
if (text.trim().startsWith("///")) {
|
|
1063
1089
|
metadata.documentation = {
|
|
1064
1090
|
content: text.replace(/^\/\/\//, "").trim(),
|
|
1065
|
-
type: "xml-doc"
|
|
1091
|
+
type: "xml-doc",
|
|
1092
|
+
loc
|
|
1066
1093
|
};
|
|
1067
1094
|
break;
|
|
1068
1095
|
}
|
|
1069
1096
|
if (text.trim().startsWith("//")) {
|
|
1070
1097
|
metadata.documentation = {
|
|
1071
1098
|
content: text.replace(/^\/\//, "").trim(),
|
|
1072
|
-
type: "comment"
|
|
1099
|
+
type: "comment",
|
|
1100
|
+
loc
|
|
1073
1101
|
};
|
|
1074
1102
|
break;
|
|
1075
1103
|
}
|
|
1076
1104
|
prev = prev.previousSibling;
|
|
1077
1105
|
}
|
|
1078
|
-
if (node.type === "function_definition") {
|
|
1106
|
+
if (node.type === "function_definition" || node.type === "class_definition") {
|
|
1079
1107
|
const body2 = node.childForFieldName ? node.childForFieldName("body") : node.children.find((c) => c.type === "block");
|
|
1080
1108
|
if (body2 && body2.children.length > 0) {
|
|
1081
1109
|
const firstStmt = body2.children[0];
|
|
1082
1110
|
if (firstStmt.type === "expression_statement" && firstStmt.firstChild?.type === "string") {
|
|
1083
1111
|
metadata.documentation = {
|
|
1084
1112
|
content: firstStmt.firstChild.text.replace(/['"`]/g, "").trim(),
|
|
1085
|
-
type: "docstring"
|
|
1113
|
+
type: "docstring",
|
|
1114
|
+
loc: {
|
|
1115
|
+
start: {
|
|
1116
|
+
line: firstStmt.startPosition.row + 1,
|
|
1117
|
+
column: firstStmt.startPosition.column
|
|
1118
|
+
},
|
|
1119
|
+
end: {
|
|
1120
|
+
line: firstStmt.endPosition.row + 1,
|
|
1121
|
+
column: firstStmt.endPosition.column
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1086
1124
|
};
|
|
1087
1125
|
}
|
|
1088
1126
|
}
|
|
@@ -3794,14 +3832,32 @@ function calculateDocDrift(params) {
|
|
|
3794
3832
|
uncommentedExports,
|
|
3795
3833
|
totalExports,
|
|
3796
3834
|
outdatedComments,
|
|
3797
|
-
undocumentedComplexity
|
|
3835
|
+
undocumentedComplexity,
|
|
3836
|
+
actualDrift
|
|
3798
3837
|
} = params;
|
|
3799
3838
|
const uncommentedRatio = totalExports > 0 ? uncommentedExports / totalExports : 0;
|
|
3800
|
-
const
|
|
3801
|
-
const
|
|
3802
|
-
const
|
|
3839
|
+
const outdatedRatio = totalExports > 0 ? outdatedComments / totalExports : 0;
|
|
3840
|
+
const complexityRatio = totalExports > 0 ? undocumentedComplexity / totalExports : 0;
|
|
3841
|
+
const driftRatio = totalExports > 0 ? actualDrift / totalExports : 0;
|
|
3842
|
+
const DRIFT_THRESHOLD = 0.2;
|
|
3843
|
+
const OUTDATED_THRESHOLD = 0.4;
|
|
3844
|
+
const COMPLEXITY_THRESHOLD = 0.2;
|
|
3845
|
+
const UNCOMMENTED_THRESHOLD = 0.8;
|
|
3846
|
+
const driftRisk = Math.min(100, driftRatio / DRIFT_THRESHOLD * 100);
|
|
3847
|
+
const outdatedRisk = Math.min(
|
|
3848
|
+
100,
|
|
3849
|
+
outdatedRatio / OUTDATED_THRESHOLD * 100
|
|
3850
|
+
);
|
|
3851
|
+
const complexityRisk = Math.min(
|
|
3852
|
+
100,
|
|
3853
|
+
complexityRatio / COMPLEXITY_THRESHOLD * 100
|
|
3854
|
+
);
|
|
3855
|
+
const uncommentedRisk = Math.min(
|
|
3856
|
+
100,
|
|
3857
|
+
uncommentedRatio / UNCOMMENTED_THRESHOLD * 100
|
|
3858
|
+
);
|
|
3803
3859
|
const risk = Math.round(
|
|
3804
|
-
|
|
3860
|
+
driftRisk * 0.4 + complexityRisk * 0.3 + outdatedRisk * 0.2 + uncommentedRisk * 0.1
|
|
3805
3861
|
);
|
|
3806
3862
|
const finalRisk = Math.min(100, Math.max(0, risk));
|
|
3807
3863
|
const score = totalExports > 0 ? 100 - finalRisk : 100;
|
|
@@ -3813,6 +3869,10 @@ function calculateDocDrift(params) {
|
|
|
3813
3869
|
else if (score >= 40) rating = "high";
|
|
3814
3870
|
else rating = "severe";
|
|
3815
3871
|
const recommendations = [];
|
|
3872
|
+
if (actualDrift > 0)
|
|
3873
|
+
recommendations.push(
|
|
3874
|
+
`Review ${actualDrift} functions where code was changed after documentation was last updated.`
|
|
3875
|
+
);
|
|
3816
3876
|
if (outdatedComments > 0)
|
|
3817
3877
|
recommendations.push(
|
|
3818
3878
|
`Update or remove ${outdatedComments} outdated comments that contradict the code.`
|
|
@@ -3831,7 +3891,8 @@ function calculateDocDrift(params) {
|
|
|
3831
3891
|
dimensions: {
|
|
3832
3892
|
uncommentedExports,
|
|
3833
3893
|
outdatedComments,
|
|
3834
|
-
undocumentedComplexity
|
|
3894
|
+
undocumentedComplexity,
|
|
3895
|
+
actualDrift
|
|
3835
3896
|
},
|
|
3836
3897
|
recommendations
|
|
3837
3898
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser-factory.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/parser-factory.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test multi-language parser factory
|
|
3
|
-
*/
|
|
4
|
-
import { describe, it, expect } from 'vitest';
|
|
5
|
-
import {
|
|
6
|
-
ParserFactory,
|
|
7
|
-
Language,
|
|
8
|
-
getParser,
|
|
9
|
-
isFileSupported,
|
|
10
|
-
getSupportedLanguages,
|
|
11
|
-
} from '../parsers/parser-factory';
|
|
12
|
-
describe('ParserFactory', () => {
|
|
13
|
-
it('should return TypeScript parser for .ts files', () => {
|
|
14
|
-
const parser = getParser('test.ts');
|
|
15
|
-
expect(parser).toBeDefined();
|
|
16
|
-
expect(parser?.language).toBe(Language.TypeScript);
|
|
17
|
-
});
|
|
18
|
-
it('should return TypeScript parser for .tsx files', () => {
|
|
19
|
-
const parser = getParser('component.tsx');
|
|
20
|
-
expect(parser).toBeDefined();
|
|
21
|
-
expect(parser?.language).toBe(Language.TypeScript);
|
|
22
|
-
});
|
|
23
|
-
it('should return JavaScript parser for .js files', () => {
|
|
24
|
-
const parser = getParser('script.js');
|
|
25
|
-
expect(parser).toBeDefined();
|
|
26
|
-
expect(parser?.language).toBe(Language.TypeScript); // TS parser handles JS too
|
|
27
|
-
});
|
|
28
|
-
it('should return Python parser for .py files', () => {
|
|
29
|
-
const parser = getParser('script.py');
|
|
30
|
-
expect(parser).toBeDefined();
|
|
31
|
-
expect(parser?.language).toBe(Language.Python);
|
|
32
|
-
});
|
|
33
|
-
it('should return null for unsupported files', () => {
|
|
34
|
-
const parser = getParser('README.md');
|
|
35
|
-
expect(parser).toBeNull();
|
|
36
|
-
});
|
|
37
|
-
it('should correctly identify supported files', () => {
|
|
38
|
-
expect(isFileSupported('test.ts')).toBe(true);
|
|
39
|
-
expect(isFileSupported('test.py')).toBe(true);
|
|
40
|
-
expect(isFileSupported('test.java')).toBe(false); // Not yet implemented
|
|
41
|
-
expect(isFileSupported('README.md')).toBe(false);
|
|
42
|
-
});
|
|
43
|
-
it('should list all supported languages', () => {
|
|
44
|
-
const languages = getSupportedLanguages();
|
|
45
|
-
expect(languages).toContain(Language.TypeScript);
|
|
46
|
-
expect(languages).toContain(Language.Python);
|
|
47
|
-
expect(languages.length).toBeGreaterThanOrEqual(2);
|
|
48
|
-
});
|
|
49
|
-
it('should be case-insensitive for extensions', () => {
|
|
50
|
-
expect(getParser('Test.TS')).toBeDefined();
|
|
51
|
-
expect(getParser('Test.PY')).toBeDefined();
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('Language Detection', () => {
|
|
55
|
-
it('should detect language from file path', () => {
|
|
56
|
-
const factory = ParserFactory.getInstance();
|
|
57
|
-
expect(factory.getLanguageForFile('src/index.ts')).toBe(
|
|
58
|
-
Language.TypeScript
|
|
59
|
-
);
|
|
60
|
-
expect(factory.getLanguageForFile('src/component.tsx')).toBe(
|
|
61
|
-
Language.TypeScript
|
|
62
|
-
);
|
|
63
|
-
expect(factory.getLanguageForFile('src/script.js')).toBe(
|
|
64
|
-
Language.JavaScript
|
|
65
|
-
);
|
|
66
|
-
expect(factory.getLanguageForFile('src/main.py')).toBe(Language.Python);
|
|
67
|
-
expect(factory.getLanguageForFile('README.md')).toBeNull();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
//# sourceMappingURL=parser-factory.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser-factory.test.js","sourceRoot":"","sources":["../../src/__tests__/parser-factory.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,QAAQ,EACR,SAAS,EACT,eAAe,EACf,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAEnC,QAAQ,CAAC,eAAe,EA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