Comprehensive update to complete the openclaw → ironclaw CLI rename across the codebase, fix build/runtime issues, and add test coverage for infra modules. CLI binary rename (openclaw → ironclaw): - Update DEFAULT_CLI_NAME and all argv parsing to recognize "ironclaw" binary - Extend package name sets (CORE_PACKAGE_NAMES, ALL_PACKAGE_NAMES) to include both "ironclaw" and "openclaw" for backward compatibility - Update NPM registry URL to fetch from ironclaw package - Update gateway lock detection, port listener classification, and launchd/systemd service scanning to recognize ironclaw-prefixed services and binaries - Update daemon inspect markers and legacy detection for ironclaw - Update voice-call extension core-bridge to resolve ironclaw package root - Fix install instructions in embeddings error messages (npm i -g ironclaw@latest) Web app / Next.js fixes: - Replace fragile `npx next` invocations with direct `node next-bin` resolution to avoid broken pnpm virtual-store symlinks in global installs - Add resolveNextBin() helper that resolves apps/web/node_modules/next directly Infra hardening: - Workspace templates: compute both source and dist fallback paths for template directory resolution (fixes templates not found in bundled builds) - Control UI assets: recognize both "openclaw" and "ironclaw" package names - Update-check, update-runner, update-cli: normalize ironclaw@ tag prefixes New tests: - Add openclaw-root.test.ts, ports-format.test.ts, update-global.test.ts - Add workspace-templates.test.ts and control-ui-assets.test.ts coverage - Add argv.test.ts coverage for ironclaw binary detection Test fixes (28 failures → 0): - Update all test assertions expecting "openclaw" CLI command output to "ironclaw" - Fix version.test.ts package name from "openclaw" to "ironclaw" - Fix camera/canvas temp path patterns in nodes-camera and program.nodes-media tests - Fix pairing message, telegram bot, channels, daemon, onboard, gateway tool, status, and profile test expectations Version: 2026.2.10-1.2 (published to npm as ironclaw@2026.2.10-1.2) Co-authored-by: Cursor <cursoragent@cursor.com>
82 lines
2.9 KiB
TypeScript
82 lines
2.9 KiB
TypeScript
import fs from "node:fs/promises";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import type { CommandRunner } from "./update-global.js";
|
|
import {
|
|
detectGlobalInstallManagerByPresence,
|
|
detectGlobalInstallManagerForRoot,
|
|
resolveGlobalPackageRoot,
|
|
} from "./update-global.js";
|
|
|
|
function makeMockRunner(globalRoot: string): CommandRunner {
|
|
return async (argv) => {
|
|
const cmd = argv.join(" ");
|
|
if (cmd === "npm root -g" || cmd === "pnpm root -g") {
|
|
return { stdout: globalRoot, stderr: "", code: 0 };
|
|
}
|
|
return { stdout: "", stderr: "not found", code: 1 };
|
|
};
|
|
}
|
|
|
|
describe("update-global package name detection", () => {
|
|
it("resolveGlobalPackageRoot returns ironclaw path", async () => {
|
|
const root = await resolveGlobalPackageRoot("npm", makeMockRunner("/tmp/mock-root"), 3000);
|
|
expect(root).toBe("/tmp/mock-root/ironclaw");
|
|
});
|
|
|
|
it("detectGlobalInstallManagerForRoot matches ironclaw package root", async () => {
|
|
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-update-global-"));
|
|
const globalRoot = path.join(tmp, "node_modules");
|
|
const pkgRoot = path.join(globalRoot, "ironclaw");
|
|
await fs.mkdir(pkgRoot, { recursive: true });
|
|
|
|
const manager = await detectGlobalInstallManagerForRoot(
|
|
makeMockRunner(globalRoot),
|
|
pkgRoot,
|
|
3000,
|
|
);
|
|
expect(manager).toBe("npm");
|
|
|
|
await fs.rm(tmp, { recursive: true, force: true });
|
|
});
|
|
|
|
it("detectGlobalInstallManagerForRoot matches legacy openclaw package root", async () => {
|
|
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-update-global-"));
|
|
const globalRoot = path.join(tmp, "node_modules");
|
|
const pkgRoot = path.join(globalRoot, "openclaw");
|
|
await fs.mkdir(pkgRoot, { recursive: true });
|
|
|
|
const manager = await detectGlobalInstallManagerForRoot(
|
|
makeMockRunner(globalRoot),
|
|
pkgRoot,
|
|
3000,
|
|
);
|
|
expect(manager).toBe("npm");
|
|
|
|
await fs.rm(tmp, { recursive: true, force: true });
|
|
});
|
|
|
|
it("detectGlobalInstallManagerByPresence finds ironclaw dir", async () => {
|
|
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-update-global-"));
|
|
const ironclawDir = path.join(tmp, "ironclaw");
|
|
await fs.mkdir(ironclawDir, { recursive: true });
|
|
|
|
const manager = await detectGlobalInstallManagerByPresence(makeMockRunner(tmp), 3000);
|
|
expect(manager).toBe("npm");
|
|
|
|
await fs.rm(tmp, { recursive: true, force: true });
|
|
});
|
|
|
|
it("detectGlobalInstallManagerByPresence finds openclaw dir", async () => {
|
|
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-update-global-"));
|
|
const openclawDir = path.join(tmp, "openclaw");
|
|
await fs.mkdir(openclawDir, { recursive: true });
|
|
|
|
const manager = await detectGlobalInstallManagerByPresence(makeMockRunner(tmp), 3000);
|
|
expect(manager).toBe("npm");
|
|
|
|
await fs.rm(tmp, { recursive: true, force: true });
|
|
});
|
|
});
|