refactor(management): replace curses TUIs with API-backed ncp subcommands; panel/autostart/install integration

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jon
2026-07-11 07:25:08 -05:00
parent f4f77c5196
commit 53eaed4c7f
792 changed files with 2782 additions and 2240 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Launch NexusOS services and open the UI as a standalone Edge app window.
# Closing the app window shuts the services back down (matches the launcher's
# "closing the window shuts it down" promise).
NEXUS_ROOT="$(cd "$(dirname "$(realpath "$0")")/.." && pwd)"
EDGE_PROFILE="$HOME/.config/nexus-edge"
# If the app is already open, just raise another window in the existing
# instance and leave the services alone — this launch doesn't own them.
if pgrep -f "user-data-dir=$EDGE_PROFILE" >/dev/null 2>&1; then
exec microsoft-edge-stable --user-data-dir="$EDGE_PROFILE" \
--app=http://localhost:5173
fi
# Own the services (and stop them on exit) only if WE start them. If the stack
# is already up — started elsewhere (ncp start, the control panel) — this launch
# is just a viewer and must not tear down someone else's services on close.
# Backend on :8000 is the sentinel for "stack already running".
if curl -s --max-time 1 http://localhost:8000/ >/dev/null 2>&1; then
OWN_SERVICES=0
else
OWN_SERVICES=1
fi
"$NEXUS_ROOT/management/nexus-cli.sh" start
# Shut the services back down whenever this script ends — whether Edge exits
# normally (window closed) or the script is itself terminated (SIGTERM/SIGHUP
# from the session/WM). A plain trailing line only covers the clean exit; an
# EXIT trap covers every path out. Only armed when we started the stack.
[ "$OWN_SERVICES" = 1 ] && trap '"$NEXUS_ROOT/management/nexus-cli.sh" stop' EXIT
# Run the app in its OWN Edge profile (--user-data-dir). Without this, the
# --class=NexusOS window becomes the Chromium "singleton owner" of the
# default profile, so every later browser window — a clicked link, or even
# normal browsing — attaches to it and inherits WM_CLASS=NexusOS. A separate
# profile makes this a distinct instance: only the app window is NexusOS-class;
# regular browsing (default profile) stays its own class, and external links
# clicked in the app open in the default browser.
#
# This invocation owns the dedicated profile's Chromium instance and runs in
# the FOREGROUND, blocking here until the app window is closed. --disable-background-mode
# is essential: without it Edge keeps a background process alive after the last
# window closes, so this call never returns and the services are never stopped.
microsoft-edge-stable \
--user-data-dir="$EDGE_PROFILE" \
--no-first-run \
--no-default-browser-check \
--disable-background-mode \
--class=NexusOS \
--app=http://localhost:5173