totem-llm 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/setup.js CHANGED
@@ -96,7 +96,10 @@ function ensureStorageDirs(storageDir) {
96
96
  * Safe to call on every startup — only applies pending migrations.
97
97
  */
98
98
  async function runMigrations(serverDir, env) {
99
- await runCommand("npx", ["prisma", "migrate", "deploy", "--schema", join(serverDir, "prisma", "schema.prisma")], {
99
+ // Use the locally-installed Prisma binary to avoid picking up a globally-
100
+ // installed incompatible Prisma CLI version.
101
+ const prismaBin = join(serverDir, "node_modules", ".bin", "prisma");
102
+ await runCommand(prismaBin, ["migrate", "deploy", "--schema", join(serverDir, "prisma", "schema.prisma")], {
100
103
  cwd: serverDir,
101
104
  env,
102
105
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totem-llm",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Totem LLM – Your Private AI. Run a self-hosted AI assistant locally on Linux, macOS, or Windows.",
5
5
  "main": "bin/totem-llm.js",
6
6
  "type": "module",
@@ -54,7 +54,8 @@
54
54
  "translations:prune": "cd frontend/src/locales && node findUnusedTranslations.mjs --delete && cd ../../../ && yarn translations:normalize",
55
55
  "translations:create": "cd extras/translator && node index.mjs --all && cd ../../frontend && yarn lint && cd ../..",
56
56
  "prepublishOnly": "node scripts/build-frontend.mjs",
57
- "postinstall": "node scripts/postinstall.mjs"
57
+ "postinstall": "node scripts/postinstall.mjs",
58
+ "test:install": "node scripts/test-install.mjs"
58
59
  },
59
60
  "private": false,
60
61
  "devDependencies": {
@@ -48,8 +48,12 @@ async function installDeps(label, dir) {
48
48
  return;
49
49
  }
50
50
  console.log(` [${label}] installing production dependencies…`);
51
- // Prefer npm (always available in npm-installed contexts) over yarn
52
- await run("npm", ["install", "--omit=dev", "--no-audit", "--no-fund"], dir);
51
+ // --no-global: overrides npm_config_global=true inherited from the outer `npm install -g`
52
+ // so packages install into dir/node_modules instead of the global prefix.
53
+ // --prefix dir: explicit local install target (belt-and-suspenders with --no-global).
54
+ // --legacy-peer-deps: the project has known peer-dep conflicts (e.g. apache-arrow,
55
+ // prettier version ranges) that are fine at runtime but fail strict npm v7+ resolution.
56
+ await run("npm", ["install", "--omit=dev", "--no-audit", "--no-fund", "--legacy-peer-deps", "--no-global", "--prefix", dir], dir);
53
57
  }
54
58
 
55
59
  async function main() {
@@ -60,7 +64,11 @@ async function main() {
60
64
  // cloned the repo and run `yarn install` at the root). We detect this by
61
65
  // checking whether the root package.json name matches AND we are NOT being
62
66
  // installed as a dependency of something else.
67
+ // NOTE: npm_config_global is "true" for `npm install -g` (even with --prefix),
68
+ // so we must NOT skip when it is set — otherwise the postinstall is a no-op
69
+ // when the tarball is installed from within the project directory.
63
70
  const isLocalDev =
71
+ !process.env.npm_config_global &&
64
72
  process.env.npm_config_local_prefix &&
65
73
  process.env.npm_config_local_prefix === process.env.INIT_CWD;
66
74
  if (isLocalDev) return;
@@ -86,9 +94,12 @@ async function main() {
86
94
  );
87
95
  if (!prismaClientExists) {
88
96
  console.log(" [server] generating Prisma client…");
97
+ // Use the locally-installed Prisma binary to avoid picking up a globally-
98
+ // installed incompatible Prisma CLI version.
99
+ const prismaBin = join(serverDir, "node_modules", ".bin", "prisma");
89
100
  await run(
90
- "npx",
91
- ["prisma", "generate", "--schema", join(serverDir, "prisma", "schema.prisma")],
101
+ prismaBin,
102
+ ["generate", "--schema", join(serverDir, "prisma", "schema.prisma")],
92
103
  serverDir
93
104
  );
94
105
  } else {