diff --git a/src/services/command/built-in-commands.ts b/src/services/command/built-in-commands.ts index 5eb3166252..db113c4895 100644 --- a/src/services/command/built-in-commands.ts +++ b/src/services/command/built-in-commands.ts @@ -284,62 +284,6 @@ Please analyze this codebase and create an AGENTS.md file containing: Remember: The goal is to create documentation that enables AI assistants to be immediately productive in this codebase, focusing on project-specific knowledge that isn't obvious from the code structure alone.`, }, - create_pr: { - name: "create-pr", - description: "Create a GitHub pull request from current branch", - content: ` -Stage and commit any outstanding changes, then review the changes made in this branch versus main/master and create a pull request using the gh CLI. - - - -1. Check if there are any unstaged/uncommitted changes: - - Run: git status - - If changes exist, stage and commit them with a descriptive message - -2. Identify the base branch (main or master): - - Check which exists: git branch --list main master - - Use the one that exists as base branch - -3. Get current branch name: - - Run: git branch --show-current - -4. Analyze all changes between current branch and base: - - Run: git diff ...HEAD - - Also get commit messages: git log ..HEAD --oneline - -5. Generate PR title and description: - - Analyze the diff and commit messages - - Create concise, descriptive title (50 chars max) - - Write clear PR description explaining: - * What changed and why - * Key implementation details - * Any breaking changes or important notes - -6. Get repository info: - - Extract from: git remote get-url origin - - Parse to get org/repo format - -7. Check if gh CLI is installed: - - Run: gh --version - - If not found, guide user to install: - * macOS: brew install gh - * Windows: winget install GitHub.cli - * Linux: See https://github.com/cli/cli#installation - * After install: gh auth login - -8. Create the pull request: - - Run: gh pr create --repo --head --title "" --body "" - -9. After successful PR creation: - - Extract PR URL from gh output - - Present success message with: - * Link to the created PR - * Offer to have it reviewed by Roo Code Cloud's PR Reviewer agent - * Link: https://roocode.com/reviewer - -If gh CLI is not installed or authenticated, provide clear setup instructions and wait for user to complete setup before proceeding. -`, - }, } /** diff --git a/src/shared/__tests__/support-prompts.spec.ts b/src/shared/__tests__/support-prompts.spec.ts index ea6a193d5a..e74459c511 100644 --- a/src/shared/__tests__/support-prompts.spec.ts +++ b/src/shared/__tests__/support-prompts.spec.ts @@ -227,6 +227,19 @@ describe("Code Action Prompts", () => { }) }) + describe("CREATE_PR prompt", () => { + it("should return default template when no custom prompts provided", () => { + const template = supportPrompt.get(undefined, "CREATE_PR") + expect(template).toBe(supportPrompt.default.CREATE_PR) + }) + + it("should create CREATE_PR prompt containing key instructions", () => { + const prompt = supportPrompt.create("CREATE_PR", {}, undefined) + expect(prompt).toContain("Stage and commit") + expect(prompt).toContain("gh pr create") + }) + }) + describe("create with custom prompts", () => { it("should use custom template when provided", () => { const customTemplate = "Custom template for ${filePath}" diff --git a/src/shared/support-prompt.ts b/src/shared/support-prompt.ts index 51f4310fc2..64a175e5fa 100644 --- a/src/shared/support-prompt.ts +++ b/src/shared/support-prompt.ts @@ -44,6 +44,7 @@ type SupportPromptType = | "TERMINAL_FIX" | "TERMINAL_EXPLAIN" | "NEW_TASK" + | "CREATE_PR" const supportPromptConfigs: Record = { ENHANCE: { @@ -174,6 +175,60 @@ Please provide: NEW_TASK: { template: `\${userInput}`, }, + CREATE_PR: { + template: ` +Stage and commit any outstanding changes, then review the changes made in this branch versus main/master and create a pull request using the gh CLI. + + + +1. Check if there are any unstaged/uncommitted changes: + - Run: git status + - If changes exist, stage and commit them with a descriptive message + +2. Identify the base branch (main or master): + - Check which exists: git branch --list main master + - Use the one that exists as base branch + +3. Get current branch name: + - Run: git branch --show-current + +4. Analyze all changes between current branch and base: + - Run: git diff ...HEAD + - Also get commit messages: git log ..HEAD --oneline + +5. Generate PR title and description: + - Analyze the diff and commit messages + - Create concise, descriptive title (50 chars max) + - Write clear PR description explaining: + * What changed and why + * Key implementation details + * Any breaking changes or important notes + +6. Get repository info: + - Extract from: git remote get-url origin + - Parse to get org/repo format + +7. Check if gh CLI is installed: + - Run: gh --version + - If not found, guide user to install: + * macOS: brew install gh + * Windows: winget install GitHub.cli + * Linux: See https://github.com/cli/cli#installation + * After install: gh auth login + +8. Create the pull request: + - Run: gh pr create --repo --head --title "" --body "" + +9. After successful PR creation: + - Extract PR URL from gh output + - Present success message with: + * Link to the created PR + * Offer to have it reviewed by Roo Code Cloud's PR Reviewer agent + * Link: https://roocode.com/reviewer + +If gh CLI is not installed or authenticated, provide clear setup instructions and wait for user to complete setup before proceeding. +`, + }, } as const export const supportPrompt = { diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index c3b06e05e0..331ebf5515 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -59,6 +59,7 @@ import DismissibleUpsell from "../common/DismissibleUpsell" import { useCloudUpsell } from "@src/hooks/useCloudUpsell" import { Cloud } from "lucide-react" import { safeJsonParse } from "../../../../src/shared/safeJsonParse" +import { supportPrompt } from "@roo/support-prompt" export interface ChatViewProps { isHidden: boolean @@ -126,6 +127,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction