Canonical instructions for coding agents in this repository. CLAUDE.md
should point here instead of duplicating rules.
- Throw errors instead of returning blank values when something goes wrong.
- Report dump serialization format (
ScreenshotRef,ReportActionDumpJSON) does not need backward compatibility with older formats. Old report files are disposable and can be regenerated, so do not add legacy-format shims when changing the serialization schema.
- NEVER force push anything unless you are explicitly told to do so.
- Use
pnpmonly. The workspace requires Node>=18.19.0and pnpm>=9.3.0. - Read
CONTRIBUTING.mdbefore local development. Dev/build workflows, app-local dev servers, and report rebuild troubleshooting are maintained there to avoid duplication. - Before creating a commit or updating a PR, run
pnpm run lintfrom the repository root. - For code changes, run the smallest relevant Nx target for each touched project instead of defaulting to full monorepo validation.
- AI tests require some environment variables like
MIDSCENE_MODEL_BASE_URLto be set.
- Add or update tests when behavior changes. Start with the nearest unit test suite; use AI tests or e2e only when the change actually depends on model behavior or browser/device integration.
- Do not hand-edit generated output under
dist/orapps/site/doc_build/. - When changing shared packages or exported entry points, run a focused build for the affected project before finishing.
- Commits must follow Conventional Commits with a required scope.
- Scope values come from directory names under
apps/andpackages/, plus shared scopes incommitlint.config.jssuch asworkflow,llm,playwright,puppeteer, andbridge. - Important mismatch: use
web-integrationas the commit scope for changes underpackages/web-integration, even though the published package name is@midscene/web. - Important mismatch: use
siteas the commit scope forapps/site, even though the Nx project name isdoc. - In PR summaries, list the actual validation commands you ran.
- Treat user-facing docs as bilingual by default.
- If you edit
README.md, updateREADME.zh.mdin the same change. - If you edit
apps/site/docs/en/**, inspect and update the corresponding file underapps/site/docs/zh/**. Do the same in the opposite direction. - The English and Chinese trees are not perfectly mirrored. If the counterpart file does not exist, decide whether to add it or call out the intentional gap in your final summary.
- Before editing site copy, read
apps/site/agents.mdfor terminology rules. It already documents translation constraints such as keepingAPI KeyandAgentuntranslated in Chinese where appropriate.
- Docs-only change: usually
pnpm run lintis enough. - Single-package code change: run
pnpm run lintplus the smallest relevantnpx nx test <project>and, if exports/build wiring changed,npx nx build <project>. - Cross-package runtime or build-system change: run
pnpm run lintand say explicitly if broader validation is still outstanding.