sra-skills 0.20.0 → 0.20.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.
Files changed (3) hide show
  1. package/index.mjs +19 -9
  2. package/lib.mjs +21 -8
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -216,8 +216,8 @@ async function selectSkillsWithProfile(skills, profileSkillNames, profileKey, pr
216
216
 
217
217
  async function promptSkillChanges(diff, allSkills, profileSkillNames, skipPrompt) {
218
218
  const { newProfile, newOther, removedFromProfile } = diff;
219
- if (!newProfile.size && !newOther.size) return [new Set(), new Set()];
220
- if (skipPrompt || !process.stdin.isTTY) return [newProfile, new Set()];
219
+ if (!newProfile.size && !newOther.size) return [new Set(), new Set(), false];
220
+ if (skipPrompt || !process.stdin.isTTY) return [newProfile, new Set(), false];
221
221
 
222
222
  if (removedFromProfile.size > 20) {
223
223
  const recCount = profileSkillNames ? profileSkillNames.size : 0;
@@ -244,7 +244,7 @@ async function promptSkillChanges(diff, allSkills, profileSkillNames, skipPrompt
244
244
  const toEnable = new Set();
245
245
  for (const name of newProfile) { if (selectedSet.has(`enable:${name}`)) toEnable.add(name); }
246
246
  for (const name of newOther) { if (selectedSet.has(`enable:${name}`)) toEnable.add(name); }
247
- return [toEnable, new Set()];
247
+ return [toEnable, new Set(), true];
248
248
  }
249
249
 
250
250
  async function selectSkills(skills, previouslyEnabled = null, previouslyDisabled = null) {
@@ -520,13 +520,18 @@ if (cmd === 'add') {
520
520
 
521
521
  if (isRepeat) {
522
522
  const diff = computeSkillDiff(allDiscovered, profileSkillNames, enabled, disabled);
523
- const [toEnable, toDisable] = skipPrompt
524
- ? [diff.newProfile, new Set()]
523
+ const [toEnable, toDisable, prompted] = skipPrompt
524
+ ? [diff.newProfile, new Set(), false]
525
525
  : await promptSkillChanges(diff, allDiscovered, profileSkillNames, false);
526
526
  const finalEnabled = new Set([...diff.keep, ...diff.removedFromProfile, ...toEnable]);
527
527
  for (const n of toDisable) finalEnabled.delete(n);
528
528
  skills = allDiscovered.filter(s => finalEnabled.has(s.name));
529
- disabled = new Set([...disabled, ...toDisable].filter(n => !toEnable.has(n) && discoveredNames.has(n)));
529
+ if (prompted) {
530
+ const rejectedNew = new Set([...diff.newProfile, ...diff.newOther].filter(n => !toEnable.has(n)));
531
+ disabled = new Set([...disabled, ...toDisable, ...rejectedNew].filter(n => !toEnable.has(n) && discoveredNames.has(n)));
532
+ } else {
533
+ disabled = new Set([...disabled, ...toDisable].filter(n => !toEnable.has(n) && discoveredNames.has(n)));
534
+ }
530
535
  } else {
531
536
  if (skipPrompt) {
532
537
  skills = allDiscovered.filter(s => profileSkillNames.has(s.name));
@@ -756,14 +761,19 @@ if (cmd === 'add') {
756
761
 
757
762
  const enabledSet = saved ? new Set(saved) : new Set();
758
763
  const diff = computeSkillDiff(allSkills, validatedProfileSkills, enabledSet, disabled);
759
- const [toEnable, toDisable] = skipPrompt
760
- ? [diff.newProfile, new Set()]
764
+ const [toEnable, toDisable, prompted] = skipPrompt
765
+ ? [diff.newProfile, new Set(), false]
761
766
  : await promptSkillChanges(diff, allSkills, validatedProfileSkills, false);
762
767
 
763
768
  const finalEnabled = new Set([...diff.keep, ...diff.removedFromProfile, ...toEnable]);
764
769
  for (const n of toDisable) finalEnabled.delete(n);
765
770
  skills = allSkills.filter(s => finalEnabled.has(s.name));
766
- disabled = new Set([...disabled, ...toDisable].filter(n => !toEnable.has(n) && discovered.has(n)));
771
+ if (prompted) {
772
+ const rejectedNew = new Set([...diff.newProfile, ...diff.newOther].filter(n => !toEnable.has(n)));
773
+ disabled = new Set([...disabled, ...toDisable, ...rejectedNew].filter(n => !toEnable.has(n) && discovered.has(n)));
774
+ } else {
775
+ disabled = new Set([...disabled, ...toDisable].filter(n => !toEnable.has(n) && discovered.has(n)));
776
+ }
767
777
  } else {
768
778
  // No profile and no profiles.json — legacy path
769
779
  const previouslyKnown = new Set([...(saved || []), ...disabled]);
package/lib.mjs CHANGED
@@ -664,6 +664,24 @@ export function runToolSetup(repoPath, tools) {
664
664
  return { commands: totalCommands, agents: totalAgents };
665
665
  }
666
666
 
667
+ export function parsePostInstallOutput(output) {
668
+ const components = [];
669
+ const warnings = [];
670
+ const errors = [];
671
+ for (const line of output.split('\n')) {
672
+ const warnMatch = line.match(/⚠\s+(.+?)(?:\s*$)/);
673
+ if (warnMatch) { warnings.push(warnMatch[1].trim()); continue; }
674
+ const errMatch = line.match(/✗\s+(.+?)(?:\s*$)/);
675
+ if (errMatch) { errors.push(errMatch[1].trim()); continue; }
676
+ const okMatch = line.match(/✓\s+(.+?)(?:\s*$)/);
677
+ if (okMatch) {
678
+ const name = okMatch[1].replace(/\s+(telemetry|hook|hooks).*$/i, '').trim().toLowerCase();
679
+ if (name && !components.includes(name)) components.push(name);
680
+ }
681
+ }
682
+ return { components, warnings, errors };
683
+ }
684
+
667
685
  export function runPostInstall(repoPath) {
668
686
  const hook = join(repoPath, 'hooks', 'post-install.sh');
669
687
  if (!existsSync(hook)) return;
@@ -673,14 +691,9 @@ export function runPostInstall(repoPath) {
673
691
  const logDir = join(SRA_HOME, 'logs');
674
692
  mkdirSync(logDir, { recursive: true });
675
693
  writeFileSync(join(logDir, 'post-install.log'), output);
676
- const components = [];
677
- for (const line of output.split('\n')) {
678
- const m = line.match(/✓\s+(.+?)(?:\s*$)/);
679
- if (m) {
680
- const name = m[1].replace(/\s+(telemetry|hook|hooks).*$/i, '').trim().toLowerCase();
681
- if (name && !components.includes(name)) components.push(name);
682
- }
683
- }
694
+ const { components, warnings, errors } = parsePostInstallOutput(output);
695
+ for (const msg of errors) console.log(` ✗ ${msg}`);
696
+ for (const msg of warnings) console.log(` ⚠ ${msg}`);
684
697
  if (components.length) {
685
698
  console.log(' Post-install:');
686
699
  const perRow = 4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sra-skills",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
4
4
  "description": "SRA agent skills installer — manage AI skill repos",
5
5
  "bin": {
6
6
  "sra": "index.mjs",