@@ -10,14 +10,19 @@ import * as Option from "effect/Option";
1010import * as Schema from "effect/Schema" ;
1111import { FetchHttpClient } from "effect/http" ;
1212
13- import * as GitHubPullRequestApi from "../src/pullRequest/GitHubPullRequestApi.ts" ;
14- import * as GitHubPullRequestProvider from "../src/pullRequest/GitHubPullRequestProvider.ts" ;
15- import * as GitHubApi from "../src/sourceControl/GitHubApi.ts" ;
16- import * as GitHubCredentials from "../src/sourceControl/GitHubCredentials.ts" ;
13+ import * as GitHubPullRequestApi from "@t3tools/source-control-github/server/GitHubPullRequestApi" ;
14+ import * as GitHubPullRequestProvider from "@t3tools/source-control-github/server/GitHubPullRequestProvider" ;
15+ import * as GitHubApi from "@t3tools/source-control-github/server/GitHubApi" ;
16+ import * as GitHubCredentials from "@t3tools/source-control-github/server/GitHubCredentials" ;
17+ import * as ServerConfig from "../src/config.ts" ;
1718import * as ServerSettings from "../src/serverSettings.ts" ;
18- import * as GitHubQuota from "../src/sourceControl/githubQuota.ts " ;
19+ import * as GitHubQuota from "@t3tools/source-control-github/server/GitHubQuota " ;
1920import * as SourceControlRateLimit from "@t3tools/source-control-core/server/SourceControlRateLimit" ;
21+ import * as ServerSourceControlHost from "../src/sourceControl/ServerSourceControlHost.ts" ;
22+ import * as GitVcsDriver from "../src/vcs/GitVcsDriver.ts" ;
23+ import * as VcsDriverRegistry from "../src/vcs/VcsDriverRegistry.ts" ;
2024import * as VcsProcess from "../src/vcs/VcsProcess.ts" ;
25+ import * as VcsProjectConfig from "../src/vcs/VcsProjectConfig.ts" ;
2126
2227const [ repository , ...numbers ] = process . argv . slice ( 2 ) ;
2328if ( ! repository || numbers . length === 0 || numbers . some ( ( number ) => ! / ^ \d + $ / . test ( number ) ) ) {
@@ -41,6 +46,17 @@ function withRateLimit(query: string): string {
4146 : `${ query . slice ( 0 , end ) } \n rateLimit { cost }\n${ query . slice ( end ) } ` ;
4247}
4348
49+ // The server's host port over default settings: gh's own account choice, no saved token.
50+ const sourceControlHost = ServerSourceControlHost . layer . pipe (
51+ Layer . provide ( VcsDriverRegistry . layer . pipe ( Layer . provide ( VcsProjectConfig . layer ) ) ) ,
52+ Layer . provide ( GitVcsDriver . layer ) ,
53+ Layer . provide ( ServerSettings . layerTest ( ) ) ,
54+ // A scratch state directory, so nothing here touches a real T3 home.
55+ Layer . provide ( ServerConfig . layerTest ( process . cwd ( ) , { prefix : "t3-measure-pr-preview-" } ) ) ,
56+ Layer . provideMerge ( VcsProcess . layer ) ,
57+ Layer . provideMerge ( NodeServices . layer ) ,
58+ ) ;
59+
4460const measuredApi = Layer . effect (
4561 GitHubApi . GitHubApi ,
4662 Effect . gen ( function * ( ) {
@@ -73,18 +89,15 @@ const measuredApi = Layer.effect(
7389 } ) ;
7490 } ) ,
7591) . pipe (
76- Layer . provide ( GitHubCredentials . layer . pipe ( Layer . provide ( ServerSettings . layerTest ( ) ) ) ) ,
92+ Layer . provide ( GitHubCredentials . layer ) ,
7793 Layer . provide ( GitHubQuota . layer ) ,
7894 Layer . provide ( SourceControlRateLimit . layer ) ,
7995 Layer . provide ( FetchHttpClient . layer ) ,
80- Layer . provide ( VcsProcess . layer ) ,
81- Layer . provide ( NodeServices . layer ) ,
8296) ;
8397
8498const services = GitHubPullRequestApi . layer . pipe (
8599 Layer . provideMerge ( measuredApi ) ,
86- Layer . provideMerge ( VcsProcess . layer ) ,
87- Layer . provideMerge ( NodeServices . layer ) ,
100+ Layer . provideMerge ( sourceControlHost ) ,
88101) ;
89102
90103const encodeJson = Schema . encodeSync ( Schema . fromJsonString ( Schema . Unknown ) ) ;
0 commit comments