claudepluginhub 0.13.0 → 0.14.0

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.
@@ -204,6 +204,10 @@ export function scanEquivalent(aRecord, aScan, bRecord, bScan) {
204
204
  return false;
205
205
  if (sortedStrings(aScan.themeFiles).join('\0') !== sortedStrings(bScan.themeFiles).join('\0'))
206
206
  return false;
207
+ // Two installations with different workflow scripts register different slash
208
+ // commands — never collapse them into one "equivalent" row.
209
+ if (sortedStrings(aScan.workflowFiles).join('\0') !== sortedStrings(bScan.workflowFiles).join('\0'))
210
+ return false;
207
211
  if (sortedStrings(aScan.parseErrors).join('\0') !== sortedStrings(bScan.parseErrors).join('\0'))
208
212
  return false;
209
213
  if (sortedStrings(aScan.symlinksSkipped).join('\0') !== sortedStrings(bScan.symlinksSkipped).join('\0'))
@@ -52,6 +52,8 @@ function capsSummary(caps) {
52
52
  parts.push(`lsp: ${caps.lsp.total}`);
53
53
  if (caps.monitors.total > 0)
54
54
  parts.push(`monitors: ${caps.monitors.total}`);
55
+ if (caps.workflowCount > 0)
56
+ parts.push(`workflows: ${caps.workflowCount}`);
55
57
  if (caps.binCount > 0)
56
58
  parts.push(`bin: ${caps.binCount}`);
57
59
  return parts.length > 0 ? parts.join(', ') : 'none';
@@ -61,6 +61,7 @@ export function createScanner(overrides) {
61
61
  mcp: [],
62
62
  lsp: [],
63
63
  monitors: [],
64
+ workflowFiles: [],
64
65
  bin: [],
65
66
  parseErrors: [],
66
67
  symlinksSkipped: [],
@@ -979,6 +980,8 @@ function scanPlugin(rootCanonical, state, result, read, walk, openDirect) {
979
980
  ['mcpServers', manifest.mcpServers, isPathArrayOrObject],
980
981
  ['lspServers', manifest.lspServers, isPathArrayOrObject],
981
982
  ['monitors', monitorsValue, isPathArrayOrObject],
983
+ // Top-level only — `workflows` is NOT an `experimental.*` field.
984
+ ['workflows', manifest.workflows, isPathOrArray],
982
985
  ['dependencies', manifest.dependencies, (v) => Array.isArray(v)],
983
986
  ];
984
987
  for (const [field, value, valid] of checks) {
@@ -1022,6 +1025,7 @@ function scanPlugin(rootCanonical, state, result, read, walk, openDirect) {
1022
1025
  ...boundPaths(stringPaths(manifest.mcpServers), state),
1023
1026
  ...boundPaths(stringPaths(manifest.lspServers), state),
1024
1027
  ...boundPaths(stringPaths(manifest.monitors !== undefined ? manifest.monitors : experimental.monitors), state),
1028
+ ...boundPaths(stringPaths(manifest.workflows), state),
1025
1029
  ];
1026
1030
  for (const rel of [...new Set(declared)].sort()) {
1027
1031
  // Contained lexical resolve first: a "../…" or absolute declaration is
@@ -1177,6 +1181,68 @@ function scanPlugin(rootCanonical, state, result, read, walk, openDirect) {
1177
1181
  if (inline.length > 0)
1178
1182
  pushFacts(result.monitors, parseMonitorEntries(inline));
1179
1183
  }
1184
+ // --- workflows/ (spec: top-level manifest field, REPLACES the default dir) --
1185
+ // Mirrors the measured loader behaviour, which is narrower than every other
1186
+ // component scan here:
1187
+ // - `.js` ONLY, matched case-sensitively (`W.JS` is silently not loaded)
1188
+ // - direct children only — `workflows/sub/w.js` never loads
1189
+ // Files are LISTED, never read and never executed. The invocation name lives
1190
+ // in the script's `export const meta`, which needs a JS parser the CLI does
1191
+ // not ship, so no name is claimed here.
1192
+ const workflowsRoots = boundPaths(stringPaths(manifest.workflows), state);
1193
+ for (const root of workflowsRoots.length > 0 ? [...new Set(workflowsRoots)].sort() : ['workflows']) {
1194
+ const dirReal = containedReal(rootCanonical, root, state);
1195
+ if (dirReal === null)
1196
+ continue;
1197
+ let entries = [];
1198
+ try {
1199
+ entries = readdirSync(dirReal).sort();
1200
+ }
1201
+ catch {
1202
+ entries = [];
1203
+ }
1204
+ if (entries.length > MAX_KEYS) {
1205
+ state.limitsHit.add('max-facts');
1206
+ state.incomplete = true;
1207
+ }
1208
+ for (const entry of entries.slice(0, MAX_KEYS)) {
1209
+ // Case-SENSITIVE: the loader does not lowercase, so `W.JS` is not a workflow.
1210
+ if (!entry.endsWith('.js'))
1211
+ continue;
1212
+ const abs = join(dirReal, entry);
1213
+ let info;
1214
+ try {
1215
+ info = lstatSync(abs);
1216
+ }
1217
+ catch {
1218
+ continue;
1219
+ }
1220
+ // Same containment rule as bin/ below: `statSync` alone FOLLOWS symlinks,
1221
+ // so an entry resolving outside the plugin root would be listed as a
1222
+ // legitimate workflow of this plugin and the report would not be marked
1223
+ // incomplete — the one signal that tells the reader the scan was bounded.
1224
+ if (info.isSymbolicLink()) {
1225
+ try {
1226
+ const real = realpathSync(abs);
1227
+ if (!isWithin(rootCanonical, real)) {
1228
+ state.symlinksSkipped.push(`${root}/${entry}`);
1229
+ state.incomplete = true;
1230
+ continue;
1231
+ }
1232
+ info = statSync(real);
1233
+ }
1234
+ catch {
1235
+ state.symlinksSkipped.push(`${root}/${entry}`);
1236
+ state.incomplete = true;
1237
+ continue;
1238
+ }
1239
+ }
1240
+ if (!info.isFile())
1241
+ continue;
1242
+ state.filesScanned += 1;
1243
+ result.workflowFiles.push(`${root}/${entry}`);
1244
+ }
1245
+ }
1180
1246
  // --- bin/ (spec: on PATH while the plugin is enabled; tree-only, no manifest) --------
1181
1247
  // The directory itself goes through the contained-realpath helper: a bin/
1182
1248
  // that is a symlink pointing outside the root must not be listed at all.
@@ -167,6 +167,8 @@ export interface ScanResult {
167
167
  mcp: McpFact[];
168
168
  lsp: LspFact[];
169
169
  monitors: MonitorFact[];
170
+ /** Plugin-relative paths of workflow scripts. Never read/parsed — never executed. */
171
+ workflowFiles: string[];
170
172
  bin: {
171
173
  relPath: string;
172
174
  executable: boolean;
@@ -228,6 +230,18 @@ export interface PluginCapabilities {
228
230
  executable: string | null;
229
231
  }>;
230
232
  binCount: number;
233
+ /**
234
+ * Count of `workflows/` scripts found (default dir or the manifest's
235
+ * replaces-default path; `.js`, direct children only).
236
+ *
237
+ * A COUNT, not a per-item list, deliberately: the invocation name a workflow
238
+ * registers lives in its `export const meta = {…}`, and extracting that
239
+ * requires a JS parser the CLI does not ship. Emitting file basenames as if
240
+ * they were command names would be a fabricated claim — the runtime uses
241
+ * `meta.name`, which frequently differs from the filename. Report what we can
242
+ * actually see.
243
+ */
244
+ workflowCount: number;
231
245
  }
232
246
  export interface PluginEntry {
233
247
  id: string;
@@ -89,6 +89,7 @@ function capabilities(scan) {
89
89
  executable: m.command?.executable ?? null,
90
90
  })), MAX_CAPABILITY_ITEMS),
91
91
  binCount: scan.bin.length,
92
+ workflowCount: scan.workflowFiles.length,
92
93
  };
93
94
  }
94
95
  function makeEntry(record, selection, scan) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudepluginhub",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Install Claude Code components from ClaudePluginHub",
5
5
  "bin": {
6
6
  "claudepluginhub": "dist/index.js"