Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

2.6 KB
Raw Blame
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
TMP="$(mktemp -d)";trap 'find "$TMP" -type f -o -type l | xargs -r rm -f; find "$TMP" -depth -type d -empty -delete 2>/dev/null||true' EXIT
SRC="$TMP/worktrees/sc-flow-merge-main";mkdir -p "$SRC/bin"
printf '%s' '{"name":"si-coder-agent","version":"0.9.8","bin":{"sc":"bin/sc-entry.js"}}' >"$SRC/package.json"
chmod 600 "$SRC/package.json"
FAKE="$SRC/bin/sc-entry.js";LINK="$TMP/sc";LOG="$TMP/log";:>"$LOG"
cat >"$FAKE" <<'SC'
#!/usr/bin/env bash
set -euo pipefail
if [ "${1-}" = version ];then printf '{"version":"0.9.8","source":"%s"}' "$FAKE_SC_SOURCE";exit;fi
if [ "${1-}" = data ]&&[ "${2-}" = export ];then
  out='';shift 2
  while [ $# -gt 0 ];do case "$1" in --out)out="$2";shift 2;;*)exit 9;;esac;done
  cat >"$out" <<'JSON'
{"format":"integration-bundle","version":1,"producer":{"name":"si-coder","version":"test"},"exportedAt":"2026-09-05T00:00:00Z","mode":"metadata","users":[{"id":"alice","label":"Alice","connections":[{"id":"work","label":"Work","provider":"github","source":"direct","authMethod":"classic-pat","scope":"account","fields":[{"key":"GITHUB_TOKEN","secret":true,"configured":true}]}]}]}
JSON
  chmod 600 "$out";printf '%s' '{"ok":true}';exit
fi
exit 8
SC
chmod +x "$FAKE";ln -s "$FAKE" "$LINK"
# `chmod +x` yields 0775 under a group-writable umask (0002 on some hosts), and
# sc-installation.mjs rightly refuses a group-writable binary. The fixture must be
# an owner-private install like a real one, not a reflection of the invoking shell.
chmod 755 "$FAKE"
export MSO_SC_BIN="$LINK" FAKE_SC_SOURCE="$SRC"
die(){ printf '%s\n' "$*" >&2;exit 2; }
tty_ok(){ return 1; }
tty_line(){ REPLY=n; }
jpost(){ local route="$1" body="$2";printf '%s\t%s\n' "$route" "$body">>"$LOG";if jq -e '.apply==true' >/dev/null<<<"$body";then printf '%s' '{"producer":"si-coder","createUsers":[{"id":"alice","label":"Alice"}],"connections":[{"user":"alice","provider":"github","connection":"work","status":"create"}],"warnings":[],"canApply":true,"planId":"PLAN","created":1,"applied":true}';else printf '%s' '{"producer":"si-coder","createUsers":[{"id":"alice","label":"Alice"}],"connections":[{"user":"alice","provider":"github","connection":"work","status":"create"}],"warnings":[],"canApply":true,"planId":"PLAN"}';fi; }
source "$ROOT/scripts/mso-cli-integrations-sc.sh"
case "${1-}" in
 probe) integration_sc_probe;;
 spoof) printf '%s' '{"name":"si-coder-agent","version":"0.9.8","bin":{"sc":"bin/other.js"}}' >"$SRC/package.json";printf '%s' '// unrelated synthetic entrypoint' >"$SRC/bin/other.js";integration_sc_probe;;
 preview) integration_sc_preview;;
 *) exit 4;;
esac