prpm 1.1.14 → 1.1.16
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 +520 -166
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -10891,6 +10891,364 @@ var init_schema_files = __esm({
|
|
|
10891
10891
|
}
|
|
10892
10892
|
});
|
|
10893
10893
|
|
|
10894
|
+
// ../converters/dist/format-registry.json
|
|
10895
|
+
var format_registry_default;
|
|
10896
|
+
var init_format_registry = __esm({
|
|
10897
|
+
"../converters/dist/format-registry.json"() {
|
|
10898
|
+
format_registry_default = {
|
|
10899
|
+
$schema: "../schemas/format-registry.schema.json",
|
|
10900
|
+
version: "1.0.0",
|
|
10901
|
+
formats: {
|
|
10902
|
+
cursor: {
|
|
10903
|
+
name: "Cursor",
|
|
10904
|
+
description: "Cursor AI coding rules and agents",
|
|
10905
|
+
documentationUrl: "https://cursor.com/docs/context/rules",
|
|
10906
|
+
rootFiles: [".cursorrules"],
|
|
10907
|
+
subtypes: {
|
|
10908
|
+
rule: {
|
|
10909
|
+
directory: ".cursor/rules",
|
|
10910
|
+
filePatterns: ["*.mdc", "*.md"],
|
|
10911
|
+
fileExtension: ".mdc"
|
|
10912
|
+
},
|
|
10913
|
+
agent: {
|
|
10914
|
+
directory: ".cursor/agents",
|
|
10915
|
+
filePatterns: ["*.md"],
|
|
10916
|
+
fileExtension: ".md"
|
|
10917
|
+
},
|
|
10918
|
+
"slash-command": {
|
|
10919
|
+
directory: ".cursor/commands",
|
|
10920
|
+
filePatterns: ["*.md"],
|
|
10921
|
+
fileExtension: ".md"
|
|
10922
|
+
}
|
|
10923
|
+
}
|
|
10924
|
+
},
|
|
10925
|
+
claude: {
|
|
10926
|
+
name: "Claude Code",
|
|
10927
|
+
description: "Claude AI skills, agents, commands, and hooks",
|
|
10928
|
+
documentationUrl: "https://code.claude.com/docs",
|
|
10929
|
+
defaultSubtype: "agent",
|
|
10930
|
+
subtypes: {
|
|
10931
|
+
skill: {
|
|
10932
|
+
directory: ".claude/skills",
|
|
10933
|
+
filePatterns: ["SKILL.md"],
|
|
10934
|
+
nested: true,
|
|
10935
|
+
nestedIndicator: "SKILL.md",
|
|
10936
|
+
usesPackageSubdirectory: true,
|
|
10937
|
+
fileExtension: ".md"
|
|
10938
|
+
},
|
|
10939
|
+
agent: {
|
|
10940
|
+
directory: ".claude/agents",
|
|
10941
|
+
filePatterns: ["*.md"],
|
|
10942
|
+
fileExtension: ".md"
|
|
10943
|
+
},
|
|
10944
|
+
"slash-command": {
|
|
10945
|
+
directory: ".claude/commands",
|
|
10946
|
+
filePatterns: ["*.md"],
|
|
10947
|
+
nested: true,
|
|
10948
|
+
fileExtension: ".md"
|
|
10949
|
+
},
|
|
10950
|
+
hook: {
|
|
10951
|
+
directory: ".claude",
|
|
10952
|
+
scanDirectory: ".claude/hooks",
|
|
10953
|
+
filePatterns: ["hook.json"],
|
|
10954
|
+
nested: true,
|
|
10955
|
+
nestedIndicator: "hook.json",
|
|
10956
|
+
fileExtension: ".json"
|
|
10957
|
+
}
|
|
10958
|
+
}
|
|
10959
|
+
},
|
|
10960
|
+
continue: {
|
|
10961
|
+
name: "Continue",
|
|
10962
|
+
description: "Continue AI coding rules and prompts",
|
|
10963
|
+
documentationUrl: "https://docs.continue.dev",
|
|
10964
|
+
rootFiles: [".continuerules"],
|
|
10965
|
+
subtypes: {
|
|
10966
|
+
rule: {
|
|
10967
|
+
directory: ".continue/rules",
|
|
10968
|
+
filePatterns: ["*.md"],
|
|
10969
|
+
fileExtension: ".md"
|
|
10970
|
+
},
|
|
10971
|
+
prompt: {
|
|
10972
|
+
directory: ".continue/prompts",
|
|
10973
|
+
filePatterns: ["*.md"],
|
|
10974
|
+
fileExtension: ".md"
|
|
10975
|
+
}
|
|
10976
|
+
}
|
|
10977
|
+
},
|
|
10978
|
+
windsurf: {
|
|
10979
|
+
name: "Windsurf",
|
|
10980
|
+
description: "Windsurf AI coding rules",
|
|
10981
|
+
documentationUrl: "https://windsurf.run",
|
|
10982
|
+
subtypes: {
|
|
10983
|
+
rule: {
|
|
10984
|
+
directory: ".windsurf/rules",
|
|
10985
|
+
filePatterns: ["*.md"],
|
|
10986
|
+
fileExtension: ".md"
|
|
10987
|
+
}
|
|
10988
|
+
}
|
|
10989
|
+
},
|
|
10990
|
+
copilot: {
|
|
10991
|
+
name: "GitHub Copilot",
|
|
10992
|
+
description: "GitHub Copilot instructions and chat modes",
|
|
10993
|
+
documentationUrl: "https://docs.github.com/en/copilot",
|
|
10994
|
+
subtypes: {
|
|
10995
|
+
rule: {
|
|
10996
|
+
directory: ".github/instructions",
|
|
10997
|
+
filePatterns: ["*.instructions.md"],
|
|
10998
|
+
fileExtension: ".instructions.md"
|
|
10999
|
+
},
|
|
11000
|
+
chatmode: {
|
|
11001
|
+
directory: ".github/chatmodes",
|
|
11002
|
+
filePatterns: ["*.chatmode.md"],
|
|
11003
|
+
fileExtension: ".chatmode.md"
|
|
11004
|
+
}
|
|
11005
|
+
}
|
|
11006
|
+
},
|
|
11007
|
+
kiro: {
|
|
11008
|
+
name: "Kiro",
|
|
11009
|
+
description: "Kiro steering files, hooks, and agents",
|
|
11010
|
+
documentationUrl: "https://kiro.dev",
|
|
11011
|
+
subtypes: {
|
|
11012
|
+
rule: {
|
|
11013
|
+
directory: ".kiro/steering",
|
|
11014
|
+
filePatterns: ["*.md"],
|
|
11015
|
+
fileExtension: ".md"
|
|
11016
|
+
},
|
|
11017
|
+
hook: {
|
|
11018
|
+
directory: ".kiro/hooks",
|
|
11019
|
+
filePatterns: ["*.kiro.hook"],
|
|
11020
|
+
fileExtension: ".kiro.hook"
|
|
11021
|
+
},
|
|
11022
|
+
agent: {
|
|
11023
|
+
directory: ".kiro/agents",
|
|
11024
|
+
filePatterns: ["*.json"],
|
|
11025
|
+
fileExtension: ".json"
|
|
11026
|
+
}
|
|
11027
|
+
}
|
|
11028
|
+
},
|
|
11029
|
+
gemini: {
|
|
11030
|
+
name: "Gemini CLI",
|
|
11031
|
+
description: "Gemini CLI custom commands",
|
|
11032
|
+
documentationUrl: "https://geminicli.com",
|
|
11033
|
+
subtypes: {
|
|
11034
|
+
"slash-command": {
|
|
11035
|
+
directory: ".gemini/commands",
|
|
11036
|
+
filePatterns: ["*.toml"],
|
|
11037
|
+
fileExtension: ".toml"
|
|
11038
|
+
}
|
|
11039
|
+
}
|
|
11040
|
+
},
|
|
11041
|
+
opencode: {
|
|
11042
|
+
name: "OpenCode",
|
|
11043
|
+
description: "OpenCode agents, commands, and tools",
|
|
11044
|
+
documentationUrl: "https://opencode.ai",
|
|
11045
|
+
subtypes: {
|
|
11046
|
+
agent: {
|
|
11047
|
+
directory: ".opencode/agent",
|
|
11048
|
+
filePatterns: ["*.md"],
|
|
11049
|
+
fileExtension: ".md"
|
|
11050
|
+
},
|
|
11051
|
+
"slash-command": {
|
|
11052
|
+
directory: ".opencode/command",
|
|
11053
|
+
filePatterns: ["*.md"],
|
|
11054
|
+
fileExtension: ".md"
|
|
11055
|
+
},
|
|
11056
|
+
tool: {
|
|
11057
|
+
directory: ".opencode/tool",
|
|
11058
|
+
filePatterns: ["*.md", "*.json"],
|
|
11059
|
+
fileExtension: ".md"
|
|
11060
|
+
}
|
|
11061
|
+
}
|
|
11062
|
+
},
|
|
11063
|
+
droid: {
|
|
11064
|
+
name: "Factory Droid",
|
|
11065
|
+
description: "Factory Droid skills, commands, and hooks",
|
|
11066
|
+
documentationUrl: "https://docs.factory.ai",
|
|
11067
|
+
subtypes: {
|
|
11068
|
+
skill: {
|
|
11069
|
+
directory: ".factory/skills",
|
|
11070
|
+
filePatterns: ["*.md"],
|
|
11071
|
+
nested: true,
|
|
11072
|
+
usesPackageSubdirectory: true,
|
|
11073
|
+
fileExtension: ".md"
|
|
11074
|
+
},
|
|
11075
|
+
"slash-command": {
|
|
11076
|
+
directory: ".factory/commands",
|
|
11077
|
+
filePatterns: ["*.md"],
|
|
11078
|
+
fileExtension: ".md"
|
|
11079
|
+
},
|
|
11080
|
+
hook: {
|
|
11081
|
+
directory: ".factory/hooks",
|
|
11082
|
+
filePatterns: ["*.json", "*.js"],
|
|
11083
|
+
fileExtension: ".json"
|
|
11084
|
+
}
|
|
11085
|
+
}
|
|
11086
|
+
},
|
|
11087
|
+
trae: {
|
|
11088
|
+
name: "Trae",
|
|
11089
|
+
description: "Trae AI coding rules",
|
|
11090
|
+
subtypes: {
|
|
11091
|
+
rule: {
|
|
11092
|
+
directory: ".trae/rules",
|
|
11093
|
+
filePatterns: ["*.md"],
|
|
11094
|
+
fileExtension: ".md"
|
|
11095
|
+
}
|
|
11096
|
+
}
|
|
11097
|
+
},
|
|
11098
|
+
zencoder: {
|
|
11099
|
+
name: "Zencoder",
|
|
11100
|
+
description: "Zencoder AI coding rules",
|
|
11101
|
+
subtypes: {
|
|
11102
|
+
rule: {
|
|
11103
|
+
directory: ".zencoder/rules",
|
|
11104
|
+
filePatterns: ["*.md"],
|
|
11105
|
+
fileExtension: ".md"
|
|
11106
|
+
}
|
|
11107
|
+
}
|
|
11108
|
+
},
|
|
11109
|
+
generic: {
|
|
11110
|
+
name: "Generic Prompts",
|
|
11111
|
+
description: "Generic AI prompts",
|
|
11112
|
+
subtypes: {
|
|
11113
|
+
prompt: {
|
|
11114
|
+
directory: ".prompts",
|
|
11115
|
+
filePatterns: ["*.md"],
|
|
11116
|
+
fileExtension: ".md"
|
|
11117
|
+
}
|
|
11118
|
+
}
|
|
11119
|
+
},
|
|
11120
|
+
"agents.md": {
|
|
11121
|
+
name: "AGENTS.md",
|
|
11122
|
+
description: "OpenAI AGENTS.md project instructions",
|
|
11123
|
+
rootFiles: ["AGENTS.md"],
|
|
11124
|
+
subtypes: {
|
|
11125
|
+
rule: {
|
|
11126
|
+
directory: ".",
|
|
11127
|
+
filePatterns: ["AGENTS.md"],
|
|
11128
|
+
fileExtension: ".md"
|
|
11129
|
+
},
|
|
11130
|
+
skill: {
|
|
11131
|
+
directory: ".openskills",
|
|
11132
|
+
filePatterns: ["*.md"],
|
|
11133
|
+
nested: true,
|
|
11134
|
+
usesPackageSubdirectory: true,
|
|
11135
|
+
fileExtension: ".md"
|
|
11136
|
+
},
|
|
11137
|
+
agent: {
|
|
11138
|
+
directory: ".openagents",
|
|
11139
|
+
filePatterns: ["*.md"],
|
|
11140
|
+
nested: true,
|
|
11141
|
+
usesPackageSubdirectory: true,
|
|
11142
|
+
fileExtension: ".md"
|
|
11143
|
+
}
|
|
11144
|
+
}
|
|
11145
|
+
},
|
|
11146
|
+
"gemini.md": {
|
|
11147
|
+
name: "GEMINI.md",
|
|
11148
|
+
description: "Gemini GEMINI.md project instructions",
|
|
11149
|
+
rootFiles: ["GEMINI.md"],
|
|
11150
|
+
subtypes: {
|
|
11151
|
+
rule: {
|
|
11152
|
+
directory: ".",
|
|
11153
|
+
filePatterns: ["GEMINI.md"],
|
|
11154
|
+
fileExtension: ".md"
|
|
11155
|
+
},
|
|
11156
|
+
skill: {
|
|
11157
|
+
directory: ".openskills",
|
|
11158
|
+
filePatterns: ["*.md"],
|
|
11159
|
+
nested: true,
|
|
11160
|
+
usesPackageSubdirectory: true,
|
|
11161
|
+
fileExtension: ".md"
|
|
11162
|
+
},
|
|
11163
|
+
agent: {
|
|
11164
|
+
directory: ".openagents",
|
|
11165
|
+
filePatterns: ["*.md"],
|
|
11166
|
+
nested: true,
|
|
11167
|
+
usesPackageSubdirectory: true,
|
|
11168
|
+
fileExtension: ".md"
|
|
11169
|
+
}
|
|
11170
|
+
}
|
|
11171
|
+
},
|
|
11172
|
+
"claude.md": {
|
|
11173
|
+
name: "CLAUDE.md",
|
|
11174
|
+
description: "Claude CLAUDE.md project instructions",
|
|
11175
|
+
rootFiles: ["CLAUDE.md"],
|
|
11176
|
+
subtypes: {
|
|
11177
|
+
rule: {
|
|
11178
|
+
directory: ".",
|
|
11179
|
+
filePatterns: ["CLAUDE.md"],
|
|
11180
|
+
fileExtension: ".md"
|
|
11181
|
+
},
|
|
11182
|
+
skill: {
|
|
11183
|
+
directory: ".openskills",
|
|
11184
|
+
filePatterns: ["*.md"],
|
|
11185
|
+
nested: true,
|
|
11186
|
+
usesPackageSubdirectory: true,
|
|
11187
|
+
fileExtension: ".md"
|
|
11188
|
+
},
|
|
11189
|
+
agent: {
|
|
11190
|
+
directory: ".openagents",
|
|
11191
|
+
filePatterns: ["*.md"],
|
|
11192
|
+
nested: true,
|
|
11193
|
+
usesPackageSubdirectory: true,
|
|
11194
|
+
fileExtension: ".md"
|
|
11195
|
+
}
|
|
11196
|
+
}
|
|
11197
|
+
},
|
|
11198
|
+
aider: {
|
|
11199
|
+
name: "Aider",
|
|
11200
|
+
description: "Aider CONVENTIONS.md project instructions",
|
|
11201
|
+
rootFiles: ["CONVENTIONS.md"],
|
|
11202
|
+
subtypes: {
|
|
11203
|
+
rule: {
|
|
11204
|
+
directory: ".",
|
|
11205
|
+
filePatterns: ["CONVENTIONS.md"],
|
|
11206
|
+
fileExtension: ".md"
|
|
11207
|
+
},
|
|
11208
|
+
skill: {
|
|
11209
|
+
directory: ".openskills",
|
|
11210
|
+
filePatterns: ["*.md"],
|
|
11211
|
+
nested: true,
|
|
11212
|
+
usesPackageSubdirectory: true,
|
|
11213
|
+
fileExtension: ".md"
|
|
11214
|
+
},
|
|
11215
|
+
agent: {
|
|
11216
|
+
directory: ".openagents",
|
|
11217
|
+
filePatterns: ["*.md"],
|
|
11218
|
+
nested: true,
|
|
11219
|
+
usesPackageSubdirectory: true,
|
|
11220
|
+
fileExtension: ".md"
|
|
11221
|
+
}
|
|
11222
|
+
}
|
|
11223
|
+
},
|
|
11224
|
+
replit: {
|
|
11225
|
+
name: "Replit",
|
|
11226
|
+
description: "Replit replit.md configuration",
|
|
11227
|
+
rootFiles: ["replit.md"],
|
|
11228
|
+
subtypes: {
|
|
11229
|
+
rule: {
|
|
11230
|
+
directory: ".",
|
|
11231
|
+
filePatterns: ["replit.md"],
|
|
11232
|
+
fileExtension: ".md"
|
|
11233
|
+
}
|
|
11234
|
+
}
|
|
11235
|
+
},
|
|
11236
|
+
mcp: {
|
|
11237
|
+
name: "MCP",
|
|
11238
|
+
description: "Model Context Protocol tools",
|
|
11239
|
+
subtypes: {
|
|
11240
|
+
tool: {
|
|
11241
|
+
directory: ".mcp/tools",
|
|
11242
|
+
filePatterns: ["*.json"],
|
|
11243
|
+
fileExtension: ".json"
|
|
11244
|
+
}
|
|
11245
|
+
}
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
};
|
|
11249
|
+
}
|
|
11250
|
+
});
|
|
11251
|
+
|
|
10894
11252
|
// ../converters/dist/format-registry.js
|
|
10895
11253
|
function getFormatRegistry() {
|
|
10896
11254
|
return formatRegistry;
|
|
@@ -10963,17 +11321,13 @@ function findFormatByRootFile(filename) {
|
|
|
10963
11321
|
}
|
|
10964
11322
|
return void 0;
|
|
10965
11323
|
}
|
|
10966
|
-
var
|
|
10967
|
-
var
|
|
11324
|
+
var formatRegistry;
|
|
11325
|
+
var init_format_registry2 = __esm({
|
|
10968
11326
|
"../converters/dist/format-registry.js"() {
|
|
10969
11327
|
"use strict";
|
|
10970
11328
|
init_cjs_shims();
|
|
10971
|
-
|
|
10972
|
-
|
|
10973
|
-
import_path7 = require("path");
|
|
10974
|
-
currentDir = (0, import_path7.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
|
|
10975
|
-
formatRegistryData = JSON.parse((0, import_fs6.readFileSync)((0, import_path7.join)(currentDir, "format-registry.json"), "utf-8"));
|
|
10976
|
-
formatRegistry = formatRegistryData;
|
|
11329
|
+
init_format_registry();
|
|
11330
|
+
formatRegistry = format_registry_default;
|
|
10977
11331
|
}
|
|
10978
11332
|
});
|
|
10979
11333
|
|
|
@@ -11117,7 +11471,7 @@ var init_dist = __esm({
|
|
|
11117
11471
|
init_taxonomy_utils();
|
|
11118
11472
|
init_validation();
|
|
11119
11473
|
init_schema_files();
|
|
11120
|
-
|
|
11474
|
+
init_format_registry2();
|
|
11121
11475
|
}
|
|
11122
11476
|
});
|
|
11123
11477
|
|
|
@@ -11141,23 +11495,23 @@ function getDestinationDir2(format, subtype, name) {
|
|
|
11141
11495
|
}
|
|
11142
11496
|
async function ensureDirectoryExists(dirPath) {
|
|
11143
11497
|
try {
|
|
11144
|
-
await
|
|
11498
|
+
await import_fs6.promises.mkdir(dirPath, { recursive: true });
|
|
11145
11499
|
} catch (error) {
|
|
11146
11500
|
throw new Error(`Failed to create directory ${dirPath}: ${error}`);
|
|
11147
11501
|
}
|
|
11148
11502
|
}
|
|
11149
11503
|
async function saveFile(filePath, content) {
|
|
11150
11504
|
try {
|
|
11151
|
-
const dir =
|
|
11505
|
+
const dir = import_path7.default.dirname(filePath);
|
|
11152
11506
|
await ensureDirectoryExists(dir);
|
|
11153
|
-
await
|
|
11507
|
+
await import_fs6.promises.writeFile(filePath, content, "utf-8");
|
|
11154
11508
|
} catch (error) {
|
|
11155
11509
|
throw new Error(`Failed to save file ${filePath}: ${error}`);
|
|
11156
11510
|
}
|
|
11157
11511
|
}
|
|
11158
11512
|
async function fileExists(filePath) {
|
|
11159
11513
|
try {
|
|
11160
|
-
await
|
|
11514
|
+
await import_fs6.promises.access(filePath);
|
|
11161
11515
|
return true;
|
|
11162
11516
|
} catch {
|
|
11163
11517
|
return false;
|
|
@@ -11165,7 +11519,7 @@ async function fileExists(filePath) {
|
|
|
11165
11519
|
}
|
|
11166
11520
|
async function directoryExists(dirPath) {
|
|
11167
11521
|
try {
|
|
11168
|
-
const stats = await
|
|
11522
|
+
const stats = await import_fs6.promises.stat(dirPath);
|
|
11169
11523
|
return stats.isDirectory();
|
|
11170
11524
|
} catch {
|
|
11171
11525
|
return false;
|
|
@@ -11220,13 +11574,13 @@ function stripAuthorNamespace2(packageId) {
|
|
|
11220
11574
|
const parts = packageId.split("/");
|
|
11221
11575
|
return parts[parts.length - 1];
|
|
11222
11576
|
}
|
|
11223
|
-
var
|
|
11577
|
+
var import_fs6, import_path7;
|
|
11224
11578
|
var init_filesystem = __esm({
|
|
11225
11579
|
"src/core/filesystem.ts"() {
|
|
11226
11580
|
"use strict";
|
|
11227
11581
|
init_cjs_shims();
|
|
11228
|
-
|
|
11229
|
-
|
|
11582
|
+
import_fs6 = require("fs");
|
|
11583
|
+
import_path7 = __toESM(require("path"));
|
|
11230
11584
|
init_dist();
|
|
11231
11585
|
}
|
|
11232
11586
|
});
|
|
@@ -11246,7 +11600,7 @@ function generateSkillXML(entry) {
|
|
|
11246
11600
|
const resourceType = entry.resourceType || "skill";
|
|
11247
11601
|
const tag = resourceType === "agent" ? "agent" : "skill";
|
|
11248
11602
|
const mainFile = entry.mainFile || (resourceType === "agent" ? "AGENT.md" : "SKILL.md");
|
|
11249
|
-
const fullPath =
|
|
11603
|
+
const fullPath = import_path8.default.join(entry.skillPath, mainFile);
|
|
11250
11604
|
return `<${tag}>
|
|
11251
11605
|
<name>${escapeXML(entry.name)}</name>
|
|
11252
11606
|
<description>${escapeXML(entry.description)}</description>
|
|
@@ -11316,7 +11670,7 @@ async function readAgentsMdManifest(agentsPath = "AGENTS.md") {
|
|
|
11316
11670
|
afterManifest: ""
|
|
11317
11671
|
};
|
|
11318
11672
|
}
|
|
11319
|
-
const content = await
|
|
11673
|
+
const content = await import_fs7.promises.readFile(agentsPath, "utf-8");
|
|
11320
11674
|
let manifestStart = "<!-- PRPM_MANIFEST_START -->";
|
|
11321
11675
|
let manifestEnd = "<!-- PRPM_MANIFEST_END -->";
|
|
11322
11676
|
let startIdx = content.indexOf(manifestStart);
|
|
@@ -11374,7 +11728,7 @@ async function addSkillToManifest(entry, agentsPath = "AGENTS.md") {
|
|
|
11374
11728
|
newContent += "\n\n";
|
|
11375
11729
|
newContent += generateManifestFooter(hasAgents, agentsXML);
|
|
11376
11730
|
newContent += afterManifest;
|
|
11377
|
-
await
|
|
11731
|
+
await import_fs7.promises.writeFile(agentsPath, newContent.trim() + "\n", "utf-8");
|
|
11378
11732
|
}
|
|
11379
11733
|
async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
11380
11734
|
const { beforeManifest, manifest, afterManifest } = await readAgentsMdManifest(agentsPath);
|
|
@@ -11386,9 +11740,9 @@ async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
|
11386
11740
|
if (updatedResources.length === 0) {
|
|
11387
11741
|
const newContent2 = (beforeManifest + afterManifest).trim();
|
|
11388
11742
|
if (newContent2) {
|
|
11389
|
-
await
|
|
11743
|
+
await import_fs7.promises.writeFile(agentsPath, newContent2 + "\n", "utf-8");
|
|
11390
11744
|
} else {
|
|
11391
|
-
await
|
|
11745
|
+
await import_fs7.promises.unlink(agentsPath);
|
|
11392
11746
|
}
|
|
11393
11747
|
return;
|
|
11394
11748
|
}
|
|
@@ -11404,7 +11758,7 @@ async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
|
11404
11758
|
newContent += "\n\n";
|
|
11405
11759
|
newContent += generateManifestFooter(hasAgents, agentsXML);
|
|
11406
11760
|
newContent += afterManifest;
|
|
11407
|
-
await
|
|
11761
|
+
await import_fs7.promises.writeFile(agentsPath, newContent.trim() + "\n", "utf-8");
|
|
11408
11762
|
}
|
|
11409
11763
|
function parseSkillsFromManifest(manifestXML) {
|
|
11410
11764
|
const resources = [];
|
|
@@ -11461,13 +11815,13 @@ function escapeXML(str2) {
|
|
|
11461
11815
|
function unescapeXML(str2) {
|
|
11462
11816
|
return str2.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
11463
11817
|
}
|
|
11464
|
-
var
|
|
11818
|
+
var import_fs7, import_path8;
|
|
11465
11819
|
var init_agents_md_progressive = __esm({
|
|
11466
11820
|
"src/core/agents-md-progressive.ts"() {
|
|
11467
11821
|
"use strict";
|
|
11468
11822
|
init_cjs_shims();
|
|
11469
|
-
|
|
11470
|
-
|
|
11823
|
+
import_fs7 = require("fs");
|
|
11824
|
+
import_path8 = __toESM(require("path"));
|
|
11471
11825
|
init_filesystem();
|
|
11472
11826
|
}
|
|
11473
11827
|
});
|
|
@@ -14176,7 +14530,7 @@ This could indicate:
|
|
|
14176
14530
|
destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
|
|
14177
14531
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
14178
14532
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
14179
|
-
destDir =
|
|
14533
|
+
destDir = import_path10.default.join(locationOverride, relativeDestDir);
|
|
14180
14534
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
14181
14535
|
}
|
|
14182
14536
|
let mainFile = extractedFiles[0].content;
|
|
@@ -14197,7 +14551,7 @@ This could indicate:
|
|
|
14197
14551
|
const manifestFilename = getManifestFilename(effectiveFormat);
|
|
14198
14552
|
let targetPath = manifestFilename;
|
|
14199
14553
|
if (locationOverride) {
|
|
14200
|
-
targetPath =
|
|
14554
|
+
targetPath = import_path10.default.join(locationOverride, `${manifestFilename.replace(".md", ".override.md")}`);
|
|
14201
14555
|
console.log(` \u{1F4C1} Installing to custom location: ${targetPath}`);
|
|
14202
14556
|
}
|
|
14203
14557
|
destPath = targetPath;
|
|
@@ -14308,7 +14662,7 @@ This could indicate:
|
|
|
14308
14662
|
destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
|
|
14309
14663
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
14310
14664
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
14311
|
-
destDir =
|
|
14665
|
+
destDir = import_path10.default.join(locationOverride, relativeDestDir);
|
|
14312
14666
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
14313
14667
|
}
|
|
14314
14668
|
const packageName = stripAuthorNamespace2(packageId);
|
|
@@ -14483,9 +14837,9 @@ ${afterFrontmatter}`;
|
|
|
14483
14837
|
}
|
|
14484
14838
|
}
|
|
14485
14839
|
function isPathSafe(targetDir, filePath) {
|
|
14486
|
-
const resolvedPath =
|
|
14487
|
-
const resolvedTarget =
|
|
14488
|
-
return resolvedPath.startsWith(resolvedTarget +
|
|
14840
|
+
const resolvedPath = import_path10.default.resolve(targetDir, filePath);
|
|
14841
|
+
const resolvedTarget = import_path10.default.resolve(targetDir);
|
|
14842
|
+
return resolvedPath.startsWith(resolvedTarget + import_path10.default.sep) || resolvedPath === resolvedTarget;
|
|
14489
14843
|
}
|
|
14490
14844
|
function hasUnsafePathPatterns(filePath) {
|
|
14491
14845
|
if (filePath.includes("..")) return true;
|
|
@@ -14509,7 +14863,7 @@ async function extractTarball(tarball, packageId) {
|
|
|
14509
14863
|
} catch (error) {
|
|
14510
14864
|
throw new CLIError(`Package decompression failed: ${error.message}`);
|
|
14511
14865
|
}
|
|
14512
|
-
const tmpDir = await import_promises2.default.mkdtemp(
|
|
14866
|
+
const tmpDir = await import_promises2.default.mkdtemp(import_path10.default.join(import_os3.default.tmpdir(), "prpm-"));
|
|
14513
14867
|
const cleanup = async () => {
|
|
14514
14868
|
try {
|
|
14515
14869
|
await import_promises2.default.rm(tmpDir, { recursive: true, force: true });
|
|
@@ -14575,11 +14929,11 @@ async function collectExtractedFiles(rootDir, excludedNames, fs14) {
|
|
|
14575
14929
|
const files = [];
|
|
14576
14930
|
const dirs = [rootDir];
|
|
14577
14931
|
while (dirs.length > 0) {
|
|
14578
|
-
const
|
|
14579
|
-
if (!
|
|
14580
|
-
const entries = await fs14.readdir(
|
|
14932
|
+
const currentDir = dirs.pop();
|
|
14933
|
+
if (!currentDir) continue;
|
|
14934
|
+
const entries = await fs14.readdir(currentDir, { withFileTypes: true });
|
|
14581
14935
|
for (const entry of entries) {
|
|
14582
|
-
const fullPath =
|
|
14936
|
+
const fullPath = import_path10.default.join(currentDir, entry.name);
|
|
14583
14937
|
if (entry.isDirectory()) {
|
|
14584
14938
|
dirs.push(fullPath);
|
|
14585
14939
|
continue;
|
|
@@ -14591,7 +14945,7 @@ async function collectExtractedFiles(rootDir, excludedNames, fs14) {
|
|
|
14591
14945
|
continue;
|
|
14592
14946
|
}
|
|
14593
14947
|
const content = await fs14.readFile(fullPath, "utf-8");
|
|
14594
|
-
const relativePath =
|
|
14948
|
+
const relativePath = import_path10.default.relative(rootDir, fullPath).split(import_path10.default.sep).join("/");
|
|
14595
14949
|
files.push({
|
|
14596
14950
|
name: relativePath,
|
|
14597
14951
|
content
|
|
@@ -14625,11 +14979,11 @@ async function installFromLockfile(options) {
|
|
|
14625
14979
|
console.log(` Installing ${displayName}...`);
|
|
14626
14980
|
let locationOverride = options.location;
|
|
14627
14981
|
if (!locationOverride && lockEntry.format === "agents.md" && lockEntry.installedPath) {
|
|
14628
|
-
const baseName =
|
|
14982
|
+
const baseName = import_path10.default.basename(lockEntry.installedPath);
|
|
14629
14983
|
if (baseName === "AGENTS.override.md") {
|
|
14630
|
-
locationOverride =
|
|
14984
|
+
locationOverride = import_path10.default.dirname(lockEntry.installedPath);
|
|
14631
14985
|
} else if (baseName !== "AGENTS.md") {
|
|
14632
|
-
locationOverride =
|
|
14986
|
+
locationOverride = import_path10.default.dirname(lockEntry.installedPath);
|
|
14633
14987
|
}
|
|
14634
14988
|
}
|
|
14635
14989
|
const manifestFile = (_a = lockEntry.progressiveDisclosure) == null ? void 0 : _a.manifestPath;
|
|
@@ -14708,7 +15062,7 @@ function createInstallCommand() {
|
|
|
14708
15062
|
});
|
|
14709
15063
|
return command;
|
|
14710
15064
|
}
|
|
14711
|
-
var import_commander11, import_chalk, import_registry_client5, import_stream, import_promises, tar,
|
|
15065
|
+
var import_commander11, import_chalk, import_registry_client5, import_stream, import_promises, tar, import_path10, import_zlib, import_promises2, import_os3, import_semver;
|
|
14712
15066
|
var init_install = __esm({
|
|
14713
15067
|
"src/commands/install.ts"() {
|
|
14714
15068
|
"use strict";
|
|
@@ -14725,7 +15079,7 @@ var init_install = __esm({
|
|
|
14725
15079
|
tar = __toESM(require("tar"));
|
|
14726
15080
|
init_errors();
|
|
14727
15081
|
init_prompts();
|
|
14728
|
-
|
|
15082
|
+
import_path10 = __toESM(require("path"));
|
|
14729
15083
|
import_zlib = __toESM(require("zlib"));
|
|
14730
15084
|
import_promises2 = __toESM(require("fs/promises"));
|
|
14731
15085
|
import_os3 = __toESM(require("os"));
|
|
@@ -14742,8 +15096,8 @@ var init_install = __esm({
|
|
|
14742
15096
|
// src/index.ts
|
|
14743
15097
|
init_cjs_shims();
|
|
14744
15098
|
var import_commander29 = require("commander");
|
|
14745
|
-
var
|
|
14746
|
-
var
|
|
15099
|
+
var import_fs18 = require("fs");
|
|
15100
|
+
var import_path21 = require("path");
|
|
14747
15101
|
|
|
14748
15102
|
// src/commands/list.ts
|
|
14749
15103
|
init_cjs_shims();
|
|
@@ -14903,7 +15257,7 @@ var import_commander2 = require("commander");
|
|
|
14903
15257
|
init_lockfile();
|
|
14904
15258
|
init_filesystem();
|
|
14905
15259
|
init_types();
|
|
14906
|
-
var
|
|
15260
|
+
var import_fs8 = require("fs");
|
|
14907
15261
|
init_errors();
|
|
14908
15262
|
init_agents_md_progressive();
|
|
14909
15263
|
var readline = __toESM(require("readline"));
|
|
@@ -15004,7 +15358,7 @@ async function handleUninstall(name, options = {}) {
|
|
|
15004
15358
|
if (pkg.format === "claude" && pkg.subtype === "hook" && pkg.hookMetadata) {
|
|
15005
15359
|
const settingsPath = pkg.installedPath || ".claude/settings.json";
|
|
15006
15360
|
try {
|
|
15007
|
-
const settingsContent = await
|
|
15361
|
+
const settingsContent = await import_fs8.promises.readFile(settingsPath, "utf-8");
|
|
15008
15362
|
const settings = JSON.parse(settingsContent);
|
|
15009
15363
|
if (settings.hooks) {
|
|
15010
15364
|
let removedCount = 0;
|
|
@@ -15021,7 +15375,7 @@ async function handleUninstall(name, options = {}) {
|
|
|
15021
15375
|
}
|
|
15022
15376
|
}
|
|
15023
15377
|
}
|
|
15024
|
-
await
|
|
15378
|
+
await import_fs8.promises.writeFile(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
15025
15379
|
console.log(` \u{1FA9D} Removed ${removedCount} hook(s) from ${settingsPath}`);
|
|
15026
15380
|
}
|
|
15027
15381
|
} catch (error) {
|
|
@@ -15046,12 +15400,12 @@ async function handleUninstall(name, options = {}) {
|
|
|
15046
15400
|
throw new CLIError(`Cannot uninstall ${name}: installation path unknown`, 1);
|
|
15047
15401
|
}
|
|
15048
15402
|
try {
|
|
15049
|
-
const stats = await
|
|
15403
|
+
const stats = await import_fs8.promises.stat(targetPath);
|
|
15050
15404
|
if (stats.isDirectory()) {
|
|
15051
|
-
await
|
|
15405
|
+
await import_fs8.promises.rm(targetPath, { recursive: true, force: true });
|
|
15052
15406
|
console.log(` \u{1F5D1}\uFE0F Deleted directory: ${targetPath}`);
|
|
15053
15407
|
} else if (stats.isFile()) {
|
|
15054
|
-
await
|
|
15408
|
+
await import_fs8.promises.unlink(targetPath);
|
|
15055
15409
|
console.log(` \u{1F5D1}\uFE0F Deleted file: ${targetPath}`);
|
|
15056
15410
|
}
|
|
15057
15411
|
} catch (error) {
|
|
@@ -15080,17 +15434,17 @@ function createUninstallCommand() {
|
|
|
15080
15434
|
// src/commands/index.ts
|
|
15081
15435
|
init_cjs_shims();
|
|
15082
15436
|
var import_commander3 = require("commander");
|
|
15083
|
-
var
|
|
15084
|
-
var
|
|
15437
|
+
var import_fs9 = require("fs");
|
|
15438
|
+
var import_path9 = __toESM(require("path"));
|
|
15085
15439
|
init_lockfile();
|
|
15086
15440
|
init_filesystem();
|
|
15087
15441
|
init_errors();
|
|
15088
15442
|
async function scanDirectory(dirPath, format, subtype) {
|
|
15089
15443
|
try {
|
|
15090
|
-
const files = await
|
|
15444
|
+
const files = await import_fs9.promises.readdir(dirPath, { withFileTypes: true });
|
|
15091
15445
|
const results = [];
|
|
15092
15446
|
for (const file of files) {
|
|
15093
|
-
const fullPath =
|
|
15447
|
+
const fullPath = import_path9.default.join(dirPath, file.name);
|
|
15094
15448
|
if (file.isFile()) {
|
|
15095
15449
|
const id = generateId(file.name);
|
|
15096
15450
|
results.push({
|
|
@@ -15103,11 +15457,11 @@ async function scanDirectory(dirPath, format, subtype) {
|
|
|
15103
15457
|
const isCursorAgent = format === "cursor" && subtype === "agent";
|
|
15104
15458
|
if (isClaudeType || isCursorAgent) {
|
|
15105
15459
|
try {
|
|
15106
|
-
const subFiles = await
|
|
15460
|
+
const subFiles = await import_fs9.promises.readdir(fullPath, { withFileTypes: true });
|
|
15107
15461
|
for (const subFile of subFiles) {
|
|
15108
15462
|
const isValidFile = subFile.isFile() && (subFile.name === "SKILL.md" || subFile.name === "AGENT.md" || subFile.name === "skill.md" || subFile.name === "agent.md");
|
|
15109
15463
|
if (isValidFile) {
|
|
15110
|
-
const subFilePath =
|
|
15464
|
+
const subFilePath = import_path9.default.join(fullPath, subFile.name);
|
|
15111
15465
|
const id = file.name;
|
|
15112
15466
|
results.push({
|
|
15113
15467
|
filePath: subFilePath,
|
|
@@ -15169,7 +15523,7 @@ async function handleIndex(options = {}) {
|
|
|
15169
15523
|
id: file.id,
|
|
15170
15524
|
version: "0.0.0",
|
|
15171
15525
|
// Local files don't have versions
|
|
15172
|
-
tarballUrl: `file://${
|
|
15526
|
+
tarballUrl: `file://${import_path9.default.resolve(file.filePath)}`,
|
|
15173
15527
|
format: dir.format,
|
|
15174
15528
|
subtype: dir.subtype
|
|
15175
15529
|
});
|
|
@@ -15996,8 +16350,8 @@ init_install();
|
|
|
15996
16350
|
init_cjs_shims();
|
|
15997
16351
|
var import_commander13 = require("commander");
|
|
15998
16352
|
var import_promises7 = require("fs/promises");
|
|
15999
|
-
var
|
|
16000
|
-
var
|
|
16353
|
+
var import_path17 = require("path");
|
|
16354
|
+
var import_fs15 = require("fs");
|
|
16001
16355
|
var tar2 = __toESM(require("tar"));
|
|
16002
16356
|
var import_os4 = require("os");
|
|
16003
16357
|
var import_crypto2 = require("crypto");
|
|
@@ -16170,19 +16524,19 @@ function validateMarketplaceJson(data) {
|
|
|
16170
16524
|
init_cjs_shims();
|
|
16171
16525
|
var import_ajv2 = __toESM(require("ajv"));
|
|
16172
16526
|
var import_ajv_formats2 = __toESM(require("ajv-formats"));
|
|
16173
|
-
var
|
|
16174
|
-
var
|
|
16527
|
+
var import_fs10 = require("fs");
|
|
16528
|
+
var import_path11 = require("path");
|
|
16175
16529
|
var schema2;
|
|
16176
16530
|
var schemaCandidates = [
|
|
16177
16531
|
// Source file layout (src/core → ../../schemas)
|
|
16178
|
-
(0,
|
|
16532
|
+
(0, import_path11.join)(__dirname, "../../schemas/prpm-manifest.schema.json"),
|
|
16179
16533
|
// Bundled layout (dist/index.js → ../schemas)
|
|
16180
|
-
(0,
|
|
16534
|
+
(0, import_path11.join)(__dirname, "../schemas/prpm-manifest.schema.json")
|
|
16181
16535
|
];
|
|
16182
16536
|
for (const candidate of schemaCandidates) {
|
|
16183
16537
|
try {
|
|
16184
|
-
if ((0,
|
|
16185
|
-
schema2 = JSON.parse((0,
|
|
16538
|
+
if ((0, import_fs10.existsSync)(candidate)) {
|
|
16539
|
+
schema2 = JSON.parse((0, import_fs10.readFileSync)(candidate, "utf-8"));
|
|
16186
16540
|
break;
|
|
16187
16541
|
}
|
|
16188
16542
|
} catch {
|
|
@@ -16237,8 +16591,8 @@ function getManifestSchema() {
|
|
|
16237
16591
|
// src/utils/license-extractor.ts
|
|
16238
16592
|
init_cjs_shims();
|
|
16239
16593
|
var import_promises3 = require("fs/promises");
|
|
16240
|
-
var
|
|
16241
|
-
var
|
|
16594
|
+
var import_path12 = require("path");
|
|
16595
|
+
var import_fs11 = require("fs");
|
|
16242
16596
|
var LICENSE_FILE_PATTERNS = [
|
|
16243
16597
|
"LICENSE",
|
|
16244
16598
|
"LICENSE.md",
|
|
@@ -16287,9 +16641,9 @@ function generateLicenseUrl(repositoryUrl, fileName) {
|
|
|
16287
16641
|
async function extractLicenseInfo(repositoryUrl) {
|
|
16288
16642
|
const cwd = process.cwd();
|
|
16289
16643
|
for (const fileName of LICENSE_FILE_PATTERNS) {
|
|
16290
|
-
const filePath = (0,
|
|
16644
|
+
const filePath = (0, import_path12.join)(cwd, fileName);
|
|
16291
16645
|
try {
|
|
16292
|
-
await (0, import_promises3.access)(filePath,
|
|
16646
|
+
await (0, import_promises3.access)(filePath, import_fs11.constants.R_OK);
|
|
16293
16647
|
const text = await (0, import_promises3.readFile)(filePath, "utf-8");
|
|
16294
16648
|
const type2 = detectLicenseType(text);
|
|
16295
16649
|
const url = generateLicenseUrl(repositoryUrl, fileName);
|
|
@@ -16323,7 +16677,7 @@ function validateLicenseInfo(licenseInfo, packageName) {
|
|
|
16323
16677
|
// src/utils/snippet-extractor.ts
|
|
16324
16678
|
init_cjs_shims();
|
|
16325
16679
|
var import_promises4 = require("fs/promises");
|
|
16326
|
-
var
|
|
16680
|
+
var import_path13 = require("path");
|
|
16327
16681
|
var MAX_SNIPPET_LENGTH = 2e3;
|
|
16328
16682
|
async function extractSnippet(manifest) {
|
|
16329
16683
|
const cwd = process.cwd();
|
|
@@ -16339,7 +16693,7 @@ async function extractSnippet(manifest) {
|
|
|
16339
16693
|
const firstFile = manifest.files[0];
|
|
16340
16694
|
fileName = typeof firstFile === "string" ? firstFile : firstFile.path;
|
|
16341
16695
|
}
|
|
16342
|
-
const fullPath = (0,
|
|
16696
|
+
const fullPath = (0, import_path13.join)(cwd, fileName);
|
|
16343
16697
|
const stats = await (0, import_promises4.stat)(fullPath);
|
|
16344
16698
|
if (stats.isDirectory()) {
|
|
16345
16699
|
console.warn(`\u26A0\uFE0F Skipping snippet extraction: "${fullPath}" is a directory`);
|
|
@@ -16601,8 +16955,8 @@ async function validatePackageFiles(manifest) {
|
|
|
16601
16955
|
init_cjs_shims();
|
|
16602
16956
|
var import_commander12 = require("commander");
|
|
16603
16957
|
var import_promises6 = require("fs/promises");
|
|
16604
|
-
var
|
|
16605
|
-
var
|
|
16958
|
+
var import_path16 = require("path");
|
|
16959
|
+
var import_fs14 = require("fs");
|
|
16606
16960
|
var readline4 = __toESM(require("readline/promises"));
|
|
16607
16961
|
var import_process = require("process");
|
|
16608
16962
|
init_types();
|
|
@@ -16610,8 +16964,8 @@ init_errors();
|
|
|
16610
16964
|
|
|
16611
16965
|
// src/core/package-scanner.ts
|
|
16612
16966
|
init_cjs_shims();
|
|
16613
|
-
var
|
|
16614
|
-
var
|
|
16967
|
+
var import_fs12 = require("fs");
|
|
16968
|
+
var import_path14 = __toESM(require("path"));
|
|
16615
16969
|
init_dist();
|
|
16616
16970
|
function buildScanConfigs() {
|
|
16617
16971
|
const configs = [];
|
|
@@ -16637,7 +16991,7 @@ function buildScanConfigs() {
|
|
|
16637
16991
|
var SCAN_CONFIGS = buildScanConfigs();
|
|
16638
16992
|
async function extractMetadata2(filePath) {
|
|
16639
16993
|
try {
|
|
16640
|
-
const content = await
|
|
16994
|
+
const content = await import_fs12.promises.readFile(filePath, "utf-8");
|
|
16641
16995
|
const metadata = {};
|
|
16642
16996
|
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
16643
16997
|
if (frontmatterMatch) {
|
|
@@ -16690,7 +17044,7 @@ function matchesPattern(filename, patterns) {
|
|
|
16690
17044
|
}
|
|
16691
17045
|
async function directoryExists2(dirPath) {
|
|
16692
17046
|
try {
|
|
16693
|
-
const stats = await
|
|
17047
|
+
const stats = await import_fs12.promises.stat(dirPath);
|
|
16694
17048
|
return stats.isDirectory();
|
|
16695
17049
|
} catch {
|
|
16696
17050
|
return false;
|
|
@@ -16698,7 +17052,7 @@ async function directoryExists2(dirPath) {
|
|
|
16698
17052
|
}
|
|
16699
17053
|
async function fileExists2(filePath) {
|
|
16700
17054
|
try {
|
|
16701
|
-
await
|
|
17055
|
+
await import_fs12.promises.access(filePath);
|
|
16702
17056
|
return true;
|
|
16703
17057
|
} catch {
|
|
16704
17058
|
return false;
|
|
@@ -16706,21 +17060,21 @@ async function fileExists2(filePath) {
|
|
|
16706
17060
|
}
|
|
16707
17061
|
async function scanDirectory2(config, cwd) {
|
|
16708
17062
|
const packages = [];
|
|
16709
|
-
const fullDir =
|
|
17063
|
+
const fullDir = import_path14.default.join(cwd, config.directory);
|
|
16710
17064
|
if (!await directoryExists2(fullDir)) {
|
|
16711
17065
|
return packages;
|
|
16712
17066
|
}
|
|
16713
|
-
const entries = await
|
|
17067
|
+
const entries = await import_fs12.promises.readdir(fullDir, { withFileTypes: true });
|
|
16714
17068
|
if (config.nested) {
|
|
16715
17069
|
for (const entry of entries) {
|
|
16716
17070
|
if (!entry.isDirectory()) continue;
|
|
16717
|
-
const packageDir =
|
|
17071
|
+
const packageDir = import_path14.default.join(fullDir, entry.name);
|
|
16718
17072
|
if (config.nestedIndicator) {
|
|
16719
|
-
const indicatorPath =
|
|
17073
|
+
const indicatorPath = import_path14.default.join(packageDir, config.nestedIndicator);
|
|
16720
17074
|
if (!await fileExists2(indicatorPath)) continue;
|
|
16721
17075
|
const packageFiles = await collectPackageFiles(packageDir, config.directory, entry.name);
|
|
16722
17076
|
const metadata = await extractMetadata2(indicatorPath);
|
|
16723
|
-
const relativePath =
|
|
17077
|
+
const relativePath = import_path14.default.join(config.directory, entry.name, config.nestedIndicator);
|
|
16724
17078
|
packages.push({
|
|
16725
17079
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
16726
17080
|
format: config.format,
|
|
@@ -16731,12 +17085,12 @@ async function scanDirectory2(config, cwd) {
|
|
|
16731
17085
|
primaryFile: relativePath
|
|
16732
17086
|
});
|
|
16733
17087
|
} else {
|
|
16734
|
-
const subEntries = await
|
|
17088
|
+
const subEntries = await import_fs12.promises.readdir(packageDir, { withFileTypes: true });
|
|
16735
17089
|
for (const subEntry of subEntries) {
|
|
16736
17090
|
if (!subEntry.isFile()) continue;
|
|
16737
17091
|
if (!matchesPattern(subEntry.name, config.patterns)) continue;
|
|
16738
|
-
const filePath =
|
|
16739
|
-
const relativePath =
|
|
17092
|
+
const filePath = import_path14.default.join(packageDir, subEntry.name);
|
|
17093
|
+
const relativePath = import_path14.default.join(config.directory, entry.name, subEntry.name);
|
|
16740
17094
|
const metadata = await extractMetadata2(filePath);
|
|
16741
17095
|
packages.push({
|
|
16742
17096
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -16754,8 +17108,8 @@ async function scanDirectory2(config, cwd) {
|
|
|
16754
17108
|
for (const entry of entries) {
|
|
16755
17109
|
if (!entry.isFile()) continue;
|
|
16756
17110
|
if (!matchesPattern(entry.name, config.patterns)) continue;
|
|
16757
|
-
const filePath =
|
|
16758
|
-
const relativePath =
|
|
17111
|
+
const filePath = import_path14.default.join(fullDir, entry.name);
|
|
17112
|
+
const relativePath = import_path14.default.join(config.directory, entry.name);
|
|
16759
17113
|
const metadata = await extractMetadata2(filePath);
|
|
16760
17114
|
packages.push({
|
|
16761
17115
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -16773,24 +17127,24 @@ async function scanDirectory2(config, cwd) {
|
|
|
16773
17127
|
async function collectPackageFiles(packageDir, baseDir, packageName) {
|
|
16774
17128
|
const files = [];
|
|
16775
17129
|
async function walkDir(dir, relativeBase) {
|
|
16776
|
-
const entries = await
|
|
17130
|
+
const entries = await import_fs12.promises.readdir(dir, { withFileTypes: true });
|
|
16777
17131
|
for (const entry of entries) {
|
|
16778
|
-
const fullPath =
|
|
16779
|
-
const relativePath =
|
|
17132
|
+
const fullPath = import_path14.default.join(dir, entry.name);
|
|
17133
|
+
const relativePath = import_path14.default.join(relativeBase, entry.name);
|
|
16780
17134
|
if (entry.isDirectory()) {
|
|
16781
17135
|
if (["node_modules", "dist", ".git", "coverage"].includes(entry.name)) {
|
|
16782
17136
|
continue;
|
|
16783
17137
|
}
|
|
16784
17138
|
await walkDir(fullPath, relativePath);
|
|
16785
17139
|
} else if (entry.isFile()) {
|
|
16786
|
-
const ext =
|
|
17140
|
+
const ext = import_path14.default.extname(entry.name).toLowerCase();
|
|
16787
17141
|
if ([".md", ".json", ".js", ".ts", ".toml"].includes(ext)) {
|
|
16788
17142
|
files.push(relativePath);
|
|
16789
17143
|
}
|
|
16790
17144
|
}
|
|
16791
17145
|
}
|
|
16792
17146
|
}
|
|
16793
|
-
await walkDir(packageDir,
|
|
17147
|
+
await walkDir(packageDir, import_path14.default.join(baseDir, packageName));
|
|
16794
17148
|
return files;
|
|
16795
17149
|
}
|
|
16796
17150
|
function buildRootManifestFiles() {
|
|
@@ -16813,7 +17167,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16813
17167
|
allPackages.push(...packages);
|
|
16814
17168
|
}
|
|
16815
17169
|
for (const { file, format } of ROOT_MANIFEST_FILES) {
|
|
16816
|
-
const filePath =
|
|
17170
|
+
const filePath = import_path14.default.join(cwd, file);
|
|
16817
17171
|
if (await fileExists2(filePath)) {
|
|
16818
17172
|
const metadata = await extractMetadata2(filePath);
|
|
16819
17173
|
allPackages.push({
|
|
@@ -16827,7 +17181,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16827
17181
|
});
|
|
16828
17182
|
}
|
|
16829
17183
|
}
|
|
16830
|
-
const copilotInstructionsPath =
|
|
17184
|
+
const copilotInstructionsPath = import_path14.default.join(cwd, ".github/copilot-instructions.md");
|
|
16831
17185
|
if (await fileExists2(copilotInstructionsPath)) {
|
|
16832
17186
|
const metadata = await extractMetadata2(copilotInstructionsPath);
|
|
16833
17187
|
allPackages.push({
|
|
@@ -16845,12 +17199,12 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16845
17199
|
|
|
16846
17200
|
// src/core/package-reconciler.ts
|
|
16847
17201
|
init_cjs_shims();
|
|
16848
|
-
var
|
|
16849
|
-
var
|
|
17202
|
+
var import_fs13 = require("fs");
|
|
17203
|
+
var import_path15 = __toESM(require("path"));
|
|
16850
17204
|
async function readManifest(cwd = process.cwd()) {
|
|
16851
17205
|
try {
|
|
16852
|
-
const manifestPath =
|
|
16853
|
-
const content = await
|
|
17206
|
+
const manifestPath = import_path15.default.join(cwd, "prpm.json");
|
|
17207
|
+
const content = await import_fs13.promises.readFile(manifestPath, "utf-8");
|
|
16854
17208
|
const raw = JSON.parse(content);
|
|
16855
17209
|
if ("packages" in raw && Array.isArray(raw.packages)) {
|
|
16856
17210
|
return {
|
|
@@ -16876,7 +17230,7 @@ async function readManifest(cwd = process.cwd()) {
|
|
|
16876
17230
|
}
|
|
16877
17231
|
async function fileExists3(filePath) {
|
|
16878
17232
|
try {
|
|
16879
|
-
await
|
|
17233
|
+
await import_fs13.promises.access(filePath);
|
|
16880
17234
|
return true;
|
|
16881
17235
|
} catch {
|
|
16882
17236
|
return false;
|
|
@@ -16932,7 +17286,7 @@ async function reconcilePackages(detected, manifest, cwd = process.cwd()) {
|
|
|
16932
17286
|
const manifestPkg = manifest[mi];
|
|
16933
17287
|
let anyFileExists = false;
|
|
16934
17288
|
for (const file of manifestPkg.files) {
|
|
16935
|
-
const fullPath =
|
|
17289
|
+
const fullPath = import_path15.default.join(cwd, file);
|
|
16936
17290
|
if (await fileExists3(fullPath)) {
|
|
16937
17291
|
anyFileExists = true;
|
|
16938
17292
|
break;
|
|
@@ -17001,7 +17355,7 @@ function createManifestFromDetected(packages, defaults) {
|
|
|
17001
17355
|
files: pkg.files
|
|
17002
17356
|
};
|
|
17003
17357
|
}
|
|
17004
|
-
const projectName =
|
|
17358
|
+
const projectName = import_path15.default.basename(process.cwd()).toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
17005
17359
|
return {
|
|
17006
17360
|
name: `${projectName}-packages`,
|
|
17007
17361
|
version: "1.0.0",
|
|
@@ -17380,12 +17734,12 @@ function getDefaultAuthor() {
|
|
|
17380
17734
|
async function createExampleFiles(format, files, packageName) {
|
|
17381
17735
|
const templates = EXAMPLE_TEMPLATES[format] || {};
|
|
17382
17736
|
for (const file of files) {
|
|
17383
|
-
const filePath = (0,
|
|
17384
|
-
const dirPath = (0,
|
|
17385
|
-
if (!(0,
|
|
17737
|
+
const filePath = (0, import_path16.join)(process.cwd(), file);
|
|
17738
|
+
const dirPath = (0, import_path16.join)(filePath, "..");
|
|
17739
|
+
if (!(0, import_fs14.existsSync)(dirPath)) {
|
|
17386
17740
|
await (0, import_promises6.mkdir)(dirPath, { recursive: true });
|
|
17387
17741
|
}
|
|
17388
|
-
if ((0,
|
|
17742
|
+
if ((0, import_fs14.existsSync)(filePath)) {
|
|
17389
17743
|
console.log(` Skipping ${file} (already exists)`);
|
|
17390
17744
|
continue;
|
|
17391
17745
|
}
|
|
@@ -17399,8 +17753,8 @@ Add your content here.
|
|
|
17399
17753
|
}
|
|
17400
17754
|
}
|
|
17401
17755
|
async function createReadme(config) {
|
|
17402
|
-
const readmePath = (0,
|
|
17403
|
-
if ((0,
|
|
17756
|
+
const readmePath = (0, import_path16.join)(process.cwd(), "README.md");
|
|
17757
|
+
if ((0, import_fs14.existsSync)(readmePath)) {
|
|
17404
17758
|
console.log(" Skipping README.md (already exists)");
|
|
17405
17759
|
return;
|
|
17406
17760
|
}
|
|
@@ -17503,8 +17857,8 @@ async function reviewMissingPackage(rl, pkg, index, total) {
|
|
|
17503
17857
|
return await confirm(rl, "\n Remove from prpm.json?", true);
|
|
17504
17858
|
}
|
|
17505
17859
|
async function smartInit(options) {
|
|
17506
|
-
const manifestPath = (0,
|
|
17507
|
-
const hasManifest = (0,
|
|
17860
|
+
const manifestPath = (0, import_path16.join)(process.cwd(), "prpm.json");
|
|
17861
|
+
const hasManifest = (0, import_fs14.existsSync)(manifestPath);
|
|
17508
17862
|
console.log("\nScanning for packages...\n");
|
|
17509
17863
|
const detected = await scanForPackages();
|
|
17510
17864
|
const existingManifest = hasManifest ? await readManifest() : null;
|
|
@@ -17636,8 +17990,8 @@ Create multi-package prpm.json with these ${detected.length} packages?` : "\nCre
|
|
|
17636
17990
|
}
|
|
17637
17991
|
}
|
|
17638
17992
|
async function classicInit(options) {
|
|
17639
|
-
const manifestPath = (0,
|
|
17640
|
-
if ((0,
|
|
17993
|
+
const manifestPath = (0, import_path16.join)(process.cwd(), "prpm.json");
|
|
17994
|
+
if ((0, import_fs14.existsSync)(manifestPath) && !options.force) {
|
|
17641
17995
|
throw new Error(
|
|
17642
17996
|
"prpm.json already exists. Use --force to overwrite, or run this command in a different directory."
|
|
17643
17997
|
);
|
|
@@ -17833,7 +18187,7 @@ function createInitCommand() {
|
|
|
17833
18187
|
|
|
17834
18188
|
// src/commands/publish.ts
|
|
17835
18189
|
async function findAndLoadManifests() {
|
|
17836
|
-
const prpmJsonPath = (0,
|
|
18190
|
+
const prpmJsonPath = (0, import_path17.join)(process.cwd(), "prpm.json");
|
|
17837
18191
|
let prpmJsonExists = false;
|
|
17838
18192
|
let prpmJsonError = null;
|
|
17839
18193
|
try {
|
|
@@ -17885,7 +18239,7 @@ async function findAndLoadManifests() {
|
|
|
17885
18239
|
throw error;
|
|
17886
18240
|
}
|
|
17887
18241
|
}
|
|
17888
|
-
const marketplaceJsonPath = (0,
|
|
18242
|
+
const marketplaceJsonPath = (0, import_path17.join)(process.cwd(), ".claude", "marketplace.json");
|
|
17889
18243
|
try {
|
|
17890
18244
|
const content = await (0, import_promises7.readFile)(marketplaceJsonPath, "utf-8");
|
|
17891
18245
|
const marketplaceData = JSON.parse(content);
|
|
@@ -17901,7 +18255,7 @@ async function findAndLoadManifests() {
|
|
|
17901
18255
|
return { manifests, collections: [], source: ".claude/marketplace.json" };
|
|
17902
18256
|
} catch (error) {
|
|
17903
18257
|
}
|
|
17904
|
-
const marketplaceJsonPluginPath = (0,
|
|
18258
|
+
const marketplaceJsonPluginPath = (0, import_path17.join)(process.cwd(), ".claude-plugin", "marketplace.json");
|
|
17905
18259
|
try {
|
|
17906
18260
|
const content = await (0, import_promises7.readFile)(marketplaceJsonPluginPath, "utf-8");
|
|
17907
18261
|
const marketplaceData = JSON.parse(content);
|
|
@@ -18034,8 +18388,8 @@ function getSafePackageName(manifest, userInfo, fallbackName) {
|
|
|
18034
18388
|
return manifest.name;
|
|
18035
18389
|
}
|
|
18036
18390
|
async function createTarball(manifest) {
|
|
18037
|
-
const tmpDir = (0,
|
|
18038
|
-
const tarballPath = (0,
|
|
18391
|
+
const tmpDir = (0, import_path17.join)((0, import_os4.tmpdir)(), `prpm-${(0, import_crypto2.randomBytes)(8).toString("hex")}`);
|
|
18392
|
+
const tarballPath = (0, import_path17.join)(tmpDir, "package.tar.gz");
|
|
18039
18393
|
try {
|
|
18040
18394
|
await (0, import_promises7.mkdir)(tmpDir, { recursive: true });
|
|
18041
18395
|
const filePaths = normalizeFilePaths2(manifest.files);
|
|
@@ -18092,14 +18446,14 @@ async function handlePublish(options) {
|
|
|
18092
18446
|
throw new CLIError('\u274C Not logged in. Run "prpm login" first.', 1);
|
|
18093
18447
|
}
|
|
18094
18448
|
console.log("\u{1F4E6} Publishing package...\n");
|
|
18095
|
-
const prpmJsonPath = (0,
|
|
18096
|
-
const marketplaceJsonPath = (0,
|
|
18097
|
-
const marketplaceJsonPluginPath = (0,
|
|
18098
|
-
const hasManifest = (0,
|
|
18449
|
+
const prpmJsonPath = (0, import_path17.join)(process.cwd(), "prpm.json");
|
|
18450
|
+
const marketplaceJsonPath = (0, import_path17.join)(process.cwd(), ".claude", "marketplace.json");
|
|
18451
|
+
const marketplaceJsonPluginPath = (0, import_path17.join)(process.cwd(), ".claude-plugin", "marketplace.json");
|
|
18452
|
+
const hasManifest = (0, import_fs15.existsSync)(prpmJsonPath) || (0, import_fs15.existsSync)(marketplaceJsonPath) || (0, import_fs15.existsSync)(marketplaceJsonPluginPath);
|
|
18099
18453
|
if (!hasManifest) {
|
|
18100
18454
|
console.log("No prpm.json found. Let's create one first.\n");
|
|
18101
18455
|
await smartInit({});
|
|
18102
|
-
if (!(0,
|
|
18456
|
+
if (!(0, import_fs15.existsSync)(prpmJsonPath)) {
|
|
18103
18457
|
throw new CLIError("No prpm.json was created. Cannot publish without a manifest.", 1);
|
|
18104
18458
|
}
|
|
18105
18459
|
console.log("\n\u{1F4E6} Continuing with publish...\n");
|
|
@@ -18108,7 +18462,7 @@ async function handlePublish(options) {
|
|
|
18108
18462
|
const { manifests, collections, source } = await findAndLoadManifests();
|
|
18109
18463
|
if (source === "prpm.json (multi-package)" || source === "prpm.json") {
|
|
18110
18464
|
try {
|
|
18111
|
-
const prpmJsonPath2 = (0,
|
|
18465
|
+
const prpmJsonPath2 = (0, import_path17.join)(process.cwd(), "prpm.json");
|
|
18112
18466
|
const prpmContent = await (0, import_promises7.readFile)(prpmJsonPath2, "utf-8");
|
|
18113
18467
|
const prpmManifest = JSON.parse(prpmContent);
|
|
18114
18468
|
if (prpmManifest.scripts) {
|
|
@@ -19286,15 +19640,15 @@ function createConfigCommand() {
|
|
|
19286
19640
|
init_cjs_shims();
|
|
19287
19641
|
var import_commander21 = require("commander");
|
|
19288
19642
|
var import_promises8 = require("fs/promises");
|
|
19289
|
-
var
|
|
19643
|
+
var import_path18 = require("path");
|
|
19290
19644
|
init_telemetry();
|
|
19291
19645
|
init_lockfile();
|
|
19292
19646
|
init_errors();
|
|
19293
19647
|
function detectPackageInfo(filePath, content) {
|
|
19294
|
-
const fileName = (0,
|
|
19648
|
+
const fileName = (0, import_path18.basename)(filePath);
|
|
19295
19649
|
const lowerFileName = fileName.toLowerCase();
|
|
19296
19650
|
if (fileName === "SKILL.md") {
|
|
19297
|
-
const dirName = (0,
|
|
19651
|
+
const dirName = (0, import_path18.basename)((0, import_path18.join)(filePath, ".."));
|
|
19298
19652
|
return {
|
|
19299
19653
|
format: "claude",
|
|
19300
19654
|
subtype: "skill",
|
|
@@ -19346,8 +19700,8 @@ async function scanDirectory3(dirPath, baseDir, scanDir, maxDepth = 5, currentDe
|
|
|
19346
19700
|
try {
|
|
19347
19701
|
const entries = await (0, import_promises8.readdir)(dirPath, { withFileTypes: true });
|
|
19348
19702
|
for (const entry of entries) {
|
|
19349
|
-
const fullPath = (0,
|
|
19350
|
-
const relativePath = (0,
|
|
19703
|
+
const fullPath = (0, import_path18.join)(dirPath, entry.name);
|
|
19704
|
+
const relativePath = (0, import_path18.relative)(baseDir, fullPath);
|
|
19351
19705
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist" || entry.name === "build") {
|
|
19352
19706
|
continue;
|
|
19353
19707
|
}
|
|
@@ -19484,7 +19838,7 @@ async function handleCatalog(directories, options) {
|
|
|
19484
19838
|
success = true;
|
|
19485
19839
|
return;
|
|
19486
19840
|
}
|
|
19487
|
-
const prpmJsonPath = options.output || (0,
|
|
19841
|
+
const prpmJsonPath = options.output || (0, import_path18.join)(process.cwd(), "prpm.json");
|
|
19488
19842
|
let manifest;
|
|
19489
19843
|
if (options.append) {
|
|
19490
19844
|
try {
|
|
@@ -19522,7 +19876,7 @@ async function handleCatalog(directories, options) {
|
|
|
19522
19876
|
}
|
|
19523
19877
|
let description = `${discovered.format} ${discovered.subtype}`;
|
|
19524
19878
|
try {
|
|
19525
|
-
const firstFilePath = (0,
|
|
19879
|
+
const firstFilePath = (0, import_path18.join)(process.cwd(), discovered.scanDir, discovered.files[0]);
|
|
19526
19880
|
const content = await (0, import_promises8.readFile)(firstFilePath, "utf-8");
|
|
19527
19881
|
const extractedDesc = extractDescription6(content);
|
|
19528
19882
|
if (extractedDesc) {
|
|
@@ -20773,57 +21127,57 @@ function createStarredCommand() {
|
|
|
20773
21127
|
init_cjs_shims();
|
|
20774
21128
|
var import_commander27 = require("commander");
|
|
20775
21129
|
var import_promises9 = require("fs/promises");
|
|
20776
|
-
var
|
|
20777
|
-
var
|
|
21130
|
+
var import_path19 = require("path");
|
|
21131
|
+
var import_fs16 = require("fs");
|
|
20778
21132
|
var import_readline = require("readline");
|
|
20779
21133
|
var import_chalk2 = __toESM(require_source());
|
|
20780
21134
|
init_errors();
|
|
20781
21135
|
init_dist();
|
|
20782
21136
|
function getDefaultPath(format, filename, subtype, customName) {
|
|
20783
|
-
const baseName = customName || (0,
|
|
21137
|
+
const baseName = customName || (0, import_path19.basename)(filename, (0, import_path19.extname)(filename));
|
|
20784
21138
|
switch (format) {
|
|
20785
21139
|
case "cursor":
|
|
20786
21140
|
if (subtype === "slash-command") {
|
|
20787
|
-
return (0,
|
|
21141
|
+
return (0, import_path19.join)(process.cwd(), ".cursor", "commands", `${baseName}.md`);
|
|
20788
21142
|
}
|
|
20789
|
-
return (0,
|
|
21143
|
+
return (0, import_path19.join)(process.cwd(), ".cursor", "rules", `${baseName}.mdc`);
|
|
20790
21144
|
case "claude":
|
|
20791
21145
|
if (subtype === "skill") {
|
|
20792
|
-
return (0,
|
|
21146
|
+
return (0, import_path19.join)(process.cwd(), ".claude", "skills", baseName, "SKILL.md");
|
|
20793
21147
|
} else if (subtype === "slash-command") {
|
|
20794
|
-
return (0,
|
|
21148
|
+
return (0, import_path19.join)(process.cwd(), ".claude", "commands", `${baseName}.md`);
|
|
20795
21149
|
} else {
|
|
20796
|
-
return (0,
|
|
21150
|
+
return (0, import_path19.join)(process.cwd(), ".claude", "agents", `${baseName}.md`);
|
|
20797
21151
|
}
|
|
20798
21152
|
case "windsurf":
|
|
20799
|
-
return (0,
|
|
21153
|
+
return (0, import_path19.join)(process.cwd(), ".windsurf", "rules", `${baseName}.md`);
|
|
20800
21154
|
case "kiro":
|
|
20801
21155
|
if (subtype === "hook") {
|
|
20802
|
-
return (0,
|
|
21156
|
+
return (0, import_path19.join)(process.cwd(), ".kiro", "hooks", `${baseName}.kiro.hook`);
|
|
20803
21157
|
}
|
|
20804
21158
|
if (subtype === "agent") {
|
|
20805
|
-
return (0,
|
|
21159
|
+
return (0, import_path19.join)(process.cwd(), ".kiro", "agents", `${baseName}.json`);
|
|
20806
21160
|
}
|
|
20807
|
-
return (0,
|
|
21161
|
+
return (0, import_path19.join)(process.cwd(), ".kiro", "steering", `${baseName}.md`);
|
|
20808
21162
|
case "copilot":
|
|
20809
|
-
return (0,
|
|
21163
|
+
return (0, import_path19.join)(process.cwd(), ".github", "instructions", `${baseName}.instructions.md`);
|
|
20810
21164
|
case "continue":
|
|
20811
21165
|
if (subtype === "slash-command" || subtype === "prompt") {
|
|
20812
|
-
return (0,
|
|
21166
|
+
return (0, import_path19.join)(process.cwd(), ".continue", "prompts", `${baseName}.md`);
|
|
20813
21167
|
}
|
|
20814
|
-
return (0,
|
|
21168
|
+
return (0, import_path19.join)(process.cwd(), ".continue", "rules", `${baseName}.md`);
|
|
20815
21169
|
case "agents.md":
|
|
20816
|
-
return (0,
|
|
21170
|
+
return (0, import_path19.join)(process.cwd(), "agents.md");
|
|
20817
21171
|
case "gemini":
|
|
20818
|
-
return (0,
|
|
21172
|
+
return (0, import_path19.join)(process.cwd(), ".gemini", "commands", `${baseName}.toml`);
|
|
20819
21173
|
case "ruler":
|
|
20820
|
-
return (0,
|
|
21174
|
+
return (0, import_path19.join)(process.cwd(), ".ruler", `${baseName}.md`);
|
|
20821
21175
|
default:
|
|
20822
21176
|
throw new CLIError(`Unknown format: ${format}`);
|
|
20823
21177
|
}
|
|
20824
21178
|
}
|
|
20825
21179
|
function detectFormat(content, filepath) {
|
|
20826
|
-
const ext = (0,
|
|
21180
|
+
const ext = (0, import_path19.extname)(filepath).toLowerCase();
|
|
20827
21181
|
if (ext === ".mdc" || filepath.includes(".cursor/rules") || filepath.includes(".cursor/commands")) {
|
|
20828
21182
|
return "cursor";
|
|
20829
21183
|
}
|
|
@@ -20845,7 +21199,7 @@ function detectFormat(content, filepath) {
|
|
|
20845
21199
|
if (filepath.includes(".continue/rules") || filepath.includes(".continue/prompts") || filepath.includes(".continuerules")) {
|
|
20846
21200
|
return "continue";
|
|
20847
21201
|
}
|
|
20848
|
-
if ((0,
|
|
21202
|
+
if ((0, import_path19.basename)(filepath) === "agents.md") {
|
|
20849
21203
|
return "agents.md";
|
|
20850
21204
|
}
|
|
20851
21205
|
if (ext === ".toml" || filepath.includes(".gemini/commands")) {
|
|
@@ -21003,14 +21357,14 @@ async function handleConvert(sourcePath, options) {
|
|
|
21003
21357
|
}
|
|
21004
21358
|
console.log(import_chalk2.default.green(`\u2713 Converted from ${sourceFormat} to ${options.to}`));
|
|
21005
21359
|
const outputPath = options.output || getDefaultPath(options.to, sourcePath, options.subtype, options.name);
|
|
21006
|
-
if ((0,
|
|
21360
|
+
if ((0, import_fs16.existsSync)(outputPath) && !options.yes) {
|
|
21007
21361
|
const shouldOverwrite = await confirmOverwrite(outputPath);
|
|
21008
21362
|
if (!shouldOverwrite) {
|
|
21009
21363
|
console.log(import_chalk2.default.yellow("\n\u2716 Conversion cancelled"));
|
|
21010
21364
|
return;
|
|
21011
21365
|
}
|
|
21012
21366
|
}
|
|
21013
|
-
const outputDir = (0,
|
|
21367
|
+
const outputDir = (0, import_path19.dirname)(outputPath);
|
|
21014
21368
|
await (0, import_promises9.mkdir)(outputDir, { recursive: true });
|
|
21015
21369
|
console.log(import_chalk2.default.dim("Writing converted file..."));
|
|
21016
21370
|
await (0, import_promises9.writeFile)(outputPath, result.content, "utf-8");
|
|
@@ -21076,8 +21430,8 @@ Valid subtypes: ${validSubtypes.join(", ")}`
|
|
|
21076
21430
|
// src/commands/export.ts
|
|
21077
21431
|
init_cjs_shims();
|
|
21078
21432
|
var import_commander28 = require("commander");
|
|
21079
|
-
var
|
|
21080
|
-
var
|
|
21433
|
+
var import_fs17 = require("fs");
|
|
21434
|
+
var import_path20 = require("path");
|
|
21081
21435
|
var import_chalk3 = __toESM(require_source());
|
|
21082
21436
|
init_errors();
|
|
21083
21437
|
init_lockfile();
|
|
@@ -21093,17 +21447,17 @@ async function exportToRuler(options) {
|
|
|
21093
21447
|
}
|
|
21094
21448
|
console.log(import_chalk3.default.green(`\u2713 Found ${packages.length} installed package${packages.length === 1 ? "" : "s"}`));
|
|
21095
21449
|
console.log();
|
|
21096
|
-
const outputDir = options.output || (0,
|
|
21450
|
+
const outputDir = options.output || (0, import_path20.join)(process.cwd(), ".ruler");
|
|
21097
21451
|
let rulerExists = false;
|
|
21098
21452
|
try {
|
|
21099
|
-
await
|
|
21453
|
+
await import_fs17.promises.access(outputDir);
|
|
21100
21454
|
rulerExists = true;
|
|
21101
21455
|
} catch {
|
|
21102
21456
|
}
|
|
21103
21457
|
if (!rulerExists) {
|
|
21104
21458
|
console.log(import_chalk3.default.yellow(`\u26A0 ${outputDir} directory not found`));
|
|
21105
21459
|
console.log(import_chalk3.default.dim("Creating .ruler directory..."));
|
|
21106
|
-
await
|
|
21460
|
+
await import_fs17.promises.mkdir(outputDir, { recursive: true });
|
|
21107
21461
|
console.log(import_chalk3.default.green(`\u2713 Created ${outputDir}/`));
|
|
21108
21462
|
console.log();
|
|
21109
21463
|
}
|
|
@@ -21117,11 +21471,11 @@ async function exportToRuler(options) {
|
|
|
21117
21471
|
continue;
|
|
21118
21472
|
}
|
|
21119
21473
|
try {
|
|
21120
|
-
const content = await
|
|
21474
|
+
const content = await import_fs17.promises.readFile(pkg.installedPath, "utf-8");
|
|
21121
21475
|
const rulerContent = createRulerFormat(pkg.id, pkg.version, content, pkg.format, pkg.subtype);
|
|
21122
21476
|
const rulerFilename = `${packageName}.md`;
|
|
21123
|
-
const rulerPath = (0,
|
|
21124
|
-
await
|
|
21477
|
+
const rulerPath = (0, import_path20.join)(outputDir, rulerFilename);
|
|
21478
|
+
await import_fs17.promises.writeFile(rulerPath, rulerContent, "utf-8");
|
|
21125
21479
|
console.log(import_chalk3.default.green(`\u2713 Exported ${pkg.id} \u2192 ${rulerFilename}`));
|
|
21126
21480
|
exportedCount++;
|
|
21127
21481
|
} catch (error) {
|
|
@@ -21160,9 +21514,9 @@ function createRulerFormat(packageId, version, content, format, subtype) {
|
|
|
21160
21514
|
return frontmatter + contentWithoutFrontmatter;
|
|
21161
21515
|
}
|
|
21162
21516
|
async function ensureRulerConfig(rulerDir) {
|
|
21163
|
-
const configPath = (0,
|
|
21517
|
+
const configPath = (0, import_path20.join)((0, import_path20.dirname)(rulerDir), "ruler.toml");
|
|
21164
21518
|
try {
|
|
21165
|
-
await
|
|
21519
|
+
await import_fs17.promises.access(configPath);
|
|
21166
21520
|
console.log(import_chalk3.default.dim("\u2139 ruler.toml already exists (not modified)"));
|
|
21167
21521
|
} catch {
|
|
21168
21522
|
const basicConfig = `# Ruler Configuration
|
|
@@ -21188,7 +21542,7 @@ async function ensureRulerConfig(rulerDir) {
|
|
|
21188
21542
|
# [agents.github-copilot]
|
|
21189
21543
|
# enabled = false
|
|
21190
21544
|
`;
|
|
21191
|
-
await
|
|
21545
|
+
await import_fs17.promises.writeFile(configPath, basicConfig, "utf-8");
|
|
21192
21546
|
console.log(import_chalk3.default.green(`\u2713 Created ruler.toml configuration template`));
|
|
21193
21547
|
}
|
|
21194
21548
|
}
|
|
@@ -21258,8 +21612,8 @@ init_telemetry();
|
|
|
21258
21612
|
init_errors();
|
|
21259
21613
|
function getVersion() {
|
|
21260
21614
|
try {
|
|
21261
|
-
const packageJsonPath = (0,
|
|
21262
|
-
const packageJson = JSON.parse((0,
|
|
21615
|
+
const packageJsonPath = (0, import_path21.join)(__dirname, "../package.json");
|
|
21616
|
+
const packageJson = JSON.parse((0, import_fs18.readFileSync)(packageJsonPath, "utf-8"));
|
|
21263
21617
|
return packageJson.version || "0.0.0";
|
|
21264
21618
|
} catch {
|
|
21265
21619
|
return "0.0.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prpm",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"description": "Prompt Package Manager CLI - Install and manage prompt-based files",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@octokit/rest": "^22.0.0",
|
|
48
|
-
"@pr-pm/converters": "^1.1.
|
|
49
|
-
"@pr-pm/registry-client": "^2.1.
|
|
50
|
-
"@pr-pm/types": "^1.1.
|
|
48
|
+
"@pr-pm/converters": "^1.1.16",
|
|
49
|
+
"@pr-pm/registry-client": "^2.1.16",
|
|
50
|
+
"@pr-pm/types": "^1.1.16",
|
|
51
51
|
"ajv": "^8.17.1",
|
|
52
52
|
"ajv-formats": "^3.0.1",
|
|
53
53
|
"commander": "^11.1.0",
|