skillvault 0.9.2 → 0.9.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.js +48 -68
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync, rmSync } from 'node:fs';
|
|
21
21
|
import { join } from 'node:path';
|
|
22
22
|
import { createDecipheriv, createHmac, createPublicKey, diffieHellman, hkdfSync, generateKeyPairSync, } from 'node:crypto';
|
|
23
|
-
const VERSION = '0.9.
|
|
23
|
+
const VERSION = '0.9.3';
|
|
24
24
|
const HOME = process.env.HOME || process.env.USERPROFILE || '~';
|
|
25
25
|
const API_URL = process.env.SKILLVAULT_API_URL || 'https://api.getskillvault.com';
|
|
26
26
|
const CONFIG_DIR = join(HOME, '.skillvault');
|
|
@@ -270,33 +270,26 @@ function configureSessionHook() {
|
|
|
270
270
|
settings.hooks.SessionStart = [];
|
|
271
271
|
if (!settings.hooks.SessionEnd)
|
|
272
272
|
settings.hooks.SessionEnd = [];
|
|
273
|
-
// ── SessionStart: auto-sync (permanent) ──
|
|
274
|
-
// Remove
|
|
275
|
-
settings.hooks.SessionStart = settings.hooks.SessionStart.filter((h) => !(h
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
settings.hooks.SessionEnd.push({
|
|
294
|
-
hooks: [{
|
|
295
|
-
type: 'command',
|
|
296
|
-
command: `npx -y skillvault@${VERSION} --session-cleanup`,
|
|
297
|
-
}],
|
|
298
|
-
});
|
|
299
|
-
}
|
|
273
|
+
// ── SessionStart: auto-sync (permanent, unpinned so it always gets latest) ──
|
|
274
|
+
// Remove all existing skillvault SessionStart hooks and re-add with current format
|
|
275
|
+
settings.hooks.SessionStart = settings.hooks.SessionStart.filter((h) => !hasSkillvaultCommand(h));
|
|
276
|
+
settings.hooks.SessionStart.push({
|
|
277
|
+
matcher: 'startup',
|
|
278
|
+
hooks: [{
|
|
279
|
+
type: 'command',
|
|
280
|
+
command: 'npx -y skillvault --sync',
|
|
281
|
+
timeout: 30,
|
|
282
|
+
}],
|
|
283
|
+
});
|
|
284
|
+
// ── SessionEnd: cleanup (permanent, pinned to current version) ──
|
|
285
|
+
// Remove all existing skillvault SessionEnd hooks and re-add with current version
|
|
286
|
+
settings.hooks.SessionEnd = settings.hooks.SessionEnd.filter((h) => !hasSkillvaultCommand(h));
|
|
287
|
+
settings.hooks.SessionEnd.push({
|
|
288
|
+
hooks: [{
|
|
289
|
+
type: 'command',
|
|
290
|
+
command: `npx -y skillvault@${VERSION} --session-cleanup`,
|
|
291
|
+
}],
|
|
292
|
+
});
|
|
300
293
|
// ── Remove legacy PostToolCall + PreToolCall hooks (invalid event names) ──
|
|
301
294
|
let removedLegacy = false;
|
|
302
295
|
for (const legacyKey of ['PostToolCall', 'PreToolCall']) {
|
|
@@ -322,10 +315,7 @@ function configureSessionHook() {
|
|
|
322
315
|
}
|
|
323
316
|
mkdirSync(join(HOME, '.claude'), { recursive: true });
|
|
324
317
|
writeFileSync(settingsPath, JSON.stringify(settings, null, 2), { mode: 0o600 });
|
|
325
|
-
|
|
326
|
-
console.error(' ✅ Auto-sync hook installed');
|
|
327
|
-
if (!hasEndHook)
|
|
328
|
-
console.error(' ✅ Session cleanup hook installed');
|
|
318
|
+
console.error(' ✅ Hooks updated');
|
|
329
319
|
if (removedLegacy)
|
|
330
320
|
console.error(' 🧹 Removed legacy monitoring hooks (now session-scoped)');
|
|
331
321
|
}
|
|
@@ -378,43 +368,31 @@ function injectMonitoringHooks(skillName) {
|
|
|
378
368
|
delete settings.hooks[legacyKey];
|
|
379
369
|
}
|
|
380
370
|
}
|
|
381
|
-
// ──
|
|
382
|
-
|
|
383
|
-
settings.hooks
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
settings.hooks.UserPromptSubmit.push({
|
|
387
|
-
hooks: [{
|
|
388
|
-
type: 'command',
|
|
389
|
-
command: `npx -y skillvault@${VERSION} --session-keepalive --event-type prompt-submit`,
|
|
390
|
-
}],
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
// ── PostToolUse hook ──
|
|
394
|
-
if (!Array.isArray(settings.hooks.PostToolUse))
|
|
395
|
-
settings.hooks.PostToolUse = [];
|
|
396
|
-
const hasToolHook = settings.hooks.PostToolUse.some((g) => g.hooks?.some((h) => h.command?.includes('skillvault') && h.command?.includes('session-keepalive')));
|
|
397
|
-
if (!hasToolHook) {
|
|
398
|
-
settings.hooks.PostToolUse.push({
|
|
399
|
-
matcher: 'Write|Bash|Edit',
|
|
400
|
-
hooks: [{
|
|
401
|
-
type: 'command',
|
|
402
|
-
command: `npx -y skillvault@${VERSION} --session-keepalive --event-type tool-use`,
|
|
403
|
-
}],
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
// ── Stop hook ──
|
|
407
|
-
if (!Array.isArray(settings.hooks.Stop))
|
|
408
|
-
settings.hooks.Stop = [];
|
|
409
|
-
const hasStopHook = settings.hooks.Stop.some((g) => g.hooks?.some((h) => h.command?.includes('skillvault') && h.command?.includes('session-keepalive')));
|
|
410
|
-
if (!hasStopHook) {
|
|
411
|
-
settings.hooks.Stop.push({
|
|
412
|
-
hooks: [{
|
|
413
|
-
type: 'command',
|
|
414
|
-
command: `npx -y skillvault@${VERSION} --session-keepalive --event-type stop`,
|
|
415
|
-
}],
|
|
416
|
-
});
|
|
371
|
+
// ── Monitoring hooks: remove existing and re-add with current version ──
|
|
372
|
+
for (const key of ['UserPromptSubmit', 'PostToolUse', 'Stop']) {
|
|
373
|
+
if (!Array.isArray(settings.hooks[key]))
|
|
374
|
+
settings.hooks[key] = [];
|
|
375
|
+
settings.hooks[key] = settings.hooks[key].filter((h) => !hasSkillvaultCommand(h));
|
|
417
376
|
}
|
|
377
|
+
settings.hooks.UserPromptSubmit.push({
|
|
378
|
+
hooks: [{
|
|
379
|
+
type: 'command',
|
|
380
|
+
command: `npx -y skillvault@${VERSION} --session-keepalive --event-type prompt-submit`,
|
|
381
|
+
}],
|
|
382
|
+
});
|
|
383
|
+
settings.hooks.PostToolUse.push({
|
|
384
|
+
matcher: 'Write|Bash|Edit',
|
|
385
|
+
hooks: [{
|
|
386
|
+
type: 'command',
|
|
387
|
+
command: `npx -y skillvault@${VERSION} --session-keepalive --event-type tool-use`,
|
|
388
|
+
}],
|
|
389
|
+
});
|
|
390
|
+
settings.hooks.Stop.push({
|
|
391
|
+
hooks: [{
|
|
392
|
+
type: 'command',
|
|
393
|
+
command: `npx -y skillvault@${VERSION} --session-keepalive --event-type stop`,
|
|
394
|
+
}],
|
|
395
|
+
});
|
|
418
396
|
writeFileSync(settingsPath, JSON.stringify(settings, null, 2), { mode: 0o600 });
|
|
419
397
|
}
|
|
420
398
|
catch {
|
|
@@ -1874,6 +1852,8 @@ async function main() {
|
|
|
1874
1852
|
process.exit(1);
|
|
1875
1853
|
}
|
|
1876
1854
|
console.error('🔐 SkillVault Sync\n');
|
|
1855
|
+
// Re-install hooks with current version (auto-upgrades pinned commands)
|
|
1856
|
+
configureSessionHook();
|
|
1877
1857
|
await syncSkills();
|
|
1878
1858
|
const result = await installSkillStubs();
|
|
1879
1859
|
console.error(`\n ✅ ${result.installed} installed, ${result.skipped} up to date\n`);
|