Skip to content

chore: update .gitignore to exclude playwright reports, generated #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .cursor/rules/extension.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
description:
globs: extension/**
alwaysApply: false
---
description: extension project development guidelines
- Prefer using the shadcn/ui component library for UI implementation
- Use Tailwind CSS for consistent styling
- For Chrome extension development, follow Manifest V3 specification
- For unfamiliar APIs, query usage via api docs integrated in mcp
- Implement components elegantly and aesthetically; avoid redundancy and repetition
12 changes: 12 additions & 0 deletions .cursor/rules/frontend.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
description:
globs: frontend/**
alwaysApply: false
---
description: Frontend Development Code Guidelines

- When writing frontend code, prioritize using Next.js as the framework
- Prefer the combination of shadcn/ui and Tailwind CSS for UI components
- Do not use Next.js API routes (/api); always use backend APIs for all API requests
- If the backend API is unclear or in question, use the MCP api docs tool to find the relevant API definition-
- The UI library should be isolated from the code base and placed in components/ui
130 changes: 9 additions & 121 deletions .cursor/rules/python.mdc
Original file line number Diff line number Diff line change
@@ -1,125 +1,13 @@
---
description:
globs:
globs: backend/app/**/*.py
alwaysApply: false
---
---
description: Python best practices and patterns for modern software development with Flask and SQLite
globs: **/*.py, src/**/*.py, tests/**/*.py
---

# Python Best Practices

## Project Structure
- Use src-layout with `src/your_package_name/`
- Place tests in `tests/` directory parallel to `src/`
- Keep configuration in `config/` or as environment variables
- Store requirements in `requirements.txt` or `pyproject.toml`
- Place static files in `static/` directory
- Use `templates/` for Jinja2 templates

## Code Style
- Follow Black code formatting
- Use isort for import sorting
- Follow PEP 8 naming conventions:
- snake_case for functions and variables
- PascalCase for classes
- UPPER_CASE for constants
- Maximum line length of 88 characters (Black default)
- Use absolute imports over relative imports

## Type Hints
- Use type hints for all function parameters and returns
- Import types from `typing` module
- Use `Optional[Type]` instead of `Type | None`
- Use `TypeVar` for generic types
- Define custom types in `types.py`
- Use `Protocol` for duck typing

## Flask Structure
- Use Flask factory pattern
- Organize routes using Blueprints
- Use Flask-SQLAlchemy for database
- Implement proper error handlers
- Use Flask-Login for authentication
- Structure views with proper separation of concerns

## Database
- Use SQLAlchemy ORM
- Implement database migrations with Alembic
- Use proper connection pooling
- Define models in separate modules
- Implement proper relationships
- Use proper indexing strategies

## Authentication
- Use Flask-Login for session management
- Implement Google OAuth using Flask-OAuth
- Hash passwords with bcrypt
- Use proper session security
- Implement CSRF protection
- Use proper role-based access control

## API Design
- Use Flask-RESTful for REST APIs
- Implement proper request validation
- Use proper HTTP status codes
- Handle errors consistently
- Use proper response formats
- Implement proper rate limiting

## Testing
- Use pytest for testing
- Write tests for all routes
- Use pytest-cov for coverage
- Implement proper fixtures
- Use proper mocking with pytest-mock
- Test all error scenarios

## Security
- Use HTTPS in production
- Implement proper CORS
- Sanitize all user inputs
- Use proper session configuration
- Implement proper logging
- Follow OWASP guidelines

## Performance
- Use proper caching with Flask-Caching
- Implement database query optimization
- Use proper connection pooling
- Implement proper pagination
- Use background tasks for heavy operations
- Monitor application performance

## Error Handling
- Create custom exception classes
- Use proper try-except blocks
- Implement proper logging
- Return proper error responses
- Handle edge cases properly
- Use proper error messages

## Documentation
- Use Google-style docstrings
- Document all public APIs
- Keep README.md updated
- Use proper inline comments
- Generate API documentation
- Document environment setup

## Development Workflow
- Use virtual environments (venv)
- Implement pre-commit hooks
- Use proper Git workflow
- Follow semantic versioning
- Use proper CI/CD practices
- Implement proper logging

