@lattices/cli 0.4.14 → 0.6.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.
Files changed (181) hide show
  1. package/README.md +5 -7
  2. package/apps/mac/Info.plist +4 -4
  3. package/apps/mac/Lattices.app/Contents/Info.plist +4 -12
  4. package/apps/mac/Lattices.app/Contents/MacOS/Lattices +0 -0
  5. package/bin/lattices-app.ts +110 -17
  6. package/bin/lattices-build +125 -0
  7. package/bin/lattices-dev +89 -16
  8. package/bin/lattices.ts +977 -16
  9. package/docs/agents.md +81 -4
  10. package/docs/ai-chat-ux-review.md +416 -0
  11. package/docs/api.md +135 -3
  12. package/docs/app.md +30 -8
  13. package/docs/config.md +4 -0
  14. package/docs/mouse-gestures.md +60 -1
  15. package/docs/proposals/LAT-004-interactive-overlay-actors.md +1 -1
  16. package/docs/proposals/LAT-005-action-runtime-product-spine.md +914 -0
  17. package/docs/proposals/LAT-006-mira-in-lattices.md +553 -0
  18. package/docs/proposals/LAT-007-unified-app-shell.md +128 -0
  19. package/docs/reference/dewey.config.ts +2 -2
  20. package/docs/release.md +171 -0
  21. package/docs/repo-structure.md +5 -5
  22. package/docs/voice.md +11 -27
  23. package/package.json +11 -10
  24. package/apps/mac/Package.swift +0 -27
  25. package/apps/mac/Sources/AppShell/App.swift +0 -26
  26. package/apps/mac/Sources/AppShell/AppActivationCoordinator.swift +0 -27
  27. package/apps/mac/Sources/AppShell/AppDelegate.swift +0 -189
  28. package/apps/mac/Sources/AppShell/AppServicesBootstrap.swift +0 -25
  29. package/apps/mac/Sources/AppShell/AppShellView.swift +0 -171
  30. package/apps/mac/Sources/AppShell/AppUpdater.swift +0 -305
  31. package/apps/mac/Sources/AppShell/CliActionLauncher.swift +0 -50
  32. package/apps/mac/Sources/AppShell/HomeDashboardView.swift +0 -133
  33. package/apps/mac/Sources/AppShell/HotkeyBootstrap.swift +0 -87
  34. package/apps/mac/Sources/AppShell/KeyRecorderView.swift +0 -210
  35. package/apps/mac/Sources/AppShell/LatticesRuntime.swift +0 -104
  36. package/apps/mac/Sources/AppShell/MainView.swift +0 -847
  37. package/apps/mac/Sources/AppShell/MainWindow.swift +0 -83
  38. package/apps/mac/Sources/AppShell/MenuBarController.swift +0 -177
  39. package/apps/mac/Sources/AppShell/OnboardingView.swift +0 -483
  40. package/apps/mac/Sources/AppShell/PermissionsAssistantView.swift +0 -366
  41. package/apps/mac/Sources/AppShell/PermissionsAssistantWindow.swift +0 -70
  42. package/apps/mac/Sources/AppShell/Preferences.swift +0 -297
  43. package/apps/mac/Sources/AppShell/SettingsView.swift +0 -3163
  44. package/apps/mac/Sources/AppShell/SettingsWindow.swift +0 -34
  45. package/apps/mac/Sources/AppShell/WorkspaceInspectorPresenter.swift +0 -13
  46. package/apps/mac/Sources/Core/Actions/HotkeyManager.swift +0 -256
  47. package/apps/mac/Sources/Core/Actions/HotkeyStore.swift +0 -399
  48. package/apps/mac/Sources/Core/Actions/IntentEngine.swift +0 -988
  49. package/apps/mac/Sources/Core/Actions/IntentSchema.swift +0 -94
  50. package/apps/mac/Sources/Core/Actions/Intents/CreateLayerIntent.swift +0 -54
  51. package/apps/mac/Sources/Core/Actions/Intents/DistributeIntent.swift +0 -56
  52. package/apps/mac/Sources/Core/Actions/Intents/FocusIntent.swift +0 -69
  53. package/apps/mac/Sources/Core/Actions/Intents/HelpIntent.swift +0 -41
  54. package/apps/mac/Sources/Core/Actions/Intents/KillIntent.swift +0 -47
  55. package/apps/mac/Sources/Core/Actions/Intents/LatticeIntent.swift +0 -53
  56. package/apps/mac/Sources/Core/Actions/Intents/LaunchIntent.swift +0 -67
  57. package/apps/mac/Sources/Core/Actions/Intents/ListSessionsIntent.swift +0 -32
  58. package/apps/mac/Sources/Core/Actions/Intents/ListWindowsIntent.swift +0 -30
  59. package/apps/mac/Sources/Core/Actions/Intents/ScanIntent.swift +0 -52
  60. package/apps/mac/Sources/Core/Actions/Intents/SearchIntent.swift +0 -190
  61. package/apps/mac/Sources/Core/Actions/Intents/SwitchLayerIntent.swift +0 -50
  62. package/apps/mac/Sources/Core/Actions/Intents/TileIntent.swift +0 -61
  63. package/apps/mac/Sources/Core/Actions/PaletteCommand.swift +0 -439
  64. package/apps/mac/Sources/Core/Actions/VoiceIntentResolver.swift +0 -713
  65. package/apps/mac/Sources/Core/Companion/CompanionActivityLog.swift +0 -70
  66. package/apps/mac/Sources/Core/Companion/CompanionKeyboardController.swift +0 -141
  67. package/apps/mac/Sources/Core/Companion/LatticesCompanionBridgeServer.swift +0 -454
  68. package/apps/mac/Sources/Core/Companion/LatticesCompanionCockpit.swift +0 -555
  69. package/apps/mac/Sources/Core/Companion/LatticesCompanionSecurityCoordinator.swift +0 -629
  70. package/apps/mac/Sources/Core/Companion/LatticesCompanionTrackpadController.swift +0 -204
  71. package/apps/mac/Sources/Core/Companion/LatticesDeckHost.swift +0 -1463
  72. package/apps/mac/Sources/Core/Daemon/DaemonProtocol.swift +0 -114
  73. package/apps/mac/Sources/Core/Daemon/DaemonServer.swift +0 -427
  74. package/apps/mac/Sources/Core/Daemon/LatticesApi.swift +0 -2965
  75. package/apps/mac/Sources/Core/Desktop/AccessibilityTextExtractor.swift +0 -111
  76. package/apps/mac/Sources/Core/Desktop/AppTypeClassifier.swift +0 -106
  77. package/apps/mac/Sources/Core/Desktop/DesktopModel.swift +0 -331
  78. package/apps/mac/Sources/Core/Desktop/DesktopModelTypes.swift +0 -73
  79. package/apps/mac/Sources/Core/Desktop/InventoryManager.swift +0 -35
  80. package/apps/mac/Sources/Core/Desktop/InventoryPath.swift +0 -43
  81. package/apps/mac/Sources/Core/Desktop/MouseFinder.swift +0 -527
  82. package/apps/mac/Sources/Core/Desktop/OcrModel.swift +0 -467
  83. package/apps/mac/Sources/Core/Desktop/OcrStore.swift +0 -329
  84. package/apps/mac/Sources/Core/Desktop/PlacementSpec.swift +0 -195
  85. package/apps/mac/Sources/Core/Desktop/SessionWindowLocator.swift +0 -139
  86. package/apps/mac/Sources/Core/Desktop/TilePickerView.swift +0 -209
  87. package/apps/mac/Sources/Core/Desktop/WindowCapture.swift +0 -33
  88. package/apps/mac/Sources/Core/Desktop/WindowDragSnapController.swift +0 -429
  89. package/apps/mac/Sources/Core/Desktop/WindowPreviewCard.swift +0 -100
  90. package/apps/mac/Sources/Core/Desktop/WindowPreviewStore.swift +0 -112
  91. package/apps/mac/Sources/Core/Desktop/WindowSelectionStore.swift +0 -76
  92. package/apps/mac/Sources/Core/Desktop/WindowTiler.swift +0 -2222
  93. package/apps/mac/Sources/Core/Input/EventTapBreaker.swift +0 -124
  94. package/apps/mac/Sources/Core/Input/EventTapThread.swift +0 -54
  95. package/apps/mac/Sources/Core/Input/InputCaptureResetCenter.swift +0 -20
  96. package/apps/mac/Sources/Core/Input/KeyboardRemapConfig.swift +0 -69
  97. package/apps/mac/Sources/Core/Input/KeyboardRemapController.swift +0 -346
  98. package/apps/mac/Sources/Core/Input/KeyboardRemapStore.swift +0 -141
  99. package/apps/mac/Sources/Core/Input/MouseGestureConfig.swift +0 -499
  100. package/apps/mac/Sources/Core/Input/MouseGestureController.swift +0 -2583
  101. package/apps/mac/Sources/Core/Input/MouseInputDeviceStore.swift +0 -98
  102. package/apps/mac/Sources/Core/Input/MouseInputEventViewer.swift +0 -272
  103. package/apps/mac/Sources/Core/Input/MouseShortcutStore.swift +0 -170
  104. package/apps/mac/Sources/Core/Input/SecureEventInputMonitor.swift +0 -39
  105. package/apps/mac/Sources/Core/Input/ShapeRecognizer.swift +0 -624
  106. package/apps/mac/Sources/Core/Input/TapBudgetMeter.swift +0 -56
  107. package/apps/mac/Sources/Core/Overlays/AppWindowShell.swift +0 -63
  108. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeState.swift +0 -1566
  109. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeView.swift +0 -1927
  110. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeWindow.swift +0 -196
  111. package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteView.swift +0 -307
  112. package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteWindow.swift +0 -67
  113. package/apps/mac/Sources/Core/Overlays/HUD/CheatSheetHUD.swift +0 -576
  114. package/apps/mac/Sources/Core/Overlays/HUD/HUDBottomBar.swift +0 -279
  115. package/apps/mac/Sources/Core/Overlays/HUD/HUDController.swift +0 -1158
  116. package/apps/mac/Sources/Core/Overlays/HUD/HUDLeftBar.swift +0 -849
  117. package/apps/mac/Sources/Core/Overlays/HUD/HUDMinimap.swift +0 -179
  118. package/apps/mac/Sources/Core/Overlays/HUD/HUDRightBar.swift +0 -596
  119. package/apps/mac/Sources/Core/Overlays/HUD/HUDState.swift +0 -367
  120. package/apps/mac/Sources/Core/Overlays/HUD/HUDTopBar.swift +0 -243
  121. package/apps/mac/Sources/Core/Overlays/HUD/LauncherHUD.swift +0 -334
  122. package/apps/mac/Sources/Core/Overlays/HUD/LayerBezel.swift +0 -203
  123. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchState.swift +0 -280
  124. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchView.swift +0 -422
  125. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchWindow.swift +0 -94
  126. package/apps/mac/Sources/Core/Overlays/OverlayPanelShell.swift +0 -241
  127. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapState.swift +0 -3135
  128. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapView.swift +0 -3977
  129. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapWindowController.swift +0 -119
  130. package/apps/mac/Sources/Core/Overlays/ScreenOverlayCanvasController.swift +0 -1217
  131. package/apps/mac/Sources/Core/Overlays/Voice/VoiceCommandWindow.swift +0 -1575
  132. package/apps/mac/Sources/Core/Pi/PiAuthNextStepCard.swift +0 -148
  133. package/apps/mac/Sources/Core/Pi/PiAuthPromptCard.swift +0 -90
  134. package/apps/mac/Sources/Core/Pi/PiChatDock.swift +0 -564
  135. package/apps/mac/Sources/Core/Pi/PiChatSession.swift +0 -1948
  136. package/apps/mac/Sources/Core/Pi/PiInstallCallout.swift +0 -86
  137. package/apps/mac/Sources/Core/Pi/PiProviderSetupCallout.swift +0 -99
  138. package/apps/mac/Sources/Core/Pi/PiWorkspaceView.swift +0 -510
  139. package/apps/mac/Sources/Core/System/Capability.swift +0 -79
  140. package/apps/mac/Sources/Core/System/DiagnosticLog.swift +0 -373
  141. package/apps/mac/Sources/Core/System/EventBus.swift +0 -31
  142. package/apps/mac/Sources/Core/System/PermissionChecker.swift +0 -224
  143. package/apps/mac/Sources/Core/System/ProcessModel.swift +0 -199
  144. package/apps/mac/Sources/Core/System/ProcessQuery.swift +0 -151
  145. package/apps/mac/Sources/Core/System/SystemTelemetryMonitor.swift +0 -273
  146. package/apps/mac/Sources/Core/Voice/AdvisorLearningStore.swift +0 -90
  147. package/apps/mac/Sources/Core/Voice/AgentSession.swift +0 -377
  148. package/apps/mac/Sources/Core/Voice/AudioProvider.swift +0 -555
  149. package/apps/mac/Sources/Core/Voice/HandsOffSession.swift +0 -839
  150. package/apps/mac/Sources/Core/Voice/VoiceChatView.swift +0 -192
  151. package/apps/mac/Sources/Core/Voice/VoxClient.swift +0 -454
  152. package/apps/mac/Sources/Core/Workspace/Project.swift +0 -28
  153. package/apps/mac/Sources/Core/Workspace/ProjectScanner.swift +0 -141
  154. package/apps/mac/Sources/Core/Workspace/SessionLayerStore.swift +0 -285
  155. package/apps/mac/Sources/Core/Workspace/SessionManager.swift +0 -75
  156. package/apps/mac/Sources/Core/Workspace/Terminal/Terminal.swift +0 -259
  157. package/apps/mac/Sources/Core/Workspace/Terminal/TerminalQuery.swift +0 -156
  158. package/apps/mac/Sources/Core/Workspace/Terminal/TerminalSynthesizer.swift +0 -200
  159. package/apps/mac/Sources/Core/Workspace/Tmux/TmuxModel.swift +0 -60
  160. package/apps/mac/Sources/Core/Workspace/Tmux/TmuxQuery.swift +0 -105
  161. package/apps/mac/Sources/Core/Workspace/WorkspaceManager.swift +0 -1027
  162. package/apps/mac/Sources/UI/ActionRow.swift +0 -78
  163. package/apps/mac/Sources/UI/OrphanRow.swift +0 -129
  164. package/apps/mac/Sources/UI/ProjectRow.swift +0 -368
  165. package/apps/mac/Sources/UI/TabGroupRow.swift +0 -178
  166. package/apps/mac/Sources/UI/Theme.swift +0 -164
  167. package/apps/mac/Tests/StageDragTests.swift +0 -333
  168. package/apps/mac/Tests/StageJoinTests.swift +0 -313
  169. package/apps/mac/Tests/StageManagerTests.swift +0 -280
  170. package/apps/mac/Tests/StageTileTests.swift +0 -353
  171. package/swift/Package.swift +0 -20
  172. package/swift/Sources/DeckKit/DeckAction.swift +0 -51
  173. package/swift/Sources/DeckKit/DeckBridgeSecurity.swift +0 -152
  174. package/swift/Sources/DeckKit/DeckCockpit.swift +0 -82
  175. package/swift/Sources/DeckKit/DeckHost.swift +0 -7
  176. package/swift/Sources/DeckKit/DeckManifest.swift +0 -145
  177. package/swift/Sources/DeckKit/DeckRuntimeSnapshot.swift +0 -533
  178. package/swift/Sources/DeckKit/DeckTrackpad.swift +0 -63
  179. package/swift/Sources/DeckKit/DeckValue.swift +0 -93
  180. package/swift/Sources/DeckKit/DeckVoiceError.swift +0 -88
  181. package/swift/Tests/DeckKitTests/DeckKitTests.swift +0 -286
