refactor: rename to openclaw

This commit is contained in:
Peter Steinberger
2026-01-30 03:15:10 +01:00
parent 4583f88626
commit 9a7160786a
2357 changed files with 16688 additions and 16788 deletions

View File

@@ -9,6 +9,9 @@ export type CommandRunner = (
options: { timeoutMs: number; cwd?: string; env?: NodeJS.ProcessEnv },
) => Promise<{ stdout: string; stderr: string; code: number | null }>;
const PRIMARY_PACKAGE_NAME = "openclaw";
const ALL_PACKAGE_NAMES = [PRIMARY_PACKAGE_NAME] as const;
async function pathExists(targetPath: string): Promise<boolean> {
try {
await fs.access(targetPath);
@@ -51,7 +54,7 @@ export async function resolveGlobalPackageRoot(
): Promise<string | null> {
const root = await resolveGlobalRoot(manager, runCommand, timeoutMs);
if (!root) return null;
return path.join(root, "moltbot");
return path.join(root, PRIMARY_PACKAGE_NAME);
}
export async function detectGlobalInstallManagerForRoot(
@@ -75,14 +78,18 @@ export async function detectGlobalInstallManagerForRoot(
const globalRoot = res.stdout.trim();
if (!globalRoot) continue;
const globalReal = await tryRealpath(globalRoot);
const expected = path.join(globalReal, "moltbot");
if (path.resolve(expected) === path.resolve(pkgReal)) return manager;
for (const name of ALL_PACKAGE_NAMES) {
const expected = path.join(globalReal, name);
if (path.resolve(expected) === path.resolve(pkgReal)) return manager;
}
}
const bunGlobalRoot = resolveBunGlobalRoot();
const bunGlobalReal = await tryRealpath(bunGlobalRoot);
const bunExpected = path.join(bunGlobalReal, "moltbot");
if (path.resolve(bunExpected) === path.resolve(pkgReal)) return "bun";
for (const name of ALL_PACKAGE_NAMES) {
const bunExpected = path.join(bunGlobalReal, name);
if (path.resolve(bunExpected) === path.resolve(pkgReal)) return "bun";
}
return null;
}
@@ -94,11 +101,15 @@ export async function detectGlobalInstallManagerByPresence(
for (const manager of ["npm", "pnpm"] as const) {
const root = await resolveGlobalRoot(manager, runCommand, timeoutMs);
if (!root) continue;
if (await pathExists(path.join(root, "moltbot"))) return manager;
for (const name of ALL_PACKAGE_NAMES) {
if (await pathExists(path.join(root, name))) return manager;
}
}
const bunRoot = resolveBunGlobalRoot();
if (await pathExists(path.join(bunRoot, "moltbot"))) return "bun";
for (const name of ALL_PACKAGE_NAMES) {
if (await pathExists(path.join(bunRoot, name))) return "bun";
}
return null;
}