contextsliver 0.1.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.
Files changed (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +130 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +156 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/graph/rank.d.ts +9 -0
  8. package/dist/graph/rank.d.ts.map +1 -0
  9. package/dist/graph/rank.js +10 -0
  10. package/dist/graph/rank.js.map +1 -0
  11. package/dist/graph/schema.d.ts +4 -0
  12. package/dist/graph/schema.d.ts.map +1 -0
  13. package/dist/graph/schema.js +74 -0
  14. package/dist/graph/schema.js.map +1 -0
  15. package/dist/graph/store.d.ts +56 -0
  16. package/dist/graph/store.d.ts.map +1 -0
  17. package/dist/graph/store.js +163 -0
  18. package/dist/graph/store.js.map +1 -0
  19. package/dist/graph/traverse.d.ts +20 -0
  20. package/dist/graph/traverse.d.ts.map +1 -0
  21. package/dist/graph/traverse.js +81 -0
  22. package/dist/graph/traverse.js.map +1 -0
  23. package/dist/graph/types.d.ts +48 -0
  24. package/dist/graph/types.d.ts.map +1 -0
  25. package/dist/graph/types.js +4 -0
  26. package/dist/graph/types.js.map +1 -0
  27. package/dist/index.d.ts +13 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +16 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/mcp/responses.d.ts +19 -0
  32. package/dist/mcp/responses.d.ts.map +1 -0
  33. package/dist/mcp/responses.js +25 -0
  34. package/dist/mcp/responses.js.map +1 -0
  35. package/dist/mcp/server.d.ts +16 -0
  36. package/dist/mcp/server.d.ts.map +1 -0
  37. package/dist/mcp/server.js +88 -0
  38. package/dist/mcp/server.js.map +1 -0
  39. package/dist/mcp/tools/cs_blast_radius.d.ts +3 -0
  40. package/dist/mcp/tools/cs_blast_radius.d.ts.map +1 -0
  41. package/dist/mcp/tools/cs_blast_radius.js +96 -0
  42. package/dist/mcp/tools/cs_blast_radius.js.map +1 -0
  43. package/dist/mcp/tools/cs_get_context.d.ts +3 -0
  44. package/dist/mcp/tools/cs_get_context.d.ts.map +1 -0
  45. package/dist/mcp/tools/cs_get_context.js +80 -0
  46. package/dist/mcp/tools/cs_get_context.js.map +1 -0
  47. package/dist/mcp/tools/cs_index_repo.d.ts +3 -0
  48. package/dist/mcp/tools/cs_index_repo.d.ts.map +1 -0
  49. package/dist/mcp/tools/cs_index_repo.js +45 -0
  50. package/dist/mcp/tools/cs_index_repo.js.map +1 -0
  51. package/dist/mcp/tools/cs_index_status.d.ts +3 -0
  52. package/dist/mcp/tools/cs_index_status.d.ts.map +1 -0
  53. package/dist/mcp/tools/cs_index_status.js +31 -0
  54. package/dist/mcp/tools/cs_index_status.js.map +1 -0
  55. package/dist/mcp/tools/cs_search_symbols.d.ts +3 -0
  56. package/dist/mcp/tools/cs_search_symbols.d.ts.map +1 -0
  57. package/dist/mcp/tools/cs_search_symbols.js +51 -0
  58. package/dist/mcp/tools/cs_search_symbols.js.map +1 -0
  59. package/dist/mcp/tools/index.d.ts +4 -0
  60. package/dist/mcp/tools/index.d.ts.map +1 -0
  61. package/dist/mcp/tools/index.js +14 -0
  62. package/dist/mcp/tools/index.js.map +1 -0
  63. package/dist/mcp/types.d.ts +22 -0
  64. package/dist/mcp/types.d.ts.map +1 -0
  65. package/dist/mcp/types.js +2 -0
  66. package/dist/mcp/types.js.map +1 -0
  67. package/dist/parser/extractor.d.ts +16 -0
  68. package/dist/parser/extractor.d.ts.map +1 -0
  69. package/dist/parser/extractor.js +304 -0
  70. package/dist/parser/extractor.js.map +1 -0
  71. package/dist/parser/index.d.ts +30 -0
  72. package/dist/parser/index.d.ts.map +1 -0
  73. package/dist/parser/index.js +270 -0
  74. package/dist/parser/index.js.map +1 -0
  75. package/dist/parser/languages/python.d.ts +3 -0
  76. package/dist/parser/languages/python.d.ts.map +1 -0
  77. package/dist/parser/languages/python.js +14 -0
  78. package/dist/parser/languages/python.js.map +1 -0
  79. package/dist/parser/languages/query-loader.d.ts +10 -0
  80. package/dist/parser/languages/query-loader.d.ts.map +1 -0
  81. package/dist/parser/languages/query-loader.js +33 -0
  82. package/dist/parser/languages/query-loader.js.map +1 -0
  83. package/dist/parser/languages/registry.d.ts +25 -0
  84. package/dist/parser/languages/registry.d.ts.map +1 -0
  85. package/dist/parser/languages/registry.js +33 -0
  86. package/dist/parser/languages/registry.js.map +1 -0
  87. package/dist/parser/languages/typescript.d.ts +11 -0
  88. package/dist/parser/languages/typescript.d.ts.map +1 -0
  89. package/dist/parser/languages/typescript.js +26 -0
  90. package/dist/parser/languages/typescript.js.map +1 -0
  91. package/dist/parser/types.d.ts +36 -0
  92. package/dist/parser/types.d.ts.map +1 -0
  93. package/dist/parser/types.js +2 -0
  94. package/dist/parser/types.js.map +1 -0
  95. package/dist/session/manager.d.ts +28 -0
  96. package/dist/session/manager.d.ts.map +1 -0
  97. package/dist/session/manager.js +82 -0
  98. package/dist/session/manager.js.map +1 -0
  99. package/dist/session/pruner.d.ts +28 -0
  100. package/dist/session/pruner.d.ts.map +1 -0
  101. package/dist/session/pruner.js +24 -0
  102. package/dist/session/pruner.js.map +1 -0
  103. package/dist/session/types.d.ts +21 -0
  104. package/dist/session/types.d.ts.map +1 -0
  105. package/dist/session/types.js +4 -0
  106. package/dist/session/types.js.map +1 -0
  107. package/dist/utils/logger.d.ts +13 -0
  108. package/dist/utils/logger.d.ts.map +1 -0
  109. package/dist/utils/logger.js +36 -0
  110. package/dist/utils/logger.js.map +1 -0
  111. package/dist/utils/paths.d.ts +24 -0
  112. package/dist/utils/paths.d.ts.map +1 -0
  113. package/dist/utils/paths.js +55 -0
  114. package/dist/utils/paths.js.map +1 -0
  115. package/dist/utils/tokens.d.ts +10 -0
  116. package/dist/utils/tokens.d.ts.map +1 -0
  117. package/dist/utils/tokens.js +28 -0
  118. package/dist/utils/tokens.js.map +1 -0
  119. package/dist/watcher/hasher.d.ts +11 -0
  120. package/dist/watcher/hasher.d.ts.map +1 -0
  121. package/dist/watcher/hasher.js +29 -0
  122. package/dist/watcher/hasher.js.map +1 -0
  123. package/dist/watcher/index.d.ts +9 -0
  124. package/dist/watcher/index.d.ts.map +1 -0
  125. package/dist/watcher/index.js +100 -0
  126. package/dist/watcher/index.js.map +1 -0
  127. package/grammars/python/tags.scm +16 -0
  128. package/grammars/typescript/tags.scm +39 -0
  129. package/hooks/pre-tool-use.js +46 -0
  130. package/package.json +89 -0
  131. package/templates/CLAUDE.md +50 -0
  132. package/templates/mcp-config-claude-code.json +9 -0
  133. package/templates/mcp-config-cline.json +15 -0
  134. package/templates/mcp-config-cursor.json +9 -0
@@ -0,0 +1,96 @@
1
+ // cs_blast_radius — the flagship tool.
2
+ //
3
+ // Returns all callers (who uses this symbol) and all dependencies (what it uses) up to
4
+ // max_depth hops. If a session_id is given, already-seen symbols are excluded and listed in
5
+ // already_in_context, so the agent doesn't pay for context it already has. This is the core
6
+ // differentiator vs grep/cat — see contextsliver-spec.md §8.
7
+ import { z } from 'zod';
8
+ import { blastRadius } from '../../graph/traverse.js';
9
+ import { pruneBySession, symbolsToMark } from '../../session/pruner.js';
10
+ import { log } from '../../utils/logger.js';
11
+ import { textResponse } from '../responses.js';
12
+ export const csBlastRadiusTool = {
13
+ register(server, ctx) {
14
+ server.registerTool('cs_blast_radius', {
15
+ description: [
16
+ 'Returns all callers (who uses this symbol) and all dependencies (what this symbol uses)',
17
+ 'up to max_depth hops. Use this BEFORE reading any file to understand code connections.',
18
+ 'Much cheaper than cat or grep on entire files.',
19
+ 'If session_id is provided, already-seen symbols are excluded from the response',
20
+ 'and listed in already_in_context. Pass the same session_id to every call this session.',
21
+ ].join(' '),
22
+ inputSchema: {
23
+ symbol_name: z
24
+ .string()
25
+ .describe('Exact name of the function/class to analyze'),
26
+ session_id: z
27
+ .string()
28
+ .optional()
29
+ .describe('Session ID for deduplication. Get it from the first cs_get_context call.'),
30
+ max_depth: z
31
+ .number()
32
+ .int()
33
+ .min(1)
34
+ .max(4)
35
+ .default(2)
36
+ .describe('How many hops to traverse (default 2, max 4)'),
37
+ },
38
+ }, async (args) => {
39
+ const { symbol_name, session_id, max_depth } = args;
40
+ log(`cs_blast_radius symbol="${symbol_name}" depth=${max_depth}`);
41
+ const symbolRow = ctx.store.findSymbolByName(symbol_name);
42
+ if (!symbolRow) {
43
+ return textResponse({
44
+ error: `Symbol '${symbol_name}' not found in index.`,
45
+ hint: 'Try cs_search_symbols to find the correct name, or run cs_index_repo to re-index.',
46
+ }, { annotateTokens: false });
47
+ }
48
+ const result = blastRadius(ctx.store.raw, symbolRow.id, max_depth);
49
+ if (!result) {
50
+ return textResponse({ error: 'Traversal failed' });
51
+ }
52
+ let callers = result.callers;
53
+ let dependencies = result.dependencies;
54
+ let skipped = [];
55
+ if (session_id && ctx.sessionManager.sessionExists(session_id)) {
56
+ const pruned = pruneBySession(ctx.sessionManager, session_id, {
57
+ symbol: result.symbol,
58
+ callers,
59
+ dependencies,
60
+ });
61
+ callers = pruned.callers;
62
+ dependencies = pruned.dependencies;
63
+ skipped = pruned.skipped;
64
+ // Mark as sent only after we've built the response successfully.
65
+ ctx.sessionManager.markAsSent(session_id, symbolsToMark(pruned));
66
+ }
67
+ else if (session_id) {
68
+ // Caller passed a session_id that doesn't exist — create it lazily so the agent
69
+ // can start a session from any tool, not just cs_get_context.
70
+ // (We don't mark anything until next call, to keep semantics simple here.)
71
+ log(`Unknown session_id; creating session ${session_id}`, 'warn');
72
+ }
73
+ const response = {
74
+ symbol: result.symbol.name,
75
+ file: result.symbol.file_path,
76
+ kind: result.symbol.kind,
77
+ signature: result.symbol.signature,
78
+ callers: callers.map((s) => ({
79
+ name: s.name,
80
+ file: s.file_path,
81
+ kind: s.kind,
82
+ })),
83
+ dependencies: dependencies.map((s) => ({
84
+ name: s.name,
85
+ file: s.file_path,
86
+ kind: s.kind,
87
+ })),
88
+ depth_searched: max_depth,
89
+ };
90
+ if (skipped.length > 0)
91
+ response.already_in_context = skipped;
92
+ return textResponse(response);
93
+ });
94
+ },
95
+ };
96
+ //# sourceMappingURL=cs_blast_radius.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_blast_radius.js","sourceRoot":"","sources":["../../../src/mcp/tools/cs_blast_radius.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,uFAAuF;AACvF,4FAA4F;AAC5F,4FAA4F;AAC5F,6DAA6D;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC3C,QAAQ,CAAC,MAAiB,EAAE,GAAgB;QAC1C,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;YACE,WAAW,EAAE;gBACX,yFAAyF;gBACzF,wFAAwF;gBACxF,gDAAgD;gBAChD,gFAAgF;gBAChF,wFAAwF;aACzF,CAAC,IAAI,CAAC,GAAG,CAAC;YACX,WAAW,EAAE;gBACX,WAAW,EAAE,CAAC;qBACX,MAAM,EAAE;qBACR,QAAQ,CAAC,6CAA6C,CAAC;gBAC1D,UAAU,EAAE,CAAC;qBACV,MAAM,EAAE;qBACR,QAAQ,EAAE;qBACV,QAAQ,CAAC,0EAA0E,CAAC;gBACvF,SAAS,EAAE,CAAC;qBACT,MAAM,EAAE;qBACR,GAAG,EAAE;qBACL,GAAG,CAAC,CAAC,CAAC;qBACN,GAAG,CAAC,CAAC,CAAC;qBACN,OAAO,CAAC,CAAC,CAAC;qBACV,QAAQ,CAAC,8CAA8C,CAAC;aAC5D;SACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;YACb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AAC,CAAC,CAAC;YACnE,CAAC;iBAAM,IAAI,UAAU,EAAE,CAAC;gBACtB,gFAAgF;gBAChF,8DAA8D;gBAC9D,2EAA2E;gBAC3E,GAAG,CAAC,wCAAwC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC;YACpE,CAAC;YAED,MAAM,QAAQ,GAA4B;gBACxC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;gBAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS;gBAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;gBACxB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS;gBAClC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC3B,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,IAAI,EAAE,CAAC,CAAC,SAAS;oBACjB,IAAI,EAAE,CAAC,CAAC,IAAI;iBACb,CAAC,CAAC;gBACH,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBACrC,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,IAAI,EAAE,CAAC,CAAC,SAAS;oBACjB,IAAI,EAAE,CAAC,CAAC,IAAI;iBACb,CAAC,CAAC;gBACH,cAAc,EAAE,SAAS;aAC1B,CAAC;YACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;gBAAE,QAAQ,CAAC,kBAAkB,GAAG,OAAO,CAAC;YAE9D,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolModule } from '../types.js';
2
+ export declare const csGetContextTool: ToolModule;
3
+ //# sourceMappingURL=cs_get_context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_get_context.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cs_get_context.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,gBAAgB,EAAE,UA8E9B,CAAC"}
@@ -0,0 +1,80 @@
1
+ // cs_get_context — lightweight "what is this symbol + its immediate neighbors" tool.
2
+ //
3
+ // Cheaper than cs_blast_radius: only 1-hop callers + dependencies, plus the symbol's own
4
+ // definition. This is also the canonical place to START a session — the response includes a
5
+ // session_id (creating one if not provided) that the agent should pass to subsequent calls.
6
+ import { z } from 'zod';
7
+ import { directNeighbors } from '../../graph/traverse.js';
8
+ import { pruneBySession, symbolsToMark } from '../../session/pruner.js';
9
+ import { log } from '../../utils/logger.js';
10
+ import { textResponse } from '../responses.js';
11
+ export const csGetContextTool = {
12
+ register(server, ctx) {
13
+ server.registerTool('cs_get_context', {
14
+ description: [
15
+ 'Returns a symbol definition plus its immediate (1-hop) callers and dependencies.',
16
+ 'Use this to understand a single symbol quickly. Cheaper than cs_blast_radius.',
17
+ 'Returns a session_id — pass it to every subsequent cs_* call this session to enable',
18
+ 'deduplication (skip context you already have).',
19
+ ].join(' '),
20
+ inputSchema: {
21
+ symbol_name: z
22
+ .string()
23
+ .describe('Exact name of the function/class/variable to look up'),
24
+ session_id: z
25
+ .string()
26
+ .optional()
27
+ .describe('Existing session id. Omit to start a new session.'),
28
+ },
29
+ }, async (args) => {
30
+ const { symbol_name, session_id } = args;
31
+ log(`cs_get_context symbol="${symbol_name}"`);
32
+ const symbol = ctx.store.findSymbolByName(symbol_name);
33
+ if (!symbol) {
34
+ return textResponse({
35
+ error: `Symbol '${symbol_name}' not found in index.`,
36
+ hint: 'Try cs_search_symbols to locate it, or cs_index_repo to re-index.',
37
+ }, { annotateTokens: false });
38
+ }
39
+ // Resolve or create the session.
40
+ let sid = session_id;
41
+ if (sid && !ctx.sessionManager.sessionExists(sid)) {
42
+ log(`Unknown session_id; creating new session`, 'warn');
43
+ sid = ctx.sessionManager.createSession(ctx.projectRoot);
44
+ }
45
+ else if (!sid) {
46
+ sid = ctx.sessionManager.createSession(ctx.projectRoot);
47
+ }
48
+ const neighbors = directNeighbors(ctx.store.raw, symbol.id);
49
+ const pruned = pruneBySession(ctx.sessionManager, sid, {
50
+ symbol,
51
+ callers: neighbors.callers,
52
+ dependencies: neighbors.dependencies,
53
+ });
54
+ ctx.sessionManager.markAsSent(sid, symbolsToMark(pruned));
55
+ return textResponse({
56
+ session_id: sid,
57
+ symbol: symbol.name,
58
+ file: symbol.file_path,
59
+ kind: symbol.kind,
60
+ signature: symbol.signature,
61
+ lines: `${symbol.line_start}-${symbol.line_end}`,
62
+ callers: pruned.callers.map((s) => ({
63
+ name: s.name,
64
+ file: s.file_path,
65
+ kind: s.kind,
66
+ })),
67
+ dependencies: pruned.dependencies.map((s) => ({
68
+ name: s.name,
69
+ file: s.file_path,
70
+ kind: s.kind,
71
+ })),
72
+ ...(pruned.skipped.length > 0
73
+ ? { already_in_context: pruned.skipped }
74
+ : {}),
75
+ hint: 'Pass session_id to subsequent cs_* calls to skip already-sent context.',
76
+ });
77
+ });
78
+ },
79
+ };
80
+ //# sourceMappingURL=cs_get_context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_get_context.js","sourceRoot":"","sources":["../../../src/mcp/tools/cs_get_context.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,EAAE;AACF,yFAAyF;AACzF,4FAA4F;AAC5F,4FAA4F;AAC5F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,QAAQ,CAAC,MAAiB,EAAE,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,IAAI,EAAE,wEAAwE;aAC/E,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolModule } from '../types.js';
2
+ export declare const csIndexRepoTool: ToolModule;
3
+ //# sourceMappingURL=cs_index_repo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_index_repo.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cs_index_repo.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,eAAe,EAAE,UAwC7B,CAAC"}
@@ -0,0 +1,45 @@
1
+ // cs_index_repo — trigger a full re-index of the project.
2
+ //
3
+ // Rarely needed in normal use (the file watcher keeps the index fresh after `start`), but
4
+ // useful if the index gets out of sync (e.g. files changed while the server was down, or after
5
+ // a git branch switch). Returns a status summary, not the symbols themselves.
6
+ import { z } from 'zod';
7
+ import { indexRepository } from '../../parser/index.js';
8
+ import { log } from '../../utils/logger.js';
9
+ import { textResponse } from '../responses.js';
10
+ export const csIndexRepoTool = {
11
+ register(server, ctx) {
12
+ server.registerTool('cs_index_repo', {
13
+ description: [
14
+ 'Trigger a full re-index of the project into the SQLite graph. Normally the file watcher',
15
+ 'keeps the index fresh automatically; use this only if the index is out of sync',
16
+ '(e.g. after a git branch switch with the server stopped). Returns a status summary.',
17
+ ].join(' '),
18
+ inputSchema: {
19
+ force: z
20
+ .boolean()
21
+ .default(false)
22
+ .describe('If true, re-parse every file even if its hash is unchanged.'),
23
+ },
24
+ }, async (args) => {
25
+ const { force } = args;
26
+ log(`cs_index_repo force=${force}`);
27
+ try {
28
+ const result = indexRepository(ctx.store, ctx.projectRoot, { force });
29
+ return textResponse({
30
+ status: 'ok',
31
+ files_indexed: result.filesIndexed,
32
+ files_skipped: result.filesSkipped,
33
+ symbols: result.symbols,
34
+ edges: result.edges,
35
+ duration_ms: result.durationMs,
36
+ });
37
+ }
38
+ catch (err) {
39
+ log(`cs_index_repo failed: ${err.message}`, 'error');
40
+ return textResponse({ status: 'error', message: err.message }, { annotateTokens: false });
41
+ }
42
+ });
43
+ },
44
+ };
45
+ //# sourceMappingURL=cs_index_repo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_index_repo.js","sourceRoot":"","sources":["../../../src/mcp/tools/cs_index_repo.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,0FAA0F;AAC1F,+FAA+F;AAC/F,8EAA8E;AAC9E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,CAAC,MAAM,eAAe,GAAe;IACzC,QAAQ,CAAC,MAAiB,EAAE,GAAgB;QAC1C,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;YACE,WAAW,EAAE;gBACX,yFAAyF;gBACzF,gFAAgF;gBAChF,qFAAqF;aACtF,CAAC,IAAI,CAAC,GAAG,CAAC;YACX,WAAW,EAAE;gBACX,KAAK,EAAE,CAAC;qBACL,OAAO,EAAE;qBACT,OAAO,CAAC,KAAK,CAAC;qBACd,QAAQ,CAAC,6DAA6D,CAAC;aAC3E;SACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;YACb,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;YACvB,GAAG,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;YACpC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;gBACtE,OAAO,YAAY,CAAC;oBAClB,MAAM,EAAE,IAAI;oBACZ,aAAa,EAAE,MAAM,CAAC,YAAY;oBAClC,aAAa,EAAE,MAAM,CAAC,YAAY;oBAClC,OAAO,EAAE,MAAM,CAAC,OAAO;oBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,WAAW,EAAE,MAAM,CAAC,UAAU;iBAC/B,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,GAAG,CAAC,yBAA0B,GAAa,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;gBAChE,OAAO,YAAY,CACjB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAG,GAAa,CAAC,OAAO,EAAE,EACpD,EAAE,cAAc,EAAE,KAAK,EAAE,CAC1B,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolModule } from '../types.js';
2
+ export declare const csIndexStatusTool: ToolModule;
3
+ //# sourceMappingURL=cs_index_status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_index_status.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cs_index_status.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,iBAAiB,EAAE,UAgC/B,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { log } from '../../utils/logger.js';
2
+ import { textResponse } from '../responses.js';
3
+ export const csIndexStatusTool = {
4
+ register(server, ctx) {
5
+ server.registerTool('cs_index_status', {
6
+ description: [
7
+ 'Report the health of the index: number of files, symbols, edges, and when the index was',
8
+ 'last updated. Use this to check whether the index is fresh before relying on',
9
+ 'cs_get_context / cs_blast_radius results.',
10
+ ].join(' '),
11
+ inputSchema: {},
12
+ }, async () => {
13
+ log('cs_index_status');
14
+ const stats = ctx.store.stats();
15
+ const lastIndexed = stats.lastIndexedAt
16
+ ? new Date(stats.lastIndexedAt).toISOString()
17
+ : null;
18
+ return textResponse({
19
+ status: stats.files > 0 ? 'ok' : 'empty',
20
+ files: stats.files,
21
+ symbols: stats.symbols,
22
+ edges: stats.edges,
23
+ last_indexed: lastIndexed,
24
+ hint: stats.files === 0
25
+ ? 'Index is empty. Run cs_index_repo to populate it.'
26
+ : undefined,
27
+ });
28
+ });
29
+ },
30
+ };
31
+ //# sourceMappingURL=cs_index_status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_index_status.js","sourceRoot":"","sources":["../../../src/mcp/tools/cs_index_status.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC3C,QAAQ,CAAC,MAAiB,EAAE,GAAgB;QAC1C,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;YACE,WAAW,EAAE;gBACX,yFAAyF;gBACzF,8EAA8E;gBAC9E,2CAA2C;aAC5C,CAAC,IAAI,CAAC,GAAG,CAAC;YACX,WAAW,EAAE,EAAE;SAChB,EACD,KAAK,IAAI,EAAE;YACT,GAAG,CAAC,iBAAiB,CAAC,CAAC;YACvB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAChC,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa;gBACrC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,WAAW,EAAE;gBAC7C,CAAC,CAAC,IAAI,CAAC;YACT,OAAO,YAAY,CAAC;gBAClB,MAAM,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;gBACxC,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,YAAY,EAAE,WAAW;gBACzB,IAAI,EACF,KAAK,CAAC,KAAK,KAAK,CAAC;oBACf,CAAC,CAAC,mDAAmD;oBACrD,CAAC,CAAC,SAAS;aAChB,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolModule } from '../types.js';
2
+ export declare const csSearchSymbolsTool: ToolModule;
3
+ //# sourceMappingURL=cs_search_symbols.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_search_symbols.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/cs_search_symbols.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,mBAAmB,EAAE,UAiDjC,CAAC"}
@@ -0,0 +1,51 @@
1
+ // cs_search_symbols — full-text-ish search across all indexed symbols.
2
+ //
3
+ // Use this when you don't know the exact name or location of a symbol. Substring-matches on
4
+ // symbol name + file path, prioritizing exact-ish name hits. Much cheaper than find/grep on
5
+ // the whole repo, since it only searches the symbol index.
6
+ import { z } from 'zod';
7
+ import { log } from '../../utils/logger.js';
8
+ import { textResponse } from '../responses.js';
9
+ export const csSearchSymbolsTool = {
10
+ register(server, ctx) {
11
+ server.registerTool('cs_search_symbols', {
12
+ description: [
13
+ 'Search across all indexed symbols (functions, classes, interfaces, types) by name',
14
+ 'or file path. Use this instead of find/grep to locate a symbol. Returns matches with',
15
+ 'their file + kind + line range.',
16
+ ].join(' '),
17
+ inputSchema: {
18
+ query: z
19
+ .string()
20
+ .min(1)
21
+ .describe('Substring to search for in symbol names or file paths'),
22
+ limit: z
23
+ .number()
24
+ .int()
25
+ .min(1)
26
+ .max(100)
27
+ .default(20)
28
+ .describe('Max results to return (default 20)'),
29
+ },
30
+ }, async (args) => {
31
+ const { query, limit } = args;
32
+ log(`cs_search_symbols query="${query}" limit=${limit}`);
33
+ const matches = ctx.store.searchSymbols(query, limit);
34
+ if (matches.length === 0) {
35
+ return textResponse({ query, results: [], hint: 'No matches. Try cs_index_repo if the index is stale.' }, { annotateTokens: false });
36
+ }
37
+ return textResponse({
38
+ query,
39
+ count: matches.length,
40
+ results: matches.map((m) => ({
41
+ name: m.name,
42
+ kind: m.kind,
43
+ file: m.file_path,
44
+ lines: `${m.line_start}-${m.line_end}`,
45
+ signature: m.signature,
46
+ })),
47
+ });
48
+ });
49
+ },
50
+ };
51
+ //# sourceMappingURL=cs_search_symbols.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cs_search_symbols.js","sourceRoot":"","sources":["../../../src/mcp/tools/cs_search_symbols.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,4FAA4F;AAC5F,4FAA4F;AAC5F,2DAA2D;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C,QAAQ,CAAC,MAAiB,EAAE,GAAgB;QAC1C,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;YACE,WAAW,EAAE;gBACX,mFAAmF;gBACnF,sFAAsF;gBACtF,iCAAiC;aAClC,CAAC,IAAI,CAAC,GAAG,CAAC;YACX,WAAW,EAAE;gBACX,KAAK,EAAE,CAAC;qBACL,MAAM,EAAE;qBACR,GAAG,CAAC,CAAC,CAAC;qBACN,QAAQ,CAAC,uDAAuD,CAAC;gBACpE,KAAK,EAAE,CAAC;qBACL,MAAM,EAAE;qBACR,GAAG,EAAE;qBACL,GAAG,CAAC,CAAC,CAAC;qBACN,GAAG,CAAC,GAAG,CAAC;qBACR,OAAO,CAAC,EAAE,CAAC;qBACX,QAAQ,CAAC,oCAAoC,CAAC;aAClD;SACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;YACb,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;YAC9B,GAAG,CAAC,4BAA4B,KAAK,WAAW,KAAK,EAAE,CAAC,CAAC;YAEzD,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACtD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,YAAY,CACjB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,sDAAsD,EAAE,EACpF,EAAE,cAAc,EAAE,KAAK,EAAE,CAC1B,CAAC;YACJ,CAAC;YACD,OAAO,YAAY,CAAC;gBAClB,KAAK;gBACL,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC3B,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,IAAI,EAAE,CAAC,CAAC,SAAS;oBACjB,KAAK,EAAE,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,QAAQ,EAAE;oBACtC,SAAS,EAAE,CAAC,CAAC,SAAS;iBACvB,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ToolModule } from '../types.js';
2
+ /** Every tool ContextSliver exposes. Order is the order tools appear in tool listings. */
3
+ export declare const ALL_TOOLS: ToolModule[];
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAO9C,0FAA0F;AAC1F,eAAO,MAAM,SAAS,EAAE,UAAU,EAMjC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { csIndexRepoTool } from './cs_index_repo.js';
2
+ import { csGetContextTool } from './cs_get_context.js';
3
+ import { csBlastRadiusTool } from './cs_blast_radius.js';
4
+ import { csSearchSymbolsTool } from './cs_search_symbols.js';
5
+ import { csIndexStatusTool } from './cs_index_status.js';
6
+ /** Every tool ContextSliver exposes. Order is the order tools appear in tool listings. */
7
+ export const ALL_TOOLS = [
8
+ csGetContextTool,
9
+ csBlastRadiusTool,
10
+ csSearchSymbolsTool,
11
+ csIndexStatusTool,
12
+ csIndexRepoTool,
13
+ ];
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,SAAS,GAAiB;IACrC,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;CAChB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { GraphStore } from '../graph/store.js';
3
+ import type { SessionManager } from '../session/manager.js';
4
+ /** Dependencies passed to every tool handler. */
5
+ export interface ToolContext {
6
+ /** the graph store (read + write for re-index tools) */
7
+ store: GraphStore;
8
+ /** session ledger manager (for dedup) */
9
+ sessionManager: SessionManager;
10
+ /** absolute project root */
11
+ projectRoot: string;
12
+ }
13
+ /**
14
+ * A tool module: registers itself on the server using the current high-level MCP SDK API
15
+ * (server.registerTool with a Zod raw-shape inputSchema). Each tool lives in its own file
16
+ * and exports a `register(server, ctx)` function; tools/index.ts collects them.
17
+ */
18
+ export type ToolModule = {
19
+ /** Register the tool on the given McpServer, closing over ctx. */
20
+ register: (server: McpServer, ctx: ToolContext) => void;
21
+ };
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,KAAK,EAAE,UAAU,CAAC;IAClB,yCAAyC;IACzC,cAAc,EAAE,cAAc,CAAC;IAC/B,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,kEAAkE;IAClE,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;CACzD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mcp/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import Parser, { Query } from 'tree-sitter';
2
+ import type { LanguagePlugin } from './languages/registry.js';
3
+ import type { ParseResult } from './types.js';
4
+ /** Build (or fetch) a cached Query for a plugin's default grammar. */
5
+ export declare function getQuery(plugin: LanguagePlugin): Query;
6
+ /** Build (or fetch) a cached Parser for a plugin. */
7
+ export declare function getParser(plugin: LanguagePlugin): Parser;
8
+ /**
9
+ * Extract symbols + imports from source code.
10
+ *
11
+ * @param source - raw file text
12
+ * @param plugin - the language plugin (provides grammar + query)
13
+ * @param filePath - used only to pick tsx vs ts grammar for the TS family
14
+ */
15
+ export declare function extractSymbols(source: string, plugin: LanguagePlugin, filePath?: string): ParseResult;
16
+ //# sourceMappingURL=extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractor.d.ts","sourceRoot":"","sources":["../../src/parser/extractor.ts"],"names":[],"mappings":"AAcA,OAAO,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAGV,WAAW,EACZ,MAAM,YAAY,CAAC;AASpB,sEAAsE;AACtE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,KAAK,CActD;AAED,qDAAqD;AACrD,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAQxD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,MAAM,GAChB,WAAW,CAgHb"}