openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
54 lines (53 loc) • 5.65 kB
JavaScript
import { n as isExperimentalClawsEnabled } from "./experimental-BMzbGmT5.js";
import { t as applyParentDefaultHelpAction } from "./parent-default-help-DQUF3qKA.js";
//#region src/cli/claws-cli.ts
function collectOption(value, previous) {
return [...previous, value];
}
function registerClawsCli(program) {
if (!isExperimentalClawsEnabled()) return;
const claws = program.command("claws").description("Manage experimental OpenClaw Claws");
claws.command("create").description("Create a minimal local Claw project").argument("[path]", "New project directory", ".").option("--name <name>", "Set the package name").option("--agent-id <id>", "Set the portable agent id").option("--json", "Print JSON", false).action(async (path, opts) => {
const { runClawsCreateCommand } = await import("./claws-cli.project-CAzgJj-L.js");
await runClawsCreateCommand(path, opts);
});
claws.command("validate").description("Validate a local Claw project").argument("[path]", "Project directory", ".").option("--json", "Print JSON", false).action(async (path, opts) => {
const { runClawsValidateCommand } = await import("./claws-cli.project-CAzgJj-L.js");
await runClawsValidateCommand(path, opts);
});
claws.command("dev").description("Build and preview a local Claw without network or mutation").argument("[path]", "Project directory", ".").option("--agent-id <id>", "Preview with an unused local agent id").option("--workspace <path>", "Preview with a new workspace path").option("--json", "Print JSON", false).action(async (path, opts) => {
const { runClawsDevCommand } = await import("./claws-cli.project-CAzgJj-L.js");
await runClawsDevCommand(path, opts);
});
claws.command("build").description("Build a deterministic Claw package artifact").argument("[path]", "Project directory", ".").requiredOption("--out <artifact>", "New .tgz artifact to create").option("--json", "Print JSON", false).action(async (path, opts) => {
const { runClawsBuildCommand } = await import("./claws-cli.project-CAzgJj-L.js");
await runClawsBuildCommand(path, opts);
});
claws.command("inspect").description("Validate a Claw package or local development manifest").argument("<source>", "Path to a Claw package directory or grouped manifest").option("--json", "Print JSON", false).action(async (source, opts) => {
const { runClawsInspectCommand } = await import("./claws-cli.runtime.js");
await runClawsInspectCommand(source, opts);
});
claws.command("add").description("Preview adding one new agent and workspace from a Claw").argument("<source>", "Path to a Claw package directory or grouped manifest").option("--dry-run", "Preview all actions without mutating state", false).option("--yes", "Confirm creation of the new agent and workspace", false).option("--plan-integrity <digest>", "Bind consent to an exact dry-run plan").option("--agent-id <id>", "Override the requested id with an unused local agent id").option("--workspace <path>", "Override the derived new workspace path").option("--json", "Print JSON", false).action(async (source, opts) => {
const { runClawsAddCommand } = await import("./claws-cli.runtime.js");
await runClawsAddCommand(source, opts);
});
claws.command("status").description("Show installed Claw agents and managed-state drift").argument("[claw-or-agent]", "Installed package name or final agent id").option("--json", "Print JSON", false).action(async (target, opts) => {
const { runClawsStatusCommand } = await import("./claws-cli.runtime.js");
await runClawsStatusCommand(target, opts);
});
claws.command("update").description("Plan changes to one installed Claw agent").argument("<claw-or-agent>", "Installed package name or final agent id").option("--from <source>", "Override the target source recorded at Claw add time").option("--dry-run", "Preview update actions without mutating state", false).option("--yes", "Confirm the exact supported update plan", false).option("--plan-integrity <digest>", "Bind consent to an exact update plan").option("--json", "Print JSON", false).action(async (target, opts) => {
const { runClawsUpdateCommand } = await import("./claws-cli.runtime.js");
await runClawsUpdateCommand(target, opts);
});
claws.command("remove").description("Plan or remove one Claw-created agent and owned state").argument("<claw-or-agent>", "Installed package name or final agent id").option("--dry-run", "Preview removal without mutating state", false).option("--yes", "Confirm removal", false).option("--plan-integrity <digest>", "Bind consent to an exact removal plan").option("--remove-unused", "Remove unchanged Claw-introduced references with no other current owner", false).option("--remove-referenced <resource>", "Remove an exact referenced resource (repeatable)", collectOption, []).option("--force-referenced", "Allow selected cleanup despite other dependents, owners, or pre-existing origin", false).option("--json", "Print JSON", false).action(async (target, opts) => {
const { runClawsRemoveCommand } = await import("./claws-cli.runtime.js");
await runClawsRemoveCommand(target, opts);
});
claws.command("export").description("Export portable state for one installed Claw agent").argument("<agent>", "Final id of the installed Claw agent").requiredOption("--out <path>", "New package directory to create").option("--bootstrap <path>", "Reviewed Markdown file to export as package BOOTSTRAP.md").option("--json", "Print JSON", false).action(async (agent, opts) => {
const { runClawsExportCommand } = await import("./claws-cli.runtime.js");
await runClawsExportCommand(agent, opts);
});
applyParentDefaultHelpAction(claws);
}
//#endregion
export { registerClawsCli };