claude-eidetic 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +0 -4
- package/dist/index.js +36 -17
- package/dist/setup-message.d.ts +3 -0
- package/dist/setup-message.js +23 -0
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -49,10 +49,6 @@ export function loadConfig() {
|
|
|
49
49
|
throw new ConfigError(`Invalid configuration:\n${issues}`);
|
|
50
50
|
}
|
|
51
51
|
const config = result.data;
|
|
52
|
-
if (config.embeddingProvider === 'openai' && !config.openaiApiKey) {
|
|
53
|
-
throw new ConfigError('OPENAI_API_KEY is required when EMBEDDING_PROVIDER is "openai" (the default). ' +
|
|
54
|
-
'Set EMBEDDING_PROVIDER=ollama or EMBEDDING_PROVIDER=local to use a local embedding server.');
|
|
55
|
-
}
|
|
56
52
|
cachedConfig = config;
|
|
57
53
|
return cachedConfig;
|
|
58
54
|
}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { bootstrapQdrant } from './infra/qdrant-bootstrap.js';
|
|
|
17
17
|
import { StateManager, cleanupOrphanedSnapshots } from './state/snapshot.js';
|
|
18
18
|
import { ToolHandlers } from './tools.js';
|
|
19
19
|
import { TOOL_DEFINITIONS } from './tool-schemas.js';
|
|
20
|
+
import { getSetupErrorMessage } from './setup-message.js';
|
|
20
21
|
const WORKFLOW_GUIDANCE = `# Eidetic Code Search Workflow
|
|
21
22
|
|
|
22
23
|
**Before searching:** Ensure the codebase is indexed.
|
|
@@ -43,31 +44,49 @@ const WORKFLOW_GUIDANCE = `# Eidetic Code Search Workflow
|
|
|
43
44
|
async function main() {
|
|
44
45
|
const config = loadConfig();
|
|
45
46
|
console.log(`Config loaded. Provider: ${config.vectordbProvider}, Model: ${config.embeddingModel}`);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
vectordb
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
let handlers = null;
|
|
48
|
+
let setupError = null;
|
|
49
|
+
try {
|
|
50
|
+
const embedding = createEmbedding(config);
|
|
51
|
+
await embedding.initialize();
|
|
52
|
+
let vectordb;
|
|
53
|
+
if (config.vectordbProvider === 'milvus') {
|
|
54
|
+
const { MilvusVectorDB } = await import('./vectordb/milvus.js');
|
|
55
|
+
vectordb = new MilvusVectorDB();
|
|
56
|
+
console.log(`Using Milvus at ${config.milvusAddress}`);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const qdrantUrl = await bootstrapQdrant();
|
|
60
|
+
vectordb = new QdrantVectorDB(qdrantUrl);
|
|
61
|
+
console.log(`Using Qdrant at ${qdrantUrl}`);
|
|
62
|
+
}
|
|
63
|
+
const cleaned = await cleanupOrphanedSnapshots(vectordb);
|
|
64
|
+
if (cleaned > 0) {
|
|
65
|
+
console.log(`Cleaned ${cleaned} orphaned snapshot(s).`);
|
|
66
|
+
}
|
|
67
|
+
const state = new StateManager();
|
|
68
|
+
handlers = new ToolHandlers(embedding, vectordb, state);
|
|
58
69
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
console.
|
|
70
|
+
catch (err) {
|
|
71
|
+
setupError = err instanceof Error ? err.message : String(err);
|
|
72
|
+
console.warn(`Eidetic initialization failed: ${setupError}`);
|
|
73
|
+
console.warn('Server will start in setup-required mode. All tool calls will return setup instructions.');
|
|
62
74
|
}
|
|
63
|
-
const state = new StateManager();
|
|
64
|
-
const handlers = new ToolHandlers(embedding, vectordb, state);
|
|
65
75
|
const server = new Server({ name: 'claude-eidetic', version: '0.1.0' }, { capabilities: { tools: {} } });
|
|
66
76
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
67
77
|
tools: [...TOOL_DEFINITIONS],
|
|
68
78
|
}));
|
|
69
79
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
70
80
|
const { name, arguments: args } = request.params;
|
|
81
|
+
if (!handlers) {
|
|
82
|
+
return {
|
|
83
|
+
content: [{
|
|
84
|
+
type: 'text',
|
|
85
|
+
text: getSetupErrorMessage(setupError ?? 'Unknown error'),
|
|
86
|
+
}],
|
|
87
|
+
isError: true,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
71
90
|
switch (name) {
|
|
72
91
|
case 'index_codebase':
|
|
73
92
|
return handlers.handleIndexCodebase(args ?? {});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Centralized setup/error messages — easy to update links and instructions. */
|
|
2
|
+
const OPENAI_KEY_URL = 'https://platform.openai.com/api-keys';
|
|
3
|
+
export function getSetupErrorMessage(errorDetail) {
|
|
4
|
+
return (`Eidetic setup required: ${errorDetail}\n\n` +
|
|
5
|
+
'## How to fix\n\n' +
|
|
6
|
+
`1. **Get an API key**: ${OPENAI_KEY_URL}\n` +
|
|
7
|
+
'2. **Add it to your config** (pick one):\n\n' +
|
|
8
|
+
'### Quick (CLI)\n\n' +
|
|
9
|
+
'```\nclaude mcp update claude-eidetic -e OPENAI_API_KEY=sk-your-key-here\n```\n\n' +
|
|
10
|
+
'### Manual\n\n' +
|
|
11
|
+
'Edit `~/.claude/plugins/claude-eidetic/config.json`:\n' +
|
|
12
|
+
'```json\n' +
|
|
13
|
+
'{\n' +
|
|
14
|
+
' "env": {\n' +
|
|
15
|
+
' "OPENAI_API_KEY": "sk-your-key-here"\n' +
|
|
16
|
+
' }\n' +
|
|
17
|
+
'}\n' +
|
|
18
|
+
'```\n\n' +
|
|
19
|
+
'### Using Ollama instead (free, local)\n\n' +
|
|
20
|
+
'Set `EMBEDDING_PROVIDER=ollama` in the same env block (requires Ollama running locally with `nomic-embed-text`).\n\n' +
|
|
21
|
+
'3. **Restart Claude Code** for changes to take effect.');
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=setup-message.js.map
|