prpm 2.1.21 → 2.1.23
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 +1138 -288
- package/dist/schemas/amp-command.schema.json +37 -0
- package/dist/schemas/amp.schema.json +48 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -830,6 +830,8 @@ function normalizeFormat(sourceFormat) {
|
|
|
830
830
|
return "zed";
|
|
831
831
|
if (normalized.includes("mcp"))
|
|
832
832
|
return "mcp";
|
|
833
|
+
if (normalized.includes("amp"))
|
|
834
|
+
return "amp";
|
|
833
835
|
return "generic";
|
|
834
836
|
}
|
|
835
837
|
var CLI_SUPPORTED_FORMATS;
|
|
@@ -854,7 +856,8 @@ var init_taxonomy_utils = __esm({
|
|
|
854
856
|
"replit",
|
|
855
857
|
"zencoder",
|
|
856
858
|
"droid",
|
|
857
|
-
"codex"
|
|
859
|
+
"codex",
|
|
860
|
+
"amp"
|
|
858
861
|
];
|
|
859
862
|
}
|
|
860
863
|
});
|
|
@@ -1179,8 +1182,8 @@ function extractAtReferences(content) {
|
|
|
1179
1182
|
const refs = Array.from(matches, (m) => m[1]);
|
|
1180
1183
|
return [...new Set(refs)];
|
|
1181
1184
|
}
|
|
1182
|
-
function categorizeFile(
|
|
1183
|
-
const pathLower =
|
|
1185
|
+
function categorizeFile(path12) {
|
|
1186
|
+
const pathLower = path12.toLowerCase();
|
|
1184
1187
|
if (pathLower.includes("/patterns/") || pathLower.includes("/pattern/") || pathLower.startsWith("patterns/") || pathLower.startsWith("pattern/")) {
|
|
1185
1188
|
return "pattern";
|
|
1186
1189
|
}
|
|
@@ -1204,8 +1207,8 @@ function categorizeFile(path11) {
|
|
|
1204
1207
|
}
|
|
1205
1208
|
return "other";
|
|
1206
1209
|
}
|
|
1207
|
-
function detectContentType(
|
|
1208
|
-
const ext = (0, import_path5.extname)(
|
|
1210
|
+
function detectContentType(path12) {
|
|
1211
|
+
const ext = (0, import_path5.extname)(path12).toLowerCase();
|
|
1209
1212
|
const typeMap = {
|
|
1210
1213
|
".md": "text/markdown",
|
|
1211
1214
|
".txt": "text/plain",
|
|
@@ -1267,8 +1270,8 @@ function loadReferencedFiles(references, basePath) {
|
|
|
1267
1270
|
}
|
|
1268
1271
|
function extractDirectories(filePaths) {
|
|
1269
1272
|
const dirs = /* @__PURE__ */ new Set();
|
|
1270
|
-
for (const
|
|
1271
|
-
const dir = (0, import_path5.dirname)(
|
|
1273
|
+
for (const path12 of filePaths) {
|
|
1274
|
+
const dir = (0, import_path5.dirname)(path12);
|
|
1272
1275
|
if (dir && dir !== ".") {
|
|
1273
1276
|
dirs.add(dir);
|
|
1274
1277
|
const parts = dir.split("/");
|
|
@@ -8765,6 +8768,91 @@ var init_from_codex = __esm({
|
|
|
8765
8768
|
}
|
|
8766
8769
|
});
|
|
8767
8770
|
|
|
8771
|
+
// ../converters/dist/from-amp.js
|
|
8772
|
+
function parseFrontmatter9(content) {
|
|
8773
|
+
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
8774
|
+
if (!match) {
|
|
8775
|
+
return { frontmatter: {}, body: content };
|
|
8776
|
+
}
|
|
8777
|
+
const frontmatter = jsYaml.load(match[1]);
|
|
8778
|
+
const body = match[2];
|
|
8779
|
+
return { frontmatter, body };
|
|
8780
|
+
}
|
|
8781
|
+
function detectSubtype2(frontmatter) {
|
|
8782
|
+
if (frontmatter.name && frontmatter.description) {
|
|
8783
|
+
return "skill";
|
|
8784
|
+
}
|
|
8785
|
+
if (frontmatter.description && !frontmatter.name) {
|
|
8786
|
+
return "slash-command";
|
|
8787
|
+
}
|
|
8788
|
+
return "rule";
|
|
8789
|
+
}
|
|
8790
|
+
function fromAmp(content, metadata, subtypeHint) {
|
|
8791
|
+
const { frontmatter, body } = parseFrontmatter9(content);
|
|
8792
|
+
const fm = frontmatter;
|
|
8793
|
+
const sections = [];
|
|
8794
|
+
const detectedSubtype = subtypeHint || detectSubtype2(frontmatter);
|
|
8795
|
+
const metadataSection = {
|
|
8796
|
+
type: "metadata",
|
|
8797
|
+
data: {
|
|
8798
|
+
title: fm.name || metadata.name || metadata.id,
|
|
8799
|
+
description: fm.description || metadata.description || "",
|
|
8800
|
+
version: metadata.version || "1.0.0",
|
|
8801
|
+
author: metadata.author
|
|
8802
|
+
}
|
|
8803
|
+
};
|
|
8804
|
+
const skillFm = fm;
|
|
8805
|
+
const agentsFm = fm;
|
|
8806
|
+
if (detectedSubtype === "skill") {
|
|
8807
|
+
if (skillFm["argument-hint"] || skillFm["disable-model-invocation"] !== void 0) {
|
|
8808
|
+
metadataSection.data.amp = {
|
|
8809
|
+
argumentHint: skillFm["argument-hint"],
|
|
8810
|
+
disableModelInvocation: skillFm["disable-model-invocation"]
|
|
8811
|
+
};
|
|
8812
|
+
}
|
|
8813
|
+
} else if (agentsFm.globs) {
|
|
8814
|
+
const globs = Array.isArray(agentsFm.globs) ? agentsFm.globs : [agentsFm.globs];
|
|
8815
|
+
metadataSection.data.amp = {
|
|
8816
|
+
globs
|
|
8817
|
+
};
|
|
8818
|
+
}
|
|
8819
|
+
sections.push(metadataSection);
|
|
8820
|
+
if (body.trim()) {
|
|
8821
|
+
sections.push({
|
|
8822
|
+
type: "instructions",
|
|
8823
|
+
title: "Instructions",
|
|
8824
|
+
content: body.trim()
|
|
8825
|
+
});
|
|
8826
|
+
}
|
|
8827
|
+
const canonicalContent = {
|
|
8828
|
+
format: "canonical",
|
|
8829
|
+
version: "1.0",
|
|
8830
|
+
sections
|
|
8831
|
+
};
|
|
8832
|
+
const pkg = {
|
|
8833
|
+
...metadata,
|
|
8834
|
+
id: metadata.id,
|
|
8835
|
+
name: fm.name || metadata.name || metadata.id,
|
|
8836
|
+
version: metadata.version,
|
|
8837
|
+
author: metadata.author,
|
|
8838
|
+
description: metadata.description || fm.description || "",
|
|
8839
|
+
tags: metadata.tags || [],
|
|
8840
|
+
format: "amp",
|
|
8841
|
+
subtype: detectedSubtype,
|
|
8842
|
+
content: canonicalContent
|
|
8843
|
+
};
|
|
8844
|
+
setTaxonomy(pkg, "amp", detectedSubtype);
|
|
8845
|
+
return pkg;
|
|
8846
|
+
}
|
|
8847
|
+
var init_from_amp = __esm({
|
|
8848
|
+
"../converters/dist/from-amp.js"() {
|
|
8849
|
+
"use strict";
|
|
8850
|
+
init_cjs_shims();
|
|
8851
|
+
init_taxonomy_utils();
|
|
8852
|
+
init_js_yaml();
|
|
8853
|
+
}
|
|
8854
|
+
});
|
|
8855
|
+
|
|
8768
8856
|
// ../converters/dist/from-mcp-server.js
|
|
8769
8857
|
function fromMCPServer(mcpServerJson, metadata) {
|
|
8770
8858
|
var _a;
|
|
@@ -8892,6 +8980,8 @@ function loadSchema(format, subtype) {
|
|
|
8892
8980
|
"opencode:skill": "agent-skills.schema.json",
|
|
8893
8981
|
"codex:skill": "agent-skills.schema.json",
|
|
8894
8982
|
"gemini:extension": "gemini-extension.schema.json",
|
|
8983
|
+
"amp:skill": "agent-skills.schema.json",
|
|
8984
|
+
"amp:slash-command": "amp-command.schema.json",
|
|
8895
8985
|
"mcp:server": "mcp-server.schema.json"
|
|
8896
8986
|
};
|
|
8897
8987
|
schemaFilename = subtypeSchemaMap[cacheKey];
|
|
@@ -8913,6 +9003,7 @@ function loadSchema(format, subtype) {
|
|
|
8913
9003
|
"aider": "aider.schema.json",
|
|
8914
9004
|
"zencoder": "zencoder.schema.json",
|
|
8915
9005
|
"replit": "replit.schema.json",
|
|
9006
|
+
"amp": "amp.schema.json",
|
|
8916
9007
|
"canonical": "canonical.schema.json"
|
|
8917
9008
|
// generic and mcp don't have specific schemas, will use fallback
|
|
8918
9009
|
};
|
|
@@ -8953,11 +9044,11 @@ function validateFormat(format, data, subtype) {
|
|
|
8953
9044
|
const warnings = [];
|
|
8954
9045
|
if (!valid && validate.errors) {
|
|
8955
9046
|
for (const error of validate.errors) {
|
|
8956
|
-
const
|
|
9047
|
+
const path12 = error.instancePath || "/" + error.params.missingProperty || "/";
|
|
8957
9048
|
const message = error.message || "Validation error";
|
|
8958
9049
|
const validationError = {
|
|
8959
|
-
path:
|
|
8960
|
-
message: `${
|
|
9050
|
+
path: path12,
|
|
9051
|
+
message: `${path12}: ${message}`,
|
|
8961
9052
|
value: error.data
|
|
8962
9053
|
};
|
|
8963
9054
|
if (error.keyword === "deprecated") {
|
|
@@ -12811,6 +12902,130 @@ var init_to_codex = __esm({
|
|
|
12811
12902
|
}
|
|
12812
12903
|
});
|
|
12813
12904
|
|
|
12905
|
+
// ../converters/dist/to-amp.js
|
|
12906
|
+
function toAmp(pkg) {
|
|
12907
|
+
const warnings = [];
|
|
12908
|
+
let qualityScore = 100;
|
|
12909
|
+
try {
|
|
12910
|
+
const content = convertContent15(pkg, warnings);
|
|
12911
|
+
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
12912
|
+
if (lossyConversion) {
|
|
12913
|
+
qualityScore -= 10;
|
|
12914
|
+
}
|
|
12915
|
+
return {
|
|
12916
|
+
content,
|
|
12917
|
+
format: "amp",
|
|
12918
|
+
warnings: warnings.length > 0 ? warnings : void 0,
|
|
12919
|
+
lossyConversion,
|
|
12920
|
+
qualityScore
|
|
12921
|
+
};
|
|
12922
|
+
} catch (error) {
|
|
12923
|
+
warnings.push(`Conversion error: ${error instanceof Error ? error.message : String(error)}`);
|
|
12924
|
+
return {
|
|
12925
|
+
content: "",
|
|
12926
|
+
format: "amp",
|
|
12927
|
+
warnings,
|
|
12928
|
+
lossyConversion: true,
|
|
12929
|
+
qualityScore: 0
|
|
12930
|
+
};
|
|
12931
|
+
}
|
|
12932
|
+
}
|
|
12933
|
+
function convertContent15(pkg, warnings) {
|
|
12934
|
+
const lines = [];
|
|
12935
|
+
const metadata = pkg.content.sections.find((s) => s.type === "metadata");
|
|
12936
|
+
const frontmatter = {};
|
|
12937
|
+
const ampData = (metadata == null ? void 0 : metadata.type) === "metadata" ? metadata.data.amp : void 0;
|
|
12938
|
+
if (pkg.subtype === "skill") {
|
|
12939
|
+
const skillName = pkg.name || pkg.id;
|
|
12940
|
+
frontmatter.name = skillName.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
12941
|
+
if ((metadata == null ? void 0 : metadata.type) === "metadata" && metadata.data.description) {
|
|
12942
|
+
frontmatter.description = metadata.data.description;
|
|
12943
|
+
} else {
|
|
12944
|
+
frontmatter.description = pkg.description || "No description provided";
|
|
12945
|
+
warnings.push("REQUIRED description field missing, using package description");
|
|
12946
|
+
}
|
|
12947
|
+
if (ampData == null ? void 0 : ampData.argumentHint) {
|
|
12948
|
+
frontmatter["argument-hint"] = ampData.argumentHint;
|
|
12949
|
+
}
|
|
12950
|
+
if ((ampData == null ? void 0 : ampData.disableModelInvocation) !== void 0) {
|
|
12951
|
+
frontmatter["disable-model-invocation"] = ampData.disableModelInvocation;
|
|
12952
|
+
}
|
|
12953
|
+
} else if (pkg.subtype === "slash-command") {
|
|
12954
|
+
if ((metadata == null ? void 0 : metadata.type) === "metadata" && metadata.data.description) {
|
|
12955
|
+
frontmatter.description = metadata.data.description;
|
|
12956
|
+
}
|
|
12957
|
+
} else {
|
|
12958
|
+
if ((ampData == null ? void 0 : ampData.globs) && ampData.globs.length > 0) {
|
|
12959
|
+
frontmatter.globs = ampData.globs;
|
|
12960
|
+
}
|
|
12961
|
+
}
|
|
12962
|
+
const hasFrontmatter = Object.keys(frontmatter).length > 0;
|
|
12963
|
+
if (hasFrontmatter) {
|
|
12964
|
+
lines.push("---");
|
|
12965
|
+
lines.push(jsYaml.dump(frontmatter, { indent: 2, lineWidth: -1 }).trim());
|
|
12966
|
+
lines.push("---");
|
|
12967
|
+
lines.push("");
|
|
12968
|
+
}
|
|
12969
|
+
const contentSections = pkg.content.sections.filter((s) => s.type !== "metadata" && s.type !== "tools");
|
|
12970
|
+
for (const section of contentSections) {
|
|
12971
|
+
if (section.type === "persona") {
|
|
12972
|
+
if (section.data.role) {
|
|
12973
|
+
lines.push(`You are a ${section.data.role}.`);
|
|
12974
|
+
lines.push("");
|
|
12975
|
+
}
|
|
12976
|
+
} else if (section.type === "instructions") {
|
|
12977
|
+
if (section.title && section.title !== "Overview" && section.title !== "Instructions") {
|
|
12978
|
+
lines.push(`## ${section.title}`);
|
|
12979
|
+
lines.push("");
|
|
12980
|
+
}
|
|
12981
|
+
lines.push(section.content);
|
|
12982
|
+
lines.push("");
|
|
12983
|
+
} else if (section.type === "rules") {
|
|
12984
|
+
const rulesTitle = section.title || "Rules";
|
|
12985
|
+
lines.push(`## ${rulesTitle}`);
|
|
12986
|
+
lines.push("");
|
|
12987
|
+
for (const rule of section.items) {
|
|
12988
|
+
lines.push(`- ${rule.content}`);
|
|
12989
|
+
}
|
|
12990
|
+
lines.push("");
|
|
12991
|
+
} else if (section.type === "examples") {
|
|
12992
|
+
const examplesTitle = section.title || "Examples";
|
|
12993
|
+
lines.push(`## ${examplesTitle}`);
|
|
12994
|
+
lines.push("");
|
|
12995
|
+
for (const example of section.examples) {
|
|
12996
|
+
if (example.description) {
|
|
12997
|
+
lines.push(`### ${example.description}`);
|
|
12998
|
+
lines.push("");
|
|
12999
|
+
}
|
|
13000
|
+
const lang = example.language || "";
|
|
13001
|
+
lines.push("```" + lang);
|
|
13002
|
+
lines.push(example.code);
|
|
13003
|
+
lines.push("```");
|
|
13004
|
+
lines.push("");
|
|
13005
|
+
}
|
|
13006
|
+
} else if (section.type === "context") {
|
|
13007
|
+
const contextTitle = section.title || "Context";
|
|
13008
|
+
lines.push(`## ${contextTitle}`);
|
|
13009
|
+
lines.push("");
|
|
13010
|
+
lines.push(section.content);
|
|
13011
|
+
lines.push("");
|
|
13012
|
+
} else if (section.type === "hook" || section.type === "cursor-hook") {
|
|
13013
|
+
warnings.push(`Hook sections are not supported in Amp format`);
|
|
13014
|
+
} else if (section.type !== "custom" && section.type !== "file-reference") {
|
|
13015
|
+
const sectionType = section.type;
|
|
13016
|
+
warnings.push(`Section type '${sectionType}' may not be fully supported in Amp format`);
|
|
13017
|
+
}
|
|
13018
|
+
}
|
|
13019
|
+
return lines.join("\n").trim() + "\n";
|
|
13020
|
+
}
|
|
13021
|
+
var init_to_amp = __esm({
|
|
13022
|
+
"../converters/dist/to-amp.js"() {
|
|
13023
|
+
"use strict";
|
|
13024
|
+
init_cjs_shims();
|
|
13025
|
+
init_js_yaml();
|
|
13026
|
+
}
|
|
13027
|
+
});
|
|
13028
|
+
|
|
12814
13029
|
// ../converters/dist/to-mcp-server.js
|
|
12815
13030
|
function toMCPServer(pkg) {
|
|
12816
13031
|
var _a, _b;
|
|
@@ -13396,6 +13611,41 @@ var init_format_registry = __esm({
|
|
|
13396
13611
|
fileExtension: ".json"
|
|
13397
13612
|
}
|
|
13398
13613
|
}
|
|
13614
|
+
},
|
|
13615
|
+
amp: {
|
|
13616
|
+
name: "Amp",
|
|
13617
|
+
description: "Amp code editor skills, commands, and AGENTS.md",
|
|
13618
|
+
documentationUrl: "https://ampcode.com/manual",
|
|
13619
|
+
rootFiles: ["AGENTS.md", "AGENT.md", "CLAUDE.md"],
|
|
13620
|
+
defaultSubtype: "skill",
|
|
13621
|
+
subtypes: {
|
|
13622
|
+
skill: {
|
|
13623
|
+
directory: ".agents/skills",
|
|
13624
|
+
filePatterns: ["SKILL.md"],
|
|
13625
|
+
nested: true,
|
|
13626
|
+
nestedIndicator: "SKILL.md",
|
|
13627
|
+
usesPackageSubdirectory: true,
|
|
13628
|
+
fileExtension: ".md"
|
|
13629
|
+
},
|
|
13630
|
+
"slash-command": {
|
|
13631
|
+
directory: ".agents/commands",
|
|
13632
|
+
filePatterns: ["*.md"],
|
|
13633
|
+
fileExtension: ".md"
|
|
13634
|
+
},
|
|
13635
|
+
rule: {
|
|
13636
|
+
directory: ".",
|
|
13637
|
+
filePatterns: ["AGENTS.md"],
|
|
13638
|
+
fileExtension: ".md"
|
|
13639
|
+
},
|
|
13640
|
+
agent: {
|
|
13641
|
+
directory: ".openagents",
|
|
13642
|
+
filePatterns: ["AGENT.md"],
|
|
13643
|
+
nested: true,
|
|
13644
|
+
nestedIndicator: "AGENT.md",
|
|
13645
|
+
usesPackageSubdirectory: true,
|
|
13646
|
+
fileExtension: ".md"
|
|
13647
|
+
}
|
|
13648
|
+
}
|
|
13399
13649
|
}
|
|
13400
13650
|
}
|
|
13401
13651
|
};
|
|
@@ -13695,6 +13945,281 @@ var init_progressive_disclosure = __esm({
|
|
|
13695
13945
|
}
|
|
13696
13946
|
});
|
|
13697
13947
|
|
|
13948
|
+
// ../converters/dist/cross-converters/mcp-transformer.js
|
|
13949
|
+
function geminiToClaudeMCP(geminiServers) {
|
|
13950
|
+
const warnings = [];
|
|
13951
|
+
const servers = {};
|
|
13952
|
+
let lossless = true;
|
|
13953
|
+
for (const [name, config] of Object.entries(geminiServers)) {
|
|
13954
|
+
servers[name] = {
|
|
13955
|
+
command: config.command
|
|
13956
|
+
};
|
|
13957
|
+
if (config.args) {
|
|
13958
|
+
servers[name].args = [...config.args];
|
|
13959
|
+
}
|
|
13960
|
+
if (config.env) {
|
|
13961
|
+
servers[name].env = { ...config.env };
|
|
13962
|
+
const hasGeminiVars = Object.values(config.env).some((val) => typeof val === "string" && (val.includes("${extensionPath}") || val.includes("${home}")));
|
|
13963
|
+
if (hasGeminiVars) {
|
|
13964
|
+
warnings.push(`MCP server '${name}' uses Gemini variable substitutions (\${extensionPath}, \${home}). Claude uses different variable syntax - manual adjustment may be needed.`);
|
|
13965
|
+
lossless = false;
|
|
13966
|
+
}
|
|
13967
|
+
}
|
|
13968
|
+
if (config.disabled !== void 0) {
|
|
13969
|
+
servers[name].disabled = config.disabled;
|
|
13970
|
+
}
|
|
13971
|
+
}
|
|
13972
|
+
return {
|
|
13973
|
+
servers,
|
|
13974
|
+
warnings,
|
|
13975
|
+
lossless
|
|
13976
|
+
};
|
|
13977
|
+
}
|
|
13978
|
+
function claudeToGeminiMCP(claudeServers) {
|
|
13979
|
+
const warnings = [];
|
|
13980
|
+
const servers = {};
|
|
13981
|
+
let lossless = true;
|
|
13982
|
+
for (const [name, config] of Object.entries(claudeServers)) {
|
|
13983
|
+
servers[name] = {
|
|
13984
|
+
command: config.command
|
|
13985
|
+
};
|
|
13986
|
+
if (config.args) {
|
|
13987
|
+
servers[name].args = [...config.args];
|
|
13988
|
+
}
|
|
13989
|
+
if (config.env) {
|
|
13990
|
+
servers[name].env = { ...config.env };
|
|
13991
|
+
const hasClaudePatterns = Object.values(config.env).some((val) => val.includes("${CLAUDE_") || val.includes("%APPDATA%"));
|
|
13992
|
+
if (hasClaudePatterns) {
|
|
13993
|
+
warnings.push(`MCP server '${name}' uses Claude-specific patterns. Consider using Gemini variable syntax: \${extensionPath}, \${home}`);
|
|
13994
|
+
lossless = false;
|
|
13995
|
+
}
|
|
13996
|
+
}
|
|
13997
|
+
if (config.disabled !== void 0) {
|
|
13998
|
+
servers[name].disabled = config.disabled;
|
|
13999
|
+
}
|
|
14000
|
+
}
|
|
14001
|
+
return {
|
|
14002
|
+
servers,
|
|
14003
|
+
warnings,
|
|
14004
|
+
lossless
|
|
14005
|
+
};
|
|
14006
|
+
}
|
|
14007
|
+
function validateMCPServer(config) {
|
|
14008
|
+
const errors = [];
|
|
14009
|
+
if (!config.command) {
|
|
14010
|
+
errors.push("MCP server must have a command");
|
|
14011
|
+
}
|
|
14012
|
+
if (config.args && !Array.isArray(config.args)) {
|
|
14013
|
+
errors.push("MCP server args must be an array");
|
|
14014
|
+
}
|
|
14015
|
+
if (config.env !== void 0 && (typeof config.env !== "object" || config.env === null)) {
|
|
14016
|
+
errors.push("MCP server env must be an object");
|
|
14017
|
+
}
|
|
14018
|
+
if (config.disabled !== void 0 && typeof config.disabled !== "boolean") {
|
|
14019
|
+
errors.push("MCP server disabled must be a boolean");
|
|
14020
|
+
}
|
|
14021
|
+
return errors;
|
|
14022
|
+
}
|
|
14023
|
+
function mergeMCPServers(...serverSets) {
|
|
14024
|
+
const warnings = [];
|
|
14025
|
+
const servers = {};
|
|
14026
|
+
let lossless = true;
|
|
14027
|
+
for (const serverSet of serverSets) {
|
|
14028
|
+
for (const [name, config] of Object.entries(serverSet)) {
|
|
14029
|
+
if (servers[name]) {
|
|
14030
|
+
warnings.push(`MCP server '${name}' defined multiple times. Using latest definition.`);
|
|
14031
|
+
lossless = false;
|
|
14032
|
+
}
|
|
14033
|
+
servers[name] = { ...config };
|
|
14034
|
+
}
|
|
14035
|
+
}
|
|
14036
|
+
return {
|
|
14037
|
+
servers,
|
|
14038
|
+
warnings,
|
|
14039
|
+
lossless
|
|
14040
|
+
};
|
|
14041
|
+
}
|
|
14042
|
+
function kiroToClaudeMCP(kiroServers) {
|
|
14043
|
+
const warnings = [];
|
|
14044
|
+
const servers = {};
|
|
14045
|
+
let lossless = true;
|
|
14046
|
+
for (const [name, config] of Object.entries(kiroServers)) {
|
|
14047
|
+
servers[name] = {
|
|
14048
|
+
command: config.command
|
|
14049
|
+
};
|
|
14050
|
+
if (config.args) {
|
|
14051
|
+
servers[name].args = [...config.args];
|
|
14052
|
+
}
|
|
14053
|
+
if (config.env) {
|
|
14054
|
+
servers[name].env = { ...config.env };
|
|
14055
|
+
}
|
|
14056
|
+
if (config.disabled !== void 0) {
|
|
14057
|
+
servers[name].disabled = config.disabled;
|
|
14058
|
+
}
|
|
14059
|
+
if (config.timeout !== void 0) {
|
|
14060
|
+
warnings.push(`MCP server '${name}' has timeout=${config.timeout}ms which is not supported in Claude format. This field will be lost.`);
|
|
14061
|
+
lossless = false;
|
|
14062
|
+
}
|
|
14063
|
+
}
|
|
14064
|
+
return {
|
|
14065
|
+
servers,
|
|
14066
|
+
warnings,
|
|
14067
|
+
lossless
|
|
14068
|
+
};
|
|
14069
|
+
}
|
|
14070
|
+
function claudeToKiroMCP(claudeServers) {
|
|
14071
|
+
const warnings = [];
|
|
14072
|
+
const servers = {};
|
|
14073
|
+
let lossless = true;
|
|
14074
|
+
for (const [name, config] of Object.entries(claudeServers)) {
|
|
14075
|
+
servers[name] = {
|
|
14076
|
+
command: config.command
|
|
14077
|
+
};
|
|
14078
|
+
if (config.args) {
|
|
14079
|
+
servers[name].args = [...config.args];
|
|
14080
|
+
}
|
|
14081
|
+
if (config.env) {
|
|
14082
|
+
servers[name].env = { ...config.env };
|
|
14083
|
+
}
|
|
14084
|
+
if (config.disabled !== void 0) {
|
|
14085
|
+
servers[name].disabled = config.disabled;
|
|
14086
|
+
}
|
|
14087
|
+
}
|
|
14088
|
+
return {
|
|
14089
|
+
servers,
|
|
14090
|
+
warnings,
|
|
14091
|
+
lossless
|
|
14092
|
+
};
|
|
14093
|
+
}
|
|
14094
|
+
function kiroToGeminiMCP(kiroServers) {
|
|
14095
|
+
const warnings = [];
|
|
14096
|
+
const servers = {};
|
|
14097
|
+
let lossless = true;
|
|
14098
|
+
for (const [name, config] of Object.entries(kiroServers)) {
|
|
14099
|
+
servers[name] = {
|
|
14100
|
+
command: config.command
|
|
14101
|
+
};
|
|
14102
|
+
if (config.args) {
|
|
14103
|
+
servers[name].args = [...config.args];
|
|
14104
|
+
}
|
|
14105
|
+
if (config.env) {
|
|
14106
|
+
servers[name].env = { ...config.env };
|
|
14107
|
+
}
|
|
14108
|
+
if (config.disabled !== void 0) {
|
|
14109
|
+
servers[name].disabled = config.disabled;
|
|
14110
|
+
}
|
|
14111
|
+
if (config.timeout !== void 0) {
|
|
14112
|
+
warnings.push(`MCP server '${name}' has timeout=${config.timeout}ms which is not supported in Gemini format. This field will be lost.`);
|
|
14113
|
+
lossless = false;
|
|
14114
|
+
}
|
|
14115
|
+
}
|
|
14116
|
+
return {
|
|
14117
|
+
servers,
|
|
14118
|
+
warnings,
|
|
14119
|
+
lossless
|
|
14120
|
+
};
|
|
14121
|
+
}
|
|
14122
|
+
function geminiToKiroMCP(geminiServers) {
|
|
14123
|
+
const warnings = [];
|
|
14124
|
+
const servers = {};
|
|
14125
|
+
let lossless = true;
|
|
14126
|
+
for (const [name, config] of Object.entries(geminiServers)) {
|
|
14127
|
+
servers[name] = {
|
|
14128
|
+
command: config.command
|
|
14129
|
+
};
|
|
14130
|
+
if (config.args) {
|
|
14131
|
+
servers[name].args = [...config.args];
|
|
14132
|
+
}
|
|
14133
|
+
if (config.env) {
|
|
14134
|
+
servers[name].env = { ...config.env };
|
|
14135
|
+
const hasGeminiVars = Object.values(config.env).some((val) => typeof val === "string" && (val.includes("${extensionPath}") || val.includes("${home}")));
|
|
14136
|
+
if (hasGeminiVars) {
|
|
14137
|
+
warnings.push(`MCP server '${name}' uses Gemini variable substitutions (\${extensionPath}, \${home}). These may need manual adjustment for Kiro.`);
|
|
14138
|
+
lossless = false;
|
|
14139
|
+
}
|
|
14140
|
+
}
|
|
14141
|
+
if (config.disabled !== void 0) {
|
|
14142
|
+
servers[name].disabled = config.disabled;
|
|
14143
|
+
}
|
|
14144
|
+
}
|
|
14145
|
+
return {
|
|
14146
|
+
servers,
|
|
14147
|
+
warnings,
|
|
14148
|
+
lossless
|
|
14149
|
+
};
|
|
14150
|
+
}
|
|
14151
|
+
function translateEnvVar(envValue, direction) {
|
|
14152
|
+
let translated = false;
|
|
14153
|
+
let value = envValue;
|
|
14154
|
+
const mappings = ENV_VAR_MAPPINGS[direction];
|
|
14155
|
+
if (mappings) {
|
|
14156
|
+
for (const [from, to] of Object.entries(mappings)) {
|
|
14157
|
+
if (value.includes(from)) {
|
|
14158
|
+
value = value.replace(new RegExp(from.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), to);
|
|
14159
|
+
translated = true;
|
|
14160
|
+
}
|
|
14161
|
+
}
|
|
14162
|
+
}
|
|
14163
|
+
return { value, translated };
|
|
14164
|
+
}
|
|
14165
|
+
function translateMCPServerEnv(config, direction) {
|
|
14166
|
+
const warnings = [];
|
|
14167
|
+
if (!config.env) {
|
|
14168
|
+
return { config, warnings };
|
|
14169
|
+
}
|
|
14170
|
+
const translatedEnv = {};
|
|
14171
|
+
let anyTranslated = false;
|
|
14172
|
+
for (const [key, value] of Object.entries(config.env)) {
|
|
14173
|
+
const { value: translatedValue, translated } = translateEnvVar(value, direction);
|
|
14174
|
+
translatedEnv[key] = translatedValue;
|
|
14175
|
+
if (translated) {
|
|
14176
|
+
anyTranslated = true;
|
|
14177
|
+
}
|
|
14178
|
+
}
|
|
14179
|
+
if (anyTranslated) {
|
|
14180
|
+
warnings.push(`Environment variables were automatically translated for target format`);
|
|
14181
|
+
}
|
|
14182
|
+
return {
|
|
14183
|
+
config: { ...config, env: translatedEnv },
|
|
14184
|
+
warnings
|
|
14185
|
+
};
|
|
14186
|
+
}
|
|
14187
|
+
var ENV_VAR_MAPPINGS;
|
|
14188
|
+
var init_mcp_transformer = __esm({
|
|
14189
|
+
"../converters/dist/cross-converters/mcp-transformer.js"() {
|
|
14190
|
+
"use strict";
|
|
14191
|
+
init_cjs_shims();
|
|
14192
|
+
ENV_VAR_MAPPINGS = {
|
|
14193
|
+
"gemini-to-claude": {
|
|
14194
|
+
"${extensionPath}": "${CLAUDE_EXTENSIONS_PATH}",
|
|
14195
|
+
"${home}": "${HOME}"
|
|
14196
|
+
},
|
|
14197
|
+
"claude-to-gemini": {
|
|
14198
|
+
"${CLAUDE_EXTENSIONS_PATH}": "${extensionPath}",
|
|
14199
|
+
"${HOME}": "${home}",
|
|
14200
|
+
"%APPDATA%": "${home}"
|
|
14201
|
+
},
|
|
14202
|
+
// Kiro uses standard env vars similar to Claude
|
|
14203
|
+
"gemini-to-kiro": {
|
|
14204
|
+
"${extensionPath}": "${KIRO_EXTENSIONS_PATH}",
|
|
14205
|
+
"${home}": "${HOME}"
|
|
14206
|
+
},
|
|
14207
|
+
"kiro-to-gemini": {
|
|
14208
|
+
"${KIRO_EXTENSIONS_PATH}": "${extensionPath}",
|
|
14209
|
+
"${HOME}": "${home}",
|
|
14210
|
+
"%APPDATA%": "${home}"
|
|
14211
|
+
},
|
|
14212
|
+
// Claude and Kiro use similar env var conventions, minimal translation needed
|
|
14213
|
+
"kiro-to-claude": {
|
|
14214
|
+
"${KIRO_EXTENSIONS_PATH}": "${CLAUDE_EXTENSIONS_PATH}"
|
|
14215
|
+
},
|
|
14216
|
+
"claude-to-kiro": {
|
|
14217
|
+
"${CLAUDE_EXTENSIONS_PATH}": "${KIRO_EXTENSIONS_PATH}"
|
|
14218
|
+
}
|
|
14219
|
+
};
|
|
14220
|
+
}
|
|
14221
|
+
});
|
|
14222
|
+
|
|
13698
14223
|
// ../converters/dist/index.js
|
|
13699
14224
|
var dist_exports = {};
|
|
13700
14225
|
__export(dist_exports, {
|
|
@@ -13719,6 +14244,8 @@ __export(dist_exports, {
|
|
|
13719
14244
|
claudeSchema: () => claudeSchema,
|
|
13720
14245
|
claudeSkillSchema: () => claudeSkillSchema,
|
|
13721
14246
|
claudeSlashCommandSchema: () => claudeSlashCommandSchema,
|
|
14247
|
+
claudeToGeminiMCP: () => claudeToGeminiMCP,
|
|
14248
|
+
claudeToKiroMCP: () => claudeToKiroMCP,
|
|
13722
14249
|
codexSkillSchema: () => codexSkillSchema,
|
|
13723
14250
|
continueSchema: () => continueSchema,
|
|
13724
14251
|
copilotSchema: () => copilotSchema,
|
|
@@ -13741,6 +14268,7 @@ __export(dist_exports, {
|
|
|
13741
14268
|
formatValidationErrors: () => formatValidationErrors,
|
|
13742
14269
|
fromAgentsMd: () => fromAgentsMd,
|
|
13743
14270
|
fromAider: () => fromAider,
|
|
14271
|
+
fromAmp: () => fromAmp,
|
|
13744
14272
|
fromClaude: () => fromClaude,
|
|
13745
14273
|
fromClaudePlugin: () => fromClaudePlugin,
|
|
13746
14274
|
fromCodex: () => fromCodex,
|
|
@@ -13763,6 +14291,8 @@ __export(dist_exports, {
|
|
|
13763
14291
|
fromZencoder: () => fromZencoder,
|
|
13764
14292
|
geminiMdSchema: () => geminiMdSchema,
|
|
13765
14293
|
geminiSchema: () => geminiSchema,
|
|
14294
|
+
geminiToClaudeMCP: () => geminiToClaudeMCP,
|
|
14295
|
+
geminiToKiroMCP: () => geminiToKiroMCP,
|
|
13766
14296
|
generateCodexFilename: () => generateFilename2,
|
|
13767
14297
|
generateMCPServerPackage: () => generateMCPServerPackage,
|
|
13768
14298
|
generatePluginJson: () => generatePluginJson,
|
|
@@ -13811,8 +14341,11 @@ __export(dist_exports, {
|
|
|
13811
14341
|
kiroAgentSchema: () => kiroAgentSchema,
|
|
13812
14342
|
kiroHookSchema: () => kiroHookSchema,
|
|
13813
14343
|
kiroSteeringSchema: () => kiroSteeringSchema,
|
|
14344
|
+
kiroToClaudeMCP: () => kiroToClaudeMCP,
|
|
14345
|
+
kiroToGeminiMCP: () => kiroToGeminiMCP,
|
|
13814
14346
|
mapHook: () => mapHook,
|
|
13815
14347
|
mapHooks: () => mapHooks,
|
|
14348
|
+
mergeMCPServerConfigs: () => mergeMCPServers,
|
|
13816
14349
|
normalizeFormat: () => normalizeFormat,
|
|
13817
14350
|
opencodeSchema: () => opencodeSchema,
|
|
13818
14351
|
opencodeSlashCommandSchema: () => opencodeSlashCommandSchema,
|
|
@@ -13826,6 +14359,7 @@ __export(dist_exports, {
|
|
|
13826
14359
|
supportsAgentsMd: () => supportsAgentsMd,
|
|
13827
14360
|
toAgentsMd: () => toAgentsMd,
|
|
13828
14361
|
toAider: () => toAider,
|
|
14362
|
+
toAmp: () => toAmp,
|
|
13829
14363
|
toClaude: () => toClaude,
|
|
13830
14364
|
toClaudeMd: () => toClaudeMd,
|
|
13831
14365
|
toClaudePlugin: () => toClaudePlugin,
|
|
@@ -13848,8 +14382,11 @@ __export(dist_exports, {
|
|
|
13848
14382
|
toZed: () => toZed,
|
|
13849
14383
|
toZencoder: () => toZencoder,
|
|
13850
14384
|
traeSchema: () => traeSchema,
|
|
14385
|
+
translateEnvVar: () => translateEnvVar,
|
|
14386
|
+
translateMCPServerEnv: () => translateMCPServerEnv,
|
|
13851
14387
|
validateConversion: () => validateConversion,
|
|
13852
14388
|
validateFormat: () => validateFormat,
|
|
14389
|
+
validateMCPServer: () => validateMCPServer,
|
|
13853
14390
|
validateMarkdown: () => validateMarkdown,
|
|
13854
14391
|
windsurfSchema: () => windsurfSchema,
|
|
13855
14392
|
zedSchema: () => zedSchema,
|
|
@@ -13883,6 +14420,7 @@ var init_dist = __esm({
|
|
|
13883
14420
|
init_from_replit();
|
|
13884
14421
|
init_from_zed();
|
|
13885
14422
|
init_from_codex();
|
|
14423
|
+
init_from_amp();
|
|
13886
14424
|
init_from_mcp_server();
|
|
13887
14425
|
init_to_cursor();
|
|
13888
14426
|
init_to_cursor_hooks();
|
|
@@ -13905,12 +14443,14 @@ var init_dist = __esm({
|
|
|
13905
14443
|
init_to_replit();
|
|
13906
14444
|
init_to_zed();
|
|
13907
14445
|
init_to_codex();
|
|
14446
|
+
init_to_amp();
|
|
13908
14447
|
init_to_mcp_server();
|
|
13909
14448
|
init_taxonomy_utils();
|
|
13910
14449
|
init_validation();
|
|
13911
14450
|
init_schema_files();
|
|
13912
14451
|
init_format_registry2();
|
|
13913
14452
|
init_progressive_disclosure();
|
|
14453
|
+
init_mcp_transformer();
|
|
13914
14454
|
}
|
|
13915
14455
|
});
|
|
13916
14456
|
|
|
@@ -14415,7 +14955,7 @@ function writeMCPConfig(configPath, config) {
|
|
|
14415
14955
|
}
|
|
14416
14956
|
(0, import_fs10.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
14417
14957
|
}
|
|
14418
|
-
function
|
|
14958
|
+
function mergeMCPServers2(servers, global2 = false, projectDir = process.cwd()) {
|
|
14419
14959
|
const result = {
|
|
14420
14960
|
added: [],
|
|
14421
14961
|
skipped: [],
|
|
@@ -15214,7 +15754,7 @@ async function handleCollectionsSearch(query, options) {
|
|
|
15214
15754
|
const startTime = Date.now();
|
|
15215
15755
|
try {
|
|
15216
15756
|
const config = await getConfig();
|
|
15217
|
-
const client = (0,
|
|
15757
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15218
15758
|
console.log(`\u{1F50D} Searching collections for "${query}"...
|
|
15219
15759
|
`);
|
|
15220
15760
|
const result = await client.getCollections({
|
|
@@ -15307,7 +15847,7 @@ async function handleCollectionsList(options) {
|
|
|
15307
15847
|
const startTime = Date.now();
|
|
15308
15848
|
try {
|
|
15309
15849
|
const config = await getConfig();
|
|
15310
|
-
const client = (0,
|
|
15850
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15311
15851
|
console.log("\u{1F4E6} Searching collections...\n");
|
|
15312
15852
|
const result = await client.getCollections({
|
|
15313
15853
|
category: options.category,
|
|
@@ -15408,7 +15948,7 @@ async function handleCollectionInfo(collectionSpec) {
|
|
|
15408
15948
|
}
|
|
15409
15949
|
[, name_slug, version] = match;
|
|
15410
15950
|
const config = await getConfig();
|
|
15411
|
-
const client = (0,
|
|
15951
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15412
15952
|
console.log(`\u{1F4E6} Loading collection: ${name_slug}...
|
|
15413
15953
|
`);
|
|
15414
15954
|
const collection = await client.getCollection(name_slug, version);
|
|
@@ -15499,14 +16039,14 @@ async function handleCollectionPublish(manifestPath = "./collection.json") {
|
|
|
15499
16039
|
const startTime = Date.now();
|
|
15500
16040
|
try {
|
|
15501
16041
|
const config = await getConfig();
|
|
15502
|
-
const client = (0,
|
|
16042
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15503
16043
|
if (!config.token) {
|
|
15504
16044
|
console.error("\n\u274C Authentication required. Run `prpm login` first.\n");
|
|
15505
16045
|
throw new CLIError("\n\u274C Authentication required. Run `prpm login` first.", 1);
|
|
15506
16046
|
}
|
|
15507
16047
|
console.log("\u{1F4E6} Publishing collection...\n");
|
|
15508
|
-
const
|
|
15509
|
-
const manifestContent = await
|
|
16048
|
+
const fs16 = await import("fs/promises");
|
|
16049
|
+
const manifestContent = await fs16.readFile(manifestPath, "utf-8");
|
|
15510
16050
|
const manifest = JSON.parse(manifestContent);
|
|
15511
16051
|
const required = ["id", "name", "description", "packages"];
|
|
15512
16052
|
const missing = required.filter((field) => !manifest[field]);
|
|
@@ -15602,7 +16142,7 @@ async function handleCollectionDeprecate(collectionSpec, options) {
|
|
|
15602
16142
|
console.error("\n\u274C Authentication required. Run `prpm login` first.\n");
|
|
15603
16143
|
throw new CLIError("Authentication required. Run `prpm login` first.", 1);
|
|
15604
16144
|
}
|
|
15605
|
-
const client = (0,
|
|
16145
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15606
16146
|
const action = options.undo ? "Undeprecating" : "Deprecating";
|
|
15607
16147
|
console.log(`\u26A0\uFE0F ${action} collection: ${name_slug}...
|
|
15608
16148
|
`);
|
|
@@ -15663,7 +16203,7 @@ async function handleCollectionInstall(collectionSpec, options) {
|
|
|
15663
16203
|
}
|
|
15664
16204
|
[, name_slug, version] = match;
|
|
15665
16205
|
const config = await getConfig();
|
|
15666
|
-
const client = (0,
|
|
16206
|
+
const client = (0, import_registry_client5.getRegistryClient)(config);
|
|
15667
16207
|
console.log(`\u{1F4E6} Installing collection: ${name_slug}...
|
|
15668
16208
|
`);
|
|
15669
16209
|
const installResult = await client.installCollection({
|
|
@@ -15776,7 +16316,7 @@ async function handleCollectionInstall(collectionSpec, options) {
|
|
|
15776
16316
|
}
|
|
15777
16317
|
}
|
|
15778
16318
|
function createCollectionsCommand() {
|
|
15779
|
-
const command = new
|
|
16319
|
+
const command = new import_commander11.Command("collections");
|
|
15780
16320
|
command.description("Manage package collections").alias("collection").action(async (options) => {
|
|
15781
16321
|
await handleCollectionsList(options);
|
|
15782
16322
|
});
|
|
@@ -15798,13 +16338,13 @@ function createCollectionsCommand() {
|
|
|
15798
16338
|
});
|
|
15799
16339
|
return command;
|
|
15800
16340
|
}
|
|
15801
|
-
var
|
|
16341
|
+
var import_commander11, import_registry_client5;
|
|
15802
16342
|
var init_collections = __esm({
|
|
15803
16343
|
"src/commands/collections.ts"() {
|
|
15804
16344
|
"use strict";
|
|
15805
16345
|
init_cjs_shims();
|
|
15806
|
-
|
|
15807
|
-
|
|
16346
|
+
import_commander11 = require("commander");
|
|
16347
|
+
import_registry_client5 = require("@pr-pm/registry-client");
|
|
15808
16348
|
init_user_config();
|
|
15809
16349
|
init_install();
|
|
15810
16350
|
init_telemetry();
|
|
@@ -16001,6 +16541,7 @@ function getPackageIcon2(format, subtype) {
|
|
|
16001
16541
|
"replit": "\u{1F52E}",
|
|
16002
16542
|
"zed": "\u26A1",
|
|
16003
16543
|
"codex": "\u{1F9E0}",
|
|
16544
|
+
"amp": "\u26A1",
|
|
16004
16545
|
"mcp": "\u{1F517}",
|
|
16005
16546
|
"agents.md": "\u{1F4DD}",
|
|
16006
16547
|
"ruler": "\u{1F4CF}",
|
|
@@ -16028,6 +16569,7 @@ function getPackageLabel2(format, subtype) {
|
|
|
16028
16569
|
"replit": "Replit",
|
|
16029
16570
|
"zed": "Zed",
|
|
16030
16571
|
"codex": "Codex",
|
|
16572
|
+
"amp": "Amp",
|
|
16031
16573
|
"mcp": "MCP",
|
|
16032
16574
|
"agents.md": "Agents.md",
|
|
16033
16575
|
"ruler": "Ruler",
|
|
@@ -16061,7 +16603,7 @@ function findMainFile(files, format, subtype) {
|
|
|
16061
16603
|
const nestedIndicator = getNestedIndicator(format, subtype);
|
|
16062
16604
|
if (nestedIndicator) {
|
|
16063
16605
|
const match = files.find((f) => {
|
|
16064
|
-
const filename =
|
|
16606
|
+
const filename = import_path15.default.basename(f.name);
|
|
16065
16607
|
return filename.toLowerCase() === nestedIndicator.toLowerCase();
|
|
16066
16608
|
});
|
|
16067
16609
|
if (match) return match;
|
|
@@ -16070,7 +16612,7 @@ function findMainFile(files, format, subtype) {
|
|
|
16070
16612
|
if (filePatterns) {
|
|
16071
16613
|
for (const pattern of filePatterns) {
|
|
16072
16614
|
for (const file of files) {
|
|
16073
|
-
const filename =
|
|
16615
|
+
const filename = import_path15.default.basename(file.name);
|
|
16074
16616
|
if (pattern.startsWith("*")) {
|
|
16075
16617
|
const extension = pattern.slice(1);
|
|
16076
16618
|
if (filename.endsWith(extension)) {
|
|
@@ -16101,7 +16643,7 @@ function findMainFile(files, format, subtype) {
|
|
|
16101
16643
|
];
|
|
16102
16644
|
for (const pattern of fallbackPatterns) {
|
|
16103
16645
|
for (const file of files) {
|
|
16104
|
-
const filename =
|
|
16646
|
+
const filename = import_path15.default.basename(file.name);
|
|
16105
16647
|
if (filename.toLowerCase() === pattern.toLowerCase()) {
|
|
16106
16648
|
return file;
|
|
16107
16649
|
}
|
|
@@ -16182,10 +16724,10 @@ async function handleInstall(packageSpec, options) {
|
|
|
16182
16724
|
let isDifferentLocation = false;
|
|
16183
16725
|
if (requestedLocation && existingLocation) {
|
|
16184
16726
|
if (installedPkg.subtype === "snippet") {
|
|
16185
|
-
isDifferentLocation =
|
|
16727
|
+
isDifferentLocation = import_path15.default.resolve(requestedLocation) !== import_path15.default.resolve(existingLocation);
|
|
16186
16728
|
} else {
|
|
16187
|
-
const existingDir =
|
|
16188
|
-
isDifferentLocation =
|
|
16729
|
+
const existingDir = import_path15.default.dirname(existingLocation);
|
|
16730
|
+
isDifferentLocation = import_path15.default.resolve(requestedLocation) !== import_path15.default.resolve(existingDir);
|
|
16189
16731
|
}
|
|
16190
16732
|
}
|
|
16191
16733
|
if (!requestedVersion || requestedVersion === "latest" || requestedVersion === installedPkg.version) {
|
|
@@ -16222,7 +16764,7 @@ async function handleInstall(packageSpec, options) {
|
|
|
16222
16764
|
}
|
|
16223
16765
|
}
|
|
16224
16766
|
console.log(`\u{1F4E5} Installing ${packageId}@${version}...`);
|
|
16225
|
-
const client = (0,
|
|
16767
|
+
const client = (0, import_registry_client6.getRegistryClient)(config);
|
|
16226
16768
|
let isCollection = false;
|
|
16227
16769
|
try {
|
|
16228
16770
|
await client.getCollection(packageId, version === "latest" ? void 0 : version);
|
|
@@ -16534,9 +17076,9 @@ This could indicate:
|
|
|
16534
17076
|
(f) => f.name.startsWith("agents/") && f.name.endsWith(".md")
|
|
16535
17077
|
);
|
|
16536
17078
|
if (agentFiles.length > 0) {
|
|
16537
|
-
await
|
|
17079
|
+
await import_promises4.default.mkdir(".claude/agents", { recursive: true });
|
|
16538
17080
|
for (const file of agentFiles) {
|
|
16539
|
-
const filename =
|
|
17081
|
+
const filename = import_path15.default.basename(file.name);
|
|
16540
17082
|
const destFile = `.claude/agents/${filename}`;
|
|
16541
17083
|
await saveFile(destFile, file.content);
|
|
16542
17084
|
installedFiles.push(destFile);
|
|
@@ -16550,8 +17092,8 @@ This could indicate:
|
|
|
16550
17092
|
for (const file of skillFiles) {
|
|
16551
17093
|
const relativePath = file.name.replace(/^skills\//, "");
|
|
16552
17094
|
const destFile = `.claude/skills/${relativePath}`;
|
|
16553
|
-
const destFileDir =
|
|
16554
|
-
await
|
|
17095
|
+
const destFileDir = import_path15.default.dirname(destFile);
|
|
17096
|
+
await import_promises4.default.mkdir(destFileDir, { recursive: true });
|
|
16555
17097
|
await saveFile(destFile, file.content);
|
|
16556
17098
|
installedFiles.push(destFile);
|
|
16557
17099
|
}
|
|
@@ -16561,9 +17103,9 @@ This could indicate:
|
|
|
16561
17103
|
(f) => f.name.startsWith("commands/") && f.name.endsWith(".md")
|
|
16562
17104
|
);
|
|
16563
17105
|
if (commandFiles.length > 0) {
|
|
16564
|
-
await
|
|
17106
|
+
await import_promises4.default.mkdir(".claude/commands", { recursive: true });
|
|
16565
17107
|
for (const file of commandFiles) {
|
|
16566
|
-
const filename =
|
|
17108
|
+
const filename = import_path15.default.basename(file.name);
|
|
16567
17109
|
const destFile = `.claude/commands/${filename}`;
|
|
16568
17110
|
await saveFile(destFile, file.content);
|
|
16569
17111
|
installedFiles.push(destFile);
|
|
@@ -16571,7 +17113,7 @@ This could indicate:
|
|
|
16571
17113
|
console.log(` \u2713 Installed ${commandFiles.length} commands to .claude/commands/`);
|
|
16572
17114
|
}
|
|
16573
17115
|
if (pluginConfig.mcpServers && Object.keys(pluginConfig.mcpServers).length > 0) {
|
|
16574
|
-
const mcpResult =
|
|
17116
|
+
const mcpResult = mergeMCPServers2(
|
|
16575
17117
|
pluginConfig.mcpServers,
|
|
16576
17118
|
options.global || false,
|
|
16577
17119
|
process.cwd()
|
|
@@ -16608,7 +17150,7 @@ This could indicate:
|
|
|
16608
17150
|
} catch (error2) {
|
|
16609
17151
|
throw new Error(`Failed to parse MCP server config: ${error2 instanceof Error ? error2.message : error2}`);
|
|
16610
17152
|
}
|
|
16611
|
-
const mcpResult =
|
|
17153
|
+
const mcpResult = mergeMCPServers2(mcpServerConfig.mcpServers, options.global || false);
|
|
16612
17154
|
if (mcpResult.added.length > 0) {
|
|
16613
17155
|
const location = options.global ? "~/.claude/settings.json" : ".mcp.json";
|
|
16614
17156
|
console.log(` \u2713 Added MCP servers to ${location}: ${mcpResult.added.join(", ")}`);
|
|
@@ -16674,7 +17216,7 @@ This could indicate:
|
|
|
16674
17216
|
destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
|
|
16675
17217
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
16676
17218
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
16677
|
-
destDir =
|
|
17219
|
+
destDir = import_path15.default.join(locationOverride, relativeDestDir);
|
|
16678
17220
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
16679
17221
|
}
|
|
16680
17222
|
let mainFile = extractedFiles[0].content;
|
|
@@ -16705,7 +17247,7 @@ This could indicate:
|
|
|
16705
17247
|
const manifestFilename = getManifestFilename(effectiveFormat);
|
|
16706
17248
|
let targetPath = manifestFilename;
|
|
16707
17249
|
if (locationOverride) {
|
|
16708
|
-
targetPath =
|
|
17250
|
+
targetPath = import_path15.default.join(locationOverride, `${manifestFilename.replace(".md", ".override.md")}`);
|
|
16709
17251
|
console.log(` \u{1F4C1} Installing to custom location: ${targetPath}`);
|
|
16710
17252
|
}
|
|
16711
17253
|
destPath = targetPath;
|
|
@@ -16799,7 +17341,7 @@ This could indicate:
|
|
|
16799
17341
|
let existingSettings = { hooks: {} };
|
|
16800
17342
|
if (await fileExists(destPath)) {
|
|
16801
17343
|
try {
|
|
16802
|
-
const existingContent = await
|
|
17344
|
+
const existingContent = await import_promises4.default.readFile(destPath, "utf-8");
|
|
16803
17345
|
existingSettings = JSON.parse(existingContent);
|
|
16804
17346
|
if (!existingSettings.hooks) {
|
|
16805
17347
|
existingSettings.hooks = {};
|
|
@@ -16853,7 +17395,7 @@ This could indicate:
|
|
|
16853
17395
|
}
|
|
16854
17396
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
16855
17397
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
16856
|
-
destDir =
|
|
17398
|
+
destDir = import_path15.default.join(locationOverride, relativeDestDir);
|
|
16857
17399
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
16858
17400
|
}
|
|
16859
17401
|
const isCursorConversion = effectiveFormat === "cursor" && pkg.format === "claude" && pkg.subtype === "skill";
|
|
@@ -16920,7 +17462,7 @@ This could indicate:
|
|
|
16920
17462
|
}
|
|
16921
17463
|
if (isCursorConversion && jsonFiles.length > 0) {
|
|
16922
17464
|
const mdcFile = `${packageDir}/${packageName}.mdc`;
|
|
16923
|
-
let mdcContent = await
|
|
17465
|
+
let mdcContent = await import_promises4.default.readFile(mdcFile, "utf-8");
|
|
16924
17466
|
const frontmatterMatch = mdcContent.match(/^---\n[\s\S]*?\n---\n/);
|
|
16925
17467
|
if (frontmatterMatch) {
|
|
16926
17468
|
const frontmatterEnd = frontmatterMatch[0].length;
|
|
@@ -17074,12 +17616,12 @@ ${afterFrontmatter}`;
|
|
|
17074
17616
|
await telemetry.shutdown();
|
|
17075
17617
|
}
|
|
17076
17618
|
}
|
|
17077
|
-
function
|
|
17078
|
-
const resolvedPath =
|
|
17079
|
-
const resolvedTarget =
|
|
17080
|
-
return resolvedPath.startsWith(resolvedTarget +
|
|
17619
|
+
function isPathSafe2(targetDir, filePath) {
|
|
17620
|
+
const resolvedPath = import_path15.default.resolve(targetDir, filePath);
|
|
17621
|
+
const resolvedTarget = import_path15.default.resolve(targetDir);
|
|
17622
|
+
return resolvedPath.startsWith(resolvedTarget + import_path15.default.sep) || resolvedPath === resolvedTarget;
|
|
17081
17623
|
}
|
|
17082
|
-
function
|
|
17624
|
+
function hasUnsafePathPatterns2(filePath) {
|
|
17083
17625
|
if (filePath.includes("..")) return true;
|
|
17084
17626
|
if (filePath.startsWith("/")) return true;
|
|
17085
17627
|
if (/^[a-zA-Z]:/.test(filePath)) return true;
|
|
@@ -17090,7 +17632,7 @@ async function extractTarball(tarball, packageId) {
|
|
|
17090
17632
|
let decompressed;
|
|
17091
17633
|
try {
|
|
17092
17634
|
decompressed = await new Promise((resolve3, reject) => {
|
|
17093
|
-
|
|
17635
|
+
import_zlib2.default.gunzip(tarball, (err, result) => {
|
|
17094
17636
|
if (err) {
|
|
17095
17637
|
reject(new Error(`Failed to decompress tarball: ${err.message}`));
|
|
17096
17638
|
return;
|
|
@@ -17101,10 +17643,10 @@ async function extractTarball(tarball, packageId) {
|
|
|
17101
17643
|
} catch (error) {
|
|
17102
17644
|
throw new CLIError(`Package decompression failed: ${error.message}`);
|
|
17103
17645
|
}
|
|
17104
|
-
const tmpDir = await
|
|
17646
|
+
const tmpDir = await import_promises4.default.mkdtemp(import_path15.default.join(import_os5.default.tmpdir(), "prpm-"));
|
|
17105
17647
|
const cleanup = async () => {
|
|
17106
17648
|
try {
|
|
17107
|
-
await
|
|
17649
|
+
await import_promises4.default.rm(tmpDir, { recursive: true, force: true });
|
|
17108
17650
|
} catch {
|
|
17109
17651
|
}
|
|
17110
17652
|
};
|
|
@@ -17118,7 +17660,7 @@ async function extractTarball(tarball, packageId) {
|
|
|
17118
17660
|
"LICENSE.md"
|
|
17119
17661
|
]);
|
|
17120
17662
|
try {
|
|
17121
|
-
const
|
|
17663
|
+
const extract3 = tar2.extract({
|
|
17122
17664
|
cwd: tmpDir,
|
|
17123
17665
|
strict: true,
|
|
17124
17666
|
// Enable strict mode to reject malformed archives
|
|
@@ -17133,19 +17675,19 @@ async function extractTarball(tarball, packageId) {
|
|
|
17133
17675
|
console.warn(` \u26A0\uFE0F Blocked symlink in package: ${entryPath}`);
|
|
17134
17676
|
return false;
|
|
17135
17677
|
}
|
|
17136
|
-
if (
|
|
17678
|
+
if (hasUnsafePathPatterns2(entryPath)) {
|
|
17137
17679
|
console.warn(` \u26A0\uFE0F Blocked unsafe path in package: ${entryPath}`);
|
|
17138
17680
|
return false;
|
|
17139
17681
|
}
|
|
17140
|
-
if (!
|
|
17682
|
+
if (!isPathSafe2(tmpDir, entryPath)) {
|
|
17141
17683
|
console.warn(` \u26A0\uFE0F Blocked path traversal attempt: ${entryPath}`);
|
|
17142
17684
|
return false;
|
|
17143
17685
|
}
|
|
17144
17686
|
return true;
|
|
17145
17687
|
}
|
|
17146
17688
|
});
|
|
17147
|
-
await (0,
|
|
17148
|
-
const extractedFiles = await collectExtractedFiles(tmpDir, excludedNames,
|
|
17689
|
+
await (0, import_promises3.pipeline)(import_stream2.Readable.from(decompressed), extract3);
|
|
17690
|
+
const extractedFiles = await collectExtractedFiles(tmpDir, excludedNames, import_promises4.default);
|
|
17149
17691
|
if (extractedFiles.length === 0) {
|
|
17150
17692
|
throw new CLIError("Package archive contains no valid files");
|
|
17151
17693
|
}
|
|
@@ -17163,15 +17705,15 @@ async function extractTarball(tarball, packageId) {
|
|
|
17163
17705
|
await cleanup();
|
|
17164
17706
|
}
|
|
17165
17707
|
}
|
|
17166
|
-
async function collectExtractedFiles(rootDir, excludedNames,
|
|
17708
|
+
async function collectExtractedFiles(rootDir, excludedNames, fs16) {
|
|
17167
17709
|
const files = [];
|
|
17168
17710
|
const dirs = [rootDir];
|
|
17169
17711
|
while (dirs.length > 0) {
|
|
17170
17712
|
const currentDir = dirs.pop();
|
|
17171
17713
|
if (!currentDir) continue;
|
|
17172
|
-
const entries = await
|
|
17714
|
+
const entries = await fs16.readdir(currentDir, { withFileTypes: true });
|
|
17173
17715
|
for (const entry of entries) {
|
|
17174
|
-
const fullPath =
|
|
17716
|
+
const fullPath = import_path15.default.join(currentDir, entry.name);
|
|
17175
17717
|
if (entry.isDirectory()) {
|
|
17176
17718
|
dirs.push(fullPath);
|
|
17177
17719
|
continue;
|
|
@@ -17182,8 +17724,8 @@ async function collectExtractedFiles(rootDir, excludedNames, fs15) {
|
|
|
17182
17724
|
if (excludedNames.has(entry.name)) {
|
|
17183
17725
|
continue;
|
|
17184
17726
|
}
|
|
17185
|
-
const content = await
|
|
17186
|
-
const relativePath =
|
|
17727
|
+
const content = await fs16.readFile(fullPath, "utf-8");
|
|
17728
|
+
const relativePath = import_path15.default.relative(rootDir, fullPath).split(import_path15.default.sep).join("/");
|
|
17187
17729
|
files.push({
|
|
17188
17730
|
name: relativePath,
|
|
17189
17731
|
content
|
|
@@ -17217,11 +17759,11 @@ async function installFromLockfile(options) {
|
|
|
17217
17759
|
console.log(` Installing ${displayName}...`);
|
|
17218
17760
|
let locationOverride = options.location;
|
|
17219
17761
|
if (!locationOverride && lockEntry.format === "agents.md" && lockEntry.installedPath) {
|
|
17220
|
-
const baseName =
|
|
17762
|
+
const baseName = import_path15.default.basename(lockEntry.installedPath);
|
|
17221
17763
|
if (baseName === "AGENTS.override.md") {
|
|
17222
|
-
locationOverride =
|
|
17764
|
+
locationOverride = import_path15.default.dirname(lockEntry.installedPath);
|
|
17223
17765
|
} else if (baseName !== "AGENTS.md") {
|
|
17224
|
-
locationOverride =
|
|
17766
|
+
locationOverride = import_path15.default.dirname(lockEntry.installedPath);
|
|
17225
17767
|
}
|
|
17226
17768
|
}
|
|
17227
17769
|
const manifestFile = (_a = lockEntry.progressiveDisclosure) == null ? void 0 : _a.manifestPath;
|
|
@@ -17266,7 +17808,7 @@ async function installFromLockfile(options) {
|
|
|
17266
17808
|
}
|
|
17267
17809
|
}
|
|
17268
17810
|
function createInstallCommand() {
|
|
17269
|
-
const command = new
|
|
17811
|
+
const command = new import_commander12.Command("install");
|
|
17270
17812
|
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
17813
|
const convertTo = options.format || options.as;
|
|
17272
17814
|
const validFormats = import_types.FORMATS;
|
|
@@ -17315,27 +17857,27 @@ Valid strategies: ${VALID_HOOK_MAPPING_STRATEGIES.join(", ")}`
|
|
|
17315
17857
|
});
|
|
17316
17858
|
return command;
|
|
17317
17859
|
}
|
|
17318
|
-
var
|
|
17860
|
+
var import_commander12, import_registry_client6, import_stream2, import_promises3, tar2, import_path15, import_zlib2, import_promises4, import_os5, import_semver;
|
|
17319
17861
|
var init_install = __esm({
|
|
17320
17862
|
"src/commands/install.ts"() {
|
|
17321
17863
|
"use strict";
|
|
17322
17864
|
init_cjs_shims();
|
|
17323
|
-
|
|
17865
|
+
import_commander12 = require("commander");
|
|
17324
17866
|
init_source();
|
|
17325
|
-
|
|
17867
|
+
import_registry_client6 = require("@pr-pm/registry-client");
|
|
17326
17868
|
init_user_config();
|
|
17327
17869
|
init_filesystem();
|
|
17328
17870
|
init_telemetry();
|
|
17329
17871
|
init_types();
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17872
|
+
import_stream2 = require("stream");
|
|
17873
|
+
import_promises3 = require("stream/promises");
|
|
17874
|
+
tar2 = __toESM(require("tar"));
|
|
17333
17875
|
init_errors();
|
|
17334
17876
|
init_prompts();
|
|
17335
|
-
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
|
|
17877
|
+
import_path15 = __toESM(require("path"));
|
|
17878
|
+
import_zlib2 = __toESM(require("zlib"));
|
|
17879
|
+
import_promises4 = __toESM(require("fs/promises"));
|
|
17880
|
+
import_os5 = __toESM(require("os"));
|
|
17339
17881
|
import_semver = __toESM(require("semver"));
|
|
17340
17882
|
init_collections();
|
|
17341
17883
|
init_lockfile();
|
|
@@ -17441,7 +17983,7 @@ async function fileExists2(filePath) {
|
|
|
17441
17983
|
}
|
|
17442
17984
|
async function scanDirectory2(config, cwd) {
|
|
17443
17985
|
const packages = [];
|
|
17444
|
-
const fullDir =
|
|
17986
|
+
const fullDir = import_path21.default.join(cwd, config.directory);
|
|
17445
17987
|
if (!await directoryExists2(fullDir)) {
|
|
17446
17988
|
return packages;
|
|
17447
17989
|
}
|
|
@@ -17449,13 +17991,13 @@ async function scanDirectory2(config, cwd) {
|
|
|
17449
17991
|
if (config.nested) {
|
|
17450
17992
|
for (const entry of entries) {
|
|
17451
17993
|
if (!entry.isDirectory()) continue;
|
|
17452
|
-
const packageDir =
|
|
17994
|
+
const packageDir = import_path21.default.join(fullDir, entry.name);
|
|
17453
17995
|
if (config.nestedIndicator) {
|
|
17454
|
-
const indicatorPath =
|
|
17996
|
+
const indicatorPath = import_path21.default.join(packageDir, config.nestedIndicator);
|
|
17455
17997
|
if (!await fileExists2(indicatorPath)) continue;
|
|
17456
17998
|
const packageFiles = await collectPackageFiles(packageDir, config.directory, entry.name);
|
|
17457
17999
|
const metadata = await extractMetadata2(indicatorPath);
|
|
17458
|
-
const relativePath =
|
|
18000
|
+
const relativePath = import_path21.default.join(config.directory, entry.name, config.nestedIndicator);
|
|
17459
18001
|
packages.push({
|
|
17460
18002
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
17461
18003
|
format: config.format,
|
|
@@ -17470,8 +18012,8 @@ async function scanDirectory2(config, cwd) {
|
|
|
17470
18012
|
for (const subEntry of subEntries) {
|
|
17471
18013
|
if (!subEntry.isFile()) continue;
|
|
17472
18014
|
if (!matchesPattern(subEntry.name, config.patterns)) continue;
|
|
17473
|
-
const filePath =
|
|
17474
|
-
const relativePath =
|
|
18015
|
+
const filePath = import_path21.default.join(packageDir, subEntry.name);
|
|
18016
|
+
const relativePath = import_path21.default.join(config.directory, entry.name, subEntry.name);
|
|
17475
18017
|
const metadata = await extractMetadata2(filePath);
|
|
17476
18018
|
packages.push({
|
|
17477
18019
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -17489,8 +18031,8 @@ async function scanDirectory2(config, cwd) {
|
|
|
17489
18031
|
for (const entry of entries) {
|
|
17490
18032
|
if (!entry.isFile()) continue;
|
|
17491
18033
|
if (!matchesPattern(entry.name, config.patterns)) continue;
|
|
17492
|
-
const filePath =
|
|
17493
|
-
const relativePath =
|
|
18034
|
+
const filePath = import_path21.default.join(fullDir, entry.name);
|
|
18035
|
+
const relativePath = import_path21.default.join(config.directory, entry.name);
|
|
17494
18036
|
const metadata = await extractMetadata2(filePath);
|
|
17495
18037
|
packages.push({
|
|
17496
18038
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -17510,31 +18052,35 @@ async function collectPackageFiles(packageDir, baseDir, packageName) {
|
|
|
17510
18052
|
async function walkDir(dir, relativeBase) {
|
|
17511
18053
|
const entries = await import_fs16.promises.readdir(dir, { withFileTypes: true });
|
|
17512
18054
|
for (const entry of entries) {
|
|
17513
|
-
const fullPath =
|
|
17514
|
-
const relativePath =
|
|
18055
|
+
const fullPath = import_path21.default.join(dir, entry.name);
|
|
18056
|
+
const relativePath = import_path21.default.join(relativeBase, entry.name);
|
|
17515
18057
|
if (entry.isDirectory()) {
|
|
17516
18058
|
if (["node_modules", "dist", ".git", "coverage"].includes(entry.name)) {
|
|
17517
18059
|
continue;
|
|
17518
18060
|
}
|
|
17519
18061
|
await walkDir(fullPath, relativePath);
|
|
17520
18062
|
} else if (entry.isFile()) {
|
|
17521
|
-
const ext =
|
|
18063
|
+
const ext = import_path21.default.extname(entry.name).toLowerCase();
|
|
17522
18064
|
if ([".md", ".json", ".js", ".ts", ".toml"].includes(ext)) {
|
|
17523
18065
|
files.push(relativePath);
|
|
17524
18066
|
}
|
|
17525
18067
|
}
|
|
17526
18068
|
}
|
|
17527
18069
|
}
|
|
17528
|
-
await walkDir(packageDir,
|
|
18070
|
+
await walkDir(packageDir, import_path21.default.join(baseDir, packageName));
|
|
17529
18071
|
return files;
|
|
17530
18072
|
}
|
|
17531
18073
|
function buildRootManifestFiles() {
|
|
17532
18074
|
const files = [];
|
|
18075
|
+
const seenFiles = /* @__PURE__ */ new Set();
|
|
17533
18076
|
const registry = getFormatRegistry();
|
|
17534
18077
|
for (const [formatName, formatConfig] of Object.entries(registry.formats)) {
|
|
17535
18078
|
if (formatConfig.rootFiles) {
|
|
17536
18079
|
for (const rootFile of formatConfig.rootFiles) {
|
|
17537
|
-
|
|
18080
|
+
if (!seenFiles.has(rootFile)) {
|
|
18081
|
+
seenFiles.add(rootFile);
|
|
18082
|
+
files.push({ file: rootFile, format: formatName });
|
|
18083
|
+
}
|
|
17538
18084
|
}
|
|
17539
18085
|
}
|
|
17540
18086
|
}
|
|
@@ -17547,7 +18093,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
17547
18093
|
allPackages.push(...packages);
|
|
17548
18094
|
}
|
|
17549
18095
|
for (const { file, format } of ROOT_MANIFEST_FILES) {
|
|
17550
|
-
const filePath =
|
|
18096
|
+
const filePath = import_path21.default.join(cwd, file);
|
|
17551
18097
|
if (await fileExists2(filePath)) {
|
|
17552
18098
|
const metadata = await extractMetadata2(filePath);
|
|
17553
18099
|
allPackages.push({
|
|
@@ -17561,7 +18107,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
17561
18107
|
});
|
|
17562
18108
|
}
|
|
17563
18109
|
}
|
|
17564
|
-
const copilotInstructionsPath =
|
|
18110
|
+
const copilotInstructionsPath = import_path21.default.join(cwd, ".github/copilot-instructions.md");
|
|
17565
18111
|
if (await fileExists2(copilotInstructionsPath)) {
|
|
17566
18112
|
const metadata = await extractMetadata2(copilotInstructionsPath);
|
|
17567
18113
|
allPackages.push({
|
|
@@ -17576,13 +18122,13 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
17576
18122
|
}
|
|
17577
18123
|
return allPackages;
|
|
17578
18124
|
}
|
|
17579
|
-
var import_fs16,
|
|
18125
|
+
var import_fs16, import_path21, SCAN_CONFIGS, ROOT_MANIFEST_FILES;
|
|
17580
18126
|
var init_package_scanner = __esm({
|
|
17581
18127
|
"src/core/package-scanner.ts"() {
|
|
17582
18128
|
"use strict";
|
|
17583
18129
|
init_cjs_shims();
|
|
17584
18130
|
import_fs16 = require("fs");
|
|
17585
|
-
|
|
18131
|
+
import_path21 = __toESM(require("path"));
|
|
17586
18132
|
init_dist();
|
|
17587
18133
|
SCAN_CONFIGS = buildScanConfigs();
|
|
17588
18134
|
ROOT_MANIFEST_FILES = buildRootManifestFiles();
|
|
@@ -17592,7 +18138,7 @@ var init_package_scanner = __esm({
|
|
|
17592
18138
|
// src/core/package-reconciler.ts
|
|
17593
18139
|
async function readManifest(cwd = process.cwd()) {
|
|
17594
18140
|
try {
|
|
17595
|
-
const manifestPath =
|
|
18141
|
+
const manifestPath = import_path22.default.join(cwd, "prpm.json");
|
|
17596
18142
|
const content = await import_fs17.promises.readFile(manifestPath, "utf-8");
|
|
17597
18143
|
const raw = JSON.parse(content);
|
|
17598
18144
|
if ("packages" in raw && Array.isArray(raw.packages)) {
|
|
@@ -17675,7 +18221,7 @@ async function reconcilePackages(detected, manifest, cwd = process.cwd()) {
|
|
|
17675
18221
|
const manifestPkg = manifest[mi];
|
|
17676
18222
|
let anyFileExists = false;
|
|
17677
18223
|
for (const file of manifestPkg.files) {
|
|
17678
|
-
const fullPath =
|
|
18224
|
+
const fullPath = import_path22.default.join(cwd, file);
|
|
17679
18225
|
if (await fileExists3(fullPath)) {
|
|
17680
18226
|
anyFileExists = true;
|
|
17681
18227
|
break;
|
|
@@ -17744,7 +18290,7 @@ function createManifestFromDetected(packages, defaults) {
|
|
|
17744
18290
|
files: pkg.files
|
|
17745
18291
|
};
|
|
17746
18292
|
}
|
|
17747
|
-
const projectName =
|
|
18293
|
+
const projectName = import_path22.default.basename(process.cwd()).toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
17748
18294
|
return {
|
|
17749
18295
|
name: `${projectName}-packages`,
|
|
17750
18296
|
version: "1.0.0",
|
|
@@ -17755,13 +18301,13 @@ function createManifestFromDetected(packages, defaults) {
|
|
|
17755
18301
|
packages: packages.map(detectedToManifest)
|
|
17756
18302
|
};
|
|
17757
18303
|
}
|
|
17758
|
-
var import_fs17,
|
|
18304
|
+
var import_fs17, import_path22;
|
|
17759
18305
|
var init_package_reconciler = __esm({
|
|
17760
18306
|
"src/core/package-reconciler.ts"() {
|
|
17761
18307
|
"use strict";
|
|
17762
18308
|
init_cjs_shims();
|
|
17763
18309
|
import_fs17 = require("fs");
|
|
17764
|
-
|
|
18310
|
+
import_path22 = __toESM(require("path"));
|
|
17765
18311
|
}
|
|
17766
18312
|
});
|
|
17767
18313
|
|
|
@@ -17812,7 +18358,7 @@ ${question}`);
|
|
|
17812
18358
|
}
|
|
17813
18359
|
async function extractMetadataFromFile(filePath) {
|
|
17814
18360
|
try {
|
|
17815
|
-
const content = await (0,
|
|
18361
|
+
const content = await (0, import_promises10.readFile)(filePath, "utf-8");
|
|
17816
18362
|
const metadata = {};
|
|
17817
18363
|
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
17818
18364
|
if (frontmatterMatch) {
|
|
@@ -17876,10 +18422,10 @@ function getDefaultAuthor() {
|
|
|
17876
18422
|
async function createExampleFiles(format, files, packageName) {
|
|
17877
18423
|
const templates = EXAMPLE_TEMPLATES[format] || {};
|
|
17878
18424
|
for (const file of files) {
|
|
17879
|
-
const filePath = (0,
|
|
17880
|
-
const dirPath = (0,
|
|
18425
|
+
const filePath = (0, import_path23.join)(process.cwd(), file);
|
|
18426
|
+
const dirPath = (0, import_path23.join)(filePath, "..");
|
|
17881
18427
|
if (!(0, import_fs18.existsSync)(dirPath)) {
|
|
17882
|
-
await (0,
|
|
18428
|
+
await (0, import_promises10.mkdir)(dirPath, { recursive: true });
|
|
17883
18429
|
}
|
|
17884
18430
|
if ((0, import_fs18.existsSync)(filePath)) {
|
|
17885
18431
|
console.log(` Skipping ${file} (already exists)`);
|
|
@@ -17890,12 +18436,12 @@ async function createExampleFiles(format, files, packageName) {
|
|
|
17890
18436
|
Add your content here.
|
|
17891
18437
|
`;
|
|
17892
18438
|
content = content.replace(/example-skill/g, packageName);
|
|
17893
|
-
await (0,
|
|
18439
|
+
await (0, import_promises10.writeFile)(filePath, content, "utf-8");
|
|
17894
18440
|
console.log(` Created ${file}`);
|
|
17895
18441
|
}
|
|
17896
18442
|
}
|
|
17897
18443
|
async function createReadme(config) {
|
|
17898
|
-
const readmePath = (0,
|
|
18444
|
+
const readmePath = (0, import_path23.join)(process.cwd(), "README.md");
|
|
17899
18445
|
if ((0, import_fs18.existsSync)(readmePath)) {
|
|
17900
18446
|
console.log(" Skipping README.md (already exists)");
|
|
17901
18447
|
return;
|
|
@@ -17926,7 +18472,7 @@ ${config.author}
|
|
|
17926
18472
|
|
|
17927
18473
|
${config.license}
|
|
17928
18474
|
`;
|
|
17929
|
-
await (0,
|
|
18475
|
+
await (0, import_promises10.writeFile)(readmePath, content, "utf-8");
|
|
17930
18476
|
console.log(" Created README.md");
|
|
17931
18477
|
}
|
|
17932
18478
|
function displayPackagesTable(packages) {
|
|
@@ -18005,7 +18551,7 @@ async function reviewMissingPackage(rl, pkg, index, total) {
|
|
|
18005
18551
|
return await confirm(rl, "\n Remove from prpm.json?", true);
|
|
18006
18552
|
}
|
|
18007
18553
|
async function smartInit(options) {
|
|
18008
|
-
const manifestPath = (0,
|
|
18554
|
+
const manifestPath = (0, import_path23.join)(process.cwd(), "prpm.json");
|
|
18009
18555
|
const hasManifest = (0, import_fs18.existsSync)(manifestPath);
|
|
18010
18556
|
console.log("\nScanning for packages...\n");
|
|
18011
18557
|
const detected = await scanForPackages();
|
|
@@ -18079,7 +18625,7 @@ ${summaryParts.join(" and ")} package${changes === 1 ? "" : "s"}?`,
|
|
|
18079
18625
|
packagesToRemove,
|
|
18080
18626
|
existingManifest.isMultiPackage
|
|
18081
18627
|
);
|
|
18082
|
-
await (0,
|
|
18628
|
+
await (0, import_promises10.writeFile)(
|
|
18083
18629
|
manifestPath,
|
|
18084
18630
|
JSON.stringify(updatedManifest, null, 2) + "\n",
|
|
18085
18631
|
"utf-8"
|
|
@@ -18138,7 +18684,7 @@ Create multi-package prpm.json with these ${detected.length} packages?` : "\nCre
|
|
|
18138
18684
|
author: defaultAuthor || void 0,
|
|
18139
18685
|
license: "MIT"
|
|
18140
18686
|
});
|
|
18141
|
-
await (0,
|
|
18687
|
+
await (0, import_promises10.writeFile)(
|
|
18142
18688
|
manifestPath,
|
|
18143
18689
|
JSON.stringify(manifest, null, 2) + "\n",
|
|
18144
18690
|
"utf-8"
|
|
@@ -18156,7 +18702,7 @@ Create multi-package prpm.json with these ${detected.length} packages?` : "\nCre
|
|
|
18156
18702
|
}
|
|
18157
18703
|
}
|
|
18158
18704
|
async function classicInit(options) {
|
|
18159
|
-
const manifestPath = (0,
|
|
18705
|
+
const manifestPath = (0, import_path23.join)(process.cwd(), "prpm.json");
|
|
18160
18706
|
if ((0, import_fs18.existsSync)(manifestPath) && !options.force) {
|
|
18161
18707
|
throw new Error(
|
|
18162
18708
|
"prpm.json already exists. Use --force to overwrite, or run this command in a different directory."
|
|
@@ -18328,7 +18874,7 @@ Current files (${config.files.length}):`);
|
|
|
18328
18874
|
manifest.tags = config.tags;
|
|
18329
18875
|
}
|
|
18330
18876
|
manifest.files = config.files;
|
|
18331
|
-
await (0,
|
|
18877
|
+
await (0, import_promises10.writeFile)(
|
|
18332
18878
|
manifestPath,
|
|
18333
18879
|
JSON.stringify(manifest, null, 2) + "\n",
|
|
18334
18880
|
"utf-8"
|
|
@@ -18415,11 +18961,11 @@ async function scanMode(directories, options) {
|
|
|
18415
18961
|
console.log("\u{1F50D} Dry run - no changes made\n");
|
|
18416
18962
|
return;
|
|
18417
18963
|
}
|
|
18418
|
-
const prpmJsonPath = options.output || (0,
|
|
18964
|
+
const prpmJsonPath = options.output || (0, import_path23.join)(process.cwd(), "prpm.json");
|
|
18419
18965
|
let manifest;
|
|
18420
18966
|
if (options.append) {
|
|
18421
18967
|
try {
|
|
18422
|
-
const existingContent = await (0,
|
|
18968
|
+
const existingContent = await (0, import_promises10.readFile)(prpmJsonPath, "utf-8");
|
|
18423
18969
|
const existing = JSON.parse(existingContent);
|
|
18424
18970
|
if ("packages" in existing && Array.isArray(existing.packages)) {
|
|
18425
18971
|
manifest = existing;
|
|
@@ -18465,7 +19011,7 @@ async function scanMode(directories, options) {
|
|
|
18465
19011
|
manifest.packages.push(packageManifest);
|
|
18466
19012
|
addedCount++;
|
|
18467
19013
|
}
|
|
18468
|
-
await (0,
|
|
19014
|
+
await (0, import_promises10.writeFile)(
|
|
18469
19015
|
prpmJsonPath,
|
|
18470
19016
|
JSON.stringify(manifest, null, 2) + "\n",
|
|
18471
19017
|
"utf-8"
|
|
@@ -18491,7 +19037,7 @@ async function initPackage(options, scanDirectories) {
|
|
|
18491
19037
|
return smartInit(options);
|
|
18492
19038
|
}
|
|
18493
19039
|
function createInitCommand() {
|
|
18494
|
-
const command = new
|
|
19040
|
+
const command = new import_commander13.Command("init");
|
|
18495
19041
|
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
19042
|
"-s, --scan",
|
|
18497
19043
|
"Scan mode: discover packages in directories without prompts"
|
|
@@ -18517,14 +19063,14 @@ function createInitCommand() {
|
|
|
18517
19063
|
});
|
|
18518
19064
|
return command;
|
|
18519
19065
|
}
|
|
18520
|
-
var
|
|
19066
|
+
var import_commander13, import_promises10, import_path23, import_fs18, readline4, import_process, FORMAT_EXAMPLES, EXAMPLE_TEMPLATES;
|
|
18521
19067
|
var init_init = __esm({
|
|
18522
19068
|
"src/commands/init.ts"() {
|
|
18523
19069
|
"use strict";
|
|
18524
19070
|
init_cjs_shims();
|
|
18525
|
-
|
|
18526
|
-
|
|
18527
|
-
|
|
19071
|
+
import_commander13 = require("commander");
|
|
19072
|
+
import_promises10 = require("fs/promises");
|
|
19073
|
+
import_path23 = require("path");
|
|
18528
19074
|
import_fs18 = require("fs");
|
|
18529
19075
|
readline4 = __toESM(require("readline/promises"));
|
|
18530
19076
|
import_process = require("process");
|
|
@@ -18907,9 +19453,9 @@ Include examples if helpful.
|
|
|
18907
19453
|
|
|
18908
19454
|
// src/index.ts
|
|
18909
19455
|
init_cjs_shims();
|
|
18910
|
-
var
|
|
19456
|
+
var import_commander32 = require("commander");
|
|
18911
19457
|
var import_fs22 = require("fs");
|
|
18912
|
-
var
|
|
19458
|
+
var import_path27 = require("path");
|
|
18913
19459
|
|
|
18914
19460
|
// src/commands/list.ts
|
|
18915
19461
|
init_cjs_shims();
|
|
@@ -19813,6 +20359,7 @@ function getPackageIcon(format, subtype) {
|
|
|
19813
20359
|
"replit": "\u{1F52E}",
|
|
19814
20360
|
"zed": "\u26A1",
|
|
19815
20361
|
"codex": "\u{1F9E0}",
|
|
20362
|
+
"amp": "\u26A1",
|
|
19816
20363
|
"mcp": "\u{1F517}",
|
|
19817
20364
|
"agents.md": "\u{1F4DD}",
|
|
19818
20365
|
"ruler": "\u{1F4CF}",
|
|
@@ -19840,6 +20387,7 @@ function getPackageLabel(format, subtype) {
|
|
|
19840
20387
|
"replit": "Replit",
|
|
19841
20388
|
"zed": "Zed",
|
|
19842
20389
|
"codex": "Codex",
|
|
20390
|
+
"amp": "Amp",
|
|
19843
20391
|
"mcp": "MCP",
|
|
19844
20392
|
"agents.md": "Agents.md",
|
|
19845
20393
|
"ruler": "Ruler",
|
|
@@ -20364,24 +20912,325 @@ function createInfoCommand() {
|
|
|
20364
20912
|
return command;
|
|
20365
20913
|
}
|
|
20366
20914
|
|
|
20915
|
+
// src/commands/show.ts
|
|
20916
|
+
init_cjs_shims();
|
|
20917
|
+
var import_commander10 = require("commander");
|
|
20918
|
+
var import_registry_client4 = require("@pr-pm/registry-client");
|
|
20919
|
+
init_user_config();
|
|
20920
|
+
init_telemetry();
|
|
20921
|
+
init_errors();
|
|
20922
|
+
var import_stream = require("stream");
|
|
20923
|
+
var import_promises = require("stream/promises");
|
|
20924
|
+
var tar = __toESM(require("tar"));
|
|
20925
|
+
var import_zlib = __toESM(require("zlib"));
|
|
20926
|
+
var import_path14 = __toESM(require("path"));
|
|
20927
|
+
var import_os4 = __toESM(require("os"));
|
|
20928
|
+
var import_promises2 = __toESM(require("fs/promises"));
|
|
20929
|
+
function isPathSafe(targetDir, filePath) {
|
|
20930
|
+
const resolvedPath = import_path14.default.resolve(targetDir, filePath);
|
|
20931
|
+
const resolvedTarget = import_path14.default.resolve(targetDir);
|
|
20932
|
+
return resolvedPath.startsWith(resolvedTarget + import_path14.default.sep) || resolvedPath === resolvedTarget;
|
|
20933
|
+
}
|
|
20934
|
+
function hasUnsafePathPatterns(filePath) {
|
|
20935
|
+
if (filePath.includes("..")) return true;
|
|
20936
|
+
if (filePath.startsWith("/")) return true;
|
|
20937
|
+
if (/^[a-zA-Z]:/.test(filePath)) return true;
|
|
20938
|
+
if (filePath.includes("\0")) return true;
|
|
20939
|
+
return false;
|
|
20940
|
+
}
|
|
20941
|
+
function isBinaryContent(buffer) {
|
|
20942
|
+
if (buffer.includes(0)) return true;
|
|
20943
|
+
const sampleSize = Math.min(buffer.length, 512);
|
|
20944
|
+
let nonPrintable = 0;
|
|
20945
|
+
for (let i = 0; i < sampleSize; i++) {
|
|
20946
|
+
const byte = buffer[i];
|
|
20947
|
+
if (byte !== 9 && byte !== 10 && byte !== 13 && (byte < 32 || byte > 126)) {
|
|
20948
|
+
nonPrintable++;
|
|
20949
|
+
}
|
|
20950
|
+
}
|
|
20951
|
+
return nonPrintable / sampleSize > 0.3;
|
|
20952
|
+
}
|
|
20953
|
+
async function extractTarballContents(tarball) {
|
|
20954
|
+
let decompressed;
|
|
20955
|
+
try {
|
|
20956
|
+
decompressed = await new Promise((resolve3, reject) => {
|
|
20957
|
+
import_zlib.default.gunzip(tarball, (err, result) => {
|
|
20958
|
+
if (err) {
|
|
20959
|
+
reject(new Error(`Failed to decompress tarball: ${err.message}`));
|
|
20960
|
+
return;
|
|
20961
|
+
}
|
|
20962
|
+
resolve3(result);
|
|
20963
|
+
});
|
|
20964
|
+
});
|
|
20965
|
+
} catch (error) {
|
|
20966
|
+
throw new CLIError(`Package decompression failed: ${error.message}`);
|
|
20967
|
+
}
|
|
20968
|
+
const tmpDir = await import_promises2.default.mkdtemp(import_path14.default.join(import_os4.default.tmpdir(), "prpm-show-"));
|
|
20969
|
+
const cleanup = async () => {
|
|
20970
|
+
try {
|
|
20971
|
+
await import_promises2.default.rm(tmpDir, { recursive: true, force: true });
|
|
20972
|
+
} catch {
|
|
20973
|
+
}
|
|
20974
|
+
};
|
|
20975
|
+
try {
|
|
20976
|
+
const extract3 = tar.extract({
|
|
20977
|
+
cwd: tmpDir,
|
|
20978
|
+
strict: true,
|
|
20979
|
+
// Security: filter out dangerous entries before extraction
|
|
20980
|
+
filter: (entryPath, entry) => {
|
|
20981
|
+
const entryType = "type" in entry ? entry.type : null;
|
|
20982
|
+
if (entryType === "SymbolicLink" || entryType === "Link") {
|
|
20983
|
+
console.warn(` \u26A0\uFE0F Blocked symlink in package: ${entryPath}`);
|
|
20984
|
+
return false;
|
|
20985
|
+
}
|
|
20986
|
+
if ("isSymbolicLink" in entry && entry.isSymbolicLink()) {
|
|
20987
|
+
console.warn(` \u26A0\uFE0F Blocked symlink in package: ${entryPath}`);
|
|
20988
|
+
return false;
|
|
20989
|
+
}
|
|
20990
|
+
if (hasUnsafePathPatterns(entryPath)) {
|
|
20991
|
+
console.warn(` \u26A0\uFE0F Blocked unsafe path in package: ${entryPath}`);
|
|
20992
|
+
return false;
|
|
20993
|
+
}
|
|
20994
|
+
if (!isPathSafe(tmpDir, entryPath)) {
|
|
20995
|
+
console.warn(` \u26A0\uFE0F Blocked path traversal attempt: ${entryPath}`);
|
|
20996
|
+
return false;
|
|
20997
|
+
}
|
|
20998
|
+
return true;
|
|
20999
|
+
}
|
|
21000
|
+
});
|
|
21001
|
+
await (0, import_promises.pipeline)(import_stream.Readable.from(decompressed), extract3);
|
|
21002
|
+
const files = [];
|
|
21003
|
+
const dirs = [tmpDir];
|
|
21004
|
+
while (dirs.length > 0) {
|
|
21005
|
+
const currentDir = dirs.pop();
|
|
21006
|
+
if (!currentDir) continue;
|
|
21007
|
+
const entries = await import_promises2.default.readdir(currentDir, { withFileTypes: true });
|
|
21008
|
+
for (const entry of entries) {
|
|
21009
|
+
const fullPath = import_path14.default.join(currentDir, entry.name);
|
|
21010
|
+
if (entry.isDirectory()) {
|
|
21011
|
+
dirs.push(fullPath);
|
|
21012
|
+
continue;
|
|
21013
|
+
}
|
|
21014
|
+
if (!entry.isFile()) {
|
|
21015
|
+
continue;
|
|
21016
|
+
}
|
|
21017
|
+
const buffer = await import_promises2.default.readFile(fullPath);
|
|
21018
|
+
const stats = await import_promises2.default.stat(fullPath);
|
|
21019
|
+
const relativePath = import_path14.default.relative(tmpDir, fullPath).split(import_path14.default.sep).join("/");
|
|
21020
|
+
const binary2 = isBinaryContent(buffer);
|
|
21021
|
+
files.push({
|
|
21022
|
+
name: relativePath,
|
|
21023
|
+
content: binary2 ? `[Binary file - ${stats.size} bytes]` : buffer.toString("utf-8"),
|
|
21024
|
+
size: stats.size,
|
|
21025
|
+
isBinary: binary2
|
|
21026
|
+
});
|
|
21027
|
+
}
|
|
21028
|
+
}
|
|
21029
|
+
return files;
|
|
21030
|
+
} finally {
|
|
21031
|
+
await cleanup();
|
|
21032
|
+
}
|
|
21033
|
+
}
|
|
21034
|
+
function formatSize(bytes) {
|
|
21035
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
21036
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
21037
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
21038
|
+
}
|
|
21039
|
+
function getFileIcon(filename, isBinary2 = false) {
|
|
21040
|
+
if (isBinary2) return "\u{1F512}";
|
|
21041
|
+
const ext = import_path14.default.extname(filename).toLowerCase();
|
|
21042
|
+
const iconMap = {
|
|
21043
|
+
".md": "\u{1F4C4}",
|
|
21044
|
+
".mdc": "\u{1F4CB}",
|
|
21045
|
+
".json": "\u{1F4E6}",
|
|
21046
|
+
".toml": "\u2699\uFE0F",
|
|
21047
|
+
".yaml": "\u2699\uFE0F",
|
|
21048
|
+
".yml": "\u2699\uFE0F",
|
|
21049
|
+
".ts": "\u{1F4DC}",
|
|
21050
|
+
".js": "\u{1F4DC}",
|
|
21051
|
+
".sh": "\u{1F527}",
|
|
21052
|
+
".txt": "\u{1F4DD}"
|
|
21053
|
+
};
|
|
21054
|
+
return iconMap[ext] || "\u{1F4C4}";
|
|
21055
|
+
}
|
|
21056
|
+
async function handleShow(packageSpec, options) {
|
|
21057
|
+
const startTime = Date.now();
|
|
21058
|
+
let success = false;
|
|
21059
|
+
let error;
|
|
21060
|
+
try {
|
|
21061
|
+
let packageId;
|
|
21062
|
+
let specVersion;
|
|
21063
|
+
if (packageSpec.startsWith("@")) {
|
|
21064
|
+
const match = packageSpec.match(/^(@[^/]+\/[^@]+)(?:@(.+))?$/);
|
|
21065
|
+
if (!match) {
|
|
21066
|
+
throw new Error("Invalid package spec format. Use: @scope/package or @scope/package@version");
|
|
21067
|
+
}
|
|
21068
|
+
packageId = match[1];
|
|
21069
|
+
specVersion = match[2];
|
|
21070
|
+
} else {
|
|
21071
|
+
const parts = packageSpec.split("@");
|
|
21072
|
+
packageId = parts[0];
|
|
21073
|
+
specVersion = parts[1];
|
|
21074
|
+
}
|
|
21075
|
+
console.log(`\u{1F4E6} Fetching package contents for "${packageId}"...`);
|
|
21076
|
+
const config = await getConfig();
|
|
21077
|
+
const client = (0, import_registry_client4.getRegistryClient)(config);
|
|
21078
|
+
const pkg = await client.getPackage(packageId);
|
|
21079
|
+
let tarballUrl;
|
|
21080
|
+
let actualVersion;
|
|
21081
|
+
if (specVersion && specVersion !== "latest") {
|
|
21082
|
+
const versionInfo = await client.getPackageVersion(packageId, specVersion);
|
|
21083
|
+
tarballUrl = versionInfo.tarball_url;
|
|
21084
|
+
actualVersion = specVersion;
|
|
21085
|
+
} else {
|
|
21086
|
+
if (!pkg.latest_version) {
|
|
21087
|
+
throw new Error("No versions available for this package");
|
|
21088
|
+
}
|
|
21089
|
+
tarballUrl = pkg.latest_version.tarball_url;
|
|
21090
|
+
actualVersion = pkg.latest_version.version;
|
|
21091
|
+
}
|
|
21092
|
+
console.log(` Version: ${actualVersion}`);
|
|
21093
|
+
console.log(` \u2B07\uFE0F Downloading package...`);
|
|
21094
|
+
const tarball = await client.downloadPackage(tarballUrl);
|
|
21095
|
+
console.log(` \u{1F4C2} Extracting contents...
|
|
21096
|
+
`);
|
|
21097
|
+
const files = await extractTarballContents(tarball);
|
|
21098
|
+
if (files.length === 0) {
|
|
21099
|
+
console.log("\u26A0\uFE0F Package contains no files");
|
|
21100
|
+
success = true;
|
|
21101
|
+
return;
|
|
21102
|
+
}
|
|
21103
|
+
if (options.json) {
|
|
21104
|
+
const output2 = {
|
|
21105
|
+
package: packageId,
|
|
21106
|
+
version: actualVersion,
|
|
21107
|
+
format: pkg.format,
|
|
21108
|
+
subtype: pkg.subtype,
|
|
21109
|
+
description: pkg.description,
|
|
21110
|
+
files: files.map((f) => ({
|
|
21111
|
+
path: f.name,
|
|
21112
|
+
size: f.size,
|
|
21113
|
+
isBinary: f.isBinary,
|
|
21114
|
+
content: options.full ? f.content : void 0
|
|
21115
|
+
}))
|
|
21116
|
+
};
|
|
21117
|
+
console.log(JSON.stringify(output2, null, 2));
|
|
21118
|
+
success = true;
|
|
21119
|
+
return;
|
|
21120
|
+
}
|
|
21121
|
+
console.log("=".repeat(60));
|
|
21122
|
+
console.log(` ${pkg.name} v${actualVersion}`);
|
|
21123
|
+
console.log("=".repeat(60));
|
|
21124
|
+
if (pkg.description) {
|
|
21125
|
+
console.log(`
|
|
21126
|
+
\u{1F4DD} ${pkg.description}`);
|
|
21127
|
+
}
|
|
21128
|
+
console.log(`
|
|
21129
|
+
\u{1F4C2} Type: ${pkg.format} ${pkg.subtype}`);
|
|
21130
|
+
console.log(`\u{1F4E6} Files: ${files.length}`);
|
|
21131
|
+
console.log(`\u{1F4CA} Total size: ${formatSize(files.reduce((sum, f) => sum + f.size, 0))}`);
|
|
21132
|
+
if (options.file) {
|
|
21133
|
+
const targetFile = files.find(
|
|
21134
|
+
(f) => f.name === options.file || f.name.endsWith("/" + options.file) || import_path14.default.basename(f.name) === options.file
|
|
21135
|
+
);
|
|
21136
|
+
if (!targetFile) {
|
|
21137
|
+
console.log(`
|
|
21138
|
+
\u274C File not found: ${options.file}`);
|
|
21139
|
+
console.log("\n\u{1F4CB} Available files:");
|
|
21140
|
+
for (const file of files) {
|
|
21141
|
+
console.log(` ${getFileIcon(file.name, file.isBinary)} ${file.name}`);
|
|
21142
|
+
}
|
|
21143
|
+
throw new CLIError(`File "${options.file}" not found in package`, 1);
|
|
21144
|
+
}
|
|
21145
|
+
console.log("\n" + "\u2500".repeat(60));
|
|
21146
|
+
console.log(`\u{1F4C4} ${targetFile.name} (${formatSize(targetFile.size)})`);
|
|
21147
|
+
console.log("\u2500".repeat(60));
|
|
21148
|
+
console.log(targetFile.content);
|
|
21149
|
+
success = true;
|
|
21150
|
+
return;
|
|
21151
|
+
}
|
|
21152
|
+
console.log("\n" + "\u2500".repeat(60));
|
|
21153
|
+
console.log(" \u{1F4CB} Package Contents");
|
|
21154
|
+
console.log("\u2500".repeat(60));
|
|
21155
|
+
for (const file of files) {
|
|
21156
|
+
const binaryLabel = file.isBinary ? " [binary]" : "";
|
|
21157
|
+
console.log(` ${getFileIcon(file.name, file.isBinary)} ${file.name} (${formatSize(file.size)})${binaryLabel}`);
|
|
21158
|
+
}
|
|
21159
|
+
if (options.full) {
|
|
21160
|
+
console.log("\n" + "\u2550".repeat(60));
|
|
21161
|
+
console.log(" \u{1F4D6} Full File Contents");
|
|
21162
|
+
console.log("\u2550".repeat(60));
|
|
21163
|
+
for (const file of files) {
|
|
21164
|
+
console.log("\n" + "\u2500".repeat(60));
|
|
21165
|
+
console.log(`\u{1F4C4} ${file.name}`);
|
|
21166
|
+
console.log("\u2500".repeat(60));
|
|
21167
|
+
console.log(file.content);
|
|
21168
|
+
}
|
|
21169
|
+
} else {
|
|
21170
|
+
console.log("\n\u{1F4A1} Tip: Use --full to see complete file contents");
|
|
21171
|
+
console.log(` prpm show ${packageSpec} --full`);
|
|
21172
|
+
console.log(` prpm show ${packageSpec} --file <filename> # View specific file`);
|
|
21173
|
+
}
|
|
21174
|
+
console.log("\n" + "=".repeat(60));
|
|
21175
|
+
console.log(`
|
|
21176
|
+
\u{1F4BB} To install: prpm install ${packageId}`);
|
|
21177
|
+
success = true;
|
|
21178
|
+
} catch (err) {
|
|
21179
|
+
error = err instanceof Error ? err.message : String(err);
|
|
21180
|
+
if (err instanceof CLIError) {
|
|
21181
|
+
throw err;
|
|
21182
|
+
}
|
|
21183
|
+
throw new CLIError(
|
|
21184
|
+
`
|
|
21185
|
+
\u274C Failed to show package contents: ${error}
|
|
21186
|
+
|
|
21187
|
+
\u{1F4A1} Tips:
|
|
21188
|
+
- Check the package ID spelling
|
|
21189
|
+
- Search for packages: prpm search <query>
|
|
21190
|
+
- Get package info: prpm info <package>`,
|
|
21191
|
+
1
|
|
21192
|
+
);
|
|
21193
|
+
} finally {
|
|
21194
|
+
await telemetry.track({
|
|
21195
|
+
command: "show",
|
|
21196
|
+
success,
|
|
21197
|
+
error,
|
|
21198
|
+
duration: Date.now() - startTime,
|
|
21199
|
+
data: {
|
|
21200
|
+
packageName: packageSpec,
|
|
21201
|
+
full: options.full,
|
|
21202
|
+
json: options.json
|
|
21203
|
+
}
|
|
21204
|
+
});
|
|
21205
|
+
await telemetry.shutdown();
|
|
21206
|
+
}
|
|
21207
|
+
}
|
|
21208
|
+
function createShowCommand() {
|
|
21209
|
+
const command = new import_commander10.Command("show");
|
|
21210
|
+
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) => {
|
|
21211
|
+
await handleShow(packageSpec, options);
|
|
21212
|
+
});
|
|
21213
|
+
return command;
|
|
21214
|
+
}
|
|
21215
|
+
|
|
20367
21216
|
// src/index.ts
|
|
20368
21217
|
init_install();
|
|
20369
21218
|
|
|
20370
21219
|
// src/commands/publish.ts
|
|
20371
21220
|
init_cjs_shims();
|
|
20372
|
-
var
|
|
20373
|
-
var
|
|
20374
|
-
var
|
|
21221
|
+
var import_commander14 = require("commander");
|
|
21222
|
+
var import_promises11 = require("fs/promises");
|
|
21223
|
+
var import_path24 = require("path");
|
|
20375
21224
|
var import_fs19 = require("fs");
|
|
20376
|
-
var
|
|
21225
|
+
var import_registry_client7 = require("@pr-pm/registry-client");
|
|
20377
21226
|
init_user_config();
|
|
20378
21227
|
init_telemetry();
|
|
20379
21228
|
init_errors();
|
|
20380
21229
|
|
|
20381
21230
|
// src/utils/license-extractor.ts
|
|
20382
21231
|
init_cjs_shims();
|
|
20383
|
-
var
|
|
20384
|
-
var
|
|
21232
|
+
var import_promises5 = require("fs/promises");
|
|
21233
|
+
var import_path16 = require("path");
|
|
20385
21234
|
var import_fs14 = require("fs");
|
|
20386
21235
|
var LICENSE_FILE_PATTERNS = [
|
|
20387
21236
|
"LICENSE",
|
|
@@ -20431,10 +21280,10 @@ function generateLicenseUrl(repositoryUrl, fileName) {
|
|
|
20431
21280
|
async function extractLicenseInfo(repositoryUrl) {
|
|
20432
21281
|
const cwd = process.cwd();
|
|
20433
21282
|
for (const fileName of LICENSE_FILE_PATTERNS) {
|
|
20434
|
-
const filePath = (0,
|
|
21283
|
+
const filePath = (0, import_path16.join)(cwd, fileName);
|
|
20435
21284
|
try {
|
|
20436
|
-
await (0,
|
|
20437
|
-
const text = await (0,
|
|
21285
|
+
await (0, import_promises5.access)(filePath, import_fs14.constants.R_OK);
|
|
21286
|
+
const text = await (0, import_promises5.readFile)(filePath, "utf-8");
|
|
20438
21287
|
const type2 = detectLicenseType(text);
|
|
20439
21288
|
const url = generateLicenseUrl(repositoryUrl, fileName);
|
|
20440
21289
|
return {
|
|
@@ -20466,8 +21315,8 @@ function validateLicenseInfo(licenseInfo, packageName) {
|
|
|
20466
21315
|
|
|
20467
21316
|
// src/utils/snippet-extractor.ts
|
|
20468
21317
|
init_cjs_shims();
|
|
20469
|
-
var
|
|
20470
|
-
var
|
|
21318
|
+
var import_promises6 = require("fs/promises");
|
|
21319
|
+
var import_path17 = require("path");
|
|
20471
21320
|
var MAX_SNIPPET_LENGTH = 2e3;
|
|
20472
21321
|
async function extractSnippet(manifest) {
|
|
20473
21322
|
const cwd = process.cwd();
|
|
@@ -20483,13 +21332,13 @@ async function extractSnippet(manifest) {
|
|
|
20483
21332
|
const firstFile = manifest.files[0];
|
|
20484
21333
|
fileName = typeof firstFile === "string" ? firstFile : firstFile.path;
|
|
20485
21334
|
}
|
|
20486
|
-
const fullPath = (0,
|
|
20487
|
-
const stats = await (0,
|
|
21335
|
+
const fullPath = (0, import_path17.join)(cwd, fileName);
|
|
21336
|
+
const stats = await (0, import_promises6.stat)(fullPath);
|
|
20488
21337
|
if (stats.isDirectory()) {
|
|
20489
21338
|
console.warn(`\u26A0\uFE0F Skipping snippet extraction: "${fullPath}" is a directory`);
|
|
20490
21339
|
return null;
|
|
20491
21340
|
}
|
|
20492
|
-
const content = await (0,
|
|
21341
|
+
const content = await (0, import_promises6.readFile)(fullPath, "utf-8");
|
|
20493
21342
|
if (content.length <= MAX_SNIPPET_LENGTH) {
|
|
20494
21343
|
return content.trim();
|
|
20495
21344
|
}
|
|
@@ -20572,7 +21421,7 @@ async function executePrepublishOnly(scripts, options = {}) {
|
|
|
20572
21421
|
|
|
20573
21422
|
// src/utils/format-file-validator.ts
|
|
20574
21423
|
init_cjs_shims();
|
|
20575
|
-
var
|
|
21424
|
+
var import_promises7 = require("fs/promises");
|
|
20576
21425
|
init_dist();
|
|
20577
21426
|
function normalizeFilePaths(files) {
|
|
20578
21427
|
return files.map((file) => {
|
|
@@ -20598,7 +21447,7 @@ function getFormatType(format) {
|
|
|
20598
21447
|
}
|
|
20599
21448
|
async function validateMarkdownFile(filePath, formatType, subtype) {
|
|
20600
21449
|
try {
|
|
20601
|
-
const content = await (0,
|
|
21450
|
+
const content = await (0, import_promises7.readFile)(filePath, "utf-8");
|
|
20602
21451
|
const result = validateMarkdown(formatType, content, subtype);
|
|
20603
21452
|
return {
|
|
20604
21453
|
valid: result.valid,
|
|
@@ -20617,7 +21466,7 @@ Stack: ${error.stack}` : String(error);
|
|
|
20617
21466
|
}
|
|
20618
21467
|
async function validateStructuredFile(filePath, formatType, subtype) {
|
|
20619
21468
|
try {
|
|
20620
|
-
const content = await (0,
|
|
21469
|
+
const content = await (0, import_promises7.readFile)(filePath, "utf-8");
|
|
20621
21470
|
let data;
|
|
20622
21471
|
try {
|
|
20623
21472
|
data = JSON.parse(content);
|
|
@@ -20724,13 +21573,13 @@ async function validatePackageFiles(manifest) {
|
|
|
20724
21573
|
}
|
|
20725
21574
|
}
|
|
20726
21575
|
if (manifest.format === "claude" && manifest.subtype === "skill") {
|
|
20727
|
-
const hasSkillMd = filePaths.some((
|
|
20728
|
-
const mdFiles = filePaths.filter((
|
|
21576
|
+
const hasSkillMd = filePaths.some((path12) => path12.endsWith("/SKILL.md") || path12 === "SKILL.md");
|
|
21577
|
+
const mdFiles = filePaths.filter((path12) => {
|
|
20729
21578
|
var _a;
|
|
20730
|
-
if (!
|
|
20731
|
-
const filename = ((_a =
|
|
21579
|
+
if (!path12.endsWith(".md")) return false;
|
|
21580
|
+
const filename = ((_a = path12.split(/[\\/]/).pop()) == null ? void 0 : _a.toLowerCase()) || "";
|
|
20732
21581
|
if (filename === "readme.md") return false;
|
|
20733
|
-
if (
|
|
21582
|
+
if (path12.includes("examples/") || path12.includes("example/") || path12.includes("tests/") || path12.includes("__tests__/") || path12.includes("docs/") || path12.includes("doc/")) return false;
|
|
20734
21583
|
return true;
|
|
20735
21584
|
});
|
|
20736
21585
|
if (!hasSkillMd && mdFiles.length === 0) {
|
|
@@ -20742,7 +21591,7 @@ async function validatePackageFiles(manifest) {
|
|
|
20742
21591
|
}
|
|
20743
21592
|
}
|
|
20744
21593
|
if (manifest.format === "windsurf") {
|
|
20745
|
-
const hasWindsurfRules = filePaths.some((
|
|
21594
|
+
const hasWindsurfRules = filePaths.some((path12) => path12.includes(".windsurf/rules"));
|
|
20746
21595
|
if (!hasWindsurfRules) {
|
|
20747
21596
|
warnings.push("Windsurf packages typically use .windsurf/rules filename");
|
|
20748
21597
|
}
|
|
@@ -20752,8 +21601,8 @@ async function validatePackageFiles(manifest) {
|
|
|
20752
21601
|
|
|
20753
21602
|
// src/utils/manifest-loader.ts
|
|
20754
21603
|
init_cjs_shims();
|
|
20755
|
-
var
|
|
20756
|
-
var
|
|
21604
|
+
var import_promises8 = require("fs/promises");
|
|
21605
|
+
var import_path19 = require("path");
|
|
20757
21606
|
|
|
20758
21607
|
// src/core/marketplace-converter.ts
|
|
20759
21608
|
init_cjs_shims();
|
|
@@ -20920,13 +21769,13 @@ init_cjs_shims();
|
|
|
20920
21769
|
var import_ajv2 = __toESM(require("ajv"));
|
|
20921
21770
|
var import_ajv_formats2 = __toESM(require("ajv-formats"));
|
|
20922
21771
|
var import_fs15 = require("fs");
|
|
20923
|
-
var
|
|
21772
|
+
var import_path18 = require("path");
|
|
20924
21773
|
var schema2;
|
|
20925
21774
|
var schemaCandidates = [
|
|
20926
21775
|
// Source file layout (src/core → ../../schemas)
|
|
20927
|
-
(0,
|
|
21776
|
+
(0, import_path18.join)(__dirname, "../../schemas/prpm-manifest.schema.json"),
|
|
20928
21777
|
// Bundled layout (dist/index.js → ../schemas)
|
|
20929
|
-
(0,
|
|
21778
|
+
(0, import_path18.join)(__dirname, "../schemas/prpm-manifest.schema.json")
|
|
20930
21779
|
];
|
|
20931
21780
|
for (const candidate of schemaCandidates) {
|
|
20932
21781
|
try {
|
|
@@ -20953,27 +21802,27 @@ function validateManifestSchema(manifest) {
|
|
|
20953
21802
|
const valid = validate(manifest);
|
|
20954
21803
|
if (!valid && validate.errors) {
|
|
20955
21804
|
const errors = validate.errors.map((err) => {
|
|
20956
|
-
const
|
|
21805
|
+
const path12 = err.instancePath || "manifest";
|
|
20957
21806
|
const message = err.message || "validation failed";
|
|
20958
21807
|
if (err.keyword === "required") {
|
|
20959
21808
|
const missingProp = err.params.missingProperty;
|
|
20960
21809
|
return `Missing required field: ${missingProp}`;
|
|
20961
21810
|
}
|
|
20962
21811
|
if (err.keyword === "pattern") {
|
|
20963
|
-
return `${
|
|
21812
|
+
return `${path12}: ${message}. Value does not match required pattern.`;
|
|
20964
21813
|
}
|
|
20965
21814
|
if (err.keyword === "enum") {
|
|
20966
21815
|
const allowedValues = err.params.allowedValues;
|
|
20967
|
-
return `${
|
|
21816
|
+
return `${path12}: ${message}. Allowed values: ${allowedValues.join(", ")}`;
|
|
20968
21817
|
}
|
|
20969
21818
|
if (err.keyword === "minLength" || err.keyword === "maxLength") {
|
|
20970
21819
|
const limit = err.params.limit;
|
|
20971
|
-
return `${
|
|
21820
|
+
return `${path12}: ${message} (${err.keyword}: ${limit})`;
|
|
20972
21821
|
}
|
|
20973
21822
|
if (err.keyword === "oneOf") {
|
|
20974
|
-
return `${
|
|
21823
|
+
return `${path12}: must match exactly one schema (check if files array uses either all strings or all objects, not mixed)`;
|
|
20975
21824
|
}
|
|
20976
|
-
return `${
|
|
21825
|
+
return `${path12}: ${message}`;
|
|
20977
21826
|
});
|
|
20978
21827
|
return { valid: false, errors };
|
|
20979
21828
|
}
|
|
@@ -20988,10 +21837,10 @@ function toOrganizationSlug(value) {
|
|
|
20988
21837
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-+/g, "-");
|
|
20989
21838
|
}
|
|
20990
21839
|
async function findAndLoadManifests() {
|
|
20991
|
-
const prpmJsonPath = (0,
|
|
21840
|
+
const prpmJsonPath = (0, import_path19.join)(process.cwd(), "prpm.json");
|
|
20992
21841
|
let prpmJsonExists = false;
|
|
20993
21842
|
try {
|
|
20994
|
-
const content = await (0,
|
|
21843
|
+
const content = await (0, import_promises8.readFile)(prpmJsonPath, "utf-8");
|
|
20995
21844
|
prpmJsonExists = true;
|
|
20996
21845
|
const manifest = JSON.parse(content);
|
|
20997
21846
|
const collections = [];
|
|
@@ -21049,13 +21898,13 @@ async function findAndLoadManifests() {
|
|
|
21049
21898
|
throw error;
|
|
21050
21899
|
}
|
|
21051
21900
|
}
|
|
21052
|
-
const marketplaceJsonPath = (0,
|
|
21901
|
+
const marketplaceJsonPath = (0, import_path19.join)(
|
|
21053
21902
|
process.cwd(),
|
|
21054
21903
|
".claude",
|
|
21055
21904
|
"marketplace.json"
|
|
21056
21905
|
);
|
|
21057
21906
|
try {
|
|
21058
|
-
const content = await (0,
|
|
21907
|
+
const content = await (0, import_promises8.readFile)(marketplaceJsonPath, "utf-8");
|
|
21059
21908
|
const marketplaceData = JSON.parse(content);
|
|
21060
21909
|
if (!validateMarketplaceJson(marketplaceData)) {
|
|
21061
21910
|
throw new Error("Invalid marketplace.json format");
|
|
@@ -21069,13 +21918,13 @@ async function findAndLoadManifests() {
|
|
|
21069
21918
|
return { manifests, collections: [], source: ".claude/marketplace.json" };
|
|
21070
21919
|
} catch (error) {
|
|
21071
21920
|
}
|
|
21072
|
-
const marketplaceJsonPluginPath = (0,
|
|
21921
|
+
const marketplaceJsonPluginPath = (0, import_path19.join)(
|
|
21073
21922
|
process.cwd(),
|
|
21074
21923
|
".claude-plugin",
|
|
21075
21924
|
"marketplace.json"
|
|
21076
21925
|
);
|
|
21077
21926
|
try {
|
|
21078
|
-
const content = await (0,
|
|
21927
|
+
const content = await (0, import_promises8.readFile)(marketplaceJsonPluginPath, "utf-8");
|
|
21079
21928
|
const marketplaceData = JSON.parse(content);
|
|
21080
21929
|
if (!validateMarketplaceJson(marketplaceData)) {
|
|
21081
21930
|
throw new Error("Invalid marketplace.json format");
|
|
@@ -21126,7 +21975,7 @@ function validateManifest(manifest, contextLabel) {
|
|
|
21126
21975
|
if (manifest.format === "claude" && manifest.subtype === "skill") {
|
|
21127
21976
|
const filePaths = normalizeFilePaths2(manifest.files);
|
|
21128
21977
|
const hasSkillMd = filePaths.some(
|
|
21129
|
-
(
|
|
21978
|
+
(path12) => path12.endsWith("/SKILL.md") || path12 === "SKILL.md"
|
|
21130
21979
|
);
|
|
21131
21980
|
const mdFiles = filePaths.filter((filePath) => {
|
|
21132
21981
|
var _a2;
|
|
@@ -21235,10 +22084,10 @@ function getSafePackageName(manifest, userInfo, fallbackName) {
|
|
|
21235
22084
|
|
|
21236
22085
|
// src/utils/tarball-creator.ts
|
|
21237
22086
|
init_cjs_shims();
|
|
21238
|
-
var
|
|
21239
|
-
var
|
|
21240
|
-
var
|
|
21241
|
-
var
|
|
22087
|
+
var import_promises9 = require("fs/promises");
|
|
22088
|
+
var import_path20 = require("path");
|
|
22089
|
+
var tar3 = __toESM(require("tar"));
|
|
22090
|
+
var import_os6 = require("os");
|
|
21242
22091
|
var import_crypto2 = require("crypto");
|
|
21243
22092
|
var RELOCATION_CONFIG = {
|
|
21244
22093
|
claude: {
|
|
@@ -21326,12 +22175,12 @@ var RELOCATION_CONFIG = {
|
|
|
21326
22175
|
}
|
|
21327
22176
|
};
|
|
21328
22177
|
async function createTarball(manifest) {
|
|
21329
|
-
const tmpDir = (0,
|
|
21330
|
-
const tarballPath = (0,
|
|
21331
|
-
const stagingDir = (0,
|
|
22178
|
+
const tmpDir = (0, import_path20.join)((0, import_os6.tmpdir)(), `prpm-${(0, import_crypto2.randomBytes)(8).toString("hex")}`);
|
|
22179
|
+
const tarballPath = (0, import_path20.join)(tmpDir, "package.tar.gz");
|
|
22180
|
+
const stagingDir = (0, import_path20.join)(tmpDir, "staging");
|
|
21332
22181
|
try {
|
|
21333
|
-
await (0,
|
|
21334
|
-
await (0,
|
|
22182
|
+
await (0, import_promises9.mkdir)(tmpDir, { recursive: true });
|
|
22183
|
+
await (0, import_promises9.mkdir)(stagingDir, { recursive: true });
|
|
21335
22184
|
const filePaths = normalizeFilePaths2(manifest.files);
|
|
21336
22185
|
const standardFiles = ["prpm.json", "README.md", "LICENSE"];
|
|
21337
22186
|
for (const file of standardFiles) {
|
|
@@ -21343,18 +22192,18 @@ async function createTarball(manifest) {
|
|
|
21343
22192
|
const fileRenames = /* @__PURE__ */ new Map();
|
|
21344
22193
|
if (manifest.format === "claude" && manifest.subtype === "skill") {
|
|
21345
22194
|
const hasSkillMd = filePaths.some(
|
|
21346
|
-
(
|
|
22195
|
+
(path12) => path12.endsWith("/SKILL.md") || path12 === "SKILL.md"
|
|
21347
22196
|
);
|
|
21348
22197
|
if (!hasSkillMd) {
|
|
21349
22198
|
const mdFiles = filePaths.filter(
|
|
21350
|
-
(
|
|
22199
|
+
(path12) => path12.endsWith(".md") && !path12.toLowerCase().includes("readme")
|
|
21351
22200
|
);
|
|
21352
22201
|
if (mdFiles.length === 1) {
|
|
21353
22202
|
const file = mdFiles[0];
|
|
21354
22203
|
try {
|
|
21355
|
-
await (0,
|
|
21356
|
-
const dir = (0,
|
|
21357
|
-
const newPath = dir === "." ? "SKILL.md" : (0,
|
|
22204
|
+
await (0, import_promises9.stat)(file);
|
|
22205
|
+
const dir = (0, import_path20.dirname)(file);
|
|
22206
|
+
const newPath = dir === "." ? "SKILL.md" : (0, import_path20.join)(dir, "SKILL.md");
|
|
21358
22207
|
fileRenames.set(file, newPath);
|
|
21359
22208
|
console.log(` \u{1F4DD} Renaming ${file} \u2192 ${newPath}`);
|
|
21360
22209
|
} catch {
|
|
@@ -21366,20 +22215,20 @@ async function createTarball(manifest) {
|
|
|
21366
22215
|
const subtypeConfig = formatConfig == null ? void 0 : formatConfig[manifest.subtype || "rule"];
|
|
21367
22216
|
if (subtypeConfig) {
|
|
21368
22217
|
const contentFiles = filePaths.filter(
|
|
21369
|
-
(
|
|
22218
|
+
(path12) => !path12.toLowerCase().includes("readme") && !path12.toLowerCase().includes("license") && path12 !== "prpm.json" && (path12.endsWith(".md") || path12.endsWith(".mdc") || path12.endsWith(".json"))
|
|
21370
22219
|
);
|
|
21371
22220
|
for (const file of contentFiles) {
|
|
21372
22221
|
if (file.includes(subtypeConfig.checkPath)) {
|
|
21373
22222
|
continue;
|
|
21374
22223
|
}
|
|
21375
22224
|
try {
|
|
21376
|
-
await (0,
|
|
21377
|
-
let fileName = (0,
|
|
22225
|
+
await (0, import_promises9.stat)(file);
|
|
22226
|
+
let fileName = (0, import_path20.basename)(file);
|
|
21378
22227
|
if (subtypeConfig.extension) {
|
|
21379
22228
|
const nameWithoutExt = fileName.replace(/\.[^.]+$/, "");
|
|
21380
22229
|
fileName = nameWithoutExt + subtypeConfig.extension;
|
|
21381
22230
|
}
|
|
21382
|
-
const newPath = (0,
|
|
22231
|
+
const newPath = (0, import_path20.join)(subtypeConfig.directory, fileName);
|
|
21383
22232
|
fileRenames.set(file, newPath);
|
|
21384
22233
|
console.log(` \u{1F4DD} Relocating ${file} \u2192 ${newPath}`);
|
|
21385
22234
|
} catch {
|
|
@@ -21388,11 +22237,11 @@ async function createTarball(manifest) {
|
|
|
21388
22237
|
}
|
|
21389
22238
|
for (const file of filePaths) {
|
|
21390
22239
|
try {
|
|
21391
|
-
await (0,
|
|
22240
|
+
await (0, import_promises9.stat)(file);
|
|
21392
22241
|
const targetPath = fileRenames.get(file) || file;
|
|
21393
|
-
const stagingPath = (0,
|
|
21394
|
-
await (0,
|
|
21395
|
-
await (0,
|
|
22242
|
+
const stagingPath = (0, import_path20.join)(stagingDir, targetPath);
|
|
22243
|
+
await (0, import_promises9.mkdir)((0, import_path20.dirname)(stagingPath), { recursive: true });
|
|
22244
|
+
await (0, import_promises9.copyFile)(file, stagingPath);
|
|
21396
22245
|
existingFiles.push(targetPath);
|
|
21397
22246
|
} catch {
|
|
21398
22247
|
}
|
|
@@ -21400,7 +22249,7 @@ async function createTarball(manifest) {
|
|
|
21400
22249
|
if (existingFiles.length === 0) {
|
|
21401
22250
|
throw new Error("No package files found to include in tarball");
|
|
21402
22251
|
}
|
|
21403
|
-
await
|
|
22252
|
+
await tar3.create(
|
|
21404
22253
|
{
|
|
21405
22254
|
gzip: true,
|
|
21406
22255
|
file: tarballPath,
|
|
@@ -21408,7 +22257,7 @@ async function createTarball(manifest) {
|
|
|
21408
22257
|
},
|
|
21409
22258
|
existingFiles
|
|
21410
22259
|
);
|
|
21411
|
-
const tarballBuffer = await (0,
|
|
22260
|
+
const tarballBuffer = await (0, import_promises9.readFile)(tarballPath);
|
|
21412
22261
|
const sizeMB = tarballBuffer.length / (1024 * 1024);
|
|
21413
22262
|
if (sizeMB > 10) {
|
|
21414
22263
|
throw new Error(
|
|
@@ -21420,7 +22269,7 @@ async function createTarball(manifest) {
|
|
|
21420
22269
|
throw error;
|
|
21421
22270
|
} finally {
|
|
21422
22271
|
try {
|
|
21423
|
-
await (0,
|
|
22272
|
+
await (0, import_promises9.rm)(tmpDir, { recursive: true, force: true });
|
|
21424
22273
|
} catch {
|
|
21425
22274
|
}
|
|
21426
22275
|
}
|
|
@@ -21513,13 +22362,13 @@ async function handlePublish(options) {
|
|
|
21513
22362
|
console.log("\u{1F916} CI Mode: Publishing without authentication\n");
|
|
21514
22363
|
}
|
|
21515
22364
|
console.log("\u{1F4E6} Publishing package...\n");
|
|
21516
|
-
const prpmJsonPath = (0,
|
|
21517
|
-
const marketplaceJsonPath = (0,
|
|
22365
|
+
const prpmJsonPath = (0, import_path24.join)(process.cwd(), "prpm.json");
|
|
22366
|
+
const marketplaceJsonPath = (0, import_path24.join)(
|
|
21518
22367
|
process.cwd(),
|
|
21519
22368
|
".claude",
|
|
21520
22369
|
"marketplace.json"
|
|
21521
22370
|
);
|
|
21522
|
-
const marketplaceJsonPluginPath = (0,
|
|
22371
|
+
const marketplaceJsonPluginPath = (0, import_path24.join)(
|
|
21523
22372
|
process.cwd(),
|
|
21524
22373
|
".claude-plugin",
|
|
21525
22374
|
"marketplace.json"
|
|
@@ -21540,8 +22389,8 @@ async function handlePublish(options) {
|
|
|
21540
22389
|
const { manifests, collections, source } = await findAndLoadManifests();
|
|
21541
22390
|
if (source === "prpm.json (multi-package)" || source === "prpm.json") {
|
|
21542
22391
|
try {
|
|
21543
|
-
const prpmJsonPath2 = (0,
|
|
21544
|
-
const prpmContent = await (0,
|
|
22392
|
+
const prpmJsonPath2 = (0, import_path24.join)(process.cwd(), "prpm.json");
|
|
22393
|
+
const prpmContent = await (0, import_promises11.readFile)(prpmJsonPath2, "utf-8");
|
|
21545
22394
|
const prpmManifest = JSON.parse(prpmContent);
|
|
21546
22395
|
if (prpmManifest.scripts) {
|
|
21547
22396
|
await executePrepublishOnly(prpmManifest.scripts);
|
|
@@ -21585,7 +22434,7 @@ async function handlePublish(options) {
|
|
|
21585
22434
|
`);
|
|
21586
22435
|
}
|
|
21587
22436
|
console.log("\u{1F50D} Checking authentication...");
|
|
21588
|
-
const client = (0,
|
|
22437
|
+
const client = (0, import_registry_client7.getRegistryClient)(config);
|
|
21589
22438
|
let userInfo;
|
|
21590
22439
|
try {
|
|
21591
22440
|
userInfo = await client.whoami();
|
|
@@ -22130,7 +22979,7 @@ ${"=".repeat(60)}`);
|
|
|
22130
22979
|
}
|
|
22131
22980
|
}
|
|
22132
22981
|
function createPublishCommand() {
|
|
22133
|
-
return new
|
|
22982
|
+
return new import_commander14.Command("publish").description("Publish packages and collections to the registry").option(
|
|
22134
22983
|
"--access <type>",
|
|
22135
22984
|
"Package access (public or private) - overrides manifest setting"
|
|
22136
22985
|
).option("--tag <tag>", "NPM-style tag (e.g., latest, beta)", "latest").option("--dry-run", "Validate package without publishing").option(
|
|
@@ -22146,8 +22995,8 @@ function createPublishCommand() {
|
|
|
22146
22995
|
|
|
22147
22996
|
// src/commands/deprecate.ts
|
|
22148
22997
|
init_cjs_shims();
|
|
22149
|
-
var
|
|
22150
|
-
var
|
|
22998
|
+
var import_commander15 = require("commander");
|
|
22999
|
+
var import_registry_client8 = require("@pr-pm/registry-client");
|
|
22151
23000
|
init_user_config();
|
|
22152
23001
|
init_telemetry();
|
|
22153
23002
|
init_errors();
|
|
@@ -22162,7 +23011,7 @@ async function handleDeprecate(packageName, options) {
|
|
|
22162
23011
|
if (!config.token) {
|
|
22163
23012
|
throw new CLIError("\u274C Authentication required. Run `prpm login` first.", 1);
|
|
22164
23013
|
}
|
|
22165
|
-
const client = (0,
|
|
23014
|
+
const client = (0, import_registry_client8.getRegistryClient)(config);
|
|
22166
23015
|
const action = options.undo ? "Undeprecating" : "Deprecating";
|
|
22167
23016
|
console.log(`\u26A0\uFE0F ${action} package: ${packageName}...
|
|
22168
23017
|
`);
|
|
@@ -22210,7 +23059,7 @@ async function handleDeprecate(packageName, options) {
|
|
|
22210
23059
|
}
|
|
22211
23060
|
}
|
|
22212
23061
|
function createDeprecateCommand() {
|
|
22213
|
-
const command = new
|
|
23062
|
+
const command = new import_commander15.Command("deprecate");
|
|
22214
23063
|
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
23064
|
await handleDeprecate(packageName, options);
|
|
22216
23065
|
});
|
|
@@ -22219,8 +23068,8 @@ function createDeprecateCommand() {
|
|
|
22219
23068
|
|
|
22220
23069
|
// src/commands/visibility.ts
|
|
22221
23070
|
init_cjs_shims();
|
|
22222
|
-
var
|
|
22223
|
-
var
|
|
23071
|
+
var import_commander16 = require("commander");
|
|
23072
|
+
var import_registry_client9 = require("@pr-pm/registry-client");
|
|
22224
23073
|
init_user_config();
|
|
22225
23074
|
init_telemetry();
|
|
22226
23075
|
init_errors();
|
|
@@ -22241,7 +23090,7 @@ async function handleVisibility(packageName, options) {
|
|
|
22241
23090
|
throw new CLIError("\u274C Must specify either --public or --private", 1);
|
|
22242
23091
|
}
|
|
22243
23092
|
visibility = options.public ? "public" : "private";
|
|
22244
|
-
const client = (0,
|
|
23093
|
+
const client = (0, import_registry_client9.getRegistryClient)(config);
|
|
22245
23094
|
console.log(`\u{1F504} Setting package visibility: ${packageName} -> ${visibility}...
|
|
22246
23095
|
`);
|
|
22247
23096
|
const result = await client.setPackageVisibility(packageName, visibility);
|
|
@@ -22284,7 +23133,7 @@ async function handleVisibility(packageName, options) {
|
|
|
22284
23133
|
}
|
|
22285
23134
|
}
|
|
22286
23135
|
function createVisibilityCommand() {
|
|
22287
|
-
const command = new
|
|
23136
|
+
const command = new import_commander16.Command("visibility");
|
|
22288
23137
|
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
23138
|
await handleVisibility(packageName, options);
|
|
22290
23139
|
});
|
|
@@ -22293,7 +23142,7 @@ function createVisibilityCommand() {
|
|
|
22293
23142
|
|
|
22294
23143
|
// src/commands/login.ts
|
|
22295
23144
|
init_cjs_shims();
|
|
22296
|
-
var
|
|
23145
|
+
var import_commander17 = require("commander");
|
|
22297
23146
|
var jwt = __toESM(require("jsonwebtoken"));
|
|
22298
23147
|
init_telemetry();
|
|
22299
23148
|
init_user_config();
|
|
@@ -22460,16 +23309,16 @@ async function handleLogin(options) {
|
|
|
22460
23309
|
}
|
|
22461
23310
|
}
|
|
22462
23311
|
function createLoginCommand() {
|
|
22463
|
-
return new
|
|
23312
|
+
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
23313
|
await handleLogin(options);
|
|
22465
23314
|
});
|
|
22466
23315
|
}
|
|
22467
23316
|
|
|
22468
23317
|
// src/commands/whoami.ts
|
|
22469
23318
|
init_cjs_shims();
|
|
22470
|
-
var
|
|
23319
|
+
var import_commander18 = require("commander");
|
|
22471
23320
|
init_user_config();
|
|
22472
|
-
var
|
|
23321
|
+
var import_registry_client10 = require("@pr-pm/registry-client");
|
|
22473
23322
|
init_telemetry();
|
|
22474
23323
|
init_errors();
|
|
22475
23324
|
async function handleWhoami() {
|
|
@@ -22485,7 +23334,7 @@ async function handleWhoami() {
|
|
|
22485
23334
|
return;
|
|
22486
23335
|
}
|
|
22487
23336
|
try {
|
|
22488
|
-
const client = (0,
|
|
23337
|
+
const client = (0, import_registry_client10.getRegistryClient)(config);
|
|
22489
23338
|
const userProfile = await client.getUserProfile(config.username);
|
|
22490
23339
|
console.log(`
|
|
22491
23340
|
\u{1F464} ${userProfile.username}${userProfile.verified_author ? " \u2713" : ""}`);
|
|
@@ -22525,7 +23374,7 @@ async function handleWhoami() {
|
|
|
22525
23374
|
}
|
|
22526
23375
|
}
|
|
22527
23376
|
function createWhoamiCommand() {
|
|
22528
|
-
return new
|
|
23377
|
+
return new import_commander18.Command("whoami").description("Show current logged-in user").action(async () => {
|
|
22529
23378
|
await handleWhoami();
|
|
22530
23379
|
});
|
|
22531
23380
|
}
|
|
@@ -22535,8 +23384,8 @@ init_collections();
|
|
|
22535
23384
|
|
|
22536
23385
|
// src/commands/outdated.ts
|
|
22537
23386
|
init_cjs_shims();
|
|
22538
|
-
var
|
|
22539
|
-
var
|
|
23387
|
+
var import_commander19 = require("commander");
|
|
23388
|
+
var import_registry_client11 = require("@pr-pm/registry-client");
|
|
22540
23389
|
init_user_config();
|
|
22541
23390
|
init_lockfile();
|
|
22542
23391
|
init_telemetry();
|
|
@@ -22548,7 +23397,7 @@ async function handleOutdated() {
|
|
|
22548
23397
|
try {
|
|
22549
23398
|
console.log("\u{1F50D} Checking for package updates...\n");
|
|
22550
23399
|
const config = await getConfig();
|
|
22551
|
-
const client = (0,
|
|
23400
|
+
const client = (0, import_registry_client11.getRegistryClient)(config);
|
|
22552
23401
|
const installedPackages = await listPackages();
|
|
22553
23402
|
if (installedPackages.length === 0) {
|
|
22554
23403
|
console.log("No packages installed.");
|
|
@@ -22638,15 +23487,15 @@ function getUpdateType(current, latest) {
|
|
|
22638
23487
|
return "patch";
|
|
22639
23488
|
}
|
|
22640
23489
|
function createOutdatedCommand() {
|
|
22641
|
-
return new
|
|
23490
|
+
return new import_commander19.Command("outdated").description("Check for package updates").action(async () => {
|
|
22642
23491
|
await handleOutdated();
|
|
22643
23492
|
});
|
|
22644
23493
|
}
|
|
22645
23494
|
|
|
22646
23495
|
// src/commands/update.ts
|
|
22647
23496
|
init_cjs_shims();
|
|
22648
|
-
var
|
|
22649
|
-
var
|
|
23497
|
+
var import_commander20 = require("commander");
|
|
23498
|
+
var import_registry_client12 = require("@pr-pm/registry-client");
|
|
22650
23499
|
init_user_config();
|
|
22651
23500
|
init_lockfile();
|
|
22652
23501
|
init_install();
|
|
@@ -22659,7 +23508,7 @@ async function handleUpdate(packageName, options = {}) {
|
|
|
22659
23508
|
let updatedCount = 0;
|
|
22660
23509
|
try {
|
|
22661
23510
|
const config = await getConfig();
|
|
22662
|
-
const client = (0,
|
|
23511
|
+
const client = (0, import_registry_client12.getRegistryClient)(config);
|
|
22663
23512
|
const installedPackages = await listPackages();
|
|
22664
23513
|
if (installedPackages.length === 0) {
|
|
22665
23514
|
console.log("No packages installed.");
|
|
@@ -22751,7 +23600,7 @@ function getUpdateType2(current, latest) {
|
|
|
22751
23600
|
return "patch";
|
|
22752
23601
|
}
|
|
22753
23602
|
function createUpdateCommand() {
|
|
22754
|
-
return new
|
|
23603
|
+
return new import_commander20.Command("update").description(
|
|
22755
23604
|
"Update packages to latest compatible versions (minor/patch only)"
|
|
22756
23605
|
).argument("[package]", "Specific package to update (optional)").option("--all", "Update all packages").action(async (packageName, options) => {
|
|
22757
23606
|
await handleUpdate(packageName, options);
|
|
@@ -22760,8 +23609,8 @@ function createUpdateCommand() {
|
|
|
22760
23609
|
|
|
22761
23610
|
// src/commands/upgrade.ts
|
|
22762
23611
|
init_cjs_shims();
|
|
22763
|
-
var
|
|
22764
|
-
var
|
|
23612
|
+
var import_commander21 = require("commander");
|
|
23613
|
+
var import_registry_client13 = require("@pr-pm/registry-client");
|
|
22765
23614
|
init_user_config();
|
|
22766
23615
|
init_lockfile();
|
|
22767
23616
|
init_install();
|
|
@@ -22775,7 +23624,7 @@ async function handleUpgrade(packageName, options = {}) {
|
|
|
22775
23624
|
let upgradedCount = 0;
|
|
22776
23625
|
try {
|
|
22777
23626
|
const config = await getConfig();
|
|
22778
|
-
const client = (0,
|
|
23627
|
+
const client = (0, import_registry_client13.getRegistryClient)(config);
|
|
22779
23628
|
const installedPackages = await listPackages();
|
|
22780
23629
|
if (installedPackages.length === 0) {
|
|
22781
23630
|
console.log("No packages installed.");
|
|
@@ -22942,7 +23791,7 @@ function getUpdateType3(current, latest) {
|
|
|
22942
23791
|
return "patch";
|
|
22943
23792
|
}
|
|
22944
23793
|
function createUpgradeCommand() {
|
|
22945
|
-
return new
|
|
23794
|
+
return new import_commander21.Command("upgrade").description(
|
|
22946
23795
|
"Upgrade packages to latest versions (including major updates)"
|
|
22947
23796
|
).argument("[package]", "Specific package to upgrade (optional)").option("--all", "Upgrade all packages").option("--force", "Skip warning for major version upgrades").action(
|
|
22948
23797
|
async (packageName, options) => {
|
|
@@ -22953,7 +23802,7 @@ function createUpgradeCommand() {
|
|
|
22953
23802
|
|
|
22954
23803
|
// src/commands/schema.ts
|
|
22955
23804
|
init_cjs_shims();
|
|
22956
|
-
var
|
|
23805
|
+
var import_commander22 = require("commander");
|
|
22957
23806
|
init_errors();
|
|
22958
23807
|
async function handleSchema() {
|
|
22959
23808
|
try {
|
|
@@ -22970,7 +23819,7 @@ async function handleSchema() {
|
|
|
22970
23819
|
}
|
|
22971
23820
|
}
|
|
22972
23821
|
function createSchemaCommand() {
|
|
22973
|
-
const command = new
|
|
23822
|
+
const command = new import_commander22.Command("schema");
|
|
22974
23823
|
command.description("Display the PRPM manifest JSON schema").action(async () => {
|
|
22975
23824
|
await handleSchema();
|
|
22976
23825
|
});
|
|
@@ -22982,7 +23831,7 @@ init_init();
|
|
|
22982
23831
|
|
|
22983
23832
|
// src/commands/config.ts
|
|
22984
23833
|
init_cjs_shims();
|
|
22985
|
-
var
|
|
23834
|
+
var import_commander23 = require("commander");
|
|
22986
23835
|
init_user_config();
|
|
22987
23836
|
init_errors();
|
|
22988
23837
|
async function handleConfigGet(key) {
|
|
@@ -23073,7 +23922,7 @@ async function handleConfigDelete(key) {
|
|
|
23073
23922
|
}
|
|
23074
23923
|
}
|
|
23075
23924
|
function createConfigCommand() {
|
|
23076
|
-
const command = new
|
|
23925
|
+
const command = new import_commander23.Command("config").description("Manage CLI configuration");
|
|
23077
23926
|
command.command("list").alias("ls").description("List all configuration values").action(async () => {
|
|
23078
23927
|
await handleConfigList();
|
|
23079
23928
|
});
|
|
@@ -23094,9 +23943,9 @@ function createConfigCommand() {
|
|
|
23094
23943
|
|
|
23095
23944
|
// src/commands/catalog.ts
|
|
23096
23945
|
init_cjs_shims();
|
|
23097
|
-
var
|
|
23946
|
+
var import_commander24 = require("commander");
|
|
23098
23947
|
function createCatalogCommand() {
|
|
23099
|
-
return new
|
|
23948
|
+
return new import_commander24.Command("catalog").description(
|
|
23100
23949
|
"[DEPRECATED] Use 'prpm init --scan' instead. Discover and catalog packages."
|
|
23101
23950
|
).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
23951
|
async (directories, options) => {
|
|
@@ -23135,12 +23984,12 @@ function createCatalogCommand() {
|
|
|
23135
23984
|
|
|
23136
23985
|
// src/commands/playground.ts
|
|
23137
23986
|
init_cjs_shims();
|
|
23138
|
-
var
|
|
23987
|
+
var import_commander25 = require("commander");
|
|
23139
23988
|
init_user_config();
|
|
23140
23989
|
init_telemetry();
|
|
23141
23990
|
var readline5 = __toESM(require("readline"));
|
|
23142
|
-
var
|
|
23143
|
-
var
|
|
23991
|
+
var fs14 = __toESM(require("fs"));
|
|
23992
|
+
var path11 = __toESM(require("path"));
|
|
23144
23993
|
init_errors();
|
|
23145
23994
|
function createReadline() {
|
|
23146
23995
|
return readline5.createInterface({
|
|
@@ -23258,11 +24107,11 @@ async function runCustomPrompt(customPrompt, input2, options, sessionId) {
|
|
|
23258
24107
|
return response.json();
|
|
23259
24108
|
}
|
|
23260
24109
|
function readPromptFile(filePath) {
|
|
23261
|
-
const absolutePath =
|
|
23262
|
-
if (!
|
|
24110
|
+
const absolutePath = path11.resolve(filePath);
|
|
24111
|
+
if (!fs14.existsSync(absolutePath)) {
|
|
23263
24112
|
throw new Error(`Prompt file not found: ${filePath}`);
|
|
23264
24113
|
}
|
|
23265
|
-
return
|
|
24114
|
+
return fs14.readFileSync(absolutePath, "utf-8");
|
|
23266
24115
|
}
|
|
23267
24116
|
function displayResponse(result, showStats = true) {
|
|
23268
24117
|
const lastMessage = result.conversation[result.conversation.length - 1];
|
|
@@ -23575,7 +24424,7 @@ async function handlePlayground(options) {
|
|
|
23575
24424
|
}
|
|
23576
24425
|
}
|
|
23577
24426
|
function createPlaygroundCommand() {
|
|
23578
|
-
const command = new
|
|
24427
|
+
const command = new import_commander25.Command("playground");
|
|
23579
24428
|
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
24429
|
"-m, --model <model>",
|
|
23581
24430
|
"AI model to use (sonnet, opus, gpt-4o, gpt-4o-mini, gpt-4-turbo)",
|
|
@@ -23644,7 +24493,7 @@ Note: Playground usage requires credits. Run 'prpm credits' to check balance.
|
|
|
23644
24493
|
|
|
23645
24494
|
// src/commands/credits.ts
|
|
23646
24495
|
init_cjs_shims();
|
|
23647
|
-
var
|
|
24496
|
+
var import_commander26 = require("commander");
|
|
23648
24497
|
init_user_config();
|
|
23649
24498
|
init_telemetry();
|
|
23650
24499
|
init_errors();
|
|
@@ -23771,7 +24620,7 @@ async function handleCredits(options) {
|
|
|
23771
24620
|
}
|
|
23772
24621
|
}
|
|
23773
24622
|
function createCreditsCommand() {
|
|
23774
|
-
const command = new
|
|
24623
|
+
const command = new import_commander26.Command("credits");
|
|
23775
24624
|
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
24625
|
"after",
|
|
23777
24626
|
`
|
|
@@ -23806,7 +24655,7 @@ Get more credits:
|
|
|
23806
24655
|
|
|
23807
24656
|
// src/commands/subscribe.ts
|
|
23808
24657
|
init_cjs_shims();
|
|
23809
|
-
var
|
|
24658
|
+
var import_commander27 = require("commander");
|
|
23810
24659
|
init_user_config();
|
|
23811
24660
|
init_telemetry();
|
|
23812
24661
|
var import_child_process2 = require("child_process");
|
|
@@ -23965,7 +24814,7 @@ async function handleSubscribe() {
|
|
|
23965
24814
|
}
|
|
23966
24815
|
}
|
|
23967
24816
|
function createSubscribeCommand() {
|
|
23968
|
-
const command = new
|
|
24817
|
+
const command = new import_commander27.Command("subscribe");
|
|
23969
24818
|
command.description("Subscribe to PRPM+ for monthly playground credits and benefits").addHelpText(
|
|
23970
24819
|
"after",
|
|
23971
24820
|
`
|
|
@@ -24006,7 +24855,7 @@ Note: You can cancel anytime from https://prpm.dev/settings/billing
|
|
|
24006
24855
|
|
|
24007
24856
|
// src/commands/buy-credits.ts
|
|
24008
24857
|
init_cjs_shims();
|
|
24009
|
-
var
|
|
24858
|
+
var import_commander28 = require("commander");
|
|
24010
24859
|
init_user_config();
|
|
24011
24860
|
init_telemetry();
|
|
24012
24861
|
var import_child_process3 = require("child_process");
|
|
@@ -24147,7 +24996,7 @@ async function handleBuyCredits(options) {
|
|
|
24147
24996
|
}
|
|
24148
24997
|
}
|
|
24149
24998
|
function createBuyCreditsCommand() {
|
|
24150
|
-
const command = new
|
|
24999
|
+
const command = new import_commander28.Command("buy-credits");
|
|
24151
25000
|
command.description("Purchase one-time playground credits (never expire)").option(
|
|
24152
25001
|
"-p, --package <package>",
|
|
24153
25002
|
"Credit package to purchase (small, medium, large)"
|
|
@@ -24200,8 +25049,8 @@ Note: Purchased credits are one-time and never expire, unlike monthly credits.
|
|
|
24200
25049
|
|
|
24201
25050
|
// src/commands/starred.ts
|
|
24202
25051
|
init_cjs_shims();
|
|
24203
|
-
var
|
|
24204
|
-
var
|
|
25052
|
+
var import_commander29 = require("commander");
|
|
25053
|
+
var import_registry_client14 = require("@pr-pm/registry-client");
|
|
24205
25054
|
init_user_config();
|
|
24206
25055
|
init_telemetry();
|
|
24207
25056
|
init_errors();
|
|
@@ -24214,7 +25063,7 @@ async function handleStarred(options) {
|
|
|
24214
25063
|
throw new CLIError("You must be logged in to view starred items. Run `prpm login` first.");
|
|
24215
25064
|
}
|
|
24216
25065
|
const registryUrl = config.registryUrl || process.env.PRPM_REGISTRY_URL || "https://registry.prpm.dev";
|
|
24217
|
-
const client = (0,
|
|
25066
|
+
const client = (0, import_registry_client14.getRegistryClient)({ registryUrl, token });
|
|
24218
25067
|
const showPackages = options.packages || !options.packages && !options.collections;
|
|
24219
25068
|
const showCollections = options.collections || !options.packages && !options.collections;
|
|
24220
25069
|
const limit = options.limit || 100;
|
|
@@ -24316,91 +25165,91 @@ Total: ${packages.length + collections.length} starred items`);
|
|
|
24316
25165
|
}
|
|
24317
25166
|
}
|
|
24318
25167
|
function createStarredCommand() {
|
|
24319
|
-
const command = new
|
|
25168
|
+
const command = new import_commander29.Command("starred");
|
|
24320
25169
|
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
25170
|
return command;
|
|
24322
25171
|
}
|
|
24323
25172
|
|
|
24324
25173
|
// src/commands/convert.ts
|
|
24325
25174
|
init_cjs_shims();
|
|
24326
|
-
var
|
|
24327
|
-
var
|
|
24328
|
-
var
|
|
25175
|
+
var import_commander30 = require("commander");
|
|
25176
|
+
var import_promises12 = require("fs/promises");
|
|
25177
|
+
var import_path25 = require("path");
|
|
24329
25178
|
var import_fs20 = require("fs");
|
|
24330
25179
|
var import_readline = require("readline");
|
|
24331
25180
|
init_source();
|
|
24332
25181
|
init_errors();
|
|
24333
25182
|
init_dist();
|
|
24334
25183
|
function getDefaultPath(format, filename, subtype, customName) {
|
|
24335
|
-
const baseName = customName || (0,
|
|
25184
|
+
const baseName = customName || (0, import_path25.basename)(filename, (0, import_path25.extname)(filename));
|
|
24336
25185
|
switch (format) {
|
|
24337
25186
|
case "cursor":
|
|
24338
25187
|
if (subtype === "slash-command") {
|
|
24339
|
-
return (0,
|
|
25188
|
+
return (0, import_path25.join)(process.cwd(), ".cursor", "commands", `${baseName}.md`);
|
|
24340
25189
|
}
|
|
24341
25190
|
if (subtype === "hook") {
|
|
24342
|
-
return (0,
|
|
25191
|
+
return (0, import_path25.join)(process.cwd(), ".cursor", "hooks", "hooks.json");
|
|
24343
25192
|
}
|
|
24344
|
-
return (0,
|
|
25193
|
+
return (0, import_path25.join)(process.cwd(), ".cursor", "rules", `${baseName}.mdc`);
|
|
24345
25194
|
case "claude":
|
|
24346
25195
|
if (subtype === "skill") {
|
|
24347
|
-
return (0,
|
|
25196
|
+
return (0, import_path25.join)(process.cwd(), ".claude", "skills", baseName, "SKILL.md");
|
|
24348
25197
|
} else if (subtype === "slash-command") {
|
|
24349
|
-
return (0,
|
|
25198
|
+
return (0, import_path25.join)(process.cwd(), ".claude", "commands", `${baseName}.md`);
|
|
24350
25199
|
} else {
|
|
24351
|
-
return (0,
|
|
25200
|
+
return (0, import_path25.join)(process.cwd(), ".claude", "agents", `${baseName}.md`);
|
|
24352
25201
|
}
|
|
24353
25202
|
case "windsurf":
|
|
24354
|
-
return (0,
|
|
25203
|
+
return (0, import_path25.join)(process.cwd(), ".windsurf", "rules", `${baseName}.md`);
|
|
24355
25204
|
case "kiro":
|
|
24356
25205
|
if (subtype === "hook") {
|
|
24357
|
-
return (0,
|
|
25206
|
+
return (0, import_path25.join)(process.cwd(), ".kiro", "hooks", `${baseName}.kiro.hook`);
|
|
24358
25207
|
}
|
|
24359
25208
|
if (subtype === "agent") {
|
|
24360
|
-
return (0,
|
|
25209
|
+
return (0, import_path25.join)(process.cwd(), ".kiro", "agents", `${baseName}.json`);
|
|
24361
25210
|
}
|
|
24362
|
-
return (0,
|
|
25211
|
+
return (0, import_path25.join)(process.cwd(), ".kiro", "steering", `${baseName}.md`);
|
|
24363
25212
|
case "copilot":
|
|
24364
|
-
return (0,
|
|
25213
|
+
return (0, import_path25.join)(process.cwd(), ".github", "instructions", `${baseName}.instructions.md`);
|
|
24365
25214
|
case "continue":
|
|
24366
25215
|
if (subtype === "slash-command" || subtype === "prompt") {
|
|
24367
|
-
return (0,
|
|
25216
|
+
return (0, import_path25.join)(process.cwd(), ".continue", "prompts", `${baseName}.md`);
|
|
24368
25217
|
}
|
|
24369
|
-
return (0,
|
|
25218
|
+
return (0, import_path25.join)(process.cwd(), ".continue", "rules", `${baseName}.md`);
|
|
24370
25219
|
case "agents.md":
|
|
24371
|
-
return (0,
|
|
25220
|
+
return (0, import_path25.join)(process.cwd(), "agents.md");
|
|
24372
25221
|
case "gemini":
|
|
24373
|
-
return (0,
|
|
25222
|
+
return (0, import_path25.join)(process.cwd(), ".gemini", "commands", `${baseName}.toml`);
|
|
24374
25223
|
case "ruler":
|
|
24375
|
-
return (0,
|
|
25224
|
+
return (0, import_path25.join)(process.cwd(), ".ruler", `${baseName}.md`);
|
|
24376
25225
|
case "zed":
|
|
24377
25226
|
if (subtype === "slash-command") {
|
|
24378
|
-
return (0,
|
|
25227
|
+
return (0, import_path25.join)(process.cwd(), ".zed", "slash_commands", `${baseName}.md`);
|
|
24379
25228
|
}
|
|
24380
|
-
return (0,
|
|
25229
|
+
return (0, import_path25.join)(process.cwd(), ".zed", "extensions", `${baseName}.json`);
|
|
24381
25230
|
case "opencode":
|
|
24382
|
-
return (0,
|
|
25231
|
+
return (0, import_path25.join)(process.cwd(), ".opencode", `${baseName}.md`);
|
|
24383
25232
|
case "aider":
|
|
24384
|
-
return (0,
|
|
25233
|
+
return (0, import_path25.join)(process.cwd(), ".aider", `${baseName}.md`);
|
|
24385
25234
|
case "trae":
|
|
24386
|
-
return (0,
|
|
25235
|
+
return (0, import_path25.join)(process.cwd(), ".trae", "rules", `${baseName}.md`);
|
|
24387
25236
|
case "replit":
|
|
24388
|
-
return (0,
|
|
25237
|
+
return (0, import_path25.join)(process.cwd(), ".replit", `${baseName}.md`);
|
|
24389
25238
|
case "zencoder":
|
|
24390
|
-
return (0,
|
|
25239
|
+
return (0, import_path25.join)(process.cwd(), ".zencoder", `${baseName}.md`);
|
|
24391
25240
|
case "droid":
|
|
24392
|
-
return (0,
|
|
25241
|
+
return (0, import_path25.join)(process.cwd(), ".factory", `${baseName}.md`);
|
|
24393
25242
|
case "codex":
|
|
24394
25243
|
if (subtype === "skill") {
|
|
24395
|
-
return (0,
|
|
25244
|
+
return (0, import_path25.join)(process.cwd(), ".codex", "skills", baseName, "SKILL.md");
|
|
24396
25245
|
}
|
|
24397
|
-
return (0,
|
|
25246
|
+
return (0, import_path25.join)(process.cwd(), "AGENTS.md");
|
|
24398
25247
|
default:
|
|
24399
25248
|
throw new CLIError(`Unknown format: ${format}`);
|
|
24400
25249
|
}
|
|
24401
25250
|
}
|
|
24402
25251
|
function detectFormat(content, filepath) {
|
|
24403
|
-
const ext = (0,
|
|
25252
|
+
const ext = (0, import_path25.extname)(filepath).toLowerCase();
|
|
24404
25253
|
if (ext === ".mdc" || filepath.includes(".cursor/rules") || filepath.includes(".cursor/commands")) {
|
|
24405
25254
|
return "cursor";
|
|
24406
25255
|
}
|
|
@@ -24422,10 +25271,10 @@ function detectFormat(content, filepath) {
|
|
|
24422
25271
|
if (filepath.includes(".continue/rules") || filepath.includes(".continue/prompts") || filepath.includes(".continuerules")) {
|
|
24423
25272
|
return "continue";
|
|
24424
25273
|
}
|
|
24425
|
-
if ((0,
|
|
25274
|
+
if ((0, import_path25.basename)(filepath) === "agents.md") {
|
|
24426
25275
|
return "agents.md";
|
|
24427
25276
|
}
|
|
24428
|
-
if ((0,
|
|
25277
|
+
if ((0, import_path25.basename)(filepath) === "gemini-extension.json" || filepath.includes(".gemini/extensions")) {
|
|
24429
25278
|
return "gemini-extension";
|
|
24430
25279
|
}
|
|
24431
25280
|
if (ext === ".toml" || filepath.includes(".gemini/commands")) {
|
|
@@ -24478,7 +25327,7 @@ async function handleConvert(sourcePath, options) {
|
|
|
24478
25327
|
console.log(source_default.dim("Reading source file..."));
|
|
24479
25328
|
let content;
|
|
24480
25329
|
try {
|
|
24481
|
-
content = await (0,
|
|
25330
|
+
content = await (0, import_promises12.readFile)(sourcePath, "utf-8");
|
|
24482
25331
|
} catch (error) {
|
|
24483
25332
|
throw new CLIError(`Failed to read source file: ${error.message}`);
|
|
24484
25333
|
}
|
|
@@ -24514,7 +25363,7 @@ async function handleConvert(sourcePath, options) {
|
|
|
24514
25363
|
}
|
|
24515
25364
|
canonicalPkg = fromCursor(content, metadata, {
|
|
24516
25365
|
resolveFiles: hasFileReferences,
|
|
24517
|
-
basePath: hasFileReferences ? (0,
|
|
25366
|
+
basePath: hasFileReferences ? (0, import_path25.dirname)(sourcePath) : void 0
|
|
24518
25367
|
});
|
|
24519
25368
|
break;
|
|
24520
25369
|
case "cursor-hooks":
|
|
@@ -24671,10 +25520,10 @@ async function handleConvert(sourcePath, options) {
|
|
|
24671
25520
|
return;
|
|
24672
25521
|
}
|
|
24673
25522
|
}
|
|
24674
|
-
const outputDir = (0,
|
|
24675
|
-
await (0,
|
|
25523
|
+
const outputDir = (0, import_path25.dirname)(outputPath);
|
|
25524
|
+
await (0, import_promises12.mkdir)(outputDir, { recursive: true });
|
|
24676
25525
|
console.log(source_default.dim("Writing converted file..."));
|
|
24677
|
-
await (0,
|
|
25526
|
+
await (0, import_promises12.writeFile)(outputPath, result.content, "utf-8");
|
|
24678
25527
|
console.log(source_default.green(`\u2713 Converted file written to ${outputPath}`));
|
|
24679
25528
|
console.log();
|
|
24680
25529
|
if (options.to === "cursor") {
|
|
@@ -24698,7 +25547,7 @@ async function handleConvert(sourcePath, options) {
|
|
|
24698
25547
|
}
|
|
24699
25548
|
}
|
|
24700
25549
|
function createConvertCommand() {
|
|
24701
|
-
const command = new
|
|
25550
|
+
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
25551
|
try {
|
|
24703
25552
|
if (!options.to) {
|
|
24704
25553
|
throw new CLIError("Target format is required. Use --to <format>");
|
|
@@ -24747,9 +25596,9 @@ Valid subtypes: ${validSubtypes.join(", ")}`
|
|
|
24747
25596
|
|
|
24748
25597
|
// src/commands/export.ts
|
|
24749
25598
|
init_cjs_shims();
|
|
24750
|
-
var
|
|
25599
|
+
var import_commander31 = require("commander");
|
|
24751
25600
|
var import_fs21 = require("fs");
|
|
24752
|
-
var
|
|
25601
|
+
var import_path26 = require("path");
|
|
24753
25602
|
init_source();
|
|
24754
25603
|
init_errors();
|
|
24755
25604
|
init_lockfile();
|
|
@@ -24765,7 +25614,7 @@ async function exportToRuler(options) {
|
|
|
24765
25614
|
}
|
|
24766
25615
|
console.log(source_default.green(`\u2713 Found ${packages.length} installed package${packages.length === 1 ? "" : "s"}`));
|
|
24767
25616
|
console.log();
|
|
24768
|
-
const outputDir = options.output || (0,
|
|
25617
|
+
const outputDir = options.output || (0, import_path26.join)(process.cwd(), ".ruler");
|
|
24769
25618
|
let rulerExists = false;
|
|
24770
25619
|
try {
|
|
24771
25620
|
await import_fs21.promises.access(outputDir);
|
|
@@ -24792,7 +25641,7 @@ async function exportToRuler(options) {
|
|
|
24792
25641
|
const content = await import_fs21.promises.readFile(pkg.installedPath, "utf-8");
|
|
24793
25642
|
const rulerContent = createRulerFormat(pkg.id, pkg.version, content, pkg.format, pkg.subtype);
|
|
24794
25643
|
const rulerFilename = `${packageName}.md`;
|
|
24795
|
-
const rulerPath = (0,
|
|
25644
|
+
const rulerPath = (0, import_path26.join)(outputDir, rulerFilename);
|
|
24796
25645
|
await import_fs21.promises.writeFile(rulerPath, rulerContent, "utf-8");
|
|
24797
25646
|
console.log(source_default.green(`\u2713 Exported ${pkg.id} \u2192 ${rulerFilename}`));
|
|
24798
25647
|
exportedCount++;
|
|
@@ -24832,7 +25681,7 @@ function createRulerFormat(packageId, version, content, format, subtype) {
|
|
|
24832
25681
|
return frontmatter + contentWithoutFrontmatter;
|
|
24833
25682
|
}
|
|
24834
25683
|
async function ensureRulerConfig(rulerDir) {
|
|
24835
|
-
const configPath = (0,
|
|
25684
|
+
const configPath = (0, import_path26.join)((0, import_path26.dirname)(rulerDir), "ruler.toml");
|
|
24836
25685
|
try {
|
|
24837
25686
|
await import_fs21.promises.access(configPath);
|
|
24838
25687
|
console.log(source_default.dim("\u2139 ruler.toml already exists (not modified)"));
|
|
@@ -24896,7 +25745,7 @@ async function handleExport(options) {
|
|
|
24896
25745
|
}
|
|
24897
25746
|
}
|
|
24898
25747
|
function createExportCommand() {
|
|
24899
|
-
const command = new
|
|
25748
|
+
const command = new import_commander31.Command("export");
|
|
24900
25749
|
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
25750
|
try {
|
|
24902
25751
|
if (!options.to) {
|
|
@@ -24930,14 +25779,14 @@ init_telemetry();
|
|
|
24930
25779
|
init_errors();
|
|
24931
25780
|
function getVersion() {
|
|
24932
25781
|
try {
|
|
24933
|
-
const packageJsonPath = (0,
|
|
25782
|
+
const packageJsonPath = (0, import_path27.join)(__dirname, "../package.json");
|
|
24934
25783
|
const packageJson = JSON.parse((0, import_fs22.readFileSync)(packageJsonPath, "utf-8"));
|
|
24935
25784
|
return packageJson.version || "0.0.0";
|
|
24936
25785
|
} catch {
|
|
24937
25786
|
return "0.0.0";
|
|
24938
25787
|
}
|
|
24939
25788
|
}
|
|
24940
|
-
var program = new
|
|
25789
|
+
var program = new import_commander32.Command();
|
|
24941
25790
|
program.name("prpm").description("Prompt Package Manager - Install and manage prompt-based files").version(getVersion());
|
|
24942
25791
|
program.addCommand(createInitCommand());
|
|
24943
25792
|
program.addCommand(createCatalogCommand());
|
|
@@ -24945,6 +25794,7 @@ program.addCommand(createSearchCommand());
|
|
|
24945
25794
|
program.addCommand(createAISearchCommand());
|
|
24946
25795
|
program.addCommand(createInstallCommand());
|
|
24947
25796
|
program.addCommand(createInfoCommand());
|
|
25797
|
+
program.addCommand(createShowCommand());
|
|
24948
25798
|
program.addCommand(createTrendingCommand());
|
|
24949
25799
|
program.addCommand(createPopularCommand());
|
|
24950
25800
|
program.addCommand(createPublishCommand());
|