Revert "feat: add --remote-url CLI option to connect to remote OpenCode instances (#161)"
This reverts commit 53f8e1324e.
This commit is contained in:
+5
-26
@@ -74,7 +74,7 @@ function buildTunnelUrl(baseUrl, password, includePassword) {
|
||||
function parseArgs() {
|
||||
const args = process.argv.slice(2);
|
||||
const envPassword = process.env.OPENCHAMBER_UI_PASSWORD || undefined;
|
||||
const options = { port: DEFAULT_PORT, daemon: false, uiPassword: envPassword, tryCfTunnel: false, tunnelQr: false, tunnelPasswordUrl: false, remoteUrl: null };
|
||||
const options = { port: DEFAULT_PORT, daemon: false, uiPassword: envPassword, tryCfTunnel: false, tunnelQr: false, tunnelPasswordUrl: false };
|
||||
let command = 'serve';
|
||||
|
||||
const consumeValue = (currentIndex, inlineValue) => {
|
||||
@@ -132,12 +132,6 @@ function parseArgs() {
|
||||
options.uiPassword = typeof value === 'string' ? value : '';
|
||||
break;
|
||||
}
|
||||
case 'remote-url': {
|
||||
const { value, nextIndex } = consumeValue(i, inlineValue);
|
||||
i = nextIndex;
|
||||
options.remoteUrl = typeof value === 'string' && value.length > 0 ? value : null;
|
||||
break;
|
||||
}
|
||||
case 'help':
|
||||
case 'h':
|
||||
showHelp();
|
||||
@@ -173,7 +167,6 @@ COMMANDS:
|
||||
|
||||
OPTIONS:
|
||||
-p, --port Web server port (default: ${DEFAULT_PORT})
|
||||
--remote-url Connect to remote OpenCode instance instead of starting local
|
||||
--ui-password Protect browser UI with single password
|
||||
--try-cf-tunnel Create a Cloudflare Quick Tunnel for remote access
|
||||
--tunnel-qr Display QR code for tunnel URL (use with --try-cf-tunnel)
|
||||
@@ -184,14 +177,12 @@ OPTIONS:
|
||||
|
||||
ENVIRONMENT:
|
||||
OPENCHAMBER_UI_PASSWORD Alternative to --ui-password flag
|
||||
OPENCODE_REMOTE_URL Alternative to --remote-url flag
|
||||
|
||||
EXAMPLES:
|
||||
openchamber # Start on default port 3000
|
||||
openchamber --port 8080 # Start on port 8080
|
||||
openchamber serve --daemon # Start in background
|
||||
openchamber --try-cf-tunnel # Start with Cloudflare Quick Tunnel
|
||||
openchamber --remote-url http://remote-server:3000 # Connect to remote OpenCode
|
||||
openchamber stop # Stop all running instances
|
||||
openchamber stop --port 3000 # Stop specific instance
|
||||
openchamber status # Check status
|
||||
@@ -465,8 +456,7 @@ const commands = {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// When remoteUrl is provided, skip local OpenCode CLI check
|
||||
const opencodeBinary = options.remoteUrl ? null : await checkOpenCodeCLI();
|
||||
const opencodeBinary = await checkOpenCodeCLI();
|
||||
|
||||
const serverPath = path.join(__dirname, '..', 'server', 'index.js');
|
||||
|
||||
@@ -485,9 +475,6 @@ const commands = {
|
||||
if (options.tryCfTunnel) {
|
||||
serverArgs.push('--try-cf-tunnel');
|
||||
}
|
||||
if (options.remoteUrl) {
|
||||
serverArgs.push('--remote-url', options.remoteUrl);
|
||||
}
|
||||
|
||||
const preferredRuntime = getPreferredServerRuntime();
|
||||
const runtimeBin = preferredRuntime === 'bun' ? BUN_BIN : process.execPath;
|
||||
@@ -500,10 +487,9 @@ const commands = {
|
||||
env: {
|
||||
...process.env,
|
||||
OPENCHAMBER_PORT: options.port.toString(),
|
||||
...(opencodeBinary ? { OPENCODE_BINARY: opencodeBinary } : {}),
|
||||
OPENCODE_BINARY: opencodeBinary,
|
||||
...(typeof effectiveUiPassword === 'string' ? { OPENCHAMBER_UI_PASSWORD: effectiveUiPassword } : {}),
|
||||
OPENCHAMBER_TRY_CF_TUNNEL: options.tryCfTunnel ? 'true' : 'false',
|
||||
...(options.remoteUrl ? { OPENCODE_REMOTE_URL: options.remoteUrl } : {}),
|
||||
}
|
||||
});
|
||||
|
||||
@@ -528,15 +514,10 @@ const commands = {
|
||||
|
||||
} else {
|
||||
|
||||
if (opencodeBinary) {
|
||||
process.env.OPENCODE_BINARY = opencodeBinary;
|
||||
}
|
||||
process.env.OPENCODE_BINARY = opencodeBinary;
|
||||
if (typeof effectiveUiPassword === 'string') {
|
||||
process.env.OPENCHAMBER_UI_PASSWORD = effectiveUiPassword;
|
||||
}
|
||||
if (options.remoteUrl) {
|
||||
process.env.OPENCODE_REMOTE_URL = options.remoteUrl;
|
||||
}
|
||||
if (showAutoGeneratedPassword) {
|
||||
console.log(`\n🔐 Auto-generated password: \x1b[92m${effectiveUiPassword}\x1b[0m`);
|
||||
console.log('⚠️ Save this password - it won\'t be shown again!\n');
|
||||
@@ -552,10 +533,9 @@ const commands = {
|
||||
env: {
|
||||
...process.env,
|
||||
OPENCHAMBER_PORT: options.port.toString(),
|
||||
...(opencodeBinary ? { OPENCODE_BINARY: opencodeBinary } : {}),
|
||||
OPENCODE_BINARY: opencodeBinary,
|
||||
...(typeof effectiveUiPassword === 'string' ? { OPENCHAMBER_UI_PASSWORD: effectiveUiPassword } : {}),
|
||||
OPENCHAMBER_TRY_CF_TUNNEL: options.tryCfTunnel ? 'true' : 'false',
|
||||
...(options.remoteUrl ? { OPENCODE_REMOTE_URL: options.remoteUrl } : {}),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -573,7 +553,6 @@ const commands = {
|
||||
exitOnShutdown: true,
|
||||
uiPassword: typeof effectiveUiPassword === 'string' ? effectiveUiPassword : null,
|
||||
tryCfTunnel: options.tryCfTunnel,
|
||||
remoteUrl: options.remoteUrl,
|
||||
onTunnelReady: async (url) => {
|
||||
const displayUrl = buildTunnelUrl(url, effectiveUiPassword, options.tunnelPasswordUrl);
|
||||
console.log(`\n🌐 Tunnel URL: \x1b[36m${displayUrl}\x1b[0m\n`);
|
||||
|
||||
Reference in New Issue
Block a user