claudepluginhub 0.14.0 → 0.15.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.d.ts +65 -0
- package/dist/recommend.js +54 -3
- package/package.json +1 -1
package/dist/recommend.d.ts
CHANGED
|
@@ -32,4 +32,69 @@ export interface ProjectSignals {
|
|
|
32
32
|
* contributes nothing (its filename still signals via `files`).
|
|
33
33
|
*/
|
|
34
34
|
export declare function collectProjectSignals(cwd: string): ProjectSignals;
|
|
35
|
+
/**
|
|
36
|
+
* Response subset the CLI renders. Canonical contract:
|
|
37
|
+
* src/features/stack-recommendations/types.ts (RecommendApiResponse) — the
|
|
38
|
+
* CLI package can't import site types, so keep this in sync (additive server
|
|
39
|
+
* changes are safe; renames break the site's own consumers first).
|
|
40
|
+
*
|
|
41
|
+
* POST returns per-stack `sections` (not a fused `results` list): fusion buries
|
|
42
|
+
* the sharp single-stack specialists, so the CLI shows each detected stack's own
|
|
43
|
+
* top picks.
|
|
44
|
+
*/
|
|
45
|
+
interface RecommendResultItem {
|
|
46
|
+
slug: string;
|
|
47
|
+
name: string;
|
|
48
|
+
description: string | null;
|
|
49
|
+
starCount: number;
|
|
50
|
+
installCount: number;
|
|
51
|
+
/**
|
|
52
|
+
* Per-recommendation evidence (subset of the server's stored evidence
|
|
53
|
+
* payload — see StackRecommendationEvidence in the site schema). Null on
|
|
54
|
+
* cold-stack fallback results; the whole field is absent from pre-P2
|
|
55
|
+
* servers, so it stays optional and every read is guarded.
|
|
56
|
+
*/
|
|
57
|
+
evidence?: {
|
|
58
|
+
lift: number | null;
|
|
59
|
+
reuseCount: number;
|
|
60
|
+
recentInstalls90d: number;
|
|
61
|
+
coInstalledWith: string[];
|
|
62
|
+
} | null;
|
|
63
|
+
/** Site-relative detail-page URL (absent from pre-P2 servers). */
|
|
64
|
+
url?: string;
|
|
65
|
+
/** Present component types (presence only). Absent from pre-P2 servers. */
|
|
66
|
+
componentTypes?: string[];
|
|
67
|
+
/**
|
|
68
|
+
* Server-derived code-execution flag covering all six vectors
|
|
69
|
+
* (hooks/MCP/LSP/bin/monitors/workflows — the safe.json exclusion set).
|
|
70
|
+
* The ONLY source for the "runs code" warning: componentTypes cannot
|
|
71
|
+
* represent bin, so client inference would under-warn. Absent from pre-P2
|
|
72
|
+
* servers (no flag shown rather than a wrong one).
|
|
73
|
+
*/
|
|
74
|
+
runsCode?: boolean;
|
|
75
|
+
/** Claimed/verified maintainer flag (absent from pre-P2 servers). */
|
|
76
|
+
hasVerifiedOwner?: boolean;
|
|
77
|
+
install: {
|
|
78
|
+
command: string;
|
|
79
|
+
/**
|
|
80
|
+
* True when `command` is a verified maintainer's override. Override items
|
|
81
|
+
* are manual-only: they never enter the interactive selector (their
|
|
82
|
+
* command is already printed in the section list) and are never executed.
|
|
83
|
+
*/
|
|
84
|
+
maintainerOverride: boolean;
|
|
85
|
+
/** Generated Claude Code fallback; null exactly when an override is set. */
|
|
86
|
+
claude: {
|
|
87
|
+
addCommand: string;
|
|
88
|
+
installCommand: string;
|
|
89
|
+
} | null;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export declare function buildEvidenceLine(evidence: RecommendResultItem['evidence'], stackLabel: string): string | null;
|
|
93
|
+
/**
|
|
94
|
+
* "⚠ runs code" marker. Strictly the server-derived `runsCode` field — never
|
|
95
|
+
* inferred from componentTypes (see the field doc: bin is unrepresentable
|
|
96
|
+
* there, so inference under-warns).
|
|
97
|
+
*/
|
|
98
|
+
export declare function runsCodeFlag(item: RecommendResultItem): boolean;
|
|
35
99
|
export declare function runRecommend(argv: string[]): Promise<void>;
|
|
100
|
+
export {};
|
package/dist/recommend.js
CHANGED
|
@@ -323,6 +323,46 @@ function formatStackLabel(stack) {
|
|
|
323
323
|
.map((w) => (w ? w[0].toUpperCase() + w.slice(1) : w))
|
|
324
324
|
.join(' ');
|
|
325
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Quiet per-item evidence line. Hand-synced mini twin of the site's
|
|
328
|
+
* `buildEvidenceLine` (src/features/stack-recommendations/lib/display.ts —
|
|
329
|
+
* not importable across the package boundary): same signal priority
|
|
330
|
+
* (lift > reuse > co-copy > copy clicks), same honesty thresholds, same
|
|
331
|
+
* ≤2-signal cap, and the same copy-integrity rule — install-derived numbers
|
|
332
|
+
* are copy-click proxies, never described as installs.
|
|
333
|
+
*/
|
|
334
|
+
const EVIDENCE_MIN_LIFT = 1.5;
|
|
335
|
+
const EVIDENCE_MIN_REUSE = 2;
|
|
336
|
+
const EVIDENCE_MIN_INSTALLS = 5;
|
|
337
|
+
const EVIDENCE_MAX_SIGNALS = 2;
|
|
338
|
+
export function buildEvidenceLine(evidence, stackLabel) {
|
|
339
|
+
if (!evidence)
|
|
340
|
+
return null;
|
|
341
|
+
const signals = [];
|
|
342
|
+
if (evidence.lift !== null && evidence.lift >= EVIDENCE_MIN_LIFT) {
|
|
343
|
+
signals.push(`popular among ${stackLabel}-focused visitors`);
|
|
344
|
+
}
|
|
345
|
+
if (evidence.reuseCount >= EVIDENCE_MIN_REUSE) {
|
|
346
|
+
signals.push(`components reused in ${evidence.reuseCount} plugins`);
|
|
347
|
+
}
|
|
348
|
+
if (Array.isArray(evidence.coInstalledWith) && evidence.coInstalledWith.length > 0) {
|
|
349
|
+
signals.push(`often copied alongside ${evidence.coInstalledWith[0]}`);
|
|
350
|
+
}
|
|
351
|
+
if (evidence.recentInstalls90d >= EVIDENCE_MIN_INSTALLS) {
|
|
352
|
+
signals.push(`${evidence.recentInstalls90d} copy clicks in 90 days`);
|
|
353
|
+
}
|
|
354
|
+
if (signals.length === 0)
|
|
355
|
+
return null;
|
|
356
|
+
return signals.slice(0, EVIDENCE_MAX_SIGNALS).join(' · ');
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* "⚠ runs code" marker. Strictly the server-derived `runsCode` field — never
|
|
360
|
+
* inferred from componentTypes (see the field doc: bin is unrepresentable
|
|
361
|
+
* there, so inference under-warns).
|
|
362
|
+
*/
|
|
363
|
+
export function runsCodeFlag(item) {
|
|
364
|
+
return item.runsCode === true;
|
|
365
|
+
}
|
|
326
366
|
export async function runRecommend(argv) {
|
|
327
367
|
const { limit, json } = parseRecommendFlags(argv);
|
|
328
368
|
if (!json)
|
|
@@ -397,15 +437,24 @@ export async function runRecommend(argv) {
|
|
|
397
437
|
// One "For {Stack}:" group per detected stack — each its own ranking, deduped
|
|
398
438
|
// server-side so a plugin never repeats across sections.
|
|
399
439
|
sections.forEach((section) => {
|
|
400
|
-
|
|
440
|
+
const stackLabel = formatStackLabel(section.stack);
|
|
441
|
+
print(`${BOLD}For ${stackLabel}:${RESET}`);
|
|
401
442
|
section.results.forEach((item, i) => {
|
|
402
443
|
const rank = `${String(i + 1).padStart(2)}.`;
|
|
403
444
|
const stars = item.starCount > 0 ? ` ${YELLOW}★ ${formatCount(item.starCount)}${RESET}` : '';
|
|
404
|
-
|
|
445
|
+
const codeFlag = runsCodeFlag(item) ? ` ${YELLOW}⚠ runs code${RESET}` : '';
|
|
446
|
+
print(` ${BOLD}${rank} ${item.name}${RESET}${stars}${codeFlag}`);
|
|
405
447
|
if (item.description) {
|
|
406
448
|
print(` ${DIM}${truncate(item.description, 88)}${RESET}`);
|
|
407
449
|
}
|
|
450
|
+
const evidenceLine = buildEvidenceLine(item.evidence, stackLabel);
|
|
451
|
+
if (evidenceLine) {
|
|
452
|
+
print(` ${DIM}${truncate(evidenceLine, 88)}${RESET}`);
|
|
453
|
+
}
|
|
408
454
|
print(` ${CYAN}${item.install.command}${RESET}`);
|
|
455
|
+
if (item.url) {
|
|
456
|
+
print(` ${DIM}${BASE_URL}${item.url}${RESET}`);
|
|
457
|
+
}
|
|
409
458
|
});
|
|
410
459
|
print('');
|
|
411
460
|
});
|
|
@@ -456,7 +505,9 @@ async function runInteractiveInstall(body) {
|
|
|
456
505
|
}
|
|
457
506
|
print('');
|
|
458
507
|
const chosen = await recommendPrompt('Install plugins:', installable.map(({ item, stack }) => ({
|
|
459
|
-
|
|
508
|
+
// Repeat the code-execution flag at the decision point — the list line
|
|
509
|
+
// above may have scrolled away by selection time.
|
|
510
|
+
label: `${item.name} (${formatStackLabel(stack)})${runsCodeFlag(item) ? ' ⚠ runs code' : ''}`,
|
|
460
511
|
selected: false,
|
|
461
512
|
})), RECOMMEND_MAX_SELECTIONS);
|
|
462
513
|
if (chosen === null || chosen.length === 0) {
|