@@ -26,10 +26,12 @@ import {
2626// EFFECT: Effect<void, PlatformError, FileSystem | Path>
2727// INVARIANT: output is deterministic for a stable filesystem
2828// COMPLEXITY: O(n) where n = |projects|
29+ export type ListProjectsContext = FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor
30+
2931export const listProjects : Effect . Effect <
3032 void ,
3133 PlatformError ,
32- FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor
34+ ListProjectsContext
3335> = pipe (
3436 withProjectIndexAndSsh ( ( index , sshKey ) =>
3537 Effect . gen ( function * ( _ ) {
@@ -78,9 +80,12 @@ const emptyItems = (): ReadonlyArray<ProjectItem> => []
7880const collectProjectValues = < A , B , E > (
7981 configPaths : ReadonlyArray < string > ,
8082 sshKey : string | null ,
81- load : ( configPath : string , sshKey : string | null ) => Effect . Effect < A , E , FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor > ,
83+ load : (
84+ configPath : string ,
85+ sshKey : string | null
86+ ) => Effect . Effect < A , E , ListProjectsContext > ,
8287 toValue : ( value : A ) => B
83- ) : Effect . Effect < ReadonlyArray < B > , never , FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor > =>
88+ ) : Effect . Effect < ReadonlyArray < B > , never , ListProjectsContext > =>
8489 Effect . gen ( function * ( _ ) {
8590 const available : Array < B > = [ ]
8691
@@ -102,10 +107,17 @@ const collectProjectValues = <A, B, E>(
102107 } )
103108
104109const listProjectValues = < A , B , E > (
105- load : ( configPath : string , sshKey : string | null ) => Effect . Effect < A , E , FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor > ,
110+ load : (
111+ configPath : string ,
112+ sshKey : string | null
113+ ) => Effect . Effect < A , E , ListProjectsContext > ,
106114 toValue : ( value : A ) => B ,
107115 empty : ( ) => ReadonlyArray < B >
108- ) : Effect . Effect < ReadonlyArray < B > , PlatformError , FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor > =>
116+ ) : Effect . Effect <
117+ ReadonlyArray < B > ,
118+ PlatformError ,
119+ ListProjectsContext
120+ > =>
109121 pipe (
110122 withProjectIndexAndSsh ( ( index , sshKey ) => collectProjectValues ( index . configPaths , sshKey , load , toValue ) ) ,
111123 Effect . map ( ( values ) => values ?? empty ( ) )
@@ -114,7 +126,7 @@ const listProjectValues = <A, B, E>(
114126export const listProjectSummaries : Effect . Effect <
115127 ReadonlyArray < string > ,
116128 PlatformError ,
117- FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor
129+ ListProjectsContext
118130> = listProjectValues ( loadProjectSummary , renderProjectSummary , emptySummaries )
119131
120132// CHANGE: load docker-git projects for TUI selection
@@ -130,7 +142,7 @@ export const listProjectSummaries: Effect.Effect<
130142export const listProjectItems : Effect . Effect <
131143 ReadonlyArray < ProjectItem > ,
132144 PlatformError ,
133- FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor
145+ ListProjectsContext
134146> = listProjectValues ( loadProjectItem , ( value ) => value , emptyItems )
135147
136148// CHANGE: list only running docker-git projects (for "Stop container" UI)
@@ -146,7 +158,7 @@ export const listProjectItems: Effect.Effect<
146158export const listRunningProjectItems : Effect . Effect <
147159 ReadonlyArray < ProjectItem > ,
148160 PlatformError | CommandFailedError ,
149- FileSystem . FileSystem | Path . Path | CommandExecutor . CommandExecutor
161+ ListProjectsContext
150162> = pipe (
151163 Effect . all ( [ listProjectItems , runDockerPsNames ( process . cwd ( ) ) ] ) ,
152164 Effect . map ( ( [ items , runningNames ] ) => items . filter ( ( item ) => runningNames . includes ( item . containerName ) ) )
0 commit comments