@pleaseai/context-please-core 0.2.0 → 0.3.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/README.md +74 -46
- package/dist/.tsbuildinfo +1 -1
- package/dist/context.d.ts +12 -12
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +179 -76
- package/dist/context.js.map +1 -1
- package/dist/embedding/base-embedding.d.ts.map +1 -1
- package/dist/embedding/base-embedding.js +1 -1
- package/dist/embedding/base-embedding.js.map +1 -1
- package/dist/embedding/gemini-embedding.d.ts +2 -1
- package/dist/embedding/gemini-embedding.d.ts.map +1 -1
- package/dist/embedding/gemini-embedding.js +8 -8
- package/dist/embedding/gemini-embedding.js.map +1 -1
- package/dist/embedding/index.d.ts +2 -2
- package/dist/embedding/index.d.ts.map +1 -1
- package/dist/embedding/index.js +2 -2
- package/dist/embedding/index.js.map +1 -1
- package/dist/embedding/ollama-embedding.d.ts +2 -1
- package/dist/embedding/ollama-embedding.d.ts.map +1 -1
- package/dist/embedding/ollama-embedding.js +5 -5
- package/dist/embedding/ollama-embedding.js.map +1 -1
- package/dist/embedding/openai-embedding.d.ts +2 -1
- package/dist/embedding/openai-embedding.d.ts.map +1 -1
- package/dist/embedding/openai-embedding.js +10 -10
- package/dist/embedding/openai-embedding.js.map +1 -1
- package/dist/embedding/voyageai-embedding.d.ts +2 -1
- package/dist/embedding/voyageai-embedding.d.ts.map +1 -1
- package/dist/embedding/voyageai-embedding.js +23 -23
- package/dist/embedding/voyageai-embedding.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/splitter/ast-splitter.d.ts +1 -1
- package/dist/splitter/ast-splitter.d.ts.map +1 -1
- package/dist/splitter/ast-splitter.js +30 -16
- package/dist/splitter/ast-splitter.js.map +1 -1
- package/dist/splitter/index.d.ts +4 -4
- package/dist/splitter/index.d.ts.map +1 -1
- package/dist/splitter/index.js +1 -1
- package/dist/splitter/index.js.map +1 -1
- package/dist/splitter/langchain-splitter.d.ts +1 -1
- package/dist/splitter/langchain-splitter.d.ts.map +1 -1
- package/dist/splitter/langchain-splitter.js.map +1 -1
- package/dist/sync/merkle.d.ts.map +1 -1
- package/dist/sync/merkle.js +9 -9
- package/dist/sync/merkle.js.map +1 -1
- package/dist/sync/synchronizer.d.ts.map +1 -1
- package/dist/sync/synchronizer.js +15 -15
- package/dist/sync/synchronizer.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/env-manager.d.ts.map +1 -1
- package/dist/utils/env-manager.js +3 -3
- package/dist/utils/env-manager.js.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/vectordb/base/base-vector-database.d.ts +1 -1
- package/dist/vectordb/base/base-vector-database.d.ts.map +1 -1
- package/dist/vectordb/base/base-vector-database.js.map +1 -1
- package/dist/vectordb/factory.d.ts +6 -6
- package/dist/vectordb/factory.d.ts.map +1 -1
- package/dist/vectordb/factory.js +1 -1
- package/dist/vectordb/factory.js.map +1 -1
- package/dist/vectordb/index.d.ts +9 -9
- package/dist/vectordb/index.d.ts.map +1 -1
- package/dist/vectordb/index.js +8 -8
- package/dist/vectordb/index.js.map +1 -1
- package/dist/vectordb/milvus-restful-vectordb.d.ts +6 -5
- package/dist/vectordb/milvus-restful-vectordb.d.ts.map +1 -1
- package/dist/vectordb/milvus-restful-vectordb.js +136 -136
- package/dist/vectordb/milvus-restful-vectordb.js.map +1 -1
- package/dist/vectordb/milvus-vectordb.d.ts +5 -4
- package/dist/vectordb/milvus-vectordb.d.ts.map +1 -1
- package/dist/vectordb/milvus-vectordb.js +31 -31
- package/dist/vectordb/milvus-vectordb.js.map +1 -1
- package/dist/vectordb/qdrant-vectordb.d.ts +28 -3
- package/dist/vectordb/qdrant-vectordb.d.ts.map +1 -1
- package/dist/vectordb/qdrant-vectordb.js +298 -73
- package/dist/vectordb/qdrant-vectordb.js.map +1 -1
- package/dist/vectordb/sparse/index.d.ts +2 -2
- package/dist/vectordb/sparse/index.d.ts.map +1 -1
- package/dist/vectordb/sparse/index.js +4 -4
- package/dist/vectordb/sparse/index.js.map +1 -1
- package/dist/vectordb/sparse/simple-bm25.d.ts +12 -2
- package/dist/vectordb/sparse/simple-bm25.d.ts.map +1 -1
- package/dist/vectordb/sparse/simple-bm25.js +82 -9
- package/dist/vectordb/sparse/simple-bm25.js.map +1 -1
- package/dist/vectordb/sparse/sparse-vector-generator.d.ts +7 -7
- package/dist/vectordb/sparse/sparse-vector-generator.d.ts.map +1 -1
- package/dist/vectordb/sparse/types.d.ts.map +1 -1
- package/dist/vectordb/types.d.ts +12 -12
- package/dist/vectordb/types.d.ts.map +1 -1
- package/dist/vectordb/types.js +1 -1
- package/dist/vectordb/types.js.map +1 -1
- package/dist/vectordb/zilliz-utils.d.ts +10 -10
- package/dist/vectordb/zilliz-utils.d.ts.map +1 -1
- package/dist/vectordb/zilliz-utils.js +16 -17
- package/dist/vectordb/zilliz-utils.js.map +1 -1
- package/package.json +18 -14
package/dist/context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { Embedding } from './embedding';
|
|
2
|
+
import type { Splitter } from './splitter';
|
|
3
|
+
import type { SemanticSearchResult } from './types';
|
|
4
|
+
import type { VectorDatabase } from './vectordb';
|
|
5
5
|
import { FileSynchronizer } from './sync/synchronizer';
|
|
6
6
|
export interface ContextConfig {
|
|
7
7
|
embedding?: Embedding;
|
|
@@ -155,16 +155,16 @@ export declare class Context {
|
|
|
155
155
|
*/
|
|
156
156
|
private getCodeFiles;
|
|
157
157
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
* Process a list of files with streaming chunk processing
|
|
159
|
+
* @param filePaths Array of file paths to process
|
|
160
|
+
* @param codebasePath Base path for the codebase
|
|
161
|
+
* @param onFileProcessed Callback called when each file is processed
|
|
162
|
+
* @returns Object with processed file count and total chunk count
|
|
163
|
+
*/
|
|
164
164
|
private processFileList;
|
|
165
165
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
* Process accumulated chunk buffer
|
|
167
|
+
*/
|
|
168
168
|
private processChunkBuffer;
|
|
169
169
|
/**
|
|
170
170
|
* Process a batch of chunks
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"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"}
|
package/dist/context.js
CHANGED
|
@@ -34,19 +34,40 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Context = void 0;
|
|
37
|
-
const
|
|
37
|
+
const crypto = __importStar(require("node:crypto"));
|
|
38
|
+
const fs = __importStar(require("node:fs"));
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
38
40
|
const embedding_1 = require("./embedding");
|
|
39
|
-
const
|
|
40
|
-
const fs = __importStar(require("fs"));
|
|
41
|
-
const path = __importStar(require("path"));
|
|
42
|
-
const crypto = __importStar(require("crypto"));
|
|
41
|
+
const splitter_1 = require("./splitter");
|
|
43
42
|
const synchronizer_1 = require("./sync/synchronizer");
|
|
43
|
+
const env_manager_1 = require("./utils/env-manager");
|
|
44
|
+
const qdrant_vectordb_1 = require("./vectordb/qdrant-vectordb");
|
|
44
45
|
const DEFAULT_SUPPORTED_EXTENSIONS = [
|
|
45
46
|
// Programming languages
|
|
46
|
-
'.ts',
|
|
47
|
-
'.
|
|
47
|
+
'.ts',
|
|
48
|
+
'.tsx',
|
|
49
|
+
'.js',
|
|
50
|
+
'.jsx',
|
|
51
|
+
'.py',
|
|
52
|
+
'.java',
|
|
53
|
+
'.cpp',
|
|
54
|
+
'.c',
|
|
55
|
+
'.h',
|
|
56
|
+
'.hpp',
|
|
57
|
+
'.cs',
|
|
58
|
+
'.go',
|
|
59
|
+
'.rs',
|
|
60
|
+
'.php',
|
|
61
|
+
'.rb',
|
|
62
|
+
'.swift',
|
|
63
|
+
'.kt',
|
|
64
|
+
'.scala',
|
|
65
|
+
'.m',
|
|
66
|
+
'.mm',
|
|
48
67
|
// Text and markup files
|
|
49
|
-
'.md',
|
|
68
|
+
'.md',
|
|
69
|
+
'.markdown',
|
|
70
|
+
'.ipynb',
|
|
50
71
|
// '.txt', '.json', '.yaml', '.yml', '.xml', '.html', '.htm',
|
|
51
72
|
// '.css', '.scss', '.less', '.sql', '.sh', '.bash', '.env'
|
|
52
73
|
];
|
|
@@ -92,9 +113,23 @@ const DEFAULT_IGNORE_PATTERNS = [
|
|
|
92
113
|
'*.polyfills.js',
|
|
93
114
|
'*.runtime.js',
|
|
94
115
|
'*.map', // source map files
|
|
95
|
-
'node_modules',
|
|
96
|
-
'
|
|
97
|
-
'
|
|
116
|
+
'node_modules',
|
|
117
|
+
'.git',
|
|
118
|
+
'.svn',
|
|
119
|
+
'.hg',
|
|
120
|
+
'build',
|
|
121
|
+
'dist',
|
|
122
|
+
'out',
|
|
123
|
+
'target',
|
|
124
|
+
'.vscode',
|
|
125
|
+
'.idea',
|
|
126
|
+
'__pycache__',
|
|
127
|
+
'.pytest_cache',
|
|
128
|
+
'coverage',
|
|
129
|
+
'.nyc_output',
|
|
130
|
+
'logs',
|
|
131
|
+
'tmp',
|
|
132
|
+
'temp',
|
|
98
133
|
];
|
|
99
134
|
class Context {
|
|
100
135
|
constructor(config = {}) {
|
|
@@ -103,7 +138,7 @@ class Context {
|
|
|
103
138
|
this.embedding = config.embedding || new embedding_1.OpenAIEmbedding({
|
|
104
139
|
apiKey: env_manager_1.envManager.get('OPENAI_API_KEY') || 'your-openai-api-key',
|
|
105
140
|
model: 'text-embedding-3-small',
|
|
106
|
-
...(env_manager_1.envManager.get('OPENAI_BASE_URL') && { baseURL: env_manager_1.envManager.get('OPENAI_BASE_URL') })
|
|
141
|
+
...(env_manager_1.envManager.get('OPENAI_BASE_URL') && { baseURL: env_manager_1.envManager.get('OPENAI_BASE_URL') }),
|
|
107
142
|
});
|
|
108
143
|
if (!config.vectorDatabase) {
|
|
109
144
|
throw new Error('VectorDatabase is required. Please provide a vectorDatabase instance in the config.');
|
|
@@ -117,18 +152,18 @@ class Context {
|
|
|
117
152
|
...DEFAULT_SUPPORTED_EXTENSIONS,
|
|
118
153
|
...(config.supportedExtensions || []),
|
|
119
154
|
...(config.customExtensions || []),
|
|
120
|
-
...envCustomExtensions
|
|
155
|
+
...envCustomExtensions,
|
|
121
156
|
];
|
|
122
157
|
// Remove duplicates
|
|
123
158
|
this.supportedExtensions = [...new Set(allSupportedExtensions)];
|
|
124
|
-
// Load custom ignore patterns from environment variables
|
|
159
|
+
// Load custom ignore patterns from environment variables
|
|
125
160
|
const envCustomIgnorePatterns = this.getCustomIgnorePatternsFromEnv();
|
|
126
161
|
// Start with default ignore patterns
|
|
127
162
|
const allIgnorePatterns = [
|
|
128
163
|
...DEFAULT_IGNORE_PATTERNS,
|
|
129
164
|
...(config.ignorePatterns || []),
|
|
130
165
|
...(config.customIgnorePatterns || []),
|
|
131
|
-
...envCustomIgnorePatterns
|
|
166
|
+
...envCustomIgnorePatterns,
|
|
132
167
|
];
|
|
133
168
|
// Remove duplicates
|
|
134
169
|
this.ignorePatterns = [...new Set(allIgnorePatterns)];
|
|
@@ -252,7 +287,7 @@ class Context {
|
|
|
252
287
|
phase: `Processing files (${fileIndex}/${totalFiles})...`,
|
|
253
288
|
current: fileIndex,
|
|
254
289
|
total: totalFiles,
|
|
255
|
-
percentage: Math.round(progressPercentage)
|
|
290
|
+
percentage: Math.round(progressPercentage),
|
|
256
291
|
});
|
|
257
292
|
});
|
|
258
293
|
console.log(`[Context] ✅ Codebase indexing completed! Processed ${result.processedFiles} files in total, generated ${result.totalChunks} code chunks`);
|
|
@@ -260,15 +295,29 @@ class Context {
|
|
|
260
295
|
phase: 'Indexing complete!',
|
|
261
296
|
current: result.processedFiles,
|
|
262
297
|
total: codeFiles.length,
|
|
263
|
-
percentage: 100
|
|
298
|
+
percentage: 100,
|
|
264
299
|
});
|
|
265
300
|
return {
|
|
266
301
|
indexedFiles: result.processedFiles,
|
|
267
302
|
totalChunks: result.totalChunks,
|
|
268
|
-
status: result.status
|
|
303
|
+
status: result.status,
|
|
269
304
|
};
|
|
270
305
|
}
|
|
271
306
|
async reindexByChange(codebasePath, progressCallback) {
|
|
307
|
+
// Validate that the codebase path exists
|
|
308
|
+
const normalizedPath = path.resolve(codebasePath);
|
|
309
|
+
try {
|
|
310
|
+
const stat = await fs.promises.stat(normalizedPath);
|
|
311
|
+
if (!stat.isDirectory()) {
|
|
312
|
+
throw new Error(`Codebase path is not a directory: ${normalizedPath}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
if (error.code === 'ENOENT') {
|
|
317
|
+
throw new Error(`Codebase path does not exist: ${normalizedPath}`);
|
|
318
|
+
}
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
272
321
|
const collectionName = this.getCollectionName(codebasePath);
|
|
273
322
|
const synchronizer = this.synchronizers.get(collectionName);
|
|
274
323
|
if (!synchronizer) {
|
|
@@ -306,7 +355,7 @@ class Context {
|
|
|
306
355
|
updateProgress(`Deleted old chunks for ${file}`);
|
|
307
356
|
}
|
|
308
357
|
// Handle added and modified files
|
|
309
|
-
const filesToIndex = [...added, ...modified].map(f => path.join(codebasePath, f));
|
|
358
|
+
const filesToIndex = [...added, ...modified].map((f) => path.join(codebasePath, f));
|
|
310
359
|
if (filesToIndex.length > 0) {
|
|
311
360
|
await this.processFileList(filesToIndex, codebasePath, (filePath, fileIndex, totalFiles) => {
|
|
312
361
|
updateProgress(`Indexed ${filePath} (${fileIndex}/${totalFiles})`);
|
|
@@ -321,7 +370,7 @@ class Context {
|
|
|
321
370
|
const escapedPath = relativePath.replace(/\\/g, '\\\\');
|
|
322
371
|
const results = await this.vectorDatabase.query(collectionName, `relativePath == "${escapedPath}"`, ['id']);
|
|
323
372
|
if (results.length > 0) {
|
|
324
|
-
const ids = results.map(r => r.id).filter(id => id);
|
|
373
|
+
const ids = results.map((r) => r.id).filter((id) => id);
|
|
325
374
|
if (ids.length > 0) {
|
|
326
375
|
await this.vectorDatabase.delete(collectionName, ids);
|
|
327
376
|
console.log(`[Context] Deleted ${ids.length} chunks for file ${relativePath}`);
|
|
@@ -356,6 +405,17 @@ class Context {
|
|
|
356
405
|
catch (error) {
|
|
357
406
|
console.log(`[Context] ⚠️ Collection '${collectionName}' exists but may be empty or not properly indexed:`, error);
|
|
358
407
|
}
|
|
408
|
+
// Load BM25 model if using Qdrant and model is not yet trained
|
|
409
|
+
if (this.vectorDatabase instanceof qdrant_vectordb_1.QdrantVectorDatabase) {
|
|
410
|
+
const bm25Generator = this.vectorDatabase.getBM25Generator();
|
|
411
|
+
if (!bm25Generator.isTrained()) {
|
|
412
|
+
console.log('[Context] 📂 BM25 model not loaded, attempting to load from disk...');
|
|
413
|
+
const loaded = await this.vectorDatabase.loadBM25Model(collectionName);
|
|
414
|
+
if (!loaded) {
|
|
415
|
+
console.warn('[Context] ⚠️ Failed to load BM25 model. Hybrid search quality may be degraded.');
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
359
419
|
// 1. Generate query vector
|
|
360
420
|
console.log(`[Context] 🔍 Generating embeddings for query: "${query}"`);
|
|
361
421
|
const queryEmbedding = await this.embedding.embed(query);
|
|
@@ -365,16 +425,16 @@ class Context {
|
|
|
365
425
|
const searchRequests = [
|
|
366
426
|
{
|
|
367
427
|
data: queryEmbedding.vector,
|
|
368
|
-
anns_field:
|
|
369
|
-
param: {
|
|
370
|
-
limit: topK
|
|
428
|
+
anns_field: 'vector',
|
|
429
|
+
param: { nprobe: 10 },
|
|
430
|
+
limit: topK,
|
|
371
431
|
},
|
|
372
432
|
{
|
|
373
433
|
data: query,
|
|
374
|
-
anns_field:
|
|
375
|
-
param: {
|
|
376
|
-
limit: topK
|
|
377
|
-
}
|
|
434
|
+
anns_field: 'sparse_vector',
|
|
435
|
+
param: { drop_ratio_search: 0.2 },
|
|
436
|
+
limit: topK,
|
|
437
|
+
},
|
|
378
438
|
];
|
|
379
439
|
console.log(`[Context] 🔍 Search request 1 (dense): anns_field="${searchRequests[0].anns_field}", vector_dim=${queryEmbedding.vector.length}, limit=${searchRequests[0].limit}`);
|
|
380
440
|
console.log(`[Context] 🔍 Search request 2 (sparse): anns_field="${searchRequests[1].anns_field}", query_text="${query}", limit=${searchRequests[1].limit}`);
|
|
@@ -383,20 +443,20 @@ class Context {
|
|
|
383
443
|
const searchResults = await this.vectorDatabase.hybridSearch(collectionName, searchRequests, {
|
|
384
444
|
rerank: {
|
|
385
445
|
strategy: 'rrf',
|
|
386
|
-
params: { k: 100 }
|
|
446
|
+
params: { k: 100 },
|
|
387
447
|
},
|
|
388
448
|
limit: topK,
|
|
389
|
-
filterExpr
|
|
449
|
+
filterExpr,
|
|
390
450
|
});
|
|
391
451
|
console.log(`[Context] 🔍 Raw search results count: ${searchResults.length}`);
|
|
392
452
|
// 4. Convert to semantic search result format
|
|
393
|
-
const results = searchResults.map(result => ({
|
|
453
|
+
const results = searchResults.map((result) => ({
|
|
394
454
|
content: result.document.content,
|
|
395
455
|
relativePath: result.document.relativePath,
|
|
396
456
|
startLine: result.document.startLine,
|
|
397
457
|
endLine: result.document.endLine,
|
|
398
458
|
language: result.document.metadata.language || 'unknown',
|
|
399
|
-
score: result.score
|
|
459
|
+
score: result.score,
|
|
400
460
|
}));
|
|
401
461
|
console.log(`[Context] ✅ Found ${results.length} relevant hybrid results`);
|
|
402
462
|
if (results.length > 0) {
|
|
@@ -411,13 +471,13 @@ class Context {
|
|
|
411
471
|
// 2. Search in vector database
|
|
412
472
|
const searchResults = await this.vectorDatabase.search(collectionName, queryEmbedding.vector, { topK, threshold, filterExpr });
|
|
413
473
|
// 3. Convert to semantic search result format
|
|
414
|
-
const results = searchResults.map(result => ({
|
|
474
|
+
const results = searchResults.map((result) => ({
|
|
415
475
|
content: result.document.content,
|
|
416
476
|
relativePath: result.document.relativePath,
|
|
417
477
|
startLine: result.document.startLine,
|
|
418
478
|
endLine: result.document.endLine,
|
|
419
479
|
language: result.document.metadata.language || 'unknown',
|
|
420
|
-
score: result.score
|
|
480
|
+
score: result.score,
|
|
421
481
|
}));
|
|
422
482
|
console.log(`[Context] ✅ Found ${results.length} relevant results`);
|
|
423
483
|
return results;
|
|
@@ -446,6 +506,10 @@ class Context {
|
|
|
446
506
|
if (collectionExists) {
|
|
447
507
|
await this.vectorDatabase.dropCollection(collectionName);
|
|
448
508
|
}
|
|
509
|
+
// Delete BM25 model if using Qdrant
|
|
510
|
+
if (this.vectorDatabase instanceof qdrant_vectordb_1.QdrantVectorDatabase) {
|
|
511
|
+
await this.vectorDatabase.deleteBM25Model(collectionName);
|
|
512
|
+
}
|
|
449
513
|
// Delete snapshot file
|
|
450
514
|
await synchronizer_1.FileSynchronizer.deleteSnapshot(codebasePath);
|
|
451
515
|
progressCallback?.({ phase: 'Index cleared', current: 100, total: 100, percentage: 100 });
|
|
@@ -460,7 +524,7 @@ class Context {
|
|
|
460
524
|
const mergedPatterns = [...DEFAULT_IGNORE_PATTERNS, ...ignorePatterns];
|
|
461
525
|
const uniquePatterns = [];
|
|
462
526
|
const patternSet = new Set(mergedPatterns);
|
|
463
|
-
patternSet.forEach(pattern => uniquePatterns.push(pattern));
|
|
527
|
+
patternSet.forEach((pattern) => uniquePatterns.push(pattern));
|
|
464
528
|
this.ignorePatterns = uniquePatterns;
|
|
465
529
|
console.log(`[Context] 🚫 Updated ignore patterns: ${ignorePatterns.length} new + ${DEFAULT_IGNORE_PATTERNS.length} default = ${this.ignorePatterns.length} total patterns`);
|
|
466
530
|
}
|
|
@@ -475,7 +539,7 @@ class Context {
|
|
|
475
539
|
const mergedPatterns = [...this.ignorePatterns, ...customPatterns];
|
|
476
540
|
const uniquePatterns = [];
|
|
477
541
|
const patternSet = new Set(mergedPatterns);
|
|
478
|
-
patternSet.forEach(pattern => uniquePatterns.push(pattern));
|
|
542
|
+
patternSet.forEach((pattern) => uniquePatterns.push(pattern));
|
|
479
543
|
this.ignorePatterns = uniquePatterns;
|
|
480
544
|
console.log(`[Context] 🚫 Added ${customPatterns.length} custom ignore patterns. Total: ${this.ignorePatterns.length} patterns`);
|
|
481
545
|
}
|
|
@@ -569,17 +633,20 @@ class Context {
|
|
|
569
633
|
return files;
|
|
570
634
|
}
|
|
571
635
|
/**
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
636
|
+
* Process a list of files with streaming chunk processing
|
|
637
|
+
* @param filePaths Array of file paths to process
|
|
638
|
+
* @param codebasePath Base path for the codebase
|
|
639
|
+
* @param onFileProcessed Callback called when each file is processed
|
|
640
|
+
* @returns Object with processed file count and total chunk count
|
|
641
|
+
*/
|
|
578
642
|
async processFileList(filePaths, codebasePath, onFileProcessed) {
|
|
579
643
|
const isHybrid = this.getIsHybrid();
|
|
580
|
-
const EMBEDDING_BATCH_SIZE = Math.max(1, parseInt(env_manager_1.envManager.get('EMBEDDING_BATCH_SIZE') || '100', 10));
|
|
644
|
+
const EMBEDDING_BATCH_SIZE = Math.max(1, Number.parseInt(env_manager_1.envManager.get('EMBEDDING_BATCH_SIZE') || '100', 10));
|
|
581
645
|
const CHUNK_LIMIT = 450000;
|
|
582
646
|
console.log(`[Context] 🔧 Using EMBEDDING_BATCH_SIZE: ${EMBEDDING_BATCH_SIZE}`);
|
|
647
|
+
// For Qdrant hybrid search, we need to train BM25 on the full corpus first
|
|
648
|
+
const needsBM25Training = isHybrid && this.vectorDatabase instanceof qdrant_vectordb_1.QdrantVectorDatabase;
|
|
649
|
+
const allChunks = [];
|
|
583
650
|
let chunkBuffer = [];
|
|
584
651
|
let processedFiles = 0;
|
|
585
652
|
let totalChunks = 0;
|
|
@@ -599,10 +666,16 @@ class Context {
|
|
|
599
666
|
}
|
|
600
667
|
// Add chunks to buffer
|
|
601
668
|
for (const chunk of chunks) {
|
|
602
|
-
chunkBuffer.push({ chunk, codebasePath });
|
|
603
669
|
totalChunks++;
|
|
604
|
-
//
|
|
605
|
-
if (
|
|
670
|
+
// For Qdrant hybrid, collect all chunks. For others, add to buffer.
|
|
671
|
+
if (needsBM25Training) {
|
|
672
|
+
allChunks.push({ chunk, codebasePath });
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
chunkBuffer.push({ chunk, codebasePath });
|
|
676
|
+
}
|
|
677
|
+
// Process batch when buffer reaches EMBEDDING_BATCH_SIZE (skip for Qdrant hybrid)
|
|
678
|
+
if (!needsBM25Training && chunkBuffer.length >= EMBEDDING_BATCH_SIZE) {
|
|
606
679
|
try {
|
|
607
680
|
await this.processChunkBuffer(chunkBuffer);
|
|
608
681
|
}
|
|
@@ -634,8 +707,38 @@ class Context {
|
|
|
634
707
|
console.warn(`[Context] ⚠️ Skipping file ${filePath}: ${error}`);
|
|
635
708
|
}
|
|
636
709
|
}
|
|
637
|
-
//
|
|
638
|
-
if (
|
|
710
|
+
// For Qdrant hybrid, train BM25 and process all chunks
|
|
711
|
+
if (needsBM25Training && allChunks.length > 0) {
|
|
712
|
+
console.log(`[Context] 🎓 Training BM25 on ${allChunks.length} chunks for Qdrant hybrid search...`);
|
|
713
|
+
// Extract corpus texts for BM25 training
|
|
714
|
+
const corpus = allChunks.map((item) => item.chunk.content);
|
|
715
|
+
// Get BM25 generator and train it
|
|
716
|
+
if (this.vectorDatabase instanceof qdrant_vectordb_1.QdrantVectorDatabase) {
|
|
717
|
+
const collectionName = this.getCollectionName(codebasePath);
|
|
718
|
+
const bm25Generator = this.vectorDatabase.getBM25Generator();
|
|
719
|
+
bm25Generator.learn(corpus);
|
|
720
|
+
console.log(`[Context] ✅ BM25 training completed on ${corpus.length} documents`);
|
|
721
|
+
// Save BM25 model to disk for future use
|
|
722
|
+
await this.vectorDatabase.saveBM25Model(collectionName);
|
|
723
|
+
}
|
|
724
|
+
// Now process all chunks in batches
|
|
725
|
+
console.log(`[Context] 📝 Processing ${allChunks.length} chunks in batches of ${EMBEDDING_BATCH_SIZE}...`);
|
|
726
|
+
for (let i = 0; i < allChunks.length; i += EMBEDDING_BATCH_SIZE) {
|
|
727
|
+
const batch = allChunks.slice(i, i + EMBEDDING_BATCH_SIZE);
|
|
728
|
+
try {
|
|
729
|
+
await this.processChunkBuffer(batch);
|
|
730
|
+
console.log(`[Context] 📊 Processed batch ${Math.floor(i / EMBEDDING_BATCH_SIZE) + 1}/${Math.ceil(allChunks.length / EMBEDDING_BATCH_SIZE)}`);
|
|
731
|
+
}
|
|
732
|
+
catch (error) {
|
|
733
|
+
console.error(`[Context] ❌ Failed to process chunk batch:`, error);
|
|
734
|
+
if (error instanceof Error) {
|
|
735
|
+
console.error('[Context] Stack trace:', error.stack);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
else if (chunkBuffer.length > 0) {
|
|
741
|
+
// Process any remaining chunks in the buffer (for non-Qdrant hybrid)
|
|
639
742
|
const searchType = isHybrid === true ? 'hybrid' : 'regular';
|
|
640
743
|
console.log(`📝 Processing final batch of ${chunkBuffer.length} chunks for ${searchType}`);
|
|
641
744
|
try {
|
|
@@ -651,17 +754,17 @@ class Context {
|
|
|
651
754
|
return {
|
|
652
755
|
processedFiles,
|
|
653
756
|
totalChunks,
|
|
654
|
-
status: limitReached ? 'limit_reached' : 'completed'
|
|
757
|
+
status: limitReached ? 'limit_reached' : 'completed',
|
|
655
758
|
};
|
|
656
759
|
}
|
|
657
760
|
/**
|
|
658
|
-
|
|
659
|
-
|
|
761
|
+
* Process accumulated chunk buffer
|
|
762
|
+
*/
|
|
660
763
|
async processChunkBuffer(chunkBuffer) {
|
|
661
764
|
if (chunkBuffer.length === 0)
|
|
662
765
|
return;
|
|
663
766
|
// Extract chunks and ensure they all have the same codebasePath
|
|
664
|
-
const chunks = chunkBuffer.map(item => item.chunk);
|
|
767
|
+
const chunks = chunkBuffer.map((item) => item.chunk);
|
|
665
768
|
const codebasePath = chunkBuffer[0].codebasePath;
|
|
666
769
|
// Estimate tokens (rough estimation: 1 token ≈ 4 characters)
|
|
667
770
|
const estimatedTokens = chunks.reduce((sum, chunk) => sum + Math.ceil(chunk.content.length / 4), 0);
|
|
@@ -676,7 +779,7 @@ class Context {
|
|
|
676
779
|
async processChunkBatch(chunks, codebasePath) {
|
|
677
780
|
const isHybrid = this.getIsHybrid();
|
|
678
781
|
// Generate embedding vectors
|
|
679
|
-
const chunkContents = chunks.map(chunk => chunk.content);
|
|
782
|
+
const chunkContents = chunks.map((chunk) => chunk.content);
|
|
680
783
|
const embeddings = await this.embedding.embedBatch(chunkContents);
|
|
681
784
|
if (isHybrid === true) {
|
|
682
785
|
// Create hybrid vector documents
|
|
@@ -699,8 +802,8 @@ class Context {
|
|
|
699
802
|
...restMetadata,
|
|
700
803
|
codebasePath,
|
|
701
804
|
language: chunk.metadata.language || 'unknown',
|
|
702
|
-
chunkIndex: index
|
|
703
|
-
}
|
|
805
|
+
chunkIndex: index,
|
|
806
|
+
},
|
|
704
807
|
};
|
|
705
808
|
});
|
|
706
809
|
// Store to vector database
|
|
@@ -727,8 +830,8 @@ class Context {
|
|
|
727
830
|
...restMetadata,
|
|
728
831
|
codebasePath,
|
|
729
832
|
language: chunk.metadata.language || 'unknown',
|
|
730
|
-
chunkIndex: index
|
|
731
|
-
}
|
|
833
|
+
chunkIndex: index,
|
|
834
|
+
},
|
|
732
835
|
};
|
|
733
836
|
});
|
|
734
837
|
// Store to vector database
|
|
@@ -760,7 +863,7 @@ class Context {
|
|
|
760
863
|
'.scala': 'scala',
|
|
761
864
|
'.m': 'objective-c',
|
|
762
865
|
'.mm': 'objective-c',
|
|
763
|
-
'.ipynb': 'jupyter'
|
|
866
|
+
'.ipynb': 'jupyter',
|
|
764
867
|
};
|
|
765
868
|
return languageMap[ext] || 'text';
|
|
766
869
|
}
|
|
@@ -787,8 +890,8 @@ class Context {
|
|
|
787
890
|
const content = await fs.promises.readFile(filePath, 'utf-8');
|
|
788
891
|
return content
|
|
789
892
|
.split('\n')
|
|
790
|
-
.map(line => line.trim())
|
|
791
|
-
.filter(line => line && !line.startsWith('#')); // Filter out empty lines and comments
|
|
893
|
+
.map((line) => line.trim())
|
|
894
|
+
.filter((line) => line && !line.startsWith('#')); // Filter out empty lines and comments
|
|
792
895
|
}
|
|
793
896
|
catch (error) {
|
|
794
897
|
console.warn(`[Context] ⚠️ Could not read ignore file ${filePath}: ${error}`);
|
|
@@ -802,7 +905,7 @@ class Context {
|
|
|
802
905
|
*/
|
|
803
906
|
async loadIgnorePatterns(codebasePath) {
|
|
804
907
|
try {
|
|
805
|
-
|
|
908
|
+
const fileBasedPatterns = [];
|
|
806
909
|
// Load all .xxxignore files in codebase directory
|
|
807
910
|
const ignoreFiles = await this.findIgnoreFiles(codebasePath);
|
|
808
911
|
for (const ignoreFile of ignoreFiles) {
|
|
@@ -836,14 +939,14 @@ class Context {
|
|
|
836
939
|
const entries = await fs.promises.readdir(codebasePath, { withFileTypes: true });
|
|
837
940
|
const ignoreFiles = [];
|
|
838
941
|
for (const entry of entries) {
|
|
839
|
-
if (entry.isFile()
|
|
840
|
-
entry.name.startsWith('.')
|
|
841
|
-
entry.name.endsWith('ignore')) {
|
|
942
|
+
if (entry.isFile()
|
|
943
|
+
&& entry.name.startsWith('.')
|
|
944
|
+
&& entry.name.endsWith('ignore')) {
|
|
842
945
|
ignoreFiles.push(path.join(codebasePath, entry.name));
|
|
843
946
|
}
|
|
844
947
|
}
|
|
845
948
|
if (ignoreFiles.length > 0) {
|
|
846
|
-
console.log(`📄 Found ignore files: ${ignoreFiles.map(f => path.basename(f)).join(', ')}`);
|
|
949
|
+
console.log(`📄 Found ignore files: ${ignoreFiles.map((f) => path.basename(f)).join(', ')}`);
|
|
847
950
|
}
|
|
848
951
|
return ignoreFiles;
|
|
849
952
|
}
|
|
@@ -858,7 +961,7 @@ class Context {
|
|
|
858
961
|
*/
|
|
859
962
|
async loadGlobalIgnoreFile() {
|
|
860
963
|
try {
|
|
861
|
-
const homeDir = require('os').homedir();
|
|
964
|
+
const homeDir = require('node:os').homedir();
|
|
862
965
|
const globalIgnorePath = path.join(homeDir, '.context', '.contextignore');
|
|
863
966
|
return await this.loadIgnoreFile(globalIgnorePath, 'global .contextignore');
|
|
864
967
|
}
|
|
@@ -924,7 +1027,7 @@ class Context {
|
|
|
924
1027
|
if (pattern.endsWith('/')) {
|
|
925
1028
|
const dirPattern = pattern.slice(0, -1);
|
|
926
1029
|
const pathParts = filePath.split('/');
|
|
927
|
-
return pathParts.some(part => this.simpleGlobMatch(part, dirPattern));
|
|
1030
|
+
return pathParts.some((part) => this.simpleGlobMatch(part, dirPattern));
|
|
928
1031
|
}
|
|
929
1032
|
// Handle file patterns
|
|
930
1033
|
if (pattern.includes('/')) {
|
|
@@ -964,9 +1067,9 @@ class Context {
|
|
|
964
1067
|
try {
|
|
965
1068
|
const extensions = envExtensions
|
|
966
1069
|
.split(',')
|
|
967
|
-
.map(ext => ext.trim())
|
|
968
|
-
.filter(ext => ext.length > 0)
|
|
969
|
-
.map(ext => ext.startsWith('.') ? ext : `.${ext}`); // Ensure extensions start with dot
|
|
1070
|
+
.map((ext) => ext.trim())
|
|
1071
|
+
.filter((ext) => ext.length > 0)
|
|
1072
|
+
.map((ext) => ext.startsWith('.') ? ext : `.${ext}`); // Ensure extensions start with dot
|
|
970
1073
|
return extensions;
|
|
971
1074
|
}
|
|
972
1075
|
catch (error) {
|
|
@@ -987,8 +1090,8 @@ class Context {
|
|
|
987
1090
|
try {
|
|
988
1091
|
const patterns = envIgnorePatterns
|
|
989
1092
|
.split(',')
|
|
990
|
-
.map(pattern => pattern.trim())
|
|
991
|
-
.filter(pattern => pattern.length > 0);
|
|
1093
|
+
.map((pattern) => pattern.trim())
|
|
1094
|
+
.filter((pattern) => pattern.length > 0);
|
|
992
1095
|
return patterns;
|
|
993
1096
|
}
|
|
994
1097
|
catch (error) {
|
|
@@ -1004,7 +1107,7 @@ class Context {
|
|
|
1004
1107
|
if (customExtensions.length === 0)
|
|
1005
1108
|
return;
|
|
1006
1109
|
// Ensure extensions start with dot
|
|
1007
|
-
const normalizedExtensions = customExtensions.map(ext => ext.startsWith('.') ? ext : `.${ext}`);
|
|
1110
|
+
const normalizedExtensions = customExtensions.map((ext) => ext.startsWith('.') ? ext : `.${ext}`);
|
|
1008
1111
|
// Merge current extensions with new custom extensions, avoiding duplicates
|
|
1009
1112
|
const mergedExtensions = [...this.supportedExtensions, ...normalizedExtensions];
|
|
1010
1113
|
const uniqueExtensions = [...new Set(mergedExtensions)];
|
|
@@ -1021,13 +1124,13 @@ class Context {
|
|
|
1021
1124
|
return {
|
|
1022
1125
|
type: 'ast',
|
|
1023
1126
|
hasBuiltinFallback: true,
|
|
1024
|
-
supportedLanguages: AstCodeSplitter.getSupportedLanguages()
|
|
1127
|
+
supportedLanguages: AstCodeSplitter.getSupportedLanguages(),
|
|
1025
1128
|
};
|
|
1026
1129
|
}
|
|
1027
1130
|
else {
|
|
1028
1131
|
return {
|
|
1029
1132
|
type: 'langchain',
|
|
1030
|
-
hasBuiltinFallback: false
|
|
1133
|
+
hasBuiltinFallback: false,
|
|
1031
1134
|
};
|
|
1032
1135
|
}
|
|
1033
1136
|
}
|
|
@@ -1057,13 +1160,13 @@ class Context {
|
|
|
1057
1160
|
strategy: isSupported ? 'ast' : 'langchain',
|
|
1058
1161
|
reason: isSupported
|
|
1059
1162
|
? 'Language supported by AST parser'
|
|
1060
|
-
: 'Language not supported by AST, will fallback to LangChain'
|
|
1163
|
+
: 'Language not supported by AST, will fallback to LangChain',
|
|
1061
1164
|
};
|
|
1062
1165
|
}
|
|
1063
1166
|
else {
|
|
1064
1167
|
return {
|
|
1065
1168
|
strategy: 'langchain',
|
|
1066
|
-
reason: 'Using LangChain splitter directly'
|
|
1169
|
+
reason: 'Using LangChain splitter directly',
|
|
1067
1170
|
};
|
|
1068
1171
|
}
|
|
1069
1172
|
}
|