totem-llm 0.1.2 → 0.1.4

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.
@@ -158,7 +158,7 @@ async function wipeCollectorStorage() {
158
158
  const cleanHotDir = new Promise((resolve) => {
159
159
  const directory = path.resolve(__dirname, "../../hotdir");
160
160
  fs.readdir(directory, (err, files) => {
161
- if (err) resolve();
161
+ if (err) { resolve(); return; }
162
162
 
163
163
  for (const file of files) {
164
164
  if (file === "__HOTDIR__.md") continue;
@@ -173,7 +173,7 @@ async function wipeCollectorStorage() {
173
173
  const cleanTmpDir = new Promise((resolve) => {
174
174
  const directory = path.resolve(__dirname, "../../storage/tmp");
175
175
  fs.readdir(directory, (err, files) => {
176
- if (err) resolve();
176
+ if (err) { resolve(); return; }
177
177
 
178
178
  for (const file of files) {
179
179
  if (file === ".placeholder") continue;
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.2",
3
+ "version": "0.1.4",
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",
@@ -24,6 +24,7 @@
24
24
  "bin/",
25
25
  "lib/",
26
26
  "scripts/postinstall.mjs",
27
+ "totem.features.cjs",
27
28
  "server/",
28
29
  "collector/"
29
30
  ],
@@ -54,7 +55,8 @@
54
55
  "translations:prune": "cd frontend/src/locales && node findUnusedTranslations.mjs --delete && cd ../../../ && yarn translations:normalize",
55
56
  "translations:create": "cd extras/translator && node index.mjs --all && cd ../../frontend && yarn lint && cd ../..",
56
57
  "prepublishOnly": "node scripts/build-frontend.mjs",
57
- "postinstall": "node scripts/postinstall.mjs"
58
+ "postinstall": "node scripts/postinstall.mjs",
59
+ "test:install": "node scripts/test-install.mjs"
58
60
  },
59
61
  "private": false,
60
62
  "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 {