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 +2 -2
- package/README.md +150 -161
- package/bin/mux-sesh +62 -0
- package/bin/platform.sh +139 -0
- package/bin/postinstall +22 -0
- package/package.json +30 -33
- package/config.example.json +0 -7
- package/src/app.tsx +0 -416
- package/src/components/KeybindHelp.tsx +0 -222
- package/src/config/index.ts +0 -52
- package/src/handlers/actions.ts +0 -86
- package/src/handlers/keyboard.ts +0 -431
- package/src/index.tsx +0 -9
- package/src/opencode/constants.ts +0 -5
- package/src/opencode/index.ts +0 -19
- package/src/opencode/parser.ts +0 -54
- package/src/opencode/session.ts +0 -278
- package/src/opencode/stats.ts +0 -34
- package/src/opencode/tokens.ts +0 -143
- package/src/opencode/types.ts +0 -33
- package/src/search/index.ts +0 -148
- package/src/styles/theme.ts +0 -46
- package/src/tmux/index.ts +0 -187
- package/src/tmux/projects.ts +0 -55
- package/src/types/index.ts +0 -80
- package/src/ui/HighlightedText.tsx +0 -61
- package/src/ui/ItemList.tsx +0 -93
- package/src/ui/OpencodeSessionGroup.tsx +0 -63
- package/src/ui/OpencodeStatsPanel.tsx +0 -178
- package/src/ui/SearchInput.tsx +0 -42
- package/src/ui/SessionDetailsPanel.tsx +0 -94
- package/src/ui/SessionList.tsx +0 -57
- package/src/ui/SessionStats.tsx +0 -30
- package/src/util/github.ts +0 -55
- package/src/util/time.ts +0 -48
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { colors } from '../styles/theme'
|
|
2
|
-
import { AppMode, KeybindMode } from '../types'
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
appMode: AppMode
|
|
6
|
-
keybindMode?: KeybindMode
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export default function KeybindHelp({ appMode, keybindMode = 'vim' }: Props) {
|
|
10
|
-
const isStandard = keybindMode === 'standard'
|
|
11
|
-
if (appMode === AppMode.Search || appMode === AppMode.NewSession || appMode === AppMode.Rename) {
|
|
12
|
-
if (isStandard) {
|
|
13
|
-
// Standard mode: show Ctrl+X prefix keybinds in vertical layout matching vim mode
|
|
14
|
-
return (
|
|
15
|
-
<>
|
|
16
|
-
<text>
|
|
17
|
-
<span style={{ fg: colors.key }}>↑/↓ </span>
|
|
18
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
19
|
-
<span style={{ fg: colors.action }}>navigate</span>
|
|
20
|
-
</text>
|
|
21
|
-
<text>
|
|
22
|
-
<span style={{ fg: colors.key }}>Ctrl+X d </span>
|
|
23
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
24
|
-
<span style={{ fg: colors.action }}>kill</span>
|
|
25
|
-
</text>
|
|
26
|
-
<text>
|
|
27
|
-
<span style={{ fg: colors.key }}>Ctrl+X r </span>
|
|
28
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
29
|
-
<span style={{ fg: colors.action }}>rename</span>
|
|
30
|
-
</text>
|
|
31
|
-
<text>
|
|
32
|
-
<span style={{ fg: colors.key }}>Ctrl+X n </span>
|
|
33
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
34
|
-
<span style={{ fg: colors.action }}>new</span>
|
|
35
|
-
</text>
|
|
36
|
-
<text>
|
|
37
|
-
<span style={{ fg: colors.key }}>Ctrl+X o </span>
|
|
38
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
39
|
-
<span style={{ fg: colors.action }}>opencode</span>
|
|
40
|
-
</text>
|
|
41
|
-
<text>
|
|
42
|
-
<span style={{ fg: colors.key }}>Ctrl+X R </span>
|
|
43
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
44
|
-
<span style={{ fg: colors.action }}>refresh</span>
|
|
45
|
-
</text>
|
|
46
|
-
<text>
|
|
47
|
-
<span style={{ fg: colors.key }}>Ctrl+Q </span>
|
|
48
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
49
|
-
<span style={{ fg: colors.action }}>quit</span>
|
|
50
|
-
</text>
|
|
51
|
-
</>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
// Vim mode: simple keybinds
|
|
55
|
-
return (
|
|
56
|
-
<text>
|
|
57
|
-
<span style={{ fg: colors.key }}>Enter</span>
|
|
58
|
-
<span style={{ fg: colors.separator }}> │ </span>
|
|
59
|
-
<span style={{ fg: colors.action }}>select</span>
|
|
60
|
-
{' '}
|
|
61
|
-
<span style={{ fg: colors.key }}>↑/↓</span>
|
|
62
|
-
<span style={{ fg: colors.separator }}> │ </span>
|
|
63
|
-
<span style={{ fg: colors.action }}>navigate</span>
|
|
64
|
-
{' '}
|
|
65
|
-
<span style={{ fg: colors.key }}>Esc</span>
|
|
66
|
-
<span style={{ fg: colors.separator }}> │ </span>
|
|
67
|
-
<span style={{ fg: colors.action }}>cancel</span>
|
|
68
|
-
</text>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (appMode === AppMode.OpencodeManage) {
|
|
73
|
-
if (isStandard) {
|
|
74
|
-
return (
|
|
75
|
-
<>
|
|
76
|
-
<text>
|
|
77
|
-
<span style={{ fg: colors.key }}>↑/↓ </span>
|
|
78
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
79
|
-
<span style={{ fg: colors.action }}>navigate</span>
|
|
80
|
-
</text>
|
|
81
|
-
<text>
|
|
82
|
-
<span style={{ fg: colors.key }}>Ctrl+D </span>
|
|
83
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
84
|
-
<span style={{ fg: colors.action }}>kill</span>
|
|
85
|
-
</text>
|
|
86
|
-
<text>
|
|
87
|
-
<span style={{ fg: colors.key }}>Ctrl+R </span>
|
|
88
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
89
|
-
<span style={{ fg: colors.action }}>rename</span>
|
|
90
|
-
</text>
|
|
91
|
-
<text>
|
|
92
|
-
<span style={{ fg: colors.key }}>Ctrl+O </span>
|
|
93
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
94
|
-
<span style={{ fg: colors.action }}>back</span>
|
|
95
|
-
</text>
|
|
96
|
-
</>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
return (
|
|
100
|
-
<>
|
|
101
|
-
<text>
|
|
102
|
-
<span style={{ fg: colors.key }}>j/k </span>
|
|
103
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
104
|
-
<span style={{ fg: colors.action }}>navigate</span>
|
|
105
|
-
</text>
|
|
106
|
-
<text>
|
|
107
|
-
<span style={{ fg: colors.key }}>d </span>
|
|
108
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
109
|
-
<span style={{ fg: colors.action }}>kill</span>
|
|
110
|
-
</text>
|
|
111
|
-
<text>
|
|
112
|
-
<span style={{ fg: colors.key }}>r </span>
|
|
113
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
114
|
-
<span style={{ fg: colors.action }}>rename</span>
|
|
115
|
-
</text>
|
|
116
|
-
<text>
|
|
117
|
-
<span style={{ fg: colors.key }}>o/Esc </span>
|
|
118
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
119
|
-
<span style={{ fg: colors.action }}>back</span>
|
|
120
|
-
</text>
|
|
121
|
-
</>
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Single column layout - all keys in left column, all actions in right column
|
|
126
|
-
if (isStandard) {
|
|
127
|
-
return (
|
|
128
|
-
<>
|
|
129
|
-
<text>
|
|
130
|
-
<span style={{ fg: colors.key }}>↑/↓ </span>
|
|
131
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
132
|
-
<span style={{ fg: colors.action }}>navigate</span>
|
|
133
|
-
</text>
|
|
134
|
-
<text>
|
|
135
|
-
<span style={{ fg: colors.key }}>Ctrl+X d </span>
|
|
136
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
137
|
-
<span style={{ fg: colors.action }}>kill</span>
|
|
138
|
-
</text>
|
|
139
|
-
<text>
|
|
140
|
-
<span style={{ fg: colors.key }}>Ctrl+X r </span>
|
|
141
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
142
|
-
<span style={{ fg: colors.action }}>rename</span>
|
|
143
|
-
</text>
|
|
144
|
-
<text>
|
|
145
|
-
<span style={{ fg: colors.key }}>Ctrl+X n </span>
|
|
146
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
147
|
-
<span style={{ fg: colors.action }}>new</span>
|
|
148
|
-
</text>
|
|
149
|
-
<text>
|
|
150
|
-
<span style={{ fg: colors.key }}>Ctrl+I </span>
|
|
151
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
152
|
-
<span style={{ fg: colors.action }}>search</span>
|
|
153
|
-
</text>
|
|
154
|
-
<text>
|
|
155
|
-
<span style={{ fg: colors.key }}>Ctrl+X o </span>
|
|
156
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
157
|
-
<span style={{ fg: colors.action }}>opencode</span>
|
|
158
|
-
</text>
|
|
159
|
-
<text>
|
|
160
|
-
<span style={{ fg: colors.key }}>Ctrl+X R </span>
|
|
161
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
162
|
-
<span style={{ fg: colors.action }}>refresh</span>
|
|
163
|
-
</text>
|
|
164
|
-
<text>
|
|
165
|
-
<span style={{ fg: colors.key }}>Ctrl+Q </span>
|
|
166
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
167
|
-
<span style={{ fg: colors.action }}>quit</span>
|
|
168
|
-
</text>
|
|
169
|
-
</>
|
|
170
|
-
)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return (
|
|
174
|
-
<>
|
|
175
|
-
<text>
|
|
176
|
-
<span style={{ fg: colors.key }}>j/k </span>
|
|
177
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
178
|
-
<span style={{ fg: colors.action }}>navigate</span>
|
|
179
|
-
</text>
|
|
180
|
-
<text>
|
|
181
|
-
<span style={{ fg: colors.key }}>1-9 </span>
|
|
182
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
183
|
-
<span style={{ fg: colors.action }}>switch</span>
|
|
184
|
-
</text>
|
|
185
|
-
<text>
|
|
186
|
-
<span style={{ fg: colors.key }}>d </span>
|
|
187
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
188
|
-
<span style={{ fg: colors.action }}>kill</span>
|
|
189
|
-
</text>
|
|
190
|
-
<text>
|
|
191
|
-
<span style={{ fg: colors.key }}>r </span>
|
|
192
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
193
|
-
<span style={{ fg: colors.action }}>rename</span>
|
|
194
|
-
</text>
|
|
195
|
-
<text>
|
|
196
|
-
<span style={{ fg: colors.key }}>n </span>
|
|
197
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
198
|
-
<span style={{ fg: colors.action }}>new</span>
|
|
199
|
-
</text>
|
|
200
|
-
<text>
|
|
201
|
-
<span style={{ fg: colors.key }}>i </span>
|
|
202
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
203
|
-
<span style={{ fg: colors.action }}>search</span>
|
|
204
|
-
</text>
|
|
205
|
-
<text>
|
|
206
|
-
<span style={{ fg: colors.key }}>o </span>
|
|
207
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
208
|
-
<span style={{ fg: colors.action }}>opencode</span>
|
|
209
|
-
</text>
|
|
210
|
-
<text>
|
|
211
|
-
<span style={{ fg: colors.key }}>R </span>
|
|
212
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
213
|
-
<span style={{ fg: colors.action }}>refresh</span>
|
|
214
|
-
</text>
|
|
215
|
-
<text>
|
|
216
|
-
<span style={{ fg: colors.key }}>q </span>
|
|
217
|
-
<span style={{ fg: colors.separator }}>│ </span>
|
|
218
|
-
<span style={{ fg: colors.action }}>quit</span>
|
|
219
|
-
</text>
|
|
220
|
-
</>
|
|
221
|
-
)
|
|
222
|
-
}
|
package/src/config/index.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { join } from 'path'
|
|
2
|
-
import { mkdir } from 'fs/promises'
|
|
3
|
-
import type { Config } from '../types'
|
|
4
|
-
|
|
5
|
-
export function getDefaultConfig(): Config {
|
|
6
|
-
const homeDir = process.env.HOME || '~'
|
|
7
|
-
return {
|
|
8
|
-
projectPaths: [join(homeDir, 'dev'), join(homeDir, 'personal')],
|
|
9
|
-
reposPath: join(homeDir, 'dev', 'repos'),
|
|
10
|
-
editor: 'nvim',
|
|
11
|
-
editorCmd:
|
|
12
|
-
"nvim -c \"lua vim.defer_fn(function() if pcall(require, 'telescope') then vim.cmd('Telescope find_files') end end, 100)\"",
|
|
13
|
-
keybindMode: 'vim',
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function loadConfig(): Promise<Config> {
|
|
18
|
-
const configDir = join(process.env.HOME!, '.config', 'mux-sesh')
|
|
19
|
-
const configPath = join(configDir, 'config.json')
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
const file = Bun.file(configPath)
|
|
23
|
-
const config = await file.json()
|
|
24
|
-
|
|
25
|
-
// Convert snake_case keys to camelCase for TypeScript
|
|
26
|
-
return {
|
|
27
|
-
...getDefaultConfig(),
|
|
28
|
-
projectPaths: config.project_paths || config.projectPaths,
|
|
29
|
-
reposPath: config.repos_path || config.reposPath,
|
|
30
|
-
editor: config.editor,
|
|
31
|
-
editorCmd: config.editor_cmd || config.editorCmd,
|
|
32
|
-
keybindMode: config.keybind_mode || config.keybindMode,
|
|
33
|
-
}
|
|
34
|
-
} catch (error) {
|
|
35
|
-
// Config doesn't exist, create default
|
|
36
|
-
const defaultConfig = getDefaultConfig()
|
|
37
|
-
await saveConfig(defaultConfig)
|
|
38
|
-
return defaultConfig
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export async function saveConfig(config: Config): Promise<void> {
|
|
43
|
-
const configDir = join(process.env.HOME!, '.config', 'mux-sesh')
|
|
44
|
-
const configPath = join(configDir, 'config.json')
|
|
45
|
-
|
|
46
|
-
await mkdir(configDir, { recursive: true })
|
|
47
|
-
await Bun.write(configPath, JSON.stringify(config, null, 2))
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function getConfigPath(): string {
|
|
51
|
-
return join(process.env.HOME!, '.config', 'mux-sesh', 'config.json')
|
|
52
|
-
}
|
package/src/handlers/actions.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { basename } from 'path'
|
|
2
|
-
import type { Item, Config } from '../types'
|
|
3
|
-
import {
|
|
4
|
-
switchTmuxSession,
|
|
5
|
-
createTmuxSession,
|
|
6
|
-
killTmuxSession,
|
|
7
|
-
renameTmuxSession,
|
|
8
|
-
createNamedTmuxSession,
|
|
9
|
-
} from '../tmux/index'
|
|
10
|
-
import { isGitHubURL, cloneGitHubRepo } from '../util/github'
|
|
11
|
-
|
|
12
|
-
export async function handleSelect(item: Item) {
|
|
13
|
-
if (item.isSession) {
|
|
14
|
-
await switchTmuxSession(item.title)
|
|
15
|
-
process.exit(0)
|
|
16
|
-
} else {
|
|
17
|
-
await createTmuxSession(item.title, item.path)
|
|
18
|
-
process.exit(0)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function handleKillSession(
|
|
23
|
-
sessionName: string,
|
|
24
|
-
callbacks: {
|
|
25
|
-
onSuccess: (message: string) => void
|
|
26
|
-
onError: (message: string) => void
|
|
27
|
-
refreshItems: () => Promise<void>
|
|
28
|
-
}
|
|
29
|
-
) {
|
|
30
|
-
try {
|
|
31
|
-
await killTmuxSession(sessionName)
|
|
32
|
-
callbacks.onSuccess(`Session '${sessionName}' killed`)
|
|
33
|
-
await callbacks.refreshItems()
|
|
34
|
-
} catch (error) {
|
|
35
|
-
callbacks.onError(`Error killing session: ${error}`)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export async function handleRenameSubmit(
|
|
40
|
-
renameTarget: string,
|
|
41
|
-
newName: string,
|
|
42
|
-
callbacks: {
|
|
43
|
-
onSuccess: (message: string) => void
|
|
44
|
-
onError: (message: string) => void
|
|
45
|
-
refreshItems: () => Promise<void>
|
|
46
|
-
}
|
|
47
|
-
) {
|
|
48
|
-
const trimmedName = newName.trim()
|
|
49
|
-
if (trimmedName && trimmedName !== renameTarget) {
|
|
50
|
-
try {
|
|
51
|
-
await renameTmuxSession(renameTarget, trimmedName)
|
|
52
|
-
callbacks.onSuccess(`Session renamed to '${trimmedName}'`)
|
|
53
|
-
await callbacks.refreshItems()
|
|
54
|
-
} catch (error) {
|
|
55
|
-
callbacks.onError(`Error renaming session: ${error}`)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function handleNewSessionSubmit(
|
|
61
|
-
searchTerm: string,
|
|
62
|
-
config: Config | null,
|
|
63
|
-
items: Item[],
|
|
64
|
-
cursor: number
|
|
65
|
-
) {
|
|
66
|
-
if (!searchTerm) return
|
|
67
|
-
|
|
68
|
-
if (isGitHubURL(searchTerm)) {
|
|
69
|
-
try {
|
|
70
|
-
if (!config) return
|
|
71
|
-
const clonedPath = await cloneGitHubRepo(searchTerm, config)
|
|
72
|
-
const repoName = basename(clonedPath)
|
|
73
|
-
await createTmuxSession(repoName, clonedPath)
|
|
74
|
-
process.exit(0)
|
|
75
|
-
} catch (error) {
|
|
76
|
-
throw new Error(`Error cloning repository: ${error}`)
|
|
77
|
-
}
|
|
78
|
-
} else if (items.length > 0 && cursor < items.length) {
|
|
79
|
-
const selectedItem = items[cursor]
|
|
80
|
-
await createTmuxSession(selectedItem.title, selectedItem.path)
|
|
81
|
-
process.exit(0)
|
|
82
|
-
} else {
|
|
83
|
-
await createNamedTmuxSession(searchTerm)
|
|
84
|
-
process.exit(0)
|
|
85
|
-
}
|
|
86
|
-
}
|