prpm 2.1.21 → 2.1.22
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/index.js +585 -283
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1179,8 +1179,8 @@ function extractAtReferences(content) {
|
|
|
1179
1179
|
const refs = Array.from(matches, (m) => m[1]);
|
|
1180
1180
|
return [...new Set(refs)];
|
|
1181
1181
|
}
|
|
1182
|
-
function categorizeFile(
|
|
1183
|
-
const pathLower =
|
|
1182
|
+
function categorizeFile(path12) {
|
|
1183
|
+
const pathLower = path12.toLowerCase();
|
|
1184
1184
|
if (pathLower.includes("/patterns/") || pathLower.includes("/pattern/") || pathLower.startsWith("patterns/") || pathLower.startsWith("pattern/")) {
|
|
1185
1185
|
return "pattern";
|
|
1186
1186
|
}
|
|
@@ -1204,8 +1204,8 @@ function categorizeFile(path11) {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
return "other";
|
|
1206
1206
|
}
|
|
1207
|
-
function detectContentType(
|
|
1208
|
-
const ext = (0, import_path5.extname)(
|
|
1207
|
+
function detectContentType(path12) {
|
|
1208
|
+
const ext = (0, import_path5.extname)(path12).toLowerCase();
|
|
1209
1209
|
const typeMap = {
|
|
1210
1210
|
".md": "text/markdown",
|
|
1211
1211
|
".txt": "text/plain",
|
|
@@ -1267,8 +1267,8 @@ function loadReferencedFiles(references, basePath) {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
function extractDirectories(filePaths) {
|
|
1269
1269
|
const dirs = /* @__PURE__ */ new Set();
|
|
1270
|
-
for (const
|
|
1271
|
-
const dir = (0, import_path5.dirname)(
|
|
1270
|
+
for (const path12 of filePaths) {
|
|
1271
|
+
const dir = (0, import_path5.dirname)(path12);
|
|
1272
1272
|
if (dir && dir !== ".") {
|
|
1273
1273
|
dirs.add(dir);
|
|
1274
1274
|
const parts = dir.split("/");
|
|
@@ -8953,11 +8953,11 @@ function validateFormat(format, data, subtype) {
|
|
|
8953
8953
|
const warnings = [];
|
|
8954
8954
|
if (!valid && validate.errors) {
|
|
8955
8955
|
for (const error of validate.errors) {
|
|
8956
|
-
const
|
|
8956
|
+
const path12 = error.instancePath || "/" + error.params.missingProperty || "/";
|
|
8957
8957
|
const message = error.message || "Validation error";
|
|
8958
8958
|
const validationError = {
|
|
8959
|
-
path:
|
|
8960
|
-
message: `${
|
|
8959
|
+
path: path12,
|
|
8960
|
+
message: `${path12}: ${message}`,
|
|
8961
8961
|
value: error.data
|
|
8962
8962
|
};
|
|
8963
8963
|
if (error.keyword === "deprecated") {
|
|
@@ -15214,7 +15214,7 @@ async function handleCollectionsSearch(query, options) {
|
|
|
15214
15214
|
const startTime = Date.now();
|
|
15215
15215
|
try {
|
|
15216
15216
|
const config = await getConfig();
|
|
15217
|
-
const client = (0,
|
|
15217
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15218
15218
|
console.log(`\u{1F50D} Searching collections for "${query}"...
|
|
15219
15219
|
`);
|
|
15220
15220
|
const result = await client.getCollections({
|
|
@@ -15307,7 +15307,7 @@ async function handleCollectionsList(options) {
|
|
|
15307
15307
|
const startTime = Date.now();
|
|
15308
15308
|
try {
|
|
15309
15309
|
const config = await getConfig();
|
|
15310
|
-
const client = (0,
|
|
15310
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15311
15311
|
console.log("\u{1F4E6} Searching collections...\n");
|
|
15312
15312
|
const result = await client.getCollections({
|
|
15313
15313
|
category: options.category,
|
|
@@ -15408,7 +15408,7 @@ async function handleCollectionInfo(collectionSpec) {
|
|
|
15408
15408
|
}
|
|
15409
15409
|
[, name_slug, version] = match;
|
|
15410
15410
|
const config = await getConfig();
|
|
15411
|
-
const client = (0,
|
|
15411
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15412
15412
|
console.log(`\u{1F4E6} Loading collection: ${name_slug}...
|
|
15413
15413
|
`);
|
|
15414
15414
|
const collection = await client.getCollection(name_slug, version);
|
|
@@ -15499,14 +15499,14 @@ async function handleCollectionPublish(manifestPath = "./collection.json") {
|
|
|
15499
15499
|
const startTime = Date.now();
|
|
15500
15500
|
try {
|
|
15501
15501
|
const config = await getConfig();
|
|
15502
|
-
const client = (0,
|
|
15502
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15503
15503
|
if (!config.token) {
|
|
15504
15504
|
console.error("\n\u274C Authentication required. Run `prpm login` first.\n");
|
|
15505
15505
|
throw new CLIError("\n\u274C Authentication required. Run `prpm login` first.", 1);
|
|
15506
15506
|
}
|
|
15507
15507
|
console.log("\u{1F4E6} Publishing collection...\n");
|
|
15508
|
-
const
|
|
15509
|
-
const manifestContent = await
|
|
15508
|
+
const fs16 = await import("fs/promises");
|
|
15509
|
+
const manifestContent = await fs16.readFile(manifestPath, "utf-8");
|
|
15510
15510
|
const manifest = JSON.parse(manifestContent);
|
|
15511
15511
|
const required = ["id", "name", "description", "packages"];
|
|
15512
15512
|
const missing = required.filter((field) => !manifest[field]);
|
|
@@ -15602,7 +15602,7 @@ async function handleCollectionDeprecate(collectionSpec, options) {
|
|
|
15602
15602
|
console.error("\n\u274C Authentication required. Run `prpm login` first.\n");
|
|
15603
15603
|
throw new CLIError("Authentication required. Run `prpm login` first.", 1);
|
|
15604
15604
|
}
|
|
15605
|
-
const client = (0,
|
|
15605
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15606
15606
|
const action = options.undo ? "Undeprecating" : "Deprecating";
|
|
15607
15607
|
console.log(`\u26A0\uFE0F ${action} collection: ${name_slug}...
|
|
15608
15608
|
`);
|
|
@@ -15663,7 +15663,7 @@ async function handleCollectionInstall(collectionSpec, options) {
|
|
|
15663
15663
|
}
|
|
15664
15664
|
[, name_slug, version] = match;
|
|
15665
15665
|
const config = await getConfig();
|
|
15666
|
-
const client = (0,
|
|
15666
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15667
15667
|
console.log(`\u{1F4E6} Installing collection: ${name_slug}...
|
|
15668
15668
|
`);
|
|
15669
15669
|
const installResult = await client.installCollection({
|
|
@@ -15776,7 +15776,7 @@ async function handleCollectionInstall(collectionSpec, options) {
|
|
|
15776
15776
|
}
|
|
15777
15777
|
}
|
|
15778
15778
|
function createCollectionsCommand() {
|
|
15779
|
-
const command = new
|
|
15779
|
+
const command = new import_commander11.Command("collections");
|
|
15780
15780
|
command.description("Manage package collections").alias("collection").action(async (options) => {
|
|
15781
15781
|
await handleCollectionsList(options);
|
|
15782
15782
|
});
|
|
@@ -15798,13 +15798,13 @@ function createCollectionsCommand() {
|
|
|
15798
15798
|
});
|
|
15799
15799
|
return command;
|
|
15800
15800
|
}
|
|
15801
|
-
var
|
|
15801
|
+
var import_commander11, import_registry_client5;
|
|
15802
15802
|
var init_collections = __esm({
|
|
15803
15803
|
"src/commands/collections.ts"() {
|
|
15804
15804
|
"use strict";
|
|
15805
15805
|
init_cjs_shims();
|
|
15806
|
-
|
|
15807
|
-
|
|
15806
|
+
import_commander11 = require("commander");
|
|
15807
|
+
import_registry_client5 = require("@pr-pm/registry-client");
|
|
15808
15808
|
init_user_config();
|
|
15809
15809
|
init_install();
|
|
15810
15810
|
init_telemetry();
|
|
@@ -16061,7 +16061,7 @@ function findMainFile(files, format, subtype) {
|
|
|
16061
16061
|
const nestedIndicator = getNestedIndicator(format, subtype);
|
|
16062
16062
|
if (nestedIndicator) {
|
|
16063
16063
|
const match = files.find((f) => {
|
|
16064
|
-
const filename =
|
|
16064
|
+
const filename = import_path15.default.basename(f.name);
|
|
16065
16065
|
return filename.toLowerCase() === nestedIndicator.toLowerCase();
|
|
16066
16066
|
});
|
|
16067
16067
|
if (match) return match;
|
|
@@ -16070,7 +16070,7 @@ function findMainFile(files, format, subtype) {
|
|
|
16070
16070
|
if (filePatterns) {
|
|
16071
16071
|
for (const pattern of filePatterns) {
|
|
16072
16072
|
for (const file of files) {
|
|
16073
|
-
const filename =
|
|
16073
|
+
const filename = import_path15.default.basename(file.name);
|
|
16074
16074
|
if (pattern.startsWith("*")) {
|
|
16075
16075
|
const extension = pattern.slice(1);
|
|
16076
16076
|
if (filename.endsWith(extension)) {
|
|
@@ -16101,7 +16101,7 @@ function findMainFile(files, format, subtype) {
|
|
|
16101
16101
|
];
|
|
16102
16102
|
for (const pattern of fallbackPatterns) {
|
|
16103
16103
|
for (const file of files) {
|
|
16104
|
-
const filename =
|
|
16104
|
+
const filename = import_path15.default.basename(file.name);
|
|
16105
16105
|
if (filename.toLowerCase() === pattern.toLowerCase()) {
|
|
16106
16106
|
return file;
|
|
16107
16107
|
}
|
|
@@ -16182,10 +16182,10 @@ async function handleInstall(packageSpec, options) {
|
|
|
16182
16182
|
let isDifferentLocation = false;
|
|
16183
16183
|
if (requestedLocation && existingLocation) {
|
|
16184
16184
|
if (installedPkg.subtype === "snippet") {
|
|
16185
|
-
isDifferentLocation =
|
|
16185
|
+
isDifferentLocation = import_path15.default.resolve(requestedLocation) !== import_path15.default.resolve(existingLocation);
|
|
16186
16186
|
} else {
|
|
16187
|
-
const existingDir =
|
|
16188
|
-
isDifferentLocation =
|
|
16187
|
+
const existingDir = import_path15.default.dirname(existingLocation);
|
|
16188
|
+
isDifferentLocation = import_path15.default.resolve(requestedLocation) !== import_path15.default.resolve(existingDir);
|
|
16189
16189
|
}
|
|
16190
16190
|
}
|
|
16191
16191
|
if (!requestedVersion || requestedVersion === "latest" || requestedVersion === installedPkg.version) {
|
|
@@ -16222,7 +16222,7 @@ async function handleInstall(packageSpec, options) {
|
|
|
16222
16222
|
}
|
|
16223
16223
|
}
|
|
16224
16224
|
console.log(`\u{1F4E5} Installing ${packageId}@${version}...`);
|
|
16225
|
-
const client = (0,
|
|
16225
|
+
const client = (0, import_registry_client6.getRegistryClient)(config);
|
|
16226
16226
|
let isCollection = false;
|
|
16227
16227
|
try {
|
|
16228
16228
|
await client.getCollection(packageId, version === "latest" ? void 0 : version);
|
|
@@ -16534,9 +16534,9 @@ This could indicate:
|
|
|
16534
16534
|
(f) => f.name.startsWith("agents/") && f.name.endsWith(".md")
|
|
16535
16535
|
);
|
|
16536
16536
|
if (agentFiles.length > 0) {
|
|
16537
|
-
await
|
|
16537
|
+
await import_promises4.default.mkdir(".claude/agents", { recursive: true });
|
|
16538
16538
|
for (const file of agentFiles) {
|
|
16539
|
-
const filename =
|
|
16539
|
+
const filename = import_path15.default.basename(file.name);
|
|
16540
16540
|
const destFile = `.claude/agents/${filename}`;
|
|
16541
16541
|
await saveFile(destFile, file.content);
|
|
16542
16542
|
installedFiles.push(destFile);
|
|
@@ -16550,8 +16550,8 @@ This could indicate:
|
|
|
16550
16550
|
for (const file of skillFiles) {
|
|
16551
16551
|
const relativePath = file.name.replace(/^skills\//, "");
|
|
16552
16552
|
const destFile = `.claude/skills/${relativePath}`;
|
|
16553
|
-
const destFileDir =
|
|
16554
|
-
await
|
|
16553
|
+
const destFileDir = import_path15.default.dirname(destFile);
|
|
16554
|
+
await import_promises4.default.mkdir(destFileDir, { recursive: true });
|
|
16555
16555
|
await saveFile(destFile, file.content);
|
|
16556
16556
|
installedFiles.push(destFile);
|
|
16557
16557
|
}
|
|
@@ -16561,9 +16561,9 @@ This could indicate:
|
|
|
16561
16561
|
(f) => f.name.startsWith("commands/") && f.name.endsWith(".md")
|
|
16562
16562
|
);
|
|
16563
16563
|
if (commandFiles.length > 0) {
|
|
16564
|
-
await
|
|
16564
|
+
await import_promises4.default.mkdir(".claude/commands", { recursive: true });
|
|
16565
16565
|
for (const file of commandFiles) {
|
|
16566
|
-
const filename =
|
|
16566
|
+
const filename = import_path15.default.basename(file.name);
|
|
16567
16567
|
const destFile = `.claude/commands/${filename}`;
|
|
16568
16568
|
await saveFile(destFile, file.content);
|
|
16569
16569
|
installedFiles.push(destFile);
|
|
@@ -16674,7 +16674,7 @@ This could indicate:
|
|
|
16674
16674
|
destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
|
|
16675
16675
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
16676
16676
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
16677
|
-
destDir =
|
|
16677
|
+
destDir = import_path15.default.join(locationOverride, relativeDestDir);
|
|
16678
16678
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
16679
16679
|
}
|
|
16680
16680
|
let mainFile = extractedFiles[0].content;
|
|
@@ -16705,7 +16705,7 @@ This could indicate:
|
|
|
16705
16705
|
const manifestFilename = getManifestFilename(effectiveFormat);
|
|
16706
16706
|
let targetPath = manifestFilename;
|
|
16707
16707
|
if (locationOverride) {
|
|
16708
|
-
targetPath =
|
|
16708
|
+
targetPath = import_path15.default.join(locationOverride, `${manifestFilename.replace(".md", ".override.md")}`);
|
|
16709
16709
|
console.log(` \u{1F4C1} Installing to custom location: ${targetPath}`);
|
|
16710
16710
|
}
|
|
16711
16711
|
destPath = targetPath;
|
|
@@ -16799,7 +16799,7 @@ This could indicate:
|
|
|
16799
16799
|
let existingSettings = { hooks: {} };
|
|
16800
16800
|
if (await fileExists(destPath)) {
|
|
16801
16801
|
try {
|
|
16802
|
-
const existingContent = await
|
|
16802
|
+
const existingContent = await import_promises4.default.readFile(destPath, "utf-8");
|
|
16803
16803
|
existingSettings = JSON.parse(existingContent);
|
|
16804
16804
|
if (!existingSettings.hooks) {
|
|
16805
16805
|
existingSettings.hooks = {};
|
|
@@ -16853,7 +16853,7 @@ This could indicate:
|
|
|
16853
16853
|
}
|
|
16854
16854
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
16855
16855
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
16856
|
-
destDir =
|
|
16856
|
+
destDir = import_path15.default.join(locationOverride, relativeDestDir);
|
|
16857
16857
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
16858
16858
|
}
|
|
16859
16859
|
const isCursorConversion = effectiveFormat === "cursor" && pkg.format === "claude" && pkg.subtype === "skill";
|
|
@@ -16920,7 +16920,7 @@ This could indicate:
|
|
|
16920
16920
|
}
|
|
16921
16921
|
if (isCursorConversion && jsonFiles.length > 0) {
|
|
16922
16922
|
const mdcFile = `${packageDir}/${packageName}.mdc`;
|
|
16923
|
-
let mdcContent = await
|
|
16923
|
+
let mdcContent = await import_promises4.default.readFile(mdcFile, "utf-8");
|
|
16924
16924
|
const frontmatterMatch = mdcContent.match(/^---\n[\s\S]*?\n---\n/);
|
|
16925
16925
|
if (frontmatterMatch) {
|
|
16926
16926
|
const frontmatterEnd = frontmatterMatch[0].length;
|
|
@@ -17074,12 +17074,12 @@ ${afterFrontmatter}`;
|
|
|
17074
17074
|
await telemetry.shutdown();
|
|
17075
17075
|
}
|
|
17076
17076
|
}
|
|
17077
|
-
function
|
|
17078
|
-
const resolvedPath =
|
|
17079
|
-
const resolvedTarget =
|
|
17080
|
-
return resolvedPath.startsWith(resolvedTarget +
|
|
17077
|
+
function isPathSafe2(targetDir, filePath) {
|
|
17078
|
+
const resolvedPath = import_path15.default.resolve(targetDir, filePath);
|
|
17079
|
+
const resolvedTarget = import_path15.default.resolve(targetDir);
|
|
17080
|
+
return resolvedPath.startsWith(resolvedTarget + import_path15.default.sep) || resolvedPath === resolvedTarget;
|
|
17081
17081
|
}
|
|
17082
|
-
function
|
|
17082
|
+
function hasUnsafePathPatterns2(filePath) {
|
|
17083
17083
|
if (filePath.includes("..")) return true;
|
|
17084
17084
|
if (filePath.startsWith("/")) return true;
|
|
17085
17085
|
if (/^[a-zA-Z]:/.test(filePath)) return true;
|
|
@@ -17090,7 +17090,7 @@ async function extractTarball(tarball, packageId) {
|
|
|
17090
17090
|
let decompressed;
|
|
17091
17091
|
try {
|
|
17092
17092
|
decompressed = await new Promise((resolve3, reject) => {
|
|
17093
|
-
|
|
17093
|
+
import_zlib2.default.gunzip(tarball, (err, result) => {
|
|
17094
17094
|
if (err) {
|
|
17095
17095
|
reject(new Error(`Failed to decompress tarball: ${err.message}`));
|
|
17096
17096
|
return;
|
|
@@ -17101,10 +17101,10 @@ async function extractTarball(tarball, packageId) {
|
|
|
17101
17101
|
} catch (error) {
|
|
17102
17102
|
throw new CLIError(`Package decompression failed: ${error.message}`);
|
|
17103
17103
|
}
|
|
17104
|
-
const tmpDir = await
|
|
17104
|
+
const tmpDir = await import_promises4.default.mkdtemp(import_path15.default.join(import_os5.default.tmpdir(), "prpm-"));
|
|
17105
17105
|
const cleanup = async () => {
|
|
17106
17106
|
try {
|
|
17107
|
-
await
|
|
17107
|
+
await import_promises4.default.rm(tmpDir, { recursive: true, force: true });
|
|
17108
17108
|
} catch {
|
|
17109
17109
|
}
|
|
17110
17110
|
};
|
|
@@ -17118,7 +17118,7 @@ async function extractTarball(tarball, packageId) {
|
|
|
17118
17118
|
"LICENSE.md"
|
|
17119
17119
|
]);
|
|
17120
17120
|
try {
|
|
17121
|
-
const
|
|
17121
|
+
const extract3 = tar2.extract({
|
|
17122
17122
|
cwd: tmpDir,
|
|
17123
17123
|
strict: true,
|
|
17124
17124
|
// Enable strict mode to reject malformed archives
|
|
@@ -17133,19 +17133,19 @@ async function extractTarball(tarball, packageId) {
|
|
|
17133
17133
|
console.warn(` \u26A0\uFE0F Blocked symlink in package: ${entryPath}`);
|
|
17134
17134
|
return false;
|
|
17135
17135
|
}
|
|
17136
|
-
if (
|
|
17136
|
+
if (hasUnsafePathPatterns2(entryPath)) {
|
|
17137
17137
|
console.warn(` \u26A0\uFE0F Blocked unsafe path in package: ${entryPath}`);
|
|
17138
17138
|
return false;
|
|
17139
17139
|
}
|
|
17140
|
-
if (!
|
|
17140
|
+
if (!isPathSafe2(tmpDir, entryPath)) {
|
|
17141
17141
|
console.warn(` \u26A0\uFE0F Blocked path traversal attempt: ${entryPath}`);
|
|
17142
17142
|
return false;
|
|
17143
17143
|
}
|
|
17144
17144
|
return true;
|
|
17145
17145
|
}
|
|
17146
17146
|
});
|
|
17147
|
-
await (0,
|
|
17148
|
-
const extractedFiles = await collectExtractedFiles(tmpDir, excludedNames,
|
|
17147
|
+
await (0, import_promises3.pipeline)(import_stream2.Readable.from(decompressed), extract3);
|
|
17148
|
+
const extractedFiles = await collectExtractedFiles(tmpDir, excludedNames, import_promises4.default);
|
|
17149
17149
|
if (extractedFiles.length === 0) {
|
|
17150
17150
|
throw new CLIError("Package archive contains no valid files");
|
|
17151
17151
|
}
|
|
@@ -17163,15 +17163,15 @@ async function extractTarball(tarball, packageId) {
|
|
|
17163
17163
|
await cleanup();
|
|
17164
17164
|
}
|
|
17165
17165
|
}
|
|
17166
|
-
async function collectExtractedFiles(rootDir, excludedNames,
|
|
17166
|
+
async function collectExtractedFiles(rootDir, excludedNames, fs16) {
|
|
17167
17167
|
const files = [];
|
|
17168
17168
|
const dirs = [rootDir];
|
|
17169
17169
|
while (dirs.length > 0) {
|
|
17170
17170
|
const currentDir = dirs.pop();
|
|
17171
17171
|
if (!currentDir) continue;
|
|
17172
|
-
const entries = await
|
|
17172
|
+
const entries = await fs16.readdir(currentDir, { withFileTypes: true });
|
|
17173
17173
|
for (const entry of entries) {
|
|
17174
|
-
const fullPath =
|
|
17174
|
+
const fullPath = import_path15.default.join(currentDir, entry.name);
|
|
17175
17175
|
if (entry.isDirectory()) {
|
|
17176
17176
|
dirs.push(fullPath);
|
|
17177
17177
|
continue;
|
|
@@ -17182,8 +17182,8 @@ async function collectExtractedFiles(rootDir, excludedNames, fs15) {
|
|
|
17182
17182
|
if (excludedNames.has(entry.name)) {
|
|
17183
17183
|
continue;
|
|
17184
17184
|
}
|
|
17185
|
-
const content = await
|
|
17186
|
-
const relativePath =
|
|
17185
|
+
const content = await fs16.readFile(fullPath, "utf-8");
|
|
17186
|
+
const relativePath = import_path15.default.relative(rootDir, fullPath).split(import_path15.default.sep).join("/");
|
|
17187
17187
|
files.push({
|
|
17188
17188
|
name: relativePath,
|
|
17189
17189
|
content
|
|
@@ -17217,11 +17217,11 @@ async function installFromLockfile(options) {
|
|
|
17217
17217
|
console.log(` Installing ${displayName}...`);
|
|
17218
17218
|
let locationOverride = options.location;
|
|
17219
17219
|
if (!locationOverride && lockEntry.format === "agents.md" && lockEntry.installedPath) {
|
|
17220
|
-
const baseName =
|
|
17220
|
+
const baseName = import_path15.default.basename(lockEntry.installedPath);
|
|
17221
17221
|
if (baseName === "AGENTS.override.md") {
|
|
17222
|
-
locationOverride =
|
|
17222
|
+
locationOverride = import_path15.default.dirname(lockEntry.installedPath);
|
|
17223
17223
|
} else if (baseName !== "AGENTS.md") {
|
|
17224
|
-
locationOverride =
|
|
17224
|
+
locationOverride = import_path15.default.dirname(lockEntry.installedPath);
|
|
17225
17225
|
}
|
|
17226
17226
|
}
|
|
17227
17227
|
const manifestFile = (_a = lockEntry.progressiveDisclosure) == null ? void 0 : _a.manifestPath;
|
|
@@ -17266,7 +17266,7 @@ async function installFromLockfile(options) {
|
|
|
17266
17266
|
}
|
|
17267
17267
|
}
|
|
17268
17268
|
function createInstallCommand() {
|
|
17269
|
-
const command = new
|
|
17269
|
+
const command = new import_commander12.Command("install");
|
|
17270
17270
|
command.description("Install a package from the registry, or install all packages from prpm.lock if no package specified").argument("[package]", "Package to install (e.g., react-rules or react-rules@1.2.0). If omitted, installs all packages from prpm.lock").option("--version <version>", "Specific version to install").option("--as <format>", `Convert and install in specific format (${import_types.FORMATS.join(", ")})`).option("--format <format>", "Alias for --as").option("--location <path>", "Custom location for installed files (Agents.md or nested Cursor rules)").option("--subtype <subtype>", "Specify subtype when converting (skill, agent, rule, etc.)").option("--hook-mapping <strategy>", "Hook mapping strategy: auto (default), strict, skip", "auto").option("--frozen-lockfile", "Fail if lock file needs to be updated (for CI)").option("-y, --yes", "Auto-confirm prompts (overwrite files without asking)").option("--no-append", "Skip adding skill to manifest file (skill files only)").option("--manifest-file <filename>", "Custom manifest filename for progressive disclosure").option("--eager", "Force skill/agent to always activate (not on-demand)").option("--lazy", "Use default on-demand activation (overrides package eager setting)").action(async (packageSpec, options) => {
|
|
17271
17271
|
const convertTo = options.format || options.as;
|
|
17272
17272
|
const validFormats = import_types.FORMATS;
|
|
@@ -17315,27 +17315,27 @@ Valid strategies: ${VALID_HOOK_MAPPING_STRATEGIES.join(", ")}`
|
|
|
17315
17315
|
});
|
|
17316
17316
|
return command;
|
|
17317
17317
|
}
|
|
17318
|
-
var
|
|
17318
|
+
var import_commander12, import_registry_client6, import_stream2, import_promises3, tar2, import_path15, import_zlib2, import_promises4, import_os5, import_semver;
|
|
17319
17319
|
var init_install = __esm({
|
|
17320
17320
|
"src/commands/install.ts"() {
|
|
17321
17321
|
"use strict";
|
|
17322
17322
|
init_cjs_shims();
|
|
17323
|
-
|
|
17323
|
+
import_commander12 = require("commander");
|
|
17324
17324
|
init_source();
|
|
17325
|
-
|
|
17325
|
+
import_registry_client6 = require("@pr-pm/registry-client");
|
|
17326
17326
|
init_user_config();
|
|
17327
17327
|
init_filesystem();
|
|
17328
17328
|
init_telemetry();
|
|
17329
17329
|
init_types();
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17330
|
+
import_stream2 = require("stream");
|
|
17331
|
+
import_promises3 = require("stream/promises");
|
|
17332
|
+
tar2 = __toESM(require("tar"));
|
|
17333
17333
|
init_errors();
|
|
17334
17334
|
init_prompts();
|
|
17335
|
-
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
|
|
17335
|
+
import_path15 = __toESM(require("path"));
|
|
17336
|
+
import_zlib2 = __toESM(require("zlib"));
|
|
17337
|
+
import_promises4 = __toESM(require("fs/promises"));
|
|
17338
|
+
import_os5 = __toESM(require("os"));
|
|
17339
17339
|
import_semver = __toESM(require("semver"));
|
|
17340
17340
|
init_collections();
|
|
17341
17341
|
init_lockfile();
|
|
@@ -17441,7 +17441,7 @@ async function fileExists2(filePath) {
|
|
|
17441
17441
|
}
|
|
17442
17442
|
async function scanDirectory2(config, cwd) {
|
|
17443
17443
|
const packages = [];
|
|
17444
|
-
const fullDir =
|
|
17444
|
+
const fullDir = import_path21.default.join(cwd, config.directory);
|
|
17445
17445
|
if (!await directoryExists2(fullDir)) {
|
|
17446
17446
|
return packages;
|
|
17447
17447
|
}
|
|
@@ -17449,13 +17449,13 @@ async function scanDirectory2(config, cwd) {
|
|
|
17449
17449
|
if (config.nested) {
|
|
17450
17450
|
for (const entry of entries) {
|
|
17451
17451
|
if (!entry.isDirectory()) continue;
|
|
17452
|
-
const packageDir =
|
|
17452
|
+
const packageDir = import_path21.default.join(fullDir, entry.name);
|
|
17453
17453
|
if (config.nestedIndicator) {
|
|
17454
|
-
const indicatorPath =
|
|
17454
|
+
const indicatorPath = import_path21.default.join(packageDir, config.nestedIndicator);
|
|
17455
17455
|
if (!await fileExists2(indicatorPath)) continue;
|
|
17456
17456
|
const packageFiles = await collectPackageFiles(packageDir, config.directory, entry.name);
|
|
17457
17457
|
const metadata = await extractMetadata2(indicatorPath);
|
|
17458
|
-
const relativePath =
|
|
17458
|
+
const relativePath = import_path21.default.join(config.directory, entry.name, config.nestedIndicator);
|
|
17459
17459
|
packages.push({
|
|
17460
17460
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
17461
17461
|
format: config.format,
|
|
@@ -17470,8 +17470,8 @@ async function scanDirectory2(config, cwd) {
|
|
|
17470
17470
|
for (const subEntry of subEntries) {
|
|
17471
17471
|
if (!subEntry.isFile()) continue;
|
|
17472
17472
|
if (!matchesPattern(subEntry.name, config.patterns)) continue;
|
|
17473
|
-
const filePath =
|
|
17474
|
-
const relativePath =
|
|
17473
|
+
const filePath = import_path21.default.join(packageDir, subEntry.name);
|
|
17474
|
+
const relativePath = import_path21.default.join(config.directory, entry.name, subEntry.name);
|
|
17475
17475
|
const metadata = await extractMetadata2(filePath);
|
|
17476
17476
|
packages.push({
|
|
17477
17477
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -17489,8 +17489,8 @@ async function scanDirectory2(config, cwd) {
|
|
|
17489
17489
|
for (const entry of entries) {
|
|
17490
17490
|
if (!entry.isFile()) continue;
|
|
17491
17491
|
if (!matchesPattern(entry.name, config.patterns)) continue;
|
|
17492
|
-
const filePath =
|
|
17493
|
-
const relativePath =
|
|
17492
|
+
const filePath = import_path21.default.join(fullDir, entry.name);
|
|
17493
|
+
const relativePath = import_path21.default.join(config.directory, entry.name);
|
|
17494
17494
|
const metadata = await extractMetadata2(filePath);
|
|
17495
17495
|
packages.push({
|
|
17496
17496
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -17510,22 +17510,22 @@ async function collectPackageFiles(packageDir, baseDir, packageName) {
|
|
|
17510
17510
|
async function walkDir(dir, relativeBase) {
|
|
17511
17511
|
const entries = await import_fs16.promises.readdir(dir, { withFileTypes: true });
|
|
17512
17512
|
for (const entry of entries) {
|
|
17513
|
-
const fullPath =
|
|
17514
|
-
const relativePath =
|
|
17513
|
+
const fullPath = import_path21.default.join(dir, entry.name);
|
|
17514
|
+
const relativePath = import_path21.default.join(relativeBase, entry.name);
|
|
17515
17515
|
if (entry.isDirectory()) {
|
|
17516
17516
|
if (["node_modules", "dist", ".git", "coverage"].includes(entry.name)) {
|
|
17517
17517
|
continue;
|
|
17518
17518
|
}
|
|
17519
17519
|
await walkDir(fullPath, relativePath);
|
|
17520
17520
|
} else if (entry.isFile()) {
|
|
17521
|
-
const ext =
|
|
17521
|
+
const ext = import_path21.default.extname(entry.name).toLowerCase();
|
|
17522
17522
|
if ([".md", ".json", ".js", ".ts", ".toml"].includes(ext)) {
|
|
17523
17523
|
files.push(relativePath);
|
|
17524
17524
|
}
|
|
17525
17525
|
}
|
|
17526
17526
|
}
|
|
17527
17527
|
}
|
|
17528
|
-
await walkDir(packageDir,
|
|
17528
|
+
await walkDir(packageDir, import_path21.default.join(baseDir, packageName));
|
|
17529
17529
|
return files;
|
|
17530
17530
|
}
|
|
17531
17531
|
function buildRootManifestFiles() {
|
|
@@ -17547,7 +17547,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
17547
17547
|
allPackages.push(...packages);
|
|
17548
17548
|
}
|
|
17549
17549
|
for (const { file, format } of ROOT_MANIFEST_FILES) {
|
|
17550
|
-
const filePath =
|
|
17550
|
+
const filePath = import_path21.default.join(cwd, file);
|
|
17551
17551
|
if (await fileExists2(filePath)) {
|
|
17552
17552
|
const metadata = await extractMetadata2(filePath);
|
|
17553
17553
|
allPackages.push({
|
|
@@ -17561,7 +17561,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
17561
17561
|
});
|
|
17562
17562
|
}
|
|
17563
17563
|
}
|
|
17564
|
-
const copilotInstructionsPath =
|
|
17564
|
+
const copilotInstructionsPath = import_path21.default.join(cwd, ".github/copilot-instructions.md");
|
|
17565
17565
|
if (await fileExists2(copilotInstructionsPath)) {
|
|
17566
17566
|
const metadata = await extractMetadata2(copilotInstructionsPath);
|
|
17567
17567
|
allPackages.push({
|
|
@@ -17576,13 +17576,13 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
17576
17576
|
}
|
|
17577
17577
|
return allPackages;
|
|
17578
17578
|
}
|
|
17579
|
-
var import_fs16,
|
|
17579
|
+
var import_fs16, import_path21, SCAN_CONFIGS, ROOT_MANIFEST_FILES;
|
|
17580
17580
|
var init_package_scanner = __esm({
|
|
17581
17581
|
"src/core/package-scanner.ts"() {
|
|
17582
17582
|
"use strict";
|
|
17583
17583
|
init_cjs_shims();
|
|
17584
17584
|
import_fs16 = require("fs");
|
|
17585
|
-
|
|
17585
|
+
import_path21 = __toESM(require("path"));
|
|
17586
17586
|
init_dist();
|
|
17587
17587
|
SCAN_CONFIGS = buildScanConfigs();
|
|
17588
17588
|
ROOT_MANIFEST_FILES = buildRootManifestFiles();
|
|
@@ -17592,7 +17592,7 @@ var init_package_scanner = __esm({
|
|
|
17592
17592
|
// src/core/package-reconciler.ts
|
|
17593
17593
|
async function readManifest(cwd = process.cwd()) {
|
|
17594
17594
|
try {
|
|
17595
|
-
const manifestPath =
|
|
17595
|
+
const manifestPath = import_path22.default.join(cwd, "prpm.json");
|
|
17596
17596
|
const content = await import_fs17.promises.readFile(manifestPath, "utf-8");
|
|
17597
17597
|
const raw = JSON.parse(content);
|
|
17598
17598
|
if ("packages" in raw && Array.isArray(raw.packages)) {
|
|
@@ -17675,7 +17675,7 @@ async function reconcilePackages(detected, manifest, cwd = process.cwd()) {
|
|
|
17675
17675
|
const manifestPkg = manifest[mi];
|
|
17676
17676
|
let anyFileExists = false;
|
|
17677
17677
|
for (const file of manifestPkg.files) {
|
|
17678
|
-
const fullPath =
|
|
17678
|
+
const fullPath = import_path22.default.join(cwd, file);
|
|
17679
17679
|
if (await fileExists3(fullPath)) {
|
|
17680
17680
|
anyFileExists = true;
|
|
17681
17681
|
break;
|
|
@@ -17744,7 +17744,7 @@ function createManifestFromDetected(packages, defaults) {
|
|
|
17744
17744
|
files: pkg.files
|
|
17745
17745
|
};
|
|
17746
17746
|
}
|
|
17747
|
-
const projectName =
|
|
17747
|
+
const projectName = import_path22.default.basename(process.cwd()).toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
17748
17748
|
return {
|
|
17749
17749
|
name: `${projectName}-packages`,
|
|
17750
17750
|
version: "1.0.0",
|
|
@@ -17755,13 +17755,13 @@ function createManifestFromDetected(packages, defaults) {
|
|
|
17755
17755
|
packages: packages.map(detectedToManifest)
|
|
17756
17756
|
};
|
|
17757
17757
|
}
|
|
17758
|
-
var import_fs17,
|
|
17758
|
+
var import_fs17, import_path22;
|
|
17759
17759
|
var init_package_reconciler = __esm({
|
|
17760
17760
|
"src/core/package-reconciler.ts"() {
|
|
17761
17761
|
"use strict";
|
|
17762
17762
|
init_cjs_shims();
|
|
17763
17763
|
import_fs17 = require("fs");
|
|
17764
|
-
|
|
17764
|
+
import_path22 = __toESM(require("path"));
|
|
17765
17765
|
}
|
|
17766
17766
|
});
|
|
17767
17767
|
|
|
@@ -17812,7 +17812,7 @@ ${question}`);
|
|
|
17812
17812
|
}
|
|
17813
17813
|
async function extractMetadataFromFile(filePath) {
|
|
17814
17814
|
try {
|
|
17815
|
-
const content = await (0,
|
|
17815
|
+
const content = await (0, import_promises10.readFile)(filePath, "utf-8");
|
|
17816
17816
|
const metadata = {};
|
|
17817
17817
|
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
17818
17818
|
if (frontmatterMatch) {
|
|
@@ -17876,10 +17876,10 @@ function getDefaultAuthor() {
|
|
|
17876
17876
|
async function createExampleFiles(format, files, packageName) {
|
|
17877
17877
|
const templates = EXAMPLE_TEMPLATES[format] || {};
|
|
17878
17878
|
for (const file of files) {
|
|
17879
|
-
const filePath = (0,
|
|
17880
|
-
const dirPath = (0,
|
|
17879
|
+
const filePath = (0, import_path23.join)(process.cwd(), file);
|
|
17880
|
+
const dirPath = (0, import_path23.join)(filePath, "..");
|
|
17881
17881
|
if (!(0, import_fs18.existsSync)(dirPath)) {
|
|
17882
|
-
await (0,
|
|
17882
|
+
await (0, import_promises10.mkdir)(dirPath, { recursive: true });
|
|
17883
17883
|
}
|
|
17884
17884
|
if ((0, import_fs18.existsSync)(filePath)) {
|
|
17885
17885
|
console.log(` Skipping ${file} (already exists)`);
|
|
@@ -17890,12 +17890,12 @@ async function createExampleFiles(format, files, packageName) {
|
|
|
17890
17890
|
Add your content here.
|
|
17891
17891
|
`;
|
|
17892
17892
|
content = content.replace(/example-skill/g, packageName);
|
|
17893
|
-
await (0,
|
|
17893
|
+
await (0, import_promises10.writeFile)(filePath, content, "utf-8");
|
|
17894
17894
|
console.log(` Created ${file}`);
|
|
17895
17895
|
}
|
|
17896
17896
|
}
|
|
17897
17897
|
async function createReadme(config) {
|
|
17898
|
-
const readmePath = (0,
|
|
17898
|
+
const readmePath = (0, import_path23.join)(process.cwd(), "README.md");
|
|
17899
17899
|
if ((0, import_fs18.existsSync)(readmePath)) {
|
|
17900
17900
|
console.log(" Skipping README.md (already exists)");
|
|
17901
17901
|
return;
|
|
@@ -17926,7 +17926,7 @@ ${config.author}
|
|
|
17926
17926
|
|
|
17927
17927
|
${config.license}
|
|
17928
17928
|
`;
|
|
17929
|
-
await (0,
|
|
17929
|
+
await (0, import_promises10.writeFile)(readmePath, content, "utf-8");
|
|
17930
17930
|
console.log(" Created README.md");
|
|
17931
17931
|
}
|
|
17932
17932
|
function displayPackagesTable(packages) {
|
|
@@ -18005,7 +18005,7 @@ async function reviewMissingPackage(rl, pkg, index, total) {
|
|
|
18005
18005
|
return await confirm(rl, "\n Remove from prpm.json?", true);
|
|
18006
18006
|
}
|
|
18007
18007
|
async function smartInit(options) {
|
|
18008
|
-
const manifestPath = (0,
|
|
18008
|
+
const manifestPath = (0, import_path23.join)(process.cwd(), "prpm.json");
|
|
18009
18009
|
const hasManifest = (0, import_fs18.existsSync)(manifestPath);
|
|
18010
18010
|
console.log("\nScanning for packages...\n");
|
|
18011
18011
|
const detected = await scanForPackages();
|
|
@@ -18079,7 +18079,7 @@ ${summaryParts.join(" and ")} package${changes === 1 ? "" : "s"}?`,
|
|
|
18079
18079
|
packagesToRemove,
|
|
18080
18080
|
existingManifest.isMultiPackage
|
|
18081
18081
|
);
|
|
18082
|
-
await (0,
|
|
18082
|
+
await (0, import_promises10.writeFile)(
|
|
18083
18083
|
manifestPath,
|
|
18084
18084
|
JSON.stringify(updatedManifest, null, 2) + "\n",
|
|
18085
18085
|
"utf-8"
|
|
@@ -18138,7 +18138,7 @@ Create multi-package prpm.json with these ${detected.length} packages?` : "\nCre
|
|
|
18138
18138
|
author: defaultAuthor || void 0,
|
|
18139
18139
|
license: "MIT"
|
|
18140
18140
|
});
|
|
18141
|
-
await (0,
|
|
18141
|
+
await (0, import_promises10.writeFile)(
|
|
18142
18142
|
manifestPath,
|
|
18143
18143
|
JSON.stringify(manifest, null, 2) + "\n",
|
|
18144
18144
|
"utf-8"
|
|
@@ -18156,7 +18156,7 @@ Create multi-package prpm.json with these ${detected.length} packages?` : "\nCre
|
|
|
18156
18156
|
}
|
|
18157
18157
|
}
|
|
18158
18158
|
async function classicInit(options) {
|
|
18159
|
-
const manifestPath = (0,
|
|
18159
|
+
const manifestPath = (0, import_path23.join)(process.cwd(), "prpm.json");
|
|
18160
18160
|
if ((0, import_fs18.existsSync)(manifestPath) && !options.force) {
|
|
18161
18161
|
throw new Error(
|
|
18162
18162
|
"prpm.json already exists. Use --force to overwrite, or run this command in a different directory."
|
|
@@ -18328,7 +18328,7 @@ Current files (${config.files.length}):`);
|
|
|
18328
18328
|
manifest.tags = config.tags;
|
|
18329
18329
|
}
|
|
18330
18330
|
manifest.files = config.files;
|
|
18331
|
-
await (0,
|
|
18331
|
+
await (0, import_promises10.writeFile)(
|
|
18332
18332
|
manifestPath,
|
|
18333
18333
|
JSON.stringify(manifest, null, 2) + "\n",
|
|
18334
18334
|
"utf-8"
|
|
@@ -18415,11 +18415,11 @@ async function scanMode(directories, options) {
|
|
|
18415
18415
|
console.log("\u{1F50D} Dry run - no changes made\n");
|
|
18416
18416
|
return;
|
|
18417
18417
|
}
|
|
18418
|
-
const prpmJsonPath = options.output || (0,
|
|
18418
|
+
const prpmJsonPath = options.output || (0, import_path23.join)(process.cwd(), "prpm.json");
|
|
18419
18419
|
let manifest;
|
|
18420
18420
|
if (options.append) {
|
|
18421
18421
|
try {
|
|
18422
|
-
const existingContent = await (0,
|
|
18422
|
+
const existingContent = await (0, import_promises10.readFile)(prpmJsonPath, "utf-8");
|
|
18423
18423
|
const existing = JSON.parse(existingContent);
|
|
18424
18424
|
if ("packages" in existing && Array.isArray(existing.packages)) {
|
|
18425
18425
|
manifest = existing;
|
|
@@ -18465,7 +18465,7 @@ async function scanMode(directories, options) {
|
|
|
18465
18465
|
manifest.packages.push(packageManifest);
|
|
18466
18466
|
addedCount++;
|
|
18467
18467
|
}
|
|
18468
|
-
await (0,
|
|
18468
|
+
await (0, import_promises10.writeFile)(
|
|
18469
18469
|
prpmJsonPath,
|
|
18470
18470
|
JSON.stringify(manifest, null, 2) + "\n",
|
|
18471
18471
|
"utf-8"
|
|
@@ -18491,7 +18491,7 @@ async function initPackage(options, scanDirectories) {
|
|
|
18491
18491
|
return smartInit(options);
|
|
18492
18492
|
}
|
|
18493
18493
|
function createInitCommand() {
|
|
18494
|
-
const command = new
|
|
18494
|
+
const command = new import_commander13.Command("init");
|
|
18495
18495
|
command.description("Initialize a new PRPM package with interactive prompts").argument("[directories...]", "Directories to scan (only used with --scan)").option("-y, --yes", "Skip prompts and use defaults").option("--private", "Create a private package").option("-f, --force", "Overwrite existing prpm.json").option(
|
|
18496
18496
|
"-s, --scan",
|
|
18497
18497
|
"Scan mode: discover packages in directories without prompts"
|
|
@@ -18517,14 +18517,14 @@ function createInitCommand() {
|
|
|
18517
18517
|
});
|
|
18518
18518
|
return command;
|
|
18519
18519
|
}
|
|
18520
|
-
var
|
|
18520
|
+
var import_commander13, import_promises10, import_path23, import_fs18, readline4, import_process, FORMAT_EXAMPLES, EXAMPLE_TEMPLATES;
|
|
18521
18521
|
var init_init = __esm({
|
|
18522
18522
|
"src/commands/init.ts"() {
|
|
18523
18523
|
"use strict";
|
|
18524
18524
|
init_cjs_shims();
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
18525
|
+
import_commander13 = require("commander");
|
|
18526
|
+
import_promises10 = require("fs/promises");
|
|
18527
|
+
import_path23 = require("path");
|
|
18528
18528
|
import_fs18 = require("fs");
|
|
18529
18529
|
readline4 = __toESM(require("readline/promises"));
|
|
18530
18530
|
import_process = require("process");
|
|
@@ -18907,9 +18907,9 @@ Include examples if helpful.
|
|
|
18907
18907
|
|
|
18908
18908
|
// src/index.ts
|
|
18909
18909
|
init_cjs_shims();
|
|
18910
|
-
var
|
|
18910
|
+
var import_commander32 = require("commander");
|
|
18911
18911
|
var import_fs22 = require("fs");
|
|
18912
|
-
var
|
|
18912
|
+
var import_path27 = require("path");
|
|
18913
18913
|
|
|
18914
18914
|
// src/commands/list.ts
|
|
18915
18915
|
init_cjs_shims();
|
|
@@ -20364,24 +20364,325 @@ function createInfoCommand() {
|
|
|
20364
20364
|
return command;
|
|
20365
20365
|
}
|
|
20366
20366
|
|
|
20367
|
+
// src/commands/show.ts
|
|
20368
|
+
init_cjs_shims();
|
|
20369
|
+
var import_commander10 = require("commander");
|
|
20370
|
+
var import_registry_client4 = require("@pr-pm/registry-client");
|
|
20371
|
+
init_user_config();
|
|
20372
|
+
init_telemetry();
|
|
20373
|
+
init_errors();
|
|
20374
|
+
var import_stream = require("stream");
|
|
20375
|
+
var import_promises = require("stream/promises");
|
|
20376
|
+
var tar = __toESM(require("tar"));
|
|
20377
|
+
var import_zlib = __toESM(require("zlib"));
|
|
20378
|
+
var import_path14 = __toESM(require("path"));
|
|
20379
|
+
var import_os4 = __toESM(require("os"));
|
|
20380
|
+
var import_promises2 = __toESM(require("fs/promises"));
|
|
20381
|
+
function isPathSafe(targetDir, filePath) {
|
|
20382
|
+
const resolvedPath = import_path14.default.resolve(targetDir, filePath);
|
|
20383
|
+
const resolvedTarget = import_path14.default.resolve(targetDir);
|
|
20384
|
+
return resolvedPath.startsWith(resolvedTarget + import_path14.default.sep) || resolvedPath === resolvedTarget;
|
|
20385
|
+
}
|
|
20386
|
+
function hasUnsafePathPatterns(filePath) {
|
|
20387
|
+
if (filePath.includes("..")) return true;
|
|
20388
|
+
if (filePath.startsWith("/")) return true;
|
|
20389
|
+
if (/^[a-zA-Z]:/.test(filePath)) return true;
|
|
20390
|
+
if (filePath.includes("\0")) return true;
|
|
20391
|
+
return false;
|
|
20392
|
+
}
|
|
20393
|
+
function isBinaryContent(buffer) {
|
|
20394
|
+
if (buffer.includes(0)) return true;
|
|
20395
|
+
const sampleSize = Math.min(buffer.length, 512);
|
|
20396
|
+
let nonPrintable = 0;
|
|
20397
|
+
for (let i = 0; i < sampleSize; i++) {
|
|
20398
|
+
const byte = buffer[i];
|
|
20399
|
+
if (byte !== 9 && byte !== 10 && byte !== 13 && (byte < 32 || byte > 126)) {
|
|
20400
|
+
nonPrintable++;
|
|
20401
|
+
}
|
|
20402
|
+
}
|
|
20403
|
+
return nonPrintable / sampleSize > 0.3;
|
|
20404
|
+
}
|
|
20405
|
+
async function extractTarballContents(tarball) {
|
|
20406
|
+
let decompressed;
|
|
20407
|
+
try {
|
|
20408
|
+
decompressed = await new Promise((resolve3, reject) => {
|
|
20409
|
+
import_zlib.default.gunzip(tarball, (err, result) => {
|
|
20410
|
+
if (err) {
|
|
20411
|
+
reject(new Error(`Failed to decompress tarball: ${err.message}`));
|
|
20412
|
+
return;
|
|
20413
|
+
}
|
|
20414
|
+
resolve3(result);
|
|
20415
|
+
});
|
|
20416
|
+
});
|
|
20417
|
+
} catch (error) {
|
|
20418
|
+
throw new CLIError(`Package decompression failed: ${error.message}`);
|
|
20419
|
+
}
|
|
20420
|
+
const tmpDir = await import_promises2.default.mkdtemp(import_path14.default.join(import_os4.default.tmpdir(), "prpm-show-"));
|
|
20421
|
+
const cleanup = async () => {
|
|
20422
|
+
try {
|
|
20423
|
+
await import_promises2.default.rm(tmpDir, { recursive: true, force: true });
|
|
20424
|
+
} catch {
|
|
20425
|
+
}
|
|
20426
|
+
};
|
|
20427
|
+
try {
|
|
20428
|
+
const extract3 = tar.extract({
|
|
20429
|
+
cwd: tmpDir,
|
|
20430
|
+
strict: true,
|
|
20431
|
+
// Security: filter out dangerous entries before extraction
|
|
20432
|
+
filter: (entryPath, entry) => {
|
|
20433
|
+
const entryType = "type" in entry ? entry.type : null;
|
|
20434
|
+
if (entryType === "SymbolicLink" || entryType === "Link") {
|
|
20435
|
+
console.warn(` \u26A0\uFE0F Blocked symlink in package: ${entryPath}`);
|
|
20436
|
+
return false;
|
|
20437
|
+
}
|
|
20438
|
+
if ("isSymbolicLink" in entry && entry.isSymbolicLink()) {
|
|
20439
|
+
console.warn(` \u26A0\uFE0F Blocked symlink in package: ${entryPath}`);
|
|
20440
|
+
return false;
|
|
20441
|
+
}
|
|
20442
|
+
if (hasUnsafePathPatterns(entryPath)) {
|
|
20443
|
+
console.warn(` \u26A0\uFE0F Blocked unsafe path in package: ${entryPath}`);
|
|
20444
|
+
return false;
|
|
20445
|
+
}
|
|
20446
|
+
if (!isPathSafe(tmpDir, entryPath)) {
|
|
20447
|
+
console.warn(` \u26A0\uFE0F Blocked path traversal attempt: ${entryPath}`);
|
|
20448
|
+
return false;
|
|
20449
|
+
}
|
|
20450
|
+
return true;
|
|
20451
|
+
}
|
|
20452
|
+
});
|
|
20453
|
+
await (0, import_promises.pipeline)(import_stream.Readable.from(decompressed), extract3);
|
|
20454
|
+
const files = [];
|
|
20455
|
+
const dirs = [tmpDir];
|
|
20456
|
+
while (dirs.length > 0) {
|
|
20457
|
+
const currentDir = dirs.pop();
|
|
20458
|
+
if (!currentDir) continue;
|
|
20459
|
+
const entries = await import_promises2.default.readdir(currentDir, { withFileTypes: true });
|
|
20460
|
+
for (const entry of entries) {
|
|
20461
|
+
const fullPath = import_path14.default.join(currentDir, entry.name);
|
|
20462
|
+
if (entry.isDirectory()) {
|
|
20463
|
+
dirs.push(fullPath);
|
|
20464
|
+
continue;
|
|
20465
|
+
}
|
|
20466
|
+
if (!entry.isFile()) {
|
|
20467
|
+
continue;
|
|
20468
|
+
}
|
|
20469
|
+
const buffer = await import_promises2.default.readFile(fullPath);
|
|
20470
|
+
const stats = await import_promises2.default.stat(fullPath);
|
|
20471
|
+
const relativePath = import_path14.default.relative(tmpDir, fullPath).split(import_path14.default.sep).join("/");
|
|
20472
|
+
const binary2 = isBinaryContent(buffer);
|
|
20473
|
+
files.push({
|
|
20474
|
+
name: relativePath,
|
|
20475
|
+
content: binary2 ? `[Binary file - ${stats.size} bytes]` : buffer.toString("utf-8"),
|
|
20476
|
+
size: stats.size,
|
|
20477
|
+
isBinary: binary2
|
|
20478
|
+
});
|
|
20479
|
+
}
|
|
20480
|
+
}
|
|
20481
|
+
return files;
|
|
20482
|
+
} finally {
|
|
20483
|
+
await cleanup();
|
|
20484
|
+
}
|
|
20485
|
+
}
|
|
20486
|
+
function formatSize(bytes) {
|
|
20487
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
20488
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
20489
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
20490
|
+
}
|
|
20491
|
+
function getFileIcon(filename, isBinary2 = false) {
|
|
20492
|
+
if (isBinary2) return "\u{1F512}";
|
|
20493
|
+
const ext = import_path14.default.extname(filename).toLowerCase();
|
|
20494
|
+
const iconMap = {
|
|
20495
|
+
".md": "\u{1F4C4}",
|
|
20496
|
+
".mdc": "\u{1F4CB}",
|
|
20497
|
+
".json": "\u{1F4E6}",
|
|
20498
|
+
".toml": "\u2699\uFE0F",
|
|
20499
|
+
".yaml": "\u2699\uFE0F",
|
|
20500
|
+
".yml": "\u2699\uFE0F",
|
|
20501
|
+
".ts": "\u{1F4DC}",
|
|
20502
|
+
".js": "\u{1F4DC}",
|
|
20503
|
+
".sh": "\u{1F527}",
|
|
20504
|
+
".txt": "\u{1F4DD}"
|
|
20505
|
+
};
|
|
20506
|
+
return iconMap[ext] || "\u{1F4C4}";
|
|
20507
|
+
}
|
|
20508
|
+
async function handleShow(packageSpec, options) {
|
|
20509
|
+
const startTime = Date.now();
|
|
20510
|
+
let success = false;
|
|
20511
|
+
let error;
|
|
20512
|
+
try {
|
|
20513
|
+
let packageId;
|
|
20514
|
+
let specVersion;
|
|
20515
|
+
if (packageSpec.startsWith("@")) {
|
|
20516
|
+
const match = packageSpec.match(/^(@[^/]+\/[^@]+)(?:@(.+))?$/);
|
|
20517
|
+
if (!match) {
|
|
20518
|
+
throw new Error("Invalid package spec format. Use: @scope/package or @scope/package@version");
|
|
20519
|
+
}
|
|
20520
|
+
packageId = match[1];
|
|
20521
|
+
specVersion = match[2];
|
|
20522
|
+
} else {
|
|
20523
|
+
const parts = packageSpec.split("@");
|
|
20524
|
+
packageId = parts[0];
|
|
20525
|
+
specVersion = parts[1];
|
|
20526
|
+
}
|
|
20527
|
+
console.log(`\u{1F4E6} Fetching package contents for "${packageId}"...`);
|
|
20528
|
+
const config = await getConfig();
|
|
20529
|
+
const client = (0, import_registry_client4.getRegistryClient)(config);
|
|
20530
|
+
const pkg = await client.getPackage(packageId);
|
|
20531
|
+
let tarballUrl;
|
|
20532
|
+
let actualVersion;
|
|
20533
|
+
if (specVersion && specVersion !== "latest") {
|
|
20534
|
+
const versionInfo = await client.getPackageVersion(packageId, specVersion);
|
|
20535
|
+
tarballUrl = versionInfo.tarball_url;
|
|
20536
|
+
actualVersion = specVersion;
|
|
20537
|
+
} else {
|
|
20538
|
+
if (!pkg.latest_version) {
|
|
20539
|
+
throw new Error("No versions available for this package");
|
|
20540
|
+
}
|
|
20541
|
+
tarballUrl = pkg.latest_version.tarball_url;
|
|
20542
|
+
actualVersion = pkg.latest_version.version;
|
|
20543
|
+
}
|
|
20544
|
+
console.log(` Version: ${actualVersion}`);
|
|
20545
|
+
console.log(` \u2B07\uFE0F Downloading package...`);
|
|
20546
|
+
const tarball = await client.downloadPackage(tarballUrl);
|
|
20547
|
+
console.log(` \u{1F4C2} Extracting contents...
|
|
20548
|
+
`);
|
|
20549
|
+
const files = await extractTarballContents(tarball);
|
|
20550
|
+
if (files.length === 0) {
|
|
20551
|
+
console.log("\u26A0\uFE0F Package contains no files");
|
|
20552
|
+
success = true;
|
|
20553
|
+
return;
|
|
20554
|
+
}
|
|
20555
|
+
if (options.json) {
|
|
20556
|
+
const output2 = {
|
|
20557
|
+
package: packageId,
|
|
20558
|
+
version: actualVersion,
|
|
20559
|
+
format: pkg.format,
|
|
20560
|
+
subtype: pkg.subtype,
|
|
20561
|
+
description: pkg.description,
|
|
20562
|
+
files: files.map((f) => ({
|
|
20563
|
+
path: f.name,
|
|
20564
|
+
size: f.size,
|
|
20565
|
+
isBinary: f.isBinary,
|
|
20566
|
+
content: options.full ? f.content : void 0
|
|
20567
|
+
}))
|
|
20568
|
+
};
|
|
20569
|
+
console.log(JSON.stringify(output2, null, 2));
|
|
20570
|
+
success = true;
|
|
20571
|
+
return;
|
|
20572
|
+
}
|
|
20573
|
+
console.log("=".repeat(60));
|
|
20574
|
+
console.log(` ${pkg.name} v${actualVersion}`);
|
|
20575
|
+
console.log("=".repeat(60));
|
|
20576
|
+
if (pkg.description) {
|
|
20577
|
+
console.log(`
|
|
20578
|
+
\u{1F4DD} ${pkg.description}`);
|
|
20579
|
+
}
|
|
20580
|
+
console.log(`
|
|
20581
|
+
\u{1F4C2} Type: ${pkg.format} ${pkg.subtype}`);
|
|
20582
|
+
console.log(`\u{1F4E6} Files: ${files.length}`);
|
|
20583
|
+
console.log(`\u{1F4CA} Total size: ${formatSize(files.reduce((sum, f) => sum + f.size, 0))}`);
|
|
20584
|
+
if (options.file) {
|
|
20585
|
+
const targetFile = files.find(
|
|
20586
|
+
(f) => f.name === options.file || f.name.endsWith("/" + options.file) || import_path14.default.basename(f.name) === options.file
|
|
20587
|
+
);
|
|
20588
|
+
if (!targetFile) {
|
|
20589
|
+
console.log(`
|
|
20590
|
+
\u274C File not found: ${options.file}`);
|
|
20591
|
+
console.log("\n\u{1F4CB} Available files:");
|
|
20592
|
+
for (const file of files) {
|
|
20593
|
+
console.log(` ${getFileIcon(file.name, file.isBinary)} ${file.name}`);
|
|
20594
|
+
}
|
|
20595
|
+
throw new CLIError(`File "${options.file}" not found in package`, 1);
|
|
20596
|
+
}
|
|
20597
|
+
console.log("\n" + "\u2500".repeat(60));
|
|
20598
|
+
console.log(`\u{1F4C4} ${targetFile.name} (${formatSize(targetFile.size)})`);
|
|
20599
|
+
console.log("\u2500".repeat(60));
|
|
20600
|
+
console.log(targetFile.content);
|
|
20601
|
+
success = true;
|
|
20602
|
+
return;
|
|
20603
|
+
}
|
|
20604
|
+
console.log("\n" + "\u2500".repeat(60));
|
|
20605
|
+
console.log(" \u{1F4CB} Package Contents");
|
|
20606
|
+
console.log("\u2500".repeat(60));
|
|
20607
|
+
for (const file of files) {
|
|
20608
|
+
const binaryLabel = file.isBinary ? " [binary]" : "";
|
|
20609
|
+
console.log(` ${getFileIcon(file.name, file.isBinary)} ${file.name} (${formatSize(file.size)})${binaryLabel}`);
|
|
20610
|
+
}
|
|
20611
|
+
if (options.full) {
|
|
20612
|
+
console.log("\n" + "\u2550".repeat(60));
|
|
20613
|
+
console.log(" \u{1F4D6} Full File Contents");
|
|
20614
|
+
console.log("\u2550".repeat(60));
|
|
20615
|
+
for (const file of files) {
|
|
20616
|
+
console.log("\n" + "\u2500".repeat(60));
|
|
20617
|
+
console.log(`\u{1F4C4} ${file.name}`);
|
|
20618
|
+
console.log("\u2500".repeat(60));
|
|
20619
|
+
console.log(file.content);
|
|
20620
|
+
}
|
|
20621
|
+
} else {
|
|
20622
|
+
console.log("\n\u{1F4A1} Tip: Use --full to see complete file contents");
|
|
20623
|
+
console.log(` prpm show ${packageSpec} --full`);
|
|
20624
|
+
console.log(` prpm show ${packageSpec} --file <filename> # View specific file`);
|
|
20625
|
+
}
|
|
20626
|
+
console.log("\n" + "=".repeat(60));
|
|
20627
|
+
console.log(`
|
|
20628
|
+
\u{1F4BB} To install: prpm install ${packageId}`);
|
|
20629
|
+
success = true;
|
|
20630
|
+
} catch (err) {
|
|
20631
|
+
error = err instanceof Error ? err.message : String(err);
|
|
20632
|
+
if (err instanceof CLIError) {
|
|
20633
|
+
throw err;
|
|
20634
|
+
}
|
|
20635
|
+
throw new CLIError(
|
|
20636
|
+
`
|
|
20637
|
+
\u274C Failed to show package contents: ${error}
|
|
20638
|
+
|
|
20639
|
+
\u{1F4A1} Tips:
|
|
20640
|
+
- Check the package ID spelling
|
|
20641
|
+
- Search for packages: prpm search <query>
|
|
20642
|
+
- Get package info: prpm info <package>`,
|
|
20643
|
+
1
|
|
20644
|
+
);
|
|
20645
|
+
} finally {
|
|
20646
|
+
await telemetry.track({
|
|
20647
|
+
command: "show",
|
|
20648
|
+
success,
|
|
20649
|
+
error,
|
|
20650
|
+
duration: Date.now() - startTime,
|
|
20651
|
+
data: {
|
|
20652
|
+
packageName: packageSpec,
|
|
20653
|
+
full: options.full,
|
|
20654
|
+
json: options.json
|
|
20655
|
+
}
|
|
20656
|
+
});
|
|
20657
|
+
await telemetry.shutdown();
|
|
20658
|
+
}
|
|
20659
|
+
}
|
|
20660
|
+
function createShowCommand() {
|
|
20661
|
+
const command = new import_commander10.Command("show");
|
|
20662
|
+
command.description("Display package contents before installing").argument("<package>", "Package ID to show (e.g., @user/package or @user/package@1.0.0)").option("--full", "Show complete file contents").option("--file <name>", "Show contents of a specific file").option("--json", "Output in JSON format (for programmatic use)").action(async (packageSpec, options) => {
|
|
20663
|
+
await handleShow(packageSpec, options);
|
|
20664
|
+
});
|
|
20665
|
+
return command;
|
|
20666
|
+
}
|
|
20667
|
+
|
|
20367
20668
|
// src/index.ts
|
|
20368
20669
|
init_install();
|
|
20369
20670
|
|
|
20370
20671
|
// src/commands/publish.ts
|
|
20371
20672
|
init_cjs_shims();
|
|
20372
|
-
var
|
|
20373
|
-
var
|
|
20374
|
-
var
|
|
20673
|
+
var import_commander14 = require("commander");
|
|
20674
|
+
var import_promises11 = require("fs/promises");
|
|
20675
|
+
var import_path24 = require("path");
|
|
20375
20676
|
var import_fs19 = require("fs");
|
|
20376
|
-
var
|
|
20677
|
+
var import_registry_client7 = require("@pr-pm/registry-client");
|
|
20377
20678
|
init_user_config();
|
|
20378
20679
|
init_telemetry();
|
|
20379
20680
|
init_errors();
|
|
20380
20681
|
|
|
20381
20682
|
// src/utils/license-extractor.ts
|
|
20382
20683
|
init_cjs_shims();
|
|
20383
|
-
var
|
|
20384
|
-
var
|
|
20684
|
+
var import_promises5 = require("fs/promises");
|
|
20685
|
+
var import_path16 = require("path");
|
|
20385
20686
|
var import_fs14 = require("fs");
|
|
20386
20687
|
var LICENSE_FILE_PATTERNS = [
|
|
20387
20688
|
"LICENSE",
|
|
@@ -20431,10 +20732,10 @@ function generateLicenseUrl(repositoryUrl, fileName) {
|
|
|
20431
20732
|
async function extractLicenseInfo(repositoryUrl) {
|
|
20432
20733
|
const cwd = process.cwd();
|
|
20433
20734
|
for (const fileName of LICENSE_FILE_PATTERNS) {
|
|
20434
|
-
const filePath = (0,
|
|
20735
|
+
const filePath = (0, import_path16.join)(cwd, fileName);
|
|
20435
20736
|
try {
|
|
20436
|
-
await (0,
|
|
20437
|
-
const text = await (0,
|
|
20737
|
+
await (0, import_promises5.access)(filePath, import_fs14.constants.R_OK);
|
|
20738
|
+
const text = await (0, import_promises5.readFile)(filePath, "utf-8");
|
|
20438
20739
|
const type2 = detectLicenseType(text);
|
|
20439
20740
|
const url = generateLicenseUrl(repositoryUrl, fileName);
|
|
20440
20741
|
return {
|
|
@@ -20466,8 +20767,8 @@ function validateLicenseInfo(licenseInfo, packageName) {
|
|
|
20466
20767
|
|
|
20467
20768
|
// src/utils/snippet-extractor.ts
|
|
20468
20769
|
init_cjs_shims();
|
|
20469
|
-
var
|
|
20470
|
-
var
|
|
20770
|
+
var import_promises6 = require("fs/promises");
|
|
20771
|
+
var import_path17 = require("path");
|
|
20471
20772
|
var MAX_SNIPPET_LENGTH = 2e3;
|
|
20472
20773
|
async function extractSnippet(manifest) {
|
|
20473
20774
|
const cwd = process.cwd();
|
|
@@ -20483,13 +20784,13 @@ async function extractSnippet(manifest) {
|
|
|
20483
20784
|
const firstFile = manifest.files[0];
|
|
20484
20785
|
fileName = typeof firstFile === "string" ? firstFile : firstFile.path;
|
|
20485
20786
|
}
|
|
20486
|
-
const fullPath = (0,
|
|
20487
|
-
const stats = await (0,
|
|
20787
|
+
const fullPath = (0, import_path17.join)(cwd, fileName);
|
|
20788
|
+
const stats = await (0, import_promises6.stat)(fullPath);
|
|
20488
20789
|
if (stats.isDirectory()) {
|
|
20489
20790
|
console.warn(`\u26A0\uFE0F Skipping snippet extraction: "${fullPath}" is a directory`);
|
|
20490
20791
|
return null;
|
|
20491
20792
|
}
|
|
20492
|
-
const content = await (0,
|
|
20793
|
+
const content = await (0, import_promises6.readFile)(fullPath, "utf-8");
|
|
20493
20794
|
if (content.length <= MAX_SNIPPET_LENGTH) {
|
|
20494
20795
|
return content.trim();
|
|
20495
20796
|
}
|
|
@@ -20572,7 +20873,7 @@ async function executePrepublishOnly(scripts, options = {}) {
|
|
|
20572
20873
|
|
|
20573
20874
|
// src/utils/format-file-validator.ts
|
|
20574
20875
|
init_cjs_shims();
|
|
20575
|
-
var
|
|
20876
|
+
var import_promises7 = require("fs/promises");
|
|
20576
20877
|
init_dist();
|
|
20577
20878
|
function normalizeFilePaths(files) {
|
|
20578
20879
|
return files.map((file) => {
|
|
@@ -20598,7 +20899,7 @@ function getFormatType(format) {
|
|
|
20598
20899
|
}
|
|
20599
20900
|
async function validateMarkdownFile(filePath, formatType, subtype) {
|
|
20600
20901
|
try {
|
|
20601
|
-
const content = await (0,
|
|
20902
|
+
const content = await (0, import_promises7.readFile)(filePath, "utf-8");
|
|
20602
20903
|
const result = validateMarkdown(formatType, content, subtype);
|
|
20603
20904
|
return {
|
|
20604
20905
|
valid: result.valid,
|
|
@@ -20617,7 +20918,7 @@ Stack: ${error.stack}` : String(error);
|
|
|
20617
20918
|
}
|
|
20618
20919
|
async function validateStructuredFile(filePath, formatType, subtype) {
|
|
20619
20920
|
try {
|
|
20620
|
-
const content = await (0,
|
|
20921
|
+
const content = await (0, import_promises7.readFile)(filePath, "utf-8");
|
|
20621
20922
|
let data;
|
|
20622
20923
|
try {
|
|
20623
20924
|
data = JSON.parse(content);
|
|
@@ -20724,13 +21025,13 @@ async function validatePackageFiles(manifest) {
|
|
|
20724
21025
|
}
|
|
20725
21026
|
}
|
|
20726
21027
|
if (manifest.format === "claude" && manifest.subtype === "skill") {
|
|
20727
|
-
const hasSkillMd = filePaths.some((
|
|
20728
|
-
const mdFiles = filePaths.filter((
|
|
21028
|
+
const hasSkillMd = filePaths.some((path12) => path12.endsWith("/SKILL.md") || path12 === "SKILL.md");
|
|
21029
|
+
const mdFiles = filePaths.filter((path12) => {
|
|
20729
21030
|
var _a;
|
|
20730
|
-
if (!
|
|
20731
|
-
const filename = ((_a =
|
|
21031
|
+
if (!path12.endsWith(".md")) return false;
|
|
21032
|
+
const filename = ((_a = path12.split(/[\\/]/).pop()) == null ? void 0 : _a.toLowerCase()) || "";
|
|
20732
21033
|
if (filename === "readme.md") return false;
|
|
20733
|
-
if (
|
|
21034
|
+
if (path12.includes("examples/") || path12.includes("example/") || path12.includes("tests/") || path12.includes("__tests__/") || path12.includes("docs/") || path12.includes("doc/")) return false;
|
|
20734
21035
|
return true;
|
|
20735
21036
|
});
|
|
20736
21037
|
if (!hasSkillMd && mdFiles.length === 0) {
|
|
@@ -20742,7 +21043,7 @@ async function validatePackageFiles(manifest) {
|
|
|
20742
21043
|
}
|
|
20743
21044
|
}
|
|
20744
21045
|
if (manifest.format === "windsurf") {
|
|
20745
|
-
const hasWindsurfRules = filePaths.some((
|
|
21046
|
+
const hasWindsurfRules = filePaths.some((path12) => path12.includes(".windsurf/rules"));
|
|
20746
21047
|
if (!hasWindsurfRules) {
|
|
20747
21048
|
warnings.push("Windsurf packages typically use .windsurf/rules filename");
|
|
20748
21049
|
}
|
|
@@ -20752,8 +21053,8 @@ async function validatePackageFiles(manifest) {
|
|
|
20752
21053
|
|
|
20753
21054
|
// src/utils/manifest-loader.ts
|
|
20754
21055
|
init_cjs_shims();
|
|
20755
|
-
var
|
|
20756
|
-
var
|
|
21056
|
+
var import_promises8 = require("fs/promises");
|
|
21057
|
+
var import_path19 = require("path");
|
|
20757
21058
|
|
|
20758
21059
|
// src/core/marketplace-converter.ts
|
|
20759
21060
|
init_cjs_shims();
|
|
@@ -20920,13 +21221,13 @@ init_cjs_shims();
|
|
|
20920
21221
|
var import_ajv2 = __toESM(require("ajv"));
|
|
20921
21222
|
var import_ajv_formats2 = __toESM(require("ajv-formats"));
|
|
20922
21223
|
var import_fs15 = require("fs");
|
|
20923
|
-
var
|
|
21224
|
+
var import_path18 = require("path");
|
|
20924
21225
|
var schema2;
|
|
20925
21226
|
var schemaCandidates = [
|
|
20926
21227
|
// Source file layout (src/core → ../../schemas)
|
|
20927
|
-
(0,
|
|
21228
|
+
(0, import_path18.join)(__dirname, "../../schemas/prpm-manifest.schema.json"),
|
|
20928
21229
|
// Bundled layout (dist/index.js → ../schemas)
|
|
20929
|
-
(0,
|
|
21230
|
+
(0, import_path18.join)(__dirname, "../schemas/prpm-manifest.schema.json")
|
|
20930
21231
|
];
|
|
20931
21232
|
for (const candidate of schemaCandidates) {
|
|
20932
21233
|
try {
|
|
@@ -20953,27 +21254,27 @@ function validateManifestSchema(manifest) {
|
|
|
20953
21254
|
const valid = validate(manifest);
|
|
20954
21255
|
if (!valid && validate.errors) {
|
|
20955
21256
|
const errors = validate.errors.map((err) => {
|
|
20956
|
-
const
|
|
21257
|
+
const path12 = err.instancePath || "manifest";
|
|
20957
21258
|
const message = err.message || "validation failed";
|
|
20958
21259
|
if (err.keyword === "required") {
|
|
20959
21260
|
const missingProp = err.params.missingProperty;
|
|
20960
21261
|
return `Missing required field: ${missingProp}`;
|
|
20961
21262
|
}
|
|
20962
21263
|
if (err.keyword === "pattern") {
|
|
20963
|
-
return `${
|
|
21264
|
+
return `${path12}: ${message}. Value does not match required pattern.`;
|
|
20964
21265
|
}
|
|
20965
21266
|
if (err.keyword === "enum") {
|
|
20966
21267
|
const allowedValues = err.params.allowedValues;
|
|
20967
|
-
return `${
|
|
21268
|
+
return `${path12}: ${message}. Allowed values: ${allowedValues.join(", ")}`;
|
|
20968
21269
|
}
|
|
20969
21270
|
if (err.keyword === "minLength" || err.keyword === "maxLength") {
|
|
20970
21271
|
const limit = err.params.limit;
|
|
20971
|
-
return `${
|
|
21272
|
+
return `${path12}: ${message} (${err.keyword}: ${limit})`;
|
|
20972
21273
|
}
|
|
20973
21274
|
if (err.keyword === "oneOf") {
|
|
20974
|
-
return `${
|
|
21275
|
+
return `${path12}: must match exactly one schema (check if files array uses either all strings or all objects, not mixed)`;
|
|
20975
21276
|
}
|
|
20976
|
-
return `${
|
|
21277
|
+
return `${path12}: ${message}`;
|
|
20977
21278
|
});
|
|
20978
21279
|
return { valid: false, errors };
|
|
20979
21280
|
}
|
|
@@ -20988,10 +21289,10 @@ function toOrganizationSlug(value) {
|
|
|
20988
21289
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-+/g, "-");
|
|
20989
21290
|
}
|
|
20990
21291
|
async function findAndLoadManifests() {
|
|
20991
|
-
const prpmJsonPath = (0,
|
|
21292
|
+
const prpmJsonPath = (0, import_path19.join)(process.cwd(), "prpm.json");
|
|
20992
21293
|
let prpmJsonExists = false;
|
|
20993
21294
|
try {
|
|
20994
|
-
const content = await (0,
|
|
21295
|
+
const content = await (0, import_promises8.readFile)(prpmJsonPath, "utf-8");
|
|
20995
21296
|
prpmJsonExists = true;
|
|
20996
21297
|
const manifest = JSON.parse(content);
|
|
20997
21298
|
const collections = [];
|
|
@@ -21049,13 +21350,13 @@ async function findAndLoadManifests() {
|
|
|
21049
21350
|
throw error;
|
|
21050
21351
|
}
|
|
21051
21352
|
}
|
|
21052
|
-
const marketplaceJsonPath = (0,
|
|
21353
|
+
const marketplaceJsonPath = (0, import_path19.join)(
|
|
21053
21354
|
process.cwd(),
|
|
21054
21355
|
".claude",
|
|
21055
21356
|
"marketplace.json"
|
|
21056
21357
|
);
|
|
21057
21358
|
try {
|
|
21058
|
-
const content = await (0,
|
|
21359
|
+
const content = await (0, import_promises8.readFile)(marketplaceJsonPath, "utf-8");
|
|
21059
21360
|
const marketplaceData = JSON.parse(content);
|
|
21060
21361
|
if (!validateMarketplaceJson(marketplaceData)) {
|
|
21061
21362
|
throw new Error("Invalid marketplace.json format");
|
|
@@ -21069,13 +21370,13 @@ async function findAndLoadManifests() {
|
|
|
21069
21370
|
return { manifests, collections: [], source: ".claude/marketplace.json" };
|
|
21070
21371
|
} catch (error) {
|
|
21071
21372
|
}
|
|
21072
|
-
const marketplaceJsonPluginPath = (0,
|
|
21373
|
+
const marketplaceJsonPluginPath = (0, import_path19.join)(
|
|
21073
21374
|
process.cwd(),
|
|
21074
21375
|
".claude-plugin",
|
|
21075
21376
|
"marketplace.json"
|
|
21076
21377
|
);
|
|
21077
21378
|
try {
|
|
21078
|
-
const content = await (0,
|
|
21379
|
+
const content = await (0, import_promises8.readFile)(marketplaceJsonPluginPath, "utf-8");
|
|
21079
21380
|
const marketplaceData = JSON.parse(content);
|
|
21080
21381
|
if (!validateMarketplaceJson(marketplaceData)) {
|
|
21081
21382
|
throw new Error("Invalid marketplace.json format");
|
|
@@ -21126,7 +21427,7 @@ function validateManifest(manifest, contextLabel) {
|
|
|
21126
21427
|
if (manifest.format === "claude" && manifest.subtype === "skill") {
|
|
21127
21428
|
const filePaths = normalizeFilePaths2(manifest.files);
|
|
21128
21429
|
const hasSkillMd = filePaths.some(
|
|
21129
|
-
(
|
|
21430
|
+
(path12) => path12.endsWith("/SKILL.md") || path12 === "SKILL.md"
|
|
21130
21431
|
);
|
|
21131
21432
|
const mdFiles = filePaths.filter((filePath) => {
|
|
21132
21433
|
var _a2;
|
|
@@ -21235,10 +21536,10 @@ function getSafePackageName(manifest, userInfo, fallbackName) {
|
|
|
21235
21536
|
|
|
21236
21537
|
// src/utils/tarball-creator.ts
|
|
21237
21538
|
init_cjs_shims();
|
|
21238
|
-
var
|
|
21239
|
-
var
|
|
21240
|
-
var
|
|
21241
|
-
var
|
|
21539
|
+
var import_promises9 = require("fs/promises");
|
|
21540
|
+
var import_path20 = require("path");
|
|
21541
|
+
var tar3 = __toESM(require("tar"));
|
|
21542
|
+
var import_os6 = require("os");
|
|
21242
21543
|
var import_crypto2 = require("crypto");
|
|
21243
21544
|
var RELOCATION_CONFIG = {
|
|
21244
21545
|
claude: {
|
|
@@ -21326,12 +21627,12 @@ var RELOCATION_CONFIG = {
|
|
|
21326
21627
|
}
|
|
21327
21628
|
};
|
|
21328
21629
|
async function createTarball(manifest) {
|
|
21329
|
-
const tmpDir = (0,
|
|
21330
|
-
const tarballPath = (0,
|
|
21331
|
-
const stagingDir = (0,
|
|
21630
|
+
const tmpDir = (0, import_path20.join)((0, import_os6.tmpdir)(), `prpm-${(0, import_crypto2.randomBytes)(8).toString("hex")}`);
|
|
21631
|
+
const tarballPath = (0, import_path20.join)(tmpDir, "package.tar.gz");
|
|
21632
|
+
const stagingDir = (0, import_path20.join)(tmpDir, "staging");
|
|
21332
21633
|
try {
|
|
21333
|
-
await (0,
|
|
21334
|
-
await (0,
|
|
21634
|
+
await (0, import_promises9.mkdir)(tmpDir, { recursive: true });
|
|
21635
|
+
await (0, import_promises9.mkdir)(stagingDir, { recursive: true });
|
|
21335
21636
|
const filePaths = normalizeFilePaths2(manifest.files);
|
|
21336
21637
|
const standardFiles = ["prpm.json", "README.md", "LICENSE"];
|
|
21337
21638
|
for (const file of standardFiles) {
|
|
@@ -21343,18 +21644,18 @@ async function createTarball(manifest) {
|
|
|
21343
21644
|
const fileRenames = /* @__PURE__ */ new Map();
|
|
21344
21645
|
if (manifest.format === "claude" && manifest.subtype === "skill") {
|
|
21345
21646
|
const hasSkillMd = filePaths.some(
|
|
21346
|
-
(
|
|
21647
|
+
(path12) => path12.endsWith("/SKILL.md") || path12 === "SKILL.md"
|
|
21347
21648
|
);
|
|
21348
21649
|
if (!hasSkillMd) {
|
|
21349
21650
|
const mdFiles = filePaths.filter(
|
|
21350
|
-
(
|
|
21651
|
+
(path12) => path12.endsWith(".md") && !path12.toLowerCase().includes("readme")
|
|
21351
21652
|
);
|
|
21352
21653
|
if (mdFiles.length === 1) {
|
|
21353
21654
|
const file = mdFiles[0];
|
|
21354
21655
|
try {
|
|
21355
|
-
await (0,
|
|
21356
|
-
const dir = (0,
|
|
21357
|
-
const newPath = dir === "." ? "SKILL.md" : (0,
|
|
21656
|
+
await (0, import_promises9.stat)(file);
|
|
21657
|
+
const dir = (0, import_path20.dirname)(file);
|
|
21658
|
+
const newPath = dir === "." ? "SKILL.md" : (0, import_path20.join)(dir, "SKILL.md");
|
|
21358
21659
|
fileRenames.set(file, newPath);
|
|
21359
21660
|
console.log(` \u{1F4DD} Renaming ${file} \u2192 ${newPath}`);
|
|
21360
21661
|
} catch {
|
|
@@ -21366,20 +21667,20 @@ async function createTarball(manifest) {
|
|
|
21366
21667
|
const subtypeConfig = formatConfig == null ? void 0 : formatConfig[manifest.subtype || "rule"];
|
|
21367
21668
|
if (subtypeConfig) {
|
|
21368
21669
|
const contentFiles = filePaths.filter(
|
|
21369
|
-
(
|
|
21670
|
+
(path12) => !path12.toLowerCase().includes("readme") && !path12.toLowerCase().includes("license") && path12 !== "prpm.json" && (path12.endsWith(".md") || path12.endsWith(".mdc") || path12.endsWith(".json"))
|
|
21370
21671
|
);
|
|
21371
21672
|
for (const file of contentFiles) {
|
|
21372
21673
|
if (file.includes(subtypeConfig.checkPath)) {
|
|
21373
21674
|
continue;
|
|
21374
21675
|
}
|
|
21375
21676
|
try {
|
|
21376
|
-
await (0,
|
|
21377
|
-
let fileName = (0,
|
|
21677
|
+
await (0, import_promises9.stat)(file);
|
|
21678
|
+
let fileName = (0, import_path20.basename)(file);
|
|
21378
21679
|
if (subtypeConfig.extension) {
|
|
21379
21680
|
const nameWithoutExt = fileName.replace(/\.[^.]+$/, "");
|
|
21380
21681
|
fileName = nameWithoutExt + subtypeConfig.extension;
|
|
21381
21682
|
}
|
|
21382
|
-
const newPath = (0,
|
|
21683
|
+
const newPath = (0, import_path20.join)(subtypeConfig.directory, fileName);
|
|
21383
21684
|
fileRenames.set(file, newPath);
|
|
21384
21685
|
console.log(` \u{1F4DD} Relocating ${file} \u2192 ${newPath}`);
|
|
21385
21686
|
} catch {
|
|
@@ -21388,11 +21689,11 @@ async function createTarball(manifest) {
|
|
|
21388
21689
|
}
|
|
21389
21690
|
for (const file of filePaths) {
|
|
21390
21691
|
try {
|
|
21391
|
-
await (0,
|
|
21692
|
+
await (0, import_promises9.stat)(file);
|
|
21392
21693
|
const targetPath = fileRenames.get(file) || file;
|
|
21393
|
-
const stagingPath = (0,
|
|
21394
|
-
await (0,
|
|
21395
|
-
await (0,
|
|
21694
|
+
const stagingPath = (0, import_path20.join)(stagingDir, targetPath);
|
|
21695
|
+
await (0, import_promises9.mkdir)((0, import_path20.dirname)(stagingPath), { recursive: true });
|
|
21696
|
+
await (0, import_promises9.copyFile)(file, stagingPath);
|
|
21396
21697
|
existingFiles.push(targetPath);
|
|
21397
21698
|
} catch {
|
|
21398
21699
|
}
|
|
@@ -21400,7 +21701,7 @@ async function createTarball(manifest) {
|
|
|
21400
21701
|
if (existingFiles.length === 0) {
|
|
21401
21702
|
throw new Error("No package files found to include in tarball");
|
|
21402
21703
|
}
|
|
21403
|
-
await
|
|
21704
|
+
await tar3.create(
|
|
21404
21705
|
{
|
|
21405
21706
|
gzip: true,
|
|
21406
21707
|
file: tarballPath,
|
|
@@ -21408,7 +21709,7 @@ async function createTarball(manifest) {
|
|
|
21408
21709
|
},
|
|
21409
21710
|
existingFiles
|
|
21410
21711
|
);
|
|
21411
|
-
const tarballBuffer = await (0,
|
|
21712
|
+
const tarballBuffer = await (0, import_promises9.readFile)(tarballPath);
|
|
21412
21713
|
const sizeMB = tarballBuffer.length / (1024 * 1024);
|
|
21413
21714
|
if (sizeMB > 10) {
|
|
21414
21715
|
throw new Error(
|
|
@@ -21420,7 +21721,7 @@ async function createTarball(manifest) {
|
|
|
21420
21721
|
throw error;
|
|
21421
21722
|
} finally {
|
|
21422
21723
|
try {
|
|
21423
|
-
await (0,
|
|
21724
|
+
await (0, import_promises9.rm)(tmpDir, { recursive: true, force: true });
|
|
21424
21725
|
} catch {
|
|
21425
21726
|
}
|
|
21426
21727
|
}
|
|
@@ -21513,13 +21814,13 @@ async function handlePublish(options) {
|
|
|
21513
21814
|
console.log("\u{1F916} CI Mode: Publishing without authentication\n");
|
|
21514
21815
|
}
|
|
21515
21816
|
console.log("\u{1F4E6} Publishing package...\n");
|
|
21516
|
-
const prpmJsonPath = (0,
|
|
21517
|
-
const marketplaceJsonPath = (0,
|
|
21817
|
+
const prpmJsonPath = (0, import_path24.join)(process.cwd(), "prpm.json");
|
|
21818
|
+
const marketplaceJsonPath = (0, import_path24.join)(
|
|
21518
21819
|
process.cwd(),
|
|
21519
21820
|
".claude",
|
|
21520
21821
|
"marketplace.json"
|
|
21521
21822
|
);
|
|
21522
|
-
const marketplaceJsonPluginPath = (0,
|
|
21823
|
+
const marketplaceJsonPluginPath = (0, import_path24.join)(
|
|
21523
21824
|
process.cwd(),
|
|
21524
21825
|
".claude-plugin",
|
|
21525
21826
|
"marketplace.json"
|
|
@@ -21540,8 +21841,8 @@ async function handlePublish(options) {
|
|
|
21540
21841
|
const { manifests, collections, source } = await findAndLoadManifests();
|
|
21541
21842
|
if (source === "prpm.json (multi-package)" || source === "prpm.json") {
|
|
21542
21843
|
try {
|
|
21543
|
-
const prpmJsonPath2 = (0,
|
|
21544
|
-
const prpmContent = await (0,
|
|
21844
|
+
const prpmJsonPath2 = (0, import_path24.join)(process.cwd(), "prpm.json");
|
|
21845
|
+
const prpmContent = await (0, import_promises11.readFile)(prpmJsonPath2, "utf-8");
|
|
21545
21846
|
const prpmManifest = JSON.parse(prpmContent);
|
|
21546
21847
|
if (prpmManifest.scripts) {
|
|
21547
21848
|
await executePrepublishOnly(prpmManifest.scripts);
|
|
@@ -21585,7 +21886,7 @@ async function handlePublish(options) {
|
|
|
21585
21886
|
`);
|
|
21586
21887
|
}
|
|
21587
21888
|
console.log("\u{1F50D} Checking authentication...");
|
|
21588
|
-
const client = (0,
|
|
21889
|
+
const client = (0, import_registry_client7.getRegistryClient)(config);
|
|
21589
21890
|
let userInfo;
|
|
21590
21891
|
try {
|
|
21591
21892
|
userInfo = await client.whoami();
|
|
@@ -22130,7 +22431,7 @@ ${"=".repeat(60)}`);
|
|
|
22130
22431
|
}
|
|
22131
22432
|
}
|
|
22132
22433
|
function createPublishCommand() {
|
|
22133
|
-
return new
|
|
22434
|
+
return new import_commander14.Command("publish").description("Publish packages and collections to the registry").option(
|
|
22134
22435
|
"--access <type>",
|
|
22135
22436
|
"Package access (public or private) - overrides manifest setting"
|
|
22136
22437
|
).option("--tag <tag>", "NPM-style tag (e.g., latest, beta)", "latest").option("--dry-run", "Validate package without publishing").option(
|
|
@@ -22146,8 +22447,8 @@ function createPublishCommand() {
|
|
|
22146
22447
|
|
|
22147
22448
|
// src/commands/deprecate.ts
|
|
22148
22449
|
init_cjs_shims();
|
|
22149
|
-
var
|
|
22150
|
-
var
|
|
22450
|
+
var import_commander15 = require("commander");
|
|
22451
|
+
var import_registry_client8 = require("@pr-pm/registry-client");
|
|
22151
22452
|
init_user_config();
|
|
22152
22453
|
init_telemetry();
|
|
22153
22454
|
init_errors();
|
|
@@ -22162,7 +22463,7 @@ async function handleDeprecate(packageName, options) {
|
|
|
22162
22463
|
if (!config.token) {
|
|
22163
22464
|
throw new CLIError("\u274C Authentication required. Run `prpm login` first.", 1);
|
|
22164
22465
|
}
|
|
22165
|
-
const client = (0,
|
|
22466
|
+
const client = (0, import_registry_client8.getRegistryClient)(config);
|
|
22166
22467
|
const action = options.undo ? "Undeprecating" : "Deprecating";
|
|
22167
22468
|
console.log(`\u26A0\uFE0F ${action} package: ${packageName}...
|
|
22168
22469
|
`);
|
|
@@ -22210,7 +22511,7 @@ async function handleDeprecate(packageName, options) {
|
|
|
22210
22511
|
}
|
|
22211
22512
|
}
|
|
22212
22513
|
function createDeprecateCommand() {
|
|
22213
|
-
const command = new
|
|
22514
|
+
const command = new import_commander15.Command("deprecate");
|
|
22214
22515
|
command.description("Deprecate a package (owner only)").argument("<package>", "Package name to deprecate").option("--reason <reason>", "Reason for deprecation").option("--undo", "Remove deprecation status").action(async (packageName, options) => {
|
|
22215
22516
|
await handleDeprecate(packageName, options);
|
|
22216
22517
|
});
|
|
@@ -22219,8 +22520,8 @@ function createDeprecateCommand() {
|
|
|
22219
22520
|
|
|
22220
22521
|
// src/commands/visibility.ts
|
|
22221
22522
|
init_cjs_shims();
|
|
22222
|
-
var
|
|
22223
|
-
var
|
|
22523
|
+
var import_commander16 = require("commander");
|
|
22524
|
+
var import_registry_client9 = require("@pr-pm/registry-client");
|
|
22224
22525
|
init_user_config();
|
|
22225
22526
|
init_telemetry();
|
|
22226
22527
|
init_errors();
|
|
@@ -22241,7 +22542,7 @@ async function handleVisibility(packageName, options) {
|
|
|
22241
22542
|
throw new CLIError("\u274C Must specify either --public or --private", 1);
|
|
22242
22543
|
}
|
|
22243
22544
|
visibility = options.public ? "public" : "private";
|
|
22244
|
-
const client = (0,
|
|
22545
|
+
const client = (0, import_registry_client9.getRegistryClient)(config);
|
|
22245
22546
|
console.log(`\u{1F504} Setting package visibility: ${packageName} -> ${visibility}...
|
|
22246
22547
|
`);
|
|
22247
22548
|
const result = await client.setPackageVisibility(packageName, visibility);
|
|
@@ -22284,7 +22585,7 @@ async function handleVisibility(packageName, options) {
|
|
|
22284
22585
|
}
|
|
22285
22586
|
}
|
|
22286
22587
|
function createVisibilityCommand() {
|
|
22287
|
-
const command = new
|
|
22588
|
+
const command = new import_commander16.Command("visibility");
|
|
22288
22589
|
command.description("Change package visibility (owner only)").argument("<package>", "Package name to update").option("--public", "Make the package public (visible in search)").option("--private", "Make the package private (org members only)").action(async (packageName, options) => {
|
|
22289
22590
|
await handleVisibility(packageName, options);
|
|
22290
22591
|
});
|
|
@@ -22293,7 +22594,7 @@ function createVisibilityCommand() {
|
|
|
22293
22594
|
|
|
22294
22595
|
// src/commands/login.ts
|
|
22295
22596
|
init_cjs_shims();
|
|
22296
|
-
var
|
|
22597
|
+
var import_commander17 = require("commander");
|
|
22297
22598
|
var jwt = __toESM(require("jsonwebtoken"));
|
|
22298
22599
|
init_telemetry();
|
|
22299
22600
|
init_user_config();
|
|
@@ -22460,16 +22761,16 @@ async function handleLogin(options) {
|
|
|
22460
22761
|
}
|
|
22461
22762
|
}
|
|
22462
22763
|
function createLoginCommand() {
|
|
22463
|
-
return new
|
|
22764
|
+
return new import_commander17.Command("login").description("Login to the PRMP registry").option("--token <token>", "Login with a personal access token").action(async (options) => {
|
|
22464
22765
|
await handleLogin(options);
|
|
22465
22766
|
});
|
|
22466
22767
|
}
|
|
22467
22768
|
|
|
22468
22769
|
// src/commands/whoami.ts
|
|
22469
22770
|
init_cjs_shims();
|
|
22470
|
-
var
|
|
22771
|
+
var import_commander18 = require("commander");
|
|
22471
22772
|
init_user_config();
|
|
22472
|
-
var
|
|
22773
|
+
var import_registry_client10 = require("@pr-pm/registry-client");
|
|
22473
22774
|
init_telemetry();
|
|
22474
22775
|
init_errors();
|
|
22475
22776
|
async function handleWhoami() {
|
|
@@ -22485,7 +22786,7 @@ async function handleWhoami() {
|
|
|
22485
22786
|
return;
|
|
22486
22787
|
}
|
|
22487
22788
|
try {
|
|
22488
|
-
const client = (0,
|
|
22789
|
+
const client = (0, import_registry_client10.getRegistryClient)(config);
|
|
22489
22790
|
const userProfile = await client.getUserProfile(config.username);
|
|
22490
22791
|
console.log(`
|
|
22491
22792
|
\u{1F464} ${userProfile.username}${userProfile.verified_author ? " \u2713" : ""}`);
|
|
@@ -22525,7 +22826,7 @@ async function handleWhoami() {
|
|
|
22525
22826
|
}
|
|
22526
22827
|
}
|
|
22527
22828
|
function createWhoamiCommand() {
|
|
22528
|
-
return new
|
|
22829
|
+
return new import_commander18.Command("whoami").description("Show current logged-in user").action(async () => {
|
|
22529
22830
|
await handleWhoami();
|
|
22530
22831
|
});
|
|
22531
22832
|
}
|
|
@@ -22535,8 +22836,8 @@ init_collections();
|
|
|
22535
22836
|
|
|
22536
22837
|
// src/commands/outdated.ts
|
|
22537
22838
|
init_cjs_shims();
|
|
22538
|
-
var
|
|
22539
|
-
var
|
|
22839
|
+
var import_commander19 = require("commander");
|
|
22840
|
+
var import_registry_client11 = require("@pr-pm/registry-client");
|
|
22540
22841
|
init_user_config();
|
|
22541
22842
|
init_lockfile();
|
|
22542
22843
|
init_telemetry();
|
|
@@ -22548,7 +22849,7 @@ async function handleOutdated() {
|
|
|
22548
22849
|
try {
|
|
22549
22850
|
console.log("\u{1F50D} Checking for package updates...\n");
|
|
22550
22851
|
const config = await getConfig();
|
|
22551
|
-
const client = (0,
|
|
22852
|
+
const client = (0, import_registry_client11.getRegistryClient)(config);
|
|
22552
22853
|
const installedPackages = await listPackages();
|
|
22553
22854
|
if (installedPackages.length === 0) {
|
|
22554
22855
|
console.log("No packages installed.");
|
|
@@ -22638,15 +22939,15 @@ function getUpdateType(current, latest) {
|
|
|
22638
22939
|
return "patch";
|
|
22639
22940
|
}
|
|
22640
22941
|
function createOutdatedCommand() {
|
|
22641
|
-
return new
|
|
22942
|
+
return new import_commander19.Command("outdated").description("Check for package updates").action(async () => {
|
|
22642
22943
|
await handleOutdated();
|
|
22643
22944
|
});
|
|
22644
22945
|
}
|
|
22645
22946
|
|
|
22646
22947
|
// src/commands/update.ts
|
|
22647
22948
|
init_cjs_shims();
|
|
22648
|
-
var
|
|
22649
|
-
var
|
|
22949
|
+
var import_commander20 = require("commander");
|
|
22950
|
+
var import_registry_client12 = require("@pr-pm/registry-client");
|
|
22650
22951
|
init_user_config();
|
|
22651
22952
|
init_lockfile();
|
|
22652
22953
|
init_install();
|
|
@@ -22659,7 +22960,7 @@ async function handleUpdate(packageName, options = {}) {
|
|
|
22659
22960
|
let updatedCount = 0;
|
|
22660
22961
|
try {
|
|
22661
22962
|
const config = await getConfig();
|
|
22662
|
-
const client = (0,
|
|
22963
|
+
const client = (0, import_registry_client12.getRegistryClient)(config);
|
|
22663
22964
|
const installedPackages = await listPackages();
|
|
22664
22965
|
if (installedPackages.length === 0) {
|
|
22665
22966
|
console.log("No packages installed.");
|
|
@@ -22751,7 +23052,7 @@ function getUpdateType2(current, latest) {
|
|
|
22751
23052
|
return "patch";
|
|
22752
23053
|
}
|
|
22753
23054
|
function createUpdateCommand() {
|
|
22754
|
-
return new
|
|
23055
|
+
return new import_commander20.Command("update").description(
|
|
22755
23056
|
"Update packages to latest compatible versions (minor/patch only)"
|
|
22756
23057
|
).argument("[package]", "Specific package to update (optional)").option("--all", "Update all packages").action(async (packageName, options) => {
|
|
22757
23058
|
await handleUpdate(packageName, options);
|
|
@@ -22760,8 +23061,8 @@ function createUpdateCommand() {
|
|
|
22760
23061
|
|
|
22761
23062
|
// src/commands/upgrade.ts
|
|
22762
23063
|
init_cjs_shims();
|
|
22763
|
-
var
|
|
22764
|
-
var
|
|
23064
|
+
var import_commander21 = require("commander");
|
|
23065
|
+
var import_registry_client13 = require("@pr-pm/registry-client");
|
|
22765
23066
|
init_user_config();
|
|
22766
23067
|
init_lockfile();
|
|
22767
23068
|
init_install();
|
|
@@ -22775,7 +23076,7 @@ async function handleUpgrade(packageName, options = {}) {
|
|
|
22775
23076
|
let upgradedCount = 0;
|
|
22776
23077
|
try {
|
|
22777
23078
|
const config = await getConfig();
|
|
22778
|
-
const client = (0,
|
|
23079
|
+
const client = (0, import_registry_client13.getRegistryClient)(config);
|
|
22779
23080
|
const installedPackages = await listPackages();
|
|
22780
23081
|
if (installedPackages.length === 0) {
|
|
22781
23082
|
console.log("No packages installed.");
|
|
@@ -22942,7 +23243,7 @@ function getUpdateType3(current, latest) {
|
|
|
22942
23243
|
return "patch";
|
|
22943
23244
|
}
|
|
22944
23245
|
function createUpgradeCommand() {
|
|
22945
|
-
return new
|
|
23246
|
+
return new import_commander21.Command("upgrade").description(
|
|
22946
23247
|
"Upgrade packages to latest versions (including major updates)"
|
|
22947
23248
|
).argument("[package]", "Specific package to upgrade (optional)").option("--all", "Upgrade all packages").option("--force", "Skip warning for major version upgrades").action(
|
|
22948
23249
|
async (packageName, options) => {
|
|
@@ -22953,7 +23254,7 @@ function createUpgradeCommand() {
|
|
|
22953
23254
|
|
|
22954
23255
|
// src/commands/schema.ts
|
|
22955
23256
|
init_cjs_shims();
|
|
22956
|
-
var
|
|
23257
|
+
var import_commander22 = require("commander");
|
|
22957
23258
|
init_errors();
|
|
22958
23259
|
async function handleSchema() {
|
|
22959
23260
|
try {
|
|
@@ -22970,7 +23271,7 @@ async function handleSchema() {
|
|
|
22970
23271
|
}
|
|
22971
23272
|
}
|
|
22972
23273
|
function createSchemaCommand() {
|
|
22973
|
-
const command = new
|
|
23274
|
+
const command = new import_commander22.Command("schema");
|
|
22974
23275
|
command.description("Display the PRPM manifest JSON schema").action(async () => {
|
|
22975
23276
|
await handleSchema();
|
|
22976
23277
|
});
|
|
@@ -22982,7 +23283,7 @@ init_init();
|
|
|
22982
23283
|
|
|
22983
23284
|
// src/commands/config.ts
|
|
22984
23285
|
init_cjs_shims();
|
|
22985
|
-
var
|
|
23286
|
+
var import_commander23 = require("commander");
|
|
22986
23287
|
init_user_config();
|
|
22987
23288
|
init_errors();
|
|
22988
23289
|
async function handleConfigGet(key) {
|
|
@@ -23073,7 +23374,7 @@ async function handleConfigDelete(key) {
|
|
|
23073
23374
|
}
|
|
23074
23375
|
}
|
|
23075
23376
|
function createConfigCommand() {
|
|
23076
|
-
const command = new
|
|
23377
|
+
const command = new import_commander23.Command("config").description("Manage CLI configuration");
|
|
23077
23378
|
command.command("list").alias("ls").description("List all configuration values").action(async () => {
|
|
23078
23379
|
await handleConfigList();
|
|
23079
23380
|
});
|
|
@@ -23094,9 +23395,9 @@ function createConfigCommand() {
|
|
|
23094
23395
|
|
|
23095
23396
|
// src/commands/catalog.ts
|
|
23096
23397
|
init_cjs_shims();
|
|
23097
|
-
var
|
|
23398
|
+
var import_commander24 = require("commander");
|
|
23098
23399
|
function createCatalogCommand() {
|
|
23099
|
-
return new
|
|
23400
|
+
return new import_commander24.Command("catalog").description(
|
|
23100
23401
|
"[DEPRECATED] Use 'prpm init --scan' instead. Discover and catalog packages."
|
|
23101
23402
|
).argument("[directories...]", "Directories to scan for packages").option("-o, --output <path>", "Output path for prpm.json").option("-a, --append", "Append to existing prpm.json").option("--dry-run", "Show what would be cataloged without making changes").action(
|
|
23102
23403
|
async (directories, options) => {
|
|
@@ -23135,12 +23436,12 @@ function createCatalogCommand() {
|
|
|
23135
23436
|
|
|
23136
23437
|
// src/commands/playground.ts
|
|
23137
23438
|
init_cjs_shims();
|
|
23138
|
-
var
|
|
23439
|
+
var import_commander25 = require("commander");
|
|
23139
23440
|
init_user_config();
|
|
23140
23441
|
init_telemetry();
|
|
23141
23442
|
var readline5 = __toESM(require("readline"));
|
|
23142
|
-
var
|
|
23143
|
-
var
|
|
23443
|
+
var fs14 = __toESM(require("fs"));
|
|
23444
|
+
var path11 = __toESM(require("path"));
|
|
23144
23445
|
init_errors();
|
|
23145
23446
|
function createReadline() {
|
|
23146
23447
|
return readline5.createInterface({
|
|
@@ -23258,11 +23559,11 @@ async function runCustomPrompt(customPrompt, input2, options, sessionId) {
|
|
|
23258
23559
|
return response.json();
|
|
23259
23560
|
}
|
|
23260
23561
|
function readPromptFile(filePath) {
|
|
23261
|
-
const absolutePath =
|
|
23262
|
-
if (!
|
|
23562
|
+
const absolutePath = path11.resolve(filePath);
|
|
23563
|
+
if (!fs14.existsSync(absolutePath)) {
|
|
23263
23564
|
throw new Error(`Prompt file not found: ${filePath}`);
|
|
23264
23565
|
}
|
|
23265
|
-
return
|
|
23566
|
+
return fs14.readFileSync(absolutePath, "utf-8");
|
|
23266
23567
|
}
|
|
23267
23568
|
function displayResponse(result, showStats = true) {
|
|
23268
23569
|
const lastMessage = result.conversation[result.conversation.length - 1];
|
|
@@ -23575,7 +23876,7 @@ async function handlePlayground(options) {
|
|
|
23575
23876
|
}
|
|
23576
23877
|
}
|
|
23577
23878
|
function createPlaygroundCommand() {
|
|
23578
|
-
const command = new
|
|
23879
|
+
const command = new import_commander25.Command("playground");
|
|
23579
23880
|
command.description("Test a package or custom prompt with AI models in the playground").option("-p, --package <name>", "Package name to test").option("--input <text>", "Input text to send to the model (omit for interactive mode)").option(
|
|
23580
23881
|
"-m, --model <model>",
|
|
23581
23882
|
"AI model to use (sonnet, opus, gpt-4o, gpt-4o-mini, gpt-4-turbo)",
|
|
@@ -23644,7 +23945,7 @@ Note: Playground usage requires credits. Run 'prpm credits' to check balance.
|
|
|
23644
23945
|
|
|
23645
23946
|
// src/commands/credits.ts
|
|
23646
23947
|
init_cjs_shims();
|
|
23647
|
-
var
|
|
23948
|
+
var import_commander26 = require("commander");
|
|
23648
23949
|
init_user_config();
|
|
23649
23950
|
init_telemetry();
|
|
23650
23951
|
init_errors();
|
|
@@ -23771,7 +24072,7 @@ async function handleCredits(options) {
|
|
|
23771
24072
|
}
|
|
23772
24073
|
}
|
|
23773
24074
|
function createCreditsCommand() {
|
|
23774
|
-
const command = new
|
|
24075
|
+
const command = new import_commander26.Command("credits");
|
|
23775
24076
|
command.description("Check playground credits balance and transaction history").option("-h, --history", "Show transaction history instead of balance", false).option("-l, --limit <number>", "Number of transactions to show in history", "10").addHelpText(
|
|
23776
24077
|
"after",
|
|
23777
24078
|
`
|
|
@@ -23806,7 +24107,7 @@ Get more credits:
|
|
|
23806
24107
|
|
|
23807
24108
|
// src/commands/subscribe.ts
|
|
23808
24109
|
init_cjs_shims();
|
|
23809
|
-
var
|
|
24110
|
+
var import_commander27 = require("commander");
|
|
23810
24111
|
init_user_config();
|
|
23811
24112
|
init_telemetry();
|
|
23812
24113
|
var import_child_process2 = require("child_process");
|
|
@@ -23965,7 +24266,7 @@ async function handleSubscribe() {
|
|
|
23965
24266
|
}
|
|
23966
24267
|
}
|
|
23967
24268
|
function createSubscribeCommand() {
|
|
23968
|
-
const command = new
|
|
24269
|
+
const command = new import_commander27.Command("subscribe");
|
|
23969
24270
|
command.description("Subscribe to PRPM+ for monthly playground credits and benefits").addHelpText(
|
|
23970
24271
|
"after",
|
|
23971
24272
|
`
|
|
@@ -24006,7 +24307,7 @@ Note: You can cancel anytime from https://prpm.dev/settings/billing
|
|
|
24006
24307
|
|
|
24007
24308
|
// src/commands/buy-credits.ts
|
|
24008
24309
|
init_cjs_shims();
|
|
24009
|
-
var
|
|
24310
|
+
var import_commander28 = require("commander");
|
|
24010
24311
|
init_user_config();
|
|
24011
24312
|
init_telemetry();
|
|
24012
24313
|
var import_child_process3 = require("child_process");
|
|
@@ -24147,7 +24448,7 @@ async function handleBuyCredits(options) {
|
|
|
24147
24448
|
}
|
|
24148
24449
|
}
|
|
24149
24450
|
function createBuyCreditsCommand() {
|
|
24150
|
-
const command = new
|
|
24451
|
+
const command = new import_commander28.Command("buy-credits");
|
|
24151
24452
|
command.description("Purchase one-time playground credits (never expire)").option(
|
|
24152
24453
|
"-p, --package <package>",
|
|
24153
24454
|
"Credit package to purchase (small, medium, large)"
|
|
@@ -24200,8 +24501,8 @@ Note: Purchased credits are one-time and never expire, unlike monthly credits.
|
|
|
24200
24501
|
|
|
24201
24502
|
// src/commands/starred.ts
|
|
24202
24503
|
init_cjs_shims();
|
|
24203
|
-
var
|
|
24204
|
-
var
|
|
24504
|
+
var import_commander29 = require("commander");
|
|
24505
|
+
var import_registry_client14 = require("@pr-pm/registry-client");
|
|
24205
24506
|
init_user_config();
|
|
24206
24507
|
init_telemetry();
|
|
24207
24508
|
init_errors();
|
|
@@ -24214,7 +24515,7 @@ async function handleStarred(options) {
|
|
|
24214
24515
|
throw new CLIError("You must be logged in to view starred items. Run `prpm login` first.");
|
|
24215
24516
|
}
|
|
24216
24517
|
const registryUrl = config.registryUrl || process.env.PRPM_REGISTRY_URL || "https://registry.prpm.dev";
|
|
24217
|
-
const client = (0,
|
|
24518
|
+
const client = (0, import_registry_client14.getRegistryClient)({ registryUrl, token });
|
|
24218
24519
|
const showPackages = options.packages || !options.packages && !options.collections;
|
|
24219
24520
|
const showCollections = options.collections || !options.packages && !options.collections;
|
|
24220
24521
|
const limit = options.limit || 100;
|
|
@@ -24316,91 +24617,91 @@ Total: ${packages.length + collections.length} starred items`);
|
|
|
24316
24617
|
}
|
|
24317
24618
|
}
|
|
24318
24619
|
function createStarredCommand() {
|
|
24319
|
-
const command = new
|
|
24620
|
+
const command = new import_commander29.Command("starred");
|
|
24320
24621
|
command.description("List your starred packages and collections").option("--packages", "Show only starred packages").option("--collections", "Show only starred collections").option("--format <format>", "Filter packages by format (cursor, claude, continue, windsurf, etc.)").option("--limit <number>", "Maximum number of items to fetch (default: 100)", (val) => parseInt(val, 10)).action(handleStarred);
|
|
24321
24622
|
return command;
|
|
24322
24623
|
}
|
|
24323
24624
|
|
|
24324
24625
|
// src/commands/convert.ts
|
|
24325
24626
|
init_cjs_shims();
|
|
24326
|
-
var
|
|
24327
|
-
var
|
|
24328
|
-
var
|
|
24627
|
+
var import_commander30 = require("commander");
|
|
24628
|
+
var import_promises12 = require("fs/promises");
|
|
24629
|
+
var import_path25 = require("path");
|
|
24329
24630
|
var import_fs20 = require("fs");
|
|
24330
24631
|
var import_readline = require("readline");
|
|
24331
24632
|
init_source();
|
|
24332
24633
|
init_errors();
|
|
24333
24634
|
init_dist();
|
|
24334
24635
|
function getDefaultPath(format, filename, subtype, customName) {
|
|
24335
|
-
const baseName = customName || (0,
|
|
24636
|
+
const baseName = customName || (0, import_path25.basename)(filename, (0, import_path25.extname)(filename));
|
|
24336
24637
|
switch (format) {
|
|
24337
24638
|
case "cursor":
|
|
24338
24639
|
if (subtype === "slash-command") {
|
|
24339
|
-
return (0,
|
|
24640
|
+
return (0, import_path25.join)(process.cwd(), ".cursor", "commands", `${baseName}.md`);
|
|
24340
24641
|
}
|
|
24341
24642
|
if (subtype === "hook") {
|
|
24342
|
-
return (0,
|
|
24643
|
+
return (0, import_path25.join)(process.cwd(), ".cursor", "hooks", "hooks.json");
|
|
24343
24644
|
}
|
|
24344
|
-
return (0,
|
|
24645
|
+
return (0, import_path25.join)(process.cwd(), ".cursor", "rules", `${baseName}.mdc`);
|
|
24345
24646
|
case "claude":
|
|
24346
24647
|
if (subtype === "skill") {
|
|
24347
|
-
return (0,
|
|
24648
|
+
return (0, import_path25.join)(process.cwd(), ".claude", "skills", baseName, "SKILL.md");
|
|
24348
24649
|
} else if (subtype === "slash-command") {
|
|
24349
|
-
return (0,
|
|
24650
|
+
return (0, import_path25.join)(process.cwd(), ".claude", "commands", `${baseName}.md`);
|
|
24350
24651
|
} else {
|
|
24351
|
-
return (0,
|
|
24652
|
+
return (0, import_path25.join)(process.cwd(), ".claude", "agents", `${baseName}.md`);
|
|
24352
24653
|
}
|
|
24353
24654
|
case "windsurf":
|
|
24354
|
-
return (0,
|
|
24655
|
+
return (0, import_path25.join)(process.cwd(), ".windsurf", "rules", `${baseName}.md`);
|
|
24355
24656
|
case "kiro":
|
|
24356
24657
|
if (subtype === "hook") {
|
|
24357
|
-
return (0,
|
|
24658
|
+
return (0, import_path25.join)(process.cwd(), ".kiro", "hooks", `${baseName}.kiro.hook`);
|
|
24358
24659
|
}
|
|
24359
24660
|
if (subtype === "agent") {
|
|
24360
|
-
return (0,
|
|
24661
|
+
return (0, import_path25.join)(process.cwd(), ".kiro", "agents", `${baseName}.json`);
|
|
24361
24662
|
}
|
|
24362
|
-
return (0,
|
|
24663
|
+
return (0, import_path25.join)(process.cwd(), ".kiro", "steering", `${baseName}.md`);
|
|
24363
24664
|
case "copilot":
|
|
24364
|
-
return (0,
|
|
24665
|
+
return (0, import_path25.join)(process.cwd(), ".github", "instructions", `${baseName}.instructions.md`);
|
|
24365
24666
|
case "continue":
|
|
24366
24667
|
if (subtype === "slash-command" || subtype === "prompt") {
|
|
24367
|
-
return (0,
|
|
24668
|
+
return (0, import_path25.join)(process.cwd(), ".continue", "prompts", `${baseName}.md`);
|
|
24368
24669
|
}
|
|
24369
|
-
return (0,
|
|
24670
|
+
return (0, import_path25.join)(process.cwd(), ".continue", "rules", `${baseName}.md`);
|
|
24370
24671
|
case "agents.md":
|
|
24371
|
-
return (0,
|
|
24672
|
+
return (0, import_path25.join)(process.cwd(), "agents.md");
|
|
24372
24673
|
case "gemini":
|
|
24373
|
-
return (0,
|
|
24674
|
+
return (0, import_path25.join)(process.cwd(), ".gemini", "commands", `${baseName}.toml`);
|
|
24374
24675
|
case "ruler":
|
|
24375
|
-
return (0,
|
|
24676
|
+
return (0, import_path25.join)(process.cwd(), ".ruler", `${baseName}.md`);
|
|
24376
24677
|
case "zed":
|
|
24377
24678
|
if (subtype === "slash-command") {
|
|
24378
|
-
return (0,
|
|
24679
|
+
return (0, import_path25.join)(process.cwd(), ".zed", "slash_commands", `${baseName}.md`);
|
|
24379
24680
|
}
|
|
24380
|
-
return (0,
|
|
24681
|
+
return (0, import_path25.join)(process.cwd(), ".zed", "extensions", `${baseName}.json`);
|
|
24381
24682
|
case "opencode":
|
|
24382
|
-
return (0,
|
|
24683
|
+
return (0, import_path25.join)(process.cwd(), ".opencode", `${baseName}.md`);
|
|
24383
24684
|
case "aider":
|
|
24384
|
-
return (0,
|
|
24685
|
+
return (0, import_path25.join)(process.cwd(), ".aider", `${baseName}.md`);
|
|
24385
24686
|
case "trae":
|
|
24386
|
-
return (0,
|
|
24687
|
+
return (0, import_path25.join)(process.cwd(), ".trae", "rules", `${baseName}.md`);
|
|
24387
24688
|
case "replit":
|
|
24388
|
-
return (0,
|
|
24689
|
+
return (0, import_path25.join)(process.cwd(), ".replit", `${baseName}.md`);
|
|
24389
24690
|
case "zencoder":
|
|
24390
|
-
return (0,
|
|
24691
|
+
return (0, import_path25.join)(process.cwd(), ".zencoder", `${baseName}.md`);
|
|
24391
24692
|
case "droid":
|
|
24392
|
-
return (0,
|
|
24693
|
+
return (0, import_path25.join)(process.cwd(), ".factory", `${baseName}.md`);
|
|
24393
24694
|
case "codex":
|
|
24394
24695
|
if (subtype === "skill") {
|
|
24395
|
-
return (0,
|
|
24696
|
+
return (0, import_path25.join)(process.cwd(), ".codex", "skills", baseName, "SKILL.md");
|
|
24396
24697
|
}
|
|
24397
|
-
return (0,
|
|
24698
|
+
return (0, import_path25.join)(process.cwd(), "AGENTS.md");
|
|
24398
24699
|
default:
|
|
24399
24700
|
throw new CLIError(`Unknown format: ${format}`);
|
|
24400
24701
|
}
|
|
24401
24702
|
}
|
|
24402
24703
|
function detectFormat(content, filepath) {
|
|
24403
|
-
const ext = (0,
|
|
24704
|
+
const ext = (0, import_path25.extname)(filepath).toLowerCase();
|
|
24404
24705
|
if (ext === ".mdc" || filepath.includes(".cursor/rules") || filepath.includes(".cursor/commands")) {
|
|
24405
24706
|
return "cursor";
|
|
24406
24707
|
}
|
|
@@ -24422,10 +24723,10 @@ function detectFormat(content, filepath) {
|
|
|
24422
24723
|
if (filepath.includes(".continue/rules") || filepath.includes(".continue/prompts") || filepath.includes(".continuerules")) {
|
|
24423
24724
|
return "continue";
|
|
24424
24725
|
}
|
|
24425
|
-
if ((0,
|
|
24726
|
+
if ((0, import_path25.basename)(filepath) === "agents.md") {
|
|
24426
24727
|
return "agents.md";
|
|
24427
24728
|
}
|
|
24428
|
-
if ((0,
|
|
24729
|
+
if ((0, import_path25.basename)(filepath) === "gemini-extension.json" || filepath.includes(".gemini/extensions")) {
|
|
24429
24730
|
return "gemini-extension";
|
|
24430
24731
|
}
|
|
24431
24732
|
if (ext === ".toml" || filepath.includes(".gemini/commands")) {
|
|
@@ -24478,7 +24779,7 @@ async function handleConvert(sourcePath, options) {
|
|
|
24478
24779
|
console.log(source_default.dim("Reading source file..."));
|
|
24479
24780
|
let content;
|
|
24480
24781
|
try {
|
|
24481
|
-
content = await (0,
|
|
24782
|
+
content = await (0, import_promises12.readFile)(sourcePath, "utf-8");
|
|
24482
24783
|
} catch (error) {
|
|
24483
24784
|
throw new CLIError(`Failed to read source file: ${error.message}`);
|
|
24484
24785
|
}
|
|
@@ -24514,7 +24815,7 @@ async function handleConvert(sourcePath, options) {
|
|
|
24514
24815
|
}
|
|
24515
24816
|
canonicalPkg = fromCursor(content, metadata, {
|
|
24516
24817
|
resolveFiles: hasFileReferences,
|
|
24517
|
-
basePath: hasFileReferences ? (0,
|
|
24818
|
+
basePath: hasFileReferences ? (0, import_path25.dirname)(sourcePath) : void 0
|
|
24518
24819
|
});
|
|
24519
24820
|
break;
|
|
24520
24821
|
case "cursor-hooks":
|
|
@@ -24671,10 +24972,10 @@ async function handleConvert(sourcePath, options) {
|
|
|
24671
24972
|
return;
|
|
24672
24973
|
}
|
|
24673
24974
|
}
|
|
24674
|
-
const outputDir = (0,
|
|
24675
|
-
await (0,
|
|
24975
|
+
const outputDir = (0, import_path25.dirname)(outputPath);
|
|
24976
|
+
await (0, import_promises12.mkdir)(outputDir, { recursive: true });
|
|
24676
24977
|
console.log(source_default.dim("Writing converted file..."));
|
|
24677
|
-
await (0,
|
|
24978
|
+
await (0, import_promises12.writeFile)(outputPath, result.content, "utf-8");
|
|
24678
24979
|
console.log(source_default.green(`\u2713 Converted file written to ${outputPath}`));
|
|
24679
24980
|
console.log();
|
|
24680
24981
|
if (options.to === "cursor") {
|
|
@@ -24698,7 +24999,7 @@ async function handleConvert(sourcePath, options) {
|
|
|
24698
24999
|
}
|
|
24699
25000
|
}
|
|
24700
25001
|
function createConvertCommand() {
|
|
24701
|
-
const command = new
|
|
25002
|
+
const command = new import_commander30.Command("convert").description("Convert AI prompt files between formats").argument("<source>", "Source file path to convert").option("-t, --to <format>", `Target format (${CLI_SUPPORTED_FORMATS.join(", ")})`).option("-s, --subtype <subtype>", "Target subtype (agent, skill, slash-command, rule, hook, prompt, etc.)").option("-o, --output <path>", "Output path (defaults to format-specific location)").option("-n, --name <name>", 'Custom output filename (without extension, e.g., "my-rule")').option("--hook-mapping <strategy>", "Hook mapping strategy: auto (default), strict, skip", "auto").option("-y, --yes", "Skip confirmation prompts").action(async (source, options) => {
|
|
24702
25003
|
try {
|
|
24703
25004
|
if (!options.to) {
|
|
24704
25005
|
throw new CLIError("Target format is required. Use --to <format>");
|
|
@@ -24747,9 +25048,9 @@ Valid subtypes: ${validSubtypes.join(", ")}`
|
|
|
24747
25048
|
|
|
24748
25049
|
// src/commands/export.ts
|
|
24749
25050
|
init_cjs_shims();
|
|
24750
|
-
var
|
|
25051
|
+
var import_commander31 = require("commander");
|
|
24751
25052
|
var import_fs21 = require("fs");
|
|
24752
|
-
var
|
|
25053
|
+
var import_path26 = require("path");
|
|
24753
25054
|
init_source();
|
|
24754
25055
|
init_errors();
|
|
24755
25056
|
init_lockfile();
|
|
@@ -24765,7 +25066,7 @@ async function exportToRuler(options) {
|
|
|
24765
25066
|
}
|
|
24766
25067
|
console.log(source_default.green(`\u2713 Found ${packages.length} installed package${packages.length === 1 ? "" : "s"}`));
|
|
24767
25068
|
console.log();
|
|
24768
|
-
const outputDir = options.output || (0,
|
|
25069
|
+
const outputDir = options.output || (0, import_path26.join)(process.cwd(), ".ruler");
|
|
24769
25070
|
let rulerExists = false;
|
|
24770
25071
|
try {
|
|
24771
25072
|
await import_fs21.promises.access(outputDir);
|
|
@@ -24792,7 +25093,7 @@ async function exportToRuler(options) {
|
|
|
24792
25093
|
const content = await import_fs21.promises.readFile(pkg.installedPath, "utf-8");
|
|
24793
25094
|
const rulerContent = createRulerFormat(pkg.id, pkg.version, content, pkg.format, pkg.subtype);
|
|
24794
25095
|
const rulerFilename = `${packageName}.md`;
|
|
24795
|
-
const rulerPath = (0,
|
|
25096
|
+
const rulerPath = (0, import_path26.join)(outputDir, rulerFilename);
|
|
24796
25097
|
await import_fs21.promises.writeFile(rulerPath, rulerContent, "utf-8");
|
|
24797
25098
|
console.log(source_default.green(`\u2713 Exported ${pkg.id} \u2192 ${rulerFilename}`));
|
|
24798
25099
|
exportedCount++;
|
|
@@ -24832,7 +25133,7 @@ function createRulerFormat(packageId, version, content, format, subtype) {
|
|
|
24832
25133
|
return frontmatter + contentWithoutFrontmatter;
|
|
24833
25134
|
}
|
|
24834
25135
|
async function ensureRulerConfig(rulerDir) {
|
|
24835
|
-
const configPath = (0,
|
|
25136
|
+
const configPath = (0, import_path26.join)((0, import_path26.dirname)(rulerDir), "ruler.toml");
|
|
24836
25137
|
try {
|
|
24837
25138
|
await import_fs21.promises.access(configPath);
|
|
24838
25139
|
console.log(source_default.dim("\u2139 ruler.toml already exists (not modified)"));
|
|
@@ -24896,7 +25197,7 @@ async function handleExport(options) {
|
|
|
24896
25197
|
}
|
|
24897
25198
|
}
|
|
24898
25199
|
function createExportCommand() {
|
|
24899
|
-
const command = new
|
|
25200
|
+
const command = new import_commander31.Command("export");
|
|
24900
25201
|
command.description("Export installed packages to external tools").option("--to <tool>", "Export target (currently supports: ruler)", "ruler").option("-o, --output <dir>", "Custom output directory").option("-y, --yes", "Skip confirmation prompts").action(async (options) => {
|
|
24901
25202
|
try {
|
|
24902
25203
|
if (!options.to) {
|
|
@@ -24930,14 +25231,14 @@ init_telemetry();
|
|
|
24930
25231
|
init_errors();
|
|
24931
25232
|
function getVersion() {
|
|
24932
25233
|
try {
|
|
24933
|
-
const packageJsonPath = (0,
|
|
25234
|
+
const packageJsonPath = (0, import_path27.join)(__dirname, "../package.json");
|
|
24934
25235
|
const packageJson = JSON.parse((0, import_fs22.readFileSync)(packageJsonPath, "utf-8"));
|
|
24935
25236
|
return packageJson.version || "0.0.0";
|
|
24936
25237
|
} catch {
|
|
24937
25238
|
return "0.0.0";
|
|
24938
25239
|
}
|
|
24939
25240
|
}
|
|
24940
|
-
var program = new
|
|
25241
|
+
var program = new import_commander32.Command();
|
|
24941
25242
|
program.name("prpm").description("Prompt Package Manager - Install and manage prompt-based files").version(getVersion());
|
|
24942
25243
|
program.addCommand(createInitCommand());
|
|
24943
25244
|
program.addCommand(createCatalogCommand());
|
|
@@ -24945,6 +25246,7 @@ program.addCommand(createSearchCommand());
|
|
|
24945
25246
|
program.addCommand(createAISearchCommand());
|
|
24946
25247
|
program.addCommand(createInstallCommand());
|
|
24947
25248
|
program.addCommand(createInfoCommand());
|
|
25249
|
+
program.addCommand(createShowCommand());
|
|
24948
25250
|
program.addCommand(createTrendingCommand());
|
|
24949
25251
|
program.addCommand(createPopularCommand());
|
|
24950
25252
|
program.addCommand(createPublishCommand());
|