vskill 1.2.9 → 1.2.10
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/README.md +27 -1
- package/agents.json +1 -1
- package/dist/api/client.d.ts +11 -1
- package/dist/api/client.js +4 -2
- package/dist/api/client.js.map +1 -1
- package/dist/commands/__tests__/helpers/fake-network.d.ts +36 -0
- package/dist/commands/__tests__/helpers/fake-network.js +119 -0
- package/dist/commands/__tests__/helpers/fake-network.js.map +1 -0
- package/dist/commands/add-lockfile.d.ts +2 -0
- package/dist/commands/add-lockfile.js +1 -1
- package/dist/commands/add-lockfile.js.map +1 -1
- package/dist/commands/add.d.ts +4 -0
- package/dist/commands/add.js +130 -102
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/doctor.js +8 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/outdated.js +52 -3
- package/dist/commands/outdated.js.map +1 -1
- package/dist/commands/pin.d.ts +6 -0
- package/dist/commands/pin.js +25 -2
- package/dist/commands/pin.js.map +1 -1
- package/dist/commands/submit.d.ts +5 -0
- package/dist/commands/submit.js +36 -6
- package/dist/commands/submit.js.map +1 -1
- package/dist/commands/update.js +12 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/discovery/github-tree.d.ts +16 -0
- package/dist/discovery/github-tree.js +58 -49
- package/dist/discovery/github-tree.js.map +1 -1
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/installer/frontmatter.d.ts +14 -0
- package/dist/installer/frontmatter.js +21 -0
- package/dist/installer/frontmatter.js.map +1 -1
- package/dist/lib/install-resolution.d.ts +39 -0
- package/dist/lib/install-resolution.js +68 -0
- package/dist/lib/install-resolution.js.map +1 -0
- package/dist/lib/platform-security.d.ts +15 -0
- package/dist/lib/platform-security.js +62 -0
- package/dist/lib/platform-security.js.map +1 -0
- package/dist/lib/private-source.d.ts +8 -0
- package/dist/lib/private-source.js +16 -12
- package/dist/lib/private-source.js.map +1 -1
- package/dist/lib/registry-tier.d.ts +42 -0
- package/dist/lib/registry-tier.js +136 -0
- package/dist/lib/registry-tier.js.map +1 -0
- package/dist/lib/registry-version.d.ts +36 -0
- package/dist/lib/registry-version.js +104 -0
- package/dist/lib/registry-version.js.map +1 -0
- package/dist/marketplace/marketplace.js +4 -3
- package/dist/marketplace/marketplace.js.map +1 -1
- package/dist/updater/source-fetcher.d.ts +21 -0
- package/dist/updater/source-fetcher.js +52 -1
- package/dist/updater/source-fetcher.js.map +1 -1
- package/package.json +1 -1
package/dist/commands/add.js
CHANGED
|
@@ -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 {
|
|
21
|
-
import {
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
1013
|
-
|
|
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:
|
|
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
|
|
1415
|
+
// Platform security check on owner/repo/skill (skipped for private repos)
|
|
1385
1416
|
const privateRepo = await isPrivateOrUnknownRepo(owner, repo);
|
|
1386
|
-
const
|
|
1387
|
-
if (
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
-
//
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
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
|
-
//
|
|
2273
|
-
if (!isTTY()) {
|
|
2274
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
|
2621
|
-
if (
|
|
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
|
|
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}`);
|