DiffSanity

Agent guide

Rules and conventions for anyone (human or AI agent) changing DiffSanity. Read this before making changes.

What DiffSanity is: a Chrome/Edge MV3 extension. It adds a button to each file on a GitHub pull request’s Files changed tab and opens that file in a focused review tab (whole file as one diff, syntax highlighting, minimap, themes, GitHub comment hand-off). See README.md for features, the architecture diagram, the module table, how files are fetched and every GitHub selector the extension relies on. Keep those sections up to date instead of copying them here.

Ground rules

These are product promises. Do not break them without the owner’s explicit approval.

Architecture rules

Code style

Testing

Command When
npm run typecheck Every change
npm test Every change. Vitest + jsdom, tests in test/
npm run build Every change; output goes to dist/
npm run e2e Any change to src/content, src/review or manifest.json. Runs dist/ against live public PRs (~3 min, 21 checks)

Docs to keep in sync

Change Update
New or changed feature README feature list, Tested and Known limitations; store description in docs/store/README.md
GitHub selectors README “GitHub DOM dependencies” table
Data, hosts or permissions PRIVACY.md (and its Last updated date), docs/store/README.md justifications and privacy answers
Build or scripts README Development table

PRIVACY.md is published by GitHub Pages (repo root, master) at https://zubeirom.github.io/DiffSanity/PRIVACY.html, which is the URL in both stores. Do not rename or move it. Exclude non-site files (sources, scripts, build output) from Pages in _config.yml.

Commits and releases

Writing style

For README, store text, release notes, UI strings and messages to the owner: plain, simple English, short sentences, no jargon, no filler. Say what something does, not how clever it is.

Roadmap

The review tab now covers the whole pull request: a GitHub-style file list on the left switches files in place, using the existing FileDiff model, renderer and minimap. Build new review features on those modules rather than a parallel implementation. Next ideas (syncing GitHub’s “Viewed” state, j/k change navigation, word-level highlighting) are listed under Known limitations in the README.