## Dependencies
- Pin dependency versions
- Use requirements.txt for production
- Separate dev dependencies
- Use proper package versions
- Regularly update dependencies
- Check for security vulnerabilities
- Organize routes in api/routes/, configs in core/config.py, and manage all sensitive settings via environment variables
- Place ORM models in models/; use Alembic for migrations
- Use HTTPOnly Cookie or Bearer Token for authentication; hash passwords with bcrypt
- Ensure consistent API response format and centralized exception handling
- Write tests with pytest to cover all routes and exception branches
- Manage dependencies in pyproject.toml; use .venv/ for virtual environments
- All code comments and docstrings must be in English using Google style
- Keep README.md, Swagger docs, and API references up to date
1 change: 1 addition & 0 deletions .cursor/rules/tdd-sequential-api-flow.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Design with Test-Driven Development + sequential thinking + API documentation re
4. **Implement Minimally**
- Write code that passes tests
- Follow your sequential thought chain

5. **Refactor & Validate**
- Clean up while maintaining passing tests
- Verify all requirements are met
14 changes: 14 additions & 0 deletions .cursor/rules/ui-colors.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
description:
globs:
alwaysApply: false
---
- Use black, white, and gray as the base colors for all interfaces. Main text should be black or dark gray, secondary text should use medium gray, and dividers/borders should use very light gray.
- Use the theme color (such as blue #3366FF or green #2EC27E) for interactive elements like action buttons and links.
- Highlight summaries and keywords with yellow (#FFF8DC) or a light blue background, combined with bold text.
- Semantic color system includes: Primary (#3B82F6/#2EC27E), Info (#0284C7), Success (#16A34A), Warning (#F59E0B), Error (#DC2626), Highlight (#FEF9C3).
- Support light and dark themes. Color is managed through theme tokens and semantic colors to maintain consistency, not by direct inversion.
- Recommend providing 3–5 theme options (such as Calm Blue, Rhythm Green, Midnight Black, Classic Gray), as well as highlight color customization, to ensure both consistency and adaptability.
- Avoid large areas of bright colors or complex gradient backgrounds. Emphasize information hierarchy and minimize visual distractions.
- Encourage continuous iteration and maintenance of components and color schemes. For scenarios not covered, communicate with product/design teams.
- Strive for an interface that is as elegant and visually appealing as possible, with a minimalist and refined high-end feel.
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ OR_SITE_URL="https://openrouter.ai/api/v1"
OR_APP_NAME="LiteLLM Nexus app"
OR_API_KEY="sk-or-api03-1234567890"

# OPENAI
OPENAI_API_KEY="sk-"
OPENAI_BASE_URL=""

# github model api key
GITHUB_API_KEY=""

# volcengine model api key
VOLCENGINE_API_KEY=""
VOLCENGINE_BASE_URL=""

# Test environment configuration example (port number +1), multiple sets of services are deployed simultaneously on the same machine
# TRAEFIK_HTTP_PORT=81
# TRAEFIK_HTTPS_PORT=444
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ backend-test: backend-install
@echo "===========> Running backend tests with coverage"
@source $(BACKEND_DIR)/.venv/bin/activate && \
cd $(BACKEND_DIR) && \
@bash scripts/tests-start.sh
bash scripts/tests-start.sh

## backend-lint: Run backend linters
.PHONY: backend-lint
Expand Down Expand Up @@ -455,7 +455,13 @@ admin-test: admin-install
@echo "===========> Running admin tests"
@echo "===========> Tests temporarily skipped due to network issues"
@echo "===========> Consider running tests manually when network is stable"
@true
@cd $(ADMIN_DIR) && $(PNPM) test

## admin-test-ui: Run admin tests with UI
.PHONY: admin-test-ui
admin-test-ui: admin-install
@echo "===========> Running admin tests with UI"
@cd $(ADMIN_DIR) && $(PNPM) test --ui

## admin-lint: Run admin linters
.PHONY: admin-lint
Expand Down
5 changes: 4 additions & 1 deletion admin/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'dotenv/config'
*/
export default defineConfig({
testDir: './tests',
timeout: 30 * 1000,
timeout: 60 * 1000,
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand All @@ -29,6 +29,9 @@ export default defineConfig({

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',

// 添加截图设置
screenshot: 'on',
},

/* Configure projects for major browsers */
Expand Down
Loading
Loading