prpm 2.0.1 → 2.1.0
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 +1200 -270
- package/dist/schemas/format-capabilities.schema.json +101 -0
- package/dist/schemas/gemini-extension.schema.json +77 -0
- package/dist/schemas/kiro-hook.schema.json +52 -7
- package/dist/schemas/opencode-plugin.schema.json +391 -0
- package/dist/schemas/prpm-manifest.schema.json +25 -0
- package/dist/schemas/zed-extension.schema.json +238 -0
- package/dist/schemas/zed.schema.json +44 -0
- package/package.json +4 -4
- package/schemas/prpm-manifest.schema.json +25 -0
package/dist/index.js
CHANGED
|
@@ -788,14 +788,35 @@ function normalizeFormat(sourceFormat) {
|
|
|
788
788
|
return "zencoder";
|
|
789
789
|
if (normalized.includes("replit"))
|
|
790
790
|
return "replit";
|
|
791
|
+
if (normalized.includes("zed"))
|
|
792
|
+
return "zed";
|
|
791
793
|
if (normalized.includes("mcp"))
|
|
792
794
|
return "mcp";
|
|
793
795
|
return "generic";
|
|
794
796
|
}
|
|
797
|
+
var CLI_SUPPORTED_FORMATS;
|
|
795
798
|
var init_taxonomy_utils = __esm({
|
|
796
799
|
"../converters/dist/taxonomy-utils.js"() {
|
|
797
800
|
"use strict";
|
|
798
801
|
init_cjs_shims();
|
|
802
|
+
CLI_SUPPORTED_FORMATS = [
|
|
803
|
+
"cursor",
|
|
804
|
+
"claude",
|
|
805
|
+
"windsurf",
|
|
806
|
+
"continue",
|
|
807
|
+
"copilot",
|
|
808
|
+
"kiro",
|
|
809
|
+
"agents.md",
|
|
810
|
+
"gemini",
|
|
811
|
+
"ruler",
|
|
812
|
+
"zed",
|
|
813
|
+
"opencode",
|
|
814
|
+
"aider",
|
|
815
|
+
"trae",
|
|
816
|
+
"replit",
|
|
817
|
+
"zencoder",
|
|
818
|
+
"droid"
|
|
819
|
+
];
|
|
799
820
|
}
|
|
800
821
|
});
|
|
801
822
|
|
|
@@ -1085,11 +1106,161 @@ var init_from_claude = __esm({
|
|
|
1085
1106
|
}
|
|
1086
1107
|
});
|
|
1087
1108
|
|
|
1109
|
+
// ../converters/dist/utils/file-references.js
|
|
1110
|
+
function extractAtReferences(content) {
|
|
1111
|
+
const atRefRegex = /@([\w\-./]+\.\w+)/g;
|
|
1112
|
+
const matches = content.matchAll(atRefRegex);
|
|
1113
|
+
const refs = Array.from(matches, (m) => m[1]);
|
|
1114
|
+
return [...new Set(refs)];
|
|
1115
|
+
}
|
|
1116
|
+
function categorizeFile(path10) {
|
|
1117
|
+
const pathLower = path10.toLowerCase();
|
|
1118
|
+
if (pathLower.includes("/patterns/") || pathLower.includes("/pattern/") || pathLower.startsWith("patterns/") || pathLower.startsWith("pattern/")) {
|
|
1119
|
+
return "pattern";
|
|
1120
|
+
}
|
|
1121
|
+
if (pathLower.includes("/examples/") || pathLower.includes("/example/") || pathLower.startsWith("examples/") || pathLower.startsWith("example/")) {
|
|
1122
|
+
return "example";
|
|
1123
|
+
}
|
|
1124
|
+
if (pathLower.includes("/context/") || pathLower.includes("/contexts/") || pathLower.startsWith("context/") || pathLower.startsWith("contexts/")) {
|
|
1125
|
+
return "context";
|
|
1126
|
+
}
|
|
1127
|
+
if (pathLower.includes("/config/") || pathLower.includes("/configs/") || pathLower.startsWith("config/") || pathLower.startsWith("configs/")) {
|
|
1128
|
+
return "config";
|
|
1129
|
+
}
|
|
1130
|
+
if (pathLower.includes("/data/") || pathLower.startsWith("data/")) {
|
|
1131
|
+
return "data";
|
|
1132
|
+
}
|
|
1133
|
+
if (pathLower.includes("/docs/") || pathLower.includes("/documentation/") || pathLower.startsWith("docs/") || pathLower.startsWith("documentation/")) {
|
|
1134
|
+
return "documentation";
|
|
1135
|
+
}
|
|
1136
|
+
if (pathLower.endsWith(".md") && !pathLower.includes("/")) {
|
|
1137
|
+
return "documentation";
|
|
1138
|
+
}
|
|
1139
|
+
return "other";
|
|
1140
|
+
}
|
|
1141
|
+
function detectContentType(path10) {
|
|
1142
|
+
const ext = (0, import_path5.extname)(path10).toLowerCase();
|
|
1143
|
+
const typeMap = {
|
|
1144
|
+
".md": "text/markdown",
|
|
1145
|
+
".txt": "text/plain",
|
|
1146
|
+
".json": "application/json",
|
|
1147
|
+
".yaml": "text/yaml",
|
|
1148
|
+
".yml": "text/yaml",
|
|
1149
|
+
".toml": "text/toml",
|
|
1150
|
+
".ts": "typescript",
|
|
1151
|
+
".tsx": "typescriptreact",
|
|
1152
|
+
".js": "javascript",
|
|
1153
|
+
".jsx": "javascriptreact",
|
|
1154
|
+
".py": "python",
|
|
1155
|
+
".rb": "ruby",
|
|
1156
|
+
".go": "go",
|
|
1157
|
+
".rs": "rust",
|
|
1158
|
+
".java": "java",
|
|
1159
|
+
".c": "c",
|
|
1160
|
+
".cpp": "cpp",
|
|
1161
|
+
".cs": "csharp",
|
|
1162
|
+
".php": "php",
|
|
1163
|
+
".sh": "shellscript",
|
|
1164
|
+
".bash": "shellscript",
|
|
1165
|
+
".zsh": "shellscript",
|
|
1166
|
+
".html": "text/html",
|
|
1167
|
+
".css": "text/css",
|
|
1168
|
+
".scss": "scss",
|
|
1169
|
+
".sass": "sass",
|
|
1170
|
+
".xml": "text/xml",
|
|
1171
|
+
".sql": "sql"
|
|
1172
|
+
};
|
|
1173
|
+
return typeMap[ext] || "text/plain";
|
|
1174
|
+
}
|
|
1175
|
+
function loadReferencedFiles(references, basePath) {
|
|
1176
|
+
const loaded = [];
|
|
1177
|
+
const resolvedBasePath = (0, import_path5.resolve)(basePath);
|
|
1178
|
+
for (const ref of references) {
|
|
1179
|
+
const fullPath = (0, import_path5.resolve)((0, import_path5.join)(basePath, ref));
|
|
1180
|
+
if (!fullPath.startsWith(resolvedBasePath + import_path5.sep) && fullPath !== resolvedBasePath) {
|
|
1181
|
+
console.warn(`Warning: Path traversal attempt blocked: ${ref}`);
|
|
1182
|
+
continue;
|
|
1183
|
+
}
|
|
1184
|
+
if (!(0, import_fs5.existsSync)(fullPath)) {
|
|
1185
|
+
console.warn(`Warning: Referenced file not found: ${ref}`);
|
|
1186
|
+
continue;
|
|
1187
|
+
}
|
|
1188
|
+
try {
|
|
1189
|
+
const content = (0, import_fs5.readFileSync)(fullPath, "utf-8");
|
|
1190
|
+
loaded.push({
|
|
1191
|
+
path: ref,
|
|
1192
|
+
content,
|
|
1193
|
+
contentType: detectContentType(ref),
|
|
1194
|
+
category: categorizeFile(ref)
|
|
1195
|
+
});
|
|
1196
|
+
} catch (error) {
|
|
1197
|
+
console.warn(`Warning: Could not read file: ${ref}`, error);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
return loaded;
|
|
1201
|
+
}
|
|
1202
|
+
function extractDirectories(filePaths) {
|
|
1203
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
1204
|
+
for (const path10 of filePaths) {
|
|
1205
|
+
const dir = (0, import_path5.dirname)(path10);
|
|
1206
|
+
if (dir && dir !== ".") {
|
|
1207
|
+
dirs.add(dir);
|
|
1208
|
+
const parts = dir.split("/");
|
|
1209
|
+
for (let i = 1; i < parts.length; i++) {
|
|
1210
|
+
dirs.add(parts.slice(0, i).join("/"));
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
return Array.from(dirs).sort();
|
|
1215
|
+
}
|
|
1216
|
+
var import_fs5, import_path5;
|
|
1217
|
+
var init_file_references = __esm({
|
|
1218
|
+
"../converters/dist/utils/file-references.js"() {
|
|
1219
|
+
"use strict";
|
|
1220
|
+
init_cjs_shims();
|
|
1221
|
+
import_fs5 = require("fs");
|
|
1222
|
+
import_path5 = require("path");
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
|
|
1088
1226
|
// ../converters/dist/from-cursor.js
|
|
1089
|
-
function fromCursor(content, metadata,
|
|
1090
|
-
const
|
|
1227
|
+
function fromCursor(content, metadata, options) {
|
|
1228
|
+
const opts = typeof options === "string" ? { explicitSubtype: options } : options || {};
|
|
1229
|
+
const pkg = fromClaude(content, metadata, "cursor", opts.explicitSubtype);
|
|
1091
1230
|
pkg.format = "cursor";
|
|
1092
1231
|
pkg.sourceFormat = "cursor";
|
|
1232
|
+
if (opts.resolveFiles && opts.basePath) {
|
|
1233
|
+
const fileRefs = extractAtReferences(content);
|
|
1234
|
+
if (fileRefs.length > 0) {
|
|
1235
|
+
try {
|
|
1236
|
+
const loadedFiles = loadReferencedFiles(fileRefs, opts.basePath);
|
|
1237
|
+
const fileSections = loadedFiles.map((file) => ({
|
|
1238
|
+
type: "file-reference",
|
|
1239
|
+
title: file.path,
|
|
1240
|
+
path: file.path,
|
|
1241
|
+
content: file.content,
|
|
1242
|
+
contentType: file.contentType,
|
|
1243
|
+
category: file.category,
|
|
1244
|
+
description: `Referenced file from @${file.path}`
|
|
1245
|
+
}));
|
|
1246
|
+
pkg.content.sections.push(...fileSections);
|
|
1247
|
+
const directories = extractDirectories(fileRefs);
|
|
1248
|
+
pkg.metadata = pkg.metadata || {};
|
|
1249
|
+
pkg.metadata.fileStructure = {
|
|
1250
|
+
mainFile: "rule.md",
|
|
1251
|
+
// Cursor typically uses single rule files
|
|
1252
|
+
files: loadedFiles.map((file) => ({
|
|
1253
|
+
path: file.path,
|
|
1254
|
+
category: file.category,
|
|
1255
|
+
description: `Referenced via @${file.path}`
|
|
1256
|
+
})),
|
|
1257
|
+
directories: directories.length > 0 ? directories : void 0
|
|
1258
|
+
};
|
|
1259
|
+
} catch (error) {
|
|
1260
|
+
console.warn(`Failed to load @file references: ${error instanceof Error ? error.message : String(error)}`);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1093
1264
|
return pkg;
|
|
1094
1265
|
}
|
|
1095
1266
|
var init_from_cursor = __esm({
|
|
@@ -1097,6 +1268,7 @@ var init_from_cursor = __esm({
|
|
|
1097
1268
|
"use strict";
|
|
1098
1269
|
init_cjs_shims();
|
|
1099
1270
|
init_from_claude();
|
|
1271
|
+
init_file_references();
|
|
1100
1272
|
}
|
|
1101
1273
|
});
|
|
1102
1274
|
|
|
@@ -6525,20 +6697,20 @@ var require_parse_async = __commonJS({
|
|
|
6525
6697
|
const index = 0;
|
|
6526
6698
|
const blocksize = opts.blocksize || 40960;
|
|
6527
6699
|
const parser = new TOMLParser();
|
|
6528
|
-
return new Promise((
|
|
6529
|
-
setImmediate(parseAsyncNext, index, blocksize,
|
|
6700
|
+
return new Promise((resolve3, reject) => {
|
|
6701
|
+
setImmediate(parseAsyncNext, index, blocksize, resolve3, reject);
|
|
6530
6702
|
});
|
|
6531
|
-
function parseAsyncNext(index2, blocksize2,
|
|
6703
|
+
function parseAsyncNext(index2, blocksize2, resolve3, reject) {
|
|
6532
6704
|
if (index2 >= str2.length) {
|
|
6533
6705
|
try {
|
|
6534
|
-
return
|
|
6706
|
+
return resolve3(parser.finish());
|
|
6535
6707
|
} catch (err) {
|
|
6536
6708
|
return reject(prettyError(err, str2));
|
|
6537
6709
|
}
|
|
6538
6710
|
}
|
|
6539
6711
|
try {
|
|
6540
6712
|
parser.parse(str2.slice(index2, index2 + blocksize2));
|
|
6541
|
-
setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2,
|
|
6713
|
+
setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve3, reject);
|
|
6542
6714
|
} catch (err) {
|
|
6543
6715
|
reject(prettyError(err, str2));
|
|
6544
6716
|
}
|
|
@@ -6565,7 +6737,7 @@ var require_parse_stream = __commonJS({
|
|
|
6565
6737
|
function parseReadable(stm) {
|
|
6566
6738
|
const parser = new TOMLParser();
|
|
6567
6739
|
stm.setEncoding("utf8");
|
|
6568
|
-
return new Promise((
|
|
6740
|
+
return new Promise((resolve3, reject) => {
|
|
6569
6741
|
let readable;
|
|
6570
6742
|
let ended = false;
|
|
6571
6743
|
let errored = false;
|
|
@@ -6573,7 +6745,7 @@ var require_parse_stream = __commonJS({
|
|
|
6573
6745
|
ended = true;
|
|
6574
6746
|
if (readable) return;
|
|
6575
6747
|
try {
|
|
6576
|
-
|
|
6748
|
+
resolve3(parser.finish());
|
|
6577
6749
|
} catch (err) {
|
|
6578
6750
|
reject(err);
|
|
6579
6751
|
}
|
|
@@ -6968,6 +7140,74 @@ var init_from_gemini = __esm({
|
|
|
6968
7140
|
}
|
|
6969
7141
|
});
|
|
6970
7142
|
|
|
7143
|
+
// ../converters/dist/from-gemini-plugin.js
|
|
7144
|
+
function fromGeminiPlugin(content, metadata) {
|
|
7145
|
+
const config = JSON.parse(content);
|
|
7146
|
+
const sections = [];
|
|
7147
|
+
const metadataSection = {
|
|
7148
|
+
type: "metadata",
|
|
7149
|
+
data: {
|
|
7150
|
+
title: config.name || metadata.name || metadata.id,
|
|
7151
|
+
description: config.description || metadata.description || "",
|
|
7152
|
+
version: config.version || metadata.version,
|
|
7153
|
+
author: config.author || metadata.author
|
|
7154
|
+
}
|
|
7155
|
+
};
|
|
7156
|
+
if (config.mcpServers || config.contextFileName || config.excludeTools || config.experimentalSettings) {
|
|
7157
|
+
metadataSection.data.geminiExtension = {
|
|
7158
|
+
mcpServers: config.mcpServers,
|
|
7159
|
+
contextFileName: config.contextFileName,
|
|
7160
|
+
excludeTools: config.excludeTools,
|
|
7161
|
+
experimentalSettings: config.experimentalSettings
|
|
7162
|
+
};
|
|
7163
|
+
}
|
|
7164
|
+
sections.push(metadataSection);
|
|
7165
|
+
if (config.description) {
|
|
7166
|
+
sections.push({
|
|
7167
|
+
type: "instructions",
|
|
7168
|
+
title: "Extension Description",
|
|
7169
|
+
content: config.description
|
|
7170
|
+
});
|
|
7171
|
+
}
|
|
7172
|
+
const canonicalContent = {
|
|
7173
|
+
format: "canonical",
|
|
7174
|
+
version: "1.0",
|
|
7175
|
+
sections
|
|
7176
|
+
};
|
|
7177
|
+
const pkg = {
|
|
7178
|
+
...metadata,
|
|
7179
|
+
id: metadata.id,
|
|
7180
|
+
name: metadata.name || config.name || metadata.id,
|
|
7181
|
+
version: metadata.version || config.version,
|
|
7182
|
+
author: metadata.author || config.author || "unknown",
|
|
7183
|
+
description: metadata.description || config.description || "",
|
|
7184
|
+
tags: metadata.tags || [],
|
|
7185
|
+
format: "gemini",
|
|
7186
|
+
subtype: "extension",
|
|
7187
|
+
content: canonicalContent
|
|
7188
|
+
};
|
|
7189
|
+
if (config.mcpServers || config.contextFileName || config.excludeTools || config.experimentalSettings) {
|
|
7190
|
+
pkg.metadata = {
|
|
7191
|
+
...pkg.metadata,
|
|
7192
|
+
geminiExtension: {
|
|
7193
|
+
mcpServers: config.mcpServers,
|
|
7194
|
+
contextFileName: config.contextFileName,
|
|
7195
|
+
excludeTools: config.excludeTools,
|
|
7196
|
+
experimentalSettings: config.experimentalSettings
|
|
7197
|
+
}
|
|
7198
|
+
};
|
|
7199
|
+
}
|
|
7200
|
+
setTaxonomy(pkg, "gemini", "extension");
|
|
7201
|
+
return pkg;
|
|
7202
|
+
}
|
|
7203
|
+
var init_from_gemini_plugin = __esm({
|
|
7204
|
+
"../converters/dist/from-gemini-plugin.js"() {
|
|
7205
|
+
"use strict";
|
|
7206
|
+
init_cjs_shims();
|
|
7207
|
+
init_taxonomy_utils();
|
|
7208
|
+
}
|
|
7209
|
+
});
|
|
7210
|
+
|
|
6971
7211
|
// ../converters/dist/from-opencode.js
|
|
6972
7212
|
function parseFrontmatter5(content) {
|
|
6973
7213
|
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
@@ -8312,6 +8552,34 @@ var init_from_replit = __esm({
|
|
|
8312
8552
|
}
|
|
8313
8553
|
});
|
|
8314
8554
|
|
|
8555
|
+
// ../converters/dist/from-zed.js
|
|
8556
|
+
function fromZed(content, metadata, explicitSubtype) {
|
|
8557
|
+
const pkg = fromAgentsMd(content, metadata);
|
|
8558
|
+
pkg.format = "zed";
|
|
8559
|
+
pkg.sourceFormat = "zed";
|
|
8560
|
+
if (explicitSubtype) {
|
|
8561
|
+
pkg.subtype = explicitSubtype;
|
|
8562
|
+
}
|
|
8563
|
+
return pkg;
|
|
8564
|
+
}
|
|
8565
|
+
function isZedFormat(content) {
|
|
8566
|
+
const trimmed = content.trim();
|
|
8567
|
+
if (trimmed.startsWith("---")) {
|
|
8568
|
+
return false;
|
|
8569
|
+
}
|
|
8570
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
8571
|
+
return false;
|
|
8572
|
+
}
|
|
8573
|
+
return true;
|
|
8574
|
+
}
|
|
8575
|
+
var init_from_zed = __esm({
|
|
8576
|
+
"../converters/dist/from-zed.js"() {
|
|
8577
|
+
"use strict";
|
|
8578
|
+
init_cjs_shims();
|
|
8579
|
+
init_from_agents_md();
|
|
8580
|
+
}
|
|
8581
|
+
});
|
|
8582
|
+
|
|
8315
8583
|
// ../converters/dist/from-mcp-server.js
|
|
8316
8584
|
function fromMCPServer(mcpServerJson, metadata) {
|
|
8317
8585
|
var _a;
|
|
@@ -8432,7 +8700,8 @@ function loadSchema(format, subtype) {
|
|
|
8432
8700
|
"droid:skill": "droid-skill.schema.json",
|
|
8433
8701
|
"droid:slash-command": "droid-slash-command.schema.json",
|
|
8434
8702
|
"droid:hook": "droid-hook.schema.json",
|
|
8435
|
-
"opencode:slash-command": "opencode-slash-command.schema.json"
|
|
8703
|
+
"opencode:slash-command": "opencode-slash-command.schema.json",
|
|
8704
|
+
"gemini:extension": "gemini-extension.schema.json"
|
|
8436
8705
|
};
|
|
8437
8706
|
schemaFilename = subtypeSchemaMap[cacheKey];
|
|
8438
8707
|
}
|
|
@@ -8459,15 +8728,15 @@ function loadSchema(format, subtype) {
|
|
|
8459
8728
|
schemaFilename = schemaMap[format] || `${format}.schema.json`;
|
|
8460
8729
|
}
|
|
8461
8730
|
const schemaDirectories = [
|
|
8462
|
-
(0,
|
|
8463
|
-
(0,
|
|
8731
|
+
(0, import_path6.join)(currentDirname, "..", "schemas"),
|
|
8732
|
+
(0, import_path6.join)(currentDirname, "schemas")
|
|
8464
8733
|
];
|
|
8465
8734
|
let schemaContent = null;
|
|
8466
8735
|
let schemaPath = null;
|
|
8467
8736
|
for (const dir of schemaDirectories) {
|
|
8468
|
-
const candidate = (0,
|
|
8737
|
+
const candidate = (0, import_path6.join)(dir, schemaFilename);
|
|
8469
8738
|
try {
|
|
8470
|
-
schemaContent = (0,
|
|
8739
|
+
schemaContent = (0, import_fs6.readFileSync)(candidate, "utf-8");
|
|
8471
8740
|
schemaPath = candidate;
|
|
8472
8741
|
break;
|
|
8473
8742
|
} catch (error) {
|
|
@@ -8585,18 +8854,18 @@ function formatValidationErrors(result) {
|
|
|
8585
8854
|
}
|
|
8586
8855
|
return lines.join("\n");
|
|
8587
8856
|
}
|
|
8588
|
-
var import_ajv, import_ajv_formats,
|
|
8857
|
+
var import_ajv, import_ajv_formats, import_fs6, import_path6, import_url, currentDirname, ajv, schemaCache;
|
|
8589
8858
|
var init_validation = __esm({
|
|
8590
8859
|
"../converters/dist/validation.js"() {
|
|
8591
8860
|
"use strict";
|
|
8592
8861
|
init_cjs_shims();
|
|
8593
8862
|
import_ajv = __toESM(require("ajv"), 1);
|
|
8594
8863
|
import_ajv_formats = __toESM(require("ajv-formats"), 1);
|
|
8595
|
-
|
|
8596
|
-
|
|
8864
|
+
import_fs6 = require("fs");
|
|
8865
|
+
import_path6 = require("path");
|
|
8597
8866
|
import_url = require("url");
|
|
8598
8867
|
init_js_yaml();
|
|
8599
|
-
currentDirname = (0,
|
|
8868
|
+
currentDirname = (0, import_path6.dirname)((0, import_url.fileURLToPath)(importMetaUrl));
|
|
8600
8869
|
ajv = new import_ajv.default({
|
|
8601
8870
|
allErrors: true,
|
|
8602
8871
|
verbose: true,
|
|
@@ -8701,6 +8970,8 @@ function convertSection(section, warnings) {
|
|
|
8701
8970
|
return convertPersona(section);
|
|
8702
8971
|
case "context":
|
|
8703
8972
|
return convertContext(section);
|
|
8973
|
+
case "file-reference":
|
|
8974
|
+
return convertFileReference(section, warnings);
|
|
8704
8975
|
case "tools":
|
|
8705
8976
|
warnings.push("Tools section skipped (Claude-specific)");
|
|
8706
8977
|
return "";
|
|
@@ -8807,6 +9078,32 @@ function convertContext(section) {
|
|
|
8807
9078
|
lines.push(section.content);
|
|
8808
9079
|
return lines.join("\n");
|
|
8809
9080
|
}
|
|
9081
|
+
function convertFileReference(section, warnings) {
|
|
9082
|
+
const lines = [];
|
|
9083
|
+
if (section.description) {
|
|
9084
|
+
lines.push(`## ${section.title}`);
|
|
9085
|
+
lines.push("");
|
|
9086
|
+
lines.push(section.description);
|
|
9087
|
+
lines.push("");
|
|
9088
|
+
}
|
|
9089
|
+
let sanitizedPath = section.path.trim();
|
|
9090
|
+
if (sanitizedPath.startsWith("/") || /^[A-Z]:/i.test(sanitizedPath)) {
|
|
9091
|
+
warnings.push(`Rejected absolute path: ${section.path} - converted to relative path`);
|
|
9092
|
+
sanitizedPath = sanitizedPath.replace(/^\/+/, "").replace(/^[A-Z]:/i, "");
|
|
9093
|
+
}
|
|
9094
|
+
if (sanitizedPath.includes("../") || sanitizedPath.includes("..\\")) {
|
|
9095
|
+
warnings.push(`Rejected parent traversal in path: ${section.path} - removed traversal segments`);
|
|
9096
|
+
sanitizedPath = sanitizedPath.split("/").filter((seg) => seg !== "..").join("/");
|
|
9097
|
+
}
|
|
9098
|
+
if (/[\r\n\t]/.test(sanitizedPath)) {
|
|
9099
|
+
warnings.push(`Rejected control characters in path: ${section.path}`);
|
|
9100
|
+
sanitizedPath = sanitizedPath.replace(/[\r\n\t]/g, "");
|
|
9101
|
+
}
|
|
9102
|
+
const sanitizedCategory = (section.category || "converted package").replace(/-->/g, "-->").replace(/</g, "<").replace(/>/g, ">");
|
|
9103
|
+
lines.push(`<!-- PRPM: File reference from ${sanitizedCategory} -->`);
|
|
9104
|
+
lines.push(`@file ${sanitizedPath}`);
|
|
9105
|
+
return lines.join("\n");
|
|
9106
|
+
}
|
|
8810
9107
|
function isCursorFormat(content) {
|
|
8811
9108
|
return content.includes("# ") && !content.includes("---\n") && // Not Claude format (has frontmatter)
|
|
8812
9109
|
!content.includes('"systemMessage"');
|
|
@@ -10436,12 +10733,84 @@ var init_to_gemini = __esm({
|
|
|
10436
10733
|
}
|
|
10437
10734
|
});
|
|
10438
10735
|
|
|
10736
|
+
// ../converters/dist/to-gemini-plugin.js
|
|
10737
|
+
function toGeminiPlugin(pkg) {
|
|
10738
|
+
const warnings = [];
|
|
10739
|
+
let qualityScore = 100;
|
|
10740
|
+
try {
|
|
10741
|
+
const content = convertContent6(pkg, warnings);
|
|
10742
|
+
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
10743
|
+
if (lossyConversion) {
|
|
10744
|
+
qualityScore -= 10;
|
|
10745
|
+
}
|
|
10746
|
+
return {
|
|
10747
|
+
content,
|
|
10748
|
+
format: "gemini",
|
|
10749
|
+
warnings: warnings.length > 0 ? warnings : void 0,
|
|
10750
|
+
lossyConversion,
|
|
10751
|
+
qualityScore
|
|
10752
|
+
};
|
|
10753
|
+
} catch (error) {
|
|
10754
|
+
warnings.push(`Conversion error: ${error instanceof Error ? error.message : String(error)}`);
|
|
10755
|
+
return {
|
|
10756
|
+
content: "",
|
|
10757
|
+
format: "gemini",
|
|
10758
|
+
warnings,
|
|
10759
|
+
lossyConversion: true,
|
|
10760
|
+
qualityScore: 0
|
|
10761
|
+
};
|
|
10762
|
+
}
|
|
10763
|
+
}
|
|
10764
|
+
function convertContent6(pkg, warnings) {
|
|
10765
|
+
var _a, _b;
|
|
10766
|
+
const metadata = pkg.content.sections.find((s) => s.type === "metadata");
|
|
10767
|
+
const config = {
|
|
10768
|
+
name: pkg.name,
|
|
10769
|
+
version: pkg.version
|
|
10770
|
+
};
|
|
10771
|
+
if (pkg.description) {
|
|
10772
|
+
config.description = pkg.description;
|
|
10773
|
+
}
|
|
10774
|
+
if (pkg.author) {
|
|
10775
|
+
config.author = pkg.author;
|
|
10776
|
+
}
|
|
10777
|
+
const geminiData = (metadata == null ? void 0 : metadata.type) === "metadata" ? (_a = metadata.data) == null ? void 0 : _a.geminiExtension : void 0;
|
|
10778
|
+
const geminiMeta = (_b = pkg.metadata) == null ? void 0 : _b.geminiExtension;
|
|
10779
|
+
if (geminiData || geminiMeta) {
|
|
10780
|
+
const geminiConfig = geminiData || geminiMeta;
|
|
10781
|
+
if (geminiConfig == null ? void 0 : geminiConfig.mcpServers) {
|
|
10782
|
+
config.mcpServers = geminiConfig.mcpServers;
|
|
10783
|
+
}
|
|
10784
|
+
if (geminiConfig == null ? void 0 : geminiConfig.contextFileName) {
|
|
10785
|
+
config.contextFileName = geminiConfig.contextFileName;
|
|
10786
|
+
}
|
|
10787
|
+
if (geminiConfig == null ? void 0 : geminiConfig.excludeTools) {
|
|
10788
|
+
config.excludeTools = geminiConfig.excludeTools;
|
|
10789
|
+
}
|
|
10790
|
+
if (geminiConfig == null ? void 0 : geminiConfig.experimentalSettings) {
|
|
10791
|
+
config.experimentalSettings = geminiConfig.experimentalSettings;
|
|
10792
|
+
}
|
|
10793
|
+
}
|
|
10794
|
+
const unsupportedSections = pkg.content.sections.filter((s) => s.type !== "metadata" && s.type !== "instructions");
|
|
10795
|
+
if (unsupportedSections.length > 0) {
|
|
10796
|
+
const types2 = [...new Set(unsupportedSections.map((s) => s.type))];
|
|
10797
|
+
warnings.push(`Gemini extensions do not support ${types2.join(", ")} sections - these will be skipped`);
|
|
10798
|
+
}
|
|
10799
|
+
return JSON.stringify(config, null, 2) + "\n";
|
|
10800
|
+
}
|
|
10801
|
+
var init_to_gemini_plugin = __esm({
|
|
10802
|
+
"../converters/dist/to-gemini-plugin.js"() {
|
|
10803
|
+
"use strict";
|
|
10804
|
+
init_cjs_shims();
|
|
10805
|
+
}
|
|
10806
|
+
});
|
|
10807
|
+
|
|
10439
10808
|
// ../converters/dist/to-opencode.js
|
|
10440
10809
|
function toOpencode(pkg) {
|
|
10441
10810
|
const warnings = [];
|
|
10442
10811
|
let qualityScore = 100;
|
|
10443
10812
|
try {
|
|
10444
|
-
const content =
|
|
10813
|
+
const content = convertContent7(pkg, warnings);
|
|
10445
10814
|
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
10446
10815
|
if (lossyConversion) {
|
|
10447
10816
|
qualityScore -= 10;
|
|
@@ -10464,7 +10833,7 @@ function toOpencode(pkg) {
|
|
|
10464
10833
|
};
|
|
10465
10834
|
}
|
|
10466
10835
|
}
|
|
10467
|
-
function
|
|
10836
|
+
function convertContent7(pkg, warnings) {
|
|
10468
10837
|
const lines = [];
|
|
10469
10838
|
const metadata = pkg.content.sections.find((s) => s.type === "metadata");
|
|
10470
10839
|
const tools = pkg.content.sections.find((s) => s.type === "tools");
|
|
@@ -10609,7 +10978,7 @@ function toRuler(pkg, options = {}) {
|
|
|
10609
10978
|
warnings.push("Hooks are not supported by Ruler");
|
|
10610
10979
|
qualityScore -= 20;
|
|
10611
10980
|
}
|
|
10612
|
-
const content =
|
|
10981
|
+
const content = convertContent8(pkg.content, warnings);
|
|
10613
10982
|
const header = `<!-- Package: ${pkg.name} -->
|
|
10614
10983
|
<!-- Author: ${pkg.author || "Unknown"} -->
|
|
10615
10984
|
${pkg.description ? `<!-- Description: ${pkg.description} -->
|
|
@@ -10645,7 +11014,7 @@ ${content}`;
|
|
|
10645
11014
|
};
|
|
10646
11015
|
}
|
|
10647
11016
|
}
|
|
10648
|
-
function
|
|
11017
|
+
function convertContent8(content, warnings) {
|
|
10649
11018
|
const parts = [];
|
|
10650
11019
|
const metadataSection = content.sections.find((s) => s.type === "metadata");
|
|
10651
11020
|
if (metadataSection) {
|
|
@@ -10753,7 +11122,7 @@ function toDroid(pkg) {
|
|
|
10753
11122
|
const warnings = [];
|
|
10754
11123
|
let qualityScore = 100;
|
|
10755
11124
|
try {
|
|
10756
|
-
const result =
|
|
11125
|
+
const result = convertContent9(pkg, warnings, qualityScore);
|
|
10757
11126
|
const content = result.content;
|
|
10758
11127
|
qualityScore = result.qualityScore;
|
|
10759
11128
|
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
@@ -10778,7 +11147,7 @@ function toDroid(pkg) {
|
|
|
10778
11147
|
};
|
|
10779
11148
|
}
|
|
10780
11149
|
}
|
|
10781
|
-
function
|
|
11150
|
+
function convertContent9(pkg, warnings, qualityScore) {
|
|
10782
11151
|
var _a;
|
|
10783
11152
|
const lines = [];
|
|
10784
11153
|
const metadata = pkg.content.sections.find((s) => s.type === "metadata");
|
|
@@ -10882,7 +11251,7 @@ function toTrae(pkg, options = {}) {
|
|
|
10882
11251
|
const warnings = [];
|
|
10883
11252
|
let qualityScore = 100;
|
|
10884
11253
|
try {
|
|
10885
|
-
const content =
|
|
11254
|
+
const content = convertContent10(pkg, warnings);
|
|
10886
11255
|
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
10887
11256
|
if (lossyConversion) {
|
|
10888
11257
|
qualityScore -= 10;
|
|
@@ -10905,7 +11274,7 @@ function toTrae(pkg, options = {}) {
|
|
|
10905
11274
|
};
|
|
10906
11275
|
}
|
|
10907
11276
|
}
|
|
10908
|
-
function
|
|
11277
|
+
function convertContent10(pkg, warnings) {
|
|
10909
11278
|
var _a, _b, _c;
|
|
10910
11279
|
const lines = [];
|
|
10911
11280
|
const title = ((_a = pkg.metadata) == null ? void 0 : _a.title) || pkg.name;
|
|
@@ -11024,7 +11393,7 @@ function toAider(pkg, options = {}) {
|
|
|
11024
11393
|
const warnings = [];
|
|
11025
11394
|
let qualityScore = 100;
|
|
11026
11395
|
try {
|
|
11027
|
-
const content =
|
|
11396
|
+
const content = convertContent11(pkg, warnings);
|
|
11028
11397
|
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
11029
11398
|
if (lossyConversion) {
|
|
11030
11399
|
qualityScore -= 10;
|
|
@@ -11047,7 +11416,7 @@ function toAider(pkg, options = {}) {
|
|
|
11047
11416
|
};
|
|
11048
11417
|
}
|
|
11049
11418
|
}
|
|
11050
|
-
function
|
|
11419
|
+
function convertContent11(pkg, warnings) {
|
|
11051
11420
|
var _a, _b, _c;
|
|
11052
11421
|
const lines = [];
|
|
11053
11422
|
const title = ((_a = pkg.metadata) == null ? void 0 : _a.title) || pkg.name;
|
|
@@ -11170,7 +11539,7 @@ function toZencoder(pkg, options = {}) {
|
|
|
11170
11539
|
const config = options.zencoderConfig || {};
|
|
11171
11540
|
const hasConfig = config.description || config.globs || config.alwaysApply !== void 0 || ((_a = pkg.metadata) == null ? void 0 : _a.globs) || ((_b = pkg.metadata) == null ? void 0 : _b.alwaysApply) !== void 0;
|
|
11172
11541
|
const includeFrontmatter = config.includeFrontmatter ?? hasConfig;
|
|
11173
|
-
const content =
|
|
11542
|
+
const content = convertContent12(pkg, warnings, config);
|
|
11174
11543
|
let fullContent;
|
|
11175
11544
|
if (includeFrontmatter) {
|
|
11176
11545
|
const frontmatter = generateFrontmatter3(pkg, config);
|
|
@@ -11243,7 +11612,7 @@ function generateFrontmatter3(pkg, config) {
|
|
|
11243
11612
|
}
|
|
11244
11613
|
return "";
|
|
11245
11614
|
}
|
|
11246
|
-
function
|
|
11615
|
+
function convertContent12(pkg, warnings, config) {
|
|
11247
11616
|
var _a, _b, _c;
|
|
11248
11617
|
const lines = [];
|
|
11249
11618
|
const title = ((_a = pkg.metadata) == null ? void 0 : _a.title) || pkg.name;
|
|
@@ -11368,7 +11737,7 @@ function toReplit(pkg, options = {}) {
|
|
|
11368
11737
|
const warnings = [];
|
|
11369
11738
|
let qualityScore = 100;
|
|
11370
11739
|
try {
|
|
11371
|
-
const content =
|
|
11740
|
+
const content = convertContent13(pkg, warnings);
|
|
11372
11741
|
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
11373
11742
|
if (lossyConversion) {
|
|
11374
11743
|
qualityScore -= 10;
|
|
@@ -11391,7 +11760,7 @@ function toReplit(pkg, options = {}) {
|
|
|
11391
11760
|
};
|
|
11392
11761
|
}
|
|
11393
11762
|
}
|
|
11394
|
-
function
|
|
11763
|
+
function convertContent13(pkg, warnings) {
|
|
11395
11764
|
var _a, _b, _c;
|
|
11396
11765
|
const lines = [];
|
|
11397
11766
|
const title = ((_a = pkg.metadata) == null ? void 0 : _a.title) || pkg.name;
|
|
@@ -11505,6 +11874,175 @@ var init_to_replit = __esm({
|
|
|
11505
11874
|
}
|
|
11506
11875
|
});
|
|
11507
11876
|
|
|
11877
|
+
// ../converters/dist/to-zed.js
|
|
11878
|
+
function toZed(pkg, options = {}) {
|
|
11879
|
+
const warnings = [];
|
|
11880
|
+
let qualityScore = 100;
|
|
11881
|
+
try {
|
|
11882
|
+
const fullContent = convertContent14(pkg, warnings);
|
|
11883
|
+
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
11884
|
+
if (lossyConversion) {
|
|
11885
|
+
qualityScore -= 10;
|
|
11886
|
+
}
|
|
11887
|
+
return {
|
|
11888
|
+
content: fullContent,
|
|
11889
|
+
format: "zed",
|
|
11890
|
+
warnings: warnings.length > 0 ? warnings : void 0,
|
|
11891
|
+
lossyConversion,
|
|
11892
|
+
qualityScore
|
|
11893
|
+
};
|
|
11894
|
+
} catch (error) {
|
|
11895
|
+
warnings.push(`Conversion error: ${error instanceof Error ? error.message : String(error)}`);
|
|
11896
|
+
return {
|
|
11897
|
+
content: "",
|
|
11898
|
+
format: "zed",
|
|
11899
|
+
warnings,
|
|
11900
|
+
lossyConversion: true,
|
|
11901
|
+
qualityScore: 0
|
|
11902
|
+
};
|
|
11903
|
+
}
|
|
11904
|
+
}
|
|
11905
|
+
function convertContent14(pkg, warnings) {
|
|
11906
|
+
var _a, _b, _c;
|
|
11907
|
+
const lines = [];
|
|
11908
|
+
const projectName = ((_a = pkg.metadata) == null ? void 0 : _a.title) || pkg.name;
|
|
11909
|
+
lines.push(`# ${projectName}`);
|
|
11910
|
+
lines.push("");
|
|
11911
|
+
if (pkg.description || ((_b = pkg.metadata) == null ? void 0 : _b.description)) {
|
|
11912
|
+
lines.push(pkg.description || ((_c = pkg.metadata) == null ? void 0 : _c.description) || "");
|
|
11913
|
+
lines.push("");
|
|
11914
|
+
}
|
|
11915
|
+
for (const section of pkg.content.sections) {
|
|
11916
|
+
if (section.type === "metadata" || section.type === "tools" || section.type === "persona") {
|
|
11917
|
+
if (section.type === "persona") {
|
|
11918
|
+
warnings.push("Persona section skipped (not supported by Zed)");
|
|
11919
|
+
} else if (section.type === "tools") {
|
|
11920
|
+
warnings.push("Tools section skipped (not supported by Zed)");
|
|
11921
|
+
}
|
|
11922
|
+
continue;
|
|
11923
|
+
}
|
|
11924
|
+
const sectionContent = convertSection12(section, warnings);
|
|
11925
|
+
if (sectionContent) {
|
|
11926
|
+
lines.push(sectionContent);
|
|
11927
|
+
lines.push("");
|
|
11928
|
+
}
|
|
11929
|
+
}
|
|
11930
|
+
return lines.join("\n").trim();
|
|
11931
|
+
}
|
|
11932
|
+
function convertSection12(section, warnings) {
|
|
11933
|
+
switch (section.type) {
|
|
11934
|
+
case "instructions":
|
|
11935
|
+
return convertInstructions12(section);
|
|
11936
|
+
case "rules":
|
|
11937
|
+
return convertRules12(section);
|
|
11938
|
+
case "examples":
|
|
11939
|
+
return convertExamples12(section);
|
|
11940
|
+
case "context":
|
|
11941
|
+
return convertContext12(section);
|
|
11942
|
+
case "custom":
|
|
11943
|
+
if (!section.editorType) {
|
|
11944
|
+
return section.content;
|
|
11945
|
+
}
|
|
11946
|
+
if (section.editorType === "zed") {
|
|
11947
|
+
return section.content;
|
|
11948
|
+
}
|
|
11949
|
+
warnings.push(`Custom ${section.editorType} section skipped`);
|
|
11950
|
+
return "";
|
|
11951
|
+
default:
|
|
11952
|
+
return "";
|
|
11953
|
+
}
|
|
11954
|
+
}
|
|
11955
|
+
function convertInstructions12(section) {
|
|
11956
|
+
const lines = [];
|
|
11957
|
+
lines.push(`## ${section.title}`);
|
|
11958
|
+
lines.push("");
|
|
11959
|
+
lines.push(section.content);
|
|
11960
|
+
return lines.join("\n");
|
|
11961
|
+
}
|
|
11962
|
+
function convertRules12(section) {
|
|
11963
|
+
const lines = [];
|
|
11964
|
+
lines.push(`## ${section.title}`);
|
|
11965
|
+
lines.push("");
|
|
11966
|
+
section.items.forEach((rule, index) => {
|
|
11967
|
+
const prefix = section.ordered ? `${index + 1}.` : "-";
|
|
11968
|
+
lines.push(`${prefix} ${rule.content}`);
|
|
11969
|
+
if (rule.rationale) {
|
|
11970
|
+
lines.push(` - Rationale: ${rule.rationale}`);
|
|
11971
|
+
}
|
|
11972
|
+
if (rule.examples && rule.examples.length > 0) {
|
|
11973
|
+
rule.examples.forEach((example) => {
|
|
11974
|
+
lines.push(` - Example: \`${example}\``);
|
|
11975
|
+
});
|
|
11976
|
+
}
|
|
11977
|
+
});
|
|
11978
|
+
return lines.join("\n");
|
|
11979
|
+
}
|
|
11980
|
+
function convertExamples12(section) {
|
|
11981
|
+
const lines = [];
|
|
11982
|
+
lines.push(`## ${section.title}`);
|
|
11983
|
+
lines.push("");
|
|
11984
|
+
section.examples.forEach((example) => {
|
|
11985
|
+
if (example.good === false) {
|
|
11986
|
+
lines.push(`### \u274C Avoid: ${example.description}`);
|
|
11987
|
+
} else if (example.good === true) {
|
|
11988
|
+
lines.push(`### \u2705 Preferred: ${example.description}`);
|
|
11989
|
+
} else {
|
|
11990
|
+
lines.push(`### ${example.description}`);
|
|
11991
|
+
}
|
|
11992
|
+
lines.push("");
|
|
11993
|
+
const lang = example.language || "";
|
|
11994
|
+
lines.push("```" + lang);
|
|
11995
|
+
lines.push(example.code);
|
|
11996
|
+
lines.push("```");
|
|
11997
|
+
lines.push("");
|
|
11998
|
+
});
|
|
11999
|
+
return lines.join("\n");
|
|
12000
|
+
}
|
|
12001
|
+
function convertContext12(section) {
|
|
12002
|
+
const lines = [];
|
|
12003
|
+
lines.push(`## ${section.title}`);
|
|
12004
|
+
lines.push("");
|
|
12005
|
+
lines.push(section.content);
|
|
12006
|
+
return lines.join("\n");
|
|
12007
|
+
}
|
|
12008
|
+
function isZedFormat2(content) {
|
|
12009
|
+
const trimmed = content.trim();
|
|
12010
|
+
if (trimmed.startsWith("---")) {
|
|
12011
|
+
return false;
|
|
12012
|
+
}
|
|
12013
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
12014
|
+
return false;
|
|
12015
|
+
}
|
|
12016
|
+
return true;
|
|
12017
|
+
}
|
|
12018
|
+
function generateFilename(pkg, config) {
|
|
12019
|
+
if (config == null ? void 0 : config.useAlternativeFile) {
|
|
12020
|
+
switch (config.useAlternativeFile) {
|
|
12021
|
+
case "cursorrules":
|
|
12022
|
+
return ".cursorrules";
|
|
12023
|
+
case "windsurfrules":
|
|
12024
|
+
return ".windsurfrules";
|
|
12025
|
+
case "clinerules":
|
|
12026
|
+
return ".clinerules";
|
|
12027
|
+
case "agents":
|
|
12028
|
+
return "AGENTS.md";
|
|
12029
|
+
case "claude":
|
|
12030
|
+
return "CLAUDE.md";
|
|
12031
|
+
case "gemini":
|
|
12032
|
+
return "GEMINI.md";
|
|
12033
|
+
default:
|
|
12034
|
+
return ".rules";
|
|
12035
|
+
}
|
|
12036
|
+
}
|
|
12037
|
+
return ".rules";
|
|
12038
|
+
}
|
|
12039
|
+
var init_to_zed = __esm({
|
|
12040
|
+
"../converters/dist/to-zed.js"() {
|
|
12041
|
+
"use strict";
|
|
12042
|
+
init_cjs_shims();
|
|
12043
|
+
}
|
|
12044
|
+
});
|
|
12045
|
+
|
|
11508
12046
|
// ../converters/dist/to-mcp-server.js
|
|
11509
12047
|
function toMCPServer(pkg) {
|
|
11510
12048
|
var _a, _b;
|
|
@@ -11584,17 +12122,17 @@ var init_to_mcp_server = __esm({
|
|
|
11584
12122
|
});
|
|
11585
12123
|
|
|
11586
12124
|
// ../converters/dist/schema-files.js
|
|
11587
|
-
var import_module,
|
|
12125
|
+
var import_module, import_path7, schemaRequire, convertersPackagePath, convertersDir, loadSchema2, formatRegistrySchema, agentsMdSchema, canonicalSchema, claudeSchema, continueSchema, copilotSchema, cursorSchema, droidSchema, geminiMdSchema, geminiSchema, kiroSteeringSchema, opencodeSchema, rulerSchema, windsurfSchema, traeSchema, aiderSchema, zencoderSchema, replitSchema, zedSchema, claudeAgentSchema, claudeHookSchema, claudeSkillSchema, claudeSlashCommandSchema, cursorCommandSchema, cursorHooksSchema, droidHookSchema, droidSkillSchema, droidSlashCommandSchema, kiroAgentSchema, kiroHookSchema, opencodeSlashCommandSchema;
|
|
11588
12126
|
var init_schema_files = __esm({
|
|
11589
12127
|
"../converters/dist/schema-files.js"() {
|
|
11590
12128
|
"use strict";
|
|
11591
12129
|
init_cjs_shims();
|
|
11592
12130
|
import_module = require("module");
|
|
11593
|
-
|
|
12131
|
+
import_path7 = require("path");
|
|
11594
12132
|
schemaRequire = (0, import_module.createRequire)(importMetaUrl);
|
|
11595
12133
|
convertersPackagePath = schemaRequire.resolve("@pr-pm/converters/package.json");
|
|
11596
|
-
convertersDir = (0,
|
|
11597
|
-
loadSchema2 = (filename) => schemaRequire((0,
|
|
12134
|
+
convertersDir = (0, import_path7.dirname)(convertersPackagePath);
|
|
12135
|
+
loadSchema2 = (filename) => schemaRequire((0, import_path7.join)(convertersDir, "schemas", filename));
|
|
11598
12136
|
formatRegistrySchema = loadSchema2("format-registry.schema.json");
|
|
11599
12137
|
agentsMdSchema = loadSchema2("agents-md.schema.json");
|
|
11600
12138
|
canonicalSchema = loadSchema2("canonical.schema.json");
|
|
@@ -11613,6 +12151,7 @@ var init_schema_files = __esm({
|
|
|
11613
12151
|
aiderSchema = loadSchema2("aider.schema.json");
|
|
11614
12152
|
zencoderSchema = loadSchema2("zencoder.schema.json");
|
|
11615
12153
|
replitSchema = loadSchema2("replit.schema.json");
|
|
12154
|
+
zedSchema = loadSchema2("zed.schema.json");
|
|
11616
12155
|
claudeAgentSchema = loadSchema2("claude-agent.schema.json");
|
|
11617
12156
|
claudeHookSchema = loadSchema2("claude-hook.schema.json");
|
|
11618
12157
|
claudeSkillSchema = loadSchema2("claude-skill.schema.json");
|
|
@@ -11793,13 +12332,22 @@ var init_format_registry = __esm({
|
|
|
11793
12332
|
},
|
|
11794
12333
|
gemini: {
|
|
11795
12334
|
name: "Gemini CLI",
|
|
11796
|
-
description: "Gemini CLI custom commands",
|
|
12335
|
+
description: "Gemini CLI custom commands and extensions",
|
|
11797
12336
|
documentationUrl: "https://geminicli.com",
|
|
12337
|
+
rootFiles: [".gemini/extensions/*/gemini-extension.json"],
|
|
11798
12338
|
subtypes: {
|
|
11799
12339
|
"slash-command": {
|
|
11800
12340
|
directory: ".gemini/commands",
|
|
11801
12341
|
filePatterns: ["*.toml"],
|
|
11802
12342
|
fileExtension: ".toml"
|
|
12343
|
+
},
|
|
12344
|
+
extension: {
|
|
12345
|
+
directory: ".gemini/extensions",
|
|
12346
|
+
filePatterns: ["gemini-extension.json"],
|
|
12347
|
+
nested: true,
|
|
12348
|
+
nestedIndicator: "gemini-extension.json",
|
|
12349
|
+
usesPackageSubdirectory: true,
|
|
12350
|
+
fileExtension: ".json"
|
|
11803
12351
|
}
|
|
11804
12352
|
}
|
|
11805
12353
|
},
|
|
@@ -12133,13 +12681,197 @@ var init_format_registry2 = __esm({
|
|
|
12133
12681
|
}
|
|
12134
12682
|
});
|
|
12135
12683
|
|
|
12684
|
+
// ../converters/dist/utils/progressive-disclosure.js
|
|
12685
|
+
function loadFormatCapabilities() {
|
|
12686
|
+
try {
|
|
12687
|
+
const dataPath = (0, import_path8.join)(__dirname2, "format-capabilities.json");
|
|
12688
|
+
const data = (0, import_fs7.readFileSync)(dataPath, "utf-8");
|
|
12689
|
+
const parsed = JSON.parse(data);
|
|
12690
|
+
if (!parsed || typeof parsed !== "object") {
|
|
12691
|
+
throw new Error("Invalid format-capabilities.json: not an object");
|
|
12692
|
+
}
|
|
12693
|
+
if (!parsed.agentsMdSupport || !Array.isArray(parsed.agentsMdSupport.formats)) {
|
|
12694
|
+
throw new Error("Invalid format-capabilities.json: missing agentsMdSupport.formats array");
|
|
12695
|
+
}
|
|
12696
|
+
if (!parsed.formats || typeof parsed.formats !== "object") {
|
|
12697
|
+
throw new Error("Invalid format-capabilities.json: missing formats object");
|
|
12698
|
+
}
|
|
12699
|
+
return parsed;
|
|
12700
|
+
} catch (error) {
|
|
12701
|
+
console.error(`Failed to load format-capabilities.json: ${error instanceof Error ? error.message : String(error)}`);
|
|
12702
|
+
console.error("Using minimal fallback capabilities");
|
|
12703
|
+
return {
|
|
12704
|
+
version: "1.0.0",
|
|
12705
|
+
description: "Minimal fallback capabilities due to load error",
|
|
12706
|
+
agentsMdSupport: {
|
|
12707
|
+
description: "Basic agents.md support (fallback)",
|
|
12708
|
+
formats: ["cursor", "copilot", "windsurf", "continue", "kiro", "droid", "opencode", "trae", "zed", "agents.md"]
|
|
12709
|
+
},
|
|
12710
|
+
formats: {}
|
|
12711
|
+
};
|
|
12712
|
+
}
|
|
12713
|
+
}
|
|
12714
|
+
function supportsAgentsMd(format) {
|
|
12715
|
+
return AGENTS_MD_SUPPORTED_FORMATS.includes(format);
|
|
12716
|
+
}
|
|
12717
|
+
function formatSupportsSubtype2(format, subtype) {
|
|
12718
|
+
const capabilities = FORMAT_CAPABILITIES[format];
|
|
12719
|
+
if (!capabilities)
|
|
12720
|
+
return false;
|
|
12721
|
+
switch (subtype) {
|
|
12722
|
+
case "skill":
|
|
12723
|
+
return capabilities.supportsSkills || false;
|
|
12724
|
+
case "plugin":
|
|
12725
|
+
case "extension":
|
|
12726
|
+
return capabilities.supportsPlugins || capabilities.supportsExtensions || false;
|
|
12727
|
+
case "agent":
|
|
12728
|
+
return capabilities.supportsAgents || false;
|
|
12729
|
+
default:
|
|
12730
|
+
return true;
|
|
12731
|
+
}
|
|
12732
|
+
}
|
|
12733
|
+
function shouldUseMarkdownFallback(targetFormat, sourceSubtype) {
|
|
12734
|
+
const capabilities = FORMAT_CAPABILITIES[targetFormat];
|
|
12735
|
+
if (!capabilities) {
|
|
12736
|
+
return { shouldFallback: false };
|
|
12737
|
+
}
|
|
12738
|
+
const supportsSubtype = formatSupportsSubtype2(targetFormat, sourceSubtype);
|
|
12739
|
+
if (!supportsSubtype) {
|
|
12740
|
+
return {
|
|
12741
|
+
shouldFallback: true,
|
|
12742
|
+
fallbackFormat: capabilities.markdownFallback,
|
|
12743
|
+
reason: `${targetFormat} doesn't support ${sourceSubtype} subtype`
|
|
12744
|
+
};
|
|
12745
|
+
}
|
|
12746
|
+
return { shouldFallback: false };
|
|
12747
|
+
}
|
|
12748
|
+
function getRecommendedFormat(targetFormat, sourceSubtype) {
|
|
12749
|
+
const warnings = [];
|
|
12750
|
+
const fallback = shouldUseMarkdownFallback(targetFormat, sourceSubtype);
|
|
12751
|
+
if (fallback.shouldFallback) {
|
|
12752
|
+
warnings.push(`Progressive disclosure: Using ${fallback.fallbackFormat} because ${fallback.reason}`);
|
|
12753
|
+
return {
|
|
12754
|
+
format: "markdown",
|
|
12755
|
+
filename: fallback.fallbackFormat,
|
|
12756
|
+
useProgressive: true,
|
|
12757
|
+
warnings
|
|
12758
|
+
};
|
|
12759
|
+
}
|
|
12760
|
+
return {
|
|
12761
|
+
format: targetFormat,
|
|
12762
|
+
subtype: sourceSubtype,
|
|
12763
|
+
useProgressive: false,
|
|
12764
|
+
warnings
|
|
12765
|
+
};
|
|
12766
|
+
}
|
|
12767
|
+
function getUniversalFallback() {
|
|
12768
|
+
return {
|
|
12769
|
+
format: "markdown",
|
|
12770
|
+
filename: "agents.md",
|
|
12771
|
+
description: "Universal agent format - works with OpenAI, Gemini, Claude, and most AI systems"
|
|
12772
|
+
};
|
|
12773
|
+
}
|
|
12774
|
+
function getFallbackChain(format) {
|
|
12775
|
+
const chain = [];
|
|
12776
|
+
const capabilities = FORMAT_CAPABILITIES[format];
|
|
12777
|
+
chain.push({
|
|
12778
|
+
format,
|
|
12779
|
+
filename: (capabilities == null ? void 0 : capabilities.markdownFallback) || "README.md",
|
|
12780
|
+
priority: 1,
|
|
12781
|
+
description: `Native ${format} format`
|
|
12782
|
+
});
|
|
12783
|
+
if (capabilities == null ? void 0 : capabilities.markdownFallback) {
|
|
12784
|
+
const fallbackFilename = capabilities.markdownFallback;
|
|
12785
|
+
const formatName = capabilities.name || format;
|
|
12786
|
+
chain.push({
|
|
12787
|
+
format: "markdown",
|
|
12788
|
+
filename: fallbackFilename,
|
|
12789
|
+
priority: 2,
|
|
12790
|
+
description: `${formatName}-specific markdown format`
|
|
12791
|
+
});
|
|
12792
|
+
}
|
|
12793
|
+
chain.push({
|
|
12794
|
+
format: "markdown",
|
|
12795
|
+
filename: "agents.md",
|
|
12796
|
+
priority: 3,
|
|
12797
|
+
description: "Universal agents.md format"
|
|
12798
|
+
});
|
|
12799
|
+
return chain;
|
|
12800
|
+
}
|
|
12801
|
+
function getConversionStrategy(targetFormat, sourceSubtype, options) {
|
|
12802
|
+
const warnings = [];
|
|
12803
|
+
let qualityScore = 100;
|
|
12804
|
+
if (options == null ? void 0 : options.forceMarkdown) {
|
|
12805
|
+
const capabilities = FORMAT_CAPABILITIES[targetFormat];
|
|
12806
|
+
return {
|
|
12807
|
+
primaryFormat: "markdown",
|
|
12808
|
+
primaryFilename: capabilities == null ? void 0 : capabilities.markdownFallback,
|
|
12809
|
+
strategy: "progressive",
|
|
12810
|
+
warnings: ["Forced markdown fallback as requested"],
|
|
12811
|
+
qualityScore: 80
|
|
12812
|
+
};
|
|
12813
|
+
}
|
|
12814
|
+
if (options == null ? void 0 : options.preferUniversal) {
|
|
12815
|
+
return {
|
|
12816
|
+
primaryFormat: "markdown",
|
|
12817
|
+
primaryFilename: "agents.md",
|
|
12818
|
+
strategy: "universal",
|
|
12819
|
+
warnings: ["Using universal agents.md format for maximum compatibility"],
|
|
12820
|
+
qualityScore: 75
|
|
12821
|
+
};
|
|
12822
|
+
}
|
|
12823
|
+
const recommendation = getRecommendedFormat(targetFormat, sourceSubtype);
|
|
12824
|
+
if (recommendation.useProgressive) {
|
|
12825
|
+
qualityScore -= 15;
|
|
12826
|
+
return {
|
|
12827
|
+
primaryFormat: recommendation.format,
|
|
12828
|
+
primaryFilename: recommendation.filename,
|
|
12829
|
+
fallbackFormat: "markdown",
|
|
12830
|
+
fallbackFilename: "agents.md",
|
|
12831
|
+
strategy: "progressive",
|
|
12832
|
+
warnings: recommendation.warnings,
|
|
12833
|
+
qualityScore
|
|
12834
|
+
};
|
|
12835
|
+
}
|
|
12836
|
+
return {
|
|
12837
|
+
primaryFormat: recommendation.format,
|
|
12838
|
+
strategy: "native",
|
|
12839
|
+
warnings: [],
|
|
12840
|
+
qualityScore
|
|
12841
|
+
};
|
|
12842
|
+
}
|
|
12843
|
+
function getAllFormatCapabilities() {
|
|
12844
|
+
return capabilitiesData;
|
|
12845
|
+
}
|
|
12846
|
+
function getFormatCapability(format) {
|
|
12847
|
+
return capabilitiesData.formats[format];
|
|
12848
|
+
}
|
|
12849
|
+
var import_fs7, import_path8, import_url2, __filename2, __dirname2, capabilitiesData, AGENTS_MD_SUPPORTED_FORMATS, FORMAT_CAPABILITIES;
|
|
12850
|
+
var init_progressive_disclosure = __esm({
|
|
12851
|
+
"../converters/dist/utils/progressive-disclosure.js"() {
|
|
12852
|
+
"use strict";
|
|
12853
|
+
init_cjs_shims();
|
|
12854
|
+
import_fs7 = require("fs");
|
|
12855
|
+
import_path8 = require("path");
|
|
12856
|
+
import_url2 = require("url");
|
|
12857
|
+
__filename2 = (0, import_url2.fileURLToPath)(importMetaUrl);
|
|
12858
|
+
__dirname2 = (0, import_path8.dirname)(__filename2);
|
|
12859
|
+
capabilitiesData = loadFormatCapabilities();
|
|
12860
|
+
AGENTS_MD_SUPPORTED_FORMATS = capabilitiesData.agentsMdSupport.formats;
|
|
12861
|
+
FORMAT_CAPABILITIES = capabilitiesData.formats;
|
|
12862
|
+
}
|
|
12863
|
+
});
|
|
12864
|
+
|
|
12136
12865
|
// ../converters/dist/index.js
|
|
12137
12866
|
var dist_exports = {};
|
|
12138
12867
|
__export(dist_exports, {
|
|
12868
|
+
AGENTS_MD_SUPPORTED_FORMATS: () => AGENTS_MD_SUPPORTED_FORMATS,
|
|
12139
12869
|
CLAUDE_TO_CURSOR: () => CLAUDE_TO_CURSOR,
|
|
12140
12870
|
CLAUDE_TO_KIRO: () => CLAUDE_TO_KIRO,
|
|
12871
|
+
CLI_SUPPORTED_FORMATS: () => CLI_SUPPORTED_FORMATS,
|
|
12141
12872
|
CURSOR_TO_CLAUDE: () => CURSOR_TO_CLAUDE,
|
|
12142
12873
|
CURSOR_TO_KIRO: () => CURSOR_TO_KIRO,
|
|
12874
|
+
FORMAT_CAPABILITIES: () => FORMAT_CAPABILITIES,
|
|
12143
12875
|
KIRO_TO_CLAUDE: () => KIRO_TO_CLAUDE,
|
|
12144
12876
|
KIRO_TO_CURSOR: () => KIRO_TO_CURSOR,
|
|
12145
12877
|
SCRIPT_LANGUAGE_EXTENSIONS: () => SCRIPT_LANGUAGE_EXTENSIONS,
|
|
@@ -12169,7 +12901,7 @@ __export(dist_exports, {
|
|
|
12169
12901
|
findFormatByRootFile: () => findFormatByRootFile,
|
|
12170
12902
|
formatRegistry: () => formatRegistry,
|
|
12171
12903
|
formatRegistrySchema: () => formatRegistrySchema,
|
|
12172
|
-
formatSupportsSubtype: () =>
|
|
12904
|
+
formatSupportsSubtype: () => formatSupportsSubtype2,
|
|
12173
12905
|
formatValidationErrors: () => formatValidationErrors,
|
|
12174
12906
|
fromAgentsMd: () => fromAgentsMd,
|
|
12175
12907
|
fromAider: () => fromAider,
|
|
@@ -12181,6 +12913,7 @@ __export(dist_exports, {
|
|
|
12181
12913
|
fromCursorHooks: () => fromCursorHooks,
|
|
12182
12914
|
fromDroid: () => fromDroid,
|
|
12183
12915
|
fromGemini: () => fromGemini,
|
|
12916
|
+
fromGeminiPlugin: () => fromGeminiPlugin,
|
|
12184
12917
|
fromKiro: () => fromKiro,
|
|
12185
12918
|
fromKiroAgent: () => fromKiroAgent,
|
|
12186
12919
|
fromMCPServer: () => fromMCPServer,
|
|
@@ -12189,26 +12922,34 @@ __export(dist_exports, {
|
|
|
12189
12922
|
fromRuler: () => fromRuler,
|
|
12190
12923
|
fromTrae: () => fromTrae,
|
|
12191
12924
|
fromWindsurf: () => fromWindsurf,
|
|
12925
|
+
fromZed: () => fromZed,
|
|
12192
12926
|
fromZencoder: () => fromZencoder,
|
|
12193
12927
|
geminiMdSchema: () => geminiMdSchema,
|
|
12194
12928
|
geminiSchema: () => geminiSchema,
|
|
12195
12929
|
generateMCPServerPackage: () => generateMCPServerPackage,
|
|
12196
12930
|
generatePluginJson: () => generatePluginJson,
|
|
12931
|
+
generateZedFilename: () => generateFilename,
|
|
12932
|
+
getAllFormatCapabilities: () => getAllFormatCapabilities,
|
|
12933
|
+
getConversionStrategy: () => getConversionStrategy,
|
|
12197
12934
|
getDefaultSubtype: () => getDefaultSubtype,
|
|
12198
12935
|
getDestinationDirectory: () => getDestinationDirectory,
|
|
12936
|
+
getFallbackChain: () => getFallbackChain,
|
|
12199
12937
|
getFileExtension: () => getFileExtension,
|
|
12200
12938
|
getFilePatterns: () => getFilePatterns,
|
|
12939
|
+
getFormatCapability: () => getFormatCapability,
|
|
12201
12940
|
getFormatConfig: () => getFormatConfig,
|
|
12202
12941
|
getFormatNames: () => getFormatNames,
|
|
12203
12942
|
getFormatRegistry: () => getFormatRegistry,
|
|
12204
12943
|
getHookMapping: () => getHookMapping,
|
|
12205
12944
|
getNestedIndicator: () => getNestedIndicator,
|
|
12206
12945
|
getQualityPenalty: () => getQualityPenalty,
|
|
12946
|
+
getRecommendedFormat: () => getRecommendedFormat,
|
|
12207
12947
|
getRootFiles: () => getRootFiles,
|
|
12208
12948
|
getScanDirectory: () => getScanDirectory,
|
|
12209
12949
|
getScriptExtension: () => getScriptExtension,
|
|
12210
12950
|
getSubtypeConfig: () => getSubtypeConfig,
|
|
12211
12951
|
getSubtypes: () => getSubtypes,
|
|
12952
|
+
getUniversalFallback: () => getUniversalFallback,
|
|
12212
12953
|
isAgentsMdFormat: () => isAgentsMdFormat,
|
|
12213
12954
|
isAiderFormat: () => isAiderFormat,
|
|
12214
12955
|
isClaudeFormat: () => isClaudeFormat,
|
|
@@ -12225,6 +12966,8 @@ __export(dist_exports, {
|
|
|
12225
12966
|
isValidCursorHookType: () => isValidCursorHookType,
|
|
12226
12967
|
isValidHookMappingStrategy: () => isValidHookMappingStrategy,
|
|
12227
12968
|
isWindsurfFormat: () => isWindsurfFormat,
|
|
12969
|
+
isZedFormat: () => isZedFormat,
|
|
12970
|
+
isZedFormatTo: () => isZedFormat2,
|
|
12228
12971
|
isZencoderFormat: () => isZencoderFormat,
|
|
12229
12972
|
kiroAgentSchema: () => kiroAgentSchema,
|
|
12230
12973
|
kiroHookSchema: () => kiroHookSchema,
|
|
@@ -12240,6 +12983,8 @@ __export(dist_exports, {
|
|
|
12240
12983
|
resolveFormatForSubtype: () => resolveFormatForSubtype,
|
|
12241
12984
|
rulerSchema: () => rulerSchema,
|
|
12242
12985
|
setTaxonomy: () => setTaxonomy,
|
|
12986
|
+
shouldUseMarkdownFallback: () => shouldUseMarkdownFallback,
|
|
12987
|
+
supportsAgentsMd: () => supportsAgentsMd,
|
|
12243
12988
|
toAgentsMd: () => toAgentsMd,
|
|
12244
12989
|
toAider: () => toAider,
|
|
12245
12990
|
toClaude: () => toClaude,
|
|
@@ -12251,6 +12996,7 @@ __export(dist_exports, {
|
|
|
12251
12996
|
toCursorHooks: () => toCursorHooks,
|
|
12252
12997
|
toDroid: () => toDroid,
|
|
12253
12998
|
toGemini: () => toGemini,
|
|
12999
|
+
toGeminiPlugin: () => toGeminiPlugin,
|
|
12254
13000
|
toKiro: () => toKiro,
|
|
12255
13001
|
toKiroAgent: () => toKiroAgent,
|
|
12256
13002
|
toMCPServer: () => toMCPServer,
|
|
@@ -12259,12 +13005,14 @@ __export(dist_exports, {
|
|
|
12259
13005
|
toRuler: () => toRuler,
|
|
12260
13006
|
toTrae: () => toTrae,
|
|
12261
13007
|
toWindsurf: () => toWindsurf,
|
|
13008
|
+
toZed: () => toZed,
|
|
12262
13009
|
toZencoder: () => toZencoder,
|
|
12263
13010
|
traeSchema: () => traeSchema,
|
|
12264
13011
|
validateConversion: () => validateConversion,
|
|
12265
13012
|
validateFormat: () => validateFormat,
|
|
12266
13013
|
validateMarkdown: () => validateMarkdown,
|
|
12267
13014
|
windsurfSchema: () => windsurfSchema,
|
|
13015
|
+
zedSchema: () => zedSchema,
|
|
12268
13016
|
zencoderSchema: () => zencoderSchema
|
|
12269
13017
|
});
|
|
12270
13018
|
var init_dist = __esm({
|
|
@@ -12285,6 +13033,7 @@ var init_dist = __esm({
|
|
|
12285
13033
|
init_from_windsurf();
|
|
12286
13034
|
init_from_agents_md();
|
|
12287
13035
|
init_from_gemini();
|
|
13036
|
+
init_from_gemini_plugin();
|
|
12288
13037
|
init_from_opencode();
|
|
12289
13038
|
init_from_ruler();
|
|
12290
13039
|
init_from_droid();
|
|
@@ -12292,6 +13041,7 @@ var init_dist = __esm({
|
|
|
12292
13041
|
init_from_aider();
|
|
12293
13042
|
init_from_zencoder();
|
|
12294
13043
|
init_from_replit();
|
|
13044
|
+
init_from_zed();
|
|
12295
13045
|
init_from_mcp_server();
|
|
12296
13046
|
init_to_cursor();
|
|
12297
13047
|
init_to_cursor_hooks();
|
|
@@ -12304,6 +13054,7 @@ var init_dist = __esm({
|
|
|
12304
13054
|
init_to_windsurf();
|
|
12305
13055
|
init_to_agents_md();
|
|
12306
13056
|
init_to_gemini();
|
|
13057
|
+
init_to_gemini_plugin();
|
|
12307
13058
|
init_to_opencode();
|
|
12308
13059
|
init_to_ruler();
|
|
12309
13060
|
init_to_droid();
|
|
@@ -12311,11 +13062,13 @@ var init_dist = __esm({
|
|
|
12311
13062
|
init_to_aider();
|
|
12312
13063
|
init_to_zencoder();
|
|
12313
13064
|
init_to_replit();
|
|
13065
|
+
init_to_zed();
|
|
12314
13066
|
init_to_mcp_server();
|
|
12315
13067
|
init_taxonomy_utils();
|
|
12316
13068
|
init_validation();
|
|
12317
13069
|
init_schema_files();
|
|
12318
13070
|
init_format_registry2();
|
|
13071
|
+
init_progressive_disclosure();
|
|
12319
13072
|
}
|
|
12320
13073
|
});
|
|
12321
13074
|
|
|
@@ -12339,23 +13092,23 @@ function getDestinationDir2(format, subtype, name) {
|
|
|
12339
13092
|
}
|
|
12340
13093
|
async function ensureDirectoryExists(dirPath) {
|
|
12341
13094
|
try {
|
|
12342
|
-
await
|
|
13095
|
+
await import_fs8.promises.mkdir(dirPath, { recursive: true });
|
|
12343
13096
|
} catch (error) {
|
|
12344
13097
|
throw new Error(`Failed to create directory ${dirPath}: ${error}`);
|
|
12345
13098
|
}
|
|
12346
13099
|
}
|
|
12347
13100
|
async function saveFile(filePath, content) {
|
|
12348
13101
|
try {
|
|
12349
|
-
const dir =
|
|
13102
|
+
const dir = import_path9.default.dirname(filePath);
|
|
12350
13103
|
await ensureDirectoryExists(dir);
|
|
12351
|
-
await
|
|
13104
|
+
await import_fs8.promises.writeFile(filePath, content, "utf-8");
|
|
12352
13105
|
} catch (error) {
|
|
12353
13106
|
throw new Error(`Failed to save file ${filePath}: ${error}`);
|
|
12354
13107
|
}
|
|
12355
13108
|
}
|
|
12356
13109
|
async function fileExists(filePath) {
|
|
12357
13110
|
try {
|
|
12358
|
-
await
|
|
13111
|
+
await import_fs8.promises.access(filePath);
|
|
12359
13112
|
return true;
|
|
12360
13113
|
} catch {
|
|
12361
13114
|
return false;
|
|
@@ -12363,7 +13116,7 @@ async function fileExists(filePath) {
|
|
|
12363
13116
|
}
|
|
12364
13117
|
async function directoryExists(dirPath) {
|
|
12365
13118
|
try {
|
|
12366
|
-
const stats = await
|
|
13119
|
+
const stats = await import_fs8.promises.stat(dirPath);
|
|
12367
13120
|
return stats.isDirectory();
|
|
12368
13121
|
} catch {
|
|
12369
13122
|
return false;
|
|
@@ -12418,13 +13171,13 @@ function stripAuthorNamespace2(packageId) {
|
|
|
12418
13171
|
const parts = packageId.split("/");
|
|
12419
13172
|
return parts[parts.length - 1];
|
|
12420
13173
|
}
|
|
12421
|
-
var
|
|
13174
|
+
var import_fs8, import_path9;
|
|
12422
13175
|
var init_filesystem = __esm({
|
|
12423
13176
|
"src/core/filesystem.ts"() {
|
|
12424
13177
|
"use strict";
|
|
12425
13178
|
init_cjs_shims();
|
|
12426
|
-
|
|
12427
|
-
|
|
13179
|
+
import_fs8 = require("fs");
|
|
13180
|
+
import_path9 = __toESM(require("path"));
|
|
12428
13181
|
init_dist();
|
|
12429
13182
|
}
|
|
12430
13183
|
});
|
|
@@ -12444,17 +13197,33 @@ function generateSkillXML(entry) {
|
|
|
12444
13197
|
const resourceType = entry.resourceType || "skill";
|
|
12445
13198
|
const tag = resourceType === "agent" ? "agent" : "skill";
|
|
12446
13199
|
const mainFile = entry.mainFile || (resourceType === "agent" ? "AGENT.md" : "SKILL.md");
|
|
12447
|
-
const fullPath =
|
|
12448
|
-
|
|
13200
|
+
const fullPath = import_path10.default.join(entry.skillPath, mainFile);
|
|
13201
|
+
const activation = entry.eager ? "eager" : "lazy";
|
|
13202
|
+
return `<${tag} activation="${activation}">
|
|
12449
13203
|
<name>${escapeXML(entry.name)}</name>
|
|
12450
13204
|
<description>${escapeXML(entry.description)}</description>
|
|
12451
13205
|
<path>${escapeXML(fullPath)}</path>
|
|
12452
13206
|
</${tag}>`;
|
|
12453
13207
|
}
|
|
12454
|
-
function
|
|
13208
|
+
function generateEagerSkillsSystemHeader() {
|
|
12455
13209
|
return `<!-- PRPM_MANIFEST_START -->
|
|
12456
13210
|
|
|
12457
|
-
<skills_system priority="
|
|
13211
|
+
<skills_system priority="0">
|
|
13212
|
+
<usage>
|
|
13213
|
+
MANDATORY: You MUST load and apply these skills at the START of every session.
|
|
13214
|
+
Do not wait for relevance - these are always active.
|
|
13215
|
+
|
|
13216
|
+
How to use eager skills:
|
|
13217
|
+
- Load each skill immediately using Bash("cat <path>")
|
|
13218
|
+
- These skills apply to ALL work in this project
|
|
13219
|
+
- Do NOT skip or defer loading these skills
|
|
13220
|
+
</usage>
|
|
13221
|
+
|
|
13222
|
+
<eager_skills>`;
|
|
13223
|
+
}
|
|
13224
|
+
function generateSkillsSystemHeader(includeManifestStart = true) {
|
|
13225
|
+
const prefix = includeManifestStart ? "<!-- PRPM_MANIFEST_START -->\n\n" : "";
|
|
13226
|
+
return `${prefix}<skills_system priority="1">
|
|
12458
13227
|
<usage>
|
|
12459
13228
|
When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
|
|
12460
13229
|
|
|
@@ -12514,7 +13283,7 @@ async function readAgentsMdManifest(agentsPath = "AGENTS.md") {
|
|
|
12514
13283
|
afterManifest: ""
|
|
12515
13284
|
};
|
|
12516
13285
|
}
|
|
12517
|
-
const content = await
|
|
13286
|
+
const content = await import_fs9.promises.readFile(agentsPath, "utf-8");
|
|
12518
13287
|
let manifestStart = "<!-- PRPM_MANIFEST_START -->";
|
|
12519
13288
|
let manifestEnd = "<!-- PRPM_MANIFEST_END -->";
|
|
12520
13289
|
let startIdx = content.indexOf(manifestStart);
|
|
@@ -12557,22 +13326,56 @@ async function addSkillToManifest(entry, agentsPath = "AGENTS.md") {
|
|
|
12557
13326
|
updatedResources.push(entry);
|
|
12558
13327
|
const skills = updatedResources.filter((r) => (r.resourceType || "skill") === "skill");
|
|
12559
13328
|
const agents = updatedResources.filter((r) => r.resourceType === "agent");
|
|
12560
|
-
const
|
|
12561
|
-
const
|
|
13329
|
+
const eagerSkills = skills.filter((s) => s.eager === true);
|
|
13330
|
+
const lazySkills = skills.filter((s) => s.eager !== true);
|
|
13331
|
+
const eagerAgents = agents.filter((a) => a.eager === true);
|
|
13332
|
+
const lazyAgents = agents.filter((a) => a.eager !== true);
|
|
12562
13333
|
let newContent = "";
|
|
12563
13334
|
if (!beforeManifest.trim() && !afterManifest.trim()) {
|
|
12564
13335
|
newContent = "";
|
|
12565
13336
|
} else {
|
|
12566
13337
|
newContent = beforeManifest;
|
|
12567
13338
|
}
|
|
12568
|
-
const
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
13339
|
+
const hasEagerContent = eagerSkills.length > 0 || eagerAgents.length > 0;
|
|
13340
|
+
const hasLazyContent = lazySkills.length > 0 || lazyAgents.length > 0;
|
|
13341
|
+
if (hasEagerContent) {
|
|
13342
|
+
if (eagerSkills.length > 0) {
|
|
13343
|
+
newContent += generateEagerSkillsSystemHeader();
|
|
13344
|
+
newContent += "\n\n";
|
|
13345
|
+
newContent += eagerSkills.map((s) => generateSkillXML(s)).join("\n\n");
|
|
13346
|
+
newContent += "\n\n</eager_skills>\n</skills_system>\n\n";
|
|
13347
|
+
}
|
|
13348
|
+
if (eagerAgents.length > 0) {
|
|
13349
|
+
newContent += `<agents_system priority="0">
|
|
13350
|
+
<usage>
|
|
13351
|
+
MANDATORY: These agents are always available and should be used proactively.
|
|
13352
|
+
Do not wait for explicit requests - invoke these agents when their expertise applies.
|
|
13353
|
+
</usage>
|
|
13354
|
+
|
|
13355
|
+
<eager_agents>
|
|
13356
|
+
|
|
13357
|
+
`;
|
|
13358
|
+
newContent += eagerAgents.map((a) => generateSkillXML(a)).join("\n\n");
|
|
13359
|
+
newContent += "\n\n</eager_agents>\n</agents_system>\n\n";
|
|
13360
|
+
}
|
|
13361
|
+
}
|
|
13362
|
+
if (hasLazyContent) {
|
|
13363
|
+
if (lazySkills.length > 0) {
|
|
13364
|
+
newContent += generateSkillsSystemHeader(!hasEagerContent);
|
|
13365
|
+
newContent += "\n\n";
|
|
13366
|
+
newContent += lazySkills.map((s) => generateSkillXML(s)).join("\n\n");
|
|
13367
|
+
newContent += "\n\n</available_skills>\n</skills_system>";
|
|
13368
|
+
}
|
|
13369
|
+
if (lazyAgents.length > 0) {
|
|
13370
|
+
newContent += "\n\n" + generateAgentsSystemHeader();
|
|
13371
|
+
newContent += "\n\n";
|
|
13372
|
+
newContent += lazyAgents.map((a) => generateSkillXML(a)).join("\n\n");
|
|
13373
|
+
newContent += "\n\n</available_agents>\n</agents_system>";
|
|
13374
|
+
}
|
|
13375
|
+
}
|
|
13376
|
+
newContent += "\n\n<!-- PRPM_MANIFEST_END -->";
|
|
12574
13377
|
newContent += afterManifest;
|
|
12575
|
-
await
|
|
13378
|
+
await import_fs9.promises.writeFile(agentsPath, newContent.trim() + "\n", "utf-8");
|
|
12576
13379
|
}
|
|
12577
13380
|
async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
12578
13381
|
const { beforeManifest, manifest, afterManifest } = await readAgentsMdManifest(agentsPath);
|
|
@@ -12584,9 +13387,9 @@ async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
|
12584
13387
|
if (updatedResources.length === 0) {
|
|
12585
13388
|
const newContent2 = (beforeManifest + afterManifest).trim();
|
|
12586
13389
|
if (newContent2) {
|
|
12587
|
-
await
|
|
13390
|
+
await import_fs9.promises.writeFile(agentsPath, newContent2 + "\n", "utf-8");
|
|
12588
13391
|
} else {
|
|
12589
|
-
await
|
|
13392
|
+
await import_fs9.promises.unlink(agentsPath);
|
|
12590
13393
|
}
|
|
12591
13394
|
return;
|
|
12592
13395
|
}
|
|
@@ -12602,14 +13405,14 @@ async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
|
12602
13405
|
newContent += "\n\n";
|
|
12603
13406
|
newContent += generateManifestFooter(hasAgents, agentsXML);
|
|
12604
13407
|
newContent += afterManifest;
|
|
12605
|
-
await
|
|
13408
|
+
await import_fs9.promises.writeFile(agentsPath, newContent.trim() + "\n", "utf-8");
|
|
12606
13409
|
}
|
|
12607
13410
|
function parseSkillsFromManifest(manifestXML) {
|
|
12608
13411
|
const resources = [];
|
|
12609
|
-
const
|
|
13412
|
+
const skillFormatWithAttrRegex = /<skill(?:\s+activation="(eager|lazy)")?\s*>\s*<name>([^<]+)<\/name>\s*<description>([^<]+)<\/description>\s*<path>([^<]+)<\/path>\s*<\/skill>/g;
|
|
12610
13413
|
let match;
|
|
12611
|
-
while ((match =
|
|
12612
|
-
const [, name, description, fullPath] = match;
|
|
13414
|
+
while ((match = skillFormatWithAttrRegex.exec(manifestXML)) !== null) {
|
|
13415
|
+
const [, activation, name, description, fullPath] = match;
|
|
12613
13416
|
const pathParts = fullPath.trim().split("/");
|
|
12614
13417
|
const mainFile = pathParts[pathParts.length - 1];
|
|
12615
13418
|
const dir = pathParts.slice(0, -1).join("/");
|
|
@@ -12618,12 +13421,13 @@ function parseSkillsFromManifest(manifestXML) {
|
|
|
12618
13421
|
description: unescapeXML(description.trim()),
|
|
12619
13422
|
skillPath: dir,
|
|
12620
13423
|
mainFile,
|
|
12621
|
-
resourceType: "skill"
|
|
13424
|
+
resourceType: "skill",
|
|
13425
|
+
eager: activation === "eager"
|
|
12622
13426
|
});
|
|
12623
13427
|
}
|
|
12624
|
-
const
|
|
12625
|
-
while ((match =
|
|
12626
|
-
const [, name, description, fullPath] = match;
|
|
13428
|
+
const agentFormatWithAttrRegex = /<agent(?:\s+activation="(eager|lazy)")?\s*>\s*<name>([^<]+)<\/name>\s*<description>([^<]+)<\/description>\s*<path>([^<]+)<\/path>\s*<\/agent>/g;
|
|
13429
|
+
while ((match = agentFormatWithAttrRegex.exec(manifestXML)) !== null) {
|
|
13430
|
+
const [, activation, name, description, fullPath] = match;
|
|
12627
13431
|
const pathParts = fullPath.trim().split("/");
|
|
12628
13432
|
const mainFile = pathParts[pathParts.length - 1];
|
|
12629
13433
|
const dir = pathParts.slice(0, -1).join("/");
|
|
@@ -12632,7 +13436,8 @@ function parseSkillsFromManifest(manifestXML) {
|
|
|
12632
13436
|
description: unescapeXML(description.trim()),
|
|
12633
13437
|
skillPath: dir,
|
|
12634
13438
|
mainFile,
|
|
12635
|
-
resourceType: "agent"
|
|
13439
|
+
resourceType: "agent",
|
|
13440
|
+
eager: activation === "eager"
|
|
12636
13441
|
});
|
|
12637
13442
|
}
|
|
12638
13443
|
if (resources.length === 0) {
|
|
@@ -12647,7 +13452,9 @@ function parseSkillsFromManifest(manifestXML) {
|
|
|
12647
13452
|
description: unescapeXML(description.trim()),
|
|
12648
13453
|
skillPath: dir,
|
|
12649
13454
|
mainFile,
|
|
12650
|
-
resourceType: "skill"
|
|
13455
|
+
resourceType: "skill",
|
|
13456
|
+
eager: false
|
|
13457
|
+
// Legacy format defaults to lazy
|
|
12651
13458
|
});
|
|
12652
13459
|
}
|
|
12653
13460
|
}
|
|
@@ -12659,13 +13466,13 @@ function escapeXML(str2) {
|
|
|
12659
13466
|
function unescapeXML(str2) {
|
|
12660
13467
|
return str2.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
12661
13468
|
}
|
|
12662
|
-
var
|
|
13469
|
+
var import_fs9, import_path10;
|
|
12663
13470
|
var init_agents_md_progressive = __esm({
|
|
12664
13471
|
"src/core/agents-md-progressive.ts"() {
|
|
12665
13472
|
"use strict";
|
|
12666
13473
|
init_cjs_shims();
|
|
12667
|
-
|
|
12668
|
-
|
|
13474
|
+
import_fs9 = require("fs");
|
|
13475
|
+
import_path10 = __toESM(require("path"));
|
|
12669
13476
|
init_filesystem();
|
|
12670
13477
|
}
|
|
12671
13478
|
});
|
|
@@ -12673,27 +13480,27 @@ var init_agents_md_progressive = __esm({
|
|
|
12673
13480
|
// src/core/mcp.ts
|
|
12674
13481
|
function getMCPConfigPath(global2 = false, projectDir = process.cwd()) {
|
|
12675
13482
|
if (global2) {
|
|
12676
|
-
return (0,
|
|
13483
|
+
return (0, import_path11.join)((0, import_os3.homedir)(), ".claude", "settings.json");
|
|
12677
13484
|
}
|
|
12678
|
-
return (0,
|
|
13485
|
+
return (0, import_path11.join)(projectDir, ".mcp.json");
|
|
12679
13486
|
}
|
|
12680
13487
|
function readMCPConfig(configPath) {
|
|
12681
|
-
if (!(0,
|
|
13488
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
12682
13489
|
return { mcpServers: {} };
|
|
12683
13490
|
}
|
|
12684
13491
|
try {
|
|
12685
|
-
const content = (0,
|
|
13492
|
+
const content = (0, import_fs10.readFileSync)(configPath, "utf-8");
|
|
12686
13493
|
return JSON.parse(content);
|
|
12687
13494
|
} catch (error) {
|
|
12688
13495
|
return { mcpServers: {} };
|
|
12689
13496
|
}
|
|
12690
13497
|
}
|
|
12691
13498
|
function writeMCPConfig(configPath, config) {
|
|
12692
|
-
const dir = (0,
|
|
12693
|
-
if (!(0,
|
|
12694
|
-
(0,
|
|
13499
|
+
const dir = (0, import_path11.dirname)(configPath);
|
|
13500
|
+
if (!(0, import_fs10.existsSync)(dir)) {
|
|
13501
|
+
(0, import_fs10.mkdirSync)(dir, { recursive: true });
|
|
12695
13502
|
}
|
|
12696
|
-
(0,
|
|
13503
|
+
(0, import_fs10.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
12697
13504
|
}
|
|
12698
13505
|
function mergeMCPServers(servers, global2 = false, projectDir = process.cwd()) {
|
|
12699
13506
|
const result = {
|
|
@@ -12733,7 +13540,7 @@ function removeMCPServers(servers, global2 = false, projectDir = process.cwd())
|
|
|
12733
13540
|
return result;
|
|
12734
13541
|
}
|
|
12735
13542
|
const configPath = getMCPConfigPath(global2, projectDir);
|
|
12736
|
-
if (!(0,
|
|
13543
|
+
if (!(0, import_fs10.existsSync)(configPath)) {
|
|
12737
13544
|
return result;
|
|
12738
13545
|
}
|
|
12739
13546
|
const config = readMCPConfig(configPath);
|
|
@@ -12776,13 +13583,13 @@ function sortObject(obj) {
|
|
|
12776
13583
|
}
|
|
12777
13584
|
return sorted;
|
|
12778
13585
|
}
|
|
12779
|
-
var
|
|
13586
|
+
var import_fs10, import_path11, import_os3;
|
|
12780
13587
|
var init_mcp = __esm({
|
|
12781
13588
|
"src/core/mcp.ts"() {
|
|
12782
13589
|
"use strict";
|
|
12783
13590
|
init_cjs_shims();
|
|
12784
|
-
|
|
12785
|
-
|
|
13591
|
+
import_fs10 = require("fs");
|
|
13592
|
+
import_path11 = require("path");
|
|
12786
13593
|
import_os3 = require("os");
|
|
12787
13594
|
}
|
|
12788
13595
|
});
|
|
@@ -14814,6 +15621,9 @@ async function handleCollectionInstall(collectionSpec, options) {
|
|
|
14814
15621
|
if (options.format) {
|
|
14815
15622
|
installOptions.as = options.format;
|
|
14816
15623
|
}
|
|
15624
|
+
if (options.eager !== void 0) {
|
|
15625
|
+
installOptions.eager = options.eager;
|
|
15626
|
+
}
|
|
14817
15627
|
if (pkg.format === "claude" && pkg.subtype === "hook") {
|
|
14818
15628
|
hasClaudeHooks = true;
|
|
14819
15629
|
}
|
|
@@ -15083,6 +15893,7 @@ function getPackageIcon2(format, subtype) {
|
|
|
15083
15893
|
"workflow": "\u{1F504}",
|
|
15084
15894
|
"template": "\u{1F4C4}",
|
|
15085
15895
|
"plugin": "\u{1F50C}",
|
|
15896
|
+
"extension": "\u{1F4E6}",
|
|
15086
15897
|
"server": "\u{1F5A5}\uFE0F"
|
|
15087
15898
|
};
|
|
15088
15899
|
const formatIcons = {
|
|
@@ -15101,6 +15912,7 @@ function getPackageIcon2(format, subtype) {
|
|
|
15101
15912
|
"aider": "\u{1F91D}",
|
|
15102
15913
|
"zencoder": "\u26A1",
|
|
15103
15914
|
"replit": "\u{1F52E}",
|
|
15915
|
+
"zed": "\u26A1",
|
|
15104
15916
|
"mcp": "\u{1F517}",
|
|
15105
15917
|
"agents.md": "\u{1F4DD}",
|
|
15106
15918
|
"ruler": "\u{1F4CF}",
|
|
@@ -15125,6 +15937,7 @@ function getPackageLabel2(format, subtype) {
|
|
|
15125
15937
|
"aider": "Aider",
|
|
15126
15938
|
"zencoder": "Zencoder",
|
|
15127
15939
|
"replit": "Replit",
|
|
15940
|
+
"zed": "Zed",
|
|
15128
15941
|
"mcp": "MCP",
|
|
15129
15942
|
"agents.md": "Agents.md",
|
|
15130
15943
|
"ruler": "Ruler",
|
|
@@ -15143,6 +15956,7 @@ function getPackageLabel2(format, subtype) {
|
|
|
15143
15956
|
"workflow": "Workflow",
|
|
15144
15957
|
"template": "Template",
|
|
15145
15958
|
"plugin": "Plugin",
|
|
15959
|
+
"extension": "Extension",
|
|
15146
15960
|
"server": "Server"
|
|
15147
15961
|
};
|
|
15148
15962
|
const formatLabel = formatLabels[format];
|
|
@@ -15156,7 +15970,7 @@ function findMainFile(files, format, subtype) {
|
|
|
15156
15970
|
const nestedIndicator = getNestedIndicator(format, subtype);
|
|
15157
15971
|
if (nestedIndicator) {
|
|
15158
15972
|
const match = files.find((f) => {
|
|
15159
|
-
const filename =
|
|
15973
|
+
const filename = import_path13.default.basename(f.name);
|
|
15160
15974
|
return filename.toLowerCase() === nestedIndicator.toLowerCase();
|
|
15161
15975
|
});
|
|
15162
15976
|
if (match) return match;
|
|
@@ -15165,7 +15979,7 @@ function findMainFile(files, format, subtype) {
|
|
|
15165
15979
|
if (filePatterns) {
|
|
15166
15980
|
for (const pattern of filePatterns) {
|
|
15167
15981
|
for (const file of files) {
|
|
15168
|
-
const filename =
|
|
15982
|
+
const filename = import_path13.default.basename(file.name);
|
|
15169
15983
|
if (pattern.startsWith("*")) {
|
|
15170
15984
|
const extension = pattern.slice(1);
|
|
15171
15985
|
if (filename.endsWith(extension)) {
|
|
@@ -15196,7 +16010,7 @@ function findMainFile(files, format, subtype) {
|
|
|
15196
16010
|
];
|
|
15197
16011
|
for (const pattern of fallbackPatterns) {
|
|
15198
16012
|
for (const file of files) {
|
|
15199
|
-
const filename =
|
|
16013
|
+
const filename = import_path13.default.basename(file.name);
|
|
15200
16014
|
if (filename.toLowerCase() === pattern.toLowerCase()) {
|
|
15201
16015
|
return file;
|
|
15202
16016
|
}
|
|
@@ -15220,7 +16034,8 @@ async function handleInstall(packageSpec, options) {
|
|
|
15220
16034
|
return await handleCollectionInstall(collectionId, {
|
|
15221
16035
|
format: options.as,
|
|
15222
16036
|
skipOptional: false,
|
|
15223
|
-
dryRun: false
|
|
16037
|
+
dryRun: false,
|
|
16038
|
+
eager: options.eager
|
|
15224
16039
|
});
|
|
15225
16040
|
}
|
|
15226
16041
|
let packageId;
|
|
@@ -15455,7 +16270,11 @@ This could indicate:
|
|
|
15455
16270
|
canonicalPkg = fromAgentsMd(sourceContent, metadata);
|
|
15456
16271
|
break;
|
|
15457
16272
|
case "gemini":
|
|
15458
|
-
|
|
16273
|
+
if (pkg.subtype === "extension") {
|
|
16274
|
+
canonicalPkg = fromGeminiPlugin(sourceContent, metadata);
|
|
16275
|
+
} else {
|
|
16276
|
+
canonicalPkg = fromGemini(sourceContent, metadata);
|
|
16277
|
+
}
|
|
15459
16278
|
break;
|
|
15460
16279
|
default:
|
|
15461
16280
|
throw new CLIError(`Unsupported source format for conversion: ${pkg.format}`);
|
|
@@ -15506,9 +16325,17 @@ This could indicate:
|
|
|
15506
16325
|
convertedContent = agentsResult.content;
|
|
15507
16326
|
break;
|
|
15508
16327
|
case "gemini":
|
|
16328
|
+
if (effectiveSubtype === "extension") {
|
|
16329
|
+
const geminiPluginResult = toGeminiPlugin(canonicalPkg);
|
|
16330
|
+
convertedContent = geminiPluginResult.content;
|
|
16331
|
+
} else {
|
|
16332
|
+
const geminiResult = toGemini(canonicalPkg);
|
|
16333
|
+
convertedContent = geminiResult.content;
|
|
16334
|
+
}
|
|
16335
|
+
break;
|
|
15509
16336
|
case "gemini.md":
|
|
15510
|
-
const
|
|
15511
|
-
convertedContent =
|
|
16337
|
+
const geminiMdResult = toAgentsMd(canonicalPkg);
|
|
16338
|
+
convertedContent = geminiMdResult.content;
|
|
15512
16339
|
break;
|
|
15513
16340
|
case "ruler":
|
|
15514
16341
|
convertedContent = toRuler(canonicalPkg).content;
|
|
@@ -15584,7 +16411,7 @@ This could indicate:
|
|
|
15584
16411
|
if (agentFiles.length > 0) {
|
|
15585
16412
|
await import_promises2.default.mkdir(".claude/agents", { recursive: true });
|
|
15586
16413
|
for (const file of agentFiles) {
|
|
15587
|
-
const filename =
|
|
16414
|
+
const filename = import_path13.default.basename(file.name);
|
|
15588
16415
|
const destFile = `.claude/agents/${filename}`;
|
|
15589
16416
|
await saveFile(destFile, file.content);
|
|
15590
16417
|
installedFiles.push(destFile);
|
|
@@ -15598,7 +16425,7 @@ This could indicate:
|
|
|
15598
16425
|
for (const file of skillFiles) {
|
|
15599
16426
|
const relativePath = file.name.replace(/^skills\//, "");
|
|
15600
16427
|
const destFile = `.claude/skills/${relativePath}`;
|
|
15601
|
-
const destFileDir =
|
|
16428
|
+
const destFileDir = import_path13.default.dirname(destFile);
|
|
15602
16429
|
await import_promises2.default.mkdir(destFileDir, { recursive: true });
|
|
15603
16430
|
await saveFile(destFile, file.content);
|
|
15604
16431
|
installedFiles.push(destFile);
|
|
@@ -15611,7 +16438,7 @@ This could indicate:
|
|
|
15611
16438
|
if (commandFiles.length > 0) {
|
|
15612
16439
|
await import_promises2.default.mkdir(".claude/commands", { recursive: true });
|
|
15613
16440
|
for (const file of commandFiles) {
|
|
15614
|
-
const filename =
|
|
16441
|
+
const filename = import_path13.default.basename(file.name);
|
|
15615
16442
|
const destFile = `.claude/commands/${filename}`;
|
|
15616
16443
|
await saveFile(destFile, file.content);
|
|
15617
16444
|
installedFiles.push(destFile);
|
|
@@ -15687,7 +16514,7 @@ This could indicate:
|
|
|
15687
16514
|
destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
|
|
15688
16515
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
15689
16516
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
15690
|
-
destDir =
|
|
16517
|
+
destDir = import_path13.default.join(locationOverride, relativeDestDir);
|
|
15691
16518
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
15692
16519
|
}
|
|
15693
16520
|
let mainFile = extractedFiles[0].content;
|
|
@@ -15715,7 +16542,7 @@ This could indicate:
|
|
|
15715
16542
|
const manifestFilename = getManifestFilename(effectiveFormat);
|
|
15716
16543
|
let targetPath = manifestFilename;
|
|
15717
16544
|
if (locationOverride) {
|
|
15718
|
-
targetPath =
|
|
16545
|
+
targetPath = import_path13.default.join(locationOverride, `${manifestFilename.replace(".md", ".override.md")}`);
|
|
15719
16546
|
console.log(` \u{1F4C1} Installing to custom location: ${targetPath}`);
|
|
15720
16547
|
}
|
|
15721
16548
|
destPath = targetPath;
|
|
@@ -15826,7 +16653,7 @@ This could indicate:
|
|
|
15826
16653
|
destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
|
|
15827
16654
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
15828
16655
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
15829
|
-
destDir =
|
|
16656
|
+
destDir = import_path13.default.join(locationOverride, relativeDestDir);
|
|
15830
16657
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
15831
16658
|
}
|
|
15832
16659
|
const packageName = stripAuthorNamespace2(packageId);
|
|
@@ -15918,15 +16745,23 @@ ${afterFrontmatter}`;
|
|
|
15918
16745
|
const resourceName = stripAuthorNamespace2(packageId);
|
|
15919
16746
|
const resourceType = effectiveSubtype;
|
|
15920
16747
|
const mainFile = resourceType === "agent" ? "AGENT.md" : "SKILL.md";
|
|
16748
|
+
let resolvedEager;
|
|
16749
|
+
if (options.eager !== void 0) {
|
|
16750
|
+
resolvedEager = options.eager;
|
|
16751
|
+
} else if (pkg.eager !== void 0) {
|
|
16752
|
+
resolvedEager = pkg.eager;
|
|
16753
|
+
}
|
|
15921
16754
|
const manifestEntry = {
|
|
15922
16755
|
name: resourceName,
|
|
15923
16756
|
description: pkg.description || `${pkg.name} ${resourceType}`,
|
|
15924
16757
|
skillPath: destDir,
|
|
15925
16758
|
mainFile,
|
|
15926
|
-
resourceType
|
|
16759
|
+
resourceType,
|
|
16760
|
+
eager: resolvedEager
|
|
15927
16761
|
};
|
|
15928
16762
|
await addSkillToManifest(manifestEntry, manifestPath);
|
|
15929
|
-
|
|
16763
|
+
const eagerLabel = resolvedEager ? " (eager)" : "";
|
|
16764
|
+
console.log(` \u2713 Added ${resourceType}${eagerLabel} to ${manifestPath} manifest`);
|
|
15930
16765
|
progressiveDisclosureMetadata = {
|
|
15931
16766
|
mode: "progressive",
|
|
15932
16767
|
resourceDir: destDir,
|
|
@@ -15935,7 +16770,8 @@ ${afterFrontmatter}`;
|
|
|
15935
16770
|
resourceType,
|
|
15936
16771
|
// Legacy fields for backward compatibility
|
|
15937
16772
|
skillsDir: destDir,
|
|
15938
|
-
skillName: resourceName
|
|
16773
|
+
skillName: resourceName,
|
|
16774
|
+
eager: resolvedEager
|
|
15939
16775
|
};
|
|
15940
16776
|
}
|
|
15941
16777
|
const updatedLockfile = lockfile || createLockfile();
|
|
@@ -15970,11 +16806,17 @@ ${afterFrontmatter}`;
|
|
|
15970
16806
|
console.log(` \u{1F512} Lock file updated`);
|
|
15971
16807
|
if (progressiveDisclosureMetadata && !options.noAppend) {
|
|
15972
16808
|
const manifestFile = progressiveDisclosureMetadata.manifestPath;
|
|
16809
|
+
const isEager = progressiveDisclosureMetadata.eager;
|
|
15973
16810
|
console.log(`
|
|
15974
16811
|
\u{1F393} Skill installed with progressive disclosure`);
|
|
15975
16812
|
console.log(` \u{1F4DD} Skill added to ${manifestFile} manifest`);
|
|
15976
|
-
|
|
15977
|
-
|
|
16813
|
+
if (isEager) {
|
|
16814
|
+
console.log(` \u{1F525} This skill will be loaded at the START of every session (eager mode)`);
|
|
16815
|
+
console.log(` \u26A1 Your AI agent will always apply this skill - no activation needed`);
|
|
16816
|
+
} else {
|
|
16817
|
+
console.log(` \u{1F4A1} The skill is available but not loaded into context by default`);
|
|
16818
|
+
console.log(` \u26A1 Your AI agent will activate this skill automatically when relevant based on its description`);
|
|
16819
|
+
}
|
|
15978
16820
|
}
|
|
15979
16821
|
if (pluginMetadata) {
|
|
15980
16822
|
console.log(`
|
|
@@ -16013,9 +16855,9 @@ ${afterFrontmatter}`;
|
|
|
16013
16855
|
}
|
|
16014
16856
|
}
|
|
16015
16857
|
function isPathSafe(targetDir, filePath) {
|
|
16016
|
-
const resolvedPath =
|
|
16017
|
-
const resolvedTarget =
|
|
16018
|
-
return resolvedPath.startsWith(resolvedTarget +
|
|
16858
|
+
const resolvedPath = import_path13.default.resolve(targetDir, filePath);
|
|
16859
|
+
const resolvedTarget = import_path13.default.resolve(targetDir);
|
|
16860
|
+
return resolvedPath.startsWith(resolvedTarget + import_path13.default.sep) || resolvedPath === resolvedTarget;
|
|
16019
16861
|
}
|
|
16020
16862
|
function hasUnsafePathPatterns(filePath) {
|
|
16021
16863
|
if (filePath.includes("..")) return true;
|
|
@@ -16027,19 +16869,19 @@ function hasUnsafePathPatterns(filePath) {
|
|
|
16027
16869
|
async function extractTarball(tarball, packageId) {
|
|
16028
16870
|
let decompressed;
|
|
16029
16871
|
try {
|
|
16030
|
-
decompressed = await new Promise((
|
|
16872
|
+
decompressed = await new Promise((resolve3, reject) => {
|
|
16031
16873
|
import_zlib.default.gunzip(tarball, (err, result) => {
|
|
16032
16874
|
if (err) {
|
|
16033
16875
|
reject(new Error(`Failed to decompress tarball: ${err.message}`));
|
|
16034
16876
|
return;
|
|
16035
16877
|
}
|
|
16036
|
-
|
|
16878
|
+
resolve3(result);
|
|
16037
16879
|
});
|
|
16038
16880
|
});
|
|
16039
16881
|
} catch (error) {
|
|
16040
16882
|
throw new CLIError(`Package decompression failed: ${error.message}`);
|
|
16041
16883
|
}
|
|
16042
|
-
const tmpDir = await import_promises2.default.mkdtemp(
|
|
16884
|
+
const tmpDir = await import_promises2.default.mkdtemp(import_path13.default.join(import_os4.default.tmpdir(), "prpm-"));
|
|
16043
16885
|
const cleanup = async () => {
|
|
16044
16886
|
try {
|
|
16045
16887
|
await import_promises2.default.rm(tmpDir, { recursive: true, force: true });
|
|
@@ -16109,7 +16951,7 @@ async function collectExtractedFiles(rootDir, excludedNames, fs14) {
|
|
|
16109
16951
|
if (!currentDir) continue;
|
|
16110
16952
|
const entries = await fs14.readdir(currentDir, { withFileTypes: true });
|
|
16111
16953
|
for (const entry of entries) {
|
|
16112
|
-
const fullPath =
|
|
16954
|
+
const fullPath = import_path13.default.join(currentDir, entry.name);
|
|
16113
16955
|
if (entry.isDirectory()) {
|
|
16114
16956
|
dirs.push(fullPath);
|
|
16115
16957
|
continue;
|
|
@@ -16121,7 +16963,7 @@ async function collectExtractedFiles(rootDir, excludedNames, fs14) {
|
|
|
16121
16963
|
continue;
|
|
16122
16964
|
}
|
|
16123
16965
|
const content = await fs14.readFile(fullPath, "utf-8");
|
|
16124
|
-
const relativePath =
|
|
16966
|
+
const relativePath = import_path13.default.relative(rootDir, fullPath).split(import_path13.default.sep).join("/");
|
|
16125
16967
|
files.push({
|
|
16126
16968
|
name: relativePath,
|
|
16127
16969
|
content
|
|
@@ -16155,11 +16997,11 @@ async function installFromLockfile(options) {
|
|
|
16155
16997
|
console.log(` Installing ${displayName}...`);
|
|
16156
16998
|
let locationOverride = options.location;
|
|
16157
16999
|
if (!locationOverride && lockEntry.format === "agents.md" && lockEntry.installedPath) {
|
|
16158
|
-
const baseName =
|
|
17000
|
+
const baseName = import_path13.default.basename(lockEntry.installedPath);
|
|
16159
17001
|
if (baseName === "AGENTS.override.md") {
|
|
16160
|
-
locationOverride =
|
|
17002
|
+
locationOverride = import_path13.default.dirname(lockEntry.installedPath);
|
|
16161
17003
|
} else if (baseName !== "AGENTS.md") {
|
|
16162
|
-
locationOverride =
|
|
17004
|
+
locationOverride = import_path13.default.dirname(lockEntry.installedPath);
|
|
16163
17005
|
}
|
|
16164
17006
|
}
|
|
16165
17007
|
const manifestFile = (_a = lockEntry.progressiveDisclosure) == null ? void 0 : _a.manifestPath;
|
|
@@ -16203,7 +17045,7 @@ async function installFromLockfile(options) {
|
|
|
16203
17045
|
}
|
|
16204
17046
|
function createInstallCommand() {
|
|
16205
17047
|
const command = new import_commander11.Command("install");
|
|
16206
|
-
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").action(async (packageSpec, options) => {
|
|
17048
|
+
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) => {
|
|
16207
17049
|
const convertTo = options.format || options.as;
|
|
16208
17050
|
const validFormats = import_types.FORMATS;
|
|
16209
17051
|
if (convertTo && !validFormats.includes(convertTo)) {
|
|
@@ -16235,6 +17077,7 @@ Valid strategies: ${VALID_HOOK_MAPPING_STRATEGIES.join(", ")}`
|
|
|
16235
17077
|
});
|
|
16236
17078
|
return;
|
|
16237
17079
|
}
|
|
17080
|
+
const eager = options.eager ? true : options.lazy ? false : void 0;
|
|
16238
17081
|
await handleInstall(packageSpec, {
|
|
16239
17082
|
version: options.version,
|
|
16240
17083
|
as: convertTo,
|
|
@@ -16243,12 +17086,13 @@ Valid strategies: ${VALID_HOOK_MAPPING_STRATEGIES.join(", ")}`
|
|
|
16243
17086
|
location: options.location,
|
|
16244
17087
|
noAppend: options.noAppend,
|
|
16245
17088
|
manifestFile: options.manifestFile,
|
|
16246
|
-
hookMapping: options.hookMapping
|
|
17089
|
+
hookMapping: options.hookMapping,
|
|
17090
|
+
eager
|
|
16247
17091
|
});
|
|
16248
17092
|
});
|
|
16249
17093
|
return command;
|
|
16250
17094
|
}
|
|
16251
|
-
var import_commander11, import_chalk, import_registry_client5, import_stream, import_promises, tar,
|
|
17095
|
+
var import_commander11, import_chalk, import_registry_client5, import_stream, import_promises, tar, import_path13, import_zlib, import_promises2, import_os4, import_semver;
|
|
16252
17096
|
var init_install = __esm({
|
|
16253
17097
|
"src/commands/install.ts"() {
|
|
16254
17098
|
"use strict";
|
|
@@ -16265,7 +17109,7 @@ var init_install = __esm({
|
|
|
16265
17109
|
tar = __toESM(require("tar"));
|
|
16266
17110
|
init_errors();
|
|
16267
17111
|
init_prompts();
|
|
16268
|
-
|
|
17112
|
+
import_path13 = __toESM(require("path"));
|
|
16269
17113
|
import_zlib = __toESM(require("zlib"));
|
|
16270
17114
|
import_promises2 = __toESM(require("fs/promises"));
|
|
16271
17115
|
import_os4 = __toESM(require("os"));
|
|
@@ -16304,7 +17148,7 @@ function buildScanConfigs() {
|
|
|
16304
17148
|
}
|
|
16305
17149
|
async function extractMetadata2(filePath) {
|
|
16306
17150
|
try {
|
|
16307
|
-
const content = await
|
|
17151
|
+
const content = await import_fs15.promises.readFile(filePath, "utf-8");
|
|
16308
17152
|
const metadata = {};
|
|
16309
17153
|
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
16310
17154
|
if (frontmatterMatch) {
|
|
@@ -16357,7 +17201,7 @@ function matchesPattern(filename, patterns) {
|
|
|
16357
17201
|
}
|
|
16358
17202
|
async function directoryExists2(dirPath) {
|
|
16359
17203
|
try {
|
|
16360
|
-
const stats = await
|
|
17204
|
+
const stats = await import_fs15.promises.stat(dirPath);
|
|
16361
17205
|
return stats.isDirectory();
|
|
16362
17206
|
} catch {
|
|
16363
17207
|
return false;
|
|
@@ -16365,7 +17209,7 @@ async function directoryExists2(dirPath) {
|
|
|
16365
17209
|
}
|
|
16366
17210
|
async function fileExists2(filePath) {
|
|
16367
17211
|
try {
|
|
16368
|
-
await
|
|
17212
|
+
await import_fs15.promises.access(filePath);
|
|
16369
17213
|
return true;
|
|
16370
17214
|
} catch {
|
|
16371
17215
|
return false;
|
|
@@ -16373,21 +17217,21 @@ async function fileExists2(filePath) {
|
|
|
16373
17217
|
}
|
|
16374
17218
|
async function scanDirectory2(config, cwd) {
|
|
16375
17219
|
const packages = [];
|
|
16376
|
-
const fullDir =
|
|
17220
|
+
const fullDir = import_path19.default.join(cwd, config.directory);
|
|
16377
17221
|
if (!await directoryExists2(fullDir)) {
|
|
16378
17222
|
return packages;
|
|
16379
17223
|
}
|
|
16380
|
-
const entries = await
|
|
17224
|
+
const entries = await import_fs15.promises.readdir(fullDir, { withFileTypes: true });
|
|
16381
17225
|
if (config.nested) {
|
|
16382
17226
|
for (const entry of entries) {
|
|
16383
17227
|
if (!entry.isDirectory()) continue;
|
|
16384
|
-
const packageDir =
|
|
17228
|
+
const packageDir = import_path19.default.join(fullDir, entry.name);
|
|
16385
17229
|
if (config.nestedIndicator) {
|
|
16386
|
-
const indicatorPath =
|
|
17230
|
+
const indicatorPath = import_path19.default.join(packageDir, config.nestedIndicator);
|
|
16387
17231
|
if (!await fileExists2(indicatorPath)) continue;
|
|
16388
17232
|
const packageFiles = await collectPackageFiles(packageDir, config.directory, entry.name);
|
|
16389
17233
|
const metadata = await extractMetadata2(indicatorPath);
|
|
16390
|
-
const relativePath =
|
|
17234
|
+
const relativePath = import_path19.default.join(config.directory, entry.name, config.nestedIndicator);
|
|
16391
17235
|
packages.push({
|
|
16392
17236
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
16393
17237
|
format: config.format,
|
|
@@ -16398,12 +17242,12 @@ async function scanDirectory2(config, cwd) {
|
|
|
16398
17242
|
primaryFile: relativePath
|
|
16399
17243
|
});
|
|
16400
17244
|
} else {
|
|
16401
|
-
const subEntries = await
|
|
17245
|
+
const subEntries = await import_fs15.promises.readdir(packageDir, { withFileTypes: true });
|
|
16402
17246
|
for (const subEntry of subEntries) {
|
|
16403
17247
|
if (!subEntry.isFile()) continue;
|
|
16404
17248
|
if (!matchesPattern(subEntry.name, config.patterns)) continue;
|
|
16405
|
-
const filePath =
|
|
16406
|
-
const relativePath =
|
|
17249
|
+
const filePath = import_path19.default.join(packageDir, subEntry.name);
|
|
17250
|
+
const relativePath = import_path19.default.join(config.directory, entry.name, subEntry.name);
|
|
16407
17251
|
const metadata = await extractMetadata2(filePath);
|
|
16408
17252
|
packages.push({
|
|
16409
17253
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -16421,8 +17265,8 @@ async function scanDirectory2(config, cwd) {
|
|
|
16421
17265
|
for (const entry of entries) {
|
|
16422
17266
|
if (!entry.isFile()) continue;
|
|
16423
17267
|
if (!matchesPattern(entry.name, config.patterns)) continue;
|
|
16424
|
-
const filePath =
|
|
16425
|
-
const relativePath =
|
|
17268
|
+
const filePath = import_path19.default.join(fullDir, entry.name);
|
|
17269
|
+
const relativePath = import_path19.default.join(config.directory, entry.name);
|
|
16426
17270
|
const metadata = await extractMetadata2(filePath);
|
|
16427
17271
|
packages.push({
|
|
16428
17272
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -16440,24 +17284,24 @@ async function scanDirectory2(config, cwd) {
|
|
|
16440
17284
|
async function collectPackageFiles(packageDir, baseDir, packageName) {
|
|
16441
17285
|
const files = [];
|
|
16442
17286
|
async function walkDir(dir, relativeBase) {
|
|
16443
|
-
const entries = await
|
|
17287
|
+
const entries = await import_fs15.promises.readdir(dir, { withFileTypes: true });
|
|
16444
17288
|
for (const entry of entries) {
|
|
16445
|
-
const fullPath =
|
|
16446
|
-
const relativePath =
|
|
17289
|
+
const fullPath = import_path19.default.join(dir, entry.name);
|
|
17290
|
+
const relativePath = import_path19.default.join(relativeBase, entry.name);
|
|
16447
17291
|
if (entry.isDirectory()) {
|
|
16448
17292
|
if (["node_modules", "dist", ".git", "coverage"].includes(entry.name)) {
|
|
16449
17293
|
continue;
|
|
16450
17294
|
}
|
|
16451
17295
|
await walkDir(fullPath, relativePath);
|
|
16452
17296
|
} else if (entry.isFile()) {
|
|
16453
|
-
const ext =
|
|
17297
|
+
const ext = import_path19.default.extname(entry.name).toLowerCase();
|
|
16454
17298
|
if ([".md", ".json", ".js", ".ts", ".toml"].includes(ext)) {
|
|
16455
17299
|
files.push(relativePath);
|
|
16456
17300
|
}
|
|
16457
17301
|
}
|
|
16458
17302
|
}
|
|
16459
17303
|
}
|
|
16460
|
-
await walkDir(packageDir,
|
|
17304
|
+
await walkDir(packageDir, import_path19.default.join(baseDir, packageName));
|
|
16461
17305
|
return files;
|
|
16462
17306
|
}
|
|
16463
17307
|
function buildRootManifestFiles() {
|
|
@@ -16479,7 +17323,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16479
17323
|
allPackages.push(...packages);
|
|
16480
17324
|
}
|
|
16481
17325
|
for (const { file, format } of ROOT_MANIFEST_FILES) {
|
|
16482
|
-
const filePath =
|
|
17326
|
+
const filePath = import_path19.default.join(cwd, file);
|
|
16483
17327
|
if (await fileExists2(filePath)) {
|
|
16484
17328
|
const metadata = await extractMetadata2(filePath);
|
|
16485
17329
|
allPackages.push({
|
|
@@ -16493,7 +17337,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16493
17337
|
});
|
|
16494
17338
|
}
|
|
16495
17339
|
}
|
|
16496
|
-
const copilotInstructionsPath =
|
|
17340
|
+
const copilotInstructionsPath = import_path19.default.join(cwd, ".github/copilot-instructions.md");
|
|
16497
17341
|
if (await fileExists2(copilotInstructionsPath)) {
|
|
16498
17342
|
const metadata = await extractMetadata2(copilotInstructionsPath);
|
|
16499
17343
|
allPackages.push({
|
|
@@ -16508,13 +17352,13 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16508
17352
|
}
|
|
16509
17353
|
return allPackages;
|
|
16510
17354
|
}
|
|
16511
|
-
var
|
|
17355
|
+
var import_fs15, import_path19, SCAN_CONFIGS, ROOT_MANIFEST_FILES;
|
|
16512
17356
|
var init_package_scanner = __esm({
|
|
16513
17357
|
"src/core/package-scanner.ts"() {
|
|
16514
17358
|
"use strict";
|
|
16515
17359
|
init_cjs_shims();
|
|
16516
|
-
|
|
16517
|
-
|
|
17360
|
+
import_fs15 = require("fs");
|
|
17361
|
+
import_path19 = __toESM(require("path"));
|
|
16518
17362
|
init_dist();
|
|
16519
17363
|
SCAN_CONFIGS = buildScanConfigs();
|
|
16520
17364
|
ROOT_MANIFEST_FILES = buildRootManifestFiles();
|
|
@@ -16524,8 +17368,8 @@ var init_package_scanner = __esm({
|
|
|
16524
17368
|
// src/core/package-reconciler.ts
|
|
16525
17369
|
async function readManifest(cwd = process.cwd()) {
|
|
16526
17370
|
try {
|
|
16527
|
-
const manifestPath =
|
|
16528
|
-
const content = await
|
|
17371
|
+
const manifestPath = import_path20.default.join(cwd, "prpm.json");
|
|
17372
|
+
const content = await import_fs16.promises.readFile(manifestPath, "utf-8");
|
|
16529
17373
|
const raw = JSON.parse(content);
|
|
16530
17374
|
if ("packages" in raw && Array.isArray(raw.packages)) {
|
|
16531
17375
|
return {
|
|
@@ -16551,7 +17395,7 @@ async function readManifest(cwd = process.cwd()) {
|
|
|
16551
17395
|
}
|
|
16552
17396
|
async function fileExists3(filePath) {
|
|
16553
17397
|
try {
|
|
16554
|
-
await
|
|
17398
|
+
await import_fs16.promises.access(filePath);
|
|
16555
17399
|
return true;
|
|
16556
17400
|
} catch {
|
|
16557
17401
|
return false;
|
|
@@ -16607,7 +17451,7 @@ async function reconcilePackages(detected, manifest, cwd = process.cwd()) {
|
|
|
16607
17451
|
const manifestPkg = manifest[mi];
|
|
16608
17452
|
let anyFileExists = false;
|
|
16609
17453
|
for (const file of manifestPkg.files) {
|
|
16610
|
-
const fullPath =
|
|
17454
|
+
const fullPath = import_path20.default.join(cwd, file);
|
|
16611
17455
|
if (await fileExists3(fullPath)) {
|
|
16612
17456
|
anyFileExists = true;
|
|
16613
17457
|
break;
|
|
@@ -16676,7 +17520,7 @@ function createManifestFromDetected(packages, defaults) {
|
|
|
16676
17520
|
files: pkg.files
|
|
16677
17521
|
};
|
|
16678
17522
|
}
|
|
16679
|
-
const projectName =
|
|
17523
|
+
const projectName = import_path20.default.basename(process.cwd()).toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
16680
17524
|
return {
|
|
16681
17525
|
name: `${projectName}-packages`,
|
|
16682
17526
|
version: "1.0.0",
|
|
@@ -16687,13 +17531,13 @@ function createManifestFromDetected(packages, defaults) {
|
|
|
16687
17531
|
packages: packages.map(detectedToManifest)
|
|
16688
17532
|
};
|
|
16689
17533
|
}
|
|
16690
|
-
var
|
|
17534
|
+
var import_fs16, import_path20;
|
|
16691
17535
|
var init_package_reconciler = __esm({
|
|
16692
17536
|
"src/core/package-reconciler.ts"() {
|
|
16693
17537
|
"use strict";
|
|
16694
17538
|
init_cjs_shims();
|
|
16695
|
-
|
|
16696
|
-
|
|
17539
|
+
import_fs16 = require("fs");
|
|
17540
|
+
import_path20 = __toESM(require("path"));
|
|
16697
17541
|
}
|
|
16698
17542
|
});
|
|
16699
17543
|
|
|
@@ -16808,12 +17652,12 @@ function getDefaultAuthor() {
|
|
|
16808
17652
|
async function createExampleFiles(format, files, packageName) {
|
|
16809
17653
|
const templates = EXAMPLE_TEMPLATES[format] || {};
|
|
16810
17654
|
for (const file of files) {
|
|
16811
|
-
const filePath = (0,
|
|
16812
|
-
const dirPath = (0,
|
|
16813
|
-
if (!(0,
|
|
17655
|
+
const filePath = (0, import_path21.join)(process.cwd(), file);
|
|
17656
|
+
const dirPath = (0, import_path21.join)(filePath, "..");
|
|
17657
|
+
if (!(0, import_fs17.existsSync)(dirPath)) {
|
|
16814
17658
|
await (0, import_promises8.mkdir)(dirPath, { recursive: true });
|
|
16815
17659
|
}
|
|
16816
|
-
if ((0,
|
|
17660
|
+
if ((0, import_fs17.existsSync)(filePath)) {
|
|
16817
17661
|
console.log(` Skipping ${file} (already exists)`);
|
|
16818
17662
|
continue;
|
|
16819
17663
|
}
|
|
@@ -16827,8 +17671,8 @@ Add your content here.
|
|
|
16827
17671
|
}
|
|
16828
17672
|
}
|
|
16829
17673
|
async function createReadme(config) {
|
|
16830
|
-
const readmePath = (0,
|
|
16831
|
-
if ((0,
|
|
17674
|
+
const readmePath = (0, import_path21.join)(process.cwd(), "README.md");
|
|
17675
|
+
if ((0, import_fs17.existsSync)(readmePath)) {
|
|
16832
17676
|
console.log(" Skipping README.md (already exists)");
|
|
16833
17677
|
return;
|
|
16834
17678
|
}
|
|
@@ -16937,8 +17781,8 @@ async function reviewMissingPackage(rl, pkg, index, total) {
|
|
|
16937
17781
|
return await confirm(rl, "\n Remove from prpm.json?", true);
|
|
16938
17782
|
}
|
|
16939
17783
|
async function smartInit(options) {
|
|
16940
|
-
const manifestPath = (0,
|
|
16941
|
-
const hasManifest = (0,
|
|
17784
|
+
const manifestPath = (0, import_path21.join)(process.cwd(), "prpm.json");
|
|
17785
|
+
const hasManifest = (0, import_fs17.existsSync)(manifestPath);
|
|
16942
17786
|
console.log("\nScanning for packages...\n");
|
|
16943
17787
|
const detected = await scanForPackages();
|
|
16944
17788
|
const existingManifest = hasManifest ? await readManifest() : null;
|
|
@@ -17088,8 +17932,8 @@ Create multi-package prpm.json with these ${detected.length} packages?` : "\nCre
|
|
|
17088
17932
|
}
|
|
17089
17933
|
}
|
|
17090
17934
|
async function classicInit(options) {
|
|
17091
|
-
const manifestPath = (0,
|
|
17092
|
-
if ((0,
|
|
17935
|
+
const manifestPath = (0, import_path21.join)(process.cwd(), "prpm.json");
|
|
17936
|
+
if ((0, import_fs17.existsSync)(manifestPath) && !options.force) {
|
|
17093
17937
|
throw new Error(
|
|
17094
17938
|
"prpm.json already exists. Use --force to overwrite, or run this command in a different directory."
|
|
17095
17939
|
);
|
|
@@ -17347,7 +18191,7 @@ async function scanMode(directories, options) {
|
|
|
17347
18191
|
console.log("\u{1F50D} Dry run - no changes made\n");
|
|
17348
18192
|
return;
|
|
17349
18193
|
}
|
|
17350
|
-
const prpmJsonPath = options.output || (0,
|
|
18194
|
+
const prpmJsonPath = options.output || (0, import_path21.join)(process.cwd(), "prpm.json");
|
|
17351
18195
|
let manifest;
|
|
17352
18196
|
if (options.append) {
|
|
17353
18197
|
try {
|
|
@@ -17449,15 +18293,15 @@ function createInitCommand() {
|
|
|
17449
18293
|
});
|
|
17450
18294
|
return command;
|
|
17451
18295
|
}
|
|
17452
|
-
var import_commander12, import_promises8,
|
|
18296
|
+
var import_commander12, import_promises8, import_path21, import_fs17, readline4, import_process, FORMAT_EXAMPLES, EXAMPLE_TEMPLATES;
|
|
17453
18297
|
var init_init = __esm({
|
|
17454
18298
|
"src/commands/init.ts"() {
|
|
17455
18299
|
"use strict";
|
|
17456
18300
|
init_cjs_shims();
|
|
17457
18301
|
import_commander12 = require("commander");
|
|
17458
18302
|
import_promises8 = require("fs/promises");
|
|
17459
|
-
|
|
17460
|
-
|
|
18303
|
+
import_path21 = require("path");
|
|
18304
|
+
import_fs17 = require("fs");
|
|
17461
18305
|
readline4 = __toESM(require("readline/promises"));
|
|
17462
18306
|
import_process = require("process");
|
|
17463
18307
|
init_types();
|
|
@@ -17840,8 +18684,8 @@ Include examples if helpful.
|
|
|
17840
18684
|
// src/index.ts
|
|
17841
18685
|
init_cjs_shims();
|
|
17842
18686
|
var import_commander29 = require("commander");
|
|
17843
|
-
var
|
|
17844
|
-
var
|
|
18687
|
+
var import_fs21 = require("fs");
|
|
18688
|
+
var import_path25 = require("path");
|
|
17845
18689
|
|
|
17846
18690
|
// src/commands/list.ts
|
|
17847
18691
|
init_cjs_shims();
|
|
@@ -18001,7 +18845,7 @@ var import_commander2 = require("commander");
|
|
|
18001
18845
|
init_lockfile();
|
|
18002
18846
|
init_filesystem();
|
|
18003
18847
|
init_types();
|
|
18004
|
-
var
|
|
18848
|
+
var import_fs11 = require("fs");
|
|
18005
18849
|
init_errors();
|
|
18006
18850
|
init_agents_md_progressive();
|
|
18007
18851
|
init_mcp();
|
|
@@ -18017,17 +18861,17 @@ async function promptForFormat(packageId, formats) {
|
|
|
18017
18861
|
input: process.stdin,
|
|
18018
18862
|
output: process.stdout
|
|
18019
18863
|
});
|
|
18020
|
-
return new Promise((
|
|
18864
|
+
return new Promise((resolve3) => {
|
|
18021
18865
|
rl.question("\nSelect format to uninstall (number): ", (answer) => {
|
|
18022
18866
|
rl.close();
|
|
18023
18867
|
const choice = parseInt(answer.trim(), 10);
|
|
18024
18868
|
if (choice > 0 && choice <= formats.length) {
|
|
18025
|
-
|
|
18869
|
+
resolve3(formats[choice - 1]);
|
|
18026
18870
|
} else if (choice === formats.length + 1) {
|
|
18027
|
-
|
|
18871
|
+
resolve3("all");
|
|
18028
18872
|
} else {
|
|
18029
18873
|
console.log("Invalid choice, uninstalling all formats");
|
|
18030
|
-
|
|
18874
|
+
resolve3("all");
|
|
18031
18875
|
}
|
|
18032
18876
|
});
|
|
18033
18877
|
});
|
|
@@ -18107,7 +18951,7 @@ async function handleUninstall(name, options = {}) {
|
|
|
18107
18951
|
let filesRemoved = 0;
|
|
18108
18952
|
for (const filePath of files) {
|
|
18109
18953
|
try {
|
|
18110
|
-
await
|
|
18954
|
+
await import_fs11.promises.unlink(filePath);
|
|
18111
18955
|
filesRemoved++;
|
|
18112
18956
|
console.log(` \u{1F5D1}\uFE0F Deleted: ${filePath}`);
|
|
18113
18957
|
} catch (error) {
|
|
@@ -18136,7 +18980,7 @@ async function handleUninstall(name, options = {}) {
|
|
|
18136
18980
|
if (pkg.format === "claude" && pkg.subtype === "hook" && pkg.hookMetadata) {
|
|
18137
18981
|
const settingsPath = pkg.installedPath || ".claude/settings.json";
|
|
18138
18982
|
try {
|
|
18139
|
-
const settingsContent = await
|
|
18983
|
+
const settingsContent = await import_fs11.promises.readFile(settingsPath, "utf-8");
|
|
18140
18984
|
const settings = JSON.parse(settingsContent);
|
|
18141
18985
|
if (settings.hooks) {
|
|
18142
18986
|
let removedCount = 0;
|
|
@@ -18153,7 +18997,7 @@ async function handleUninstall(name, options = {}) {
|
|
|
18153
18997
|
}
|
|
18154
18998
|
}
|
|
18155
18999
|
}
|
|
18156
|
-
await
|
|
19000
|
+
await import_fs11.promises.writeFile(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
18157
19001
|
console.log(` \u{1FA9D} Removed ${removedCount} hook(s) from ${settingsPath}`);
|
|
18158
19002
|
}
|
|
18159
19003
|
} catch (error) {
|
|
@@ -18178,12 +19022,12 @@ async function handleUninstall(name, options = {}) {
|
|
|
18178
19022
|
throw new CLIError(`Cannot uninstall ${name}: installation path unknown`, 1);
|
|
18179
19023
|
}
|
|
18180
19024
|
try {
|
|
18181
|
-
const stats = await
|
|
19025
|
+
const stats = await import_fs11.promises.stat(targetPath);
|
|
18182
19026
|
if (stats.isDirectory()) {
|
|
18183
|
-
await
|
|
19027
|
+
await import_fs11.promises.rm(targetPath, { recursive: true, force: true });
|
|
18184
19028
|
console.log(` \u{1F5D1}\uFE0F Deleted directory: ${targetPath}`);
|
|
18185
19029
|
} else if (stats.isFile()) {
|
|
18186
|
-
await
|
|
19030
|
+
await import_fs11.promises.unlink(targetPath);
|
|
18187
19031
|
console.log(` \u{1F5D1}\uFE0F Deleted file: ${targetPath}`);
|
|
18188
19032
|
}
|
|
18189
19033
|
} catch (error) {
|
|
@@ -18212,17 +19056,17 @@ function createUninstallCommand() {
|
|
|
18212
19056
|
// src/commands/index.ts
|
|
18213
19057
|
init_cjs_shims();
|
|
18214
19058
|
var import_commander3 = require("commander");
|
|
18215
|
-
var
|
|
18216
|
-
var
|
|
19059
|
+
var import_fs12 = require("fs");
|
|
19060
|
+
var import_path12 = __toESM(require("path"));
|
|
18217
19061
|
init_lockfile();
|
|
18218
19062
|
init_filesystem();
|
|
18219
19063
|
init_errors();
|
|
18220
19064
|
async function scanDirectory(dirPath, format, subtype) {
|
|
18221
19065
|
try {
|
|
18222
|
-
const files = await
|
|
19066
|
+
const files = await import_fs12.promises.readdir(dirPath, { withFileTypes: true });
|
|
18223
19067
|
const results = [];
|
|
18224
19068
|
for (const file of files) {
|
|
18225
|
-
const fullPath =
|
|
19069
|
+
const fullPath = import_path12.default.join(dirPath, file.name);
|
|
18226
19070
|
if (file.isFile()) {
|
|
18227
19071
|
const id = generateId(file.name);
|
|
18228
19072
|
results.push({
|
|
@@ -18235,11 +19079,11 @@ async function scanDirectory(dirPath, format, subtype) {
|
|
|
18235
19079
|
const isCursorAgent = format === "cursor" && subtype === "agent";
|
|
18236
19080
|
if (isClaudeType || isCursorAgent) {
|
|
18237
19081
|
try {
|
|
18238
|
-
const subFiles = await
|
|
19082
|
+
const subFiles = await import_fs12.promises.readdir(fullPath, { withFileTypes: true });
|
|
18239
19083
|
for (const subFile of subFiles) {
|
|
18240
19084
|
const isValidFile = subFile.isFile() && (subFile.name === "SKILL.md" || subFile.name === "AGENT.md" || subFile.name === "skill.md" || subFile.name === "agent.md");
|
|
18241
19085
|
if (isValidFile) {
|
|
18242
|
-
const subFilePath =
|
|
19086
|
+
const subFilePath = import_path12.default.join(fullPath, subFile.name);
|
|
18243
19087
|
const id = file.name;
|
|
18244
19088
|
results.push({
|
|
18245
19089
|
filePath: subFilePath,
|
|
@@ -18301,7 +19145,7 @@ async function handleIndex(options = {}) {
|
|
|
18301
19145
|
id: file.id,
|
|
18302
19146
|
version: "0.0.0",
|
|
18303
19147
|
// Local files don't have versions
|
|
18304
|
-
tarballUrl: `file://${
|
|
19148
|
+
tarballUrl: `file://${import_path12.default.resolve(file.filePath)}`,
|
|
18305
19149
|
format: dir.format,
|
|
18306
19150
|
subtype: dir.subtype
|
|
18307
19151
|
});
|
|
@@ -18427,7 +19271,7 @@ function createTestCommand() {
|
|
|
18427
19271
|
console.log("\u{1F4C8} Check your PostHog dashboard for the event: prpm_test");
|
|
18428
19272
|
console.log("\u{1F517} Dashboard: https://app.posthog.com");
|
|
18429
19273
|
console.log("\u23F0 Note: Events may take 1-2 minutes to appear in the dashboard");
|
|
18430
|
-
await new Promise((
|
|
19274
|
+
await new Promise((resolve3) => setTimeout(resolve3, 3e3));
|
|
18431
19275
|
const stats = await telemetry.getStats();
|
|
18432
19276
|
console.log(`\u{1F4CA} Total events now: ${stats.totalEvents}`);
|
|
18433
19277
|
console.log("\n\u{1F50D} Troubleshooting tips:");
|
|
@@ -18561,6 +19405,7 @@ function getPackageIcon(format, subtype) {
|
|
|
18561
19405
|
"workflow": "\u{1F504}",
|
|
18562
19406
|
"template": "\u{1F4C4}",
|
|
18563
19407
|
"plugin": "\u{1F50C}",
|
|
19408
|
+
"extension": "\u{1F4E6}",
|
|
18564
19409
|
"server": "\u{1F5A5}\uFE0F"
|
|
18565
19410
|
};
|
|
18566
19411
|
const formatIcons = {
|
|
@@ -18579,6 +19424,7 @@ function getPackageIcon(format, subtype) {
|
|
|
18579
19424
|
"aider": "\u{1F91D}",
|
|
18580
19425
|
"zencoder": "\u26A1",
|
|
18581
19426
|
"replit": "\u{1F52E}",
|
|
19427
|
+
"zed": "\u26A1",
|
|
18582
19428
|
"mcp": "\u{1F517}",
|
|
18583
19429
|
"agents.md": "\u{1F4DD}",
|
|
18584
19430
|
"ruler": "\u{1F4CF}",
|
|
@@ -18603,6 +19449,7 @@ function getPackageLabel(format, subtype) {
|
|
|
18603
19449
|
"aider": "Aider",
|
|
18604
19450
|
"zencoder": "Zencoder",
|
|
18605
19451
|
"replit": "Replit",
|
|
19452
|
+
"zed": "Zed",
|
|
18606
19453
|
"mcp": "MCP",
|
|
18607
19454
|
"agents.md": "Agents.md",
|
|
18608
19455
|
"ruler": "Ruler",
|
|
@@ -18621,6 +19468,7 @@ function getPackageLabel(format, subtype) {
|
|
|
18621
19468
|
"workflow": "Workflow",
|
|
18622
19469
|
"template": "Template",
|
|
18623
19470
|
"plugin": "Plugin",
|
|
19471
|
+
"extension": "Extension",
|
|
18624
19472
|
"server": "Server"
|
|
18625
19473
|
};
|
|
18626
19474
|
const formatLabel = formatLabels[format];
|
|
@@ -18666,14 +19514,14 @@ function displayResults(packages, total, page, limit) {
|
|
|
18666
19514
|
console.log("\u2500".repeat(80));
|
|
18667
19515
|
}
|
|
18668
19516
|
function promptUser() {
|
|
18669
|
-
return new Promise((
|
|
19517
|
+
return new Promise((resolve3) => {
|
|
18670
19518
|
const rl = readline2.createInterface({
|
|
18671
19519
|
input: process.stdin,
|
|
18672
19520
|
output: process.stdout
|
|
18673
19521
|
});
|
|
18674
19522
|
rl.question("", (answer) => {
|
|
18675
19523
|
rl.close();
|
|
18676
|
-
|
|
19524
|
+
resolve3(answer.trim().toLowerCase());
|
|
18677
19525
|
});
|
|
18678
19526
|
});
|
|
18679
19527
|
}
|
|
@@ -18710,7 +19558,7 @@ async function handlePagination(query, options, client, searchOptions, initialRe
|
|
|
18710
19558
|
console.clear();
|
|
18711
19559
|
} else {
|
|
18712
19560
|
console.log("\n\u274C Already on last page");
|
|
18713
|
-
await new Promise((
|
|
19561
|
+
await new Promise((resolve3) => setTimeout(resolve3, 1e3));
|
|
18714
19562
|
console.clear();
|
|
18715
19563
|
}
|
|
18716
19564
|
continue;
|
|
@@ -18723,7 +19571,7 @@ async function handlePagination(query, options, client, searchOptions, initialRe
|
|
|
18723
19571
|
console.clear();
|
|
18724
19572
|
} else {
|
|
18725
19573
|
console.log("\n\u274C Already on first page");
|
|
18726
|
-
await new Promise((
|
|
19574
|
+
await new Promise((resolve3) => setTimeout(resolve3, 1e3));
|
|
18727
19575
|
console.clear();
|
|
18728
19576
|
}
|
|
18729
19577
|
continue;
|
|
@@ -18733,7 +19581,7 @@ async function handlePagination(query, options, client, searchOptions, initialRe
|
|
|
18733
19581
|
console.log(`
|
|
18734
19582
|
\u{1F310} Opening: ${url}`);
|
|
18735
19583
|
console.log(" (Copy and paste this URL into your browser)\n");
|
|
18736
|
-
await new Promise((
|
|
19584
|
+
await new Promise((resolve3) => setTimeout(resolve3, 2e3));
|
|
18737
19585
|
console.clear();
|
|
18738
19586
|
continue;
|
|
18739
19587
|
}
|
|
@@ -18744,12 +19592,12 @@ async function handlePagination(query, options, client, searchOptions, initialRe
|
|
|
18744
19592
|
\u{1F4E6} To install: \x1B[36mprpm install ${pkg.name}\x1B[0m`);
|
|
18745
19593
|
console.log(` More info: \x1B[36mprpm info ${pkg.name}\x1B[0m
|
|
18746
19594
|
`);
|
|
18747
|
-
await new Promise((
|
|
19595
|
+
await new Promise((resolve3) => setTimeout(resolve3, 2e3));
|
|
18748
19596
|
console.clear();
|
|
18749
19597
|
continue;
|
|
18750
19598
|
}
|
|
18751
19599
|
console.log("\n\u274C Invalid option. Try again.");
|
|
18752
|
-
await new Promise((
|
|
19600
|
+
await new Promise((resolve3) => setTimeout(resolve3, 1e3));
|
|
18753
19601
|
console.clear();
|
|
18754
19602
|
}
|
|
18755
19603
|
}
|
|
@@ -19132,8 +19980,8 @@ init_install();
|
|
|
19132
19980
|
init_cjs_shims();
|
|
19133
19981
|
var import_commander13 = require("commander");
|
|
19134
19982
|
var import_promises9 = require("fs/promises");
|
|
19135
|
-
var
|
|
19136
|
-
var
|
|
19983
|
+
var import_path22 = require("path");
|
|
19984
|
+
var import_fs18 = require("fs");
|
|
19137
19985
|
var import_registry_client6 = require("@pr-pm/registry-client");
|
|
19138
19986
|
init_user_config();
|
|
19139
19987
|
init_telemetry();
|
|
@@ -19142,8 +19990,8 @@ init_errors();
|
|
|
19142
19990
|
// src/utils/license-extractor.ts
|
|
19143
19991
|
init_cjs_shims();
|
|
19144
19992
|
var import_promises3 = require("fs/promises");
|
|
19145
|
-
var
|
|
19146
|
-
var
|
|
19993
|
+
var import_path14 = require("path");
|
|
19994
|
+
var import_fs13 = require("fs");
|
|
19147
19995
|
var LICENSE_FILE_PATTERNS = [
|
|
19148
19996
|
"LICENSE",
|
|
19149
19997
|
"LICENSE.md",
|
|
@@ -19192,9 +20040,9 @@ function generateLicenseUrl(repositoryUrl, fileName) {
|
|
|
19192
20040
|
async function extractLicenseInfo(repositoryUrl) {
|
|
19193
20041
|
const cwd = process.cwd();
|
|
19194
20042
|
for (const fileName of LICENSE_FILE_PATTERNS) {
|
|
19195
|
-
const filePath = (0,
|
|
20043
|
+
const filePath = (0, import_path14.join)(cwd, fileName);
|
|
19196
20044
|
try {
|
|
19197
|
-
await (0, import_promises3.access)(filePath,
|
|
20045
|
+
await (0, import_promises3.access)(filePath, import_fs13.constants.R_OK);
|
|
19198
20046
|
const text = await (0, import_promises3.readFile)(filePath, "utf-8");
|
|
19199
20047
|
const type2 = detectLicenseType(text);
|
|
19200
20048
|
const url = generateLicenseUrl(repositoryUrl, fileName);
|
|
@@ -19228,7 +20076,7 @@ function validateLicenseInfo(licenseInfo, packageName) {
|
|
|
19228
20076
|
// src/utils/snippet-extractor.ts
|
|
19229
20077
|
init_cjs_shims();
|
|
19230
20078
|
var import_promises4 = require("fs/promises");
|
|
19231
|
-
var
|
|
20079
|
+
var import_path15 = require("path");
|
|
19232
20080
|
var MAX_SNIPPET_LENGTH = 2e3;
|
|
19233
20081
|
async function extractSnippet(manifest) {
|
|
19234
20082
|
const cwd = process.cwd();
|
|
@@ -19244,7 +20092,7 @@ async function extractSnippet(manifest) {
|
|
|
19244
20092
|
const firstFile = manifest.files[0];
|
|
19245
20093
|
fileName = typeof firstFile === "string" ? firstFile : firstFile.path;
|
|
19246
20094
|
}
|
|
19247
|
-
const fullPath = (0,
|
|
20095
|
+
const fullPath = (0, import_path15.join)(cwd, fileName);
|
|
19248
20096
|
const stats = await (0, import_promises4.stat)(fullPath);
|
|
19249
20097
|
if (stats.isDirectory()) {
|
|
19250
20098
|
console.warn(`\u26A0\uFE0F Skipping snippet extraction: "${fullPath}" is a directory`);
|
|
@@ -19505,7 +20353,7 @@ async function validatePackageFiles(manifest) {
|
|
|
19505
20353
|
// src/utils/manifest-loader.ts
|
|
19506
20354
|
init_cjs_shims();
|
|
19507
20355
|
var import_promises6 = require("fs/promises");
|
|
19508
|
-
var
|
|
20356
|
+
var import_path17 = require("path");
|
|
19509
20357
|
|
|
19510
20358
|
// src/core/marketplace-converter.ts
|
|
19511
20359
|
init_cjs_shims();
|
|
@@ -19671,19 +20519,19 @@ function validateMarketplaceJson(data) {
|
|
|
19671
20519
|
init_cjs_shims();
|
|
19672
20520
|
var import_ajv2 = __toESM(require("ajv"));
|
|
19673
20521
|
var import_ajv_formats2 = __toESM(require("ajv-formats"));
|
|
19674
|
-
var
|
|
19675
|
-
var
|
|
20522
|
+
var import_fs14 = require("fs");
|
|
20523
|
+
var import_path16 = require("path");
|
|
19676
20524
|
var schema2;
|
|
19677
20525
|
var schemaCandidates = [
|
|
19678
20526
|
// Source file layout (src/core → ../../schemas)
|
|
19679
|
-
(0,
|
|
20527
|
+
(0, import_path16.join)(__dirname, "../../schemas/prpm-manifest.schema.json"),
|
|
19680
20528
|
// Bundled layout (dist/index.js → ../schemas)
|
|
19681
|
-
(0,
|
|
20529
|
+
(0, import_path16.join)(__dirname, "../schemas/prpm-manifest.schema.json")
|
|
19682
20530
|
];
|
|
19683
20531
|
for (const candidate of schemaCandidates) {
|
|
19684
20532
|
try {
|
|
19685
|
-
if ((0,
|
|
19686
|
-
schema2 = JSON.parse((0,
|
|
20533
|
+
if ((0, import_fs14.existsSync)(candidate)) {
|
|
20534
|
+
schema2 = JSON.parse((0, import_fs14.readFileSync)(candidate, "utf-8"));
|
|
19687
20535
|
break;
|
|
19688
20536
|
}
|
|
19689
20537
|
} catch {
|
|
@@ -19737,7 +20585,7 @@ function getManifestSchema() {
|
|
|
19737
20585
|
|
|
19738
20586
|
// src/utils/manifest-loader.ts
|
|
19739
20587
|
async function findAndLoadManifests() {
|
|
19740
|
-
const prpmJsonPath = (0,
|
|
20588
|
+
const prpmJsonPath = (0, import_path17.join)(process.cwd(), "prpm.json");
|
|
19741
20589
|
let prpmJsonExists = false;
|
|
19742
20590
|
try {
|
|
19743
20591
|
const content = await (0, import_promises6.readFile)(prpmJsonPath, "utf-8");
|
|
@@ -19798,7 +20646,7 @@ async function findAndLoadManifests() {
|
|
|
19798
20646
|
throw error;
|
|
19799
20647
|
}
|
|
19800
20648
|
}
|
|
19801
|
-
const marketplaceJsonPath = (0,
|
|
20649
|
+
const marketplaceJsonPath = (0, import_path17.join)(
|
|
19802
20650
|
process.cwd(),
|
|
19803
20651
|
".claude",
|
|
19804
20652
|
"marketplace.json"
|
|
@@ -19818,7 +20666,7 @@ async function findAndLoadManifests() {
|
|
|
19818
20666
|
return { manifests, collections: [], source: ".claude/marketplace.json" };
|
|
19819
20667
|
} catch (error) {
|
|
19820
20668
|
}
|
|
19821
|
-
const marketplaceJsonPluginPath = (0,
|
|
20669
|
+
const marketplaceJsonPluginPath = (0, import_path17.join)(
|
|
19822
20670
|
process.cwd(),
|
|
19823
20671
|
".claude-plugin",
|
|
19824
20672
|
"marketplace.json"
|
|
@@ -19968,13 +20816,13 @@ function getSafePackageName(manifest, userInfo, fallbackName) {
|
|
|
19968
20816
|
// src/utils/tarball-creator.ts
|
|
19969
20817
|
init_cjs_shims();
|
|
19970
20818
|
var import_promises7 = require("fs/promises");
|
|
19971
|
-
var
|
|
20819
|
+
var import_path18 = require("path");
|
|
19972
20820
|
var tar2 = __toESM(require("tar"));
|
|
19973
20821
|
var import_os5 = require("os");
|
|
19974
20822
|
var import_crypto2 = require("crypto");
|
|
19975
20823
|
async function createTarball(manifest) {
|
|
19976
|
-
const tmpDir = (0,
|
|
19977
|
-
const tarballPath = (0,
|
|
20824
|
+
const tmpDir = (0, import_path18.join)((0, import_os5.tmpdir)(), `prpm-${(0, import_crypto2.randomBytes)(8).toString("hex")}`);
|
|
20825
|
+
const tarballPath = (0, import_path18.join)(tmpDir, "package.tar.gz");
|
|
19978
20826
|
try {
|
|
19979
20827
|
await (0, import_promises7.mkdir)(tmpDir, { recursive: true });
|
|
19980
20828
|
const filePaths = normalizeFilePaths2(manifest.files);
|
|
@@ -20103,22 +20951,22 @@ async function handlePublish(options) {
|
|
|
20103
20951
|
throw new CLIError('\u274C Not logged in. Run "prpm login" first.', 1);
|
|
20104
20952
|
}
|
|
20105
20953
|
console.log("\u{1F4E6} Publishing package...\n");
|
|
20106
|
-
const prpmJsonPath = (0,
|
|
20107
|
-
const marketplaceJsonPath = (0,
|
|
20954
|
+
const prpmJsonPath = (0, import_path22.join)(process.cwd(), "prpm.json");
|
|
20955
|
+
const marketplaceJsonPath = (0, import_path22.join)(
|
|
20108
20956
|
process.cwd(),
|
|
20109
20957
|
".claude",
|
|
20110
20958
|
"marketplace.json"
|
|
20111
20959
|
);
|
|
20112
|
-
const marketplaceJsonPluginPath = (0,
|
|
20960
|
+
const marketplaceJsonPluginPath = (0, import_path22.join)(
|
|
20113
20961
|
process.cwd(),
|
|
20114
20962
|
".claude-plugin",
|
|
20115
20963
|
"marketplace.json"
|
|
20116
20964
|
);
|
|
20117
|
-
const hasManifest = (0,
|
|
20965
|
+
const hasManifest = (0, import_fs18.existsSync)(prpmJsonPath) || (0, import_fs18.existsSync)(marketplaceJsonPath) || (0, import_fs18.existsSync)(marketplaceJsonPluginPath);
|
|
20118
20966
|
if (!hasManifest) {
|
|
20119
20967
|
console.log("No prpm.json found. Let's create one first.\n");
|
|
20120
20968
|
await smartInit({});
|
|
20121
|
-
if (!(0,
|
|
20969
|
+
if (!(0, import_fs18.existsSync)(prpmJsonPath)) {
|
|
20122
20970
|
throw new CLIError(
|
|
20123
20971
|
"No prpm.json was created. Cannot publish without a manifest.",
|
|
20124
20972
|
1
|
|
@@ -20130,7 +20978,7 @@ async function handlePublish(options) {
|
|
|
20130
20978
|
const { manifests, collections, source } = await findAndLoadManifests();
|
|
20131
20979
|
if (source === "prpm.json (multi-package)" || source === "prpm.json") {
|
|
20132
20980
|
try {
|
|
20133
|
-
const prpmJsonPath2 = (0,
|
|
20981
|
+
const prpmJsonPath2 = (0, import_path22.join)(process.cwd(), "prpm.json");
|
|
20134
20982
|
const prpmContent = await (0, import_promises9.readFile)(prpmJsonPath2, "utf-8");
|
|
20135
20983
|
const prpmManifest = JSON.parse(prpmContent);
|
|
20136
20984
|
if (prpmManifest.scripts) {
|
|
@@ -20222,7 +21070,7 @@ async function handlePublish(options) {
|
|
|
20222
21070
|
const BATCH_DELAY_MS = options.dryRun || process.env.NODE_ENV === "test" ? 0 : parseInt(process.env.PRPM_BATCH_DELAY_MS || "2000");
|
|
20223
21071
|
const MAX_RETRIES = parseInt(process.env.PRPM_MAX_RETRIES || "3");
|
|
20224
21072
|
const RETRY_DELAY_MS = options.dryRun || process.env.NODE_ENV === "test" ? 0 : parseInt(process.env.PRPM_RETRY_DELAY_MS || "5000");
|
|
20225
|
-
const delay = (ms) => new Promise((
|
|
21073
|
+
const delay = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
20226
21074
|
const isRetriableError = (error2) => {
|
|
20227
21075
|
return error2.includes("Service Unavailable") || error2.includes("Bad Gateway") || error2.includes("at capacity") || error2.includes("502") || error2.includes("503") || error2.includes("ECONNRESET") || error2.includes("ETIMEDOUT");
|
|
20228
21076
|
};
|
|
@@ -20789,7 +21637,7 @@ async function pollForAuthentication(registryUrl, userId) {
|
|
|
20789
21637
|
}
|
|
20790
21638
|
} catch (error) {
|
|
20791
21639
|
}
|
|
20792
|
-
await new Promise((
|
|
21640
|
+
await new Promise((resolve3) => setTimeout(resolve3, 5e3));
|
|
20793
21641
|
attempts++;
|
|
20794
21642
|
}
|
|
20795
21643
|
throw new Error("Authentication timeout - please try again");
|
|
@@ -21479,9 +22327,9 @@ function createReadline() {
|
|
|
21479
22327
|
});
|
|
21480
22328
|
}
|
|
21481
22329
|
function prompt2(rl, question) {
|
|
21482
|
-
return new Promise((
|
|
22330
|
+
return new Promise((resolve3) => {
|
|
21483
22331
|
rl.question(question, (answer) => {
|
|
21484
|
-
|
|
22332
|
+
resolve3(answer);
|
|
21485
22333
|
});
|
|
21486
22334
|
});
|
|
21487
22335
|
}
|
|
@@ -22207,7 +23055,7 @@ async function pollForSubscription(initialStatus, maxAttempts = 60, intervalMs =
|
|
|
22207
23055
|
console.log("\n\u23F3 Waiting for subscription confirmation...");
|
|
22208
23056
|
console.log(" (This may take a minute. Press Ctrl+C to cancel)");
|
|
22209
23057
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
22210
|
-
await new Promise((
|
|
23058
|
+
await new Promise((resolve3) => setTimeout(resolve3, intervalMs));
|
|
22211
23059
|
try {
|
|
22212
23060
|
const status = await getSubscriptionStatus();
|
|
22213
23061
|
if (status.prpm_plus_status === "active" && initialStatus !== "active") {
|
|
@@ -22386,7 +23234,7 @@ async function pollForPurchase(initialBalance, maxAttempts = 60, intervalMs = 2e
|
|
|
22386
23234
|
console.log("\n\u23F3 Waiting for purchase confirmation...");
|
|
22387
23235
|
console.log(" (This may take a minute. Press Ctrl+C to cancel)");
|
|
22388
23236
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
22389
|
-
await new Promise((
|
|
23237
|
+
await new Promise((resolve3) => setTimeout(resolve3, intervalMs));
|
|
22390
23238
|
try {
|
|
22391
23239
|
const status = await getBalance();
|
|
22392
23240
|
if (status.balance > initialBalance) {
|
|
@@ -22655,60 +23503,77 @@ function createStarredCommand() {
|
|
|
22655
23503
|
init_cjs_shims();
|
|
22656
23504
|
var import_commander27 = require("commander");
|
|
22657
23505
|
var import_promises10 = require("fs/promises");
|
|
22658
|
-
var
|
|
22659
|
-
var
|
|
23506
|
+
var import_path23 = require("path");
|
|
23507
|
+
var import_fs19 = require("fs");
|
|
22660
23508
|
var import_readline = require("readline");
|
|
22661
23509
|
var import_chalk2 = __toESM(require_source());
|
|
22662
23510
|
init_errors();
|
|
22663
23511
|
init_dist();
|
|
22664
23512
|
function getDefaultPath(format, filename, subtype, customName) {
|
|
22665
|
-
const baseName = customName || (0,
|
|
23513
|
+
const baseName = customName || (0, import_path23.basename)(filename, (0, import_path23.extname)(filename));
|
|
22666
23514
|
switch (format) {
|
|
22667
23515
|
case "cursor":
|
|
22668
23516
|
if (subtype === "slash-command") {
|
|
22669
|
-
return (0,
|
|
23517
|
+
return (0, import_path23.join)(process.cwd(), ".cursor", "commands", `${baseName}.md`);
|
|
22670
23518
|
}
|
|
22671
23519
|
if (subtype === "hook") {
|
|
22672
|
-
return (0,
|
|
23520
|
+
return (0, import_path23.join)(process.cwd(), ".cursor", "hooks", "hooks.json");
|
|
22673
23521
|
}
|
|
22674
|
-
return (0,
|
|
23522
|
+
return (0, import_path23.join)(process.cwd(), ".cursor", "rules", `${baseName}.mdc`);
|
|
22675
23523
|
case "claude":
|
|
22676
23524
|
if (subtype === "skill") {
|
|
22677
|
-
return (0,
|
|
23525
|
+
return (0, import_path23.join)(process.cwd(), ".claude", "skills", baseName, "SKILL.md");
|
|
22678
23526
|
} else if (subtype === "slash-command") {
|
|
22679
|
-
return (0,
|
|
23527
|
+
return (0, import_path23.join)(process.cwd(), ".claude", "commands", `${baseName}.md`);
|
|
22680
23528
|
} else {
|
|
22681
|
-
return (0,
|
|
23529
|
+
return (0, import_path23.join)(process.cwd(), ".claude", "agents", `${baseName}.md`);
|
|
22682
23530
|
}
|
|
22683
23531
|
case "windsurf":
|
|
22684
|
-
return (0,
|
|
23532
|
+
return (0, import_path23.join)(process.cwd(), ".windsurf", "rules", `${baseName}.md`);
|
|
22685
23533
|
case "kiro":
|
|
22686
23534
|
if (subtype === "hook") {
|
|
22687
|
-
return (0,
|
|
23535
|
+
return (0, import_path23.join)(process.cwd(), ".kiro", "hooks", `${baseName}.kiro.hook`);
|
|
22688
23536
|
}
|
|
22689
23537
|
if (subtype === "agent") {
|
|
22690
|
-
return (0,
|
|
23538
|
+
return (0, import_path23.join)(process.cwd(), ".kiro", "agents", `${baseName}.json`);
|
|
22691
23539
|
}
|
|
22692
|
-
return (0,
|
|
23540
|
+
return (0, import_path23.join)(process.cwd(), ".kiro", "steering", `${baseName}.md`);
|
|
22693
23541
|
case "copilot":
|
|
22694
|
-
return (0,
|
|
23542
|
+
return (0, import_path23.join)(process.cwd(), ".github", "instructions", `${baseName}.instructions.md`);
|
|
22695
23543
|
case "continue":
|
|
22696
23544
|
if (subtype === "slash-command" || subtype === "prompt") {
|
|
22697
|
-
return (0,
|
|
23545
|
+
return (0, import_path23.join)(process.cwd(), ".continue", "prompts", `${baseName}.md`);
|
|
22698
23546
|
}
|
|
22699
|
-
return (0,
|
|
23547
|
+
return (0, import_path23.join)(process.cwd(), ".continue", "rules", `${baseName}.md`);
|
|
22700
23548
|
case "agents.md":
|
|
22701
|
-
return (0,
|
|
23549
|
+
return (0, import_path23.join)(process.cwd(), "agents.md");
|
|
22702
23550
|
case "gemini":
|
|
22703
|
-
return (0,
|
|
23551
|
+
return (0, import_path23.join)(process.cwd(), ".gemini", "commands", `${baseName}.toml`);
|
|
22704
23552
|
case "ruler":
|
|
22705
|
-
return (0,
|
|
23553
|
+
return (0, import_path23.join)(process.cwd(), ".ruler", `${baseName}.md`);
|
|
23554
|
+
case "zed":
|
|
23555
|
+
if (subtype === "slash-command") {
|
|
23556
|
+
return (0, import_path23.join)(process.cwd(), ".zed", "slash_commands", `${baseName}.md`);
|
|
23557
|
+
}
|
|
23558
|
+
return (0, import_path23.join)(process.cwd(), ".zed", "extensions", `${baseName}.json`);
|
|
23559
|
+
case "opencode":
|
|
23560
|
+
return (0, import_path23.join)(process.cwd(), ".opencode", `${baseName}.md`);
|
|
23561
|
+
case "aider":
|
|
23562
|
+
return (0, import_path23.join)(process.cwd(), ".aider", `${baseName}.md`);
|
|
23563
|
+
case "trae":
|
|
23564
|
+
return (0, import_path23.join)(process.cwd(), ".trae", "rules", `${baseName}.md`);
|
|
23565
|
+
case "replit":
|
|
23566
|
+
return (0, import_path23.join)(process.cwd(), ".replit", `${baseName}.md`);
|
|
23567
|
+
case "zencoder":
|
|
23568
|
+
return (0, import_path23.join)(process.cwd(), ".zencoder", `${baseName}.md`);
|
|
23569
|
+
case "droid":
|
|
23570
|
+
return (0, import_path23.join)(process.cwd(), ".factory", `${baseName}.md`);
|
|
22706
23571
|
default:
|
|
22707
23572
|
throw new CLIError(`Unknown format: ${format}`);
|
|
22708
23573
|
}
|
|
22709
23574
|
}
|
|
22710
23575
|
function detectFormat(content, filepath) {
|
|
22711
|
-
const ext = (0,
|
|
23576
|
+
const ext = (0, import_path23.extname)(filepath).toLowerCase();
|
|
22712
23577
|
if (ext === ".mdc" || filepath.includes(".cursor/rules") || filepath.includes(".cursor/commands")) {
|
|
22713
23578
|
return "cursor";
|
|
22714
23579
|
}
|
|
@@ -22730,15 +23595,21 @@ function detectFormat(content, filepath) {
|
|
|
22730
23595
|
if (filepath.includes(".continue/rules") || filepath.includes(".continue/prompts") || filepath.includes(".continuerules")) {
|
|
22731
23596
|
return "continue";
|
|
22732
23597
|
}
|
|
22733
|
-
if ((0,
|
|
23598
|
+
if ((0, import_path23.basename)(filepath) === "agents.md") {
|
|
22734
23599
|
return "agents.md";
|
|
22735
23600
|
}
|
|
23601
|
+
if ((0, import_path23.basename)(filepath) === "gemini-extension.json" || filepath.includes(".gemini/extensions")) {
|
|
23602
|
+
return "gemini-extension";
|
|
23603
|
+
}
|
|
22736
23604
|
if (ext === ".toml" || filepath.includes(".gemini/commands")) {
|
|
22737
23605
|
return "gemini";
|
|
22738
23606
|
}
|
|
22739
23607
|
if (filepath.includes(".ruler/")) {
|
|
22740
23608
|
return "ruler";
|
|
22741
23609
|
}
|
|
23610
|
+
if (filepath.includes(".zed/extensions") || filepath.includes(".zed/slash_commands")) {
|
|
23611
|
+
return "zed";
|
|
23612
|
+
}
|
|
22742
23613
|
if (isCursorHooksFormat(content)) return "cursor-hooks";
|
|
22743
23614
|
if (isClaudeFormat(content)) {
|
|
22744
23615
|
if (content.includes("type: skill")) return "claude-skill";
|
|
@@ -22753,6 +23624,7 @@ function detectFormat(content, filepath) {
|
|
|
22753
23624
|
if (isContinueFormat(content)) return "continue";
|
|
22754
23625
|
if (isAgentsMdFormat(content)) return "agents.md";
|
|
22755
23626
|
if (isRulerFormat(content)) return "ruler";
|
|
23627
|
+
if (isZedFormat(content)) return "zed";
|
|
22756
23628
|
return null;
|
|
22757
23629
|
}
|
|
22758
23630
|
async function confirmOverwrite(filepath) {
|
|
@@ -22760,12 +23632,12 @@ async function confirmOverwrite(filepath) {
|
|
|
22760
23632
|
input: process.stdin,
|
|
22761
23633
|
output: process.stdout
|
|
22762
23634
|
});
|
|
22763
|
-
return new Promise((
|
|
23635
|
+
return new Promise((resolve3) => {
|
|
22764
23636
|
rl.question(
|
|
22765
23637
|
import_chalk2.default.yellow(`File ${filepath} already exists. Overwrite? (y/N): `),
|
|
22766
23638
|
(answer) => {
|
|
22767
23639
|
rl.close();
|
|
22768
|
-
|
|
23640
|
+
resolve3(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
22769
23641
|
}
|
|
22770
23642
|
);
|
|
22771
23643
|
});
|
|
@@ -22790,6 +23662,7 @@ async function handleConvert(sourcePath, options) {
|
|
|
22790
23662
|
console.log(import_chalk2.default.dim(" - GitHub Copilot instructions"));
|
|
22791
23663
|
console.log(import_chalk2.default.dim(" - Continue rules (.continue/rules/*.md)"));
|
|
22792
23664
|
console.log(import_chalk2.default.dim(" - agents.md format"));
|
|
23665
|
+
console.log(import_chalk2.default.dim(" - Zed extensions (.zed/extensions/*)"));
|
|
22793
23666
|
throw new CLIError("Unsupported source format");
|
|
22794
23667
|
}
|
|
22795
23668
|
console.log(import_chalk2.default.green(`\u2713 Detected source format: ${sourceFormat}`));
|
|
@@ -22804,7 +23677,14 @@ async function handleConvert(sourcePath, options) {
|
|
|
22804
23677
|
let canonicalPkg;
|
|
22805
23678
|
switch (sourceFormat.toLowerCase()) {
|
|
22806
23679
|
case "cursor":
|
|
22807
|
-
|
|
23680
|
+
const hasFileReferences = /@[\w\-\/\.]+\.[\w]+/m.test(content);
|
|
23681
|
+
if (hasFileReferences) {
|
|
23682
|
+
console.log(import_chalk2.default.dim("\u{1F4C1} Detected @file references - resolving linked files..."));
|
|
23683
|
+
}
|
|
23684
|
+
canonicalPkg = fromCursor(content, metadata, {
|
|
23685
|
+
resolveFiles: hasFileReferences,
|
|
23686
|
+
basePath: hasFileReferences ? (0, import_path23.dirname)(sourcePath) : void 0
|
|
23687
|
+
});
|
|
22808
23688
|
break;
|
|
22809
23689
|
case "cursor-hooks":
|
|
22810
23690
|
canonicalPkg = fromCursorHooks(content, metadata);
|
|
@@ -22835,6 +23715,9 @@ async function handleConvert(sourcePath, options) {
|
|
|
22835
23715
|
case "agents.md":
|
|
22836
23716
|
canonicalPkg = fromAgentsMd(content, metadata);
|
|
22837
23717
|
break;
|
|
23718
|
+
case "gemini-extension":
|
|
23719
|
+
canonicalPkg = fromGeminiPlugin(content, metadata);
|
|
23720
|
+
break;
|
|
22838
23721
|
case "gemini":
|
|
22839
23722
|
canonicalPkg = fromGemini(content, metadata);
|
|
22840
23723
|
break;
|
|
@@ -22842,6 +23725,27 @@ async function handleConvert(sourcePath, options) {
|
|
|
22842
23725
|
const rulerResult = fromRuler(content);
|
|
22843
23726
|
canonicalPkg = JSON.parse(rulerResult.content);
|
|
22844
23727
|
break;
|
|
23728
|
+
case "zed":
|
|
23729
|
+
canonicalPkg = fromZed(content, metadata);
|
|
23730
|
+
break;
|
|
23731
|
+
case "opencode":
|
|
23732
|
+
canonicalPkg = fromOpencode(content, metadata);
|
|
23733
|
+
break;
|
|
23734
|
+
case "aider":
|
|
23735
|
+
canonicalPkg = fromAider(content, metadata);
|
|
23736
|
+
break;
|
|
23737
|
+
case "trae":
|
|
23738
|
+
canonicalPkg = fromTrae(content, metadata);
|
|
23739
|
+
break;
|
|
23740
|
+
case "replit":
|
|
23741
|
+
canonicalPkg = fromReplit(content, metadata);
|
|
23742
|
+
break;
|
|
23743
|
+
case "zencoder":
|
|
23744
|
+
canonicalPkg = fromZencoder(content, metadata);
|
|
23745
|
+
break;
|
|
23746
|
+
case "droid":
|
|
23747
|
+
canonicalPkg = fromDroid(content, metadata);
|
|
23748
|
+
break;
|
|
22845
23749
|
default:
|
|
22846
23750
|
throw new CLIError(`Unsupported source format: ${sourceFormat}`);
|
|
22847
23751
|
}
|
|
@@ -22885,11 +23789,36 @@ async function handleConvert(sourcePath, options) {
|
|
|
22885
23789
|
result = toAgentsMd(canonicalPkg);
|
|
22886
23790
|
break;
|
|
22887
23791
|
case "gemini":
|
|
22888
|
-
|
|
23792
|
+
if (canonicalPkg.subtype === "extension" || options.subtype === "extension") {
|
|
23793
|
+
result = toGeminiPlugin(canonicalPkg);
|
|
23794
|
+
} else {
|
|
23795
|
+
result = toGemini(canonicalPkg);
|
|
23796
|
+
}
|
|
22889
23797
|
break;
|
|
22890
23798
|
case "ruler":
|
|
22891
23799
|
result = toRuler(canonicalPkg);
|
|
22892
23800
|
break;
|
|
23801
|
+
case "zed":
|
|
23802
|
+
result = toZed(canonicalPkg);
|
|
23803
|
+
break;
|
|
23804
|
+
case "opencode":
|
|
23805
|
+
result = toOpencode(canonicalPkg);
|
|
23806
|
+
break;
|
|
23807
|
+
case "aider":
|
|
23808
|
+
result = toAider(canonicalPkg);
|
|
23809
|
+
break;
|
|
23810
|
+
case "trae":
|
|
23811
|
+
result = toTrae(canonicalPkg);
|
|
23812
|
+
break;
|
|
23813
|
+
case "replit":
|
|
23814
|
+
result = toReplit(canonicalPkg);
|
|
23815
|
+
break;
|
|
23816
|
+
case "zencoder":
|
|
23817
|
+
result = toZencoder(canonicalPkg);
|
|
23818
|
+
break;
|
|
23819
|
+
case "droid":
|
|
23820
|
+
result = toDroid(canonicalPkg);
|
|
23821
|
+
break;
|
|
22893
23822
|
default:
|
|
22894
23823
|
throw new CLIError(`Unsupported target format: ${options.to}`);
|
|
22895
23824
|
}
|
|
@@ -22898,14 +23827,14 @@ async function handleConvert(sourcePath, options) {
|
|
|
22898
23827
|
}
|
|
22899
23828
|
console.log(import_chalk2.default.green(`\u2713 Converted from ${sourceFormat} to ${options.to}`));
|
|
22900
23829
|
const outputPath = options.output || getDefaultPath(options.to, sourcePath, options.subtype, options.name);
|
|
22901
|
-
if ((0,
|
|
23830
|
+
if ((0, import_fs19.existsSync)(outputPath) && !options.yes) {
|
|
22902
23831
|
const shouldOverwrite = await confirmOverwrite(outputPath);
|
|
22903
23832
|
if (!shouldOverwrite) {
|
|
22904
23833
|
console.log(import_chalk2.default.yellow("\n\u2716 Conversion cancelled"));
|
|
22905
23834
|
return;
|
|
22906
23835
|
}
|
|
22907
23836
|
}
|
|
22908
|
-
const outputDir = (0,
|
|
23837
|
+
const outputDir = (0, import_path23.dirname)(outputPath);
|
|
22909
23838
|
await (0, import_promises10.mkdir)(outputDir, { recursive: true });
|
|
22910
23839
|
console.log(import_chalk2.default.dim("Writing converted file..."));
|
|
22911
23840
|
await (0, import_promises10.writeFile)(outputPath, result.content, "utf-8");
|
|
@@ -22923,6 +23852,8 @@ async function handleConvert(sourcePath, options) {
|
|
|
22923
23852
|
console.log(import_chalk2.default.dim("\u{1F4A1} Gemini will automatically load commands from .gemini/commands/"));
|
|
22924
23853
|
} else if (options.to === "ruler") {
|
|
22925
23854
|
console.log(import_chalk2.default.dim("\u{1F4A1} Ruler will automatically load and distribute rules from .ruler/"));
|
|
23855
|
+
} else if (options.to === "zed") {
|
|
23856
|
+
console.log(import_chalk2.default.dim("\u{1F4A1} Zed will automatically load extensions from .zed/extensions/"));
|
|
22926
23857
|
}
|
|
22927
23858
|
} catch (error) {
|
|
22928
23859
|
console.log(import_chalk2.default.red("\u2716 Conversion failed"));
|
|
@@ -22930,17 +23861,16 @@ async function handleConvert(sourcePath, options) {
|
|
|
22930
23861
|
}
|
|
22931
23862
|
}
|
|
22932
23863
|
function createConvertCommand() {
|
|
22933
|
-
const command = new import_commander27.Command("convert").description("Convert AI prompt files between formats").argument("<source>", "Source file path to convert").option("-t, --to <format>",
|
|
23864
|
+
const command = new import_commander27.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) => {
|
|
22934
23865
|
try {
|
|
22935
23866
|
if (!options.to) {
|
|
22936
23867
|
throw new CLIError("Target format is required. Use --to <format>");
|
|
22937
23868
|
}
|
|
22938
|
-
|
|
22939
|
-
if (!validFormats.includes(options.to)) {
|
|
23869
|
+
if (!CLI_SUPPORTED_FORMATS.includes(options.to)) {
|
|
22940
23870
|
throw new CLIError(
|
|
22941
23871
|
`Invalid format: ${options.to}
|
|
22942
23872
|
|
|
22943
|
-
Valid formats: ${
|
|
23873
|
+
Valid formats: ${CLI_SUPPORTED_FORMATS.join(", ")}
|
|
22944
23874
|
|
|
22945
23875
|
\u{1F4A1} For Cursor hooks, use: --to cursor --subtype hook`
|
|
22946
23876
|
);
|
|
@@ -22981,8 +23911,8 @@ Valid subtypes: ${validSubtypes.join(", ")}`
|
|
|
22981
23911
|
// src/commands/export.ts
|
|
22982
23912
|
init_cjs_shims();
|
|
22983
23913
|
var import_commander28 = require("commander");
|
|
22984
|
-
var
|
|
22985
|
-
var
|
|
23914
|
+
var import_fs20 = require("fs");
|
|
23915
|
+
var import_path24 = require("path");
|
|
22986
23916
|
var import_chalk3 = __toESM(require_source());
|
|
22987
23917
|
init_errors();
|
|
22988
23918
|
init_lockfile();
|
|
@@ -22998,17 +23928,17 @@ async function exportToRuler(options) {
|
|
|
22998
23928
|
}
|
|
22999
23929
|
console.log(import_chalk3.default.green(`\u2713 Found ${packages.length} installed package${packages.length === 1 ? "" : "s"}`));
|
|
23000
23930
|
console.log();
|
|
23001
|
-
const outputDir = options.output || (0,
|
|
23931
|
+
const outputDir = options.output || (0, import_path24.join)(process.cwd(), ".ruler");
|
|
23002
23932
|
let rulerExists = false;
|
|
23003
23933
|
try {
|
|
23004
|
-
await
|
|
23934
|
+
await import_fs20.promises.access(outputDir);
|
|
23005
23935
|
rulerExists = true;
|
|
23006
23936
|
} catch {
|
|
23007
23937
|
}
|
|
23008
23938
|
if (!rulerExists) {
|
|
23009
23939
|
console.log(import_chalk3.default.yellow(`\u26A0 ${outputDir} directory not found`));
|
|
23010
23940
|
console.log(import_chalk3.default.dim("Creating .ruler directory..."));
|
|
23011
|
-
await
|
|
23941
|
+
await import_fs20.promises.mkdir(outputDir, { recursive: true });
|
|
23012
23942
|
console.log(import_chalk3.default.green(`\u2713 Created ${outputDir}/`));
|
|
23013
23943
|
console.log();
|
|
23014
23944
|
}
|
|
@@ -23022,11 +23952,11 @@ async function exportToRuler(options) {
|
|
|
23022
23952
|
continue;
|
|
23023
23953
|
}
|
|
23024
23954
|
try {
|
|
23025
|
-
const content = await
|
|
23955
|
+
const content = await import_fs20.promises.readFile(pkg.installedPath, "utf-8");
|
|
23026
23956
|
const rulerContent = createRulerFormat(pkg.id, pkg.version, content, pkg.format, pkg.subtype);
|
|
23027
23957
|
const rulerFilename = `${packageName}.md`;
|
|
23028
|
-
const rulerPath = (0,
|
|
23029
|
-
await
|
|
23958
|
+
const rulerPath = (0, import_path24.join)(outputDir, rulerFilename);
|
|
23959
|
+
await import_fs20.promises.writeFile(rulerPath, rulerContent, "utf-8");
|
|
23030
23960
|
console.log(import_chalk3.default.green(`\u2713 Exported ${pkg.id} \u2192 ${rulerFilename}`));
|
|
23031
23961
|
exportedCount++;
|
|
23032
23962
|
} catch (error) {
|
|
@@ -23065,9 +23995,9 @@ function createRulerFormat(packageId, version, content, format, subtype) {
|
|
|
23065
23995
|
return frontmatter + contentWithoutFrontmatter;
|
|
23066
23996
|
}
|
|
23067
23997
|
async function ensureRulerConfig(rulerDir) {
|
|
23068
|
-
const configPath = (0,
|
|
23998
|
+
const configPath = (0, import_path24.join)((0, import_path24.dirname)(rulerDir), "ruler.toml");
|
|
23069
23999
|
try {
|
|
23070
|
-
await
|
|
24000
|
+
await import_fs20.promises.access(configPath);
|
|
23071
24001
|
console.log(import_chalk3.default.dim("\u2139 ruler.toml already exists (not modified)"));
|
|
23072
24002
|
} catch {
|
|
23073
24003
|
const basicConfig = `# Ruler Configuration
|
|
@@ -23093,7 +24023,7 @@ async function ensureRulerConfig(rulerDir) {
|
|
|
23093
24023
|
# [agents.github-copilot]
|
|
23094
24024
|
# enabled = false
|
|
23095
24025
|
`;
|
|
23096
|
-
await
|
|
24026
|
+
await import_fs20.promises.writeFile(configPath, basicConfig, "utf-8");
|
|
23097
24027
|
console.log(import_chalk3.default.green(`\u2713 Created ruler.toml configuration template`));
|
|
23098
24028
|
}
|
|
23099
24029
|
}
|
|
@@ -23163,8 +24093,8 @@ init_telemetry();
|
|
|
23163
24093
|
init_errors();
|
|
23164
24094
|
function getVersion() {
|
|
23165
24095
|
try {
|
|
23166
|
-
const packageJsonPath = (0,
|
|
23167
|
-
const packageJson = JSON.parse((0,
|
|
24096
|
+
const packageJsonPath = (0, import_path25.join)(__dirname, "../package.json");
|
|
24097
|
+
const packageJson = JSON.parse((0, import_fs21.readFileSync)(packageJsonPath, "utf-8"));
|
|
23168
24098
|
return packageJson.version || "0.0.0";
|
|
23169
24099
|
} catch {
|
|
23170
24100
|
return "0.0.0";
|