skild 0.10.19 → 0.10.21

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 (2) hide show
  1. package/dist/index.js +38 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -332,17 +332,22 @@ async function promptSkillsTreeInteractive(skills, tree, options = {}) {
332
332
  async function promptPlatformsInteractive(options = {}) {
333
333
  const platforms = options.platforms && options.platforms.length > 0 ? options.platforms : PLATFORMS;
334
334
  const platformItems = platforms.map((p) => ({ platform: p }));
335
+ const installedSet = new Set(options.installedPlatforms ?? []);
336
+ const defaultSelected = installedSet.size > 0 ? new Set(platforms.flatMap((p, idx) => installedSet.has(p) ? [idx] : [])) : void 0;
335
337
  const selectedIndices = await interactiveTreeSelect(platformItems, {
336
338
  title: "Select target platforms",
337
339
  subtitle: "\u2191\u2193 navigate \u2022 Space toggle \u2022 Enter confirm",
338
340
  buildTree: buildPlatformTree,
339
341
  formatNode: (node, selection, isCursor, maxWidth) => {
340
342
  const displayName = node.name === "All Platforms" ? node.name : PLATFORM_DISPLAY[node.name] || node.name;
343
+ const installedSuffix = node.name !== "All Platforms" && installedSet.has(node.name) ? " [installed]" : "";
341
344
  return formatTreeNode({ ...node, name: displayName }, selection, isCursor, maxWidth, {
345
+ suffixText: installedSuffix,
342
346
  hintText: buildSpaceHint(node, selection)
343
347
  });
344
348
  },
345
- defaultAll: options.defaultAll !== false
349
+ defaultAll: options.defaultAll !== false,
350
+ defaultSelected
346
351
  });
347
352
  if (!selectedIndices) return null;
348
353
  const selected = selectedIndices.map((i) => platforms[i]);
@@ -1098,8 +1103,8 @@ function getInstalledPlatforms(scope) {
1098
1103
  return PLATFORMS2.filter((platform) => listSkills({ platform, scope }).length > 0);
1099
1104
  }
1100
1105
  function getPlatformPromptList(scope) {
1101
- const installed = getInstalledPlatforms(scope);
1102
- return installed.length > 0 ? installed : [...PLATFORMS2];
1106
+ void scope;
1107
+ return [...PLATFORMS2];
1103
1108
  }
1104
1109
  function normalizeSkillSelector(input) {
1105
1110
  const trimmed = input.trim();
@@ -1364,9 +1369,11 @@ async function promptSelections(ctx) {
1364
1369
  if (ctx.isSingleSkill) {
1365
1370
  if (ctx.needsPlatformPrompt) {
1366
1371
  if (ctx.spinner) ctx.spinner.stop();
1372
+ const installedPlatforms = getInstalledPlatforms(ctx.scope);
1367
1373
  const selectedPlatforms = await promptPlatformsInteractive({
1368
- defaultAll: true,
1369
- platforms: getPlatformPromptList(ctx.scope)
1374
+ defaultAll: installedPlatforms.length === 0,
1375
+ platforms: getPlatformPromptList(ctx.scope),
1376
+ installedPlatforms
1370
1377
  });
1371
1378
  if (!selectedPlatforms) {
1372
1379
  console.log(chalk3.red("No platforms selected."));
@@ -1431,9 +1438,11 @@ async function promptSelections(ctx) {
1431
1438
  }
1432
1439
  ctx.selectedSkills = selected;
1433
1440
  if (ctx.needsPlatformPrompt) {
1441
+ const installedPlatforms = getInstalledPlatforms(ctx.scope);
1434
1442
  const selectedPlatforms = await promptPlatformsInteractive({
1435
- defaultAll: true,
1436
- platforms: getPlatformPromptList(ctx.scope)
1443
+ defaultAll: installedPlatforms.length === 0,
1444
+ platforms: getPlatformPromptList(ctx.scope),
1445
+ installedPlatforms
1437
1446
  });
1438
1447
  if (!selectedPlatforms) {
1439
1448
  console.log(chalk3.red("No platforms selected."));
@@ -1519,6 +1528,7 @@ function reportResults(ctx) {
1519
1528
  return;
1520
1529
  }
1521
1530
  const platformsLabel = targets.length === PLATFORMS2.length ? "all platforms" : targets.length === 1 ? targets[0] : `${targets.length} platforms`;
1531
+ const isMultiTarget = targets.length > 1;
1522
1532
  if (errors.length === 0 && (results.length > 0 || skipped.length > 0)) {
1523
1533
  const displayName = results[0]?.canonicalName || results[0]?.name || ctx.source;
1524
1534
  const skillCount = selectedSkills?.length ?? results.length;
@@ -1533,7 +1543,7 @@ function reportResults(ctx) {
1533
1543
  );
1534
1544
  } else {
1535
1545
  spinner?.succeed(
1536
- isMultiSkill ? `Installed ${chalk3.green(skillCount)} skill${skillCount > 1 ? "s" : ""} \u2192 ${chalk3.dim(platformsLabel)}` : `Installed ${chalk3.green(displayName)} \u2192 ${chalk3.dim(results[0]?.installDir || platformsLabel)}`
1546
+ isMultiSkill ? `Installed ${chalk3.green(skillCount)} skill${skillCount > 1 ? "s" : ""} \u2192 ${chalk3.dim(platformsLabel)}` : isMultiTarget ? `Installed ${chalk3.green(displayName)} \u2192 ${chalk3.dim(platformsLabel)}` : `Installed ${chalk3.green(displayName)} \u2192 ${chalk3.dim(results[0]?.installDir || platformsLabel)}`
1537
1547
  );
1538
1548
  }
1539
1549
  } else if (errors.length > 0) {
@@ -1566,6 +1576,15 @@ function reportResults(ctx) {
1566
1576
  }
1567
1577
  console.log(chalk3.dim(` ... and ${uniqueSkillNames.length - 8} more`));
1568
1578
  }
1579
+ } else if (!isMultiSkill && isMultiTarget && results.length > 0) {
1580
+ console.log();
1581
+ const byPlatform = /* @__PURE__ */ new Map();
1582
+ for (const r of results) byPlatform.set(r.platform, r);
1583
+ for (const platform of targets) {
1584
+ const record = byPlatform.get(platform);
1585
+ if (!record) continue;
1586
+ console.log(` ${chalk3.green("\u2713")} ${chalk3.cyan(platform)} \u2192 ${chalk3.dim(record.installDir)}`);
1587
+ }
1569
1588
  } else if (!isMultiSkill && targets.length === 1 && results[0]) {
1570
1589
  const record = results[0];
1571
1590
  if (!record.hasSkillMd) {
@@ -1597,11 +1616,17 @@ function reportResults(ctx) {
1597
1616
  platforms.push(s.platform);
1598
1617
  bySkill.set(s.skillName, platforms);
1599
1618
  }
1600
- for (const [skillName] of [...bySkill.entries()].slice(0, 5)) {
1601
- console.log(chalk3.dim(` \u2022 ${skillName}`));
1602
- }
1603
- if (bySkill.size > 5) {
1604
- console.log(chalk3.dim(` ... and ${bySkill.size - 5} more`));
1619
+ const onlySkill = bySkill.size === 1 ? [...bySkill.entries()][0] : null;
1620
+ if (onlySkill && isMultiTarget) {
1621
+ const [skillName, platforms] = onlySkill;
1622
+ console.log(chalk3.dim(` \u2022 ${skillName} \u2192 ${platforms.join(", ")}`));
1623
+ } else {
1624
+ for (const [skillName] of [...bySkill.entries()].slice(0, 5)) {
1625
+ console.log(chalk3.dim(` \u2022 ${skillName}`));
1626
+ }
1627
+ if (bySkill.size > 5) {
1628
+ console.log(chalk3.dim(` ... and ${bySkill.size - 5} more`));
1629
+ }
1605
1630
  }
1606
1631
  console.log(chalk3.dim(`
1607
1632
  \u{1F4A1} Reinstall with: ${chalk3.cyan(`skild install ${ctx.source} --force`)}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skild",
3
- "version": "0.10.19",
3
+ "version": "0.10.21",
4
4
  "description": "The npm for Agent Skills — Discover, install, manage, and publish AI Agent Skills with ease.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",