# Turn Linear Issues Into Pull Requests for an Electron App

Yes. Label an issue and the agent reads it, changes the main, preload and renderer code it names, runs lint, tsc, Jest and the smoke test, and opens a linked PR.

[Run this on Rush](https://cloud.getrush.ai/run/linear-issue-to-pr/electron/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The run starts with the issue in front of the agent: the Linear issue URL in `resources` puts its title, description and comments into the prompt through your Linear connection, and it reads the app before it writes a line. In an app built from electron-react-boilerplate/electron-react-boilerplate, `package.json` runs on Node 24 and npm 10, builds with `electron-vite build`, starts with `electron-vite dev --watch`, packages with `electron-builder build --publish never`, tests with `jest` and runs a smoke test through `.erb/scripts/smoke-test.cjs`. `electron.vite.config.ts` has three targets: `main` from `src/main/main.ts` to `release/app/dist/main/main.js`, `preload` from `src/main/preload.ts`, and the `renderer` rooted at `src/renderer` with the React and SVGR plugins on port 1212. Native modules are listed in `release/app/package.json` and externalized; the app depends on React 19, `react-router-dom` 7, `electron-log` and `electron-updater`, with Electron 44 as a dev dependency.

It then reads the three processes the issue may touch. `src/main/main.ts` creates the `BrowserWindow` with `preload.js` from the preload output directory, builds the menu through `MenuBuilder` in `menu.ts`, opens external links in the system browser with `setWindowOpenHandler`, starts `electron-updater` from `updates.ts` after the window is ready, and already answers one IPC channel, `ipc-example`, with `ipcMain.on`. `src/main/preload.ts` exposes `window.electron.ipcRenderer` through `contextBridge` with `sendMessage`, `on` and `once` typed over a `Channels` union that lists that single channel, and `src/renderer/preload.d.ts` types the global. `src/renderer/App.tsx` is a `MemoryRouter` with one route. `src/__tests__/App.test.tsx` renders `App` with Testing Library and checks the heading and the two links, and `jest.config.js` runs `ts-jest` from the isolated toolchain in `.erb/tooling` under `jsdom`, with `check-build-exists.ts` as a setup file.

The agent does what the issue describes in the places that layout dictates. A feature that needs the operating system, say reading a file or showing a native dialog, gets a handler in the main process, a new entry in the `Channels` union and a typed function in `preload.ts`, and a renderer component that calls it; a renderer-only change touches `App.tsx` and a new component under `src/renderer/`; a menu item goes into `menu.ts`. It writes a Jest test beside `App.test.tsx` for the renderer side, with the preload bridge mocked on `window.electron`, and keeps the issue's wording for labels and copy. If the issue's description does not say enough, it asks on the issue and stops.

Before opening the pull request it runs what `.github/workflows/test.yml` runs on three operating systems: `npm ci`, which also runs `npm --prefix .erb/tooling ci` and `install-electron` through `postinstall`, then `npm run package`, `npm run lint`, `npm exec tsc -- --noEmit` and `npm test`. On Linux the workflow verifies startup with `xvfb-run --auto-servernum npm run test:smoke`, and the agent installs `xvfb` in the sandbox to do the same: the smoke test starts the app with a remote debugging port, connects, and fails if the window never appears. A test or type error is fixed before the pull request opens; a failure the agent cannot fix ends the run `needs_review` with the output quoted.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Do the work this Linear issue describes in this Electron app and open a pull request that links back to it. Read package.json, electron.vite.config.ts, jest.config.js, src/main/main.ts, src/main/preload.ts, src/main/menu.ts, src/renderer/App.tsx, src/renderer/preload.d.ts and src/__tests__/App.test.tsx first. Put operating-system work in the main process behind a typed IPC channel added to the Channels union in preload.ts, renderer work under src/renderer, and menu changes in menu.ts. Add a Jest test for the renderer side with the preload bridge mocked. Run npm ci, npm run package, npm run lint, npm exec tsc -- --noEmit and npm test, then install xvfb and run xvfb-run --auto-servernum npm run test:smoke. Fix what fails. If the issue does not say enough to decide what to build, ask on the issue and stop. Change nothing unrelated.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    },
    {
      "url": "https://linear.app/your-org/issue/ENG-123"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch whose description opens with the issue key and link, says which process each change lives in, and quotes the lint, type check, Jest and smoke test output. A feature that crossed the bridge shows as a matched trio: a handler in `src/main/`, a channel and function in `src/main/preload.ts`, and a component plus test under `src/renderer/` and `src/__tests__/`. The repository's own `test.yml` then runs the same commands on macOS, Windows and Linux.

The session keeps the record: the issue text it read, every file it opened, each `npm` command with its full output, and the smoke test's log from the virtual display. `GET /o/{org}/sessions/{id}/messages` returns that transcript, and `GET /o/{org}/p/{project}/sessions/{id}/changes` returns the diff per file.

Before merging, a reviewer checks the two things a Linux sandbox cannot: that a native dialog or file path behaves on macOS and Windows, which the workflow's matrix exercises only as far as startup, and that any new IPC channel validates what the renderer sends, since `contextBridge` exposes the function to page code. A follow-up message to the same session, or a comment on the issue, continues on the same branch.

## Run it on every Linear issue labelled agent

Create an automation in the Project for this repository with this prompt and a `linear` trigger on `linear.issue.labeled`, with the hand-off label in `config.labels` and your team keys in `config.teams`. Each labelled issue starts one run with the issue as its context on its own branch; a label added by an app integration never fires it. Leave the example issue URL out of the automation's prompt, since the trigger supplies the issue.

For a two-step flow, add a `linear.issue.state_changed` trigger whose `config.states` maps a review state to `plan` and a later state to `exec`. The `plan` run reads the main, preload and renderer files the issue touches, changes nothing and posts its plan as a comment on the issue, naming the IPC channel it would add; the `exec` run opens the pull request once someone has read it.

## Why run it on Rush?

An Electron change is rarely one file: the feature lands in the main process, crosses the preload bridge with a typed channel, and shows up in React, and the check that catches a missing piece is the packager and the smoke test, not the unit tests. In a Rush sandbox the agent runs `npm run package`, `tsc`, Jest and the smoke test under `xvfb` the way the repository's Linux job does, so the pull request arrives with the app known to start.

The pull request carries its proof: the command output and the transcript of every file read and edited, linked from the issue. Several issues can be worked at the same time in separate sandboxes, each with its own Electron download and build, and the person who labelled them reads diffs in the morning instead of writing them.

## Frequently asked questions

### Can it run the app to check the change?

It can start it. The sandbox has no display, so the agent installs `xvfb` and runs the repository's smoke test under `xvfb-run`, which launches the app with a remote debugging port and confirms the window appears. It does not click through the feature; the Jest test covers the renderer and a reviewer tries the native side.

### What if the issue needs a native module?

The agent adds it to `release/app/package.json`, where `electron.vite.config.ts` reads the list to externalize it, and lets `npm run rebuild` compile it for the Electron version in use. The pull request says which native module was added and that the workflow's macOS and Windows jobs will build it for those platforms.

### Does it touch the auto-updater or code signing?

Not unless the issue is about them. `updates.ts` and the `build` block in `package.json`, including the notarize hook and entitlements, stay as they are, and `npm run package` runs with `--publish never` so nothing is uploaded.

### What happens when the issue is too vague?

The agent posts a comment on the issue through your Linear connection saying what it needs, such as which window the feature belongs in or what the menu item should be called, and ends without a pull request. Answering on the issue and relabelling it starts a fresh run with the new text.

## More Electron jobs

- [Migrate Jest to Vitest in an Electron App](https://getrush.ai/run/migrate-jest-to-vitest/electron/)
- [Remember Window Size and Position in an Electron App](https://getrush.ai/run/remember-window-state/electron/)
- [Review Pull Requests on an Electron App](https://getrush.ai/run/review-pull-requests/electron/)

## The same job on other stacks

- [Turn Linear Issues Into Pull Requests for an Express API](https://getrush.ai/run/linear-issue-to-pr/express/)
- [Turn Linear Issues into Pull Requests for a FastAPI App](https://getrush.ai/run/linear-issue-to-pr/fastapi/)
- [Turn a Labeled Linear Issue Into a Pull Request on a Fastify API](https://getrush.ai/run/linear-issue-to-pr/fastify/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
