|
| 1 | +# Jamulus — Agent Instructions |
| 2 | + |
| 3 | +Real-time networked music jamming app. Qt/C++ qmake project. Client and server share one codebase; entry point: `src/main.cpp`. Configure `CONFIG` flags in `Jamulus.pro`. |
| 4 | + |
| 5 | +**Make the smallest possible change. One logical change per PR. Never mix refactoring with fixes/features.** |
| 6 | + |
| 7 | +Priority order: Stability > Low latency / real-time safety > Backwards compatibility > Maintainability > New features. This order resolves conflicts only — new features are welcome. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Build |
| 12 | + |
| 13 | +Linux: `qmake && make` (use `qmake-qt5` on Fedora). Headless server: `qmake "CONFIG+=headless serveronly" && make`. First run: `git submodule update --init` (oboe for Android). Run `make distclean` before re-running `qmake` with different `CONFIG` flags. Full per-platform table: `COMPILING.md`. |
| 14 | + |
| 15 | +macOS: `qmake QMAKE_APPLE_DEVICE_ARCHS=arm64 QT_ARCH=arm64 -spec macx-xcode Jamulus.pro` (Use `x86_64` on Intel Macs; `macx-clang` if using `make`). Then `xcodebuild build`, and `macdeployqt ./{Debug,Release}/Jamulus.app`. |
| 16 | + |
| 17 | +**Testing:** run headless server (args `-s -n`), connect a client (e.g. via: `-n -c localhost`; may need jackd running on Linux. Run dummy Jack via: `jackd -d dummy`), exercise the change; use the JSON-RPC API (`docs/JSON-RPC.md`) where possible. State what you tested in the PR with evidence. GitHub Actions builds multiple platforms — on failure read the failing step's log. |
| 18 | + |
| 19 | +## Never Do |
| 20 | + |
| 21 | +**`Never Do` rules are absolute** |
| 22 | + |
| 23 | +- Introduce code that prevents processing of audio within the minimum cycle time for any frame (i.e. worst case must remain viable); DO test this and produce evidence to support the change |
| 24 | + - this covers sound process in `src/sound`, network processing in `src/socket.cpp` and mixing in `src/server.cpp` |
| 25 | + - potential problems include (but not limited to): memory allocation, file I/O, locks |
| 26 | + - where possible, move processing off the real-time thread with queued signals |
| 27 | +- Trust values from remote clients — validate size/bounds on all network input (malformed input crashes). |
| 28 | +- Edit generated files (`moc_*.cpp`, `ui_*.h`, `qrc_*.cpp`, `*.qm`) — regenerate; don't edit/reformat third-party code in `libs/`. |
| 29 | +- Edit `ChangeLog` directly — use a `CHANGELOG:` line in the PR. |
| 30 | + |
| 31 | +## Always |
| 32 | + |
| 33 | +- Attach test evidence (logs/output) to the PR — never just assert something works. |
| 34 | +- Say so if you did not run or verify something. |
| 35 | + |
| 36 | +## Ask first |
| 37 | + |
| 38 | +- Architecture changes (networking/protocol, threading, build system) — open an issue to discuss (see `CONTRIBUTING.md`). |
| 39 | + |
| 40 | +## Qt / portability |
| 41 | + |
| 42 | +- Minimum Qt: **5.12.2**. Qt 6 recommended (iOS: Qt 5.15+ required, Qt 6 iOS buggy). Guard newer APIs with `#if QT_VERSION >= QT_VERSION_CHECK(...)`. |
| 43 | +- C++11 (C++17 on Android for Oboe). |
| 44 | +- Preserve platform support. |
| 45 | +- Desktop: Windows 10+, macOS 10.10+, Ubuntu 20.04+/Debian 11+. |
| 46 | + |
| 47 | +## Style (C / C++ / Obj-C++) |
| 48 | + |
| 49 | +- **CI uses clang-format** (version in `.github/workflows/coding-style-check.yml`). |
| 50 | +- Run `make clang_format` before committing (works only after qmake). |
| 51 | +- CI runs **shellcheck + shfmt** on `.sh` files; **pylint** (config: `.pylintrc`) on `.py` files in `tools/`. |
| 52 | +- New contributions: AGPL 3.0+ license header. Pre-3.12.1dev code: GPL 3.0+ (see `CONTRIBUTING.md`). |
| 53 | +- Use `tr ( "Hello %1" ).arg ( name )` for user-facing strings — never string concatenation. |
| 54 | + |
| 55 | +## JSON-RPC |
| 56 | + |
| 57 | +- Changing RPC methods (e.g. `src/clientrpc.cpp` / `src/serverrpc.cpp`) requires regenerating `docs/JSON-RPC.md` with `tools/generate_json_rpc_docs.py` (CI fails otherwise). |
| 58 | +- Requires `--jsonrpcport` + `--jsonrpcsecretfile` at runtime. Binds to localhost by default. Secret requires ≥16 characters. |
| 59 | + |
| 60 | +## PR expectations |
| 61 | + |
| 62 | +- One logical change per PR — no unrelated cleanup or reformatting of untouched code. Discuss features in an issue before implementing. See `CONTRIBUTING.md`. |
| 63 | +- Branch names starting with `autobuild` trigger CI builds on your fork. |
| 64 | +- Follow `.github/pull_request_template.md`. Include `CHANGELOG:` line. Add `AUTOBUILD: Please build all targets` for skipped targets (iOS, Windows JACK, Linux armhf/arm64) if touched; see `.github/workflows/autobuild.yml`. |
| 65 | +- Builds? Tested? Smallest change possible? Self reviewed against "Priority order" above? |
| 66 | +- Disclose AI-generated text at the end of Comments/PRs. (e.g: `> 🤖 Used AI: <model>, <harness>`) — never in code comments. |
| 67 | + |
| 68 | +## Read when relevant |
| 69 | + |
| 70 | +- `CONTRIBUTING.md` — process, style, licensing |
| 71 | +- `COMPILING.md` — full build per platform, CONFIG flags table |
| 72 | +- `docs/JAMULUS_PROTOCOL.md` — network protocol, packet IDs, ack rules |
| 73 | +- `SECURITY.md` — security reporting |
0 commit comments