oh-skillhub 0.1.21 → 0.1.23
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/package.json +1 -1
- package/src/cli.js +21 -3
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -379,12 +379,13 @@ async function runInteractiveInstallerFromAnswers(answers, output = process.stdo
|
|
|
379
379
|
const manifest = await loadRuntimeManifest({ env: process.env });
|
|
380
380
|
const choices = buildRepositoryChoices(manifest);
|
|
381
381
|
const [agentAnswer, groupAnswer] = answers.length > 1 ? [answers[0], answers.slice(1).join(" ")] : ["", answers[0] || ""];
|
|
382
|
+
const defaultGroup = defaultGroupNumber(choices);
|
|
382
383
|
output.write(renderAgentMenu());
|
|
383
384
|
output.write("Select target [1]: \n");
|
|
384
385
|
const agent = parseAgentSelection(agentAnswer);
|
|
385
386
|
output.write(renderTuiMenu(choices, agent));
|
|
386
|
-
output.write(
|
|
387
|
-
const selectedIndexes = parseSelection(groupAnswer, choices.length,
|
|
387
|
+
output.write(`Select groups [${defaultGroup}]: \n`);
|
|
388
|
+
const selectedIndexes = parseSelection(groupAnswer, choices.length, defaultGroup);
|
|
388
389
|
await installInteractiveSelection(manifest, choices, agent, selectedIndexes, output);
|
|
389
390
|
}
|
|
390
391
|
|
|
@@ -457,6 +458,15 @@ function splitPromptAnswers(text) {
|
|
|
457
458
|
|
|
458
459
|
function buildRepositoryChoices(manifest) {
|
|
459
460
|
const choices = [];
|
|
461
|
+
const commonSkills = manifest.skills.filter((skill) => skill.scope === "common");
|
|
462
|
+
choices.push({
|
|
463
|
+
scope: "common",
|
|
464
|
+
stage: "all",
|
|
465
|
+
path: "common / all",
|
|
466
|
+
count: commonSkills.length,
|
|
467
|
+
skills: commonSkills,
|
|
468
|
+
allCommon: true,
|
|
469
|
+
});
|
|
460
470
|
for (const stage of COMMON_STAGES) {
|
|
461
471
|
const skills = manifest.skills.filter((skill) => skill.scope === "common" && skill.stage === stage);
|
|
462
472
|
choices.push({ scope: "common", stage, path: `common / ${stage}`, count: skills.length, skills });
|
|
@@ -483,7 +493,7 @@ function renderTuiMenu(choices, agent = "codex") {
|
|
|
483
493
|
"",
|
|
484
494
|
"Choose skill groups",
|
|
485
495
|
" Interactive TTY: Up/Down or j/k to move, Space to toggle, Enter to install",
|
|
486
|
-
" Piped input: enter numbers separated by spaces, e.g.
|
|
496
|
+
" Piped input: enter numbers separated by spaces, e.g. 1 for all common",
|
|
487
497
|
"",
|
|
488
498
|
];
|
|
489
499
|
choices.forEach((choice, index) => {
|
|
@@ -1006,6 +1016,11 @@ function isSingleSelection(answer, max) {
|
|
|
1006
1016
|
}
|
|
1007
1017
|
}
|
|
1008
1018
|
|
|
1019
|
+
function defaultGroupNumber(choices) {
|
|
1020
|
+
const arkuiIndex = choices.findIndex((choice) => choice.scope === "domain" && choice.domain === "arkui");
|
|
1021
|
+
return arkuiIndex >= 0 ? arkuiIndex + 1 : 1;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1009
1024
|
function normalizeAgentIndexes(selected) {
|
|
1010
1025
|
const indexes = selected instanceof Set ? Array.from(selected) : [selected];
|
|
1011
1026
|
if (indexes.includes(ALL_AGENT_INDEX)) {
|
|
@@ -1066,6 +1081,9 @@ function selectSkillsForChoices(manifest, choices) {
|
|
|
1066
1081
|
const selected = new Map();
|
|
1067
1082
|
for (const choice of choices) {
|
|
1068
1083
|
for (const skill of manifest.skills) {
|
|
1084
|
+
if (choice.allCommon && skill.scope === "common") {
|
|
1085
|
+
selected.set(skill.name, skill);
|
|
1086
|
+
}
|
|
1069
1087
|
if (choice.scope === "common" && skill.scope === "common" && skill.stage === choice.stage) {
|
|
1070
1088
|
selected.set(skill.name, skill);
|
|
1071
1089
|
}
|