()
| 13 | } from "./security"; |
| 14 | |
| 15 | export const createStagingRouter = () => { |
| 16 | return router({ |
| 17 | stageFile: publicProcedure |
| 18 | .input( |
| 19 | z.object({ |
| 20 | worktreePath: z.string(), |
| 21 | filePath: z.string(), |
| 22 | }), |
| 23 | ) |
| 24 | .mutation(async ({ input }): Promise<{ success: boolean }> => { |
| 25 | await gitStageFile(input.worktreePath, input.filePath); |
| 26 | return { success: true }; |
| 27 | }), |
| 28 | |
| 29 | unstageFile: publicProcedure |
| 30 | .input( |
| 31 | z.object({ |
| 32 | worktreePath: z.string(), |
| 33 | filePath: z.string(), |
| 34 | }), |
| 35 | ) |
| 36 | .mutation(async ({ input }): Promise<{ success: boolean }> => { |
| 37 | await gitUnstageFile(input.worktreePath, input.filePath); |
| 38 | return { success: true }; |
| 39 | }), |
| 40 | |
| 41 | discardChanges: publicProcedure |
| 42 | .input( |
| 43 | z.object({ |
| 44 | worktreePath: z.string(), |
| 45 | filePath: z.string(), |
| 46 | }), |
| 47 | ) |
| 48 | .mutation(async ({ input }): Promise<{ success: boolean }> => { |
| 49 | await gitCheckoutFile(input.worktreePath, input.filePath); |
| 50 | return { success: true }; |
| 51 | }), |
| 52 | |
| 53 | stageAll: publicProcedure |
| 54 | .input(z.object({ worktreePath: z.string() })) |
| 55 | .mutation(async ({ input }): Promise<{ success: boolean }> => { |
| 56 | await gitStageAll(input.worktreePath); |
| 57 | return { success: true }; |
| 58 | }), |
| 59 | |
| 60 | unstageAll: publicProcedure |
| 61 | .input(z.object({ worktreePath: z.string() })) |
| 62 | .mutation(async ({ input }): Promise<{ success: boolean }> => { |
| 63 | await gitUnstageAll(input.worktreePath); |
| 64 | return { success: true }; |
| 65 | }), |
| 66 | |
| 67 | stageFiles: publicProcedure |
| 68 | .input( |
| 69 | z.object({ |
| 70 | worktreePath: z.string(), |
| 71 | filePaths: z.array(z.string()), |
| 72 | }), |
no test coverage detected