Revert "Merge pull request #239 from manaflow-ai/issue-151-ssh-remote-port-proxying"
This reverts commit78e4bd32ba, reversing changes made tocf75da8f8a.
This commit is contained in:
parent
78e4bd32ba
commit
f7cbbad434
60 changed files with 1250 additions and 17140 deletions
|
|
@ -1,140 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: scripts/build_remote_daemon_release_assets.sh \
|
||||
--version <app-version> \
|
||||
--release-tag <tag> \
|
||||
--repo <owner/repo> \
|
||||
--output-dir <dir>
|
||||
|
||||
Builds cmuxd-remote release assets for the supported remote platforms and emits:
|
||||
cmuxd-remote-<goos>-<goarch>
|
||||
cmuxd-remote-checksums.txt
|
||||
cmuxd-remote-manifest.json
|
||||
EOF
|
||||
}
|
||||
|
||||
VERSION=""
|
||||
RELEASE_TAG=""
|
||||
REPO=""
|
||||
OUTPUT_DIR=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--version)
|
||||
VERSION="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--release-tag)
|
||||
RELEASE_TAG="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--repo)
|
||||
REPO="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--output-dir)
|
||||
OUTPUT_DIR="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "error: unknown option $1" >&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$VERSION" || -z "$RELEASE_TAG" || -z "$REPO" || -z "$OUTPUT_DIR" ]]; then
|
||||
echo "error: --version, --release-tag, --repo, and --output-dir are required" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v go >/dev/null 2>&1; then
|
||||
echo "error: go is required to build cmuxd-remote release assets" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
DAEMON_ROOT="${REPO_ROOT}/daemon/remote"
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
rm -f "$OUTPUT_DIR"/cmuxd-remote-* "$OUTPUT_DIR"/cmuxd-remote-checksums.txt "$OUTPUT_DIR"/cmuxd-remote-manifest.json
|
||||
|
||||
RELEASE_URL="https://github.com/${REPO}/releases/download/${RELEASE_TAG}"
|
||||
CHECKSUMS_ASSET_NAME="cmuxd-remote-checksums.txt"
|
||||
CHECKSUMS_PATH="${OUTPUT_DIR}/${CHECKSUMS_ASSET_NAME}"
|
||||
MANIFEST_PATH="${OUTPUT_DIR}/cmuxd-remote-manifest.json"
|
||||
|
||||
TARGETS=(
|
||||
"darwin arm64"
|
||||
"darwin amd64"
|
||||
"linux arm64"
|
||||
"linux amd64"
|
||||
)
|
||||
|
||||
declare -a manifest_entries=()
|
||||
: > "$CHECKSUMS_PATH"
|
||||
|
||||
for target in "${TARGETS[@]}"; do
|
||||
read -r GOOS GOARCH <<<"$target"
|
||||
ASSET_NAME="cmuxd-remote-${GOOS}-${GOARCH}"
|
||||
OUTPUT_PATH="${OUTPUT_DIR}/${ASSET_NAME}"
|
||||
|
||||
(
|
||||
cd "$DAEMON_ROOT"
|
||||
GOOS="$GOOS" \
|
||||
GOARCH="$GOARCH" \
|
||||
CGO_ENABLED=0 \
|
||||
go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" \
|
||||
-o "$OUTPUT_PATH" \
|
||||
./cmd/cmuxd-remote
|
||||
)
|
||||
chmod 755 "$OUTPUT_PATH"
|
||||
|
||||
SHA256="$(shasum -a 256 "$OUTPUT_PATH" | awk '{print $1}')"
|
||||
printf '%s %s\n' "$SHA256" "$ASSET_NAME" >> "$CHECKSUMS_PATH"
|
||||
|
||||
manifest_entries+=("{\"goOS\":\"${GOOS}\",\"goArch\":\"${GOARCH}\",\"assetName\":\"${ASSET_NAME}\",\"downloadURL\":\"${RELEASE_URL}/${ASSET_NAME}\",\"sha256\":\"${SHA256}\"}")
|
||||
done
|
||||
|
||||
ENTRIES_FILE="$(mktemp "${TMPDIR:-/tmp}/cmuxd-remote-entries.XXXXXX")"
|
||||
trap 'rm -f "$ENTRIES_FILE"' EXIT
|
||||
printf '%s\n' "${manifest_entries[@]}" > "$ENTRIES_FILE"
|
||||
ENTRIES_JSON="$(python3 - <<'PY' "$ENTRIES_FILE"
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
entries = [json.loads(line) for line in Path(sys.argv[1]).read_text(encoding="utf-8").splitlines() if line.strip()]
|
||||
print(json.dumps(entries, separators=(",", ":")))
|
||||
PY
|
||||
)"
|
||||
|
||||
python3 - <<'PY' "$VERSION" "$RELEASE_TAG" "$RELEASE_URL" "$CHECKSUMS_ASSET_NAME" "$CHECKSUMS_PATH" "$MANIFEST_PATH" "$ENTRIES_JSON"
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
version, release_tag, release_url, checksums_asset_name, checksums_path, manifest_path, entries_json = sys.argv[1:]
|
||||
checksums_url = f"{release_url}/{checksums_asset_name}"
|
||||
manifest = {
|
||||
"schemaVersion": 1,
|
||||
"appVersion": version,
|
||||
"releaseTag": release_tag,
|
||||
"releaseURL": release_url,
|
||||
"checksumsAssetName": checksums_asset_name,
|
||||
"checksumsURL": checksums_url,
|
||||
"entries": json.loads(entries_json),
|
||||
}
|
||||
Path(manifest_path).write_text(json.dumps(manifest, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
PY
|
||||
|
||||
echo "Built cmuxd-remote assets in ${OUTPUT_DIR}"
|
||||
|
|
@ -3,5 +3,4 @@
|
|||
# Format: <ghostty_sha> <sha256>
|
||||
7dd589824d4c9bda8265355718800cccaf7189a0 3915af4256850a0a7bee671c3ba0a47cbfee5dbfc6d71caf952acefdf2ee4207
|
||||
a50579bd5ddec81c6244b9b349d4bf781f667cec f7e9c0597468a263d6b75eaf815ccecd90c7933f3cf4ae58929569ff23b2666d
|
||||
c47010b80cd9ae6d1ab744c120f011a465521ea3 d6904870a3c920b2787b1c4b950cfdef232606bb9876964f5e8497081d5cb5df
|
||||
0cf5595817794466e3a60abe6bf97f8494dedcfe 1c6ae53ea549740bd45e59fe92714a292fb0d71a41ff915eb6b2e644468152de
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
const IMMUTABLE_RELEASE_ASSETS = [
|
||||
"cmux-macos.dmg",
|
||||
"appcast.xml",
|
||||
"cmuxd-remote-darwin-arm64",
|
||||
"cmuxd-remote-darwin-amd64",
|
||||
"cmuxd-remote-linux-arm64",
|
||||
"cmuxd-remote-linux-amd64",
|
||||
"cmuxd-remote-checksums.txt",
|
||||
"cmuxd-remote-manifest.json",
|
||||
];
|
||||
const IMMUTABLE_RELEASE_ASSETS = ["cmux-macos.dmg", "appcast.xml"];
|
||||
const RELEASE_ASSET_GUARD_STATE = Object.freeze({
|
||||
CLEAR: "clear",
|
||||
PARTIAL: "partial",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const {
|
|||
|
||||
test("marks guard as complete and skips build/upload when all immutable assets already exist", () => {
|
||||
const result = evaluateReleaseAssetGuard({
|
||||
existingAssetNames: [...IMMUTABLE_RELEASE_ASSETS, "notes.txt"],
|
||||
existingAssetNames: ["cmux-macos.dmg", "appcast.xml", "notes.txt"],
|
||||
});
|
||||
|
||||
assert.deepEqual(result.conflicts, IMMUTABLE_RELEASE_ASSETS);
|
||||
|
|
@ -36,16 +36,12 @@ test("marks guard as clear when immutable assets are not present", () => {
|
|||
});
|
||||
|
||||
test("marks guard as partial when only some immutable assets exist", () => {
|
||||
const partialAssets = ["appcast.xml", "cmuxd-remote-manifest.json"];
|
||||
const result = evaluateReleaseAssetGuard({
|
||||
existingAssetNames: partialAssets,
|
||||
existingAssetNames: ["appcast.xml"],
|
||||
});
|
||||
|
||||
assert.deepEqual(result.conflicts, partialAssets);
|
||||
assert.deepEqual(
|
||||
result.missingImmutableAssets,
|
||||
IMMUTABLE_RELEASE_ASSETS.filter((assetName) => !partialAssets.includes(assetName)),
|
||||
);
|
||||
assert.deepEqual(result.conflicts, ["appcast.xml"]);
|
||||
assert.deepEqual(result.missingImmutableAssets, ["cmux-macos.dmg"]);
|
||||
assert.equal(result.guardState, RELEASE_ASSET_GUARD_STATE.PARTIAL);
|
||||
assert.equal(result.hasPartialConflict, true);
|
||||
assert.equal(result.shouldSkipBuildAndUpload, false);
|
||||
|
|
|
|||
|
|
@ -10,85 +10,6 @@ BUNDLE_SET=0
|
|||
DERIVED_SET=0
|
||||
TAG=""
|
||||
CMUX_DEBUG_LOG=""
|
||||
CLI_PATH=""
|
||||
|
||||
write_dev_cli_shim() {
|
||||
local target="$1"
|
||||
local fallback_bin="$2"
|
||||
mkdir -p "$(dirname "$target")"
|
||||
cat > "$target" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
# cmux dev shim (managed by scripts/reload.sh)
|
||||
set -euo pipefail
|
||||
|
||||
CLI_PATH_FILE="/tmp/cmux-last-cli-path"
|
||||
CLI_PATH_OWNER="\$(stat -f '%u' "\$CLI_PATH_FILE" 2>/dev/null || stat -c '%u' "\$CLI_PATH_FILE" 2>/dev/null || echo -1)"
|
||||
if [[ -r "\$CLI_PATH_FILE" ]] && [[ ! -L "\$CLI_PATH_FILE" ]] && [[ "\$CLI_PATH_OWNER" == "\$(id -u)" ]]; then
|
||||
CLI_PATH="\$(cat "\$CLI_PATH_FILE")"
|
||||
if [[ -x "\$CLI_PATH" ]]; then
|
||||
exec "\$CLI_PATH" "\$@"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -x "$fallback_bin" ]]; then
|
||||
exec "$fallback_bin" "\$@"
|
||||
fi
|
||||
|
||||
echo "error: no reload-selected dev cmux CLI found. Run ./scripts/reload.sh --tag <name> first." >&2
|
||||
exit 1
|
||||
EOF
|
||||
chmod +x "$target"
|
||||
}
|
||||
|
||||
select_cmux_shim_target() {
|
||||
local app_cli_dir="/Applications/cmux.app/Contents/Resources/bin"
|
||||
local marker="cmux dev shim (managed by scripts/reload.sh)"
|
||||
local target=""
|
||||
local path_entry=""
|
||||
local candidate=""
|
||||
|
||||
IFS=':' read -r -a path_entries <<< "${PATH:-}"
|
||||
for path_entry in "${path_entries[@]}"; do
|
||||
[[ -z "$path_entry" ]] && continue
|
||||
if [[ "$path_entry" == "~/"* ]]; then
|
||||
path_entry="$HOME/${path_entry#~/}"
|
||||
fi
|
||||
if [[ "$path_entry" == "$app_cli_dir" ]]; then
|
||||
break
|
||||
fi
|
||||
[[ -d "$path_entry" && -w "$path_entry" ]] || continue
|
||||
candidate="$path_entry/cmux"
|
||||
if [[ ! -e "$candidate" ]]; then
|
||||
target="$candidate"
|
||||
break
|
||||
fi
|
||||
if [[ -f "$candidate" ]] && grep -q "$marker" "$candidate" 2>/dev/null; then
|
||||
target="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n "$target" ]]; then
|
||||
echo "$target"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Fallback for PATH layouts where app CLI isn't listed or no earlier entries were writable.
|
||||
for path_entry in /opt/homebrew/bin /usr/local/bin "$HOME/.local/bin" "$HOME/bin"; do
|
||||
[[ -d "$path_entry" && -w "$path_entry" ]] || continue
|
||||
candidate="$path_entry/cmux"
|
||||
if [[ ! -e "$candidate" ]]; then
|
||||
echo "$candidate"
|
||||
return 0
|
||||
fi
|
||||
if [[ -f "$candidate" ]] && grep -q "$marker" "$candidate" 2>/dev/null; then
|
||||
echo "$candidate"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
|
|
@ -358,10 +279,6 @@ if [[ -n "$TAG" && "$APP_NAME" != "$SEARCH_APP_NAME" ]]; then
|
|||
|| /usr/libexec/PlistBuddy -c "Add :LSEnvironment:CMUX_SOCKET_PATH string \"${CMUX_SOCKET}\"" "$INFO_PLIST"
|
||||
/usr/libexec/PlistBuddy -c "Set :LSEnvironment:CMUX_DEBUG_LOG \"${CMUX_DEBUG_LOG}\"" "$INFO_PLIST" 2>/dev/null \
|
||||
|| /usr/libexec/PlistBuddy -c "Add :LSEnvironment:CMUX_DEBUG_LOG string \"${CMUX_DEBUG_LOG}\"" "$INFO_PLIST"
|
||||
/usr/libexec/PlistBuddy -c "Set :LSEnvironment:CMUX_REMOTE_DAEMON_ALLOW_LOCAL_BUILD 1" "$INFO_PLIST" 2>/dev/null \
|
||||
|| /usr/libexec/PlistBuddy -c "Add :LSEnvironment:CMUX_REMOTE_DAEMON_ALLOW_LOCAL_BUILD string 1" "$INFO_PLIST"
|
||||
/usr/libexec/PlistBuddy -c "Set :LSEnvironment:CMUXTERM_REPO_ROOT \"${PWD}\"" "$INFO_PLIST" 2>/dev/null \
|
||||
|| /usr/libexec/PlistBuddy -c "Add :LSEnvironment:CMUXTERM_REPO_ROOT string \"${PWD}\"" "$INFO_PLIST"
|
||||
if [[ -S "$CMUXD_SOCKET" ]]; then
|
||||
for PID in $(lsof -t "$CMUXD_SOCKET" 2>/dev/null); do
|
||||
kill "$PID" 2>/dev/null || true
|
||||
|
|
@ -377,21 +294,6 @@ if [[ -n "$TAG" && "$APP_NAME" != "$SEARCH_APP_NAME" ]]; then
|
|||
APP_PATH="$TAG_APP_PATH"
|
||||
fi
|
||||
|
||||
CLI_PATH="$(dirname "$APP_PATH")/cmux"
|
||||
if [[ -x "$CLI_PATH" ]]; then
|
||||
(umask 077; printf '%s\n' "$CLI_PATH" > /tmp/cmux-last-cli-path) || true
|
||||
ln -sfn "$CLI_PATH" /tmp/cmux-cli || true
|
||||
|
||||
# Stable shim that always follows the last reload-selected dev CLI.
|
||||
DEV_CLI_SHIM="$HOME/.local/bin/cmux-dev"
|
||||
write_dev_cli_shim "$DEV_CLI_SHIM" "/Applications/cmux.app/Contents/Resources/bin/cmux"
|
||||
|
||||
CMUX_SHIM_TARGET="$(select_cmux_shim_target || true)"
|
||||
if [[ -n "${CMUX_SHIM_TARGET:-}" ]]; then
|
||||
write_dev_cli_shim "$CMUX_SHIM_TARGET" "/Applications/cmux.app/Contents/Resources/bin/cmux"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ensure any running instance is fully terminated, regardless of DerivedData path.
|
||||
/usr/bin/osascript -e "tell application id \"${BUNDLE_ID}\" to quit" >/dev/null 2>&1 || true
|
||||
sleep 0.3
|
||||
|
|
@ -423,8 +325,6 @@ fi
|
|||
OPEN_CLEAN_ENV=(
|
||||
env
|
||||
-u CMUX_SOCKET_PATH
|
||||
-u CMUX_WORKSPACE_ID
|
||||
-u CMUX_SURFACE_ID
|
||||
-u CMUX_TAB_ID
|
||||
-u CMUX_PANEL_ID
|
||||
-u CMUXD_UNIX_PATH
|
||||
|
|
@ -445,11 +345,10 @@ OPEN_CLEAN_ENV=(
|
|||
|
||||
if [[ -n "${TAG_SLUG:-}" && -n "${CMUX_SOCKET:-}" ]]; then
|
||||
# Ensure tag-specific socket paths win even if the caller has CMUX_* overrides.
|
||||
"${OPEN_CLEAN_ENV[@]}" CMUX_TAG="$TAG_SLUG" CMUX_SOCKET_PATH="$CMUX_SOCKET" CMUXD_UNIX_PATH="$CMUXD_SOCKET" CMUX_DEBUG_LOG="$CMUX_DEBUG_LOG" CMUX_REMOTE_DAEMON_ALLOW_LOCAL_BUILD=1 CMUXTERM_REPO_ROOT="$PWD" open -g "$APP_PATH"
|
||||
"${OPEN_CLEAN_ENV[@]}" CMUX_TAG="$TAG_SLUG" CMUX_SOCKET_PATH="$CMUX_SOCKET" CMUXD_UNIX_PATH="$CMUXD_SOCKET" CMUX_DEBUG_LOG="$CMUX_DEBUG_LOG" open -g "$APP_PATH"
|
||||
elif [[ -n "${TAG_SLUG:-}" ]]; then
|
||||
"${OPEN_CLEAN_ENV[@]}" CMUX_TAG="$TAG_SLUG" CMUX_DEBUG_LOG="$CMUX_DEBUG_LOG" CMUX_REMOTE_DAEMON_ALLOW_LOCAL_BUILD=1 CMUXTERM_REPO_ROOT="$PWD" open -g "$APP_PATH"
|
||||
"${OPEN_CLEAN_ENV[@]}" CMUX_TAG="$TAG_SLUG" CMUX_DEBUG_LOG="$CMUX_DEBUG_LOG" open -g "$APP_PATH"
|
||||
else
|
||||
echo "/tmp/cmux-debug.sock" > /tmp/cmux-last-socket-path || true
|
||||
echo "/tmp/cmux-debug.log" > /tmp/cmux-last-debug-log-path || true
|
||||
"${OPEN_CLEAN_ENV[@]}" open -g "$APP_PATH"
|
||||
fi
|
||||
|
|
@ -477,16 +376,3 @@ fi
|
|||
if [[ -n "${TAG_SLUG:-}" ]]; then
|
||||
print_tag_cleanup_reminder "$TAG_SLUG"
|
||||
fi
|
||||
|
||||
if [[ -x "${CLI_PATH:-}" ]]; then
|
||||
echo
|
||||
echo "CLI path:"
|
||||
echo " $CLI_PATH"
|
||||
echo "CLI helpers:"
|
||||
echo " /tmp/cmux-cli ..."
|
||||
echo " $HOME/.local/bin/cmux-dev ..."
|
||||
if [[ -n "${CMUX_SHIM_TARGET:-}" ]]; then
|
||||
echo " $CMUX_SHIM_TARGET ..."
|
||||
fi
|
||||
echo "If your shell still resolves the old cmux, run: rehash"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue