Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

[codex] Align GitHub source control adapter errors (#2476)

Julius Marminge350d76ee1410
diff --git a/apps/server/src/git/GitManager.test.ts b/apps/server/src/git/GitManager.test.ts
index 2d95c5219..cf04296ea 100644
--- a/apps/server/src/git/GitManager.test.ts
+++ b/apps/server/src/git/GitManager.test.ts
@@ -14,9 +14,10 @@ import type {
ThreadId,
} from "@t3tools/contracts";
-import { GitCommandError, GitHubCliError, TextGenerationError } from "@t3tools/contracts";
+import { GitCommandError, TextGenerationError } from "@t3tools/contracts";
import { type GitManagerShape } from "./GitManager.ts";
import {
+ GitHubCliError,
type GitHubCliShape,
type GitHubPullRequestSummary,
GitHubCli,
diff --git a/apps/server/src/sourceControl/GitHubCli.ts b/apps/server/src/sourceControl/GitHubCli.ts
index bb90aeba0..9dcf0ffec 100644
--- a/apps/server/src/sourceControl/GitHubCli.ts
+++ b/apps/server/src/sourceControl/GitHubCli.ts
@@ -1,16 +1,26 @@
import { Context, Effect, Layer, Result, Schema, SchemaIssue } from "effect";
-import { GitHubCliError, TrimmedNonEmptyString, type VcsError } from "@t3tools/contracts";
+import { TrimmedNonEmptyString, type VcsError } from "@t3tools/contracts";
import { VcsProcess, type VcsProcessOutput } from "../vcs/VcsProcess.ts";
import {
decodeGitHubPullRequestJson,
decodeGitHubPullRequestListJson,
formatGitHubJsonDecodeError,
-} from "../git/githubPullRequests.ts";
+} from "./gitHubPullRequests.ts";
const DEFAULT_TIMEOUT_MS = 30_000;
+export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("GitHubCliError", {
+ operation: Schema.String,
+ detail: Schema.String,
+ cause: Schema.optional(Schema.Defect),
+}) {
+ override get message(): string {
+ return `GitHub CLI failed in ${this.operation}: ${this.detail}`;
+ }
+}
+
export interface GitHubPullRequestSummary {
readonly number: number;
readonly title: string;
diff --git a/apps/server/src/sourceControl/GitHubSourceControlProvider.ts b/apps/server/src/sourceControl/GitHubSourceControlProvider.ts
index 3bdccbf97..916db45fd 100644
--- a/apps/server/src/sourceControl/GitHubSourceControlProvider.ts
+++ b/apps/server/src/sourceControl/GitHubSourceControlProvider.ts
@@ -3,11 +3,10 @@ import {
SourceControlProviderError,
type ChangeRequest,
type ChangeRequestState,
- type GitHubCliError,
} from "@t3tools/contracts";
-import { GitHubCli, type GitHubPullRequestSummary } from "./GitHubCli.ts";
-import { decodeGitHubPullRequestListJson } from "../git/githubPullRequests.ts";
+import { GitHubCli, type GitHubCliError, type GitHubPullRequestSummary } from "./GitHubCli.ts";
+import { decodeGitHubPullRequestListJson } from "./gitHubPullRequests.ts";
import { SourceControlProvider, type SourceControlProviderShape } from "./SourceControlProvider.ts";
function providerError(operation: string, cause: GitHubCliError): SourceControlProviderError {
diff --git a/apps/server/src/git/githubPullRequests.ts b/apps/server/src/sourceControl/gitHubPullRequests.ts
similarity index 100%
rename from apps/server/src/git/githubPullRequests.ts
rename to apps/server/src/sourceControl/gitHubPullRequests.ts
diff --git a/packages/contracts/src/git.ts b/packages/contracts/src/git.ts
index dd12e749d..cf3bfe93e 100644
--- a/packages/contracts/src/git.ts
+++ b/packages/contracts/src/git.ts
@@ -328,16 +328,6 @@ export class GitCommandError extends Schema.TaggedErrorClass<GitCommandError>()(
}
}
-export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("GitHubCliError", {
- operation: Schema.String,
- detail: Schema.String,
- cause: Schema.optional(Schema.Defect),
-}) {
- override get message(): string {
- return `GitHub CLI failed in ${this.operation}: ${this.detail}`;
- }
-}
-
export class TextGenerationError extends Schema.TaggedErrorClass<TextGenerationError>()(
"TextGenerationError",
{
@@ -364,7 +354,6 @@ export class GitManagerError extends Schema.TaggedErrorClass<GitManagerError>()(
export const GitManagerServiceError = Schema.Union([
GitManagerError,
GitCommandError,
- GitHubCliError,
SourceControlProviderError,
TextGenerationError,
]);