native macOS codings agent orchestrator
6
fork

Configure Feed

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

Merge pull request #125 from onevcat/fix/initial-prompt-cwd

Fix initial prompt missing worktree name on first tab

authored by

khoi and committed by
GitHub
e98ee2ef d0ec4897

+32 -1
+11 -1
supacode/Infrastructure/Ghostty/GhosttySurfaceView.swift
··· 91 91 .URL, 92 92 ] 93 93 94 + static func normalizedWorkingDirectoryPath(_ path: String) -> String { 95 + var normalized = path 96 + while normalized.count > 1 && normalized.hasSuffix("/") { 97 + normalized.removeLast() 98 + } 99 + return normalized 100 + } 101 + 94 102 override var acceptsFirstResponder: Bool { true } 95 103 96 104 init( ··· 105 113 self.fontSize = fontSize ?? 0 106 114 self.context = context 107 115 if let workingDirectory { 108 - let path = workingDirectory.path(percentEncoded: false) 116 + let path = Self.normalizedWorkingDirectoryPath( 117 + workingDirectory.path(percentEncoded: false) 118 + ) 109 119 workingDirectoryCString = path.withCString { strdup($0) } 110 120 } else { 111 121 workingDirectoryCString = nil
+21
supacodeTests/GhosttySurfaceViewTests.swift
··· 1 + import Testing 2 + 3 + @testable import supacode 4 + 5 + @MainActor 6 + struct GhosttySurfaceViewTests { 7 + @Test func normalizedWorkingDirectoryPathRemovesTrailingSlashForNonRootPath() { 8 + #expect( 9 + GhosttySurfaceView.normalizedWorkingDirectoryPath("/Users/onevcat/Sync/github/supacode/") 10 + == "/Users/onevcat/Sync/github/supacode" 11 + ) 12 + #expect( 13 + GhosttySurfaceView.normalizedWorkingDirectoryPath("/Users/onevcat/Sync/github/supacode///") 14 + == "/Users/onevcat/Sync/github/supacode" 15 + ) 16 + } 17 + 18 + @Test func normalizedWorkingDirectoryPathKeepsRootPath() { 19 + #expect(GhosttySurfaceView.normalizedWorkingDirectoryPath("/") == "/") 20 + } 21 + }