gh-manager-cli 1.13.1 → 1.14.0
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 +24 -0
- package/README.md +14 -9
- package/dist/{chunk-BOS4OCY4.js → chunk-OKP742N4.js} +83 -2
- package/dist/{github-GO2ZQWZN.js → github-YDCON2PN.js} +7 -1
- package/dist/index.js +703 -425
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
__commonJS,
|
|
4
4
|
__toESM,
|
|
5
5
|
archiveRepositoryById,
|
|
6
|
+
changeRepositoryVisibility,
|
|
7
|
+
checkOrganizationIsEnterprise,
|
|
6
8
|
deleteRepositoryRest,
|
|
7
9
|
fetchViewerOrganizations,
|
|
8
10
|
fetchViewerReposPageUnified,
|
|
@@ -16,15 +18,16 @@ import {
|
|
|
16
18
|
unarchiveRepositoryById,
|
|
17
19
|
updateCacheAfterArchive,
|
|
18
20
|
updateCacheAfterDelete,
|
|
21
|
+
updateCacheAfterVisibilityChange,
|
|
19
22
|
updateCacheWithRepository
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OKP742N4.js";
|
|
21
24
|
|
|
22
25
|
// package.json
|
|
23
26
|
var require_package = __commonJS({
|
|
24
27
|
"package.json"(exports, module) {
|
|
25
28
|
module.exports = {
|
|
26
29
|
name: "gh-manager-cli",
|
|
27
|
-
version: "1.
|
|
30
|
+
version: "1.14.0",
|
|
28
31
|
private: false,
|
|
29
32
|
description: "Interactive CLI to manage your GitHub repos (personal) with Ink",
|
|
30
33
|
license: "MIT",
|
|
@@ -147,13 +150,13 @@ var require_package = __commonJS({
|
|
|
147
150
|
|
|
148
151
|
// src/index.tsx
|
|
149
152
|
var import_package = __toESM(require_package(), 1);
|
|
150
|
-
import { render, Box as
|
|
153
|
+
import { render, Box as Box15, Text as Text16 } from "ink";
|
|
151
154
|
import "dotenv/config";
|
|
152
155
|
|
|
153
156
|
// src/ui/App.tsx
|
|
154
|
-
import { useEffect as
|
|
155
|
-
import { Box as
|
|
156
|
-
import
|
|
157
|
+
import { useEffect as useEffect8, useMemo as useMemo2, useState as useState11 } from "react";
|
|
158
|
+
import { Box as Box14, Text as Text15, useApp as useApp2, useStdout as useStdout2, useInput as useInput11 } from "ink";
|
|
159
|
+
import TextInput5 from "ink-text-input";
|
|
157
160
|
|
|
158
161
|
// src/config.ts
|
|
159
162
|
import fs from "fs";
|
|
@@ -209,10 +212,10 @@ function storeUIPrefs(patch) {
|
|
|
209
212
|
}
|
|
210
213
|
|
|
211
214
|
// src/ui/RepoList.tsx
|
|
212
|
-
import
|
|
213
|
-
import { Box as
|
|
214
|
-
import
|
|
215
|
-
import
|
|
215
|
+
import React10, { useEffect as useEffect7, useMemo, useState as useState10, useRef } from "react";
|
|
216
|
+
import { Box as Box13, Text as Text14, useApp, useInput as useInput10, useStdout } from "ink";
|
|
217
|
+
import TextInput4 from "ink-text-input";
|
|
218
|
+
import chalk11 from "chalk";
|
|
216
219
|
|
|
217
220
|
// src/apolloMeta.ts
|
|
218
221
|
import fs2 from "fs";
|
|
@@ -282,14 +285,23 @@ function OrgSwitcher({ token, currentContext, onSelect, onClose }) {
|
|
|
282
285
|
const [loading, setLoading] = useState(true);
|
|
283
286
|
const [error, setError] = useState(null);
|
|
284
287
|
const [cursor, setCursor] = useState(0);
|
|
288
|
+
const [enterpriseOrgs, setEnterpriseOrgs] = useState(/* @__PURE__ */ new Set());
|
|
285
289
|
const isPersonalContext = currentContext === "personal";
|
|
286
290
|
useEffect(() => {
|
|
287
291
|
const loadOrgs = async () => {
|
|
288
292
|
try {
|
|
289
293
|
setLoading(true);
|
|
290
|
-
const client = await import("./github-
|
|
294
|
+
const client = await import("./github-YDCON2PN.js").then((m) => m.makeClient(token));
|
|
291
295
|
const orgs = await fetchViewerOrganizations(client);
|
|
292
296
|
setOrganizations(orgs);
|
|
297
|
+
const entOrgs = /* @__PURE__ */ new Set();
|
|
298
|
+
for (const org of orgs) {
|
|
299
|
+
const isEnt = await checkOrganizationIsEnterprise(client, org.login);
|
|
300
|
+
if (isEnt) {
|
|
301
|
+
entOrgs.add(org.login);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
setEnterpriseOrgs(entOrgs);
|
|
293
305
|
if (!isPersonalContext) {
|
|
294
306
|
const orgLogin2 = currentContext.login;
|
|
295
307
|
const index = orgs.findIndex((org) => org.login === orgLogin2);
|
|
@@ -330,14 +342,19 @@ function OrgSwitcher({ token, currentContext, onSelect, onClose }) {
|
|
|
330
342
|
}
|
|
331
343
|
});
|
|
332
344
|
const totalItems = organizations.length + 1;
|
|
333
|
-
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX:
|
|
334
|
-
/* @__PURE__ */ jsx(Text, { bold: true, children: "Switch Account
|
|
335
|
-
loading ? /* @__PURE__ */ jsx(Text, { color: "yellow", children: "Loading
|
|
336
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: cursor === 0 ? chalk.bgCyan.black(" \u2192 ") + " " + chalk.bold("Personal Account") : " " + chalk.gray("Personal Account") }) }),
|
|
337
|
-
organizations.map((org, index) =>
|
|
345
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1, width: 50, children: [
|
|
346
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "Switch Account" }),
|
|
347
|
+
loading ? /* @__PURE__ */ jsx(Text, { color: "yellow", children: "Loading..." }) : error ? /* @__PURE__ */ jsx(Text, { color: "red", children: error }) : /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
|
|
348
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: cursor === 0 ? chalk.bgCyan.black(" \u2192 ") + " " + chalk.bold("Personal Account") + (isPersonalContext ? chalk.green(" \u2713") : "") : " " + chalk.gray("Personal Account") + (isPersonalContext ? chalk.green(" \u2713") : "") }) }),
|
|
349
|
+
organizations.map((org, index) => {
|
|
350
|
+
const isEnterprise = enterpriseOrgs.has(org.login);
|
|
351
|
+
const isCurrent = cursor === index + 1;
|
|
352
|
+
const isActiveContext = !isPersonalContext && currentContext.login === org.login;
|
|
353
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: isCurrent ? chalk.bgCyan.black(" \u2192 ") + " " + chalk.bold(org.name || org.login) + (isEnterprise ? chalk.yellow(" (ENT)") : "") + chalk.gray(` (@${org.login})`) + (isActiveContext ? chalk.green(" \u2713") : "") : " " + chalk.gray(org.name || org.login) + (isEnterprise ? chalk.gray(" (ENT)") : "") + chalk.gray(` (@${org.login})`) + (isActiveContext ? chalk.green(" \u2713") : "") }) }, org.id);
|
|
354
|
+
}),
|
|
338
355
|
organizations.length === 0 && /* @__PURE__ */ jsx(Text, { color: "gray", dimColor: true, children: "No organizations found" })
|
|
339
356
|
] }),
|
|
340
|
-
/* @__PURE__ */ jsx(Box, { marginTop:
|
|
357
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "gray", dimColor: true, children: "\u2191\u2193/Enter \u2022 Esc" }) })
|
|
341
358
|
] });
|
|
342
359
|
}
|
|
343
360
|
|
|
@@ -416,11 +433,11 @@ import chalk7 from "chalk";
|
|
|
416
433
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
417
434
|
function VisibilityModal({
|
|
418
435
|
currentFilter,
|
|
419
|
-
|
|
436
|
+
isEnterprise,
|
|
420
437
|
onSelect,
|
|
421
438
|
onCancel
|
|
422
439
|
}) {
|
|
423
|
-
const options =
|
|
440
|
+
const options = ["all", "public", "private"];
|
|
424
441
|
const [selectedIndex, setSelectedIndex] = useState7(0);
|
|
425
442
|
const [focusedOption, setFocusedOption] = useState7("all");
|
|
426
443
|
useEffect4(() => {
|
|
@@ -488,8 +505,6 @@ function VisibilityModal({
|
|
|
488
505
|
onSelect("public");
|
|
489
506
|
} else if (upperInput === "R") {
|
|
490
507
|
onSelect("private");
|
|
491
|
-
} else if (upperInput === "I" && hasInternalRepos) {
|
|
492
|
-
onSelect("internal");
|
|
493
508
|
}
|
|
494
509
|
}
|
|
495
510
|
});
|
|
@@ -500,9 +515,7 @@ function VisibilityModal({
|
|
|
500
515
|
case "public":
|
|
501
516
|
return "Public Only";
|
|
502
517
|
case "private":
|
|
503
|
-
return "Private Only";
|
|
504
|
-
case "internal":
|
|
505
|
-
return "Internal Only";
|
|
518
|
+
return isEnterprise ? "Private/Internal" : "Private Only";
|
|
506
519
|
}
|
|
507
520
|
};
|
|
508
521
|
const getButtonColor = (filter) => {
|
|
@@ -511,45 +524,20 @@ function VisibilityModal({
|
|
|
511
524
|
}
|
|
512
525
|
return focusedOption === filter ? "cyan" : "gray";
|
|
513
526
|
};
|
|
514
|
-
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX:
|
|
527
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1, width: 45, children: [
|
|
515
528
|
/* @__PURE__ */ jsx8(Text8, { bold: true, children: "Visibility Filter" }),
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
/* @__PURE__ */ jsx8(Text8, { color: focusedOption === option ? "white" : void 0, children: focusedOption === option ? chalk7[getButtonColor(option)].bold(getButtonLabel(option)) : chalk7[getButtonColor(option)](getButtonLabel(option)) }),
|
|
529
|
-
option === currentFilter && /* @__PURE__ */ jsx8(Text8, { color: "green", children: " \u2713 Current" })
|
|
530
|
-
] })
|
|
531
|
-
},
|
|
532
|
-
option
|
|
533
|
-
)) }),
|
|
534
|
-
/* @__PURE__ */ jsx8(Box7, { height: 1, children: /* @__PURE__ */ jsx8(Text8, { children: " " }) }),
|
|
535
|
-
/* @__PURE__ */ jsx8(
|
|
536
|
-
Box7,
|
|
537
|
-
{
|
|
538
|
-
borderStyle: focusedOption === "cancel" ? "round" : "single",
|
|
539
|
-
borderColor: focusedOption === "cancel" ? "white" : "gray",
|
|
540
|
-
paddingX: 2,
|
|
541
|
-
paddingY: 1,
|
|
542
|
-
width: "100%",
|
|
543
|
-
justifyContent: "center",
|
|
544
|
-
children: /* @__PURE__ */ jsx8(Text8, { children: focusedOption === "cancel" ? chalk7.white.bold("Cancel") : chalk7.gray("Cancel") })
|
|
545
|
-
}
|
|
546
|
-
),
|
|
547
|
-
/* @__PURE__ */ jsx8(Box7, { height: 1, children: /* @__PURE__ */ jsx8(Text8, { children: " " }) }),
|
|
548
|
-
/* @__PURE__ */ jsx8(Box7, { flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs7(Text8, { color: "gray", children: [
|
|
549
|
-
"\u2191\u2193 Navigate \u2022 Enter Select \u2022 A All \u2022 P Public \u2022 R Private",
|
|
550
|
-
hasInternalRepos && " \u2022 I Internal",
|
|
551
|
-
" \u2022 C/Esc Cancel"
|
|
552
|
-
] }) })
|
|
529
|
+
/* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
|
|
530
|
+
options.map((option) => /* @__PURE__ */ jsx8(Box7, { paddingX: 1, children: /* @__PURE__ */ jsxs7(Text8, { children: [
|
|
531
|
+
focusedOption === option ? chalk7.bgCyan.black(" \u2192 ") : " ",
|
|
532
|
+
focusedOption === option ? chalk7[getButtonColor(option)].bold(getButtonLabel(option)) : chalk7[getButtonColor(option)](getButtonLabel(option)),
|
|
533
|
+
option === currentFilter && chalk7.green(" \u2713")
|
|
534
|
+
] }) }, option)),
|
|
535
|
+
/* @__PURE__ */ jsx8(Box7, { paddingX: 1, children: /* @__PURE__ */ jsxs7(Text8, { children: [
|
|
536
|
+
focusedOption === "cancel" ? chalk7.bgWhite.black(" \u2192 ") : " ",
|
|
537
|
+
focusedOption === "cancel" ? chalk7.white.bold("Cancel") : chalk7.gray("Cancel")
|
|
538
|
+
] }) })
|
|
539
|
+
] }),
|
|
540
|
+
/* @__PURE__ */ jsx8(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text8, { color: "gray", dimColor: true, children: "\u2191\u2193/Enter \u2022 A/P/R \u2022 Esc" }) })
|
|
553
541
|
] });
|
|
554
542
|
}
|
|
555
543
|
|
|
@@ -666,51 +654,233 @@ function SortModal({
|
|
|
666
654
|
}
|
|
667
655
|
return focusedOption === sort ? "cyan" : "gray";
|
|
668
656
|
};
|
|
669
|
-
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX:
|
|
657
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1, width: 40, children: [
|
|
670
658
|
/* @__PURE__ */ jsx9(Text9, { bold: true, children: "Sort By" }),
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
/* @__PURE__ */ jsxs8(Box8, { flexDirection: "row", justifyContent: "space-between", children: [
|
|
684
|
-
/* @__PURE__ */ jsx9(Text9, { color: focusedOption === option ? "white" : void 0, children: focusedOption === option ? chalk8[getButtonColor(option)].bold(getButtonLabel(option)) : chalk8[getButtonColor(option)](getButtonLabel(option)) }),
|
|
685
|
-
option === currentSort && /* @__PURE__ */ jsx9(Text9, { color: "green", children: " \u2713 Current" })
|
|
686
|
-
] }),
|
|
687
|
-
/* @__PURE__ */ jsx9(Text9, { color: "gray", dimColor: true, children: getButtonDescription(option) })
|
|
688
|
-
] })
|
|
689
|
-
},
|
|
690
|
-
option
|
|
691
|
-
)) }),
|
|
692
|
-
/* @__PURE__ */ jsx9(Box8, { height: 1, children: /* @__PURE__ */ jsx9(Text9, { children: " " }) }),
|
|
693
|
-
/* @__PURE__ */ jsx9(
|
|
694
|
-
Box8,
|
|
695
|
-
{
|
|
696
|
-
borderStyle: focusedOption === "cancel" ? "round" : "single",
|
|
697
|
-
borderColor: focusedOption === "cancel" ? "white" : "gray",
|
|
698
|
-
paddingX: 2,
|
|
699
|
-
paddingY: 1,
|
|
700
|
-
width: "100%",
|
|
701
|
-
justifyContent: "center",
|
|
702
|
-
children: /* @__PURE__ */ jsx9(Text9, { children: focusedOption === "cancel" ? chalk8.white.bold("Cancel") : chalk8.gray("Cancel") })
|
|
703
|
-
}
|
|
704
|
-
),
|
|
705
|
-
/* @__PURE__ */ jsx9(Box8, { height: 1, children: /* @__PURE__ */ jsx9(Text9, { children: " " }) }),
|
|
706
|
-
/* @__PURE__ */ jsx9(Box8, { flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsx9(Text9, { color: "gray", children: "\u2191\u2193 Navigate \u2022 Enter Select \u2022 U Updated \u2022 P Pushed \u2022 N Name \u2022 S Stars \u2022 C/Esc Cancel" }) })
|
|
659
|
+
/* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
660
|
+
options.map((option) => /* @__PURE__ */ jsx9(Box8, { paddingX: 1, children: /* @__PURE__ */ jsxs8(Text9, { children: [
|
|
661
|
+
focusedOption === option ? chalk8.bgCyan.black(" \u2192 ") : " ",
|
|
662
|
+
focusedOption === option ? chalk8[getButtonColor(option)].bold(getButtonLabel(option)) : chalk8[getButtonColor(option)](getButtonLabel(option)),
|
|
663
|
+
option === currentSort && chalk8.green(" \u2713")
|
|
664
|
+
] }) }, option)),
|
|
665
|
+
/* @__PURE__ */ jsx9(Box8, { paddingX: 1, children: /* @__PURE__ */ jsxs8(Text9, { children: [
|
|
666
|
+
focusedOption === "cancel" ? chalk8.bgWhite.black(" \u2192 ") : " ",
|
|
667
|
+
focusedOption === "cancel" ? chalk8.white.bold("Cancel") : chalk8.gray("Cancel")
|
|
668
|
+
] }) })
|
|
669
|
+
] }),
|
|
670
|
+
/* @__PURE__ */ jsx9(Box8, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text9, { color: "gray", dimColor: true, children: "\u2191\u2193/Enter \u2022 U/P/N/S \u2022 Esc" }) })
|
|
707
671
|
] });
|
|
708
672
|
}
|
|
709
673
|
|
|
710
|
-
// src/ui/components/
|
|
711
|
-
import {
|
|
674
|
+
// src/ui/components/modals/ChangeVisibilityModal.tsx
|
|
675
|
+
import { useState as useState9, useEffect as useEffect6 } from "react";
|
|
676
|
+
import { Box as Box9, Text as Text10, useInput as useInput9 } from "ink";
|
|
677
|
+
import TextInput2 from "ink-text-input";
|
|
712
678
|
import chalk9 from "chalk";
|
|
713
|
-
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
679
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
680
|
+
var ChangeVisibilityModal = ({
|
|
681
|
+
isOpen,
|
|
682
|
+
repoName,
|
|
683
|
+
currentVisibility,
|
|
684
|
+
isFork = false,
|
|
685
|
+
isEnterprise = false,
|
|
686
|
+
onVisibilityChange,
|
|
687
|
+
onClose,
|
|
688
|
+
changing: externalChanging,
|
|
689
|
+
error: externalError
|
|
690
|
+
}) => {
|
|
691
|
+
const getAvailableOptions = () => {
|
|
692
|
+
if (currentVisibility === "PUBLIC") {
|
|
693
|
+
return isEnterprise ? ["PRIVATE", "INTERNAL"] : ["PRIVATE"];
|
|
694
|
+
} else if (currentVisibility === "PRIVATE") {
|
|
695
|
+
return isEnterprise ? ["PUBLIC", "INTERNAL"] : ["PUBLIC"];
|
|
696
|
+
} else if (currentVisibility === "INTERNAL") {
|
|
697
|
+
return ["PUBLIC", "PRIVATE"];
|
|
698
|
+
}
|
|
699
|
+
return ["PUBLIC"];
|
|
700
|
+
};
|
|
701
|
+
const availableOptions = getAvailableOptions();
|
|
702
|
+
const [selectedOptionIndex, setSelectedOptionIndex] = useState9(0);
|
|
703
|
+
const [focusedButton, setFocusedButton] = useState9(isFork ? "cancel" : "option");
|
|
704
|
+
const changing = externalChanging ?? false;
|
|
705
|
+
const error = externalError ?? null;
|
|
706
|
+
useEffect6(() => {
|
|
707
|
+
if (isOpen) {
|
|
708
|
+
setSelectedOptionIndex(0);
|
|
709
|
+
setFocusedButton(isFork ? "cancel" : "option");
|
|
710
|
+
}
|
|
711
|
+
}, [isOpen, isFork]);
|
|
712
|
+
useInput9((input, key) => {
|
|
713
|
+
if (!isOpen) return;
|
|
714
|
+
if (key.escape || input?.toLowerCase() === "c") {
|
|
715
|
+
onClose();
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
if (!isFork) {
|
|
719
|
+
if (key.leftArrow) {
|
|
720
|
+
if (focusedButton === "cancel") {
|
|
721
|
+
setFocusedButton("option");
|
|
722
|
+
} else if (availableOptions.length > 1 && selectedOptionIndex > 0) {
|
|
723
|
+
setSelectedOptionIndex(selectedOptionIndex - 1);
|
|
724
|
+
}
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
if (key.rightArrow) {
|
|
728
|
+
if (focusedButton === "option") {
|
|
729
|
+
if (selectedOptionIndex < availableOptions.length - 1) {
|
|
730
|
+
setSelectedOptionIndex(selectedOptionIndex + 1);
|
|
731
|
+
} else {
|
|
732
|
+
setFocusedButton("cancel");
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
if (key.upArrow || key.downArrow) {
|
|
738
|
+
if (focusedButton === "option" && availableOptions.length > 1) {
|
|
739
|
+
setSelectedOptionIndex((selectedOptionIndex + 1) % availableOptions.length);
|
|
740
|
+
}
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
if (input?.toLowerCase() === "y") {
|
|
744
|
+
if (focusedButton === "cancel") {
|
|
745
|
+
onClose();
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
handleChange();
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
const handleChange = () => {
|
|
754
|
+
if (isFork) return;
|
|
755
|
+
const newVisibility = availableOptions[selectedOptionIndex];
|
|
756
|
+
onVisibilityChange(newVisibility);
|
|
757
|
+
};
|
|
758
|
+
if (!isOpen) return null;
|
|
759
|
+
const getVisibilityLabel = (vis) => {
|
|
760
|
+
switch (vis) {
|
|
761
|
+
case "PUBLIC":
|
|
762
|
+
return "Public";
|
|
763
|
+
case "PRIVATE":
|
|
764
|
+
return "Private";
|
|
765
|
+
case "INTERNAL":
|
|
766
|
+
return "Internal";
|
|
767
|
+
default:
|
|
768
|
+
return vis;
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
const getVisibilityColor = (vis) => {
|
|
772
|
+
switch (vis) {
|
|
773
|
+
case "PUBLIC":
|
|
774
|
+
return "green";
|
|
775
|
+
case "PRIVATE":
|
|
776
|
+
return "yellow";
|
|
777
|
+
case "INTERNAL":
|
|
778
|
+
return "cyan";
|
|
779
|
+
default:
|
|
780
|
+
return "white";
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
const borderColor = isFork ? "red" : getVisibilityColor(currentVisibility);
|
|
784
|
+
return /* @__PURE__ */ jsxs9(
|
|
785
|
+
Box9,
|
|
786
|
+
{
|
|
787
|
+
flexDirection: "column",
|
|
788
|
+
borderStyle: "round",
|
|
789
|
+
borderColor,
|
|
790
|
+
paddingX: 3,
|
|
791
|
+
paddingY: 2,
|
|
792
|
+
width: 80,
|
|
793
|
+
children: [
|
|
794
|
+
/* @__PURE__ */ jsx10(Text10, { bold: true, children: isFork ? "Visibility Change Not Available" : "Change Repository Visibility" }),
|
|
795
|
+
isFork ? /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
796
|
+
/* @__PURE__ */ jsx10(Text10, { color: "red", children: "\u26A0\uFE0F Cannot change visibility of forked repositories" }),
|
|
797
|
+
/* @__PURE__ */ jsx10(Box9, { height: 1, children: /* @__PURE__ */ jsx10(Text10, { children: " " }) }),
|
|
798
|
+
/* @__PURE__ */ jsx10(Text10, { children: repoName }),
|
|
799
|
+
/* @__PURE__ */ jsx10(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text10, { children: "GitHub does not allow changing the visibility of forked repositories. The fork must have the same visibility as its parent repository." }) }),
|
|
800
|
+
/* @__PURE__ */ jsx10(Box9, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsx10(
|
|
801
|
+
Box9,
|
|
802
|
+
{
|
|
803
|
+
borderStyle: "round",
|
|
804
|
+
borderColor: "white",
|
|
805
|
+
height: 3,
|
|
806
|
+
width: 20,
|
|
807
|
+
alignItems: "center",
|
|
808
|
+
justifyContent: "center",
|
|
809
|
+
flexDirection: "column",
|
|
810
|
+
children: /* @__PURE__ */ jsx10(Text10, { children: chalk9.bgGray.white.bold(" Cancel ") })
|
|
811
|
+
}
|
|
812
|
+
) }),
|
|
813
|
+
/* @__PURE__ */ jsx10(Box9, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsx10(Text10, { color: "gray", children: "Press Enter or C/Esc to Cancel" }) })
|
|
814
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
815
|
+
/* @__PURE__ */ jsx10(Text10, { color: borderColor, children: "\u26A0\uFE0F Change repository visibility?" }),
|
|
816
|
+
/* @__PURE__ */ jsx10(Box9, { height: 1, children: /* @__PURE__ */ jsx10(Text10, { children: " " }) }),
|
|
817
|
+
/* @__PURE__ */ jsx10(Text10, { children: repoName }),
|
|
818
|
+
/* @__PURE__ */ jsx10(Box9, { marginTop: 1, children: /* @__PURE__ */ jsxs9(Text10, { children: [
|
|
819
|
+
"Current visibility:",
|
|
820
|
+
" ",
|
|
821
|
+
/* @__PURE__ */ jsx10(Text10, { color: getVisibilityColor(currentVisibility), children: getVisibilityLabel(currentVisibility) })
|
|
822
|
+
] }) }),
|
|
823
|
+
/* @__PURE__ */ jsx10(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text10, { children: "Change to:" }) }),
|
|
824
|
+
/* @__PURE__ */ jsxs9(Box9, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 3, children: [
|
|
825
|
+
availableOptions.map((option, index) => /* @__PURE__ */ jsx10(
|
|
826
|
+
Box9,
|
|
827
|
+
{
|
|
828
|
+
borderStyle: "round",
|
|
829
|
+
borderColor: focusedButton === "option" && selectedOptionIndex === index ? getVisibilityColor(option) : "gray",
|
|
830
|
+
height: 3,
|
|
831
|
+
width: 18,
|
|
832
|
+
alignItems: "center",
|
|
833
|
+
justifyContent: "center",
|
|
834
|
+
flexDirection: "column",
|
|
835
|
+
children: /* @__PURE__ */ jsx10(Text10, { children: focusedButton === "option" && selectedOptionIndex === index ? chalk9[`bg${getVisibilityLabel(option) === "Public" ? "Green" : getVisibilityLabel(option) === "Private" ? "Yellow" : "Cyan"}`].black.bold(` ${getVisibilityLabel(option)} `) : chalk9[getVisibilityColor(option)](getVisibilityLabel(option)) })
|
|
836
|
+
},
|
|
837
|
+
option
|
|
838
|
+
)),
|
|
839
|
+
/* @__PURE__ */ jsx10(
|
|
840
|
+
Box9,
|
|
841
|
+
{
|
|
842
|
+
borderStyle: "round",
|
|
843
|
+
borderColor: focusedButton === "cancel" ? "white" : "gray",
|
|
844
|
+
height: 3,
|
|
845
|
+
width: 18,
|
|
846
|
+
alignItems: "center",
|
|
847
|
+
justifyContent: "center",
|
|
848
|
+
flexDirection: "column",
|
|
849
|
+
children: /* @__PURE__ */ jsx10(Text10, { children: focusedButton === "cancel" ? chalk9.bgGray.white.bold(" Cancel ") : chalk9.gray.bold("Cancel") })
|
|
850
|
+
}
|
|
851
|
+
)
|
|
852
|
+
] }),
|
|
853
|
+
/* @__PURE__ */ jsx10(Box9, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs9(Text10, { color: "gray", children: [
|
|
854
|
+
availableOptions.length > 1 ? "\u2191\u2193 Select Option \u2022 " : "",
|
|
855
|
+
"\u2190 \u2192 Navigate \u2022 Enter to Confirm \u2022 C/Esc to Cancel"
|
|
856
|
+
] }) })
|
|
857
|
+
] }),
|
|
858
|
+
/* @__PURE__ */ jsx10(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx10(
|
|
859
|
+
TextInput2,
|
|
860
|
+
{
|
|
861
|
+
value: "",
|
|
862
|
+
onChange: () => {
|
|
863
|
+
},
|
|
864
|
+
onSubmit: () => {
|
|
865
|
+
if (isFork || focusedButton === "cancel") {
|
|
866
|
+
onClose();
|
|
867
|
+
} else {
|
|
868
|
+
handleChange();
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
) }),
|
|
873
|
+
error && /* @__PURE__ */ jsx10(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text10, { color: "magenta", children: error }) }),
|
|
874
|
+
changing && /* @__PURE__ */ jsx10(Box9, { marginTop: 1, children: /* @__PURE__ */ jsx10(Text10, { color: "yellow", children: "Changing visibility..." }) })
|
|
875
|
+
]
|
|
876
|
+
}
|
|
877
|
+
);
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
// src/ui/components/repo/RepoRow.tsx
|
|
881
|
+
import { Box as Box10, Text as Text11 } from "ink";
|
|
882
|
+
import chalk10 from "chalk";
|
|
883
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
714
884
|
function RepoRow({
|
|
715
885
|
repo,
|
|
716
886
|
selected,
|
|
@@ -726,46 +896,50 @@ function RepoRow({
|
|
|
726
896
|
const commitsBehind = hasCommitData ? repo.parent.defaultBranchRef.target.history.totalCount - repo.defaultBranchRef.target.history.totalCount : 0;
|
|
727
897
|
const showCommitsBehind = forkTracking && hasCommitData;
|
|
728
898
|
let line1 = "";
|
|
729
|
-
const numColor = selected ?
|
|
730
|
-
const nameColor = selected ?
|
|
899
|
+
const numColor = selected ? chalk10.cyan : chalk10.gray;
|
|
900
|
+
const nameColor = selected ? chalk10.cyan.bold : chalk10.white;
|
|
731
901
|
line1 += numColor(`${String(index).padStart(3, " ")}.`);
|
|
732
902
|
line1 += nameColor(` ${repo.nameWithOwner}`);
|
|
733
|
-
if (repo.
|
|
734
|
-
|
|
903
|
+
if (repo.visibility === "INTERNAL") {
|
|
904
|
+
line1 += chalk10.magenta(" Internal");
|
|
905
|
+
} else if (repo.visibility === "PRIVATE" || repo.isPrivate && !repo.visibility) {
|
|
906
|
+
line1 += chalk10.yellow(" Private");
|
|
907
|
+
}
|
|
908
|
+
if (repo.isArchived) line1 += " " + chalk10.bgGray.whiteBright(" Archived ") + " ";
|
|
735
909
|
if (repo.isFork && repo.parent) {
|
|
736
|
-
line1 +=
|
|
910
|
+
line1 += chalk10.blue(` Fork of ${repo.parent.nameWithOwner}`);
|
|
737
911
|
if (showCommitsBehind) {
|
|
738
912
|
if (commitsBehind > 0) {
|
|
739
|
-
line1 +=
|
|
913
|
+
line1 += chalk10.yellow(` (${commitsBehind} behind)`);
|
|
740
914
|
} else {
|
|
741
|
-
line1 +=
|
|
915
|
+
line1 += chalk10.green(` (0 behind)`);
|
|
742
916
|
}
|
|
743
917
|
}
|
|
744
918
|
}
|
|
745
919
|
let line2 = " ";
|
|
746
|
-
const metaColor = selected ?
|
|
747
|
-
if (langName) line2 +=
|
|
920
|
+
const metaColor = selected ? chalk10.white : chalk10.gray;
|
|
921
|
+
if (langName) line2 += chalk10.hex(langColor)("\u25CF ") + metaColor(`${langName} `);
|
|
748
922
|
line2 += metaColor(`\u2605 ${repo.stargazerCount} \u2442 ${repo.forkCount} Updated ${formatDate(repo.updatedAt)}`);
|
|
749
923
|
const line3 = repo.description ? ` ${truncate(repo.description, Math.max(30, maxWidth - 10))}` : null;
|
|
750
924
|
let fullText = line1 + "\n" + line2;
|
|
751
925
|
if (line3) fullText += "\n" + metaColor(line3);
|
|
752
926
|
const spacingAbove = Math.floor(spacingLines / 2);
|
|
753
927
|
const spacingBelow = spacingLines - spacingAbove;
|
|
754
|
-
return /* @__PURE__ */
|
|
755
|
-
spacingAbove > 0 && /* @__PURE__ */
|
|
756
|
-
/* @__PURE__ */
|
|
757
|
-
spacingBelow > 0 && /* @__PURE__ */
|
|
928
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", backgroundColor: selected ? "gray" : void 0, children: [
|
|
929
|
+
spacingAbove > 0 && /* @__PURE__ */ jsx11(Box10, { height: spacingAbove, children: /* @__PURE__ */ jsx11(Text11, { children: " " }) }),
|
|
930
|
+
/* @__PURE__ */ jsx11(Text11, { children: dim ? chalk10.dim(fullText) : fullText }),
|
|
931
|
+
spacingBelow > 0 && /* @__PURE__ */ jsx11(Box10, { height: spacingBelow, children: /* @__PURE__ */ jsx11(Text11, { children: " " }) })
|
|
758
932
|
] });
|
|
759
933
|
}
|
|
760
934
|
|
|
761
935
|
// src/ui/components/repo/FilterInput.tsx
|
|
762
|
-
import { Box as
|
|
763
|
-
import
|
|
764
|
-
import { jsx as
|
|
936
|
+
import { Box as Box11, Text as Text12 } from "ink";
|
|
937
|
+
import TextInput3 from "ink-text-input";
|
|
938
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
765
939
|
|
|
766
940
|
// src/ui/components/repo/RepoListHeader.tsx
|
|
767
|
-
import { Box as
|
|
768
|
-
import { Fragment as
|
|
941
|
+
import { Box as Box12, Text as Text13 } from "ink";
|
|
942
|
+
import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
769
943
|
function RepoListHeader({
|
|
770
944
|
ownerContext,
|
|
771
945
|
sortKey,
|
|
@@ -774,37 +948,37 @@ function RepoListHeader({
|
|
|
774
948
|
filter,
|
|
775
949
|
searchActive,
|
|
776
950
|
searchLoading,
|
|
777
|
-
visibilityFilter = "all"
|
|
951
|
+
visibilityFilter = "all",
|
|
952
|
+
isEnterprise = false
|
|
778
953
|
}) {
|
|
779
|
-
return /* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */ jsxs11(Text12, { color: "gray", dimColor: true, children: [
|
|
954
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "row", gap: 2, marginBottom: 1, children: [
|
|
955
|
+
/* @__PURE__ */ jsxs12(Text13, { color: "gray", dimColor: true, children: [
|
|
782
956
|
"Sort: ",
|
|
783
957
|
sortKey,
|
|
784
958
|
" ",
|
|
785
959
|
sortDir === "asc" ? "\u2191" : "\u2193"
|
|
786
960
|
] }),
|
|
787
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ jsxs12(Text13, { color: "gray", dimColor: true, children: [
|
|
788
962
|
"Fork Status - Commits Behind: ",
|
|
789
963
|
forkTracking ? "ON" : "OFF"
|
|
790
964
|
] }),
|
|
791
|
-
visibilityFilter !== "all" && /* @__PURE__ */
|
|
965
|
+
visibilityFilter !== "all" && /* @__PURE__ */ jsxs12(Text13, { color: "yellow", children: [
|
|
792
966
|
"Visibility: ",
|
|
793
|
-
visibilityFilter === "public" ? "Public" : visibilityFilter === "private" ? "Private" : "
|
|
967
|
+
visibilityFilter === "public" ? "Public" : visibilityFilter === "private" ? isEnterprise ? "Private/Internal" : "Private" : ""
|
|
794
968
|
] }),
|
|
795
|
-
filter && !searchActive && /* @__PURE__ */
|
|
969
|
+
filter && !searchActive && /* @__PURE__ */ jsxs12(Text13, { color: "cyan", children: [
|
|
796
970
|
'Filter: "',
|
|
797
971
|
filter,
|
|
798
972
|
'"'
|
|
799
973
|
] }),
|
|
800
|
-
searchActive && /* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
974
|
+
searchActive && /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
975
|
+
/* @__PURE__ */ jsxs12(Text13, { color: "cyan", children: [
|
|
802
976
|
'Search: "',
|
|
803
977
|
filter.trim(),
|
|
804
978
|
'"'
|
|
805
979
|
] }),
|
|
806
|
-
searchLoading && /* @__PURE__ */
|
|
807
|
-
/* @__PURE__ */
|
|
980
|
+
searchLoading && /* @__PURE__ */ jsx13(Box12, { marginLeft: 1, children: /* @__PURE__ */ jsxs12(Text13, { color: "cyan", children: [
|
|
981
|
+
/* @__PURE__ */ jsx13(SlowSpinner, {}),
|
|
808
982
|
" Searching\u2026"
|
|
809
983
|
] }) })
|
|
810
984
|
] })
|
|
@@ -812,7 +986,7 @@ function RepoListHeader({
|
|
|
812
986
|
}
|
|
813
987
|
|
|
814
988
|
// src/ui/RepoList.tsx
|
|
815
|
-
import { Fragment as
|
|
989
|
+
import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
816
990
|
var getPageSize = () => {
|
|
817
991
|
const envValue = process.env.REPOS_PER_FETCH;
|
|
818
992
|
if (envValue) {
|
|
@@ -828,66 +1002,70 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
828
1002
|
const { exit } = useApp();
|
|
829
1003
|
const { stdout } = useStdout();
|
|
830
1004
|
const client = useMemo(() => makeClient(token), [token]);
|
|
831
|
-
const [debugMessages, setDebugMessages] =
|
|
1005
|
+
const [debugMessages, setDebugMessages] = useState10([]);
|
|
832
1006
|
const addDebugMessage = (msg) => {
|
|
833
1007
|
if (process.env.GH_MANAGER_DEBUG === "1") {
|
|
834
1008
|
setDebugMessages((prev) => [...prev.slice(-9), msg]);
|
|
835
1009
|
}
|
|
836
1010
|
};
|
|
837
|
-
|
|
1011
|
+
React10.useEffect(() => {
|
|
838
1012
|
addDebugMessage(`[RepoList] Component mounted`);
|
|
839
1013
|
}, []);
|
|
840
1014
|
const terminalWidth = stdout?.columns ?? 80;
|
|
841
1015
|
const availableHeight = maxVisibleRows ?? 20;
|
|
842
|
-
const [items, setItems] =
|
|
843
|
-
const [cursor, setCursor] =
|
|
844
|
-
const [endCursor, setEndCursor] =
|
|
845
|
-
const [hasNextPage, setHasNextPage] =
|
|
846
|
-
const [totalCount, setTotalCount] =
|
|
847
|
-
const [loading, setLoading] =
|
|
848
|
-
const [sortingLoading, setSortingLoading] =
|
|
849
|
-
const [refreshing, setRefreshing] =
|
|
850
|
-
const [loadingMore, setLoadingMore] =
|
|
851
|
-
const [error, setError] =
|
|
852
|
-
const [rateLimit, setRateLimit] =
|
|
853
|
-
const [prevRateLimit, setPrevRateLimit] =
|
|
854
|
-
const [density, setDensity] =
|
|
855
|
-
const [prefsLoaded, setPrefsLoaded] =
|
|
856
|
-
const [ownerContext, setOwnerContext] =
|
|
857
|
-
const [ownerAffiliations, setOwnerAffiliations] =
|
|
858
|
-
const [orgSwitcherOpen, setOrgSwitcherOpen] =
|
|
859
|
-
const [searchItems, setSearchItems] =
|
|
860
|
-
const [searchEndCursor, setSearchEndCursor] =
|
|
861
|
-
const [searchHasNextPage, setSearchHasNextPage] =
|
|
862
|
-
const [searchTotalCount, setSearchTotalCount] =
|
|
863
|
-
const [searchLoading, setSearchLoading] =
|
|
864
|
-
const [deleteMode, setDeleteMode] =
|
|
865
|
-
const [deleteTarget, setDeleteTarget] =
|
|
866
|
-
const [deleteCode, setDeleteCode] =
|
|
867
|
-
const [typedCode, setTypedCode] =
|
|
868
|
-
const [deleting, setDeleting] =
|
|
869
|
-
const [deleteError, setDeleteError] =
|
|
870
|
-
const [deleteConfirmStage, setDeleteConfirmStage] =
|
|
871
|
-
const [confirmFocus, setConfirmFocus] =
|
|
872
|
-
const [archiveMode, setArchiveMode] =
|
|
873
|
-
const [archiveTarget, setArchiveTarget] =
|
|
874
|
-
const [archiving, setArchiving] =
|
|
875
|
-
const [archiveError, setArchiveError] =
|
|
876
|
-
const [archiveFocus, setArchiveFocus] =
|
|
877
|
-
const [syncMode, setSyncMode] =
|
|
878
|
-
const [syncTarget, setSyncTarget] =
|
|
879
|
-
const [syncing, setSyncing] =
|
|
880
|
-
const [syncError, setSyncError] =
|
|
881
|
-
const [syncFocus, setSyncFocus] =
|
|
882
|
-
const [syncTrigger, setSyncTrigger] =
|
|
883
|
-
const [infoMode, setInfoMode] =
|
|
884
|
-
const [infoRepo, setInfoRepo] =
|
|
885
|
-
const [logoutMode, setLogoutMode] =
|
|
886
|
-
const [logoutFocus, setLogoutFocus] =
|
|
887
|
-
const [logoutError, setLogoutError] =
|
|
888
|
-
const [visibilityMode, setVisibilityMode] =
|
|
889
|
-
const [
|
|
890
|
-
const [
|
|
1016
|
+
const [items, setItems] = useState10([]);
|
|
1017
|
+
const [cursor, setCursor] = useState10(0);
|
|
1018
|
+
const [endCursor, setEndCursor] = useState10(null);
|
|
1019
|
+
const [hasNextPage, setHasNextPage] = useState10(false);
|
|
1020
|
+
const [totalCount, setTotalCount] = useState10(0);
|
|
1021
|
+
const [loading, setLoading] = useState10(true);
|
|
1022
|
+
const [sortingLoading, setSortingLoading] = useState10(false);
|
|
1023
|
+
const [refreshing, setRefreshing] = useState10(false);
|
|
1024
|
+
const [loadingMore, setLoadingMore] = useState10(false);
|
|
1025
|
+
const [error, setError] = useState10(null);
|
|
1026
|
+
const [rateLimit, setRateLimit] = useState10(void 0);
|
|
1027
|
+
const [prevRateLimit, setPrevRateLimit] = useState10(void 0);
|
|
1028
|
+
const [density, setDensity] = useState10(2);
|
|
1029
|
+
const [prefsLoaded, setPrefsLoaded] = useState10(false);
|
|
1030
|
+
const [ownerContext, setOwnerContext] = useState10("personal");
|
|
1031
|
+
const [ownerAffiliations, setOwnerAffiliations] = useState10(["OWNER"]);
|
|
1032
|
+
const [orgSwitcherOpen, setOrgSwitcherOpen] = useState10(false);
|
|
1033
|
+
const [searchItems, setSearchItems] = useState10([]);
|
|
1034
|
+
const [searchEndCursor, setSearchEndCursor] = useState10(null);
|
|
1035
|
+
const [searchHasNextPage, setSearchHasNextPage] = useState10(false);
|
|
1036
|
+
const [searchTotalCount, setSearchTotalCount] = useState10(0);
|
|
1037
|
+
const [searchLoading, setSearchLoading] = useState10(false);
|
|
1038
|
+
const [deleteMode, setDeleteMode] = useState10(false);
|
|
1039
|
+
const [deleteTarget, setDeleteTarget] = useState10(null);
|
|
1040
|
+
const [deleteCode, setDeleteCode] = useState10("");
|
|
1041
|
+
const [typedCode, setTypedCode] = useState10("");
|
|
1042
|
+
const [deleting, setDeleting] = useState10(false);
|
|
1043
|
+
const [deleteError, setDeleteError] = useState10(null);
|
|
1044
|
+
const [deleteConfirmStage, setDeleteConfirmStage] = useState10(false);
|
|
1045
|
+
const [confirmFocus, setConfirmFocus] = useState10("delete");
|
|
1046
|
+
const [archiveMode, setArchiveMode] = useState10(false);
|
|
1047
|
+
const [archiveTarget, setArchiveTarget] = useState10(null);
|
|
1048
|
+
const [archiving, setArchiving] = useState10(false);
|
|
1049
|
+
const [archiveError, setArchiveError] = useState10(null);
|
|
1050
|
+
const [archiveFocus, setArchiveFocus] = useState10("confirm");
|
|
1051
|
+
const [syncMode, setSyncMode] = useState10(false);
|
|
1052
|
+
const [syncTarget, setSyncTarget] = useState10(null);
|
|
1053
|
+
const [syncing, setSyncing] = useState10(false);
|
|
1054
|
+
const [syncError, setSyncError] = useState10(null);
|
|
1055
|
+
const [syncFocus, setSyncFocus] = useState10("confirm");
|
|
1056
|
+
const [syncTrigger, setSyncTrigger] = useState10(false);
|
|
1057
|
+
const [infoMode, setInfoMode] = useState10(false);
|
|
1058
|
+
const [infoRepo, setInfoRepo] = useState10(null);
|
|
1059
|
+
const [logoutMode, setLogoutMode] = useState10(false);
|
|
1060
|
+
const [logoutFocus, setLogoutFocus] = useState10("confirm");
|
|
1061
|
+
const [logoutError, setLogoutError] = useState10(null);
|
|
1062
|
+
const [visibilityMode, setVisibilityMode] = useState10(false);
|
|
1063
|
+
const [isEnterpriseOrg, setIsEnterpriseOrg] = useState10(false);
|
|
1064
|
+
const [changeVisibilityMode, setChangeVisibilityMode] = useState10(false);
|
|
1065
|
+
const [changeVisibilityTarget, setChangeVisibilityTarget] = useState10(null);
|
|
1066
|
+
const [changingVisibility, setChangingVisibility] = useState10(false);
|
|
1067
|
+
const [changeVisibilityError, setChangeVisibilityError] = useState10(null);
|
|
1068
|
+
const [sortMode, setSortMode] = useState10(false);
|
|
891
1069
|
function closeArchiveModal() {
|
|
892
1070
|
setArchiveMode(false);
|
|
893
1071
|
setArchiveTarget(null);
|
|
@@ -895,6 +1073,12 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
895
1073
|
setArchiveError(null);
|
|
896
1074
|
setArchiveFocus("confirm");
|
|
897
1075
|
}
|
|
1076
|
+
function closeChangeVisibilityModal() {
|
|
1077
|
+
setChangeVisibilityMode(false);
|
|
1078
|
+
setChangeVisibilityTarget(null);
|
|
1079
|
+
setChangingVisibility(false);
|
|
1080
|
+
setChangeVisibilityError(null);
|
|
1081
|
+
}
|
|
898
1082
|
function closeSyncModal() {
|
|
899
1083
|
setSyncMode(false);
|
|
900
1084
|
setSyncTarget(null);
|
|
@@ -963,14 +1147,54 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
963
1147
|
setArchiveError("Failed to update archive state. Check permissions.");
|
|
964
1148
|
}
|
|
965
1149
|
}
|
|
966
|
-
function
|
|
1150
|
+
async function handleVisibilityChange(newVisibility) {
|
|
1151
|
+
if (!changeVisibilityTarget || changingVisibility) return;
|
|
1152
|
+
try {
|
|
1153
|
+
setChangingVisibility(true);
|
|
1154
|
+
const id = changeVisibilityTarget.id;
|
|
1155
|
+
await changeRepositoryVisibility(client, id, newVisibility, token);
|
|
1156
|
+
await updateCacheAfterVisibilityChange(token, id, newVisibility);
|
|
1157
|
+
const shouldRemove = visibilityFilter === "public" && newVisibility !== "PUBLIC" || visibilityFilter === "private" && newVisibility !== "PRIVATE" && newVisibility !== "INTERNAL";
|
|
1158
|
+
if (shouldRemove) {
|
|
1159
|
+
setItems((prev) => prev.filter((r) => r.id !== id));
|
|
1160
|
+
setSearchItems((prev) => prev.filter((r) => r.id !== id));
|
|
1161
|
+
setTotalCount((c) => Math.max(0, c - 1));
|
|
1162
|
+
if (searchActive) {
|
|
1163
|
+
setSearchTotalCount((c) => Math.max(0, c - 1));
|
|
1164
|
+
}
|
|
1165
|
+
const currentItemsLength = searchActive ? searchItems.length : items.length;
|
|
1166
|
+
setCursor((c) => Math.max(0, Math.min(c, currentItemsLength - 2)));
|
|
1167
|
+
} else {
|
|
1168
|
+
const isPrivate = newVisibility === "PRIVATE";
|
|
1169
|
+
const updateRepo = (r) => r.id === id ? { ...r, visibility: newVisibility, isPrivate } : r;
|
|
1170
|
+
setItems((prev) => prev.map(updateRepo));
|
|
1171
|
+
setSearchItems((prev) => prev.map(updateRepo));
|
|
1172
|
+
}
|
|
1173
|
+
closeChangeVisibilityModal();
|
|
1174
|
+
} catch (e) {
|
|
1175
|
+
setChangingVisibility(false);
|
|
1176
|
+
setChangeVisibilityError(e.message || "Failed to change visibility. Check permissions.");
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
async function handleOrgContextChange(newContext) {
|
|
967
1180
|
setOwnerContext(newContext);
|
|
968
|
-
storeUIPrefs({ ownerContext: newContext });
|
|
969
1181
|
setCursor(0);
|
|
970
1182
|
setOrgSwitcherOpen(false);
|
|
1183
|
+
setVisibilityFilter("all");
|
|
971
1184
|
const newAffiliations = newContext === "personal" ? ["OWNER"] : ["ORGANIZATION_MEMBER"];
|
|
972
1185
|
setOwnerAffiliations(newAffiliations);
|
|
973
|
-
|
|
1186
|
+
if (newContext !== "personal") {
|
|
1187
|
+
const client2 = makeClient(token);
|
|
1188
|
+
const isEnt = await checkOrganizationIsEnterprise(client2, newContext.login);
|
|
1189
|
+
setIsEnterpriseOrg(isEnt);
|
|
1190
|
+
} else {
|
|
1191
|
+
setIsEnterpriseOrg(false);
|
|
1192
|
+
}
|
|
1193
|
+
storeUIPrefs({
|
|
1194
|
+
ownerContext: newContext,
|
|
1195
|
+
ownerAffiliations: newAffiliations,
|
|
1196
|
+
visibilityFilter: "all"
|
|
1197
|
+
});
|
|
974
1198
|
if (onOrgContextChange) {
|
|
975
1199
|
onOrgContextChange(newContext);
|
|
976
1200
|
}
|
|
@@ -1010,12 +1234,12 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1010
1234
|
setDeleteError("Failed to delete repository. Ensure delete_repo scope and admin permissions.");
|
|
1011
1235
|
}
|
|
1012
1236
|
}
|
|
1013
|
-
const [filter, setFilter] =
|
|
1014
|
-
const [filterMode, setFilterMode] =
|
|
1015
|
-
const [sortKey, setSortKey] =
|
|
1016
|
-
const [sortDir, setSortDir] =
|
|
1017
|
-
const [forkTracking, setForkTracking] =
|
|
1018
|
-
const [visibilityFilter, setVisibilityFilter] =
|
|
1237
|
+
const [filter, setFilter] = useState10("");
|
|
1238
|
+
const [filterMode, setFilterMode] = useState10(false);
|
|
1239
|
+
const [sortKey, setSortKey] = useState10("updated");
|
|
1240
|
+
const [sortDir, setSortDir] = useState10("desc");
|
|
1241
|
+
const [forkTracking, setForkTracking] = useState10(true);
|
|
1242
|
+
const [visibilityFilter, setVisibilityFilter] = useState10("all");
|
|
1019
1243
|
const previousVisibilityFilter = useRef("all");
|
|
1020
1244
|
const sortFieldMap = {
|
|
1021
1245
|
"updated": "UPDATED_AT",
|
|
@@ -1058,6 +1282,12 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1058
1282
|
if (page.nodes.some((repo) => repo.visibility === "INTERNAL")) {
|
|
1059
1283
|
setHasInternalRepos(true);
|
|
1060
1284
|
}
|
|
1285
|
+
if (!after && orgLogin2) {
|
|
1286
|
+
const client2 = makeClient(token);
|
|
1287
|
+
checkOrganizationIsEnterprise(client2, orgLogin2).then((isEnt) => {
|
|
1288
|
+
setIsEnterpriseOrg(isEnt);
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1061
1291
|
if (!after) {
|
|
1062
1292
|
try {
|
|
1063
1293
|
const key = makeApolloKey({
|
|
@@ -1097,7 +1327,8 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1097
1327
|
setSearchLoading(true);
|
|
1098
1328
|
try {
|
|
1099
1329
|
const orderBy = { field: sortFieldMap[sortKey], direction: sortDir.toUpperCase() };
|
|
1100
|
-
|
|
1330
|
+
const orgLogin2 = ownerContext !== "personal" ? ownerContext.login : void 0;
|
|
1331
|
+
addDebugMessage(`[fetchSearchPage] Calling API with viewer="${viewerLogin}", orgLogin="${orgLogin2 || "none"}", query="${query.trim()}"`);
|
|
1101
1332
|
const page = await searchRepositoriesUnified(
|
|
1102
1333
|
token,
|
|
1103
1334
|
viewerLogin,
|
|
@@ -1107,7 +1338,8 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1107
1338
|
orderBy.field,
|
|
1108
1339
|
orderBy.direction,
|
|
1109
1340
|
forkTracking,
|
|
1110
|
-
policy ?? (after ? "network-only" : "cache-first")
|
|
1341
|
+
policy ?? (after ? "network-only" : "cache-first"),
|
|
1342
|
+
orgLogin2
|
|
1111
1343
|
);
|
|
1112
1344
|
addDebugMessage(`[fetchSearchPage] API returned ${page.nodes.length} results, totalCount=${page.totalCount}`);
|
|
1113
1345
|
if (page.nodes.length > 0) {
|
|
@@ -1143,7 +1375,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1143
1375
|
setSearchLoading(false);
|
|
1144
1376
|
}
|
|
1145
1377
|
};
|
|
1146
|
-
|
|
1378
|
+
useEffect7(() => {
|
|
1147
1379
|
const ui = getUIPrefs();
|
|
1148
1380
|
if (ui.density !== void 0) setDensity(ui.density);
|
|
1149
1381
|
if (ui.sortKey && ["updated", "pushed", "name", "stars"].includes(ui.sortKey)) {
|
|
@@ -1162,13 +1394,19 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1162
1394
|
if (onOrgContextChange) {
|
|
1163
1395
|
onOrgContextChange(ui.ownerContext);
|
|
1164
1396
|
}
|
|
1397
|
+
if (ui.ownerContext !== "personal") {
|
|
1398
|
+
const client2 = makeClient(token);
|
|
1399
|
+
checkOrganizationIsEnterprise(client2, ui.ownerContext.login).then((isEnt) => {
|
|
1400
|
+
setIsEnterpriseOrg(isEnt);
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1165
1403
|
}
|
|
1166
1404
|
if (ui.ownerAffiliations && Array.isArray(ui.ownerAffiliations)) {
|
|
1167
1405
|
setOwnerAffiliations(ui.ownerAffiliations);
|
|
1168
1406
|
}
|
|
1169
1407
|
setPrefsLoaded(true);
|
|
1170
1408
|
}, [onOrgContextChange]);
|
|
1171
|
-
|
|
1409
|
+
useEffect7(() => {
|
|
1172
1410
|
if (!prefsLoaded) return;
|
|
1173
1411
|
let policy = "cache-first";
|
|
1174
1412
|
const orgLogin2 = ownerContext !== "personal" ? ownerContext.login : void 0;
|
|
@@ -1188,7 +1426,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1188
1426
|
setCursor(0);
|
|
1189
1427
|
fetchPage(null, true, false, void 0, policy);
|
|
1190
1428
|
}, [client, prefsLoaded, ownerContext, ownerAffiliations]);
|
|
1191
|
-
|
|
1429
|
+
useEffect7(() => {
|
|
1192
1430
|
if (!searchActive) {
|
|
1193
1431
|
if (items.length > 0) {
|
|
1194
1432
|
let policy = "cache-first";
|
|
@@ -1227,7 +1465,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1227
1465
|
}
|
|
1228
1466
|
}
|
|
1229
1467
|
}, [sortKey, sortDir]);
|
|
1230
|
-
|
|
1468
|
+
useEffect7(() => {
|
|
1231
1469
|
if (visibilityFilter !== "all" || previousVisibilityFilter.current && previousVisibilityFilter.current !== visibilityFilter) {
|
|
1232
1470
|
if (!searchActive) {
|
|
1233
1471
|
if (items.length > 0) {
|
|
@@ -1244,7 +1482,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1244
1482
|
}
|
|
1245
1483
|
previousVisibilityFilter.current = visibilityFilter;
|
|
1246
1484
|
}, [visibilityFilter]);
|
|
1247
|
-
|
|
1485
|
+
useEffect7(() => {
|
|
1248
1486
|
if (viewerLogin && searchActive && !searchLoading && searchItems.length === 0) {
|
|
1249
1487
|
let policy = "cache-first";
|
|
1250
1488
|
try {
|
|
@@ -1264,7 +1502,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1264
1502
|
fetchSearchPage(null, true, policy);
|
|
1265
1503
|
}
|
|
1266
1504
|
}, [viewerLogin]);
|
|
1267
|
-
|
|
1505
|
+
useInput10((input, key) => {
|
|
1268
1506
|
if (orgSwitcherOpen) {
|
|
1269
1507
|
return;
|
|
1270
1508
|
}
|
|
@@ -1379,6 +1617,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1379
1617
|
if (visibilityMode) {
|
|
1380
1618
|
return;
|
|
1381
1619
|
}
|
|
1620
|
+
if (changeVisibilityMode) {
|
|
1621
|
+
return;
|
|
1622
|
+
}
|
|
1382
1623
|
if (sortMode) {
|
|
1383
1624
|
return;
|
|
1384
1625
|
}
|
|
@@ -1481,6 +1722,14 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1481
1722
|
}
|
|
1482
1723
|
return;
|
|
1483
1724
|
}
|
|
1725
|
+
if (key.ctrl && (input === "v" || input === "V")) {
|
|
1726
|
+
const repo = visibleItems[cursor];
|
|
1727
|
+
if (repo) {
|
|
1728
|
+
setChangeVisibilityTarget(repo);
|
|
1729
|
+
setChangeVisibilityMode(true);
|
|
1730
|
+
}
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1484
1733
|
if (key.ctrl && (input === "s" || input === "S")) {
|
|
1485
1734
|
const repo = visibleItems[cursor];
|
|
1486
1735
|
if (repo && repo.isFork && repo.parent) {
|
|
@@ -1582,8 +1831,8 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1582
1831
|
});
|
|
1583
1832
|
const filtered = useMemo(() => {
|
|
1584
1833
|
let result = items;
|
|
1585
|
-
if (visibilityFilter === "
|
|
1586
|
-
result = result.filter((r) => r.visibility === "INTERNAL");
|
|
1834
|
+
if (visibilityFilter === "private") {
|
|
1835
|
+
result = result.filter((r) => r.visibility === "PRIVATE" || r.visibility === "INTERNAL");
|
|
1587
1836
|
}
|
|
1588
1837
|
const q = filter.trim().toLowerCase();
|
|
1589
1838
|
if (q) {
|
|
@@ -1614,13 +1863,22 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1614
1863
|
return arr;
|
|
1615
1864
|
}, [filtered, sortKey, sortDir]);
|
|
1616
1865
|
const searchActive = filter.trim().length >= 3;
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1866
|
+
const filteredSearchItems = useMemo(() => {
|
|
1867
|
+
let result = searchItems;
|
|
1868
|
+
if (visibilityFilter === "private") {
|
|
1869
|
+
result = result.filter((r) => r.visibility === "PRIVATE" || r.visibility === "INTERNAL");
|
|
1870
|
+
} else if (visibilityFilter === "public") {
|
|
1871
|
+
result = result.filter((r) => r.visibility === "PUBLIC");
|
|
1872
|
+
}
|
|
1873
|
+
return result;
|
|
1874
|
+
}, [searchItems, visibilityFilter]);
|
|
1875
|
+
const visibleItems = searchActive ? filteredSearchItems : filteredAndSorted;
|
|
1876
|
+
useEffect7(() => {
|
|
1619
1877
|
if (searchActive) {
|
|
1620
1878
|
addDebugMessage(`[State] searchActive=${searchActive}, searchItems=${searchItems.length}, visibleItems=${visibleItems.length}, filter="${filter}"`);
|
|
1621
1879
|
}
|
|
1622
1880
|
}, [searchActive, searchItems.length, visibleItems.length, filter]);
|
|
1623
|
-
|
|
1881
|
+
useEffect7(() => {
|
|
1624
1882
|
setCursor((c) => Math.min(c, Math.max(0, (searchActive ? searchItems.length : items.length) - 1)));
|
|
1625
1883
|
}, [searchActive, searchItems.length, items.length]);
|
|
1626
1884
|
const headerHeight = 2;
|
|
@@ -1641,7 +1899,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1641
1899
|
const end = Math.min(total, start + visibleRepos + buffer);
|
|
1642
1900
|
return { start, end };
|
|
1643
1901
|
}, [visibleItems.length, cursor, listHeight, spacingLines]);
|
|
1644
|
-
|
|
1902
|
+
useEffect7(() => {
|
|
1645
1903
|
const prefetchThreshold = Math.floor(visibleItems.length * 0.8);
|
|
1646
1904
|
const nearEnd = visibleItems.length > 0 && cursor >= prefetchThreshold;
|
|
1647
1905
|
if (searchActive) {
|
|
@@ -1663,88 +1921,94 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1663
1921
|
}
|
|
1664
1922
|
const lowRate = rateLimit && rateLimit.remaining <= Math.ceil(rateLimit.limit * 0.1);
|
|
1665
1923
|
const modalOpen = deleteMode || archiveMode || syncMode || logoutMode || infoMode || visibilityMode;
|
|
1666
|
-
const headerBar = useMemo(() => /* @__PURE__ */
|
|
1667
|
-
/* @__PURE__ */
|
|
1668
|
-
/* @__PURE__ */
|
|
1669
|
-
|
|
1924
|
+
const headerBar = useMemo(() => /* @__PURE__ */ jsxs13(Box13, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: [
|
|
1925
|
+
/* @__PURE__ */ jsxs13(Box13, { flexDirection: "row", gap: 1, children: [
|
|
1926
|
+
/* @__PURE__ */ jsxs13(Text14, { color: "cyan", bold: !modalOpen, dimColor: modalOpen, children: [
|
|
1927
|
+
" ",
|
|
1928
|
+
ownerContext === "personal" ? "Personal" : ownerContext.name || ownerContext.login,
|
|
1929
|
+
ownerContext !== "personal" && isEnterpriseOrg && " (ENT)"
|
|
1930
|
+
] }),
|
|
1931
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, color: modalOpen ? "gray" : void 0, dimColor: modalOpen ? true : void 0, children: "Repositories" }),
|
|
1932
|
+
/* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
1670
1933
|
"(",
|
|
1671
1934
|
visibleItems.length,
|
|
1672
1935
|
"/",
|
|
1673
1936
|
searchActive ? searchTotalCount : totalCount,
|
|
1674
1937
|
")"
|
|
1675
1938
|
] }),
|
|
1676
|
-
(loading || searchLoading) && /* @__PURE__ */
|
|
1939
|
+
(loading || searchLoading) && /* @__PURE__ */ jsx14(Box13, { width: 2, flexShrink: 0, flexGrow: 0, marginLeft: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "yellow", children: /* @__PURE__ */ jsx14(SlowSpinner, {}) }) })
|
|
1677
1940
|
] }),
|
|
1678
|
-
rateLimit && /* @__PURE__ */
|
|
1941
|
+
rateLimit && /* @__PURE__ */ jsxs13(Text14, { color: lowRate ? "yellow" : "gray", children: [
|
|
1679
1942
|
"API: ",
|
|
1680
1943
|
rateLimit.remaining,
|
|
1681
1944
|
"/",
|
|
1682
1945
|
rateLimit.limit,
|
|
1683
|
-
prevRateLimit !== void 0 && prevRateLimit !== rateLimit.remaining && /* @__PURE__ */
|
|
1946
|
+
prevRateLimit !== void 0 && prevRateLimit !== rateLimit.remaining && /* @__PURE__ */ jsx14(Text14, { color: rateLimit.remaining < prevRateLimit ? "red" : "green", children: ` (${rateLimit.remaining - prevRateLimit > 0 ? "+" : ""}${rateLimit.remaining - prevRateLimit})` }),
|
|
1947
|
+
" "
|
|
1684
1948
|
] })
|
|
1685
|
-
] }), [visibleItems.length, searchActive, searchTotalCount, totalCount, loading, searchLoading, rateLimit, lowRate, modalOpen, prevRateLimit]);
|
|
1949
|
+
] }), [visibleItems.length, searchActive, searchTotalCount, totalCount, loading, searchLoading, rateLimit, lowRate, modalOpen, prevRateLimit, ownerContext, isEnterpriseOrg]);
|
|
1686
1950
|
if (error) {
|
|
1687
|
-
return /* @__PURE__ */
|
|
1688
|
-
/* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1951
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", height: availableHeight, children: [
|
|
1952
|
+
/* @__PURE__ */ jsx14(Box13, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "row", gap: 1, children: [
|
|
1953
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, children: " Repositories" }),
|
|
1954
|
+
/* @__PURE__ */ jsx14(Text14, { color: "red", children: "(Error)" })
|
|
1691
1955
|
] }) }),
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsx14(Box13, { borderStyle: "single", borderColor: "red", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: /* @__PURE__ */ jsx14(Box13, { height: contentHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", alignItems: "center", children: [
|
|
1957
|
+
/* @__PURE__ */ jsx14(Text14, { color: "red", children: error }),
|
|
1958
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "gray", dimColor: true, children: "Press 'r' to retry or 'q' to quit" }) })
|
|
1695
1959
|
] }) }) }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1960
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "gray", children: "Press 'r' to retry \u2022 'q' to quit" }) })
|
|
1697
1961
|
] });
|
|
1698
1962
|
}
|
|
1699
1963
|
if (loading && items.length === 0 || sortingLoading) {
|
|
1700
|
-
return /* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1703
|
-
/* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", height: availableHeight, children: [
|
|
1965
|
+
/* @__PURE__ */ jsx14(Box13, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "row", gap: 1, children: [
|
|
1966
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, children: " Repositories" }),
|
|
1967
|
+
/* @__PURE__ */ jsx14(Text14, { color: "gray", children: "(Loading...)" })
|
|
1704
1968
|
] }) }),
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1969
|
+
/* @__PURE__ */ jsx14(Box13, { borderStyle: "single", borderColor: "yellow", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: /* @__PURE__ */ jsx14(Box13, { height: contentHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx14(Box13, { flexDirection: "column", alignItems: "center", children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", alignItems: "center", children: [
|
|
1970
|
+
/* @__PURE__ */ jsxs13(Box13, { height: 1, flexDirection: "row", children: [
|
|
1971
|
+
/* @__PURE__ */ jsx14(Box13, { width: 2, flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx14(Text14, { color: "cyan", children: /* @__PURE__ */ jsx14(SlowSpinner, {}) }) }),
|
|
1972
|
+
/* @__PURE__ */ jsx14(Text14, { color: "cyan", children: refreshing ? "Refreshing..." : sortingLoading ? "Applying sort..." : "Loading repositories..." })
|
|
1709
1973
|
] }),
|
|
1710
|
-
/* @__PURE__ */
|
|
1974
|
+
/* @__PURE__ */ jsx14(Box13, { height: 1, marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "gray", children: refreshing ? "Fetching latest repository data" : sortingLoading ? `Sorting by ${sortKey} (${sortDir === "asc" ? "ascending" : "descending"})` : "Fetching your GitHub repositories" }) })
|
|
1711
1975
|
] }) }) }) }),
|
|
1712
|
-
/* @__PURE__ */
|
|
1976
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "gray", children: "Please wait..." }) })
|
|
1713
1977
|
] });
|
|
1714
1978
|
}
|
|
1715
|
-
return /* @__PURE__ */
|
|
1979
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", height: availableHeight, children: [
|
|
1716
1980
|
headerBar,
|
|
1717
|
-
/* @__PURE__ */
|
|
1981
|
+
/* @__PURE__ */ jsx14(Box13, { borderStyle: "single", borderColor: modalOpen ? "gray" : "yellow", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: deleteMode && deleteTarget ? (
|
|
1718
1982
|
// Centered modal; hide list content while modal is open
|
|
1719
|
-
/* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1984
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, children: "Delete Confirmation" }),
|
|
1985
|
+
/* @__PURE__ */ jsx14(Text14, { color: "red", children: "\u26A0\uFE0F Delete repository?" }),
|
|
1986
|
+
/* @__PURE__ */ jsx14(Box13, { height: 2, children: /* @__PURE__ */ jsx14(Text14, { children: " " }) }),
|
|
1723
1987
|
(() => {
|
|
1724
1988
|
const langName = deleteTarget.primaryLanguage?.name || "";
|
|
1725
1989
|
const langColor = deleteTarget.primaryLanguage?.color || "#666666";
|
|
1726
1990
|
let line1 = "";
|
|
1727
|
-
line1 +=
|
|
1728
|
-
if (deleteTarget.isPrivate) line1 +=
|
|
1729
|
-
if (deleteTarget.isArchived) line1 +=
|
|
1730
|
-
if (deleteTarget.isFork && deleteTarget.parent) line1 +=
|
|
1991
|
+
line1 += chalk11.white(deleteTarget.nameWithOwner);
|
|
1992
|
+
if (deleteTarget.isPrivate) line1 += chalk11.yellow(" Private");
|
|
1993
|
+
if (deleteTarget.isArchived) line1 += chalk11.gray.dim(" Archived");
|
|
1994
|
+
if (deleteTarget.isFork && deleteTarget.parent) line1 += chalk11.blue(` Fork of ${deleteTarget.parent.nameWithOwner}`);
|
|
1731
1995
|
let line2 = "";
|
|
1732
|
-
if (langName) line2 +=
|
|
1733
|
-
line2 +=
|
|
1734
|
-
return /* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
1996
|
+
if (langName) line2 += chalk11.hex(langColor)("\u25CF ") + chalk11.gray(`${langName} `);
|
|
1997
|
+
line2 += chalk11.gray(`\u2605 ${deleteTarget.stargazerCount} \u2442 ${deleteTarget.forkCount} Updated ${formatDate(deleteTarget.updatedAt)}`);
|
|
1998
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
1999
|
+
/* @__PURE__ */ jsx14(Text14, { children: line1 }),
|
|
2000
|
+
/* @__PURE__ */ jsx14(Text14, { children: line2 })
|
|
1737
2001
|
] });
|
|
1738
2002
|
})(),
|
|
1739
|
-
/* @__PURE__ */
|
|
2003
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsxs13(Text14, { children: [
|
|
1740
2004
|
"Type ",
|
|
1741
|
-
/* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ jsx14(Text14, { color: "yellow", bold: true, children: deleteCode }),
|
|
1742
2006
|
" to confirm."
|
|
1743
2007
|
] }) }),
|
|
1744
|
-
!deleteConfirmStage && /* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
|
|
2008
|
+
!deleteConfirmStage && /* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
2009
|
+
/* @__PURE__ */ jsx14(Text14, { children: "Confirm code: " }),
|
|
2010
|
+
/* @__PURE__ */ jsx14(
|
|
2011
|
+
TextInput4,
|
|
1748
2012
|
{
|
|
1749
2013
|
value: typedCode,
|
|
1750
2014
|
onChange: (v) => {
|
|
@@ -1770,11 +2034,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1770
2034
|
}
|
|
1771
2035
|
)
|
|
1772
2036
|
] }),
|
|
1773
|
-
deleteConfirmStage && /* @__PURE__ */
|
|
1774
|
-
/* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
|
|
2037
|
+
deleteConfirmStage && /* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "column", children: [
|
|
2038
|
+
/* @__PURE__ */ jsx14(Text14, { color: "red", children: "This action will permanently delete the repository. This cannot be undone." }),
|
|
2039
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
2040
|
+
/* @__PURE__ */ jsx14(
|
|
2041
|
+
Box13,
|
|
1778
2042
|
{
|
|
1779
2043
|
borderStyle: "round",
|
|
1780
2044
|
borderColor: "red",
|
|
@@ -1783,11 +2047,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1783
2047
|
alignItems: "center",
|
|
1784
2048
|
justifyContent: "center",
|
|
1785
2049
|
flexDirection: "column",
|
|
1786
|
-
children: /* @__PURE__ */
|
|
2050
|
+
children: /* @__PURE__ */ jsx14(Text14, { children: confirmFocus === "delete" ? chalk11.bgRed.white.bold(" Delete ") : chalk11.red.bold("Delete") })
|
|
1787
2051
|
}
|
|
1788
2052
|
),
|
|
1789
|
-
/* @__PURE__ */
|
|
1790
|
-
|
|
2053
|
+
/* @__PURE__ */ jsx14(
|
|
2054
|
+
Box13,
|
|
1791
2055
|
{
|
|
1792
2056
|
borderStyle: "round",
|
|
1793
2057
|
borderColor: confirmFocus === "cancel" ? "white" : "gray",
|
|
@@ -1796,17 +2060,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1796
2060
|
alignItems: "center",
|
|
1797
2061
|
justifyContent: "center",
|
|
1798
2062
|
flexDirection: "column",
|
|
1799
|
-
children: /* @__PURE__ */
|
|
2063
|
+
children: /* @__PURE__ */ jsx14(Text14, { children: confirmFocus === "cancel" ? chalk11.bgGray.white.bold(" Cancel ") : chalk11.gray.bold("Cancel") })
|
|
1800
2064
|
}
|
|
1801
2065
|
)
|
|
1802
2066
|
] }),
|
|
1803
|
-
/* @__PURE__ */
|
|
2067
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
1804
2068
|
"Press Enter to ",
|
|
1805
2069
|
confirmFocus === "delete" ? "Delete" : "Cancel",
|
|
1806
2070
|
" | Y to Delete | C to Cancel"
|
|
1807
2071
|
] }) }),
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
|
|
2072
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(
|
|
2073
|
+
TextInput4,
|
|
1810
2074
|
{
|
|
1811
2075
|
value: "",
|
|
1812
2076
|
onChange: () => {
|
|
@@ -1819,18 +2083,18 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1819
2083
|
}
|
|
1820
2084
|
) })
|
|
1821
2085
|
] }),
|
|
1822
|
-
deleteError && /* @__PURE__ */
|
|
1823
|
-
deleting && /* @__PURE__ */
|
|
2086
|
+
deleteError && /* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "magenta", children: deleteError }) }),
|
|
2087
|
+
deleting && /* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "yellow", children: "Deleting..." }) })
|
|
1824
2088
|
] }) })
|
|
1825
|
-
) : archiveMode && archiveTarget ? /* @__PURE__ */
|
|
1826
|
-
/* @__PURE__ */
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
1831
|
-
/* @__PURE__ */
|
|
1832
|
-
/* @__PURE__ */
|
|
1833
|
-
|
|
2089
|
+
) : archiveMode && archiveTarget ? /* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", borderStyle: "round", borderColor: archiveTarget.isArchived ? "green" : "yellow", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
2090
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, children: archiveTarget.isArchived ? "Unarchive Confirmation" : "Archive Confirmation" }),
|
|
2091
|
+
/* @__PURE__ */ jsx14(Text14, { color: archiveTarget.isArchived ? "green" : "yellow", children: archiveTarget.isArchived ? "\u21BA Unarchive repository?" : "\u26A0\uFE0F Archive repository?" }),
|
|
2092
|
+
/* @__PURE__ */ jsx14(Box13, { height: 1, children: /* @__PURE__ */ jsx14(Text14, { children: " " }) }),
|
|
2093
|
+
/* @__PURE__ */ jsx14(Text14, { children: archiveTarget.nameWithOwner }),
|
|
2094
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { children: archiveTarget.isArchived ? "This will make the repository active again." : "This will make the repository read-only." }) }),
|
|
2095
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
2096
|
+
/* @__PURE__ */ jsx14(
|
|
2097
|
+
Box13,
|
|
1834
2098
|
{
|
|
1835
2099
|
borderStyle: "round",
|
|
1836
2100
|
borderColor: archiveTarget.isArchived ? "green" : "yellow",
|
|
@@ -1839,11 +2103,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1839
2103
|
alignItems: "center",
|
|
1840
2104
|
justifyContent: "center",
|
|
1841
2105
|
flexDirection: "column",
|
|
1842
|
-
children: /* @__PURE__ */
|
|
2106
|
+
children: /* @__PURE__ */ jsx14(Text14, { children: archiveFocus === "confirm" ? chalk11.bgGreen.white.bold(` ${archiveTarget.isArchived ? "Unarchive" : "Archive"} `) : chalk11.bold[archiveTarget.isArchived ? "green" : "yellow"](archiveTarget.isArchived ? "Unarchive" : "Archive") })
|
|
1843
2107
|
}
|
|
1844
2108
|
),
|
|
1845
|
-
/* @__PURE__ */
|
|
1846
|
-
|
|
2109
|
+
/* @__PURE__ */ jsx14(
|
|
2110
|
+
Box13,
|
|
1847
2111
|
{
|
|
1848
2112
|
borderStyle: "round",
|
|
1849
2113
|
borderColor: archiveFocus === "cancel" ? "white" : "gray",
|
|
@@ -1852,19 +2116,19 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1852
2116
|
alignItems: "center",
|
|
1853
2117
|
justifyContent: "center",
|
|
1854
2118
|
flexDirection: "column",
|
|
1855
|
-
children: /* @__PURE__ */
|
|
2119
|
+
children: /* @__PURE__ */ jsx14(Text14, { children: archiveFocus === "cancel" ? chalk11.bgGray.white.bold(" Cancel ") : chalk11.gray.bold("Cancel") })
|
|
1856
2120
|
}
|
|
1857
2121
|
)
|
|
1858
2122
|
] }),
|
|
1859
|
-
/* @__PURE__ */
|
|
2123
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
1860
2124
|
"Press Enter to ",
|
|
1861
2125
|
archiveFocus === "confirm" ? archiveTarget.isArchived ? "Unarchive" : "Archive" : "Cancel",
|
|
1862
2126
|
" | Y to ",
|
|
1863
2127
|
archiveTarget.isArchived ? "Unarchive" : "Archive",
|
|
1864
2128
|
" | C to Cancel"
|
|
1865
2129
|
] }) }),
|
|
1866
|
-
/* @__PURE__ */
|
|
1867
|
-
|
|
2130
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(
|
|
2131
|
+
TextInput4,
|
|
1868
2132
|
{
|
|
1869
2133
|
value: "",
|
|
1870
2134
|
onChange: () => {
|
|
@@ -1878,21 +2142,21 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1878
2142
|
}
|
|
1879
2143
|
}
|
|
1880
2144
|
) }),
|
|
1881
|
-
archiveError && /* @__PURE__ */
|
|
1882
|
-
archiving && /* @__PURE__ */
|
|
1883
|
-
] }) }) : syncMode && syncTarget ? /* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
/* @__PURE__ */
|
|
1887
|
-
/* @__PURE__ */
|
|
1888
|
-
syncTarget.parent && /* @__PURE__ */
|
|
2145
|
+
archiveError && /* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "magenta", children: archiveError }) }),
|
|
2146
|
+
archiving && /* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "yellow", children: archiveTarget.isArchived ? "Unarchiving..." : "Archiving..." }) })
|
|
2147
|
+
] }) }) : syncMode && syncTarget ? /* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "blue", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
2148
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, children: "Sync Fork Confirmation" }),
|
|
2149
|
+
/* @__PURE__ */ jsx14(Text14, { color: "blue", children: "\u27F2 Sync fork with upstream?" }),
|
|
2150
|
+
/* @__PURE__ */ jsx14(Box13, { height: 1, children: /* @__PURE__ */ jsx14(Text14, { children: " " }) }),
|
|
2151
|
+
/* @__PURE__ */ jsx14(Text14, { children: syncTarget.nameWithOwner }),
|
|
2152
|
+
syncTarget.parent && /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
1889
2153
|
"Upstream: ",
|
|
1890
2154
|
syncTarget.parent.nameWithOwner
|
|
1891
2155
|
] }),
|
|
1892
|
-
/* @__PURE__ */
|
|
1893
|
-
/* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
|
|
2156
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { children: "This will merge upstream changes into your fork." }) }),
|
|
2157
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
2158
|
+
/* @__PURE__ */ jsx14(
|
|
2159
|
+
Box13,
|
|
1896
2160
|
{
|
|
1897
2161
|
borderStyle: "round",
|
|
1898
2162
|
borderColor: "blue",
|
|
@@ -1901,11 +2165,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1901
2165
|
alignItems: "center",
|
|
1902
2166
|
justifyContent: "center",
|
|
1903
2167
|
flexDirection: "column",
|
|
1904
|
-
children: /* @__PURE__ */
|
|
2168
|
+
children: /* @__PURE__ */ jsx14(Text14, { children: syncFocus === "confirm" ? chalk11.bgBlue.white.bold(" Sync ") : chalk11.blue.bold("Sync") })
|
|
1905
2169
|
}
|
|
1906
2170
|
),
|
|
1907
|
-
/* @__PURE__ */
|
|
1908
|
-
|
|
2171
|
+
/* @__PURE__ */ jsx14(
|
|
2172
|
+
Box13,
|
|
1909
2173
|
{
|
|
1910
2174
|
borderStyle: "round",
|
|
1911
2175
|
borderColor: syncFocus === "cancel" ? "white" : "gray",
|
|
@@ -1914,17 +2178,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1914
2178
|
alignItems: "center",
|
|
1915
2179
|
justifyContent: "center",
|
|
1916
2180
|
flexDirection: "column",
|
|
1917
|
-
children: /* @__PURE__ */
|
|
2181
|
+
children: /* @__PURE__ */ jsx14(Text14, { children: syncFocus === "cancel" ? chalk11.bgGray.white.bold(" Cancel ") : chalk11.gray.bold("Cancel") })
|
|
1918
2182
|
}
|
|
1919
2183
|
)
|
|
1920
2184
|
] }),
|
|
1921
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
1922
2186
|
"Press Enter to ",
|
|
1923
2187
|
syncFocus === "confirm" ? "Sync" : "Cancel",
|
|
1924
2188
|
" | Y to Sync | C to Cancel"
|
|
1925
2189
|
] }) }),
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
|
|
2190
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(
|
|
2191
|
+
TextInput4,
|
|
1928
2192
|
{
|
|
1929
2193
|
value: "",
|
|
1930
2194
|
onChange: () => {
|
|
@@ -1938,14 +2202,14 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1938
2202
|
}
|
|
1939
2203
|
}
|
|
1940
2204
|
) }),
|
|
1941
|
-
syncError && /* @__PURE__ */
|
|
1942
|
-
syncing && /* @__PURE__ */
|
|
1943
|
-
] }) }) : logoutMode ? /* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
1945
|
-
/* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
|
|
2205
|
+
syncError && /* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "magenta", children: syncError }) }),
|
|
2206
|
+
syncing && /* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "yellow", children: "Syncing..." }) })
|
|
2207
|
+
] }) }) : logoutMode ? /* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
2208
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, children: "Logout Confirmation" }),
|
|
2209
|
+
/* @__PURE__ */ jsx14(Text14, { color: "cyan", children: "Are you sure you want to log out?" }),
|
|
2210
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
2211
|
+
/* @__PURE__ */ jsx14(
|
|
2212
|
+
Box13,
|
|
1949
2213
|
{
|
|
1950
2214
|
borderStyle: "round",
|
|
1951
2215
|
borderColor: "cyan",
|
|
@@ -1954,11 +2218,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1954
2218
|
alignItems: "center",
|
|
1955
2219
|
justifyContent: "center",
|
|
1956
2220
|
flexDirection: "column",
|
|
1957
|
-
children: /* @__PURE__ */
|
|
2221
|
+
children: /* @__PURE__ */ jsx14(Text14, { children: logoutFocus === "confirm" ? chalk11.bgCyan.white.bold(" Logout ") : chalk11.cyan.bold("Logout") })
|
|
1958
2222
|
}
|
|
1959
2223
|
),
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
|
|
2224
|
+
/* @__PURE__ */ jsx14(
|
|
2225
|
+
Box13,
|
|
1962
2226
|
{
|
|
1963
2227
|
borderStyle: "round",
|
|
1964
2228
|
borderColor: logoutFocus === "cancel" ? "white" : "gray",
|
|
@@ -1967,16 +2231,16 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1967
2231
|
alignItems: "center",
|
|
1968
2232
|
justifyContent: "center",
|
|
1969
2233
|
flexDirection: "column",
|
|
1970
|
-
children: /* @__PURE__ */
|
|
2234
|
+
children: /* @__PURE__ */ jsx14(Text14, { children: logoutFocus === "cancel" ? chalk11.bgGray.white.bold(" Cancel ") : chalk11.gray.bold("Cancel") })
|
|
1971
2235
|
}
|
|
1972
2236
|
)
|
|
1973
2237
|
] }),
|
|
1974
|
-
/* @__PURE__ */
|
|
2238
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
1975
2239
|
"Press Enter to ",
|
|
1976
2240
|
logoutFocus === "confirm" ? "Logout" : "Cancel",
|
|
1977
2241
|
" | Y to Logout | C to Cancel"
|
|
1978
2242
|
] }) })
|
|
1979
|
-
] }) }) : orgSwitcherOpen ? /* @__PURE__ */
|
|
2243
|
+
] }) }) : orgSwitcherOpen ? /* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx14(
|
|
1980
2244
|
OrgSwitcher,
|
|
1981
2245
|
{
|
|
1982
2246
|
token,
|
|
@@ -1984,49 +2248,49 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1984
2248
|
onSelect: handleOrgContextChange,
|
|
1985
2249
|
onClose: () => setOrgSwitcherOpen(false)
|
|
1986
2250
|
}
|
|
1987
|
-
) }) : infoMode ? /* @__PURE__ */
|
|
2251
|
+
) }) : infoMode ? /* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: (() => {
|
|
1988
2252
|
const repo = infoRepo || visibleItems[cursor];
|
|
1989
|
-
if (!repo) return /* @__PURE__ */
|
|
2253
|
+
if (!repo) return /* @__PURE__ */ jsx14(Text14, { color: "red", children: "No repository selected." });
|
|
1990
2254
|
const langName = repo.primaryLanguage?.name || "N/A";
|
|
1991
2255
|
const langColor = repo.primaryLanguage?.color || "#666666";
|
|
1992
|
-
return /* @__PURE__ */
|
|
1993
|
-
/* @__PURE__ */
|
|
2256
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 90), children: [
|
|
2257
|
+
/* @__PURE__ */ jsxs13(Text14, { bold: true, children: [
|
|
1994
2258
|
"Repository Info ",
|
|
1995
|
-
infoRepo ?
|
|
2259
|
+
infoRepo ? chalk11.dim("(cached)") : ""
|
|
1996
2260
|
] }),
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
/* @__PURE__ */
|
|
1999
|
-
repo.description && /* @__PURE__ */
|
|
2000
|
-
/* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
2002
|
-
repo.visibility === "PRIVATE" ?
|
|
2003
|
-
repo.isArchived ?
|
|
2004
|
-
repo.isFork ?
|
|
2261
|
+
/* @__PURE__ */ jsx14(Box13, { height: 1, children: /* @__PURE__ */ jsx14(Text14, { children: " " }) }),
|
|
2262
|
+
/* @__PURE__ */ jsx14(Text14, { children: chalk11.bold(repo.nameWithOwner) }),
|
|
2263
|
+
repo.description && /* @__PURE__ */ jsx14(Text14, { color: "gray", children: repo.description }),
|
|
2264
|
+
/* @__PURE__ */ jsx14(Box13, { height: 1, children: /* @__PURE__ */ jsx14(Text14, { children: " " }) }),
|
|
2265
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
2266
|
+
repo.visibility === "PRIVATE" ? chalk11.yellow("Private") : repo.visibility === "INTERNAL" ? chalk11.magenta("Internal") : chalk11.green("Public"),
|
|
2267
|
+
repo.isArchived ? chalk11.gray(" Archived") : "",
|
|
2268
|
+
repo.isFork ? chalk11.blue(" Fork") : ""
|
|
2005
2269
|
] }),
|
|
2006
|
-
/* @__PURE__ */
|
|
2007
|
-
/* @__PURE__ */
|
|
2008
|
-
|
|
2009
|
-
|
|
2270
|
+
/* @__PURE__ */ jsx14(Text14, { children: chalk11.gray(`\u2605 ${repo.stargazerCount} \u2442 ${repo.forkCount}`) }),
|
|
2271
|
+
/* @__PURE__ */ jsxs13(Text14, { children: [
|
|
2272
|
+
chalk11.hex(langColor)(`\u25CF `),
|
|
2273
|
+
chalk11.gray(`${langName}`)
|
|
2010
2274
|
] }),
|
|
2011
|
-
/* @__PURE__ */
|
|
2275
|
+
/* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
2012
2276
|
"Updated: ",
|
|
2013
2277
|
formatDate(repo.updatedAt),
|
|
2014
2278
|
" \u2022 Pushed: ",
|
|
2015
2279
|
formatDate(repo.pushedAt)
|
|
2016
2280
|
] }),
|
|
2017
|
-
/* @__PURE__ */
|
|
2281
|
+
/* @__PURE__ */ jsxs13(Text14, { color: "gray", children: [
|
|
2018
2282
|
"Size: ",
|
|
2019
2283
|
repo.diskUsage,
|
|
2020
2284
|
" KB"
|
|
2021
2285
|
] }),
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
2286
|
+
/* @__PURE__ */ jsx14(Box13, { height: 1, children: /* @__PURE__ */ jsx14(Text14, { children: " " }) }),
|
|
2287
|
+
/* @__PURE__ */ jsx14(Text14, { color: "gray", children: "Press Esc or I to close" })
|
|
2024
2288
|
] });
|
|
2025
|
-
})() }) : visibilityMode ? /* @__PURE__ */
|
|
2289
|
+
})() }) : visibilityMode ? /* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx14(
|
|
2026
2290
|
VisibilityModal,
|
|
2027
2291
|
{
|
|
2028
2292
|
currentFilter: visibilityFilter,
|
|
2029
|
-
|
|
2293
|
+
isEnterprise: isEnterpriseOrg,
|
|
2030
2294
|
onSelect: (filter2) => {
|
|
2031
2295
|
setVisibilityFilter(filter2);
|
|
2032
2296
|
setVisibilityMode(false);
|
|
@@ -2035,7 +2299,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2035
2299
|
},
|
|
2036
2300
|
onCancel: () => setVisibilityMode(false)
|
|
2037
2301
|
}
|
|
2038
|
-
) }) : sortMode ? /* @__PURE__ */
|
|
2302
|
+
) }) : sortMode ? /* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx14(
|
|
2039
2303
|
SortModal,
|
|
2040
2304
|
{
|
|
2041
2305
|
currentSort: sortKey,
|
|
@@ -2047,8 +2311,21 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2047
2311
|
},
|
|
2048
2312
|
onCancel: () => setSortMode(false)
|
|
2049
2313
|
}
|
|
2050
|
-
) }) : /* @__PURE__ */
|
|
2051
|
-
|
|
2314
|
+
) }) : changeVisibilityMode && changeVisibilityTarget ? /* @__PURE__ */ jsx14(Box13, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx14(
|
|
2315
|
+
ChangeVisibilityModal,
|
|
2316
|
+
{
|
|
2317
|
+
isOpen: changeVisibilityMode,
|
|
2318
|
+
repoName: changeVisibilityTarget.nameWithOwner,
|
|
2319
|
+
currentVisibility: changeVisibilityTarget.visibility,
|
|
2320
|
+
isFork: changeVisibilityTarget.isFork,
|
|
2321
|
+
isEnterprise: isEnterpriseOrg,
|
|
2322
|
+
onVisibilityChange: handleVisibilityChange,
|
|
2323
|
+
onClose: closeChangeVisibilityModal,
|
|
2324
|
+
changing: changingVisibility,
|
|
2325
|
+
error: changeVisibilityError
|
|
2326
|
+
}
|
|
2327
|
+
) }) : /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
2328
|
+
/* @__PURE__ */ jsx14(
|
|
2052
2329
|
RepoListHeader,
|
|
2053
2330
|
{
|
|
2054
2331
|
ownerContext,
|
|
@@ -2058,13 +2335,14 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2058
2335
|
filter,
|
|
2059
2336
|
searchActive,
|
|
2060
2337
|
searchLoading,
|
|
2061
|
-
visibilityFilter
|
|
2338
|
+
visibilityFilter,
|
|
2339
|
+
isEnterprise: isEnterpriseOrg
|
|
2062
2340
|
}
|
|
2063
2341
|
),
|
|
2064
|
-
filterMode && /* @__PURE__ */
|
|
2065
|
-
/* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
2067
|
-
|
|
2342
|
+
filterMode && /* @__PURE__ */ jsxs13(Box13, { marginBottom: 1, children: [
|
|
2343
|
+
/* @__PURE__ */ jsx14(Text14, { children: "Search: " }),
|
|
2344
|
+
/* @__PURE__ */ jsx14(
|
|
2345
|
+
TextInput4,
|
|
2068
2346
|
{
|
|
2069
2347
|
value: filter,
|
|
2070
2348
|
onChange: (val) => {
|
|
@@ -2103,10 +2381,10 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2103
2381
|
}
|
|
2104
2382
|
)
|
|
2105
2383
|
] }),
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
filterMode && filter.trim().length > 0 && filter.trim().length < 3 ? /* @__PURE__ */
|
|
2384
|
+
/* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", height: listHeight, children: [
|
|
2385
|
+
filterMode && filter.trim().length > 0 && filter.trim().length < 3 ? /* @__PURE__ */ jsx14(Box13, { justifyContent: "center", alignItems: "center", flexGrow: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "gray", dimColor: true, children: "Type at least 3 characters to search" }) }) : visibleItems.slice(windowed.start, windowed.end).map((repo, i) => {
|
|
2108
2386
|
const idx = windowed.start + i;
|
|
2109
|
-
return /* @__PURE__ */
|
|
2387
|
+
return /* @__PURE__ */ jsx14(
|
|
2110
2388
|
RepoRow,
|
|
2111
2389
|
{
|
|
2112
2390
|
repo,
|
|
@@ -2119,45 +2397,45 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2119
2397
|
repo.nameWithOwner
|
|
2120
2398
|
);
|
|
2121
2399
|
}),
|
|
2122
|
-
loadingMore && hasNextPage && /* @__PURE__ */
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
2400
|
+
loadingMore && hasNextPage && /* @__PURE__ */ jsx14(Box13, { justifyContent: "center", alignItems: "center", marginTop: 1, children: /* @__PURE__ */ jsxs13(Box13, { flexDirection: "row", children: [
|
|
2401
|
+
/* @__PURE__ */ jsx14(Box13, { width: 2, flexShrink: 0, flexGrow: 0, marginRight: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "cyan", children: /* @__PURE__ */ jsx14(SlowSpinner, {}) }) }),
|
|
2402
|
+
/* @__PURE__ */ jsx14(Text14, { color: "cyan", children: "Loading more repositories..." })
|
|
2125
2403
|
] }) }),
|
|
2126
|
-
!loading && !searchLoading && visibleItems.length === 0 && /* @__PURE__ */
|
|
2404
|
+
!loading && !searchLoading && visibleItems.length === 0 && /* @__PURE__ */ jsx14(Box13, { justifyContent: "center", alignItems: "center", flexGrow: 1, children: /* @__PURE__ */ jsx14(Text14, { color: "gray", dimColor: true, children: searchActive ? "No repositories match your search" : filter ? "No repositories match your filter" : "No repositories found" }) })
|
|
2127
2405
|
] })
|
|
2128
2406
|
] }) }),
|
|
2129
|
-
/* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2132
|
-
/* @__PURE__ */
|
|
2407
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, paddingX: 1, flexDirection: "column", children: [
|
|
2408
|
+
/* @__PURE__ */ jsx14(Box13, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx14(Text14, { color: "gray", dimColor: modalOpen ? true : void 0, children: "\u2191\u2193 Navigate \u2022 \u23CE/O Open \u2022 R Refresh \u2022 W Org Switch \u2022 Ctrl+L Logout \u2022 Q Quit" }) }),
|
|
2409
|
+
/* @__PURE__ */ jsx14(Box13, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx14(Text14, { color: "gray", dimColor: modalOpen ? true : void 0, children: "Ctrl+G Top \u2022 G Bottom \u2022 / Search \u2022 S Sort \u2022 D Direction \u2022 T Density \u2022 F Fork Status \u2022 V Visibility" }) }),
|
|
2410
|
+
/* @__PURE__ */ jsx14(Box13, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx14(Text14, { color: "gray", dimColor: modalOpen ? true : void 0, children: "I Info \u2022 K Cache Info \u2022 Ctrl+A Un/Archive \u2022 Ctrl+V Change Visibility \u2022 Del/Backspace Delete \u2022 Ctrl+S Sync Fork" }) })
|
|
2133
2411
|
] }),
|
|
2134
|
-
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */
|
|
2135
|
-
/* @__PURE__ */
|
|
2136
|
-
debugMessages.length === 0 ? /* @__PURE__ */
|
|
2412
|
+
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */ jsxs13(Box13, { marginTop: 1, borderStyle: "single", borderColor: "yellow", paddingX: 1, flexDirection: "column", children: [
|
|
2413
|
+
/* @__PURE__ */ jsx14(Text14, { bold: true, color: "yellow", children: "Debug Messages:" }),
|
|
2414
|
+
debugMessages.length === 0 ? /* @__PURE__ */ jsx14(Text14, { color: "gray", children: "No debug messages yet..." }) : debugMessages.map((msg, i) => /* @__PURE__ */ jsx14(Text14, { color: "gray", children: msg }, i))
|
|
2137
2415
|
] })
|
|
2138
2416
|
] });
|
|
2139
2417
|
}
|
|
2140
2418
|
|
|
2141
2419
|
// src/ui/App.tsx
|
|
2142
|
-
import { jsx as
|
|
2420
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2143
2421
|
var packageJson = require_package();
|
|
2144
2422
|
function App() {
|
|
2145
2423
|
const { exit } = useApp2();
|
|
2146
2424
|
const { stdout } = useStdout2();
|
|
2147
|
-
const [mode, setMode] =
|
|
2148
|
-
const [token, setToken] =
|
|
2149
|
-
const [input, setInput] =
|
|
2150
|
-
const [error, setError] =
|
|
2151
|
-
const [viewer, setViewer] =
|
|
2152
|
-
const [rateLimitReset, setRateLimitReset] =
|
|
2153
|
-
const [wasRateLimited, setWasRateLimited] =
|
|
2154
|
-
const [orgContext, setOrgContext] =
|
|
2155
|
-
const [dims, setDims] =
|
|
2425
|
+
const [mode, setMode] = useState11("checking");
|
|
2426
|
+
const [token, setToken] = useState11(null);
|
|
2427
|
+
const [input, setInput] = useState11("");
|
|
2428
|
+
const [error, setError] = useState11(null);
|
|
2429
|
+
const [viewer, setViewer] = useState11(null);
|
|
2430
|
+
const [rateLimitReset, setRateLimitReset] = useState11(null);
|
|
2431
|
+
const [wasRateLimited, setWasRateLimited] = useState11(false);
|
|
2432
|
+
const [orgContext, setOrgContext] = useState11("personal");
|
|
2433
|
+
const [dims, setDims] = useState11(() => {
|
|
2156
2434
|
const cols = stdout?.columns ?? 100;
|
|
2157
2435
|
const rows = stdout?.rows ?? 30;
|
|
2158
2436
|
return { cols, rows };
|
|
2159
2437
|
});
|
|
2160
|
-
|
|
2438
|
+
useEffect8(() => {
|
|
2161
2439
|
if (!stdout) return;
|
|
2162
2440
|
const onResize = () => {
|
|
2163
2441
|
const cols = stdout.columns ?? 100;
|
|
@@ -2169,7 +2447,7 @@ function App() {
|
|
|
2169
2447
|
stdout.off?.("resize", onResize);
|
|
2170
2448
|
};
|
|
2171
2449
|
}, [stdout]);
|
|
2172
|
-
|
|
2450
|
+
useEffect8(() => {
|
|
2173
2451
|
const env = getTokenFromEnv();
|
|
2174
2452
|
const stored = getStoredToken();
|
|
2175
2453
|
if (env) {
|
|
@@ -2182,7 +2460,7 @@ function App() {
|
|
|
2182
2460
|
setMode("prompt");
|
|
2183
2461
|
}
|
|
2184
2462
|
}, []);
|
|
2185
|
-
|
|
2463
|
+
useEffect8(() => {
|
|
2186
2464
|
(async () => {
|
|
2187
2465
|
if (mode !== "validating" || !token) return;
|
|
2188
2466
|
const timeoutId = setTimeout(() => {
|
|
@@ -2274,7 +2552,7 @@ function App() {
|
|
|
2274
2552
|
setInput("");
|
|
2275
2553
|
setMode("prompt");
|
|
2276
2554
|
};
|
|
2277
|
-
|
|
2555
|
+
useInput11((input2, key) => {
|
|
2278
2556
|
if (mode === "prompt" && key.escape) {
|
|
2279
2557
|
exit();
|
|
2280
2558
|
}
|
|
@@ -2299,19 +2577,19 @@ function App() {
|
|
|
2299
2577
|
}
|
|
2300
2578
|
});
|
|
2301
2579
|
const verticalPadding = Math.floor(dims.rows * 0.15);
|
|
2302
|
-
const header = useMemo2(() => /* @__PURE__ */
|
|
2303
|
-
/* @__PURE__ */
|
|
2304
|
-
/* @__PURE__ */
|
|
2580
|
+
const header = useMemo2(() => /* @__PURE__ */ jsxs14(Box14, { flexDirection: "row", justifyContent: "space-between", marginBottom: 1, children: [
|
|
2581
|
+
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "row", gap: 1, children: [
|
|
2582
|
+
/* @__PURE__ */ jsxs14(Text15, { bold: true, color: "cyan", children: [
|
|
2305
2583
|
" ",
|
|
2306
2584
|
"GitHub Repository Manager"
|
|
2307
2585
|
] }),
|
|
2308
|
-
/* @__PURE__ */
|
|
2586
|
+
/* @__PURE__ */ jsxs14(Text15, { color: "gray", dimColor: true, children: [
|
|
2309
2587
|
"v",
|
|
2310
2588
|
packageJson.version
|
|
2311
2589
|
] }),
|
|
2312
|
-
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */
|
|
2590
|
+
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */ jsx15(Text15, { backgroundColor: "blue", color: "white", children: " debug mode " })
|
|
2313
2591
|
] }),
|
|
2314
|
-
viewer && /* @__PURE__ */
|
|
2592
|
+
viewer && /* @__PURE__ */ jsx15(Text15, { color: "gray", children: orgContext !== "personal" && orgContext.login ? `${orgContext.login}/@${viewer} ` : `@${viewer} ` })
|
|
2315
2593
|
] }), [viewer, orgContext]);
|
|
2316
2594
|
if (mode === "rate_limited") {
|
|
2317
2595
|
const formatResetTime = (resetTime) => {
|
|
@@ -2334,56 +2612,56 @@ function App() {
|
|
|
2334
2612
|
return "Unknown";
|
|
2335
2613
|
}
|
|
2336
2614
|
};
|
|
2337
|
-
return /* @__PURE__ */
|
|
2615
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2338
2616
|
header,
|
|
2339
|
-
/* @__PURE__ */
|
|
2340
|
-
/* @__PURE__ */
|
|
2341
|
-
/* @__PURE__ */
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
rateLimitReset && /* @__PURE__ */
|
|
2344
|
-
/* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2617
|
+
/* @__PURE__ */ jsx15(Box14, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs14(Box14, { borderStyle: "single", borderColor: "yellow", paddingX: 3, paddingY: 2, flexDirection: "column", width: Math.min(dims.cols - 8, 80), children: [
|
|
2618
|
+
/* @__PURE__ */ jsx15(Text15, { bold: true, color: "yellow", marginBottom: 1, children: "\u26A0\uFE0F Rate Limit Exceeded" }),
|
|
2619
|
+
/* @__PURE__ */ jsx15(Text15, { color: "gray", marginBottom: 1, children: "You've hit GitHub's API rate limit for your token." }),
|
|
2620
|
+
/* @__PURE__ */ jsx15(Text15, { color: "gray", marginBottom: 1, children: "This happens when you make too many requests in a short time." }),
|
|
2621
|
+
rateLimitReset && /* @__PURE__ */ jsxs14(Box14, { marginTop: 1, marginBottom: 1, children: [
|
|
2622
|
+
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
2623
|
+
/* @__PURE__ */ jsx15(Text15, { color: "cyan", children: "Reset in:" }),
|
|
2346
2624
|
" ",
|
|
2347
|
-
/* @__PURE__ */
|
|
2625
|
+
/* @__PURE__ */ jsx15(Text15, { bold: true, children: formatResetTime(rateLimitReset) })
|
|
2348
2626
|
] }),
|
|
2349
|
-
/* @__PURE__ */
|
|
2627
|
+
/* @__PURE__ */ jsxs14(Text15, { color: "gray", dimColor: true, children: [
|
|
2350
2628
|
"(",
|
|
2351
2629
|
new Date(rateLimitReset).toLocaleTimeString(),
|
|
2352
2630
|
")"
|
|
2353
2631
|
] })
|
|
2354
2632
|
] }),
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
2357
|
-
/* @__PURE__ */
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */
|
|
2633
|
+
/* @__PURE__ */ jsxs14(Box14, { marginTop: 2, flexDirection: "column", gap: 1, children: [
|
|
2634
|
+
/* @__PURE__ */ jsx15(Text15, { bold: true, children: "What would you like to do?" }),
|
|
2635
|
+
/* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", paddingLeft: 2, children: [
|
|
2636
|
+
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
2637
|
+
/* @__PURE__ */ jsx15(Text15, { color: "cyan", bold: true, children: "R" }),
|
|
2360
2638
|
" - Retry now ",
|
|
2361
2639
|
rateLimitReset && formatResetTime(rateLimitReset) !== "Now (should be reset)" ? "(likely to fail until reset)" : "(should work now)"
|
|
2362
2640
|
] }),
|
|
2363
|
-
/* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2641
|
+
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
2642
|
+
/* @__PURE__ */ jsx15(Text15, { color: "cyan", bold: true, children: "L" }),
|
|
2365
2643
|
" - Logout and use a different token"
|
|
2366
2644
|
] }),
|
|
2367
|
-
/* @__PURE__ */
|
|
2368
|
-
/* @__PURE__ */
|
|
2645
|
+
/* @__PURE__ */ jsxs14(Text15, { children: [
|
|
2646
|
+
/* @__PURE__ */ jsx15(Text15, { color: "gray", bold: true, children: "Q/Esc" }),
|
|
2369
2647
|
" - Quit application"
|
|
2370
2648
|
] })
|
|
2371
2649
|
] })
|
|
2372
2650
|
] }),
|
|
2373
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ jsx15(Text15, { color: "gray", dimColor: true, marginTop: 2, children: "Tip: Using multiple tokens or waiting between requests can help avoid rate limits." })
|
|
2374
2652
|
] }) })
|
|
2375
2653
|
] });
|
|
2376
2654
|
}
|
|
2377
2655
|
if (mode === "prompt") {
|
|
2378
|
-
return /* @__PURE__ */
|
|
2656
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2379
2657
|
header,
|
|
2380
|
-
/* @__PURE__ */
|
|
2381
|
-
/* @__PURE__ */
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
|
|
2658
|
+
/* @__PURE__ */ jsx15(Box14, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs14(Box14, { borderStyle: "single", borderColor: "cyan", paddingX: 2, paddingY: 1, flexDirection: "column", children: [
|
|
2659
|
+
/* @__PURE__ */ jsx15(Text15, { bold: true, marginBottom: 1, children: "Authentication Required" }),
|
|
2660
|
+
/* @__PURE__ */ jsx15(Text15, { color: "gray", marginBottom: 1, children: "Enter your GitHub Personal Access Token" }),
|
|
2661
|
+
/* @__PURE__ */ jsxs14(Box14, { children: [
|
|
2662
|
+
/* @__PURE__ */ jsx15(Text15, { children: "Token: " }),
|
|
2663
|
+
/* @__PURE__ */ jsx15(
|
|
2664
|
+
TextInput5,
|
|
2387
2665
|
{
|
|
2388
2666
|
value: input,
|
|
2389
2667
|
onChange: setInput,
|
|
@@ -2392,30 +2670,30 @@ function App() {
|
|
|
2392
2670
|
}
|
|
2393
2671
|
)
|
|
2394
2672
|
] }),
|
|
2395
|
-
error && /* @__PURE__ */
|
|
2396
|
-
/* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2673
|
+
error && /* @__PURE__ */ jsx15(Text15, { color: "red", marginTop: 1, children: error }),
|
|
2674
|
+
/* @__PURE__ */ jsx15(Text15, { color: "gray", dimColor: true, marginTop: 1, children: "The token will be stored securely in your local config" }),
|
|
2675
|
+
/* @__PURE__ */ jsx15(Text15, { color: "gray", dimColor: true, marginTop: 1, children: "Press Esc to quit" })
|
|
2398
2676
|
] }) })
|
|
2399
2677
|
] });
|
|
2400
2678
|
}
|
|
2401
2679
|
if (mode === "validating" || mode === "checking") {
|
|
2402
|
-
return /* @__PURE__ */
|
|
2680
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2403
2681
|
header,
|
|
2404
|
-
/* @__PURE__ */
|
|
2405
|
-
/* @__PURE__ */
|
|
2406
|
-
mode === "validating" && /* @__PURE__ */
|
|
2682
|
+
/* @__PURE__ */ jsx15(Box14, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", alignItems: "center", children: [
|
|
2683
|
+
/* @__PURE__ */ jsx15(Text15, { color: "yellow", children: "Validating token..." }),
|
|
2684
|
+
mode === "validating" && /* @__PURE__ */ jsx15(Text15, { color: "gray", dimColor: true, marginTop: 1, children: "Press Esc to cancel" })
|
|
2407
2685
|
] }) })
|
|
2408
2686
|
] });
|
|
2409
2687
|
}
|
|
2410
2688
|
if (mode === "error") {
|
|
2411
|
-
return /* @__PURE__ */
|
|
2689
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2412
2690
|
header,
|
|
2413
|
-
/* @__PURE__ */
|
|
2691
|
+
/* @__PURE__ */ jsx15(Box14, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx15(Text15, { color: "red", children: error ?? "Unexpected error" }) })
|
|
2414
2692
|
] });
|
|
2415
2693
|
}
|
|
2416
|
-
return /* @__PURE__ */
|
|
2694
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2417
2695
|
header,
|
|
2418
|
-
/* @__PURE__ */
|
|
2696
|
+
/* @__PURE__ */ jsx15(
|
|
2419
2697
|
RepoList,
|
|
2420
2698
|
{
|
|
2421
2699
|
token,
|
|
@@ -2429,7 +2707,7 @@ function App() {
|
|
|
2429
2707
|
}
|
|
2430
2708
|
|
|
2431
2709
|
// src/index.tsx
|
|
2432
|
-
import { jsx as
|
|
2710
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2433
2711
|
var argv = process.argv.slice(2);
|
|
2434
2712
|
if (argv.includes("--version") || argv.includes("-v")) {
|
|
2435
2713
|
const version = import_package.default?.version || "0.0.0";
|
|
@@ -2464,8 +2742,8 @@ process.on("unhandledRejection", (reason) => {
|
|
|
2464
2742
|
process.exit(1);
|
|
2465
2743
|
});
|
|
2466
2744
|
render(
|
|
2467
|
-
/* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2469
|
-
/* @__PURE__ */
|
|
2745
|
+
/* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", children: [
|
|
2746
|
+
/* @__PURE__ */ jsx16(App, {}),
|
|
2747
|
+
/* @__PURE__ */ jsx16(Text16, { color: "gray" })
|
|
2470
2748
|
] })
|
|
2471
2749
|
);
|