crabigator 0.3.4

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.
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Crabigator NPM wrapper
5
+ *
6
+ * Detects the current platform and architecture, then spawns the appropriate
7
+ * pre-built binary from the vendor directory.
8
+ */
9
+
10
+ const { spawn } = require('child_process');
11
+ const path = require('path');
12
+ const fs = require('fs');
13
+ const os = require('os');
14
+
15
+ // Map Node.js platform/arch to our binary naming convention
16
+ const platformMap = {
17
+ 'darwin': 'darwin',
18
+ 'linux': 'linux',
19
+ 'win32': 'win32'
20
+ };
21
+
22
+ const archMap = {
23
+ 'arm64': 'arm64',
24
+ 'x64': 'x64'
25
+ };
26
+
27
+ function getBinaryPath() {
28
+ const platform = platformMap[process.platform];
29
+ const arch = archMap[process.arch];
30
+
31
+ if (!platform || !arch) {
32
+ console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
33
+ console.error('Crabigator supports: darwin-arm64, darwin-x64, linux-arm64, linux-x64, win32-arm64, win32-x64');
34
+ process.exit(1);
35
+ }
36
+
37
+ const binaryName = process.platform === 'win32' ? 'crabigator.exe' : 'crabigator';
38
+ const binaryPath = path.join(__dirname, '..', 'vendor', `${platform}-${arch}`, binaryName);
39
+
40
+ if (!fs.existsSync(binaryPath)) {
41
+ console.error(`Binary not found: ${binaryPath}`);
42
+ console.error('This may indicate an incomplete installation. Try reinstalling:');
43
+ console.error(' npm install -g crabigator@latest');
44
+ process.exit(1);
45
+ }
46
+
47
+ return binaryPath;
48
+ }
49
+
50
+ function main() {
51
+ const binaryPath = getBinaryPath();
52
+
53
+ // Set environment variable to indicate installation method
54
+ const env = { ...process.env, CRABIGATOR_INSTALLED_VIA: 'npm' };
55
+
56
+ // Spawn the binary with all arguments passed through
57
+ const child = spawn(binaryPath, process.argv.slice(2), {
58
+ stdio: 'inherit',
59
+ env
60
+ });
61
+
62
+ // Forward signals to child process
63
+ const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
64
+ signals.forEach(signal => {
65
+ process.on(signal, () => {
66
+ if (!child.pid) return;
67
+ try {
68
+ process.kill(child.pid, signal);
69
+ } catch (_) {
70
+ // Ignore if the child already exited.
71
+ }
72
+ });
73
+ });
74
+
75
+ // Exit with child's exit code
76
+ child.on('exit', (code, signal) => {
77
+ if (signal) {
78
+ // Child was killed by signal, exit with 128 + signal number
79
+ const signalNumber = os.constants.signals[signal];
80
+ if (typeof signalNumber === 'number') {
81
+ process.exit(128 + signalNumber);
82
+ }
83
+ process.exit(128);
84
+ }
85
+ process.exit(code || 0);
86
+ });
87
+
88
+ child.on('error', (err) => {
89
+ console.error(`Failed to start crabigator: ${err.message}`);
90
+ process.exit(1);
91
+ });
92
+ }
93
+
94
+ main();
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "crabigator",
3
+ "version": "0.3.4",
4
+ "description": "A TUI wrapper for Claude Code with real-time status widgets",
5
+ "bin": {
6
+ "crabigator": "bin/crabigator.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "vendor"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/samuelclay/crabigator.git"
15
+ },
16
+ "homepage": "https://github.com/samuelclay/crabigator#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/samuelclay/crabigator/issues"
19
+ },
20
+ "keywords": [
21
+ "claude",
22
+ "claude-code",
23
+ "terminal",
24
+ "tui",
25
+ "cli",
26
+ "ai",
27
+ "anthropic",
28
+ "codex"
29
+ ],
30
+ "author": "Samuel Clay",
31
+ "license": "MIT",
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "os": [
36
+ "darwin",
37
+ "linux",
38
+ "win32"
39
+ ],
40
+ "cpu": [
41
+ "x64",
42
+ "arm64"
43
+ ]
44
+ }
Binary file
Binary file
Binary file
Binary file
Binary file