@takara-ai/miru-code 1.8.0 → 1.8.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/miru-index.ts +21 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takara-ai/miru-code",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Miru (見る) — hybrid code search for agents. Bun, TypeScript, Takara embeddings.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/miru-index.ts CHANGED
@@ -11,7 +11,7 @@ import { cloneGitRepository } from "./git.ts";
11
11
  import type { BM25Index } from "./index/bm25.ts";
12
12
  import { buildChunkSelector } from "./index/chunk-selector.ts";
13
13
  import { createIndexFromPath } from "./index/create.ts";
14
- import { applyIncrementalFileChanges } from "./index/incremental.ts";
14
+ import { applyIncrementalFileChanges, normalizeRelativePath } from "./index/incremental.ts";
15
15
  import { persistencePaths, saveIndexBundle } from "./index/persistence.ts";
16
16
  import type { SemanticIndex } from "./index/semantic-index.ts";
17
17
  import { type LiteralLocateOptions, type LiteralLocateResult, locateLiteral } from "./literal.ts";
@@ -329,6 +329,25 @@ export class MiruIndex {
329
329
  file_mtimes: fileMtimes,
330
330
  },
331
331
  });
332
+ this.storedFileMtimes = new Map(Object.entries(fileMtimes));
333
+ }
334
+
335
+ private async updateStoredFileMtimes(relativePaths: readonly string[]): Promise<void> {
336
+ if (!this._root || relativePaths.length === 0) {
337
+ return;
338
+ }
339
+
340
+ const root = this._root;
341
+ await Promise.all(
342
+ [...new Set(relativePaths.map(normalizeRelativePath))].map(async (filePath) => {
343
+ try {
344
+ const stat = await Bun.file(resolve(root, filePath)).stat();
345
+ this.storedFileMtimes.set(filePath, Math.floor(stat.mtime?.getTime() ?? 0));
346
+ } catch {
347
+ this.storedFileMtimes.delete(filePath);
348
+ }
349
+ }),
350
+ );
332
351
  }
333
352
 
334
353
  /**
@@ -371,6 +390,7 @@ export class MiruIndex {
371
390
  this.semanticIndex = updated.semantic;
372
391
  this.loadedFromDiskFlag = false;
373
392
  this.rebuildMappings();
393
+ await this.updateStoredFileMtimes(relativePaths);
374
394
  }
375
395
 
376
396
  private getSelector(