mirror of
https://github.com/Egonex-AI/Understand-Anything.git
synced 2026-06-22 10:58:03 +08:00
b0cb17793a
Introduce keyboard shortcuts to the dashboard and add contributor docs. Adds a reusable useKeyboardShortcuts hook (with formatShortcutKey), a KeyboardShortcutsHelp modal component, and integrates shortcuts into App.tsx (registering keys like ?, Escape, /, ArrowLeft/Right, l, d and wiring store actions). Adds related styles (.glass-heavy, .kbd) to index.css. Also adds a comprehensive CONTRIBUTING.md with setup, workflow, testing, and PR guidelines.
6.7 KiB
6.7 KiB
Contributing to Understand Anything
Thank you for your interest in contributing to Understand Anything! This document provides guidelines and instructions for contributing to the project.
🌟 Ways to Contribute
- Bug Reports: Found a bug? Open an issue with detailed reproduction steps
- Feature Requests: Have an idea? Share it in the issues section
- Documentation: Improve or translate documentation
- Code: Fix bugs, add features, or improve performance
- Testing: Write tests to improve code coverage
🚀 Getting Started
Prerequisites
- Node.js >= 22 (developed on v24)
- pnpm >= 10 (pinned via
packageManagerfield in rootpackage.json) - Git for version control
Setup
-
Fork and Clone
git clone https://github.com/YOUR_USERNAME/Understand-Anything.git cd Understand-Anything -
Install Dependencies
pnpm install -
Build Core Package
pnpm --filter @understand-anything/core build -
Run Tests
pnpm --filter @understand-anything/core test pnpm --filter @understand-anything/skill test -
Start Dashboard (Optional)
pnpm dev:dashboard
📝 Development Workflow
1. Create a Branch
Create a descriptive branch name:
git checkout -b feat/my-feature # For new features
git checkout -b fix/bug-description # For bug fixes
git checkout -b docs/update-readme # For documentation
2. Make Changes
- Write clean, readable code
- Follow existing code style and conventions
- Add tests for new functionality
- Update documentation as needed
3. Test Your Changes
# Run all tests
pnpm --filter @understand-anything/core test
pnpm --filter @understand-anything/skill test
# Run linter
pnpm lint
# Build packages
pnpm build
4. Commit Your Changes
Write clear, descriptive commit messages:
git add .
git commit -m "feat: add keyboard shortcuts to dashboard"
Commit Message Convention:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, etc.)refactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
5. Push and Create Pull Request
git push origin your-branch-name
Then open a Pull Request on GitHub with:
- Clear title describing the change
- Detailed description of what changed and why
- Link to related issues (if any)
- Screenshots (for UI changes)
🧪 Testing Guidelines
Writing Tests
- Use Vitest for testing
- Place tests in
__tests__directories or*.test.tsfiles - Aim for high test coverage for new features
- Test edge cases and error conditions
Example test structure:
import { describe, it, expect } from 'vitest';
describe('MyFeature', () => {
it('should do something', () => {
// Arrange
const input = 'test';
// Act
const result = myFunction(input);
// Assert
expect(result).toBe('expected');
});
});
Running Tests
# Run all tests
pnpm test
# Run tests for specific package
pnpm --filter @understand-anything/core test
# Run tests in watch mode
pnpm --filter @understand-anything/core test --watch
📚 Code Style Guidelines
TypeScript
- Use TypeScript strict mode
- Define explicit types for function parameters and return values
- Avoid
anytype - useunknownif type is truly unknown - Use interfaces for object shapes
- Use type aliases for unions and complex types
Formatting
- The project uses ESLint for code quality
- Consistent indentation (2 spaces)
- Use meaningful variable and function names
- Keep functions small and focused
React/Dashboard
- Use functional components with hooks
- Keep components focused and single-purpose
- Use Zustand for state management
- Follow the existing component structure
File Organization
understand-anything-plugin/
├── packages/
│ ├── core/ # Core analysis engine
│ │ ├── src/
│ │ └── package.json
│ └── dashboard/ # React dashboard
│ ├── src/
│ │ ├── components/
│ │ ├── utils/
│ │ └── store.ts
│ └── package.json
├── src/ # Plugin skills implementation
├── agents/ # AI agent prompts
└── skills/ # Skill definitions
🌍 Translation Guidelines
Adding a New Language
- Create
README.{language-code}.md(e.g.,README.fr-FR.md) - Translate all sections while maintaining formatting
- Update main
README.mdto include language link - Keep technical terms in English where appropriate
- Ensure all links still work
Example:
<a href="README.md">English</a> | <a href="README.fr-FR.md">Français</a>
🐛 Bug Reports
When reporting bugs, include:
- Description: Clear description of the issue
- Steps to Reproduce: Detailed steps to reproduce the bug
- Expected Behavior: What you expected to happen
- Actual Behavior: What actually happened
- Environment: OS, Node version, pnpm version
- Screenshots: If applicable
- Error Messages: Full error output
💡 Feature Requests
When requesting features:
- Use Case: Describe the problem you're trying to solve
- Proposed Solution: How you envision the feature working
- Alternatives: Other solutions you've considered
- Additional Context: Any other relevant information
📋 Pull Request Checklist
Before submitting a PR, ensure:
- Code follows the project's style guidelines
- All tests pass (
pnpm test) - New code has test coverage
- Documentation is updated (if needed)
- Commit messages follow convention
- PR description clearly explains changes
- No console.log or debug code left behind
- Branch is up to date with main
🤝 Code Review Process
- Automated Checks: CI runs tests and linting
- Maintainer Review: Project maintainers review the code
- Feedback: Address any requested changes
- Approval: Once approved, PR will be merged
- Cleanup: Delete your branch after merge
📞 Getting Help
- Issues: For bugs and feature requests
- Discussions: For questions and general discussion
- Documentation: Check existing docs first
📄 License
By contributing, you agree that your contributions will be licensed under the MIT License.
🙏 Recognition
Contributors will be recognized in:
- GitHub contributors list
- Release notes (for significant contributions)
- Special mentions for exceptional contributions
Thank you for contributing to Understand Anything! Your contributions help make code understanding accessible to everyone. 🚀