pruneguard 0.3.1 → 0.4.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.
@@ -21,7 +21,10 @@
21
21
  "cycles": "warn",
22
22
  "boundaries": "warn",
23
23
  "ownership": "warn",
24
- "impact": "warn"
24
+ "impact": "warn",
25
+ "unusedMembers": "warn",
26
+ "duplicateExports": "warn",
27
+ "ignoreExportsUsedInFile": false
25
28
  },
26
29
  "allOf": [
27
30
  {
@@ -34,7 +37,8 @@
34
37
  "default": {
35
38
  "auto": true,
36
39
  "includeTests": false,
37
- "includeStories": false
40
+ "includeStories": false,
41
+ "includeEntryExports": false
38
42
  },
39
43
  "allOf": [
40
44
  {
@@ -63,6 +67,13 @@
63
67
  }
64
68
  ]
65
69
  },
70
+ "ignoreIssues": {
71
+ "description": "Suppress specific finding kinds from the report.",
72
+ "type": "array",
73
+ "items": {
74
+ "$ref": "#/definitions/IgnoreIssueRule"
75
+ }
76
+ },
66
77
  "ignorePatterns": {
67
78
  "description": "Glob patterns for files to ignore entirely.",
68
79
  "type": "array",
@@ -92,7 +103,18 @@
92
103
  "description": "Module resolver configuration.",
93
104
  "default": {
94
105
  "respectExports": true,
95
- "preserveSymlinks": false
106
+ "preserveSymlinks": false,
107
+ "detectRequireResolve": true,
108
+ "detectImportMetaResolve": true,
109
+ "detectImportMetaGlob": true,
110
+ "detectRequireContext": true,
111
+ "detectUrlConstructor": true,
112
+ "detectJsdocImports": true,
113
+ "detectTripleSlash": true,
114
+ "detectImportEquals": true,
115
+ "detectTypeImports": true,
116
+ "detectWebpackAliases": true,
117
+ "detectBabelAliases": true
96
118
  },
97
119
  "allOf": [
98
120
  {
@@ -143,6 +165,20 @@
143
165
  }
144
166
  ]
145
167
  },
168
+ "duplicateExports": {
169
+ "description": "Report duplicate exports (same symbol re-exported from multiple paths).",
170
+ "default": "warn",
171
+ "allOf": [
172
+ {
173
+ "$ref": "#/definitions/AnalysisSeverity"
174
+ }
175
+ ]
176
+ },
177
+ "ignoreExportsUsedInFile": {
178
+ "description": "When true, exports consumed only within the same file are still reported as unused.",
179
+ "default": false,
180
+ "type": "boolean"
181
+ },
146
182
  "impact": {
147
183
  "default": "warn",
148
184
  "allOf": [
@@ -183,6 +219,15 @@
183
219
  }
184
220
  ]
185
221
  },
222
+ "unusedMembers": {
223
+ "description": "Report unused exported class/enum members (methods, properties, variants).",
224
+ "default": "warn",
225
+ "allOf": [
226
+ {
227
+ "$ref": "#/definitions/AnalysisSeverity"
228
+ }
229
+ ]
230
+ },
186
231
  "unusedPackages": {
187
232
  "default": "warn",
188
233
  "allOf": [
@@ -225,6 +270,11 @@
225
270
  "type": "string"
226
271
  }
227
272
  },
273
+ "includeEntryExports": {
274
+ "description": "When true, runtime entrypoint exports are eligible to be reported as unused. By default (`false`), only public-API entrypoint exports are checked.",
275
+ "default": false,
276
+ "type": "boolean"
277
+ },
228
278
  "includeStories": {
229
279
  "description": "Whether to include story files as entrypoints.",
230
280
  "default": false,
@@ -421,6 +471,68 @@
421
471
  }
422
472
  }
423
473
  },
474
+ "IgnoreIssueRule": {
475
+ "description": "Rule for suppressing specific finding kinds.",
476
+ "type": "object",
477
+ "required": [
478
+ "kind"
479
+ ],
480
+ "properties": {
481
+ "codes": {
482
+ "description": "Additional finding codes to match (beyond the primary `kind`).",
483
+ "type": "array",
484
+ "items": {
485
+ "type": "string"
486
+ }
487
+ },
488
+ "comment": {
489
+ "description": "Optional comment explaining why this is suppressed.",
490
+ "type": [
491
+ "string",
492
+ "null"
493
+ ]
494
+ },
495
+ "files": {
496
+ "description": "Optional glob patterns — only suppress in matching files.",
497
+ "type": "array",
498
+ "items": {
499
+ "type": "string"
500
+ }
501
+ },
502
+ "kind": {
503
+ "description": "The finding kind to suppress (e.g. \"unusedExport\", \"unusedFile\", \"cycle\").",
504
+ "type": "string"
505
+ },
506
+ "packages": {
507
+ "description": "Package names to scope this rule to.",
508
+ "type": "array",
509
+ "items": {
510
+ "type": "string"
511
+ }
512
+ },
513
+ "parentSymbols": {
514
+ "description": "Parent symbol names to scope this rule to.",
515
+ "type": "array",
516
+ "items": {
517
+ "type": "string"
518
+ }
519
+ },
520
+ "symbols": {
521
+ "description": "Symbol names to scope this rule to.",
522
+ "type": "array",
523
+ "items": {
524
+ "type": "string"
525
+ }
526
+ },
527
+ "workspaces": {
528
+ "description": "Workspace names to scope this rule to.",
529
+ "type": "array",
530
+ "items": {
531
+ "type": "string"
532
+ }
533
+ }
534
+ }
535
+ },
424
536
  "OverrideConfig": {
425
537
  "type": "object",
426
538
  "properties": {
@@ -554,6 +666,61 @@
554
666
  "type": "string"
555
667
  }
556
668
  },
