feat(source-control): add Bitbucket & Azure Devops providers (#2473)
Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
This commit is contained in:
59 files changed
+5852
-2345
No files matched your search
@@ -655,6 +655,7 @@ function makeManager(input?: {
|
||||
get: () => Effect.succeed(provider),
|
||||
resolveHandle: () => Effect.succeed({ provider, context: null }),
|
||||
resolve: () => Effect.succeed(provider),
|
||||
discover: Effect.succeed([]),
|
||||
}),
|
||||
),
|
||||
Effect.provide(Layer.succeed(GitHubCli, gitHubCli)),
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { assert, describe, it, vi } from "@effect/vitest";
|
||||
import { Effect, Layer } from "effect";
|
||||
import { describe, vi } from "vitest";
|
||||
|
||||
import { GitManager } from "./GitManager.ts";
|
||||
import { GitWorkflowService, layer as GitWorkflowServiceLayer } from "./GitWorkflowService.ts";
|
||||
import { GitVcsDriver } from "../vcs/GitVcsDriver.ts";
|
||||
import { VcsDriverRegistry, type VcsDriverRegistryShape } from "../vcs/VcsDriverRegistry.ts";
|
||||
import * as GitManager from "./GitManager.ts";
|
||||
import * as GitWorkflowService from "./GitWorkflowService.ts";
|
||||
import * as GitVcsDriver from "../vcs/GitVcsDriver.ts";
|
||||
import * as VcsDriverRegistry from "../vcs/VcsDriverRegistry.ts";
|
||||
|
||||
function makeLayer(input: { readonly detect: VcsDriverRegistryShape["detect"] }) {
|
||||
return GitWorkflowServiceLayer.pipe(
|
||||
function makeLayer(input: { readonly detect: VcsDriverRegistry.VcsDriverRegistryShape["detect"] }) {
|
||||
return GitWorkflowService.layer.pipe(
|
||||
Layer.provide(
|
||||
Layer.mock(VcsDriverRegistry)({
|
||||
Layer.mock(VcsDriverRegistry.VcsDriverRegistry)({
|
||||
detect: input.detect,
|
||||
}),
|
||||
),
|
||||
Layer.provide(Layer.mock(GitVcsDriver)({})),
|
||||
Layer.provide(Layer.mock(GitManager)({})),
|
||||
Layer.provide(Layer.mock(GitVcsDriver.GitVcsDriver)({})),
|
||||
Layer.provide(Layer.mock(GitManager.GitManager)({})),
|
||||
);
|
||||
}
|
||||
|
||||
describe("GitWorkflowService", () => {
|
||||
it.effect("returns an empty local status when no VCS repository is detected", () =>
|
||||
Effect.gen(function* () {
|
||||
const workflow = yield* GitWorkflowService;
|
||||
const workflow = yield* GitWorkflowService.GitWorkflowService;
|
||||
const status = yield* workflow.localStatus({ cwd: "/not-a-repo" });
|
||||
|
||||
assert.deepStrictEqual(status, {
|
||||
@@ -48,7 +47,7 @@ describe("GitWorkflowService", () => {
|
||||
|
||||
it.effect("returns an empty full status when no VCS repository is detected", () =>
|
||||
Effect.gen(function* () {
|
||||
const workflow = yield* GitWorkflowService;
|
||||
const workflow = yield* GitWorkflowService.GitWorkflowService;
|
||||
const status = yield* workflow.status({ cwd: "/not-a-repo" });
|
||||
|
||||
assert.deepStrictEqual(status, {
|
||||
@@ -82,15 +81,15 @@ describe("GitWorkflowService", () => {
|
||||
const remoteStatus = vi.fn();
|
||||
const status = vi.fn();
|
||||
|
||||
const testLayer = GitWorkflowServiceLayer.pipe(
|
||||
const testLayer = GitWorkflowService.layer.pipe(
|
||||
Layer.provide(
|
||||
Layer.mock(VcsDriverRegistry)({
|
||||
Layer.mock(VcsDriverRegistry.VcsDriverRegistry)({
|
||||
detect: () => Effect.succeed(null),
|
||||
}),
|
||||
),
|
||||
Layer.provide(Layer.mock(GitVcsDriver)({})),
|
||||
Layer.provide(Layer.mock(GitVcsDriver.GitVcsDriver)({})),
|
||||
Layer.provide(
|
||||
Layer.mock(GitManager)({
|
||||
Layer.mock(GitManager.GitManager)({
|
||||
localStatus,
|
||||
remoteStatus,
|
||||
status,
|
||||
@@ -99,7 +98,7 @@ describe("GitWorkflowService", () => {
|
||||
);
|
||||
|
||||
return Effect.gen(function* () {
|
||||
const workflow = yield* GitWorkflowService;
|
||||
const workflow = yield* GitWorkflowService.GitWorkflowService;
|
||||
yield* workflow.localStatus({ cwd: "/not-a-repo" });
|
||||
yield* workflow.remoteStatus({ cwd: "/not-a-repo" });
|
||||
yield* workflow.status({ cwd: "/not-a-repo" });
|
||||
@@ -112,7 +111,7 @@ describe("GitWorkflowService", () => {
|
||||
|
||||
it.effect("returns an empty ref list when no VCS repository is detected", () =>
|
||||
Effect.gen(function* () {
|
||||
const workflow = yield* GitWorkflowService;
|
||||
const workflow = yield* GitWorkflowService.GitWorkflowService;
|
||||
const refs = yield* workflow.listRefs({ cwd: "/not-a-repo" });
|
||||
|
||||
assert.deepStrictEqual(refs, {
|
||||
|
||||
Reference in new issue
Block a user