raggrep 0.10.1 → 0.10.2
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 +5 -0
- package/dist/cli/main.js +37 -4
- package/dist/cli/main.js.map +4 -4
- package/dist/index.js +35 -2
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { EmbeddingModelName, Logger } from "../../domain/ports";
|
|
2
|
+
/**
|
|
3
|
+
* Clear the freshness cache.
|
|
4
|
+
* Call this after explicit indexing operations.
|
|
5
|
+
*/
|
|
6
|
+
export declare function clearFreshnessCache(): void;
|
|
2
7
|
export interface IndexResult {
|
|
3
8
|
moduleId: string;
|
|
4
9
|
indexed: number;
|
package/dist/cli/main.js
CHANGED
|
@@ -11235,6 +11235,7 @@ async function watchDirectory(rootDir, options = {}) {
|
|
|
11235
11235
|
isIndexing = true;
|
|
11236
11236
|
const changes = new Map(pendingChanges);
|
|
11237
11237
|
pendingChanges.clear();
|
|
11238
|
+
clearFreshnessCache();
|
|
11238
11239
|
try {
|
|
11239
11240
|
const filesToIndex = [];
|
|
11240
11241
|
const filesToDelete = [];
|
|
@@ -11377,6 +11378,7 @@ __export(exports_indexer, {
|
|
|
11377
11378
|
indexDirectory: () => indexDirectory,
|
|
11378
11379
|
getIndexStatus: () => getIndexStatus,
|
|
11379
11380
|
ensureIndexFresh: () => ensureIndexFresh,
|
|
11381
|
+
clearFreshnessCache: () => clearFreshnessCache,
|
|
11380
11382
|
cleanupIndex: () => cleanupIndex
|
|
11381
11383
|
});
|
|
11382
11384
|
import { glob } from "glob";
|
|
@@ -11384,6 +11386,9 @@ import * as fs8 from "fs/promises";
|
|
|
11384
11386
|
import * as path22 from "path";
|
|
11385
11387
|
import * as os3 from "os";
|
|
11386
11388
|
import * as crypto2 from "crypto";
|
|
11389
|
+
function clearFreshnessCache() {
|
|
11390
|
+
freshnessCache = null;
|
|
11391
|
+
}
|
|
11387
11392
|
function computeContentHash(content) {
|
|
11388
11393
|
return crypto2.createHash("sha256").update(content, "utf-8").digest("hex");
|
|
11389
11394
|
}
|
|
@@ -11427,6 +11432,7 @@ async function indexDirectory(rootDir, options = {}) {
|
|
|
11427
11432
|
const verbose = options.verbose ?? false;
|
|
11428
11433
|
const quiet = options.quiet ?? false;
|
|
11429
11434
|
const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
|
|
11435
|
+
clearFreshnessCache();
|
|
11430
11436
|
const logger = options.logger ? options.logger : quiet ? createSilentLogger() : createLogger({ verbose });
|
|
11431
11437
|
rootDir = path22.resolve(rootDir);
|
|
11432
11438
|
const location = getIndexLocation(rootDir);
|
|
@@ -11525,6 +11531,7 @@ async function deleteIndex(rootDir) {
|
|
|
11525
11531
|
}
|
|
11526
11532
|
async function resetIndex(rootDir) {
|
|
11527
11533
|
rootDir = path22.resolve(rootDir);
|
|
11534
|
+
clearFreshnessCache();
|
|
11528
11535
|
const status = await getIndexStatus(rootDir);
|
|
11529
11536
|
if (!status.exists) {
|
|
11530
11537
|
throw new Error(`No index found for ${rootDir}`);
|
|
@@ -11542,6 +11549,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11542
11549
|
rootDir = path22.resolve(rootDir);
|
|
11543
11550
|
const status = await getIndexStatus(rootDir);
|
|
11544
11551
|
if (!status.exists) {
|
|
11552
|
+
clearFreshnessCache();
|
|
11545
11553
|
logger.info(`No index found. Creating index...
|
|
11546
11554
|
`);
|
|
11547
11555
|
const results = await indexDirectory(rootDir, { ...options, logger });
|
|
@@ -11550,6 +11558,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11550
11558
|
}
|
|
11551
11559
|
const versionCompatible = await isIndexVersionCompatible(rootDir);
|
|
11552
11560
|
if (!versionCompatible) {
|
|
11561
|
+
clearFreshnessCache();
|
|
11553
11562
|
logger.info(`Index version incompatible. Rebuilding...
|
|
11554
11563
|
`);
|
|
11555
11564
|
await deleteIndex(rootDir);
|
|
@@ -11558,6 +11567,17 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11558
11567
|
return { indexed: totalIndexed2, removed: 0, unchanged: 0 };
|
|
11559
11568
|
}
|
|
11560
11569
|
const config = await loadConfig(rootDir);
|
|
11570
|
+
const globalManifestPath = getGlobalManifestPath(rootDir, config);
|
|
11571
|
+
let currentManifestMtime = 0;
|
|
11572
|
+
try {
|
|
11573
|
+
const manifestStats = await fs8.stat(globalManifestPath);
|
|
11574
|
+
currentManifestMtime = manifestStats.mtimeMs;
|
|
11575
|
+
} catch {}
|
|
11576
|
+
const now = Date.now();
|
|
11577
|
+
if (freshnessCache && freshnessCache.rootDir === rootDir && now - freshnessCache.timestamp < FRESHNESS_CACHE_TTL_MS && freshnessCache.manifestMtime === currentManifestMtime) {
|
|
11578
|
+
logger.debug("Using cached freshness check result");
|
|
11579
|
+
return freshnessCache.result;
|
|
11580
|
+
}
|
|
11561
11581
|
await registerBuiltInModules();
|
|
11562
11582
|
const enabledModules = registry.getEnabled(config);
|
|
11563
11583
|
if (enabledModules.length === 0) {
|
|
@@ -11733,12 +11753,25 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
11733
11753
|
}
|
|
11734
11754
|
if (totalIndexed > 0 || totalRemoved > 0) {
|
|
11735
11755
|
await updateGlobalManifest(rootDir, enabledModules, config);
|
|
11756
|
+
clearFreshnessCache();
|
|
11736
11757
|
}
|
|
11737
|
-
|
|
11758
|
+
const result = {
|
|
11738
11759
|
indexed: totalIndexed,
|
|
11739
11760
|
removed: totalRemoved,
|
|
11740
11761
|
unchanged: totalUnchanged
|
|
11741
11762
|
};
|
|
11763
|
+
let finalManifestMtime = currentManifestMtime;
|
|
11764
|
+
try {
|
|
11765
|
+
const manifestStats = await fs8.stat(globalManifestPath);
|
|
11766
|
+
finalManifestMtime = manifestStats.mtimeMs;
|
|
11767
|
+
} catch {}
|
|
11768
|
+
freshnessCache = {
|
|
11769
|
+
rootDir,
|
|
11770
|
+
result,
|
|
11771
|
+
timestamp: Date.now(),
|
|
11772
|
+
manifestMtime: finalManifestMtime
|
|
11773
|
+
};
|
|
11774
|
+
return result;
|
|
11742
11775
|
}
|
|
11743
11776
|
async function indexWithModule(rootDir, files, module2, config, verbose, introspection, logger, concurrency = DEFAULT_CONCURRENCY) {
|
|
11744
11777
|
const result = {
|
|
@@ -12054,7 +12087,7 @@ async function getIndexStatus(rootDir) {
|
|
|
12054
12087
|
}
|
|
12055
12088
|
return status;
|
|
12056
12089
|
}
|
|
12057
|
-
var INDEX_SCHEMA_VERSION = "2.0.0", DEFAULT_CONCURRENCY;
|
|
12090
|
+
var FRESHNESS_CACHE_TTL_MS = 5000, freshnessCache = null, INDEX_SCHEMA_VERSION = "2.0.0", DEFAULT_CONCURRENCY;
|
|
12058
12091
|
var init_indexer = __esm(() => {
|
|
12059
12092
|
init_config2();
|
|
12060
12093
|
init_registry();
|
|
@@ -13635,7 +13668,7 @@ init_logger();
|
|
|
13635
13668
|
// package.json
|
|
13636
13669
|
var package_default = {
|
|
13637
13670
|
name: "raggrep",
|
|
13638
|
-
version: "0.10.
|
|
13671
|
+
version: "0.10.2",
|
|
13639
13672
|
description: "Local filesystem-based RAG system for codebases - semantic search using local embeddings",
|
|
13640
13673
|
type: "module",
|
|
13641
13674
|
main: "./dist/index.js",
|
|
@@ -14229,4 +14262,4 @@ Run 'raggrep <command> --help' for more information.
|
|
|
14229
14262
|
}
|
|
14230
14263
|
main();
|
|
14231
14264
|
|
|
14232
|
-
//# debugId=
|
|
14265
|
+
//# debugId=04D75A20D6C87C2264756E2164756E21
|