You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.8 KiB
2.8 KiB
Claude Code Rules for Dify Project
Docker Commands
-
Always rebuild containers when changes are made
- Use
docker-compose up [container-name] --build -dwhen:- Web container code is changed
- API container code is changed
- Environment variables (.env) are modified
- Dependencies are updated
- Example:
docker-compose up web --build -d
- Use
-
Nginx proxy restart may be required
- After significant configuration changes, restart the nginx proxy:
cd ../nginx-proxy && docker-compose up -d
- This is especially important for:
- Port mapping changes
- SSL certificate updates
- Proxy configuration modifications
- After significant configuration changes, restart the nginx proxy:
Testing Commands
- Run linting and type checking
- API (Python):
cd api && ruff check . - Web (TypeScript):
cd web && npm run lint && npm run type-check
- API (Python):
Git Workflow
- Never commit unless explicitly asked
- Only create commits when the user specifically requests it
- Always check git status before committing
File Management
- Prefer editing over creating
- Always edit existing files when possible
- Only create new files when absolutely necessary
- Never create documentation files unless explicitly requested
MFA (Multi-Factor Authentication) Implementation Issues
-
Modal vs Dialog Component Usage
- Problem: Using Dialog component (z-index: 40) instead of Modal (z-index: 70) can cause click-blocking issues
- Solution: Always use Modal component for account settings and similar UI interactions
- Pattern:
- Modal: For settings, configurations, and single-purpose interactions
- Dialog: Reserved for multi-step wizards and critical actions
-
MenuDialog Structure Fix
- Problem: Fixed overlay inside DialogPanel blocks all clicks
- Solution: Separate overlay and content layers with proper structure:
<Dialog> <TransitionChild> <div className="fixed inset-0 bg-overlay pointer-events-none" /> </TransitionChild> <div className="fixed inset-0 overflow-y-auto pointer-events-none"> <DialogPanel className="pointer-events-auto"> {content} </DialogPanel> </div> </Dialog>
-
502 Error Resolution
- Problem: Nginx-proxy caches old container IPs after restart
- Solution:
- Restart all containers:
docker-compose down && docker-compose up -d - Reload nginx configuration:
docker exec nginx-proxy nginx -s reload - May need to restart nginx-proxy separately
- Restart all containers:
-
Debug Tips for Click Issues
- Add debug styling with distinct colors and borders
- Use console.log for hover and click events
- Check z-index layering with browser developer tools
- Verify pointer-events CSS property