@softerist/heuristic-mcp 3.0.15 → 3.0.16
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/README.md +104 -104
- package/config.jsonc +173 -173
- package/features/ann-config.js +131 -0
- package/features/clear-cache.js +84 -0
- package/features/find-similar-code.js +291 -0
- package/features/hybrid-search.js +544 -0
- package/features/index-codebase.js +3268 -0
- package/features/lifecycle.js +1189 -0
- package/features/package-version.js +302 -0
- package/features/register.js +408 -0
- package/features/resources.js +156 -0
- package/features/set-workspace.js +265 -0
- package/index.js +96 -96
- package/lib/cache-ops.js +22 -22
- package/lib/cache-utils.js +565 -565
- package/lib/cache.js +1870 -1870
- package/lib/call-graph.js +396 -396
- package/lib/cli.js +1 -1
- package/lib/config.js +517 -517
- package/lib/constants.js +39 -39
- package/lib/embed-query-process.js +7 -7
- package/lib/embedding-process.js +7 -7
- package/lib/embedding-worker.js +299 -299
- package/lib/ignore-patterns.js +316 -316
- package/lib/json-worker.js +14 -14
- package/lib/json-writer.js +337 -337
- package/lib/logging.js +164 -164
- package/lib/memory-logger.js +13 -13
- package/lib/onnx-backend.js +193 -193
- package/lib/project-detector.js +84 -84
- package/lib/server-lifecycle.js +165 -165
- package/lib/settings-editor.js +754 -754
- package/lib/tokenizer.js +256 -256
- package/lib/utils.js +428 -428
- package/lib/vector-store-binary.js +627 -627
- package/lib/vector-store-sqlite.js +95 -95
- package/lib/workspace-env.js +28 -28
- package/mcp_config.json +9 -9
- package/package.json +86 -75
- package/scripts/clear-cache.js +20 -0
- package/scripts/download-model.js +43 -0
- package/scripts/mcp-launcher.js +49 -0
- package/scripts/postinstall.js +12 -0
- package/search-configs.js +36 -36
- package/.prettierrc +0 -7
- package/debug-pids.js +0 -30
- package/eslint.config.js +0 -36
- package/specs/plan.md +0 -23
- package/vitest.config.js +0 -39
package/lib/constants.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized constants for the heuristic-mcp project.
|
|
3
|
-
* Extracting magic numbers improves maintainability and documents design decisions.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// ================================
|
|
7
|
-
// Workspace Resolution Constants
|
|
8
|
-
// ================================
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Environment variables checked for workspace resolution, in precedence order.
|
|
12
|
-
*/
|
|
13
|
-
export const WORKSPACE_ENV_VARS = Object.freeze([
|
|
14
|
-
'HEURISTIC_MCP_WORKSPACE',
|
|
15
|
-
'MCP_WORKSPACE',
|
|
16
|
-
'CODEX_WORKSPACE',
|
|
17
|
-
'CODEX_PROJECT_ROOT',
|
|
18
|
-
'CODEX_CWD',
|
|
19
|
-
'WORKSPACE_FOLDER',
|
|
20
|
-
'WORKSPACE_ROOT',
|
|
21
|
-
'CURSOR_WORKSPACE',
|
|
22
|
-
'CLAUDE_WORKSPACE',
|
|
23
|
-
'ANTIGRAVITY_WORKSPACE',
|
|
24
|
-
'INIT_CWD',
|
|
25
|
-
]);
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Prefix for dynamic workspace-related env vars (provider-specific).
|
|
29
|
-
*/
|
|
30
|
-
export const DYNAMIC_WORKSPACE_ENV_PREFIX = 'CODEX_';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Pattern used when ranking provider-specific workspace env vars.
|
|
34
|
-
*/
|
|
35
|
-
export const WORKSPACE_ENV_KEY_PATTERN = /(WORKSPACE|PROJECT|ROOT|CWD|DIR)/i;
|
|
36
|
-
|
|
37
|
-
// ================================
|
|
38
|
-
// Chunking Constants
|
|
39
|
-
// ================================
|
|
1
|
+
/**
|
|
2
|
+
* Centralized constants for the heuristic-mcp project.
|
|
3
|
+
* Extracting magic numbers improves maintainability and documents design decisions.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// ================================
|
|
7
|
+
// Workspace Resolution Constants
|
|
8
|
+
// ================================
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Environment variables checked for workspace resolution, in precedence order.
|
|
12
|
+
*/
|
|
13
|
+
export const WORKSPACE_ENV_VARS = Object.freeze([
|
|
14
|
+
'HEURISTIC_MCP_WORKSPACE',
|
|
15
|
+
'MCP_WORKSPACE',
|
|
16
|
+
'CODEX_WORKSPACE',
|
|
17
|
+
'CODEX_PROJECT_ROOT',
|
|
18
|
+
'CODEX_CWD',
|
|
19
|
+
'WORKSPACE_FOLDER',
|
|
20
|
+
'WORKSPACE_ROOT',
|
|
21
|
+
'CURSOR_WORKSPACE',
|
|
22
|
+
'CLAUDE_WORKSPACE',
|
|
23
|
+
'ANTIGRAVITY_WORKSPACE',
|
|
24
|
+
'INIT_CWD',
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Prefix for dynamic workspace-related env vars (provider-specific).
|
|
29
|
+
*/
|
|
30
|
+
export const DYNAMIC_WORKSPACE_ENV_PREFIX = 'CODEX_';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Pattern used when ranking provider-specific workspace env vars.
|
|
34
|
+
*/
|
|
35
|
+
export const WORKSPACE_ENV_KEY_PATTERN = /(WORKSPACE|PROJECT|ROOT|CWD|DIR)/i;
|
|
36
|
+
|
|
37
|
+
// ================================
|
|
38
|
+
// Chunking Constants
|
|
39
|
+
// ================================
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Minimum text length for a chunk to be considered valid.
|
|
@@ -31,13 +31,13 @@ function getOrCreateChild(config) {
|
|
|
31
31
|
const args = ['--expose-gc', EMBEDDING_PROCESS_PATH];
|
|
32
32
|
persistentChild = spawn(process.execPath, args, {
|
|
33
33
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
34
|
-
env: {
|
|
35
|
-
...process.env,
|
|
36
|
-
EMBEDDING_PROCESS_PERSISTENT: 'true',
|
|
37
|
-
EMBEDDING_PROCESS_RUN_MAIN: 'true',
|
|
38
|
-
EMBEDDING_PROCESS_VERBOSE: config.verbose ? 'true' : '',
|
|
39
|
-
},
|
|
40
|
-
});
|
|
34
|
+
env: {
|
|
35
|
+
...process.env,
|
|
36
|
+
EMBEDDING_PROCESS_PERSISTENT: 'true',
|
|
37
|
+
EMBEDDING_PROCESS_RUN_MAIN: 'true',
|
|
38
|
+
EMBEDDING_PROCESS_VERBOSE: config.verbose ? 'true' : '',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
41
|
|
|
42
42
|
currentConfig = config;
|
|
43
43
|
|
package/lib/embedding-process.js
CHANGED
|
@@ -422,13 +422,13 @@ async function main() {
|
|
|
422
422
|
process.stdout.write(JSON.stringify(output));
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
function shouldRunMain() {
|
|
426
|
-
if (process.env.EMBEDDING_PROCESS_RUN_MAIN === 'true') return true;
|
|
427
|
-
if (process.env.VITEST) return false;
|
|
428
|
-
if (!process.argv[1]) return false;
|
|
429
|
-
const entryUrl = pathToFileURL(process.argv[1]).href;
|
|
430
|
-
return import.meta.url === entryUrl;
|
|
431
|
-
}
|
|
425
|
+
function shouldRunMain() {
|
|
426
|
+
if (process.env.EMBEDDING_PROCESS_RUN_MAIN === 'true') return true;
|
|
427
|
+
if (process.env.VITEST) return false;
|
|
428
|
+
if (!process.argv[1]) return false;
|
|
429
|
+
const entryUrl = pathToFileURL(process.argv[1]).href;
|
|
430
|
+
return import.meta.url === entryUrl;
|
|
431
|
+
}
|
|
432
432
|
|
|
433
433
|
if (shouldRunMain()) {
|
|
434
434
|
main().catch((err) => {
|