skillfullstack 1.0.2 → 1.0.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/bin/index.js +40 -69
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -12,7 +12,6 @@ import fs from 'fs';
|
|
|
12
12
|
import { promises as fsp } from 'fs';
|
|
13
13
|
import path from 'path';
|
|
14
14
|
import { fileURLToPath } from 'url';
|
|
15
|
-
import readline from 'readline';
|
|
16
15
|
|
|
17
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
17
|
const __dirname = path.dirname(__filename);
|
|
@@ -46,18 +45,6 @@ function loadCatalog() {
|
|
|
46
45
|
return { skills: [] };
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
async function fetchRemoteCatalog() {
|
|
50
|
-
try {
|
|
51
|
-
const res = await fetch(`${REPO_RAW}/.skillsRegistry/catalog.json`);
|
|
52
|
-
if (res.ok) {
|
|
53
|
-
return await res.json();
|
|
54
|
-
}
|
|
55
|
-
} catch (err) {
|
|
56
|
-
// Ignore
|
|
57
|
-
}
|
|
58
|
-
return loadCatalog();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
48
|
// Auto-detect project environment
|
|
62
49
|
function detectAgents() {
|
|
63
50
|
const detected = [];
|
|
@@ -97,8 +84,10 @@ function resolveInstallTarget(skillName, agent, customDir = null) {
|
|
|
97
84
|
};
|
|
98
85
|
case 'cursor':
|
|
99
86
|
return {
|
|
100
|
-
targetDir: path.join(cwd, '.cursor/
|
|
101
|
-
targetFile: path.join(cwd, '.cursor/
|
|
87
|
+
targetDir: path.join(cwd, '.cursor/skills', skillName),
|
|
88
|
+
targetFile: path.join(cwd, '.cursor/skills', skillName, 'SKILL.md'),
|
|
89
|
+
ruleDir: path.join(cwd, '.cursor/rules'),
|
|
90
|
+
ruleFile: path.join(cwd, '.cursor/rules', `${skillName}.mdc`),
|
|
102
91
|
agent: 'cursor',
|
|
103
92
|
};
|
|
104
93
|
case 'windsurf':
|
|
@@ -123,20 +112,6 @@ function resolveInstallTarget(skillName, agent, customDir = null) {
|
|
|
123
112
|
}
|
|
124
113
|
}
|
|
125
114
|
|
|
126
|
-
async function copyDirRecursive(src, dest) {
|
|
127
|
-
await fsp.mkdir(dest, { recursive: true });
|
|
128
|
-
const entries = await fsp.readdir(src, { withFileTypes: true });
|
|
129
|
-
for (const entry of entries) {
|
|
130
|
-
const srcPath = path.join(src, entry.name);
|
|
131
|
-
const destPath = path.join(dest, entry.name);
|
|
132
|
-
if (entry.isDirectory()) {
|
|
133
|
-
await copyDirRecursive(srcPath, destPath);
|
|
134
|
-
} else {
|
|
135
|
-
await fsp.copyFile(srcPath, destPath);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
115
|
// -------------------------------------------------------------
|
|
141
116
|
// Commands
|
|
142
117
|
// -------------------------------------------------------------
|
|
@@ -222,7 +197,6 @@ async function cmdInfo(skillName, catalog) {
|
|
|
222
197
|
console.log(` ${c.bold}Official Docs:${c.reset} ${skill.docs || 'N/A'}`);
|
|
223
198
|
console.log(`\n ${c.bold}Description:${c.reset}\n ${skill.description}\n`);
|
|
224
199
|
|
|
225
|
-
// Check if offline assets exist
|
|
226
200
|
const localAssetDir = path.join(PKG_ROOT, skill.path, 'assets');
|
|
227
201
|
const hasAssets = fs.existsSync(localAssetDir);
|
|
228
202
|
console.log(` ${c.bold}Offline Assets:${c.reset} ${hasAssets ? c.green + '✓ Bundled (High-Accuracy)' : c.gray + 'Remote only'}${c.reset}`);
|
|
@@ -249,59 +223,62 @@ async function installSingleSkill(skillName, catalog, options = {}) {
|
|
|
249
223
|
}
|
|
250
224
|
}
|
|
251
225
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const localFile = path.join(PKG_ROOT, skill.path, 'SKILL.md');
|
|
255
|
-
if (fs.existsSync(localFile)) {
|
|
256
|
-
content = await fsp.readFile(localFile, 'utf8');
|
|
257
|
-
} else {
|
|
258
|
-
const remoteUrl = `${REPO_RAW}/${skill.path}/SKILL.md`;
|
|
259
|
-
const res = await fetch(remoteUrl);
|
|
260
|
-
if (!res.ok) throw new Error(`Failed to fetch ${remoteUrl} (HTTP ${res.status})`);
|
|
261
|
-
content = await res.text();
|
|
262
|
-
}
|
|
226
|
+
const localSkillDir = path.join(PKG_ROOT, skill.path);
|
|
227
|
+
const hasLocalDir = fs.existsSync(localSkillDir);
|
|
263
228
|
|
|
264
|
-
// 2. Install to targets
|
|
265
229
|
for (const agent of agentsToInstall) {
|
|
266
230
|
const target = resolveInstallTarget(skill.name, agent, options.dir);
|
|
267
231
|
await fsp.mkdir(target.targetDir, { recursive: true });
|
|
268
|
-
await fsp.writeFile(target.targetFile, content, 'utf8');
|
|
269
232
|
|
|
270
|
-
|
|
233
|
+
if (hasLocalDir) {
|
|
234
|
+
// 1. Copy the ENTIRE skill folder (SKILL.md, references/, assets/, scripts/, evals/, policies/, templates/)
|
|
235
|
+
await fsp.cp(localSkillDir, target.targetDir, { recursive: true });
|
|
236
|
+
} else {
|
|
237
|
+
// Remote fallback: Fetch SKILL.md
|
|
238
|
+
const remoteUrl = `${REPO_RAW}/${skill.path}/SKILL.md`;
|
|
239
|
+
const res = await fetch(remoteUrl);
|
|
240
|
+
if (!res.ok) throw new Error(`Failed to fetch ${remoteUrl} (HTTP ${res.status})`);
|
|
241
|
+
const content = await res.text();
|
|
242
|
+
await fsp.writeFile(target.targetFile, content, 'utf8');
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// 2. Special handling for Claude Code: also register slash command
|
|
271
246
|
if (target.cmdFile && target.cmdDir) {
|
|
272
247
|
await fsp.mkdir(target.cmdDir, { recursive: true });
|
|
273
|
-
await fsp.
|
|
248
|
+
const skillMdContent = await fsp.readFile(path.join(target.targetDir, 'SKILL.md'), 'utf8');
|
|
249
|
+
await fsp.writeFile(target.cmdFile, skillMdContent, 'utf8');
|
|
274
250
|
}
|
|
275
251
|
|
|
276
|
-
// Special handling for Cursor:
|
|
277
|
-
if (target.
|
|
252
|
+
// 3. Special handling for Cursor: also create .mdc rule file
|
|
253
|
+
if (target.ruleFile && target.ruleDir) {
|
|
254
|
+
await fsp.mkdir(target.ruleDir, { recursive: true });
|
|
255
|
+
const skillMdContent = await fsp.readFile(path.join(target.targetDir, 'SKILL.md'), 'utf8');
|
|
278
256
|
const cursorContent = `---
|
|
279
257
|
description: ${skill.description}
|
|
280
258
|
globs: *
|
|
281
259
|
alwaysApply: false
|
|
282
260
|
---
|
|
283
261
|
|
|
284
|
-
${
|
|
285
|
-
await fsp.writeFile(target.
|
|
262
|
+
${skillMdContent}`;
|
|
263
|
+
await fsp.writeFile(target.ruleFile, cursorContent, 'utf8');
|
|
286
264
|
}
|
|
287
265
|
|
|
288
|
-
//
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (fs.existsSync(localRefs)) {
|
|
296
|
-
await copyDirRecursive(localRefs, path.join(target.targetDir, 'references'));
|
|
297
|
-
}
|
|
298
|
-
}
|
|
266
|
+
// List installed subdirectories for transparency
|
|
267
|
+
const installedItems = ['SKILL.md'];
|
|
268
|
+
if (fs.existsSync(path.join(target.targetDir, 'references'))) installedItems.push('references/');
|
|
269
|
+
if (fs.existsSync(path.join(target.targetDir, 'assets'))) installedItems.push('assets/');
|
|
270
|
+
if (fs.existsSync(path.join(target.targetDir, 'scripts'))) installedItems.push('scripts/');
|
|
271
|
+
if (fs.existsSync(path.join(target.targetDir, 'evals'))) installedItems.push('evals/');
|
|
272
|
+
if (fs.existsSync(path.join(target.targetDir, 'policies'))) installedItems.push('policies/');
|
|
299
273
|
|
|
300
274
|
console.log(` ${c.green}✓${c.reset} Installed ${c.bold}${skill.name}${c.reset} for ${c.cyan}${agent}${c.reset}`);
|
|
301
|
-
console.log(` ${c.gray}→ ${path.relative(process.cwd(), target.
|
|
275
|
+
console.log(` ${c.gray}→ ${path.relative(process.cwd(), target.targetDir)}/ [${installedItems.join(', ')}]${c.reset}`);
|
|
302
276
|
if (target.cmdFile) {
|
|
303
277
|
console.log(` ${c.gray}→ Slash command: ${path.relative(process.cwd(), target.cmdFile)} (/${skill.name})${c.reset}`);
|
|
304
278
|
}
|
|
279
|
+
if (target.ruleFile) {
|
|
280
|
+
console.log(` ${c.gray}→ Cursor rule: ${path.relative(process.cwd(), target.ruleFile)}${c.reset}`);
|
|
281
|
+
}
|
|
305
282
|
}
|
|
306
283
|
}
|
|
307
284
|
|
|
@@ -395,7 +372,7 @@ ${c.bold}USAGE${c.reset}
|
|
|
395
372
|
$ ${c.cyan}sfs${c.reset} <command> [options]
|
|
396
373
|
|
|
397
374
|
${c.bold}COMMANDS${c.reset}
|
|
398
|
-
${c.green}add, install${c.reset} <skill...> Install one or more skills
|
|
375
|
+
${c.green}add, install${c.reset} <skill...> Install one or more skills (copies SKILL.md, references, assets, etc.)
|
|
399
376
|
${c.green}list, ls${c.reset} List all 25+ verified skills across all domains
|
|
400
377
|
${c.green}search${c.reset} <query> Search skills by keyword, framework, or capability
|
|
401
378
|
${c.green}info${c.reset} <skill> Show detailed documentation, slash commands, & metadata
|
|
@@ -404,7 +381,6 @@ ${c.bold}COMMANDS${c.reset}
|
|
|
404
381
|
${c.bold}OPTIONS${c.reset}
|
|
405
382
|
${c.yellow}-a, --agent <name>${c.reset} Target agent: ${c.dim}claude, cursor, antigravity, windsurf, copilot, agent, all${c.reset}
|
|
406
383
|
${c.yellow}-d, --dir <path>${c.reset} Custom destination folder
|
|
407
|
-
${c.yellow}--with-assets${c.reset} Download complete offline documentation assets
|
|
408
384
|
${c.yellow}-t, --taxonomy <name>${c.reset} Filter list by category (frontend, backend, github, etc.)
|
|
409
385
|
${c.yellow}--json${c.reset} Output catalog as JSON
|
|
410
386
|
${c.yellow}-h, --help${c.reset} Display help guide
|
|
@@ -414,7 +390,6 @@ ${c.bold}EXAMPLES${c.reset}
|
|
|
414
390
|
$ ${c.cyan}npx skillfullstack add nextjs${c.reset}
|
|
415
391
|
$ ${c.cyan}npx skillfullstack add astro cloudflare --agent=cursor${c.reset}
|
|
416
392
|
$ ${c.cyan}npx skillfullstack add databaseArchitecture --agent=claude${c.reset}
|
|
417
|
-
$ ${c.cyan}npx skillfullstack add nextjs --with-assets${c.reset}
|
|
418
393
|
$ ${c.cyan}npx skillfullstack list --taxonomy frontend${c.reset}
|
|
419
394
|
$ ${c.cyan}npx skillfullstack search graphql${c.reset}
|
|
420
395
|
$ ${c.cyan}npx skillfullstack init${c.reset}
|
|
@@ -442,11 +417,9 @@ async function main() {
|
|
|
442
417
|
|
|
443
418
|
const catalog = loadCatalog();
|
|
444
419
|
|
|
445
|
-
// Parse simple flags
|
|
446
420
|
const options = {
|
|
447
421
|
agent: null,
|
|
448
422
|
dir: null,
|
|
449
|
-
withAssets: false,
|
|
450
423
|
taxonomy: null,
|
|
451
424
|
json: false,
|
|
452
425
|
};
|
|
@@ -462,9 +435,7 @@ async function main() {
|
|
|
462
435
|
options.dir = arg.split('=')[1];
|
|
463
436
|
} else if (arg === '-d' || arg === '--dir') {
|
|
464
437
|
options.dir = rawArgs[++i];
|
|
465
|
-
} else if (arg
|
|
466
|
-
options.withAssets = true;
|
|
467
|
-
} else if (arg.startsWith('--taxonomy=')|| arg.startsWith('-t=')) {
|
|
438
|
+
} else if (arg.startsWith('--taxonomy=') || arg.startsWith('-t=')) {
|
|
468
439
|
options.taxonomy = arg.split('=')[1];
|
|
469
440
|
} else if (arg === '-t' || arg === '--taxonomy') {
|
|
470
441
|
options.taxonomy = rawArgs[++i];
|
package/package.json
CHANGED