omnirush 0.3.0 → 0.3.1

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.
@@ -400,20 +400,29 @@ export function createRefresher({ dir, origin, fetchImpl, now = () => Date.now()
400
400
  };
401
401
  }
402
402
 
403
- /** Best-effort browser open: xdg-open / open / cmd start. Never throws. */
403
+ /** Best-effort browser open. NEVER throws or crashes: the spawned child's
404
+ * 'error' event is always handled (ENOENT on a headless Linux box would
405
+ * otherwise take the CLI down — Foxtran's login crash). Linux tries a
406
+ * chain of openers; if all fail the caller's printed URL still works. */
404
407
  export function openBrowser(url) {
405
- try {
406
- if (process.platform === "darwin") {
407
- spawn("open", [url], { detached: true, stdio: "ignore" }).unref();
408
- return true;
409
- }
410
- if (process.platform === "win32") {
411
- spawn("cmd", ["/c", "start", "", url], { detached: true, stdio: "ignore" }).unref();
408
+ const spawnSafe = (cmd, args) => {
409
+ try {
410
+ const child = spawn(cmd, args, { detached: true, stdio: "ignore" });
411
+ child.on("error", () => undefined);
412
+ child.unref();
412
413
  return true;
414
+ } catch {
415
+ return false;
413
416
  }
414
- spawn("xdg-open", [url], { detached: true, stdio: "ignore" }).unref();
415
- return true;
416
- } catch {
417
- return false;
417
+ };
418
+ if (process.platform === "darwin") {
419
+ return spawnSafe("open", [url]);
420
+ }
421
+ if (process.platform === "win32") {
422
+ return spawnSafe("cmd", ["/c", "start", "", url]);
423
+ }
424
+ for (const opener of ["xdg-open", "sensible-browser", "gnome-open", "kde-open", "wslview"]) {
425
+ if (spawnSafe(opener, [url])) return true;
418
426
  }
427
+ return false;
419
428
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnirush",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Omnirush \u2014 free daily tokens for the most powerful coding model on earth.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/bin.js CHANGED
@@ -513,7 +513,7 @@ if (cmd === "login") await cmdLogin(argv.slice(1));
513
513
  else if (cmd === "logout") await cmdLogout();
514
514
  else if (cmd === "whoami") await cmdWhoami();
515
515
  else if (cmd === "doctor") await cmdDoctor();
516
- else if (cmd === "--version" || cmd === "-v") console.log("omnirush 0.3.0");
516
+ else if (cmd === "--version" || cmd === "-v") console.log("omnirush 0.3.1");
517
517
  else if (cmd === "collect") await cmdCollect(argv.slice(1));
518
518
  else if (cmd === undefined || cmd === "run") await cmdRun();
519
519
  else {