skild 0.5.2 → 0.5.3
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/index.js +21 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
installRegistrySkill,
|
|
16
16
|
installSkill,
|
|
17
17
|
isValidAlias,
|
|
18
|
+
listSkills,
|
|
18
19
|
loadRegistryAuth,
|
|
19
20
|
materializeSourceToTemp,
|
|
20
21
|
resolveRegistryAlias,
|
|
@@ -354,7 +355,8 @@ async function promptSkillsInteractive(skills, options = {}) {
|
|
|
354
355
|
return selectedSkills;
|
|
355
356
|
}
|
|
356
357
|
async function promptPlatformsInteractive(options = {}) {
|
|
357
|
-
const
|
|
358
|
+
const platforms = options.platforms && options.platforms.length > 0 ? options.platforms : PLATFORMS;
|
|
359
|
+
const platformItems = platforms.map((p) => ({ platform: p }));
|
|
358
360
|
const selectedIndices = await interactiveTreeSelect(platformItems, {
|
|
359
361
|
title: "Select target platforms",
|
|
360
362
|
subtitle: "\u2191\u2193 navigate \u2022 Space toggle \u2022 Enter confirm",
|
|
@@ -367,7 +369,7 @@ async function promptPlatformsInteractive(options = {}) {
|
|
|
367
369
|
defaultAll: options.defaultAll !== false
|
|
368
370
|
});
|
|
369
371
|
if (!selectedIndices) return null;
|
|
370
|
-
const selected = selectedIndices.map((i) =>
|
|
372
|
+
const selected = selectedIndices.map((i) => platforms[i]);
|
|
371
373
|
const names = selected.map((p) => PLATFORM_DISPLAY[p] || p);
|
|
372
374
|
console.log(chalk2.green(`
|
|
373
375
|
\u2713 Installing to ${selected.length} platform${selected.length > 1 ? "s" : ""}: ${chalk2.cyan(names.join(", "))}
|
|
@@ -472,6 +474,13 @@ function printJson(value) {
|
|
|
472
474
|
process.stdout.write(`${JSON.stringify(value, null, 2)}
|
|
473
475
|
`);
|
|
474
476
|
}
|
|
477
|
+
function getInstalledPlatforms(scope) {
|
|
478
|
+
return PLATFORMS2.filter((platform) => listSkills({ platform, scope }).length > 0);
|
|
479
|
+
}
|
|
480
|
+
function getPlatformPromptList(scope) {
|
|
481
|
+
const installed = getInstalledPlatforms(scope);
|
|
482
|
+
return installed.length > 0 ? installed : [...PLATFORMS2];
|
|
483
|
+
}
|
|
475
484
|
function asDiscoveredSkills(discovered, toSuggestedSource, toMaterializedDir) {
|
|
476
485
|
return discovered.map((d) => ({
|
|
477
486
|
relPath: d.relPath,
|
|
@@ -631,7 +640,10 @@ async function promptSelections(ctx) {
|
|
|
631
640
|
if (isSingleSkill) {
|
|
632
641
|
if (ctx.needsPlatformPrompt) {
|
|
633
642
|
if (ctx.spinner) ctx.spinner.stop();
|
|
634
|
-
const selectedPlatforms = await promptPlatformsInteractive({
|
|
643
|
+
const selectedPlatforms = await promptPlatformsInteractive({
|
|
644
|
+
defaultAll: true,
|
|
645
|
+
platforms: getPlatformPromptList(ctx.scope)
|
|
646
|
+
});
|
|
635
647
|
if (!selectedPlatforms) {
|
|
636
648
|
console.log(chalk3.red("No platforms selected."));
|
|
637
649
|
process.exitCode = 1;
|
|
@@ -693,7 +705,10 @@ async function promptSelections(ctx) {
|
|
|
693
705
|
}
|
|
694
706
|
ctx.selectedSkills = selected;
|
|
695
707
|
if (ctx.needsPlatformPrompt) {
|
|
696
|
-
const selectedPlatforms = await promptPlatformsInteractive({
|
|
708
|
+
const selectedPlatforms = await promptPlatformsInteractive({
|
|
709
|
+
defaultAll: true,
|
|
710
|
+
platforms: getPlatformPromptList(ctx.scope)
|
|
711
|
+
});
|
|
697
712
|
if (!selectedPlatforms) {
|
|
698
713
|
console.log(chalk3.red("No platforms selected."));
|
|
699
714
|
process.exitCode = 1;
|
|
@@ -920,7 +935,7 @@ async function reportDownload(record, registryOverride) {
|
|
|
920
935
|
|
|
921
936
|
// src/commands/list.ts
|
|
922
937
|
import chalk4 from "chalk";
|
|
923
|
-
import { PLATFORMS as PLATFORMS3, listAllSkills, listSkills } from "@skild/core";
|
|
938
|
+
import { PLATFORMS as PLATFORMS3, listAllSkills, listSkills as listSkills2 } from "@skild/core";
|
|
924
939
|
function isSkillset(skill) {
|
|
925
940
|
return Boolean(skill.record?.skillset || skill.record?.skill?.frontmatter?.skillset);
|
|
926
941
|
}
|
|
@@ -1019,7 +1034,7 @@ async function list(options = {}) {
|
|
|
1019
1034
|
const verbose = Boolean(options.verbose);
|
|
1020
1035
|
const platform = options.target;
|
|
1021
1036
|
if (platform) {
|
|
1022
|
-
const skills =
|
|
1037
|
+
const skills = listSkills2({ platform, scope });
|
|
1023
1038
|
if (options.json) {
|
|
1024
1039
|
console.log(JSON.stringify(skills, null, 2));
|
|
1025
1040
|
return;
|