unity-hub-cli 0.13.0 → 0.13.2

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.
Files changed (2) hide show
  1. package/dist/index.js +53 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -652,6 +652,13 @@ var extractProjectPath = (command) => {
652
652
  var isUnityMainProcess = (command) => {
653
653
  return UNITY_EXECUTABLE_PATTERN.test(command);
654
654
  };
655
+ var isUnityAuxiliaryProcess = (command) => {
656
+ const normalized = command.toLowerCase();
657
+ if (normalized.includes("-batchmode")) {
658
+ return true;
659
+ }
660
+ return normalized.includes("assetimportworker");
661
+ };
655
662
  var isProcessMissingError = (error) => {
656
663
  if (typeof error !== "object" || error === null) {
657
664
  return false;
@@ -698,6 +705,9 @@ var MacUnityProcessReader = class {
698
705
  if (!isUnityMainProcess(command)) {
699
706
  return void 0;
700
707
  }
708
+ if (isUnityAuxiliaryProcess(command)) {
709
+ return void 0;
710
+ }
701
711
  const projectArgument = extractProjectPath(command);
702
712
  if (!projectArgument) {
703
713
  return void 0;
@@ -959,6 +969,7 @@ var UnityTempDirectoryCleaner = class {
959
969
  };
960
970
 
961
971
  // src/presentation/App.tsx
972
+ import { basename as basename4 } from "path";
962
973
  import clipboard from "clipboardy";
963
974
  import { Box as Box6, Text as Text4, useApp, useInput, useStdout as useStdout2 } from "ink";
964
975
  import { useCallback, useEffect as useEffect4, useMemo as useMemo2, useState as useState4 } from "react";
@@ -1002,6 +1013,7 @@ var LayoutManager = ({
1002
1013
  };
1003
1014
 
1004
1015
  // src/presentation/components/ProjectList.tsx
1016
+ import { basename as basename3 } from "path";
1005
1017
  import { Box as Box3 } from "ink";
1006
1018
  import { useMemo } from "react";
1007
1019
 
@@ -1054,7 +1066,8 @@ var ProjectRow = ({
1054
1066
  pathLine,
1055
1067
  showBranch,
1056
1068
  showPath,
1057
- scrollbar
1069
+ scrollbar,
1070
+ showSpacer
1058
1071
  }) => {
1059
1072
  const { stdout } = useStdout();
1060
1073
  const computedCenterWidth = typeof stdout?.columns === "number" ? Math.max(0, stdout.columns - 6) : void 0;
@@ -1077,13 +1090,13 @@ var ProjectRow = ({
1077
1090
  ] }),
1078
1091
  showBranch ? /* @__PURE__ */ jsx2(Text, { color: "#e3839c", wrap: "truncate", children: branchLine }) : null,
1079
1092
  showPath ? /* @__PURE__ */ jsx2(Text, { color: "#719bd8", wrap: "truncate", children: pathLine }) : null,
1080
- /* @__PURE__ */ jsx2(Text, { children: " " })
1093
+ showSpacer ? /* @__PURE__ */ jsx2(Text, { children: " " }) : null
1081
1094
  ] }),
1082
1095
  /* @__PURE__ */ jsxs2(Box2, { marginLeft: 1, width: 1, flexDirection: "column", alignItems: "center", children: [
1083
1096
  /* @__PURE__ */ jsx2(Text, { children: scrollbar.title }),
1084
1097
  showBranch ? /* @__PURE__ */ jsx2(Text, { children: scrollbar.branch }) : null,
1085
1098
  showPath ? /* @__PURE__ */ jsx2(Text, { children: scrollbar.path }) : null,
1086
- /* @__PURE__ */ jsx2(Text, { children: scrollbar.spacer })
1099
+ showSpacer ? /* @__PURE__ */ jsx2(Text, { children: scrollbar.spacer }) : null
1087
1100
  ] })
1088
1101
  ] });
1089
1102
  };
@@ -1095,17 +1108,14 @@ var LOCK_COLOR = "yellow";
1095
1108
  var STATUS_LABELS = {
1096
1109
  idle: "",
1097
1110
  running: "[running]",
1098
- crashed: "[crash]"
1111
+ crashed: ""
1099
1112
  };
1100
1113
  var extractRootFolder = (repository) => {
1101
1114
  if (!repository?.root) {
1102
1115
  return void 0;
1103
1116
  }
1104
- const segments = repository.root.split("/").filter((segment) => segment.length > 0);
1105
- if (segments.length === 0) {
1106
- return void 0;
1107
- }
1108
- return segments[segments.length - 1];
1117
+ const base = basename3(repository.root);
1118
+ return base || void 0;
1109
1119
  };
