| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | import { |
| 2 | 2 | PROVIDER_SEND_TURN_MAX_INPUT_CHARS, |
| 3 | | type GitRunStackedActionResult, |
| 4 | 3 | type GitStackedAction, |
| 5 | 4 | type GitStatusResult, |
| 6 | 5 | type ProviderApprovalDecision, |
| ... | ... | @@ -137,35 +136,6 @@ function derivePendingApprovals(events: ProviderEvent[]): PendingApprovalCard[] |
| 137 | 136 | return Array.from(pending.values()); |
| 138 | 137 | } |
| 139 | 138 | |
| 140 | | function summarizeGitActionResult(result: GitRunStackedActionResult): string { |
| 141 | | const parts: string[] = []; |
| 142 | | |
| 143 | | if (result.commit.status === "created") { |
| 144 | | parts.push(`Committed: ${result.commit.subject ?? "changes saved"}.`); |
| 145 | | } else { |
| 146 | | parts.push("No local changes to commit."); |
| 147 | | } |
| 148 | | |
| 149 | | if (result.push.status === "pushed") { |
| 150 | | const upstream = result.push.upstreamBranch; |
| 151 | | parts.push( |
| 152 | | upstream ? `Pushed to ${upstream}.` : "Pushed to remote branch.", |
| 153 | | ); |
| 154 | | } else if (result.push.status === "skipped_up_to_date") { |
| 155 | | parts.push("Push skipped: branch already up to date."); |
| 156 | | } |
| 157 | | |
| 158 | | if (result.pr.status === "created") { |
| 159 | | parts.push(result.pr.url ? `PR created: ${result.pr.url}` : "PR created."); |
| 160 | | } else if (result.pr.status === "opened_existing") { |
| 161 | | parts.push( |
| 162 | | result.pr.url ? `Opened existing PR: ${result.pr.url}` : "Opened existing PR.", |
| 163 | | ); |
| 164 | | } |
| 165 | | |
| 166 | | return parts.join(" "); |
| 167 | | } |
| 168 | | |
| 169 | 139 | export default function ChatView() { |
| 170 | 140 | const { state, dispatch } = useStore(); |
| 171 | 141 | const api = useMemo(() => readNativeApi(), []); |
| ... | ... | @@ -177,7 +147,6 @@ export default function ChatView() { |
| 177 | 147 | const [isGitMenuOpen, setIsGitMenuOpen] = useState(false); |
| 178 | 148 | const [isGitActionRunning, setIsGitActionRunning] = useState(false); |
| 179 | 149 | const [gitStatus, setGitStatus] = useState<GitStatusResult | null>(null); |
| 180 | | const [gitActionNotice, setGitActionNotice] = useState<string | null>(null); |
| 181 | 150 | const [gitActionError, setGitActionError] = useState<string | null>(null); |
| 182 | 151 | const [lastEditor, setLastEditor] = useState<EditorId>(() => { |
| 183 | 152 | const stored = localStorage.getItem(LAST_EDITOR_KEY); |
| ... | ... | @@ -391,13 +360,11 @@ export default function ChatView() { |
| 391 | 360 | setIsGitMenuOpen(false); |
| 392 | 361 | setIsGitActionRunning(true); |
| 393 | 362 | setGitActionError(null); |
| 394 | | setGitActionNotice(null); |
| 395 | 363 | try { |
| 396 | | const result = await api.git.runStackedAction({ |
| 364 | await api.git.runStackedAction({ |
| 397 | 365 | cwd: actionCwd, |
| 398 | 366 | action, |
| 399 | 367 | }); |
| 400 | | setGitActionNotice(summarizeGitActionResult(result)); |
| 401 | 368 | } catch (error) { |
| 402 | 369 | setGitActionError( |
| 403 | 370 | error instanceof Error ? error.message : "Git action failed.", |
| ... | ... | @@ -462,7 +429,6 @@ export default function ChatView() { |
| 462 | 429 | const activeWorktreePath = activeThread?.worktreePath; |
| 463 | 430 | |
| 464 | 431 | useEffect(() => { |
| 465 | | setGitActionNotice(null); |
| 466 | 432 | setGitActionError(null); |
| 467 | 433 | }, [activeProject?.id, activeWorktreePath]); |
| 468 | 434 | |
| ... | ... | @@ -933,12 +899,6 @@ export default function ChatView() { |
| 933 | 899 | </div> |
| 934 | 900 | )} |
| 935 | 901 | |
| 936 | | {gitActionNotice && ( |
| 937 | | <div className="mx-4 mt-3 rounded-lg border border-emerald-200 bg-emerald-50 px-3 py-2 text-xs text-emerald-800 dark:border-emerald-400/20 dark:bg-emerald-500/[0.08] dark:text-emerald-100"> |
| 938 | | {gitActionNotice} |
| 939 | | </div> |
| 940 | | )} |
| 941 | | |
| 942 | 902 | {pendingApprovals.length > 0 && ( |
| 943 | 903 | <div className="mx-4 mt-3 space-y-2"> |
| 944 | 904 | {pendingApprovals.map((approval) => { |