prpm 2.1.6 → 2.1.8

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 +67 -44
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -10968,14 +10968,14 @@ function convertContent7(pkg, warnings) {
10968
10968
  const lines = [];
10969
10969
  const metadata = pkg.content.sections.find((s) => s.type === "metadata");
10970
10970
  const tools = pkg.content.sections.find((s) => s.type === "tools");
10971
- const instructions = pkg.content.sections.find((s) => s.type === "instructions");
10972
10971
  const frontmatter = {};
10973
10972
  if (pkg.subtype === "slash-command") {
10974
10973
  const opencodeSlashCommand = (metadata == null ? void 0 : metadata.type) === "metadata" ? metadata.data.opencodeSlashCommand : void 0;
10974
+ const firstInstructions = pkg.content.sections.find((s) => s.type === "instructions");
10975
10975
  if (opencodeSlashCommand == null ? void 0 : opencodeSlashCommand.template) {
10976
10976
  frontmatter.template = opencodeSlashCommand.template;
10977
- } else if ((instructions == null ? void 0 : instructions.type) === "instructions") {
10978
- frontmatter.template = instructions.content;
10977
+ } else if ((firstInstructions == null ? void 0 : firstInstructions.type) === "instructions") {
10978
+ frontmatter.template = firstInstructions.content;
10979
10979
  warnings.push("No template field found, using instructions content as template");
10980
10980
  } else {
10981
10981
  frontmatter.template = "Execute the following task: {{args}}";
@@ -11040,42 +11040,50 @@ function convertContent7(pkg, warnings) {
11040
11040
  lines.push(jsYaml.dump(frontmatter, { indent: 2, lineWidth: -1 }).trim());
11041
11041
  lines.push("---");
11042
11042
  lines.push("");
11043
- if ((instructions == null ? void 0 : instructions.type) === "instructions") {
11044
- lines.push(instructions.content);
11045
- } else {
11046
- const contentSections = pkg.content.sections.filter((s) => s.type !== "metadata" && s.type !== "tools");
11047
- for (const section of contentSections) {
11048
- if (section.type === "persona") {
11049
- if (section.data.role) {
11050
- lines.push(`You are a ${section.data.role}.`);
11051
- lines.push("");
11052
- }
11053
- } else if (section.type === "instructions") {
11054
- lines.push(section.content);
11055
- lines.push("");
11056
- } else if (section.type === "rules") {
11057
- lines.push("## Rules");
11058
- lines.push("");
11059
- for (const rule of section.items) {
11060
- lines.push(`- ${rule.content}`);
11061
- }
11043
+ const contentSections = pkg.content.sections.filter((s) => s.type !== "metadata" && s.type !== "tools");
11044
+ for (const section of contentSections) {
11045
+ if (section.type === "persona") {
11046
+ if (section.data.role) {
11047
+ lines.push(`You are a ${section.data.role}.`);
11062
11048
  lines.push("");
11063
- } else if (section.type === "examples") {
11064
- lines.push("## Examples");
11049
+ }
11050
+ } else if (section.type === "instructions") {
11051
+ if (section.title && section.title !== "Overview" && section.title !== "Instructions") {
11052
+ lines.push(`## ${section.title}`);
11065
11053
  lines.push("");
11066
- for (const example of section.examples) {
11067
- if (example.description) {
11068
- lines.push(`### ${example.description}`);
11069
- lines.push("");
11070
- }
11071
- lines.push("```");
11072
- lines.push(example.code);
11073
- lines.push("```");
11054
+ }
11055
+ lines.push(section.content);
11056
+ lines.push("");
11057
+ } else if (section.type === "rules") {
11058
+ const rulesTitle = section.title || "Rules";
11059
+ lines.push(`## ${rulesTitle}`);
11060
+ lines.push("");
11061
+ for (const rule of section.items) {
11062
+ lines.push(`- ${rule.content}`);
11063
+ }
11064
+ lines.push("");
11065
+ } else if (section.type === "examples") {
11066
+ const examplesTitle = section.title || "Examples";
11067
+ lines.push(`## ${examplesTitle}`);
11068
+ lines.push("");
11069
+ for (const example of section.examples) {
11070
+ if (example.description) {
11071
+ lines.push(`### ${example.description}`);
11074
11072
  lines.push("");
11075
11073
  }
11076
- } else {
11077
- warnings.push(`Section type '${section.type}' may not be fully supported in OpenCode format`);
11074
+ lines.push("```");
11075
+ lines.push(example.code);
11076
+ lines.push("```");
11077
+ lines.push("");
11078
11078
  }
11079
+ } else if (section.type === "context") {
11080
+ const contextTitle = section.title || "Context";
11081
+ lines.push(`## ${contextTitle}`);
11082
+ lines.push("");
11083
+ lines.push(section.content);
11084
+ lines.push("");
11085
+ } else {
11086
+ warnings.push(`Section type '${section.type}' may not be fully supported in OpenCode format`);
11079
11087
  }
11080
11088
  }
11081
11089
  return lines.join("\n").trim() + "\n";
@@ -17184,15 +17192,30 @@ This could indicate:
17184
17192
  await saveFile(destPath, mainFile);
17185
17193
  fileCount = 1;
17186
17194
  } else {
17187
- destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
17195
+ const packageName = stripAuthorNamespace2(packageId);
17196
+ const nativeSubtypesMulti = import_types.FORMAT_NATIVE_SUBTYPES[effectiveFormat];
17197
+ const needsProgressiveDisclosureMulti = nativeSubtypesMulti && !nativeSubtypesMulti.includes(effectiveSubtype) && (effectiveSubtype === "skill" || effectiveSubtype === "agent" || effectiveSubtype === "slash-command");
17198
+ if (needsProgressiveDisclosureMulti) {
17199
+ if (effectiveSubtype === "skill") {
17200
+ destDir = `.openskills/${packageName}`;
17201
+ console.log(` \u{1F4E6} Installing multi-file skill to ${destDir}/ for progressive disclosure`);
17202
+ } else if (effectiveSubtype === "agent") {
17203
+ destDir = `.openagents/${packageName}`;
17204
+ console.log(` \u{1F916} Installing multi-file agent to ${destDir}/ for progressive disclosure`);
17205
+ } else if (effectiveSubtype === "slash-command") {
17206
+ destDir = `.opencommands/${packageName}`;
17207
+ console.log(` \u26A1 Installing multi-file command to ${destDir}/ for progressive disclosure`);
17208
+ }
17209
+ } else {
17210
+ destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
17211
+ }
17188
17212
  if (locationOverride && effectiveFormat === "cursor") {
17189
17213
  const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
17190
17214
  destDir = import_path13.default.join(locationOverride, relativeDestDir);
17191
17215
  console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
17192
17216
  }
17193
- const packageName = stripAuthorNamespace2(packageId);
17194
17217
  const isCursorConversion = effectiveFormat === "cursor" && pkg.format === "claude" && pkg.subtype === "skill";
17195
- const packageDir = effectiveFormat === "claude" && effectiveSubtype === "skill" ? destDir : isCursorConversion ? destDir : `${destDir}/${packageName}`;
17218
+ const packageDir = effectiveFormat === "claude" && effectiveSubtype === "skill" ? destDir : isCursorConversion ? destDir : needsProgressiveDisclosureMulti ? destDir : `${destDir}/${packageName}`;
17196
17219
  destPath = packageDir;
17197
17220
  console.log(` \u{1F4C1} Multi-file package - creating directory: ${packageDir}`);
17198
17221
  if (effectiveFormat === "claude" && effectiveSubtype === "skill") {
@@ -17597,7 +17620,7 @@ async function installFromLockfile(options) {
17597
17620
  }
17598
17621
  function createInstallCommand() {
17599
17622
  const command = new import_commander11.Command("install");
17600
- 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("--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) => {
17623
+ 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) => {
17601
17624
  const convertTo = options.format || options.as;
17602
17625
  const validFormats = import_types.FORMATS;
17603
17626
  if (convertTo && !validFormats.includes(convertTo)) {
@@ -17635,6 +17658,7 @@ Valid strategies: ${VALID_HOOK_MAPPING_STRATEGIES.join(", ")}`
17635
17658
  as: convertTo,
17636
17659
  subtype: options.subtype,
17637
17660
  frozenLockfile: options.frozenLockfile,
17661
+ force: options.yes,
17638
17662
  location: options.location,
17639
17663
  noAppend: options.noAppend,
17640
17664
  manifestFile: options.manifestFile,
@@ -22745,7 +22769,7 @@ async function handleUpgrade(packageName, options = {}) {
22745
22769
  }
22746
22770
  console.log("\u{1F680} Checking for upgrades...\n");
22747
22771
  for (const pkg of packagesToUpgrade) {
22748
- const { packageId, format: installedFormat } = parseLockfileKey(pkg.id);
22772
+ const { packageId, format: keyFormat } = parseLockfileKey(pkg.id);
22749
22773
  try {
22750
22774
  const registryPkg = await client.getPackage(packageId);
22751
22775
  if (!registryPkg.latest_version || !pkg.version) {
@@ -22770,11 +22794,10 @@ ${emoji} Upgrading ${packageId}: ${currentVersion} \u2192 ${latestVersion} (${up
22770
22794
  ` \u26A0\uFE0F This is a major version upgrade and may contain breaking changes`
22771
22795
  );
22772
22796
  }
22773
- const installOptions = {};
22774
- if (installedFormat && installedFormat !== pkg.sourceFormat) {
22775
- installOptions.as = installedFormat;
22776
- }
22777
- await handleInstall(`${packageId}@${latestVersion}`, installOptions);
22797
+ const installedFormat = pkg.format || keyFormat;
22798
+ await handleInstall(`${packageId}@${latestVersion}`, {
22799
+ as: installedFormat
22800
+ });
22778
22801
  upgradedCount++;
22779
22802
  } catch (err) {
22780
22803
  console.error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prpm",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
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.6",
49
- "@pr-pm/registry-client": "^2.3.6",
50
- "@pr-pm/types": "^2.1.6",
48
+ "@pr-pm/converters": "^2.1.9",
49
+ "@pr-pm/registry-client": "^2.3.8",
50
+ "@pr-pm/types": "^2.1.9",
51
51
  "ajv": "^8.17.1",
52
52
  "ajv-formats": "^3.0.1",
53
53
  "commander": "^11.1.0",