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: address latest git action review feedback
Julius Marmingeba03241df35b
diff --git a/apps/server/src/git/Layers/GitCore.test.ts b/apps/server/src/git/Layers/GitCore.test.tsindex e4a4bf005..f94bd7631 100644--- a/apps/server/src/git/Layers/GitCore.test.ts+++ b/apps/server/src/git/Layers/GitCore.test.ts@@ -1234,6 +1234,42 @@ it.layer(TestLayer)("git integration", (it) => {}),);+ it.effect(+ "pushes with upstream setup when comparable base exists but remote branch is missing",+ () =>+ Effect.gen(function* () {+ const tmp = yield* makeTmpDir();+ const remote = yield* makeTmpDir();+ yield* git(remote, ["init", "--bare"]);++ yield* initRepoWithCommit(tmp);+ const initialBranch = (yield* listGitBranches({ cwd: tmp })).branches.find(+ (branch) => branch.current,+ )!.name;+ yield* git(tmp, ["remote", "add", "origin", remote]);+ yield* git(tmp, ["push", "-u", "origin", initialBranch]);++ yield* writeTextFile(path.join(tmp, "default-ahead.txt"), "ahead on default\n");+ yield* git(tmp, ["add", "default-ahead.txt"]);+ yield* git(tmp, ["commit", "-m", "default ahead"]);++ const featureBranch = "feature/publish-no-upstream";+ yield* git(tmp, ["checkout", "-b", featureBranch]);++ const core = yield* GitCore;+ const pushed = yield* core.pushCurrentBranch(tmp, null);+ expect(pushed.status).toBe("pushed");+ expect(pushed.setUpstream).toBe(true);+ expect(pushed.upstreamBranch).toBe(`origin/${featureBranch}`);+ expect(yield* git(tmp, ["rev-parse", "--abbrev-ref", "@{upstream}"])).toBe(+ `origin/${featureBranch}`,+ );+ expect(yield* git(tmp, ["ls-remote", "--heads", "origin", featureBranch])).toContain(+ featureBranch,+ );+ }),+ );+it.effect("includes command context when worktree removal fails", () =>Effect.gen(function* () {const tmp = yield* makeTmpDir();diff --git a/apps/server/src/git/Layers/GitCore.ts b/apps/server/src/git/Layers/GitCore.tsindex e36276575..2a2d358bd 100644--- a/apps/server/src/git/Layers/GitCore.ts+++ b/apps/server/src/git/Layers/GitCore.ts@@ -381,6 +381,11 @@ const makeGitCore = Effect.gen(function* () {},).pipe(Effect.map((result) => result.code === 0));+ const originRemoteExists = (cwd: string): Effect.Effect<boolean, GitCommandError> =>+ executeGit("GitCore.originRemoteExists", cwd, ["remote", "get-url", "origin"], {+ allowNonZeroExit: true,+ }).pipe(Effect.map((result) => result.code === 0));+const resolveBaseBranchForNoUpstream = (cwd: string,branch: string,@@ -668,10 +673,25 @@ const makeGitCore = Effect.gen(function* () {Effect.catch(() => Effect.succeed(null)),);if (comparableBaseBranch) {- return {- status: "skipped_up_to_date" as const,- branch,- };+ const hasOriginRemote = yield* originRemoteExists(cwd).pipe(+ Effect.catch(() => Effect.succeed(false)),+ );+ if (!hasOriginRemote) {+ return {+ status: "skipped_up_to_date" as const,+ branch,+ };+ }++ const hasRemoteBranch = yield* remoteBranchExists(cwd, branch).pipe(+ Effect.catch(() => Effect.succeed(false)),+ );+ if (hasRemoteBranch) {+ return {+ status: "skipped_up_to_date" as const,+ branch,+ };+ }}}diff --git a/apps/web/src/components/GitActionsControl.logic.ts b/apps/web/src/components/GitActionsControl.logic.tsindex 7b454a50b..d1c91ba94 100644--- a/apps/web/src/components/GitActionsControl.logic.ts+++ b/apps/web/src/components/GitActionsControl.logic.ts@@ -31,6 +31,8 @@ export interface DefaultBranchActionDialogCopy {continueLabel: string;}+export type DefaultBranchConfirmableAction = "commit_push" | "commit_push_pr";+const SHORT_SHA_LENGTH = 7;const TOAST_DESCRIPTION_MAX = 72;const AUTO_FEATURE_BRANCH_PREFIX = "feature/stacked";@@ -283,21 +285,13 @@ export function requiresDefaultBranchConfirmation(}export function resolveDefaultBranchActionDialogCopy(input: {- action: GitStackedAction;+ action: DefaultBranchConfirmableAction;branchName: string;includesCommit: boolean;}): DefaultBranchActionDialogCopy {const branchLabel = input.branchName;const suffix = ` on "${branchLabel}". You can continue on this branch or create a feature branch and run the same action there.`;- if (input.action === "commit") {- return {- title: "Commit to default branch?",- description: `This action will commit changes${suffix}`,- continueLabel: `Commit to ${branchLabel}`,- };- }-if (input.action === "commit_push") {if (input.includesCommit) {return {diff --git a/apps/web/src/components/GitActionsControl.tsx b/apps/web/src/components/GitActionsControl.tsxindex 2f91edfa0..a60680118 100644--- a/apps/web/src/components/GitActionsControl.tsx+++ b/apps/web/src/components/GitActionsControl.tsx@@ -9,6 +9,7 @@ import {type GitActionIconName,type GitActionMenuItem,type GitQuickAction,+ type DefaultBranchConfirmableAction,requiresDefaultBranchConfirmation,resolveAutoFeatureBranchName,resolveDefaultBranchActionDialogCopy,@@ -50,7 +51,7 @@ interface GitActionsControlProps {}interface PendingDefaultBranchAction {- action: GitStackedAction;+ action: DefaultBranchConfirmableAction;branchName: string;includesCommit: boolean;commitMessage?: string;@@ -268,6 +269,9 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActionsrequiresDefaultBranchConfirmation(action, actionIsDefaultBranch) &&actionBranch) {+ if (action !== "commit_push" && action !== "commit_push_pr") {+ return;+ }setPendingDefaultBranchAction({action,branchName: actionBranch,@@ -578,11 +582,18 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActionsif (!isCommitDialogOpen) return;const commitMessage = dialogCommitMessage.trim();setIsCommitDialogOpen(false);+ setDialogCommitMessage("");void runGitActionWithToast({action: "commit",...(commitMessage ? { commitMessage } : {}),});- }, [dialogCommitMessage, isCommitDialogOpen, runGitActionWithToast, setIsCommitDialogOpen]);+ }, [+ dialogCommitMessage,+ isCommitDialogOpen,+ runGitActionWithToast,+ setDialogCommitMessage,+ setIsCommitDialogOpen,+ ]);const openChangedFileInEditor = useCallback((filePath: string) => {