Files
hapi/cli/bin/happy-mcp.mjs
T
2025-12-16 15:03:50 +08:00

33 lines
958 B
JavaScript
Executable File

#!/usr/bin/env node
import { execFileSync } from 'child_process';
import { fileURLToPath } from 'url';
import { join, dirname } from 'path';
// Ensure Node flags to reduce noisy warnings on stdout (which could interfere with MCP)
const hasNoWarnings = process.execArgv.includes('--no-warnings');
const hasNoDeprecation = process.execArgv.includes('--no-deprecation');
if (!hasNoWarnings || !hasNoDeprecation) {
const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
const entrypoint = join(projectRoot, 'dist', 'codex', 'happyMcpStdioBridge.mjs');
try {
execFileSync(process.execPath, [
'--no-warnings',
'--no-deprecation',
entrypoint,
...process.argv.slice(2)
], {
stdio: 'inherit',
env: process.env
});
} catch (error) {
process.exit(error.status || 1);
}
} else {
// Already have desired flags; import module directly
import('../dist/codex/happyMcpStdioBridge.mjs');
}