@sdsrs/code-graph 0.5.6 → 0.5.7
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/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/hooks/hooks.json +3 -3
- package/claude-plugin/scripts/pre-explore-guide.js +6 -7
- package/claude-plugin/scripts/pre-glob-guide.js +23 -0
- package/claude-plugin/scripts/pre-search-guide.js +9 -10
- package/package.json +6 -6
- package/claude-plugin/scripts/pre-read-guide.js +0 -24
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"description": "Suggest code-graph alternatives on first Grep call"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
"matcher": "tool == \"
|
|
16
|
+
"matcher": "tool == \"Glob\"",
|
|
17
17
|
"hooks": [
|
|
18
18
|
{
|
|
19
19
|
"type": "command",
|
|
20
|
-
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/pre-
|
|
20
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/pre-glob-guide.js\"",
|
|
21
21
|
"timeout": 2
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"description": "Suggest code-graph alternatives on first
|
|
24
|
+
"description": "Suggest code-graph alternatives on first Glob call"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"matcher": "tool == \"Agent\"",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
// PreToolUse hook: On FIRST Agent
|
|
4
|
-
//
|
|
3
|
+
// PreToolUse hook: On FIRST Agent call per session window, suggest
|
|
4
|
+
// code-graph tools for structural code understanding before spawning agents.
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const os = require('os');
|
|
@@ -16,10 +16,9 @@ try {
|
|
|
16
16
|
|
|
17
17
|
fs.writeFileSync(flag, '');
|
|
18
18
|
process.stdout.write(
|
|
19
|
-
'[code-graph]
|
|
20
|
-
' project_map → full architecture overview
|
|
19
|
+
'[code-graph] For code structure understanding, try code-graph first (one call vs many):\n' +
|
|
20
|
+
' project_map → full architecture overview\n' +
|
|
21
21
|
' module_overview(path) → module structure, exports, hot paths\n' +
|
|
22
|
-
' get_call_graph(symbol) → trace call chains
|
|
23
|
-
'
|
|
24
|
-
'Explore agents cost many tool calls; code-graph returns structured results in one.\n'
|
|
22
|
+
' get_call_graph(symbol) → trace call chains\n' +
|
|
23
|
+
'Explore agents remain best for: non-code files, runtime behavior, open-ended investigation.\n'
|
|
25
24
|
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
// PreToolUse hook: On FIRST Glob call per session window, suggest
|
|
4
|
+
// code-graph tools when exploring project structure (not finding specific files).
|
|
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-glob-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 exploring project structure (not finding specific files):\n' +
|
|
20
|
+
' project_map → all modules, their files, key symbols, and dependencies\n' +
|
|
21
|
+
' module_overview(path) → files and exports within a module\n' +
|
|
22
|
+
'Glob remains best for: finding specific files, configs, non-code assets.\n'
|
|
23
|
+
);
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
// PreToolUse hook: On FIRST Grep call per session window,
|
|
4
|
-
//
|
|
3
|
+
// PreToolUse hook: On FIRST Grep call per session window, suggest
|
|
4
|
+
// code-graph tools as complementary options for code understanding.
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
const os = require('os');
|
|
8
8
|
|
|
9
9
|
const flag = path.join(os.tmpdir(), '.code-graph-search-guided');
|
|
10
|
-
const WINDOW_MS = 2 * 60 * 60 * 1000; // 2 hours
|
|
10
|
+
const WINDOW_MS = 2 * 60 * 60 * 1000; // 2 hours
|
|
11
11
|
|
|
12
12
|
try {
|
|
13
13
|
const stat = fs.statSync(flag);
|
|
14
14
|
if (Date.now() - stat.mtimeMs < WINDOW_MS) process.exit(0);
|
|
15
|
-
} catch { /*
|
|
15
|
+
} catch { /* first time */ }
|
|
16
16
|
|
|
17
17
|
fs.writeFileSync(flag, '');
|
|
18
18
|
process.stdout.write(
|
|
19
|
-
'[code-graph] For code
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'Use Grep only for exact strings, constants, or regex patterns.\n'
|
|
19
|
+
'[code-graph] For understanding code relationships, these tools complement Grep:\n' +
|
|
20
|
+
' get_call_graph(symbol) → who calls X / what X calls (vs Grep + Read ×N)\n' +
|
|
21
|
+
' module_overview(path) → module exports, structure, hot paths\n' +
|
|
22
|
+
' semantic_code_search(query) → find code by concept across indexed files\n' +
|
|
23
|
+
'Grep remains best for: exact strings, regex, constants, non-code files.\n'
|
|
25
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.7",
|
|
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.7",
|
|
37
|
+
"@sdsrs/code-graph-linux-arm64": "0.5.7",
|
|
38
|
+
"@sdsrs/code-graph-darwin-x64": "0.5.7",
|
|
39
|
+
"@sdsrs/code-graph-darwin-arm64": "0.5.7",
|
|
40
|
+
"@sdsrs/code-graph-win32-x64": "0.5.7"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
);
|