Skip to content

Commit b82a59a

Browse files
omarshahineclaude
andauthored
feat(cli): add openclaw automations alias and reword cron display prose (#114854)
* feat(cli): add openclaw automations alias and reword cron display prose Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WhJ8EiMXue6ADLmHfb7FL6 * test(doctor): update cron doctor prose assertions for automations wording * fix(plugins): include command aliases in plugin CLI collision detection Codex review finding on the automations alias: plugin CLI registration seeded existingCommands from command names only, so a plugin exposing a top-level command matching an alias-only root name (automations, terminal, chat) would crash Commander at startup instead of being skipped. Seed from names plus aliases; regression test covers the alias path. * fix(cli): rename residual cron prose in CLI and gateway RPC errors Found in combined dev-gateway E2E: automation not found / unknown automation id errors, add/edit prose, docs tip, skills-cli mention, and the gateway RPC not-found message. The CLI missing-get matcher accepts both message forms so older gateways keep resolving name lookups. * fix(gateway): keep cron.get missing wording as a wire contract for older CLI matchers ClawSweeper rank-up: shipped CLI matchers parse 'cron job not found: <id>' before the name-lookup fallback; the rename stays CLI-display only. Adds a regression pinning the exact wire form. * fix(cli): rename doctor and task-summary cron prose flagged in review Repair-plan advisories, session-registry task summary, and the heartbeat migration health check now say automations; recreate hints use the openclaw automations CLI form. --------- Co-authored-by: Omar Shahine <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
1 parent 364d8be commit b82a59a

31 files changed

Lines changed: 123 additions & 75 deletions

‎src/agents/embedded-agent-subscribe.handlers.tools.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ function isOpenClawCronAddShellCommand(args: unknown): boolean {
597597
return (
598598
(isOpenClawExecutable(tokens[commandIndex]) ||
599599
(packageRunner.acceptsPackageSpec && isOpenClawPackageSpec(tokens[commandIndex]))) &&
600-
normalizeOptionalLowercaseString(tokens[cliArgIndex]) === "cron" &&
600+
(normalizeOptionalLowercaseString(tokens[cliArgIndex]) === "cron" ||
601+
normalizeOptionalLowercaseString(tokens[cliArgIndex]) === "automations") &&
601602
(action === "add" || action === "create") &&
602603
!actionArgs.some((token) => token === "-h" || token === "--help")
603604
);

‎src/cli/command-catalog.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
322322
policy: { ownsProtocolStdout: true },
323323
},
324324
{ commandPath: ["approvals"], policy: { networkProxy: "bypass" } },
325+
// automations is a commander alias for cron; argv-derived command paths keep the typed token.
326+
{ commandPath: ["automations"], policy: { networkProxy: "bypass" } },
325327
{ commandPath: ["backup"], policy: { bypassConfigGuard: true, networkProxy: "bypass" } },
326328
{ commandPath: ["chat"], policy: { networkProxy: "bypass" } },
327329
{ commandPath: ["config"], policy: { networkProxy: "bypass" } },

‎src/cli/cron-cli.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,9 @@ describe("cron cli", () => {
654654
"Option prompt",
655655
]);
656656

657-
expectRuntimeErrorContaining("Pass the cron job message either positionally or with --message");
657+
expectRuntimeErrorContaining(
658+
"Pass the automation message either positionally or with --message",
659+
);
658660
});
659661

660662
it("rejects ambiguous cron add names", async () => {
@@ -670,7 +672,7 @@ describe("cron cli", () => {
670672
"tick",
671673
]);
672674

673-
expectRuntimeErrorContaining("Pass the cron job name either positionally or with --name");
675+
expectRuntimeErrorContaining("Pass the automation name either positionally or with --name");
674676
});
675677

676678
it("rejects webhook delivery mixed with chat delivery on cron add", async () => {

‎src/cli/cron-cli/list-jobs.ts‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,20 +176,20 @@ export async function listCronJobsFromGateway(
176176
page.nextOffset <= offset ||
177177
(total !== undefined && page.nextOffset !== offset + page.jobs.length)
178178
) {
179-
throw new Error("cron.list pagination did not advance while looking up cron job");
179+
throw new Error("cron.list pagination did not advance while looking up automation");
180180
}
181181
offset = page.nextOffset;
182182
}
183183

184184
if (!snapshotChanged) {
185-
throw new Error("cron.list pagination exceeded maximum pages while looking up cron job");
185+
throw new Error("cron.list pagination exceeded maximum pages while looking up automation");
186186
}
187187
if (restart === CRON_LIST_MAX_SNAPSHOT_RESTARTS) {
188-
throw new Error("cron.list inventory changed repeatedly while reading cron jobs");
188+
throw new Error("cron.list inventory changed repeatedly while reading automations");
189189
}
190190
}
191191

