consortium
Version:
Remote control and session sharing CLI for AI coding agents
42 lines (35 loc) • 1.28 kB
JavaScript
import { execFileSync } from 'child_process';
import { fileURLToPath } from 'url';
import { join, dirname } from 'path';
import { homedir } from 'os';
// Check if we're already running with the flags
const hasNoWarnings = process.execArgv.includes('--no-warnings');
const hasNoDeprecation = process.execArgv.includes('--no-deprecation');
if (!hasNoWarnings || !hasNoDeprecation) {
// Re-execute with the flags
const __filename = fileURLToPath(import.meta.url);
const scriptPath = join(dirname(__filename), '../dist/index.mjs');
// Set development environment variables
process.env.CONSORTIUM_HOME_DIR = join(homedir(), '.consortium-dev');
process.env.CONSORTIUM_VARIANT = 'dev';
try {
execFileSync(
process.execPath,
['--no-warnings', '--no-deprecation', scriptPath, ...process.argv.slice(2)],
{
stdio: 'inherit',
env: process.env
}
);
} catch (error) {
// Exit with the same code as the subprocess
process.exit(error.status || 1);
}
} else {
// Already have the flags, import normally
// Set development environment variables
process.env.CONSORTIUM_HOME_DIR = join(homedir(), '.consortium-dev');
process.env.CONSORTIUM_VARIANT = 'dev';
await import('../dist/index.mjs');
}