claudepluginhub 0.9.0 → 0.11.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.
package/dist/recommend.js CHANGED
@@ -13,7 +13,12 @@ const RECOMMEND_URL = `${BASE_URL}/api/recommend?source=cli`;
13
13
  const MAX_DEPENDENCIES = 500;
14
14
  const MAX_FILES = 200;
15
15
  const MAX_DEP_LENGTH = 128;
16
- const DEFAULT_LIMIT = 10;
16
+ /**
17
+ * `--limit` is recommendations PER detected stack: the output is grouped into a
18
+ * "For {Stack}:" section per stack, not one fused list. 4 keeps each section
19
+ * tight while covering the project's main stacks.
20
+ */
21
+ const DEFAULT_LIMIT = 4;
17
22
  const MAX_LIMIT = 50;
18
23
  /**
19
24
  * Telltale filename prefixes. Privacy allowlist: when a cwd entry matches a
@@ -262,6 +267,50 @@ function formatCount(n) {
262
267
  function truncate(text, max) {
263
268
  return text.length > max ? `${text.slice(0, max - 1).trimEnd()}…` : text;
264
269
  }
270
+ /**
271
+ * Prettify a vocabulary stack tag for a section header. This is a curated subset
272
+ * of the site's `formatStackName` special-cases (the CLI can't import site
273
+ * types, so it's hand-kept — not a full mirror, and may lag/drift slightly);
274
+ * anything not listed falls back to title-casing the hyphen/space tokens.
275
+ */
276
+ const STACK_LABELS = {
277
+ nextjs: 'Next.js',
278
+ nuxt: 'Nuxt',
279
+ nodejs: 'Node.js',
280
+ node: 'Node.js',
281
+ postgresql: 'PostgreSQL',
282
+ mysql: 'MySQL',
283
+ mongodb: 'MongoDB',
284
+ sqlite: 'SQLite',
285
+ graphql: 'GraphQL',
286
+ typescript: 'TypeScript',
287
+ javascript: 'JavaScript',
288
+ tailwind: 'Tailwind',
289
+ 'shadcn-ui': 'shadcn/ui',
290
+ 'react-native': 'React Native',
291
+ sveltekit: 'SvelteKit',
292
+ nestjs: 'NestJS',
293
+ trpc: 'tRPC',
294
+ fastapi: 'FastAPI',
295
+ eslint: 'ESLint',
296
+ prettier: 'Prettier',
297
+ biome: 'Biome',
298
+ pnpm: 'pnpm',
299
+ 'docker-compose': 'Docker Compose',
300
+ dotnet: '.NET',
301
+ github: 'GitHub',
302
+ openai: 'OpenAI',
303
+ aws: 'AWS',
304
+ gcp: 'GCP',
305
+ };
306
+ function formatStackLabel(stack) {
307
+ if (STACK_LABELS[stack])
308
+ return STACK_LABELS[stack];
309
+ return stack
310
+ .split(/[-\s]+/)
311
+ .map((w) => (w ? w[0].toUpperCase() + w.slice(1) : w))
312
+ .join(' ');
313
+ }
265
314
  export async function runRecommend(argv) {
266
315
  const { limit, json } = parseRecommendFlags(argv);
267
316
  if (!json)
@@ -310,7 +359,18 @@ export async function runRecommend(argv) {
310
359
  print(JSON.stringify(body, null, 2));
311
360
  return;
312
361
  }
313
- if (body.results.length === 0) {
362
+ // A well-formed 200 always carries `sections` (the POST contract). A missing
363
+ // array is a server contract break / version skew — NOT "no data" — so surface
364
+ // it rather than masking it as the reassuring empty state below (mirrors the
365
+ // site picker, which lets a missing `results` throw into its error state so a
366
+ // broken response never reads as "your stack is unsupported").
367
+ if (!Array.isArray(body.sections)) {
368
+ printError('Unexpected response from the recommend API (missing sections). Please try again later.');
369
+ process.exit(1);
370
+ }
371
+ const sections = body.sections;
372
+ const total = sections.reduce((sum, s) => sum + s.results.length, 0);
373
+ if (total === 0) {
314
374
  print('');
315
375
  print(`No recommendations yet for: ${body.stacks.join(', ')}`);
316
376
  print(`${DIM}Browse plugins at ${BASE_URL}/plugins${RESET}`);
@@ -319,17 +379,22 @@ export async function runRecommend(argv) {
319
379
  print('');
320
380
  print(`${BOLD}Recommended for:${RESET} ${CYAN}${body.stacks.join(' + ')}${RESET}`);
321
381
  if (body.droppedStacks && body.droppedStacks.length > 0) {
322
- print(`${DIM}(also detected: ${body.droppedStacks.join(', ')} — one request fuses at most ${body.stacks.length} stacks)${RESET}`);
382
+ print(`${DIM}(also detected: ${body.droppedStacks.join(', ')} — showing your ${body.stacks.length} most specific stacks)${RESET}`);
323
383
  }
324
384
  print('');
325
- body.results.forEach((item, i) => {
326
- const rank = `${String(i + 1).padStart(2)}.`;
327
- const stars = item.starCount > 0 ? ` ${YELLOW}★ ${formatCount(item.starCount)}${RESET}` : '';
328
- print(`${BOLD}${rank} ${item.name}${RESET}${stars}`);
329
- if (item.description) {
330
- print(` ${DIM}${truncate(item.description, 90)}${RESET}`);
331
- }
332
- print(` ${CYAN}${item.install.command}${RESET}`);
385
+ // One "For {Stack}:" group per detected stack — each its own ranking, deduped
386
+ // server-side so a plugin never repeats across sections.
387
+ sections.forEach((section) => {
388
+ print(`${BOLD}For ${formatStackLabel(section.stack)}:${RESET}`);
389
+ section.results.forEach((item, i) => {
390
+ const rank = `${String(i + 1).padStart(2)}.`;
391
+ const stars = item.starCount > 0 ? ` ${YELLOW}★ ${formatCount(item.starCount)}${RESET}` : '';
392
+ print(` ${BOLD}${rank} ${item.name}${RESET}${stars}`);
393
+ if (item.description) {
394
+ print(` ${DIM}${truncate(item.description, 88)}${RESET}`);
395
+ }
396
+ print(` ${CYAN}${item.install.command}${RESET}`);
397
+ });
333
398
  print('');
334
399
  });
335
400
  // Link the always-live picker page, not /for/[stack] — low-coverage stacks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudepluginhub",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Install Claude Code components from ClaudePluginHub",
5
5
  "bin": {
6
6
  "claudepluginhub": "dist/index.js"