mux-sesh 1.7.2 → 1.9.0
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/README.md +69 -329
- package/package.json +6 -2
- package/src/app/commands.ts +10 -0
- package/src/app/controller.ts +2 -0
- package/src/app/data.ts +5 -1
- package/src/app/effects.ts +65 -0
- package/src/app/handlers.ts +48 -0
- package/src/app/keyboard.ts +2 -0
- package/src/config/index.ts +24 -0
- package/src/files/target.ts +99 -0
- package/src/handlers/action-helpers.ts +12 -1
- package/src/handlers/actions.ts +31 -4
- package/src/handlers/keyboard/normal.ts +9 -0
- package/src/handlers/keyboard/shared.ts +1 -0
- package/src/items/order.ts +41 -8
- package/src/preview/project.ts +83 -4
- package/src/projects/session-links.ts +5 -2
- package/src/search/fff.ts +224 -0
- package/src/search/index.ts +11 -0
- package/src/settings.ts +13 -0
- package/src/types/index.ts +3 -1
- package/src/ui/CommandsModal.tsx +11 -0
- package/src/ui/ItemList.tsx +5 -1
- package/src/ui/SessionDetailsPanel.tsx +7 -6
- package/src/ui/item-icon.ts +18 -2
package/README.md
CHANGED
|
@@ -1,390 +1,130 @@
|
|
|
1
1
|
# mux-sesh
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Fast tmux session switching and project launching from a polished terminal UI.
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<img src="screenshot.png" alt="mux-sesh screenshot" width="800">
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Why mux-sesh
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- **Project scanning** - Browse and create sessions from local directories
|
|
16
|
-
- **Config-driven sessions** - Exact project rules, wildcard rules, and listed config targets
|
|
17
|
-
- **Session-aware project picker** - See when a project will attach to an existing tmux session vs create a new one
|
|
18
|
-
- **Rich previews** - Preview commands with directory fallback and live tmux context for running projects
|
|
19
|
-
- **GitHub integration** - Clone repos directly from URLs
|
|
20
|
-
- **Quick select** - Use number keys (1-9) for instant switching
|
|
21
|
-
- **Session management** - Create, switch, kill, and rename sessions
|
|
11
|
+
- Switch to live tmux sessions without leaving the keyboard.
|
|
12
|
+
- Launch local projects from a single, searchable picker.
|
|
13
|
+
- Keep reusable project rules in config instead of shell scripts.
|
|
14
|
+
- Stay inside tmux with previews, quick actions, and lightweight workflows.
|
|
22
15
|
|
|
23
|
-
##
|
|
16
|
+
## Quick Start
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
`mux-sesh` runs on Bun and talks directly to tmux.
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
- [Zig](https://ziglang.org) - Required for building OpenTUI
|
|
29
|
-
- tmux - Terminal multiplexer
|
|
30
|
-
- git - For GitHub cloning feature
|
|
20
|
+
Prerequisites:
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
- [Bun](https://bun.sh)
|
|
23
|
+
- [tmux](https://github.com/tmux/tmux/wiki)
|
|
24
|
+
- [git](https://git-scm.com) for cloning GitHub repositories from the new-session flow
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
brew install zig
|
|
26
|
+
Install globally:
|
|
38
27
|
|
|
39
|
-
|
|
28
|
+
```bash
|
|
29
|
+
bun install -g mux-sesh
|
|
40
30
|
```
|
|
41
31
|
|
|
42
|
-
|
|
32
|
+
Run it:
|
|
43
33
|
|
|
44
34
|
```bash
|
|
45
|
-
bun install -g mux-sesh
|
|
46
|
-
|
|
47
|
-
# Then run
|
|
48
35
|
mux-sesh
|
|
49
36
|
```
|
|
50
37
|
|
|
51
|
-
|
|
38
|
+
Recommended tmux binding:
|
|
39
|
+
|
|
40
|
+
```tmux
|
|
41
|
+
bind-key -n M-w popup -E -w 62% -h 70% "mux-sesh"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Reload tmux after adding the binding:
|
|
52
45
|
|
|
53
46
|
```bash
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
tmux source-file ~/.tmux.conf
|
|
48
|
+
```
|
|
56
49
|
|
|
57
|
-
|
|
58
|
-
bun install
|
|
50
|
+
## How It Works
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
- Sessions view shows live tmux sessions.
|
|
53
|
+
- Projects view shows scanned or configured directories.
|
|
54
|
+
- Selecting a project attaches to an existing session when possible, or creates one.
|
|
55
|
+
- The new-session flow searches files and directories under `project_paths` as you type, powered by [fff](https://github.com/dmtrKovalenko/fff).
|
|
56
|
+
- Selecting a file creates a session in the file's directory and opens it in your editor.
|
|
57
|
+
- The new-session flow can also clone a GitHub repository into your configured repos directory.
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
sudo cp dist/mux-sesh /usr/local/bin/
|
|
65
|
-
# or
|
|
66
|
-
cp dist/mux-sesh ~/.local/bin/
|
|
67
|
-
```
|
|
59
|
+
## Minimal Configuration
|
|
68
60
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
### Normal Mode
|
|
72
|
-
|
|
73
|
-
| Key | Action |
|
|
74
|
-
| ---------------------- | ----------------------------------------------- |
|
|
75
|
-
| `j` / `k` or `↑` / `↓` | Navigate up/down |
|
|
76
|
-
| `1-9` | Quick select session/project |
|
|
77
|
-
| `Enter` | Switch to session / Create from project |
|
|
78
|
-
| `i` | Enter search mode |
|
|
79
|
-
| `n` | Create new session |
|
|
80
|
-
| `d` | Kill selected session |
|
|
81
|
-
| `r` | Rename selected session |
|
|
82
|
-
| `l` | Jump to previous tmux session |
|
|
83
|
-
| `g` | Open the git-root session for the selected item |
|
|
84
|
-
| `e` | Edit configured session target |
|
|
85
|
-
| `R` | Refresh list |
|
|
86
|
-
| `s` | Switch to sessions view |
|
|
87
|
-
| `p` | Switch to projects view |
|
|
88
|
-
| `q` or `Esc` | Quit |
|
|
89
|
-
|
|
90
|
-
### Standard Mode
|
|
91
|
-
|
|
92
|
-
Standard mode is a search-first workflow. mux-sesh starts in search mode, keeps the query box focused, and favors a configurable prefix key for secondary actions.
|
|
93
|
-
|
|
94
|
-
| Key | Action |
|
|
95
|
-
| --------- | -------------------- |
|
|
96
|
-
| Type | Filter immediately |
|
|
97
|
-
| `↑` / `↓` | Navigate results |
|
|
98
|
-
| `Enter` | Select first result |
|
|
99
|
-
| `Esc` | Clear current search |
|
|
100
|
-
| `Ctrl+P` | Open command palette |
|
|
101
|
-
| `Ctrl+Q` | Quit |
|
|
102
|
-
|
|
103
|
-
Default prefix: `Ctrl+X`.
|
|
104
|
-
|
|
105
|
-
Common prefix actions while in standard mode:
|
|
106
|
-
|
|
107
|
-
| Prefix action | Result |
|
|
108
|
-
| ------------- | ----------------------------- |
|
|
109
|
-
| `n` | New session |
|
|
110
|
-
| `o` | Open OpenCode session manager |
|
|
111
|
-
| `s` | Open settings |
|
|
112
|
-
| `l` | Jump to previous tmux session |
|
|
113
|
-
| `g` | Open git-root session |
|
|
114
|
-
| `r` | Rename selected live session |
|
|
115
|
-
| `d` | Kill selected live session |
|
|
116
|
-
| `Shift+R` | Refresh sessions/projects |
|
|
117
|
-
|
|
118
|
-
### Search Mode
|
|
119
|
-
|
|
120
|
-
| Key | Action |
|
|
121
|
-
| -------------- | ------------------------ |
|
|
122
|
-
| Type to search | Filter sessions/projects |
|
|
123
|
-
| `Enter` | Select first result |
|
|
124
|
-
| `↑` / `↓` | Navigate results |
|
|
125
|
-
| `Esc` | Cancel search |
|
|
126
|
-
|
|
127
|
-
### New Session Mode
|
|
128
|
-
|
|
129
|
-
| Key | Action |
|
|
130
|
-
| ----------------- | ------------------------ |
|
|
131
|
-
| Type project name | Filter projects |
|
|
132
|
-
| Paste GitHub URL | Clone and create session |
|
|
133
|
-
| Type custom name | Create named session |
|
|
134
|
-
| `Enter` | Confirm selection |
|
|
135
|
-
| `Esc` | Cancel |
|
|
136
|
-
|
|
137
|
-
## Configuration
|
|
138
|
-
|
|
139
|
-
Configuration is stored at `~/.config/mux-sesh/config.json`:
|
|
61
|
+
Config lives at `~/.config/mux-sesh/config.json`.
|
|
140
62
|
|
|
141
63
|
```json
|
|
142
64
|
{
|
|
143
|
-
"project_paths": ["~/dev", "~/personal"
|
|
65
|
+
"project_paths": ["~/dev", "~/personal"],
|
|
144
66
|
"repos_path": "~/dev/repos",
|
|
145
|
-
"editor": "nvim",
|
|
146
|
-
"editor_cmd": "nvim -c \"lua vim.defer_fn(function() if pcall(require, 'telescope') then vim.cmd('Telescope find_files') end end, 100)\"",
|
|
147
67
|
"keybind_mode": "vim",
|
|
148
68
|
"prefix_key": "ctrl+x",
|
|
149
69
|
"theme": "rosepine",
|
|
150
|
-
"color_scheme": "system",
|
|
151
|
-
"sort_order": "zoxide-first",
|
|
152
|
-
"zoxide_mode": "rank",
|
|
153
|
-
"auto_update": true,
|
|
154
|
-
"dir_length": 2,
|
|
155
|
-
"hidden_sessions": ["scratch", "tmp*"],
|
|
156
|
-
"icons": {
|
|
157
|
-
"tmux": "",
|
|
158
|
-
"configured": "",
|
|
159
|
-
"project": "",
|
|
160
|
-
"opencode": ""
|
|
161
|
-
},
|
|
162
|
-
"default_session": {
|
|
163
|
-
"startup_command": "nvim",
|
|
164
|
-
"preview_command": "eza --all {}"
|
|
165
|
-
},
|
|
166
|
-
"projects": [
|
|
167
|
-
{
|
|
168
|
-
"path": "~/.dotfiles/hypr/.config/hypr",
|
|
169
|
-
"session_name": "hyprland",
|
|
170
|
-
"listed": true,
|
|
171
|
-
"icon": "",
|
|
172
|
-
"startup_command": "nvim"
|
|
173
|
-
}
|
|
174
|
-
],
|
|
175
|
-
"wildcards": [
|
|
176
|
-
{
|
|
177
|
-
"pattern": "~/work/**",
|
|
178
|
-
"startup_command": "bun run dev"
|
|
179
|
-
}
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Configuration Options
|
|
185
|
-
|
|
186
|
-
- **`project_paths`** - Array of directories to scan for projects
|
|
187
|
-
- **`repos_path`** - Directory where GitHub repositories will be cloned
|
|
188
|
-
- **`editor`** - Default editor to use
|
|
189
|
-
- **`editor_cmd`** - Default startup command for new sessions unless overridden
|
|
190
|
-
- **`keybind_mode`** - `vim` or `standard`
|
|
191
|
-
- **`prefix_key`** - Prefix used for multi-key commands in standard mode and optional vim mode workflows
|
|
192
|
-
- **`theme`** - Built-in or custom theme name
|
|
193
|
-
- **`color_scheme`** - `system`, `dark`, or `light`
|
|
194
|
-
- **`sort_order`** - Session/project ordering: `live-first`, `configured-first`, `zoxide-first`, or `alphabetical`
|
|
195
|
-
- **`zoxide_mode`** - `off`, `rank`, or `merge` for zoxide-aware project ordering
|
|
196
|
-
- **`auto_update`** - Enable or disable background update checks
|
|
197
|
-
- **`dir_length`** - Number of path segments used when generating session names from git roots or project paths
|
|
198
|
-
- **`hidden_sessions`** - Glob patterns for live tmux sessions to hide from the list
|
|
199
|
-
- **`icons`** - Global icons for tmux, configured, project, and opencode rows
|
|
200
|
-
- **`themes`** - Optional custom theme definitions keyed by name
|
|
201
|
-
- **`default_session`** - Fallback startup and preview commands
|
|
202
|
-
- **`projects`** - Exact path rules with optional `session_name`, `startup_command`, `preview_command`, `listed`, and `icon`
|
|
203
|
-
- **`wildcards`** - Pattern-based defaults for matching projects
|
|
204
|
-
|
|
205
|
-
### Rule Resolution
|
|
206
|
-
|
|
207
|
-
When you select a project, mux-sesh resolves its behavior in this order:
|
|
208
|
-
|
|
209
|
-
1. Exact `projects[]` path match
|
|
210
|
-
2. First matching `wildcards[]` rule
|
|
211
|
-
3. `default_session`
|
|
212
|
-
|
|
213
|
-
Session names use the git root when available, then apply `dir_length` if you did not set an explicit `session_name`.
|
|
214
|
-
|
|
215
|
-
### Listed Sessions
|
|
216
|
-
|
|
217
|
-
Set `listed: true` on a project rule to keep that target visible in the Sessions view even when tmux has not started it yet. This works well for dotfiles, config folders, dashboards, and other “always useful” targets.
|
|
218
|
-
|
|
219
|
-
If a live tmux session already exists with the same title, the live session takes precedence.
|
|
220
|
-
|
|
221
|
-
### Sorting and Zoxide
|
|
222
|
-
|
|
223
|
-
- `zoxide_mode: off` - scan only
|
|
224
|
-
- `zoxide_mode: rank` - reorder discovered projects by zoxide score
|
|
225
|
-
- `zoxide_mode: merge` - include additional zoxide-ranked projects inside configured roots
|
|
226
|
-
- `sort_order: live-first` - live sessions before configured placeholders
|
|
227
|
-
- `sort_order: configured-first` - configured placeholders before live sessions
|
|
228
|
-
- `sort_order: zoxide-first` - preserve project discovery/zoxide ordering
|
|
229
|
-
- `sort_order: alphabetical` - alphabetical project and session ordering
|
|
230
|
-
|
|
231
|
-
### Preview Behavior
|
|
232
|
-
|
|
233
|
-
`preview_command` inherits from `default_session`, can be overridden per project rule, and supports `{}` interpolation for the selected path.
|
|
234
|
-
|
|
235
|
-
- if the preview command succeeds, mux-sesh renders its output in the detail panel
|
|
236
|
-
- if it fails or times out, mux-sesh falls back to a directory listing
|
|
237
|
-
- if a project already has a linked tmux session, the preview also includes live tmux window details
|
|
238
|
-
|
|
239
|
-
Example:
|
|
240
|
-
|
|
241
|
-
```json
|
|
242
|
-
{
|
|
243
70
|
"default_session": {
|
|
244
|
-
"
|
|
245
|
-
}
|
|
246
|
-
"projects": [
|
|
247
|
-
{
|
|
248
|
-
"path": "~/dev/projects/mux-sesh",
|
|
249
|
-
"preview_command": "git -C {} status --short"
|
|
250
|
-
}
|
|
251
|
-
]
|
|
71
|
+
"startup_command": "nvim"
|
|
72
|
+
}
|
|
252
73
|
}
|
|
253
74
|
```
|
|
254
75
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
For the best experience, bind mux-sesh to a global tmux keybinding. Add this to your `~/.tmux.conf`:
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
# Open mux-sesh in a popup with Alt+w (no prefix required)
|
|
261
|
-
bind-key -n M-w popup -E -w 62% -h 70% "mux-sesh"
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
After adding the binding, reload your tmux config:
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
tmux source-file ~/.tmux.conf
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
Now you can press `Alt+w` from anywhere in tmux (including inside nvim) to launch mux-sesh.
|
|
271
|
-
|
|
272
|
-
**Alternative Integration:**
|
|
273
|
-
|
|
274
|
-
- **From Neovim**: Use [mux-manager](https://github.com/quiet-ghost/mux-manager) - a Telescope-based tmux session manager that integrates directly into Neovim
|
|
275
|
-
- **With prefix**: Use `bind-key f popup -E -w 80% -h 80% "mux-sesh"` if you prefer requiring the tmux prefix key first
|
|
276
|
-
|
|
277
|
-
## Usage Examples
|
|
278
|
-
|
|
279
|
-
### Quick Session Switching
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
# Open mux-sesh
|
|
283
|
-
mux-sesh
|
|
284
|
-
|
|
285
|
-
# Press 1-9 to instantly switch to that session
|
|
286
|
-
# Or use j/k to navigate and Enter to select
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### Create Session from Project
|
|
290
|
-
|
|
291
|
-
```bash
|
|
292
|
-
mux-sesh
|
|
293
|
-
|
|
294
|
-
# Press 'n' for new session
|
|
295
|
-
# Type project name to filter
|
|
296
|
-
# Rows show whether they will attach to an existing tmux session or create a new one
|
|
297
|
-
# Press Enter to create or attach
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### Jump to Root / Last / Edit Target
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
mux-sesh
|
|
304
|
-
|
|
305
|
-
# Select a project or session, then press 'g' to jump to its git-root session
|
|
306
|
-
# Press 'l' to jump to the most recent non-current tmux session
|
|
307
|
-
# Select a configured session and press 'e' to open its target in your editor
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Clone from GitHub
|
|
76
|
+
Full configuration reference: [docs/configuration.md](docs/configuration.md)
|
|
311
77
|
|
|
312
|
-
|
|
313
|
-
mux-sesh
|
|
78
|
+
## Essential Keys
|
|
314
79
|
|
|
315
|
-
|
|
316
|
-
# Paste GitHub URL:
|
|
317
|
-
# https://github.com/user/repo
|
|
318
|
-
# or
|
|
319
|
-
# git@github.com:user/repo.git
|
|
320
|
-
# Press Enter to clone and create session
|
|
321
|
-
```
|
|
80
|
+
Default mode is `vim`.
|
|
322
81
|
|
|
323
|
-
|
|
82
|
+
| Key | Action |
|
|
83
|
+
| ----------- | --------------------- |
|
|
84
|
+
| `j` / `k` | Move |
|
|
85
|
+
| `Enter` | Attach or create |
|
|
86
|
+
| `i` | Search |
|
|
87
|
+
| `n` | New session |
|
|
88
|
+
| `d` | Kill selected session |
|
|
89
|
+
| `1-9` | Quick select |
|
|
90
|
+
| `Ctrl+P` | Open command palette |
|
|
91
|
+
| `q` / `Esc` | Quit |
|
|
324
92
|
|
|
325
|
-
|
|
326
|
-
mux-sesh
|
|
93
|
+
With the default prefix key, secondary actions live behind `ctrl+x`:
|
|
327
94
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
95
|
+
- `ctrl+x s` sessions
|
|
96
|
+
- `ctrl+x p` projects
|
|
97
|
+
- `ctrl+x l` last session
|
|
98
|
+
- `ctrl+x g` git root session
|
|
99
|
+
- `ctrl+x r` rename session
|
|
100
|
+
- `ctrl+x e` edit configured target
|
|
101
|
+
- `ctrl+x Shift+R` refresh
|
|
332
102
|
|
|
333
|
-
|
|
103
|
+
In vim mode, `s` and `p` are also available as direct view switches.
|
|
334
104
|
|
|
335
|
-
|
|
105
|
+
Full keybinding reference: [docs/keybindings.md](docs/keybindings.md)
|
|
336
106
|
|
|
337
|
-
|
|
338
|
-
- **Active**: `#a6e3a1` (Green)
|
|
339
|
-
- **Inactive**: `#6c7086` (Gray)
|
|
340
|
-
- **Border**: `#89b4fa` (Blue)
|
|
341
|
-
- **Key**: `#f9e2af` (Yellow)
|
|
342
|
-
- **Action**: `#cba6f7` (Mauve)
|
|
107
|
+
## Docs
|
|
343
108
|
|
|
344
|
-
|
|
109
|
+
- [Configuration](docs/configuration.md)
|
|
110
|
+
- [Keybindings](docs/keybindings.md)
|
|
111
|
+
- [Workflows](docs/workflows.md)
|
|
345
112
|
|
|
346
113
|
## Development
|
|
347
114
|
|
|
348
115
|
```bash
|
|
349
|
-
# Install dependencies
|
|
350
116
|
bun install
|
|
351
|
-
|
|
352
|
-
# Run in dev mode (with hot reload)
|
|
353
|
-
bun run dev
|
|
354
|
-
|
|
355
|
-
# Type check
|
|
356
117
|
bun run typecheck
|
|
357
|
-
|
|
358
|
-
# Build for production
|
|
359
|
-
bun run build
|
|
118
|
+
bun test
|
|
360
119
|
```
|
|
361
120
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
365
|
-
|
|
366
|
-
1. Fork the repository
|
|
367
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
368
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
369
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
370
|
-
5. Open a Pull Request
|
|
121
|
+
Use `bun run build` only when you need the compiled binary in `dist/mux-sesh`.
|
|
371
122
|
|
|
372
123
|
## License
|
|
373
124
|
|
|
374
|
-
MIT
|
|
125
|
+
MIT. See [LICENSE](LICENSE).
|
|
375
126
|
|
|
376
|
-
##
|
|
127
|
+
## Related
|
|
377
128
|
|
|
378
|
-
-
|
|
129
|
+
- [mux-manager](https://github.com/quiet-ghost/mux-manager) for Telescope-based tmux session management inside Neovim
|
|
379
130
|
- Built with [OpenTUI](https://github.com/anomalyco/opentui)
|
|
380
|
-
- UI design inspired by [nvim telescope plugin](https://github.com/nvim-telescope/telescope.nvim)
|
|
381
|
-
|
|
382
|
-
## Related Projects
|
|
383
|
-
|
|
384
|
-
- [mux-manager](https://github.com/quiet-ghost/mux-manager) - Telescope-based tmux session manager for Neovim
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
<p align="center">
|
|
389
|
-
Made with using <a href="https://github.com/anomalyco/opentui">OpenTUI</a> and <a href="https://bun.sh">Bun</a>
|
|
390
|
-
</p>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "mux-sesh",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.9.0",
|
|
5
5
|
"description": "A beautiful tmux session manager built with OpenTUI - fuzzy search sessions, manage projects, clone from GitHub",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"packageManager": "bun@1.3.5",
|
|
@@ -48,13 +48,17 @@
|
|
|
48
48
|
"engines": {
|
|
49
49
|
"bun": ">=1.0.0"
|
|
50
50
|
},
|
|
51
|
+
"overrides": {
|
|
52
|
+
"@types/node": "^24"
|
|
53
|
+
},
|
|
51
54
|
"dependencies": {
|
|
55
|
+
"@ff-labs/fff-bun": "0.9.4",
|
|
52
56
|
"@opentui/core": "0.1.60",
|
|
53
57
|
"@opentui/react": "0.1.60",
|
|
54
58
|
"react": "^19.2.2"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|
|
57
|
-
"@types/bun": "1.3.
|
|
61
|
+
"@types/bun": "1.3.14",
|
|
58
62
|
"@types/react": "^19.2.7",
|
|
59
63
|
"prettier": "3.6.2",
|
|
60
64
|
"typescript": "^5.9.3"
|
package/src/app/commands.ts
CHANGED
|
@@ -15,6 +15,7 @@ interface ExecuteCommandContext {
|
|
|
15
15
|
openRenameModal: (sessionName: string) => void
|
|
16
16
|
openSettingsModal: () => void
|
|
17
17
|
requestKillSession: (sessionName: string) => void
|
|
18
|
+
togglePinnedSession: (sessionName: string) => Promise<void>
|
|
18
19
|
setAppMode: (mode: AppMode) => void
|
|
19
20
|
setViewMode: (mode: ViewMode) => void
|
|
20
21
|
setAllItems: (items: Item[]) => void
|
|
@@ -87,6 +88,15 @@ export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandCo
|
|
|
87
88
|
}
|
|
88
89
|
return
|
|
89
90
|
}
|
|
91
|
+
case 'toggle-pin-session': {
|
|
92
|
+
const target =
|
|
93
|
+
ctx.viewMode === ViewMode.Sessions ? ctx.regularSessions[ctx.cursor] : undefined
|
|
94
|
+
if (target) {
|
|
95
|
+
ctx.closeModal()
|
|
96
|
+
await ctx.togglePinnedSession(target.title)
|
|
97
|
+
}
|
|
98
|
+
return
|
|
99
|
+
}
|
|
90
100
|
case 'last-session':
|
|
91
101
|
ctx.closeModal()
|
|
92
102
|
await ctx.handleLastSession()
|
package/src/app/controller.ts
CHANGED
|
@@ -193,6 +193,7 @@ export function useAppController() {
|
|
|
193
193
|
handleNewSessionSubmit,
|
|
194
194
|
handleSettingsEditorSubmit,
|
|
195
195
|
handleSettingOptionSubmit,
|
|
196
|
+
handleTogglePinnedSessionWrapper,
|
|
196
197
|
executeCommand,
|
|
197
198
|
} = createAppHandlers({
|
|
198
199
|
appMode,
|
|
@@ -270,6 +271,7 @@ export function useAppController() {
|
|
|
270
271
|
closeModal,
|
|
271
272
|
clearPendingKill,
|
|
272
273
|
requestKillSession,
|
|
274
|
+
togglePinnedSession: handleTogglePinnedSessionWrapper,
|
|
273
275
|
openRenameModal,
|
|
274
276
|
openCommandsModal,
|
|
275
277
|
openSettingsModal,
|
package/src/app/data.ts
CHANGED
|
@@ -41,7 +41,11 @@ export async function loadSessionItems(
|
|
|
41
41
|
getListedSessionItems(config)
|
|
42
42
|
)
|
|
43
43
|
const sessionItems = clearMatchIndices(
|
|
44
|
-
orderSessionItems(
|
|
44
|
+
orderSessionItems(
|
|
45
|
+
mergeSessionItems(visibleSessions, listedSessions),
|
|
46
|
+
config.sortOrder,
|
|
47
|
+
config.pinnedSessions
|
|
48
|
+
)
|
|
45
49
|
)
|
|
46
50
|
|
|
47
51
|
return {
|
package/src/app/effects.ts
CHANGED
|
@@ -2,12 +2,15 @@ import { useEffect, useRef, type Dispatch, type MutableRefObject, type SetStateA
|
|
|
2
2
|
import { checkAndUpdate, updateEvents } from '../update'
|
|
3
3
|
import { showTemporaryToast } from './notifications'
|
|
4
4
|
import { clearMatchIndices, filterAndSortItems } from '../search'
|
|
5
|
+
import { combineFileSearchResults, searchFilesAndDirectories, warmFileSearch } from '../search/fff'
|
|
6
|
+
import { annotateProjectItemsWithSessionLinks } from '../projects/session-links'
|
|
5
7
|
import {
|
|
6
8
|
getProjectSelectionIndex,
|
|
7
9
|
getSessionSelectionIndex,
|
|
8
10
|
loadSessionCandidateItems,
|
|
9
11
|
} from './data'
|
|
10
12
|
import { AppMode, ViewMode, type Config, type Item } from '../types'
|
|
13
|
+
import { isGitHubURL } from '../util/github'
|
|
11
14
|
import { measure } from '../util/perf'
|
|
12
15
|
|
|
13
16
|
export function useAutoUpdateScheduler(
|
|
@@ -269,6 +272,60 @@ export function useSearchFiltering(
|
|
|
269
272
|
}, [allItems, appMode, searchQuery, setCursor, setItems])
|
|
270
273
|
}
|
|
271
274
|
|
|
275
|
+
export function useNewSessionFileSearch(
|
|
276
|
+
appMode: AppMode,
|
|
277
|
+
config: Config | null,
|
|
278
|
+
searchQuery: string,
|
|
279
|
+
sessionItems: Item[],
|
|
280
|
+
setItems: Dispatch<SetStateAction<Item[]>>,
|
|
281
|
+
setCursor: Dispatch<SetStateAction<number>>
|
|
282
|
+
) {
|
|
283
|
+
const sessionItemsRef = useRef(sessionItems)
|
|
284
|
+
sessionItemsRef.current = sessionItems
|
|
285
|
+
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
if (appMode !== AppMode.NewSession || !config) {
|
|
288
|
+
return
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const nextConfig = config
|
|
292
|
+
const query = searchQuery.trim()
|
|
293
|
+
|
|
294
|
+
if (!query || isGitHubURL(query)) {
|
|
295
|
+
void warmFileSearch(nextConfig)
|
|
296
|
+
return
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
let cancelled = false
|
|
300
|
+
|
|
301
|
+
async function runFileSearch() {
|
|
302
|
+
const fileSearchItems = await searchFilesAndDirectories(query, nextConfig)
|
|
303
|
+
if (cancelled || fileSearchItems.length === 0) {
|
|
304
|
+
return
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const liveSessions = sessionItemsRef.current.filter(item => item.isSession)
|
|
308
|
+
const annotated = await annotateProjectItemsWithSessionLinks(
|
|
309
|
+
fileSearchItems,
|
|
310
|
+
liveSessions,
|
|
311
|
+
nextConfig
|
|
312
|
+
)
|
|
313
|
+
if (cancelled) {
|
|
314
|
+
return
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
setItems(current => combineFileSearchResults(annotated, current, query))
|
|
318
|
+
setCursor(0)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
void runFileSearch()
|
|
322
|
+
|
|
323
|
+
return () => {
|
|
324
|
+
cancelled = true
|
|
325
|
+
}
|
|
326
|
+
}, [appMode, config, searchQuery, setCursor, setItems])
|
|
327
|
+
}
|
|
328
|
+
|
|
272
329
|
export function useOpencodeStatsPolling(
|
|
273
330
|
selectedOpencodeSessionName: string | undefined,
|
|
274
331
|
loadOpencodeStatsForSession: (sessionName: string) => Promise<unknown>
|
|
@@ -388,5 +445,13 @@ export function useAppBehaviors(options: UseAppBehaviorsOptions) {
|
|
|
388
445
|
options.setItems,
|
|
389
446
|
options.setCursor
|
|
390
447
|
)
|
|
448
|
+
useNewSessionFileSearch(
|
|
449
|
+
options.appMode,
|
|
450
|
+
options.config,
|
|
451
|
+
options.searchQuery,
|
|
452
|
+
options.sessionItems,
|
|
453
|
+
options.setItems,
|
|
454
|
+
options.setCursor
|
|
455
|
+
)
|
|
391
456
|
useOpencodeStatsPolling(options.selectedOpencodeSessionName, options.loadOpencodeStatsForSession)
|
|
392
457
|
}
|