chore: drop Clawdis legacy references

This commit is contained in:
Peter Steinberger
2026-01-15 06:18:34 +00:00
parent 60748b1370
commit d59aab7fd3
31 changed files with 61 additions and 592 deletions

View File

@@ -6,11 +6,9 @@ export const GATEWAY_SERVICE_MARKER = "clawdbot";
export const GATEWAY_SERVICE_KIND = "gateway";
export const LEGACY_GATEWAY_LAUNCH_AGENT_LABELS = [
"com.steipete.clawdbot.gateway",
"com.steipete.clawdis.gateway",
"com.clawdis.gateway",
];
export const LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES = ["clawdis-gateway"];
export const LEGACY_GATEWAY_WINDOWS_TASK_NAMES = ["Clawdis Gateway"];
export const LEGACY_GATEWAY_SYSTEMD_SERVICE_NAMES: string[] = [];
export const LEGACY_GATEWAY_WINDOWS_TASK_NAMES: string[] = [];
export function resolveGatewayLaunchAgentLabel(profile?: string): string {
const trimmed = profile?.trim();

View File

@@ -25,7 +25,7 @@ export type FindExtraGatewayServicesOptions = {
deep?: boolean;
};
const EXTRA_MARKERS = ["clawdbot", "clawdis"];
const EXTRA_MARKERS = ["clawdbot"];
const execFileAsync = promisify(execFile);
export function renderGatewayServiceCleanupHints(

View File

@@ -57,7 +57,7 @@ export function resolveGatewayLogPaths(env: Record<string, string | undefined>):
stderrPath: string;
} {
const home = resolveHomeDir(env);
const stateOverride = env.CLAWDBOT_STATE_DIR?.trim() || env.CLAWDIS_STATE_DIR?.trim();
const stateOverride = env.CLAWDBOT_STATE_DIR?.trim();
const profile = env.CLAWDBOT_PROFILE?.trim();
const suffix = profile && profile.toLowerCase() !== "default" ? `-${profile}` : "";
const defaultStateDir = path.join(home, `.clawdbot${suffix}`);

View File

@@ -1,5 +1,4 @@
import { findLegacyLaunchAgents, uninstallLegacyLaunchAgents } from "./launchd.js";
import { findLegacyScheduledTasks, uninstallLegacyScheduledTasks } from "./schtasks.js";
import { findLegacySystemdUnits, uninstallLegacySystemdUnits } from "./systemd.js";
export type LegacyGatewayService = {
@@ -34,19 +33,6 @@ function formatLegacySystemdUnits(
}));
}
function formatLegacyScheduledTasks(
tasks: Awaited<ReturnType<typeof findLegacyScheduledTasks>>,
): LegacyGatewayService[] {
return tasks.map((task) => ({
platform: "win32",
label: task.name,
detail: [
task.installed ? "installed" : "not installed",
task.scriptExists ? `script: ${task.scriptPath}` : "script missing",
].join(", "),
}));
}
export async function findLegacyGatewayServices(
env: Record<string, string | undefined>,
): Promise<LegacyGatewayService[]> {
@@ -60,11 +46,6 @@ export async function findLegacyGatewayServices(
return formatLegacySystemdUnits(units);
}
if (process.platform === "win32") {
const tasks = await findLegacyScheduledTasks(env);
return formatLegacyScheduledTasks(tasks);
}
return [];
}
@@ -85,10 +66,5 @@ export async function uninstallLegacyGatewayServices({
return formatLegacySystemdUnits(units);
}
if (process.platform === "win32") {
const tasks = await uninstallLegacyScheduledTasks({ env, stdout });
return formatLegacyScheduledTasks(tasks);
}
return [];
}

View File

@@ -4,11 +4,7 @@ import path from "node:path";
import { promisify } from "node:util";
import { colorize, isRich, theme } from "../terminal/theme.js";
import {
formatGatewayServiceDescription,
LEGACY_GATEWAY_WINDOWS_TASK_NAMES,
resolveGatewayWindowsTaskName,
} from "./constants.js";
import { formatGatewayServiceDescription, resolveGatewayWindowsTaskName } from "./constants.js";
import { parseKeyValueOutput } from "./runtime-parse.js";
import type { GatewayServiceRuntime } from "./service-runtime.js";
@@ -32,10 +28,6 @@ function resolveTaskScriptPath(env: Record<string, string | undefined>): string
return path.join(home, `.clawdbot${suffix}`, "gateway.cmd");
}
function resolveLegacyTaskScriptPath(env: Record<string, string | undefined>): string {
const home = resolveHomeDir(env);
return path.join(home, ".clawdis", "gateway.cmd");
}
function quoteCmdArg(value: string): string {
if (!/[ \t"]/g.test(value)) return value;
@@ -351,77 +343,3 @@ export async function readScheduledTaskRuntime(
lastRunResult: parsed.lastRunResult,
};
}
export type LegacyScheduledTask = {
name: string;
scriptPath: string;
installed: boolean;
scriptExists: boolean;
};
export async function findLegacyScheduledTasks(
env: Record<string, string | undefined>,
): Promise<LegacyScheduledTask[]> {
const results: LegacyScheduledTask[] = [];
let schtasksAvailable = true;
try {
await assertSchtasksAvailable();
} catch {
schtasksAvailable = false;
}
for (const name of LEGACY_GATEWAY_WINDOWS_TASK_NAMES) {
const scriptPath = resolveLegacyTaskScriptPath(env);
let installed = false;
if (schtasksAvailable) {
const res = await execSchtasks(["/Query", "/TN", name]);
installed = res.code === 0;
}
let scriptExists = false;
try {
await fs.access(scriptPath);
scriptExists = true;
} catch {
// ignore
}
if (installed || scriptExists) {
results.push({ name, scriptPath, installed, scriptExists });
}
}
return results;
}
export async function uninstallLegacyScheduledTasks({
env,
stdout,
}: {
env: Record<string, string | undefined>;
stdout: NodeJS.WritableStream;
}): Promise<LegacyScheduledTask[]> {
const tasks = await findLegacyScheduledTasks(env);
if (tasks.length === 0) return tasks;
let schtasksAvailable = true;
try {
await assertSchtasksAvailable();
} catch {
schtasksAvailable = false;
}
for (const task of tasks) {
if (schtasksAvailable && task.installed) {
await execSchtasks(["/Delete", "/F", "/TN", task.name]);
} else if (!schtasksAvailable && task.installed) {
stdout.write(`schtasks unavailable; unable to remove legacy task: ${task.name}\n`);
}
try {
await fs.unlink(task.scriptPath);
stdout.write(`${formatLine("Removed legacy task script", task.scriptPath)}\n`);
} catch {
stdout.write(`Legacy task script not found at ${task.scriptPath}\n`);
}
}
return tasks;
}