|
| 1 | +# Contributing to OTG Code |
| 2 | + |
| 3 | +Thanks for your interest in improving OTG Code! This guide covers the dev |
| 4 | +setup, conventions, and PR workflow. |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | + |
| 8 | +- **Node.js** `>= 20.19` |
| 9 | +- **pnpm** `>= 10` (`corepack enable` will provide it) |
| 10 | + |
| 11 | +## Setup |
| 12 | + |
| 13 | +```bash |
| 14 | +pnpm install |
| 15 | +``` |
| 16 | + |
| 17 | +### Run it |
| 18 | + |
| 19 | +```bash |
| 20 | +pnpm dev # local dev server (no tunnel) |
| 21 | +bash start.sh # production build + server + Cloudflare quick tunnel |
| 22 | +``` |
| 23 | + |
| 24 | +By default the app runs on http://localhost:7777 (override with `OTG_PORT`). |
| 25 | + |
| 26 | +## Checks (run before opening a PR) |
| 27 | + |
| 28 | +CI runs these on every PR; they must pass. |
| 29 | + |
| 30 | +```bash |
| 31 | +pnpm lint # Biome lint + format check (biome ci) |
| 32 | +pnpm format # auto-fix formatting and safe lint issues |
| 33 | +pnpm typecheck # React Router typegen + tsc |
| 34 | +pnpm run build # production build |
| 35 | +``` |
| 36 | + |
| 37 | +## Code style |
| 38 | + |
| 39 | +Formatting and linting are handled by [Biome](https://biomejs.dev) — config in |
| 40 | +`biome.json`. Run `pnpm format` to auto-apply. Don't hand-format; let Biome |
| 41 | +decide. Match the conventions of the surrounding code. |
| 42 | + |
| 43 | +## Commit messages — Conventional Commits |
| 44 | + |
| 45 | +This project uses [Conventional Commits](https://www.conventionalcommits.org). |
| 46 | +It keeps history readable and makes the `CHANGELOG.md` easy to assemble per |
| 47 | +release. |
| 48 | + |
| 49 | +Common types: |
| 50 | + |
| 51 | +- `feat:` — a new feature |
| 52 | +- `fix:` — a bug fix |
| 53 | +- `chore:`, `docs:`, `style:`, `refactor:`, `test:`, `ci:` — supporting changes |
| 54 | + |
| 55 | +Example: `fix: flip file menu upward near the bottom of the pane` |
| 56 | + |
| 57 | +Security fixes should use `fix:` and are listed under a **Security** section in |
| 58 | +the changelog — there is no separate security-advisory file. |
| 59 | + |
| 60 | +## Pull request workflow |
| 61 | + |
| 62 | +1. Branch off `main`. |
| 63 | +2. Make your change; keep commits focused and Conventionally named. |
| 64 | +3. Ensure `pnpm lint`, `pnpm typecheck`, and `pnpm run build` pass. |
| 65 | +4. Open a PR against `main` with a short description of what and why. |
| 66 | + |
| 67 | +## Releasing (maintainers) |
| 68 | + |
| 69 | +Releases are cut manually: |
| 70 | + |
| 71 | +1. Update the version in `package.json` and add a section to `CHANGELOG.md` |
| 72 | + (group changes under Added / Changed / Fixed / Security). |
| 73 | +2. Merge to `main`. |
| 74 | +3. Tag and push: `git tag -a vX.Y.Z -m "Release vX.Y.Z" && git push origin vX.Y.Z`. |
| 75 | +4. Create a GitHub Release for the tag, using the changelog section as the notes. |
| 76 | + |
| 77 | +The in-app version (shown in the header) is read from `package.json` at build |
| 78 | +time, so bumping `package.json` is enough to update it. |
| 79 | + |
| 80 | +## Project layout |
| 81 | + |
| 82 | +``` |
| 83 | +app/ React Router (SSR) frontend |
| 84 | + components/ UI — browser/, files/, terminal/ |
| 85 | + routes/ routes + routes/api/ (file ops, tmux, system info) |
| 86 | + stores/ Zustand stores |
| 87 | + lib/ shared client helpers (clipboard, socket, constants) |
| 88 | +server/ Node backend |
| 89 | + index.ts Express + Socket.IO entry |
| 90 | + pty-manager.ts node-pty terminal sessions |
| 91 | + socket-handlers.ts realtime terminal I/O |
| 92 | + proxy.ts reverse proxy |
| 93 | + tunnel.ts Cloudflare quick-tunnel management |
| 94 | +start.sh builds, installs cloudflared, runs server + tunnel |
| 95 | +``` |
0 commit comments