mux-sesh 1.6.4 → 1.7.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 +90 -59
- package/package.json +7 -5
- package/src/app/commands.ts +120 -0
- package/src/app/controller.ts +397 -0
- package/src/app/controls.ts +121 -0
- package/src/app/core-state.ts +71 -0
- package/src/app/data.ts +90 -0
- package/src/app/derived.ts +77 -0
- package/src/app/effects.ts +392 -0
- package/src/app/handlers.ts +325 -0
- package/src/app/keyboard.ts +161 -0
- package/src/app/modal-keyboard.ts +118 -0
- package/src/app/modal-state.ts +50 -0
- package/src/app/modals-layer.tsx +159 -0
- package/src/app/modals.ts +108 -0
- package/src/app/notifications.ts +21 -0
- package/src/app/opencode.ts +49 -0
- package/src/app/operations.ts +31 -0
- package/src/app/runtime.ts +76 -0
- package/src/app/screen.tsx +217 -0
- package/src/app/state.ts +166 -0
- package/src/app/textarea.ts +16 -0
- package/src/app/view.ts +89 -0
- package/src/app.tsx +7 -1136
- package/src/config/index.ts +36 -42
- package/src/config/paths.ts +13 -0
- package/src/config/session-rules.ts +6 -2
- package/src/config/store.ts +26 -0
- package/src/handlers/action-helpers.ts +50 -0
- package/src/handlers/actions.ts +34 -65
- package/src/handlers/keyboard/index.ts +5 -0
- package/src/handlers/keyboard/new-session.ts +57 -0
- package/src/handlers/keyboard/normal.ts +201 -0
- package/src/handlers/keyboard/opencode.ts +104 -0
- package/src/handlers/keyboard/search.ts +113 -0
- package/src/handlers/keyboard/shared.ts +116 -0
- package/src/opencode/sqlite.ts +21 -6
- package/src/preview/project.ts +41 -15
- package/src/search/index.ts +4 -1
- package/src/settings.ts +294 -297
- package/src/styles/opencode-themes-a.ts +1442 -1
- package/src/styles/opencode-themes-b.ts +1212 -1
- package/src/styles/opencode-tui-colors.ts +1784 -1
- package/src/styles/theme.tsx +2 -1
- package/src/tmux/actions.ts +103 -0
- package/src/tmux/details.ts +123 -0
- package/src/tmux/helpers.ts +35 -0
- package/src/tmux/index.ts +10 -288
- package/src/tmux/list.ts +31 -0
- package/src/tmux/project-discovery.ts +113 -0
- package/src/tmux/project-loader.ts +74 -0
- package/src/tmux/project-zoxide.ts +128 -0
- package/src/tmux/projects.ts +23 -262
- package/src/types/index.ts +0 -1
- package/src/ui/CommandsModal.tsx +87 -22
- package/src/ui/HighlightedText.tsx +1 -5
- package/src/ui/ItemList.tsx +14 -4
- package/src/ui/Modal.tsx +8 -1
- package/src/ui/OpencodeSessionGroup.tsx +20 -9
- package/src/ui/OpencodeStatsPanel.tsx +48 -15
- package/src/ui/RenameModal.tsx +17 -17
- package/src/ui/SearchInput.tsx +1 -20
- package/src/ui/SessionDetailsPanel.tsx +43 -15
- package/src/ui/SessionList.tsx +23 -6
- package/src/ui/SettingEditorModal.tsx +15 -9
- package/src/ui/SettingOptionsModal.tsx +30 -12
- package/src/ui/SettingsModal.tsx +20 -14
- package/src/ui/VersionBadge.tsx +3 -1
- package/src/ui/item-icon.ts +5 -1
- package/src/ui/list-window.ts +5 -1
- package/src/ui/use-textarea-focus.ts +26 -0
- package/src/update/index.ts +10 -2
- package/src/update/installation.ts +6 -2
- package/src/util/ansi.ts +3 -0
- package/src/util/glob.ts +5 -1
- package/src/components/KeybindHelp.tsx +0 -289
- package/src/handlers/keyboard.ts +0 -654
- package/src/ui/SessionStats.tsx +0 -32
package/README.md
CHANGED
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
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
|
+
- **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
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
@@ -53,7 +53,6 @@ mux-sesh
|
|
|
53
53
|
```bash
|
|
54
54
|
git clone https://github.com/quiet-ghost/mux-sesh.git
|
|
55
55
|
cd mux-sesh
|
|
56
|
-
git checkout opentui-convert
|
|
57
56
|
|
|
58
57
|
# Install dependencies
|
|
59
58
|
bun install
|
|
@@ -70,54 +69,70 @@ cp dist/mux-sesh ~/.local/bin/
|
|
|
70
69
|
## Keybindings
|
|
71
70
|
|
|
72
71
|
### Normal Mode
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
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
89
|
|
|
90
90
|
### Standard Mode
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `Ctrl+
|
|
101
|
-
| `Ctrl+Q`
|
|
102
|
-
|
|
103
|
-
|
|
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 |
|
|
104
117
|
|
|
105
118
|
### Search Mode
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
|
|
120
|
+
| Key | Action |
|
|
121
|
+
| -------------- | ------------------------ |
|
|
108
122
|
| Type to search | Filter sessions/projects |
|
|
109
|
-
| `Enter`
|
|
110
|
-
| `↑` / `↓`
|
|
111
|
-
| `Esc`
|
|
123
|
+
| `Enter` | Select first result |
|
|
124
|
+
| `↑` / `↓` | Navigate results |
|
|
125
|
+
| `Esc` | Cancel search |
|
|
112
126
|
|
|
113
127
|
### New Session Mode
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
| `
|
|
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 |
|
|
121
136
|
|
|
122
137
|
## Configuration
|
|
123
138
|
|
|
@@ -130,8 +145,12 @@ Configuration is stored at `~/.config/mux-sesh/config.json`:
|
|
|
130
145
|
"editor": "nvim",
|
|
131
146
|
"editor_cmd": "nvim -c \"lua vim.defer_fn(function() if pcall(require, 'telescope') then vim.cmd('Telescope find_files') end end, 100)\"",
|
|
132
147
|
"keybind_mode": "vim",
|
|
148
|
+
"prefix_key": "ctrl+x",
|
|
149
|
+
"theme": "rosepine",
|
|
150
|
+
"color_scheme": "system",
|
|
133
151
|
"sort_order": "zoxide-first",
|
|
134
152
|
"zoxide_mode": "rank",
|
|
153
|
+
"auto_update": true,
|
|
135
154
|
"dir_length": 2,
|
|
136
155
|
"hidden_sessions": ["scratch", "tmp*"],
|
|
137
156
|
"icons": {
|
|
@@ -169,11 +188,16 @@ Configuration is stored at `~/.config/mux-sesh/config.json`:
|
|
|
169
188
|
- **`editor`** - Default editor to use
|
|
170
189
|
- **`editor_cmd`** - Default startup command for new sessions unless overridden
|
|
171
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`
|
|
172
194
|
- **`sort_order`** - Session/project ordering: `live-first`, `configured-first`, `zoxide-first`, or `alphabetical`
|
|
173
195
|
- **`zoxide_mode`** - `off`, `rank`, or `merge` for zoxide-aware project ordering
|
|
196
|
+
- **`auto_update`** - Enable or disable background update checks
|
|
174
197
|
- **`dir_length`** - Number of path segments used when generating session names from git roots or project paths
|
|
175
198
|
- **`hidden_sessions`** - Glob patterns for live tmux sessions to hide from the list
|
|
176
199
|
- **`icons`** - Global icons for tmux, configured, project, and opencode rows
|
|
200
|
+
- **`themes`** - Optional custom theme definitions keyed by name
|
|
177
201
|
- **`default_session`** - Fallback startup and preview commands
|
|
178
202
|
- **`projects`** - Exact path rules with optional `session_name`, `startup_command`, `preview_command`, `listed`, and `icon`
|
|
179
203
|
- **`wildcards`** - Pattern-based defaults for matching projects
|
|
@@ -238,6 +262,7 @@ bind-key -n M-w popup -E -w 62% -h 70% "mux-sesh"
|
|
|
238
262
|
```
|
|
239
263
|
|
|
240
264
|
After adding the binding, reload your tmux config:
|
|
265
|
+
|
|
241
266
|
```bash
|
|
242
267
|
tmux source-file ~/.tmux.conf
|
|
243
268
|
```
|
|
@@ -245,12 +270,14 @@ tmux source-file ~/.tmux.conf
|
|
|
245
270
|
Now you can press `Alt+w` from anywhere in tmux (including inside nvim) to launch mux-sesh.
|
|
246
271
|
|
|
247
272
|
**Alternative Integration:**
|
|
273
|
+
|
|
248
274
|
- **From Neovim**: Use [mux-manager](https://github.com/quiet-ghost/mux-manager) - a Telescope-based tmux session manager that integrates directly into Neovim
|
|
249
275
|
- **With prefix**: Use `bind-key f popup -E -w 80% -h 80% "mux-sesh"` if you prefer requiring the tmux prefix key first
|
|
250
276
|
|
|
251
277
|
## Usage Examples
|
|
252
278
|
|
|
253
279
|
### Quick Session Switching
|
|
280
|
+
|
|
254
281
|
```bash
|
|
255
282
|
# Open mux-sesh
|
|
256
283
|
mux-sesh
|
|
@@ -260,6 +287,7 @@ mux-sesh
|
|
|
260
287
|
```
|
|
261
288
|
|
|
262
289
|
### Create Session from Project
|
|
290
|
+
|
|
263
291
|
```bash
|
|
264
292
|
mux-sesh
|
|
265
293
|
|
|
@@ -270,6 +298,7 @@ mux-sesh
|
|
|
270
298
|
```
|
|
271
299
|
|
|
272
300
|
### Jump to Root / Last / Edit Target
|
|
301
|
+
|
|
273
302
|
```bash
|
|
274
303
|
mux-sesh
|
|
275
304
|
|
|
@@ -279,6 +308,7 @@ mux-sesh
|
|
|
279
308
|
```
|
|
280
309
|
|
|
281
310
|
### Clone from GitHub
|
|
311
|
+
|
|
282
312
|
```bash
|
|
283
313
|
mux-sesh
|
|
284
314
|
|
|
@@ -291,6 +321,7 @@ mux-sesh
|
|
|
291
321
|
```
|
|
292
322
|
|
|
293
323
|
### Search Existing Sessions
|
|
324
|
+
|
|
294
325
|
```bash
|
|
295
326
|
mux-sesh
|
|
296
327
|
|
|
@@ -310,9 +341,9 @@ mux-sesh uses the beautiful [Catppuccin](https://github.com/catppuccin/catppucci
|
|
|
310
341
|
- **Key**: `#f9e2af` (Yellow)
|
|
311
342
|
- **Action**: `#cba6f7` (Mauve)
|
|
312
343
|
|
|
313
|
-
|
|
344
|
+
**Cross-Platform** - Works on Linux, macOS, Windows
|
|
314
345
|
|
|
315
|
-
##
|
|
346
|
+
## Development
|
|
316
347
|
|
|
317
348
|
```bash
|
|
318
349
|
# Install dependencies
|
|
@@ -328,7 +359,7 @@ bun run typecheck
|
|
|
328
359
|
bun run build
|
|
329
360
|
```
|
|
330
361
|
|
|
331
|
-
##
|
|
362
|
+
## Contributing
|
|
332
363
|
|
|
333
364
|
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
334
365
|
|
|
@@ -338,17 +369,17 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
338
369
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
339
370
|
5. Open a Pull Request
|
|
340
371
|
|
|
341
|
-
##
|
|
372
|
+
## License
|
|
342
373
|
|
|
343
374
|
MIT License - see [LICENSE](./LICENSE) for details.
|
|
344
375
|
|
|
345
|
-
##
|
|
376
|
+
## Acknowledgments
|
|
346
377
|
|
|
347
378
|
- Inspired by [ThePrimeagen's tmux-sessionizer](https://github.com/ThePrimeagen/.dotfiles/blob/master/bin/.local/scripts/tmux-sessionizer)
|
|
348
379
|
- Built with [OpenTUI](https://github.com/anomalyco/opentui)
|
|
349
380
|
- UI design inspired by [nvim telescope plugin](https://github.com/nvim-telescope/telescope.nvim)
|
|
350
381
|
|
|
351
|
-
##
|
|
382
|
+
## Related Projects
|
|
352
383
|
|
|
353
384
|
- [mux-manager](https://github.com/quiet-ghost/mux-manager) - Telescope-based tmux session manager for Neovim
|
|
354
385
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
2
3
|
"name": "mux-sesh",
|
|
3
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.0",
|
|
4
5
|
"description": "A beautiful tmux session manager built with OpenTUI - fuzzy search sessions, manage projects, clone from GitHub",
|
|
5
6
|
"type": "module",
|
|
7
|
+
"packageManager": "bun@1.3.5",
|
|
6
8
|
"bin": {
|
|
7
9
|
"mux-sesh": "./bin/mux-sesh"
|
|
8
10
|
},
|
|
@@ -16,8 +18,8 @@
|
|
|
16
18
|
"build": "bun build src/index.tsx --compile --outfile dist/mux-sesh",
|
|
17
19
|
"start": "bun run src/index.tsx",
|
|
18
20
|
"typecheck": "tsc --noEmit",
|
|
19
|
-
"format": "prettier --write
|
|
20
|
-
"format:check": "prettier --check
|
|
21
|
+
"format": "prettier --write .",
|
|
22
|
+
"format:check": "prettier --check .",
|
|
21
23
|
"test": "bun test",
|
|
22
24
|
"prepublishOnly": "bun run typecheck"
|
|
23
25
|
},
|
|
@@ -49,12 +51,12 @@
|
|
|
49
51
|
"dependencies": {
|
|
50
52
|
"@opentui/core": "0.1.60",
|
|
51
53
|
"@opentui/react": "0.1.60",
|
|
52
|
-
"mux-sesh": "^1.6.2",
|
|
53
54
|
"react": "^19.2.2"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@types/bun": "
|
|
57
|
+
"@types/bun": "1.3.5",
|
|
57
58
|
"@types/react": "^19.2.7",
|
|
59
|
+
"prettier": "3.6.2",
|
|
58
60
|
"typescript": "^5.9.3"
|
|
59
61
|
}
|
|
60
62
|
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { CommandId } from '../ui/CommandsModal'
|
|
2
|
+
import { AppMode, ViewMode, type Item } from '../types'
|
|
3
|
+
|
|
4
|
+
interface ExecuteCommandContext {
|
|
5
|
+
appMode: AppMode
|
|
6
|
+
viewMode: ViewMode
|
|
7
|
+
cursor: number
|
|
8
|
+
opencodeCursor: number
|
|
9
|
+
regularSessions: Item[]
|
|
10
|
+
opencodeSessions: Item[]
|
|
11
|
+
selectedPrimaryItem?: Item
|
|
12
|
+
sessionCandidateItems: Item[]
|
|
13
|
+
projectSourceItems: Item[]
|
|
14
|
+
closeModal: () => void
|
|
15
|
+
openRenameModal: (sessionName: string) => void
|
|
16
|
+
openSettingsModal: () => void
|
|
17
|
+
requestKillSession: (sessionName: string) => void
|
|
18
|
+
setAppMode: (mode: AppMode) => void
|
|
19
|
+
setViewMode: (mode: ViewMode) => void
|
|
20
|
+
setAllItems: (items: Item[]) => void
|
|
21
|
+
setItems: (items: Item[]) => void
|
|
22
|
+
setCursor: (cursor: number) => void
|
|
23
|
+
setSearchQuery: (value: string) => void
|
|
24
|
+
setOpencodeCursor: (cursor: number) => void
|
|
25
|
+
refreshItems: (forceViewMode?: ViewMode) => Promise<void>
|
|
26
|
+
handleLastSession: () => Promise<void>
|
|
27
|
+
handleRootSession: (item?: Item) => Promise<void>
|
|
28
|
+
handleEditTarget: (item?: Item) => Promise<void>
|
|
29
|
+
loadOpencodeStatsForSession: (sessionName: string) => Promise<unknown>
|
|
30
|
+
showMessage: (message: string, timeout?: number) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function executeCommand(commandID: CommandId, ctx: ExecuteCommandContext) {
|
|
34
|
+
switch (commandID) {
|
|
35
|
+
case 'search':
|
|
36
|
+
ctx.closeModal()
|
|
37
|
+
ctx.setAppMode(AppMode.Search)
|
|
38
|
+
ctx.setSearchQuery('')
|
|
39
|
+
return
|
|
40
|
+
case 'new-session': {
|
|
41
|
+
const items =
|
|
42
|
+
ctx.sessionCandidateItems.length > 0 ? ctx.sessionCandidateItems : ctx.projectSourceItems
|
|
43
|
+
ctx.closeModal()
|
|
44
|
+
ctx.setAppMode(AppMode.NewSession)
|
|
45
|
+
ctx.setViewMode(ViewMode.Projects)
|
|
46
|
+
ctx.setAllItems(items)
|
|
47
|
+
ctx.setItems(items)
|
|
48
|
+
ctx.setCursor(Math.max(0, items.length - 1))
|
|
49
|
+
ctx.setSearchQuery('')
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
case 'open-settings':
|
|
53
|
+
ctx.openSettingsModal()
|
|
54
|
+
return
|
|
55
|
+
case 'view-projects':
|
|
56
|
+
ctx.closeModal()
|
|
57
|
+
ctx.setViewMode(ViewMode.Projects)
|
|
58
|
+
await ctx.refreshItems(ViewMode.Projects)
|
|
59
|
+
return
|
|
60
|
+
case 'view-sessions':
|
|
61
|
+
ctx.closeModal()
|
|
62
|
+
ctx.setViewMode(ViewMode.Sessions)
|
|
63
|
+
await ctx.refreshItems(ViewMode.Sessions)
|
|
64
|
+
return
|
|
65
|
+
case 'rename-session': {
|
|
66
|
+
const target =
|
|
67
|
+
ctx.appMode === AppMode.OpencodeManage
|
|
68
|
+
? ctx.opencodeSessions[ctx.opencodeCursor]
|
|
69
|
+
: ctx.viewMode === ViewMode.Sessions
|
|
70
|
+
? ctx.regularSessions[ctx.cursor]
|
|
71
|
+
: undefined
|
|
72
|
+
if (target?.isSession) {
|
|
73
|
+
ctx.openRenameModal(target.title)
|
|
74
|
+
}
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
case 'kill-session': {
|
|
78
|
+
const target =
|
|
79
|
+
ctx.appMode === AppMode.OpencodeManage
|
|
80
|
+
? ctx.opencodeSessions[ctx.opencodeCursor]
|
|
81
|
+
: ctx.viewMode === ViewMode.Sessions
|
|
82
|
+
? ctx.regularSessions[ctx.cursor]
|
|
83
|
+
: undefined
|
|
84
|
+
if (target?.isSession) {
|
|
85
|
+
ctx.closeModal()
|
|
86
|
+
ctx.requestKillSession(target.title)
|
|
87
|
+
}
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
case 'last-session':
|
|
91
|
+
ctx.closeModal()
|
|
92
|
+
await ctx.handleLastSession()
|
|
93
|
+
return
|
|
94
|
+
case 'root-session':
|
|
95
|
+
ctx.closeModal()
|
|
96
|
+
await ctx.handleRootSession(ctx.selectedPrimaryItem)
|
|
97
|
+
return
|
|
98
|
+
case 'edit-target':
|
|
99
|
+
ctx.closeModal()
|
|
100
|
+
await ctx.handleEditTarget(ctx.selectedPrimaryItem)
|
|
101
|
+
return
|
|
102
|
+
case 'open-opencode':
|
|
103
|
+
ctx.closeModal()
|
|
104
|
+
if (ctx.viewMode === ViewMode.Sessions && ctx.opencodeSessions.length > 0) {
|
|
105
|
+
ctx.setAppMode(AppMode.OpencodeManage)
|
|
106
|
+
ctx.setOpencodeCursor(0)
|
|
107
|
+
await ctx.loadOpencodeStatsForSession(ctx.opencodeSessions[0].title)
|
|
108
|
+
}
|
|
109
|
+
return
|
|
110
|
+
case 'refresh':
|
|
111
|
+
ctx.closeModal()
|
|
112
|
+
await ctx.refreshItems()
|
|
113
|
+
ctx.showMessage('Refreshed')
|
|
114
|
+
return
|
|
115
|
+
case 'back':
|
|
116
|
+
ctx.closeModal()
|
|
117
|
+
ctx.setAppMode(AppMode.Normal)
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
}
|