claudepluginhub 0.15.0 → 0.16.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/index.js CHANGED
@@ -62,6 +62,7 @@ never file contents):
62
62
  attempted installs are reported)
63
63
  recommend --limit 6 Results per stack (1-50, default 4)
64
64
  recommend --json Raw JSON output (never interactive)
65
+ recommend --source plugin Attribution tag for wrappers (cli|plugin; default cli)
65
66
 
66
67
  Options:
67
68
  --plugin <name> Install a specific plugin from a marketplace repo
@@ -1,3 +1,18 @@
1
+ /**
2
+ * `npx claudepluginhub recommend` — instant plugin recommendations for the
3
+ * current project. Reads local manifest dependency NAMES and telltale config
4
+ * FILENAMES (never file contents, never CLAUDE.md) and POSTs them to
5
+ * /api/recommend, where they resolve to vocabulary stacks server-side.
6
+ */
7
+ /**
8
+ * Analytics source tag sent as `?source=`. Default `cli`; the Claude Code
9
+ * plugin (which wraps this command) passes `--source plugin` so plugin-driven
10
+ * usage stays separable from direct CLI usage in readouts. Allowlisted here
11
+ * AND server-side (`resolveSource`); unknown values are rejected at parse so
12
+ * a typo can't silently degrade to the server's `web` fallback.
13
+ */
14
+ declare const RECOMMEND_SOURCES: readonly ["cli", "plugin"];
15
+ export type RecommendSource = (typeof RECOMMEND_SOURCES)[number];
1
16
  /**
2
17
  * Hard cap on plugins selectable in one interactive recommend run. Deliberate
3
18
  * selection-safety bound: the selector has no select-all and every item starts
@@ -10,6 +25,7 @@ export declare const RECOMMEND_MAX_SELECTIONS = 5;
10
25
  export interface RecommendFlags {
11
26
  limit: number;
12
27
  json: boolean;
28
+ source: RecommendSource;
13
29
  }
14
30
  export declare function parseRecommendFlags(argv: string[]): RecommendFlags;
15
31
  export declare function parsePackageJsonDeps(content: string): string[];
package/dist/recommend.js CHANGED
@@ -11,7 +11,17 @@ import { print, printBanner, printStep, printSuccess, printFail, printError, BOL
11
11
  * FILENAMES (never file contents, never CLAUDE.md) and POSTs them to
12
12
  * /api/recommend, where they resolve to vocabulary stacks server-side.
13
13
  */
14
- const RECOMMEND_URL = `${BASE_URL}/api/recommend?source=cli`;
14
+ /**
15
+ * Analytics source tag sent as `?source=`. Default `cli`; the Claude Code
16
+ * plugin (which wraps this command) passes `--source plugin` so plugin-driven
17
+ * usage stays separable from direct CLI usage in readouts. Allowlisted here
18
+ * AND server-side (`resolveSource`); unknown values are rejected at parse so
19
+ * a typo can't silently degrade to the server's `web` fallback.
20
+ */
21
+ const RECOMMEND_SOURCES = ['cli', 'plugin'];
22
+ function recommendUrl(source) {
23
+ return `${BASE_URL}/api/recommend?source=${source}`;
24
+ }
15
25
  /** Server-side body caps (mirrors the /api/recommend Zod schema). */
16
26
  const MAX_DEPENDENCIES = 500;
17
27
  const MAX_FILES = 200;
@@ -85,6 +95,16 @@ const TELLTALE_PREFIXES = [
85
95
  export function parseRecommendFlags(argv) {
86
96
  const json = argv.includes('--json');
87
97
  let limit = DEFAULT_LIMIT;
98
+ let source = 'cli';
99
+ const sourceIdx = argv.indexOf('--source');
100
+ if (sourceIdx !== -1) {
101
+ const val = argv[sourceIdx + 1];
102
+ if (!val || !RECOMMEND_SOURCES.includes(val)) {
103
+ printError(`Invalid --source "${val ?? ''}". Must be one of: ${RECOMMEND_SOURCES.join(', ')}`);
104
+ process.exit(1);
105
+ }
106
+ source = val;
107
+ }
88
108
  const limitIdx = argv.indexOf('--limit');
89
109
  if (limitIdx !== -1) {
90
110
  const val = argv[limitIdx + 1];
@@ -99,7 +119,7 @@ export function parseRecommendFlags(argv) {
99
119
  }
100
120
  limit = parsed;
101
121
  }
102
- return { limit, json };
122
+ return { limit, json, source };
103
123
  }
104
124
  /** Strip a Python requirement spec down to the bare package name. */
105
125
  function pythonDepName(spec) {
@@ -364,7 +384,7 @@ export function runsCodeFlag(item) {
364
384
  return item.runsCode === true;
365
385
  }
366
386
  export async function runRecommend(argv) {
367
- const { limit, json } = parseRecommendFlags(argv);
387
+ const { limit, json, source } = parseRecommendFlags(argv);
368
388
  if (!json)
369
389
  printBanner();
370
390
  const signals = collectProjectSignals(process.cwd());
@@ -378,7 +398,7 @@ export async function runRecommend(argv) {
378
398
  }
379
399
  let response;
380
400
  try {
381
- response = await fetch(RECOMMEND_URL, {
401
+ response = await fetch(recommendUrl(source), {
382
402
  method: 'POST',
383
403
  headers: { 'content-type': 'application/json' },
384
404
  body: JSON.stringify({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudepluginhub",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Install Claude Code components from ClaudePluginHub",
5
5
  "bin": {
6
6
  "claudepluginhub": "dist/index.js"