codestrate 0.6.2 → 0.6.3
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/README.md +97 -101
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +54 -4
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +198 -119
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +0 -0
- package/dist/install.d.ts.map +0 -0
- package/dist/install.js +2 -2
- package/dist/install.js.map +1 -1
- package/dist/profiles.d.ts +28 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +89 -0
- package/dist/profiles.js.map +1 -0
- package/dist/schemas/index.d.ts +1441 -126
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +221 -10
- package/dist/schemas/index.js.map +1 -1
- package/dist/security/guard.d.ts +15 -2
- package/dist/security/guard.d.ts.map +1 -1
- package/dist/security/guard.js +42 -8
- package/dist/security/guard.js.map +1 -1
- package/dist/services/code-chunker.d.ts +50 -0
- package/dist/services/code-chunker.d.ts.map +1 -0
- package/dist/services/code-chunker.js +148 -0
- package/dist/services/code-chunker.js.map +1 -0
- package/dist/services/code-searcher.d.ts +6 -2
- package/dist/services/code-searcher.d.ts.map +1 -1
- package/dist/services/code-searcher.js +111 -17
- package/dist/services/code-searcher.js.map +1 -1
- package/dist/services/context-builder.d.ts +0 -11
- package/dist/services/context-builder.d.ts.map +1 -1
- package/dist/services/context-builder.js +74 -128
- package/dist/services/context-builder.js.map +1 -1
- package/dist/services/embedding-runtime.d.ts +41 -0
- package/dist/services/embedding-runtime.d.ts.map +1 -0
- package/dist/services/embedding-runtime.js +636 -0
- package/dist/services/embedding-runtime.js.map +1 -0
- package/dist/services/embedding.d.ts +79 -0
- package/dist/services/embedding.d.ts.map +1 -0
- package/dist/services/embedding.js +257 -0
- package/dist/services/embedding.js.map +1 -0
- package/dist/services/index-state.d.ts +74 -0
- package/dist/services/index-state.d.ts.map +1 -0
- package/dist/services/index-state.js +151 -0
- package/dist/services/index-state.js.map +1 -0
- package/dist/services/index-worker.d.ts +60 -0
- package/dist/services/index-worker.d.ts.map +1 -0
- package/dist/services/index-worker.js +182 -0
- package/dist/services/index-worker.js.map +1 -0
- package/dist/services/logger.d.ts +48 -0
- package/dist/services/logger.d.ts.map +1 -0
- package/dist/services/logger.js +106 -0
- package/dist/services/logger.js.map +1 -0
- package/dist/services/memory-store.d.ts +9 -7
- package/dist/services/memory-store.d.ts.map +1 -1
- package/dist/services/memory-store.js +93 -7
- package/dist/services/memory-store.js.map +1 -1
- package/dist/services/repository-parser.d.ts +0 -0
- package/dist/services/repository-parser.d.ts.map +0 -0
- package/dist/services/repository-parser.js +0 -0
- package/dist/services/repository-parser.js.map +0 -0
- package/dist/services/symbol-indexer.d.ts +0 -0
- package/dist/services/symbol-indexer.d.ts.map +1 -1
- package/dist/services/symbol-indexer.js +25 -13
- package/dist/services/symbol-indexer.js.map +1 -1
- package/dist/services/tree-sitter.d.ts +0 -0
- package/dist/services/tree-sitter.d.ts.map +0 -0
- package/dist/services/tree-sitter.js +0 -0
- package/dist/services/tree-sitter.js.map +0 -0
- package/dist/services/validation-runner.d.ts +0 -0
- package/dist/services/validation-runner.d.ts.map +1 -1
- package/dist/services/validation-runner.js +9 -9
- package/dist/services/validation-runner.js.map +1 -1
- package/dist/services/vector-indexer.d.ts +53 -0
- package/dist/services/vector-indexer.d.ts.map +1 -0
- package/dist/services/vector-indexer.js +230 -0
- package/dist/services/vector-indexer.js.map +1 -0
- package/dist/store/index.d.ts +0 -0
- package/dist/store/index.d.ts.map +0 -0
- package/dist/store/index.js +0 -0
- package/dist/store/index.js.map +0 -0
- package/dist/store/interface.d.ts +70 -1
- package/dist/store/interface.d.ts.map +1 -1
- package/dist/store/interface.js +0 -0
- package/dist/store/interface.js.map +0 -0
- package/dist/store/memory.d.ts +0 -0
- package/dist/store/memory.d.ts.map +0 -0
- package/dist/store/memory.js +0 -0
- package/dist/store/memory.js.map +0 -0
- package/dist/store/service.d.ts +49 -0
- package/dist/store/service.d.ts.map +1 -0
- package/dist/store/service.js +147 -0
- package/dist/store/service.js.map +1 -0
- package/dist/store/sqlite.d.ts +68 -3
- package/dist/store/sqlite.d.ts.map +1 -1
- package/dist/store/sqlite.js +708 -58
- package/dist/store/sqlite.js.map +1 -1
- package/dist/store/vector-store.d.ts +66 -0
- package/dist/store/vector-store.d.ts.map +1 -0
- package/dist/store/vector-store.js +330 -0
- package/dist/store/vector-store.js.map +1 -0
- package/dist/tools/analyze-impact.d.ts +0 -0
- package/dist/tools/analyze-impact.d.ts.map +1 -1
- package/dist/tools/analyze-impact.js +101 -39
- package/dist/tools/analyze-impact.js.map +1 -1
- package/dist/tools/deep-explore.d.ts +0 -0
- package/dist/tools/deep-explore.d.ts.map +1 -1
- package/dist/tools/deep-explore.js +18 -4
- package/dist/tools/deep-explore.js.map +1 -1
- package/dist/tools/detect-cycles.d.ts +3 -0
- package/dist/tools/detect-cycles.d.ts.map +1 -0
- package/dist/tools/detect-cycles.js +61 -0
- package/dist/tools/detect-cycles.js.map +1 -0
- package/dist/tools/detect-dead-code.d.ts +0 -0
- package/dist/tools/detect-dead-code.d.ts.map +1 -1
- package/dist/tools/detect-dead-code.js +1 -0
- package/dist/tools/detect-dead-code.js.map +1 -1
- package/dist/tools/explore.d.ts +13 -0
- package/dist/tools/explore.d.ts.map +1 -1
- package/dist/tools/explore.js +122 -88
- package/dist/tools/explore.js.map +1 -1
- package/dist/tools/get-context.d.ts +15 -0
- package/dist/tools/get-context.d.ts.map +1 -1
- package/dist/tools/get-context.js +66 -61
- package/dist/tools/get-context.js.map +1 -1
- package/dist/tools/graph-explain.d.ts +3 -0
- package/dist/tools/graph-explain.d.ts.map +1 -0
- package/dist/tools/graph-explain.js +140 -0
- package/dist/tools/graph-explain.js.map +1 -0
- package/dist/tools/graph-stats.d.ts +3 -0
- package/dist/tools/graph-stats.d.ts.map +1 -0
- package/dist/tools/graph-stats.js +73 -0
- package/dist/tools/graph-stats.js.map +1 -0
- package/dist/tools/inspect-symbol.d.ts +10 -0
- package/dist/tools/inspect-symbol.d.ts.map +1 -1
- package/dist/tools/inspect-symbol.js +112 -101
- package/dist/tools/inspect-symbol.js.map +1 -1
- package/dist/tools/ping.d.ts +0 -0
- package/dist/tools/ping.d.ts.map +1 -1
- package/dist/tools/ping.js +2 -3
- package/dist/tools/ping.js.map +1 -1
- package/dist/tools/profile.d.ts +9 -0
- package/dist/tools/profile.d.ts.map +1 -0
- package/dist/tools/profile.js +101 -0
- package/dist/tools/profile.js.map +1 -0
- package/dist/tools/query-graph.d.ts +3 -0
- package/dist/tools/query-graph.d.ts.map +1 -0
- package/dist/tools/query-graph.js +157 -0
- package/dist/tools/query-graph.js.map +1 -0
- package/dist/tools/recall-experience.d.ts +0 -0
- package/dist/tools/recall-experience.d.ts.map +1 -1
- package/dist/tools/recall-experience.js +5 -5
- package/dist/tools/recall-experience.js.map +1 -1
- package/dist/tools/record-experience.d.ts +0 -0
- package/dist/tools/record-experience.d.ts.map +1 -1
- package/dist/tools/record-experience.js +2 -5
- package/dist/tools/record-experience.js.map +1 -1
- package/dist/tools/reflect.d.ts +4 -0
- package/dist/tools/reflect.d.ts.map +1 -0
- package/dist/tools/reflect.js +99 -0
- package/dist/tools/reflect.js.map +1 -0
- package/dist/tools/register.d.ts +5 -2
- package/dist/tools/register.d.ts.map +1 -1
- package/dist/tools/register.js +31 -1
- package/dist/tools/register.js.map +1 -1
- package/dist/tools/reindex.d.ts +0 -0
- package/dist/tools/reindex.d.ts.map +1 -1
- package/dist/tools/reindex.js +102 -21
- package/dist/tools/reindex.js.map +1 -1
- package/dist/tools/repo-overview.d.ts +0 -0
- package/dist/tools/repo-overview.d.ts.map +1 -1
- package/dist/tools/repo-overview.js +8 -6
- package/dist/tools/repo-overview.js.map +1 -1
- package/dist/tools/run-validation.d.ts +0 -0
- package/dist/tools/run-validation.d.ts.map +1 -1
- package/dist/tools/run-validation.js +15 -1
- package/dist/tools/run-validation.js.map +1 -1
- package/dist/tools/search-code.d.ts +0 -0
- package/dist/tools/search-code.d.ts.map +1 -1
- package/dist/tools/search-code.js +11 -4
- package/dist/tools/search-code.js.map +1 -1
- package/dist/tools/search-history.d.ts +0 -0
- package/dist/tools/search-history.d.ts.map +0 -0
- package/dist/tools/search-history.js +0 -0
- package/dist/tools/search-history.js.map +0 -0
- package/dist/tools/session-heartbeat.d.ts +0 -0
- package/dist/tools/session-heartbeat.d.ts.map +1 -1
- package/dist/tools/session-heartbeat.js +1 -0
- package/dist/tools/session-heartbeat.js.map +1 -1
- package/dist/tools/session-status.d.ts +0 -0
- package/dist/tools/session-status.d.ts.map +1 -1
- package/dist/tools/session-status.js +1 -0
- package/dist/tools/session-status.js.map +1 -1
- package/dist/tools/status.d.ts +0 -0
- package/dist/tools/status.d.ts.map +1 -1
- package/dist/tools/status.js +87 -24
- package/dist/tools/status.js.map +1 -1
- package/dist/tools/trace-bfs.d.ts +13 -0
- package/dist/tools/trace-bfs.d.ts.map +1 -0
- package/dist/tools/trace-bfs.js +251 -0
- package/dist/tools/trace-bfs.js.map +1 -0
- package/dist/tools/trace-flow.d.ts +1 -1
- package/dist/tools/trace-flow.d.ts.map +1 -1
- package/dist/tools/trace-flow.js +113 -69
- package/dist/tools/trace-flow.js.map +1 -1
- package/dist/types.d.ts +75 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -0
- package/dist/types.js.map +1 -1
- package/grammars/tree-sitter-c.wasm +0 -0
- package/grammars/tree-sitter-cpp.wasm +0 -0
- package/grammars/tree-sitter-go.wasm +0 -0
- package/grammars/tree-sitter-java.wasm +0 -0
- package/grammars/tree-sitter-javascript.wasm +0 -0
- package/grammars/tree-sitter-python.wasm +0 -0
- package/grammars/tree-sitter-rust.wasm +0 -0
- package/grammars/tree-sitter-tsx.wasm +0 -0
- package/grammars/tree-sitter-typescript.wasm +0 -0
- package/package.json +8 -6
package/dist/tools/explore.js
CHANGED
|
@@ -1,114 +1,148 @@
|
|
|
1
1
|
import { registerCiTool } from "./register.js";
|
|
2
2
|
import { ExploreSchema, ExploreOutputSchema, ResponseFormat } from "../schemas/index.js";
|
|
3
|
-
import { findSymbols } from "../store/
|
|
3
|
+
import { findSymbols } from "../store/service.js";
|
|
4
4
|
import { getStore } from "../store/sqlite.js";
|
|
5
5
|
import { MAX_RESPONSE_CHARS } from "../constants.js";
|
|
6
6
|
import { asStructured } from "../types.js";
|
|
7
|
+
import { requireIndexReady, ciErrorToolResult, indexMeta, getIndexState, } from "../services/index-state.js";
|
|
7
8
|
let warnedFts5 = false, warnedCamel = false, warnedGraph = false;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
/** Handler exported for tests — same path as the registered MCP tool. */
|
|
10
|
+
export async function handleExplore(args) {
|
|
11
|
+
try {
|
|
12
|
+
const indexErr = requireIndexReady();
|
|
13
|
+
if (indexErr) {
|
|
14
|
+
return ciErrorToolResult(indexErr);
|
|
15
|
+
}
|
|
16
|
+
const input = {
|
|
17
|
+
query: args.query,
|
|
18
|
+
maxResults: args.maxResults ?? 20,
|
|
19
|
+
responseFormat: args.responseFormat ?? "markdown",
|
|
20
|
+
};
|
|
21
|
+
const limit = input.maxResults ?? 20;
|
|
22
|
+
const symbols = [];
|
|
23
|
+
const seen = new Set();
|
|
24
|
+
const addIfNew = (name, kind, file, line, signature) => {
|
|
25
|
+
const key = `${name}:${file}`;
|
|
26
|
+
if (seen.has(key))
|
|
27
|
+
return;
|
|
28
|
+
seen.add(key);
|
|
29
|
+
symbols.push({ name, kind, file, line, signature });
|
|
30
|
+
};
|
|
16
31
|
try {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
const symbols = [];
|
|
32
|
+
const store = getStore();
|
|
33
|
+
// 1a. FTS5 search
|
|
20
34
|
try {
|
|
21
|
-
const
|
|
22
|
-
|
|
35
|
+
const ftsResults = store.searchGraphNodesFTS(input.query, limit);
|
|
36
|
+
for (const node of ftsResults)
|
|
37
|
+
addIfNew(node.name, node.kind, node.file, node.line ?? 0, node.signature);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
if (!warnedFts5) {
|
|
41
|
+
warnedFts5 = true;
|
|
42
|
+
console.warn("[explore] FTS5 không khả dụng:", err instanceof Error ? err.message : String(err));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// 1b. CamelCase search
|
|
46
|
+
if (symbols.length < limit) {
|
|
23
47
|
try {
|
|
24
|
-
const
|
|
25
|
-
for (const node of
|
|
26
|
-
|
|
27
|
-
name: node.name,
|
|
28
|
-
kind: node.kind,
|
|
29
|
-
file: node.file,
|
|
30
|
-
line: node.line ?? 0,
|
|
31
|
-
signature: node.signature,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
48
|
+
const camelResults = store.searchGraphNodesCamel(input.query, limit - symbols.length);
|
|
49
|
+
for (const node of camelResults)
|
|
50
|
+
addIfNew(node.name, node.kind, node.file, node.line ?? 0, node.signature);
|
|
34
51
|
}
|
|
35
52
|
catch (err) {
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
console.warn("[explore]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// 1b. CamelCase search
|
|
42
|
-
if (symbols.length < limit) {
|
|
43
|
-
try {
|
|
44
|
-
const camelResults = store.searchGraphNodesCamel(input.query, limit - symbols.length);
|
|
45
|
-
for (const node of camelResults) {
|
|
46
|
-
if (!symbols.some(s => s.name === node.name && s.file === node.file)) {
|
|
47
|
-
symbols.push({
|
|
48
|
-
name: node.name,
|
|
49
|
-
kind: node.kind,
|
|
50
|
-
file: node.file,
|
|
51
|
-
line: node.line ?? 0,
|
|
52
|
-
signature: node.signature,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
if (!warnedCamel) {
|
|
59
|
-
warnedCamel = true;
|
|
60
|
-
console.warn("[explore] Tìm kiếm CamelCase thất bại:", err instanceof Error ? err.message : String(err));
|
|
61
|
-
}
|
|
53
|
+
if (!warnedCamel) {
|
|
54
|
+
warnedCamel = true;
|
|
55
|
+
console.warn("[explore] Tìm kiếm CamelCase thất bại:", err instanceof Error ? err.message : String(err));
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
// 1c. Trigram FTS (CJK support)
|
|
60
|
+
if (symbols.length < limit) {
|
|
61
|
+
try {
|
|
62
|
+
const triResults = store.searchGraphNodesTrigram(input.query, limit - symbols.length);
|
|
63
|
+
for (const node of triResults)
|
|
64
|
+
addIfNew(node.name, node.kind, node.file, node.line ?? 0, node.signature);
|
|
69
65
|
}
|
|
66
|
+
catch { /* trigram not available, skip */ }
|
|
70
67
|
}
|
|
71
|
-
//
|
|
72
|
-
if (symbols.length
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
name
|
|
77
|
-
kind: s.kind,
|
|
78
|
-
file: s.file,
|
|
79
|
-
line: s.line,
|
|
80
|
-
signature: s.signature,
|
|
81
|
-
});
|
|
68
|
+
// 1d. Name segment vocab (partial name match)
|
|
69
|
+
if (symbols.length < limit) {
|
|
70
|
+
try {
|
|
71
|
+
const segResults = store.searchGraphNodesBySegment(input.query, limit - symbols.length);
|
|
72
|
+
for (const node of segResults)
|
|
73
|
+
addIfNew(node.name, node.kind, node.file, node.line ?? 0, node.signature);
|
|
82
74
|
}
|
|
75
|
+
catch { /* segment_vocab not available, skip */ }
|
|
83
76
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
content: [{ type: "text", text: JSON.stringify({ query: input.query, totalSymbols: compressed.length, symbols: compressed }, null, 2) }],
|
|
91
|
-
structuredContent: asStructured({ query: input.query, totalSymbols: compressed.length, symbols: compressed }),
|
|
92
|
-
};
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
if (!warnedGraph) {
|
|
80
|
+
warnedGraph = true;
|
|
81
|
+
console.warn("[explore] Graph store lỗi:", err instanceof Error ? err.message : String(err));
|
|
93
82
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
83
|
+
}
|
|
84
|
+
// 2. Fallback JSON store
|
|
85
|
+
if (symbols.length === 0) {
|
|
86
|
+
const flatResults = findSymbols(input.query);
|
|
87
|
+
for (const s of flatResults.slice(0, limit)) {
|
|
88
|
+
symbols.push({
|
|
89
|
+
name: s.name,
|
|
90
|
+
kind: s.kind,
|
|
91
|
+
file: s.file,
|
|
92
|
+
line: s.line,
|
|
93
|
+
signature: s.signature,
|
|
94
|
+
});
|
|
101
95
|
}
|
|
102
|
-
|
|
96
|
+
}
|
|
97
|
+
// Compression: truncate long signatures when many results
|
|
98
|
+
const compressed = symbols.length > 10
|
|
99
|
+
? symbols.map(s => ({ ...s, signature: s.signature.length > 80 ? s.signature.slice(0, 80) + "..." : s.signature }))
|
|
100
|
+
: symbols;
|
|
101
|
+
const meta = indexMeta();
|
|
102
|
+
const payload = {
|
|
103
|
+
query: input.query,
|
|
104
|
+
totalSymbols: compressed.length,
|
|
105
|
+
symbols: compressed,
|
|
106
|
+
...meta,
|
|
107
|
+
partial: getIndexState().partial || meta.partial,
|
|
108
|
+
};
|
|
109
|
+
if (input.responseFormat === ResponseFormat.JSON) {
|
|
103
110
|
return {
|
|
104
|
-
content: [{ type: "text", text:
|
|
105
|
-
structuredContent: asStructured(
|
|
111
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
112
|
+
structuredContent: asStructured(payload),
|
|
106
113
|
};
|
|
107
114
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
const lines = [
|
|
116
|
+
`# Explore: \`${input.query}\``,
|
|
117
|
+
`**Kết quả:** ${compressed.length}`,
|
|
118
|
+
`**Index:** ${meta.indexLifecycle}${payload.partial ? " (partial)" : ""}`,
|
|
119
|
+
"",
|
|
120
|
+
];
|
|
121
|
+
for (const s of compressed) {
|
|
122
|
+
lines.push(`### ${s.name} (\`${s.kind}\`)`);
|
|
123
|
+
lines.push(`- **File:** \`${s.file}\` **Line:** ${s.line}`);
|
|
124
|
+
if (s.signature)
|
|
125
|
+
lines.push(`- **Signature:** \`${s.signature}\``);
|
|
126
|
+
lines.push("");
|
|
111
127
|
}
|
|
112
|
-
|
|
128
|
+
const text = lines.join("\n");
|
|
129
|
+
return {
|
|
130
|
+
content: [{ type: "text", text: text.length > MAX_RESPONSE_CHARS ? text.slice(0, MAX_RESPONSE_CHARS) + "\n\n[Output truncated]" : text }],
|
|
131
|
+
structuredContent: asStructured(payload),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
136
|
+
return { content: [{ type: "text", text: `Error exploring: ${msg}` }], isError: true };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export function registerExplore(server) {
|
|
140
|
+
registerCiTool(server, "ci_explore", {
|
|
141
|
+
title: "Explore Codebase",
|
|
142
|
+
description: "Primary exploration tool — searches symbols, files, and patterns using graph FTS5 + symbol index. Returns compressed, relevance-ranked results.",
|
|
143
|
+
inputSchema: ExploreSchema.shape,
|
|
144
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
145
|
+
outputSchema: ExploreOutputSchema,
|
|
146
|
+
}, async (args) => handleExplore(args));
|
|
113
147
|
}
|
|
114
148
|
//# sourceMappingURL=explore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explore.js","sourceRoot":"","sources":["../../src/tools/explore.ts"],"names":[],"mappings":"AACA,OA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}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
/** Handler exported for tests — same path as the registered MCP tool. */
|
|
3
|
+
export declare function handleGetContext(params: {
|
|
4
|
+
task: string;
|
|
5
|
+
tokenBudget?: number;
|
|
6
|
+
includeHistory?: boolean;
|
|
7
|
+
includeMemory?: boolean;
|
|
8
|
+
responseFormat?: string;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
content: Array<{
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
}>;
|
|
14
|
+
structuredContent?: Record<string, unknown>;
|
|
15
|
+
isError?: boolean;
|
|
16
|
+
}>;
|
|
2
17
|
export declare function registerGetContext(server: McpServer): void;
|
|
3
18
|
//# sourceMappingURL=get-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-context.d.ts","sourceRoot":"","sources":["../../src/tools/get-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-context.d.ts","sourceRoot":"","sources":["../../src/tools/get-context.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASzE,yEAAyE;AACzE,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,CAoED;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiB1D"}
|
|
@@ -7,10 +7,73 @@
|
|
|
7
7
|
import { GetContextSchema, GetContextOutputSchema, ResponseFormat } from "../schemas/index.js";
|
|
8
8
|
import { buildContext } from "../services/context-builder.js";
|
|
9
9
|
import { loadConfig } from "../constants.js";
|
|
10
|
-
import {
|
|
11
|
-
import { loadMemoryStore } from "../store/memory.js";
|
|
10
|
+
import { getStore } from "../store/sqlite.js";
|
|
12
11
|
import { asStructured } from "../types.js";
|
|
13
12
|
import { registerCiTool } from "./register.js";
|
|
13
|
+
import { requireIndexReady, ciErrorToolResult, indexMeta, getIndexState, } from "../services/index-state.js";
|
|
14
|
+
/** Handler exported for tests — same path as the registered MCP tool. */
|
|
15
|
+
export async function handleGetContext(params) {
|
|
16
|
+
try {
|
|
17
|
+
// Typed readiness gate — never soft-succeed on failed/indexing index
|
|
18
|
+
const indexErr = requireIndexReady();
|
|
19
|
+
if (indexErr) {
|
|
20
|
+
return ciErrorToolResult(indexErr);
|
|
21
|
+
}
|
|
22
|
+
const config = loadConfig();
|
|
23
|
+
getStore(config.storePath);
|
|
24
|
+
const bundle = await buildContext({
|
|
25
|
+
task: params.task,
|
|
26
|
+
tokenBudget: params.tokenBudget ?? 12_000,
|
|
27
|
+
includeHistory: params.includeHistory ?? true,
|
|
28
|
+
includeMemory: params.includeMemory ?? true,
|
|
29
|
+
repoPath: config.repoPath ?? "",
|
|
30
|
+
});
|
|
31
|
+
const meta = indexMeta();
|
|
32
|
+
const idx = getIndexState();
|
|
33
|
+
const payload = {
|
|
34
|
+
...bundle,
|
|
35
|
+
...meta,
|
|
36
|
+
partial: idx.partial || meta.partial,
|
|
37
|
+
};
|
|
38
|
+
if (params.responseFormat === ResponseFormat.JSON || params.responseFormat === "json") {
|
|
39
|
+
return {
|
|
40
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
41
|
+
structuredContent: asStructured(payload),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const lines = [
|
|
45
|
+
`**Context Bundle for Task:** ${bundle.task}`,
|
|
46
|
+
``,
|
|
47
|
+
`### Index`,
|
|
48
|
+
`- lifecycle: ${meta.indexLifecycle}`,
|
|
49
|
+
`- partial: ${payload.partial}`,
|
|
50
|
+
`- stale: ${meta.stale}`,
|
|
51
|
+
``,
|
|
52
|
+
`### Symbolic Canvas`,
|
|
53
|
+
`\`\`\`mermaid`,
|
|
54
|
+
bundle.canvas,
|
|
55
|
+
`\`\`\``,
|
|
56
|
+
``,
|
|
57
|
+
`### Ref Nodes`,
|
|
58
|
+
];
|
|
59
|
+
for (const node of bundle.nodes) {
|
|
60
|
+
lines.push(`- **[${node.node_id}]** ${node.type}: ${node.name} (Ref: ${node.ref_file})`);
|
|
61
|
+
}
|
|
62
|
+
lines.push(``);
|
|
63
|
+
lines.push(`> **Instruction:** ${bundle.instruction}`);
|
|
64
|
+
return {
|
|
65
|
+
content: [{ type: "text", text: lines.join("\n").trim() }],
|
|
66
|
+
structuredContent: asStructured(payload),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
71
|
+
return {
|
|
72
|
+
content: [{ type: "text", text: `Error building context: ${message}` }],
|
|
73
|
+
isError: true,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
14
77
|
export function registerGetContext(server) {
|
|
15
78
|
registerCiTool(server, "ci_get_context", {
|
|
16
79
|
title: "Get Context for Task",
|
|
@@ -21,64 +84,6 @@ export function registerGetContext(server) {
|
|
|
21
84
|
readOnlyHint: true,
|
|
22
85
|
idempotentHint: true,
|
|
23
86
|
},
|
|
24
|
-
}, async (params) =>
|
|
25
|
-
try {
|
|
26
|
-
const config = loadConfig();
|
|
27
|
-
loadIndex(config.storePath);
|
|
28
|
-
loadMemoryStore(config.storePath);
|
|
29
|
-
const index = getIndex();
|
|
30
|
-
if (!index.snapshot) {
|
|
31
|
-
return {
|
|
32
|
-
content: [{
|
|
33
|
-
type: "text",
|
|
34
|
-
text: "No repository index found. Run `ci_repo_overview` first to build an index snapshot.",
|
|
35
|
-
}],
|
|
36
|
-
structuredContent: asStructured(null),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const bundle = await buildContext({
|
|
40
|
-
task: params.task,
|
|
41
|
-
tokenBudget: params.tokenBudget,
|
|
42
|
-
includeHistory: params.includeHistory,
|
|
43
|
-
includeMemory: params.includeMemory,
|
|
44
|
-
repoPath: config.repoPath ?? "",
|
|
45
|
-
});
|
|
46
|
-
if (params.responseFormat === ResponseFormat.JSON) {
|
|
47
|
-
return {
|
|
48
|
-
content: [{ type: "text", text: JSON.stringify(bundle, null, 2) }],
|
|
49
|
-
structuredContent: asStructured(bundle),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
// Markdown format — summary line, all items separated by ---
|
|
53
|
-
const lines = [
|
|
54
|
-
`**Context Bundle: ${bundle.summary}**`,
|
|
55
|
-
`**Token Usage:** ${bundle.totalTokens} / ${params.tokenBudget} tokens`,
|
|
56
|
-
];
|
|
57
|
-
if (bundle.hasMore) {
|
|
58
|
-
lines.push("> ⚠ Some relevant context was truncated due to token budget limits.");
|
|
59
|
-
}
|
|
60
|
-
lines.push("");
|
|
61
|
-
for (const item of bundle.items) {
|
|
62
|
-
lines.push(`### ${item.label}`);
|
|
63
|
-
lines.push(`**Type:** ${item.type} | **Tokens:** ${item.tokens} | **Relevance:** ${(item.relevance * 100).toFixed(0)}%`);
|
|
64
|
-
lines.push("");
|
|
65
|
-
lines.push(item.content);
|
|
66
|
-
lines.push("");
|
|
67
|
-
lines.push("---");
|
|
68
|
-
lines.push("");
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
content: [{ type: "text", text: lines.join("\n").trim() }],
|
|
72
|
-
structuredContent: asStructured(bundle),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
77
|
-
return {
|
|
78
|
-
content: [{ type: "text", text: `Error building context: ${message}` }],
|
|
79
|
-
isError: true,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
87
|
+
}, async (params) => handleGetContext(params));
|
|
83
88
|
}
|
|
84
89
|
//# sourceMappingURL=get-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-context.js","sourceRoot":"","sources":["../../src/tools/get-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-context.js","sourceRoot":"","sources":["../../src/tools/get-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,aAAa,GACd,MAAM,4BAA4B,CAAC;AAEpC,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAMtC;IAKC,IAAI,CAAC;QACH,qEAAqE;QACrE,MAAM,QAAQ,GAAG,iBAAiB,EAAE,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,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAgD,CAAC,CACrF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-explain.d.ts","sourceRoot":"","sources":["../../src/tools/graph-explain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA4J5D"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { registerCiTool } from "./register.js";
|
|
2
|
+
import { GraphExplainSchema, GraphExplainOutputSchema } from "../schemas/index.js";
|
|
3
|
+
import { getStore } from "../store/sqlite.js";
|
|
4
|
+
import { asStructured } from "../types.js";
|
|
5
|
+
export function registerGraphExplain(server) {
|
|
6
|
+
registerCiTool(server, "ci_graph_explain", {
|
|
7
|
+
title: "Graph Explain",
|
|
8
|
+
description: "Rich neighborhood explanation for a symbol — shows its connections, degree, community, and surrounding subgraph with EXTRACTED/INFERRED confidence tags on every edge.",
|
|
9
|
+
inputSchema: GraphExplainSchema,
|
|
10
|
+
outputSchema: GraphExplainOutputSchema,
|
|
11
|
+
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
12
|
+
}, async (params) => {
|
|
13
|
+
try {
|
|
14
|
+
const store = getStore();
|
|
15
|
+
// Find the node
|
|
16
|
+
const node = store.getGraphNodeByName(params.symbol);
|
|
17
|
+
if (!node) {
|
|
18
|
+
return {
|
|
19
|
+
content: [{ type: "text", text: `Symbol '${params.symbol}' not found in graph. Try ci_explore to find available symbols.` }],
|
|
20
|
+
structuredContent: asStructured({ symbol: params.symbol, neighbors: [], degree: 0 }),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
// Get edges (both directions) for direct neighbors
|
|
24
|
+
const edges = store.getGraphEdges(node.id, "both");
|
|
25
|
+
const filteredEdges = params.edgeKinds
|
|
26
|
+
? edges.filter(e => params.edgeKinds.includes(e.kind))
|
|
27
|
+
: edges;
|
|
28
|
+
// Compute degree
|
|
29
|
+
const degree = filteredEdges.length;
|
|
30
|
+
// Run BFS for deeper context
|
|
31
|
+
const subgraph = store.traverseBFS(params.symbol, {
|
|
32
|
+
maxDepth: params.depth,
|
|
33
|
+
edgeKinds: params.edgeKinds,
|
|
34
|
+
limit: params.maxNodes,
|
|
35
|
+
});
|
|
36
|
+
// Collect neighbor info
|
|
37
|
+
const neighbors = [];
|
|
38
|
+
for (const edge of filteredEdges) {
|
|
39
|
+
const isOutgoing = edge.sourceNodeId === node.id;
|
|
40
|
+
const neighborId = isOutgoing ? edge.targetNodeId : edge.sourceNodeId;
|
|
41
|
+
const neighborNode = store.getGraphNode(neighborId);
|
|
42
|
+
if (neighborNode) {
|
|
43
|
+
neighbors.push({
|
|
44
|
+
name: neighborNode.name,
|
|
45
|
+
kind: neighborNode.kind,
|
|
46
|
+
relation: edge.kind,
|
|
47
|
+
direction: isOutgoing ? "outgoing" : "incoming",
|
|
48
|
+
confidence: edge.confidence,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Build community info via direct SQL count
|
|
53
|
+
let nodeCommunity;
|
|
54
|
+
if (node.community !== undefined) {
|
|
55
|
+
const row = store.db.prepare("SELECT COUNT(*) AS c FROM graph_nodes WHERE community = ?").get(node.community);
|
|
56
|
+
nodeCommunity = {
|
|
57
|
+
id: node.community,
|
|
58
|
+
size: Number(row.c),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const lines = [
|
|
62
|
+
`# Graph Explain: \`${node.name}\``,
|
|
63
|
+
``,
|
|
64
|
+
`**Kind:** ${node.kind} | **File:** \`${node.file}\` | **Degree:** ${degree}`,
|
|
65
|
+
];
|
|
66
|
+
if (nodeCommunity) {
|
|
67
|
+
lines.push(`**Community:** ${nodeCommunity.id} (${nodeCommunity.size} nodes)`);
|
|
68
|
+
}
|
|
69
|
+
lines.push(``, `## Connections (${neighbors.length})`, ``);
|
|
70
|
+
if (neighbors.length === 0) {
|
|
71
|
+
lines.push("_No connections found._");
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// Sort by direction then relation
|
|
75
|
+
const outgoing = neighbors.filter(n => n.direction === "outgoing");
|
|
76
|
+
const incoming = neighbors.filter(n => n.direction === "incoming");
|
|
77
|
+
if (outgoing.length > 0) {
|
|
78
|
+
lines.push(`### Outgoing`, ``);
|
|
79
|
+
for (const n of outgoing) {
|
|
80
|
+
lines.push(`- **\`${n.name}\`** — ${n.relation} [${n.confidence}]`);
|
|
81
|
+
}
|
|
82
|
+
lines.push(``);
|
|
83
|
+
}
|
|
84
|
+
if (incoming.length > 0) {
|
|
85
|
+
lines.push(`### Incoming`, ``);
|
|
86
|
+
for (const n of incoming) {
|
|
87
|
+
lines.push(`- **\`${n.name}\`** ← ${n.relation} [${n.confidence}]`);
|
|
88
|
+
}
|
|
89
|
+
lines.push(``);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Show deeper subgraph summary
|
|
93
|
+
if (subgraph.nodes.length > 1) {
|
|
94
|
+
lines.push(`## Subgraph (depth ${params.depth})`, ``);
|
|
95
|
+
lines.push(`**${subgraph.nodes.length} nodes, ${subgraph.edges.length} edges**`);
|
|
96
|
+
if (subgraph.stats.truncated) {
|
|
97
|
+
lines.push("_(truncated — results limited)_");
|
|
98
|
+
}
|
|
99
|
+
lines.push(``);
|
|
100
|
+
for (const sn of subgraph.nodes) {
|
|
101
|
+
if (sn.id === node.id)
|
|
102
|
+
continue; // skip self
|
|
103
|
+
lines.push(`- **\`${sn.name}\`** — ${sn.kind} (${sn.file})`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
108
|
+
structuredContent: asStructured({
|
|
109
|
+
symbol: node.name,
|
|
110
|
+
kind: node.kind,
|
|
111
|
+
file: node.file,
|
|
112
|
+
communityId: node.community,
|
|
113
|
+
degree,
|
|
114
|
+
neighbors,
|
|
115
|
+
subgraph: subgraph.nodes.length > 0
|
|
116
|
+
? {
|
|
117
|
+
nodes: subgraph.nodes.map(n => ({
|
|
118
|
+
id: n.id, name: n.name, kind: n.kind, file: n.file,
|
|
119
|
+
line: n.line, column: n.column, signature: n.signature,
|
|
120
|
+
})),
|
|
121
|
+
edges: subgraph.edges.map(e => ({
|
|
122
|
+
id: e.id, sourceNodeId: e.sourceNodeId, targetNodeId: e.targetNodeId,
|
|
123
|
+
kind: e.kind, confidence: e.confidence,
|
|
124
|
+
})),
|
|
125
|
+
}
|
|
126
|
+
: undefined,
|
|
127
|
+
nodeCommunity,
|
|
128
|
+
}),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
133
|
+
return {
|
|
134
|
+
content: [{ type: "text", text: `Graph explain error: ${msg}` }],
|
|
135
|
+
isError: true,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=graph-explain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-explain.js","sourceRoot":"","sources":["../../src/tools/graph-explain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAA0B,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACpD,cAAc,CAAC,MAAM,EAAE,kBAAkB,EACzC;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,wKAAwK;QACrL,WAAW,EAAE,kBAAkB;QAC/B,YAAY,EAAE,wBAAwB;QACtC,WAA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