Thanks for your interest in contributing! This repo is a Yarn 4 (Berry) workspaces monorepo containing the model-driven, collaboration-ready Editor.js engine. This guide covers local setup, day-to-day development, and — since this project practices spec-driven development with OpenSpec — how specs and change proposals fit into the workflow.
For a general, non-technical overview of ways to get involved, see the Want to contribute? section of the README and editorjs.io/contributing.
Prerequisites
- Node.js
v24.15.0(see.nvmrc— usenvm useif you manage versions with nvm) - Yarn
4.0.1via Corepack (corepack enable)
Setup
Clone with git clone --recurse-submodules https://github.com/editor-js/document-model.git, or initialize submodules in an existing clone before installing dependencies:
git submodule update --init
yarn installHeader is a workspace package, so yarn install needs its submodule directory. The install also sets up the Husky git hook (yarn constraints runs on pre-commit to keep workspace dependency versions consistent).
Common commands (from the repo root, across all packages):
yarn build # build every package
yarn test # run every package's test suite
yarn lint # lint every package
yarn lint:fix # lint and auto-fix every packageTo work within a single package:
cd packages/model
yarn test
yarn test:coverage
yarn lintSome packages (e.g. model) also run Stryker mutation testing via yarn test:mutations.
To try changes end-to-end, use the Vite playground:
cd packages/playground && yarn devThe OT collaboration server can be run via Docker. It requires a WSS_PORT env var (defaults to 8080 if you set it, but docker compose needs it explicit) — create a .env file at the repo root with WSS_PORT=8080, then:
docker compose uppackages/model-types— shared low-level types/event base classes (internal tomodel/sdk)packages/sdk— public contracts (EventBus, interfaces) that tools/plugins should depend onpackages/model— the in-memory document model (EditorJSModel,BlockNode,TextNode, caret management)packages/dom-adapters— binds model nodes to DOM inputspackages/collaboration-manager— OT, batching, undo/redo, OT WebSocket clientpackages/core— orchestrator (IoC container, plugin/tool lifecycle,EditorAPI)packages/ui— default UI shellpackages/ot-server— standalone WebSocket OT serverpackages/playground— manual testing sandboxpackages/tools/*— built-in block/inline tools (paragraph, bold, italic, inline-link), each implementingBlockTool/InlineToolfrom@editorjs/sdk
New tools/plugins should depend on @editorjs/sdk, not @editorjs/model directly.
Architecture, data model, input handling, plugin lifecycle, collaboration, and event system docs live in docs/, with Mermaid diagrams in docs/diagrams/. Read the relevant page before making structural changes — and expect PRs that touch public APIs to require doc updates (see Documentation below).
This repo's source-of-truth specs live in openspec/specs/ (one folder per package/area, e.g. model, core, collaboration-manager, sdk, architecture). Project-wide conventions for AI-assisted work are configured in openspec/config.yaml, including:
- TDD is required: write a failing test first, then implement, then refactor.
- Test naming: use should-notation, e.g.
it('should return X when Y'). - Proposals must cross-check
docs/and call out anything they supersede.
For any non-trivial change (new capability, breaking change, architectural shift, or anything that alters behavior described in openspec/specs/), start with an OpenSpec change proposal instead of jumping straight into code. Small fixes, typo corrections, and refactors that don't change behavior don't need one — use your judgment, and feel free to ask in a draft PR or issue if unsure.
The OpenSpec CLI (@fission-ai/openspec) drives this. Install it globally or use npx openspec:
npm install -g @fission-ai/openspecTypical flow for a change:
- Explore (optional) — think through the problem and requirements before committing to an approach.
- Propose — create a change under
openspec/changes/<change-name>/withproposal.md(what & why),design.md(how), andtasks.md(implementation steps):openspec new change "<change-name>" openspec status --change "<change-name>"
- Apply — implement the tasks in
tasks.md, following TDD as required byopenspec/config.yaml. - Verify — check the implementation matches the proposal's specs and tasks before wrapping up.
- Archive — when the last task is checked, the change is archived (
openspec archive <change-name>) to move it intoopenspec/changes/archive/and fold its delta specs intoopenspec/specs/. On a PR this is done for you — see Archiving at merge time below.
Useful CLI commands while working on a change:
openspec list # list active changes/specs
openspec show <item-name> # show a change or spec
openspec validate <item-name> # validate a change/spec against its schema
openspec view # interactive dashboardIf you're using Claude Code in this repo, the same workflow is available as slash commands (/opsx:explore, /opsx:propose, /opsx:apply, /opsx:verify, /opsx:sync, /opsx:archive, /opsx:update) and equivalent skills — these wrap the CLI above and keep proposal/spec/task files coherent as you iterate.
Keep specs and code in sync: a PR that changes behavior covered by openspec/specs/ without a corresponding proposal/archive will likely be asked to add one during review.
A change is archived in its final PR, right before merge, so the spec fold-in is reviewable and lands atomically with the code. CI enforces this:
- The gate (
OpenSpec archive gate) fails a PR / merge-queue build when an active change has every task in itstasks.mdchecked but is still sitting inopenspec/changes/. Changes with unchecked tasks pass, so a change spread across several PRs only needs to be archived in the PR that completes it. Run the same check locally withnode .github/scripts/openspec-archive-gate.mjs. - The action — a maintainer comments
/archiveon the PR (or/archive <change-name>when more than one change is complete). A workflow runsopenspec archive, then commits the moved change + updated specs to the PR branch. Review that spec diff before merging.
To intentionally land completed code but defer archiving to a follow-up PR, leave the change's final task unchecked until you're ready to archive (task completion is the "ready to archive" signal). The openspec:defer-archive label additionally silences the informational gate on the PR itself.
Authoring deltas so the fold is clean. CI runs the openspec archive CLI — a deterministic tool, not the agent-driven /opsx:archive skill — so the fold is only as good as the delta. The authoring rules live in openspec/config.yaml (rules.specs) and surface to agents via openspec instructions specs. Two that bite most often:
- For
MODIFIED/REMOVED/RENAMEDrequirements, the### Requirement:header must match the currentopenspec/specs/<capability>/spec.mdexactly — a mismatch silently appends a duplicate instead of updating. - The CLI can't author a new capability's
## Purpose(it writes aTBDplaceholder). Put the intended Purpose in the proposal and fill it into the folded spec in the same PR.
- Tests are co-located with source as
*.spec.ts(unit) and*.integration.spec.ts(integration), run with Jest. - Name test cases in should-notation:
it('should return X when Y'). - Write the failing test before the implementation (TDD), per
openspec/config.yaml. - Some packages run Stryker mutation testing (
yarn test:mutations); CI runs mutation tests on changed files for PRs and on all files for merge groups.
- ESLint (
eslint-config-codex) is the source of truth for style; runyarn lint(oryarn lint:fix) before pushing. - CI enforces
lint:ciwith zero warnings allowed per package.
Recent history favors Conventional Commits-style messages scoped to a package, e.g.:
fix(sdk): remove @/ alias from tsconfig
refactor(link): extract link inline tool into standalone package
Use a scope matching the package you changed where it makes sense (model, core, sdk, collaboration-manager, etc.).
Public API or architectural changes should be reflected in docs/ (see the map in .github/agents/docs-updater.agent.md for which doc/diagram pairs correspond to which parts of the codebase). Diagrams are Mermaid files in docs/diagrams/ — keep node/class names in sync with actual TypeScript identifiers, and never invent methods or properties that don't exist.
- CI runs per affected package (lint, unit tests, build, and mutation tests where configured) — only packages whose files (or dependencies) changed will run.
- Make sure
yarn build,yarn test, andyarn lintpass locally for any package you touched. - If your change is behavior-affecting, link the relevant OpenSpec change (or note that one wasn't needed and why).
- Keep PRs scoped to one package/concern where possible, matching the existing commit convention.
- Good First Tasks
- Telegram Chat
- Custom requirements: team@codex.so