@lattices/cli 0.3.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 +155 -0
- package/app/Lattices.app/Contents/Info.plist +24 -0
- package/app/Package.swift +13 -0
- package/app/Sources/AccessibilityTextExtractor.swift +111 -0
- package/app/Sources/ActionRow.swift +61 -0
- package/app/Sources/App.swift +10 -0
- package/app/Sources/AppDelegate.swift +242 -0
- package/app/Sources/AppShellView.swift +62 -0
- package/app/Sources/AppTypeClassifier.swift +70 -0
- package/app/Sources/AppWindowShell.swift +63 -0
- package/app/Sources/CheatSheetHUD.swift +332 -0
- package/app/Sources/CommandModeState.swift +1362 -0
- package/app/Sources/CommandModeView.swift +1405 -0
- package/app/Sources/CommandModeWindow.swift +192 -0
- package/app/Sources/CommandPaletteView.swift +307 -0
- package/app/Sources/CommandPaletteWindow.swift +134 -0
- package/app/Sources/DaemonProtocol.swift +101 -0
- package/app/Sources/DaemonServer.swift +414 -0
- package/app/Sources/DesktopModel.swift +149 -0
- package/app/Sources/DesktopModelTypes.swift +71 -0
- package/app/Sources/DiagnosticLog.swift +271 -0
- package/app/Sources/EventBus.swift +30 -0
- package/app/Sources/HotkeyManager.swift +254 -0
- package/app/Sources/HotkeyStore.swift +338 -0
- package/app/Sources/InventoryManager.swift +35 -0
- package/app/Sources/InventoryPath.swift +43 -0
- package/app/Sources/KeyRecorderView.swift +210 -0
- package/app/Sources/LatticesApi.swift +1234 -0
- package/app/Sources/LayerBezel.swift +203 -0
- package/app/Sources/MainView.swift +479 -0
- package/app/Sources/MainWindow.swift +83 -0
- package/app/Sources/OcrModel.swift +430 -0
- package/app/Sources/OcrStore.swift +329 -0
- package/app/Sources/OmniSearchState.swift +283 -0
- package/app/Sources/OmniSearchView.swift +288 -0
- package/app/Sources/OmniSearchWindow.swift +105 -0
- package/app/Sources/OrphanRow.swift +129 -0
- package/app/Sources/PaletteCommand.swift +419 -0
- package/app/Sources/PermissionChecker.swift +125 -0
- package/app/Sources/Preferences.swift +99 -0
- package/app/Sources/ProcessModel.swift +199 -0
- package/app/Sources/ProcessQuery.swift +151 -0
- package/app/Sources/Project.swift +28 -0
- package/app/Sources/ProjectRow.swift +368 -0
- package/app/Sources/ProjectScanner.swift +128 -0
- package/app/Sources/ScreenMapState.swift +2387 -0
- package/app/Sources/ScreenMapView.swift +2820 -0
- package/app/Sources/ScreenMapWindowController.swift +89 -0
- package/app/Sources/SessionManager.swift +72 -0
- package/app/Sources/SettingsView.swift +1064 -0
- package/app/Sources/SettingsWindow.swift +20 -0
- package/app/Sources/TabGroupRow.swift +178 -0
- package/app/Sources/Terminal.swift +259 -0
- package/app/Sources/TerminalQuery.swift +156 -0
- package/app/Sources/TerminalSynthesizer.swift +200 -0
- package/app/Sources/Theme.swift +163 -0
- package/app/Sources/TilePickerView.swift +209 -0
- package/app/Sources/TmuxModel.swift +53 -0
- package/app/Sources/TmuxQuery.swift +81 -0
- package/app/Sources/WindowTiler.swift +1778 -0
- package/app/Sources/WorkspaceManager.swift +575 -0
- package/bin/client.js +4 -0
- package/bin/daemon-client.js +187 -0
- package/bin/lattices-app.js +221 -0
- package/bin/lattices.js +1551 -0
- package/docs/api.md +924 -0
- package/docs/app.md +297 -0
- package/docs/concepts.md +135 -0
- package/docs/config.md +245 -0
- package/docs/layers.md +410 -0
- package/docs/ocr.md +185 -0
- package/docs/overview.md +94 -0
- package/docs/quickstart.md +75 -0
- package/package.json +42 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
// MARK: - Data Models
|
|
4
|
+
|
|
5
|
+
struct TmuxSession: Identifiable {
|
|
6
|
+
let id: String // session name
|
|
7
|
+
let name: String
|
|
8
|
+
let windowCount: Int
|
|
9
|
+
let attached: Bool
|
|
10
|
+
let panes: [TmuxPane]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
struct TmuxPane: Identifiable {
|
|
14
|
+
let id: String // "%0", "%1", etc.
|
|
15
|
+
let windowIndex: Int
|
|
16
|
+
let windowName: String
|
|
17
|
+
let title: String // pane_title
|
|
18
|
+
let currentCommand: String // e.g. "node", "vim", "zsh"
|
|
19
|
+
let pid: Int
|
|
20
|
+
let isActive: Bool
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// MARK: - Query
|
|
24
|
+
|
|
25
|
+
enum TmuxQuery {
|
|
26
|
+
private static let tmuxPath = "/opt/homebrew/bin/tmux"
|
|
27
|
+
|
|
28
|
+
/// List all tmux sessions with their panes in exactly 2 shell calls
|
|
29
|
+
static func listSessions() -> [TmuxSession] {
|
|
30
|
+
// Query 1: all sessions
|
|
31
|
+
let sessionsRaw = shell([
|
|
32
|
+
tmuxPath, "list-sessions", "-F",
|
|
33
|
+
"#{session_name}\t#{session_windows}\t#{session_created}\t#{session_attached}"
|
|
34
|
+
])
|
|
35
|
+
guard !sessionsRaw.isEmpty else { return [] }
|
|
36
|
+
|
|
37
|
+
// Query 2: all panes across all sessions
|
|
38
|
+
let panesRaw = shell([
|
|
39
|
+
tmuxPath, "list-panes", "-a", "-F",
|
|
40
|
+
"#{session_name}\t#{window_index}\t#{window_name}\t#{pane_id}\t#{pane_title}\t#{pane_current_command}\t#{pane_pid}\t#{pane_active}"
|
|
41
|
+
])
|
|
42
|
+
|
|
43
|
+
// Parse panes, grouped by session name
|
|
44
|
+
var panesBySession: [String: [TmuxPane]] = [:]
|
|
45
|
+
for line in panesRaw.split(separator: "\n") {
|
|
46
|
+
let cols = line.split(separator: "\t", omittingEmptySubsequences: false).map(String.init)
|
|
47
|
+
guard cols.count >= 8 else { continue }
|
|
48
|
+
let pane = TmuxPane(
|
|
49
|
+
id: cols[3],
|
|
50
|
+
windowIndex: Int(cols[1]) ?? 0,
|
|
51
|
+
windowName: cols[2],
|
|
52
|
+
title: cols[4],
|
|
53
|
+
currentCommand: cols[5],
|
|
54
|
+
pid: Int(cols[6]) ?? 0,
|
|
55
|
+
isActive: cols[7] == "1"
|
|
56
|
+
)
|
|
57
|
+
panesBySession[cols[0], default: []].append(pane)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Parse sessions
|
|
61
|
+
var sessions: [TmuxSession] = []
|
|
62
|
+
for line in sessionsRaw.split(separator: "\n") {
|
|
63
|
+
let cols = line.split(separator: "\t", omittingEmptySubsequences: false).map(String.init)
|
|
64
|
+
guard cols.count >= 4 else { continue }
|
|
65
|
+
let name = cols[0]
|
|
66
|
+
sessions.append(TmuxSession(
|
|
67
|
+
id: name,
|
|
68
|
+
name: name,
|
|
69
|
+
windowCount: Int(cols[1]) ?? 1,
|
|
70
|
+
attached: cols[3] != "0",
|
|
71
|
+
panes: panesBySession[name] ?? []
|
|
72
|
+
))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return sessions
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private static func shell(_ args: [String]) -> String {
|
|
79
|
+
ProcessQuery.shell(args)
|
|
80
|
+
}
|
|
81
|
+
}
|