Skip to content

feat(electron): Electron wrapper for vuhitracode-web app#44

Merged
A-Souhei merged 8 commits intomainfrom
feat/electron-wrapper
Mar 14, 2026
Merged

feat(electron): Electron wrapper for vuhitracode-web app#44
A-Souhei merged 8 commits intomainfrom
feat/electron-wrapper

Conversation

@A-Souhei
Copy link
Owner

Summary

  • Adds a standalone Electron wrapper under packages/electron/ that loads the web app served by vuhitracode-web at http://localhost:4444
  • Adds scripts/vuhitracode-electron.sh — a single-command launcher that starts the backend, web server, and Electron window
  • Adds make install-electron target to install the launcher binary to ~/.local/bin/vuhitracode-electron

Usage

make install-electron
vuhitracode-electron            # foreground
vuhitracode-electron --detach   # background, window appears immediately
vuhitracode-electron stop       # kill detached stack

Notes

  • No existing code was modified except Makefile (new target added) and scripts/ (new script added)
  • Electron binary is auto-downloaded on first run via node install.js (bun skips post-install scripts)
  • --no-sandbox is passed on Linux to avoid the chrome-sandbox SUID requirement

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to start/stop the stack and launch Electron (foreground or detached).
  • Adds a make install-electron target 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
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"
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
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"

wait_ready || { kill 0; exit 1; }

echo "Launching Electron ..."
(cd "$ELECTRONDIR" && "$electron" . --no-sandbox)
@A-Souhei A-Souhei merged commit 111c504 into main Mar 14, 2026
2 checks passed
@A-Souhei A-Souhei deleted the feat/electron-wrapper branch March 14, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants