@aiready/core 0.22.0 → 0.23.0
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-5HIXDC3X.mjs +694 -0
- package/dist/client.d.mts +19 -3
- package/dist/client.d.ts +19 -3
- package/dist/client.js +54 -3
- package/dist/client.mjs +5 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -3
- package/dist/index.mjs +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
// src/types/schema.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
4
|
+
Severity2["Critical"] = "critical";
|
|
5
|
+
Severity2["Major"] = "major";
|
|
6
|
+
Severity2["Minor"] = "minor";
|
|
7
|
+
Severity2["Info"] = "info";
|
|
8
|
+
return Severity2;
|
|
9
|
+
})(Severity || {});
|
|
10
|
+
var SeveritySchema = z.nativeEnum(Severity);
|
|
11
|
+
var ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
12
|
+
ToolName2["PatternDetect"] = "pattern-detect";
|
|
13
|
+
ToolName2["ContextAnalyzer"] = "context-analyzer";
|
|
14
|
+
ToolName2["NamingConsistency"] = "naming-consistency";
|
|
15
|
+
ToolName2["AiSignalClarity"] = "ai-signal-clarity";
|
|
16
|
+
ToolName2["AgentGrounding"] = "agent-grounding";
|
|
17
|
+
ToolName2["TestabilityIndex"] = "testability-index";
|
|
18
|
+
ToolName2["DocDrift"] = "doc-drift";
|
|
19
|
+
ToolName2["DependencyHealth"] = "dependency-health";
|
|
20
|
+
ToolName2["ChangeAmplification"] = "change-amplification";
|
|
21
|
+
ToolName2["CognitiveLoad"] = "cognitive-load";
|
|
22
|
+
ToolName2["PatternEntropy"] = "pattern-entropy";
|
|
23
|
+
ToolName2["ConceptCohesion"] = "concept-cohesion";
|
|
24
|
+
ToolName2["SemanticDistance"] = "semantic-distance";
|
|
25
|
+
return ToolName2;
|
|
26
|
+
})(ToolName || {});
|
|
27
|
+
var ToolNameSchema = z.nativeEnum(ToolName);
|
|
28
|
+
var FRIENDLY_TOOL_NAMES = {
|
|
29
|
+
["pattern-detect" /* PatternDetect */]: "Semantic Duplicates",
|
|
30
|
+
["context-analyzer" /* ContextAnalyzer */]: "Context Fragmentation",
|
|
31
|
+
["naming-consistency" /* NamingConsistency */]: "Naming Consistency",
|
|
32
|
+
["ai-signal-clarity" /* AiSignalClarity */]: "AI Signal Clarity",
|
|
33
|
+
["agent-grounding" /* AgentGrounding */]: "Agent Grounding",
|
|
34
|
+
["testability-index" /* TestabilityIndex */]: "Testability Index",
|
|
35
|
+
["doc-drift" /* DocDrift */]: "Documentation Health",
|
|
36
|
+
["dependency-health" /* DependencyHealth */]: "Dependency Health",
|
|
37
|
+
["change-amplification" /* ChangeAmplification */]: "Change Amplification",
|
|
38
|
+
["cognitive-load" /* CognitiveLoad */]: "Cognitive Load",
|
|
39
|
+
["pattern-entropy" /* PatternEntropy */]: "Pattern Entropy",
|
|
40
|
+
["concept-cohesion" /* ConceptCohesion */]: "Concept Cohesion",
|
|
41
|
+
["semantic-distance" /* SemanticDistance */]: "Semantic Distance"
|
|
42
|
+
};
|
|
43
|
+
var IssueType = /* @__PURE__ */ ((IssueType2) => {
|
|
44
|
+
IssueType2["DuplicatePattern"] = "duplicate-pattern";
|
|
45
|
+
IssueType2["PatternInconsistency"] = "pattern-inconsistency";
|
|
46
|
+
IssueType2["ContextFragmentation"] = "context-fragmentation";
|
|
47
|
+
IssueType2["DependencyHealth"] = "dependency-health";
|
|
48
|
+
IssueType2["CircularDependency"] = "circular-dependency";
|
|
49
|
+
IssueType2["DocDrift"] = "doc-drift";
|
|
50
|
+
IssueType2["NamingInconsistency"] = "naming-inconsistency";
|
|
51
|
+
IssueType2["NamingQuality"] = "naming-quality";
|
|
52
|
+
IssueType2["ArchitectureInconsistency"] = "architecture-inconsistency";
|
|
53
|
+
IssueType2["DeadCode"] = "dead-code";
|
|
54
|
+
IssueType2["MissingTypes"] = "missing-types";
|
|
55
|
+
IssueType2["MagicLiteral"] = "magic-literal";
|
|
56
|
+
IssueType2["BooleanTrap"] = "boolean-trap";
|
|
57
|
+
IssueType2["AiSignalClarity"] = "ai-signal-clarity";
|
|
58
|
+
IssueType2["LowTestability"] = "low-testability";
|
|
59
|
+
IssueType2["AgentNavigationFailure"] = "agent-navigation-failure";
|
|
60
|
+
IssueType2["AmbiguousApi"] = "ambiguous-api";
|
|
61
|
+
IssueType2["ChangeAmplification"] = "change-amplification";
|
|
62
|
+
return IssueType2;
|
|
63
|
+
})(IssueType || {});
|
|
64
|
+
var IssueTypeSchema = z.nativeEnum(IssueType);
|
|
65
|
+
var AnalysisStatus = /* @__PURE__ */ ((AnalysisStatus2) => {
|
|
66
|
+
AnalysisStatus2["Processing"] = "processing";
|
|
67
|
+
AnalysisStatus2["Completed"] = "completed";
|
|
68
|
+
AnalysisStatus2["Failed"] = "failed";
|
|
69
|
+
return AnalysisStatus2;
|
|
70
|
+
})(AnalysisStatus || {});
|
|
71
|
+
var AnalysisStatusSchema = z.nativeEnum(AnalysisStatus);
|
|
72
|
+
var ModelTier = /* @__PURE__ */ ((ModelTier2) => {
|
|
73
|
+
ModelTier2["Compact"] = "compact";
|
|
74
|
+
ModelTier2["Standard"] = "standard";
|
|
75
|
+
ModelTier2["Extended"] = "extended";
|
|
76
|
+
ModelTier2["Frontier"] = "frontier";
|
|
77
|
+
return ModelTier2;
|
|
78
|
+
})(ModelTier || {});
|
|
79
|
+
var ModelTierSchema = z.nativeEnum(ModelTier);
|
|
80
|
+
var LocationSchema = z.object({
|
|
81
|
+
file: z.string(),
|
|
82
|
+
line: z.number(),
|
|
83
|
+
column: z.number().optional(),
|
|
84
|
+
endLine: z.number().optional(),
|
|
85
|
+
endColumn: z.number().optional()
|
|
86
|
+
});
|
|
87
|
+
var IssueSchema = z.object({
|
|
88
|
+
type: IssueTypeSchema,
|
|
89
|
+
severity: SeveritySchema,
|
|
90
|
+
message: z.string(),
|
|
91
|
+
location: LocationSchema,
|
|
92
|
+
suggestion: z.string().optional()
|
|
93
|
+
});
|
|
94
|
+
var MetricsSchema = z.object({
|
|
95
|
+
tokenCost: z.number().optional(),
|
|
96
|
+
complexityScore: z.number().optional(),
|
|
97
|
+
consistencyScore: z.number().optional(),
|
|
98
|
+
docFreshnessScore: z.number().optional(),
|
|
99
|
+
// AI agent readiness metrics (v0.12+)
|
|
100
|
+
aiSignalClarityScore: z.number().optional(),
|
|
101
|
+
agentGroundingScore: z.number().optional(),
|
|
102
|
+
testabilityScore: z.number().optional(),
|
|
103
|
+
docDriftScore: z.number().optional(),
|
|
104
|
+
dependencyHealthScore: z.number().optional(),
|
|
105
|
+
modelContextTier: ModelTierSchema.optional(),
|
|
106
|
+
// Business value metrics
|
|
107
|
+
estimatedMonthlyCost: z.number().optional(),
|
|
108
|
+
estimatedDeveloperHours: z.number().optional(),
|
|
109
|
+
comprehensionDifficultyIndex: z.number().optional(),
|
|
110
|
+
// Extended metrics for specific spokes
|
|
111
|
+
totalSymbols: z.number().optional(),
|
|
112
|
+
totalExports: z.number().optional()
|
|
113
|
+
});
|
|
114
|
+
var AnalysisResultSchema = z.object({
|
|
115
|
+
fileName: z.string(),
|
|
116
|
+
issues: z.array(IssueSchema),
|
|
117
|
+
metrics: MetricsSchema
|
|
118
|
+
});
|
|
119
|
+
var SpokeSummarySchema = z.object({
|
|
120
|
+
totalFiles: z.number().optional(),
|
|
121
|
+
totalIssues: z.number().optional(),
|
|
122
|
+
criticalIssues: z.number().optional(),
|
|
123
|
+
majorIssues: z.number().optional(),
|
|
124
|
+
score: z.number().optional()
|
|
125
|
+
}).catchall(z.any());
|
|
126
|
+
var SpokeOutputSchema = z.object({
|
|
127
|
+
results: z.array(AnalysisResultSchema),
|
|
128
|
+
summary: SpokeSummarySchema,
|
|
129
|
+
metadata: z.object({
|
|
130
|
+
toolName: z.string(),
|
|
131
|
+
version: z.string().optional(),
|
|
132
|
+
timestamp: z.string().optional(),
|
|
133
|
+
config: z.any().optional()
|
|
134
|
+
}).catchall(z.any()).optional()
|
|
135
|
+
});
|
|
136
|
+
var UnifiedReportSchema = z.object({
|
|
137
|
+
summary: z.object({
|
|
138
|
+
totalFiles: z.number(),
|
|
139
|
+
totalIssues: z.number(),
|
|
140
|
+
criticalIssues: z.number(),
|
|
141
|
+
majorIssues: z.number(),
|
|
142
|
+
businessImpact: z.object({
|
|
143
|
+
estimatedMonthlyWaste: z.number().optional(),
|
|
144
|
+
potentialSavings: z.number().optional(),
|
|
145
|
+
productivityHours: z.number().optional()
|
|
146
|
+
}).optional()
|
|
147
|
+
}),
|
|
148
|
+
results: z.array(AnalysisResultSchema),
|
|
149
|
+
scoring: z.object({
|
|
150
|
+
overall: z.number(),
|
|
151
|
+
rating: z.string(),
|
|
152
|
+
timestamp: z.string(),
|
|
153
|
+
breakdown: z.array(
|
|
154
|
+
z.object({
|
|
155
|
+
toolName: z.union([ToolNameSchema, z.string()]),
|
|
156
|
+
score: z.number()
|
|
157
|
+
}).catchall(z.any())
|
|
158
|
+
)
|
|
159
|
+
}).optional()
|
|
160
|
+
}).catchall(z.any());
|
|
161
|
+
|
|
162
|
+
// src/types.ts
|
|
163
|
+
var GLOBAL_INFRA_OPTIONS = [
|
|
164
|
+
"rootDir",
|
|
165
|
+
// Essential for every tool
|
|
166
|
+
"include",
|
|
167
|
+
"exclude",
|
|
168
|
+
"onProgress",
|
|
169
|
+
"progressCallback",
|
|
170
|
+
"includeTests",
|
|
171
|
+
"useSmartDefaults",
|
|
172
|
+
"streamResults",
|
|
173
|
+
"batchSize",
|
|
174
|
+
"costConfig",
|
|
175
|
+
"tools",
|
|
176
|
+
"toolConfigs"
|
|
177
|
+
];
|
|
178
|
+
var COMMON_FINE_TUNING_OPTIONS = [
|
|
179
|
+
"maxDepth",
|
|
180
|
+
"minSimilarity",
|
|
181
|
+
"minLines",
|
|
182
|
+
"minCohesion",
|
|
183
|
+
// AI Signal Clarity options
|
|
184
|
+
"checkMagicLiterals",
|
|
185
|
+
"checkBooleanTraps",
|
|
186
|
+
"checkAmbiguousNames",
|
|
187
|
+
"checkUndocumentedExports",
|
|
188
|
+
"checkImplicitSideEffects",
|
|
189
|
+
"checkDeepCallbacks"
|
|
190
|
+
];
|
|
191
|
+
var GLOBAL_SCAN_OPTIONS = [...GLOBAL_INFRA_OPTIONS];
|
|
192
|
+
|
|
193
|
+
// src/types/language.ts
|
|
194
|
+
var Language = /* @__PURE__ */ ((Language2) => {
|
|
195
|
+
Language2["TypeScript"] = "typescript";
|
|
196
|
+
Language2["JavaScript"] = "javascript";
|
|
197
|
+
Language2["Python"] = "python";
|
|
198
|
+
Language2["Java"] = "java";
|
|
199
|
+
Language2["Go"] = "go";
|
|
200
|
+
Language2["Rust"] = "rust";
|
|
201
|
+
Language2["CSharp"] = "csharp";
|
|
202
|
+
return Language2;
|
|
203
|
+
})(Language || {});
|
|
204
|
+
var LANGUAGE_EXTENSIONS = {
|
|
205
|
+
".ts": "typescript" /* TypeScript */,
|
|
206
|
+
".tsx": "typescript" /* TypeScript */,
|
|
207
|
+
".js": "javascript" /* JavaScript */,
|
|
208
|
+
".jsx": "javascript" /* JavaScript */,
|
|
209
|
+
".py": "python" /* Python */,
|
|
210
|
+
".java": "java" /* Java */,
|
|
211
|
+
".go": "go" /* Go */,
|
|
212
|
+
".rs": "rust" /* Rust */,
|
|
213
|
+
".cs": "csharp" /* CSharp */
|
|
214
|
+
};
|
|
215
|
+
var ParseError = class extends Error {
|
|
216
|
+
constructor(message, filePath, loc) {
|
|
217
|
+
super(message);
|
|
218
|
+
this.filePath = filePath;
|
|
219
|
+
this.loc = loc;
|
|
220
|
+
this.name = "ParseError";
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// src/scoring.ts
|
|
225
|
+
var RecommendationPriority = /* @__PURE__ */ ((RecommendationPriority2) => {
|
|
226
|
+
RecommendationPriority2["High"] = "high";
|
|
227
|
+
RecommendationPriority2["Medium"] = "medium";
|
|
228
|
+
RecommendationPriority2["Low"] = "low";
|
|
229
|
+
return RecommendationPriority2;
|
|
230
|
+
})(RecommendationPriority || {});
|
|
231
|
+
var ReadinessRating = /* @__PURE__ */ ((ReadinessRating2) => {
|
|
232
|
+
ReadinessRating2["Excellent"] = "Excellent";
|
|
233
|
+
ReadinessRating2["Good"] = "Good";
|
|
234
|
+
ReadinessRating2["Fair"] = "Fair";
|
|
235
|
+
ReadinessRating2["NeedsWork"] = "Needs Work";
|
|
236
|
+
ReadinessRating2["Critical"] = "Critical";
|
|
237
|
+
return ReadinessRating2;
|
|
238
|
+
})(ReadinessRating || {});
|
|
239
|
+
var DEFAULT_TOOL_WEIGHTS = {
|
|
240
|
+
["pattern-detect" /* PatternDetect */]: 22,
|
|
241
|
+
["context-analyzer" /* ContextAnalyzer */]: 19,
|
|
242
|
+
["naming-consistency" /* NamingConsistency */]: 14,
|
|
243
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 11,
|
|
244
|
+
["agent-grounding" /* AgentGrounding */]: 10,
|
|
245
|
+
["testability-index" /* TestabilityIndex */]: 10,
|
|
246
|
+
["doc-drift" /* DocDrift */]: 8,
|
|
247
|
+
["dependency-health" /* DependencyHealth */]: 6,
|
|
248
|
+
["change-amplification" /* ChangeAmplification */]: 8
|
|
249
|
+
};
|
|
250
|
+
var TOOL_NAME_MAP = {
|
|
251
|
+
patterns: "pattern-detect" /* PatternDetect */,
|
|
252
|
+
"pattern-detect": "pattern-detect" /* PatternDetect */,
|
|
253
|
+
context: "context-analyzer" /* ContextAnalyzer */,
|
|
254
|
+
"context-analyzer": "context-analyzer" /* ContextAnalyzer */,
|
|
255
|
+
consistency: "naming-consistency" /* NamingConsistency */,
|
|
256
|
+
"naming-consistency": "naming-consistency" /* NamingConsistency */,
|
|
257
|
+
"ai-signal": "ai-signal-clarity" /* AiSignalClarity */,
|
|
258
|
+
"ai-signal-clarity": "ai-signal-clarity" /* AiSignalClarity */,
|
|
259
|
+
grounding: "agent-grounding" /* AgentGrounding */,
|
|
260
|
+
"agent-grounding": "agent-grounding" /* AgentGrounding */,
|
|
261
|
+
testability: "testability-index" /* TestabilityIndex */,
|
|
262
|
+
"testability-index": "testability-index" /* TestabilityIndex */,
|
|
263
|
+
"doc-drift": "doc-drift" /* DocDrift */,
|
|
264
|
+
"deps-health": "dependency-health" /* DependencyHealth */,
|
|
265
|
+
"dependency-health": "dependency-health" /* DependencyHealth */,
|
|
266
|
+
"change-amp": "change-amplification" /* ChangeAmplification */,
|
|
267
|
+
"change-amplification": "change-amplification" /* ChangeAmplification */
|
|
268
|
+
};
|
|
269
|
+
var ScoringProfile = /* @__PURE__ */ ((ScoringProfile2) => {
|
|
270
|
+
ScoringProfile2["Default"] = "default";
|
|
271
|
+
ScoringProfile2["Agentic"] = "agentic";
|
|
272
|
+
ScoringProfile2["Logic"] = "logic";
|
|
273
|
+
ScoringProfile2["UI"] = "ui";
|
|
274
|
+
ScoringProfile2["Cost"] = "cost";
|
|
275
|
+
ScoringProfile2["Security"] = "security";
|
|
276
|
+
return ScoringProfile2;
|
|
277
|
+
})(ScoringProfile || {});
|
|
278
|
+
var SCORING_PROFILES = {
|
|
279
|
+
["default" /* Default */]: DEFAULT_TOOL_WEIGHTS,
|
|
280
|
+
["agentic" /* Agentic */]: {
|
|
281
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 30,
|
|
282
|
+
["agent-grounding" /* AgentGrounding */]: 30,
|
|
283
|
+
["testability-index" /* TestabilityIndex */]: 20,
|
|
284
|
+
["context-analyzer" /* ContextAnalyzer */]: 10,
|
|
285
|
+
["naming-consistency" /* NamingConsistency */]: 10
|
|
286
|
+
},
|
|
287
|
+
["logic" /* Logic */]: {
|
|
288
|
+
["testability-index" /* TestabilityIndex */]: 40,
|
|
289
|
+
["naming-consistency" /* NamingConsistency */]: 20,
|
|
290
|
+
["context-analyzer" /* ContextAnalyzer */]: 20,
|
|
291
|
+
["pattern-detect" /* PatternDetect */]: 10,
|
|
292
|
+
["change-amplification" /* ChangeAmplification */]: 10
|
|
293
|
+
},
|
|
294
|
+
["ui" /* UI */]: {
|
|
295
|
+
["naming-consistency" /* NamingConsistency */]: 30,
|
|
296
|
+
["context-analyzer" /* ContextAnalyzer */]: 30,
|
|
297
|
+
["pattern-detect" /* PatternDetect */]: 20,
|
|
298
|
+
["doc-drift" /* DocDrift */]: 10,
|
|
299
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 10
|
|
300
|
+
},
|
|
301
|
+
["cost" /* Cost */]: {
|
|
302
|
+
["pattern-detect" /* PatternDetect */]: 50,
|
|
303
|
+
["context-analyzer" /* ContextAnalyzer */]: 30,
|
|
304
|
+
["change-amplification" /* ChangeAmplification */]: 10,
|
|
305
|
+
["dependency-health" /* DependencyHealth */]: 10
|
|
306
|
+
},
|
|
307
|
+
["security" /* Security */]: {
|
|
308
|
+
["naming-consistency" /* NamingConsistency */]: 40,
|
|
309
|
+
["testability-index" /* TestabilityIndex */]: 30,
|
|
310
|
+
["dependency-health" /* DependencyHealth */]: 20,
|
|
311
|
+
["context-analyzer" /* ContextAnalyzer */]: 10
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
var CONTEXT_TIER_THRESHOLDS = {
|
|
315
|
+
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
316
|
+
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
317
|
+
extended: { idealTokens: 15e3, criticalTokens: 5e4, idealDepth: 7 },
|
|
318
|
+
frontier: { idealTokens: 5e4, criticalTokens: 15e4, idealDepth: 10 }
|
|
319
|
+
};
|
|
320
|
+
var SIZE_ADJUSTED_THRESHOLDS = {
|
|
321
|
+
xs: 80,
|
|
322
|
+
// < 50 files
|
|
323
|
+
small: 75,
|
|
324
|
+
// 50-200 files
|
|
325
|
+
medium: 70,
|
|
326
|
+
// 200-500 files
|
|
327
|
+
large: 65,
|
|
328
|
+
// 500-2000 files
|
|
329
|
+
enterprise: 58
|
|
330
|
+
// 2000+ files
|
|
331
|
+
};
|
|
332
|
+
function getProjectSizeTier(fileCount) {
|
|
333
|
+
if (fileCount < 50) return "xs";
|
|
334
|
+
if (fileCount < 200) return "small";
|
|
335
|
+
if (fileCount < 500) return "medium";
|
|
336
|
+
if (fileCount < 2e3) return "large";
|
|
337
|
+
return "enterprise";
|
|
338
|
+
}
|
|
339
|
+
function getRecommendedThreshold(fileCount, modelTier = "standard") {
|
|
340
|
+
const sizeTier = getProjectSizeTier(fileCount);
|
|
341
|
+
const base = SIZE_ADJUSTED_THRESHOLDS[sizeTier];
|
|
342
|
+
const modelBonus = modelTier === "frontier" ? -3 : modelTier === "extended" ? -2 : 0;
|
|
343
|
+
return base + modelBonus;
|
|
344
|
+
}
|
|
345
|
+
function normalizeToolName(shortName) {
|
|
346
|
+
return TOOL_NAME_MAP[shortName.toLowerCase()] || shortName;
|
|
347
|
+
}
|
|
348
|
+
function getToolWeight(toolName, toolConfig, cliOverride, profile = "default" /* Default */) {
|
|
349
|
+
if (cliOverride !== void 0) return cliOverride;
|
|
350
|
+
if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
|
|
351
|
+
const profileWeights = SCORING_PROFILES[profile] || DEFAULT_TOOL_WEIGHTS;
|
|
352
|
+
return profileWeights[toolName] ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
353
|
+
}
|
|
354
|
+
function parseWeightString(weightStr) {
|
|
355
|
+
const weights = /* @__PURE__ */ new Map();
|
|
356
|
+
if (!weightStr) return weights;
|
|
357
|
+
const pairs = weightStr.split(",");
|
|
358
|
+
for (const pair of pairs) {
|
|
359
|
+
const [toolShortName, weightValueStr] = pair.split(":");
|
|
360
|
+
if (toolShortName && weightValueStr) {
|
|
361
|
+
const toolName = normalizeToolName(toolShortName.trim());
|
|
362
|
+
const weight = parseInt(weightValueStr.trim(), 10);
|
|
363
|
+
if (!isNaN(weight) && weight > 0) {
|
|
364
|
+
weights.set(toolName, weight);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return weights;
|
|
369
|
+
}
|
|
370
|
+
function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
371
|
+
if (toolOutputs.size === 0) {
|
|
372
|
+
throw new Error("No tool outputs provided for scoring");
|
|
373
|
+
}
|
|
374
|
+
const profile = config?.scoring?.profile || "default" /* Default */;
|
|
375
|
+
const weights = /* @__PURE__ */ new Map();
|
|
376
|
+
for (const [toolName] of toolOutputs.entries()) {
|
|
377
|
+
const cliWeight = cliWeights?.get(toolName);
|
|
378
|
+
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
379
|
+
const weight = cliWeight ?? configWeight ?? getToolWeight(toolName, void 0, void 0, profile);
|
|
380
|
+
weights.set(toolName, weight);
|
|
381
|
+
}
|
|
382
|
+
let weightedSum = 0;
|
|
383
|
+
let totalWeight = 0;
|
|
384
|
+
const breakdown = [];
|
|
385
|
+
const toolsUsed = [];
|
|
386
|
+
const calculationWeights = {};
|
|
387
|
+
for (const [toolName, output] of toolOutputs.entries()) {
|
|
388
|
+
const weight = weights.get(toolName) || 5;
|
|
389
|
+
weightedSum += output.score * weight;
|
|
390
|
+
totalWeight += weight;
|
|
391
|
+
toolsUsed.push(toolName);
|
|
392
|
+
calculationWeights[toolName] = weight;
|
|
393
|
+
breakdown.push(output);
|
|
394
|
+
}
|
|
395
|
+
const overall = Math.round(weightedSum / totalWeight);
|
|
396
|
+
const rating = getRating(overall);
|
|
397
|
+
const formulaParts = Array.from(toolOutputs.entries()).map(
|
|
398
|
+
([name, output]) => {
|
|
399
|
+
const w = weights.get(name) || 5;
|
|
400
|
+
return `(${output.score} \xD7 ${w})`;
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
const formulaStr = `[${formulaParts.join(" + ")}] / ${totalWeight} = ${overall}`;
|
|
404
|
+
return {
|
|
405
|
+
overall,
|
|
406
|
+
rating,
|
|
407
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
408
|
+
toolsUsed,
|
|
409
|
+
breakdown,
|
|
410
|
+
calculation: {
|
|
411
|
+
formula: formulaStr,
|
|
412
|
+
weights: calculationWeights,
|
|
413
|
+
normalized: formulaStr
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function getRating(score) {
|
|
418
|
+
if (score >= 90) return "Excellent" /* Excellent */;
|
|
419
|
+
if (score >= 75) return "Good" /* Good */;
|
|
420
|
+
if (score >= 60) return "Fair" /* Fair */;
|
|
421
|
+
if (score >= 40) return "Needs Work" /* NeedsWork */;
|
|
422
|
+
return "Critical" /* Critical */;
|
|
423
|
+
}
|
|
424
|
+
function getRatingWithContext(score, fileCount, modelTier = "standard") {
|
|
425
|
+
const threshold = getRecommendedThreshold(fileCount, modelTier);
|
|
426
|
+
const normalized = score - threshold + 70;
|
|
427
|
+
return getRating(normalized);
|
|
428
|
+
}
|
|
429
|
+
function getRatingDisplay(rating) {
|
|
430
|
+
switch (rating) {
|
|
431
|
+
case "Excellent" /* Excellent */:
|
|
432
|
+
return { emoji: "\u2705", color: "green" };
|
|
433
|
+
case "Good" /* Good */:
|
|
434
|
+
return { emoji: "\u{1F44D}", color: "blue" };
|
|
435
|
+
case "Fair" /* Fair */:
|
|
436
|
+
return { emoji: "\u26A0\uFE0F", color: "yellow" };
|
|
437
|
+
case "Needs Work" /* NeedsWork */:
|
|
438
|
+
return { emoji: "\u{1F528}", color: "orange" };
|
|
439
|
+
case "Critical" /* Critical */:
|
|
440
|
+
return { emoji: "\u274C", color: "red" };
|
|
441
|
+
default:
|
|
442
|
+
return { emoji: "\u2753", color: "gray" };
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function formatScore(result) {
|
|
446
|
+
const { emoji } = getRatingDisplay(result.rating);
|
|
447
|
+
return `${result.overall}/100 (${result.rating}) ${emoji}`;
|
|
448
|
+
}
|
|
449
|
+
function formatToolScore(output) {
|
|
450
|
+
let result = ` Score: ${output.score}/100
|
|
451
|
+
|
|
452
|
+
`;
|
|
453
|
+
if (output.factors && output.factors.length > 0) {
|
|
454
|
+
result += ` Factors:
|
|
455
|
+
`;
|
|
456
|
+
output.factors.forEach((factor) => {
|
|
457
|
+
const impactSign = factor.impact > 0 ? "+" : "";
|
|
458
|
+
result += ` \u2022 ${factor.name}: ${impactSign}${factor.impact} - ${factor.description}
|
|
459
|
+
`;
|
|
460
|
+
});
|
|
461
|
+
result += "\n";
|
|
462
|
+
}
|
|
463
|
+
if (output.recommendations && output.recommendations.length > 0) {
|
|
464
|
+
result += ` Recommendations:
|
|
465
|
+
`;
|
|
466
|
+
output.recommendations.forEach((rec, i) => {
|
|
467
|
+
let priorityIcon = "\u{1F535}";
|
|
468
|
+
const prio = rec.priority;
|
|
469
|
+
if (prio === "high" /* High */ || prio === "high")
|
|
470
|
+
priorityIcon = "\u{1F534}";
|
|
471
|
+
else if (prio === "medium" /* Medium */ || prio === "medium")
|
|
472
|
+
priorityIcon = "\u{1F7E1}";
|
|
473
|
+
result += ` ${i + 1}. ${priorityIcon} ${rec.action}
|
|
474
|
+
`;
|
|
475
|
+
result += ` Impact: +${rec.estimatedImpact} points
|
|
476
|
+
|
|
477
|
+
`;
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
return result;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// src/utils/visualization.ts
|
|
484
|
+
function generateHTML(graph) {
|
|
485
|
+
const payload = JSON.stringify(graph, null, 2);
|
|
486
|
+
return `<!doctype html>
|
|
487
|
+
<html>
|
|
488
|
+
<head>
|
|
489
|
+
<meta charset="utf-8" />
|
|
490
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
491
|
+
<title>AIReady Visualization</title>
|
|
492
|
+
<style>
|
|
493
|
+
html,body { height: 100%; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #e2e8f0 }
|
|
494
|
+
#container { display:flex; height:100vh }
|
|
495
|
+
#panel { width: 320px; padding: 16px; background: #071130; box-shadow: -2px 0 8px rgba(0,0,0,0.3); overflow:auto }
|
|
496
|
+
#canvasWrap { flex:1; display:flex; align-items:center; justify-content:center }
|
|
497
|
+
canvas { background: #0b1220; border-radius:8px }
|
|
498
|
+
.stat { margin-bottom:12px }
|
|
499
|
+
</style>
|
|
500
|
+
</head>
|
|
501
|
+
<body>
|
|
502
|
+
<div id="container">
|
|
503
|
+
<div id="canvasWrap"><canvas id="canvas" width="1200" height="800"></canvas></div>
|
|
504
|
+
<div id="panel">
|
|
505
|
+
<h2>AIReady Visualization</h2>
|
|
506
|
+
<div class="stat"><strong>Files:</strong> <span id="stat-files"></span></div>
|
|
507
|
+
<div class="stat"><strong>Dependencies:</strong> <span id="stat-deps"></span></div>
|
|
508
|
+
<div class="stat"><strong>Legend</strong></div>
|
|
509
|
+
<div style="font-size:13px;line-height:1.3;color:#cbd5e1;margin-top:8px">
|
|
510
|
+
<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>
|
|
511
|
+
<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>
|
|
512
|
+
<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>
|
|
513
|
+
<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>
|
|
514
|
+
<div style="margin-top:10px;color:#94a3b8"><strong>Node size</strong>: larger = higher token cost, more issues or dependency weight.</div>
|
|
515
|
+
<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>
|
|
516
|
+
<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>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
</div>
|
|
520
|
+
|
|
521
|
+
<script>
|
|
522
|
+
const graphData = ${payload};
|
|
523
|
+
document.getElementById('stat-files').textContent = graphData.metadata.totalFiles;
|
|
524
|
+
document.getElementById('stat-deps').textContent = graphData.metadata.totalDependencies;
|
|
525
|
+
|
|
526
|
+
const canvas = document.getElementById('canvas');
|
|
527
|
+
const ctx = canvas.getContext('2d');
|
|
528
|
+
|
|
529
|
+
const nodes = graphData.nodes.map((n, i) => ({
|
|
530
|
+
...n,
|
|
531
|
+
x: canvas.width / 2 + Math.cos(i / graphData.nodes.length * Math.PI * 2) * (Math.min(canvas.width, canvas.height) / 3),
|
|
532
|
+
y: canvas.height / 2 + Math.sin(i / graphData.nodes.length * Math.PI * 2) * (Math.min(canvas.width, canvas.height) / 3),
|
|
533
|
+
}));
|
|
534
|
+
|
|
535
|
+
function draw() {
|
|
536
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
537
|
+
|
|
538
|
+
graphData.edges.forEach(edge => {
|
|
539
|
+
const s = nodes.find(n => n.id === edge.source);
|
|
540
|
+
const t = nodes.find(n => n.id === edge.target);
|
|
541
|
+
if (!s || !t) return;
|
|
542
|
+
if (edge.type === 'related') return;
|
|
543
|
+
if (edge.type === 'similarity') {
|
|
544
|
+
ctx.strokeStyle = '#fb7e81';
|
|
545
|
+
ctx.lineWidth = 1.2;
|
|
546
|
+
} else if (edge.type === 'dependency') {
|
|
547
|
+
ctx.strokeStyle = '#84c1ff';
|
|
548
|
+
ctx.lineWidth = 1.0;
|
|
549
|
+
} else if (edge.type === 'reference') {
|
|
550
|
+
ctx.strokeStyle = '#ffa500';
|
|
551
|
+
ctx.lineWidth = 0.9;
|
|
552
|
+
} else {
|
|
553
|
+
ctx.strokeStyle = '#334155';
|
|
554
|
+
ctx.lineWidth = 0.8;
|
|
555
|
+
}
|
|
556
|
+
ctx.beginPath();
|
|
557
|
+
ctx.moveTo(s.x, s.y);
|
|
558
|
+
ctx.lineTo(t.x, t.y);
|
|
559
|
+
ctx.stroke();
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
const groups = {};
|
|
563
|
+
nodes.forEach(n => {
|
|
564
|
+
const g = n.group || '__default';
|
|
565
|
+
if (!groups[g]) groups[g] = { minX: n.x, minY: n.y, maxX: n.x, maxY: n.y };
|
|
566
|
+
groups[g].minX = Math.min(groups[g].minX, n.x);
|
|
567
|
+
groups[g].minY = Math.min(groups[g].minY, n.y);
|
|
568
|
+
groups[g].maxX = Math.max(groups[g].maxX, n.x);
|
|
569
|
+
groups[g].maxY = Math.max(groups[g].maxY, n.y);
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
const groupRelations = {};
|
|
573
|
+
graphData.edges.forEach(edge => {
|
|
574
|
+
const sNode = nodes.find(n => n.id === edge.source);
|
|
575
|
+
const tNode = nodes.find(n => n.id === edge.target);
|
|
576
|
+
if (!sNode || !tNode) return;
|
|
577
|
+
const g1 = sNode.group || '__default';
|
|
578
|
+
const g2 = tNode.group || '__default';
|
|
579
|
+
if (g1 === g2) return;
|
|
580
|
+
const key = g1 < g2 ? g1 + '::' + g2 : g2 + '::' + g1;
|
|
581
|
+
groupRelations[key] = (groupRelations[key] || 0) + 1;
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
Object.keys(groupRelations).forEach(k => {
|
|
585
|
+
const count = groupRelations[k];
|
|
586
|
+
const [ga, gb] = k.split('::');
|
|
587
|
+
if (!groups[ga] || !groups[gb]) return;
|
|
588
|
+
const ax = (groups[ga].minX + groups[ga].maxX) / 2;
|
|
589
|
+
const ay = (groups[ga].minY + groups[ga].maxY) / 2;
|
|
590
|
+
const bx = (groups[gb].minX + groups[gb].maxX) / 2;
|
|
591
|
+
const by = (groups[gb].minY + groups[gb].maxY) / 2;
|
|
592
|
+
ctx.beginPath();
|
|
593
|
+
ctx.strokeStyle = 'rgba(148,163,184,0.25)';
|
|
594
|
+
ctx.lineWidth = Math.min(6, 0.6 + Math.sqrt(count));
|
|
595
|
+
ctx.moveTo(ax, ay);
|
|
596
|
+
ctx.lineTo(bx, by);
|
|
597
|
+
ctx.stroke();
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
Object.keys(groups).forEach(g => {
|
|
601
|
+
if (g === '__default') return;
|
|
602
|
+
const box = groups[g];
|
|
603
|
+
const pad = 16;
|
|
604
|
+
const x = box.minX - pad;
|
|
605
|
+
const y = box.minY - pad;
|
|
606
|
+
const w = (box.maxX - box.minX) + pad * 2;
|
|
607
|
+
const h = (box.maxY - box.minY) + pad * 2;
|
|
608
|
+
ctx.save();
|
|
609
|
+
ctx.fillStyle = 'rgba(30,64,175,0.04)';
|
|
610
|
+
ctx.strokeStyle = 'rgba(30,64,175,0.12)';
|
|
611
|
+
ctx.lineWidth = 1.2;
|
|
612
|
+
const r = 8;
|
|
613
|
+
ctx.beginPath();
|
|
614
|
+
ctx.moveTo(x + r, y);
|
|
615
|
+
ctx.arcTo(x + w, y, x + w, y + h, r);
|
|
616
|
+
ctx.arcTo(x + w, y + h, x, y + h, r);
|
|
617
|
+
ctx.arcTo(x, y + h, x, y, r);
|
|
618
|
+
ctx.arcTo(x, y, x + w, y, r);
|
|
619
|
+
ctx.closePath();
|
|
620
|
+
ctx.fill();
|
|
621
|
+
ctx.stroke();
|
|
622
|
+
ctx.restore();
|
|
623
|
+
ctx.fillStyle = '#94a3b8';
|
|
624
|
+
ctx.font = '11px sans-serif';
|
|
625
|
+
ctx.fillText(g, x + 8, y + 14);
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
nodes.forEach(n => {
|
|
629
|
+
const sizeVal = (n.size || n.value || 1);
|
|
630
|
+
const r = 6 + (sizeVal / 2);
|
|
631
|
+
ctx.beginPath();
|
|
632
|
+
ctx.fillStyle = n.color || '#60a5fa';
|
|
633
|
+
ctx.arc(n.x, n.y, r, 0, Math.PI * 2);
|
|
634
|
+
ctx.fill();
|
|
635
|
+
|
|
636
|
+
ctx.fillStyle = '#e2e8f0';
|
|
637
|
+
ctx.font = '11px sans-serif';
|
|
638
|
+
ctx.textAlign = 'center';
|
|
639
|
+
ctx.fillText(n.label || n.id.split('/').slice(-1)[0], n.x, n.y + r + 12);
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
draw();
|
|
644
|
+
</script>
|
|
645
|
+
</body>
|
|
646
|
+
</html>`;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export {
|
|
650
|
+
Severity,
|
|
651
|
+
SeveritySchema,
|
|
652
|
+
ToolName,
|
|
653
|
+
ToolNameSchema,
|
|
654
|
+
FRIENDLY_TOOL_NAMES,
|
|
655
|
+
IssueType,
|
|
656
|
+
IssueTypeSchema,
|
|
657
|
+
AnalysisStatus,
|
|
658
|
+
AnalysisStatusSchema,
|
|
659
|
+
ModelTier,
|
|
660
|
+
ModelTierSchema,
|
|
661
|
+
LocationSchema,
|
|
662
|
+
IssueSchema,
|
|
663
|
+
MetricsSchema,
|
|
664
|
+
AnalysisResultSchema,
|
|
665
|
+
SpokeSummarySchema,
|
|
666
|
+
SpokeOutputSchema,
|
|
667
|
+
UnifiedReportSchema,
|
|
668
|
+
GLOBAL_INFRA_OPTIONS,
|
|
669
|
+
COMMON_FINE_TUNING_OPTIONS,
|
|
670
|
+
GLOBAL_SCAN_OPTIONS,
|
|
671
|
+
Language,
|
|
672
|
+
LANGUAGE_EXTENSIONS,
|
|
673
|
+
ParseError,
|
|
674
|
+
RecommendationPriority,
|
|
675
|
+
ReadinessRating,
|
|
676
|
+
DEFAULT_TOOL_WEIGHTS,
|
|
677
|
+
TOOL_NAME_MAP,
|
|
678
|
+
ScoringProfile,
|
|
679
|
+
SCORING_PROFILES,
|
|
680
|
+
CONTEXT_TIER_THRESHOLDS,
|
|
681
|
+
SIZE_ADJUSTED_THRESHOLDS,
|
|
682
|
+
getProjectSizeTier,
|
|
683
|
+
getRecommendedThreshold,
|
|
684
|
+
normalizeToolName,
|
|
685
|
+
getToolWeight,
|
|
686
|
+
parseWeightString,
|
|
687
|
+
calculateOverallScore,
|
|
688
|
+
getRating,
|
|
689
|
+
getRatingWithContext,
|
|
690
|
+
getRatingDisplay,
|
|
691
|
+
formatScore,
|
|
692
|
+
formatToolScore,
|
|
693
|
+
generateHTML
|
|
694
|
+
};
|
package/dist/client.d.mts
CHANGED
|
@@ -960,6 +960,21 @@ declare const TOOL_NAME_MAP: Record<string, string>;
|
|
|
960
960
|
* Model context tiers for context-aware threshold calibration.
|
|
961
961
|
*/
|
|
962
962
|
type ModelContextTier = 'compact' | 'standard' | 'extended' | 'frontier';
|
|
963
|
+
/**
|
|
964
|
+
* Scoring profiles for project-type-aware weighting.
|
|
965
|
+
*/
|
|
966
|
+
declare enum ScoringProfile {
|
|
967
|
+
Default = "default",
|
|
968
|
+
Agentic = "agentic",// Focus on AI agent navigation and signal
|
|
969
|
+
Logic = "logic",// Focus on testability and complexity
|
|
970
|
+
UI = "ui",// Focus on consistency and context (lower penalty for magic literals)
|
|
971
|
+
Cost = "cost",// Focus on token waste (duplication and fragmentation)
|
|
972
|
+
Security = "security"
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Project-type-aware tool weight presets.
|
|
976
|
+
*/
|
|
977
|
+
declare const SCORING_PROFILES: Record<ScoringProfile, Record<string, number>>;
|
|
963
978
|
/**
|
|
964
979
|
* Context budget thresholds per tier.
|
|
965
980
|
*/
|
|
@@ -995,16 +1010,17 @@ declare function getRecommendedThreshold(fileCount: number, modelTier?: ModelCon
|
|
|
995
1010
|
*/
|
|
996
1011
|
declare function normalizeToolName(shortName: string): string;
|
|
997
1012
|
/**
|
|
998
|
-
* Retrieve the weight for a specific tool, considering overrides
|
|
1013
|
+
* Retrieve the weight for a specific tool, considering overrides and profiles
|
|
999
1014
|
*
|
|
1000
1015
|
* @param toolName The canonical tool ID
|
|
1001
1016
|
* @param toolConfig Optional configuration for the tool containing a weight
|
|
1002
1017
|
* @param cliOverride Optional weight override from the CLI
|
|
1018
|
+
* @param profile Optional scoring profile to use
|
|
1003
1019
|
* @returns The weight to be used for this tool in overall scoring
|
|
1004
1020
|
*/
|
|
1005
1021
|
declare function getToolWeight(toolName: string, toolConfig?: {
|
|
1006
1022
|
scoreWeight?: number;
|
|
1007
|
-
}, cliOverride?: number): number;
|
|
1023
|
+
}, cliOverride?: number, profile?: ScoringProfile): number;
|
|
1008
1024
|
/**
|
|
1009
1025
|
* Parse a comma-separated weight string (e.g. "patterns:30,context:10")
|
|
1010
1026
|
*
|
|
@@ -1075,4 +1091,4 @@ declare function formatToolScore(output: ToolScoringOutput): string;
|
|
|
1075
1091
|
*/
|
|
1076
1092
|
declare function generateHTML(graph: GraphData): string;
|
|
1077
1093
|
|
|
1078
|
-
export { type AIReadyConfig, type AcceptancePrediction, type AiSignalClarityConfig, type AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, type BaseToolConfig, type BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type ContextAnalyzerConfig, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, LocationSchema, type Metrics, MetricsSchema, type ModelContextTier, ModelTier, ModelTierSchema, type NamingConsistencyConfig, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type PatternDetectConfig, type ProductivityImpact, ReadinessRating, RecommendationPriority, type Report, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, type ScoringResult, Severity, SeveritySchema, type SourceLocation, type SourceRange, type SpokeOutput, SpokeOutputSchema, type SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, type TechnicalValueChain, type TechnicalValueChainSummary, type TokenBudget, ToolName, ToolNameSchema, type ToolScoringOutput, type UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
|
|
1094
|
+
export { type AIReadyConfig, type AcceptancePrediction, type AiSignalClarityConfig, type AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, type BaseToolConfig, type BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type ContextAnalyzerConfig, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, LocationSchema, type Metrics, MetricsSchema, type ModelContextTier, ModelTier, ModelTierSchema, type NamingConsistencyConfig, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type PatternDetectConfig, type ProductivityImpact, ReadinessRating, RecommendationPriority, type Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, ScoringProfile, type ScoringResult, Severity, SeveritySchema, type SourceLocation, type SourceRange, type SpokeOutput, SpokeOutputSchema, type SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, type TechnicalValueChain, type TechnicalValueChainSummary, type TokenBudget, ToolName, ToolNameSchema, type ToolScoringOutput, type UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
|
package/dist/client.d.ts
CHANGED
|
@@ -960,6 +960,21 @@ declare const TOOL_NAME_MAP: Record<string, string>;
|
|
|
960
960
|
* Model context tiers for context-aware threshold calibration.
|
|
961
961
|
*/
|
|
962
962
|
type ModelContextTier = 'compact' | 'standard' | 'extended' | 'frontier';
|
|
963
|
+
/**
|
|
964
|
+
* Scoring profiles for project-type-aware weighting.
|
|
965
|
+
*/
|
|
966
|
+
declare enum ScoringProfile {
|
|
967
|
+
Default = "default",
|
|
968
|
+
Agentic = "agentic",// Focus on AI agent navigation and signal
|
|
969
|
+
Logic = "logic",// Focus on testability and complexity
|
|
970
|
+
UI = "ui",// Focus on consistency and context (lower penalty for magic literals)
|
|
971
|
+
Cost = "cost",// Focus on token waste (duplication and fragmentation)
|
|
972
|
+
Security = "security"
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Project-type-aware tool weight presets.
|
|
976
|
+
*/
|
|
977
|
+
declare const SCORING_PROFILES: Record<ScoringProfile, Record<string, number>>;
|
|
963
978
|
/**
|
|
964
979
|
* Context budget thresholds per tier.
|
|
965
980
|
*/
|
|
@@ -995,16 +1010,17 @@ declare function getRecommendedThreshold(fileCount: number, modelTier?: ModelCon
|
|
|
995
1010
|
*/
|
|
996
1011
|
declare function normalizeToolName(shortName: string): string;
|
|
997
1012
|
/**
|
|
998
|
-
* Retrieve the weight for a specific tool, considering overrides
|
|
1013
|
+
* Retrieve the weight for a specific tool, considering overrides and profiles
|
|
999
1014
|
*
|
|
1000
1015
|
* @param toolName The canonical tool ID
|
|
1001
1016
|
* @param toolConfig Optional configuration for the tool containing a weight
|
|
1002
1017
|
* @param cliOverride Optional weight override from the CLI
|
|
1018
|
+
* @param profile Optional scoring profile to use
|
|
1003
1019
|
* @returns The weight to be used for this tool in overall scoring
|
|
1004
1020
|
*/
|
|
1005
1021
|
declare function getToolWeight(toolName: string, toolConfig?: {
|
|
1006
1022
|
scoreWeight?: number;
|
|
1007
|
-
}, cliOverride?: number): number;
|
|
1023
|
+
}, cliOverride?: number, profile?: ScoringProfile): number;
|
|
1008
1024
|
/**
|
|
1009
1025
|
* Parse a comma-separated weight string (e.g. "patterns:30,context:10")
|
|
1010
1026
|
*
|
|
@@ -1075,4 +1091,4 @@ declare function formatToolScore(output: ToolScoringOutput): string;
|
|
|
1075
1091
|
*/
|
|
1076
1092
|
declare function generateHTML(graph: GraphData): string;
|
|
1077
1093
|
|
|
1078
|
-
export { type AIReadyConfig, type AcceptancePrediction, type AiSignalClarityConfig, type AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, type BaseToolConfig, type BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type ContextAnalyzerConfig, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, LocationSchema, type Metrics, MetricsSchema, type ModelContextTier, ModelTier, ModelTierSchema, type NamingConsistencyConfig, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type PatternDetectConfig, type ProductivityImpact, ReadinessRating, RecommendationPriority, type Report, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, type ScoringResult, Severity, SeveritySchema, type SourceLocation, type SourceRange, type SpokeOutput, SpokeOutputSchema, type SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, type TechnicalValueChain, type TechnicalValueChainSummary, type TokenBudget, ToolName, ToolNameSchema, type ToolScoringOutput, type UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
|
|
1094
|
+
export { type AIReadyConfig, type AcceptancePrediction, type AiSignalClarityConfig, type AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, type BaseToolConfig, type BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type ContextAnalyzerConfig, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, LocationSchema, type Metrics, MetricsSchema, type ModelContextTier, ModelTier, ModelTierSchema, type NamingConsistencyConfig, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type PatternDetectConfig, type ProductivityImpact, ReadinessRating, RecommendationPriority, type Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, ScoringProfile, type ScoringResult, Severity, SeveritySchema, type SourceLocation, type SourceRange, type SpokeOutput, SpokeOutputSchema, type SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, type TechnicalValueChain, type TechnicalValueChainSummary, type TokenBudget, ToolName, ToolNameSchema, type ToolScoringOutput, type UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
|
package/dist/client.js
CHANGED
|
@@ -41,7 +41,9 @@ __export(client_exports, {
|
|
|
41
41
|
ParseError: () => ParseError,
|
|
42
42
|
ReadinessRating: () => ReadinessRating,
|
|
43
43
|
RecommendationPriority: () => RecommendationPriority,
|
|
44
|
+
SCORING_PROFILES: () => SCORING_PROFILES,
|
|
44
45
|
SIZE_ADJUSTED_THRESHOLDS: () => SIZE_ADJUSTED_THRESHOLDS,
|
|
46
|
+
ScoringProfile: () => ScoringProfile,
|
|
45
47
|
Severity: () => Severity,
|
|
46
48
|
SeveritySchema: () => SeveritySchema,
|
|
47
49
|
SpokeOutputSchema: () => SpokeOutputSchema,
|
|
@@ -333,6 +335,51 @@ var TOOL_NAME_MAP = {
|
|
|
333
335
|
"change-amp": "change-amplification" /* ChangeAmplification */,
|
|
334
336
|
"change-amplification": "change-amplification" /* ChangeAmplification */
|
|
335
337
|
};
|
|
338
|
+
var ScoringProfile = /* @__PURE__ */ ((ScoringProfile2) => {
|
|
339
|
+
ScoringProfile2["Default"] = "default";
|
|
340
|
+
ScoringProfile2["Agentic"] = "agentic";
|
|
341
|
+
ScoringProfile2["Logic"] = "logic";
|
|
342
|
+
ScoringProfile2["UI"] = "ui";
|
|
343
|
+
ScoringProfile2["Cost"] = "cost";
|
|
344
|
+
ScoringProfile2["Security"] = "security";
|
|
345
|
+
return ScoringProfile2;
|
|
346
|
+
})(ScoringProfile || {});
|
|
347
|
+
var SCORING_PROFILES = {
|
|
348
|
+
["default" /* Default */]: DEFAULT_TOOL_WEIGHTS,
|
|
349
|
+
["agentic" /* Agentic */]: {
|
|
350
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 30,
|
|
351
|
+
["agent-grounding" /* AgentGrounding */]: 30,
|
|
352
|
+
["testability-index" /* TestabilityIndex */]: 20,
|
|
353
|
+
["context-analyzer" /* ContextAnalyzer */]: 10,
|
|
354
|
+
["naming-consistency" /* NamingConsistency */]: 10
|
|
355
|
+
},
|
|
356
|
+
["logic" /* Logic */]: {
|
|
357
|
+
["testability-index" /* TestabilityIndex */]: 40,
|
|
358
|
+
["naming-consistency" /* NamingConsistency */]: 20,
|
|
359
|
+
["context-analyzer" /* ContextAnalyzer */]: 20,
|
|
360
|
+
["pattern-detect" /* PatternDetect */]: 10,
|
|
361
|
+
["change-amplification" /* ChangeAmplification */]: 10
|
|
362
|
+
},
|
|
363
|
+
["ui" /* UI */]: {
|
|
364
|
+
["naming-consistency" /* NamingConsistency */]: 30,
|
|
365
|
+
["context-analyzer" /* ContextAnalyzer */]: 30,
|
|
366
|
+
["pattern-detect" /* PatternDetect */]: 20,
|
|
367
|
+
["doc-drift" /* DocDrift */]: 10,
|
|
368
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 10
|
|
369
|
+
},
|
|
370
|
+
["cost" /* Cost */]: {
|
|
371
|
+
["pattern-detect" /* PatternDetect */]: 50,
|
|
372
|
+
["context-analyzer" /* ContextAnalyzer */]: 30,
|
|
373
|
+
["change-amplification" /* ChangeAmplification */]: 10,
|
|
374
|
+
["dependency-health" /* DependencyHealth */]: 10
|
|
375
|
+
},
|
|
376
|
+
["security" /* Security */]: {
|
|
377
|
+
["naming-consistency" /* NamingConsistency */]: 40,
|
|
378
|
+
["testability-index" /* TestabilityIndex */]: 30,
|
|
379
|
+
["dependency-health" /* DependencyHealth */]: 20,
|
|
380
|
+
["context-analyzer" /* ContextAnalyzer */]: 10
|
|
381
|
+
}
|
|
382
|
+
};
|
|
336
383
|
var CONTEXT_TIER_THRESHOLDS = {
|
|
337
384
|
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
338
385
|
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
@@ -367,10 +414,11 @@ function getRecommendedThreshold(fileCount, modelTier = "standard") {
|
|
|
367
414
|
function normalizeToolName(shortName) {
|
|
368
415
|
return TOOL_NAME_MAP[shortName.toLowerCase()] || shortName;
|
|
369
416
|
}
|
|
370
|
-
function getToolWeight(toolName, toolConfig, cliOverride) {
|
|
417
|
+
function getToolWeight(toolName, toolConfig, cliOverride, profile = "default" /* Default */) {
|
|
371
418
|
if (cliOverride !== void 0) return cliOverride;
|
|
372
419
|
if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
|
|
373
|
-
|
|
420
|
+
const profileWeights = SCORING_PROFILES[profile] || DEFAULT_TOOL_WEIGHTS;
|
|
421
|
+
return profileWeights[toolName] ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
374
422
|
}
|
|
375
423
|
function parseWeightString(weightStr) {
|
|
376
424
|
const weights = /* @__PURE__ */ new Map();
|
|
@@ -392,11 +440,12 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
392
440
|
if (toolOutputs.size === 0) {
|
|
393
441
|
throw new Error("No tool outputs provided for scoring");
|
|
394
442
|
}
|
|
443
|
+
const profile = config?.scoring?.profile || "default" /* Default */;
|
|
395
444
|
const weights = /* @__PURE__ */ new Map();
|
|
396
445
|
for (const [toolName] of toolOutputs.entries()) {
|
|
397
446
|
const cliWeight = cliWeights?.get(toolName);
|
|
398
447
|
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
399
|
-
const weight = cliWeight ?? configWeight ??
|
|
448
|
+
const weight = cliWeight ?? configWeight ?? getToolWeight(toolName, void 0, void 0, profile);
|
|
400
449
|
weights.set(toolName, weight);
|
|
401
450
|
}
|
|
402
451
|
let weightedSum = 0;
|
|
@@ -688,7 +737,9 @@ function generateHTML(graph) {
|
|
|
688
737
|
ParseError,
|
|
689
738
|
ReadinessRating,
|
|
690
739
|
RecommendationPriority,
|
|
740
|
+
SCORING_PROFILES,
|
|
691
741
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
742
|
+
ScoringProfile,
|
|
692
743
|
Severity,
|
|
693
744
|
SeveritySchema,
|
|
694
745
|
SpokeOutputSchema,
|
package/dist/client.mjs
CHANGED
|
@@ -20,7 +20,9 @@ import {
|
|
|
20
20
|
ParseError,
|
|
21
21
|
ReadinessRating,
|
|
22
22
|
RecommendationPriority,
|
|
23
|
+
SCORING_PROFILES,
|
|
23
24
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
25
|
+
ScoringProfile,
|
|
24
26
|
Severity,
|
|
25
27
|
SeveritySchema,
|
|
26
28
|
SpokeOutputSchema,
|
|
@@ -41,7 +43,7 @@ import {
|
|
|
41
43
|
getToolWeight,
|
|
42
44
|
normalizeToolName,
|
|
43
45
|
parseWeightString
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-5HIXDC3X.mjs";
|
|
45
47
|
export {
|
|
46
48
|
AnalysisResultSchema,
|
|
47
49
|
AnalysisStatus,
|
|
@@ -64,7 +66,9 @@ export {
|
|
|
64
66
|
ParseError,
|
|
65
67
|
ReadinessRating,
|
|
66
68
|
RecommendationPriority,
|
|
69
|
+
SCORING_PROFILES,
|
|
67
70
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
71
|
+
ScoringProfile,
|
|
68
72
|
Severity,
|
|
69
73
|
SeveritySchema,
|
|
70
74
|
SpokeOutputSchema,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.mjs';
|
|
2
|
-
export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
|
|
2
|
+
export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringProfile, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.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';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.js';
|
|
2
|
-
export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
|
|
2
|
+
export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringProfile, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.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';
|
package/dist/index.js
CHANGED
|
@@ -59,8 +59,10 @@ __export(index_exports, {
|
|
|
59
59
|
PythonParser: () => PythonParser,
|
|
60
60
|
ReadinessRating: () => ReadinessRating,
|
|
61
61
|
RecommendationPriority: () => RecommendationPriority,
|
|
62
|
+
SCORING_PROFILES: () => SCORING_PROFILES,
|
|
62
63
|
SEVERITY_TIME_ESTIMATES: () => SEVERITY_TIME_ESTIMATES,
|
|
63
64
|
SIZE_ADJUSTED_THRESHOLDS: () => SIZE_ADJUSTED_THRESHOLDS,
|
|
65
|
+
ScoringProfile: () => ScoringProfile,
|
|
64
66
|
Severity: () => Severity,
|
|
65
67
|
SeveritySchema: () => SeveritySchema,
|
|
66
68
|
SpokeOutputSchema: () => SpokeOutputSchema,
|
|
@@ -3177,6 +3179,51 @@ var TOOL_NAME_MAP = {
|
|
|
3177
3179
|
"change-amp": "change-amplification" /* ChangeAmplification */,
|
|
3178
3180
|
"change-amplification": "change-amplification" /* ChangeAmplification */
|
|
3179
3181
|
};
|
|
3182
|
+
var ScoringProfile = /* @__PURE__ */ ((ScoringProfile2) => {
|
|
3183
|
+
ScoringProfile2["Default"] = "default";
|
|
3184
|
+
ScoringProfile2["Agentic"] = "agentic";
|
|
3185
|
+
ScoringProfile2["Logic"] = "logic";
|
|
3186
|
+
ScoringProfile2["UI"] = "ui";
|
|
3187
|
+
ScoringProfile2["Cost"] = "cost";
|
|
3188
|
+
ScoringProfile2["Security"] = "security";
|
|
3189
|
+
return ScoringProfile2;
|
|
3190
|
+
})(ScoringProfile || {});
|
|
3191
|
+
var SCORING_PROFILES = {
|
|
3192
|
+
["default" /* Default */]: DEFAULT_TOOL_WEIGHTS,
|
|
3193
|
+
["agentic" /* Agentic */]: {
|
|
3194
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 30,
|
|
3195
|
+
["agent-grounding" /* AgentGrounding */]: 30,
|
|
3196
|
+
["testability-index" /* TestabilityIndex */]: 20,
|
|
3197
|
+
["context-analyzer" /* ContextAnalyzer */]: 10,
|
|
3198
|
+
["naming-consistency" /* NamingConsistency */]: 10
|
|
3199
|
+
},
|
|
3200
|
+
["logic" /* Logic */]: {
|
|
3201
|
+
["testability-index" /* TestabilityIndex */]: 40,
|
|
3202
|
+
["naming-consistency" /* NamingConsistency */]: 20,
|
|
3203
|
+
["context-analyzer" /* ContextAnalyzer */]: 20,
|
|
3204
|
+
["pattern-detect" /* PatternDetect */]: 10,
|
|
3205
|
+
["change-amplification" /* ChangeAmplification */]: 10
|
|
3206
|
+
},
|
|
3207
|
+
["ui" /* UI */]: {
|
|
3208
|
+
["naming-consistency" /* NamingConsistency */]: 30,
|
|
3209
|
+
["context-analyzer" /* ContextAnalyzer */]: 30,
|
|
3210
|
+
["pattern-detect" /* PatternDetect */]: 20,
|
|
3211
|
+
["doc-drift" /* DocDrift */]: 10,
|
|
3212
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 10
|
|
3213
|
+
},
|
|
3214
|
+
["cost" /* Cost */]: {
|
|
3215
|
+
["pattern-detect" /* PatternDetect */]: 50,
|
|
3216
|
+
["context-analyzer" /* ContextAnalyzer */]: 30,
|
|
3217
|
+
["change-amplification" /* ChangeAmplification */]: 10,
|
|
3218
|
+
["dependency-health" /* DependencyHealth */]: 10
|
|
3219
|
+
},
|
|
3220
|
+
["security" /* Security */]: {
|
|
3221
|
+
["naming-consistency" /* NamingConsistency */]: 40,
|
|
3222
|
+
["testability-index" /* TestabilityIndex */]: 30,
|
|
3223
|
+
["dependency-health" /* DependencyHealth */]: 20,
|
|
3224
|
+
["context-analyzer" /* ContextAnalyzer */]: 10
|
|
3225
|
+
}
|
|
3226
|
+
};
|
|
3180
3227
|
var CONTEXT_TIER_THRESHOLDS = {
|
|
3181
3228
|
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
3182
3229
|
standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
|
|
@@ -3211,10 +3258,11 @@ function getRecommendedThreshold(fileCount, modelTier = "standard") {
|
|
|
3211
3258
|
function normalizeToolName(shortName) {
|
|
3212
3259
|
return TOOL_NAME_MAP[shortName.toLowerCase()] || shortName;
|
|
3213
3260
|
}
|
|
3214
|
-
function getToolWeight(toolName, toolConfig, cliOverride) {
|
|
3261
|
+
function getToolWeight(toolName, toolConfig, cliOverride, profile = "default" /* Default */) {
|
|
3215
3262
|
if (cliOverride !== void 0) return cliOverride;
|
|
3216
3263
|
if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
|
|
3217
|
-
|
|
3264
|
+
const profileWeights = SCORING_PROFILES[profile] || DEFAULT_TOOL_WEIGHTS;
|
|
3265
|
+
return profileWeights[toolName] ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
|
|
3218
3266
|
}
|
|
3219
3267
|
function parseWeightString(weightStr) {
|
|
3220
3268
|
const weights = /* @__PURE__ */ new Map();
|
|
@@ -3236,11 +3284,12 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
3236
3284
|
if (toolOutputs.size === 0) {
|
|
3237
3285
|
throw new Error("No tool outputs provided for scoring");
|
|
3238
3286
|
}
|
|
3287
|
+
const profile = config?.scoring?.profile || "default" /* Default */;
|
|
3239
3288
|
const weights = /* @__PURE__ */ new Map();
|
|
3240
3289
|
for (const [toolName] of toolOutputs.entries()) {
|
|
3241
3290
|
const cliWeight = cliWeights?.get(toolName);
|
|
3242
3291
|
const configWeight = config?.tools?.[toolName]?.scoreWeight;
|
|
3243
|
-
const weight = cliWeight ?? configWeight ??
|
|
3292
|
+
const weight = cliWeight ?? configWeight ?? getToolWeight(toolName, void 0, void 0, profile);
|
|
3244
3293
|
weights.set(toolName, weight);
|
|
3245
3294
|
}
|
|
3246
3295
|
let weightedSum = 0;
|
|
@@ -4819,8 +4868,10 @@ function emitIssuesAsAnnotations(issues) {
|
|
|
4819
4868
|
PythonParser,
|
|
4820
4869
|
ReadinessRating,
|
|
4821
4870
|
RecommendationPriority,
|
|
4871
|
+
SCORING_PROFILES,
|
|
4822
4872
|
SEVERITY_TIME_ESTIMATES,
|
|
4823
4873
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
4874
|
+
ScoringProfile,
|
|
4824
4875
|
Severity,
|
|
4825
4876
|
SeveritySchema,
|
|
4826
4877
|
SpokeOutputSchema,
|
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,9 @@ import {
|
|
|
20
20
|
ParseError,
|
|
21
21
|
ReadinessRating,
|
|
22
22
|
RecommendationPriority,
|
|
23
|
+
SCORING_PROFILES,
|
|
23
24
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
25
|
+
ScoringProfile,
|
|
24
26
|
Severity,
|
|
25
27
|
SeveritySchema,
|
|
26
28
|
SpokeOutputSchema,
|
|
@@ -41,7 +43,7 @@ import {
|
|
|
41
43
|
getToolWeight,
|
|
42
44
|
normalizeToolName,
|
|
43
45
|
parseWeightString
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-5HIXDC3X.mjs";
|
|
45
47
|
|
|
46
48
|
// src/types/contract.ts
|
|
47
49
|
function validateSpokeOutput(toolName, output) {
|
|
@@ -4104,8 +4106,10 @@ export {
|
|
|
4104
4106
|
PythonParser,
|
|
4105
4107
|
ReadinessRating,
|
|
4106
4108
|
RecommendationPriority,
|
|
4109
|
+
SCORING_PROFILES,
|
|
4107
4110
|
SEVERITY_TIME_ESTIMATES,
|
|
4108
4111
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
4112
|
+
ScoringProfile,
|
|
4109
4113
|
Severity,
|
|
4110
4114
|
SeveritySchema,
|
|
4111
4115
|
SpokeOutputSchema,
|