mux-sesh 1.6.3 → 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 -1101
- package/src/config/index.ts +36 -42
- package/src/config/listed-sessions.ts +2 -5
- package/src/config/paths.ts +13 -0
- package/src/config/session-rules.ts +10 -11
- 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/items/order.ts +21 -2
- 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 -286
- 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 -261
- 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 +26 -11
- 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 +25 -4
- 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/text-columns.ts +17 -0
- 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/util/path-display.ts +98 -0
- package/src/components/KeybindHelp.tsx +0 -289
- package/src/handlers/keyboard.ts +0 -654
- package/src/ui/SessionStats.tsx +0 -32
package/src/preview/project.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { basename, join } from 'path'
|
|
|
3
3
|
import { spawn } from 'bun'
|
|
4
4
|
import { getSessionDetails } from '../tmux'
|
|
5
5
|
import type { Config, SessionDetails } from '../types'
|
|
6
|
+
import { stripAnsi } from '../util/ansi'
|
|
6
7
|
import { getGitRoot, resolveProjectSession } from '../config/session-rules'
|
|
7
8
|
|
|
8
9
|
const MAX_PREVIEW_LINES = 24
|
|
@@ -40,11 +41,10 @@ function displayPath(path: string): string {
|
|
|
40
41
|
return path.replace(process.env.HOME || '', '~')
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export function interpolatePreviewCommand(command: string | undefined, projectPath: string): string | undefined {
|
|
44
|
+
export function interpolatePreviewCommand(
|
|
45
|
+
command: string | undefined,
|
|
46
|
+
projectPath: string
|
|
47
|
+
): string | undefined {
|
|
48
48
|
if (!command) {
|
|
49
49
|
return undefined
|
|
50
50
|
}
|
|
@@ -52,13 +52,20 @@ export function interpolatePreviewCommand(command: string | undefined, projectPa
|
|
|
52
52
|
return command.replaceAll('{}', projectPath)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export function formatPreviewOutput(
|
|
55
|
+
export function formatPreviewOutput(
|
|
56
|
+
output: string,
|
|
57
|
+
maxLines = MAX_PREVIEW_LINES
|
|
58
|
+
): FormattedPreviewOutput {
|
|
56
59
|
const cleanedLines = stripAnsi(output)
|
|
57
60
|
.replace(/\r/g, '')
|
|
58
61
|
.split('\n')
|
|
59
62
|
.map(line => line.trimEnd())
|
|
60
63
|
.filter(line => line.length > 0)
|
|
61
|
-
.map(line =>
|
|
64
|
+
.map(line =>
|
|
65
|
+
line.length > MAX_PREVIEW_LINE_LENGTH
|
|
66
|
+
? `${line.slice(0, MAX_PREVIEW_LINE_LENGTH - 1)}…`
|
|
67
|
+
: line
|
|
68
|
+
)
|
|
62
69
|
|
|
63
70
|
if (cleanedLines.length === 0) {
|
|
64
71
|
return {
|
|
@@ -118,7 +125,11 @@ async function getDirectoryPreviewLines(projectPath: string): Promise<string[]>
|
|
|
118
125
|
|
|
119
126
|
const visibleEntries = entries
|
|
120
127
|
.filter(entry => !entry.name.startsWith('.'))
|
|
121
|
-
.sort(
|
|
128
|
+
.sort(
|
|
129
|
+
(left, right) =>
|
|
130
|
+
Number(right.isDirectory()) - Number(left.isDirectory()) ||
|
|
131
|
+
left.name.localeCompare(right.name)
|
|
132
|
+
)
|
|
122
133
|
.slice(0, 16)
|
|
123
134
|
|
|
124
135
|
const lines: string[] = []
|
|
@@ -149,7 +160,10 @@ async function getDirectoryPreviewLines(projectPath: string): Promise<string[]>
|
|
|
149
160
|
}
|
|
150
161
|
}
|
|
151
162
|
|
|
152
|
-
async function runPreviewCommand(
|
|
163
|
+
async function runPreviewCommand(
|
|
164
|
+
command: string,
|
|
165
|
+
cwd: string
|
|
166
|
+
): Promise<{ output?: string; notice?: string }> {
|
|
153
167
|
try {
|
|
154
168
|
const proc = spawn(['sh', '-lc', command], {
|
|
155
169
|
cwd,
|
|
@@ -196,12 +210,21 @@ export async function getProjectPreview(
|
|
|
196
210
|
resolveProjectSession(projectPath, config),
|
|
197
211
|
getGitRoot(projectPath),
|
|
198
212
|
getGitBranch(projectPath),
|
|
199
|
-
linkedSessionName
|
|
213
|
+
linkedSessionName
|
|
214
|
+
? getSessionDetails(linkedSessionName).catch(() => null)
|
|
215
|
+
: Promise.resolve(null),
|
|
200
216
|
])
|
|
201
217
|
|
|
202
|
-
const resolvedPreviewCommand = interpolatePreviewCommand(
|
|
203
|
-
|
|
204
|
-
|
|
218
|
+
const resolvedPreviewCommand = interpolatePreviewCommand(
|
|
219
|
+
resolvedSession.previewCommand,
|
|
220
|
+
projectPath
|
|
221
|
+
)
|
|
222
|
+
const commandResult = resolvedPreviewCommand
|
|
223
|
+
? await runPreviewCommand(resolvedPreviewCommand, projectPath)
|
|
224
|
+
: undefined
|
|
225
|
+
const formattedCommandOutput = commandResult?.output
|
|
226
|
+
? formatPreviewOutput(commandResult.output)
|
|
227
|
+
: undefined
|
|
205
228
|
|
|
206
229
|
if (formattedCommandOutput && formattedCommandOutput.lines.length > 0) {
|
|
207
230
|
const preview: ProjectPreview = {
|
|
@@ -244,8 +267,11 @@ export async function getProjectPreview(
|
|
|
244
267
|
previewKind: 'directory',
|
|
245
268
|
previewLabel: 'Directory Listing',
|
|
246
269
|
previewLines: formattedDirectoryOutput.lines,
|
|
247
|
-
previewNotice:
|
|
248
|
-
|
|
270
|
+
previewNotice:
|
|
271
|
+
commandResult?.notice ??
|
|
272
|
+
(formattedDirectoryOutput.truncated
|
|
273
|
+
? 'Directory listing truncated to fit the panel.'
|
|
274
|
+
: undefined),
|
|
249
275
|
}
|
|
250
276
|
|
|
251
277
|
projectPreviewCache.set(cacheKey, {
|
package/src/search/index.ts
CHANGED
|
@@ -108,7 +108,10 @@ function calculateItemBonus(item: Item, query: string): number {
|
|
|
108
108
|
bonus += 1200
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
if (
|
|
111
|
+
if (
|
|
112
|
+
item.path.toLowerCase().endsWith(`/${normalizedQuery}`) ||
|
|
113
|
+
description.endsWith(`/${normalizedQuery}`)
|
|
114
|
+
) {
|
|
112
115
|
bonus += 2000
|
|
113
116
|
}
|
|
114
117
|
|