claude-code-rehab 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/index.mjs +22 -9
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -106,12 +106,25 @@ const server = createServer(async (req, res) => {
106
106
  }
107
107
  });
108
108
 
109
- server.listen(PORT, "0.0.0.0", () => {
110
- const ips = getLocalIPs();
111
- console.log("\n Claude Code Rehab — Data Server\n");
112
- console.log(` Local: http://localhost:${PORT}`);
113
- ips.forEach(ip => console.log(` Network: http://${ip}:${PORT}`));
114
- console.log(`\n Open the app on your phone and enter:`);
115
- ips.forEach(ip => console.log(` ${ip}:${PORT}`));
116
- console.log("\n Ctrl+C to stop\n");
117
- });
109
+ function tryListen(port) {
110
+ server.listen(port, "0.0.0.0", () => {
111
+ const ips = getLocalIPs();
112
+ console.log("\n Claude Code Rehab — Data Server\n");
113
+ console.log(` Local: http://localhost:${port}`);
114
+ ips.forEach(ip => console.log(` Network: http://${ip}:${port}`));
115
+ console.log(`\n Open the app on your phone and enter:`);
116
+ ips.forEach(ip => console.log(` ${ip}:${port}`));
117
+ console.log("\n Ctrl+C to stop\n");
118
+ });
119
+ server.on("error", (e) => {
120
+ if (e.code === "EADDRINUSE" && port < PORT + 10) {
121
+ console.log(` Port ${port} in use, trying ${port + 1}...`);
122
+ server.close();
123
+ tryListen(port + 1);
124
+ } else {
125
+ console.error(` Error: ${e.message}`);
126
+ process.exit(1);
127
+ }
128
+ });
129
+ }
130
+ tryListen(PORT);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-rehab",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Claude Code usage data server — connects to the Rehab dashboard",
5
5
  "type": "module",
6
6
  "bin": {