refactor(cli): deduplicate command options between top-level and agent subcommands

Extract addXxxOptions() builder functions for all 9 shared commands
(ls, run, attach, logs, stop, delete, send, inspect, wait) so both
paseo <cmd> and paseo agent <cmd> use a single source of truth.

Fixes drift where agent subcommands were missing --wait-timeout (run),
--worktree/--base/--image (run), --since (logs), and --image (send).
This commit is contained in:
Mohamed Boudra
2026-03-23 10:33:06 +07:00
parent 07720f1d99
commit 7f9dafab68
11 changed files with 156 additions and 198 deletions
+13 -1
View File
@@ -1,4 +1,5 @@
import type { Command } from "commander";
import { type Command } from "commander";
import { collectMultiple } from "../../utils/command-options.js";
import { connectToDaemon, getDaemonHost } from "../../utils/client.js";
import type {
CommandOptions,
@@ -33,6 +34,17 @@ export interface AgentSendOptions extends CommandOptions {
promptFile?: string;
}
export function addSendOptions(cmd: Command): Command {
return cmd
.description("Send a message/task to an existing agent")
.argument("<id>", "Agent ID (or prefix)")
.argument("[prompt]", "The message to send")
.option("--prompt <text>", "Provide the message inline as a flag")
.option("--prompt-file <path>", "Read the message from a UTF-8 text file")
.option("--image <path>", "Attach image(s) to the message", collectMultiple, [])
.option("--no-wait", "Return immediately without waiting for completion");
}
/**
* Read image files and convert them to base64 data URIs
*/