prpm 0.1.7 → 0.1.9

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.
@@ -63,12 +63,12 @@ const FORMAT_EXAMPLES = {
63
63
  files: ['.windsurf/rules', 'README.md'],
64
64
  },
65
65
  copilot: {
66
- description: 'GitHub Copilot instructions',
67
- files: ['.github/copilot-instructions.md', 'README.md'],
66
+ description: 'GitHub Copilot (repository-wide, path-specific, and chat modes)',
67
+ files: ['.github/copilot-instructions.md', '.github/instructions/typescript.instructions.md', '.github/chatmodes/code-reviewer.chatmode.md', 'README.md'],
68
68
  },
69
69
  kiro: {
70
- description: 'Kiro steering files',
71
- files: ['.kiro/steering/example.md', 'README.md'],
70
+ description: 'Kiro steering files and hooks',
71
+ files: ['.kiro/steering/example.md', '.kiro/hooks/example-hook.kiro.hook', 'README.md'],
72
72
  },
73
73
  'agents.md': {
74
74
  description: 'OpenAI agents.md project instructions',
@@ -145,31 +145,49 @@ Add your Windsurf AI coding rules here.
145
145
  `,
146
146
  },
147
147
  copilot: {
148
- '.github/copilot-instructions.md': `---
149
- applyTo:
150
- - "**/*.ts"
151
- - "**/*.tsx"
152
- ---
148
+ '.github/copilot-instructions.md': `# GitHub Copilot Repository-Wide Instructions
153
149
 
154
- # GitHub Copilot Instructions
155
-
156
- Add your GitHub Copilot instructions here.
150
+ These instructions apply to all files in this repository.
157
151
 
158
152
  ## Code Standards
159
153
 
160
154
  - Use TypeScript strict mode
161
155
  - Follow ESLint rules
162
- - Write JSDoc comments
156
+ - Write JSDoc comments for public APIs
163
157
 
164
158
  ## Patterns to Follow
165
159
 
166
160
  - Use async/await for asynchronous operations
167
161
  - Implement error handling with try/catch
168
162
  - Export named functions instead of default exports
163
+ - Write unit tests for all new features
164
+ `,
165
+ '.github/instructions/typescript.instructions.md': `---
166
+ applyTo:
167
+ - "**/*.ts"
168
+ - "**/*.tsx"
169
+ ---
170
+
171
+ # TypeScript-Specific Instructions
172
+
173
+ These instructions apply only to TypeScript files.
174
+
175
+ ## Type Safety
176
+
177
+ - Use strict null checks
178
+ - Avoid 'any' type - use 'unknown' or specific types
179
+ - Define interfaces for all object shapes
180
+ - Use type guards for runtime type checking
181
+
182
+ ## Patterns
183
+
184
+ - Prefer const over let
185
+ - Use template literals for string concatenation
186
+ - Destructure objects and arrays when appropriate
169
187
  `,
170
- '.github/chatmodes/example.chatmode.md': `---
171
- name: Example Chat Mode
172
- description: Example custom chat mode for GitHub Copilot
188
+ '.github/chatmodes/code-reviewer.chatmode.md': `---
189
+ name: Code Reviewer
190
+ description: Expert code reviewer focusing on best practices, security, and maintainability
173
191
  ---
174
192
 
175
193
  # Example Chat Mode
@@ -221,6 +239,23 @@ Describe the context where this steering file applies.
221
239
 
222
240
  Provide examples of correct patterns.
223
241
  `,
242
+ '.kiro/hooks/example-hook.kiro.hook': `{
243
+ "enabled": false,
244
+ "name": "Example Hook",
245
+ "description": "Example Kiro hook - disabled by default. Replace with your actual hook logic.",
246
+ "version": "1",
247
+ "when": {
248
+ "type": "fileEdited",
249
+ "patterns": [
250
+ "**/*.ts",
251
+ "**/*.tsx"
252
+ ]
253
+ },
254
+ "then": {
255
+ "type": "askAgent",
256
+ "prompt": "A file has been modified. Please review it for best practices:\\n1. Check for code quality issues\\n2. Verify error handling\\n3. Suggest improvements\\n4. Ensure tests are updated"
257
+ }
258
+ }`,
224
259
  },
225
260
  'agents.md': {
226
261
  'agents.md': `# Project Coding Guidelines
@@ -37,6 +37,7 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.handleInstall = handleInstall;
40
+ exports.installFromLockfile = installFromLockfile;
40
41
  exports.createInstallCommand = createInstallCommand;
41
42
  const commander_1 = require("commander");
42
43
  const registry_client_1 = require("@pr-pm/registry-client");
@@ -61,6 +62,7 @@ function getPackageIcon(format, subtype) {
61
62
  'collection': '📦',
62
63
  'chatmode': '💬',
63
64
  'tool': '🔧',
65
+ 'hook': '🪝',
64
66
  };
65
67
  // Format-specific icons for rules/defaults
66
68
  const formatIcons = {
@@ -100,6 +102,7 @@ function getPackageLabel(format, subtype) {
100
102
  'collection': 'Collection',
101
103
  'chatmode': 'Chat Mode',
102
104
  'tool': 'Tool',
105
+ 'hook': 'Hook',
103
106
  };
104
107
  const formatLabel = formatLabels[format];
105
108
  const subtypeLabel = subtypeLabels[subtype];
@@ -159,8 +162,8 @@ async function handleInstall(packageSpec, options) {
159
162
  // Normal mode - use specified version or locked version or latest
160
163
  version = options.version || specVersion || lockedVersion || 'latest';
161
164
  }
162
- // Check if package is already installed
163
- if (lockfile && lockfile.packages[packageId]) {
165
+ // Check if package is already installed (skip if --force option is set)
166
+ if (!options.force && lockfile && lockfile.packages[packageId]) {
164
167
  const installedPkg = lockfile.packages[packageId];
165
168
  const requestedVersion = options.version || specVersion;
166
169
  // If no specific version requested, or same version requested
@@ -301,6 +304,7 @@ async function handleInstall(packageSpec, options) {
301
304
  const packageName = (0, filesystem_1.stripAuthorNamespace)(packageId);
302
305
  // For Claude skills, use SKILL.md filename in the package directory
303
306
  // For agents.md, use package-name/AGENTS.md directory structure
307
+ // For Copilot, use official naming conventions
304
308
  // For other formats, use package name as filename
305
309
  if (effectiveFormat === 'claude' && effectiveSubtype === 'skill') {
306
310
  destPath = `${destDir}/SKILL.md`;
@@ -308,6 +312,21 @@ async function handleInstall(packageSpec, options) {
308
312
  else if (effectiveFormat === 'agents.md') {
309
313
  destPath = `${destDir}/${packageName}/AGENTS.md`;
310
314
  }
315
+ else if (effectiveFormat === 'copilot') {
316
+ // Official GitHub Copilot naming conventions
317
+ if (effectiveSubtype === 'chatmode') {
318
+ // Chat modes: .github/chatmodes/NAME.chatmode.md
319
+ destPath = `${destDir}/${packageName}.chatmode.md`;
320
+ }
321
+ else {
322
+ // Path-specific instructions: .github/instructions/NAME.instructions.md
323
+ destPath = `${destDir}/${packageName}.instructions.md`;
324
+ }
325
+ }
326
+ else if (effectiveFormat === 'kiro' && effectiveSubtype === 'hook') {
327
+ // Kiro hooks use .kiro.hook extension (JSON files)
328
+ destPath = `${destDir}/${packageName}.kiro.hook`;
329
+ }
311
330
  else {
312
331
  destPath = `${destDir}/${packageName}.${fileExtension}`;
313
332
  }
@@ -367,7 +386,25 @@ async function handleInstall(packageSpec, options) {
367
386
  }
368
387
  }
369
388
  for (const file of extractedFiles) {
370
- const filePath = `${packageDir}/${file.name}`;
389
+ // Strip the tarball's root directory prefix to preserve subdirectories
390
+ // Example: ".claude/skills/agent-builder/docs/examples.md" → "docs/examples.md"
391
+ // ".claude/skills/agent-builder/SKILL.md" → "SKILL.md"
392
+ // Find the common prefix (the package's root directory in the tarball)
393
+ const pathParts = file.name.split('/');
394
+ // For Claude skills, the tarball structure is typically: .claude/skills/package-name/...
395
+ // We want to strip everything up to and including the package-name directory
396
+ let relativeFileName = file.name;
397
+ // Find the skills directory index
398
+ const skillsDirIndex = pathParts.indexOf('skills');
399
+ if (skillsDirIndex !== -1 && pathParts.length > skillsDirIndex + 2) {
400
+ // Skip: .claude/skills/package-name/ and keep the rest
401
+ relativeFileName = pathParts.slice(skillsDirIndex + 2).join('/');
402
+ }
403
+ else if (pathParts.length > 1) {
404
+ // Fallback: just take the filename (last part)
405
+ relativeFileName = pathParts[pathParts.length - 1];
406
+ }
407
+ const filePath = `${packageDir}/${relativeFileName}`;
371
408
  await (0, filesystem_1.saveFile)(filePath, file.content);
372
409
  fileCount++;
373
410
  }
@@ -416,7 +453,7 @@ async function handleInstall(packageSpec, options) {
416
453
  error,
417
454
  duration: Date.now() - startTime,
418
455
  data: {
419
- packageId: packageSpec.split('@')[0],
456
+ packageId: packageSpec ? packageSpec.split('@')[0] : 'lockfile',
420
457
  version: options.version || 'latest',
421
458
  convertTo: options.as,
422
459
  },
@@ -512,11 +549,65 @@ function detectProjectFormat() {
512
549
  return 'windsurf';
513
550
  return null;
514
551
  }
552
+ /**
553
+ * Install all packages from prpm.lock
554
+ */
555
+ async function installFromLockfile(options) {
556
+ try {
557
+ // Read lockfile
558
+ const lockfile = await (0, lockfile_1.readLockfile)();
559
+ if (!lockfile) {
560
+ console.error('❌ No prpm.lock file found');
561
+ console.log('\n💡 Run "prpm install <package>" first to create a lockfile, or initialize a new project with "prpm init"');
562
+ process.exit(1);
563
+ }
564
+ const packageIds = Object.keys(lockfile.packages);
565
+ if (packageIds.length === 0) {
566
+ console.log('✅ No packages to install (prpm.lock is empty)');
567
+ return;
568
+ }
569
+ console.log(`📦 Installing ${packageIds.length} package${packageIds.length === 1 ? '' : 's'} from prpm.lock...\n`);
570
+ let successCount = 0;
571
+ let failCount = 0;
572
+ // Install each package from lockfile
573
+ for (const packageId of packageIds) {
574
+ const lockEntry = lockfile.packages[packageId];
575
+ try {
576
+ // Extract package spec (strip version if present in packageId)
577
+ const packageSpec = packageId.includes('@') && !packageId.startsWith('@')
578
+ ? packageId.substring(0, packageId.lastIndexOf('@'))
579
+ : packageId;
580
+ console.log(` Installing ${packageId}...`);
581
+ await handleInstall(packageSpec, {
582
+ version: lockEntry.version,
583
+ as: options.as || lockEntry.format,
584
+ subtype: options.subtype || lockEntry.subtype,
585
+ frozenLockfile: options.frozenLockfile,
586
+ force: true, // Force reinstall when installing from lockfile
587
+ });
588
+ successCount++;
589
+ }
590
+ catch (error) {
591
+ failCount++;
592
+ console.error(` ❌ Failed to install ${packageId}: ${error}`);
593
+ }
594
+ }
595
+ console.log(`\n✅ Installed ${successCount}/${packageIds.length} packages`);
596
+ if (failCount > 0) {
597
+ console.error(`❌ ${failCount} package${failCount === 1 ? '' : 's'} failed to install`);
598
+ process.exit(1);
599
+ }
600
+ }
601
+ catch (error) {
602
+ console.error(`❌ Failed to install from lockfile: ${error}`);
603
+ process.exit(1);
604
+ }
605
+ }
515
606
  function createInstallCommand() {
516
607
  const command = new commander_1.Command('install');
517
608
  command
518
- .description('Install a package from the registry')
519
- .argument('<package>', 'Package to install (e.g., react-rules or react-rules@1.2.0)')
609
+ .description('Install a package from the registry, or install all packages from prpm.lock if no package specified')
610
+ .argument('[package]', 'Package to install (e.g., react-rules or react-rules@1.2.0). If omitted, installs all packages from prpm.lock')
520
611
  .option('--version <version>', 'Specific version to install')
521
612
  .option('--as <format>', 'Convert and install in specific format (cursor, claude, continue, windsurf, copilot, kiro, agents.md, canonical)')
522
613
  .option('--format <format>', 'Alias for --as')
@@ -535,6 +626,16 @@ function createInstallCommand() {
535
626
  console.log(' prpm install my-package # Install in native format');
536
627
  process.exit(1);
537
628
  }
629
+ // If no package specified, install from lockfile
630
+ if (!packageSpec) {
631
+ await installFromLockfile({
632
+ as: convertTo,
633
+ subtype: options.subtype,
634
+ frozenLockfile: options.frozenLockfile
635
+ });
636
+ process.exit(0);
637
+ return;
638
+ }
538
639
  await handleInstall(packageSpec, {
539
640
  version: options.version,
540
641
  as: convertTo,
@@ -57,6 +57,7 @@ function getPackageIcon(format, subtype) {
57
57
  'collection': '📦',
58
58
  'chatmode': '💬',
59
59
  'tool': '🔧',
60
+ 'hook': '🪝',
60
61
  };
61
62
  // Format-specific icons for rules/defaults
62
63
  const formatIcons = {
@@ -96,6 +97,7 @@ function getPackageLabel(format, subtype) {
96
97
  'collection': 'Collection',
97
98
  'chatmode': 'Chat Mode',
98
99
  'tool': 'Tool',
100
+ 'hook': 'Hook',
99
101
  };
100
102
  const formatLabel = formatLabels[format];
101
103
  const subtypeLabel = subtypeLabels[subtype];
@@ -404,7 +406,7 @@ function createSearchCommand() {
404
406
  .description('Search for packages in the registry')
405
407
  .argument('[query]', 'Search query (optional when using --format/--subtype or --author)')
406
408
  .option('--format <format>', 'Filter by package format (cursor, claude, continue, windsurf, copilot, kiro, agents.md, generic, mcp)')
407
- .option('--subtype <subtype>', 'Filter by package subtype (rule, agent, skill, slash-command, prompt, workflow, tool, template, collection)')
409
+ .option('--subtype <subtype>', 'Filter by package subtype (rule, agent, skill, slash-command, prompt, workflow, tool, template, collection, chatmode, hook)')
408
410
  .option('--author <username>', 'Filter by author username')
409
411
  .option('--language <language>', 'Filter by programming language (javascript, typescript, python, etc.)')
410
412
  .option('--framework <framework>', 'Filter by framework (react, nextjs, django, etc.)')
@@ -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
  }
@@ -54,8 +54,20 @@ function getDestinationDir(format, subtype, name) {
54
54
  case 'windsurf':
55
55
  return '.windsurf/rules';
56
56
  case 'copilot':
57
+ // Copilot has different locations based on subtype:
58
+ // - Repository-wide instructions: .github/copilot-instructions.md
59
+ // - Path-specific instructions: .github/instructions/*.instructions.md
60
+ // - Chat modes: .github/chatmodes/*.chatmode.md
61
+ if (subtype === 'chatmode')
62
+ return '.github/chatmodes';
63
+ // Default to path-specific instructions directory
57
64
  return '.github/instructions';
58
65
  case 'kiro':
66
+ // Kiro has different locations based on subtype:
67
+ // - Steering files: .kiro/steering/*.md
68
+ // - Hooks: .kiro/hooks/*.kiro.hook (JSON files)
69
+ if (subtype === 'hook')
70
+ return '.kiro/hooks';
59
71
  return '.kiro/steering';
60
72
  case 'agents.md':
61
73
  return '.agents';
package/dist/types.js CHANGED
@@ -32,4 +32,5 @@ exports.SUBTYPES = [
32
32
  'collection',
33
33
  'chatmode',
34
34
  'tool',
35
+ 'hook',
35
36
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
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.7",
49
+ "@pr-pm/types": "^0.2.8",
50
50
  "ajv": "^8.17.1",
51
51
  "ajv-formats": "^3.0.1",
52
52
  "commander": "^11.1.0",