@sdsrs/code-graph 0.5.4 → 0.5.6
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.
|
@@ -12,6 +12,28 @@
|
|
|
12
12
|
],
|
|
13
13
|
"description": "Suggest code-graph alternatives on first Grep call"
|
|
14
14
|
},
|
|
15
|
+
{
|
|
16
|
+
"matcher": "tool == \"Read\"",
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/pre-read-guide.js\"",
|
|
21
|
+
"timeout": 2
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"description": "Suggest code-graph alternatives on first Read call"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"matcher": "tool == \"Agent\"",
|
|
28
|
+
"hooks": [
|
|
29
|
+
{
|
|
30
|
+
"type": "command",
|
|
31
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/pre-explore-guide.js\"",
|
|
32
|
+
"timeout": 2
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"description": "Suggest code-graph tools before spawning Explore agents"
|
|
36
|
+
},
|
|
15
37
|
{
|
|
16
38
|
"matcher": "tool == \"Edit\" || tool == \"Write\"",
|
|
17
39
|
"hooks": [
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
// PreToolUse hook: On FIRST Agent(Explore) call per session window, remind Claude
|
|
4
|
+
// that code-graph tools provide faster, structured codebase exploration.
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
const flag = path.join(os.tmpdir(), '.code-graph-explore-guided');
|
|
10
|
+
const WINDOW_MS = 2 * 60 * 60 * 1000; // 2 hours
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const stat = fs.statSync(flag);
|
|
14
|
+
if (Date.now() - stat.mtimeMs < WINDOW_MS) process.exit(0);
|
|
15
|
+
} catch { /* first time */ }
|
|
16
|
+
|
|
17
|
+
fs.writeFileSync(flag, '');
|
|
18
|
+
process.stdout.write(
|
|
19
|
+
'[code-graph] Before spawning an Explore agent, try code-graph tools first:\n' +
|
|
20
|
+
' project_map → full architecture overview in one call\n' +
|
|
21
|
+
' module_overview(path) → module structure, exports, hot paths\n' +
|
|
22
|
+
' get_call_graph(symbol) → trace call chains instantly\n' +
|
|
23
|
+
' dependency_graph(file) → file-level import/export map\n' +
|
|
24
|
+
'Explore agents cost many tool calls; code-graph returns structured results in one.\n'
|
|
25
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
// PreToolUse hook: On FIRST Read call per session window, remind Claude
|
|
4
|
+
// that code-graph tools are more token-efficient for understanding code.
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
const flag = path.join(os.tmpdir(), '.code-graph-read-guided');
|
|
10
|
+
const WINDOW_MS = 2 * 60 * 60 * 1000; // 2 hours
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const stat = fs.statSync(flag);
|
|
14
|
+
if (Date.now() - stat.mtimeMs < WINDOW_MS) process.exit(0);
|
|
15
|
+
} catch { /* first time */ }
|
|
16
|
+
|
|
17
|
+
fs.writeFileSync(flag, '');
|
|
18
|
+
process.stdout.write(
|
|
19
|
+
'[code-graph] If reading to understand code (not to edit), prefer code-graph tools:\n' +
|
|
20
|
+
' module_overview(path) → understand a module\'s exports and structure\n' +
|
|
21
|
+
' get_ast_node(file_path, symbol_name) → one function\'s code + callers/callees\n' +
|
|
22
|
+
' semantic_code_search(query) → find code by concept\n' +
|
|
23
|
+
'Use Read only for files you intend to edit.\n'
|
|
24
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdsrs/code-graph",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
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": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"node": ">=16"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@sdsrs/code-graph-linux-x64": "0.5.
|
|
37
|
-
"@sdsrs/code-graph-linux-arm64": "0.5.
|
|
38
|
-
"@sdsrs/code-graph-darwin-x64": "0.5.
|
|
39
|
-
"@sdsrs/code-graph-darwin-arm64": "0.5.
|
|
40
|
-
"@sdsrs/code-graph-win32-x64": "0.5.
|
|
36
|
+
"@sdsrs/code-graph-linux-x64": "0.5.6",
|
|
37
|
+
"@sdsrs/code-graph-linux-arm64": "0.5.6",
|
|
38
|
+
"@sdsrs/code-graph-darwin-x64": "0.5.6",
|
|
39
|
+
"@sdsrs/code-graph-darwin-arm64": "0.5.6",
|
|
40
|
+
"@sdsrs/code-graph-win32-x64": "0.5.6"
|
|
41
41
|
}
|
|
42
42
|
}
|