OpenCLIApp should auto-start the Browser Bridge daemon on launch
- Dominant language
- JavaScript
- Stars
- 29.3k
- Forks
- 2.9k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 70
Description
## Description
OpenCLIApp v0.1.31 on Windows does not auto-start the Browser Bridge daemon (port 19825) when the app launches, even though the app itself auto-starts with Windows via the registry Run key.
After every cold boot, `opencli doctor` or the app's built-in diagnostic reports:
- `OpenCLI daemon running: false`
- `BrowserBridge last error: OpenCLI daemon not reachable on 127.0.0.1:19825: connection timed out`
- `Extension connected: false`
- `Profiles connected: 0`
The internal API server on port 19826 starts fine (the app works), but the daemon on port 19825 does not start until a browser command triggers `BrowserBridge._ensureDaemon()` lazily.
## Expected behavior
When OpenCLIApp starts, it should also start the Browser Bridge daemon on port 19825 so that:
1. The diagnostic report from the app shows green immediately
2. The browser extension can connect as soon as Chrome starts
3. Users don't need to run a browser command first to "warm up" the connection
## Technical context
- The app starts via `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` → `opencli-app.exe`
- The daemon spawn logic already exists in `dist/src/browser/daemon-lifecycle.js` (`spawnDaemonProcess()`)
- `BrowserBridge.connect()` → `_ensureDaemon()` in `dist/src/browser/bridge.js` handles daemon lifecycle, but this path is only triggered on the first CLI browser command, not at app launch
- The daemon startup log lives at `~/.opencli/daemon-startup.log` (currently empty / unused at app level)
## Suggested fix
Call `spawnDaemonProcess()` (from `daemon-lifecycle.js`) or equivalent during the OpenCLIApp's main initialization, after the internal API server is ready. A simple `opencli daemon restart` equivalent at app startup would resolve the issue.
## Environment
- OpenCLIApp: v0.1.31
- opencli (npm): v1.8.4
- OS: Windows 10
- Chrome: 149.0.7827.156
Contributor guide
Research direction
Read dist/src/browser/daemon-lifecycle.js and dist/src/browser/bridge.js, then trace the OpenCLIApp initialization after the internal API server is ready. Reproduce with opencli doctor after a cold Windows boot and inspect ~/.opencli/daemon-startup.log. Done means the daemon is running at launch and diagnostics no longer require a browser command to report it as reachable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100