promptgraph-mcp 2.9.22 → 2.9.24
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/commands/update.js +8 -0
- package/indexer.js +6 -6
- package/package.json +1 -1
package/commands/update.js
CHANGED
|
@@ -34,6 +34,14 @@ export default async function handler(args, bin) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
info(`Current: ${chalk.gray('v' + currentVersion)} → Latest: ${chalk.white.bold('v' + latest)}`);
|
|
37
|
+
|
|
38
|
+
// Kill other node processes that may lock native .node files (e.g. pg reindex still running)
|
|
39
|
+
if (process.platform === 'win32') {
|
|
40
|
+
spawnSync('taskkill', ['/F', '/IM', 'node.exe'], { stdio: 'ignore', shell: true });
|
|
41
|
+
} else {
|
|
42
|
+
spawnSync('pkill', ['-f', 'promptgraph-mcp'], { stdio: 'ignore' });
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
const updateSpin = (await import('../cli.js')).spinner(`Installing promptgraph-mcp@latest (v${latest})...`);
|
|
38
46
|
updateSpin.start();
|
|
39
47
|
const result = spawnSync('npm', ['install', '-g', 'promptgraph-mcp@latest'], { encoding: 'utf8', stdio: 'pipe', shell: true });
|
package/indexer.js
CHANGED
|
@@ -19,7 +19,7 @@ function sanitizePath(filePath) {
|
|
|
19
19
|
return path.resolve(filePath);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export async function indexBatch(db, skills, { fast = false } = {}) {
|
|
22
|
+
export async function indexBatch(db, skills, { fast = false, silent = false } = {}) {
|
|
23
23
|
const upsertSkill = db.prepare(`
|
|
24
24
|
INSERT INTO skills (id, name, description, path, source, content, hash, version, author, license, updated_at, downloads, verified)
|
|
25
25
|
VALUES (@id, @name, @description, @path, @source, @content, @hash, @version, @author, @license, @updated_at, @downloads, @verified)
|
|
@@ -70,9 +70,9 @@ export async function indexBatch(db, skills, { fast = false } = {}) {
|
|
|
70
70
|
if (!fast && allChunks.length) {
|
|
71
71
|
const texts = allChunks.map(c => c.text);
|
|
72
72
|
const total = texts.length;
|
|
73
|
-
process.stdout.write('\n ⠋ Preparing model...\n');
|
|
73
|
+
if (!silent) process.stdout.write('\n ⠋ Preparing model...\n');
|
|
74
74
|
let embedStart = null;
|
|
75
|
-
const embeddings = await embedBatch(texts, (done, tot) => {
|
|
75
|
+
const embeddings = await embedBatch(texts, silent ? null : (done, tot) => {
|
|
76
76
|
if (!embedStart) {
|
|
77
77
|
process.stdout.write('\x1b[1A\x1b[2K');
|
|
78
78
|
embedStart = Date.now();
|
|
@@ -81,7 +81,7 @@ export async function indexBatch(db, skills, { fast = false } = {}) {
|
|
|
81
81
|
const eta = done > 0 ? Math.round((tot - done) * elapsed / done) : '?';
|
|
82
82
|
progress(done, tot, { eta });
|
|
83
83
|
});
|
|
84
|
-
progressDone();
|
|
84
|
+
if (!silent) progressDone();
|
|
85
85
|
db.transaction(() => {
|
|
86
86
|
for (let i = 0; i < allChunks.length; i++) {
|
|
87
87
|
const { id, chunkIndex, text } = allChunks[i];
|
|
@@ -215,7 +215,7 @@ export async function indexAll({ fast = false } = {}) {
|
|
|
215
215
|
if (batch.length >= BATCH_SIZE) {
|
|
216
216
|
const filtered = await filterWithClassifier(batch);
|
|
217
217
|
classifierRemoved += batch.length - filtered.length;
|
|
218
|
-
await indexBatch(db, filtered, { fast });
|
|
218
|
+
await indexBatch(db, filtered, { fast, silent: true });
|
|
219
219
|
count += filtered.length;
|
|
220
220
|
processedCount += filtered.length;
|
|
221
221
|
batch = [];
|
|
@@ -241,7 +241,7 @@ export async function indexAll({ fast = false } = {}) {
|
|
|
241
241
|
if (batch.length > 0) {
|
|
242
242
|
const filtered = await filterWithClassifier(batch);
|
|
243
243
|
classifierRemoved += batch.length - filtered.length;
|
|
244
|
-
await indexBatch(db, filtered, { fast });
|
|
244
|
+
await indexBatch(db, filtered, { fast, silent: true });
|
|
245
245
|
count += filtered.length;
|
|
246
246
|
}
|
|
247
247
|
|