@softerist/heuristic-mcp 2.1.35 → 2.1.37
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/features/register.js +12 -1
- package/package.json +3 -3
- package/scripts/download-model.js +32 -0
package/features/register.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
|
-
import { writeFileSync } from 'fs';
|
|
2
|
+
import { writeFileSync, existsSync, statSync } from 'fs';
|
|
3
|
+
|
|
3
4
|
import path from 'path';
|
|
4
5
|
import os from 'os';
|
|
5
6
|
import { fileURLToPath } from 'url';
|
|
@@ -14,10 +15,20 @@ function detectCurrentIDE() {
|
|
|
14
15
|
if (process.env.CURSOR_AGENT) {
|
|
15
16
|
return 'Cursor';
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
// Fallback: Check for Antigravity directory presence
|
|
20
|
+
try {
|
|
21
|
+
const agPath = path.join(os.homedir(), '.gemini', 'antigravity');
|
|
22
|
+
if (existsSync(agPath) || (statSync && statSync(agPath).isDirectory())) {
|
|
23
|
+
return 'Antigravity';
|
|
24
|
+
}
|
|
25
|
+
} catch (e) {}
|
|
26
|
+
|
|
17
27
|
// Claude Desktop doesn't have a known env var, so we rely on existing config detection
|
|
18
28
|
return null;
|
|
19
29
|
}
|
|
20
30
|
|
|
31
|
+
|
|
21
32
|
// Known config paths for different IDEs
|
|
22
33
|
function getConfigPaths() {
|
|
23
34
|
const platform = process.platform;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softerist/heuristic-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.37",
|
|
4
4
|
"description": "An enhanced MCP server providing intelligent semantic code search with find-similar-code, recency ranking, and improved chunking. Fork of smart-coding-mcp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"dev": "node --watch index.js",
|
|
13
13
|
"test": "vitest run",
|
|
14
14
|
"test:watch": "vitest",
|
|
15
|
-
"
|
|
16
|
-
"postinstall": "node scripts/postinstall.js"
|
|
15
|
+
"clean": "node scripts/clear-cache.js",
|
|
16
|
+
"postinstall": "node scripts/postinstall.js && node scripts/download-model.js"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"mcp",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
import { pipeline, env } from '@xenova/transformers';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import os from 'os';
|
|
6
|
+
import { getGlobalCacheDir } from '../lib/config.js';
|
|
7
|
+
|
|
8
|
+
// Force cache directory to global location
|
|
9
|
+
const globalCacheDir = path.join(getGlobalCacheDir(), 'xenova');
|
|
10
|
+
env.cacheDir = globalCacheDir;
|
|
11
|
+
|
|
12
|
+
console.log(`[Model Setup] Pre-caching model to: ${globalCacheDir}`);
|
|
13
|
+
|
|
14
|
+
async function downloadModel() {
|
|
15
|
+
try {
|
|
16
|
+
// Check if network is available by pinging HF (simple check)
|
|
17
|
+
// Actually, pipeline() will fail fast if network is down
|
|
18
|
+
console.log(`[Model Setup] Downloading 'Xenova/all-MiniLM-L6-v2'...`);
|
|
19
|
+
|
|
20
|
+
// This will download the model to the cache directory
|
|
21
|
+
await pipeline('feature-extraction', 'Xenova/all-MiniLM-L6-v2');
|
|
22
|
+
|
|
23
|
+
console.log(`[Model Setup] ✅ Model cached successfully!`);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.warn(`[Model Setup] ⚠️ Constructive warning: Failed to pre-download model.`);
|
|
26
|
+
console.warn(`[Model Setup] This is okay! The server will attempt to download it when started.`);
|
|
27
|
+
console.warn(`[Model Setup] Error details: ${error.message}`);
|
|
28
|
+
// Don't fail the install, just warn
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
downloadModel();
|