Guidance for AI coding agents working in this repository.
@y/codemirror — CodeMirror 6 binding for Yjs. Binds a Y.Text to a CodeMirror editor and provides awareness (remote cursors/selections) and a shared undo manager as separate plugins.
src/index.js— public entry pointsrc/y-sync.js— Y.Text ↔ CodeMirror sync pluginsrc/y-remote-selections.js— remote cursor/selection rendering via awarenesssrc/y-undomanager.js— shared undo/redo integration withY.UndoManagersrc/y-range.js— range helperstest/— test entry (test/index.js) and node runner (test/test.node.cjs)demo/— browser demodist/— build output (generated, do not edit)
npm run dist— clean build via rollup + emit types with tscnpm test— build then run node tests (test/test.node.cjs)npm run test-extensive— longer fuzz run (--production --repetition-time 10000)npm run lint—standard+tsc --skipLibChecknpm run watch— rollup watchnpm start— demo server + watchnpm run debug—test.html+ watch
- ESM source (
"type": "module"), CJS output forrequireconsumers - Lint style:
standard(no semicolons, single quotes) - Types via JSDoc +
tsc --skipLibCheck(no.tssource) - Peer deps:
@y/y,@y/protocols,@codemirror/state,@codemirror/view— do not import transitively; treat as host-provided - Tests use the lib0 testing framework (
lib0/testing,lib0/prng) — see thelib0-testingskill
npm run lintnpm test- Do not commit
dist/churn unless the change is intentional — build output is regenerated bypreversion