claudepluginhub 0.16.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.
@@ -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);
@@ -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 fetchDefaultBranch(source);
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 fetchDefaultBranch(source);
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 fetchDefaultBranch(source);
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 fetchDefaultBranch(source);
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
@@ -7,6 +7,8 @@ export interface MarketplacePlugin {
7
7
  repo?: string;
8
8
  url?: string;
9
9
  path?: string;
10
+ ref?: string;
11
+ sha?: string;
10
12
  };
11
13
  strict: boolean;
12
14
  description?: string;
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',
@@ -75,6 +75,8 @@ interface RecommendResultItem {
75
75
  reuseCount: number;
76
76
  recentInstalls90d: number;
77
77
  coInstalledWith: string[];
78
+ /** Display names index-aligned with coInstalledWith (absent on older servers). */
79
+ coInstalledNames?: string[];
78
80
  } | null;
79
81
  /** Site-relative detail-page URL (absent from pre-P2 servers). */
80
82
  url?: string;
@@ -90,6 +92,17 @@ interface RecommendResultItem {
90
92
  runsCode?: boolean;
91
93
  /** Claimed/verified maintainer flag (absent from pre-P2 servers). */
92
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;
93
106
  install: {
94
107
  command: string;
95
108
  /**
package/dist/recommend.js CHANGED
@@ -366,7 +366,11 @@ export function buildEvidenceLine(evidence, stackLabel) {
366
366
  signals.push(`components reused in ${evidence.reuseCount} plugins`);
367
367
  }
368
368
  if (Array.isArray(evidence.coInstalledWith) && evidence.coInstalledWith.length > 0) {
369
- signals.push(`often copied alongside ${evidence.coInstalledWith[0]}`);
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]}`);
370
374
  }
371
375
  if (evidence.recentInstalls90d >= EVIDENCE_MIN_INSTALLS) {
372
376
  signals.push(`${evidence.recentInstalls90d} copy clicks in 90 days`);
@@ -461,9 +465,20 @@ export async function runRecommend(argv) {
461
465
  print(`${BOLD}For ${stackLabel}:${RESET}`);
462
466
  section.results.forEach((item, i) => {
463
467
  const rank = `${String(i + 1).padStart(2)}.`;
464
- const stars = item.starCount > 0 ? ` ${YELLOW}★ ${formatCount(item.starCount)}${RESET}` : '';
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
+ : '';
465
476
  const codeFlag = runsCodeFlag(item) ? ` ${YELLOW}⚠ runs code${RESET}` : '';
466
- print(` ${BOLD}${rank} ${item.name}${RESET}${stars}${codeFlag}`);
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}`);
467
482
  if (item.description) {
468
483
  print(` ${DIM}${truncate(item.description, 88)}${RESET}`);
469
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 { fetchDefaultBranch, fetchTree, findTreeSha, findBlobSha, } from './github.js';
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
- const branch = await fetchDefaultBranch(component.source);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudepluginhub",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Install Claude Code components from ClaudePluginHub",
5
5
  "bin": {
6
6
  "claudepluginhub": "dist/index.js"