This document serves as a shared guideline for all team members when using Claude Code in this opensource lobe-chat(also known as lobehub) repository.
read @.cursor/rules/project-introduce.mdc
read @.cursor/rules/project-structure.mdc
- use rebase for git pull
- git commit message should prefix with gitmoji
- git branch name format template: /
- use .github/PULL_REQUEST_TEMPLATE.md to generate pull request description
- PR titles starting with
✨ feat/or🐛 fixwill trigger the release workflow upon merge. Only use these prefixes for significant user-facing feature changes or bug fixes
This repository adopts a monorepo structure.
- Use
pnpmas the primary package manager for dependency management - Use
bunto run npm scripts - Use
bunxto run executable npm packages
see @.cursor/rules/typescript.mdc
- Required Rule: read
.cursor/rules/testing-guide/testing-guide.mdcbefore writing tests - Command:
- web:
bunx vitest run --silent='passed-only' '[file-path-pattern]' - packages(eg: database):
cd packages/database && bunx vitest run --silent='passed-only' '[file-path-pattern]'
- web:
Important:
- wrap the file path in single quotes to avoid shell expansion
- Never run
bun run testetc to run tests, this will run all tests and cost about 10mins - If trying to fix the same test twice, but still failed, stop and ask for help.
- Prefer
vi.spyOnovervi.mock: When mocking modules or functions, prefer usingvi.spyOnto mock specific functions rather thanvi.mockto mock entire modules. This approach is more targeted, easier to maintain, and allows for better control over mock behavior in individual tests. - Tests must pass type check: After writing or modifying tests, run
bun run type-checkto ensure there are no type errors. Tests should pass both runtime execution and TypeScript type checking.
- use
bun run type-checkto check type errors.
- Keys: Add to
src/locales/default/namespace.ts - Dev: Translate
locales/zh-CN/namespace.jsonandlocales/en-US/namespace.jsonlocales file only for dev preview - DON'T run
pnpm i18n, let CI auto handle it
Read @.cursor/rules/linear.mdc when working with Linear issues.
Some useful project rules are listed in @.cursor/rules/rules-index.mdc