coderemote 0.3.1 → 0.3.2

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
@@ -97,7 +97,7 @@ coderemote stop # stop the agent for this folder (--all: every
97
97
  coderemote serve # share on 127.0.0.1 only, no tunnel (local testing)
98
98
  coderemote requests [PORT] # requests that reached a previewed port (--grep, --failed, --json)
99
99
  coderemote request <ID> # headers and bodies of one request (--show-secrets, --json)
100
- coderemote rotate-token # revoke every paired device
100
+ coderemote rotate-token # revoke every paired device, stop running agents
101
101
  coderemote login # sign in again (--microsoft, or --device-code without a browser)
102
102
  coderemote update # install the latest version (`up` says when there's one)
103
103
  coderemote help # all options
@@ -435,11 +435,11 @@ async function listeningSockets() {
435
435
  return sockets;
436
436
  }
437
437
  async function processTable() {
438
- const out = await run("ps", ["-A", "-ww", "-o", "pid=,ppid=,command="]);
438
+ const out = await run("ps", ["-A", "-ww", "-o", "pid=,ppid=,tty=,command="]);
439
439
  const table = /* @__PURE__ */ new Map();
440
440
  for (const line of out.split("\n")) {
441
- const m = line.match(/^\s*(\d+)\s+(\d+)\s+(.*)$/);
442
- if (m) table.set(parseInt(m[1], 10), { ppid: parseInt(m[2], 10), command: m[3] });
441
+ const m = line.match(/^\s*(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/);
442
+ if (m) table.set(parseInt(m[1], 10), { ppid: parseInt(m[2], 10), tty: /^\?+$/.test(m[3]) ? null : m[3], command: m[4] });
443
443
  }
444
444
  return table;
445
445
  }
@@ -477,6 +477,8 @@ async function listPorts(shells = /* @__PURE__ */ new Map()) {
477
477
  command: table.get(s.pid)?.command ?? s.name,
478
478
  cwd: null,
479
479
  session: sessionOf(s.pid, table, shells),
480
+ // Started from a terminal (a dev server) rather than by launchd, an app or a daemon.
481
+ terminal: table.get(s.pid)?.tty != null,
480
482
  self: s.pid === process.pid,
481
483
  agent: s.pid === process.pid || AGENT_COMMAND.test(table.get(s.pid)?.command ?? "")
482
484
  });
@@ -1588,7 +1590,7 @@ function installCommand(installedAt) {
1588
1590
  // package.json
1589
1591
  var package_default = {
1590
1592
  name: "coderemote",
1591
- version: "0.3.1",
1593
+ version: "0.3.2",
1592
1594
  description: "Use your computer from your iPhone: files, git and a real terminal over a secure Microsoft Dev Tunnel. No SSH, no port forwarding, no VPN.",
1593
1595
  keywords: [
1594
1596
  "remote",
@@ -2132,7 +2134,7 @@ var USAGE = `Usage: coderemote <command> [options]
2132
2134
  status list running agents and their terminal sessions
2133
2135
  kill <id>... | --all kill terminal sessions (an id prefix is enough)
2134
2136
  stop [--all] stop the agent for this folder (or every agent)
2135
- rotate-token revoke every paired device
2137
+ rotate-token revoke every paired device and stop running agents
2136
2138
  update install the latest coderemote (up says when there's one)
2137
2139
  requests [PORT] list the requests that reached a previewed port, oldest first;
2138
2140
  --grep TEXT, --failed (errors, 4xx and 5xx), --limit N (default 50)
@@ -2393,7 +2395,13 @@ Token: ${cfg.token}`);
2393
2395
  case "rotate-token": {
2394
2396
  cfg.token = randomBytes(32).toString("base64url");
2395
2397
  saveConfig(cfg);
2396
- console.log("Token rotated. Re-pair your devices, and restart running agents.");
2398
+ const agents = registry.list();
2399
+ for (const agent of agents) {
2400
+ process.kill(agent.pid, "SIGTERM");
2401
+ console.log(`stopped agent for ${agent.root} (pid ${agent.pid})`);
2402
+ }
2403
+ console.log("Token rotated. Re-pair your devices.");
2404
+ if (agents.length) console.log("Run `coderemote up` again in each folder above; each keeps its tunnel URL.");
2397
2405
  break;
2398
2406
  }
2399
2407
  case "login": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coderemote",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Use your computer from your iPhone: files, git and a real terminal over a secure Microsoft Dev Tunnel. No SSH, no port forwarding, no VPN.",
5
5
  "keywords": [
6
6
  "remote",