prpm 0.0.14 → 0.0.16
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/dist/commands/catalog.js +22 -5
- package/dist/commands/install.js +3 -1
- package/dist/commands/publish.js +12 -0
- package/package.json +3 -3
package/dist/commands/catalog.js
CHANGED
|
@@ -9,6 +9,7 @@ const commander_1 = require("commander");
|
|
|
9
9
|
const promises_1 = require("fs/promises");
|
|
10
10
|
const path_1 = require("path");
|
|
11
11
|
const telemetry_1 = require("../core/telemetry");
|
|
12
|
+
const lockfile_1 = require("../core/lockfile");
|
|
12
13
|
/**
|
|
13
14
|
* Detect format and subtype from file path and content
|
|
14
15
|
*/
|
|
@@ -205,15 +206,31 @@ async function handleCatalog(directories, options) {
|
|
|
205
206
|
console.log(` ⚠️ Could not access ${dir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
// Read lockfile to exclude packages installed from other users
|
|
210
|
+
const lockfile = await (0, lockfile_1.readLockfile)();
|
|
211
|
+
const installedPackageIds = new Set(lockfile ? Object.keys(lockfile.packages) : []);
|
|
212
|
+
// Filter out packages that are installed from the registry (not user-created)
|
|
213
|
+
const filteredDiscovered = allDiscovered.filter(pkg => {
|
|
214
|
+
// Check if this package exists in lockfile
|
|
215
|
+
// Package ID in lockfile could be: "package-name", "@author/package-name"
|
|
216
|
+
// Check both formats
|
|
217
|
+
const isInstalled = installedPackageIds.has(pkg.name) ||
|
|
218
|
+
Array.from(installedPackageIds).some(id => id.endsWith(`/${pkg.name}`));
|
|
219
|
+
if (isInstalled) {
|
|
220
|
+
console.log(` ⏩ Skipping ${pkg.name} (installed from registry, not user-created)`);
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
});
|
|
225
|
+
console.log(`\n✨ Discovered ${filteredDiscovered.length} package(s) total:\n`);
|
|
226
|
+
if (filteredDiscovered.length === 0) {
|
|
227
|
+
console.log('No user-created packages found. Try scanning different directories or check if all packages were installed from registry.');
|
|
211
228
|
success = true;
|
|
212
229
|
return;
|
|
213
230
|
}
|
|
214
231
|
// Display discovered packages
|
|
215
232
|
const byFormat = new Map();
|
|
216
|
-
for (const pkg of
|
|
233
|
+
for (const pkg of filteredDiscovered) {
|
|
217
234
|
if (!byFormat.has(pkg.format)) {
|
|
218
235
|
byFormat.set(pkg.format, []);
|
|
219
236
|
}
|
|
@@ -270,7 +287,7 @@ async function handleCatalog(directories, options) {
|
|
|
270
287
|
// Convert discovered packages to manifests
|
|
271
288
|
const existingNames = new Set(manifest.packages.map(p => p.name));
|
|
272
289
|
let addedCount = 0;
|
|
273
|
-
for (const discovered of
|
|
290
|
+
for (const discovered of filteredDiscovered) {
|
|
274
291
|
// Skip if already exists
|
|
275
292
|
if (existingNames.has(discovered.name)) {
|
|
276
293
|
console.log(` ⚠️ Skipping ${discovered.name} (already in prpm.json)`);
|
package/dist/commands/install.js
CHANGED
|
@@ -444,8 +444,10 @@ async function extractTarball(tarball, packageId) {
|
|
|
444
444
|
});
|
|
445
445
|
// Read all extracted files
|
|
446
446
|
const extractedFiles = await fs.promises.readdir(tmpDir, { withFileTypes: true, recursive: true });
|
|
447
|
+
// Files to exclude from package content (metadata files)
|
|
448
|
+
const excludeFiles = ['package.tar', 'prpm.json', 'README.md', 'LICENSE', 'LICENSE.txt', 'LICENSE.md'];
|
|
447
449
|
for (const entry of extractedFiles) {
|
|
448
|
-
if (entry.isFile() && entry.name
|
|
450
|
+
if (entry.isFile() && !excludeFiles.includes(entry.name)) {
|
|
449
451
|
const filePath = path.join(entry.path || tmpDir, entry.name);
|
|
450
452
|
const content = await fs.promises.readFile(filePath, 'utf-8');
|
|
451
453
|
const relativePath = path.relative(tmpDir, filePath);
|
package/dist/commands/publish.js
CHANGED
|
@@ -509,6 +509,10 @@ async function handlePublish(options) {
|
|
|
509
509
|
}
|
|
510
510
|
// Publish to registry
|
|
511
511
|
console.log('🚀 Publishing to registry...');
|
|
512
|
+
if (selectedOrgId) {
|
|
513
|
+
console.log(` Publishing as organization: ${userInfo.organizations.find((org) => org.id === selectedOrgId)?.name}`);
|
|
514
|
+
console.log(` Organization ID: ${selectedOrgId}`);
|
|
515
|
+
}
|
|
512
516
|
const result = await client.publish(manifest, tarball, selectedOrgId ? { orgId: selectedOrgId } : undefined);
|
|
513
517
|
// Determine the webapp URL based on registry URL
|
|
514
518
|
let webappUrl;
|
|
@@ -568,6 +572,14 @@ async function handlePublish(options) {
|
|
|
568
572
|
console.log(` - ${pkg.name}: ${pkg.error}`);
|
|
569
573
|
});
|
|
570
574
|
console.log('');
|
|
575
|
+
// Provide hints for common permission errors
|
|
576
|
+
if (failedPackages.some(pkg => pkg.error.includes('Forbidden'))) {
|
|
577
|
+
console.log('💡 Forbidden errors usually mean:');
|
|
578
|
+
console.log(' - The package already exists and you don\'t have permission to update it');
|
|
579
|
+
console.log(' - The package belongs to an organization and you\'re not a member with publish rights');
|
|
580
|
+
console.log(' - Try: prpm whoami (to check your organization memberships)');
|
|
581
|
+
console.log('');
|
|
582
|
+
}
|
|
571
583
|
}
|
|
572
584
|
}
|
|
573
585
|
success = publishedPackages.length > 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prpm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
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.
|
|
49
|
-
"@pr-pm/types": "^0.1.
|
|
48
|
+
"@pr-pm/registry-client": "^1.2.10",
|
|
49
|
+
"@pr-pm/types": "^0.1.10",
|
|
50
50
|
"ajv": "^8.17.1",
|
|
51
51
|
"ajv-formats": "^3.0.1",
|
|
52
52
|
"commander": "^11.1.0",
|