vskill 1.2.9 → 1.2.11

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 (104) hide show
  1. package/README.md +27 -1
  2. package/agents.json +1 -1
  3. package/dist/api/client.d.ts +11 -1
  4. package/dist/api/client.js +4 -2
  5. package/dist/api/client.js.map +1 -1
  6. package/dist/commands/__tests__/helpers/fake-network.d.ts +36 -0
  7. package/dist/commands/__tests__/helpers/fake-network.js +119 -0
  8. package/dist/commands/__tests__/helpers/fake-network.js.map +1 -0
  9. package/dist/commands/add-lockfile.d.ts +2 -0
  10. package/dist/commands/add-lockfile.js +1 -1
  11. package/dist/commands/add-lockfile.js.map +1 -1
  12. package/dist/commands/add.d.ts +4 -0
  13. package/dist/commands/add.js +130 -102
  14. package/dist/commands/add.js.map +1 -1
  15. package/dist/commands/doctor.js +8 -4
  16. package/dist/commands/doctor.js.map +1 -1
  17. package/dist/commands/outdated.js +52 -3
  18. package/dist/commands/outdated.js.map +1 -1
  19. package/dist/commands/pin.d.ts +6 -0
  20. package/dist/commands/pin.js +25 -2
  21. package/dist/commands/pin.js.map +1 -1
  22. package/dist/commands/submit.d.ts +7 -0
  23. package/dist/commands/submit.js +40 -6
  24. package/dist/commands/submit.js.map +1 -1
  25. package/dist/commands/update.js +12 -2
  26. package/dist/commands/update.js.map +1 -1
  27. package/dist/discovery/github-tree.d.ts +16 -0
  28. package/dist/discovery/github-tree.js +58 -49
  29. package/dist/discovery/github-tree.js.map +1 -1
  30. package/dist/eval-server/install-skill-routes.js +7 -6
  31. package/dist/eval-server/install-skill-routes.js.map +1 -1
  32. package/dist/eval-server/install-state-routes.d.ts +2 -2
  33. package/dist/eval-server/install-state-routes.js +4 -1
  34. package/dist/eval-server/install-state-routes.js.map +1 -1
  35. package/dist/eval-server/remove-skill-routes.js +9 -1
  36. package/dist/eval-server/remove-skill-routes.js.map +1 -1
  37. package/dist/eval-server/supported-agents-routes.d.ts +8 -2
  38. package/dist/eval-server/supported-agents-routes.js +10 -2
  39. package/dist/eval-server/supported-agents-routes.js.map +1 -1
  40. package/dist/eval-ui/assets/{AdvancedTab-6VlfqCuD.js → AdvancedTab-DX3v5Q7O.js} +1 -1
  41. package/dist/eval-ui/assets/{CreateSkillPage-e3YH0sBH.js → CreateSkillPage-H8PKqquP.js} +1 -1
  42. package/dist/eval-ui/assets/{FindSkillsPalette-M6Ot4Qeq.js → FindSkillsPalette-BqNFXzS6.js} +2 -2
  43. package/dist/eval-ui/assets/{GeneralTab-BpFlJ2ue.js → GeneralTab-BfFbcbuP.js} +1 -1
  44. package/dist/eval-ui/assets/{PrivacyTab-UfO7QLy_.js → PrivacyTab-Bq2N7Iam.js} +1 -1
  45. package/dist/eval-ui/assets/{SearchPaletteCore-CufFV6OR.js → SearchPaletteCore-DCd9aZnv.js} +1 -1
  46. package/dist/eval-ui/assets/SkillDetailPanel-C5wytaSH.js +1 -0
  47. package/dist/eval-ui/assets/{UpdateDropdown-CVM2xW6V.js → UpdateDropdown-BYJ29wcH.js} +1 -1
  48. package/dist/eval-ui/assets/{UpdatesTab-C38-n7V3.js → UpdatesTab-w6h18GPp.js} +1 -1
  49. package/dist/eval-ui/assets/core-DgHXlyD_.js +1 -0
  50. package/dist/eval-ui/assets/{event-QtOCMXAv.js → event-CABB5pUM.js} +1 -1
  51. package/dist/eval-ui/assets/{fonts-i7Lkz2zN.css → fonts-BZeyWEAn.css} +1 -1
  52. package/dist/eval-ui/assets/{index-DlQYQHDO.js → index-Bje294df.js} +1 -1
  53. package/dist/eval-ui/assets/{index-DDNzcrhv.js → index-D0lWXViJ.js} +1 -1
  54. package/dist/eval-ui/assets/{index-CUEYzTVL.js → index-DCV9_0X4.js} +1 -1
  55. package/dist/eval-ui/assets/main-DjTh6bpa.js +86 -0
  56. package/dist/eval-ui/assets/{preferences-BN-jNWS0.js → preferences-VTBvoXmM.js} +2 -2
  57. package/dist/eval-ui/assets/source-serif-4-cyrillic-ext-wght-normal-DHTKMUil.woff2 +0 -0
  58. package/dist/eval-ui/assets/source-serif-4-cyrillic-wght-normal-B1g8a0vD.woff2 +0 -0
  59. package/dist/eval-ui/assets/source-serif-4-greek-wght-normal-BpXpdlRW.woff2 +0 -0
  60. package/dist/eval-ui/assets/source-serif-4-latin-ext-wght-normal-BVZ5su8S.woff2 +0 -0
  61. package/dist/eval-ui/assets/source-serif-4-latin-wght-normal-DMe4EKeb.woff2 +0 -0
  62. package/dist/eval-ui/assets/source-serif-4-vietnamese-wght-normal-BsaNuasd.woff2 +0 -0
  63. package/dist/eval-ui/assets/{useDesktopBridge-Cm4zPght.js → useDesktopBridge-C8dT34x9.js} +2 -2
  64. package/dist/eval-ui/index.html +3 -3
  65. package/dist/eval-ui/lifecycle.html +2 -2
  66. package/dist/eval-ui/preferences.html +3 -3
  67. package/dist/index.js +27 -6
  68. package/dist/index.js.map +1 -1
  69. package/dist/installer/frontmatter.d.ts +14 -0
  70. package/dist/installer/frontmatter.js +21 -0
  71. package/dist/installer/frontmatter.js.map +1 -1
  72. package/dist/lib/install-resolution.d.ts +39 -0
  73. package/dist/lib/install-resolution.js +68 -0
  74. package/dist/lib/install-resolution.js.map +1 -0
  75. package/dist/lib/platform-security.d.ts +15 -0
  76. package/dist/lib/platform-security.js +62 -0
  77. package/dist/lib/platform-security.js.map +1 -0
  78. package/dist/lib/private-source.d.ts +8 -0
  79. package/dist/lib/private-source.js +16 -12
  80. package/dist/lib/private-source.js.map +1 -1
  81. package/dist/lib/registry-tier.d.ts +42 -0
  82. package/dist/lib/registry-tier.js +136 -0
  83. package/dist/lib/registry-tier.js.map +1 -0
  84. package/dist/lib/registry-version.d.ts +36 -0
  85. package/dist/lib/registry-version.js +104 -0
  86. package/dist/lib/registry-version.js.map +1 -0
  87. package/dist/marketplace/marketplace.js +4 -3
  88. package/dist/marketplace/marketplace.js.map +1 -1
  89. package/dist/studio/routes/index.js +1 -1
  90. package/dist/studio/routes/index.js.map +1 -1
  91. package/dist/updater/source-fetcher.d.ts +21 -0
  92. package/dist/updater/source-fetcher.js +52 -1
  93. package/dist/updater/source-fetcher.js.map +1 -1
  94. package/package.json +3 -3
  95. package/dist/eval-ui/assets/SkillDetailPanel-B7f3UPBT.js +0 -1
  96. package/dist/eval-ui/assets/core-DZjBCfjp.js +0 -1
  97. package/dist/eval-ui/assets/main-C30fpcFP.js +0 -86
  98. package/dist/eval-ui/assets/source-serif-4-cyrillic-ext-wght-normal-cHuGMAiY.woff2 +0 -0
  99. package/dist/eval-ui/assets/source-serif-4-cyrillic-wght-normal-DwHjdM4S.woff2 +0 -0
  100. package/dist/eval-ui/assets/source-serif-4-greek-wght-normal-ece1310W.woff2 +0 -0
  101. package/dist/eval-ui/assets/source-serif-4-latin-ext-wght-normal-CxNHBx-q.woff2 +0 -0
  102. package/dist/eval-ui/assets/source-serif-4-latin-wght-normal-D9elroTD.woff2 +0 -0
  103. package/dist/eval-ui/assets/source-serif-4-vietnamese-wght-normal-D-yuW59g.woff2 +0 -0
  104. /package/dist/eval-ui/assets/{lifecycle-n00yue6r.js → lifecycle-DC0khFSd.js} +0 -0
