@zilliz/claude-context-core 0.0.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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +275 -0
  3. package/dist/context.d.ts +234 -0
  4. package/dist/context.d.ts.map +1 -0
  5. package/dist/context.js +879 -0
  6. package/dist/context.js.map +1 -0
  7. package/dist/embedding/base-embedding.d.ts +45 -0
  8. package/dist/embedding/base-embedding.d.ts.map +1 -0
  9. package/dist/embedding/base-embedding.js +36 -0
  10. package/dist/embedding/base-embedding.js.map +1 -0
  11. package/dist/embedding/gemini-embedding.d.ts +51 -0
  12. package/dist/embedding/gemini-embedding.d.ts.map +1 -0
  13. package/dist/embedding/gemini-embedding.js +143 -0
  14. package/dist/embedding/gemini-embedding.js.map +1 -0
  15. package/dist/embedding/index.d.ts +6 -0
  16. package/dist/embedding/index.d.ts.map +1 -0
  17. package/dist/embedding/index.js +24 -0
  18. package/dist/embedding/index.js.map +1 -0
  19. package/dist/embedding/ollama-embedding.d.ts +64 -0
  20. package/dist/embedding/ollama-embedding.d.ts.map +1 -0
  21. package/dist/embedding/ollama-embedding.js +205 -0
  22. package/dist/embedding/ollama-embedding.js.map +1 -0
  23. package/dist/embedding/openai-embedding.d.ts +36 -0
  24. package/dist/embedding/openai-embedding.d.ts.map +1 -0
  25. package/dist/embedding/openai-embedding.js +103 -0
  26. package/dist/embedding/openai-embedding.js.map +1 -0
  27. package/dist/embedding/voyageai-embedding.d.ts +43 -0
  28. package/dist/embedding/voyageai-embedding.d.ts.map +1 -0
  29. package/dist/embedding/voyageai-embedding.js +223 -0
  30. package/dist/embedding/voyageai-embedding.js.map +1 -0
  31. package/dist/index.d.ts +8 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +24 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/splitter/ast-splitter.d.ts +22 -0
  36. package/dist/splitter/ast-splitter.d.ts.map +1 -0
  37. package/dist/splitter/ast-splitter.js +227 -0
  38. package/dist/splitter/ast-splitter.js.map +1 -0
  39. package/dist/splitter/index.d.ts +41 -0
  40. package/dist/splitter/index.d.ts.map +1 -0
  41. package/dist/splitter/index.js +27 -0
  42. package/dist/splitter/index.js.map +1 -0
  43. package/dist/splitter/langchain-splitter.d.ts +13 -0
  44. package/dist/splitter/langchain-splitter.d.ts.map +1 -0
  45. package/dist/splitter/langchain-splitter.js +118 -0
  46. package/dist/splitter/langchain-splitter.js.map +1 -0
  47. package/dist/sync/merkle.d.ts +26 -0
  48. package/dist/sync/merkle.d.ts.map +1 -0
  49. package/dist/sync/merkle.js +112 -0
  50. package/dist/sync/merkle.js.map +1 -0
  51. package/dist/sync/synchronizer.d.ts +30 -0
  52. package/dist/sync/synchronizer.d.ts.map +1 -0
  53. package/dist/sync/synchronizer.js +339 -0
  54. package/dist/sync/synchronizer.js.map +1 -0
  55. package/dist/types.d.ts +14 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +3 -0
  58. package/dist/types.js.map +1 -0
  59. package/dist/utils/env-manager.d.ts +19 -0
  60. package/dist/utils/env-manager.d.ts.map +1 -0
  61. package/dist/utils/env-manager.js +125 -0
  62. package/dist/utils/env-manager.js.map +1 -0
  63. package/dist/utils/index.d.ts +2 -0
  64. package/dist/utils/index.d.ts.map +1 -0
  65. package/dist/utils/index.js +7 -0
  66. package/dist/utils/index.js.map +1 -0
  67. package/dist/vectordb/index.d.ts +5 -0
  68. package/dist/vectordb/index.d.ts.map +1 -0
  69. package/dist/vectordb/index.js +14 -0
  70. package/dist/vectordb/index.js.map +1 -0
  71. package/dist/vectordb/milvus-restful-vectordb.d.ts +51 -0
  72. package/dist/vectordb/milvus-restful-vectordb.d.ts.map +1 -0
  73. package/dist/vectordb/milvus-restful-vectordb.js +406 -0
  74. package/dist/vectordb/milvus-restful-vectordb.js.map +1 -0
  75. package/dist/vectordb/milvus-vectordb.d.ts +34 -0
  76. package/dist/vectordb/milvus-vectordb.d.ts.map +1 -0
  77. package/dist/vectordb/milvus-vectordb.js +248 -0
  78. package/dist/vectordb/milvus-vectordb.js.map +1 -0
  79. package/dist/vectordb/types.d.ts +75 -0
  80. package/dist/vectordb/types.d.ts.map +1 -0
  81. package/dist/vectordb/types.js +9 -0
  82. package/dist/vectordb/types.js.map +1 -0
  83. package/dist/vectordb/zilliz-utils.d.ts +135 -0
  84. package/dist/vectordb/zilliz-utils.d.ts.map +1 -0
  85. package/dist/vectordb/zilliz-utils.js +192 -0
  86. package/dist/vectordb/zilliz-utils.js.map +1 -0
  87. package/package.json +56 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Zilliz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,275 @@
