@dotdotgod/context 0.6.0 → 0.6.2

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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/project.mjs +12 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotdotgod/context",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Local-first MCP execution, indexing, and retrieval runtime for dotdotgod adapters.",
5
5
  "type": "module",
6
6
  "license": "Elastic-2.0",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@modelcontextprotocol/sdk": "^1.25.2",
30
30
  "zod": "^3.25.76",
31
- "@dotdotgod/cli": "0.6.0"
31
+ "@dotdotgod/cli": "0.6.2"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=22.5.0"
package/src/project.mjs CHANGED
@@ -43,28 +43,34 @@ async function cliJson(args, cwd) {
43
43
  try { return JSON.parse(out); } catch { throw new Error(`Expected JSON from dotdotgod: ${out.slice(0, 500)}`); }
44
44
  }
45
45
 
46
+ function embeddingRuntimeRecovery() {
47
+ return {
48
+ code: 'EMBEDDING_RUNTIME_MISSING',
49
+ message: 'Semantic vectors need an optional runtime; continue with keyword/map retrieval or ask before installation.',
50
+ recovery: { kind: 'embedding-runtime-install', requiresConfirmation: true, statusTool: 'dotdotgod_embedding_status', installTool: 'dotdotgod_embedding_install', cliCommand: 'dotdotgod embedding install --confirm' },
51
+ };
52
+ }
53
+
46
54
  export async function projectLoad(input) {
47
55
  const root = resolve(input.root || process.cwd());
48
56
  const focus = input.focus?.trim() ?? '';
49
57
  const tree = markdownTree(root, input.maxDepth ?? (focus ? 3 : 5));
50
58
  let query = null;
51
59
  let queryUnavailable;
60
+ let vectorUnavailable;
52
61
  if (focus) {
53
62
  try {
54
63
  query = await cliJson(['query', root, focus, '--limit', String(Math.min(input.limit ?? 30, 30)), '--json'], root);
64
+ if (query.warnings?.some((warning) => warning.includes('Optional local embedding runtime is not installed'))) vectorUnavailable = embeddingRuntimeRecovery();
55
65
  } catch (error) {
56
66
  const missingRuntime = String(error?.message ?? error).includes('Optional local embedding runtime is not installed');
57
- queryUnavailable = missingRuntime ? {
58
- code: 'EMBEDDING_RUNTIME_MISSING',
59
- message: 'Local semantic search requires an optional embedding runtime; continue with the documentation map or ask the user before installation.',
60
- recovery: { kind: 'embedding-runtime-install', requiresConfirmation: true, statusTool: 'dotdotgod_embedding_status', installTool: 'dotdotgod_embedding_install', cliCommand: 'dotdotgod embedding install --confirm' },
61
- } : {
67
+ queryUnavailable = missingRuntime ? embeddingRuntimeRecovery() : {
62
68
  code: 'QUERY_UNAVAILABLE',
63
69
  message: 'Semantic project query is unavailable; continue with the documentation map and targeted reads.',
64
70
  };
65
71
  }
66
72
  }
67
- return { ok: true, root, focus, documentationTree: tree, query, ...(queryUnavailable ? { queryUnavailable } : {}) };
73
+ return { ok: true, root, focus, documentationTree: tree, query, ...(queryUnavailable ? { queryUnavailable } : {}), ...(vectorUnavailable ? { vectorUnavailable } : {}) };
68
74
  }
69
75
 
70
76
  export async function projectEmbeddingStatus(input = {}) {