Skip to content

Contributing

Issues and pull requests are welcome. For bugs, include your OS, terminal emulator, bmux version, and steps to reproduce.

Build from a checkout (requires Go 1.26+) and run the checks:

gofmt -l .
go build -o bin/bmux ./cmd/bmux
./bin/bmux
go test ./...
go test -race ./...
go vet ./...

To preview user docs or regenerate the 2× Retina documentation screenshots:

cd site && npm run dev
go run ./site/screenshots/capture -scene all -theme both

Read AGENTS.md and the architecture guide before changing terminal or session behavior.

Install Node.js to run the generated plugin event fixtures in go test (they skip when Node is absent). To check the installed artifact against OpenCode’s real loader and public form events, use Python 3 and an OpenCode V2 binary:

go build -o bin/bmux ./cmd/bmux
python3 scripts/test-opencode-integration.py --bmux ./bin/bmux --opencode opencode

The script starts a throwaway private server with an isolated home, database and config inside the checkout, and a recording fake bmux on PATH. It does not inherit provider credentials or modify/restart the shared service. Pass --v1 and a V1 binary path to smoke-test V1 plugin initialization. Failures save private server diagnostics locally in .opencode-validation-error-v1.log or .opencode-validation-error-v2.log; review and redact before sharing them.

Releases are built by GoReleaser from a tag; see Releasing. goreleaser release --snapshot --clean builds the same archives locally into dist/.

File a GitHub issue for every bug or feature before fixing it, labeled bug or enhancement, with Problem, Cause, Expected and Done when sections. Never commit to main: work on a feat/, fix/ or docs/ branch and open a pull request that closes its issues with Fixes #N.

Fuzz targets try random input where a crash would take the server down: the terminal emulator (everything programs print), Kitty image commands, requests to a session, config files, key names, #{...} formats and CLI targets. go test ./... runs each one’s seeds and saved crashes; to fuzz one, name it and give it time:

go test ./internal/vt -run '^$' -fuzz '^FuzzEmulatorOutput$' -fuzztime 5m

The others are FuzzKittyCommands (internal/graphics), FuzzSessionRequests (internal/server), FuzzLoad and FuzzKeyName (internal/config), FuzzExpand (internal/format) and FuzzParseTarget (cmd/bmux). A crash writes its input to the package’s testdata/fuzz/. Commit that file with the fix, so the input runs as a regression test from then on.

esctest checks how a terminal answers several hundred escape sequences. scripts/esctest.sh runs it inside a bmux pane, so it tests bmux’s emulator, and prints the summary; each failure’s details go to esctest.log. Pass a regular expression to run some tests, for example scripts/esctest.sh 'CUUTests|EDTests'. It needs Python 3 and tmux. Compare the summary before and after an emulator change: the pass count shouldn’t drop. Many failures are xterm features bmux doesn’t implement, such as window operations and palette changes.

To capture CPU and allocation profiles for a particular workload, see CPU and allocation profiles. Profile the client and server separately before selecting an optimization.

scripts/compare-tmux.py measures bmux from your checkout against the installed tmux and prints Markdown tables for three things:

  • keystroke echo latency, through an attached client;
  • how long seq 1 1000000 takes to display;
  • server memory, idle, with scrollback at 80 and 200 columns, and with 20 sessions.

Each program gets a throwaway socket and config and a client in a pty, and tmux’s history-limit matches bmux’s scrollback.lines. A full run takes a few minutes; --quick takes about one. It needs Go, tmux and Python 3. Run it before and after a change to the server, the client or the emulator to see its effect.

A release is a tag on main. Pushing it runs CI and then GoReleaser (.github/workflows/release.yml), which uploads bmux_<os>_<arch>.tar.gz for Linux and macOS on amd64 and arm64, plus checksums.txt, to a draft release. Nothing is public—and the Homebrew tap is not updated—until you publish the draft. The version comes from the tag: no file in the code holds it.

You need push access and the GitHub CLI (gh), logged in. Set the version once; the commands below use it:

V=v0.7.6

bmux is 0.x, and every release is a pre-release. Bump the patch number for anything within the current roadmap milestone, and the minor number when a milestone ships (v0.6 is scripting). Check whether the protocol changed since the last release; the release notes must then say to run bmux restart:

git fetch origin --tags
git diff "$(git describe --tags --abbrev=0 origin/main)" origin/main -- internal/protocol/protocol.go | grep 'const Version'

