skills 1.0.8 → 1.0.10

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/cli.js +37 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -65,13 +65,48 @@ ${BOLD}Examples:${RESET}
65
65
  Discover more skills at ${TEXT}https://skills.sh/${RESET}
66
66
  `);
67
67
  }
68
+ function getOwnerRepo(pkg) {
69
+ const repoMatch = pkg.match(/^([^\/]+)\/([^\/]+)$/);
70
+ if (repoMatch && repoMatch[1] && repoMatch[2]) {
71
+ return { owner: repoMatch[1], repo: repoMatch[2] };
72
+ }
73
+ const githubMatch = pkg.match(/github\.com\/([^\/]+)\/([^\/]+)/);
74
+ if (githubMatch && githubMatch[1] && githubMatch[2]) {
75
+ return { owner: githubMatch[1], repo: githubMatch[2].replace(/\.git$/, "") };
76
+ }
77
+ return null;
78
+ }
79
+ async function isRepoPublic(owner, repo) {
80
+ try {
81
+ const res = await fetch(`https://api.github.com/repos/${owner}/${repo}`);
82
+ if (!res.ok)
83
+ return false;
84
+ const data = await res.json();
85
+ return data.private === false;
86
+ } catch {
87
+ return false;
88
+ }
89
+ }
68
90
  function runAddSkill(packages) {
69
91
  const child = spawn("npx", ["-y", "add-skill", ...packages], {
70
92
  stdio: "inherit",
71
93
  shell: true
72
94
  });
73
- child.on("close", (code) => {
74
- process.exit(code ?? 0);
95
+ child.on("close", async (code) => {
96
+ if (code !== 0) {
97
+ process.exit(code ?? 1);
98
+ return;
99
+ }
100
+ console.log();
101
+ const pkg = packages[0];
102
+ const info = pkg ? getOwnerRepo(pkg) : null;
103
+ if (info && await isRepoPublic(info.owner, info.repo)) {
104
+ console.log(`${DIM}View the skill at${RESET} ${TEXT}https://skills.sh/${info.owner}/${info.repo}${RESET}`);
105
+ } else {
106
+ console.log(`${DIM}Discover more skills at${RESET} ${TEXT}https://skills.sh${RESET}`);
107
+ }
108
+ console.log();
109
+ process.exit(0);
75
110
  });
76
111
  }
77
112
  function runInit(args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skills",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {