Merge pull request #83 from continuedev/remote-specify-url
feat: --url flag for remote
This commit is contained in:
commit
34f6fd6160
3 changed files with 25 additions and 7 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -103,10 +103,11 @@ program
|
|||
|
||||
// Remote subcommand
|
||||
program
|
||||
.command("remote <prompt>")
|
||||
.command("remote [prompt]")
|
||||
.description("Launch a remote instance of the cn agent")
|
||||
.action(async (prompt: string) => {
|
||||
await remote(prompt);
|
||||
.option("--url <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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue