prpm 0.1.7 → 0.1.8

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.
@@ -367,7 +367,25 @@ async function handleInstall(packageSpec, options) {
367
367
  }
368
368
  }
369
369
  for (const file of extractedFiles) {
370
- const filePath = `${packageDir}/${file.name}`;
370
+ // Strip the tarball's root directory prefix to preserve subdirectories
371
+ // Example: ".claude/skills/agent-builder/docs/examples.md" → "docs/examples.md"
372
+ // ".claude/skills/agent-builder/SKILL.md" → "SKILL.md"
373
+ // Find the common prefix (the package's root directory in the tarball)
374
+ const pathParts = file.name.split('/');
375
+ // For Claude skills, the tarball structure is typically: .claude/skills/package-name/...
376
+ // We want to strip everything up to and including the package-name directory
377
+ let relativeFileName = file.name;
378
+ // Find the skills directory index
379
+ const skillsDirIndex = pathParts.indexOf('skills');
380
+ if (skillsDirIndex !== -1 && pathParts.length > skillsDirIndex + 2) {
381
+ // Skip: .claude/skills/package-name/ and keep the rest
382
+ relativeFileName = pathParts.slice(skillsDirIndex + 2).join('/');
383
+ }
384
+ else if (pathParts.length > 1) {
385
+ // Fallback: just take the filename (last part)
386
+ relativeFileName = pathParts[pathParts.length - 1];
387
+ }
388
+ const filePath = `${packageDir}/${relativeFileName}`;
371
389
  await (0, filesystem_1.saveFile)(filePath, file.content);
372
390
  fileCount++;
373
391
  }
@@ -27,40 +27,24 @@ async function handleUninstall(name) {
27
27
  const packageName = (0, filesystem_1.stripAuthorNamespace)(name);
28
28
  const destDir = (0, filesystem_1.getDestinationDir)(format, subtype, packageName);
29
29
  const fileExtension = pkg.format === 'cursor' ? 'mdc' : 'md';
30
- // For Claude skills, check the directory structure first (since they use SKILL.md)
30
+ // For Claude skills, delete the entire directory (may contain multiple files)
31
31
  if (format === 'claude' && subtype === 'skill') {
32
- // Claude skills are in .claude/skills/${packageName}/ with SKILL.md file
33
- const skillPath = `${destDir}/SKILL.md`;
34
- if (await (0, filesystem_1.fileExists)(skillPath)) {
35
- // Delete the SKILL.md file
36
- await (0, filesystem_1.deleteFile)(skillPath);
37
- console.log(` 🗑️ Deleted file: ${skillPath}`);
38
- // If the directory is empty or only contains SKILL.md, delete the directory too
39
- try {
40
- const dirContents = await fs_1.promises.readdir(destDir);
41
- if (dirContents.length === 0) {
42
- await fs_1.promises.rmdir(destDir);
43
- console.log(` 🗑️ Deleted empty directory: ${destDir}`);
44
- }
45
- }
46
- catch (error) {
47
- // Directory doesn't exist or can't be deleted, that's okay
32
+ // Claude skills are in .claude/skills/${packageName}/ directory
33
+ // Delete the entire directory (includes SKILL.md, EXAMPLES.md, docs/, etc.)
34
+ try {
35
+ const stats = await fs_1.promises.stat(destDir);
36
+ if (stats.isDirectory()) {
37
+ await fs_1.promises.rm(destDir, { recursive: true, force: true });
38
+ console.log(` 🗑️ Deleted directory: ${destDir}`);
48
39
  }
49
40
  }
50
- else {
51
- // Try the whole directory
52
- try {
53
- const stats = await fs_1.promises.stat(destDir);
54
- if (stats.isDirectory()) {
55
- await fs_1.promises.rm(destDir, { recursive: true, force: true });
56
- console.log(` 🗑️ Deleted directory: ${destDir}`);
57
- }
41
+ catch (error) {
42
+ const err = error;
43
+ if (err.code === 'ENOENT') {
44
+ console.warn(` ⚠️ Skill directory not found: ${destDir}`);
58
45
  }
59
- catch (error) {
60
- const err = error;
61
- if (err.code !== 'ENOENT') {
62
- console.warn(` ⚠️ Could not delete package files: ${err.message}`);
63
- }
46
+ else {
47
+ console.warn(` ⚠️ Could not delete skill directory: ${err.message}`);
64
48
  }
65
49
  }
66
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
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.3.5",
49
- "@pr-pm/types": "^0.2.6",
48
+ "@pr-pm/registry-client": "^1.3.6",
49
+ "@pr-pm/types": "^0.2.7",
50
50
  "ajv": "^8.17.1",
51
51
  "ajv-formats": "^3.0.1",
52
52
  "commander": "^11.1.0",