From ea736df376564a55f6519d6095cb322a68398153 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 21 Jul 2025 00:06:48 -0700 Subject: [PATCH] feat: --url flag for remote --- src/commands/remote.ts | 23 ++++++++++++++++++++--- src/index.ts | 7 ++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/commands/remote.ts b/src/commands/remote.ts index fb766ddbd..e82063fce 100644 --- a/src/commands/remote.ts +++ b/src/commands/remote.ts @@ -9,7 +9,24 @@ import { startRemoteTUIChat } from "../ui/index.js"; import telemetryService from "../telemetry/telemetryService.js"; import logger from "../util/logger.js"; -export async function remote(prompt: string) { +export async function remote(prompt: string | undefined, options: { url?: string } = {}) { + // If --url is provided, connect directly to that URL + if (options.url) { + console.info(chalk.white(`Connecting to remote environment at: ${options.url}`)); + + // Record session start + telemetryService.recordSessionStart(); + telemetryService.startActiveTime(); + + try { + // Start the TUI in remote mode + await startRemoteTUIChat(options.url, prompt); + } finally { + telemetryService.stopActiveTime(); + } + return; + } + console.info(chalk.white("Setting up remote development environment...")); try { @@ -63,7 +80,7 @@ export async function remote(prompt: string) { try { // Start the TUI in remote mode (prompt is optional) - await startRemoteTUIChat(remoteUrl, undefined); + await startRemoteTUIChat(remoteUrl, prompt); } finally { telemetryService.stopActiveTime(); } @@ -76,4 +93,4 @@ export async function remote(prompt: string) { ); process.exit(1); } -} +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 9736b2b77..15b553db5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -103,10 +103,11 @@ program // Remote subcommand program - .command("remote ") + .command("remote [prompt]") .description("Launch a remote instance of the cn agent") - .action(async (prompt: string) => { - await remote(prompt); + .option("--url ", "Connect directly to the specified URL instead of creating a new remote environment") + .action(async (prompt: string | undefined, options) => { + await remote(prompt, options); }); // Serve subcommand