chore: rename project to clawdbot
This commit is contained in:
@@ -4,24 +4,24 @@ import path from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { ensureClawdisCliOnPath } from "./path-env.js";
|
||||
import { ensureClawdbotCliOnPath } from "./path-env.js";
|
||||
|
||||
describe("ensureClawdisCliOnPath", () => {
|
||||
it("prepends the bundled Relay dir when a sibling clawdis exists", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdis-path-"));
|
||||
describe("ensureClawdbotCliOnPath", () => {
|
||||
it("prepends the bundled Relay dir when a sibling clawdbot exists", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-path-"));
|
||||
try {
|
||||
const relayDir = path.join(tmp, "Relay");
|
||||
await fs.mkdir(relayDir, { recursive: true });
|
||||
const cliPath = path.join(relayDir, "clawdis");
|
||||
const cliPath = path.join(relayDir, "clawdbot");
|
||||
await fs.writeFile(cliPath, "#!/bin/sh\necho ok\n", "utf-8");
|
||||
await fs.chmod(cliPath, 0o755);
|
||||
|
||||
const originalPath = process.env.PATH;
|
||||
const originalFlag = process.env.CLAWDIS_PATH_BOOTSTRAPPED;
|
||||
const originalFlag = process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
process.env.PATH = "/usr/bin";
|
||||
delete process.env.CLAWDIS_PATH_BOOTSTRAPPED;
|
||||
delete process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
try {
|
||||
ensureClawdisCliOnPath({
|
||||
ensureClawdbotCliOnPath({
|
||||
execPath: cliPath,
|
||||
cwd: tmp,
|
||||
homeDir: tmp,
|
||||
@@ -32,8 +32,8 @@ describe("ensureClawdisCliOnPath", () => {
|
||||
} finally {
|
||||
process.env.PATH = originalPath;
|
||||
if (originalFlag === undefined)
|
||||
delete process.env.CLAWDIS_PATH_BOOTSTRAPPED;
|
||||
else process.env.CLAWDIS_PATH_BOOTSTRAPPED = originalFlag;
|
||||
delete process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
else process.env.CLAWDBOT_PATH_BOOTSTRAPPED = originalFlag;
|
||||
}
|
||||
} finally {
|
||||
await fs.rm(tmp, { recursive: true, force: true });
|
||||
@@ -42,11 +42,11 @@ describe("ensureClawdisCliOnPath", () => {
|
||||
|
||||
it("is idempotent", () => {
|
||||
const originalPath = process.env.PATH;
|
||||
const originalFlag = process.env.CLAWDIS_PATH_BOOTSTRAPPED;
|
||||
const originalFlag = process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
process.env.PATH = "/bin";
|
||||
process.env.CLAWDIS_PATH_BOOTSTRAPPED = "1";
|
||||
process.env.CLAWDBOT_PATH_BOOTSTRAPPED = "1";
|
||||
try {
|
||||
ensureClawdisCliOnPath({
|
||||
ensureClawdbotCliOnPath({
|
||||
execPath: "/tmp/does-not-matter",
|
||||
cwd: "/tmp",
|
||||
homeDir: "/tmp",
|
||||
@@ -56,26 +56,26 @@ describe("ensureClawdisCliOnPath", () => {
|
||||
} finally {
|
||||
process.env.PATH = originalPath;
|
||||
if (originalFlag === undefined)
|
||||
delete process.env.CLAWDIS_PATH_BOOTSTRAPPED;
|
||||
else process.env.CLAWDIS_PATH_BOOTSTRAPPED = originalFlag;
|
||||
delete process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
else process.env.CLAWDBOT_PATH_BOOTSTRAPPED = originalFlag;
|
||||
}
|
||||
});
|
||||
|
||||
it("prepends mise shims when available", async () => {
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdis-path-"));
|
||||
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-path-"));
|
||||
const originalPath = process.env.PATH;
|
||||
const originalFlag = process.env.CLAWDIS_PATH_BOOTSTRAPPED;
|
||||
const originalFlag = process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
const originalMiseDataDir = process.env.MISE_DATA_DIR;
|
||||
try {
|
||||
const relayDir = path.join(tmp, "Relay");
|
||||
await fs.mkdir(relayDir, { recursive: true });
|
||||
const relayCli = path.join(relayDir, "clawdis");
|
||||
const relayCli = path.join(relayDir, "clawdbot");
|
||||
await fs.writeFile(relayCli, "#!/bin/sh\necho ok\n", "utf-8");
|
||||
await fs.chmod(relayCli, 0o755);
|
||||
|
||||
const localBinDir = path.join(tmp, "node_modules", ".bin");
|
||||
await fs.mkdir(localBinDir, { recursive: true });
|
||||
const localCli = path.join(localBinDir, "clawdis");
|
||||
const localCli = path.join(localBinDir, "clawdbot");
|
||||
await fs.writeFile(localCli, "#!/bin/sh\necho ok\n", "utf-8");
|
||||
await fs.chmod(localCli, 0o755);
|
||||
|
||||
@@ -84,9 +84,9 @@ describe("ensureClawdisCliOnPath", () => {
|
||||
await fs.mkdir(shimsDir, { recursive: true });
|
||||
process.env.MISE_DATA_DIR = miseDataDir;
|
||||
process.env.PATH = "/usr/bin";
|
||||
delete process.env.CLAWDIS_PATH_BOOTSTRAPPED;
|
||||
delete process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
|
||||
ensureClawdisCliOnPath({
|
||||
ensureClawdbotCliOnPath({
|
||||
execPath: relayCli,
|
||||
cwd: tmp,
|
||||
homeDir: tmp,
|
||||
@@ -104,8 +104,8 @@ describe("ensureClawdisCliOnPath", () => {
|
||||
} finally {
|
||||
process.env.PATH = originalPath;
|
||||
if (originalFlag === undefined)
|
||||
delete process.env.CLAWDIS_PATH_BOOTSTRAPPED;
|
||||
else process.env.CLAWDIS_PATH_BOOTSTRAPPED = originalFlag;
|
||||
delete process.env.CLAWDBOT_PATH_BOOTSTRAPPED;
|
||||
else process.env.CLAWDBOT_PATH_BOOTSTRAPPED = originalFlag;
|
||||
if (originalMiseDataDir === undefined) delete process.env.MISE_DATA_DIR;
|
||||
else process.env.MISE_DATA_DIR = originalMiseDataDir;
|
||||
await fs.rm(tmp, { recursive: true, force: true });
|
||||
|
||||
Reference in New Issue
Block a user