/**
* PR Commands
* Manage pull requests from the CLI
*/
import chalk from "chalk";
import { Command } from "commander";
import inquirer from "inquirer";
import ora from "ora";
import { simpleGit } from "simple-git";
import { getWithAuth, patchWithAuth, postWithAuth } from "../../lib/api.js";
import { getConfig } from "../../lib/config.js";
import { getRepoInfoFromGit } from "../../lib/git.js";
const git = simpleGit();
interface PullRequest {
id: string;
number: number;
title: string;
state: string;
author: { username: string };
sourceBranch: string;
targetBranch: string;
createdAt: string;
updatedAt: string;
isDraft: boolean;
additions?: number;
deletions?: number;
changedFiles?: number;
}
export const prCommands = new Command("pr").description("Manage pull requests");
// Get repo info from git remote
async function getRepoInfo() {
return getRepoInfoFromGit(git);
}
// PR Create
prCommands
.command("create")
.description("Create a new pull request")
.option("-t, --title
", "PR title")
.option("-b, --body ", "PR description")
.option("-B, --base ", "Base branch", "main")
.option("-d, --draft", "Create as draft PR")
.option("-a, --assignee ", "Assign to user")
.option(
"-l, --label