Userscripts for LessWrong and EA Forum
- Core Stack: Vite + vite-plugin-monkey, TypeScript (ESM), GraphQL (LW API), Playwright (E2E).
- Architecture: Site takeover (
window.stop()), React DOM clearing, custom GraphQL client.
- Run
npm audit --audit-level=high(analyze risks of fixing/updating vs not, then proceed accordingly) - Increment version.
- Run
jj stand confirm no temporary files are included. - Run
jj --no-pager diff --git. Do a quick sanity check on the diff. - Generate the commit message from the actual diff, then set it with
jj desc -m "...". - Include relevant requirement IDs in commit messages when applicable (e.g.,
PR-UARCH-*,PR-PREV-*). - Run
npm run check:eol(if it fails, runnpm run fix:eol; for full cleanup usenpm run fix:eol -- --all) - Run
npm run lint:changed - Run
npm run lint:app - Run
npm test - Run
jj bookmark set main - Run
jj git push(don't run this without explicit user direction)
- Build:
npm run build:power-reader - Test:
npm test(E2E) |npm run test:sync-emulator(Firestore integration) - Lint:
npm run lint:changed|npm run lint:app - Tooling:
npm run check:eol|npm run fix:eol|npm run codegen(types) |update-schema(latest LW API).codegenruns automatically ondev/build.
- Shell: PowerShell 5.1. No
&&, use;. Use backslashes\for local Windows paths. Use quotes around "paths with spaces". Do not prefix commands with shell executables likecmdorpowershell. Quote@if used - Code: ESM only (no
__dirname). Use/// <reference types="vite-plugin-monkey/client" />forGM_*types. UsehtmlBodyfor content. - Testing: Wait for
#lw-power-reader-ready-signal. MockGM_*and GraphQL viaaddInitScript. - Sync Testing: Run Firestore integration checks with
$env:PR_SYNC_EMULATOR_AUTOSTART="1"; npm run test:sync-emulator. This validates security rules and CAS logic against a local emulator. - Playwright browser log piping: Enabled only for single-spec runs, or explicitly with
PW_FORCE_BROWSER_LOGS=true. - Spec-driven changes: For behavior changes, update
src/scripts/power-reader/SPEC.mdrequirement IDs and add/update matching tests. - Logic: Use getters (e.g.,
() => state.data) for component props to avoid stale closures.
README.md TESTING.md NOTES.md CHANGELOG.md src/scripts/power-reader/SPEC.md src/shared/graphql/lw_schema.graphql