prpm 2.1.19 → 2.1.20

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 +29 -13
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -16099,7 +16099,7 @@ function findMainFile(files, format, subtype) {
16099
16099
  return null;
16100
16100
  }
16101
16101
  async function handleInstall(packageSpec, options) {
16102
- var _a;
16102
+ var _a, _b, _c;
16103
16103
  const startTime = Date.now();
16104
16104
  let success = false;
16105
16105
  let error;
@@ -16149,18 +16149,34 @@ async function handleInstall(packageSpec, options) {
16149
16149
  const installedPkg = lockfile.packages[lockfileKey];
16150
16150
  if (installedPkg) {
16151
16151
  const requestedVersion = options.version || specVersion;
16152
+ const existingLocation = ((_a = installedPkg.snippetMetadata) == null ? void 0 : _a.targetPath) || installedPkg.installedPath;
16153
+ const requestedLocation = (_b = options.location) == null ? void 0 : _b.trim();
16154
+ let isDifferentLocation = false;
16155
+ if (requestedLocation && existingLocation) {
16156
+ if (installedPkg.subtype === "snippet") {
16157
+ isDifferentLocation = import_path14.default.resolve(requestedLocation) !== import_path14.default.resolve(existingLocation);
16158
+ } else {
16159
+ const existingDir = import_path14.default.dirname(existingLocation);
16160
+ isDifferentLocation = import_path14.default.resolve(requestedLocation) !== import_path14.default.resolve(existingDir);
16161
+ }
16162
+ }
16152
16163
  if (!requestedVersion || requestedVersion === "latest" || requestedVersion === installedPkg.version) {
16153
- console.log(`
16164
+ if (isDifferentLocation) {
16165
+ console.log(`\u{1F4E6} Installing ${packageId} to different location: ${requestedLocation}`);
16166
+ console.log(` (already installed at: ${existingLocation})`);
16167
+ } else {
16168
+ console.log(`
16154
16169
  \u2728 Package already installed!`);
16155
- console.log(` \u{1F4E6} ${packageId}@${installedPkg.version}`);
16156
- console.log(` \u{1F504} Format: ${installedPkg.format || "unknown"} | Subtype: ${installedPkg.subtype || "unknown"}`);
16157
- console.log(`
16170
+ console.log(` \u{1F4E6} ${packageId}@${installedPkg.version}`);
16171
+ console.log(` \u{1F504} Format: ${installedPkg.format || "unknown"} | Subtype: ${installedPkg.subtype || "unknown"}`);
16172
+ console.log(`
16158
16173
  \u{1F4A1} To reinstall or upgrade:`);
16159
- console.log(` prpm upgrade ${packageId} # Upgrade to latest version`);
16160
- console.log(` prpm uninstall ${packageId} # Uninstall first, then install`);
16161
- console.log(` prpm install ${packageId} --as <format> # Install in different format`);
16162
- success = true;
16163
- return;
16174
+ console.log(` prpm upgrade ${packageId} # Upgrade to latest version`);
16175
+ console.log(` prpm uninstall ${packageId} # Uninstall first, then install`);
16176
+ console.log(` prpm install ${packageId} --as <format> # Install in different format`);
16177
+ success = true;
16178
+ return;
16179
+ }
16164
16180
  } else {
16165
16181
  console.log(`\u{1F4E6} Upgrading ${packageId}: ${installedPkg.version} \u2192 ${requestedVersion}`);
16166
16182
  }
@@ -16239,7 +16255,7 @@ async function handleInstall(packageSpec, options) {
16239
16255
  console.log(` \u26A0\uFE0F ${fallbackResult.reason}`);
16240
16256
  format = fallbackResult.format;
16241
16257
  }
16242
- if (format !== pkg.format) {
16258
+ if (format !== pkg.format && pkg.subtype !== "snippet") {
16243
16259
  console.log(` \u{1F504} Converting to ${format} format...`);
16244
16260
  }
16245
16261
  }
@@ -16296,7 +16312,7 @@ This could indicate:
16296
16312
  const effectiveFormat = format || pkg.format;
16297
16313
  const effectiveSubtype = options.subtype || pkg.subtype;
16298
16314
  let extractedFiles = await extractTarball(tarball, packageId);
16299
- if (options.as && format && format !== pkg.format) {
16315
+ if (options.as && format && format !== pkg.format && effectiveSubtype !== "snippet") {
16300
16316
  console.log(` \u{1F504} Converting from ${pkg.format} to ${format}...`);
16301
16317
  let sourceContent;
16302
16318
  if (extractedFiles.length === 1) {
@@ -16459,7 +16475,7 @@ This could indicate:
16459
16475
  console.log(` \u2713 Converted from ${pkg.format} to ${format}`);
16460
16476
  }
16461
16477
  const locationSupportedFormats = ["agents.md", "cursor"];
16462
- let locationOverride = (_a = options.location) == null ? void 0 : _a.trim();
16478
+ let locationOverride = (_c = options.location) == null ? void 0 : _c.trim();
16463
16479
  const isSnippet = effectiveSubtype === "snippet";
16464
16480
  if (locationOverride && !locationSupportedFormats.includes(effectiveFormat) && !isSnippet) {
16465
16481
  console.log(` \u26A0\uFE0F --location option currently applies to Cursor, Agents.md, or snippet installs. Ignoring provided value for ${effectiveFormat}.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "2.1.19",
3
+ "version": "2.1.20",
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.20",
49
- "@pr-pm/registry-client": "^2.3.19",
50
- "@pr-pm/types": "^2.1.20",
48
+ "@pr-pm/converters": "^2.1.21",
49
+ "@pr-pm/registry-client": "^2.3.20",
50
+ "@pr-pm/types": "^2.1.21",
51
51
  "ajv": "^8.17.1",
52
52
  "ajv-formats": "^3.0.1",
53
53
  "chalk": "^5.6.2",