mux-sesh 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Your Name
3
+ Copyright (c) 2025 QuietGhost
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,219 +1,208 @@
1
1
  # mux-sesh
2
2
 
3
- > A beautiful, fast tmux session manager built with OpenTUI and TypeScript
3
+ A keyboard-driven picker for tmux sessions and Herdr workspaces. Switch to what's running, start a
4
+ session from any project, and close what you're done with, all from one popup.
4
5
 
5
6
  <p align="center">
6
7
  <img src="screenshot.png" alt="mux-sesh screenshot" width="800">
7
8
  </p>
8
9
 
9
- ## Features
10
+ - **Switch fast:** live sessions, pinned sessions and agent panes in one list, with fuzzy search
11
+ that learns what you open.
12
+ - **Start from a project:** pick a folder, a file or a GitHub URL. mux-sesh shows exactly what
13
+ Enter will do (focus, create or clone) before it does it.
14
+ - **Close safely:** every close is confirmed, and nothing but the session itself is ever removed.
15
+ - **Configure in the app:** a settings screen with real editors, saved to one JSON file.
10
16
 
11
- - **Fuzzy search** - Find sessions and projects instantly
12
- - **Lightning fast** - Built with Bun and OpenTUI
13
- - **Beautiful UI** - Catppuccin-themed interface
14
- - **Vim keybindings** - Navigate with j/k or arrow keys
15
- - **Project scanning** - Browse and create sessions from local directories
16
- - **GitHub integration** - Clone repos directly from URLs
17
- - **Quick select** - Use number keys (1-9) for instant switching
18
- - **Session management** - Create, switch, kill, and rename sessions
17
+ ## Install
19
18
 
