INNER CODE UNIT · TypeScript

stderrWrite

AmrDab/clawdcursor · src/surface/cli.ts:1363

    const stderrWrite = (prefix: string, args: any[]) =>
      process.stderr.write(`${prefix}${args.map(a => typeof a === 'string' ? a : JSON.stringify(a)).join(' ')}\n`);
    console.log = (...args: any[]) => stderrWrite('', args);
    console.warn = (...args: any[]) => stderrWrite('[WARN] ', args);
    console.error = (...args: any[]) => stderrWrite('[ERROR] ', args);

    // Consent gate — REQUIRED before any tool runs, but NON-FATAL to startup.
    // Exiting here made the host show an opaque "MCP server failed" with no
    // reason: the message only goes to stderr, which most editor hosts hide.
    // Instead we start the server normally so the requirement surfaces as a
    // VISIBLE consent prompt on every tool call (enforced in mcp-server.ts) —
    // and it takes effect the moment `clawdcursor consent --accept` runs, with
    // no restart needed.
    const { hasConsent } = await import('./onboarding');
    if (!hasConsent()) {
      process.stderr.write(
        `\n[clawdcursor] One-time consent not yet accepted. The server will start, but\n` +
        `every tool call returns a consent prompt until you run:\n` +

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…