native macOS codings agent orchestrator
6
fork

Configure Feed

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

Add reducer action logging

- Debug: prints action labels to console
- Release: logs action labels as Sentry breadcrumbs

khoi e0857047 91540b4a

+27
+9
supacode/App/supacodeApp.swift
··· 66 66 initialState: AppFeature.State(settings: SettingsFeature.State(settings: initialSettings)) 67 67 ) { 68 68 AppFeature() 69 + .logActions { action in 70 + #if DEBUG 71 + print("Action: \(action)") 72 + #else 73 + let breadcrumb = Breadcrumb(level: .debug, category: "action") 74 + breadcrumb.message = action 75 + SentrySDK.addBreadcrumb(breadcrumb) 76 + #endif 77 + } 69 78 } withDependencies: { values in 70 79 values.terminalClient = TerminalClient( 71 80 send: { command in
+18
supacode/Support/DebugCaseOutput.swift
··· 1 1 import Foundation 2 + import ComposableArchitecture 3 + 4 + extension Reducer { 5 + @ReducerBuilder<State, Action> 6 + func logActions(_ log: @escaping (String) -> Void) -> some Reducer<State, Action> { 7 + LogActionsReducer(base: self, log: log) 8 + } 9 + } 10 + 11 + struct LogActionsReducer<Base: Reducer>: Reducer { 12 + let base: Base 13 + let log: (String) -> Void 14 + 15 + func reduce(into state: inout Base.State, action: Base.Action) -> Effect<Base.Action> { 16 + log(debugCaseOutput(action)) 17 + return base.reduce(into: &state, action: action) 18 + } 19 + } 2 20 3 21 func debugCaseOutput( 4 22 _ value: Any,