669
+ "detectBabelAliases": {
670
+ "description": "Whether to detect Babel alias patterns.",
671
+ "default": true,
672
+ "type": "boolean"
673
+ },
674
+ "detectImportEquals": {
675
+ "description": "Whether to detect TypeScript `import =` statements.",
676
+ "default": true,
677
+ "type": "boolean"
678
+ },
679
+ "detectImportMetaGlob": {
680
+ "description": "Whether to detect `import.meta.glob()` calls.",
681
+ "default": true,
682
+ "type": "boolean"
683
+ },
684
+ "detectImportMetaResolve": {
685
+ "description": "Whether to detect `import.meta.resolve()` calls.",
686
+ "default": true,
687
+ "type": "boolean"
688
+ },
689
+ "detectJsdocImports": {
690
+ "description": "Whether to detect JSDoc `@import` tags.",
691
+ "default": true,
692
+ "type": "boolean"
693
+ },
694
+ "detectRequireContext": {
695
+ "description": "Whether to detect `require.context()` calls.",
696
+ "default": true,
697
+ "type": "boolean"
698
+ },
699
+ "detectRequireResolve": {
700
+ "description": "Whether to detect `require.resolve()` calls.",
701
+ "default": true,
702
+ "type": "boolean"
703
+ },
704
+ "detectTripleSlash": {
705
+ "description": "Whether to detect triple-slash reference directives.",
706
+ "default": true,
707
+ "type": "boolean"
708
+ },
709
+ "detectTypeImports": {
710
+ "description": "Whether to detect type-only imports.",
711
+ "default": true,
712
+ "type": "boolean"
713
+ },
714
+ "detectUrlConstructor": {
715
+ "description": "Whether to detect `new URL()` constructor patterns.",
716
+ "default": true,
717
+ "type": "boolean"
718
+ },
719
+ "detectWebpackAliases": {
720
+ "description": "Whether to detect webpack alias patterns.",
721
+ "default": true,
722
+ "type": "boolean"
723
+ },
557
724
  "extensions": {
558
725
  "description": "File extensions to resolve.",
559
726
  "type": "array",
@@ -0,0 +1,183 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "DaemonStatusReport",
4
+ "description": "Daemon status report for querying daemon health from JS or CLI.",
5
+ "type": "object",
6
+ "required": [
7
+ "running"
8
+ ],
9
+ "properties": {
10
+ "binaryPath": {
11
+ "description": "Absolute path to the daemon binary.",
12
+ "type": [
13
+ "string",
14
+ "null"
15
+ ]
16
+ },
17
+ "configChangePending": {
18
+ "description": "Whether a config-level change is pending that requires full rebuild.",
19
+ "type": [
20
+ "boolean",
21
+ "null"
22
+ ]
23
+ },
24
+ "generation": {
25
+ "description": "Current generation (rebuild counter) of the index.",
26
+ "type": [
27
+ "integer",
28
+ "null"
29
+ ],
30
+ "format": "uint64",
31
+ "minimum": 0.0
32
+ },
33
+ "graphEdges": {
34
+ "description": "Number of edges in the module graph.",
35
+ "type": [
36
+ "integer",
37
+ "null"
38
+ ],
39
+ "format": "uint",
40
+ "minimum": 0.0
41
+ },
42
+ "graphNodes": {
43
+ "description": "Number of nodes in the module graph.",
44
+ "type": [
45
+ "integer",
46
+ "null"
47
+ ],
48
+ "format": "uint",
49
+ "minimum": 0.0
50
+ },
51
+ "incrementalRebuilds": {
52
+ "description": "Number of incremental rebuilds since daemon start.",
53
+ "type": [
54
+ "integer",
55
+ "null"
56
+ ],
57
+ "format": "uint64",
58
+ "minimum": 0.0
59
+ },
60
+ "indexWarm": {
61
+ "description": "Whether the hot index has been warmed (initial build complete).",
62
+ "type": [
63
+ "boolean",
64
+ "null"
65
+ ]
66
+ },
67
+ "initialBuildMs": {
68
+ "description": "Milliseconds the initial graph build took.",
69
+ "type": [
70
+ "integer",
71
+ "null"
72
+ ],
73
+ "format": "uint64",
74
+ "minimum": 0.0
75
+ },
76
+ "lastRebuildMs": {
77
+ "description": "Milliseconds the last incremental rebuild took.",
78
+ "type": [
79
+ "integer",
80
+ "null"
81
+ ],
82
+ "format": "uint64",
83
+ "minimum": 0.0
84
+ },
85
+ "lastUpdateMs": {
86
+ "description": "Milliseconds since the last graph update.",
87
+ "type": [
88
+ "integer",
89
+ "null"
90
+ ],
91
+ "format": "uint64",
92
+ "minimum": 0.0
93
+ },
94
+ "pendingInvalidations": {
95
+ "description": "Number of files pending invalidation.",
96
+ "type": [
97
+ "integer",
98
+ "null"
99
+ ],
100
+ "format": "uint",
101
+ "minimum": 0.0
102
+ },
103
+ "pid": {
104
+ "description": "Process ID of the running daemon, if any.",
105
+ "type": [
106
+ "integer",
107
+ "null"
108
+ ],
109
+ "format": "uint32",
110
+ "minimum": 0.0
111
+ },
112
+ "port": {
113
+ "description": "TCP port the daemon is listening on, if any.",
114
+ "type": [
115
+ "integer",
116
+ "null"
117
+ ],
118
+ "format": "uint16",
119
+ "minimum": 0.0
120
+ },
121
+ "projectRoot": {
122
+ "description": "Absolute path to the project root the daemon is serving.",
123
+ "type": [
124
+ "string",
125
+ "null"
126
+ ]
127
+ },
128
+ "running": {
129
+ "description": "Whether a daemon process is currently running.",
130
+ "type": "boolean"
131
+ },
132
+ "startedAt": {
133
+ "description": "ISO-8601 timestamp when the daemon started.",
134
+ "type": [
135
+ "string",
136
+ "null"
137
+ ]
138
+ },
139
+ "totalInvalidations": {
140
+ "description": "Total number of files invalidated since daemon start.",
141
+ "type": [
142
+ "integer",
143
+ "null"
144
+ ],
145
+ "format": "uint64",
146
+ "minimum": 0.0
147
+ },
148
+ "uptimeSecs": {
149
+ "description": "Uptime of the daemon in seconds.",
150
+ "type": [
151
+ "integer",
152
+ "null"
153
+ ],
154
+ "format": "uint64",
155
+ "minimum": 0.0
156
+ },
157
+ "version": {
158
+ "description": "Version of the running daemon binary.",
159
+ "type": [
160
+ "string",
161
+ "null"
162
+ ]
163
+ },
164
+ "watchedFiles": {
165
+ "description": "Number of files being watched for changes.",
166
+ "type": [
167
+ "integer",
168
+ "null"
169
+ ],
170
+ "format": "uint",
171
+ "minimum": 0.0
172
+ },
173
+ "watcherLagMs": {
174
+ "description": "Milliseconds of watcher lag (time since last fs event was processed).",
175
+ "type": [
176
+ "integer",
177
+ "null"
178
+ ],
179
+ "format": "uint64",
180
+ "minimum": 0.0
181
+ }
182
+ }
183
+ }
package/dist/index.d.mts CHANGED
@@ -126,6 +126,8 @@ type AnalysisReport = {
126
126
  ruleName?: string;
127
127
  primaryActionKind?: string;
128
128
  actionKinds?: string[];
129
+ trustNotes?: string[];
130
+ frameworkContext?: string[];
129
131
  }>;
