|
| 1 | +# Contributing to GraphChat |
| 2 | + |
| 3 | +Thank you for your interest in contributing to GraphChat! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## 🌟 How to Contribute |
| 6 | + |
| 7 | +### Reporting Bugs |
| 8 | + |
| 9 | +Before creating bug reports, please check existing issues. When creating a bug report, include: |
| 10 | + |
| 11 | +- **Clear title and description** |
| 12 | +- **Steps to reproduce** the behavior |
| 13 | +- **Expected vs actual behavior** |
| 14 | +- **Screenshots** if applicable |
| 15 | +- **Environment details** (OS, Node version, browser) |
| 16 | + |
| 17 | +**Example:** |
| 18 | +```markdown |
| 19 | +**Bug**: Intent matching fails for multi-word phrases |
| 20 | + |
| 21 | +**Steps to Reproduce:** |
| 22 | +1. Start customer-support-escalation scenario |
| 23 | +2. Type "I am really frustrated with this" |
| 24 | +3. See incorrect intent detection |
| 25 | + |
| 26 | +**Expected:** Should detect "express-frustration" intent |
| 27 | +**Actual:** Detects generic inquiry |
| 28 | + |
| 29 | +**Environment:** Node 20, Chrome 120 |
| 30 | +``` |
| 31 | + |
| 32 | +### Suggesting Features |
| 33 | + |
| 34 | +Feature suggestions are welcome! Please provide: |
| 35 | + |
| 36 | +- **Use case**: Why is this feature needed? |
| 37 | +- **Proposed solution**: How should it work? |
| 38 | +- **Alternatives considered**: What other approaches exist? |
| 39 | +- **Additional context**: Screenshots, mockups, etc. |
| 40 | + |
| 41 | +### Pull Requests |
| 42 | + |
| 43 | +1. **Fork** the repository |
| 44 | +2. **Create a branch** from `main`: |
| 45 | + ```bash |
| 46 | + git checkout -b feature/amazing-feature |
| 47 | + ``` |
| 48 | +3. **Make your changes** |
| 49 | +4. **Run tests** and ensure they pass |
| 50 | +5. **Commit** with clear messages: |
| 51 | + ```bash |
| 52 | + git commit -m "feat: add amazing feature" |
| 53 | + ``` |
| 54 | +6. **Push** to your fork: |
| 55 | + ```bash |
| 56 | + git push origin feature/amazing-feature |
| 57 | + ``` |
| 58 | +7. **Open a Pull Request** |
| 59 | + |
| 60 | +### Commit Message Convention |
| 61 | + |
| 62 | +We follow [Conventional Commits](https://www.conventionalcommits.org/): |
| 63 | + |
| 64 | +- `feat:` New features |
| 65 | +- `fix:` Bug fixes |
| 66 | +- `docs:` Documentation changes |
| 67 | +- `style:` Code style changes (formatting, etc.) |
| 68 | +- `refactor:` Code refactoring |
| 69 | +- `test:` Test additions/changes |
| 70 | +- `chore:` Build process, tooling, etc. |
| 71 | + |
| 72 | +**Examples:** |
| 73 | +```bash |
| 74 | +feat: add emotion detection to intent engine |
| 75 | +fix: resolve graph viewer zoom issue in Safari |
| 76 | +docs: update API reference documentation |
| 77 | +refactor: simplify dialogue generator logic |
| 78 | +``` |
| 79 | + |
| 80 | +## 📋 Development Setup |
| 81 | + |
| 82 | +### Prerequisites |
| 83 | + |
| 84 | +- Node.js 18+ |
| 85 | +- npm 9+ |
| 86 | +- Git |
| 87 | + |
| 88 | +### Installation |
| 89 | + |
| 90 | +```bash |
| 91 | +# Fork and clone |
| 92 | +git clone https://github.com/YOUR_USERNAME/graphchat.git |
| 93 | +cd graphchat |
| 94 | + |
| 95 | +# Install dependencies |
| 96 | +npm install |
| 97 | + |
| 98 | +# Start development servers |
| 99 | +npm run dev |
| 100 | +``` |
| 101 | + |
| 102 | +### Running Tests |
| 103 | + |
| 104 | +```bash |
| 105 | +# All tests |
| 106 | +npm test |
| 107 | + |
| 108 | +# With coverage |
| 109 | +npm run test:coverage |
| 110 | + |
| 111 | +# Specific workspace |
| 112 | +npm run test --workspace @conversation-trainer/api |
| 113 | +``` |
| 114 | + |
| 115 | +### Building |
| 116 | + |
| 117 | +```bash |
| 118 | +# Build all packages |
| 119 | +npm run build |
| 120 | + |
| 121 | +# Build specific package |
| 122 | +npm run build --workspace @conversation-trainer/api |
| 123 | +``` |
| 124 | + |
| 125 | +## 📝 Scenario Creation |
| 126 | + |
| 127 | +When creating new scenarios: |
| 128 | + |
| 129 | +1. **Define clear learning objectives** |
| 130 | +2. **Create distinct personas** with backstories |
| 131 | +3. **Write diverse intent examples** (5+ per intent) |
| 132 | +4. **Add dialogue variations** to avoid repetition |
| 133 | +5. **Test thoroughly** with different inputs |
| 134 | +6. **Document difficulty and estimated duration** |
| 135 | + |
| 136 | +### Scenario Quality Checklist |
| 137 | + |
| 138 | +- [ ] Personas have clear goals and pain points |
| 139 | +- [ ] Intents have 5+ diverse examples |
| 140 | +- [ ] Dialogue variations (2+) per bot node |
| 141 | +- [ ] Emotions specified for key nodes |
| 142 | +- [ ] Learning objectives documented |
| 143 | +- [ ] All edges have appropriate triggers |
| 144 | +- [ ] Scenario validates successfully |
| 145 | + |
| 146 | +## 🎨 Code Style |
| 147 | + |
| 148 | +### TypeScript |
| 149 | + |
| 150 | +- Use strict mode |
| 151 | +- Define explicit types (avoid `any`) |
| 152 | +- Use interfaces for object shapes |
| 153 | +- Export types from `packages/types` |
| 154 | + |
| 155 | +### React |
| 156 | + |
| 157 | +- Use functional components with hooks |
| 158 | +- Prefer composition over inheritance |
| 159 | +- Keep components small and focused |
| 160 | +- Use TypeScript for props and state |
| 161 | + |
| 162 | +### Naming Conventions |
| 163 | + |
| 164 | +- **Files**: PascalCase for components, camelCase for utilities |
| 165 | +- **Components**: PascalCase (e.g., `ChatContainer`) |
| 166 | +- **Functions/Variables**: camelCase (e.g., `sendMessage`) |
| 167 | +- **Constants**: UPPER_SNAKE_CASE (e.g., `MAX_RETRIES`) |
| 168 | +- **Types/Interfaces**: PascalCase (e.g., `ConversationNode`) |
| 169 | + |
| 170 | +## 📖 Documentation |
| 171 | + |
| 172 | +When adding features, please update: |
| 173 | + |
| 174 | +- **README.md**: Feature overview and usage |
| 175 | +- **API Reference**: New endpoints or changes |
| 176 | +- **TypeScript types**: Update `packages/types` |
| 177 | +- **Comments**: Complex logic should be documented |
| 178 | + |
| 179 | +## 🚀 Release Process |
| 180 | + |
| 181 | +Releases are managed by maintainers. The process: |
| 182 | + |
| 183 | +1. Version bump in `package.json` files |
| 184 | +2. Update CHANGELOG.md |
| 185 | +3. Create git tag |
| 186 | +4. Publish to npm (for packages) |
| 187 | +5. Create GitHub release |
| 188 | + |
| 189 | +## 💬 Community |
| 190 | + |
| 191 | +- **Discord**: [Join our server](https://discord.gg/graphchat) |
| 192 | +- **Twitter**: [@GraphChat](https://twitter.com/graphchat) |
| 193 | +- **Email**: contributors@graphchat.dev |
| 194 | + |
| 195 | +## 🙏 Code of Conduct |
| 196 | + |
| 197 | +Please be respectful and constructive. We're committed to providing a welcoming environment for all contributors. |
| 198 | + |
| 199 | +--- |
| 200 | + |
| 201 | +Thank you for contributing to GraphChat! 🎉 |
0 commit comments