@aiready/core 0.24.4 → 0.24.6

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