@agimon-ai/po-git 0.0.0-alpha.194 → 0.0.0-alpha.196
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -149
- package/README.md +1 -1
- package/dist/extensions/native.mjs +208 -178
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/web.mjs +387 -320
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +13 -13
package/dist/extensions/web.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createApiClient, defineActivityGroup, defineChannelFile, defineFill, defineHostStore, defineLeaderBinding, defineRepositorySettingsPanel, defineSessionStore, defineToolRenderer, defineWebLifecycle, defineWebPlugin, sessionApiAddress } from "@agimon-ai/po-core/web";
|
|
1
|
+
import { createApiClient, defineActivityGroup, defineChannelFile, defineFill, defineHostStore, defineLeaderBinding, defineRepositorySettingsPanel, defineSessionStore, defineToolRenderer, defineWebLifecycle, defineWebPlugin, sessionApiAddress, t, useT } from "@agimon-ai/po-core/web";
|
|
2
2
|
import { ArrowRightIcon, BranchIcon, Button, CheckIcon, ChevronDownIcon, ChevronUpIcon, CodeBlock, Dialog, DialogContent, DialogTitle, DiffView, Dot, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EmptyState, FolderIcon, Input, KebabIcon, MessageIcon, MessageItem, MessageItemBody, ProfilePicker, ReviewCommentDraft, SearchIcon, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SettingsActions, SettingsCard, SettingsNote, SettingsRow, SettingsRowDescription, SettingsRowText, SettingsRowTitle, SettingsSection, SettingsSectionDescription, SettingsSectionHeader, SettingsSectionTitle, ShieldIcon, Spinner, StatusBadge, Tabs, TabsContent, TabsList, TabsTrigger, TrashIcon, buildReviewPrompt, useProfileCatalog } from "@agimon-ai/po-web-components";
|
|
3
3
|
import { createElement, useCallback, useEffect, useEffectEvent, useId, useRef, useState } from "react";
|
|
4
4
|
import { browserTransport } from "@agimon-ai/po-web-security/browser";
|
|
@@ -76,8 +76,8 @@ function folderName(path) {
|
|
|
76
76
|
return path.split(/[\\/]/).filter((part) => part !== "").pop() ?? path;
|
|
77
77
|
}
|
|
78
78
|
/** Where a busy branch is checked out, short enough for one line. */
|
|
79
|
-
function busyNote(busyAt, workspaceRoot) {
|
|
80
|
-
return busyAt === workspaceRoot ? "Checked out here" :
|
|
79
|
+
function busyNote(t, busyAt, workspaceRoot) {
|
|
80
|
+
return busyAt === workspaceRoot ? t("git.ui.checkedOutHere", "Checked out here") : t("git.branch.checkedOutIn", "Checked out in {folder}", { folder: folderName(busyAt) });
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Local branches a session can take, then the checked-out ones, then remote-only ones, filtered by a
|
|
@@ -109,12 +109,12 @@ function baseOptions(branches) {
|
|
|
109
109
|
])];
|
|
110
110
|
}
|
|
111
111
|
/** Why the form cannot be submitted yet, or undefined when it can. */
|
|
112
|
-
function formProblem$1(state) {
|
|
112
|
+
function formProblem$1(t, state) {
|
|
113
113
|
if (state.mode === "existing") {
|
|
114
|
-
if (state.selected === void 0) return "Pick a branch.";
|
|
115
|
-
if (state.selected.busyAt !== void 0) return
|
|
114
|
+
if (state.selected === void 0) return t("git.ui.pickABranch", "Pick a branch.");
|
|
115
|
+
if (state.selected.busyAt !== void 0) return t("git.branch.busyAt", "That branch is checked out at {path}.", { path: state.selected.busyAt });
|
|
116
116
|
}
|
|
117
|
-
if (state.mode === "new" && state.newBranch.trim() === "") return "Name the new branch.";
|
|
117
|
+
if (state.mode === "new" && state.newBranch.trim() === "") return t("git.ui.nameTheNewBranch", "Name the new branch.");
|
|
118
118
|
}
|
|
119
119
|
/** The launch profile choice for any session kind, or undefined when none was made. */
|
|
120
120
|
function launchSelection(state) {
|
|
@@ -154,6 +154,7 @@ function Field$1({ label, children }) {
|
|
|
154
154
|
}
|
|
155
155
|
/** Inline presentation also lets story capture inspect content, rather than a portal-only root. */
|
|
156
156
|
function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", initialForm, busy = false, error = "", riftMissing = false, profileCatalog, onClose, onCreate, onDeleteBranch, onOpenBranchFolder }) {
|
|
157
|
+
const t = useT();
|
|
157
158
|
const [form, setForm] = useState({
|
|
158
159
|
mode: "existing",
|
|
159
160
|
newBranch: "",
|
|
@@ -171,7 +172,7 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
171
172
|
mode,
|
|
172
173
|
baseRef: form.baseRef || branches?.defaultBase || ""
|
|
173
174
|
};
|
|
174
|
-
const problem = formProblem$1(state);
|
|
175
|
+
const problem = formProblem$1(t, state);
|
|
175
176
|
const update = (patch) => setForm((current) => ({
|
|
176
177
|
...current,
|
|
177
178
|
...patch
|
|
@@ -183,14 +184,14 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
183
184
|
};
|
|
184
185
|
return /* @__PURE__ */ jsxs("section", {
|
|
185
186
|
"data-testid": "new-session-dialog",
|
|
186
|
-
"aria-label": "New session",
|
|
187
|
+
"aria-label": t("git.ui.newSession", "New session"),
|
|
187
188
|
className: "shrink-0 overflow-hidden rounded-lg border border-po-border bg-po-panel shadow-sm",
|
|
188
189
|
children: [
|
|
189
190
|
/* @__PURE__ */ jsxs("header", {
|
|
190
191
|
className: "border-b border-po-border-soft px-6 py-4",
|
|
191
192
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
192
193
|
className: "text-xl font-semibold text-po-hi",
|
|
193
|
-
children: "New session"
|
|
194
|
+
children: t("git.ui.newSession", "New session")
|
|
194
195
|
}), /* @__PURE__ */ jsx("p", {
|
|
195
196
|
className: "mt-1 font-mono text-sm text-po-dim",
|
|
196
197
|
title: workspaceRoot,
|
|
@@ -203,14 +204,14 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
203
204
|
!ready ? /* @__PURE__ */ jsx("p", {
|
|
204
205
|
"data-testid": "git-new-session-plain-note",
|
|
205
206
|
className: "text-base text-po-dim",
|
|
206
|
-
children: loading ? "Reading branches..." : loadError || "This workspace is not a git checkout. Start a plain session in this folder."
|
|
207
|
+
children: loading ? t("git.ui.readingBranchesPending", "Reading branches...") : loadError || t("git.ui.thisWorkspaceIsNotAGitCheckoutStartAPlainSessionInThisFolder", "This workspace is not a git checkout. Start a plain session in this folder.")
|
|
207
208
|
}) : /* @__PURE__ */ jsxs(Tabs, {
|
|
208
209
|
value: mode,
|
|
209
210
|
onValueChange: (value) => update({ mode: value }),
|
|
210
211
|
className: "flex flex-col gap-5",
|
|
211
212
|
children: [
|
|
212
213
|
/* @__PURE__ */ jsxs(TabsList, {
|
|
213
|
-
"aria-label": "Session kind",
|
|
214
|
+
"aria-label": t("git.ui.sessionKind", "Session kind"),
|
|
214
215
|
className: "rounded-md border border-po-border-soft bg-po-bg p-1",
|
|
215
216
|
children: [
|
|
216
217
|
/* @__PURE__ */ jsx(TabsTrigger, {
|
|
@@ -218,21 +219,21 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
218
219
|
value: "existing",
|
|
219
220
|
disabled: busy,
|
|
220
221
|
className: "flex-1 justify-center",
|
|
221
|
-
children: "Existing branch"
|
|
222
|
+
children: t("git.ui.existingBranch", "Existing branch")
|
|
222
223
|
}),
|
|
223
224
|
/* @__PURE__ */ jsx(TabsTrigger, {
|
|
224
225
|
"data-testid": "git-new-session-mode-new",
|
|
225
226
|
value: "new",
|
|
226
227
|
disabled: busy,
|
|
227
228
|
className: "flex-1 justify-center",
|
|
228
|
-
children: "New branch"
|
|
229
|
+
children: t("git.ui.newBranch", "New branch")
|
|
229
230
|
}),
|
|
230
231
|
/* @__PURE__ */ jsx(TabsTrigger, {
|
|
231
232
|
"data-testid": "git-new-session-mode-plain",
|
|
232
233
|
value: "plain",
|
|
233
234
|
disabled: busy,
|
|
234
235
|
className: "flex-1 justify-center",
|
|
235
|
-
children: "No branch"
|
|
236
|
+
children: t("git.ui.noBranch", "No branch")
|
|
236
237
|
})
|
|
237
238
|
]
|
|
238
239
|
}),
|
|
@@ -242,25 +243,25 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
242
243
|
children: [
|
|
243
244
|
/* @__PURE__ */ jsx("p", {
|
|
244
245
|
className: "text-base font-medium",
|
|
245
|
-
children: "Branch"
|
|
246
|
+
children: t("git.ui.branch", "Branch")
|
|
246
247
|
}),
|
|
247
248
|
/* @__PURE__ */ jsx(Input, {
|
|
248
249
|
"data-testid": "git-new-session-branch-search",
|
|
249
|
-
"aria-label": "Find a branch",
|
|
250
|
-
placeholder: "Find a branch",
|
|
250
|
+
"aria-label": t("git.ui.findABranch", "Find a branch"),
|
|
251
|
+
placeholder: t("git.ui.findABranch", "Find a branch"),
|
|
251
252
|
value: query,
|
|
252
253
|
onChange: (event) => setQuery(event.target.value),
|
|
253
254
|
disabled: busy
|
|
254
255
|
}),
|
|
255
256
|
/* @__PURE__ */ jsxs("fieldset", {
|
|
256
|
-
"aria-label": "Branches",
|
|
257
|
+
"aria-label": t("git.ui.branches", "Branches"),
|
|
257
258
|
className: "max-h-64 min-w-0 overflow-y-auto rounded-md border border-po-border-soft bg-po-bg p-1",
|
|
258
259
|
children: [options.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
259
260
|
className: "px-3 py-2 text-sm text-po-dim",
|
|
260
|
-
children: "No matching branches"
|
|
261
|
+
children: t("git.ui.noMatchingBranches", "No matching branches")
|
|
261
262
|
}) : null, options.map((branch, index) => /* @__PURE__ */ jsxs("div", { children: [branch.remote !== void 0 && (index === 0 || options[index - 1]?.remote === void 0) ? /* @__PURE__ */ jsx("p", {
|
|
262
263
|
className: "mt-1 border-t border-po-border-soft px-3 pt-2 text-sm text-po-dim",
|
|
263
|
-
children: "Remote branches"
|
|
264
|
+
children: t("git.ui.remoteBranches", "Remote branches")
|
|
264
265
|
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
265
266
|
className: "flex min-w-0 items-start gap-1",
|
|
266
267
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
@@ -280,10 +281,10 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
280
281
|
}), branch.busyAt !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
281
282
|
className: "truncate text-sm text-po-dim",
|
|
282
283
|
title: branch.busyAt,
|
|
283
|
-
children: busyNote(branch.busyAt, workspaceRoot)
|
|
284
|
+
children: busyNote(t, branch.busyAt, workspaceRoot)
|
|
284
285
|
}) : branch.current ? /* @__PURE__ */ jsx("span", {
|
|
285
286
|
className: "text-sm text-po-dim",
|
|
286
|
-
children: "Current"
|
|
287
|
+
children: t("git.ui.current", "Current")
|
|
287
288
|
}) : null]
|
|
288
289
|
}), /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
289
290
|
asChild: true,
|
|
@@ -291,40 +292,41 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
291
292
|
variant: "ghost",
|
|
292
293
|
size: "icon-md",
|
|
293
294
|
className: "mt-1",
|
|
294
|
-
"aria-label":
|
|
295
|
+
"aria-label": t("git.branch.actionsFor", "Actions for {branch}", { branch: branch.remote === void 0 ? branch.name : `${branch.remote}/${branch.name}` }),
|
|
295
296
|
disabled: busy,
|
|
296
297
|
children: /* @__PURE__ */ jsx(KebabIcon, { className: "size-4" })
|
|
297
298
|
})
|
|
298
299
|
}), /* @__PURE__ */ jsxs(DropdownMenuContent, { children: [
|
|
299
300
|
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
300
301
|
disabled: branch.busyAt === void 0 || onOpenBranchFolder === void 0,
|
|
301
|
-
title: branch.busyAt === void 0 ? "This branch has no checked-out folder." : branch.busyAt,
|
|
302
|
+
title: branch.busyAt === void 0 ? t("git.ui.thisBranchHasNoCheckedOutFolder", "This branch has no checked-out folder.") : branch.busyAt,
|
|
302
303
|
onSelect: () => onOpenBranchFolder?.(branch.name),
|
|
303
|
-
children: [/* @__PURE__ */ jsx(FolderIcon, { className: "size-4" }), "Open in Finder"]
|
|
304
|
+
children: [/* @__PURE__ */ jsx(FolderIcon, { className: "size-4" }), t("git.ui.openInFinder", "Open in Finder")]
|
|
304
305
|
}),
|
|
305
306
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
306
307
|
/* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
307
308
|
variant: "destructive",
|
|
308
309
|
disabled: branch.remote !== void 0 || branch.busyAt !== void 0 || branch.current || onDeleteBranch === void 0,
|
|
309
|
-
title: branch.remote !== void 0 ? "Only local branches can be deleted here." : branch.busyAt !== void 0 || branch.current ? "Close this branch’s worktree before deleting it." : void 0,
|
|
310
|
+
title: branch.remote !== void 0 ? t("git.ui.onlyLocalBranchesCanBeDeletedHere", "Only local branches can be deleted here.") : branch.busyAt !== void 0 || branch.current ? t("git.ui.closeThisBranchSWorktreeBeforeDeletingIt", "Close this branch’s worktree before deleting it.") : void 0,
|
|
310
311
|
onSelect: () => setDeleting(branch),
|
|
311
|
-
children: [/* @__PURE__ */ jsx(TrashIcon, { className: "size-4" }), "Delete branch"]
|
|
312
|
+
children: [/* @__PURE__ */ jsx(TrashIcon, { className: "size-4" }), t("git.ui.deleteBranch", "Delete branch")]
|
|
312
313
|
})
|
|
313
314
|
] })] })]
|
|
314
315
|
})] }, branch.key))]
|
|
315
316
|
}),
|
|
316
317
|
deleting !== void 0 ? /* @__PURE__ */ jsxs("fieldset", {
|
|
317
|
-
"aria-label": "Confirm branch deletion",
|
|
318
|
+
"aria-label": t("git.ui.confirmBranchDeletion", "Confirm branch deletion"),
|
|
318
319
|
className: "flex flex-col gap-3 rounded-md border border-po-edge-red bg-po-tint-red p-3",
|
|
319
320
|
children: [/* @__PURE__ */ jsxs("p", {
|
|
320
321
|
className: "text-sm text-po-text",
|
|
321
322
|
children: [
|
|
322
|
-
"Delete local branch
|
|
323
|
+
t("git.ui.deleteLocalBranch", "Delete local branch"),
|
|
324
|
+
" ",
|
|
323
325
|
/* @__PURE__ */ jsx("span", {
|
|
324
326
|
className: "font-mono break-all",
|
|
325
327
|
children: deleting.name
|
|
326
328
|
}),
|
|
327
|
-
"? Git will refuse if it contains unmerged commits. No worktree or remote branch will be removed."
|
|
329
|
+
t("git.ui.gitWillRefuseIfItContainsUnmergedCommitsNoWorktreeOrRemoteBranchWillBeRemoved", "? Git will refuse if it contains unmerged commits. No worktree or remote branch will be removed.")
|
|
328
330
|
]
|
|
329
331
|
}), /* @__PURE__ */ jsxs("div", {
|
|
330
332
|
className: "flex justify-end gap-2",
|
|
@@ -332,7 +334,7 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
332
334
|
variant: "ghost",
|
|
333
335
|
disabled: busy,
|
|
334
336
|
onClick: () => setDeleting(void 0),
|
|
335
|
-
children: "Cancel deletion"
|
|
337
|
+
children: t("git.ui.cancelDeletion", "Cancel deletion")
|
|
336
338
|
}), /* @__PURE__ */ jsx(Button, {
|
|
337
339
|
variant: "danger-outline",
|
|
338
340
|
disabled: busy,
|
|
@@ -343,7 +345,7 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
343
345
|
setDeleting(void 0);
|
|
344
346
|
}
|
|
345
347
|
},
|
|
346
|
-
children: "Delete branch"
|
|
348
|
+
children: t("git.ui.deleteBranch", "Delete branch")
|
|
347
349
|
})]
|
|
348
350
|
})]
|
|
349
351
|
}) : null
|
|
@@ -353,10 +355,10 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
353
355
|
value: "new",
|
|
354
356
|
className: "flex flex-col gap-4",
|
|
355
357
|
children: [/* @__PURE__ */ jsx(Field$1, {
|
|
356
|
-
label: "Branch name",
|
|
358
|
+
label: t("git.ui.branchName", "Branch name"),
|
|
357
359
|
children: /* @__PURE__ */ jsx(Input, {
|
|
358
360
|
"data-testid": "git-new-session-new-branch",
|
|
359
|
-
"aria-label": "Branch name",
|
|
361
|
+
"aria-label": t("git.ui.branchName", "Branch name"),
|
|
360
362
|
placeholder: "feature/my-change",
|
|
361
363
|
className: "font-mono",
|
|
362
364
|
value: form.newBranch,
|
|
@@ -364,14 +366,14 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
364
366
|
disabled: busy
|
|
365
367
|
})
|
|
366
368
|
}), /* @__PURE__ */ jsx(Field$1, {
|
|
367
|
-
label: "From",
|
|
369
|
+
label: t("git.ui.from", "From"),
|
|
368
370
|
children: /* @__PURE__ */ jsxs(Select, {
|
|
369
371
|
value: form.baseRef || branches?.defaultBase || "",
|
|
370
372
|
onValueChange: (baseRef) => update({ baseRef }),
|
|
371
373
|
disabled: busy,
|
|
372
374
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
373
375
|
"data-testid": "git-new-session-base",
|
|
374
|
-
"aria-label": "From",
|
|
376
|
+
"aria-label": t("git.ui.from", "From"),
|
|
375
377
|
className: "font-mono",
|
|
376
378
|
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
377
379
|
}), /* @__PURE__ */ jsx(SelectContent, { children: bases.map((base) => /* @__PURE__ */ jsx(SelectItem, {
|
|
@@ -385,24 +387,24 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
385
387
|
value: "plain",
|
|
386
388
|
children: /* @__PURE__ */ jsx("p", {
|
|
387
389
|
className: "text-base text-po-dim",
|
|
388
|
-
children: "Start in this workspace folder, without creating a worktree."
|
|
390
|
+
children: t("git.ui.startInThisWorkspaceFolderWithoutCreatingAWorktree", "Start in this workspace folder, without creating a worktree.")
|
|
389
391
|
})
|
|
390
392
|
})
|
|
391
393
|
]
|
|
392
394
|
}),
|
|
393
395
|
/* @__PURE__ */ jsx(Field$1, {
|
|
394
396
|
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
395
|
-
"Name",
|
|
397
|
+
t("git.ui.name", "Name"),
|
|
396
398
|
" ",
|
|
397
399
|
/* @__PURE__ */ jsx("span", {
|
|
398
400
|
className: "text-sm text-po-dim",
|
|
399
|
-
children: mode === "plain" ? "(optional)" : "(optional, defaults to the branch)"
|
|
401
|
+
children: mode === "plain" ? t("git.ui.optionalHint", "(optional)") : t("git.ui.hintoptionalDefaultsToTheBranch", "(optional, defaults to the branch)")
|
|
400
402
|
})
|
|
401
403
|
] }),
|
|
402
404
|
children: /* @__PURE__ */ jsx(Input, {
|
|
403
405
|
"data-testid": "new-session-name",
|
|
404
|
-
"aria-label": "Session name",
|
|
405
|
-
placeholder: "Session name",
|
|
406
|
+
"aria-label": t("git.ui.sessionName", "Session name"),
|
|
407
|
+
placeholder: t("git.ui.sessionName", "Session name"),
|
|
406
408
|
value: form.name,
|
|
407
409
|
onChange: (event) => update({ name: event.target.value }),
|
|
408
410
|
onKeyDown: (event) => {
|
|
@@ -421,13 +423,13 @@ function GitNewSessionDialogView({ workspaceRoot, branches, loadError = "", init
|
|
|
421
423
|
mode !== "plain" ? /* @__PURE__ */ jsx("p", {
|
|
422
424
|
"data-testid": "new-session-hint",
|
|
423
425
|
className: "text-sm leading-relaxed text-po-dim",
|
|
424
|
-
children: (loading ? void 0 : problem) ?? "Runs in its own worktree, so this checkout stays as it is."
|
|
426
|
+
children: (loading ? void 0 : problem) ?? t("git.ui.runsInItsOwnWorktreeSoThisCheckoutStaysAsItIs", "Runs in its own worktree, so this checkout stays as it is.")
|
|
425
427
|
}) : null,
|
|
426
428
|
riftMissing ? /* @__PURE__ */ jsxs("div", {
|
|
427
429
|
"data-testid": "rift-install-notice",
|
|
428
430
|
role: "alert",
|
|
429
431
|
className: "flex flex-col gap-2 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-3 py-3 text-sm text-po-hi",
|
|
430
|
-
children: [/* @__PURE__ */ jsx("p", { children: "This repository uses Rift, and its CLI is not installed here. Run these in the repository root, then try again." }), /* @__PURE__ */ jsx(CodeBlock, {
|
|
432
|
+
children: [/* @__PURE__ */ jsx("p", { children: t("git.ui.thisRepositoryUsesRiftAndItsCLIIsNotInstalledHereRunTheseInTheRepositoryRootThenTryAgain", "This repository uses Rift, and its CLI is not installed here. Run these in the repository root, then try again.") }), /* @__PURE__ */ jsx(CodeBlock, {
|
|
431
433
|
text: `${RIFT_INSTALL_COMMAND}
|
|
432
434
|
rift init`,
|
|
433
435
|
className: "language-bash"
|
|
@@ -447,21 +449,21 @@ rift init`,
|
|
|
447
449
|
variant: "ghost",
|
|
448
450
|
disabled: busy,
|
|
449
451
|
onClick: onClose,
|
|
450
|
-
children: "Cancel"
|
|
452
|
+
children: t("git.ui.cancel", "Cancel")
|
|
451
453
|
}), /* @__PURE__ */ jsx(Button, {
|
|
452
454
|
"data-testid": "new-session-create",
|
|
453
455
|
variant: "primary",
|
|
454
456
|
title: problem,
|
|
455
457
|
disabled: busy || loading || deleting !== void 0 || problem !== void 0,
|
|
456
458
|
onClick: submit,
|
|
457
|
-
children: busy ? mode === "plain" ? "Creating session..." : "Creating worktree..." : riftMissing ? "Try again" : "Create session"
|
|
459
|
+
children: busy ? mode === "plain" ? t("git.ui.creatingSessionPending", "Creating session...") : t("git.ui.creatingWorktreePending", "Creating worktree...") : riftMissing ? t("git.ui.tryAgain", "Try again") : t("git.ui.createSession", "Create session")
|
|
458
460
|
})]
|
|
459
461
|
})
|
|
460
462
|
]
|
|
461
463
|
});
|
|
462
464
|
}
|
|
463
465
|
function errorOf$1(body, status) {
|
|
464
|
-
return typeof body === "object" && body !== null && typeof body.error === "string" ? body.error :
|
|
466
|
+
return typeof body === "object" && body !== null && typeof body.error === "string" ? body.error : t("git.request.status", "The cockpit answered {status}.", { status });
|
|
465
467
|
}
|
|
466
468
|
/**
|
|
467
469
|
* The new-session dialog when git is installed: a worktree on an existing or a
|
|
@@ -469,6 +471,7 @@ function errorOf$1(body, status) {
|
|
|
469
471
|
* starts at the top level of the rail, with no parent.
|
|
470
472
|
*/
|
|
471
473
|
function GitNewSessionDialog({ newSession }) {
|
|
474
|
+
const t = useT();
|
|
472
475
|
const [branches, setBranches] = useState(null);
|
|
473
476
|
const [loadError, setLoadError] = useState("");
|
|
474
477
|
const [error, setError] = useState("");
|
|
@@ -490,15 +493,15 @@ function GitNewSessionDialog({ newSession }) {
|
|
|
490
493
|
}
|
|
491
494
|
setBranches(body);
|
|
492
495
|
}).catch(() => {
|
|
493
|
-
if (!stale) setLoadError("The branches could not be loaded.");
|
|
496
|
+
if (!stale) setLoadError(t("git.ui.theBranchesCouldNotBeLoaded", "The branches could not be loaded."));
|
|
494
497
|
});
|
|
495
498
|
return () => {
|
|
496
499
|
stale = true;
|
|
497
500
|
};
|
|
498
|
-
}, [workspaceId]);
|
|
501
|
+
}, [workspaceId, t]);
|
|
499
502
|
if (newSession === void 0) return null;
|
|
500
503
|
const submit = async (state) => {
|
|
501
|
-
if (busy || formProblem$1(state) !== void 0) return;
|
|
504
|
+
if (busy || formProblem$1(t, state) !== void 0) return;
|
|
502
505
|
setBusy(true);
|
|
503
506
|
setError("");
|
|
504
507
|
setRiftMissing(false);
|
|
@@ -517,7 +520,7 @@ function GitNewSessionDialog({ newSession }) {
|
|
|
517
520
|
setRiftMissing(!response.ok && answer?.code === "rift_missing");
|
|
518
521
|
}
|
|
519
522
|
} catch {
|
|
520
|
-
failure = "The cockpit is unreachable.";
|
|
523
|
+
failure = t("git.ui.theCockpitIsUnreachable", "The cockpit is unreachable.");
|
|
521
524
|
}
|
|
522
525
|
if (failure === void 0) return;
|
|
523
526
|
setError(failure);
|
|
@@ -546,7 +549,7 @@ function GitNewSessionDialog({ newSession }) {
|
|
|
546
549
|
});
|
|
547
550
|
return true;
|
|
548
551
|
} catch {
|
|
549
|
-
setError("The cockpit is unreachable.");
|
|
552
|
+
setError(t("git.ui.theCockpitIsUnreachable", "The cockpit is unreachable."));
|
|
550
553
|
return false;
|
|
551
554
|
} finally {
|
|
552
555
|
setBusy(false);
|
|
@@ -563,7 +566,7 @@ function GitNewSessionDialog({ newSession }) {
|
|
|
563
566
|
"aria-describedby": void 0,
|
|
564
567
|
children: [/* @__PURE__ */ jsx(DialogTitle, {
|
|
565
568
|
className: "sr-only",
|
|
566
|
-
children: "New session"
|
|
569
|
+
children: t("git.ui.newSession", "New session")
|
|
567
570
|
}), /* @__PURE__ */ jsx(GitNewSessionDialogView, {
|
|
568
571
|
workspaceRoot: newSession.workspaceRoot,
|
|
569
572
|
branches,
|
|
@@ -610,16 +613,16 @@ function formProblem(form, saved) {
|
|
|
610
613
|
if (form.method === "ssh") {
|
|
611
614
|
const keyPath = form.keyPath.trim();
|
|
612
615
|
if (keyPath === "") return void 0;
|
|
613
|
-
if (hasControl(keyPath)) return "The key path has a control character in it.";
|
|
614
|
-
if (!keyPath.startsWith("/") && !keyPath.startsWith("~/")) return "Give the key as an absolute path or one under ~/.";
|
|
616
|
+
if (hasControl(keyPath)) return t("git.ui.theKeyPathHasAControlCharacterInIt", "The key path has a control character in it.");
|
|
617
|
+
if (!keyPath.startsWith("/") && !keyPath.startsWith("~/")) return t("git.ui.giveTheKeyAsAnAbsolutePathOrOneUnder", "Give the key as an absolute path or one under ~/.");
|
|
615
618
|
return;
|
|
616
619
|
}
|
|
617
620
|
if (form.method === "https") {
|
|
618
621
|
const host = form.host.trim().toLowerCase();
|
|
619
|
-
if (!HOST_PATTERN.test(host)) return "The host should look like github.com, with an optional :port.";
|
|
620
|
-
if (form.username.trim() === "") return "A username is required.";
|
|
621
|
-
if (hasControl(form.username) || hasControl(form.token)) return "Remove the control character from the username or token.";
|
|
622
|
-
if (form.token === "" && !keepsToken(form, saved)) return saved.https?.hasToken === true ? "The host changed, so enter the token for the new host." : "A token is required.";
|
|
622
|
+
if (!HOST_PATTERN.test(host)) return t("git.ui.theHostShouldLookLikeGithubComWithAnOptionalPort", "The host should look like github.com, with an optional :port.");
|
|
623
|
+
if (form.username.trim() === "") return t("git.ui.aUsernameIsRequired", "A username is required.");
|
|
624
|
+
if (hasControl(form.username) || hasControl(form.token)) return t("git.ui.removeTheControlCharacterFromTheUsernameOrToken", "Remove the control character from the username or token.");
|
|
625
|
+
if (form.token === "" && !keepsToken(form, saved)) return saved.https?.hasToken === true ? t("git.ui.theHostChangedSoEnterTheTokenForTheNewHost", "The host changed, so enter the token for the new host.") : t("git.ui.aTokenIsRequired", "A token is required.");
|
|
623
626
|
}
|
|
624
627
|
}
|
|
625
628
|
/** What a save sends. The token goes only when the reader typed one. */
|
|
@@ -665,24 +668,25 @@ function Field({ label, children }) {
|
|
|
665
668
|
children: [/* @__PURE__ */ jsx("span", { children: label }), children]
|
|
666
669
|
});
|
|
667
670
|
}
|
|
668
|
-
const METHODS = [
|
|
669
|
-
{
|
|
670
|
-
method: "none",
|
|
671
|
-
title: "This machine's git",
|
|
672
|
-
detail: "Your credential helper, SSH config and agent, as they are."
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
method: "ssh",
|
|
676
|
-
title: "SSH key",
|
|
677
|
-
detail: "A key file on this machine, or your ssh-agent."
|
|
678
|
-
},
|
|
679
|
-
{
|
|
680
|
-
method: "https",
|
|
681
|
-
title: "HTTPS token",
|
|
682
|
-
detail: "A username and personal access token for one host."
|
|
683
|
-
}
|
|
684
|
-
];
|
|
685
671
|
function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave }) {
|
|
672
|
+
const t = useT();
|
|
673
|
+
const METHODS = [
|
|
674
|
+
{
|
|
675
|
+
method: "none",
|
|
676
|
+
title: t("git.ui.thisMachineSGit", "This machine's git"),
|
|
677
|
+
detail: t("git.ui.yourCredentialHelperSSHConfigAndAgentAsTheyAre", "Your credential helper, SSH config and agent, as they are.")
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
method: "ssh",
|
|
681
|
+
title: t("git.ui.sshKey", "SSH key"),
|
|
682
|
+
detail: t("git.ui.aKeyFileOnThisMachineOrYourSshAgent", "A key file on this machine, or your ssh-agent.")
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
method: "https",
|
|
686
|
+
title: t("git.ui.httpsToken", "HTTPS token"),
|
|
687
|
+
detail: t("git.ui.aUsernameAndPersonalAccessTokenForOneHost", "A username and personal access token for one host.")
|
|
688
|
+
}
|
|
689
|
+
];
|
|
686
690
|
const [form, setForm] = useState(() => formFromView(saved));
|
|
687
691
|
const [edited, setEdited] = useState(false);
|
|
688
692
|
const update = (patch) => {
|
|
@@ -694,13 +698,13 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
694
698
|
};
|
|
695
699
|
const problem = formProblem(form, saved);
|
|
696
700
|
const tokenSaved = saved.https?.hasToken === true && saved.https.host === form.host.trim().toLowerCase();
|
|
697
|
-
const host = form.host.trim() === "" ? "this host" : form.host.trim();
|
|
701
|
+
const host = form.host.trim() === "" ? t("git.ui.thisHost", "this host") : form.host.trim();
|
|
698
702
|
return /* @__PURE__ */ jsxs(SettingsSection, {
|
|
699
703
|
"data-testid": "git-auth-form",
|
|
700
704
|
children: [
|
|
701
|
-
/* @__PURE__ */ jsxs(SettingsSectionHeader, { children: [/* @__PURE__ */ jsx(SettingsSectionTitle, { children: "Connection" }), /* @__PURE__ */ jsx(SettingsSectionDescription, { children: "Worktree sessions use the setup of the workspace they belong to." })] }),
|
|
705
|
+
/* @__PURE__ */ jsxs(SettingsSectionHeader, { children: [/* @__PURE__ */ jsx(SettingsSectionTitle, { children: t("git.ui.connection", "Connection") }), /* @__PURE__ */ jsx(SettingsSectionDescription, { children: t("git.ui.worktreeSessionsUseTheSetupOfTheWorkspaceTheyBelongTo", "Worktree sessions use the setup of the workspace they belong to.") })] }),
|
|
702
706
|
/* @__PURE__ */ jsx("div", {
|
|
703
|
-
"aria-label": "How git reaches your remote",
|
|
707
|
+
"aria-label": t("git.ui.howGitReachesYourRemote", "How git reaches your remote"),
|
|
704
708
|
className: "flex flex-col gap-3",
|
|
705
709
|
children: METHODS.map((choice) => /* @__PURE__ */ jsxs("div", {
|
|
706
710
|
className: `overflow-hidden rounded-lg border ${form.method === choice.method ? "border-po-green" : "border-po-border-soft"}`,
|
|
@@ -726,7 +730,7 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
726
730
|
form.method === choice.method && form.method === "ssh" ? /* @__PURE__ */ jsxs("div", {
|
|
727
731
|
className: "flex flex-col gap-3 border-t border-po-border-soft p-4",
|
|
728
732
|
children: [/* @__PURE__ */ jsx(Field, {
|
|
729
|
-
label: "Key path",
|
|
733
|
+
label: t("git.ui.keyPath", "Key path"),
|
|
730
734
|
children: /* @__PURE__ */ jsx(Input, {
|
|
731
735
|
"data-testid": "git-auth-key-path",
|
|
732
736
|
value: form.keyPath,
|
|
@@ -738,7 +742,7 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
738
742
|
})
|
|
739
743
|
}), /* @__PURE__ */ jsx("p", {
|
|
740
744
|
className: "text-sm leading-relaxed text-po-dim",
|
|
741
|
-
children: "Leave blank to use SSH config and ssh-agent. Passphrases need ssh-agent. Trust an unknown host in a terminal first."
|
|
745
|
+
children: t("git.ui.leaveBlankToUseSSHConfigAndSshAgentPassphrasesNeedSshAgentTrustAnUnknownHostInATerminalFirst", "Leave blank to use SSH config and ssh-agent. Passphrases need ssh-agent. Trust an unknown host in a terminal first.")
|
|
742
746
|
})]
|
|
743
747
|
}) : null,
|
|
744
748
|
form.method === choice.method && form.method === "https" ? /* @__PURE__ */ jsxs("div", {
|
|
@@ -747,7 +751,7 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
747
751
|
/* @__PURE__ */ jsxs("div", {
|
|
748
752
|
className: "grid grid-cols-2 gap-3",
|
|
749
753
|
children: [/* @__PURE__ */ jsx(Field, {
|
|
750
|
-
label: "Host",
|
|
754
|
+
label: t("git.ui.host", "Host"),
|
|
751
755
|
children: /* @__PURE__ */ jsx(Input, {
|
|
752
756
|
"data-testid": "git-auth-host",
|
|
753
757
|
value: form.host,
|
|
@@ -757,7 +761,7 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
757
761
|
className: "font-mono"
|
|
758
762
|
})
|
|
759
763
|
}), /* @__PURE__ */ jsx(Field, {
|
|
760
|
-
label: "Username",
|
|
764
|
+
label: t("git.ui.username", "Username"),
|
|
761
765
|
children: /* @__PURE__ */ jsx(Input, {
|
|
762
766
|
"data-testid": "git-auth-username",
|
|
763
767
|
value: form.username,
|
|
@@ -770,12 +774,12 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
770
774
|
}),
|
|
771
775
|
/* @__PURE__ */ jsx(Field, {
|
|
772
776
|
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
773
|
-
"Token",
|
|
777
|
+
t("git.ui.token", "Token"),
|
|
774
778
|
" ",
|
|
775
779
|
tokenSaved ? /* @__PURE__ */ jsx("span", {
|
|
776
780
|
"data-testid": "git-auth-token-saved",
|
|
777
781
|
className: "ml-2 text-sm text-po-green",
|
|
778
|
-
children: "A token is saved"
|
|
782
|
+
children: t("git.ui.aTokenIsSaved", "A token is saved")
|
|
779
783
|
}) : null
|
|
780
784
|
] }),
|
|
781
785
|
children: /* @__PURE__ */ jsx(Input, {
|
|
@@ -783,7 +787,7 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
783
787
|
type: "password",
|
|
784
788
|
value: form.token,
|
|
785
789
|
autoComplete: "new-password",
|
|
786
|
-
placeholder: tokenSaved ? "Leave blank to keep it" : "Personal access token",
|
|
790
|
+
placeholder: tokenSaved ? t("git.ui.leaveBlankToKeepIt", "Leave blank to keep it") : t("git.ui.personalAccessToken", "Personal access token"),
|
|
787
791
|
disabled: saving,
|
|
788
792
|
onChange: (event) => update({ token: event.target.value })
|
|
789
793
|
})
|
|
@@ -791,12 +795,13 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
791
795
|
/* @__PURE__ */ jsxs("p", {
|
|
792
796
|
className: "text-sm text-po-dim",
|
|
793
797
|
children: [
|
|
794
|
-
"Sent only to
|
|
798
|
+
t("git.ui.sentOnlyTo", "Sent only to"),
|
|
799
|
+
" ",
|
|
795
800
|
/* @__PURE__ */ jsx("span", {
|
|
796
801
|
className: "font-mono",
|
|
797
802
|
children: host
|
|
798
803
|
}),
|
|
799
|
-
". Other hosts use this machine's git."
|
|
804
|
+
t("git.ui.otherHostsUseThisMachineSGit", ". Other hosts use this machine's git.")
|
|
800
805
|
]
|
|
801
806
|
})
|
|
802
807
|
]
|
|
@@ -810,14 +815,15 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
810
815
|
"aria-hidden": true,
|
|
811
816
|
className: "mt-0.5 size-4 shrink-0"
|
|
812
817
|
}), /* @__PURE__ */ jsxs("span", { children: [
|
|
813
|
-
"Only cockpit pull, push and rebase use these credentials, not the agent.",
|
|
818
|
+
t("git.ui.onlyCockpitPullPushAndRebaseUseTheseCredentialsNotTheAgent", "Only cockpit pull, push and rebase use these credentials, not the agent."),
|
|
814
819
|
/* @__PURE__ */ jsx("br", {}),
|
|
815
|
-
"Stored in
|
|
820
|
+
t("git.ui.storedIn", "Stored in"),
|
|
821
|
+
" ",
|
|
816
822
|
/* @__PURE__ */ jsx("span", {
|
|
817
823
|
className: "font-mono",
|
|
818
824
|
children: "~/.po/git/credentials.json"
|
|
819
825
|
}),
|
|
820
|
-
", readable only by you."
|
|
826
|
+
t("git.ui.readableOnlyByYou", ", readable only by you.")
|
|
821
827
|
] })]
|
|
822
828
|
}),
|
|
823
829
|
/* @__PURE__ */ jsxs(SettingsActions, {
|
|
@@ -827,15 +833,15 @@ function GitAuthForm({ saved, saving, saveError, savedNotice = false, onSave })
|
|
|
827
833
|
"data-testid": "git-auth-save",
|
|
828
834
|
disabled: problem !== void 0 || saving,
|
|
829
835
|
loading: saving,
|
|
830
|
-
loadingLabel: "Saving...",
|
|
836
|
+
loadingLabel: t("git.ui.savingPending", "Saving..."),
|
|
831
837
|
onClick: () => {
|
|
832
838
|
if (!saving && problem === void 0) onSave(saveRequestOf(form));
|
|
833
839
|
},
|
|
834
|
-
children: "Save connection"
|
|
840
|
+
children: t("git.ui.saveConnection", "Save connection")
|
|
835
841
|
}), savedNotice && !edited && problem === void 0 && saveError === void 0 ? /* @__PURE__ */ jsx("span", {
|
|
836
842
|
"data-testid": "git-auth-saved",
|
|
837
843
|
className: "text-sm text-po-green",
|
|
838
|
-
children: "Saved."
|
|
844
|
+
children: t("git.ui.saved", "Saved.")
|
|
839
845
|
}) : null]
|
|
840
846
|
}),
|
|
841
847
|
problem !== void 0 ? /* @__PURE__ */ jsx("p", {
|
|
@@ -876,7 +882,7 @@ function isAuthView(value) {
|
|
|
876
882
|
].includes(String(value.method));
|
|
877
883
|
}
|
|
878
884
|
function errorOf(body, status) {
|
|
879
|
-
return typeof body === "object" && body !== null && typeof body.error === "string" ? body.error :
|
|
885
|
+
return typeof body === "object" && body !== null && typeof body.error === "string" ? body.error : t("git.request.status", "The cockpit answered {status}.", { status });
|
|
880
886
|
}
|
|
881
887
|
/** The one-row card every non-form state of this panel is told in. */
|
|
882
888
|
function StateCard({ testId, title, children, action }) {
|
|
@@ -886,6 +892,7 @@ function StateCard({ testId, title, children, action }) {
|
|
|
886
892
|
});
|
|
887
893
|
}
|
|
888
894
|
function GitAuthPanel({ repository, request, requestWithStepUp }) {
|
|
895
|
+
const t = useT();
|
|
889
896
|
const repositoryId = repository?.id;
|
|
890
897
|
const [loaded, setLoaded] = useState();
|
|
891
898
|
const [loadError, setLoadError] = useState();
|
|
@@ -911,7 +918,7 @@ function GitAuthPanel({ repository, request, requestWithStepUp }) {
|
|
|
911
918
|
}).catch(() => {
|
|
912
919
|
if (!stale) setLoadError({
|
|
913
920
|
repositoryId,
|
|
914
|
-
error: "The cockpit is unreachable."
|
|
921
|
+
error: t("git.ui.theCockpitIsUnreachable", "The cockpit is unreachable.")
|
|
915
922
|
});
|
|
916
923
|
});
|
|
917
924
|
return () => {
|
|
@@ -920,12 +927,13 @@ function GitAuthPanel({ repository, request, requestWithStepUp }) {
|
|
|
920
927
|
}, [
|
|
921
928
|
repositoryId,
|
|
922
929
|
request,
|
|
923
|
-
attempt
|
|
930
|
+
attempt,
|
|
931
|
+
t
|
|
924
932
|
]);
|
|
925
933
|
if (repository === null || repositoryId === void 0) return /* @__PURE__ */ jsx(StateCard, {
|
|
926
934
|
testId: "git-auth-no-repository",
|
|
927
|
-
title: "No repository picked",
|
|
928
|
-
children: "Git remote access is set per workspace. Pick one above."
|
|
935
|
+
title: t("git.ui.noRepositoryPicked", "No repository picked"),
|
|
936
|
+
children: t("git.ui.gitRemoteAccessIsSetPerWorkspacePickOneAbove", "Git remote access is set per workspace. Pick one above.")
|
|
929
937
|
});
|
|
930
938
|
const save = async (next) => {
|
|
931
939
|
setSaving(true);
|
|
@@ -947,7 +955,7 @@ function GitAuthPanel({ repository, request, requestWithStepUp }) {
|
|
|
947
955
|
setSavedNotice(true);
|
|
948
956
|
} else setSaveError(errorOf(body, response.status));
|
|
949
957
|
} catch {
|
|
950
|
-
setSaveError("The cockpit is unreachable.");
|
|
958
|
+
setSaveError(t("git.ui.theCockpitIsUnreachable", "The cockpit is unreachable."));
|
|
951
959
|
} finally {
|
|
952
960
|
setSaving(false);
|
|
953
961
|
}
|
|
@@ -957,7 +965,7 @@ function GitAuthPanel({ repository, request, requestWithStepUp }) {
|
|
|
957
965
|
"data-testid": "git-auth-load-error",
|
|
958
966
|
children: /* @__PURE__ */ jsxs(StateCard, {
|
|
959
967
|
testId: "git-auth-load-error-card",
|
|
960
|
-
title: "Po couldn't read this workspace's git settings just now",
|
|
968
|
+
title: t("git.ui.poCouldnTReadThisWorkspaceSGitSettingsJustNow", "Po couldn't read this workspace's git settings just now"),
|
|
961
969
|
action: /* @__PURE__ */ jsx(Button, {
|
|
962
970
|
variant: "outline",
|
|
963
971
|
size: "sm",
|
|
@@ -965,20 +973,24 @@ function GitAuthPanel({ repository, request, requestWithStepUp }) {
|
|
|
965
973
|
setLoadError(void 0);
|
|
966
974
|
setAttempt((current) => current + 1);
|
|
967
975
|
},
|
|
968
|
-
children: "Try again"
|
|
976
|
+
children: t("git.ui.tryAgain", "Try again")
|
|
969
977
|
}),
|
|
970
|
-
children: [
|
|
978
|
+
children: [
|
|
979
|
+
loadError.error,
|
|
980
|
+
" ",
|
|
981
|
+
t("git.ui.nothingHasChanged", "Nothing has changed.")
|
|
982
|
+
]
|
|
971
983
|
})
|
|
972
984
|
});
|
|
973
985
|
if (loaded?.repositoryId !== repositoryId) return /* @__PURE__ */ jsx(StateCard, {
|
|
974
986
|
testId: "git-auth-loading",
|
|
975
|
-
title: "Reading git settings",
|
|
987
|
+
title: t("git.ui.readingGitSettings", "Reading git settings"),
|
|
976
988
|
children: /* @__PURE__ */ jsxs("span", {
|
|
977
989
|
className: "inline-flex items-center gap-2",
|
|
978
990
|
children: [/* @__PURE__ */ jsx(Spinner, {
|
|
979
991
|
className: "size-3 text-po-faint",
|
|
980
|
-
label: "Loading git settings"
|
|
981
|
-
}), "This takes a moment."]
|
|
992
|
+
label: t("git.ui.loadingGitSettings", "Loading git settings")
|
|
993
|
+
}), t("git.ui.thisTakesAMoment", "This takes a moment.")]
|
|
982
994
|
})
|
|
983
995
|
});
|
|
984
996
|
return /* @__PURE__ */ jsx(GitAuthForm, {
|
|
@@ -992,8 +1004,8 @@ function GitAuthPanel({ repository, request, requestWithStepUp }) {
|
|
|
992
1004
|
//#endregion
|
|
993
1005
|
//#region src/extensions/workspaces/(frontend)/repository-settings-panel/git.web.tsx
|
|
994
1006
|
var git_web_default$1 = defineRepositorySettingsPanel({
|
|
995
|
-
label: "Git remote",
|
|
996
|
-
detail: "How this workspace's sessions reach the remote when you pull, push or rebase from the cockpit.",
|
|
1007
|
+
label: t("git.ui.gitRemote", "Git remote"),
|
|
1008
|
+
detail: t("git.ui.howThisWorkspaceSSessionsReachTheRemoteWhenYouPullPushOrRebaseFromTheCockpit", "How this workspace's sessions reach the remote when you pull, push or rebase from the cockpit."),
|
|
997
1009
|
order: 50,
|
|
998
1010
|
component: GitAuthPanel
|
|
999
1011
|
});
|
|
@@ -1144,6 +1156,7 @@ function requestWorktreeClose(sessionId, id) {
|
|
|
1144
1156
|
//#endregion
|
|
1145
1157
|
//#region src/extensions/workspaces/sessions/(frontend)/fill/_components/WorktreeCreateDialog.tsx
|
|
1146
1158
|
function WorktreeCreateOverlay(props) {
|
|
1159
|
+
const t = useT();
|
|
1147
1160
|
const target = useStore(worktreeCreateDialog.store);
|
|
1148
1161
|
const { holdSessionChannels } = props;
|
|
1149
1162
|
useEffect(() => {
|
|
@@ -1167,7 +1180,7 @@ function WorktreeCreateOverlay(props) {
|
|
|
1167
1180
|
"aria-describedby": void 0,
|
|
1168
1181
|
children: [/* @__PURE__ */ jsx(DialogTitle, {
|
|
1169
1182
|
className: "sr-only",
|
|
1170
|
-
children: "Create a worktree session"
|
|
1183
|
+
children: t("git.ui.createAWorktreeSession", "Create a worktree session")
|
|
1171
1184
|
}), /* @__PURE__ */ createElement(WorktreeCreateForm, {
|
|
1172
1185
|
...props,
|
|
1173
1186
|
key: `${target.sessionId}:${target.reservationId ?? ""}`,
|
|
@@ -1223,6 +1236,7 @@ function WorktreeCreateForm({ sessionId, sessionReservationId, onCancel, onReque
|
|
|
1223
1236
|
});
|
|
1224
1237
|
}
|
|
1225
1238
|
function WorktreeCreateView({ branch, baseRef, onBranchChange, onBaseChange, busy = false, error, riftMissing = false, onCancel, onCreate, disabled = false }) {
|
|
1239
|
+
const t = useT();
|
|
1226
1240
|
const id = useId();
|
|
1227
1241
|
return /* @__PURE__ */ jsxs("div", {
|
|
1228
1242
|
className: "rounded-lg border border-po-border-soft bg-po-panel p-5 text-po-text shadow-sm",
|
|
@@ -1230,11 +1244,11 @@ function WorktreeCreateView({ branch, baseRef, onBranchChange, onBaseChange, bus
|
|
|
1230
1244
|
/* @__PURE__ */ jsx("h2", {
|
|
1231
1245
|
id: `${id}-title`,
|
|
1232
1246
|
className: "text-xl font-semibold text-po-hi",
|
|
1233
|
-
children: "Create a worktree session"
|
|
1247
|
+
children: t("git.ui.createAWorktreeSession", "Create a worktree session")
|
|
1234
1248
|
}),
|
|
1235
1249
|
/* @__PURE__ */ jsx("p", {
|
|
1236
1250
|
className: "mt-2 text-sm leading-relaxed text-po-dim",
|
|
1237
|
-
children: "Create a separate checkout and session without moving your existing sessions."
|
|
1251
|
+
children: t("git.ui.createASeparateCheckoutAndSessionWithoutMovingYourExistingSessions", "Create a separate checkout and session without moving your existing sessions.")
|
|
1238
1252
|
}),
|
|
1239
1253
|
/* @__PURE__ */ jsxs("form", {
|
|
1240
1254
|
onSubmit: (event) => {
|
|
@@ -1249,7 +1263,7 @@ function WorktreeCreateView({ branch, baseRef, onBranchChange, onBaseChange, bus
|
|
|
1249
1263
|
/* @__PURE__ */ jsx("label", {
|
|
1250
1264
|
htmlFor: `${id}-branch`,
|
|
1251
1265
|
className: "text-base font-medium",
|
|
1252
|
-
children: "Branch"
|
|
1266
|
+
children: t("git.ui.branch", "Branch")
|
|
1253
1267
|
}),
|
|
1254
1268
|
/* @__PURE__ */ jsx(Input, {
|
|
1255
1269
|
id: `${id}-branch`,
|
|
@@ -1266,7 +1280,7 @@ function WorktreeCreateView({ branch, baseRef, onBranchChange, onBaseChange, bus
|
|
|
1266
1280
|
"data-testid": "rift-install-notice",
|
|
1267
1281
|
role: "alert",
|
|
1268
1282
|
className: "flex flex-col gap-2 rounded-md border border-po-edge-magenta bg-po-tint-magenta px-3 py-3 text-sm text-po-hi",
|
|
1269
|
-
children: [/* @__PURE__ */ jsx("p", { children: "This repository uses Rift, and its CLI is not installed here. Run these in the repository root, then try again." }), /* @__PURE__ */ jsx(CodeBlock, {
|
|
1283
|
+
children: [/* @__PURE__ */ jsx("p", { children: t("git.ui.thisRepositoryUsesRiftAndItsCLIIsNotInstalledHereRunTheseInTheRepositoryRootThenTryAgain", "This repository uses Rift, and its CLI is not installed here. Run these in the repository root, then try again.") }), /* @__PURE__ */ jsx(CodeBlock, {
|
|
1270
1284
|
text: `${RIFT_INSTALL_COMMAND}
|
|
1271
1285
|
rift init`,
|
|
1272
1286
|
className: "language-bash"
|
|
@@ -1284,13 +1298,13 @@ rift init`,
|
|
|
1284
1298
|
children: [/* @__PURE__ */ jsx("label", {
|
|
1285
1299
|
htmlFor: `${id}-base`,
|
|
1286
1300
|
className: "text-base font-medium",
|
|
1287
|
-
children: "Start from"
|
|
1301
|
+
children: t("git.ui.startFrom", "Start from")
|
|
1288
1302
|
}), /* @__PURE__ */ jsx(Input, {
|
|
1289
1303
|
size: "sm",
|
|
1290
1304
|
id: `${id}-base`,
|
|
1291
1305
|
"data-testid": "git-worktree-base",
|
|
1292
1306
|
className: "font-mono",
|
|
1293
|
-
placeholder: "Current branch",
|
|
1307
|
+
placeholder: t("git.ui.currentBranch", "Current branch"),
|
|
1294
1308
|
value: baseRef,
|
|
1295
1309
|
onChange: (e) => onBaseChange?.(e.target.value),
|
|
1296
1310
|
disabled: busy
|
|
@@ -1303,7 +1317,7 @@ rift init`,
|
|
|
1303
1317
|
variant: "ghost",
|
|
1304
1318
|
disabled: busy,
|
|
1305
1319
|
onClick: onCancel,
|
|
1306
|
-
children: "Cancel"
|
|
1320
|
+
children: t("git.ui.cancel", "Cancel")
|
|
1307
1321
|
}), /* @__PURE__ */ jsxs(Button, {
|
|
1308
1322
|
type: "submit",
|
|
1309
1323
|
variant: "primary",
|
|
@@ -1311,8 +1325,8 @@ rift init`,
|
|
|
1311
1325
|
disabled: busy || disabled || !branch.trim(),
|
|
1312
1326
|
children: [busy && /* @__PURE__ */ jsx(Spinner, {
|
|
1313
1327
|
className: "size-3",
|
|
1314
|
-
label: "Creating worktree"
|
|
1315
|
-
}), busy ? "Creating worktree..." : riftMissing ? "Try again" : "Create worktree"]
|
|
1328
|
+
label: t("git.ui.creatingWorktree", "Creating worktree")
|
|
1329
|
+
}), busy ? t("git.ui.creatingWorktreePending", "Creating worktree...") : riftMissing ? t("git.ui.tryAgain", "Try again") : t("git.ui.createWorktree", "Create worktree")]
|
|
1316
1330
|
})]
|
|
1317
1331
|
})]
|
|
1318
1332
|
})
|
|
@@ -1324,7 +1338,7 @@ rift init`,
|
|
|
1324
1338
|
function worktreesTab() {
|
|
1325
1339
|
return {
|
|
1326
1340
|
id: "git-worktrees",
|
|
1327
|
-
label: "worktrees",
|
|
1341
|
+
label: t("git.tab.worktrees", "worktrees"),
|
|
1328
1342
|
panel: WorktreesPanel
|
|
1329
1343
|
};
|
|
1330
1344
|
}
|
|
@@ -1365,6 +1379,7 @@ function WorktreesPanel(props) {
|
|
|
1365
1379
|
});
|
|
1366
1380
|
}
|
|
1367
1381
|
function WorktreesPanelView({ worktrees, pending, error, closeErrorId, onNew, onClose, form, startingIds = [], startingBranch }) {
|
|
1382
|
+
const t = useT();
|
|
1368
1383
|
const groups = [worktrees.filter((w) => !w.orphaned && !w.unowned), worktrees.filter((w) => w.orphaned || w.unowned)];
|
|
1369
1384
|
const empty = worktrees.length === 0 && !startingBranch;
|
|
1370
1385
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -1376,18 +1391,18 @@ function WorktreesPanelView({ worktrees, pending, error, closeErrorId, onNew, on
|
|
|
1376
1391
|
children: [
|
|
1377
1392
|
/* @__PURE__ */ jsx("h2", {
|
|
1378
1393
|
className: "text-lg font-semibold text-po-hi",
|
|
1379
|
-
children: "Worktrees"
|
|
1394
|
+
children: t("git.ui.worktrees", "Worktrees")
|
|
1380
1395
|
}),
|
|
1381
1396
|
/* @__PURE__ */ jsx("span", {
|
|
1382
1397
|
"data-testid": "git-worktrees-count",
|
|
1383
1398
|
className: "sr-only",
|
|
1384
|
-
children: worktrees.length === 0 ? "none yet" :
|
|
1399
|
+
children: worktrees.length === 0 ? t("git.ui.noneYet", "none yet") : t("git.worktree.openCount", "{count} open", { count: worktrees.length })
|
|
1385
1400
|
}),
|
|
1386
1401
|
!empty && /* @__PURE__ */ jsx(Button, {
|
|
1387
1402
|
variant: "outline",
|
|
1388
1403
|
size: "sm",
|
|
1389
1404
|
onClick: onNew,
|
|
1390
|
-
children: "New worktree"
|
|
1405
|
+
children: t("git.ui.newWorktree", "New worktree")
|
|
1391
1406
|
})
|
|
1392
1407
|
]
|
|
1393
1408
|
}),
|
|
@@ -1414,10 +1429,10 @@ function WorktreesPanelView({ worktrees, pending, error, closeErrorId, onNew, on
|
|
|
1414
1429
|
surface: "plain",
|
|
1415
1430
|
className: "py-10",
|
|
1416
1431
|
icon: /* @__PURE__ */ jsx(BranchIcon, {}),
|
|
1417
|
-
title: "No worktrees yet",
|
|
1418
|
-
description: "A worktree gives a branch its own checkout and a session nested under this one.",
|
|
1432
|
+
title: t("git.ui.noWorktreesYet", "No worktrees yet"),
|
|
1433
|
+
description: t("git.ui.aWorktreeGivesABranchItsOwnCheckoutAndASessionNestedUnderThisOne", "A worktree gives a branch its own checkout and a session nested under this one."),
|
|
1419
1434
|
action: onNew && !form ? {
|
|
1420
|
-
label: "New worktree",
|
|
1435
|
+
label: t("git.ui.newWorktree", "New worktree"),
|
|
1421
1436
|
onAction: onNew
|
|
1422
1437
|
} : void 0
|
|
1423
1438
|
}) : /* @__PURE__ */ jsx("div", {
|
|
@@ -1426,20 +1441,24 @@ function WorktreesPanelView({ worktrees, pending, error, closeErrorId, onNew, on
|
|
|
1426
1441
|
/* @__PURE__ */ jsxs("h3", {
|
|
1427
1442
|
className: "flex items-center gap-2 pt-5 text-lg font-semibold text-po-hi",
|
|
1428
1443
|
children: [
|
|
1429
|
-
i === 0 ? "Working" : "Needs a look",
|
|
1444
|
+
i === 0 ? t("git.ui.working", "Working") : t("git.ui.needsALook", "Needs a look"),
|
|
1430
1445
|
" ",
|
|
1431
1446
|
/* @__PURE__ */ jsxs("span", {
|
|
1432
1447
|
className: "text-sm font-normal text-po-dim",
|
|
1433
|
-
children: [
|
|
1448
|
+
children: [
|
|
1449
|
+
group.length + (i === 0 && startingBranch ? 1 : 0),
|
|
1450
|
+
" ",
|
|
1451
|
+
t("git.ui.open", "open")
|
|
1452
|
+
]
|
|
1434
1453
|
})
|
|
1435
1454
|
]
|
|
1436
1455
|
}),
|
|
1437
1456
|
i === 1 && /* @__PURE__ */ jsxs("p", {
|
|
1438
1457
|
className: "pt-2 text-sm leading-relaxed text-po-dim",
|
|
1439
1458
|
children: [
|
|
1440
|
-
group.length === 2 ? "Two worktrees" : group.length === 1 ? "One worktree" :
|
|
1459
|
+
group.length === 2 ? t("git.ui.twoWorktrees", "Two worktrees") : group.length === 1 ? t("git.ui.oneWorktree", "One worktree") : t("git.worktree.count", "{count} worktrees", { count: group.length }),
|
|
1441
1460
|
" ",
|
|
1442
|
-
"would like your eye, whenever you are ready."
|
|
1461
|
+
t("git.ui.wouldLikeYourEyeWheneverYouAreReady", "would like your eye, whenever you are ready.")
|
|
1443
1462
|
]
|
|
1444
1463
|
}),
|
|
1445
1464
|
i === 0 && startingBranch && /* @__PURE__ */ jsxs("div", {
|
|
@@ -1449,14 +1468,14 @@ function WorktreesPanelView({ worktrees, pending, error, closeErrorId, onNew, on
|
|
|
1449
1468
|
className: "flex min-w-0 items-center gap-2",
|
|
1450
1469
|
children: [/* @__PURE__ */ jsx(Spinner, {
|
|
1451
1470
|
className: "size-3 shrink-0 text-po-dim",
|
|
1452
|
-
label: "Starting session"
|
|
1471
|
+
label: t("git.ui.startingSession", "Starting session")
|
|
1453
1472
|
}), /* @__PURE__ */ jsx("span", {
|
|
1454
1473
|
className: "min-w-0 flex-1 truncate font-mono text-base font-medium text-po-hi",
|
|
1455
1474
|
children: startingBranch
|
|
1456
1475
|
})]
|
|
1457
1476
|
}), /* @__PURE__ */ jsx("p", {
|
|
1458
1477
|
className: "pl-4 text-sm text-po-dim",
|
|
1459
|
-
children: "Starting session..."
|
|
1478
|
+
children: t("git.ui.startingSessionPending", "Starting session...")
|
|
1460
1479
|
})]
|
|
1461
1480
|
}),
|
|
1462
1481
|
group.map((w) => /* @__PURE__ */ jsx(WorktreeRow, {
|
|
@@ -1472,20 +1491,22 @@ function WorktreesPanelView({ worktrees, pending, error, closeErrorId, onNew, on
|
|
|
1472
1491
|
});
|
|
1473
1492
|
}
|
|
1474
1493
|
function WorktreeBadge({ worktree }) {
|
|
1494
|
+
const t = useT();
|
|
1475
1495
|
if (worktree.orphaned) return /* @__PURE__ */ jsx(StatusBadge, {
|
|
1476
1496
|
tone: "neutral",
|
|
1477
1497
|
size: "xs",
|
|
1478
1498
|
className: "bg-po-tint-yellow text-po-yellow",
|
|
1479
|
-
children: "Orphaned"
|
|
1499
|
+
children: t("git.ui.orphaned", "Orphaned")
|
|
1480
1500
|
});
|
|
1481
1501
|
if (worktree.unowned) return /* @__PURE__ */ jsx(StatusBadge, {
|
|
1482
1502
|
tone: "info",
|
|
1483
1503
|
size: "xs",
|
|
1484
|
-
children: "Unowned"
|
|
1504
|
+
children: t("git.ui.unowned", "Unowned")
|
|
1485
1505
|
});
|
|
1486
1506
|
return null;
|
|
1487
1507
|
}
|
|
1488
1508
|
function WorktreeRow({ worktree, compact = false, starting = false, error, disabled = false, onClose }) {
|
|
1509
|
+
const t = useT();
|
|
1489
1510
|
return /* @__PURE__ */ jsxs("div", {
|
|
1490
1511
|
"data-testid": `git-worktree-${worktree.id}`,
|
|
1491
1512
|
className: compact ? "flex min-w-0 flex-col gap-1 py-2" : "flex min-w-0 flex-col gap-2 border-b border-po-border-soft py-4",
|
|
@@ -1495,7 +1516,7 @@ function WorktreeRow({ worktree, compact = false, starting = false, error, disab
|
|
|
1495
1516
|
children: [
|
|
1496
1517
|
starting ? /* @__PURE__ */ jsx(Spinner, {
|
|
1497
1518
|
className: "size-3 shrink-0 text-po-dim",
|
|
1498
|
-
label: "Starting session"
|
|
1519
|
+
label: t("git.ui.startingSession", "Starting session")
|
|
1499
1520
|
}) : /* @__PURE__ */ jsx(Dot, {
|
|
1500
1521
|
size: "md",
|
|
1501
1522
|
tone: worktree.orphaned ? "yellow" : worktree.unowned ? "blue" : "green"
|
|
@@ -1512,8 +1533,8 @@ function WorktreeRow({ worktree, compact = false, starting = false, error, disab
|
|
|
1512
1533
|
onClick: onClose,
|
|
1513
1534
|
disabled: starting || disabled,
|
|
1514
1535
|
"data-testid": `git-worktree-close-${worktree.id}`,
|
|
1515
|
-
"aria-label":
|
|
1516
|
-
children: "Close"
|
|
1536
|
+
"aria-label": t("git.worktree.closeBranch", "Close {branch}", { branch: worktree.branch }),
|
|
1537
|
+
children: t("git.ui.close", "Close")
|
|
1517
1538
|
})
|
|
1518
1539
|
]
|
|
1519
1540
|
}),
|
|
@@ -1524,11 +1545,11 @@ function WorktreeRow({ worktree, compact = false, starting = false, error, disab
|
|
|
1524
1545
|
}),
|
|
1525
1546
|
starting && /* @__PURE__ */ jsx("p", {
|
|
1526
1547
|
className: "pl-4 text-sm text-po-dim",
|
|
1527
|
-
children: "Starting session..."
|
|
1548
|
+
children: t("git.ui.startingSessionPending", "Starting session...")
|
|
1528
1549
|
}),
|
|
1529
1550
|
!compact && (worktree.orphaned || worktree.unowned) && /* @__PURE__ */ jsx("p", {
|
|
1530
1551
|
className: "pl-4 text-sm text-po-dim first-letter:uppercase",
|
|
1531
|
-
children: worktree.orphaned ? "its folder is missing" : "its session has ended"
|
|
1552
|
+
children: worktree.orphaned ? t("git.worktree.folderMissing", "its folder is missing") : t("git.worktree.sessionEnded", "its session has ended")
|
|
1532
1553
|
}),
|
|
1533
1554
|
error && /* @__PURE__ */ jsx("p", {
|
|
1534
1555
|
role: "alert",
|
|
@@ -1685,6 +1706,7 @@ function requestGitSync(sessionId, action, force = false) {
|
|
|
1685
1706
|
//#endregion
|
|
1686
1707
|
//#region src/extensions/workspaces/sessions/(frontend)/activity-group/git.web.ts
|
|
1687
1708
|
var git_web_default = defineActivityGroup({
|
|
1709
|
+
label: "Git",
|
|
1688
1710
|
keys: "g w",
|
|
1689
1711
|
icon: BranchIcon,
|
|
1690
1712
|
activeSource: {
|
|
@@ -1719,14 +1741,14 @@ var gitWorktrees_web_default = defineChannelFile(worktreesChannel);
|
|
|
1719
1741
|
* spells a route or reaches for `fetch`. What travels is file contents, which a
|
|
1720
1742
|
* tunnel's relay must never see in the clear.
|
|
1721
1743
|
*/
|
|
1722
|
-
const
|
|
1744
|
+
const unreachable = () => t("git.ui.theSessionIsUnreachable", "The session is unreachable.");
|
|
1723
1745
|
function isRecord(value) {
|
|
1724
1746
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1725
1747
|
}
|
|
1726
1748
|
/** The message a reader is shown: the route's own words, or why there were none. */
|
|
1727
1749
|
function messageOf(result) {
|
|
1728
|
-
if (result.status === 0) return
|
|
1729
|
-
return result.error === "" ?
|
|
1750
|
+
if (result.status === 0) return unreachable();
|
|
1751
|
+
return result.error === "" ? t("git.request.sessionStatus", "The session answered {status}.", { status: result.status }) : result.error;
|
|
1730
1752
|
}
|
|
1731
1753
|
async function fetchReviewSummary(sessionId, signal) {
|
|
1732
1754
|
const result = await api.session(sessionId).review(signal === void 0 ? {} : { signal });
|
|
@@ -1736,7 +1758,7 @@ async function fetchReviewSummary(sessionId, signal) {
|
|
|
1736
1758
|
};
|
|
1737
1759
|
if (!isRecord(result.data) || !Array.isArray(result.data.files)) return {
|
|
1738
1760
|
ok: false,
|
|
1739
|
-
error: "The session answered with no file list."
|
|
1761
|
+
error: t("git.ui.theSessionAnsweredWithNoFileList", "The session answered with no file list.")
|
|
1740
1762
|
};
|
|
1741
1763
|
return {
|
|
1742
1764
|
ok: true,
|
|
@@ -1754,7 +1776,7 @@ async function fetchReviewFile(sessionId, path, signal) {
|
|
|
1754
1776
|
};
|
|
1755
1777
|
if (!isRecord(result.data) || !Array.isArray(result.data.hunks)) return {
|
|
1756
1778
|
ok: false,
|
|
1757
|
-
error: "The session answered with no diff."
|
|
1779
|
+
error: t("git.ui.theSessionAnsweredWithNoDiff", "The session answered with no diff.")
|
|
1758
1780
|
};
|
|
1759
1781
|
return {
|
|
1760
1782
|
ok: true,
|
|
@@ -1836,16 +1858,19 @@ function suggestedSyncAction(changes) {
|
|
|
1836
1858
|
return changes.upstream.ahead > 0 ? "push" : void 0;
|
|
1837
1859
|
}
|
|
1838
1860
|
/** "2 to push, 1 new on origin/feat/git", or "Up to date with origin/feat/git". */
|
|
1839
|
-
function upstreamSummary(upstream) {
|
|
1840
|
-
if (upstream === void 0) return "No upstream yet";
|
|
1841
|
-
const parts = [...upstream.ahead > 0 ? [
|
|
1842
|
-
|
|
1861
|
+
function upstreamSummary(t, upstream) {
|
|
1862
|
+
if (upstream === void 0) return t("git.ui.noUpstreamYet", "No upstream yet");
|
|
1863
|
+
const parts = [...upstream.ahead > 0 ? [t("git.sync.toPush", "{count} to push", { count: upstream.ahead })] : [], ...upstream.behind > 0 ? [t("git.sync.newOn", "{count} new on {ref}", {
|
|
1864
|
+
count: upstream.behind,
|
|
1865
|
+
ref: upstream.ref
|
|
1866
|
+
})] : []];
|
|
1867
|
+
return parts.length === 0 ? t("git.sync.upToDate", "Up to date with {ref}", { ref: upstream.ref }) : parts.join(", ");
|
|
1843
1868
|
}
|
|
1844
1869
|
/**
|
|
1845
1870
|
* Hands one deferred follow-up to the session. Returns the reason it failed,
|
|
1846
1871
|
* or undefined once sent. The sender throws when the session is disconnected.
|
|
1847
1872
|
*/
|
|
1848
|
-
function deliverToAgent(send, sessionId, message) {
|
|
1873
|
+
function deliverToAgent(t, send, sessionId, message) {
|
|
1849
1874
|
try {
|
|
1850
1875
|
send(sessionId, {
|
|
1851
1876
|
type: "follow_up",
|
|
@@ -1853,39 +1878,40 @@ function deliverToAgent(send, sessionId, message) {
|
|
|
1853
1878
|
});
|
|
1854
1879
|
return;
|
|
1855
1880
|
} catch (error) {
|
|
1856
|
-
return error instanceof Error ? error.message : "The session did not take the message.";
|
|
1881
|
+
return error instanceof Error ? error.message : t("git.ui.theSessionDidNotTakeTheMessage", "The session did not take the message.");
|
|
1857
1882
|
}
|
|
1858
1883
|
}
|
|
1859
1884
|
//#endregion
|
|
1860
1885
|
//#region src/extensions/workspaces/sessions/(frontend)/_components/GitReviewBrowser.tsx
|
|
1861
|
-
const status = {
|
|
1862
|
-
added: [
|
|
1863
|
-
"A",
|
|
1864
|
-
"text-po-green",
|
|
1865
|
-
"Added"
|
|
1866
|
-
],
|
|
1867
|
-
modified: [
|
|
1868
|
-
"M",
|
|
1869
|
-
"text-po-yellow",
|
|
1870
|
-
"Modified"
|
|
1871
|
-
],
|
|
1872
|
-
deleted: [
|
|
1873
|
-
"D",
|
|
1874
|
-
"text-po-red",
|
|
1875
|
-
"Deleted"
|
|
1876
|
-
],
|
|
1877
|
-
untracked: [
|
|
1878
|
-
"U",
|
|
1879
|
-
"text-po-blue",
|
|
1880
|
-
"Untracked"
|
|
1881
|
-
],
|
|
1882
|
-
conflicted: [
|
|
1883
|
-
"C",
|
|
1884
|
-
"text-po-red",
|
|
1885
|
-
"Conflicted"
|
|
1886
|
-
]
|
|
1887
|
-
};
|
|
1888
1886
|
function GitReviewBrowser({ files, activePath, commentCounts, onPick }) {
|
|
1887
|
+
const t = useT();
|
|
1888
|
+
const status = {
|
|
1889
|
+
added: [
|
|
1890
|
+
"A",
|
|
1891
|
+
"text-po-green",
|
|
1892
|
+
t("git.ui.added", "Added")
|
|
1893
|
+
],
|
|
1894
|
+
modified: [
|
|
1895
|
+
"M",
|
|
1896
|
+
"text-po-yellow",
|
|
1897
|
+
t("git.ui.modified", "Modified")
|
|
1898
|
+
],
|
|
1899
|
+
deleted: [
|
|
1900
|
+
"D",
|
|
1901
|
+
"text-po-red",
|
|
1902
|
+
t("git.ui.deleted", "Deleted")
|
|
1903
|
+
],
|
|
1904
|
+
untracked: [
|
|
1905
|
+
"U",
|
|
1906
|
+
"text-po-blue",
|
|
1907
|
+
t("git.ui.untracked", "Untracked")
|
|
1908
|
+
],
|
|
1909
|
+
conflicted: [
|
|
1910
|
+
"C",
|
|
1911
|
+
"text-po-red",
|
|
1912
|
+
t("git.ui.conflicted", "Conflicted")
|
|
1913
|
+
]
|
|
1914
|
+
};
|
|
1889
1915
|
const [query, setQuery] = useState("");
|
|
1890
1916
|
const shown = files.filter((f) => f.path.toLowerCase().includes(query.trim().toLowerCase()));
|
|
1891
1917
|
const listRef = useRef(null);
|
|
@@ -1907,7 +1933,7 @@ function GitReviewBrowser({ files, activePath, commentCounts, onPick }) {
|
|
|
1907
1933
|
event.currentTarget.closest("[data-git-review-list]")?.querySelectorAll("[data-git-review-row]")[next]?.focus();
|
|
1908
1934
|
};
|
|
1909
1935
|
return /* @__PURE__ */ jsxs("nav", {
|
|
1910
|
-
"aria-label": "Changed files",
|
|
1936
|
+
"aria-label": t("git.ui.changedFiles", "Changed files"),
|
|
1911
1937
|
"data-testid": "git-review-browser",
|
|
1912
1938
|
className: "flex min-h-0 w-80 shrink-0 flex-col border-r border-po-border-soft",
|
|
1913
1939
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -1915,13 +1941,17 @@ function GitReviewBrowser({ files, activePath, commentCounts, onPick }) {
|
|
|
1915
1941
|
children: [/* @__PURE__ */ jsx(Input, {
|
|
1916
1942
|
"data-testid": "git-review-search",
|
|
1917
1943
|
size: "sm",
|
|
1918
|
-
"aria-label": "Search paths",
|
|
1919
|
-
placeholder: "Search paths",
|
|
1944
|
+
"aria-label": t("git.ui.searchPaths", "Search paths"),
|
|
1945
|
+
placeholder: t("git.ui.searchPaths", "Search paths"),
|
|
1920
1946
|
value: query,
|
|
1921
1947
|
onChange: (e) => setQuery(e.target.value)
|
|
1922
1948
|
}), /* @__PURE__ */ jsxs("span", {
|
|
1923
1949
|
className: "text-sm text-po-dim",
|
|
1924
|
-
children: [
|
|
1950
|
+
children: [
|
|
1951
|
+
shown.length,
|
|
1952
|
+
" ",
|
|
1953
|
+
t("git.ui.changed", "changed")
|
|
1954
|
+
]
|
|
1925
1955
|
})]
|
|
1926
1956
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1927
1957
|
ref: listRef,
|
|
@@ -1978,10 +2008,10 @@ function GitReviewBrowser({ files, activePath, commentCounts, onPick }) {
|
|
|
1978
2008
|
size: "compact",
|
|
1979
2009
|
surface: "plain",
|
|
1980
2010
|
icon: /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
1981
|
-
title: "No paths match",
|
|
1982
|
-
description: query.trim() ?
|
|
2011
|
+
title: t("git.ui.noPathsMatch", "No paths match"),
|
|
2012
|
+
description: query.trim() ? t("git.review.noMatchingPath", "No changed file path contains \"{query}\".", { query: query.trim() }) : void 0,
|
|
1983
2013
|
secondaryAction: {
|
|
1984
|
-
label: "Clear filter",
|
|
2014
|
+
label: t("git.ui.clearFilter", "Clear filter"),
|
|
1985
2015
|
onAction: () => setQuery("")
|
|
1986
2016
|
}
|
|
1987
2017
|
})]
|
|
@@ -1991,12 +2021,13 @@ function GitReviewBrowser({ files, activePath, commentCounts, onPick }) {
|
|
|
1991
2021
|
//#endregion
|
|
1992
2022
|
//#region src/extensions/workspaces/sessions/(frontend)/_components/GitSyncBar.tsx
|
|
1993
2023
|
function GitSyncBar({ secondary = false, ...props }) {
|
|
2024
|
+
const t = useT();
|
|
1994
2025
|
const c = props.changes;
|
|
1995
2026
|
const paused = c?.rebase !== void 0;
|
|
1996
2027
|
const busy = props.pending !== void 0;
|
|
1997
2028
|
const rejected = props.errorTarget?.action === "push" && props.errorTarget.forceRequired;
|
|
1998
2029
|
const suggested = suggestedSyncAction(c);
|
|
1999
|
-
const upstream = upstreamSummary(c?.upstream);
|
|
2030
|
+
const upstream = upstreamSummary(t, c?.upstream);
|
|
2000
2031
|
return /* @__PURE__ */ jsxs("div", {
|
|
2001
2032
|
"data-testid": "git-sync-bar",
|
|
2002
2033
|
className: "flex flex-col gap-3 border-b border-po-border-soft p-4",
|
|
@@ -2008,21 +2039,29 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2008
2039
|
/* @__PURE__ */ jsx("span", {
|
|
2009
2040
|
"data-testid": "git-review-branch",
|
|
2010
2041
|
className: "font-mono text-base font-semibold text-po-hi",
|
|
2011
|
-
children: c?.branch ?? "Detached HEAD"
|
|
2042
|
+
children: c?.branch ?? t("git.ui.detachedHEAD", "Detached HEAD")
|
|
2012
2043
|
}),
|
|
2013
2044
|
/* @__PURE__ */ jsx("span", {
|
|
2014
2045
|
className: "text-po-dim",
|
|
2015
|
-
children: c?.base === void 0 ? "Uncommitted changes" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2046
|
+
children: c?.base === void 0 ? t("git.ui.uncommittedChanges", "Uncommitted changes") : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2047
|
+
t("git.ui.vs", "vs"),
|
|
2048
|
+
" ",
|
|
2049
|
+
/* @__PURE__ */ jsx("span", {
|
|
2050
|
+
className: "font-mono",
|
|
2051
|
+
children: c.base
|
|
2052
|
+
})
|
|
2053
|
+
] })
|
|
2019
2054
|
}),
|
|
2020
2055
|
props.mergeBase && /* @__PURE__ */ jsxs("span", {
|
|
2021
2056
|
className: "text-po-dim",
|
|
2022
|
-
children: [
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2057
|
+
children: [
|
|
2058
|
+
t("git.ui.fromLabel", "from"),
|
|
2059
|
+
" ",
|
|
2060
|
+
/* @__PURE__ */ jsx("span", {
|
|
2061
|
+
className: "font-mono",
|
|
2062
|
+
children: props.mergeBase
|
|
2063
|
+
})
|
|
2064
|
+
]
|
|
2026
2065
|
}),
|
|
2027
2066
|
c === void 0 ? null : /* @__PURE__ */ jsxs("span", {
|
|
2028
2067
|
"data-testid": "git-review-totals",
|
|
@@ -2042,7 +2081,7 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2042
2081
|
c?.files,
|
|
2043
2082
|
c?.truncated ? "+" : "",
|
|
2044
2083
|
" ",
|
|
2045
|
-
c?.files === 1 ? "file" : "files"
|
|
2084
|
+
c?.files === 1 ? t("git.ui.file", "file") : t("git.ui.files", "files")
|
|
2046
2085
|
]
|
|
2047
2086
|
})
|
|
2048
2087
|
]
|
|
@@ -2050,7 +2089,7 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2050
2089
|
/* @__PURE__ */ jsx("span", { className: "flex-1" }),
|
|
2051
2090
|
/* @__PURE__ */ jsx("span", {
|
|
2052
2091
|
className: "text-po-dim",
|
|
2053
|
-
children: c?.branch === void 0 ? "No branch checked out" : c.upstream === void 0 || !upstream.endsWith(c.upstream.ref) ? upstream : /* @__PURE__ */ jsxs(Fragment, { children: [upstream.slice(0, -c.upstream.ref.length), /* @__PURE__ */ jsx("span", {
|
|
2092
|
+
children: c?.branch === void 0 ? t("git.ui.noBranchCheckedOut", "No branch checked out") : c.upstream === void 0 || !upstream.endsWith(c.upstream.ref) ? upstream : /* @__PURE__ */ jsxs(Fragment, { children: [upstream.slice(0, -c.upstream.ref.length), /* @__PURE__ */ jsx("span", {
|
|
2054
2093
|
className: "font-mono",
|
|
2055
2094
|
children: c.upstream.ref
|
|
2056
2095
|
})] })
|
|
@@ -2067,7 +2106,7 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2067
2106
|
variant: !busy && !paused && !rejected && !props.error && c?.branch !== void 0 && suggested === action ? secondary ? "outline" : "primary" : "ghost",
|
|
2068
2107
|
disabled: busy || paused || action !== "rebase" && c?.branch === void 0 || action === "pull" && c?.upstream === void 0 || action === "rebase" && c?.base === void 0,
|
|
2069
2108
|
onClick: () => props.onSync(action),
|
|
2070
|
-
children: action === "pull" ? "Pull" : action === "push" ? "Push" : "Rebase"
|
|
2109
|
+
children: action === "pull" ? t("git.ui.pull", "Pull") : action === "push" ? t("git.ui.push", "Push") : t("git.ui.rebase", "Rebase")
|
|
2071
2110
|
}, action))
|
|
2072
2111
|
})
|
|
2073
2112
|
]
|
|
@@ -2086,7 +2125,7 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2086
2125
|
children: [
|
|
2087
2126
|
/* @__PURE__ */ jsx("span", {
|
|
2088
2127
|
className: "flex-1 text-base text-po-text",
|
|
2089
|
-
children: "origin has commits you have not pulled yet."
|
|
2128
|
+
children: t("git.ui.originHasCommitsYouHaveNotPulledYet", "origin has commits you have not pulled yet.")
|
|
2090
2129
|
}),
|
|
2091
2130
|
/* @__PURE__ */ jsx(Button, {
|
|
2092
2131
|
size: "sm",
|
|
@@ -2094,14 +2133,14 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2094
2133
|
"data-testid": "git-push-force",
|
|
2095
2134
|
disabled: busy,
|
|
2096
2135
|
onClick: props.onForcePush,
|
|
2097
|
-
children: "Force push with lease"
|
|
2136
|
+
children: t("git.ui.forcePushWithLease", "Force push with lease")
|
|
2098
2137
|
}),
|
|
2099
2138
|
/* @__PURE__ */ jsx(Button, {
|
|
2100
2139
|
size: "sm",
|
|
2101
2140
|
variant: "ghost",
|
|
2102
2141
|
"data-testid": "git-push-force-cancel",
|
|
2103
2142
|
onClick: props.onDismissError,
|
|
2104
|
-
children: "Not now"
|
|
2143
|
+
children: t("git.ui.notNow", "Not now")
|
|
2105
2144
|
})
|
|
2106
2145
|
]
|
|
2107
2146
|
}) : props.error && /* @__PURE__ */ jsxs("div", {
|
|
@@ -2115,7 +2154,7 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2115
2154
|
size: "sm",
|
|
2116
2155
|
variant: "ghost",
|
|
2117
2156
|
onClick: props.onDismissError,
|
|
2118
|
-
children: "Dismiss"
|
|
2157
|
+
children: t("git.ui.dismiss", "Dismiss")
|
|
2119
2158
|
})]
|
|
2120
2159
|
}),
|
|
2121
2160
|
paused && /* @__PURE__ */ jsxs("div", {
|
|
@@ -2125,14 +2164,15 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2125
2164
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(StatusBadge, {
|
|
2126
2165
|
tone: "running",
|
|
2127
2166
|
size: "xs",
|
|
2128
|
-
children: "Rebase paused"
|
|
2167
|
+
children: t("git.ui.rebasePaused", "Rebase paused")
|
|
2129
2168
|
}), /* @__PURE__ */ jsxs("span", {
|
|
2130
2169
|
className: "ml-2 text-base text-po-text",
|
|
2131
2170
|
children: [
|
|
2132
|
-
"Conflicts in
|
|
2171
|
+
t("git.ui.conflictsIn", "Conflicts in"),
|
|
2172
|
+
" ",
|
|
2133
2173
|
c.rebase?.conflicts.length,
|
|
2134
2174
|
" ",
|
|
2135
|
-
c.rebase?.conflicts.length === 1 ? "file" : "files"
|
|
2175
|
+
c.rebase?.conflicts.length === 1 ? t("git.ui.file", "file") : t("git.ui.files", "files")
|
|
2136
2176
|
]
|
|
2137
2177
|
})] }),
|
|
2138
2178
|
c.rebase?.conflicts.map((path) => /* @__PURE__ */ jsx("p", {
|
|
@@ -2148,7 +2188,7 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2148
2188
|
"data-testid": "git-rebase-ask-agent",
|
|
2149
2189
|
disabled: busy,
|
|
2150
2190
|
onClick: props.onAskAgent,
|
|
2151
|
-
children: "Ask Po to resolve"
|
|
2191
|
+
children: t("git.ui.askPoToResolve", "Ask Po to resolve")
|
|
2152
2192
|
}),
|
|
2153
2193
|
/* @__PURE__ */ jsx(Button, {
|
|
2154
2194
|
variant: "danger-outline",
|
|
@@ -2156,11 +2196,11 @@ function GitSyncBar({ secondary = false, ...props }) {
|
|
|
2156
2196
|
"data-testid": "git-rebase-abort",
|
|
2157
2197
|
disabled: busy,
|
|
2158
2198
|
onClick: () => props.onSync("abort-rebase"),
|
|
2159
|
-
children: "Abort rebase"
|
|
2199
|
+
children: t("git.ui.abortRebase", "Abort rebase")
|
|
2160
2200
|
}),
|
|
2161
2201
|
/* @__PURE__ */ jsx("span", {
|
|
2162
2202
|
className: "text-sm text-po-dim",
|
|
2163
|
-
children: "Abort discards conflict resolution in progress."
|
|
2203
|
+
children: t("git.ui.abortDiscardsConflictResolutionInProgress", "Abort discards conflict resolution in progress.")
|
|
2164
2204
|
})
|
|
2165
2205
|
]
|
|
2166
2206
|
})
|
|
@@ -2180,6 +2220,7 @@ function sideOf(row) {
|
|
|
2180
2220
|
return row.marker === "-" ? "old" : "new";
|
|
2181
2221
|
}
|
|
2182
2222
|
function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddComment, onRemoveComment, onSendReview, onDiscard, onDraftChange, sendError, initialDraft, initialPath }) {
|
|
2223
|
+
const t = useT();
|
|
2183
2224
|
const entries = summary.state === "ready" ? summary.summary.files : NO_FILES;
|
|
2184
2225
|
const [picked, setPicked] = useState(initialPath ?? initialDraft?.path);
|
|
2185
2226
|
const activePath = entries.some((entry) => entry.path === picked) ? picked : entries[0]?.path;
|
|
@@ -2198,7 +2239,7 @@ function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddCommen
|
|
|
2198
2239
|
const pick = (path) => {
|
|
2199
2240
|
if (!entries.some((entry) => entry.path === path)) return;
|
|
2200
2241
|
if (path !== activePath && draft !== void 0) {
|
|
2201
|
-
if (!window.confirm("Discard the unsent comment and open another file?")) return;
|
|
2242
|
+
if (!window.confirm(t("git.ui.discardTheUnsentCommentAndOpenAnotherFileConfirm", "Discard the unsent comment and open another file?"))) return;
|
|
2202
2243
|
setDraft(void 0);
|
|
2203
2244
|
onDraftChange?.(false);
|
|
2204
2245
|
}
|
|
@@ -2232,29 +2273,29 @@ function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddCommen
|
|
|
2232
2273
|
className: "flex min-h-48 flex-1 items-center justify-center gap-2 text-sm text-po-dim",
|
|
2233
2274
|
children: [/* @__PURE__ */ jsx(Spinner, {
|
|
2234
2275
|
className: "h-4 w-4 text-po-dim",
|
|
2235
|
-
label: "Reading changes"
|
|
2276
|
+
label: t("git.ui.readingChanges", "Reading changes")
|
|
2236
2277
|
}), /* @__PURE__ */ jsx("span", {
|
|
2237
2278
|
className: "text-sm text-po-dim",
|
|
2238
|
-
children: "Reading changes..."
|
|
2279
|
+
children: t("git.ui.readingChangesPending", "Reading changes...")
|
|
2239
2280
|
})]
|
|
2240
2281
|
}) : summary.state === "error" ? /* @__PURE__ */ jsx(EmptyState, {
|
|
2241
2282
|
"data-testid": "git-review-error",
|
|
2242
2283
|
className: "min-h-48 text-po-red",
|
|
2243
2284
|
title: /* @__PURE__ */ jsx("span", {
|
|
2244
2285
|
className: "text-po-red",
|
|
2245
|
-
children: "Changes could not be read"
|
|
2286
|
+
children: t("git.ui.changesCouldNotBeRead", "Changes could not be read")
|
|
2246
2287
|
}),
|
|
2247
2288
|
description: summary.error
|
|
2248
2289
|
}) : !summary.summary.repository ? /* @__PURE__ */ jsx(EmptyState, {
|
|
2249
2290
|
"data-testid": "git-review-no-repository",
|
|
2250
2291
|
className: "min-h-48",
|
|
2251
|
-
title: "Not a Git checkout",
|
|
2252
|
-
description: "This session's folder is not inside a Git repository."
|
|
2292
|
+
title: t("git.ui.notAGitCheckout", "Not a Git checkout"),
|
|
2293
|
+
description: t("git.ui.thisSessionSFolderIsNotInsideAGitRepository", "This session's folder is not inside a Git repository.")
|
|
2253
2294
|
}) : entries.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
2254
2295
|
"data-testid": "git-review-empty",
|
|
2255
2296
|
className: "min-h-48",
|
|
2256
|
-
title: "No changes yet",
|
|
2257
|
-
description: summary.summary.base === void 0 ? "Nothing uncommitted in this checkout." :
|
|
2297
|
+
title: t("git.ui.noChangesYet", "No changes yet"),
|
|
2298
|
+
description: summary.summary.base === void 0 ? t("git.ui.nothingUncommittedInThisCheckout", "Nothing uncommitted in this checkout.") : t("git.review.nothingDiffers", "Nothing differs from {base}, committed or not.", { base: summary.summary.base })
|
|
2258
2299
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
2259
2300
|
"data-testid": "git-review-content",
|
|
2260
2301
|
className: "flex min-h-0 flex-1",
|
|
@@ -2269,7 +2310,7 @@ function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddCommen
|
|
|
2269
2310
|
children: [
|
|
2270
2311
|
summary.summary.truncated ? /* @__PURE__ */ jsx("p", {
|
|
2271
2312
|
className: "px-4 pt-2 text-sm text-po-dim",
|
|
2272
|
-
children: "More files changed than the review lists; the rest are left out."
|
|
2313
|
+
children: t("git.ui.moreFilesChangedThanTheReviewListsTheRestAreLeftOut", "More files changed than the review lists; the rest are left out.")
|
|
2273
2314
|
}) : null,
|
|
2274
2315
|
/* @__PURE__ */ jsxs("div", {
|
|
2275
2316
|
className: "flex items-center justify-between border-b border-po-border-soft px-4 py-2",
|
|
@@ -2279,13 +2320,15 @@ function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddCommen
|
|
|
2279
2320
|
size: "sm",
|
|
2280
2321
|
disabled: index <= 0,
|
|
2281
2322
|
onClick: () => pick(entries[index - 1].path),
|
|
2282
|
-
children: "Previous file"
|
|
2323
|
+
children: t("git.ui.previousFile", "Previous file")
|
|
2283
2324
|
}),
|
|
2284
2325
|
/* @__PURE__ */ jsxs("span", {
|
|
2285
2326
|
className: "text-sm text-po-dim",
|
|
2286
2327
|
children: [
|
|
2287
2328
|
index + 1,
|
|
2288
|
-
"
|
|
2329
|
+
" ",
|
|
2330
|
+
t("git.ui.of", "of"),
|
|
2331
|
+
" ",
|
|
2289
2332
|
entries.length
|
|
2290
2333
|
]
|
|
2291
2334
|
}),
|
|
@@ -2294,7 +2337,7 @@ function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddCommen
|
|
|
2294
2337
|
size: "sm",
|
|
2295
2338
|
disabled: index >= entries.length - 1,
|
|
2296
2339
|
onClick: () => pick(entries[index + 1].path),
|
|
2297
|
-
children: "Next file"
|
|
2340
|
+
children: t("git.ui.nextFile", "Next file")
|
|
2298
2341
|
})
|
|
2299
2342
|
]
|
|
2300
2343
|
}),
|
|
@@ -2333,7 +2376,7 @@ function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddCommen
|
|
|
2333
2376
|
/* @__PURE__ */ jsx("span", {
|
|
2334
2377
|
"data-testid": "git-review-comment-count",
|
|
2335
2378
|
className: "text-sm text-po-dim",
|
|
2336
|
-
children: comments.length === 0 ? "No comments yet: select lines or click a line number" :
|
|
2379
|
+
children: comments.length === 0 ? t("git.ui.noCommentsYetSelectLinesOrClickALineNumber", "No comments yet: select lines or click a line number") : comments.length === 1 ? t("git.review.commentsQueuedOne", "{count} comment queued", { count: comments.length }) : t("git.review.commentsQueued", "{count} comments queued", { count: comments.length })
|
|
2337
2380
|
}),
|
|
2338
2381
|
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1" }),
|
|
2339
2382
|
sendError === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
@@ -2348,7 +2391,7 @@ function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddCommen
|
|
|
2348
2391
|
"data-testid": "git-review-discard",
|
|
2349
2392
|
disabled: comments.length === 0,
|
|
2350
2393
|
onClick: onDiscard,
|
|
2351
|
-
children: "Discard"
|
|
2394
|
+
children: t("git.ui.discard", "Discard")
|
|
2352
2395
|
}),
|
|
2353
2396
|
/* @__PURE__ */ jsx(Button, {
|
|
2354
2397
|
variant: "primary",
|
|
@@ -2356,22 +2399,23 @@ function GitReviewView({ sync, summary, files, comments, onLoadFile, onAddCommen
|
|
|
2356
2399
|
"data-testid": "git-review-send",
|
|
2357
2400
|
disabled: comments.length === 0,
|
|
2358
2401
|
onClick: onSendReview,
|
|
2359
|
-
children: "Send review"
|
|
2402
|
+
children: t("git.ui.sendReview", "Send review")
|
|
2360
2403
|
})
|
|
2361
2404
|
]
|
|
2362
2405
|
})
|
|
2363
2406
|
]
|
|
2364
2407
|
});
|
|
2365
2408
|
}
|
|
2366
|
-
const STATUS_WORD = {
|
|
2367
|
-
added: "Added",
|
|
2368
|
-
modified: "Modified",
|
|
2369
|
-
deleted: "Deleted",
|
|
2370
|
-
untracked: "Untracked",
|
|
2371
|
-
conflicted: "Conflicted"
|
|
2372
|
-
};
|
|
2373
2409
|
/** One file: a pinned header, then its diff with comments drawn under the lines they are about. */
|
|
2374
2410
|
function FileSection({ id, entry, state, comments, draft, onSelect, onSubmitDraft, onCancelDraft, onRemoveComment, onRetry }) {
|
|
2411
|
+
const t = useT();
|
|
2412
|
+
const STATUS_WORD = {
|
|
2413
|
+
added: t("git.ui.added", "Added"),
|
|
2414
|
+
modified: t("git.ui.modified", "Modified"),
|
|
2415
|
+
deleted: t("git.ui.deleted", "Deleted"),
|
|
2416
|
+
untracked: t("git.ui.untracked", "Untracked"),
|
|
2417
|
+
conflicted: t("git.ui.conflicted", "Conflicted")
|
|
2418
|
+
};
|
|
2375
2419
|
const renderAfterRow = (row) => {
|
|
2376
2420
|
const side = sideOf(row);
|
|
2377
2421
|
const here = comments.filter((comment) => (comment.side ?? "new") === side && (comment.endLine ?? comment.startLine) === row.line);
|
|
@@ -2391,7 +2435,11 @@ function FileSection({ id, entry, state, comments, draft, onSelect, onSubmitDraf
|
|
|
2391
2435
|
className: "flex min-w-0 flex-1 flex-col",
|
|
2392
2436
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
2393
2437
|
className: "mb-1 text-sm text-po-dim",
|
|
2394
|
-
children: [
|
|
2438
|
+
children: [
|
|
2439
|
+
t("git.ui.youLine", "You · line"),
|
|
2440
|
+
" ",
|
|
2441
|
+
comment.endLine ?? comment.startLine
|
|
2442
|
+
]
|
|
2395
2443
|
}), /* @__PURE__ */ jsx("span", {
|
|
2396
2444
|
className: "text-base whitespace-pre-wrap text-po-text",
|
|
2397
2445
|
children: comment.body
|
|
@@ -2400,10 +2448,10 @@ function FileSection({ id, entry, state, comments, draft, onSelect, onSubmitDraf
|
|
|
2400
2448
|
/* @__PURE__ */ jsx(Button, {
|
|
2401
2449
|
variant: "ghost",
|
|
2402
2450
|
size: "sm",
|
|
2403
|
-
"aria-label": "Remove comment",
|
|
2404
|
-
title: "Remove comment",
|
|
2451
|
+
"aria-label": t("git.ui.removeComment", "Remove comment"),
|
|
2452
|
+
title: t("git.ui.removeComment", "Remove comment"),
|
|
2405
2453
|
onClick: () => onRemoveComment(comment.id),
|
|
2406
|
-
children: "Remove"
|
|
2454
|
+
children: t("git.ui.remove", "Remove")
|
|
2407
2455
|
})
|
|
2408
2456
|
]
|
|
2409
2457
|
}, comment.id)), drafting ? /* @__PURE__ */ jsx("div", {
|
|
@@ -2444,15 +2492,10 @@ function FileSection({ id, entry, state, comments, draft, onSelect, onSubmitDraf
|
|
|
2444
2492
|
})] }),
|
|
2445
2493
|
comments.length === 0 ? null : /* @__PURE__ */ jsxs("span", {
|
|
2446
2494
|
className: "flex shrink-0 items-center gap-1 text-sm text-po-blue",
|
|
2447
|
-
children: [
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
}),
|
|
2452
|
-
comments.length,
|
|
2453
|
-
" ",
|
|
2454
|
-
comments.length === 1 ? "comment" : "comments"
|
|
2455
|
-
]
|
|
2495
|
+
children: [/* @__PURE__ */ jsx(MessageIcon, {
|
|
2496
|
+
"aria-hidden": true,
|
|
2497
|
+
className: "h-3 w-3"
|
|
2498
|
+
}), comments.length === 1 ? t("git.ui.commentCount", "{count} comment", { count: comments.length }) : t("git.ui.commentsCount", "{count} comments", { count: comments.length })]
|
|
2456
2499
|
})
|
|
2457
2500
|
]
|
|
2458
2501
|
}), /* @__PURE__ */ jsx("div", {
|
|
@@ -2461,10 +2504,10 @@ function FileSection({ id, entry, state, comments, draft, onSelect, onSubmitDraf
|
|
|
2461
2504
|
className: "flex items-center gap-2 px-4 py-3",
|
|
2462
2505
|
children: [/* @__PURE__ */ jsx(Spinner, {
|
|
2463
2506
|
className: "h-3 w-3 text-po-faint",
|
|
2464
|
-
label:
|
|
2507
|
+
label: t("git.review.loadingFile", "Loading {path}", { path: entry.path })
|
|
2465
2508
|
}), /* @__PURE__ */ jsx("span", {
|
|
2466
2509
|
className: "text-sm text-po-dim",
|
|
2467
|
-
children: "Loading diff..."
|
|
2510
|
+
children: t("git.ui.loadingDiffPending", "Loading diff...")
|
|
2468
2511
|
})]
|
|
2469
2512
|
}) : state.state === "error" ? /* @__PURE__ */ jsxs("div", {
|
|
2470
2513
|
className: "flex min-h-48 flex-col items-center justify-center gap-3",
|
|
@@ -2476,16 +2519,16 @@ function FileSection({ id, entry, state, comments, draft, onSelect, onSubmitDraf
|
|
|
2476
2519
|
variant: "outline",
|
|
2477
2520
|
size: "sm",
|
|
2478
2521
|
onClick: onRetry,
|
|
2479
|
-
children: "Retry"
|
|
2522
|
+
children: t("git.ui.retry", "Retry")
|
|
2480
2523
|
})]
|
|
2481
2524
|
}) : state.diff.binary ? /* @__PURE__ */ jsx(EmptyState, {
|
|
2482
2525
|
className: "min-h-48",
|
|
2483
|
-
title: "Binary file",
|
|
2484
|
-
description:
|
|
2526
|
+
title: t("git.ui.binaryFile", "Binary file"),
|
|
2527
|
+
description: t("git.review.binaryDescription", "{path} cannot be shown as a text diff.", { path: entry.path })
|
|
2485
2528
|
}) : state.diff.tooLarge ? /* @__PURE__ */ jsx(EmptyState, {
|
|
2486
2529
|
className: "min-h-48",
|
|
2487
|
-
title: "This diff is too large to show",
|
|
2488
|
-
description: "Other changed files are still available to review."
|
|
2530
|
+
title: t("git.ui.thisDiffIsTooLargeToShow", "This diff is too large to show"),
|
|
2531
|
+
description: t("git.ui.otherChangedFilesAreStillAvailableToReview", "Other changed files are still available to review.")
|
|
2489
2532
|
}) : /* @__PURE__ */ jsx(DiffView, {
|
|
2490
2533
|
hunks: state.diff.hunks,
|
|
2491
2534
|
testId: `git-review-diff-${id}`,
|
|
@@ -2518,11 +2561,12 @@ const REVIEW_TAB_ID = "git-review";
|
|
|
2518
2561
|
function reviewTab() {
|
|
2519
2562
|
return {
|
|
2520
2563
|
id: REVIEW_TAB_ID,
|
|
2521
|
-
label: "review",
|
|
2564
|
+
label: t("git.tab.review", "review"),
|
|
2522
2565
|
panel: GitReviewPanel
|
|
2523
2566
|
};
|
|
2524
2567
|
}
|
|
2525
2568
|
function GitReviewPanel({ sessionId, sendSessionFrame }) {
|
|
2569
|
+
const t = useT();
|
|
2526
2570
|
const activity = useStore(gitChanges.store, (state) => gitChanges.select(state, sessionId));
|
|
2527
2571
|
const comments = useStore(gitReview.store, (state) => gitReview.select(state, sessionId).comments);
|
|
2528
2572
|
const focus = useStore(gitReview.store, (state) => gitReview.select(state, sessionId).focus);
|
|
@@ -2570,7 +2614,7 @@ function GitReviewPanel({ sessionId, sendSessionFrame }) {
|
|
|
2570
2614
|
if (controller.signal.aborted) return;
|
|
2571
2615
|
setSummary({
|
|
2572
2616
|
state: "error",
|
|
2573
|
-
error: error instanceof Error ? error.message : "The changes could not be read."
|
|
2617
|
+
error: error instanceof Error ? error.message : t("git.ui.theChangesCouldNotBeRead", "The changes could not be read.")
|
|
2574
2618
|
});
|
|
2575
2619
|
});
|
|
2576
2620
|
return () => {
|
|
@@ -2580,7 +2624,11 @@ function GitReviewPanel({ sessionId, sendSessionFrame }) {
|
|
|
2580
2624
|
for (const request of pending.values()) request.abort();
|
|
2581
2625
|
pending.clear();
|
|
2582
2626
|
};
|
|
2583
|
-
}, [
|
|
2627
|
+
}, [
|
|
2628
|
+
sessionId,
|
|
2629
|
+
refreshFingerprint,
|
|
2630
|
+
t
|
|
2631
|
+
]);
|
|
2584
2632
|
const loadFile = useCallback((path) => {
|
|
2585
2633
|
if (sessionId === null || !readyGeneration.current || pendingFiles.current.has(path)) return;
|
|
2586
2634
|
const requestGeneration = generation.current;
|
|
@@ -2605,17 +2653,17 @@ function GitReviewPanel({ sessionId, sendSessionFrame }) {
|
|
|
2605
2653
|
error: result.error
|
|
2606
2654
|
})).catch((error) => settle({
|
|
2607
2655
|
state: "error",
|
|
2608
|
-
error: error instanceof Error ? error.message : "The diff could not be read."
|
|
2656
|
+
error: error instanceof Error ? error.message : t("git.ui.theDiffCouldNotBeRead", "The diff could not be read.")
|
|
2609
2657
|
})).finally(() => {
|
|
2610
2658
|
if (pendingFiles.current.get(path) === controller) pendingFiles.current.delete(path);
|
|
2611
2659
|
});
|
|
2612
|
-
}, [sessionId]);
|
|
2660
|
+
}, [sessionId, t]);
|
|
2613
2661
|
if (sessionId === null) return null;
|
|
2614
2662
|
const branch = summary.state === "ready" ? summary.summary.branch : changes?.branch;
|
|
2615
2663
|
const base = summary.state === "ready" ? summary.summary.base : changes?.base;
|
|
2616
2664
|
const error = activity.error === dismissedError ? void 0 : activity.error;
|
|
2617
2665
|
const send = (message, onSent) => {
|
|
2618
|
-
const failure = deliverToAgent(sendSessionFrame, sessionId, message);
|
|
2666
|
+
const failure = deliverToAgent(t, sendSessionFrame, sessionId, message);
|
|
2619
2667
|
setSendError(failure);
|
|
2620
2668
|
if (failure === void 0) onSent?.();
|
|
2621
2669
|
};
|
|
@@ -2631,7 +2679,7 @@ function GitReviewPanel({ sessionId, sendSessionFrame }) {
|
|
|
2631
2679
|
...error === void 0 ? {} : { error },
|
|
2632
2680
|
...activity.errorTarget === void 0 || error === void 0 ? {} : { errorTarget: activity.errorTarget },
|
|
2633
2681
|
onSync: (action) => {
|
|
2634
|
-
if (action === "abort-rebase" && !window.confirm("Abort rebase? This discards conflict resolution in progress.")) return;
|
|
2682
|
+
if (action === "abort-rebase" && !window.confirm(t("git.ui.abortRebaseThisDiscardsConflictResolutionInProgress", "Abort rebase? This discards conflict resolution in progress."))) return;
|
|
2635
2683
|
requestGitSync(sessionId, action);
|
|
2636
2684
|
},
|
|
2637
2685
|
onForcePush: () => requestGitSync(sessionId, "push", true),
|
|
@@ -2657,7 +2705,7 @@ var GitReview_lint_finding_review_web_default = defineFill({
|
|
|
2657
2705
|
id: "git-review",
|
|
2658
2706
|
data: {
|
|
2659
2707
|
version: 1,
|
|
2660
|
-
label: "Open in review",
|
|
2708
|
+
label: t("git.ui.openInReview", "Open in review"),
|
|
2661
2709
|
open: (props, path) => {
|
|
2662
2710
|
if (props.sessionId === null) return;
|
|
2663
2711
|
focusReviewFile(props.sessionId, path);
|
|
@@ -2696,8 +2744,9 @@ function DiffActivitySection({ sessionId, openTransientTab }) {
|
|
|
2696
2744
|
});
|
|
2697
2745
|
}
|
|
2698
2746
|
function DiffActivityView({ changes, pending, onReview, branch }) {
|
|
2747
|
+
const t = useT();
|
|
2699
2748
|
const zero = changes?.added === 0 && changes?.removed === 0;
|
|
2700
|
-
const against = changes?.base === void 0 ? "uncommitted" :
|
|
2749
|
+
const against = changes?.base === void 0 ? t("git.review.uncommitted", "uncommitted") : t("git.review.versus", "vs {base}", { base: changes.base });
|
|
2701
2750
|
return /* @__PURE__ */ jsxs("div", {
|
|
2702
2751
|
className: "flex min-w-0 flex-col gap-1",
|
|
2703
2752
|
children: [/* @__PURE__ */ jsxs(Button, {
|
|
@@ -2705,15 +2754,26 @@ function DiffActivityView({ changes, pending, onReview, branch }) {
|
|
|
2705
2754
|
size: "card",
|
|
2706
2755
|
"data-testid": "activity-diff-changes",
|
|
2707
2756
|
className: "min-w-0 flex-row items-center gap-2 rounded-md px-1 py-1 font-normal hover:bg-po-panel",
|
|
2708
|
-
"aria-label": changes ?
|
|
2709
|
-
|
|
2757
|
+
"aria-label": changes ? t("git.review.changesLabel", "review {branch} changes: {added} added, {removed} removed {against}", {
|
|
2758
|
+
branch: changes.branch ?? t("git.review.detachedHeadLower", "detached HEAD"),
|
|
2759
|
+
added: changes.added,
|
|
2760
|
+
removed: changes.removed,
|
|
2761
|
+
against
|
|
2762
|
+
}) : t("git.ui.changesNotReportedYet", "Changes not reported yet"),
|
|
2763
|
+
title: changes ? changes.files === 1 ? t("git.review.filesAgainstOne", "{count} file {against}", {
|
|
2764
|
+
count: changes.files,
|
|
2765
|
+
against
|
|
2766
|
+
}) : t("git.review.filesAgainst", "{count} files {against}", {
|
|
2767
|
+
count: changes.files,
|
|
2768
|
+
against
|
|
2769
|
+
}) : void 0,
|
|
2710
2770
|
onClick: onReview,
|
|
2711
2771
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2712
2772
|
className: "min-w-0 flex-1 truncate text-left font-mono text-sm text-po-hi",
|
|
2713
|
-
children: changes?.branch ?? branch ?? "detached HEAD"
|
|
2773
|
+
children: changes?.branch ?? branch ?? t("git.review.detachedHeadLower", "detached HEAD")
|
|
2714
2774
|
}), !changes || zero ? /* @__PURE__ */ jsx("span", {
|
|
2715
2775
|
className: "shrink-0 text-sm text-po-dim",
|
|
2716
|
-
children: zero ? "No changes yet" : "Not reported yet"
|
|
2776
|
+
children: zero ? t("git.ui.noChangesYet", "No changes yet") : t("git.ui.notReportedYet", "Not reported yet")
|
|
2717
2777
|
}) : /* @__PURE__ */ jsxs("span", {
|
|
2718
2778
|
className: "flex shrink-0 gap-2 text-sm",
|
|
2719
2779
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
@@ -2754,6 +2814,7 @@ function WorktreesActivitySection(props) {
|
|
|
2754
2814
|
});
|
|
2755
2815
|
}
|
|
2756
2816
|
function WorktreesActivityView({ worktrees, pending, onOpen, onCreate, startingIds = [] }) {
|
|
2817
|
+
const t = useT();
|
|
2757
2818
|
return /* @__PURE__ */ jsxs("div", {
|
|
2758
2819
|
className: "flex min-w-0 flex-col gap-1",
|
|
2759
2820
|
children: [pending && /* @__PURE__ */ jsxs("p", {
|
|
@@ -2771,14 +2832,14 @@ function WorktreesActivityView({ worktrees, pending, onOpen, onCreate, startingI
|
|
|
2771
2832
|
"data-testid": "activity-git-create",
|
|
2772
2833
|
className: "h-auto self-start gap-1 px-1 text-po-green",
|
|
2773
2834
|
onClick: onCreate,
|
|
2774
|
-
children: ["Create a worktree", /* @__PURE__ */ jsx(ArrowRightIcon, {
|
|
2835
|
+
children: [t("git.ui.createAWorktreeLabel", "Create a worktree"), /* @__PURE__ */ jsx(ArrowRightIcon, {
|
|
2775
2836
|
"aria-hidden": true,
|
|
2776
2837
|
className: "size-3.5"
|
|
2777
2838
|
})]
|
|
2778
2839
|
}) : /* @__PURE__ */ jsx("span", {
|
|
2779
2840
|
"data-testid": "activity-summary-git",
|
|
2780
2841
|
className: "px-1 text-sm text-po-dim",
|
|
2781
|
-
children: "Idle"
|
|
2842
|
+
children: t("git.ui.idle", "Idle")
|
|
2782
2843
|
}) : /* @__PURE__ */ jsx("div", {
|
|
2783
2844
|
"data-testid": "activity-git-worktrees",
|
|
2784
2845
|
children: worktrees.map((w) => /* @__PURE__ */ jsx(Button, {
|
|
@@ -2807,8 +2868,8 @@ var review_web_default = defineLeaderBinding({
|
|
|
2807
2868
|
label: "goal"
|
|
2808
2869
|
}, {
|
|
2809
2870
|
key: "d",
|
|
2810
|
-
label: "diff",
|
|
2811
|
-
detail: "review this checkout’s changes"
|
|
2871
|
+
label: t("git.leader.diff", "diff"),
|
|
2872
|
+
detail: t("git.ui.reviewThisCheckoutSChanges", "review this checkout’s changes")
|
|
2812
2873
|
}],
|
|
2813
2874
|
run: (context) => context.openTransientTab(reviewTab())
|
|
2814
2875
|
});
|
|
@@ -2828,48 +2889,6 @@ function startGitRuntime(runtime) {
|
|
|
2828
2889
|
var start_web_default = defineWebLifecycle(startGitRuntime);
|
|
2829
2890
|
//#endregion
|
|
2830
2891
|
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/RunWorktreeToolMessage.tsx
|
|
2831
|
-
const VERBS = {
|
|
2832
|
-
spawn_worktree: [
|
|
2833
|
-
"is creating",
|
|
2834
|
-
"created",
|
|
2835
|
-
"create"
|
|
2836
|
-
],
|
|
2837
|
-
close_worktree: [
|
|
2838
|
-
"is closing",
|
|
2839
|
-
"closed",
|
|
2840
|
-
"close"
|
|
2841
|
-
],
|
|
2842
|
-
list: [
|
|
2843
|
-
"is listing",
|
|
2844
|
-
"listed",
|
|
2845
|
-
"list"
|
|
2846
|
-
],
|
|
2847
|
-
status: [
|
|
2848
|
-
"is checking",
|
|
2849
|
-
"checked",
|
|
2850
|
-
"check"
|
|
2851
|
-
],
|
|
2852
|
-
merge: [
|
|
2853
|
-
"is merging",
|
|
2854
|
-
"merged",
|
|
2855
|
-
"merge"
|
|
2856
|
-
],
|
|
2857
|
-
prune: [
|
|
2858
|
-
"is pruning",
|
|
2859
|
-
"pruned",
|
|
2860
|
-
"prune"
|
|
2861
|
-
],
|
|
2862
|
-
send: [
|
|
2863
|
-
"is messaging",
|
|
2864
|
-
"messaged",
|
|
2865
|
-
"message"
|
|
2866
|
-
],
|
|
2867
|
-
messages: [
|
|
2868
|
-
"is reading messages from",
|
|
2869
|
-
"read messages from",
|
|
2870
|
-
"read messages from"
|
|
2871
|
-
]
|
|
2872
|
-
};
|
|
2873
2892
|
function RunWorktreeToolMessage({ args, output, running, isError }) {
|
|
2874
2893
|
return /* @__PURE__ */ jsx(RunWorktreeToolMessageView, {
|
|
2875
2894
|
action: typeof args.action === "string" ? args.action : "",
|
|
@@ -2880,11 +2899,54 @@ function RunWorktreeToolMessage({ args, output, running, isError }) {
|
|
|
2880
2899
|
});
|
|
2881
2900
|
}
|
|
2882
2901
|
function RunWorktreeToolMessageView({ action, subject = "", output = "", running = false, isError = false, defaultExpanded = false }) {
|
|
2902
|
+
const t = useT();
|
|
2903
|
+
const VERBS = {
|
|
2904
|
+
spawn_worktree: [
|
|
2905
|
+
t("git.tool.isCreating", "is creating"),
|
|
2906
|
+
t("git.tool.created", "created"),
|
|
2907
|
+
t("git.tool.create", "create")
|
|
2908
|
+
],
|
|
2909
|
+
close_worktree: [
|
|
2910
|
+
t("git.tool.isClosing", "is closing"),
|
|
2911
|
+
t("git.tool.closed", "closed"),
|
|
2912
|
+
t("git.tool.close", "close")
|
|
2913
|
+
],
|
|
2914
|
+
list: [
|
|
2915
|
+
t("git.tool.isListing", "is listing"),
|
|
2916
|
+
t("git.tool.listed", "listed"),
|
|
2917
|
+
t("git.tool.list", "list")
|
|
2918
|
+
],
|
|
2919
|
+
status: [
|
|
2920
|
+
t("git.tool.isChecking", "is checking"),
|
|
2921
|
+
t("git.tool.checked", "checked"),
|
|
2922
|
+
t("git.tool.check", "check")
|
|
2923
|
+
],
|
|
2924
|
+
merge: [
|
|
2925
|
+
t("git.tool.isMerging", "is merging"),
|
|
2926
|
+
t("git.tool.merged", "merged"),
|
|
2927
|
+
t("git.tool.merge", "merge")
|
|
2928
|
+
],
|
|
2929
|
+
prune: [
|
|
2930
|
+
t("git.tool.isPruning", "is pruning"),
|
|
2931
|
+
t("git.tool.pruned", "pruned"),
|
|
2932
|
+
t("git.tool.prune", "prune")
|
|
2933
|
+
],
|
|
2934
|
+
send: [
|
|
2935
|
+
t("git.tool.isMessaging", "is messaging"),
|
|
2936
|
+
t("git.tool.messaged", "messaged"),
|
|
2937
|
+
t("git.tool.message", "message")
|
|
2938
|
+
],
|
|
2939
|
+
messages: [
|
|
2940
|
+
t("git.tool.isReadingMessagesFrom", "is reading messages from"),
|
|
2941
|
+
t("git.tool.readMessagesFrom", "read messages from"),
|
|
2942
|
+
t("git.tool.readMessagesFrom", "read messages from")
|
|
2943
|
+
]
|
|
2944
|
+
};
|
|
2883
2945
|
const tone = running ? "neutral" : isError ? "error" : "ok";
|
|
2884
2946
|
const verbs = VERBS[action] ?? [
|
|
2885
|
-
"is running",
|
|
2886
|
-
"finished",
|
|
2887
|
-
"run"
|
|
2947
|
+
t("git.tool.isRunning", "is running"),
|
|
2948
|
+
t("git.tool.finished", "finished"),
|
|
2949
|
+
t("git.tool.run", "run")
|
|
2888
2950
|
];
|
|
2889
2951
|
const rows = action === "list" ? output.split("\n").map((line) => line.split(/\s{2,}/)).filter((parts) => parts.length >= 3) : [];
|
|
2890
2952
|
const listingCount = output.match(/^(\d+) worktree/);
|
|
@@ -2901,13 +2963,14 @@ function RunWorktreeToolMessageView({ action, subject = "", output = "", running
|
|
|
2901
2963
|
children: /* @__PURE__ */ jsxs("p", {
|
|
2902
2964
|
className: "text-base font-semibold leading-relaxed text-po-hi",
|
|
2903
2965
|
children: [
|
|
2904
|
-
"Po
|
|
2905
|
-
|
|
2966
|
+
"Po",
|
|
2967
|
+
" ",
|
|
2968
|
+
isError && !running ? t("git.tool.couldNot", "could not {action}", { action: verbs[2] }) : verbs[running ? 0 : 1],
|
|
2906
2969
|
" ",
|
|
2907
|
-
action === "list" && !running && !isError ?
|
|
2970
|
+
action === "list" && !running && !isError ? Number(listingCount?.[1] ?? rows.length) === 1 ? t("git.tool.worktreeCountOne", "{count} worktree", { count: listingCount?.[1] ?? rows.length }) : t("git.tool.worktreeCount", "{count} worktrees", { count: listingCount?.[1] ?? rows.length }) : subject ? /* @__PURE__ */ jsx("span", {
|
|
2908
2971
|
className: "font-mono",
|
|
2909
2972
|
children: subject
|
|
2910
|
-
}) : "worktrees",
|
|
2973
|
+
}) : t("git.tool.worktrees", "worktrees"),
|
|
2911
2974
|
running ? "..." : isError && output ? `: ${output.split("\n")[0]}` : ""
|
|
2912
2975
|
]
|
|
2913
2976
|
})
|
|
@@ -2917,8 +2980,8 @@ function RunWorktreeToolMessageView({ action, subject = "", output = "", running
|
|
|
2917
2980
|
className: running ? "gap-1 bg-po-rail text-po-dim" : "",
|
|
2918
2981
|
children: [running && /* @__PURE__ */ jsx(Spinner, {
|
|
2919
2982
|
className: "size-3",
|
|
2920
|
-
label: "Running"
|
|
2921
|
-
}), running ? "Running" : isError ? "Failed" : "Completed"]
|
|
2983
|
+
label: t("git.ui.running", "Running")
|
|
2984
|
+
}), running ? t("git.ui.running", "Running") : isError ? t("git.ui.failed", "Failed") : t("git.ui.completed", "Completed")]
|
|
2922
2985
|
})]
|
|
2923
2986
|
}),
|
|
2924
2987
|
/* @__PURE__ */ jsxs(Button, {
|
|
@@ -2927,7 +2990,11 @@ function RunWorktreeToolMessageView({ action, subject = "", output = "", running
|
|
|
2927
2990
|
onClick: toggle,
|
|
2928
2991
|
"aria-expanded": expanded,
|
|
2929
2992
|
className: "mb-2 ml-3 text-po-dim",
|
|
2930
|
-
children: [
|
|
2993
|
+
children: [
|
|
2994
|
+
t("git.ui.details", "Details"),
|
|
2995
|
+
" ",
|
|
2996
|
+
expanded ? /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-3" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3" })
|
|
2997
|
+
]
|
|
2931
2998
|
}),
|
|
2932
2999
|
expanded && /* @__PURE__ */ jsx(MessageItemBody, { children: rows.length > 0 && !isError ? /* @__PURE__ */ jsxs("table", {
|
|
2933
3000
|
className: "w-full text-left text-sm",
|
|
@@ -2936,15 +3003,15 @@ function RunWorktreeToolMessageView({ action, subject = "", output = "", running
|
|
|
2936
3003
|
children: [
|
|
2937
3004
|
/* @__PURE__ */ jsx("th", {
|
|
2938
3005
|
className: "pb-2 font-medium",
|
|
2939
|
-
children: "Branch"
|
|
3006
|
+
children: t("git.ui.branch", "Branch")
|
|
2940
3007
|
}),
|
|
2941
3008
|
/* @__PURE__ */ jsx("th", {
|
|
2942
3009
|
className: "pb-2 font-medium",
|
|
2943
|
-
children: "Path"
|
|
3010
|
+
children: t("git.ui.path", "Path")
|
|
2944
3011
|
}),
|
|
2945
3012
|
/* @__PURE__ */ jsx("th", {
|
|
2946
3013
|
className: "pb-2 font-medium",
|
|
2947
|
-
children: "Status"
|
|
3014
|
+
children: t("git.ui.status", "Status")
|
|
2948
3015
|
})
|
|
2949
3016
|
]
|
|
2950
3017
|
}) }), /* @__PURE__ */ jsx("tbody", { children: rows.map((parts, i) => {
|