@agimon-ai/po-git 0.0.0-alpha.164 → 0.0.0-alpha.165

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.
@@ -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, ChevronRightIcon, Dot, FileIcon, Input, Label, ListRow, MessageIcon, SegmentedControl, Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle, Spinner, SyntaxLine, Textarea, fontOf } from "@agimon-ai/po-native-components";
5
+ import { AlertIcon, Badge, BranchIcon, Button, CheckIcon, ChevronRightIcon, Dot, FileIcon, Input, Label, ListRow, MessageIcon, SegmentedControl, 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";
@@ -70,7 +70,18 @@ const api = createApiClient({
70
70
  //#endregion
71
71
  //#region src/extensions/workspaces/(frontend)/_lib/newSessionForm.ts
72
72
  const MAX_LISTED = 200;
73
- /** Local branches first, then remote-only ones, filtered by a case-insensitive substring. */
73
+ /** The last segment of a path: enough to name a checkout without spelling out where it lives. */
74
+ function folderName(path) {
75
+ return path.split(/[\\/]/).filter((part) => part !== "").pop() ?? path;
76
+ }
77
+ /** Where a busy branch is checked out, short enough for one line. */
78
+ function busyNote(busyAt, workspaceRoot) {
79
+ return busyAt === workspaceRoot ? "Checked out here" : `Checked out in ${folderName(busyAt)}`;
80
+ }
81
+ /**
82
+ * Local branches a session can take, then the checked-out ones, then remote-only ones, filtered by a
83
+ * case-insensitive substring.
84
+ */
74
85
  function branchOptions(branches, query) {
75
86
  const needle = query.trim().toLowerCase();
76
87
  const matches = (text) => needle === "" || text.toLowerCase().includes(needle);
@@ -79,7 +90,7 @@ function branchOptions(branches, query) {
79
90
  name: branch.name,
80
91
  current: branch.name === branches.current,
81
92
  ...branch.checkedOutAt === void 0 ? {} : { busyAt: branch.checkedOutAt }
82
- }));
93
+ })).sort((a, b) => Number(a.busyAt !== void 0) - Number(b.busyAt !== void 0));
83
94
  const remote = branches.remote.filter((branch) => matches(`${branch.remote}/${branch.name}`)).map((branch) => ({
84
95
  key: `remote:${branch.remote}/${branch.name}`,
85
96
  name: branch.name,
@@ -180,8 +191,8 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
180
191
  /* @__PURE__ */ jsx(Text, {
181
192
  style: styles$3.root,
182
193
  numberOfLines: 1,
183
- ellipsizeMode: "middle",
184
- children: workspaceRoot
194
+ accessibilityLabel: `Workspace ${workspaceRoot}`,
195
+ children: folderName(workspaceRoot)
185
196
  }),
186
197
  !ready ? /* @__PURE__ */ jsx(Text, {
187
198
  testID: "git-new-session-plain-note",
@@ -224,12 +235,23 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
224
235
  }) : null, /* @__PURE__ */ jsx(ListRow, {
225
236
  title: /* @__PURE__ */ jsx(Text, {
226
237
  style: styles$3.mono,
238
+ numberOfLines: 1,
239
+ ellipsizeMode: "middle",
227
240
  children: branch.remote === void 0 ? branch.name : `${branch.remote}/${branch.name}`
228
241
  }),
229
- description: branch.busyAt !== void 0 ? `Checked out in ${branch.busyAt}` : branch.current ? "Current" : void 0,
242
+ description: branch.busyAt !== void 0 ? /* @__PURE__ */ jsx(Text, {
243
+ style: styles$3.dim,
244
+ numberOfLines: 1,
245
+ children: busyNote(branch.busyAt, workspaceRoot)
246
+ }) : branch.current ? "Current" : void 0,
247
+ trailing: form.selected?.key === branch.key ? /* @__PURE__ */ jsx(CheckIcon, {
248
+ size: 16,
249
+ color: "green"
250
+ }) : void 0,
230
251
  selected: form.selected?.key === branch.key,
231
252
  disabled: branch.busyAt !== void 0 || busy,
232
253
  disclosure: false,
254
+ style: index > 0 && styles$3.divider,
233
255
  onPress: () => update({ selected: branch })
234
256
  })] }, branch.key))]
235
257
  })
@@ -290,8 +312,9 @@ function GitNewSessionSheetView({ workspaceRoot, branches, loadError = "", initi
290
312
  })]
291
313
  }),
292
314
  mode !== "plain" ? /* @__PURE__ */ jsx(Text, {
315
+ testID: "new-session-hint",
293
316
  style: styles$3.dim,
294
- children: "Runs in its own worktree, so this checkout stays as it is."
317
+ children: (loading ? void 0 : problem) ?? "Runs in its own worktree, so this checkout stays as it is."
295
318
  }) : null,
296
319
  error ? /* @__PURE__ */ jsx(Text, {
297
320
  testID: "new-session-error",
@@ -386,7 +409,6 @@ const styles$3 = StyleSheet.create((theme) => {
386
409
  fontSize: theme.fontSize.sm,
387
410
  lineHeight: theme.lineHeight.sm,
388
411
  color: theme.colors.dim,
389
- textAlign: "center",
390
412
  uni__dependencies: [0]
391
413
  },
392
414
  field: {
@@ -415,7 +437,7 @@ const styles$3 = StyleSheet.create((theme) => {
415
437
  uni__dependencies: [0]
416
438
  },
417
439
  list: {
418
- maxHeight: 320,
440
+ maxHeight: 242,
419
441
  borderRadius: theme.borderRadius.lg,
420
442
  borderWidth: 1,
421
443
  borderColor: theme.colors["border-soft"],