@longleash/cli 0.1.0-rc.3 → 0.1.0-rc.5

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
@@ -26,9 +26,12 @@ longleash doctor
26
26
  longleash run ~/code
27
27
  ```
28
28
 
29
- Until the background-service workstream ships, `longleash run` is foreground operation and the
30
- terminal must remain open. See the [first-party setup guide](https://longleash.dev/docs/getting-started)
31
- and [connectivity comparison](https://longleash.dev/docs/connectivity) before pairing.
29
+ Setup recommends a per-user background service, so the setup terminal may close after installation.
30
+ Use `longleash service status` to verify it, and `longleash pair` to print a fresh QR. Explicit
31
+ `longleash run` remains available for foreground diagnosis and requires that terminal to stay open.
32
+ See the [first-party setup guide](https://longleash.dev/docs/getting-started),
33
+ [background-service guide](https://longleash.dev/docs/background-service), and
34
+ [connectivity comparison](https://longleash.dev/docs/connectivity) before pairing.
32
35
 
33
36
  ## Security notes
34
37
 
package/bin/longleash.mjs CHANGED
@@ -1300,6 +1300,11 @@ function assertVersion(value) {
1300
1300
  }
1301
1301
  return value;
1302
1302
  }
1303
+ function updatePackageSpec(target, currentVersion) {
1304
+ const selected = target ?? (currentVersion.includes("-") ? "rc" : "latest");
1305
+ if (selected === "latest" || selected === "rc") return `@longleash/cli@${selected}`;
1306
+ return `@longleash/cli@${assertVersion(selected)}`;
1307
+ }
1303
1308
  function packageLocation(prefix) {
1304
1309
  return join2(prefix, "node_modules", "@longleash", "cli");
1305
1310
  }
@@ -1611,6 +1616,27 @@ function processAlive(pid) {
1611
1616
  }
1612
1617
  }
1613
1618
 
1619
+ // src/setup-input.ts
1620
+ function resolveAllowedRootAnswer(answer, defaultRoot) {
1621
+ const trimmed = answer.trim();
1622
+ if (/^(?:y|yes|n|no)$/i.test(trimmed)) {
1623
+ return {
1624
+ ok: false,
1625
+ message: `This question needs a folder path. Press Enter to use ${defaultRoot}, or type another existing folder.`
1626
+ };
1627
+ }
1628
+ try {
1629
+ const [root] = normalizeRoots([trimmed || defaultRoot]);
1630
+ if (!root) throw new Error("At least one allowed project directory is required.");
1631
+ return { ok: true, root };
1632
+ } catch (error) {
1633
+ return {
1634
+ ok: false,
1635
+ message: `That folder cannot be used: ${error instanceof Error ? error.message : String(error)}`
1636
+ };
1637
+ }
1638
+ }
1639
+
1614
1640
  // src/service.ts
1615
1641
  import {
1616
1642
  chmodSync as chmodSync2,
@@ -2119,7 +2145,7 @@ async function main() {
2119
2145
  if (command === "hooks") return runHooks(args.slice(1));
2120
2146
  if (command === "devices") return runNode(devicesEntry, []);
2121
2147
  if (command === "revoke") return runNode(devicesEntry, ["revoke", ...args.slice(1)]);
2122
- if (command === "update") return update(args[1] ?? "latest");
2148
+ if (command === "update") return update(args[1]);
2123
2149
  if (command === "uninstall") return uninstall();
2124
2150
  if (command === "run") return runDaemon(args.slice(1));
2125
2151
  if (command?.startsWith("-")) {
@@ -2148,7 +2174,7 @@ Usage:
2148
2174
  longleash hooks [--remove] install or remove supported provider hooks
2149
2175
  longleash devices list paired phones
2150
2176
  longleash revoke <id|--all> revoke paired phone access
2151
- longleash update [version] atomically install latest or an exact version
2177
+ longleash update [version] atomically update this channel or install an exact version
2152
2178
  longleash uninstall remove runtime and hooks; preserve user data
2153
2179
  longleash where print the active npm package directory`);
2154
2180
  }
@@ -2213,8 +2239,15 @@ async function setup(options) {
2213
2239
  try {
2214
2240
  console.log("\nLongLeash setup\n");
2215
2241
  console.log("Agents remain on this laptop. Choose only folders where they may work.");
2216
- const rootAnswer = await prompt.question(`Allowed project folder [${process.cwd()}]: `);
2217
- options.roots = [rootAnswer.trim() || process.cwd()];
2242
+ const defaultRoot = process.cwd();
2243
+ while (options.roots.length === 0) {
2244
+ const rootAnswer = await prompt.question(`Allowed project folder (press Enter for ${defaultRoot}): `);
2245
+ const resolved = resolveAllowedRootAnswer(rootAnswer, defaultRoot);
2246
+ if (resolved.ok) options.roots = [resolved.root];
2247
+ else console.log(`
2248
+ ${resolved.message}
2249
+ `);
2250
+ }
2218
2251
  console.log("\nConnectivity: hosted works away from home; LAN-only has no internet relay.");
2219
2252
  const relayAnswer = await prompt.question("Relay [hosted / lan / wss://your-relay/ws] (hosted): ");
2220
2253
  options.relay = relayAnswer.trim() || "hosted";
@@ -2457,7 +2490,7 @@ async function runHooks(args) {
2457
2490
  return failed ? 1 : 0;
2458
2491
  }
2459
2492
  async function update(target) {
2460
- const spec = target === "latest" ? "@longleash/cli@latest" : `@longleash/cli@${assertVersion(target)}`;
2493
+ const spec = updatePackageSpec(target, VERSION);
2461
2494
  const child = spawn("npm", [
2462
2495
  "exec",
2463
2496
  "--yes",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@longleash/cli",
3
- "version": "0.1.0-rc.3",
3
+ "version": "0.1.0-rc.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@longleash/cli",
9
- "version": "0.1.0-rc.3",
9
+ "version": "0.1.0-rc.5",
10
10
  "license": "MIT",
11
11
  "os": [
12
12
  "darwin",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longleash/cli",
3
- "version": "0.1.0-rc.3",
3
+ "version": "0.1.0-rc.5",
4
4
  "description": "Securely control Claude Code and Codex sessions on your laptop from your phone.",
5
5
  "license": "MIT",
6
6
  "type": "module",