Skip to content

Contributing ​

AI-assisted development ​

If you use an AI coding agent to contribute to MCR, start at the repository root and ask it to read AGENTS.md before making changes. This file is the repository's guide for AI coding agents, regardless of which tool you use. It explains where to find the relevant source and tests, which checks to run, and which commands or generated files require special care.

Give the agent a clear task and expected outcome. Ask it to keep changes focused and report what it actually verified. Review the diff and check results before submitting a pull request.

AGENTS.md is for developing MCR itself. To use MCR in another project with an agent, see the AI agent skill.

Development environment and commands ​

  • Latest Node.js 24 LTS recommended for development; see package.json engines for the minimum runtime. Development tools may require a newer patch.
  • VSCode (extensions: eslint/stylelint/vue)
sh
npm install
npx playwright install --with-deps

npm run build
npm run lint
npm run test

npm run dev

Source formatting and safety ​

Preserve UTF-8 and LF line endings, as required by .gitattributes. LF and CRLF use different numbers of characters, changing source lengths and coverage range offsets. As a result, coverage reports generated by npm run test can have different bytes values across operating systems, causing coverage snapshot checks to fail even when the code logic is unchanged.

npm run eol is intended to repair inconsistent line endings in an existing checkout by rebuilding the Git index and checking out tracked files again according to the repository’s line-ending rules. If a snapshot fails because of line endings, normalize the checkout rather than updating the snapshot baseline to accept the difference.

Destructive repair command

npm run eol runs git rm -rf --cached . && git reset --hard HEAD. It clears staged changes and discards uncommitted changes to tracked files. Commit or back up your work before considering this repair. Do not use it as a routine validation or formatting command.

Documentation and report site ​

docs/ contains tracked VitePress source. Keep English and zh/ page filenames aligned and update both languages for behavior changes.

Keep migration guides versioned as docs/migrations/migration-to-<major>.md and docs/zh/migrations/migration-to-<major>.md, preserving earlier guides when adding a new major version. Add each guide to docs/.vitepress/pages.js in the migrations group; both language sidebars use that list. English docs/migrations/migration-to-*.md guides are included in the npm package automatically.

Documentation preview and validation ​

sh
npm ci
npm run docs:dev
npm run docs
npm run docs:preview

Documentation linting ​

npm run lint:docs automatically fixes lint issues using ESLint directly for the VitePress configuration and Vue theme in docs/, plus JavaScript code fences in documentation and README.md. The official @eslint/markdown processor maps diagnostics and fixes back to the Markdown source. js, javascript, mjs and cjs fences support the project's syntax/style rules, including VitePress annotations such as js{1,3-5}:line-numbers and code-group filenames. Only no-undef and no-unused-vars are disabled for snippets that omit surrounding context; other correctness rules remain enabled. TypeScript (ts) and text fences are not checked as JavaScript. Markdown prose is not reformatted.

For intentionally nonstandard syntax demonstrations, keep js highlighting and place <!-- eslint-skip --> immediately before that code fence. It skips only that example, including during autofix; repeat the comment for each intentional exception. Do not use JavaScript eslint-disable comments to hide errors in normal examples. VSCode's ESLint integration validates Markdown and supports formatting/code fixes with the checked-in editor settings.

sh
npm run lint:docs             # Check and automatically fix
npm run lint:docs -- --no-fix # Check only (also used by docs)

Generated output and reports ​

All documentation output stays under .temp/: .temp/site/ is the published site, .temp/vitepress-cache/ holds caches, and .temp/vitepress-ssr/ holds intermediate SSR files. Integration tests write directly to .temp/site/reports/; the demo list is maintained as the VitePress pages docs/getting-started/examples.md and docs/zh/getting-started/examples.md, with direct links to reports. All report HTML, data and asset URLs use /monocart-coverage-reports/reports/; old URLs are not supported.

npm run docs:dev serves existing reports directly from .temp/site/reports/, without modifying their HTML or scripts. The Report Examples page renders without reports. Run the corresponding repository tests before opening individual reports locally. Missing reports return a 404 with these instructions; the development server does not run tests automatically.

Cleanup and publishing ​

npm run docs:build (also used by docs) removes previous site output except reports/ before building, so obsolete pages, legacy report redirects and hashed assets do not accumulate. Integration test groups (test-node, test-browser, test-all) remove marked legacy report redirect directories from the site root while preserving documentation and existing reports; each generated report cleans its own output directory. Reports and raw merge inputs under reports/ are not globally cleared by either workflow.

For a completely fresh local site, clean only the dedicated .temp/site/ output, then rebuild documentation and regenerate the required reports. Never clean or generate over docs/. CI builds documentation and reports separately, then downloads them into the same site directory for publishing.