claude-eidetic 0.1.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/dist/config.d.ts +87 -0
- package/dist/config.js +65 -0
- package/dist/core/indexer.d.ts +18 -0
- package/dist/core/indexer.js +169 -0
- package/dist/core/preview.d.ts +14 -0
- package/dist/core/preview.js +61 -0
- package/dist/core/searcher.d.ts +24 -0
- package/dist/core/searcher.js +101 -0
- package/dist/core/snapshot-io.d.ts +6 -0
- package/dist/core/snapshot-io.js +39 -0
- package/dist/core/sync.d.ts +35 -0
- package/dist/core/sync.js +188 -0
- package/dist/embedding/factory.d.ts +17 -0
- package/dist/embedding/factory.js +41 -0
- package/dist/embedding/openai.d.ts +45 -0
- package/dist/embedding/openai.js +243 -0
- package/dist/embedding/truncate.d.ts +6 -0
- package/dist/embedding/truncate.js +14 -0
- package/dist/embedding/types.d.ts +18 -0
- package/dist/embedding/types.js +2 -0
- package/dist/errors.d.ts +17 -0
- package/dist/errors.js +21 -0
- package/dist/format.d.ts +12 -0
- package/dist/format.js +97 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +109 -0
- package/dist/infra/qdrant-bootstrap.d.ts +2 -0
- package/dist/infra/qdrant-bootstrap.js +94 -0
- package/dist/paths.d.ts +11 -0
- package/dist/paths.js +41 -0
- package/dist/splitter/ast.d.ts +13 -0
- package/dist/splitter/ast.js +169 -0
- package/dist/splitter/line.d.ts +14 -0
- package/dist/splitter/line.js +109 -0
- package/dist/splitter/types.d.ts +11 -0
- package/dist/splitter/types.js +2 -0
- package/dist/state/registry.d.ts +8 -0
- package/dist/state/registry.js +33 -0
- package/dist/state/snapshot.d.ts +26 -0
- package/dist/state/snapshot.js +101 -0
- package/dist/tool-schemas.d.ts +135 -0
- package/dist/tool-schemas.js +162 -0
- package/dist/tools.d.ts +40 -0
- package/dist/tools.js +169 -0
- package/dist/vectordb/milvus.d.ts +33 -0
- package/dist/vectordb/milvus.js +328 -0
- package/dist/vectordb/qdrant.d.ts +51 -0
- package/dist/vectordb/qdrant.js +241 -0
- package/dist/vectordb/types.d.ts +35 -0
- package/dist/vectordb/types.js +2 -0
- package/package.json +62 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface CodeChunk {
|
|
2
|
+
content: string;
|
|
3
|
+
startLine: number;
|
|
4
|
+
endLine: number;
|
|
5
|
+
language: string;
|
|
6
|
+
filePath: string;
|
|
7
|
+
}
|
|
8
|
+
export interface Splitter {
|
|
9
|
+
split(code: string, language: string, filePath: string): CodeChunk[];
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Registry {
|
|
2
|
+
[project: string]: string;
|
|
3
|
+
}
|
|
4
|
+
export declare function registerProject(absolutePath: string): void;
|
|
5
|
+
export declare function resolveProject(project: string): string | undefined;
|
|
6
|
+
export declare function listProjects(): Registry;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getRegistryPath } from '../paths.js';
|
|
4
|
+
function readRegistry() {
|
|
5
|
+
const registryPath = getRegistryPath();
|
|
6
|
+
try {
|
|
7
|
+
const data = fs.readFileSync(registryPath, 'utf-8');
|
|
8
|
+
return JSON.parse(data);
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function writeRegistry(registry) {
|
|
15
|
+
const registryPath = getRegistryPath();
|
|
16
|
+
const dir = path.dirname(registryPath);
|
|
17
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
18
|
+
fs.writeFileSync(registryPath, JSON.stringify(registry, null, 2) + '\n', 'utf-8');
|
|
19
|
+
}
|
|
20
|
+
export function registerProject(absolutePath) {
|
|
21
|
+
const name = path.basename(absolutePath).toLowerCase();
|
|
22
|
+
const registry = readRegistry();
|
|
23
|
+
registry[name] = absolutePath;
|
|
24
|
+
writeRegistry(registry);
|
|
25
|
+
}
|
|
26
|
+
export function resolveProject(project) {
|
|
27
|
+
const registry = readRegistry();
|
|
28
|
+
return registry[project.toLowerCase()];
|
|
29
|
+
}
|
|
30
|
+
export function listProjects() {
|
|
31
|
+
return readRegistry();
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { VectorDB } from '../vectordb/types.js';
|
|
2
|
+
export type CodebaseStatus = 'idle' | 'indexing' | 'indexed' | 'error';
|
|
3
|
+
export interface CodebaseState {
|
|
4
|
+
path: string;
|
|
5
|
+
collectionName: string;
|
|
6
|
+
status: CodebaseStatus;
|
|
7
|
+
lastIndexed?: string;
|
|
8
|
+
totalFiles?: number;
|
|
9
|
+
totalChunks?: number;
|
|
10
|
+
error?: string;
|
|
11
|
+
progress?: number;
|
|
12
|
+
progressMessage?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class StateManager {
|
|
15
|
+
private states;
|
|
16
|
+
getState(normalizedPath: string): CodebaseState | undefined;
|
|
17
|
+
getAllStates(): CodebaseState[];
|
|
18
|
+
setIndexing(normalizedPath: string, collectionName: string): void;
|
|
19
|
+
updateProgress(normalizedPath: string, progress: number, message: string): void;
|
|
20
|
+
setIndexed(normalizedPath: string, totalFiles: number, totalChunks: number): void;
|
|
21
|
+
setError(normalizedPath: string, error: string): void;
|
|
22
|
+
remove(normalizedPath: string): void;
|
|
23
|
+
markExisting(normalizedPath: string, collectionName: string): void;
|
|
24
|
+
}
|
|
25
|
+
export declare function cleanupOrphanedSnapshots(vectordb: VectorDB): Promise<number>;
|
|
26
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getSnapshotDir } from '../paths.js';
|
|
4
|
+
export class StateManager {
|
|
5
|
+
states = new Map();
|
|
6
|
+
getState(normalizedPath) {
|
|
7
|
+
return this.states.get(normalizedPath);
|
|
8
|
+
}
|
|
9
|
+
getAllStates() {
|
|
10
|
+
return [...this.states.values()];
|
|
11
|
+
}
|
|
12
|
+
setIndexing(normalizedPath, collectionName) {
|
|
13
|
+
this.states.set(normalizedPath, {
|
|
14
|
+
path: normalizedPath,
|
|
15
|
+
collectionName,
|
|
16
|
+
status: 'indexing',
|
|
17
|
+
progress: 0,
|
|
18
|
+
progressMessage: 'Starting...',
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
updateProgress(normalizedPath, progress, message) {
|
|
22
|
+
const state = this.states.get(normalizedPath);
|
|
23
|
+
if (state) {
|
|
24
|
+
state.progress = progress;
|
|
25
|
+
state.progressMessage = message;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
setIndexed(normalizedPath, totalFiles, totalChunks) {
|
|
29
|
+
const state = this.states.get(normalizedPath);
|
|
30
|
+
if (state) {
|
|
31
|
+
state.status = 'indexed';
|
|
32
|
+
state.lastIndexed = new Date().toISOString();
|
|
33
|
+
state.totalFiles = totalFiles;
|
|
34
|
+
state.totalChunks = totalChunks;
|
|
35
|
+
state.progress = 100;
|
|
36
|
+
state.progressMessage = 'Done';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
setError(normalizedPath, error) {
|
|
40
|
+
const state = this.states.get(normalizedPath);
|
|
41
|
+
if (state) {
|
|
42
|
+
state.status = 'error';
|
|
43
|
+
state.error = error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
remove(normalizedPath) {
|
|
47
|
+
this.states.delete(normalizedPath);
|
|
48
|
+
}
|
|
49
|
+
markExisting(normalizedPath, collectionName) {
|
|
50
|
+
this.states.set(normalizedPath, {
|
|
51
|
+
path: normalizedPath,
|
|
52
|
+
collectionName,
|
|
53
|
+
status: 'indexed',
|
|
54
|
+
lastIndexed: 'unknown (pre-existing)',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export async function cleanupOrphanedSnapshots(vectordb) {
|
|
59
|
+
const snapshotDir = getSnapshotDir();
|
|
60
|
+
let cleaned = 0;
|
|
61
|
+
try {
|
|
62
|
+
if (!fs.existsSync(snapshotDir))
|
|
63
|
+
return 0;
|
|
64
|
+
const files = fs.readdirSync(snapshotDir).filter(f => f.endsWith('.json'));
|
|
65
|
+
if (files.length === 0)
|
|
66
|
+
return 0;
|
|
67
|
+
// Connectivity probe: use a name unlikely to exist. If hasCollection throws
|
|
68
|
+
// or the vector DB is unreachable (Qdrant's hasCollection returns false on
|
|
69
|
+
// network error), we must not proceed -- deleting snapshots when we cannot
|
|
70
|
+
// confirm collection absence would destroy valid state.
|
|
71
|
+
const probeResult = await vectordb.hasCollection('__eidetic_connectivity_probe__');
|
|
72
|
+
// If the probe returns true for a name that should never exist, something is
|
|
73
|
+
// wrong -- skip cleanup to be safe.
|
|
74
|
+
if (probeResult) {
|
|
75
|
+
console.warn('Orphan cleanup skipped: connectivity probe returned unexpected result.');
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
for (const file of files) {
|
|
79
|
+
const collectionName = path.basename(file, '.json');
|
|
80
|
+
try {
|
|
81
|
+
const exists = await vectordb.hasCollection(collectionName);
|
|
82
|
+
if (!exists) {
|
|
83
|
+
const filePath = path.join(snapshotDir, file);
|
|
84
|
+
fs.unlinkSync(filePath);
|
|
85
|
+
console.log(`Cleaned orphaned snapshot: ${collectionName}`);
|
|
86
|
+
cleaned++;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
// Network error for this specific check -- skip rather than risk deletion
|
|
91
|
+
console.warn(`Skipping orphan check for ${collectionName}: ${err}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
// Connectivity probe failure or filesystem error -- skip cleanup entirely
|
|
97
|
+
console.warn(`Orphan cleanup skipped: ${err}`);
|
|
98
|
+
}
|
|
99
|
+
return cleaned;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export declare const TOOL_DEFINITIONS: readonly [{
|
|
2
|
+
readonly name: "index_codebase";
|
|
3
|
+
readonly description: "Index a codebase directory to enable semantic search using a configurable code splitter.\n\nProvide either `path` (absolute) or `project` (name). Use `list_indexed` to see registered projects.\n\nUsage Guidance:\n- Use dryRun=true first to preview what files would be indexed and catch configuration issues before committing to a full index.\n- This tool is typically used when search fails due to an unindexed codebase.\n- If indexing is attempted on an already indexed path, and a conflict is detected, you MUST prompt the user to confirm whether to proceed with a force index.";
|
|
4
|
+
readonly inputSchema: {
|
|
5
|
+
readonly type: "object";
|
|
6
|
+
readonly properties: {
|
|
7
|
+
readonly path: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly description: "Absolute path to the codebase directory to index.";
|
|
10
|
+
};
|
|
11
|
+
readonly project: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "Project name (resolves via registry). Use list_indexed to see registered projects.";
|
|
14
|
+
};
|
|
15
|
+
readonly force: {
|
|
16
|
+
readonly type: "boolean";
|
|
17
|
+
readonly description: "Force re-indexing even if already indexed";
|
|
18
|
+
readonly default: false;
|
|
19
|
+
};
|
|
20
|
+
readonly dryRun: {
|
|
21
|
+
readonly type: "boolean";
|
|
22
|
+
readonly description: "Preview what would be indexed without actually indexing. Returns file counts by extension, top directories, estimated cost, and warnings.";
|
|
23
|
+
readonly default: false;
|
|
24
|
+
};
|
|
25
|
+
readonly customExtensions: {
|
|
26
|
+
readonly type: "array";
|
|
27
|
+
readonly items: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
};
|
|
30
|
+
readonly description: "Additional file extensions to include beyond defaults (e.g., [\".dart\", \".arb\"]). Extensions should include the dot prefix.";
|
|
31
|
+
readonly default: readonly [];
|
|
32
|
+
};
|
|
33
|
+
readonly customIgnorePatterns: {
|
|
34
|
+
readonly type: "array";
|
|
35
|
+
readonly items: {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
};
|
|
38
|
+
readonly description: "Additional glob patterns to exclude (e.g., [\"**/Pods/**\", \"**/DerivedData/**\"]).";
|
|
39
|
+
readonly default: readonly [];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly required: readonly [];
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "search_code";
|
|
46
|
+
readonly description: "Search the indexed codebase using natural language queries.\n\nProvide either `path` (absolute) or `project` (name). Use `list_indexed` to see registered projects.\n\nWhen to Use:\n- Code search: Find specific functions, classes, or implementations\n- Context-aware assistance: Gather relevant code context before making changes\n- Issue identification: Locate problematic code sections or bugs\n- Code review: Understand existing implementations and patterns\n- Refactoring: Find all related code pieces that need to be updated\n- Feature development: Understand existing architecture and similar implementations\n- Duplicate detection: Identify redundant or duplicated code patterns\n\nIf the codebase is not indexed, this tool will return a clear error message indicating that indexing is required first.";
|
|
47
|
+
readonly inputSchema: {
|
|
48
|
+
readonly type: "object";
|
|
49
|
+
readonly properties: {
|
|
50
|
+
readonly path: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly description: "Absolute path to the codebase directory to search in.";
|
|
53
|
+
};
|
|
54
|
+
readonly project: {
|
|
55
|
+
readonly type: "string";
|
|
56
|
+
readonly description: "Project name (resolves via registry). Use list_indexed to see registered projects.";
|
|
57
|
+
};
|
|
58
|
+
readonly query: {
|
|
59
|
+
readonly type: "string";
|
|
60
|
+
readonly description: "Natural language query to search for in the codebase";
|
|
61
|
+
};
|
|
62
|
+
readonly limit: {
|
|
63
|
+
readonly type: "number";
|
|
64
|
+
readonly description: "Maximum number of results to return";
|
|
65
|
+
readonly default: 10;
|
|
66
|
+
readonly maximum: 50;
|
|
67
|
+
};
|
|
68
|
+
readonly extensionFilter: {
|
|
69
|
+
readonly type: "array";
|
|
70
|
+
readonly items: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
};
|
|
73
|
+
readonly description: "Optional: List of file extensions to filter results (e.g., [\".ts\", \".py\"]).";
|
|
74
|
+
readonly default: readonly [];
|
|
75
|
+
};
|
|
76
|
+
readonly compact: {
|
|
77
|
+
readonly type: "boolean";
|
|
78
|
+
readonly description: "Return compact table (file, lines, score, ~tokens) instead of full code snippets. Use Read tool to fetch interesting results. Default: true.";
|
|
79
|
+
readonly default: true;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
readonly required: readonly ["query"];
|
|
83
|
+
};
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "clear_index";
|
|
86
|
+
readonly description: "Clear the search index. Provide either `path` (absolute) or `project` (name). Use `list_indexed` to see registered projects.";
|
|
87
|
+
readonly inputSchema: {
|
|
88
|
+
readonly type: "object";
|
|
89
|
+
readonly properties: {
|
|
90
|
+
readonly path: {
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly description: "Absolute path to the codebase directory to clear.";
|
|
93
|
+
};
|
|
94
|
+
readonly project: {
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
readonly description: "Project name (resolves via registry). Use list_indexed to see registered projects.";
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
readonly required: readonly [];
|
|
100
|
+
};
|
|
101
|
+
}, {
|
|
102
|
+
readonly name: "get_indexing_status";
|
|
103
|
+
readonly description: "Get the current indexing status of a codebase. Provide either `path` (absolute) or `project` (name). Use `list_indexed` to see registered projects.";
|
|
104
|
+
readonly inputSchema: {
|
|
105
|
+
readonly type: "object";
|
|
106
|
+
readonly properties: {
|
|
107
|
+
readonly path: {
|
|
108
|
+
readonly type: "string";
|
|
109
|
+
readonly description: "Absolute path to the codebase directory to check status for.";
|
|
110
|
+
};
|
|
111
|
+
readonly project: {
|
|
112
|
+
readonly type: "string";
|
|
113
|
+
readonly description: "Project name (resolves via registry). Use list_indexed to see registered projects.";
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
readonly required: readonly [];
|
|
117
|
+
};
|
|
118
|
+
}, {
|
|
119
|
+
readonly name: "list_indexed";
|
|
120
|
+
readonly description: "List all currently indexed codebases with their status. Returns paths, file/chunk counts, and indexing status for all known codebases in this session.";
|
|
121
|
+
readonly inputSchema: {
|
|
122
|
+
readonly type: "object";
|
|
123
|
+
readonly properties: {};
|
|
124
|
+
readonly required: readonly [];
|
|
125
|
+
};
|
|
126
|
+
}, {
|
|
127
|
+
readonly name: "__IMPORTANT";
|
|
128
|
+
readonly description: "Workflow guidance for efficient code search. ALWAYS index before searching. Use project names after first index. Use extensionFilter to narrow results.";
|
|
129
|
+
readonly inputSchema: {
|
|
130
|
+
readonly type: "object";
|
|
131
|
+
readonly properties: {};
|
|
132
|
+
readonly required: readonly [];
|
|
133
|
+
};
|
|
134
|
+
}];
|
|
135
|
+
//# sourceMappingURL=tool-schemas.d.ts.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const INDEX_DESCRIPTION = `\
|
|
2
|
+
Index a codebase directory to enable semantic search using a configurable code splitter.
|
|
3
|
+
|
|
4
|
+
Provide either \`path\` (absolute) or \`project\` (name). Use \`list_indexed\` to see registered projects.
|
|
5
|
+
|
|
6
|
+
Usage Guidance:
|
|
7
|
+
- Use dryRun=true first to preview what files would be indexed and catch configuration issues before committing to a full index.
|
|
8
|
+
- This tool is typically used when search fails due to an unindexed codebase.
|
|
9
|
+
- If indexing is attempted on an already indexed path, and a conflict is detected, \
|
|
10
|
+
you MUST prompt the user to confirm whether to proceed with a force index.`;
|
|
11
|
+
const SEARCH_DESCRIPTION = `\
|
|
12
|
+
Search the indexed codebase using natural language queries.
|
|
13
|
+
|
|
14
|
+
Provide either \`path\` (absolute) or \`project\` (name). Use \`list_indexed\` to see registered projects.
|
|
15
|
+
|
|
16
|
+
When to Use:
|
|
17
|
+
- Code search: Find specific functions, classes, or implementations
|
|
18
|
+
- Context-aware assistance: Gather relevant code context before making changes
|
|
19
|
+
- Issue identification: Locate problematic code sections or bugs
|
|
20
|
+
- Code review: Understand existing implementations and patterns
|
|
21
|
+
- Refactoring: Find all related code pieces that need to be updated
|
|
22
|
+
- Feature development: Understand existing architecture and similar implementations
|
|
23
|
+
- Duplicate detection: Identify redundant or duplicated code patterns
|
|
24
|
+
|
|
25
|
+
If the codebase is not indexed, this tool will return a clear error message \
|
|
26
|
+
indicating that indexing is required first.`;
|
|
27
|
+
export const TOOL_DEFINITIONS = [
|
|
28
|
+
{
|
|
29
|
+
name: 'index_codebase',
|
|
30
|
+
description: INDEX_DESCRIPTION,
|
|
31
|
+
inputSchema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
path: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Absolute path to the codebase directory to index.',
|
|
37
|
+
},
|
|
38
|
+
project: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'Project name (resolves via registry). Use list_indexed to see registered projects.',
|
|
41
|
+
},
|
|
42
|
+
force: {
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
description: 'Force re-indexing even if already indexed',
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
dryRun: {
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
description: 'Preview what would be indexed without actually indexing. Returns file counts by extension, top directories, estimated cost, and warnings.',
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
customExtensions: {
|
|
53
|
+
type: 'array',
|
|
54
|
+
items: { type: 'string' },
|
|
55
|
+
description: 'Additional file extensions to include beyond defaults (e.g., [".dart", ".arb"]). Extensions should include the dot prefix.',
|
|
56
|
+
default: [],
|
|
57
|
+
},
|
|
58
|
+
customIgnorePatterns: {
|
|
59
|
+
type: 'array',
|
|
60
|
+
items: { type: 'string' },
|
|
61
|
+
description: 'Additional glob patterns to exclude (e.g., ["**/Pods/**", "**/DerivedData/**"]).',
|
|
62
|
+
default: [],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
required: [],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'search_code',
|
|
70
|
+
description: SEARCH_DESCRIPTION,
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: {
|
|
74
|
+
path: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
description: 'Absolute path to the codebase directory to search in.',
|
|
77
|
+
},
|
|
78
|
+
project: {
|
|
79
|
+
type: 'string',
|
|
80
|
+
description: 'Project name (resolves via registry). Use list_indexed to see registered projects.',
|
|
81
|
+
},
|
|
82
|
+
query: {
|
|
83
|
+
type: 'string',
|
|
84
|
+
description: 'Natural language query to search for in the codebase',
|
|
85
|
+
},
|
|
86
|
+
limit: {
|
|
87
|
+
type: 'number',
|
|
88
|
+
description: 'Maximum number of results to return',
|
|
89
|
+
default: 10,
|
|
90
|
+
maximum: 50,
|
|
91
|
+
},
|
|
92
|
+
extensionFilter: {
|
|
93
|
+
type: 'array',
|
|
94
|
+
items: { type: 'string' },
|
|
95
|
+
description: 'Optional: List of file extensions to filter results (e.g., [".ts", ".py"]).',
|
|
96
|
+
default: [],
|
|
97
|
+
},
|
|
98
|
+
compact: {
|
|
99
|
+
type: 'boolean',
|
|
100
|
+
description: 'Return compact table (file, lines, score, ~tokens) instead of full code snippets. Use Read tool to fetch interesting results. Default: true.',
|
|
101
|
+
default: true,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
required: ['query'],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'clear_index',
|
|
109
|
+
description: 'Clear the search index. Provide either `path` (absolute) or `project` (name). Use `list_indexed` to see registered projects.',
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
path: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
description: 'Absolute path to the codebase directory to clear.',
|
|
116
|
+
},
|
|
117
|
+
project: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: 'Project name (resolves via registry). Use list_indexed to see registered projects.',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
required: [],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'get_indexing_status',
|
|
127
|
+
description: 'Get the current indexing status of a codebase. Provide either `path` (absolute) or `project` (name). Use `list_indexed` to see registered projects.',
|
|
128
|
+
inputSchema: {
|
|
129
|
+
type: 'object',
|
|
130
|
+
properties: {
|
|
131
|
+
path: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
description: 'Absolute path to the codebase directory to check status for.',
|
|
134
|
+
},
|
|
135
|
+
project: {
|
|
136
|
+
type: 'string',
|
|
137
|
+
description: 'Project name (resolves via registry). Use list_indexed to see registered projects.',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
required: [],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'list_indexed',
|
|
145
|
+
description: 'List all currently indexed codebases with their status. Returns paths, file/chunk counts, and indexing status for all known codebases in this session.',
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {},
|
|
149
|
+
required: [],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: '__IMPORTANT',
|
|
154
|
+
description: 'Workflow guidance for efficient code search. ALWAYS index before searching. Use project names after first index. Use extensionFilter to narrow results.',
|
|
155
|
+
inputSchema: {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {},
|
|
158
|
+
required: [],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
//# sourceMappingURL=tool-schemas.js.map
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { StateManager } from './state/snapshot.js';
|
|
2
|
+
import type { Embedding } from './embedding/types.js';
|
|
3
|
+
import type { VectorDB } from './vectordb/types.js';
|
|
4
|
+
export declare class ToolHandlers {
|
|
5
|
+
private embedding;
|
|
6
|
+
private vectordb;
|
|
7
|
+
private state;
|
|
8
|
+
constructor(embedding: Embedding, vectordb: VectorDB, state: StateManager);
|
|
9
|
+
handleIndexCodebase(args: Record<string, unknown>): Promise<{
|
|
10
|
+
content: {
|
|
11
|
+
type: string;
|
|
12
|
+
text: string;
|
|
13
|
+
}[];
|
|
14
|
+
}>;
|
|
15
|
+
handleSearchCode(args: Record<string, unknown>): Promise<{
|
|
16
|
+
content: {
|
|
17
|
+
type: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}[];
|
|
20
|
+
}>;
|
|
21
|
+
handleClearIndex(args: Record<string, unknown>): Promise<{
|
|
22
|
+
content: {
|
|
23
|
+
type: string;
|
|
24
|
+
text: string;
|
|
25
|
+
}[];
|
|
26
|
+
}>;
|
|
27
|
+
handleGetIndexingStatus(args: Record<string, unknown>): Promise<{
|
|
28
|
+
content: {
|
|
29
|
+
type: string;
|
|
30
|
+
text: string;
|
|
31
|
+
}[];
|
|
32
|
+
}>;
|
|
33
|
+
handleListIndexed(): Promise<{
|
|
34
|
+
content: {
|
|
35
|
+
type: string;
|
|
36
|
+
text: string;
|
|
37
|
+
}[];
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=tools.d.ts.map
|