From 1d2a06998c51d85e47814437af343da5225d5a00 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Thu, 26 Feb 2026 18:49:22 +0000 Subject: [PATCH] Draft PRs --- entry | 12 +++++++++--- mcp/pr.ts | 7 ++++++- modes.ts | 2 ++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/entry b/entry index 43f8f8c..a193561 100755 --- a/entry +++ b/entry @@ -143094,7 +143094,10 @@ function SetOutputTool(ctx) { var PullRequest = type({ title: type.string.describe("the title of the pull request"), body: type.string.describe("the body content of the pull request"), - base: type.string.describe("the base branch to merge into (e.g., 'main')") + base: type.string.describe("the base branch to merge into (e.g., 'main')"), + "draft?": type.boolean.describe( + "if true, create the pull request as a draft. use when the user explicitly asks for a draft PR." + ) }); function buildPrBodyWithFooter(ctx, body) { const footer = buildPullfrogFooter({ @@ -143145,10 +143148,11 @@ function CreatePullRequestTool(ctx) { title: params.title, body: bodyWithFooter, head: currentBranch, - base: params.base + base: params.base, + draft: params.draft ?? false }); const reviewer = ctx.payload.triggeringUser; - if (reviewer) { + if (reviewer && !params.draft) { try { log.debug(`requesting review from ${reviewer} on PR #${result.data.number}`); await ctx.octokit.rest.pulls.requestReviewers({ @@ -144466,6 +144470,7 @@ function computeModes() { 9. **PR** - Determine whether to create a PR (if not already on a PR branch): - **Default behavior**: Create a PR using ${ghPullfrogMcpName}/create_pull_request with an informative title and body. If you are working in the context of an issue (check EVENT DATA for \`issue_number\` where \`is_pr\` is not true), include "Closes #" in the PR body to auto-close the issue when merged. + - **Draft PR request**: If the user explicitly asks for a draft PR (e.g. "draft PR", "create as draft", "WIP"), create a PR with \`draft: true\`. - **Branch-only request**: If the user explicitly asks for a branch without a PR (e.g. "don't create a PR", "branch only", "just create a branch"), do NOT create a PR. Simply push the branch and report the branch link. 10. **FINAL REPORT** - Call report_progress one final time ONLY if you haven't already included all the important information (PR links, branch links, summary) in a previous report_progress call. If you already called report_progress with complete information including PR links after creating the PR, you do NOT need to call it again. Only make a final call if you need to add missing information. When making the final call, ensure it includes: @@ -144643,6 +144648,7 @@ Your job is to fix issues THIS PR introduced, not to fix all CI failures. If in - Commit your changes with \`${ghPullfrogMcpName}/git\` (\`git add .\` then \`git commit -m "message"\`), then push with \`${ghPullfrogMcpName}/push_branch\`. Do NOT use \`git push\` directly - it requires credentials that only the MCP tool provides. - Determine whether to create a PR: - **Default behavior**: Create a PR using ${ghPullfrogMcpName}/create_pull_request with an informative title and body. If you are working in the context of an issue (check EVENT DATA for \`issue_number\` where \`is_pr\` is not true), include "Closes #" in the PR body to auto-close the issue when merged. + - **Draft PR request**: If the user explicitly asks for a draft PR (e.g. "draft PR", "create as draft", "WIP"), create a PR with \`draft: true\`. - **Branch-only request**: If the user explicitly asks for a branch without a PR (e.g. "don't create a PR", "branch only", "just create a branch"), do NOT create a PR. Simply push the branch and report the branch link. 5. **PROGRESS** - ${reportProgressInstruction} diff --git a/mcp/pr.ts b/mcp/pr.ts index 5a9db64..cdd88d0 100644 --- a/mcp/pr.ts +++ b/mcp/pr.ts @@ -9,6 +9,9 @@ export const PullRequest = type({ title: type.string.describe("the title of the pull request"), body: type.string.describe("the body content of the pull request"), base: type.string.describe("the base branch to merge into (e.g., 'main')"), + "draft?": type.boolean.describe( + "if true, create the pull request as a draft. use when the user explicitly asks for a draft PR." + ), }); function buildPrBodyWithFooter(ctx: ToolContext, body: string): string { @@ -71,11 +74,13 @@ export function CreatePullRequestTool(ctx: ToolContext) { body: bodyWithFooter, head: currentBranch, base: params.base, + draft: params.draft ?? false, }); // best-effort: request review from the user who triggered the workflow + // skip for draft PRs since they're not ready for review const reviewer = ctx.payload.triggeringUser; - if (reviewer) { + if (reviewer && !params.draft) { try { log.debug(`requesting review from ${reviewer} on PR #${result.data.number}`); await ctx.octokit.rest.pulls.requestReviewers({ diff --git a/modes.ts b/modes.ts index 22b9e41..c871931 100644 --- a/modes.ts +++ b/modes.ts @@ -51,6 +51,7 @@ export function computeModes(): Mode[] { 9. **PR** - Determine whether to create a PR (if not already on a PR branch): - **Default behavior**: Create a PR using ${ghPullfrogMcpName}/create_pull_request with an informative title and body. If you are working in the context of an issue (check EVENT DATA for \`issue_number\` where \`is_pr\` is not true), include "Closes #" in the PR body to auto-close the issue when merged. + - **Draft PR request**: If the user explicitly asks for a draft PR (e.g. "draft PR", "create as draft", "WIP"), create a PR with \`draft: true\`. - **Branch-only request**: If the user explicitly asks for a branch without a PR (e.g. "don't create a PR", "branch only", "just create a branch"), do NOT create a PR. Simply push the branch and report the branch link. 10. **FINAL REPORT** - Call report_progress one final time ONLY if you haven't already included all the important information (PR links, branch links, summary) in a previous report_progress call. If you already called report_progress with complete information including PR links after creating the PR, you do NOT need to call it again. Only make a final call if you need to add missing information. When making the final call, ensure it includes: @@ -233,6 +234,7 @@ Your job is to fix issues THIS PR introduced, not to fix all CI failures. If in - Commit your changes with \`${ghPullfrogMcpName}/git\` (\`git add .\` then \`git commit -m "message"\`), then push with \`${ghPullfrogMcpName}/push_branch\`. Do NOT use \`git push\` directly - it requires credentials that only the MCP tool provides. - Determine whether to create a PR: - **Default behavior**: Create a PR using ${ghPullfrogMcpName}/create_pull_request with an informative title and body. If you are working in the context of an issue (check EVENT DATA for \`issue_number\` where \`is_pr\` is not true), include "Closes #" in the PR body to auto-close the issue when merged. + - **Draft PR request**: If the user explicitly asks for a draft PR (e.g. "draft PR", "create as draft", "WIP"), create a PR with \`draft: true\`. - **Branch-only request**: If the user explicitly asks for a branch without a PR (e.g. "don't create a PR", "branch only", "just create a branch"), do NOT create a PR. Simply push the branch and report the branch link. 5. **PROGRESS** - ${reportProgressInstruction}