linkshell-cli 0.8.2 → 0.9.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/src/index.ts CHANGED
@@ -51,7 +51,7 @@ const program = new Command();
51
51
  program
52
52
  .name("linkshell")
53
53
  .description(
54
- "Your coding agents and terminals, on your phone. Run `linkshell host --daemon`, then `linkshell pair` (or `linkshell login` for the official gateway).",
54
+ "Your coding agents and terminals, on your phone. Start with `linkshell setup`.",
55
55
  )
56
56
  .version(pkg.version);
57
57
 
@@ -93,7 +93,9 @@ const hostCmd = program
93
93
  process.stderr.write(` Log: ${daemon.getLogFile("host")}\n`);
94
94
  process.stderr.write(` Status: linkshell host status\n`);
95
95
  process.stderr.write(` Stop: linkshell host stop\n`);
96
- // The screen needs setting up once, at the computer: said here, where someone is.
96
+ // The first start here: the rest of the setup happens now, while someone is at the computer.
97
+ const { offerSetup } = await import("./commands/setup.js");
98
+ if (await offerSetup(pkg.version)) process.exit(process.exitCode ?? 0);
97
99
  const { screenAccess, describeScreen, screenReady } = await import("./commands/screen.js");
98
100
  const screen = await screenAccess().catch(() => undefined);
99
101
  if (screen && (screen === "old" || !screenReady(screen))) process.stderr.write(` Screen: ${describeScreen(screen)}\n`);
@@ -551,7 +553,7 @@ gatewayCmd
551
553
 
552
554
  program
553
555
  .command("screen")
554
- .description("Set this computer up for watching and controlling its screen from the phone (permissions, ffmpeg)")
556
+ .description("Set this computer up for watching and controlling its screen from the phone (the two macOS permissions; on Linux, ffmpeg)")
555
557
  .option("--check", "Only say what is and isn't ready")
556
558
  .action(async (options) => {
557
559
  const { runScreenSetup } = await import("./commands/screen.js");
@@ -611,9 +613,10 @@ program
611
613
 
612
614
  program
613
615
  .command("setup")
614
- .description("Configure the v1 bridge (`linkshell start`)")
616
+ .description("Set this computer up, once: the host, the screen's permissions, and your phone")
615
617
  .action(async () => {
616
- await runSetup();
618
+ await runSetup(pkg.version);
619
+ process.exit(process.exitCode ?? 0);
617
620
  });
618
621
 
619
622
  program
@@ -730,6 +733,14 @@ program
730
733
  );
731
734
  });
732
735
 
736
+ // `linkshell` by itself, on a computer where nothing has been set up yet: the setup, rather than a page of help.
737
+ program.action(async () => {
738
+ const { setupDone } = await import("./commands/setup.js");
739
+ if (process.stdin.isTTY !== true || process.stdout.isTTY !== true || (await setupDone())) return program.help();
740
+ await runSetup(pkg.version);
741
+ process.exit(process.exitCode ?? 0);
742
+ });
743
+
733
744
  program.parseAsync(process.argv).catch((error: unknown) => {
734
745
  const message = error instanceof Error ? error.message : String(error);
735
746
  process.stderr.write(`${message}\n`);