@mcampa/ai-context-core 0.0.2-beta.2250c7e → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +47 -55
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/context.d.ts +5 -30
  4. package/dist/context.d.ts.map +1 -1
  5. package/dist/context.js +16 -160
  6. package/dist/context.js.map +1 -1
  7. package/dist/embedding/base-embedding.d.ts.map +1 -1
  8. package/dist/embedding/base-embedding.js +0 -4
  9. package/dist/embedding/base-embedding.js.map +1 -1
  10. package/dist/embedding/gemini-embedding.d.ts +1 -43
  11. package/dist/embedding/gemini-embedding.d.ts.map +1 -1
  12. package/dist/embedding/gemini-embedding.js +26 -164
  13. package/dist/embedding/gemini-embedding.js.map +1 -1
  14. package/dist/embedding/index.d.ts +2 -3
  15. package/dist/embedding/index.d.ts.map +1 -1
  16. package/dist/embedding/index.js +2 -3
  17. package/dist/embedding/index.js.map +1 -1
  18. package/dist/embedding/ollama-embedding.d.ts +1 -2
  19. package/dist/embedding/ollama-embedding.d.ts.map +1 -1
  20. package/dist/embedding/ollama-embedding.js +3 -2
  21. package/dist/embedding/ollama-embedding.js.map +1 -1
  22. package/dist/embedding/openai-embedding.d.ts +1 -2
  23. package/dist/embedding/openai-embedding.d.ts.map +1 -1
  24. package/dist/embedding/openai-embedding.js +3 -3
  25. package/dist/embedding/openai-embedding.js.map +1 -1
  26. package/dist/embedding/voyageai-embedding.d.ts +1 -2
  27. package/dist/embedding/voyageai-embedding.d.ts.map +1 -1
  28. package/dist/embedding/voyageai-embedding.js +2 -2
  29. package/dist/embedding/voyageai-embedding.js.map +1 -1
  30. package/dist/index.d.ts +4 -4
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +4 -4
  33. package/dist/index.js.map +1 -1
  34. package/dist/splitter/ast-splitter.d.ts +1 -1
  35. package/dist/splitter/ast-splitter.d.ts.map +1 -1
  36. package/dist/splitter/ast-splitter.js +7 -7
  37. package/dist/splitter/ast-splitter.js.map +1 -1
  38. package/dist/splitter/index.d.ts +4 -4
  39. package/dist/splitter/index.d.ts.map +1 -1
  40. package/dist/splitter/index.js +1 -1
  41. package/dist/splitter/index.js.map +1 -1
  42. package/dist/splitter/langchain-splitter.d.ts +1 -1
  43. package/dist/splitter/langchain-splitter.d.ts.map +1 -1
  44. package/dist/splitter/langchain-splitter.js +2 -2
  45. package/dist/splitter/langchain-splitter.js.map +1 -1
  46. package/dist/sync/merkle.js +1 -1
  47. package/dist/sync/merkle.js.map +1 -1
  48. package/dist/sync/synchronizer.js +6 -6
  49. package/dist/sync/synchronizer.js.map +1 -1
  50. package/dist/utils/env-manager.js +4 -4
  51. package/dist/utils/env-manager.js.map +1 -1
  52. package/dist/vectordb/index.d.ts +4 -13
  53. package/dist/vectordb/index.d.ts.map +1 -1
  54. package/dist/vectordb/index.js +5 -39
  55. package/dist/vectordb/index.js.map +1 -1
  56. package/dist/vectordb/milvus-restful-vectordb.d.ts +11 -12
  57. package/dist/vectordb/milvus-restful-vectordb.d.ts.map +1 -1
  58. package/dist/vectordb/milvus-restful-vectordb.js +31 -29
  59. package/dist/vectordb/milvus-restful-vectordb.js.map +1 -1
  60. package/dist/vectordb/milvus-vectordb.d.ts +12 -12
  61. package/dist/vectordb/milvus-vectordb.d.ts.map +1 -1
  62. package/dist/vectordb/milvus-vectordb.js +28 -31
  63. package/dist/vectordb/milvus-vectordb.js.map +1 -1
  64. package/dist/vectordb/types.d.ts +16 -16
  65. package/dist/vectordb/types.d.ts.map +1 -1
  66. package/dist/vectordb/types.js.map +1 -1
  67. package/dist/vectordb/zilliz-utils.js +3 -3
  68. package/dist/vectordb/zilliz-utils.js.map +1 -1
  69. package/package.json +22 -32
  70. package/dist/embedding/huggingface-embedding.d.ts +0 -70
  71. package/dist/embedding/huggingface-embedding.d.ts.map +0 -1
  72. package/dist/embedding/huggingface-embedding.js +0 -270
  73. package/dist/embedding/huggingface-embedding.js.map +0 -1
  74. package/dist/vectordb/base/base-vector-database.d.ts +0 -58
  75. package/dist/vectordb/base/base-vector-database.d.ts.map +0 -1
  76. package/dist/vectordb/base/base-vector-database.js +0 -32
  77. package/dist/vectordb/base/base-vector-database.js.map +0 -1
  78. package/dist/vectordb/factory.d.ts +0 -113
  79. package/dist/vectordb/factory.d.ts.map +0 -1
  80. package/dist/vectordb/factory.js +0 -170
  81. package/dist/vectordb/factory.js.map +0 -1
  82. package/dist/vectordb/faiss-vectordb.d.ts +0 -162
  83. package/dist/vectordb/faiss-vectordb.d.ts.map +0 -1
  84. package/dist/vectordb/faiss-vectordb.js +0 -777
  85. package/dist/vectordb/faiss-vectordb.js.map +0 -1
  86. package/dist/vectordb/libsql-vectordb.d.ts +0 -170
  87. package/dist/vectordb/libsql-vectordb.d.ts.map +0 -1
  88. package/dist/vectordb/libsql-vectordb.js +0 -837
  89. package/dist/vectordb/libsql-vectordb.js.map +0 -1
  90. package/dist/vectordb/qdrant-vectordb.d.ts +0 -149
  91. package/dist/vectordb/qdrant-vectordb.d.ts.map +0 -1
  92. package/dist/vectordb/qdrant-vectordb.js +0 -856
  93. package/dist/vectordb/qdrant-vectordb.js.map +0 -1
  94. package/dist/vectordb/sparse/index.d.ts +0 -4
  95. package/dist/vectordb/sparse/index.d.ts.map +0 -1
  96. package/dist/vectordb/sparse/index.js +0 -23
  97. package/dist/vectordb/sparse/index.js.map +0 -1
  98. package/dist/vectordb/sparse/simple-bm25.d.ts +0 -115
  99. package/dist/vectordb/sparse/simple-bm25.d.ts.map +0 -1
  100. package/dist/vectordb/sparse/simple-bm25.js +0 -249
  101. package/dist/vectordb/sparse/simple-bm25.js.map +0 -1
  102. package/dist/vectordb/sparse/sparse-vector-generator.d.ts +0 -54
  103. package/dist/vectordb/sparse/sparse-vector-generator.d.ts.map +0 -1
  104. package/dist/vectordb/sparse/sparse-vector-generator.js +0 -3
  105. package/dist/vectordb/sparse/sparse-vector-generator.js.map +0 -1
  106. package/dist/vectordb/sparse/types.d.ts +0 -38
  107. package/dist/vectordb/sparse/types.d.ts.map +0 -1
  108. package/dist/vectordb/sparse/types.js +0 -3
  109. package/dist/vectordb/sparse/types.js.map +0 -1
