diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..4f1aa5c --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,101 @@ +# Code of Conduct + +## Our Commitment + +CodePapi AI is committed to providing a welcoming, inclusive, and harassment-free community for all contributors, maintainers, and users, regardless of: +- Age, body size, disability, ethnicity, gender identity, experience level, nationality, personal appearance, political beliefs, race, religion, sexual identity, or sexual orientation +- Any other characteristic protected by applicable law + +## Our Standards + +### Positive Behavior +- Use welcoming and inclusive language +- Be respectful of differing opinions, experiences, and viewpoints +- Accept constructive criticism gracefully +- Focus on what's best for the community +- Show empathy towards other community members +- Help new contributors feel welcome +- Acknowledge mistakes and learn from them + +### Unacceptable Behavior +- Harassment, intimidation, or threats of any kind +- Offensive comments related to personal characteristics +- Unwelcome sexual attention or advances +- Trolling, insulting remarks, or personal attacks +- Publishing others' private information without permission +- Other conduct that is clearly unprofessional or inappropriate +- Abuse of power or position of authority +- Disruptive behavior in discussions or PRs +- Spam, self-promotion, or commercial solicitation + +## Our Responsibilities + +Project maintainers are responsible for: +- Clarifying standards of acceptable behavior +- Taking appropriate action in response to violations +- Removing comments, commits, code, issues, and PRs that violate this Code of Conduct +- Banning contributors who violate this Code of Conduct + +Maintainers have the right and responsibility to remove comments or contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies to: +- All project spaces (GitHub issues, PRs, discussions, wiki) +- Project-related communication channels (Discord, Slack, mailing lists, etc.) +- Official project events and meetings +- Unofficial project spaces (third-party forums, social media, etc.) +- Private communications when discussing project business + +## Enforcement + +### Reporting Violations + +If you witness or experience a Code of Conduct violation, please report it by: + +1. **Email:** [conduct@example.com] with details about the incident +2. **GitHub:** Report to a maintainer directly if you're not comfortable emailing +3. **Anonymous:** You may report anonymously through a third-party tool (link to be provided) + +**Please include:** +- Description of the incident +- Involved parties (if safe to do so) +- Context and timestamps +- Any evidence (screenshots, links, etc.) +- How the incident affected you or the community + +### Investigation & Response + +All reports will be reviewed confidentially by the conduct committee. We will: +1. Acknowledge receipt within 48 hours +2. Investigate thoroughly and impartially +3. Reach out for additional information if needed +4. Communicate findings and actions taken +5. Maintain confidentiality of reporters + +### Consequences + +Depending on severity, responses may include: +- **First offense:** Written warning and temporary muting +- **Repeated violations:** Suspension from the project +- **Severe violations:** Permanent ban from the community +- **Legal violations:** Referral to appropriate authorities + +## Appeals + +If you believe you've been wrongfully sanctioned, you may appeal to: +- [appeals@example.com] within 14 days of the decision +- Provide new evidence or context not previously considered +- A different person will review your appeal + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html + +## Questions? + +If you have questions about this Code of Conduct, contact [conduct@example.com] + +--- + +**Thank you for helping make CodePapi AI a welcoming community for everyone!** ❤️ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..680d272 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,367 @@ +# Contributing to CodePapi AI + +Thank you for considering contributing to CodePapi AI! This document provides guidelines and instructions for contributing to the project. + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [Getting Started](#getting-started) +- [Development Workflow](#development-workflow) +- [Code Standards](#code-standards) +- [Commit Guidelines](#commit-guidelines) +- [Pull Request Process](#pull-request-process) +- [Testing](#testing) +- [Documentation](#documentation) +- [Questions](#questions) + +## Code of Conduct + +Please review and follow our [Code of Conduct](./CODE_OF_CONDUCT.md). By contributing, you agree to uphold these standards. + +## Getting Started + +### Prerequisites +- Node.js 18+ or Docker Desktop +- Git +- A GitHub account +- Familiarity with TypeScript/JavaScript + +### Fork and Clone + +```bash +# Fork on GitHub (click the fork button) + +# Clone your fork +git clone https://github.com/YOUR-USERNAME/codepapi-ai.git +cd codepapi-ai + +# Add upstream remote +git remote add upstream https://github.com/original-owner/codepapi-ai.git + +# Keep your fork updated +git fetch upstream +git merge upstream/main +``` + +## Development Workflow + +### Local Setup + +```bash +# Option 1: Docker (Recommended) +docker-compose up -d + +# Option 2: Local development +cd backend +npm install +npm run start:dev + +# In another terminal +cd frontend +npm install +npm run dev +``` + +### Create a Branch + +```bash +# Update main branch +git fetch upstream +git checkout main +git merge upstream/main + +# Create feature branch +git checkout -b feature/your-feature-name + +# Branch naming conventions: +# - feature/add-rust-support +# - fix/handle-large-files +# - docs/update-readme +# - refactor/simplify-converter +``` + +### Make Changes + +- Write clean, readable code +- Follow existing code style +- Add comments for complex logic +- Use descriptive variable/function names +- Keep functions small and focused + +### Lint Before Committing + +```bash +# Run Biome checks +npx @biomejs/biome check --apply . + +# This will auto-format your code and show any remaining issues +``` + +## Code Standards + +### TypeScript/JavaScript + +#### Style Guidelines +- **Use TypeScript:** Avoid `any` types when possible +- **Naming:** camelCase for variables/functions, PascalCase for classes +- **Constants:** UPPER_SNAKE_CASE for env vars and constants +- **Imports:** Organize alphabetically within each group +- **Line length:** Max 100 characters (Biome enforced) +- **Indentation:** 2 spaces (Biome enforced) + +#### Good Examples + +```typescript +// ✅ Good: Clear, typed, descriptive +interface CodeTranslation { + success: boolean; + code: string; + language: string; +} + +async function translateCode( + source: string, + from: string, + to: string +): Promise { + // implementation +} + +// ❌ Avoid: Vague, any type, unclear intent +async function process(data: any): any { + // implementation +} +``` + +#### Comments + +```typescript +// ❌ Bad: Explains what the code does (obvious) +// Add 1 to count +count = count + 1; + +// ✅ Good: Explains why or what it means +// Increment the conversion counter for analytics +count = count + 1; + +// ✅ Good: Complex logic gets a comment block +// Detect migration presets by checking if language ID includes a dash +// e.g., "react-ts" or "react-vue" are migrations +const isMigration = sourceLang.includes('-'); +``` + +### React Components + +```typescript +// ✅ Good: Props interface, clear component name, proper exports +interface LanguageSelectorProps { + value: string; + onChange: (lang: string) => void; + label: string; + disabled?: boolean; +} + +export const LanguageSelector: React.FC = ({ + value, + onChange, + label, + disabled, +}) => { + return ( + // JSX here + ); +}; + +// ❌ Avoid: No props typing, default exports, unclear names +export default (props) => { + // JSX here +}; +``` + +## Commit Guidelines + +### Message Format + +``` +(): + + + +