@@ -4,15 +4,14 @@ import { dirname, join, sep } from "node:path";
44import { fileURLToPath } from "node:url" ;
55
66// Dead-export guard: runs knip and fails when a consumer-less export or an
7- // unused file falls outside scripts/dead-export-allowlist.txt. knip replaces
8- // the retired ts-prune scanner (CL-10655); it resolves the module graph, so an
9- // export consumed through a re-export barrel or the closed director fan-in is
10- // not reported, and exports used only inside their own module are skipped
11- // (ignoreExportsUsedInFile in knip.json knits both semantics). knip.json pins
12- // the scan (entry points per tree plus the workspace packages); this guard
13- // owns only the allowlist and the fail-closed floor. New dead exports must be
14- // deleted, not allowlisted — the allowlist covers entry-point API surfaces and
15- // deferred-deletion lanes only.
7+ // unused file falls outside scripts/dead-export-allowlist.txt. knip resolves
8+ // the module graph, so an export consumed through a re-export barrel or the
9+ // closed director fan-in is not reported, and exports used only inside their
10+ // own module are skipped (ignoreExportsUsedInFile in knip.json). knip.json
11+ // pins the scan; this guard owns only the allowlist and the fail-closed floor.
12+ // New dead exports must be deleted, not allowlisted — the allowlist names
13+ // entry-point API surfaces only. vendor/ and path-loaded eval fixtures are
14+ // knip ignore entries, not allowlist blankets.
1615//
1716// Hardening: stale entries fail instead of warning, every entry must pass
1817// shape validation and sit under a reason comment (the gate enforces the
@@ -33,10 +32,10 @@ const guardConfigPath = join(here, "dead-export-guard.json");
3332const knipBin = join ( repoRoot , "node_modules" , ".bin" , "knip" ) ;
3433const tscBin = join ( repoRoot , "node_modules" , "typescript" , "bin" , "tsc" ) ;
3534
36- // The integrated-monorepo knip config that drives the production agent scan;
37- // a separate file so the default scan keeps knip.json's ts-prune-parity
38- // project scope (the `workspaces` key switches knip into integrated mode,
39- // which also widens its default file detection beyond that scope).
35+ // The integrated-monorepo knip config that drives the production agent scan.
36+ // A separate file so the default scan keeps knip.json's project scope (the
37+ // `workspaces` key switches knip into integrated mode, which also widens its
38+ // default file detection beyond that scope).
4039export function agentsConfigPath ( ) : string {
4140 return join ( repoRoot , "knip.agents.json" ) ;
4241}
@@ -366,8 +365,7 @@ export function knipDefaultSpawn(knipBinPath: string): {
366365// `workspaces` key makes cross-workspace consumers visible in production
367366// mode), so the registry fan-in still clears `director` while the laundered
368367// worker names surface. Outside that surface the default scan owns
369- // enforcement at ts-prune parity; the union of both scans is the guard's
370- // finding set.
368+ // enforcement; the union of both scans is the guard's finding set.
371369export function knipAgentProductionSpawn (
372370 knipBinPath : string ,
373371 workspaces : readonly string [ ] ,
@@ -490,11 +488,11 @@ function fail(message: string): never {
490488
491489// The guard's finding set is the union of two knip reports:
492490//
493- // 1. the default scan over knip.json's project scope (ts-prune parity) , and
491+ // 1. the default scan over knip.json's project scope, and
494492// 2. the `--production` scan filtered to the agent workspaces, where knip
495493// does not count test-file consumers.
496494//
497- // Both run under the pinned pinned spawn contract; a failing or malformed
495+ // Both run under the pinned spawn contract; a failing or malformed
498496// report fails the gate rather than narrowing it silently.
499497export function runKnipScans ( rules : readonly AllowRule [ ] ) : DeadExport [ ] {
500498 requireKnipConfigs ( ) ;
0 commit comments