diff --git a/eslint.config.mjs b/eslint.config.mjs index 381eb9672..dd96f3ae1 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -99,12 +99,11 @@ export default [ 'Direct process.stdout.write is forbidden in MCP-reachable code. Route diagnostics through console.error or process.stderr.write — the MCP stdio transport owns stdout for JSON-RPC frames.', }, { - selector: - "VariableDeclarator > ObjectPattern > Property[key.name='write'].properties:has(MemberExpression[object.name='process'][property.name='stdout'])", - message: - 'Destructuring write off process.stdout is forbidden in MCP-reachable code — bypasses the sentinel. Use process.stderr.write for diagnostics.', - }, - { + // Catches the canonical destructuring shape: + // const { write } = process.stdout; + // (and any other ObjectPattern destructure rooted at process.stdout) + // which would otherwise capture a reference to the original write + // and bypass the sentinel. selector: "VariableDeclarator[init.type='MemberExpression'][init.object.name='process'][init.property.name='stdout'] > ObjectPattern", message: diff --git a/gitnexus/src/cli/mcp.ts b/gitnexus/src/cli/mcp.ts index 76a3584d0..f8cf7d18d 100644 --- a/gitnexus/src/cli/mcp.ts +++ b/gitnexus/src/cli/mcp.ts @@ -43,18 +43,18 @@ export const mcpCommand = async () => { // Now safe to dynamically import the heavy backend modules. Anything // they emit to stdout during evaluation will route through the sentinel. - const [{ startMCPServer }, { LocalBackend }, { warnMissingOptionalGrammars }] = await Promise.all( - [ - import('../mcp/server.js'), - import('../mcp/local/local-backend.js'), - import('./optional-grammars.js'), - ], - ); + const [{ startMCPServer }, { LocalBackend }] = await Promise.all([ + import('../mcp/server.js'), + import('../mcp/local/local-backend.js'), + ]); - // Surface missing optional grammars at startup so users learn why - // .dart/.proto files won't be parsed instead of silently getting a - // degraded index. - warnMissingOptionalGrammars({ context: 'mcp' }); + // Note: missing-optional-grammar warnings are emitted by `gitnexus analyze` + // (with `relevantExtensions` filtered to the repo's actual file types) at + // index time. A repo can only be served by MCP after it has been analyzed, + // so the user has already been warned through the path that knows whether + // the repo even contains .dart/.proto files. Repeating an unconditional + // warning at every MCP startup would be pure noise on machines whose + // indexed repos don't use those grammars. // Initialize multi-repo backend from registry. // The server starts even with 0 repos — tools call refreshRepos() lazily,