# Audit the Dependency Licenses of an Electron App

Yes. An agent reads your Electron app's lockfiles, resolves every package's license, and writes a report that separates what ships to users from what only builds it.

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

## What the agent does

The agent clones the app and starts with how it is packaged, because that decides which licenses matter. In an app built on electron-react-boilerplate, there are two package roots: the top-level `package.json`, whose `dependencies` are `electron-updater`, `electron-log`, `electron-debug`, `@electron/notarize`, `react`, `react-dom` and `react-router-dom`, and whose `devDependencies` hold `electron` 44, `electron-builder`, `electron-vite`, `jest`, `eslint` and the rest of the toolchain; and `release/app/package.json`, which electron-builder uses as the packaged app's manifest (`directories.app` in the `build` block) and whose `dependencies` object is empty, meaning native modules would be installed there. A third root, `.erb/tooling/package.json`, holds `typescript`, `ts-jest` and the ESLint TypeScript plugins and is installed by the `postinstall` script with `npm --prefix .erb/tooling ci`. The `build.files` list says the packaged app contains `dist`, `node_modules` and `package.json` from `release/app`, so the licenses that ship are those of the top-level `dependencies` bundled by `electron-vite` plus anything in `release/app/node_modules`.

Each root has its own `package-lock.json`. The top-level lock is lockfile version 3 and records a `license` field for almost every package, along with `dev` and `optional` flags, so the agent reads it directly rather than installing first: it writes a small script that walks the `packages` map, groups every entry by its SPDX expression, and marks whether the entry is a production or a development dependency. In this lockfile the bulk is `MIT`, `ISC`, `Apache-2.0` and the BSD variants, and the entries worth a second look are the ones with compound or unusual expressions: `argparse` 2.0.1 under `Python-2.0`, which the lock marks as a production dependency; `jszip` under `(MIT OR GPL-3.0-or-later)`; `harmony-reflect` under `(Apache-2.0 OR MPL-1.1)`; `axe-core` under `MPL-2.0`; `caniuse-lite` under `CC-BY-4.0`; and `truncate-utf8-bytes` under `WTFPL`, the last five all development-only. Entries with no `license` field at all get a row of their own.

Then it does what the lockfile cannot: it runs `npm ci`, which also runs the `postinstall` chain, and reads the `LICENSE` file inside each flagged package under `node_modules` to confirm the text matches the SPDX field, because a package's `package.json` can say `MIT` while its `LICENSE` says otherwise. For the compound expressions it records which option the team may choose, and for `argparse` it traces the dependency path with `npm ls argparse` to show which production package pulls it in and whether that package is bundled into `dist/main` or `dist/renderer` by `electron.vite.config.ts`. It repeats the walk for `.erb/tooling/package-lock.json` and notes that nothing there ships, and for `release/app/package-lock.json`, which has one entry, the app itself.

The report, `licenses.md`, has three tables: packages that ship to users, grouped by license with the bundle each lands in; development and tooling packages, grouped the same way; and a flagged section with every copyleft, share-alike, compound or missing license, each with the package, version, dependency path and what the agent read in its `LICENSE` file. A `licenses.csv` with one row per package backs the tables. Electron itself is listed under MIT with the version from the lock, and the report notes that Chromium's and Node's third-party notices ship inside the Electron binary, outside the npm graph, and are not covered by this audit.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Audit the dependency licenses of this Electron app and write licenses.md and licenses.csv. Read package.json, release/app/package.json, .erb/tooling/package.json, their three package-lock.json files, electron.vite.config.ts and the build block in package.json to work out which packages ship inside the packaged app and which only build or test it. Walk the packages map of each lockfile, group entries by SPDX license expression and record whether each is a production, development or optional dependency. Run npm ci, then open the LICENSE file of every package whose expression is copyleft, share-alike, compound, unusual or missing and confirm it matches. Trace the dependency path of every flagged production package with npm ls. Write licenses.md with a table of shipped packages by license, a table of development and tooling packages by license, and a flagged section with package, version, path and what the LICENSE file says. Write licenses.csv with one row per package. Note that Electron's Chromium and Node notices are outside the npm graph. Do not change any file in the repository.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

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 two artifacts on the session, `licenses.md` and `licenses.csv`, each with a download link that works for an hour and is refreshed on every read of the session. The Markdown report leads with the split that matters for distribution, shipped packages against build tooling, then the flagged section. The CSV has one row per package across all three lockfiles with its root, version, license expression, dependency kind and whether it ships.

