@anytio/pspm 0.9.0 → 0.10.0
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/CHANGELOG.md +32 -0
- package/CLI_GUIDE.md +2 -2
- package/README.md +5 -4
- package/dist/index.js +652 -257
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import { join, dirname, basename, resolve, relative } from 'path';
|
|
|
5
5
|
import * as ini from 'ini';
|
|
6
6
|
import ignore from 'ignore';
|
|
7
7
|
import { createHash, randomBytes } from 'crypto';
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
8
|
+
import * as semver2 from 'semver';
|
|
9
|
+
import semver2__default from 'semver';
|
|
10
10
|
import { checkbox } from '@inquirer/prompts';
|
|
11
11
|
import { readFileSync } from 'fs';
|
|
12
12
|
import { fileURLToPath, URL as URL$1 } from 'url';
|
|
@@ -74,7 +74,7 @@ var init_fetcher = __esm({
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
// src/sdk/generated/index.ts
|
|
77
|
-
var getMeUrl, me, getExplorePublicSkillsUrl, explorePublicSkills, getDeleteSkillUrl, deleteSkill, getListSkillVersionsUrl, listSkillVersions, getGetSkillVersionUrl, getSkillVersion, getDeleteSkillVersionUrl, deleteSkillVersion, getPublishSkillUrl, publishSkill;
|
|
77
|
+
var getMeUrl, me, getExplorePublicSkillsUrl, explorePublicSkills, getDeleteSkillUrl, deleteSkill, getListSkillVersionsUrl, listSkillVersions, getGetSkillVersionUrl, getSkillVersion, getDeleteSkillVersionUrl, deleteSkillVersion, getPublishSkillUrl, publishSkill, getListOrgSkillVersionsUrl, listOrgSkillVersions, getGetOrgSkillVersionUrl, getOrgSkillVersion, getPublishOrgSkillUrl, publishOrgSkill;
|
|
78
78
|
var init_generated = __esm({
|
|
79
79
|
"src/sdk/generated/index.ts"() {
|
|
80
80
|
init_fetcher();
|
|
@@ -173,6 +173,46 @@ var init_generated = __esm({
|
|
|
173
173
|
}
|
|
174
174
|
);
|
|
175
175
|
};
|
|
176
|
+
getListOrgSkillVersionsUrl = (orgname, name) => {
|
|
177
|
+
return `/api/skills/@org/${orgname}/${name}/versions`;
|
|
178
|
+
};
|
|
179
|
+
listOrgSkillVersions = async (orgname, name, options) => {
|
|
180
|
+
return customFetch(
|
|
181
|
+
getListOrgSkillVersionsUrl(orgname, name),
|
|
182
|
+
{
|
|
183
|
+
...options,
|
|
184
|
+
method: "GET"
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
getGetOrgSkillVersionUrl = (orgname, name, version3) => {
|
|
189
|
+
return `/api/skills/@org/${orgname}/${name}/versions/${version3}`;
|
|
190
|
+
};
|
|
191
|
+
getOrgSkillVersion = async (orgname, name, version3, options) => {
|
|
192
|
+
return customFetch(
|
|
193
|
+
getGetOrgSkillVersionUrl(orgname, name, version3),
|
|
194
|
+
{
|
|
195
|
+
...options,
|
|
196
|
+
method: "GET"
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
getPublishOrgSkillUrl = (orgname) => {
|
|
201
|
+
return `/api/skills/@org/${orgname}/publish`;
|
|
202
|
+
};
|
|
203
|
+
publishOrgSkill = async (orgname, publishSkillInput, options) => {
|
|
204
|
+
return customFetch(
|
|
205
|
+
getPublishOrgSkillUrl(orgname),
|
|
206
|
+
{
|
|
207
|
+
...options,
|
|
208
|
+
method: "POST",
|
|
209
|
+
headers: { "Content-Type": "application/json", ...options?.headers },
|
|
210
|
+
body: JSON.stringify(
|
|
211
|
+
publishSkillInput
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
};
|
|
176
216
|
}
|
|
177
217
|
});
|
|
178
218
|
|
|
@@ -258,6 +298,58 @@ async function undeprecateSkillVersion(username, skillName, version3) {
|
|
|
258
298
|
};
|
|
259
299
|
}
|
|
260
300
|
}
|
|
301
|
+
async function listGithubSkillVersions(owner, repo, name) {
|
|
302
|
+
const config2 = getConfig();
|
|
303
|
+
try {
|
|
304
|
+
const response = await fetch(
|
|
305
|
+
`${config2.baseUrl}/api/skills/@github/${owner}/${repo}/${name}/versions`,
|
|
306
|
+
{
|
|
307
|
+
method: "GET",
|
|
308
|
+
headers: {
|
|
309
|
+
"Content-Type": "application/json",
|
|
310
|
+
...config2.apiKey ? { Authorization: `Bearer ${config2.apiKey}` } : {}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
if (!response.ok) {
|
|
315
|
+
const error = await response.text();
|
|
316
|
+
return { status: response.status, error };
|
|
317
|
+
}
|
|
318
|
+
const data = await response.json();
|
|
319
|
+
return { status: response.status, data };
|
|
320
|
+
} catch (error) {
|
|
321
|
+
return {
|
|
322
|
+
status: 500,
|
|
323
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
async function getGithubSkillVersion(owner, repo, name, version3) {
|
|
328
|
+
const config2 = getConfig();
|
|
329
|
+
try {
|
|
330
|
+
const response = await fetch(
|
|
331
|
+
`${config2.baseUrl}/api/skills/@github/${owner}/${repo}/${name}/versions/${version3}`,
|
|
332
|
+
{
|
|
333
|
+
method: "GET",
|
|
334
|
+
headers: {
|
|
335
|
+
"Content-Type": "application/json",
|
|
336
|
+
...config2.apiKey ? { Authorization: `Bearer ${config2.apiKey}` } : {}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
if (!response.ok) {
|
|
341
|
+
const error = await response.text();
|
|
342
|
+
return { status: response.status, error };
|
|
343
|
+
}
|
|
344
|
+
const data = await response.json();
|
|
345
|
+
return { status: response.status, data };
|
|
346
|
+
} catch (error) {
|
|
347
|
+
return {
|
|
348
|
+
status: 500,
|
|
349
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
261
353
|
async function changeSkillAccess(username, skillName, input) {
|
|
262
354
|
const config2 = getConfig();
|
|
263
355
|
if (!config2) {
|
|
@@ -786,22 +878,98 @@ var init_manifest = __esm({
|
|
|
786
878
|
PSPM_SCHEMA_URL = "https://pspm.dev/schema/v1/pspm.json";
|
|
787
879
|
}
|
|
788
880
|
});
|
|
789
|
-
|
|
790
|
-
|
|
881
|
+
var init_integrity2 = __esm({
|
|
882
|
+
"../../packages/shared/pspm-types/src/integrity.ts"() {
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
// ../../packages/shared/pspm-types/src/local.ts
|
|
887
|
+
var init_local = __esm({
|
|
888
|
+
"../../packages/shared/pspm-types/src/local.ts"() {
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
|
|
892
|
+
// ../../packages/shared/pspm-types/src/lockfile.ts
|
|
893
|
+
var init_lockfile2 = __esm({
|
|
894
|
+
"../../packages/shared/pspm-types/src/lockfile.ts"() {
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
// ../../packages/shared/pspm-types/src/manifest.ts
|
|
899
|
+
var init_manifest2 = __esm({
|
|
900
|
+
"../../packages/shared/pspm-types/src/manifest.ts"() {
|
|
901
|
+
}
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
// ../../packages/shared/pspm-types/src/specifier.ts
|
|
905
|
+
function parseRegistrySpecifier(specifier) {
|
|
906
|
+
const match = specifier.match(REGISTRY_SPECIFIER_PATTERN);
|
|
907
|
+
if (!match) {
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
910
|
+
const namespace = match[1];
|
|
911
|
+
const owner = match[2];
|
|
912
|
+
const name = match[3];
|
|
913
|
+
const subname = match[4];
|
|
914
|
+
const versionRange = match[5];
|
|
915
|
+
if (!owner || !name) {
|
|
916
|
+
return null;
|
|
917
|
+
}
|
|
918
|
+
if (namespace === "github" && !subname) {
|
|
919
|
+
return null;
|
|
920
|
+
}
|
|
921
|
+
if (namespace !== "github" && subname) {
|
|
922
|
+
return null;
|
|
923
|
+
}
|
|
924
|
+
return {
|
|
925
|
+
namespace,
|
|
926
|
+
owner,
|
|
927
|
+
name,
|
|
928
|
+
subname: subname || void 0,
|
|
929
|
+
versionRange: versionRange || void 0
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
var REGISTRY_SPECIFIER_PATTERN;
|
|
933
|
+
var init_specifier = __esm({
|
|
934
|
+
"../../packages/shared/pspm-types/src/specifier.ts"() {
|
|
935
|
+
REGISTRY_SPECIFIER_PATTERN = /^@(user|org|github)\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+)(?:\/([a-z][a-z0-9-]*))?(?:@(.+))?$/;
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
var init_version = __esm({
|
|
939
|
+
"../../packages/shared/pspm-types/src/version.ts"() {
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
// ../../packages/shared/pspm-types/src/index.ts
|
|
944
|
+
var init_src = __esm({
|
|
945
|
+
"../../packages/shared/pspm-types/src/index.ts"() {
|
|
946
|
+
init_integrity2();
|
|
947
|
+
init_local();
|
|
948
|
+
init_lockfile2();
|
|
949
|
+
init_manifest2();
|
|
950
|
+
init_specifier();
|
|
951
|
+
init_version();
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
function resolveVersion2(range, availableVersions) {
|
|
955
|
+
const sorted = availableVersions.filter((v) => semver2.valid(v)).sort((a, b) => semver2.rcompare(a, b));
|
|
791
956
|
if (!range || range === "latest" || range === "*") {
|
|
792
957
|
return sorted[0] ?? null;
|
|
793
958
|
}
|
|
794
|
-
return
|
|
959
|
+
return semver2.maxSatisfying(sorted, range);
|
|
960
|
+
}
|
|
961
|
+
function isNewerVersion2(a, b) {
|
|
962
|
+
return semver2.gt(a, b);
|
|
795
963
|
}
|
|
796
964
|
function findHighestSatisfying(ranges, availableVersions) {
|
|
797
|
-
const sorted = availableVersions.filter((v) =>
|
|
965
|
+
const sorted = availableVersions.filter((v) => semver2.valid(v)).sort((a, b) => semver2.rcompare(a, b));
|
|
798
966
|
if (sorted.length === 0) return null;
|
|
799
967
|
const normalizedRanges = ranges.map(
|
|
800
968
|
(r) => !r || r === "latest" || r === "*" ? "*" : r
|
|
801
969
|
);
|
|
802
970
|
for (const version3 of sorted) {
|
|
803
971
|
const satisfiesAll = normalizedRanges.every(
|
|
804
|
-
(range) =>
|
|
972
|
+
(range) => semver2.satisfies(version3, range)
|
|
805
973
|
);
|
|
806
974
|
if (satisfiesAll) {
|
|
807
975
|
return version3;
|
|
@@ -809,7 +977,7 @@ function findHighestSatisfying(ranges, availableVersions) {
|
|
|
809
977
|
}
|
|
810
978
|
return null;
|
|
811
979
|
}
|
|
812
|
-
var
|
|
980
|
+
var init_version2 = __esm({
|
|
813
981
|
"src/lib/version.ts"() {
|
|
814
982
|
}
|
|
815
983
|
});
|
|
@@ -872,8 +1040,8 @@ async function resolveRecursive(rootDeps, config2) {
|
|
|
872
1040
|
continue;
|
|
873
1041
|
}
|
|
874
1042
|
processing.add(name);
|
|
875
|
-
const
|
|
876
|
-
if (!
|
|
1043
|
+
const parsed = parseRegistrySpecifier(name);
|
|
1044
|
+
if (!parsed) {
|
|
877
1045
|
graph.errors.push({
|
|
878
1046
|
type: "package_not_found",
|
|
879
1047
|
package: name,
|
|
@@ -881,10 +1049,27 @@ async function resolveRecursive(rootDeps, config2) {
|
|
|
881
1049
|
});
|
|
882
1050
|
continue;
|
|
883
1051
|
}
|
|
884
|
-
const [, username, skillName] = match;
|
|
885
1052
|
try {
|
|
886
|
-
|
|
887
|
-
|
|
1053
|
+
let versionsData;
|
|
1054
|
+
let versionsStatus;
|
|
1055
|
+
if (parsed.namespace === "github" && parsed.subname) {
|
|
1056
|
+
const resp = await listGithubSkillVersions(
|
|
1057
|
+
parsed.owner,
|
|
1058
|
+
parsed.name,
|
|
1059
|
+
parsed.subname
|
|
1060
|
+
);
|
|
1061
|
+
versionsStatus = resp.status;
|
|
1062
|
+
versionsData = resp.data;
|
|
1063
|
+
} else if (parsed.namespace === "org") {
|
|
1064
|
+
const resp = await listOrgSkillVersions(parsed.owner, parsed.name);
|
|
1065
|
+
versionsStatus = resp.status;
|
|
1066
|
+
versionsData = resp.status === 200 ? resp.data : void 0;
|
|
1067
|
+
} else {
|
|
1068
|
+
const resp = await listSkillVersions(parsed.owner, parsed.name);
|
|
1069
|
+
versionsStatus = resp.status;
|
|
1070
|
+
versionsData = resp.status === 200 ? resp.data : void 0;
|
|
1071
|
+
}
|
|
1072
|
+
if (versionsStatus !== 200 || !versionsData) {
|
|
888
1073
|
graph.errors.push({
|
|
889
1074
|
type: "package_not_found",
|
|
890
1075
|
package: name,
|
|
@@ -892,8 +1077,7 @@ async function resolveRecursive(rootDeps, config2) {
|
|
|
892
1077
|
});
|
|
893
1078
|
continue;
|
|
894
1079
|
}
|
|
895
|
-
|
|
896
|
-
if (versions.length === 0) {
|
|
1080
|
+
if (versionsData.length === 0) {
|
|
897
1081
|
graph.errors.push({
|
|
898
1082
|
type: "package_not_found",
|
|
899
1083
|
package: name,
|
|
@@ -901,7 +1085,7 @@ async function resolveRecursive(rootDeps, config2) {
|
|
|
901
1085
|
});
|
|
902
1086
|
continue;
|
|
903
1087
|
}
|
|
904
|
-
const availableVersions =
|
|
1088
|
+
const availableVersions = versionsData.map((v) => v.version);
|
|
905
1089
|
const resolvedVersion = findHighestSatisfying(
|
|
906
1090
|
[versionRange],
|
|
907
1091
|
availableVersions
|
|
@@ -914,12 +1098,37 @@ async function resolveRecursive(rootDeps, config2) {
|
|
|
914
1098
|
});
|
|
915
1099
|
continue;
|
|
916
1100
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1101
|
+
let versionData = null;
|
|
1102
|
+
if (parsed.namespace === "github" && parsed.subname) {
|
|
1103
|
+
const resp = await getGithubSkillVersion(
|
|
1104
|
+
parsed.owner,
|
|
1105
|
+
parsed.name,
|
|
1106
|
+
parsed.subname,
|
|
1107
|
+
resolvedVersion
|
|
1108
|
+
);
|
|
1109
|
+
if (resp.status === 200 && resp.data) {
|
|
1110
|
+
versionData = resp.data;
|
|
1111
|
+
}
|
|
1112
|
+
} else if (parsed.namespace === "org") {
|
|
1113
|
+
const resp = await getOrgSkillVersion(
|
|
1114
|
+
parsed.owner,
|
|
1115
|
+
parsed.name,
|
|
1116
|
+
resolvedVersion
|
|
1117
|
+
);
|
|
1118
|
+
if (resp.status === 200 && resp.data) {
|
|
1119
|
+
versionData = resp.data;
|
|
1120
|
+
}
|
|
1121
|
+
} else {
|
|
1122
|
+
const resp = await getSkillVersion(
|
|
1123
|
+
parsed.owner,
|
|
1124
|
+
parsed.name,
|
|
1125
|
+
resolvedVersion
|
|
1126
|
+
);
|
|
1127
|
+
if (resp.status === 200 && resp.data) {
|
|
1128
|
+
versionData = resp.data;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
if (!versionData) {
|
|
923
1132
|
graph.errors.push({
|
|
924
1133
|
type: "fetch_error",
|
|
925
1134
|
package: name,
|
|
@@ -927,20 +1136,19 @@ async function resolveRecursive(rootDeps, config2) {
|
|
|
927
1136
|
});
|
|
928
1137
|
continue;
|
|
929
1138
|
}
|
|
930
|
-
const
|
|
931
|
-
const manifest = versionInfo.manifest;
|
|
1139
|
+
const manifest = versionData.manifest;
|
|
932
1140
|
const dependencies = manifest?.dependencies ?? {};
|
|
933
1141
|
const node = {
|
|
934
1142
|
name,
|
|
935
1143
|
version: resolvedVersion,
|
|
936
1144
|
versionRange,
|
|
937
|
-
downloadUrl:
|
|
938
|
-
integrity: `sha256-${Buffer.from(
|
|
1145
|
+
downloadUrl: versionData.downloadUrl,
|
|
1146
|
+
integrity: `sha256-${Buffer.from(versionData.checksum, "hex").toString("base64")}`,
|
|
939
1147
|
depth,
|
|
940
1148
|
dependencies,
|
|
941
1149
|
dependents: [dependent],
|
|
942
1150
|
isDirect: depth === 0,
|
|
943
|
-
deprecated:
|
|
1151
|
+
deprecated: versionData.deprecationMessage ?? void 0
|
|
944
1152
|
};
|
|
945
1153
|
graph.nodes.set(name, node);
|
|
946
1154
|
for (const [depName, depRange] of Object.entries(dependencies)) {
|
|
@@ -967,14 +1175,26 @@ async function resolveRecursive(rootDeps, config2) {
|
|
|
967
1175
|
const uniqueDependents = [...new Set(ranges.map((r) => r.dependent))];
|
|
968
1176
|
node.dependents = uniqueDependents;
|
|
969
1177
|
const allRanges = ranges.map((r) => r.range);
|
|
970
|
-
const
|
|
971
|
-
if (!
|
|
972
|
-
const [, username, skillName] = match;
|
|
1178
|
+
const p2Parsed = parseRegistrySpecifier(name);
|
|
1179
|
+
if (!p2Parsed) continue;
|
|
973
1180
|
try {
|
|
974
|
-
|
|
975
|
-
if (
|
|
976
|
-
|
|
977
|
-
|
|
1181
|
+
let p2Versions;
|
|
1182
|
+
if (p2Parsed.namespace === "github" && p2Parsed.subname) {
|
|
1183
|
+
const resp = await listGithubSkillVersions(
|
|
1184
|
+
p2Parsed.owner,
|
|
1185
|
+
p2Parsed.name,
|
|
1186
|
+
p2Parsed.subname
|
|
1187
|
+
);
|
|
1188
|
+
p2Versions = resp.status === 200 ? resp.data : void 0;
|
|
1189
|
+
} else if (p2Parsed.namespace === "org") {
|
|
1190
|
+
const resp = await listOrgSkillVersions(p2Parsed.owner, p2Parsed.name);
|
|
1191
|
+
p2Versions = resp.status === 200 ? resp.data : void 0;
|
|
1192
|
+
} else {
|
|
1193
|
+
const resp = await listSkillVersions(p2Parsed.owner, p2Parsed.name);
|
|
1194
|
+
p2Versions = resp.status === 200 ? resp.data : void 0;
|
|
1195
|
+
}
|
|
1196
|
+
if (!p2Versions) continue;
|
|
1197
|
+
const availableVersions = p2Versions.map((v) => v.version);
|
|
978
1198
|
const finalVersion = findHighestSatisfying(allRanges, availableVersions);
|
|
979
1199
|
if (!finalVersion) {
|
|
980
1200
|
graph.conflicts.push({
|
|
@@ -993,18 +1213,42 @@ async function resolveRecursive(rootDeps, config2) {
|
|
|
993
1213
|
continue;
|
|
994
1214
|
}
|
|
995
1215
|
if (finalVersion !== node.version) {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1216
|
+
let p2VersionData = null;
|
|
1217
|
+
if (p2Parsed.namespace === "github" && p2Parsed.subname) {
|
|
1218
|
+
const resp = await getGithubSkillVersion(
|
|
1219
|
+
p2Parsed.owner,
|
|
1220
|
+
p2Parsed.name,
|
|
1221
|
+
p2Parsed.subname,
|
|
1222
|
+
finalVersion
|
|
1223
|
+
);
|
|
1224
|
+
if (resp.status === 200 && resp.data) {
|
|
1225
|
+
p2VersionData = resp.data;
|
|
1226
|
+
}
|
|
1227
|
+
} else if (p2Parsed.namespace === "org") {
|
|
1228
|
+
const resp = await getOrgSkillVersion(
|
|
1229
|
+
p2Parsed.owner,
|
|
1230
|
+
p2Parsed.name,
|
|
1231
|
+
finalVersion
|
|
1232
|
+
);
|
|
1233
|
+
if (resp.status === 200 && resp.data) {
|
|
1234
|
+
p2VersionData = resp.data;
|
|
1235
|
+
}
|
|
1236
|
+
} else {
|
|
1237
|
+
const resp = await getSkillVersion(
|
|
1238
|
+
p2Parsed.owner,
|
|
1239
|
+
p2Parsed.name,
|
|
1240
|
+
finalVersion
|
|
1241
|
+
);
|
|
1242
|
+
if (resp.status === 200 && resp.data) {
|
|
1243
|
+
p2VersionData = resp.data;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
if (p2VersionData) {
|
|
1003
1247
|
node.version = finalVersion;
|
|
1004
|
-
node.downloadUrl =
|
|
1005
|
-
node.integrity = `sha256-${Buffer.from(
|
|
1006
|
-
node.deprecated =
|
|
1007
|
-
const manifest =
|
|
1248
|
+
node.downloadUrl = p2VersionData.downloadUrl;
|
|
1249
|
+
node.integrity = `sha256-${Buffer.from(p2VersionData.checksum, "hex").toString("base64")}`;
|
|
1250
|
+
node.deprecated = p2VersionData.deprecationMessage ?? void 0;
|
|
1251
|
+
const manifest = p2VersionData.manifest;
|
|
1008
1252
|
node.dependencies = manifest?.dependencies ?? {};
|
|
1009
1253
|
}
|
|
1010
1254
|
}
|
|
@@ -1119,30 +1363,55 @@ function printResolutionErrors(errors, conflicts = []) {
|
|
|
1119
1363
|
var MAX_DEPENDENCY_DEPTH;
|
|
1120
1364
|
var init_resolver = __esm({
|
|
1121
1365
|
"src/lib/resolver.ts"() {
|
|
1366
|
+
init_src();
|
|
1122
1367
|
init_api_client();
|
|
1123
|
-
|
|
1368
|
+
init_version2();
|
|
1124
1369
|
MAX_DEPENDENCY_DEPTH = 5;
|
|
1125
1370
|
}
|
|
1126
1371
|
});
|
|
1127
1372
|
|
|
1128
1373
|
// src/lib/specifier.ts
|
|
1129
|
-
function
|
|
1130
|
-
const match = specifier.match(
|
|
1374
|
+
function parseRegistrySpecifier2(specifier) {
|
|
1375
|
+
const match = specifier.match(REGISTRY_SPECIFIER_PATTERN2);
|
|
1131
1376
|
if (!match) {
|
|
1132
1377
|
return null;
|
|
1133
1378
|
}
|
|
1134
|
-
const
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1379
|
+
const namespace = match[1];
|
|
1380
|
+
const owner = match[2];
|
|
1381
|
+
const name = match[3];
|
|
1382
|
+
const subname = match[4];
|
|
1383
|
+
const versionRange = match[5];
|
|
1384
|
+
if (!owner || !name) {
|
|
1385
|
+
return null;
|
|
1386
|
+
}
|
|
1387
|
+
if (namespace === "github" && !subname) {
|
|
1388
|
+
return null;
|
|
1389
|
+
}
|
|
1390
|
+
if (namespace !== "github" && subname) {
|
|
1137
1391
|
return null;
|
|
1138
1392
|
}
|
|
1139
1393
|
return {
|
|
1140
|
-
|
|
1394
|
+
namespace,
|
|
1395
|
+
owner,
|
|
1141
1396
|
name,
|
|
1142
|
-
|
|
1397
|
+
subname: subname || void 0,
|
|
1398
|
+
versionRange: versionRange || void 0
|
|
1143
1399
|
};
|
|
1144
1400
|
}
|
|
1145
|
-
function
|
|
1401
|
+
function generateRegistryIdentifier2(spec) {
|
|
1402
|
+
let base = `@${spec.namespace}/${spec.owner}/${spec.name}`;
|
|
1403
|
+
if (spec.subname) {
|
|
1404
|
+
base += `/${spec.subname}`;
|
|
1405
|
+
}
|
|
1406
|
+
if (spec.versionRange) {
|
|
1407
|
+
base += `@${spec.versionRange}`;
|
|
1408
|
+
}
|
|
1409
|
+
return base;
|
|
1410
|
+
}
|
|
1411
|
+
function isRegistrySpecifier2(specifier) {
|
|
1412
|
+
return specifier.startsWith("@user/") || specifier.startsWith("@org/") || specifier.startsWith("@github/");
|
|
1413
|
+
}
|
|
1414
|
+
function parseGitHubSpecifier2(specifier) {
|
|
1146
1415
|
const match = specifier.match(GITHUB_SPECIFIER_PATTERN);
|
|
1147
1416
|
if (!match) {
|
|
1148
1417
|
return null;
|
|
@@ -1159,7 +1428,7 @@ function parseGitHubSpecifier(specifier) {
|
|
|
1159
1428
|
ref: ref || void 0
|
|
1160
1429
|
};
|
|
1161
1430
|
}
|
|
1162
|
-
function
|
|
1431
|
+
function formatGitHubSpecifier2(spec) {
|
|
1163
1432
|
let result = `github:${spec.owner}/${spec.repo}`;
|
|
1164
1433
|
if (spec.path) {
|
|
1165
1434
|
result += `/${spec.path}`;
|
|
@@ -1169,7 +1438,7 @@ function formatGitHubSpecifier(spec) {
|
|
|
1169
1438
|
}
|
|
1170
1439
|
return result;
|
|
1171
1440
|
}
|
|
1172
|
-
function
|
|
1441
|
+
function getGitHubSkillName2(spec) {
|
|
1173
1442
|
if (spec.path) {
|
|
1174
1443
|
const segments = spec.path.split("/").filter(Boolean);
|
|
1175
1444
|
const lastSegment = segments[segments.length - 1];
|
|
@@ -1179,7 +1448,7 @@ function getGitHubSkillName(spec) {
|
|
|
1179
1448
|
}
|
|
1180
1449
|
return spec.repo;
|
|
1181
1450
|
}
|
|
1182
|
-
function
|
|
1451
|
+
function isGitHubSpecifier2(specifier) {
|
|
1183
1452
|
return specifier.startsWith("github:");
|
|
1184
1453
|
}
|
|
1185
1454
|
function isGitHubUrl(input) {
|
|
@@ -1225,10 +1494,10 @@ function parseGitHubShorthand(input) {
|
|
|
1225
1494
|
path: path || void 0
|
|
1226
1495
|
};
|
|
1227
1496
|
}
|
|
1228
|
-
var
|
|
1229
|
-
var
|
|
1497
|
+
var REGISTRY_SPECIFIER_PATTERN2, GITHUB_SPECIFIER_PATTERN, GITHUB_URL_TREE_PATTERN, GITHUB_URL_PATTERN, GITHUB_SHORTHAND_PATTERN;
|
|
1498
|
+
var init_specifier2 = __esm({
|
|
1230
1499
|
"src/lib/specifier.ts"() {
|
|
1231
|
-
|
|
1500
|
+
REGISTRY_SPECIFIER_PATTERN2 = /^@(user|org|github)\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+)(?:\/([a-z][a-z0-9-]*))?(?:@(.+))?$/;
|
|
1232
1501
|
GITHUB_SPECIFIER_PATTERN = /^github:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)(\/[^@]+)?(?:@(.+))?$/;
|
|
1233
1502
|
GITHUB_URL_TREE_PATTERN = /^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(?:\/(.+))?$/;
|
|
1234
1503
|
GITHUB_URL_PATTERN = /^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
|
|
@@ -1244,8 +1513,8 @@ var init_lib = __esm({
|
|
|
1244
1513
|
init_lockfile();
|
|
1245
1514
|
init_manifest();
|
|
1246
1515
|
init_resolver();
|
|
1247
|
-
|
|
1248
|
-
|
|
1516
|
+
init_specifier2();
|
|
1517
|
+
init_version2();
|
|
1249
1518
|
}
|
|
1250
1519
|
});
|
|
1251
1520
|
function resolveAgentConfig(name, overrides, global) {
|
|
@@ -1890,7 +2159,7 @@ async function listLockfileWellKnownPackages() {
|
|
|
1890
2159
|
})
|
|
1891
2160
|
);
|
|
1892
2161
|
}
|
|
1893
|
-
var
|
|
2162
|
+
var init_lockfile3 = __esm({
|
|
1894
2163
|
"src/lockfile.ts"() {
|
|
1895
2164
|
init_config();
|
|
1896
2165
|
init_lib();
|
|
@@ -1992,7 +2261,7 @@ async function addWellKnownDependency(baseUrl, skillNames) {
|
|
|
1992
2261
|
}
|
|
1993
2262
|
await writeManifest(manifest);
|
|
1994
2263
|
}
|
|
1995
|
-
var
|
|
2264
|
+
var init_manifest3 = __esm({
|
|
1996
2265
|
"src/manifest.ts"() {
|
|
1997
2266
|
init_config();
|
|
1998
2267
|
}
|
|
@@ -2063,8 +2332,19 @@ async function removeAgentSymlinks(skillName, options) {
|
|
|
2063
2332
|
}
|
|
2064
2333
|
}
|
|
2065
2334
|
}
|
|
2066
|
-
function getRegistrySkillPath(
|
|
2067
|
-
|
|
2335
|
+
function getRegistrySkillPath(ownerOrNamespace, skillNameOrOwner, skillName) {
|
|
2336
|
+
if (skillName !== void 0) {
|
|
2337
|
+
const namespace = ownerOrNamespace;
|
|
2338
|
+
const owner = skillNameOrOwner;
|
|
2339
|
+
if (namespace === "org") {
|
|
2340
|
+
return `.pspm/skills/_org/${owner}/${skillName}`;
|
|
2341
|
+
}
|
|
2342
|
+
if (namespace === "github") {
|
|
2343
|
+
return `.pspm/skills/_github-registry/${owner}/${skillName}`;
|
|
2344
|
+
}
|
|
2345
|
+
return `.pspm/skills/${owner}/${skillName}`;
|
|
2346
|
+
}
|
|
2347
|
+
return `.pspm/skills/${ownerOrNamespace}/${skillNameOrOwner}`;
|
|
2068
2348
|
}
|
|
2069
2349
|
function getGitHubSkillPath(owner, repo, path) {
|
|
2070
2350
|
if (path) {
|
|
@@ -2281,7 +2561,7 @@ var add_exports = {};
|
|
|
2281
2561
|
__export(add_exports, {
|
|
2282
2562
|
add: () => add
|
|
2283
2563
|
});
|
|
2284
|
-
function
|
|
2564
|
+
function isLocalSpecifier3(specifier) {
|
|
2285
2565
|
return specifier.startsWith("file:") || specifier.startsWith("./") || specifier.startsWith("../");
|
|
2286
2566
|
}
|
|
2287
2567
|
function parseLocalPath(specifier) {
|
|
@@ -2290,7 +2570,7 @@ function parseLocalPath(specifier) {
|
|
|
2290
2570
|
}
|
|
2291
2571
|
return specifier;
|
|
2292
2572
|
}
|
|
2293
|
-
function
|
|
2573
|
+
function normalizeToFileSpecifier2(path) {
|
|
2294
2574
|
if (path.startsWith("file:")) {
|
|
2295
2575
|
return path;
|
|
2296
2576
|
}
|
|
@@ -2306,18 +2586,27 @@ async function add(specifiers, options) {
|
|
|
2306
2586
|
const validationErrors = [];
|
|
2307
2587
|
for (const specifier of specifiers) {
|
|
2308
2588
|
try {
|
|
2309
|
-
if (
|
|
2589
|
+
if (isLocalSpecifier3(specifier)) {
|
|
2310
2590
|
const resolved = await validateLocalPackage(specifier);
|
|
2311
2591
|
resolvedPackages.push(resolved);
|
|
2312
|
-
} else if (
|
|
2592
|
+
} else if (isGitHubSpecifier2(specifier) || isGitHubUrl(specifier) || isGitHubShorthand(specifier)) {
|
|
2313
2593
|
const resolved = await validateGitHubPackage(specifier);
|
|
2314
2594
|
resolvedPackages.push(resolved);
|
|
2315
2595
|
} else if (isWellKnownSpecifier(specifier)) {
|
|
2316
2596
|
const resolved = await validateWellKnownPackage(specifier);
|
|
2317
2597
|
resolvedPackages.push(resolved);
|
|
2318
|
-
} else {
|
|
2598
|
+
} else if (isRegistrySpecifier2(specifier)) {
|
|
2319
2599
|
const resolved = await validateRegistryPackage(specifier);
|
|
2320
2600
|
resolvedPackages.push(resolved);
|
|
2601
|
+
} else {
|
|
2602
|
+
throw new Error(
|
|
2603
|
+
`Unknown specifier format "${specifier}". Supported formats:
|
|
2604
|
+
@user/{username}/{name}[@version] (registry)
|
|
2605
|
+
@org/{orgname}/{name}[@version] (organization)
|
|
2606
|
+
github:owner/repo[/path][@ref] (github)
|
|
2607
|
+
file:./path/to/skill (local)
|
|
2608
|
+
owner/repo (github shorthand)`
|
|
2609
|
+
);
|
|
2321
2610
|
}
|
|
2322
2611
|
} catch (error) {
|
|
2323
2612
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -2354,7 +2643,12 @@ async function add(specifiers, options) {
|
|
|
2354
2643
|
if (registryPackages.length > 0) {
|
|
2355
2644
|
const rootDeps = {};
|
|
2356
2645
|
for (const pkg of registryPackages) {
|
|
2357
|
-
const fullName =
|
|
2646
|
+
const fullName = generateRegistryIdentifier2({
|
|
2647
|
+
namespace: pkg.namespace,
|
|
2648
|
+
owner: pkg.owner,
|
|
2649
|
+
name: pkg.name,
|
|
2650
|
+
subname: pkg.subname
|
|
2651
|
+
});
|
|
2358
2652
|
rootDeps[fullName] = pkg.versionRange || `^${pkg.resolvedVersion}`;
|
|
2359
2653
|
}
|
|
2360
2654
|
console.log("Resolving dependencies...");
|
|
@@ -2487,11 +2781,11 @@ function getSymlinkRoot() {
|
|
|
2487
2781
|
return isGlobalMode() ? homedir() : process.cwd();
|
|
2488
2782
|
}
|
|
2489
2783
|
async function installFromNode(node, options) {
|
|
2490
|
-
const
|
|
2491
|
-
if (!
|
|
2784
|
+
const parsed = parseRegistrySpecifier2(node.name);
|
|
2785
|
+
if (!parsed) {
|
|
2492
2786
|
throw new Error(`Invalid package name: ${node.name}`);
|
|
2493
2787
|
}
|
|
2494
|
-
const
|
|
2788
|
+
const { namespace, owner, name, subname } = parsed;
|
|
2495
2789
|
console.log(`Installing ${node.name}@${node.version}...`);
|
|
2496
2790
|
const config2 = await resolveConfig();
|
|
2497
2791
|
const apiKey = getTokenForRegistry(config2, config2.registryUrl);
|
|
@@ -2513,7 +2807,15 @@ async function installFromNode(node, options) {
|
|
|
2513
2807
|
throw new Error("Checksum verification failed");
|
|
2514
2808
|
}
|
|
2515
2809
|
const skillsDir = getSkillsDir();
|
|
2516
|
-
const
|
|
2810
|
+
const effectiveSkillName = subname ?? name;
|
|
2811
|
+
let destDir;
|
|
2812
|
+
if (namespace === "org") {
|
|
2813
|
+
destDir = join(skillsDir, "_org", owner, effectiveSkillName);
|
|
2814
|
+
} else if (namespace === "github" && subname) {
|
|
2815
|
+
destDir = join(skillsDir, "_github-registry", owner, name, subname);
|
|
2816
|
+
} else {
|
|
2817
|
+
destDir = join(skillsDir, owner, effectiveSkillName);
|
|
2818
|
+
}
|
|
2517
2819
|
await mkdir(destDir, { recursive: true });
|
|
2518
2820
|
const { writeFile: writeFile11 } = await import('fs/promises');
|
|
2519
2821
|
const tempFile = join(destDir, ".temp.tgz");
|
|
@@ -2552,9 +2854,10 @@ async function installFromNode(node, options) {
|
|
|
2552
2854
|
const agents = options.resolvedAgents;
|
|
2553
2855
|
if (agents[0] !== "none") {
|
|
2554
2856
|
const skillManifest = await readManifest();
|
|
2857
|
+
const pathSkillName = namespace === "github" && subname ? `${name}/${subname}` : name;
|
|
2555
2858
|
const skillInfo = {
|
|
2556
|
-
name,
|
|
2557
|
-
sourcePath: getRegistrySkillPath(
|
|
2859
|
+
name: effectiveSkillName,
|
|
2860
|
+
sourcePath: getRegistrySkillPath(namespace, owner, pathSkillName)
|
|
2558
2861
|
};
|
|
2559
2862
|
await createAgentSymlinks([skillInfo], {
|
|
2560
2863
|
agents,
|
|
@@ -2570,73 +2873,110 @@ async function validateRegistryPackage(specifier) {
|
|
|
2570
2873
|
const config2 = await resolveConfig();
|
|
2571
2874
|
const registryUrl = config2.registryUrl;
|
|
2572
2875
|
const apiKey = getTokenForRegistry(config2, registryUrl);
|
|
2573
|
-
const parsed =
|
|
2876
|
+
const parsed = parseRegistrySpecifier2(specifier);
|
|
2574
2877
|
if (!parsed) {
|
|
2575
2878
|
throw new Error(
|
|
2576
|
-
`Invalid skill specifier "${specifier}". Use format: @user/{username}/{name}[@{version}]`
|
|
2879
|
+
`Invalid skill specifier "${specifier}". Use format: @user/{username}/{name}[@{version}] or @org/{orgname}/{name}[@{version}]`
|
|
2577
2880
|
);
|
|
2578
2881
|
}
|
|
2579
|
-
const {
|
|
2882
|
+
const { namespace, owner, name, subname, versionRange } = parsed;
|
|
2883
|
+
const fullName = generateRegistryIdentifier2({
|
|
2884
|
+
namespace,
|
|
2885
|
+
owner,
|
|
2886
|
+
name,
|
|
2887
|
+
subname
|
|
2888
|
+
});
|
|
2580
2889
|
configure2({ registryUrl, apiKey });
|
|
2581
2890
|
console.log(`Resolving ${specifier}...`);
|
|
2582
|
-
|
|
2583
|
-
if (
|
|
2584
|
-
|
|
2585
|
-
|
|
2891
|
+
let versions;
|
|
2892
|
+
if (namespace === "github" && subname) {
|
|
2893
|
+
const versionsResponse = await listGithubSkillVersions(
|
|
2894
|
+
owner,
|
|
2895
|
+
name,
|
|
2896
|
+
subname
|
|
2897
|
+
);
|
|
2898
|
+
if (versionsResponse.status !== 200 || !versionsResponse.data) {
|
|
2899
|
+
if (versionsResponse.status === 401) {
|
|
2586
2900
|
throw new Error(
|
|
2587
|
-
`
|
|
2901
|
+
apiKey ? `Access denied to ${fullName}. You may not have permission to access this private package.` : `Package ${fullName} requires authentication. Please run 'pspm login' to authenticate`
|
|
2588
2902
|
);
|
|
2589
2903
|
}
|
|
2590
|
-
throw new Error(
|
|
2591
|
-
|
|
2904
|
+
throw new Error(versionsResponse.error || `Skill ${fullName} not found`);
|
|
2905
|
+
}
|
|
2906
|
+
versions = versionsResponse.data;
|
|
2907
|
+
} else {
|
|
2908
|
+
const versionsResponse = await listSkillVersions(owner, name);
|
|
2909
|
+
if (versionsResponse.status !== 200) {
|
|
2910
|
+
if (versionsResponse.status === 401) {
|
|
2911
|
+
if (!apiKey) {
|
|
2912
|
+
throw new Error(
|
|
2913
|
+
`Package ${fullName} requires authentication. Please run 'pspm login' to authenticate`
|
|
2914
|
+
);
|
|
2915
|
+
}
|
|
2916
|
+
throw new Error(
|
|
2917
|
+
`Access denied to ${fullName}. You may not have permission to access this private package.`
|
|
2918
|
+
);
|
|
2919
|
+
}
|
|
2920
|
+
const errorMessage = extractApiErrorMessage(
|
|
2921
|
+
versionsResponse,
|
|
2922
|
+
`Skill ${fullName} not found`
|
|
2592
2923
|
);
|
|
2924
|
+
throw new Error(errorMessage);
|
|
2593
2925
|
}
|
|
2594
|
-
|
|
2595
|
-
versionsResponse,
|
|
2596
|
-
`Skill @user/${username}/${name} not found`
|
|
2597
|
-
);
|
|
2598
|
-
throw new Error(errorMessage);
|
|
2926
|
+
versions = versionsResponse.data;
|
|
2599
2927
|
}
|
|
2600
|
-
const versions = versionsResponse.data;
|
|
2601
2928
|
if (versions.length === 0) {
|
|
2602
|
-
throw new Error(`Skill
|
|
2929
|
+
throw new Error(`Skill ${fullName} not found`);
|
|
2603
2930
|
}
|
|
2604
2931
|
const versionStrings = versions.map((v) => v.version);
|
|
2605
|
-
const resolvedVersion =
|
|
2932
|
+
const resolvedVersion = resolveVersion2(versionRange || "*", versionStrings);
|
|
2606
2933
|
if (!resolvedVersion) {
|
|
2607
2934
|
throw new Error(
|
|
2608
|
-
`No version matching "${versionRange || "latest"}" found for
|
|
2935
|
+
`No version matching "${versionRange || "latest"}" found for ${fullName}. Available versions: ${versionStrings.join(", ")}`
|
|
2609
2936
|
);
|
|
2610
2937
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
`Version ${resolvedVersion} not found`
|
|
2938
|
+
let downloadUrl;
|
|
2939
|
+
let checksum;
|
|
2940
|
+
if (namespace === "github" && subname) {
|
|
2941
|
+
const versionResponse = await getGithubSkillVersion(
|
|
2942
|
+
owner,
|
|
2943
|
+
name,
|
|
2944
|
+
subname,
|
|
2945
|
+
resolvedVersion
|
|
2620
2946
|
);
|
|
2621
|
-
|
|
2947
|
+
if (versionResponse.status !== 200 || !versionResponse.data) {
|
|
2948
|
+
throw new Error(`Version ${resolvedVersion} not found for ${fullName}`);
|
|
2949
|
+
}
|
|
2950
|
+
downloadUrl = versionResponse.data.downloadUrl;
|
|
2951
|
+
checksum = versionResponse.data.checksum;
|
|
2952
|
+
} else {
|
|
2953
|
+
const versionResponse = await getSkillVersion(owner, name, resolvedVersion);
|
|
2954
|
+
if (versionResponse.status !== 200 || !versionResponse.data) {
|
|
2955
|
+
const errorMessage = extractApiErrorMessage(
|
|
2956
|
+
versionResponse,
|
|
2957
|
+
`Version ${resolvedVersion} not found`
|
|
2958
|
+
);
|
|
2959
|
+
throw new Error(errorMessage);
|
|
2960
|
+
}
|
|
2961
|
+
downloadUrl = versionResponse.data.downloadUrl;
|
|
2962
|
+
checksum = versionResponse.data.checksum;
|
|
2622
2963
|
}
|
|
2623
|
-
console.log(`Resolved
|
|
2964
|
+
console.log(`Resolved ${fullName}@${resolvedVersion}`);
|
|
2624
2965
|
return {
|
|
2625
2966
|
type: "registry",
|
|
2626
2967
|
specifier,
|
|
2627
|
-
|
|
2968
|
+
namespace,
|
|
2969
|
+
owner,
|
|
2628
2970
|
name,
|
|
2971
|
+
subname,
|
|
2629
2972
|
versionRange,
|
|
2630
2973
|
resolvedVersion,
|
|
2631
|
-
versionInfo: {
|
|
2632
|
-
downloadUrl: versionResponse.data.downloadUrl,
|
|
2633
|
-
checksum: versionResponse.data.checksum
|
|
2634
|
-
}
|
|
2974
|
+
versionInfo: { downloadUrl, checksum }
|
|
2635
2975
|
};
|
|
2636
2976
|
}
|
|
2637
2977
|
function parseAnyGitHubFormat(specifier) {
|
|
2638
|
-
if (
|
|
2639
|
-
return
|
|
2978
|
+
if (isGitHubSpecifier2(specifier)) {
|
|
2979
|
+
return parseGitHubSpecifier2(specifier);
|
|
2640
2980
|
}
|
|
2641
2981
|
if (isGitHubUrl(specifier)) {
|
|
2642
2982
|
return parseGitHubUrl(specifier);
|
|
@@ -2679,7 +3019,7 @@ async function installGitHubPackage(resolved, options) {
|
|
|
2679
3019
|
downloadResult.buffer,
|
|
2680
3020
|
skillsDir
|
|
2681
3021
|
);
|
|
2682
|
-
const lockfileSpecifier =
|
|
3022
|
+
const lockfileSpecifier = formatGitHubSpecifier2({
|
|
2683
3023
|
owner: parsed.owner,
|
|
2684
3024
|
repo: parsed.repo,
|
|
2685
3025
|
path: parsed.path
|
|
@@ -2697,7 +3037,7 @@ async function installGitHubPackage(resolved, options) {
|
|
|
2697
3037
|
const agents = options.resolvedAgents;
|
|
2698
3038
|
if (agents[0] !== "none") {
|
|
2699
3039
|
const manifest = await readManifest();
|
|
2700
|
-
const skillName =
|
|
3040
|
+
const skillName = getGitHubSkillName2(parsed);
|
|
2701
3041
|
const skillInfo = {
|
|
2702
3042
|
name: skillName,
|
|
2703
3043
|
sourcePath: getGitHubSkillPath(parsed.owner, parsed.repo, parsed.path)
|
|
@@ -2717,7 +3057,7 @@ async function installGitHubPackage(resolved, options) {
|
|
|
2717
3057
|
async function validateLocalPackage(specifier) {
|
|
2718
3058
|
const path = parseLocalPath(specifier);
|
|
2719
3059
|
const resolvedPath = resolve(process.cwd(), path);
|
|
2720
|
-
const normalizedSpecifier =
|
|
3060
|
+
const normalizedSpecifier = normalizeToFileSpecifier2(path);
|
|
2721
3061
|
console.log(`Resolving ${specifier}...`);
|
|
2722
3062
|
try {
|
|
2723
3063
|
const stats = await stat(resolvedPath);
|
|
@@ -2866,8 +3206,8 @@ var init_add = __esm({
|
|
|
2866
3206
|
init_errors();
|
|
2867
3207
|
init_github();
|
|
2868
3208
|
init_lib();
|
|
2869
|
-
|
|
2870
|
-
|
|
3209
|
+
init_lockfile3();
|
|
3210
|
+
init_manifest3();
|
|
2871
3211
|
init_symlinks();
|
|
2872
3212
|
init_wellknown();
|
|
2873
3213
|
}
|
|
@@ -2877,7 +3217,7 @@ var init_add = __esm({
|
|
|
2877
3217
|
init_api_client();
|
|
2878
3218
|
init_config();
|
|
2879
3219
|
init_lib();
|
|
2880
|
-
function
|
|
3220
|
+
function isLocalSpecifier2(specifier) {
|
|
2881
3221
|
return specifier.startsWith("file:") || specifier.startsWith("./") || specifier.startsWith("../");
|
|
2882
3222
|
}
|
|
2883
3223
|
async function access(specifier, options) {
|
|
@@ -2896,8 +3236,8 @@ async function access(specifier, options) {
|
|
|
2896
3236
|
let packageName;
|
|
2897
3237
|
let packageUsername;
|
|
2898
3238
|
if (specifier) {
|
|
2899
|
-
if (
|
|
2900
|
-
const ghSpec =
|
|
3239
|
+
if (isGitHubSpecifier2(specifier)) {
|
|
3240
|
+
const ghSpec = parseGitHubSpecifier2(specifier);
|
|
2901
3241
|
if (ghSpec) {
|
|
2902
3242
|
console.error(`Error: Cannot change visibility of GitHub packages.`);
|
|
2903
3243
|
console.error(
|
|
@@ -2912,7 +3252,7 @@ async function access(specifier, options) {
|
|
|
2912
3252
|
}
|
|
2913
3253
|
process.exit(1);
|
|
2914
3254
|
}
|
|
2915
|
-
if (
|
|
3255
|
+
if (isLocalSpecifier2(specifier)) {
|
|
2916
3256
|
console.error(`Error: Cannot change visibility of local packages.`);
|
|
2917
3257
|
console.error(
|
|
2918
3258
|
` "${specifier}" is a local directory, not a registry package.`
|
|
@@ -2922,10 +3262,12 @@ async function access(specifier, options) {
|
|
|
2922
3262
|
);
|
|
2923
3263
|
process.exit(1);
|
|
2924
3264
|
}
|
|
2925
|
-
const parsed =
|
|
3265
|
+
const parsed = parseRegistrySpecifier2(specifier);
|
|
2926
3266
|
if (!parsed) {
|
|
2927
3267
|
console.error(`Error: Invalid package specifier "${specifier}".`);
|
|
2928
|
-
console.error(
|
|
3268
|
+
console.error(
|
|
3269
|
+
` Use format: @user/{username}/{name} or @org/{orgname}/{name}`
|
|
3270
|
+
);
|
|
2929
3271
|
console.error(``);
|
|
2930
3272
|
console.error(` Examples:`);
|
|
2931
3273
|
console.error(` pspm access @user/myname/my-skill --public`);
|
|
@@ -2935,7 +3277,7 @@ async function access(specifier, options) {
|
|
|
2935
3277
|
process.exit(1);
|
|
2936
3278
|
}
|
|
2937
3279
|
packageName = parsed.name;
|
|
2938
|
-
packageUsername = parsed.
|
|
3280
|
+
packageUsername = parsed.owner;
|
|
2939
3281
|
} else {
|
|
2940
3282
|
const { readFile: readFile10 } = await import('fs/promises');
|
|
2941
3283
|
const { join: join18 } = await import('path');
|
|
@@ -2991,7 +3333,7 @@ async function access(specifier, options) {
|
|
|
2991
3333
|
}
|
|
2992
3334
|
const result = response.data;
|
|
2993
3335
|
console.log(
|
|
2994
|
-
`+
|
|
3336
|
+
`+ @${result.namespace ?? "user"}/${result.username}/${result.name} is now ${result.visibility}`
|
|
2995
3337
|
);
|
|
2996
3338
|
if (visibility === "public") {
|
|
2997
3339
|
console.log("");
|
|
@@ -3012,7 +3354,7 @@ init_add();
|
|
|
3012
3354
|
// src/commands/audit.ts
|
|
3013
3355
|
init_config();
|
|
3014
3356
|
init_lib();
|
|
3015
|
-
|
|
3357
|
+
init_lockfile3();
|
|
3016
3358
|
async function audit(options) {
|
|
3017
3359
|
try {
|
|
3018
3360
|
const lockfile = await readLockfile();
|
|
@@ -3082,7 +3424,7 @@ async function audit(options) {
|
|
|
3082
3424
|
}
|
|
3083
3425
|
const githubSkills = await listLockfileGitHubPackages();
|
|
3084
3426
|
for (const { specifier } of githubSkills) {
|
|
3085
|
-
const parsed =
|
|
3427
|
+
const parsed = parseGitHubSpecifier2(specifier);
|
|
3086
3428
|
if (!parsed) continue;
|
|
3087
3429
|
const destDir = parsed.path ? join(
|
|
3088
3430
|
projectRoot,
|
|
@@ -3280,14 +3622,19 @@ async function deprecate(specifier, message, options) {
|
|
|
3280
3622
|
try {
|
|
3281
3623
|
const apiKey = await requireApiKey();
|
|
3282
3624
|
const registryUrl = await getRegistryUrl();
|
|
3283
|
-
const parsed =
|
|
3625
|
+
const parsed = parseRegistrySpecifier2(specifier);
|
|
3284
3626
|
if (!parsed) {
|
|
3285
3627
|
console.error(
|
|
3286
|
-
`Error: Invalid skill specifier "${specifier}". Use format: @user/{username}/{name}@{version}`
|
|
3628
|
+
`Error: Invalid skill specifier "${specifier}". Use format: @user/{username}/{name}@{version} or @org/{orgname}/{name}@{version}`
|
|
3287
3629
|
);
|
|
3288
3630
|
process.exit(1);
|
|
3289
3631
|
}
|
|
3290
|
-
const {
|
|
3632
|
+
const { owner, name, versionRange } = parsed;
|
|
3633
|
+
const fullName = generateRegistryIdentifier2({
|
|
3634
|
+
namespace: parsed.namespace,
|
|
3635
|
+
owner,
|
|
3636
|
+
name
|
|
3637
|
+
});
|
|
3291
3638
|
if (!versionRange) {
|
|
3292
3639
|
console.error(
|
|
3293
3640
|
"Error: Version is required for deprecation. Use format: @user/{username}/{name}@{version}"
|
|
@@ -3296,23 +3643,15 @@ async function deprecate(specifier, message, options) {
|
|
|
3296
3643
|
}
|
|
3297
3644
|
configure2({ registryUrl, apiKey });
|
|
3298
3645
|
if (options.undo) {
|
|
3299
|
-
console.log(
|
|
3300
|
-
|
|
3301
|
-
);
|
|
3302
|
-
const response = await undeprecateSkillVersion(
|
|
3303
|
-
username,
|
|
3304
|
-
name,
|
|
3305
|
-
versionRange
|
|
3306
|
-
);
|
|
3646
|
+
console.log(`Removing deprecation from ${fullName}@${versionRange}...`);
|
|
3647
|
+
const response = await undeprecateSkillVersion(owner, name, versionRange);
|
|
3307
3648
|
if (response.status !== 200) {
|
|
3308
3649
|
console.error(
|
|
3309
3650
|
`Error: ${response.error || "Failed to remove deprecation"}`
|
|
3310
3651
|
);
|
|
3311
3652
|
process.exit(1);
|
|
3312
3653
|
}
|
|
3313
|
-
console.log(
|
|
3314
|
-
`Removed deprecation from @user/${username}/${name}@${versionRange}`
|
|
3315
|
-
);
|
|
3654
|
+
console.log(`Removed deprecation from ${fullName}@${versionRange}`);
|
|
3316
3655
|
} else {
|
|
3317
3656
|
if (!message) {
|
|
3318
3657
|
console.error(
|
|
@@ -3320,9 +3659,9 @@ async function deprecate(specifier, message, options) {
|
|
|
3320
3659
|
);
|
|
3321
3660
|
process.exit(1);
|
|
3322
3661
|
}
|
|
3323
|
-
console.log(`Deprecating
|
|
3662
|
+
console.log(`Deprecating ${fullName}@${versionRange}...`);
|
|
3324
3663
|
const response = await deprecateSkillVersion(
|
|
3325
|
-
|
|
3664
|
+
owner,
|
|
3326
3665
|
name,
|
|
3327
3666
|
versionRange,
|
|
3328
3667
|
message
|
|
@@ -3333,7 +3672,7 @@ async function deprecate(specifier, message, options) {
|
|
|
3333
3672
|
);
|
|
3334
3673
|
process.exit(1);
|
|
3335
3674
|
}
|
|
3336
|
-
console.log(`Deprecated
|
|
3675
|
+
console.log(`Deprecated ${fullName}@${versionRange}`);
|
|
3337
3676
|
console.log(`Message: ${message}`);
|
|
3338
3677
|
console.log("");
|
|
3339
3678
|
console.log(
|
|
@@ -3573,8 +3912,8 @@ init_config();
|
|
|
3573
3912
|
init_errors();
|
|
3574
3913
|
init_github();
|
|
3575
3914
|
init_lib();
|
|
3576
|
-
|
|
3577
|
-
|
|
3915
|
+
init_lockfile3();
|
|
3916
|
+
init_manifest3();
|
|
3578
3917
|
init_symlinks();
|
|
3579
3918
|
function getCacheFilePath(cacheDir, integrity) {
|
|
3580
3919
|
const match = integrity.match(/^sha256-(.+)$/);
|
|
@@ -3659,14 +3998,14 @@ async function installFromLockfile(options) {
|
|
|
3659
3998
|
`);
|
|
3660
3999
|
configure2({ registryUrl, apiKey });
|
|
3661
4000
|
for (const { fullName, versionRange } of missingDeps) {
|
|
3662
|
-
const parsed =
|
|
4001
|
+
const parsed = parseRegistrySpecifier2(fullName);
|
|
3663
4002
|
if (!parsed) {
|
|
3664
4003
|
console.error(`Error: Invalid dependency specifier: ${fullName}`);
|
|
3665
4004
|
continue;
|
|
3666
4005
|
}
|
|
3667
|
-
const {
|
|
4006
|
+
const { owner, name } = parsed;
|
|
3668
4007
|
console.log(`Resolving ${fullName}@${versionRange}...`);
|
|
3669
|
-
const versionsResponse = await listSkillVersions(
|
|
4008
|
+
const versionsResponse = await listSkillVersions(owner, name);
|
|
3670
4009
|
if (versionsResponse.status !== 200) {
|
|
3671
4010
|
const errorMessage = extractApiErrorMessage(
|
|
3672
4011
|
versionsResponse,
|
|
@@ -3683,14 +4022,14 @@ async function installFromLockfile(options) {
|
|
|
3683
4022
|
const versionStrings = versions.map(
|
|
3684
4023
|
(v) => v.version
|
|
3685
4024
|
);
|
|
3686
|
-
const resolved =
|
|
4025
|
+
const resolved = resolveVersion2(versionRange || "*", versionStrings);
|
|
3687
4026
|
if (!resolved) {
|
|
3688
4027
|
console.error(
|
|
3689
4028
|
`Error: No version matching "${versionRange}" for ${fullName}`
|
|
3690
4029
|
);
|
|
3691
4030
|
continue;
|
|
3692
4031
|
}
|
|
3693
|
-
const versionResponse = await getSkillVersion(
|
|
4032
|
+
const versionResponse = await getSkillVersion(owner, name, resolved);
|
|
3694
4033
|
if (versionResponse.status !== 200 || !versionResponse.data) {
|
|
3695
4034
|
const errorMessage = extractApiErrorMessage(
|
|
3696
4035
|
versionResponse,
|
|
@@ -3750,7 +4089,7 @@ Resolving ${missingGitHubDeps.length} GitHub dependency(ies)...
|
|
|
3750
4089
|
`
|
|
3751
4090
|
);
|
|
3752
4091
|
for (const { specifier, ref } of missingGitHubDeps) {
|
|
3753
|
-
const parsed =
|
|
4092
|
+
const parsed = parseGitHubSpecifier2(specifier);
|
|
3754
4093
|
if (!parsed) {
|
|
3755
4094
|
console.error(`Error: Invalid GitHub specifier: ${specifier}`);
|
|
3756
4095
|
continue;
|
|
@@ -3810,12 +4149,12 @@ Installing ${packageCount} registry skill(s)...
|
|
|
3810
4149
|
const installOrder = computeInstallOrder(packages);
|
|
3811
4150
|
const entries = installOrder.filter((name) => packages[name]).map((name) => [name, packages[name]]);
|
|
3812
4151
|
for (const [fullName, entry] of entries) {
|
|
3813
|
-
const
|
|
3814
|
-
if (!
|
|
4152
|
+
const parsedName = parseRegistrySpecifier2(fullName);
|
|
4153
|
+
if (!parsedName) {
|
|
3815
4154
|
console.warn(`Warning: Invalid skill name in lockfile: ${fullName}`);
|
|
3816
4155
|
continue;
|
|
3817
4156
|
}
|
|
3818
|
-
const
|
|
4157
|
+
const { namespace: ns, owner: pkgOwner, name, subname } = parsedName;
|
|
3819
4158
|
console.log(`Installing ${fullName}@${entry.version}...`);
|
|
3820
4159
|
let tarballBuffer;
|
|
3821
4160
|
let fromCache = false;
|
|
@@ -3864,7 +4203,21 @@ Installing ${packageCount} registry skill(s)...
|
|
|
3864
4203
|
}
|
|
3865
4204
|
await writeToCache(cacheDir, entry.integrity, tarballBuffer);
|
|
3866
4205
|
}
|
|
3867
|
-
const
|
|
4206
|
+
const effectiveSkillName = subname ?? name;
|
|
4207
|
+
let destDir;
|
|
4208
|
+
if (ns === "org") {
|
|
4209
|
+
destDir = join(skillsDir, "_org", pkgOwner, effectiveSkillName);
|
|
4210
|
+
} else if (ns === "github" && subname) {
|
|
4211
|
+
destDir = join(
|
|
4212
|
+
skillsDir,
|
|
4213
|
+
"_github-registry",
|
|
4214
|
+
pkgOwner,
|
|
4215
|
+
name,
|
|
4216
|
+
subname
|
|
4217
|
+
);
|
|
4218
|
+
} else {
|
|
4219
|
+
destDir = join(skillsDir, pkgOwner, effectiveSkillName);
|
|
4220
|
+
}
|
|
3868
4221
|
await rm(destDir, { recursive: true, force: true });
|
|
3869
4222
|
await mkdir(destDir, { recursive: true });
|
|
3870
4223
|
const tempFile = join(destDir, ".temp.tgz");
|
|
@@ -3882,9 +4235,10 @@ Installing ${packageCount} registry skill(s)...
|
|
|
3882
4235
|
console.log(
|
|
3883
4236
|
` Installed to ${destDir}${fromCache ? " (from cache)" : ""}`
|
|
3884
4237
|
);
|
|
4238
|
+
const pathSkillName = ns === "github" && subname ? `${name}/${subname}` : name;
|
|
3885
4239
|
installedSkills.push({
|
|
3886
|
-
name,
|
|
3887
|
-
sourcePath: getRegistrySkillPath(
|
|
4240
|
+
name: effectiveSkillName,
|
|
4241
|
+
sourcePath: getRegistrySkillPath(ns, pkgOwner, pathSkillName)
|
|
3888
4242
|
});
|
|
3889
4243
|
}
|
|
3890
4244
|
}
|
|
@@ -3895,7 +4249,7 @@ Installing ${packageCount} registry skill(s)...
|
|
|
3895
4249
|
Installing ${githubCount} GitHub skill(s)...
|
|
3896
4250
|
`);
|
|
3897
4251
|
for (const [specifier, entry] of Object.entries(githubPackages)) {
|
|
3898
|
-
const parsed =
|
|
4252
|
+
const parsed = parseGitHubSpecifier2(specifier);
|
|
3899
4253
|
if (!parsed) {
|
|
3900
4254
|
console.warn(
|
|
3901
4255
|
`Warning: Invalid GitHub specifier in lockfile: ${specifier}`
|
|
@@ -3950,7 +4304,7 @@ Installing ${githubCount} GitHub skill(s)...
|
|
|
3950
4304
|
console.log(
|
|
3951
4305
|
` Installed to ${destPath}${fromCache ? " (from cache)" : ""}`
|
|
3952
4306
|
);
|
|
3953
|
-
const skillName =
|
|
4307
|
+
const skillName = getGitHubSkillName2(parsed);
|
|
3954
4308
|
installedSkills.push({
|
|
3955
4309
|
name: skillName,
|
|
3956
4310
|
sourcePath: getGitHubSkillPath(
|
|
@@ -3996,8 +4350,8 @@ All ${totalCount} skill(s) installed.`);
|
|
|
3996
4350
|
// src/commands/link.ts
|
|
3997
4351
|
init_agents();
|
|
3998
4352
|
init_lib();
|
|
3999
|
-
|
|
4000
|
-
|
|
4353
|
+
init_lockfile3();
|
|
4354
|
+
init_manifest3();
|
|
4001
4355
|
init_symlinks();
|
|
4002
4356
|
async function link(options) {
|
|
4003
4357
|
try {
|
|
@@ -4025,26 +4379,32 @@ async function link(options) {
|
|
|
4025
4379
|
const skills = [];
|
|
4026
4380
|
const registrySkills = await listLockfileSkills();
|
|
4027
4381
|
for (const { name } of registrySkills) {
|
|
4028
|
-
const parsed =
|
|
4382
|
+
const parsed = parseRegistrySpecifier2(name);
|
|
4029
4383
|
if (!parsed) {
|
|
4030
4384
|
console.warn(`Warning: Invalid skill name in lockfile: ${name}`);
|
|
4031
4385
|
continue;
|
|
4032
4386
|
}
|
|
4387
|
+
const effectiveName = parsed.subname ?? parsed.name;
|
|
4388
|
+
const pathName = parsed.namespace === "github" && parsed.subname ? `${parsed.name}/${parsed.subname}` : parsed.name;
|
|
4033
4389
|
skills.push({
|
|
4034
|
-
name:
|
|
4035
|
-
sourcePath: getRegistrySkillPath(
|
|
4390
|
+
name: effectiveName,
|
|
4391
|
+
sourcePath: getRegistrySkillPath(
|
|
4392
|
+
parsed.namespace,
|
|
4393
|
+
parsed.owner,
|
|
4394
|
+
pathName
|
|
4395
|
+
)
|
|
4036
4396
|
});
|
|
4037
4397
|
}
|
|
4038
4398
|
const githubSkills = await listLockfileGitHubPackages();
|
|
4039
4399
|
for (const { specifier } of githubSkills) {
|
|
4040
|
-
const parsed =
|
|
4400
|
+
const parsed = parseGitHubSpecifier2(specifier);
|
|
4041
4401
|
if (!parsed) {
|
|
4042
4402
|
console.warn(
|
|
4043
4403
|
`Warning: Invalid GitHub specifier in lockfile: ${specifier}`
|
|
4044
4404
|
);
|
|
4045
4405
|
continue;
|
|
4046
4406
|
}
|
|
4047
|
-
const skillName =
|
|
4407
|
+
const skillName = getGitHubSkillName2(parsed);
|
|
4048
4408
|
skills.push({
|
|
4049
4409
|
name: skillName,
|
|
4050
4410
|
sourcePath: getGitHubSkillPath(parsed.owner, parsed.repo, parsed.path)
|
|
@@ -4079,8 +4439,8 @@ async function link(options) {
|
|
|
4079
4439
|
// src/commands/list.ts
|
|
4080
4440
|
init_agents();
|
|
4081
4441
|
init_lib();
|
|
4082
|
-
|
|
4083
|
-
|
|
4442
|
+
init_lockfile3();
|
|
4443
|
+
init_manifest3();
|
|
4084
4444
|
init_symlinks();
|
|
4085
4445
|
async function list(options) {
|
|
4086
4446
|
try {
|
|
@@ -4097,10 +4457,15 @@ async function list(options) {
|
|
|
4097
4457
|
const projectRoot = process.cwd();
|
|
4098
4458
|
const skills = [];
|
|
4099
4459
|
for (const { name: fullName, entry } of registrySkills) {
|
|
4100
|
-
const
|
|
4101
|
-
if (!
|
|
4102
|
-
const
|
|
4103
|
-
const
|
|
4460
|
+
const parsed = parseRegistrySpecifier2(fullName);
|
|
4461
|
+
if (!parsed) continue;
|
|
4462
|
+
const skillName = parsed.subname ?? parsed.name;
|
|
4463
|
+
const pathName = parsed.namespace === "github" && parsed.subname ? `${parsed.name}/${parsed.subname}` : parsed.name;
|
|
4464
|
+
const sourcePath = getRegistrySkillPath(
|
|
4465
|
+
parsed.namespace,
|
|
4466
|
+
parsed.owner,
|
|
4467
|
+
pathName
|
|
4468
|
+
);
|
|
4104
4469
|
const absolutePath = join(projectRoot, sourcePath);
|
|
4105
4470
|
let status = "installed";
|
|
4106
4471
|
try {
|
|
@@ -4125,10 +4490,10 @@ async function list(options) {
|
|
|
4125
4490
|
});
|
|
4126
4491
|
}
|
|
4127
4492
|
for (const { specifier, entry } of githubSkills) {
|
|
4128
|
-
const parsed =
|
|
4493
|
+
const parsed = parseGitHubSpecifier2(specifier);
|
|
4129
4494
|
if (!parsed) continue;
|
|
4130
4495
|
const ghEntry = entry;
|
|
4131
|
-
const skillName =
|
|
4496
|
+
const skillName = getGitHubSkillName2(parsed);
|
|
4132
4497
|
const sourcePath = getGitHubSkillPath(
|
|
4133
4498
|
parsed.owner,
|
|
4134
4499
|
parsed.repo,
|
|
@@ -4442,7 +4807,7 @@ async function logout() {
|
|
|
4442
4807
|
|
|
4443
4808
|
// src/commands/migrate.ts
|
|
4444
4809
|
init_config();
|
|
4445
|
-
|
|
4810
|
+
init_lockfile3();
|
|
4446
4811
|
async function migrate(options) {
|
|
4447
4812
|
try {
|
|
4448
4813
|
const legacySkillsDir = getLegacySkillsDir();
|
|
@@ -4542,20 +4907,20 @@ async function migrate(options) {
|
|
|
4542
4907
|
process.exit(1);
|
|
4543
4908
|
}
|
|
4544
4909
|
}
|
|
4545
|
-
function
|
|
4546
|
-
const sorted = availableVersions.filter((v) =>
|
|
4910
|
+
function resolveVersion3(range, availableVersions) {
|
|
4911
|
+
const sorted = availableVersions.filter((v) => semver2.valid(v)).sort((a, b) => semver2.rcompare(a, b));
|
|
4547
4912
|
if (range === "latest") {
|
|
4548
4913
|
return sorted[0] ?? null;
|
|
4549
4914
|
}
|
|
4550
|
-
return
|
|
4915
|
+
return semver2.maxSatisfying(sorted, range);
|
|
4551
4916
|
}
|
|
4552
|
-
function
|
|
4553
|
-
return
|
|
4917
|
+
function compareVersions3(a, b) {
|
|
4918
|
+
return semver2.compare(a, b);
|
|
4554
4919
|
}
|
|
4555
|
-
function
|
|
4556
|
-
const
|
|
4557
|
-
if (
|
|
4558
|
-
return
|
|
4920
|
+
function getLatestVersion3(versions) {
|
|
4921
|
+
const valid5 = versions.filter((v) => semver2.valid(v));
|
|
4922
|
+
if (valid5.length === 0) return null;
|
|
4923
|
+
return valid5.sort((a, b) => semver2.rcompare(a, b))[0];
|
|
4559
4924
|
}
|
|
4560
4925
|
|
|
4561
4926
|
// ../../packages/server/skill-registry/src/client/outdated.ts
|
|
@@ -4588,14 +4953,14 @@ function createOutdatedChecker(config2) {
|
|
|
4588
4953
|
const versions = await fetchRegistryVersions(username, name);
|
|
4589
4954
|
const versionStrings = versions.map((v) => v.version);
|
|
4590
4955
|
const range = versionRange || "*";
|
|
4591
|
-
const wanted =
|
|
4592
|
-
const latest =
|
|
4956
|
+
const wanted = resolveVersion3(range, versionStrings);
|
|
4957
|
+
const latest = getLatestVersion3(versionStrings);
|
|
4593
4958
|
const currentVersionInfo = versions.find(
|
|
4594
4959
|
(v) => v.version === entry.version
|
|
4595
4960
|
);
|
|
4596
4961
|
const deprecated = currentVersionInfo?.deprecationMessage ?? void 0;
|
|
4597
|
-
const isOutdated = wanted !== null &&
|
|
4598
|
-
const wantedBehindLatest = wanted !== null && latest !== null &&
|
|
4962
|
+
const isOutdated = wanted !== null && compareVersions3(entry.version, wanted) < 0 || latest !== null && compareVersions3(entry.version, latest) < 0;
|
|
4963
|
+
const wantedBehindLatest = wanted !== null && latest !== null && compareVersions3(wanted, latest) < 0;
|
|
4599
4964
|
return {
|
|
4600
4965
|
name: specifier,
|
|
4601
4966
|
current: entry.version,
|
|
@@ -4728,8 +5093,8 @@ async function checkOutdated(config2, options) {
|
|
|
4728
5093
|
|
|
4729
5094
|
// src/commands/outdated.ts
|
|
4730
5095
|
init_config();
|
|
4731
|
-
|
|
4732
|
-
|
|
5096
|
+
init_lockfile3();
|
|
5097
|
+
init_manifest3();
|
|
4733
5098
|
async function outdated(packages, options) {
|
|
4734
5099
|
try {
|
|
4735
5100
|
const lockfile = await readLockfile();
|
|
@@ -4937,8 +5302,8 @@ async function publishCommand(options) {
|
|
|
4937
5302
|
dependencies: manifest.dependencies
|
|
4938
5303
|
};
|
|
4939
5304
|
if (options.bump) {
|
|
4940
|
-
const
|
|
4941
|
-
const newVersion =
|
|
5305
|
+
const semver6 = await import('semver');
|
|
5306
|
+
const newVersion = semver6.default.inc(packageJson2.version, options.bump);
|
|
4942
5307
|
if (!newVersion) {
|
|
4943
5308
|
console.error(
|
|
4944
5309
|
`Error: Failed to bump version from ${packageJson2.version}`
|
|
@@ -5048,13 +5413,25 @@ async function publishCommand(options) {
|
|
|
5048
5413
|
console.log("");
|
|
5049
5414
|
console.log(`pspm notice Publishing to ${registryUrl} with tag latest`);
|
|
5050
5415
|
configure2({ registryUrl, apiKey });
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5416
|
+
let response;
|
|
5417
|
+
if (options.org) {
|
|
5418
|
+
response = await publishOrgSkill(options.org, {
|
|
5419
|
+
manifest: packageJson2,
|
|
5420
|
+
tarballBase64,
|
|
5421
|
+
visibility: options.access
|
|
5422
|
+
});
|
|
5423
|
+
} else {
|
|
5424
|
+
response = await publishSkill({
|
|
5425
|
+
manifest: packageJson2,
|
|
5426
|
+
tarballBase64,
|
|
5427
|
+
visibility: options.access
|
|
5428
|
+
});
|
|
5429
|
+
}
|
|
5056
5430
|
if (response.status !== 200) {
|
|
5057
|
-
const errorMessage = extractApiErrorMessage(
|
|
5431
|
+
const errorMessage = extractApiErrorMessage(
|
|
5432
|
+
{ status: response.status, data: response.data },
|
|
5433
|
+
"Publish failed"
|
|
5434
|
+
);
|
|
5058
5435
|
if (errorMessage.includes("must be greater than") || errorMessage.includes("already exists")) {
|
|
5059
5436
|
console.error("pspm error code E403");
|
|
5060
5437
|
console.error(
|
|
@@ -5065,9 +5442,11 @@ async function publishCommand(options) {
|
|
|
5065
5442
|
}
|
|
5066
5443
|
const result = response.data;
|
|
5067
5444
|
const visibility = result.skill.visibility;
|
|
5068
|
-
const visibilityIcon = visibility === "public" ? "\u{1F310}" : "\u{1F512}";
|
|
5445
|
+
const visibilityIcon = visibility === "public" ? "\u{1F310}" : visibility === "team" ? "\u{1F465}" : "\u{1F512}";
|
|
5446
|
+
const namespace = options.org ? "org" : result.skill.namespace ?? "user";
|
|
5447
|
+
const owner = options.org ?? result.skill.username;
|
|
5069
5448
|
console.log(
|
|
5070
|
-
`+
|
|
5449
|
+
`+ @${namespace}/${owner}/${result.skill.name}@${result.version.version}`
|
|
5071
5450
|
);
|
|
5072
5451
|
console.log(`Checksum: ${result.version.checksum}`);
|
|
5073
5452
|
console.log(`Visibility: ${visibilityIcon} ${visibility}`);
|
|
@@ -5094,17 +5473,17 @@ async function publishCommand(options) {
|
|
|
5094
5473
|
init_agents();
|
|
5095
5474
|
init_config();
|
|
5096
5475
|
init_lib();
|
|
5097
|
-
|
|
5098
|
-
|
|
5476
|
+
init_lockfile3();
|
|
5477
|
+
init_manifest3();
|
|
5099
5478
|
init_symlinks();
|
|
5100
5479
|
async function remove(nameOrSpecifier) {
|
|
5101
5480
|
try {
|
|
5102
5481
|
const manifest = await readManifest();
|
|
5103
5482
|
const agentConfigs = manifest?.agents;
|
|
5104
5483
|
const agents = getAvailableAgents(agentConfigs);
|
|
5105
|
-
if (
|
|
5484
|
+
if (isGitHubSpecifier2(nameOrSpecifier)) {
|
|
5106
5485
|
await removeGitHub(nameOrSpecifier, agents, agentConfigs);
|
|
5107
|
-
} else if (nameOrSpecifier
|
|
5486
|
+
} else if (isRegistrySpecifier2(nameOrSpecifier)) {
|
|
5108
5487
|
await removeRegistry(nameOrSpecifier, agents, agentConfigs);
|
|
5109
5488
|
} else {
|
|
5110
5489
|
await removeByShortName(nameOrSpecifier, agents, agentConfigs);
|
|
@@ -5116,14 +5495,13 @@ async function remove(nameOrSpecifier) {
|
|
|
5116
5495
|
}
|
|
5117
5496
|
}
|
|
5118
5497
|
async function removeRegistry(specifier, agents, agentConfigs) {
|
|
5119
|
-
const
|
|
5120
|
-
if (!
|
|
5498
|
+
const parsed = parseRegistrySpecifier2(specifier);
|
|
5499
|
+
if (!parsed) {
|
|
5121
5500
|
console.error(`Error: Invalid skill specifier: ${specifier}`);
|
|
5122
5501
|
process.exit(1);
|
|
5123
5502
|
}
|
|
5124
|
-
const
|
|
5125
|
-
const
|
|
5126
|
-
const name = match[2];
|
|
5503
|
+
const { namespace, owner, name } = parsed;
|
|
5504
|
+
const fullName = `@${namespace}/${owner}/${name}`;
|
|
5127
5505
|
console.log(`Removing ${fullName}...`);
|
|
5128
5506
|
const removedFromLockfile = await removeFromLockfile(fullName);
|
|
5129
5507
|
const removedFromManifest = await removeDependency(fullName);
|
|
@@ -5137,7 +5515,7 @@ async function removeRegistry(specifier, agents, agentConfigs) {
|
|
|
5137
5515
|
agentConfigs
|
|
5138
5516
|
});
|
|
5139
5517
|
const skillsDir = getSkillsDir();
|
|
5140
|
-
const destDir = join(skillsDir,
|
|
5518
|
+
const destDir = namespace === "org" ? join(skillsDir, "_org", owner, name) : join(skillsDir, owner, name);
|
|
5141
5519
|
try {
|
|
5142
5520
|
await rm(destDir, { recursive: true, force: true });
|
|
5143
5521
|
} catch {
|
|
@@ -5145,7 +5523,7 @@ async function removeRegistry(specifier, agents, agentConfigs) {
|
|
|
5145
5523
|
console.log(`Removed ${fullName}`);
|
|
5146
5524
|
}
|
|
5147
5525
|
async function removeGitHub(specifier, agents, agentConfigs) {
|
|
5148
|
-
const parsed =
|
|
5526
|
+
const parsed = parseGitHubSpecifier2(specifier);
|
|
5149
5527
|
if (!parsed) {
|
|
5150
5528
|
console.error(`Error: Invalid GitHub specifier: ${specifier}`);
|
|
5151
5529
|
process.exit(1);
|
|
@@ -5158,7 +5536,7 @@ async function removeGitHub(specifier, agents, agentConfigs) {
|
|
|
5158
5536
|
console.error(`Error: ${lockfileKey} not found in lockfile or pspm.json`);
|
|
5159
5537
|
process.exit(1);
|
|
5160
5538
|
}
|
|
5161
|
-
const skillName =
|
|
5539
|
+
const skillName = getGitHubSkillName2(parsed);
|
|
5162
5540
|
await removeAgentSymlinks(skillName, {
|
|
5163
5541
|
agents,
|
|
5164
5542
|
projectRoot: process.cwd(),
|
|
@@ -5176,8 +5554,8 @@ async function removeGitHub(specifier, agents, agentConfigs) {
|
|
|
5176
5554
|
async function removeByShortName(shortName, agents, agentConfigs) {
|
|
5177
5555
|
const registrySkills = await listLockfileSkills();
|
|
5178
5556
|
const foundRegistry = registrySkills.find((s) => {
|
|
5179
|
-
const
|
|
5180
|
-
return
|
|
5557
|
+
const parsed = parseRegistrySpecifier2(s.name);
|
|
5558
|
+
return parsed && parsed.name === shortName;
|
|
5181
5559
|
});
|
|
5182
5560
|
if (foundRegistry) {
|
|
5183
5561
|
await removeRegistry(foundRegistry.name, agents, agentConfigs);
|
|
@@ -5185,9 +5563,9 @@ async function removeByShortName(shortName, agents, agentConfigs) {
|
|
|
5185
5563
|
}
|
|
5186
5564
|
const githubSkills = await listLockfileGitHubPackages();
|
|
5187
5565
|
const foundGitHub = githubSkills.find((s) => {
|
|
5188
|
-
const parsed =
|
|
5566
|
+
const parsed = parseGitHubSpecifier2(s.specifier);
|
|
5189
5567
|
if (!parsed) return false;
|
|
5190
|
-
return
|
|
5568
|
+
return getGitHubSkillName2(parsed) === shortName;
|
|
5191
5569
|
});
|
|
5192
5570
|
if (foundGitHub) {
|
|
5193
5571
|
await removeGitHub(foundGitHub.specifier, agents, agentConfigs);
|
|
@@ -5240,7 +5618,7 @@ async function search(query, options) {
|
|
|
5240
5618
|
return;
|
|
5241
5619
|
}
|
|
5242
5620
|
for (const skill of skills) {
|
|
5243
|
-
const name =
|
|
5621
|
+
const name = `@${skill.namespace ?? "user"}/${skill.username}/${skill.name}`;
|
|
5244
5622
|
const desc = skill.description ? ` - ${skill.description.slice(0, 80)}${skill.description.length > 80 ? "..." : ""}` : "";
|
|
5245
5623
|
const downloads = skill.totalDownloads > 0 ? ` (${formatDownloads(skill.totalDownloads)} downloads)` : "";
|
|
5246
5624
|
console.log(` ${name}${downloads}`);
|
|
@@ -5260,7 +5638,7 @@ ${total} skill(s) found.`);
|
|
|
5260
5638
|
const first = skills[0];
|
|
5261
5639
|
console.log(
|
|
5262
5640
|
`
|
|
5263
|
-
Install with: pspm add
|
|
5641
|
+
Install with: pspm add @${first.namespace ?? "user"}/${first.username}/${first.name}`
|
|
5264
5642
|
);
|
|
5265
5643
|
}
|
|
5266
5644
|
} catch (error) {
|
|
@@ -5288,14 +5666,19 @@ async function unpublish(specifier, options) {
|
|
|
5288
5666
|
try {
|
|
5289
5667
|
const apiKey = await requireApiKey();
|
|
5290
5668
|
const registryUrl = await getRegistryUrl();
|
|
5291
|
-
const parsed =
|
|
5669
|
+
const parsed = parseRegistrySpecifier2(specifier);
|
|
5292
5670
|
if (!parsed) {
|
|
5293
5671
|
console.error(
|
|
5294
|
-
`Error: Invalid skill specifier "${specifier}". Use format: @user/{username}/{name}[@{version}]`
|
|
5672
|
+
`Error: Invalid skill specifier "${specifier}". Use format: @user/{username}/{name}[@{version}] or @org/{orgname}/{name}[@{version}]`
|
|
5295
5673
|
);
|
|
5296
5674
|
process.exit(1);
|
|
5297
5675
|
}
|
|
5298
|
-
const {
|
|
5676
|
+
const { owner, name, versionRange } = parsed;
|
|
5677
|
+
const fullName = generateRegistryIdentifier2({
|
|
5678
|
+
namespace: parsed.namespace,
|
|
5679
|
+
owner,
|
|
5680
|
+
name
|
|
5681
|
+
});
|
|
5299
5682
|
configure2({ registryUrl, apiKey });
|
|
5300
5683
|
if (versionRange) {
|
|
5301
5684
|
console.log(`Unpublishing ${specifier}...`);
|
|
@@ -5305,7 +5688,7 @@ async function unpublish(specifier, options) {
|
|
|
5305
5688
|
);
|
|
5306
5689
|
process.exit(1);
|
|
5307
5690
|
}
|
|
5308
|
-
const response = await deleteSkillVersion(
|
|
5691
|
+
const response = await deleteSkillVersion(owner, name, versionRange);
|
|
5309
5692
|
if (response.status !== 200) {
|
|
5310
5693
|
const errorMessage = extractApiErrorMessage(
|
|
5311
5694
|
response,
|
|
@@ -5314,16 +5697,16 @@ async function unpublish(specifier, options) {
|
|
|
5314
5697
|
console.error(`Error: ${errorMessage}`);
|
|
5315
5698
|
process.exit(1);
|
|
5316
5699
|
}
|
|
5317
|
-
console.log(`Unpublished
|
|
5700
|
+
console.log(`Unpublished ${fullName}@${versionRange}`);
|
|
5318
5701
|
} else {
|
|
5319
|
-
console.log(`Unpublishing all versions of
|
|
5702
|
+
console.log(`Unpublishing all versions of ${fullName}...`);
|
|
5320
5703
|
if (!options.force) {
|
|
5321
5704
|
console.error(
|
|
5322
5705
|
"Warning: This will delete ALL versions. Use --force to confirm."
|
|
5323
5706
|
);
|
|
5324
5707
|
process.exit(1);
|
|
5325
5708
|
}
|
|
5326
|
-
const response = await deleteSkill(
|
|
5709
|
+
const response = await deleteSkill(owner, name);
|
|
5327
5710
|
if (response.status !== 200) {
|
|
5328
5711
|
const errorMessage = extractApiErrorMessage(
|
|
5329
5712
|
response,
|
|
@@ -5332,7 +5715,7 @@ async function unpublish(specifier, options) {
|
|
|
5332
5715
|
console.error(`Error: ${errorMessage}`);
|
|
5333
5716
|
process.exit(1);
|
|
5334
5717
|
}
|
|
5335
|
-
console.log(`Unpublished
|
|
5718
|
+
console.log(`Unpublished ${fullName} (all versions)`);
|
|
5336
5719
|
}
|
|
5337
5720
|
} catch (error) {
|
|
5338
5721
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -5346,7 +5729,7 @@ init_api_client();
|
|
|
5346
5729
|
init_config();
|
|
5347
5730
|
init_errors();
|
|
5348
5731
|
init_lib();
|
|
5349
|
-
|
|
5732
|
+
init_lockfile3();
|
|
5350
5733
|
init_add();
|
|
5351
5734
|
async function update(options) {
|
|
5352
5735
|
try {
|
|
@@ -5362,11 +5745,13 @@ async function update(options) {
|
|
|
5362
5745
|
const updates = [];
|
|
5363
5746
|
console.log("Checking for updates...\n");
|
|
5364
5747
|
for (const { name, entry } of skills) {
|
|
5365
|
-
const
|
|
5366
|
-
if (!
|
|
5367
|
-
const [, username, skillName] = match;
|
|
5748
|
+
const parsed = parseRegistrySpecifier2(name);
|
|
5749
|
+
if (!parsed) continue;
|
|
5368
5750
|
try {
|
|
5369
|
-
const versionsResponse = await listSkillVersions(
|
|
5751
|
+
const versionsResponse = await listSkillVersions(
|
|
5752
|
+
parsed.owner,
|
|
5753
|
+
parsed.name
|
|
5754
|
+
);
|
|
5370
5755
|
if (versionsResponse.status !== 200) {
|
|
5371
5756
|
const errorMessage = extractApiErrorMessage(
|
|
5372
5757
|
versionsResponse,
|
|
@@ -5380,7 +5765,7 @@ async function update(options) {
|
|
|
5380
5765
|
const versionStrings = versions.map(
|
|
5381
5766
|
(v) => v.version
|
|
5382
5767
|
);
|
|
5383
|
-
const latest =
|
|
5768
|
+
const latest = resolveVersion2("*", versionStrings);
|
|
5384
5769
|
if (latest && latest !== entry.version) {
|
|
5385
5770
|
updates.push({
|
|
5386
5771
|
name,
|
|
@@ -5405,11 +5790,10 @@ async function update(options) {
|
|
|
5405
5790
|
return;
|
|
5406
5791
|
}
|
|
5407
5792
|
console.log("\nUpdating...\n");
|
|
5408
|
-
for (const { name, latest } of updates) {
|
|
5409
|
-
const
|
|
5410
|
-
if (!
|
|
5411
|
-
const
|
|
5412
|
-
const specifier = `@user/${username}/${skillName}@${latest}`;
|
|
5793
|
+
for (const { name: pkgName, latest } of updates) {
|
|
5794
|
+
const parsed = parseRegistrySpecifier2(pkgName);
|
|
5795
|
+
if (!parsed) continue;
|
|
5796
|
+
const specifier = `${pkgName}@${latest}`;
|
|
5413
5797
|
await add([specifier], {});
|
|
5414
5798
|
}
|
|
5415
5799
|
console.log("\nAll skills updated.");
|
|
@@ -5424,12 +5808,12 @@ async function upgrade() {
|
|
|
5424
5808
|
try {
|
|
5425
5809
|
const currentVersion = getCurrentVersion();
|
|
5426
5810
|
console.log("Checking for updates...\n");
|
|
5427
|
-
const latestVersion =
|
|
5811
|
+
const latestVersion = getLatestVersion4(packageName);
|
|
5428
5812
|
if (!latestVersion) {
|
|
5429
5813
|
console.error("Error: Could not fetch latest version from registry.");
|
|
5430
5814
|
process.exit(1);
|
|
5431
5815
|
}
|
|
5432
|
-
if (currentVersion
|
|
5816
|
+
if (semver2.valid(currentVersion) && semver2.valid(latestVersion) && !semver2.gt(latestVersion, currentVersion)) {
|
|
5433
5817
|
console.log(`Already on the latest version: ${currentVersion}`);
|
|
5434
5818
|
return;
|
|
5435
5819
|
}
|
|
@@ -5462,7 +5846,7 @@ function getCurrentVersion() {
|
|
|
5462
5846
|
return "unknown";
|
|
5463
5847
|
}
|
|
5464
5848
|
}
|
|
5465
|
-
function
|
|
5849
|
+
function getLatestVersion4(packageName) {
|
|
5466
5850
|
try {
|
|
5467
5851
|
const output = execSync(`npm view ${packageName} version`, {
|
|
5468
5852
|
encoding: "utf-8",
|
|
@@ -5514,7 +5898,7 @@ function getInstallCommand(pm, packageName, version3) {
|
|
|
5514
5898
|
}
|
|
5515
5899
|
|
|
5516
5900
|
// src/commands/version.ts
|
|
5517
|
-
|
|
5901
|
+
init_manifest3();
|
|
5518
5902
|
async function version(bump, options = {}) {
|
|
5519
5903
|
try {
|
|
5520
5904
|
const manifest = await readManifest();
|
|
@@ -5530,7 +5914,7 @@ async function version(bump, options = {}) {
|
|
|
5530
5914
|
);
|
|
5531
5915
|
process.exit(1);
|
|
5532
5916
|
}
|
|
5533
|
-
if (!
|
|
5917
|
+
if (!semver2__default.valid(manifest.version)) {
|
|
5534
5918
|
console.error(
|
|
5535
5919
|
`Error: Current version "${manifest.version}" is not valid semver.`
|
|
5536
5920
|
);
|
|
@@ -5539,7 +5923,7 @@ async function version(bump, options = {}) {
|
|
|
5539
5923
|
);
|
|
5540
5924
|
process.exit(1);
|
|
5541
5925
|
}
|
|
5542
|
-
const newVersion =
|
|
5926
|
+
const newVersion = semver2__default.inc(manifest.version, bump);
|
|
5543
5927
|
if (!newVersion) {
|
|
5544
5928
|
console.error(`Error: Failed to bump version from ${manifest.version}`);
|
|
5545
5929
|
process.exit(1);
|
|
@@ -5585,6 +5969,9 @@ async function whoami() {
|
|
|
5585
5969
|
process.exit(1);
|
|
5586
5970
|
}
|
|
5587
5971
|
}
|
|
5972
|
+
|
|
5973
|
+
// src/update-notifier.ts
|
|
5974
|
+
init_version2();
|
|
5588
5975
|
var PACKAGE_NAME = "@anytio/pspm";
|
|
5589
5976
|
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
5590
5977
|
var CACHE_DIR = join(homedir(), ".pspm");
|
|
@@ -5593,7 +5980,7 @@ async function checkForUpdates(currentVersion) {
|
|
|
5593
5980
|
try {
|
|
5594
5981
|
const cache = await readCache();
|
|
5595
5982
|
if (cache && Date.now() - cache.lastCheck < CHECK_INTERVAL_MS) {
|
|
5596
|
-
if (cache.latestVersion
|
|
5983
|
+
if (isNewerVersion2(cache.latestVersion, currentVersion)) {
|
|
5597
5984
|
printUpdateWarning(currentVersion, cache.latestVersion);
|
|
5598
5985
|
}
|
|
5599
5986
|
return;
|
|
@@ -5628,7 +6015,7 @@ function fetchAndCache(currentVersion) {
|
|
|
5628
6015
|
};
|
|
5629
6016
|
writeCache(cache).catch(() => {
|
|
5630
6017
|
});
|
|
5631
|
-
if (latestVersion
|
|
6018
|
+
if (isNewerVersion2(latestVersion, currentVersion)) {
|
|
5632
6019
|
printUpdateWarning(currentVersion, latestVersion);
|
|
5633
6020
|
}
|
|
5634
6021
|
} catch {
|
|
@@ -5650,7 +6037,7 @@ var packageJson = JSON.parse(
|
|
|
5650
6037
|
);
|
|
5651
6038
|
var version2 = packageJson.version;
|
|
5652
6039
|
var program = new Command();
|
|
5653
|
-
program.name("pspm").description("
|
|
6040
|
+
program.name("pspm").description("Package manager for AI agent skills").version(version2);
|
|
5654
6041
|
var configCmd = program.command("config").description("Manage PSPM configuration");
|
|
5655
6042
|
configCmd.command("show").description("Show resolved configuration").action(async () => {
|
|
5656
6043
|
await configShow();
|
|
@@ -5762,19 +6149,24 @@ program.command("version <bump>").description("Bump package version (major, mino
|
|
|
5762
6149
|
dryRun: options.dryRun
|
|
5763
6150
|
});
|
|
5764
6151
|
});
|
|
5765
|
-
program.command("publish").description("Publish current directory as a skill").option("--bump <level>", "Bump version (major, minor, patch)").option("--tag <tag>", "Tag for the release").requiredOption(
|
|
6152
|
+
program.command("publish").description("Publish current directory as a skill").option("--bump <level>", "Bump version (major, minor, patch)").option("--tag <tag>", "Tag for the release").option("--org <orgname>", "Publish under an organization namespace").requiredOption(
|
|
5766
6153
|
"--access <level>",
|
|
5767
|
-
"Set package visibility (public or
|
|
6154
|
+
"Set package visibility (public, private, or team)"
|
|
5768
6155
|
).action(async (options) => {
|
|
5769
6156
|
const access3 = options.access;
|
|
5770
|
-
if (access3 !== "public" && access3 !== "private") {
|
|
5771
|
-
console.error('Error: --access must be "public" or "
|
|
6157
|
+
if (access3 !== "public" && access3 !== "private" && access3 !== "team") {
|
|
6158
|
+
console.error('Error: --access must be "public", "private", or "team"');
|
|
6159
|
+
process.exit(1);
|
|
6160
|
+
}
|
|
6161
|
+
if (access3 === "team" && !options.org) {
|
|
6162
|
+
console.error("Error: --access team requires --org <orgname>");
|
|
5772
6163
|
process.exit(1);
|
|
5773
6164
|
}
|
|
5774
6165
|
await publishCommand({
|
|
5775
6166
|
bump: options.bump,
|
|
5776
6167
|
tag: options.tag,
|
|
5777
|
-
access: access3
|
|
6168
|
+
access: access3,
|
|
6169
|
+
org: options.org
|
|
5778
6170
|
});
|
|
5779
6171
|
});
|
|
5780
6172
|
program.command("unpublish <specifier>").description(
|
|
@@ -5794,6 +6186,9 @@ program.command("deprecate <specifier> [message]").description(
|
|
|
5794
6186
|
await deprecate(specifier, message, { undo: options.undo });
|
|
5795
6187
|
});
|
|
5796
6188
|
await program.parseAsync();
|
|
5797
|
-
|
|
6189
|
+
var executedCommand = program.args[0];
|
|
6190
|
+
if (executedCommand !== "upgrade") {
|
|
6191
|
+
await checkForUpdates(version2);
|
|
6192
|
+
}
|
|
5798
6193
|
//# sourceMappingURL=index.js.map
|
|
5799
6194
|
//# sourceMappingURL=index.js.map
|