diff --git a/scripts/deadcode-exports.baseline.mjs b/scripts/deadcode-exports.baseline.mjs index 857c37b7370f..16d62b1752ee 100644 --- a/scripts/deadcode-exports.baseline.mjs +++ b/scripts/deadcode-exports.baseline.mjs @@ -949,22 +949,15 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [ "src/cli/command-path-policy.ts: resolveCliCatalogCommandPath", "src/cli/command-secret-gateway.ts: testing", "src/cli/cron-cli/register.cron-simple.ts: loadCronJobForShow", - "src/cli/daemon-cli/launchd-recovery.ts: LAUNCH_AGENT_RECOVERY_MESSAGE", "src/cli/daemon-cli/response.ts: buildDaemonHintItems", - "src/cli/gateway-cli/qa-parent-watchdog.ts: QA_PARENT_PID_ENV", - "src/cli/gateway-cli/qa-parent-watchdog.ts: QA_STAGED_RUNTIME_ROOT_ENV", - "src/cli/gateway-cli/qa-parent-watchdog.ts: QA_TEMP_ROOT_ENV", "src/cli/gateway-cli/run.ts: testing", "src/cli/nodes-camera.ts: writeUrlToFile", "src/cli/plugins-install-command.ts: loadConfigForInstall", "src/cli/plugins-list-format.ts: formatPluginLine", - "src/cli/plugins-uninstall-command.ts: PluginUninstallOptions", "src/cli/ports.ts: listPortListeners", "src/cli/ports.ts: parseLsofOutput", - "src/cli/ports.ts: PortProcess", "src/cli/ports.ts: probePortFree", "src/cli/startup-metadata.ts: testing", - "src/cli/tagline.ts: DEFAULT_TAGLINE", "src/cli/update-cli/progress.ts: inferUpdateFailureHints", "src/cli/update-cli/update-command-plugins.ts: buildInvalidConfigPostCoreUpdateResult", "src/cli/update-cli/update-command-plugins.ts: collectMissingPluginInstallPayloads", diff --git a/scripts/test-force.ts b/scripts/test-force.ts index c550fb3b5784..4119c54e007d 100755 --- a/scripts/test-force.ts +++ b/scripts/test-force.ts @@ -4,9 +4,11 @@ import { spawnSync } from "node:child_process"; import os from "node:os"; import path from "node:path"; import { pathToFileURL } from "node:url"; -import { forceFreePort, type PortProcess } from "../src/cli/ports.js"; +import { forceFreePort } from "../src/cli/ports.js"; import { resolveGatewayPort } from "../src/config/config.js"; +type PortProcess = ReturnType[number]; + function usage(): string { return [ "Usage: node --import tsx scripts/test-force.ts", diff --git a/src/cli/daemon-cli/launchd-recovery.test.ts b/src/cli/daemon-cli/launchd-recovery.test.ts index a0fe35bd5886..c10757ae7bda 100644 --- a/src/cli/daemon-cli/launchd-recovery.test.ts +++ b/src/cli/daemon-cli/launchd-recovery.test.ts @@ -20,12 +20,10 @@ vi.mock("../../daemon/launchd.js", () => ({ })); let recoverInstalledLaunchAgent: typeof import("./launchd-recovery.js").recoverInstalledLaunchAgent; -let LAUNCH_AGENT_RECOVERY_MESSAGE: typeof import("./launchd-recovery.js").LAUNCH_AGENT_RECOVERY_MESSAGE; describe("recoverInstalledLaunchAgent", () => { beforeAll(async () => { - ({ recoverInstalledLaunchAgent, LAUNCH_AGENT_RECOVERY_MESSAGE } = - await import("./launchd-recovery.js")); + ({ recoverInstalledLaunchAgent } = await import("./launchd-recovery.js")); }); beforeEach(() => { @@ -57,7 +55,7 @@ describe("recoverInstalledLaunchAgent", () => { await expect(recoverInstalledLaunchAgent({ result: "restarted" })).resolves.toEqual({ result: "restarted", loaded: true, - message: LAUNCH_AGENT_RECOVERY_MESSAGE, + message: "Gateway LaunchAgent was installed but not loaded; re-bootstrapped launchd service.", }); expect(launchAgentPlistExists).toHaveBeenCalledWith(process.env); expect(repairLaunchAgentBootstrap).toHaveBeenCalledWith({ env: process.env }); diff --git a/src/cli/daemon-cli/launchd-recovery.ts b/src/cli/daemon-cli/launchd-recovery.ts index bb59d8d8987f..bd0a24b1cc55 100644 --- a/src/cli/daemon-cli/launchd-recovery.ts +++ b/src/cli/daemon-cli/launchd-recovery.ts @@ -53,6 +53,3 @@ export async function recoverInstalledLaunchAgent(params: { message: LAUNCH_AGENT_RECOVERY_MESSAGE, }; } - -/** User-facing recovery message for successful LaunchAgent bootstrap repair. */ -export { LAUNCH_AGENT_RECOVERY_MESSAGE }; diff --git a/src/cli/gateway-cli/qa-parent-watchdog.test.ts b/src/cli/gateway-cli/qa-parent-watchdog.test.ts index 4cb5c5db778f..8bd625ddc2da 100644 --- a/src/cli/gateway-cli/qa-parent-watchdog.test.ts +++ b/src/cli/gateway-cli/qa-parent-watchdog.test.ts @@ -1,11 +1,10 @@ // Gateway QA parent watchdog tests cover parent-process watchdog shutdown behavior. import { describe, expect, it, vi } from "vitest"; -import { - installQaParentWatchdog, - QA_PARENT_PID_ENV, - QA_STAGED_RUNTIME_ROOT_ENV, - QA_TEMP_ROOT_ENV, -} from "./qa-parent-watchdog.js"; +import { installQaParentWatchdog } from "./qa-parent-watchdog.js"; + +const QA_PARENT_PID_ENV = "OPENCLAW_QA_PARENT_PID"; +const QA_TEMP_ROOT_ENV = "OPENCLAW_QA_TEMP_ROOT"; +const QA_STAGED_RUNTIME_ROOT_ENV = "OPENCLAW_QA_STAGED_RUNTIME_ROOT"; describe("installQaParentWatchdog", () => { it("does not install without a QA parent pid", () => { diff --git a/src/cli/gateway-cli/qa-parent-watchdog.ts b/src/cli/gateway-cli/qa-parent-watchdog.ts index 61c1a00aa9ab..c0bdc34b1e92 100644 --- a/src/cli/gateway-cli/qa-parent-watchdog.ts +++ b/src/cli/gateway-cli/qa-parent-watchdog.ts @@ -4,9 +4,9 @@ import path from "node:path"; import { uniqueStrings } from "@openclaw/normalization-core/string-normalization"; import { createSubsystemLogger } from "../../logging/subsystem.js"; -export const QA_PARENT_PID_ENV = "OPENCLAW_QA_PARENT_PID"; -export const QA_TEMP_ROOT_ENV = "OPENCLAW_QA_TEMP_ROOT"; -export const QA_STAGED_RUNTIME_ROOT_ENV = "OPENCLAW_QA_STAGED_RUNTIME_ROOT"; +const QA_PARENT_PID_ENV = "OPENCLAW_QA_PARENT_PID"; +const QA_TEMP_ROOT_ENV = "OPENCLAW_QA_TEMP_ROOT"; +const QA_STAGED_RUNTIME_ROOT_ENV = "OPENCLAW_QA_STAGED_RUNTIME_ROOT"; const DEFAULT_QA_PARENT_WATCHDOG_INTERVAL_MS = 1000; const QA_TEMP_ROOT_PREFIX = "openclaw-qa-suite-"; diff --git a/src/cli/plugins-uninstall-command.ts b/src/cli/plugins-uninstall-command.ts index 1b0bd8f566c9..b5a3119b2cc4 100644 --- a/src/cli/plugins-uninstall-command.ts +++ b/src/cli/plugins-uninstall-command.ts @@ -12,7 +12,7 @@ import { import { defaultRuntime, type RuntimeEnv } from "../runtime.js"; import { shortenHomePath } from "../utils.js"; -export type PluginUninstallOptions = { +type PluginUninstallOptions = { keepFiles?: boolean; /** @deprecated Use keepFiles. */ keepConfig?: boolean; diff --git a/src/cli/ports.ts b/src/cli/ports.ts index 1cc6a52bb4ff..f6f27b32daa5 100644 --- a/src/cli/ports.ts +++ b/src/cli/ports.ts @@ -10,7 +10,7 @@ import { getWindowsSystem32ExePath } from "../infra/windows-install-roots.js"; import { resolvePositiveTimerTimeoutMs, resolveTimerTimeoutMs } from "../shared/number-coercion.js"; import { sleep } from "../utils.js"; -export type PortProcess = { pid: number; command?: string }; +type PortProcess = { pid: number; command?: string }; type ForceFreePortResult = { killed: PortProcess[]; diff --git a/src/cli/program.force.test.ts b/src/cli/program.force.test.ts index 62bd936f14f9..a52085e74da0 100644 --- a/src/cli/program.force.test.ts +++ b/src/cli/program.force.test.ts @@ -21,10 +21,11 @@ import { forceFreePort, forceFreePortAndWait, listPortListeners, - type PortProcess, parseLsofOutput, } from "./ports.js"; +type PortProcess = ReturnType[number]; + describe("gateway --force helpers", () => { let originalKill: typeof process.kill; let originalPlatform: NodeJS.Platform; diff --git a/src/cli/tagline.test.ts b/src/cli/tagline.test.ts index 5ca374dd0520..8c499dcaa058 100644 --- a/src/cli/tagline.test.ts +++ b/src/cli/tagline.test.ts @@ -1,6 +1,8 @@ // Tagline tests cover CLI tagline selection and display formatting. import { describe, expect, it } from "vitest"; -import { DEFAULT_TAGLINE, pickTagline } from "./tagline.js"; +import { pickTagline } from "./tagline.js"; + +const EXPECTED_DEFAULT_TAGLINE = "All your chats, one OpenClaw."; describe("pickTagline", () => { it("returns empty string when mode is off", () => { @@ -8,7 +10,7 @@ describe("pickTagline", () => { }); it("returns default tagline when mode is default", () => { - expect(pickTagline({ mode: "default" })).toBe(DEFAULT_TAGLINE); + expect(pickTagline({ mode: "default" })).toBe(EXPECTED_DEFAULT_TAGLINE); }); it("keeps OPENCLAW_TAGLINE_INDEX behavior in random mode", () => { @@ -19,7 +21,7 @@ describe("pickTagline", () => { expect(value).toBe( "Your terminal just grew claws\u2014type something and let the bot pinch the busywork.", ); - expect(value).not.toBe(DEFAULT_TAGLINE); + expect(value).not.toBe(EXPECTED_DEFAULT_TAGLINE); }); it("ignores partial OPENCLAW_TAGLINE_INDEX values", () => { diff --git a/src/cli/tagline.ts b/src/cli/tagline.ts index 5d7cd20f327c..ee79127b7d81 100644 --- a/src/cli/tagline.ts +++ b/src/cli/tagline.ts @@ -330,5 +330,3 @@ export function pickTagline(options: TaglineOptions = {}): string { const index = Math.floor(rand() * pool.length) % pool.length; return expectDefined(pool[index], "pool entry at index"); } - -export { DEFAULT_TAGLINE };