prpm 1.2.1 ā 2.0.1
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.
- package/README.md +90 -862
- package/dist/index.js +23233 -65
- package/dist/schemas/agents-md.schema.json +24 -0
- package/dist/schemas/aider.schema.json +24 -0
- package/dist/schemas/canonical.schema.json +435 -0
- package/dist/schemas/claude-agent.schema.json +62 -0
- package/dist/schemas/claude-hook.schema.json +70 -0
- package/dist/schemas/claude-plugin.schema.json +122 -0
- package/dist/schemas/claude-skill.schema.json +51 -0
- package/dist/schemas/claude-slash-command.schema.json +77 -0
- package/dist/schemas/claude.schema.json +52 -0
- package/dist/schemas/continue.schema.json +98 -0
- package/dist/schemas/copilot.schema.json +76 -0
- package/dist/schemas/cursor-command.schema.json +27 -0
- package/dist/schemas/cursor-hooks.schema.json +59 -0
- package/dist/schemas/cursor.schema.json +74 -0
- package/dist/schemas/droid-hook.schema.json +103 -0
- package/dist/schemas/droid-skill.schema.json +46 -0
- package/dist/schemas/droid-slash-command.schema.json +53 -0
- package/dist/schemas/droid.schema.json +46 -0
- package/dist/schemas/format-registry.schema.json +99 -0
- package/dist/schemas/gemini-md.schema.json +24 -0
- package/dist/schemas/gemini.schema.json +30 -0
- package/dist/schemas/kiro-agent.schema.json +146 -0
- package/dist/schemas/kiro-hook.schema.json +120 -0
- package/dist/schemas/kiro-steering.schema.json +74 -0
- package/dist/schemas/mcp-server.schema.json +130 -0
- package/dist/schemas/opencode-slash-command.schema.json +60 -0
- package/dist/schemas/opencode.schema.json +111 -0
- package/dist/schemas/prpm-manifest.schema.json +733 -0
- package/dist/schemas/replit.schema.json +21 -0
- package/dist/schemas/ruler.schema.json +22 -0
- package/dist/schemas/trae.schema.json +24 -0
- package/dist/schemas/windsurf.schema.json +22 -0
- package/dist/schemas/zencoder.schema.json +51 -0
- package/package.json +20 -14
- package/schemas/prpm-manifest.schema.json +465 -39
- package/dist/__tests__/e2e/test-helpers.js +0 -150
- package/dist/commands/collections.js +0 -606
- package/dist/commands/index.js +0 -186
- package/dist/commands/info.js +0 -82
- package/dist/commands/install.js +0 -477
- package/dist/commands/list.js +0 -166
- package/dist/commands/login.js +0 -281
- package/dist/commands/outdated.js +0 -128
- package/dist/commands/popular.js +0 -27
- package/dist/commands/publish.js +0 -274
- package/dist/commands/schema.js +0 -37
- package/dist/commands/search.js +0 -404
- package/dist/commands/telemetry.js +0 -103
- package/dist/commands/trending.js +0 -76
- package/dist/commands/uninstall.js +0 -77
- package/dist/commands/update.js +0 -121
- package/dist/commands/upgrade.js +0 -121
- package/dist/commands/whoami.js +0 -75
- package/dist/core/claude-config.js +0 -91
- package/dist/core/cursor-config.js +0 -130
- package/dist/core/downloader.js +0 -64
- package/dist/core/filesystem.js +0 -124
- package/dist/core/lockfile.js +0 -239
- package/dist/core/marketplace-converter.js +0 -198
- package/dist/core/registry-client.js +0 -265
- package/dist/core/schema-validator.js +0 -74
- package/dist/core/telemetry.js +0 -175
- package/dist/core/user-config.js +0 -79
- package/dist/types/registry.js +0 -5
- package/dist/types.js +0 -5
package/dist/commands/publish.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Publish command implementation
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.handlePublish = handlePublish;
|
|
40
|
-
exports.createPublishCommand = createPublishCommand;
|
|
41
|
-
const commander_1 = require("commander");
|
|
42
|
-
const promises_1 = require("fs/promises");
|
|
43
|
-
const path_1 = require("path");
|
|
44
|
-
const tar = __importStar(require("tar"));
|
|
45
|
-
const os_1 = require("os");
|
|
46
|
-
const crypto_1 = require("crypto");
|
|
47
|
-
const registry_client_1 = require("@pr-pm/registry-client");
|
|
48
|
-
const user_config_1 = require("../core/user-config");
|
|
49
|
-
const telemetry_1 = require("../core/telemetry");
|
|
50
|
-
const marketplace_converter_1 = require("../core/marketplace-converter");
|
|
51
|
-
const schema_validator_1 = require("../core/schema-validator");
|
|
52
|
-
/**
|
|
53
|
-
* Try to find and load a manifest file
|
|
54
|
-
* Checks for:
|
|
55
|
-
* 1. prpm.json (native format)
|
|
56
|
-
* 2. .claude/marketplace.json (Claude format)
|
|
57
|
-
*/
|
|
58
|
-
async function findAndLoadManifest() {
|
|
59
|
-
// Try prpm.json first (native format)
|
|
60
|
-
const prpmJsonPath = (0, path_1.join)(process.cwd(), 'prpm.json');
|
|
61
|
-
try {
|
|
62
|
-
const content = await (0, promises_1.readFile)(prpmJsonPath, 'utf-8');
|
|
63
|
-
const manifest = JSON.parse(content);
|
|
64
|
-
const validated = validateManifest(manifest);
|
|
65
|
-
return { manifest: validated, source: 'prpm.json' };
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
// prpm.json not found or invalid, try marketplace.json
|
|
69
|
-
}
|
|
70
|
-
// Try .claude/marketplace.json (Claude format)
|
|
71
|
-
const marketplaceJsonPath = (0, path_1.join)(process.cwd(), '.claude', 'marketplace.json');
|
|
72
|
-
try {
|
|
73
|
-
const content = await (0, promises_1.readFile)(marketplaceJsonPath, 'utf-8');
|
|
74
|
-
const marketplaceData = JSON.parse(content);
|
|
75
|
-
if (!(0, marketplace_converter_1.validateMarketplaceJson)(marketplaceData)) {
|
|
76
|
-
throw new Error('Invalid marketplace.json format');
|
|
77
|
-
}
|
|
78
|
-
// Convert marketplace.json to PRPM manifest
|
|
79
|
-
const manifest = (0, marketplace_converter_1.marketplaceToManifest)(marketplaceData);
|
|
80
|
-
// Validate the converted manifest
|
|
81
|
-
const validated = validateManifest(manifest);
|
|
82
|
-
return { manifest: validated, source: '.claude/marketplace.json' };
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
// marketplace.json not found or invalid
|
|
86
|
-
}
|
|
87
|
-
// Neither file found
|
|
88
|
-
throw new Error('No manifest file found. Expected either:\n' +
|
|
89
|
-
' - prpm.json in the current directory, or\n' +
|
|
90
|
-
' - .claude/marketplace.json (Claude format)');
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Validate package manifest
|
|
94
|
-
*/
|
|
95
|
-
function validateManifest(manifest) {
|
|
96
|
-
// First, validate against JSON schema
|
|
97
|
-
const schemaValidation = (0, schema_validator_1.validateManifestSchema)(manifest);
|
|
98
|
-
if (!schemaValidation.valid) {
|
|
99
|
-
const errorMessages = schemaValidation.errors?.join('\n - ') || 'Unknown validation error';
|
|
100
|
-
throw new Error(`Manifest validation failed:\n - ${errorMessages}`);
|
|
101
|
-
}
|
|
102
|
-
// Additional custom validations (beyond what JSON schema can express)
|
|
103
|
-
// Check if using enhanced format (file objects)
|
|
104
|
-
const hasEnhancedFormat = manifest.files.some(f => typeof f === 'object');
|
|
105
|
-
if (hasEnhancedFormat) {
|
|
106
|
-
// Check if files have multiple distinct types
|
|
107
|
-
const fileTypes = new Set(manifest.files
|
|
108
|
-
.filter(f => typeof f === 'object')
|
|
109
|
-
.map(f => f.type));
|
|
110
|
-
// Only suggest "collection" if there are multiple distinct types
|
|
111
|
-
if (fileTypes.size > 1 && manifest.type !== 'collection') {
|
|
112
|
-
console.warn('ā ļø Package contains multiple file types. Consider setting type to "collection" for clarity.');
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return manifest;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Normalize files array to string paths
|
|
119
|
-
* Converts both simple and enhanced formats to string array
|
|
120
|
-
*/
|
|
121
|
-
function normalizeFilePaths(files) {
|
|
122
|
-
return files.map(file => {
|
|
123
|
-
if (typeof file === 'string') {
|
|
124
|
-
return file;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
return file.path;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Create tarball from current directory
|
|
133
|
-
*/
|
|
134
|
-
async function createTarball(manifest) {
|
|
135
|
-
const tmpDir = (0, path_1.join)((0, os_1.tmpdir)(), `prpm-${(0, crypto_1.randomBytes)(8).toString('hex')}`);
|
|
136
|
-
const tarballPath = (0, path_1.join)(tmpDir, 'package.tar.gz');
|
|
137
|
-
try {
|
|
138
|
-
// Create temp directory
|
|
139
|
-
await (0, promises_1.mkdir)(tmpDir, { recursive: true });
|
|
140
|
-
// Get files to include - normalize to string paths
|
|
141
|
-
const filePaths = normalizeFilePaths(manifest.files);
|
|
142
|
-
// Add standard files if not already included
|
|
143
|
-
const standardFiles = ['prpm.json', 'README.md', 'LICENSE'];
|
|
144
|
-
for (const file of standardFiles) {
|
|
145
|
-
if (!filePaths.includes(file)) {
|
|
146
|
-
filePaths.push(file);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
// Check which files exist
|
|
150
|
-
const existingFiles = [];
|
|
151
|
-
for (const file of filePaths) {
|
|
152
|
-
try {
|
|
153
|
-
await (0, promises_1.stat)(file);
|
|
154
|
-
existingFiles.push(file);
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
// File doesn't exist, skip
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (existingFiles.length === 0) {
|
|
161
|
-
throw new Error('No package files found to include in tarball');
|
|
162
|
-
}
|
|
163
|
-
// Create tarball
|
|
164
|
-
await tar.create({
|
|
165
|
-
gzip: true,
|
|
166
|
-
file: tarballPath,
|
|
167
|
-
cwd: process.cwd(),
|
|
168
|
-
}, existingFiles);
|
|
169
|
-
// Read tarball into buffer
|
|
170
|
-
const tarballBuffer = await (0, promises_1.readFile)(tarballPath);
|
|
171
|
-
// Check size (max 10MB)
|
|
172
|
-
const sizeMB = tarballBuffer.length / (1024 * 1024);
|
|
173
|
-
if (sizeMB > 10) {
|
|
174
|
-
throw new Error(`Package size (${sizeMB.toFixed(2)}MB) exceeds 10MB limit`);
|
|
175
|
-
}
|
|
176
|
-
return tarballBuffer;
|
|
177
|
-
}
|
|
178
|
-
catch (error) {
|
|
179
|
-
throw error;
|
|
180
|
-
}
|
|
181
|
-
finally {
|
|
182
|
-
// Clean up temp directory
|
|
183
|
-
try {
|
|
184
|
-
await (0, promises_1.rm)(tmpDir, { recursive: true, force: true });
|
|
185
|
-
}
|
|
186
|
-
catch {
|
|
187
|
-
// Ignore cleanup errors
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Publish a package to the registry
|
|
193
|
-
*/
|
|
194
|
-
async function handlePublish(options) {
|
|
195
|
-
const startTime = Date.now();
|
|
196
|
-
let success = false;
|
|
197
|
-
let error;
|
|
198
|
-
let packageName;
|
|
199
|
-
let version;
|
|
200
|
-
try {
|
|
201
|
-
const config = await (0, user_config_1.getConfig)();
|
|
202
|
-
// Check if logged in
|
|
203
|
-
if (!config.token) {
|
|
204
|
-
console.error('ā Not logged in. Run "prpm login" first.');
|
|
205
|
-
process.exit(1);
|
|
206
|
-
}
|
|
207
|
-
console.log('š¦ Publishing package...\n');
|
|
208
|
-
// Read and validate manifest
|
|
209
|
-
console.log('š Validating package manifest...');
|
|
210
|
-
const { manifest, source } = await findAndLoadManifest();
|
|
211
|
-
packageName = manifest.name;
|
|
212
|
-
version = manifest.version;
|
|
213
|
-
console.log(` Source: ${source}`);
|
|
214
|
-
console.log(` Package: ${manifest.name}@${manifest.version}`);
|
|
215
|
-
console.log(` Type: ${manifest.type}`);
|
|
216
|
-
console.log(` Description: ${manifest.description}`);
|
|
217
|
-
console.log('');
|
|
218
|
-
// Create tarball
|
|
219
|
-
console.log('š¦ Creating package tarball...');
|
|
220
|
-
const tarball = await createTarball(manifest);
|
|
221
|
-
const sizeMB = (tarball.length / (1024 * 1024)).toFixed(2);
|
|
222
|
-
console.log(` Size: ${sizeMB}MB`);
|
|
223
|
-
console.log('');
|
|
224
|
-
if (options.dryRun) {
|
|
225
|
-
console.log('ā
Dry run successful! Package is ready to publish.');
|
|
226
|
-
console.log(' Run without --dry-run to publish.');
|
|
227
|
-
success = true;
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
// Publish to registry
|
|
231
|
-
console.log('š Publishing to registry...');
|
|
232
|
-
const client = (0, registry_client_1.getRegistryClient)(config);
|
|
233
|
-
const result = await client.publish(manifest, tarball);
|
|
234
|
-
console.log('');
|
|
235
|
-
console.log('ā
Package published successfully!');
|
|
236
|
-
console.log('');
|
|
237
|
-
console.log(` Package: ${manifest.name}@${result.version}`);
|
|
238
|
-
console.log(` Install: prpm install ${manifest.name}`);
|
|
239
|
-
console.log(` View: ${config.registryUrl}/packages/${result.package_id}`);
|
|
240
|
-
console.log('');
|
|
241
|
-
success = true;
|
|
242
|
-
}
|
|
243
|
-
catch (err) {
|
|
244
|
-
error = err instanceof Error ? err.message : String(err);
|
|
245
|
-
console.error(`\nā Failed to publish package: ${error}\n`);
|
|
246
|
-
process.exit(1);
|
|
247
|
-
}
|
|
248
|
-
finally {
|
|
249
|
-
// Track telemetry
|
|
250
|
-
await telemetry_1.telemetry.track({
|
|
251
|
-
command: 'publish',
|
|
252
|
-
success,
|
|
253
|
-
error,
|
|
254
|
-
duration: Date.now() - startTime,
|
|
255
|
-
data: {
|
|
256
|
-
packageName,
|
|
257
|
-
version,
|
|
258
|
-
dryRun: options.dryRun,
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
await telemetry_1.telemetry.shutdown();
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Create the publish command
|
|
266
|
-
*/
|
|
267
|
-
function createPublishCommand() {
|
|
268
|
-
return new commander_1.Command('publish')
|
|
269
|
-
.description('Publish a package to the registry')
|
|
270
|
-
.option('--access <type>', 'Package access (public or private)', 'public')
|
|
271
|
-
.option('--tag <tag>', 'NPM-style tag (e.g., latest, beta)', 'latest')
|
|
272
|
-
.option('--dry-run', 'Validate package without publishing')
|
|
273
|
-
.action(handlePublish);
|
|
274
|
-
}
|
package/dist/commands/schema.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Schema command - Export and display JSON schema
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handleSchema = handleSchema;
|
|
7
|
-
exports.createSchemaCommand = createSchemaCommand;
|
|
8
|
-
const commander_1 = require("commander");
|
|
9
|
-
const schema_validator_1 = require("../core/schema-validator");
|
|
10
|
-
/**
|
|
11
|
-
* Handle the schema command
|
|
12
|
-
*/
|
|
13
|
-
async function handleSchema() {
|
|
14
|
-
try {
|
|
15
|
-
const schema = (0, schema_validator_1.getManifestSchema)();
|
|
16
|
-
if (!schema) {
|
|
17
|
-
console.error('ā Schema not available');
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
// Output the schema as pretty-printed JSON
|
|
21
|
-
console.log(JSON.stringify(schema, null, 2));
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error(`ā Failed to export schema: ${error}`);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Create the schema command
|
|
30
|
-
*/
|
|
31
|
-
function createSchemaCommand() {
|
|
32
|
-
const command = new commander_1.Command('schema');
|
|
33
|
-
command
|
|
34
|
-
.description('Display the PRPM manifest JSON schema')
|
|
35
|
-
.action(handleSchema);
|
|
36
|
-
return command;
|
|
37
|
-
}
|