skillvault 0.5.1 → 0.5.2
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 +51 -5
- 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.2';
|
|
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');
|
|
@@ -479,14 +479,60 @@ async function installSkillStubs() {
|
|
|
479
479
|
meta = JSON.parse(readFileSync(metaPath, 'utf8'));
|
|
480
480
|
}
|
|
481
481
|
catch { }
|
|
482
|
+
// Decrypt vault to extract frontmatter (name, description, triggers)
|
|
483
|
+
// The frontmatter is the "public storefront" — body stays encrypted
|
|
484
|
+
let frontmatter = '';
|
|
485
|
+
let frontmatterFields = {};
|
|
486
|
+
try {
|
|
487
|
+
const cek = await fetchCEK(skillName, pub.token);
|
|
488
|
+
const vaultData = readFileSync(vaultPath);
|
|
489
|
+
const vault = decryptVault(vaultData, cek);
|
|
490
|
+
cek.fill(0);
|
|
491
|
+
const skillMd = vault.files.find(f => f.path === 'SKILL.md');
|
|
492
|
+
if (skillMd) {
|
|
493
|
+
const fmMatch = skillMd.content.match(/^---\n([\s\S]*?)\n---/);
|
|
494
|
+
if (fmMatch) {
|
|
495
|
+
frontmatter = fmMatch[1];
|
|
496
|
+
// Parse YAML-like frontmatter fields
|
|
497
|
+
for (const line of frontmatter.split('\n')) {
|
|
498
|
+
const kv = line.match(/^(\S+):\s*(.+)$/);
|
|
499
|
+
if (kv)
|
|
500
|
+
frontmatterFields[kv[1]] = kv[2].replace(/^["']|["']$/g, '');
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
catch {
|
|
506
|
+
// If decrypt fails during stub install (e.g. offline), fall back to meta
|
|
507
|
+
}
|
|
508
|
+
const stubName = frontmatterFields['name'] || skillName;
|
|
509
|
+
const stubDescription = frontmatterFields['description'] || meta.description || '';
|
|
510
|
+
// Build frontmatter for stub — copy all fields except body-related ones
|
|
511
|
+
let stubFrontmatter = `name: ${stubName}\n`;
|
|
512
|
+
stubFrontmatter += `description: "${stubDescription.replace(/"/g, '\\"')}"\n`;
|
|
513
|
+
// Preserve publisher's allowed-tools, trigger config, etc. but always include our load tool
|
|
514
|
+
const publisherAllowedTools = frontmatterFields['allowed-tools'] || '';
|
|
515
|
+
const loadTool = `"Bash(npx skillvault@${VERSION} --load *)"`;
|
|
516
|
+
if (publisherAllowedTools && !publisherAllowedTools.includes('skillvault')) {
|
|
517
|
+
// Merge publisher's allowed-tools with ours
|
|
518
|
+
const merged = publisherAllowedTools.replace(/\]$/, `, ${loadTool}]`);
|
|
519
|
+
stubFrontmatter += `allowed-tools: ${merged}\n`;
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
stubFrontmatter += `allowed-tools: [${loadTool}]\n`;
|
|
523
|
+
}
|
|
524
|
+
// Copy through other frontmatter fields the publisher set (for Claude triggering)
|
|
525
|
+
for (const [key, value] of Object.entries(frontmatterFields)) {
|
|
526
|
+
if (!['name', 'description', 'allowed-tools'].includes(key)) {
|
|
527
|
+
stubFrontmatter += `${key}: ${value}\n`;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
482
530
|
mkdirSync(skillDir, { recursive: true });
|
|
483
531
|
const stub = `---
|
|
484
|
-
|
|
485
|
-
description: "${(meta.description || '').replace(/"/g, '\\"')}"
|
|
486
|
-
allowed-tools: ["Bash(npx skillvault@${VERSION} --load *)"]
|
|
532
|
+
${stubFrontmatter.trimEnd()}
|
|
487
533
|
---
|
|
488
534
|
|
|
489
|
-
# ${
|
|
535
|
+
# ${stubName}
|
|
490
536
|
|
|
491
537
|
This is an encrypted SkillVault skill from **${meta.publisher_name || pub.name}**.
|
|
492
538
|
|