@aiready/core 0.24.5 → 0.24.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/{chunk-RCZSMGCX.mjs → chunk-2IUCKF4Z.mjs} +1 -1
- package/dist/{chunk-WYOW6O3P.mjs → chunk-3D3I5K5W.mjs} +33 -7
- package/dist/{chunk-GTS642BQ.mjs → chunk-3FAI4YNO.mjs} +1 -1
- package/dist/{chunk-EZ7ECLAZ.mjs → chunk-5IVDH26E.mjs} +21 -16
- package/dist/{chunk-SWZOT67M.mjs → chunk-6T5O7OAY.mjs} +1 -1
- package/dist/{chunk-L6BKANJC.mjs → chunk-DHFOYNMW.mjs} +12 -8
- package/dist/{chunk-QZNY7B2N.mjs → chunk-EHUK4VMH.mjs} +16 -8
- package/dist/{chunk-MTK2IIDZ.mjs → chunk-EJ74KPCV.mjs} +1 -1
- package/dist/{chunk-2ILVUVRK.mjs → chunk-FAESSLG7.mjs} +44 -17
- package/dist/{chunk-UTCRW3N7.mjs → chunk-Q4LOPVH6.mjs} +18 -14
- package/dist/{chunk-WH4ZGRVF.mjs → chunk-QY5YG2AZ.mjs} +12 -9
- package/dist/{chunk-IXPY5J4K.mjs → chunk-X63YJX5G.mjs} +16 -8
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +44 -17
- package/dist/client/index.mjs +1 -1
- package/dist/{csharp-parser-4ZKCSX5B.mjs → csharp-parser-C52DNAKT.mjs} +2 -2
- package/dist/{csharp-parser-5HKICCRR.mjs → csharp-parser-XW7WHE77.mjs} +2 -2
- package/dist/{go-parser-TKXL3DVH.mjs → go-parser-GO4BIRDD.mjs} +2 -2
- package/dist/{go-parser-XOM232XZ.mjs → go-parser-KTG4CGF5.mjs} +2 -2
- package/dist/{index-CkM98qn1.d.mts → index-ChiWzeQs.d.mts} +188 -180
- package/dist/{index-CkM98qn1.d.ts → index-ChiWzeQs.d.ts} +188 -180
- package/dist/{index-EQ2jRSlB.d.mts → index-PI6qMP2H.d.mts} +182 -178
- package/dist/{index-EQ2jRSlB.d.ts → index-PI6qMP2H.d.ts} +182 -178
- package/dist/index.d.mts +50 -15
- package/dist/index.d.ts +50 -15
- package/dist/index.js +255 -109
- package/dist/index.mjs +161 -66
- package/dist/{java-parser-MASGS4WB.mjs → java-parser-EOKMGQ6B.mjs} +2 -2
- package/dist/{java-parser-T5LXD63J.mjs → java-parser-G47O53QP.mjs} +2 -2
- package/dist/{python-parser-FNFK2473.mjs → python-parser-BCI7JVLF.mjs} +1 -1
- package/dist/{typescript-parser-2GGNRNB5.mjs → typescript-parser-4BA4VYAF.mjs} +1 -1
- package/dist/{typescript-parser-3ENJ6C7H.mjs → typescript-parser-WFGH52WB.mjs} +1 -1
- package/package.json +1 -1
- package/dist/chunk-ARUIZO7M.mjs +0 -297
- package/dist/chunk-AZRUQG5T.mjs +0 -537
- package/dist/chunk-CYC5EGEI.mjs +0 -297
- package/dist/chunk-DBOPSRBC.mjs +0 -884
- package/dist/chunk-E55RNGGK.mjs +0 -852
- package/dist/chunk-FNPULWG7.mjs +0 -248
- package/dist/chunk-FZTFKZUQ.mjs +0 -250
- package/dist/chunk-G4Z45SMK.mjs +0 -852
- package/dist/chunk-JJQLYW6Z.mjs +0 -111
- package/dist/chunk-LEITCMH3.mjs +0 -535
- package/dist/chunk-LTAZ7Z62.mjs +0 -855
- package/dist/chunk-LXEO5PG3.mjs +0 -292
- package/dist/chunk-LZHO636W.mjs +0 -501
- package/dist/chunk-MPWWAAHQ.mjs +0 -548
- package/dist/chunk-QDCQETSI.mjs +0 -262
- package/dist/chunk-SM6INS52.mjs +0 -501
- package/dist/chunk-UBCM5Y6R.mjs +0 -275
- package/dist/chunk-UYLH35LA.mjs +0 -884
- package/dist/chunk-WVNVC2PP.mjs +0 -852
- package/dist/chunk-XQSEJ7WN.mjs +0 -547
- package/dist/chunk-YRSSR4KN.mjs +0 -850
- package/dist/client-2xbeKnrg.d.mts +0 -1291
- package/dist/client-2xbeKnrg.d.ts +0 -1291
- package/dist/client-4HLAGzFg.d.mts +0 -1291
- package/dist/client-4HLAGzFg.d.ts +0 -1291
- package/dist/client-B4TQwNa7.d.mts +0 -1290
- package/dist/client-B4TQwNa7.d.ts +0 -1290
- package/dist/client-Bdi4ty0v.d.mts +0 -1294
- package/dist/client-Bdi4ty0v.d.ts +0 -1294
- package/dist/client-BsKpUH3H.d.mts +0 -1339
- package/dist/client-BsKpUH3H.d.ts +0 -1339
- package/dist/client-Bv1zOaWF.d.mts +0 -1291
- package/dist/client-Bv1zOaWF.d.ts +0 -1291
- package/dist/client-Bz9YJMIX.d.mts +0 -1290
- package/dist/client-Bz9YJMIX.d.ts +0 -1290
- package/dist/client-CBpzm34X.d.mts +0 -1291
- package/dist/client-CBpzm34X.d.ts +0 -1291
- package/dist/client-CNu_tCZZ.d.mts +0 -1305
- package/dist/client-CNu_tCZZ.d.ts +0 -1305
- package/dist/client-CmEvxxQu.d.mts +0 -1339
- package/dist/client-CmEvxxQu.d.ts +0 -1339
- package/dist/client-Ctl_0z6F.d.mts +0 -1294
- package/dist/client-Ctl_0z6F.d.ts +0 -1294
- package/dist/client-DGMAxkZc.d.mts +0 -1339
- package/dist/client-DGMAxkZc.d.ts +0 -1339
- package/dist/client-DZq-CqcD.d.mts +0 -1292
- package/dist/client-DZq-CqcD.d.ts +0 -1292
- package/dist/client-DcqGfDTt.d.mts +0 -1284
- package/dist/client-DcqGfDTt.d.ts +0 -1284
- package/dist/client-O8RvSRm0.d.mts +0 -1261
- package/dist/client-O8RvSRm0.d.ts +0 -1261
- package/dist/client.d.mts +0 -2
- package/dist/client.d.ts +0 -2
- package/dist/client.js +0 -922
- package/dist/client.mjs +0 -104
- package/dist/csharp-parser-JCKXIAJW.mjs +0 -9
- package/dist/go-parser-J4KIH4RG.mjs +0 -9
- package/dist/index-Ctl_0z6F.d.mts +0 -1294
- package/dist/index-Ctl_0z6F.d.ts +0 -1294
- package/dist/index-DLHCsiAk.d.mts +0 -1294
- package/dist/index-DLHCsiAk.d.ts +0 -1294
- package/dist/java-parser-3KHXOXRQ.mjs +0 -9
- package/dist/python-parser-7QISP7LK.mjs +0 -8
- package/dist/python-parser-PDCO35VN.mjs +0 -8
- package/dist/python-parser-QAAL56MC.mjs +0 -8
- package/dist/python-parser-R7HLPNZK.mjs +0 -8
- package/dist/python-parser-SJ3LFZFJ.mjs +0 -8
- package/dist/python-parser-UFLCDT6L.mjs +0 -8
- package/dist/typescript-parser-4GI7DPSW.mjs +0 -7
- package/dist/typescript-parser-4H3HUBO4.mjs +0 -7
- package/dist/typescript-parser-K63IVZMF.mjs +0 -7
- package/dist/typescript-parser-ZJKROMQG.mjs +0 -7
package/dist/client/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as AIReadyConfig, o as AIReadyConfigSchema, i as AcceptancePrediction, A as AnalysisResult, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, aN as BaseGraphLink, aO as BaseGraphNode, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, j as ComprehensionDifficulty, w as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, n as ExportInfo, 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, I as Issue, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, L as Language, Y as LanguageConfig, l as LanguageParser, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, M as Metrics, a7 as MetricsSchema, g as ModelContextTier, a8 as ModelTier, a9 as ModelTierSchema, N as NamingConvention, aa as ParseError, m as ParseResult, ab as ParseStatistics, P as ProductivityImpact, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, c as Severity, ak as SeveritySchema, c as SeverityType, al as SourceLocation, am as SourceRange, a as SpokeOutput, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, f as TechnicalValueChain, k as TechnicalValueChainSummary, h as TokenBudget, T as ToolName, ar as ToolNameSchema, d as ToolOptions, as as ToolOutput, b as ToolScoringOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from '../index-
|
|
1
|
+
export { e as AIReadyConfig, o as AIReadyConfigSchema, i as AcceptancePrediction, A as AnalysisResult, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, aN as BaseGraphLink, aO as BaseGraphNode, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, j as ComprehensionDifficulty, w as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, n as ExportInfo, 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, I as Issue, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, L as Language, Y as LanguageConfig, l as LanguageParser, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, M as Metrics, a7 as MetricsSchema, g as ModelContextTier, a8 as ModelTier, a9 as ModelTierSchema, N as NamingConvention, aa as ParseError, m as ParseResult, ab as ParseStatistics, P as ProductivityImpact, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, c as Severity, ak as SeveritySchema, c as SeverityType, al as SourceLocation, am as SourceRange, a as SpokeOutput, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, f as TechnicalValueChain, k as TechnicalValueChainSummary, h as TokenBudget, T as ToolName, ar as ToolNameSchema, d as ToolOptions, as as ToolOutput, b as ToolScoringOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from '../index-ChiWzeQs.mjs';
|
|
2
2
|
import 'zod';
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { e as AIReadyConfig, o as AIReadyConfigSchema, i as AcceptancePrediction, A as AnalysisResult, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, aN as BaseGraphLink, aO as BaseGraphNode, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, j as ComprehensionDifficulty, w as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, n as ExportInfo, 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, I as Issue, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, L as Language, Y as LanguageConfig, l as LanguageParser, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, M as Metrics, a7 as MetricsSchema, g as ModelContextTier, a8 as ModelTier, a9 as ModelTierSchema, N as NamingConvention, aa as ParseError, m as ParseResult, ab as ParseStatistics, P as ProductivityImpact, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, c as Severity, ak as SeveritySchema, c as SeverityType, al as SourceLocation, am as SourceRange, a as SpokeOutput, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, f as TechnicalValueChain, k as TechnicalValueChainSummary, h as TokenBudget, T as ToolName, ar as ToolNameSchema, d as ToolOptions, as as ToolOutput, b as ToolScoringOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from '../index-
|
|
1
|
+
export { e as AIReadyConfig, o as AIReadyConfigSchema, i as AcceptancePrediction, A as AnalysisResult, q as AnalysisResultSchema, r as AnalysisStatus, s as AnalysisStatusSchema, aN as BaseGraphLink, aO as BaseGraphNode, B as BusinessMetrics, t as COMMON_FINE_TUNING_OPTIONS, u as CONTEXT_TIER_THRESHOLDS, v as CommonASTNode, j as ComprehensionDifficulty, w as Config, C as CostConfig, D as DEFAULT_TOOL_WEIGHTS, n as ExportInfo, 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, I as Issue, R as IssueOverlay, U as IssueSchema, V as IssueType, W as IssueTypeSchema, X as LANGUAGE_EXTENSIONS, L as Language, Y as LanguageConfig, l as LanguageParser, Z as Lead, _ as LeadSchema, $ as LeadSource, a0 as LeadSourceSchema, a1 as LeadSubmission, a2 as LeadSubmissionSchema, a3 as Location, a4 as LocationSchema, M as Metrics, a7 as MetricsSchema, g as ModelContextTier, a8 as ModelTier, a9 as ModelTierSchema, N as NamingConvention, aa as ParseError, m as ParseResult, ab as ParseStatistics, P as ProductivityImpact, ad as RecommendationPriority, ae as SCORING_PROFILES, af as SIZE_ADJUSTED_THRESHOLDS, S as ScanOptions, ag as ScanResult, ah as ScoringConfig, ai as ScoringProfile, aj as ScoringResult, c as Severity, ak as SeveritySchema, c as SeverityType, al as SourceLocation, am as SourceRange, a as SpokeOutput, an as SpokeOutputSchema, ao as SpokeSummary, ap as SpokeSummarySchema, aq as TOOL_NAME_MAP, f as TechnicalValueChain, k as TechnicalValueChainSummary, h as TokenBudget, T as ToolName, ar as ToolNameSchema, d as ToolOptions, as as ToolOutput, b as ToolScoringOutput, at as UnifiedReport, au as UnifiedReportSchema, av as calculateOverallScore, aw as formatScore, ax as formatToolScore, ay as generateHTML, aA as getProjectSizeTier, aB as getRating, aC as getRatingDisplay, aG as getRatingSlug, aH as getRatingWithContext, aI as getRecommendedThreshold, aK as getToolWeight, aL as normalizeToolName, aM as parseWeightString } from '../index-ChiWzeQs.js';
|
|
2
2
|
import 'zod';
|
package/dist/client/index.js
CHANGED
|
@@ -469,6 +469,31 @@ var RecommendationPriority = /* @__PURE__ */ ((RecommendationPriority2) => {
|
|
|
469
469
|
})(RecommendationPriority || {});
|
|
470
470
|
|
|
471
471
|
// src/scoring.ts
|
|
472
|
+
var SCORING_CONSTANTS = {
|
|
473
|
+
WEIGHTS: {
|
|
474
|
+
DEFAULT: 5,
|
|
475
|
+
MAX: 100
|
|
476
|
+
},
|
|
477
|
+
THRESHOLDS: {
|
|
478
|
+
XS: 80,
|
|
479
|
+
SMALL: 75,
|
|
480
|
+
MEDIUM: 70,
|
|
481
|
+
LARGE: 65,
|
|
482
|
+
ENTERPRISE: 58,
|
|
483
|
+
NORMALIZATION_OFFSET: 70
|
|
484
|
+
},
|
|
485
|
+
FILE_COUNTS: {
|
|
486
|
+
XS: 50,
|
|
487
|
+
SMALL: 200,
|
|
488
|
+
MEDIUM: 500,
|
|
489
|
+
LARGE: 2e3
|
|
490
|
+
},
|
|
491
|
+
DELIMITERS: {
|
|
492
|
+
LIST: ",",
|
|
493
|
+
PAIR: ":",
|
|
494
|
+
FORMULA_JOIN: " + "
|
|
495
|
+
}
|
|
496
|
+
};
|
|
472
497
|
var DEFAULT_TOOL_WEIGHTS = {
|
|
473
498
|
["pattern-detect" /* PatternDetect */]: 22,
|
|
474
499
|
["context-analyzer" /* ContextAnalyzer */]: 19,
|
|
@@ -556,22 +581,22 @@ var CONTEXT_TIER_THRESHOLDS = {
|
|
|
556
581
|
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 }
|
|
557
582
|
};
|
|
558
583
|
var SIZE_ADJUSTED_THRESHOLDS = {
|
|
559
|
-
xs:
|
|
584
|
+
xs: SCORING_CONSTANTS.THRESHOLDS.XS,
|
|
560
585
|
// < 50 files
|
|
561
|
-
small:
|
|
586
|
+
small: SCORING_CONSTANTS.THRESHOLDS.SMALL,
|
|
562
587
|
// 50-200 files
|
|
563
|
-
medium:
|
|
588
|
+
medium: SCORING_CONSTANTS.THRESHOLDS.MEDIUM,
|
|
564
589
|
// 200-500 files
|
|
565
|
-
large:
|
|
590
|
+
large: SCORING_CONSTANTS.THRESHOLDS.LARGE,
|
|
566
591
|
// 500-2000 files
|
|
567
|
-
enterprise:
|
|
592
|
+
enterprise: SCORING_CONSTANTS.THRESHOLDS.ENTERPRISE
|
|
568
593
|
// 2000+ files
|
|
569
594
|
};
|
|
570
595
|
function getProjectSizeTier(fileCount) {
|
|
571
|
-
if (fileCount <
|
|
572
|
-
if (fileCount <
|
|
573
|
-
if (fileCount <
|
|
574
|
-
if (fileCount <
|
|
596
|
+
if (fileCount < SCORING_CONSTANTS.FILE_COUNTS.XS) return "xs";
|
|
597
|
+
if (fileCount < SCORING_CONSTANTS.FILE_COUNTS.SMALL) return "small";
|
|
598
|
+
if (fileCount < SCORING_CONSTANTS.FILE_COUNTS.MEDIUM) return "medium";
|
|
599
|
+
if (fileCount < SCORING_CONSTANTS.FILE_COUNTS.LARGE) return "large";
|
|
575
600
|
return "enterprise";
|
|
576
601
|
}
|
|
577
602
|
function getRecommendedThreshold(fileCount, modelTier = "standard") {
|
|
@@ -587,14 +612,16 @@ function getToolWeight(toolName, toolConfig, cliOverride, profile = "default" /*
|
|
|
587
612
|
if (cliOverride !== void 0) return cliOverride;
|
|
588
613
|
if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
|
|
589
614
|
const profileWeights = SCORING_PROFILES[profile] ?? DEFAULT_TOOL_WEIGHTS;
|
|
590
|
-
return profileWeights[toolName] ?? DEFAULT_TOOL_WEIGHTS[toolName] ??
|
|
615
|
+
return profileWeights[toolName] ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? SCORING_CONSTANTS.WEIGHTS.DEFAULT;
|
|
591
616
|
}
|
|
592
617
|
function parseWeightString(weightStr) {
|
|
593
618
|
const weights = /* @__PURE__ */ new Map();
|
|
594
619
|
if (!weightStr) return weights;
|
|
595
|
-
const pairs = weightStr.split(
|
|
620
|
+
const pairs = weightStr.split(SCORING_CONSTANTS.DELIMITERS.LIST);
|
|
596
621
|
for (const pair of pairs) {
|
|
597
|
-
const [toolShortName, weightValueStr] = pair.split(
|
|
622
|
+
const [toolShortName, weightValueStr] = pair.split(
|
|
623
|
+
SCORING_CONSTANTS.DELIMITERS.PAIR
|
|
624
|
+
);
|
|
598
625
|
if (toolShortName && weightValueStr) {
|
|
599
626
|
const toolName = normalizeToolName(toolShortName.trim());
|
|
600
627
|
const weight = parseInt(weightValueStr.trim(), 10);
|
|
@@ -609,7 +636,7 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
609
636
|
if (toolOutputs.size === 0) {
|
|
610
637
|
throw new Error("No tool outputs provided for scoring");
|
|
611
638
|
}
|
|
612
|
-
const profile = config?.
|
|
639
|
+
const profile = config?.profile || "default" /* Default */;
|
|
613
640
|
const weights = /* @__PURE__ */ new Map();
|
|
614
641
|
for (const [toolName] of toolOutputs.entries()) {
|
|
615
642
|
const cliWeight = cliWeights?.get(toolName);
|
|
@@ -623,7 +650,7 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
623
650
|
const toolsUsed = [];
|
|
624
651
|
const calculationWeights = {};
|
|
625
652
|
for (const [toolName, output] of toolOutputs.entries()) {
|
|
626
|
-
const weight = weights.get(toolName) ??
|
|
653
|
+
const weight = weights.get(toolName) ?? SCORING_CONSTANTS.WEIGHTS.DEFAULT;
|
|
627
654
|
weightedSum += output.score * weight;
|
|
628
655
|
totalWeight += weight;
|
|
629
656
|
toolsUsed.push(toolName);
|
|
@@ -634,11 +661,11 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
634
661
|
const rating = getRating(overall);
|
|
635
662
|
const formulaParts = Array.from(toolOutputs.entries()).map(
|
|
636
663
|
([name, output]) => {
|
|
637
|
-
const weight = weights.get(name) ??
|
|
664
|
+
const weight = weights.get(name) ?? SCORING_CONSTANTS.WEIGHTS.DEFAULT;
|
|
638
665
|
return `(${output.score} \xD7 ${weight})`;
|
|
639
666
|
}
|
|
640
667
|
);
|
|
641
|
-
const formulaStr = `[${formulaParts.join(
|
|
668
|
+
const formulaStr = `[${formulaParts.join(SCORING_CONSTANTS.DELIMITERS.FORMULA_JOIN)}] / ${totalWeight} = ${overall}`;
|
|
642
669
|
return {
|
|
643
670
|
overall,
|
|
644
671
|
rating,
|
|
@@ -654,7 +681,7 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
654
681
|
}
|
|
655
682
|
function getRatingWithContext(score, fileCount, modelTier = "standard") {
|
|
656
683
|
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
657
|
-
const normalized = score - threshold +
|
|
684
|
+
const normalized = score - threshold + SCORING_CONSTANTS.THRESHOLDS.NORMALIZATION_OFFSET;
|
|
658
685
|
return getRating(normalized);
|
|
659
686
|
}
|
|
660
687
|
function getRatingDisplay(rating) {
|
package/dist/client/index.mjs
CHANGED
|
@@ -1,8 +1,182 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* AST
|
|
4
|
+
* Language-agnostic AST and parser interfaces for multi-language support
|
|
5
|
+
*
|
|
6
|
+
* This module provides abstractions for parsing different programming languages
|
|
7
|
+
* while maintaining a consistent interface for analysis tools.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Supported programming languages
|
|
12
|
+
*/
|
|
13
|
+
declare enum Language {
|
|
14
|
+
TypeScript = "typescript",
|
|
15
|
+
JavaScript = "javascript",
|
|
16
|
+
Python = "python",
|
|
17
|
+
Java = "java",
|
|
18
|
+
Go = "go",
|
|
19
|
+
Rust = "rust",
|
|
20
|
+
CSharp = "csharp"
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* File extensions mapped to languages
|
|
24
|
+
*/
|
|
25
|
+
declare const LANGUAGE_EXTENSIONS: Record<string, Language>;
|
|
26
|
+
/**
|
|
27
|
+
* Common AST node type (language-agnostic)
|
|
28
|
+
*/
|
|
29
|
+
interface CommonASTNode {
|
|
30
|
+
type: string;
|
|
31
|
+
loc?: SourceRange;
|
|
32
|
+
raw?: any;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Export information (function, class, variable, etc.)
|
|
36
|
+
*/
|
|
37
|
+
interface ExportInfo {
|
|
38
|
+
name: string;
|
|
39
|
+
type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default' | 'variable' | 'all';
|
|
40
|
+
loc?: SourceRange;
|
|
41
|
+
/** Imports used within this export */
|
|
42
|
+
imports?: string[];
|
|
43
|
+
/** Dependencies on other exports in same file */
|
|
44
|
+
dependencies?: string[];
|
|
45
|
+
/** TypeScript types referenced */
|
|
46
|
+
typeReferences?: string[];
|
|
47
|
+
/** For methods: parent class name */
|
|
48
|
+
parentClass?: string;
|
|
49
|
+
/** For functions/methods: parameters */
|
|
50
|
+
parameters?: string[];
|
|
51
|
+
/** For classes/interfaces: number of methods and properties */
|
|
52
|
+
methodCount?: number;
|
|
53
|
+
propertyCount?: number;
|
|
54
|
+
/** Visibility (public, private, protected) */
|
|
55
|
+
visibility?: 'public' | 'private' | 'protected';
|
|
56
|
+
/** Whether the value is a primitive (string, number, boolean) */
|
|
57
|
+
isPrimitive?: boolean;
|
|
58
|
+
/** Behavioral metadata for advanced metrics */
|
|
59
|
+
isPure?: boolean;
|
|
60
|
+
hasSideEffects?: boolean;
|
|
61
|
+
/** Whether the export has explicit type annotations (TS only) */
|
|
62
|
+
isTyped?: boolean;
|
|
63
|
+
/** Inferred domain/area this export belongs to (e.g., "auth", "database") */
|
|
64
|
+
inferredDomain?: string;
|
|
65
|
+
/** Associated documentation */
|
|
66
|
+
documentation?: {
|
|
67
|
+
content: string;
|
|
68
|
+
type: 'jsdoc' | 'docstring' | 'comment' | 'xml-doc';
|
|
69
|
+
loc?: SourceRange;
|
|
70
|
+
isStale?: boolean;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Parse result containing exports and imports
|
|
5
75
|
*/
|
|
76
|
+
interface ParseResult {
|
|
77
|
+
exports: ExportInfo[];
|
|
78
|
+
imports: FileImport[];
|
|
79
|
+
/** Language of the parsed file */
|
|
80
|
+
language: Language;
|
|
81
|
+
/** Any parse warnings (non-fatal) */
|
|
82
|
+
warnings?: string[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Naming convention rules per language
|
|
86
|
+
*/
|
|
87
|
+
interface NamingConvention {
|
|
88
|
+
/** Allowed variable naming patterns */
|
|
89
|
+
variablePattern: RegExp;
|
|
90
|
+
/** Allowed function naming patterns */
|
|
91
|
+
functionPattern: RegExp;
|
|
92
|
+
/** Allowed class naming patterns */
|
|
93
|
+
classPattern: RegExp;
|
|
94
|
+
/** Allowed constant naming patterns */
|
|
95
|
+
constantPattern: RegExp;
|
|
96
|
+
/** Allowed type naming patterns */
|
|
97
|
+
typePattern?: RegExp;
|
|
98
|
+
/** Allowed interface naming patterns */
|
|
99
|
+
interfacePattern?: RegExp;
|
|
100
|
+
/** Language-specific exceptions (e.g., __init__ in Python) */
|
|
101
|
+
exceptions?: string[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Language-specific configuration
|
|
105
|
+
*/
|
|
106
|
+
interface LanguageConfig {
|
|
107
|
+
language: Language;
|
|
108
|
+
/** File extensions for this language */
|
|
109
|
+
extensions: string[];
|
|
110
|
+
/** Naming conventions */
|
|
111
|
+
namingConventions: NamingConvention;
|
|
112
|
+
/** Common abbreviations allowed */
|
|
113
|
+
allowedAbbreviations?: string[];
|
|
114
|
+
/** Language-specific keywords to ignore */
|
|
115
|
+
keywords?: string[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Abstract interface for language parsers
|
|
119
|
+
* Each language implementation should implement this interface
|
|
120
|
+
*/
|
|
121
|
+
interface LanguageParser {
|
|
122
|
+
/** Language this parser handles */
|
|
123
|
+
readonly language: Language;
|
|
124
|
+
/** File extensions this parser supports */
|
|
125
|
+
readonly extensions: string[];
|
|
126
|
+
/**
|
|
127
|
+
* Parse source code and extract structure
|
|
128
|
+
* @param code - Source code to parse
|
|
129
|
+
* @param filePath - Path to the file (for context)
|
|
130
|
+
* @returns Parse result with exports and imports
|
|
131
|
+
* @throws ParseError if code has syntax errors
|
|
132
|
+
*/
|
|
133
|
+
parse(code: string, filePath: string): ParseResult;
|
|
134
|
+
/**
|
|
135
|
+
* Get naming conventions for this language
|
|
136
|
+
*/
|
|
137
|
+
getNamingConventions(): NamingConvention;
|
|
138
|
+
/**
|
|
139
|
+
* Initialize the parser (e.g. load WASM)
|
|
140
|
+
*/
|
|
141
|
+
initialize(): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Check if this parser can handle a file
|
|
144
|
+
* @param filePath - File path to check
|
|
145
|
+
*/
|
|
146
|
+
canHandle(filePath: string): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Get the raw AST for advanced querying
|
|
149
|
+
* @param code - Source code to parse
|
|
150
|
+
* @param filePath - Path to the file
|
|
151
|
+
*/
|
|
152
|
+
getAST(code: string, filePath: string): Promise<any>;
|
|
153
|
+
/**
|
|
154
|
+
* Analyze structural metadata for a node (e.g. purity)
|
|
155
|
+
* @param node - The AST node to analyze (language specific)
|
|
156
|
+
* @param code - The original source code
|
|
157
|
+
*/
|
|
158
|
+
analyzeMetadata(node: any, code: string): Partial<ExportInfo>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Parser error with location information
|
|
162
|
+
*/
|
|
163
|
+
declare class ParseError extends Error {
|
|
164
|
+
readonly filePath: string;
|
|
165
|
+
readonly loc?: SourceLocation | undefined;
|
|
166
|
+
constructor(message: string, filePath: string, loc?: SourceLocation | undefined);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Statistics about parsed code
|
|
170
|
+
*/
|
|
171
|
+
interface ParseStatistics {
|
|
172
|
+
language: Language;
|
|
173
|
+
filesAnalyzed: number;
|
|
174
|
+
totalExports: number;
|
|
175
|
+
totalImports: number;
|
|
176
|
+
parseErrors: number;
|
|
177
|
+
warnings: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
6
180
|
/**
|
|
7
181
|
* Location information in source code
|
|
8
182
|
*/
|
|
@@ -17,9 +191,10 @@ interface SourceRange {
|
|
|
17
191
|
start: SourceLocation;
|
|
18
192
|
end: SourceLocation;
|
|
19
193
|
}
|
|
194
|
+
|
|
20
195
|
interface ExportWithImports {
|
|
21
196
|
name: string;
|
|
22
|
-
type: '
|
|
197
|
+
type: ExportInfo['type'];
|
|
23
198
|
source?: string;
|
|
24
199
|
imports: string[];
|
|
25
200
|
dependencies: string[];
|
|
@@ -89,7 +264,8 @@ declare enum ToolName {
|
|
|
89
264
|
CognitiveLoad = "cognitive-load",
|
|
90
265
|
PatternEntropy = "pattern-entropy",
|
|
91
266
|
ConceptCohesion = "concept-cohesion",
|
|
92
|
-
SemanticDistance = "semantic-distance"
|
|
267
|
+
SemanticDistance = "semantic-distance",
|
|
268
|
+
ContractEnforcement = "contract-enforcement"
|
|
93
269
|
}
|
|
94
270
|
/** Zod schema for ToolName enum */
|
|
95
271
|
declare const ToolNameSchema: z.ZodEnum<typeof ToolName>;
|
|
@@ -118,7 +294,8 @@ declare enum IssueType {
|
|
|
118
294
|
LowTestability = "low-testability",
|
|
119
295
|
AgentNavigationFailure = "agent-navigation-failure",
|
|
120
296
|
AmbiguousApi = "ambiguous-api",
|
|
121
|
-
ChangeAmplification = "change-amplification"
|
|
297
|
+
ChangeAmplification = "change-amplification",
|
|
298
|
+
ContractGap = "contract-gap"
|
|
122
299
|
}
|
|
123
300
|
/** Zod schema for IssueType enum */
|
|
124
301
|
declare const IssueTypeSchema: z.ZodEnum<typeof IssueType>;
|
|
@@ -820,181 +997,6 @@ interface GraphMetadata {
|
|
|
820
997
|
executionTime?: number;
|
|
821
998
|
}
|
|
822
999
|
|
|
823
|
-
/**
|
|
824
|
-
* Language-agnostic AST and parser interfaces for multi-language support
|
|
825
|
-
*
|
|
826
|
-
* This module provides abstractions for parsing different programming languages
|
|
827
|
-
* while maintaining a consistent interface for analysis tools.
|
|
828
|
-
*/
|
|
829
|
-
|
|
830
|
-
/**
|
|
831
|
-
* Supported programming languages
|
|
832
|
-
*/
|
|
833
|
-
declare enum Language {
|
|
834
|
-
TypeScript = "typescript",
|
|
835
|
-
JavaScript = "javascript",
|
|
836
|
-
Python = "python",
|
|
837
|
-
Java = "java",
|
|
838
|
-
Go = "go",
|
|
839
|
-
Rust = "rust",
|
|
840
|
-
CSharp = "csharp"
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
|
-
* File extensions mapped to languages
|
|
844
|
-
*/
|
|
845
|
-
declare const LANGUAGE_EXTENSIONS: Record<string, Language>;
|
|
846
|
-
/**
|
|
847
|
-
* Common AST node type (language-agnostic)
|
|
848
|
-
*/
|
|
849
|
-
interface CommonASTNode {
|
|
850
|
-
type: string;
|
|
851
|
-
loc?: SourceRange;
|
|
852
|
-
raw?: any;
|
|
853
|
-
}
|
|
854
|
-
/**
|
|
855
|
-
* Export information (function, class, variable, etc.)
|
|
856
|
-
*/
|
|
857
|
-
interface ExportInfo {
|
|
858
|
-
name: string;
|
|
859
|
-
type: 'function' | 'class' | 'const' | 'type' | 'interface' | 'default' | 'variable';
|
|
860
|
-
loc?: SourceRange;
|
|
861
|
-
/** Imports used within this export */
|
|
862
|
-
imports?: string[];
|
|
863
|
-
/** Dependencies on other exports in same file */
|
|
864
|
-
dependencies?: string[];
|
|
865
|
-
/** TypeScript types referenced */
|
|
866
|
-
typeReferences?: string[];
|
|
867
|
-
/** For methods: parent class name */
|
|
868
|
-
parentClass?: string;
|
|
869
|
-
/** For functions/methods: parameters */
|
|
870
|
-
parameters?: string[];
|
|
871
|
-
/** For classes/interfaces: number of methods and properties */
|
|
872
|
-
methodCount?: number;
|
|
873
|
-
propertyCount?: number;
|
|
874
|
-
/** Visibility (public, private, protected) */
|
|
875
|
-
visibility?: 'public' | 'private' | 'protected';
|
|
876
|
-
/** Whether the value is a primitive (string, number, boolean) */
|
|
877
|
-
isPrimitive?: boolean;
|
|
878
|
-
/** Behavioral metadata for advanced metrics */
|
|
879
|
-
isPure?: boolean;
|
|
880
|
-
hasSideEffects?: boolean;
|
|
881
|
-
/** Whether the export has explicit type annotations (TS only) */
|
|
882
|
-
isTyped?: boolean;
|
|
883
|
-
/** Associated documentation */
|
|
884
|
-
documentation?: {
|
|
885
|
-
content: string;
|
|
886
|
-
type: 'jsdoc' | 'docstring' | 'comment' | 'xml-doc';
|
|
887
|
-
loc?: SourceRange;
|
|
888
|
-
isStale?: boolean;
|
|
889
|
-
};
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Parse result containing exports and imports
|
|
893
|
-
*/
|
|
894
|
-
interface ParseResult {
|
|
895
|
-
exports: ExportInfo[];
|
|
896
|
-
imports: FileImport[];
|
|
897
|
-
/** Language of the parsed file */
|
|
898
|
-
language: Language;
|
|
899
|
-
/** Any parse warnings (non-fatal) */
|
|
900
|
-
warnings?: string[];
|
|
901
|
-
}
|
|
902
|
-
/**
|
|
903
|
-
* Naming convention rules per language
|
|
904
|
-
*/
|
|
905
|
-
interface NamingConvention {
|
|
906
|
-
/** Allowed variable naming patterns */
|
|
907
|
-
variablePattern: RegExp;
|
|
908
|
-
/** Allowed function naming patterns */
|
|
909
|
-
functionPattern: RegExp;
|
|
910
|
-
/** Allowed class naming patterns */
|
|
911
|
-
classPattern: RegExp;
|
|
912
|
-
/** Allowed constant naming patterns */
|
|
913
|
-
constantPattern: RegExp;
|
|
914
|
-
/** Allowed type naming patterns */
|
|
915
|
-
typePattern?: RegExp;
|
|
916
|
-
/** Allowed interface naming patterns */
|
|
917
|
-
interfacePattern?: RegExp;
|
|
918
|
-
/** Language-specific exceptions (e.g., __init__ in Python) */
|
|
919
|
-
exceptions?: string[];
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* Language-specific configuration
|
|
923
|
-
*/
|
|
924
|
-
interface LanguageConfig {
|
|
925
|
-
language: Language;
|
|
926
|
-
/** File extensions for this language */
|
|
927
|
-
extensions: string[];
|
|
928
|
-
/** Naming conventions */
|
|
929
|
-
namingConventions: NamingConvention;
|
|
930
|
-
/** Common abbreviations allowed */
|
|
931
|
-
allowedAbbreviations?: string[];
|
|
932
|
-
/** Language-specific keywords to ignore */
|
|
933
|
-
keywords?: string[];
|
|
934
|
-
}
|
|
935
|
-
/**
|
|
936
|
-
* Abstract interface for language parsers
|
|
937
|
-
* Each language implementation should implement this interface
|
|
938
|
-
*/
|
|
939
|
-
interface LanguageParser {
|
|
940
|
-
/** Language this parser handles */
|
|
941
|
-
readonly language: Language;
|
|
942
|
-
/** File extensions this parser supports */
|
|
943
|
-
readonly extensions: string[];
|
|
944
|
-
/**
|
|
945
|
-
* Parse source code and extract structure
|
|
946
|
-
* @param code - Source code to parse
|
|
947
|
-
* @param filePath - Path to the file (for context)
|
|
948
|
-
* @returns Parse result with exports and imports
|
|
949
|
-
* @throws ParseError if code has syntax errors
|
|
950
|
-
*/
|
|
951
|
-
parse(code: string, filePath: string): ParseResult;
|
|
952
|
-
/**
|
|
953
|
-
* Get naming conventions for this language
|
|
954
|
-
*/
|
|
955
|
-
getNamingConventions(): NamingConvention;
|
|
956
|
-
/**
|
|
957
|
-
* Initialize the parser (e.g. load WASM)
|
|
958
|
-
*/
|
|
959
|
-
initialize(): Promise<void>;
|
|
960
|
-
/**
|
|
961
|
-
* Check if this parser can handle a file
|
|
962
|
-
* @param filePath - File path to check
|
|
963
|
-
*/
|
|
964
|
-
canHandle(filePath: string): boolean;
|
|
965
|
-
/**
|
|
966
|
-
* Get the raw AST for advanced querying
|
|
967
|
-
* @param code - Source code to parse
|
|
968
|
-
* @param filePath - Path to the file
|
|
969
|
-
*/
|
|
970
|
-
getAST(code: string, filePath: string): Promise<any>;
|
|
971
|
-
/**
|
|
972
|
-
* Analyze structural metadata for a node (e.g. purity)
|
|
973
|
-
* @param node - The AST node to analyze (language specific)
|
|
974
|
-
* @param code - The original source code
|
|
975
|
-
*/
|
|
976
|
-
analyzeMetadata(node: any, code: string): Partial<ExportInfo>;
|
|
977
|
-
}
|
|
978
|
-
/**
|
|
979
|
-
* Parser error with location information
|
|
980
|
-
*/
|
|
981
|
-
declare class ParseError extends Error {
|
|
982
|
-
readonly filePath: string;
|
|
983
|
-
readonly loc?: SourceLocation | undefined;
|
|
984
|
-
constructor(message: string, filePath: string, loc?: SourceLocation | undefined);
|
|
985
|
-
}
|
|
986
|
-
/**
|
|
987
|
-
* Statistics about parsed code
|
|
988
|
-
*/
|
|
989
|
-
interface ParseStatistics {
|
|
990
|
-
language: Language;
|
|
991
|
-
filesAnalyzed: number;
|
|
992
|
-
totalExports: number;
|
|
993
|
-
totalImports: number;
|
|
994
|
-
parseErrors: number;
|
|
995
|
-
warnings: number;
|
|
996
|
-
}
|
|
997
|
-
|
|
998
1000
|
/**
|
|
999
1001
|
* Shared rating helper functions for scoring and display.
|
|
1000
1002
|
* Extracted to eliminate duplication between scoring.ts and CLI output modules.
|
|
@@ -1140,6 +1142,12 @@ interface ScoringConfig {
|
|
|
1140
1142
|
compareBaseline?: string;
|
|
1141
1143
|
/** Target file path to persist the calculated score */
|
|
1142
1144
|
saveTo?: string;
|
|
1145
|
+
/** Scoring profile to use for weighting */
|
|
1146
|
+
profile?: string;
|
|
1147
|
+
/** Tool-specific configurations (e.g., weights) */
|
|
1148
|
+
tools?: Record<string, {
|
|
1149
|
+
scoreWeight?: number;
|
|
1150
|
+
}>;
|
|
1143
1151
|
}
|
|
1144
1152
|
|
|
1145
1153
|
/**
|
|
@@ -1244,7 +1252,7 @@ declare function parseWeightString(weightStr?: string): Map<string, number>;
|
|
|
1244
1252
|
* @param cliWeights Optional weight overrides from the CLI
|
|
1245
1253
|
* @returns Consolidate ScoringResult including overall score and rating
|
|
1246
1254
|
*/
|
|
1247
|
-
declare function calculateOverallScore(toolOutputs: Map<string, ToolScoringOutput>, config?:
|
|
1255
|
+
declare function calculateOverallScore(toolOutputs: Map<string, ToolScoringOutput>, config?: ScoringConfig, cliWeights?: Map<string, number>): ScoringResult;
|
|
1248
1256
|
/**
|
|
1249
1257
|
* Convert score to rating with project-size and model awareness.
|
|
1250
1258
|
*
|