gearbox-code 0.1.4 → 0.1.6

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
@@ -44,17 +44,45 @@ No provider configured? Gearbox opens a setup screen and will not run a fake mod
44
44
  bun run scripts/preview.tsx
45
45
  ```
46
46
 
47
- ## Install for internal use (the `gearbox` command, anywhere)
47
+ ## Install
48
48
 
49
- Requires [Bun](https://bun.sh). Clone the repo, then:
49
+ One command, no sudo, no npm global permissions:
50
+
51
+ ```bash
52
+ curl -fsSL https://unpkg.com/gearbox-code@latest/install.sh | bash
53
+ ```
54
+
55
+ The installer is served from the published npm package, downloads the latest
56
+ `gearbox-code` tarball, and creates a user-owned `gearbox` command in
57
+ `~/.local/bin`.
58
+
59
+ Then:
50
60
 
51
61
  ```bash
52
- ./install.sh # bun install + bun link → 'gearbox' on your PATH
53
62
  gearbox auth add <api-key> # each person uses their own provider account
54
63
  cd ~/any/project && gearbox # the current directory is the workspace
55
64
  ```
56
65
 
57
- **Upgrade** later with one command — `gearbox upgrade` (pulls latest + reinstalls deps). Equivalent to `git pull && bun install` in the repo. If `gearbox` isn't found, add Bun's bin dir to PATH: `export PATH="$HOME/.bun/bin:$PATH"`.
66
+ If `~/.local/bin` is not on your PATH, the installer prints the exact line to
67
+ add to your shell config.
68
+
69
+ You can still run without installing:
70
+
71
+ ```bash
72
+ npx gearbox-code@latest
73
+ ```
74
+
75
+ **Upgrade** later by rerunning the install command. `gearbox upgrade` still works
76
+ for git checkouts.
77
+
78
+ ## Develop From Source
79
+
80
+ Requires [Bun](https://bun.sh). Clone the repo, then:
81
+
82
+ ```bash
83
+ bun install
84
+ bun run src/cli.tsx
85
+ ```
58
86
 
59
87
  **Standalone binary** (no clone/install on the target, same OS/arch):
60
88
 
package/dist/cli.mjs CHANGED
@@ -136099,7 +136099,7 @@ function App2({ selector: initialSelector, runner, fullscreen = false, resumeId
136099
136099
  var jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
136100
136100
  process.env.LANG = process.env.LANG || "en_US.UTF-8";
136101
136101
  process.env.LC_ALL = process.env.LC_ALL || "en_US.UTF-8";
136102
- var VERSION16 = "0.1.0";
136102
+ var VERSION16 = "0.1.6";
136103
136103
  var args = process.argv.slice(2);
136104
136104
  if (args[0] === "upgrade" || args[0] === "update") {
136105
136105
  const root2 = resolve11(import.meta.dir, "..");
package/install.sh ADDED
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env bash
2
+ # Public Gearbox installer.
3
+ #
4
+ # Installs the published npm package into user-owned directories:
5
+ # ~/.local/share/gearbox/<version>/cli.mjs
6
+ # ~/.local/bin/gearbox
7
+ #
8
+ # This intentionally avoids `npm install -g`, sudo, /usr/local, and any system
9
+ # prefix. It follows the same practical model as modern CLI installers: place a
10
+ # small executable shim in a user bin directory and tell the user if that
11
+ # directory is not on PATH.
12
+ set -euo pipefail
13
+
14
+ PACKAGE_NAME="${GEARBOX_PACKAGE:-gearbox-code}"
15
+ VERSION="${GEARBOX_VERSION:-latest}"
16
+ BIN_DIR="${GEARBOX_BIN_DIR:-${HOME}/.local/bin}"
17
+ INSTALL_ROOT="${GEARBOX_INSTALL_DIR:-${HOME}/.local/share/gearbox}"
18
+
19
+ need() {
20
+ if ! command -v "$1" >/dev/null 2>&1; then
21
+ echo "Gearbox installer needs '$1'." >&2
22
+ echo "Install Node.js first, then rerun this installer." >&2
23
+ exit 1
24
+ fi
25
+ }
26
+
27
+ need node
28
+ need curl
29
+ need tar
30
+
31
+ tmp="$(mktemp -d)"
32
+ cleanup() {
33
+ rm -rf "$tmp"
34
+ }
35
+ trap cleanup EXIT
36
+
37
+ meta_url="https://registry.npmjs.org/${PACKAGE_NAME}/${VERSION}"
38
+ meta_file="${tmp}/meta.json"
39
+
40
+ echo "-> Fetching ${PACKAGE_NAME}@${VERSION}"
41
+ curl -fsSL "$meta_url" -o "$meta_file"
42
+
43
+ resolved_version="$(node -e 'const fs=require("fs"); const j=JSON.parse(fs.readFileSync(process.argv[1],"utf8")); console.log(j.version || "")' "$meta_file")"
44
+ tarball_url="$(node -e 'const fs=require("fs"); const j=JSON.parse(fs.readFileSync(process.argv[1],"utf8")); console.log(j.dist && j.dist.tarball || "")' "$meta_file")"
45
+
46
+ if [[ -z "$resolved_version" || -z "$tarball_url" ]]; then
47
+ echo "Could not resolve ${PACKAGE_NAME}@${VERSION} from npm." >&2
48
+ exit 1
49
+ fi
50
+
51
+ target_dir="${INSTALL_ROOT}/${resolved_version}"
52
+ archive="${tmp}/package.tgz"
53
+ extract_dir="${tmp}/extract"
54
+
55
+ echo "-> Downloading ${PACKAGE_NAME}@${resolved_version}"
56
+ curl -fsSL "$tarball_url" -o "$archive"
57
+ mkdir -p "$extract_dir" "$target_dir" "$BIN_DIR"
58
+ tar -xzf "$archive" -C "$extract_dir"
59
+
60
+ if [[ ! -f "${extract_dir}/package/dist/cli.mjs" ]]; then
61
+ echo "Package did not contain dist/cli.mjs." >&2
62
+ exit 1
63
+ fi
64
+
65
+ cp "${extract_dir}/package/dist/cli.mjs" "${target_dir}/cli.mjs"
66
+ chmod 0755 "${target_dir}/cli.mjs"
67
+
68
+ cat > "${BIN_DIR}/gearbox" <<EOF
69
+ #!/usr/bin/env sh
70
+ exec node "${target_dir}/cli.mjs" "\$@"
71
+ EOF
72
+ chmod 0755 "${BIN_DIR}/gearbox"
73
+
74
+ echo ""
75
+ echo "Installed Gearbox ${resolved_version}"
76
+ echo " ${BIN_DIR}/gearbox"
77
+ echo ""
78
+
79
+ case ":${PATH}:" in
80
+ *":${BIN_DIR}:"*)
81
+ echo "Run it with: gearbox"
82
+ ;;
83
+ *)
84
+ shell_name="$(basename "${SHELL:-sh}")"
85
+ rc_file="${HOME}/.profile"
86
+ if [[ "$shell_name" == "zsh" ]]; then rc_file="${HOME}/.zshrc"; fi
87
+ if [[ "$shell_name" == "bash" ]]; then rc_file="${HOME}/.bashrc"; fi
88
+ echo "${BIN_DIR} is not on PATH yet."
89
+ echo "Add it with:"
90
+ echo " echo 'export PATH=\"${BIN_DIR}:\$PATH\"' >> ${rc_file}"
91
+ echo " source ${rc_file}"
92
+ echo ""
93
+ echo "Then run: gearbox"
94
+ ;;
95
+ esac
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gearbox-code",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A beautiful multi-provider coding harness for the terminal. (Intelligent model routing lands on top of this soon.)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -8,7 +8,8 @@
8
8
  "gearbox": "dist/cli.mjs"
9
9
  },
10
10
  "files": [
11
- "dist/cli.mjs"
11
+ "dist/cli.mjs",
12
+ "install.sh"
12
13
  ],
13
14
  "scripts": {
14
15
  "start": "bun run src/cli.tsx",