claudepluginhub 0.4.0 → 0.4.2
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/detect.js +21 -13
- package/dist/github-install.js +1 -1
- package/dist/native.d.ts +1 -1
- package/dist/native.js +2 -2
- package/package.json +1 -1
package/dist/detect.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { fetchDefaultBranch, fetchTree, downloadFile } from './github.js';
|
|
2
2
|
import { printError } from './output.js';
|
|
3
|
+
import { sanitizeName } from './wrapper.js';
|
|
3
4
|
const OWNER_REPO_RE = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/;
|
|
4
5
|
const VALID_NAME_RE = /^[a-zA-Z0-9_.-]+$/;
|
|
5
6
|
export function isOwnerRepo(identifier) {
|
|
6
|
-
|
|
7
|
+
if (!OWNER_REPO_RE.test(identifier))
|
|
8
|
+
return false;
|
|
9
|
+
const [owner, repo] = identifier.split('/');
|
|
10
|
+
// Reject segments that are purely dots (e.g. "..", ".")
|
|
11
|
+
if (/^\.+$/.test(owner) || /^\.+$/.test(repo))
|
|
12
|
+
return false;
|
|
13
|
+
return true;
|
|
7
14
|
}
|
|
8
15
|
const COMPONENT_PATTERNS = [
|
|
9
16
|
/^commands\/.*\.md$/,
|
|
@@ -59,6 +66,10 @@ export async function detectRepo(ownerRepo) {
|
|
|
59
66
|
printError('marketplace.json is missing the required "name" field');
|
|
60
67
|
process.exit(1);
|
|
61
68
|
}
|
|
69
|
+
if (!VALID_NAME_RE.test(manifest.name)) {
|
|
70
|
+
printError(`marketplace.json has an invalid name: "${manifest.name}". Must match [a-zA-Z0-9_.-]+`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
62
73
|
const rawPlugins = manifest.plugins;
|
|
63
74
|
if (!Array.isArray(rawPlugins)) {
|
|
64
75
|
printError('marketplace.json "plugins" must be an array');
|
|
@@ -80,14 +91,18 @@ export async function detectRepo(ownerRepo) {
|
|
|
80
91
|
printError(`marketplace.json plugin has an invalid name: "${name}". Must match [a-zA-Z0-9_.-]+`);
|
|
81
92
|
process.exit(1);
|
|
82
93
|
}
|
|
94
|
+
const rawSource = plugin.source;
|
|
95
|
+
const source = rawSource &&
|
|
96
|
+
typeof rawSource === 'object' &&
|
|
97
|
+
typeof rawSource.source === 'string' &&
|
|
98
|
+
typeof rawSource.repo === 'string'
|
|
99
|
+
? rawSource
|
|
100
|
+
: { source: 'github', repo: ownerRepo };
|
|
83
101
|
validPlugins.push({
|
|
84
102
|
name,
|
|
85
103
|
description: typeof plugin.description === 'string' ? plugin.description : null,
|
|
86
|
-
source
|
|
87
|
-
|
|
88
|
-
repo: ownerRepo,
|
|
89
|
-
},
|
|
90
|
-
strict: plugin.strict ?? true,
|
|
104
|
+
source,
|
|
105
|
+
strict: plugin.strict === false ? false : true,
|
|
91
106
|
});
|
|
92
107
|
}
|
|
93
108
|
return {
|
|
@@ -135,10 +150,3 @@ export async function detectRepo(ownerRepo) {
|
|
|
135
150
|
}
|
|
136
151
|
return { kind: 'unknown' };
|
|
137
152
|
}
|
|
138
|
-
function sanitizeName(raw) {
|
|
139
|
-
return (raw
|
|
140
|
-
.toLowerCase()
|
|
141
|
-
.replace(/[^a-z0-9-]/g, '-')
|
|
142
|
-
.replace(/-+/g, '-')
|
|
143
|
-
.replace(/^-|-$/g, '') || 'plugin');
|
|
144
|
-
}
|
package/dist/github-install.js
CHANGED
|
@@ -172,7 +172,7 @@ export async function runGithubRemove(ownerRepo, scopeOverride) {
|
|
|
172
172
|
anyFailed = true;
|
|
173
173
|
}
|
|
174
174
|
// Best-effort: remove marketplace
|
|
175
|
-
const removeResult = claudeMarketplaceRemove(meta.marketplaceName);
|
|
175
|
+
const removeResult = claudeMarketplaceRemove(meta.marketplaceName, scope);
|
|
176
176
|
if (removeResult.ok) {
|
|
177
177
|
printSuccess(`Removed marketplace ${meta.marketplaceName}`);
|
|
178
178
|
}
|
package/dist/native.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare function claudePluginUninstall(plugin: string, scope: Scope): {
|
|
|
12
12
|
ok: boolean;
|
|
13
13
|
output: string;
|
|
14
14
|
};
|
|
15
|
-
export declare function claudeMarketplaceRemove(name: string): {
|
|
15
|
+
export declare function claudeMarketplaceRemove(name: string, scope: Scope): {
|
|
16
16
|
ok: boolean;
|
|
17
17
|
output: string;
|
|
18
18
|
};
|
package/dist/native.js
CHANGED
|
@@ -37,6 +37,6 @@ export function claudePluginInstall(plugin, marketplace, scope) {
|
|
|
37
37
|
export function claudePluginUninstall(plugin, scope) {
|
|
38
38
|
return runClaude(['plugin', 'uninstall', plugin, '--scope', scope]);
|
|
39
39
|
}
|
|
40
|
-
export function claudeMarketplaceRemove(name) {
|
|
41
|
-
return runClaude(['plugin', 'marketplace', 'remove', name]);
|
|
40
|
+
export function claudeMarketplaceRemove(name, scope) {
|
|
41
|
+
return runClaude(['plugin', 'marketplace', 'remove', name, '--scope', scope]);
|
|
42
42
|
}
|