native macOS codings agent orchestrator
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(cli): inside-root now creates tab at subpath

- Add createTabAtPath action to OpenCommandHandler so that inside-root
resolution actually opens a new terminal tab cd'd to the requested
subpath, not just selects the parent worktree
- Wire createTabAtPath in supacodeApp via terminalManager.handleCommand
(.createTabWithInput) to create a real tab at the exact directory
- Update inside-root test to verify createTabAtPath is called with the
correct worktreeID and subpath
- Addresses second round of review feedback from @jarvis-elevated:
inside-root must execute the behavior the contract promises, not just
classify correctly

Note: app_launched remains false because the CLI socket server only
exists when the app is already running. Auto-launch from CLI is a
separate follow-up (requires CLIRunner changes).

Friday 80f44742 d3f15e22

+23 -2
+1
supacode/App/supacodeApp.swift
··· 343 343 appStore.send(.repositories(.repositoryManagement(.openRepositories([url])))) 344 344 }, 345 345 createTabAtPath: { worktreeID, path in 346 + // Find the Worktree object by ID to create a tab cd'd to the subpath. 346 347 let repositories = appStore.state.repositories 347 348 for repository in repositories.repositories { 348 349 if let worktree = repository.worktrees.first(where: { $0.id == worktreeID }) {
+10
supacode/CLIService/OpenCommandHandler.swift
··· 104 104 typealias Resolver = @MainActor (String?) -> OpenResolverResult 105 105 typealias SelectAction = @MainActor (String) -> Void 106 106 typealias AddAndOpenAction = @MainActor (URL) -> Void 107 + /// Creates a new tab in the given worktree and `cd`s to the specified path. 108 + /// Parameters: worktreeID, absolutePath. 109 + typealias CreateTabAtPathAction = @MainActor (String, String) -> Void 107 110 typealias TerminalSnapshotProvider = @MainActor (String) -> OpenTerminalSnapshot? 108 111 109 112 private let resolver: Resolver 110 113 private let selectWorktree: SelectAction 111 114 private let addAndOpen: AddAndOpenAction 115 + private let createTabAtPath: CreateTabAtPathAction 112 116 private let terminalSnapshot: TerminalSnapshotProvider 113 117 114 118 init( 115 119 resolver: @escaping Resolver, 116 120 selectWorktree: @escaping SelectAction, 117 121 addAndOpen: @escaping AddAndOpenAction, 122 + createTabAtPath: @escaping CreateTabAtPathAction = { _, _ in }, 118 123 terminalSnapshot: @escaping TerminalSnapshotProvider 119 124 ) { 120 125 self.resolver = resolver 121 126 self.selectWorktree = selectWorktree 122 127 self.addAndOpen = addAndOpen 128 + self.createTabAtPath = createTabAtPath 123 129 self.terminalSnapshot = terminalSnapshot 124 130 } 125 131 ··· 167 173 case .insideRoot: 168 174 if let worktreeID = result.worktreeID { 169 175 selectWorktree(worktreeID) 176 + // Open a new tab cd'd to the exact requested subpath. 177 + if let subpath = result.resolvedPath ?? input.path { 178 + createTabAtPath(worktreeID, subpath) 179 + } 170 180 } 171 181 bringAppToFront() 172 182 let snapshot = result.worktreeID.flatMap { terminalSnapshot($0) }
+12 -2
supacodeTests/OpenCommandHandlerTests.swift
··· 19 19 }, 20 20 selectWorktree: @escaping OpenCommandHandler.SelectAction = { _ in }, 21 21 addAndOpen: @escaping OpenCommandHandler.AddAndOpenAction = { _ in }, 22 + createTabAtPath: @escaping OpenCommandHandler.CreateTabAtPathAction = { _, _ in }, 22 23 terminalSnapshot: @escaping OpenCommandHandler.TerminalSnapshotProvider = { _ in nil } 23 24 ) -> OpenCommandHandler { 24 25 OpenCommandHandler( 25 26 resolver: resolver, 26 27 selectWorktree: selectWorktree, 27 28 addAndOpen: addAndOpen, 29 + createTabAtPath: createTabAtPath, 28 30 terminalSnapshot: terminalSnapshot 29 31 ) 30 32 } ··· 112 114 // MARK: - Inside root 113 115 114 116 @MainActor 115 - @Test func openInsideRootResolvesToParentWorktree() async throws { 117 + @Test func openInsideRootSelectsWorktreeAndCreatesTab() async throws { 116 118 var selectedID: String? 119 + var tabCreatedForWorktree: String? 120 + var tabCreatedAtPath: String? 117 121 118 122 let handler = makeHandler( 119 123 resolver: { _ in ··· 127 131 resolvedPath: "/Users/test/Projects/Prowl/supacode" 128 132 ) 129 133 }, 130 - selectWorktree: { id in selectedID = id } 134 + selectWorktree: { id in selectedID = id }, 135 + createTabAtPath: { worktreeID, path in 136 + tabCreatedForWorktree = worktreeID 137 + tabCreatedAtPath = path 138 + } 131 139 ) 132 140 133 141 let envelope = CommandEnvelope( ··· 138 146 139 147 #expect(response.ok == true) 140 148 #expect(selectedID == "Prowl:/Users/test/Projects/Prowl") 149 + #expect(tabCreatedForWorktree == "Prowl:/Users/test/Projects/Prowl") 150 + #expect(tabCreatedAtPath == "/Users/test/Projects/Prowl/supacode") 141 151 142 152 let data = try #require(response.data) 143 153 let payload = try data.decode(as: OpenCommandData.self)