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/dist/remove.js
CHANGED
|
@@ -12,7 +12,6 @@ function removeConfigKeys(lock) {
|
|
|
12
12
|
try {
|
|
13
13
|
const settings = JSON.parse(readFileSync(lock.configFile, 'utf-8'));
|
|
14
14
|
if (lock.type === 'hook' && lock.configFragment) {
|
|
15
|
-
// Remove hooks by deep equality
|
|
16
15
|
const hooks = settings.hooks;
|
|
17
16
|
if (hooks) {
|
|
18
17
|
const fragment = lock.configFragment;
|
|
@@ -30,7 +29,7 @@ function removeConfigKeys(lock) {
|
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
else if (lock.configKeys) {
|
|
33
|
-
//
|
|
32
|
+
// Key paths are `section.key` (mcpServers.x, lspServers.x).
|
|
34
33
|
for (const keyPath of lock.configKeys) {
|
|
35
34
|
const parts = keyPath.split('.');
|
|
36
35
|
if (parts.length === 2) {
|
|
@@ -58,9 +57,9 @@ function isSafeRemovePath(targetPath) {
|
|
|
58
57
|
return (resolved.startsWith(userBase + sep) ||
|
|
59
58
|
resolved.startsWith(projectBase + sep));
|
|
60
59
|
}
|
|
61
|
-
function
|
|
60
|
+
export function removeComponentByLock(lock) {
|
|
62
61
|
if (lock.configFile) {
|
|
63
|
-
// Config-based component
|
|
62
|
+
// Config-based component: remove its keys, never the settings file itself.
|
|
64
63
|
removeConfigKeys(lock);
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
@@ -82,9 +81,6 @@ function removeFiles(lock) {
|
|
|
82
81
|
// Best effort
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
export function removeComponentByLock(comp) {
|
|
86
|
-
removeFiles(comp);
|
|
87
|
-
}
|
|
88
84
|
export async function runDirectRemove(identifier, scope) {
|
|
89
85
|
const lock = readLock(scope);
|
|
90
86
|
const collection = lock.collections[identifier];
|
|
@@ -94,7 +90,7 @@ export async function runDirectRemove(identifier, scope) {
|
|
|
94
90
|
}
|
|
95
91
|
printStep(`Removing ${Object.keys(collection.components).length} component(s) from ${scope} scope...`);
|
|
96
92
|
for (const [, comp] of Object.entries(collection.components)) {
|
|
97
|
-
|
|
93
|
+
removeComponentByLock(comp);
|
|
98
94
|
printSuccess(`${comp.componentName} (${comp.type})`);
|
|
99
95
|
}
|
|
100
96
|
removeCollection(lock, identifier);
|
|
@@ -104,7 +100,6 @@ export async function runDirectRemove(identifier, scope) {
|
|
|
104
100
|
print('');
|
|
105
101
|
}
|
|
106
102
|
export async function runRemove(identifier) {
|
|
107
|
-
// Try all scopes to find the collection
|
|
108
103
|
const scopes = ['project', 'local', 'user'];
|
|
109
104
|
let foundScope = null;
|
|
110
105
|
let foundCollection = null;
|
|
@@ -123,7 +118,7 @@ export async function runRemove(identifier) {
|
|
|
123
118
|
}
|
|
124
119
|
printStep(`Removing ${Object.keys(foundCollection.components).length} component(s)...`);
|
|
125
120
|
for (const [, comp] of Object.entries(foundCollection.components)) {
|
|
126
|
-
|
|
121
|
+
removeComponentByLock(comp);
|
|
127
122
|
printSuccess(`${comp.componentName} (${comp.type})`);
|
|
128
123
|
}
|
|
129
124
|
const lock = readLock(foundScope);
|
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);
|
|
@@ -29,7 +30,7 @@ export async function runUpdate(identifier) {
|
|
|
29
30
|
if (identifier && collection.identifier !== identifier)
|
|
30
31
|
continue;
|
|
31
32
|
found = true;
|
|
32
|
-
//
|
|
33
|
+
// apiUrl === '' marks a direct install; there is no manifest to update from.
|
|
33
34
|
if (collection.apiUrl === '') {
|
|
34
35
|
print(`${BOLD}${collection.identifier}${RESET} — direct install, skipped`);
|
|
35
36
|
for (const comp of Object.values(collection.components)) {
|
|
@@ -63,7 +64,6 @@ export async function runUpdate(identifier) {
|
|
|
63
64
|
removed.push(key);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
// Check hashes before downloading to avoid unnecessary re-downloads
|
|
67
67
|
const changed = [];
|
|
68
68
|
for (const comp of toCheck) {
|
|
69
69
|
const key = componentKey(comp.source, comp.sourcePath);
|
|
@@ -77,14 +77,12 @@ export async function runUpdate(identifier) {
|
|
|
77
77
|
printSuccess('Already up to date');
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
|
-
// Remove deleted components (including config cleanup)
|
|
81
80
|
for (const key of removed) {
|
|
82
81
|
const comp = collection.components[key];
|
|
83
82
|
removeComponentByLock(comp);
|
|
84
83
|
delete collection.components[key];
|
|
85
84
|
printSuccess(`Removed ${comp.componentName} (${comp.type})`);
|
|
86
85
|
}
|
|
87
|
-
// Add new components
|
|
88
86
|
for (const comp of added) {
|
|
89
87
|
const result = await installComponent(comp, scope, false);
|
|
90
88
|
if (result.status === 'installed') {
|
|
@@ -96,7 +94,6 @@ export async function runUpdate(identifier) {
|
|
|
96
94
|
printFail(`${comp.componentName} (${comp.type})`, 'download failed');
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
|
-
// Re-download changed components: clean up old files/config, then reinstall
|
|
100
97
|
for (const comp of changed) {
|
|
101
98
|
const key = componentKey(comp.source, comp.sourcePath);
|
|
102
99
|
const existing = collection.components[key];
|
package/dist/validation.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
/** Shared validation constants and helpers for the CLI. */
|
|
2
|
-
/** Matches a single valid name segment: alphanumeric, underscore, dot, hyphen. */
|
|
3
1
|
export declare const VALID_NAME_RE: RegExp;
|
|
4
|
-
/** Matches an owner/repo string (two valid name segments separated by /). */
|
|
5
|
-
export declare const OWNER_REPO_RE: RegExp;
|
|
6
|
-
/** Validates that a string is a well-formed owner/repo identifier. */
|
|
7
2
|
export declare function isOwnerRepo(identifier: string): boolean;
|
package/dist/validation.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
/** Shared validation constants and helpers for the CLI. */
|
|
2
|
-
/** Matches a single valid name segment: alphanumeric, underscore, dot, hyphen. */
|
|
3
1
|
export const VALID_NAME_RE = /^[a-zA-Z0-9_.-]+$/;
|
|
4
|
-
|
|
5
|
-
export const OWNER_REPO_RE = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/;
|
|
6
|
-
/** Validates that a string is a well-formed owner/repo identifier. */
|
|
2
|
+
const OWNER_REPO_RE = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/;
|
|
7
3
|
export function isOwnerRepo(identifier) {
|
|
8
4
|
if (!OWNER_REPO_RE.test(identifier))
|
|
9
5
|
return false;
|
|
10
6
|
const [owner, repo] = identifier.split('/');
|
|
11
|
-
// Reject segments that are purely dots (e.g. "..", ".")
|
|
12
7
|
if (/^\.+$/.test(owner) || /^\.+$/.test(repo))
|
|
13
8
|
return false;
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// symmetry). Repos of the literal GitHub users "u"/"c"/"p" are not
|
|
17
|
-
// installable via the bare form — an acceptable, documented trade-off.
|
|
9
|
+
// p/<slug> is owner/repo-shaped but means a wrapper install (u/ and c/ are
|
|
10
|
+
// reserved for symmetry), so GitHub users "u"/"c"/"p" can't use the bare form.
|
|
18
11
|
if (owner === 'u' || owner === 'c' || owner === 'p')
|
|
19
12
|
return false;
|
|
20
13
|
return true;
|
package/dist/wrapper.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Scope } from './prompts.js';
|
|
2
2
|
export declare function sanitizeName(raw: string): string;
|
|
3
|
-
export declare function validateManifestName(name: string): boolean;
|
|
4
3
|
export declare function getWrapperDir(ownerRepo: string, scope: Scope): string;
|
|
5
4
|
export declare function getMarketplaceName(ownerRepo: string, scope: Scope): string;
|
|
6
5
|
export interface WrapperOptions {
|
package/dist/wrapper.js
CHANGED
|
@@ -2,7 +2,6 @@ import { mkdirSync, writeFileSync, readFileSync, existsSync, rmSync } from 'node
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
|
-
import { VALID_NAME_RE } from './validation.js';
|
|
6
5
|
export function sanitizeName(raw) {
|
|
7
6
|
return (raw
|
|
8
7
|
.toLowerCase()
|
|
@@ -10,9 +9,6 @@ export function sanitizeName(raw) {
|
|
|
10
9
|
.replace(/-+/g, '-')
|
|
11
10
|
.replace(/^-|-$/g, '') || 'plugin');
|
|
12
11
|
}
|
|
13
|
-
export function validateManifestName(name) {
|
|
14
|
-
return VALID_NAME_RE.test(name);
|
|
15
|
-
}
|
|
16
12
|
function cwdHash() {
|
|
17
13
|
return createHash('sha256').update(process.cwd()).digest('hex').slice(0, 8);
|
|
18
14
|
}
|
|
@@ -28,7 +24,6 @@ export function getWrapperDir(ownerRepo, scope) {
|
|
|
28
24
|
if (scope === 'project') {
|
|
29
25
|
return join(process.cwd(), '.claude', '.cpd-wrappers', name);
|
|
30
26
|
}
|
|
31
|
-
// user and local both go under ~/.claude/
|
|
32
27
|
return join(homedir(), '.claude', '.cpd-wrappers', name);
|
|
33
28
|
}
|
|
34
29
|
export function getMarketplaceName(ownerRepo, scope) {
|
|
@@ -80,7 +75,6 @@ export function readWrapperMeta(ownerRepo, scope) {
|
|
|
80
75
|
export function findWrapperScopes(ownerRepo) {
|
|
81
76
|
const scopes = [];
|
|
82
77
|
const [owner, repo] = ownerRepo.split('/');
|
|
83
|
-
// Check user scope
|
|
84
78
|
const userDir = join(homedir(), '.claude', '.cpd-wrappers');
|
|
85
79
|
if (existsSync(userDir)) {
|
|
86
80
|
const userWrapper = join(userDir, `${owner}-${repo}-user`);
|
|
@@ -88,7 +82,6 @@ export function findWrapperScopes(ownerRepo) {
|
|
|
88
82
|
scopes.push('user');
|
|
89
83
|
}
|
|
90
84
|
}
|
|
91
|
-
// Check project scope
|
|
92
85
|
const projectDir = join(process.cwd(), '.claude', '.cpd-wrappers');
|
|
93
86
|
if (existsSync(projectDir)) {
|
|
94
87
|
const projectWrapper = join(projectDir, `${owner}-${repo}-project`);
|
|
@@ -96,7 +89,7 @@ export function findWrapperScopes(ownerRepo) {
|
|
|
96
89
|
scopes.push('project');
|
|
97
90
|
}
|
|
98
91
|
}
|
|
99
|
-
//
|
|
92
|
+
// Local wrappers are keyed by cwd hash, so only the current cwd matches.
|
|
100
93
|
if (existsSync(userDir)) {
|
|
101
94
|
const localWrapper = join(userDir, `${owner}-${repo}-local-${cwdHash()}`);
|
|
102
95
|
if (existsSync(join(localWrapper, 'cpd-meta.json'))) {
|