reley 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +32 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -425,7 +425,7 @@ function findReleyServer() {
425
425
  for (const p of candidates) {
426
426
  if (existsSync2(p)) return p;
427
427
  }
428
- throw new Error("Not logged in. Run `reley login` first, or use `reley --online` to connect to the remote server.");
428
+ throw new Error("Not logged in. Run `reley login` first, or use `reley` to connect to the remote server.");
429
429
  }
430
430
  async function isReleyRunning(url) {
431
431
  try {
@@ -1136,7 +1136,14 @@ async function runCommand(commandArgs, options) {
1136
1136
  log("RELEY", `Already running on :${releyPort}`);
1137
1137
  } else {
1138
1138
  log("RELEY", `Starting on :${releyPort}...`);
1139
- const releyPath = findReleyServer();
1139
+ let releyPath;
1140
+ try {
1141
+ releyPath = findReleyServer();
1142
+ } catch {
1143
+ console.error(" \x1B[33mLocal server not found.\x1B[0m");
1144
+ console.error(" Run \x1B[1mreley login\x1B[0m to connect to the remote server.\n");
1145
+ process.exit(1);
1146
+ }
1140
1147
  releyProc = fork(releyPath, [], {
1141
1148
  env: { ...process.env, PORT: String(releyPort), LOG_LEVEL: "warn" },
1142
1149
  stdio: "pipe"
@@ -1394,7 +1401,24 @@ async function runOnlineCommand(commandArgs, options) {
1394
1401
  });
1395
1402
  if (!res.ok) {
1396
1403
  const body = await res.json().catch(() => ({}));
1397
- console.error(`\x1B[31mError:\x1B[0m Failed to create session: ${body.error || res.statusText}`);
1404
+ if (body.code === "SUBSCRIPTION_REQUIRED") {
1405
+ console.error(" \x1B[33mSubscription required.\x1B[0m");
1406
+ console.error(` Subscribe at \x1B[1m\x1B[4mhttps://reley.sh/dashboard\x1B[0m
1407
+ `);
1408
+ process.exit(1);
1409
+ }
1410
+ if (body.code === "SUBSCRIPTION_INACTIVE") {
1411
+ console.error(` \x1B[33mSubscription ${body.status || "inactive"}.\x1B[0m`);
1412
+ console.error(` Update your subscription at \x1B[1m\x1B[4mhttps://reley.sh/dashboard\x1B[0m
1413
+ `);
1414
+ process.exit(1);
1415
+ }
1416
+ if (res.status === 401) {
1417
+ console.error(" \x1B[31mSession expired.\x1B[0m Run \x1B[1mreley login\x1B[0m to re-authenticate.\n");
1418
+ process.exit(1);
1419
+ }
1420
+ console.error(` \x1B[31mFailed to create session:\x1B[0m ${body.error || res.statusText}
1421
+ `);
1398
1422
  process.exit(1);
1399
1423
  }
1400
1424
  const { roomId, cliToken, sessionId } = await res.json();
@@ -2720,7 +2744,7 @@ async function startOAuthFlow(supabaseUrl, supabaseAnonKey) {
2720
2744
  // src/index.ts
2721
2745
  init_config();
2722
2746
  var program = new Command();
2723
- program.name("reley").description("Bridge your terminal to mobile/web with E2E encryption").version("0.1.0");
2747
+ program.name("reley").description("Bridge your terminal to mobile/web with E2E encryption").version("0.1.2");
2724
2748
  program.option("--reley-url <url>", "Reley server URL", "http://localhost:3100").option("--config-dir <path>", "Configuration directory", `${process.env.HOME}/.reley`);
2725
2749
  program.command("run [command...]", { isDefault: true }).description("Run a command with web terminal sync (default)").option("--web-port <port>", "Web UI port", "3200").option("--reley-port <port>", "Reley server port", "3100").option("--online", "Use online reley server (requires `reley login` first)").action(async (commandArgs, opts) => {
2726
2750
  const online = opts.online ?? isConfigured();
@@ -2747,6 +2771,9 @@ program.command("install-hooks").description("Install Claude Code hooks for Rele
2747
2771
  await installHooksCommand({ releyUrl: opts.releyUrl, configDir: opts.configDir });
2748
2772
  });
2749
2773
  program.parseAsync(process.argv).catch((err) => {
2750
- console.error("Fatal error:", err);
2774
+ const msg = err instanceof Error ? err.message : String(err);
2775
+ console.error(`
2776
+ \x1B[31m\x1B[1mError:\x1B[0m ${msg}
2777
+ `);
2751
2778
  process.exit(1);
2752
2779
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reley",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Reley CLI — Bridge your terminal to mobile/web with E2E encryption",