plugins 1.2.0 → 1.2.2

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +27 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -82,7 +82,7 @@ Discovery follows a 3-step fallback:
82
82
  2. **Root plugin** — checks if the repo root itself is a plugin
83
83
  3. **Recursive scan** — scans subdirectories (up to 2 levels deep) for plugin directories
84
84
 
85
- A plugin is any directory containing skills, commands, agents, rules, hooks, MCP servers, or LSP servers in the [open-plugin format](https://github.com/anthropics/open-plugin).
85
+ A plugin is any directory containing skills, commands, agents, rules, hooks, MCP servers, or LSP servers.
86
86
 
87
87
  ### Installation
88
88
 
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, hasHooks, hasMcp, hasLsp] = await Promise.all([
96
+ const [commands, agents, rules, hookCount, hasMcp, hasLsp] = await Promise.all([
97
97
  discoverCommands(sourcePath),
98
98
  discoverAgents(sourcePath),
99
99
  discoverRules(sourcePath),
100
- fileExists(join(sourcePath, "hooks", "hooks.json")),
100
+ countHooks(sourcePath),
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
- hasHooks,
115
+ hookCount,
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, hasHooks, hasMcp, hasLsp] = await Promise.all([
150
+ const [skills, commands, agents, rules, hookCount, hasMcp, hasLsp] = await Promise.all([
151
151
  discoverSkills(pluginPath),
152
152
  discoverCommands(pluginPath),
153
153
  discoverAgents(pluginPath),
154
154
  discoverRules(pluginPath),
155
- fileExists(join(pluginPath, "hooks", "hooks.json")),
155
+ countHooks(pluginPath),
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
- hasHooks,
169
+ hookCount,
170
170
  hasMcp,
171
171
  hasLsp,
172
172
  manifest,
@@ -298,6 +298,22 @@ 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
+ }
301
317
  async function readJson(path) {
302
318
  try {
303
319
  const content = await readFile(path, "utf-8");
@@ -1152,11 +1168,11 @@ async function cmdInstall(source, opts) {
1152
1168
  }
1153
1169
  function pluginComponents(p) {
1154
1170
  const parts = [];
1155
- if (p.skills.length) parts.push(`${p.skills.length} skill`);
1156
- if (p.commands.length) parts.push(`${p.commands.length} cmd`);
1157
- if (p.agents.length) parts.push(`${p.agents.length} agent`);
1158
- if (p.rules.length) parts.push(`${p.rules.length} rule`);
1159
- if (p.hasHooks) parts.push("hook");
1171
+ if (p.skills.length) parts.push(`${p.skills.length} ${p.skills.length === 1 ? "skill" : "skills"}`);
1172
+ if (p.commands.length) parts.push(`${p.commands.length} ${p.commands.length === 1 ? "cmd" : "cmds"}`);
1173
+ if (p.agents.length) parts.push(`${p.agents.length} ${p.agents.length === 1 ? "agent" : "agents"}`);
1174
+ 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"}`);
1160
1176
  if (p.hasMcp) parts.push("mcp");
1161
1177
  if (p.hasLsp) parts.push("lsp");
1162
1178
  return parts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugins",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Install open-plugin format plugins into agent tools",
5
5
  "type": "module",
6
6
  "bin": {