@principal-ai/quality-lens-registry 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +157 -0
- package/dist/index.cjs +677 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +180 -0
- package/dist/index.d.ts +180 -0
- package/dist/index.js +627 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
// src/registry.ts
|
|
2
|
+
var LENS_REGISTRY = [
|
|
3
|
+
// ============================================================
|
|
4
|
+
// LINTING - Code style and bug detection
|
|
5
|
+
// ============================================================
|
|
6
|
+
// TypeScript/JavaScript linting
|
|
7
|
+
{
|
|
8
|
+
id: "eslint",
|
|
9
|
+
name: "ESLint",
|
|
10
|
+
category: "linting",
|
|
11
|
+
languages: ["typescript", "javascript"],
|
|
12
|
+
outputsFileMetrics: true,
|
|
13
|
+
outputsAggregate: true,
|
|
14
|
+
colorScheme: "issues",
|
|
15
|
+
description: "Pluggable linting utility for JavaScript and TypeScript",
|
|
16
|
+
command: "eslint"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "biome-lint",
|
|
20
|
+
name: "Biome Lint",
|
|
21
|
+
category: "linting",
|
|
22
|
+
languages: ["typescript", "javascript"],
|
|
23
|
+
alternativeTo: ["eslint"],
|
|
24
|
+
outputsFileMetrics: true,
|
|
25
|
+
outputsAggregate: true,
|
|
26
|
+
colorScheme: "issues",
|
|
27
|
+
description: "Fast linter for JavaScript and TypeScript",
|
|
28
|
+
command: "biome lint"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "oxlint",
|
|
32
|
+
name: "OxLint",
|
|
33
|
+
category: "linting",
|
|
34
|
+
languages: ["typescript", "javascript"],
|
|
35
|
+
alternativeTo: ["eslint", "biome-lint"],
|
|
36
|
+
outputsFileMetrics: true,
|
|
37
|
+
outputsAggregate: true,
|
|
38
|
+
colorScheme: "issues",
|
|
39
|
+
description: "Blazing fast JavaScript/TypeScript linter",
|
|
40
|
+
command: "oxlint"
|
|
41
|
+
},
|
|
42
|
+
// Python linting
|
|
43
|
+
{
|
|
44
|
+
id: "ruff",
|
|
45
|
+
name: "Ruff",
|
|
46
|
+
category: "linting",
|
|
47
|
+
languages: ["python"],
|
|
48
|
+
alternativeTo: ["pylint", "flake8"],
|
|
49
|
+
outputsFileMetrics: true,
|
|
50
|
+
outputsAggregate: true,
|
|
51
|
+
colorScheme: "issues",
|
|
52
|
+
description: "Extremely fast Python linter",
|
|
53
|
+
command: "ruff check"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "pylint",
|
|
57
|
+
name: "Pylint",
|
|
58
|
+
category: "linting",
|
|
59
|
+
languages: ["python"],
|
|
60
|
+
outputsFileMetrics: true,
|
|
61
|
+
outputsAggregate: true,
|
|
62
|
+
colorScheme: "issues",
|
|
63
|
+
description: "Python static code analyzer",
|
|
64
|
+
command: "pylint"
|
|
65
|
+
},
|
|
66
|
+
// Go linting
|
|
67
|
+
{
|
|
68
|
+
id: "golangci-lint",
|
|
69
|
+
name: "golangci-lint",
|
|
70
|
+
category: "linting",
|
|
71
|
+
languages: ["go"],
|
|
72
|
+
outputsFileMetrics: true,
|
|
73
|
+
outputsAggregate: true,
|
|
74
|
+
colorScheme: "issues",
|
|
75
|
+
description: "Fast linters runner for Go",
|
|
76
|
+
command: "golangci-lint run"
|
|
77
|
+
},
|
|
78
|
+
// Rust linting
|
|
79
|
+
{
|
|
80
|
+
id: "clippy",
|
|
81
|
+
name: "Clippy",
|
|
82
|
+
category: "linting",
|
|
83
|
+
languages: ["rust"],
|
|
84
|
+
outputsFileMetrics: true,
|
|
85
|
+
outputsAggregate: true,
|
|
86
|
+
colorScheme: "issues",
|
|
87
|
+
description: "Rust linter",
|
|
88
|
+
command: "cargo clippy"
|
|
89
|
+
},
|
|
90
|
+
// ============================================================
|
|
91
|
+
// FORMATTING - Code formatting
|
|
92
|
+
// ============================================================
|
|
93
|
+
// TypeScript/JavaScript formatting
|
|
94
|
+
{
|
|
95
|
+
id: "prettier",
|
|
96
|
+
name: "Prettier",
|
|
97
|
+
category: "formatting",
|
|
98
|
+
languages: ["typescript", "javascript"],
|
|
99
|
+
outputsFileMetrics: true,
|
|
100
|
+
outputsAggregate: true,
|
|
101
|
+
colorScheme: "binary",
|
|
102
|
+
description: "Opinionated code formatter",
|
|
103
|
+
command: "prettier --check"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "biome-format",
|
|
107
|
+
name: "Biome Format",
|
|
108
|
+
category: "formatting",
|
|
109
|
+
languages: ["typescript", "javascript"],
|
|
110
|
+
alternativeTo: ["prettier"],
|
|
111
|
+
outputsFileMetrics: true,
|
|
112
|
+
outputsAggregate: true,
|
|
113
|
+
colorScheme: "binary",
|
|
114
|
+
description: "Fast code formatter for JavaScript and TypeScript",
|
|
115
|
+
command: "biome format"
|
|
116
|
+
},
|
|
117
|
+
// Python formatting
|
|
118
|
+
{
|
|
119
|
+
id: "black",
|
|
120
|
+
name: "Black",
|
|
121
|
+
category: "formatting",
|
|
122
|
+
languages: ["python"],
|
|
123
|
+
outputsFileMetrics: true,
|
|
124
|
+
outputsAggregate: true,
|
|
125
|
+
colorScheme: "binary",
|
|
126
|
+
description: "The uncompromising Python code formatter",
|
|
127
|
+
command: "black --check"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "ruff-format",
|
|
131
|
+
name: "Ruff Format",
|
|
132
|
+
category: "formatting",
|
|
133
|
+
languages: ["python"],
|
|
134
|
+
alternativeTo: ["black"],
|
|
135
|
+
outputsFileMetrics: true,
|
|
136
|
+
outputsAggregate: true,
|
|
137
|
+
colorScheme: "binary",
|
|
138
|
+
description: "Fast Python formatter (Ruff)",
|
|
139
|
+
command: "ruff format --check"
|
|
140
|
+
},
|
|
141
|
+
// Go formatting
|
|
142
|
+
{
|
|
143
|
+
id: "gofmt",
|
|
144
|
+
name: "gofmt",
|
|
145
|
+
category: "formatting",
|
|
146
|
+
languages: ["go"],
|
|
147
|
+
outputsFileMetrics: true,
|
|
148
|
+
outputsAggregate: true,
|
|
149
|
+
colorScheme: "binary",
|
|
150
|
+
description: "Go code formatter",
|
|
151
|
+
command: "gofmt -l"
|
|
152
|
+
},
|
|
153
|
+
// Rust formatting
|
|
154
|
+
{
|
|
155
|
+
id: "rustfmt",
|
|
156
|
+
name: "rustfmt",
|
|
157
|
+
category: "formatting",
|
|
158
|
+
languages: ["rust"],
|
|
159
|
+
outputsFileMetrics: true,
|
|
160
|
+
outputsAggregate: true,
|
|
161
|
+
colorScheme: "binary",
|
|
162
|
+
description: "Rust code formatter",
|
|
163
|
+
command: "cargo fmt --check"
|
|
164
|
+
},
|
|
165
|
+
// ============================================================
|
|
166
|
+
// TYPES - Type checking
|
|
167
|
+
// ============================================================
|
|
168
|
+
// TypeScript
|
|
169
|
+
{
|
|
170
|
+
id: "typescript",
|
|
171
|
+
name: "TypeScript",
|
|
172
|
+
category: "types",
|
|
173
|
+
languages: ["typescript"],
|
|
174
|
+
outputsFileMetrics: true,
|
|
175
|
+
outputsAggregate: true,
|
|
176
|
+
colorScheme: "issues",
|
|
177
|
+
description: "TypeScript type checker",
|
|
178
|
+
command: "tsc --noEmit"
|
|
179
|
+
},
|
|
180
|
+
// Python type checking
|
|
181
|
+
{
|
|
182
|
+
id: "mypy",
|
|
183
|
+
name: "MyPy",
|
|
184
|
+
category: "types",
|
|
185
|
+
languages: ["python"],
|
|
186
|
+
outputsFileMetrics: true,
|
|
187
|
+
outputsAggregate: true,
|
|
188
|
+
colorScheme: "issues",
|
|
189
|
+
description: "Static type checker for Python",
|
|
190
|
+
command: "mypy"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: "pyright",
|
|
194
|
+
name: "Pyright",
|
|
195
|
+
category: "types",
|
|
196
|
+
languages: ["python"],
|
|
197
|
+
alternativeTo: ["mypy"],
|
|
198
|
+
outputsFileMetrics: true,
|
|
199
|
+
outputsAggregate: true,
|
|
200
|
+
colorScheme: "issues",
|
|
201
|
+
description: "Static type checker for Python",
|
|
202
|
+
command: "pyright"
|
|
203
|
+
},
|
|
204
|
+
// Go type checking (built into compiler)
|
|
205
|
+
{
|
|
206
|
+
id: "go-vet",
|
|
207
|
+
name: "Go Vet",
|
|
208
|
+
category: "types",
|
|
209
|
+
languages: ["go"],
|
|
210
|
+
outputsFileMetrics: true,
|
|
211
|
+
outputsAggregate: true,
|
|
212
|
+
colorScheme: "issues",
|
|
213
|
+
description: "Go static analyzer",
|
|
214
|
+
command: "go vet"
|
|
215
|
+
},
|
|
216
|
+
// ============================================================
|
|
217
|
+
// TESTS - Test coverage and results
|
|
218
|
+
// ============================================================
|
|
219
|
+
// JavaScript/TypeScript testing
|
|
220
|
+
{
|
|
221
|
+
id: "jest",
|
|
222
|
+
name: "Jest",
|
|
223
|
+
category: "tests",
|
|
224
|
+
languages: ["typescript", "javascript"],
|
|
225
|
+
outputsFileMetrics: true,
|
|
226
|
+
outputsAggregate: true,
|
|
227
|
+
colorScheme: "coverage",
|
|
228
|
+
description: "JavaScript testing framework",
|
|
229
|
+
command: "jest --coverage"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "vitest",
|
|
233
|
+
name: "Vitest",
|
|
234
|
+
category: "tests",
|
|
235
|
+
languages: ["typescript", "javascript"],
|
|
236
|
+
alternativeTo: ["jest"],
|
|
237
|
+
outputsFileMetrics: true,
|
|
238
|
+
outputsAggregate: true,
|
|
239
|
+
colorScheme: "coverage",
|
|
240
|
+
description: "Vite-native testing framework",
|
|
241
|
+
command: "vitest run --coverage"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
id: "bun-test",
|
|
245
|
+
name: "Bun Test",
|
|
246
|
+
category: "tests",
|
|
247
|
+
languages: ["typescript", "javascript"],
|
|
248
|
+
alternativeTo: ["jest", "vitest"],
|
|
249
|
+
outputsFileMetrics: true,
|
|
250
|
+
outputsAggregate: true,
|
|
251
|
+
colorScheme: "coverage",
|
|
252
|
+
description: "Bun native test runner",
|
|
253
|
+
command: "bun test"
|
|
254
|
+
},
|
|
255
|
+
// Python testing
|
|
256
|
+
{
|
|
257
|
+
id: "pytest",
|
|
258
|
+
name: "Pytest",
|
|
259
|
+
category: "tests",
|
|
260
|
+
languages: ["python"],
|
|
261
|
+
outputsFileMetrics: true,
|
|
262
|
+
outputsAggregate: true,
|
|
263
|
+
colorScheme: "coverage",
|
|
264
|
+
description: "Python testing framework",
|
|
265
|
+
command: "pytest --cov"
|
|
266
|
+
},
|
|
267
|
+
// Go testing
|
|
268
|
+
{
|
|
269
|
+
id: "go-test",
|
|
270
|
+
name: "Go Test",
|
|
271
|
+
category: "tests",
|
|
272
|
+
languages: ["go"],
|
|
273
|
+
outputsFileMetrics: true,
|
|
274
|
+
outputsAggregate: true,
|
|
275
|
+
colorScheme: "coverage",
|
|
276
|
+
description: "Go test runner",
|
|
277
|
+
command: "go test -cover"
|
|
278
|
+
},
|
|
279
|
+
// Rust testing
|
|
280
|
+
{
|
|
281
|
+
id: "cargo-test",
|
|
282
|
+
name: "Cargo Test",
|
|
283
|
+
category: "tests",
|
|
284
|
+
languages: ["rust"],
|
|
285
|
+
outputsFileMetrics: true,
|
|
286
|
+
outputsAggregate: true,
|
|
287
|
+
colorScheme: "coverage",
|
|
288
|
+
description: "Rust test runner",
|
|
289
|
+
command: "cargo test"
|
|
290
|
+
},
|
|
291
|
+
// ============================================================
|
|
292
|
+
// DEAD CODE - Unused code detection
|
|
293
|
+
// ============================================================
|
|
294
|
+
// TypeScript/JavaScript
|
|
295
|
+
{
|
|
296
|
+
id: "knip",
|
|
297
|
+
name: "Knip",
|
|
298
|
+
category: "dead-code",
|
|
299
|
+
languages: ["typescript", "javascript"],
|
|
300
|
+
outputsFileMetrics: true,
|
|
301
|
+
outputsAggregate: true,
|
|
302
|
+
colorScheme: "issues",
|
|
303
|
+
description: "Find unused files, dependencies and exports",
|
|
304
|
+
command: "knip"
|
|
305
|
+
},
|
|
306
|
+
// Python
|
|
307
|
+
{
|
|
308
|
+
id: "vulture",
|
|
309
|
+
name: "Vulture",
|
|
310
|
+
category: "dead-code",
|
|
311
|
+
languages: ["python"],
|
|
312
|
+
outputsFileMetrics: true,
|
|
313
|
+
outputsAggregate: true,
|
|
314
|
+
colorScheme: "issues",
|
|
315
|
+
description: "Find dead Python code",
|
|
316
|
+
command: "vulture"
|
|
317
|
+
},
|
|
318
|
+
// ============================================================
|
|
319
|
+
// DOCUMENTATION - Documentation coverage
|
|
320
|
+
// ============================================================
|
|
321
|
+
{
|
|
322
|
+
id: "alexandria",
|
|
323
|
+
name: "Alexandria",
|
|
324
|
+
category: "documentation",
|
|
325
|
+
languages: ["typescript", "javascript"],
|
|
326
|
+
outputsFileMetrics: true,
|
|
327
|
+
outputsAggregate: true,
|
|
328
|
+
colorScheme: "binary",
|
|
329
|
+
description: "Documentation coverage checker",
|
|
330
|
+
command: "alexandria lint"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: "typedoc",
|
|
334
|
+
name: "TypeDoc",
|
|
335
|
+
category: "documentation",
|
|
336
|
+
languages: ["typescript"],
|
|
337
|
+
outputsFileMetrics: false,
|
|
338
|
+
outputsAggregate: true,
|
|
339
|
+
colorScheme: "coverage",
|
|
340
|
+
description: "TypeScript documentation generator",
|
|
341
|
+
command: "typedoc"
|
|
342
|
+
},
|
|
343
|
+
// ============================================================
|
|
344
|
+
// SECURITY - Security scanning
|
|
345
|
+
// ============================================================
|
|
346
|
+
{
|
|
347
|
+
id: "npm-audit",
|
|
348
|
+
name: "npm audit",
|
|
349
|
+
category: "security",
|
|
350
|
+
languages: ["typescript", "javascript"],
|
|
351
|
+
outputsFileMetrics: false,
|
|
352
|
+
outputsAggregate: true,
|
|
353
|
+
colorScheme: "issues",
|
|
354
|
+
description: "Check for known vulnerabilities in dependencies",
|
|
355
|
+
command: "npm audit"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
id: "bandit",
|
|
359
|
+
name: "Bandit",
|
|
360
|
+
category: "security",
|
|
361
|
+
languages: ["python"],
|
|
362
|
+
outputsFileMetrics: true,
|
|
363
|
+
outputsAggregate: true,
|
|
364
|
+
colorScheme: "issues",
|
|
365
|
+
description: "Python security linter",
|
|
366
|
+
command: "bandit -r"
|
|
367
|
+
}
|
|
368
|
+
];
|
|
369
|
+
var CATEGORY_CONFIGS = [
|
|
370
|
+
{
|
|
371
|
+
id: "linting",
|
|
372
|
+
name: "Linting",
|
|
373
|
+
description: "Code style and bug detection",
|
|
374
|
+
icon: "AlertCircle"
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
id: "formatting",
|
|
378
|
+
name: "Formatting",
|
|
379
|
+
description: "Code formatting consistency",
|
|
380
|
+
icon: "AlignLeft"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
id: "types",
|
|
384
|
+
name: "Types",
|
|
385
|
+
description: "Type safety and checking",
|
|
386
|
+
icon: "FileType"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
id: "tests",
|
|
390
|
+
name: "Tests",
|
|
391
|
+
description: "Test coverage and results",
|
|
392
|
+
icon: "TestTube"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
id: "dead-code",
|
|
396
|
+
name: "Dead Code",
|
|
397
|
+
description: "Unused code detection",
|
|
398
|
+
icon: "Trash2",
|
|
399
|
+
invertedScale: true
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
id: "documentation",
|
|
403
|
+
name: "Documentation",
|
|
404
|
+
description: "Documentation coverage",
|
|
405
|
+
icon: "FileText"
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
id: "security",
|
|
409
|
+
name: "Security",
|
|
410
|
+
description: "Security vulnerability scanning",
|
|
411
|
+
icon: "Shield"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
id: "complexity",
|
|
415
|
+
name: "Complexity",
|
|
416
|
+
description: "Code complexity metrics",
|
|
417
|
+
icon: "GitBranch"
|
|
418
|
+
}
|
|
419
|
+
];
|
|
420
|
+
var LANGUAGE_CONFIGS = [
|
|
421
|
+
{
|
|
422
|
+
id: "typescript",
|
|
423
|
+
name: "TypeScript",
|
|
424
|
+
extensions: [".ts", ".tsx", ".mts", ".cts"],
|
|
425
|
+
icon: "TS"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
id: "javascript",
|
|
429
|
+
name: "JavaScript",
|
|
430
|
+
extensions: [".js", ".jsx", ".mjs", ".cjs"],
|
|
431
|
+
icon: "JS"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
id: "python",
|
|
435
|
+
name: "Python",
|
|
436
|
+
extensions: [".py", ".pyi"],
|
|
437
|
+
icon: "PY"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
id: "go",
|
|
441
|
+
name: "Go",
|
|
442
|
+
extensions: [".go"],
|
|
443
|
+
icon: "GO"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
id: "rust",
|
|
447
|
+
name: "Rust",
|
|
448
|
+
extensions: [".rs"],
|
|
449
|
+
icon: "RS"
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
id: "java",
|
|
453
|
+
name: "Java",
|
|
454
|
+
extensions: [".java"],
|
|
455
|
+
icon: "JV"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
id: "csharp",
|
|
459
|
+
name: "C#",
|
|
460
|
+
extensions: [".cs"],
|
|
461
|
+
icon: "C#"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
id: "ruby",
|
|
465
|
+
name: "Ruby",
|
|
466
|
+
extensions: [".rb"],
|
|
467
|
+
icon: "RB"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
id: "php",
|
|
471
|
+
name: "PHP",
|
|
472
|
+
extensions: [".php"],
|
|
473
|
+
icon: "PHP"
|
|
474
|
+
}
|
|
475
|
+
];
|
|
476
|
+
|
|
477
|
+
// src/helpers.ts
|
|
478
|
+
function getLensById(id) {
|
|
479
|
+
return LENS_REGISTRY.find((lens) => lens.id === id);
|
|
480
|
+
}
|
|
481
|
+
function getLensesByCategory(category) {
|
|
482
|
+
return LENS_REGISTRY.filter((lens) => lens.category === category);
|
|
483
|
+
}
|
|
484
|
+
function getLensesByLanguage(language) {
|
|
485
|
+
return LENS_REGISTRY.filter((lens) => lens.languages.includes(language));
|
|
486
|
+
}
|
|
487
|
+
function getLensesByCategoryAndLanguage(category, language) {
|
|
488
|
+
return LENS_REGISTRY.filter(
|
|
489
|
+
(lens) => lens.category === category && lens.languages.includes(language)
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
function getCategoryForLens(lensId) {
|
|
493
|
+
return getLensById(lensId)?.category;
|
|
494
|
+
}
|
|
495
|
+
function getAlternatives(lensId) {
|
|
496
|
+
const lens = getLensById(lensId);
|
|
497
|
+
if (!lens) return [];
|
|
498
|
+
const listedAsAlternative = LENS_REGISTRY.filter(
|
|
499
|
+
(other) => other.alternativeTo?.includes(lensId)
|
|
500
|
+
);
|
|
501
|
+
const thisListsAsAlternative = lens.alternativeTo ? LENS_REGISTRY.filter((other) => lens.alternativeTo.includes(other.id)) : [];
|
|
502
|
+
const all = [...listedAsAlternative, ...thisListsAsAlternative];
|
|
503
|
+
return Array.from(new Map(all.map((l) => [l.id, l])).values());
|
|
504
|
+
}
|
|
505
|
+
function areLensesAlternatives(lensId1, lensId2) {
|
|
506
|
+
const lens1 = getLensById(lensId1);
|
|
507
|
+
const lens2 = getLensById(lensId2);
|
|
508
|
+
if (!lens1 || !lens2) return false;
|
|
509
|
+
if (lens1.category !== lens2.category) return false;
|
|
510
|
+
return lens1.alternativeTo?.includes(lensId2) || lens2.alternativeTo?.includes(lensId1) || false;
|
|
511
|
+
}
|
|
512
|
+
function getLensesWithFileMetrics() {
|
|
513
|
+
return LENS_REGISTRY.filter((lens) => lens.outputsFileMetrics);
|
|
514
|
+
}
|
|
515
|
+
function getLensesWithAggregates() {
|
|
516
|
+
return LENS_REGISTRY.filter((lens) => lens.outputsAggregate);
|
|
517
|
+
}
|
|
518
|
+
function getColorModeForCategory(category, lensesRan) {
|
|
519
|
+
const lensesInCategory = getLensesByCategory(category);
|
|
520
|
+
for (const lensId of lensesRan) {
|
|
521
|
+
if (lensesInCategory.some((lens) => lens.id === lensId)) {
|
|
522
|
+
return lensId;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return null;
|
|
526
|
+
}
|
|
527
|
+
function getLensDisplayName(lensId) {
|
|
528
|
+
return getLensById(lensId)?.name ?? lensId;
|
|
529
|
+
}
|
|
530
|
+
function getLensColorScheme(lensId) {
|
|
531
|
+
return getLensById(lensId)?.colorScheme ?? "issues";
|
|
532
|
+
}
|
|
533
|
+
function getCategoryConfig(category) {
|
|
534
|
+
return CATEGORY_CONFIGS.find((c) => c.id === category);
|
|
535
|
+
}
|
|
536
|
+
function getCategoryDisplayName(category) {
|
|
537
|
+
return getCategoryConfig(category)?.name ?? category;
|
|
538
|
+
}
|
|
539
|
+
function isCategoryInverted(category) {
|
|
540
|
+
return getCategoryConfig(category)?.invertedScale ?? false;
|
|
541
|
+
}
|
|
542
|
+
function getLanguageConfig(language) {
|
|
543
|
+
return LANGUAGE_CONFIGS.find((l) => l.id === language);
|
|
544
|
+
}
|
|
545
|
+
function detectLanguageFromExtension(extension) {
|
|
546
|
+
const normalizedExt = extension.startsWith(".") ? extension : `.${extension}`;
|
|
547
|
+
const config = LANGUAGE_CONFIGS.find(
|
|
548
|
+
(l) => l.extensions.includes(normalizedExt.toLowerCase())
|
|
549
|
+
);
|
|
550
|
+
return config?.id;
|
|
551
|
+
}
|
|
552
|
+
function getLanguagesForCategory(category) {
|
|
553
|
+
const lenses = getLensesByCategory(category);
|
|
554
|
+
const languages = /* @__PURE__ */ new Set();
|
|
555
|
+
for (const lens of lenses) {
|
|
556
|
+
for (const lang of lens.languages) {
|
|
557
|
+
languages.add(lang);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return Array.from(languages);
|
|
561
|
+
}
|
|
562
|
+
function isValidLensId(lensId) {
|
|
563
|
+
return getLensById(lensId) !== void 0;
|
|
564
|
+
}
|
|
565
|
+
function findCategoryConflicts(lensesRan) {
|
|
566
|
+
const byCategory = /* @__PURE__ */ new Map();
|
|
567
|
+
for (const lensId of lensesRan) {
|
|
568
|
+
const category = getCategoryForLens(lensId);
|
|
569
|
+
if (category) {
|
|
570
|
+
const existing = byCategory.get(category) || [];
|
|
571
|
+
existing.push(lensId);
|
|
572
|
+
byCategory.set(category, existing);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
const conflicts = [];
|
|
576
|
+
for (const [category, lenses] of byCategory) {
|
|
577
|
+
if (lenses.length > 1) {
|
|
578
|
+
conflicts.push({ category, lenses });
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return conflicts;
|
|
582
|
+
}
|
|
583
|
+
function validateLensOutputs(lensesRan, fileMetricsProduced, aggregatesProduced) {
|
|
584
|
+
const issues = [];
|
|
585
|
+
for (const lensId of lensesRan) {
|
|
586
|
+
const lens = getLensById(lensId);
|
|
587
|
+
if (!lens) continue;
|
|
588
|
+
const missing = [];
|
|
589
|
+
if (lens.outputsFileMetrics && !fileMetricsProduced.includes(lensId)) {
|
|
590
|
+
missing.push("fileMetrics");
|
|
591
|
+
}
|
|
592
|
+
if (lens.outputsAggregate && !aggregatesProduced.includes(lensId)) {
|
|
593
|
+
missing.push("aggregate");
|
|
594
|
+
}
|
|
595
|
+
if (missing.length > 0) {
|
|
596
|
+
issues.push({ lensId, missing });
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
return issues;
|
|
600
|
+
}
|
|
601
|
+
export {
|
|
602
|
+
CATEGORY_CONFIGS,
|
|
603
|
+
LANGUAGE_CONFIGS,
|
|
604
|
+
LENS_REGISTRY,
|
|
605
|
+
areLensesAlternatives,
|
|
606
|
+
detectLanguageFromExtension,
|
|
607
|
+
findCategoryConflicts,
|
|
608
|
+
getAlternatives,
|
|
609
|
+
getCategoryConfig,
|
|
610
|
+
getCategoryDisplayName,
|
|
611
|
+
getCategoryForLens,
|
|
612
|
+
getColorModeForCategory,
|
|
613
|
+
getLanguageConfig,
|
|
614
|
+
getLanguagesForCategory,
|
|
615
|
+
getLensById,
|
|
616
|
+
getLensColorScheme,
|
|
617
|
+
getLensDisplayName,
|
|
618
|
+
getLensesByCategory,
|
|
619
|
+
getLensesByCategoryAndLanguage,
|
|
620
|
+
getLensesByLanguage,
|
|
621
|
+
getLensesWithAggregates,
|
|
622
|
+
getLensesWithFileMetrics,
|
|
623
|
+
isCategoryInverted,
|
|
624
|
+
isValidLensId,
|
|
625
|
+
validateLensOutputs
|
|
626
|
+
};
|
|
627
|
+
//# sourceMappingURL=index.js.map
|