diff --git a/.pi/extensions/pi-worktree.ts b/.pi/extensions/pi-worktree.ts new file mode 100644 index 0000000..552d659 --- /dev/null +++ b/.pi/extensions/pi-worktree.ts @@ -0,0 +1,70 @@ +import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; +import { Type } from "typebox"; + +export default function (pi: ExtensionAPI) { + pi.registerTool({ + name: "git_worktree_list", + label: "Git Worktree List", + description: "List all linked worktrees in the current repo with branch, path, and status.", + parameters: Type.Object({}), + async execute() { + return { + content: [{ type: "text", text: "Not implemented yet." }], + }; + }, + }); + + pi.registerTool({ + name: "git_worktree_create", + label: "Git Worktree Create", + description: "Create a linked worktree for a branch in the current repo.", + parameters: Type.Object({ + path: Type.String({ description: "Path for the new worktree" }), + branch: Type.Optional( + Type.String({ + description: "Branch name (new or existing). Defaults to 'main'.", + }) + ), + create_branch: Type.Optional( + Type.Boolean({ + description: "Create a new branch? Defaults to true if branch doesn't exist.", + }) + ), + }), + async execute() { + return { + content: [{ type: "text", text: "Not implemented yet." }], + }; + }, + }); + + pi.registerTool({ + name: "git_worktree_switch", + label: "Git Worktree Switch", + description: "Switch pi's working directory to a linked worktree.", + parameters: Type.Object({ + target: Type.String({ + description: "Path or branch name of the target worktree", + }), + }), + async execute() { + return { + content: [{ type: "text", text: "Not implemented yet." }], + }; + }, + }); + + pi.registerTool({ + name: "git_worktree_remove", + label: "Git Worktree Remove", + description: "Remove a linked worktree.", + parameters: Type.Object({ + path: Type.String({ description: "Path of the worktree to remove" }), + }), + async execute() { + return { + content: [{ type: "text", text: "Not implemented yet." }], + }; + }, + }); +}