pruneguard 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 ADDED
@@ -0,0 +1,6 @@
1
+ # pruneguard
2
+
3
+ Rust-first repo truth engine for JS/TS monorepos.
4
+
5
+ Build one accurate repo graph, then answer dead-code, dependency, boundary,
6
+ ownership, impact, and explainability questions from the same analysis pass.
package/bin/pruneguard ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import "../dist/bin.mjs";
@@ -0,0 +1,693 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "PruneguardConfig",
4
+ "description": "Top-level configuration for pruneguard.",
5
+ "type": "object",
6
+ "properties": {
7
+ "$schema": {
8
+ "description": "JSON Schema reference.",
9
+ "type": [
10
+ "string",
11
+ "null"
12
+ ]
13
+ },
14
+ "analysis": {
15
+ "description": "Analysis severity levels.",
16
+ "default": {
17
+ "unusedExports": "warn",
18
+ "unusedFiles": "warn",
19
+ "unusedPackages": "warn",
20
+ "unusedDependencies": "warn",
21
+ "cycles": "warn",
22
+ "boundaries": "warn",
23
+ "ownership": "warn",
24
+ "impact": "warn"
25
+ },
26
+ "allOf": [
27
+ {
28
+ "$ref": "#/definitions/AnalysisConfig"
29
+ }
30
+ ]
31
+ },
32
+ "entrypoints": {
33
+ "description": "Entrypoint configuration.",
34
+ "default": {
35
+ "auto": true,
36
+ "includeTests": false,
37
+ "includeStories": false
38
+ },
39
+ "allOf": [
40
+ {
41
+ "$ref": "#/definitions/EntrypointsConfig"
42
+ }
43
+ ]
44
+ },
45
+ "extends": {
46
+ "description": "Configs to extend from.",
47
+ "type": [
48
+ "array",
49
+ "null"
50
+ ],
51
+ "items": {
52
+ "type": "string"
53
+ }
54
+ },
55
+ "frameworks": {
56
+ "description": "Framework detection packs.",
57
+ "anyOf": [
58
+ {
59
+ "$ref": "#/definitions/FrameworksConfig"
60
+ },
61
+ {
62
+ "type": "null"
63
+ }
64
+ ]
65
+ },
66
+ "ignorePatterns": {
67
+ "description": "Glob patterns for files to ignore entirely.",
68
+ "type": "array",
69
+ "items": {
70
+ "type": "string"
71
+ }
72
+ },
73
+ "overrides": {
74
+ "description": "Per-path or per-workspace overrides.",
75
+ "type": "array",
76
+ "items": {
77
+ "$ref": "#/definitions/OverrideConfig"
78
+ }
79
+ },
80
+ "ownership": {
81
+ "description": "Code ownership configuration.",
82
+ "anyOf": [
83
+ {
84
+ "$ref": "#/definitions/OwnershipConfig"
85
+ },
86
+ {
87
+ "type": "null"
88
+ }
89
+ ]
90
+ },
91
+ "resolver": {
92
+ "description": "Module resolver configuration.",
93
+ "default": {
94
+ "respectExports": true,
95
+ "preserveSymlinks": false
96
+ },
97
+ "allOf": [
98
+ {
99
+ "$ref": "#/definitions/ResolverConfig"
100
+ }
101
+ ]
102
+ },
103
+ "rules": {
104
+ "description": "Custom rules.",
105
+ "anyOf": [
106
+ {
107
+ "$ref": "#/definitions/RulesConfig"
108
+ },
109
+ {
110
+ "type": "null"
111
+ }
112
+ ]
113
+ },
114
+ "workspaces": {
115
+ "description": "Workspace configuration.",
116
+ "anyOf": [
117
+ {
118
+ "$ref": "#/definitions/WorkspacesConfig"
119
+ },
120
+ {
121
+ "type": "null"
122
+ }
123
+ ]
124
+ }
125
+ },
126
+ "definitions": {
127
+ "AnalysisConfig": {
128
+ "type": "object",
129
+ "properties": {
130
+ "boundaries": {
131
+ "default": "warn",
132
+ "allOf": [
133
+ {
134
+ "$ref": "#/definitions/AnalysisSeverity"
135
+ }
136
+ ]
137
+ },
138
+ "cycles": {
139
+ "default": "warn",
140
+ "allOf": [
141
+ {
142
+ "$ref": "#/definitions/AnalysisSeverity"
143
+ }
144
+ ]
145
+ },
146
+ "impact": {
147
+ "default": "warn",
148
+ "allOf": [
149
+ {
150
+ "$ref": "#/definitions/AnalysisSeverity"
151
+ }
152
+ ]
153
+ },
154
+ "ownership": {
155
+ "default": "warn",
156
+ "allOf": [
157
+ {
158
+ "$ref": "#/definitions/AnalysisSeverity"
159
+ }
160
+ ]
161
+ },
162
+ "unusedDependencies": {
163
+ "default": "warn",
164
+ "allOf": [
165
+ {
166
+ "$ref": "#/definitions/AnalysisSeverity"
167
+ }
168
+ ]
169
+ },
170
+ "unusedExports": {
171
+ "default": "warn",
172
+ "allOf": [
173
+ {
174
+ "$ref": "#/definitions/AnalysisSeverity"
175
+ }
176
+ ]
177
+ },
178
+ "unusedFiles": {
179
+ "default": "warn",
180
+ "allOf": [
181
+ {
182
+ "$ref": "#/definitions/AnalysisSeverity"
183
+ }
184
+ ]
185
+ },
186
+ "unusedPackages": {
187
+ "default": "warn",
188
+ "allOf": [
189
+ {
190
+ "$ref": "#/definitions/AnalysisSeverity"
191
+ }
192
+ ]
193
+ }
194
+ }
195
+ },
196
+ "AnalysisSeverity": {
197
+ "description": "Severity level for analysis features.",
198
+ "type": "string",
199
+ "enum": [
200
+ "off",
201
+ "info",
202
+ "warn",
203
+ "error"
204
+ ]
205
+ },
206
+ "EntrypointsConfig": {
207
+ "type": "object",
208
+ "properties": {
209
+ "auto": {
210
+ "description": "Auto-detect entrypoints from package.json and conventions.",
211
+ "default": true,
212
+ "type": "boolean"
213
+ },
214
+ "exclude": {
215
+ "description": "Exclude entrypoints matching these globs.",
216
+ "type": "array",
217
+ "items": {
218
+ "type": "string"
219
+ }
220
+ },
221
+ "include": {
222
+ "description": "Additional entrypoint globs.",
223
+ "type": "array",
224
+ "items": {
225
+ "type": "string"
226
+ }
227
+ },
228
+ "includeStories": {
229
+ "description": "Whether to include story files as entrypoints.",
230
+ "default": false,
231
+ "type": "boolean"
232
+ },
233
+ "includeTests": {
234
+ "description": "Whether to include test files as entrypoints.",
235
+ "default": false,
236
+ "type": "boolean"
237
+ },
238
+ "profiles": {
239
+ "description": "Profile-specific entrypoint overrides.",
240
+ "anyOf": [
241
+ {
242
+ "$ref": "#/definitions/ProfilesConfig"
243
+ },
244
+ {
245
+ "type": "null"
246
+ }
247
+ ]
248
+ }
249
+ }
250
+ },
251
+ "FrameworkToggle": {
252
+ "type": "string",
253
+ "enum": [
254
+ "off",
255
+ "auto",
256
+ "on"
257
+ ]
258
+ },
259
+ "FrameworksConfig": {
260
+ "type": "object",
261
+ "properties": {
262
+ "jest": {
263
+ "anyOf": [
264
+ {
265
+ "$ref": "#/definitions/FrameworkToggle"
266
+ },
267
+ {
268
+ "type": "null"
269
+ }
270
+ ]
271
+ },
272
+ "next": {
273
+ "anyOf": [
274
+ {
275
+ "$ref": "#/definitions/FrameworkToggle"
276
+ },
277
+ {
278
+ "type": "null"
279
+ }
280
+ ]
281
+ },
282
+ "storybook": {
283
+ "anyOf": [
284
+ {
285
+ "$ref": "#/definitions/FrameworkToggle"
286
+ },
287
+ {
288
+ "type": "null"
289
+ }
290
+ ]
291
+ },
292
+ "vite": {
293
+ "anyOf": [
294
+ {
295
+ "$ref": "#/definitions/FrameworkToggle"
296
+ },
297
+ {
298
+ "type": "null"
299
+ }
300
+ ]
301
+ },
302
+ "vitest": {
303
+ "anyOf": [
304
+ {
305
+ "$ref": "#/definitions/FrameworkToggle"
306
+ },
307
+ {
308
+ "type": "null"
309
+ }
310
+ ]
311
+ }
312
+ }
313
+ },
314
+ "OverrideConfig": {
315
+ "type": "object",
316
+ "properties": {
317
+ "analysis": {
318
+ "description": "Analysis overrides.",
319
+ "anyOf": [
320
+ {
321
+ "$ref": "#/definitions/AnalysisConfig"
322
+ },
323
+ {
324
+ "type": "null"
325
+ }
326
+ ]
327
+ },
328
+ "entrypoints": {
329
+ "description": "Entrypoint overrides.",
330
+ "anyOf": [
331
+ {
332
+ "$ref": "#/definitions/EntrypointsConfig"
333
+ },
334
+ {
335
+ "type": "null"
336
+ }
337
+ ]
338
+ },
339
+ "files": {
340
+ "description": "File globs this override applies to.",
341
+ "type": "array",
342
+ "items": {
343
+ "type": "string"
344
+ }
345
+ },
346
+ "ignore_patterns": {
347
+ "description": "Additional ignore patterns.",
348
+ "type": "array",
349
+ "items": {
350
+ "type": "string"
351
+ }
352
+ },
353
+ "tags": {
354
+ "description": "Deterministic tags applied to matching files/workspaces.",
355
+ "type": "array",
356
+ "items": {
357
+ "type": "string"
358
+ }
359
+ },
360
+ "workspaces": {
361
+ "description": "Workspace names this override applies to.",
362
+ "type": "array",
363
+ "items": {
364
+ "type": "string"
365
+ }
366
+ }
367
+ }
368
+ },
369
+ "OwnershipConfig": {
370
+ "type": "object",
371
+ "properties": {
372
+ "importCodeowners": {
373
+ "default": false,
374
+ "type": "boolean"
375
+ },
376
+ "teams": {
377
+ "type": [
378
+ "object",
379
+ "null"
380
+ ],
381
+ "additionalProperties": {
382
+ "$ref": "#/definitions/TeamConfig"
383
+ }
384
+ },
385
+ "unownedSeverity": {
386
+ "default": "warn",
387
+ "allOf": [
388
+ {
389
+ "$ref": "#/definitions/AnalysisSeverity"
390
+ }
391
+ ]
392
+ }
393
+ }
394
+ },
395
+ "PackageManager": {
396
+ "type": "string",
397
+ "enum": [
398
+ "auto",
399
+ "pnpm",
400
+ "npm",
401
+ "yarn",
402
+ "bun"
403
+ ]
404
+ },
405
+ "ProfilesConfig": {
406
+ "type": "object",
407
+ "properties": {
408
+ "all": {
409
+ "type": [
410
+ "array",
411
+ "null"
412
+ ],
413
+ "items": {
414
+ "type": "string"
415
+ }
416
+ },
417
+ "development": {
418
+ "type": [
419
+ "array",
420
+ "null"
421
+ ],
422
+ "items": {
423
+ "type": "string"
424
+ }
425
+ },
426
+ "production": {
427
+ "type": [
428
+ "array",
429
+ "null"
430
+ ],
431
+ "items": {
432
+ "type": "string"
433
+ }
434
+ }
435
+ }
436
+ },
437
+ "ResolverConfig": {
438
+ "type": "object",
439
+ "properties": {
440
+ "conditions": {
441
+ "description": "Export conditions to use when resolving package exports.",
442
+ "type": "array",
443
+ "items": {
444
+ "type": "string"
445
+ }
446
+ },
447
+ "extensions": {
448
+ "description": "File extensions to resolve.",
449
+ "type": "array",
450
+ "items": {
451
+ "type": "string"
452
+ }
453
+ },
454
+ "preserveSymlinks": {
455
+ "description": "Whether to preserve symlinks during resolution.",
456
+ "default": false,
457
+ "type": "boolean"
458
+ },
459
+ "respectExports": {
460
+ "description": "Whether to respect the `exports` field in package.json.",
461
+ "default": true,
462
+ "type": "boolean"
463
+ },
464
+ "tsconfig": {
465
+ "description": "Paths to tsconfig files.",
466
+ "type": "array",
467
+ "items": {
468
+ "type": "string"
469
+ }
470
+ }
471
+ }
472
+ },
473
+ "Rule": {
474
+ "type": "object",
475
+ "required": [
476
+ "name"
477
+ ],
478
+ "properties": {
479
+ "comment": {
480
+ "type": [
481
+ "string",
482
+ "null"
483
+ ]
484
+ },
485
+ "from": {
486
+ "anyOf": [
487
+ {
488
+ "$ref": "#/definitions/RuleFilter"
489
+ },
490
+ {
491
+ "type": "null"
492
+ }
493
+ ]
494
+ },
495
+ "name": {
496
+ "type": "string"
497
+ },
498
+ "severity": {
499
+ "default": "warn",
500
+ "allOf": [
501
+ {
502
+ "$ref": "#/definitions/AnalysisSeverity"
503
+ }
504
+ ]
505
+ },
506
+ "to": {
507
+ "anyOf": [
508
+ {
509
+ "$ref": "#/definitions/RuleFilter"
510
+ },
511
+ {
512
+ "type": "null"
513
+ }
514
+ ]
515
+ }
516
+ }
517
+ },
518
+ "RuleFilter": {
519
+ "type": "object",
520
+ "properties": {
521
+ "dependencyKinds": {
522
+ "type": "array",
523
+ "items": {
524
+ "type": "string"
525
+ }
526
+ },
527
+ "entrypointKinds": {
528
+ "type": "array",
529
+ "items": {
530
+ "type": "string"
531
+ }
532
+ },
533
+ "package": {
534
+ "type": "array",
535
+ "items": {
536
+ "type": "string"
537
+ }
538
+ },
539
+ "packageNot": {
540
+ "type": "array",
541
+ "items": {
542
+ "type": "string"
543
+ }
544
+ },
545
+ "path": {
546
+ "type": "array",
547
+ "items": {
548
+ "type": "string"
549
+ }
550
+ },
551
+ "pathNot": {
552
+ "type": "array",
553
+ "items": {
554
+ "type": "string"
555
+ }
556
+ },
557
+ "profiles": {
558
+ "type": "array",
559
+ "items": {
560
+ "type": "string"
561
+ }
562
+ },
563
+ "reachableFrom": {
564
+ "type": [
565
+ "array",
566
+ "null"
567
+ ],
568
+ "items": {
569
+ "type": "string"
570
+ }
571
+ },
572
+ "reaches": {
573
+ "type": [
574
+ "array",
575
+ "null"
576
+ ],
577
+ "items": {
578
+ "type": "string"
579
+ }
580
+ },
581
+ "tag": {
582
+ "type": "array",
583
+ "items": {
584
+ "type": "string"
585
+ }
586
+ },
587
+ "tagNot": {
588
+ "type": "array",
589
+ "items": {
590
+ "type": "string"
591
+ }
592
+ },
593
+ "workspace": {
594
+ "type": "array",
595
+ "items": {
596
+ "type": "string"
597
+ }
598
+ },
599
+ "workspaceNot": {
600
+ "type": "array",
601
+ "items": {
602
+ "type": "string"
603
+ }
604
+ }
605
+ }
606
+ },
607
+ "RulesConfig": {
608
+ "type": "object",
609
+ "properties": {
610
+ "allow": {
611
+ "type": "array",
612
+ "items": {
613
+ "$ref": "#/definitions/Rule"
614
+ }
615
+ },
616
+ "forbidden": {
617
+ "type": "array",
618
+ "items": {
619
+ "$ref": "#/definitions/Rule"
620
+ }
621
+ },
622
+ "required": {
623
+ "type": "array",
624
+ "items": {
625
+ "$ref": "#/definitions/Rule"
626
+ }
627
+ }
628
+ }
629
+ },
630
+ "TeamConfig": {
631
+ "type": "object",
632
+ "properties": {
633
+ "packages": {
634
+ "default": [],
635
+ "type": "array",
636
+ "items": {
637
+ "type": "string"
638
+ }
639
+ },
640
+ "paths": {
641
+ "default": [],
642
+ "type": "array",
643
+ "items": {
644
+ "type": "string"
645
+ }
646
+ },
647
+ "tags": {
648
+ "default": [],
649
+ "type": "array",
650
+ "items": {
651
+ "type": "string"
652
+ }
653
+ }
654
+ }
655
+ },
656
+ "WorkspacesConfig": {
657
+ "type": "object",
658
+ "properties": {
659
+ "exclude": {
660
+ "description": "Exclude workspaces matching these patterns.",
661
+ "type": "array",
662
+ "items": {
663
+ "type": "string"
664
+ }
665
+ },
666
+ "include": {
667
+ "description": "Include only workspaces matching these patterns.",
668
+ "type": "array",
669
+ "items": {
670
+ "type": "string"
671
+ }
672
+ },
673
+ "packageManager": {
674
+ "description": "Package manager to use for workspace discovery.",
675
+ "default": "auto",
676
+ "allOf": [
677
+ {
678
+ "$ref": "#/definitions/PackageManager"
679
+ }
680
+ ]
681
+ },
682
+ "roots": {
683
+ "description": "Workspace root globs (e.g. `[\"apps/*\", \"packages/*\"]`).",
684
+ "default": [],
685
+ "type": "array",
686
+ "items": {
687
+ "type": "string"
688
+ }
689
+ }
690
+ }
691
+ }
692
+ }
693
+ }
package/dist/bin.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { };