prpm 2.1.17 → 2.1.18

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.
Files changed (2) hide show
  1. package/dist/index.js +23 -14
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -8648,15 +8648,17 @@ var init_from_zed = __esm({
8648
8648
  // ../converters/dist/from-codex.js
8649
8649
  function parseFrontmatter8(content) {
8650
8650
  const normalizedContent = content.replace(/\r\n/g, "\n");
8651
- const match = normalizedContent.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
8651
+ const match = normalizedContent.match(/^---[ \t]*\n([\s\S]*?)\n---[ \t]*(?:\n([\s\S]*))?$/);
8652
8652
  if (!match) {
8653
8653
  return { frontmatter: {}, body: normalizedContent };
8654
8654
  }
8655
8655
  try {
8656
8656
  const frontmatter = jsYaml.load(match[1]);
8657
- const body = match[2];
8658
- return { frontmatter: frontmatter || {}, body };
8659
- } catch (error) {
8657
+ if (typeof frontmatter !== "object" || frontmatter === null) {
8658
+ return { frontmatter: {}, body: match[2] || "" };
8659
+ }
8660
+ return { frontmatter, body: match[2] || "" };
8661
+ } catch {
8660
8662
  return { frontmatter: {}, body: normalizedContent };
8661
8663
  }
8662
8664
  }
@@ -9995,26 +9997,28 @@ ${content}`;
9995
9997
  qualityScore
9996
9998
  };
9997
9999
  }
10000
+ function escapeYamlString(str2) {
10001
+ return str2.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\r/g, "\\r").replace(/\n/g, "\\n");
10002
+ }
9998
10003
  function generateSkillFrontmatter(name, description, pkg, agentSkillsData) {
9999
10004
  const lines = ["---"];
10000
10005
  lines.push(`name: ${name}`);
10001
10006
  const truncatedDesc = description.length > 1024 ? description.slice(0, 1021) + "..." : description;
10002
- const quotedDesc = `"${truncatedDesc.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\r/g, "\\r").replace(/\n/g, "\\n")}"`;
10003
- lines.push(`description: ${quotedDesc}`);
10007
+ lines.push(`description: "${escapeYamlString(truncatedDesc)}"`);
10004
10008
  const license = (agentSkillsData == null ? void 0 : agentSkillsData.license) || pkg.license;
10005
10009
  if (license) {
10006
- lines.push(`license: ${license}`);
10010
+ lines.push(`license: "${escapeYamlString(license)}"`);
10007
10011
  }
10008
10012
  if (agentSkillsData == null ? void 0 : agentSkillsData.compatibility) {
10009
- lines.push(`compatibility: "${agentSkillsData.compatibility}"`);
10013
+ lines.push(`compatibility: "${escapeYamlString(agentSkillsData.compatibility)}"`);
10010
10014
  }
10011
10015
  if (agentSkillsData == null ? void 0 : agentSkillsData.allowedTools) {
10012
- lines.push(`allowed-tools: ${agentSkillsData.allowedTools}`);
10016
+ lines.push(`allowed-tools: "${escapeYamlString(agentSkillsData.allowedTools)}"`);
10013
10017
  }
10014
10018
  if ((agentSkillsData == null ? void 0 : agentSkillsData.metadata) && Object.keys(agentSkillsData.metadata).length > 0) {
10015
10019
  lines.push("metadata:");
10016
10020
  for (const [key, value] of Object.entries(agentSkillsData.metadata)) {
10017
- lines.push(` ${key}: "${value}"`);
10021
+ lines.push(` ${key}: "${escapeYamlString(value)}"`);
10018
10022
  }
10019
10023
  }
10020
10024
  lines.push("---");
@@ -12503,11 +12507,14 @@ function truncateDescription(desc, maxLength) {
12503
12507
  return desc.substring(0, maxLength - 3) + "...";
12504
12508
  }
12505
12509
  function slugify(name) {
12506
- const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
12510
+ let slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
12507
12511
  if (!slug) {
12508
12512
  return "unnamed-skill";
12509
12513
  }
12510
- return slug.slice(0, 64);
12514
+ if (slug.length > 64) {
12515
+ slug = slug.substring(0, 64).replace(/-$/, "");
12516
+ }
12517
+ return slug;
12511
12518
  }
12512
12519
  function convertSlashCommandToSection(pkg, warnings) {
12513
12520
  const lines = [];
@@ -12729,11 +12736,13 @@ function generateFilename2(pkg) {
12729
12736
  }
12730
12737
  function isCodexSkillFormat(content) {
12731
12738
  const normalizedContent = content.replace(/\r\n/g, "\n");
12732
- const match = normalizedContent.match(/^---\n([\s\S]*?)\n---/);
12739
+ const match = normalizedContent.match(/^---[ \t]*\n([\s\S]*?)\n---/);
12733
12740
  if (!match)
12734
12741
  return false;
12735
12742
  const frontmatterText = match[1];
12736
- return frontmatterText.includes("name:") && frontmatterText.includes("description:");
12743
+ const hasName = /^[ \t]*name\s*:/m.test(frontmatterText);
12744
+ const hasDescription = /^[ \t]*description\s*:/m.test(frontmatterText);
12745
+ return hasName && hasDescription;
12737
12746
  }
12738
12747
  var init_to_codex = __esm({
12739
12748
  "../converters/dist/to-codex.js"() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "2.1.17",
3
+ "version": "2.1.18",
4
4
  "description": "Prompt Package Manager CLI - Install and manage prompt-based files",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -45,9 +45,9 @@
45
45
  "license": "MIT",
46
46
  "dependencies": {
47
47
  "@octokit/rest": "^22.0.0",
48
- "@pr-pm/converters": "^2.1.18",
49
- "@pr-pm/registry-client": "^2.3.17",
50
- "@pr-pm/types": "^2.1.18",
48
+ "@pr-pm/converters": "^2.1.19",
49
+ "@pr-pm/registry-client": "^2.3.18",
50
+ "@pr-pm/types": "^2.1.19",
51
51
  "ajv": "^8.17.1",
52
52
  "ajv-formats": "^3.0.1",
53
53
  "commander": "^11.1.0",