prpm 2.1.9 → 2.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +104 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -15710,6 +15710,7 @@ var init_prompts = __esm({
|
|
|
15710
15710
|
var collections_exports = {};
|
|
15711
15711
|
__export(collections_exports, {
|
|
15712
15712
|
createCollectionsCommand: () => createCollectionsCommand,
|
|
15713
|
+
handleCollectionDeprecate: () => handleCollectionDeprecate,
|
|
15713
15714
|
handleCollectionInfo: () => handleCollectionInfo,
|
|
15714
15715
|
handleCollectionInstall: () => handleCollectionInstall,
|
|
15715
15716
|
handleCollectionPublish: () => handleCollectionPublish,
|
|
@@ -16089,6 +16090,72 @@ async function handleCollectionPublish(manifestPath = "./collection.json") {
|
|
|
16089
16090
|
await telemetry.shutdown();
|
|
16090
16091
|
}
|
|
16091
16092
|
}
|
|
16093
|
+
async function handleCollectionDeprecate(collectionSpec, options) {
|
|
16094
|
+
const startTime = Date.now();
|
|
16095
|
+
try {
|
|
16096
|
+
const cleanSpec = collectionSpec.replace(/^collections\//, "").trim();
|
|
16097
|
+
const name_slug = cleanSpec.split("@")[0];
|
|
16098
|
+
if (!name_slug || name_slug.length === 0) {
|
|
16099
|
+
throw new CLIError("Collection name cannot be empty", 1);
|
|
16100
|
+
}
|
|
16101
|
+
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/.test(name_slug)) {
|
|
16102
|
+
throw new CLIError(
|
|
16103
|
+
`Invalid collection name "${name_slug}". Must be lowercase alphanumeric with hyphens (e.g., "my-collection")`,
|
|
16104
|
+
1
|
|
16105
|
+
);
|
|
16106
|
+
}
|
|
16107
|
+
const config = await getConfig();
|
|
16108
|
+
if (!config.token) {
|
|
16109
|
+
console.error("\n\u274C Authentication required. Run `prpm login` first.\n");
|
|
16110
|
+
throw new CLIError("Authentication required. Run `prpm login` first.", 1);
|
|
16111
|
+
}
|
|
16112
|
+
const client = (0, import_registry_client4.getRegistryClient)(config);
|
|
16113
|
+
const action = options.undo ? "Undeprecating" : "Deprecating";
|
|
16114
|
+
console.log(`\u26A0\uFE0F ${action} collection: ${name_slug}...
|
|
16115
|
+
`);
|
|
16116
|
+
const result = await client.deprecateCollection(name_slug, {
|
|
16117
|
+
deprecated: !options.undo,
|
|
16118
|
+
reason: options.reason
|
|
16119
|
+
});
|
|
16120
|
+
if (result.success) {
|
|
16121
|
+
console.log(`\u2705 ${result.message}`);
|
|
16122
|
+
console.log("");
|
|
16123
|
+
if (result.deprecated && result.reason) {
|
|
16124
|
+
console.log(` Reason: ${result.reason}`);
|
|
16125
|
+
console.log("");
|
|
16126
|
+
}
|
|
16127
|
+
if (result.deprecated) {
|
|
16128
|
+
console.log("\u{1F4A1} To undo: prpm collections deprecate --undo " + name_slug);
|
|
16129
|
+
}
|
|
16130
|
+
} else {
|
|
16131
|
+
throw new Error("Failed to update deprecation status");
|
|
16132
|
+
}
|
|
16133
|
+
await telemetry.track({
|
|
16134
|
+
command: "collections:deprecate",
|
|
16135
|
+
success: true,
|
|
16136
|
+
duration: Date.now() - startTime,
|
|
16137
|
+
data: {
|
|
16138
|
+
name_slug,
|
|
16139
|
+
deprecated: result.deprecated,
|
|
16140
|
+
reason: result.reason
|
|
16141
|
+
}
|
|
16142
|
+
});
|
|
16143
|
+
} catch (error) {
|
|
16144
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
16145
|
+
console.error(`
|
|
16146
|
+
\u274C Failed to deprecate collection: ${errorMessage}
|
|
16147
|
+
`);
|
|
16148
|
+
await telemetry.track({
|
|
16149
|
+
command: "collections:deprecate",
|
|
16150
|
+
success: false,
|
|
16151
|
+
error: errorMessage,
|
|
16152
|
+
duration: Date.now() - startTime
|
|
16153
|
+
});
|
|
16154
|
+
throw new CLIError(`Failed to deprecate collection: ${errorMessage}`, 1);
|
|
16155
|
+
} finally {
|
|
16156
|
+
await telemetry.shutdown();
|
|
16157
|
+
}
|
|
16158
|
+
}
|
|
16092
16159
|
async function handleCollectionInstall(collectionSpec, options) {
|
|
16093
16160
|
const startTime = Date.now();
|
|
16094
16161
|
let packagesInstalled = 0;
|
|
@@ -16233,6 +16300,9 @@ function createCollectionsCommand() {
|
|
|
16233
16300
|
command.command("publish [manifest]").description("Publish a collection from collection.json").action(async (manifest) => {
|
|
16234
16301
|
await handleCollectionPublish(manifest);
|
|
16235
16302
|
});
|
|
16303
|
+
command.command("deprecate <collection>").description("Deprecate a collection (owner only)").option("--reason <reason>", "Reason for deprecation").option("--undo", "Remove deprecation status").action(async (collection, options) => {
|
|
16304
|
+
await handleCollectionDeprecate(collection, options);
|
|
16305
|
+
});
|
|
16236
16306
|
return command;
|
|
16237
16307
|
}
|
|
16238
16308
|
var import_commander10, import_registry_client4;
|
|
@@ -21842,6 +21912,7 @@ ${"=".repeat(60)}`);
|
|
|
21842
21912
|
let lastError = null;
|
|
21843
21913
|
let retryCount = 0;
|
|
21844
21914
|
let publishSuccess = false;
|
|
21915
|
+
let sawGatewayLikeError = false;
|
|
21845
21916
|
while (retryCount <= MAX_RETRIES && !publishSuccess) {
|
|
21846
21917
|
try {
|
|
21847
21918
|
if (retryCount > 0 && RETRY_DELAY_MS > 0) {
|
|
@@ -22038,7 +22109,40 @@ ${"=".repeat(60)}`);
|
|
|
22038
22109
|
userInfo,
|
|
22039
22110
|
packageName
|
|
22040
22111
|
);
|
|
22112
|
+
if (sawGatewayLikeError && pkgError.toLowerCase().includes("version already exists")) {
|
|
22113
|
+
const assumedName = predictScopedPackageName(
|
|
22114
|
+
manifest.name,
|
|
22115
|
+
(userInfo == null ? void 0 : userInfo.username) || config.username || "unknown",
|
|
22116
|
+
manifest.organization
|
|
22117
|
+
);
|
|
22118
|
+
let webappUrl;
|
|
22119
|
+
const registryUrl = config.registryUrl || "https://registry.prpm.dev";
|
|
22120
|
+
if (registryUrl.includes("localhost") || registryUrl.includes("127.0.0.1")) {
|
|
22121
|
+
webappUrl = "http://localhost:5173";
|
|
22122
|
+
} else if (registryUrl.includes("registry.prpm.dev")) {
|
|
22123
|
+
webappUrl = "https://prpm.dev";
|
|
22124
|
+
} else {
|
|
22125
|
+
webappUrl = registryUrl;
|
|
22126
|
+
}
|
|
22127
|
+
const packageSlug = assumedName.startsWith("@") ? assumedName.slice(1) : assumedName;
|
|
22128
|
+
const packagePath = packageSlug.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
22129
|
+
const packageUrl = `${webappUrl}/packages/${packagePath}`;
|
|
22130
|
+
console.log(
|
|
22131
|
+
`
|
|
22132
|
+
\u2705 ${displayName}@${manifest.version} now exists on the registry after a transient gateway error; assuming publish succeeded.`
|
|
22133
|
+
);
|
|
22134
|
+
publishedPackages.push({
|
|
22135
|
+
name: assumedName,
|
|
22136
|
+
version: manifest.version,
|
|
22137
|
+
url: packageUrl
|
|
22138
|
+
});
|
|
22139
|
+
publishSuccess = true;
|
|
22140
|
+
break;
|
|
22141
|
+
}
|
|
22041
22142
|
if (isRetriableError(pkgError) && retryCount < MAX_RETRIES) {
|
|
22143
|
+
if (pkgError.includes("Bad Gateway") || pkgError.includes("Service Unavailable") || pkgError.includes("502") || pkgError.includes("503") || pkgError.includes("504")) {
|
|
22144
|
+
sawGatewayLikeError = true;
|
|
22145
|
+
}
|
|
22042
22146
|
console.error(
|
|
22043
22147
|
`
|
|
22044
22148
|
\u26A0\uFE0F Temporary error publishing ${displayName}: ${pkgError}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prpm",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
4
4
|
"description": "Prompt Package Manager CLI - Install and manage prompt-based files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@octokit/rest": "^22.0.0",
|
|
48
|
-
"@pr-pm/converters": "^2.1.
|
|
49
|
-
"@pr-pm/registry-client": "^2.3.
|
|
50
|
-
"@pr-pm/types": "^2.1.
|
|
48
|
+
"@pr-pm/converters": "^2.1.12",
|
|
49
|
+
"@pr-pm/registry-client": "^2.3.11",
|
|
50
|
+
"@pr-pm/types": "^2.1.12",
|
|
51
51
|
"ajv": "^8.17.1",
|
|
52
52
|
"ajv-formats": "^3.0.1",
|
|
53
53
|
"commander": "^11.1.0",
|