|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for your interest in contributing to opencode-llm-proxy. |
| 4 | + |
| 5 | +## Getting started |
| 6 | + |
| 7 | +```bash |
| 8 | +git clone https://github.com/KochC/opencode-llm-proxy.git |
| 9 | +cd opencode-llm-proxy |
| 10 | +npm install |
| 11 | +``` |
| 12 | + |
| 13 | +Run the tests: |
| 14 | + |
| 15 | +```bash |
| 16 | +npm test |
| 17 | +``` |
| 18 | + |
| 19 | +Run the linter: |
| 20 | + |
| 21 | +```bash |
| 22 | +npm run lint |
| 23 | +``` |
| 24 | + |
| 25 | +## How to contribute |
| 26 | + |
| 27 | +### Reporting bugs |
| 28 | + |
| 29 | +Open a [bug report](https://github.com/KochC/opencode-llm-proxy/issues/new?template=bug_report.yml). Include: |
| 30 | + |
| 31 | +- What you did |
| 32 | +- What you expected |
| 33 | +- What actually happened |
| 34 | +- Your Node.js / Bun version and OS |
| 35 | + |
| 36 | +### Suggesting features |
| 37 | + |
| 38 | +Open a [feature request](https://github.com/KochC/opencode-llm-proxy/issues/new?template=feature_request.yml) describing the use case. |
| 39 | + |
| 40 | +### Submitting a pull request |
| 41 | + |
| 42 | +1. Fork the repo and create a branch from `dev` (not `main`) |
| 43 | +2. Make your changes |
| 44 | +3. Add or update tests in `index.test.js` — all 112+ tests must pass |
| 45 | +4. Lint passes: `npm run lint` |
| 46 | +5. Commit using [Conventional Commits](https://www.conventionalcommits.org/): |
| 47 | + - `fix:` for bug fixes (triggers a patch release) |
| 48 | + - `feat:` for new features (triggers a minor release) |
| 49 | + - `docs:` / `chore:` / `test:` for everything else (no release) |
| 50 | +6. Open a PR against the `dev` branch |
| 51 | + |
| 52 | +## Branch model |
| 53 | + |
| 54 | +``` |
| 55 | +dev ──► main ──► npm (via Release Please) |
| 56 | +``` |
| 57 | + |
| 58 | +- All work goes on `dev` |
| 59 | +- `main` is release-only — only Release Please PRs merge directly there |
| 60 | +- Do not open PRs against `main` |
| 61 | + |
| 62 | +## Tests |
| 63 | + |
| 64 | +Tests use the Node.js built-in test runner — no external framework needed. |
| 65 | + |
| 66 | +```bash |
| 67 | +node --test # run once |
| 68 | +node --test --watch # watch mode |
| 69 | +node --test --experimental-test-coverage # with coverage |
| 70 | +``` |
| 71 | + |
| 72 | +Tests mock the OpenCode SDK client entirely — no real LLM calls are made. |
| 73 | + |
| 74 | +## Code style |
| 75 | + |
| 76 | +ESLint enforces style. Run `npm run lint` before pushing. The config is in `eslint.config.js`. |
| 77 | + |
| 78 | +Key conventions in the codebase: |
| 79 | + |
| 80 | +- Pure functions are exported for testability (`normalizeMessages`, `buildPrompt`, etc.) |
| 81 | +- Each API format (OpenAI, Anthropic, Gemini) has its own section in `index.js` |
| 82 | +- Error responses mirror the format of the target API (OpenAI errors for `/v1/*`, Anthropic errors for `/v1/messages`, etc.) |
0 commit comments