raggrep 0.7.0 → 0.7.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.
- package/dist/cli/main.js +50 -2
- package/dist/cli/main.js.map +5 -5
- package/dist/index.js +49 -1
- package/dist/index.js.map +5 -5
- package/dist/infrastructure/storage/literalIndex.d.ts +8 -0
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -3277,6 +3277,11 @@ var init_symbolicIndex = __esm(() => {
|
|
|
3277
3277
|
});
|
|
3278
3278
|
|
|
3279
3279
|
// src/infrastructure/storage/literalIndex.ts
|
|
3280
|
+
var exports_literalIndex = {};
|
|
3281
|
+
__export(exports_literalIndex, {
|
|
3282
|
+
getLiteralIndexPath: () => getLiteralIndexPath,
|
|
3283
|
+
LiteralIndex: () => LiteralIndex
|
|
3284
|
+
});
|
|
3280
3285
|
import * as fs4 from "fs/promises";
|
|
3281
3286
|
import * as path9 from "path";
|
|
3282
3287
|
|
|
@@ -3329,6 +3334,22 @@ class LiteralIndex {
|
|
|
3329
3334
|
}
|
|
3330
3335
|
}
|
|
3331
3336
|
}
|
|
3337
|
+
removeFile(filepath) {
|
|
3338
|
+
let removed = 0;
|
|
3339
|
+
for (const [key, entries] of this.entries) {
|
|
3340
|
+
const filtered = entries.filter((e) => e.filepath !== filepath);
|
|
3341
|
+
const removedCount = entries.length - filtered.length;
|
|
3342
|
+
if (removedCount > 0) {
|
|
3343
|
+
removed += removedCount;
|
|
3344
|
+
if (filtered.length === 0) {
|
|
3345
|
+
this.entries.delete(key);
|
|
3346
|
+
} else {
|
|
3347
|
+
this.entries.set(key, filtered);
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
return removed;
|
|
3352
|
+
}
|
|
3332
3353
|
findMatches(queryLiterals) {
|
|
3333
3354
|
const matches = [];
|
|
3334
3355
|
for (const queryLiteral of queryLiterals) {
|
|
@@ -3421,6 +3442,9 @@ function shouldReplaceMatchType(existing, incoming) {
|
|
|
3421
3442
|
};
|
|
3422
3443
|
return priority[incoming] > priority[existing];
|
|
3423
3444
|
}
|
|
3445
|
+
function getLiteralIndexPath(rootDir, moduleId, indexDir = ".raggrep") {
|
|
3446
|
+
return path9.join(rootDir, indexDir, "index", moduleId, "literals");
|
|
3447
|
+
}
|
|
3424
3448
|
var init_literalIndex = () => {};
|
|
3425
3449
|
|
|
3426
3450
|
// src/infrastructure/storage/index.ts
|
|
@@ -3583,6 +3607,16 @@ class TypeScriptModule {
|
|
|
3583
3607
|
await this.symbolicIndex.save();
|
|
3584
3608
|
this.literalIndex = new LiteralIndex(indexDir, this.id);
|
|
3585
3609
|
await this.literalIndex.initialize();
|
|
3610
|
+
const indexedFilepaths = new Set;
|
|
3611
|
+
for (const filepath of this.pendingSummaries.keys()) {
|
|
3612
|
+
indexedFilepaths.add(filepath);
|
|
3613
|
+
}
|
|
3614
|
+
for (const { filepath } of this.pendingLiterals.values()) {
|
|
3615
|
+
indexedFilepaths.add(filepath);
|
|
3616
|
+
}
|
|
3617
|
+
for (const filepath of indexedFilepaths) {
|
|
3618
|
+
this.literalIndex.removeFile(filepath);
|
|
3619
|
+
}
|
|
3586
3620
|
for (const [chunkId, { filepath, literals }] of this.pendingLiterals) {
|
|
3587
3621
|
this.literalIndex.addLiterals(chunkId, filepath, literals);
|
|
3588
3622
|
}
|
|
@@ -5039,6 +5073,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
5039
5073
|
filesToRemove.push(filepath);
|
|
5040
5074
|
}
|
|
5041
5075
|
}
|
|
5076
|
+
const removedFilepaths = [];
|
|
5042
5077
|
for (const filepath of filesToRemove) {
|
|
5043
5078
|
logger.debug(` Removing stale: ${filepath}`);
|
|
5044
5079
|
const indexFilePath = path16.join(indexPath, filepath.replace(/\.[^.]+$/, ".json"));
|
|
@@ -5050,8 +5085,21 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
5050
5085
|
await fs7.unlink(symbolicFilePath);
|
|
5051
5086
|
} catch {}
|
|
5052
5087
|
delete manifest.files[filepath];
|
|
5088
|
+
removedFilepaths.push(filepath);
|
|
5053
5089
|
totalRemoved++;
|
|
5054
5090
|
}
|
|
5091
|
+
if (removedFilepaths.length > 0) {
|
|
5092
|
+
try {
|
|
5093
|
+
const { LiteralIndex: LiteralIndex2 } = await Promise.resolve().then(() => (init_literalIndex(), exports_literalIndex));
|
|
5094
|
+
const raggrepDir = getRaggrepDir(rootDir, config);
|
|
5095
|
+
const literalIndex = new LiteralIndex2(raggrepDir, module.id);
|
|
5096
|
+
await literalIndex.initialize();
|
|
5097
|
+
for (const filepath of removedFilepaths) {
|
|
5098
|
+
literalIndex.removeFile(filepath);
|
|
5099
|
+
}
|
|
5100
|
+
await literalIndex.save();
|
|
5101
|
+
} catch {}
|
|
5102
|
+
}
|
|
5055
5103
|
const ctx = {
|
|
5056
5104
|
rootDir,
|
|
5057
5105
|
config,
|
|
@@ -5588,7 +5636,7 @@ init_logger();
|
|
|
5588
5636
|
// package.json
|
|
5589
5637
|
var package_default = {
|
|
5590
5638
|
name: "raggrep",
|
|
5591
|
-
version: "0.7.
|
|
5639
|
+
version: "0.7.1",
|
|
5592
5640
|
description: "Local filesystem-based RAG system for codebases - semantic search using local embeddings",
|
|
5593
5641
|
type: "module",
|
|
5594
5642
|
main: "./dist/index.js",
|
|
@@ -6049,4 +6097,4 @@ Run 'raggrep <command> --help' for more information.
|
|
|
6049
6097
|
}
|
|
6050
6098
|
main();
|
|
6051
6099
|
|
|
6052
|
-
//# debugId=
|
|
6100
|
+
//# debugId=D5C2A5C0F122D20164756E2164756E21
|