From 3bbc2732c0f7c26fbfc13193db45d6aed22861eb Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Tue, 7 Jul 2026 16:59:51 -0700 Subject: [PATCH] refactor(deadcode): localize script helper types (#101917) --- scripts/e2e/lib/session-log-mentions.ts | 4 ++-- scripts/e2e/lib/temp-state-dir.ts | 2 +- scripts/e2e/mcp-channel-limits.ts | 2 +- scripts/e2e/mcp-code-mode-gateway-client.ts | 2 +- scripts/e2e/telegram-bot-api.ts | 2 +- scripts/lib/android-version.ts | 2 +- scripts/lib/copy-assets.ts | 2 +- scripts/lib/gateway-bench-child.ts | 2 +- scripts/lib/gateway-ws-client.ts | 4 ++-- scripts/lib/npm-verify-exec.ts | 2 +- scripts/lib/openclaw-release-clawhub-plan.ts | 8 ++++---- scripts/lib/plugin-npm-release.ts | 19 +++++++++---------- scripts/lib/release-beta-verifier.ts | 4 ++-- scripts/lib/version-script-args.ts | 8 ++++---- scripts/test-env-mutation-report.ts | 2 +- scripts/test-skip-inventory.ts | 2 +- 16 files changed, 33 insertions(+), 34 deletions(-) diff --git a/scripts/e2e/lib/session-log-mentions.ts b/scripts/e2e/lib/session-log-mentions.ts index 7c2eee9d1c7d..a338debf41bd 100644 --- a/scripts/e2e/lib/session-log-mentions.ts +++ b/scripts/e2e/lib/session-log-mentions.ts @@ -3,12 +3,12 @@ import fs from "node:fs/promises"; import path from "node:path"; import { readPositiveIntEnv } from "./env-limits.mjs"; -export type SessionLogMentionLimits = { +type SessionLogMentionLimits = { fileMaxBytes: number; totalMaxBytes: number; }; -export type SessionLogNeedles = Record; +type SessionLogNeedles = Record; const DEFAULT_FILE_MAX_BYTES = 4 * 1024 * 1024; const DEFAULT_TOTAL_MAX_BYTES = 16 * 1024 * 1024; diff --git a/scripts/e2e/lib/temp-state-dir.ts b/scripts/e2e/lib/temp-state-dir.ts index adc73d91e139..aaa091d5f265 100644 --- a/scripts/e2e/lib/temp-state-dir.ts +++ b/scripts/e2e/lib/temp-state-dir.ts @@ -8,7 +8,7 @@ const cleanupSignals = ["SIGINT", "SIGTERM", "SIGHUP"] as const; type CleanupSignal = (typeof cleanupSignals)[number]; -export type E2eStateDir = { +type E2eStateDir = { stateDir: string; created: boolean; cleanup: () => void; diff --git a/scripts/e2e/mcp-channel-limits.ts b/scripts/e2e/mcp-channel-limits.ts index 81ecab41c2c0..e447e6057633 100644 --- a/scripts/e2e/mcp-channel-limits.ts +++ b/scripts/e2e/mcp-channel-limits.ts @@ -1,7 +1,7 @@ // Mcp Channel Limits script supports OpenClaw repository automation. import { readPositiveIntEnv } from "./lib/env-limits.mjs"; -export type McpChannelLimits = { +type McpChannelLimits = { connectTimeoutMs: number; gatewayEventRetainLimit: number; rawMessageRetainLimit: number; diff --git a/scripts/e2e/mcp-code-mode-gateway-client.ts b/scripts/e2e/mcp-code-mode-gateway-client.ts index a613a5dfa08e..9e1d9505755c 100644 --- a/scripts/e2e/mcp-code-mode-gateway-client.ts +++ b/scripts/e2e/mcp-code-mode-gateway-client.ts @@ -16,7 +16,7 @@ type FetchJsonOptions = { timeoutMs?: number; }; -export type McpCodeModeClientFetchLimits = { +type McpCodeModeClientFetchLimits = { bodyMaxBytes: number; timeoutMs: number; }; diff --git a/scripts/e2e/telegram-bot-api.ts b/scripts/e2e/telegram-bot-api.ts index 7a9a20859abe..ad0849f55790 100644 --- a/scripts/e2e/telegram-bot-api.ts +++ b/scripts/e2e/telegram-bot-api.ts @@ -13,7 +13,7 @@ type TelegramBotApiOptions = { const DEFAULT_BASE_URL = process.env.OPENCLAW_TELEGRAM_USER_BOT_API_BASE_URL ?? "https://api.telegram.org"; -export type TelegramBotApiLimits = { +type TelegramBotApiLimits = { bodyMaxBytes: number; timeoutMs: number; }; diff --git a/scripts/lib/android-version.ts b/scripts/lib/android-version.ts index d44ac1095cb8..0afcba4afbc7 100644 --- a/scripts/lib/android-version.ts +++ b/scripts/lib/android-version.ts @@ -14,7 +14,7 @@ type AndroidVersionManifest = { versionCode: number; }; -export type ResolvedAndroidVersion = { +type ResolvedAndroidVersion = { canonicalVersion: string; changelogPath: string; releaseNotesPath: string; diff --git a/scripts/lib/copy-assets.ts b/scripts/lib/copy-assets.ts index e1a030a7dda1..1765657e3b06 100644 --- a/scripts/lib/copy-assets.ts +++ b/scripts/lib/copy-assets.ts @@ -3,7 +3,7 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; -export type BuildCopyContext = { +type BuildCopyContext = { prefix: string; projectRoot: string; verbose: boolean; diff --git a/scripts/lib/gateway-bench-child.ts b/scripts/lib/gateway-bench-child.ts index 5f594dd8f1e4..263c7fbccf40 100644 --- a/scripts/lib/gateway-bench-child.ts +++ b/scripts/lib/gateway-bench-child.ts @@ -18,7 +18,7 @@ export type StopChildResult = ChildExit & { exitedBeforeTeardown: boolean; }; -export type StopChildOptions = { +type StopChildOptions = { killGraceMs?: number; platform?: NodeJS.Platform; runTaskkill?: typeof spawnSync; diff --git a/scripts/lib/gateway-ws-client.ts b/scripts/lib/gateway-ws-client.ts index 1e3157b5b57d..6ed413a50aa2 100644 --- a/scripts/lib/gateway-ws-client.ts +++ b/scripts/lib/gateway-ws-client.ts @@ -2,8 +2,8 @@ import { randomUUID } from "node:crypto"; import WebSocket from "ws"; -export type GatewayReqFrame = { type: "req"; id: string; method: string; params?: unknown }; -export type GatewayResFrame = { +type GatewayReqFrame = { type: "req"; id: string; method: string; params?: unknown }; +type GatewayResFrame = { type: "res"; id: string; ok: boolean; diff --git a/scripts/lib/npm-verify-exec.ts b/scripts/lib/npm-verify-exec.ts index 0ca0b9e5a353..6d8e22800439 100644 --- a/scripts/lib/npm-verify-exec.ts +++ b/scripts/lib/npm-verify-exec.ts @@ -1,7 +1,7 @@ // Npm Verify Exec script supports OpenClaw repository automation. import { execFileSync } from "node:child_process"; -export type NpmVerifyCommandInvocation = { +type NpmVerifyCommandInvocation = { command: string; args: string[]; windowsVerbatimArguments?: boolean; diff --git a/scripts/lib/openclaw-release-clawhub-plan.ts b/scripts/lib/openclaw-release-clawhub-plan.ts index dbb06756ff7d..ac33a3bd3055 100644 --- a/scripts/lib/openclaw-release-clawhub-plan.ts +++ b/scripts/lib/openclaw-release-clawhub-plan.ts @@ -22,7 +22,7 @@ type ClawHubDispatchTarget = { inputs: ClawHubDispatchInputs; }; -export type OpenClawReleaseClawHubPlanArgs = { +type OpenClawReleaseClawHubPlanArgs = { releaseTag: string; releasePublishBranch: string; releasePublishRunId: string; @@ -30,7 +30,7 @@ export type OpenClawReleaseClawHubPlanArgs = { plugins: string[]; }; -export type OpenClawReleaseClawHubPlan = { +type OpenClawReleaseClawHubPlan = { clawHubWorkflowRef: string; releasePublishBranch: string; normal: ClawHubDispatchTarget; @@ -48,7 +48,7 @@ export type OpenClawReleaseClawHubPlan = { }; }; -export type OpenClawReleaseClawHubRuntimeStateArgs = { +type OpenClawReleaseClawHubRuntimeStateArgs = { repository: string; waitForClawHub: boolean; forceSkipClawHub: boolean; @@ -57,7 +57,7 @@ export type OpenClawReleaseClawHubRuntimeStateArgs = { bootstrapCompleted: boolean; }; -export type OpenClawReleaseClawHubRuntimeState = { +type OpenClawReleaseClawHubRuntimeState = { verifierArgs: string[]; proofLines: { normal: string; diff --git a/scripts/lib/plugin-npm-release.ts b/scripts/lib/plugin-npm-release.ts index 184a28257518..3eccc7272823 100644 --- a/scripts/lib/plugin-npm-release.ts +++ b/scripts/lib/plugin-npm-release.ts @@ -76,7 +76,7 @@ export type GitRangeSelection = { headRef: string; }; -export type ParsedPluginReleaseArgs = { +type ParsedPluginReleaseArgs = { selection: string[]; selectionMode?: PluginReleaseSelectionMode; pluginsFlagProvided: boolean; @@ -98,14 +98,13 @@ function parsePluginNpmDistTagOverride(value: string | undefined): "extended-sta throw new Error(`Unknown npm dist-tag override: ${value}. Expected "extended-stable".`); } -export type PublishablePluginPackageCandidate< - TPackageJson extends PluginPackageJson = PluginPackageJson, -> = { - extensionId: string; - packageDir: string; - packageJson: TPackageJson; - readmeText?: string; -}; +type PublishablePluginPackageCandidate = + { + extensionId: string; + packageDir: string; + packageJson: TPackageJson; + readmeText?: string; + }; export const OPENCLAW_PLUGIN_NPM_REPOSITORY_URL = "https://github.com/openclaw/openclaw"; @@ -402,7 +401,7 @@ export function collectPublishablePluginPackageErrors( return errors; } -export type PublishablePluginPackageFilters = { +type PublishablePluginPackageFilters = { extensionIds?: readonly string[]; packageNames?: readonly string[]; npmDistTag?: "extended-stable"; diff --git a/scripts/lib/release-beta-verifier.ts b/scripts/lib/release-beta-verifier.ts index 0d85a8331091..2f96ec4b6c05 100644 --- a/scripts/lib/release-beta-verifier.ts +++ b/scripts/lib/release-beta-verifier.ts @@ -11,7 +11,7 @@ import { type JsonRecord = Record; -export type ReleaseVerifyBetaArgs = { +type ReleaseVerifyBetaArgs = { version: string; tag: string; distTag: string; @@ -35,7 +35,7 @@ export type ReleaseVerifyBetaArgs = { }; }; -export type NpmViewFields = { +type NpmViewFields = { version?: string; distTagVersion?: string; integrity?: string; diff --git a/scripts/lib/version-script-args.ts b/scripts/lib/version-script-args.ts index 9ec5d8446673..ce3939ea1b87 100644 --- a/scripts/lib/version-script-args.ts +++ b/scripts/lib/version-script-args.ts @@ -1,15 +1,15 @@ import path from "node:path"; -export type VersionScriptFormat = "json" | "shell"; -export type VersionQueryCliOptions = { +type VersionScriptFormat = "json" | "shell"; +type VersionQueryCliOptions = { field: string | null; format: VersionScriptFormat; help: boolean; releaseVersion: string | null; rootDir: string; }; -export type VersionSyncMode = "check" | "write"; -export type VersionSyncCliOptions = { +type VersionSyncMode = "check" | "write"; +type VersionSyncCliOptions = { help: boolean; mode: VersionSyncMode; releaseVersion: string | null; diff --git a/scripts/test-env-mutation-report.ts b/scripts/test-env-mutation-report.ts index 1dcfc56f73d0..4e4ea687378d 100644 --- a/scripts/test-env-mutation-report.ts +++ b/scripts/test-env-mutation-report.ts @@ -10,7 +10,7 @@ import { collectFilesSync, isCodeFile, toPosixPath } from "./check-file-utils.js type EnvMutationOperation = "assign" | "delete" | "replace" | "stubEnv"; -export type TestEnvMutationFinding = { +type TestEnvMutationFinding = { allowed: boolean; allowReason?: string; excerpt: string; diff --git a/scripts/test-skip-inventory.ts b/scripts/test-skip-inventory.ts index cbd4272706ae..4506c26b8898 100644 --- a/scripts/test-skip-inventory.ts +++ b/scripts/test-skip-inventory.ts @@ -20,7 +20,7 @@ type SkipInventoryReason = type SkipInventoryTarget = "describe" | "it" | "test" | "unknown"; -export type TestSkipInventoryFinding = { +type TestSkipInventoryFinding = { excerpt: string; file: string; kind: SkipInventoryKind;