| ... | @@ -35,6 +35,8 @@ import { | ... | @@ -35,6 +35,8 @@ import { |
| 35 | type SourceControlProviderKind, | 35 | type SourceControlProviderKind, |
| 36 | type SourceControlWritingStyleSettings, | 36 | type SourceControlWritingStyleSettings, |
| 37 | type ThreadId, | 37 | type ThreadId, |
| | 38 | type VcsCreateWorktreeInput, |
| | 39 | type VcsCreateWorktreeResult, |
| 38 | } from "@t3tools/contracts"; | 40 | } from "@t3tools/contracts"; |
| 39 | import { | 41 | import { |
| 40 | hasProjectSettingsOverrides, | 42 | hasProjectSettingsOverrides, |
| ... | @@ -103,6 +105,10 @@ interface SourceControlTextGenerationSettings { | ... | @@ -103,6 +105,10 @@ interface SourceControlTextGenerationSettings { |
| 103 | export class GitManager extends Context.Service< | 105 | export class GitManager extends Context.Service< |
| 104 | GitManager, | 106 | GitManager, |
| 105 | { | 107 | { |
| | 108 | readonly createWorktree: ( |
| | 109 | input: VcsCreateWorktreeInput, |
| | 110 | options?: GitVcsDriver.CreateWorktreeOptions, |
| | 111 | ) => Effect.Effect<VcsCreateWorktreeResult, GitCommandError>; |
| 106 | readonly status: ( | 112 | readonly status: ( |
| 107 | input: VcsStatusInput, | 113 | input: VcsStatusInput, |
| 108 | ) => Effect.Effect<VcsStatusResult, GitManagerServiceError>; | 114 | ) => Effect.Effect<VcsStatusResult, GitManagerServiceError>; |
| ... | @@ -727,6 +733,19 @@ export const make = Effect.gen(function* () { | ... | @@ -727,6 +733,19 @@ export const make = Effect.gen(function* () { |
| 727 | ); | 733 | ); |
| 728 | return resolveProjectSettings(settings, projectId).settings; | 734 | return resolveProjectSettings(settings, projectId).settings; |
| 729 | }); | 735 | }); |
| | 736 | const createWorktree: GitManager["Service"]["createWorktree"] = Effect.fn( |
| | 737 | "GitManager.createWorktree", |
| | 738 | )(function* (input, options) { |
| | 739 | const submodules = |
| | 740 | options?.submodules !== undefined |
| | 741 | ? options.submodules |
| | 742 | : yield* projectSettingsFor(input).pipe( |
| | 743 | Effect.map((settings) => settings.worktreeSubmodules), |
| | 744 | Effect.orElseSucceed(() => null), |
| | 745 | ); |
| | 746 | return yield* gitCore.createWorktree(input, { ...options, submodules }); |
| | 747 | }); |
| | 748 | |
| 730 | const readRepositoryInstructions = (cwd: string, fileName: string) => | 749 | const readRepositoryInstructions = (cwd: string, fileName: string) => |
| 731 | Effect.gen(function* () { | 750 | Effect.gen(function* () { |
| 732 | const root = yield* fileSystem.realPath(cwd); | 751 | const root = yield* fileSystem.realPath(cwd); |
| ... | @@ -2849,6 +2868,7 @@ export const make = Effect.gen(function* () { | ... | @@ -2849,6 +2868,7 @@ export const make = Effect.gen(function* () { |
| 2849 | ); | 2868 | ); |
| 2850 | | 2869 | |
| 2851 | return GitManager.of({ | 2870 | return GitManager.of({ |
| | 2871 | createWorktree, |
| 2852 | localStatus, | 2872 | localStatus, |
| 2853 | remoteStatus, | 2873 | remoteStatus, |
| 2854 | status, | 2874 | status, |