prpm 0.0.13 → 0.0.15

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.
@@ -9,6 +9,7 @@ const commander_1 = require("commander");
9
9
  const promises_1 = require("fs/promises");
10
10
  const path_1 = require("path");
11
11
  const telemetry_1 = require("../core/telemetry");
12
+ const lockfile_1 = require("../core/lockfile");
12
13
  /**
13
14
  * Detect format and subtype from file path and content
14
15
  */
@@ -205,15 +206,31 @@ async function handleCatalog(directories, options) {
205
206
  console.log(` ⚠️ Could not access ${dir}: ${err instanceof Error ? err.message : String(err)}`);
206
207
  }
207
208
  }
208
- console.log(`\n✨ Discovered ${allDiscovered.length} package(s) total:\n`);
209
- if (allDiscovered.length === 0) {
210
- console.log('No packages found. Try scanning different directories.');
209
+ // Read lockfile to exclude packages installed from other users
210
+ const lockfile = await (0, lockfile_1.readLockfile)();
211
+ const installedPackageIds = new Set(lockfile ? Object.keys(lockfile.packages) : []);
212
+ // Filter out packages that are installed from the registry (not user-created)
213
+ const filteredDiscovered = allDiscovered.filter(pkg => {
214
+ // Check if this package exists in lockfile
215
+ // Package ID in lockfile could be: "package-name", "@author/package-name"
216
+ // Check both formats
217
+ const isInstalled = installedPackageIds.has(pkg.name) ||
218
+ Array.from(installedPackageIds).some(id => id.endsWith(`/${pkg.name}`));
219
+ if (isInstalled) {
220
+ console.log(` ⏩ Skipping ${pkg.name} (installed from registry, not user-created)`);
221
+ return false;
222
+ }
223
+ return true;
224
+ });
225
+ console.log(`\n✨ Discovered ${filteredDiscovered.length} package(s) total:\n`);
226
+ if (filteredDiscovered.length === 0) {
227
+ console.log('No user-created packages found. Try scanning different directories or check if all packages were installed from registry.');
211
228
  success = true;
212
229
  return;
213
230
  }
214
231
  // Display discovered packages
215
232
  const byFormat = new Map();
216
- for (const pkg of allDiscovered) {
233
+ for (const pkg of filteredDiscovered) {
217
234
  if (!byFormat.has(pkg.format)) {
218
235
  byFormat.set(pkg.format, []);
219
236
  }
@@ -270,7 +287,7 @@ async function handleCatalog(directories, options) {
270
287
  // Convert discovered packages to manifests
271
288
  const existingNames = new Set(manifest.packages.map(p => p.name));
272
289
  let addedCount = 0;
273
- for (const discovered of allDiscovered) {
290
+ for (const discovered of filteredDiscovered) {
274
291
  // Skip if already exists
275
292
  if (existingNames.has(discovered.name)) {
276
293
  console.log(` ⚠️ Skipping ${discovered.name} (already in prpm.json)`);
@@ -8,7 +8,6 @@ exports.extractSnippet = extractSnippet;
8
8
  exports.validateSnippet = validateSnippet;
9
9
  const promises_1 = require("fs/promises");
10
10
  const path_1 = require("path");
11
- const filesystem_1 = require("../core/filesystem");
12
11
  const MAX_SNIPPET_LENGTH = 2000;
13
12
  /**
14
13
  * Extract a preview snippet from package files
@@ -18,35 +17,28 @@ async function extractSnippet(manifest) {
18
17
  const cwd = process.cwd();
19
18
  try {
20
19
  // Validate manifest has required fields
21
- if (!manifest.format || !manifest.name || !manifest.subtype) {
22
- console.warn('⚠️ Cannot extract snippet: manifest missing format, name, or subtype');
20
+ if (!manifest.files || manifest.files.length === 0) {
21
+ console.warn('⚠️ Cannot extract snippet: no files specified in manifest');
23
22
  return null;
24
23
  }
25
- // Determine which file to extract snippet from
26
- let targetFilePath;
24
+ // Prefer main file over first file if specified
25
+ let fileName;
27
26
  if (manifest.main) {
28
- // If main file is specified, use it directly (for multi-file packages)
29
- targetFilePath = (0, filesystem_1.getInstalledFilePath)(manifest.name, manifest.format, manifest.subtype, manifest.main);
27
+ fileName = manifest.main;
30
28
  }
31
- else if (manifest.files && manifest.files.length > 0) {
32
- // Get the first file from the manifest
29
+ else {
33
30
  const firstFile = manifest.files[0];
34
- const fileName = typeof firstFile === 'string'
31
+ fileName = typeof firstFile === 'string'
35
32
  ? firstFile
36
33
  : firstFile.path;
37
- // For single-file packages or when no main is specified,
38
- // use the format-aware path construction
39
- targetFilePath = (0, filesystem_1.getInstalledFilePath)(manifest.name, manifest.format, manifest.subtype, fileName);
40
- }
41
- else {
42
- // No files specified, try to construct the default path
43
- targetFilePath = (0, filesystem_1.getInstalledFilePath)(manifest.name, manifest.format, manifest.subtype);
44
34
  }
45
- const fullPath = (0, path_1.join)(cwd, targetFilePath);
35
+ // Use the file path directly - it should be relative to project root
36
+ // (e.g., ".claude/skills/my-skill/SKILL.md" or ".cursor/rules/my-rule.mdc")
37
+ const fullPath = (0, path_1.join)(cwd, fileName);
46
38
  // Check if path is a directory
47
39
  const stats = await (0, promises_1.stat)(fullPath);
48
40
  if (stats.isDirectory()) {
49
- console.warn(`⚠️ Skipping snippet extraction: "${targetFilePath}" is a directory`);
41
+ console.warn(`⚠️ Skipping snippet extraction: "${fullPath}" is a directory`);
50
42
  return null;
51
43
  }
52
44
  // Read the file content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Prompt Package Manager CLI - Install and manage prompt-based files",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -45,8 +45,8 @@
45
45
  "license": "MIT",
46
46
  "dependencies": {
47
47
  "@octokit/rest": "^22.0.0",
48
- "@pr-pm/registry-client": "^1.2.7",
49
- "@pr-pm/types": "^0.1.7",
48
+ "@pr-pm/registry-client": "^1.2.9",
49
+ "@pr-pm/types": "^0.1.9",
50
50
  "ajv": "^8.17.1",
51
51
  "ajv-formats": "^3.0.1",
52
52
  "commander": "^11.1.0",