claudepluginhub 0.15.0 → 0.16.1
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/component-install.js +3 -0
- package/dist/download.d.ts +9 -0
- package/dist/download.js +8 -4
- package/dist/fetch.d.ts +2 -0
- package/dist/fetch.js +9 -0
- package/dist/index.js +1 -0
- package/dist/recommend.d.ts +29 -0
- package/dist/recommend.js +42 -7
- package/dist/update.js +4 -3
- package/package.json +1 -1
|
@@ -161,6 +161,9 @@ export async function runDirectComponentInstall(ownerRepo, componentType, repoPa
|
|
|
161
161
|
componentName,
|
|
162
162
|
sourcePath: pluginPath,
|
|
163
163
|
downloadPath: repoPath,
|
|
164
|
+
// Direct install of a bare owner/repo: no marketplace entry, so no pin —
|
|
165
|
+
// the default branch is the only thing this path can mean.
|
|
166
|
+
ref: null,
|
|
164
167
|
inlineConfig: null,
|
|
165
168
|
};
|
|
166
169
|
const result = await installComponent(component, scope, false);
|
package/dist/download.d.ts
CHANGED
|
@@ -2,12 +2,21 @@ import type { Scope } from './prompts.js';
|
|
|
2
2
|
import type { ComponentLock } from './lock.js';
|
|
3
3
|
export interface FlatComponent {
|
|
4
4
|
source: string;
|
|
5
|
+
/**
|
|
6
|
+
* Git ref (branch, tag or commit sha) the component is fetched from; null =
|
|
7
|
+
* the repo's default branch. Carried from the marketplace entry's
|
|
8
|
+
* `source.sha ?? source.ref` so pinned listings install — and update to —
|
|
9
|
+
* the content the hub indexed, not whatever the default branch holds.
|
|
10
|
+
*/
|
|
11
|
+
ref: string | null;
|
|
5
12
|
type: 'command' | 'agent' | 'skill' | 'hook' | 'mcp' | 'lsp';
|
|
6
13
|
componentName: string;
|
|
7
14
|
sourcePath: string;
|
|
8
15
|
downloadPath?: string;
|
|
9
16
|
inlineConfig: unknown | null;
|
|
10
17
|
}
|
|
18
|
+
/** The ref every GitHub read for this component must use. */
|
|
19
|
+
export declare function resolveFetchRef(component: Pick<FlatComponent, 'source' | 'ref'>): Promise<string | null>;
|
|
11
20
|
export declare function getBaseDir(scope: Scope): string;
|
|
12
21
|
export type InstallResult = {
|
|
13
22
|
status: 'installed';
|
package/dist/download.js
CHANGED
|
@@ -3,6 +3,10 @@ import { dirname, join, resolve, sep } from 'node:path';
|
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { fetchDefaultBranch, fetchTree, downloadFile, findTreeSha, findBlobSha, listFilesUnder, } from './github.js';
|
|
5
5
|
import { printError, printProgress } from './output.js';
|
|
6
|
+
/** The ref every GitHub read for this component must use. */
|
|
7
|
+
export async function resolveFetchRef(component) {
|
|
8
|
+
return component.ref ?? fetchDefaultBranch(component.source);
|
|
9
|
+
}
|
|
6
10
|
export function getBaseDir(scope) {
|
|
7
11
|
if (scope === 'user') {
|
|
8
12
|
return join(homedir(), '.claude');
|
|
@@ -46,7 +50,7 @@ export async function downloadSkill(component, scope) {
|
|
|
46
50
|
const downloadSource = component.downloadPath ?? sourcePath;
|
|
47
51
|
// Strip /SKILL.md to get directory path (repo-root-relative for GitHub API)
|
|
48
52
|
const dirPath = downloadSource.replace(/\/SKILL\.md$/, '');
|
|
49
|
-
const branch = await
|
|
53
|
+
const branch = await resolveFetchRef(component);
|
|
50
54
|
if (!branch)
|
|
51
55
|
return null;
|
|
52
56
|
const tree = await fetchTree(source, branch);
|
|
@@ -101,7 +105,7 @@ export async function downloadSkill(component, scope) {
|
|
|
101
105
|
export async function downloadSingleFile(component, scope) {
|
|
102
106
|
const { source, type, sourcePath, componentName } = component;
|
|
103
107
|
const effectivePath = component.downloadPath ?? sourcePath;
|
|
104
|
-
const branch = await
|
|
108
|
+
const branch = await resolveFetchRef(component);
|
|
105
109
|
if (!branch)
|
|
106
110
|
return null;
|
|
107
111
|
const tree = await fetchTree(source, branch);
|
|
@@ -171,7 +175,7 @@ async function resolveConfig(component) {
|
|
|
171
175
|
// String path — download and parse
|
|
172
176
|
if (typeof inlineConfig === 'string' || !inlineConfig) {
|
|
173
177
|
const filePath = typeof inlineConfig === 'string' ? inlineConfig : sourcePath;
|
|
174
|
-
const branch = await
|
|
178
|
+
const branch = await resolveFetchRef(component);
|
|
175
179
|
if (!branch)
|
|
176
180
|
return null;
|
|
177
181
|
const content = await downloadFile(source, branch, filePath);
|
|
@@ -269,7 +273,7 @@ export async function mergeConfig(component, scope) {
|
|
|
269
273
|
configFragment = hookConfig;
|
|
270
274
|
}
|
|
271
275
|
writeJsonFile(settingsPath, settings);
|
|
272
|
-
const branch = await
|
|
276
|
+
const branch = await resolveFetchRef(component);
|
|
273
277
|
const tree = branch ? await fetchTree(source, branch) : null;
|
|
274
278
|
const hash = tree ? (findBlobSha(tree, sourcePath) ?? 'unknown') : 'unknown';
|
|
275
279
|
return {
|
package/dist/fetch.d.ts
CHANGED
package/dist/fetch.js
CHANGED
|
@@ -103,6 +103,9 @@ export function flattenComponents(manifest) {
|
|
|
103
103
|
let skippedWholePlugin = 0;
|
|
104
104
|
for (const plugin of manifest.plugins) {
|
|
105
105
|
const repo = plugin.source.repo;
|
|
106
|
+
// Spec install precedence: an exact commit wins over a branch/tag. Null =
|
|
107
|
+
// the repo's default branch (unpinned listing).
|
|
108
|
+
const ref = plugin.source.sha ?? plugin.source.ref ?? null;
|
|
106
109
|
// Whole-plugin references (git/git-subdir sources, no component arrays)
|
|
107
110
|
// can't be cherry-picked; they belong to the collection install path.
|
|
108
111
|
if (!repo) {
|
|
@@ -119,6 +122,7 @@ export function flattenComponents(manifest) {
|
|
|
119
122
|
const name = relPath.replace(/\.md$/, '');
|
|
120
123
|
components.push({
|
|
121
124
|
source: repo,
|
|
125
|
+
ref,
|
|
122
126
|
type: 'command',
|
|
123
127
|
componentName: name,
|
|
124
128
|
sourcePath: path,
|
|
@@ -133,6 +137,7 @@ export function flattenComponents(manifest) {
|
|
|
133
137
|
const name = relPath.replace(/\.md$/, '');
|
|
134
138
|
components.push({
|
|
135
139
|
source: repo,
|
|
140
|
+
ref,
|
|
136
141
|
type: 'agent',
|
|
137
142
|
componentName: name,
|
|
138
143
|
sourcePath: path,
|
|
@@ -149,6 +154,7 @@ export function flattenComponents(manifest) {
|
|
|
149
154
|
const skillName = withoutSkillMd.split('/').pop() ?? withoutSkillMd;
|
|
150
155
|
components.push({
|
|
151
156
|
source: repo,
|
|
157
|
+
ref,
|
|
152
158
|
type: 'skill',
|
|
153
159
|
componentName: skillName,
|
|
154
160
|
sourcePath: path,
|
|
@@ -159,6 +165,7 @@ export function flattenComponents(manifest) {
|
|
|
159
165
|
if (plugin.hooks) {
|
|
160
166
|
components.push({
|
|
161
167
|
source: repo,
|
|
168
|
+
ref,
|
|
162
169
|
type: 'hook',
|
|
163
170
|
componentName: `${plugin.name}-hooks`,
|
|
164
171
|
sourcePath: typeof plugin.hooks === 'string' ? stripDotSlash(plugin.hooks) : 'hooks/hooks.json',
|
|
@@ -168,6 +175,7 @@ export function flattenComponents(manifest) {
|
|
|
168
175
|
if (plugin.mcpServers) {
|
|
169
176
|
components.push({
|
|
170
177
|
source: repo,
|
|
178
|
+
ref,
|
|
171
179
|
type: 'mcp',
|
|
172
180
|
componentName: `${plugin.name}-mcp`,
|
|
173
181
|
sourcePath: typeof plugin.mcpServers === 'string' ? stripDotSlash(plugin.mcpServers) : '.mcp.json',
|
|
@@ -177,6 +185,7 @@ export function flattenComponents(manifest) {
|
|
|
177
185
|
if (plugin.lspServers) {
|
|
178
186
|
components.push({
|
|
179
187
|
source: repo,
|
|
188
|
+
ref,
|
|
180
189
|
type: 'lsp',
|
|
181
190
|
componentName: `${plugin.name}-lsp`,
|
|
182
191
|
sourcePath: typeof plugin.lspServers === 'string' ? stripDotSlash(plugin.lspServers) : '.lsp.json',
|
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
|
package/dist/recommend.d.ts
CHANGED
|
@@ -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[];
|
|
@@ -59,6 +75,8 @@ interface RecommendResultItem {
|
|
|
59
75
|
reuseCount: number;
|
|
60
76
|
recentInstalls90d: number;
|
|
61
77
|
coInstalledWith: string[];
|
|
78
|
+
/** Display names index-aligned with coInstalledWith (absent on older servers). */
|
|
79
|
+
coInstalledNames?: string[];
|
|
62
80
|
} | null;
|
|
63
81
|
/** Site-relative detail-page URL (absent from pre-P2 servers). */
|
|
64
82
|
url?: string;
|
|
@@ -74,6 +92,17 @@ interface RecommendResultItem {
|
|
|
74
92
|
runsCode?: boolean;
|
|
75
93
|
/** Claimed/verified maintainer flag (absent from pre-P2 servers). */
|
|
76
94
|
hasVerifiedOwner?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* GitHub owner login for name disambiguation (absent from pre-2026-08
|
|
97
|
+
* servers → the name renders alone).
|
|
98
|
+
*/
|
|
99
|
+
repoOwnerLogin?: string | null;
|
|
100
|
+
/**
|
|
101
|
+
* True for monorepo-subdir plugins whose starCount is the PARENT repo's
|
|
102
|
+
* total; rendered as a "(repo)" qualifier. Absent from pre-2026-08
|
|
103
|
+
* servers → no qualifier (never a guessed one).
|
|
104
|
+
*/
|
|
105
|
+
starsInherited?: boolean;
|
|
77
106
|
install: {
|
|
78
107
|
command: string;
|
|
79
108
|
/**
|
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
|
-
|
|
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) {
|
|
@@ -346,7 +366,11 @@ export function buildEvidenceLine(evidence, stackLabel) {
|
|
|
346
366
|
signals.push(`components reused in ${evidence.reuseCount} plugins`);
|
|
347
367
|
}
|
|
348
368
|
if (Array.isArray(evidence.coInstalledWith) && evidence.coInstalledWith.length > 0) {
|
|
349
|
-
|
|
369
|
+
// Prefer the index-aligned display name (absent on older servers/rows).
|
|
370
|
+
const coName = Array.isArray(evidence.coInstalledNames)
|
|
371
|
+
? evidence.coInstalledNames[0]
|
|
372
|
+
: undefined;
|
|
373
|
+
signals.push(`often copied alongside ${coName ?? evidence.coInstalledWith[0]}`);
|
|
350
374
|
}
|
|
351
375
|
if (evidence.recentInstalls90d >= EVIDENCE_MIN_INSTALLS) {
|
|
352
376
|
signals.push(`${evidence.recentInstalls90d} copy clicks in 90 days`);
|
|
@@ -364,7 +388,7 @@ export function runsCodeFlag(item) {
|
|
|
364
388
|
return item.runsCode === true;
|
|
365
389
|
}
|
|
366
390
|
export async function runRecommend(argv) {
|
|
367
|
-
const { limit, json } = parseRecommendFlags(argv);
|
|
391
|
+
const { limit, json, source } = parseRecommendFlags(argv);
|
|
368
392
|
if (!json)
|
|
369
393
|
printBanner();
|
|
370
394
|
const signals = collectProjectSignals(process.cwd());
|
|
@@ -378,7 +402,7 @@ export async function runRecommend(argv) {
|
|
|
378
402
|
}
|
|
379
403
|
let response;
|
|
380
404
|
try {
|
|
381
|
-
response = await fetch(
|
|
405
|
+
response = await fetch(recommendUrl(source), {
|
|
382
406
|
method: 'POST',
|
|
383
407
|
headers: { 'content-type': 'application/json' },
|
|
384
408
|
body: JSON.stringify({
|
|
@@ -441,9 +465,20 @@ export async function runRecommend(argv) {
|
|
|
441
465
|
print(`${BOLD}For ${stackLabel}:${RESET}`);
|
|
442
466
|
section.results.forEach((item, i) => {
|
|
443
467
|
const rank = `${String(i + 1).padStart(2)}.`;
|
|
444
|
-
|
|
468
|
+
// Inherited-star honesty (mirrors the web card's "repo" marker): on
|
|
469
|
+
// monorepo-subdir plugins starCount is the PARENT repo's total —
|
|
470
|
+
// qualify it so ★ 140.1k never reads as plugin-earned. Strict ===
|
|
471
|
+
// true: absent on pre-2026-08 servers → unqualified, like before.
|
|
472
|
+
const repoQualifier = item.starsInherited === true ? ' (repo)' : '';
|
|
473
|
+
const stars = item.starCount > 0
|
|
474
|
+
? ` ${YELLOW}★ ${formatCount(item.starCount)}${repoQualifier}${RESET}`
|
|
475
|
+
: '';
|
|
445
476
|
const codeFlag = runsCodeFlag(item) ? ` ${YELLOW}⚠ runs code${RESET}` : '';
|
|
446
|
-
|
|
477
|
+
// Owner disambiguation: distinct plugins share generic names (six
|
|
478
|
+
// actives named "nextjs") — the owner login tells them apart. Absent
|
|
479
|
+
// on pre-2026-08 servers → name renders alone, like before.
|
|
480
|
+
const owner = item.repoOwnerLogin ? ` ${DIM}by ${item.repoOwnerLogin}${RESET}` : '';
|
|
481
|
+
print(` ${BOLD}${rank} ${item.name}${RESET}${owner}${stars}${codeFlag}`);
|
|
447
482
|
if (item.description) {
|
|
448
483
|
print(` ${DIM}${truncate(item.description, 88)}${RESET}`);
|
|
449
484
|
}
|
package/dist/update.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { readLock, writeLock, componentKey } from './lock.js';
|
|
2
2
|
import { fetchMarketplace, flattenComponents } from './fetch.js';
|
|
3
|
-
import { installComponent } from './download.js';
|
|
3
|
+
import { installComponent, resolveFetchRef } from './download.js';
|
|
4
4
|
import { removeComponentByLock } from './remove.js';
|
|
5
|
-
import {
|
|
5
|
+
import { fetchTree, findTreeSha, findBlobSha, } from './github.js';
|
|
6
6
|
import { print, printSuccess, printFail, printError, BOLD, RESET, DIM, } from './output.js';
|
|
7
7
|
async function getRemoteHash(component) {
|
|
8
|
-
|
|
8
|
+
// Pinned entries compare against the pinned ref, not the default branch.
|
|
9
|
+
const branch = await resolveFetchRef(component);
|
|
9
10
|
if (!branch)
|
|
10
11
|
return null;
|
|
11
12
|
const tree = await fetchTree(component.source, branch);
|