prpm 0.0.13 → 0.0.14

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.
@@ -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.14",
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.8",
49
+ "@pr-pm/types": "^0.1.8",
50
50
  "ajv": "^8.17.1",
51
51
  "ajv-formats": "^3.0.1",
52
52
  "commander": "^11.1.0",