{"draft":null,"from":2,"to":318,"files":[{"path":"client/avcs.ts","added":30,"removed":12,"diff":"--- a/client/avcs.ts\n+++ b/client/avcs.ts\n@@ -3,14 +3,33 @@\n // `abso help` lists the commands. `abso hook` is the Claude Code hook; it\n // loads only what it needs, since every edit pays for its start-up.\n \n-import { enableCompileCache } from \"node:module\";\n+import { readFileSync } from \"node:fs\";\n+import * as nodeModule from \"node:module\";\n+import { dirname, join } from \"node:path\";\n \n+const argv = process.argv.slice(2);\n+\n+/**\n+ * Whether this command opens a local project (abso init --local): --local, or a folder whose config names the server\n+ * \"local\". Those load the open server's code through a module hook, and with the compile cache on Node 24 crashes.\n+ */\n+function opensLocal(): boolean {\n+\tif (argv.includes(\"--local\")) return true;\n+\tfor (let dir = process.cwd(); ; dir = dirname(dir)) {\n+\t\tfor (const state of [\".abso\", \".avcs\"]) {\n+\t\t\ttry {\n+\t\t\t\treturn /\"server\"\\s*:\\s*\"local\"/.test(readFileSync(join(dir, state, \"config.json\"), \"utf8\"));\n+\t\t\t} catch {}\n+\t\t}\n+\t\tif (dirname(dir) === dir) return false;\n+\t}\n+}\n+\n // Node keeps the compiled modules (TypeScript already stripped) in a cache in\n // the temp folder. Loading the hook's modules drops from about 55 ms to 11 ms.\n-enableCompileCache();\n+// Node 20 has no compile cache, and the built client runs there without one.\n+if (!opensLocal()) (nodeModule as { enableCompileCache?: () => unknown }).enableCompileCache?.();\n \n-const argv = process.argv.slice(2);\n-\n if (argv[0] === \"hook\") {\n \tconst { runHook } = await import(\"./src/hook.ts\");\n \tconst chunks: Buffer[] = [];\n@@ -25,13 +44,12 @@\n \tawait serveMcp(process.stdin, (line) => process.stdout.write(`${line}\\n`), process.cwd(), process.env);\n } else {\n \tconst { main } = await import(\"./src/main.ts\");\n-\tconst result = await main(argv, {\n-\t\tcwd: process.cwd(),\n-\t\tenv: process.env,\n-\t\twrite: (text) => process.stdout.write(text),\n-\t\twriteErr: (text) => process.stderr.write(text),\n-\t});\n-\tif (result.stdout) process.stdout.write(result.stdout);\n-\tif (result.stderr) process.stderr.write(result.stderr);\n+\t// Everything printed goes through terminalText: most of it is a server's text (abso-core's terminal-text.ts).\n+\tconst { colorsPass, terminalText } = await import(\"./src/terminal-text.ts\");\n+\tconst out = (text: string) => process.stdout.write(terminalText(text, colorsPass(process.stdout, process.env)));\n+\tconst err = (text: string) => process.stderr.write(terminalText(text, colorsPass(process.stderr, process.env)));\n+\tconst result = await main(argv, { cwd: process.cwd(), env: process.env, write: out, writeErr: err });\n+\tif (result.stdout) out(result.stdout);\n+\tif (result.stderr) err(result.stderr);\n \tprocess.exitCode = result.exit;\n }"}],"unmatched":[]}