mirror of
https://github.com/Dasemu/Phenocheck.git
synced 2026-11-26 07:16:16 +00:00
Add root CLAUDE.md, docs/architecture.md, LESSONS.md, .env.example, .claude/settings.json hooks (PostToolUse JS syntax check, Stop hook validating manifest.json + node --check on all JS), and GitHub Actions workflows (ci.yml, version.yml) for this plain-JS Chrome extension with no existing build/lint/test tooling. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
Architecture
Phenocheck is a Manifest V3 Chrome extension with no build step.
Components
manifest.json— declares permissions (storage,cookies), host permissions forx.com/twitter.com, the background service worker, content scripts, and web-accessible resources (phenotype images).background.js— the extension's service worker.content.js+content.css— injected into matched pages atdocument_idle; reads the page DOM and renders phenotype estimates.data/data.js— static dataset (location → phenotype mapping or similar), loaded beforecontent.jsso its globals are available to it.images/icons/— toolbar/extension icons.images/phenotypes/(incl.images/phenotypes/custom/) — images shown in the injected UI, exposed viaweb_accessible_resources.
Data flow
background.jsfetches the profile's declared "Account based in" country via X's internalAboutAccountQueryAPI (using thecookiespermission for auth).content.jsrequests that country for the profile being viewed, with an in-memory cache keyed by handle.- It maps the country to an estimate using
data/data.js(plus hardcoded per-handle overrides incontent.js). - It renders the result into the page using
content.cssfor styling and images fromimages/phenotypes/(orimages/phenotypes/custom/for overrides).
No external backend of our own is involved; the only network calls are to X's own internal API, made from the background service worker.