From 42472ee024c5de5096965f09c3f618e4f27ebb76 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Wed, 20 May 2026 12:23:04 -0700 Subject: [PATCH] feat(ui): replace Vue/Vite frontend with self-contained static HTML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The UI was previously a Vue 3 SPA served via a Vite dev server on :1420. This had two problems: - Building from source required Node, npm, and the Tauri CLI - Running required starting a Vite dev server alongside the binary Replace with a single self-contained dist/index.html using vanilla JS and the Tauri 2 withGlobalTauri IPC global. No build step, no npm, no dev server — the binary loads the static file directly. Changes: - dist/index.html: full Robin UI (chat, events, debug tabs) in ~750 LOC - Chat tab: streaming LLM responses via robin:chat-token events - Events tab: live matched system events with severity badges - Debug tab: migration config, Ollama status probe, notif level picker - Onboarding form shown on first run (calls complete_onboarding IPC) - All user/LLM text via textContent/DOM construction, no innerHTML - Markdown renderer (fenced code, inline code) built from DOM nodes - tauri.conf.json: add withGlobalTauri: true, remove devUrl and Node hooks - tauri.conf.json: update CSP to allow inline scripts (desktop app) - manage.sh: remove Vite dev server auto-start and kill logic - manage.sh: build/dev now use cargo directly, add bundle command for full .deb/.rpm/.AppImage (still requires Tauri CLI) - .gitignore: track dist/index.html, only ignore dist/assets/ (Vite output) --- .gitignore | 4 +- dist/index.html | 753 ++++++++++++++++++++++++++++++++++++++ manage.sh | 54 ++- src-tauri/tauri.conf.json | 8 +- 4 files changed, 783 insertions(+), 36 deletions(-) create mode 100644 dist/index.html diff --git a/.gitignore b/.gitignore index b2f91ef..a6afdbc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,9 @@ pnpm-debug.log* lerna-debug.log* node_modules -dist +# dist/ was previously generated by Vite; now it holds the static UI (dist/index.html). +# Ignore generated assets but track the hand-crafted index.html. +dist/assets/ dist-ssr *.local diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..f65c76d --- /dev/null +++ b/dist/index.html @@ -0,0 +1,753 @@ + + + + + + Robin + + + +
+
+ +

Robin

+ connecting… + +
+ +
+
🐦
+

Welcome to Robin

+

Set up your migration profile so Robin can give you personalised help.

