chore: update molt.bot domains
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { normalizeProfileName } from "./profile-utils.js";
|
||||
import { replaceCliName, resolveCliName } from "./cli-name.js";
|
||||
|
||||
const CLI_PREFIX_RE = /^(?:pnpm|npm|bunx|npx)\s+clawdbot\b|^clawdbot\b/;
|
||||
const CLI_PREFIX_RE = /^(?:pnpm|npm|bunx|npx)\s+(?:clawdbot|moltbot)\b|^(?:clawdbot|moltbot)\b/;
|
||||
const PROFILE_FLAG_RE = /(?:^|\s)--profile(?:\s|=|$)/;
|
||||
const DEV_FLAG_RE = /(?:^|\s)--dev(?:\s|$)/;
|
||||
|
||||
@@ -8,9 +9,13 @@ export function formatCliCommand(
|
||||
command: string,
|
||||
env: Record<string, string | undefined> = process.env as Record<string, string | undefined>,
|
||||
): string {
|
||||
const cliName = resolveCliName(undefined, env);
|
||||
const normalizedCommand = replaceCliName(command, cliName);
|
||||
const profile = normalizeProfileName(env.CLAWDBOT_PROFILE);
|
||||
if (!profile) return command;
|
||||
if (!CLI_PREFIX_RE.test(command)) return command;
|
||||
if (PROFILE_FLAG_RE.test(command) || DEV_FLAG_RE.test(command)) return command;
|
||||
return command.replace(CLI_PREFIX_RE, (match) => `${match} --profile ${profile}`);
|
||||
if (!profile) return normalizedCommand;
|
||||
if (!CLI_PREFIX_RE.test(normalizedCommand)) return normalizedCommand;
|
||||
if (PROFILE_FLAG_RE.test(normalizedCommand) || DEV_FLAG_RE.test(normalizedCommand)) {
|
||||
return normalizedCommand;
|
||||
}
|
||||
return normalizedCommand.replace(CLI_PREFIX_RE, (match) => `${match} --profile ${profile}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user