@aiready/core 0.19.2 → 0.19.5
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-D3D3NCRR.mjs +538 -0
- package/dist/chunk-OQ6IGDXG.mjs +535 -0
- package/dist/chunk-QAFB3HXQ.mjs +574 -0
- package/dist/chunk-UTZOO4XO.mjs +537 -0
- package/dist/client.d.mts +276 -97
- package/dist/client.d.ts +276 -97
- package/dist/client.js +213 -32
- package/dist/client.mjs +35 -1
- package/dist/index.d.mts +10 -39
- package/dist/index.d.ts +10 -39
- package/dist/index.js +253 -56
- package/dist/index.mjs +73 -24
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -30,20 +30,37 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AnalysisResultSchema: () => AnalysisResultSchema,
|
|
34
|
+
AnalysisStatus: () => AnalysisStatus,
|
|
35
|
+
AnalysisStatusSchema: () => AnalysisStatusSchema,
|
|
33
36
|
CONTEXT_TIER_THRESHOLDS: () => CONTEXT_TIER_THRESHOLDS,
|
|
34
37
|
DEFAULT_COST_CONFIG: () => DEFAULT_COST_CONFIG,
|
|
35
38
|
DEFAULT_EXCLUDE: () => DEFAULT_EXCLUDE,
|
|
36
39
|
DEFAULT_TOOL_WEIGHTS: () => DEFAULT_TOOL_WEIGHTS,
|
|
40
|
+
FRIENDLY_TOOL_NAMES: () => FRIENDLY_TOOL_NAMES,
|
|
41
|
+
IssueSchema: () => IssueSchema,
|
|
42
|
+
IssueType: () => IssueType,
|
|
43
|
+
IssueTypeSchema: () => IssueTypeSchema,
|
|
37
44
|
LANGUAGE_EXTENSIONS: () => LANGUAGE_EXTENSIONS,
|
|
38
45
|
Language: () => Language,
|
|
46
|
+
LocationSchema: () => LocationSchema,
|
|
39
47
|
MODEL_PRICING_PRESETS: () => MODEL_PRICING_PRESETS,
|
|
48
|
+
MetricsSchema: () => MetricsSchema,
|
|
49
|
+
ModelTier: () => ModelTier,
|
|
50
|
+
ModelTierSchema: () => ModelTierSchema,
|
|
40
51
|
ParseError: () => ParseError,
|
|
41
52
|
ParserFactory: () => ParserFactory,
|
|
42
53
|
PythonParser: () => PythonParser,
|
|
43
54
|
SEVERITY_TIME_ESTIMATES: () => SEVERITY_TIME_ESTIMATES,
|
|
44
55
|
SIZE_ADJUSTED_THRESHOLDS: () => SIZE_ADJUSTED_THRESHOLDS,
|
|
56
|
+
Severity: () => Severity,
|
|
57
|
+
SeveritySchema: () => SeveritySchema,
|
|
58
|
+
SpokeOutputSchema: () => SpokeOutputSchema,
|
|
45
59
|
TOOL_NAME_MAP: () => TOOL_NAME_MAP,
|
|
60
|
+
ToolName: () => ToolName,
|
|
61
|
+
ToolNameSchema: () => ToolNameSchema,
|
|
46
62
|
TypeScriptParser: () => TypeScriptParser,
|
|
63
|
+
UnifiedReportSchema: () => UnifiedReportSchema,
|
|
47
64
|
VAGUE_FILE_NAMES: () => VAGUE_FILE_NAMES,
|
|
48
65
|
calculateAgentGrounding: () => calculateAgentGrounding,
|
|
49
66
|
calculateAiSignalClarity: () => calculateAiSignalClarity,
|
|
@@ -116,10 +133,159 @@ __export(index_exports, {
|
|
|
116
133
|
saveScoreEntry: () => saveScoreEntry,
|
|
117
134
|
scanEntries: () => scanEntries,
|
|
118
135
|
scanFiles: () => scanFiles,
|
|
119
|
-
validateSpokeOutput: () => validateSpokeOutput
|
|
136
|
+
validateSpokeOutput: () => validateSpokeOutput,
|
|
137
|
+
validateWithSchema: () => validateWithSchema
|
|
120
138
|
});
|
|
121
139
|
module.exports = __toCommonJS(index_exports);
|
|
122
140
|
|
|
141
|
+
// src/types/schema.ts
|
|
142
|
+
var import_zod = require("zod");
|
|
143
|
+
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
144
|
+
Severity2["Critical"] = "critical";
|
|
145
|
+
Severity2["Major"] = "major";
|
|
146
|
+
Severity2["Minor"] = "minor";
|
|
147
|
+
Severity2["Info"] = "info";
|
|
148
|
+
return Severity2;
|
|
149
|
+
})(Severity || {});
|
|
150
|
+
var SeveritySchema = import_zod.z.nativeEnum(Severity);
|
|
151
|
+
var ToolName = /* @__PURE__ */ ((ToolName2) => {
|
|
152
|
+
ToolName2["PatternDetect"] = "pattern-detect";
|
|
153
|
+
ToolName2["ContextAnalyzer"] = "context-analyzer";
|
|
154
|
+
ToolName2["NamingConsistency"] = "naming-consistency";
|
|
155
|
+
ToolName2["AiSignalClarity"] = "ai-signal-clarity";
|
|
156
|
+
ToolName2["AgentGrounding"] = "agent-grounding";
|
|
157
|
+
ToolName2["TestabilityIndex"] = "testability-index";
|
|
158
|
+
ToolName2["DocDrift"] = "doc-drift";
|
|
159
|
+
ToolName2["DependencyHealth"] = "dependency-health";
|
|
160
|
+
ToolName2["ChangeAmplification"] = "change-amplification";
|
|
161
|
+
ToolName2["CognitiveLoad"] = "cognitive-load";
|
|
162
|
+
ToolName2["PatternEntropy"] = "pattern-entropy";
|
|
163
|
+
ToolName2["ConceptCohesion"] = "concept-cohesion";
|
|
164
|
+
ToolName2["SemanticDistance"] = "semantic-distance";
|
|
165
|
+
return ToolName2;
|
|
166
|
+
})(ToolName || {});
|
|
167
|
+
var ToolNameSchema = import_zod.z.nativeEnum(ToolName);
|
|
168
|
+
var FRIENDLY_TOOL_NAMES = {
|
|
169
|
+
["pattern-detect" /* PatternDetect */]: "Semantic Duplicates",
|
|
170
|
+
["context-analyzer" /* ContextAnalyzer */]: "Context Fragmentation",
|
|
171
|
+
["naming-consistency" /* NamingConsistency */]: "Naming Consistency",
|
|
172
|
+
["ai-signal-clarity" /* AiSignalClarity */]: "AI Signal Clarity",
|
|
173
|
+
["agent-grounding" /* AgentGrounding */]: "Agent Grounding",
|
|
174
|
+
["testability-index" /* TestabilityIndex */]: "Testability Index",
|
|
175
|
+
["doc-drift" /* DocDrift */]: "Documentation Health",
|
|
176
|
+
["dependency-health" /* DependencyHealth */]: "Dependency Health",
|
|
177
|
+
["change-amplification" /* ChangeAmplification */]: "Change Amplification",
|
|
178
|
+
["cognitive-load" /* CognitiveLoad */]: "Cognitive Load",
|
|
179
|
+
["pattern-entropy" /* PatternEntropy */]: "Pattern Entropy",
|
|
180
|
+
["concept-cohesion" /* ConceptCohesion */]: "Concept Cohesion",
|
|
181
|
+
["semantic-distance" /* SemanticDistance */]: "Semantic Distance"
|
|
182
|
+
};
|
|
183
|
+
var IssueType = /* @__PURE__ */ ((IssueType2) => {
|
|
184
|
+
IssueType2["DuplicatePattern"] = "duplicate-pattern";
|
|
185
|
+
IssueType2["PatternInconsistency"] = "pattern-inconsistency";
|
|
186
|
+
IssueType2["ContextFragmentation"] = "context-fragmentation";
|
|
187
|
+
IssueType2["DependencyHealth"] = "dependency-health";
|
|
188
|
+
IssueType2["CircularDependency"] = "circular-dependency";
|
|
189
|
+
IssueType2["DocDrift"] = "doc-drift";
|
|
190
|
+
IssueType2["NamingInconsistency"] = "naming-inconsistency";
|
|
191
|
+
IssueType2["NamingQuality"] = "naming-quality";
|
|
192
|
+
IssueType2["ArchitectureInconsistency"] = "architecture-inconsistency";
|
|
193
|
+
IssueType2["DeadCode"] = "dead-code";
|
|
194
|
+
IssueType2["MissingTypes"] = "missing-types";
|
|
195
|
+
IssueType2["MagicLiteral"] = "magic-literal";
|
|
196
|
+
IssueType2["BooleanTrap"] = "boolean-trap";
|
|
197
|
+
IssueType2["AiSignalClarity"] = "ai-signal-clarity";
|
|
198
|
+
IssueType2["LowTestability"] = "low-testability";
|
|
199
|
+
IssueType2["AgentNavigationFailure"] = "agent-navigation-failure";
|
|
200
|
+
IssueType2["AmbiguousApi"] = "ambiguous-api";
|
|
201
|
+
IssueType2["ChangeAmplification"] = "change-amplification";
|
|
202
|
+
return IssueType2;
|
|
203
|
+
})(IssueType || {});
|
|
204
|
+
var IssueTypeSchema = import_zod.z.nativeEnum(IssueType);
|
|
205
|
+
var AnalysisStatus = /* @__PURE__ */ ((AnalysisStatus2) => {
|
|
206
|
+
AnalysisStatus2["Processing"] = "processing";
|
|
207
|
+
AnalysisStatus2["Completed"] = "completed";
|
|
208
|
+
AnalysisStatus2["Failed"] = "failed";
|
|
209
|
+
return AnalysisStatus2;
|
|
210
|
+
})(AnalysisStatus || {});
|
|
211
|
+
var AnalysisStatusSchema = import_zod.z.nativeEnum(AnalysisStatus);
|
|
212
|
+
var ModelTier = /* @__PURE__ */ ((ModelTier2) => {
|
|
213
|
+
ModelTier2["Compact"] = "compact";
|
|
214
|
+
ModelTier2["Standard"] = "standard";
|
|
215
|
+
ModelTier2["Extended"] = "extended";
|
|
216
|
+
ModelTier2["Frontier"] = "frontier";
|
|
217
|
+
return ModelTier2;
|
|
218
|
+
})(ModelTier || {});
|
|
219
|
+
var ModelTierSchema = import_zod.z.nativeEnum(ModelTier);
|
|
220
|
+
var LocationSchema = import_zod.z.object({
|
|
221
|
+
file: import_zod.z.string(),
|
|
222
|
+
line: import_zod.z.number(),
|
|
223
|
+
column: import_zod.z.number().optional(),
|
|
224
|
+
endLine: import_zod.z.number().optional(),
|
|
225
|
+
endColumn: import_zod.z.number().optional()
|
|
226
|
+
});
|
|
227
|
+
var IssueSchema = import_zod.z.object({
|
|
228
|
+
type: IssueTypeSchema,
|
|
229
|
+
severity: SeveritySchema,
|
|
230
|
+
message: import_zod.z.string(),
|
|
231
|
+
location: LocationSchema,
|
|
232
|
+
suggestion: import_zod.z.string().optional()
|
|
233
|
+
});
|
|
234
|
+
var MetricsSchema = import_zod.z.object({
|
|
235
|
+
tokenCost: import_zod.z.number().optional(),
|
|
236
|
+
complexityScore: import_zod.z.number().optional(),
|
|
237
|
+
consistencyScore: import_zod.z.number().optional(),
|
|
238
|
+
docFreshnessScore: import_zod.z.number().optional(),
|
|
239
|
+
// AI agent readiness metrics (v0.12+)
|
|
240
|
+
aiSignalClarityScore: import_zod.z.number().optional(),
|
|
241
|
+
agentGroundingScore: import_zod.z.number().optional(),
|
|
242
|
+
testabilityScore: import_zod.z.number().optional(),
|
|
243
|
+
docDriftScore: import_zod.z.number().optional(),
|
|
244
|
+
dependencyHealthScore: import_zod.z.number().optional(),
|
|
245
|
+
modelContextTier: ModelTierSchema.optional(),
|
|
246
|
+
// Business value metrics
|
|
247
|
+
estimatedMonthlyCost: import_zod.z.number().optional(),
|
|
248
|
+
estimatedDeveloperHours: import_zod.z.number().optional(),
|
|
249
|
+
comprehensionDifficultyIndex: import_zod.z.number().optional(),
|
|
250
|
+
// Extended metrics for specific spokes
|
|
251
|
+
totalSymbols: import_zod.z.number().optional(),
|
|
252
|
+
totalExports: import_zod.z.number().optional()
|
|
253
|
+
});
|
|
254
|
+
var AnalysisResultSchema = import_zod.z.object({
|
|
255
|
+
fileName: import_zod.z.string(),
|
|
256
|
+
issues: import_zod.z.array(IssueSchema),
|
|
257
|
+
metrics: MetricsSchema
|
|
258
|
+
});
|
|
259
|
+
var SpokeOutputSchema = import_zod.z.object({
|
|
260
|
+
results: import_zod.z.array(AnalysisResultSchema),
|
|
261
|
+
summary: import_zod.z.any(),
|
|
262
|
+
metadata: import_zod.z.object({
|
|
263
|
+
toolName: import_zod.z.string(),
|
|
264
|
+
version: import_zod.z.string(),
|
|
265
|
+
timestamp: import_zod.z.string()
|
|
266
|
+
}).catchall(import_zod.z.any()).optional()
|
|
267
|
+
});
|
|
268
|
+
var UnifiedReportSchema = import_zod.z.object({
|
|
269
|
+
summary: import_zod.z.object({
|
|
270
|
+
totalFiles: import_zod.z.number(),
|
|
271
|
+
totalIssues: import_zod.z.number(),
|
|
272
|
+
criticalIssues: import_zod.z.number(),
|
|
273
|
+
majorIssues: import_zod.z.number()
|
|
274
|
+
}),
|
|
275
|
+
results: import_zod.z.array(AnalysisResultSchema),
|
|
276
|
+
scoring: import_zod.z.object({
|
|
277
|
+
overall: import_zod.z.number(),
|
|
278
|
+
rating: import_zod.z.string(),
|
|
279
|
+
timestamp: import_zod.z.string(),
|
|
280
|
+
breakdown: import_zod.z.array(
|
|
281
|
+
import_zod.z.object({
|
|
282
|
+
toolName: import_zod.z.union([ToolNameSchema, import_zod.z.string()]),
|
|
283
|
+
score: import_zod.z.number()
|
|
284
|
+
}).catchall(import_zod.z.any())
|
|
285
|
+
)
|
|
286
|
+
}).optional()
|
|
287
|
+
}).catchall(import_zod.z.any());
|
|
288
|
+
|
|
123
289
|
// src/types/language.ts
|
|
124
290
|
var Language = /* @__PURE__ */ ((Language2) => {
|
|
125
291
|
Language2["TypeScript"] = "typescript";
|
|
@@ -198,6 +364,16 @@ function validateSpokeOutput(toolName, output) {
|
|
|
198
364
|
errors
|
|
199
365
|
};
|
|
200
366
|
}
|
|
367
|
+
function validateWithSchema(schema, data) {
|
|
368
|
+
const result = schema.safeParse(data);
|
|
369
|
+
if (result.success) {
|
|
370
|
+
return { valid: true, data: result.data };
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
valid: false,
|
|
374
|
+
errors: result.error.issues.map((e) => `${e.path.join(".")}: ${e.message}`)
|
|
375
|
+
};
|
|
376
|
+
}
|
|
201
377
|
|
|
202
378
|
// src/utils/file-scanner.ts
|
|
203
379
|
var import_glob = require("glob");
|
|
@@ -896,28 +1072,34 @@ function generateHTML(graph) {
|
|
|
896
1072
|
|
|
897
1073
|
// src/scoring.ts
|
|
898
1074
|
var DEFAULT_TOOL_WEIGHTS = {
|
|
899
|
-
"pattern-detect": 22,
|
|
900
|
-
"context-analyzer": 19,
|
|
901
|
-
consistency: 14,
|
|
902
|
-
"ai-signal-clarity": 11,
|
|
903
|
-
"agent-grounding": 10,
|
|
904
|
-
testability: 10,
|
|
905
|
-
"doc-drift": 8,
|
|
906
|
-
|
|
1075
|
+
["pattern-detect" /* PatternDetect */]: 22,
|
|
1076
|
+
["context-analyzer" /* ContextAnalyzer */]: 19,
|
|
1077
|
+
["naming-consistency" /* NamingConsistency */]: 14,
|
|
1078
|
+
["ai-signal-clarity" /* AiSignalClarity */]: 11,
|
|
1079
|
+
["agent-grounding" /* AgentGrounding */]: 10,
|
|
1080
|
+
["testability-index" /* TestabilityIndex */]: 10,
|
|
1081
|
+
["doc-drift" /* DocDrift */]: 8,
|
|
1082
|
+
["dependency-health" /* DependencyHealth */]: 6,
|
|
1083
|
+
["change-amplification" /* ChangeAmplification */]: 8
|
|
907
1084
|
};
|
|
908
1085
|
var TOOL_NAME_MAP = {
|
|
909
|
-
patterns: "pattern-detect"
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
"
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
"
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
"
|
|
919
|
-
|
|
920
|
-
|
|
1086
|
+
patterns: "pattern-detect" /* PatternDetect */,
|
|
1087
|
+
"pattern-detect": "pattern-detect" /* PatternDetect */,
|
|
1088
|
+
context: "context-analyzer" /* ContextAnalyzer */,
|
|
1089
|
+
"context-analyzer": "context-analyzer" /* ContextAnalyzer */,
|
|
1090
|
+
consistency: "naming-consistency" /* NamingConsistency */,
|
|
1091
|
+
"naming-consistency": "naming-consistency" /* NamingConsistency */,
|
|
1092
|
+
"ai-signal": "ai-signal-clarity" /* AiSignalClarity */,
|
|
1093
|
+
"ai-signal-clarity": "ai-signal-clarity" /* AiSignalClarity */,
|
|
1094
|
+
grounding: "agent-grounding" /* AgentGrounding */,
|
|
1095
|
+
"agent-grounding": "agent-grounding" /* AgentGrounding */,
|
|
1096
|
+
testability: "testability-index" /* TestabilityIndex */,
|
|
1097
|
+
"testability-index": "testability-index" /* TestabilityIndex */,
|
|
1098
|
+
"doc-drift": "doc-drift" /* DocDrift */,
|
|
1099
|
+
"deps-health": "dependency-health" /* DependencyHealth */,
|
|
1100
|
+
"dependency-health": "dependency-health" /* DependencyHealth */,
|
|
1101
|
+
"change-amp": "change-amplification" /* ChangeAmplification */,
|
|
1102
|
+
"change-amplification": "change-amplification" /* ChangeAmplification */
|
|
921
1103
|
};
|
|
922
1104
|
var CONTEXT_TIER_THRESHOLDS = {
|
|
923
1105
|
compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
|
|
@@ -951,22 +1133,16 @@ function getRecommendedThreshold(fileCount, modelTier = "standard") {
|
|
|
951
1133
|
return base + modelBonus;
|
|
952
1134
|
}
|
|
953
1135
|
function normalizeToolName(shortName) {
|
|
954
|
-
return TOOL_NAME_MAP[shortName] || shortName;
|
|
1136
|
+
return TOOL_NAME_MAP[shortName.toLowerCase()] || shortName;
|
|
955
1137
|
}
|
|
956
1138
|
function getToolWeight(toolName, toolConfig, cliOverride) {
|
|
957
|
-
if (cliOverride !== void 0)
|
|
958
|
-
|
|
959
|
-
}
|
|
960
|
-
if (toolConfig?.scoreWeight !== void 0) {
|
|
961
|
-
return toolConfig.scoreWeight;
|
|
962
|
-
}
|
|
1139
|
+
if (cliOverride !== void 0) return cliOverride;
|
|
1140
|
+
if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
|
|
963
1141
|
return DEFAULT_TOOL_WEIGHTS[toolName] || 5;
|
|
964
1142
|
}
|
|
965
1143
|
function parseWeightString(weightStr) {
|
|
966
1144
|
const weights = /* @__PURE__ */ new Map();
|
|
967
|
-
if (!weightStr)
|
|
968
|
-
return weights;
|
|
969
|
-
}
|
|
1145
|
+
if (!weightStr) return weights;
|
|
970
1146
|
const pairs = weightStr.split(",");
|
|
971
1147
|
for (const pair of pairs) {
|
|
972
1148
|
const [toolShortName, weightStr2] = pair.split(":");
|
|
@@ -998,8 +1174,7 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
|
|
|
998
1174
|
const calculationWeights = {};
|
|
999
1175
|
for (const [toolName, output] of toolOutputs.entries()) {
|
|
1000
1176
|
const weight = weights.get(toolName) || 5;
|
|
1001
|
-
|
|
1002
|
-
weightedSum += weightedScore;
|
|
1177
|
+
weightedSum += output.score * weight;
|
|
1003
1178
|
totalWeight += weight;
|
|
1004
1179
|
toolsUsed.push(toolName);
|
|
1005
1180
|
calculationWeights[toolName] = weight;
|
|
@@ -1218,43 +1393,47 @@ function estimateCostFromBudget(budget, model, config = {}) {
|
|
|
1218
1393
|
|
|
1219
1394
|
// src/business/productivity-metrics.ts
|
|
1220
1395
|
var SEVERITY_TIME_ESTIMATES = {
|
|
1221
|
-
critical: 4,
|
|
1222
|
-
major: 2,
|
|
1223
|
-
minor: 0.5,
|
|
1224
|
-
info: 0.25
|
|
1396
|
+
["critical" /* Critical */]: 4,
|
|
1397
|
+
["major" /* Major */]: 2,
|
|
1398
|
+
["minor" /* Minor */]: 0.5,
|
|
1399
|
+
["info" /* Info */]: 0.25
|
|
1225
1400
|
};
|
|
1226
1401
|
var DEFAULT_HOURLY_RATE = 75;
|
|
1227
1402
|
function calculateProductivityImpact(issues, hourlyRate = DEFAULT_HOURLY_RATE) {
|
|
1228
1403
|
const counts = {
|
|
1229
|
-
critical: issues.filter((i) => i.severity === "critical").length,
|
|
1230
|
-
major: issues.filter((i) => i.severity === "major").length,
|
|
1231
|
-
minor: issues.filter((i) => i.severity === "minor").length,
|
|
1232
|
-
info: issues.filter((i) => i.severity === "info").length
|
|
1404
|
+
["critical" /* Critical */]: issues.filter((i) => i.severity === "critical" /* Critical */).length,
|
|
1405
|
+
["major" /* Major */]: issues.filter((i) => i.severity === "major" /* Major */).length,
|
|
1406
|
+
["minor" /* Minor */]: issues.filter((i) => i.severity === "minor" /* Minor */).length,
|
|
1407
|
+
["info" /* Info */]: issues.filter((i) => i.severity === "info" /* Info */).length
|
|
1233
1408
|
};
|
|
1234
1409
|
const hours = {
|
|
1235
|
-
critical: counts
|
|
1236
|
-
major: counts
|
|
1237
|
-
minor: counts
|
|
1238
|
-
info: counts
|
|
1410
|
+
["critical" /* Critical */]: counts["critical" /* Critical */] * SEVERITY_TIME_ESTIMATES["critical" /* Critical */],
|
|
1411
|
+
["major" /* Major */]: counts["major" /* Major */] * SEVERITY_TIME_ESTIMATES["major" /* Major */],
|
|
1412
|
+
["minor" /* Minor */]: counts["minor" /* Minor */] * SEVERITY_TIME_ESTIMATES["minor" /* Minor */],
|
|
1413
|
+
["info" /* Info */]: counts["info" /* Info */] * SEVERITY_TIME_ESTIMATES["info" /* Info */]
|
|
1239
1414
|
};
|
|
1240
|
-
const totalHours = hours
|
|
1415
|
+
const totalHours = hours["critical" /* Critical */] + hours["major" /* Major */] + hours["minor" /* Minor */] + hours["info" /* Info */];
|
|
1241
1416
|
const totalCost = totalHours * hourlyRate;
|
|
1242
1417
|
return {
|
|
1243
1418
|
totalHours: Math.round(totalHours * 10) / 10,
|
|
1244
1419
|
hourlyRate,
|
|
1245
1420
|
totalCost: Math.round(totalCost),
|
|
1246
1421
|
bySeverity: {
|
|
1247
|
-
critical: {
|
|
1248
|
-
hours: Math.round(hours
|
|
1249
|
-
cost: Math.round(hours
|
|
1422
|
+
["critical" /* Critical */]: {
|
|
1423
|
+
hours: Math.round(hours["critical" /* Critical */] * 10) / 10,
|
|
1424
|
+
cost: Math.round(hours["critical" /* Critical */] * hourlyRate)
|
|
1425
|
+
},
|
|
1426
|
+
["major" /* Major */]: {
|
|
1427
|
+
hours: Math.round(hours["major" /* Major */] * 10) / 10,
|
|
1428
|
+
cost: Math.round(hours["major" /* Major */] * hourlyRate)
|
|
1250
1429
|
},
|
|
1251
|
-
|
|
1252
|
-
hours: Math.round(hours
|
|
1253
|
-
cost: Math.round(hours
|
|
1430
|
+
["minor" /* Minor */]: {
|
|
1431
|
+
hours: Math.round(hours["minor" /* Minor */] * 10) / 10,
|
|
1432
|
+
cost: Math.round(hours["minor" /* Minor */] * hourlyRate)
|
|
1254
1433
|
},
|
|
1255
|
-
|
|
1256
|
-
hours: Math.round(hours
|
|
1257
|
-
cost: Math.round(hours
|
|
1434
|
+
["info" /* Info */]: {
|
|
1435
|
+
hours: Math.round(hours["info" /* Info */] * 10) / 10,
|
|
1436
|
+
cost: Math.round(hours["info" /* Info */] * hourlyRate)
|
|
1258
1437
|
}
|
|
1259
1438
|
}
|
|
1260
1439
|
};
|
|
@@ -2985,20 +3164,37 @@ function getRepoMetadata(directory) {
|
|
|
2985
3164
|
}
|
|
2986
3165
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2987
3166
|
0 && (module.exports = {
|
|
3167
|
+
AnalysisResultSchema,
|
|
3168
|
+
AnalysisStatus,
|
|
3169
|
+
AnalysisStatusSchema,
|
|
2988
3170
|
CONTEXT_TIER_THRESHOLDS,
|
|
2989
3171
|
DEFAULT_COST_CONFIG,
|
|
2990
3172
|
DEFAULT_EXCLUDE,
|
|
2991
3173
|
DEFAULT_TOOL_WEIGHTS,
|
|
3174
|
+
FRIENDLY_TOOL_NAMES,
|
|
3175
|
+
IssueSchema,
|
|
3176
|
+
IssueType,
|
|
3177
|
+
IssueTypeSchema,
|
|
2992
3178
|
LANGUAGE_EXTENSIONS,
|
|
2993
3179
|
Language,
|
|
3180
|
+
LocationSchema,
|
|
2994
3181
|
MODEL_PRICING_PRESETS,
|
|
3182
|
+
MetricsSchema,
|
|
3183
|
+
ModelTier,
|
|
3184
|
+
ModelTierSchema,
|
|
2995
3185
|
ParseError,
|
|
2996
3186
|
ParserFactory,
|
|
2997
3187
|
PythonParser,
|
|
2998
3188
|
SEVERITY_TIME_ESTIMATES,
|
|
2999
3189
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
3190
|
+
Severity,
|
|
3191
|
+
SeveritySchema,
|
|
3192
|
+
SpokeOutputSchema,
|
|
3000
3193
|
TOOL_NAME_MAP,
|
|
3194
|
+
ToolName,
|
|
3195
|
+
ToolNameSchema,
|
|
3001
3196
|
TypeScriptParser,
|
|
3197
|
+
UnifiedReportSchema,
|
|
3002
3198
|
VAGUE_FILE_NAMES,
|
|
3003
3199
|
calculateAgentGrounding,
|
|
3004
3200
|
calculateAiSignalClarity,
|
|
@@ -3071,5 +3267,6 @@ function getRepoMetadata(directory) {
|
|
|
3071
3267
|
saveScoreEntry,
|
|
3072
3268
|
scanEntries,
|
|
3073
3269
|
scanFiles,
|
|
3074
|
-
validateSpokeOutput
|
|
3270
|
+
validateSpokeOutput,
|
|
3271
|
+
validateWithSchema
|
|
3075
3272
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AnalysisResultSchema,
|
|
3
|
+
AnalysisStatus,
|
|
4
|
+
AnalysisStatusSchema,
|
|
2
5
|
CONTEXT_TIER_THRESHOLDS,
|
|
3
6
|
DEFAULT_TOOL_WEIGHTS,
|
|
7
|
+
FRIENDLY_TOOL_NAMES,
|
|
8
|
+
IssueSchema,
|
|
9
|
+
IssueType,
|
|
10
|
+
IssueTypeSchema,
|
|
4
11
|
LANGUAGE_EXTENSIONS,
|
|
5
12
|
Language,
|
|
13
|
+
LocationSchema,
|
|
14
|
+
MetricsSchema,
|
|
15
|
+
ModelTier,
|
|
16
|
+
ModelTierSchema,
|
|
6
17
|
ParseError,
|
|
7
18
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
19
|
+
Severity,
|
|
20
|
+
SeveritySchema,
|
|
21
|
+
SpokeOutputSchema,
|
|
8
22
|
TOOL_NAME_MAP,
|
|
23
|
+
ToolName,
|
|
24
|
+
ToolNameSchema,
|
|
25
|
+
UnifiedReportSchema,
|
|
9
26
|
calculateOverallScore,
|
|
10
27
|
formatScore,
|
|
11
28
|
formatToolScore,
|
|
@@ -18,7 +35,7 @@ import {
|
|
|
18
35
|
getToolWeight,
|
|
19
36
|
normalizeToolName,
|
|
20
37
|
parseWeightString
|
|
21
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-QAFB3HXQ.mjs";
|
|
22
39
|
|
|
23
40
|
// src/types/contract.ts
|
|
24
41
|
function validateSpokeOutput(toolName, output) {
|
|
@@ -67,6 +84,16 @@ function validateSpokeOutput(toolName, output) {
|
|
|
67
84
|
errors
|
|
68
85
|
};
|
|
69
86
|
}
|
|
87
|
+
function validateWithSchema(schema, data) {
|
|
88
|
+
const result = schema.safeParse(data);
|
|
89
|
+
if (result.success) {
|
|
90
|
+
return { valid: true, data: result.data };
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
valid: false,
|
|
94
|
+
errors: result.error.issues.map((e) => `${e.path.join(".")}: ${e.message}`)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
70
97
|
|
|
71
98
|
// src/utils/file-scanner.ts
|
|
72
99
|
import { glob } from "glob";
|
|
@@ -729,43 +756,47 @@ function estimateCostFromBudget(budget, model, config = {}) {
|
|
|
729
756
|
|
|
730
757
|
// src/business/productivity-metrics.ts
|
|
731
758
|
var SEVERITY_TIME_ESTIMATES = {
|
|
732
|
-
critical: 4,
|
|
733
|
-
major: 2,
|
|
734
|
-
minor: 0.5,
|
|
735
|
-
info: 0.25
|
|
759
|
+
["critical" /* Critical */]: 4,
|
|
760
|
+
["major" /* Major */]: 2,
|
|
761
|
+
["minor" /* Minor */]: 0.5,
|
|
762
|
+
["info" /* Info */]: 0.25
|
|
736
763
|
};
|
|
737
764
|
var DEFAULT_HOURLY_RATE = 75;
|
|
738
765
|
function calculateProductivityImpact(issues, hourlyRate = DEFAULT_HOURLY_RATE) {
|
|
739
766
|
const counts = {
|
|
740
|
-
critical: issues.filter((i) => i.severity === "critical").length,
|
|
741
|
-
major: issues.filter((i) => i.severity === "major").length,
|
|
742
|
-
minor: issues.filter((i) => i.severity === "minor").length,
|
|
743
|
-
info: issues.filter((i) => i.severity === "info").length
|
|
767
|
+
["critical" /* Critical */]: issues.filter((i) => i.severity === "critical" /* Critical */).length,
|
|
768
|
+
["major" /* Major */]: issues.filter((i) => i.severity === "major" /* Major */).length,
|
|
769
|
+
["minor" /* Minor */]: issues.filter((i) => i.severity === "minor" /* Minor */).length,
|
|
770
|
+
["info" /* Info */]: issues.filter((i) => i.severity === "info" /* Info */).length
|
|
744
771
|
};
|
|
745
772
|
const hours = {
|
|
746
|
-
critical: counts
|
|
747
|
-
major: counts
|
|
748
|
-
minor: counts
|
|
749
|
-
info: counts
|
|
773
|
+
["critical" /* Critical */]: counts["critical" /* Critical */] * SEVERITY_TIME_ESTIMATES["critical" /* Critical */],
|
|
774
|
+
["major" /* Major */]: counts["major" /* Major */] * SEVERITY_TIME_ESTIMATES["major" /* Major */],
|
|
775
|
+
["minor" /* Minor */]: counts["minor" /* Minor */] * SEVERITY_TIME_ESTIMATES["minor" /* Minor */],
|
|
776
|
+
["info" /* Info */]: counts["info" /* Info */] * SEVERITY_TIME_ESTIMATES["info" /* Info */]
|
|
750
777
|
};
|
|
751
|
-
const totalHours = hours
|
|
778
|
+
const totalHours = hours["critical" /* Critical */] + hours["major" /* Major */] + hours["minor" /* Minor */] + hours["info" /* Info */];
|
|
752
779
|
const totalCost = totalHours * hourlyRate;
|
|
753
780
|
return {
|
|
754
781
|
totalHours: Math.round(totalHours * 10) / 10,
|
|
755
782
|
hourlyRate,
|
|
756
783
|
totalCost: Math.round(totalCost),
|
|
757
784
|
bySeverity: {
|
|
758
|
-
critical: {
|
|
759
|
-
hours: Math.round(hours
|
|
760
|
-
cost: Math.round(hours
|
|
785
|
+
["critical" /* Critical */]: {
|
|
786
|
+
hours: Math.round(hours["critical" /* Critical */] * 10) / 10,
|
|
787
|
+
cost: Math.round(hours["critical" /* Critical */] * hourlyRate)
|
|
788
|
+
},
|
|
789
|
+
["major" /* Major */]: {
|
|
790
|
+
hours: Math.round(hours["major" /* Major */] * 10) / 10,
|
|
791
|
+
cost: Math.round(hours["major" /* Major */] * hourlyRate)
|
|
761
792
|
},
|
|
762
|
-
|
|
763
|
-
hours: Math.round(hours
|
|
764
|
-
cost: Math.round(hours
|
|
793
|
+
["minor" /* Minor */]: {
|
|
794
|
+
hours: Math.round(hours["minor" /* Minor */] * 10) / 10,
|
|
795
|
+
cost: Math.round(hours["minor" /* Minor */] * hourlyRate)
|
|
765
796
|
},
|
|
766
|
-
|
|
767
|
-
hours: Math.round(hours
|
|
768
|
-
cost: Math.round(hours
|
|
797
|
+
["info" /* Info */]: {
|
|
798
|
+
hours: Math.round(hours["info" /* Info */] * 10) / 10,
|
|
799
|
+
cost: Math.round(hours["info" /* Info */] * hourlyRate)
|
|
769
800
|
}
|
|
770
801
|
}
|
|
771
802
|
};
|
|
@@ -2495,20 +2526,37 @@ function getRepoMetadata(directory) {
|
|
|
2495
2526
|
return metadata;
|
|
2496
2527
|
}
|
|
2497
2528
|
export {
|
|
2529
|
+
AnalysisResultSchema,
|
|
2530
|
+
AnalysisStatus,
|
|
2531
|
+
AnalysisStatusSchema,
|
|
2498
2532
|
CONTEXT_TIER_THRESHOLDS,
|
|
2499
2533
|
DEFAULT_COST_CONFIG,
|
|
2500
2534
|
DEFAULT_EXCLUDE,
|
|
2501
2535
|
DEFAULT_TOOL_WEIGHTS,
|
|
2536
|
+
FRIENDLY_TOOL_NAMES,
|
|
2537
|
+
IssueSchema,
|
|
2538
|
+
IssueType,
|
|
2539
|
+
IssueTypeSchema,
|
|
2502
2540
|
LANGUAGE_EXTENSIONS,
|
|
2503
2541
|
Language,
|
|
2542
|
+
LocationSchema,
|
|
2504
2543
|
MODEL_PRICING_PRESETS,
|
|
2544
|
+
MetricsSchema,
|
|
2545
|
+
ModelTier,
|
|
2546
|
+
ModelTierSchema,
|
|
2505
2547
|
ParseError,
|
|
2506
2548
|
ParserFactory,
|
|
2507
2549
|
PythonParser,
|
|
2508
2550
|
SEVERITY_TIME_ESTIMATES,
|
|
2509
2551
|
SIZE_ADJUSTED_THRESHOLDS,
|
|
2552
|
+
Severity,
|
|
2553
|
+
SeveritySchema,
|
|
2554
|
+
SpokeOutputSchema,
|
|
2510
2555
|
TOOL_NAME_MAP,
|
|
2556
|
+
ToolName,
|
|
2557
|
+
ToolNameSchema,
|
|
2511
2558
|
TypeScriptParser,
|
|
2559
|
+
UnifiedReportSchema,
|
|
2512
2560
|
VAGUE_FILE_NAMES,
|
|
2513
2561
|
calculateAgentGrounding,
|
|
2514
2562
|
calculateAiSignalClarity,
|
|
@@ -2581,5 +2629,6 @@ export {
|
|
|
2581
2629
|
saveScoreEntry,
|
|
2582
2630
|
scanEntries,
|
|
2583
2631
|
scanFiles,
|
|
2584
|
-
validateSpokeOutput
|
|
2632
|
+
validateSpokeOutput,
|
|
2633
|
+
validateWithSchema
|
|
2585
2634
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/core",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.5",
|
|
4
4
|
"description": "Shared utilities for AIReady analysis tools",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"chalk": "^5.4.1",
|
|
49
49
|
"glob": "^13.0.0",
|
|
50
50
|
"ignore": "^7.0.0",
|
|
51
|
-
"typescript": "^5.9.3"
|
|
51
|
+
"typescript": "^5.9.3",
|
|
52
|
+
"zod": "^4.3.6"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"build": "tsup src/index.ts src/client.ts --format cjs,esm --dts",
|