feat(electron): Electron wrapper for vuhitracode-web app#44
Merged
Conversation
…sed, drop broken install_self
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an Electron-based desktop wrapper for the OpenCode web UI, plus a launcher workflow to start the local backend + web dev server and then open the UI in Electron.
Changes:
- Introduces
packages/electron/(Electron main + preload, build config, docs). - Adds
scripts/vuhitracode-electron.shto start/stop the stack and launch Electron (foreground or detached). - Adds a
make install-electrontarget to install the launcher into~/.local/bin.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/vuhitracode-electron.sh | New launcher script to run backend/web + Electron and manage stop/detach |
| packages/electron/package.json | New Electron package definition + build configuration |
| packages/electron/src/main.js | Electron main process that loads http://localhost:4444 |
| packages/electron/src/preload.js | Empty preload placeholder for future native integrations |
| packages/electron/tsconfig.json | Typecheck configuration for the Electron package |
| packages/electron/README.md | Usage and packaging documentation for the Electron wrapper |
| Makefile | Adds install-electron target to install the launcher script |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+41
to
+45
| | File | Role | | ||
| | ---------------- | -------------------------------------------------------------------- | | ||
| | `src/main.js` | Electron main process — creates the BrowserWindow and loads the URL | | ||
| | `src/preload.js` | Secure preload script — intentionally minimal (no Node APIs exposed) | | ||
|
|
Comment on lines
+50
to
+59
| win.loadURL(URL).catch(() => showError(win)) | ||
|
|
||
| win.webContents.on("did-fail-load", (_event, errorCode) => { | ||
| if (errorCode === -102 || errorCode === -6 || errorCode === -7) showError(win) | ||
| }) | ||
|
|
||
| win.webContents.setWindowOpenHandler(({ url }) => { | ||
| if (url.startsWith("https://") || url.startsWith("http://")) shell.openExternal(url) | ||
| return { action: "deny" } | ||
| }) |
Comment on lines
+67
to
+69
| echo "Downloading Electron binary ..." | ||
| node "$ELECTRONDIR/node_modules/electron/install.js" | ||
| fi |
scripts/vuhitracode-electron.sh
Outdated
| wait_ready || { kill 0; exit 1; } | ||
|
|
||
| echo "Launching Electron ..." | ||
| (cd "$ELECTRONDIR" && "$electron" . --no-sandbox) & |
Comment on lines
+82
to
+84
| echo "Launching Electron ..." | ||
| (cd "$ELECTRONDIR" && "$electron" . --no-sandbox) & | ||
| echo $! >> "$PIDFILE" |
scripts/vuhitracode-electron.sh
Outdated
| start() { | ||
| for dir in "$PKGDIR" "$WEBDIR" "$ELECTRONDIR"; do | ||
| if [ ! -d "$dir" ]; then | ||
| echo "Error: directory not found: $dir — re-run --install" >&2 |
| PIDFILE="${TMPDIR:-/tmp}/vuhitracode-electron.pid" | ||
|
|
||
| wait_ready() { | ||
| local tries=0 |
scripts/vuhitracode-electron.sh
Outdated
| fi | ||
| # bun does not run post-install scripts by default; ensure the electron binary is downloaded | ||
| local dist | ||
| dist="$(readlink -f "$ELECTRONDIR/node_modules/electron")/dist/electron" |
Comment on lines
+71
to
+79
| if [ "$detach" = "1" ]; then | ||
| echo "Starting backend on :4096 and web on :4444 (detached) ..." | ||
| "$BUN" run --cwd "$PKGDIR" --conditions=browser src/index.ts serve --port 4096 \ | ||
| >> "$LOGFILE" 2>&1 & | ||
| echo $! >> "$PIDFILE" | ||
| "$BUN" --cwd "$WEBDIR" dev -- --port 4444 \ | ||
| >> "$LOGFILE" 2>&1 & | ||
| echo $! >> "$PIDFILE" | ||
|
|
scripts/vuhitracode-electron.sh
Outdated
| wait_ready || { kill 0; exit 1; } | ||
|
|
||
| echo "Launching Electron ..." | ||
| (cd "$ELECTRONDIR" && "$electron" . --no-sandbox) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/electron/that loads the web app served byvuhitracode-webathttp://localhost:4444scripts/vuhitracode-electron.sh— a single-command launcher that starts the backend, web server, and Electron windowmake install-electrontarget to install the launcher binary to~/.local/bin/vuhitracode-electronUsage
Notes
Makefile(new target added) andscripts/(new script added)node install.js(bun skips post-install scripts)--no-sandboxis passed on Linux to avoid thechrome-sandboxSUID requirement