raggrep 0.10.5 → 0.10.7
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 +6 -4
- package/dist/cli/main.js +64 -27
- package/dist/cli/main.js.map +4 -4
- package/dist/domain/entities/fileIndex.d.ts +5 -0
- package/dist/index.js +53 -16
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -36,6 +36,11 @@ export interface FileManifestEntry {
|
|
|
36
36
|
* This prevents false positives when git updates mtime on branch switches.
|
|
37
37
|
*/
|
|
38
38
|
contentHash?: string;
|
|
39
|
+
/**
|
|
40
|
+
* File size in bytes. Used as a quick filter:
|
|
41
|
+
* If mtime changed but size is same, content is likely unchanged.
|
|
42
|
+
*/
|
|
43
|
+
fileSize?: number;
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
41
46
|
* Manifest tracking all indexed files for a specific module.
|
package/dist/index.js
CHANGED
|
@@ -12099,7 +12099,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12099
12099
|
let cleanupMs = 0;
|
|
12100
12100
|
let filesDiscovered = 0;
|
|
12101
12101
|
let filesStatChecked = 0;
|
|
12102
|
-
let
|
|
12102
|
+
let filesWithChanges = 0;
|
|
12103
|
+
let filesReindexed = 0;
|
|
12103
12104
|
const logger = options.logger ? options.logger : quiet ? createSilentLogger() : createLogger({ verbose });
|
|
12104
12105
|
rootDir = path21.resolve(rootDir);
|
|
12105
12106
|
const status = await getIndexStatus(rootDir);
|
|
@@ -12141,7 +12142,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12141
12142
|
cleanupMs: 0,
|
|
12142
12143
|
filesDiscovered: 0,
|
|
12143
12144
|
filesStatChecked: 0,
|
|
12144
|
-
|
|
12145
|
+
filesWithChanges: 0,
|
|
12146
|
+
filesReindexed: 0,
|
|
12145
12147
|
fromCache: true
|
|
12146
12148
|
};
|
|
12147
12149
|
}
|
|
@@ -12236,14 +12238,18 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12236
12238
|
try {
|
|
12237
12239
|
const stats = await fs8.stat(filepath);
|
|
12238
12240
|
const lastModified = stats.mtime.toISOString();
|
|
12241
|
+
const fileSize = stats.size;
|
|
12239
12242
|
const existingEntry = manifest.files[relativePath];
|
|
12240
12243
|
if (!existingEntry) {
|
|
12241
|
-
return { filepath, relativePath, lastModified, needsCheck: true, isNew: true };
|
|
12244
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: true, isNew: true };
|
|
12242
12245
|
}
|
|
12243
12246
|
if (existingEntry.lastModified === lastModified) {
|
|
12244
|
-
return { filepath, relativePath, lastModified, needsCheck: false, isNew: false };
|
|
12247
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: false, isNew: false };
|
|
12245
12248
|
}
|
|
12246
|
-
|
|
12249
|
+
if (existingEntry.fileSize !== undefined && existingEntry.fileSize === fileSize && existingEntry.contentHash) {
|
|
12250
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: false, isNew: false, existingContentHash: existingEntry.contentHash };
|
|
12251
|
+
}
|
|
12252
|
+
return { filepath, relativePath, lastModified, fileSize, needsCheck: true, isNew: false, existingContentHash: existingEntry.contentHash };
|
|
12247
12253
|
} catch {
|
|
12248
12254
|
return null;
|
|
12249
12255
|
}
|
|
@@ -12253,6 +12259,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12253
12259
|
statCheckMs += Date.now() - statCheckStart;
|
|
12254
12260
|
filesStatChecked += currentFiles.length;
|
|
12255
12261
|
const filesToProcess = [];
|
|
12262
|
+
const filesWithMtimeOnlyChange = [];
|
|
12256
12263
|
let unchangedCount = 0;
|
|
12257
12264
|
for (const result2 of statResults) {
|
|
12258
12265
|
if (!result2.success || !result2.value)
|
|
@@ -12261,16 +12268,36 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12261
12268
|
filesToProcess.push(result2.value);
|
|
12262
12269
|
} else {
|
|
12263
12270
|
unchangedCount++;
|
|
12271
|
+
const existingEntry = manifest.files[result2.value.relativePath];
|
|
12272
|
+
if (existingEntry && existingEntry.lastModified !== result2.value.lastModified) {
|
|
12273
|
+
filesWithMtimeOnlyChange.push(result2.value);
|
|
12274
|
+
}
|
|
12275
|
+
}
|
|
12276
|
+
}
|
|
12277
|
+
let mtimeOnlyUpdates = 0;
|
|
12278
|
+
for (const file of filesWithMtimeOnlyChange) {
|
|
12279
|
+
const existingEntry = manifest.files[file.relativePath];
|
|
12280
|
+
if (existingEntry) {
|
|
12281
|
+
manifest.files[file.relativePath] = {
|
|
12282
|
+
...existingEntry,
|
|
12283
|
+
lastModified: file.lastModified,
|
|
12284
|
+
fileSize: file.fileSize
|
|
12285
|
+
};
|
|
12286
|
+
mtimeOnlyUpdates++;
|
|
12264
12287
|
}
|
|
12265
12288
|
}
|
|
12266
12289
|
if (filesToProcess.length === 0) {
|
|
12267
12290
|
totalUnchanged += unchangedCount;
|
|
12291
|
+
if (mtimeOnlyUpdates > 0) {
|
|
12292
|
+
manifest.lastUpdated = new Date().toISOString();
|
|
12293
|
+
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
12294
|
+
}
|
|
12268
12295
|
continue;
|
|
12269
12296
|
}
|
|
12270
12297
|
let completedCount = 0;
|
|
12271
12298
|
const totalToProcess = filesToProcess.length;
|
|
12272
12299
|
const processChangedFile = async (statResult) => {
|
|
12273
|
-
const { filepath, relativePath, lastModified, isNew } = statResult;
|
|
12300
|
+
const { filepath, relativePath, lastModified, fileSize, isNew } = statResult;
|
|
12274
12301
|
try {
|
|
12275
12302
|
const content = await fs8.readFile(filepath, "utf-8");
|
|
12276
12303
|
const contentHash = computeContentHash(content);
|
|
@@ -12281,6 +12308,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12281
12308
|
relativePath,
|
|
12282
12309
|
status: "mtime_updated",
|
|
12283
12310
|
lastModified,
|
|
12311
|
+
fileSize,
|
|
12284
12312
|
contentHash
|
|
12285
12313
|
};
|
|
12286
12314
|
}
|
|
@@ -12289,13 +12317,14 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12289
12317
|
introspection.addFile(relativePath, content);
|
|
12290
12318
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
12291
12319
|
if (!fileIndex) {
|
|
12292
|
-
return { relativePath, status: "unchanged" };
|
|
12320
|
+
return { relativePath, status: "unchanged", fileSize };
|
|
12293
12321
|
}
|
|
12294
12322
|
await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
|
|
12295
12323
|
return {
|
|
12296
12324
|
relativePath,
|
|
12297
12325
|
status: "indexed",
|
|
12298
12326
|
lastModified,
|
|
12327
|
+
fileSize,
|
|
12299
12328
|
chunkCount: fileIndex.chunks.length,
|
|
12300
12329
|
contentHash
|
|
12301
12330
|
};
|
|
@@ -12308,7 +12337,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12308
12337
|
const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
|
|
12309
12338
|
const results = await parallelMap(filesToProcess, processChangedFile, concurrency);
|
|
12310
12339
|
indexingMs += Date.now() - indexingStart;
|
|
12311
|
-
|
|
12340
|
+
filesWithChanges += filesToProcess.length;
|
|
12312
12341
|
totalUnchanged += unchangedCount;
|
|
12313
12342
|
logger.clearProgress();
|
|
12314
12343
|
let mtimeUpdates = 0;
|
|
@@ -12322,7 +12351,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12322
12351
|
manifest.files[fileResult.relativePath] = {
|
|
12323
12352
|
lastModified: fileResult.lastModified,
|
|
12324
12353
|
chunkCount: fileResult.chunkCount,
|
|
12325
|
-
contentHash: fileResult.contentHash
|
|
12354
|
+
contentHash: fileResult.contentHash,
|
|
12355
|
+
fileSize: fileResult.fileSize
|
|
12326
12356
|
};
|
|
12327
12357
|
totalIndexed++;
|
|
12328
12358
|
break;
|
|
@@ -12331,7 +12361,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12331
12361
|
manifest.files[fileResult.relativePath] = {
|
|
12332
12362
|
...manifest.files[fileResult.relativePath],
|
|
12333
12363
|
lastModified: fileResult.lastModified,
|
|
12334
|
-
contentHash: fileResult.contentHash
|
|
12364
|
+
contentHash: fileResult.contentHash,
|
|
12365
|
+
fileSize: fileResult.fileSize
|
|
12335
12366
|
};
|
|
12336
12367
|
mtimeUpdates++;
|
|
12337
12368
|
}
|
|
@@ -12345,7 +12376,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12345
12376
|
break;
|
|
12346
12377
|
}
|
|
12347
12378
|
}
|
|
12348
|
-
const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0;
|
|
12379
|
+
const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0 || mtimeOnlyUpdates > 0;
|
|
12349
12380
|
if (hasManifestChanges) {
|
|
12350
12381
|
manifest.lastUpdated = new Date().toISOString();
|
|
12351
12382
|
await writeModuleManifest(rootDir, module2.id, manifest, config);
|
|
@@ -12379,7 +12410,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12379
12410
|
cleanupMs,
|
|
12380
12411
|
filesDiscovered,
|
|
12381
12412
|
filesStatChecked,
|
|
12382
|
-
|
|
12413
|
+
filesWithChanges,
|
|
12414
|
+
filesReindexed: totalIndexed,
|
|
12383
12415
|
fromCache: false
|
|
12384
12416
|
};
|
|
12385
12417
|
}
|
|
@@ -12449,6 +12481,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12449
12481
|
try {
|
|
12450
12482
|
const stats = await fs8.stat(filepath);
|
|
12451
12483
|
const lastModified = stats.mtime.toISOString();
|
|
12484
|
+
const fileSize = stats.size;
|
|
12452
12485
|
const existingEntry = manifest.files[relativePath];
|
|
12453
12486
|
if (existingEntry && existingEntry.lastModified === lastModified) {
|
|
12454
12487
|
completedCount++;
|
|
@@ -12464,6 +12497,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12464
12497
|
relativePath,
|
|
12465
12498
|
status: "skipped",
|
|
12466
12499
|
lastModified,
|
|
12500
|
+
fileSize,
|
|
12467
12501
|
contentHash
|
|
12468
12502
|
};
|
|
12469
12503
|
}
|
|
@@ -12473,13 +12507,14 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12473
12507
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
12474
12508
|
if (!fileIndex) {
|
|
12475
12509
|
logger.debug(` [${completedCount}/${totalFiles}] Skipped ${relativePath} (no chunks)`);
|
|
12476
|
-
return { relativePath, status: "skipped" };
|
|
12510
|
+
return { relativePath, status: "skipped", fileSize };
|
|
12477
12511
|
}
|
|
12478
12512
|
await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
|
|
12479
12513
|
return {
|
|
12480
12514
|
relativePath,
|
|
12481
12515
|
status: "indexed",
|
|
12482
12516
|
lastModified,
|
|
12517
|
+
fileSize,
|
|
12483
12518
|
chunkCount: fileIndex.chunks.length,
|
|
12484
12519
|
contentHash
|
|
12485
12520
|
};
|
|
@@ -12502,7 +12537,8 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12502
12537
|
manifest.files[fileResult.relativePath] = {
|
|
12503
12538
|
lastModified: fileResult.lastModified,
|
|
12504
12539
|
chunkCount: fileResult.chunkCount,
|
|
12505
|
-
contentHash: fileResult.contentHash
|
|
12540
|
+
contentHash: fileResult.contentHash,
|
|
12541
|
+
fileSize: fileResult.fileSize
|
|
12506
12542
|
};
|
|
12507
12543
|
result.indexed++;
|
|
12508
12544
|
break;
|
|
@@ -12513,7 +12549,8 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12513
12549
|
manifest.files[fileResult.relativePath] = {
|
|
12514
12550
|
...existingEntry,
|
|
12515
12551
|
lastModified: fileResult.lastModified,
|
|
12516
|
-
contentHash: fileResult.contentHash
|
|
12552
|
+
contentHash: fileResult.contentHash,
|
|
12553
|
+
fileSize: fileResult.fileSize
|
|
12517
12554
|
};
|
|
12518
12555
|
}
|
|
12519
12556
|
}
|
|
@@ -14115,4 +14152,4 @@ export {
|
|
|
14115
14152
|
ConsoleLogger
|
|
14116
14153
|
};
|
|
14117
14154
|
|
|
14118
|
-
//# debugId=
|
|
14155
|
+
//# debugId=120D75FB1F633A7A64756E2164756E21
|