1
+ # @zilliz/claude-context-core
2
+ ![](../../assets/code_context_logo_dark.png)
3
+
4
+ The core indexing engine for Code Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.
5
+
6
+ [![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)
7
+ [![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)
8
+
9
+ > 📖 **New to Code Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @zilliz/claude-context-core
15
+ ```
16
+
17
+ ### Prepare Environment Variables
18
+ #### OpenAI API key
19
+ See [OpenAI Documentation](https://platform.openai.com/docs/api-reference) for more details to get your API key.
20
+ ```bash
21
+ OPENAI_API_KEY=your-openai-api-key
22
+ ```
23
+
24
+ #### Zilliz Cloud configuration
25
+ Get a free Milvus vector database on Zilliz Cloud.
26
+
27
+ Code Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.
28
+
29
+ ![](../../assets/signup_and_create_cluster.jpeg)
30
+
31
+ After creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.
32
+ These will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.
33
+
34
+ ![Zilliz Cloud Dashboard](../../assets/zilliz_cloud_dashboard.jpeg)
35
+
36
+ Keep both values handy for the configuration steps below.
37
+
38
+ If you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.
39
+
40
+ ```bash
41
+ MILVUS_ADDRESS=your-zilliz-cloud-public-endpoint
42
+ MILVUS_TOKEN=your-zilliz-cloud-api-key
43
+ ```
44
+
45
+ > 💡 **Tip**: For easier configuration management across different usage scenarios, consider using [global environment variables](../../docs/getting-started/environment-variables.md).
46
+
47
+ ## Quick Start
48
+
49
+ ```typescript
50
+ import {
51
+ CodeContext,
52
+ OpenAIEmbedding,
53
+ MilvusVectorDatabase
54
+ } from '@zilliz/claude-context-core';
55
+
56
+ // Initialize embedding provider
57
+ const embedding = new OpenAIEmbedding({
58
+ apiKey: process.env.OPENAI_API_KEY || 'your-openai-api-key',
59
+ model: 'text-embedding-3-small'
60
+ });
61
+
62
+ // Initialize vector database
63
+ const vectorDatabase = new MilvusVectorDatabase({
64
+ address: process.env.MILVUS_ADDRESS || 'localhost:19530',
65
+ token: process.env.MILVUS_TOKEN || ''
66
+ });
67
+
68
+ // Create context instance
69
+ const context = new CodeContext({
70
+ embedding,
71
+ vectorDatabase
72
+ });
73
+
74
+ // Index a codebase
75
+ const stats = await context.indexCodebase('./my-project', (progress) => {
76
+ console.log(`${progress.phase} - ${progress.percentage}%`);
77
+ });
78
+
79
+ console.log(`Indexed ${stats.indexedFiles} files with ${stats.totalChunks} chunks`);
80
+
81
+ // Search the codebase
82
+ const results = await context.semanticSearch(
83
+ './my-project',
84
+ 'function that handles user authentication',
85
+ 5
86
+ );
87
+
88
+ results.forEach(result => {
89
+ console.log(`${result.relativePath}:${result.startLine}-${result.endLine}`);
90
+ console.log(`Score: ${result.score}`);
91
+ console.log(result.content);
92
+ });
93
+ ```
94
+
95
+ ## Features
96
+
97
+ - **Multi-language Support**: Index TypeScript, JavaScript, Python, Java, C++, and many other programming languages
98
+ - **Semantic Search**: Find code using natural language queries powered by AI embeddings
99
+ - **Flexible Architecture**: Pluggable embedding providers and vector databases
100
+ - **Smart Chunking**: Intelligent code splitting that preserves context and structure
101
+ - **Batch Processing**: Efficient processing of large codebases with progress tracking
102
+ - **Pattern Matching**: Built-in ignore patterns for common build artifacts and dependencies
103
+ - **Incremental File Synchronization**: Efficient change detection using Merkle trees to only re-index modified files
104
+
105
+ ## Embedding Providers
106
+
107
+ - **OpenAI Embeddings** (`text-embedding-3-small`, `text-embedding-3-large`)
108
+ - **VoyageAI Embeddings** - High-quality embeddings optimized for code
109
+
110
+ ## Vector Database Support
111
+
112
+ - **Milvus/Zilliz Cloud** - High-performance vector database
113
+
114
+ ## Code Splitters
115
+
116
+ - **AST Code Splitter** - AST-based code splitting with automatic fallback (default)
117
+ - **LangChain Code Splitter** - Character-based code chunking
118
+
119
+ ## Configuration
120
+
121
+ ### CodeContextConfig
122
+
123
+ ```typescript
124
+ interface CodeContextConfig {
125
+ embedding?: Embedding; // Embedding provider
126
+ vectorDatabase?: VectorDatabase; // Vector database instance (required)
127
+ codeSplitter?: Splitter; // Code splitting strategy
128
+ supportedExtensions?: string[]; // File extensions to index
129
+ ignorePatterns?: string[]; // Patterns to ignore
130
+ }
131
+ ```
132
+
133
+ ### Supported File Extensions (Default)
134
+
135
+ ```typescript
136
+ [
137
+ // Programming languages
138
+ '.ts', '.tsx', '.js', '.jsx', '.py', '.java', '.cpp', '.c', '.h', '.hpp',
139
+ '.cs', '.go', '.rs', '.php', '.rb', '.swift', '.kt', '.scala', '.m', '.mm',
140
+ // Text and markup files
141
+ '.md', '.markdown'
142
+ ]
143
+ ```
144
+
145
+ ### Default Ignore Patterns
146
+
147
+ - `node_modules/**`, `dist/**`, `build/**`, `out/**`
148
+ - `.git/**`, `.vscode/**`, `.idea/**`
149
+ - `*.min.js`, `*.bundle.js`, `*.map`
150
+ - Log files, cache directories, and temporary files
151
+
152
+ ## API Reference
153
+
154
+ ### CodeContext
155
+
156
+ #### Methods
157
+
158
+ - `indexCodebase(path, progressCallback?)` - Index an entire codebase
159
+ - `semanticSearch(path, query, topK?, threshold?)` - Search indexed code semantically
160
+ - `hasIndex(path)` - Check if codebase is already indexed
161
+ - `clearIndex(path, progressCallback?)` - Remove index for a codebase
162
+ - `updateIgnorePatterns(patterns)` - Update ignore patterns
163
+ - `updateEmbedding(embedding)` - Switch embedding provider
164
+ - `updateVectorDatabase(vectorDB)` - Switch vector database
165
+
166
+ ### Search Results
167
+
168
+ ```typescript
169
+ interface SemanticSearchResult {
170
+ content: string; // Code content
171
+ relativePath: string; // File path relative to codebase root
172
+ startLine: number; // Starting line number
173
+ endLine: number; // Ending line number
174
+ language: string; // Programming language
175
+ score: number; // Similarity score (0-1)
176
+ fileExtension: string; // File extension
177
+ }
178
+ ```
179
+
180
+
181
+ ## Examples
182
+
183
+ ### Using VoyageAI Embeddings
184
+
185
+ ```typescript
186
+ import { CodeContext, MilvusVectorDatabase, VoyageAIEmbedding } from '@zilliz/claude-context-core';
187
+
188
+ // Initialize with VoyageAI embedding provider
189
+ const embedding = new VoyageAIEmbedding({
190
+ apiKey: process.env.VOYAGEAI_API_KEY || 'your-voyageai-api-key',
191
+ model: 'voyage-code-3'
192
+ });
193
+
194
+ const vectorDatabase = new MilvusVectorDatabase({
195
+ address: process.env.MILVUS_ADDRESS || 'localhost:19530',
196
+ token: process.env.MILVUS_TOKEN || ''
197
+ });
198
+
199
+ const context = new CodeContext({
200
+ embedding,
201
+ vectorDatabase
202
+ });
203
+ ```
204
+
205
+ ### Custom File Filtering
206
+
207
+ ```typescript
208
+ const context = new CodeContext({
209
+ embedding,
210
+ vectorDatabase,
211
+ supportedExtensions: ['.ts', '.js', '.py', '.java'],
212
+ ignorePatterns: [
213
+ 'node_modules/**',
214
+ 'dist/**',
215
+ '*.spec.ts',
216
+ '*.test.js'
217
+ ]
218
+ });
219
+ ```
220
+
221
+ ## File Synchronization Architecture
222
+
223
+ Code 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.
224
+
225
+ ![File Synchronization Architecture](../../assets/file_synchronizer.png)
226
+
227
+ ### How It Works
228
+
229
+ The file synchronization system uses a **Merkle tree-based approach** combined with SHA-256 file hashing to detect changes:
230
+
231
+ #### 1. File Hashing
232
+ - Each file in the codebase is hashed using SHA-256
233
+ - File hashes are computed based on file content, not metadata
234
+ - Hashes are stored with relative file paths for consistency across different environments
235
+
236
+ #### 2. Merkle Tree Construction
237
+ - All file hashes are organized into a Merkle tree structure
238
+ - The tree provides a single root hash that represents the entire codebase state
239
+ - Any change to any file will cause the root hash to change
240
+
241
+ #### 3. Snapshot Management
242
+ - File synchronization state is persisted to `~/.codecontext/merkle/` directory
243
+ - Each codebase gets a unique snapshot file based on its absolute path hash
244
+ - Snapshots contain both file hashes and serialized Merkle tree data
245
+
246
+ #### 4. Change Detection Process
247
+ 1. **Quick Check**: Compare current Merkle root hash with stored snapshot
248
+ 2. **Detailed Analysis**: If root hashes differ, perform file-by-file comparison
249
+ 3. **Change Classification**: Categorize changes into three types:
250
+ - **Added**: New files that didn't exist before
251
+ - **Modified**: Existing files with changed content
252
+ - **Removed**: Files that were deleted from the codebase
253
+
254
+ #### 5. Incremental Updates
255
+ - Only process files that have actually changed
256
+ - Update vector database entries only for modified chunks
257
+ - Remove entries for deleted files
258
+ - Add entries for new files
259
+
260
+
261
+ ## Contributing
262
+
263
+ This package is part of the CodeContext monorepo. Please see:
264
+ - [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines
265
+ - [Core Package Contributing](CONTRIBUTING.md) - Specific development guide for this package
266
+
267
+ ## Related Packages
268
+
269
+ - **[@claude-context/mcp](../mcp)** - MCP server that uses this core engine
270
+ - **[VSCode Extension](../vscode-extension)** - VSCode extension built on this core
271
+
272
+
273
+ ## License
274
+
275
+ MIT - See [LICENSE](../../LICENSE) for details
@@ -0,0 +1,234 @@
1
+ import { Splitter } from './splitter';
2
+ import { Embedding } from './embedding';
3
+ import { VectorDatabase } from './vectordb';
4
+ import { SemanticSearchResult } from './types';
5
+ export interface CodeContextConfig {
6
+ embedding?: Embedding;
7
+ vectorDatabase?: VectorDatabase;
8
+ codeSplitter?: Splitter;
9
+ supportedExtensions?: string[];
10
+ ignorePatterns?: string[];
11
+ customExtensions?: string[];
12
+ customIgnorePatterns?: string[];
13
+ }
14
+ export declare class CodeContext {
15
+ private embedding;
16
+ private vectorDatabase;
17
+ private codeSplitter;
18
+ private supportedExtensions;
19
+ private ignorePatterns;
20
+ private synchronizers;
21
+ constructor(config?: CodeContextConfig);
22
+ /**
23
+ * Generate collection name based on codebase path
24
+ */
25
+ private getCollectionName;
26
+ /**
27
+ * Index entire codebase
28
+ * @param codebasePath Codebase path
29
+ * @param progressCallback Optional progress callback function
30
+ * @returns Indexing statistics
31
+ */
32
+ indexCodebase(codebasePath: string, progressCallback?: (progress: {
33
+ phase: string;
34
+ current: number;
35
+ total: number;
36
+ percentage: number;
37
+ }) => void): Promise<{
38
+ indexedFiles: number;
39
+ totalChunks: number;
40
+ status: 'completed' | 'limit_reached';
41
+ }>;
42
+ reindexByChange(codebasePath: string, progressCallback?: (progress: {
43
+ phase: string;
44
+ current: number;
45
+ total: number;
46
+ percentage: number;
47
+ }) => void): Promise<{
48
+ added: number;
49
+ removed: number;
50
+ modified: number;
51
+ }>;
52
+ private deleteFileChunks;
53
+ /**
54
+ * Semantic search
55
+ * @param codebasePath Codebase path to search in
56
+ * @param query Search query
57
+ * @param topK Number of results to return
58
+ * @param threshold Similarity threshold
59
+ */
60
+ semanticSearch(codebasePath: string, query: string, topK?: number, threshold?: number): Promise<SemanticSearchResult[]>;
61
+ /**
62
+ * Check if index exists for codebase
63
+ * @param codebasePath Codebase path to check
64
+ * @returns Whether index exists
65
+ */
66
+ hasIndex(codebasePath: string): Promise<boolean>;
67
+ /**
68
+ * Clear index
69
+ * @param codebasePath Codebase path to clear index for
70
+ * @param progressCallback Optional progress callback function
71
+ */
72
+ clearIndex(codebasePath: string, progressCallback?: (progress: {
73
+ phase: string;
74
+ current: number;
75
+ total: number;
76
+ percentage: number;
77
+ }) => void): Promise<void>;
78
+ /**
79
+ * Update ignore patterns (merges with default patterns and existing patterns)
80
+ * @param ignorePatterns Array of ignore patterns to add to defaults
81
+ */
82
+ updateIgnorePatterns(ignorePatterns: string[]): void;
83
+ /**
84
+ * Add custom ignore patterns (from MCP or other sources) without replacing existing ones
85
+ * @param customPatterns Array of custom ignore patterns to add
86
+ */
87
+ addCustomIgnorePatterns(customPatterns: string[]): void;
88
+ /**
89
+ * Reset ignore patterns to defaults only
90
+ */
91
+ resetIgnorePatternsToDefaults(): void;
92
+ /**
93
+ * Update embedding instance
94
+ * @param embedding New embedding instance
95
+ */
96
+ updateEmbedding(embedding: Embedding): void;
97
+ /**
98
+ * Update vector database instance
99
+ * @param vectorDatabase New vector database instance
100
+ */
101
+ updateVectorDatabase(vectorDatabase: VectorDatabase): void;
102
+ /**
103
+ * Update splitter instance
104
+ * @param splitter New splitter instance
105
+ */
106
+ updateSplitter(splitter: Splitter): void;
107
+ /**
108
+ * Prepare vector collection
109
+ */
110
+ private prepareCollection;
111
+ /**
112
+ * Recursively get all code files in the codebase
113
+ */
114
+ private getCodeFiles;
115
+ /**
116
+ * Process a list of files with streaming chunk processing
117
+ * @param filePaths Array of file paths to process
118
+ * @param codebasePath Base path for the codebase
119
+ * @param onFileProcessed Callback called when each file is processed
120
+ * @returns Object with processed file count and total chunk count
121
+ */
122
+ private processFileList;
123
+ /**
124
+ * Process accumulated chunk buffer
125
+ */
126
+ private processChunkBuffer;
127
+ /**
128
+ * Process a batch of chunks
129
+ */
130
+ private processChunkBatch;
131
+ /**
132
+ * Get programming language based on file extension
133
+ */
134
+ private getLanguageFromExtension;
135
+ /**
136
+ * Generate unique ID based on chunk content and location
137
+ * @param relativePath Relative path to the file
138
+ * @param startLine Start line number
139
+ * @param endLine End line number
140
+ * @param content Chunk content
141
+ * @returns Hash-based unique ID
142
+ */
143
+ private generateId;
144
+ /**
145
+ * Read ignore patterns from file (e.g., .gitignore)
146
+ * @param filePath Path to the ignore file
147
+ * @returns Array of ignore patterns
148
+ */
149
+ static getIgnorePatternsFromFile(filePath: string): Promise<string[]>;
150
+ /**
151
+ * Load ignore patterns from various ignore files in the codebase
152
+ * This method preserves any existing custom patterns that were added before
153
+ * @param codebasePath Path to the codebase
154
+ */
155
+ private loadGitignorePatterns;
156
+ /**
157
+ * Find all .xxxignore files in the codebase directory (excluding .gitignore as it's handled separately)
158
+ * @param codebasePath Path to the codebase
159
+ * @returns Array of ignore file paths
160
+ */
161
+ private findIgnoreFiles;
162
+ /**
163
+ * Load global ignore file from ~/.codecontext/.codecontextignore
164
+ * @returns Array of ignore patterns
165
+ */
166
+ private loadGlobalIgnoreFile;
167
+ /**
168
+ * Load ignore patterns from a specific ignore file
169
+ * @param filePath Path to the ignore file
170
+ * @param fileName Display name for logging
171
+ * @returns Array of ignore patterns
172
+ */
173
+ private loadIgnoreFile;
174
+ /**
175
+ * Check if a path matches any ignore pattern
176
+ * @param filePath Path to check
177
+ * @param basePath Base path for relative pattern matching
178
+ * @returns True if path should be ignored
179
+ */
180
+ private matchesIgnorePattern;
181
+ /**
182
+ * Simple glob pattern matching
183
+ * @param filePath File path to test
184
+ * @param pattern Glob pattern
185
+ * @returns True if pattern matches
186
+ */
187
+ private isPatternMatch;
188
+ /**
189
+ * Simple glob matching supporting * wildcard
190
+ * @param text Text to test
191
+ * @param pattern Pattern with * wildcards
192
+ * @returns True if pattern matches
193
+ */
194
+ private simpleGlobMatch;
195
+ /**
196
+ * Get custom extensions from environment variables
197
+ * Supports CUSTOM_EXTENSIONS as comma-separated list
198
+ * @returns Array of custom extensions
199
+ */
200
+ private getCustomExtensionsFromEnv;
201
+ /**
202
+ * Get custom ignore patterns from environment variables
203
+ * Supports CUSTOM_IGNORE_PATTERNS as comma-separated list
204
+ * @returns Array of custom ignore patterns
205
+ */
206
+ private getCustomIgnorePatternsFromEnv;
207
+ /**
208
+ * Add custom extensions (from MCP or other sources) without replacing existing ones
209
+ * @param customExtensions Array of custom extensions to add
210
+ */
211
+ addCustomExtensions(customExtensions: string[]): void;
212
+ /**
213
+ * Get current splitter information
214
+ */
215
+ getSplitterInfo(): {
216
+ type: string;
217
+ hasBuiltinFallback: boolean;
218
+ supportedLanguages?: string[];
219
+ };
220
+ /**
221
+ * Check if current splitter supports a specific language
222
+ * @param language Programming language
223
+ */
224
+ isLanguageSupported(language: string): boolean;
225
+ /**
226
+ * Get which strategy would be used for a specific language
227
+ * @param language Programming language
228
+ */
229
+ getSplitterStrategyForLanguage(language: string): {
230
+ strategy: 'ast' | 'langchain';
231
+ reason: string;
232
+ };
233
+ }
234
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,QAAQ,EAGX,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,SAAS,EAGZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,cAAc,EAGjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAsE/C,MAAM,WAAW,iBAAiB;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACnC;AAED,qBAAa,WAAW;IACpB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAW;IAC/B,OAAO,CAAC,mBAAmB,CAAW;IACtC,OAAO,CAAC,cAAc,CAAW;IACjC,OAAO,CAAC,aAAa,CAAuC;gBAEhD,MAAM,GAAE,iBAAsB;IAkD1C;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAMzB;;;;;OAKG;IACG,aAAa,CACf,YAAY,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,GAC7G,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE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