cli-setu 0.2.1 → 0.2.3

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/setu.js CHANGED
@@ -60,7 +60,10 @@ async function main() {
60
60
  }
61
61
  case 'stop': {
62
62
  const { stop } = require('../src/stop');
63
- await stop();
63
+ // args[1] (optional) - a specific sessionId to stop, copied from
64
+ // `cli-setu status`'s own output. Omitted stops every session on
65
+ // this computer, unchanged from before.
66
+ await stop(args[1]);
64
67
  return;
65
68
  }
66
69
  case 'unpair': {
@@ -103,7 +106,9 @@ Usage:
103
106
  (e.g. --cli claude, --cli codex)
104
107
  cli-setu pair Pair this computer with your phone, nothing else
105
108
  cli-setu status Show pairing status and any sessions running now
106
- cli-setu stop Stop a running session
109
+ cli-setu stop Stop every session running on this computer
110
+ cli-setu stop <sessionId> Stop just one session (see \`cli-setu status\`
111
+ for the exact id to use)
107
112
  cli-setu unpair Unpair this computer (asks for confirmation)
108
113
  cli-setu --version, -v Print the installed version
109
114
  cli-setu --update Check for and install the latest version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-setu",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Bridge your terminal to your phone — run and approve Claude Code, Codex CLI and other AI coding agents from anywhere.",
5
5
  "type": "commonjs",
6
6
  "bin": {
package/src/stop.js CHANGED
@@ -3,10 +3,15 @@
3
3
  // a supervisor was closing its terminal window (or Ctrl+C, which only
4
4
  // reaches the one you're actually looking at) - this reaches every
5
5
  // running session at once via the same PID files status.js reads.
6
+ //
7
+ // `cli-setu stop <sessionId>` (new) - real gap found by testing: running
8
+ // several sessions at once (e.g. two different project folders) had no
9
+ // way to stop just ONE of them without killing all the others too -
10
+ // copy the exact sessionId from `cli-setu status`'s own output.
6
11
  const fs = require('fs');
7
12
  const { CONFIG_DIR } = require('./config');
8
13
 
9
- async function stop() {
14
+ async function stop(targetSessionId) {
10
15
  let files;
11
16
  try {
12
17
  files = fs.readdirSync(CONFIG_DIR).filter((f) => f.startsWith('session.') && f.endsWith('.pid'));
@@ -20,6 +25,7 @@ async function stop() {
20
25
  }
21
26
 
22
27
  let stopped = 0;
28
+ let matchedTarget = false;
23
29
  for (const file of files) {
24
30
  const pidFile = `${CONFIG_DIR}/${file}`;
25
31
  let info;
@@ -28,6 +34,12 @@ async function stop() {
28
34
  } catch {
29
35
  continue;
30
36
  }
37
+
38
+ // Only act on the one session asked for, if a target was given - every
39
+ // other running session is left completely untouched.
40
+ if (targetSessionId && info.sessionId !== targetSessionId) continue;
41
+ if (targetSessionId) matchedTarget = true;
42
+
31
43
  try {
32
44
  // SIGINT (not SIGKILL) - the same signal Ctrl+C sends, so the
33
45
  // process's own handler (supervisor.js's process.on('SIGINT', ...))
@@ -43,6 +55,11 @@ async function stop() {
43
55
  }
44
56
  }
45
57
 
58
+ if (targetSessionId && !matchedTarget) {
59
+ console.log(`[cli-setu] No running session found with id "${targetSessionId}". Run \`cli-setu status\` to see what's running.`);
60
+ return;
61
+ }
62
+
46
63
  if (stopped === 0) {
47
64
  console.log('[cli-setu] Sessions were already stopped (stale state cleaned up).');
48
65
  }
package/src/supervisor.js CHANGED
@@ -256,6 +256,13 @@ async function connectToAzure() {
256
256
  const conn = await res.json();
257
257
  deviceId = conn.deviceId;
258
258
  log(`[supervisor] Connecting to Azure as device:${deviceId} (owner: ${conn.userId})...`);
259
+ // Diagnostic found by testing: a session not appearing in the phone's
260
+ // Terminal tab had no visible cause from the laptop's own side - this
261
+ // surfaces whether the backend's session.started broadcast (what
262
+ // actually makes a session show up before its first approval prompt)
263
+ // was even attempted and whether it succeeded, right here, instead of
264
+ // needing server log access to find out.
265
+ console.log(`[supervisor] session.started broadcast: ${conn.sessionBroadcast || '(not reported by this server version)'}`);
259
266
 
260
267
  ws = new WebSocket(conn.wssUrl);
261
268