consortium
Version:
Remote control and session sharing CLI for AI coding agents
36 lines (31 loc) • 1.11 kB
JavaScript
import { execFileSync } from 'child_process';
import { fileURLToPath } from 'url';
import { join, dirname } from 'path';
// 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) {
// Get path to the actual CLI entrypoint
const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
const entrypoint = join(projectRoot, 'dist', 'index.mjs');
// Execute the actual CLI directly with the correct flags
try {
execFileSync(process.execPath, [
'--no-warnings',
'--no-deprecation',
entrypoint,
...process.argv.slice(2)
], {
stdio: 'inherit',
env: process.env
});
} catch (error) {
// execFileSync throws if the process exits with non-zero
process.exit(error.status || 1);
}
} else {
// We're running Node with the flags we wanted, import the CLI entrypoint
// module to avoid creating a new process.
import("../dist/index.mjs");
}