prpm 2.1.10 → 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.
Files changed (2) hide show
  1. package/dist/index.js +70 -0
  2. 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "2.1.10",
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.11",
49
- "@pr-pm/registry-client": "^2.3.10",
50
- "@pr-pm/types": "^2.1.11",
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",