sra-skills 0.2.3 → 0.3.0
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/index.mjs +78 -14
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -291,7 +291,7 @@ if (cmd === 'add') {
|
|
|
291
291
|
|
|
292
292
|
const m = readManifest();
|
|
293
293
|
m.repos[name] = { path: repoPath, ...(url && { url }), version: getVersion(repoPath),
|
|
294
|
-
updated_at: new Date().toISOString() };
|
|
294
|
+
skills: skills.map(s => s.name), updated_at: new Date().toISOString() };
|
|
295
295
|
m.tools = tools;
|
|
296
296
|
writeManifest(m);
|
|
297
297
|
console.log(`Done. ${name}: ${m.repos[name].version}`);
|
|
@@ -327,21 +327,83 @@ if (cmd === 'add') {
|
|
|
327
327
|
if (!repo) { console.error(`Repo "${name}" not found`); continue; }
|
|
328
328
|
console.log(`Updating ${name}...`);
|
|
329
329
|
try { execSync('git pull', { cwd: repo.path, stdio: 'inherit' }); } catch {}
|
|
330
|
-
const
|
|
330
|
+
const allSkills = discoverSkills(repo.path);
|
|
331
|
+
const saved = repo.skills;
|
|
332
|
+
const skills = saved ? allSkills.filter(s => saved.includes(s.name)) : allSkills;
|
|
331
333
|
linkSkills(skills, tools);
|
|
332
334
|
runToolSetup(repo.path, tools);
|
|
335
|
+
runPostInstall(repo.path);
|
|
336
|
+
repo.skills = skills.map(s => s.name);
|
|
333
337
|
repo.version = getVersion(repo.path);
|
|
334
338
|
repo.updated_at = new Date().toISOString();
|
|
335
339
|
}
|
|
336
340
|
m.tools = tools;
|
|
337
341
|
writeManifest(m);
|
|
338
342
|
|
|
343
|
+
} else if (cmd === 'skill') {
|
|
344
|
+
const subCmd = cmdArgs[0];
|
|
345
|
+
const skillName = cmdArgs[1];
|
|
346
|
+
const m = readManifest();
|
|
347
|
+
const tools = m.tools || detectTools();
|
|
348
|
+
|
|
349
|
+
if (subCmd === 'add' && skillName) {
|
|
350
|
+
for (const [rname, repo] of Object.entries(m.repos)) {
|
|
351
|
+
const allSkills = discoverSkills(repo.path);
|
|
352
|
+
const match = allSkills.filter(s => s.name === skillName);
|
|
353
|
+
if (match.length) {
|
|
354
|
+
const saved = repo.skills || [];
|
|
355
|
+
if (saved.includes(skillName)) {
|
|
356
|
+
console.log(`${skillName} is already enabled`);
|
|
357
|
+
process.exit(0);
|
|
358
|
+
}
|
|
359
|
+
linkSkills(match, tools);
|
|
360
|
+
saved.push(skillName);
|
|
361
|
+
repo.skills = saved;
|
|
362
|
+
writeManifest(m);
|
|
363
|
+
console.log(`Enabled ${skillName} (from ${rname})`);
|
|
364
|
+
process.exit(0);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
console.error(`Skill "${skillName}" not found in any installed repo`);
|
|
368
|
+
console.error('Available skills:');
|
|
369
|
+
for (const [rname, repo] of Object.entries(m.repos)) {
|
|
370
|
+
const allSkills = discoverSkills(repo.path);
|
|
371
|
+
const saved = repo.skills || [];
|
|
372
|
+
allSkills.filter(s => !saved.includes(s.name)).forEach(s =>
|
|
373
|
+
console.error(` ${s.name} (${rname})`));
|
|
374
|
+
}
|
|
375
|
+
process.exit(1);
|
|
376
|
+
|
|
377
|
+
} else if (subCmd === 'remove' && skillName) {
|
|
378
|
+
for (const [rname, repo] of Object.entries(m.repos)) {
|
|
379
|
+
const saved = repo.skills || [];
|
|
380
|
+
if (saved.includes(skillName)) {
|
|
381
|
+
const allSkills = discoverSkills(repo.path);
|
|
382
|
+
const match = allSkills.filter(s => s.name === skillName);
|
|
383
|
+
if (match.length) unlinkSkills(match, tools);
|
|
384
|
+
repo.skills = saved.filter(s => s !== skillName);
|
|
385
|
+
writeManifest(m);
|
|
386
|
+
console.log(`Disabled ${skillName} (from ${rname})`);
|
|
387
|
+
process.exit(0);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
console.error(`Skill "${skillName}" is not currently enabled`);
|
|
391
|
+
process.exit(1);
|
|
392
|
+
|
|
393
|
+
} else {
|
|
394
|
+
console.log(`Usage: sra skill <add|remove> <skill-name>`);
|
|
395
|
+
}
|
|
396
|
+
|
|
339
397
|
} else if (cmd === 'list') {
|
|
340
398
|
const m = readManifest();
|
|
341
399
|
for (const [name, info] of Object.entries(m.repos)) {
|
|
342
|
-
const
|
|
400
|
+
const allSkills = discoverSkills(info.path);
|
|
401
|
+
const saved = info.skills;
|
|
343
402
|
console.log(`${name} (${info.version || 'unknown'}):`);
|
|
344
|
-
|
|
403
|
+
allSkills.forEach(s => {
|
|
404
|
+
const enabled = !saved || saved.includes(s.name);
|
|
405
|
+
console.log(` ${enabled ? '' : '(disabled) '}${s.name}`);
|
|
406
|
+
});
|
|
345
407
|
}
|
|
346
408
|
if (m.tools?.length) console.log(`\nTools: ${m.tools.join(', ')}`);
|
|
347
409
|
|
|
@@ -352,18 +414,20 @@ if (cmd === 'add') {
|
|
|
352
414
|
}
|
|
353
415
|
|
|
354
416
|
} else {
|
|
355
|
-
console.log(`Usage: sra <
|
|
417
|
+
console.log(`Usage: sra <command> [args]
|
|
356
418
|
|
|
357
419
|
Commands:
|
|
358
|
-
add <git-url>
|
|
359
|
-
add --local <path>
|
|
360
|
-
remove <repo-name>
|
|
361
|
-
update [repo-name]
|
|
362
|
-
|
|
363
|
-
|
|
420
|
+
add <git-url> Clone repo, discover skills, symlink, configure tools
|
|
421
|
+
add --local <path> Register existing repo directory
|
|
422
|
+
remove <repo-name> Unlink skills, remove repo
|
|
423
|
+
update [repo-name] Git pull, re-link, re-configure
|
|
424
|
+
skill add <skill-name> Enable a skill from an installed repo
|
|
425
|
+
skill remove <skill-name> Disable a skill (remove symlink)
|
|
426
|
+
list Show installed repos and skills
|
|
427
|
+
version Show repo versions
|
|
364
428
|
|
|
365
429
|
Options:
|
|
366
|
-
--tool <name>
|
|
367
|
-
|
|
368
|
-
--
|
|
430
|
+
--tool <name> Target tool (claude|codex|cursor|openclaw|all)
|
|
431
|
+
--name <name> Override repo name (for add)
|
|
432
|
+
-y, --yes Skip interactive selection (install all)`);
|
|
369
433
|
}
|