@@ -1,439 +0,0 @@
1
- import AppKit
2
- import Foundation
3
-
4
- struct PaletteCommand: Identifiable {
5
- let id: String
6
- let title: String
7
- let subtitle: String
8
- let icon: String
9
- let category: Category
10
- let badge: String?
11
- let action: () -> Void
12
-
13
- enum Category: String, CaseIterable {
14
- case project = "Projects"
15
- case window = "Window"
16
- case app = "App"
17
-
18
- var icon: String {
19
- switch self {
20
- case .project: return "terminal"
21
- case .window: return "macwindow"
22
- case .app: return "gearshape"
23
- }
24
- }
25
- }
26
-
27
- /// Fuzzy match score — higher is better, 0 means no match
28
- func matchScore(query: String) -> Int {
29
- let q = query.lowercased()
30
- let t = title.lowercased()
31
- let s = subtitle.lowercased()
32
-
33
- // Exact prefix match on title — best
34
- if t.hasPrefix(q) { return 100 }
35
- // Word-boundary prefix (e.g. "set" matches "Open Settings")
36
- let words = t.split(separator: " ").map(String.init)
37
- if words.contains(where: { $0.hasPrefix(q) }) { return 80 }
38
- // Contains in title
39
- if t.contains(q) { return 60 }
40
- // Subtitle prefix
41
- if s.hasPrefix(q) { return 50 }
42
- // Subtitle contains
43
- if s.contains(q) { return 40 }
44
- // Subsequence match on title
45
- if isSubsequence(q, of: t) { return 20 }
46
- return 0
47
- }
48
-
49
- private func isSubsequence(_ needle: String, of haystack: String) -> Bool {
50
- var it = haystack.makeIterator()
51
- for ch in needle {
52
- while let next = it.next() {
53
- if next == ch { break }
54
- }
55
- // If iterator is exhausted before matching all chars, not a subsequence
56
- // (handled by the while loop returning nil)
57
- }
58
- // Verify: re-check properly
59
- var hi = haystack.startIndex
60
- for ch in needle {
61
- guard let found = haystack[hi...].firstIndex(of: ch) else { return false }
62
- hi = haystack.index(after: found)
63
- }
64
- return true
65
- }
66
- }
67
-
68
- // MARK: - Command Builder
69
-
70
- enum CommandBuilder {
71
- static func build(scanner: ProjectScanner) -> [PaletteCommand] {
72
- var projectCmds: [PaletteCommand] = []
73
- var windowCmds: [PaletteCommand] = []
74
- let terminal = Preferences.shared.terminal
75
-
76
- for project in scanner.projects {
77
- if project.isRunning {
78
- // Project actions
79
- projectCmds.append(PaletteCommand(
80
- id: "attach-\(project.id)",
81
- title: "Attach \(project.name)",
82
- subtitle: "Open terminal to running session",
83
- icon: "play.fill",
84
- category: .project,
85
- badge: "running",
86
- action: { SessionManager.launch(project: project) }
87
- ))
88
- // Window actions
89
- windowCmds.append(PaletteCommand(
90
- id: "goto-\(project.id)",
91
- title: "Go to \(project.name)",
92
- subtitle: "Focus the terminal window",
93
- icon: "macwindow",
94
- category: .window,
95
- badge: nil,
96
- action: {
97
- WindowTiler.navigateToWindow(
98
- session: project.sessionName,
99
- terminal: terminal
100
- )
101
- }
102
- ))
103
- windowCmds.append(PaletteCommand(
104
- id: "tile-left-\(project.id)",
105
- title: "Tile \(project.name) Left",
106
- subtitle: "Snap window to left half",
107
- icon: "rectangle.lefthalf.filled",
108
- category: .window,
109
- badge: nil,
110
- action: {
111
- WindowTiler.tile(session: project.sessionName, terminal: terminal, to: .left)
112
- }
113
- ))
114
- windowCmds.append(PaletteCommand(
115
- id: "tile-right-\(project.id)",
116
- title: "Tile \(project.name) Right",
117
- subtitle: "Snap window to right half",
118
- icon: "rectangle.righthalf.filled",
119
- category: .window,
120
- badge: nil,
121
- action: {
122
- WindowTiler.tile(session: project.sessionName, terminal: terminal, to: .right)
123
- }
124
- ))
125
- windowCmds.append(PaletteCommand(
126
- id: "tile-max-\(project.id)",
127
- title: "Maximize \(project.name)",
128
- subtitle: "Expand window to fill screen",
129
- icon: "rectangle.fill",
130
- category: .window,
131
- badge: nil,
132
- action: {
133
- WindowTiler.tile(session: project.sessionName, terminal: terminal, to: .maximize)
134
- }
135
- ))
136
- windowCmds.append(PaletteCommand(
137
- id: "detach-\(project.id)",
138
- title: "Detach \(project.name)",
139
- subtitle: "Disconnect clients, keep session alive",
140
- icon: "eject.fill",
141
- category: .window,
142
- badge: nil,
143
- action: { SessionManager.detach(project: project) }
144
- ))
145
- windowCmds.append(PaletteCommand(
146
- id: "kill-\(project.id)",
147
- title: "Kill \(project.name)",
148
- subtitle: "Terminate the tmux session",
149
- icon: "xmark.circle.fill",
150
- category: .window,
151
- badge: nil,
152
- action: { SessionManager.kill(project: project) }
153
- ))
154
- // Recovery commands
155
- projectCmds.append(PaletteCommand(
156
- id: "sync-\(project.id)",
157
- title: "Sync \(project.name)",
158
- subtitle: "Reconcile session to declared config",
159
- icon: "arrow.triangle.2.circlepath",
160
- category: .project,
161
- badge: nil,
162
- action: { SessionManager.sync(project: project) }
163
- ))
164
- // Per-pane restart commands
165
- for paneName in project.paneNames {
166
- projectCmds.append(PaletteCommand(
167
- id: "restart-\(paneName)-\(project.id)",
168
- title: "Restart \(paneName) in \(project.name)",
169
- subtitle: "Kill and re-run the \(paneName) pane",
170
- icon: "arrow.counterclockwise",
171
- category: .project,
172
- badge: nil,
173
- action: { SessionManager.restart(project: project, paneName: paneName) }
174
- ))
175
- }
176
- } else {
177
- projectCmds.append(PaletteCommand(
178
- id: "launch-\(project.id)",
179
- title: "Launch \(project.name)",
180
- subtitle: project.paneSummary.isEmpty
181
- ? (project.devCommand ?? project.path)
182
- : project.paneSummary,
183
- icon: "play.circle",
184
- category: .project,
185
- badge: nil,
186
- action: { SessionManager.launch(project: project) }
187
- ))
188
- }
189
- }
190
-
191
- // Move-to-space commands for running projects
192
- let allSpaces = WindowTiler.getDisplaySpaces().flatMap(\.spaces)
193
- if allSpaces.count > 1 {
194
- for project in scanner.projects where project.isRunning {
195
- let tag = Terminal.windowTag(for: project.sessionName)
196
- var windowSpaces: [Int] = []
197
- if let (w, _) = WindowTiler.findWindow(tag: tag) {
198
- windowSpaces = WindowTiler.getSpacesForWindow(w)
199
- }
200
-
201
- for space in allSpaces {
202
- let isCurrentSpace = windowSpaces.contains(space.id)
203
- windowCmds.append(PaletteCommand(
204
- id: "move-space\(space.index)-\(project.id)",
205
- title: "Move \(project.name) to Space \(space.index)",
206
- subtitle: isCurrentSpace ? "Window is already here" : "Move window to Space \(space.index)",
207
- icon: "rectangle.on.rectangle",
208
- category: .window,
209
- badge: isCurrentSpace ? "current" : nil,
210
- action: {
211
- let result = WindowTiler.moveWindowToSpace(
212
- session: project.sessionName,
213
- terminal: terminal,
214
- spaceId: space.id
215
- )
216
- if case .success = result {
217
- WindowTiler.switchToSpace(spaceId: space.id)
218
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
219
- WindowTiler.highlightWindow(session: project.sessionName)
220
- }
221
- }
222
- }
223
- ))
224
- }
225
- }
226
- }
227
-
228
- var commands = projectCmds + windowCmds
229
-
230
- // Layer commands (focus + launch)
231
- let workspace = WorkspaceManager.shared
232
- if let wsConfig = workspace.config {
233
- for (i, layer) in (wsConfig.layers ?? []).enumerated() {
234
- let layerIndex = i
235
- let isActive = i == workspace.activeLayerIndex
236
- let counts = workspace.layerRunningCount(index: i)
237
- commands.append(PaletteCommand(
238
- id: "layer-focus-\(layer.id)",
239
- title: "Focus Layer: \(layer.label)",
240
- subtitle: "\(counts.running)/\(counts.total) running \u{2014} \u{2325}\(i + 1)",
241
- icon: "square.stack.3d.up",
242
- category: .app,
243
- badge: isActive ? "active" : nil,
244
- action: { workspace.tileLayer(index: layerIndex) }
245
- ))
246
- commands.append(PaletteCommand(
247
- id: "layer-launch-\(layer.id)",
248
- title: "Launch Layer: \(layer.label)",
249
- subtitle: "Start all \(layer.projects.count) project\(layer.projects.count == 1 ? "" : "s")",
250
- icon: "play.circle",
251
- category: .app,
252
- badge: isActive ? "active" : nil,
253
- action: { workspace.tileLayer(index: layerIndex, launch: true) }
254
- ))
255
- }
256
-
257
- // Tab group commands
258
- for group in wsConfig.groups ?? [] {
259
- let isRunning = workspace.isGroupRunning(group)
260
-
261
- if isRunning {
262
- commands.append(PaletteCommand(
263
- id: "group-attach-\(group.id)",
264
- title: "Attach \(group.label)",
265
- subtitle: "\(group.tabs.count) tabs",
266
- icon: "rectangle.stack",
267
- category: .project,
268
- badge: "group",
269
- action: {
270
- if let firstTab = group.tabs.first {
271
- let session = WorkspaceManager.sessionName(for: firstTab.path)
272
- let terminal = Preferences.shared.terminal
273
- terminal.focusOrAttach(session: session)
274
- }
275
- }
276
- ))
277
-
278
- // Per-tab focus commands
279
- for (idx, tab) in group.tabs.enumerated() {
280
- let tabLabel = tab.label ?? (tab.path as NSString).lastPathComponent
281
- let tabIndex = idx
282
- commands.append(PaletteCommand(
283
- id: "group-tab-\(group.id)-\(idx)",
284
- title: "\(group.label): \(tabLabel)",
285
- subtitle: "Focus tab \(idx + 1) in group",
286
- icon: "rectangle.topthird.inset.filled",
287
- category: .project,
288
- badge: nil,
289
- action: {
290
- workspace.focusTab(group: group, tabIndex: tabIndex)
291
- }
292
- ))
293
- }
294
-
295
- commands.append(PaletteCommand(
296
- id: "group-kill-\(group.id)",
297
- title: "Kill \(group.label) Group",
298
- subtitle: "Terminate the group session",
299
- icon: "xmark.circle.fill",
300
- category: .window,
301
- badge: nil,
302
- action: {
303
- workspace.killGroup(group)
304
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
305
- scanner.refreshStatus()
306
- }
307
- }
308
- ))
309
- } else {
310
- commands.append(PaletteCommand(
311
- id: "group-launch-\(group.id)",
312
- title: "Launch \(group.label)",
313
- subtitle: "\(group.tabs.count) tabs \u{2014} \(group.tabs.map { $0.label ?? ($0.path as NSString).lastPathComponent }.joined(separator: ", "))",
314
- icon: "rectangle.stack",
315
- category: .project,
316
- badge: "group",
317
- action: { workspace.launchGroup(group) }
318
- ))
319
- }
320
- }
321
- }
322
-
323
- // Orphan session commands
324
- let inventory = InventoryManager.shared
325
- for orphan in inventory.orphans {
326
- commands.append(PaletteCommand(
327
- id: "orphan-attach-\(orphan.name)",
328
- title: "Attach \(orphan.name)",
329
- subtitle: "\(orphan.panes.count) pane\(orphan.panes.count == 1 ? "" : "s") \u{2014} \(orphan.panes.prefix(3).map(\.currentCommand).joined(separator: ", "))",
330
- icon: "play.fill",
331
- category: .project,
332
- badge: "orphan",
333
- action: {
334
- let terminal = Preferences.shared.terminal
335
- terminal.focusOrAttach(session: orphan.name)
336
- }
337
- ))
338
- commands.append(PaletteCommand(
339
- id: "orphan-kill-\(orphan.name)",
340
- title: "Kill \(orphan.name)",
341
- subtitle: "Terminate unmanaged tmux session",
342
- icon: "xmark.circle.fill",
343
- category: .window,
344
- badge: "orphan",
345
- action: {
346
- SessionManager.killByName(orphan.name)
347
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
348
- inventory.refresh()
349
- }
350
- }
351
- ))
352
- }
353
-
354
- // App actions
355
- commands.append(PaletteCommand(
356
- id: "app-settings",
357
- title: "Settings",
358
- subtitle: "Terminal, scan root, mode",
359
- icon: "gearshape",
360
- category: .app,
361
- badge: nil,
362
- action: {
363
- SettingsWindowController.shared.show()
364
- }
365
- ))
366
-
367
- commands.append(PaletteCommand(
368
- id: "app-home",
369
- title: "Home",
370
- subtitle: "Open the workspace home view",
371
- icon: "house",
372
- category: .app,
373
- badge: nil,
374
- action: { ScreenMapWindowController.shared.showPage(.home) }
375
- ))
376
-
377
- commands.append(PaletteCommand(
378
- id: "app-windows-list",
379
- title: "Search",
380
- subtitle: "Browse windows, displays, spaces, and screen text",
381
- icon: "magnifyingglass",
382
- category: .app,
383
- badge: nil,
384
- action: { ScreenMapWindowController.shared.showPage(.desktopInventory) }
385
- ))
386
-
387
- commands.append(PaletteCommand(
388
- id: "app-screen-map",
389
- title: "Layout",
390
- subtitle: "Visual window editor",
391
- icon: "rectangle.3.group",
392
- category: .app,
393
- badge: nil,
394
- action: { ScreenMapWindowController.shared.showPage(.screenMap) }
395
- ))
396
-
397
- commands.append(PaletteCommand(
398
- id: "app-workspace-chat",
399
- title: "Workspace Chat",
400
- subtitle: "Open the longer-form assistant surface",
401
- icon: "bubble.left.and.bubble.right",
402
- category: .app,
403
- badge: nil,
404
- action: { ScreenMapWindowController.shared.showPage(.pi) }
405
- ))
406
-
407
- commands.append(PaletteCommand(
408
- id: "app-diagnostics",
409
- title: "Diagnostics",
410
- subtitle: "View logs and debug info",
411
- icon: "stethoscope",
412
- category: .app,
413
- badge: nil,
414
- action: { DiagnosticWindow.shared.show() }
415
- ))
416
-
417
- commands.append(PaletteCommand(
418
- id: "app-refresh",
419
- title: "Refresh Projects",
420
- subtitle: "Re-scan for .lattices.json configs",
421
- icon: "arrow.clockwise",
422
- category: .app,
423
- badge: nil,
424
- action: { scanner.scan() }
425
- ))
426
-
427
- commands.append(PaletteCommand(
428
- id: "app-quit",
429
- title: "Quit Lattices",
430
- subtitle: "Exit the menu bar app",
431
- icon: "power",
432
- category: .app,
433
- badge: nil,
434
- action: { NSApp.terminate(nil) }
435
- ))
436
-
437
- return commands
438
- }
439
- }