prpm 1.1.13 → 1.1.15
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 +582 -164
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -113,6 +113,16 @@ function setPackageIntegrity(lockfile, packageId, tarballBuffer, format) {
|
|
|
113
113
|
const hash = (0, import_crypto.createHash)("sha256").update(tarballBuffer).digest("hex");
|
|
114
114
|
lockfile.packages[lockfileKey].integrity = `sha256-${hash}`;
|
|
115
115
|
}
|
|
116
|
+
function verifyPackageIntegrity(lockfile, packageId, tarballBuffer, format) {
|
|
117
|
+
const lockfileKey = getLockfileKey(packageId, format);
|
|
118
|
+
const pkg = lockfile.packages[lockfileKey];
|
|
119
|
+
if (!pkg || !pkg.integrity) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
const hash = (0, import_crypto.createHash)("sha256").update(tarballBuffer).digest("hex");
|
|
123
|
+
const expectedHash = pkg.integrity.replace("sha256-", "");
|
|
124
|
+
return hash === expectedHash;
|
|
125
|
+
}
|
|
116
126
|
function getLockedVersion(lockfile, packageId, format) {
|
|
117
127
|
var _a;
|
|
118
128
|
if (!lockfile) {
|
|
@@ -10881,6 +10891,364 @@ var init_schema_files = __esm({
|
|
|
10881
10891
|
}
|
|
10882
10892
|
});
|
|
10883
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
|
+
|
|
10884
11252
|
// ../converters/dist/format-registry.js
|
|
10885
11253
|
function getFormatRegistry() {
|
|
10886
11254
|
return formatRegistry;
|
|
@@ -10953,17 +11321,13 @@ function findFormatByRootFile(filename) {
|
|
|
10953
11321
|
}
|
|
10954
11322
|
return void 0;
|
|
10955
11323
|
}
|
|
10956
|
-
var
|
|
10957
|
-
var
|
|
11324
|
+
var formatRegistry;
|
|
11325
|
+
var init_format_registry2 = __esm({
|
|
10958
11326
|
"../converters/dist/format-registry.js"() {
|
|
10959
11327
|
"use strict";
|
|
10960
11328
|
init_cjs_shims();
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
import_path7 = require("path");
|
|
10964
|
-
currentDir = (0, import_path7.dirname)((0, import_url2.fileURLToPath)(importMetaUrl));
|
|
10965
|
-
formatRegistryData = JSON.parse((0, import_fs6.readFileSync)((0, import_path7.join)(currentDir, "format-registry.json"), "utf-8"));
|
|
10966
|
-
formatRegistry = formatRegistryData;
|
|
11329
|
+
init_format_registry();
|
|
11330
|
+
formatRegistry = format_registry_default;
|
|
10967
11331
|
}
|
|
10968
11332
|
});
|
|
10969
11333
|
|
|
@@ -11107,7 +11471,7 @@ var init_dist = __esm({
|
|
|
11107
11471
|
init_taxonomy_utils();
|
|
11108
11472
|
init_validation();
|
|
11109
11473
|
init_schema_files();
|
|
11110
|
-
|
|
11474
|
+
init_format_registry2();
|
|
11111
11475
|
}
|
|
11112
11476
|
});
|
|
11113
11477
|
|
|
@@ -11131,23 +11495,23 @@ function getDestinationDir2(format, subtype, name) {
|
|
|
11131
11495
|
}
|
|
11132
11496
|
async function ensureDirectoryExists(dirPath) {
|
|
11133
11497
|
try {
|
|
11134
|
-
await
|
|
11498
|
+
await import_fs6.promises.mkdir(dirPath, { recursive: true });
|
|
11135
11499
|
} catch (error) {
|
|
11136
11500
|
throw new Error(`Failed to create directory ${dirPath}: ${error}`);
|
|
11137
11501
|
}
|
|
11138
11502
|
}
|
|
11139
11503
|
async function saveFile(filePath, content) {
|
|
11140
11504
|
try {
|
|
11141
|
-
const dir =
|
|
11505
|
+
const dir = import_path7.default.dirname(filePath);
|
|
11142
11506
|
await ensureDirectoryExists(dir);
|
|
11143
|
-
await
|
|
11507
|
+
await import_fs6.promises.writeFile(filePath, content, "utf-8");
|
|
11144
11508
|
} catch (error) {
|
|
11145
11509
|
throw new Error(`Failed to save file ${filePath}: ${error}`);
|
|
11146
11510
|
}
|
|
11147
11511
|
}
|
|
11148
11512
|
async function fileExists(filePath) {
|
|
11149
11513
|
try {
|
|
11150
|
-
await
|
|
11514
|
+
await import_fs6.promises.access(filePath);
|
|
11151
11515
|
return true;
|
|
11152
11516
|
} catch {
|
|
11153
11517
|
return false;
|
|
@@ -11155,7 +11519,7 @@ async function fileExists(filePath) {
|
|
|
11155
11519
|
}
|
|
11156
11520
|
async function directoryExists(dirPath) {
|
|
11157
11521
|
try {
|
|
11158
|
-
const stats = await
|
|
11522
|
+
const stats = await import_fs6.promises.stat(dirPath);
|
|
11159
11523
|
return stats.isDirectory();
|
|
11160
11524
|
} catch {
|
|
11161
11525
|
return false;
|
|
@@ -11210,13 +11574,13 @@ function stripAuthorNamespace2(packageId) {
|
|
|
11210
11574
|
const parts = packageId.split("/");
|
|
11211
11575
|
return parts[parts.length - 1];
|
|
11212
11576
|
}
|
|
11213
|
-
var
|
|
11577
|
+
var import_fs6, import_path7;
|
|
11214
11578
|
var init_filesystem = __esm({
|
|
11215
11579
|
"src/core/filesystem.ts"() {
|
|
11216
11580
|
"use strict";
|
|
11217
11581
|
init_cjs_shims();
|
|
11218
|
-
|
|
11219
|
-
|
|
11582
|
+
import_fs6 = require("fs");
|
|
11583
|
+
import_path7 = __toESM(require("path"));
|
|
11220
11584
|
init_dist();
|
|
11221
11585
|
}
|
|
11222
11586
|
});
|
|
@@ -11236,7 +11600,7 @@ function generateSkillXML(entry) {
|
|
|
11236
11600
|
const resourceType = entry.resourceType || "skill";
|
|
11237
11601
|
const tag = resourceType === "agent" ? "agent" : "skill";
|
|
11238
11602
|
const mainFile = entry.mainFile || (resourceType === "agent" ? "AGENT.md" : "SKILL.md");
|
|
11239
|
-
const fullPath =
|
|
11603
|
+
const fullPath = import_path8.default.join(entry.skillPath, mainFile);
|
|
11240
11604
|
return `<${tag}>
|
|
11241
11605
|
<name>${escapeXML(entry.name)}</name>
|
|
11242
11606
|
<description>${escapeXML(entry.description)}</description>
|
|
@@ -11306,7 +11670,7 @@ async function readAgentsMdManifest(agentsPath = "AGENTS.md") {
|
|
|
11306
11670
|
afterManifest: ""
|
|
11307
11671
|
};
|
|
11308
11672
|
}
|
|
11309
|
-
const content = await
|
|
11673
|
+
const content = await import_fs7.promises.readFile(agentsPath, "utf-8");
|
|
11310
11674
|
let manifestStart = "<!-- PRPM_MANIFEST_START -->";
|
|
11311
11675
|
let manifestEnd = "<!-- PRPM_MANIFEST_END -->";
|
|
11312
11676
|
let startIdx = content.indexOf(manifestStart);
|
|
@@ -11364,7 +11728,7 @@ async function addSkillToManifest(entry, agentsPath = "AGENTS.md") {
|
|
|
11364
11728
|
newContent += "\n\n";
|
|
11365
11729
|
newContent += generateManifestFooter(hasAgents, agentsXML);
|
|
11366
11730
|
newContent += afterManifest;
|
|
11367
|
-
await
|
|
11731
|
+
await import_fs7.promises.writeFile(agentsPath, newContent.trim() + "\n", "utf-8");
|
|
11368
11732
|
}
|
|
11369
11733
|
async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
11370
11734
|
const { beforeManifest, manifest, afterManifest } = await readAgentsMdManifest(agentsPath);
|
|
@@ -11376,9 +11740,9 @@ async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
|
11376
11740
|
if (updatedResources.length === 0) {
|
|
11377
11741
|
const newContent2 = (beforeManifest + afterManifest).trim();
|
|
11378
11742
|
if (newContent2) {
|
|
11379
|
-
await
|
|
11743
|
+
await import_fs7.promises.writeFile(agentsPath, newContent2 + "\n", "utf-8");
|
|
11380
11744
|
} else {
|
|
11381
|
-
await
|
|
11745
|
+
await import_fs7.promises.unlink(agentsPath);
|
|
11382
11746
|
}
|
|
11383
11747
|
return;
|
|
11384
11748
|
}
|
|
@@ -11394,7 +11758,7 @@ async function removeSkillFromManifest(skillName, agentsPath = "AGENTS.md") {
|
|
|
11394
11758
|
newContent += "\n\n";
|
|
11395
11759
|
newContent += generateManifestFooter(hasAgents, agentsXML);
|
|
11396
11760
|
newContent += afterManifest;
|
|
11397
|
-
await
|
|
11761
|
+
await import_fs7.promises.writeFile(agentsPath, newContent.trim() + "\n", "utf-8");
|
|
11398
11762
|
}
|
|
11399
11763
|
function parseSkillsFromManifest(manifestXML) {
|
|
11400
11764
|
const resources = [];
|
|
@@ -11451,13 +11815,13 @@ function escapeXML(str2) {
|
|
|
11451
11815
|
function unescapeXML(str2) {
|
|
11452
11816
|
return str2.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
11453
11817
|
}
|
|
11454
|
-
var
|
|
11818
|
+
var import_fs7, import_path8;
|
|
11455
11819
|
var init_agents_md_progressive = __esm({
|
|
11456
11820
|
"src/core/agents-md-progressive.ts"() {
|
|
11457
11821
|
"use strict";
|
|
11458
11822
|
init_cjs_shims();
|
|
11459
|
-
|
|
11460
|
-
|
|
11823
|
+
import_fs7 = require("fs");
|
|
11824
|
+
import_path8 = __toESM(require("path"));
|
|
11461
11825
|
init_filesystem();
|
|
11462
11826
|
}
|
|
11463
11827
|
});
|
|
@@ -13989,6 +14353,26 @@ async function handleInstall(packageSpec, options) {
|
|
|
13989
14353
|
}
|
|
13990
14354
|
console.log(` \u2B07\uFE0F Downloading...`);
|
|
13991
14355
|
const tarball = await client.downloadPackage(tarballUrl);
|
|
14356
|
+
const lockfileKeyForVerification = getLockfileKey(packageId, targetFormat);
|
|
14357
|
+
const existingEntry = lockfile == null ? void 0 : lockfile.packages[lockfileKeyForVerification];
|
|
14358
|
+
if (existingEntry == null ? void 0 : existingEntry.integrity) {
|
|
14359
|
+
console.log(` \u{1F512} Verifying integrity...`);
|
|
14360
|
+
const isValid = verifyPackageIntegrity(lockfile, packageId, tarball, targetFormat);
|
|
14361
|
+
if (!isValid) {
|
|
14362
|
+
throw new CLIError(
|
|
14363
|
+
`\u274C Integrity verification failed for ${packageId}
|
|
14364
|
+
|
|
14365
|
+
The downloaded package does not match the expected hash from prpm.lock.
|
|
14366
|
+
This could indicate:
|
|
14367
|
+
\u2022 A corrupted download
|
|
14368
|
+
\u2022 A modified package on the registry
|
|
14369
|
+
\u2022 A potential security issue
|
|
14370
|
+
|
|
14371
|
+
\u{1F4A1} To force installation anyway, delete the package from prpm.lock and retry.`
|
|
14372
|
+
);
|
|
14373
|
+
}
|
|
14374
|
+
console.log(` \u2713 Integrity verified`);
|
|
14375
|
+
}
|
|
13992
14376
|
console.log(` \u{1F4C2} Extracting...`);
|
|
13993
14377
|
const effectiveFormat = format || pkg.format;
|
|
13994
14378
|
const effectiveSubtype = options.subtype || pkg.subtype;
|
|
@@ -14146,7 +14530,7 @@ async function handleInstall(packageSpec, options) {
|
|
|
14146
14530
|
destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
|
|
14147
14531
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
14148
14532
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
14149
|
-
destDir =
|
|
14533
|
+
destDir = import_path10.default.join(locationOverride, relativeDestDir);
|
|
14150
14534
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
14151
14535
|
}
|
|
14152
14536
|
let mainFile = extractedFiles[0].content;
|
|
@@ -14167,7 +14551,7 @@ async function handleInstall(packageSpec, options) {
|
|
|
14167
14551
|
const manifestFilename = getManifestFilename(effectiveFormat);
|
|
14168
14552
|
let targetPath = manifestFilename;
|
|
14169
14553
|
if (locationOverride) {
|
|
14170
|
-
targetPath =
|
|
14554
|
+
targetPath = import_path10.default.join(locationOverride, `${manifestFilename.replace(".md", ".override.md")}`);
|
|
14171
14555
|
console.log(` \u{1F4C1} Installing to custom location: ${targetPath}`);
|
|
14172
14556
|
}
|
|
14173
14557
|
destPath = targetPath;
|
|
@@ -14278,7 +14662,7 @@ async function handleInstall(packageSpec, options) {
|
|
|
14278
14662
|
destDir = getDestinationDir2(effectiveFormat, effectiveSubtype, pkg.name);
|
|
14279
14663
|
if (locationOverride && effectiveFormat === "cursor") {
|
|
14280
14664
|
const relativeDestDir = destDir.startsWith("./") ? destDir.slice(2) : destDir;
|
|
14281
|
-
destDir =
|
|
14665
|
+
destDir = import_path10.default.join(locationOverride, relativeDestDir);
|
|
14282
14666
|
console.log(` \u{1F4C1} Installing Cursor package to custom location: ${destDir}`);
|
|
14283
14667
|
}
|
|
14284
14668
|
const packageName = stripAuthorNamespace2(packageId);
|
|
@@ -14452,6 +14836,18 @@ ${afterFrontmatter}`;
|
|
|
14452
14836
|
await telemetry.shutdown();
|
|
14453
14837
|
}
|
|
14454
14838
|
}
|
|
14839
|
+
function isPathSafe(targetDir, filePath) {
|
|
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;
|
|
14843
|
+
}
|
|
14844
|
+
function hasUnsafePathPatterns(filePath) {
|
|
14845
|
+
if (filePath.includes("..")) return true;
|
|
14846
|
+
if (filePath.startsWith("/")) return true;
|
|
14847
|
+
if (/^[a-zA-Z]:/.test(filePath)) return true;
|
|
14848
|
+
if (filePath.includes("\0")) return true;
|
|
14849
|
+
return false;
|
|
14850
|
+
}
|
|
14455
14851
|
async function extractTarball(tarball, packageId) {
|
|
14456
14852
|
let decompressed;
|
|
14457
14853
|
try {
|
|
@@ -14467,7 +14863,7 @@ async function extractTarball(tarball, packageId) {
|
|
|
14467
14863
|
} catch (error) {
|
|
14468
14864
|
throw new CLIError(`Package decompression failed: ${error.message}`);
|
|
14469
14865
|
}
|
|
14470
|
-
const tmpDir = await import_promises2.default.mkdtemp(
|
|
14866
|
+
const tmpDir = await import_promises2.default.mkdtemp(import_path10.default.join(import_os3.default.tmpdir(), "prpm-"));
|
|
14471
14867
|
const cleanup = async () => {
|
|
14472
14868
|
try {
|
|
14473
14869
|
await import_promises2.default.rm(tmpDir, { recursive: true, force: true });
|
|
@@ -14486,7 +14882,29 @@ async function extractTarball(tarball, packageId) {
|
|
|
14486
14882
|
try {
|
|
14487
14883
|
const extract2 = tar.extract({
|
|
14488
14884
|
cwd: tmpDir,
|
|
14489
|
-
strict:
|
|
14885
|
+
strict: true,
|
|
14886
|
+
// Enable strict mode to reject malformed archives
|
|
14887
|
+
// Security: filter out dangerous entries before extraction
|
|
14888
|
+
filter: (entryPath, entry) => {
|
|
14889
|
+
const entryType = "type" in entry ? entry.type : null;
|
|
14890
|
+
if (entryType === "SymbolicLink" || entryType === "Link") {
|
|
14891
|
+
console.warn(` \u26A0\uFE0F Blocked symlink in package: ${entryPath}`);
|
|
14892
|
+
return false;
|
|
14893
|
+
}
|
|
14894
|
+
if ("isSymbolicLink" in entry && entry.isSymbolicLink()) {
|
|
14895
|
+
console.warn(` \u26A0\uFE0F Blocked symlink in package: ${entryPath}`);
|
|
14896
|
+
return false;
|
|
14897
|
+
}
|
|
14898
|
+
if (hasUnsafePathPatterns(entryPath)) {
|
|
14899
|
+
console.warn(` \u26A0\uFE0F Blocked unsafe path in package: ${entryPath}`);
|
|
14900
|
+
return false;
|
|
14901
|
+
}
|
|
14902
|
+
if (!isPathSafe(tmpDir, entryPath)) {
|
|
14903
|
+
console.warn(` \u26A0\uFE0F Blocked path traversal attempt: ${entryPath}`);
|
|
14904
|
+
return false;
|
|
14905
|
+
}
|
|
14906
|
+
return true;
|
|
14907
|
+
}
|
|
14490
14908
|
});
|
|
14491
14909
|
await (0, import_promises.pipeline)(import_stream.Readable.from(decompressed), extract2);
|
|
14492
14910
|
const extractedFiles = await collectExtractedFiles(tmpDir, excludedNames, import_promises2.default);
|
|
@@ -14511,11 +14929,11 @@ async function collectExtractedFiles(rootDir, excludedNames, fs14) {
|
|
|
14511
14929
|
const files = [];
|
|
14512
14930
|
const dirs = [rootDir];
|
|
14513
14931
|
while (dirs.length > 0) {
|
|
14514
|
-
const
|
|
14515
|
-
if (!
|
|
14516
|
-
const entries = await fs14.readdir(
|
|
14932
|
+
const currentDir = dirs.pop();
|
|
14933
|
+
if (!currentDir) continue;
|
|
14934
|
+
const entries = await fs14.readdir(currentDir, { withFileTypes: true });
|
|
14517
14935
|
for (const entry of entries) {
|
|
14518
|
-
const fullPath =
|
|
14936
|
+
const fullPath = import_path10.default.join(currentDir, entry.name);
|
|
14519
14937
|
if (entry.isDirectory()) {
|
|
14520
14938
|
dirs.push(fullPath);
|
|
14521
14939
|
continue;
|
|
@@ -14527,7 +14945,7 @@ async function collectExtractedFiles(rootDir, excludedNames, fs14) {
|
|
|
14527
14945
|
continue;
|
|
14528
14946
|
}
|
|
14529
14947
|
const content = await fs14.readFile(fullPath, "utf-8");
|
|
14530
|
-
const relativePath =
|
|
14948
|
+
const relativePath = import_path10.default.relative(rootDir, fullPath).split(import_path10.default.sep).join("/");
|
|
14531
14949
|
files.push({
|
|
14532
14950
|
name: relativePath,
|
|
14533
14951
|
content
|
|
@@ -14561,11 +14979,11 @@ async function installFromLockfile(options) {
|
|
|
14561
14979
|
console.log(` Installing ${displayName}...`);
|
|
14562
14980
|
let locationOverride = options.location;
|
|
14563
14981
|
if (!locationOverride && lockEntry.format === "agents.md" && lockEntry.installedPath) {
|
|
14564
|
-
const baseName =
|
|
14982
|
+
const baseName = import_path10.default.basename(lockEntry.installedPath);
|
|
14565
14983
|
if (baseName === "AGENTS.override.md") {
|
|
14566
|
-
locationOverride =
|
|
14984
|
+
locationOverride = import_path10.default.dirname(lockEntry.installedPath);
|
|
14567
14985
|
} else if (baseName !== "AGENTS.md") {
|
|
14568
|
-
locationOverride =
|
|
14986
|
+
locationOverride = import_path10.default.dirname(lockEntry.installedPath);
|
|
14569
14987
|
}
|
|
14570
14988
|
}
|
|
14571
14989
|
const manifestFile = (_a = lockEntry.progressiveDisclosure) == null ? void 0 : _a.manifestPath;
|
|
@@ -14644,7 +15062,7 @@ function createInstallCommand() {
|
|
|
14644
15062
|
});
|
|
14645
15063
|
return command;
|
|
14646
15064
|
}
|
|
14647
|
-
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;
|
|
14648
15066
|
var init_install = __esm({
|
|
14649
15067
|
"src/commands/install.ts"() {
|
|
14650
15068
|
"use strict";
|
|
@@ -14661,7 +15079,7 @@ var init_install = __esm({
|
|
|
14661
15079
|
tar = __toESM(require("tar"));
|
|
14662
15080
|
init_errors();
|
|
14663
15081
|
init_prompts();
|
|
14664
|
-
|
|
15082
|
+
import_path10 = __toESM(require("path"));
|
|
14665
15083
|
import_zlib = __toESM(require("zlib"));
|
|
14666
15084
|
import_promises2 = __toESM(require("fs/promises"));
|
|
14667
15085
|
import_os3 = __toESM(require("os"));
|
|
@@ -14678,8 +15096,8 @@ var init_install = __esm({
|
|
|
14678
15096
|
// src/index.ts
|
|
14679
15097
|
init_cjs_shims();
|
|
14680
15098
|
var import_commander29 = require("commander");
|
|
14681
|
-
var
|
|
14682
|
-
var
|
|
15099
|
+
var import_fs18 = require("fs");
|
|
15100
|
+
var import_path21 = require("path");
|
|
14683
15101
|
|
|
14684
15102
|
// src/commands/list.ts
|
|
14685
15103
|
init_cjs_shims();
|
|
@@ -14839,7 +15257,7 @@ var import_commander2 = require("commander");
|
|
|
14839
15257
|
init_lockfile();
|
|
14840
15258
|
init_filesystem();
|
|
14841
15259
|
init_types();
|
|
14842
|
-
var
|
|
15260
|
+
var import_fs8 = require("fs");
|
|
14843
15261
|
init_errors();
|
|
14844
15262
|
init_agents_md_progressive();
|
|
14845
15263
|
var readline = __toESM(require("readline"));
|
|
@@ -14940,7 +15358,7 @@ async function handleUninstall(name, options = {}) {
|
|
|
14940
15358
|
if (pkg.format === "claude" && pkg.subtype === "hook" && pkg.hookMetadata) {
|
|
14941
15359
|
const settingsPath = pkg.installedPath || ".claude/settings.json";
|
|
14942
15360
|
try {
|
|
14943
|
-
const settingsContent = await
|
|
15361
|
+
const settingsContent = await import_fs8.promises.readFile(settingsPath, "utf-8");
|
|
14944
15362
|
const settings = JSON.parse(settingsContent);
|
|
14945
15363
|
if (settings.hooks) {
|
|
14946
15364
|
let removedCount = 0;
|
|
@@ -14957,7 +15375,7 @@ async function handleUninstall(name, options = {}) {
|
|
|
14957
15375
|
}
|
|
14958
15376
|
}
|
|
14959
15377
|
}
|
|
14960
|
-
await
|
|
15378
|
+
await import_fs8.promises.writeFile(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
14961
15379
|
console.log(` \u{1FA9D} Removed ${removedCount} hook(s) from ${settingsPath}`);
|
|
14962
15380
|
}
|
|
14963
15381
|
} catch (error) {
|
|
@@ -14982,12 +15400,12 @@ async function handleUninstall(name, options = {}) {
|
|
|
14982
15400
|
throw new CLIError(`Cannot uninstall ${name}: installation path unknown`, 1);
|
|
14983
15401
|
}
|
|
14984
15402
|
try {
|
|
14985
|
-
const stats = await
|
|
15403
|
+
const stats = await import_fs8.promises.stat(targetPath);
|
|
14986
15404
|
if (stats.isDirectory()) {
|
|
14987
|
-
await
|
|
15405
|
+
await import_fs8.promises.rm(targetPath, { recursive: true, force: true });
|
|
14988
15406
|
console.log(` \u{1F5D1}\uFE0F Deleted directory: ${targetPath}`);
|
|
14989
15407
|
} else if (stats.isFile()) {
|
|
14990
|
-
await
|
|
15408
|
+
await import_fs8.promises.unlink(targetPath);
|
|
14991
15409
|
console.log(` \u{1F5D1}\uFE0F Deleted file: ${targetPath}`);
|
|
14992
15410
|
}
|
|
14993
15411
|
} catch (error) {
|
|
@@ -15016,17 +15434,17 @@ function createUninstallCommand() {
|
|
|
15016
15434
|
// src/commands/index.ts
|
|
15017
15435
|
init_cjs_shims();
|
|
15018
15436
|
var import_commander3 = require("commander");
|
|
15019
|
-
var
|
|
15020
|
-
var
|
|
15437
|
+
var import_fs9 = require("fs");
|
|
15438
|
+
var import_path9 = __toESM(require("path"));
|
|
15021
15439
|
init_lockfile();
|
|
15022
15440
|
init_filesystem();
|
|
15023
15441
|
init_errors();
|
|
15024
15442
|
async function scanDirectory(dirPath, format, subtype) {
|
|
15025
15443
|
try {
|
|
15026
|
-
const files = await
|
|
15444
|
+
const files = await import_fs9.promises.readdir(dirPath, { withFileTypes: true });
|
|
15027
15445
|
const results = [];
|
|
15028
15446
|
for (const file of files) {
|
|
15029
|
-
const fullPath =
|
|
15447
|
+
const fullPath = import_path9.default.join(dirPath, file.name);
|
|
15030
15448
|
if (file.isFile()) {
|
|
15031
15449
|
const id = generateId(file.name);
|
|
15032
15450
|
results.push({
|
|
@@ -15039,11 +15457,11 @@ async function scanDirectory(dirPath, format, subtype) {
|
|
|
15039
15457
|
const isCursorAgent = format === "cursor" && subtype === "agent";
|
|
15040
15458
|
if (isClaudeType || isCursorAgent) {
|
|
15041
15459
|
try {
|
|
15042
|
-
const subFiles = await
|
|
15460
|
+
const subFiles = await import_fs9.promises.readdir(fullPath, { withFileTypes: true });
|
|
15043
15461
|
for (const subFile of subFiles) {
|
|
15044
15462
|
const isValidFile = subFile.isFile() && (subFile.name === "SKILL.md" || subFile.name === "AGENT.md" || subFile.name === "skill.md" || subFile.name === "agent.md");
|
|
15045
15463
|
if (isValidFile) {
|
|
15046
|
-
const subFilePath =
|
|
15464
|
+
const subFilePath = import_path9.default.join(fullPath, subFile.name);
|
|
15047
15465
|
const id = file.name;
|
|
15048
15466
|
results.push({
|
|
15049
15467
|
filePath: subFilePath,
|
|
@@ -15105,7 +15523,7 @@ async function handleIndex(options = {}) {
|
|
|
15105
15523
|
id: file.id,
|
|
15106
15524
|
version: "0.0.0",
|
|
15107
15525
|
// Local files don't have versions
|
|
15108
|
-
tarballUrl: `file://${
|
|
15526
|
+
tarballUrl: `file://${import_path9.default.resolve(file.filePath)}`,
|
|
15109
15527
|
format: dir.format,
|
|
15110
15528
|
subtype: dir.subtype
|
|
15111
15529
|
});
|
|
@@ -15932,8 +16350,8 @@ init_install();
|
|
|
15932
16350
|
init_cjs_shims();
|
|
15933
16351
|
var import_commander13 = require("commander");
|
|
15934
16352
|
var import_promises7 = require("fs/promises");
|
|
15935
|
-
var
|
|
15936
|
-
var
|
|
16353
|
+
var import_path17 = require("path");
|
|
16354
|
+
var import_fs15 = require("fs");
|
|
15937
16355
|
var tar2 = __toESM(require("tar"));
|
|
15938
16356
|
var import_os4 = require("os");
|
|
15939
16357
|
var import_crypto2 = require("crypto");
|
|
@@ -16106,19 +16524,19 @@ function validateMarketplaceJson(data) {
|
|
|
16106
16524
|
init_cjs_shims();
|
|
16107
16525
|
var import_ajv2 = __toESM(require("ajv"));
|
|
16108
16526
|
var import_ajv_formats2 = __toESM(require("ajv-formats"));
|
|
16109
|
-
var
|
|
16110
|
-
var
|
|
16527
|
+
var import_fs10 = require("fs");
|
|
16528
|
+
var import_path11 = require("path");
|
|
16111
16529
|
var schema2;
|
|
16112
16530
|
var schemaCandidates = [
|
|
16113
16531
|
// Source file layout (src/core → ../../schemas)
|
|
16114
|
-
(0,
|
|
16532
|
+
(0, import_path11.join)(__dirname, "../../schemas/prpm-manifest.schema.json"),
|
|
16115
16533
|
// Bundled layout (dist/index.js → ../schemas)
|
|
16116
|
-
(0,
|
|
16534
|
+
(0, import_path11.join)(__dirname, "../schemas/prpm-manifest.schema.json")
|
|
16117
16535
|
];
|
|
16118
16536
|
for (const candidate of schemaCandidates) {
|
|
16119
16537
|
try {
|
|
16120
|
-
if ((0,
|
|
16121
|
-
schema2 = JSON.parse((0,
|
|
16538
|
+
if ((0, import_fs10.existsSync)(candidate)) {
|
|
16539
|
+
schema2 = JSON.parse((0, import_fs10.readFileSync)(candidate, "utf-8"));
|
|
16122
16540
|
break;
|
|
16123
16541
|
}
|
|
16124
16542
|
} catch {
|
|
@@ -16173,8 +16591,8 @@ function getManifestSchema() {
|
|
|
16173
16591
|
// src/utils/license-extractor.ts
|
|
16174
16592
|
init_cjs_shims();
|
|
16175
16593
|
var import_promises3 = require("fs/promises");
|
|
16176
|
-
var
|
|
16177
|
-
var
|
|
16594
|
+
var import_path12 = require("path");
|
|
16595
|
+
var import_fs11 = require("fs");
|
|
16178
16596
|
var LICENSE_FILE_PATTERNS = [
|
|
16179
16597
|
"LICENSE",
|
|
16180
16598
|
"LICENSE.md",
|
|
@@ -16223,9 +16641,9 @@ function generateLicenseUrl(repositoryUrl, fileName) {
|
|
|
16223
16641
|
async function extractLicenseInfo(repositoryUrl) {
|
|
16224
16642
|
const cwd = process.cwd();
|
|
16225
16643
|
for (const fileName of LICENSE_FILE_PATTERNS) {
|
|
16226
|
-
const filePath = (0,
|
|
16644
|
+
const filePath = (0, import_path12.join)(cwd, fileName);
|
|
16227
16645
|
try {
|
|
16228
|
-
await (0, import_promises3.access)(filePath,
|
|
16646
|
+
await (0, import_promises3.access)(filePath, import_fs11.constants.R_OK);
|
|
16229
16647
|
const text = await (0, import_promises3.readFile)(filePath, "utf-8");
|
|
16230
16648
|
const type2 = detectLicenseType(text);
|
|
16231
16649
|
const url = generateLicenseUrl(repositoryUrl, fileName);
|
|
@@ -16259,7 +16677,7 @@ function validateLicenseInfo(licenseInfo, packageName) {
|
|
|
16259
16677
|
// src/utils/snippet-extractor.ts
|
|
16260
16678
|
init_cjs_shims();
|
|
16261
16679
|
var import_promises4 = require("fs/promises");
|
|
16262
|
-
var
|
|
16680
|
+
var import_path13 = require("path");
|
|
16263
16681
|
var MAX_SNIPPET_LENGTH = 2e3;
|
|
16264
16682
|
async function extractSnippet(manifest) {
|
|
16265
16683
|
const cwd = process.cwd();
|
|
@@ -16275,7 +16693,7 @@ async function extractSnippet(manifest) {
|
|
|
16275
16693
|
const firstFile = manifest.files[0];
|
|
16276
16694
|
fileName = typeof firstFile === "string" ? firstFile : firstFile.path;
|
|
16277
16695
|
}
|
|
16278
|
-
const fullPath = (0,
|
|
16696
|
+
const fullPath = (0, import_path13.join)(cwd, fileName);
|
|
16279
16697
|
const stats = await (0, import_promises4.stat)(fullPath);
|
|
16280
16698
|
if (stats.isDirectory()) {
|
|
16281
16699
|
console.warn(`\u26A0\uFE0F Skipping snippet extraction: "${fullPath}" is a directory`);
|
|
@@ -16537,8 +16955,8 @@ async function validatePackageFiles(manifest) {
|
|
|
16537
16955
|
init_cjs_shims();
|
|
16538
16956
|
var import_commander12 = require("commander");
|
|
16539
16957
|
var import_promises6 = require("fs/promises");
|
|
16540
|
-
var
|
|
16541
|
-
var
|
|
16958
|
+
var import_path16 = require("path");
|
|
16959
|
+
var import_fs14 = require("fs");
|
|
16542
16960
|
var readline4 = __toESM(require("readline/promises"));
|
|
16543
16961
|
var import_process = require("process");
|
|
16544
16962
|
init_types();
|
|
@@ -16546,8 +16964,8 @@ init_errors();
|
|
|
16546
16964
|
|
|
16547
16965
|
// src/core/package-scanner.ts
|
|
16548
16966
|
init_cjs_shims();
|
|
16549
|
-
var
|
|
16550
|
-
var
|
|
16967
|
+
var import_fs12 = require("fs");
|
|
16968
|
+
var import_path14 = __toESM(require("path"));
|
|
16551
16969
|
init_dist();
|
|
16552
16970
|
function buildScanConfigs() {
|
|
16553
16971
|
const configs = [];
|
|
@@ -16573,7 +16991,7 @@ function buildScanConfigs() {
|
|
|
16573
16991
|
var SCAN_CONFIGS = buildScanConfigs();
|
|
16574
16992
|
async function extractMetadata2(filePath) {
|
|
16575
16993
|
try {
|
|
16576
|
-
const content = await
|
|
16994
|
+
const content = await import_fs12.promises.readFile(filePath, "utf-8");
|
|
16577
16995
|
const metadata = {};
|
|
16578
16996
|
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
16579
16997
|
if (frontmatterMatch) {
|
|
@@ -16626,7 +17044,7 @@ function matchesPattern(filename, patterns) {
|
|
|
16626
17044
|
}
|
|
16627
17045
|
async function directoryExists2(dirPath) {
|
|
16628
17046
|
try {
|
|
16629
|
-
const stats = await
|
|
17047
|
+
const stats = await import_fs12.promises.stat(dirPath);
|
|
16630
17048
|
return stats.isDirectory();
|
|
16631
17049
|
} catch {
|
|
16632
17050
|
return false;
|
|
@@ -16634,7 +17052,7 @@ async function directoryExists2(dirPath) {
|
|
|
16634
17052
|
}
|
|
16635
17053
|
async function fileExists2(filePath) {
|
|
16636
17054
|
try {
|
|
16637
|
-
await
|
|
17055
|
+
await import_fs12.promises.access(filePath);
|
|
16638
17056
|
return true;
|
|
16639
17057
|
} catch {
|
|
16640
17058
|
return false;
|
|
@@ -16642,21 +17060,21 @@ async function fileExists2(filePath) {
|
|
|
16642
17060
|
}
|
|
16643
17061
|
async function scanDirectory2(config, cwd) {
|
|
16644
17062
|
const packages = [];
|
|
16645
|
-
const fullDir =
|
|
17063
|
+
const fullDir = import_path14.default.join(cwd, config.directory);
|
|
16646
17064
|
if (!await directoryExists2(fullDir)) {
|
|
16647
17065
|
return packages;
|
|
16648
17066
|
}
|
|
16649
|
-
const entries = await
|
|
17067
|
+
const entries = await import_fs12.promises.readdir(fullDir, { withFileTypes: true });
|
|
16650
17068
|
if (config.nested) {
|
|
16651
17069
|
for (const entry of entries) {
|
|
16652
17070
|
if (!entry.isDirectory()) continue;
|
|
16653
|
-
const packageDir =
|
|
17071
|
+
const packageDir = import_path14.default.join(fullDir, entry.name);
|
|
16654
17072
|
if (config.nestedIndicator) {
|
|
16655
|
-
const indicatorPath =
|
|
17073
|
+
const indicatorPath = import_path14.default.join(packageDir, config.nestedIndicator);
|
|
16656
17074
|
if (!await fileExists2(indicatorPath)) continue;
|
|
16657
17075
|
const packageFiles = await collectPackageFiles(packageDir, config.directory, entry.name);
|
|
16658
17076
|
const metadata = await extractMetadata2(indicatorPath);
|
|
16659
|
-
const relativePath =
|
|
17077
|
+
const relativePath = import_path14.default.join(config.directory, entry.name, config.nestedIndicator);
|
|
16660
17078
|
packages.push({
|
|
16661
17079
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
16662
17080
|
format: config.format,
|
|
@@ -16667,12 +17085,12 @@ async function scanDirectory2(config, cwd) {
|
|
|
16667
17085
|
primaryFile: relativePath
|
|
16668
17086
|
});
|
|
16669
17087
|
} else {
|
|
16670
|
-
const subEntries = await
|
|
17088
|
+
const subEntries = await import_fs12.promises.readdir(packageDir, { withFileTypes: true });
|
|
16671
17089
|
for (const subEntry of subEntries) {
|
|
16672
17090
|
if (!subEntry.isFile()) continue;
|
|
16673
17091
|
if (!matchesPattern(subEntry.name, config.patterns)) continue;
|
|
16674
|
-
const filePath =
|
|
16675
|
-
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);
|
|
16676
17094
|
const metadata = await extractMetadata2(filePath);
|
|
16677
17095
|
packages.push({
|
|
16678
17096
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -16690,8 +17108,8 @@ async function scanDirectory2(config, cwd) {
|
|
|
16690
17108
|
for (const entry of entries) {
|
|
16691
17109
|
if (!entry.isFile()) continue;
|
|
16692
17110
|
if (!matchesPattern(entry.name, config.patterns)) continue;
|
|
16693
|
-
const filePath =
|
|
16694
|
-
const relativePath =
|
|
17111
|
+
const filePath = import_path14.default.join(fullDir, entry.name);
|
|
17112
|
+
const relativePath = import_path14.default.join(config.directory, entry.name);
|
|
16695
17113
|
const metadata = await extractMetadata2(filePath);
|
|
16696
17114
|
packages.push({
|
|
16697
17115
|
name: metadata.name || filenameToPackageName(entry.name),
|
|
@@ -16709,24 +17127,24 @@ async function scanDirectory2(config, cwd) {
|
|
|
16709
17127
|
async function collectPackageFiles(packageDir, baseDir, packageName) {
|
|
16710
17128
|
const files = [];
|
|
16711
17129
|
async function walkDir(dir, relativeBase) {
|
|
16712
|
-
const entries = await
|
|
17130
|
+
const entries = await import_fs12.promises.readdir(dir, { withFileTypes: true });
|
|
16713
17131
|
for (const entry of entries) {
|
|
16714
|
-
const fullPath =
|
|
16715
|
-
const relativePath =
|
|
17132
|
+
const fullPath = import_path14.default.join(dir, entry.name);
|
|
17133
|
+
const relativePath = import_path14.default.join(relativeBase, entry.name);
|
|
16716
17134
|
if (entry.isDirectory()) {
|
|
16717
17135
|
if (["node_modules", "dist", ".git", "coverage"].includes(entry.name)) {
|
|
16718
17136
|
continue;
|
|
16719
17137
|
}
|
|
16720
17138
|
await walkDir(fullPath, relativePath);
|
|
16721
17139
|
} else if (entry.isFile()) {
|
|
16722
|
-
const ext =
|
|
17140
|
+
const ext = import_path14.default.extname(entry.name).toLowerCase();
|
|
16723
17141
|
if ([".md", ".json", ".js", ".ts", ".toml"].includes(ext)) {
|
|
16724
17142
|
files.push(relativePath);
|
|
16725
17143
|
}
|
|
16726
17144
|
}
|
|
16727
17145
|
}
|
|
16728
17146
|
}
|
|
16729
|
-
await walkDir(packageDir,
|
|
17147
|
+
await walkDir(packageDir, import_path14.default.join(baseDir, packageName));
|
|
16730
17148
|
return files;
|
|
16731
17149
|
}
|
|
16732
17150
|
function buildRootManifestFiles() {
|
|
@@ -16749,7 +17167,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16749
17167
|
allPackages.push(...packages);
|
|
16750
17168
|
}
|
|
16751
17169
|
for (const { file, format } of ROOT_MANIFEST_FILES) {
|
|
16752
|
-
const filePath =
|
|
17170
|
+
const filePath = import_path14.default.join(cwd, file);
|
|
16753
17171
|
if (await fileExists2(filePath)) {
|
|
16754
17172
|
const metadata = await extractMetadata2(filePath);
|
|
16755
17173
|
allPackages.push({
|
|
@@ -16763,7 +17181,7 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16763
17181
|
});
|
|
16764
17182
|
}
|
|
16765
17183
|
}
|
|
16766
|
-
const copilotInstructionsPath =
|
|
17184
|
+
const copilotInstructionsPath = import_path14.default.join(cwd, ".github/copilot-instructions.md");
|
|
16767
17185
|
if (await fileExists2(copilotInstructionsPath)) {
|
|
16768
17186
|
const metadata = await extractMetadata2(copilotInstructionsPath);
|
|
16769
17187
|
allPackages.push({
|
|
@@ -16781,12 +17199,12 @@ async function scanForPackages(cwd = process.cwd()) {
|
|
|
16781
17199
|
|
|
16782
17200
|
// src/core/package-reconciler.ts
|
|
16783
17201
|
init_cjs_shims();
|
|
16784
|
-
var
|
|
16785
|
-
var
|
|
17202
|
+
var import_fs13 = require("fs");
|
|
17203
|
+
var import_path15 = __toESM(require("path"));
|
|
16786
17204
|
async function readManifest(cwd = process.cwd()) {
|
|
16787
17205
|
try {
|
|
16788
|
-
const manifestPath =
|
|
16789
|
-
const content = await
|
|
17206
|
+
const manifestPath = import_path15.default.join(cwd, "prpm.json");
|
|
17207
|
+
const content = await import_fs13.promises.readFile(manifestPath, "utf-8");
|
|
16790
17208
|
const raw = JSON.parse(content);
|
|
16791
17209
|
if ("packages" in raw && Array.isArray(raw.packages)) {
|
|
16792
17210
|
return {
|
|
@@ -16812,7 +17230,7 @@ async function readManifest(cwd = process.cwd()) {
|
|
|
16812
17230
|
}
|
|
16813
17231
|
async function fileExists3(filePath) {
|
|
16814
17232
|
try {
|
|
16815
|
-
await
|
|
17233
|
+
await import_fs13.promises.access(filePath);
|
|
16816
17234
|
return true;
|
|
16817
17235
|
} catch {
|
|
16818
17236
|
return false;
|
|
@@ -16868,7 +17286,7 @@ async function reconcilePackages(detected, manifest, cwd = process.cwd()) {
|
|
|
16868
17286
|
const manifestPkg = manifest[mi];
|
|
16869
17287
|
let anyFileExists = false;
|
|
16870
17288
|
for (const file of manifestPkg.files) {
|
|
16871
|
-
const fullPath =
|
|
17289
|
+
const fullPath = import_path15.default.join(cwd, file);
|
|
16872
17290
|
if (await fileExists3(fullPath)) {
|
|
16873
17291
|
anyFileExists = true;
|
|
16874
17292
|
break;
|
|
@@ -16937,7 +17355,7 @@ function createManifestFromDetected(packages, defaults) {
|
|
|
16937
17355
|
files: pkg.files
|
|
16938
17356
|
};
|
|
16939
17357
|
}
|
|
16940
|
-
const projectName =
|
|
17358
|
+
const projectName = import_path15.default.basename(process.cwd()).toLowerCase().replace(/[^a-z0-9-]/g, "-");
|
|
16941
17359
|
return {
|
|
16942
17360
|
name: `${projectName}-packages`,
|
|
16943
17361
|
version: "1.0.0",
|
|
@@ -17316,12 +17734,12 @@ function getDefaultAuthor() {
|
|
|
17316
17734
|
async function createExampleFiles(format, files, packageName) {
|
|
17317
17735
|
const templates = EXAMPLE_TEMPLATES[format] || {};
|
|
17318
17736
|
for (const file of files) {
|
|
17319
|
-
const filePath = (0,
|
|
17320
|
-
const dirPath = (0,
|
|
17321
|
-
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)) {
|
|
17322
17740
|
await (0, import_promises6.mkdir)(dirPath, { recursive: true });
|
|
17323
17741
|
}
|
|
17324
|
-
if ((0,
|
|
17742
|
+
if ((0, import_fs14.existsSync)(filePath)) {
|
|
17325
17743
|
console.log(` Skipping ${file} (already exists)`);
|
|
17326
17744
|
continue;
|
|
17327
17745
|
}
|
|
@@ -17335,8 +17753,8 @@ Add your content here.
|
|
|
17335
17753
|
}
|
|
17336
17754
|
}
|
|
17337
17755
|
async function createReadme(config) {
|
|
17338
|
-
const readmePath = (0,
|
|
17339
|
-
if ((0,
|
|
17756
|
+
const readmePath = (0, import_path16.join)(process.cwd(), "README.md");
|
|
17757
|
+
if ((0, import_fs14.existsSync)(readmePath)) {
|
|
17340
17758
|
console.log(" Skipping README.md (already exists)");
|
|
17341
17759
|
return;
|
|
17342
17760
|
}
|
|
@@ -17439,8 +17857,8 @@ async function reviewMissingPackage(rl, pkg, index, total) {
|
|
|
17439
17857
|
return await confirm(rl, "\n Remove from prpm.json?", true);
|
|
17440
17858
|
}
|
|
17441
17859
|
async function smartInit(options) {
|
|
17442
|
-
const manifestPath = (0,
|
|
17443
|
-
const hasManifest = (0,
|
|
17860
|
+
const manifestPath = (0, import_path16.join)(process.cwd(), "prpm.json");
|
|
17861
|
+
const hasManifest = (0, import_fs14.existsSync)(manifestPath);
|
|
17444
17862
|
console.log("\nScanning for packages...\n");
|
|
17445
17863
|
const detected = await scanForPackages();
|
|
17446
17864
|
const existingManifest = hasManifest ? await readManifest() : null;
|
|
@@ -17572,8 +17990,8 @@ Create multi-package prpm.json with these ${detected.length} packages?` : "\nCre
|
|
|
17572
17990
|
}
|
|
17573
17991
|
}
|
|
17574
17992
|
async function classicInit(options) {
|
|
17575
|
-
const manifestPath = (0,
|
|
17576
|
-
if ((0,
|
|
17993
|
+
const manifestPath = (0, import_path16.join)(process.cwd(), "prpm.json");
|
|
17994
|
+
if ((0, import_fs14.existsSync)(manifestPath) && !options.force) {
|
|
17577
17995
|
throw new Error(
|
|
17578
17996
|
"prpm.json already exists. Use --force to overwrite, or run this command in a different directory."
|
|
17579
17997
|
);
|
|
@@ -17769,7 +18187,7 @@ function createInitCommand() {
|
|
|
17769
18187
|
|
|
17770
18188
|
// src/commands/publish.ts
|
|
17771
18189
|
async function findAndLoadManifests() {
|
|
17772
|
-
const prpmJsonPath = (0,
|
|
18190
|
+
const prpmJsonPath = (0, import_path17.join)(process.cwd(), "prpm.json");
|
|
17773
18191
|
let prpmJsonExists = false;
|
|
17774
18192
|
let prpmJsonError = null;
|
|
17775
18193
|
try {
|
|
@@ -17821,7 +18239,7 @@ async function findAndLoadManifests() {
|
|
|
17821
18239
|
throw error;
|
|
17822
18240
|
}
|
|
17823
18241
|
}
|
|
17824
|
-
const marketplaceJsonPath = (0,
|
|
18242
|
+
const marketplaceJsonPath = (0, import_path17.join)(process.cwd(), ".claude", "marketplace.json");
|
|
17825
18243
|
try {
|
|
17826
18244
|
const content = await (0, import_promises7.readFile)(marketplaceJsonPath, "utf-8");
|
|
17827
18245
|
const marketplaceData = JSON.parse(content);
|
|
@@ -17837,7 +18255,7 @@ async function findAndLoadManifests() {
|
|
|
17837
18255
|
return { manifests, collections: [], source: ".claude/marketplace.json" };
|
|
17838
18256
|
} catch (error) {
|
|
17839
18257
|
}
|
|
17840
|
-
const marketplaceJsonPluginPath = (0,
|
|
18258
|
+
const marketplaceJsonPluginPath = (0, import_path17.join)(process.cwd(), ".claude-plugin", "marketplace.json");
|
|
17841
18259
|
try {
|
|
17842
18260
|
const content = await (0, import_promises7.readFile)(marketplaceJsonPluginPath, "utf-8");
|
|
17843
18261
|
const marketplaceData = JSON.parse(content);
|
|
@@ -17970,8 +18388,8 @@ function getSafePackageName(manifest, userInfo, fallbackName) {
|
|
|
17970
18388
|
return manifest.name;
|
|
17971
18389
|
}
|
|
17972
18390
|
async function createTarball(manifest) {
|
|
17973
|
-
const tmpDir = (0,
|
|
17974
|
-
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");
|
|
17975
18393
|
try {
|
|
17976
18394
|
await (0, import_promises7.mkdir)(tmpDir, { recursive: true });
|
|
17977
18395
|
const filePaths = normalizeFilePaths2(manifest.files);
|
|
@@ -18028,14 +18446,14 @@ async function handlePublish(options) {
|
|
|
18028
18446
|
throw new CLIError('\u274C Not logged in. Run "prpm login" first.', 1);
|
|
18029
18447
|
}
|
|
18030
18448
|
console.log("\u{1F4E6} Publishing package...\n");
|
|
18031
|
-
const prpmJsonPath = (0,
|
|
18032
|
-
const marketplaceJsonPath = (0,
|
|
18033
|
-
const marketplaceJsonPluginPath = (0,
|
|
18034
|
-
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);
|
|
18035
18453
|
if (!hasManifest) {
|
|
18036
18454
|
console.log("No prpm.json found. Let's create one first.\n");
|
|
18037
18455
|
await smartInit({});
|
|
18038
|
-
if (!(0,
|
|
18456
|
+
if (!(0, import_fs15.existsSync)(prpmJsonPath)) {
|
|
18039
18457
|
throw new CLIError("No prpm.json was created. Cannot publish without a manifest.", 1);
|
|
18040
18458
|
}
|
|
18041
18459
|
console.log("\n\u{1F4E6} Continuing with publish...\n");
|
|
@@ -18044,7 +18462,7 @@ async function handlePublish(options) {
|
|
|
18044
18462
|
const { manifests, collections, source } = await findAndLoadManifests();
|
|
18045
18463
|
if (source === "prpm.json (multi-package)" || source === "prpm.json") {
|
|
18046
18464
|
try {
|
|
18047
|
-
const prpmJsonPath2 = (0,
|
|
18465
|
+
const prpmJsonPath2 = (0, import_path17.join)(process.cwd(), "prpm.json");
|
|
18048
18466
|
const prpmContent = await (0, import_promises7.readFile)(prpmJsonPath2, "utf-8");
|
|
18049
18467
|
const prpmManifest = JSON.parse(prpmContent);
|
|
18050
18468
|
if (prpmManifest.scripts) {
|
|
@@ -19222,15 +19640,15 @@ function createConfigCommand() {
|
|
|
19222
19640
|
init_cjs_shims();
|
|
19223
19641
|
var import_commander21 = require("commander");
|
|
19224
19642
|
var import_promises8 = require("fs/promises");
|
|
19225
|
-
var
|
|
19643
|
+
var import_path18 = require("path");
|
|
19226
19644
|
init_telemetry();
|
|
19227
19645
|
init_lockfile();
|
|
19228
19646
|
init_errors();
|
|
19229
19647
|
function detectPackageInfo(filePath, content) {
|
|
19230
|
-
const fileName = (0,
|
|
19648
|
+
const fileName = (0, import_path18.basename)(filePath);
|
|
19231
19649
|
const lowerFileName = fileName.toLowerCase();
|
|
19232
19650
|
if (fileName === "SKILL.md") {
|
|
19233
|
-
const dirName = (0,
|
|
19651
|
+
const dirName = (0, import_path18.basename)((0, import_path18.join)(filePath, ".."));
|
|
19234
19652
|
return {
|
|
19235
19653
|
format: "claude",
|
|
19236
19654
|
subtype: "skill",
|
|
@@ -19282,8 +19700,8 @@ async function scanDirectory3(dirPath, baseDir, scanDir, maxDepth = 5, currentDe
|
|
|
19282
19700
|
try {
|
|
19283
19701
|
const entries = await (0, import_promises8.readdir)(dirPath, { withFileTypes: true });
|
|
19284
19702
|
for (const entry of entries) {
|
|
19285
|
-
const fullPath = (0,
|
|
19286
|
-
const relativePath = (0,
|
|
19703
|
+
const fullPath = (0, import_path18.join)(dirPath, entry.name);
|
|
19704
|
+
const relativePath = (0, import_path18.relative)(baseDir, fullPath);
|
|
19287
19705
|
if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist" || entry.name === "build") {
|
|
19288
19706
|
continue;
|
|
19289
19707
|
}
|
|
@@ -19420,7 +19838,7 @@ async function handleCatalog(directories, options) {
|
|
|
19420
19838
|
success = true;
|
|
19421
19839
|
return;
|
|
19422
19840
|
}
|
|
19423
|
-
const prpmJsonPath = options.output || (0,
|
|
19841
|
+
const prpmJsonPath = options.output || (0, import_path18.join)(process.cwd(), "prpm.json");
|
|
19424
19842
|
let manifest;
|
|
19425
19843
|
if (options.append) {
|
|
19426
19844
|
try {
|
|
@@ -19458,7 +19876,7 @@ async function handleCatalog(directories, options) {
|
|
|
19458
19876
|
}
|
|
19459
19877
|
let description = `${discovered.format} ${discovered.subtype}`;
|
|
19460
19878
|
try {
|
|
19461
|
-
const firstFilePath = (0,
|
|
19879
|
+
const firstFilePath = (0, import_path18.join)(process.cwd(), discovered.scanDir, discovered.files[0]);
|
|
19462
19880
|
const content = await (0, import_promises8.readFile)(firstFilePath, "utf-8");
|
|
19463
19881
|
const extractedDesc = extractDescription6(content);
|
|
19464
19882
|
if (extractedDesc) {
|
|
@@ -20709,57 +21127,57 @@ function createStarredCommand() {
|
|
|
20709
21127
|
init_cjs_shims();
|
|
20710
21128
|
var import_commander27 = require("commander");
|
|
20711
21129
|
var import_promises9 = require("fs/promises");
|
|
20712
|
-
var
|
|
20713
|
-
var
|
|
21130
|
+
var import_path19 = require("path");
|
|
21131
|
+
var import_fs16 = require("fs");
|
|
20714
21132
|
var import_readline = require("readline");
|
|
20715
21133
|
var import_chalk2 = __toESM(require_source());
|
|
20716
21134
|
init_errors();
|
|
20717
21135
|
init_dist();
|
|
20718
21136
|
function getDefaultPath(format, filename, subtype, customName) {
|
|
20719
|
-
const baseName = customName || (0,
|
|
21137
|
+
const baseName = customName || (0, import_path19.basename)(filename, (0, import_path19.extname)(filename));
|
|
20720
21138
|
switch (format) {
|
|
20721
21139
|
case "cursor":
|
|
20722
21140
|
if (subtype === "slash-command") {
|
|
20723
|
-
return (0,
|
|
21141
|
+
return (0, import_path19.join)(process.cwd(), ".cursor", "commands", `${baseName}.md`);
|
|
20724
21142
|
}
|
|
20725
|
-
return (0,
|
|
21143
|
+
return (0, import_path19.join)(process.cwd(), ".cursor", "rules", `${baseName}.mdc`);
|
|
20726
21144
|
case "claude":
|
|
20727
21145
|
if (subtype === "skill") {
|
|
20728
|
-
return (0,
|
|
21146
|
+
return (0, import_path19.join)(process.cwd(), ".claude", "skills", baseName, "SKILL.md");
|
|
20729
21147
|
} else if (subtype === "slash-command") {
|
|
20730
|
-
return (0,
|
|
21148
|
+
return (0, import_path19.join)(process.cwd(), ".claude", "commands", `${baseName}.md`);
|
|
20731
21149
|
} else {
|
|
20732
|
-
return (0,
|
|
21150
|
+
return (0, import_path19.join)(process.cwd(), ".claude", "agents", `${baseName}.md`);
|
|
20733
21151
|
}
|
|
20734
21152
|
case "windsurf":
|
|
20735
|
-
return (0,
|
|
21153
|
+
return (0, import_path19.join)(process.cwd(), ".windsurf", "rules", `${baseName}.md`);
|
|
20736
21154
|
case "kiro":
|
|
20737
21155
|
if (subtype === "hook") {
|
|
20738
|
-
return (0,
|
|
21156
|
+
return (0, import_path19.join)(process.cwd(), ".kiro", "hooks", `${baseName}.kiro.hook`);
|
|
20739
21157
|
}
|
|
20740
21158
|
if (subtype === "agent") {
|
|
20741
|
-
return (0,
|
|
21159
|
+
return (0, import_path19.join)(process.cwd(), ".kiro", "agents", `${baseName}.json`);
|
|
20742
21160
|
}
|
|
20743
|
-
return (0,
|
|
21161
|
+
return (0, import_path19.join)(process.cwd(), ".kiro", "steering", `${baseName}.md`);
|
|
20744
21162
|
case "copilot":
|
|
20745
|
-
return (0,
|
|
21163
|
+
return (0, import_path19.join)(process.cwd(), ".github", "instructions", `${baseName}.instructions.md`);
|
|
20746
21164
|
case "continue":
|
|
20747
21165
|
if (subtype === "slash-command" || subtype === "prompt") {
|
|
20748
|
-
return (0,
|
|
21166
|
+
return (0, import_path19.join)(process.cwd(), ".continue", "prompts", `${baseName}.md`);
|
|
20749
21167
|
}
|
|
20750
|
-
return (0,
|
|
21168
|
+
return (0, import_path19.join)(process.cwd(), ".continue", "rules", `${baseName}.md`);
|
|
20751
21169
|
case "agents.md":
|
|
20752
|
-
return (0,
|
|
21170
|
+
return (0, import_path19.join)(process.cwd(), "agents.md");
|
|
20753
21171
|
case "gemini":
|
|
20754
|
-
return (0,
|
|
21172
|
+
return (0, import_path19.join)(process.cwd(), ".gemini", "commands", `${baseName}.toml`);
|
|
20755
21173
|
case "ruler":
|
|
20756
|
-
return (0,
|
|
21174
|
+
return (0, import_path19.join)(process.cwd(), ".ruler", `${baseName}.md`);
|
|
20757
21175
|
default:
|
|
20758
21176
|
throw new CLIError(`Unknown format: ${format}`);
|
|
20759
21177
|
}
|
|
20760
21178
|
}
|
|
20761
21179
|
function detectFormat(content, filepath) {
|
|
20762
|
-
const ext = (0,
|
|
21180
|
+
const ext = (0, import_path19.extname)(filepath).toLowerCase();
|
|
20763
21181
|
if (ext === ".mdc" || filepath.includes(".cursor/rules") || filepath.includes(".cursor/commands")) {
|
|
20764
21182
|
return "cursor";
|
|
20765
21183
|
}
|
|
@@ -20781,7 +21199,7 @@ function detectFormat(content, filepath) {
|
|
|
20781
21199
|
if (filepath.includes(".continue/rules") || filepath.includes(".continue/prompts") || filepath.includes(".continuerules")) {
|
|
20782
21200
|
return "continue";
|
|
20783
21201
|
}
|
|
20784
|
-
if ((0,
|
|
21202
|
+
if ((0, import_path19.basename)(filepath) === "agents.md") {
|
|
20785
21203
|
return "agents.md";
|
|
20786
21204
|
}
|
|
20787
21205
|
if (ext === ".toml" || filepath.includes(".gemini/commands")) {
|
|
@@ -20939,14 +21357,14 @@ async function handleConvert(sourcePath, options) {
|
|
|
20939
21357
|
}
|
|
20940
21358
|
console.log(import_chalk2.default.green(`\u2713 Converted from ${sourceFormat} to ${options.to}`));
|
|
20941
21359
|
const outputPath = options.output || getDefaultPath(options.to, sourcePath, options.subtype, options.name);
|
|
20942
|
-
if ((0,
|
|
21360
|
+
if ((0, import_fs16.existsSync)(outputPath) && !options.yes) {
|
|
20943
21361
|
const shouldOverwrite = await confirmOverwrite(outputPath);
|
|
20944
21362
|
if (!shouldOverwrite) {
|
|
20945
21363
|
console.log(import_chalk2.default.yellow("\n\u2716 Conversion cancelled"));
|
|
20946
21364
|
return;
|
|
20947
21365
|
}
|
|
20948
21366
|
}
|
|
20949
|
-
const outputDir = (0,
|
|
21367
|
+
const outputDir = (0, import_path19.dirname)(outputPath);
|
|
20950
21368
|
await (0, import_promises9.mkdir)(outputDir, { recursive: true });
|
|
20951
21369
|
console.log(import_chalk2.default.dim("Writing converted file..."));
|
|
20952
21370
|
await (0, import_promises9.writeFile)(outputPath, result.content, "utf-8");
|
|
@@ -21012,8 +21430,8 @@ Valid subtypes: ${validSubtypes.join(", ")}`
|
|
|
21012
21430
|
// src/commands/export.ts
|
|
21013
21431
|
init_cjs_shims();
|
|
21014
21432
|
var import_commander28 = require("commander");
|
|
21015
|
-
var
|
|
21016
|
-
var
|
|
21433
|
+
var import_fs17 = require("fs");
|
|
21434
|
+
var import_path20 = require("path");
|
|
21017
21435
|
var import_chalk3 = __toESM(require_source());
|
|
21018
21436
|
init_errors();
|
|
21019
21437
|
init_lockfile();
|
|
@@ -21029,17 +21447,17 @@ async function exportToRuler(options) {
|
|
|
21029
21447
|
}
|
|
21030
21448
|
console.log(import_chalk3.default.green(`\u2713 Found ${packages.length} installed package${packages.length === 1 ? "" : "s"}`));
|
|
21031
21449
|
console.log();
|
|
21032
|
-
const outputDir = options.output || (0,
|
|
21450
|
+
const outputDir = options.output || (0, import_path20.join)(process.cwd(), ".ruler");
|
|
21033
21451
|
let rulerExists = false;
|
|
21034
21452
|
try {
|
|
21035
|
-
await
|
|
21453
|
+
await import_fs17.promises.access(outputDir);
|
|
21036
21454
|
rulerExists = true;
|
|
21037
21455
|
} catch {
|
|
21038
21456
|
}
|
|
21039
21457
|
if (!rulerExists) {
|
|
21040
21458
|
console.log(import_chalk3.default.yellow(`\u26A0 ${outputDir} directory not found`));
|
|
21041
21459
|
console.log(import_chalk3.default.dim("Creating .ruler directory..."));
|
|
21042
|
-
await
|
|
21460
|
+
await import_fs17.promises.mkdir(outputDir, { recursive: true });
|
|
21043
21461
|
console.log(import_chalk3.default.green(`\u2713 Created ${outputDir}/`));
|
|
21044
21462
|
console.log();
|
|
21045
21463
|
}
|
|
@@ -21053,11 +21471,11 @@ async function exportToRuler(options) {
|
|
|
21053
21471
|
continue;
|
|
21054
21472
|
}
|
|
21055
21473
|
try {
|
|
21056
|
-
const content = await
|
|
21474
|
+
const content = await import_fs17.promises.readFile(pkg.installedPath, "utf-8");
|
|
21057
21475
|
const rulerContent = createRulerFormat(pkg.id, pkg.version, content, pkg.format, pkg.subtype);
|
|
21058
21476
|
const rulerFilename = `${packageName}.md`;
|
|
21059
|
-
const rulerPath = (0,
|
|
21060
|
-
await
|
|
21477
|
+
const rulerPath = (0, import_path20.join)(outputDir, rulerFilename);
|
|
21478
|
+
await import_fs17.promises.writeFile(rulerPath, rulerContent, "utf-8");
|
|
21061
21479
|
console.log(import_chalk3.default.green(`\u2713 Exported ${pkg.id} \u2192 ${rulerFilename}`));
|
|
21062
21480
|
exportedCount++;
|
|
21063
21481
|
} catch (error) {
|
|
@@ -21096,9 +21514,9 @@ function createRulerFormat(packageId, version, content, format, subtype) {
|
|
|
21096
21514
|
return frontmatter + contentWithoutFrontmatter;
|
|
21097
21515
|
}
|
|
21098
21516
|
async function ensureRulerConfig(rulerDir) {
|
|
21099
|
-
const configPath = (0,
|
|
21517
|
+
const configPath = (0, import_path20.join)((0, import_path20.dirname)(rulerDir), "ruler.toml");
|
|
21100
21518
|
try {
|
|
21101
|
-
await
|
|
21519
|
+
await import_fs17.promises.access(configPath);
|
|
21102
21520
|
console.log(import_chalk3.default.dim("\u2139 ruler.toml already exists (not modified)"));
|
|
21103
21521
|
} catch {
|
|
21104
21522
|
const basicConfig = `# Ruler Configuration
|
|
@@ -21124,7 +21542,7 @@ async function ensureRulerConfig(rulerDir) {
|
|
|
21124
21542
|
# [agents.github-copilot]
|
|
21125
21543
|
# enabled = false
|
|
21126
21544
|
`;
|
|
21127
|
-
await
|
|
21545
|
+
await import_fs17.promises.writeFile(configPath, basicConfig, "utf-8");
|
|
21128
21546
|
console.log(import_chalk3.default.green(`\u2713 Created ruler.toml configuration template`));
|
|
21129
21547
|
}
|
|
21130
21548
|
}
|
|
@@ -21194,8 +21612,8 @@ init_telemetry();
|
|
|
21194
21612
|
init_errors();
|
|
21195
21613
|
function getVersion() {
|
|
21196
21614
|
try {
|
|
21197
|
-
const packageJsonPath = (0,
|
|
21198
|
-
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"));
|
|
21199
21617
|
return packageJson.version || "0.0.0";
|
|
21200
21618
|
} catch {
|
|
21201
21619
|
return "0.0.0";
|