claudepluginhub 0.1.0 → 0.1.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/fetch.js +9 -7
- package/package.json +1 -1
package/dist/fetch.js
CHANGED
|
@@ -14,7 +14,7 @@ export function resolveMarketplaceUrl(input) {
|
|
|
14
14
|
printError(`Only claudepluginhub.com URLs are supported. Got: ${parsed.hostname}`);
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return parsed.href;
|
|
18
18
|
}
|
|
19
19
|
catch {
|
|
20
20
|
printError('Invalid URL format.');
|
|
@@ -32,11 +32,11 @@ export function resolveMarketplaceUrl(input) {
|
|
|
32
32
|
export async function fetchMarketplace(url) {
|
|
33
33
|
try {
|
|
34
34
|
// Ensure ?source=cli is present for install tracking
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const parsed = new URL(url);
|
|
36
|
+
if (!parsed.searchParams.has('source')) {
|
|
37
|
+
parsed.searchParams.set('source', 'cli');
|
|
38
|
+
}
|
|
39
|
+
const fetchUrl = parsed.toString();
|
|
40
40
|
const response = await fetch(fetchUrl, {
|
|
41
41
|
signal: AbortSignal.timeout(15_000),
|
|
42
42
|
});
|
|
@@ -50,7 +50,9 @@ export async function fetchMarketplace(url) {
|
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
const data = (await response.json());
|
|
53
|
-
if (!data.name ||
|
|
53
|
+
if (!data.name ||
|
|
54
|
+
!Array.isArray(data.plugins) ||
|
|
55
|
+
data.plugins.some((p) => !p.name)) {
|
|
54
56
|
printError('Invalid marketplace JSON format.');
|
|
55
57
|
return null;
|
|
56
58
|
}
|