@forkline/cli 0.37.2-rc.3

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 (3) hide show
  1. package/README.md +87 -0
  2. package/bin/forkline.js +107 -0
  3. package/package.json +39 -0
package/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # @forkline/cli
2
+
3
+ Forkline CLI - OpenCode runner management platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @forkline/cli
9
+ ```
10
+
11
+ Or use without installing:
12
+
13
+ ```bash
14
+ npx @forkline/cli --help
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```bash
20
+ forkline --help
21
+ forkline --version
22
+ forkline completions bash
23
+ ```
24
+
25
+ ## Supported Platforms
26
+
27
+ Pre-built binaries are available for:
28
+
29
+ | Platform | Architecture | libc |
30
+ |----------|--------------|------|
31
+ | macOS | arm64 (Apple Silicon) | — |
32
+ | macOS | x64 (Intel) | — |
33
+ | Linux | arm64 | glibc |
34
+ | Linux | arm64 | musl (Alpine) |
35
+ | Linux | x64 | glibc (Debian/Ubuntu) |
36
+ | Linux | x64 | musl (Alpine) |
37
+ | Windows | arm64 | — |
38
+ | Windows | x64 | — |
39
+
40
+ The correct platform-specific package is installed automatically as an optional dependency.
41
+
42
+ ## Environment Variables
43
+
44
+ ### `FORKLINE_BINARY`
45
+
46
+ Override the binary path. Useful for testing or using a custom build:
47
+
48
+ ```bash
49
+ export FORKLINE_BINARY=/path/to/custom/forkline
50
+ forkline --version
51
+ ```
52
+
53
+ ## Manual Binary Installation
54
+
55
+ If npm installation fails or you need a specific platform binary:
56
+
57
+ 1. Download the appropriate archive from [GitHub Releases](https://github.com/forkline/cli/releases)
58
+ 2. Extract the `forkline` binary
59
+ 3. Set `FORKLINE_BINARY` to point to it
60
+
61
+ ## Troubleshooting
62
+
63
+ ### "Platform package not installed"
64
+
65
+ This usually means npm was run with `--no-optional`. Reinstall without that flag:
66
+
67
+ ```bash
68
+ npm install @forkline/cli
69
+ ```
70
+
71
+ Or download the binary manually and use `FORKLINE_BINARY`.
72
+
73
+ ### "Permission denied"
74
+
75
+ The binary needs execute permissions:
76
+
77
+ ```bash
78
+ chmod +x node_modules/@forkline/cli-linux-x64-gnu/bin/forkline
79
+ ```
80
+
81
+ (Adjust platform package name as needed)
82
+
83
+ ## Links
84
+
85
+ - [GitHub Repository](https://github.com/forkline/cli)
86
+ - [Releases](https://github.com/forkline/cli/releases)
87
+ - [Issue Tracker](https://github.com/forkline/cli/issues)
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require('child_process');
4
+ const path = require('path');
5
+
6
+ const PLATFORMS = {
7
+ 'darwin-arm64': { os: 'darwin', arch: 'arm64', pkg: '@forkline/cli-darwin-arm64', bin: 'forkline' },
8
+ 'darwin-x64': { os: 'darwin', arch: 'x64', pkg: '@forkline/cli-darwin-x64', bin: 'forkline' },
9
+ 'linux-arm64-gnu': { os: 'linux', arch: 'arm64', libc: 'glibc', pkg: '@forkline/cli-linux-arm64-gnu', bin: 'forkline' },
10
+ 'linux-arm64-musl': { os: 'linux', arch: 'arm64', libc: 'musl', pkg: '@forkline/cli-linux-arm64-musl', bin: 'forkline' },
11
+ 'linux-x64-gnu': { os: 'linux', arch: 'x64', libc: 'glibc', pkg: '@forkline/cli-linux-x64-gnu', bin: 'forkline' },
12
+ 'linux-x64-musl': { os: 'linux', arch: 'x64', libc: 'musl', pkg: '@forkline/cli-linux-x64-musl', bin: 'forkline' },
13
+ 'win32-arm64': { os: 'win32', arch: 'arm64', pkg: '@forkline/cli-win32-arm64', bin: 'forkline.exe' },
14
+ 'win32-x64': { os: 'win32', arch: 'x64', pkg: '@forkline/cli-win32-x64', bin: 'forkline.exe' },
15
+ };
16
+
17
+ function detectLinuxLibc() {
18
+ try {
19
+ const report = process.report.getReport();
20
+ if (report && report.header && report.header.glibcVersionRuntime) {
21
+ return 'glibc';
22
+ }
23
+ } catch (e) {
24
+ // process.report not available, fall through
25
+ }
26
+
27
+ try {
28
+ const result = require('child_process').spawnSync('ldd', ['--version'], {
29
+ encoding: 'utf8',
30
+ stdio: ['pipe', 'pipe', 'pipe']
31
+ });
32
+ const output = (result.stdout || '') + (result.stderr || '');
33
+ if (output.toLowerCase().includes('musl')) {
34
+ return 'musl';
35
+ }
36
+ } catch (e) {
37
+ // ldd not available or failed
38
+ }
39
+
40
+ return 'glibc';
41
+ }
42
+
43
+ function resolvePlatform() {
44
+ const platform = process.platform;
45
+ const arch = process.arch;
46
+
47
+ if (platform === 'linux') {
48
+ const libc = detectLinuxLibc();
49
+ const libcSuffix = libc === 'glibc' ? 'gnu' : 'musl';
50
+ return `${platform}-${arch}-${libcSuffix}`;
51
+ }
52
+
53
+ return `${platform}-${arch}`;
54
+ }
55
+
56
+ function main() {
57
+ const platformKey = resolvePlatform();
58
+ const platformInfo = PLATFORMS[platformKey];
59
+
60
+ if (!platformInfo) {
61
+ console.error(`Error: Unsupported platform ${process.platform}/${process.arch}`);
62
+ console.error('Supported platforms:');
63
+ Object.keys(PLATFORMS).forEach(key => {
64
+ const info = PLATFORMS[key];
65
+ console.error(` - ${info.os}/${info.arch}${info.libc ? ` (${info.libc})` : ''}`);
66
+ });
67
+ process.exit(1);
68
+ }
69
+
70
+ const binaryPath = process.env.FORKLINE_BINARY;
71
+ let resolvedPath;
72
+
73
+ if (binaryPath) {
74
+ resolvedPath = binaryPath;
75
+ } else {
76
+ try {
77
+ resolvedPath = require.resolve(`${platformInfo.pkg}/bin/${platformInfo.bin}`);
78
+ } catch (e) {
79
+ console.error(`Error: Platform package ${platformInfo.pkg} not installed.`);
80
+ console.error('Reinstall without --no-optional or set FORKLINE_BINARY environment variable.');
81
+ process.exit(1);
82
+ }
83
+ }
84
+
85
+ const args = process.argv.slice(2);
86
+ const result = spawnSync(resolvedPath, args, {
87
+ stdio: 'inherit',
88
+ env: process.env
89
+ });
90
+
91
+ if (result.error) {
92
+ if (result.error.code === 'EACCES') {
93
+ console.error(`Error: Permission denied executing ${resolvedPath}`);
94
+ console.error('Try: chmod +x ' + resolvedPath);
95
+ } else if (result.error.code === 'ENOENT') {
96
+ console.error(`Error: Binary not found at ${resolvedPath}`);
97
+ console.error('Platform package may be corrupted. Try reinstalling.');
98
+ } else {
99
+ console.error(`Error: ${result.error.message}`);
100
+ }
101
+ process.exit(1);
102
+ }
103
+
104
+ process.exit(result.status || 0);
105
+ }
106
+
107
+ main();
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@forkline/cli",
3
+ "version": "0.37.2-rc.3",
4
+ "description": "Forkline CLI - OpenCode runner management",
5
+ "bin": {
6
+ "forkline": "./bin/forkline.js"
7
+ },
8
+ "optionalDependencies": {
9
+ "@forkline/cli-darwin-arm64": "0.37.2-rc.3",
10
+ "@forkline/cli-darwin-x64": "0.37.2-rc.3",
11
+ "@forkline/cli-linux-arm64-gnu": "0.37.2-rc.3",
12
+ "@forkline/cli-linux-arm64-musl": "0.37.2-rc.3",
13
+ "@forkline/cli-linux-x64-gnu": "0.37.2-rc.3",
14
+ "@forkline/cli-linux-x64-musl": "0.37.2-rc.3",
15
+ "@forkline/cli-win32-arm64": "0.37.2-rc.3",
16
+ "@forkline/cli-win32-x64": "0.37.2-rc.3"
17
+ },
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "files": [
22
+ "bin"
23
+ ],
24
+ "keywords": [
25
+ "forkline",
26
+ "cli",
27
+ "runner",
28
+ "opencode"
29
+ ],
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/forkline/cli"
34
+ },
35
+ "homepage": "https://github.com/forkline/cli#readme",
36
+ "bugs": {
37
+ "url": "https://github.com/forkline/cli/issues"
38
+ }
39
+ }