feat: support creating worktrees from GitHub pull requests

This commit is contained in:
Mohamed Boudra
2026-04-18 12:08:30 +07:00
parent 82f97e942d
commit 14cc1cc83c
48 changed files with 6448 additions and 1515 deletions
@@ -0,0 +1,30 @@
import type { CreatePaseoWorktreeInput } from "@server/client/daemon-client";
import type { GitHubSearchItem } from "@server/shared/messages";
export type PickerItem =
| { kind: "branch"; name: string }
| {
kind: "github-pr";
item: GitHubSearchItem;
};
export type PickerCheckoutRequest = Pick<
CreatePaseoWorktreeInput,
"action" | "refName" | "githubPrNumber"
>;
export function pickerItemToCheckoutRequest(
item: PickerItem | null,
): PickerCheckoutRequest | undefined {
if (!item) return undefined;
switch (item.kind) {
case "branch":
return { action: "branch-off", refName: item.name };
case "github-pr":
return {
action: "checkout",
refName: item.item.headRefName ?? "",
githubPrNumber: item.item.number,
};
}
}