130
132
  entrypoints: Array<{
131
133
  path: string;
@@ -133,6 +135,9 @@ type AnalysisReport = {
133
135
  profile: string;
134
136
  workspace?: string;
135
137
  source: string;
138
+ framework?: string;
139
+ reason?: string;
140
+ heuristic?: boolean;
136
141
  }>;
137
142
  stats: {
138
143
  durationMs: number;
@@ -147,6 +152,7 @@ type AnalysisReport = {
147
152
  tsconfigPathMiss: number;
148
153
  exportsConditionMiss: number;
149
154
  externalized: number;
155
+ workspaceExportsMiss: number;
150
156
  };
151
157
  resolvedViaExports: number;
152
158
  entrypointsDetected: number;
@@ -177,6 +183,16 @@ type AnalysisReport = {
177
183
  cacheEntriesRead: number;
178
184
  cacheEntriesWritten: number;
179
185
  affectedScopeIncomplete: boolean;
186
+ frameworksDetected: string[];
187
+ heuristicFrameworks: string[];
188
+ heuristicEntrypoints: number;
189
+ compatibilityWarnings: string[];
190
+ strictTrustApplied: boolean;
191
+ frameworkConfidenceCounts: {
192
+ exact: number;
193
+ heuristic: number;
194
+ unsupported: number;
195
+ };
180
196
  executionMode?: "oneshot" | "daemon";
181
197
  indexWarm?: boolean;
182
198
  indexAgeMs?: number;
@@ -223,6 +239,7 @@ type ReviewOptions = {
223
239
  baseRef?: string;
224
240
  noCache?: boolean;
225
241
  noBaseline?: boolean;
242
+ strictTrust?: boolean;
226
243
  };
227
244
  type ReviewReport = {
228
245
  baseRef?: string;
@@ -239,6 +256,7 @@ type ReviewReport = {
239
256
  medium: number;
240
257
  low: number;
241
258
  };
259
+ executionMode?: "oneshot" | "daemon";
242
260
  };
243
261
  recommendations: string[];
244
262
  proposedActions?: Array<{
@@ -256,6 +274,15 @@ type ReviewReport = {
256
274
  risk: "low" | "medium" | "high";
257
275
  confidence: "high" | "medium" | "low";
258
276
  }>;
277
+ compatibilityWarnings?: string[];
278
+ strictTrustApplied?: boolean;
279
+ recommendedActions?: Array<{
280
+ kind: string;
281
+ description: string;
282
+ priority: number;
283
+ command?: string;
284
+ targets?: string[];
285
+ }>;
259
286
  executionMode?: "oneshot" | "daemon";
260
287
  latencyMs?: number;
261
288
  };
@@ -270,20 +297,45 @@ type SafeDeleteReport = {
270
297
  targets: string[];
271
298
  safe: Array<{
272
299
  target: string;
300
+ classification: "safe" | "needs-review" | "blocked";
273
301
  confidence?: "high" | "medium" | "low";
274
302
  reasons: string[];
303
+ evidence: Array<{
304
+ kind: string;
305
+ file?: string;
306
+ line?: number;
307
+ description: string;
308
+ }>;
275
309
  }>;
276
310
  needsReview: Array<{
277
311
  target: string;
312
+ classification: "safe" | "needs-review" | "blocked";
278
313
  confidence?: "high" | "medium" | "low";
279
314
  reasons: string[];
315
+ evidence: Array<{
316
+ kind: string;
317
+ file?: string;
318
+ line?: number;
319
+ description: string;
320
+ }>;
280
321
  }>;
281
322
  blocked: Array<{
282
323
  target: string;
324
+ classification: "safe" | "needs-review" | "blocked";
283
325
  confidence?: "high" | "medium" | "low";
284
326
  reasons: string[];
327
+ evidence: Array<{
328
+ kind: string;
329
+ file?: string;
330
+ line?: number;
331
+ description: string;
332
+ }>;
333
+ }>;
334
+ deletionOrder: Array<{
335
+ target: string;
336
+ step: number;
337
+ reason?: string;
285
338
  }>;
286
- deletionOrder: string[];
287
339
  evidence: Array<{
288
340
  kind: string;
289
341
  file?: string;
@@ -312,26 +364,41 @@ type SuggestRulesReport = {
312
364
  configFragment: Record<string, unknown>;
313
365
  confidence: "high" | "medium" | "low";
314
366
  evidence?: string[];
367
+ rationale?: string;
315
368
  }>;
316
369
  tags?: Array<{
317
370
  name: string;
318
371
  glob: string;
319
372
  rationale: string;
373
+ source?: string;
320
374
  }>;
321
375
  ownershipHints?: Array<{
322
376
  pathGlob: string;
323
377
  suggestedOwner: string;
324
378
  crossTeamEdges: number;
325
379
  rationale: string;
380
+ touchedPackages?: string[];
326
381
  }>;
327
382
  hotspots?: Array<{
328
383
  file: string;
384
+ workspace?: string;
385
+ package?: string;
329
386
  crossPackageImports: number;
330
387
  crossOwnerImports: number;
331
388
  incomingEdges: number;
332
389
  outgoingEdges: number;
390
+ rank: number;
391
+ teamsInvolved?: string[];
333
392
  suggestion: string;
334
393
  }>;
394
+ governanceActions?: Array<{
395
+ priority: number;
396
+ kind: string;
397
+ description: string;
398
+ effort: "low" | "medium" | "high";
399
+ impact: "low" | "medium" | "high";
400
+ configFragment?: Record<string, unknown>;
401
+ }>;
335
402
  rationale?: string[];
336
403
  };
337
404
  type FixPlanReport = {
@@ -351,11 +418,22 @@ type FixPlanReport = {
351
418
  verification: string[];
352
419
  risk: "low" | "medium" | "high";
353
420
  confidence: "high" | "medium" | "low";
421
+ rank?: number;
422
+ phase?: string;
423
+ findingIds: string[];
354
424
  }>;
355
425
  blockedBy: string[];
356
426
  verificationSteps: string[];
357
427
  riskLevel: "low" | "medium" | "high";
358
428
  confidence: "high" | "medium" | "low";
429
+ totalActions: number;
430
+ highConfidenceActions: number;
431
+ phaseSummary: Array<{
432
+ name: string;
433
+ order: number;
434
+ actionCount: number;
435
+ description: string;
436
+ }>;
359
437
  };
360
438
  type DaemonStatusReport = {
361
439
  running: boolean;
@@ -364,6 +442,72 @@ type DaemonStatusReport = {
364
442
  version?: string;
365
443
  startedAt?: string;
366
444
  projectRoot?: string;
445
+ indexWarm?: boolean;
446
+ lastUpdateMs?: number;
447
+ graphNodes?: number;
448
+ graphEdges?: number;
449
+ watchedFiles?: number;
450
+ watcherLagMs?: number;
451
+ pendingInvalidations?: number;
452
+ generation?: number;
453
+ uptimeSecs?: number;
454
+ binaryPath?: string;
455
+ initialBuildMs?: number;
456
+ lastRebuildMs?: number;
457
+ incrementalRebuilds?: number;
458
+ totalInvalidations?: number;
459
+ configChangePending?: boolean;
460
+ };
461
+ type CompatibilityReportOptions = {
462
+ cwd?: string;
463
+ config?: string;
464
+ profile?: Profile;
465
+ };
466
+ type DebugFrameworksOptions = {
467
+ cwd?: string;
468
+ config?: string;
469
+ profile?: Profile;
470
+ };
471
+ type CompatibilityReport = {
472
+ supportedFrameworks: string[];
473
+ heuristicFrameworks: string[];
474
+ unsupportedSignals: Array<{
475
+ signal: string;
476
+ source: string;
477
+ suggestion?: string;
478
+ }>;
479
+ warnings: Array<{
480
+ code: string;
481
+ message: string;
482
+ affectedScope?: string;
483
+ severity: "low" | "medium" | "high";
484
+ }>;
485
+ trustDowngrades: Array<{
486
+ reason: string;
487
+ scope: string;
488
+ severity: "low" | "medium" | "high";
489
+ }>;
490
+ };
491
+ type FrameworkDebugReport = {
492
+ detectedPacks: Array<{
493
+ name: string;
494
+ confidence: string;
495
+ signals: string[];
496
+ reasons: string[];
497
+ }>;
498
+ allEntrypoints: Array<{
499
+ path: string;
500
+ framework: string;
501
+ kind: string;
502
+ heuristic: boolean;
503
+ reason: string;
504
+ }>;
505
+ allIgnorePatterns: string[];
506
+ allClassificationRules: Array<{
507
+ pattern: string;
508
+ classification: string;
509
+ }>;
510
+ heuristicDetections: string[];
367
511
  };
368
512
  declare function scan(options?: ScanOptions): Promise<AnalysisReport>;
369
513
  declare function scanDot(options?: ScanOptions): Promise<string>;
@@ -397,5 +541,7 @@ declare function migrateDepcruise(options?: {
397
541
  declare function daemonStatus(options?: {
398
542
  cwd?: string;
399
543
  }): Promise<DaemonStatusReport>;
544
+ declare function compatibilityReport(options?: CompatibilityReportOptions): Promise<CompatibilityReport>;
545
+ declare function debugFrameworks(options?: DebugFrameworksOptions): Promise<FrameworkDebugReport>;
400
546
  //#endregion
401
- export { AnalysisReport, type CommandResult, DaemonStatusReport, DebugEntrypointsOptions, DebugResolveOptions, ExplainOptions, ExplainReport, FixPlanOptions, FixPlanReport, ImpactOptions, ImpactReport, MigrationOutput, Profile, PruneguardConfig, PruneguardExecutionError, type ResolutionInfo, type ResolutionSource, ReviewOptions, ReviewReport, SafeDeleteOptions, SafeDeleteReport, ScanOptions, SuggestRulesOptions, SuggestRulesReport, binaryPath, daemonStatus, debugEntrypoints, debugResolve, explain, fixPlan, impact, loadConfig, migrateDepcruise, migrateKnip, resolutionInfo, review, run, safeDelete, scan, scanDot, schemaPath, suggestRules };
547
+ export { AnalysisReport, type CommandResult, CompatibilityReport, CompatibilityReportOptions, DaemonStatusReport, DebugEntrypointsOptions, DebugFrameworksOptions, DebugResolveOptions, ExplainOptions, ExplainReport, FixPlanOptions, FixPlanReport, FrameworkDebugReport, ImpactOptions, ImpactReport, MigrationOutput, Profile, PruneguardConfig, PruneguardExecutionError, type ResolutionInfo, type ResolutionSource, ReviewOptions, ReviewReport, SafeDeleteOptions, SafeDeleteReport, ScanOptions, SuggestRulesOptions, SuggestRulesReport, binaryPath, compatibilityReport, daemonStatus, debugEntrypoints, debugFrameworks, debugResolve, explain, fixPlan, impact, loadConfig, migrateDepcruise, migrateKnip, resolutionInfo, review, run, safeDelete, scan, scanDot, schemaPath, suggestRules };
package/dist/index.mjs CHANGED
@@ -126,6 +126,7 @@ async function review(options = {}) {
126
126
  if (options.baseRef) args.push("--changed-since", options.baseRef);
127
127
  if (options.noCache) args.push("--no-cache");
128
128
  if (options.noBaseline) args.push("--no-baseline");
129
+ if (options.strictTrust) args.push("--strict-trust");
129
130
  args.push("review");
130
131
  const result = await run$1(args, { cwd: options.cwd });
131
132
  if (result.exitCode !== 0 && result.exitCode !== 1) requireSuccess(result);
@@ -199,5 +200,21 @@ async function daemonStatus(options) {
199
200
  }
200
201
  return report;
201
202
  }
203
+ async function compatibilityReport(options = {}) {
204
+ const args = ["--format", "json"];
205
+ pushGlobalFlags(args, options);
206
+ args.push("compatibility-report");
207
+ const result = await run$1(args, { cwd: options.cwd });
208
+ requireSuccess(result);
209
+ return parseJson(result);
210
+ }
211
+ async function debugFrameworks(options = {}) {
212
+ const args = ["--format", "json"];
213
+ pushGlobalFlags(args, options);
214
+ args.push("debug", "frameworks");
215
+ const result = await run$1(args, { cwd: options.cwd });
216
+ requireSuccess(result);
217
+ return parseJson(result);
218
+ }
202
219
  //#endregion
203
- export { PruneguardExecutionError, binaryPath, daemonStatus, debugEntrypoints, debugResolve, explain, fixPlan, impact, loadConfig, migrateDepcruise, migrateKnip, resolutionInfo, review, run, safeDelete, scan, scanDot, schemaPath, suggestRules };
220
+ export { PruneguardExecutionError, binaryPath, compatibilityReport, daemonStatus, debugEntrypoints, debugFrameworks, debugResolve, explain, fixPlan, impact, loadConfig, migrateDepcruise, migrateKnip, resolutionInfo, review, run, safeDelete, scan, scanDot, schemaPath, suggestRules };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pruneguard",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Repo truth engine for JS/TS monorepos",
5
5
  "keywords": [
6
6
  "javascript",
@@ -29,6 +29,8 @@
29
29
  "report_schema.json",
30
30
  "review_report_schema.json",
31
31
  "safe_delete_report_schema.json",
32
+ "suggest_rules_report_schema.json",
33
+ "daemon_status_report_schema.json",
32
34
  "dist",
33
35
  "README.md",
34
36
  "bin/pruneguard"
@@ -43,14 +45,14 @@
43
45
  }
44
46
  },
45
47
  "optionalDependencies": {
46
- "@pruneguard/cli-darwin-arm64": "0.3.1",
47
- "@pruneguard/cli-darwin-x64": "0.3.1",
48
- "@pruneguard/cli-linux-arm64-gnu": "0.3.1",
49
- "@pruneguard/cli-linux-arm64-musl": "0.3.1",
50
- "@pruneguard/cli-linux-x64-gnu": "0.3.1",
51
- "@pruneguard/cli-linux-x64-musl": "0.3.1",
52
- "@pruneguard/cli-win32-arm64-msvc": "0.3.1",
53
- "@pruneguard/cli-win32-x64-msvc": "0.3.1"
48
+ "@pruneguard/cli-darwin-arm64": "0.4.0",
49
+ "@pruneguard/cli-darwin-x64": "0.4.0",
50
+ "@pruneguard/cli-linux-arm64-gnu": "0.4.0",
51
+ "@pruneguard/cli-linux-arm64-musl": "0.4.0",
52
+ "@pruneguard/cli-linux-x64-gnu": "0.4.0",
53
+ "@pruneguard/cli-linux-x64-musl": "0.4.0",
54
+ "@pruneguard/cli-win32-arm64-msvc": "0.4.0",
55
+ "@pruneguard/cli-win32-x64-msvc": "0.4.0"
54
56
  },
55
57
  "engines": {
56
58
  "node": ">=18.0.0"
@@ -378,16 +378,34 @@
378
378
  }
379
379
  },
380
380
  "FindingCategory": {
381
- "type": "string",
382
- "enum": [
383
- "unused-export",
384
- "unused-file",
385
- "unused-package",
386
- "unused-dependency",
387
- "cycle",
388
- "boundary-violation",
389
- "ownership-violation",
390
- "impact"
381
+ "oneOf": [
382
+ {
383
+ "type": "string",
384
+ "enum": [
385
+ "unused-export",
386
+ "unused-file",
387
+ "unused-package",
388
+ "unused-dependency",
389
+ "cycle",
390
+ "boundary-violation",
391
+ "ownership-violation",
392
+ "impact"
393
+ ]
394
+ },
395
+ {
396
+ "description": "An exported class member, enum variant, or namespace member is unused.",
397
+ "type": "string",
398
+ "enum": [
399
+ "unused-member"
400
+ ]
401
+ },
402
+ {
403
+ "description": "The same symbol is exported from multiple paths (barrel re-export collision).",
404
+ "type": "string",
405
+ "enum": [
406
+ "duplicate-export"
407
+ ]
408
+ }
391
409
  ]
392
410
  },
393
411
  "FindingConfidence": {
@@ -0,0 +1,350 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "SuggestRulesReport",
4
+ "description": "Suggested governance rules report.",
5
+ "type": "object",
6
+ "required": [
7
+ "suggestedRules"
8
+ ],
9
+ "properties": {
10
+ "governanceActions": {
11
+ "description": "Recommended governance actions ordered by priority.",
12
+ "type": "array",
13
+ "items": {
14
+ "$ref": "#/definitions/GovernanceAction"
15
+ }
16
+ },
17
+ "hotspots": {
18
+ "description": "Hotspot files with high edge traffic.",
19
+ "type": "array",
20
+ "items": {
21
+ "$ref": "#/definitions/Hotspot"
22
+ }
23
+ },
24
+ "ownershipHints": {
25
+ "description": "Ownership hints from cross-boundary analysis.",
26
+ "type": "array",
27
+ "items": {
28
+ "$ref": "#/definitions/OwnershipHint"
29
+ }
30
+ },
31
+ "rationale": {
32
+ "description": "Rationale explaining the suggestions.",
33
+ "type": "array",
34
+ "items": {
35
+ "type": "string"
36
+ }
37
+ },
38
+ "suggestedRules": {
39
+ "description": "Suggested rules inferred from graph analysis.",
40
+ "type": "array",
41
+ "items": {
42
+ "$ref": "#/definitions/SuggestedRule"
43
+ }
44
+ },
45
+ "tags": {
46
+ "description": "Suggested tags for directory grouping.",
47
+ "type": "array",
48
+ "items": {
49
+ "$ref": "#/definitions/SuggestedTag"
50
+ }
51
+ }
52
+ },
53
+ "definitions": {
54
+ "EffortLevel": {
55
+ "description": "Estimated effort level.",
56
+ "type": "string",
57
+ "enum": [
58
+ "low",
59
+ "medium",
60
+ "high"
61
+ ]
62
+ },
63
+ "FindingConfidence": {
64
+ "type": "string",
65
+ "enum": [
66
+ "high",
67
+ "medium",
68
+ "low"
69
+ ]
70
+ },
71
+ "GovernanceAction": {
72
+ "description": "A recommended governance action with priority ordering.",
73
+ "type": "object",
74
+ "required": [
75
+ "description",
76
+ "effort",
77
+ "impact",
78
+ "kind",
79
+ "priority"
80
+ ],
81
+ "properties": {
82
+ "configFragment": {
83
+ "description": "Concrete configuration fragment or steps."
84
+ },
85
+ "description": {
86
+ "description": "Human-readable description of what to do.",
87
+ "type": "string"
88
+ },
89
+ "effort": {
90
+ "description": "Estimated effort level.",
91
+ "allOf": [
92
+ {
93
+ "$ref": "#/definitions/EffortLevel"
94
+ }
95
+ ]
96
+ },
97
+ "impact": {
98
+ "description": "Expected impact on governance coverage.",
99
+ "allOf": [
100
+ {
101
+ "$ref": "#/definitions/ImpactLevel"
102
+ }
103
+ ]
104
+ },
105
+ "kind": {
106
+ "description": "Kind of governance action.",
107
+ "allOf": [
108
+ {
109
+ "$ref": "#/definitions/GovernanceActionKind"
110
+ }
111
+ ]
112
+ },
113
+ "priority": {
114
+ "description": "Priority rank (1 = most impactful).",
115
+ "type": "integer",
116
+ "format": "uint",
117
+ "minimum": 0.0
118
+ }
119
+ }
120
+ },
121
+ "GovernanceActionKind": {
122
+ "description": "Kind of governance action.",
123
+ "type": "string",
124
+ "enum": [
125
+ "add-boundary-rule",
126
+ "assign-ownership",
127
+ "introduce-tags",
128
+ "split-hotspot",
129
+ "add-reachability-fence",
130
+ "enforce-layering"
131
+ ]
132
+ },
133
+ "Hotspot": {
134
+ "description": "A hotspot file with high edge traffic.",
135
+ "type": "object",
136
+ "required": [
137
+ "crossOwnerImports",
138
+ "crossPackageImports",
139
+ "file",
140
+ "incomingEdges",
141
+ "outgoingEdges",
142
+ "rank",
143
+ "suggestion"
144
+ ],
145
+ "properties": {
146
+ "crossOwnerImports": {
147
+ "description": "Cross-owner import count.",
148
+ "type": "integer",
149
+ "format": "uint",
150
+ "minimum": 0.0
151
+ },
152
+ "crossPackageImports": {
153
+ "description": "Cross-package import count.",
154
+ "type": "integer",
155
+ "format": "uint",
156
+ "minimum": 0.0
157
+ },
158
+ "file": {
159
+ "description": "File path.",
160
+ "type": "string"
161
+ },
162
+ "incomingEdges": {
163
+ "description": "Incoming edge count.",
164
+ "type": "integer",
165
+ "format": "uint",
166
+ "minimum": 0.0
167
+ },
168
+ "outgoingEdges": {
169
+ "description": "Outgoing edge count.",
170
+ "type": "integer",
171
+ "format": "uint",
172
+ "minimum": 0.0
173
+ },
174
+ "package": {
175
+ "description": "Package containing this file, if any.",
176
+ "type": [
177
+ "string",
178
+ "null"
179
+ ]
180
+ },
181
+ "rank": {
182
+ "description": "Hotspot rank (1 = highest traffic).",
183
+ "type": "integer",
184
+ "format": "uint",
185
+ "minimum": 0.0
186
+ },
187
+ "suggestion": {
188
+ "description": "Suggestion for addressing this hotspot.",
189
+ "type": "string"
190
+ },
191
+ "teamsInvolved": {
192
+ "description": "Distinct teams that touch this file via imports (source or target).",
193
+ "type": "array",
194
+ "items": {
195
+ "type": "string"
196
+ }
197
+ },
198
+ "workspace": {
199
+ "description": "Workspace containing this file, if any.",
200
+ "type": [
201
+ "string",
202
+ "null"
203
+ ]
204
+ }
205
+ }
206
+ },
207
+ "ImpactLevel": {
208
+ "description": "Expected impact level.",
209
+ "type": "string",
210
+ "enum": [
211
+ "low",
212
+ "medium",
213
+ "high"
214
+ ]
215
+ },
216
+ "OwnershipHint": {
217
+ "description": "Ownership assignment hint.",
218
+ "type": "object",
219
+ "required": [
220
+ "crossTeamEdges",
221
+ "pathGlob",
222
+ "rationale",
223
+ "suggestedOwner"
224
+ ],
225
+ "properties": {
226
+ "crossTeamEdges": {
227
+ "description": "Number of cross-team edges.",
228
+ "type": "integer",
229
+ "format": "uint",
230
+ "minimum": 0.0
231
+ },
232
+ "pathGlob": {
233
+ "description": "Path glob to match.",
234
+ "type": "string"
235
+ },
236
+ "rationale": {
237
+ "description": "Rationale for the suggestion.",
238
+ "type": "string"
239
+ },
240
+ "suggestedOwner": {
241
+ "description": "Suggested owner identifier.",
242
+ "type": "string"
243
+ },
244
+ "touchedPackages": {
245
+ "description": "Packages touched by cross-team edges from this area.",
246
+ "type": "array",
247
+ "items": {
248
+ "type": "string"
249
+ }
250
+ }
251
+ }
252
+ },
253
+ "SuggestedRule": {
254
+ "description": "A single suggested rule.",
255
+ "type": "object",
256
+ "required": [
257
+ "confidence",
258
+ "configFragment",
259
+ "description",
260
+ "kind",
261
+ "name"
262
+ ],
263
+ "properties": {
264
+ "confidence": {
265
+ "description": "Confidence in the suggestion.",
266
+ "allOf": [
267
+ {
268
+ "$ref": "#/definitions/FindingConfidence"
269
+ }
270
+ ]
271
+ },
272
+ "configFragment": {
273
+ "description": "Configuration fragment that implements this rule."
274
+ },
275
+ "description": {
276
+ "description": "Human-readable description.",
277
+ "type": "string"
278
+ },
279
+ "evidence": {
280
+ "description": "Evidence supporting the suggestion.",
281
+ "type": "array",
282
+ "items": {
283
+ "type": "string"
284
+ }
285
+ },
286
+ "kind": {
287
+ "description": "Kind of rule suggestion.",
288
+ "allOf": [
289
+ {
290
+ "$ref": "#/definitions/SuggestedRuleKind"
291
+ }
292
+ ]
293
+ },
294
+ "name": {
295
+ "description": "Rule name.",
296
+ "type": "string"
297
+ },
298
+ "rationale": {
299
+ "description": "Rationale explaining why this specific rule was suggested.",
300
+ "type": [
301
+ "string",
302
+ "null"
303
+ ]
304
+ }
305
+ }
306
+ },
307
+ "SuggestedRuleKind": {
308
+ "description": "Kind of suggested rule.",
309
+ "type": "string",
310
+ "enum": [
311
+ "forbidden",
312
+ "required",
313
+ "tag-assignment",
314
+ "ownership-boundary",
315
+ "reachability-fence",
316
+ "layer-enforcement"
317
+ ]
318
+ },
319
+ "SuggestedTag": {
320
+ "description": "A suggested tag for directory grouping.",
321
+ "type": "object",
322
+ "required": [
323
+ "glob",
324
+ "name",
325
+ "rationale"
326
+ ],
327
+ "properties": {
328
+ "glob": {
329
+ "description": "Glob pattern for the tag.",
330
+ "type": "string"
331
+ },
332
+ "name": {
333
+ "description": "Tag name.",
334
+ "type": "string"
335
+ },
336
+ "rationale": {
337
+ "description": "Why this tag is suggested.",
338
+ "type": "string"
339
+ },
340
+ "source": {
341
+ "description": "Source of the tag inference (e.g. \"directory-cluster\", \"workspace\", \"package\", \"ownership\").",
342
+ "type": [
343
+ "string",
344
+ "null"
345
+ ]
346
+ }
347
+ }
348
+ }
349
+ }
350
+ }