gitnexus 1.6.2-rc.7 → 1.6.2-rc.9
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.
|
@@ -131,6 +131,11 @@ export const initEmbedder = async (onProgress, config = {}, forceDevice) => {
|
|
|
131
131
|
try {
|
|
132
132
|
// Configure transformers.js environment
|
|
133
133
|
env.allowLocalModels = false;
|
|
134
|
+
// Default cache to user-writable location. transformers.js defaults to
|
|
135
|
+
// ./node_modules/.cache inside its own install dir, which is unwritable
|
|
136
|
+
// when gitnexus is installed globally (e.g. /usr/lib/node_modules/).
|
|
137
|
+
// Respect HF_HOME if set, otherwise fall back to ~/.cache/huggingface.
|
|
138
|
+
env.cacheDir = process.env.HF_HOME ?? `${process.env.HOME}/.cache/huggingface`;
|
|
134
139
|
const isDev = process.env.NODE_ENV === 'development';
|
|
135
140
|
if (isDev) {
|
|
136
141
|
console.log(`🧠 Loading embedding model: ${finalConfig.modelId}`);
|
|
@@ -30,6 +30,11 @@ export const initEmbedder = async () => {
|
|
|
30
30
|
initPromise = (async () => {
|
|
31
31
|
try {
|
|
32
32
|
env.allowLocalModels = false;
|
|
33
|
+
// Default cache to user-writable location. transformers.js defaults to
|
|
34
|
+
// ./node_modules/.cache inside its own install dir, which is unwritable
|
|
35
|
+
// when gitnexus is installed globally (e.g. /usr/lib/node_modules/).
|
|
36
|
+
// Respect HF_HOME if set, otherwise fall back to ~/.cache/huggingface.
|
|
37
|
+
env.cacheDir = process.env.HF_HOME ?? `${process.env.HOME}/.cache/huggingface`;
|
|
33
38
|
console.error('GitNexus: Loading embedding model (first search may take a moment)...');
|
|
34
39
|
// Try GPU first (DirectML on Windows, CUDA on Linux), fall back to CPU
|
|
35
40
|
const isWindows = process.platform === 'win32';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitnexus",
|
|
3
|
-
"version": "1.6.2-rc.
|
|
3
|
+
"version": "1.6.2-rc.9",
|
|
4
4
|
"description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
|
|
5
5
|
"author": "Abhigyan Patwari",
|
|
6
6
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"test:integration": "vitest run test/integration",
|
|
47
47
|
"test:watch": "vitest",
|
|
48
48
|
"test:coverage": "vitest run --coverage",
|
|
49
|
+
"preinstall": "node scripts/preinstall-cleanup.cjs",
|
|
49
50
|
"postinstall": "node scripts/patch-tree-sitter-swift.cjs",
|
|
50
51
|
"prepare": "node scripts/build.js",
|
|
51
52
|
"prepack": "node scripts/build.js"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Preinstall cleanup script.
|
|
4
|
+
*
|
|
5
|
+
* When upgrading gitnexus globally (`npm install -g gitnexus@<new>`),
|
|
6
|
+
* npm may fail with ENOTEMPTY because it cannot cleanly remove the
|
|
7
|
+
* `node_modules/` and `build/` directories that a *previous*
|
|
8
|
+
* installation's `file:` dependency resolution created inside
|
|
9
|
+
* `vendor/tree-sitter-proto/`.
|
|
10
|
+
*
|
|
11
|
+
* This script runs as a `preinstall` hook — before npm resolves
|
|
12
|
+
* dependencies — and removes those leftover directories so npm can
|
|
13
|
+
* proceed without errors.
|
|
14
|
+
*
|
|
15
|
+
* See: https://github.com/abhigyanpatwari/GitNexus/issues/836
|
|
16
|
+
*/
|
|
17
|
+
const fs = require('fs');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
|
|
20
|
+
const vendorDirs = [
|
|
21
|
+
path.join(__dirname, '..', 'vendor', 'tree-sitter-proto', 'node_modules'),
|
|
22
|
+
path.join(__dirname, '..', 'vendor', 'tree-sitter-proto', 'build'),
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
for (const dir of vendorDirs) {
|
|
26
|
+
try {
|
|
27
|
+
if (fs.existsSync(dir)) {
|
|
28
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
29
|
+
}
|
|
30
|
+
} catch (err) {
|
|
31
|
+
// Best-effort cleanup — warn but don't fail the install.
|
|
32
|
+
console.warn(`[preinstall] Could not remove ${dir}:`, err.message);
|
|
33
|
+
}
|
|
34
|
+
}
|