skillhub 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/dist/index.js +52 -12
  2. package/package.json +13 -3
package/dist/index.js CHANGED
@@ -140,7 +140,11 @@ function getOctokit() {
140
140
  if (!octokit) {
141
141
  octokit = new Octokit({
142
142
  auth: process.env.GITHUB_TOKEN,
143
- userAgent: "SkillHub-CLI/1.0"
143
+ userAgent: "SkillHub-CLI/1.0",
144
+ request: {
145
+ timeout: 3e4
146
+ // 30 second timeout
147
+ }
144
148
  });
145
149
  }
146
150
  return octokit;
@@ -148,12 +152,23 @@ function getOctokit() {
148
152
  async function fetchSkillContent(owner, repo, skillPath, branch = "main") {
149
153
  const client = getOctokit();
150
154
  const skillMdPath = skillPath ? `${skillPath}/SKILL.md` : "SKILL.md";
151
- const skillMdResponse = await client.repos.getContent({
152
- owner,
153
- repo,
154
- path: skillMdPath,
155
- ref: branch
156
- });
155
+ let skillMdResponse;
156
+ try {
157
+ skillMdResponse = await client.repos.getContent({
158
+ owner,
159
+ repo,
160
+ path: skillMdPath,
161
+ ref: branch
162
+ });
163
+ } catch (error) {
164
+ if (error.status === 404) {
165
+ throw new Error(`SKILL.md not found at ${owner}/${repo}/${skillMdPath}`);
166
+ }
167
+ if (error.message?.includes("timeout")) {
168
+ throw new Error(`GitHub request timeout. Check your internet connection or try again later.`);
169
+ }
170
+ throw new Error(`Failed to fetch from GitHub: ${error.message}`);
171
+ }
157
172
  if (!("content" in skillMdResponse.data)) {
158
173
  throw new Error("SKILL.md not found");
159
174
  }
@@ -241,7 +256,13 @@ async function install(skillId, options) {
241
256
  }
242
257
  const [owner, repo, ...rest] = parts;
243
258
  const skillPath = rest.join("/");
244
- const skillInfo = await getSkill(skillId);
259
+ let skillInfo;
260
+ try {
261
+ skillInfo = await getSkill(skillId);
262
+ } catch (error) {
263
+ spinner.warn(`API error: ${error.message}`);
264
+ spinner.start("Falling back to direct GitHub fetch...");
265
+ }
245
266
  let skillName;
246
267
  let branch = "main";
247
268
  if (skillInfo) {
@@ -249,8 +270,13 @@ async function install(skillId, options) {
249
270
  spinner.text = `Found skill: ${chalk.cyan(skillName)}`;
250
271
  } else {
251
272
  spinner.text = "Skill not in registry, fetching from GitHub...";
252
- branch = await getDefaultBranch(owner, repo);
253
- skillName = skillPath || repo;
273
+ try {
274
+ branch = await getDefaultBranch(owner, repo);
275
+ skillName = skillPath || repo;
276
+ } catch (error) {
277
+ spinner.fail("Failed to connect to GitHub");
278
+ throw error;
279
+ }
254
280
  }
255
281
  const installed = await isSkillInstalled(options.platform, skillName, options.project);
256
282
  if (installed && !options.force) {
@@ -260,8 +286,22 @@ async function install(skillId, options) {
260
286
  process.exit(1);
261
287
  }
262
288
  await ensureSkillsDir(options.platform, options.project);
263
- spinner.text = "Downloading skill files...";
264
- const content = await fetchSkillContent(owner, repo, skillPath, branch);
289
+ spinner.text = `Downloading from ${owner}/${repo}/${skillPath || ""}...`;
290
+ let content;
291
+ try {
292
+ content = await fetchSkillContent(owner, repo, skillPath, branch);
293
+ spinner.text = `Downloaded ${content.scripts.length} scripts, ${content.references.length} references`;
294
+ } catch (error) {
295
+ spinner.fail("Failed to download skill files");
296
+ console.error(chalk.red(error.message));
297
+ console.log();
298
+ console.log(chalk.yellow("Troubleshooting tips:"));
299
+ console.log(chalk.dim(" 1. Check your internet connection"));
300
+ console.log(chalk.dim(" 2. If behind a proxy, configure HTTP_PROXY/HTTPS_PROXY environment variables"));
301
+ console.log(chalk.dim(" 3. Try again in a few minutes (GitHub API might be rate-limited)"));
302
+ console.log(chalk.dim(" 4. Set GITHUB_TOKEN environment variable for higher rate limits"));
303
+ process.exit(1);
304
+ }
265
305
  const parsed = parseSkillMd(content.skillMd);
266
306
  if (!parsed.validation.isValid) {
267
307
  spinner.warn("Skill has validation issues:");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillhub",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "CLI tool for managing AI Agent skills - search, install, and update skills for Claude, Codex, Copilot, and more",
5
5
  "author": "SkillHub Contributors",
6
6
  "license": "MIT",
@@ -14,7 +14,9 @@
14
14
  "bin": {
15
15
  "skillhub": "./dist/index.js"
16
16
  },
17
- "files": ["dist"],
17
+ "files": [
18
+ "dist"
19
+ ],
18
20
  "scripts": {
19
21
  "build": "tsup src/index.ts --format esm --target node20 --clean",
20
22
  "dev": "tsx src/index.ts",
@@ -45,5 +47,13 @@
45
47
  "engines": {
46
48
  "node": ">=18.0.0"
47
49
  },
48
- "keywords": ["ai", "agent", "skills", "cli", "claude", "codex", "copilot"]
50
+ "keywords": [
51
+ "ai",
52
+ "agent",
53
+ "skills",
54
+ "cli",
55
+ "claude",
56
+ "codex",
57
+ "copilot"
58
+ ]
49
59
  }