| ... | @@ -1,6 +1,5 @@ | ... | @@ -1,6 +1,5 @@ |
| 1 | import { | 1 | import { |
| 2 | PROVIDER_SEND_TURN_MAX_INPUT_CHARS, | 2 | PROVIDER_SEND_TURN_MAX_INPUT_CHARS, |
| 3 | type GitRunStackedActionResult, | | |
| 4 | type GitStackedAction, | 3 | type GitStackedAction, |
| 5 | type GitStatusResult, | 4 | type GitStatusResult, |
| 6 | type ProviderApprovalDecision, | 5 | type ProviderApprovalDecision, |
| ... | @@ -137,35 +136,6 @@ function derivePendingApprovals(events: ProviderEvent[]): PendingApprovalCard[] | ... | @@ -137,35 +136,6 @@ function derivePendingApprovals(events: ProviderEvent[]): PendingApprovalCard[] |
| 137 | return Array.from(pending.values()); | 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 | export default function ChatView() { | 139 | export default function ChatView() { |
| 170 | const { state, dispatch } = useStore(); | 140 | const { state, dispatch } = useStore(); |
| 171 | const api = useMemo(() => readNativeApi(), []); | 141 | const api = useMemo(() => readNativeApi(), []); |
| ... | @@ -177,7 +147,6 @@ export default function ChatView() { | ... | @@ -177,7 +147,6 @@ export default function ChatView() { |
| 177 | const [isGitMenuOpen, setIsGitMenuOpen] = useState(false); | 147 | const [isGitMenuOpen, setIsGitMenuOpen] = useState(false); |
| 178 | const [isGitActionRunning, setIsGitActionRunning] = useState(false); | 148 | const [isGitActionRunning, setIsGitActionRunning] = useState(false); |
| 179 | const [gitStatus, setGitStatus] = useState<GitStatusResult | null>(null); | 149 | const [gitStatus, setGitStatus] = useState<GitStatusResult | null>(null); |
| 180 | const [gitActionNotice, setGitActionNotice] = useState<string | null>(null); | | |
| 181 | const [gitActionError, setGitActionError] = useState<string | null>(null); | 150 | const [gitActionError, setGitActionError] = useState<string | null>(null); |
| 182 | const [lastEditor, setLastEditor] = useState<EditorId>(() => { | 151 | const [lastEditor, setLastEditor] = useState<EditorId>(() => { |
| 183 | const stored = localStorage.getItem(LAST_EDITOR_KEY); | 152 | const stored = localStorage.getItem(LAST_EDITOR_KEY); |
| ... | @@ -391,13 +360,11 @@ export default function ChatView() { | ... | @@ -391,13 +360,11 @@ export default function ChatView() { |
| 391 | setIsGitMenuOpen(false); | 360 | setIsGitMenuOpen(false); |
| 392 | setIsGitActionRunning(true); | 361 | setIsGitActionRunning(true); |
| 393 | setGitActionError(null); | 362 | setGitActionError(null); |
| 394 | setGitActionNotice(null); | | |
| 395 | try { | 363 | try { |
| 396 | const result = await api.git.runStackedAction({ | 364 | await api.git.runStackedAction({ |
| 397 | cwd: actionCwd, | 365 | cwd: actionCwd, |
| 398 | action, | 366 | action, |
| 399 | }); | 367 | }); |
| 400 | setGitActionNotice(summarizeGitActionResult(result)); | | |
| 401 | } catch (error) { | 368 | } catch (error) { |
| 402 | setGitActionError( | 369 | setGitActionError( |
| 403 | error instanceof Error ? error.message : "Git action failed.", | 370 | error instanceof Error ? error.message : "Git action failed.", |
| ... | @@ -462,7 +429,6 @@ export default function ChatView() { | ... | @@ -462,7 +429,6 @@ export default function ChatView() { |
| 462 | const activeWorktreePath = activeThread?.worktreePath; | 429 | const activeWorktreePath = activeThread?.worktreePath; |
| 463 | | 430 | |
| 464 | useEffect(() => { | 431 | useEffect(() => { |
| 465 | setGitActionNotice(null); | | |
| 466 | setGitActionError(null); | 432 | setGitActionError(null); |
| 467 | }, [activeProject?.id, activeWorktreePath]); | 433 | }, [activeProject?.id, activeWorktreePath]); |
| 468 | | 434 | |
| ... | @@ -933,12 +899,6 @@ export default function ChatView() { | ... | @@ -933,12 +899,6 @@ export default function ChatView() { |
| 933 | </div> | 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 | {pendingApprovals.length > 0 && ( | 902 | {pendingApprovals.length > 0 && ( |
| 943 | <div className="mx-4 mt-3 space-y-2"> | 903 | <div className="mx-4 mt-3 space-y-2"> |
| 944 | {pendingApprovals.map((approval) => { | 904 | {pendingApprovals.map((approval) => { |