cli-setu 0.2.9 → 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.
Files changed (3) hide show
  1. package/bin/setu.js +31 -2
  2. package/package.json +1 -1
  3. package/src/pair.js +1 -15
package/bin/setu.js CHANGED
@@ -29,7 +29,27 @@ const args = process.argv.slice(2);
29
29
  const firstArg = args[0];
30
30
  const isSubcommand = firstArg && !firstArg.startsWith('-');
31
31
 
32
+ // Real bug found by testing: a genuinely unrecognized flag like `-rfesfd`
33
+ // or `-g` (a typo, not meant for supervisor.js at all) also starts with
34
+ // "-", so it fell through the isSubcommand check above straight into the
35
+ // bare-`cli-setu` session-watching path below - silently pairing/starting
36
+ // a real session and generating a QR code instead of telling the user
37
+ // their command doesn't exist. supervisor.js only ever actually reads
38
+ // `--cli <name>` out of argv (confirmed by reading it directly - the
39
+ // `[workingDir]` mentioned in its own old comment is dead, WORKING_DIR is
40
+ // just process.cwd()) - every other `-`-prefixed flag is unrecognized by
41
+ // definition, same as an unrecognized subcommand already is below.
42
+ const KNOWN_FLAGS = new Set(['--version', '-v', '--help', '-h', '--update', '--cli']);
43
+ const hasUnknownFlag = args.some((a) => a.startsWith('-') && !KNOWN_FLAGS.has(a));
44
+
32
45
  async function main() {
46
+ if (hasUnknownFlag) {
47
+ const bad = args.find((a) => a.startsWith('-') && !KNOWN_FLAGS.has(a));
48
+ console.error(`[cli-setu] Unknown option: ${bad}`);
49
+ console.error('[cli-setu] For more info, run: cli-setu --help');
50
+ process.exit(1);
51
+ }
52
+
33
53
  if (args.includes('--version') || args.includes('-v')) {
34
54
  console.log(require('../package.json').version);
35
55
  return;
@@ -49,8 +69,16 @@ async function main() {
49
69
  if (isSubcommand) {
50
70
  switch (firstArg) {
51
71
  case 'pair': {
72
+ // Real product ask (PM report): a first-time user had to run
73
+ // `cli-setu pair` then separately `cli-setu` to actually start a
74
+ // session - two commands where one would do, and the phone had
75
+ // nothing to show (no session yet) right after pairing. Matches
76
+ // bare `cli-setu`'s own already-correct behavior below: pair (if
77
+ // needed), then immediately start watching THIS folder as a
78
+ // session, same single-step flow either way now.
52
79
  const { pair } = require('../src/pair');
53
80
  await pair(AUTH_SERVER, AUTH_SERVER_PUBLIC);
81
+ require('../src/supervisor');
54
82
  return;
55
83
  }
56
84
  case 'status': {
@@ -91,7 +119,7 @@ async function main() {
91
119
  const config = readConfig();
92
120
  if (!config || !config.deviceToken) {
93
121
  const { pair } = require('../src/pair');
94
- await pair(AUTH_SERVER, AUTH_SERVER_PUBLIC, { standalone: false });
122
+ await pair(AUTH_SERVER, AUTH_SERVER_PUBLIC);
95
123
  }
96
124
  require('../src/supervisor');
97
125
  }
@@ -104,7 +132,8 @@ Usage:
104
132
  cli-setu --cli <name> Same, but run a specific CLI inside the bridged
105
133
  session instead of the default plain shell
106
134
  (e.g. --cli claude, --cli codex)
107
- cli-setu pair Pair this computer with your phone, nothing else
135
+ cli-setu pair Pair this computer with your phone, then watch
136
+ this folder as a session (same as bare cli-setu)
108
137
  cli-setu status Show pairing status and any sessions running now
109
138
  cli-setu stop Stop every session running on this computer
110
139
  cli-setu stop <sessionId> Stop just one session (see \`cli-setu status\`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-setu",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
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/pair.js CHANGED
@@ -8,7 +8,7 @@ const qrcode = require('qrcode-terminal');
8
8
  const { loadOrCreateConfig, writeConfig, hasKeypair } = require('./config');
9
9
  const { generateKeypair, publicKeyToBase64, privateKeyToBase64 } = require('./crypto');
10
10
 
11
- async function pair(authServer, authServerPublic, { standalone = true } = {}) {
11
+ async function pair(authServer, authServerPublic) {
12
12
  const config = loadOrCreateConfig();
13
13
 
14
14
  // Section 1 E2E: generate this device's own keypair up front, before
@@ -125,20 +125,6 @@ async function pair(authServer, authServerPublic, { standalone = true } = {}) {
125
125
  }
126
126
  }
127
127
 
128
- // Real gap found by testing (PM report): a first-time user had no clear
129
- // next step after pairing succeeded - pairing a device and starting a
130
- // real terminal session are deliberately separate commands (one laptop
131
- // can run several sessions, switch CLIs across restarts, etc.), but
132
- // nothing here ever told a first-time user that distinction, or what
133
- // to actually type next. Only shown for an explicit, standalone
134
- // `cli-setu pair` - bin/setu.js's own bare-`cli-setu` flow calls this
135
- // function too (auto-pairing an unpaired machine before immediately
136
- // starting a session right after), where this message would be
137
- // immediately followed by the session actually starting anyway.
138
- if (standalone) {
139
- console.log('[cli-setu] Run `cli-setu` in a project folder to start your first session.');
140
- }
141
-
142
128
  return config;
143
129
  }
144
130