UNPKG

github-pr-automation

Version:

MCP server and CLI for automated GitHub PR management, review resolution, and workflow optimization

48 lines 1.77 kB
import { parsePRIdentifier, formatPRIdentifier } from "../../utils/parser.js"; /** * Generate rebase commands after upstream PR was squash-merged * @param client - GitHub client instance * @param input - Input containing PR identifier and optional target branch * @returns Promise resolving to rebase command output */ export async function handleRebaseAfterSquashMerge(client, input) { const pr = parsePRIdentifier(input.pr); const octokit = client.getOctokit(); const { data } = await octokit.pulls.get({ owner: pr.owner, repo: pr.repo, pull_number: pr.number, }); const targetBranch = input.target_branch || data.base.ref; // Basic implementation - enhanced in optimization phase const commands = [ { step: 1, command: "git fetch origin", description: "Fetch latest changes from remote", }, { step: 2, command: `git rebase --onto origin/${targetBranch} <last-upstream-commit> ${data.head.ref}`, description: "Rebase using --onto to skip squash-merged commits (replace <last-upstream-commit> with actual SHA)", }, { step: 3, command: `git push --force-with-lease origin ${data.head.ref}`, description: "Update remote branch", }, ]; return { pr: formatPRIdentifier(pr), analysis: { upstream_pr: input.upstream_pr, detected_squash_merge: false, // Enhanced detection in optimization phase }, commands, summary: { action_required: true, reason: "Manual upstream commit identification needed in this phase", }, }; } //# sourceMappingURL=handler.js.map