gearbox-code 0.1.13 → 0.1.15

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/dist/cli.mjs +29 -17
  2. package/install.sh +8 -2
  3. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -147353,9 +147353,9 @@ init_permission();
147353
147353
  var jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
147354
147354
  process.env.LANG = process.env.LANG || "en_US.UTF-8";
147355
147355
  process.env.LC_ALL = process.env.LC_ALL || "en_US.UTF-8";
147356
- var VERSION16 = "0.1.13";
147356
+ var VERSION16 = "0.1.15";
147357
147357
  var args = process.argv.slice(2);
147358
- var supportsAnsi = process.env.NO_COLOR !== "1" && process.env.TERM !== "dumb" && (process.stdout.isTTY || process.env.FORCE_COLOR === "1");
147358
+ var supportsAnsi = process.env.FORCE_COLOR === "1" || process.env.TERM !== "dumb" && process.env.NO_COLOR !== "1" && process.stdout.isTTY;
147359
147359
  var ansi = (code) => supportsAnsi ? `\x1B[${code}m` : "";
147360
147360
  var paint = (code, text2) => `${ansi(code)}${text2}${ansi("0")}`;
147361
147361
  var bold = (text2) => paint("1", text2);
@@ -147367,18 +147367,33 @@ var errColor = (text2) => paint("31", text2);
147367
147367
  var stripAnsi2 = (text2) => text2.replace(/\x1b\[[0-9;]*m/g, "");
147368
147368
  var visibleLength = (text2) => stripAnsi2(text2).length;
147369
147369
  var padVisible = (text2, width) => text2 + " ".repeat(Math.max(width - visibleLength(text2), 0));
147370
+ var hexRgb = (h2) => [parseInt(h2.slice(1, 3), 16), parseInt(h2.slice(3, 5), 16), parseInt(h2.slice(5, 7), 16)];
147371
+ var trueFg = (h2) => `\x1B[38;2;${hexRgb(h2).join(";")}m`;
147372
+ var trueBg = (h2) => `\x1B[48;2;${hexRgb(h2).join(";")}m`;
147373
+ function ghostLines(cells, pad3 = " ") {
147374
+ return cells.map((row) => {
147375
+ let line = pad3;
147376
+ for (const { t: t2, b } of row) {
147377
+ if (supportsAnsi && t2 && b)
147378
+ line += trueFg(t2) + trueBg(b) + "▀" + ansi("0");
147379
+ else if (supportsAnsi && t2)
147380
+ line += trueFg(t2) + "▀" + ansi("0");
147381
+ else if (supportsAnsi && b)
147382
+ line += trueFg(b) + "▄" + ansi("0");
147383
+ else if (t2 && b)
147384
+ line += "█";
147385
+ else if (t2)
147386
+ line += "▀";
147387
+ else if (b)
147388
+ line += "▄";
147389
+ else
147390
+ line += " ";
147391
+ }
147392
+ return line;
147393
+ });
147394
+ }
147370
147395
  function onboardingBoo() {
147371
- return [
147372
- " .-''''-.",
147373
- " .' .--. '.",
147374
- " / ( ) \\",
147375
- " | .-. .-. |",
147376
- " | |_| |_| |",
147377
- " | __ |",
147378
- " \\ .' '. /",
147379
- " '._\\____/_.'",
147380
- " /| |\\"
147381
- ].join(`
147396
+ return ghostLines(renderGhost({ palette: "default", face: "happy", scale: 1 })).join(`
147382
147397
  `);
147383
147398
  }
147384
147399
  function box(title, lines) {
@@ -147443,10 +147458,7 @@ async function runCliOnboarding() {
147443
147458
  };
147444
147459
  try {
147445
147460
  console.log("");
147446
- if (supportsAnsi)
147447
- console.log(paint("38;5;117", onboardingBoo()));
147448
- else
147449
- console.log(onboardingBoo());
147461
+ console.log(onboardingBoo());
147450
147462
  console.log("");
147451
147463
  console.log(bold("Gearbox setup"));
147452
147464
  console.log("Boo needs one model account before the coding app opens.");
package/install.sh CHANGED
@@ -101,6 +101,10 @@ fi
101
101
  cp "${extract_dir}/package/dist/cli.mjs" "${target_dir}/cli.mjs"
102
102
  chmod 0755 "${target_dir}/cli.mjs"
103
103
 
104
+ # Replace stale symlinks instead of following them. Old Bun-linked installs can
105
+ # leave ~/.bun/bin/gearbox -> .../src/cli.tsx; `cat > symlink` would overwrite
106
+ # the target and keep the broken link in place.
107
+ rm -f "${BIN_DIR}/gearbox"
104
108
  cat > "${BIN_DIR}/gearbox" <<EOF
105
109
  #!/usr/bin/env sh
106
110
  exec node "${target_dir}/cli.mjs" "\$@"
@@ -133,8 +137,10 @@ esac
133
137
  if [[ "${GEARBOX_SKIP_ONBOARD:-}" != "1" ]]; then
134
138
  echo ""
135
139
  echo "Starting setup..."
136
- if [[ -r /dev/tty && -w /dev/tty ]]; then
137
- "${BIN_DIR}/gearbox" onboard < /dev/tty > /dev/tty
140
+ if [[ -t 1 && -e /dev/tty && -r /dev/tty && -w /dev/tty ]]; then
141
+ if ! "${BIN_DIR}/gearbox" onboard < /dev/tty > /dev/tty; then
142
+ echo "Setup did not complete. Run: ${BIN_DIR}/gearbox onboard"
143
+ fi
138
144
  else
139
145
  echo "No interactive terminal detected. Run: ${BIN_DIR}/gearbox onboard"
140
146
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gearbox-code",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
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",