@youdie006/swapdex 0.137.0 → 0.138.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.
package/bin/exit.js ADDED
@@ -0,0 +1,34 @@
1
+ // How the launcher reports the prebuilt binary's ending.
2
+ //
3
+ // `spawnSync` reports a signal death as `status: null` plus a signal name. The
4
+ // launcher used to collapse that to exit 1, which made "something on this
5
+ // machine killed the proxy" indistinguishable from "the proxy failed" - and a
6
+ // signal death prints nothing, so there was no other clue either. On WSL the
7
+ // proxy was dying at the top of every hour and systemd's restart hid it.
8
+ const { constants } = require("os");
9
+
10
+ function describeExit(result) {
11
+ if (typeof result.status === "number") {
12
+ return { code: result.status, note: null };
13
+ }
14
+ const signal = result.signal;
15
+ if (!signal) {
16
+ return {
17
+ code: 1,
18
+ note:
19
+ "swapdex: the binary ended without an exit code and without a signal. " +
20
+ "Exiting 1, but that 1 is this launcher's, not the binary's.",
21
+ };
22
+ }
23
+ const number = constants.signals[signal];
24
+ return {
25
+ // 128 + signal is the shell convention, so 137 reads as SIGKILL rather
26
+ // than as a swapdex failure.
27
+ code: number ? 128 + number : 1,
28
+ note:
29
+ `swapdex: the binary was killed by ${signal}. Something on this machine ` +
30
+ "sent that signal - this is not swapdex exiting on its own.",
31
+ };
32
+ }
33
+
34
+ module.exports = { describeExit };
package/bin/swapdex.js CHANGED
@@ -6,6 +6,7 @@
6
6
  // install time and there is no allow-scripts prompt.
7
7
 
8
8
  const { spawnSync } = require("child_process");
9
+ const { describeExit } = require("./exit.js");
9
10
 
10
11
  // swapdex is a Unix tool (Linux, WSL, macOS) - it manages 0600 credential files.
11
12
  const PKGS = {
@@ -46,4 +47,6 @@ if (result.error) {
46
47
  );
47
48
  process.exit(1);
48
49
  }
49
- process.exit(result.status === null ? 1 : result.status);
50
+ const { code, note } = describeExit(result);
51
+ if (note) console.error(note);
52
+ process.exit(code);
package/man/swapdex.1 CHANGED
@@ -1,6 +1,6 @@
1
1
  .ie \n(.g .ds Aq \(aq
2
2
  .el .ds Aq '
3
- .TH swapdex 1 "swapdex 0.137.0"
3
+ .TH swapdex 1 "swapdex 0.138.0"
4
4
  .SH NAME
5
5
  swapdex \- Switch Claude Code / Codex / Gemini / Antigravity login accounts, locally and safely.
6
6
  .SH SYNOPSIS
@@ -130,4 +130,4 @@ Print the man page (roff) to stdout
130
130
  swapdex\-help(1)
131
131
  Print this message or the help of the given subcommand(s)
132
132
  .SH VERSION
133
- v0.137.0
133
+ v0.138.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youdie006/swapdex",
3
- "version": "0.137.0",
3
+ "version": "0.138.0",
4
4
  "description": "Switch between multiple Claude Code, Codex, Gemini, and Antigravity login accounts, locally and safely.",
5
5
  "bin": {
6
6
  "swapdex": "bin/swapdex.js"
@@ -8,13 +8,14 @@
8
8
  "files": [
9
9
  "README.md",
10
10
  "bin/swapdex.js",
11
+ "bin/exit.js",
11
12
  "man/swapdex.1"
12
13
  ],
13
14
  "optionalDependencies": {
14
- "@youdie006/swapdex-darwin-arm64": "0.137.0",
15
- "@youdie006/swapdex-darwin-x64": "0.137.0",
16
- "@youdie006/swapdex-linux-x64": "0.137.0",
17
- "@youdie006/swapdex-linux-arm64": "0.137.0"
15
+ "@youdie006/swapdex-darwin-arm64": "0.138.0",
16
+ "@youdie006/swapdex-darwin-x64": "0.138.0",
17
+ "@youdie006/swapdex-linux-x64": "0.138.0",
18
+ "@youdie006/swapdex-linux-arm64": "0.138.0"
18
19
  },
19
20
  "keywords": [
20
21
  "cli",