192-
throw new Error("cron.list inventory changed repeatedly while reading cron jobs");
192+
throw new Error("cron.list inventory changed repeatedly while reading automations");
193193
}
194194

195195
function isMissingCronGetError(error: unknown, id: string): error is Error {
@@ -198,7 +198,10 @@ function isMissingCronGetError(error: unknown, id: string): error is Error {
198198
(error instanceof Error &&
199199
error.name === "GatewayClientRequestError" &&
200200
(error as Error & { gatewayCode?: unknown }).gatewayCode === "INVALID_REQUEST" &&
201-
error.message.includes(`cron job not found: ${id}`))
201+
// Gateways emit the stable "cron job not found" wire wording (kept for older
202+
// shipped CLI matchers); also accept the renamed form in case it ever changes.
203+
(error.message.includes(`automation not found: ${id}`) ||
204+
error.message.includes(`cron job not found: ${id}`)))
202205
);
203206
}
204207

‎src/cli/cron-cli/register.cron-add.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function registerCronStatusCommand(cron: Command) {
3434
addGatewayClientOptions(
3535
cron
3636
.command("status")
37-
.description("Show cron scheduler status")
37+
.description("Show automations scheduler status")
3838
.option("--json", "Output JSON", false)
3939
.action(async (opts) => {
4040
try {
@@ -51,7 +51,7 @@ export function registerCronListCommand(cron: Command) {
5151
addGatewayClientOptions(
5252
cron
5353
.command("list")
54-
.description("List cron jobs")
54+
.description("List automations")
5555
.option("--all", "Include disabled jobs", false)
5656
.option("--agent <id>", "Filter by agent id")
5757
.option("--json", "Output JSON", false)
@@ -84,7 +84,7 @@ export function registerCronAddCommand(cron: Command) {
8484
cron
8585
.command("add")
8686
.alias("create")
87-
.description("Add a cron job")
87+
.description("Add an automation")
8888
.argument("[scheduleOrName]", "Schedule string, or job name when using --at/--every/--cron")
8989
.argument("[message]", "Agent message when using a positional schedule")
9090
.option("--name <name>", "Job name")
@@ -224,7 +224,7 @@ export function registerCronAddCommand(cron: Command) {
224224
const toolsAllow = parseCronToolsAllow(opts.tools);
225225
if (optionMessage && positionalMessage && optionMessage !== positionalMessage) {
226226
throw new Error(
227-
"Pass the cron job message either positionally or with --message, not both.",
227+
"Pass the automation message either positionally or with --message, not both.",
228228
);
229229
}
230230
const message = optionMessage ?? positionalMessage ?? "";
@@ -435,7 +435,7 @@ export function registerCronAddCommand(cron: Command) {
435435
const positionalName = hasScheduleFlag ? normalizeOptionalString(nameArg) : undefined;
436436
if (optionName && positionalName && optionName !== positionalName) {
437437
throw new Error(
438-
"Pass the cron job name either positionally or with --name, not both.",
438+
"Pass the automation name either positionally or with --name, not both.",
439439
);
440440
}
441441
const name = optionName ?? positionalName ?? "";

‎src/cli/cron-cli/register.cron-edit.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async function readCronJobForEdit(opts: GatewayRpcOpts, id: string): Promise<Cro
4646
);
4747
const existing = inventory.jobs.find((job) => job.id === id);
4848
if (!existing) {
49-
throw new Error(`unknown cron job id: ${id}`, { cause: error });
49+
throw new Error(`unknown automation id: ${id}`, { cause: error });
5050
}
5151
return existing;
5252
}
@@ -56,7 +56,7 @@ export function registerCronEditCommand(cron: Command) {
5656
addGatewayClientOptions(
5757
cron
5858
.command("edit")
59-
.description("Edit a cron job (patch fields)")
59+
.description("Edit an automation (patch fields)")
6060
.argument("<id>", "Job id")
6161
.option("--name <name>", "Set name")
6262
.option("--description <text>", "Set description")

‎src/cli/cron-cli/register.cron-scratch.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function registerCronScratchCommand(cron: Command) {
2929
addGatewayClientOptions(
3030
cron
3131
.command("scratch")
32-
.description("Read or replace a cron job's private scratch")
32+
.description("Read or replace an automation's private scratch")
3333
.argument("<id>", "Job id")
3434
.option("--set <text>", "Replace scratch with exact text")
3535
.option("--file <path>", "Replace scratch from a file, or - for stdin")

‎src/cli/cron-cli/register.cron-simple.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ function mockCronShowPages(readPage: (params: { offset?: number }) => unknown):
3535
callGatewayFromCli.mockImplementation(
3636
async (method: string, _opts: unknown, params?: { id?: string; offset?: number }) => {
3737
if (method === "cron.get") {
38+
// Mirrors the gateway's stable wire wording; older shipped CLI matchers
39+
// parse exactly this form, so the server must not reword it.
3840
throw Object.assign(new Error(`cron job not found: ${params?.id ?? ""}`), {
3941
name: "GatewayClientRequestError",
4042
gatewayCode: "INVALID_REQUEST",
@@ -161,7 +163,7 @@ describe("cron show pagination guard (regression for #83856)", () => {
161163
}));
162164
await expect(runCronShow("missing")).rejects.toThrow("exit 1");
163165
expect(defaultRuntime.error).toHaveBeenCalledWith(
164-
expect.stringContaining("cron job not found: missing"),
166+
expect.stringContaining("automation not found: missing"),
165167
);
166168
});
167169
});

‎src/cli/cron-cli/register.cron-simple.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function registerCronSimpleCommands(cron: Command) {
131131
.command("rm")
132132
.alias("remove")
133133
.alias("delete")
134-
.description("Remove a cron job")
134+
.description("Remove an automation")
135135
.argument("<id>", "Job id")
136136
.option("--json", "Output JSON", false)
137137
.action(async (id, opts) => {
@@ -147,20 +147,20 @@ export function registerCronSimpleCommands(cron: Command) {
147147
registerCronToggleCommand({
148148
cron,
149149
name: "enable",
150-
description: "Enable a cron job",
150+
description: "Enable an automation",
151151
enabled: true,
152152
});
153153
registerCronToggleCommand({
154154
cron,
155155
name: "disable",
156-
description: "Disable a cron job",
156+
description: "Disable an automation",
157157
enabled: false,
158158
});
159159

160160
addGatewayClientOptions(
161161
cron
162162
.command("get")
163-
.description("Get a cron job as JSON")
163+
.description("Get an automation as JSON")
164164
.argument("<id>", "Job id")
165165
.action(async (id, opts) => {
166166
try {
@@ -175,7 +175,7 @@ export function registerCronSimpleCommands(cron: Command) {
175175
addGatewayClientOptions(
176176
cron
177177
.command("show")
178-
.description("Show a cron job")
178+
.description("Show an automation")
179179
.argument("<id>", "Job id or exact name")
180180
.option("--json", "Output JSON", false)
181181
.action(async (id, opts) => {
@@ -184,7 +184,7 @@ export function registerCronSimpleCommands(cron: Command) {
184184
includeDeliveryPreview: !opts.json,
185185
});
186186
if (!job) {
187-
throw new Error(`cron job not found: ${String(id)}`);
187+
throw new Error(`automation not found: ${String(id)}`);
188188
}
189189
if (opts.json) {
190190
printCronJson(enrichCronJsonWithStatus(job));
@@ -200,7 +200,7 @@ export function registerCronSimpleCommands(cron: Command) {
200200
addGatewayClientOptions(
201201
cron
202202
.command("runs")
203-
.description("Show cron run history")
203+
.description("Show automation run history")
204204
.requiredOption("--id <id>", "Job id")
205205
.option("--run-id <runId>", "Filter by cron run id")
206206
.option("--limit <n>", "Max entries (default 50)", "50")
@@ -226,7 +226,7 @@ export function registerCronSimpleCommands(cron: Command) {
226226
addGatewayClientOptions(
227227
cron
228228
.command("run")
229-
.description("Run a cron job now (debug)")
229+
.description("Run an automation now (debug)")
230230
.argument("<id>", "Job id")
231231
.option("--due", "Run only when due (default behavior in older versions)", false)
232232
.option("--wait", "Wait for the queued run to finish", false)

‎src/cli/cron-cli/register.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ import { registerCronSimpleCommands } from "./register.cron-simple.js";
1717
export function registerCronCli(program: Command) {
1818
const cron = program
1919
.command("cron")
20-
.description("Manage cron jobs (via Gateway)")
20+
.alias("automations")
21+
.description("Manage automations (via Gateway)")
2122
.addHelpText(
2223
"after",
2324
() =>
24-
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/cron", "docs.openclaw.ai/cli/cron")}\n${theme.muted("Upgrade tip:")} run \`openclaw doctor --fix\` to normalize legacy cron job storage.\n`,
25+
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/cron", "docs.openclaw.ai/cli/cron")}\n${theme.muted("Upgrade tip:")} run \`openclaw doctor --fix\` to normalize legacy automation storage.\n`,
2526
);
2627

2728
registerCronStatusCommand(cron);

0 commit comments

Comments
 (0)