bun-gemini-cli 0.1.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.
Files changed (3) hide show
  1. package/bin/.gitkeep +0 -0
  2. package/bin/gemini +124 -0
  3. package/package.json +30 -0
package/bin/.gitkeep ADDED
File without changes
package/bin/gemini ADDED
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * @license
5
+ * Copyright 2026 Google LLC
6
+ * SPDX-License-Identifier: Apache-2.0
7
+ */
8
+
9
+ /**
10
+ * Launcher script for gemini-cli.
11
+ * Detects the current platform and runs the appropriate binary.
12
+ */
13
+
14
+ const { execFileSync, spawnSync } = require('child_process');
15
+ const path = require('path');
16
+ const fs = require('fs');
17
+ const os = require('os');
18
+
19
+ // Allow override via environment variable
20
+ const envPath = process.env.GEMINI_BIN_PATH;
21
+ if (envPath) {
22
+ run(envPath);
23
+ }
24
+
25
+ // Map platform/arch names
26
+ const platformMap = {
27
+ darwin: 'darwin',
28
+ linux: 'linux',
29
+ win32: 'windows',
30
+ };
31
+
32
+ const archMap = {
33
+ x64: 'x64',
34
+ arm64: 'arm64',
35
+ };
36
+
37
+ const platform = platformMap[os.platform()] || os.platform();
38
+ const arch = archMap[os.arch()] || os.arch();
39
+
40
+ // Check for musl libc on Linux
41
+ let suffix = '';
42
+ if (os.platform() === 'linux') {
43
+ try {
44
+ const lddOutput = execFileSync('ldd', ['--version'], {
45
+ encoding: 'utf8',
46
+ stdio: ['pipe', 'pipe', 'pipe'],
47
+ });
48
+ if (lddOutput.includes('musl')) {
49
+ suffix = '-musl';
50
+ }
51
+ } catch {
52
+ // If ldd fails, try checking /lib for musl
53
+ try {
54
+ const libFiles = fs.readdirSync('/lib');
55
+ if (libFiles.some((f) => f.includes('musl'))) {
56
+ suffix = '-musl';
57
+ }
58
+ } catch {
59
+ // Assume glibc
60
+ }
61
+ }
62
+ }
63
+
64
+ const base = 'bun-gemini-cli-' + platform + '-' + arch + suffix;
65
+ const binary = platform === 'windows' ? 'gemini.exe' : 'gemini';
66
+
67
+ function run(target) {
68
+ const result = spawnSync(target, process.argv.slice(2), {
69
+ stdio: 'inherit',
70
+ windowsHide: true,
71
+ });
72
+ if (result.error) {
73
+ console.error(result.error.message);
74
+ process.exit(1);
75
+ }
76
+ const code = typeof result.status === 'number' ? result.status : 0;
77
+ process.exit(code);
78
+ }
79
+
80
+ function findBinary(startDir) {
81
+ let current = startDir;
82
+ for (;;) {
83
+ const modules = path.join(current, 'node_modules');
84
+ if (fs.existsSync(modules)) {
85
+ const entries = fs.readdirSync(modules);
86
+ for (const entry of entries) {
87
+ // Try exact match first, then baseline
88
+ if (entry === base || entry === base + '-baseline') {
89
+ const candidate = path.join(modules, entry, 'bin', binary);
90
+ if (fs.existsSync(candidate)) {
91
+ return candidate;
92
+ }
93
+ }
94
+ }
95
+ }
96
+ const parent = path.dirname(current);
97
+ if (parent === current) {
98
+ return null;
99
+ }
100
+ current = parent;
101
+ }
102
+ }
103
+
104
+ const scriptPath = fs.realpathSync(__filename);
105
+ const scriptDir = path.dirname(scriptPath);
106
+ const resolved = findBinary(scriptDir);
107
+
108
+ if (!resolved) {
109
+ console.error(
110
+ 'It seems that your package manager failed to install the right version of gemini-cli for your platform.\n' +
111
+ 'You can try manually installing the "' + base + '" package.\n\n' +
112
+ 'Supported platforms:\n' +
113
+ ' - macOS (Apple Silicon): bun-gemini-cli-darwin-arm64\n' +
114
+ ' - macOS (Intel): bun-gemini-cli-darwin-x64\n' +
115
+ ' - Linux (ARM64): bun-gemini-cli-linux-arm64\n' +
116
+ ' - Linux (x64): bun-gemini-cli-linux-x64\n' +
117
+ ' - Linux (x64 musl): bun-gemini-cli-linux-x64-musl\n' +
118
+ ' - Windows (x64): bun-gemini-cli-windows-x64\n\n' +
119
+ 'Please report this issue at https://github.com/google-gemini/gemini-cli/issues'
120
+ );
121
+ process.exit(1);
122
+ }
123
+
124
+ run(resolved);
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "bun-gemini-cli",
3
+ "version": "0.1.0",
4
+ "description": "Gemini CLI - AI-powered command-line interface",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/jackwotherspoon/gemini-cli.git"
10
+ },
11
+ "bin": {
12
+ "gemini": "bin/gemini"
13
+ },
14
+ "files": [
15
+ "bin"
16
+ ],
17
+ "optionalDependencies": {
18
+ "bun-gemini-cli-darwin-arm64": "0.1.0",
19
+ "bun-gemini-cli-darwin-x64": "0.1.0",
20
+ "bun-gemini-cli-darwin-x64-baseline": "0.1.0",
21
+ "bun-gemini-cli-linux-arm64": "0.1.0",
22
+ "bun-gemini-cli-linux-arm64-musl": "0.1.0",
23
+ "bun-gemini-cli-linux-x64": "0.1.0",
24
+ "bun-gemini-cli-linux-x64-baseline": "0.1.0",
25
+ "bun-gemini-cli-linux-x64-musl": "0.1.0",
26
+ "bun-gemini-cli-linux-x64-musl-baseline": "0.1.0",
27
+ "bun-gemini-cli-windows-x64": "0.1.0",
28
+ "bun-gemini-cli-windows-x64-baseline": "0.1.0"
29
+ }
30
+ }