+
+ + +
+
+ + +
+
+ + +
+ + +
+ + + +
+
+
Robin is watching your system logs. Ask me anything about Linux!
+
+
+
+ + +
+
+ +
+
+ No events yet + +
+
+
+ 📋 + No system events matched yet.
Robin is watching your logs.
+
+
+
+ +
+
+
Migration Profile
+
+
Source OS
+
Distro
+
Distro family
+
Dual bootnone
+
Fluency level0 / 5
+
+
+
+
LLM Config
+
+
Ollama URL
+
Model
+
Connection
+
+
+
+
Notifications
+
+
+ Level + +
+
+
+
+
App Info
+
+
Tierfree
+
Events captured0
+
+
+
+
Profile
+
+
+ +
+
+
+
+
+ + + + diff --git a/manage.sh b/manage.sh index 016111d..b5dc0d3 100755 --- a/manage.sh +++ b/manage.sh @@ -52,8 +52,7 @@ case "$cmd" in start) # Start Robin in the background (daemonised via nohup). - # Also starts the Vite dev server if a release binary is not available - # and Node/nvm is present, so the webview has something to connect to. + # No dev server needed — the webview loads dist/index.html directly. if pgrep -x "$APP_NAME" > /dev/null 2>&1; then echo "Robin is already running (PID $(pgrep -x "$APP_NAME"))" exit 0 @@ -62,21 +61,6 @@ case "$cmd" in export DISPLAY="${DISPLAY:-:0}" export RUST_LOG="${RUST_LOG:-robin_lib=info,warn}" mkdir -p "$(dirname "$LOG_FILE")" - - # If using the debug binary and no Vite server is running, start one. - if [[ "$bin" == *"target/debug"* ]] && ! curl -sf http://localhost:1420 > /dev/null 2>&1; then - NVM_DIR="${NVM_DIR:-$HOME/.nvm}" - if [[ -s "$NVM_DIR/nvm.sh" ]] && command -v npm > /dev/null 2>&1 || { source "$NVM_DIR/nvm.sh" 2>/dev/null && command -v npm > /dev/null 2>&1; }; then - echo "Starting Vite dev server on :1420..." - nohup npm --prefix "$SCRIPT_DIR" run dev >> /tmp/robin-vite.log 2>&1 & - echo "Vite PID $! — logs: /tmp/robin-vite.log" - sleep 2 # give Vite time to bind before Robin connects - else - echo "Note: no release binary and Node not found — webview will show connection error." - echo "Run 'npm install && npm run dev' in $SCRIPT_DIR to fix this." - fi - fi - nohup "$bin" >> "$LOG_FILE" 2>&1 & echo "Robin started (PID $!). Logs: $LOG_FILE" ;; @@ -88,11 +72,6 @@ case "$cmd" in else echo "Robin is not running." fi - # Stop Vite dev server if we started it. - if pgrep -f "vite" > /dev/null 2>&1; then - pkill -f "node.*vite" 2>/dev/null || true - echo "Vite dev server stopped." - fi ;; restart) @@ -119,15 +98,27 @@ case "$cmd" in ;; dev) - echo "Starting Robin in dev mode (hot-reload)..." - cd "$SCRIPT_DIR" - npm run tauri dev + # Dev mode: build debug binary and run it directly. + # The webview loads dist/index.html from the build artefact path — + # no npm or Vite server required. + echo "Building and running Robin in dev mode..." + cargo build --manifest-path "$SCRIPT_DIR/src-tauri/Cargo.toml" + export DISPLAY="${DISPLAY:-:0}" + export RUST_LOG="${RUST_LOG:-robin_lib=debug,warn}" + exec "$DEBUG_BIN" ;; build) - echo "Building Robin release binary + installers..." + echo "Building Robin release binary..." + cargo build --release --manifest-path "$SCRIPT_DIR/src-tauri/Cargo.toml" + echo "Binary: $RELEASE_BIN" + ;; + + bundle) + # Full release bundle (.deb/.rpm/.AppImage) — requires Tauri CLI (npm install -g @tauri-apps/cli) + echo "Building Robin release bundle (deb/rpm/AppImage)..." cd "$SCRIPT_DIR" - npm run tauri build + cargo tauri build ;; build-debug) @@ -258,7 +249,7 @@ Usage: ./manage.sh Running: run Run in foreground (logs to terminal, Ctrl+C to quit) - start Start in background + start Start in background (no dev server needed) stop Stop background instance restart Stop then start status Show whether Robin is running @@ -266,8 +257,9 @@ Running: Building: build-debug Build debug binary (Rust only, no Node/npm needed) - build Build release binary + .deb/.rpm/.AppImage (needs Node + Tauri CLI) - dev Start dev mode with hot-reload (needs Node + Tauri CLI) + build Build release binary (Rust only) + bundle Build release bundle (.deb/.rpm/.AppImage) — requires Tauri CLI + dev Build debug binary and run it immediately test Run Rust unit tests Installation: @@ -281,6 +273,8 @@ Installation: Dependencies: install-deps Install system deps (Debian/Ubuntu/Mint) install-deps-arch Install system deps (Arch/Manjaro/CachyOS) + +Note: No Node.js or npm required. The UI is a static HTML file bundled with the binary. EOF ;; esac diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 547f6e5..f016737 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -4,12 +4,10 @@ "version": "0.1.0", "identifier": "tech.circuitforge.robin", "build": { - "frontendDist": "../dist", - "devUrl": "http://localhost:1420", - "beforeDevCommand": "npm run dev", - "beforeBuildCommand": "npm run build" + "frontendDist": "../dist" }, "app": { + "withGlobalTauri": true, "windows": [ { "label": "chat", @@ -32,7 +30,7 @@ "tooltip": "Robin" }, "security": { - "csp": "default-src 'self'; connect-src http://localhost:* ipc: asset:" + "csp": "default-src 'self' tauri: asset: ipc:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; connect-src ipc: http://ipc.localhost asset: http://localhost:*" } }, "bundle": {