refactor: rename to openclaw
This commit is contained in:
@@ -71,7 +71,9 @@ export async function ensureConfigReady(params: {
|
||||
params.runtime.error(legacyIssues.map((issue) => ` ${error(issue)}`).join("\n"));
|
||||
}
|
||||
params.runtime.error("");
|
||||
params.runtime.error(`${muted("Run:")} ${commandText(formatCliCommand("moltbot doctor --fix"))}`);
|
||||
params.runtime.error(
|
||||
`${muted("Run:")} ${commandText(formatCliCommand("openclaw doctor --fix"))}`,
|
||||
);
|
||||
if (!allowInvalid) {
|
||||
params.runtime.exit(1);
|
||||
}
|
||||
|
||||
@@ -8,21 +8,24 @@ import type { ProgramContext } from "./context.js";
|
||||
const CLI_NAME = resolveCliName();
|
||||
|
||||
const EXAMPLES = [
|
||||
["moltbot channels login --verbose", "Link personal WhatsApp Web and show QR + connection logs."],
|
||||
[
|
||||
'moltbot message send --target +15555550123 --message "Hi" --json',
|
||||
"openclaw channels login --verbose",
|
||||
"Link personal WhatsApp Web and show QR + connection logs.",
|
||||
],
|
||||
[
|
||||
'openclaw message send --target +15555550123 --message "Hi" --json',
|
||||
"Send via your web session and print JSON result.",
|
||||
],
|
||||
["moltbot gateway --port 18789", "Run the WebSocket Gateway locally."],
|
||||
["moltbot --dev gateway", "Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001."],
|
||||
["moltbot gateway --force", "Kill anything bound to the default gateway port, then start it."],
|
||||
["moltbot gateway ...", "Gateway control via WebSocket."],
|
||||
["openclaw gateway --port 18789", "Run the WebSocket Gateway locally."],
|
||||
["openclaw --dev gateway", "Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001."],
|
||||
["openclaw gateway --force", "Kill anything bound to the default gateway port, then start it."],
|
||||
["openclaw gateway ...", "Gateway control via WebSocket."],
|
||||
[
|
||||
'moltbot agent --to +15555550123 --message "Run summary" --deliver',
|
||||
'openclaw agent --to +15555550123 --message "Run summary" --deliver',
|
||||
"Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.",
|
||||
],
|
||||
[
|
||||
'moltbot message send --channel telegram --target @mychat --message "Hi"',
|
||||
'openclaw message send --channel telegram --target @mychat --message "Hi"',
|
||||
"Send via your Telegram bot.",
|
||||
],
|
||||
] as const;
|
||||
@@ -34,11 +37,11 @@ export function configureProgramHelp(program: Command, ctx: ProgramContext) {
|
||||
.version(ctx.programVersion)
|
||||
.option(
|
||||
"--dev",
|
||||
"Dev profile: isolate state under ~/.clawdbot-dev, default gateway port 19001, and shift derived ports (browser/canvas)",
|
||||
"Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)",
|
||||
)
|
||||
.option(
|
||||
"--profile <name>",
|
||||
"Use a named profile (isolates CLAWDBOT_STATE_DIR/CLAWDBOT_CONFIG_PATH under ~/.clawdbot-<name>)",
|
||||
"Use a named profile (isolates OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH under ~/.openclaw-<name>)",
|
||||
);
|
||||
|
||||
program.option("--no-color", "Disable ANSI colors", false);
|
||||
@@ -82,7 +85,7 @@ export function configureProgramHelp(program: Command, ctx: ProgramContext) {
|
||||
|
||||
program.addHelpText("afterAll", ({ command }) => {
|
||||
if (command !== program) return "";
|
||||
const docs = formatDocsLink("/cli", "docs.molt.bot/cli");
|
||||
const docs = formatDocsLink("/cli", "docs.openclaw.ai/cli");
|
||||
return `\n${theme.heading("Examples:")}\n${fmtExamples}\n\n${theme.muted("Docs:")} ${docs}\n`;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export function registerPreActionHooks(program: Command, programVersion: string)
|
||||
if (hasHelpOrVersion(argv)) return;
|
||||
const commandPath = getCommandPath(argv, 2);
|
||||
const hideBanner =
|
||||
isTruthyEnvValue(process.env.CLAWDBOT_HIDE_BANNER) ||
|
||||
isTruthyEnvValue(process.env.OPENCLAW_HIDE_BANNER) ||
|
||||
commandPath[0] === "update" ||
|
||||
(commandPath[0] === "plugins" && commandPath[1] === "update");
|
||||
if (!hideBanner) {
|
||||
|
||||
@@ -51,24 +51,24 @@ export function registerAgentCommands(program: Command, args: { agentChannelOpti
|
||||
`
|
||||
${theme.heading("Examples:")}
|
||||
${formatHelpExamples([
|
||||
['moltbot agent --to +15555550123 --message "status update"', "Start a new session."],
|
||||
['moltbot agent --agent ops --message "Summarize logs"', "Use a specific agent."],
|
||||
['openclaw agent --to +15555550123 --message "status update"', "Start a new session."],
|
||||
['openclaw agent --agent ops --message "Summarize logs"', "Use a specific agent."],
|
||||
[
|
||||
'moltbot agent --session-id 1234 --message "Summarize inbox" --thinking medium',
|
||||
'openclaw agent --session-id 1234 --message "Summarize inbox" --thinking medium',
|
||||
"Target a session with explicit thinking level.",
|
||||
],
|
||||
[
|
||||
'moltbot agent --to +15555550123 --message "Trace logs" --verbose on --json',
|
||||
'openclaw agent --to +15555550123 --message "Trace logs" --verbose on --json',
|
||||
"Enable verbose logging and JSON output.",
|
||||
],
|
||||
['moltbot agent --to +15555550123 --message "Summon reply" --deliver', "Deliver reply."],
|
||||
['openclaw agent --to +15555550123 --message "Summon reply" --deliver', "Deliver reply."],
|
||||
[
|
||||
'moltbot agent --agent ops --message "Generate report" --deliver --reply-channel slack --reply-to "#reports"',
|
||||
'openclaw agent --agent ops --message "Generate report" --deliver --reply-channel slack --reply-to "#reports"',
|
||||
"Send reply to a different channel/target.",
|
||||
],
|
||||
])}
|
||||
|
||||
${theme.muted("Docs:")} ${formatDocsLink("/cli/agent", "docs.molt.bot/cli/agent")}`,
|
||||
${theme.muted("Docs:")} ${formatDocsLink("/cli/agent", "docs.openclaw.ai/cli/agent")}`,
|
||||
)
|
||||
.action(async (opts) => {
|
||||
const verboseLevel = typeof opts.verbose === "string" ? opts.verbose.toLowerCase() : "";
|
||||
@@ -86,7 +86,7 @@ ${theme.muted("Docs:")} ${formatDocsLink("/cli/agent", "docs.molt.bot/cli/agent"
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/agents", "docs.molt.bot/cli/agents")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/agents", "docs.openclaw.ai/cli/agents")}\n`,
|
||||
);
|
||||
|
||||
agents
|
||||
@@ -155,11 +155,14 @@ ${theme.muted("Docs:")} ${formatDocsLink("/cli/agent", "docs.molt.bot/cli/agent"
|
||||
`
|
||||
${theme.heading("Examples:")}
|
||||
${formatHelpExamples([
|
||||
['moltbot agents set-identity --agent main --name "Clawd" --emoji "🦞"', "Set name + emoji."],
|
||||
["moltbot agents set-identity --agent main --avatar avatars/clawd.png", "Set avatar path."],
|
||||
["moltbot agents set-identity --workspace ~/clawd --from-identity", "Load from IDENTITY.md."],
|
||||
['openclaw agents set-identity --agent main --name "OpenClaw" --emoji "🦞"', "Set name + emoji."],
|
||||
["openclaw agents set-identity --agent main --avatar avatars/openclaw.png", "Set avatar path."],
|
||||
[
|
||||
"moltbot agents set-identity --identity-file ~/clawd/IDENTITY.md --agent main",
|
||||
"openclaw agents set-identity --workspace ~/.openclaw/workspace --from-identity",
|
||||
"Load from IDENTITY.md.",
|
||||
],
|
||||
[
|
||||
"openclaw agents set-identity --identity-file ~/.openclaw/workspace/IDENTITY.md --agent main",
|
||||
"Use a specific IDENTITY.md.",
|
||||
],
|
||||
])}
|
||||
|
||||
@@ -16,7 +16,7 @@ export function registerConfigureCommand(program: Command) {
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/configure", "docs.molt.bot/cli/configure")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/configure", "docs.openclaw.ai/cli/configure")}\n`,
|
||||
)
|
||||
.option(
|
||||
"--section <section>",
|
||||
|
||||
@@ -15,7 +15,7 @@ export function registerMaintenanceCommands(program: Command) {
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/doctor", "docs.molt.bot/cli/doctor")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/doctor", "docs.openclaw.ai/cli/doctor")}\n`,
|
||||
)
|
||||
.option("--no-workspace-suggestions", "Disable workspace memory system suggestions", false)
|
||||
.option("--yes", "Accept defaults without prompting", false)
|
||||
@@ -45,7 +45,7 @@ export function registerMaintenanceCommands(program: Command) {
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/dashboard", "docs.molt.bot/cli/dashboard")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/dashboard", "docs.openclaw.ai/cli/dashboard")}\n`,
|
||||
)
|
||||
.option("--no-open", "Print URL but do not launch a browser", false)
|
||||
.action(async (opts) => {
|
||||
@@ -62,7 +62,7 @@ export function registerMaintenanceCommands(program: Command) {
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/reset", "docs.molt.bot/cli/reset")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/reset", "docs.openclaw.ai/cli/reset")}\n`,
|
||||
)
|
||||
.option("--scope <scope>", "config|config+creds+sessions|full (default: interactive prompt)")
|
||||
.option("--yes", "Skip confirmation prompts", false)
|
||||
@@ -85,7 +85,7 @@ export function registerMaintenanceCommands(program: Command) {
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/uninstall", "docs.molt.bot/cli/uninstall")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/uninstall", "docs.openclaw.ai/cli/uninstall")}\n`,
|
||||
)
|
||||
.option("--service", "Remove the gateway service", false)
|
||||
.option("--state", "Remove state + config", false)
|
||||
|
||||
@@ -31,22 +31,22 @@ export function registerMessageCommands(program: Command, ctx: ProgramContext) {
|
||||
`
|
||||
${theme.heading("Examples:")}
|
||||
${formatHelpExamples([
|
||||
['moltbot message send --target +15555550123 --message "Hi"', "Send a text message."],
|
||||
['openclaw message send --target +15555550123 --message "Hi"', "Send a text message."],
|
||||
[
|
||||
'moltbot message send --target +15555550123 --message "Hi" --media photo.jpg',
|
||||
'openclaw message send --target +15555550123 --message "Hi" --media photo.jpg',
|
||||
"Send a message with media.",
|
||||
],
|
||||
[
|
||||
'moltbot message poll --channel discord --target channel:123 --poll-question "Snack?" --poll-option Pizza --poll-option Sushi',
|
||||
'openclaw message poll --channel discord --target channel:123 --poll-question "Snack?" --poll-option Pizza --poll-option Sushi',
|
||||
"Create a Discord poll.",
|
||||
],
|
||||
[
|
||||
'moltbot message react --channel discord --target 123 --message-id 456 --emoji "✅"',
|
||||
'openclaw message react --channel discord --target 123 --message-id 456 --emoji "✅"',
|
||||
"React to a message.",
|
||||
],
|
||||
])}
|
||||
|
||||
${theme.muted("Docs:")} ${formatDocsLink("/cli/message", "docs.molt.bot/cli/message")}`,
|
||||
${theme.muted("Docs:")} ${formatDocsLink("/cli/message", "docs.openclaw.ai/cli/message")}`,
|
||||
)
|
||||
.action(() => {
|
||||
message.help({ error: true });
|
||||
|
||||
@@ -38,9 +38,9 @@ export function registerOnboardCommand(program: Command) {
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/onboard", "docs.molt.bot/cli/onboard")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/onboard", "docs.openclaw.ai/cli/onboard")}\n`,
|
||||
)
|
||||
.option("--workspace <dir>", "Agent workspace directory (default: ~/clawd)")
|
||||
.option("--workspace <dir>", "Agent workspace directory (default: ~/.openclaw/workspace)")
|
||||
.option("--reset", "Reset config + credentials + sessions + workspace before running wizard")
|
||||
.option("--non-interactive", "Run without prompts", false)
|
||||
.option(
|
||||
|
||||
@@ -10,15 +10,15 @@ import { runCommandWithRuntime } from "../cli-utils.js";
|
||||
export function registerSetupCommand(program: Command) {
|
||||
program
|
||||
.command("setup")
|
||||
.description("Initialize ~/.clawdbot/moltbot.json and the agent workspace")
|
||||
.description("Initialize ~/.openclaw/openclaw.json and the agent workspace")
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/setup", "docs.molt.bot/cli/setup")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/setup", "docs.openclaw.ai/cli/setup")}\n`,
|
||||
)
|
||||
.option(
|
||||
"--workspace <dir>",
|
||||
"Agent workspace directory (default: ~/clawd; stored as agents.defaults.workspace)",
|
||||
"Agent workspace directory (default: ~/.openclaw/workspace; stored as agents.defaults.workspace)",
|
||||
)
|
||||
.option("--wizard", "Run the interactive onboarding wizard", false)
|
||||
.option("--non-interactive", "Run the wizard without prompts", false)
|
||||
|
||||
@@ -39,21 +39,21 @@ export function registerStatusHealthSessionsCommands(program: Command) {
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.heading("Examples:")}\n${formatHelpExamples([
|
||||
["moltbot status", "Show channel health + session summary."],
|
||||
["moltbot status --all", "Full diagnosis (read-only)."],
|
||||
["moltbot status --json", "Machine-readable output."],
|
||||
["moltbot status --usage", "Show model provider usage/quota snapshots."],
|
||||
["openclaw status", "Show channel health + session summary."],
|
||||
["openclaw status --all", "Full diagnosis (read-only)."],
|
||||
["openclaw status --json", "Machine-readable output."],
|
||||
["openclaw status --usage", "Show model provider usage/quota snapshots."],
|
||||
[
|
||||
"moltbot status --deep",
|
||||
"openclaw status --deep",
|
||||
"Run channel probes (WA + Telegram + Discord + Slack + Signal).",
|
||||
],
|
||||
["moltbot status --deep --timeout 5000", "Tighten probe timeout."],
|
||||
["openclaw status --deep --timeout 5000", "Tighten probe timeout."],
|
||||
])}`,
|
||||
)
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/status", "docs.molt.bot/cli/status")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/status", "docs.openclaw.ai/cli/status")}\n`,
|
||||
)
|
||||
.action(async (opts) => {
|
||||
const verbose = resolveVerbose(opts);
|
||||
@@ -87,7 +87,7 @@ export function registerStatusHealthSessionsCommands(program: Command) {
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/health", "docs.molt.bot/cli/health")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/health", "docs.openclaw.ai/cli/health")}\n`,
|
||||
)
|
||||
.action(async (opts) => {
|
||||
const verbose = resolveVerbose(opts);
|
||||
@@ -119,10 +119,10 @@ export function registerStatusHealthSessionsCommands(program: Command) {
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.heading("Examples:")}\n${formatHelpExamples([
|
||||
["moltbot sessions", "List all sessions."],
|
||||
["moltbot sessions --active 120", "Only last 2 hours."],
|
||||
["moltbot sessions --json", "Machine-readable output."],
|
||||
["moltbot sessions --store ./tmp/sessions.json", "Use a specific session store."],
|
||||
["openclaw sessions", "List all sessions."],
|
||||
["openclaw sessions --active 120", "Only last 2 hours."],
|
||||
["openclaw sessions --json", "Machine-readable output."],
|
||||
["openclaw sessions --store ./tmp/sessions.json", "Use a specific session store."],
|
||||
])}\n\n${theme.muted(
|
||||
"Shows token usage per session when the agent reports it; set agents.defaults.contextTokens to see % of your model window.",
|
||||
)}`,
|
||||
@@ -130,7 +130,7 @@ export function registerStatusHealthSessionsCommands(program: Command) {
|
||||
.addHelpText(
|
||||
"after",
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/sessions", "docs.molt.bot/cli/sessions")}\n`,
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/sessions", "docs.openclaw.ai/cli/sessions")}\n`,
|
||||
)
|
||||
.action(async (opts) => {
|
||||
setVerbose(Boolean(opts.verbose));
|
||||
|
||||
@@ -29,7 +29,7 @@ describe("registerSubCliCommands", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
process.env = { ...originalEnv };
|
||||
delete process.env.CLAWDBOT_DISABLE_LAZY_SUBCOMMANDS;
|
||||
delete process.env.OPENCLAW_DISABLE_LAZY_SUBCOMMANDS;
|
||||
registerAcpCli.mockClear();
|
||||
acpAction.mockClear();
|
||||
registerNodesCli.mockClear();
|
||||
@@ -42,7 +42,7 @@ describe("registerSubCliCommands", () => {
|
||||
});
|
||||
|
||||
it("registers only the primary placeholder and dispatches", async () => {
|
||||
process.argv = ["node", "moltbot", "acp"];
|
||||
process.argv = ["node", "openclaw", "acp"];
|
||||
const program = new Command();
|
||||
registerSubCliCommands(program, process.argv);
|
||||
|
||||
@@ -55,7 +55,7 @@ describe("registerSubCliCommands", () => {
|
||||
});
|
||||
|
||||
it("registers placeholders for all subcommands when no primary", () => {
|
||||
process.argv = ["node", "moltbot"];
|
||||
process.argv = ["node", "openclaw"];
|
||||
const program = new Command();
|
||||
registerSubCliCommands(program, process.argv);
|
||||
|
||||
@@ -66,9 +66,9 @@ describe("registerSubCliCommands", () => {
|
||||
});
|
||||
|
||||
it("re-parses argv for lazy subcommands", async () => {
|
||||
process.argv = ["node", "moltbot", "nodes", "list"];
|
||||
process.argv = ["node", "openclaw", "nodes", "list"];
|
||||
const program = new Command();
|
||||
program.name("moltbot");
|
||||
program.name("openclaw");
|
||||
registerSubCliCommands(program, process.argv);
|
||||
|
||||
expect(program.commands.map((cmd) => cmd.name())).toEqual(["nodes"]);
|
||||
@@ -80,9 +80,9 @@ describe("registerSubCliCommands", () => {
|
||||
});
|
||||
|
||||
it("replaces placeholder when registering a subcommand by name", async () => {
|
||||
process.argv = ["node", "moltbot", "acp", "--help"];
|
||||
process.argv = ["node", "openclaw", "acp", "--help"];
|
||||
const program = new Command();
|
||||
program.name("moltbot");
|
||||
program.name("openclaw");
|
||||
registerSubCliCommands(program, process.argv);
|
||||
|
||||
await registerSubCliByName(program, "acp");
|
||||
@@ -90,7 +90,7 @@ describe("registerSubCliCommands", () => {
|
||||
const names = program.commands.map((cmd) => cmd.name());
|
||||
expect(names.filter((name) => name === "acp")).toHaveLength(1);
|
||||
|
||||
await program.parseAsync(["node", "moltbot", "acp"], { from: "user" });
|
||||
await program.parseAsync(["node", "openclaw", "acp"], { from: "user" });
|
||||
expect(registerAcpCli).toHaveBeenCalledTimes(1);
|
||||
expect(acpAction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Command } from "commander";
|
||||
import type { MoltbotConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { isTruthyEnvValue } from "../../infra/env.js";
|
||||
import { buildParseArgv, getPrimaryCommand, hasHelpOrVersion } from "../argv.js";
|
||||
import { resolveActionArgs } from "./helpers.js";
|
||||
@@ -13,16 +13,16 @@ type SubCliEntry = {
|
||||
};
|
||||
|
||||
const shouldRegisterPrimaryOnly = (argv: string[]) => {
|
||||
if (isTruthyEnvValue(process.env.CLAWDBOT_DISABLE_LAZY_SUBCOMMANDS)) return false;
|
||||
if (isTruthyEnvValue(process.env.OPENCLAW_DISABLE_LAZY_SUBCOMMANDS)) return false;
|
||||
if (hasHelpOrVersion(argv)) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
const shouldEagerRegisterSubcommands = (_argv: string[]) => {
|
||||
return isTruthyEnvValue(process.env.CLAWDBOT_DISABLE_LAZY_SUBCOMMANDS);
|
||||
return isTruthyEnvValue(process.env.OPENCLAW_DISABLE_LAZY_SUBCOMMANDS);
|
||||
};
|
||||
|
||||
const loadConfig = async (): Promise<MoltbotConfig> => {
|
||||
const loadConfig = async (): Promise<OpenClawConfig> => {
|
||||
const mod = await import("../../config/config.js");
|
||||
return mod.loadConfig();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user