Development
npm test # unit testsnpm run typecheck # tsc --checkJs over src/, extension/ and test/npm run test:chrome # end-to-end in Chrome for Testing with the real extensionnpm run test:pack # npm pack, install the tarball elsewhere, run what got installed- Chrome for Testing. Branded Chrome no longer loads unpacked extensions from the command line, so
test:chromeuses Chrome for Testing: setKBROWSER_TEST_CHROMEto its binary, or runnpx playwright install chromiumand the newest one in Playwright’s cache is used (Apple silicon). Without it these tests are skipped.KBROWSER_TEST_HEADED=1shows the window. - Isolation. Tests never use your
~/.k-browseror the bridge on port 9444; each one starts its own. - Kav. Tests against a real Kav run when
KBROWSER_TEST_KAVpoints at a Kav checkout (or one sits next to the repo), and are skipped otherwise. - Versions.
package.jsonandextension/manifest.jsoncarry the same version; a test checks it. Bump both when the bridge or the extension changes, sodoctorcan tell old code from new.
Code map
Section titled “Code map”| Path | What |
|---|---|
src/server.js, src/relay.js |
The bridge: websocket server, CDP relay, ownership |
src/policy.js |
Which CDP methods a client may send |
src/mcp/ |
The MCP server and its tools |
src/sdk/ |
Snapshots, refs and re-checked input |
src/redact.js |
Masking of secrets |
extension/ |
The Chrome extension (service worker, popup, side panel) |
test/ |
Unit tests; test/integration/ runs in real Chrome |