skillvault 0.5.0 → 0.5.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.js +41 -1
- 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, createPublicKey, diffieHellman, hkdfSync, generateKeyPairSync, } from 'node:crypto';
|
|
23
|
-
const VERSION = '0.5.
|
|
23
|
+
const VERSION = '0.5.1';
|
|
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');
|
|
@@ -151,6 +151,8 @@ async function setup(code) {
|
|
|
151
151
|
mkdirSync(join(VAULT_DIR, data.publisher_id), { recursive: true });
|
|
152
152
|
// Clean up legacy MCP config if present
|
|
153
153
|
cleanupMCPConfig();
|
|
154
|
+
// Install session hook for auto-sync
|
|
155
|
+
configureSessionHook();
|
|
154
156
|
// Sync vaults and install stubs
|
|
155
157
|
console.error('');
|
|
156
158
|
console.error(' Syncing skills...');
|
|
@@ -161,6 +163,7 @@ async function setup(code) {
|
|
|
161
163
|
console.error(` ✅ ${installResult.installed} skill${installResult.installed !== 1 ? 's' : ''} installed to ~/.claude/skills/`);
|
|
162
164
|
}
|
|
163
165
|
console.error(' ✅ Setup complete! Restart Claude Code to use your skills.');
|
|
166
|
+
console.error(' Skills will auto-sync at the start of each Claude Code session.');
|
|
164
167
|
console.error('');
|
|
165
168
|
}
|
|
166
169
|
/** Remove legacy MCP server config from ~/.claude/.mcp.json */
|
|
@@ -178,6 +181,43 @@ function cleanupMCPConfig() {
|
|
|
178
181
|
}
|
|
179
182
|
catch { }
|
|
180
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Install a SessionStart hook in Claude Code settings so skills auto-sync
|
|
186
|
+
* at the start of each session. This discovers new skills from all
|
|
187
|
+
* existing publishers without the customer doing anything.
|
|
188
|
+
*/
|
|
189
|
+
function configureSessionHook() {
|
|
190
|
+
const settingsPath = join(HOME, '.claude', 'settings.json');
|
|
191
|
+
try {
|
|
192
|
+
let settings = {};
|
|
193
|
+
if (existsSync(settingsPath)) {
|
|
194
|
+
settings = JSON.parse(readFileSync(settingsPath, 'utf8'));
|
|
195
|
+
}
|
|
196
|
+
if (!settings.hooks)
|
|
197
|
+
settings.hooks = {};
|
|
198
|
+
if (!settings.hooks.SessionStart)
|
|
199
|
+
settings.hooks.SessionStart = [];
|
|
200
|
+
// Check if we already have a skillvault sync hook
|
|
201
|
+
const hasHook = settings.hooks.SessionStart.some((group) => group.matcher === 'startup' &&
|
|
202
|
+
group.hooks?.some((h) => h.command?.includes('skillvault')));
|
|
203
|
+
if (!hasHook) {
|
|
204
|
+
settings.hooks.SessionStart.push({
|
|
205
|
+
matcher: 'startup',
|
|
206
|
+
hooks: [{
|
|
207
|
+
type: 'command',
|
|
208
|
+
command: `npx skillvault@${VERSION} --sync`,
|
|
209
|
+
timeout: 30,
|
|
210
|
+
}],
|
|
211
|
+
});
|
|
212
|
+
mkdirSync(join(HOME, '.claude'), { recursive: true });
|
|
213
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2), { mode: 0o600 });
|
|
214
|
+
console.error(' ✅ Auto-sync hook installed');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
console.error(' ⚠️ Could not install auto-sync hook — run npx skillvault --sync manually');
|
|
219
|
+
}
|
|
220
|
+
}
|
|
181
221
|
async function showStatus() {
|
|
182
222
|
const config = loadConfig();
|
|
183
223
|
if (!config) {
|