pruneguard 0.3.0 → 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.
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.0",
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.0",
47
- "@pruneguard/cli-darwin-x64": "0.3.0",
48
- "@pruneguard/cli-linux-arm64-gnu": "0.3.0",
49
- "@pruneguard/cli-linux-arm64-musl": "0.3.0",
50
- "@pruneguard/cli-linux-x64-gnu": "0.3.0",
51
- "@pruneguard/cli-linux-x64-musl": "0.3.0",
52
- "@pruneguard/cli-win32-arm64-msvc": "0.3.0",
53
- "@pruneguard/cli-win32-x64-msvc": "0.3.0"
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"
@@ -108,6 +108,20 @@
108
108
  "source"
109
109
  ],
110
110
  "properties": {
111
+ "framework": {
112
+ "description": "Framework that contributed this entrypoint, if any.",
113
+ "type": [
114
+ "string",
115
+ "null"
116
+ ]
117
+ },
118
+ "heuristic": {
119
+ "description": "Whether this entrypoint was detected via heuristics.",
120
+ "type": [
121
+ "boolean",
122
+ "null"
123
+ ]
124
+ },
111
125
  "kind": {
112
126
  "type": "string"
113
127
  },
@@ -117,6 +131,13 @@
117
131
  "profile": {
118
132
  "type": "string"
119
133
  },
134
+ "reason": {
135
+ "description": "Reason this entrypoint was detected.",
136
+ "type": [
137
+ "string",
138
+ "null"
139
+ ]
140
+ },
120
141
  "source": {
121
142
  "type": "string"
122
143
  },
@@ -275,6 +296,16 @@
275
296
  "$ref": "#/definitions/Evidence"
276
297
  }
277
298
  },
299
+ "frameworkContext": {
300
+ "description": "Framework context relevant to this finding.",
301
+ "type": [
302
+ "array",
303
+ "null"
304
+ ],
305
+ "items": {
306
+ "type": "string"
307
+ }
308
+ },
278
309
  "id": {
279
310
  "description": "Stable deterministic ID for this finding.",
280
311
  "type": "string"
@@ -327,6 +358,16 @@
327
358
  "null"
328
359
  ]
329
360
  },
361
+ "trustNotes": {
362
+ "description": "Trust-related notes for this finding.",
363
+ "type": [
364
+ "array",
365
+ "null"
366
+ ],
367
+ "items": {
368
+ "type": "string"
369
+ }
370
+ },
330
371
  "workspace": {
331
372
  "description": "Workspace this finding belongs to, if applicable.",
332
373
  "type": [
@@ -337,16 +378,34 @@
337
378
  }
338
379
  },
339
380
  "FindingCategory": {
340
- "type": "string",
341
- "enum": [
342
- "unused-export",
343
- "unused-file",
344
- "unused-package",
345
- "unused-dependency",
346
- "cycle",
347
- "boundary-violation",
348
- "ownership-violation",
349
- "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
+ }
350
409
  ]
351
410
  },
352
411
  "FindingConfidence": {
@@ -365,6 +424,32 @@
365
424
  "info"
366
425
  ]
367
426
  },
427
+ "FrameworkConfidenceCounts": {
428
+ "description": "Breakdown of framework detection confidence levels.",
429
+ "type": "object",
430
+ "required": [
431
+ "exact",
432
+ "heuristic",
433
+ "unsupported"
434
+ ],
435
+ "properties": {
436
+ "exact": {
437
+ "type": "integer",
438
+ "format": "uint",
439
+ "minimum": 0.0
440
+ },
441
+ "heuristic": {
442
+ "type": "integer",
443
+ "format": "uint",
444
+ "minimum": 0.0
445
+ },
446
+ "unsupported": {
447
+ "type": "integer",
448
+ "format": "uint",
449
+ "minimum": 0.0
450
+ }
451
+ }
452
+ },
368
453
  "Inventories": {
369
454
  "description": "Inventories of discovered entities.",
370
455
  "type": "object",
@@ -521,6 +606,13 @@
521
606
  "format": "uint",
522
607
  "minimum": 0.0
523
608
  },
609
+ "compatibilityWarnings": {
610
+ "description": "Compatibility warnings from framework detection.",
611
+ "type": "array",
612
+ "items": {
613
+ "type": "string"
614
+ }
615
+ },
524
616
  "confidenceCounts": {
525
617
  "$ref": "#/definitions/ConfidenceCounts"
526
618
  },
@@ -578,6 +670,26 @@
578
670
  "format": "uint",
579
671
  "minimum": 0.0
580
672
  },
673
+ "frameworkConfidenceCounts": {
674
+ "description": "Framework confidence breakdown.",
675
+ "default": {
676
+ "exact": 0,
677
+ "heuristic": 0,
678
+ "unsupported": 0
679
+ },
680
+ "allOf": [
681
+ {
682
+ "$ref": "#/definitions/FrameworkConfidenceCounts"
683
+ }
684
+ ]
685
+ },
686
+ "frameworksDetected": {
687
+ "description": "Frameworks detected during analysis.",
688
+ "type": "array",
689
+ "items": {
690
+ "type": "string"
691
+ }
692
+ },
581
693
  "fullScopeRequired": {
582
694
  "type": "boolean"
583
695
  },
@@ -591,6 +703,20 @@
591
703
  "format": "uint",
592
704
  "minimum": 0.0
593
705
  },
706
+ "heuristicEntrypoints": {
707
+ "description": "Number of entrypoints added by heuristic detection.",
708
+ "default": 0,
709
+ "type": "integer",
710
+ "format": "uint",
711
+ "minimum": 0.0
712
+ },
713
+ "heuristicFrameworks": {
714
+ "description": "Frameworks detected via heuristics (lower confidence).",
715
+ "type": "array",
716
+ "items": {
717
+ "type": "string"
718
+ }
719
+ },
594
720
  "indexAgeMs": {
595
721
  "description": "Age of the reused graph index in milliseconds.",
596
722
  "type": [
@@ -650,6 +776,11 @@
650
776
  "format": "uint",
651
777
  "minimum": 0.0
652
778
  },
779
+ "strictTrustApplied": {
780
+ "description": "Whether strict trust mode was applied.",
781
+ "default": false,
782
+ "type": "boolean"
783
+ },
653
784
  "suppressedFindings": {
654
785
  "type": "integer",
655
786
  "format": "uint",
@@ -764,6 +895,13 @@
764
895
  "type": "integer",
765
896
  "format": "uint",
766
897
  "minimum": 0.0
898
+ },
899
+ "workspaceExportsMiss": {
900
+ "description": "Subpath not declared in a workspace package's `exports` map.",
901
+ "default": 0,
902
+ "type": "integer",
903
+ "format": "uint",
904
+ "minimum": 0.0
767
905
  }
768
906
  }
769
907
  },