replicas-cli 0.3.589 → 0.3.591

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.cjs +13 -6
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -40649,7 +40649,7 @@ var CLI_VERSION;
40649
40649
  var init_cli_version = __esm({
40650
40650
  "../shared/src/cli-version.ts"() {
40651
40651
  "use strict";
40652
- CLI_VERSION = "0.3.589";
40652
+ CLI_VERSION = "0.3.591";
40653
40653
  }
40654
40654
  });
40655
40655
 
@@ -52961,6 +52961,13 @@ var init_identity = __esm({
52961
52961
  });
52962
52962
 
52963
52963
  // src/lib/ssh.ts
52964
+ function ensureSSHTransport() {
52965
+ const result = (0, import_child_process.spawnSync)("websocat", ["--version"], { stdio: "ignore" });
52966
+ if (result.error || result.status !== 0) {
52967
+ const install = process.platform === "darwin" ? "Install it with: brew install websocat" : "Install it from https://github.com/vi/websocat#installation";
52968
+ throw new Error(`SSH requires websocat on your PATH. ${install}`);
52969
+ }
52970
+ }
52964
52971
  function buildSSHArgs(token, host, proxyCommand, localForward) {
52965
52972
  return [
52966
52973
  ...SSH_OPTIONS,
@@ -52982,9 +52989,10 @@ async function connectSSH(token, host, proxyCommand, localForward) {
52982
52989
  const ssh = (0, import_child_process.spawn)("ssh", buildSSHArgs(token, host, proxyCommand, localForward), {
52983
52990
  stdio: "inherit"
52984
52991
  });
52985
- ssh.on("close", (code) => {
52986
- if (localForward && code) {
52987
- reject(new Error(`SSH tunnel exited with code ${code}`));
52992
+ ssh.on("close", (code, signal) => {
52993
+ if (code !== 0) {
52994
+ const reason = signal ? `signal ${signal}` : `code ${code}`;
52995
+ reject(new Error(`SSH${localForward ? " tunnel" : ""} exited with ${reason}`));
52988
52996
  } else {
52989
52997
  resolve4();
52990
52998
  }
@@ -53148,11 +53156,10 @@ var init_workspace_connection = __esm({
53148
53156
  // src/commands/connect.ts
53149
53157
  async function connectCommand(workspaceName) {
53150
53158
  ensureOrgApiAuthenticated();
53159
+ ensureSSHTransport();
53151
53160
  const { workspace, sshToken, sshHost, sshProxyCommand } = await prepareWorkspaceConnection(workspaceName);
53152
53161
  console.log(import_chalk10.default.blue(`
53153
53162
  Connecting to ${workspace.name}...`));
53154
- const sshCommand = `ssh ${sshToken}@${sshHost}`;
53155
- console.log(import_chalk10.default.gray(`SSH command: ${sshCommand}`));
53156
53163
  console.log(import_chalk10.default.gray("\nPress Ctrl+D to disconnect.\n"));
53157
53164
  await connectSSH(sshToken, sshHost, sshProxyCommand);
53158
53165
  console.log(import_chalk10.default.green("\n\u2713 Disconnected from workspace.\n"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.589",
3
+ "version": "0.3.591",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {