feat(server): source control, media and discovery use GitHub's API instead of gh (#16321)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
adc3c9327a
commit
649418f01f
13 files changed
+1403
-1777
No files matched your search
@@ -36,6 +36,7 @@ import {
|
||||
ThreadId,
|
||||
} from "@t3tools/contracts";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as GitHubApi from "../sourceControl/GitHubApi.ts";
|
||||
import * as GitHubCli from "../sourceControl/GitHubCli.ts";
|
||||
import { decodeGitHubPullRequestListJson } from "../sourceControl/gitHubPullRequests.ts";
|
||||
import * as GitLabCli from "../sourceControl/GitLabCli.ts";
|
||||
@@ -383,7 +384,11 @@ function createGitHubCliWithFakeGh(scenario: FakeGhScenario = {}): {
|
||||
);
|
||||
const ghCalls: string[] = [];
|
||||
|
||||
const execute: GitHubCli.GitHubCli["Service"]["execute"] = (input) => {
|
||||
// The fake still speaks in gh's command shapes; the service methods below translate to them.
|
||||
const execute = (input: {
|
||||
readonly cwd: string;
|
||||
readonly args: ReadonlyArray<string>;
|
||||
}): Effect.Effect<VcsProcess.VcsProcessOutput, GitHubCli.GitHubCliError> => {
|
||||
const args = [...input.args];
|
||||
ghCalls.push(args.join(" "));
|
||||
|
||||
@@ -518,7 +523,6 @@ function createGitHubCliWithFakeGh(scenario: FakeGhScenario = {}): {
|
||||
|
||||
return {
|
||||
service: {
|
||||
execute,
|
||||
// The fake answers the CLI shape, so batched lookups read it the way the fallback does.
|
||||
listPullRequestsByHead: (input) =>
|
||||
execute({
|
||||
@@ -724,7 +728,12 @@ function makeManager(input?: {
|
||||
discover: Effect.succeed([]),
|
||||
}),
|
||||
),
|
||||
Effect.provide(Layer.succeed(GitHubCli.GitHubCli, gitHubCli)),
|
||||
Effect.provide(
|
||||
Layer.merge(
|
||||
Layer.succeed(GitHubCli.GitHubCli, gitHubCli),
|
||||
Layer.mock(GitHubApi.GitHubApi)({}),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -2660,8 +2669,7 @@ it.layer(layerGitManagerTest)("GitManager", (it) => {
|
||||
provider: "github",
|
||||
providerOperation: "listChangeRequests",
|
||||
providerCommand: "gh",
|
||||
errorDetail:
|
||||
"GitHub API rate limit exceeded. For the GraphQL quota and reset time, run `gh api graphql -f query='{rateLimit{remaining resetAt}}'`; `gh api rate_limit` reports REST.",
|
||||
errorDetail: "GitHub API rate limit exceeded. Requests resume when the limit resets.",
|
||||
});
|
||||
const loggedText = [
|
||||
warning?.message ?? "",
|
||||
|
||||
Reference in new issue
Block a user