Contributing to Lokyr
On this page
Thank you for your interest in Lokyr. This guide tells how to set up the project, the rules that the code and the documents follow, and what a pull request needs before it can be merged.
Lokyr is young: its first version is under way, for macOS 26 or later on Apple Silicon. Linux comes later. By taking part, you agree to follow the code of conduct.
Before you start
- A large change starts as an issue. Open one before you write a new feature, a new dependency or a change of design, so that we can agree on its shape first. A small fix, a typo or a test can go straight to a pull request.
- Read the documents of the part that you change. Start with docs/README.md, then ARCHITECTURE.md, and the document of the area, such as VT-CORE.md for the terminal core. The work is planned in phases, as the roadmap tells.
- The decisions are in the documents of each area. A change that goes against one is discussed in an issue first.
Setting up
You need:
- a Mac with Apple Silicon, on macOS 26 or later;
- Xcode 26 or later, with its Metal toolchain, a download of its own since Xcode 26, which the renderer's shaders need to build:
xcodebuild -downloadComponent MetalToolchain; - Rust through rustup:
rust-toolchain.tomlpins the version, which rustup installs at the first build; just, which runs the project's recipes:brew install just;cargo-deny, which checks the dependencies' licenses and advisories:cargo install cargo-deny --locked.
Then:
cargo run -p lokyr-app # the terminal, with your login shell
just --list # the project's recipes
just ci # the checks of CI, as the next section tells
Fuzzing uses a nightly Rust, which the justfile pins, and cargo-fuzz; you need it only to work on the fuzzers.
The bundle, target/Lokyr.app, which just bundle builds, is signed with the identity that LOKYR_SIGN_IDENTITY names, as codesign --sign takes it, and ad hoc without it. just and cargo xtask read the variables of the untracked private/lokyr.env, which names the Developer ID and the notary's profile, so that no signing identity, team or credential is in the repository; a variable of the environment wins over the file's. just notarize has Apple notarize the bundle and staples the ticket: it needs the Developer ID and the notary's credentials, an App Store Connect API key where LOKYR_NOTARY_KEY (the .p8 file's path) and LOKYR_NOTARY_KEY_ID name one, with LOKYR_NOTARY_ISSUER for a team's key, or else the keychain's profile lokyr-notary that xcrun notarytool store-credentials makes, or the one that LOKYR_NOTARY_PROFILE names; it sends the bundle to Apple's notary service.
The bundle carries the notices of the licenses of what it holds of other projects, in Contents/Resources/licenses: the symbols' font's, Sparkle's, and in crates every crate's of the binary, with an index, which cargo xtask bundle writes from cargo metadata, of the license that Lokyr takes of each crate's expression among those that deny.toml allows, its own files, or the license's text of SPDX's list, in tools/xtask/licenses, under its authors' copyright where its package has none; a crate that allows none of them fails the bundle, and a license that deny.toml comes to allow needs its text there.
The bundle holds Sparkle's updater, of the release that tools/xtask/src/sparkle.rs pins with its digest, which cargo xtask bundle downloads once into target/sparkle, and signs with the bundle's identity; the app loads it after its first window, and cargo run runs without it. The private EdDSA key that signs the updates is the maintainer's, in the login keychain under the account lokyr of Sparkle's generate_keys, with a copy in the untracked private/; the public one is in sparkle.rs.
just dmg builds target/Lokyr-<version>.dmg of the bundle, the app and a link to Applications over a background, after it has Apple notarize the bundle if it has no ticket yet, and has Apple notarize the image too; cargo xtask dmg --no-notarize builds it of the bundle as it is, to look at it. The window's look is the Finder's own .DS_Store, kept in crates/app/resources/dmg, which cargo xtask dmg layout has the Finder write again, with the background rendered from its SVG by rsvg-convert, when the window's size or the icons' places change; it needs the terminal's permission to control the Finder.
The updates' public feed is an asset of each release, appcast.xml, which https://lokyr.dev/appcast.xml serves of the latest release, site/public/appcast.xml until a release holds one, and the bundle's SUFeedURL names: cargo xtask feed publish target/Lokyr-<X.Y.Z>.dmg puts a release's DMG into the latest release's feed, written into target/releases/<X.Y.Z>/appcast.xml, of Sparkle's generate_appcast in the untracked private/public-feed, which keeps the released DMGs to make the deltas of, each item's DMG and deltas downloaded from its own GitHub release, and the appcast signed with the EdDSA key. The feed of tests is on the maintainer's Mac, in the untracked private/feed: cargo xtask feed add target/Lokyr-<version>.dmg puts a DMG there with its notes, docs/releases/<X.Y.Z>.md or the file that --notes names, and has Sparkle's generate_appcast write the appcast, each DMG and the appcast signed with the EdDSA key, the keychain's or the file that LOKYR_SPARKLE_KEY_FILE names; --channel <name> puts the version in a channel, as a beta's. just feed-serve has Lokyr on that Mac read the feed, through the updater's SUFeedURL in its defaults, and serves it on 127.0.0.1:8123 until Control-C; defaults delete io.github.sephiroth74.lokyr SUFeedURL gives the builds their own feed back.
Releasing covers how a release is made, by the CI or by hand. just release <version> releases a candidate, X.Y.Z-rc.N, or a release, X.Y.Z, of the workspace's version, in the steps of cargo xtask release, check, build and draft, each of which runs alone as cargo xtask release <step> <version>, check first, of no secret, which a release's pull request into main runs, beside build, which the release's workflow runs on GitHub's macOS runner in the environment release, of its secrets and the maintainer's approval: the Developer ID imported into a keychain of the run, deleted at its end, and the notary's API key, the log masking the identity, its team and the notarization's id, the DMG, the dSYM and the bill an artifact of the run, which its draft job, of the EdDSA key, drafts in place of a draft of that tag, the last five released DMGs downloaded for the deltas, and tells the pull request of; at the pull request's merge, its publish job, of the maintainer's approval again, checks that the merge holds the tree that the release built, and that the draft is of the pull request's last commit and holds its DMG and feed, a draft of an earlier push or of a draft that failed refused, waits for a draft that runs, moves the draft to the merge and publishes it (cargo xtask release publish <version> --target <commit> --built <commit>), its tag made there, asks a run of the site of main, which a release's merge does not deploy of its own push, and pushes the tap's cask, the run's summary telling what is left by hand of a step that failed; a release's pull request into test/main, a branch of tests, rehearses it all, the release a pre-release that is never the latest (--rehearsal), the site built and not deployed, the cask pushed to a branch of tests of the tap; from the commit checked out, without changes, once GitHub has it: the bundle built as that version, its build's number above the feed's latest, which it refuses to release without, unless --without-feed, as a feed's first release, and with SOURCE_DATE_EPOCH set, which would give the number, the binary's dSYM, which the release profile makes beside it, and the bill of materials, CycloneDX's JSON of the crates that the binary holds, Sparkle and the symbols' font, kept in target/releases/<version>; the DMG, the bundle and the image notarized; a draft of the GitHub release, v<version>, a candidate's a pre-release, with the DMG, the dSYM and the bill, its notes docs/releases/<X.Y.Z>.md; the DMG in the feed of tests; and a release's, not a candidate's, in the public feed, its deltas and its appcast uploaded to the draft, and its Homebrew cask. A release's commit holds no mark of what no release has yet, which cargo xtask since <X.Y.Z> makes the release's beforehand. Publishing the draft, cargo xtask release publish <version>, makes its tag and the release the latest, whose appcast the site serves once its workflow runs again; then the cask is pushed to the tap. cargo xtask symbolicate <report.ips> reads a crash report of macOS, from ~/Library/Logs/DiagnosticReports: its crashed thread and the main thread, Lokyr's frames told by their functions, files and lines through the dSYM of the binary's UUID, which target/releases keeps, or the one that --dsym names. The app's own log, which a panic writes its backtrace to, is ~/Library/Logs/Lokyr/lokyr.log.
The gate: just ci
just ci runs the checks of CI that a Mac can make, and a pull request needs it green:
- formatting,
cargo fmt --check, and clippy with every warning an error; - the build and the tests of the whole workspace, and a build of the platform-independent crates for Linux;
cargo deny: the dependencies' licenses, advisories and sources;cargo xtask check-deps: the dependency rules, such as no networking in the app and no macOS crate in the platform-independent ones;cargo xtask check-comments: no comment names a task, a phase or an ADR;cargo xtask check-changelog:CHANGELOG.mdkeeps the format of Keep a Changelog 1.1.0;cargo xtask check-links: the internal links and anchors of the Markdown files resolve;cargo xtask bundle: the app's bundle,target/Lokyr.app, signed with the identity thatLOKYR_SIGN_IDENTITYnames, or ad hoc without it.
CI's macOS job, whose minutes GitHub bills ten times a Linux job's, runs on main's pushes, on pull requests and on the runs that gh workflow run CI --ref <branch> asks for, and only of changes beyond documents, Markdown files and docs/; a phase's branch, as f3, runs its Linux jobs at each push, and the macOS job by hand, as before a release, just ci on the Mac covering it meanwhile.
Two checks of CI are not in it, and run on Linux: the tests of the platform-independent crates, which just ci builds for Linux without running; and the count of the instructions that the terminal's core takes for a set of scenarios, which fails a pull request that raises one by more than 3% over its base, with just instructions <base> where Valgrind runs.
The code
The conventions are the full list. The ones that reviews meet most:
- English for the code, its comments, the documents and the commit messages.
- Comments describe the code as it is: what it does and why. They never name the plan: no task's identifier, no phase, no ADR's number, no section of
docs/. A link to an external specification, such as xterm's, Unicode's or Apple's, is welcome.just check-commentscatches the plan's names; a review catches the rest. unsafeonly in the crates that the conventions list, such as the platform's, the renderer's, the fonts' and the PTY's, and each block with a// SAFETY:comment that tells why it holds. The other crates forbid it.- Errors:
thiserrorin the libraries,anyhowin the binaries. - Dependencies: the workspace's
Cargo.tomlnames them all; a new one needs a reason, a license thatdeny.tomlallows, and a place that the dependency rules accept. The app contains no networking code: downloads are Sleip's. - Formatting:
cargo fmt, with the workspace'srustfmt.toml.
Tests
- New code has tests, and a fix has the test that would have caught the bug.
- The platform's tests in
crates/platform-macos/testsrun without the test harness, on the main thread, as AppKit needs: each is a program that starts the application, opens its windows and quits. They hide their app at once, but keys typed while they start can still reach their window, and a click or a key while a context menu of theirs is open closes it: run them again if one fails with keys that it did not send, or with a menu that closed before its time.alert_keyspastes and copies through the system's clipboard, whose items it puts back as it ends. - The golden images in
crates/app/tests/goldenare what the GPU draws of text, colors, decorations, the cursor and the selection, at scales of 1 and 2, in SF Mono, and of the shapes that the renderer draws itself, without text:crates/app/tests/golden.rscompares a drawing with them, and a pixel can differ by a little, as the GPU and the rasterizer round; a few pixels of the shapes alone. A test that fails writes the drawing, and a map of the pixels that differ, undertarget/tmp/golden. A change that is meant to change the drawing comes with new images:LOKYR_GOLDEN_UPDATE=1 cargo test -p lokyr-app --test goldenwrites them, which you look at before you commit them; a new release of macOS that draws a font otherwise can need them too. They are drawn on a system whose preferred languages hold none of Chinese, Japanese and Korean: CoreText's fallback for CJK text takes its font from the first of them in the list, so that a Mac that has one there, as an input method's setup can add, draws the scenes of CJK text in another font, and fails them, as CI's runner does not. - The changelog: a change that someone using Lokyr can notice, a feature, a shortcut, a key of the config, a fix, adds its line under
## [Unreleased]in CHANGELOG.md, of the kindAdded,Changed,Deprecated,Removed,FixedorSecurity, in the same pull request, told as they meet it. - Checks by hand: what no test can check, such as an input method, a drawing next to another terminal's or a measure, is told in the pull request, with what you saw.
The documents
- Write a page as WRITING-DOCS.md shows: where it goes, its sections, the voice, the code blocks, the keys, the markers and the screenshots.
- A change to a feature updates the feature's page in the same pull request, or the pull request says why the feature has none yet. A feature that no release has yet is marked
· not released yet, and a new key of the config"x-since": "next"in its schema, whichcargo xtask since X.Y.Zmakes the release's in the commit that prepares it. - A changed decision changes the documents that tell it, and its row of the requirements' table in docs/requirements.md, if it has one.
- A new public page goes into docs/SUMMARY.md, in its group, where a reader would look for it: the site's build fails of a page that the summary leaves out. GitHub's alerts,
> [!NOTE],> [!TIP],> [!IMPORTANT],> [!WARNING]and> [!CAUTION], show as callouts on lokyr.dev as on GitHub. - A key of the config that a change adds, changes or removes is in the config's schema,
crates/kernel/config.schema.json: its type, its values, its range, its default and its description, and its annotations ofx-, the platforms where it applies, its text in the guide, its value and comment in the complete example, a number's step and a text's bound, and the documentation's page of its topic,x-docs, such as"shell-integration.md#set-it-up-by-hand", which the settings link beside the guide's text; a plugin's keys are in its own schema. The kernel's tests hold the schema to the parser. docs/CONFIGURATION.md, the guide to the config, is made of the schemas and of its template,crates/kernel/config-guide.md, bycargo xtask config-guide, never edited by hand; CI checks that it is the schemas'. The guide names no other terminal emulator; it can name the tools that help, such as vim, Font Book on macOS or GNU Stow. - A changed behavior changes the documents that describe it.
- A command or a default key that a change adds, changes or removes is written into docs/commands.md and the plugins' tables of commands by
cargo xtask docs; a new command takes a row in its plugin's table, of what it does.just check-docs, injust ciand CI, checks them. - A change that someone using Lokyr can notice adds its line to CHANGELOG.md under
## [Unreleased], of the format of Keep a Changelog 1.1.0, told as a user meets it. A release moves those lines under## [X.Y.Z] - YYYY-MM-DDand adds its link at the end;cargo xtask check-changelog, injust ci, checks the format. - A release's notes, which Sparkle's window shows with the new version, are
docs/releases/<X.Y.Z>.md, in English, in Markdown: what is new, what works better, what was fixed, and what to know before updating, such as a key of the config that changed. A candidate,X.Y.Z-rc.N, and a build of a date,X.Y.Z-YYYYMMDD, take their release's notes. The notes go at the top of the list in docs/releases/README.md, which the site's build checks, andcargo xtask releaserefuses a version whose notes, list entry or changelog section is missing. - Links resolve, which
just check-linkschecks.
Commits
- One logical change a commit, which builds and passes its tests on its own.
- The message: a summary line, then a blank line, then a body that tells what changed and why, in English.
Pull requests
- Open it from a branch of your fork, against
main, and fill in the template. - Keep it to one subject: a smaller pull request is reviewed sooner.
- CI must be green. A reviewer may ask for changes; push them as new commits, which are squashed or kept as the review decides.
Translations
A translation, a new language or a better one, follows TRANSLATING.md: the catalogs, their format, and the steps of a new language.
Reporting a bug
Open an issue with the bug's template: the macOS version, the Mac, Lokyr's commit, your config, the steps that make the bug happen, and what you expected. A security problem goes privately to the maintainer, through GitHub's private vulnerability reporting, not in a public issue.
License
Lokyr is under the MIT license. By contributing, you agree that your contributions are under the same license.