mirror of
https://github.com/lobehub/lobehub
synced 2026-04-21 09:37:28 +00:00
* v2 init
* chore: update eslint suppressions and package dependencies
- Removed several eslint suppressions related to array sorting and reversing from eslint-suppressions.json to clean up the configuration.
- Updated @lobehub/lint package version from 2.0.0-beta.6 to 2.0.0-beta.7 in package.json for improvements and bug fixes.
- Made minor formatting adjustments in vitest.config.mts and various SKILL.md files for better readability and consistency.
Signed-off-by: Innei <tukon479@gmail.com>
* fix: clean up import statements and formatting
- Removed unnecessary whitespace in replaceComponentImports.ts for improved readability.
- Standardized import statements in contextEngineering.ts and createAgentExecutors.ts by adding missing spaces for consistency.
Signed-off-by: Innei <tukon479@gmail.com>
* chore: update eslint suppressions and clean up code formatting
* 🐛 fix: use vi.hoisted for mock variable initialization
Fix TDZ error in persona service test by using vi.hoisted() to ensure
mock variables are available when vi.mock factory runs.
---------
Signed-off-by: Innei <tukon479@gmail.com>
3.4 KiB
3.4 KiB
LobeChat Development Guidelines
This document serves as a comprehensive guide for all team members when developing LobeChat.
Project Description
You are developing an open-source, modern-design AI Agent Workspace: LobeHub (previously LobeChat).
Tech Stack
- Frontend: Next.js 16, React 19, TypeScript
- UI Components: Ant Design, @lobehub/ui, antd-style
- State Management: Zustand, SWR
- Database: PostgreSQL, PGLite, Drizzle ORM
- Testing: Vitest, Testing Library
- Package Manager: pnpm (monorepo structure)
Directory Structure
lobe-chat/
├── apps/desktop/ # Electron desktop app
├── packages/ # Shared packages (@lobechat/*)
│ ├── database/ # Database schemas, models, repositories
│ ├── agent-runtime/ # Agent runtime
│ └── ...
├── src/
│ ├── app/ # Next.js app router
│ ├── store/ # Zustand stores
│ ├── services/ # Client services
│ ├── server/ # Server services and routers
│ └── ...
├── .agents/skills/ # AI development skills
└── e2e/ # E2E tests (Cucumber + Playwright)
Development Workflow
Git Workflow
- The current release branch is
nextuntil v2.0.0 is officially released - Use rebase for git pull
- Git commit messages should prefix with gitmoji
- Git branch name format:
username/feat/feature-name - Use
.github/PULL_REQUEST_TEMPLATE.mdfor PR descriptions - PR titles with
✨ feat/or🐛 fixtrigger releases
Package Management
- Use
pnpmas the primary package manager - Use
bunto run npm scripts - Use
bunxto run executable npm packages
Code Style Guidelines
TypeScript
- Prefer interfaces over types for object shapes
Testing Strategy
# Web tests
bunx vitest run --silent='passed-only' '[file-path-pattern]'
# Package tests (e.g., database)
cd packages/[package-name] && bunx vitest run --silent='passed-only' '[file-path-pattern]'
Important Notes:
- Wrap file paths in single quotes to avoid shell expansion
- Never run
bun run test- this runs all tests and takes ~10 minutes
Type Checking
- Use
bun run type-checkto check for type errors
i18n
- Keys: Add to
src/locales/default/namespace.ts - Dev: Translate
locales/zh-CN/namespace.jsonlocale file only for preview - DON'T run
pnpm i18n, let CI auto handle it
Linear Issue Management
Follow Linear rules in CLAUDE.md when working with Linear issues.
Skills (Auto-loaded)
All AI development skills are available in .agents/skills/ directory:
| Category | Skills |
|---|---|
| Frontend | react, typescript, i18n, microcopy |
| State | zustand |
| Backend | drizzle |
| Desktop | desktop |
| Testing | testing |
| UI | modal, hotkey, recent-data |
| Config | add-provider-doc, add-setting-env |
| Workflow | linear, debug |
| Performance | vercel-react-best-practices |
| Overview | project-overview |