ancoder-skill-cli 0.2.0
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/README.md +53 -0
- package/bin/skill-cli.js +29 -0
- package/package.json +48 -0
- package/scripts/check-bin.js +14 -0
- package/scripts/postinstall.js +95 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# skill-cli
|
|
2
|
+
|
|
3
|
+
CLI for managing and testing [Anthropic Agent Skills](https://agentskills.io) (e.g. [anthropics/skills](https://github.com/anthropics/skills)).
|
|
4
|
+
|
|
5
|
+
<!-- ## Install (npm)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Global
|
|
9
|
+
npm install -g skill-cli
|
|
10
|
+
|
|
11
|
+
# Or run without installing
|
|
12
|
+
npx skill-cli --help
|
|
13
|
+
``` -->
|
|
14
|
+
|
|
15
|
+
After install, the binary is either downloaded from GitHub Releases (if you set `repository` in `package.json` and publish releases) or you can build from source once and the wrapper will use it.
|
|
16
|
+
|
|
17
|
+
## Build from source (Go)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd skill-cli
|
|
21
|
+
go build -o bin/skill-cli .
|
|
22
|
+
# Then run: ./bin/skill-cli --help
|
|
23
|
+
# Or via npm: node bin/skill-cli.js --help
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
| Command | Description |
|
|
29
|
+
|--------|-------------|
|
|
30
|
+
| `skill-cli validate <path>` | Validate a skill directory's SKILL.md |
|
|
31
|
+
| `skill-cli list [--path <dir>]` | List installed skills |
|
|
32
|
+
| `skill-cli create <name> [--path <dir>]` | Create a new skill scaffold |
|
|
33
|
+
| `skill-cli test <path>` | Test a skill (placeholder) |
|
|
34
|
+
|
|
35
|
+
## Publish to npm
|
|
36
|
+
|
|
37
|
+
1. Set `repository.url` in `package.json` to your GitHub repo (e.g. `https://github.com/your-org/skill-cli.git`).
|
|
38
|
+
2. For install-from-GitHub flow: build binaries per platform and attach to a GitHub Release with names:
|
|
39
|
+
- `skill-cli-darwin-arm64`, `skill-cli-darwin-x64`
|
|
40
|
+
- `skill-cli-linux-x64`, `skill-cli-linux-arm64`
|
|
41
|
+
- `skill-cli-win32-x64.exe`
|
|
42
|
+
3. Publish the package:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm login
|
|
46
|
+
npm publish
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Users who `npm install -g skill-cli` will get the wrapper; `postinstall` will try to download the binary for their platform from the GitHub release. If no release exists, they can still build from source and put the binary in `bin/skill-cli` (or `bin/skill-cli.exe` on Windows).
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT
|
package/bin/skill-cli.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { spawn } = require('child_process');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
const isWindows = process.platform === 'win32';
|
|
9
|
+
const binName = isWindows ? 'skill-cli.exe' : 'skill-cli';
|
|
10
|
+
const binPath = path.join(__dirname, binName);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(binPath)) {
|
|
13
|
+
console.error('skill-cli: binary not found. Run "npm install" or build from source: go build -o ' + binName + ' .');
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const child = spawn(binPath, process.argv.slice(2), {
|
|
18
|
+
stdio: 'inherit',
|
|
19
|
+
shell: false,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
child.on('close', (code) => {
|
|
23
|
+
process.exit(code != null ? code : 0);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
child.on('error', (err) => {
|
|
27
|
+
console.error('skill-cli:', err.message);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ancoder-skill-cli",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "CLI for managing everything-claude-code (ECC) components — agents, skills, commands, rules, hooks, MCP configs. Single binary, all assets embedded.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"skill-cli": "bin/skill-cli.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node scripts/postinstall.js",
|
|
10
|
+
"prepublishOnly": "node scripts/check-bin.js",
|
|
11
|
+
"build": "bash scripts/build-all.sh"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/AncoderAI/Ancoder_SkillsCreator.git"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/AncoderAI/Ancoder_SkillsCreator#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/AncoderAI/Ancoder_SkillsCreator/issues"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"skill",
|
|
23
|
+
"claude",
|
|
24
|
+
"claude-code",
|
|
25
|
+
"anthropic",
|
|
26
|
+
"agentskills",
|
|
27
|
+
"everything-claude-code",
|
|
28
|
+
"ecc",
|
|
29
|
+
"cli",
|
|
30
|
+
"agents",
|
|
31
|
+
"mcp"
|
|
32
|
+
],
|
|
33
|
+
"author": "AncoderAI",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=16"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"bin/skill-cli.js",
|
|
40
|
+
"scripts/postinstall.js",
|
|
41
|
+
"scripts/check-bin.js",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const binDir = path.join(__dirname, '..', 'bin');
|
|
8
|
+
const hasUnix = fs.existsSync(path.join(binDir, 'skill-cli'));
|
|
9
|
+
const hasWin = fs.existsSync(path.join(binDir, 'skill-cli.exe'));
|
|
10
|
+
|
|
11
|
+
if (!hasUnix && !hasWin) {
|
|
12
|
+
console.warn('skill-cli: no binary in bin/. Users will get the binary from GitHub Releases on install.');
|
|
13
|
+
console.warn('To ship a binary in the package, run: go build -o bin/skill-cli .');
|
|
14
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const https = require('https');
|
|
7
|
+
const http = require('http');
|
|
8
|
+
|
|
9
|
+
const pkg = require(path.join(__dirname, '..', 'package.json'));
|
|
10
|
+
const version = pkg.version;
|
|
11
|
+
const repo = 'AncoderAI/Ancoder_SkillsCreator';
|
|
12
|
+
|
|
13
|
+
const platform = process.platform;
|
|
14
|
+
const arch = process.arch;
|
|
15
|
+
const isWindows = platform === 'win32';
|
|
16
|
+
|
|
17
|
+
const assetNames = {
|
|
18
|
+
'darwin-arm64': 'skill-cli-darwin-arm64',
|
|
19
|
+
'darwin-x64': 'skill-cli-darwin-x64',
|
|
20
|
+
'linux-arm64': 'skill-cli-linux-arm64',
|
|
21
|
+
'linux-x64': 'skill-cli-linux-x64',
|
|
22
|
+
'win32-x64': 'skill-cli-win32-x64.exe',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const key = `${platform}-${arch}`;
|
|
26
|
+
const assetName = assetNames[key];
|
|
27
|
+
const binDir = path.join(__dirname, '..', 'bin');
|
|
28
|
+
const binName = isWindows ? 'skill-cli.exe' : 'skill-cli';
|
|
29
|
+
const binPath = path.join(binDir, binName);
|
|
30
|
+
|
|
31
|
+
// Already installed
|
|
32
|
+
if (fs.existsSync(binPath)) {
|
|
33
|
+
try {
|
|
34
|
+
fs.accessSync(binPath, fs.constants.X_OK);
|
|
35
|
+
process.exit(0);
|
|
36
|
+
} catch (_) {
|
|
37
|
+
fs.chmodSync(binPath, 0o755);
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!assetName) {
|
|
43
|
+
console.warn(`skill-cli: no prebuilt binary for ${key}`);
|
|
44
|
+
console.warn(`Build from source: go build -o bin/${binName} .`);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const url = `https://github.com/${repo}/releases/download/v${version}/${assetName}`;
|
|
49
|
+
|
|
50
|
+
function fetch(url, dest, redirects) {
|
|
51
|
+
if (redirects > 5) {
|
|
52
|
+
console.error('skill-cli: too many redirects');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const proto = url.startsWith('https') ? https : http;
|
|
57
|
+
|
|
58
|
+
proto.get(url, {
|
|
59
|
+
headers: { 'User-Agent': 'skill-cli-npm-postinstall' }
|
|
60
|
+
}, (res) => {
|
|
61
|
+
// Follow redirects (GitHub releases always redirect)
|
|
62
|
+
if (res.statusCode === 301 || res.statusCode === 302 || res.statusCode === 307) {
|
|
63
|
+
const location = res.headers.location;
|
|
64
|
+
if (location) {
|
|
65
|
+
res.resume(); // consume response to free socket
|
|
66
|
+
fetch(location, dest, redirects + 1);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (res.statusCode !== 200) {
|
|
72
|
+
console.warn(`skill-cli: HTTP ${res.statusCode} downloading ${url}`);
|
|
73
|
+
console.warn(`Build from source: go build -o bin/${binName} .`);
|
|
74
|
+
process.exit(0);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const file = fs.createWriteStream(dest, { mode: 0o755 });
|
|
78
|
+
res.pipe(file);
|
|
79
|
+
file.on('finish', () => {
|
|
80
|
+
file.close();
|
|
81
|
+
console.log(`skill-cli: installed binary for ${key} (v${version})`);
|
|
82
|
+
});
|
|
83
|
+
file.on('error', (err) => {
|
|
84
|
+
fs.unlink(dest, () => {});
|
|
85
|
+
console.warn('skill-cli: write error:', err.message);
|
|
86
|
+
});
|
|
87
|
+
}).on('error', (err) => {
|
|
88
|
+
console.warn('skill-cli: download error:', err.message);
|
|
89
|
+
console.warn(`Build from source: go build -o bin/${binName} .`);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
94
|
+
console.log(`skill-cli: downloading binary for ${key}...`);
|
|
95
|
+
fetch(url, binPath, 0);
|