Files
coucou/brain/scripts/pin-node.cjs
T
Claude 38f2b6b2c0 Release prep: Coucou 0.7.0 (GitHub), Memory and Mochis
0.7.0 now comes out with Memory and the Mochis; Botan and the iPhone app's 3.0 wait for Botan's
launch (their CHANGELOG lines are kept in a comment at the top of CHANGELOG.md, and the What's new
entry is rewritten: Memory, Mochis, draft replies, in the 16 languages). README: the 0.7.0 row and
the two new sections of the window.

brain becomes the npm package coucou-brain 0.7.0 (it was never published as @coucou/brain, which
the Memory page asked to install): files, engines, postinstall pins the Node that can load
better-sqlite3, prepublishOnly builds, an English README head. The user's settings move to
~/CoucouBrain/.state/config.json so an npm update keeps them (brain.config.local.json next to the
package still counts, for a dev checkout), and the language defaults to the Mac's instead of
French. The Memory and Mochis pages say npm install -g coucou-brain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
2026-11-28 23:33:01 +00:00

18 lines
978 B
JavaScript

// After `npm run build`: write dist/node-path, the Node that built brain and can load its native
// module (better-sqlite3). The Coucou app runs brain with that Node, not whichever `node` comes
// first in its own PATH: a different Node version can't open the index ("compiled against a
// different Node.js version") and the Memory pages would see nothing.
const fs = require("node:fs");
const path = require("node:path");
const out = path.join(__dirname, "..", "dist", "node-path");
// `npm install` in the repo runs this before any build: nothing to pin yet
if (!fs.existsSync(path.dirname(out))) process.exit(0);
try {
require("better-sqlite3");
fs.writeFileSync(out, process.execPath + "\n");
console.log(`brain: Node pinned for the app → ${process.execPath}`);
} catch (e) {
fs.rmSync(out, { force: true });
console.warn(`brain: this Node (${process.version}) can't load better-sqlite3 — run « npm rebuild better-sqlite3 », then « npm run build ».`);
}