|
| 1 | +# Contributing to opencode-codebase-index |
| 2 | + |
| 3 | +Thank you for your interest in contributing! This document provides guidelines and information for contributors. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +1. **Fork the repository** on GitHub |
| 8 | +2. **Clone your fork** locally: |
| 9 | + ```bash |
| 10 | + git clone https://github.com/YOUR_USERNAME/opencode-codebase-index.git |
| 11 | + cd opencode-codebase-index |
| 12 | + ``` |
| 13 | +3. **Install dependencies**: |
| 14 | + ```bash |
| 15 | + npm install |
| 16 | + ``` |
| 17 | +4. **Build the project**: |
| 18 | + ```bash |
| 19 | + npm run build |
| 20 | + ``` |
| 21 | + |
| 22 | +## Development Setup |
| 23 | + |
| 24 | +### Prerequisites |
| 25 | + |
| 26 | +- Node.js >= 18 |
| 27 | +- Rust toolchain (for native module) |
| 28 | +- npm |
| 29 | + |
| 30 | +### Building |
| 31 | + |
| 32 | +```bash |
| 33 | +# Build everything (TypeScript + Rust) |
| 34 | +npm run build |
| 35 | + |
| 36 | +# Build only TypeScript |
| 37 | +npm run build:ts |
| 38 | + |
| 39 | +# Build only Rust native module |
| 40 | +npm run build:native |
| 41 | +``` |
| 42 | + |
| 43 | +### Testing |
| 44 | + |
| 45 | +```bash |
| 46 | +# Run all tests |
| 47 | +npm run test:run |
| 48 | + |
| 49 | +# Run tests in watch mode |
| 50 | +npm run test |
| 51 | + |
| 52 | +# Run Rust tests |
| 53 | +cd native && cargo test |
| 54 | +``` |
| 55 | + |
| 56 | +### Linting |
| 57 | + |
| 58 | +```bash |
| 59 | +# Run ESLint |
| 60 | +npm run lint |
| 61 | + |
| 62 | +# Run Clippy (Rust) |
| 63 | +cd native && cargo clippy |
| 64 | +``` |
| 65 | + |
| 66 | +## Making Changes |
| 67 | + |
| 68 | +1. **Create a feature branch**: |
| 69 | + ```bash |
| 70 | + git checkout -b feature/my-feature |
| 71 | + ``` |
| 72 | + |
| 73 | +2. **Make your changes** and add tests if applicable |
| 74 | + |
| 75 | +3. **Run checks** before committing: |
| 76 | + ```bash |
| 77 | + npm run build && npm run test:run && npm run lint |
| 78 | + ``` |
| 79 | + |
| 80 | +4. **Commit with a descriptive message**: |
| 81 | + ```bash |
| 82 | + git commit -m "feat: add my feature" |
| 83 | + ``` |
| 84 | + |
| 85 | + We follow [Conventional Commits](https://www.conventionalcommits.org/): |
| 86 | + - `feat:` - New feature |
| 87 | + - `fix:` - Bug fix |
| 88 | + - `docs:` - Documentation changes |
| 89 | + - `perf:` - Performance improvement |
| 90 | + - `refactor:` - Code refactoring |
| 91 | + - `test:` - Adding/updating tests |
| 92 | + - `chore:` - Maintenance tasks |
| 93 | + |
| 94 | +5. **Push and open a pull request**: |
| 95 | + ```bash |
| 96 | + git push origin feature/my-feature |
| 97 | + ``` |
| 98 | + |
| 99 | +## Pull Request Guidelines |
| 100 | + |
| 101 | +- Keep PRs focused and atomic |
| 102 | +- Include tests for new functionality |
| 103 | +- Update documentation if needed |
| 104 | +- Ensure CI passes before requesting review |
| 105 | + |
| 106 | +## Project Structure |
| 107 | + |
| 108 | +``` |
| 109 | +src/ # TypeScript source |
| 110 | + ├── indexer/ # Core indexing logic |
| 111 | + ├── embeddings/ # Embedding providers |
| 112 | + ├── tools/ # OpenCode tool definitions |
| 113 | + ├── native/ # Rust module wrapper |
| 114 | + └── config/ # Configuration schema |
| 115 | +
|
| 116 | +native/src/ # Rust native module |
| 117 | + ├── parser.rs # Tree-sitter parsing |
| 118 | + ├── store.rs # Vector storage |
| 119 | + └── inverted_index.rs # BM25 search |
| 120 | +
|
| 121 | +tests/ # Unit tests |
| 122 | +``` |
| 123 | + |
| 124 | +## Questions? |
| 125 | + |
| 126 | +Open an issue for any questions or concerns. We're happy to help! |
0 commit comments