UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

131 lines (130 loc) 4.66 kB
import { J as getCoreCliCommandDescriptors, Y as getCoreCliCommandNamesCore } from "./argv-DNjh_yaF.js"; import { t as resolveCliArgvInvocation } from "./argv-invocation-C1WhAkJL.js"; import { r as shouldRegisterPrimaryCommandOnly } from "./command-registration-policy-Crwwx_Cg.js"; import { i as registerCommandGroups, r as registerCommandGroupByName } from "./register-command-groups-DO7oGkdB.js"; import { a as defineImportedCommandGroupSpec, i as buildCommandGroupEntries, o as defineImportedProgramCommandGroupSpecs } from "./register.subclis-core-4L9HlrD9.js"; //#region src/cli/program/command-registry-core.ts function withProgramOnlySpecs(specs) { return specs.map((spec) => ({ commandNames: spec.commandNames, register: async ({ program }) => { await spec.register(program); } })); } const coreEntrySpecs = [ ...withProgramOnlySpecs(defineImportedProgramCommandGroupSpecs([ { commandNames: ["setup", "crestodian"], loadModule: () => import("./register.setup-BqIBKR3S.js"), exportName: "registerSetupCommand" }, { commandNames: ["onboard"], loadModule: () => import("./register.onboard-BLPMt6q9.js"), exportName: "registerOnboardCommand" }, { commandNames: ["configure"], loadModule: () => import("./register.configure-Dr1UPfLP.js"), exportName: "registerConfigureCommand" }, { commandNames: ["config"], loadModule: () => import("./config-cli-BAjpm1Yf.js"), exportName: "registerConfigCli" }, { commandNames: ["claws"], loadModule: () => import("./claws-cli-D6zCjGXC.js"), exportName: "registerClawsCli" }, { commandNames: ["backup"], loadModule: () => import("./register.backup-CKwMb8eC.js"), exportName: "registerBackupCommand" }, { commandNames: ["database"], loadModule: () => import("./register.database-CaMC7tWH.js"), exportName: "registerDatabaseCommand" }, { commandNames: ["migrate"], loadModule: () => import("./register.migrate-B6jlie4B.js"), exportName: "registerMigrateCommand" }, { commandNames: ["audit"], loadModule: () => import("./register.audit-C3bCkn65.js"), exportName: "registerAuditCommand" }, { commandNames: [ "doctor", "triage", "dashboard", "reset", "uninstall" ], loadModule: () => import("./register.maintenance-Dvn9QSoZ.js"), exportName: "registerMaintenanceCommands" } ])), defineImportedCommandGroupSpec(["message"], () => import("./register.message-DNLpFfBK.js"), (mod, { program, ctx }) => { mod.registerMessageCommands(program, ctx); }), ...withProgramOnlySpecs(defineImportedProgramCommandGroupSpecs([{ commandNames: ["mcp"], loadModule: () => import("./mcp-cli-vRBiwiQQ.js"), exportName: "registerMcpCli" }, { commandNames: ["transcripts"], loadModule: () => import("./register.transcripts-B9Y-XMkJ.js"), exportName: "registerTranscriptsCli" }])), defineImportedCommandGroupSpec(["agent"], () => import("./register.agent-turn-DS3dYZlx.js"), (mod, { program, ctx }) => { mod.registerAgentTurnCommand(program, { agentChannelOptions: ctx.agentChannelOptions }); }), defineImportedCommandGroupSpec(["agents"], () => import("./register.agent-DnTAhizP.js"), (mod, { program }) => { mod.registerAgentsCommands(program); }), ...withProgramOnlySpecs(defineImportedProgramCommandGroupSpecs([{ commandNames: [ "status", "health", "sessions", "tasks" ], loadModule: () => import("./register.status-health-sessions-pzxlXx8G.js"), exportName: "registerStatusHealthSessionsCommands" }])) ]; function resolveCoreCommandGroups(ctx, argv) { const descriptors = getCoreCliCommandDescriptors(); const visibleCommandNames = new Set(descriptors.map((descriptor) => descriptor.name)); const visibleEntrySpecs = coreEntrySpecs.filter((spec) => spec.commandNames.every((name) => visibleCommandNames.has(name))); return buildCommandGroupEntries(descriptors, visibleEntrySpecs, (register) => async (program) => { await register({ program, ctx, argv }); }); } function getCoreCliCommandNames() { return getCoreCliCommandNamesCore(); } async function registerCoreCliByName(program, ctx, name, argv = process.argv) { return registerCommandGroupByName(program, resolveCoreCommandGroups(ctx, argv), name); } function registerCoreCliCommands(program, ctx, argv) { const { primary } = resolveCliArgvInvocation(argv); registerCommandGroups(program, resolveCoreCommandGroups(ctx, argv), { eager: false, primary, registerPrimaryOnly: Boolean(primary && shouldRegisterPrimaryCommandOnly(argv)) }); } //#endregion export { registerCoreCliByName as n, registerCoreCliCommands as r, getCoreCliCommandNames as t };