@onezhao/skill-sync 1.0.0 → 1.1.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/dist/cli.mjs +22 -9
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -545,25 +545,32 @@ async function runSkillSync(args = []) {
|
|
|
545
545
|
process.exit(1);
|
|
546
546
|
}
|
|
547
547
|
spinner.stop(`Found ${pc.green(skills.length)} skill${skills.length !== 1 ? "s" : ""}`);
|
|
548
|
-
const
|
|
548
|
+
const SELECT_ALL_SKILLS = Symbol("select-all-skills");
|
|
549
|
+
const skillChoices = [{
|
|
550
|
+
value: SELECT_ALL_SKILLS,
|
|
551
|
+
label: pc.bold("Select All"),
|
|
552
|
+
hint: `All ${skills.length} skills`
|
|
553
|
+
}, ...skills.map((s) => ({
|
|
549
554
|
value: s,
|
|
550
555
|
label: s.name,
|
|
551
556
|
hint: s.description.length > 50 ? s.description.slice(0, 47) + "..." : s.description
|
|
552
|
-
}));
|
|
557
|
+
}))];
|
|
553
558
|
let selectedSkills;
|
|
554
559
|
if (options.yes) {
|
|
555
560
|
selectedSkills = skills;
|
|
556
561
|
p.log.info(`Selected all ${skills.length} skills`);
|
|
557
562
|
} else {
|
|
558
|
-
|
|
563
|
+
const rawSelection = await p.multiselect({
|
|
559
564
|
message: "Select skills to sync",
|
|
560
565
|
options: skillChoices,
|
|
561
566
|
required: true
|
|
562
567
|
});
|
|
563
|
-
if (p.isCancel(
|
|
568
|
+
if (p.isCancel(rawSelection)) {
|
|
564
569
|
p.cancel("Cancelled");
|
|
565
570
|
process.exit(0);
|
|
566
571
|
}
|
|
572
|
+
const selection = rawSelection;
|
|
573
|
+
selectedSkills = selection.includes(SELECT_ALL_SKILLS) ? skills : selection.filter((s) => s !== SELECT_ALL_SKILLS);
|
|
567
574
|
}
|
|
568
575
|
if (selectedSkills.length === 0) {
|
|
569
576
|
p.cancel("No skills selected");
|
|
@@ -592,21 +599,27 @@ async function runSkillSync(args = []) {
|
|
|
592
599
|
agentsToLink = filteredAgents;
|
|
593
600
|
p.log.info(`Selected all ${filteredAgents.length} available agents`);
|
|
594
601
|
} else {
|
|
595
|
-
const
|
|
602
|
+
const SELECT_ALL_AGENTS = Symbol("select-all-agents");
|
|
603
|
+
const agentChoices = [{
|
|
604
|
+
value: SELECT_ALL_AGENTS,
|
|
605
|
+
label: pc.bold("Select All"),
|
|
606
|
+
hint: `All ${filteredAgents.length} agents`
|
|
607
|
+
}, ...filteredAgents.map((a) => ({
|
|
596
608
|
value: a,
|
|
597
609
|
label: a.displayName,
|
|
598
610
|
hint: a.isInstalled ? `${a.skillsDir} ${pc.green("(installed)")}` : `${a.skillsDir} ${pc.yellow("(not detected)")}`
|
|
599
|
-
}));
|
|
600
|
-
const
|
|
611
|
+
}))];
|
|
612
|
+
const rawAgents = await p.multiselect({
|
|
601
613
|
message: "Select target agents",
|
|
602
614
|
options: agentChoices,
|
|
603
615
|
required: true
|
|
604
616
|
});
|
|
605
|
-
if (p.isCancel(
|
|
617
|
+
if (p.isCancel(rawAgents)) {
|
|
606
618
|
p.cancel("Cancelled");
|
|
607
619
|
process.exit(0);
|
|
608
620
|
}
|
|
609
|
-
|
|
621
|
+
const agentSelection = rawAgents;
|
|
622
|
+
agentsToLink = agentSelection.includes(SELECT_ALL_AGENTS) ? filteredAgents : agentSelection.filter((a) => a !== SELECT_ALL_AGENTS);
|
|
610
623
|
if (agentsToLink.length === 0) {
|
|
611
624
|
p.cancel("No agents selected");
|
|
612
625
|
process.exit(0);
|