promptgraph-mcp 2.9.18 → 2.9.19
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/indexer.js +8 -2
- package/package.json +1 -1
package/indexer.js
CHANGED
|
@@ -168,6 +168,8 @@ export async function indexAll({ fast = false } = {}) {
|
|
|
168
168
|
let classifierRemoved = 0;
|
|
169
169
|
let batch = [];
|
|
170
170
|
const start = Date.now();
|
|
171
|
+
let processedCount = 0;
|
|
172
|
+
let processedStart = null;
|
|
171
173
|
|
|
172
174
|
// Build a path→{hash,id} map from DB for O(1) lookups
|
|
173
175
|
const dbByPath = new Map();
|
|
@@ -193,7 +195,9 @@ export async function indexAll({ fast = false } = {}) {
|
|
|
193
195
|
if (dbRow?.hash === hash) {
|
|
194
196
|
skipped++; count++;
|
|
195
197
|
if (count % 200 === 0) {
|
|
196
|
-
const eta =
|
|
198
|
+
const eta = processedCount > 0 && processedStart
|
|
199
|
+
? Math.round((total - count) * (Date.now() - processedStart) / processedCount / 1000)
|
|
200
|
+
: '?';
|
|
197
201
|
progress(count, total, { skipped, eta, errors });
|
|
198
202
|
}
|
|
199
203
|
continue;
|
|
@@ -202,6 +206,7 @@ export async function indexAll({ fast = false } = {}) {
|
|
|
202
206
|
// 4. Only now check if it's a real skill (content already in memory)
|
|
203
207
|
if (!isSkillFile(file, raw)) { skipped++; count++; continue; }
|
|
204
208
|
|
|
209
|
+
if (!processedStart) processedStart = Date.now();
|
|
205
210
|
const parsed = parseSkillFile(file, source, { raw });
|
|
206
211
|
batch.push({ ...parsed, hash });
|
|
207
212
|
|
|
@@ -210,8 +215,9 @@ export async function indexAll({ fast = false } = {}) {
|
|
|
210
215
|
classifierRemoved += batch.length - filtered.length;
|
|
211
216
|
await indexBatch(db, filtered, { fast });
|
|
212
217
|
count += filtered.length;
|
|
218
|
+
processedCount += filtered.length;
|
|
213
219
|
batch = [];
|
|
214
|
-
const eta =
|
|
220
|
+
const eta = processedCount > 0 ? Math.round((total - count) * (Date.now() - processedStart) / processedCount / 1000) : '?';
|
|
215
221
|
progress(count, total, { skipped, eta, errors });
|
|
216
222
|
await new Promise(r => setImmediate ? setImmediate(r) : setTimeout(r, 0));
|
|
217
223
|
}
|