prpm 0.0.10 → 0.0.12

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.
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /**
3
+ * Snippet extraction utilities
4
+ * Extracts preview content from package files for display in modals
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.extractSnippet = extractSnippet;
8
+ exports.validateSnippet = validateSnippet;
9
+ const promises_1 = require("fs/promises");
10
+ const path_1 = require("path");
11
+ const MAX_SNIPPET_LENGTH = 2000;
12
+ /**
13
+ * Extract a preview snippet from package files
14
+ * Takes the first file in the package and extracts ~2000 characters
15
+ */
16
+ async function extractSnippet(manifest) {
17
+ const cwd = process.cwd();
18
+ try {
19
+ // Get the first file from the manifest
20
+ const firstFile = manifest.files[0];
21
+ if (!firstFile) {
22
+ return null;
23
+ }
24
+ // Get file path (handle both string and object formats)
25
+ const filePath = typeof firstFile === 'string'
26
+ ? firstFile
27
+ : firstFile.path;
28
+ // If there's a main file specified, prefer that
29
+ const targetFile = manifest.main || filePath;
30
+ const fullPath = (0, path_1.join)(cwd, targetFile);
31
+ // Check if path is a directory
32
+ const stats = await (0, promises_1.stat)(fullPath);
33
+ if (stats.isDirectory()) {
34
+ console.warn(`⚠️ Skipping snippet extraction: "${targetFile}" is a directory`);
35
+ return null;
36
+ }
37
+ // Read the file content
38
+ const content = await (0, promises_1.readFile)(fullPath, 'utf-8');
39
+ // Extract first N characters, trying to break at a reasonable point
40
+ if (content.length <= MAX_SNIPPET_LENGTH) {
41
+ return content.trim();
42
+ }
43
+ // Try to break at a newline near the limit
44
+ let snippet = content.substring(0, MAX_SNIPPET_LENGTH);
45
+ const lastNewline = snippet.lastIndexOf('\n');
46
+ if (lastNewline > MAX_SNIPPET_LENGTH * 0.8) {
47
+ // If we found a newline in the last 20%, break there
48
+ snippet = snippet.substring(0, lastNewline);
49
+ }
50
+ return snippet.trim() + '\n\n[... content truncated ...]';
51
+ }
52
+ catch (error) {
53
+ // If we can't read the file, return null (snippet is optional)
54
+ console.warn('⚠️ Could not extract snippet:', error instanceof Error ? error.message : 'Unknown error');
55
+ return null;
56
+ }
57
+ }
58
+ /**
59
+ * Validate snippet and warn if issues found
60
+ */
61
+ function validateSnippet(snippet, packageName) {
62
+ if (!snippet) {
63
+ console.warn(`⚠️ Warning: No content snippet extracted for package "${packageName}"`);
64
+ console.warn(' A preview snippet helps users see what the prompt contains before installing.');
65
+ console.warn('');
66
+ }
67
+ else {
68
+ console.log(` Snippet: ${snippet.length} characters extracted`);
69
+ }
70
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
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.4",
49
- "@pr-pm/types": "^0.1.4",
48
+ "@pr-pm/registry-client": "^1.2.6",
49
+ "@pr-pm/types": "^0.1.6",
50
50
  "ajv": "^8.17.1",
51
51
  "ajv-formats": "^3.0.1",
52
52
  "commander": "^11.1.0",
@@ -113,6 +113,15 @@
113
113
  "BSD-3-Clause"
114
114
  ]
115
115
  },
116
+ "license_text": {
117
+ "type": "string",
118
+ "description": "Full text of the license file for proper attribution"
119
+ },
120
+ "license_url": {
121
+ "type": "string",
122
+ "format": "uri",
123
+ "description": "URL to the license file in the repository"
124
+ },
116
125
  "repository": {
117
126
  "type": "string",
118
127
  "format": "uri",
@@ -131,6 +140,19 @@
131
140
  "format": "uri",
132
141
  "description": "Documentation URL"
133
142
  },
143
+ "organization": {
144
+ "type": "string",
145
+ "description": "Organization name or ID to publish this package under. If not specified, publishes to personal account.",
146
+ "examples": [
147
+ "my-team",
148
+ "my-company"
149
+ ]
150
+ },
151
+ "private": {
152
+ "type": "boolean",
153
+ "description": "Whether the package is private. Private packages are only accessible to the owner/organization members. Defaults to false (public).",
154
+ "default": false
155
+ },
134
156
  "tags": {
135
157
  "type": "array",
136
158
  "description": "Package tags for categorization",
@@ -337,6 +359,14 @@
337
359
  "node": ">=18.0.0"
338
360
  }
339
361
  ]
362
+ },
363
+ "packages": {
364
+ "type": "array",
365
+ "description": "Array of packages to publish from a single manifest (multi-package publishing). Packages inherit top-level fields unless overridden.",
366
+ "items": {
367
+ "$ref": "#"
368
+ },
369
+ "minItems": 1
340
370
  }
341
371
  },
342
372
  "additionalProperties": false,
@@ -353,6 +383,19 @@
353
383
  "README.md"
354
384
  ]
355
385
  },
386
+ {
387
+ "name": "@company/team-package",
388
+ "version": "1.0.0",
389
+ "description": "A package published under organization account",
390
+ "format": "cursor",
391
+ "author": "Team Name",
392
+ "organization": "my-company",
393
+ "license": "MIT",
394
+ "files": [
395
+ ".cursor/rules/guidelines.mdc",
396
+ "README.md"
397
+ ]
398
+ },
356
399
  {
357
400
  "name": "@username/cursor-rules",
358
401
  "version": "1.0.0",
@@ -461,6 +504,51 @@
461
504
  "files": [
462
505
  ".windsurfrules"
463
506
  ]
507
+ },
508
+ {
509
+ "name": "@company/private-package",
510
+ "version": "1.0.0",
511
+ "description": "A private package only accessible to organization members",
512
+ "format": "claude",
513
+ "subtype": "skill",
514
+ "author": "Company Team",
515
+ "organization": "my-company",
516
+ "private": true,
517
+ "license": "Proprietary",
518
+ "files": [
519
+ "internal-skill.md",
520
+ "README.md"
521
+ ]
522
+ },
523
+ {
524
+ "name": "@username/multi-package-example",
525
+ "version": "1.0.0",
526
+ "description": "Multi-package manifest example",
527
+ "author": "Your Name",
528
+ "license": "MIT",
529
+ "repository": "https://github.com/username/multi-package",
530
+ "packages": [
531
+ {
532
+ "name": "@username/package-one",
533
+ "version": "1.0.0",
534
+ "description": "First package in the multi-package manifest",
535
+ "format": "claude",
536
+ "subtype": "skill",
537
+ "files": [
538
+ "package-one/SKILL.md"
539
+ ]
540
+ },
541
+ {
542
+ "name": "@username/package-two",
543
+ "version": "1.0.0",
544
+ "description": "Second package with different settings",
545
+ "format": "cursor",
546
+ "private": true,
547
+ "files": [
548
+ "package-two/.cursor/rules/main.mdc"
549
+ ]
550
+ }
551
+ ]
464
552
  }
465
553
  ]
466
554
  }