ancoder-skill-cli 0.2.4 → 0.4.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 CHANGED
@@ -12,7 +12,15 @@ npm install -g ancoder-skill-cli
12
12
  npx ancoder-skill-cli --help
13
13
  ```
14
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.
15
+ The npm package is self-contained and includes prebuilt binaries for:
16
+
17
+ - macOS arm64
18
+ - macOS x64
19
+ - Linux arm64
20
+ - Linux x64
21
+ - Windows x64
22
+
23
+ After install, the wrapper selects the correct bundled binary for the current platform automatically.
16
24
 
17
25
  ## Build from source (Go)
18
26
 
@@ -35,18 +43,24 @@ go build -o bin/skill-cli .
35
43
  ## Publish to npm
36
44
 
37
45
  1. Set `repository.url` in `package.json` to your GitHub repo (e.g. `git+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:
46
+ 2. Build binaries per platform before publishing the npm package:
47
+
48
+ ```bash
49
+ bash scripts/build-all.sh
50
+ ```
51
+
52
+ 3. Optionally attach the same binaries to a GitHub Release with names:
39
53
  - `skill-cli-darwin-arm64`, `skill-cli-darwin-x64`
40
54
  - `skill-cli-linux-x64`, `skill-cli-linux-arm64`
41
55
  - `skill-cli-win32-x64.exe`
42
- 3. Publish the package:
56
+ 4. Publish the package:
43
57
 
44
58
  ```bash
45
59
  npm login --registry=https://registry.npmjs.org/
46
60
  npm publish --access public --registry=https://registry.npmjs.org/ --userconfig ~/.npmrc
47
61
  ```
48
62
 
49
- Users who `npm install -g ancoder-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).
63
+ Users who `npm install -g ancoder-skill-cli` get a fully bundled package. No extra binary download is required during install.
50
64
 
51
65
  ## License
52
66
 
package/bin/skill-cli.js CHANGED
@@ -6,14 +6,38 @@ const { spawn } = require('child_process');
6
6
  const fs = require('fs');
7
7
 
8
8
  const isWindows = process.platform === 'win32';
9
- const binName = isWindows ? 'skill-cli.exe' : 'skill-cli';
10
- const binPath = path.join(__dirname, binName);
9
+ const key = `${process.platform}-${process.arch}`;
10
+ const targetMap = {
11
+ 'darwin-arm64': 'skill-cli-darwin-arm64',
12
+ 'darwin-x64': 'skill-cli-darwin-x64',
13
+ 'linux-arm64': 'skill-cli-linux-arm64',
14
+ 'linux-x64': 'skill-cli-linux-x64',
15
+ 'win32-x64': 'skill-cli-win32-x64.exe',
16
+ };
17
+
18
+ const bundledName = targetMap[key];
19
+ const bundledPath = bundledName ? path.join(__dirname, 'targets', bundledName) : null;
20
+ const fallbackName = isWindows ? 'skill-cli.exe' : 'skill-cli';
21
+ const fallbackPath = path.join(__dirname, fallbackName);
22
+
23
+ const binPath = bundledPath && fs.existsSync(bundledPath) ? bundledPath : fallbackPath;
11
24
 
12
25
  if (!fs.existsSync(binPath)) {
13
- console.error('skill-cli: binary not found. Run "npm install" or build from source: go build -o ' + binName + ' .');
26
+ console.error(
27
+ 'skill-cli: binary not found for ' + key + '. ' +
28
+ 'Expected bundled binary: ' + (bundledName || 'unsupported-platform') + '.'
29
+ );
14
30
  process.exit(1);
15
31
  }
16
32
 
33
+ if (!isWindows) {
34
+ try {
35
+ fs.chmodSync(binPath, 0o755);
36
+ } catch (_) {
37
+ // ignore chmod failures on readonly installs
38
+ }
39
+ }
40
+
17
41
  const child = spawn(binPath, process.argv.slice(2), {
18
42
  stdio: 'inherit',
19
43
  shell: false,
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ancoder-skill-cli",
3
- "version": "0.2.4",
3
+ "version": "0.4.0",
4
4
  "description": "CLI for managing everything-claude-code (ECC) components — agents, skills, commands, rules, hooks, MCP configs. Single binary, all assets embedded.",
5
5
  "bin": {
6
6
  "skill-cli": "bin/skill-cli.js"
@@ -37,6 +37,7 @@
37
37
  },
38
38
  "files": [
39
39
  "bin/skill-cli.js",
40
+ "bin/targets",
40
41
  "scripts/postinstall.js",
41
42
  "scripts/check-bin.js",
42
43
  "README.md",
@@ -5,10 +5,22 @@ const path = require('path');
5
5
  const fs = require('fs');
6
6
 
7
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'));
8
+ const targetsDir = path.join(binDir, 'targets');
9
+ const expected = [
10
+ 'skill-cli-darwin-arm64',
11
+ 'skill-cli-darwin-x64',
12
+ 'skill-cli-linux-arm64',
13
+ 'skill-cli-linux-x64',
14
+ 'skill-cli-win32-x64.exe',
15
+ ];
10
16
 
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 .');
17
+ const missing = expected.filter((name) => !fs.existsSync(path.join(targetsDir, name)));
18
+
19
+ if (missing.length > 0) {
20
+ console.error('skill-cli: missing bundled binaries for npm publish:');
21
+ for (const name of missing) {
22
+ console.error(' - ' + name);
23
+ }
24
+ console.error('Run: bash scripts/build-all.sh');
25
+ process.exit(1);
14
26
  }
@@ -3,12 +3,6 @@
3
3
 
4
4
  const fs = require('fs');
5
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
6
 
13
7
  const platform = process.platform;
14
8
  const arch = process.arch;
@@ -23,73 +17,20 @@ const assetNames = {
23
17
  };
24
18
 
25
19
  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);
20
+ const bundledName = assetNames[key];
21
+ const bundledPath = bundledName ? path.join(__dirname, '..', 'bin', 'targets', bundledName) : null;
30
22
 
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} .`);
23
+ if (!bundledName || !bundledPath || !fs.existsSync(bundledPath)) {
24
+ console.warn(`skill-cli: bundled binary missing for ${key}`);
45
25
  process.exit(0);
46
26
  }
47
27
 
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);
28
+ if (!isWindows) {
29
+ try {
30
+ fs.chmodSync(bundledPath, 0o755);
31
+ } catch (_) {
32
+ // ignore chmod failures
54
33
  }
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
34
  }
92
35
 
93
- fs.mkdirSync(binDir, { recursive: true });
94
- console.log(`skill-cli: downloading binary for ${key}...`);
95
- fetch(url, binPath, 0);
36
+ console.log(`skill-cli: bundled binary ready for ${key}`);