raggrep 0.12.2 → 0.12.3
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 +225 -7
- package/dist/cli/main.js.map +8 -6
- package/dist/index.js +224 -6
- package/dist/index.js.map +8 -6
- package/dist/infrastructure/logger/index.d.ts +2 -0
- package/dist/infrastructure/logger/multiModuleProgressManager.d.ts +19 -0
- package/dist/infrastructure/logger/progressManager.d.ts +17 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -127,7 +127,24 @@ var init_config = __esm(() => {
|
|
|
127
127
|
".pytest_cache",
|
|
128
128
|
"*.egg-info",
|
|
129
129
|
".idea",
|
|
130
|
-
".raggrep"
|
|
130
|
+
".raggrep",
|
|
131
|
+
".DS_Store",
|
|
132
|
+
"Thumbs.db",
|
|
133
|
+
".env",
|
|
134
|
+
".env.local",
|
|
135
|
+
".env.development.local",
|
|
136
|
+
".env.test.local",
|
|
137
|
+
".env.production.local",
|
|
138
|
+
"*.lock",
|
|
139
|
+
"package-lock.json",
|
|
140
|
+
"yarn.lock",
|
|
141
|
+
"pnpm-lock.yaml",
|
|
142
|
+
"Cargo.lock",
|
|
143
|
+
"poetry.lock",
|
|
144
|
+
"Gemfile.lock",
|
|
145
|
+
"go.sum",
|
|
146
|
+
"*.min.js",
|
|
147
|
+
"*.min.css"
|
|
131
148
|
];
|
|
132
149
|
DEFAULT_EXTENSIONS = [
|
|
133
150
|
".ts",
|
|
@@ -11888,11 +11905,13 @@ class InlineProgressLogger {
|
|
|
11888
11905
|
}
|
|
11889
11906
|
}
|
|
11890
11907
|
progress(message) {
|
|
11891
|
-
|
|
11892
|
-
|
|
11908
|
+
const maxCols = 120;
|
|
11909
|
+
process.stdout.write("\r" + message);
|
|
11910
|
+
const padding = Math.max(0, maxCols - message.length);
|
|
11893
11911
|
if (padding > 0) {
|
|
11894
11912
|
process.stdout.write(" ".repeat(padding));
|
|
11895
11913
|
}
|
|
11914
|
+
process.stdout.write("\r");
|
|
11896
11915
|
this.lastProgressLength = message.length;
|
|
11897
11916
|
this.hasProgress = true;
|
|
11898
11917
|
}
|
|
@@ -11922,6 +11941,116 @@ function createInlineLogger(options) {
|
|
|
11922
11941
|
function createSilentLogger() {
|
|
11923
11942
|
return new SilentLogger;
|
|
11924
11943
|
}
|
|
11944
|
+
// src/infrastructure/logger/progressManager.ts
|
|
11945
|
+
var PROGRESS_UPDATE_INTERVAL_MS = 50;
|
|
11946
|
+
|
|
11947
|
+
class ProgressManager {
|
|
11948
|
+
logger;
|
|
11949
|
+
state = {
|
|
11950
|
+
completed: 0,
|
|
11951
|
+
total: 0,
|
|
11952
|
+
message: "",
|
|
11953
|
+
timestamp: 0
|
|
11954
|
+
};
|
|
11955
|
+
intervalId = null;
|
|
11956
|
+
constructor(logger) {
|
|
11957
|
+
this.logger = logger;
|
|
11958
|
+
}
|
|
11959
|
+
start() {
|
|
11960
|
+
if (this.intervalId) {
|
|
11961
|
+
return;
|
|
11962
|
+
}
|
|
11963
|
+
this.intervalId = setInterval(() => {
|
|
11964
|
+
this.writeProgress();
|
|
11965
|
+
}, PROGRESS_UPDATE_INTERVAL_MS);
|
|
11966
|
+
}
|
|
11967
|
+
stop() {
|
|
11968
|
+
if (this.intervalId) {
|
|
11969
|
+
clearInterval(this.intervalId);
|
|
11970
|
+
this.intervalId = null;
|
|
11971
|
+
}
|
|
11972
|
+
this.logger.clearProgress();
|
|
11973
|
+
}
|
|
11974
|
+
reportProgress(completed, total, message) {
|
|
11975
|
+
this.state = {
|
|
11976
|
+
completed,
|
|
11977
|
+
total,
|
|
11978
|
+
message,
|
|
11979
|
+
timestamp: Date.now()
|
|
11980
|
+
};
|
|
11981
|
+
}
|
|
11982
|
+
writeProgress() {
|
|
11983
|
+
const progressMessage = ` [${this.state.completed}/${this.state.total}] ${this.state.message}`;
|
|
11984
|
+
this.logger.progress(progressMessage);
|
|
11985
|
+
}
|
|
11986
|
+
}
|
|
11987
|
+
// src/infrastructure/logger/multiModuleProgressManager.ts
|
|
11988
|
+
var PROGRESS_UPDATE_INTERVAL_MS2 = 50;
|
|
11989
|
+
|
|
11990
|
+
class MultiModuleProgressManager {
|
|
11991
|
+
logger;
|
|
11992
|
+
modules = new Map;
|
|
11993
|
+
intervalId = null;
|
|
11994
|
+
constructor(logger) {
|
|
11995
|
+
this.logger = logger;
|
|
11996
|
+
}
|
|
11997
|
+
start() {
|
|
11998
|
+
if (this.intervalId) {
|
|
11999
|
+
return;
|
|
12000
|
+
}
|
|
12001
|
+
this.intervalId = setInterval(() => {
|
|
12002
|
+
this.writeProgress();
|
|
12003
|
+
}, PROGRESS_UPDATE_INTERVAL_MS2);
|
|
12004
|
+
}
|
|
12005
|
+
stop() {
|
|
12006
|
+
if (this.intervalId) {
|
|
12007
|
+
clearInterval(this.intervalId);
|
|
12008
|
+
this.intervalId = null;
|
|
12009
|
+
}
|
|
12010
|
+
this.logger.clearProgress();
|
|
12011
|
+
}
|
|
12012
|
+
registerModule(moduleId, moduleName, totalFiles) {
|
|
12013
|
+
this.modules.set(moduleId, {
|
|
12014
|
+
moduleName,
|
|
12015
|
+
completed: 0,
|
|
12016
|
+
total: totalFiles,
|
|
12017
|
+
currentFile: "",
|
|
12018
|
+
active: true
|
|
12019
|
+
});
|
|
12020
|
+
}
|
|
12021
|
+
unregisterModule(moduleId) {
|
|
12022
|
+
const module2 = this.modules.get(moduleId);
|
|
12023
|
+
if (module2) {
|
|
12024
|
+
module2.active = false;
|
|
12025
|
+
}
|
|
12026
|
+
}
|
|
12027
|
+
reportProgress(moduleId, completed, currentFile) {
|
|
12028
|
+
const module2 = this.modules.get(moduleId);
|
|
12029
|
+
if (!module2) {
|
|
12030
|
+
return;
|
|
12031
|
+
}
|
|
12032
|
+
module2.completed = completed;
|
|
12033
|
+
module2.currentFile = currentFile;
|
|
12034
|
+
}
|
|
12035
|
+
writeProgress() {
|
|
12036
|
+
const activeModules = Array.from(this.modules.values()).filter((m) => m.active);
|
|
12037
|
+
if (activeModules.length === 0) {
|
|
12038
|
+
return;
|
|
12039
|
+
}
|
|
12040
|
+
if (activeModules.length === 1) {
|
|
12041
|
+
const m = activeModules[0];
|
|
12042
|
+
const progressMessage = `[${m.moduleName}] ${m.completed}/${m.total}: ${m.currentFile}`;
|
|
12043
|
+
this.logger.progress(progressMessage);
|
|
12044
|
+
} else {
|
|
12045
|
+
const parts2 = activeModules.map((m) => {
|
|
12046
|
+
const percent = m.total > 0 ? Math.round(m.completed / m.total * 100) : 100;
|
|
12047
|
+
return `[${m.moduleName} ${m.completed}/${m.total} ${percent}%]`;
|
|
12048
|
+
});
|
|
12049
|
+
const progressMessage = parts2.join(" ");
|
|
12050
|
+
this.logger.progress(progressMessage);
|
|
12051
|
+
}
|
|
12052
|
+
}
|
|
12053
|
+
}
|
|
11925
12054
|
// src/app/indexer/watcher.ts
|
|
11926
12055
|
import { watch } from "chokidar";
|
|
11927
12056
|
init_config2();
|
|
@@ -12256,8 +12385,15 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12256
12385
|
}
|
|
12257
12386
|
let completedCount = 0;
|
|
12258
12387
|
const totalToProcess = filesToProcess.length;
|
|
12388
|
+
const progressManager = new ProgressManager(logger);
|
|
12389
|
+
progressManager.start();
|
|
12259
12390
|
const processChangedFile = async (fileToProcess) => {
|
|
12260
12391
|
const { filepath, relativePath, lastModified, isNew, existingContentHash } = fileToProcess;
|
|
12392
|
+
if (isLikelyBinary(filepath)) {
|
|
12393
|
+
completedCount++;
|
|
12394
|
+
logger.debug(` Skipping ${relativePath} (binary file)`);
|
|
12395
|
+
return { relativePath, status: "unchanged" };
|
|
12396
|
+
}
|
|
12261
12397
|
try {
|
|
12262
12398
|
const content = await fs8.readFile(filepath, "utf-8");
|
|
12263
12399
|
const contentHash = computeContentHash(content);
|
|
@@ -12271,7 +12407,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12271
12407
|
};
|
|
12272
12408
|
}
|
|
12273
12409
|
completedCount++;
|
|
12274
|
-
|
|
12410
|
+
progressManager.reportProgress(completedCount, totalToProcess, `Indexing: ${relativePath}`);
|
|
12275
12411
|
introspection.addFile(relativePath, content);
|
|
12276
12412
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
12277
12413
|
if (!fileIndex) {
|
|
@@ -12294,6 +12430,7 @@ async function ensureIndexFresh(rootDir, options = {}) {
|
|
|
12294
12430
|
const concurrency = options.concurrency ?? DEFAULT_CONCURRENCY;
|
|
12295
12431
|
const results = await parallelMap(filesToProcess, processChangedFile, concurrency);
|
|
12296
12432
|
indexingMs += Date.now() - indexingStart;
|
|
12433
|
+
progressManager.stop();
|
|
12297
12434
|
totalUnchanged += unchangedCount;
|
|
12298
12435
|
logger.clearProgress();
|
|
12299
12436
|
let mtimeUpdates = 0;
|
|
@@ -12428,9 +12565,16 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12428
12565
|
getIntrospection: (filepath) => introspection.getFile(filepath)
|
|
12429
12566
|
};
|
|
12430
12567
|
const totalFiles = files.length;
|
|
12568
|
+
const progressManager = new ProgressManager(logger);
|
|
12569
|
+
progressManager.start();
|
|
12431
12570
|
let completedCount = 0;
|
|
12432
12571
|
const processFile = async (filepath, _index) => {
|
|
12433
12572
|
const relativePath = path21.relative(rootDir, filepath);
|
|
12573
|
+
if (isLikelyBinary(filepath)) {
|
|
12574
|
+
completedCount++;
|
|
12575
|
+
logger.debug(` [${completedCount}/${totalFiles}] Skipped ${relativePath} (binary file)`);
|
|
12576
|
+
return { relativePath, status: "skipped" };
|
|
12577
|
+
}
|
|
12434
12578
|
try {
|
|
12435
12579
|
const stats = await fs8.stat(filepath);
|
|
12436
12580
|
const lastModified = stats.mtime.toISOString();
|
|
@@ -12454,7 +12598,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12454
12598
|
}
|
|
12455
12599
|
introspection.addFile(relativePath, content);
|
|
12456
12600
|
completedCount++;
|
|
12457
|
-
|
|
12601
|
+
progressManager.reportProgress(completedCount, totalFiles, `Processing: ${relativePath}`);
|
|
12458
12602
|
const fileIndex = await module2.indexFile(relativePath, content, ctx);
|
|
12459
12603
|
if (!fileIndex) {
|
|
12460
12604
|
logger.debug(` [${completedCount}/${totalFiles}] Skipped ${relativePath} (no chunks)`);
|
|
@@ -12475,6 +12619,7 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12475
12619
|
};
|
|
12476
12620
|
logger.debug(` Using concurrency: ${concurrency}`);
|
|
12477
12621
|
const results = await parallelMap(files, processFile, concurrency);
|
|
12622
|
+
progressManager.stop();
|
|
12478
12623
|
logger.clearProgress();
|
|
12479
12624
|
for (const item of results) {
|
|
12480
12625
|
if (!item.success) {
|
|
@@ -12515,6 +12660,79 @@ async function indexWithModule(rootDir, files, module2, config, verbose, introsp
|
|
|
12515
12660
|
return result;
|
|
12516
12661
|
}
|
|
12517
12662
|
var STAT_CONCURRENCY = 64;
|
|
12663
|
+
function isLikelyBinary(filepath) {
|
|
12664
|
+
const ext = path21.extname(filepath).toLowerCase();
|
|
12665
|
+
const basename15 = path21.basename(filepath).toLowerCase();
|
|
12666
|
+
const binaryExtensions = new Set([
|
|
12667
|
+
".png",
|
|
12668
|
+
".jpg",
|
|
12669
|
+
".jpeg",
|
|
12670
|
+
".gif",
|
|
12671
|
+
".ico",
|
|
12672
|
+
".svg",
|
|
12673
|
+
".webp",
|
|
12674
|
+
".bmp",
|
|
12675
|
+
".tiff",
|
|
12676
|
+
".pdf",
|
|
12677
|
+
".doc",
|
|
12678
|
+
".docx",
|
|
12679
|
+
".xls",
|
|
12680
|
+
".xlsx",
|
|
12681
|
+
".ppt",
|
|
12682
|
+
".pptx",
|
|
12683
|
+
".zip",
|
|
12684
|
+
".tar",
|
|
12685
|
+
".gz",
|
|
12686
|
+
".7z",
|
|
12687
|
+
".rar",
|
|
12688
|
+
".bz2",
|
|
12689
|
+
".exe",
|
|
12690
|
+
".dll",
|
|
12691
|
+
".so",
|
|
12692
|
+
".dylib",
|
|
12693
|
+
".bin",
|
|
12694
|
+
".dat",
|
|
12695
|
+
".obj",
|
|
12696
|
+
".o",
|
|
12697
|
+
".mp3",
|
|
12698
|
+
".mp4",
|
|
12699
|
+
".wav",
|
|
12700
|
+
".avi",
|
|
12701
|
+
".mov",
|
|
12702
|
+
".flac",
|
|
12703
|
+
".ogg",
|
|
12704
|
+
".woff",
|
|
12705
|
+
".woff2",
|
|
12706
|
+
".ttf",
|
|
12707
|
+
".eot",
|
|
12708
|
+
".otf"
|
|
12709
|
+
]);
|
|
12710
|
+
if (binaryExtensions.has(ext)) {
|
|
12711
|
+
return true;
|
|
12712
|
+
}
|
|
12713
|
+
const minifiedPatterns = [
|
|
12714
|
+
".min.js",
|
|
12715
|
+
".min.css",
|
|
12716
|
+
".bundle.js",
|
|
12717
|
+
".bundle.css",
|
|
12718
|
+
".prod.js",
|
|
12719
|
+
".prod.css",
|
|
12720
|
+
".chunk.js",
|
|
12721
|
+
".chunk.css"
|
|
12722
|
+
];
|
|
12723
|
+
if (minifiedPatterns.some((pattern) => filepath.includes(pattern))) {
|
|
12724
|
+
return true;
|
|
12725
|
+
}
|
|
12726
|
+
const systemFiles = [
|
|
12727
|
+
".ds_store",
|
|
12728
|
+
"thumbs.db",
|
|
12729
|
+
"desktop.ini"
|
|
12730
|
+
];
|
|
12731
|
+
if (systemFiles.includes(basename15)) {
|
|
12732
|
+
return true;
|
|
12733
|
+
}
|
|
12734
|
+
return false;
|
|
12735
|
+
}
|
|
12518
12736
|
async function findFilesWithStats(rootDir, config, lastIndexStarted) {
|
|
12519
12737
|
const validExtensions = new Set(config.extensions);
|
|
12520
12738
|
const ignoreDirs = new Set(config.ignorePaths);
|
|
@@ -14145,4 +14363,4 @@ export {
|
|
|
14145
14363
|
ConsoleLogger
|
|
14146
14364
|
};
|
|
14147
14365
|
|
|
14148
|
-
//# debugId=
|
|
14366
|
+
//# debugId=DF4029DAF7548B8C64756E2164756E21
|