prpm 0.1.8 → 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
  }
@@ -434,7 +453,7 @@ async function handleInstall(packageSpec, options) {
434
453
  error,
435
454
  duration: Date.now() - startTime,
436
455
  data: {
437
- packageId: packageSpec.split('@')[0],
456
+ packageId: packageSpec ? packageSpec.split('@')[0] : 'lockfile',
438
457
  version: options.version || 'latest',
439
458
  convertTo: options.as,
440
459
  },
@@ -530,11 +549,65 @@ function detectProjectFormat() {
530
549
  return 'windsurf';
531
550
  return null;
532
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
+ }
533
606
  function createInstallCommand() {
534
607
  const command = new commander_1.Command('install');
535
608
  command
536
- .description('Install a package from the registry')
537
- .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')
538
611
  .option('--version <version>', 'Specific version to install')
539
612
  .option('--as <format>', 'Convert and install in specific format (cursor, claude, continue, windsurf, copilot, kiro, agents.md, canonical)')
540
613
  .option('--format <format>', 'Alias for --as')
@@ -553,6 +626,16 @@ function createInstallCommand() {
553
626
  console.log(' prpm install my-package # Install in native format');
554
627
  process.exit(1);
555
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
+ }
556
639
  await handleInstall(packageSpec, {
557
640
  version: options.version,
558
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.)')
@@ -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.8",
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.6",
49
- "@pr-pm/types": "^0.2.7",
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",