@sdsrs/code-graph 0.11.6 → 0.12.1
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.
|
@@ -13,6 +13,12 @@ const INDEX_LINE = [
|
|
|
13
13
|
'- [code-graph-mcp](plugin_code_graph_mcp.md) — v0.10.0 起 tools/list 默认 7 核心 + 5 隐藏可调(省启动 token)',
|
|
14
14
|
' - 核心 7(默认暴露):`get_call_graph`/`module_overview`/`semantic_code_search`/`ast_search`/`find_references`/`get_ast_node`/`project_map`',
|
|
15
15
|
' - 进阶 5(隐藏按名可调):`impact_analysis`/`trace_http_chain`/`dependency_graph`/`find_similar_code`/`find_dead_code`',
|
|
16
|
+
' - 场景速查(优先于 Grep):',
|
|
17
|
+
' - 改 X 影响面 → `get_ast_node symbol=X include_impact=true`(或 CLI `code-graph-mcp impact X`)',
|
|
18
|
+
' - 谁调用 X / X 被谁用 → `get_call_graph X` 或 `find_references X`',
|
|
19
|
+
' - 看 X 源码 / 签名 → `get_ast_node symbol=X`',
|
|
20
|
+
' - Y 模块长啥样 → `module_overview` 或 CLI `code-graph-mcp overview Y/`',
|
|
21
|
+
' - 概念查询(不知精确名)→ `semantic_code_search "Z"`;字面匹配用 Grep',
|
|
16
22
|
].join('\n');
|
|
17
23
|
const TEMPLATE_PATH = path.resolve(__dirname, '..', 'templates', 'plugin_code_graph_mcp.md');
|
|
18
24
|
const TARGET_NAME = 'plugin_code_graph_mcp.md';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
const { spawnSync } = require('child_process');
|
|
8
|
+
|
|
9
|
+
const { findBinary } = require('./find-binary');
|
|
10
|
+
|
|
11
|
+
test('incremental-index bails silently when cwd is not a git repo', (t) => {
|
|
12
|
+
const bin = findBinary();
|
|
13
|
+
if (!bin) {
|
|
14
|
+
// Binary not built — skip rather than fail; matches session-init.test.js convention.
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const tmpRoot = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'code-graph-no-git-')));
|
|
18
|
+
t.after(() => fs.rmSync(tmpRoot, { recursive: true, force: true }));
|
|
19
|
+
|
|
20
|
+
const result = spawnSync(bin, ['incremental-index', '--quiet'], {
|
|
21
|
+
cwd: tmpRoot,
|
|
22
|
+
timeout: 8000,
|
|
23
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
24
|
+
});
|
|
25
|
+
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
|
26
|
+
assert.equal(
|
|
27
|
+
fs.existsSync(path.join(tmpRoot, '.code-graph')),
|
|
28
|
+
false,
|
|
29
|
+
'.code-graph must not be created outside a git repo',
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('incremental-index runs inside a minimal git repo without creating stray state', (t) => {
|
|
34
|
+
const bin = findBinary();
|
|
35
|
+
if (!bin) return;
|
|
36
|
+
const tmpRoot = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'code-graph-git-')));
|
|
37
|
+
t.after(() => fs.rmSync(tmpRoot, { recursive: true, force: true }));
|
|
38
|
+
|
|
39
|
+
fs.mkdirSync(path.join(tmpRoot, '.git'));
|
|
40
|
+
const result = spawnSync(bin, ['incremental-index', '--quiet'], {
|
|
41
|
+
cwd: tmpRoot,
|
|
42
|
+
timeout: 8000,
|
|
43
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
44
|
+
});
|
|
45
|
+
assert.equal(result.status, 0, `expected exit 0, got ${result.status}; stderr: ${result.stderr}`);
|
|
46
|
+
// Index may or may not materialize for an empty repo; the contract is that the guard does NOT block this case.
|
|
47
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdsrs/code-graph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "MCP server that indexes codebases into an AST knowledge graph with semantic search, call graph traversal, and HTTP route tracing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"node": ">=16"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@sdsrs/code-graph-linux-x64": "0.
|
|
38
|
-
"@sdsrs/code-graph-linux-arm64": "0.
|
|
39
|
-
"@sdsrs/code-graph-darwin-x64": "0.
|
|
40
|
-
"@sdsrs/code-graph-darwin-arm64": "0.
|
|
41
|
-
"@sdsrs/code-graph-win32-x64": "0.
|
|
37
|
+
"@sdsrs/code-graph-linux-x64": "0.12.1",
|
|
38
|
+
"@sdsrs/code-graph-linux-arm64": "0.12.1",
|
|
39
|
+
"@sdsrs/code-graph-darwin-x64": "0.12.1",
|
|
40
|
+
"@sdsrs/code-graph-darwin-arm64": "0.12.1",
|
|
41
|
+
"@sdsrs/code-graph-win32-x64": "0.12.1"
|
|
42
42
|
}
|
|
43
43
|
}
|