mirror of
https://github.com/lobehub/lobe-chat.git
synced 2025-12-20 01:12:52 +08:00
👷 build: optimize claude action workflow and add vscode settings (#8796)
This commit is contained in:
7
.github/workflows/claude-code-review.yml
vendored
7
.github/workflows/claude-code-review.yml
vendored
@@ -38,7 +38,8 @@ jobs:
|
||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
|
||||
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
|
||||
# model: "claude-opus-4-20250514"
|
||||
model: 'claude-opus-4-1-20250805'
|
||||
allowed_bots: 'bot'
|
||||
|
||||
# Direct prompt for automated review (no @claude mention needed)
|
||||
direct_prompt: |
|
||||
@@ -51,8 +52,6 @@ jobs:
|
||||
|
||||
Be constructive and helpful in your feedback.
|
||||
|
||||
allowed_bots: 'bot'
|
||||
|
||||
# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
|
||||
# use_sticky_comment: true
|
||||
|
||||
@@ -71,7 +70,7 @@ jobs:
|
||||
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
|
||||
|
||||
# Optional: Add specific tools for running tests or linting
|
||||
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
|
||||
allowed_tools: 'Bash(bun run:*),Bash(pnpm run:*),Bash(npm run:*),Bash(npx vitest:*),Bash(rg:*),Bash(find:*),Bash(sed:*),Bash(grep:*),Bash(awk:*),Bash(wc:*),Bash(xargs:*)'
|
||||
|
||||
# Optional: Skip review for certain conditions
|
||||
# if: |
|
||||
|
||||
18
.github/workflows/claude.yml
vendored
18
.github/workflows/claude.yml
vendored
@@ -39,26 +39,26 @@ jobs:
|
||||
# This is an optional setting that allows Claude to read CI results on PRs
|
||||
additional_permissions: |
|
||||
actions: read
|
||||
|
||||
|
||||
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
|
||||
# model: "claude-opus-4-20250514"
|
||||
|
||||
model: 'claude-opus-4-1-20250805'
|
||||
allowed_bots: 'bot'
|
||||
|
||||
# Optional: Customize the trigger phrase (default: @claude)
|
||||
# trigger_phrase: "/claude"
|
||||
|
||||
|
||||
# Optional: Trigger when specific user is assigned to an issue
|
||||
# assignee_trigger: "claude-bot"
|
||||
|
||||
|
||||
# Optional: Allow Claude to run specific commands
|
||||
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
|
||||
|
||||
allowed_tools: 'Bash(bun run:*),Bash(pnpm run:*),Bash(npm run:*),Bash(npx vitest:*),Bash(rg:*),Bash(find:*),Bash(sed:*),Bash(grep:*),Bash(awk:*),Bash(wc:*),Bash(xargs:*)'
|
||||
|
||||
# Optional: Add custom instructions for Claude to customize its behavior for your project
|
||||
# custom_instructions: |
|
||||
# Follow our coding standards
|
||||
# Ensure all new code has tests
|
||||
# Use TypeScript for new files
|
||||
|
||||
|
||||
# Optional: Custom environment variables for Claude
|
||||
# claude_env: |
|
||||
# NODE_ENV: test
|
||||
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -19,7 +19,6 @@ Desktop.ini
|
||||
|
||||
# IDE and editors
|
||||
.idea/
|
||||
.vscode/
|
||||
*.sublime-*
|
||||
.history/
|
||||
.windsurfrules
|
||||
@@ -102,8 +101,8 @@ vertex-ai-key.json
|
||||
.local/
|
||||
.claude/
|
||||
.mcp.json
|
||||
CLAUDE.md
|
||||
CLAUDE.*.md
|
||||
|
||||
CLAUDE.local.md
|
||||
|
||||
# Misc
|
||||
./packages/lobe-ui
|
||||
|
||||
13
.vscode/extensions.json
vendored
Normal file
13
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"Anthropic.claude-code",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"jrr997.antd-docs",
|
||||
"seatonjiang.gitmoji-vscode",
|
||||
"styled-components.vscode-styled-components",
|
||||
"stylelint.vscode-stylelint",
|
||||
"unifiedjs.vscode-mdx",
|
||||
"unifiedjs.vscode-remark",
|
||||
"vitest.explorer",
|
||||
]
|
||||
}
|
||||
89
.vscode/settings.json
vendored
Normal file
89
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"npm.packageManager": "pnpm",
|
||||
// don't show errors, but fix when save and git pre commit
|
||||
"eslint.rules.customizations": [
|
||||
{ "rule": "import/order", "severity": "off" },
|
||||
{ "rule": "prettier/prettier", "severity": "off" },
|
||||
{ "rule": "react/jsx-sort-props", "severity": "off" },
|
||||
{ "rule": "sort-keys-fix/sort-keys-fix", "severity": "off" },
|
||||
{ "rule": "typescript-sort-keys/interface", "severity": "off" }
|
||||
],
|
||||
"stylelint.validate": [
|
||||
"css",
|
||||
"postcss",
|
||||
// make stylelint work with tsx antd-style css template string
|
||||
"typescriptreact"
|
||||
],
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
// useless to search this big folder
|
||||
"locales": true
|
||||
},
|
||||
"vitest.maximumConfigs": 6,
|
||||
"workbench.editor.customLabels.patterns": {
|
||||
"**/app/**/[[]*[]]/[[]*[]]/page.tsx": "${dirname(2)}/${dirname(1)}/${dirname} • page component",
|
||||
"**/app/**/[[]*[]]/page.tsx": "${dirname(1)}/${dirname} • page component",
|
||||
"**/app/**/page.tsx": "${dirname} • page component",
|
||||
|
||||
"**/app/**/[[]*[]]/[[]*[]]/layout.tsx": "${dirname(2)}/${dirname(1)}/${dirname} • page layout",
|
||||
"**/app/**/[[]*[]]/layout.tsx": "${dirname(1)}/${dirname} • page layout",
|
||||
"**/app/**/layout.tsx": "${dirname} • page layout",
|
||||
|
||||
"**/app/**/[[]*[]]/[[]*[]]/default.tsx": "${dirname(2)}/${dirname(1)}/${dirname} • slot default",
|
||||
"**/app/**/[[]*[]]/default.tsx": "${dirname(1)}/${dirname} • slot default",
|
||||
"**/app/**/default.tsx": "${dirname} • slot default",
|
||||
|
||||
"**/app/**/[[]*[]]/[[]*[]]/error.tsx": "${dirname(2)}/${dirname(1)}/${dirname} • error component",
|
||||
"**/app/**/[[]*[]]/error.tsx": "${dirname(1)}/${dirname} • error component",
|
||||
"**/app/**/error.tsx": "${dirname} • error component",
|
||||
|
||||
"**/app/**/[[]*[]]/[[]*[]]/loading.tsx": "${dirname(2)}/${dirname(1)}/${dirname} • loading component",
|
||||
"**/app/**/[[]*[]]/loading.tsx": "${dirname(1)}/${dirname} • loading component",
|
||||
"**/app/**/loading.tsx": "${dirname} • loading component",
|
||||
|
||||
"**/src/**/route.ts": "${dirname(1)}/${dirname} • route",
|
||||
"**/src/**/index.tsx": "${dirname} • component",
|
||||
|
||||
"**/src/database/repositories/*/index.ts": "${dirname} • db repository",
|
||||
"**/src/database/models/*.ts": "${filename} • db model",
|
||||
"**/src/database/schemas/*.ts": "${filename} • db schema",
|
||||
|
||||
"**/src/services/*.ts": "${filename} • service",
|
||||
"**/src/services/*/client.ts": "${dirname} • client service",
|
||||
"**/src/services/*/server.ts": "${dirname} • server service",
|
||||
|
||||
"**/src/store/*/action.ts": "${dirname} • action",
|
||||
"**/src/store/*/slices/*/action.ts": "${dirname(2)}/${dirname} • action",
|
||||
"**/src/store/*/slices/*/actions/*.ts": "${dirname(1)}/${dirname}/${filename} • action",
|
||||
|
||||
"**/src/store/*/initialState.ts": "${dirname} • state",
|
||||
"**/src/store/*/slices/*/initialState.ts": "${dirname(2)}/${dirname} • state",
|
||||
|
||||
"**/src/store/*/selectors.ts": "${dirname} • selectors",
|
||||
"**/src/store/*/slices/*/selectors.ts": "${dirname(2)}/${dirname} • selectors",
|
||||
|
||||
"**/src/store/*/reducer.ts": "${dirname} • reducer",
|
||||
"**/src/store/*/slices/*/reducer.ts": "${dirname(2)}/${dirname} • reducer",
|
||||
|
||||
"**/src/config/modelProviders/*.ts": "${filename} • provider",
|
||||
"**/src/config/aiModels/*.ts": "${filename} • model",
|
||||
"**/src/config/paramsSchemas/*/*.json": "${dirname(1)}/${filename} • params",
|
||||
"**/src/libs/model-runtime/*/index.ts": "${dirname} • runtime",
|
||||
|
||||
"**/src/server/services/*/index.ts": "${dirname} • server/service",
|
||||
"**/src/server/routers/lambda/*.ts": "${filename} • lambda",
|
||||
"**/src/server/routers/async/*.ts": "${filename} • async",
|
||||
"**/src/server/routers/edge/*.ts": "${filename} • edge",
|
||||
|
||||
"**/src/locales/default/*.ts": "${filename} • locale",
|
||||
},
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"markdown",
|
||||
// support mdx
|
||||
"mdx"
|
||||
]
|
||||
}
|
||||
117
CLAUDE.md
Normal file
117
CLAUDE.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This document serves as a shared guideline for all team members when using Claude Code in this repository.
|
||||
|
||||
## Suggestions
|
||||
|
||||
- When searching the project source code, it is recommended to exclude: `src/database/migrations/meta`, `**/*.test.*`, `**/__snapshots__`, `**/fixtures`
|
||||
- Please store all temporary scripts (such as migration and refactoring scripts) in the `docs/.local/` directory; the contents of this folder will not be committed.
|
||||
|
||||
## Technologies Stack
|
||||
|
||||
read @.cursor/rules/project-introduce.mdc for more details.
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```plaintext
|
||||
src/
|
||||
├── app/ # Next.js App Router
|
||||
├── features/ # Feature-based UI components
|
||||
├── store/ # Zustand state stores
|
||||
├── services/ # Client services (tRPC/Model calls)
|
||||
├── server/ # Server-side (tRPC routers, services)
|
||||
├── database/ # Schemas, models, repositories
|
||||
├── libs/ # External library integrations
|
||||
```
|
||||
|
||||
### Data Flow
|
||||
|
||||
- **Client DB Version**: UI → Zustand → Service → Model → PGLite
|
||||
- **Server DB Version**: UI → Zustand → Service → tRPC → Repository/Model → PostgreSQL
|
||||
|
||||
## Development
|
||||
|
||||
### Git Workflow
|
||||
|
||||
- use rebase for git pull.
|
||||
- git commit message should prefix with gitmoji.
|
||||
- git branch name format example: tj/feat/feature-name
|
||||
- use .github/PULL_REQUEST_TEMPLATE.md to generate pull request description
|
||||
|
||||
### Package Management
|
||||
|
||||
this is a monorepo project and we use `pnpm` as package manager
|
||||
|
||||
### TypeScript Code Style Guide
|
||||
|
||||
see @.cursor/rules/typescript.mdc
|
||||
|
||||
### Modify Code Rules
|
||||
|
||||
- **Code Language**:
|
||||
- For files with existing Chinese comments: Continue using Chinese to maintain consistency
|
||||
- For new files or files without Chinese comments: MUST use American English.
|
||||
- eg: new react tsx file and new test file
|
||||
- Conservative for existing code, modern approaches for new features
|
||||
|
||||
### Testing
|
||||
|
||||
Testing work follows the Rule-Aware Task Execution system above.
|
||||
|
||||
- **Required Rule**: `testing-guide/testing-guide.mdc`
|
||||
- **Command**: `npx vitest run --config vitest.config.ts '[file-path-pattern]'`, wrapped in single quotes to avoid shell expansion
|
||||
|
||||
**Important**:
|
||||
|
||||
- Never run `bun run test` etc to run tests, this will run all tests and cost about 10mins
|
||||
- If try to fix the same test twice, but still failed, stop and ask for help.
|
||||
|
||||
### Typecheck
|
||||
|
||||
- use `bun run type-check` to check type errors.
|
||||
|
||||
### Internationalization
|
||||
|
||||
- **Keys**: Add to `src/locales/default/namespace.ts`
|
||||
- **Dev**: Translate at least `zh-CN` files for preview
|
||||
- **Structure**: Hierarchical nested objects, not flat keys
|
||||
- **Script**: DON'T run `pnpm i18n` (user/CI handles it)
|
||||
|
||||
## Rules Index
|
||||
|
||||
Some useful rules of this project. Read them when needed.
|
||||
|
||||
**IMPORTANT**: All rule files referenced in this document are located in the `.cursor/rules/` directory. Throughout this document, rule files are referenced by their filename only for brevity.
|
||||
|
||||
### 📋 Complete Rule Files
|
||||
|
||||
**Core Development**
|
||||
|
||||
- `backend-architecture.mdc` - Three-layer architecture, data flow
|
||||
- `react-component.mdc` - antd-style, Lobe UI usage
|
||||
- `drizzle-schema-style-guide.mdc` - Schema naming, patterns
|
||||
- `define-database-model.mdc` - Model templates, CRUD patterns
|
||||
|
||||
**State & UI**
|
||||
|
||||
- `zustand-slice-organization.mdc` - Store organization
|
||||
- `zustand-action-patterns.mdc` - Action patterns
|
||||
- `packages/react-layout-kit.mdc` - Layout components usage
|
||||
|
||||
**Testing & Quality**
|
||||
|
||||
- `testing-guide/testing-guide.mdc` - Test strategy, mock patterns
|
||||
- `code-review.mdc` - Review process and standards
|
||||
|
||||
**Desktop (Electron)**
|
||||
|
||||
- `desktop-feature-implementation.mdc` - Main/renderer process patterns
|
||||
- `desktop-local-tools-implement.mdc` - Tool integration workflow
|
||||
- `desktop-menu-configuration.mdc` - App menu, context menu, tray menu
|
||||
- `desktop-window-management.mdc` - Window creation, state management, multi-window
|
||||
- `desktop-controller-tests.mdc` - Controller unit testing guide
|
||||
|
||||
**Development Tools**
|
||||
|
||||
- `i18n.mdc` - Internationalization workflow
|
||||
- `debug.mdc` - Debugging strategies
|
||||
Reference in New Issue
Block a user