native macOS codings agent orchestrator
6
fork

Configure Feed

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

Merge pull request #193 from supabitapp/check-graphql-logging

Disable GraphQL shell logging

authored by

khoi and committed by
GitHub
5620f647 f96924a3

+31 -19
+2 -1
supacode/Clients/Github/GithubCLIClient.swift
··· 257 257 let env = URL(fileURLWithPath: "/usr/bin/env") 258 258 let command = ([env.path(percentEncoded: false)] + ["gh"] + arguments).joined(separator: " ") 259 259 do { 260 - return try await shell.runLogin(env, ["gh"] + arguments, repoRoot).stdout 260 + let shouldLog = !arguments.contains("graphql") 261 + return try await shell.runLogin(env, ["gh"] + arguments, repoRoot, log: shouldLog).stdout 261 262 } catch { 262 263 if let shellError = error as? ShellClientError { 263 264 let message = shellError.errorDescription ?? "Command failed: \(command)"
+17 -6
supacode/Clients/Shell/ShellClient.swift
··· 4 4 5 5 nonisolated struct ShellClient { 6 6 var run: @Sendable (URL, [String], URL?) async throws -> ShellOutput 7 - var runLogin: @Sendable (URL, [String], URL?) async throws -> ShellOutput 7 + var _runLogin: @Sendable (URL, [String], URL?, Bool) async throws -> ShellOutput 8 + 9 + func runLogin( 10 + _ executableURL: URL, 11 + _ arguments: [String], 12 + _ currentDirectoryURL: URL?, 13 + log: Bool = true 14 + ) async throws -> ShellOutput { 15 + try await _runLogin(executableURL, arguments, currentDirectoryURL, log) 16 + } 8 17 } 9 18 10 19 extension ShellClient: DependencyKey { ··· 16 25 currentDirectoryURL: currentDirectoryURL 17 26 ) 18 27 }, 19 - runLogin: { executableURL, arguments, currentDirectoryURL in 28 + _runLogin: { executableURL, arguments, currentDirectoryURL, log in 20 29 let shellURL = URL(fileURLWithPath: defaultShellPath()) 21 30 let execCommand = shellExecCommand(for: shellURL) 22 31 let shellArguments = 23 32 ["-l", "-c", execCommand, "--", executableURL.path(percentEncoded: false)] + arguments 24 - print( 25 - "[Shell] runLogin\n\tcwd: \(currentDirectoryURL?.path(percentEncoded: false) ?? "nil")\n\tcmd: \(shellURL.path) \(shellArguments.joined(separator: " "))" 26 - ) 33 + if log { 34 + print( 35 + "[Shell] runLogin\n\tcwd: \(currentDirectoryURL?.path(percentEncoded: false) ?? "nil")\n\tcmd: \(shellURL.path) \(shellArguments.joined(separator: " "))" 36 + ) 37 + } 27 38 let result = try await runProcess( 28 39 executableURL: shellURL, 29 40 arguments: shellArguments, ··· 35 46 36 47 static let testValue = ShellClient( 37 48 run: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) }, 38 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 49 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 39 50 ) 40 51 } 41 52
+7 -7
supacodeTests/GitClientBranchRefsTests.swift
··· 24 24 await store.record(arguments) 25 25 return ShellOutput(stdout: output, stderr: "", exitCode: 0) 26 26 }, 27 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 27 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 28 28 ) 29 29 let client = GitClient(shell: shell) 30 30 let repoRoot = URL(fileURLWithPath: "/tmp/repo") ··· 50 50 """ 51 51 let shell = ShellClient( 52 52 run: { _, _, _ in ShellOutput(stdout: output, stderr: "", exitCode: 0) }, 53 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 53 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 54 54 ) 55 55 let client = GitClient(shell: shell) 56 56 let repoRoot = URL(fileURLWithPath: "/tmp/repo") ··· 65 65 run: { _, _, _ in 66 66 ShellOutput(stdout: "refs/remotes/origin/develop\n", stderr: "", exitCode: 0) 67 67 }, 68 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 68 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 69 69 ) 70 70 let client = GitClient(shell: shell) 71 71 ··· 79 79 run: { _, _, _ in 80 80 throw ShellClientError(command: "git", stdout: "", stderr: "boom", exitCode: 1) 81 81 }, 82 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 82 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 83 83 ) 84 84 let client = GitClient(shell: shell) 85 85 ··· 99 99 } 100 100 return ShellOutput(stdout: "", stderr: "", exitCode: 0) 101 101 }, 102 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 102 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 103 103 ) 104 104 let client = GitClient(shell: shell) 105 105 ··· 119 119 } 120 120 return ShellOutput(stdout: "", stderr: "", exitCode: 0) 121 121 }, 122 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 122 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 123 123 ) 124 124 let client = GitClient(shell: shell) 125 125 ··· 136 136 } 137 137 return ShellOutput(stdout: "", stderr: "", exitCode: 0) 138 138 }, 139 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 139 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 140 140 ) 141 141 let client = GitClient(shell: shell) 142 142
+5 -5
supacodeTests/GitClientLineChangesTests.swift
··· 20 20 await store.record(arguments) 21 21 return ShellOutput(stdout: output, stderr: "", exitCode: 0) 22 22 }, 23 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 23 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 24 24 ) 25 25 let client = GitClient(shell: shell) 26 26 ··· 42 42 let output = " 1 file changed, 5 insertions(+)\n" 43 43 let shell = ShellClient( 44 44 run: { _, _, _ in ShellOutput(stdout: output, stderr: "", exitCode: 0) }, 45 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 45 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 46 46 ) 47 47 let client = GitClient(shell: shell) 48 48 ··· 56 56 let output = "1 file changed, 10 insertions(+), 4 deletions(-)\n" 57 57 let shell = ShellClient( 58 58 run: { _, _, _ in ShellOutput(stdout: output, stderr: "", exitCode: 0) }, 59 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 59 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 60 60 ) 61 61 let client = GitClient(shell: shell) 62 62 ··· 69 69 @Test func lineChangesHandlesEmptyOutput() async { 70 70 let shell = ShellClient( 71 71 run: { _, _, _ in ShellOutput(stdout: "\n", stderr: "", exitCode: 0) }, 72 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 72 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 73 73 ) 74 74 let client = GitClient(shell: shell) 75 75 ··· 95 95 await store.record(arguments) 96 96 return ShellOutput(stdout: "", stderr: "", exitCode: 0) 97 97 }, 98 - runLogin: { _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 98 + _runLogin: { _, _, _, _ in ShellOutput(stdout: "", stderr: "", exitCode: 0) } 99 99 ) 100 100 let client = GitClient(shell: shell) 101 101