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