chore: rename project to clawdbot
This commit is contained in:
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
type EnsureClawdisPathOpts = {
|
||||
type EnsureClawdbotPathOpts = {
|
||||
execPath?: string;
|
||||
cwd?: string;
|
||||
homeDir?: string;
|
||||
@@ -47,7 +47,7 @@ function mergePath(params: { existing: string; prepend: string[] }): string {
|
||||
return merged.join(path.delimiter);
|
||||
}
|
||||
|
||||
function candidateBinDirs(opts: EnsureClawdisPathOpts): string[] {
|
||||
function candidateBinDirs(opts: EnsureClawdbotPathOpts): string[] {
|
||||
const execPath = opts.execPath ?? process.execPath;
|
||||
const cwd = opts.cwd ?? process.cwd();
|
||||
const homeDir = opts.homeDir ?? os.homedir();
|
||||
@@ -55,19 +55,19 @@ function candidateBinDirs(opts: EnsureClawdisPathOpts): string[] {
|
||||
|
||||
const candidates: string[] = [];
|
||||
|
||||
// Bun bundled (macOS app): `clawdis` lives in the Relay dir (process.execPath).
|
||||
// Bun bundled (macOS app): `clawdbot` lives in the Relay dir (process.execPath).
|
||||
try {
|
||||
const execDir = path.dirname(execPath);
|
||||
const siblingClawdis = path.join(execDir, "clawdis");
|
||||
if (isExecutable(siblingClawdis)) candidates.push(execDir);
|
||||
const siblingClawdbot = path.join(execDir, "clawdbot");
|
||||
if (isExecutable(siblingClawdbot)) candidates.push(execDir);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
// Project-local installs (best effort): if a `node_modules/.bin/clawdis` exists near cwd,
|
||||
// Project-local installs (best effort): if a `node_modules/.bin/clawdbot` exists near cwd,
|
||||
// include it. This helps when running under launchd or other minimal PATH environments.
|
||||
const localBinDir = path.join(cwd, "node_modules", ".bin");
|
||||
if (isExecutable(path.join(localBinDir, "clawdis")))
|
||||
if (isExecutable(path.join(localBinDir, "clawdbot")))
|
||||
candidates.push(localBinDir);
|
||||
|
||||
const miseDataDir =
|
||||
@@ -90,12 +90,12 @@ function candidateBinDirs(opts: EnsureClawdisPathOpts): string[] {
|
||||
}
|
||||
|
||||
/**
|
||||
* Best-effort PATH bootstrap so skills that require the `clawdis` CLI can run
|
||||
* Best-effort PATH bootstrap so skills that require the `clawdbot` CLI can run
|
||||
* under launchd/minimal environments (and inside the macOS bun bundle).
|
||||
*/
|
||||
export function ensureClawdisCliOnPath(opts: EnsureClawdisPathOpts = {}) {
|
||||
if (process.env.CLAWDIS_PATH_BOOTSTRAPPED === "1") return;
|
||||
process.env.CLAWDIS_PATH_BOOTSTRAPPED = "1";
|
||||
export function ensureClawdbotCliOnPath(opts: EnsureClawdbotPathOpts = {}) {
|
||||
if (process.env.CLAWDBOT_PATH_BOOTSTRAPPED === "1") return;
|
||||
process.env.CLAWDBOT_PATH_BOOTSTRAPPED = "1";
|
||||
|
||||
const existing = opts.pathEnv ?? process.env.PATH ?? "";
|
||||
const prepend = candidateBinDirs(opts);
|
||||
|
||||
Reference in New Issue
Block a user