Split git VCS driver from core service
- Introduce a dedicated `GitVcsDriver` service and `vcsLayer` - Update server, orchestration, and workspace wiring to use the new layer - Adjust tests and mocks for the new git-specific dependency
This commit is contained in:
1 parent
0ce293b37e
commit
82a8394cd8
15 files changed
+97
-87
No files matched your search
@@ -33,7 +33,6 @@ import { ProjectionCheckpointRepositoryLive } from "../src/persistence/Layers/Pr
|
||||
import { ProjectionPendingApprovalRepositoryLive } from "../src/persistence/Layers/ProjectionPendingApprovals.ts";
|
||||
import { ProviderSessionRuntimeRepositoryLive } from "../src/persistence/Layers/ProviderSessionRuntime.ts";
|
||||
import { makeSqlitePersistenceLive } from "../src/persistence/Layers/Sqlite.ts";
|
||||
import { VcsDriver, type VcsDriverShape } from "../src/vcs/VcsDriver.ts";
|
||||
import { ProjectionCheckpointRepository } from "../src/persistence/Services/ProjectionCheckpoints.ts";
|
||||
import { ProjectionPendingApprovalRepository } from "../src/persistence/Services/ProjectionPendingApprovals.ts";
|
||||
import { makeAdapterRegistryMock } from "../src/provider/testUtils/providerAdapterRegistryMock.ts";
|
||||
@@ -292,7 +291,7 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
Layer.provide(providerEventLoggersLayer),
|
||||
);
|
||||
|
||||
const checkpointStoreLayer = CheckpointStoreLive.pipe(Layer.provide(GitVcsDriver.layer));
|
||||
const checkpointStoreLayer = CheckpointStoreLive.pipe(Layer.provide(GitVcsDriver.vcsLayer));
|
||||
const projectionSnapshotQueryLayer = OrchestrationProjectionSnapshotQueryLive;
|
||||
const runtimeServicesLayer = Layer.mergeAll(
|
||||
projectionSnapshotQueryLayer,
|
||||
@@ -308,17 +307,17 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
Layer.provideMerge(runtimeServicesLayer),
|
||||
Layer.provideMerge(serverSettingsLayer),
|
||||
);
|
||||
const vcsDriverLayer = Layer.succeed(VcsDriver, {
|
||||
renameBranch: (input: Parameters<VcsDriverShape["renameBranch"]>[0]) =>
|
||||
const gitVcsDriverLayer = Layer.succeed(GitVcsDriver.GitVcsDriver, {
|
||||
renameBranch: (input: Parameters<GitVcsDriver.GitVcsDriverShape["renameBranch"]>[0]) =>
|
||||
Effect.succeed({ branch: input.newBranch }),
|
||||
} as unknown as VcsDriverShape);
|
||||
} as unknown as GitVcsDriver.GitVcsDriverShape);
|
||||
const textGenerationLayer = Layer.succeed(TextGeneration, {
|
||||
generateBranchName: () => Effect.succeed({ branch: "update" }),
|
||||
generateThreadTitle: () => Effect.succeed({ title: "New thread" }),
|
||||
} as unknown as TextGenerationShape);
|
||||
const providerCommandReactorLayer = ProviderCommandReactorLive.pipe(
|
||||
Layer.provideMerge(runtimeServicesLayer),
|
||||
Layer.provideMerge(vcsDriverLayer),
|
||||
Layer.provideMerge(gitVcsDriverLayer),
|
||||
Layer.provideMerge(textGenerationLayer),
|
||||
Layer.provideMerge(serverSettingsLayer),
|
||||
);
|
||||
@@ -343,7 +342,7 @@ export const makeOrchestrationIntegrationHarness = (
|
||||
Layer.provideMerge(
|
||||
WorkspaceEntriesLive.pipe(
|
||||
Layer.provide(WorkspacePathsLive),
|
||||
Layer.provideMerge(GitVcsDriver.layer),
|
||||
Layer.provideMerge(GitVcsDriver.vcsLayer),
|
||||
Layer.provide(NodeServices.layer),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -18,7 +18,7 @@ const ServerConfigLayer = ServerConfig.layerTest(process.cwd(), {
|
||||
prefix: "t3-checkpoint-store-test-",
|
||||
});
|
||||
const VcsProcessTestLayer = VcsProcess.layer.pipe(Layer.provide(NodeServices.layer));
|
||||
const VcsDriverTestLayer = GitVcsDriver.layer.pipe(Layer.provide(VcsProcessTestLayer));
|
||||
const VcsDriverTestLayer = GitVcsDriver.vcsLayer.pipe(Layer.provide(VcsProcessTestLayer));
|
||||
const CheckpointStoreTestLayer = CheckpointStoreLive.pipe(
|
||||
Layer.provideMerge(VcsDriverTestLayer),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
import { type TextGenerationShape, TextGeneration } from "../Services/TextGeneration.ts";
|
||||
import * as GitVcsDriver from "../../vcs/GitVcsDriver.ts";
|
||||
import * as VcsProcess from "../../vcs/VcsProcess.ts";
|
||||
import { VcsDriver } from "../../vcs/VcsDriver.ts";
|
||||
import { makeGitManager } from "./GitManager.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
@@ -212,30 +211,18 @@ function runGit(
|
||||
): Effect.Effect<
|
||||
{ readonly code: number; readonly stdout: string; readonly stderr: string },
|
||||
GitCommandError,
|
||||
VcsDriver
|
||||
GitVcsDriver.GitVcsDriver
|
||||
> {
|
||||
return Effect.gen(function* () {
|
||||
const vcs = yield* VcsDriver;
|
||||
const result = yield* vcs
|
||||
.execute({
|
||||
operation: "GitManager.test.runGit",
|
||||
cwd,
|
||||
args,
|
||||
allowNonZeroExit,
|
||||
})
|
||||
.pipe(
|
||||
Effect.mapError(
|
||||
(error) =>
|
||||
new GitCommandError({
|
||||
operation: "GitManager.test.runGit",
|
||||
command: `git ${args.join(" ")}`,
|
||||
cwd,
|
||||
detail: error.message,
|
||||
}),
|
||||
),
|
||||
);
|
||||
const git = yield* GitVcsDriver.GitVcsDriver;
|
||||
const result = yield* git.execute({
|
||||
operation: "GitManager.test.runGit",
|
||||
cwd,
|
||||
args,
|
||||
allowNonZeroExit,
|
||||
});
|
||||
return {
|
||||
code: result.exitCode,
|
||||
code: result.code,
|
||||
stdout: result.stdout,
|
||||
stderr: result.stderr,
|
||||
};
|
||||
@@ -247,7 +234,7 @@ function initRepo(
|
||||
): Effect.Effect<
|
||||
void,
|
||||
PlatformError.PlatformError | GitCommandError,
|
||||
FileSystem.FileSystem | Scope.Scope | VcsDriver
|
||||
FileSystem.FileSystem | Scope.Scope | GitVcsDriver.GitVcsDriver
|
||||
> {
|
||||
return Effect.gen(function* () {
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
@@ -263,7 +250,7 @@ function initRepo(
|
||||
function createBareRemote(): Effect.Effect<
|
||||
string,
|
||||
PlatformError.PlatformError | GitCommandError,
|
||||
FileSystem.FileSystem | Scope.Scope | VcsDriver
|
||||
FileSystem.FileSystem | Scope.Scope | GitVcsDriver.GitVcsDriver
|
||||
> {
|
||||
return Effect.gen(function* () {
|
||||
const remoteDir = yield* makeTempDir("t3code-git-remote-");
|
||||
@@ -277,7 +264,7 @@ function configureRemote(
|
||||
remoteName: string,
|
||||
remotePath: string,
|
||||
fetchNamespace: string,
|
||||
): Effect.Effect<void, GitCommandError, VcsDriver> {
|
||||
): Effect.Effect<void, GitCommandError, GitVcsDriver.GitVcsDriver> {
|
||||
return Effect.gen(function* () {
|
||||
yield* runGit(cwd, ["config", `remote.${remoteName}.url`, remotePath]);
|
||||
yield* runGit(cwd, [
|
||||
|
||||
@@ -49,7 +49,7 @@ import {
|
||||
decodeGitHubPullRequestListJson,
|
||||
formatGitHubJsonDecodeError,
|
||||
} from "../githubPullRequests.ts";
|
||||
import { VcsDriver } from "../../vcs/VcsDriver.ts";
|
||||
import { GitVcsDriver } from "../../vcs/GitVcsDriver.ts";
|
||||
|
||||
const COMMIT_TIMEOUT_MS = 10 * 60_000;
|
||||
const MAX_PROGRESS_TEXT_LENGTH = 500;
|
||||
@@ -491,7 +491,7 @@ function toPullRequestHeadRemoteInfo(pr: {
|
||||
}
|
||||
|
||||
export const makeGitManager = Effect.fn("makeGitManager")(function* () {
|
||||
const gitCore = yield* VcsDriver;
|
||||
const gitCore = yield* GitVcsDriver;
|
||||
const gitHubCli = yield* GitHubCli;
|
||||
const textGeneration = yield* TextGeneration;
|
||||
const projectSetupScriptRunner = yield* ProjectSetupScriptRunner;
|
||||
|
||||
@@ -307,11 +307,11 @@ describe("CheckpointReactor", () => {
|
||||
Layer.provideMerge(RuntimeReceiptBusLive),
|
||||
Layer.provideMerge(Layer.succeed(ProviderService, provider.service)),
|
||||
Layer.provideMerge(gitStatusBroadcasterLayer),
|
||||
Layer.provideMerge(CheckpointStoreLive.pipe(Layer.provide(GitVcsDriver.layer))),
|
||||
Layer.provideMerge(CheckpointStoreLive.pipe(Layer.provide(GitVcsDriver.vcsLayer))),
|
||||
Layer.provideMerge(
|
||||
WorkspaceEntriesLive.pipe(
|
||||
Layer.provide(WorkspacePathsLive),
|
||||
Layer.provideMerge(GitVcsDriver.layer),
|
||||
Layer.provideMerge(GitVcsDriver.vcsLayer),
|
||||
),
|
||||
),
|
||||
Layer.provideMerge(WorkspacePathsLive),
|
||||
|
||||
@@ -51,7 +51,7 @@ import { OrchestrationEngineService } from "../Services/OrchestrationEngine.ts";
|
||||
import { ProviderCommandReactor } from "../Services/ProviderCommandReactor.ts";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { VcsDriver, type VcsDriverShape } from "../../vcs/VcsDriver.ts";
|
||||
import * as GitVcsDriver from "../../vcs/GitVcsDriver.ts";
|
||||
|
||||
const asProjectId = (value: string): ProjectId => ProjectId.make(value);
|
||||
const asApprovalRequestId = (value: string): ApprovalRequestId => ApprovalRequestId.make(value);
|
||||
@@ -324,7 +324,11 @@ describe("ProviderCommandReactor", () => {
|
||||
const layer = ProviderCommandReactorLive.pipe(
|
||||
Layer.provideMerge(orchestrationLayer),
|
||||
Layer.provideMerge(Layer.succeed(ProviderService, service)),
|
||||
Layer.provideMerge(Layer.succeed(VcsDriver, { renameBranch } as unknown as VcsDriverShape)),
|
||||
Layer.provideMerge(
|
||||
Layer.succeed(GitVcsDriver.GitVcsDriver, {
|
||||
renameBranch,
|
||||
} as unknown as GitVcsDriver.GitVcsDriverShape),
|
||||
),
|
||||
Layer.provideMerge(
|
||||
Layer.succeed(GitStatusBroadcaster, {
|
||||
getStatus: () => Effect.die("getStatus should not be called in this test"),
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
type ProviderCommandReactorShape,
|
||||
} from "../Services/ProviderCommandReactor.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { VcsDriver } from "../../vcs/VcsDriver.ts";
|
||||
import { GitVcsDriver } from "../../vcs/GitVcsDriver.ts";
|
||||
|
||||
type ProviderIntentEvent = Extract<
|
||||
OrchestrationEvent,
|
||||
@@ -168,7 +168,7 @@ function buildGeneratedWorktreeBranchName(raw: string): string {
|
||||
const make = Effect.gen(function* () {
|
||||
const orchestrationEngine = yield* OrchestrationEngineService;
|
||||
const providerService = yield* ProviderService;
|
||||
const git = yield* VcsDriver;
|
||||
const git = yield* GitVcsDriver;
|
||||
const gitStatusBroadcaster = yield* GitStatusBroadcaster;
|
||||
const textGeneration = yield* TextGeneration;
|
||||
const serverSettingsService = yield* ServerSettingsService;
|
||||
|
||||
@@ -104,6 +104,7 @@ import {
|
||||
import { WorkspaceEntriesLive } from "./workspace/Layers/WorkspaceEntries.ts";
|
||||
import { WorkspaceFileSystemLive } from "./workspace/Layers/WorkspaceFileSystem.ts";
|
||||
import { WorkspacePathsLive } from "./workspace/Layers/WorkspacePaths.ts";
|
||||
import * as GitVcsDriver from "./vcs/GitVcsDriver.ts";
|
||||
import { VcsDriver, type VcsDriverShape } from "./vcs/VcsDriver.ts";
|
||||
import { ServerSecretStoreLive } from "./auth/Layers/ServerSecretStore.ts";
|
||||
import { ServerAuthLive } from "./auth/Layers/ServerAuth.ts";
|
||||
@@ -315,6 +316,7 @@ const buildAppUnderTest = (options?: {
|
||||
serverSettings?: Partial<ServerSettingsShape>;
|
||||
open?: Partial<OpenShape>;
|
||||
vcsDriver?: Partial<VcsDriverShape>;
|
||||
gitVcsDriver?: Partial<GitVcsDriver.GitVcsDriverShape>;
|
||||
gitManager?: Partial<GitManagerShape>;
|
||||
gitStatusBroadcaster?: Partial<GitStatusBroadcasterShape>;
|
||||
projectSetupScriptRunner?: Partial<ProjectSetupScriptRunnerShape>;
|
||||
@@ -384,6 +386,9 @@ const buildAppUnderTest = (options?: {
|
||||
filterIgnoredPaths: (_cwd, relativePaths) => Effect.succeed(relativePaths),
|
||||
...options?.layers?.vcsDriver,
|
||||
});
|
||||
const gitVcsDriverLayer = Layer.mock(GitVcsDriver.GitVcsDriver)({
|
||||
...options?.layers?.gitVcsDriver,
|
||||
});
|
||||
const gitManagerLayer = Layer.mock(GitManager)({
|
||||
...options?.layers?.gitManager,
|
||||
});
|
||||
@@ -444,6 +449,7 @@ const buildAppUnderTest = (options?: {
|
||||
}),
|
||||
),
|
||||
Layer.provide(gitManagerLayer),
|
||||
Layer.provide(gitVcsDriverLayer),
|
||||
Layer.provideMerge(gitStatusBroadcasterLayer),
|
||||
Layer.provide(
|
||||
Layer.mock(ProjectSetupScriptRunner)({
|
||||
@@ -2377,7 +2383,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
worktreePath: null,
|
||||
}),
|
||||
},
|
||||
vcsDriver: {
|
||||
gitVcsDriver: {
|
||||
pullCurrentBranch: () =>
|
||||
Effect.succeed({
|
||||
status: "pulled",
|
||||
@@ -2531,7 +2537,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
let statusCalls = 0;
|
||||
yield* buildAppUnderTest({
|
||||
layers: {
|
||||
vcsDriver: {
|
||||
gitVcsDriver: {
|
||||
pullCurrentBranch: () => Effect.fail(gitError),
|
||||
},
|
||||
gitManager: {
|
||||
@@ -2685,7 +2691,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
Effect.gen(function* () {
|
||||
yield* buildAppUnderTest({
|
||||
layers: {
|
||||
vcsDriver: {
|
||||
gitVcsDriver: {
|
||||
pullCurrentBranch: () =>
|
||||
Effect.succeed({
|
||||
status: "pulled" as const,
|
||||
@@ -3499,13 +3505,14 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
pr: null,
|
||||
}),
|
||||
);
|
||||
const createWorktree = vi.fn((_: Parameters<VcsDriverShape["createWorktree"]>[0]) =>
|
||||
Effect.succeed({
|
||||
worktree: {
|
||||
branch: "t3code/bootstrap-branch",
|
||||
path: "/tmp/bootstrap-worktree",
|
||||
},
|
||||
}),
|
||||
const createWorktree = vi.fn(
|
||||
(_: Parameters<GitVcsDriver.GitVcsDriverShape["createWorktree"]>[0]) =>
|
||||
Effect.succeed({
|
||||
worktree: {
|
||||
branch: "t3code/bootstrap-branch",
|
||||
path: "/tmp/bootstrap-worktree",
|
||||
},
|
||||
}),
|
||||
);
|
||||
const runForThread = vi.fn(
|
||||
(_: Parameters<ProjectSetupScriptRunnerShape["runForThread"]>[0]) =>
|
||||
@@ -3520,7 +3527,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
|
||||
yield* buildAppUnderTest({
|
||||
layers: {
|
||||
vcsDriver: {
|
||||
gitVcsDriver: {
|
||||
createWorktree,
|
||||
},
|
||||
gitStatusBroadcaster: {
|
||||
@@ -3624,13 +3631,14 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
it.effect("records setup-script failures without aborting bootstrap turn start", () =>
|
||||
Effect.gen(function* () {
|
||||
const dispatchedCommands: Array<OrchestrationCommand> = [];
|
||||
const createWorktree = vi.fn((_: Parameters<VcsDriverShape["createWorktree"]>[0]) =>
|
||||
Effect.succeed({
|
||||
worktree: {
|
||||
branch: "t3code/bootstrap-branch",
|
||||
path: "/tmp/bootstrap-worktree",
|
||||
},
|
||||
}),
|
||||
const createWorktree = vi.fn(
|
||||
(_: Parameters<GitVcsDriver.GitVcsDriverShape["createWorktree"]>[0]) =>
|
||||
Effect.succeed({
|
||||
worktree: {
|
||||
branch: "t3code/bootstrap-branch",
|
||||
path: "/tmp/bootstrap-worktree",
|
||||
},
|
||||
}),
|
||||
);
|
||||
const runForThread = vi.fn(
|
||||
(_: Parameters<ProjectSetupScriptRunnerShape["runForThread"]>[0]) =>
|
||||
@@ -3639,7 +3647,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
|
||||
yield* buildAppUnderTest({
|
||||
layers: {
|
||||
vcsDriver: {
|
||||
gitVcsDriver: {
|
||||
createWorktree,
|
||||
},
|
||||
orchestrationEngine: {
|
||||
@@ -3717,13 +3725,14 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
it.effect("does not misattribute setup activity dispatch failures as setup launch failures", () =>
|
||||
Effect.gen(function* () {
|
||||
const dispatchedCommands: Array<OrchestrationCommand> = [];
|
||||
const createWorktree = vi.fn((_: Parameters<VcsDriverShape["createWorktree"]>[0]) =>
|
||||
Effect.succeed({
|
||||
worktree: {
|
||||
branch: "t3code/bootstrap-branch",
|
||||
path: "/tmp/bootstrap-worktree",
|
||||
},
|
||||
}),
|
||||
const createWorktree = vi.fn(
|
||||
(_: Parameters<GitVcsDriver.GitVcsDriverShape["createWorktree"]>[0]) =>
|
||||
Effect.succeed({
|
||||
worktree: {
|
||||
branch: "t3code/bootstrap-branch",
|
||||
path: "/tmp/bootstrap-worktree",
|
||||
},
|
||||
}),
|
||||
);
|
||||
const runForThread = vi.fn(
|
||||
(_: Parameters<ProjectSetupScriptRunnerShape["runForThread"]>[0]) =>
|
||||
@@ -3739,7 +3748,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
|
||||
yield* buildAppUnderTest({
|
||||
layers: {
|
||||
vcsDriver: {
|
||||
gitVcsDriver: {
|
||||
createWorktree,
|
||||
},
|
||||
orchestrationEngine: {
|
||||
@@ -3835,13 +3844,14 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
it.effect("cleans up created bootstrap threads when worktree creation defects", () =>
|
||||
Effect.gen(function* () {
|
||||
const dispatchedCommands: Array<OrchestrationCommand> = [];
|
||||
const createWorktree = vi.fn((_: Parameters<VcsDriverShape["createWorktree"]>[0]) =>
|
||||
Effect.die(new Error("worktree exploded")),
|
||||
const createWorktree = vi.fn(
|
||||
(_: Parameters<GitVcsDriver.GitVcsDriverShape["createWorktree"]>[0]) =>
|
||||
Effect.die(new Error("worktree exploded")),
|
||||
);
|
||||
|
||||
yield* buildAppUnderTest({
|
||||
layers: {
|
||||
vcsDriver: {
|
||||
gitVcsDriver: {
|
||||
createWorktree,
|
||||
},
|
||||
orchestrationEngine: {
|
||||
|
||||
@@ -136,7 +136,7 @@ const ReactorLayerLive = Layer.empty.pipe(
|
||||
|
||||
const CheckpointingLayerLive = Layer.empty.pipe(
|
||||
Layer.provideMerge(CheckpointDiffQueryLive),
|
||||
Layer.provideMerge(CheckpointStoreLive.pipe(Layer.provide(GitVcsDriver.layer))),
|
||||
Layer.provideMerge(CheckpointStoreLive.pipe(Layer.provide(GitVcsDriver.vcsLayer))),
|
||||
);
|
||||
|
||||
const ProviderSessionDirectoryLayerLive = ProviderSessionDirectoryLive.pipe(
|
||||
@@ -173,7 +173,7 @@ const TerminalLayerLive = TerminalManagerLive.pipe(Layer.provide(PtyAdapterLive)
|
||||
|
||||
const WorkspaceEntriesLayerLive = WorkspaceEntriesLive.pipe(
|
||||
Layer.provide(WorkspacePathsLive),
|
||||
Layer.provideMerge(GitVcsDriver.layer),
|
||||
Layer.provideMerge(GitVcsDriver.vcsLayer),
|
||||
);
|
||||
|
||||
const WorkspaceFileSystemLayerLive = WorkspaceFileSystemLive.pipe(
|
||||
|
||||
@@ -18,7 +18,7 @@ const GitVcsDriverTestDependencies = ServerConfig.layerTest(process.cwd(), {
|
||||
prefix: "t3-git-vcs-driver-test-",
|
||||
}).pipe(Layer.provide(NodeServices.layer));
|
||||
|
||||
it.layer(Layer.empty)("GitVcsDriver.layer", (it) => {
|
||||
it.layer(Layer.empty)("GitVcsDriver.vcsLayer", (it) => {
|
||||
describe("workspace helpers", () => {
|
||||
it.effect("filterIgnoredPaths chunks large path lists and preserves kept paths", () =>
|
||||
Effect.gen(function* () {
|
||||
@@ -32,7 +32,7 @@ it.layer(Layer.empty)("GitVcsDriver.layer", (it) => {
|
||||
);
|
||||
|
||||
const seenChunks: string[][] = [];
|
||||
const layer = GitVcsDriver.layer.pipe(
|
||||
const layer = GitVcsDriver.vcsLayer.pipe(
|
||||
Layer.provideMerge(GitVcsDriverTestDependencies),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provide(
|
||||
@@ -81,7 +81,7 @@ it.layer(Layer.empty)("GitVcsDriver.layer", (it) => {
|
||||
|
||||
it.effect("listWorkspaceFiles disables fsmonitor and untracked cache helpers", () =>
|
||||
Effect.gen(function* () {
|
||||
const layer = GitVcsDriver.layer.pipe(
|
||||
const layer = GitVcsDriver.vcsLayer.pipe(
|
||||
Layer.provideMerge(GitVcsDriverTestDependencies),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provide(
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import { DateTime, Effect, Layer } from "effect";
|
||||
import { Context, DateTime, Effect, Layer } from "effect";
|
||||
|
||||
import { VcsProcessExitError } from "@t3tools/contracts";
|
||||
import { makeGitCore } from "../git/Layers/GitCore.ts";
|
||||
import type { GitCoreShape } from "../git/Services/GitCore.ts";
|
||||
import { VcsDriver, type VcsDriverShape } from "./VcsDriver.ts";
|
||||
import { VcsProcess, type VcsProcessShape } from "./VcsProcess.ts";
|
||||
|
||||
export interface GitVcsDriverShape extends GitCoreShape {}
|
||||
|
||||
export class GitVcsDriver extends Context.Service<GitVcsDriver, GitVcsDriverShape>()(
|
||||
"t3/vcs/GitVcsDriver",
|
||||
) {}
|
||||
|
||||
const WORKSPACE_FILES_MAX_OUTPUT_BYTES = 16 * 1024 * 1024;
|
||||
const GIT_CHECK_IGNORE_MAX_STDIN_BYTES = 256 * 1024;
|
||||
const WORKSPACE_GIT_HARDENED_CONFIG_ARGS = [
|
||||
@@ -92,9 +99,8 @@ const gitCommand = (
|
||||
: {}),
|
||||
});
|
||||
|
||||
export const make = Effect.fn("makeGitVcsDriver")(function* () {
|
||||
export const makeVcsDriver = Effect.fn("makeGitVcsDriver")(function* () {
|
||||
const process = yield* VcsProcess;
|
||||
const legacyGit = yield* makeGitCore();
|
||||
const capabilities = {
|
||||
kind: "git" as const,
|
||||
supportsWorktrees: true,
|
||||
@@ -243,7 +249,6 @@ export const make = Effect.fn("makeGitVcsDriver")(function* () {
|
||||
);
|
||||
|
||||
return VcsDriver.of({
|
||||
...legacyGit,
|
||||
capabilities,
|
||||
execute,
|
||||
detectRepository,
|
||||
@@ -253,4 +258,10 @@ export const make = Effect.fn("makeGitVcsDriver")(function* () {
|
||||
});
|
||||
});
|
||||
|
||||
export const layer = Layer.effect(VcsDriver, make());
|
||||
export const make = Effect.fn("makeGitVcsDriverService")(function* () {
|
||||
const legacyGit = yield* makeGitCore();
|
||||
return GitVcsDriver.of(legacyGit);
|
||||
});
|
||||
|
||||
export const vcsLayer = Layer.effect(VcsDriver, makeVcsDriver());
|
||||
export const layer = Layer.effect(GitVcsDriver, make());
|
||||
@@ -6,10 +6,9 @@ import type {
|
||||
VcsListWorkspaceFilesResult,
|
||||
VcsRepositoryIdentity,
|
||||
} from "@t3tools/contracts";
|
||||
import type { GitCoreShape } from "../git/Services/GitCore.ts";
|
||||
import type { VcsProcessInput, VcsProcessOutput } from "./VcsProcess.ts";
|
||||
|
||||
export interface VcsDriverShape extends Omit<GitCoreShape, "execute"> {
|
||||
export interface VcsDriverShape {
|
||||
readonly capabilities: VcsDriverCapabilities;
|
||||
readonly execute: (
|
||||
input: Omit<VcsProcessInput, "command">,
|
||||
|
||||
@@ -15,7 +15,7 @@ const TestLayer = Layer.empty.pipe(
|
||||
Layer.provideMerge(WorkspaceEntriesLive.pipe(Layer.provide(WorkspacePathsLive))),
|
||||
Layer.provideMerge(WorkspacePathsLive),
|
||||
Layer.provideMerge(VcsProcess.layer),
|
||||
Layer.provideMerge(GitVcsDriver.layer.pipe(Layer.provide(VcsProcess.layer))),
|
||||
Layer.provideMerge(GitVcsDriver.vcsLayer.pipe(Layer.provide(VcsProcess.layer))),
|
||||
Layer.provide(
|
||||
ServerConfig.layerTest(process.cwd(), {
|
||||
prefix: "t3-workspace-entries-test-",
|
||||
|
||||
@@ -20,7 +20,7 @@ const TestLayer = Layer.empty.pipe(
|
||||
Layer.provideMerge(ProjectLayer),
|
||||
Layer.provideMerge(WorkspaceEntriesLive.pipe(Layer.provide(WorkspacePathsLive))),
|
||||
Layer.provideMerge(WorkspacePathsLive),
|
||||
Layer.provideMerge(GitVcsDriver.layer.pipe(Layer.provide(VcsProcess.layer))),
|
||||
Layer.provideMerge(GitVcsDriver.vcsLayer.pipe(Layer.provide(VcsProcess.layer))),
|
||||
Layer.provide(
|
||||
ServerConfig.layerTest(process.cwd(), {
|
||||
prefix: "t3-workspace-files-test-",
|
||||
|
||||
@@ -49,7 +49,7 @@ import { TerminalManager } from "./terminal/Services/Manager.ts";
|
||||
import { WorkspaceEntries } from "./workspace/Services/WorkspaceEntries.ts";
|
||||
import { WorkspaceFileSystem } from "./workspace/Services/WorkspaceFileSystem.ts";
|
||||
import { WorkspacePathOutsideRootError } from "./workspace/Services/WorkspacePaths.ts";
|
||||
import { VcsDriver } from "./vcs/VcsDriver.ts";
|
||||
import { GitVcsDriver } from "./vcs/GitVcsDriver.ts";
|
||||
import { ProjectSetupScriptRunner } from "./project/Services/ProjectSetupScriptRunner.ts";
|
||||
import { RepositoryIdentityResolver } from "./project/Services/RepositoryIdentityResolver.ts";
|
||||
import { ServerEnvironment } from "./environment/Services/ServerEnvironment.ts";
|
||||
@@ -137,7 +137,7 @@ const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
|
||||
const keybindings = yield* Keybindings;
|
||||
const open = yield* Open;
|
||||
const gitManager = yield* GitManager;
|
||||
const git = yield* VcsDriver;
|
||||
const git = yield* GitVcsDriver;
|
||||
const gitStatusBroadcaster = yield* GitStatusBroadcaster;
|
||||
const terminalManager = yield* TerminalManager;
|
||||
const providerRegistry = yield* ProviderRegistry;
|
||||
|
||||
Reference in new issue
Block a user