prpm 2.1.13 → 2.1.14

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 +188 -19
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -8883,8 +8883,14 @@ function parseMarkdownWithFrontmatter(markdown) {
8883
8883
  return { frontmatter, content };
8884
8884
  }
8885
8885
  function validateMarkdown(format, markdown, subtype) {
8886
+ var _a;
8886
8887
  const { frontmatter, content } = parseMarkdownWithFrontmatter(markdown);
8887
- if (format === "windsurf" || format === "agents.md" || format === "ruler") {
8888
+ const noFrontmatterFormats = ["windsurf", "agents.md", "ruler"];
8889
+ const noFrontmatterSubtypes = {
8890
+ cursor: ["slash-command"]
8891
+ };
8892
+ const isNoFrontmatter = noFrontmatterFormats.includes(format) || subtype && ((_a = noFrontmatterSubtypes[format]) == null ? void 0 : _a.includes(subtype));
8893
+ if (isNoFrontmatter) {
8888
8894
  return validateFormat(format, { content: markdown }, subtype);
8889
8895
  }
8890
8896
  return validateConversion(format, frontmatter, content, subtype);
@@ -21074,7 +21080,7 @@ async function validatePackageFiles(manifest) {
21074
21080
  return false;
21075
21081
  }
21076
21082
  if (formatType === "cursor") {
21077
- return filePath.includes(".cursorrules") || filePath.endsWith(".mdc");
21083
+ return filePath.includes(".cursorrules") || filePath.endsWith(".mdc") || filePath.endsWith(".md");
21078
21084
  } else if (formatType === "claude") {
21079
21085
  if (manifest.subtype === "skill") {
21080
21086
  return filePath.endsWith("SKILL.md");
@@ -21085,16 +21091,13 @@ async function validatePackageFiles(manifest) {
21085
21091
  if (filePath.endsWith(".json")) {
21086
21092
  return false;
21087
21093
  }
21088
- if (manifest.subtype === "agent") {
21089
- return filePath.includes(".claude/agents/") && filePath.endsWith(".md");
21090
- } else if (manifest.subtype === "slash-command") {
21091
- return filePath.includes(".claude/commands/") && filePath.endsWith(".md");
21092
- }
21093
- return filePath.endsWith(".md") && !filePath.endsWith(".json");
21094
+ return filePath.endsWith(".md");
21094
21095
  } else if (formatType === "continue") {
21095
- return filePath.includes(".continue/") && filePath.endsWith(".json");
21096
+ return filePath.endsWith(".md") || filePath.endsWith(".json");
21096
21097
  } else if (formatType === "windsurf") {
21097
- return filePath.includes(".windsurf/rules");
21098
+ return filePath.endsWith(".md");
21099
+ } else if (formatType === "copilot") {
21100
+ return filePath.endsWith(".md");
21098
21101
  } else if (formatType === "agents.md") {
21099
21102
  return filePath === "agents.md";
21100
21103
  } else if (formatType === "kiro") {
@@ -21136,8 +21139,20 @@ async function validatePackageFiles(manifest) {
21136
21139
  }
21137
21140
  if (manifest.format === "claude" && manifest.subtype === "skill") {
21138
21141
  const hasSkillMd = filePaths.some((path10) => path10.endsWith("/SKILL.md") || path10 === "SKILL.md");
21139
- if (!hasSkillMd) {
21140
- errors.push("Claude skills must contain a SKILL.md file");
21142
+ const mdFiles = filePaths.filter((path10) => {
21143
+ var _a;
21144
+ if (!path10.endsWith(".md")) return false;
21145
+ const filename = ((_a = path10.split(/[\\/]/).pop()) == null ? void 0 : _a.toLowerCase()) || "";
21146
+ if (filename === "readme.md") return false;
21147
+ if (path10.includes("examples/") || path10.includes("example/") || path10.includes("tests/") || path10.includes("__tests__/") || path10.includes("docs/") || path10.includes("doc/")) return false;
21148
+ return true;
21149
+ });
21150
+ if (!hasSkillMd && mdFiles.length === 0) {
21151
+ errors.push("Claude skills must contain a markdown file (.md)");
21152
+ } else if (!hasSkillMd && mdFiles.length === 1) {
21153
+ warnings.push("Skill file will be auto-renamed to SKILL.md during publish");
21154
+ } else if (!hasSkillMd && mdFiles.length > 1) {
21155
+ errors.push(`Claude skills with multiple .md files must use SKILL.md for the main skill file (found ${mdFiles.length} .md files)`);
21141
21156
  }
21142
21157
  }
21143
21158
  if (manifest.format === "windsurf") {
@@ -21527,12 +21542,29 @@ function validateManifest(manifest, contextLabel) {
21527
21542
  const hasSkillMd = filePaths.some(
21528
21543
  (path10) => path10.endsWith("/SKILL.md") || path10 === "SKILL.md"
21529
21544
  );
21530
- if (!hasSkillMd) {
21545
+ const mdFiles = filePaths.filter((filePath) => {
21546
+ var _a2;
21547
+ if (!filePath.endsWith(".md")) return false;
21548
+ const filename = ((_a2 = filePath.split(/[\\/]/).pop()) == null ? void 0 : _a2.toLowerCase()) || "";
21549
+ return filename !== "readme.md";
21550
+ });
21551
+ if (!hasSkillMd && mdFiles.length === 0) {
21531
21552
  throw new Error(
21532
- `${prefix}Claude skills must contain a SKILL.md file.
21533
- According to Claude documentation at https://docs.claude.com/en/docs/claude-code/skills,
21534
- skills must have a file named SKILL.md in their directory.
21535
- Please rename your skill file to SKILL.md (all caps) and update your prpm.json files array.`
21553
+ `${prefix}Claude skills must contain a markdown file.
21554
+ No .md file found in the files array.
21555
+ Please add your skill file to the prpm.json files array.`
21556
+ );
21557
+ }
21558
+ if (!hasSkillMd && mdFiles.length === 1) {
21559
+ console.log(
21560
+ `${prefix}\u26A0\uFE0F Skill file will be auto-renamed to SKILL.md during publish`
21561
+ );
21562
+ }
21563
+ if (!hasSkillMd && mdFiles.length > 1) {
21564
+ throw new Error(
21565
+ `${prefix}Claude skills with multiple .md files must use SKILL.md for the main skill file.
21566
+ Found ${mdFiles.length} .md files but no SKILL.md.
21567
+ Please rename your main skill file to SKILL.md so we know which file is the skill.`
21536
21568
  );
21537
21569
  }
21538
21570
  if (manifest.name.length > 64) {
@@ -21622,11 +21654,98 @@ var import_path18 = require("path");
21622
21654
  var tar2 = __toESM(require("tar"));
21623
21655
  var import_os5 = require("os");
21624
21656
  var import_crypto2 = require("crypto");
21657
+ var RELOCATION_CONFIG = {
21658
+ claude: {
21659
+ "slash-command": {
21660
+ directory: ".claude/commands",
21661
+ checkPath: ".claude/commands/"
21662
+ },
21663
+ agent: {
21664
+ directory: ".claude/agents",
21665
+ checkPath: ".claude/agents/"
21666
+ }
21667
+ },
21668
+ cursor: {
21669
+ rule: {
21670
+ directory: ".cursor/rules",
21671
+ extension: ".mdc",
21672
+ checkPath: ".cursor/rules/"
21673
+ },
21674
+ agent: {
21675
+ directory: ".cursor/agents",
21676
+ checkPath: ".cursor/agents/"
21677
+ },
21678
+ "slash-command": {
21679
+ directory: ".cursor/commands",
21680
+ checkPath: ".cursor/commands/"
21681
+ }
21682
+ },
21683
+ continue: {
21684
+ rule: {
21685
+ directory: ".continue/rules",
21686
+ checkPath: ".continue/rules/"
21687
+ },
21688
+ prompt: {
21689
+ directory: ".continue/prompts",
21690
+ checkPath: ".continue/prompts/"
21691
+ }
21692
+ },
21693
+ windsurf: {
21694
+ rule: {
21695
+ directory: ".windsurf/rules",
21696
+ checkPath: ".windsurf/rules/"
21697
+ }
21698
+ },
21699
+ copilot: {
21700
+ rule: {
21701
+ directory: ".github/instructions",
21702
+ extension: ".instructions.md",
21703
+ checkPath: ".github/instructions/"
21704
+ },
21705
+ chatmode: {
21706
+ directory: ".github/chatmodes",
21707
+ extension: ".chatmode.md",
21708
+ checkPath: ".github/chatmodes/"
21709
+ }
21710
+ },
21711
+ kiro: {
21712
+ rule: {
21713
+ directory: ".kiro/steering",
21714
+ checkPath: ".kiro/steering/"
21715
+ },
21716
+ agent: {
21717
+ directory: ".kiro/agents",
21718
+ checkPath: ".kiro/agents/"
21719
+ }
21720
+ },
21721
+ opencode: {
21722
+ agent: {
21723
+ directory: ".opencode/agent",
21724
+ checkPath: ".opencode/agent/"
21725
+ },
21726
+ "slash-command": {
21727
+ directory: ".opencode/command",
21728
+ checkPath: ".opencode/command/"
21729
+ },
21730
+ tool: {
21731
+ directory: ".opencode/tool",
21732
+ checkPath: ".opencode/tool/"
21733
+ }
21734
+ },
21735
+ factory: {
21736
+ "slash-command": {
21737
+ directory: ".factory/commands",
21738
+ checkPath: ".factory/commands/"
21739
+ }
21740
+ }
21741
+ };
21625
21742
  async function createTarball(manifest) {
21626
21743
  const tmpDir = (0, import_path18.join)((0, import_os5.tmpdir)(), `prpm-${(0, import_crypto2.randomBytes)(8).toString("hex")}`);
21627
21744
  const tarballPath = (0, import_path18.join)(tmpDir, "package.tar.gz");
21745
+ const stagingDir = (0, import_path18.join)(tmpDir, "staging");
21628
21746
  try {
21629
21747
  await (0, import_promises7.mkdir)(tmpDir, { recursive: true });
21748
+ await (0, import_promises7.mkdir)(stagingDir, { recursive: true });
21630
21749
  const filePaths = normalizeFilePaths2(manifest.files);
21631
21750
  const standardFiles = ["prpm.json", "README.md", "LICENSE"];
21632
21751
  for (const file of standardFiles) {
@@ -21635,10 +21754,60 @@ async function createTarball(manifest) {
21635
21754
  }
21636
21755
  }
21637
21756
  const existingFiles = [];
21757
+ const fileRenames = /* @__PURE__ */ new Map();
21758
+ if (manifest.format === "claude" && manifest.subtype === "skill") {
21759
+ const hasSkillMd = filePaths.some(
21760
+ (path10) => path10.endsWith("/SKILL.md") || path10 === "SKILL.md"
21761
+ );
21762
+ if (!hasSkillMd) {
21763
+ const mdFiles = filePaths.filter(
21764
+ (path10) => path10.endsWith(".md") && !path10.toLowerCase().includes("readme")
21765
+ );
21766
+ if (mdFiles.length === 1) {
21767
+ const file = mdFiles[0];
21768
+ try {
21769
+ await (0, import_promises7.stat)(file);
21770
+ const dir = (0, import_path18.dirname)(file);
21771
+ const newPath = dir === "." ? "SKILL.md" : (0, import_path18.join)(dir, "SKILL.md");
21772
+ fileRenames.set(file, newPath);
21773
+ console.log(` \u{1F4DD} Renaming ${file} \u2192 ${newPath}`);
21774
+ } catch {
21775
+ }
21776
+ }
21777
+ }
21778
+ }
21779
+ const formatConfig = RELOCATION_CONFIG[manifest.format];
21780
+ const subtypeConfig = formatConfig == null ? void 0 : formatConfig[manifest.subtype || "rule"];
21781
+ if (subtypeConfig) {
21782
+ const contentFiles = filePaths.filter(
21783
+ (path10) => !path10.toLowerCase().includes("readme") && !path10.toLowerCase().includes("license") && path10 !== "prpm.json" && (path10.endsWith(".md") || path10.endsWith(".mdc") || path10.endsWith(".json"))
21784
+ );
21785
+ for (const file of contentFiles) {
21786
+ if (file.includes(subtypeConfig.checkPath)) {
21787
+ continue;
21788
+ }
21789
+ try {
21790
+ await (0, import_promises7.stat)(file);
21791
+ let fileName = (0, import_path18.basename)(file);
21792
+ if (subtypeConfig.extension) {
21793
+ const nameWithoutExt = fileName.replace(/\.[^.]+$/, "");
21794
+ fileName = nameWithoutExt + subtypeConfig.extension;
21795
+ }
21796
+ const newPath = (0, import_path18.join)(subtypeConfig.directory, fileName);
21797
+ fileRenames.set(file, newPath);
21798
+ console.log(` \u{1F4DD} Relocating ${file} \u2192 ${newPath}`);
21799
+ } catch {
21800
+ }
21801
+ }
21802
+ }
21638
21803
  for (const file of filePaths) {
21639
21804
  try {
21640
21805
  await (0, import_promises7.stat)(file);
21641
- existingFiles.push(file);
21806
+ const targetPath = fileRenames.get(file) || file;
21807
+ const stagingPath = (0, import_path18.join)(stagingDir, targetPath);
21808
+ await (0, import_promises7.mkdir)((0, import_path18.dirname)(stagingPath), { recursive: true });
21809
+ await (0, import_promises7.copyFile)(file, stagingPath);
21810
+ existingFiles.push(targetPath);
21642
21811
  } catch {
21643
21812
  }
21644
21813
  }
@@ -21649,7 +21818,7 @@ async function createTarball(manifest) {
21649
21818
  {
21650
21819
  gzip: true,
21651
21820
  file: tarballPath,
21652
- cwd: process.cwd()
21821
+ cwd: stagingDir
21653
21822
  },
21654
21823
  existingFiles
21655
21824
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
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.14",
49
- "@pr-pm/registry-client": "^2.3.13",
50
- "@pr-pm/types": "^2.1.14",
48
+ "@pr-pm/converters": "^2.1.15",
49
+ "@pr-pm/registry-client": "^2.3.14",
50
+ "@pr-pm/types": "^2.1.15",
51
51
  "ajv": "^8.17.1",
52
52
  "ajv-formats": "^3.0.1",
53
53
  "commander": "^11.1.0",