20
- ## Installation
21
-
22
- ### Prerequisites
23
-
24
- - [Bun](https://bun.sh) - JavaScript runtime (required)
25
- - [Zig](https://ziglang.org) - Required for building OpenTUI
26
- - tmux - Terminal multiplexer
27
- - git - For GitHub cloning feature
19
+ You need **tmux** or **Herdr 0.7.5 or newer**, and **git** if you want to clone repositories from
20
+ mux-sesh. Pick one:
28
21
 
29
22
  ```bash
30
- # Install Bun
31
- curl -fsSL https://bun.sh/install | bash
32
-
33
- # Install Zig (macOS)
34
- brew install zig
35
-
36
- # Install Zig (Linux - check https://ziglang.org/download/)
23
+ npm install -g mux-sesh
37
24
  ```
38
25
 
39
- ### Install from npm/Bun
40
-
41
26
  ```bash
42
27
  bun install -g mux-sesh
43
-
44
- # Then run
45
- mux-sesh
46
28
  ```
47
29
 
48
- ### Install from Source
49
-
50
30
  ```bash
51
- git clone https://github.com/quiet-ghost/mux-sesh.git
52
- cd mux-sesh
53
- git checkout opentui-convert
31
+ mise use -g npm:mux-sesh
32
+ ```
54
33
 
55
- # Install dependencies
56
- bun install
34
+ The package installs a prebuilt binary, so mux-sesh doesn't need Bun or Node at runtime. Supported
35
+ platforms are Linux (x64 and arm64, glibc and musl) and macOS (x64 and arm64), with a baseline
36
+ build for x64 CPUs without AVX2. The binary ships as an optional dependency, so don't install with
37
+ `--omit=optional`.
57
38
 
58
- # Build standalone executable
59
- bun run build
39
+ Check it works:
60
40
 
61
- # Install globally
62
- sudo cp dist/mux-sesh /usr/local/bin/
63
- # or
64
- cp dist/mux-sesh ~/.local/bin/
41
+ ```bash
42
+ mux-sesh
65
43
  ```
66
44
 
67
- ## Keybindings
68
-
69
- ### Normal Mode
70
- | Key | Action |
71
- |-----|--------|
72
- | `j` / `k` or `↑` / `↓` | Navigate up/down |
73
- | `1-9` | Quick select session/project |
74
- | `Enter` | Switch to session / Create from project |
75
- | `i` | Enter search mode |
76
- | `n` | Create new session |
77
- | `d` | Kill selected session |
78
- | `r` | Rename selected session |
79
- | `R` | Refresh list |
80
- | `s` | Switch to sessions view |
81
- | `p` | Switch to projects view |
82
- | `q` or `Esc` | Quit |
83
-
84
- ### Search Mode
85
- | Key | Action |
86
- |-----|--------|
87
- | Type to search | Filter sessions/projects |
88
- | `Enter` | Select first result |
89
- | `↑` / `↓` | Navigate results |
90
- | `Esc` | Cancel search |
91
-
92
- ### New Session Mode
93
- | Key | Action |
94
- |-----|--------|
95
- | Type project name | Filter projects |
96
- | Paste GitHub URL | Clone and create session |
97
- | Type custom name | Create named session |
98
- | `Enter` | Confirm selection |
99
- | `Esc` | Cancel |
100
-
101
- ## Configuration
102
-
103
- Configuration is stored at `~/.config/mux-sesh/config.json`:
45
+ ### Updating
104
46
 
105
- ```json
106
- {
107
- "projectPaths": ["~/dev", "~/personal", "~/work"],
108
- "reposPath": "~/dev/repos",
109
- "editor": "nvim",
110
- "editorCmd": "nvim -c \"lua vim.defer_fn(function() if pcall(require, 'telescope') then vim.cmd('Telescope find_files') end end, 100)\""
111
- }
112
- ```
47
+ With `auto_update` on (the default), npm and Bun installs update themselves in the background;
48
+ the status line tells you to restart when a new version is ready. mise and Homebrew installs are
49
+ left to their own tool, and mux-sesh shows the command to run, such as `mise upgrade npm:mux-sesh`.
113
50
 
114
- ### Configuration Options
51
+ Upgrading from 1.x? Read the [CHANGELOG](CHANGELOG.md) first: 2.0 validates your config and
52
+ changes a few defaults.
115
53
 
116
- - **`projectPaths`** - Array of directories to scan for projects
117
- - **`reposPath`** - Directory where GitHub repositories will be cloned
118
- - **`editor`** - Default editor to use
119
- - **`editorCmd`** - Command to run when opening editor
54
+ To uninstall, use the same tool: `npm uninstall -g mux-sesh`, `bun remove -g mux-sesh` or
55
+ `mise uninstall npm:mux-sesh`.
120
56
 
121
- ## Usage Examples
57
+ ## Open it from a key
122
58
 
123
- ### Quick Session Switching
124
- ```bash
125
- # Open mux-sesh
126
- mux-sesh
59
+ mux-sesh works best as a popup over your current work.
127
60
 
128
- # Press 1-9 to instantly switch to that session
129
- # Or use j/k to navigate and Enter to select
61
+ **tmux:** add this to `~/.tmux.conf`, then reload with `tmux source-file ~/.tmux.conf`:
62
+
63
+ ```tmux
64
+ bind-key -n M-w popup -E -w 62% -h 70% "mux-sesh"
130
65
  ```
131
66
 
132
- ### Create Session from Project
133
- ```bash
134
- mux-sesh
67
+ `Alt+W` now opens the picker. To start new sessions in the current pane's directory, add
68
+ `-d "#{pane_current_path}"` before `"mux-sesh"`.
135
69
 
136
- # Press 'n' for new session
137
- # Type project name to filter
138
- # Press Enter to create session in that directory
70
+ **Herdr:** add a popup command to Herdr's `config.toml`, then run `herdr server reload-config`:
71
+
72
+ ```toml
73
+ [[keys.command]]
74
+ key = "prefix+alt+w"
75
+ type = "popup"
76
+ command = "mux-sesh"
77
+ description = "mux-sesh"
78
+ width = "70%"
79
+ height = "70%"
139
80
  ```
140
81
 
141
- ### Clone from GitHub
142
- ```bash
143
- mux-sesh
82
+ You can also run `mux-sesh` from any shell. Without tmux or Herdr around it, mux-sesh uses a
83
+ running Herdr server first, then tmux (see [Backend Selection](docs/configuration.md#backend-selection)).
144
84
 
145
- # Press 'n' for new session
146
- # Paste GitHub URL:
147
- # https://github.com/user/repo
148
- # or
149
- # git@github.com:user/repo.git
150
- # Press Enter to clone and create session
151
- ```
85
+ ## Use it
152
86
 
153
- ### Search Existing Sessions
154
- ```bash
155
- mux-sesh
87
+ The picker opens on the session you're in. Type to search (in `vim` mode, press `i` first), move
88
+ with `j`/`k` or the arrows, and press `enter` to switch.
156
89
 
157
- # Press 'i' to search
158
- # Type to filter sessions
159
- # Press Enter to switch to first match
160
- ```
90
+ | To… | Do this |
91
+ | --------------------------------------- | ------------------------------------------------------------------------- |
92
+ | Switch to a session | Select it and press `enter`, or press `1`–`9` for a visible row |
93
+ | Start a session from a project | Press `n`, pick a project or folder (or paste a GitHub URL), then `enter` |
94
+ | Open a file in a new session | In New: `ctrl+o`, type a file name or path, then `enter` |
95
+ | Change the new session before it starts | In New: `ctrl+n` renames it, `ctrl+t` changes its startup command |
96
+ | Start a session in the current folder | In New: `ctrl+g` |
97
+ | Close a session | Press `d`, then `d` again to confirm; any other key cancels |
98
+ | Close several sessions | Mark each with `m`, then press `d` to review and confirm them together |
99
+ | See details about the selected row | `v` |
100
+ | Run any command, change the theme | `ctrl+p`, then type, such as `theme` or `settings` |
161
101
 
162
- ## Color Scheme
102
+ New shows a summary line that says exactly what `enter` will do, for example
103
+ `Focus existing 'api' in ~/dev/api`. Cloning a GitHub URL goes into your `repos_path` and never
104
+ deletes anything. Closing only ever closes the tmux session or Herdr workspace: files, worktrees
105
+ and branches are never touched.
163
106
 
164
- mux-sesh uses the beautiful [Catppuccin](https://github.com/catppuccin/catppuccin) color scheme with the following palette:
107
+ ### Essential keys
165
108
 
166
- - **Primary**: `#f38ba8` (Pink)
167
- - **Active**: `#a6e3a1` (Green)
168
- - **Inactive**: `#6c7086` (Gray)
169
- - **Border**: `#89b4fa` (Blue)
170
- - **Key**: `#f9e2af` (Yellow)
171
- - **Action**: `#cba6f7` (Mauve)
109
+ Default mode is `vim`, with `ctrl+x` as the prefix for secondary actions.
172
110
 
173
- **Cross-Platform** - Works on Linux, macOS, Windows
111
+ <!-- keys: vim normal subset -->
174
112
 
175
- ## Development
113
+ | Key | Action |
114
+ | ---------- | ---------------------------------------------------------------------- |
115
+ | `enter` | Open the selected row: focus a live session, or create from a project |
116
+ | `i` | Search |
117
+ | `n` | New session |
118
+ | `d` | Close the selected session (`d` again confirms), or review marked rows |
119
+ | `m` | Mark or unmark a row for a batch close |
120
+ | `v` | Toggle details |
121
+ | `ctrl+x s` | Show sessions |
122
+ | `ctrl+x p` | Show projects |
123
+ | `ctrl+x r` | Rename session |
124
+ | `ctrl+p` | Command palette; type `theme` for the theme picker |
176
125
 
177
- ```bash
178
- # Install dependencies
179
- bun install
126
+ Quit with `q` or `esc`. In text fields, letters type; only arrows, `enter`, `esc` and `ctrl+…`
127
+ keys act. Prefer typing straight into search? Set `"keybind_mode": "standard"`. Every key for both
128
+ modes: [docs/keybindings.md](docs/keybindings.md).
180
129
 
181
- # Run in dev mode (with hot reload)
182
- bun run dev
130
+ ## Set it up
183
131
 
184
- # Type check
185
- bun run typecheck
132
+ mux-sesh runs with no config. To tell it where your projects live, open **Settings**
133
+ (`ctrl+p`, then `settings`) or edit `~/.config/mux-sesh/config.json`:
186
134
 
187
- # Build for production
188
- bun run build
135
+ ```json
136
+ {
137
+ "project_paths": ["~/dev"],
138
+ "repos_path": "~/dev/repos",
139
+ "theme": "rosepine",
140
+ "default_session": {
141
+ "startup_command": "nvim"
142
+ }
143
+ }
189
144
  ```
190
145
 
191
- ## Contributing
146
+ - `project_paths`: folders scanned for projects and searched by New.
147
+ - `repos_path`: where GitHub URLs are cloned.
148
+ - `default_session.startup_command`: what runs in a new session.
149
+ - `theme`: any built-in theme, or `system` to follow Omarchy or your terminal.
192
150
 
193
- Contributions are welcome! Please feel free to submit a Pull Request.
151
+ Changes from Settings save immediately. Edits to the file apply the next time mux-sesh starts. If
152
+ the file has an invalid value, mux-sesh shows which field is wrong instead of starting, and never
153
+ changes the file; fix it and press `r`. For completion and validation in your editor, point it at
154
+ [`mux-sesh.schema.json`](mux-sesh.schema.json).
194
155
 
195
- 1. Fork the repository
196
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
197
- 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
198
- 4. Push to the branch (`git push origin feature/amazing-feature`)
199
- 5. Open a Pull Request
156
+ Project rules (a fixed session name, a startup command or an icon per project), wildcard rules,
157
+ pinned and hidden sessions, sorting, zoxide and themes are all covered in
158
+ [docs/configuration.md](docs/configuration.md).
200
159
 
201
- ## License
160
+ ### Search history
202
161
 
203
- MIT License - see [LICENSE](./LICENSE) for details.
162
+ Searches rank what you open often a little higher. Names, folders and open counts are kept in
163
+ `~/.local/state/mux-sesh/frecency.jsonl` and never leave your machine. Delete the file to clear it,
164
+ or set `"search_history": false`. See [Search History](docs/configuration.md#search-history).
204
165
 
205
- ## Acknowledgments
166
+ ## When something goes wrong
206
167
 
207
- - Inspired by [ThePrimeagen's tmux-sessionizer](https://github.com/ThePrimeagen/.dotfiles/blob/master/bin/.local/scripts/tmux-sessionizer)
208
- - Built with [OpenTUI](https://github.com/sst/opentui)
209
- - UI design inspired by [nvim telescope plugin](https://github.com/nvim-telescope/telescope.nvim)
168
+ - **mux-sesh won't start:** a startup screen names the problem (an invalid config field, or no
169
+ usable tmux or Herdr) and what to do. Press `r` to retry after fixing it.
170
+ - **"no prebuilt binary":** reinstall without `--omit=optional`.
171
+ - **A crash:** a recovery screen shows a diagnostics report. `c` copies it, `o` asks before opening
172
+ a prefilled GitHub issue (opening it sends the report to GitHub), `r` recovers and `q` quits. The
173
+ report is redacted, but read it before sharing.
210
174
 
211
- ## Related Projects
175
+ More: [Crash Recovery](docs/workflows.md#crash-recovery).
212
176
 
213
- - [mux-manager](https://github.com/quiet-ghost/mux-manager) - Telescope-based tmux session manager for Neovim
177
+ ## Docs
214
178
 
215
- ---
179
+ - [Workflows](docs/workflows.md): step-by-step guides for every task
180
+ - [Configuration](docs/configuration.md): every option and rule
181
+ - [Keybindings](docs/keybindings.md): every key, in vim and standard mode
182
+ - [Themes](docs/themes.md): built-in themes, custom themes and Omarchy
183
+ - [Changelog](CHANGELOG.md)
216
184
 
217
- <p align="center">
218
- Made with using <a href="https://github.com/sst/opentui">OpenTUI</a> and <a href="https://bun.sh">Bun</a>
219
- </p>
185
+ ## Development
186
+
187
+ ```bash
188
+ bun install
189
+ bun run typecheck
190
+ bun test
191
+ bun run dev
192
+ ```
193
+
194
+ `bun run dev` runs from source with your real config. `bun run dev:config-error`,
195
+ `dev:backend-error` and `dev:crash` open each failure screen. [AGENTS.md](AGENTS.md) describes the
196
+ source layout, every script, the test conventions and the rules for never touching a live tmux or
197
+ Herdr session from tests. Builds, packing and release checks are in
198
+ [Install From Source](docs/workflows.md#install-from-source).
199
+
200
+ ## License
201
+
202
+ MIT. See [LICENSE](LICENSE).
203
+
204
+ ## Related
205
+
206
+ - [mux-manager](https://github.com/quiet-ghost/mux-manager) for Telescope-based tmux session
207
+ management inside Neovim
208
+ - Built with [OpenTUI](https://github.com/anomalyco/opentui)
package/bin/mux-sesh ADDED
@@ -0,0 +1,62 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ invocation_cwd="$(pwd -P)"
5
+
6
+ # Get the real path of this script, resolving any symlinks
7
+ script_path="$0"
8
+ while [ -L "$script_path" ]; do
9
+ link_target="$(readlink "$script_path")"
10
+ case "$link_target" in
11
+ /*) script_path="$link_target" ;;
12
+ *) script_path="$(dirname "$script_path")/$link_target" ;;
13
+ esac
14
+ done
15
+ script_dir="$(dirname "$script_path")"
16
+ script_dir="$(cd "$script_dir" && pwd -P)"
17
+ package_root="${script_dir%/*}"
18
+
19
+ . "$script_dir/platform.sh"
20
+
21
+ # A dev checkout runs from source; Bun needs the package directory to bootstrap its JSX settings.
22
+ run_source() {
23
+ current_dir="$script_dir"
24
+ while [ "$current_dir" != "/" ]; do
25
+ if [ -f "$current_dir/src/index.tsx" ]; then
26
+ if ! command -v bun >/dev/null 2>&1; then
27
+ printf 'mux-sesh: running from source in %s needs Bun on PATH. Install Bun from https://bun.sh, then retry.\n' "$current_dir" >&2
28
+ exit 1
29
+ fi
30
+
31
+ cd "$current_dir"
32
+ MUX_SESH_INVOCATION_CWD="$invocation_cwd" exec bun "$current_dir/src/index.tsx" "$@"
33
+ fi
34
+ current_dir="$(dirname "$current_dir")"
35
+ done
36
+ }
37
+
38
+ # exec replaces this shell, so the binary owns the terminal, signals, and exit status directly.
39
+ run_binary() {
40
+ binary=""
41
+
42
+ # bin/postinstall links the binary it resolved; without the link, search as postinstall would.
43
+ if [ -x "$script_dir/.platform-binary" ]; then
44
+ binary="$script_dir/.platform-binary"
45
+ else
46
+ binary="$(mux_sesh_find_binary "$package_root")" || binary=""
47
+ fi
48
+
49
+ if [ -n "$binary" ]; then
50
+ MUX_SESH_INVOCATION_CWD="$invocation_cwd" exec "$binary" "$@"
51
+ fi
52
+ }
53
+
54
+ if [ "${MUX_SESH_DEV:-}" = 1 ]; then
55
+ run_source "$@"
56
+ fi
57
+
58
+ run_binary "$@"
59
+ run_source "$@"
60
+
61
+ mux_sesh_missing_binary_message >&2
62
+ exit 1
@@ -0,0 +1,139 @@
1
+ # Platform binary selection shared by bin/mux-sesh and bin/postinstall. Sourced, not executed.
2
+
3
+ # Prints platform package names in preference order. Arguments: os arch libc avx2(yes|no).
4
+ # Keep in sync with Host.candidates in tools/build/targets.ts; tests compare both.
5
+ mux_sesh_platform_candidates() {
6
+ _mux_os=$1
7
+ _mux_arch=$2
8
+ _mux_libc=$3
9
+ _mux_avx2=$4
10
+
11
+ if [ "$_mux_arch" != x64 ]; then
12
+ _mux_variants=default
13
+ elif [ "$_mux_avx2" = yes ]; then
14
+ _mux_variants="default baseline"
15
+ else
16
+ _mux_variants="baseline default"
17
+ fi
18
+
19
+ if [ "$_mux_os" != linux ]; then
20
+ _mux_libcs=none
21
+ elif [ "$_mux_libc" = musl ]; then
22
+ _mux_libcs="musl glibc"
23
+ else
24
+ _mux_libcs="glibc musl"
25
+ fi
26
+
27
+ for _mux_candidate_libc in $_mux_libcs; do
28
+ for _mux_variant in $_mux_variants; do
29
+ _mux_name="mux-sesh-$_mux_os-$_mux_arch"
30
+
31
+ if [ "$_mux_variant" = baseline ]; then
32
+ _mux_name="$_mux_name-baseline"
33
+ fi
34
+
35
+ if [ "$_mux_candidate_libc" = musl ]; then
36
+ _mux_name="$_mux_name-musl"
37
+ fi
38
+
39
+ printf '%s\n' "$_mux_name"
40
+ done
41
+ done
42
+ }
43
+
44
+ # Sets mux_sesh_os, mux_sesh_arch, mux_sesh_libc, and mux_sesh_avx2 for this machine.
45
+ # Most hosts are answered by builtins plus one uname call, keeping launch overhead low.
46
+ mux_sesh_detect_host() {
47
+ mux_sesh_uname="$(uname -s -m)"
48
+
49
+ case "${mux_sesh_uname%% *}" in
50
+ Linux) mux_sesh_os=linux ;;
51
+ Darwin) mux_sesh_os=darwin ;;
52
+ *) mux_sesh_os=unsupported ;;
53
+ esac
54
+
55
+ case "${mux_sesh_uname##* }" in
56
+ x86_64 | amd64) mux_sesh_arch=x64 ;;
57
+ aarch64 | arm64) mux_sesh_arch=arm64 ;;
58
+ *) mux_sesh_arch=unsupported ;;
59
+ esac
60
+
61
+ # Alpine marks itself and a glibc loader means glibc; other systems name their libc in ldd.
62
+ mux_sesh_libc=none
63
+
64
+ if [ "$mux_sesh_os" != linux ]; then
65
+ :
66
+ elif [ -f /etc/alpine-release ]; then
67
+ mux_sesh_libc=musl
68
+ elif [ -e /lib64/ld-linux-x86-64.so.2 ] || [ -e /lib/ld-linux-aarch64.so.1 ]; then
69
+ mux_sesh_libc=glibc
70
+ elif ldd --version 2>&1 | grep -qi musl; then
71
+ mux_sesh_libc=musl
72
+ else
73
+ mux_sesh_libc=glibc
74
+ fi
75
+
76
+ # Bun's default x64 runtime needs AVX2. Unknown support answers no, so baseline builds come first.
77
+ mux_sesh_avx2=no
78
+
79
+ if [ "$mux_sesh_arch" != x64 ]; then
80
+ :
81
+ elif [ "$mux_sesh_os" = linux ]; then
82
+ if grep -qw avx2 /proc/cpuinfo 2>/dev/null; then mux_sesh_avx2=yes; fi
83
+ elif [ "$mux_sesh_os" = darwin ]; then
84
+ if [ "$(sysctl -n hw.optional.avx2_0 2>/dev/null)" = 1 ]; then mux_sesh_avx2=yes; fi
85
+ fi
86
+ }
87
+
88
+ # Prints the best installed platform binary. npm nests it under the package; bun and pnpm hoist it beside.
89
+ mux_sesh_find_binary() {
90
+ _mux_root=$1
91
+ mux_sesh_detect_host
92
+
93
+ if [ "$mux_sesh_os" = unsupported ] || [ "$mux_sesh_arch" = unsupported ]; then
94
+ return 1
95
+ fi
96
+
97
+ for _mux_name in $(mux_sesh_platform_candidates "$mux_sesh_os" "$mux_sesh_arch" "$mux_sesh_libc" "$mux_sesh_avx2"); do
98
+ _mux_dir=$_mux_root
99
+
100
+ while :; do
101
+ _mux_binary="$_mux_dir/node_modules/$_mux_name/bin/mux-sesh"
102
+
103
+ if [ -f "$_mux_binary" ] && [ -x "$_mux_binary" ]; then
104
+ printf '%s\n' "$_mux_binary"
105
+ return 0
106
+ fi
107
+
108
+ if [ -z "$_mux_dir" ] || [ "$_mux_dir" = / ]; then
109
+ break
110
+ fi
111
+
112
+ _mux_dir=${_mux_dir%/*}
113
+ done
114
+ done
115
+
116
+ return 1
117
+ }
118
+
119
+ mux_sesh_missing_binary_message() {
120
+ mux_sesh_detect_host
121
+
122
+ if [ "$mux_sesh_os" = unsupported ] || [ "$mux_sesh_arch" = unsupported ]; then
123
+ printf 'mux-sesh has no prebuilt binary for %s %s.\n' "$(uname -s)" "$(uname -m)"
124
+ printf 'Supported platforms: Linux x64/arm64 (glibc or musl) and macOS x64/arm64.\n'
125
+ return 0
126
+ fi
127
+
128
+ _mux_platform="$mux_sesh_os-$mux_sesh_arch"
129
+
130
+ if [ "$mux_sesh_os" = linux ]; then
131
+ _mux_platform="$_mux_platform ($mux_sesh_libc)"
132
+ fi
133
+
134
+ _mux_expected=$(mux_sesh_platform_candidates "$mux_sesh_os" "$mux_sesh_arch" "$mux_sesh_libc" "$mux_sesh_avx2" | head -n 1)
135
+ printf 'mux-sesh could not find its prebuilt binary for %s.\n' "$_mux_platform"
136
+ printf 'It ships in the optional dependency %s, which was not installed.\n' "$_mux_expected"
137
+ printf 'Optional dependencies are skipped by --omit=optional, --no-optional, or a lockfile made on another platform.\n'
138
+ printf 'Reinstall with optional dependencies enabled: npm install -g mux-sesh (or bun install -g mux-sesh).\n'
139
+ }
@@ -0,0 +1,22 @@
1
+ #!/bin/sh
2
+ # Links the platform binary bin/mux-sesh should run. It never fails the install: the launcher
3
+ # searches again at startup and explains what is missing.
4
+
5
+ script_dir="$(cd "$(dirname "$0")" && pwd -P)"
6
+ link="$script_dir/.platform-binary"
7
+
8
+ . "$script_dir/platform.sh"
9
+
10
+ rm -f "$link"
11
+
12
+ if binary="$(mux_sesh_find_binary "${script_dir%/*}")"; then
13
+ ln -s "$binary" "$link" 2>/dev/null || true
14
+ exit 0
15
+ fi
16
+
17
+ {
18
+ printf 'mux-sesh postinstall warning: '
19
+ mux_sesh_missing_binary_message
20
+ } >&2
21
+
22
+ exit 0