mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 22:01:24 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -4,15 +4,15 @@ import path from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { ensureClawdbotCliOnPath } from "./path-env.js";
|
||||
import { ensureMoltbotCliOnPath } from "./path-env.js";
|
||||
|
||||
describe("ensureClawdbotCliOnPath", () => {
|
||||
it("prepends the bundled app bin dir when a sibling clawdbot exists", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-path-"));
|
||||
describe("ensureMoltbotCliOnPath", () => {
|
||||
it("prepends the bundled app bin dir when a sibling moltbot exists", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-path-"));
|
||||
try {
|
||||
const appBinDir = path.join(tmp, "AppBin");
|
||||
await fs.mkdir(appBinDir, { recursive: true });
|
||||
const cliPath = path.join(appBinDir, "clawdbot");
|
||||
const cliPath = path.join(appBinDir, "moltbot");
|
||||
await fs.writeFile(cliPath, "#!/bin/sh\necho ok\n", "utf-8");
|
||||
await fs.chmod(cliPath, 0o755);
|
||||
|
||||
@@ -21,7 +21,7 @@ describe("ensureClawdbotCliOnPath", () => {
|
||||
process.env.PATH = "/usr/bin";
|
||||
delete process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
try {
|
||||
ensureClawdbotCliOnPath({
|
||||
ensureMoltbotCliOnPath({
|
||||
execPath: cliPath,
|
||||
cwd: tmp,
|
||||
homeDir: tmp,
|
||||
@@ -45,7 +45,7 @@ describe("ensureClawdbotCliOnPath", () => {
|
||||
process.env.PATH = "/bin";
|
||||
process.env.CLAWDBOT_PATH_BOOTSTRAPPED = "1";
|
||||
try {
|
||||
ensureClawdbotCliOnPath({
|
||||
ensureMoltbotCliOnPath({
|
||||
execPath: "/tmp/does-not-matter",
|
||||
cwd: "/tmp",
|
||||
homeDir: "/tmp",
|
||||
@@ -60,20 +60,20 @@ describe("ensureClawdbotCliOnPath", () => {
|
||||
});
|
||||
|
||||
it("prepends mise shims when available", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-path-"));
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-path-"));
|
||||
const originalPath = process.env.PATH;
|
||||
const originalFlag = process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
const originalMiseDataDir = process.env.MISE_DATA_DIR;
|
||||
try {
|
||||
const appBinDir = path.join(tmp, "AppBin");
|
||||
await fs.mkdir(appBinDir, { recursive: true });
|
||||
const appCli = path.join(appBinDir, "clawdbot");
|
||||
const appCli = path.join(appBinDir, "moltbot");
|
||||
await fs.writeFile(appCli, "#!/bin/sh\necho ok\n", "utf-8");
|
||||
await fs.chmod(appCli, 0o755);
|
||||
|
||||
const localBinDir = path.join(tmp, "node_modules", ".bin");
|
||||
await fs.mkdir(localBinDir, { recursive: true });
|
||||
const localCli = path.join(localBinDir, "clawdbot");
|
||||
const localCli = path.join(localBinDir, "moltbot");
|
||||
await fs.writeFile(localCli, "#!/bin/sh\necho ok\n", "utf-8");
|
||||
await fs.chmod(localCli, 0o755);
|
||||
|
||||
@@ -84,7 +84,7 @@ describe("ensureClawdbotCliOnPath", () => {
|
||||
process.env.PATH = "/usr/bin";
|
||||
delete process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
|
||||
ensureClawdbotCliOnPath({
|
||||
ensureMoltbotCliOnPath({
|
||||
execPath: appCli,
|
||||
cwd: tmp,
|
||||
homeDir: tmp,
|
||||
@@ -110,7 +110,7 @@ describe("ensureClawdbotCliOnPath", () => {
|
||||
});
|
||||
|
||||
it("prepends Linuxbrew dirs when present", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-path-"));
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-path-"));
|
||||
const originalPath = process.env.PATH;
|
||||
const originalFlag = process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
const originalHomebrewPrefix = process.env.HOMEBREW_PREFIX;
|
||||
@@ -131,7 +131,7 @@ describe("ensureClawdbotCliOnPath", () => {
|
||||
delete process.env.HOMEBREW_BREW_FILE;
|
||||
delete process.env.XDG_BIN_HOME;
|
||||
|
||||
ensureClawdbotCliOnPath({
|
||||
ensureMoltbotCliOnPath({
|
||||
execPath: path.join(execDir, "node"),
|
||||
cwd: tmp,
|
||||
homeDir: tmp,
|
||||
|
||||
Reference in New Issue
Block a user