From ea736df376564a55f6519d6095cb322a68398153 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 21 Jul 2025 00:06:48 -0700 Subject: [PATCH 1/2] 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 From 5d8834d861434aa0689d1c752b54275bcd20ab3b Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 21 Jul 2025 09:39:37 -0700 Subject: [PATCH 2/2] fix tests --- src/e2e/headless-dynamic-responses.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/e2e/headless-dynamic-responses.test.ts b/src/e2e/headless-dynamic-responses.test.ts index 207a6d27b..f4b4722b2 100644 --- a/src/e2e/headless-dynamic-responses.test.ts +++ b/src/e2e/headless-dynamic-responses.test.ts @@ -103,7 +103,7 @@ describe("E2E: Headless Mode with Dynamic Responses", () => { expect(result.stdout).toContain("Non-streaming response"); expect(result.exitCode).toBe(0); - }); + }, 20000); it("should handle multiple mock servers for different models", async () => { context = await createTestContext();