prpm 1.1.3 → 1.1.5

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 +198 -152
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -11946,7 +11946,7 @@ ${afterFrontmatter}`;
11946
11946
  \u{1F393} Skill installed with progressive disclosure`);
11947
11947
  console.log(` \u{1F4DD} Skill added to ${manifestFile} manifest`);
11948
11948
  console.log(` \u{1F4A1} The skill is available but not loaded into context by default`);
11949
- console.log(` \u26A1 To activate: Add skill usage to your code or let the agent discover it`);
11949
+ console.log(` \u26A1 Your AI agent will activate this skill automatically when relevant based on its description`);
11950
11950
  }
11951
11951
  console.log(`
11952
11952
  \u{1F4A1} This package has been downloaded ${newDownloadCount.toLocaleString()} times`);
@@ -14253,182 +14253,228 @@ async function handlePublish(options) {
14253
14253
  const failedPackages = [];
14254
14254
  const publishedCollections = [];
14255
14255
  const failedCollections = [];
14256
+ const BATCH_SIZE = parseInt(process.env.PRPM_BATCH_SIZE || "5");
14257
+ const BATCH_DELAY_MS = options.dryRun || process.env.NODE_ENV === "test" ? 0 : parseInt(process.env.PRPM_BATCH_DELAY_MS || "2000");
14258
+ const MAX_RETRIES = parseInt(process.env.PRPM_MAX_RETRIES || "3");
14259
+ const RETRY_DELAY_MS = options.dryRun || process.env.NODE_ENV === "test" ? 0 : parseInt(process.env.PRPM_RETRY_DELAY_MS || "5000");
14260
+ const delay = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
14261
+ const isRetriableError = (error2) => {
14262
+ return error2.includes("Service Unavailable") || error2.includes("at capacity") || error2.includes("503") || error2.includes("ECONNRESET") || error2.includes("ETIMEDOUT");
14263
+ };
14264
+ if (filteredManifests.length > 1 && BATCH_DELAY_MS > 0) {
14265
+ console.log(`\u{1F4E6} Publishing ${filteredManifests.length} packages in batches of ${BATCH_SIZE}`);
14266
+ console.log(`\u23F1\uFE0F ${BATCH_DELAY_MS}ms delay between batches, ${RETRY_DELAY_MS}ms retry delay`);
14267
+ console.log("");
14268
+ }
14256
14269
  for (let i = 0; i < filteredManifests.length; i++) {
14257
14270
  const manifest = filteredManifests[i];
14258
14271
  packageName = manifest.name;
14259
14272
  version = manifest.version;
14273
+ if (i > 0 && i % BATCH_SIZE === 0 && BATCH_DELAY_MS > 0) {
14274
+ console.log(`\u23F8\uFE0F Batch delay (${BATCH_DELAY_MS}ms) before next ${Math.min(BATCH_SIZE, filteredManifests.length - i)} packages...`);
14275
+ await delay(BATCH_DELAY_MS);
14276
+ }
14260
14277
  if (filteredManifests.length > 1) {
14261
14278
  console.log(`
14262
14279
  ${"=".repeat(60)}`);
14263
- console.log(`\u{1F4E6} Publishing plugin ${i + 1} of ${filteredManifests.length}`);
14280
+ console.log(`\u{1F4E6} Publishing package ${i + 1} of ${filteredManifests.length}`);
14264
14281
  console.log(`${"=".repeat(60)}
14265
14282
  `);
14266
14283
  }
14267
- try {
14268
- if (process.env.DEBUG) {
14269
- console.log(`
14284
+ let lastError = null;
14285
+ let retryCount = 0;
14286
+ let publishSuccess = false;
14287
+ while (retryCount <= MAX_RETRIES && !publishSuccess) {
14288
+ try {
14289
+ if (retryCount > 0 && RETRY_DELAY_MS > 0) {
14290
+ console.log(` \u{1F504} Retry ${retryCount}/${MAX_RETRIES} after ${RETRY_DELAY_MS}ms...`);
14291
+ await delay(RETRY_DELAY_MS);
14292
+ } else if (retryCount > 0) {
14293
+ console.log(` \u{1F504} Retry ${retryCount}/${MAX_RETRIES}...`);
14294
+ }
14295
+ if (process.env.DEBUG) {
14296
+ console.log(`
14270
14297
  \u{1F50D} Before access override:`);
14271
- console.log(` - manifest.private: ${manifest.private}`);
14272
- console.log(` - options.access: ${options.access}`);
14273
- }
14274
- let isPrivate;
14275
- if (options.access !== void 0) {
14276
- isPrivate = options.access === "private";
14298
+ console.log(` - manifest.private: ${manifest.private}`);
14299
+ console.log(` - options.access: ${options.access}`);
14300
+ }
14301
+ let isPrivate;
14302
+ if (options.access !== void 0) {
14303
+ isPrivate = options.access === "private";
14304
+ if (process.env.DEBUG) {
14305
+ console.log(` - Using CLI flag override: ${options.access}`);
14306
+ }
14307
+ } else {
14308
+ isPrivate = manifest.private || false;
14309
+ if (process.env.DEBUG) {
14310
+ console.log(` - Using manifest setting: ${isPrivate}`);
14311
+ }
14312
+ }
14277
14313
  if (process.env.DEBUG) {
14278
- console.log(` - Using CLI flag override: ${options.access}`);
14314
+ console.log(` - calculated isPrivate: ${isPrivate}`);
14279
14315
  }
14280
- } else {
14281
- isPrivate = manifest.private || false;
14316
+ manifest.private = isPrivate;
14282
14317
  if (process.env.DEBUG) {
14283
- console.log(` - Using manifest setting: ${isPrivate}`);
14318
+ console.log(` - final manifest.private: ${manifest.private}`);
14319
+ console.log("");
14284
14320
  }
14285
- }
14286
- if (process.env.DEBUG) {
14287
- console.log(` - calculated isPrivate: ${isPrivate}`);
14288
- }
14289
- manifest.private = isPrivate;
14290
- if (process.env.DEBUG) {
14291
- console.log(` - final manifest.private: ${manifest.private}`);
14292
- console.log("");
14293
- }
14294
- let selectedOrgId;
14295
- let selectedOrgName;
14296
- if (manifest.organization && userInfo) {
14297
- const orgFromManifest = (_a = userInfo.organizations) == null ? void 0 : _a.find(
14298
- (org) => org.name === manifest.organization || org.id === manifest.organization
14321
+ let selectedOrgId;
14322
+ let selectedOrgName;
14323
+ if (manifest.organization && userInfo) {
14324
+ const orgFromManifest = (_a = userInfo.organizations) == null ? void 0 : _a.find(
14325
+ (org) => org.name === manifest.organization || org.id === manifest.organization
14326
+ );
14327
+ if (!orgFromManifest) {
14328
+ throw new Error(`Organization "${manifest.organization}" not found or you are not a member`);
14329
+ }
14330
+ if (!["owner", "admin", "maintainer"].includes(orgFromManifest.role)) {
14331
+ throw new Error(
14332
+ `You do not have permission to publish to organization "${orgFromManifest.name}". Your role: ${orgFromManifest.role}. Required: owner, admin, or maintainer`
14333
+ );
14334
+ }
14335
+ selectedOrgId = orgFromManifest.id;
14336
+ selectedOrgName = orgFromManifest.name;
14337
+ }
14338
+ const scopedPackageName = predictScopedPackageName(
14339
+ manifest.name,
14340
+ (userInfo == null ? void 0 : userInfo.username) || config.username || "unknown",
14341
+ selectedOrgName || manifest.organization
14299
14342
  );
14300
- if (!orgFromManifest) {
14301
- throw new Error(`Organization "${manifest.organization}" not found or you are not a member`);
14343
+ console.log(` Source: ${source}`);
14344
+ console.log(` Package: ${scopedPackageName}@${manifest.version}`);
14345
+ console.log(` Format: ${manifest.format} | Subtype: ${manifest.subtype}`);
14346
+ console.log(` Description: ${manifest.description}`);
14347
+ console.log(` Access: ${manifest.private ? "private" : "public"}`);
14348
+ if (selectedOrgId && userInfo) {
14349
+ const selectedOrg = userInfo.organizations.find((org) => org.id === selectedOrgId);
14350
+ console.log(` Publishing to: ${(selectedOrg == null ? void 0 : selectedOrg.name) || "organization"}`);
14302
14351
  }
14303
- if (!["owner", "admin", "maintainer"].includes(orgFromManifest.role)) {
14304
- throw new Error(
14305
- `You do not have permission to publish to organization "${orgFromManifest.name}". Your role: ${orgFromManifest.role}. Required: owner, admin, or maintainer`
14306
- );
14352
+ console.log("");
14353
+ console.log("\u{1F50D} Validating package files...");
14354
+ const fileValidation = await validatePackageFiles(manifest);
14355
+ if (fileValidation.errors.length > 0) {
14356
+ console.log(" \u274C Format validation errors:");
14357
+ fileValidation.errors.forEach((err) => {
14358
+ console.log(` - ${err}`);
14359
+ });
14360
+ console.log("");
14361
+ throw new Error("Package files do not match the specified format. Please fix the errors above.");
14307
14362
  }
14308
- selectedOrgId = orgFromManifest.id;
14309
- selectedOrgName = orgFromManifest.name;
14310
- }
14311
- const scopedPackageName = predictScopedPackageName(
14312
- manifest.name,
14313
- (userInfo == null ? void 0 : userInfo.username) || config.username || "unknown",
14314
- selectedOrgName || manifest.organization
14315
- );
14316
- console.log(` Source: ${source}`);
14317
- console.log(` Package: ${scopedPackageName}@${manifest.version}`);
14318
- console.log(` Format: ${manifest.format} | Subtype: ${manifest.subtype}`);
14319
- console.log(` Description: ${manifest.description}`);
14320
- console.log(` Access: ${manifest.private ? "private" : "public"}`);
14321
- if (selectedOrgId && userInfo) {
14322
- const selectedOrg = userInfo.organizations.find((org) => org.id === selectedOrgId);
14323
- console.log(` Publishing to: ${(selectedOrg == null ? void 0 : selectedOrg.name) || "organization"}`);
14324
- }
14325
- console.log("");
14326
- console.log("\u{1F50D} Validating package files...");
14327
- const fileValidation = await validatePackageFiles(manifest);
14328
- if (fileValidation.errors.length > 0) {
14329
- console.log(" \u274C Format validation errors:");
14330
- fileValidation.errors.forEach((err) => {
14331
- console.log(` - ${err}`);
14332
- });
14363
+ if (fileValidation.warnings.length > 0) {
14364
+ console.log(" \u26A0\uFE0F Format validation warnings:");
14365
+ fileValidation.warnings.forEach((warn) => {
14366
+ console.log(` - ${warn}`);
14367
+ });
14368
+ console.log("");
14369
+ } else {
14370
+ console.log(" \u2713 All files valid");
14371
+ console.log("");
14372
+ }
14373
+ console.log("\u{1F4C4} Extracting license information...");
14374
+ const licenseInfo = await extractLicenseInfo(manifest.repository);
14375
+ if (licenseInfo.type && !manifest.license) {
14376
+ manifest.license = licenseInfo.type;
14377
+ }
14378
+ if (licenseInfo.text && !manifest.license_text) {
14379
+ manifest.license_text = licenseInfo.text;
14380
+ }
14381
+ if (licenseInfo.url && !manifest.license_url) {
14382
+ manifest.license_url = licenseInfo.url || void 0;
14383
+ }
14384
+ validateLicenseInfo(licenseInfo, scopedPackageName);
14333
14385
  console.log("");
14334
- throw new Error("Package files do not match the specified format. Please fix the errors above.");
14335
- }
14336
- if (fileValidation.warnings.length > 0) {
14337
- console.log(" \u26A0\uFE0F Format validation warnings:");
14338
- fileValidation.warnings.forEach((warn) => {
14339
- console.log(` - ${warn}`);
14340
- });
14386
+ console.log("\u{1F4DD} Extracting content snippet...");
14387
+ const snippet2 = await extractSnippet(manifest);
14388
+ if (snippet2) {
14389
+ manifest.snippet = snippet2;
14390
+ }
14391
+ validateSnippet(snippet2, scopedPackageName);
14341
14392
  console.log("");
14342
- } else {
14343
- console.log(" \u2713 All files valid");
14393
+ console.log("\u{1F4E6} Creating package tarball...");
14394
+ const tarball = await createTarball(manifest);
14395
+ const sizeInBytes = tarball.length;
14396
+ const sizeInKB = sizeInBytes / 1024;
14397
+ const sizeInMB = sizeInBytes / (1024 * 1024);
14398
+ let sizeDisplay;
14399
+ if (sizeInMB >= 1) {
14400
+ sizeDisplay = `${sizeInMB.toFixed(2)}MB`;
14401
+ } else {
14402
+ sizeDisplay = `${sizeInKB.toFixed(2)}KB`;
14403
+ }
14404
+ console.log(` Size: ${sizeDisplay}`);
14405
+ console.log("");
14406
+ if (options.dryRun) {
14407
+ console.log("\u2705 Dry run successful! Package is ready to publish.");
14408
+ publishedPackages.push({
14409
+ name: scopedPackageName,
14410
+ version: manifest.version,
14411
+ url: ""
14412
+ });
14413
+ publishSuccess = true;
14414
+ break;
14415
+ }
14416
+ console.log("\u{1F680} Publishing to registry...");
14417
+ if (selectedOrgId) {
14418
+ console.log(` Publishing as organization: ${(_b = userInfo.organizations.find((org) => org.id === selectedOrgId)) == null ? void 0 : _b.name}`);
14419
+ console.log(` Organization ID: ${selectedOrgId}`);
14420
+ }
14421
+ const result = await client.publish(manifest, tarball, selectedOrgId ? { orgId: selectedOrgId } : void 0);
14422
+ let webappUrl;
14423
+ const registryUrl = config.registryUrl || "https://registry.prpm.dev";
14424
+ if (registryUrl.includes("localhost") || registryUrl.includes("127.0.0.1")) {
14425
+ webappUrl = "http://localhost:5173";
14426
+ } else if (registryUrl.includes("registry.prpm.dev")) {
14427
+ webappUrl = "https://prpm.dev";
14428
+ } else {
14429
+ webappUrl = registryUrl;
14430
+ }
14431
+ const packageSlug = result.name.startsWith("@") ? result.name.slice(1) : result.name;
14432
+ const packagePath = packageSlug.split("/").map((segment) => encodeURIComponent(segment)).join("/");
14433
+ const packageUrl = `${webappUrl}/packages/${packagePath}`;
14434
+ console.log("");
14435
+ console.log("\u2705 Package published successfully!");
14436
+ console.log("");
14437
+ console.log(` Package: ${result.name}@${result.version}`);
14438
+ console.log(` Install: prpm install ${result.name}`);
14344
14439
  console.log("");
14345
- }
14346
- console.log("\u{1F4C4} Extracting license information...");
14347
- const licenseInfo = await extractLicenseInfo(manifest.repository);
14348
- if (licenseInfo.type && !manifest.license) {
14349
- manifest.license = licenseInfo.type;
14350
- }
14351
- if (licenseInfo.text && !manifest.license_text) {
14352
- manifest.license_text = licenseInfo.text;
14353
- }
14354
- if (licenseInfo.url && !manifest.license_url) {
14355
- manifest.license_url = licenseInfo.url || void 0;
14356
- }
14357
- validateLicenseInfo(licenseInfo, scopedPackageName);
14358
- console.log("");
14359
- console.log("\u{1F4DD} Extracting content snippet...");
14360
- const snippet2 = await extractSnippet(manifest);
14361
- if (snippet2) {
14362
- manifest.snippet = snippet2;
14363
- }
14364
- validateSnippet(snippet2, scopedPackageName);
14365
- console.log("");
14366
- console.log("\u{1F4E6} Creating package tarball...");
14367
- const tarball = await createTarball(manifest);
14368
- const sizeInBytes = tarball.length;
14369
- const sizeInKB = sizeInBytes / 1024;
14370
- const sizeInMB = sizeInBytes / (1024 * 1024);
14371
- let sizeDisplay;
14372
- if (sizeInMB >= 1) {
14373
- sizeDisplay = `${sizeInMB.toFixed(2)}MB`;
14374
- } else {
14375
- sizeDisplay = `${sizeInKB.toFixed(2)}KB`;
14376
- }
14377
- console.log(` Size: ${sizeDisplay}`);
14378
- console.log("");
14379
- if (options.dryRun) {
14380
- console.log("\u2705 Dry run successful! Package is ready to publish.");
14381
14440
  publishedPackages.push({
14382
- name: scopedPackageName,
14383
- version: manifest.version,
14384
- url: ""
14441
+ name: result.name,
14442
+ // Use scoped name from server
14443
+ version: result.version,
14444
+ url: packageUrl
14385
14445
  });
14386
- continue;
14387
- }
14388
- console.log("\u{1F680} Publishing to registry...");
14389
- if (selectedOrgId) {
14390
- console.log(` Publishing as organization: ${(_b = userInfo.organizations.find((org) => org.id === selectedOrgId)) == null ? void 0 : _b.name}`);
14391
- console.log(` Organization ID: ${selectedOrgId}`);
14392
- }
14393
- const result = await client.publish(manifest, tarball, selectedOrgId ? { orgId: selectedOrgId } : void 0);
14394
- let webappUrl;
14395
- const registryUrl = config.registryUrl || "https://registry.prpm.dev";
14396
- if (registryUrl.includes("localhost") || registryUrl.includes("127.0.0.1")) {
14397
- webappUrl = "http://localhost:5173";
14398
- } else if (registryUrl.includes("registry.prpm.dev")) {
14399
- webappUrl = "https://prpm.dev";
14400
- } else {
14401
- webappUrl = registryUrl;
14402
- }
14403
- const packageSlug = result.name.startsWith("@") ? result.name.slice(1) : result.name;
14404
- const packagePath = packageSlug.split("/").map((segment) => encodeURIComponent(segment)).join("/");
14405
- const packageUrl = `${webappUrl}/packages/${packagePath}`;
14406
- console.log("");
14407
- console.log("\u2705 Package published successfully!");
14408
- console.log("");
14409
- console.log(` Package: ${result.name}@${result.version}`);
14410
- console.log(` Install: prpm install ${result.name}`);
14411
- console.log("");
14412
- publishedPackages.push({
14413
- name: result.name,
14414
- // Use scoped name from server
14415
- version: result.version,
14416
- url: packageUrl
14417
- });
14418
- } catch (err) {
14419
- const pkgError = err instanceof Error ? err.message : String(err);
14420
- const displayName = userInfo ? predictScopedPackageName(
14421
- manifest.name,
14422
- userInfo.username,
14423
- manifest.organization
14424
- ) : manifest.name;
14425
- console.error(`
14446
+ publishSuccess = true;
14447
+ } catch (err) {
14448
+ const pkgError = err instanceof Error ? err.message : String(err);
14449
+ lastError = err instanceof Error ? err : new Error(String(err));
14450
+ const displayName = userInfo ? predictScopedPackageName(
14451
+ manifest.name,
14452
+ userInfo.username,
14453
+ manifest.organization
14454
+ ) : manifest.name;
14455
+ if (isRetriableError(pkgError) && retryCount < MAX_RETRIES) {
14456
+ console.error(`
14457
+ \u26A0\uFE0F Temporary error publishing ${displayName}: ${pkgError}`);
14458
+ console.error(` Will retry (${retryCount + 1}/${MAX_RETRIES})...
14459
+ `);
14460
+ retryCount++;
14461
+ } else {
14462
+ if (retryCount >= MAX_RETRIES) {
14463
+ console.error(`
14464
+ \u274C Failed to publish ${displayName} after ${MAX_RETRIES} retries: ${pkgError}
14465
+ `);
14466
+ } else {
14467
+ console.error(`
14426
14468
  \u274C Failed to publish ${displayName}: ${pkgError}
14427
14469
  `);
14428
- failedPackages.push({
14429
- name: displayName,
14430
- error: pkgError
14431
- });
14470
+ }
14471
+ failedPackages.push({
14472
+ name: displayName,
14473
+ error: pkgError
14474
+ });
14475
+ break;
14476
+ }
14477
+ }
14432
14478
  }
14433
14479
  }
14434
14480
  if (collections.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
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": "^1.1.3",
49
- "@pr-pm/registry-client": "^2.1.3",
50
- "@pr-pm/types": "^1.1.3",
48
+ "@pr-pm/converters": "^1.1.5",
49
+ "@pr-pm/registry-client": "^2.1.5",
50
+ "@pr-pm/types": "^1.1.5",
51
51
  "ajv": "^8.17.1",
52
52
  "ajv-formats": "^3.0.1",
53
53
  "commander": "^11.1.0",