Skip to content

Commit 00b060c

Browse files
committed
refactor: prune the unused-export backlog knip recorded
93 of the 94 export-level warnings resolved across 28 files: - 77 symbols un-exported: used inside their module only (settings-write -queue's retry internals, config-toml's TOML helpers, quota-headers' parsers, device-auth constants, repair-commands' usage/arg helpers, zod sub-schemas, fs-retry tuning constants, bench-format helpers, ...) — per lib/AGENTS.md, public API flows through lib/index.ts or the documented subpaths, and none of these are reachable from any entry. - Two stale compatibility re-exports trimmed (forecast-report-shared's isRetryableStorageWriteError, file-paths' getAccountsBackupPathAtIndex) plus the rotation.ts routing-mutex value re-export block whose three names every consumer now imports from routing-mutex directly. - Dead code deleted: createRuntimeEventHandler (an unused generic factory superseded by handleRuntimeEvent), the never-read DASHBOARD_DISPLAY_SETTINGS_VERSION, CODEX_HOST_BRIDGE_META and its interface (benchmark notes-as-code), the unused resetRuntimeObservabilitySnapshotForTests, and 11 unused fast-check arbitraries in test/property/helpers.ts. - PersistedSwitchReasonSchema stays exported on purpose: the const only feeds z.infer, and un-exporting it trips no-unused-vars (value used only as a type); the single remaining knip warning documents it. Verified: typecheck clean, eslint --max-warnings=0 on all 28 changed files, full vitest run 4531 passed / 58 failed — identical totals to the documented environment-only baseline on unmodified main. https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
1 parent 7363dfb commit 00b060c

29 files changed

Lines changed: 76 additions & 241 deletions

lib/auth/device-auth.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import {
55
sanitizeOAuthResponseBodyForLog,
66
} from "./auth.js";
77

