| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
| description | How to turn a new Electron desktop app into an OpenCLI adapter |
|---|
This guide is the fast entry point for turning a new Electron desktop application into an OpenCLI adapter.
If you want the full background and deeper SOP, read:
Use this workflow when the target app:
If the app is not Electron and does not expose CDP, use the native desktop automation pattern instead. See CLI-ifying Electron Applications.
Typical macOS check:
ls /Applications/AppName.app/Contents/Frameworks/Electron\ Framework.frameworkIf Electron is present, the next step is usually to launch the app with a debugging port.
/Applications/AppName.app/Contents/MacOS/AppName --remote-debugging-port=9222Then point OpenCLI at that CDP endpoint:
export OPENCLI_CDP_ENDPOINT="http://127.0.0.1:9222"For a new Electron adapter, implement these commands first in src/clis/<app>/:
This is the standard baseline because it gives you:
The full rationale and examples are in CLI-ifying Electron Applications.
Goal: prove CDP connectivity before touching app-specific logic.
Typical checks:
If status is unstable, stop there and fix connectivity first.
Do not guess selectors from the rendered UI.
Dump:
Use the dump to identify real containers, buttons, composers, and conversation regions.
Target only the app region that matters.
Good targets:
Avoid dumping the entire page text into the final command output.
Most Electron apps use React-style controlled editors, so direct .value = ... assignments are often ignored.
Prefer editor-aware input patterns such as:
Many desktop apps rely on keyboard shortcuts for “new chat”, “new tab”, or “new note”.
Typical pattern:
const isMac = process.platform === 'darwin';
await page.pressKey(isMac ? 'Meta+N' : 'Control+N');
await page.wait(1);For a TypeScript desktop adapter, the usual layout is:
src/clis/<app>/status.ts
src/clis/<app>/dump.ts
src/clis/<app>/read.ts
src/clis/<app>/send.ts
src/clis/<app>/new.ts
src/clis/<app>/utils.ts
If the app grows beyond the baseline, add higher-level commands such as:
When the adapter is ready, also add:
Examples to study:
Usually one of these:
Some desktop apps embed Chromium but do not expose a usable CDP surface. In that case, switch to the non-Electron desktop automation approach instead of forcing the Electron pattern.
If the app exposes a normal web URL and the browser flow is enough, a browser adapter is usually simpler. Use an Electron adapter only when the desktop app is the real integration surface.
If you are starting from zero:
Do not start with a large feature surface.
Start with:
Once those are stable, extend outward.
| Back | FazBrowse Home | New Git URL |