diff --git a/plugins/axiomcode/mcp/find-python.js b/plugins/axiomcode/mcp/find-python.js index 1492f31a6..9e47abfd7 100644 --- a/plugins/axiomcode/mcp/find-python.js +++ b/plugins/axiomcode/mcp/find-python.js @@ -49,6 +49,10 @@ function withPython(env, py) { // Windows Python writes a pipe in the ANSI code page and opens files in it, so the first → in an answer raised // UnicodeEncodeError, and a source file in UTF-8 read wrong. UTF-8 mode fixes both; a user's own setting stands. if (process.platform === 'win32' && out.PYTHONUTF8 === undefined) out.PYTHONUTF8 = '1'; + // Git Bash's runtime expands wildcards in the arguments a native Windows process hands it, since no shell did: + // `axiomcode path '*' X` reached the CLI as the working directory's file names. noglob turns that off for every + // bash below (the CLI's, the MCP server's, the hooks'); other MSYS options a user set are kept. + if (process.platform === 'win32' && !/(^|\s)noglob(\s|$)/.test(out.MSYS || '')) out.MSYS = ((out.MSYS || '') + ' noglob').trim(); if (process.platform !== 'win32' && py.cmd.length === 1 && py.cmd[0] === 'python3') return out; // Windows keeps it as Path, and a second PATH key beside it would be one of two the child picks from. const key = Object.keys(out).find((k) => k.toUpperCase() === 'PATH') || 'PATH';