refactor: rename clawdbot to moltbot with legacy compat

This commit is contained in:
Peter Steinberger
2026-01-27 12:19:58 +00:00
parent 83460df96f
commit 6d16a658e5
1839 changed files with 11250 additions and 11199 deletions

View File

@@ -5,7 +5,7 @@ import path from "node:path";
import type { Command } from "commander";
import { readConfigFileSnapshot, writeConfigFile } from "../config/config.js";
import { resolveClawdbotPackageRoot } from "../infra/clawdbot-root.js";
import { resolveMoltbotPackageRoot } from "../infra/moltbot-root.js";
import {
checkUpdateStatus,
compareSemverStrings,
@@ -81,7 +81,6 @@ const STEP_LABELS: Record<string, string> = {
"deps install": "Installing dependencies",
build: "Building",
"ui:build": "Building UI",
"clawdbot doctor": "Running doctor checks",
"moltbot doctor": "Running doctor checks",
"git rev-parse HEAD (after)": "Verifying update",
"global update": "Updating via package manager",
@@ -113,16 +112,16 @@ const UPDATE_QUIPS = [
const MAX_LOG_CHARS = 8000;
const DEFAULT_PACKAGE_NAME = "moltbot";
const CORE_PACKAGE_NAMES = new Set([DEFAULT_PACKAGE_NAME, "clawdbot"]);
const CORE_PACKAGE_NAMES = new Set([DEFAULT_PACKAGE_NAME, "moltbot"]);
const CLI_NAME = resolveCliName();
const CLAWDBOT_REPO_URL = "https://github.com/clawdbot/clawdbot.git";
const DEFAULT_GIT_DIR = path.join(os.homedir(), "clawdbot");
const CLAWDBOT_REPO_URL = "https://github.com/moltbot/moltbot.git";
const DEFAULT_GIT_DIR = path.join(os.homedir(), "moltbot");
function normalizeTag(value?: string | null): string | null {
if (!value) return null;
const trimmed = value.trim();
if (!trimmed) return null;
if (trimmed.startsWith("clawdbot@")) return trimmed.slice("clawdbot@".length);
if (trimmed.startsWith("moltbot@")) return trimmed.slice("moltbot@".length);
if (trimmed.startsWith(`${DEFAULT_PACKAGE_NAME}@`)) {
return trimmed.slice(`${DEFAULT_PACKAGE_NAME}@`.length);
}
@@ -272,7 +271,7 @@ async function ensureGitCheckout(params: {
const empty = await isEmptyDir(params.dir);
if (!empty) {
throw new Error(
`CLAWDBOT_GIT_DIR points at a non-git directory: ${params.dir}. Set CLAWDBOT_GIT_DIR to an empty folder or a clawdbot checkout.`,
`CLAWDBOT_GIT_DIR points at a non-git directory: ${params.dir}. Set CLAWDBOT_GIT_DIR to an empty folder or a moltbot checkout.`,
);
}
return await runUpdateStep({
@@ -337,7 +336,7 @@ export async function updateStatusCommand(opts: UpdateStatusOptions): Promise<vo
}
const root =
(await resolveClawdbotPackageRoot({
(await resolveMoltbotPackageRoot({
moduleUrl: import.meta.url,
argv1: process.argv[1],
cwd: process.cwd(),
@@ -412,7 +411,7 @@ export async function updateStatusCommand(opts: UpdateStatusOptions): Promise<vo
},
];
defaultRuntime.log(theme.heading("Clawdbot update status"));
defaultRuntime.log(theme.heading("Moltbot update status"));
defaultRuntime.log("");
defaultRuntime.log(
renderTable({
@@ -577,7 +576,7 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
}
const root =
(await resolveClawdbotPackageRoot({
(await resolveMoltbotPackageRoot({
moduleUrl: import.meta.url,
argv1: process.argv[1],
cwd: process.cwd(),
@@ -686,7 +685,7 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
const showProgress = !opts.json && process.stdout.isTTY;
if (!opts.json) {
defaultRuntime.log(theme.heading("Updating Clawdbot..."));
defaultRuntime.log(theme.heading("Updating Moltbot..."));
defaultRuntime.log("");
}
@@ -824,12 +823,12 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
if (result.reason === "not-git-install") {
defaultRuntime.log(
theme.warn(
`Skipped: this Clawdbot install isn't a git checkout, and the package manager couldn't be detected. Update via your package manager, then run \`${replaceCliName(formatCliCommand("clawdbot doctor"), CLI_NAME)}\` and \`${replaceCliName(formatCliCommand("clawdbot gateway restart"), CLI_NAME)}\`.`,
`Skipped: this Moltbot install isn't a git checkout, and the package manager couldn't be detected. Update via your package manager, then run \`${replaceCliName(formatCliCommand("moltbot doctor"), CLI_NAME)}\` and \`${replaceCliName(formatCliCommand("moltbot gateway restart"), CLI_NAME)}\`.`,
),
);
defaultRuntime.log(
theme.muted(
`Examples: \`${replaceCliName("npm i -g clawdbot@latest", CLI_NAME)}\` or \`${replaceCliName("pnpm add -g clawdbot@latest", CLI_NAME)}\``,
`Examples: \`${replaceCliName("npm i -g moltbot@latest", CLI_NAME)}\` or \`${replaceCliName("pnpm add -g moltbot@latest", CLI_NAME)}\``,
),
);
}
@@ -946,7 +945,7 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
defaultRuntime.log(theme.warn(`Daemon restart failed: ${String(err)}`));
defaultRuntime.log(
theme.muted(
`You may need to restart the service manually: ${replaceCliName(formatCliCommand("clawdbot gateway restart"), CLI_NAME)}`,
`You may need to restart the service manually: ${replaceCliName(formatCliCommand("moltbot gateway restart"), CLI_NAME)}`,
),
);
}
@@ -956,13 +955,13 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
if (result.mode === "npm" || result.mode === "pnpm") {
defaultRuntime.log(
theme.muted(
`Tip: Run \`${replaceCliName(formatCliCommand("clawdbot doctor"), CLI_NAME)}\`, then \`${replaceCliName(formatCliCommand("clawdbot gateway restart"), CLI_NAME)}\` to apply updates to a running gateway.`,
`Tip: Run \`${replaceCliName(formatCliCommand("moltbot doctor"), CLI_NAME)}\`, then \`${replaceCliName(formatCliCommand("moltbot gateway restart"), CLI_NAME)}\` to apply updates to a running gateway.`,
),
);
} else {
defaultRuntime.log(
theme.muted(
`Tip: Run \`${replaceCliName(formatCliCommand("clawdbot gateway restart"), CLI_NAME)}\` to apply updates to a running gateway.`,
`Tip: Run \`${replaceCliName(formatCliCommand("moltbot gateway restart"), CLI_NAME)}\` to apply updates to a running gateway.`,
),
);
}
@@ -976,7 +975,7 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
export async function updateWizardCommand(opts: UpdateWizardOptions = {}): Promise<void> {
if (!process.stdin.isTTY) {
defaultRuntime.error(
"Update wizard requires a TTY. Use `clawdbot update --channel <stable|beta|dev>` instead.",
"Update wizard requires a TTY. Use `moltbot update --channel <stable|beta|dev>` instead.",
);
defaultRuntime.exit(1);
return;
@@ -990,7 +989,7 @@ export async function updateWizardCommand(opts: UpdateWizardOptions = {}): Promi
}
const root =
(await resolveClawdbotPackageRoot({
(await resolveMoltbotPackageRoot({
moduleUrl: import.meta.url,
argv1: process.argv[1],
cwd: process.cwd(),
@@ -1067,7 +1066,7 @@ export async function updateWizardCommand(opts: UpdateWizardOptions = {}): Promi
const empty = await isEmptyDir(gitDir);
if (!empty) {
defaultRuntime.error(
`CLAWDBOT_GIT_DIR points at a non-git directory: ${gitDir}. Set CLAWDBOT_GIT_DIR to an empty folder or a clawdbot checkout.`,
`CLAWDBOT_GIT_DIR points at a non-git directory: ${gitDir}. Set CLAWDBOT_GIT_DIR to an empty folder or a moltbot checkout.`,
);
defaultRuntime.exit(1);
return;
@@ -1112,7 +1111,7 @@ export async function updateWizardCommand(opts: UpdateWizardOptions = {}): Promi
export function registerUpdateCli(program: Command) {
const update = program
.command("update")
.description("Update Clawdbot to the latest version")
.description("Update Moltbot to the latest version")
.option("--json", "Output result as JSON", false)
.option("--no-restart", "Skip restarting the gateway service after a successful update")
.option("--channel <stable|beta|dev>", "Persist update channel (git + npm)")
@@ -1121,15 +1120,15 @@ export function registerUpdateCli(program: Command) {
.option("--yes", "Skip confirmation prompts (non-interactive)", false)
.addHelpText("after", () => {
const examples = [
["clawdbot update", "Update a source checkout (git)"],
["clawdbot update --channel beta", "Switch to beta channel (git + npm)"],
["clawdbot update --channel dev", "Switch to dev channel (git + npm)"],
["clawdbot update --tag beta", "One-off update to a dist-tag or version"],
["clawdbot update --no-restart", "Update without restarting the service"],
["clawdbot update --json", "Output result as JSON"],
["clawdbot update --yes", "Non-interactive (accept downgrade prompts)"],
["clawdbot update wizard", "Interactive update wizard"],
["clawdbot --update", "Shorthand for clawdbot update"],
["moltbot update", "Update a source checkout (git)"],
["moltbot update --channel beta", "Switch to beta channel (git + npm)"],
["moltbot update --channel dev", "Switch to dev channel (git + npm)"],
["moltbot update --tag beta", "One-off update to a dist-tag or version"],
["moltbot update --no-restart", "Update without restarting the service"],
["moltbot update --json", "Output result as JSON"],
["moltbot update --yes", "Non-interactive (accept downgrade prompts)"],
["moltbot update wizard", "Interactive update wizard"],
["moltbot --update", "Shorthand for moltbot update"],
] as const;
const fmtExamples = examples
.map(([cmd, desc]) => ` ${theme.command(cmd)} ${theme.muted(`# ${desc}`)}`)
@@ -1141,7 +1140,7 @@ ${theme.heading("What this does:")}
${theme.heading("Switch channels:")}
- Use --channel stable|beta|dev to persist the update channel in config
- Run clawdbot update status to see the active channel and source
- Run moltbot update status to see the active channel and source
- Use --tag <dist-tag|version> for a one-off npm update without persisting
${theme.heading("Non-interactive:")}
@@ -1201,9 +1200,9 @@ ${theme.muted("Docs:")} ${formatDocsLink("/cli/update", "docs.molt.bot/cli/updat
"after",
() =>
`\n${theme.heading("Examples:")}\n${formatHelpExamples([
["clawdbot update status", "Show channel + version status."],
["clawdbot update status --json", "JSON output."],
["clawdbot update status --timeout 10", "Custom timeout."],
["moltbot update status", "Show channel + version status."],
["moltbot update status --json", "JSON output."],
["moltbot update status --timeout 10", "Custom timeout."],
])}\n\n${theme.heading("Notes:")}\n${theme.muted(
"- Shows current update channel (stable/beta/dev) and source",
)}\n${theme.muted("- Includes git tag/branch/SHA for source checkouts")}\n\n${theme.muted(