@@ -26,6 +26,8 @@ import {
2626 CreateProjectRequestSchema ,
2727 ExchangePollRequestSchema ,
2828 ExchangeSubscribeRequestSchema ,
29+ GitAuthLoginRequestSchema ,
30+ GitAuthLogoutRequestSchema ,
2931 GitlabAuthLoginRequestSchema ,
3032 GitlabAuthLogoutRequestSchema ,
3133 GrokAuthLogoutRequestSchema ,
@@ -48,14 +50,17 @@ import { defaultProjectsRoot } from "@effect-template/lib/usecases/menu-helpers"
4850import { resolveWorkspaceRoot } from "@effect-template/lib/shell/workspace-root"
4951import {
5052 importCodexAuth ,
53+ loginGitAuth ,
5154 loginGitlabAuth ,
5255 loginGithubAuth ,
5356 logoutCodexAuth ,
5457 logoutGrokAuth ,
58+ logoutGitAuth ,
5559 logoutGitlabAuth ,
5660 logoutGithubAuth ,
5761 readCodexAuthStatus ,
5862 readGrokAuthStatus ,
63+ readGitAuthStatus ,
5964 readGitlabAuthStatus ,
6065 readGithubAuthStatus ,
6166} from "./services/auth.js"
@@ -450,6 +455,8 @@ const readGithubAuthLoginRequest = () => HttpServerRequest.schemaBodyJson(Github
450455const readGithubAuthLogoutRequest = ( ) => HttpServerRequest . schemaBodyJson ( GithubAuthLogoutRequestSchema )
451456const readGitlabAuthLoginRequest = ( ) => HttpServerRequest . schemaBodyJson ( GitlabAuthLoginRequestSchema )
452457const readGitlabAuthLogoutRequest = ( ) => HttpServerRequest . schemaBodyJson ( GitlabAuthLogoutRequestSchema )
458+ const readGitAuthLoginRequest = ( ) => HttpServerRequest . schemaBodyJson ( GitAuthLoginRequestSchema )
459+ const readGitAuthLogoutRequest = ( ) => HttpServerRequest . schemaBodyJson ( GitAuthLogoutRequestSchema )
453460const readAuthMenuRequest = ( ) => HttpServerRequest . schemaBodyJson ( AuthMenuRequestSchema )
454461const readAuthTerminalSessionRequest = ( ) => HttpServerRequest . schemaBodyJson ( AuthTerminalSessionRequestSchema )
455462const readCodexAuthImportRequest = ( ) => HttpServerRequest . schemaBodyJson ( CodexAuthImportRequestSchema )
@@ -1046,7 +1053,7 @@ export const makeRouter = () => {
10461053 )
10471054 )
10481055
1049- const withAuth = withCoreRoutes . pipe (
1056+ const withAuthHead = withCoreRoutes . pipe (
10501057 HttpRouter . get (
10511058 "/auth/github/status" ,
10521059 Effect . gen ( function * ( _ ) {
@@ -1061,6 +1068,13 @@ export const makeRouter = () => {
10611068 return yield * _ ( jsonResponse ( { status } , 200 ) )
10621069 } ) . pipe ( Effect . catchAll ( errorResponse ) )
10631070 ) ,
1071+ HttpRouter . get (
1072+ "/auth/git/status" ,
1073+ Effect . gen ( function * ( _ ) {
1074+ const status = yield * _ ( readGitAuthStatus ( ) )
1075+ return yield * _ ( jsonResponse ( { status } , 200 ) )
1076+ } ) . pipe ( Effect . catchAll ( errorResponse ) )
1077+ ) ,
10641078 HttpRouter . get (
10651079 "/auth/grok/status" ,
10661080 Effect . gen ( function * ( _ ) {
@@ -1121,14 +1135,35 @@ export const makeRouter = () => {
11211135 return yield * _ ( jsonResponse ( { ok : true , status } , 201 ) )
11221136 } ) . pipe ( Effect . catchAll ( errorResponse ) )
11231137 ) ,
1138+ HttpRouter . post (
1139+ "/auth/git/login" ,
1140+ Effect . gen ( function * ( _ ) {
1141+ const request = yield * _ ( readGitAuthLoginRequest ( ) )
1142+ const status = yield * _ ( loginGitAuth ( request ) )
1143+ return yield * _ ( jsonResponse ( { ok : true , status } , 201 ) )
1144+ } ) . pipe ( Effect . catchAll ( errorResponse ) )
1145+ ) ,
11241146 HttpRouter . post (
11251147 "/auth/menu" ,
11261148 Effect . gen ( function * ( _ ) {
11271149 const request = yield * _ ( readAuthMenuRequest ( ) )
11281150 const snapshot = yield * _ ( runAuthMenuFlow ( request ) )
11291151 return yield * _ ( jsonResponse ( { ok : true , snapshot } , 200 ) )
11301152 } ) . pipe ( Effect . catchAll ( errorResponse ) )
1131- ) ,
1153+ )
1154+ )
1155+
1156+ // CHANGE: split the auth router pipe into two chains
1157+ // WHY: Effect's `.pipe` overloads accept at most 20 arguments; adding the generic git routes exceeded that limit
1158+ // QUOTE(ТЗ): "реализовать возможность добавлять git подключения отличных от gitlab, github"
1159+ // REF: issue-368
1160+ // SOURCE: n/a
1161+ // FORMAT THEOREM: forall r in routes: route(withAuth) ⊇ route(withAuthHead) ∪ route(tail)
1162+ // PURITY: SHELL
1163+ // EFFECT: HttpRouter composition only
1164+ // INVARIANT: route set is preserved; only the pipe arity is reduced
1165+ // COMPLEXITY: O(1)
1166+ const withAuth = withAuthHead . pipe (
11321167 HttpRouter . post (
11331168 "/auth/terminal-sessions" ,
11341169 Effect . gen ( function * ( _ ) {
@@ -1173,6 +1208,14 @@ export const makeRouter = () => {
11731208 return yield * _ ( jsonResponse ( { ok : true , status } , 200 ) )
11741209 } ) . pipe ( Effect . catchAll ( errorResponse ) )
11751210 ) ,
1211+ HttpRouter . post (
1212+ "/auth/git/logout" ,
1213+ Effect . gen ( function * ( _ ) {
1214+ const request = yield * _ ( readGitAuthLogoutRequest ( ) )
1215+ const status = yield * _ ( logoutGitAuth ( request ) )
1216+ return yield * _ ( jsonResponse ( { ok : true , status } , 200 ) )
1217+ } ) . pipe ( Effect . catchAll ( errorResponse ) )
1218+ ) ,
11761219 HttpRouter . post (
11771220 "/auth/grok/logout" ,
11781221 Effect . gen ( function * ( _ ) {
0 commit comments