The best way to control Claude Code, Codex and more from any computer or phone
fix: use commit as the default git action without origin (#642)
* fix(web): avoid push and PR defaults without origin * fmt * object here too --------- Co-authored-by: Julius Marminge <julius0216@outlook.com>
0x1f99d committed
Mar 11, 2026 at 04:16 UTC
1c290767f22f9d8c7d3fa378d9450c8f48184679
9 files changed
+229
-124
apps/server/src/git/Layers/GitCore.test.ts
+3
@@ -260,6 +260,7 @@ it.layer(TestLayer)("git integration", (it) => {
260
yield* initRepoWithCommit(tmp);
261
const result = yield* listGitBranches({ cwd: tmp });
262
expect(result.isRepo).toBe(true);
263
+ expect(result.hasOriginRemote).toBe(false);
264
expect(result.branches.length).toBeGreaterThanOrEqual(1);
265
}),
266
);
@@ -273,6 +274,7 @@ it.layer(TestLayer)("git integration", (it) => {
274
const tmp = yield* makeTmpDir();
275
const result = yield* listGitBranches({ cwd: tmp });
276
expect(result.isRepo).toBe(false);
277
+ expect(result.hasOriginRemote).toBe(false);
278
expect(result.branches).toEqual([]);
279
}),
280
);
@@ -431,6 +433,7 @@ it.layer(TestLayer)("git integration", (it) => {
433
const result = yield* listGitBranches({ cwd: tmp });
434
const firstRemoteIndex = result.branches.findIndex((branch) => branch.isRemote);
435
436
+ expect(result.hasOriginRemote).toBe(true);
437
expect(firstRemoteIndex).toBeGreaterThan(0);
438
expect(result.branches.slice(0, firstRemoteIndex).every((branch) => !branch.isRemote)).toBe(
439
true,
apps/server/src/git/Layers/GitCore.ts
+2
-2
@@ -931,7 +931,7 @@ const makeGitCore = Effect.gen(function* () {
931
if (localBranchResult.code !== 0) {
932
const stderr = localBranchResult.stderr.trim();
933
if (stderr.toLowerCase().includes("not a git repository")) {
934
- return { branches: [], isRepo: false };
934
+ return { branches: [], isRepo: false, hasOriginRemote: false };
935
}
936
return yield* createGitCommandError(
937
"GitCore.listBranches",
@@ -1097,7 +1097,7 @@ const makeGitCore = Effect.gen(function* () {
1097
1098
const branches = [...localBranches, ...remoteBranches];
1099
1100
- return { branches, isRepo: true };
1100
+ return { branches, isRepo: true, hasOriginRemote: remoteNames.includes("origin") };
1101
});
1102
1103
const createWorktree: GitCoreShape["createWorktree"] = (input) =>
apps/server/src/wsServer.test.ts
+2
-1
@@ -1577,6 +1577,7 @@ describe("WebSocket Server", () => {
1577
Effect.succeed({
1578
branches: [],
1579
isRepo: false,
1580
+ hasOriginRemote: false,
1581
}),
1582
);
1583
const initRepo = vi.fn(() => Effect.void);
@@ -1608,7 +1609,7 @@ describe("WebSocket Server", () => {
1609
1610
const listResponse = await sendRequest(ws, WS_METHODS.gitListBranches, { cwd: "/repo/path" });
1611
expect(listResponse.error).toBeUndefined();
1611
- expect(listResponse.result).toEqual({ branches: [], isRepo: false });
1612
+ expect(listResponse.result).toEqual({ branches: [], isRepo: false, hasOriginRemote: false });
1613
expect(listBranches).toHaveBeenCalledWith({ cwd: "/repo/path" });
1614
1615
const initResponse = await sendRequest(ws, WS_METHODS.gitInit, { cwd: "/repo/path" });
apps/web/public/mockServiceWorker.js
+93
-106
@@ -7,114 +7,111 @@
7
* - Please do NOT modify this file.
8
*/
9
10
-const PACKAGE_VERSION = '2.12.10'
11
-const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82'
12
-const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
13
-const activeClientIds = new Set()
10
+const PACKAGE_VERSION = "2.12.10";
11
+const INTEGRITY_CHECKSUM = "4db4a41e972cec1b64cc569c66952d82";
12
+const IS_MOCKED_RESPONSE = Symbol("isMockedResponse");
13
+const activeClientIds = new Set();
14
15
-addEventListener('install', function () {
16
- self.skipWaiting()
17
-})
15
+addEventListener("install", function () {
16
+ self.skipWaiting();
17
+});
18
19
-addEventListener('activate', function (event) {
20
- event.waitUntil(self.clients.claim())
21
-})
19
+addEventListener("activate", function (event) {
20
+ event.waitUntil(self.clients.claim());
21
+});
22
23
-addEventListener('message', async function (event) {
24
- const clientId = Reflect.get(event.source || {}, 'id')
23
+addEventListener("message", async function (event) {
24
+ const clientId = Reflect.get(event.source || {}, "id");
25
26
if (!clientId || !self.clients) {
27
- return
27
+ return;
28
}
29
30
- const client = await self.clients.get(clientId)
30
+ const client = await self.clients.get(clientId);
31
32
if (!client) {
33
- return
33
+ return;
34
}
35
36
const allClients = await self.clients.matchAll({
37
- type: 'window',
38
- })
37
+ type: "window",
38
+ });
39
40
switch (event.data) {
41
- case 'KEEPALIVE_REQUEST': {
41
+ case "KEEPALIVE_REQUEST": {
42
sendToClient(client, {
43
- type: 'KEEPALIVE_RESPONSE',
44
- })
45
- break
43
+ type: "KEEPALIVE_RESPONSE",
44
+ });
45
+ break;
46
}
47
48
- case 'INTEGRITY_CHECK_REQUEST': {
48
+ case "INTEGRITY_CHECK_REQUEST": {
49
sendToClient(client, {
50
- type: 'INTEGRITY_CHECK_RESPONSE',
50
+ type: "INTEGRITY_CHECK_RESPONSE",
51
payload: {
52
packageVersion: PACKAGE_VERSION,
53
checksum: INTEGRITY_CHECKSUM,
54
},
55
- })
56
- break
55
+ });
56
+ break;
57
}
58
59
- case 'MOCK_ACTIVATE': {
60
- activeClientIds.add(clientId)
59
+ case "MOCK_ACTIVATE": {
60
+ activeClientIds.add(clientId);
61
62
sendToClient(client, {
63
- type: 'MOCKING_ENABLED',
63
+ type: "MOCKING_ENABLED",
64
payload: {
65
client: {
66
id: client.id,
67
frameType: client.frameType,
68
},
69
},
70
- })
71
- break
70
+ });
71
+ break;
72
}
73
74
- case 'CLIENT_CLOSED': {
75
- activeClientIds.delete(clientId)
74
+ case "CLIENT_CLOSED": {
75
+ activeClientIds.delete(clientId);
76
77
const remainingClients = allClients.filter((client) => {
78
- return client.id !== clientId
79
- })
78
+ return client.id !== clientId;
79
+ });
80
81
// Unregister itself when there are no more clients
82
if (remainingClients.length === 0) {
83
- self.registration.unregister()
83
+ self.registration.unregister();
84
}
85
86
- break
86
+ break;
87
}
88
}
89
-})
89
+});
90
91
-addEventListener('fetch', function (event) {
92
- const requestInterceptedAt = Date.now()
91
+addEventListener("fetch", function (event) {
92
+ const requestInterceptedAt = Date.now();
93
94
// Bypass navigation requests.
95
- if (event.request.mode === 'navigate') {
96
- return
95
+ if (event.request.mode === "navigate") {
96
+ return;
97
}
98
99
// Opening the DevTools triggers the "only-if-cached" request
100
// that cannot be handled by the worker. Bypass such requests.
101
- if (
102
- event.request.cache === 'only-if-cached' &&
103
- event.request.mode !== 'same-origin'
104
- ) {
105
- return
101
+ if (event.request.cache === "only-if-cached" && event.request.mode !== "same-origin") {
102
+ return;
103
}
104
105
// Bypass all requests when there are no active clients.
106
// Prevents the self-unregistered worked from handling requests
107
// after it's been terminated (still remains active until the next reload).
108
if (activeClientIds.size === 0) {
112
- return
109
+ return;
110
}
111
115
- const requestId = crypto.randomUUID()
116
- event.respondWith(handleRequest(event, requestId, requestInterceptedAt))
117
-})
112
+ const requestId = crypto.randomUUID();
113
+ event.respondWith(handleRequest(event, requestId, requestInterceptedAt));
114
+});
115
116
/**
117
* @param {FetchEvent} event
@@ -122,28 +119,23 @@ addEventListener('fetch', function (event) {
119
* @param {number} requestInterceptedAt
120
*/
121
async function handleRequest(event, requestId, requestInterceptedAt) {
125
- const client = await resolveMainClient(event)
126
- const requestCloneForEvents = event.request.clone()
127
- const response = await getResponse(
128
- event,
129
- client,
130
- requestId,
131
- requestInterceptedAt,
132
- )
122
+ const client = await resolveMainClient(event);
123
+ const requestCloneForEvents = event.request.clone();
124
+ const response = await getResponse(event, client, requestId, requestInterceptedAt);
125
126
// Send back the response clone for the "response:*" life-cycle events.
127
// Ensure MSW is active and ready to handle the message, otherwise
128
// this message will pend indefinitely.
129
if (client && activeClientIds.has(client.id)) {
138
- const serializedRequest = await serializeRequest(requestCloneForEvents)
130
+ const serializedRequest = await serializeRequest(requestCloneForEvents);
131
132
// Clone the response so both the client and the library could consume it.
141
- const responseClone = response.clone()
133
+ const responseClone = response.clone();
134
135
sendToClient(
136
client,
137
{
146
- type: 'RESPONSE',
138
+ type: "RESPONSE",
139
payload: {
140
isMockedResponse: IS_MOCKED_RESPONSE in response,
141
request: {
@@ -160,10 +152,10 @@ async function handleRequest(event, requestId, requestInterceptedAt) {
152
},
153
},
154
responseClone.body ? [serializedRequest.body, responseClone.body] : [],
163
- )
155
+ );
156
}
157
166
- return response
158
+ return response;
159
}
160
161
/**
@@ -175,30 +167,30 @@ async function handleRequest(event, requestId, requestInterceptedAt) {
167
* @returns {Promise<Client | undefined>}
168
*/
169
async function resolveMainClient(event) {
178
- const client = await self.clients.get(event.clientId)
170
+ const client = await self.clients.get(event.clientId);
171
172
if (activeClientIds.has(event.clientId)) {
181
- return client
173
+ return client;
174
}
175
184
- if (client?.frameType === 'top-level') {
185
- return client
176
+ if (client?.frameType === "top-level") {
177
+ return client;
178
}
179
180
const allClients = await self.clients.matchAll({
189
- type: 'window',
190
- })
181
+ type: "window",
182
+ });
183
184
return allClients
185
.filter((client) => {
186
// Get only those clients that are currently visible.
195
- return client.visibilityState === 'visible'
187
+ return client.visibilityState === "visible";
188
})
189
.find((client) => {
190
// Find the client ID that's recorded in the
191
// set of clients that have registered the worker.
200
- return activeClientIds.has(client.id)
201
- })
192
+ return activeClientIds.has(client.id);
193
+ });
194
}
195
196
/**
@@ -211,36 +203,34 @@ async function resolveMainClient(event) {
203
async function getResponse(event, client, requestId, requestInterceptedAt) {
204
// Clone the request because it might've been already used
205
// (i.e. its body has been read and sent to the client).
214
- const requestClone = event.request.clone()
206
+ const requestClone = event.request.clone();
207
208
function passthrough() {
209
// Cast the request headers to a new Headers instance
210
// so the headers can be manipulated with.
219
- const headers = new Headers(requestClone.headers)
211
+ const headers = new Headers(requestClone.headers);
212
213
// Remove the "accept" header value that marked this request as passthrough.
214
// This prevents request alteration and also keeps it compliant with the
215
// user-defined CORS policies.
224
- const acceptHeader = headers.get('accept')
216
+ const acceptHeader = headers.get("accept");
217
if (acceptHeader) {
226
- const values = acceptHeader.split(',').map((value) => value.trim())
227
- const filteredValues = values.filter(
228
- (value) => value !== 'msw/passthrough',
229
- )
218
+ const values = acceptHeader.split(",").map((value) => value.trim());
219
+ const filteredValues = values.filter((value) => value !== "msw/passthrough");
220
221
if (filteredValues.length > 0) {
232
- headers.set('accept', filteredValues.join(', '))
222
+ headers.set("accept", filteredValues.join(", "));
223
} else {
234
- headers.delete('accept')
224
+ headers.delete("accept");
225
}
226
}
227
238
- return fetch(requestClone, { headers })
228
+ return fetch(requestClone, { headers });
229
}
230
231
// Bypass mocking when the client is not active.
232
if (!client) {
243
- return passthrough()
233
+ return passthrough();
234
}
235
236
// Bypass initial page load requests (i.e. static assets).
@@ -248,15 +238,15 @@ async function getResponse(event, client, requestId, requestInterceptedAt) {
238
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
239
// and is not ready to handle requests.
240
if (!activeClientIds.has(client.id)) {
251
- return passthrough()
241
+ return passthrough();
242
}
243
244
// Notify the client that a request has been intercepted.
255
- const serializedRequest = await serializeRequest(event.request)
245
+ const serializedRequest = await serializeRequest(event.request);
246
const clientMessage = await sendToClient(
247
client,
248
{
259
- type: 'REQUEST',
249
+ type: "REQUEST",
250
payload: {
251
id: requestId,
252
interceptedAt: requestInterceptedAt,
@@ -264,19 +254,19 @@ async function getResponse(event, client, requestId, requestInterceptedAt) {
254
},
255
},
256
[serializedRequest.body],
267
- )
257
+ );
258
259
switch (clientMessage.type) {
270
- case 'MOCK_RESPONSE': {
271
- return respondWithMock(clientMessage.data)
260
+ case "MOCK_RESPONSE": {
261
+ return respondWithMock(clientMessage.data);
262
}
263
274
- case 'PASSTHROUGH': {
275
- return passthrough()
264
+ case "PASSTHROUGH": {
265
+ return passthrough();
266
}
267
}
268
279
- return passthrough()
269
+ return passthrough();
270
}
271
272
/**
@@ -287,21 +277,18 @@ async function getResponse(event, client, requestId, requestInterceptedAt) {
277
*/
278
function sendToClient(client, message, transferrables = []) {
279
return new Promise((resolve, reject) => {
290
- const channel = new MessageChannel()
280
+ const channel = new MessageChannel();
281
282
channel.port1.onmessage = (event) => {
283
if (event.data && event.data.error) {
294
- return reject(event.data.error)
284
+ return reject(event.data.error);
285
}
286
297
- resolve(event.data)
298
- }
287
+ resolve(event.data);
288
+ };
289
300
- client.postMessage(message, [
301
- channel.port2,
302
- ...transferrables.filter(Boolean),
303
- ])
304
- })
290
+ client.postMessage(message, [channel.port2, ...transferrables.filter(Boolean)]);
291
+ });
292
}
293
294
/**
@@ -314,17 +301,17 @@ function respondWithMock(response) {
301
// instance will have status code set to 0. Since it's not possible to create
302
// a Response instance with status code 0, handle that use-case separately.
303
if (response.status === 0) {
317
- return Response.error()
304
+ return Response.error();
305
}
306
320
- const mockedResponse = new Response(response.body, response)
307
+ const mockedResponse = new Response(response.body, response);
308
309
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
310
value: true,
311
enumerable: true,
325
- })
312
+ });
313
327
- return mockedResponse
314
+ return mockedResponse;
315
}
316
317
/**
@@ -345,5 +332,5 @@ async function serializeRequest(request) {
332
referrerPolicy: request.referrerPolicy,
333
body: await request.arrayBuffer(),
334
keepalive: request.keepalive,
348
- }
335
+ };
336
}
apps/web/src/components/ChatView.browser.tsx
+1
@@ -321,6 +321,7 @@ function resolveWsRpc(tag: string): unknown {
321
if (tag === WS_METHODS.gitListBranches) {
322
return {
323
isRepo: true,
324
+ hasOriginRemote: true,
325
branches: [
326
{
327
name: "main",
apps/web/src/components/GitActionsControl.logic.test.ts
+68
@@ -348,6 +348,21 @@ describe("when: working tree has local changes", () => {
348
});
349
});
350
351
+ it("resolveQuickAction falls back to commit when no origin remote exists", () => {
352
+ const quick = resolveQuickAction(
353
+ status({ hasWorkingTreeChanges: true, hasUpstream: false }),
354
+ false,
355
+ false,
356
+ false,
357
+ );
358
+ assert.deepInclude(quick, {
359
+ kind: "run_action",
360
+ action: "commit",
361
+ label: "Commit",
362
+ disabled: false,
363
+ });
364
+ });
365
+
366
it("resolveQuickAction returns commit and push when open PR exists", () => {
367
const quick = resolveQuickAction(
368
status({
@@ -623,6 +638,25 @@ describe("when: branch has no upstream configured", () => {
638
});
639
});
640
641
+ it("resolveQuickAction disables push-and-pr flows when no origin remote exists", () => {
642
+ const quick = resolveQuickAction(
643
+ status({
644
+ hasUpstream: false,
645
+ aheadCount: 2,
646
+ pr: null,
647
+ }),
648
+ false,
649
+ false,
650
+ false,
651
+ );
652
+ assert.deepEqual(quick, {
653
+ kind: "show_hint",
654
+ label: "Push",
655
+ hint: 'Add an "origin" remote before pushing or creating a PR.',
656
+ disabled: true,
657
+ });
658
+ });
659
+
660
it("buildMenuItems enables create PR when no upstream and commits are ahead", () => {
661
const items = buildMenuItems(status({ hasUpstream: false, pr: null, aheadCount: 2 }), false);
662
assert.deepEqual(items, [
@@ -653,6 +687,40 @@ describe("when: branch has no upstream configured", () => {
687
]);
688
});
689
690
+ it("buildMenuItems disables push and create PR when no origin remote exists", () => {
691
+ const items = buildMenuItems(
692
+ status({ hasUpstream: false, pr: null, aheadCount: 2 }),
693
+ false,
694
+ false,
695
+ );
696
+ assert.deepEqual(items, [
697
+ {
698
+ id: "commit",
699
+ label: "Commit",
700
+ disabled: true,
701
+ icon: "commit",
702
+ kind: "open_dialog",
703
+ dialogAction: "commit",
704
+ },
705
+ {
706
+ id: "push",
707
+ label: "Push",
708
+ disabled: true,
709
+ icon: "push",
710
+ kind: "open_dialog",
711
+ dialogAction: "push",
712
+ },
713
+ {
714
+ id: "pr",
715
+ label: "Create PR",
716
+ disabled: true,
717
+ icon: "pr",
718
+ kind: "open_dialog",
719
+ dialogAction: "create_pr",
720
+ },
721
+ ]);
722
+ });
723
+
724
it("resolveQuickAction is disabled on default branch when no upstream exists and no commits are ahead", () => {
725
const quick = resolveQuickAction(
726
status({
apps/web/src/components/GitActionsControl.logic.ts
+31
-2
@@ -113,6 +113,7 @@ export function summarizeGitResult(result: GitRunStackedActionResult): {
113
export function buildMenuItems(
114
gitStatus: GitStatusResult | null,
115
isBusy: boolean,
116
+ hasOriginRemote = true,
117
): GitActionMenuItem[] {
118
if (!gitStatus) return [];
119
@@ -120,10 +121,23 @@ export function buildMenuItems(
121
const hasChanges = gitStatus.hasWorkingTreeChanges;
122
const hasOpenPr = gitStatus.pr?.state === "open";
123
const isBehind = gitStatus.behindCount > 0;
124
+ const canPushWithoutUpstream = hasOriginRemote && !gitStatus.hasUpstream;
125
const canCommit = !isBusy && hasChanges;
124
- const canPush = !isBusy && hasBranch && !hasChanges && !isBehind && gitStatus.aheadCount > 0;
126
+ const canPush =
127
+ !isBusy &&
128
+ hasBranch &&
129
+ !hasChanges &&
130
+ !isBehind &&
131
+ gitStatus.aheadCount > 0 &&
132
+ (gitStatus.hasUpstream || canPushWithoutUpstream);
133
const canCreatePr =
126
- !isBusy && hasBranch && !hasChanges && !hasOpenPr && gitStatus.aheadCount > 0 && !isBehind;
134
+ !isBusy &&
135
+ hasBranch &&
136
+ !hasChanges &&
137
+ !hasOpenPr &&
138
+ gitStatus.aheadCount > 0 &&
139
+ !isBehind &&
140
+ (gitStatus.hasUpstream || canPushWithoutUpstream);
141
const canOpenPr = !isBusy && hasOpenPr;
142
143
return [
@@ -166,6 +180,7 @@ export function resolveQuickAction(
180
gitStatus: GitStatusResult | null,
181
isBusy: boolean,
182
isDefaultBranch = false,
183
+ hasOriginRemote = true,
184
): GitQuickAction {
185
if (isBusy) {
186
return { label: "Commit", disabled: true, kind: "show_hint", hint: "Git action in progress." };
@@ -197,6 +212,9 @@ export function resolveQuickAction(
212
}
213
214
if (hasChanges) {
215
+ if (!gitStatus.hasUpstream && !hasOriginRemote) {
216
+ return { label: "Commit", disabled: false, kind: "run_action", action: "commit" };
217
+ }
218
if (hasOpenPr || isDefaultBranch) {
219
return { label: "Commit & push", disabled: false, kind: "run_action", action: "commit_push" };
220
}
@@ -209,6 +227,17 @@ export function resolveQuickAction(
227
}
228
229
if (!gitStatus.hasUpstream) {
230
+ if (!hasOriginRemote) {
231
+ if (hasOpenPr && !isAhead) {
232
+ return { label: "View PR", disabled: false, kind: "open_pr" };
233
+ }
234
+ return {
235
+ label: "Push",
236
+ disabled: true,
237
+ kind: "show_hint",
238
+ hint: 'Add an "origin" remote before pushing or creating a PR.',
239
+ };
240
+ }
241
if (!isAhead) {
242
if (hasOpenPr) {
243
return { label: "View PR", disabled: false, kind: "open_pr" };
apps/web/src/components/GitActionsControl.tsx
+28
-13
@@ -59,11 +59,17 @@ interface PendingDefaultBranchAction {
59
60
type GitActionToastId = ReturnType<typeof toastManager.add>;
61
62
-function getMenuActionDisabledReason(
63
- item: GitActionMenuItem,
64
- gitStatus: GitStatusResult | null,
65
- isBusy: boolean,
66
-): string | null {
62
+function getMenuActionDisabledReason({
63
+ item,
64
+ gitStatus,
65
+ isBusy,
66
+ hasOriginRemote,
67
+}: {
68
+ item: GitActionMenuItem;
69
+ gitStatus: GitStatusResult | null;
70
+ isBusy: boolean;
71
+ hasOriginRemote: boolean;
72
+}): string | null {
73
if (!item.disabled) return null;
74
if (isBusy) return "Git action in progress.";
75
if (!gitStatus) return "Git status is unavailable.";
@@ -91,6 +97,9 @@ function getMenuActionDisabledReason(
97
if (isBehind) {
98
return "Branch is behind upstream. Pull/rebase before pushing.";
99
}
100
+ if (!gitStatus.hasUpstream && !hasOriginRemote) {
101
+ return 'Add an "origin" remote before pushing.';
102
+ }
103
if (!isAhead) {
104
return "No local commits to push.";
105
}
@@ -106,6 +115,9 @@ function getMenuActionDisabledReason(
115
if (hasChanges) {
116
return "Commit local changes before creating a PR.";
117
}
118
+ if (!gitStatus.hasUpstream && !hasOriginRemote) {
119
+ return 'Add an "origin" remote before creating a PR.';
120
+ }
121
if (!isAhead) {
122
return "No local commits to include in a PR.";
123
}
@@ -154,6 +166,7 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
166
const { data: branchList = null } = useQuery(gitBranchesQueryOptions(gitCwd));
167
// Default to true while loading so we don't flash init controls.
168
const isRepo = branchList?.isRepo ?? true;
169
+ const hasOriginRemote = branchList?.hasOriginRemote ?? false;
170
const currentBranch = branchList?.branches.find((branch) => branch.current)?.name ?? null;
171
const isGitStatusOutOfSync =
172
!!gitStatus?.branch && !!currentBranch && gitStatus.branch !== currentBranch;
@@ -184,12 +197,13 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
197
}, [branchList?.branches, gitStatusForActions?.branch]);
198
199
const gitActionMenuItems = useMemo(
187
- () => buildMenuItems(gitStatusForActions, isGitActionRunning),
188
- [gitStatusForActions, isGitActionRunning],
200
+ () => buildMenuItems(gitStatusForActions, isGitActionRunning, hasOriginRemote),
201
+ [gitStatusForActions, hasOriginRemote, isGitActionRunning],
202
);
203
const quickAction = useMemo(
191
- () => resolveQuickAction(gitStatusForActions, isGitActionRunning, isDefaultBranch),
192
- [gitStatusForActions, isDefaultBranch, isGitActionRunning],
204
+ () =>
205
+ resolveQuickAction(gitStatusForActions, isGitActionRunning, isDefaultBranch, hasOriginRemote),
206
+ [gitStatusForActions, hasOriginRemote, isDefaultBranch, isGitActionRunning],
207
);
208
const quickActionDisabledReason = quickAction.disabled
209
? (quickAction.hint ?? "This action is currently unavailable.")
@@ -645,11 +659,12 @@ export default function GitActionsControl({ gitCwd, activeThreadId }: GitActions
659
</MenuTrigger>
660
<MenuPopup align="end" className="w-full">
661
{gitActionMenuItems.map((item) => {
648
- const disabledReason = getMenuActionDisabledReason(
662
+ const disabledReason = getMenuActionDisabledReason({
663
item,
650
- gitStatusForActions,
651
- isGitActionRunning,
652
- );
664
+ gitStatus: gitStatusForActions,
665
+ isBusy: isGitActionRunning,
666
+ hasOriginRemote,
667
+ });
668
if (item.disabled && disabledReason) {
669
return (
670
<Popover key={`${item.id}-${item.label}`}>
packages/contracts/src/git.ts
+1
@@ -149,6 +149,7 @@ export type GitStatusResult = typeof GitStatusResult.Type;
149
export const GitListBranchesResult = Schema.Struct({
150
branches: Schema.Array(GitBranch),
151
isRepo: Schema.Boolean,
152
+ hasOriginRemote: Schema.Boolean,
153
});
154
export type GitListBranchesResult = typeof GitListBranchesResult.Type;
155