@@ -17,8 +17,10 @@ import { isBinary } from "../scanner/repo-scanner.js";
17
17
  import { getAvailablePlugins, getPluginSource, getPluginVersion, hasPlugin, discoverUnregisteredPlugins } from "../marketplace/index.js";
18
18
  import { checkInstallSafety, checkLocalInstallSafety } from "../blocklist/blocklist.js";
19
19
  import { getSkill, searchSkills } from "../api/client.js";
20
- import { checkPlatformSecurity } from "../security/index.js";
21
- import { discoverSkills, getDefaultBranch, getBranchHeadSha, checkRepoExists, warnRateLimitOnce } from "../discovery/github-tree.js";
20
+ import { platformSecurityGate } from "../lib/platform-security.js";
21
+ import { pickShortName, localPluginPath, installMethodLabel } from "../lib/install-resolution.js";
22
+ import { decideRegistryTier, decideRegistryTierForSkills, printTierDecision, readPluginDirSkills } from "../lib/registry-tier.js";
23
+ import { discoverSkills, getDefaultBranch, getBranchHeadSha, checkRepoExists, warnRateLimitOnce, wasGitHubRateLimited } from "../discovery/github-tree.js";
22
24
  import { githubFetch, privateRepoHint } from "../lib/github-fetch.js";
