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.
@@ -38,12 +38,14 @@ export interface TimingInfo {
38
38
  indexingMs: number;
39
39
  /** Time spent on cleanup operations */
40
40
  cleanupMs: number;
41
- /** Number of files discovered */
41
+ /** Number of files discovered on disk */
42
42
  filesDiscovered: number;
43
- /** Number of files that needed stat check */
43
+ /** Number of files that had stat checks performed (may be > filesDiscovered due to multiple modules) */
44
44
  filesStatChecked: number;
45
- /** Number of files that needed indexing */
46
- filesIndexed: number;
45
+ /** Number of files with detected changes (mtime or size changed) that went to Phase 2 */
46
+ filesWithChanges: number;
47
+ /** Number of files that were actually re-indexed (content changed) */
48
+ filesReindexed: number;
47
49
  /** Whether result was from cache */
48
50
  fromCache: boolean;
49
51
  }
package/dist/cli/main.js CHANGED
@@ -12057,7 +12057,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
12057
12057
  let cleanupMs = 0;
12058
12058
  let filesDiscovered = 0;
12059
12059
  let filesStatChecked = 0;
12060
- let filesIndexed = 0;
12060
+ let filesWithChanges = 0;
12061
+ let filesReindexed = 0;
12061
12062
  const logger = options.logger ? options.logger : quiet ? createSilentLogger() : createLogger({ verbose });
12062
12063
  rootDir = path22.resolve(rootDir);
12063
12064
  const status = await getIndexStatus(rootDir);
@@ -12099,7 +12100,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
12099
12100
  cleanupMs: 0,
12100
12101
  filesDiscovered: 0,
12101
12102
  filesStatChecked: 0,
12102
- filesIndexed: 0,
12103
+ filesWithChanges: 0,
12104
+ filesReindexed: 0,
12103
12105
  fromCache: true
12104
12106
  };
12105
12107
  }
@@ -12194,14 +12196,18 @@ async function ensureIndexFresh(rootDir, options = {}) {
12194
12196
  try {
12195
12197
  const stats = await fs8.stat(filepath);
12196
12198
  const lastModified = stats.mtime.toISOString();
12199
+ const fileSize = stats.size;
12197
12200
  const existingEntry = manifest.files[relativePath];
12198
12201
  if (!existingEntry) {
12199
- return { filepath, relativePath, lastModified, needsCheck: true, isNew: true };
12202
+ return { filepath, relativePath, lastModified, fileSize, needsCheck: true, isNew: true };
12200
12203
  }
12201
12204
  if (existingEntry.lastModified === lastModified) {
12202
- return { filepath, relativePath, lastModified, needsCheck: false, isNew: false };
12205
+ return { filepath, relativePath, lastModified, fileSize, needsCheck: false, isNew: false };
12203
12206
  }
12204
- return { filepath, relativePath, lastModified, needsCheck: true, isNew: false };
12207
+ if (existingEntry.fileSize !== undefined && existingEntry.fileSize === fileSize && existingEntry.contentHash) {
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 };
12205
12211
  } catch {
12206
12212
  return null;
12207
12213
  }
@@ -12211,6 +12217,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
12211
12217
  statCheckMs += Date.now() - statCheckStart;
12212
12218
  filesStatChecked += currentFiles.length;
12213
12219
  const filesToProcess = [];
12220
+ const filesWithMtimeOnlyChange = [];
12214
12221
  let unchangedCount = 0;
12215
12222
  for (const result2 of statResults) {
12216
12223
  if (!result2.success || !result2.value)
@@ -12219,16 +12226,36 @@ async function ensureIndexFresh(rootDir, options = {}) {
12219
12226
  filesToProcess.push(result2.value);
12220
12227
  } else {
12221
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++;
12222
12245
  }
12223
12246
  }
12224
12247
  if (filesToProcess.length === 0) {
12225
12248
  totalUnchanged += unchangedCount;
12249
+ if (mtimeOnlyUpdates > 0) {
12250
+ manifest.lastUpdated = new Date().toISOString();
12251
+ await writeModuleManifest(rootDir, module2.id, manifest, config);
12252
+ }
12226
12253
  continue;
12227
12254
  }
12228
12255
  let completedCount = 0;
12229
12256
  const totalToProcess = filesToProcess.length;
12230
12257
  const processChangedFile = async (statResult) => {
12231
- const { filepath, relativePath, lastModified, isNew } = statResult;
12258
+ const { filepath, relativePath, lastModified, fileSize, isNew } = statResult;
12232
12259
  try {
12233
12260
  const content = await fs8.readFile(filepath, "utf-8");
12234
12261
  const contentHash = computeContentHash(content);
@@ -12239,6 +12266,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
12239
12266
  relativePath,
12240
12267
  status: "mtime_updated",
12241
12268
  lastModified,
12269
+ fileSize,
12242
12270
  contentHash
12243
12271
  };
12244
12272
  }
@@ -12247,13 +12275,14 @@ async function ensureIndexFresh(rootDir, options = {}) {
12247
12275
  introspection.addFile(relativePath, content);
12248
12276
  const fileIndex = await module2.indexFile(relativePath, content, ctx);
12249
12277
  if (!fileIndex) {
12250
- return { relativePath, status: "unchanged" };
12278
+ return { relativePath, status: "unchanged", fileSize };
12251
12279
  }
12252
12280
  await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
12253
12281
  return {
12254
12282
  relativePath,
12255
12283
  status: "indexed",
12256
12284
  lastModified,
12285
+ fileSize,
12257
12286
  chunkCount: fileIndex.chunks.length,
12258
12287
  contentHash
12259
12288
  };
@@ -12266,7 +12295,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
12266
12295
  const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
12267
12296
  const results = await parallelMap(filesToProcess, processChangedFile, concurrency);
12268
12297
  indexingMs += Date.now() - indexingStart;
12269
- filesIndexed += filesToProcess.length;
12298
+ filesWithChanges += filesToProcess.length;
12270
12299
  totalUnchanged += unchangedCount;
12271
12300
  logger.clearProgress();
12272
12301
  let mtimeUpdates = 0;
@@ -12280,7 +12309,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
12280
12309
  manifest.files[fileResult.relativePath] = {
12281
12310
  lastModified: fileResult.lastModified,
12282
12311
  chunkCount: fileResult.chunkCount,
12283
- contentHash: fileResult.contentHash
12312
+ contentHash: fileResult.contentHash,
12313
+ fileSize: fileResult.fileSize
12284
12314
  };
12285
12315
  totalIndexed++;
12286
12316
  break;
@@ -12289,7 +12319,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
12289
12319
  manifest.files[fileResult.relativePath] = {
12290
12320
  ...manifest.files[fileResult.relativePath],
12291
12321
  lastModified: fileResult.lastModified,
12292
- contentHash: fileResult.contentHash
12322
+ contentHash: fileResult.contentHash,
12323
+ fileSize: fileResult.fileSize
12293
12324
  };
12294
12325
  mtimeUpdates++;
12295
12326
  }
@@ -12303,7 +12334,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
12303
12334
  break;
12304
12335
  }
