feat: --url flag for remote
This commit is contained in:
parent
3bf6e276c6
commit
ea736df376
2 changed files with 24 additions and 6 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,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