

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# Frontend Architecture78## Two-Paradigm Page Fork910`index.html` serves both modes from a single HTML shell. A script block at load time checks `window.location.pathname`:11- `/live` → live mode (iframe-based pin review)12- Everything else → code-review mode (file tree + diff/document views)1314Each mode dynamically loads its own script set. They share: theme pill, settings overlay, and extracted modules.1516## Module Pattern1718All custom JS uses the IIFE + dual-export pattern:1920```javascript21(function () {22 'use strict';23 // ... implementation ...24 var api = { publicFn1, publicFn2 };25 if (typeof window !== 'undefined') {26 window.crit = window.crit || {};27 window.crit.<namespace> = api;28 }29 if (typeof module === 'object' && module.exports) {30 module.exports = api;31 }32})();33```3435- Runtime: accessed via `window.crit.<namespace>`36- Tests: required via `module.exports` (Node.js `--test`)37- Never use ES modules (`import`/`export`) — no build step exists3839## Shared Modules (used by both modes)4041| Module | Namespace | Purpose |42|--------|-----------|---------|43| `crit-shared.js` | `window.crit.shared` | Cookie helpers, theme, tip rotation, image upload |44| `crit-renderer.js` | `window.crit.renderer` | ContentRenderer registry (register/deregister/current) |45| `crit-sse.js` | `window.crit.sse` | SSE client factory (createSSE) |46| `crit-draft.js` | `window.crit.draft` | Autosave drafts to localStorage |47| `crit-comment-templates.js` | `window.crit.commentTemplates` | Template bar + saved-snippet CRUD |48| `crit-comment-form.js` | `window.crit.commentForm` | Shared comment form creation |49| `crit-comment-card.js` | `window.crit.commentCard` | Comment card rendering + reply threading |50| `crit-comment-card-helpers.js` | `window.crit.commentCardHelpers` | Author colors, timestamps, markdown rendering |51| `crit-settings-overlay.js` | `window.crit.settingsOverlay` | Settings dialog lifecycle |52| `crit-settings-panes.js` | `window.crit.settingsPanes` | Settings tab content |5354## Code-Review Modules (used only by code-review mode)5556| Module | Namespace | Purpose |57|--------|-----------|---------|58| `crit-icons.js` | `window.crit.icons` | SVG icon constants (ICON_CHEVRON, ICON_EDIT, etc.) |59| `crit-line-blocks.js` | `window.crit.lineBlocks` | buildLineBlocks, splitHighlightedCode, buildCodeLineBlocks |60| `crit-diff-renderer.js` | `window.crit.diffRenderer` | Word-level diff computation (lineSimilarity, wordDiff, etc.) |6162## ContentRenderer Interface6364Modes register a renderer that the shared chrome (comment cards, settings) can call without knowing the active mode:6566```javascript67window.crit.renderer.register({68 scrollToAnchor(anchor), // scroll viewport to a comment's target69 highlightAnchor(anchor), // visually highlight the target70 clearHighlight(), // remove highlight71 onAnnotationIntent(cb), // subscribe to "user wants to comment here"72 getMode(), // "code-review" | "live"73 getAnchorType(), // "line" | "dom"74});75```7677Code-review registers its renderer in `app.js`. Live-mode registers in `live-mode.js`.7879## Script Loading8081No bundler. Scripts are loaded dynamically with `async=false` (preserves execution order while loading in parallel). A Promise-based boot gate waits for all dependencies before loading the mode's main entry point:82831. Early scripts (shared helpers) load first842. `liveDeps` array lists all sub-modules853. `Promise.all(bootGate)` waits for all load events864. Only then loads `live-mode.js` (or `app.js` for code-review)8788When adding a new shared module:89- Add to `liveDeps` array in `index.html` if live-mode needs it90- Add to the code-review script chain if code-review needs it91- Both modes must load shared modules BEFORE their main entry point9293## Live-Mode Sub-Modules9495Live-mode splits into focused files under `window.crit.live.<name>`:9697| File | Namespace | Concern |98|------|-----------|---------|99| `live-mode.dispatch.js` | `.live.dispatch` | Message dispatch table |100| `live-mode.toggle.js` | `.live.toggle` | Pin/Browse mode toggle |101| `live-mode.composer.js` | `.live.composer` | Comment composition UI |102| `live-mode.panel.js` | `.live.panel` | Side panel lifecycle |103| `live-mode.panel-render.js` | `.live.panelRender` | Panel card rendering |104| `live-mode.sse.js` | `.live.sse` | Live-mode SSE handlers |105| `live-mode.size.js` | `.live.size` | Panel resize logic |106| `live-mode.queue.js` | `.live.queue` | Batched pin push queue |107| `live-mode.origin.js` | `.live.origin` | Origin/proxy URL resolution |108| `live-mode.row.js` | `.live.row` | Per-route section rendering |109110## Adding a New Module1111121. Create the IIFE file with the dual-export pattern1132. Add it to `liveDeps` or code-review script chain in `index.html`1143. Create a matching `web/__tests__/<name>.test.js` using Node's `--test`1154. Add the test file to `Makefile` `e2e-live-utils` target (if live-mode)1165. Document dependencies in a header comment (which `window.crit.*` namespaces it reads)117
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| tomasz-tomczyk/crit.cursor/rules/frontend-css.mdc · 903 | Cursor rules | uido-not | 46/100 | today | |
| tomasz-tomczyk/crit.cursor/rules/frontend-js.mdc · 903 | Cursor rules | lint-formatstyletesting-strategyui+1 | 59/100 | today | |
| tomasz-tomczyk/crit.cursor/rules/go.mdc · 903 | Cursor rules | teststylegitdo-not | 67/100 | today | |
| tomasz-tomczyk/crit.cursor/rules/proxy-auth-transport.mdc · 903 | Cursor rules | securitydo-not | 50/100 | today | |
| tomasz-tomczyk/critAGENTS.md · 903 | AGENTS.md | buildtestlint-formatstyle+2 | 77/100 | today | |
| tomasz-tomczyk/critscripts/AGENTS.md · 903 | AGENTS.md | setupbuildtesttesting-strategy | 77/100 | today |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 46 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/gh-task-plan.mdc · 1.4k | Cursor rules | teststylearchtypes+2 | 96/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/tomasz-tomczyk-crit-cursor-rules-frontend-architecture)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.