|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Dos and Don'ts |
| 4 | + |
| 5 | +- Do run `nvm use` (reads the version pinned in `.nvmrc`) before `npm ci`; don't rely on ad-hoc Node versions. |
| 6 | +- Do lint (`npm run lint -- lib/...`) and run focused tests; don't commit artifacts from `public/build/`. |
| 7 | +- Do sign commits with `git commit -s`; don't rewrite reviewed history. |
| 8 | +- Do update `public/docs/release-notes.md` and `package.json` on `release/*`; CI verifies both. |
| 9 | + |
| 10 | +## Project Structure & Module Organization |
| 11 | + |
| 12 | +- `app.js` boots Express, Socket.IO, metrics, and pulls settings from `lib/**` modules. |
| 13 | +- Scripts and utilities live in `bin/` and `utils/`; base config defaults reside in `config.json.example`. |
| 14 | +- Front-end assets/locales live in `public/` and `locales/`; docs live in `public/docs/`. |
| 15 | +- Tests mirror runtime folders under `test/` with shared fakes in `test/testDoubles/`, and CI workflows live in `.github/workflows/`. |
| 16 | + |
| 17 | +## Build, Test, and Development Commands |
| 18 | + |
| 19 | +- Install once per checkout: `nvm use` (uses `.nvmrc`) then `npm ci` (mirrors `.github/workflows/build.yml`). |
| 20 | +- `npm run dev` watches webpack; `npm run build` emits production bundles to `public/build/`. |
| 21 | +- `npm start` runs `sequelize db:migrate` before serving. |
| 22 | +- Lint via `npm run lint -- lib/realtime/realtime.js`; validate JSON with `npm run jsonlint`. |
| 23 | +- Targeted tests: `npx mocha --require intelli-espower-loader --exit test/realtime/connection.test.js`; use `npm run test:ci` or `npm run coverage` for the full suite. |
| 24 | + |
| 25 | +## Coding Style & Naming Conventions |
| 26 | + |
| 27 | +- StandardJS and `.editorconfig` enforce two-space indents, no semicolons, and single quotes. |
| 28 | +- Keep filenames lowercase/camelCase in `lib/`, kebab-case for web assets, and reuse `test/testDoubles/` helpers for specs. |
| 29 | + |
| 30 | +## Testing Guidelines |
| 31 | + |
| 32 | +- Mocha + Power Assert run through `npm run mocha`; `nyc` covers `app.js` and `lib/**`. |
| 33 | +- Place specs beside their domain (`test/realtime/*.test.js`, `test/auth/*.test.js`) and keep them deterministic via shared fakes. |
| 34 | + |
| 35 | +## Commit & Pull Request Guidelines |
| 36 | + |
| 37 | +- Keep commits atomic, DCO-signed, and in `type: summary` form (for example `fix: empty exported notes in the archive`). |
| 38 | +- Reference issues, document config/schema changes, attach `npm run test:ci` output or UI evidence when relevant, ensure `release/*` PRs update `public/docs/release-notes.md` and `package.json`, and gather sign-off from two other developers per `CONTRIBUTING.md`. |
| 39 | + |
| 40 | +## Safety & Permissions |
| 41 | + |
| 42 | +- Safe: read/list files, adjust docs, run scoped lint/test commands. |
| 43 | +- Ask first: new dependencies, renames/deletions, build or CI edits, Docker publish flows, or other large refactors. |
| 44 | +- Never force-push shared branches, wipe data stores, or leak secrets. |
| 45 | + |
| 46 | +## Security & Configuration Tips |
| 47 | + |
| 48 | +- Seed new configs from `config.json.example` and inject secrets via environment variables. |
| 49 | +- Security headers default in `lib/config/default.js` (override via `config.json`), with CSP logic in `lib/csp.js`; image upload adapters under `lib/imageRouter/` (for example `lib/imageRouter/s3.js`) need local S3/MinIO verification and documented port/TLS expectations. |
0 commit comments