plugins 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +11 -23
  2. 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, hookCount, hasMcp, hasLsp] = await Promise.all([
96
+ const [commands, agents, rules, hasHooks, hasMcp, hasLsp] = await Promise.all([
97
97
  discoverCommands(sourcePath),
98
98
  discoverAgents(sourcePath),
99
99
  discoverRules(sourcePath),
100
- countHooks(sourcePath),
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
- hookCount,
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, hookCount, hasMcp, hasLsp] = await Promise.all([
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
- countHooks(pluginPath),
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
- hookCount,
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.hookCount) parts.push(`${p.hookCount} ${p.hookCount === 1 ? "hook" : "hooks"}`);
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,6 +1264,10 @@ 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
+ rl.on("close", () => {
1268
+ process.stdout.write("\n");
1269
+ process.exit(0);
1270
+ });
1283
1271
  rl.question(prompt, (answer) => {
1284
1272
  rl.close();
1285
1273
  if (!process.stdin.isTTY) process.stdout.write("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugins",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Install open-plugin format plugins into agent tools",
5
5
  "type": "module",
6
6
  "bin": {