@agimon-ai/po-git 0.0.0-alpha.214 → 0.0.0-alpha.216
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/README.md +1 -1
- package/dist/apiContracts.cjs +15 -7
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +15 -7
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/extensions/native.mjs +281 -144
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +26 -6
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +26 -6
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +738 -299
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{gitDependencies-D8bKxZSc.cjs → gitDependencies-1HXuMSGk.cjs} +16 -8
- package/dist/gitDependencies-1HXuMSGk.cjs.map +1 -0
- package/dist/{gitDependencies-Delu4xip.mjs → gitDependencies-NPktI6YK.mjs} +16 -8
- package/dist/gitDependencies-NPktI6YK.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/locales/vi.json +30 -13
- package/locales/zh-CN.json +30 -13
- package/package.json +12 -12
- package/dist/gitDependencies-D8bKxZSc.cjs.map +0 -1
- package/dist/gitDependencies-Delu4xip.mjs.map +0 -1
|
@@ -2,7 +2,7 @@ import { createApiClient, defineActivityGroup, defineChannelFile, defineFill, de
|
|
|
2
2
|
import { View } from "react-native-unistyles/components/native/View";
|
|
3
3
|
import { Text } from "react-native-unistyles/components/native/Text";
|
|
4
4
|
import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
|
|
5
|
-
import { AlertIcon, Badge, BranchIcon, Button, CheckIcon, ChevronRightIcon, Dot, EmptyState, FileIcon, Input, Label, ListRow, MessageIcon, SegmentedControl, Select, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Spinner, SyntaxLine, Textarea, fontOf } from "@agimon-ai/po-native-components";
|
|
5
|
+
import { AlertIcon, Badge, BranchIcon, Button, CheckIcon, ChevronRightIcon, CodeBlock, Dot, EmptyState, FileIcon, Input, Label, ListRow, MessageIcon, SegmentedControl, Select, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Spinner, SyntaxLine, Textarea, fontOf } from "@agimon-ai/po-native-components";
|
|
6
6
|
import { createElement, memo, useCallback, useEffect, useEffectEvent, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
7
7
|
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
|
8
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -68,8 +68,9 @@ const api = createApiClient({
|
|
|
68
68
|
sessionAddress: sessionApiAddress
|
|
69
69
|
});
|
|
70
70
|
//#endregion
|
|
71
|
-
//#region src/
|
|
72
|
-
|
|
71
|
+
//#region src/constants/git.ts
|
|
72
|
+
/** Installs the rift CLI. Shown to the person to copy, and named in the error an agent reads. */
|
|
73
|
+
const RIFT_INSTALL_COMMAND = "npm install -g rift-snapshot";
|
|
73
74
|
/** Full checkout is explicit; a locked default remains visible even if absent from the catalog. */
|
|
74
75
|
function sparseOptions(branches) {
|
|
75
76
|
return [.../* @__PURE__ */ new Set([
|
|
@@ -105,7 +106,11 @@ function branchOptions(branches, query) {
|
|
|
105
106
|
remote: branch.remote,
|
|
106
107
|
current: false
|
|
107
108
|
}));
|
|
108
|
-
return [...local, ...remote].slice(0,
|
|
109
|
+
return [...local, ...remote].slice(0, 200);
|
|
110
|
+
}
|
|
111
|
+
/** The kind a fresh form starts on: a new branch when no branch is free to check out. */
|
|
112
|
+
function defaultSessionMode(branches) {
|
|
113
|
+
return branches !== null && branches.remote.length === 0 && branches.local.every((branch) => branch.checkedOutAt !== void 0) ? "new" : "existing";
|
|
109
114
|
}
|
|
110
115
|
/** Every base a new branch can start from: the default first, then remote-tracking names, then local branches. */
|
|
111
116
|
function baseOptions(branches) {
|
|
@@ -156,7 +161,7 @@ function createRequest(state, branches) {
|
|
|
156
161
|
//#endregion
|
|
157
162
|
//#region src/extensions/workspaces/(frontend)/fill/_components/GitNewSessionSheet.native.tsx
|
|
158
163
|
/** The native twin of GitNewSessionDialogView: the same form state and checks, in sheet parts. */
|
|
159
|
-
function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initialForm, busy = false, error = "", sparseCheckout, onCreate }) {
|
|
164
|
+
function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initialForm, busy = false, error = "", riftMissing = false, sparseCheckout, onCreate }) {
|
|
160
165
|
const t = useT();
|
|
161
166
|
const MODES = [
|
|
162
167
|
{
|
|
@@ -180,10 +185,10 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
|
|
|
180
185
|
...initialForm
|
|
181
186
|
});
|
|
182
187
|
const [query, setQuery] = useState("");
|
|
183
|
-
const [
|
|
188
|
+
const [modeChosen, setModeChosen] = useState(initialForm?.mode !== void 0);
|
|
184
189
|
const ready = branches?.repository === true && loadError === "";
|
|
185
190
|
const loading = branches === null && loadError === "";
|
|
186
|
-
const mode = ready || loading ? form.mode : "plain";
|
|
191
|
+
const mode = ready || loading ? modeChosen ? form.mode : defaultSessionMode(branches) : "plain";
|
|
187
192
|
const state = {
|
|
188
193
|
...form,
|
|
189
194
|
mode,
|
|
@@ -205,16 +210,22 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
|
|
|
205
210
|
accessibilityLabel: t("git.session.workspace", "Workspace {path}", { path: workspaceRoot }),
|
|
206
211
|
children: folderName(workspaceRoot)
|
|
207
212
|
}),
|
|
208
|
-
!ready ? /* @__PURE__ */
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
213
|
+
!ready ? /* @__PURE__ */ jsxs(View, {
|
|
214
|
+
style: styles$3.loading,
|
|
215
|
+
children: [loading ? /* @__PURE__ */ jsx(Spinner, {}) : null, /* @__PURE__ */ jsx(Text, {
|
|
216
|
+
testID: "git-new-session-plain-note",
|
|
217
|
+
style: styles$3.dim,
|
|
218
|
+
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.")
|
|
219
|
+
})]
|
|
212
220
|
}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SegmentedControl, {
|
|
213
221
|
accessibilityLabel: t("git.ui.sessionKind", "Session kind"),
|
|
214
222
|
options: MODES,
|
|
215
223
|
value: mode,
|
|
216
224
|
disabled: busy,
|
|
217
|
-
onValueChange: (value) =>
|
|
225
|
+
onValueChange: (value) => {
|
|
226
|
+
setModeChosen(true);
|
|
227
|
+
update({ mode: value });
|
|
228
|
+
}
|
|
218
229
|
}), mode === "existing" ? /* @__PURE__ */ jsxs(View, {
|
|
219
230
|
style: styles$3.field,
|
|
220
231
|
children: [
|
|
@@ -265,7 +276,12 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
|
|
|
265
276
|
style: index > 0 && styles$3.divider,
|
|
266
277
|
onPress: () => update({ selected: branch })
|
|
267
278
|
})] }, branch.key))]
|
|
268
|
-
})
|
|
279
|
+
}),
|
|
280
|
+
options.length >= 200 ? /* @__PURE__ */ jsx(Text, {
|
|
281
|
+
testID: "git-new-session-branch-cap",
|
|
282
|
+
style: styles$3.dim,
|
|
283
|
+
children: t("git.ui.showingFirstBranches", "Showing the first {count} branches. Type to narrow the list.", { count: 200 })
|
|
284
|
+
}) : null
|
|
269
285
|
]
|
|
270
286
|
}) : mode === "new" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(View, {
|
|
271
287
|
style: styles$3.field,
|
|
@@ -282,30 +298,17 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
|
|
|
282
298
|
})]
|
|
283
299
|
}), /* @__PURE__ */ jsxs(View, {
|
|
284
300
|
style: styles$3.field,
|
|
285
|
-
children: [/* @__PURE__ */ jsx(Label, { children: t("git.ui.from", "From") }), /* @__PURE__ */
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}), basesOpen ? bases.map((base) => /* @__PURE__ */ jsx(ListRow, {
|
|
297
|
-
title: /* @__PURE__ */ jsx(Text, {
|
|
298
|
-
style: styles$3.mono,
|
|
299
|
-
children: base
|
|
300
|
-
}),
|
|
301
|
-
selected: state.baseRef === base,
|
|
302
|
-
disabled: busy,
|
|
303
|
-
disclosure: false,
|
|
304
|
-
onPress: () => {
|
|
305
|
-
update({ baseRef: base });
|
|
306
|
-
setBasesOpen(false);
|
|
307
|
-
}
|
|
308
|
-
}, base)) : null]
|
|
301
|
+
children: [/* @__PURE__ */ jsx(Label, { children: t("git.ui.from", "From") }), /* @__PURE__ */ jsx(Select, {
|
|
302
|
+
title: t("git.ui.from", "From"),
|
|
303
|
+
value: state.baseRef,
|
|
304
|
+
onValueChange: (baseRef) => update({ baseRef }),
|
|
305
|
+
disabled: busy,
|
|
306
|
+
options: bases.map((base) => ({
|
|
307
|
+
value: base,
|
|
308
|
+
label: base
|
|
309
|
+
})),
|
|
310
|
+
placeholder: t("git.ui.currentBranch", "Current branch"),
|
|
311
|
+
searchPlaceholder: t("git.ui.findABranch", "Find a branch")
|
|
309
312
|
})]
|
|
310
313
|
})] }) : /* @__PURE__ */ jsx(Text, {
|
|
311
314
|
style: styles$3.dim,
|
|
@@ -347,7 +350,18 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
|
|
|
347
350
|
style: styles$3.dim,
|
|
348
351
|
children: (loading ? void 0 : problem) ?? t("git.ui.runsInItsOwnWorktreeSoThisCheckoutStaysAsItIs", "Runs in its own worktree, so this checkout stays as it is.")
|
|
349
352
|
}) : null,
|
|
350
|
-
|
|
353
|
+
riftMissing ? /* @__PURE__ */ jsxs(View, {
|
|
354
|
+
testID: "rift-install-notice",
|
|
355
|
+
style: styles$3.notice,
|
|
356
|
+
accessibilityRole: "alert",
|
|
357
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
358
|
+
style: styles$3.noticeText,
|
|
359
|
+
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.")
|
|
360
|
+
}), /* @__PURE__ */ jsx(CodeBlock, {
|
|
361
|
+
text: `${RIFT_INSTALL_COMMAND}\nrift init`,
|
|
362
|
+
language: "bash"
|
|
363
|
+
})]
|
|
364
|
+
}) : error ? /* @__PURE__ */ jsx(Text, {
|
|
351
365
|
testID: "new-session-error",
|
|
352
366
|
style: styles$3.error,
|
|
353
367
|
accessibilityRole: "alert",
|
|
@@ -362,7 +376,7 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
|
|
|
362
376
|
disabled: loading || problem !== void 0,
|
|
363
377
|
accessibilityHint: problem,
|
|
364
378
|
onPress: () => onCreate(state),
|
|
365
|
-
children: t("git.ui.createSession", "Create session")
|
|
379
|
+
children: riftMissing ? t("git.ui.tryAgain", "Try again") : t("git.ui.createSession", "Create session")
|
|
366
380
|
})
|
|
367
381
|
]
|
|
368
382
|
})] });
|
|
@@ -376,6 +390,7 @@ function GitNewSessionSheet({ newSession }) {
|
|
|
376
390
|
const [branches, setBranches] = useState(null);
|
|
377
391
|
const [loadError, setLoadError] = useState("");
|
|
378
392
|
const [error, setError] = useState("");
|
|
393
|
+
const [riftMissing, setRiftMissing] = useState(false);
|
|
379
394
|
const [busy, setBusy] = useState(false);
|
|
380
395
|
const workspaceId = newSession?.workspaceId;
|
|
381
396
|
const request = useEffectEvent((input) => newSession?.requestWithStepUp(input));
|
|
@@ -399,6 +414,7 @@ function GitNewSessionSheet({ newSession }) {
|
|
|
399
414
|
if (busy || formProblem(t, state) !== void 0) return;
|
|
400
415
|
setBusy(true);
|
|
401
416
|
setError("");
|
|
417
|
+
setRiftMissing(false);
|
|
402
418
|
const body = createRequest(state);
|
|
403
419
|
let failure;
|
|
404
420
|
try {
|
|
@@ -410,6 +426,7 @@ function GitNewSessionSheet({ newSession }) {
|
|
|
410
426
|
body: JSON.stringify(body)
|
|
411
427
|
});
|
|
412
428
|
const answer = await response.json().catch(() => void 0);
|
|
429
|
+
setRiftMissing(!response.ok && answer?.code === "rift_missing");
|
|
413
430
|
failure = response.ok ? await newSession.openCreated(answer.sessionId) : errorOf(answer, response.status);
|
|
414
431
|
}
|
|
415
432
|
} catch {
|
|
@@ -425,6 +442,7 @@ function GitNewSessionSheet({ newSession }) {
|
|
|
425
442
|
loadError,
|
|
426
443
|
busy,
|
|
427
444
|
error,
|
|
445
|
+
riftMissing,
|
|
428
446
|
onCreate: (state) => void submit(state)
|
|
429
447
|
});
|
|
430
448
|
}
|
|
@@ -436,6 +454,28 @@ const styles$3 = StyleSheet.create((theme) => {
|
|
|
436
454
|
gap: theme.spacing(4),
|
|
437
455
|
uni__dependencies: [0]
|
|
438
456
|
},
|
|
457
|
+
loading: {
|
|
458
|
+
flexDirection: "row",
|
|
459
|
+
alignItems: "center",
|
|
460
|
+
gap: theme.spacing(2),
|
|
461
|
+
uni__dependencies: [0]
|
|
462
|
+
},
|
|
463
|
+
notice: {
|
|
464
|
+
gap: theme.spacing(2),
|
|
465
|
+
padding: theme.spacing(3),
|
|
466
|
+
borderRadius: theme.borderRadius.md,
|
|
467
|
+
borderWidth: 1,
|
|
468
|
+
borderColor: theme.colors["edge-magenta"],
|
|
469
|
+
backgroundColor: theme.colors["tint-magenta"],
|
|
470
|
+
uni__dependencies: [0]
|
|
471
|
+
},
|
|
472
|
+
noticeText: {
|
|
473
|
+
fontFamily: sans,
|
|
474
|
+
fontSize: theme.fontSize.sm,
|
|
475
|
+
lineHeight: theme.lineHeightRelaxed.sm,
|
|
476
|
+
color: theme.colors.hi,
|
|
477
|
+
uni__dependencies: [0]
|
|
478
|
+
},
|
|
439
479
|
root: {
|
|
440
480
|
fontFamily: mono,
|
|
441
481
|
fontSize: theme.fontSize.sm,
|
|
@@ -731,12 +771,12 @@ function WorktreeRow({ item, error, compact = false, onClose, onOpen, disabled =
|
|
|
731
771
|
}) : null,
|
|
732
772
|
!compact ? /* @__PURE__ */ jsx(Button, {
|
|
733
773
|
variant: "ghost",
|
|
734
|
-
style: styles$2.
|
|
774
|
+
style: styles$2.close,
|
|
735
775
|
accessibilityLabel: t("git.worktree.closeBranch", "Close {branch}", { branch: item.branch }),
|
|
736
776
|
testID: `git-worktree-close-${item.id}`,
|
|
737
777
|
onPress: onClose,
|
|
738
778
|
disabled,
|
|
739
|
-
children: "
|
|
779
|
+
children: t("git.ui.close", "Close")
|
|
740
780
|
}) : /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
741
781
|
size: 16,
|
|
742
782
|
color: "dim"
|
|
@@ -749,10 +789,18 @@ function WorktreeRow({ item, error, compact = false, onClose, onOpen, disabled =
|
|
|
749
789
|
style: styles$2.path,
|
|
750
790
|
children: item.path
|
|
751
791
|
}) : null,
|
|
752
|
-
error ? /* @__PURE__ */
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
792
|
+
error ? /* @__PURE__ */ jsxs(View, {
|
|
793
|
+
style: styles$2.errorRow,
|
|
794
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
795
|
+
accessibilityRole: "alert",
|
|
796
|
+
style: styles$2.error,
|
|
797
|
+
children: error
|
|
798
|
+
}), onOpen ? /* @__PURE__ */ jsx(Button, {
|
|
799
|
+
variant: "outline",
|
|
800
|
+
onPress: onOpen,
|
|
801
|
+
testID: `git-worktree-error-open-${item.id}`,
|
|
802
|
+
children: t("git.ui.openSession", "Open session")
|
|
803
|
+
}) : null]
|
|
756
804
|
}) : null
|
|
757
805
|
]
|
|
758
806
|
});
|
|
@@ -885,13 +933,9 @@ function WorktreesView({ state, disabled = false, onNew, onClose, onOpen }) {
|
|
|
885
933
|
title: t("git.ui.needsALook", "Needs a look"),
|
|
886
934
|
count: t("git.worktree.openCount", "{count} open", { count: attention.length })
|
|
887
935
|
}),
|
|
888
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ jsx(Text, {
|
|
889
937
|
style: styles$2.dim,
|
|
890
|
-
children:
|
|
891
|
-
attention.length === 2 ? t("git.ui.twoWorktrees", "Two worktrees") : attention.length === 1 ? t("git.ui.oneWorktree", "One worktree") : t("git.worktree.count", "{count} worktrees", { count: attention.length }),
|
|
892
|
-
" ",
|
|
893
|
-
t("git.ui.wouldLikeYourEyeWheneverYouAreReady", "would like your eye, whenever you are ready.")
|
|
894
|
-
]
|
|
938
|
+
children: attention.length === 1 ? t("git.worktree.needsCleanupOne", "One worktree needs cleanup: its folder is missing or its session has ended.") : t("git.worktree.needsCleanup", "{count} worktrees need cleanup: their folder is missing or their session has ended.", { count: attention.length })
|
|
895
939
|
}),
|
|
896
940
|
attention.map(row)
|
|
897
941
|
] }) : null
|
|
@@ -1090,10 +1134,13 @@ const styles$2 = StyleSheet.create((theme) => ({
|
|
|
1090
1134
|
gap: theme.spacing(1),
|
|
1091
1135
|
uni__dependencies: [0]
|
|
1092
1136
|
},
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1137
|
+
close: { minHeight: 44 },
|
|
1138
|
+
errorRow: {
|
|
1139
|
+
flexDirection: "row",
|
|
1140
|
+
flexWrap: "wrap",
|
|
1141
|
+
alignItems: "center",
|
|
1142
|
+
gap: theme.spacing(2),
|
|
1143
|
+
uni__dependencies: [0]
|
|
1097
1144
|
},
|
|
1098
1145
|
caution: {
|
|
1099
1146
|
backgroundColor: theme.colors["tint-yellow"],
|
|
@@ -1261,6 +1308,7 @@ function optionalChanges(value) {
|
|
|
1261
1308
|
const behind = count(upstream?.behind);
|
|
1262
1309
|
const upstreamRef = optionalText(upstream?.ref);
|
|
1263
1310
|
const conflicts = isRecord$1(value.rebase) && Array.isArray(value.rebase.conflicts) ? value.rebase.conflicts.filter((file) => typeof file === "string").slice(0, MAX_CONFLICTS) : void 0;
|
|
1311
|
+
const rebaseBranch = isRecord$1(value.rebase) ? optionalText(value.rebase.branch) : void 0;
|
|
1264
1312
|
return {
|
|
1265
1313
|
added,
|
|
1266
1314
|
removed,
|
|
@@ -1273,16 +1321,27 @@ function optionalChanges(value) {
|
|
|
1273
1321
|
ahead,
|
|
1274
1322
|
behind
|
|
1275
1323
|
} },
|
|
1276
|
-
...conflicts === void 0 ? {} : { rebase: {
|
|
1324
|
+
...conflicts === void 0 ? {} : { rebase: {
|
|
1325
|
+
conflicts,
|
|
1326
|
+
...rebaseBranch === void 0 ? {} : { branch: rebaseBranch }
|
|
1327
|
+
} }
|
|
1277
1328
|
};
|
|
1278
1329
|
}
|
|
1279
1330
|
function optionalErrorTarget(value) {
|
|
1280
1331
|
if (!isRecord$1(value)) return void 0;
|
|
1281
|
-
|
|
1282
|
-
|
|
1332
|
+
const code = value.code === "auth_failed" || value.code === "worktree_dirty" ? { code: value.code } : {};
|
|
1333
|
+
const action = value.action;
|
|
1334
|
+
if (action === "pull" || action === "rebase" || action === "abort-rebase") return {
|
|
1335
|
+
action,
|
|
1336
|
+
...code
|
|
1337
|
+
};
|
|
1338
|
+
if (action === "push") return value.forceRequired === true ? {
|
|
1283
1339
|
action: "push",
|
|
1284
1340
|
forceRequired: true
|
|
1285
|
-
} : {
|
|
1341
|
+
} : {
|
|
1342
|
+
action: "push",
|
|
1343
|
+
...code
|
|
1344
|
+
};
|
|
1286
1345
|
}
|
|
1287
1346
|
/** The session data channel: 'git_changes' payloads into the store. */
|
|
1288
1347
|
const gitChangesChannel = gitChanges.channel({
|
|
@@ -1558,7 +1617,7 @@ function SyncCard({ changes, busy = false, onSync }) {
|
|
|
1558
1617
|
}),
|
|
1559
1618
|
/* @__PURE__ */ jsx(Text, {
|
|
1560
1619
|
style: styles$1.branch,
|
|
1561
|
-
children: changes?.branch ?? t("git.ui.detachedHEAD", "Detached HEAD")
|
|
1620
|
+
children: changes?.branch ?? (changes?.rebase?.branch === void 0 ? t("git.ui.detachedHEAD", "Detached HEAD") : t("git.ui.rebasingBranch", "Rebasing {branch}", { branch: changes.rebase.branch }))
|
|
1562
1621
|
}),
|
|
1563
1622
|
/* @__PURE__ */ jsx(View, { style: styles$1.grow }),
|
|
1564
1623
|
/* @__PURE__ */ jsxs(Text, {
|
|
@@ -1588,7 +1647,7 @@ function SyncCard({ changes, busy = false, onSync }) {
|
|
|
1588
1647
|
].map((action) => /* @__PURE__ */ jsx(Button, {
|
|
1589
1648
|
variant: suggested === action ? "outline" : "ghost",
|
|
1590
1649
|
style: suggested === action ? [styles$1.action, styles$1.suggested] : styles$1.action,
|
|
1591
|
-
disabled: busy || changes?.rebase !== void 0 || (action === "pull" ? changes
|
|
1650
|
+
disabled: busy || changes?.rebase !== void 0 || changes?.branch === void 0 || (action === "pull" ? changes.upstream === void 0 : action === "rebase" && changes.base === void 0),
|
|
1592
1651
|
onPress: () => onSync?.(action),
|
|
1593
1652
|
children: action === "pull" ? t("git.ui.pull", "Pull") : action === "push" ? t("git.ui.push", "Push") : t("git.ui.rebase", "Rebase")
|
|
1594
1653
|
}, action))
|
|
@@ -1598,66 +1657,95 @@ function SyncCard({ changes, busy = false, onSync }) {
|
|
|
1598
1657
|
}
|
|
1599
1658
|
function FileList({ files, comments = [], onFile }) {
|
|
1600
1659
|
const t = useT();
|
|
1660
|
+
const [query, setQuery] = useState("");
|
|
1661
|
+
const needle = query.trim().toLowerCase();
|
|
1662
|
+
const shown = needle === "" ? files : files.filter((file) => file.path.toLowerCase().includes(needle));
|
|
1601
1663
|
return /* @__PURE__ */ jsxs(View, {
|
|
1602
1664
|
style: styles$1.list,
|
|
1603
|
-
children: [
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
" ",
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
style: file.status === "added" ? styles$1.green : file.status === "untracked" ? styles$1.blue : styles$1.yellow,
|
|
1618
|
-
children: file.status[0]?.toUpperCase()
|
|
1619
|
-
}),
|
|
1620
|
-
/* @__PURE__ */ jsxs(View, {
|
|
1621
|
-
style: styles$1.grow,
|
|
1622
|
-
children: [/* @__PURE__ */ jsx(Text, {
|
|
1623
|
-
style: styles$1.body,
|
|
1624
|
-
children: file.path.split("/").at(-1)
|
|
1625
|
-
}), /* @__PURE__ */ jsx(Text, {
|
|
1626
|
-
numberOfLines: 1,
|
|
1627
|
-
style: [styles$1.dim, styles$1.mono],
|
|
1628
|
-
children: file.path.split("/").slice(0, -1).join("/") || "."
|
|
1629
|
-
})]
|
|
1630
|
-
}),
|
|
1631
|
-
/* @__PURE__ */ jsxs(Text, { children: [
|
|
1632
|
-
/* @__PURE__ */ jsxs(Text, {
|
|
1633
|
-
style: styles$1.green,
|
|
1634
|
-
children: ["+", file.added]
|
|
1635
|
-
}),
|
|
1665
|
+
children: [
|
|
1666
|
+
/* @__PURE__ */ jsx(Input, {
|
|
1667
|
+
testID: "git-review-search",
|
|
1668
|
+
accessibilityLabel: t("git.ui.searchPaths", "Search paths"),
|
|
1669
|
+
placeholder: t("git.ui.searchPaths", "Search paths"),
|
|
1670
|
+
autoCapitalize: "none",
|
|
1671
|
+
autoCorrect: false,
|
|
1672
|
+
value: query,
|
|
1673
|
+
onChangeText: setQuery
|
|
1674
|
+
}),
|
|
1675
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
1676
|
+
style: styles$1.section,
|
|
1677
|
+
children: [
|
|
1678
|
+
shown.length,
|
|
1636
1679
|
" ",
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1680
|
+
t("git.ui.files", "files")
|
|
1681
|
+
]
|
|
1682
|
+
}),
|
|
1683
|
+
shown.length === 0 && needle !== "" ? /* @__PURE__ */ jsx(EmptyState, {
|
|
1684
|
+
testID: "git-review-browser-no-match",
|
|
1685
|
+
size: "compact",
|
|
1686
|
+
surface: "plain",
|
|
1687
|
+
title: t("git.ui.noPathsMatch", "No paths match"),
|
|
1688
|
+
description: t("git.review.noMatchingPath", "No changed file path contains \"{query}\".", { query: query.trim() }),
|
|
1689
|
+
action: {
|
|
1690
|
+
label: t("git.ui.clearFilter", "Clear filter"),
|
|
1691
|
+
onAction: () => setQuery("")
|
|
1692
|
+
}
|
|
1693
|
+
}) : null,
|
|
1694
|
+
shown.map((file) => /* @__PURE__ */ jsxs(Pressable, {
|
|
1695
|
+
accessibilityRole: "button",
|
|
1696
|
+
testID: `git-review-file-${file.path}`,
|
|
1697
|
+
onPress: () => onFile?.(file.path),
|
|
1698
|
+
style: styles$1.fileRow,
|
|
1699
|
+
children: [
|
|
1700
|
+
/* @__PURE__ */ jsx(Text, {
|
|
1701
|
+
style: file.status === "added" ? styles$1.green : file.status === "untracked" ? styles$1.blue : file.status === "deleted" || file.status === "conflicted" ? styles$1.red : styles$1.yellow,
|
|
1702
|
+
children: file.status[0]?.toUpperCase()
|
|
1703
|
+
}),
|
|
1704
|
+
/* @__PURE__ */ jsxs(View, {
|
|
1705
|
+
style: styles$1.grow,
|
|
1706
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
1707
|
+
style: styles$1.body,
|
|
1708
|
+
children: file.path.split("/").at(-1)
|
|
1709
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
1710
|
+
numberOfLines: 1,
|
|
1711
|
+
style: [styles$1.dim, styles$1.mono],
|
|
1712
|
+
children: file.path.split("/").slice(0, -1).join("/") || "."
|
|
1713
|
+
})]
|
|
1714
|
+
}),
|
|
1715
|
+
file.binary ? /* @__PURE__ */ jsx(Text, {
|
|
1716
|
+
style: styles$1.dim,
|
|
1717
|
+
children: t("git.ui.binary", "Binary")
|
|
1718
|
+
}) : file.added === 0 && file.removed === 0 ? null : /* @__PURE__ */ jsxs(Text, { children: [
|
|
1719
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
1720
|
+
style: styles$1.green,
|
|
1721
|
+
children: ["+", file.added]
|
|
1722
|
+
}),
|
|
1723
|
+
" ",
|
|
1724
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
1725
|
+
style: styles$1.red,
|
|
1726
|
+
children: ["-", file.removed]
|
|
1727
|
+
})
|
|
1728
|
+
] }),
|
|
1729
|
+
comments.some((comment) => comment.path === file.path) ? /* @__PURE__ */ jsxs(View, {
|
|
1730
|
+
style: styles$1.inline,
|
|
1731
|
+
children: [/* @__PURE__ */ jsx(MessageIcon, {
|
|
1732
|
+
size: 12,
|
|
1733
|
+
color: "blue"
|
|
1734
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
1735
|
+
style: styles$1.blue,
|
|
1736
|
+
children: comments.filter((comment) => comment.path === file.path).length
|
|
1737
|
+
})]
|
|
1738
|
+
}) : null,
|
|
1739
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
1740
|
+
size: 16,
|
|
1741
|
+
color: "dim"
|
|
1640
1742
|
})
|
|
1641
|
-
]
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
children: [/* @__PURE__ */ jsx(MessageIcon, {
|
|
1645
|
-
size: 12,
|
|
1646
|
-
color: "blue"
|
|
1647
|
-
}), /* @__PURE__ */ jsx(Text, {
|
|
1648
|
-
style: styles$1.blue,
|
|
1649
|
-
children: comments.filter((comment) => comment.path === file.path).length
|
|
1650
|
-
})]
|
|
1651
|
-
}) : null,
|
|
1652
|
-
/* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
1653
|
-
size: 16,
|
|
1654
|
-
color: "dim"
|
|
1655
|
-
})
|
|
1656
|
-
]
|
|
1657
|
-
}, file.path))]
|
|
1743
|
+
]
|
|
1744
|
+
}, file.path))
|
|
1745
|
+
]
|
|
1658
1746
|
});
|
|
1659
1747
|
}
|
|
1660
|
-
function RebaseCard({ confirmation = false, conflicts, busy = false, onResolve, onAbort }) {
|
|
1748
|
+
function RebaseCard({ confirmation = false, conflicts, busy = false, onResolve, onAbort, onFile }) {
|
|
1661
1749
|
const t = useT();
|
|
1662
1750
|
return /* @__PURE__ */ jsxs(View, {
|
|
1663
1751
|
style: [styles$1.card, styles$1.caution],
|
|
@@ -1676,7 +1764,16 @@ function RebaseCard({ confirmation = false, conflicts, busy = false, onResolve,
|
|
|
1676
1764
|
style: styles$1.body,
|
|
1677
1765
|
children: t("git.ui.resolveConflictsOrAskPoToDoItForYou", "Resolve conflicts or ask Po to do it for you.")
|
|
1678
1766
|
}),
|
|
1679
|
-
/* @__PURE__ */ jsx(
|
|
1767
|
+
onFile ? conflicts.map((path) => /* @__PURE__ */ jsx(Pressable, {
|
|
1768
|
+
accessibilityRole: "button",
|
|
1769
|
+
testID: `git-rebase-conflict-${path}`,
|
|
1770
|
+
onPress: () => onFile(path),
|
|
1771
|
+
style: styles$1.conflict,
|
|
1772
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
1773
|
+
style: [styles$1.blue, styles$1.mono],
|
|
1774
|
+
children: path
|
|
1775
|
+
})
|
|
1776
|
+
}, path)) : /* @__PURE__ */ jsx(Text, {
|
|
1680
1777
|
style: [styles$1.dim, styles$1.mono],
|
|
1681
1778
|
children: conflicts.join("\n")
|
|
1682
1779
|
}),
|
|
@@ -1766,7 +1863,7 @@ const DiffRows = memo(function DiffRows({ rows, comments = [], selection, onLine
|
|
|
1766
1863
|
const anchoredComments = useMemo(() => {
|
|
1767
1864
|
const index = /* @__PURE__ */ new Map();
|
|
1768
1865
|
for (const comment of comments) {
|
|
1769
|
-
const key = `${comment.side}:${comment.endLine ?? comment.startLine}`;
|
|
1866
|
+
const key = `${comment.side ?? "new"}:${comment.endLine ?? comment.startLine}`;
|
|
1770
1867
|
const entries = index.get(key);
|
|
1771
1868
|
if (entries) entries.push(comment);
|
|
1772
1869
|
else index.set(key, [comment]);
|
|
@@ -2025,6 +2122,10 @@ const styles$1 = StyleSheet.create((theme) => ({
|
|
|
2025
2122
|
gap: theme.spacing(2),
|
|
2026
2123
|
uni__dependencies: [0]
|
|
2027
2124
|
},
|
|
2125
|
+
conflict: {
|
|
2126
|
+
minHeight: 44,
|
|
2127
|
+
justifyContent: "center"
|
|
2128
|
+
},
|
|
2028
2129
|
fileRow: {
|
|
2029
2130
|
minHeight: 44,
|
|
2030
2131
|
paddingVertical: theme.spacing(2),
|
|
@@ -2161,6 +2262,7 @@ function GitReviewView(props) {
|
|
|
2161
2262
|
};
|
|
2162
2263
|
if (current !== disclosure) setDisclosure(current);
|
|
2163
2264
|
const visibleRows = useMemo(() => rows.slice(0, current.limit), [rows, current.limit]);
|
|
2265
|
+
const disclosable = !!file && !file.binary && !file.tooLarge && rows.length > initialLimit;
|
|
2164
2266
|
const index = summary?.files.findIndex((entry) => entry.path === path) ?? -1;
|
|
2165
2267
|
const entry = summary?.files[index];
|
|
2166
2268
|
return /* @__PURE__ */ jsxs(View, {
|
|
@@ -2215,9 +2317,19 @@ function GitReviewView(props) {
|
|
|
2215
2317
|
conflicts: activity.changes.rebase.conflicts,
|
|
2216
2318
|
busy: activity.pending !== void 0,
|
|
2217
2319
|
onResolve: props.onResolve,
|
|
2218
|
-
onAbort: props.onAbort
|
|
2320
|
+
onAbort: props.onAbort,
|
|
2321
|
+
onFile: props.onFile
|
|
2219
2322
|
}) : null,
|
|
2220
|
-
!summary ? /* @__PURE__ */ jsx(
|
|
2323
|
+
!summary && props.summaryError !== void 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
2324
|
+
testID: "git-review-error",
|
|
2325
|
+
tone: "error",
|
|
2326
|
+
title: t("git.ui.changesCouldNotBeRead", "Changes could not be read"),
|
|
2327
|
+
description: props.summaryError,
|
|
2328
|
+
...props.onRetrySummary ? { action: {
|
|
2329
|
+
label: t("git.ui.retry", "Retry"),
|
|
2330
|
+
onAction: props.onRetrySummary
|
|
2331
|
+
} } : {}
|
|
2332
|
+
}) : !summary ? /* @__PURE__ */ jsx(Text, {
|
|
2221
2333
|
style: styles$1.dim,
|
|
2222
2334
|
children: t("git.ui.loadingChangesProgress", "Loading changes…")
|
|
2223
2335
|
}) : summary.files.length ? /* @__PURE__ */ jsx(FileList, {
|
|
@@ -2305,27 +2417,19 @@ function GitReviewView(props) {
|
|
|
2305
2417
|
children: props.error
|
|
2306
2418
|
}) : null]
|
|
2307
2419
|
}, `${screen}:${path ?? ""}`),
|
|
2308
|
-
/* @__PURE__ */
|
|
2309
|
-
count: comments.length,
|
|
2310
|
-
confirmation: screen === "changes" && activity.changes?.rebase !== void 0,
|
|
2311
|
-
discard: screen === "review",
|
|
2312
|
-
onReview: () => props.onScreen("review"),
|
|
2313
|
-
onSend: props.onSend,
|
|
2314
|
-
onDiscard: props.onDiscard
|
|
2315
|
-
}),
|
|
2316
|
-
screen === "file" && file && !file.binary && !file.tooLarge ? /* @__PURE__ */ jsxs(View, {
|
|
2420
|
+
screen === "file" && (props.selection || disclosable) ? /* @__PURE__ */ jsxs(View, {
|
|
2317
2421
|
style: styles$1.disclosure,
|
|
2318
2422
|
children: [/* @__PURE__ */ jsxs(Text, {
|
|
2319
2423
|
style: styles$1.dim,
|
|
2320
2424
|
accessibilityLiveRegion: "polite",
|
|
2321
|
-
children: [t("git.review.rowsShown", "{shown} of {total} diff rows shown", {
|
|
2425
|
+
children: [disclosable ? t("git.review.rowsShown", "{shown} of {total} diff rows shown", {
|
|
2322
2426
|
shown: Math.min(current.limit, rows.length),
|
|
2323
2427
|
total: rows.length
|
|
2324
|
-
}), props.selection ? t("git.review.selectedLine", " · {side} line {line} selected", {
|
|
2428
|
+
}) : "", props.selection ? t("git.review.selectedLine", " · {side} line {line} selected", {
|
|
2325
2429
|
side: props.selection.side === "old" ? t("git.review.oldSide", "old") : t("git.review.newSide", "new"),
|
|
2326
2430
|
line: props.selection.startLine
|
|
2327
2431
|
}) : ""]
|
|
2328
|
-
}), current.limit < rows.length ? /* @__PURE__ */ jsx(Button, {
|
|
2432
|
+
}), !disclosable ? null : current.limit < rows.length ? /* @__PURE__ */ jsx(Button, {
|
|
2329
2433
|
variant: "outline",
|
|
2330
2434
|
onPress: () => setDisclosure({
|
|
2331
2435
|
...current,
|
|
@@ -2336,7 +2440,15 @@ function GitReviewView(props) {
|
|
|
2336
2440
|
style: styles$1.dim,
|
|
2337
2441
|
children: t("git.ui.allDiffRowsShown", "All diff rows shown")
|
|
2338
2442
|
})]
|
|
2339
|
-
}) : null
|
|
2443
|
+
}) : null,
|
|
2444
|
+
/* @__PURE__ */ jsx(Footer, {
|
|
2445
|
+
count: comments.length,
|
|
2446
|
+
confirmation: screen === "changes" && activity.changes?.rebase !== void 0,
|
|
2447
|
+
discard: screen === "review",
|
|
2448
|
+
onReview: () => props.onScreen("review"),
|
|
2449
|
+
onSend: props.onSend,
|
|
2450
|
+
onDiscard: props.onDiscard
|
|
2451
|
+
})
|
|
2340
2452
|
]
|
|
2341
2453
|
});
|
|
2342
2454
|
}
|
|
@@ -2370,6 +2482,8 @@ function GitReviewPanelSession({ sessionId, sendSessionFrame }) {
|
|
|
2370
2482
|
const [summary, setSummary] = useState();
|
|
2371
2483
|
const [file, setFile] = useState();
|
|
2372
2484
|
const [error, setError] = useState();
|
|
2485
|
+
const [summaryError, setSummaryError] = useState();
|
|
2486
|
+
const [summaryAttempt, setSummaryAttempt] = useState(0);
|
|
2373
2487
|
const [dismissedError, setDismissedError] = useState();
|
|
2374
2488
|
const [confirm, setConfirm] = useState();
|
|
2375
2489
|
const [screen, setScreen] = useState("changes");
|
|
@@ -2383,17 +2497,21 @@ function GitReviewPanelSession({ sessionId, sendSessionFrame }) {
|
|
|
2383
2497
|
const controller = new AbortController();
|
|
2384
2498
|
fetchReviewSummary(sessionId, controller.signal).then((result) => {
|
|
2385
2499
|
if (!controller.signal.aborted) {
|
|
2500
|
+
setSummaryError(result.ok ? void 0 : result.error);
|
|
2386
2501
|
if (result.ok) setSummary(result.summary);
|
|
2387
|
-
else setError(result.error);
|
|
2388
2502
|
}
|
|
2389
2503
|
}).catch((cause) => {
|
|
2390
|
-
if (!controller.signal.aborted)
|
|
2504
|
+
if (!controller.signal.aborted) setSummaryError(cause instanceof Error ? cause.message : String(cause));
|
|
2391
2505
|
});
|
|
2392
2506
|
return () => {
|
|
2393
2507
|
controller.abort();
|
|
2394
2508
|
request.current?.abort();
|
|
2395
2509
|
};
|
|
2396
|
-
}, [
|
|
2510
|
+
}, [
|
|
2511
|
+
sessionId,
|
|
2512
|
+
fingerprint,
|
|
2513
|
+
summaryAttempt
|
|
2514
|
+
]);
|
|
2397
2515
|
const loadFile = async (path) => {
|
|
2398
2516
|
if (sessionId === null) return;
|
|
2399
2517
|
setScreen("file");
|
|
@@ -2456,6 +2574,11 @@ function GitReviewPanelSession({ sessionId, sendSessionFrame }) {
|
|
|
2456
2574
|
path,
|
|
2457
2575
|
comments,
|
|
2458
2576
|
error,
|
|
2577
|
+
summaryError,
|
|
2578
|
+
onRetrySummary: () => {
|
|
2579
|
+
setSummaryError(void 0);
|
|
2580
|
+
setSummaryAttempt((attempt) => attempt + 1);
|
|
2581
|
+
},
|
|
2459
2582
|
forceRequired,
|
|
2460
2583
|
selection,
|
|
2461
2584
|
onScreen: setScreen,
|
|
@@ -2464,7 +2587,7 @@ function GitReviewPanelSession({ sessionId, sendSessionFrame }) {
|
|
|
2464
2587
|
onSync: sync,
|
|
2465
2588
|
onForce: () => setConfirm("force"),
|
|
2466
2589
|
onAbort: () => setConfirm("abort"),
|
|
2467
|
-
onResolve: () => send(conflictPrompt(changes?.branch, changes?.rebase?.conflicts ?? [])),
|
|
2590
|
+
onResolve: () => send(conflictPrompt(changes?.rebase?.branch ?? changes?.branch, changes?.rebase?.conflicts ?? [])),
|
|
2468
2591
|
onDismiss: () => setDismissedError(activity.error),
|
|
2469
2592
|
onComment: () => {
|
|
2470
2593
|
if (path) {
|
|
@@ -2750,24 +2873,38 @@ var Worktrees_help_guides_native_default = defineFill({
|
|
|
2750
2873
|
data: {
|
|
2751
2874
|
version: 1,
|
|
2752
2875
|
category: "build",
|
|
2753
|
-
labelKey: "git.
|
|
2754
|
-
label: "
|
|
2876
|
+
labelKey: "git.help.label",
|
|
2877
|
+
label: "Git and worktrees",
|
|
2755
2878
|
guides: [{
|
|
2756
2879
|
id: "about",
|
|
2757
2880
|
questionKey: "git.guides.howDoWorktreesKeepSessionsSeparate",
|
|
2758
2881
|
question: "How do worktrees keep sessions separate?",
|
|
2759
2882
|
order: 0,
|
|
2760
|
-
answerKey: "git.
|
|
2761
|
-
answer: "A worktree gives
|
|
2762
|
-
keywords: [
|
|
2883
|
+
answerKey: "git.help.about.answer",
|
|
2884
|
+
answer: "A Git worktree gives each session its own branch and working folder so parallel tasks do not overwrite each other.\nWhen creating a session in a Git repository, choose Existing branch or New branch, or pick No branch to work directly in the workspace folder.",
|
|
2885
|
+
keywords: [
|
|
2886
|
+
"git",
|
|
2887
|
+
"branch",
|
|
2888
|
+
"checkout",
|
|
2889
|
+
"worktree",
|
|
2890
|
+
"parallel",
|
|
2891
|
+
"repo"
|
|
2892
|
+
]
|
|
2763
2893
|
}, {
|
|
2764
2894
|
id: "review",
|
|
2765
2895
|
questionKey: "git.guides.howDoIReviewChangesAndSendFeedback",
|
|
2766
2896
|
question: "How do I review changes and send feedback?",
|
|
2767
2897
|
order: 1,
|
|
2768
|
-
answerKey: "git.
|
|
2769
|
-
answer: "Open the
|
|
2770
|
-
keywords: [
|
|
2898
|
+
answerKey: "git.help.review.answer",
|
|
2899
|
+
answer: "1. Open the Diff row under Git in Activity, or press g d on desktop.\n2. Select lines to add inline review comments.\n3. Choose Send review to deliver all your comments to Po in one message.",
|
|
2900
|
+
keywords: [
|
|
2901
|
+
"git",
|
|
2902
|
+
"diff",
|
|
2903
|
+
"review",
|
|
2904
|
+
"comments",
|
|
2905
|
+
"changes",
|
|
2906
|
+
"pr"
|
|
2907
|
+
]
|
|
2771
2908
|
}]
|
|
2772
2909
|
}
|
|
2773
2910
|
});
|