12305
12336
  }
12306
- const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0;
12337
+ const hasManifestChanges = totalIndexed > 0 || totalRemoved > 0 || mtimeUpdates > 0 || mtimeOnlyUpdates > 0;
12307
12338
  if (hasManifestChanges) {
12308
12339
  manifest.lastUpdated = new Date().toISOString();
12309
12340
  await writeModuleManifest(rootDir, module2.id, manifest, config);
@@ -12337,7 +12368,8 @@ async function ensureIndexFresh(rootDir, options = {}) {
12337
12368
  cleanupMs,
12338
12369
  filesDiscovered,
12339
12370
  filesStatChecked,
12340
- filesIndexed,
12371
+ filesWithChanges,
12372
+ filesReindexed: totalIndexed,
12341
12373
  fromCache: false
12342
12374
  };
12343
12375
  }
@@ -12407,6 +12439,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
12407
12439
  try {
12408
12440
  const stats = await fs8.stat(filepath);
12409
12441
  const lastModified = stats.mtime.toISOString();
12442
+ const fileSize = stats.size;
12410
12443
  const existingEntry = manifest.files[relativePath];
12411
12444
  if (existingEntry && existingEntry.lastModified === lastModified) {
12412
12445
  completedCount++;
@@ -12422,6 +12455,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
12422
12455
  relativePath,
12423
12456
  status: "skipped",
12424
12457
  lastModified,
12458
+ fileSize,
12425
12459
  contentHash
12426
12460
  };
12427
12461
  }
@@ -12431,13 +12465,14 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
12431
12465
  const fileIndex = await module2.indexFile(relativePath, content, ctx);
12432
12466
  if (!fileIndex) {
12433
12467
  logger.debug(` [${completedCount}/${totalFiles}] Skipped ${relativePath} (no chunks)`);
12434
- return { relativePath, status: "skipped" };
12468
+ return { relativePath, status: "skipped", fileSize };
12435
12469
  }
12436
12470
  await writeFileIndex(rootDir, module2.id, relativePath, fileIndex, config);
