skild 0.0.7
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/README.md +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +138 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Peiiii
|
|
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/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import chalk3 from "chalk";
|
|
6
|
+
|
|
7
|
+
// src/commands/install.ts
|
|
8
|
+
import { execSync } from "child_process";
|
|
9
|
+
import path2 from "path";
|
|
10
|
+
import fs2 from "fs";
|
|
11
|
+
import chalk from "chalk";
|
|
12
|
+
import ora from "ora";
|
|
13
|
+
|
|
14
|
+
// src/utils/config.ts
|
|
15
|
+
import os from "os";
|
|
16
|
+
import path from "path";
|
|
17
|
+
import fs from "fs";
|
|
18
|
+
function getSkillsDir(platform = "claude", projectLevel = false) {
|
|
19
|
+
const base = projectLevel ? process.cwd() : os.homedir();
|
|
20
|
+
switch (platform) {
|
|
21
|
+
case "claude":
|
|
22
|
+
return path.join(base, projectLevel ? ".claude" : ".claude", "skills");
|
|
23
|
+
case "codex":
|
|
24
|
+
return path.join(base, projectLevel ? ".codex" : ".codex", "skills");
|
|
25
|
+
case "copilot":
|
|
26
|
+
return path.join(base, ".github", "skills");
|
|
27
|
+
default:
|
|
28
|
+
return path.join(base, ".claude", "skills");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var SKILLS_DIR = getSkillsDir("claude", false);
|
|
32
|
+
function ensureSkillsDir(platform = "claude", projectLevel = false) {
|
|
33
|
+
const dir = getSkillsDir(platform, projectLevel);
|
|
34
|
+
if (!fs.existsSync(dir)) {
|
|
35
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
36
|
+
}
|
|
37
|
+
return dir;
|
|
38
|
+
}
|
|
39
|
+
function getSkillPath(skillName, platform = "claude", projectLevel = false) {
|
|
40
|
+
return path.join(getSkillsDir(platform, projectLevel), skillName);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/commands/install.ts
|
|
44
|
+
function extractSkillName(url) {
|
|
45
|
+
const treeMatch = url.match(/\/tree\/[^/]+\/(.+?)(?:\/)?$/);
|
|
46
|
+
if (treeMatch) {
|
|
47
|
+
return treeMatch[1].split("/").pop() || "unknown-skill";
|
|
48
|
+
}
|
|
49
|
+
const repoMatch = url.match(/github\.com\/[^/]+\/([^/]+)/);
|
|
50
|
+
if (repoMatch) {
|
|
51
|
+
return repoMatch[1].replace(/\.git$/, "");
|
|
52
|
+
}
|
|
53
|
+
return "unknown-skill";
|
|
54
|
+
}
|
|
55
|
+
function toDegitPath(url) {
|
|
56
|
+
const treeMatch = url.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+?)(?:\/)?$/);
|
|
57
|
+
if (treeMatch) {
|
|
58
|
+
const [, owner, repo, branch, subpath] = treeMatch;
|
|
59
|
+
return `${owner}/${repo}/${subpath}#${branch}`;
|
|
60
|
+
}
|
|
61
|
+
const repoMatch = url.match(/github\.com\/([^/]+\/[^/]+)/);
|
|
62
|
+
if (repoMatch) {
|
|
63
|
+
return repoMatch[1].replace(/\.git$/, "");
|
|
64
|
+
}
|
|
65
|
+
return url;
|
|
66
|
+
}
|
|
67
|
+
async function install(source, options = {}) {
|
|
68
|
+
const platform = options.target || "claude";
|
|
69
|
+
const projectLevel = options.local || false;
|
|
70
|
+
ensureSkillsDir(platform, projectLevel);
|
|
71
|
+
const skillName = extractSkillName(source);
|
|
72
|
+
const targetPath = getSkillPath(skillName, platform, projectLevel);
|
|
73
|
+
const degitPath = toDegitPath(source);
|
|
74
|
+
const locationLabel = projectLevel ? "project" : "global";
|
|
75
|
+
const spinner = ora(`Installing ${chalk.cyan(skillName)} to ${chalk.dim(platform)} (${locationLabel})...`).start();
|
|
76
|
+
try {
|
|
77
|
+
execSync(`npx degit ${degitPath} "${targetPath}" --force`, {
|
|
78
|
+
stdio: "pipe"
|
|
79
|
+
});
|
|
80
|
+
spinner.succeed(`Installed ${chalk.green(skillName)} to ${chalk.dim(targetPath)}`);
|
|
81
|
+
const skillMdPath = path2.join(targetPath, "SKILL.md");
|
|
82
|
+
const hasSkillMd = fs2.existsSync(skillMdPath);
|
|
83
|
+
if (hasSkillMd) {
|
|
84
|
+
console.log(chalk.dim(` \u2514\u2500 SKILL.md found \u2713`));
|
|
85
|
+
} else {
|
|
86
|
+
console.log(chalk.yellow(` \u2514\u2500 Warning: No SKILL.md found`));
|
|
87
|
+
}
|
|
88
|
+
} catch (error) {
|
|
89
|
+
spinner.fail(`Failed to install ${chalk.red(skillName)}`);
|
|
90
|
+
console.error(chalk.red(error.message || error));
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/commands/list.ts
|
|
96
|
+
import fs3 from "fs";
|
|
97
|
+
import path3 from "path";
|
|
98
|
+
import chalk2 from "chalk";
|
|
99
|
+
async function list() {
|
|
100
|
+
ensureSkillsDir();
|
|
101
|
+
const entries = fs3.readdirSync(SKILLS_DIR, { withFileTypes: true });
|
|
102
|
+
const skills = entries.filter((e) => e.isDirectory());
|
|
103
|
+
if (skills.length === 0) {
|
|
104
|
+
console.log(chalk2.dim("No skills installed."));
|
|
105
|
+
console.log(chalk2.dim(`Use ${chalk2.cyan("skild install <url>")} to install a skill.`));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
console.log(chalk2.bold(`
|
|
109
|
+
\u{1F4E6} Installed Skills (${skills.length}):
|
|
110
|
+
`));
|
|
111
|
+
for (const skill of skills) {
|
|
112
|
+
const skillPath = path3.join(SKILLS_DIR, skill.name);
|
|
113
|
+
const skillMdPath = path3.join(skillPath, "SKILL.md");
|
|
114
|
+
const hasSkillMd = fs3.existsSync(skillMdPath);
|
|
115
|
+
const status = hasSkillMd ? chalk2.green("\u2713") : chalk2.yellow("\u26A0");
|
|
116
|
+
console.log(` ${status} ${chalk2.cyan(skill.name)}`);
|
|
117
|
+
console.log(chalk2.dim(` \u2514\u2500 ${skillPath}`));
|
|
118
|
+
}
|
|
119
|
+
console.log("");
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/index.ts
|
|
123
|
+
var program = new Command();
|
|
124
|
+
program.name("skild").description("The npm for Agent Skills \u2014 Discover, install, manage, and publish AI Agent Skills with ease.").version("0.0.1");
|
|
125
|
+
program.command("install <source>").alias("i").description("Install a Skill from a GitHub URL or registry name").option("-t, --target <platform>", "Target platform: claude, codex, copilot", "claude").option("-l, --local", "Install to project-level directory instead of global").action(async (source, options) => {
|
|
126
|
+
await install(source, {
|
|
127
|
+
target: options.target,
|
|
128
|
+
local: options.local
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
program.command("list").alias("ls").description("List installed Skills").action(async () => {
|
|
132
|
+
await list();
|
|
133
|
+
});
|
|
134
|
+
program.action(() => {
|
|
135
|
+
console.log(chalk3.bold("\n\u{1F6E1}\uFE0F skild \u2014 Get your agents skilled.\n"));
|
|
136
|
+
program.outputHelp();
|
|
137
|
+
});
|
|
138
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "skild",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "The npm for Agent Skills — Discover, install, manage, and publish AI Agent Skills with ease.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"skild": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"agent-skills",
|
|
20
|
+
"ai",
|
|
21
|
+
"npm",
|
|
22
|
+
"cli",
|
|
23
|
+
"package-manager",
|
|
24
|
+
"claude",
|
|
25
|
+
"anthropic"
|
|
26
|
+
],
|
|
27
|
+
"author": "Peiiii",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/Peiiii/skild.git",
|
|
32
|
+
"directory": "packages/cli"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://skild.sh",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"chalk": "^5.3.0",
|
|
37
|
+
"commander": "^12.1.0",
|
|
38
|
+
"degit": "^2.8.4",
|
|
39
|
+
"ora": "^8.0.1"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^20.10.0",
|
|
43
|
+
"bumpp": "^10.3.2",
|
|
44
|
+
"tsup": "^8.0.0",
|
|
45
|
+
"typescript": "^5.3.0"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=18"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
52
|
+
"dev": "tsup src/index.ts --format esm --watch",
|
|
53
|
+
"start": "node dist/index.js",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
55
|
+
"release": "pnpm build && bumpp && pnpm publish --no-git-checks"
|
|
56
|
+
}
|
|
57
|
+
}
|