plugins 1.2.2 → 1.2.4
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 +15 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -93,11 +93,11 @@ async function discoverFromMarketplace(repoPath, marketplace) {
|
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
const [commands, agents, rules,
|
|
96
|
+
const [commands, agents, rules, hasHooks, hasMcp, hasLsp] = await Promise.all([
|
|
97
97
|
discoverCommands(sourcePath),
|
|
98
98
|
discoverAgents(sourcePath),
|
|
99
99
|
discoverRules(sourcePath),
|
|
100
|
-
|
|
100
|
+
fileExists(join(sourcePath, "hooks", "hooks.json")),
|
|
101
101
|
fileExists(join(sourcePath, ".mcp.json")),
|
|
102
102
|
fileExists(join(sourcePath, ".lsp.json"))
|
|
103
103
|
]);
|
|
@@ -112,7 +112,7 @@ async function discoverFromMarketplace(repoPath, marketplace) {
|
|
|
112
112
|
commands,
|
|
113
113
|
agents,
|
|
114
114
|
rules,
|
|
115
|
-
|
|
115
|
+
hasHooks,
|
|
116
116
|
hasMcp,
|
|
117
117
|
hasLsp,
|
|
118
118
|
manifest,
|
|
@@ -147,12 +147,12 @@ async function inspectPlugin(pluginPath) {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
const name = manifest?.name ?? dirName(pluginPath);
|
|
150
|
-
const [skills, commands, agents, rules,
|
|
150
|
+
const [skills, commands, agents, rules, hasHooks, hasMcp, hasLsp] = await Promise.all([
|
|
151
151
|
discoverSkills(pluginPath),
|
|
152
152
|
discoverCommands(pluginPath),
|
|
153
153
|
discoverAgents(pluginPath),
|
|
154
154
|
discoverRules(pluginPath),
|
|
155
|
-
|
|
155
|
+
fileExists(join(pluginPath, "hooks", "hooks.json")),
|
|
156
156
|
fileExists(join(pluginPath, ".mcp.json")),
|
|
157
157
|
fileExists(join(pluginPath, ".lsp.json"))
|
|
158
158
|
]);
|
|
@@ -166,7 +166,7 @@ async function inspectPlugin(pluginPath) {
|
|
|
166
166
|
commands,
|
|
167
167
|
agents,
|
|
168
168
|
rules,
|
|
169
|
-
|
|
169
|
+
hasHooks,
|
|
170
170
|
hasMcp,
|
|
171
171
|
hasLsp,
|
|
172
172
|
manifest,
|
|
@@ -298,22 +298,6 @@ async function dirExists(dirPath) {
|
|
|
298
298
|
async function pathExists(p) {
|
|
299
299
|
return existsSync(p);
|
|
300
300
|
}
|
|
301
|
-
async function countHooks(pluginPath) {
|
|
302
|
-
const data = await readJson(join(pluginPath, "hooks", "hooks.json"));
|
|
303
|
-
if (!data || typeof data.hooks !== "object" || data.hooks === null) return 0;
|
|
304
|
-
const events = data.hooks;
|
|
305
|
-
let count = 0;
|
|
306
|
-
for (const rules of Object.values(events)) {
|
|
307
|
-
if (!Array.isArray(rules)) continue;
|
|
308
|
-
for (const rule of rules) {
|
|
309
|
-
const inner = rule?.hooks;
|
|
310
|
-
if (Array.isArray(inner)) {
|
|
311
|
-
count += inner.length;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return count;
|
|
316
|
-
}
|
|
317
301
|
async function readJson(path) {
|
|
318
302
|
try {
|
|
319
303
|
const content = await readFile(path, "utf-8");
|
|
@@ -1172,7 +1156,7 @@ function pluginComponents(p) {
|
|
|
1172
1156
|
if (p.commands.length) parts.push(`${p.commands.length} ${p.commands.length === 1 ? "cmd" : "cmds"}`);
|
|
1173
1157
|
if (p.agents.length) parts.push(`${p.agents.length} ${p.agents.length === 1 ? "agent" : "agents"}`);
|
|
1174
1158
|
if (p.rules.length) parts.push(`${p.rules.length} ${p.rules.length === 1 ? "rule" : "rules"}`);
|
|
1175
|
-
if (p.
|
|
1159
|
+
if (p.hasHooks) parts.push("hooks");
|
|
1176
1160
|
if (p.hasMcp) parts.push("mcp");
|
|
1177
1161
|
if (p.hasLsp) parts.push("lsp");
|
|
1178
1162
|
return parts;
|
|
@@ -1280,7 +1264,15 @@ function resolveSource(source) {
|
|
|
1280
1264
|
function readLine(prompt) {
|
|
1281
1265
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
1282
1266
|
return new Promise((resolve2) => {
|
|
1267
|
+
let answered = false;
|
|
1268
|
+
rl.on("close", () => {
|
|
1269
|
+
if (!answered) {
|
|
1270
|
+
process.stdout.write("\n");
|
|
1271
|
+
process.exit(0);
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1283
1274
|
rl.question(prompt, (answer) => {
|
|
1275
|
+
answered = true;
|
|
1284
1276
|
rl.close();
|
|
1285
1277
|
if (!process.stdin.isTTY) process.stdout.write("\n");
|
|
1286
1278
|
resolve2(answer);
|