skillhub 0.1.12 → 0.1.13
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/LICENSE +21 -0
- package/dist/index.js +96 -17
- package/package.json +59 -59
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SkillHub Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -26,11 +26,13 @@ import https from "https";
|
|
|
26
26
|
import http from "http";
|
|
27
27
|
var API_BASE_URL = process.env.SKILLHUB_API_URL || "https://skills.palebluedot.live/api";
|
|
28
28
|
var API_TIMEOUT = parseInt(process.env.SKILLHUB_API_TIMEOUT || "10000");
|
|
29
|
+
var API_FILES_TIMEOUT = parseInt(process.env.SKILLHUB_API_FILES_TIMEOUT || "45000");
|
|
29
30
|
function httpsRequest(url, options = {}) {
|
|
30
31
|
return new Promise((resolve, reject) => {
|
|
31
32
|
const parsedUrl = new URL(url);
|
|
32
33
|
const isHttps = parsedUrl.protocol === "https:";
|
|
33
34
|
const lib = isHttps ? https : http;
|
|
35
|
+
const requestTimeout = options.timeout || API_TIMEOUT;
|
|
34
36
|
const reqOptions = {
|
|
35
37
|
hostname: parsedUrl.hostname,
|
|
36
38
|
port: parsedUrl.port || (isHttps ? 443 : 80),
|
|
@@ -41,7 +43,7 @@ function httpsRequest(url, options = {}) {
|
|
|
41
43
|
"Accept": "application/json",
|
|
42
44
|
...options.headers
|
|
43
45
|
},
|
|
44
|
-
timeout:
|
|
46
|
+
timeout: requestTimeout
|
|
45
47
|
};
|
|
46
48
|
const req = lib.request(reqOptions, (res) => {
|
|
47
49
|
const chunks = [];
|
|
@@ -74,10 +76,10 @@ function httpsRequest(url, options = {}) {
|
|
|
74
76
|
});
|
|
75
77
|
}
|
|
76
78
|
});
|
|
77
|
-
res.setTimeout(
|
|
79
|
+
res.setTimeout(requestTimeout, () => {
|
|
78
80
|
if (!resolved) {
|
|
79
81
|
res.destroy();
|
|
80
|
-
reject(new Error(`Response timeout after ${
|
|
82
|
+
reject(new Error(`Response timeout after ${requestTimeout / 1e3}s`));
|
|
81
83
|
}
|
|
82
84
|
});
|
|
83
85
|
});
|
|
@@ -87,7 +89,7 @@ function httpsRequest(url, options = {}) {
|
|
|
87
89
|
});
|
|
88
90
|
req.on("timeout", () => {
|
|
89
91
|
req.destroy();
|
|
90
|
-
reject(new Error(`Request timeout after ${
|
|
92
|
+
reject(new Error(`Request timeout after ${requestTimeout / 1e3}s`));
|
|
91
93
|
});
|
|
92
94
|
if (options.body) {
|
|
93
95
|
req.write(options.body);
|
|
@@ -131,6 +133,23 @@ async function trackInstall(skillId, platform, method = "cli") {
|
|
|
131
133
|
} catch {
|
|
132
134
|
}
|
|
133
135
|
}
|
|
136
|
+
async function getSkillFiles(id) {
|
|
137
|
+
try {
|
|
138
|
+
const response = await httpsRequest(
|
|
139
|
+
`${API_BASE_URL}/skill-files?id=${encodeURIComponent(id)}`,
|
|
140
|
+
{ timeout: API_FILES_TIMEOUT }
|
|
141
|
+
);
|
|
142
|
+
if (response.statusCode === 404) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
if (response.statusCode !== 200) {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
return JSON.parse(response.data);
|
|
149
|
+
} catch {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
134
153
|
|
|
135
154
|
// src/utils/github.ts
|
|
136
155
|
import { Octokit } from "@octokit/rest";
|
|
@@ -343,20 +362,49 @@ async function install(skillId, options) {
|
|
|
343
362
|
process.exit(1);
|
|
344
363
|
}
|
|
345
364
|
await ensureSkillsDir(options.platform, options.project);
|
|
346
|
-
spinner.text = `Downloading
|
|
365
|
+
spinner.text = `Downloading ${skillInfo?.name || skillId}...`;
|
|
347
366
|
let content;
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
367
|
+
let apiWasReachable = false;
|
|
368
|
+
if (!options.noApi && skillInfo) {
|
|
369
|
+
apiWasReachable = true;
|
|
370
|
+
try {
|
|
371
|
+
spinner.text = "Downloading skill files...";
|
|
372
|
+
const cachedFiles = await getSkillFiles(skillInfo.id);
|
|
373
|
+
if (cachedFiles && cachedFiles.files.length > 0) {
|
|
374
|
+
content = convertCachedFilesToSkillContent(cachedFiles);
|
|
375
|
+
spinner.text = cachedFiles.fromCache ? `Using cached files (${cachedFiles.files.length} files)` : `Downloaded ${cachedFiles.files.length} files via API`;
|
|
376
|
+
}
|
|
377
|
+
} catch {
|
|
378
|
+
spinner.text = "API file fetch failed, falling back to GitHub...";
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (!content) {
|
|
382
|
+
if (apiWasReachable) {
|
|
383
|
+
spinner.text = `Falling back to GitHub: ${owner}/${repo}/${skillPath || ""}...`;
|
|
384
|
+
} else {
|
|
385
|
+
spinner.text = `Downloading from GitHub: ${owner}/${repo}/${skillPath || ""}...`;
|
|
386
|
+
}
|
|
387
|
+
try {
|
|
388
|
+
content = await fetchSkillContent(owner, repo, skillPath, branch);
|
|
389
|
+
spinner.text = `Downloaded ${content.scripts.length} scripts, ${content.references.length} references`;
|
|
390
|
+
} catch (error) {
|
|
391
|
+
spinner.fail("Failed to download skill files");
|
|
392
|
+
console.error(chalk.red(error.message));
|
|
393
|
+
console.log();
|
|
394
|
+
console.log(chalk.yellow("Troubleshooting tips:"));
|
|
395
|
+
console.log(chalk.dim(" 1. Check your internet connection"));
|
|
396
|
+
if (apiWasReachable) {
|
|
397
|
+
console.log(chalk.dim(" 2. The API server could not fetch files either - try again in a minute"));
|
|
398
|
+
console.log(chalk.dim(" 3. The server may be caching the files now - retry shortly"));
|
|
399
|
+
} else {
|
|
400
|
+
console.log(chalk.dim(" 2. If behind a proxy, configure HTTP_PROXY/HTTPS_PROXY environment variables"));
|
|
401
|
+
}
|
|
402
|
+
console.log(chalk.dim(` ${apiWasReachable ? "4" : "3"}. Set GITHUB_TOKEN environment variable for higher rate limits`));
|
|
403
|
+
process.exit(1);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (!content) {
|
|
407
|
+
spinner.fail("Failed to download skill content");
|
|
360
408
|
process.exit(1);
|
|
361
409
|
}
|
|
362
410
|
const parsed = parseSkillMd(content.skillMd);
|
|
@@ -453,6 +501,37 @@ function getPlatformName(platform) {
|
|
|
453
501
|
};
|
|
454
502
|
return names[platform];
|
|
455
503
|
}
|
|
504
|
+
function convertCachedFilesToSkillContent(response) {
|
|
505
|
+
let skillMd = "";
|
|
506
|
+
const scripts = [];
|
|
507
|
+
const references = [];
|
|
508
|
+
for (const file of response.files) {
|
|
509
|
+
if (!file.content) continue;
|
|
510
|
+
if (file.name === "SKILL.md" && (file.path === "SKILL.md" || file.path === file.name)) {
|
|
511
|
+
skillMd = file.content;
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
if (file.path.startsWith("scripts/")) {
|
|
515
|
+
scripts.push({
|
|
516
|
+
name: file.name,
|
|
517
|
+
content: file.content
|
|
518
|
+
});
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
if (file.path.startsWith("references/")) {
|
|
522
|
+
references.push({
|
|
523
|
+
name: file.name,
|
|
524
|
+
content: file.content
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return {
|
|
529
|
+
skillMd,
|
|
530
|
+
scripts,
|
|
531
|
+
references,
|
|
532
|
+
assets: []
|
|
533
|
+
};
|
|
534
|
+
}
|
|
456
535
|
|
|
457
536
|
// src/commands/search.ts
|
|
458
537
|
import chalk2 from "chalk";
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "skillhub",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI tool for managing AI Agent skills - search, install, and update skills for Claude, Codex, Copilot, and more",
|
|
5
|
-
"author": "SkillHub Contributors",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/anthropics/skillhub.git",
|
|
10
|
-
"directory": "apps/cli"
|
|
11
|
-
},
|
|
12
|
-
"homepage": "https://skills.palebluedot.live",
|
|
13
|
-
"type": "module",
|
|
14
|
-
"bin": {
|
|
15
|
-
"skillhub": "./dist/index.js"
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"@
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "skillhub",
|
|
3
|
+
"version": "0.1.13",
|
|
4
|
+
"description": "CLI tool for managing AI Agent skills - search, install, and update skills for Claude, Codex, Copilot, and more",
|
|
5
|
+
"author": "SkillHub Contributors",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/anthropics/skillhub.git",
|
|
10
|
+
"directory": "apps/cli"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://skills.palebluedot.live",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"bin": {
|
|
15
|
+
"skillhub": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"skillhub-core": "^0.1.0",
|
|
22
|
+
"@octokit/rest": "^20.0.2",
|
|
23
|
+
"chalk": "^5.3.0",
|
|
24
|
+
"commander": "^11.1.0",
|
|
25
|
+
"fs-extra": "^11.2.0",
|
|
26
|
+
"ora": "^8.0.1",
|
|
27
|
+
"prompts": "^2.4.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/fs-extra": "^11.0.4",
|
|
31
|
+
"@types/node": "^20.10.0",
|
|
32
|
+
"@types/prompts": "^2.4.9",
|
|
33
|
+
"tsup": "^8.0.1",
|
|
34
|
+
"tsx": "^4.7.0",
|
|
35
|
+
"typescript": "^5.3.0",
|
|
36
|
+
"vitest": "^1.2.0"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"ai",
|
|
43
|
+
"agent",
|
|
44
|
+
"skills",
|
|
45
|
+
"cli",
|
|
46
|
+
"claude",
|
|
47
|
+
"codex",
|
|
48
|
+
"copilot"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup src/index.ts --format esm --target node20 --clean",
|
|
52
|
+
"dev": "tsx src/index.ts",
|
|
53
|
+
"start": "node dist/index.js",
|
|
54
|
+
"lint": "eslint src/",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"test": "vitest",
|
|
57
|
+
"test:run": "vitest run"
|
|
58
|
+
}
|
|
59
|
+
}
|