@dotdotgod/context 0.3.8 → 0.3.10
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/package.json +2 -2
- package/src/project.mjs +9 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotdotgod/context",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
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.3.
|
|
31
|
+
"@dotdotgod/cli": "0.3.10"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=22.5.0"
|
package/src/project.mjs
CHANGED
|
@@ -22,7 +22,7 @@ function markdownTree(root, maxDepth = 5) {
|
|
|
22
22
|
return output;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
async function
|
|
25
|
+
async function cliText(args, cwd) {
|
|
26
26
|
return await new Promise((resolvePromise, reject) => {
|
|
27
27
|
const child = spawn(process.execPath, [cli, ...args], { cwd, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
28
28
|
const stdout = [];
|
|
@@ -33,11 +33,16 @@ async function cliJson(args, cwd) {
|
|
|
33
33
|
child.once('close', (code) => {
|
|
34
34
|
const out = Buffer.concat(stdout).toString('utf8');
|
|
35
35
|
if (code !== 0) return reject(new Error(Buffer.concat(stderr).toString('utf8') || out || `dotdotgod exited ${code}`));
|
|
36
|
-
|
|
36
|
+
resolvePromise(out);
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
async function cliJson(args, cwd) {
|
|
42
|
+
const out = await cliText(args, cwd);
|
|
43
|
+
try { return JSON.parse(out); } catch { throw new Error(`Expected JSON from dotdotgod: ${out.slice(0, 500)}`); }
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
export async function projectLoad(input) {
|
|
42
47
|
const root = resolve(input.root || process.cwd());
|
|
43
48
|
const focus = input.focus?.trim() ?? '';
|
|
@@ -82,8 +87,8 @@ export async function projectImpact(input) {
|
|
|
82
87
|
if (paths.length > 20) throw new Error('paths is limited to 20 entries per call');
|
|
83
88
|
const args = ['graph', 'impact', root];
|
|
84
89
|
for (const path of paths) args.push('--changed', path);
|
|
85
|
-
args.push('--
|
|
86
|
-
return await
|
|
90
|
+
args.push('--compact');
|
|
91
|
+
return { ok: true, summary: (await cliText(args, root)).trim() };
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
export async function projectInitialize(input) {
|