claudepluginhub 0.16.0 → 0.17.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/README.md +34 -1
- package/dist/args.js +0 -6
- package/dist/collection-install.d.ts +4 -23
- package/dist/collection-install.js +9 -45
- package/dist/component-install.js +8 -27
- package/dist/detect.d.ts +0 -2
- package/dist/detect.js +3 -7
- package/dist/doctor/claude-source.d.ts +4 -6
- package/dist/doctor/claude-source.js +1 -2
- package/dist/doctor/color.d.ts +0 -1
- package/dist/doctor/color.js +0 -1
- package/dist/doctor/equivalence.d.ts +1 -1
- package/dist/doctor/equivalence.js +68 -149
- package/dist/doctor/estimate.js +12 -61
- package/dist/doctor/html-report.d.ts +1 -6
- package/dist/doctor/html-report.js +43 -116
- package/dist/doctor/inventory.d.ts +10 -24
- package/dist/doctor/inventory.js +29 -63
- package/dist/doctor/overlap.d.ts +3 -6
- package/dist/doctor/render.js +20 -38
- package/dist/doctor/report.d.ts +7 -16
- package/dist/doctor/report.js +3 -6
- package/dist/doctor/rules.d.ts +6 -16
- package/dist/doctor/rules.js +13 -26
- package/dist/doctor/run.d.ts +1 -1
- package/dist/doctor/run.js +5 -6
- package/dist/doctor/sanitize.d.ts +0 -8
- package/dist/doctor/sanitize.js +1 -6
- package/dist/doctor/select.d.ts +10 -25
- package/dist/doctor/select.js +2 -3
- package/dist/download.d.ts +4 -0
- package/dist/download.js +12 -18
- package/dist/fetch.d.ts +4 -8
- package/dist/fetch.js +13 -19
- package/dist/github-install.js +1 -12
- package/dist/index.js +14 -22
- package/dist/install.js +1 -2
- package/dist/mcp/server.d.ts +25 -0
- package/dist/mcp/server.js +103 -0
- package/dist/mcp/tools.d.ts +73 -0
- package/dist/mcp/tools.js +231 -0
- package/dist/output.d.ts +0 -5
- package/dist/output.js +0 -12
- package/dist/prompts.d.ts +3 -10
- package/dist/prompts.js +5 -20
- package/dist/recommend.d.ts +54 -56
- package/dist/recommend.js +69 -127
- package/dist/remove.d.ts +1 -1
- package/dist/remove.js +5 -10
- package/dist/update.js +5 -8
- package/dist/validation.d.ts +0 -5
- package/dist/validation.js +3 -10
- package/dist/wrapper.d.ts +0 -1
- package/dist/wrapper.js +1 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,12 +51,45 @@ Same as `u/` form but with the full marketplace JSON URL.
|
|
|
51
51
|
npx claudepluginhub <identifier> Install from a source
|
|
52
52
|
npx claudepluginhub add <identifier> Same as above
|
|
53
53
|
npx claudepluginhub update [identifier] Update (u/ collections only)
|
|
54
|
-
npx claudepluginhub list List (u/ collections
|
|
54
|
+
npx claudepluginhub list List lock-backed installs (u/ collections, direct components)
|
|
55
55
|
npx claudepluginhub remove <identifier> Remove
|
|
56
56
|
npx claudepluginhub recommend Recommend plugins for the current project
|
|
57
57
|
npx claudepluginhub doctor Diagnose the Claude Code plugin setup (read-only)
|
|
58
|
+
npx claudepluginhub mcp Run as an MCP server (stdio) for Claude Code
|
|
58
59
|
```
|
|
59
60
|
|
|
61
|
+
## MCP Server (Use Inside Claude Code)
|
|
62
|
+
|
|
63
|
+
Let Claude search, inspect and recommend plugins, and check your setup, without leaving the
|
|
64
|
+
session:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
claude mcp add claudepluginhub -- npx -y claudepluginhub mcp
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Or share it with your team in the project's `.mcp.json`:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"claudepluginhub": {
|
|
76
|
+
"command": "npx",
|
|
77
|
+
"args": ["-y", "claudepluginhub", "mcp"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
| Tool | What it does |
|
|
84
|
+
| --- | --- |
|
|
85
|
+
| `search_plugins` | Searches the public directory (`query`, optional `type`, `maxTokens`, `noHooks`, `limit` ≤ 10). Each card has always-on tokens, hooks/MCP flags, stars, install command and plugin page link. |
|
|
86
|
+
| `inspect_plugin` | One plugin by `slug`: component counts, always-on tokens, what runs code, the install command, or Claude Code's reason for refusing it. |
|
|
87
|
+
| `recommend_for_project` | Same as `recommend` for `projectDir` (default: the current directory). Sends only dependency names and config-filename prefixes. |
|
|
88
|
+
| `doctor_setup` | Same as `doctor`: verdict, findings and always-on token breakdown. Local, offline, read-only. |
|
|
89
|
+
|
|
90
|
+
The four tool definitions total about 970 characters (roughly 245 tokens), so the server
|
|
91
|
+
costs little context in every session. Zero runtime dependencies; logs go to stderr only.
|
|
92
|
+
|
|
60
93
|
## Recommend
|
|
61
94
|
|
|
62
95
|
Run `npx claudepluginhub recommend` from a project root to get plugin
|
package/dist/args.js
CHANGED
|
@@ -33,7 +33,6 @@ export function parseArgs(argv) {
|
|
|
33
33
|
}
|
|
34
34
|
plugin = val;
|
|
35
35
|
}
|
|
36
|
-
// Parse component flags (--skill, --command, --agent)
|
|
37
36
|
const foundComponentFlags = [];
|
|
38
37
|
for (const flag of COMPONENT_FLAGS) {
|
|
39
38
|
const idx = argv.indexOf(flag);
|
|
@@ -56,7 +55,6 @@ export function parseArgs(argv) {
|
|
|
56
55
|
printError('--plugin and component flags (--skill, --command, --agent) cannot be used together');
|
|
57
56
|
process.exit(1);
|
|
58
57
|
}
|
|
59
|
-
// Parse optional --source-path
|
|
60
58
|
let pluginPath = val;
|
|
61
59
|
const sourcePathIdx = argv.indexOf('--source-path');
|
|
62
60
|
if (sourcePathIdx !== -1) {
|
|
@@ -69,12 +67,10 @@ export function parseArgs(argv) {
|
|
|
69
67
|
}
|
|
70
68
|
componentFlag = { type, repoPath: val, pluginPath };
|
|
71
69
|
}
|
|
72
|
-
// --source-path without a component flag
|
|
73
70
|
if (!componentFlag && argv.includes('--source-path')) {
|
|
74
71
|
printError('--source-path requires a component flag (--skill, --command, or --agent)');
|
|
75
72
|
process.exit(1);
|
|
76
73
|
}
|
|
77
|
-
// Filter out flags and their values
|
|
78
74
|
const flagsWithValues = new Set(['--scope', '--plugin', '--source-path', '--limit']);
|
|
79
75
|
for (const f of COMPONENT_FLAGS)
|
|
80
76
|
flagsWithValues.add(f);
|
|
@@ -82,7 +78,6 @@ export function parseArgs(argv) {
|
|
|
82
78
|
(i === 0 || !flagsWithValues.has(argv[i - 1])));
|
|
83
79
|
const first = positional[0] ?? null;
|
|
84
80
|
const second = positional[1] ?? null;
|
|
85
|
-
// Route commands
|
|
86
81
|
if (first === 'list')
|
|
87
82
|
return { command: 'list', identifier: null, plugin, yes, scope, componentFlag };
|
|
88
83
|
if (first === 'recommend')
|
|
@@ -93,7 +88,6 @@ export function parseArgs(argv) {
|
|
|
93
88
|
return { command: 'remove', identifier: second, plugin, yes, scope, componentFlag };
|
|
94
89
|
if (first === 'add')
|
|
95
90
|
return { command: 'add', identifier: second, plugin, yes, scope, componentFlag };
|
|
96
|
-
// Default: treat first positional as identifier for install
|
|
97
91
|
return { command: 'add', identifier: first, plugin, yes, scope, componentFlag };
|
|
98
92
|
}
|
|
99
93
|
export function validatePlugin(args) {
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { Scope } from './prompts.js';
|
|
2
2
|
import type { MarketplaceJSON } from './fetch.js';
|
|
3
|
-
/**
|
|
4
|
-
* Structured outcome of one plugin install attempt, discriminated on `ok` so
|
|
5
|
-
* a failure always carries its `stage` and `error`. `stage` names the step
|
|
6
|
-
* that failed so callers can classify failures without parsing `error` text
|
|
7
|
-
* (the recommend flow maps stages to its allowlisted failureClass enum —
|
|
8
|
-
* never the raw error string).
|
|
9
|
-
*/
|
|
3
|
+
/** `stage` lets callers classify failures without parsing `error` (recommend maps it to its failureClass allowlist). */
|
|
10
4
|
export type PluginInstallResult = {
|
|
11
5
|
name: string;
|
|
12
6
|
ok: true;
|
|
@@ -18,25 +12,12 @@ export type PluginInstallResult = {
|
|
|
18
12
|
error: string;
|
|
19
13
|
};
|
|
20
14
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* exit-free — always returns a structured result, so interactive callers
|
|
25
|
-
* (collection/wrapper installs, the recommend flow) own their own output and
|
|
26
|
-
* exit semantics.
|
|
27
|
-
*
|
|
28
|
-
* `skipMarketplaceAdd` lets multi-plugin callers that registered the shared
|
|
29
|
-
* marketplace once up-front (runNativeManifestInstall) reuse the entry-lookup
|
|
30
|
-
* + install steps without re-adding per plugin.
|
|
15
|
+
* Prompt-free and exit-free: callers own output and exit codes. Looks the
|
|
16
|
+
* plugin up by name (never a blind `plugins[0]`). `skipMarketplaceAdd` is for
|
|
17
|
+
* callers that already registered the marketplace once.
|
|
31
18
|
*/
|
|
32
19
|
export declare function installPluginFromManifest(manifest: MarketplaceJSON, pluginName: string, registerUrl: string, scope: Scope, opts?: {
|
|
33
20
|
skipMarketplaceAdd?: boolean;
|
|
34
21
|
}): PluginInstallResult;
|
|
35
22
|
export declare function runCollectionInstall(url: string, yes: boolean, scopeOverride: Scope | null): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Install a single plugin via its ClaudePluginHub wrapper marketplace
|
|
38
|
-
* (p/<slug> → /api/plugins/<slug>/marketplace.json). The wrapper emits a
|
|
39
|
-
* spec-correct source (git-subdir for monorepo plugins), so this is the
|
|
40
|
-
* correct one-liner for plugins without an indexed native marketplace.
|
|
41
|
-
*/
|
|
42
23
|
export declare function runWrapperPluginInstall(url: string, yes: boolean, scopeOverride: Scope | null): Promise<void>;
|
|
@@ -2,12 +2,7 @@ import { scopePrompt, checkboxPrompt } from './prompts.js';
|
|
|
2
2
|
import { fetchMarketplace } from './fetch.js';
|
|
3
3
|
import { checkClaudeCli, claudeMarketplaceAdd, claudePluginInstall, } from './native.js';
|
|
4
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
|
-
*/
|
|
5
|
+
/** Mirrors Claude Code's marketplace-name rejection so a bad manifest fails with a clear message. */
|
|
11
6
|
function isInstallableMarketplaceName(name) {
|
|
12
7
|
return (name.length > 0 &&
|
|
13
8
|
!name.includes('/') &&
|
|
@@ -16,16 +11,9 @@ function isInstallableMarketplaceName(name) {
|
|
|
16
11
|
name !== '.');
|
|
17
12
|
}
|
|
18
13
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* exit-free — always returns a structured result, so interactive callers
|
|
23
|
-
* (collection/wrapper installs, the recommend flow) own their own output and
|
|
24
|
-
* exit semantics.
|
|
25
|
-
*
|
|
26
|
-
* `skipMarketplaceAdd` lets multi-plugin callers that registered the shared
|
|
27
|
-
* marketplace once up-front (runNativeManifestInstall) reuse the entry-lookup
|
|
28
|
-
* + install steps without re-adding per plugin.
|
|
14
|
+
* Prompt-free and exit-free: callers own output and exit codes. Looks the
|
|
15
|
+
* plugin up by name (never a blind `plugins[0]`). `skipMarketplaceAdd` is for
|
|
16
|
+
* callers that already registered the marketplace once.
|
|
29
17
|
*/
|
|
30
18
|
export function installPluginFromManifest(manifest, pluginName, registerUrl, scope, opts = {}) {
|
|
31
19
|
if (!isInstallableMarketplaceName(manifest.name)) {
|
|
@@ -58,19 +46,9 @@ export function installPluginFromManifest(manifest, pluginName, registerUrl, sco
|
|
|
58
46
|
return { name: pluginName, ok: true };
|
|
59
47
|
}
|
|
60
48
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* Used for plugin collections (c/<userId>/<slug>) and single-plugin wrapper
|
|
66
|
-
* marketplaces (p/<slug>). Both reference WHOLE plugins (source only —
|
|
67
|
-
* github/git-subdir/git), which the component downloader can't cherry-pick,
|
|
68
|
-
* so native delegation is the correct install path. This also covers mixed
|
|
69
|
-
* collections: user-plugin entries (component-path arrays) are valid
|
|
70
|
-
* marketplace entries too, so nothing is silently dropped.
|
|
71
|
-
*
|
|
72
|
-
* Requires the `claude` binary (unlike the `u/` component install path).
|
|
73
|
-
* Native owns the installed state — manage with `claude plugin ...`.
|
|
49
|
+
* c/ and p/ installs: `claude plugin marketplace add <url>` once, then
|
|
50
|
+
* `claude plugin install` per selected plugin. Claude Code owns the installed
|
|
51
|
+
* state (no lock entry).
|
|
74
52
|
*/
|
|
75
53
|
async function runNativeManifestInstall(url, yes, scopeOverride, kind) {
|
|
76
54
|
if (!checkClaudeCli())
|
|
@@ -90,7 +68,6 @@ async function runNativeManifestInstall(url, yes, scopeOverride, kind) {
|
|
|
90
68
|
'Please report this to claudepluginhub.com.');
|
|
91
69
|
process.exit(1);
|
|
92
70
|
}
|
|
93
|
-
// Plugin selection
|
|
94
71
|
let selectedPlugins = manifest.plugins;
|
|
95
72
|
if (!yes && manifest.plugins.length > 1) {
|
|
96
73
|
print('');
|
|
@@ -110,7 +87,6 @@ async function runNativeManifestInstall(url, yes, scopeOverride, kind) {
|
|
|
110
87
|
process.exit(0);
|
|
111
88
|
}
|
|
112
89
|
}
|
|
113
|
-
// Scope picker
|
|
114
90
|
let scope = scopeOverride ?? 'project';
|
|
115
91
|
if (!yes && !scopeOverride) {
|
|
116
92
|
print('');
|
|
@@ -121,11 +97,8 @@ async function runNativeManifestInstall(url, yes, scopeOverride, kind) {
|
|
|
121
97
|
}
|
|
122
98
|
scope = chosenScope;
|
|
123
99
|
}
|
|
124
|
-
// Register the endpoint itself
|
|
125
|
-
//
|
|
126
|
-
// `claude plugin marketplace update` picks up upstream changes. Strip query
|
|
127
|
-
// params (e.g. the one-shot ?source=cli tracking param) so native refreshes
|
|
128
|
-
// hit the canonical URL.
|
|
100
|
+
// Register the endpoint URL itself so `claude plugin marketplace update`
|
|
101
|
+
// follows the hosted manifest; drop the query so refreshes skip ?source=cli.
|
|
129
102
|
const registerUrl = new URL(url);
|
|
130
103
|
registerUrl.search = '';
|
|
131
104
|
print('');
|
|
@@ -136,8 +109,6 @@ async function runNativeManifestInstall(url, yes, scopeOverride, kind) {
|
|
|
136
109
|
process.exit(1);
|
|
137
110
|
}
|
|
138
111
|
printSuccess(`Marketplace "${manifest.name}" added`);
|
|
139
|
-
// Install each selected plugin via the shared prompt-free operation (the
|
|
140
|
-
// marketplace was registered once above, so each call skips the add step).
|
|
141
112
|
let failures = 0;
|
|
142
113
|
for (const plugin of selectedPlugins) {
|
|
143
114
|
printStep(`Installing ${plugin.name}...`);
|
|
@@ -163,7 +134,6 @@ async function runNativeManifestInstall(url, yes, scopeOverride, kind) {
|
|
|
163
134
|
print(` ${DIM}claude plugin uninstall <plugin>${RESET}`);
|
|
164
135
|
print(` ${DIM}claude plugin marketplace remove ${manifest.name}${RESET}`);
|
|
165
136
|
print('');
|
|
166
|
-
// Nothing installed at all — that's a failure, not a partial success.
|
|
167
137
|
if (failures === selectedPlugins.length) {
|
|
168
138
|
process.exit(1);
|
|
169
139
|
}
|
|
@@ -171,12 +141,6 @@ async function runNativeManifestInstall(url, yes, scopeOverride, kind) {
|
|
|
171
141
|
export async function runCollectionInstall(url, yes, scopeOverride) {
|
|
172
142
|
return runNativeManifestInstall(url, yes, scopeOverride, 'collection');
|
|
173
143
|
}
|
|
174
|
-
/**
|
|
175
|
-
* Install a single plugin via its ClaudePluginHub wrapper marketplace
|
|
176
|
-
* (p/<slug> → /api/plugins/<slug>/marketplace.json). The wrapper emits a
|
|
177
|
-
* spec-correct source (git-subdir for monorepo plugins), so this is the
|
|
178
|
-
* correct one-liner for plugins without an indexed native marketplace.
|
|
179
|
-
*/
|
|
180
144
|
export async function runWrapperPluginInstall(url, yes, scopeOverride) {
|
|
181
145
|
return runNativeManifestInstall(url, yes, scopeOverride, 'plugin');
|
|
182
146
|
}
|
|
@@ -5,11 +5,8 @@ import { installComponent, getBaseDir } from './download.js';
|
|
|
5
5
|
import { readLock, writeLock, addCollection, componentKey } from './lock.js';
|
|
6
6
|
import { fetchDefaultBranch, fetchTree } from './github.js';
|
|
7
7
|
import { print, printStep, printSuccess, printError, BOLD, RESET, DIM, GREEN, } from './output.js';
|
|
8
|
+
// Lock apiUrl for direct installs; `update` skips these.
|
|
8
9
|
const DIRECT_SENTINEL = '';
|
|
9
|
-
/**
|
|
10
|
-
* Validate that pluginPath has the expected path suffix for its type
|
|
11
|
-
* (/SKILL.md for skills, .md for commands/agents).
|
|
12
|
-
*/
|
|
13
10
|
function validatePathFormat(componentType, pluginPath) {
|
|
14
11
|
if (componentType === 'skill') {
|
|
15
12
|
if (!pluginPath.endsWith('/SKILL.md')) {
|
|
@@ -24,10 +21,7 @@ function validatePathFormat(componentType, pluginPath) {
|
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Validate that repoPath and pluginPath are aligned.
|
|
29
|
-
* Either they are equal (no subdir) or repoPath ends with '/' + pluginPath (monorepo).
|
|
30
|
-
*/
|
|
24
|
+
/** repoPath equals pluginPath, or ends with '/' + pluginPath (monorepo subdir). */
|
|
31
25
|
function validatePathAlignment(repoPath, pluginPath) {
|
|
32
26
|
if (!repoPath || !pluginPath) {
|
|
33
27
|
printError('Both repo path and source path must be non-empty');
|
|
@@ -38,9 +32,7 @@ function validatePathAlignment(repoPath, pluginPath) {
|
|
|
38
32
|
process.exit(1);
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Derive componentName from pluginPath, matching flattenComponents() semantics in fetch.ts.
|
|
43
|
-
*/
|
|
35
|
+
/** Must match flattenComponents() naming in fetch.ts. */
|
|
44
36
|
function deriveComponentName(componentType, pluginPath) {
|
|
45
37
|
if (componentType === 'skill') {
|
|
46
38
|
// "skills/review/SKILL.md" → "review"
|
|
@@ -48,7 +40,6 @@ function deriveComponentName(componentType, pluginPath) {
|
|
|
48
40
|
const withoutSuffix = pluginPath.replace(/\/SKILL\.md$/, '');
|
|
49
41
|
return withoutSuffix.split('/').pop();
|
|
50
42
|
}
|
|
51
|
-
// Commands/agents: strip type prefix if present, then strip .md
|
|
52
43
|
// "commands/git/commit.md" → "git/commit"
|
|
53
44
|
// "custom/cmds/deploy.md" → "custom/cmds/deploy"
|
|
54
45
|
const typeDir = componentType === 'command' ? 'commands/' : 'agents/';
|
|
@@ -57,9 +48,6 @@ function deriveComponentName(componentType, pluginPath) {
|
|
|
57
48
|
: pluginPath;
|
|
58
49
|
return relPath.replace(/\.md$/, '');
|
|
59
50
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Compute the local destination path for a component.
|
|
62
|
-
*/
|
|
63
51
|
function computeDestPath(scope, componentType, pluginPath, componentName) {
|
|
64
52
|
const baseDir = getBaseDir(scope);
|
|
65
53
|
if (componentType === 'skill') {
|
|
@@ -73,10 +61,8 @@ function computeDestPath(scope, componentType, pluginPath, componentName) {
|
|
|
73
61
|
return join(baseDir, subdir, relPath);
|
|
74
62
|
}
|
|
75
63
|
export async function runDirectComponentInstall(ownerRepo, componentType, repoPath, pluginPath, yes, scopeOverride) {
|
|
76
|
-
// Step 1: Validate path format and alignment
|
|
77
64
|
validatePathFormat(componentType, pluginPath);
|
|
78
65
|
validatePathAlignment(repoPath, pluginPath);
|
|
79
|
-
// Step 2: Fetch tree, handle truncation
|
|
80
66
|
printStep('Fetching repository tree...');
|
|
81
67
|
const branch = await fetchDefaultBranch(ownerRepo);
|
|
82
68
|
if (!branch) {
|
|
@@ -93,14 +79,13 @@ export async function runDirectComponentInstall(ownerRepo, componentType, repoPa
|
|
|
93
79
|
printError(`Install the full plugin instead: npx claudepluginhub ${ownerRepo}`);
|
|
94
80
|
process.exit(1);
|
|
95
81
|
}
|
|
96
|
-
// Step 3: Verify exact repoPath in tree
|
|
97
82
|
const exists = tree.tree.some((e) => e.type === 'blob' && e.path === repoPath);
|
|
98
83
|
if (!exists) {
|
|
99
84
|
printError(`File not found: ${repoPath}`);
|
|
100
85
|
printError(`Verify the path exists in ${ownerRepo} on branch ${branch}`);
|
|
101
86
|
process.exit(1);
|
|
102
87
|
}
|
|
103
|
-
//
|
|
88
|
+
// A SKILL.md inside another skill's directory is a template/asset, not a skill.
|
|
104
89
|
if (componentType === 'skill') {
|
|
105
90
|
const skillDir = repoPath.replace(/\/SKILL\.md$/, '').toLowerCase();
|
|
106
91
|
const isNested = tree.tree.some((e) => e.type === 'blob' &&
|
|
@@ -112,10 +97,8 @@ export async function runDirectComponentInstall(ownerRepo, componentType, repoPa
|
|
|
112
97
|
process.exit(1);
|
|
113
98
|
}
|
|
114
99
|
}
|
|
115
|
-
// Step 5: Derive component name
|
|
116
100
|
const componentName = deriveComponentName(componentType, pluginPath);
|
|
117
101
|
printSuccess(`${componentName} (${componentType})`);
|
|
118
|
-
// Step 6: Scope picker
|
|
119
102
|
let scope = scopeOverride ?? 'project';
|
|
120
103
|
if (!yes && !scopeOverride) {
|
|
121
104
|
print('');
|
|
@@ -126,11 +109,10 @@ export async function runDirectComponentInstall(ownerRepo, componentType, repoPa
|
|
|
126
109
|
}
|
|
127
110
|
scope = chosenScope;
|
|
128
111
|
}
|
|
129
|
-
// Step 7: Collision detection (two layers)
|
|
130
112
|
const lock = readLock(scope);
|
|
131
113
|
const existing = lock.collections[ownerRepo];
|
|
132
114
|
const newKey = componentKey(ownerRepo, repoPath);
|
|
133
|
-
//
|
|
115
|
+
// Lock collision: same pluginPath already installed from a different repoPath.
|
|
134
116
|
if (existing) {
|
|
135
117
|
for (const [key, comp] of Object.entries(existing.components)) {
|
|
136
118
|
if (key !== newKey && comp.sourcePath === pluginPath) {
|
|
@@ -141,8 +123,8 @@ export async function runDirectComponentInstall(ownerRepo, componentType, repoPa
|
|
|
141
123
|
}
|
|
142
124
|
}
|
|
143
125
|
}
|
|
144
|
-
// Layer 2: Filesystem collision — destination already occupied
|
|
145
126
|
const isReinstall = existing?.components[newKey] !== undefined;
|
|
127
|
+
// Filesystem collision: destination occupied by something this lock doesn't own.
|
|
146
128
|
if (!isReinstall) {
|
|
147
129
|
const destPath = computeDestPath(scope, componentType, pluginPath, componentName);
|
|
148
130
|
if (existsSync(destPath)) {
|
|
@@ -152,7 +134,6 @@ export async function runDirectComponentInstall(ownerRepo, componentType, repoPa
|
|
|
152
134
|
process.exit(1);
|
|
153
135
|
}
|
|
154
136
|
}
|
|
155
|
-
// Step 8: Build FlatComponent and install
|
|
156
137
|
print('');
|
|
157
138
|
printStep(`Installing ${componentName}...`);
|
|
158
139
|
const component = {
|
|
@@ -161,6 +142,8 @@ export async function runDirectComponentInstall(ownerRepo, componentType, repoPa
|
|
|
161
142
|
componentName,
|
|
162
143
|
sourcePath: pluginPath,
|
|
163
144
|
downloadPath: repoPath,
|
|
145
|
+
// No marketplace entry, so no pin: always the default branch.
|
|
146
|
+
ref: null,
|
|
164
147
|
inlineConfig: null,
|
|
165
148
|
};
|
|
166
149
|
const result = await installComponent(component, scope, false);
|
|
@@ -168,14 +151,12 @@ export async function runDirectComponentInstall(ownerRepo, componentType, repoPa
|
|
|
168
151
|
printError(`Failed to install ${componentName}. Check the error messages above for details.`);
|
|
169
152
|
process.exit(1);
|
|
170
153
|
}
|
|
171
|
-
// Step 9: Merge into lock file
|
|
172
154
|
const mergedComponents = {
|
|
173
155
|
...(existing?.components ?? {}),
|
|
174
156
|
[newKey]: result.lock,
|
|
175
157
|
};
|
|
176
158
|
addCollection(lock, ownerRepo, DIRECT_SENTINEL, scope, mergedComponents);
|
|
177
159
|
writeLock(scope, lock);
|
|
178
|
-
// Step 10: Print result
|
|
179
160
|
printSuccess(componentName);
|
|
180
161
|
print('');
|
|
181
162
|
print(`${GREEN}${BOLD}Done!${RESET} ${componentType} "${componentName}" installed.`);
|
package/dist/detect.d.ts
CHANGED
package/dist/detect.js
CHANGED
|
@@ -2,7 +2,6 @@ import { fetchDefaultBranch, fetchTree, downloadFile } from './github.js';
|
|
|
2
2
|
import { printError } from './output.js';
|
|
3
3
|
import { VALID_NAME_RE, isOwnerRepo } from './validation.js';
|
|
4
4
|
import { sanitizeName } from './wrapper.js';
|
|
5
|
-
export { isOwnerRepo };
|
|
6
5
|
const COMPONENT_PATTERNS = [
|
|
7
6
|
/^commands\/.*\.md$/,
|
|
8
7
|
/^agents\/.*\.md$/,
|
|
@@ -38,7 +37,6 @@ export async function detectRepo(ownerRepo) {
|
|
|
38
37
|
}
|
|
39
38
|
const hasMarketplace = tree.tree.some((e) => e.type === 'blob' && e.path === '.claude-plugin/marketplace.json');
|
|
40
39
|
const hasPluginJson = tree.tree.some((e) => e.type === 'blob' && e.path === '.claude-plugin/plugin.json');
|
|
41
|
-
// Marketplace repo
|
|
42
40
|
if (hasMarketplace) {
|
|
43
41
|
const content = await downloadFile(ownerRepo, branch, '.claude-plugin/marketplace.json');
|
|
44
42
|
if (!content) {
|
|
@@ -94,7 +92,7 @@ export async function detectRepo(ownerRepo) {
|
|
|
94
92
|
name,
|
|
95
93
|
description: typeof plugin.description === 'string' ? plugin.description : null,
|
|
96
94
|
source,
|
|
97
|
-
strict: plugin.strict
|
|
95
|
+
strict: plugin.strict !== false,
|
|
98
96
|
});
|
|
99
97
|
}
|
|
100
98
|
return {
|
|
@@ -105,7 +103,6 @@ export async function detectRepo(ownerRepo) {
|
|
|
105
103
|
},
|
|
106
104
|
};
|
|
107
105
|
}
|
|
108
|
-
// Plugin with manifest
|
|
109
106
|
if (hasPluginJson) {
|
|
110
107
|
const content = await downloadFile(ownerRepo, branch, '.claude-plugin/plugin.json');
|
|
111
108
|
if (!content) {
|
|
@@ -128,10 +125,9 @@ export async function detectRepo(ownerRepo) {
|
|
|
128
125
|
printError(`plugin.json has an invalid name: "${pluginJson.name}". Must match [a-zA-Z0-9_.-]+`);
|
|
129
126
|
process.exit(1);
|
|
130
127
|
}
|
|
131
|
-
|
|
132
|
-
return { kind: 'plugin', name: pluginJson.name, strict };
|
|
128
|
+
return { kind: 'plugin', name: pluginJson.name, strict: pluginJson.strict !== false };
|
|
133
129
|
}
|
|
134
|
-
//
|
|
130
|
+
// No manifest: a plugin only if component files sit at the repo root.
|
|
135
131
|
if (hasComponentFiles(tree.tree)) {
|
|
136
132
|
const repo = ownerRepo.split('/')[1];
|
|
137
133
|
return {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { InstallationRecord } from './report.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* spawnable, non-zero exit, output not a JSON array) is an operational
|
|
8
|
-
* failure the caller maps to exit 2.
|
|
3
|
+
* `claude plugin list --json` is the only installed-plugin source of truth and
|
|
4
|
+
* its shape is undocumented: malformed elements are dropped and counted, while a
|
|
5
|
+
* top-level failure (not spawnable, non-zero exit, not a JSON array) is
|
|
6
|
+
* returned as ProbeFailure, which the caller maps to exit 2.
|
|
9
7
|
*/
|
|
10
8
|
export interface ClaudeExecResult {
|
|
11
9
|
ok: boolean;
|
|
@@ -48,8 +48,7 @@ function parseRecord(element) {
|
|
|
48
48
|
return null;
|
|
49
49
|
if (raw.projectPath !== undefined && typeof raw.projectPath !== 'string')
|
|
50
50
|
return null;
|
|
51
|
-
//
|
|
52
|
-
// from another program's output and must not inflate the report.
|
|
51
|
+
// Externally sourced strings must not inflate the report.
|
|
53
52
|
const id = boundEvidenceString(raw.id);
|
|
54
53
|
const { name, marketplace } = splitId(id);
|
|
55
54
|
const rawScope = boundEvidenceString(raw.scope);
|
package/dist/doctor/color.d.ts
CHANGED
package/dist/doctor/color.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InstallationRecord, ScanResult } from './report.js';
|
|
2
2
|
import type { SelectionOutput } from './select.js';
|
|
3
3
|
export declare function scanEquivalent(aRecord: InstallationRecord, aScan: ScanResult, bRecord: InstallationRecord, bScan: ScanResult): boolean;
|
|
4
|
-
/**
|
|
4
|
+
/** Grouping key shared with `ruleDuplicateRecord`. */
|
|
5
5
|
export declare function duplicateRecordKey(record: InstallationRecord): string;
|
|
6
6
|
export declare function resolveEquivalences(base: SelectionOutput, scanFor: (record: InstallationRecord) => ScanResult): {
|
|
7
7
|
resolved: SelectionOutput;
|