package/README.md CHANGED
@@ -1,20 +1,18 @@
1
- # @mcampa/ai-context-core
1
+ # @mcampa/claude-context-core
2
2
 
3
3
  ![](../../assets/claude-context.png)
4
4
 
5
- The core indexing engine for Context Please - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.
5
+ The core indexing engine for Claude Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.
6
6
 
7
- > **Note:** This is a fork of [@zilliz/claude-context-core](https://www.npmjs.com/package/@zilliz/claude-context-core) by Zilliz, maintained by PleaseAI.
7
+ [![npm version](https://img.shields.io/npm/v/@mcampa/claude-context-core.svg)](https://www.npmjs.com/package/@mcampa/claude-context-core)
8
+ [![npm downloads](https://img.shields.io/npm/dm/@mcampa/claude-context-core.svg)](https://www.npmjs.com/package/@mcampa/claude-context-core)
8
9
 
9
- [![npm version](https://img.shields.io/npm/v/@mcampa/ai-context-core.svg)](https://www.npmjs.com/package/@mcampa/ai-context-core)
10
- [![npm downloads](https://img.shields.io/npm/dm/@mcampa/ai-context-core.svg)](https://www.npmjs.com/package/@mcampa/ai-context-core)
11
-
12
- > 📖 **New to Context Please?** Check out the [main project README](../../README.md) for an overview and quick start guide.
10
+ > 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.
13
11
 
14
12
  ## Installation
15
13
 
16
14
  ```bash
17
- npm install @mcampa/ai-context-core
15
+ npm install @mcampa/claude-context-core
18
16
  ```
19
17
 
20
18
  ### Prepare Environment Variables
@@ -35,7 +33,7 @@ Claude Context needs a vector database. You can [sign up](https://cloud.zilliz.c
35
33
 
36
34
  ![](../../assets/signup_and_create_cluster.jpeg)
37
35
 
38
- After creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.
36
+ After creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.
39
37
  These will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.
40
38
 
41
39
  ![Zilliz Cloud Dashboard](../../assets/zilliz_cloud_dashboard.jpeg)
@@ -56,9 +54,9 @@ MILVUS_TOKEN=your-zilliz-cloud-api-key
56
54
  ```typescript
57
55
  import {
58
56
  Context,
59
- MilvusVectorDatabase,
60
57
  OpenAIEmbedding,
61
- } from "@mcampa/ai-context-core";
58
+ MilvusVectorDatabase,
59
+ } from "@mcampa/claude-context-core";
62
60
 
63
61
  // Initialize embedding provider
64
62
  const embedding = new OpenAIEmbedding({
@@ -74,6 +72,7 @@ const vectorDatabase = new MilvusVectorDatabase({
74
72
 
75
73
  // Create context instance
76
74
  const context = new Context({
75
+ name: "my-context",
77
76
  embedding,
78
77
  vectorDatabase,
79
78
  });
@@ -89,7 +88,6 @@ console.log(
89
88
 
90
89
  // Search the codebase
91
90
  const results = await context.semanticSearch(
92
- "./my-project",
93
91
  "function that handles user authentication",
94
92
  5,
95
93
  );
@@ -144,6 +142,12 @@ interface ContextConfig {
144
142
  }
145
143
  ```
146
144
 
145
+ **Note on configuration behavior:**
146
+
147
+ - If you provide `supportedExtensions`, it **replaces** the default extensions entirely
148
+ - If you provide `ignorePatterns`, it **replaces** the default ignore patterns entirely
149
+ - `customExtensions` and `customIgnorePatterns` are **added** to whatever base is used (defaults or your custom ones)
150
+
147
151
  ### Supported File Extensions (Default)
148
152
 
149
153
  ```typescript
@@ -226,7 +230,7 @@ import {
226
230
  Context,
227
231
  MilvusVectorDatabase,
228
232
  VoyageAIEmbedding,
229
- } from "@mcampa/ai-context-core";
233
+ } from "@mcampa/claude-context-core";
230
234
 
231
235
  // Initialize with VoyageAI embedding provider
232
236
  const embedding = new VoyageAIEmbedding({
@@ -240,67 +244,55 @@ const vectorDatabase = new MilvusVectorDatabase({
240
244
  });
241
245
 
242
246
  const context = new Context({
247
+ name: "my-context",
243
248
  embedding,
244
249
  vectorDatabase,
245
250
  });
246
251
  ```
247
252
 
248
- ### Using Gemini Embeddings with Retry Configuration
253
+ ### Custom File Filtering
249
254
 
250
255
  ```typescript
251
- import {
252
- Context,
253
- MilvusVectorDatabase,
254
- GeminiEmbedding,
255
- } from "@mcampa/ai-context-core";
256
-
257
- // Initialize with Gemini embedding provider
258
- const embedding = new GeminiEmbedding({
259
- apiKey: process.env.GEMINI_API_KEY || "your-gemini-api-key",
260
- model: "gemini-embedding-001",
261
- outputDimensionality: 768, // Optional: Matryoshka Representation Learning support (256, 768, 1536, 3072)
262
- maxRetries: 3, // Optional: Maximum retry attempts (default: 3)
263
- baseDelay: 1000, // Optional: Base delay in ms for exponential backoff (default: 1000ms)
264
- });
265
-
266
- const vectorDatabase = new MilvusVectorDatabase({
267
- address: process.env.MILVUS_ADDRESS || "localhost:19530",
268
- token: process.env.MILVUS_TOKEN || "",
256
+ // Replace default extensions and ignore patterns entirely
257
+ const context = new Context({
258
+ name: "my-context",
259
+ embedding,
260
+ vectorDatabase,
261
+ supportedExtensions: [".ts", ".js", ".py", ".java"], // Only these extensions
262
+ ignorePatterns: ["node_modules/**", "dist/**", "*.spec.ts", "*.test.js"], // Only these patterns
269
263
  });
270
264
 
271
- const context = new Context({
265
+ // Or add to defaults using custom* properties
266
+ const context2 = new Context({
267
+ name: "my-context",
272
268
  embedding,
273
269
  vectorDatabase,
270
+ customExtensions: [".vue", ".svelte"], // Adds to default extensions
271
+ customIgnorePatterns: ["*.spec.ts"], // Adds to default ignore patterns
274
272
  });
273
+ ```
275
274
 
276
- // The retry mechanism automatically handles:
277
- // - Rate limit errors (429)
278
- // - Server errors (500, 502, 503, 504)
279
- // - Network errors (ECONNREFUSED, ETIMEDOUT, ENOTFOUND, EAI_AGAIN)
280
- // - Transient API failures with exponential backoff (1s → 2s → 4s → 8s, capped at 10s)
275
+ ### Relative Path Indexing
281
276
 
282
- // Update retry configuration at runtime
283
- embedding.setMaxRetries(5);
284
- embedding.setBaseDelay(2000);
277
+ File paths are indexed relative to the `codebasePath` parameter you provide when indexing:
285
278
 
286
- // Check current retry configuration
287
- const retryConfig = embedding.getRetryConfig();
288
- console.log(
289
- `Max retries: ${retryConfig.maxRetries}, Base delay: ${retryConfig.baseDelay}ms`,
290
- );
291
- ```
279
+ ```typescript
280
+ // Index a codebase - paths will be relative to this directory
281
+ await context.indexCodebase("/Users/username/projects/my-workspace");
292
282
 
293
- ### Custom File Filtering
283
+ // Search returns results with relative paths
284
+ const results = await context.semanticSearch("user authentication function");
294
285
 
295
- ```typescript
296
- const context = new Context({
297
- embedding,
298
- vectorDatabase,
299
- supportedExtensions: [".ts", ".js", ".py", ".java"],
300
- ignorePatterns: ["node_modules/**", "dist/**", "*.spec.ts", "*.test.js"],
301
- });
286
+ // Results show paths relative to the indexed codebase path, e.g.:
287
+ // "packages/app/src/auth.ts" instead of full absolute path
302
288
  ```
303
289
 
290
+ This makes search results:
291
+
292
+ - More readable and concise
293
+ - Portable across different machines
294
+ - Consistent in monorepo environments
295
+
304
296
  ## File Synchronization Architecture
305
297
 
306
298
  Claude Context implements an intelligent file synchronization system that efficiently tracks and processes only the files that have changed since the last indexing operation. This dramatically improves performance when working with large codebases.