23
25
  import { isPrivateOrUnknownRepo, localDirGitHubRepo, parseGitHubRepoRef } from "../lib/private-source.js";
24
26
  import { parseGitHubSource } from "../utils/validation.js";
@@ -32,6 +34,7 @@ import { getMarketplaceName } from "../marketplace/index.js";
32
34
  import { rankSearchResults, formatSkillId, getTrustBadge, formatResultLine } from "../utils/skill-display.js";
33
35
  import { computeSha } from "../updater/source-fetcher.js";
34
36
  import { extractFrontmatterVersion } from "../utils/version.js";
37
+ import { splitVersionSuffix, resolveRegistryVersionOrExit } from "../lib/registry-version.js";
35
38
  // 0724 T-006: enable-after-install path. We delegate every enabledPlugins
36
39
  // mutation to the claude CLI (ADR 0724-01), and we honour the --no-enable
37
40
  // flag to skip it. Uninstall is imported for F-003 rollback of earlier
@@ -87,12 +90,15 @@ export async function detectMarketplaceRepo(owner, repo) {
87
90
  const contentsUrl = `https://api.github.com/repos/${owner}/${repo}/contents/.claude-plugin/marketplace.json`;
88
91
  const headers = { Accept: "application/vnd.github.v3+json", "User-Agent": "vskill-cli" };
89
92
  // Attempt 1: Contents API
93
+ let skipRetry = false;
90
94
  try {
91
95
  const res = await githubFetch(contentsUrl, { headers });
92
96
  if (res.status === 404)
93
97
  return { isMarketplace: false };
94
- if (res.status === 403)
98
+ if (res.status === 403 || res.status === 429)
95
99
  warnRateLimitOnce(res);
100
+ // 0932: a rate limit will not clear in 1s; go straight to raw.
101
+ skipRetry = wasGitHubRateLimited();
96
102
  if (res.ok) {
97
103
  const data = (await res.json());
98
104
  const content = await parseManifestFromContentsApi(data);
@@ -104,23 +110,24 @@ export async function detectMarketplaceRepo(owner, repo) {
104
110
  // network error — continue to retry
105
111
  }
106
112
  // Attempt 2: Retry Contents API after 1s delay
107
- try {
108
- await new Promise((r) => setTimeout(r, 1000));
109
- const res = await githubFetch(contentsUrl, { headers });
110
- if (res.status === 404)
111
- return { isMarketplace: false };
112
- if (res.status === 403)
113
- warnRateLimitOnce(res);
114
- if (res.ok) {
115
- const data = (await res.json());
116
- const content = await parseManifestFromContentsApi(data);
117
- if (content)
118
- return { isMarketplace: true, manifestContent: content };
113
+ if (!skipRetry)
114
+ try {
115
+ await new Promise((r) => setTimeout(r, 1000));
116
+ const res = await githubFetch(contentsUrl, { headers });
117
+ if (res.status === 404)
118
+ return { isMarketplace: false };
119
+ if (res.status === 403)
120
+ warnRateLimitOnce(res);
121
+ if (res.ok) {
122
+ const data = (await res.json());
123
+ const content = await parseManifestFromContentsApi(data);
124
+ if (content)
125
+ return { isMarketplace: true, manifestContent: content };
126
+ }
127
+ }
128
+ catch {
129
+ // network error — continue to raw fallback
119
130
  }
120
- }
121
- catch {
122
- // network error — continue to raw fallback
123
- }
124
131
  // Attempt 3: Raw fallback (bypasses API rate limits)
125
132
  try {
126
133
  const branch = await getDefaultBranch(owner, repo);
@@ -479,10 +486,11 @@ async function installMarketplaceRepo(owner, repo, manifestContent, opts, preSel
479
486
  if (!selections.symlink)
480
487
  opts.copy = true;
481
488
  // Combine all selected plugins (registered + unregistered) for skill file install
489
+ // 0932: a null source (object-typed, another repo) is skipped below.
482
490
  const allPluginsToInstall = [
483
491
  ...selectedPlugins.map((p) => ({
484
492
  name: p.name,
485
- source: getPluginSource(p.name, manifestContent || "") || "",
493
+ source: getPluginSource(p.name, manifestContent || ""),
486
494
  isUnregistered: false,
487
495
  })),
488
496
  ...selectedUnregistered.map((u) => ({
@@ -491,6 +499,8 @@ async function installMarketplaceRepo(owner, repo, manifestContent, opts, preSel
491
499
  isUnregistered: true,
492
500
  })),
493
501
  ];
502
+ // 0932: SKILL.md bodies per plugin, for the registry tier decision.
503
+ const pluginSkillContents = new Map();
494
504
  for (const plugin of allPluginsToInstall) {
495
505
  // 0826: a marketplace plugin whose `source` is `"./"` lives at the repo
496
506
  // root — the previous guard (`if (!pluginPath) … failed`) short-circuited
@@ -498,7 +508,14 @@ async function installMarketplaceRepo(owner, repo, manifestContent, opts, preSel
498
508
  // mean "repo root" instead of treating it as a hard failure. Build URL
499
509
  // segments with a leading-slash prefix only when there's a real path so
500
510
  // we don't emit `//` between the contents-API base and `skills`.
501
- const pluginPath = plugin.source.replace(/^\.\//, "").replace(/\/$/, "");
511
+ // 0932: an object `source` ({ source: "github", repo }) lives in another
512
+ // repo; skip it instead of crashing on `.replace`.
513
+ const pluginPath = localPluginPath(plugin.source);
514
+ if (pluginPath === null) {
515
+ console.log(dim(` Skipping ${bold(plugin.name)}: its source is not a folder of this repo.`));
516
+ results.push({ name: plugin.name, installed: false, method: "failed" });
517
+ continue;
518
+ }
502
519
  const pathSegment = pluginPath ? `/${pluginPath}` : "";
503
520
  const installSpin = spinner(`Installing skills: ${bold(plugin.name)}`);
504
521
  try {
@@ -528,6 +545,7 @@ async function installMarketplaceRepo(owner, repo, manifestContent, opts, preSel
528
545
  cleanStaleNesting(skillDir);
529
546
  }
530
547
  installedSkillNames.push(sd.name);
548
+ pluginSkillContents.set(plugin.name, [...(pluginSkillContents.get(plugin.name) ?? []), { name: sd.name, content }]);
531
549
  }
532
550
  }
533
551
  else {
@@ -544,6 +562,7 @@ async function installMarketplaceRepo(owner, repo, manifestContent, opts, preSel
544
562
  cleanStaleNesting(skillDir);
545
563
  }
546
564
  installedSkillNames.push(plugin.name);
565
+ pluginSkillContents.set(plugin.name, [{ name: plugin.name, content }]);
547
566
  }
548
567
  }
549
568
  installSpin.stop();
@@ -565,14 +584,17 @@ async function installMarketplaceRepo(owner, repo, manifestContent, opts, preSel
565
584
  }
566
585
  // Update lockfile
567
586
  const lockForWrite = ensureLockfile(lockDir);
587
+ const marketplacePrivate = await isPrivateOrUnknownRepo(owner, repo);
568
588
  for (const r of results) {
569
589
  if (r.installed) {
570
590
  const isUnregistered = r.method === "extraction-unregistered";
571
591
  const pluginVersion = isUnregistered ? "0.0.0" : (getPluginVersion(r.name, manifestContent) || "0.0.0");
592
+ const tierDecision = await decideRegistryTierForSkills(isUnregistered ? null : `${owner}/${repo}`, pluginSkillContents.get(r.name) ?? [], { privateRepo: marketplacePrivate });
593
+ printTierDecision(r.name, tierDecision);
572
594
  lockForWrite.skills[r.name] = {
573
595
  version: pluginVersion,
574
596
  sha: "",
575
- tier: isUnregistered ? "UNSCANNED" : "VERIFIED",
597
+ tier: tierDecision.tier,
576
598
  installedAt: new Date().toISOString(),
577
599
  source: `marketplace:${owner}/${repo}#${r.name}`,
578
600
  marketplace: marketplaceName || undefined,
@@ -1009,8 +1031,13 @@ async function fetchSkillContent(url) {
1009
1031
  if (!res.ok) {
1010
1032
  spin.stop();
1011
1033
  if (res.status === 404) {
1012
- console.error(red(`SKILL.md not found at ${url}\n`) +
1013
- dim("Make sure the repo exists and has a SKILL.md on the default branch." + privateRepoHint()));
1034
+ // 0932: after a rate limit the default branch was never read, so do
1035
+ // not suggest the repo is private; say which limit was hit.
1036
+ const hint = wasGitHubRateLimited()
1037
+ ? "\nThe GitHub API rate limit was hit, so vskill could not list the repo and guessed this path. " +
1038
+ "Set GITHUB_TOKEN or run `vskill auth login`, then retry."
1039
+ : "Make sure the repo exists and has a SKILL.md on the default branch." + privateRepoHint();
1040
+ console.error(red(`SKILL.md not found at ${url}\n`) + dim(hint.replace(/^\n/, "")));
1014
1041
  }
1015
1042
  else {
1016
1043
  console.error(red(`Failed to fetch: ${res.status} ${res.statusText}`));
@@ -1292,10 +1319,14 @@ async function installPluginDir(basePath, pluginName, opts, repoUrl) {
1292
1319
  const lockDir = lockfileRoot(opts);
1293
1320
  // Update lockfile
1294
1321
  const lock = ensureLockfile(lockDir);
1322
+ const tierDecision = await decideRegistryTierForSkills(publicRemote, readPluginDirSkills(pluginDir), {
1323
+ privateRepo: !publicRemote,
1324
+ });
1325
+ printTierDecision(pluginName, tierDecision);
1295
1326
  lock.skills[pluginName] = {
1296
1327
  version,
1297
1328
  sha,
1298
- tier: "VERIFIED",
1329
+ tier: tierDecision.tier,
1299
1330
  installedAt: new Date().toISOString(),
1300
1331
  // Absolute, so later commands resolve the same checkout from any folder.
1301
1332
  source: `local:${resolve(basePath)}`,
@@ -1381,26 +1412,10 @@ previousFiles) {
1381
1412
  catch {
1382
1413
  return { skillName, installed: false, verdict: "FETCH_FAILED" };
1383
1414
  }
1384
- // Platform security check (skipped for private repos, see installSingleSkillLegacy)
1415
+ // Platform security check on owner/repo/skill (skipped for private repos)
1385
1416
  const privateRepo = await isPrivateOrUnknownRepo(owner, repo);
1386
- const platformSecurity = privateRepo ? null : await checkPlatformSecurity(skillName);
1387
- if (privateRepo) {
1388
- console.log(dim(" Private repository: local security scan only."));
1389
- }
1390
- else if (!platformSecurity) {
1391
- console.log(yellow(" Platform security check unavailable -- proceeding with local scan only."));
1392
- }
1393
- if (platformSecurity && platformSecurity.hasCritical && !opts.force) {
1394
- const criticalProviders = platformSecurity.providers
1395
- .filter((p) => p.status === "FAIL" && p.criticalCount > 0)
1396
- .map((p) => p.provider);
1397
- console.log(red(` BLOCKED: External security scan found CRITICAL findings`));
1398
- if (criticalProviders.length > 0) {
1399
- console.log(dim(` Providers: ${criticalProviders.join(", ")}`));
1400
- }
1401
- if (platformSecurity.reportUrl) {
1402
- console.log(dim(` Report: https://verified-skill.com${platformSecurity.reportUrl}`));
1403
- }
1417
+ const gate = await platformSecurityGate({ owner, repo, skillName, privateRepo, force: !!opts.force });
1418
+ if (gate === "blocked") {
1404
1419
  return { skillName, installed: false, verdict: "SECURITY_FAIL" };
1405
1420
  }
1406
1421
  // Tier 1 scan
@@ -1477,7 +1492,12 @@ previousFiles) {
1477
1492
  return { skillName, installed: false, verdict: "WRITE_ERROR", score: scanResult.score };
1478
1493
  }
1479
1494
  const skillVersion = extractFrontmatterVersion(content) || "1.0.0";
1480
- return { skillName, installed: true, verdict: scanResult.verdict, score: scanResult.score, sha, version: skillVersion, sourceSkillPath, files: installedFiles };
1495
+ const tierDecision = await decideRegistryTier(`${owner}/${repo}/${skillName}`, content, { privateRepo });
1496
+ printTierDecision(skillName, tierDecision);
1497
+ return {
1498
+ skillName, installed: true, verdict: scanResult.verdict, score: scanResult.score, sha,
1499
+ version: skillVersion, sourceSkillPath, files: installedFiles, tier: tierDecision.tier,
1500
+ };
1481
1501
  }
1482
1502
  // ---------------------------------------------------------------------------
1483
1503
  // Bulk repo plugin installation: --repo with --all
@@ -1782,10 +1802,14 @@ async function installRepoPlugin(ownerRepo, pluginName, opts, overrideSource) {
1782
1802
  // Update lockfile (global → ~/.agents/, project → project root)
1783
1803
  const lockDir = lockfileRoot(opts);
1784
1804
  const lock = ensureLockfile(lockDir);
1805
+ const tierDecision = await decideRegistryTierForSkills(`${owner}/${repo}`, skills, {
1806
+ privateRepo: await isPrivateOrUnknownRepo(owner, repo),
1807
+ });
1808
+ printTierDecision(pluginName, tierDecision);
1785
1809
  lock.skills[pluginName] = {
1786
1810
  version: pluginVersion,
1787
1811
  sha,
1788
- tier: "VERIFIED",
1812
+ tier: tierDecision.tier,
1789
1813
  installedAt: new Date().toISOString(),
1790
1814
  source: `github:${owner}/${repo}#plugin:${pluginName}`,
1791
1815
  scope: opts.global ? "user" : "project",
@@ -1976,39 +2000,60 @@ async function addCommandInner(source, opts) {
1976
2000
  }
1977
2001
  source = `${parsed.owner}/${parsed.repo}`;
1978
2002
  }
2003
+ // 0932: `owner/repo/skill@1.2.3` (also accepted here when called directly).
2004
+ const versionSplit = splitVersionSuffix(source);
2005
+ if (versionSplit.version) {
2006
+ source = versionSplit.source;
2007
+ opts.version = versionSplit.version;
2008
+ }
2009
+ if (opts.version && source.split("/").length !== 3) {
2010
+ console.error(red("--version needs owner/repo/skill, or a hosted private skill with --tenant."));
2011
+ return process.exit(1);
2012
+ }
1979
2013
  // GitHub mode: owner/repo or owner/repo/skill
1980
2014
  const parts = source.split("/");
1981
2015
  // 3-part format: owner/repo/skill-name → check marketplace first, then legacy
1982
2016
  if (parts.length === 3) {
1983
2017
  const [threeOwner, threeRepo, threeSkill] = parts;
2018
+ // 0932: a pinned version installs the commit the registry scanned for it.
2019
+ let pinnedRef;
2020
+ if (opts.version) {
2021
+ const pinned = await resolveRegistryVersionOrExit(threeOwner, threeRepo, threeSkill, opts.version);
2022
+ pinnedRef = pinned.gitSha ?? undefined;
2023
+ opts._pinnedVersion = pinned.version;
2024
+ console.log(dim(`Resolved ${threeOwner}/${threeRepo}/${threeSkill}@${pinned.version} to commit ${pinnedRef?.slice(0, 12)}`));
2025
+ }
1984
2026
  const detection = await detectMarketplaceRepo(threeOwner, threeRepo);
1985
2027
  if (detection.isMarketplace && detection.manifestContent) {
1986
2028
  // Direct plugin name match (e.g. owner/repo/pluginName)
1987
- if (hasPlugin(threeSkill, detection.manifestContent)) {
2029
+ if (!pinnedRef && hasPlugin(threeSkill, detection.manifestContent)) {
1988
2030
  return installMarketplaceRepo(threeOwner, threeRepo, detection.manifestContent, opts, [threeSkill]);
1989
2031
  }
1990
2032
  // Skill-inside-plugin: search all plugins for a skill with this name
1991
- const branch = await getDefaultBranch(threeOwner, threeRepo);
2033
+ const branch = pinnedRef ?? (await getDefaultBranch(threeOwner, threeRepo));
1992
2034
  const mktPlugins = getAvailablePlugins(detection.manifestContent);
1993
2035
  for (const plugin of mktPlugins) {
1994
2036
  // "./" (repo root) normalizes to "" — no leading slash in the subpath.
1995
- const pluginPath = plugin.source.replace(/^\.\//, "").replace(/\/+$/, "");
2037
+ // 0932: an object source points at another repo: skip it.
2038
+ const pluginPath = localPluginPath(plugin.source);
2039
+ if (pluginPath === null)
2040
+ continue;
1996
2041
  const subpath = `${pluginPath ? `${pluginPath}/` : ""}skills/${threeSkill}/SKILL.md`;
1997
2042
  const probeUrl = `https://raw.githubusercontent.com/${threeOwner}/${threeRepo}/${branch}/${subpath}`;
1998
2043
  const probeRes = await githubFetch(probeUrl);
1999
2044
  if (probeRes.ok) {
2000
- return installSingleSkillLegacy(threeOwner, threeRepo, threeSkill, opts, subpath, plugin.name);
2045
+ return installSingleSkillLegacy(threeOwner, threeRepo, threeSkill, opts, subpath, plugin.name, pinnedRef);
2001
2046
  }
2002
2047
  }
2003
2048
  }
2004
2049
  // Try discovery to find actual skill path before falling back to hardcoded pattern
2005
- const discovered = await discoverSkills(threeOwner, threeRepo);
2050
+ const discovered = await discoverSkills(threeOwner, threeRepo, { ref: pinnedRef, descriptions: false });
2006
2051
  const discoveredMatch = discovered.find(s => s.name === threeSkill);
2007
2052
  if (discoveredMatch) {
2008
- return installSingleSkillLegacy(threeOwner, threeRepo, threeSkill, opts, discoveredMatch.path);
2053
+ return installSingleSkillLegacy(threeOwner, threeRepo, threeSkill, opts, discoveredMatch.path, undefined, pinnedRef);
2009
2054
  }
2010
2055
  // Fallback: discovery didn't find the skill — try hardcoded skills/{name}/SKILL.md
2011
- return installSingleSkillLegacy(threeOwner, threeRepo, threeSkill, opts);
2056
+ return installSingleSkillLegacy(threeOwner, threeRepo, threeSkill, opts, undefined, undefined, pinnedRef);
2012
2057
  }
2013
2058
  if (parts.length !== 2) {
2014
2059
  // No slash → search registry and disambiguate
@@ -2128,6 +2173,7 @@ async function addCommandInner(source, opts) {
2128
2173
  pluginName: pluginNameFromSkillPath(r.sourceSkillPath),
2129
2174
  global: !!opts.global,
2130
2175
  files: r.files,
2176
+ tier: r.tier ?? "UNSCANNED",
2131
2177
  });
2132
2178
  }
2133
2179
  }
@@ -2249,29 +2295,28 @@ async function resolveViaSearch(flatName, opts) {
2249
2295
  process.exit(1);
2250
2296
  return;
2251
2297
  }
2252
- // Single installable result — auto-install
2253
- if (installable.length === 1) {
2254
- const r = installable[0];
2255
- const fullPath = `${r.ownerSlug}/${r.repoSlug}/${r.skillSlug}`;
2256
- console.log(dim(`Found: ${formatSkillId(r)}`));
2257
- return addCommand(fullPath, opts);
2258
- }
2259
- // Multiple installable results — check --yes flag first
2260
- if (opts.yes) {
2261
- const r = installable[0];
2262
- const fullPath = `${r.ownerSlug}/${r.repoSlug}/${r.skillSlug}`;
2263
- console.log(dim(`Auto-selecting first result: ${formatSkillId(r)}`));
2264
- return addCommand(fullPath, opts);
2265
- }
2266
- // Multiple results — display them
2298
+ // 0932: auto-install only an exact skill-slug match (unique); a fuzzy hit
2299
+ // (sw-do -> inbox-sweep) is never installed without the user choosing it.
2300
+ const pick = pickShortName(installable, flatName, opts);
2301
+ if (pick.kind === "pick") {
2302
+ const r = pick.result;
2303
+ console.log(dim(`${opts.yes ? "Auto-selecting exact match" : "Found"}: ${formatSkillId(r)}`));
2304
+ return addCommand(`${r.ownerSlug}/${r.repoSlug}/${r.skillSlug}`, opts);
2305
+ }
2306
+ // Several (or only fuzzy) matches — display them
2267
2307
  console.log(bold(`\nMultiple skills match "${flatName}":\n`));
2268
2308
  for (const r of ranked) {
2269
2309
  console.log(formatResultLine(r));
2270
2310
  console.log();
2271
2311
  }
2272
- // Non-TTY: print list and exit
2273
- if (!isTTY()) {
2274
- console.error(red("Ambiguous match. ") +
2312
+ // --yes or non-TTY: list the candidates and exit
2313
+ if (opts.yes || !isTTY()) {
2314
+ const exactNote = pick.candidates.length > 0 && pick.candidates.every((r) => r.skillSlug?.toLowerCase() === flatName.toLowerCase())
2315
+ ? `Several repos publish "${flatName}". `
2316
+ : `No skill is named exactly "${flatName}". `;
2317
+ console.error(red("Ambiguous match. ") + dim(exactNote) + "\n" +
2318
+ dim("Candidates:\n") +
2319
+ pick.candidates.map((r) => ` ${r.ownerSlug}/${r.repoSlug}/${r.skillSlug}`).join("\n") + "\n" +
2275
2320
  dim(`Specify the exact skill: ${cyan(`vskill install owner/repo/skill`)}`));
2276
2321
  process.exit(1);
2277
2322
  return;
@@ -2521,10 +2566,12 @@ async function installFromRegistry(skillName, opts) {
2521
2566
  const lockDir = lockfileRoot(opts);
2522
2567
  const lock = ensureLockfile(lockDir);
2523
2568
  const registryVersion = detail.version || extractFrontmatterVersion(content) || "1.0.0";
2569
+ const tierDecision = await decideRegistryTier(skillName, content);
2570
+ printTierDecision(skillName, tierDecision);
2524
2571
  lock.skills[skillName] = {
2525
2572
  version: registryVersion,
2526
2573
  sha,
2527
- tier: "VERIFIED",
2574
+ tier: tierDecision.tier,
2528
2575
  installedAt: new Date().toISOString(),
2529
2576
  source: `registry:${skillName}`,
2530
2577
  scope: opts.global ? "user" : "project",
@@ -2582,7 +2629,8 @@ async function installSingleSkillLegacy(owner, repo, skill, opts, skillSubpathOv
2582
2629
  return process.exit(1);
2583
2630
  }
2584
2631
  const branch = refOverride || (await getDefaultBranch(owner, repo));
2585
- const sourceCommitSha = await getBranchHeadSha(owner, repo, branch);
2632
+ // 0932: a full commit sha (a pinned registry version) needs no lookup.
2633
+ const sourceCommitSha = /^[0-9a-f]{40}$/i.test(branch) ? branch : await getBranchHeadSha(owner, repo, branch);
2586
2634
  // 0894: SKILL.md, the bundle and the lockfile all read this one commit.
2587
2635
  const contentRef = sourceCommitSha || branch;
2588
2636
  // Candidate subpaths: explicit override wins; otherwise try the conventional
@@ -2617,34 +2665,9 @@ async function installSingleSkillLegacy(owner, repo, skill, opts, skillSubpathOv
2617
2665
  // Skipped for private repos: the registry looks skills up by name, so it
2618
2666
  // would leak the name and could match an unrelated public skill.
2619
2667
  const privateRepo = await isPrivateOrUnknownRepo(owner, repo);
2620
- const platformSecurity = privateRepo ? null : await checkPlatformSecurity(skillName);
2621
- if (privateRepo) {
2622
- console.log(dim(" Private repository: local security scan only."));
2623
- }
2624
- else if (!platformSecurity) {
2625
- console.log(yellow(" Platform security check unavailable -- proceeding with local scan only."));
2626
- }
2627
- if (platformSecurity && platformSecurity.hasCritical && !opts.force) {
2628
- const criticalProviders = platformSecurity.providers
2629
- .filter((p) => p.status === "FAIL" && p.criticalCount > 0)
2630
- .map((p) => p.provider);
2631
- console.error(red("\n BLOCKED: External security scan found CRITICAL findings"));
2632
- console.error(red(` Providers: ${criticalProviders.join(", ")}`));
2633
- console.error(red(` Report: https://verified-skill.com${platformSecurity.reportUrl}`));
2634
- console.error(dim("\n Use --force to override (NOT recommended)"));
2668
+ const gate = await platformSecurityGate({ owner, repo, skillName, privateRepo, force: !!opts.force });
2669
+ if (gate === "blocked")
2635
2670
  return process.exit(1);
2636
- }
2637
- if (platformSecurity && platformSecurity.hasCritical && opts.force) {
2638
- console.error(yellow("\n WARNING: External scans found CRITICAL findings"));
2639
- const criticalProviders = platformSecurity.providers
2640
- .filter((p) => p.status === "FAIL" && p.criticalCount > 0)
2641
- .map((p) => p.provider);
2642
- console.error(yellow(` Providers: ${criticalProviders.join(", ")}`));
2643
- console.error(yellow(" --force: proceeding despite CRITICAL findings\n"));
2644
- }
2645
- if (platformSecurity && platformSecurity.overallVerdict === "PENDING") {
2646
- console.log(dim("\n External scans are pending. Proceeding with install.\n"));
2647
- }
2648
2671
  // Run tier1 scan
2649
2672
  console.log(dim("\nRunning security scan..."));
2650
2673
  const scanResult = runTier1Scan(content);
@@ -2751,7 +2774,9 @@ async function installSingleSkillLegacy(owner, repo, skill, opts, skillSubpathOv
2751
2774
  // (no more 404s on `/blob/HEAD/SKILL.md` for nested-layout repos).
2752
2775
  const lockDir = lockfileRoot(opts);
2753
2776
  const lock = ensureLockfile(lockDir);
2754
- const ghVersion = extractFrontmatterVersion(content) || "1.0.0";
2777
+ const ghVersion = opts._pinnedVersion || extractFrontmatterVersion(content) || "1.0.0";
2778
+ const tierDecision = await decideRegistryTier(`${owner}/${repo}/${skillName}`, content, { privateRepo });
2779
+ printTierDecision(skillName, tierDecision);
2755
2780
  lock.skills[skillName] = buildGitHubInstallLockEntry({
2756
2781
  version: ghVersion,
2757
2782
  sha,
@@ -2763,7 +2788,10 @@ async function installSingleSkillLegacy(owner, repo, skill, opts, skillSubpathOv
2763
2788
  pluginName: pluginNamespace ?? pluginNameFromSkillPath(skillSubpath),
2764
2789
  global: !!opts.global,
2765
2790
  files: bundle.fileList,
2791
+ tier: tierDecision.tier,
2766
2792
  });
2793
+ if (opts._pinnedVersion)
2794
+ lock.skills[skillName].pinnedVersion = opts._pinnedVersion;
2767
2795
  lock.agents = [...new Set([...(lock.agents || []), ...selectedAgents.map((a) => a.id)])];
2768
2796
  writeLockfile(lock, lockDir);
2769
2797
  // Phone home (awaited to prevent process exit race) — public repos only.
@@ -2771,7 +2799,7 @@ async function installSingleSkillLegacy(owner, repo, skill, opts, skillSubpathOv
2771
2799
  await reportInstall(skillName, `${owner}/${repo}`).catch(() => { });
2772
2800
  }
2773
2801
  // Print summary
2774
- const method = opts.copy ? "copied" : "symlinked";
2802
+ const method = installMethodLabel(locations, !!opts.copy);
2775
2803
  console.log(green(`\nInstalled ${bold(skillName)} (${method}) to ${locations.length} agent${locations.length === 1 ? "" : "s"}:\n`));
2776
2804
  for (const loc of locations) {
2777
2805
  console.log(` ${dim(">")} ${loc}`);