It prints the old and new const Version lines when the protocol changed, and nothing when it didn’t.

main only changes through pull requests, so the release commit is one too. Check that main is green first (gh run list --branch main --limit 3).

git switch -c "docs/release-$V" origin/main

Update:

  • CHANGELOG.md: add a new ## vX.Y.Z — YYYY-MM-DD section at the top.
  • ROADMAP.md: update the Shipped row under Now, next, later and add a bullet or row under Already built when a milestone lands.
  • site/src/pages/index.astro: bump the vX.Y.Z release pill in the nav and hero eyebrow.
  • Any docs example that names a version that doesn’t exist yet, such as BMUX_VERSION= in install.sh and the installation page.
git commit -am "Release $V"
git push -u origin "docs/release-$V"
gh pr create --title "Release $V" --body "Marks $V shipped in the README and ROADMAP."
gh pr checks --watch && gh pr merge --squash --delete-branch

Tag the merge commit on main with an annotated tag:

git fetch origin
git tag -a "$V" -m "bmux $V" origin/main
git push origin "$V"

Wait a few seconds for the run to start, then watch it:

gh run watch "$(gh run list --workflow release.yml --limit 1 --json databaseId --jq '.[0].databaseId')" --exit-status

It should hold five files, and every archive should match checksums.txt:

gh release view "$V" --json isDraft,assets --jq '.isDraft, .assets[].name'
dir=$(mktemp -d) && gh release download "$V" -D "$dir" && cd "$dir"
sha256sum -c checksums.txt          # on macOS: shasum -a 256 -c checksums.txt
tar -xzf bmux_linux_amd64.tar.gz bmux && ./bmux --version   # your platform's archive
cd - && rm -rf "$dir"

bmux --version must print the version without the v.

Write the notes in a file, following the earlier releases: a one-line summary; the install commands (the curl … install.sh | sh line and go install github.com/bmux-dev/bmux/cmd/bmux@vX.Y.Z); then New, Changed and Fixed lists as they apply; and an Upgrading line that says whether the protocol changed and, if it did, to run bmux restart (programs running in panes end; sessions, windows, layouts, directories and agent conversations come back).

Publishing a stable release automatically updates Casks/bmux.rb in bmux-dev/homebrew-tap (so aborting a draft never touches Homebrew). For 0.x pre-releases:

gh release edit "$V" --title "bmux $V" --notes-file notes.md --draft=false --prerelease

For non-prerelease (1.0+) releases, mark the release as latest instead:

gh release edit "$V" --title "bmux $V" --notes-file notes.md --draft=false --prerelease=false --latest
curl -fsSL https://raw.githubusercontent.com/bmux-dev/bmux/main/install.sh | BMUX_INSTALL_DIR="$(mktemp -d)" sh

It should install the new version. From the previous release, bmux update --check should offer it.

The compatibility tests keep every release’s save file, config and command list working. Record the new one’s, in a pull request like any other change (it needs tmux):

git switch -c "test/fixtures-$V" origin/main
scripts/compat-fixtures.sh "$V"
go test ./...
git add "testdata/releases/$V" && git commit -m "test: compatibility fixtures for $V"

To test an upgrade end to end without publishing a stable release or pushing to Homebrew, trigger the Beta workflow (.github/workflows/beta.yml) from GitHub Actions or with gh workflow run beta.yml:

gh workflow run beta.yml                  # auto-picks vX.Y.(Z+1)-beta.N
gh workflow run beta.yml -f version=0.8.0 # auto-picks v0.8.0-beta.N

The workflow runs CI, pushes the v...-beta.N tag, builds the archives, and publishes them as a pre-release without touching Homebrew. Install or test with bmux update --beta && bmux restart, and switch back with bmux update --stable && bmux restart.

  • Before publishing (CI fails, GoReleaser fails, the draft looks wrong): nothing is public. Delete the draft and the tag, fix it in a pull request, and start again at step 3:

    gh release delete "$V" --cleanup-tag --yes   # when a draft exists
    git push origin ":refs/tags/$V"               # when only the tag exists
    git tag -d "$V"
  • After publishing: don’t move or reuse the tag. Go’s module proxy keeps the first commit it saw for each version, so go install …@vX.Y.Z would no longer match the release. Fix it in a new patch release.