pi-worktrees/.pi/extensions/pi-worktree.ts
David Kong 3c3f33037d feat: register all four worktree tools with placeholder implementations
Register git_worktree_list, git_worktree_create, git_worktree_switch,
and git_worktree_remove with correct TypeBox schemas. Each tool returns
'Not implemented yet.' as a placeholder response.
2026-07-24 18:47:56 +10:00

70 lines
2 KiB
TypeScript

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." }],
};
},
});
}