sra-skills 0.3.0 → 0.3.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/index.mjs +40 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -275,8 +275,15 @@ if (cmd === 'add') {
|
|
|
275
275
|
console.log(`Repo "${name}" exists, updating...`);
|
|
276
276
|
execSync('git pull', { cwd: repoPath, stdio: 'inherit' });
|
|
277
277
|
} else {
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
const refIdx = cmdArgs.indexOf('--ref');
|
|
279
|
+
const ref = refIdx >= 0 ? cmdArgs[refIdx + 1] : 'release';
|
|
280
|
+
console.log(`Cloning ${url} (${ref})...`);
|
|
281
|
+
try {
|
|
282
|
+
execSync(`git clone --depth 1 -b "${ref}" "${url}" "${repoPath}"`, { stdio: 'inherit' });
|
|
283
|
+
} catch {
|
|
284
|
+
console.log(` ⚠ Branch "${ref}" not found, using default branch`);
|
|
285
|
+
execSync(`git clone --depth 1 "${url}" "${repoPath}"`, { stdio: 'inherit' });
|
|
286
|
+
}
|
|
280
287
|
execSync('git fetch --tags --depth 1', { cwd: repoPath, stdio: 'ignore' });
|
|
281
288
|
}
|
|
282
289
|
}
|
|
@@ -290,8 +297,11 @@ if (cmd === 'add') {
|
|
|
290
297
|
runPostInstall(repoPath);
|
|
291
298
|
|
|
292
299
|
const m = readManifest();
|
|
293
|
-
|
|
294
|
-
|
|
300
|
+
const refIdx2 = cmdArgs.indexOf('--ref');
|
|
301
|
+
const savedRef = refIdx2 >= 0 ? cmdArgs[refIdx2 + 1] : 'release';
|
|
302
|
+
m.repos[name] = { path: repoPath, ...(url && { url }), ref: savedRef,
|
|
303
|
+
version: getVersion(repoPath), skills: skills.map(s => s.name),
|
|
304
|
+
updated_at: new Date().toISOString() };
|
|
295
305
|
m.tools = tools;
|
|
296
306
|
writeManifest(m);
|
|
297
307
|
console.log(`Done. ${name}: ${m.repos[name].version}`);
|
|
@@ -326,7 +336,31 @@ if (cmd === 'add') {
|
|
|
326
336
|
const repo = m.repos[name];
|
|
327
337
|
if (!repo) { console.error(`Repo "${name}" not found`); continue; }
|
|
328
338
|
console.log(`Updating ${name}...`);
|
|
329
|
-
|
|
339
|
+
const isCloned = !!repo.url; // --local installs have no url
|
|
340
|
+
if (isCloned) {
|
|
341
|
+
const ref = repo.ref || 'release';
|
|
342
|
+
if (!repo.ref) repo.ref = ref; // backfill for pre-v2.0.1 installs
|
|
343
|
+
const current = execSync('git rev-parse --abbrev-ref HEAD', { cwd: repo.path, encoding: 'utf8' }).trim();
|
|
344
|
+
if (current !== ref) {
|
|
345
|
+
try {
|
|
346
|
+
execSync(`git checkout "${ref}"`, { cwd: repo.path, stdio: 'pipe' });
|
|
347
|
+
console.log(` Switched to ${ref}`);
|
|
348
|
+
} catch {
|
|
349
|
+
try {
|
|
350
|
+
execSync(`git fetch origin "${ref}:${ref}"`, { cwd: repo.path, stdio: 'pipe' });
|
|
351
|
+
execSync(`git checkout "${ref}"`, { cwd: repo.path, stdio: 'pipe' });
|
|
352
|
+
execSync(`git branch --set-upstream-to=origin/${ref} ${ref}`, { cwd: repo.path, stdio: 'pipe' });
|
|
353
|
+
console.log(` Switched to ${ref}`);
|
|
354
|
+
} catch {
|
|
355
|
+
console.log(` ⚠ Branch "${ref}" not found, staying on ${current}`);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
try { execSync(`git pull origin "${ref}"`, { cwd: repo.path, stdio: 'inherit' }); } catch {}
|
|
360
|
+
try { execSync('git fetch --tags --depth 1', { cwd: repo.path, stdio: 'ignore' }); } catch {}
|
|
361
|
+
} else {
|
|
362
|
+
try { execSync('git pull', { cwd: repo.path, stdio: 'inherit' }); } catch {}
|
|
363
|
+
}
|
|
330
364
|
const allSkills = discoverSkills(repo.path);
|
|
331
365
|
const saved = repo.skills;
|
|
332
366
|
const skills = saved ? allSkills.filter(s => saved.includes(s.name)) : allSkills;
|
|
@@ -429,5 +463,6 @@ Commands:
|
|
|
429
463
|
Options:
|
|
430
464
|
--tool <name> Target tool (claude|codex|cursor|openclaw|all)
|
|
431
465
|
--name <name> Override repo name (for add)
|
|
466
|
+
--ref <branch|tag> Git branch or tag (default: release)
|
|
432
467
|
-y, --yes Skip interactive selection (install all)`);
|
|
433
468
|
}
|