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.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(install): preserve caller path semantics
Rahman076eb3c41bee
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex af0316f1..fbfc7961 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `install` preserve caller path semantics- `install` prove stable-id service takeover- `install` keep security hint literal- `install` make WSL CLI setup reliablediff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 937e12cd..ffa4139f 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -17,13 +17,17 @@ already-reachable system bin directory when possible. It checks the original invthan its child-process PATH and prints an exact fallback export when immediate discovery cannot beproven. WSL without systemd remains a supported CLI-only shape; background service/onboarding waitsfor a verified service. An isolated clean-HOME/PATH install proved the child installer returns to a-parent shell where `command -v mso` and `mso -h` succeed.+parent shell where `command -v mso` and `mso -h` succeed. The invoking cwd is captured too: relative+PATH entries such as `bin` are normalized against that cwd before discoverability is claimed, so a+later `cd` into the checkout cannot manufacture a false positive.The service readiness gate was also corrected for explicit `NEXT_DEPLOYMENT_ID`. Build ID change isstill the preferred takeover proof, but a deliberately stable deployment ID can no longer make ahealthy restart look stale: the installer records the pre-restart systemd MainPID and accepts ahealthy response from a changed live MainPID as the fallback proof. This keeps the old-process/stale--chunk defense without assuming every deployment changes its public build ID.+chunk defense without assuming every deployment changes its public build ID. Runtime reporting also+distinguishes “WSL without systemd” from “systemd existed, the unit was attempted, but health/takeover+verification failed,” so a failed WSL service keeps its journal recovery path instead of being mislabeled.OpenSSF's remaining Fuzzing posture gap is addressed with real TypeScript property testing ratherthan a dismissed alert. `fast-check` now generates adversarial cases for filesystem containment,diff --git a/lib/install-contract.test.ts b/lib/install-contract.test.tsindex 0c7192c2..fdb3cc0a 100644--- a/lib/install-contract.test.ts+++ b/lib/install-contract.test.ts@@ -26,8 +26,11 @@ describe("one-line installer contract", () => {const src = fs.readFileSync(INSTALL, "utf8");expect(src.indexOf("# ---- CLI on PATH")).toBeLessThan(src.indexOf("# ---- systemd unit ----"));expect(src).toContain('PARENT_PATH="${PATH:-}"');+ expect(src).toContain('PARENT_CWD="$PWD"');+ expect(src).toContain('normalize_parent_path()');+ expect(src).toContain('PARENT_PATH_RESOLVED="$(normalize_parent_path "$PARENT_PATH" "$PARENT_CWD")"');expect(src).toContain('SYSTEM_BIN_DIR="${MSO_SYSTEM_BIN_DIR:-/usr/local/bin}"');- expect(src).toContain('PATH="$PARENT_PATH" command -v mso');+ expect(src).toContain('PATH="$PARENT_PATH_RESOLVED" command -v mso');expect(src).toContain('"$BIN_DIR/mso" -h');expect(src).toContain("# >>> mso cli >>>");expect(src).toContain('export PATH="$BIN_DIR:$PATH"');@@ -40,6 +43,9 @@ describe("one-line installer contract", () => {expect(src).toContain('= "systemd"');expect(src).toContain("WSL detected without systemd as PID 1");expect(src).toContain("SERVICE_READY=1");+ expect(src).toContain("SERVICE_ATTEMPTED=1");+ expect(src).toContain('elif [ "$SERVICE_ATTEMPTED" -eq 1 ]; then');+ expect(src.indexOf('elif [ "$SERVICE_ATTEMPTED" -eq 1 ]; then')).toBeLessThan(src.indexOf('elif is_wsl; then'));expect(src).toContain('systemctl show "$SERVICE" -p MainPID --value');expect(src).toContain('[ "$now_pid" -gt 0 ] && [ "$now_pid" != "$prev_pid" ]');expect(src).toContain('[ "$RUN_ONBOARD" -eq 1 ] && [ "$SERVICE_READY" -eq 1 ]');diff --git a/scripts/install.sh b/scripts/install.shindex 7a39b4c2..a477df53 100755--- a/scripts/install.sh+++ b/scripts/install.sh@@ -41,7 +41,9 @@ export BUN_INSTALL="${BUN_INSTALL:-$HOME/.bun}"# curl|bash process cannot export back into its parent, so this is the only PATH# that matters when proving `mso -h` will resolve immediately after we return.PARENT_PATH="${PATH:-}"+PARENT_CWD="$PWD"SERVICE_READY=0+SERVICE_ATTEMPTED=0# Reproducible bootstrap: this is Bun v1.3.14's installer source, pinned by# immutable Git commit and verified before execution. Update both values together.BUN_BOOTSTRAP_COMMIT="0d9b296af33f2b851fcbf4df3e9ec89751734ba4"@@ -111,6 +113,27 @@ path_has_dir() {case ":$1:" in *":$2:"*) return 0 ;; *) return 1 ;; esac}+# PATH entries are resolved by the caller relative to the caller's cwd. The+# installer later cd's into the checkout, so replaying a raw relative PATH there+# would prove the wrong shell. Convert each entry to the directory the parent+# shell will actually search after this child returns. Empty entries mean cwd.+normalize_parent_path() {+ local raw="$1" cwd="$2" out="" entry last=0+ while [ "$last" -eq 0 ]; do+ case "$raw" in+ *:*) entry="${raw%%:*}"; raw="${raw#*:}" ;;+ *) entry="$raw"; raw=""; last=1 ;;+ esac+ case "$entry" in+ "") entry="$cwd" ;;+ /*) ;;+ *) entry="$cwd/$entry" ;;+ esac+ if [ -n "$out" ]; then out="$out:$entry"; else out="$entry"; fi+ done+ printf '%s' "$out"+}+# Create/update one CLI symlink without ever replacing an unrelated command.# Returns nonzero when the destination is unavailable; callers decide whether that# is fatal (the user-local launcher is) or only affects current-shell discovery.@@ -347,17 +370,19 @@ fi# directory was already there, nothing else is needed. Otherwise use a guarded# launcher in /usr/local/bin (or MSO_SYSTEM_BIN_DIR) only when that directory is# already on the invoking PATH. This also makes `--no-service` useful on WSL.+PARENT_PATH_RESOLVED="$(normalize_parent_path "$PARENT_PATH" "$PARENT_CWD")"SYSTEM_BIN_DIR="${MSO_SYSTEM_BIN_DIR:-/usr/local/bin}"+case "$SYSTEM_BIN_DIR" in /*) ;; *) SYSTEM_BIN_DIR="$PARENT_CWD/$SYSTEM_BIN_DIR" ;; esacSYSTEM_CLI="$SYSTEM_BIN_DIR/mso"TARGET_CLI_REAL="$(readlink -f "$DIR/bin/mso")"CLI_IMMEDIATE=0-parent_cli="$(PATH="$PARENT_PATH" command -v mso 2>/dev/null || true)"+parent_cli="$(PATH="$PARENT_PATH_RESOLVED" command -v mso 2>/dev/null || true)"if [ -n "$parent_cli" ] && [ "$(readlink -f "$parent_cli" 2>/dev/null || true)" = "$TARGET_CLI_REAL" ]; thenCLI_IMMEDIATE=1-elif path_has_dir "$PARENT_PATH" "$SYSTEM_BIN_DIR"; then+elif path_has_dir "$PARENT_PATH_RESOLVED" "$SYSTEM_BIN_DIR"; thenif link_cli_guarded "$SYSTEM_CLI" "$DIR/bin/mso"; thenok "current-PATH cli → $SYSTEM_CLI"- parent_cli="$(PATH="$PARENT_PATH" command -v mso 2>/dev/null || true)"+ parent_cli="$(PATH="$PARENT_PATH_RESOLVED" command -v mso 2>/dev/null || true)"if [ -n "$parent_cli" ] && [ "$(readlink -f "$parent_cli" 2>/dev/null || true)" = "$TARGET_CLI_REAL" ]; thenCLI_IMMEDIATE=1fi@@ -383,6 +408,7 @@ fi# ---- systemd unit ----if [ "$DO_SERVICE" -eq 1 ] && systemd_ready; then+ SERVICE_ATTEMPTED=1# Start via npm (always on PATH, ships with node) to match the proven prod unit;# PORT/HOSTNAME are set as env too so `next start` binds correctly regardless.NPM_BIN="$(command -v npm)"@@ -564,12 +590,15 @@ if [ "$SERVICE_READY" -eq 1 ]; thenelif [ "$DO_SERVICE" -eq 0 ]; thenOPEN_STATUS="not running (--no-service). Start manually: cd $DIR && PORT=$PORT bun run start"LOG_STATUS="no system service installed"+elif [ "$SERVICE_ATTEMPTED" -eq 1 ]; then+ OPEN_STATUS="service was installed/restarted but did not pass health verification; inspect the journal before opening the UI"+ LOG_STATUS="journalctl -u mso -e"elif is_wsl; thenOPEN_STATUS="not running (WSL systemd is unavailable). Enable systemd or start manually from $DIR"LOG_STATUS="no system service installed"else- OPEN_STATUS="service did not pass health verification; inspect the service journal before opening the UI"- LOG_STATUS="journalctl -u mso -e"+ OPEN_STATUS="systemd is unavailable; start manually from $DIR"+ LOG_STATUS="no system service installed"fiok "mso installed at $DIR"