8-
export const DEVICE_AUTH_BASE_URL = "https://auth.openai.com";
9-
export const DEVICE_AUTH_API_BASE_URL = `${DEVICE_AUTH_BASE_URL}/api/accounts`;
8+
const DEVICE_AUTH_BASE_URL = "https://auth.openai.com";
9+
const DEVICE_AUTH_API_BASE_URL = `${DEVICE_AUTH_BASE_URL}/api/accounts`;
1010
export const DEVICE_AUTH_VERIFICATION_URL = `${DEVICE_AUTH_BASE_URL}/codex/device`;
1111
export const DEVICE_AUTH_REDIRECT_URI = `${DEVICE_AUTH_BASE_URL}/deviceauth/callback`;
12-
export const DEVICE_AUTH_TIMEOUT_MS = 15 * 60 * 1000;
13-
export const DEVICE_AUTH_DEFAULT_INTERVAL_MS = 5_000;
12+
const DEVICE_AUTH_TIMEOUT_MS = 15 * 60 * 1000;
13+
const DEVICE_AUTH_DEFAULT_INTERVAL_MS = 5_000;
1414
const DEVICE_AUTH_ABORTED_MESSAGE = "aborted";
1515
const DEVICE_AUTH_TRANSIENT_PENDING_STATUSES = new Set([
1616
408,
@@ -407,7 +407,7 @@ export async function requestDeviceAuthorization(
407407
}
408408
}
409409

410-
export function printDeviceAuthorizationPrompt(
410+
function printDeviceAuthorizationPrompt(
411411
deviceCode: DeviceAuthCode,
412412
log: (message: string) => void = console.log,
413413
timeoutMs = DEVICE_AUTH_TIMEOUT_MS,

lib/codex-manager/backend-settings-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function formatBackendNumberValue(
6161
return `${Math.round(value)}ms`;
6262
}
6363

64-
export function clampBackendNumber(
64+
function clampBackendNumber(
6565
option: BackendNumberSettingOption,
6666
value: number,
6767
): number {

lib/codex-manager/commands/uninstall.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export type ParsedUninstallArgs =
5151
| { ok: false; reason: "help" }
5252
| { ok: false; reason: "error"; message: string };
5353

54-
export function printUninstallUsage(): void {
54+
function printUninstallUsage(): void {
5555
console.log(
5656
[
5757
"Usage:",

lib/codex-manager/forecast-report-shared.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@ import {
55
type AccountMetadataV3,
66
type AccountStorageV3,
77
} from "../storage.js";
8-
import {
9-
isRetryableStorageWriteError,
10-
saveAccountsWithRetry,
11-
} from "../storage/save-retry.js";
8+
import { saveAccountsWithRetry } from "../storage/save-retry.js";
129
import type { TokenFailure } from "../types.js";
1310

1411
// Moved to lib/storage/save-retry.ts so lib/accounts.ts can use the retry
1512
// helper without importing this codex-manager module; re-exported here to
1613
// preserve the historical import surface.
17-
export { isRetryableStorageWriteError, saveAccountsWithRetry };
14+
export { saveAccountsWithRetry };
1815

1916
export type AccountIdentityMatch = Pick<
2017
AccountMetadataV3,

lib/codex-manager/formatters/quota-formatters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function quotaCacheEntryToSnapshot(
7676
};
7777
}
7878

79-
export function formatCompactQuotaWindowLabel(
79+
function formatCompactQuotaWindowLabel(
8080
windowMinutes: number | undefined,
8181
): string {
8282
if (!windowMinutes || !Number.isFinite(windowMinutes) || windowMinutes <= 0) {
@@ -87,7 +87,7 @@ export function formatCompactQuotaWindowLabel(
8787
return `${windowMinutes}m`;
8888
}
8989

90-
export function formatCompactQuotaPart(
90+
function formatCompactQuotaPart(
9191
windowMinutes: number | undefined,
9292
usedPercent: number | undefined,
9393
): string | null {

lib/codex-manager/repair-commands.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export interface RepairCommandDeps {
132132
) => boolean;
133133
}
134134

135-
export function printFixUsage(): void {
135+
function printFixUsage(): void {
136136
console.log(
137137
[
138138
"Usage:",
@@ -152,7 +152,7 @@ export function printFixUsage(): void {
152152
);
153153
}
154154

155-
export function printVerifyFlaggedUsage(): void {
155+
function printVerifyFlaggedUsage(): void {
156156
console.log(
157157
[
158158
"Usage:",
@@ -170,7 +170,7 @@ export function printVerifyFlaggedUsage(): void {
170170
);
171171
}
172172

173-
export function printDoctorUsage(): void {
173+
function printDoctorUsage(): void {
174174
console.log(
175175
[
176176
"Usage:",
@@ -235,7 +235,7 @@ export function parseFixArgs(args: string[]): ParsedArgsResult<FixCliOptions> {
235235
return { ok: true, options };
236236
}
237237

238-
export function parseVerifyFlaggedArgs(
238+
function parseVerifyFlaggedArgs(
239239
args: string[],
240240
): ParsedArgsResult<VerifyFlaggedCliOptions> {
241241
const options: VerifyFlaggedCliOptions = {
@@ -263,7 +263,7 @@ export function parseVerifyFlaggedArgs(
263263
return { ok: true, options };
264264
}
265265

266-
export function parseDoctorArgs(
266+
function parseDoctorArgs(
267267
args: string[],
268268
): ParsedArgsResult<DoctorCliOptions> {
269269
const options: DoctorCliOptions = { json: false, fix: false, dryRun: false };

lib/codex-manager/settings-hub/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
} from "./shared.js";
3838

3939
/* c8 ignore start - interactive prompt flows are covered by integration tests */
40-
export async function promptBackendCategorySettings(
40+
async function promptBackendCategorySettings(
4141
initial: PluginConfig,
4242
category: BackendCategoryOption,
4343
initialFocus: BackendSettingFocusKey,

lib/codex-manager/settings-hub/dashboard.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
resolveMenuLayoutMode,
4343
} from "./shared.js";
4444

45-
export const DASHBOARD_DISPLAY_OPTIONS: DashboardDisplaySettingOption[] = [
45+
const DASHBOARD_DISPLAY_OPTIONS: DashboardDisplaySettingOption[] = [
4646
{
4747
key: "menuShowStatusBadge",
4848
label: "Show Status Badges",
@@ -95,7 +95,7 @@ export const DASHBOARD_DISPLAY_OPTIONS: DashboardDisplaySettingOption[] = [
9595
},
9696
];
9797

98-
export const STATUSLINE_FIELD_OPTIONS: Array<{
98+
const STATUSLINE_FIELD_OPTIONS: Array<{
9999
key: DashboardStatuslineField;
100100
label: string;
101101
description: string;
@@ -117,21 +117,21 @@ export const STATUSLINE_FIELD_OPTIONS: Array<{
117117
},
118118
];
119119

120-
export const AUTO_RETURN_OPTIONS_MS = [1_000, 2_000, 4_000] as const;
121-
export const MENU_QUOTA_TTL_OPTIONS_MS = [
120+
const AUTO_RETURN_OPTIONS_MS = [1_000, 2_000, 4_000] as const;
121+
const MENU_QUOTA_TTL_OPTIONS_MS = [
122122
60_000,
123123
5 * 60_000,
124124
10 * 60_000,
125125
] as const;
126-
export const THEME_PRESET_OPTIONS: DashboardThemePreset[] = ["green", "blue"];
127-
export const ACCENT_COLOR_OPTIONS: DashboardAccentColor[] = [
126+
const THEME_PRESET_OPTIONS: DashboardThemePreset[] = ["green", "blue"];
127+
const ACCENT_COLOR_OPTIONS: DashboardAccentColor[] = [
128128
"green",
129129
"cyan",
130130
"blue",
131131
"yellow",
132132
];
133133

134-
export const ACCOUNT_LIST_PANEL_KEYS = [
134+
const ACCOUNT_LIST_PANEL_KEYS = [
135135
"menuShowStatusBadge",
136136
"menuShowCurrentBadge",
137137
"menuShowLastUsed",
@@ -147,7 +147,7 @@ export const ACCOUNT_LIST_PANEL_KEYS = [
147147
"menuLayoutMode",
148148
] as const satisfies readonly DashboardSettingKey[];
149149

150-
export const STATUSLINE_PANEL_KEYS = [
150+
const STATUSLINE_PANEL_KEYS = [
151151
"menuStatuslineFields",
152152
] as const satisfies readonly DashboardSettingKey[];
153153
export const BEHAVIOR_PANEL_KEYS = [

lib/codex-manager/settings-hub/shared.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function isTtyInteractive(): boolean {
4747
return Boolean(input.isTTY && output.isTTY);
4848
}
4949

50-
export function copyDashboardSettingValue(
50+
function copyDashboardSettingValue(
5151
target: DashboardDisplaySettings,
5252
source: DashboardDisplaySettings,
5353
key: DashboardSettingKey,
@@ -70,7 +70,7 @@ export function applyDashboardDefaultsForKeys(
7070
return next;
7171
}
7272

73-
export function mergeDashboardSettingsForKeys(
73+
function mergeDashboardSettingsForKeys(
7474
base: DashboardDisplaySettings,
7575
selected: DashboardDisplaySettings,
7676
keys: readonly DashboardSettingKey[],

lib/codex-manager/settings-preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
import { ANSI } from "../ui/ansi.js";
77
import type { UiRuntimeOptions } from "../ui/runtime.js";
88

9-
export const DEFAULT_STATUSLINE_FIELDS: DashboardStatuslineField[] = [
9+
const DEFAULT_STATUSLINE_FIELDS: DashboardStatuslineField[] = [
1010
"last-used",
1111
"limits",
1212
"status",

0 commit comments

Comments
 (0)