@aiready/core 0.23.20 → 0.23.22
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-2N7ISIKE.mjs +158 -0
- package/dist/chunk-ARUIZO7M.mjs +297 -0
- package/dist/chunk-CYC5EGEI.mjs +297 -0
- package/dist/{chunk-REU6OUBT.mjs → chunk-DBOPSRBC.mjs} +47 -22
- package/dist/chunk-E55RNGGK.mjs +852 -0
- package/dist/chunk-EZ7ECLAZ.mjs +299 -0
- package/dist/chunk-FNPULWG7.mjs +248 -0
- package/dist/chunk-FZTFKZUQ.mjs +250 -0
- package/dist/chunk-GTS642BQ.mjs +262 -0
- package/dist/chunk-IXPY5J4K.mjs +248 -0
- package/dist/chunk-JJQLYW6Z.mjs +111 -0
- package/dist/chunk-L6BKANJC.mjs +130 -0
- package/dist/chunk-LXEO5PG3.mjs +292 -0
- package/dist/chunk-LZHO636W.mjs +501 -0
- package/dist/chunk-MTK2IIDZ.mjs +262 -0
- package/dist/chunk-QDCQETSI.mjs +262 -0
- package/dist/chunk-QZNY7B2N.mjs +248 -0
- package/dist/chunk-RCZSMGCX.mjs +250 -0
- package/dist/chunk-SWZOT67M.mjs +250 -0
- package/dist/chunk-U3IY2CFC.mjs +36 -0
- package/dist/chunk-UBCM5Y6R.mjs +275 -0
- package/dist/chunk-UTCRW3N7.mjs +301 -0
- package/dist/{chunk-SQHS6PFL.mjs → chunk-UYLH35LA.mjs} +47 -22
- package/dist/{chunk-ZB3EHHAG.mjs → chunk-WVNVC2PP.mjs} +90 -60
- package/dist/chunk-WYOW6O3P.mjs +114 -0
- package/dist/{chunk-RMH2TPAT.mjs → chunk-YRSSR4KN.mjs} +87 -59
- package/dist/client/index.d.mts +2 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +922 -0
- package/dist/client/index.mjs +104 -0
- package/dist/client-2xbeKnrg.d.mts +1291 -0
- package/dist/client-2xbeKnrg.d.ts +1291 -0
- package/dist/client-4HLAGzFg.d.mts +1291 -0
- package/dist/client-4HLAGzFg.d.ts +1291 -0
- package/dist/client-B4TQwNa7.d.mts +1290 -0
- package/dist/client-B4TQwNa7.d.ts +1290 -0
- package/dist/client-Bdi4ty0v.d.mts +1294 -0
- package/dist/client-Bdi4ty0v.d.ts +1294 -0
- package/dist/client-BsKpUH3H.d.mts +1339 -0
- package/dist/client-BsKpUH3H.d.ts +1339 -0
- package/dist/client-Bv1zOaWF.d.mts +1291 -0
- package/dist/client-Bv1zOaWF.d.ts +1291 -0
- package/dist/client-Bz9YJMIX.d.mts +1290 -0
- package/dist/client-Bz9YJMIX.d.ts +1290 -0
- package/dist/client-CBpzm34X.d.mts +1291 -0
- package/dist/client-CBpzm34X.d.ts +1291 -0
- package/dist/client-CNu_tCZZ.d.mts +1305 -0
- package/dist/client-CNu_tCZZ.d.ts +1305 -0
- package/dist/client-CmEvxxQu.d.mts +1339 -0
- package/dist/client-CmEvxxQu.d.ts +1339 -0
- package/dist/client-Ctl_0z6F.d.mts +1294 -0
- package/dist/client-Ctl_0z6F.d.ts +1294 -0
- package/dist/client-DGMAxkZc.d.mts +1339 -0
- package/dist/client-DGMAxkZc.d.ts +1339 -0
- package/dist/client-DZq-CqcD.d.mts +1292 -0
- package/dist/client-DZq-CqcD.d.ts +1292 -0
- package/dist/{client-CYz0qxGB.d.mts → client-DcqGfDTt.d.mts} +90 -23
- package/dist/{client-CYz0qxGB.d.ts → client-DcqGfDTt.d.ts} +90 -23
- package/dist/{client-jGuH6TAG.d.mts → client-O8RvSRm0.d.mts} +18 -1
- package/dist/{client-jGuH6TAG.d.ts → client-O8RvSRm0.d.ts} +18 -1
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +47 -13
- package/dist/client.mjs +6 -4
- package/dist/csharp-parser-4ZKCSX5B.mjs +9 -0
- package/dist/csharp-parser-5HKICCRR.mjs +9 -0
- package/dist/csharp-parser-JCKXIAJW.mjs +9 -0
- package/dist/go-parser-J4KIH4RG.mjs +9 -0
- package/dist/go-parser-TKXL3DVH.mjs +9 -0
- package/dist/go-parser-XOM232XZ.mjs +9 -0
- package/dist/index-Ctl_0z6F.d.mts +1294 -0
- package/dist/index-Ctl_0z6F.d.ts +1294 -0
- package/dist/index.d.mts +372 -165
- package/dist/index.d.ts +372 -165
- package/dist/index.js +3825 -3123
- package/dist/index.mjs +901 -2128
- package/dist/java-parser-3KHXOXRQ.mjs +9 -0
- package/dist/java-parser-MASGS4WB.mjs +9 -0
- package/dist/java-parser-T5LXD63J.mjs +9 -0
- package/dist/python-parser-FNFK2473.mjs +8 -0
- package/dist/typescript-parser-2GGNRNB5.mjs +7 -0
- package/dist/typescript-parser-3ENJ6C7H.mjs +7 -0
- package/dist/typescript-parser-4GI7DPSW.mjs +7 -0
- package/dist/typescript-parser-4H3HUBO4.mjs +7 -0
- package/dist/typescript-parser-K63IVZMF.mjs +7 -0
- package/dist/typescript-parser-ZJKROMQG.mjs +7 -0
- package/package.json +6 -6
- package/dist/chunk-2Y6WZCES.mjs +0 -859
- package/dist/chunk-5SHLHMH7.mjs +0 -760
- package/dist/chunk-CGOS2J6T.mjs +0 -807
- package/dist/chunk-FMNCV4CC.mjs +0 -859
- package/dist/chunk-Q55AMEFV.mjs +0 -760
- package/dist/chunk-ST75O5C5.mjs +0 -859
- package/dist/chunk-TJXR2CHZ.mjs +0 -799
- package/dist/client-BEoUYNLp.d.mts +0 -1191
- package/dist/client-BEoUYNLp.d.ts +0 -1191
- package/dist/client-BrIMPk89.d.mts +0 -1214
- package/dist/client-BrIMPk89.d.ts +0 -1214
- package/dist/client-C5BuGX4F.d.mts +0 -1205
- package/dist/client-C5BuGX4F.d.ts +0 -1205
- package/dist/client-CKcjnPXt.d.mts +0 -1214
- package/dist/client-CKcjnPXt.d.ts +0 -1214
- package/dist/client-CLulBnie.d.mts +0 -1182
- package/dist/client-CLulBnie.d.ts +0 -1182
- package/dist/client-CQwvp8ep.d.mts +0 -1182
- package/dist/client-CQwvp8ep.d.ts +0 -1182
- package/dist/client-DLvFR2qA.d.mts +0 -1197
- package/dist/client-DLvFR2qA.d.ts +0 -1197
- package/dist/client-PFPdeo-z.d.mts +0 -1186
- package/dist/client-PFPdeo-z.d.ts +0 -1186
- package/dist/client-WVCAIWdJ.d.mts +0 -1192
- package/dist/client-WVCAIWdJ.d.ts +0 -1192
- package/dist/client-pYldIAg2.d.mts +0 -1209
- package/dist/client-pYldIAg2.d.ts +0 -1209
- package/dist/client-wk2fgk1q.d.mts +0 -1184
- package/dist/client-wk2fgk1q.d.ts +0 -1184
|
@@ -0,0 +1,922 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/client/index.ts
|
|
21
|
+
var client_exports = {};
|
|
22
|
+
__export(client_exports, {
|
|
23
|
+
AIReadyConfigSchema: () => AIReadyConfigSchema,
|
|
24
|
+
AnalysisResultSchema: () => AnalysisResultSchema,
|
|
25
|
+
AnalysisStatus: () => AnalysisStatus,
|
|
26
|
+
AnalysisStatusSchema: () => AnalysisStatusSchema,
|
|
27
|
+
COMMON_FINE_TUNING_OPTIONS: () => COMMON_FINE_TUNING_OPTIONS,
|
|
28
|
+
CONTEXT_TIER_THRESHOLDS: () => CONTEXT_TIER_THRESHOLDS,
|
|
29
|
+
DEFAULT_TOOL_WEIGHTS: () => DEFAULT_TOOL_WEIGHTS,
|
|
30
|
+
FRIENDLY_TOOL_NAMES: () => FRIENDLY_TOOL_NAMES,
|
|
31
|
+
GLOBAL_INFRA_OPTIONS: () => GLOBAL_INFRA_OPTIONS,
|
|
32
|
+
GLOBAL_SCAN_OPTIONS: () => GLOBAL_SCAN_OPTIONS,
|
|
33
|
+
IssueSchema: () => IssueSchema,
|
|
34
|
+
IssueType: () => IssueType,
|
|
35
|
+
IssueTypeSchema: () => IssueTypeSchema,
|
|
36
|
+
LANGUAGE_EXTENSIONS: () => LANGUAGE_EXTENSIONS,
|
|
37
|
+
Language: () => Language,
|
|
38
|
+
LeadSchema: () => LeadSchema,
|
|
39
|
+
LeadSource: () => LeadSource,
|
|
40
|
+
LeadSourceSchema: () => LeadSourceSchema,
|
|
41
|
+
LeadSubmissionSchema: () => LeadSubmissionSchema,
|
|
42
|
+
LocationSchema: () => LocationSchema,
|
|
43
|
+
MetricsSchema: () => MetricsSchema,
|
|
44
|
+
ModelTier: () => ModelTier,
|
|
45
|
+
ModelTierSchema: () => ModelTierSchema,
|
|
46
|
+
ParseError: () => ParseError,
|
|
47
|
+
RecommendationPriority: () => RecommendationPriority,
|
|
48
|
+
SCORING_PROFILES: () => SCORING_PROFILES,
|
|
49
|
+
SIZE_ADJUSTED_THRESHOLDS: () => SIZE_ADJUSTED_THRESHOLDS,
|
|
50
|
+
ScoringProfile: () => ScoringProfile,
|
|
51
|
+
Severity: () => Severity,
|
|
52
|
+
SeveritySchema: () => SeveritySchema,
|
|
53
|
+
SpokeOutputSchema: () => SpokeOutputSchema,
|
|
54
|
+
SpokeSummarySchema: () => SpokeSummarySchema,
|
|
55
|
+
TOOL_NAME_MAP: () => TOOL_NAME_MAP,
|
|
56
|
+
ToolName: () => ToolName,
|
|
57
|
+
ToolNameSchema: () => ToolNameSchema,
|
|
58
|
+
UnifiedReportSchema: () => UnifiedReportSchema,
|
|
59
|
+
calculateOverallScore: () => calculateOverallScore,
|
|
60
|
+
formatScore: () => formatScore,
|
|
61
|
+
formatToolScore: () => formatToolScore,
|
|
62
|
+
generateHTML: () => generateHTML,
|
|
63
|
+
getProjectSizeTier: () => getProjectSizeTier,
|
|
64
|
+
getRating: () => getRating,
|
|
65
|
+
getRatingDisplay: () => getRatingDisplay,
|
|
66
|
+
getRatingSlug: () => getRatingSlug,
|
|
67
|
+
getRatingWithContext: () => getRatingWithContext,
|
|
68
|
+
getRecommendedThreshold: () => getRecommendedThreshold,
|
|
69
|
+
getToolWeight: () => getToolWeight,
|
|
70
|
+
normalizeToolName: () => normalizeToolName,
|
|
71
|
+
parseWeightString: () => parseWeightString
|
|
72
|
+
});
|
|
73
|
+
module.exports = __toCommonJS(client_exports);
|
|
74
|
+
|
|
75
|
+
// src/types/business.ts
|
|
76
|
+
var import_zod = require("zod");
|
|
77
|
+
var LeadSource = /* @__PURE__ */ ((LeadSource2) => {
|
|
78
|
+
LeadSource2["ClawMoreHero"] = "clawmore-hero";
|
|
79
|
+
LeadSource2["ClawMoreWaitlist"] = "clawmore-waitlist";
|
|
80
|
+
LeadSource2["ClawMoreBeta"] = "clawmore-beta";
|
|
81
|
+
LeadSource2["AiReadyPlatform"] = "aiready-platform";
|
|
82
|
+
return LeadSource2;
|
|
83
|
+
})(LeadSource || {});
|
|
84
|
+
var LeadSourceSchema = import_zod.z.nativeEnum(LeadSource);
|
|
85
|
+
var LeadSchema = import_zod.z.object({
|
|
86
|
+
id: import_zod.z.string(),
|
|
87
|
+
email: import_zod.z.string().email(),
|
|
88
|
+
name: import_zod.z.string().min(1),
|
|
89
|
+
interest: import_zod.z.string().default("General"),
|
|
90
|
+
notes: import_zod.z.string().optional(),
|
|
91
|
+
timestamp: import_zod.z.string().datetime(),
|
|
92
|
+
source: LeadSourceSchema,
|
|
93
|
+
status: import_zod.z.enum(["new", "contacted", "qualified", "converted", "archived"]).default("new")
|
|
94
|
+
});
|
|
95
|
+
var LeadSubmissionSchema = LeadSchema.omit({
|
|
96
|
+
id: true,
|
|
97
|
+
timestamp: true,
|
|
98
|
+
status: true
|
|
99
|
+
});
|
|
100
|
+
var ManagedAccountSchema = import_zod.z.object({
|
|
101
|
+
id: import_zod.z.string(),
|
|
102
|
+
// Internal UUID
|
|
103
|
+
accountId: import_zod.z.string(),
|
|
104
|
+
// AWS Account ID
|
|
105
|
+
userId: import_zod.z.string(),
|
|
106
|
+
// Owner (caopengau@gmail.com)
|
|
107
|
+
stripeSubscriptionId: import_zod.z.string(),
|
|
108
|
+
// AI Token Management
|
|
109
|
+
tokenStrategy: import_zod.z.enum(["managed", "byok"]).default("managed"),
|
|
110
|
+
byokConfig: import_zod.z.object({
|
|
111
|
+
openaiKey: import_zod.z.string().optional(),
|
|
112
|
+
anthropicKey: import_zod.z.string().optional(),
|
|
113
|
+
openrouterKey: import_zod.z.string().optional()
|
|
114
|
+
}).optional(),
|
|
115
|
+
// Financials (in cents)
|
|
116
|
+
baseFeeCents: import_zod.z.number().default(2900),
|
|
117
|
+
includedComputeCents: import_zod.z.number().default(1500),
|
|
118
|
+
// $15.00 AWS included
|
|
119
|
+
includedTokenCents: import_zod.z.number().default(500),
|
|
120
|
+
// $5.00 Managed Tokens included
|
|
121
|
+
// Pre-paid Balance (credits)
|
|
122
|
+
prepaidTokenBalanceCents: import_zod.z.number().default(0),
|
|
123
|
+
// Users buy these in $10 packs
|
|
124
|
+
currentMonthlyTokenSpendCents: import_zod.z.number().default(0),
|
|
125
|
+
// Governance
|
|
126
|
+
status: import_zod.z.enum(["provisioning", "active", "warning", "quarantined", "suspended"]).default("provisioning"),
|
|
127
|
+
lastCostSyncAt: import_zod.z.string().datetime().optional(),
|
|
128
|
+
region: import_zod.z.string().default("ap-southeast-2"),
|
|
129
|
+
// Alerting thresholds (percentage of includedComputeCents)
|
|
130
|
+
alertThresholds: import_zod.z.array(import_zod.z.number()).default([50, 80, 100, 150])
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// src/types/enums.ts
|
|
134
|
+
var import_zod2 = require("zod");
|
|
135
|
+
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
136
|
+
Severity2["Critical"] = "critical";
|
|
137
|
+
Severity2["Major"] = "major";
|
|
138
|
+
Severity2["Minor"] = "minor";
|
|
139
|
+
Severity2["Info"] = "info";
|
|
140
|
+
return Severity2;
|
|
141
|
+
})(Severity || {});
|
|
142
|
+
var SeveritySchema = import_zod2.z.nativeEnum(Severity);
|
|
143
|
+
var ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
144
|
+
ToolName2["PatternDetect"] = "pattern-detect";
|
|
145
|
+
ToolName2["ContextAnalyzer"] = "context-analyzer";
|
|
146
|
+
ToolName2["NamingConsistency"] = "naming-consistency";
|
|
147
|
+
ToolName2["AiSignalClarity"] = "ai-signal-clarity";
|
|
148
|
+
ToolName2["AgentGrounding"] = "agent-grounding";
|
|
149
|
+
ToolName2["TestabilityIndex"] = "testability-index";
|
|
150
|
+
ToolName2["DocDrift"] = "doc-drift";
|
|
151
|
+
ToolName2["DependencyHealth"] = "dependency-health";
|
|
152
|
+
ToolName2["ChangeAmplification"] = "change-amplification";
|
|
153
|
+
ToolName2["CognitiveLoad"] = "cognitive-load";
|
|
154
|
+
ToolName2["PatternEntropy"] = "pattern-entropy";
|
|
155
|
+
ToolName2["ConceptCohesion"] = "concept-cohesion";
|
|
156
|
+
ToolName2["SemanticDistance"] = "semantic-distance";
|
|
157
|
+
return ToolName2;
|
|
158
|
+
})(ToolName || {});
|
|
159
|
+
var ToolNameSchema = import_zod2.z.nativeEnum(ToolName);
|
|
160
|
+
var FRIENDLY_TOOL_NAMES = {
|
|
161
|
+
["pattern-detect" /* PatternDetect */]: "Semantic Duplicates",
|
|
162
|
+
["context-analyzer" /* ContextAnalyzer */]: "Context Fragmentation",
|
|
163
|
+
["naming-consistency" /* NamingConsistency */]: "Naming Consistency",
|
|
164
|
+
["ai-signal-clarity" /* AiSignalClarity */]: "AI Signal Clarity",
|
|
165
|
+
["agent-grounding" /* AgentGrounding */]: "Agent Grounding",
|
|
166
|
+
["testability-index" /* TestabilityIndex */]: "Testability Index",
|
|
167
|
+
["doc-drift" /* DocDrift */]: "Documentation Health",
|
|
168
|
+
["dependency-health" /* DependencyHealth */]: "Dependency Health",
|
|
169
|
+
["change-amplification" /* ChangeAmplification */]: "Change Amplification",
|
|
170
|
+
["cognitive-load" /* CognitiveLoad */]: "Cognitive Load",
|
|
171
|
+
["pattern-entropy" /* PatternEntropy */]: "Pattern Entropy",
|
|
172
|
+
["concept-cohesion" /* ConceptCohesion */]: "Concept Cohesion",
|
|
173
|
+
["semantic-distance" /* SemanticDistance */]: "Semantic Distance"
|
|
174
|
+
};
|
|
175
|
+
var IssueType = /* @__PURE__ */ ((IssueType2) => {
|
|
176
|
+
IssueType2["DuplicatePattern"] = "duplicate-pattern";
|
|
177
|
+
IssueType2["PatternInconsistency"] = "pattern-inconsistency";
|
|
178
|
+
IssueType2["ContextFragmentation"] = "context-fragmentation";
|
|
179
|
+
IssueType2["DependencyHealth"] = "dependency-health";
|
|
180
|
+
IssueType2["CircularDependency"] = "circular-dependency";
|
|
181
|
+
IssueType2["DocDrift"] = "doc-drift";
|
|
182
|
+
IssueType2["NamingInconsistency"] = "naming-inconsistency";
|
|
183
|
+
IssueType2["NamingQuality"] = "naming-quality";
|
|
184
|
+
IssueType2["ArchitectureInconsistency"] = "architecture-inconsistency";
|
|
185
|
+
IssueType2["DeadCode"] = "dead-code";
|
|
186
|
+
IssueType2["MissingTypes"] = "missing-types";
|
|
187
|
+
IssueType2["MagicLiteral"] = "magic-literal";
|
|
188
|
+
IssueType2["BooleanTrap"] = "boolean-trap";
|
|
189
|
+
IssueType2["AiSignalClarity"] = "ai-signal-clarity";
|
|
190
|
+
IssueType2["LowTestability"] = "low-testability";
|
|
191
|
+
IssueType2["AgentNavigationFailure"] = "agent-navigation-failure";
|
|
192
|
+
IssueType2["AmbiguousApi"] = "ambiguous-api";
|
|
193
|
+
IssueType2["ChangeAmplification"] = "change-amplification";
|
|
194
|
+
return IssueType2;
|
|
195
|
+
})(IssueType || {});
|
|
196
|
+
var IssueTypeSchema = import_zod2.z.nativeEnum(IssueType);
|
|
197
|
+
var AnalysisStatus = /* @__PURE__ */ ((AnalysisStatus2) => {
|
|
198
|
+
AnalysisStatus2["Processing"] = "processing";
|
|
199
|
+
AnalysisStatus2["Completed"] = "completed";
|
|
200
|
+
AnalysisStatus2["Failed"] = "failed";
|
|
201
|
+
return AnalysisStatus2;
|
|
202
|
+
})(AnalysisStatus || {});
|
|
203
|
+
var AnalysisStatusSchema = import_zod2.z.nativeEnum(AnalysisStatus);
|
|
204
|
+
var ModelTier = /* @__PURE__ */ ((ModelTier2) => {
|
|
205
|
+
ModelTier2["Compact"] = "compact";
|
|
206
|
+
ModelTier2["Standard"] = "standard";
|
|
207
|
+
ModelTier2["Extended"] = "extended";
|
|
208
|
+
ModelTier2["Frontier"] = "frontier";
|
|
209
|
+
return ModelTier2;
|
|
210
|
+
})(ModelTier || {});
|
|
211
|
+
var ModelTierSchema = import_zod2.z.nativeEnum(ModelTier);
|
|
212
|
+
|
|
213
|
+
// src/types/common.ts
|
|
214
|
+
var import_zod3 = require("zod");
|
|
215
|
+
var LocationSchema = import_zod3.z.object({
|
|
216
|
+
file: import_zod3.z.string(),
|
|
217
|
+
line: import_zod3.z.number(),
|
|
218
|
+
column: import_zod3.z.number().optional(),
|
|
219
|
+
endLine: import_zod3.z.number().optional(),
|
|
220
|
+
endColumn: import_zod3.z.number().optional()
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// src/types/schemas/issue.ts
|
|
224
|
+
var import_zod4 = require("zod");
|
|
225
|
+
var IssueSchema = import_zod4.z.object({
|
|
226
|
+
type: IssueTypeSchema,
|
|
227
|
+
severity: SeveritySchema,
|
|
228
|
+
message: import_zod4.z.string(),
|
|
229
|
+
location: LocationSchema,
|
|
230
|
+
suggestion: import_zod4.z.string().optional()
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// src/types/schemas/metrics.ts
|
|
234
|
+
var import_zod5 = require("zod");
|
|
235
|
+
var MetricsSchema = import_zod5.z.object({
|
|
236
|
+
tokenCost: import_zod5.z.number().optional(),
|
|
237
|
+
complexityScore: import_zod5.z.number().optional(),
|
|
238
|
+
consistencyScore: import_zod5.z.number().optional(),
|
|
239
|
+
docFreshnessScore: import_zod5.z.number().optional(),
|
|
240
|
+
// AI agent readiness metrics (v0.12+)
|
|
241
|
+
aiSignalClarityScore: import_zod5.z.number().optional(),
|
|
242
|
+
agentGroundingScore: import_zod5.z.number().optional(),
|
|
243
|
+
testabilityScore: import_zod5.z.number().optional(),
|
|
244
|
+
docDriftScore: import_zod5.z.number().optional(),
|
|
245
|
+
dependencyHealthScore: import_zod5.z.number().optional(),
|
|
246
|
+
modelContextTier: ModelTierSchema.optional(),
|
|
247
|
+
// Business value metrics
|
|
248
|
+
estimatedMonthlyCost: import_zod5.z.number().optional(),
|
|
249
|
+
estimatedDeveloperHours: import_zod5.z.number().optional(),
|
|
250
|
+
comprehensionDifficultyIndex: import_zod5.z.number().optional(),
|
|
251
|
+
// Extended metrics for specific spokes
|
|
252
|
+
totalSymbols: import_zod5.z.number().optional(),
|
|
253
|
+
totalExports: import_zod5.z.number().optional()
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// src/types/schemas/report.ts
|
|
257
|
+
var import_zod6 = require("zod");
|
|
258
|
+
var AnalysisResultSchema = import_zod6.z.object({
|
|
259
|
+
fileName: import_zod6.z.string(),
|
|
260
|
+
issues: import_zod6.z.array(IssueSchema),
|
|
261
|
+
metrics: MetricsSchema
|
|
262
|
+
});
|
|
263
|
+
var SpokeSummarySchema = import_zod6.z.object({
|
|
264
|
+
totalFiles: import_zod6.z.number().optional(),
|
|
265
|
+
totalIssues: import_zod6.z.number().optional(),
|
|
266
|
+
criticalIssues: import_zod6.z.number().optional(),
|
|
267
|
+
majorIssues: import_zod6.z.number().optional(),
|
|
268
|
+
score: import_zod6.z.number().optional()
|
|
269
|
+
}).catchall(import_zod6.z.any());
|
|
270
|
+
var SpokeOutputSchema = import_zod6.z.object({
|
|
271
|
+
results: import_zod6.z.array(AnalysisResultSchema),
|
|
272
|
+
summary: SpokeSummarySchema,
|
|
273
|
+
metadata: import_zod6.z.object({
|
|
274
|
+
toolName: import_zod6.z.string(),
|
|
275
|
+
version: import_zod6.z.string().optional(),
|
|
276
|
+
timestamp: import_zod6.z.string().optional(),
|
|
277
|
+
config: import_zod6.z.any().optional()
|
|
278
|
+
}).catchall(import_zod6.z.any()).optional()
|
|
279
|
+
});
|
|
280
|
+
var UnifiedReportSchema = import_zod6.z.object({
|
|
281
|
+
summary: import_zod6.z.object({
|
|
282
|
+
totalFiles: import_zod6.z.number(),
|
|
283
|
+
totalIssues: import_zod6.z.number(),
|
|
284
|
+
criticalIssues: import_zod6.z.number(),
|
|
285
|
+
majorIssues: import_zod6.z.number(),
|
|
286
|
+
businessImpact: import_zod6.z.object({
|
|
287
|
+
estimatedMonthlyWaste: import_zod6.z.number().optional(),
|
|
288
|
+
potentialSavings: import_zod6.z.number().optional(),
|
|
289
|
+
productivityHours: import_zod6.z.number().optional()
|
|
290
|
+
}).optional()
|
|
291
|
+
}),
|
|
292
|
+
results: import_zod6.z.array(AnalysisResultSchema),
|
|
293
|
+
scoring: import_zod6.z.object({
|
|
294
|
+
overall: import_zod6.z.number(),
|
|
295
|
+
rating: import_zod6.z.string(),
|
|
296
|
+
timestamp: import_zod6.z.string(),
|
|
297
|
+
breakdown: import_zod6.z.array(
|
|
298
|
+
import_zod6.z.object({
|
|
299
|
+
toolName: import_zod6.z.union([ToolNameSchema, import_zod6.z.string()]),
|
|
300
|
+
score: import_zod6.z.number()
|
|
301
|
+
}).catchall(import_zod6.z.any())
|
|
302
|
+
)
|
|
303
|
+
}).optional()
|
|
304
|
+
}).catchall(import_zod6.z.any());
|
|
305
|
+
|
|
306
|
+
// src/types/schemas/config.ts
|
|
307
|
+
var import_zod7 = require("zod");
|
|
308
|
+
var AIReadyConfigSchema = import_zod7.z.object({
|
|
309
|
+
/** Target score threshold (0-100) */
|
|
310
|
+
threshold: import_zod7.z.number().optional(),
|
|
311
|
+
/** Files or directories to include in scan */
|
|
312
|
+
include: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
313
|
+
/** Files or directories to exclude from scan */
|
|
314
|
+
exclude: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
315
|
+
/** Scan-specific configuration */
|
|
316
|
+
scan: import_zod7.z.object({
|
|
317
|
+
include: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
318
|
+
exclude: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
319
|
+
parallel: import_zod7.z.boolean().optional(),
|
|
320
|
+
deep: import_zod7.z.boolean().optional(),
|
|
321
|
+
tools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
322
|
+
}).optional(),
|
|
323
|
+
/** Output-specific configuration */
|
|
324
|
+
output: import_zod7.z.object({
|
|
325
|
+
/** Output format (json, console, html) */
|
|
326
|
+
format: import_zod7.z.enum(["json", "console", "html"]).optional(),
|
|
327
|
+
/** Output file path */
|
|
328
|
+
path: import_zod7.z.string().optional(),
|
|
329
|
+
/** Output directory */
|
|
330
|
+
saveTo: import_zod7.z.string().optional(),
|
|
331
|
+
/** Whether to show score breakdown in console */
|
|
332
|
+
showBreakdown: import_zod7.z.boolean().optional(),
|
|
333
|
+
/** Baseline report to compare against */
|
|
334
|
+
compareBaseline: import_zod7.z.string().optional()
|
|
335
|
+
}).optional(),
|
|
336
|
+
/** Tool-specific configuration overrides (Strictly ToolName -> Config) */
|
|
337
|
+
tools: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.any()).optional(),
|
|
338
|
+
/** Scoring profile and weights */
|
|
339
|
+
scoring: import_zod7.z.object({
|
|
340
|
+
/** Name of the scoring profile (e.g. "strict", "balanced") */
|
|
341
|
+
profile: import_zod7.z.string().optional(),
|
|
342
|
+
/** Custom weights for tools and metrics */
|
|
343
|
+
weights: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.number()).optional()
|
|
344
|
+
}).optional(),
|
|
345
|
+
/** Visualizer settings (interactive graph) */
|
|
346
|
+
visualizer: import_zod7.z.object({
|
|
347
|
+
groupingDirs: import_zod7.z.array(import_zod7.z.string()).optional(),
|
|
348
|
+
graph: import_zod7.z.object({
|
|
349
|
+
maxNodes: import_zod7.z.number().optional(),
|
|
350
|
+
maxEdges: import_zod7.z.number().optional()
|
|
351
|
+
}).optional()
|
|
352
|
+
}).optional()
|
|
353
|
+
}).catchall(import_zod7.z.any());
|
|
354
|
+
|
|
355
|
+
// src/types.ts
|
|
356
|
+
var GLOBAL_INFRA_OPTIONS = [
|
|
357
|
+
"rootDir",
|
|
358
|
+
"include",
|
|
359
|
+
"exclude",
|
|
360
|
+
"tools",
|
|
361
|
+
"scoring"
|
|
362
|
+
];
|
|
363
|
+
var GLOBAL_SCAN_OPTIONS = [
|
|
364
|
+
"rootDir",
|
|
365
|
+
"include",
|
|
366
|
+
"exclude",
|
|
367
|
+
"config",
|
|
368
|
+
"threshold",
|
|
369
|
+
"output",
|
|
370
|
+
"format",
|
|
371
|
+
"parallel",
|
|
372
|
+
"showBreakdown"
|
|
373
|
+
];
|
|
374
|
+
var COMMON_FINE_TUNING_OPTIONS = [
|
|
375
|
+
"maxDepth",
|
|
376
|
+
"minSimilarity",
|
|
377
|
+
"threshold",
|
|
378
|
+
"showBreakdown"
|
|
379
|
+
];
|
|
380
|
+
|
|
381
|
+
// src/types/language.ts
|
|
382
|
+
var Language = /* @__PURE__ */ ((Language2) => {
|
|
383
|
+
Language2["TypeScript"] = "typescript";
|
|
384
|
+
Language2["JavaScript"] = "javascript";
|
|
385
|
+
Language2["Python"] = "python";
|
|
386
|
+
Language2["Java"] = "java";
|
|
387
|
+
Language2["Go"] = "go";
|
|
388
|
+
Language2["Rust"] = "rust";
|
|
389
|
+
Language2["CSharp"] = "csharp";
|
|
390
|
+
return Language2;
|
|
391
|
+
})(Language || {});
|
|
392
|
+
var LANGUAGE_EXTENSIONS = {
|
|
393
|
+
".ts": "typescript" /* TypeScript */,
|
|
394
|
+
".tsx": "typescript" /* TypeScript */,
|
|
395
|
+
".js": "javascript" /* JavaScript */,
|
|
396
|
+
".jsx": "javascript" /* JavaScript */,
|
|
397
|
+
".py": "python" /* Python */,
|
|
398
|
+
".java": "java" /* Java */,
|
|
399
|
+
".go": "go" /* Go */,
|
|
400
|
+
".rs": "rust" /* Rust */,
|
|
401
|
+
".cs": "csharp" /* CSharp */
|
|
402
|
+
};
|
|
403
|
+
var ParseError = class extends Error {
|
|
404
|
+
constructor(message, filePath, loc) {
|
|
405
|
+
super(message);
|
|
406
|
+
this.filePath = filePath;
|
|
407
|
+
this.loc = loc;
|
|
408
|
+
this.name = "ParseError";
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// src/utils/rating-helpers.ts
|
|
413
|
+
function getRatingMetadata(score) {
|
|
414
|
+
if (score >= 90) {
|
|
415
|
+
return {
|
|
416
|
+
label: "Excellent",
|
|
417
|
+
slug: "excellent",
|
|
418
|
+
emoji: "\u2705",
|
|
419
|
+
rating: "Excellent" /* Excellent */
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
if (score >= 75) {
|
|
423
|
+
return {
|
|
424
|
+
label: "Good",
|
|
425
|
+
slug: "good",
|
|
426
|
+
emoji: "\u{1F44D}",
|
|
427
|
+
rating: "Good" /* Good */
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
if (score >= 60) {
|
|
431
|
+
return {
|
|
432
|
+
label: "Fair",
|
|
433
|
+
slug: "fair",
|
|
434
|
+
emoji: "\u{1F44C}",
|
|
435
|
+
rating: "Fair" /* Fair */
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
if (score >= 40) {
|
|
439
|
+
return {
|
|
440
|
+
label: "Needs Work",
|
|
441
|
+
slug: "needs-work",
|
|
442
|
+
emoji: "\u{1F528}",
|
|
443
|
+
rating: "Needs Work" /* NeedsWork */
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
label: "Critical",
|
|
448
|
+
slug: "critical",
|
|
449
|
+
emoji: "\u{1F6A8}",
|
|
450
|
+
rating: "Critical" /* Critical */
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function getRatingSlug(score) {
|
|
454
|
+
return getRatingMetadata(score).slug;
|
|
455
|
+
}
|
|
456
|
+
function getRating(score) {
|
|
457
|
+
return getRatingMetadata(score).rating;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// src/scoring-types.ts
|
|
461
|
+
var RecommendationPriority = /* @__PURE__ */ ((RecommendationPriority2) => {
|
|
462
|
+
RecommendationPriority2["High"] = "high";
|
|
463
|
+
RecommendationPriority2["Medium"] = "medium";
|
|
464
|
+
RecommendationPriority2["Low"] = "low";
|
|
465
|
+
return RecommendationPriority2;
|
|
466
|
+
})(RecommendationPriority || {});
|
|
467
|
+
|
|
468
|
+
// src/scoring.ts
|
|
469
|
+
var DEFAULT_TOOL_WEIGHTS = {
|
|
470
|
+
["pattern-detect" /* PatternDetect */]: 22,
|
|
471
|
+
["context-analyzer" /* ContextAnalyzer */]: 19,
|
|
472
|
+
["naming-consistency" /* NamingConsistency */]: 14,
|
|
473
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 11,
|
|
474
|
+
["agent-grounding" /* AgentGrounding */]: 10,
|
|
475
|
+
["testability-index" /* TestabilityIndex */]: 10,
|
|
476
|
+
["doc-drift" /* DocDrift */]: 8,
|
|
477
|
+
["dependency-health" /* DependencyHealth */]: 6,
|
|
478
|
+
["change-amplification" /* ChangeAmplification */]: 8
|
|
479
|
+
};
|
|
480
|
+
var TOOL_NAME_MAP = {
|
|
481
|
+
patterns: "pattern-detect" /* PatternDetect */,
|
|
482
|
+
"pattern-detect": "pattern-detect" /* PatternDetect */,
|
|
483
|
+
context: "context-analyzer" /* ContextAnalyzer */,
|
|
484
|
+
"context-analyzer": "context-analyzer" /* ContextAnalyzer */,
|
|
485
|
+
consistency: "naming-consistency" /* NamingConsistency */,
|
|
486
|
+
"naming-consistency": "naming-consistency" /* NamingConsistency */,
|
|
487
|
+
"ai-signal": "ai-signal-clarity" /* AiSignalClarity */,
|
|
488
|
+
"ai-signal-clarity": "ai-signal-clarity" /* AiSignalClarity */,
|
|
489
|
+
grounding: "agent-grounding" /* AgentGrounding */,
|
|
490
|
+
"agent-grounding": "agent-grounding" /* AgentGrounding */,
|
|
491
|
+
testability: "testability-index" /* TestabilityIndex */,
|
|
492
|
+
"testability-index": "testability-index" /* TestabilityIndex */,
|
|
493
|
+
"doc-drift": "doc-drift" /* DocDrift */,
|
|
494
|
+
"deps-health": "dependency-health" /* DependencyHealth */,
|
|
495
|
+
"dependency-health": "dependency-health" /* DependencyHealth */,
|
|
496
|
+
"change-amp": "change-amplification" /* ChangeAmplification */,
|
|
497
|
+
"change-amplification": "change-amplification" /* ChangeAmplification */
|
|
498
|
+
};
|
|
499
|
+
var ScoringProfile = /* @__PURE__ */ ((ScoringProfile2) => {
|
|
500
|
+
ScoringProfile2["Default"] = "default";
|
|
501
|
+
ScoringProfile2["Agentic"] = "agentic";
|
|
502
|
+
ScoringProfile2["Logic"] = "logic";
|
|
503
|
+
ScoringProfile2["UI"] = "ui";
|
|
504
|
+
ScoringProfile2["Cost"] = "cost";
|
|
505
|
+
ScoringProfile2["Security"] = "security";
|
|
506
|
+
return ScoringProfile2;
|
|
507
|
+
})(ScoringProfile || {});
|
|
508
|
+
var SCORING_PROFILES = {
|
|
509
|
+
["default" /* Default */]: DEFAULT_TOOL_WEIGHTS,
|
|
510
|
+
["agentic" /* Agentic */]: {
|
|
511
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 30,
|
|
512
|
+
["agent-grounding" /* AgentGrounding */]: 30,
|
|
513
|
+
["testability-index" /* TestabilityIndex */]: 20,
|
|
514
|
+
["context-analyzer" /* ContextAnalyzer */]: 10,
|
|
515
|
+
["naming-consistency" /* NamingConsistency */]: 10
|
|
516
|
+
},
|
|
517
|
+
["logic" /* Logic */]: {
|
|
518
|
+
["testability-index" /* TestabilityIndex */]: 40,
|
|
519
|
+
["naming-consistency" /* NamingConsistency */]: 20,
|
|
520
|
+
["context-analyzer" /* ContextAnalyzer */]: 20,
|
|
521
|
+
["pattern-detect" /* PatternDetect */]: 10,
|
|
522
|
+
["change-amplification" /* ChangeAmplification */]: 10
|
|
523
|
+
},
|
|
524
|
+
["ui" /* UI */]: {
|
|
525
|
+
["naming-consistency" /* NamingConsistency */]: 30,
|
|
526
|
+
["context-analyzer" /* ContextAnalyzer */]: 30,
|
|
527
|
+
["pattern-detect" /* PatternDetect */]: 20,
|
|
528
|
+
["doc-drift" /* DocDrift */]: 10,
|
|
529
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 10
|
|
530
|
+
},
|
|
531
|
+
["cost" /* Cost */]: {
|
|
532
|
+
["pattern-detect" /* PatternDetect */]: 50,
|
|
533
|
+
["context-analyzer" /* ContextAnalyzer */]: 30,
|
|
534
|
+
["change-amplification" /* ChangeAmplification */]: 10,
|
|
535
|
+
["dependency-health" /* DependencyHealth */]: 10
|
|
536
|
+
},
|
|
537
|
+
["security" /* Security */]: {
|
|
538
|
+
["naming-consistency" /* NamingConsistency */]: 40,
|
|
539
|
+
["testability-index" /* TestabilityIndex */]: 30,
|
|
540
|
+
["dependency-health" /* DependencyHealth */]: 20,
|
|
541
|
+
["context-analyzer" /* ContextAnalyzer */]: 10
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
var CONTEXT_TIER_THRESHOLDS = {
|
|
545
|
+
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
546
|
+
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
547
|
+
extended: { idealTokens: 15e3, criticalTokens: 5e4, idealDepth: 7 },
|
|
548
|
+
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 }
|
|
549
|
+
};
|
|
550
|
+
var SIZE_ADJUSTED_THRESHOLDS = {
|
|
551
|
+
xs: 80,
|
|
552
|
+
// < 50 files
|
|
553
|
+
small: 75,
|
|
554
|
+
// 50-200 files
|
|
555
|
+
medium: 70,
|
|
556
|
+
// 200-500 files
|
|
557
|
+
large: 65,
|
|
558
|
+
// 500-2000 files
|
|
559
|
+
enterprise: 58
|
|
560
|
+
// 2000+ files
|
|
561
|
+
};
|
|
562
|
+
function getProjectSizeTier(fileCount) {
|
|
563
|
+
if (fileCount < 50) return "xs";
|
|
564
|
+
if (fileCount < 200) return "small";
|
|
565
|
+
if (fileCount < 500) return "medium";
|
|
566
|
+
if (fileCount < 2e3) return "large";
|
|
567
|
+
return "enterprise";
|
|
568
|
+
}
|
|
569
|
+
function getRecommendedThreshold(fileCount, modelTier = "standard") {
|
|
570
|
+
const sizeTier = getProjectSizeTier(fileCount);
|
|
571
|
+
const base = SIZE_ADJUSTED_THRESHOLDS[sizeTier];
|
|
572
|
+
const modelBonus = modelTier === "frontier" ? -3 : modelTier === "extended" ? -2 : 0;
|
|
573
|
+
return base + modelBonus;
|
|
574
|
+
}
|
|
575
|
+
function normalizeToolName(shortName) {
|
|
576
|
+
return TOOL_NAME_MAP[shortName.toLowerCase()] ?? shortName;
|
|
577
|
+
}
|
|
578
|
+
function getToolWeight(toolName, toolConfig, cliOverride, profile = "default" /* Default */) {
|
|
579
|
+
if (cliOverride !== void 0) return cliOverride;
|
|
580
|
+
if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
|
|
581
|
+
const profileWeights = SCORING_PROFILES[profile] ?? DEFAULT_TOOL_WEIGHTS;
|
|
582
|
+
return profileWeights[toolName] ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
583
|
+
}
|
|
584
|
+
function parseWeightString(weightStr) {
|
|
585
|
+
const weights = /* @__PURE__ */ new Map();
|
|
586
|
+
if (!weightStr) return weights;
|
|
587
|
+
const pairs = weightStr.split(",");
|
|
588
|
+
for (const pair of pairs) {
|
|
589
|
+
const [toolShortName, weightValueStr] = pair.split(":");
|
|
590
|
+
if (toolShortName && weightValueStr) {
|
|
591
|
+
const toolName = normalizeToolName(toolShortName.trim());
|
|
592
|
+
const weight = parseInt(weightValueStr.trim(), 10);
|
|
593
|
+
if (!isNaN(weight) && weight > 0) {
|
|
594
|
+
weights.set(toolName, weight);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return weights;
|
|
599
|
+
}
|
|
600
|
+
function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
601
|
+
if (toolOutputs.size === 0) {
|
|
602
|
+
throw new Error("No tool outputs provided for scoring");
|
|
603
|
+
}
|
|
604
|
+
const profile = config?.scoring?.profile || "default" /* Default */;
|
|
605
|
+
const weights = /* @__PURE__ */ new Map();
|
|
606
|
+
for (const [toolName] of toolOutputs.entries()) {
|
|
607
|
+
const cliWeight = cliWeights?.get(toolName);
|
|
608
|
+
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
609
|
+
const weight = cliWeight ?? configWeight ?? getToolWeight(toolName, void 0, void 0, profile);
|
|
610
|
+
weights.set(toolName, weight);
|
|
611
|
+
}
|
|
612
|
+
let weightedSum = 0;
|
|
613
|
+
let totalWeight = 0;
|
|
614
|
+
const breakdown = [];
|
|
615
|
+
const toolsUsed = [];
|
|
616
|
+
const calculationWeights = {};
|
|
617
|
+
for (const [toolName, output] of toolOutputs.entries()) {
|
|
618
|
+
const weight = weights.get(toolName) ?? 5;
|
|
619
|
+
weightedSum += output.score * weight;
|
|
620
|
+
totalWeight += weight;
|
|
621
|
+
toolsUsed.push(toolName);
|
|
622
|
+
calculationWeights[toolName] = weight;
|
|
623
|
+
breakdown.push(output);
|
|
624
|
+
}
|
|
625
|
+
const overall = Math.round(weightedSum / totalWeight);
|
|
626
|
+
const rating = getRating(overall);
|
|
627
|
+
const formulaParts = Array.from(toolOutputs.entries()).map(
|
|
628
|
+
([name, output]) => {
|
|
629
|
+
const weight = weights.get(name) ?? 5;
|
|
630
|
+
return `(${output.score} \xD7 ${weight})`;
|
|
631
|
+
}
|
|
632
|
+
);
|
|
633
|
+
const formulaStr = `[${formulaParts.join(" + ")}] / ${totalWeight} = ${overall}`;
|
|
634
|
+
return {
|
|
635
|
+
overall,
|
|
636
|
+
rating,
|
|
637
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
638
|
+
toolsUsed,
|
|
639
|
+
breakdown,
|
|
640
|
+
calculation: {
|
|
641
|
+
formula: formulaStr,
|
|
642
|
+
weights: calculationWeights,
|
|
643
|
+
normalized: formulaStr
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function getRatingWithContext(score, fileCount, modelTier = "standard") {
|
|
648
|
+
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
649
|
+
const normalized = score - threshold + 70;
|
|
650
|
+
return getRating(normalized);
|
|
651
|
+
}
|
|
652
|
+
function getRatingDisplay(rating) {
|
|
653
|
+
switch (rating) {
|
|
654
|
+
case "Excellent" /* Excellent */:
|
|
655
|
+
return { emoji: "\u2705", color: "green" };
|
|
656
|
+
case "Good" /* Good */:
|
|
657
|
+
return { emoji: "\u{1F44D}", color: "blue" };
|
|
658
|
+
case "Fair" /* Fair */:
|
|
659
|
+
return { emoji: "\u26A0\uFE0F", color: "yellow" };
|
|
660
|
+
case "Needs Work" /* NeedsWork */:
|
|
661
|
+
return { emoji: "\u{1F528}", color: "orange" };
|
|
662
|
+
case "Critical" /* Critical */:
|
|
663
|
+
return { emoji: "\u274C", color: "red" };
|
|
664
|
+
default:
|
|
665
|
+
return { emoji: "\u2753", color: "gray" };
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
function formatScore(result) {
|
|
669
|
+
const { emoji } = getRatingDisplay(result.rating);
|
|
670
|
+
return `${result.overall}/100 (${result.rating}) ${emoji}`;
|
|
671
|
+
}
|
|
672
|
+
function formatToolScore(output) {
|
|
673
|
+
let result = ` Score: ${output.score}/100
|
|
674
|
+
|
|
675
|
+
`;
|
|
676
|
+
if (output.factors && output.factors.length > 0) {
|
|
677
|
+
result += ` Factors:
|
|
678
|
+
`;
|
|
679
|
+
output.factors.forEach((factor) => {
|
|
680
|
+
const impactSign = factor.impact > 0 ? "+" : "";
|
|
681
|
+
result += ` \u2022 ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}
|
|
682
|
+
`;
|
|
683
|
+
});
|
|
684
|
+
result += "\n";
|
|
685
|
+
}
|
|
686
|
+
if (output.recommendations && output.recommendations.length > 0) {
|
|
687
|
+
result += ` Recommendations:
|
|
688
|
+
`;
|
|
689
|
+
output.recommendations.forEach((rec, i) => {
|
|
690
|
+
let priorityIcon = "\u{1F535}";
|
|
691
|
+
const prio = rec.priority;
|
|
692
|
+
if (prio === "high" /* High */ || prio === "high")
|
|
693
|
+
priorityIcon = "\u{1F534}";
|
|
694
|
+
else if (prio === "medium" /* Medium */ || prio === "medium")
|
|
695
|
+
priorityIcon = "\u{1F7E1}";
|
|
696
|
+
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
697
|
+
`;
|
|
698
|
+
result += ` Impact: +${rec.estimatedImpact} points
|
|
699
|
+
|
|
700
|
+
`;
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
return result;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// src/utils/visualization.ts
|
|
707
|
+
function generateHTML(graph) {
|
|
708
|
+
const payload = JSON.stringify(graph, null, 2);
|
|
709
|
+
return `<!doctype html>
|
|
710
|
+
<html>
|
|
711
|
+
<head>
|
|
712
|
+
<meta charset="utf-8" />
|
|
713
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
714
|
+
<title>AIReady Visualization</title>
|
|
715
|
+
<style>
|
|
716
|
+
html,body { height: 100%; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #e2e8f0 }
|
|
717
|
+
#container { display:flex; height:100vh }
|
|
718
|
+
#panel { width: 320px; padding: 16px; background: #071130; box-shadow: -2px 0 8px rgba(0,0,0,0.3); overflow:auto }
|
|
719
|
+
#canvasWrap { flex:1; display:flex; align-items:center; justify-content:center }
|
|
720
|
+
canvas { background: #0b1220; border-radius:8px }
|
|
721
|
+
.stat { margin-bottom:12px }
|
|
722
|
+
</style>
|
|
723
|
+
</head>
|
|
724
|
+
<body>
|
|
725
|
+
<div id="container">
|
|
726
|
+
<div id="canvasWrap"><canvas id="canvas" width="1200" height="800"></canvas></div>
|
|
727
|
+
<div id="panel">
|
|
728
|
+
<h2>AIReady Visualization</h2>
|
|
729
|
+
<div class="stat"><strong>Files:</strong> <span id="stat-files"></span></div>
|
|
730
|
+
<div class="stat"><strong>Dependencies:</strong> <span id="stat-deps"></span></div>
|
|
731
|
+
<div class="stat"><strong>Legend</strong></div>
|
|
732
|
+
<div style="font-size:13px;line-height:1.3;color:#cbd5e1;margin-top:8px">
|
|
733
|
+
<div style="margin-bottom:8px"><span style="display:inline-block;width:12px;height:12px;background:#ff4d4f;margin-right:8px;border:1px solid rgba(255,255,255,0.06)"></span><strong>Critical</strong>: highest severity issues.</div>
|
|
734
|
+
<div style="margin-bottom:8px"><span style="display:inline-block;width:12px;height:12px;background:#ff9900;margin-right:8px;border:1px solid rgba(255,255,255,0.06)"></span><strong>Major</strong>: important issues.</div>
|
|
735
|
+
<div style="margin-bottom:8px"><span style="display:inline-block;width:12px;height:12px;background:#ffd666;margin-right:8px;border:1px solid rgba(255,255,255,0.06)"></span><strong>Minor</strong>: low priority issues.</div>
|
|
736
|
+
<div style="margin-bottom:8px"><span style="display:inline-block;width:12px;height:12px;background:#91d5ff;margin-right:8px;border:1px solid rgba(255,255,255,0.06)"></span><strong>Info</strong>: informational notes.</div>
|
|
737
|
+
<div style="margin-top:10px;color:#94a3b8"><strong>Node size</strong>: larger = higher token cost, more issues or dependency weight.</div>
|
|
738
|
+
<div style="margin-top:6px;color:#94a3b8"><strong>Proximity</strong>: nodes that are spatially close are more contextually related; relatedness is represented by distance and size rather than explicit edges.</div>
|
|
739
|
+
<div style="margin-top:6px;color:#94a3b8"><strong>Edge colors</strong>: <span style="color:#fb7e81">Similarity</span>, <span style="color:#84c1ff">Dependency</span>, <span style="color:#ffa500">Reference</span>, default <span style="color:#334155">Other</span>.</div>
|
|
740
|
+
</div>
|
|
741
|
+
</div>
|
|
742
|
+
</div>
|
|
743
|
+
|
|
744
|
+
<script>
|
|
745
|
+
const graphData = ${payload};
|
|
746
|
+
document.getElementById('stat-files').textContent = graphData.metadata.totalFiles;
|
|
747
|
+
document.getElementById('stat-deps').textContent = graphData.metadata.totalDependencies;
|
|
748
|
+
|
|
749
|
+
const canvas = document.getElementById('canvas');
|
|
750
|
+
const ctx = canvas.getContext('2d');
|
|
751
|
+
|
|
752
|
+
const nodes = graphData.nodes.map((n, i) => ({
|
|
753
|
+
...n,
|
|
754
|
+
x: canvas.width / 2 + Math.cos(i / graphData.nodes.length * Math.PI * 2) * (Math.min(canvas.width, canvas.height) / 3),
|
|
755
|
+
y: canvas.height / 2 + Math.sin(i / graphData.nodes.length * Math.PI * 2) * (Math.min(canvas.width, canvas.height) / 3),
|
|
756
|
+
}));
|
|
757
|
+
|
|
758
|
+
function draw() {
|
|
759
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
760
|
+
|
|
761
|
+
graphData.edges.forEach(edge => {
|
|
762
|
+
const s = nodes.find(n => n.id === edge.source);
|
|
763
|
+
const t = nodes.find(n => n.id === edge.target);
|
|
764
|
+
if (!s || !t) return;
|
|
765
|
+
if (edge.type === 'related') return;
|
|
766
|
+
if (edge.type === 'similarity') {
|
|
767
|
+
ctx.strokeStyle = '#fb7e81';
|
|
768
|
+
ctx.lineWidth = 1.2;
|
|
769
|
+
} else if (edge.type === 'dependency') {
|
|
770
|
+
ctx.strokeStyle = '#84c1ff';
|
|
771
|
+
ctx.lineWidth = 1.0;
|
|
772
|
+
} else if (edge.type === 'reference') {
|
|
773
|
+
ctx.strokeStyle = '#ffa500';
|
|
774
|
+
ctx.lineWidth = 0.9;
|
|
775
|
+
} else {
|
|
776
|
+
ctx.strokeStyle = '#334155';
|
|
777
|
+
ctx.lineWidth = 0.8;
|
|
778
|
+
}
|
|
779
|
+
ctx.beginPath();
|
|
780
|
+
ctx.moveTo(s.x, s.y);
|
|
781
|
+
ctx.lineTo(t.x, t.y);
|
|
782
|
+
ctx.stroke();
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
const groups = {};
|
|
786
|
+
nodes.forEach(n => {
|
|
787
|
+
const g = n.group || '__default';
|
|
788
|
+
if (!groups[g]) groups[g] = { minX: n.x, minY: n.y, maxX: n.x, maxY: n.y };
|
|
789
|
+
groups[g].minX = Math.min(groups[g].minX, n.x);
|
|
790
|
+
groups[g].minY = Math.min(groups[g].minY, n.y);
|
|
791
|
+
groups[g].maxX = Math.max(groups[g].maxX, n.x);
|
|
792
|
+
groups[g].maxY = Math.max(groups[g].maxY, n.y);
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
const groupRelations = {};
|
|
796
|
+
graphData.edges.forEach(edge => {
|
|
797
|
+
const sNode = nodes.find(n => n.id === edge.source);
|
|
798
|
+
const tNode = nodes.find(n => n.id === edge.target);
|
|
799
|
+
if (!sNode || !tNode) return;
|
|
800
|
+
const g1 = sNode.group || '__default';
|
|
801
|
+
const g2 = tNode.group || '__default';
|
|
802
|
+
if (g1 === g2) return;
|
|
803
|
+
const key = g1 < g2 ? g1 + '::' + g2 : g2 + '::' + g1;
|
|
804
|
+
groupRelations[key] = (groupRelations[key] || 0) + 1;
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
Object.keys(groupRelations).forEach(k => {
|
|
808
|
+
const count = groupRelations[k];
|
|
809
|
+
const [ga, gb] = k.split('::');
|
|
810
|
+
if (!groups[ga] || !groups[gb]) return;
|
|
811
|
+
const ax = (groups[ga].minX + groups[ga].maxX) / 2;
|
|
812
|
+
const ay = (groups[ga].minY + groups[ga].maxY) / 2;
|
|
813
|
+
const bx = (groups[gb].minX + groups[gb].maxX) / 2;
|
|
814
|
+
const by = (groups[gb].minY + groups[gb].maxY) / 2;
|
|
815
|
+
ctx.beginPath();
|
|
816
|
+
ctx.strokeStyle = 'rgba(148,163,184,0.25)';
|
|
817
|
+
ctx.lineWidth = Math.min(6, 0.6 + Math.sqrt(count));
|
|
818
|
+
ctx.moveTo(ax, ay);
|
|
819
|
+
ctx.lineTo(bx, by);
|
|
820
|
+
ctx.stroke();
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
Object.keys(groups).forEach(g => {
|
|
824
|
+
if (g === '__default') return;
|
|
825
|
+
const box = groups[g];
|
|
826
|
+
const pad = 16;
|
|
827
|
+
const x = box.minX - pad;
|
|
828
|
+
const y = box.minY - pad;
|
|
829
|
+
const w = (box.maxX - box.minX) + pad * 2;
|
|
830
|
+
const h = (box.maxY - box.minY) + pad * 2;
|
|
831
|
+
ctx.save();
|
|
832
|
+
ctx.fillStyle = 'rgba(30,64,175,0.04)';
|
|
833
|
+
ctx.strokeStyle = 'rgba(30,64,175,0.12)';
|
|
834
|
+
ctx.lineWidth = 1.2;
|
|
835
|
+
const r = 8;
|
|
836
|
+
ctx.beginPath();
|
|
837
|
+
ctx.moveTo(x + r, y);
|
|
838
|
+
ctx.arcTo(x + w, y, x + w, y + h, r);
|
|
839
|
+
ctx.arcTo(x + w, y + h, x, y + h, r);
|
|
840
|
+
ctx.arcTo(x, y + h, x, y, r);
|
|
841
|
+
ctx.arcTo(x, y, x + w, y, r);
|
|
842
|
+
ctx.closePath();
|
|
843
|
+
ctx.fill();
|
|
844
|
+
ctx.stroke();
|
|
845
|
+
ctx.restore();
|
|
846
|
+
ctx.fillStyle = '#94a3b8';
|
|
847
|
+
ctx.font = '11px sans-serif';
|
|
848
|
+
ctx.fillText(g, x + 8, y + 14);
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
nodes.forEach(n => {
|
|
852
|
+
const sizeVal = (n.size || n.value || 1);
|
|
853
|
+
const r = 6 + (sizeVal / 2);
|
|
854
|
+
ctx.beginPath();
|
|
855
|
+
ctx.fillStyle = n.color || '#60a5fa';
|
|
856
|
+
ctx.arc(n.x, n.y, r, 0, Math.PI * 2);
|
|
857
|
+
ctx.fill();
|
|
858
|
+
|
|
859
|
+
ctx.fillStyle = '#e2e8f0';
|
|
860
|
+
ctx.font = '11px sans-serif';
|
|
861
|
+
ctx.textAlign = 'center';
|
|
862
|
+
ctx.fillText(n.label || n.id.split('/').slice(-1)[0], n.x, n.y + r + 12);
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
draw();
|
|
867
|
+
</script>
|
|
868
|
+
</body>
|
|
869
|
+
</html>`;
|
|
870
|
+
}
|
|
871
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
872
|
+
0 && (module.exports = {
|
|
873
|
+
AIReadyConfigSchema,
|
|
874
|
+
AnalysisResultSchema,
|
|
875
|
+
AnalysisStatus,
|
|
876
|
+
AnalysisStatusSchema,
|
|
877
|
+
COMMON_FINE_TUNING_OPTIONS,
|
|
878
|
+
CONTEXT_TIER_THRESHOLDS,
|
|
879
|
+
DEFAULT_TOOL_WEIGHTS,
|
|
880
|
+
FRIENDLY_TOOL_NAMES,
|
|
881
|
+
GLOBAL_INFRA_OPTIONS,
|
|
882
|
+
GLOBAL_SCAN_OPTIONS,
|
|
883
|
+
IssueSchema,
|
|
884
|
+
IssueType,
|
|
885
|
+
IssueTypeSchema,
|
|
886
|
+
LANGUAGE_EXTENSIONS,
|
|
887
|
+
Language,
|
|
888
|
+
LeadSchema,
|
|
889
|
+
LeadSource,
|
|
890
|
+
LeadSourceSchema,
|
|
891
|
+
LeadSubmissionSchema,
|
|
892
|
+
LocationSchema,
|
|
893
|
+
MetricsSchema,
|
|
894
|
+
ModelTier,
|
|
895
|
+
ModelTierSchema,
|
|
896
|
+
ParseError,
|
|
897
|
+
RecommendationPriority,
|
|
898
|
+
SCORING_PROFILES,
|
|
899
|
+
SIZE_ADJUSTED_THRESHOLDS,
|
|
900
|
+
ScoringProfile,
|
|
901
|
+
Severity,
|
|
902
|
+
SeveritySchema,
|
|
903
|
+
SpokeOutputSchema,
|
|
904
|
+
SpokeSummarySchema,
|
|
905
|
+
TOOL_NAME_MAP,
|
|
906
|
+
ToolName,
|
|
907
|
+
ToolNameSchema,
|
|
908
|
+
UnifiedReportSchema,
|
|
909
|
+
calculateOverallScore,
|
|
910
|
+
formatScore,
|
|
911
|
+
formatToolScore,
|
|
912
|
+
generateHTML,
|
|
913
|
+
getProjectSizeTier,
|
|
914
|
+
getRating,
|
|
915
|
+
getRatingDisplay,
|
|
916
|
+
getRatingSlug,
|
|
917
|
+
getRatingWithContext,
|
|
918
|
+
getRecommendedThreshold,
|
|
919
|
+
getToolWeight,
|
|
920
|
+
normalizeToolName,
|
|
921
|
+
parseWeightString
|
|
922
|
+
});
|