codebase-context 1.6.2 → 1.8.0
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/LICENSE +21 -21
- package/README.md +417 -282
- package/dist/analyzers/angular/index.d.ts.map +1 -1
- package/dist/analyzers/angular/index.js +91 -40
- package/dist/analyzers/angular/index.js.map +1 -1
- package/dist/analyzers/generic/index.d.ts +1 -0
- package/dist/analyzers/generic/index.d.ts.map +1 -1
- package/dist/analyzers/generic/index.js +94 -14
- package/dist/analyzers/generic/index.js.map +1 -1
- package/dist/cli-formatters.d.ts +47 -0
- package/dist/cli-formatters.d.ts.map +1 -0
- package/dist/cli-formatters.js +803 -0
- package/dist/cli-formatters.js.map +1 -0
- package/dist/cli-memory.d.ts +5 -0
- package/dist/cli-memory.d.ts.map +1 -0
- package/dist/cli-memory.js +218 -0
- package/dist/cli-memory.js.map +1 -0
- package/dist/cli.d.ts +3 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +317 -88
- package/dist/cli.js.map +1 -1
- package/dist/constants/codebase-context.d.ts +13 -0
- package/dist/constants/codebase-context.d.ts.map +1 -1
- package/dist/constants/codebase-context.js +13 -0
- package/dist/constants/codebase-context.js.map +1 -1
- package/dist/core/auto-refresh.d.ts +16 -0
- package/dist/core/auto-refresh.d.ts.map +1 -0
- package/dist/core/auto-refresh.js +25 -0
- package/dist/core/auto-refresh.js.map +1 -0
- package/dist/core/file-watcher.d.ts +15 -0
- package/dist/core/file-watcher.d.ts.map +1 -0
- package/dist/core/file-watcher.js +59 -0
- package/dist/core/file-watcher.js.map +1 -0
- package/dist/core/index-meta.d.ts +27 -0
- package/dist/core/index-meta.d.ts.map +1 -0
- package/dist/core/index-meta.js +212 -0
- package/dist/core/index-meta.js.map +1 -0
- package/dist/core/indexer.d.ts.map +1 -1
- package/dist/core/indexer.js +324 -26
- package/dist/core/indexer.js.map +1 -1
- package/dist/core/reranker.d.ts.map +1 -1
- package/dist/core/reranker.js +3 -0
- package/dist/core/reranker.js.map +1 -1
- package/dist/core/search-quality.js +2 -2
- package/dist/core/search-quality.js.map +1 -1
- package/dist/core/search.d.ts +1 -0
- package/dist/core/search.d.ts.map +1 -1
- package/dist/core/search.js +79 -11
- package/dist/core/search.js.map +1 -1
- package/dist/core/symbol-references.d.ts +20 -0
- package/dist/core/symbol-references.d.ts.map +1 -0
- package/dist/core/symbol-references.js +186 -0
- package/dist/core/symbol-references.js.map +1 -0
- package/dist/embeddings/index.d.ts +8 -0
- package/dist/embeddings/index.d.ts.map +1 -1
- package/dist/embeddings/index.js +17 -2
- package/dist/embeddings/index.js.map +1 -1
- package/dist/embeddings/openai.d.ts +1 -1
- package/dist/embeddings/openai.d.ts.map +1 -1
- package/dist/embeddings/openai.js +3 -1
- package/dist/embeddings/openai.js.map +1 -1
- package/dist/embeddings/transformers.d.ts +6 -0
- package/dist/embeddings/transformers.d.ts.map +1 -1
- package/dist/embeddings/transformers.js +12 -5
- package/dist/embeddings/transformers.js.map +1 -1
- package/dist/embeddings/types.d.ts +1 -0
- package/dist/embeddings/types.d.ts.map +1 -1
- package/dist/embeddings/types.js +7 -1
- package/dist/embeddings/types.js.map +1 -1
- package/dist/eval/harness.d.ts +5 -0
- package/dist/eval/harness.d.ts.map +1 -0
- package/dist/eval/harness.js +153 -0
- package/dist/eval/harness.js.map +1 -0
- package/dist/eval/types.d.ts +59 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +2 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/grammars/manifest.d.ts +26 -0
- package/dist/grammars/manifest.d.ts.map +1 -0
- package/dist/grammars/manifest.js +64 -0
- package/dist/grammars/manifest.js.map +1 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +181 -1300
- package/dist/index.js.map +1 -1
- package/dist/patterns/semantics.d.ts +2 -1
- package/dist/patterns/semantics.d.ts.map +1 -1
- package/dist/patterns/semantics.js +0 -2
- package/dist/patterns/semantics.js.map +1 -1
- package/dist/preflight/evidence-lock.d.ts +6 -0
- package/dist/preflight/evidence-lock.d.ts.map +1 -1
- package/dist/preflight/evidence-lock.js +33 -1
- package/dist/preflight/evidence-lock.js.map +1 -1
- package/dist/storage/index.d.ts +4 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -2
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/lancedb.d.ts +11 -1
- package/dist/storage/lancedb.d.ts.map +1 -1
- package/dist/storage/lancedb.js +45 -11
- package/dist/storage/lancedb.js.map +1 -1
- package/dist/storage/types.d.ts +4 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/storage/types.js.map +1 -1
- package/dist/tools/detect-circular-dependencies.d.ts +5 -0
- package/dist/tools/detect-circular-dependencies.d.ts.map +1 -0
- package/dist/tools/detect-circular-dependencies.js +117 -0
- package/dist/tools/detect-circular-dependencies.js.map +1 -0
- package/dist/tools/get-codebase-metadata.d.ts +5 -0
- package/dist/tools/get-codebase-metadata.d.ts.map +1 -0
- package/dist/tools/get-codebase-metadata.js +53 -0
- package/dist/tools/get-codebase-metadata.js.map +1 -0
- package/dist/tools/get-indexing-status.d.ts +5 -0
- package/dist/tools/get-indexing-status.d.ts.map +1 -0
- package/dist/tools/get-indexing-status.js +44 -0
- package/dist/tools/get-indexing-status.js.map +1 -0
- package/dist/tools/get-memory.d.ts +5 -0
- package/dist/tools/get-memory.d.ts.map +1 -0
- package/dist/tools/get-memory.js +89 -0
- package/dist/tools/get-memory.js.map +1 -0
- package/dist/tools/get-style-guide.d.ts +5 -0
- package/dist/tools/get-style-guide.d.ts.map +1 -0
- package/dist/tools/get-style-guide.js +151 -0
- package/dist/tools/get-style-guide.js.map +1 -0
- package/dist/tools/get-symbol-references.d.ts +5 -0
- package/dist/tools/get-symbol-references.d.ts.map +1 -0
- package/dist/tools/get-symbol-references.js +70 -0
- package/dist/tools/get-symbol-references.js.map +1 -0
- package/dist/tools/get-team-patterns.d.ts +5 -0
- package/dist/tools/get-team-patterns.d.ts.map +1 -0
- package/dist/tools/get-team-patterns.js +147 -0
- package/dist/tools/get-team-patterns.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +41 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/refresh-index.d.ts +5 -0
- package/dist/tools/refresh-index.d.ts.map +1 -0
- package/dist/tools/refresh-index.js +40 -0
- package/dist/tools/refresh-index.js.map +1 -0
- package/dist/tools/remember.d.ts +5 -0
- package/dist/tools/remember.d.ts.map +1 -0
- package/dist/tools/remember.js +101 -0
- package/dist/tools/remember.js.map +1 -0
- package/dist/tools/search-codebase.d.ts +5 -0
- package/dist/tools/search-codebase.d.ts.map +1 -0
- package/dist/tools/search-codebase.js +745 -0
- package/dist/tools/search-codebase.js.map +1 -0
- package/dist/tools/types.d.ts +223 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types/index.d.ts +79 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/ast-chunker.d.ts +71 -0
- package/dist/utils/ast-chunker.d.ts.map +1 -0
- package/dist/utils/ast-chunker.js +453 -0
- package/dist/utils/ast-chunker.js.map +1 -0
- package/dist/utils/chunking.d.ts.map +1 -1
- package/dist/utils/chunking.js +10 -3
- package/dist/utils/chunking.js.map +1 -1
- package/dist/utils/language-detection.d.ts.map +1 -1
- package/dist/utils/language-detection.js +26 -1
- package/dist/utils/language-detection.js.map +1 -1
- package/dist/utils/tree-sitter.d.ts +28 -0
- package/dist/utils/tree-sitter.d.ts.map +1 -0
- package/dist/utils/tree-sitter.js +422 -0
- package/dist/utils/tree-sitter.js.map +1 -0
- package/dist/utils/usage-tracker.d.ts +30 -40
- package/dist/utils/usage-tracker.d.ts.map +1 -1
- package/dist/utils/usage-tracker.js +66 -8
- package/dist/utils/usage-tracker.js.map +1 -1
- package/docs/capabilities.md +183 -92
- package/docs/cli.md +196 -0
- package/grammars/.gitkeep +0 -0
- package/grammars/tree-sitter-c.wasm +0 -0
- package/grammars/tree-sitter-c_sharp.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-kotlin.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 +153 -157
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { InternalFileGraph } from '../utils/usage-tracker.js';
|
|
4
|
+
import { RELATIONSHIPS_FILENAME } from '../constants/codebase-context.js';
|
|
5
|
+
export const definition = {
|
|
6
|
+
name: 'detect_circular_dependencies',
|
|
7
|
+
description: 'Analyze the import graph to detect circular dependencies between files. ' +
|
|
8
|
+
'Circular dependencies can cause initialization issues, tight coupling, and maintenance problems. ' +
|
|
9
|
+
'Returns all detected cycles sorted by length (shorter cycles are often more problematic).',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
type: 'object',
|
|
12
|
+
properties: {
|
|
13
|
+
scope: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: "Optional path prefix to limit analysis (e.g., 'src/features', 'libs/shared')"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export async function handle(args, ctx) {
|
|
21
|
+
const { scope } = args;
|
|
22
|
+
try {
|
|
23
|
+
// Try relationships sidecar first (preferred), then intelligence
|
|
24
|
+
let graphDataSource = null;
|
|
25
|
+
let graphStats = null;
|
|
26
|
+
const relationshipsPath = path.join(path.dirname(ctx.paths.intelligence), RELATIONSHIPS_FILENAME);
|
|
27
|
+
try {
|
|
28
|
+
const relationshipsContent = await fs.readFile(relationshipsPath, 'utf-8');
|
|
29
|
+
const relationships = JSON.parse(relationshipsContent);
|
|
30
|
+
if (relationships?.graph) {
|
|
31
|
+
graphDataSource = relationships.graph;
|
|
32
|
+
graphStats = relationships.stats;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Relationships sidecar not available, try intelligence
|
|
37
|
+
}
|
|
38
|
+
if (!graphDataSource) {
|
|
39
|
+
const intelligencePath = ctx.paths.intelligence;
|
|
40
|
+
const content = await fs.readFile(intelligencePath, 'utf-8');
|
|
41
|
+
const intelligence = JSON.parse(content);
|
|
42
|
+
if (intelligence.internalFileGraph) {
|
|
43
|
+
graphDataSource = intelligence.internalFileGraph;
|
|
44
|
+
graphStats = intelligence.internalFileGraph.stats;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (!graphDataSource) {
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: 'text',
|
|
52
|
+
text: JSON.stringify({
|
|
53
|
+
status: 'error',
|
|
54
|
+
message: 'Internal file graph not found. Please run refresh_index to rebuild the index with cycle detection support.'
|
|
55
|
+
}, null, 2)
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// Reconstruct the graph from stored data
|
|
61
|
+
const graph = InternalFileGraph.fromJSON(graphDataSource, ctx.rootPath);
|
|
62
|
+
const cycles = graph.findCycles(scope);
|
|
63
|
+
const stats = graphStats || graph.getStats();
|
|
64
|
+
if (cycles.length === 0) {
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: JSON.stringify({
|
|
70
|
+
status: 'success',
|
|
71
|
+
message: scope
|
|
72
|
+
? `No circular dependencies detected in scope: ${scope}`
|
|
73
|
+
: 'No circular dependencies detected in the codebase.',
|
|
74
|
+
scope,
|
|
75
|
+
graphStats: stats
|
|
76
|
+
}, null, 2)
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: 'text',
|
|
85
|
+
text: JSON.stringify({
|
|
86
|
+
status: 'warning',
|
|
87
|
+
message: `Found ${cycles.length} circular dependency cycle(s).`,
|
|
88
|
+
scope,
|
|
89
|
+
cycles: cycles.map((c) => ({
|
|
90
|
+
files: c.files,
|
|
91
|
+
length: c.length,
|
|
92
|
+
severity: c.length === 2 ? 'high' : c.length <= 3 ? 'medium' : 'low'
|
|
93
|
+
})),
|
|
94
|
+
count: cycles.length,
|
|
95
|
+
graphStats: stats,
|
|
96
|
+
advice: 'Shorter cycles (length 2-3) are typically more problematic. Consider breaking the cycle by extracting shared dependencies.'
|
|
97
|
+
}, null, 2)
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: 'text',
|
|
107
|
+
text: JSON.stringify({
|
|
108
|
+
status: 'error',
|
|
109
|
+
message: 'Failed to detect circular dependencies. Run indexing first.',
|
|
110
|
+
error: error instanceof Error ? error.message : String(error)
|
|
111
|
+
}, null, 2)
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=detect-circular-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-circular-dependencies.js","sourceRoot":"","sources":["../../src/tools/detect-circular-dependencies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AA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EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,MAAM,EAAE,SAAS;wBACjB,OAAO,EAAE,SAAS,MAAM,CAAC,MAAM,gCAAgC;wBAC/D,KAAK;wBACL,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;4BACzB,KAAK,EAAE,CAAC,CAAC,KAAK;4BACd,MAAM,EAAE,CAAC,CAAC,MAAM;4BAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK;yBACrE,CAAC,CAAC;wBACH,KAAK,EAAE,MAAM,CAAC,MAAM;wBACpB,UAAU,EAAE,KAAK;wBACjB,MAAM,EACJ,4HAA4H;qBAC/H,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,MAAM,EAAE,OAAO;wBACf,OAAO,EAAE,6DAA6D;wBACtE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolContext, ToolResponse } from './types.js';
|
|
3
|
+
export declare const definition: Tool;
|
|
4
|
+
export declare function handle(_args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
|
|
5
|
+
//# sourceMappingURL=get-codebase-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-codebase-metadata.d.ts","sourceRoot":"","sources":["../../src/tools/get-codebase-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG5D,eAAO,MAAM,UAAU,EAAE,IASxB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CA8CvB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import { CodebaseIndexer } from '../core/indexer.js';
|
|
3
|
+
export const definition = {
|
|
4
|
+
name: 'get_codebase_metadata',
|
|
5
|
+
description: 'Get codebase metadata including framework information, dependencies, architecture patterns, ' +
|
|
6
|
+
'and project statistics.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export async function handle(_args, ctx) {
|
|
13
|
+
const indexer = new CodebaseIndexer({ rootPath: ctx.rootPath });
|
|
14
|
+
const metadata = await indexer.detectMetadata();
|
|
15
|
+
// Load team patterns from intelligence file
|
|
16
|
+
let teamPatterns = {};
|
|
17
|
+
try {
|
|
18
|
+
const intelligencePath = ctx.paths.intelligence;
|
|
19
|
+
const intelligenceContent = await fs.readFile(intelligencePath, 'utf-8');
|
|
20
|
+
const intelligence = JSON.parse(intelligenceContent);
|
|
21
|
+
if (intelligence.patterns) {
|
|
22
|
+
teamPatterns = {
|
|
23
|
+
dependencyInjection: intelligence.patterns.dependencyInjection,
|
|
24
|
+
stateManagement: intelligence.patterns.stateManagement,
|
|
25
|
+
componentInputs: intelligence.patterns.componentInputs
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (_error) {
|
|
30
|
+
// No intelligence file or parsing error
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: JSON.stringify({
|
|
37
|
+
status: 'success',
|
|
38
|
+
metadata: {
|
|
39
|
+
name: metadata.name,
|
|
40
|
+
framework: metadata.framework,
|
|
41
|
+
languages: metadata.languages,
|
|
42
|
+
dependencies: metadata.dependencies.slice(0, 20),
|
|
43
|
+
architecture: metadata.architecture,
|
|
44
|
+
projectStructure: metadata.projectStructure,
|
|
45
|
+
statistics: metadata.statistics,
|
|
46
|
+
teamPatterns
|
|
47
|
+
}
|
|
48
|
+
}, null, 2)
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=get-codebase-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-codebase-metadata.js","sourceRoot":"","sources":["../../src/tools/get-codebase-metadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACT,8FAA8F;QAC9F,yBAAyB;IAC3B,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE;KACf;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,KAA8B,EAC9B,GAAgB;IAEhB,MAAM,OAAO,GAAG,IAAI,eAAe,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,MAAM,QAAQ,G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+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolContext, ToolResponse } from './types.js';
|
|
3
|
+
export declare const definition: Tool;
|
|
4
|
+
export declare function handle(_args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
|
|
5
|
+
//# sourceMappingURL=get-indexing-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-indexing-status.d.ts","sourceRoot":"","sources":["../../src/tools/get-indexing-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,eAAO,MAAM,UAAU,EAAE,IASxB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CAsCvB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const definition = {
|
|
2
|
+
name: 'get_indexing_status',
|
|
3
|
+
description: 'Get current indexing status: state, statistics, and progress. ' +
|
|
4
|
+
'Use refresh_index to manually trigger re-indexing when needed.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {}
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export async function handle(_args, ctx) {
|
|
11
|
+
const progress = ctx.indexState.indexer?.getProgress();
|
|
12
|
+
return {
|
|
13
|
+
content: [
|
|
14
|
+
{
|
|
15
|
+
type: 'text',
|
|
16
|
+
text: JSON.stringify({
|
|
17
|
+
status: ctx.indexState.status,
|
|
18
|
+
rootPath: ctx.rootPath,
|
|
19
|
+
lastIndexed: ctx.indexState.lastIndexed?.toISOString(),
|
|
20
|
+
stats: ctx.indexState.stats
|
|
21
|
+
? {
|
|
22
|
+
totalFiles: ctx.indexState.stats.totalFiles,
|
|
23
|
+
indexedFiles: ctx.indexState.stats.indexedFiles,
|
|
24
|
+
totalChunks: ctx.indexState.stats.totalChunks,
|
|
25
|
+
duration: `${(ctx.indexState.stats.duration / 1000).toFixed(2)}s`,
|
|
26
|
+
incremental: ctx.indexState.stats.incremental
|
|
27
|
+
}
|
|
28
|
+
: undefined,
|
|
29
|
+
progress: progress
|
|
30
|
+
? {
|
|
31
|
+
phase: progress.phase,
|
|
32
|
+
percentage: progress.percentage,
|
|
33
|
+
filesProcessed: progress.filesProcessed,
|
|
34
|
+
totalFiles: progress.totalFiles
|
|
35
|
+
}
|
|
36
|
+
: undefined,
|
|
37
|
+
error: ctx.indexState.error,
|
|
38
|
+
hint: 'Use refresh_index to manually trigger re-indexing when needed.'
|
|
39
|
+
}, null, 2)
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=get-indexing-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-indexing-status.js","sourceRoot":"","sources":["../../src/tools/get-indexing-status.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,gEAAgE;QAChE,gEAAgE;IAClE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE;KACf;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,KAA8B,EAC9B,GAAgB;IAEhB,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC;IAEvD,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oBACE,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC,MAAM;oBAC7B,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE;oBACtD,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK;wBACzB,CAAC,CAAC;4BACE,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU;4BAC3C,YAAY,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY;4BAC/C,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW;4BAC7C,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;4BACjE,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW;yBAC9C;wBACH,CAAC,CAAC,SAAS;oBACb,QAAQ,EAAE,QAAQ;wBAChB,CAAC,CAAC;4BACE,KAAK,EAAE,QAAQ,CAAC,KAAK;4BACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;4BAC/B,cAAc,EAAE,QAAQ,CAAC,cAAc;4BACvC,UAAU,EAAE,QAAQ,CAAC,UAAU;yBAChC;wBACH,CAAC,CAAC,SAAS;oBACb,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK;oBAC3B,IAAI,EAAE,gEAAgE;iBACvE,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolContext, ToolResponse } from './types.js';
|
|
3
|
+
export declare const definition: Tool;
|
|
4
|
+
export declare function handle(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
|
|
5
|
+
//# sourceMappingURL=get-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-memory.d.ts","sourceRoot":"","sources":["../../src/tools/get-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS5D,eAAO,MAAM,UAAU,EAAE,IAyBxB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CAkFvB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { readMemoriesFile, filterMemories, applyUnfilteredLimit, withConfidence } from '../memory/store.js';
|
|
2
|
+
export const definition = {
|
|
3
|
+
name: 'get_memory',
|
|
4
|
+
description: 'Retrieves team conventions, architectural decisions, and known gotchas.\n' +
|
|
5
|
+
'CALL BEFORE suggesting patterns, libraries, or architecture.\n\n' +
|
|
6
|
+
'Filters: category (tooling/architecture/testing/dependencies/conventions), type (convention/decision/gotcha), query (keyword search).',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
category: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Filter by category',
|
|
13
|
+
enum: ['tooling', 'architecture', 'testing', 'dependencies', 'conventions']
|
|
14
|
+
},
|
|
15
|
+
type: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'Filter by memory type',
|
|
18
|
+
enum: ['convention', 'decision', 'gotcha', 'failure']
|
|
19
|
+
},
|
|
20
|
+
query: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Keyword search across memory and reason'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export async function handle(args, ctx) {
|
|
28
|
+
const { category, type, query } = args;
|
|
29
|
+
try {
|
|
30
|
+
const memoryPath = ctx.paths.memory;
|
|
31
|
+
const allMemories = await readMemoriesFile(memoryPath);
|
|
32
|
+
if (allMemories.length === 0) {
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{
|
|
36
|
+
type: 'text',
|
|
37
|
+
text: JSON.stringify({
|
|
38
|
+
status: 'success',
|
|
39
|
+
message: "No team conventions recorded yet. Use 'remember' to build tribal knowledge or memory when the user corrects you over a repeatable pattern.",
|
|
40
|
+
memories: [],
|
|
41
|
+
count: 0
|
|
42
|
+
}, null, 2)
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const filtered = filterMemories(allMemories, { category, type, query });
|
|
48
|
+
const limited = applyUnfilteredLimit(filtered, { category, type, query }, 20);
|
|
49
|
+
// Enrich with confidence decay
|
|
50
|
+
const enriched = withConfidence(limited.memories);
|
|
51
|
+
const staleCount = enriched.filter((m) => m.stale).length;
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'text',
|
|
56
|
+
text: JSON.stringify({
|
|
57
|
+
status: 'success',
|
|
58
|
+
count: enriched.length,
|
|
59
|
+
totalCount: limited.totalCount,
|
|
60
|
+
truncated: limited.truncated,
|
|
61
|
+
...(staleCount > 0 && {
|
|
62
|
+
staleCount,
|
|
63
|
+
staleNote: `${staleCount} memor${staleCount === 1 ? 'y' : 'ies'} below 30% confidence. Consider reviewing or removing.`
|
|
64
|
+
}),
|
|
65
|
+
message: limited.truncated
|
|
66
|
+
? 'Showing 20 most recent. Use filters (category/type/query) for targeted results.'
|
|
67
|
+
: undefined,
|
|
68
|
+
memories: enriched
|
|
69
|
+
}, null, 2)
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: 'text',
|
|
79
|
+
text: JSON.stringify({
|
|
80
|
+
status: 'error',
|
|
81
|
+
message: 'Failed to retrieve memories.',
|
|
82
|
+
error: error instanceof Error ? error.message : String(error)
|
|
83
|
+
}, null, 2)
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=get-memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-memory.js","sourceRoot":"","sources":["../../src/tools/get-memory.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACf,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,2EAA2E;QAC3E,kEAAkE;QAClE,uIAAuI;IACzI,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oBAAoB;gBACjC,IAAI,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,CAAC;aAC5E;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uBAAuB;gBACpC,IAAI,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC;aACtD;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;aACvD;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,IAA6B,EAC7B,GAAgB;IAEhB,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAIjC,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;QACpC,MAAM,WAAW,GAAG,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAEvD,IAA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AAiF;4BACnF,CAAC,CAAC,SAAS;wBACb,QAAQ,EAAE,QAAQ;qBACnB,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,MAAM,EAAE,OAAO;wBACf,OAAO,EAAE,8BAA8B;wBACvC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAC9D,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolContext, ToolResponse } from './types.js';
|
|
3
|
+
export declare const definition: Tool;
|
|
4
|
+
export declare function handle(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
|
|
5
|
+
//# sourceMappingURL=get-style-guide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-style-guide.d.ts","sourceRoot":"","sources":["../../src/tools/get-style-guide.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAI/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,eAAO,MAAM,UAAU,EAAE,IAiBxB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CA4JvB"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import { glob } from 'glob';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
export const definition = {
|
|
5
|
+
name: 'get_style_guide',
|
|
6
|
+
description: 'Query style guide rules and architectural patterns from project documentation.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
query: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Query for specific style guide rules (e.g., "component naming", "service patterns")'
|
|
13
|
+
},
|
|
14
|
+
category: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Filter by category (naming, structure, patterns, testing)'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export async function handle(args, ctx) {
|
|
22
|
+
const { query, category } = args;
|
|
23
|
+
const queryStr = typeof query === 'string' ? query.trim() : '';
|
|
24
|
+
const queryLower = queryStr.toLowerCase();
|
|
25
|
+
const queryTerms = queryLower.split(/\s+/).filter(Boolean);
|
|
26
|
+
const categoryLower = typeof category === 'string' ? category.trim().toLowerCase() : '';
|
|
27
|
+
const limitedMode = queryTerms.length === 0;
|
|
28
|
+
const LIMITED_MAX_FILES = 3;
|
|
29
|
+
const LIMITED_MAX_SECTIONS_PER_FILE = 2;
|
|
30
|
+
const styleGuidePatterns = [
|
|
31
|
+
'STYLE_GUIDE.md',
|
|
32
|
+
'CODING_STYLE.md',
|
|
33
|
+
'ARCHITECTURE.md',
|
|
34
|
+
'CONTRIBUTING.md',
|
|
35
|
+
'docs/style-guide.md',
|
|
36
|
+
'docs/coding-style.md',
|
|
37
|
+
'docs/ARCHITECTURE.md'
|
|
38
|
+
];
|
|
39
|
+
const foundGuides = [];
|
|
40
|
+
for (const pattern of styleGuidePatterns) {
|
|
41
|
+
try {
|
|
42
|
+
const files = await glob(pattern, {
|
|
43
|
+
cwd: ctx.rootPath,
|
|
44
|
+
absolute: true
|
|
45
|
+
});
|
|
46
|
+
for (const file of files) {
|
|
47
|
+
try {
|
|
48
|
+
// Normalize line endings to \n for consistent output
|
|
49
|
+
const rawContent = await fs.readFile(file, 'utf-8');
|
|
50
|
+
const content = rawContent.replace(/\r\n/g, '\n');
|
|
51
|
+
const relativePath = path.relative(ctx.rootPath, file);
|
|
52
|
+
// Find relevant sections based on query
|
|
53
|
+
const sections = content.split(/^##\s+/m);
|
|
54
|
+
const relevantSections = [];
|
|
55
|
+
if (limitedMode) {
|
|
56
|
+
const headings = (content.match(/^##\s+.+$/gm) || [])
|
|
57
|
+
.map((h) => h.trim())
|
|
58
|
+
.filter(Boolean)
|
|
59
|
+
.slice(0, LIMITED_MAX_SECTIONS_PER_FILE);
|
|
60
|
+
if (headings.length > 0) {
|
|
61
|
+
relevantSections.push(...headings);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const words = content.split(/\s+/).filter(Boolean);
|
|
65
|
+
if (words.length > 0) {
|
|
66
|
+
relevantSections.push(`Overview: ${words.slice(0, 80).join(' ')}...`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
for (const section of sections) {
|
|
72
|
+
const sectionLower = section.toLowerCase();
|
|
73
|
+
const isRelevant = queryTerms.some((term) => sectionLower.includes(term));
|
|
74
|
+
if (isRelevant) {
|
|
75
|
+
// Limit section size to ~500 words
|
|
76
|
+
const words = section.split(/\s+/);
|
|
77
|
+
const truncated = words.slice(0, 500).join(' ');
|
|
78
|
+
relevantSections.push('## ' + (words.length > 500 ? truncated + '...' : section.trim()));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const categoryMatch = !categoryLower ||
|
|
83
|
+
relativePath.toLowerCase().includes(categoryLower) ||
|
|
84
|
+
relevantSections.some((section) => section.toLowerCase().includes(categoryLower));
|
|
85
|
+
if (!categoryMatch) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (relevantSections.length > 0) {
|
|
89
|
+
foundGuides.push({
|
|
90
|
+
file: relativePath,
|
|
91
|
+
content: content.slice(0, 200) + '...',
|
|
92
|
+
relevantSections: relevantSections.slice(0, limitedMode ? LIMITED_MAX_SECTIONS_PER_FILE : 3)
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (_e) {
|
|
97
|
+
// Skip unreadable files
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (_e) {
|
|
102
|
+
// Pattern didn't match, continue
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const results = limitedMode ? foundGuides.slice(0, LIMITED_MAX_FILES) : foundGuides;
|
|
106
|
+
if (results.length === 0) {
|
|
107
|
+
return {
|
|
108
|
+
content: [
|
|
109
|
+
{
|
|
110
|
+
type: 'text',
|
|
111
|
+
text: JSON.stringify({
|
|
112
|
+
status: 'no_results',
|
|
113
|
+
message: limitedMode
|
|
114
|
+
? 'No style guide files found in the default locations.'
|
|
115
|
+
: `No style guide content found matching: ${queryStr}`,
|
|
116
|
+
searchedPatterns: styleGuidePatterns,
|
|
117
|
+
hint: limitedMode
|
|
118
|
+
? "Run get_style_guide with a query or category (e.g. category: 'testing') for targeted results."
|
|
119
|
+
: "Try broader terms like 'naming', 'patterns', 'testing', 'components'"
|
|
120
|
+
}, null, 2)
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
content: [
|
|
127
|
+
{
|
|
128
|
+
type: 'text',
|
|
129
|
+
text: JSON.stringify({
|
|
130
|
+
status: 'success',
|
|
131
|
+
query: queryStr || undefined,
|
|
132
|
+
category,
|
|
133
|
+
limited: limitedMode,
|
|
134
|
+
notice: limitedMode
|
|
135
|
+
? 'No query provided. Results are capped. Provide query and/or category for targeted guidance.'
|
|
136
|
+
: undefined,
|
|
137
|
+
resultLimits: limitedMode
|
|
138
|
+
? {
|
|
139
|
+
maxFiles: LIMITED_MAX_FILES,
|
|
140
|
+
maxSectionsPerFile: LIMITED_MAX_SECTIONS_PER_FILE
|
|
141
|
+
}
|
|
142
|
+
: undefined,
|
|
143
|
+
results,
|
|
144
|
+
totalFiles: results.length,
|
|
145
|
+
totalMatches: foundGuides.length
|
|
146
|
+
}, null, 2)
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=get-style-guide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-style-guide.js","sourceRoot":"","sources":["../../src/tools/get-style-guide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,gFAAgF;IAC7F,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,qFAAqF;aACxF;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2DAA2D;aACzE;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,IAA6B,EAC7B,GAAgB;IAEhB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAG3B,CAAC;IACF,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,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AAW;4BAClB,CAAC,CAAC,sDAAsD;4BACxD,CAAC,CAAC,0CAA0C,QAAQ,EAAE;wBACxD,gBAAgB,EAAE,kBAAkB;wBACpC,IAAI,EAAE,WAAW;4BACf,CAAC,CAAC,+FAA+F;4BACjG,CAAC,CAAC,sEAAsE;qBAC3E,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oBACE,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,QAAQ,IAAI,SAAS;oBAC5B,QAAQ;oBACR,OAAO,EAAE,WAAW;oBACpB,MAAM,EAAE,WAAW;wBACjB,CAAC,CAAC,6FAA6F;wBAC/F,CAAC,CAAC,SAAS;oBACb,YAAY,EAAE,WAAW;wBACvB,CAAC,CAAC;4BACE,QAAQ,EAAE,iBAAiB;4BAC3B,kBAAkB,EAAE,6BAA6B;yBAClD;wBACH,CAAC,CAAC,SAAS;oBACb,OAAO;oBACP,UAAU,EAAE,OAAO,CAAC,MAAM;oBAC1B,YAAY,EAAE,WAAW,CAAC,MAAM;iBACjC,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolContext, ToolResponse } from './types.js';
|
|
3
|
+
export declare const definition: Tool;
|
|
4
|
+
export declare function handle(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
|
|
5
|
+
//# sourceMappingURL=get-symbol-references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-symbol-references.d.ts","sourceRoot":"","sources":["../../src/tools/get-symbol-references.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG5D,eAAO,MAAM,UAAU,EAAE,IAmBxB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CAiEvB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { findSymbolReferences } from '../core/symbol-references.js';
|
|
2
|
+
export const definition = {
|
|
3
|
+
name: 'get_symbol_references',
|
|
4
|
+
description: 'Find concrete references to a symbol in indexed chunks. Returns total usageCount and top usage snippets.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
symbol: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Symbol name to find references for (for example: parseConfig or UserService)'
|
|
11
|
+
},
|
|
12
|
+
limit: {
|
|
13
|
+
type: 'number',
|
|
14
|
+
description: 'Maximum number of usage snippets to return (default: 10)',
|
|
15
|
+
default: 10
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
required: ['symbol']
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export async function handle(args, ctx) {
|
|
22
|
+
const { symbol, limit } = args;
|
|
23
|
+
const normalizedSymbol = typeof symbol === 'string' ? symbol.trim() : '';
|
|
24
|
+
const normalizedLimit = typeof limit === 'number' && Number.isFinite(limit) && limit > 0 ? Math.floor(limit) : 10;
|
|
25
|
+
if (!normalizedSymbol) {
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: 'text',
|
|
30
|
+
text: JSON.stringify({
|
|
31
|
+
status: 'error',
|
|
32
|
+
message: "Invalid params: 'symbol' is required and must be a non-empty string."
|
|
33
|
+
}, null, 2)
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
isError: true
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const result = await findSymbolReferences(ctx.rootPath, normalizedSymbol, normalizedLimit);
|
|
40
|
+
if (result.status === 'error') {
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: JSON.stringify({
|
|
46
|
+
status: 'error',
|
|
47
|
+
symbol: normalizedSymbol,
|
|
48
|
+
message: result.message
|
|
49
|
+
}, null, 2)
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: JSON.stringify({
|
|
59
|
+
status: 'success',
|
|
60
|
+
symbol: result.symbol,
|
|
61
|
+
usageCount: result.usageCount,
|
|
62
|
+
usages: result.usages,
|
|
63
|
+
confidence: result.confidence,
|
|
64
|
+
isComplete: result.isComplete
|
|
65
|
+
}, null, 2)
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=get-symbol-references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-symbol-references.js","sourceRoot":"","sources":["../../src/tools/get-symbol-references.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACT,0GAA0G;IAC5G,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8EAA8E;aAC5F;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0DAA0D;gBACvE,OAAO,EAAE,EAAE;aACZ;SACF;QACD,QAAQ,EAAE,CAAC,QA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AAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;oBACE,MAAM,EAAE,SAAS;oBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,UAAU,EAAE,MAAM,CAAC,UAAU;iBAC9B,EACD,IAAI,EACJ,CAAC,CACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ToolContext, ToolResponse } from './types.js';
|
|
3
|
+
export declare const definition: Tool;
|
|
4
|
+
export declare function handle(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResponse>;
|
|
5
|
+
//# sourceMappingURL=get-team-patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-team-patterns.d.ts","sourceRoot":"","sources":["../../src/tools/get-team-patterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ5D,eAAO,MAAM,UAAU,EAAE,IAexB,CAAC;AAEF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,YAAY,CAAC,CAuIvB"}
|