Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Fix push-only progress stages in Git action toasts
Julius Marminge170c3a716252
diff --git a/apps/web/src/components/GitActionsControl.logic.test.ts b/apps/web/src/components/GitActionsControl.logic.test.tsindex 0bd7e49b3..25ad553d1 100644--- a/apps/web/src/components/GitActionsControl.logic.test.ts+++ b/apps/web/src/components/GitActionsControl.logic.test.ts@@ -1,6 +1,7 @@import type { GitStatusResult } from "@t3tools/contracts";import { assert, describe, it } from "vitest";import {+ buildGitActionProgressStages,buildMenuItems,requiresDefaultBranchConfirmation,resolveQuickAction,@@ -596,6 +597,27 @@ describe("requiresDefaultBranchConfirmation", () => {});});+describe("buildGitActionProgressStages", () => {+ it("shows only push progress when push-only is forced", () => {+ const stages = buildGitActionProgressStages({+ action: "commit_push",+ hasCustomCommitMessage: false,+ hasWorkingTreeChanges: true,+ forcePushOnly: true,+ });+ assert.deepEqual(stages, ["Pushing..."]);+ });++ it("includes commit stages for commit+push when working tree is dirty", () => {+ const stages = buildGitActionProgressStages({+ action: "commit_push",+ hasCustomCommitMessage: false,+ hasWorkingTreeChanges: true,+ });+ assert.deepEqual(stages, ["Generating commit message...", "Committing...", "Pushing..."]);+ });+});+describe("summarizeGitResult", () => {it("returns commit-focused toast for commit action", () => {const result = summarizeGitResult({diff --git a/apps/web/src/components/GitActionsControl.logic.ts b/apps/web/src/components/GitActionsControl.logic.tsindex d00fcbc74..ebab3cbf5 100644--- a/apps/web/src/components/GitActionsControl.logic.ts+++ b/apps/web/src/components/GitActionsControl.logic.ts@@ -43,6 +43,28 @@ function truncateText(return `${value.slice(0, Math.max(0, maxLength - 3)).trimEnd()}...`;}+export function buildGitActionProgressStages(input: {+ action: GitStackedAction;+ hasCustomCommitMessage: boolean;+ hasWorkingTreeChanges: boolean;+ forcePushOnly?: boolean;+}): string[] {+ const shouldIncludeCommitStages =+ !input.forcePushOnly && (input.action === "commit" || input.hasWorkingTreeChanges);+ const commitStages = !shouldIncludeCommitStages+ ? []+ : input.hasCustomCommitMessage+ ? ["Committing..."]+ : ["Generating commit message...", "Committing..."];+ if (input.action === "commit") {+ return commitStages;+ }+ if (input.action === "commit_push") {+ return [...commitStages, "Pushing..."];+ }+ return [...commitStages, "Pushing...", "Creating PR..."];+}+export function summarizeGitResult(result: GitRunStackedActionResult): {title: string;description?: string;diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsxindex c9c84f41b..49d3d82a9 100644--- a/apps/web/src/components/GitActionsControl.tsx+++ b/apps/web/src/components/GitActionsControl.tsx@@ -4,6 +4,7 @@ import { useCallback, useMemo, useState } from "react";import { ChevronDownIcon, CloudUploadIcon, GitCommitIcon, InfoIcon } from "lucide-react";import { GitHubIcon } from "./Icons";import {+ buildGitActionProgressStages,buildMenuItems,type GitActionIconName,type GitActionMenuItem,@@ -134,26 +135,6 @@ function GitQuickActionIcon({ quickAction }: { quickAction: GitQuickAction }) {return <InfoIcon className={iconClassName} />;}-function buildGitActionProgressStages(input: {- action: GitStackedAction;- hasCustomCommitMessage: boolean;- hasWorkingTreeChanges: boolean;-}): string[] {- const shouldIncludeCommitStages = input.action === "commit" || input.hasWorkingTreeChanges;- const commitStages = !shouldIncludeCommitStages- ? []- : input.hasCustomCommitMessage- ? ["Committing..."]- : ["Generating commit message...", "Committing..."];- if (input.action === "commit") {- return commitStages;- }- if (input.action === "commit_push") {- return [...commitStages, "Pushing..."];- }- return [...commitStages, "Pushing...", "Creating PR..."];-}-export default function GitActionsControl({ api, gitCwd }: GitActionsControlProps) {const queryClient = useQueryClient();const [activeDialogAction, setActiveDialogAction] = useState<GitDialogAction | null>(null);@@ -230,7 +211,15 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp}, [api, gitStatus?.openPr?.url]);const runGitActionWithToast = useCallback(- async ({ action, commitMessage }: { action: GitStackedAction; commitMessage?: string }) => {+ async ({+ action,+ commitMessage,+ forcePushOnlyProgress = false,+ }: {+ action: GitStackedAction;+ commitMessage?: string;+ forcePushOnlyProgress?: boolean;+ }) => {const confirmed = await maybeConfirmPushToDefaultBranch(action);if (!confirmed) return;@@ -238,6 +227,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlPropaction,hasCustomCommitMessage: !!commitMessage?.trim(),hasWorkingTreeChanges: !!gitStatus?.hasWorkingTreeChanges,+ forcePushOnly: forcePushOnlyProgress,});const progressToastId = toastManager.add({type: "loading",@@ -290,7 +280,10 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlPropchildren: "Push",onClick: () => {closeResultToast();- void runGitActionWithToast({ action: "commit_push" });+ void runGitActionWithToast({+ action: "commit_push",+ forcePushOnlyProgress: true,+ });},},}@@ -381,7 +374,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlPropreturn;}if (item.dialogAction === "push") {- void runGitActionWithToast({ action: "commit_push" });+ void runGitActionWithToast({ action: "commit_push", forcePushOnlyProgress: true });return;}if (item.dialogAction) {@@ -400,10 +393,12 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp? "commit_push": "commit_push_pr";const commitMessage = activeDialogAction === "commit" ? dialogCommitMessage.trim() : "";+ const forcePushOnlyProgress = activeDialogAction === "push";setActiveDialogAction(null);void runGitActionWithToast({action,...(commitMessage ? { commitMessage } : {}),+ ...(forcePushOnlyProgress ? { forcePushOnlyProgress } : {}),});}, [activeDialogAction, dialogCommitMessage, runGitActionWithToast]);