1110
1120
  var formatProjectName = (projectTitle, repository, useGitRootName) => {
1111
1121
  if (!useGitRootName) {
@@ -1197,7 +1207,7 @@ var ProjectList = ({
1197
1207
  return [];
1198
1208
  }
1199
1209
  if (totalLines <= visibleLines) {
1200
- return Array.from({ length: visibleLines }, () => "\u2588");
1210
+ return Array.from({ length: visibleLines }, () => " ");
1201
1211
  }
1202
1212
  const trackLength = visibleLines;
1203
1213
  const sliderSize = Math.max(1, Math.round(visibleLines / totalLines * trackLength));
@@ -1242,7 +1252,7 @@ var ProjectList = ({
1242
1252
  const pathScrollbar = showPath ? scrollbarChars[baseScrollbarIndex + 1 + (showBranch ? 1 : 0)] ?? " " : " ";
1243
1253
  const spacerScrollbar = scrollbarChars[baseScrollbarIndex + linesPerProject - 1] ?? " ";
1244
1254
  const statusLabel = STATUS_LABELS[displayStatus];
1245
- const statusColor = displayStatus === "running" ? LOCK_COLOR : displayStatus === "crashed" ? "red" : void 0;
1255
+ const statusColor = displayStatus === "running" ? LOCK_COLOR : void 0;
1246
1256
  return /* @__PURE__ */ jsx3(
1247
1257
  ProjectRow,
1248
1258
  {
@@ -1263,7 +1273,8 @@ var ProjectList = ({
1263
1273
  branch: branchScrollbar,
1264
1274
  path: pathScrollbar,
1265
1275
  spacer: spacerScrollbar
1266
- }
1276
+ },
1277
+ showSpacer: offset < visibleProjects.length - 1
1267
1278
  },
1268
1279
  project.id
1269
1280
  );
@@ -1502,14 +1513,14 @@ var useVisibilityPreferences = () => {
1502
1513
 
1503
1514
  // src/presentation/hooks/useVisibleCount.ts
1504
1515
  import { useEffect as useEffect3, useState as useState3 } from "react";
1505
- var useVisibleCount = (stdout, linesPerProject, panelVisible, panelHeight, minimumVisibleProjectCount2) => {
1516
+ var useVisibleCount = (stdout, linesPerProject, panelVisible, panelHeight, minimumVisibleProjectCount2, statusBarRows) => {
1506
1517
  const compute = () => {
1507
1518
  if (!stdout || typeof stdout.columns !== "number" || typeof stdout.rows !== "number") {
1508
1519
  return minimumVisibleProjectCount2;
1509
1520
  }
1510
1521
  const borderRows = 2;
1511
- const hintRows = 1;
1512
- const reservedRows = borderRows + hintRows + (panelVisible ? panelHeight : 0);
1522
+ const hintRows = Math.max(1, statusBarRows);
1523
+ const reservedRows = borderRows + hintRows + (panelVisible ? panelHeight + 1 : 0);
1513
1524
  const availableRows = Math.max(0, stdout.rows - reservedRows);
1514
1525
  const rowsPerProject = Math.max(linesPerProject, 1);
1515
1526
  const calculatedCount = Math.max(1, Math.floor(availableRows / rowsPerProject));
@@ -1523,7 +1534,7 @@ var useVisibleCount = (stdout, linesPerProject, panelVisible, panelHeight, minim
1523
1534
  return () => {
1524
1535
  stdout?.off("resize", updateVisible);
1525
1536
  };
1526
- }, [stdout, linesPerProject, panelVisible, panelHeight]);
1537
+ }, [stdout, linesPerProject, panelVisible, panelHeight, statusBarRows]);
1527
1538
  return visibleCount;
1528
1539
  };
1529
1540
 
@@ -1533,14 +1544,11 @@ var extractRootFolder2 = (repository) => {
1533
1544
  if (!repository?.root) {
1534
1545
  return void 0;
1535
1546
  }
1536
- const segments = repository.root.split("/").filter((segment) => segment.length > 0);
1537
- if (segments.length === 0) {
1538
- return void 0;
1539
- }
1540
- return segments[segments.length - 1];
1547
+ const base = basename4(repository.root);
1548
+ return base || void 0;
1541
1549
  };
1542
1550
  var minimumVisibleProjectCount = 4;
1543
- var defaultHintMessage = "Select: j/k \xB7 Open: o \xB7 Quit: q \xB7 Refresh: r \xB7 CopyPath: c \xB7 Sort: s \xB7 Visibility: v \xB7 Close: ctrl + c";
1551
+ var defaultHintMessage = "j/k Select \xB7 [o]pen [q]uit [r]efresh [c]opy [s]ort [v]isibility \xB7 ^C Exit";
1544
1552
  var getCopyTargetPath = (view) => {
1545
1553
  const root = view.repository?.root;
1546
1554
  return root && root.length > 0 ? root : view.project.path;
@@ -1565,7 +1573,6 @@ var App = ({
1565
1573
  const linesPerProject = (showBranch ? 1 : 0) + (showPath ? 1 : 0) + 2;
1566
1574
  const isAnyMenuOpen = isSortMenuOpen || isVisibilityMenuOpen;
1567
1575
  const panelHeight = isVisibilityMenuOpen ? visibilityPanelHeight : sortPanelHeight;
1568
- const visibleCount = useVisibleCount(stdout, linesPerProject, isAnyMenuOpen, panelHeight, minimumVisibleProjectCount);
1569
1576
  const [index, setIndex] = useState4(0);
1570
1577
  const [hint, setHint] = useState4(defaultHintMessage);
1571
1578
  const [windowStart, setWindowStart] = useState4(0);
@@ -1573,7 +1580,18 @@ var App = ({
1573
1580
  const [launchedProjects, setLaunchedProjects] = useState4(/* @__PURE__ */ new Set());
1574
1581
  const [isRefreshing, setIsRefreshing] = useState4(false);
1575
1582
  const [sortMenuIndex, setSortMenuIndex] = useState4(0);
1583
+ const [directionManuallyChanged, setDirectionManuallyChanged] = useState4(false);
1576
1584
  const { sortPreferences, setSortPreferences } = useSortPreferences();
1585
+ const columns = typeof stdout?.columns === "number" ? stdout.columns : void 0;
1586
+ const statusBarRows = isAnyMenuOpen ? 1 : Math.max(1, typeof columns === "number" && columns > 0 ? Math.ceil(hint.length / columns) : 1);
1587
+ const visibleCount = useVisibleCount(
1588
+ stdout,
1589
+ linesPerProject,
1590
+ isAnyMenuOpen,
1591
+ panelHeight,
1592
+ minimumVisibleProjectCount,
1593
+ statusBarRows
1594
+ );
1577
1595
  const clearScreen = useCallback(() => {
1578
1596
  stdout?.write("\x1B[2J\x1B[3J\x1B[H");
1579
1597
  }, [stdout]);
@@ -1908,10 +1926,15 @@ var App = ({
1908
1926
  }
1909
1927
  const toggleCurrent = () => {
1910
1928
  if (sortMenuIndex === 0) {
1911
- setSortPreferences((prev) => ({ ...prev, primary: prev.primary === "updated" ? "name" : "updated" }));
1929
+ setSortPreferences((prev) => {
1930
+ const nextPrimary = prev.primary === "updated" ? "name" : "updated";
1931
+ const nextDirection = nextPrimary === "name" && !directionManuallyChanged ? "asc" : prev.direction;
1932
+ return { ...prev, primary: nextPrimary, direction: nextDirection };
1933
+ });
1912
1934
  return;
1913
1935
  }
1914
1936
  if (sortMenuIndex === 1) {
1937
+ setDirectionManuallyChanged(true);
1915
1938
  setSortPreferences((prev) => ({ ...prev, direction: prev.direction === "asc" ? "desc" : "asc" }));
1916
1939
  return;
1917
1940
  }
@@ -2060,7 +2083,7 @@ var App = ({
2060
2083
  ) })
2061
2084
  ] })
2062
2085
  ] }),
2063
- statusBar: isAnyMenuOpen ? /* @__PURE__ */ jsx6(Text4, { wrap: "truncate", children: "Select: j/k, Toggle: Space, Back: Esc" }) : /* @__PURE__ */ jsx6(Text4, { wrap: "truncate", children: hint })
2086
+ statusBar: isAnyMenuOpen ? /* @__PURE__ */ jsx6(Text4, { wrap: "truncate", children: "Select: j/k, Toggle: Space, Back: Esc" }) : /* @__PURE__ */ jsx6(Text4, { wrap: "wrap", children: hint })
2064
2087
  }
2065
2088
  );
2066
2089
  };
@@ -2137,4 +2160,8 @@ var bootstrap = async () => {
2137
2160
  process2.exitCode = 1;
2138
2161
  }
2139
2162
  };
2140
- await bootstrap();
2163
+ void bootstrap().catch((error) => {
2164
+ const message = error instanceof Error ? error.message : String(error);
2165
+ console.error(message);
2166
+ process2.exitCode = 1;
2167
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unity-hub-cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "A CLI tool that reads Unity Hub's projects and launches Unity Editor with an interactive TUI",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {