mux-sesh 1.6.0 → 1.6.2
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/package.json +1 -1
- package/src/app.tsx +95 -35
- package/src/preview/project.ts +24 -2
- package/src/styles/opencode-tui-colors.ts +1 -0
- package/src/styles/theme.tsx +2 -164
- package/src/tmux/index.ts +56 -1
- package/src/tmux/projects.ts +115 -25
- package/src/types/index.ts +22 -5
- package/src/ui/SessionDetailsPanel.tsx +13 -0
- package/src/ui/VersionBadge.tsx +30 -0
- package/src/update/events.ts +2 -2
- package/src/update/index.ts +54 -7
- package/src/update/installation.ts +14 -8
- package/src/util/perf.ts +23 -0
package/package.json
CHANGED
package/src/app.tsx
CHANGED
|
@@ -8,20 +8,23 @@ import { orderProjectItems, orderSessionItems } from './items/order'
|
|
|
8
8
|
import { annotateProjectItemsWithSessionLinks } from './projects/session-links'
|
|
9
9
|
import { listTmuxSessions } from './tmux'
|
|
10
10
|
import { filterHiddenSessions } from './tmux/workflows'
|
|
11
|
-
import { getProjectItems } from './tmux/projects'
|
|
11
|
+
import { getProjectItems, getSessionCandidateItems } from './tmux/projects'
|
|
12
12
|
import { filterAndSortItems, clearMatchIndices } from './search'
|
|
13
13
|
import { isGitHubURL } from './util/github'
|
|
14
14
|
import { getOpencodeSessionStats } from './opencode'
|
|
15
15
|
import { ThemeProvider, getPanelStyle, resolveTheme } from './styles/theme'
|
|
16
16
|
import { useTerminalSize, shouldShowDetailPanel } from './util/terminal'
|
|
17
|
+
import { mark, measure } from './util/perf'
|
|
17
18
|
import Toast from './ui/Toast'
|
|
18
19
|
import { checkAndUpdate, updateEvents } from './update'
|
|
20
|
+
import { CURRENT_VERSION } from './update/version'
|
|
19
21
|
import OpencodeStatsPanel from './ui/OpencodeStatsPanel'
|
|
20
22
|
import SessionDetailsPanel from './ui/SessionDetailsPanel'
|
|
21
23
|
import SessionList from './ui/SessionList'
|
|
22
24
|
import OpencodeSessionGroup from './ui/OpencodeSessionGroup'
|
|
23
25
|
import SearchInput from './ui/SearchInput'
|
|
24
26
|
import ItemList from './ui/ItemList'
|
|
27
|
+
import VersionBadge from './ui/VersionBadge'
|
|
25
28
|
import RenameModal from './ui/RenameModal'
|
|
26
29
|
import CommandsModal, { filterCommandEntries, getCommandEntries, type CommandId } from './ui/CommandsModal'
|
|
27
30
|
import SettingsModal from './ui/SettingsModal'
|
|
@@ -69,7 +72,9 @@ export function App() {
|
|
|
69
72
|
const [viewMode, setViewMode] = useState(ViewMode.Sessions)
|
|
70
73
|
const [items, setItems] = useState<Item[]>([])
|
|
71
74
|
const [allItems, setAllItems] = useState<Item[]>([])
|
|
75
|
+
const [projectSourceItems, setProjectSourceItems] = useState<Item[]>([])
|
|
72
76
|
const [projectItems, setProjectItems] = useState<Item[]>([])
|
|
77
|
+
const [sessionCandidateItems, setSessionCandidateItems] = useState<Item[]>([])
|
|
73
78
|
const [sessionItems, setSessionItems] = useState<Item[]>([])
|
|
74
79
|
const [cursor, setCursor] = useState(0)
|
|
75
80
|
const [opencodeCursor, setOpencodeCursor] = useState(0)
|
|
@@ -101,6 +106,7 @@ export function App() {
|
|
|
101
106
|
const { columns, rows } = useTerminalSize()
|
|
102
107
|
const [toastMessage, setToastMessage] = useState('')
|
|
103
108
|
const [toastVisible, setToastVisible] = useState(false)
|
|
109
|
+
const [updatedVersion, setUpdatedVersion] = useState<string | null>(null)
|
|
104
110
|
const configPath = getConfigPath()
|
|
105
111
|
const resolvedTheme = resolveTheme(config?.theme, config?.themes, config?.colorScheme)
|
|
106
112
|
const theme = resolvedTheme.colors
|
|
@@ -109,6 +115,7 @@ export function App() {
|
|
|
109
115
|
const currentOptionField = modalState?.type === 'setting-options' ? modalState.field : undefined
|
|
110
116
|
const settingOptions = config && currentOptionField ? getSettingOptions(config, currentOptionField) : []
|
|
111
117
|
const filteredSettingOptions = filterSettingsOptions(settingOptions, settingOptionsSearchQuery)
|
|
118
|
+
const hasScheduledAutoUpdateRef = useRef(false)
|
|
112
119
|
|
|
113
120
|
function getSessionSelectionIndex(nextItems: Item[]): number {
|
|
114
121
|
const regularItems = nextItems.filter(item => !(item.isSession && item.title.startsWith('opencode-')))
|
|
@@ -150,9 +157,17 @@ export function App() {
|
|
|
150
157
|
setItems(applyState)
|
|
151
158
|
}
|
|
152
159
|
|
|
160
|
+
async function loadLinkedProjectItems(nextConfig: Config, liveSessions: Item[], sourceItems = projectSourceItems) {
|
|
161
|
+
return orderProjectItems(
|
|
162
|
+
await measure('linkProjectItems', () => annotateProjectItemsWithSessionLinks(sourceItems, liveSessions, nextConfig)),
|
|
163
|
+
nextConfig.sortOrder
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
153
167
|
useEffect(() => {
|
|
154
168
|
async function init() {
|
|
155
|
-
|
|
169
|
+
mark('startup begin')
|
|
170
|
+
const cfg = await measure('loadConfig', loadConfig)
|
|
156
171
|
setConfig(cfg)
|
|
157
172
|
|
|
158
173
|
// Standard mode always starts in search mode (non-modal)
|
|
@@ -160,7 +175,9 @@ export function App() {
|
|
|
160
175
|
setAppMode(AppMode.Search)
|
|
161
176
|
}
|
|
162
177
|
|
|
163
|
-
const [sessions, listedSessions] = await
|
|
178
|
+
const [sessions, listedSessions] = await measure('loadSessionsAndListed', () =>
|
|
179
|
+
Promise.all([listTmuxSessions(), getListedSessionItems(cfg)])
|
|
180
|
+
)
|
|
164
181
|
const visibleSessions = filterHiddenSessions(sessions, cfg.hiddenSessions)
|
|
165
182
|
const combinedSessions = orderSessionItems(mergeSessionItems(visibleSessions, listedSessions), cfg.sortOrder)
|
|
166
183
|
|
|
@@ -172,57 +189,65 @@ export function App() {
|
|
|
172
189
|
setCursor(getSessionSelectionIndex(combinedSessions))
|
|
173
190
|
}
|
|
174
191
|
|
|
175
|
-
const rawProjects = await getProjectItems(cfg)
|
|
176
|
-
const
|
|
177
|
-
await annotateProjectItemsWithSessionLinks(rawProjects, visibleSessions, cfg),
|
|
178
|
-
cfg.sortOrder
|
|
179
|
-
)
|
|
192
|
+
const rawProjects = await measure('getProjectItems', () => getProjectItems(cfg))
|
|
193
|
+
const orderedProjects = orderProjectItems(rawProjects, cfg.sortOrder)
|
|
180
194
|
|
|
181
|
-
|
|
195
|
+
setProjectSourceItems(orderedProjects)
|
|
196
|
+
setProjectItems(orderedProjects)
|
|
182
197
|
|
|
183
198
|
if (combinedSessions.length === 0) {
|
|
199
|
+
const linkedProjects = await loadLinkedProjectItems(cfg, visibleSessions, orderedProjects)
|
|
200
|
+
setProjectItems(linkedProjects)
|
|
184
201
|
setViewMode(ViewMode.Projects)
|
|
185
|
-
setAllItems(
|
|
186
|
-
setItems(
|
|
187
|
-
setCursor(getProjectSelectionIndex(
|
|
202
|
+
setAllItems(linkedProjects)
|
|
203
|
+
setItems(linkedProjects)
|
|
204
|
+
setCursor(getProjectSelectionIndex(linkedProjects))
|
|
188
205
|
}
|
|
189
206
|
|
|
190
|
-
|
|
191
|
-
console.error('Auto-update check failed:', error)
|
|
192
|
-
})
|
|
207
|
+
mark('startup complete')
|
|
193
208
|
}
|
|
194
209
|
init()
|
|
195
210
|
}, [])
|
|
196
211
|
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
if (!config || hasScheduledAutoUpdateRef.current) {
|
|
214
|
+
return
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
hasScheduledAutoUpdateRef.current = true
|
|
218
|
+
|
|
219
|
+
const timeout = setTimeout(() => {
|
|
220
|
+
checkAndUpdate(config).catch(error => {
|
|
221
|
+
console.error('Auto-update check failed:', error)
|
|
222
|
+
})
|
|
223
|
+
}, 1000)
|
|
224
|
+
|
|
225
|
+
return () => clearTimeout(timeout)
|
|
226
|
+
}, [config])
|
|
197
227
|
async function refreshItems(forceViewMode?: ViewMode, nextConfig = config) {
|
|
198
228
|
if (!nextConfig) return
|
|
199
229
|
|
|
200
230
|
const targetMode = forceViewMode ?? viewMode
|
|
201
231
|
|
|
202
232
|
if (targetMode === ViewMode.Sessions) {
|
|
203
|
-
const sessions = await listTmuxSessions
|
|
233
|
+
const sessions = await measure('refresh:listTmuxSessions', listTmuxSessions)
|
|
204
234
|
const visibleSessions = filterHiddenSessions(sessions, nextConfig.hiddenSessions)
|
|
205
|
-
const listedSessions = await getListedSessionItems(nextConfig)
|
|
235
|
+
const listedSessions = await measure('refresh:getListedSessionItems', () => getListedSessionItems(nextConfig))
|
|
206
236
|
const cleanSessions = clearMatchIndices(
|
|
207
237
|
orderSessionItems(mergeSessionItems(visibleSessions, listedSessions), nextConfig.sortOrder)
|
|
208
238
|
)
|
|
209
|
-
const linkedProjects = orderProjectItems(
|
|
210
|
-
await annotateProjectItemsWithSessionLinks(projectItems, visibleSessions, nextConfig),
|
|
211
|
-
nextConfig.sortOrder
|
|
212
|
-
)
|
|
213
239
|
setSessionItems(cleanSessions)
|
|
214
|
-
setProjectItems(linkedProjects)
|
|
215
240
|
setAllItems(cleanSessions)
|
|
216
241
|
setItems(cleanSessions)
|
|
217
242
|
setCursor(getSessionSelectionIndex(cleanSessions))
|
|
218
243
|
} else {
|
|
219
|
-
const sessions = await listTmuxSessions
|
|
244
|
+
const sessions = await measure('refresh:listTmuxSessions', listTmuxSessions)
|
|
220
245
|
const visibleSessions = filterHiddenSessions(sessions, nextConfig.hiddenSessions)
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
)
|
|
225
|
-
const cleanProjects = clearMatchIndices(
|
|
246
|
+
const rawProjects = await measure('refresh:getProjectItems', () => getProjectItems(nextConfig))
|
|
247
|
+
const orderedProjects = orderProjectItems(rawProjects, nextConfig.sortOrder)
|
|
248
|
+
setProjectSourceItems(orderedProjects)
|
|
249
|
+
const linkedProjects = await loadLinkedProjectItems(nextConfig, visibleSessions, orderedProjects)
|
|
250
|
+
const cleanProjects = clearMatchIndices(linkedProjects)
|
|
226
251
|
setProjectItems(cleanProjects)
|
|
227
252
|
setAllItems(cleanProjects)
|
|
228
253
|
setItems(cleanProjects)
|
|
@@ -433,9 +458,9 @@ export function App() {
|
|
|
433
458
|
closeModal()
|
|
434
459
|
setAppMode(AppMode.NewSession)
|
|
435
460
|
setViewMode(ViewMode.Projects)
|
|
436
|
-
setAllItems(
|
|
437
|
-
setItems(
|
|
438
|
-
setCursor(Math.max(0,
|
|
461
|
+
setAllItems(sessionCandidateItems.length > 0 ? sessionCandidateItems : projectSourceItems)
|
|
462
|
+
setItems(sessionCandidateItems.length > 0 ? sessionCandidateItems : projectSourceItems)
|
|
463
|
+
setCursor(Math.max(0, (sessionCandidateItems.length > 0 ? sessionCandidateItems : projectSourceItems).length - 1))
|
|
439
464
|
setSearchQuery('')
|
|
440
465
|
return
|
|
441
466
|
case 'open-settings':
|
|
@@ -547,7 +572,7 @@ export function App() {
|
|
|
547
572
|
searchQuery,
|
|
548
573
|
renameTarget,
|
|
549
574
|
prefixKey: config?.prefixKey,
|
|
550
|
-
projectItems,
|
|
575
|
+
projectItems: sessionCandidateItems.length > 0 ? sessionCandidateItems : projectSourceItems,
|
|
551
576
|
sessionItems,
|
|
552
577
|
prefixActive,
|
|
553
578
|
prefixTimeoutRef,
|
|
@@ -677,7 +702,14 @@ export function App() {
|
|
|
677
702
|
|
|
678
703
|
useEffect(() => {
|
|
679
704
|
const unsubscribe = updateEvents.on(event => {
|
|
680
|
-
|
|
705
|
+
if (event.kind === 'updated') {
|
|
706
|
+
setUpdatedVersion(event.version)
|
|
707
|
+
setToastMessage(`Updated in background to v${event.version}. Restart mux-sesh to use it.`)
|
|
708
|
+
} else if (event.kind === 'available') {
|
|
709
|
+
setToastMessage(`Update available: v${event.version}`)
|
|
710
|
+
} else {
|
|
711
|
+
setToastMessage(`Background update to v${event.version} failed.`)
|
|
712
|
+
}
|
|
681
713
|
setToastVisible(true)
|
|
682
714
|
setTimeout(() => {
|
|
683
715
|
setToastVisible(false)
|
|
@@ -704,9 +736,36 @@ export function App() {
|
|
|
704
736
|
|
|
705
737
|
useEffect(() => {
|
|
706
738
|
if (appMode === AppMode.NewSession && viewMode === ViewMode.Projects) {
|
|
707
|
-
setCursor(getProjectSelectionIndex(
|
|
739
|
+
setCursor(getProjectSelectionIndex(sessionCandidateItems.length > 0 ? sessionCandidateItems : projectSourceItems))
|
|
740
|
+
}
|
|
741
|
+
}, [appMode, viewMode, projectSourceItems, sessionCandidateItems])
|
|
742
|
+
|
|
743
|
+
useEffect(() => {
|
|
744
|
+
if (appMode !== AppMode.NewSession || !config) {
|
|
745
|
+
return
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
const nextConfig = config
|
|
749
|
+
let cancelled = false
|
|
750
|
+
|
|
751
|
+
async function loadSessionCandidates() {
|
|
752
|
+
const candidates = await measure('loadSessionCandidateItems', () => getSessionCandidateItems(nextConfig))
|
|
753
|
+
if (cancelled) {
|
|
754
|
+
return
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
setSessionCandidateItems(candidates)
|
|
758
|
+
setAllItems(candidates)
|
|
759
|
+
setItems(candidates)
|
|
760
|
+
setCursor(getProjectSelectionIndex(candidates))
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
void loadSessionCandidates()
|
|
764
|
+
|
|
765
|
+
return () => {
|
|
766
|
+
cancelled = true
|
|
708
767
|
}
|
|
709
|
-
}, [appMode,
|
|
768
|
+
}, [appMode, config])
|
|
710
769
|
|
|
711
770
|
useEffect(() => {
|
|
712
771
|
if (filteredCommandEntries.length === 0) {
|
|
@@ -1043,6 +1102,7 @@ export function App() {
|
|
|
1043
1102
|
)}
|
|
1044
1103
|
|
|
1045
1104
|
<Toast message={toastMessage} visible={toastVisible} />
|
|
1105
|
+
<VersionBadge currentVersion={CURRENT_VERSION} updatedVersion={updatedVersion} />
|
|
1046
1106
|
</box>
|
|
1047
1107
|
</ThemeProvider>
|
|
1048
1108
|
)
|
package/src/preview/project.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { getGitRoot, resolveProjectSession } from '../config/session-rules'
|
|
|
8
8
|
const MAX_PREVIEW_LINES = 24
|
|
9
9
|
const MAX_PREVIEW_LINE_LENGTH = 120
|
|
10
10
|
const PREVIEW_COMMAND_TIMEOUT_MS = 1500
|
|
11
|
+
const PROJECT_PREVIEW_CACHE_TTL_MS = 4000
|
|
12
|
+
const projectPreviewCache = new Map<string, { preview: ProjectPreview; expiresAt: number }>()
|
|
11
13
|
|
|
12
14
|
export interface ProjectPreview {
|
|
13
15
|
path: string
|
|
@@ -184,6 +186,12 @@ export async function getProjectPreview(
|
|
|
184
186
|
config: Config,
|
|
185
187
|
linkedSessionName?: string
|
|
186
188
|
): Promise<ProjectPreview> {
|
|
189
|
+
const cacheKey = `${projectPath}::${linkedSessionName ?? ''}`
|
|
190
|
+
const cached = projectPreviewCache.get(cacheKey)
|
|
191
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
192
|
+
return cached.preview
|
|
193
|
+
}
|
|
194
|
+
|
|
187
195
|
const [resolvedSession, gitRootPath, gitBranch, linkedSession] = await Promise.all([
|
|
188
196
|
resolveProjectSession(projectPath, config),
|
|
189
197
|
getGitRoot(projectPath),
|
|
@@ -196,7 +204,7 @@ export async function getProjectPreview(
|
|
|
196
204
|
const formattedCommandOutput = commandResult?.output ? formatPreviewOutput(commandResult.output) : undefined
|
|
197
205
|
|
|
198
206
|
if (formattedCommandOutput && formattedCommandOutput.lines.length > 0) {
|
|
199
|
-
|
|
207
|
+
const preview: ProjectPreview = {
|
|
200
208
|
path: displayPath(projectPath),
|
|
201
209
|
sessionName: resolvedSession.sessionName,
|
|
202
210
|
source: resolvedSession.source,
|
|
@@ -212,12 +220,19 @@ export async function getProjectPreview(
|
|
|
212
220
|
? 'Preview output truncated to fit the panel.'
|
|
213
221
|
: undefined,
|
|
214
222
|
}
|
|
223
|
+
|
|
224
|
+
projectPreviewCache.set(cacheKey, {
|
|
225
|
+
preview,
|
|
226
|
+
expiresAt: Date.now() + PROJECT_PREVIEW_CACHE_TTL_MS,
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
return preview
|
|
215
230
|
}
|
|
216
231
|
|
|
217
232
|
const fallbackLines = await getDirectoryPreviewLines(projectPath)
|
|
218
233
|
const formattedDirectoryOutput = formatPreviewOutput(fallbackLines.join('\n'))
|
|
219
234
|
|
|
220
|
-
|
|
235
|
+
const preview: ProjectPreview = {
|
|
221
236
|
path: displayPath(projectPath),
|
|
222
237
|
sessionName: resolvedSession.sessionName,
|
|
223
238
|
source: resolvedSession.source,
|
|
@@ -232,4 +247,11 @@ export async function getProjectPreview(
|
|
|
232
247
|
previewNotice: commandResult?.notice ??
|
|
233
248
|
(formattedDirectoryOutput.truncated ? 'Directory listing truncated to fit the panel.' : undefined),
|
|
234
249
|
}
|
|
250
|
+
|
|
251
|
+
projectPreviewCache.set(cacheKey, {
|
|
252
|
+
preview,
|
|
253
|
+
expiresAt: Date.now() + PROJECT_PREVIEW_CACHE_TTL_MS,
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
return preview
|
|
235
257
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TUI_THEME_COLORS={"aura":{"dark":{"background":"#0f0f0f","surface":"#15141b","surfaceAlt":"#15141b","surfaceModal":"#15141b","overlay":"#000000","border":"#2d2d2d","borderMuted":"#2d2d2d","text":"#edecee","textMuted":"#6d6d6d","textSubtle":"#6d6d6d","primary":"#a277ff","secondary":"#f694ff","accent":"#a277ff","active":"#61ffca","inactive":"#6d6d6d","key":"#ffca85","action":"#a277ff","separator":"#6d6d6d","program":"#61ffca","fileTree":"#f694ff","danger":"#ff6767","dangerSurface":"#3f191a","selection":"#a277ff","selectionText":"#f5f5f5"},"light":{"background":"#0f0f0f","surface":"#15141b","surfaceAlt":"#15141b","surfaceModal":"#15141b","overlay":"#000000","border":"#2d2d2d","borderMuted":"#2d2d2d","text":"#edecee","textMuted":"#6d6d6d","textSubtle":"#6d6d6d","primary":"#a277ff","secondary":"#f694ff","accent":"#a277ff","active":"#61ffca","inactive":"#6d6d6d","key":"#ffca85","action":"#a277ff","separator":"#6d6d6d","program":"#61ffca","fileTree":"#f694ff","danger":"#ff6767","dangerSurface":"#3f191a","selection":"#a277ff","selectionText":"#f5f5f5"}},"ayu":{"dark":{"background":"#0B0E14","surface":"#0F131A","surfaceAlt":"#0D1017","surfaceModal":"#0F131A","overlay":"#000000","border":"#6C7380","borderMuted":"#11151C","text":"#BFBDB6","textMuted":"#565B66","textSubtle":"#565B66","primary":"#59C2FF","secondary":"#D2A6FF","accent":"#E6B450","active":"#7FD962","inactive":"#565B66","key":"#E6B673","action":"#39BAE6","separator":"#565B66","program":"#AAD94C","fileTree":"#59C2FF","danger":"#D95757","dangerSurface":"#37222c","selection":"#59C2FF","selectionText":"#171717"},"light":{"background":"#0B0E14","surface":"#0F131A","surfaceAlt":"#0D1017","surfaceModal":"#0F131A","overlay":"#000000","border":"#6C7380","borderMuted":"#11151C","text":"#BFBDB6","textMuted":"#565B66","textSubtle":"#565B66","primary":"#59C2FF","secondary":"#D2A6FF","accent":"#E6B450","active":"#7FD962","inactive":"#565B66","key":"#E6B673","action":"#39BAE6","separator":"#565B66","program":"#AAD94C","fileTree":"#59C2FF","danger":"#D95757","dangerSurface":"#37222c","selection":"#59C2FF","selectionText":"#171717"}},"carbonfox":{"dark":{"background":"#161616","surface":"#1a1a1a","surfaceAlt":"#1e1e1e","surfaceModal":"#1a1a1a","overlay":"#000000","border":"#303030","borderMuted":"#262626","text":"#f2f4f8","textMuted":"#7d848f","textSubtle":"#7d848f","primary":"#33b1ff","secondary":"#78a9ff","accent":"#ff7eb6","active":"#25be6a","inactive":"#7d848f","key":"#f1c21b","action":"#33b1ff","separator":"#303030","program":"#25be6a","fileTree":"#78a9ff","danger":"#ee5396","dangerSurface":"#2a1216","selection":"#33b1ff","selectionText":"#f5f5f5"},"light":{"background":"#ffffff","surface":"#f4f4f4","surfaceAlt":"#f4f4f4","surfaceModal":"#f4f4f4","overlay":"#000000","border":"#dcdcdc","borderMuted":"#e8e8e8","text":"#161616","textMuted":"#6f6f6f","textSubtle":"#6f6f6f","primary":"#0043ce","secondary":"#0043ce","accent":"#9f1853","active":"#198038","inactive":"#6f6f6f","key":"#007d79","action":"#0072c3","separator":"#dcdcdc","program":"#198038","fileTree":"#0043ce","danger":"#9f1853","dangerSurface":"#fff1f1","selection":"#0043ce","selectionText":"#f5f5f5"}},"catppuccin-frappe":{"dark":{"background":"#303446","surface":"#292c3c","surfaceAlt":"#232634","surfaceModal":"#292c3c","overlay":"#000000","border":"#414559","borderMuted":"#626880","text":"#c6d0f5","textMuted":"#b5bfe2","textSubtle":"#b5bfe2","primary":"#8da4e2","secondary":"#ca9ee6","accent":"#f4b8e4","active":"#a6d189","inactive":"#b5bfe2","key":"#e5c890","action":"#99d1db","separator":"#a5adce","program":"#a6d189","fileTree":"#8da4e2","danger":"#e78284","dangerSurface":"#3a2a31","selection":"#8da4e2","selectionText":"#171717"},"light":{"background":"#303446","surface":"#292c3c","surfaceAlt":"#232634","surfaceModal":"#292c3c","overlay":"#000000","border":"#414559","borderMuted":"#626880","text":"#c6d0f5","textMuted":"#b5bfe2","textSubtle":"#b5bfe2","primary":"#8da4e2","secondary":"#ca9ee6","accent":"#f4b8e4","active":"#a6d189","inactive":"#b5bfe2","key":"#e5c890","action":"#99d1db","separator":"#a5adce","program":"#a6d189","fileTree":"#8da4e2","danger":"#e78284","dangerSurface":"#3a2a31","selection":"#8da4e2","selectionText":"#171717"}},"catppuccin-macchiato":{"dark":{"background":"#24273a","surface":"#1e2030","surfaceAlt":"#181926","surfaceModal":"#1e2030","overlay":"#000000","border":"#363a4f","borderMuted":"#5b6078","text":"#cad3f5","textMuted":"#b8c0e0","textSubtle":"#b8c0e0","primary":"#8aadf4","secondary":"#c6a0f6","accent":"#f5bde6","active":"#a6da95","inactive":"#b8c0e0","key":"#eed49f","action":"#91d7e3","separator":"#a5adcb","program":"#a6da95","fileTree":"#8aadf4","danger":"#ed8796","dangerSurface":"#3a2a31","selection":"#8aadf4","selectionText":"#171717"},"light":{"background":"#24273a","surface":"#1e2030","surfaceAlt":"#181926","surfaceModal":"#1e2030","overlay":"#000000","border":"#363a4f","borderMuted":"#5b6078","text":"#cad3f5","textMuted":"#b8c0e0","textSubtle":"#b8c0e0","primary":"#8aadf4","secondary":"#c6a0f6","accent":"#f5bde6","active":"#a6da95","inactive":"#b8c0e0","key":"#eed49f","action":"#91d7e3","separator":"#a5adcb","program":"#a6da95","fileTree":"#8aadf4","danger":"#ed8796","dangerSurface":"#3a2a31","selection":"#8aadf4","selectionText":"#171717"}},"catppuccin":{"dark":{"background":"#1e1e2e","surface":"#181825","surfaceAlt":"#11111b","surfaceModal":"#181825","overlay":"#000000","border":"#313244","borderMuted":"#585b70","text":"#cdd6f4","textMuted":"#bac2de","textSubtle":"#bac2de","primary":"#89b4fa","secondary":"#cba6f7","accent":"#f5c2e7","active":"#a6e3a1","inactive":"#bac2de","key":"#f9e2af","action":"#89dceb","separator":"#a6adc8","program":"#a6e3a1","fileTree":"#89b4fa","danger":"#f38ba8","dangerSurface":"#3c2a32","selection":"#89b4fa","selectionText":"#171717"},"light":{"background":"#eff1f5","surface":"#e6e9ef","surfaceAlt":"#dce0e8","surfaceModal":"#e6e9ef","overlay":"#000000","border":"#ccd0da","borderMuted":"#acb0be","text":"#4c4f69","textMuted":"#5c5f77","textSubtle":"#5c5f77","primary":"#1e66f5","secondary":"#8839ef","accent":"#ea76cb","active":"#40a02b","inactive":"#5c5f77","key":"#df8e1d","action":"#04a5e5","separator":"#6c6f85","program":"#40a02b","fileTree":"#1e66f5","danger":"#d20f39","dangerSurface":"#f6dfe2","selection":"#1e66f5","selectionText":"#f5f5f5"}},"cobalt2":{"dark":{"background":"#193549","surface":"#122738","surfaceAlt":"#1f4662","surfaceModal":"#122738","overlay":"#000000","border":"#1f4662","borderMuted":"#0e1e2e","text":"#ffffff","textMuted":"#adb7c9","textSubtle":"#adb7c9","primary":"#0088ff","secondary":"#9a5feb","accent":"#2affdf","active":"#9eff80","inactive":"#adb7c9","key":"#ffc600","action":"#2affdf","separator":"#2d5a7b","program":"#9eff80","fileTree":"#0088ff","danger":"#ff0088","dangerSurface":"#3a1a2a","selection":"#0088ff","selectionText":"#f5f5f5"},"light":{"background":"#ffffff","surface":"#f5f7fa","surfaceAlt":"#e8ecf1","surfaceModal":"#f5f7fa","overlay":"#000000","border":"#d3dae3","borderMuted":"#e8ecf1","text":"#193549","textMuted":"#5c6b7d","textSubtle":"#5c6b7d","primary":"#0066cc","secondary":"#7c4dff","accent":"#00acc1","active":"#4caf50","inactive":"#5c6b7d","key":"#ff9800","action":"#00acc1","separator":"#d3dae3","program":"#4caf50","fileTree":"#0066cc","danger":"#e91e63","dangerSurface":"#ffebee","selection":"#0066cc","selectionText":"#f5f5f5"}},"cursor":{"dark":{"background":"#181818","surface":"#141414","surfaceAlt":"#262626","surfaceModal":"#141414","overlay":"#000000","border":"#e4e4e413","borderMuted":"#0f0f0f","text":"#e4e4e4","textMuted":"#e4e4e45e","textSubtle":"#e4e4e45e","primary":"#88c0d0","secondary":"#81a1c1","accent":"#88c0d0","active":"#3fa266","inactive":"#e4e4e45e","key":"#f1b467","action":"#81a1c1","separator":"#e4e4e45e","program":"#E394DC","fileTree":"#82D2CE","danger":"#e34671","dangerSurface":"#b8004933","selection":"#88c0d0","selectionText":"#171717"},"light":{"background":"#fcfcfc","surface":"#f3f3f3","surfaceAlt":"#ededed","surfaceModal":"#f3f3f3","overlay":"#000000","border":"#14141413","borderMuted":"#e0e0e0","text":"#141414","textMuted":"#141414ad","textSubtle":"#141414ad","primary":"#6f9ba6","secondary":"#3c7cab","accent":"#6f9ba6","active":"#1f8a65","inactive":"#141414ad","key":"#db704b","action":"#141414ad","separator":"#141414ad","program":"#1f8a65","fileTree":"#206595","danger":"#cf2d56","dangerSurface":"#cf2d5614","selection":"#6f9ba6","selectionText":"#f5f5f5"}},"dracula":{"dark":{"background":"#282a36","surface":"#21222c","surfaceAlt":"#44475a","surfaceModal":"#21222c","overlay":"#000000","border":"#44475a","borderMuted":"#191a21","text":"#f8f8f2","textMuted":"#6272a4","textSubtle":"#6272a4","primary":"#bd93f9","secondary":"#ff79c6","accent":"#8be9fd","active":"#50fa7b","inactive":"#6272a4","key":"#f1fa8c","action":"#ff79c6","separator":"#6272a4","program":"#50fa7b","fileTree":"#8be9fd","danger":"#ff5555","dangerSurface":"#3a1a1a","selection":"#bd93f9","selectionText":"#171717"},"light":{"background":"#f8f8f2","surface":"#e8e8e2","surfaceAlt":"#d8d8d2","surfaceModal":"#e8e8e2","overlay":"#000000","border":"#c8c8c2","borderMuted":"#e0e0e0","text":"#282a36","textMuted":"#6272a4","textSubtle":"#6272a4","primary":"#bd93f9","secondary":"#ff79c6","accent":"#8be9fd","active":"#50fa7b","inactive":"#6272a4","key":"#f1fa8c","action":"#ff79c6","separator":"#6272a4","program":"#50fa7b","fileTree":"#8be9fd","danger":"#ff5555","dangerSurface":"#ffe0e0","selection":"#bd93f9","selectionText":"#171717"}},"everforest":{"dark":{"background":"#2d353b","surface":"#333c43","surfaceAlt":"#343f44","surfaceModal":"#333c43","overlay":"#000000","border":"#859289","borderMuted":"#7a8478","text":"#d3c6aa","textMuted":"#7a8478","textSubtle":"#7a8478","primary":"#a7c080","secondary":"#7fbbb3","accent":"#d699b6","active":"#a7c080","inactive":"#7a8478","key":"#e69875","action":"#83c092","separator":"#7a8478","program":"#a7c080","fileTree":"#a7c080","danger":"#e67e80","dangerSurface":"#37222c","selection":"#a7c080","selectionText":"#171717"},"light":{"background":"#fdf6e3","surface":"#efebd4","surfaceAlt":"#f4f0d9","surfaceModal":"#efebd4","overlay":"#000000","border":"#939f91","borderMuted":"#a6b0a0","text":"#5c6a72","textMuted":"#a6b0a0","textSubtle":"#a6b0a0","primary":"#8da101","secondary":"#3a94c5","accent":"#df69ba","active":"#8da101","inactive":"#a6b0a0","key":"#f57d26","action":"#35a77c","separator":"#a6b0a0","program":"#8da101","fileTree":"#8da101","danger":"#f85552","dangerSurface":"#f7d8db","selection":"#8da101","selectionText":"#f5f5f5"}},"flexoki":{"dark":{"background":"#100F0F","surface":"#1C1B1A","surfaceAlt":"#282726","surfaceModal":"#1C1B1A","overlay":"#000000","border":"#575653","borderMuted":"#403E3C","text":"#CECDC3","textMuted":"#6F6E69","textSubtle":"#6F6E69","primary":"#DA702C","secondary":"#4385BE","accent":"#8B7EC8","active":"#879A39","inactive":"#6F6E69","key":"#DA702C","action":"#3AA99F","separator":"#6F6E69","program":"#3AA99F","fileTree":"#4385BE","danger":"#D14D41","dangerSurface":"#2D1A1A","selection":"#DA702C","selectionText":"#f5f5f5"},"light":{"background":"#FFFCF0","surface":"#F2F0E5","surfaceAlt":"#E6E4D9","surfaceModal":"#F2F0E5","overlay":"#000000","border":"#B7B5AC","borderMuted":"#CECDC3","text":"#100F0F","textMuted":"#6F6E69","textSubtle":"#6F6E69","primary":"#205EA6","secondary":"#5E409D","accent":"#BC5215","active":"#66800B","inactive":"#6F6E69","key":"#BC5215","action":"#24837B","separator":"#6F6E69","program":"#24837B","fileTree":"#205EA6","danger":"#AF3029","dangerSurface":"#F7D8DB","selection":"#205EA6","selectionText":"#f5f5f5"}},"github":{"dark":{"background":"#0d1117","surface":"#010409","surfaceAlt":"#161b22","surfaceModal":"#010409","overlay":"#000000","border":"#30363d","borderMuted":"#21262d","text":"#c9d1d9","textMuted":"#8b949e","textSubtle":"#8b949e","primary":"#58a6ff","secondary":"#bc8cff","accent":"#39c5cf","active":"#3fb950","inactive":"#8b949e","key":"#e3b341","action":"#39c5cf","separator":"#30363d","program":"#ff7b72","fileTree":"#58a6ff","danger":"#f85149","dangerSurface":"#67060c","selection":"#58a6ff","selectionText":"#171717"},"light":{"background":"#ffffff","surface":"#f6f8fa","surfaceAlt":"#f0f3f6","surfaceModal":"#f6f8fa","overlay":"#000000","border":"#d0d7de","borderMuted":"#d8dee4","text":"#24292f","textMuted":"#57606a","textSubtle":"#57606a","primary":"#0969da","secondary":"#8250df","accent":"#1b7c83","active":"#1a7f37","inactive":"#57606a","key":"#9a6700","action":"#1b7c83","separator":"#d0d7de","program":"#bf3989","fileTree":"#0969da","danger":"#cf222e","dangerSurface":"#ffebe9","selection":"#0969da","selectionText":"#f5f5f5"}},"gruvbox":{"dark":{"background":"#282828","surface":"#3c3836","surfaceAlt":"#504945","surfaceModal":"#3c3836","overlay":"#000000","border":"#665c54","borderMuted":"#504945","text":"#ebdbb2","textMuted":"#928374","textSubtle":"#928374","primary":"#83a598","secondary":"#d3869b","accent":"#8ec07c","active":"#b8bb26","inactive":"#928374","key":"#fe8019","action":"#b8bb26","separator":"#928374","program":"#fabd2f","fileTree":"#8ec07c","danger":"#fb4934","dangerSurface":"#322929","selection":"#83a598","selectionText":"#171717"},"light":{"background":"#fbf1c7","surface":"#ebdbb2","surfaceAlt":"#d5c4a1","surfaceModal":"#ebdbb2","overlay":"#000000","border":"#bdae93","borderMuted":"#d5c4a1","text":"#3c3836","textMuted":"#7c6f64","textSubtle":"#7c6f64","primary":"#076678","secondary":"#8f3f71","accent":"#427b58","active":"#79740e","inactive":"#7c6f64","key":"#af3a03","action":"#79740e","separator":"#7c6f64","program":"#b57614","fileTree":"#427b58","danger":"#9d0006","dangerSurface":"#e2c7c3","selection":"#076678","selectionText":"#f5f5f5"}},"kanagawa":{"dark":{"background":"#1F1F28","surface":"#2A2A37","surfaceAlt":"#363646","surfaceModal":"#2A2A37","overlay":"#000000","border":"#54546D","borderMuted":"#363646","text":"#DCD7BA","textMuted":"#727169","textSubtle":"#727169","primary":"#7E9CD8","secondary":"#957FB8","accent":"#D27E99","active":"#98BB6C","inactive":"#727169","key":"#D7A657","action":"#76946A","separator":"#727169","program":"#98BB6C","fileTree":"#7E9CD8","danger":"#E82424","dangerSurface":"#362020","selection":"#7E9CD8","selectionText":"#171717"},"light":{"background":"#F2E9DE","surface":"#EAE4D7","surfaceAlt":"#E3DCD2","surfaceModal":"#EAE4D7","overlay":"#000000","border":"#D4CBBF","borderMuted":"#DCD4C9","text":"#54433A","textMuted":"#9E9389","textSubtle":"#9E9389","primary":"#2D4F67","secondary":"#957FB8","accent":"#D27E99","active":"#98BB6C","inactive":"#9E9389","key":"#D7A657","action":"#76946A","separator":"#9E9389","program":"#98BB6C","fileTree":"#2D4F67","danger":"#E82424","dangerSurface":"#FBE6E6","selection":"#2D4F67","selectionText":"#f5f5f5"}},"lucent-orng":{"dark":{"background":"#000000","surface":"#000000","surfaceAlt":"#000000","surfaceModal":"#000000","overlay":"#000000","border":"#EC5B2B","borderMuted":"#3c3c3c","text":"#eeeeee","textMuted":"#808080","textSubtle":"#808080","primary":"#EC5B2B","secondary":"#EE7948","accent":"#FFF7F1","active":"#6ba1e6","inactive":"#808080","key":"#EC5B2B","action":"#56b6c2","separator":"#808080","program":"#6ba1e6","fileTree":"#EC5B2B","danger":"#e06c75","dangerSurface":"#000000","selection":"#EC5B2B","selectionText":"#f5f5f5"},"light":{"background":"#000000","surface":"#000000","surfaceAlt":"#000000","surfaceModal":"#000000","overlay":"#000000","border":"#EC5B2B","borderMuted":"#d4d4d4","text":"#1a1a1a","textMuted":"#8a8a8a","textSubtle":"#8a8a8a","primary":"#EC5B2B","secondary":"#EE7948","accent":"#c94d24","active":"#0062d1","inactive":"#8a8a8a","key":"#EC5B2B","action":"#318795","separator":"#8a8a8a","program":"#0062d1","fileTree":"#EC5B2B","danger":"#d1383d","dangerSurface":"#000000","selection":"#EC5B2B","selectionText":"#f5f5f5"}},"material":{"dark":{"background":"#263238","surface":"#1e272c","surfaceAlt":"#37474f","surfaceModal":"#1e272c","overlay":"#000000","border":"#37474f","borderMuted":"#1e272c","text":"#eeffff","textMuted":"#546e7a","textSubtle":"#546e7a","primary":"#82aaff","secondary":"#c792ea","accent":"#89ddff","active":"#c3e88d","inactive":"#546e7a","key":"#ffcb6b","action":"#c792ea","separator":"#37474f","program":"#c3e88d","fileTree":"#89ddff","danger":"#f07178","dangerSurface":"#3c2b2b","selection":"#82aaff","selectionText":"#171717"},"light":{"background":"#fafafa","surface":"#f5f5f5","surfaceAlt":"#e7e7e8","surfaceModal":"#f5f5f5","overlay":"#000000","border":"#e0e0e0","borderMuted":"#eeeeee","text":"#263238","textMuted":"#90a4ae","textSubtle":"#90a4ae","primary":"#6182b8","secondary":"#7c4dff","accent":"#39adb5","active":"#91b859","inactive":"#90a4ae","key":"#ffb300","action":"#7c4dff","separator":"#e0e0e0","program":"#91b859","fileTree":"#39adb5","danger":"#e53935","dangerSurface":"#ffebee","selection":"#6182b8","selectionText":"#f5f5f5"}},"matrix":{"dark":{"background":"#0a0e0a","surface":"#0e130d","surfaceAlt":"#141c12","surfaceModal":"#0e130d","overlay":"#000000","border":"#1e2a1b","borderMuted":"#141c12","text":"#62ff94","textMuted":"#8ca391","textSubtle":"#8ca391","primary":"#2eff6a","secondary":"#00efff","accent":"#c770ff","active":"#62ff94","inactive":"#8ca391","key":"#e6ff57","action":"#24f6d9","separator":"#8ca391","program":"#1cc24b","fileTree":"#30b3ff","danger":"#ff4b4b","dangerSurface":"#261212","selection":"#2eff6a","selectionText":"#171717"},"light":{"background":"#eef3ea","surface":"#e4ebe1","surfaceAlt":"#dae1d7","surfaceModal":"#e4ebe1","overlay":"#000000","border":"#748476","borderMuted":"#dae1d7","text":"#203022","textMuted":"#748476","textSubtle":"#748476","primary":"#1cc24b","secondary":"#24f6d9","accent":"#c770ff","active":"#1cc24b","inactive":"#748476","key":"#e6ff57","action":"#24f6d9","separator":"#748476","program":"#1cc24b","fileTree":"#30b3ff","danger":"#ff4b4b","dangerSurface":"#f9e5e5","selection":"#1cc24b","selectionText":"#f5f5f5"}},"mercury":{"dark":{"background":"#171721","surface":"#10101a","surfaceAlt":"#272735","surfaceModal":"#10101a","overlay":"#000000","border":"#b4b7c81f","borderMuted":"#b4b7c814","text":"#dddde5","textMuted":"#9d9da8","textSubtle":"#9d9da8","primary":"#8da4f5","secondary":"#a7b6f8","accent":"#8da4f5","active":"#77c599","inactive":"#9d9da8","key":"#fc9b6f","action":"#a7b6f8","separator":"#b4b7c81f","program":"#77c599","fileTree":"#8da4f5","danger":"#fc92b4","dangerSurface":"#fc92b433","selection":"#8da4f5","selectionText":"#171717"},"light":{"background":"#ffffff","surface":"#fbfcfd","surfaceAlt":"#f4f5f9","surfaceModal":"#fbfcfd","overlay":"#000000","border":"#7073931a","borderMuted":"#7073930f","text":"#363644","textMuted":"#70707d","textSubtle":"#70707d","primary":"#5266eb","secondary":"#465bd1","accent":"#8da4f5","active":"#036e43","inactive":"#70707d","key":"#a44200","action":"#5266eb","separator":"#7073931a","program":"#036e43","fileTree":"#465bd1","danger":"#b0175f","dangerSurface":"#d032751a","selection":"#5266eb","selectionText":"#f5f5f5"}},"monokai":{"dark":{"background":"#272822","surface":"#1e1f1c","surfaceAlt":"#3e3d32","surfaceModal":"#1e1f1c","overlay":"#000000","border":"#3e3d32","borderMuted":"#1e1f1c","text":"#f8f8f2","textMuted":"#75715e","textSubtle":"#75715e","primary":"#66d9ef","secondary":"#ae81ff","accent":"#a6e22e","active":"#a6e22e","inactive":"#75715e","key":"#e6db74","action":"#ae81ff","separator":"#75715e","program":"#a6e22e","fileTree":"#66d9ef","danger":"#f92672","dangerSurface":"#3a1a1a","selection":"#66d9ef","selectionText":"#171717"},"light":{"background":"#fafafa","surface":"#f0f0f0","surfaceAlt":"#e0e0e0","surfaceModal":"#f0f0f0","overlay":"#000000","border":"#d0d0d0","borderMuted":"#e8e8e8","text":"#272822","textMuted":"#75715e","textSubtle":"#75715e","primary":"#66d9ef","secondary":"#ae81ff","accent":"#a6e22e","active":"#a6e22e","inactive":"#75715e","key":"#fd971f","action":"#ae81ff","separator":"#75715e","program":"#a6e22e","fileTree":"#66d9ef","danger":"#f92672","dangerSurface":"#ffe0e0","selection":"#66d9ef","selectionText":"#171717"}},"nightowl":{"dark":{"background":"#011627","surface":"#0b253a","surfaceAlt":"#0b253a","surfaceModal":"#0b253a","overlay":"#000000","border":"#5f7e97","borderMuted":"#5f7e97","text":"#d6deeb","textMuted":"#5f7e97","textSubtle":"#5f7e97","primary":"#82AAFF","secondary":"#7fdbca","accent":"#c792ea","active":"#c5e478","inactive":"#5f7e97","key":"#ecc48d","action":"#82AAFF","separator":"#5f7e97","program":"#c5e478","fileTree":"#7fdbca","danger":"#EF5350","dangerSurface":"#2d1b1b","selection":"#82AAFF","selectionText":"#171717"},"light":{"background":"#011627","surface":"#0b253a","surfaceAlt":"#0b253a","surfaceModal":"#0b253a","overlay":"#000000","border":"#5f7e97","borderMuted":"#5f7e97","text":"#d6deeb","textMuted":"#5f7e97","textSubtle":"#5f7e97","primary":"#82AAFF","secondary":"#7fdbca","accent":"#c792ea","active":"#c5e478","inactive":"#5f7e97","key":"#ecc48d","action":"#82AAFF","separator":"#5f7e97","program":"#c5e478","fileTree":"#7fdbca","danger":"#EF5350","dangerSurface":"#2d1b1b","selection":"#82AAFF","selectionText":"#171717"}},"nord":{"dark":{"background":"#2E3440","surface":"#3B4252","surfaceAlt":"#434C5E","surfaceModal":"#3B4252","overlay":"#000000","border":"#434C5E","borderMuted":"#434C5E","text":"#ECEFF4","textMuted":"#8B95A7","textSubtle":"#8B95A7","primary":"#88C0D0","secondary":"#81A1C1","accent":"#8FBCBB","active":"#A3BE8C","inactive":"#8B95A7","key":"#D08770","action":"#8FBCBB","separator":"#8B95A7","program":"#A3BE8C","fileTree":"#81A1C1","danger":"#BF616A","dangerSurface":"#3B4252","selection":"#88C0D0","selectionText":"#171717"},"light":{"background":"#ECEFF4","surface":"#E5E9F0","surfaceAlt":"#D8DEE9","surfaceModal":"#E5E9F0","overlay":"#000000","border":"#4C566A","borderMuted":"#4C566A","text":"#2E3440","textMuted":"#3B4252","textSubtle":"#3B4252","primary":"#5E81AC","secondary":"#81A1C1","accent":"#8FBCBB","active":"#A3BE8C","inactive":"#3B4252","key":"#D08770","action":"#8FBCBB","separator":"#4C566A","program":"#A3BE8C","fileTree":"#81A1C1","danger":"#BF616A","dangerSurface":"#E5E9F0","selection":"#5E81AC","selectionText":"#f5f5f5"}},"one-dark":{"dark":{"background":"#282c34","surface":"#21252b","surfaceAlt":"#353b45","surfaceModal":"#21252b","overlay":"#000000","border":"#393f4a","borderMuted":"#2c313a","text":"#abb2bf","textMuted":"#5c6370","textSubtle":"#5c6370","primary":"#61afef","secondary":"#c678dd","accent":"#56b6c2","active":"#98c379","inactive":"#5c6370","key":"#e5c07b","action":"#56b6c2","separator":"#5c6370","program":"#98c379","fileTree":"#61afef","danger":"#e06c75","dangerSurface":"#3a2d2f","selection":"#61afef","selectionText":"#171717"},"light":{"background":"#fafafa","surface":"#f0f0f1","surfaceAlt":"#eaeaeb","surfaceModal":"#f0f0f1","overlay":"#000000","border":"#d1d1d2","borderMuted":"#e0e0e1","text":"#383a42","textMuted":"#a0a1a7","textSubtle":"#a0a1a7","primary":"#4078f2","secondary":"#a626a4","accent":"#0184bc","active":"#50a14f","inactive":"#a0a1a7","key":"#c18401","action":"#0184bc","separator":"#a0a1a7","program":"#50a14f","fileTree":"#4078f2","danger":"#e45649","dangerSurface":"#fce9e8","selection":"#4078f2","selectionText":"#f5f5f5"}},"opencode":{"dark":{"background":"#0a0a0a","surface":"#141414","surfaceAlt":"#1e1e1e","surfaceModal":"#141414","overlay":"#000000","border":"#484848","borderMuted":"#3c3c3c","text":"#eeeeee","textMuted":"#808080","textSubtle":"#808080","primary":"#fab283","secondary":"#5c9cf5","accent":"#9d7cd8","active":"#7fd88f","inactive":"#808080","key":"#f5a742","action":"#56b6c2","separator":"#808080","program":"#7fd88f","fileTree":"#fab283","danger":"#e06c75","dangerSurface":"#37222c","selection":"#fab283","selectionText":"#171717"},"light":{"background":"#ffffff","surface":"#fafafa","surfaceAlt":"#f5f5f5","surfaceModal":"#fafafa","overlay":"#000000","border":"#b8b8b8","borderMuted":"#d4d4d4","text":"#1a1a1a","textMuted":"#8a8a8a","textSubtle":"#8a8a8a","primary":"#3b7dd8","secondary":"#7b5bb6","accent":"#d68c27","active":"#3d9a57","inactive":"#8a8a8a","key":"#d68c27","action":"#318795","separator":"#8a8a8a","program":"#3d9a57","fileTree":"#3b7dd8","danger":"#d1383d","dangerSurface":"#f7d8db","selection":"#3b7dd8","selectionText":"#f5f5f5"}},"orng":{"dark":{"background":"#0a0a0a","surface":"#141414","surfaceAlt":"#1e1e1e","surfaceModal":"#141414","overlay":"#000000","border":"#EC5B2B","borderMuted":"#3c3c3c","text":"#eeeeee","textMuted":"#808080","textSubtle":"#808080","primary":"#EC5B2B","secondary":"#EE7948","accent":"#FFF7F1","active":"#6ba1e6","inactive":"#808080","key":"#EC5B2B","action":"#56b6c2","separator":"#808080","program":"#6ba1e6","fileTree":"#EC5B2B","danger":"#e06c75","dangerSurface":"#37222c","selection":"#EC5B2B","selectionText":"#f5f5f5"},"light":{"background":"#ffffff","surface":"#FFF7F1","surfaceAlt":"#f5f0eb","surfaceModal":"#FFF7F1","overlay":"#000000","border":"#EC5B2B","borderMuted":"#d4d4d4","text":"#1a1a1a","textMuted":"#8a8a8a","textSubtle":"#8a8a8a","primary":"#EC5B2B","secondary":"#EE7948","accent":"#c94d24","active":"#0062d1","inactive":"#8a8a8a","key":"#EC5B2B","action":"#318795","separator":"#8a8a8a","program":"#0062d1","fileTree":"#EC5B2B","danger":"#d1383d","dangerSurface":"#f7d8db","selection":"#EC5B2B","selectionText":"#f5f5f5"}},"osaka-jade":{"dark":{"background":"#111c18","surface":"#1a2520","surfaceAlt":"#23372B","surfaceModal":"#1a2520","overlay":"#000000","border":"#3d4a44","borderMuted":"#23372B","text":"#C1C497","textMuted":"#53685B","textSubtle":"#53685B","primary":"#2DD5B7","secondary":"#D2689C","accent":"#549e6a","active":"#549e6a","inactive":"#53685B","key":"#E5C736","action":"#549e6a","separator":"#53685B","program":"#63b07a","fileTree":"#8CD3CB","danger":"#FF5345","dangerSurface":"#241515","selection":"#2DD5B7","selectionText":"#171717"},"light":{"background":"#F6F5DD","surface":"#E8E7CC","surfaceAlt":"#D5D4B8","surfaceModal":"#E8E7CC","overlay":"#000000","border":"#A8A78C","borderMuted":"#D5D4B8","text":"#111c18","textMuted":"#53685B","textSubtle":"#53685B","primary":"#1faa90","secondary":"#a8527a","accent":"#3d7a52","active":"#3d7a52","inactive":"#53685B","key":"#b5a020","action":"#3d7a52","separator":"#53685B","program":"#3d7a52","fileTree":"#1faa90","danger":"#c7392d","dangerSurface":"#eee0e0","selection":"#1faa90","selectionText":"#f5f5f5"}},"palenight":{"dark":{"background":"#292d3e","surface":"#1e2132","surfaceAlt":"#32364a","surfaceModal":"#1e2132","overlay":"#000000","border":"#32364a","borderMuted":"#1e2132","text":"#a6accd","textMuted":"#676e95","textSubtle":"#676e95","primary":"#82aaff","secondary":"#c792ea","accent":"#89ddff","active":"#c3e88d","inactive":"#676e95","key":"#ffcb6b","action":"#89ddff","separator":"#676e95","program":"#c3e88d","fileTree":"#82aaff","danger":"#f07178","dangerSurface":"#3c2b2b","selection":"#82aaff","selectionText":"#171717"},"light":{"background":"#fafafa","surface":"#f5f5f5","surfaceAlt":"#e7e7e8","surfaceModal":"#f5f5f5","overlay":"#000000","border":"#e0e0e0","borderMuted":"#eeeeee","text":"#292d3e","textMuted":"#8796b0","textSubtle":"#8796b0","primary":"#4976eb","secondary":"#a854f2","accent":"#00acc1","active":"#91b859","inactive":"#8796b0","key":"#ffb300","action":"#00acc1","separator":"#8796b0","program":"#91b859","fileTree":"#4976eb","danger":"#e53935","dangerSurface":"#ffebee","selection":"#4976eb","selectionText":"#f5f5f5"}},"rosepine":{"dark":{"background":"#191724","surface":"#1f1d2e","surfaceAlt":"#26233a","surfaceModal":"#1f1d2e","overlay":"#000000","border":"#403d52","borderMuted":"#21202e","text":"#e0def4","textMuted":"#6e6a86","textSubtle":"#6e6a86","primary":"#9ccfd8","secondary":"#c4a7e7","accent":"#ebbcba","active":"#31748f","inactive":"#6e6a86","key":"#f6c177","action":"#ebbcba","separator":"#403d52","program":"#31748f","fileTree":"#9ccfd8","danger":"#eb6f92","dangerSurface":"#3a1f2d","selection":"#9ccfd8","selectionText":"#171717"},"light":{"background":"#faf4ed","surface":"#fffaf3","surfaceAlt":"#f2e9e1","surfaceModal":"#fffaf3","overlay":"#000000","border":"#dfdad9","borderMuted":"#f4ede8","text":"#575279","textMuted":"#9893a5","textSubtle":"#9893a5","primary":"#31748f","secondary":"#907aa9","accent":"#d7827e","active":"#286983","inactive":"#9893a5","key":"#ea9d34","action":"#d7827e","separator":"#dfdad9","program":"#286983","fileTree":"#31748f","danger":"#b4637a","dangerSurface":"#fce5e8","selection":"#31748f","selectionText":"#f5f5f5"}},"solarized":{"dark":{"background":"#002b36","surface":"#073642","surfaceAlt":"#073642","surfaceModal":"#073642","overlay":"#000000","border":"#073642","borderMuted":"#073642","text":"#839496","textMuted":"#586e75","textSubtle":"#586e75","primary":"#268bd2","secondary":"#6c71c4","accent":"#2aa198","active":"#859900","inactive":"#586e75","key":"#b58900","action":"#6c71c4","separator":"#586e75","program":"#859900","fileTree":"#2aa198","danger":"#dc322f","dangerSurface":"#073642","selection":"#268bd2","selectionText":"#f5f5f5"},"light":{"background":"#fdf6e3","surface":"#eee8d5","surfaceAlt":"#eee8d5","surfaceModal":"#eee8d5","overlay":"#000000","border":"#eee8d5","borderMuted":"#eee8d5","text":"#657b83","textMuted":"#93a1a1","textSubtle":"#93a1a1","primary":"#268bd2","secondary":"#6c71c4","accent":"#2aa198","active":"#859900","inactive":"#93a1a1","key":"#b58900","action":"#6c71c4","separator":"#93a1a1","program":"#859900","fileTree":"#2aa198","danger":"#dc322f","dangerSurface":"#eee8d5","selection":"#268bd2","selectionText":"#f5f5f5"}},"synthwave84":{"dark":{"background":"#262335","surface":"#1e1a29","surfaceAlt":"#2a2139","surfaceModal":"#1e1a29","overlay":"#000000","border":"#495495","borderMuted":"#241b2f","text":"#ffffff","textMuted":"#848bbd","textSubtle":"#848bbd","primary":"#36f9f6","secondary":"#ff7edb","accent":"#b084eb","active":"#72f1b8","inactive":"#848bbd","key":"#fede5d","action":"#b084eb","separator":"#495495","program":"#72f1b8","fileTree":"#36f9f6","danger":"#fe4450","dangerSurface":"#3a1a2a","selection":"#36f9f6","selectionText":"#171717"},"light":{"background":"#fafafa","surface":"#f5f5f5","surfaceAlt":"#eeeeee","surfaceModal":"#f5f5f5","overlay":"#000000","border":"#e0e0e0","borderMuted":"#f0f0f0","text":"#262335","textMuted":"#5c5c8a","textSubtle":"#5c5c8a","primary":"#00bcd4","secondary":"#e91e63","accent":"#9c27b0","active":"#4caf50","inactive":"#5c5c8a","key":"#ff9800","action":"#9c27b0","separator":"#e0e0e0","program":"#4caf50","fileTree":"#00bcd4","danger":"#f44336","dangerSurface":"#ffebee","selection":"#00bcd4","selectionText":"#f5f5f5"}},"tokyonight":{"dark":{"background":"#1a1b26","surface":"#1e2030","surfaceAlt":"#222436","surfaceModal":"#1e2030","overlay":"#000000","border":"#737aa2","borderMuted":"#545c7e","text":"#c8d3f5","textMuted":"#828bb8","textSubtle":"#828bb8","primary":"#82aaff","secondary":"#c099ff","accent":"#ff966c","active":"#c3e88d","inactive":"#828bb8","key":"#ff966c","action":"#86e1fc","separator":"#828bb8","program":"#c3e88d","fileTree":"#82aaff","danger":"#ff757f","dangerSurface":"#37222c","selection":"#82aaff","selectionText":"#171717"},"light":{"background":"#e1e2e7","surface":"#d5d6db","surfaceAlt":"#c8c9ce","surfaceModal":"#d5d6db","overlay":"#000000","border":"#737a8c","borderMuted":"#9699a8","text":"#3760bf","textMuted":"#8990a3","textSubtle":"#8990a3","primary":"#2e7de9","secondary":"#9854f1","accent":"#b15c00","active":"#587539","inactive":"#8990a3","key":"#b15c00","action":"#007197","separator":"#8990a3","program":"#587539","fileTree":"#2e7de9","danger":"#f52a65","dangerSurface":"#f7d8db","selection":"#2e7de9","selectionText":"#f5f5f5"}},"vercel":{"dark":{"background":"#000000","surface":"#1A1A1A","surfaceAlt":"#292929","surfaceModal":"#1A1A1A","overlay":"#000000","border":"#1F1F1F","borderMuted":"#1A1A1A","text":"#EDEDED","textMuted":"#878787","textSubtle":"#878787","primary":"#0070F3","secondary":"#52A8FF","accent":"#8E4EC6","active":"#46A758","inactive":"#878787","key":"#FFB224","action":"#0AC7AC","separator":"#454545","program":"#63C46D","fileTree":"#52A8FF","danger":"#E5484D","dangerSurface":"#2A1314","selection":"#0070F3","selectionText":"#f5f5f5"},"light":{"background":"#FFFFFF","surface":"#FAFAFA","surfaceAlt":"#EAEAEA","surfaceModal":"#FAFAFA","overlay":"#000000","border":"#EAEAEA","borderMuted":"#EAEAEA","text":"#171717","textMuted":"#666666","textSubtle":"#666666","primary":"#0070F3","secondary":"#0062D1","accent":"#8E4EC6","active":"#388E3C","inactive":"#666666","key":"#FF9500","action":"#12A594","separator":"#999999","program":"#46A758","fileTree":"#0070F3","danger":"#DC3545","dangerSurface":"#FDECED","selection":"#0070F3","selectionText":"#f5f5f5"}},"vesper":{"dark":{"background":"#101010","surface":"#101010","surfaceAlt":"#101010","surfaceModal":"#101010","overlay":"#000000","border":"#282828","borderMuted":"#1C1C1C","text":"#FFF","textMuted":"#A0A0A0","textSubtle":"#A0A0A0","primary":"#FFC799","secondary":"#99FFE4","accent":"#FFC799","active":"#99FFE4","inactive":"#A0A0A0","key":"#FFC799","action":"#A0A0A0","separator":"#65737E","program":"#A0A0A0","fileTree":"#FFC799","danger":"#FF8080","dangerSurface":"#281a1a","selection":"#FFC799","selectionText":"#171717"},"light":{"background":"#FFF","surface":"#F0F0F0","surfaceAlt":"#E0E0E0","surfaceModal":"#F0F0F0","overlay":"#000000","border":"#D0D0D0","borderMuted":"#E8E8E8","text":"#101010","textMuted":"#A0A0A0","textSubtle":"#A0A0A0","primary":"#FFC799","secondary":"#99FFE4","accent":"#FFC799","active":"#99FFE4","inactive":"#A0A0A0","key":"#FFC799","action":"#A0A0A0","separator":"#65737E","program":"#A0A0A0","fileTree":"#FFC799","danger":"#FF8080","dangerSurface":"#f5e8e8","selection":"#FFC799","selectionText":"#171717"}},"zenburn":{"dark":{"background":"#3f3f3f","surface":"#4f4f4f","surfaceAlt":"#5f5f5f","surfaceModal":"#4f4f4f","overlay":"#000000","border":"#5f5f5f","borderMuted":"#4f4f4f","text":"#dcdccc","textMuted":"#9f9f9f","textSubtle":"#9f9f9f","primary":"#8cd0d3","secondary":"#dc8cc3","accent":"#93e0e3","active":"#7f9f7f","inactive":"#9f9f9f","key":"#f0dfaf","action":"#93e0e3","separator":"#9f9f9f","program":"#7f9f7f","fileTree":"#8cd0d3","danger":"#cc9393","dangerSurface":"#5f4f4f","selection":"#8cd0d3","selectionText":"#171717"},"light":{"background":"#ffffef","surface":"#f5f5e5","surfaceAlt":"#ebebdb","surfaceModal":"#f5f5e5","overlay":"#000000","border":"#d0d0c0","borderMuted":"#e0e0d0","text":"#3f3f3f","textMuted":"#6f6f6f","textSubtle":"#6f6f6f","primary":"#5f7f8f","secondary":"#8f5f8f","accent":"#5f8f8f","active":"#5f8f5f","inactive":"#6f6f6f","key":"#8f8f5f","action":"#5f8f8f","separator":"#6f6f6f","program":"#5f8f5f","fileTree":"#5f7f8f","danger":"#8f5f5f","dangerSurface":"#ffefef","selection":"#5f7f8f","selectionText":"#f5f5f5"}}} as const
|
package/src/styles/theme.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
ThemeDefinition,
|
|
7
7
|
ThemeVariant,
|
|
8
8
|
} from '../types'
|
|
9
|
+
import { TUI_THEME_COLORS } from './opencode-tui-colors'
|
|
9
10
|
import { THEMES_A } from './opencode-themes-a'
|
|
10
11
|
import { THEMES_B } from './opencode-themes-b'
|
|
11
12
|
|
|
@@ -58,170 +59,7 @@ function readableText(background: string) {
|
|
|
58
59
|
return luminance(background) > 150 ? '#171717' : '#f5f5f5'
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
const EXACT_TUI_THEME_COLORS: Partial<Record<string, Record<'light' | 'dark', ThemeColors>>> =
|
|
62
|
-
rosepine: {
|
|
63
|
-
dark: {
|
|
64
|
-
background: '#191724',
|
|
65
|
-
surface: '#191724',
|
|
66
|
-
surfaceAlt: '#26233a',
|
|
67
|
-
surfaceModal: '#1f1d2e',
|
|
68
|
-
overlay: '#000000',
|
|
69
|
-
border: '#403d52',
|
|
70
|
-
borderMuted: '#21202e',
|
|
71
|
-
text: '#e0def4',
|
|
72
|
-
textMuted: '#908caa',
|
|
73
|
-
textSubtle: '#6e6a86',
|
|
74
|
-
primary: '#9ccfd8',
|
|
75
|
-
secondary: '#c4a7e7',
|
|
76
|
-
accent: '#ebbcba',
|
|
77
|
-
active: '#31748f',
|
|
78
|
-
inactive: '#6e6a86',
|
|
79
|
-
key: '#f6c177',
|
|
80
|
-
action: '#ebbcba',
|
|
81
|
-
separator: '#403d52',
|
|
82
|
-
program: '#31748f',
|
|
83
|
-
fileTree: '#9ccfd8',
|
|
84
|
-
danger: '#eb6f92',
|
|
85
|
-
dangerSurface: '#3a1f2d',
|
|
86
|
-
selection: '#9ccfd8',
|
|
87
|
-
selectionText: readableText('#9ccfd8'),
|
|
88
|
-
},
|
|
89
|
-
light: {
|
|
90
|
-
background: '#faf4ed',
|
|
91
|
-
surface: '#fffaf3',
|
|
92
|
-
surfaceAlt: '#f2e9e1',
|
|
93
|
-
surfaceModal: '#fffaf3',
|
|
94
|
-
overlay: '#000000',
|
|
95
|
-
border: '#dfdad9',
|
|
96
|
-
borderMuted: '#f4ede8',
|
|
97
|
-
text: '#575279',
|
|
98
|
-
textMuted: '#797593',
|
|
99
|
-
textSubtle: '#9893a5',
|
|
100
|
-
primary: '#31748f',
|
|
101
|
-
secondary: '#907aa9',
|
|
102
|
-
accent: '#d7827e',
|
|
103
|
-
active: '#286983',
|
|
104
|
-
inactive: '#9893a5',
|
|
105
|
-
key: '#ea9d34',
|
|
106
|
-
action: '#d7827e',
|
|
107
|
-
separator: '#dfdad9',
|
|
108
|
-
program: '#286983',
|
|
109
|
-
fileTree: '#31748f',
|
|
110
|
-
danger: '#b4637a',
|
|
111
|
-
dangerSurface: '#fce5e8',
|
|
112
|
-
selection: '#31748f',
|
|
113
|
-
selectionText: readableText('#31748f'),
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
opencode: {
|
|
117
|
-
dark: {
|
|
118
|
-
background: '#0a0a0a',
|
|
119
|
-
surface: '#141414',
|
|
120
|
-
surfaceAlt: '#1e1e1e',
|
|
121
|
-
surfaceModal: '#141414',
|
|
122
|
-
overlay: '#000000',
|
|
123
|
-
border: '#484848',
|
|
124
|
-
borderMuted: '#3c3c3c',
|
|
125
|
-
text: '#eeeeee',
|
|
126
|
-
textMuted: '#a0a0a0',
|
|
127
|
-
textSubtle: '#808080',
|
|
128
|
-
primary: '#fab283',
|
|
129
|
-
secondary: '#5c9cf5',
|
|
130
|
-
accent: '#9d7cd8',
|
|
131
|
-
active: '#7fd88f',
|
|
132
|
-
inactive: '#808080',
|
|
133
|
-
key: '#f5a742',
|
|
134
|
-
action: '#56b6c2',
|
|
135
|
-
separator: '#808080',
|
|
136
|
-
program: '#7fd88f',
|
|
137
|
-
fileTree: '#fab283',
|
|
138
|
-
danger: '#e06c75',
|
|
139
|
-
dangerSurface: '#37222c',
|
|
140
|
-
selection: '#fab283',
|
|
141
|
-
selectionText: readableText('#fab283'),
|
|
142
|
-
},
|
|
143
|
-
light: {
|
|
144
|
-
background: '#ffffff',
|
|
145
|
-
surface: '#fafafa',
|
|
146
|
-
surfaceAlt: '#f5f5f5',
|
|
147
|
-
surfaceModal: '#fafafa',
|
|
148
|
-
overlay: '#000000',
|
|
149
|
-
border: '#b8b8b8',
|
|
150
|
-
borderMuted: '#d4d4d4',
|
|
151
|
-
text: '#1a1a1a',
|
|
152
|
-
textMuted: '#8a8a8a',
|
|
153
|
-
textSubtle: '#a0a0a0',
|
|
154
|
-
primary: '#3b7dd8',
|
|
155
|
-
secondary: '#7b5bb6',
|
|
156
|
-
accent: '#d68c27',
|
|
157
|
-
active: '#3d9a57',
|
|
158
|
-
inactive: '#8a8a8a',
|
|
159
|
-
key: '#d68c27',
|
|
160
|
-
action: '#318795',
|
|
161
|
-
separator: '#8a8a8a',
|
|
162
|
-
program: '#3d9a57',
|
|
163
|
-
fileTree: '#3b7dd8',
|
|
164
|
-
danger: '#d1383d',
|
|
165
|
-
dangerSurface: '#f7d8db',
|
|
166
|
-
selection: '#3b7dd8',
|
|
167
|
-
selectionText: readableText('#3b7dd8'),
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
'oc-2': {
|
|
171
|
-
dark: {
|
|
172
|
-
background: '#1f1f1f',
|
|
173
|
-
surface: '#232323',
|
|
174
|
-
surfaceAlt: '#282828',
|
|
175
|
-
surfaceModal: '#232323',
|
|
176
|
-
overlay: '#000000',
|
|
177
|
-
border: '#282828',
|
|
178
|
-
borderMuted: '#232323',
|
|
179
|
-
text: '#ededed',
|
|
180
|
-
textMuted: '#a0a0a0',
|
|
181
|
-
textSubtle: '#707070',
|
|
182
|
-
primary: '#fab283',
|
|
183
|
-
secondary: '#034cff',
|
|
184
|
-
accent: '#edb2f1',
|
|
185
|
-
active: '#12c905',
|
|
186
|
-
inactive: '#707070',
|
|
187
|
-
key: '#fcd53a',
|
|
188
|
-
action: '#edb2f1',
|
|
189
|
-
separator: '#505050',
|
|
190
|
-
program: '#00ceb9',
|
|
191
|
-
fileTree: '#93e9f6',
|
|
192
|
-
danger: '#fc533a',
|
|
193
|
-
dangerSurface: '#1f0603',
|
|
194
|
-
selection: '#fab283',
|
|
195
|
-
selectionText: readableText('#fab283'),
|
|
196
|
-
},
|
|
197
|
-
light: {
|
|
198
|
-
background: '#f8f8f8',
|
|
199
|
-
surface: '#f3f3f3',
|
|
200
|
-
surfaceAlt: '#ededed',
|
|
201
|
-
surfaceModal: '#ffffff',
|
|
202
|
-
overlay: '#000000',
|
|
203
|
-
border: '#dbdbdb',
|
|
204
|
-
borderMuted: '#e8e8e8',
|
|
205
|
-
text: '#171717',
|
|
206
|
-
textMuted: '#6f6f6f',
|
|
207
|
-
textSubtle: '#8f8f8f',
|
|
208
|
-
primary: '#dcde8d',
|
|
209
|
-
secondary: '#034cff',
|
|
210
|
-
accent: '#a753ae',
|
|
211
|
-
active: '#12c905',
|
|
212
|
-
inactive: '#8f8f8f',
|
|
213
|
-
key: '#ffdc17',
|
|
214
|
-
action: '#a753ae',
|
|
215
|
-
separator: '#c7c7c7',
|
|
216
|
-
program: '#00ceb9',
|
|
217
|
-
fileTree: '#007b80',
|
|
218
|
-
danger: '#fc533a',
|
|
219
|
-
dangerSurface: '#fff2f0',
|
|
220
|
-
selection: '#dcde8d',
|
|
221
|
-
selectionText: readableText('#dcde8d'),
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
}
|
|
62
|
+
const EXACT_TUI_THEME_COLORS: Partial<Record<string, Record<'light' | 'dark', ThemeColors>>> = TUI_THEME_COLORS
|
|
225
63
|
|
|
226
64
|
function mix(colorA: string, colorB: string, ratio: number) {
|
|
227
65
|
const from = hexToRgb(colorA)
|
package/src/tmux/index.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { spawn } from 'bun'
|
|
2
2
|
import type { Item, SessionDetails, WindowInfo } from '../types'
|
|
3
3
|
|
|
4
|
+
const SESSION_DETAILS_CACHE_TTL_MS = 4000
|
|
5
|
+
const sessionDetailsCache = new Map<string, { details: SessionDetails; expiresAt: number }>()
|
|
6
|
+
|
|
7
|
+
function stripAnsi(value: string): string {
|
|
8
|
+
return value.replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g, '')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function formatPanePreview(output: string): string[] {
|
|
12
|
+
return stripAnsi(output)
|
|
13
|
+
.replace(/\r/g, '')
|
|
14
|
+
.split('\n')
|
|
15
|
+
.map(line => line.trimEnd())
|
|
16
|
+
.filter(line => line.length > 0)
|
|
17
|
+
.slice(-8)
|
|
18
|
+
}
|
|
19
|
+
|
|
4
20
|
export interface CreateTmuxSessionOptions {
|
|
5
21
|
startupCommand?: string
|
|
6
22
|
}
|
|
@@ -161,6 +177,11 @@ export async function renameTmuxSession(oldName: string, newName: string): Promi
|
|
|
161
177
|
}
|
|
162
178
|
|
|
163
179
|
export async function getSessionDetails(sessionName: string): Promise<SessionDetails> {
|
|
180
|
+
const cached = sessionDetailsCache.get(sessionName)
|
|
181
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
182
|
+
return cached.details
|
|
183
|
+
}
|
|
184
|
+
|
|
164
185
|
// Get session status
|
|
165
186
|
const statusProc = spawn([
|
|
166
187
|
'tmux',
|
|
@@ -222,10 +243,44 @@ export async function getSessionDetails(sessionName: string): Promise<SessionDet
|
|
|
222
243
|
})
|
|
223
244
|
}
|
|
224
245
|
|
|
225
|
-
|
|
246
|
+
const activeWindowProc = spawn([
|
|
247
|
+
'tmux',
|
|
248
|
+
'display-message',
|
|
249
|
+
'-t',
|
|
250
|
+
sessionName,
|
|
251
|
+
'-p',
|
|
252
|
+
'#{window_index}',
|
|
253
|
+
])
|
|
254
|
+
const activeWindowIndex = (await new Response(activeWindowProc.stdout).text()).trim()
|
|
255
|
+
|
|
256
|
+
let panePreviewLines: string[] | undefined
|
|
257
|
+
if (activeWindowIndex.length > 0) {
|
|
258
|
+
const paneProc = spawn([
|
|
259
|
+
'tmux',
|
|
260
|
+
'capture-pane',
|
|
261
|
+
'-p',
|
|
262
|
+
'-t',
|
|
263
|
+
`${sessionName}:${activeWindowIndex}`,
|
|
264
|
+
'-S',
|
|
265
|
+
'-16',
|
|
266
|
+
])
|
|
267
|
+
const paneOutput = await new Response(paneProc.stdout).text()
|
|
268
|
+
const formatted = formatPanePreview(paneOutput)
|
|
269
|
+
panePreviewLines = formatted.length > 0 ? formatted : undefined
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const details = {
|
|
226
273
|
name: sessionName,
|
|
227
274
|
isAttached: attached === '1',
|
|
228
275
|
windowCount,
|
|
229
276
|
windows,
|
|
277
|
+
panePreviewLines,
|
|
230
278
|
}
|
|
279
|
+
|
|
280
|
+
sessionDetailsCache.set(sessionName, {
|
|
281
|
+
details,
|
|
282
|
+
expiresAt: Date.now() + SESSION_DETAILS_CACHE_TTL_MS,
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
return details
|
|
231
286
|
}
|
package/src/tmux/projects.ts
CHANGED
|
@@ -9,7 +9,18 @@ interface ZoxideEntry {
|
|
|
9
9
|
path: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
interface DiscoveryCacheEntry {
|
|
13
|
+
expiresAt: number
|
|
14
|
+
items: Item[]
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
const PROJECT_MARKERS = ['.git', '.jj', 'package.json', 'Cargo.toml', 'go.mod', 'pyproject.toml', 'flake.nix']
|
|
18
|
+
const DISCOVERY_CACHE_TTL_MS = 15000
|
|
19
|
+
const PROJECT_SCAN_DEPTH = 3
|
|
20
|
+
const SESSION_CANDIDATE_SCAN_DEPTH = 5
|
|
21
|
+
const projectItemsCache = new Map<string, DiscoveryCacheEntry>()
|
|
22
|
+
const sessionCandidateCache = new Map<string, DiscoveryCacheEntry>()
|
|
23
|
+
|
|
13
24
|
function isIgnoredProjectDirectory(baseName: string): boolean {
|
|
14
25
|
return (
|
|
15
26
|
baseName.startsWith('.') ||
|
|
@@ -30,6 +41,18 @@ function toProjectItem(projectPath: string): Item {
|
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
|
|
44
|
+
function uniqueNormalizedPaths(paths: string[]): string[] {
|
|
45
|
+
return [...new Set(paths.map(path => normalizePathForMatching(path)))]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function buildCacheKey(config: Config, scope: 'projects' | 'session-candidates'): string {
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
scope,
|
|
51
|
+
roots: uniqueNormalizedPaths(config.projectPaths),
|
|
52
|
+
zoxideMode: config.zoxideMode,
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
33
56
|
async function hasProjectMarker(projectPath: string): Promise<boolean> {
|
|
34
57
|
for (const marker of PROJECT_MARKERS) {
|
|
35
58
|
try {
|
|
@@ -42,7 +65,7 @@ async function hasProjectMarker(projectPath: string): Promise<boolean> {
|
|
|
42
65
|
}
|
|
43
66
|
|
|
44
67
|
export async function filterProjectCandidatePaths(projectPaths: string[]): Promise<string[]> {
|
|
45
|
-
const uniquePaths =
|
|
68
|
+
const uniquePaths = uniqueNormalizedPaths(projectPaths)
|
|
46
69
|
const matches = await Promise.all(
|
|
47
70
|
uniquePaths.map(async projectPath => ({
|
|
48
71
|
projectPath,
|
|
@@ -84,13 +107,14 @@ function isWithinProjectRoots(projectPath: string, projectRoots: string[]): bool
|
|
|
84
107
|
})
|
|
85
108
|
}
|
|
86
109
|
|
|
87
|
-
|
|
110
|
+
function rankItemsByZoxide(items: Item[], entries: ZoxideEntry[], config: Config): Item[] {
|
|
88
111
|
if (config.zoxideMode === 'off' || entries.length === 0) {
|
|
89
112
|
return items.sort((a, b) => a.title.localeCompare(b.title))
|
|
90
113
|
}
|
|
91
114
|
|
|
92
115
|
const zoxideScores = new Map(entries.map(entry => [normalizePathForMatching(entry.path), entry.score]))
|
|
93
|
-
|
|
116
|
+
|
|
117
|
+
return [...items].sort((left, right) => {
|
|
94
118
|
const scoreDifference =
|
|
95
119
|
(zoxideScores.get(normalizePathForMatching(right.path)) ?? 0) -
|
|
96
120
|
(zoxideScores.get(normalizePathForMatching(left.path)) ?? 0)
|
|
@@ -101,6 +125,10 @@ export function applyZoxideMode(items: Item[], entries: ZoxideEntry[], config: C
|
|
|
101
125
|
|
|
102
126
|
return left.title.localeCompare(right.title)
|
|
103
127
|
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function applyZoxideMode(items: Item[], entries: ZoxideEntry[], config: Config): Item[] {
|
|
131
|
+
const rankedItems = rankItemsByZoxide(items, entries, config)
|
|
104
132
|
|
|
105
133
|
if (config.zoxideMode !== 'merge') {
|
|
106
134
|
return rankedItems
|
|
@@ -126,7 +154,7 @@ export function applyZoxideMode(items: Item[], entries: ZoxideEntry[], config: C
|
|
|
126
154
|
return [...rankedItems, ...mergedItems]
|
|
127
155
|
}
|
|
128
156
|
|
|
129
|
-
async function getZoxideEntries(projectRoots: string[]): Promise<ZoxideEntry[]> {
|
|
157
|
+
async function getZoxideEntries(projectRoots: string[], requireProjectMarker: boolean): Promise<ZoxideEntry[]> {
|
|
130
158
|
try {
|
|
131
159
|
const proc = spawn(['zoxide', 'query', '--list', '--score'])
|
|
132
160
|
const output = await new Response(proc.stdout).text()
|
|
@@ -137,6 +165,11 @@ async function getZoxideEntries(projectRoots: string[]): Promise<ZoxideEntry[]>
|
|
|
137
165
|
}
|
|
138
166
|
|
|
139
167
|
const entriesWithinRoots = parseZoxideOutput(output).filter(entry => isWithinProjectRoots(entry.path, projectRoots))
|
|
168
|
+
|
|
169
|
+
if (!requireProjectMarker) {
|
|
170
|
+
return entriesWithinRoots.filter(entry => !isIgnoredProjectDirectory(basename(entry.path)))
|
|
171
|
+
}
|
|
172
|
+
|
|
140
173
|
const projectCandidatePaths = await filterProjectCandidatePaths(entriesWithinRoots.map(entry => entry.path))
|
|
141
174
|
const projectCandidates = new Set(projectCandidatePaths)
|
|
142
175
|
|
|
@@ -146,41 +179,98 @@ async function getZoxideEntries(projectRoots: string[]): Promise<ZoxideEntry[]>
|
|
|
146
179
|
}
|
|
147
180
|
}
|
|
148
181
|
|
|
149
|
-
|
|
150
|
-
const items: Item[] = []
|
|
151
|
-
|
|
182
|
+
async function getExistingProjectRoots(projectPaths: string[]): Promise<string[]> {
|
|
152
183
|
const existingPaths: string[] = []
|
|
153
|
-
for (const path of
|
|
184
|
+
for (const path of projectPaths) {
|
|
154
185
|
try {
|
|
155
|
-
await stat(path)
|
|
156
|
-
|
|
186
|
+
const pathStat = await stat(path)
|
|
187
|
+
if (pathStat.isDirectory()) {
|
|
188
|
+
existingPaths.push(path)
|
|
189
|
+
}
|
|
157
190
|
} catch {}
|
|
158
191
|
}
|
|
159
192
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
193
|
+
return existingPaths
|
|
194
|
+
}
|
|
163
195
|
|
|
164
|
-
|
|
196
|
+
async function scanDirectories(projectRoots: string[], maxDepth: number): Promise<string[]> {
|
|
197
|
+
if (projectRoots.length === 0) {
|
|
198
|
+
return []
|
|
199
|
+
}
|
|
165
200
|
|
|
166
|
-
const
|
|
201
|
+
const args = [...projectRoots, '-mindepth', '1', '-maxdepth', String(maxDepth), '-type', 'd']
|
|
202
|
+
const proc = spawn(['find', ...args], {
|
|
203
|
+
stderr: 'pipe',
|
|
204
|
+
})
|
|
167
205
|
const output = await new Response(proc.stdout).text()
|
|
206
|
+
const stderrPromise = new Response(proc.stderr).text()
|
|
207
|
+
await proc.exited
|
|
208
|
+
await stderrPromise
|
|
168
209
|
|
|
169
|
-
|
|
210
|
+
return output
|
|
211
|
+
.trim()
|
|
212
|
+
.split('\n')
|
|
213
|
+
.filter(Boolean)
|
|
214
|
+
.map(path => normalizePathForMatching(path))
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function filterSessionCandidatePaths(paths: string[]): string[] {
|
|
218
|
+
return uniqueNormalizedPaths(paths).filter(path => !isIgnoredProjectDirectory(basename(path)))
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async function getCachedDiscovery(
|
|
222
|
+
cache: Map<string, DiscoveryCacheEntry>,
|
|
223
|
+
cacheKey: string,
|
|
224
|
+
load: () => Promise<Item[]>
|
|
225
|
+
): Promise<Item[]> {
|
|
226
|
+
const cached = cache.get(cacheKey)
|
|
227
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
228
|
+
return cached.items
|
|
229
|
+
}
|
|
170
230
|
|
|
171
|
-
const
|
|
231
|
+
const items = await load()
|
|
232
|
+
cache.set(cacheKey, {
|
|
233
|
+
items,
|
|
234
|
+
expiresAt: Date.now() + DISCOVERY_CACHE_TTL_MS,
|
|
235
|
+
})
|
|
172
236
|
|
|
173
|
-
|
|
174
|
-
|
|
237
|
+
return items
|
|
238
|
+
}
|
|
175
239
|
|
|
176
|
-
|
|
177
|
-
|
|
240
|
+
export async function getProjectItems(config: Config): Promise<Item[]> {
|
|
241
|
+
const cacheKey = buildCacheKey(config, 'projects')
|
|
242
|
+
|
|
243
|
+
return getCachedDiscovery(projectItemsCache, cacheKey, async () => {
|
|
244
|
+
const existingPaths = await getExistingProjectRoots(config.projectPaths)
|
|
245
|
+
if (existingPaths.length === 0) {
|
|
246
|
+
return []
|
|
178
247
|
}
|
|
179
248
|
|
|
180
|
-
|
|
181
|
-
|
|
249
|
+
const scannedPaths = await scanDirectories(existingPaths, PROJECT_SCAN_DEPTH)
|
|
250
|
+
const projectCandidatePaths = await filterProjectCandidatePaths(scannedPaths)
|
|
251
|
+
const items = projectCandidatePaths
|
|
252
|
+
.filter(path => !isIgnoredProjectDirectory(basename(path)))
|
|
253
|
+
.map(toProjectItem)
|
|
254
|
+
|
|
255
|
+
const zoxideEntries = config.zoxideMode === 'off' ? [] : await getZoxideEntries(existingPaths, true)
|
|
256
|
+
return applyZoxideMode(items, zoxideEntries, config)
|
|
257
|
+
})
|
|
258
|
+
}
|
|
182
259
|
|
|
183
|
-
|
|
260
|
+
export async function getSessionCandidateItems(config: Config): Promise<Item[]> {
|
|
261
|
+
const cacheKey = buildCacheKey(config, 'session-candidates')
|
|
184
262
|
|
|
185
|
-
return
|
|
263
|
+
return getCachedDiscovery(sessionCandidateCache, cacheKey, async () => {
|
|
264
|
+
const existingPaths = await getExistingProjectRoots(config.projectPaths)
|
|
265
|
+
if (existingPaths.length === 0) {
|
|
266
|
+
return []
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const scannedPaths = await scanDirectories(existingPaths, SESSION_CANDIDATE_SCAN_DEPTH)
|
|
270
|
+
const candidatePaths = filterSessionCandidatePaths(scannedPaths)
|
|
271
|
+
const items = candidatePaths.map(toProjectItem)
|
|
272
|
+
const zoxideEntries = config.zoxideMode === 'off' ? [] : await getZoxideEntries(existingPaths, false)
|
|
273
|
+
|
|
274
|
+
return applyZoxideMode(items, zoxideEntries, config)
|
|
275
|
+
})
|
|
186
276
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -186,6 +186,7 @@ export interface SessionDetails {
|
|
|
186
186
|
isAttached: boolean
|
|
187
187
|
windowCount: string
|
|
188
188
|
windows: WindowInfo[]
|
|
189
|
+
panePreviewLines?: string[]
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
export interface SearchResult {
|
|
@@ -200,8 +201,24 @@ export interface FuzzyMatch {
|
|
|
200
201
|
|
|
201
202
|
export type InstallMethod = 'npm' | 'bun' | 'brew' | 'unknown'
|
|
202
203
|
|
|
203
|
-
export
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
export type UpdateEvent =
|
|
205
|
+
| {
|
|
206
|
+
kind: 'updated'
|
|
207
|
+
currentVersion: string
|
|
208
|
+
version: string
|
|
209
|
+
installMethod: InstallMethod
|
|
210
|
+
}
|
|
211
|
+
| {
|
|
212
|
+
kind: 'available'
|
|
213
|
+
currentVersion: string
|
|
214
|
+
version: string
|
|
215
|
+
installMethod: InstallMethod
|
|
216
|
+
}
|
|
217
|
+
| {
|
|
218
|
+
kind: 'failed'
|
|
219
|
+
currentVersion: string
|
|
220
|
+
version: string
|
|
221
|
+
installMethod: InstallMethod
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export type UpdateEventListener = (event: UpdateEvent) => void
|
|
@@ -109,6 +109,19 @@ function SessionDetailsView({ details }: { details: SessionDetails }) {
|
|
|
109
109
|
))
|
|
110
110
|
)}
|
|
111
111
|
</box>
|
|
112
|
+
|
|
113
|
+
{details.panePreviewLines && details.panePreviewLines.length > 0 && (
|
|
114
|
+
<>
|
|
115
|
+
<SectionLabel>Preview</SectionLabel>
|
|
116
|
+
<box style={{ flexDirection: 'column', marginTop: 1 }}>
|
|
117
|
+
{details.panePreviewLines.map((line, index) => (
|
|
118
|
+
<text key={`${details.name}:preview:${index}`} style={{ fg: theme.textMuted }}>
|
|
119
|
+
{line}
|
|
120
|
+
</text>
|
|
121
|
+
))}
|
|
122
|
+
</box>
|
|
123
|
+
</>
|
|
124
|
+
)}
|
|
112
125
|
</box>
|
|
113
126
|
)
|
|
114
127
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useTheme } from '../styles/theme'
|
|
2
|
+
|
|
3
|
+
interface VersionBadgeProps {
|
|
4
|
+
currentVersion: string
|
|
5
|
+
updatedVersion?: string | null
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function formatVersionBadge(currentVersion: string, updatedVersion?: string | null): string {
|
|
9
|
+
if (updatedVersion && updatedVersion !== currentVersion) {
|
|
10
|
+
return `v${currentVersion} -> v${updatedVersion}`
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return `v${currentVersion}`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default function VersionBadge({ currentVersion, updatedVersion }: VersionBadgeProps) {
|
|
17
|
+
const theme = useTheme()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<box
|
|
21
|
+
style={{
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
bottom: 0,
|
|
24
|
+
right: 1,
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<text style={{ fg: theme.textSubtle }}>{formatVersionBadge(currentVersion, updatedVersion)}</text>
|
|
28
|
+
</box>
|
|
29
|
+
)
|
|
30
|
+
}
|
package/src/update/events.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UpdateEventListener,
|
|
1
|
+
import type { UpdateEventListener, UpdateEvent } from '../types'
|
|
2
2
|
|
|
3
3
|
class UpdateEvents {
|
|
4
4
|
private listeners: UpdateEventListener[] = []
|
|
@@ -14,7 +14,7 @@ class UpdateEvents {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
emit(event:
|
|
17
|
+
emit(event: UpdateEvent) {
|
|
18
18
|
this.listeners.forEach(listener => {
|
|
19
19
|
try {
|
|
20
20
|
listener(event)
|
package/src/update/index.ts
CHANGED
|
@@ -1,32 +1,79 @@
|
|
|
1
1
|
import type { Config } from '../types'
|
|
2
2
|
import { CURRENT_VERSION, getLatestVersion, isNewerVersion } from './version'
|
|
3
|
-
import { detectInstallMethod, performUpgrade } from './installation'
|
|
3
|
+
import { canAutoUpdate, detectInstallMethod, performUpgrade } from './installation'
|
|
4
4
|
import { updateEvents } from './events'
|
|
5
5
|
|
|
6
|
+
interface UpdateDependencies {
|
|
7
|
+
getLatestVersion: typeof getLatestVersion
|
|
8
|
+
isNewerVersion: typeof isNewerVersion
|
|
9
|
+
detectInstallMethod: typeof detectInstallMethod
|
|
10
|
+
canAutoUpdate: typeof canAutoUpdate
|
|
11
|
+
performUpgrade: typeof performUpgrade
|
|
12
|
+
emit: typeof updateEvents.emit
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const defaultDependencies: UpdateDependencies = {
|
|
16
|
+
getLatestVersion,
|
|
17
|
+
isNewerVersion,
|
|
18
|
+
detectInstallMethod,
|
|
19
|
+
canAutoUpdate,
|
|
20
|
+
performUpgrade,
|
|
21
|
+
emit: updateEvents.emit.bind(updateEvents),
|
|
22
|
+
}
|
|
23
|
+
|
|
6
24
|
function truthy(key: string): boolean {
|
|
7
25
|
const value = process.env[key]?.toLowerCase()
|
|
8
26
|
return value === 'true' || value === '1'
|
|
9
27
|
}
|
|
10
28
|
|
|
11
|
-
export async function checkAndUpdate(config: Config): Promise<void> {
|
|
29
|
+
export async function checkAndUpdate(config: Config, dependencies: Partial<UpdateDependencies> = {}): Promise<void> {
|
|
30
|
+
const resolvedDependencies = {
|
|
31
|
+
...defaultDependencies,
|
|
32
|
+
...dependencies,
|
|
33
|
+
}
|
|
34
|
+
|
|
12
35
|
if (!(config.autoUpdate && !truthy('MUX_SESH_DISABLE_AUTOUPDATE'))) {
|
|
13
36
|
return
|
|
14
37
|
}
|
|
15
38
|
|
|
16
|
-
const latest = await getLatestVersion()
|
|
39
|
+
const latest = await resolvedDependencies.getLatestVersion()
|
|
17
40
|
if (!latest) {
|
|
18
41
|
return
|
|
19
42
|
}
|
|
20
43
|
|
|
21
|
-
if (!isNewerVersion(CURRENT_VERSION, latest)) {
|
|
44
|
+
if (!resolvedDependencies.isNewerVersion(CURRENT_VERSION, latest)) {
|
|
22
45
|
return
|
|
23
46
|
}
|
|
24
47
|
|
|
25
|
-
const method = await detectInstallMethod()
|
|
26
|
-
|
|
48
|
+
const method = await resolvedDependencies.detectInstallMethod()
|
|
49
|
+
|
|
50
|
+
if (!resolvedDependencies.canAutoUpdate(method)) {
|
|
51
|
+
resolvedDependencies.emit({
|
|
52
|
+
kind: 'available',
|
|
53
|
+
currentVersion: CURRENT_VERSION,
|
|
54
|
+
version: latest,
|
|
55
|
+
installMethod: method,
|
|
56
|
+
})
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const success = await resolvedDependencies.performUpgrade(method, latest)
|
|
27
61
|
if (success) {
|
|
28
|
-
|
|
62
|
+
resolvedDependencies.emit({
|
|
63
|
+
kind: 'updated',
|
|
64
|
+
currentVersion: CURRENT_VERSION,
|
|
65
|
+
version: latest,
|
|
66
|
+
installMethod: method,
|
|
67
|
+
})
|
|
68
|
+
return
|
|
29
69
|
}
|
|
70
|
+
|
|
71
|
+
resolvedDependencies.emit({
|
|
72
|
+
kind: 'failed',
|
|
73
|
+
currentVersion: CURRENT_VERSION,
|
|
74
|
+
version: latest,
|
|
75
|
+
installMethod: method,
|
|
76
|
+
})
|
|
30
77
|
}
|
|
31
78
|
|
|
32
79
|
export { updateEvents } from './events'
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import type { InstallMethod } from '../types'
|
|
2
2
|
|
|
3
|
+
const PACKAGE_NAME = 'mux-sesh'
|
|
4
|
+
|
|
3
5
|
export async function detectInstallMethod(): Promise<InstallMethod> {
|
|
4
6
|
const checks = [
|
|
5
7
|
{
|
|
6
8
|
name: 'npm' as const,
|
|
7
|
-
command: () => Bun.spawn(['npm', 'list', '-g', '--depth=0']),
|
|
9
|
+
command: () => Bun.spawn(['npm', 'list', '-g', '--depth=0'], { stderr: 'ignore' }),
|
|
8
10
|
},
|
|
9
11
|
{
|
|
10
12
|
name: 'bun' as const,
|
|
11
|
-
command: () => Bun.spawn(['bun', 'pm', 'ls', '-g']),
|
|
13
|
+
command: () => Bun.spawn(['bun', 'pm', 'ls', '-g'], { stderr: 'ignore' }),
|
|
12
14
|
},
|
|
13
15
|
{
|
|
14
16
|
name: 'brew' as const,
|
|
15
|
-
command: () => Bun.spawn(['brew', 'list', '--formula']),
|
|
17
|
+
command: () => Bun.spawn(['brew', 'list', '--formula'], { stderr: 'ignore' }),
|
|
16
18
|
},
|
|
17
19
|
]
|
|
18
20
|
|
|
@@ -21,7 +23,7 @@ export async function detectInstallMethod(): Promise<InstallMethod> {
|
|
|
21
23
|
const proc = check.command()
|
|
22
24
|
const output = await new Response(proc.stdout).text()
|
|
23
25
|
|
|
24
|
-
if (output.includes(
|
|
26
|
+
if (output.includes(PACKAGE_NAME)) {
|
|
25
27
|
return check.name
|
|
26
28
|
}
|
|
27
29
|
} catch (error) {
|
|
@@ -31,6 +33,10 @@ export async function detectInstallMethod(): Promise<InstallMethod> {
|
|
|
31
33
|
return 'unknown'
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
export function canAutoUpdate(method: InstallMethod): boolean {
|
|
37
|
+
return method === 'npm' || method === 'bun'
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
export async function performUpgrade(
|
|
35
41
|
method: InstallMethod,
|
|
36
42
|
targetVersion: string
|
|
@@ -41,17 +47,17 @@ export async function performUpgrade(
|
|
|
41
47
|
let command: string[]
|
|
42
48
|
switch (method) {
|
|
43
49
|
case 'npm':
|
|
44
|
-
command = ['npm', 'install', '-g',
|
|
50
|
+
command = ['npm', 'install', '-g', `${PACKAGE_NAME}@${targetVersion}`]
|
|
45
51
|
break
|
|
46
52
|
case 'bun':
|
|
47
|
-
command = ['bun', 'install', '-g',
|
|
53
|
+
command = ['bun', 'install', '-g', `${PACKAGE_NAME}@${targetVersion}`]
|
|
48
54
|
break
|
|
49
55
|
case 'brew':
|
|
50
|
-
command = ['brew', 'upgrade',
|
|
56
|
+
command = ['brew', 'upgrade', PACKAGE_NAME]
|
|
51
57
|
break
|
|
52
58
|
}
|
|
53
59
|
try {
|
|
54
|
-
const proc = Bun.spawn(command)
|
|
60
|
+
const proc = Bun.spawn(command, { stdout: 'ignore', stderr: 'ignore' })
|
|
55
61
|
await proc.exited
|
|
56
62
|
return proc.exitCode === 0
|
|
57
63
|
} catch (error) {
|
package/src/util/perf.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const PERF_ENABLED = process.env.MUX_SESH_DEBUG_PERF === '1'
|
|
2
|
+
|
|
3
|
+
export async function measure<T>(label: string, fn: () => Promise<T>): Promise<T> {
|
|
4
|
+
if (!PERF_ENABLED) {
|
|
5
|
+
return fn()
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const start = performance.now()
|
|
9
|
+
try {
|
|
10
|
+
return await fn()
|
|
11
|
+
} finally {
|
|
12
|
+
const duration = performance.now() - start
|
|
13
|
+
console.error(`[perf] ${label}: ${duration.toFixed(1)}ms`)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function mark(label: string): void {
|
|
18
|
+
if (!PERF_ENABLED) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
console.error(`[perf] ${label}`)
|
|
23
|
+
}
|