12437
12471
  return {
12438
12472
  relativePath,
12439
12473
  status: "indexed",
12440
12474
  lastModified,
12475
+ fileSize,
12441
12476
  chunkCount: fileIndex.chunks.length,
12442
12477
  contentHash
12443
12478
  };
@@ -12460,7 +12495,8 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
12460
12495
  manifest.files[fileResult.relativePath] = {
12461
12496
  lastModified: fileResult.lastModified,
12462
12497
  chunkCount: fileResult.chunkCount,
12463
- contentHash: fileResult.contentHash
12498
+ contentHash: fileResult.contentHash,
12499
+ fileSize: fileResult.fileSize
12464
12500
  };
12465
12501
  result.indexed++;
12466
12502
  break;
@@ -12471,7 +12507,8 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
12471
12507
  manifest.files[fileResult.relativePath] = {
12472
12508
  ...existingEntry,
12473
12509
  lastModified: fileResult.lastModified,
12474
- contentHash: fileResult.contentHash
12510
+ contentHash: fileResult.contentHash,
12511
+ fileSize: fileResult.fileSize
12475
12512
  };
12476
12513
  }
12477
12514
  }
@@ -14247,7 +14284,7 @@ init_logger();
14247
14284
  // package.json
14248
14285
  var package_default = {
14249
14286
  name: "raggrep",
14250
- version: "0.10.5",
14287
+ version: "0.10.7",
14251
14288
  description: "Local filesystem-based RAG system for codebases - semantic search using local embeddings",
14252
14289
  type: "module",
14253
14290
  main: "./dist/index.js",
@@ -14592,19 +14629,19 @@ Examples:
14592
14629
  }
14593
14630
  if (flags2.timing && freshStats.timing) {
14594
14631
  const t = freshStats.timing;
14595
- console.log("┌─ Timing ─────────────────────────────────────┐");
14632
+ console.log("┌─ Timing ───────────────────────────────────────────────┐");
14596
14633
  if (t.fromCache) {
14597
- console.log(`│ Cache hit (TTL-based) │`);
14598
- console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms │`);
14634
+ console.log(`│ Cache hit (TTL-based) │`);
14635
+ console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms │`);
14599
14636
  } else {
14600
- console.log(`│ File discovery: ${t.fileDiscoveryMs.toFixed(0).padStart(6)}ms (${t.filesDiscovered} files)`.padEnd(47) + "│");
14601
- console.log(`│ Stat checks: ${t.statCheckMs.toFixed(0).padStart(6)}ms (${t.filesStatChecked} files)`.padEnd(47) + "│");
14602
- console.log(`│ Indexing: ${t.indexingMs.toFixed(0).padStart(6)}ms (${t.filesIndexed} files)`.padEnd(47) + "│");
14603
- console.log(`│ Cleanup: ${t.cleanupMs.toFixed(0).padStart(6)}ms`.padEnd(47) + "│");
14604
- console.log(`│ ─────────────────────────────────────────── │`);
14605
- console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms`.padEnd(47) + "│");
14637
+ console.log(`│ File discovery: ${t.fileDiscoveryMs.toFixed(0).padStart(6)}ms${String(t.filesDiscovered).padStart(6)} files found`.padEnd(57) + "│");
14638
+ console.log(`│ Stat checks: ${t.statCheckMs.toFixed(0).padStart(6)}ms${String(t.filesStatChecked).padStart(6)} stats checked`.padEnd(57) + "│");
14639
+ console.log(`│ Indexing: ${t.indexingMs.toFixed(0).padStart(6)}ms │ ${String(t.filesWithChanges).padStart(6)} with changes → ${t.filesReindexed} reindexed`.padEnd(57) + "│");
14640
+ console.log(`│ Cleanup: ${t.cleanupMs.toFixed(0).padStart(6)}ms │`.padEnd(57) + "│");
14641
+ console.log(`│ ───────────────────────────────────────────────────── │`);
14642
+ console.log(`│ Total: ${t.totalMs.toFixed(0).padStart(6)}ms`.padEnd(57) + "│");
14606
14643
  }
14607
- console.log(`└──────────────────────────────────────────────┘
14644
+ console.log(`└────────────────────────────────────────────────────────┘
14608
14645
  `);
14609
14646
  }
14610
14647
  const filePatterns = flags2.fileType ? [`*.${flags2.fileType}`] : undefined;
@@ -14864,4 +14901,4 @@ Run 'raggrep <command> --help' for more information.
14864
14901
  }
14865
14902
  main();
14866
14903
 
14867
- //# debugId=D79BF0530F7DE02664756E2164756E21
14904
+ //# debugId=FECC7BE122B3EB1664756E2164756E21