claudepluginhub 0.7.1 → 0.8.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/collection-install.d.ts +9 -0
- package/dist/collection-install.js +139 -0
- package/dist/download.js +44 -0
- package/dist/fetch.d.ts +15 -1
- package/dist/fetch.js +61 -8
- package/dist/index.js +37 -4
- package/dist/validation.js +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Scope } from './prompts.js';
|
|
2
|
+
export declare function runCollectionInstall(url: string, yes: boolean, scopeOverride: Scope | null): Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* Install a single plugin via its ClaudePluginHub wrapper marketplace
|
|
5
|
+
* (p/<slug> → /api/plugins/<slug>/marketplace.json). The wrapper emits a
|
|
6
|
+
* spec-correct source (git-subdir for monorepo plugins), so this is the
|
|
7
|
+
* correct one-liner for plugins without an indexed native marketplace.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runWrapperPluginInstall(url: string, yes: boolean, scopeOverride: Scope | null): Promise<void>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { scopePrompt, checkboxPrompt } from './prompts.js';
|
|
2
|
+
import { fetchMarketplace } from './fetch.js';
|
|
3
|
+
import { checkClaudeCli, claudeMarketplaceAdd, claudePluginInstall, } from './native.js';
|
|
4
|
+
import { print, printStep, printSuccess, printFail, printError, BOLD, RESET, DIM, GREEN, YELLOW, } from './output.js';
|
|
5
|
+
/**
|
|
6
|
+
* Claude Code rejects marketplace names containing path separators, ".."
|
|
7
|
+
* sequences, or ".". Our API emits compliant names (cpd-c-<userId>-<slug>),
|
|
8
|
+
* but guard anyway so a bad manifest fails with a clear message instead of a
|
|
9
|
+
* cryptic native error.
|
|
10
|
+
*/
|
|
11
|
+
function isInstallableMarketplaceName(name) {
|
|
12
|
+
return (name.length > 0 &&
|
|
13
|
+
!name.includes('/') &&
|
|
14
|
+
!name.includes('\\') &&
|
|
15
|
+
!name.includes('..') &&
|
|
16
|
+
name !== '.');
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Install from a hosted marketplace manifest by delegating to Claude Code's
|
|
20
|
+
* native plugin system: `claude plugin marketplace add <url>` once, then
|
|
21
|
+
* `claude plugin install <name>@<marketplace>` per selected plugin.
|
|
22
|
+
*
|
|
23
|
+
* Used for plugin collections (c/<userId>/<slug>) and single-plugin wrapper
|
|
24
|
+
* marketplaces (p/<slug>). Both reference WHOLE plugins (source only —
|
|
25
|
+
* github/git-subdir/git), which the component downloader can't cherry-pick,
|
|
26
|
+
* so native delegation is the correct install path. This also covers mixed
|
|
27
|
+
* collections: user-plugin entries (component-path arrays) are valid
|
|
28
|
+
* marketplace entries too, so nothing is silently dropped.
|
|
29
|
+
*
|
|
30
|
+
* Requires the `claude` binary (unlike the `u/` component install path).
|
|
31
|
+
* Native owns the installed state — manage with `claude plugin ...`.
|
|
32
|
+
*/
|
|
33
|
+
async function runNativeManifestInstall(url, yes, scopeOverride, kind) {
|
|
34
|
+
if (!checkClaudeCli())
|
|
35
|
+
process.exit(1);
|
|
36
|
+
printStep(`Fetching ${kind}...`);
|
|
37
|
+
const manifest = await fetchMarketplace(url);
|
|
38
|
+
if (!manifest) {
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
printSuccess(`"${manifest.name}" — ${manifest.plugins.length} plugin(s)`);
|
|
42
|
+
if (manifest.plugins.length === 0) {
|
|
43
|
+
printError(`No plugins found in this ${kind}.`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
if (!isInstallableMarketplaceName(manifest.name)) {
|
|
47
|
+
printError(`This ${kind}'s marketplace name ("${manifest.name}") is not accepted by Claude Code. ` +
|
|
48
|
+
'Please report this to claudepluginhub.com.');
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
// Plugin selection
|
|
52
|
+
let selectedPlugins = manifest.plugins;
|
|
53
|
+
if (!yes && manifest.plugins.length > 1) {
|
|
54
|
+
print('');
|
|
55
|
+
const items = manifest.plugins.map((p) => ({
|
|
56
|
+
label: p.name,
|
|
57
|
+
description: p.description ? `${DIM}${p.description}${RESET}` : undefined,
|
|
58
|
+
selected: true,
|
|
59
|
+
}));
|
|
60
|
+
const chosen = await checkboxPrompt('Select plugins to install:', items);
|
|
61
|
+
if (chosen === null) {
|
|
62
|
+
print('\nCancelled.');
|
|
63
|
+
process.exit(0);
|
|
64
|
+
}
|
|
65
|
+
selectedPlugins = chosen.map((i) => manifest.plugins[i]);
|
|
66
|
+
if (selectedPlugins.length === 0) {
|
|
67
|
+
printError('No plugins selected.');
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Scope picker
|
|
72
|
+
let scope = scopeOverride ?? 'project';
|
|
73
|
+
if (!yes && !scopeOverride) {
|
|
74
|
+
print('');
|
|
75
|
+
const chosenScope = await scopePrompt('project');
|
|
76
|
+
if (chosenScope === null) {
|
|
77
|
+
print('\nCancelled.');
|
|
78
|
+
process.exit(0);
|
|
79
|
+
}
|
|
80
|
+
scope = chosenScope;
|
|
81
|
+
}
|
|
82
|
+
// Register the endpoint itself as the marketplace. URL-based registration
|
|
83
|
+
// keeps the marketplace linked to the hosted manifest, so
|
|
84
|
+
// `claude plugin marketplace update` picks up upstream changes. Strip query
|
|
85
|
+
// params (e.g. the one-shot ?source=cli tracking param) so native refreshes
|
|
86
|
+
// hit the canonical URL.
|
|
87
|
+
const registerUrl = new URL(url);
|
|
88
|
+
registerUrl.search = '';
|
|
89
|
+
print('');
|
|
90
|
+
printStep(`Adding ${kind} marketplace...`);
|
|
91
|
+
const addResult = claudeMarketplaceAdd(registerUrl.toString(), scope);
|
|
92
|
+
if (!addResult.ok) {
|
|
93
|
+
printError(`Failed to add marketplace: ${addResult.output}`);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
printSuccess(`Marketplace "${manifest.name}" added`);
|
|
97
|
+
// Install each selected plugin
|
|
98
|
+
let failures = 0;
|
|
99
|
+
for (const plugin of selectedPlugins) {
|
|
100
|
+
printStep(`Installing ${plugin.name}...`);
|
|
101
|
+
const result = claudePluginInstall(plugin.name, manifest.name, scope);
|
|
102
|
+
if (result.ok) {
|
|
103
|
+
printSuccess(plugin.name);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
printFail(plugin.name, result.output);
|
|
107
|
+
failures++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
print('');
|
|
111
|
+
if (failures === 0) {
|
|
112
|
+
print(`${GREEN}${BOLD}Done!${RESET} ${selectedPlugins.length} plugin(s) installed.`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
print(`${YELLOW}${BOLD}Done.${RESET} ${selectedPlugins.length - failures} succeeded, ${failures} failed.`);
|
|
116
|
+
}
|
|
117
|
+
print('');
|
|
118
|
+
print(`${DIM}Manage with Claude Code:${RESET}`);
|
|
119
|
+
print(` ${DIM}claude plugin list${RESET}`);
|
|
120
|
+
print(` ${DIM}claude plugin uninstall <plugin>${RESET}`);
|
|
121
|
+
print(` ${DIM}claude plugin marketplace remove ${manifest.name}${RESET}`);
|
|
122
|
+
print('');
|
|
123
|
+
// Nothing installed at all — that's a failure, not a partial success.
|
|
124
|
+
if (failures === selectedPlugins.length) {
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export async function runCollectionInstall(url, yes, scopeOverride) {
|
|
129
|
+
return runNativeManifestInstall(url, yes, scopeOverride, 'collection');
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Install a single plugin via its ClaudePluginHub wrapper marketplace
|
|
133
|
+
* (p/<slug> → /api/plugins/<slug>/marketplace.json). The wrapper emits a
|
|
134
|
+
* spec-correct source (git-subdir for monorepo plugins), so this is the
|
|
135
|
+
* correct one-liner for plugins without an indexed native marketplace.
|
|
136
|
+
*/
|
|
137
|
+
export async function runWrapperPluginInstall(url, yes, scopeOverride) {
|
|
138
|
+
return runNativeManifestInstall(url, yes, scopeOverride, 'plugin');
|
|
139
|
+
}
|
package/dist/download.js
CHANGED
|
@@ -135,6 +135,33 @@ export async function downloadSingleFile(component, scope) {
|
|
|
135
135
|
configFragment: null,
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
+
function isRecord(value) {
|
|
139
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Minimal structural contracts for what we write into settings.json —
|
|
143
|
+
* derived from the official Claude Code settings shapes. Deliberately loose
|
|
144
|
+
* (extra fields fine, no enum of event names) so new Claude Code features
|
|
145
|
+
* don't get rejected; the point is to never write something Claude Code
|
|
146
|
+
* cannot parse at all.
|
|
147
|
+
*/
|
|
148
|
+
function isValidMcpServerEntry(value) {
|
|
149
|
+
if (!isRecord(value))
|
|
150
|
+
return false;
|
|
151
|
+
// stdio servers need a command; remote servers need a url
|
|
152
|
+
return typeof value.command === 'string' || typeof value.url === 'string';
|
|
153
|
+
}
|
|
154
|
+
function isValidLspServerEntry(value) {
|
|
155
|
+
return isRecord(value) && typeof value.command === 'string';
|
|
156
|
+
}
|
|
157
|
+
/** A hook event's value: array of matcher groups, each with a hooks array of typed handlers. */
|
|
158
|
+
function isValidHookEventHandlers(value) {
|
|
159
|
+
if (!Array.isArray(value))
|
|
160
|
+
return false;
|
|
161
|
+
return value.every((group) => isRecord(group) &&
|
|
162
|
+
Array.isArray(group.hooks) &&
|
|
163
|
+
group.hooks.every((h) => isRecord(h) && typeof h.type === 'string'));
|
|
164
|
+
}
|
|
138
165
|
async function resolveConfig(component) {
|
|
139
166
|
const { inlineConfig, source, sourcePath } = component;
|
|
140
167
|
// Inline config object — use directly
|
|
@@ -174,6 +201,13 @@ export async function mergeConfig(component, scope) {
|
|
|
174
201
|
const mcpConfig = config.mcpServers
|
|
175
202
|
? config.mcpServers
|
|
176
203
|
: config;
|
|
204
|
+
// Validate BEFORE any write: a malformed server entry means the whole
|
|
205
|
+
// component is skipped loudly — never write config Claude Code can't parse.
|
|
206
|
+
const badMcpKeys = Object.keys(mcpConfig).filter((key) => !isValidMcpServerEntry(mcpConfig[key]));
|
|
207
|
+
if (badMcpKeys.length > 0) {
|
|
208
|
+
printError(`Skipping ${componentName}: malformed MCP server config (${badMcpKeys.join(', ')}) — each server needs a "command" or "url" string`);
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
177
211
|
const ownedFragment = {};
|
|
178
212
|
for (const [key, value] of Object.entries(mcpConfig)) {
|
|
179
213
|
if (key in servers) {
|
|
@@ -192,6 +226,11 @@ export async function mergeConfig(component, scope) {
|
|
|
192
226
|
const lspConfig = config.lspServers
|
|
193
227
|
? config.lspServers
|
|
194
228
|
: config;
|
|
229
|
+
const badLspKeys = Object.keys(lspConfig).filter((key) => !isValidLspServerEntry(lspConfig[key]));
|
|
230
|
+
if (badLspKeys.length > 0) {
|
|
231
|
+
printError(`Skipping ${componentName}: malformed LSP server config (${badLspKeys.join(', ')}) — each server needs a "command" string`);
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
195
234
|
const ownedFragment = {};
|
|
196
235
|
for (const [key, value] of Object.entries(lspConfig)) {
|
|
197
236
|
if (key in servers) {
|
|
@@ -210,6 +249,11 @@ export async function mergeConfig(component, scope) {
|
|
|
210
249
|
const hookConfig = config.hooks
|
|
211
250
|
? config.hooks
|
|
212
251
|
: config;
|
|
252
|
+
const badEvents = Object.keys(hookConfig).filter((event) => !isValidHookEventHandlers(hookConfig[event]));
|
|
253
|
+
if (badEvents.length > 0) {
|
|
254
|
+
printError(`Skipping ${componentName}: malformed hooks config (${badEvents.join(', ')}) — each event needs an array of {hooks: [{type, ...}]} groups`);
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
213
257
|
for (const [event, handlers] of Object.entries(hookConfig)) {
|
|
214
258
|
if (!Array.isArray(handlers))
|
|
215
259
|
continue;
|
package/dist/fetch.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ export interface MarketplacePlugin {
|
|
|
3
3
|
name: string;
|
|
4
4
|
source: {
|
|
5
5
|
source: string;
|
|
6
|
-
repo
|
|
6
|
+
repo?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
path?: string;
|
|
7
9
|
};
|
|
8
10
|
strict: boolean;
|
|
9
11
|
description?: string;
|
|
@@ -22,5 +24,17 @@ export interface MarketplaceJSON {
|
|
|
22
24
|
plugins: MarketplacePlugin[];
|
|
23
25
|
}
|
|
24
26
|
export declare function resolveMarketplaceUrl(input: string): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Plugin collections reference whole plugins (source only), which the
|
|
29
|
+
* component downloader can't cherry-pick — they install via native delegation
|
|
30
|
+
* (collection-install.ts) instead of the flatten/download path.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isCollectionUrl(url: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Single-plugin wrapper marketplaces (/api/plugins/<slug>/marketplace.json)
|
|
35
|
+
* reference one whole plugin (source only) — like collections, they install
|
|
36
|
+
* via native delegation, not the flatten/download path.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isPluginWrapperUrl(url: string): boolean;
|
|
25
39
|
export declare function fetchMarketplace(url: string): Promise<MarketplaceJSON | null>;
|
|
26
40
|
export declare function flattenComponents(manifest: MarketplaceJSON): FlatComponent[];
|
package/dist/fetch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { printError } from './output.js';
|
|
1
|
+
import { printError, printWarning } from './output.js';
|
|
2
2
|
const BASE_URL = 'https://claudepluginhub.com';
|
|
3
3
|
const ALLOWED_HOSTS = ['claudepluginhub.com', 'www.claudepluginhub.com'];
|
|
4
4
|
export function resolveMarketplaceUrl(input) {
|
|
@@ -27,8 +27,35 @@ export function resolveMarketplaceUrl(input) {
|
|
|
27
27
|
const [, userId, slug] = match;
|
|
28
28
|
return `${BASE_URL}/api/user-plugins/${userId}/${slug}/marketplace.json?source=cli`;
|
|
29
29
|
}
|
|
30
|
+
// Short form: c/<userId>/<slug> (plugin collection)
|
|
31
|
+
const collectionMatch = input.match(/^c\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)$/);
|
|
32
|
+
if (collectionMatch) {
|
|
33
|
+
const [, userId, slug] = collectionMatch;
|
|
34
|
+
return `${BASE_URL}/api/collections/${userId}/${slug}/marketplace.json`;
|
|
35
|
+
}
|
|
36
|
+
// Short form: p/<slug> (single plugin via wrapper marketplace endpoint)
|
|
37
|
+
const pluginMatch = input.match(/^p\/([a-z0-9-]+)$/);
|
|
38
|
+
if (pluginMatch) {
|
|
39
|
+
return `${BASE_URL}/api/plugins/${pluginMatch[1]}/marketplace.json`;
|
|
40
|
+
}
|
|
30
41
|
return null;
|
|
31
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Plugin collections reference whole plugins (source only), which the
|
|
45
|
+
* component downloader can't cherry-pick — they install via native delegation
|
|
46
|
+
* (collection-install.ts) instead of the flatten/download path.
|
|
47
|
+
*/
|
|
48
|
+
export function isCollectionUrl(url) {
|
|
49
|
+
return url.includes('/api/collections/');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Single-plugin wrapper marketplaces (/api/plugins/<slug>/marketplace.json)
|
|
53
|
+
* reference one whole plugin (source only) — like collections, they install
|
|
54
|
+
* via native delegation, not the flatten/download path.
|
|
55
|
+
*/
|
|
56
|
+
export function isPluginWrapperUrl(url) {
|
|
57
|
+
return url.includes('/api/plugins/');
|
|
58
|
+
}
|
|
32
59
|
export async function fetchMarketplace(url) {
|
|
33
60
|
try {
|
|
34
61
|
// Ensure ?source=cli is present for install tracking
|
|
@@ -42,7 +69,7 @@ export async function fetchMarketplace(url) {
|
|
|
42
69
|
});
|
|
43
70
|
if (!response.ok) {
|
|
44
71
|
if (response.status === 404) {
|
|
45
|
-
printError('
|
|
72
|
+
printError('Not found. Check the identifier and try again.');
|
|
46
73
|
}
|
|
47
74
|
else {
|
|
48
75
|
printError(`HTTP ${response.status}: ${response.statusText}`);
|
|
@@ -63,12 +90,30 @@ export async function fetchMarketplace(url) {
|
|
|
63
90
|
return null;
|
|
64
91
|
}
|
|
65
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Marketplace-entry component paths are `./`-prefixed per the plugin spec
|
|
95
|
+
* (paths relative to the plugin root). Strip the prefix before prefix checks
|
|
96
|
+
* and GitHub API calls — the downloader works with bare repo-relative paths.
|
|
97
|
+
*/
|
|
98
|
+
function stripDotSlash(path) {
|
|
99
|
+
return path.replace(/^\.\//, '');
|
|
100
|
+
}
|
|
66
101
|
export function flattenComponents(manifest) {
|
|
67
102
|
const components = [];
|
|
103
|
+
let skippedWholePlugin = 0;
|
|
68
104
|
for (const plugin of manifest.plugins) {
|
|
69
105
|
const repo = plugin.source.repo;
|
|
106
|
+
// Whole-plugin references (git/git-subdir sources, no component arrays)
|
|
107
|
+
// can't be cherry-picked; they belong to the collection install path.
|
|
108
|
+
if (!repo) {
|
|
109
|
+
printWarning(`Skipping "${plugin.name}" — whole-plugin reference (component install can't cherry-pick it)`);
|
|
110
|
+
skippedWholePlugin++;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const before = components.length;
|
|
70
114
|
if (plugin.commands) {
|
|
71
|
-
for (const
|
|
115
|
+
for (const rawPath of plugin.commands) {
|
|
116
|
+
const path = stripDotSlash(rawPath);
|
|
72
117
|
// Preserve full path under commands/ prefix, e.g. "commands/git/commit.md"
|
|
73
118
|
const relPath = path.startsWith('commands/') ? path.slice('commands/'.length) : path;
|
|
74
119
|
const name = relPath.replace(/\.md$/, '');
|
|
@@ -82,7 +127,8 @@ export function flattenComponents(manifest) {
|
|
|
82
127
|
}
|
|
83
128
|
}
|
|
84
129
|
if (plugin.agents) {
|
|
85
|
-
for (const
|
|
130
|
+
for (const rawPath of plugin.agents) {
|
|
131
|
+
const path = stripDotSlash(rawPath);
|
|
86
132
|
const relPath = path.startsWith('agents/') ? path.slice('agents/'.length) : path;
|
|
87
133
|
const name = relPath.replace(/\.md$/, '');
|
|
88
134
|
components.push({
|
|
@@ -95,7 +141,8 @@ export function flattenComponents(manifest) {
|
|
|
95
141
|
}
|
|
96
142
|
}
|
|
97
143
|
if (plugin.skills) {
|
|
98
|
-
for (const
|
|
144
|
+
for (const rawPath of plugin.skills) {
|
|
145
|
+
const path = stripDotSlash(rawPath);
|
|
99
146
|
// Skill name is the directory containing SKILL.md
|
|
100
147
|
// e.g. "plugins/foo/skills/review/SKILL.md" -> "review"
|
|
101
148
|
const withoutSkillMd = path.replace(/\/SKILL\.md$/, '');
|
|
@@ -114,7 +161,7 @@ export function flattenComponents(manifest) {
|
|
|
114
161
|
source: repo,
|
|
115
162
|
type: 'hook',
|
|
116
163
|
componentName: `${plugin.name}-hooks`,
|
|
117
|
-
sourcePath: typeof plugin.hooks === 'string' ? plugin.hooks : 'hooks/hooks.json',
|
|
164
|
+
sourcePath: typeof plugin.hooks === 'string' ? stripDotSlash(plugin.hooks) : 'hooks/hooks.json',
|
|
118
165
|
inlineConfig: plugin.hooks,
|
|
119
166
|
});
|
|
120
167
|
}
|
|
@@ -123,7 +170,7 @@ export function flattenComponents(manifest) {
|
|
|
123
170
|
source: repo,
|
|
124
171
|
type: 'mcp',
|
|
125
172
|
componentName: `${plugin.name}-mcp`,
|
|
126
|
-
sourcePath: typeof plugin.mcpServers === 'string' ? plugin.mcpServers : '.mcp.json',
|
|
173
|
+
sourcePath: typeof plugin.mcpServers === 'string' ? stripDotSlash(plugin.mcpServers) : '.mcp.json',
|
|
127
174
|
inlineConfig: plugin.mcpServers,
|
|
128
175
|
});
|
|
129
176
|
}
|
|
@@ -132,10 +179,16 @@ export function flattenComponents(manifest) {
|
|
|
132
179
|
source: repo,
|
|
133
180
|
type: 'lsp',
|
|
134
181
|
componentName: `${plugin.name}-lsp`,
|
|
135
|
-
sourcePath: typeof plugin.lspServers === 'string' ? plugin.lspServers : '.lsp.json',
|
|
182
|
+
sourcePath: typeof plugin.lspServers === 'string' ? stripDotSlash(plugin.lspServers) : '.lsp.json',
|
|
136
183
|
inlineConfig: plugin.lspServers,
|
|
137
184
|
});
|
|
138
185
|
}
|
|
186
|
+
if (components.length === before) {
|
|
187
|
+
printWarning(`"${plugin.name}" contributed no installable components`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (skippedWholePlugin > 0) {
|
|
191
|
+
printWarning(`${skippedWholePlugin} whole-plugin entr${skippedWholePlugin === 1 ? 'y' : 'ies'} skipped — install those via \`claude plugin install\` or a collection`);
|
|
139
192
|
}
|
|
140
193
|
return components;
|
|
141
194
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { resolveMarketplaceUrl, fetchMarketplace, flattenComponents } from './fetch.js';
|
|
2
|
+
import { resolveMarketplaceUrl, fetchMarketplace, flattenComponents, isCollectionUrl, isPluginWrapperUrl } from './fetch.js';
|
|
3
3
|
import { checkboxPrompt, scopePrompt, confirmPrompt } from './prompts.js';
|
|
4
4
|
import { runInstall } from './install.js';
|
|
5
5
|
import { runUpdate } from './update.js';
|
|
@@ -31,13 +31,19 @@ Commands:
|
|
|
31
31
|
|
|
32
32
|
Identifiers:
|
|
33
33
|
owner/repo GitHub plugin or marketplace (via Claude Code)
|
|
34
|
-
u/<userId>/<slug> ClaudePluginHub
|
|
34
|
+
u/<userId>/<slug> ClaudePluginHub user plugin (component install)
|
|
35
|
+
c/<userId>/<slug> ClaudePluginHub plugin collection (via Claude Code)
|
|
36
|
+
p/<slug> ClaudePluginHub plugin by slug (via Claude Code)
|
|
35
37
|
https://claudepluginhub.com/api/user-plugins/.../marketplace.json
|
|
38
|
+
https://claudepluginhub.com/api/collections/.../marketplace.json
|
|
39
|
+
https://claudepluginhub.com/api/plugins/<slug>/marketplace.json
|
|
36
40
|
|
|
37
41
|
Install modes:
|
|
38
42
|
owner/repo Full plugin install (via Claude Code plugin system)
|
|
39
43
|
owner/repo --skill <path> Direct single-component install (skill, command, or agent)
|
|
40
|
-
u/<userId>/<slug>
|
|
44
|
+
u/<userId>/<slug> Component install (no Claude Code required)
|
|
45
|
+
c/<userId>/<slug> Whole-plugin collection install (requires Claude Code)
|
|
46
|
+
p/<slug> Single-plugin install via wrapper marketplace (requires Claude Code)
|
|
41
47
|
|
|
42
48
|
Notes:
|
|
43
49
|
- list shows all lock-backed installs (collections + direct components)
|
|
@@ -120,6 +126,17 @@ async function main() {
|
|
|
120
126
|
}
|
|
121
127
|
process.exit(0);
|
|
122
128
|
}
|
|
129
|
+
// Plugin-collection and wrapper-plugin installs are native-managed (no lock entry)
|
|
130
|
+
if (identifier.startsWith('c/') ||
|
|
131
|
+
identifier.includes('/api/collections/') ||
|
|
132
|
+
identifier.startsWith('p/') ||
|
|
133
|
+
identifier.includes('/api/plugins/')) {
|
|
134
|
+
print('These installs are managed by Claude Code directly:');
|
|
135
|
+
print(` ${DIM}claude plugin uninstall <plugin>${RESET}`);
|
|
136
|
+
print(` ${DIM}claude plugin marketplace remove <marketplace-name>${RESET}`);
|
|
137
|
+
print(` ${DIM}claude plugin marketplace list${RESET}`);
|
|
138
|
+
process.exit(0);
|
|
139
|
+
}
|
|
123
140
|
await runRemove(identifier);
|
|
124
141
|
process.exit(0);
|
|
125
142
|
}
|
|
@@ -144,9 +161,21 @@ async function main() {
|
|
|
144
161
|
if (!url) {
|
|
145
162
|
printError(`Invalid identifier: ${identifier}`);
|
|
146
163
|
print('');
|
|
147
|
-
print(`Expected: owner/repo, u/<userId>/<slug>, or a claudepluginhub.com URL`);
|
|
164
|
+
print(`Expected: owner/repo, u/<userId>/<slug>, c/<userId>/<slug>, p/<slug>, or a claudepluginhub.com URL`);
|
|
148
165
|
process.exit(1);
|
|
149
166
|
}
|
|
167
|
+
// Plugin collections reference whole plugins — install via native delegation
|
|
168
|
+
if (isCollectionUrl(url)) {
|
|
169
|
+
const { runCollectionInstall } = await import('./collection-install.js');
|
|
170
|
+
await runCollectionInstall(url, yes, scopeOverride);
|
|
171
|
+
process.exit(0);
|
|
172
|
+
}
|
|
173
|
+
// Single-plugin wrapper marketplaces likewise install via native delegation
|
|
174
|
+
if (isPluginWrapperUrl(url)) {
|
|
175
|
+
const { runWrapperPluginInstall } = await import('./collection-install.js');
|
|
176
|
+
await runWrapperPluginInstall(url, yes, scopeOverride);
|
|
177
|
+
process.exit(0);
|
|
178
|
+
}
|
|
150
179
|
// Derive the collection identifier from the input
|
|
151
180
|
const collectionId = identifier.startsWith('http')
|
|
152
181
|
? extractIdentifierFromUrl(identifier)
|
|
@@ -218,6 +247,10 @@ function extractIdentifierFromUrl(url) {
|
|
|
218
247
|
if (match) {
|
|
219
248
|
return `u/${match[1]}/${match[2]}`;
|
|
220
249
|
}
|
|
250
|
+
const collectionMatch = url.match(/\/api\/collections\/([^/]+)\/([^/]+)/);
|
|
251
|
+
if (collectionMatch) {
|
|
252
|
+
return `c/${collectionMatch[1]}/${collectionMatch[2]}`;
|
|
253
|
+
}
|
|
221
254
|
return url;
|
|
222
255
|
}
|
|
223
256
|
main().catch((err) => {
|
package/dist/validation.js
CHANGED
|
@@ -11,5 +11,11 @@ export function isOwnerRepo(identifier) {
|
|
|
11
11
|
// Reject segments that are purely dots (e.g. "..", ".")
|
|
12
12
|
if (/^\.+$/.test(owner) || /^\.+$/.test(repo))
|
|
13
13
|
return false;
|
|
14
|
+
// Reserved short-form prefixes: p/<slug> is owner/repo-SHAPED but means a
|
|
15
|
+
// ClaudePluginHub wrapper install (u/ and c/ are 3-segment, reserved for
|
|
16
|
+
// symmetry). Repos of the literal GitHub users "u"/"c"/"p" are not
|
|
17
|
+
// installable via the bare form — an acceptable, documented trade-off.
|
|
18
|
+
if (owner === 'u' || owner === 'c' || owner === 'p')
|
|
19
|
+
return false;
|
|
14
20
|
return true;
|
|
15
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudepluginhub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Install Claude Code components from ClaudePluginHub",
|
|
5
5
|
"bin": {
|
|
6
6
|
"claudepluginhub": "dist/index.js"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"homepage": "https://claudepluginhub.com",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "git+https://github.com/
|
|
29
|
+
"url": "git+https://github.com/ClaudePluginHub/claudepluginhub.git",
|
|
30
30
|
"directory": "packages/cli"
|
|
31
31
|
},
|
|
32
32
|
"license": "MIT",
|