|
1 | 1 | import type { Command } from "commander"; |
| 2 | +import { commitmentsDismissCommand, commitmentsListCommand } from "../../commands/commitments.js"; |
2 | 3 | import { exportTrajectoryCommand } from "../../commands/export-trajectory.js"; |
3 | 4 | import { flowsCancelCommand, flowsListCommand, flowsShowCommand } from "../../commands/flows.js"; |
4 | 5 | import { healthCommand } from "../../commands/health.js"; |
@@ -258,6 +259,79 @@ export function registerStatusHealthSessionsCommands(program: Command) { |
258 | 259 | }); |
259 | 260 | }); |
260 | 261 |
|
| 262 | + const commitmentsCmd = program |
| 263 | + .command("commitments") |
| 264 | + .description("List and manage inferred follow-up commitments") |
| 265 | + .option("--json", "Output JSON instead of text", false) |
| 266 | + .option("--agent <id>", "Agent id to inspect") |
| 267 | + .option("--status <status>", "Filter by status (pending, sent, dismissed, snoozed, expired)") |
| 268 | + .option("--all", "Show all statuses", false) |
| 269 | + .addHelpText( |
| 270 | + "after", |
| 271 | + () => |
| 272 | + `\n${theme.heading("Examples:")}\n${formatHelpExamples([ |
| 273 | + ["openclaw commitments", "List pending inferred follow-ups."], |
| 274 | + ["openclaw commitments --all", "List all inferred follow-ups."], |
| 275 | + ["openclaw commitments --agent work", "List one agent's inferred follow-ups."], |
| 276 | + ["openclaw commitments dismiss cm_abc123", "Dismiss a follow-up."], |
| 277 | + ])}`, |
| 278 | + ) |
| 279 | + .action(async (opts) => { |
| 280 | + await runCommandWithRuntime(defaultRuntime, async () => { |
| 281 | + await commitmentsListCommand( |
| 282 | + { |
| 283 | + json: Boolean(opts.json), |
| 284 | + agent: opts.agent as string | undefined, |
| 285 | + status: opts.status as string | undefined, |
| 286 | + all: Boolean(opts.all), |
| 287 | + }, |
| 288 | + defaultRuntime, |
| 289 | + ); |
| 290 | + }); |
| 291 | + }); |
| 292 | + commitmentsCmd.enablePositionalOptions(); |
| 293 | + |
| 294 | + commitmentsCmd |
| 295 | + .command("list") |
| 296 | + .description("List inferred follow-up commitments") |
| 297 | + .option("--json", "Output JSON instead of text", false) |
| 298 | + .option("--agent <id>", "Agent id to inspect") |
| 299 | + .option("--status <status>", "Filter by status (pending, sent, dismissed, snoozed, expired)") |
| 300 | + .option("--all", "Show all statuses", false) |
| 301 | + .action(async (opts, command) => { |
| 302 | + const parentOpts = command.parent?.opts() as |
| 303 | + | { json?: boolean; agent?: string; status?: string; all?: boolean } |
| 304 | + | undefined; |
| 305 | + await runCommandWithRuntime(defaultRuntime, async () => { |
| 306 | + await commitmentsListCommand( |
| 307 | + { |
| 308 | + json: Boolean(opts.json || parentOpts?.json), |
| 309 | + agent: (opts.agent as string | undefined) ?? parentOpts?.agent, |
| 310 | + status: (opts.status as string | undefined) ?? parentOpts?.status, |
| 311 | + all: Boolean(opts.all || parentOpts?.all), |
| 312 | + }, |
| 313 | + defaultRuntime, |
| 314 | + ); |
| 315 | + }); |
| 316 | + }); |
| 317 | + |
| 318 | + commitmentsCmd |
| 319 | + .command("dismiss <ids...>") |
| 320 | + .description("Dismiss inferred follow-up commitments") |
| 321 | + .option("--json", "Output JSON instead of text", false) |
| 322 | + .action(async (ids: string[], opts, command) => { |
| 323 | + const parentOpts = command.parent?.opts() as { json?: boolean } | undefined; |
| 324 | + await runCommandWithRuntime(defaultRuntime, async () => { |
| 325 | + await commitmentsDismissCommand( |
| 326 | + { |
| 327 | + ids, |
| 328 | + json: Boolean(opts.json || parentOpts?.json), |
| 329 | + }, |
| 330 | + defaultRuntime, |
| 331 | + ); |
| 332 | + }); |
| 333 | + }); |
| 334 | + |
261 | 335 | const tasksCmd = program |
262 | 336 | .command("tasks") |
263 | 337 | .description("Inspect durable background tasks and TaskFlow state") |
|
0 commit comments