Showing the changes to apps/server/src/git (15 of 116 files). Show all
Unified · Split
| @@ -1,67 +0,0 @@ | ||
| 1 | −import { Schema } from "effect"; | |
| 2 | − | |
| 3 | −/** | |
| 4 | − * GitCommandError - Git command execution failed. | |
| 5 | − */ | |
| 6 | −export class GitCommandError extends Schema.TaggedErrorClass<GitCommandError>()("GitCommandError", { | |
| 7 | − operation: Schema.String, | |
| 8 | − command: Schema.String, | |
| 9 | − cwd: Schema.String, | |
| 10 | − detail: Schema.String, | |
| 11 | − cause: Schema.optional(Schema.Defect), | |
| 12 | −}) { | |
| 13 | − override get message(): string { | |
| 14 | − return `Git command failed in ${this.operation}: ${this.command} (${this.cwd}) - ${this.detail}`; | |
| 15 | − } | |
| 16 | −} | |
| 17 | − | |
| 18 | −/** | |
| 19 | − * GitHubCliError - GitHub CLI execution or authentication failed. | |
| 20 | − */ | |
| 21 | −export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("GitHubCliError", { | |
| 22 | − operation: Schema.String, | |
| 23 | − detail: Schema.String, | |
| 24 | − cause: Schema.optional(Schema.Defect), | |
| 25 | −}) { | |
| 26 | − override get message(): string { | |
| 27 | − return `GitHub CLI failed in ${this.operation}: ${this.detail}`; | |
| 28 | − } | |
| 29 | −} | |
| 30 | − | |
| 31 | −/** | |
| 32 | − * TextGenerationError - Commit or PR text generation failed. | |
| 33 | − */ | |
| 34 | −export class TextGenerationError extends Schema.TaggedErrorClass<TextGenerationError>()( | |
| 35 | − "TextGenerationError", | |
| 36 | − { | |
| 37 | − operation: Schema.String, | |
| 38 | − detail: Schema.String, | |
| 39 | − cause: Schema.optional(Schema.Defect), | |
| 40 | − }, | |
| 41 | −) { | |
| 42 | − override get message(): string { | |
| 43 | − return `Text generation failed in ${this.operation}: ${this.detail}`; | |
| 44 | − } | |
| 45 | −} | |
| 46 | − | |
| 47 | −/** | |
| 48 | − * GitManagerError - Stacked Git workflow orchestration failed. | |
| 49 | − */ | |
| 50 | −export class GitManagerError extends Schema.TaggedErrorClass<GitManagerError>()("GitManagerError", { | |
| 51 | − operation: Schema.String, | |
| 52 | − detail: Schema.String, | |
| 53 | − cause: Schema.optional(Schema.Defect), | |
| 54 | −}) { | |
| 55 | − override get message(): string { | |
| 56 | − return `Git manager failed in ${this.operation}: ${this.detail}`; | |
| 57 | − } | |
| 58 | −} | |
| 59 | − | |
| 60 | −/** | |
| 61 | − * GitManagerServiceError - Errors emitted by stacked Git workflow orchestration. | |
| 62 | − */ | |
| 63 | −export type GitManagerServiceError = | |
| 64 | − | GitManagerError | |
| 65 | − | GitCommandError | |
| 66 | − | GitHubCliError | |
| 67 | − | TextGenerationError; | |
| @@ -14,7 +14,7 @@ import { ClaudeModelSelection } from "@t3tools/contracts"; · 13 unmodified lines | ||
| 14 | 14 | import { resolveApiModelId } from "@t3tools/shared/model"; |
| 15 | 15 | import { sanitizeBranchFragment, sanitizeFeatureBranchName } from "@t3tools/shared/git"; |
| 16 | 16 | |
| 17 | −import { TextGenerationError } from "../Errors.ts"; | |
| 17 | +import { TextGenerationError } from "@t3tools/contracts"; | |
| 18 | 18 | import { type TextGenerationShape, TextGeneration } from "../Services/TextGeneration.ts"; |
| 19 | 19 | import { |
| 20 | 20 | buildBranchNamePrompt, |
| @@ -5,7 +5,7 @@ import { expect } from "vitest"; · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | import { ServerConfig } from "../../config.ts"; |
| 7 | 7 | import { CodexTextGenerationLive } from "./CodexTextGeneration.ts"; |
| 8 | −import { TextGenerationError } from "../Errors.ts"; | |
| 8 | +import { TextGenerationError } from "@t3tools/contracts"; | |
| 9 | 9 | import { TextGeneration } from "../Services/TextGeneration.ts"; |
| 10 | 10 | import { ServerSettingsService } from "../../serverSettings.ts"; |
| 11 | 11 | |
| @@ -8,7 +8,7 @@ import { sanitizeBranchFragment, sanitizeFeatureBranchName } from "@t3tools/shar · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | import { resolveAttachmentPath } from "../../attachmentStore.ts"; |
| 10 | 10 | import { ServerConfig } from "../../config.ts"; |
| 11 | −import { TextGenerationError } from "../Errors.ts"; | |
| 11 | +import { TextGenerationError } from "@t3tools/contracts"; | |
| 12 | 12 | import { |
| 13 | 13 | type BranchNameGenerationInput, |
| 14 | 14 | type ThreadTitleGenerationResult, |
| @@ -8,7 +8,7 @@ import { describe, expect, vi } from "vitest"; · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | import { GitCoreLive, makeGitCore } from "./GitCore.ts"; |
| 10 | 10 | import { GitCore, type GitCoreShape } from "../Services/GitCore.ts"; |
| 11 | −import { GitCommandError } from "../Errors.ts"; | |
| 11 | +import { GitCommandError } from "@t3tools/contracts"; | |
| 12 | 12 | import { type ProcessRunResult, runProcess } from "../../processRunner.ts"; |
| 13 | 13 | import { ServerConfig } from "../../config.ts"; |
| 14 | 14 | |
| @@ -18,7 +18,7 @@ import { · 17 unmodified lines | ||
| 18 | 18 | } from "effect"; |
| 19 | 19 | import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"; |
| 20 | 20 | |
| 21 | −import { GitCommandError } from "../Errors.ts"; | |
| 21 | +import { GitCommandError } from "@t3tools/contracts"; | |
| 22 | 22 | import { |
| 23 | 23 | GitCore, |
| 24 | 24 | type ExecuteGitProgress, |
| @@ -1941,8 +1941,9 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: { · 1916 unmodified lines | ||
| 1941 | 1941 | }); |
| 1942 | 1942 | |
| 1943 | 1943 | // Refresh upstream refs in the background so checkout remains responsive. |
| 1944 | − yield* Effect.forkScoped( | |
| 1945 | − refreshCheckedOutBranchUpstream(input.cwd).pipe(Effect.ignoreCause({ log: true })), | |
| 1944 | + yield* refreshCheckedOutBranchUpstream(input.cwd).pipe( | |
| 1945 | + Effect.ignoreCause({ log: true }), | |
| 1946 | + Effect.forkDetach({ startImmediately: true }), | |
| 1946 | 1947 | ); |
| 1947 | 1948 | }, |
| 1948 | 1949 | ); |
| @@ -2,7 +2,7 @@ import { Effect, Layer, Schema } from "effect"; · 1 unmodified line | ||
| 2 | 2 | import { PositiveInt, TrimmedNonEmptyString } from "@t3tools/contracts"; |
| 3 | 3 | |
| 4 | 4 | import { runProcess } from "../../processRunner"; |
| 5 | −import { GitHubCliError } from "../Errors.ts"; | |
| 5 | +import { GitHubCliError } from "@t3tools/contracts"; | |
| 6 | 6 | import { |
| 7 | 7 | GitHubCli, |
| 8 | 8 | type GitHubRepositoryCloneUrls, |
| @@ -8,7 +8,7 @@ import { Effect, FileSystem, Layer, PlatformError, Scope } from "effect"; · 7 unmodified lines | ||
| 8 | 8 | import { expect } from "vitest"; |
| 9 | 9 | import type { GitActionProgressEvent, ModelSelection } from "@t3tools/contracts"; |
| 10 | 10 | |
| 11 | −import { GitCommandError, GitHubCliError, TextGenerationError } from "../Errors.ts"; | |
| 11 | +import { GitCommandError, GitHubCliError, TextGenerationError } from "@t3tools/contracts"; | |
| 12 | 12 | import { type GitManagerShape } from "../Services/GitManager.ts"; |
| 13 | 13 | import { |
| 14 | 14 | type GitHubCliShape, |
| @@ -14,7 +14,7 @@ import { · 13 unmodified lines | ||
| 14 | 14 | sanitizeFeatureBranchName, |
| 15 | 15 | } from "@t3tools/shared/git"; |
| 16 | 16 | |
| 17 | −import { GitManagerError } from "../Errors.ts"; | |
| 17 | +import { GitManagerError } from "@t3tools/contracts"; | |
| 18 | 18 | import { |
| 19 | 19 | GitManager, |
| 20 | 20 | type GitActionProgressReporter, |
| @@ -25,7 +25,7 @@ import { GitCore } from "../Services/GitCore.ts"; · 4 unmodified lines | ||
| 25 | 25 | import { GitHubCli } from "../Services/GitHubCli.ts"; |
| 26 | 26 | import { TextGeneration } from "../Services/TextGeneration.ts"; |
| 27 | 27 | import { ServerSettingsService } from "../../serverSettings.ts"; |
| 28 | −import type { GitManagerServiceError } from "../Errors.ts"; | |
| 28 | +import type { GitManagerServiceError } from "@t3tools/contracts"; | |
| 29 | 29 | |
| 30 | 30 | const COMMIT_TIMEOUT_MS = 10 * 60_000; |
| 31 | 31 | const MAX_PROGRESS_TEXT_LENGTH = 500; |
| @@ -7,7 +7,7 @@ import { · 6 unmodified lines | ||
| 7 | 7 | buildThreadTitlePrompt, |
| 8 | 8 | } from "./Prompts.ts"; |
| 9 | 9 | import { normalizeCliError, sanitizeThreadTitle } from "./Utils.ts"; |
| 10 | −import { TextGenerationError } from "./Errors.ts"; | |
| 10 | +import { TextGenerationError } from "@t3tools/contracts"; | |
| 11 | 11 | |
| 12 | 12 | describe("buildCommitMessagePrompt", () => { |
| 13 | 13 | it("includes staged patch and summary in the prompt", () => { |
| @@ -22,7 +22,7 @@ import type { · 21 unmodified lines | ||
| 22 | 22 | GitStatusResult, |
| 23 | 23 | } from "@t3tools/contracts"; |
| 24 | 24 | |
| 25 | −import type { GitCommandError } from "../Errors.ts"; | |
| 25 | +import type { GitCommandError } from "@t3tools/contracts"; | |
| 26 | 26 | |
| 27 | 27 | export interface ExecuteGitInput { |
| 28 | 28 | readonly operation: string; |
| @@ -9,7 +9,7 @@ import { ServiceMap } from "effect"; · 8 unmodified lines | ||
| 9 | 9 | import type { Effect } from "effect"; |
| 10 | 10 | |
| 11 | 11 | import type { ProcessRunResult } from "../../processRunner"; |
| 12 | −import type { GitHubCliError } from "../Errors.ts"; | |
| 12 | +import type { GitHubCliError } from "@t3tools/contracts"; | |
| 13 | 13 | |
| 14 | 14 | export interface GitHubPullRequestSummary { |
| 15 | 15 | readonly number: number; |
| @@ -19,7 +19,7 @@ import { · 18 unmodified lines | ||
| 19 | 19 | } from "@t3tools/contracts"; |
| 20 | 20 | import { ServiceMap } from "effect"; |
| 21 | 21 | import type { Effect } from "effect"; |
| 22 | −import type { GitManagerServiceError } from "../Errors.ts"; | |
| 22 | +import type { GitManagerServiceError } from "@t3tools/contracts"; | |
| 23 | 23 | |
| 24 | 24 | export interface GitActionProgressReporter { |
| 25 | 25 | readonly publish: (event: GitActionProgressEvent) => Effect.Effect<void, never>; |
| @@ -10,7 +10,7 @@ import { ServiceMap } from "effect"; · 9 unmodified lines | ||
| 10 | 10 | import type { Effect } from "effect"; |
| 11 | 11 | import type { ChatAttachment, ModelSelection } from "@t3tools/contracts"; |
| 12 | 12 | |
| 13 | −import type { TextGenerationError } from "../Errors.ts"; | |
| 13 | +import type { TextGenerationError } from "@t3tools/contracts"; | |
| 14 | 14 | |
| 15 | 15 | /** Providers that support git text generation (commit messages, PR content, branch names). */ |
| 16 | 16 | export type TextGenerationProvider = "codex" | "claudeAgent"; |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | */ |
| 6 | 6 | import { Schema } from "effect"; |
| 7 | 7 | |
| 8 | −import { TextGenerationError } from "./Errors.ts"; | |
| 8 | +import { TextGenerationError } from "@t3tools/contracts"; | |
| 9 | 9 | |
| 10 | 10 | import { existsSync } from "node:fs"; |
| 11 | 11 | import { join } from "node:path"; |