raggrep 0.10.7 → 0.11.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/app/indexer/index.d.ts +3 -7
- package/dist/cli/main.js +95 -104
- package/dist/cli/main.js.map +4 -4
- package/dist/domain/entities/fileIndex.d.ts +7 -6
- package/dist/index.js +92 -99
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -30,20 +30,16 @@ export interface IndexOptions {
|
|
|
30
30
|
export interface TimingInfo {
|
|
31
31
|
/** Total time in milliseconds */
|
|
32
32
|
totalMs: number;
|
|
33
|
-
/** Time spent on file discovery (
|
|
33
|
+
/** Time spent on file discovery (with mtime filtering) */
|
|
34
34
|
fileDiscoveryMs: number;
|
|
35
|
-
/** Time spent on stat checks */
|
|
36
|
-
statCheckMs: number;
|
|
37
35
|
/** Time spent on indexing changed files */
|
|
38
36
|
indexingMs: number;
|
|
39
37
|
/** Time spent on cleanup operations */
|
|
40
38
|
cleanupMs: number;
|
|
41
39
|
/** Number of files discovered on disk */
|
|
42
40
|
filesDiscovered: number;
|
|
43
|
-
/** Number of files
|
|
44
|
-
|
|
45
|
-
/** Number of files with detected changes (mtime or size changed) that went to Phase 2 */
|
|
46
|
-
filesWithChanges: number;
|
|
41
|
+
/** Number of files modified since last index */
|
|
42
|
+
filesChanged: number;
|
|
47
43
|
/** Number of files that were actually re-indexed (content changed) */
|
|
48
44
|
filesReindexed: number;
|
|
49
45
|
/** Whether result was from cache */
|
package/dist/cli/main.js
CHANGED
|
@@ -11933,6 +11933,7 @@ function getOptimalConcurrency() {
|
|
|
11933
11933
|
return optimal;
|
|
11934
11934
|
}
|
|
11935
11935
|
async function indexDirectory(rootDir, options = {}) {
|
|
11936
|
+
const indexStartTime = new Date().toISOString();
|
|
11936
11937
|
const verbose = options.verbose ?? false;
|
|
11937
11938
|
const quiet = options.quiet ?? false;
|
|
11938
11939
|
const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
|
|
@@ -12013,7 +12014,7 @@ Indexing complete in ${formatDuration(overallDuration)}`);
|
|
|
12013
12014
|
const totalSkipped = results.reduce((sum, r) => sum + r.skipped, 0);
|
|
12014
12015
|
const totalErrors = results.reduce((sum, r) => sum + r.errors, 0);
|
|
12015
12016
|
logger.info(`Total: ${totalIndexed} indexed, ${totalSkipped} skipped, ${totalErrors} errors`);
|
|
12016
|
-
await updateGlobalManifest(rootDir, enabledModules, config);
|
|
12017
|
+
await updateGlobalManifest(rootDir, enabledModules, config, indexStartTime);
|
|
12017
12018
|
return results;
|
|
12018
12019
|
}
|
|
12019
12020
|
async function isIndexVersionCompatible(rootDir) {
|
|
@@ -12050,14 +12051,13 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12050
12051
|
const verbose = options.verbose ?? false;
|
|
12051
12052
|
const quiet = options.quiet ?? false;
|
|
12052
12053
|
const showTiming = options.timing ?? false;
|
|
12054
|
+
const indexStartTime = new Date().toISOString();
|
|
12053
12055
|
const startTime = Date.now();
|
|
12054
12056
|
let fileDiscoveryMs = 0;
|
|
12055
|
-
let statCheckMs = 0;
|
|
12056
12057
|
let indexingMs = 0;
|
|
12057
12058
|
let cleanupMs = 0;
|
|
12058
12059
|
let filesDiscovered = 0;
|
|
12059
|
-
let
|
|
12060
|
-
let filesWithChanges = 0;
|
|
12060
|
+
let filesChanged = 0;
|
|
12061
12061
|
let filesReindexed = 0;
|
|
12062
12062
|
const logger = options.logger ? options.logger : quiet ? createSilentLogger() : createLogger({ verbose });
|
|
12063
12063
|
rootDir = path22.resolve(rootDir);
|
|
@@ -12095,12 +12095,10 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12095
12095
|
cachedResult.timing = {
|
|
12096
12096
|
totalMs: Date.now() - startTime,
|
|
12097
12097
|
fileDiscoveryMs: 0,
|
|
12098
|
-
statCheckMs: 0,
|
|
12099
12098
|
indexingMs: 0,
|
|
12100
12099
|
cleanupMs: 0,
|
|
12101
12100
|
filesDiscovered: 0,
|
|
12102
|
-
|
|
12103
|
-
filesWithChanges: 0,
|
|
12101
|
+
filesChanged: 0,
|
|
12104
12102
|
filesReindexed: 0,
|
|
12105
12103
|
fromCache: true
|
|
12106
12104
|
};
|
|
@@ -12112,15 +12110,20 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12112
12110
|
if (enabledModules.length === 0) {
|
|
12113
12111
|
return { indexed: 0, removed: 0, unchanged: 0 };
|
|
12114
12112
|
}
|
|
12113
|
+
const globalManifest = await loadGlobalManifest(rootDir, config);
|
|
12114
|
+
const lastIndexStarted = globalManifest?.lastIndexStarted ? new Date(globalManifest.lastIndexStarted) : null;
|
|
12115
12115
|
const fileDiscoveryStart = Date.now();
|
|
12116
12116
|
const introspection = new IntrospectionIndex(rootDir);
|
|
12117
|
-
const [,
|
|
12117
|
+
const [, discoveryResult] = await Promise.all([
|
|
12118
12118
|
introspection.initialize(),
|
|
12119
|
-
|
|
12119
|
+
findFilesWithStats(rootDir, config, lastIndexStarted)
|
|
12120
12120
|
]);
|
|
12121
12121
|
fileDiscoveryMs = Date.now() - fileDiscoveryStart;
|
|
12122
|
+
const { allFiles: currentFiles, changedFiles, changedFileMtimes } = discoveryResult;
|
|
12122
12123
|
filesDiscovered = currentFiles.length;
|
|
12124
|
+
filesChanged = changedFiles.length;
|
|
12123
12125
|
const currentFileSet = new Set(currentFiles.map((f) => path22.relative(rootDir, f)));
|
|
12126
|
+
const changedFileSet = new Set(changedFiles);
|
|
12124
12127
|
let totalIndexed = 0;
|
|
12125
12128
|
let totalRemoved = 0;
|
|
12126
12129
|
let totalUnchanged = 0;
|
|
@@ -12191,82 +12194,38 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12191
12194
|
},
|
|
12192
12195
|
getIntrospection: (filepath) => introspection.getFile(filepath)
|
|
12193
12196
|
};
|
|
12194
|
-
const
|
|
12197
|
+
const moduleChangedFiles = module2.supportsFile ? changedFiles.filter((f) => module2.supportsFile(f)) : changedFiles;
|
|
12198
|
+
const filesToProcess = moduleChangedFiles.map((filepath) => {
|
|
12195
12199
|
const relativePath = path22.relative(rootDir, filepath);
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
return { filepath, relativePath, lastModified, fileSize, needsCheck: false, isNew: false, existingContentHash: existingEntry.contentHash };
|
|
12209
|
-
}
|
|
12210
|
-
return { filepath, relativePath, lastModified, fileSize, needsCheck: true, isNew: false, existingContentHash: existingEntry.contentHash };
|
|
12211
|
-
} catch {
|
|
12212
|
-
return null;
|
|
12213
|
-
}
|
|
12214
|
-
};
|
|
12215
|
-
const statCheckStart = Date.now();
|
|
12216
|
-
const statResults = await parallelMap(currentFiles, statCheck, STAT_CONCURRENCY);
|
|
12217
|
-
statCheckMs += Date.now() - statCheckStart;
|
|
12218
|
-
filesStatChecked += currentFiles.length;
|
|
12219
|
-
const filesToProcess = [];
|
|
12220
|
-
const filesWithMtimeOnlyChange = [];
|
|
12221
|
-
let unchangedCount = 0;
|
|
12222
|
-
for (const result2 of statResults) {
|
|
12223
|
-
if (!result2.success || !result2.value)
|
|
12224
|
-
continue;
|
|
12225
|
-
if (result2.value.needsCheck) {
|
|
12226
|
-
filesToProcess.push(result2.value);
|
|
12227
|
-
} else {
|
|
12228
|
-
unchangedCount++;
|
|
12229
|
-
const existingEntry = manifest.files[result2.value.relativePath];
|
|
12230
|
-
if (existingEntry && existingEntry.lastModified !== result2.value.lastModified) {
|
|
12231
|
-
filesWithMtimeOnlyChange.push(result2.value);
|
|
12232
|
-
}
|
|
12233
|
-
}
|
|
12234
|
-
}
|
|
12235
|
-
let mtimeOnlyUpdates = 0;
|
|
12236
|
-
for (const file of filesWithMtimeOnlyChange) {
|
|
12237
|
-
const existingEntry = manifest.files[file.relativePath];
|
|
12238
|
-
if (existingEntry) {
|
|
12239
|
-
manifest.files[file.relativePath] = {
|
|
12240
|
-
...existingEntry,
|
|
12241
|
-
lastModified: file.lastModified,
|
|
12242
|
-
fileSize: file.fileSize
|
|
12243
|
-
};
|
|
12244
|
-
mtimeOnlyUpdates++;
|
|
12245
|
-
}
|
|
12246
|
-
}
|
|
12200
|
+
const existingEntry = manifest.files[relativePath];
|
|
12201
|
+
const lastModified = changedFileMtimes.get(filepath) || new Date().toISOString();
|
|
12202
|
+
return {
|
|
12203
|
+
filepath,
|
|
12204
|
+
relativePath,
|
|
12205
|
+
lastModified,
|
|
12206
|
+
isNew: !existingEntry,
|
|
12207
|
+
existingContentHash: existingEntry?.contentHash
|
|
12208
|
+
};
|
|
12209
|
+
});
|
|
12210
|
+
const moduleAllFiles = module2.supportsFile ? currentFiles.filter((f) => module2.supportsFile(f)) : currentFiles;
|
|
12211
|
+
const unchangedCount = moduleAllFiles.length - filesToProcess.length;
|
|
12247
12212
|
if (filesToProcess.length === 0) {
|
|
12248
12213
|
totalUnchanged += unchangedCount;
|
|
12249
|
-
if (mtimeOnlyUpdates > 0) {
|
|
12250
|
-
manifest.lastUpdated = new Date().toISOString();
|
|
12251
|
-
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
12252
|
-
}
|
|
12253
12214
|
continue;
|
|
12254
12215
|
}
|
|
12255
12216
|
let completedCount = 0;
|
|
12256
12217
|
const totalToProcess = filesToProcess.length;
|
|
12257
|
-
const processChangedFile = async (
|
|
12258
|
-
const { filepath, relativePath, lastModified,
|
|
12218
|
+
const processChangedFile = async (fileToProcess) => {
|
|
12219
|
+
const { filepath, relativePath, lastModified, isNew, existingContentHash } = fileToProcess;
|
|
12259
12220
|
try {
|
|
12260
12221
|
const content = await fs8.readFile(filepath, "utf-8");
|
|
12261
12222
|
const contentHash = computeContentHash(content);
|
|
12262
|
-
|
|
12263
|
-
if (!isNew && existingEntry?.contentHash && existingEntry.contentHash === contentHash) {
|
|
12223
|
+
if (!isNew && existingContentHash && existingContentHash === contentHash) {
|
|
12264
12224
|
completedCount++;
|
|
12265
12225
|
return {
|
|
12266
12226
|
relativePath,
|
|
12267
12227
|
status: "mtime_updated",
|
|
12268
12228
|
lastModified,
|
|
12269
|
-
fileSize,
|
|
12270
12229
|
contentHash
|
|
12271
12230
|
};
|
|
12272
12231
|
}
|
|
@@ -12275,14 +12234,13 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12275
12234
|
introspection.addFile(relativePath, content);
|
|
12276
12235
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
12277
12236
|
if (!fileIndex) {
|
|
12278
|
-
return { relativePath, status: "unchanged"
|
|
12237
|
+
return { relativePath, status: "unchanged" };
|
|
12279
12238
|
}
|
|
12280
12239
|
await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
|
|
12281
12240
|
return {
|
|
12282
12241
|
relativePath,
|
|
12283
12242
|
status: "indexed",
|
|
12284
12243
|
lastModified,
|
|
12285
|
-
fileSize,
|
|
12286
12244
|
chunkCount: fileIndex.chunks.length,
|
|
12287
12245
|
contentHash
|
|
12288
12246
|
};
|
|
@@ -12295,7 +12253,6 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12295
12253
|
const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
|
|
12296
12254
|
const results = await parallelMap(filesToProcess, processChangedFile, concurrency);
|
|
12297
12255
|
indexingMs += Date.now() - indexingStart;
|
|
12298
|
-
filesWithChanges += filesToProcess.length;
|
|
12299
12256
|
totalUnchanged += unchangedCount;
|
|
12300
12257
|
logger.clearProgress();
|
|
12301
12258
|
let mtimeUpdates = 0;
|
|
@@ -12309,18 +12266,17 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12309
12266
|
manifest.files[fileResult.relativePath] = {
|
|
12310
12267
|
lastModified: fileResult.lastModified,
|
|
12311
12268
|
chunkCount: fileResult.chunkCount,
|
|
12312
|
-
contentHash: fileResult.contentHash
|
|
12313
|
-
fileSize: fileResult.fileSize
|
|
12269
|
+
contentHash: fileResult.contentHash
|
|
12314
12270
|
};
|
|
12315
12271
|
totalIndexed++;
|
|
12272
|
+
filesReindexed++;
|
|
12316
12273
|
break;
|
|
12317
12274
|
case "mtime_updated":
|
|
12318
12275
|
if (manifest.files[fileResult.relativePath]) {
|
|
12319
12276
|
manifest.files[fileResult.relativePath] = {
|
|
12320
12277
|
...manifest.files[fileResult.relativePath],
|
|
12321
12278
|
lastModified: fileResult.lastModified,
|
|
12322
|
-
contentHash: fileResult.contentHash
|
|
12323
|
-
fileSize: fileResult.fileSize
|
|
12279
|
+
contentHash: fileResult.contentHash
|
|
12324
12280
|
};
|
|
12325
12281
|
mtimeUpdates++;
|
|
12326
12282
|
}
|
|
@@ -12334,7 +12290,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12334
12290
|
break;
|
|
12335
12291
|
}
|
|
12336
12292
|
}
|
|
12337
|
-
const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0
|
|
12293
|
+
const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0;
|
|
12338
12294
|
if (hasManifestChanges) {
|
|
12339
12295
|
manifest.lastUpdated = new Date().toISOString();
|
|
12340
12296
|
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
@@ -12350,8 +12306,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12350
12306
|
if (totalIndexed > 0) {
|
|
12351
12307
|
await introspection.save(config);
|
|
12352
12308
|
}
|
|
12309
|
+
await updateGlobalManifest(rootDir, enabledModules, config, indexStartTime);
|
|
12353
12310
|
if (totalIndexed > 0 || totalRemoved > 0) {
|
|
12354
|
-
await updateGlobalManifest(rootDir, enabledModules, config);
|
|
12355
12311
|
clearFreshnessCache();
|
|
12356
12312
|
}
|
|
12357
12313
|
const result = {
|
|
@@ -12363,13 +12319,11 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12363
12319
|
result.timing = {
|
|
12364
12320
|
totalMs: Date.now() - startTime,
|
|
12365
12321
|
fileDiscoveryMs,
|
|
12366
|
-
statCheckMs,
|
|
12367
12322
|
indexingMs,
|
|
12368
12323
|
cleanupMs,
|
|
12369
12324
|
filesDiscovered,
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
filesReindexed: totalIndexed,
|
|
12325
|
+
filesChanged,
|
|
12326
|
+
filesReindexed,
|
|
12373
12327
|
fromCache: false
|
|
12374
12328
|
};
|
|
12375
12329
|
}
|
|
@@ -12439,7 +12393,6 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12439
12393
|
try {
|
|
12440
12394
|
const stats = await fs8.stat(filepath);
|
|
12441
12395
|
const lastModified = stats.mtime.toISOString();
|
|
12442
|
-
const fileSize = stats.size;
|
|
12443
12396
|
const existingEntry = manifest.files[relativePath];
|
|
12444
12397
|
if (existingEntry && existingEntry.lastModified === lastModified) {
|
|
12445
12398
|
completedCount++;
|
|
@@ -12455,7 +12408,6 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12455
12408
|
relativePath,
|
|
12456
12409
|
status: "skipped",
|
|
12457
12410
|
lastModified,
|
|
12458
|
-
fileSize,
|
|
12459
12411
|
contentHash
|
|
12460
12412
|
};
|
|
12461
12413
|
}
|
|
@@ -12465,14 +12417,13 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12465
12417
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
12466
12418
|
if (!fileIndex) {
|
|
12467
12419
|
logger.debug(` [${completedCount}/${totalFiles}] Skipped ${relativePath} (no chunks)`);
|
|
12468
|
-
return { relativePath, status: "skipped"
|
|
12420
|
+
return { relativePath, status: "skipped" };
|
|
12469
12421
|
}
|
|
12470
12422
|
await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
|
|
12471
12423
|
return {
|
|
12472
12424
|
relativePath,
|
|
12473
12425
|
status: "indexed",
|
|
12474
12426
|
lastModified,
|
|
12475
|
-
fileSize,
|
|
12476
12427
|
chunkCount: fileIndex.chunks.length,
|
|
12477
12428
|
contentHash
|
|
12478
12429
|
};
|
|
@@ -12495,8 +12446,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12495
12446
|
manifest.files[fileResult.relativePath] = {
|
|
12496
12447
|
lastModified: fileResult.lastModified,
|
|
12497
12448
|
chunkCount: fileResult.chunkCount,
|
|
12498
|
-
contentHash: fileResult.contentHash
|
|
12499
|
-
fileSize: fileResult.fileSize
|
|
12449
|
+
contentHash: fileResult.contentHash
|
|
12500
12450
|
};
|
|
12501
12451
|
result.indexed++;
|
|
12502
12452
|
break;
|
|
@@ -12507,8 +12457,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12507
12457
|
manifest.files[fileResult.relativePath] = {
|
|
12508
12458
|
...existingEntry,
|
|
12509
12459
|
lastModified: fileResult.lastModified,
|
|
12510
|
-
contentHash: fileResult.contentHash
|
|
12511
|
-
fileSize: fileResult.fileSize
|
|
12460
|
+
contentHash: fileResult.contentHash
|
|
12512
12461
|
};
|
|
12513
12462
|
}
|
|
12514
12463
|
}
|
|
@@ -12524,15 +12473,49 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12524
12473
|
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
12525
12474
|
return result;
|
|
12526
12475
|
}
|
|
12527
|
-
async function
|
|
12476
|
+
async function findFilesWithStats(rootDir, config, lastIndexStarted) {
|
|
12528
12477
|
const validExtensions = new Set(config.extensions);
|
|
12529
12478
|
const ignoreDirs = new Set(config.ignorePaths);
|
|
12479
|
+
const lastIndexMs = lastIndexStarted?.getTime() ?? 0;
|
|
12530
12480
|
const crawler = new Builder().withFullPaths().exclude((dirName) => ignoreDirs.has(dirName)).filter((filePath) => {
|
|
12531
12481
|
const ext = path22.extname(filePath);
|
|
12532
12482
|
return validExtensions.has(ext);
|
|
12533
12483
|
}).crawl(rootDir);
|
|
12534
|
-
const
|
|
12535
|
-
|
|
12484
|
+
const allFiles = await crawler.withPromise();
|
|
12485
|
+
if (!lastIndexStarted) {
|
|
12486
|
+
const changedFileMtimes2 = new Map;
|
|
12487
|
+
await parallelMap(allFiles, async (filePath) => {
|
|
12488
|
+
try {
|
|
12489
|
+
const stats = await fs8.stat(filePath);
|
|
12490
|
+
changedFileMtimes2.set(filePath, stats.mtime.toISOString());
|
|
12491
|
+
} catch {}
|
|
12492
|
+
}, STAT_CONCURRENCY);
|
|
12493
|
+
return {
|
|
12494
|
+
allFiles,
|
|
12495
|
+
changedFiles: allFiles,
|
|
12496
|
+
changedFileMtimes: changedFileMtimes2
|
|
12497
|
+
};
|
|
12498
|
+
}
|
|
12499
|
+
const changedFiles = [];
|
|
12500
|
+
const changedFileMtimes = new Map;
|
|
12501
|
+
await parallelMap(allFiles, async (filePath) => {
|
|
12502
|
+
try {
|
|
12503
|
+
const stats = await fs8.stat(filePath);
|
|
12504
|
+
if (stats.mtimeMs > lastIndexMs) {
|
|
12505
|
+
changedFiles.push(filePath);
|
|
12506
|
+
changedFileMtimes.set(filePath, stats.mtime.toISOString());
|
|
12507
|
+
}
|
|
12508
|
+
} catch {}
|
|
12509
|
+
}, STAT_CONCURRENCY);
|
|
12510
|
+
return {
|
|
12511
|
+
allFiles,
|
|
12512
|
+
changedFiles,
|
|
12513
|
+
changedFileMtimes
|
|
12514
|
+
};
|
|
12515
|
+
}
|
|
12516
|
+
async function findFiles(rootDir, config) {
|
|
12517
|
+
const result = await findFilesWithStats(rootDir, config, null);
|
|
12518
|
+
return result.allFiles;
|
|
12536
12519
|
}
|
|
12537
12520
|
async function loadModuleManifest(rootDir, moduleId, config) {
|
|
12538
12521
|
const manifestPath = getModuleManifestPath(rootDir, moduleId, config);
|
|
@@ -12559,11 +12542,21 @@ async function writeFileIndex(rootDir, moduleId, filepath, fileIndex, config) {
|
|
|
12559
12542
|
await fs8.mkdir(path22.dirname(indexFilePath), { recursive: true });
|
|
12560
12543
|
await fs8.writeFile(indexFilePath, JSON.stringify(fileIndex, null, 2));
|
|
12561
12544
|
}
|
|
12562
|
-
async function
|
|
12545
|
+
async function loadGlobalManifest(rootDir, config) {
|
|
12546
|
+
const manifestPath = getGlobalManifestPath(rootDir, config);
|
|
12547
|
+
try {
|
|
12548
|
+
const content = await fs8.readFile(manifestPath, "utf-8");
|
|
12549
|
+
return JSON.parse(content);
|
|
12550
|
+
} catch {
|
|
12551
|
+
return null;
|
|
12552
|
+
}
|
|
12553
|
+
}
|
|
12554
|
+
async function updateGlobalManifest(rootDir, modules, config, indexStartTime) {
|
|
12563
12555
|
const manifestPath = getGlobalManifestPath(rootDir, config);
|
|
12564
12556
|
const manifest = {
|
|
12565
12557
|
version: INDEX_SCHEMA_VERSION,
|
|
12566
12558
|
lastUpdated: new Date().toISOString(),
|
|
12559
|
+
lastIndexStarted: indexStartTime,
|
|
12567
12560
|
modules: modules.map((m) => m.id)
|
|
12568
12561
|
};
|
|
12569
12562
|
await fs8.mkdir(path22.dirname(manifestPath), { recursive: true });
|
|
@@ -12701,7 +12694,7 @@ async function getIndexStatus(rootDir) {
|
|
|
12701
12694
|
}
|
|
12702
12695
|
return status;
|
|
12703
12696
|
}
|
|
12704
|
-
var FRESHNESS_CACHE_TTL_MS = 5000, freshnessCache = null, INDEX_SCHEMA_VERSION = "2.0.0", DEFAULT_CONCURRENCY, STAT_CONCURRENCY;
|
|
12697
|
+
var FRESHNESS_CACHE_TTL_MS = 5000, freshnessCache = null, INDEX_SCHEMA_VERSION = "2.0.0", DEFAULT_CONCURRENCY, STAT_CONCURRENCY = 64;
|
|
12705
12698
|
var init_indexer = __esm(() => {
|
|
12706
12699
|
init_dist();
|
|
12707
12700
|
init_config2();
|
|
@@ -12710,7 +12703,6 @@ var init_indexer = __esm(() => {
|
|
|
12710
12703
|
init_logger();
|
|
12711
12704
|
init_watcher();
|
|
12712
12705
|
DEFAULT_CONCURRENCY = getOptimalConcurrency();
|
|
12713
|
-
STAT_CONCURRENCY = Math.max(32, getOptimalConcurrency() * 4);
|
|
12714
12706
|
});
|
|
12715
12707
|
|
|
12716
12708
|
// node_modules/balanced-match/index.js
|
|
@@ -14130,7 +14122,7 @@ async function search(rootDir, query, options = {}) {
|
|
|
14130
14122
|
console.log(`Searching for: "${query}"`);
|
|
14131
14123
|
const config = await loadConfig(rootDir);
|
|
14132
14124
|
await registerBuiltInModules();
|
|
14133
|
-
const globalManifest = await
|
|
14125
|
+
const globalManifest = await loadGlobalManifest2(rootDir, config);
|
|
14134
14126
|
if (!globalManifest || globalManifest.modules.length === 0) {
|
|
14135
14127
|
console.log('No index found. Run "raggrep index" first.');
|
|
14136
14128
|
return [];
|
|
@@ -14214,7 +14206,7 @@ async function traverseDirectory(dir, files, basePath) {
|
|
|
14214
14206
|
}
|
|
14215
14207
|
} catch {}
|
|
14216
14208
|
}
|
|
14217
|
-
async function
|
|
14209
|
+
async function loadGlobalManifest2(rootDir, config) {
|
|
14218
14210
|
const manifestPath = getGlobalManifestPath(rootDir, config);
|
|
14219
14211
|
try {
|
|
14220
14212
|
const content = await fs9.readFile(manifestPath, "utf-8");
|
|
@@ -14284,7 +14276,7 @@ init_logger();
|
|
|
14284
14276
|
// package.json
|
|
14285
14277
|
var package_default = {
|
|
14286
14278
|
name: "raggrep",
|
|
14287
|
-
version: "0.
|
|
14279
|
+
version: "0.11.0",
|
|
14288
14280
|
description: "Local filesystem-based RAG system for codebases - semantic search using local embeddings",
|
|
14289
14281
|
type: "module",
|
|
14290
14282
|
main: "./dist/index.js",
|
|
@@ -14634,9 +14626,8 @@ Examples:
|
|
|
14634
14626
|
console.log(`│ Cache hit (TTL-based) │`);
|
|
14635
14627
|
console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms │`);
|
|
14636
14628
|
} else {
|
|
14637
|
-
console.log(`│ File discovery: ${t.fileDiscoveryMs.toFixed(0).padStart(6)}ms │ ${String(t.filesDiscovered).padStart(6)} files
|
|
14638
|
-
console.log(`│
|
|
14639
|
-
console.log(`│ Indexing: ${t.indexingMs.toFixed(0).padStart(6)}ms │ ${String(t.filesWithChanges).padStart(6)} with changes → ${t.filesReindexed} reindexed`.padEnd(57) + "│");
|
|
14629
|
+
console.log(`│ File discovery: ${t.fileDiscoveryMs.toFixed(0).padStart(6)}ms │ ${String(t.filesDiscovered).padStart(6)} files, ${t.filesChanged} changed`.padEnd(57) + "│");
|
|
14630
|
+
console.log(`│ Indexing: ${t.indexingMs.toFixed(0).padStart(6)}ms │ ${String(t.filesReindexed).padStart(6)} reindexed`.padEnd(57) + "│");
|
|
14640
14631
|
console.log(`│ Cleanup: ${t.cleanupMs.toFixed(0).padStart(6)}ms │`.padEnd(57) + "│");
|
|
14641
14632
|
console.log(`│ ───────────────────────────────────────────────────── │`);
|
|
14642
14633
|
console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms`.padEnd(57) + "│");
|
|
@@ -14901,4 +14892,4 @@ Run 'raggrep <command> --help' for more information.
|
|
|
14901
14892
|
}
|
|
14902
14893
|
main();
|
|
14903
14894
|
|
|
14904
|
-
//# debugId=
|
|
14895
|
+
//# debugId=4E166248FB39358064756E2164756E21
|