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

@@ -8,7 +8,7 @@
import { pathToFileURL } from "node:url";
import path from "node:path";
import { registerInternalHook } from "./internal-hooks.js";
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import type { InternalHookHandler } from "./internal-hooks.js";
import { loadWorkspaceHookEntries } from "./workspace.js";
import { resolveHookConfig } from "./config.js";
@@ -21,7 +21,7 @@ import { shouldIncludeHook } from "./config.js";
* 1. Directory-based discovery (bundled, managed, workspace)
* 2. Legacy config handlers (backwards compatibility)
*
* @param cfg - Clawdbot configuration
* @param cfg - Moltbot configuration
* @param workspaceDir - Workspace directory for hook discovery
* @returns Number of handlers successfully loaded
*
@@ -33,10 +33,7 @@ import { shouldIncludeHook } from "./config.js";
* console.log(`Loaded ${count} hook handlers`);
* ```
*/
export async function loadInternalHooks(
cfg: ClawdbotConfig,
workspaceDir: string,
): Promise<number> {
export async function loadInternalHooks(cfg: MoltbotConfig, workspaceDir: string): Promise<number> {
// Check if hooks are enabled
if (!cfg.hooks?.internal?.enabled) {
return 0;
@@ -66,7 +63,7 @@ export async function loadInternalHooks(
const mod = (await import(cacheBustedUrl)) as Record<string, unknown>;
// Get handler function (default or named export)
const exportName = entry.clawdbot?.export ?? "default";
const exportName = entry.metadata?.export ?? "default";
const handler = mod[exportName];
if (typeof handler !== "function") {
@@ -77,7 +74,7 @@ export async function loadInternalHooks(
}
// Register for all events listed in metadata
const events = entry.clawdbot?.events ?? [];
const events = entry.metadata?.events ?? [];
if (events.length === 0) {
console.warn(`Hook warning: Hook '${entry.hook.name}' has no events defined in metadata`);
continue;