Type CLI command host/json options at the source

The CommandOptions interface in packages/cli/src/output/with-output.ts had
an open `[key: string]: unknown` indexer, so every consumer of the global
--host and --json options had to cast `options.host as string | undefined`
at the call site. Add `host?: string` and `json?: boolean` to the interface
and remove 29 redundant casts across 12 command files.
This commit is contained in:
Mohamed Boudra
2026-05-05 19:56:26 +07:00
parent 4cd9e76bd2
commit 5feaa7a101
13 changed files with 28 additions and 24 deletions
+2 -2
View File
@@ -86,7 +86,7 @@ export async function runLogsCommand(
options: AgentLogsOptions,
_command: Command,
): Promise<AgentLogsResult> {
const host = getDaemonHost({ host: options.host as string | undefined });
const host = getDaemonHost({ host: options.host });
if (!id) {
console.error("Error: Agent ID required");
@@ -96,7 +96,7 @@ export async function runLogsCommand(
let client: DaemonClient;
try {
client = await connectToDaemon({ host: options.host as string | undefined });
client = await connectToDaemon({ host: options.host });
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
console.error(`Error: Cannot connect to daemon at ${host}: ${message}`);