diff --git a/webview-ui/src/i18n/locales/ar/agentManager.json b/webview-ui/src/i18n/locales/ar/agentManager.json index 42061a4f113..137d1633170 100644 --- a/webview-ui/src/i18n/locales/ar/agentManager.json +++ b/webview-ui/src/i18n/locales/ar/agentManager.json @@ -84,6 +84,7 @@ "cancelTitle": "إلغاء الوكيل", "finishToBranchTitle": "إنهاء worktree والتحضير للـ branch: {{branch}}", "finishToBranchTitleNoBranch": "إنهاء worktree والتحضير للـ branch", + "createPRTitle": "إنشاء طلب سحب", "sendTitle": "إرسال الرسالة", "resumeTitle": "استئناف الوكيل", "hint": "اضغط Enter للإرسال، Shift+Enter لسطر جديد" diff --git a/webview-ui/src/i18n/locales/ca/agentManager.json b/webview-ui/src/i18n/locales/ca/agentManager.json index 72b852e6f7c..7c8fcae893a 100644 --- a/webview-ui/src/i18n/locales/ca/agentManager.json +++ b/webview-ui/src/i18n/locales/ca/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Cancel·lar agent", "finishToBranchTitle": "Finalitza worktree i prepara branch: {{branch}}", "finishToBranchTitleNoBranch": "Finalitza worktree i prepara branch", + "createPRTitle": "Crear pull request", "sendTitle": "Enviar missatge", "resumeTitle": "Reprendre agent", "hint": "Prem Enter per enviar, Shift+Enter per nova línia" diff --git a/webview-ui/src/i18n/locales/cs/agentManager.json b/webview-ui/src/i18n/locales/cs/agentManager.json index c74102563db..b8c57ea5b02 100644 --- a/webview-ui/src/i18n/locales/cs/agentManager.json +++ b/webview-ui/src/i18n/locales/cs/agentManager.json @@ -81,6 +81,7 @@ "cancelTitle": "Zrušit agenta", "finishToBranchTitle": "Dokončit worktree a připravit branch: {{branch}}", "finishToBranchTitleNoBranch": "Dokončit worktree a připravit branch", + "createPRTitle": "Vytvořit pull request", "sendTitle": "Odeslat zprávu", "resumeTitle": "Obnovit agenta", "hint": "Enter pro odeslání, Shift+Enter pro nový řádek" diff --git a/webview-ui/src/i18n/locales/de/agentManager.json b/webview-ui/src/i18n/locales/de/agentManager.json index fc0d6a750f6..ebc235c5aa5 100644 --- a/webview-ui/src/i18n/locales/de/agentManager.json +++ b/webview-ui/src/i18n/locales/de/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Agent abbrechen", "finishToBranchTitle": "Worktree beenden und Branch vorbereiten: {{branch}}", "finishToBranchTitleNoBranch": "Worktree beenden und Branch vorbereiten", + "createPRTitle": "Pull Request erstellen", "sendTitle": "Nachricht senden", "resumeTitle": "Agent fortsetzen", "hint": "Enter zum Senden, Shift+Enter für neue Zeile" diff --git a/webview-ui/src/i18n/locales/en/agentManager.json b/webview-ui/src/i18n/locales/en/agentManager.json index f1d452de587..76009c527ab 100644 --- a/webview-ui/src/i18n/locales/en/agentManager.json +++ b/webview-ui/src/i18n/locales/en/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Cancel agent", "finishToBranchTitle": "Finish worktree and prepare branch: {{branch}}", "finishToBranchTitleNoBranch": "Finish worktree and prepare branch", + "createPRTitle": "Create pull request", "sendTitle": "Send message", "resumeTitle": "Resume agent", "hint": "Press Enter to send, Shift+Enter for new line" diff --git a/webview-ui/src/i18n/locales/es/agentManager.json b/webview-ui/src/i18n/locales/es/agentManager.json index e839de0590a..f4004153caa 100644 --- a/webview-ui/src/i18n/locales/es/agentManager.json +++ b/webview-ui/src/i18n/locales/es/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Cancelar agente", "finishToBranchTitle": "Finalizar worktree y preparar branch: {{branch}}", "finishToBranchTitleNoBranch": "Finalizar worktree y preparar branch", + "createPRTitle": "Crear pull request", "sendTitle": "Enviar mensaje", "resumeTitle": "Reanudar agente", "hint": "Pulsa Enter para enviar, Shift+Enter para nueva línea" diff --git a/webview-ui/src/i18n/locales/fr/agentManager.json b/webview-ui/src/i18n/locales/fr/agentManager.json index 18306e6213d..a8585d8d949 100644 --- a/webview-ui/src/i18n/locales/fr/agentManager.json +++ b/webview-ui/src/i18n/locales/fr/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Annuler l'agent", "finishToBranchTitle": "Terminer le worktree et préparer la branch : {{branch}}", "finishToBranchTitleNoBranch": "Terminer le worktree et préparer la branch", + "createPRTitle": "Créer une pull request", "sendTitle": "Envoyer le message", "resumeTitle": "Reprendre l'agent", "hint": "Entrée pour envoyer, Shift+Entrée pour nouvelle ligne" diff --git a/webview-ui/src/i18n/locales/hi/agentManager.json b/webview-ui/src/i18n/locales/hi/agentManager.json index 25debc72c47..e2de90e117f 100644 --- a/webview-ui/src/i18n/locales/hi/agentManager.json +++ b/webview-ui/src/i18n/locales/hi/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "एजेंट रद्द करें", "finishToBranchTitle": "Worktree समाप्त करें और branch तैयार करें: {{branch}}", "finishToBranchTitleNoBranch": "Worktree समाप्त करें और branch तैयार करें", + "createPRTitle": "Pull request बनाएं", "sendTitle": "संदेश भेजें", "resumeTitle": "एजेंट फिर से शुरू करें", "hint": "भेजने के लिए Enter दबाएं, नई लाइन के लिए Shift+Enter" diff --git a/webview-ui/src/i18n/locales/id/agentManager.json b/webview-ui/src/i18n/locales/id/agentManager.json index 152f8b90718..bfa9362002f 100644 --- a/webview-ui/src/i18n/locales/id/agentManager.json +++ b/webview-ui/src/i18n/locales/id/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Batalkan agen", "finishToBranchTitle": "Selesaikan worktree dan siapkan branch: {{branch}}", "finishToBranchTitleNoBranch": "Selesaikan worktree dan siapkan branch", + "createPRTitle": "Buat pull request", "sendTitle": "Kirim pesan", "resumeTitle": "Lanjutkan agen", "hint": "Tekan Enter untuk mengirim, Shift+Enter untuk baris baru" diff --git a/webview-ui/src/i18n/locales/it/agentManager.json b/webview-ui/src/i18n/locales/it/agentManager.json index 4037b9b2019..01ad84e6b20 100644 --- a/webview-ui/src/i18n/locales/it/agentManager.json +++ b/webview-ui/src/i18n/locales/it/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Annulla agente", "finishToBranchTitle": "Termina worktree e prepara branch: {{branch}}", "finishToBranchTitleNoBranch": "Termina worktree e prepara branch", + "createPRTitle": "Crea pull request", "sendTitle": "Invia messaggio", "resumeTitle": "Riprendi agente", "hint": "Premi Invio per inviare, Shift+Invio per nuova riga" diff --git a/webview-ui/src/i18n/locales/ja/agentManager.json b/webview-ui/src/i18n/locales/ja/agentManager.json index fcec7994083..c132761e182 100644 --- a/webview-ui/src/i18n/locales/ja/agentManager.json +++ b/webview-ui/src/i18n/locales/ja/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "エージェントをキャンセル", "finishToBranchTitle": "Worktreeを終了してブランチを準備: {{branch}}", "finishToBranchTitleNoBranch": "Worktreeを終了してブランチを準備", + "createPRTitle": "プルリクエストを作成", "sendTitle": "メッセージを送信", "resumeTitle": "エージェントを再開", "hint": "Enterで送信、Shift+Enterで改行" diff --git a/webview-ui/src/i18n/locales/ko/agentManager.json b/webview-ui/src/i18n/locales/ko/agentManager.json index 440d5bf0cf1..7df80d870e0 100644 --- a/webview-ui/src/i18n/locales/ko/agentManager.json +++ b/webview-ui/src/i18n/locales/ko/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "에이전트 취소", "finishToBranchTitle": "Worktree 완료 및 브랜치 준비: {{branch}}", "finishToBranchTitleNoBranch": "Worktree 완료 및 브랜치 준비", + "createPRTitle": "Pull request 생성", "sendTitle": "메시지 보내기", "resumeTitle": "에이전트 재개", "hint": "Enter로 전송, Shift+Enter로 줄 바꿈" diff --git a/webview-ui/src/i18n/locales/nl/agentManager.json b/webview-ui/src/i18n/locales/nl/agentManager.json index 47fe692c0cd..a9499df8bea 100644 --- a/webview-ui/src/i18n/locales/nl/agentManager.json +++ b/webview-ui/src/i18n/locales/nl/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Agent annuleren", "finishToBranchTitle": "Voltooi worktree en bereid branch voor: {{branch}}", "finishToBranchTitleNoBranch": "Voltooi worktree en bereid branch voor", + "createPRTitle": "Pull request maken", "sendTitle": "Bericht verzenden", "resumeTitle": "Agent hervatten", "hint": "Druk Enter om te verzenden, Shift+Enter voor nieuwe regel" diff --git a/webview-ui/src/i18n/locales/pl/agentManager.json b/webview-ui/src/i18n/locales/pl/agentManager.json index 09d72fe03cf..2e7c7d56df9 100644 --- a/webview-ui/src/i18n/locales/pl/agentManager.json +++ b/webview-ui/src/i18n/locales/pl/agentManager.json @@ -82,6 +82,7 @@ "cancelTitle": "Anuluj agenta", "finishToBranchTitle": "Zakończ worktree i przygotuj branch: {{branch}}", "finishToBranchTitleNoBranch": "Zakończ worktree i przygotuj branch", + "createPRTitle": "Utwórz pull request", "sendTitle": "Wyślij wiadomość", "resumeTitle": "Wznów agenta", "hint": "Enter aby wysłać, Shift+Enter dla nowej linii" diff --git a/webview-ui/src/i18n/locales/pt-BR/agentManager.json b/webview-ui/src/i18n/locales/pt-BR/agentManager.json index f4e1f415bbf..d7011b9a763 100644 --- a/webview-ui/src/i18n/locales/pt-BR/agentManager.json +++ b/webview-ui/src/i18n/locales/pt-BR/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Cancelar agente", "finishToBranchTitle": "Finalizar worktree e preparar branch: {{branch}}", "finishToBranchTitleNoBranch": "Finalizar worktree e preparar branch", + "createPRTitle": "Criar pull request", "sendTitle": "Enviar mensagem", "resumeTitle": "Retomar agente", "hint": "Pressione Enter para enviar, Shift+Enter para nova linha" diff --git a/webview-ui/src/i18n/locales/ru/agentManager.json b/webview-ui/src/i18n/locales/ru/agentManager.json index b25411abd30..cf4af606f59 100644 --- a/webview-ui/src/i18n/locales/ru/agentManager.json +++ b/webview-ui/src/i18n/locales/ru/agentManager.json @@ -82,6 +82,7 @@ "cancelTitle": "Отменить агента", "finishToBranchTitle": "Завершить worktree и подготовить branch: {{branch}}", "finishToBranchTitleNoBranch": "Завершить worktree и подготовить branch", + "createPRTitle": "Создать pull request", "sendTitle": "Отправить сообщение", "resumeTitle": "Возобновить агента", "hint": "Enter для отправки, Shift+Enter для новой строки" diff --git a/webview-ui/src/i18n/locales/th/agentManager.json b/webview-ui/src/i18n/locales/th/agentManager.json index 1185e2ea78d..a52b92320ff 100644 --- a/webview-ui/src/i18n/locales/th/agentManager.json +++ b/webview-ui/src/i18n/locales/th/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "ยกเลิกเอเจนต์", "finishToBranchTitle": "เสร็จสิ้น worktree และเตรียม branch: {{branch}}", "finishToBranchTitleNoBranch": "เสร็จสิ้น worktree และเตรียม branch", + "createPRTitle": "สร้าง pull request", "sendTitle": "ส่งข้อความ", "resumeTitle": "ดำเนินการต่อ", "hint": "กด Enter เพื่อส่ง, Shift+Enter สำหรับบรรทัดใหม่" diff --git a/webview-ui/src/i18n/locales/tr/agentManager.json b/webview-ui/src/i18n/locales/tr/agentManager.json index c940da503f5..3202a05ba04 100644 --- a/webview-ui/src/i18n/locales/tr/agentManager.json +++ b/webview-ui/src/i18n/locales/tr/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Ajanı iptal et", "finishToBranchTitle": "Worktree'yi bitir ve branch hazırla: {{branch}}", "finishToBranchTitleNoBranch": "Worktree'yi bitir ve branch hazırla", + "createPRTitle": "Pull request oluştur", "sendTitle": "Mesaj gönder", "resumeTitle": "Ajanı devam ettir", "hint": "Göndermek için Enter, yeni satır için Shift+Enter" diff --git a/webview-ui/src/i18n/locales/uk/agentManager.json b/webview-ui/src/i18n/locales/uk/agentManager.json index a137e9bd738..7f1d705d3f4 100644 --- a/webview-ui/src/i18n/locales/uk/agentManager.json +++ b/webview-ui/src/i18n/locales/uk/agentManager.json @@ -82,6 +82,7 @@ "cancelTitle": "Скасувати агента", "finishToBranchTitle": "Завершити worktree та підготувати branch: {{branch}}", "finishToBranchTitleNoBranch": "Завершити worktree та підготувати branch", + "createPRTitle": "Створити pull request", "sendTitle": "Надіслати повідомлення", "resumeTitle": "Відновити агента", "hint": "Enter для надсилання, Shift+Enter для нового рядка" diff --git a/webview-ui/src/i18n/locales/vi/agentManager.json b/webview-ui/src/i18n/locales/vi/agentManager.json index 44b6629429f..aa1264d670d 100644 --- a/webview-ui/src/i18n/locales/vi/agentManager.json +++ b/webview-ui/src/i18n/locales/vi/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "Hủy agent", "finishToBranchTitle": "Hoàn tất worktree và chuẩn bị branch: {{branch}}", "finishToBranchTitleNoBranch": "Hoàn tất worktree và chuẩn bị branch", + "createPRTitle": "Tạo pull request", "sendTitle": "Gửi tin nhắn", "resumeTitle": "Tiếp tục agent", "hint": "Nhấn Enter để gửi, Shift+Enter để xuống dòng" diff --git a/webview-ui/src/i18n/locales/zh-CN/agentManager.json b/webview-ui/src/i18n/locales/zh-CN/agentManager.json index 29f826375d2..dac9bfd0de8 100644 --- a/webview-ui/src/i18n/locales/zh-CN/agentManager.json +++ b/webview-ui/src/i18n/locales/zh-CN/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "取消代理", "finishToBranchTitle": "完成 Worktree 并准备分支:{{branch}}", "finishToBranchTitleNoBranch": "完成 Worktree 并准备分支", + "createPRTitle": "创建 Pull Request", "sendTitle": "发送消息", "resumeTitle": "继续代理", "hint": "按 Enter 发送,Shift+Enter 换行" diff --git a/webview-ui/src/i18n/locales/zh-TW/agentManager.json b/webview-ui/src/i18n/locales/zh-TW/agentManager.json index 96d733564ec..cb34fa911c5 100644 --- a/webview-ui/src/i18n/locales/zh-TW/agentManager.json +++ b/webview-ui/src/i18n/locales/zh-TW/agentManager.json @@ -80,6 +80,7 @@ "cancelTitle": "取消代理", "finishToBranchTitle": "完成 Worktree 並準備分支:{{branch}}", "finishToBranchTitleNoBranch": "完成 Worktree 並準備分支", + "createPRTitle": "建立 Pull Request", "sendTitle": "傳送訊息", "resumeTitle": "繼續代理", "hint": "按 Enter 傳送,Shift+Enter 換行" diff --git a/webview-ui/src/kilocode/agent-manager/components/ChatInput.tsx b/webview-ui/src/kilocode/agent-manager/components/ChatInput.tsx index 7fc36d5f130..19adc1785d0 100644 --- a/webview-ui/src/kilocode/agent-manager/components/ChatInput.tsx +++ b/webview-ui/src/kilocode/agent-manager/components/ChatInput.tsx @@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from "react" import { useAtom, useAtomValue, useSetAtom } from "jotai" import { useTranslation } from "react-i18next" import { vscode } from "../utils/vscode" -import { GitBranch, SendHorizontal, Square } from "lucide-react" +import { GitBranch, GitPullRequest, SendHorizontal, Square } from "lucide-react" import DynamicTextArea from "react-textarea-autosize" import { cn } from "../../../lib/utils" import { StandardTooltip } from "../../../components/ui" @@ -17,7 +17,9 @@ interface ChatInputProps { isActive?: boolean showCancel?: boolean showFinishToBranch?: boolean + showCreatePR?: boolean worktreeBranchName?: string + parentBranch?: string sessionStatus?: "creating" | "running" | "done" | "error" | "stopped" } @@ -27,7 +29,9 @@ export const ChatInput: React.FC = ({ isActive = false, showCancel = false, showFinishToBranch = false, + showCreatePR = false, worktreeBranchName, + parentBranch, sessionStatus, }) => { const { t } = useTranslation("agentManager") @@ -96,6 +100,72 @@ export const ChatInput: React.FC = ({ }) } + const handleCreatePR = () => { + const branch = worktreeBranchName || "current-branch" + const targetBranch = parentBranch || "main" + + const instructions = `The user wants to create a pull request. + +Local branch: ${branch} +Target branch: origin/${targetBranch} + +Follow these steps: + +1. First, verify gh CLI is ready by running: gh auth status + - If gh is not installed, ask the user to install it: https://cli.github.com/ + - If not authenticated, ask the user to run: gh auth login + - Do not proceed until gh is ready. + +2. Run git status to check for uncommitted changes + +3. Run git diff to understand what changes exist (both staged and unstaged) + +4. Based on the changes, prepare suggestions for the user: + - Propose a CLEAN branch name following conventions (e.g., feat/description, fix/description, docs/description) + Do NOT suggest the auto-generated local branch name "${branch}" - always propose a better name. + - Propose a descriptive commit message (if there are uncommitted changes) + - Propose a PR title (under 80 chars) + - Propose a PR description (concise summary) + +5. STOP and present your suggestions to the user. Ask them to confirm or edit: + - Branch name for the PR (your clean suggestion, not the auto-generated one) + - Commit message (if applicable) + - PR title + - PR description + + DO NOT commit, push, or create the PR until the user explicitly confirms. + +6. Once the user confirms, execute in this order: + a. If there are uncommitted changes, commit with the confirmed message + b. Push to origin with the confirmed branch name: + git push origin ${branch}: + c. Create the PR: gh pr create --base ${targetBranch} --head --title "" --body "" + +If any step fails, ask the user for help.` + + if (isSessionCompleted) { + // Resume session with PR instructions + vscode.postMessage({ + type: "agentManager.resumeSession", + sessionId, + sessionLabel, + content: instructions, + }) + } else { + // Queue message for running session + const queuedMsg = addToQueue({ sessionId, content: instructions }) + if (queuedMsg) { + vscode.postMessage({ + type: "agentManager.messageQueued", + sessionId, + messageId: queuedMsg.id, + sessionLabel, + content: instructions, + }) + } + } + } + const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) { e.preventDefault() @@ -200,6 +270,26 @@ export const ChatInput: React.FC = ({ )} + {showCreatePR && ( + + + + )} {isActive && showCancel && (