@devries-cameron20 / t3code-1 / commits / 170c3a7162
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Fix push-only progress stages in Git action toasts

- Move `buildGitActionProgressStages` into shared logic for reuse and tests - Add `forcePushOnly` path so push actions show only `Pushing...` - Cover push-only and commit+push stage behavior with new logic tests

Julius Marminge committed Feb 14, 2026 at 23:55 UTC 170c3a7162525df90164e118023e3bc8bb97dda0
3 files changed +62 -23
apps/web/src/components/GitActionsControl.logic.test.ts
+22
@@ -1,6 +1,7 @@
1 import type { GitStatusResult } from "@t3tools/contracts";
2 import { assert, describe, it } from "vitest";
3 import {
4 + buildGitActionProgressStages,
5 buildMenuItems,
6 requiresDefaultBranchConfirmation,
7 resolveQuickAction,
@@ -596,6 +597,27 @@ describe("requiresDefaultBranchConfirmation", () => {
597 });
598 });
599
600 +describe("buildGitActionProgressStages", () => {
601 + it("shows only push progress when push-only is forced", () => {
602 + const stages = buildGitActionProgressStages({
603 + action: "commit_push",
604 + hasCustomCommitMessage: false,
605 + hasWorkingTreeChanges: true,
606 + forcePushOnly: true,
607 + });
608 + assert.deepEqual(stages, ["Pushing..."]);
609 + });
610 +
611 + it("includes commit stages for commit+push when working tree is dirty", () => {
612 + const stages = buildGitActionProgressStages({
613 + action: "commit_push",
614 + hasCustomCommitMessage: false,
615 + hasWorkingTreeChanges: true,
616 + });
617 + assert.deepEqual(stages, ["Generating commit message...", "Committing...", "Pushing..."]);
618 + });
619 +});
620 +
621 describe("summarizeGitResult", () => {
622 it("returns commit-focused toast for commit action", () => {
623 const result = summarizeGitResult({
apps/web/src/components/GitActionsControl.logic.ts
+22
@@ -43,6 +43,28 @@ function truncateText(
43 return `${value.slice(0, Math.max(0, maxLength - 3)).trimEnd()}...`;
44 }
45
46 +export function buildGitActionProgressStages(input: {
47 + action: GitStackedAction;
48 + hasCustomCommitMessage: boolean;
49 + hasWorkingTreeChanges: boolean;
50 + forcePushOnly?: boolean;
51 +}): string[] {
52 + const shouldIncludeCommitStages =
53 + !input.forcePushOnly && (input.action === "commit" || input.hasWorkingTreeChanges);
54 + const commitStages = !shouldIncludeCommitStages
55 + ? []
56 + : input.hasCustomCommitMessage
57 + ? ["Committing..."]
58 + : ["Generating commit message...", "Committing..."];
59 + if (input.action === "commit") {
60 + return commitStages;
61 + }
62 + if (input.action === "commit_push") {
63 + return [...commitStages, "Pushing..."];
64 + }
65 + return [...commitStages, "Pushing...", "Creating PR..."];
66 +}
67 +
68 export function summarizeGitResult(result: GitRunStackedActionResult): {
69 title: string;
70 description?: string;
apps/web/src/components/GitActionsControl.tsx
+18 -23
@@ -4,6 +4,7 @@ import { useCallback, useMemo, useState } from "react";
4 import { ChevronDownIcon, CloudUploadIcon, GitCommitIcon, InfoIcon } from "lucide-react";
5 import { GitHubIcon } from "./Icons";
6 import {
7 + buildGitActionProgressStages,
8 buildMenuItems,
9 type GitActionIconName,
10 type GitActionMenuItem,
@@ -134,26 +135,6 @@ function GitQuickActionIcon({ quickAction }: { quickAction: GitQuickAction }) {
135 return <InfoIcon className={iconClassName} />;
136 }
137
137 -function buildGitActionProgressStages(input: {
138 - action: GitStackedAction;
139 - hasCustomCommitMessage: boolean;
140 - hasWorkingTreeChanges: boolean;
141 -}): string[] {
142 - const shouldIncludeCommitStages = input.action === "commit" || input.hasWorkingTreeChanges;
143 - const commitStages = !shouldIncludeCommitStages
144 - ? []
145 - : input.hasCustomCommitMessage
146 - ? ["Committing..."]
147 - : ["Generating commit message...", "Committing..."];
148 - if (input.action === "commit") {
149 - return commitStages;
150 - }
151 - if (input.action === "commit_push") {
152 - return [...commitStages, "Pushing..."];
153 - }
154 - return [...commitStages, "Pushing...", "Creating PR..."];
155 -}
156 -
138 export default function GitActionsControl({ api, gitCwd }: GitActionsControlProps) {
139 const queryClient = useQueryClient();
140 const [activeDialogAction, setActiveDialogAction] = useState<GitDialogAction | null>(null);
@@ -230,7 +211,15 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
211 }, [api, gitStatus?.openPr?.url]);
212
213 const runGitActionWithToast = useCallback(
233 - async ({ action, commitMessage }: { action: GitStackedAction; commitMessage?: string }) => {
214 + async ({
215 + action,
216 + commitMessage,
217 + forcePushOnlyProgress = false,
218 + }: {
219 + action: GitStackedAction;
220 + commitMessage?: string;
221 + forcePushOnlyProgress?: boolean;
222 + }) => {
223 const confirmed = await maybeConfirmPushToDefaultBranch(action);
224 if (!confirmed) return;
225
@@ -238,6 +227,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
227 action,
228 hasCustomCommitMessage: !!commitMessage?.trim(),
229 hasWorkingTreeChanges: !!gitStatus?.hasWorkingTreeChanges,
230 + forcePushOnly: forcePushOnlyProgress,
231 });
232 const progressToastId = toastManager.add({
233 type: "loading",
@@ -290,7 +280,10 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
280 children: "Push",
281 onClick: () => {
282 closeResultToast();
293 - void runGitActionWithToast({ action: "commit_push" });
283 + void runGitActionWithToast({
284 + action: "commit_push",
285 + forcePushOnlyProgress: true,
286 + });
287 },
288 },
289 }
@@ -381,7 +374,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
374 return;
375 }
376 if (item.dialogAction === "push") {
384 - void runGitActionWithToast({ action: "commit_push" });
377 + void runGitActionWithToast({ action: "commit_push", forcePushOnlyProgress: true });
378 return;
379 }
380 if (item.dialogAction) {
@@ -400,10 +393,12 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
393 ? "commit_push"
394 : "commit_push_pr";
395 const commitMessage = activeDialogAction === "commit" ? dialogCommitMessage.trim() : "";
396 + const forcePushOnlyProgress = activeDialogAction === "push";
397 setActiveDialogAction(null);
398 void runGitActionWithToast({
399 action,
400 ...(commitMessage ? { commitMessage } : {}),
401 + ...(forcePushOnlyProgress ? { forcePushOnlyProgress } : {}),
402 });
403 }, [activeDialogAction, dialogCommitMessage, runGitActionWithToast]);
404