@sdsrs/code-graph 0.5.5 → 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.
@@ -4,6 +4,6 @@
4
4
  "author": {
5
5
  "name": "sdsrs"
6
6
  },
7
- "version": "0.5.5",
7
+ "version": "0.5.7",
8
8
  "keywords": ["code-graph", "ast", "navigation", "mcp", "knowledge-graph"]
9
9
  }
@@ -12,6 +12,28 @@
12
12
  ],
13
13
  "description": "Suggest code-graph alternatives on first Grep call"
14
14
  },
15
+ {
16
+ "matcher": "tool == \"Glob\"",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/pre-glob-guide.js\"",
21
+ "timeout": 2
22
+ }
23
+ ],
24
+ "description": "Suggest code-graph alternatives on first Glob 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,24 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ // PreToolUse hook: On FIRST Agent call per session window, suggest
4
+ // code-graph tools for structural code understanding before spawning agents.
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] For code structure understanding, try code-graph first (one call vs many):\n' +
20
+ ' project_map → full architecture overview\n' +
21
+ ' module_overview(path) → module structure, exports, hot paths\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'
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, remind Claude
4
- // about code-graph alternatives. Runs fast (<10ms) and only outputs once.
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 (approximate session window)
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 { /* flag doesn't exist — first time */ }
15
+ } catch { /* first time */ }
16
16
 
17
17
  fs.writeFileSync(flag, '');
18
18
  process.stdout.write(
19
- '[code-graph] For code understanding, prefer code-graph tools over Grep:\n' +
20
- ' project_mapfull project architecture overview (call FIRST)\n' +
21
- ' semantic_code_searchfind code by concept (10x fewer tokens)\n' +
22
- ' get_call_graphwho calls X / what X calls (13x fewer tokens)\n' +
23
- ' module_overview understand a module (20x fewer tokens)\n' +
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.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.5",
37
- "@sdsrs/code-graph-linux-arm64": "0.5.5",
38
- "@sdsrs/code-graph-darwin-x64": "0.5.5",
39
- "@sdsrs/code-graph-darwin-arm64": "0.5.5",
40
- "@sdsrs/code-graph-win32-x64": "0.5.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
  }