From 5477d5fb5b82e3f210f5c605b3bb0c18d0daeead Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sat, 4 Jul 2026 14:52:09 +0800 Subject: [PATCH] fix(scripts): keep rfc-index module internals unexported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit knip: the walker/renderer internals (the closed sets, the heading and marker helpers, the per-lifecycle renderer) have no importer beyond this module — the public surface is rfcRoot, walkRfcTree, and spliceReadme, the three names the generator CLI and the gate consume. --- scripts/rfc-index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/rfc-index.ts b/scripts/rfc-index.ts index 62d9cb0fcf..d9a4538b38 100644 --- a/scripts/rfc-index.ts +++ b/scripts/rfc-index.ts @@ -23,20 +23,20 @@ import { globSync } from 'node:fs' export const rfcRoot = resolve(import.meta.dirname, '../docs/rfc') /** The closed set of RFC lifecycles (top-level folders under docs/rfc/). */ -export const LIFECYCLES = ['proposed', 'implemented', 'rejected'] as const +const LIFECYCLES = ['proposed', 'implemented', 'rejected'] as const /** * The closed set of RFC classes (nested folder under each lifecycle). Adding a * class is a deliberate act: extend this list AND the README's Classification * section. The gate rejects any folder not listed here. */ -export const CLASSES = ['feature', 'bug-fix', 'simplification', 'architecture', 'process', 'testing'] as const +const CLASSES = ['feature', 'bug-fix', 'simplification', 'architecture', 'process', 'testing'] as const /** Non-RFC Markdown allowed to sit directly at a lifecycle root. */ const ROOT_ALLOWLIST = new Set(['AGENTS.md', 'CLAUDE.md']) /** Title-case a class/lifecycle folder name for a README heading. */ -export const heading = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1) +const heading = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1) /** One RFC file, as discovered by the walker. */ export interface Rfc { @@ -95,7 +95,7 @@ export function walkRfcTree(): { rfcs: Rfc[]; errors: string[] } { } /** The begin/end marker lines that delimit one lifecycle's generated region. */ -export const markers = (lifecycle: string): { begin: string; end: string } => ({ +const markers = (lifecycle: string): { begin: string; end: string } => ({ begin: ``, end: ``, }) @@ -105,7 +105,7 @@ export const markers = (lifecycle: string): { begin: string; end: string } => ({ * `| Title | First proposed |` table for every non-empty class, in CLASSES * order, rows sorted by date then filename. */ -export function renderLifecycle(rfcs: Rfc[], lifecycle: string): string { +function renderLifecycle(rfcs: Rfc[], lifecycle: string): string { const sections: string[] = [] for (const cls of CLASSES) { const rows = rfcs