MCPcopy
hub / github.com/21st-dev/1code / createStagingRouter

Function createStagingRouter

src/main/lib/git/staging.ts:15–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13} from "./security";
14
15export 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 }),

Callers 1

createGitRouterFunction · 0.90

Calls 9

gitStageFileFunction · 0.90
gitUnstageFileFunction · 0.90
gitCheckoutFileFunction · 0.90
gitStageAllFunction · 0.90
gitUnstageAllFunction · 0.90
gitStageFilesFunction · 0.90
gitUnstageFilesFunction · 0.90
gitCheckoutFilesFunction · 0.90
deleteMethod · 0.45

Tested by

no test coverage detected