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

@@ -1,8 +1,8 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { AuthProfileStore } from "./types.js";
export function resolveAuthProfileDisplayLabel(params: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
store: AuthProfileStore;
profileId: string;
}): string {

View File

@@ -1,12 +1,12 @@
import { formatCliCommand } from "../../cli/command-format.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { normalizeProviderId } from "../model-selection.js";
import { listProfilesForProvider } from "./profiles.js";
import { suggestOAuthProfileIdForLegacyDefault } from "./repair.js";
import type { AuthProfileStore } from "./types.js";
export function formatAuthDoctorHint(params: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
store: AuthProfileStore;
provider: string;
profileId?: string;
@@ -38,6 +38,6 @@ export function formatAuthDoctorHint(params: {
}`,
`- auth store oauth profiles: ${storeOauthProfiles || "(none)"}`,
`- suggested profile: ${suggested}`,
`Fix: run "${formatCliCommand("clawdbot doctor --yes")}"`,
`Fix: run "${formatCliCommand("moltbot doctor --yes")}"`,
].join("\n");
}

View File

@@ -21,7 +21,7 @@ describe("resolveApiKeyForProfile fallback to main agent", () => {
await fs.mkdir(mainAgentDir, { recursive: true });
await fs.mkdir(secondaryAgentDir, { recursive: true });
// Set environment variables so resolveClawdbotAgentDir() returns mainAgentDir
// Set environment variables so resolveMoltbotAgentDir() returns mainAgentDir
process.env.CLAWDBOT_STATE_DIR = tmpDir;
process.env.CLAWDBOT_AGENT_DIR = mainAgentDir;
process.env.PI_CODING_AGENT_DIR = mainAgentDir;

View File

@@ -1,7 +1,7 @@
import { getOAuthApiKey, type OAuthCredentials, type OAuthProvider } from "@mariozechner/pi-ai";
import lockfile from "proper-lockfile";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { refreshChutesTokens } from "../chutes-oauth.js";
import { refreshQwenPortalCredentials } from "../../providers/qwen-portal-oauth.js";
import { AUTH_STORE_LOCK_OPTIONS, log } from "./constants.js";
@@ -84,7 +84,7 @@ async function refreshOAuthTokenWithLock(params: {
}
async function tryResolveOAuthProfile(params: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
store: AuthProfileStore;
profileId: string;
agentDir?: string;
@@ -117,7 +117,7 @@ async function tryResolveOAuthProfile(params: {
}
export async function resolveApiKeyForProfile(params: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
store: AuthProfileStore;
profileId: string;
agentDir?: string;

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { normalizeProviderId } from "../model-selection.js";
import { listProfilesForProvider } from "./profiles.js";
import type { AuthProfileStore } from "./types.js";
@@ -16,7 +16,7 @@ function resolveProfileUnusableUntil(stats: {
}
export function resolveAuthProfileOrder(params: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
store: AuthProfileStore;
provider: string;
preferredProfile?: string;

View File

@@ -3,17 +3,17 @@ import path from "node:path";
import { saveJsonFile } from "../../infra/json-file.js";
import { resolveUserPath } from "../../utils.js";
import { resolveClawdbotAgentDir } from "../agent-paths.js";
import { resolveMoltbotAgentDir } from "../agent-paths.js";
import { AUTH_PROFILE_FILENAME, AUTH_STORE_VERSION, LEGACY_AUTH_FILENAME } from "./constants.js";
import type { AuthProfileStore } from "./types.js";
export function resolveAuthStorePath(agentDir?: string): string {
const resolved = resolveUserPath(agentDir ?? resolveClawdbotAgentDir());
const resolved = resolveUserPath(agentDir ?? resolveMoltbotAgentDir());
return path.join(resolved, AUTH_PROFILE_FILENAME);
}
export function resolveLegacyAuthStorePath(agentDir?: string): string {
const resolved = resolveUserPath(agentDir ?? resolveClawdbotAgentDir());
const resolved = resolveUserPath(agentDir ?? resolveMoltbotAgentDir());
return path.join(resolved, LEGACY_AUTH_FILENAME);
}

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { AuthProfileConfig } from "../../config/types.js";
import { normalizeProviderId } from "../model-selection.js";
import { listProfilesForProvider } from "./profiles.js";
@@ -17,7 +17,7 @@ function isEmailLike(value: string): boolean {
}
export function suggestOAuthProfileIdForLegacyDefault(params: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
store: AuthProfileStore;
provider: string;
legacyProfileId: string;
@@ -64,7 +64,7 @@ export function suggestOAuthProfileIdForLegacyDefault(params: {
}
export function repairOAuthProfileIdMismatch(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
store: AuthProfileStore;
provider: string;
legacyProfileId?: string;
@@ -123,7 +123,7 @@ export function repairOAuthProfileIdMismatch(params: {
return { ...order, [resolvedKey]: deduped };
})();
const nextCfg: ClawdbotConfig = {
const nextCfg: MoltbotConfig = {
...params.cfg,
auth: {
...params.cfg.auth,

View File

@@ -3,7 +3,7 @@ import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import { resolveSessionAuthProfileOverride } from "./session-override.js";
@@ -23,7 +23,7 @@ async function writeAuthStore(agentDir: string) {
describe("resolveSessionAuthProfileOverride", () => {
it("keeps user override when provider alias differs", async () => {
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-auth-"));
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-auth-"));
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
process.env.CLAWDBOT_STATE_DIR = tmpDir;
try {
@@ -40,7 +40,7 @@ describe("resolveSessionAuthProfileOverride", () => {
const sessionStore = { "agent:main:main": sessionEntry };
const resolved = await resolveSessionAuthProfileOverride({
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
provider: "z.ai",
agentDir,
sessionEntry,

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { updateSessionStore, type SessionEntry } from "../../config/sessions.js";
import { normalizeProviderId } from "../model-selection.js";
import {
@@ -37,7 +37,7 @@ export async function clearSessionAuthProfileOverride(params: {
}
export async function resolveSessionAuthProfileOverride(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
provider: string;
agentDir: string;
sessionEntry?: SessionEntry;

View File

@@ -1,6 +1,6 @@
import type { OAuthCredentials } from "@mariozechner/pi-ai";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
export type ApiKeyCredential = {
type: "api_key";
@@ -12,7 +12,7 @@ export type ApiKeyCredential = {
export type TokenCredential = {
/**
* Static bearer-style token (often OAuth access token / PAT).
* Not refreshable by clawdbot (unlike `type: "oauth"`).
* Not refreshable by moltbot (unlike `type: "oauth"`).
*/
type: "token";
provider: string;
@@ -65,7 +65,7 @@ export type AuthProfileStore = {
};
export type AuthProfileIdRepairResult = {
config: ClawdbotConfig;
config: MoltbotConfig;
changes: string[];
migrated: boolean;
fromProfileId?: string;

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { normalizeProviderId } from "../model-selection.js";
import { saveAuthProfileStore, updateAuthProfileStoreWithLock } from "./store.js";
import type { AuthProfileFailureReason, AuthProfileStore, ProfileUsageStats } from "./types.js";
@@ -82,7 +82,7 @@ type ResolvedAuthCooldownConfig = {
};
function resolveAuthCooldownConfig(params: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
providerId: string;
}): ResolvedAuthCooldownConfig {
const defaults = {
@@ -192,7 +192,7 @@ export async function markAuthProfileFailure(params: {
store: AuthProfileStore;
profileId: string;
reason: AuthProfileFailureReason;
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
agentDir?: string;
}): Promise<void> {
const { store, profileId, reason, agentDir, cfg } = params;