Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions CLI/cmux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ final class SocketClient {
}

let authURL = URL(fileURLWithPath: NSHomeDirectory(), isDirectory: true)
.appendingPathComponent(".cmux/relay/\(endpoint.port).auth", isDirectory: false)
.appendingPathComponent(".programa/relay/\(endpoint.port).auth", isDirectory: false)
guard let authData = try? Data(contentsOf: authURL),
let authObject = try? JSONSerialization.jsonObject(with: authData) as? [String: Any],
let relayID = trimmedEnvValue(authObject["relay_id"] as? String),
Expand Down Expand Up @@ -4428,16 +4428,16 @@ struct CMUXCLI {
remoteRelayPort: Int
) -> String {
var lines = remoteBootstrapTTYCaptureLines(remoteRelayPort: remoteRelayPort, includeRelayRPC: true)
lines.append("/bin/sh \"$HOME/.cmux/relay/\(remoteRelayPort).bootstrap.sh\"")
lines.append("/bin/sh \"$HOME/.programa/relay/\(remoteRelayPort).bootstrap.sh\"")
return lines.joined(separator: "\n")
}

private func remoteBootstrapInstallShell(remoteRelayPort: Int) -> String {
[
"set -eu",
"umask 077",
"cmux_bootstrap_path=\"$HOME/.cmux/relay/\(remoteRelayPort).bootstrap.sh\"",
"mkdir -p \"$HOME/.cmux/relay\"",
"cmux_bootstrap_path=\"$HOME/.programa/relay/\(remoteRelayPort).bootstrap.sh\"",
"mkdir -p \"$HOME/.programa/relay\"",
"cat > \"$cmux_bootstrap_path\"",
"chmod 700 \"$cmux_bootstrap_path\" >/dev/null 2>&1 || true",
].joined(separator: "\n")
Expand Down Expand Up @@ -4470,15 +4470,15 @@ struct CMUXCLI {
"cmux_bootstrap_tty=\"$(tty 2>/dev/null || true)\"",
"cmux_bootstrap_tty=\"${cmux_bootstrap_tty##*/}\"",
"if [ -n \"$cmux_bootstrap_tty\" ] && [ \"$cmux_bootstrap_tty\" != \"not a tty\" ]; then",
" mkdir -p \"$HOME/.cmux/relay\" >/dev/null 2>&1 || true",
" printf '%s' \"$cmux_bootstrap_tty\" > \"$HOME/.cmux/relay/\(remoteRelayPort).tty\" 2>/dev/null || true",
" mkdir -p \"$HOME/.programa/relay\" >/dev/null 2>&1 || true",
" printf '%s' \"$cmux_bootstrap_tty\" > \"$HOME/.programa/relay/\(remoteRelayPort).tty\" 2>/dev/null || true",
" export PROGRAMA_BOOTSTRAP_TTY=\"$cmux_bootstrap_tty\"",
]

if includeRelayRPC {
lines += [
" cmux_relay_cli=\"$HOME/.cmux/bin/cmux\"",
" if [ ! -x \"$cmux_relay_cli\" ]; then cmux_relay_cli=\"$(command -v cmux 2>/dev/null || true)\"; fi",
" cmux_relay_cli=\"$HOME/.programa/bin/programa\"",
" if [ ! -x \"$cmux_relay_cli\" ]; then cmux_relay_cli=\"$(command -v programa 2>/dev/null || true)\"; fi",
" if [ -n \"$cmux_relay_cli\" ]; then",
" cmux_relay_report_tty='{\"workspace_id\":\"__PROGRAMA_WORKSPACE_ID__\",\"tty_name\":\"'$cmux_bootstrap_tty'\"}'",
" cmux_relay_ports_kick='{\"workspace_id\":\"__PROGRAMA_WORKSPACE_ID__\",\"reason\":\"command\"}'",
Expand Down Expand Up @@ -4521,8 +4521,8 @@ struct CMUXCLI {
let relaySocket = remoteRelayPort > 0 ? "127.0.0.1:\(remoteRelayPort)" : nil
var commonShellExportLines = remoteTerminalLines
commonShellExportLines.append(contentsOf: remoteEnvExportLines)
commonShellExportLines.append("export PATH=\"$HOME/.cmux/bin:$PATH\"")
commonShellExportLines.append("export PROGRAMA_BUNDLED_CLI_PATH=\"$HOME/.cmux/bin/cmux\"")
commonShellExportLines.append("export PATH=\"$HOME/.programa/bin:$PATH\"")
commonShellExportLines.append("export PROGRAMA_BUNDLED_CLI_PATH=\"$HOME/.programa/bin/programa\"")
commonShellExportLines.append("export PROGRAMA_SHELL_INTEGRATION_DIR=\"\(shellStateDir)\"")
if let relaySocket {
commonShellExportLines.append("export PROGRAMA_SOCKET_PATH=\(relaySocket)")
Expand Down Expand Up @@ -4555,7 +4555,7 @@ struct CMUXCLI {
let relayWarmupLines = interactiveRemoteRelayWarmupLines(remoteRelayPort: remoteRelayPort)

var outerLines: [String] = [
"mkdir -p \"$HOME/.cmux/relay\"",
"mkdir -p \"$HOME/.programa/relay\"",
"cmux_shell_dir=\"\(shellStateDir)\"",
"mkdir -p \"$cmux_shell_dir\"",
]
Expand Down Expand Up @@ -4632,7 +4632,7 @@ struct CMUXCLI {
}

private func shellStateDirForRemoteRelayPort(_ remoteRelayPort: Int) -> String {
"$HOME/.cmux/relay/\(max(remoteRelayPort, 0)).shell"
"$HOME/.programa/relay/\(max(remoteRelayPort, 0)).shell"
}

private func bundledShellIntegrationScript(named fileName: String) -> String? {
Expand Down Expand Up @@ -4754,14 +4754,14 @@ struct CMUXCLI {
return []
}
return [
"cmux_relay_cli=\"${PROGRAMA_BUNDLED_CLI_PATH:-$HOME/.cmux/bin/cmux}\"",
"if [ ! -x \"$cmux_relay_cli\" ]; then cmux_relay_cli=\"$(command -v cmux 2>/dev/null || true)\"; fi",
"cmux_relay_cli=\"${PROGRAMA_BUNDLED_CLI_PATH:-$HOME/.programa/bin/programa}\"",
"if [ ! -x \"$cmux_relay_cli\" ]; then cmux_relay_cli=\"$(command -v programa 2>/dev/null || true)\"; fi",
"cmux_relay_tty=\"${PROGRAMA_BOOTSTRAP_TTY:-}\"",
"if [ -z \"$cmux_relay_tty\" ]; then cmux_relay_tty=\"$(tty 2>/dev/null || true)\"; fi",
"cmux_relay_tty=\"${cmux_relay_tty##*/}\"",
"if [ -n \"$cmux_relay_tty\" ] && [ \"$cmux_relay_tty\" != \"not a tty\" ]; then",
" mkdir -p \"$HOME/.cmux/relay\" >/dev/null 2>&1 || true",
" printf '%s' \"$cmux_relay_tty\" > \"$HOME/.cmux/relay/\(remoteRelayPort).tty\" 2>/dev/null || true",
" mkdir -p \"$HOME/.programa/relay\" >/dev/null 2>&1 || true",
" printf '%s' \"$cmux_relay_tty\" > \"$HOME/.programa/relay/\(remoteRelayPort).tty\" 2>/dev/null || true",
"fi",
"if [ -n \"$cmux_relay_cli\" ] && [ -n \"$PROGRAMA_WORKSPACE_ID\" ] && [ -n \"$cmux_relay_tty\" ] && [ \"$cmux_relay_tty\" != \"not a tty\" ]; then",
" cmux_relay_report_tty=\"{\\\"workspace_id\\\":\\\"$PROGRAMA_WORKSPACE_ID\\\",\\\"tty_name\\\":\\\"$cmux_relay_tty\\\"}\"",
Expand Down
Loading