gh-manager-cli 1.8.0 → 1.8.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.
- package/CHANGELOG.md +14 -0
- package/README.md +20 -7
- package/dist/index.js +354 -301
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var require_package = __commonJS({
|
|
|
19
19
|
"package.json"(exports, module) {
|
|
20
20
|
module.exports = {
|
|
21
21
|
name: "gh-manager-cli",
|
|
22
|
-
version: "1.8.
|
|
22
|
+
version: "1.8.2",
|
|
23
23
|
private: false,
|
|
24
24
|
description: "Interactive CLI to manage your GitHub repos (personal) with Ink",
|
|
25
25
|
license: "MIT",
|
|
@@ -135,13 +135,13 @@ var require_package = __commonJS({
|
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
// src/index.tsx
|
|
138
|
-
import { render, Box as
|
|
138
|
+
import { render, Box as Box7, Text as Text8 } from "ink";
|
|
139
139
|
import "dotenv/config";
|
|
140
140
|
|
|
141
141
|
// src/ui/App.tsx
|
|
142
|
-
import { useEffect as
|
|
143
|
-
import { Box as
|
|
144
|
-
import
|
|
142
|
+
import { useEffect as useEffect4, useMemo as useMemo2, useState as useState4 } from "react";
|
|
143
|
+
import { Box as Box6, Text as Text7, useApp as useApp2, useStdout as useStdout2, useInput as useInput3 } from "ink";
|
|
144
|
+
import TextInput3 from "ink-text-input";
|
|
145
145
|
|
|
146
146
|
// src/config.ts
|
|
147
147
|
import fs from "fs";
|
|
@@ -197,10 +197,10 @@ function storeUIPrefs(patch) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
// src/ui/RepoList.tsx
|
|
200
|
-
import
|
|
201
|
-
import { Box as
|
|
202
|
-
import
|
|
203
|
-
import
|
|
200
|
+
import React3, { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
|
|
201
|
+
import { Box as Box5, Text as Text6, useApp, useInput as useInput2, useStdout } from "ink";
|
|
202
|
+
import TextInput2 from "ink-text-input";
|
|
203
|
+
import chalk3 from "chalk";
|
|
204
204
|
|
|
205
205
|
// src/apolloMeta.ts
|
|
206
206
|
import fs2 from "fs";
|
|
@@ -329,20 +329,11 @@ function OrgSwitcher({ token, currentContext, onSelect, onClose }) {
|
|
|
329
329
|
] });
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
// src/ui/
|
|
333
|
-
import {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
const [frame, setFrame] = useState2(0);
|
|
338
|
-
useEffect2(() => {
|
|
339
|
-
const timer = setInterval(() => {
|
|
340
|
-
setFrame((f) => (f + 1) % frames.length);
|
|
341
|
-
}, 500);
|
|
342
|
-
return () => clearInterval(timer);
|
|
343
|
-
}, [frames.length]);
|
|
344
|
-
return /* @__PURE__ */ jsx2(Text2, { children: frames[frame] });
|
|
345
|
-
}
|
|
332
|
+
// src/ui/components/repo/RepoRow.tsx
|
|
333
|
+
import { Box as Box2, Text as Text2 } from "ink";
|
|
334
|
+
import chalk2 from "chalk";
|
|
335
|
+
|
|
336
|
+
// src/utils.ts
|
|
346
337
|
function truncate(str, max = 80) {
|
|
347
338
|
if (str.length <= max) return str;
|
|
348
339
|
return str.slice(0, Math.max(0, max - 1)) + "\u2026";
|
|
@@ -359,7 +350,18 @@ function formatDate(dateStr) {
|
|
|
359
350
|
if (diffDays < 365) return `${Math.floor(diffDays / 30)} months ago`;
|
|
360
351
|
return `${Math.floor(diffDays / 365)} years ago`;
|
|
361
352
|
}
|
|
362
|
-
|
|
353
|
+
|
|
354
|
+
// src/ui/components/repo/RepoRow.tsx
|
|
355
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
356
|
+
function RepoRow({
|
|
357
|
+
repo,
|
|
358
|
+
selected,
|
|
359
|
+
index,
|
|
360
|
+
maxWidth,
|
|
361
|
+
spacingLines,
|
|
362
|
+
dim,
|
|
363
|
+
forkTracking
|
|
364
|
+
}) {
|
|
363
365
|
const langName = repo.primaryLanguage?.name || "";
|
|
364
366
|
const langColor = repo.primaryLanguage?.color || "#666666";
|
|
365
367
|
const hasCommitData = repo.isFork && repo.parent && repo.defaultBranchRef && repo.parent.defaultBranchRef && repo.parent.defaultBranchRef.target?.history && repo.defaultBranchRef.target?.history;
|
|
@@ -394,65 +396,96 @@ function RepoRow({ repo, selected, index, maxWidth, spacingLines, dim, forkTrack
|
|
|
394
396
|
spacingLines > 0 && /* @__PURE__ */ jsx2(Box2, { height: spacingLines, children: /* @__PURE__ */ jsx2(Text2, { children: " " }) })
|
|
395
397
|
] });
|
|
396
398
|
}
|
|
399
|
+
|
|
400
|
+
// src/ui/components/repo/FilterInput.tsx
|
|
401
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
402
|
+
import TextInput from "ink-text-input";
|
|
403
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
404
|
+
|
|
405
|
+
// src/ui/components/repo/RepoListHeader.tsx
|
|
406
|
+
import { Box as Box4, Text as Text5 } from "ink";
|
|
407
|
+
|
|
408
|
+
// src/ui/components/common/SlowSpinner.tsx
|
|
409
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
410
|
+
import { Text as Text4 } from "ink";
|
|
411
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
412
|
+
function SlowSpinner() {
|
|
413
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
414
|
+
const [frame, setFrame] = useState2(0);
|
|
415
|
+
useEffect2(() => {
|
|
416
|
+
const timer = setInterval(() => {
|
|
417
|
+
setFrame((f) => (f + 1) % frames.length);
|
|
418
|
+
}, 500);
|
|
419
|
+
return () => clearInterval(timer);
|
|
420
|
+
}, [frames.length]);
|
|
421
|
+
return /* @__PURE__ */ jsx4(Text4, { children: frames[frame] });
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// src/ui/components/repo/RepoListHeader.tsx
|
|
425
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
426
|
+
|
|
427
|
+
// src/ui/RepoList.tsx
|
|
428
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
429
|
+
var PAGE_SIZE = process.env.GH_MANAGER_DEV === "1" || process.env.NODE_ENV === "development" ? 5 : 15;
|
|
397
430
|
function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextChange }) {
|
|
398
431
|
const { exit } = useApp();
|
|
399
432
|
const { stdout } = useStdout();
|
|
400
433
|
const client = useMemo(() => makeClient(token), [token]);
|
|
401
|
-
const [debugMessages, setDebugMessages] =
|
|
434
|
+
const [debugMessages, setDebugMessages] = useState3([]);
|
|
402
435
|
const addDebugMessage = (msg) => {
|
|
403
436
|
if (process.env.GH_MANAGER_DEBUG === "1") {
|
|
404
437
|
setDebugMessages((prev) => [...prev.slice(-9), msg]);
|
|
405
438
|
}
|
|
406
439
|
};
|
|
407
|
-
|
|
440
|
+
React3.useEffect(() => {
|
|
408
441
|
addDebugMessage(`[RepoList] Component mounted`);
|
|
409
442
|
}, []);
|
|
410
443
|
const terminalWidth = stdout?.columns ?? 80;
|
|
411
444
|
const availableHeight = maxVisibleRows ?? 20;
|
|
412
|
-
const [items, setItems] =
|
|
413
|
-
const [cursor, setCursor] =
|
|
414
|
-
const [endCursor, setEndCursor] =
|
|
415
|
-
const [hasNextPage, setHasNextPage] =
|
|
416
|
-
const [totalCount, setTotalCount] =
|
|
417
|
-
const [loading, setLoading] =
|
|
418
|
-
const [sortingLoading, setSortingLoading] =
|
|
419
|
-
const [refreshing, setRefreshing] =
|
|
420
|
-
const [loadingMore, setLoadingMore] =
|
|
421
|
-
const [error, setError] =
|
|
422
|
-
const [rateLimit, setRateLimit] =
|
|
423
|
-
const [prevRateLimit, setPrevRateLimit] =
|
|
424
|
-
const [density, setDensity] =
|
|
425
|
-
const [prefsLoaded, setPrefsLoaded] =
|
|
426
|
-
const [ownerContext, setOwnerContext] =
|
|
427
|
-
const [ownerAffiliations, setOwnerAffiliations] =
|
|
428
|
-
const [orgSwitcherOpen, setOrgSwitcherOpen] =
|
|
429
|
-
const [searchItems, setSearchItems] =
|
|
430
|
-
const [searchEndCursor, setSearchEndCursor] =
|
|
431
|
-
const [searchHasNextPage, setSearchHasNextPage] =
|
|
432
|
-
const [searchTotalCount, setSearchTotalCount] =
|
|
433
|
-
const [searchLoading, setSearchLoading] =
|
|
434
|
-
const [deleteMode, setDeleteMode] =
|
|
435
|
-
const [deleteTarget, setDeleteTarget] =
|
|
436
|
-
const [deleteCode, setDeleteCode] =
|
|
437
|
-
const [typedCode, setTypedCode] =
|
|
438
|
-
const [deleting, setDeleting] =
|
|
439
|
-
const [deleteError, setDeleteError] =
|
|
440
|
-
const [deleteConfirmStage, setDeleteConfirmStage] =
|
|
441
|
-
const [confirmFocus, setConfirmFocus] =
|
|
442
|
-
const [archiveMode, setArchiveMode] =
|
|
443
|
-
const [archiveTarget, setArchiveTarget] =
|
|
444
|
-
const [archiving, setArchiving] =
|
|
445
|
-
const [archiveError, setArchiveError] =
|
|
446
|
-
const [archiveFocus, setArchiveFocus] =
|
|
447
|
-
const [syncMode, setSyncMode] =
|
|
448
|
-
const [syncTarget, setSyncTarget] =
|
|
449
|
-
const [syncing, setSyncing] =
|
|
450
|
-
const [syncError, setSyncError] =
|
|
451
|
-
const [syncFocus, setSyncFocus] =
|
|
452
|
-
const [infoMode, setInfoMode] =
|
|
453
|
-
const [logoutMode, setLogoutMode] =
|
|
454
|
-
const [logoutFocus, setLogoutFocus] =
|
|
455
|
-
const [logoutError, setLogoutError] =
|
|
445
|
+
const [items, setItems] = useState3([]);
|
|
446
|
+
const [cursor, setCursor] = useState3(0);
|
|
447
|
+
const [endCursor, setEndCursor] = useState3(null);
|
|
448
|
+
const [hasNextPage, setHasNextPage] = useState3(false);
|
|
449
|
+
const [totalCount, setTotalCount] = useState3(0);
|
|
450
|
+
const [loading, setLoading] = useState3(true);
|
|
451
|
+
const [sortingLoading, setSortingLoading] = useState3(false);
|
|
452
|
+
const [refreshing, setRefreshing] = useState3(false);
|
|
453
|
+
const [loadingMore, setLoadingMore] = useState3(false);
|
|
454
|
+
const [error, setError] = useState3(null);
|
|
455
|
+
const [rateLimit, setRateLimit] = useState3(void 0);
|
|
456
|
+
const [prevRateLimit, setPrevRateLimit] = useState3(void 0);
|
|
457
|
+
const [density, setDensity] = useState3(2);
|
|
458
|
+
const [prefsLoaded, setPrefsLoaded] = useState3(false);
|
|
459
|
+
const [ownerContext, setOwnerContext] = useState3("personal");
|
|
460
|
+
const [ownerAffiliations, setOwnerAffiliations] = useState3(["OWNER"]);
|
|
461
|
+
const [orgSwitcherOpen, setOrgSwitcherOpen] = useState3(false);
|
|
462
|
+
const [searchItems, setSearchItems] = useState3([]);
|
|
463
|
+
const [searchEndCursor, setSearchEndCursor] = useState3(null);
|
|
464
|
+
const [searchHasNextPage, setSearchHasNextPage] = useState3(false);
|
|
465
|
+
const [searchTotalCount, setSearchTotalCount] = useState3(0);
|
|
466
|
+
const [searchLoading, setSearchLoading] = useState3(false);
|
|
467
|
+
const [deleteMode, setDeleteMode] = useState3(false);
|
|
468
|
+
const [deleteTarget, setDeleteTarget] = useState3(null);
|
|
469
|
+
const [deleteCode, setDeleteCode] = useState3("");
|
|
470
|
+
const [typedCode, setTypedCode] = useState3("");
|
|
471
|
+
const [deleting, setDeleting] = useState3(false);
|
|
472
|
+
const [deleteError, setDeleteError] = useState3(null);
|
|
473
|
+
const [deleteConfirmStage, setDeleteConfirmStage] = useState3(false);
|
|
474
|
+
const [confirmFocus, setConfirmFocus] = useState3("delete");
|
|
475
|
+
const [archiveMode, setArchiveMode] = useState3(false);
|
|
476
|
+
const [archiveTarget, setArchiveTarget] = useState3(null);
|
|
477
|
+
const [archiving, setArchiving] = useState3(false);
|
|
478
|
+
const [archiveError, setArchiveError] = useState3(null);
|
|
479
|
+
const [archiveFocus, setArchiveFocus] = useState3("confirm");
|
|
480
|
+
const [syncMode, setSyncMode] = useState3(false);
|
|
481
|
+
const [syncTarget, setSyncTarget] = useState3(null);
|
|
482
|
+
const [syncing, setSyncing] = useState3(false);
|
|
483
|
+
const [syncError, setSyncError] = useState3(null);
|
|
484
|
+
const [syncFocus, setSyncFocus] = useState3("confirm");
|
|
485
|
+
const [infoMode, setInfoMode] = useState3(false);
|
|
486
|
+
const [logoutMode, setLogoutMode] = useState3(false);
|
|
487
|
+
const [logoutFocus, setLogoutFocus] = useState3("confirm");
|
|
488
|
+
const [logoutError, setLogoutError] = useState3(null);
|
|
456
489
|
function closeArchiveModal() {
|
|
457
490
|
setArchiveMode(false);
|
|
458
491
|
setArchiveTarget(null);
|
|
@@ -494,8 +527,13 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
494
527
|
setDeleting(true);
|
|
495
528
|
const [owner, repo] = (deleteTarget.nameWithOwner || "").split("/");
|
|
496
529
|
await deleteRepositoryRest(token, owner, repo);
|
|
497
|
-
|
|
530
|
+
const targetId = deleteTarget.id;
|
|
531
|
+
setItems((prev) => prev.filter((r) => r.id !== targetId));
|
|
532
|
+
setSearchItems((prev) => prev.filter((r) => r.id !== targetId));
|
|
498
533
|
setTotalCount((c) => Math.max(0, c - 1));
|
|
534
|
+
if (searchActive) {
|
|
535
|
+
setSearchTotalCount((c) => Math.max(0, c - 1));
|
|
536
|
+
}
|
|
499
537
|
setDeleteMode(false);
|
|
500
538
|
setDeleteTarget(null);
|
|
501
539
|
setTypedCode("");
|
|
@@ -508,11 +546,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
508
546
|
setDeleteError("Failed to delete repository. Ensure delete_repo scope and admin permissions.");
|
|
509
547
|
}
|
|
510
548
|
}
|
|
511
|
-
const [filter, setFilter] =
|
|
512
|
-
const [filterMode, setFilterMode] =
|
|
513
|
-
const [sortKey, setSortKey] =
|
|
514
|
-
const [sortDir, setSortDir] =
|
|
515
|
-
const [forkTracking, setForkTracking] =
|
|
549
|
+
const [filter, setFilter] = useState3("");
|
|
550
|
+
const [filterMode, setFilterMode] = useState3(false);
|
|
551
|
+
const [sortKey, setSortKey] = useState3("updated");
|
|
552
|
+
const [sortDir, setSortDir] = useState3("desc");
|
|
553
|
+
const [forkTracking, setForkTracking] = useState3(true);
|
|
516
554
|
const sortFieldMap = {
|
|
517
555
|
"updated": "UPDATED_AT",
|
|
518
556
|
"pushed": "PUSHED_AT",
|
|
@@ -632,7 +670,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
632
670
|
setSearchLoading(false);
|
|
633
671
|
}
|
|
634
672
|
};
|
|
635
|
-
|
|
673
|
+
useEffect3(() => {
|
|
636
674
|
const ui = getUIPrefs();
|
|
637
675
|
if (ui.density !== void 0) setDensity(ui.density);
|
|
638
676
|
if (ui.sortKey && ["updated", "pushed", "name", "stars"].includes(ui.sortKey)) {
|
|
@@ -654,7 +692,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
654
692
|
}
|
|
655
693
|
setPrefsLoaded(true);
|
|
656
694
|
}, [onOrgContextChange]);
|
|
657
|
-
|
|
695
|
+
useEffect3(() => {
|
|
658
696
|
if (!prefsLoaded) return;
|
|
659
697
|
let policy = "cache-first";
|
|
660
698
|
const orgLogin2 = ownerContext !== "personal" ? ownerContext.login : void 0;
|
|
@@ -674,7 +712,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
674
712
|
setCursor(0);
|
|
675
713
|
fetchPage(null, true, false, void 0, policy);
|
|
676
714
|
}, [client, prefsLoaded, ownerContext, ownerAffiliations]);
|
|
677
|
-
|
|
715
|
+
useEffect3(() => {
|
|
678
716
|
if (!searchActive) {
|
|
679
717
|
if (items.length > 0) {
|
|
680
718
|
let policy = "cache-first";
|
|
@@ -713,7 +751,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
713
751
|
}
|
|
714
752
|
}
|
|
715
753
|
}, [sortKey, sortDir]);
|
|
716
|
-
|
|
754
|
+
useEffect3(() => {
|
|
717
755
|
if (viewerLogin && searchActive && !searchLoading && searchItems.length === 0) {
|
|
718
756
|
let policy = "cache-first";
|
|
719
757
|
try {
|
|
@@ -789,7 +827,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
789
827
|
const id = archiveTarget.id;
|
|
790
828
|
if (isArchived) await unarchiveRepositoryById(client, id);
|
|
791
829
|
else await archiveRepositoryById(client, id);
|
|
792
|
-
|
|
830
|
+
const updateRepo = (r) => r.id === id ? { ...r, isArchived: !isArchived } : r;
|
|
831
|
+
setItems((prev) => prev.map(updateRepo));
|
|
832
|
+
setSearchItems((prev) => prev.map(updateRepo));
|
|
793
833
|
closeArchiveModal();
|
|
794
834
|
} catch (e) {
|
|
795
835
|
setArchiving(false);
|
|
@@ -825,7 +865,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
825
865
|
const [owner, repo] = syncTarget.nameWithOwner.split("/");
|
|
826
866
|
const branchName = syncTarget.defaultBranchRef?.name || "main";
|
|
827
867
|
const result = await syncForkWithUpstream(token, owner, repo, branchName);
|
|
828
|
-
|
|
868
|
+
const updateSyncedRepo = (r) => {
|
|
829
869
|
if (r.id === syncTarget.id && r.parent && r.defaultBranchRef?.target?.history && r.parent.defaultBranchRef?.target?.history) {
|
|
830
870
|
return {
|
|
831
871
|
...r,
|
|
@@ -841,7 +881,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
841
881
|
};
|
|
842
882
|
}
|
|
843
883
|
return r;
|
|
844
|
-
}
|
|
884
|
+
};
|
|
885
|
+
setItems((prev) => prev.map(updateSyncedRepo));
|
|
886
|
+
setSearchItems((prev) => prev.map(updateSyncedRepo));
|
|
845
887
|
closeSyncModal();
|
|
846
888
|
} catch (e) {
|
|
847
889
|
setSyncing(false);
|
|
@@ -1105,12 +1147,12 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1105
1147
|
}, [filtered, sortKey, sortDir]);
|
|
1106
1148
|
const searchActive = filter.trim().length >= 3;
|
|
1107
1149
|
const visibleItems = searchActive ? searchItems : filteredAndSorted;
|
|
1108
|
-
|
|
1150
|
+
useEffect3(() => {
|
|
1109
1151
|
if (searchActive) {
|
|
1110
1152
|
addDebugMessage(`[State] searchActive=${searchActive}, searchItems=${searchItems.length}, visibleItems=${visibleItems.length}, filter="${filter}"`);
|
|
1111
1153
|
}
|
|
1112
1154
|
}, [searchActive, searchItems.length, visibleItems.length, filter]);
|
|
1113
|
-
|
|
1155
|
+
useEffect3(() => {
|
|
1114
1156
|
setCursor((c) => Math.min(c, Math.max(0, (searchActive ? searchItems.length : items.length) - 1)));
|
|
1115
1157
|
}, [searchActive, searchItems.length, items.length]);
|
|
1116
1158
|
const headerHeight = 2;
|
|
@@ -1131,7 +1173,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1131
1173
|
const end = Math.min(total, start + visibleRepos + buffer);
|
|
1132
1174
|
return { start, end };
|
|
1133
1175
|
}, [visibleItems.length, cursor, listHeight, spacingLines]);
|
|
1134
|
-
|
|
1176
|
+
useEffect3(() => {
|
|
1135
1177
|
const prefetchThreshold = Math.floor(visibleItems.length * 0.8);
|
|
1136
1178
|
const nearEnd = visibleItems.length > 0 && cursor >= prefetchThreshold;
|
|
1137
1179
|
if (searchActive) {
|
|
@@ -1153,81 +1195,88 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1153
1195
|
}
|
|
1154
1196
|
const lowRate = rateLimit && rateLimit.remaining <= Math.ceil(rateLimit.limit * 0.1);
|
|
1155
1197
|
const modalOpen = deleteMode || archiveMode || syncMode || logoutMode || infoMode;
|
|
1156
|
-
const headerBar = useMemo(() => /* @__PURE__ */
|
|
1157
|
-
/* @__PURE__ */
|
|
1158
|
-
/* @__PURE__ */
|
|
1159
|
-
/* @__PURE__ */
|
|
1198
|
+
const headerBar = useMemo(() => /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: [
|
|
1199
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 1, children: [
|
|
1200
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, color: modalOpen ? "gray" : void 0, dimColor: modalOpen ? true : void 0, children: " Repositories" }),
|
|
1201
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1160
1202
|
"(",
|
|
1161
1203
|
visibleItems.length,
|
|
1162
1204
|
"/",
|
|
1163
1205
|
searchActive ? searchTotalCount : totalCount,
|
|
1164
1206
|
")"
|
|
1165
1207
|
] }),
|
|
1166
|
-
(loading || searchLoading) && /* @__PURE__ */
|
|
1208
|
+
(loading || searchLoading) && /* @__PURE__ */ jsx6(Box5, { width: 2, flexShrink: 0, flexGrow: 0, marginLeft: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "yellow", children: /* @__PURE__ */ jsx6(SlowSpinner, {}) }) })
|
|
1167
1209
|
] }),
|
|
1168
|
-
rateLimit && /* @__PURE__ */
|
|
1210
|
+
rateLimit && /* @__PURE__ */ jsxs5(Text6, { color: lowRate ? "yellow" : "gray", children: [
|
|
1169
1211
|
"API: ",
|
|
1170
1212
|
rateLimit.remaining,
|
|
1171
1213
|
"/",
|
|
1172
1214
|
rateLimit.limit,
|
|
1173
|
-
prevRateLimit !== void 0 && prevRateLimit !== rateLimit.remaining && /* @__PURE__ */
|
|
1215
|
+
prevRateLimit !== void 0 && prevRateLimit !== rateLimit.remaining && /* @__PURE__ */ jsx6(Text6, { color: rateLimit.remaining < prevRateLimit ? "red" : "green", children: ` (${rateLimit.remaining - prevRateLimit > 0 ? "+" : ""}${rateLimit.remaining - prevRateLimit})` })
|
|
1174
1216
|
] })
|
|
1175
1217
|
] }), [visibleItems.length, searchActive, searchTotalCount, totalCount, loading, searchLoading, rateLimit, lowRate, modalOpen, prevRateLimit]);
|
|
1176
1218
|
if (error) {
|
|
1177
|
-
return /* @__PURE__ */
|
|
1178
|
-
/* @__PURE__ */
|
|
1179
|
-
|
|
1219
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", height: availableHeight, children: [
|
|
1220
|
+
/* @__PURE__ */ jsx6(Box5, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 1, children: [
|
|
1221
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: " Repositories" }),
|
|
1222
|
+
/* @__PURE__ */ jsx6(Text6, { color: "red", children: "(Error)" })
|
|
1223
|
+
] }) }),
|
|
1224
|
+
/* @__PURE__ */ jsx6(Box5, { borderStyle: "single", borderColor: "red", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: /* @__PURE__ */ jsx6(Box5, { height: contentHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", alignItems: "center", children: [
|
|
1225
|
+
/* @__PURE__ */ jsx6(Text6, { color: "red", children: error }),
|
|
1226
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: true, children: "Press 'r' to retry or 'q' to quit" }) })
|
|
1227
|
+
] }) }) }),
|
|
1228
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", children: "Press 'r' to retry \u2022 'q' to quit" }) })
|
|
1180
1229
|
] });
|
|
1181
1230
|
}
|
|
1182
1231
|
if (loading && items.length === 0 || sortingLoading) {
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
/* @__PURE__ */
|
|
1185
|
-
/* @__PURE__ */
|
|
1186
|
-
/* @__PURE__ */
|
|
1232
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", height: availableHeight, children: [
|
|
1233
|
+
/* @__PURE__ */ jsx6(Box5, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 1, children: [
|
|
1234
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: " Repositories" }),
|
|
1235
|
+
/* @__PURE__ */ jsx6(Text6, { color: "gray", children: "(Loading...)" })
|
|
1187
1236
|
] }) }),
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ jsx6(Box5, { borderStyle: "single", borderColor: "yellow", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: /* @__PURE__ */ jsx6(Box5, { height: contentHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx6(Box5, { flexDirection: "column", alignItems: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", alignItems: "center", children: [
|
|
1238
|
+
/* @__PURE__ */ jsxs5(Box5, { height: 1, flexDirection: "row", children: [
|
|
1239
|
+
/* @__PURE__ */ jsx6(Box5, { width: 2, flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx6(Text6, { color: "cyan", children: /* @__PURE__ */ jsx6(SlowSpinner, {}) }) }),
|
|
1240
|
+
/* @__PURE__ */ jsx6(Text6, { color: "cyan", children: refreshing ? "Refreshing..." : sortingLoading ? "Applying sort..." : "Loading repositories..." })
|
|
1192
1241
|
] }),
|
|
1193
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", children: refreshing ? "Fetching latest repository data" : sortingLoading ? `Sorting by ${sortKey} (${sortDir === "asc" ? "ascending" : "descending"})` : "Fetching your GitHub repositories" }) })
|
|
1194
1243
|
] }) }) }) }),
|
|
1195
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", children: "Please wait..." }) })
|
|
1196
1245
|
] });
|
|
1197
1246
|
}
|
|
1198
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", height: availableHeight, children: [
|
|
1199
1248
|
headerBar,
|
|
1200
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ jsx6(Box5, { borderStyle: "single", borderColor: modalOpen ? "gray" : "yellow", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: deleteMode && deleteTarget ? (
|
|
1201
1250
|
// Centered modal; hide list content while modal is open
|
|
1202
|
-
/* @__PURE__ */
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1251
|
+
/* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1252
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Delete Confirmation" }),
|
|
1253
|
+
/* @__PURE__ */ jsx6(Text6, { color: "red", children: "\u26A0\uFE0F Delete repository?" }),
|
|
1254
|
+
/* @__PURE__ */ jsx6(Box5, { height: 2, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1206
1255
|
(() => {
|
|
1207
1256
|
const langName = deleteTarget.primaryLanguage?.name || "";
|
|
1208
1257
|
const langColor = deleteTarget.primaryLanguage?.color || "#666666";
|
|
1209
1258
|
let line1 = "";
|
|
1210
|
-
line1 +=
|
|
1211
|
-
if (deleteTarget.isPrivate) line1 +=
|
|
1212
|
-
if (deleteTarget.isArchived) line1 +=
|
|
1213
|
-
if (deleteTarget.isFork && deleteTarget.parent) line1 +=
|
|
1259
|
+
line1 += chalk3.white(deleteTarget.nameWithOwner);
|
|
1260
|
+
if (deleteTarget.isPrivate) line1 += chalk3.yellow(" Private");
|
|
1261
|
+
if (deleteTarget.isArchived) line1 += chalk3.gray.dim(" Archived");
|
|
1262
|
+
if (deleteTarget.isFork && deleteTarget.parent) line1 += chalk3.blue(` Fork of ${deleteTarget.parent.nameWithOwner}`);
|
|
1214
1263
|
let line2 = "";
|
|
1215
|
-
if (langName) line2 +=
|
|
1216
|
-
line2 +=
|
|
1217
|
-
return /* @__PURE__ */
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1264
|
+
if (langName) line2 += chalk3.hex(langColor)("\u25CF ") + chalk3.gray(`${langName} `);
|
|
1265
|
+
line2 += chalk3.gray(`\u2605 ${deleteTarget.stargazerCount} \u2442 ${deleteTarget.forkCount} Updated ${formatDate(deleteTarget.updatedAt)}`);
|
|
1266
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1267
|
+
/* @__PURE__ */ jsx6(Text6, { children: line1 }),
|
|
1268
|
+
/* @__PURE__ */ jsx6(Text6, { children: line2 })
|
|
1220
1269
|
] });
|
|
1221
1270
|
})(),
|
|
1222
|
-
/* @__PURE__ */
|
|
1271
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsxs5(Text6, { children: [
|
|
1223
1272
|
"Type ",
|
|
1224
|
-
/* @__PURE__ */
|
|
1273
|
+
/* @__PURE__ */ jsx6(Text6, { color: "yellow", bold: true, children: deleteCode }),
|
|
1225
1274
|
" to confirm."
|
|
1226
1275
|
] }) }),
|
|
1227
|
-
!deleteConfirmStage && /* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1230
|
-
|
|
1276
|
+
!deleteConfirmStage && /* @__PURE__ */ jsxs5(Box5, { marginTop: 1, children: [
|
|
1277
|
+
/* @__PURE__ */ jsx6(Text6, { children: "Confirm code: " }),
|
|
1278
|
+
/* @__PURE__ */ jsx6(
|
|
1279
|
+
TextInput2,
|
|
1231
1280
|
{
|
|
1232
1281
|
value: typedCode,
|
|
1233
1282
|
onChange: (v) => {
|
|
@@ -1253,11 +1302,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1253
1302
|
}
|
|
1254
1303
|
)
|
|
1255
1304
|
] }),
|
|
1256
|
-
deleteConfirmStage && /* @__PURE__ */
|
|
1257
|
-
/* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
1259
|
-
/* @__PURE__ */
|
|
1260
|
-
|
|
1305
|
+
deleteConfirmStage && /* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "column", children: [
|
|
1306
|
+
/* @__PURE__ */ jsx6(Text6, { color: "red", children: "This action will permanently delete the repository. This cannot be undone." }),
|
|
1307
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
1308
|
+
/* @__PURE__ */ jsx6(
|
|
1309
|
+
Box5,
|
|
1261
1310
|
{
|
|
1262
1311
|
borderStyle: "round",
|
|
1263
1312
|
borderColor: "red",
|
|
@@ -1266,11 +1315,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1266
1315
|
alignItems: "center",
|
|
1267
1316
|
justifyContent: "center",
|
|
1268
1317
|
flexDirection: "column",
|
|
1269
|
-
children: /* @__PURE__ */
|
|
1318
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: confirmFocus === "delete" ? chalk3.bgRed.white.bold(" Delete ") : chalk3.red.bold("Delete") })
|
|
1270
1319
|
}
|
|
1271
1320
|
),
|
|
1272
|
-
/* @__PURE__ */
|
|
1273
|
-
|
|
1321
|
+
/* @__PURE__ */ jsx6(
|
|
1322
|
+
Box5,
|
|
1274
1323
|
{
|
|
1275
1324
|
borderStyle: "round",
|
|
1276
1325
|
borderColor: confirmFocus === "cancel" ? "white" : "gray",
|
|
@@ -1279,17 +1328,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1279
1328
|
alignItems: "center",
|
|
1280
1329
|
justifyContent: "center",
|
|
1281
1330
|
flexDirection: "column",
|
|
1282
|
-
children: /* @__PURE__ */
|
|
1331
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: confirmFocus === "cancel" ? chalk3.bgGray.white.bold(" Cancel ") : chalk3.gray.bold("Cancel") })
|
|
1283
1332
|
}
|
|
1284
1333
|
)
|
|
1285
1334
|
] }),
|
|
1286
|
-
/* @__PURE__ */
|
|
1335
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1287
1336
|
"Press Enter to ",
|
|
1288
1337
|
confirmFocus === "delete" ? "Delete" : "Cancel",
|
|
1289
1338
|
" \u2022 Y to confirm \u2022 C to cancel"
|
|
1290
1339
|
] }) }),
|
|
1291
|
-
/* @__PURE__ */
|
|
1292
|
-
|
|
1340
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(
|
|
1341
|
+
TextInput2,
|
|
1293
1342
|
{
|
|
1294
1343
|
value: "",
|
|
1295
1344
|
onChange: () => {
|
|
@@ -1302,18 +1351,18 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1302
1351
|
}
|
|
1303
1352
|
) })
|
|
1304
1353
|
] }),
|
|
1305
|
-
deleteError && /* @__PURE__ */
|
|
1306
|
-
deleting && /* @__PURE__ */
|
|
1354
|
+
deleteError && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "magenta", children: deleteError }) }),
|
|
1355
|
+
deleting && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "yellow", children: "Deleting..." }) })
|
|
1307
1356
|
] }) })
|
|
1308
|
-
) : archiveMode && archiveTarget ? /* @__PURE__ */
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1311
|
-
/* @__PURE__ */
|
|
1312
|
-
/* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
|
|
1357
|
+
) : archiveMode && archiveTarget ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: archiveTarget.isArchived ? "green" : "yellow", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1358
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: archiveTarget.isArchived ? "Unarchive Confirmation" : "Archive Confirmation" }),
|
|
1359
|
+
/* @__PURE__ */ jsx6(Text6, { color: archiveTarget.isArchived ? "green" : "yellow", children: archiveTarget.isArchived ? "\u21BA Unarchive repository?" : "\u26A0\uFE0F Archive repository?" }),
|
|
1360
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1361
|
+
/* @__PURE__ */ jsx6(Text6, { children: archiveTarget.nameWithOwner }),
|
|
1362
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { children: archiveTarget.isArchived ? "This will make the repository active again." : "This will make the repository read-only." }) }),
|
|
1363
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
1364
|
+
/* @__PURE__ */ jsx6(
|
|
1365
|
+
Box5,
|
|
1317
1366
|
{
|
|
1318
1367
|
borderStyle: "round",
|
|
1319
1368
|
borderColor: archiveTarget.isArchived ? "green" : "yellow",
|
|
@@ -1322,11 +1371,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1322
1371
|
alignItems: "center",
|
|
1323
1372
|
justifyContent: "center",
|
|
1324
1373
|
flexDirection: "column",
|
|
1325
|
-
children: /* @__PURE__ */
|
|
1374
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: archiveFocus === "confirm" ? chalk3.bgGreen.white.bold(` ${archiveTarget.isArchived ? "Unarchive" : "Archive"} `) : chalk3.bold[archiveTarget.isArchived ? "green" : "yellow"](archiveTarget.isArchived ? "Unarchive" : "Archive") })
|
|
1326
1375
|
}
|
|
1327
1376
|
),
|
|
1328
|
-
/* @__PURE__ */
|
|
1329
|
-
|
|
1377
|
+
/* @__PURE__ */ jsx6(
|
|
1378
|
+
Box5,
|
|
1330
1379
|
{
|
|
1331
1380
|
borderStyle: "round",
|
|
1332
1381
|
borderColor: archiveFocus === "cancel" ? "white" : "gray",
|
|
@@ -1335,17 +1384,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1335
1384
|
alignItems: "center",
|
|
1336
1385
|
justifyContent: "center",
|
|
1337
1386
|
flexDirection: "column",
|
|
1338
|
-
children: /* @__PURE__ */
|
|
1387
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: archiveFocus === "cancel" ? chalk3.bgGray.white.bold(" Cancel ") : chalk3.gray.bold("Cancel") })
|
|
1339
1388
|
}
|
|
1340
1389
|
)
|
|
1341
1390
|
] }),
|
|
1342
|
-
/* @__PURE__ */
|
|
1391
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1343
1392
|
"Press Enter to ",
|
|
1344
1393
|
archiveFocus === "confirm" ? archiveTarget.isArchived ? "Unarchive" : "Archive" : "Cancel",
|
|
1345
1394
|
" \u2022 Y to confirm \u2022 C to cancel"
|
|
1346
1395
|
] }) }),
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
|
|
1396
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(
|
|
1397
|
+
TextInput2,
|
|
1349
1398
|
{
|
|
1350
1399
|
value: "",
|
|
1351
1400
|
onChange: () => {
|
|
@@ -1359,7 +1408,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1359
1408
|
const id = archiveTarget.id;
|
|
1360
1409
|
if (isArchived) await unarchiveRepositoryById(client, id);
|
|
1361
1410
|
else await archiveRepositoryById(client, id);
|
|
1362
|
-
|
|
1411
|
+
const updateRepo = (r) => r.id === id ? { ...r, isArchived: !isArchived } : r;
|
|
1412
|
+
setItems((prev) => prev.map(updateRepo));
|
|
1413
|
+
setSearchItems((prev) => prev.map(updateRepo));
|
|
1363
1414
|
closeArchiveModal();
|
|
1364
1415
|
} catch (e) {
|
|
1365
1416
|
setArchiving(false);
|
|
@@ -1372,21 +1423,21 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1372
1423
|
}
|
|
1373
1424
|
}
|
|
1374
1425
|
) }),
|
|
1375
|
-
archiveError && /* @__PURE__ */
|
|
1376
|
-
archiving && /* @__PURE__ */
|
|
1377
|
-
] }) }) : syncMode && syncTarget ? /* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
-
/* @__PURE__ */
|
|
1382
|
-
syncTarget.parent && /* @__PURE__ */
|
|
1426
|
+
archiveError && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "magenta", children: archiveError }) }),
|
|
1427
|
+
archiving && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "yellow", children: archiveTarget.isArchived ? "Unarchiving..." : "Archiving..." }) })
|
|
1428
|
+
] }) }) : syncMode && syncTarget ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: "blue", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1429
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Sync Fork Confirmation" }),
|
|
1430
|
+
/* @__PURE__ */ jsx6(Text6, { color: "blue", children: "\u27F2 Sync fork with upstream?" }),
|
|
1431
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1432
|
+
/* @__PURE__ */ jsx6(Text6, { children: syncTarget.nameWithOwner }),
|
|
1433
|
+
syncTarget.parent && /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1383
1434
|
"Upstream: ",
|
|
1384
1435
|
syncTarget.parent.nameWithOwner
|
|
1385
1436
|
] }),
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
1388
|
-
/* @__PURE__ */
|
|
1389
|
-
|
|
1437
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { children: "This will merge upstream changes into your fork." }) }),
|
|
1438
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
1439
|
+
/* @__PURE__ */ jsx6(
|
|
1440
|
+
Box5,
|
|
1390
1441
|
{
|
|
1391
1442
|
borderStyle: "round",
|
|
1392
1443
|
borderColor: "blue",
|
|
@@ -1395,11 +1446,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1395
1446
|
alignItems: "center",
|
|
1396
1447
|
justifyContent: "center",
|
|
1397
1448
|
flexDirection: "column",
|
|
1398
|
-
children: /* @__PURE__ */
|
|
1449
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: syncFocus === "confirm" ? chalk3.bgBlue.white.bold(" Sync ") : chalk3.blue.bold("Sync") })
|
|
1399
1450
|
}
|
|
1400
1451
|
),
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
|
|
1452
|
+
/* @__PURE__ */ jsx6(
|
|
1453
|
+
Box5,
|
|
1403
1454
|
{
|
|
1404
1455
|
borderStyle: "round",
|
|
1405
1456
|
borderColor: syncFocus === "cancel" ? "white" : "gray",
|
|
@@ -1408,17 +1459,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1408
1459
|
alignItems: "center",
|
|
1409
1460
|
justifyContent: "center",
|
|
1410
1461
|
flexDirection: "column",
|
|
1411
|
-
children: /* @__PURE__ */
|
|
1462
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: syncFocus === "cancel" ? chalk3.bgGray.white.bold(" Cancel ") : chalk3.gray.bold("Cancel") })
|
|
1412
1463
|
}
|
|
1413
1464
|
)
|
|
1414
1465
|
] }),
|
|
1415
|
-
/* @__PURE__ */
|
|
1466
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1416
1467
|
"Press Enter to ",
|
|
1417
1468
|
syncFocus === "confirm" ? "Sync" : "Cancel",
|
|
1418
1469
|
" \u2022 y to confirm \u2022 c to cancel"
|
|
1419
1470
|
] }) }),
|
|
1420
|
-
/* @__PURE__ */
|
|
1421
|
-
|
|
1471
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(
|
|
1472
|
+
TextInput2,
|
|
1422
1473
|
{
|
|
1423
1474
|
value: "",
|
|
1424
1475
|
onChange: () => {
|
|
@@ -1430,7 +1481,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1430
1481
|
setSyncing(true);
|
|
1431
1482
|
const [owner, repo] = syncTarget.nameWithOwner.split("/");
|
|
1432
1483
|
const result = await syncForkWithUpstream(token, owner, repo);
|
|
1433
|
-
|
|
1484
|
+
const updateSyncedRepo = (r) => {
|
|
1434
1485
|
if (r.id === syncTarget.id && r.parent && r.defaultBranchRef?.target?.history && r.parent.defaultBranchRef?.target?.history) {
|
|
1435
1486
|
return {
|
|
1436
1487
|
...r,
|
|
@@ -1446,7 +1497,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1446
1497
|
};
|
|
1447
1498
|
}
|
|
1448
1499
|
return r;
|
|
1449
|
-
}
|
|
1500
|
+
};
|
|
1501
|
+
setItems((prev) => prev.map(updateSyncedRepo));
|
|
1502
|
+
setSearchItems((prev) => prev.map(updateSyncedRepo));
|
|
1450
1503
|
closeSyncModal();
|
|
1451
1504
|
} catch (e) {
|
|
1452
1505
|
setSyncing(false);
|
|
@@ -1459,14 +1512,14 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1459
1512
|
}
|
|
1460
1513
|
}
|
|
1461
1514
|
) }),
|
|
1462
|
-
syncError && /* @__PURE__ */
|
|
1463
|
-
syncing && /* @__PURE__ */
|
|
1464
|
-
] }) }) : logoutMode ? /* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1466
|
-
/* @__PURE__ */
|
|
1467
|
-
/* @__PURE__ */
|
|
1468
|
-
/* @__PURE__ */
|
|
1469
|
-
|
|
1515
|
+
syncError && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "magenta", children: syncError }) }),
|
|
1516
|
+
syncing && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "yellow", children: "Syncing..." }) })
|
|
1517
|
+
] }) }) : logoutMode ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1518
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Logout Confirmation" }),
|
|
1519
|
+
/* @__PURE__ */ jsx6(Text6, { color: "cyan", children: "Are you sure you want to log out?" }),
|
|
1520
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
1521
|
+
/* @__PURE__ */ jsx6(
|
|
1522
|
+
Box5,
|
|
1470
1523
|
{
|
|
1471
1524
|
borderStyle: "round",
|
|
1472
1525
|
borderColor: "cyan",
|
|
@@ -1475,11 +1528,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1475
1528
|
alignItems: "center",
|
|
1476
1529
|
justifyContent: "center",
|
|
1477
1530
|
flexDirection: "column",
|
|
1478
|
-
children: /* @__PURE__ */
|
|
1531
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: logoutFocus === "confirm" ? chalk3.bgCyan.white.bold(" Logout ") : chalk3.cyan.bold("Logout") })
|
|
1479
1532
|
}
|
|
1480
1533
|
),
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
|
|
1534
|
+
/* @__PURE__ */ jsx6(
|
|
1535
|
+
Box5,
|
|
1483
1536
|
{
|
|
1484
1537
|
borderStyle: "round",
|
|
1485
1538
|
borderColor: logoutFocus === "cancel" ? "white" : "gray",
|
|
@@ -1488,16 +1541,16 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1488
1541
|
alignItems: "center",
|
|
1489
1542
|
justifyContent: "center",
|
|
1490
1543
|
flexDirection: "column",
|
|
1491
|
-
children: /* @__PURE__ */
|
|
1544
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: logoutFocus === "cancel" ? chalk3.bgGray.white.bold(" Cancel ") : chalk3.gray.bold("Cancel") })
|
|
1492
1545
|
}
|
|
1493
1546
|
)
|
|
1494
1547
|
] }),
|
|
1495
|
-
/* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1496
1549
|
"Press Enter to ",
|
|
1497
1550
|
logoutFocus === "confirm" ? "Logout" : "Cancel",
|
|
1498
1551
|
" \u2022 Y to confirm \u2022 C to cancel"
|
|
1499
1552
|
] }) })
|
|
1500
|
-
] }) }) : orgSwitcherOpen ? /* @__PURE__ */
|
|
1553
|
+
] }) }) : orgSwitcherOpen ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx6(
|
|
1501
1554
|
OrgSwitcher,
|
|
1502
1555
|
{
|
|
1503
1556
|
token,
|
|
@@ -1505,75 +1558,75 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1505
1558
|
onSelect: handleOrgContextChange,
|
|
1506
1559
|
onClose: () => setOrgSwitcherOpen(false)
|
|
1507
1560
|
}
|
|
1508
|
-
) }) : infoMode ? /* @__PURE__ */
|
|
1561
|
+
) }) : infoMode ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: (() => {
|
|
1509
1562
|
const repo = visibleItems[cursor];
|
|
1510
|
-
if (!repo) return /* @__PURE__ */
|
|
1563
|
+
if (!repo) return /* @__PURE__ */ jsx6(Text6, { color: "red", children: "No repository selected." });
|
|
1511
1564
|
const langName = repo.primaryLanguage?.name || "N/A";
|
|
1512
1565
|
const langColor = repo.primaryLanguage?.color || "#666666";
|
|
1513
|
-
return /* @__PURE__ */
|
|
1514
|
-
/* @__PURE__ */
|
|
1515
|
-
/* @__PURE__ */
|
|
1516
|
-
/* @__PURE__ */
|
|
1517
|
-
repo.description && /* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
repo.isPrivate ?
|
|
1521
|
-
repo.isArchived ?
|
|
1522
|
-
repo.isFork ?
|
|
1566
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 90), children: [
|
|
1567
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Repository Info" }),
|
|
1568
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1569
|
+
/* @__PURE__ */ jsx6(Text6, { children: chalk3.bold(repo.nameWithOwner) }),
|
|
1570
|
+
repo.description && /* @__PURE__ */ jsx6(Text6, { color: "gray", children: repo.description }),
|
|
1571
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1572
|
+
/* @__PURE__ */ jsxs5(Text6, { children: [
|
|
1573
|
+
repo.isPrivate ? chalk3.yellow("Private") : chalk3.green("Public"),
|
|
1574
|
+
repo.isArchived ? chalk3.gray(" Archived") : "",
|
|
1575
|
+
repo.isFork ? chalk3.blue(" Fork") : ""
|
|
1523
1576
|
] }),
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1526
|
-
|
|
1527
|
-
|
|
1577
|
+
/* @__PURE__ */ jsx6(Text6, { children: chalk3.gray(`\u2605 ${repo.stargazerCount} \u2442 ${repo.forkCount}`) }),
|
|
1578
|
+
/* @__PURE__ */ jsxs5(Text6, { children: [
|
|
1579
|
+
chalk3.hex(langColor)(`\u25CF `),
|
|
1580
|
+
chalk3.gray(`${langName}`)
|
|
1528
1581
|
] }),
|
|
1529
|
-
/* @__PURE__ */
|
|
1582
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1530
1583
|
"Updated: ",
|
|
1531
1584
|
formatDate(repo.updatedAt),
|
|
1532
1585
|
" \u2022 Pushed: ",
|
|
1533
1586
|
formatDate(repo.pushedAt)
|
|
1534
1587
|
] }),
|
|
1535
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1536
1589
|
"Size: ",
|
|
1537
1590
|
repo.diskUsage,
|
|
1538
1591
|
" KB"
|
|
1539
1592
|
] }),
|
|
1540
|
-
/* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1594
|
+
/* @__PURE__ */ jsx6(Text6, { color: "gray", children: "Press Esc or I to close" })
|
|
1542
1595
|
] });
|
|
1543
|
-
})() }) : /* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1596
|
+
})() }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1597
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 2, marginBottom: 1, children: [
|
|
1598
|
+
/* @__PURE__ */ jsx6(Text6, { color: "cyan", bold: true, children: ownerContext === "personal" ? "Personal Account" : `Organization: ${ownerContext.name || ownerContext.login}` }),
|
|
1599
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", dimColor: true, children: [
|
|
1547
1600
|
"Sort: ",
|
|
1548
1601
|
sortKey,
|
|
1549
1602
|
" ",
|
|
1550
1603
|
sortDir === "asc" ? "\u2191" : "\u2193"
|
|
1551
1604
|
] }),
|
|
1552
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", dimColor: true, children: [
|
|
1553
1606
|
"Forks - Commits Behind: ",
|
|
1554
1607
|
forkTracking ? "ON" : "OFF"
|
|
1555
1608
|
] }),
|
|
1556
|
-
filter && !searchActive && /* @__PURE__ */
|
|
1609
|
+
filter && !searchActive && /* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
|
|
1557
1610
|
'Filter: "',
|
|
1558
1611
|
filter,
|
|
1559
1612
|
'"'
|
|
1560
1613
|
] }),
|
|
1561
|
-
searchActive && /* @__PURE__ */
|
|
1562
|
-
/* @__PURE__ */
|
|
1614
|
+
searchActive && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1615
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
|
|
1563
1616
|
'Search: "',
|
|
1564
1617
|
filter.trim(),
|
|
1565
1618
|
'"'
|
|
1566
1619
|
] }),
|
|
1567
|
-
searchLoading && /* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1620
|
+
searchLoading && /* @__PURE__ */ jsx6(Box5, { marginLeft: 1, children: /* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
|
|
1621
|
+
/* @__PURE__ */ jsx6(SlowSpinner, {}),
|
|
1569
1622
|
" Searching\u2026"
|
|
1570
1623
|
] }) })
|
|
1571
1624
|
] })
|
|
1572
1625
|
] }),
|
|
1573
|
-
filterMode && /* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
|
|
1626
|
+
filterMode && /* @__PURE__ */ jsxs5(Box5, { marginBottom: 1, children: [
|
|
1627
|
+
/* @__PURE__ */ jsx6(Text6, { children: "Filter: " }),
|
|
1628
|
+
/* @__PURE__ */ jsx6(
|
|
1629
|
+
TextInput2,
|
|
1577
1630
|
{
|
|
1578
1631
|
value: filter,
|
|
1579
1632
|
onChange: (val) => {
|
|
@@ -1612,10 +1665,10 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1612
1665
|
}
|
|
1613
1666
|
)
|
|
1614
1667
|
] }),
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
-
filterMode && filter.trim().length > 0 && filter.trim().length < 3 ? /* @__PURE__ */
|
|
1668
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", height: listHeight, children: [
|
|
1669
|
+
filterMode && filter.trim().length > 0 && filter.trim().length < 3 ? /* @__PURE__ */ jsx6(Box5, { justifyContent: "center", alignItems: "center", flexGrow: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: true, children: "Type at least 3 characters to search" }) }) : visibleItems.slice(windowed.start, windowed.end).map((repo, i) => {
|
|
1617
1670
|
const idx = windowed.start + i;
|
|
1618
|
-
return /* @__PURE__ */
|
|
1671
|
+
return /* @__PURE__ */ jsx6(
|
|
1619
1672
|
RepoRow,
|
|
1620
1673
|
{
|
|
1621
1674
|
repo,
|
|
@@ -1628,43 +1681,43 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1628
1681
|
repo.nameWithOwner
|
|
1629
1682
|
);
|
|
1630
1683
|
}),
|
|
1631
|
-
loadingMore && hasNextPage && /* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1633
|
-
/* @__PURE__ */
|
|
1684
|
+
loadingMore && hasNextPage && /* @__PURE__ */ jsx6(Box5, { justifyContent: "center", alignItems: "center", marginTop: 1, children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", children: [
|
|
1685
|
+
/* @__PURE__ */ jsx6(Box5, { width: 2, flexShrink: 0, flexGrow: 0, marginRight: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "cyan", children: /* @__PURE__ */ jsx6(SlowSpinner, {}) }) }),
|
|
1686
|
+
/* @__PURE__ */ jsx6(Text6, { color: "cyan", children: "Loading more repositories..." })
|
|
1634
1687
|
] }) }),
|
|
1635
|
-
!loading && !searchLoading && visibleItems.length === 0 && /* @__PURE__ */
|
|
1688
|
+
!loading && !searchLoading && visibleItems.length === 0 && /* @__PURE__ */ jsx6(Box5, { justifyContent: "center", alignItems: "center", flexGrow: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: true, children: searchActive ? "No repositories match your search" : filter ? "No repositories match your filter" : "No repositories found" }) })
|
|
1636
1689
|
] })
|
|
1637
1690
|
] }) }),
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1691
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, paddingX: 1, flexDirection: "column", children: [
|
|
1692
|
+
/* @__PURE__ */ jsx6(Box5, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: modalOpen ? true : void 0, children: "\u2191\u2193 Navigate \u2022 Ctrl+G Top \u2022 G Bottom \u2022 / Filter \u2022 W Org Switcher \u2022 S Sort \u2022 D Direction \u2022 T Density \u2022 F Forks \u2022 \u23CE/O Open" }) }),
|
|
1693
|
+
/* @__PURE__ */ jsx6(Box5, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: modalOpen ? true : void 0, children: "Del/Ctrl+Backspace Delete \u2022 Ctrl+A Un/Archive \u2022 Ctrl+U Sync Fork \u2022 I Info \u2022 Ctrl+I Cache \u2022 Ctrl+L Logout \u2022 R Refresh \u2022 Q Quit" }) })
|
|
1641
1694
|
] }),
|
|
1642
|
-
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */
|
|
1643
|
-
/* @__PURE__ */
|
|
1644
|
-
debugMessages.length === 0 ? /* @__PURE__ */
|
|
1695
|
+
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */ jsxs5(Box5, { marginTop: 1, borderStyle: "single", borderColor: "yellow", paddingX: 1, flexDirection: "column", children: [
|
|
1696
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, color: "yellow", children: "Debug Messages:" }),
|
|
1697
|
+
debugMessages.length === 0 ? /* @__PURE__ */ jsx6(Text6, { color: "gray", children: "No debug messages yet..." }) : debugMessages.map((msg, i) => /* @__PURE__ */ jsx6(Text6, { color: "gray", children: msg }, i))
|
|
1645
1698
|
] })
|
|
1646
1699
|
] });
|
|
1647
1700
|
}
|
|
1648
1701
|
|
|
1649
1702
|
// src/ui/App.tsx
|
|
1650
|
-
import { jsx as
|
|
1703
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1651
1704
|
var packageJson = require_package();
|
|
1652
1705
|
function App() {
|
|
1653
1706
|
const { exit } = useApp2();
|
|
1654
1707
|
const { stdout } = useStdout2();
|
|
1655
|
-
const [mode, setMode] =
|
|
1656
|
-
const [token, setToken] =
|
|
1657
|
-
const [input, setInput] =
|
|
1658
|
-
const [error, setError] =
|
|
1659
|
-
const [viewer, setViewer] =
|
|
1660
|
-
const [rateLimitReset, setRateLimitReset] =
|
|
1661
|
-
const [orgContext, setOrgContext] =
|
|
1662
|
-
const [dims, setDims] =
|
|
1708
|
+
const [mode, setMode] = useState4("checking");
|
|
1709
|
+
const [token, setToken] = useState4(null);
|
|
1710
|
+
const [input, setInput] = useState4("");
|
|
1711
|
+
const [error, setError] = useState4(null);
|
|
1712
|
+
const [viewer, setViewer] = useState4(null);
|
|
1713
|
+
const [rateLimitReset, setRateLimitReset] = useState4(null);
|
|
1714
|
+
const [orgContext, setOrgContext] = useState4("personal");
|
|
1715
|
+
const [dims, setDims] = useState4(() => {
|
|
1663
1716
|
const cols = stdout?.columns ?? 100;
|
|
1664
1717
|
const rows = stdout?.rows ?? 30;
|
|
1665
1718
|
return { cols, rows };
|
|
1666
1719
|
});
|
|
1667
|
-
|
|
1720
|
+
useEffect4(() => {
|
|
1668
1721
|
if (!stdout) return;
|
|
1669
1722
|
const onResize = () => {
|
|
1670
1723
|
const cols = stdout.columns ?? 100;
|
|
@@ -1676,7 +1729,7 @@ function App() {
|
|
|
1676
1729
|
stdout.off?.("resize", onResize);
|
|
1677
1730
|
};
|
|
1678
1731
|
}, [stdout]);
|
|
1679
|
-
|
|
1732
|
+
useEffect4(() => {
|
|
1680
1733
|
const env = getTokenFromEnv();
|
|
1681
1734
|
const stored = getStoredToken();
|
|
1682
1735
|
if (env) {
|
|
@@ -1689,7 +1742,7 @@ function App() {
|
|
|
1689
1742
|
setMode("prompt");
|
|
1690
1743
|
}
|
|
1691
1744
|
}, []);
|
|
1692
|
-
|
|
1745
|
+
useEffect4(() => {
|
|
1693
1746
|
(async () => {
|
|
1694
1747
|
if (mode !== "validating" || !token) return;
|
|
1695
1748
|
const timeoutId = setTimeout(() => {
|
|
@@ -1800,19 +1853,19 @@ function App() {
|
|
|
1800
1853
|
}
|
|
1801
1854
|
});
|
|
1802
1855
|
const verticalPadding = Math.floor(dims.rows * 0.15);
|
|
1803
|
-
const header = useMemo2(() => /* @__PURE__ */
|
|
1804
|
-
/* @__PURE__ */
|
|
1805
|
-
/* @__PURE__ */
|
|
1856
|
+
const header = useMemo2(() => /* @__PURE__ */ jsxs6(Box6, { flexDirection: "row", justifyContent: "space-between", marginBottom: 1, children: [
|
|
1857
|
+
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "row", gap: 1, children: [
|
|
1858
|
+
/* @__PURE__ */ jsxs6(Text7, { bold: true, color: "cyan", children: [
|
|
1806
1859
|
" ",
|
|
1807
1860
|
"GitHub Repository Manager"
|
|
1808
1861
|
] }),
|
|
1809
|
-
/* @__PURE__ */
|
|
1862
|
+
/* @__PURE__ */ jsxs6(Text7, { color: "gray", dimColor: true, children: [
|
|
1810
1863
|
"v",
|
|
1811
1864
|
packageJson.version
|
|
1812
1865
|
] }),
|
|
1813
|
-
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */
|
|
1866
|
+
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */ jsx7(Text7, { backgroundColor: "blue", color: "white", children: " debug mode " })
|
|
1814
1867
|
] }),
|
|
1815
|
-
viewer && /* @__PURE__ */
|
|
1868
|
+
viewer && /* @__PURE__ */ jsx7(Text7, { color: "gray", children: orgContext !== "personal" && orgContext.login ? `${orgContext.login}/@${viewer} ` : `@${viewer} ` })
|
|
1816
1869
|
] }), [viewer, orgContext]);
|
|
1817
1870
|
if (mode === "rate_limited") {
|
|
1818
1871
|
const formatResetTime = (resetTime) => {
|
|
@@ -1835,56 +1888,56 @@ function App() {
|
|
|
1835
1888
|
return "Unknown";
|
|
1836
1889
|
}
|
|
1837
1890
|
};
|
|
1838
|
-
return /* @__PURE__ */
|
|
1891
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
1839
1892
|
header,
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
rateLimitReset && /* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
1893
|
+
/* @__PURE__ */ jsx7(Box6, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs6(Box6, { borderStyle: "single", borderColor: "yellow", paddingX: 3, paddingY: 2, flexDirection: "column", width: Math.min(dims.cols - 8, 80), children: [
|
|
1894
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: "yellow", marginBottom: 1, children: "\u26A0\uFE0F Rate Limit Exceeded" }),
|
|
1895
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", marginBottom: 1, children: "You've hit GitHub's API rate limit for your token." }),
|
|
1896
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", marginBottom: 1, children: "This happens when you make too many requests in a short time." }),
|
|
1897
|
+
rateLimitReset && /* @__PURE__ */ jsxs6(Box6, { marginTop: 1, marginBottom: 1, children: [
|
|
1898
|
+
/* @__PURE__ */ jsxs6(Text7, { children: [
|
|
1899
|
+
/* @__PURE__ */ jsx7(Text7, { color: "cyan", children: "Reset in:" }),
|
|
1847
1900
|
" ",
|
|
1848
|
-
/* @__PURE__ */
|
|
1901
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: formatResetTime(rateLimitReset) })
|
|
1849
1902
|
] }),
|
|
1850
|
-
/* @__PURE__ */
|
|
1903
|
+
/* @__PURE__ */ jsxs6(Text7, { color: "gray", dimColor: true, children: [
|
|
1851
1904
|
"(",
|
|
1852
1905
|
new Date(rateLimitReset).toLocaleTimeString(),
|
|
1853
1906
|
")"
|
|
1854
1907
|
] })
|
|
1855
1908
|
] }),
|
|
1856
|
-
/* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
1859
|
-
/* @__PURE__ */
|
|
1860
|
-
/* @__PURE__ */
|
|
1909
|
+
/* @__PURE__ */ jsxs6(Box6, { marginTop: 2, flexDirection: "column", gap: 1, children: [
|
|
1910
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "What would you like to do?" }),
|
|
1911
|
+
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingLeft: 2, children: [
|
|
1912
|
+
/* @__PURE__ */ jsxs6(Text7, { children: [
|
|
1913
|
+
/* @__PURE__ */ jsx7(Text7, { color: "cyan", bold: true, children: "r" }),
|
|
1861
1914
|
" - Retry now ",
|
|
1862
1915
|
rateLimitReset && formatResetTime(rateLimitReset) !== "Now (should be reset)" ? "(likely to fail until reset)" : "(should work now)"
|
|
1863
1916
|
] }),
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
1917
|
+
/* @__PURE__ */ jsxs6(Text7, { children: [
|
|
1918
|
+
/* @__PURE__ */ jsx7(Text7, { color: "cyan", bold: true, children: "l" }),
|
|
1866
1919
|
" - Logout and use a different token"
|
|
1867
1920
|
] }),
|
|
1868
|
-
/* @__PURE__ */
|
|
1869
|
-
/* @__PURE__ */
|
|
1921
|
+
/* @__PURE__ */ jsxs6(Text7, { children: [
|
|
1922
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", bold: true, children: "q/Esc" }),
|
|
1870
1923
|
" - Quit application"
|
|
1871
1924
|
] })
|
|
1872
1925
|
] })
|
|
1873
1926
|
] }),
|
|
1874
|
-
/* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, marginTop: 2, children: "Tip: Using multiple tokens or waiting between requests can help avoid rate limits." })
|
|
1875
1928
|
] }) })
|
|
1876
1929
|
] });
|
|
1877
1930
|
}
|
|
1878
1931
|
if (mode === "prompt") {
|
|
1879
|
-
return /* @__PURE__ */
|
|
1932
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
1880
1933
|
header,
|
|
1881
|
-
/* @__PURE__ */
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
/* @__PURE__ */
|
|
1887
|
-
|
|
1934
|
+
/* @__PURE__ */ jsx7(Box6, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs6(Box6, { borderStyle: "single", borderColor: "cyan", paddingX: 2, paddingY: 1, flexDirection: "column", children: [
|
|
1935
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, marginBottom: 1, children: "Authentication Required" }),
|
|
1936
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", marginBottom: 1, children: "Enter your GitHub Personal Access Token" }),
|
|
1937
|
+
/* @__PURE__ */ jsxs6(Box6, { children: [
|
|
1938
|
+
/* @__PURE__ */ jsx7(Text7, { children: "Token: " }),
|
|
1939
|
+
/* @__PURE__ */ jsx7(
|
|
1940
|
+
TextInput3,
|
|
1888
1941
|
{
|
|
1889
1942
|
value: input,
|
|
1890
1943
|
onChange: setInput,
|
|
@@ -1893,30 +1946,30 @@ function App() {
|
|
|
1893
1946
|
}
|
|
1894
1947
|
)
|
|
1895
1948
|
] }),
|
|
1896
|
-
error && /* @__PURE__ */
|
|
1897
|
-
/* @__PURE__ */
|
|
1898
|
-
/* @__PURE__ */
|
|
1949
|
+
error && /* @__PURE__ */ jsx7(Text7, { color: "red", marginTop: 1, children: error }),
|
|
1950
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, marginTop: 1, children: "The token will be stored securely in your local config" }),
|
|
1951
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, marginTop: 1, children: "Press Esc to quit" })
|
|
1899
1952
|
] }) })
|
|
1900
1953
|
] });
|
|
1901
1954
|
}
|
|
1902
1955
|
if (mode === "validating" || mode === "checking") {
|
|
1903
|
-
return /* @__PURE__ */
|
|
1956
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
1904
1957
|
header,
|
|
1905
|
-
/* @__PURE__ */
|
|
1906
|
-
/* @__PURE__ */
|
|
1907
|
-
mode === "validating" && /* @__PURE__ */
|
|
1958
|
+
/* @__PURE__ */ jsx7(Box6, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", alignItems: "center", children: [
|
|
1959
|
+
/* @__PURE__ */ jsx7(Text7, { color: "yellow", children: "Validating token..." }),
|
|
1960
|
+
mode === "validating" && /* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, marginTop: 1, children: "Press Esc to cancel" })
|
|
1908
1961
|
] }) })
|
|
1909
1962
|
] });
|
|
1910
1963
|
}
|
|
1911
1964
|
if (mode === "error") {
|
|
1912
|
-
return /* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
1913
1966
|
header,
|
|
1914
|
-
/* @__PURE__ */
|
|
1967
|
+
/* @__PURE__ */ jsx7(Box6, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx7(Text7, { color: "red", children: error ?? "Unexpected error" }) })
|
|
1915
1968
|
] });
|
|
1916
1969
|
}
|
|
1917
|
-
return /* @__PURE__ */
|
|
1970
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
1918
1971
|
header,
|
|
1919
|
-
/* @__PURE__ */
|
|
1972
|
+
/* @__PURE__ */ jsx7(
|
|
1920
1973
|
RepoList,
|
|
1921
1974
|
{
|
|
1922
1975
|
token,
|
|
@@ -1930,7 +1983,7 @@ function App() {
|
|
|
1930
1983
|
}
|
|
1931
1984
|
|
|
1932
1985
|
// src/index.tsx
|
|
1933
|
-
import { jsx as
|
|
1986
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1934
1987
|
if (process.env.GH_MANAGER_DEBUG === "1") {
|
|
1935
1988
|
process.stderr.write("\u{1F41B} Debug mode enabled\n");
|
|
1936
1989
|
}
|
|
@@ -1943,8 +1996,8 @@ process.on("unhandledRejection", (reason) => {
|
|
|
1943
1996
|
process.exit(1);
|
|
1944
1997
|
});
|
|
1945
1998
|
render(
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
2000
|
+
/* @__PURE__ */ jsx8(App, {}),
|
|
2001
|
+
/* @__PURE__ */ jsx8(Text8, { color: "gray" })
|
|
1949
2002
|
] })
|
|
1950
2003
|
);
|