The session's `result` field summarises the flagged section: how many packages carry a compound or unusual expression, which of them ship, and whether any `LICENSE` text disagreed with its `package.json`. The transcript shows the `npm ci`, `npm ls` and file reads as `tool_use` events, so the report's claims trace to commands that ran.

A reviewer reads the flagged section first. A production package under a compound expression needs a recorded choice of licence; a `CC-BY-4.0` data package needs attribution if it ships; a package with no `license` field needs a human to look. The tables then go into the app's third-party notices or the release checklist by hand; the run writes nothing to the branch.

## Run it on every lockfile change on main

Add an automation to the Project with this prompt and a `github` trigger on `pull_request.opened` and `pull_request.synchronize` with `branch_patterns` set to `main`. A trigger filters on branch, labels and authors, not on paths, so the prompt tells the agent to end with a one-line result when the pull request changes none of the three `package-lock.json` files. The trigger adds the pull request event after the prompt and fills in nothing; pull requests from forks never fire it.

For a release audit, send `POST /o/{org}/sessions` with this body from the release script, with a `request_id` that is a UUID v5 of the tag so a retry returns the same run, and give the key a `webhook_url` so `run.completed` arrives with `data.session_url` to fetch both artifacts from.

## Why run it on Rush?

An Electron license audit is mostly bookkeeping across three lockfiles and a build config, and the mistake is always the same: counting the toolchain as if it shipped, or missing the one production package with a compound licence because it is seven levels deep. In a Rush sandbox the agent reads the locks, installs the tree with `npm ci`, opens the `LICENSE` files that matter, traces paths with `npm ls`, and keeps every command and its output in the run's record, so the report is checkable rather than asserted.

The run needs no signing keys and no packaged build, and it changes nothing, so it is safe to repeat on every lockfile change or every release. The same request works on any Electron app with lockfiles; a pnpm or Yarn app changes which file the agent walks, not what it reports.

## Frequently asked questions

### Why three lockfiles?

electron-react-boilerplate keeps the toolchain at the top level, the packaged app's manifest in `release/app`, and the TypeScript compiler API tools in `.erb/tooling`, each with its own `npm ci`. Only the first two can contribute to what users receive, and the report says which packages from the top level the bundler folds into `dist`.

### Does it trust the license field in the lockfile?

For the common cases, yes, since that field comes from each package's own `package.json`. For anything compound, copyleft, unusual or missing it opens the package's `LICENSE` file after `npm ci` and reports what the text says, and it notes any disagreement between the two.

### What about Chromium and Node inside Electron?

They are not npm packages, so the lockfile walk cannot see them. The report lists `electron` under its MIT licence at the version in the lock and adds a note that the binary carries Chromium's and Node's own third-party notices, which a distribution checklist should reference separately.

### Can it fail a pull request on a new copyleft package?

The run itself only writes a report. When a release script starts it with a key, a handler on your side can read `data.result` from the key's `run.completed` webhook and act on it. A run the automation starts is not tied to a key, so for a pull request the report feeds the review by hand.

## More Electron jobs

- [Turn Linear Issues Into Pull Requests for an Electron App](https://getrush.ai/run/linear-issue-to-pr/electron/)
- [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/)

## The same job on other stacks

- [Audit Open Source Licenses in a Go Project](https://getrush.ai/run/license-audit/go/)
- [Audit Open Source Licenses in a Next.js Project](https://getrush.ai/run/license-audit/nextjs/)
- [Audit Open Source Licenses in a Rust Project](https://getrush.ai/run/license-audit/rust/)

## 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/)
