Thanks for your interest in contributing. This guide covers everything you need to get started.
Requirements:
- macOS (the app uses macOS-specific APIs for tray icons, hotkeys, and notifications)
- Rust nightly toolchain
Install the nightly toolchain:
rustup toolchain install nightlyClone and build:
git clone https://github.com/freeoxide/gpui-starter.git
cd gpui-app
cargo buildThe first build takes a while because it compiles GPUI and all dependencies. Subsequent builds are faster thanks to incremental compilation.
Use the provided shell script for fast iteration. It builds the binary, wraps it in a .app bundle, and signs it locally:
bash scripts/macos-dev-app.shOpen the printed .app path to run the app. Repeat after each code change.
- Run
cargo fmtbefore committing. All formatting decisions go through rustfmt. - Run
cargo clippyand fix any warnings. The CI pipeline will reject code that triggers clippy lints. - Match the existing patterns in the codebase. Look at nearby files for conventions on imports, module structure, error handling, and naming.
Use Conventional Commits:
feat: add user preference for default locale
fix: resolve crash when sidebar is toggled rapidly
docs: update CONTRIBUTING.md with theme guide
refactor: extract notification logic into its own module
test: add unit tests for route matching
chore: bump gpui-component dependency
Keep the subject line under 72 characters. Use the body for anything that needs explanation beyond the diff.
- Create a new file in
src/views/(e.g.src/views/my_page.rs). - Implement a render function using the GPUI component patterns you see in existing views like
home.rsorsettings.rs. - Register the module in
src/views/mod.rs. - Add a route in
src/routes.rsand a sidebar entry if applicable.
- Define the command in
src/commands.rsfollowing the existing pattern. - Register the command handler in the relevant view or in
src/app.rs. - Bind a keyboard shortcut in
src/shortcuts.rsif the command should be accessible from the keyboard.
- Create a JSON file in
themes/(e.g.themes/my-theme.json). - Follow the structure of an existing theme file like
themes/gruvbox.jsonorthemes/tokyonight.json. - The theme will be discoverable by filename at runtime.
- Create a directory under
i18n/named after the locale code (e.g.i18n/fr/). - Add a
.ftl(Fluent) file inside it mirroring the structure ofi18n/en/gpui-starter.ftl. - Register the locale in the i18n setup within
src/i18n.rs.
- Fork the repository and create a branch from
master:git checkout -b feat/my-feature
- Commit your changes with a conventional commit message.
- Push to your fork and open a pull request against
master. - Ensure
cargo fmt --check,cargo clippy, andcargo testall pass locally before pushing. - Describe what the PR does and why in the description. Link any related issues.
Maintainers will review and merge. Small, focused PRs are easier to review and land faster.
Run the full test suite:
cargo testAdd tests for any new functionality. Integration-style tests for GPUI views go in the src/testing.rs module following the existing patterns there. Unit tests for pure logic can live in the same file as the code they test, behind #[cfg(test)].
For a high-level overview of the codebase structure, modules, and data flow, see docs/gpui-architecture.md.