Repository navigation
Description
Summary
libtmux.org tells readers to save a POSIX shell script and run their program through it on 33 hand-written pages and 97 generated API reference pages. The maintainer's complaint (2026-11-14) is that this reads as an admission that the library cannot do the job from its own language. Each launcher creates a private tmux server, creates fixture sessions with tmux new-session, scrubs TMUX, runs the program, then kills the server and checks for leaks. Eleven of the ports with a launcher page (C#, C++, F#, Go, Julia, PowerShell, Python, Ruby, Rust, Swift, TypeScript) already have a native owned-server API or a ten-line pattern that their own landing-page program uses; the pages should use it. Java, Kotlin and Scala wait on libtmux-java PR #143. Lua and Elixir cannot start a server through the library, and neither can Haskell or OCaml (no launcher page yet, but their landing page and READMEs shell out to tmux); those gaps are tracked in the port repositories.
Expected
Every example and guide program starts and stops its own private server in the port's language, with the port's API. No page shows run.sh, run-mcp.sh, unset TMUX, mktemp or the tmux CLI as setup for a library example. Console blocks keep only the install and run commands.
Use these per port (all exist on master unless noted):
- Ruby:
LibTmux::Server.start { |server| ... }. - Julia:
LibTmux.with_server/open_server(; tmux, env, timeout, cancel). - Erlang:
tmux_server:with_owned/2. - C#, F#:
Server.CreateOwnedAsync/Server.createOwned, which the programs on these pages already call. - Rust:
Server::builder().socket_path(..).config_file("/dev/null"),new_session,kill(), as the landing program does. - Go:
tmux.NewServer(tmux.ServerOptions{SocketPath, ConfigFile: os.DevNull}),NewSession, deferredKill, asexamples/quickstart/main.godoes. - TypeScript:
new Server({ socketPath, configFile: "/dev/null" }),newSession,kill()infinally. - Python:
libtmux.Server(socket_path=..., config_file="/dev/null"),new_session,kill(). - Swift:
Server(socketName:configurationFile:)andkillServer(). - C++:
libtmux::Server::startable_at_socket_pathandkill()(the C++ API pages currently uselibtmux::test::ScopedTmuxServer). - PowerShell:
New-TmuxServer -SocketName -ConfigurationFile /dev/null,New-TmuxSession,Remove-TmuxSession. - Java, Kotlin, Scala, Clojure:
Server.start,withPrivateServer,Server.start()/Server.start[F],libtmux.core/start!after libtmux-java PR Frame MCP and workspace companions as concept examples #143 merges. Re-pin the java docs revision, then delete the launcher branches injvm-examples.tsandclojure-examples.tsand rewrite the Kotlin and Scala concept pages and the two MCP guides. - Lua, Elixir, Haskell, OCaml: after the port adds the API named in its issue.
For "Attaching to tmux" the program can start the owned server, create work, then connect a second handle to the same socket; that keeps the "connect to an existing server" lesson without a script.
Drop the ENV/BASH_ENV/SHELL lines: the programs pass explicit pane commands, and -L/-S override TMUX. If a pane environment is needed, set it through the library's session environment option.
Actual
Generators that print a port repository's launcher verbatim (data feed: examples/api/ manifest in the port repo):
- Clojure:
clojure-examples.tsL35-38 and L70-84 prints "Save this file as run.sh. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors." andsh run.sh clojure ...on 33 reference pages, for example/en/clojure/latest/reference/libtmux-core-open/. - Java, Kotlin, Scala:
jvm-examples.tsL27 and L99-136 printsrun.shas a fourth setup file andsh run.sh build/install/api-example/bin/api-exampleon 13 + 14 + 26 reference pages, for example/en/java/latest/reference/io-github-libtmux-server-server/. The generator already branches on "a revision before libtmux-java#142". - Lua:
lua-examples.tsL26 and L59-72 requiresmanifest.setup.launcher === 'examples/api/run.sh', so a launcher-less Lua revision fails the build. 11 reference pages. - Tests that pin the launcher:
packages/api-model/test/{jvm-examples,clojure,lua-examples}.test.ts,site/test/{jvm-api-examples,api-example-verification,wrapper-libraries}.test.ts.
Hand-written pages under site/src/content/docs/ports/ with a sh title="run.sh" block (copy of one template; the page URL is https://libtmux.org/en/<port>/latest/<path without .md>/):
- "Attaching to tmux" guide, 16 ports: csharp L74-100, cxx L84-110, elixir L63-89, fsharp L83-109, go L88-114, java L68-94, julia L71-97, kotlin L97-123, lua L67-93, powershell L76-102, py L50-76, rs L83-109, ruby L58-84, scala L96-122, swift L82-108, ts L57-83. Each creates session
work, scrubsTMUX TMUX_PANE, runssh run.sh <program>, and checkshas-sessionafterwards. - Concept pages that create
work-oneandwork-two:fsharp/concepts/{queries L37-65, server-session-window-pane L39-67, transports L37-65, workspaces L35-63}.md,go/concepts/{queries L47-74, server-session-window-pane L46-73}.md,kotlin/concepts/{queries L54-82, server-session-window-pane L56-84, transports L54-82, workspaces L52-80}.md,scala/concepts/{queries L53-81, server-session-window-pane L55-83, transports L53-81, workspaces L51-79}.md. Example: go/concepts/queries.md L47-74; run linessh run.sh env GOWORK=off go run Local.goat L185, L281, L392. - MCP guides with a launcher that starts the server, creates a session and execs the MCP server: java/mcp/guides.md L44-78, swift/mcp/guides.md L44-78. The client is told to run
shon the launcher. - Lua example: lua/examples/capture-pane-output.md L81-112.
- Shell environment scrub in console blocks:
julia/examples/{cancel-control-wait L70-71, observe-output L79-80, owned-capture L69-70, shared-windows L94-95}.md,powershell/examples/{command-completion L91-92, create-layout L92-93, wait-for-service L101-102}.md(unset TMUX TMUX_PANE,export ENV=/dev/null BASH_ENV=/dev/null SHELL=/bin/sh).
Landing page data, site/src/data/home-examples.json:
- L24, 65, 97, 133, 179, 215, 501, 532, 563, 593, 786 (Python, Ruby, Lua, TypeScript, Rust, Go, Swift, PowerShell, Julia, Elixir, Lisp): the same two-line
unset/exportpreamble before the run command. - L390 and L430 (C#, F#):
export TMUX_TMPDIR=/tmp/libtmux-dotnet-dev,mkdir -p,unset TMUX TMUX_PANE. - L681 (Haskell): a shell subshell with
mktemp -d,trap ... kill-server,env -u TMUX -u TMUX_PANE tmux -S ... new-session -d,link-window, thencabal run. - L828 (Erlang):
env -u TMUX -u TMUX_PANE erl .... - L91 and L101-103 (Lua program text): the program spawns
tmux -S sock -f /dev/null start-server ; set-option -s exit-empty offandkill-serverwithuv.spawn. - L588 and L598-600 (Elixir program text):
System.cmd(tmux, ["-S", socket, "-f", "/dev/null" | create]).
Port README or guide files ingested by site/src/data/port-guides/*.json that carry shell setup at their pinned revision: OCaml (docs/recovery.md, docs/streaming.md, docs/workspaces.md, docs/workspace-recovery.md), Lua (README.md at pin 0395620d3), Ruby (README.md, gems/libtmux/README.md, gems/libtmux-mcp/README.md, gems/libtmux-workspace/README.md), Lisp (tools/lisp.sh, examples/worker.sh). Those are fixed in each port repository, then re-pinned.
Proposal
Tracked in the port repositories, not here: Lua Runtime:start_server (new issue), Elixir Server.start/stop (libtmux-elixir #82), Haskell startServer plus newSession/linkWindow/killServer (libtmux-haskell #34), OCaml config file on bootstrap and kill-server (libtmux-ocaml #11), JVM Server.start (libtmux-java #142, PR #143).
References
- Maintainer, 2026-11-14: "don't spam shell script to users - that's like admitting your library is flawed from the outside"; file an issue per repo and identify the missing APIs.
- Page: https://libtmux.org/en/clojure/latest/reference/libtmux-core-open/
- Related: Let readers choose the socket and cleanup for every example #237 (let readers choose the socket and cleanup for every example) covers socket choice, not launchers.
Activity