| ... | ... | @@ -35,6 +35,8 @@ import { |
| 35 | 35 | type SourceControlProviderKind, |
| 36 | 36 | type SourceControlWritingStyleSettings, |
| 37 | 37 | type ThreadId, |
| 38 | type VcsCreateWorktreeInput, |
| 39 | type VcsCreateWorktreeResult, |
| 38 | 40 | } from "@t3tools/contracts"; |
| 39 | 41 | import { |
| 40 | 42 | hasProjectSettingsOverrides, |
| ... | ... | @@ -103,6 +105,10 @@ interface SourceControlTextGenerationSettings { |
| 103 | 105 | export class GitManager extends Context.Service< |
| 104 | 106 | GitManager, |
| 105 | 107 | { |
| 108 | readonly createWorktree: ( |
| 109 | input: VcsCreateWorktreeInput, |
| 110 | options?: GitVcsDriver.CreateWorktreeOptions, |
| 111 | ) => Effect.Effect<VcsCreateWorktreeResult, GitCommandError>; |
| 106 | 112 | readonly status: ( |
| 107 | 113 | input: VcsStatusInput, |
| 108 | 114 | ) => Effect.Effect<VcsStatusResult, GitManagerServiceError>; |
| ... | ... | @@ -727,6 +733,19 @@ export const make = Effect.gen(function* () { |
| 727 | 733 | ); |
| 728 | 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 | 749 | const readRepositoryInstructions = (cwd: string, fileName: string) => |
| 731 | 750 | Effect.gen(function* () { |
| 732 | 751 | const root = yield* fileSystem.realPath(cwd); |
| ... | ... | @@ -2849,6 +2868,7 @@ export const make = Effect.gen(function* () { |
| 2849 | 2868 | ); |
| 2850 | 2869 | |
| 2851 | 2870 | return GitManager.of({ |
| 2871 | createWorktree, |
| 2852 | 2872 | localStatus, |
| 2853 | 2873 | remoteStatus, |
| 2854 | 2874 | status, |