@cyanheads/git-mcp-server
Version:
An MCP (Model Context Protocol) server enabling LLMs and AI agents to interact with Git repositories. Provides tools for comprehensive Git operations including clone, commit, branch, diff, log, status, push, pull, merge, rebase, worktree, tag management,
218 lines • 7.21 kB
TypeScript
/**
* @fileoverview Defines the core logic, schemas, and types for the git_worktree tool.
* @module src/mcp-server/tools/gitWorktree/logic
*/
import { z } from "zod";
import { type RequestContext } from "../../../utils/index.js";
export declare const GitWorktreeBaseSchema: z.ZodObject<{
path: z.ZodDefault<z.ZodString>;
mode: z.ZodEnum<["list", "add", "remove", "move", "prune"]>;
worktreePath: z.ZodOptional<z.ZodString>;
commitish: z.ZodOptional<z.ZodString>;
newBranch: z.ZodOptional<z.ZodString>;
force: z.ZodDefault<z.ZodBoolean>;
detach: z.ZodDefault<z.ZodBoolean>;
newPath: z.ZodOptional<z.ZodString>;
verbose: z.ZodDefault<z.ZodBoolean>;
dryRun: z.ZodDefault<z.ZodBoolean>;
expire: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
path: string;
mode: "add" | "list" | "prune" | "remove" | "move";
force: boolean;
dryRun: boolean;
detach: boolean;
verbose: boolean;
newBranch?: string | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
newPath?: string | undefined;
expire?: string | undefined;
}, {
mode: "add" | "list" | "prune" | "remove" | "move";
path?: string | undefined;
force?: boolean | undefined;
newBranch?: string | undefined;
dryRun?: boolean | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
detach?: boolean | undefined;
newPath?: string | undefined;
verbose?: boolean | undefined;
expire?: string | undefined;
}>;
export declare const GitWorktreeInputSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
path: z.ZodDefault<z.ZodString>;
mode: z.ZodEnum<["list", "add", "remove", "move", "prune"]>;
worktreePath: z.ZodOptional<z.ZodString>;
commitish: z.ZodOptional<z.ZodString>;
newBranch: z.ZodOptional<z.ZodString>;
force: z.ZodDefault<z.ZodBoolean>;
detach: z.ZodDefault<z.ZodBoolean>;
newPath: z.ZodOptional<z.ZodString>;
verbose: z.ZodDefault<z.ZodBoolean>;
dryRun: z.ZodDefault<z.ZodBoolean>;
expire: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
path: string;
mode: "add" | "list" | "prune" | "remove" | "move";
force: boolean;
dryRun: boolean;
detach: boolean;
verbose: boolean;
newBranch?: string | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
newPath?: string | undefined;
expire?: string | undefined;
}, {
mode: "add" | "list" | "prune" | "remove" | "move";
path?: string | undefined;
force?: boolean | undefined;
newBranch?: string | undefined;
dryRun?: boolean | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
detach?: boolean | undefined;
newPath?: string | undefined;
verbose?: boolean | undefined;
expire?: string | undefined;
}>, {
path: string;
mode: "add" | "list" | "prune" | "remove" | "move";
force: boolean;
dryRun: boolean;
detach: boolean;
verbose: boolean;
newBranch?: string | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
newPath?: string | undefined;
expire?: string | undefined;
}, {
mode: "add" | "list" | "prune" | "remove" | "move";
path?: string | undefined;
force?: boolean | undefined;
newBranch?: string | undefined;
dryRun?: boolean | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
detach?: boolean | undefined;
newPath?: string | undefined;
verbose?: boolean | undefined;
expire?: string | undefined;
}>, {
path: string;
mode: "add" | "list" | "prune" | "remove" | "move";
force: boolean;
dryRun: boolean;
detach: boolean;
verbose: boolean;
newBranch?: string | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
newPath?: string | undefined;
expire?: string | undefined;
}, {
mode: "add" | "list" | "prune" | "remove" | "move";
path?: string | undefined;
force?: boolean | undefined;
newBranch?: string | undefined;
dryRun?: boolean | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
detach?: boolean | undefined;
newPath?: string | undefined;
verbose?: boolean | undefined;
expire?: string | undefined;
}>, {
path: string;
mode: "add" | "list" | "prune" | "remove" | "move";
force: boolean;
dryRun: boolean;
detach: boolean;
verbose: boolean;
newBranch?: string | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
newPath?: string | undefined;
expire?: string | undefined;
}, {
mode: "add" | "list" | "prune" | "remove" | "move";
path?: string | undefined;
force?: boolean | undefined;
newBranch?: string | undefined;
dryRun?: boolean | undefined;
worktreePath?: string | undefined;
commitish?: string | undefined;
detach?: boolean | undefined;
newPath?: string | undefined;
verbose?: boolean | undefined;
expire?: string | undefined;
}>;
export declare const GitWorktreeOutputSchema: z.ZodObject<{
success: z.ZodBoolean;
mode: z.ZodString;
message: z.ZodOptional<z.ZodString>;
worktrees: z.ZodOptional<z.ZodArray<z.ZodObject<{
path: z.ZodString;
head: z.ZodString;
branch: z.ZodOptional<z.ZodString>;
isBare: z.ZodBoolean;
isLocked: z.ZodBoolean;
isPrunable: z.ZodBoolean;
prunableReason: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
path: string;
head: string;
isBare: boolean;
isLocked: boolean;
isPrunable: boolean;
branch?: string | undefined;
prunableReason?: string | undefined;
}, {
path: string;
head: string;
isBare: boolean;
isLocked: boolean;
isPrunable: boolean;
branch?: string | undefined;
prunableReason?: string | undefined;
}>, "many">>;
}, "strip", z.ZodTypeAny, {
success: boolean;
mode: string;
message?: string | undefined;
worktrees?: {
path: string;
head: string;
isBare: boolean;
isLocked: boolean;
isPrunable: boolean;
branch?: string | undefined;
prunableReason?: string | undefined;
}[] | undefined;
}, {
success: boolean;
mode: string;
message?: string | undefined;
worktrees?: {
path: string;
head: string;
isBare: boolean;
isLocked: boolean;
isPrunable: boolean;
branch?: string | undefined;
prunableReason?: string | undefined;
}[] | undefined;
}>;
export type GitWorktreeInput = z.infer<typeof GitWorktreeInputSchema>;
export type GitWorktreeOutput = z.infer<typeof GitWorktreeOutputSchema>;
/**
* 4. IMPLEMENT the core logic function.
* @throws {McpError} If the logic encounters an unrecoverable issue.
*/
export declare function gitWorktreeLogic(params: GitWorktreeInput, context: RequestContext & {
getWorkingDirectory: () => string | undefined;
}): Promise<GitWorktreeOutput>;
//# sourceMappingURL=logic.d.ts.map