@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.
Files changed (49) hide show
  1. package/README.md +104 -104
  2. package/config.jsonc +173 -173
  3. package/features/ann-config.js +131 -0
  4. package/features/clear-cache.js +84 -0
  5. package/features/find-similar-code.js +291 -0
  6. package/features/hybrid-search.js +544 -0
  7. package/features/index-codebase.js +3268 -0
  8. package/features/lifecycle.js +1189 -0
  9. package/features/package-version.js +302 -0
  10. package/features/register.js +408 -0
  11. package/features/resources.js +156 -0
  12. package/features/set-workspace.js +265 -0
  13. package/index.js +96 -96
  14. package/lib/cache-ops.js +22 -22
  15. package/lib/cache-utils.js +565 -565
  16. package/lib/cache.js +1870 -1870
  17. package/lib/call-graph.js +396 -396
  18. package/lib/cli.js +1 -1
  19. package/lib/config.js +517 -517
  20. package/lib/constants.js +39 -39
  21. package/lib/embed-query-process.js +7 -7
  22. package/lib/embedding-process.js +7 -7
  23. package/lib/embedding-worker.js +299 -299
  24. package/lib/ignore-patterns.js +316 -316
  25. package/lib/json-worker.js +14 -14
  26. package/lib/json-writer.js +337 -337
  27. package/lib/logging.js +164 -164
  28. package/lib/memory-logger.js +13 -13
  29. package/lib/onnx-backend.js +193 -193
  30. package/lib/project-detector.js +84 -84
  31. package/lib/server-lifecycle.js +165 -165
  32. package/lib/settings-editor.js +754 -754
  33. package/lib/tokenizer.js +256 -256
  34. package/lib/utils.js +428 -428
  35. package/lib/vector-store-binary.js +627 -627
  36. package/lib/vector-store-sqlite.js +95 -95
  37. package/lib/workspace-env.js +28 -28
  38. package/mcp_config.json +9 -9
  39. package/package.json +86 -75
  40. package/scripts/clear-cache.js +20 -0
  41. package/scripts/download-model.js +43 -0
  42. package/scripts/mcp-launcher.js +49 -0
  43. package/scripts/postinstall.js +12 -0
  44. package/search-configs.js +36 -36
  45. package/.prettierrc +0 -7
  46. package/debug-pids.js +0 -30
  47. package/eslint.config.js +0 -36
  48. package/specs/plan.md +0 -23
  49. 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
 
@@ -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) => {