gh-manager-cli 1.23.0 → 1.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +9 -9
- package/dist/{chunk-GFBV3TQA.js → chunk-4A3TGHG7.js} +53 -3
- package/dist/{github-O7QMBYSD.js → github-64JCWV7P.js} +5 -1
- package/dist/index.js +772 -400
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,21 +15,23 @@ import {
|
|
|
15
15
|
logger,
|
|
16
16
|
makeClient,
|
|
17
17
|
purgeApolloCacheFiles,
|
|
18
|
+
renameRepositoryById,
|
|
18
19
|
searchRepositoriesUnified,
|
|
19
20
|
syncForkWithUpstream,
|
|
20
21
|
unarchiveRepositoryById,
|
|
21
22
|
updateCacheAfterArchive,
|
|
22
23
|
updateCacheAfterDelete,
|
|
24
|
+
updateCacheAfterRename,
|
|
23
25
|
updateCacheAfterVisibilityChange,
|
|
24
26
|
updateCacheWithRepository
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4A3TGHG7.js";
|
|
26
28
|
|
|
27
29
|
// package.json
|
|
28
30
|
var require_package = __commonJS({
|
|
29
31
|
"package.json"(exports, module) {
|
|
30
32
|
module.exports = {
|
|
31
33
|
name: "gh-manager-cli",
|
|
32
|
-
version: "1.
|
|
34
|
+
version: "1.24.1",
|
|
33
35
|
private: false,
|
|
34
36
|
description: "Interactive CLI to manage your GitHub repos (personal) with Ink",
|
|
35
37
|
license: "MIT",
|
|
@@ -154,15 +156,15 @@ var require_package = __commonJS({
|
|
|
154
156
|
|
|
155
157
|
// src/index.tsx
|
|
156
158
|
var import_package = __toESM(require_package(), 1);
|
|
157
|
-
import { render, Box as
|
|
159
|
+
import { render, Box as Box19, Text as Text20 } from "ink";
|
|
158
160
|
import "dotenv/config";
|
|
159
161
|
|
|
160
162
|
// src/ui/App.tsx
|
|
161
|
-
import { useEffect as
|
|
162
|
-
import { Box as
|
|
163
|
-
import
|
|
163
|
+
import { useEffect as useEffect9, useMemo as useMemo2, useState as useState14 } from "react";
|
|
164
|
+
import { Box as Box18, Text as Text19, useApp as useApp2, useStdout as useStdout2, useInput as useInput14 } from "ink";
|
|
165
|
+
import TextInput6 from "ink-text-input";
|
|
164
166
|
|
|
165
|
-
// src/config.ts
|
|
167
|
+
// src/config/config.ts
|
|
166
168
|
import fs from "fs";
|
|
167
169
|
import path from "path";
|
|
168
170
|
import envPaths from "env-paths";
|
|
@@ -219,10 +221,10 @@ function storeUIPrefs(patch) {
|
|
|
219
221
|
writeConfig({ ...existing, ui: mergedUI });
|
|
220
222
|
}
|
|
221
223
|
|
|
222
|
-
// src/oauth.ts
|
|
224
|
+
// src/services/oauth.ts
|
|
223
225
|
import open from "open";
|
|
224
226
|
|
|
225
|
-
// src/constants.ts
|
|
227
|
+
// src/config/constants.ts
|
|
226
228
|
var OAUTH_CONFIG = {
|
|
227
229
|
// GitHub OAuth App Client ID (public, safe to include in client)
|
|
228
230
|
// You'll need to register an OAuth App on GitHub and replace this with your client ID
|
|
@@ -264,7 +266,7 @@ var OAUTH_CONFIG = {
|
|
|
264
266
|
// 5 seconds (GitHub's default)
|
|
265
267
|
};
|
|
266
268
|
|
|
267
|
-
// src/oauth.ts
|
|
269
|
+
// src/services/oauth.ts
|
|
268
270
|
async function pollForAccessToken(deviceCodeResponse) {
|
|
269
271
|
try {
|
|
270
272
|
const token = await pollForToken(deviceCodeResponse);
|
|
@@ -404,13 +406,13 @@ async function openGitHubAuthorizationPage() {
|
|
|
404
406
|
await open(authUrl);
|
|
405
407
|
}
|
|
406
408
|
|
|
407
|
-
// src/ui/RepoList.tsx
|
|
408
|
-
import
|
|
409
|
-
import { Box as
|
|
410
|
-
import
|
|
411
|
-
import
|
|
409
|
+
// src/ui/views/RepoList.tsx
|
|
410
|
+
import React12, { useEffect as useEffect8, useMemo, useState as useState12, useRef, useCallback } from "react";
|
|
411
|
+
import { Box as Box15, Text as Text16, useApp, useInput as useInput12, useStdout } from "ink";
|
|
412
|
+
import TextInput5 from "ink-text-input";
|
|
413
|
+
import chalk12 from "chalk";
|
|
412
414
|
|
|
413
|
-
// src/apolloMeta.ts
|
|
415
|
+
// src/services/apolloMeta.ts
|
|
414
416
|
import fs2 from "fs";
|
|
415
417
|
import path2 from "path";
|
|
416
418
|
import envPaths2 from "env-paths";
|
|
@@ -465,7 +467,7 @@ function markFetched(key) {
|
|
|
465
467
|
writeMeta(meta);
|
|
466
468
|
}
|
|
467
469
|
|
|
468
|
-
// src/ui/RepoList.tsx
|
|
470
|
+
// src/ui/views/RepoList.tsx
|
|
469
471
|
import { exec } from "child_process";
|
|
470
472
|
|
|
471
473
|
// src/ui/OrgSwitcher.tsx
|
|
@@ -486,7 +488,7 @@ function OrgSwitcher({ token, currentContext, onSelect, onClose }) {
|
|
|
486
488
|
try {
|
|
487
489
|
setLoading(true);
|
|
488
490
|
setError(null);
|
|
489
|
-
const client = await import("./github-
|
|
491
|
+
const client = await import("./github-64JCWV7P.js").then((m) => m.makeClient(token));
|
|
490
492
|
const orgs = await fetchViewerOrganizations(client);
|
|
491
493
|
setOrganizations(orgs);
|
|
492
494
|
const entOrgs = /* @__PURE__ */ new Set();
|
|
@@ -620,7 +622,7 @@ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-run
|
|
|
620
622
|
import { Box as Box5, Text as Text6, useInput as useInput5 } from "ink";
|
|
621
623
|
import chalk5 from "chalk";
|
|
622
624
|
|
|
623
|
-
// src/utils.ts
|
|
625
|
+
// src/lib/utils.ts
|
|
624
626
|
function truncate(str, max = 80) {
|
|
625
627
|
if (str.length <= max) return str;
|
|
626
628
|
return str.slice(0, Math.max(0, max - 1)) + "\u2026";
|
|
@@ -637,6 +639,51 @@ function formatDate(dateStr) {
|
|
|
637
639
|
if (diffDays < 365) return `${Math.floor(diffDays / 30)} months ago`;
|
|
638
640
|
return `${Math.floor(diffDays / 365)} years ago`;
|
|
639
641
|
}
|
|
642
|
+
async function copyToClipboard(text) {
|
|
643
|
+
try {
|
|
644
|
+
const clipboardy = await import("clipboardy");
|
|
645
|
+
await clipboardy.write(text);
|
|
646
|
+
return;
|
|
647
|
+
} catch (error) {
|
|
648
|
+
const { spawn } = await import("child_process");
|
|
649
|
+
const { promisify } = await import("util");
|
|
650
|
+
const spawnCommand = (command, args = []) => {
|
|
651
|
+
return new Promise((resolve, reject) => {
|
|
652
|
+
const child = spawn(command, args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
653
|
+
child.stdin.write(text);
|
|
654
|
+
child.stdin.end();
|
|
655
|
+
child.on("close", (code) => {
|
|
656
|
+
if (code === 0) {
|
|
657
|
+
resolve();
|
|
658
|
+
} else {
|
|
659
|
+
reject(new Error(`Command failed with code ${code}`));
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
child.on("error", reject);
|
|
663
|
+
});
|
|
664
|
+
};
|
|
665
|
+
try {
|
|
666
|
+
const platform = process.platform;
|
|
667
|
+
if (platform === "darwin") {
|
|
668
|
+
await spawnCommand("pbcopy");
|
|
669
|
+
} else if (platform === "win32") {
|
|
670
|
+
await spawnCommand("clip");
|
|
671
|
+
} else {
|
|
672
|
+
try {
|
|
673
|
+
await spawnCommand("xclip", ["-selection", "clipboard"]);
|
|
674
|
+
} catch {
|
|
675
|
+
try {
|
|
676
|
+
await spawnCommand("xsel", ["--clipboard", "--input"]);
|
|
677
|
+
} catch {
|
|
678
|
+
await spawnCommand("wl-copy");
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
} catch (osError) {
|
|
683
|
+
throw new Error(`Failed to copy to clipboard. Please install a clipboard utility for your system.`);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
640
687
|
|
|
641
688
|
// src/ui/components/modals/InfoModal.tsx
|
|
642
689
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
@@ -1100,10 +1147,228 @@ var ChangeVisibilityModal = ({
|
|
|
1100
1147
|
);
|
|
1101
1148
|
};
|
|
1102
1149
|
|
|
1103
|
-
// src/ui/components/
|
|
1104
|
-
import {
|
|
1150
|
+
// src/ui/components/modals/CopyUrlModal.tsx
|
|
1151
|
+
import { useState as useState10 } from "react";
|
|
1152
|
+
import { Box as Box10, Text as Text11, useInput as useInput10 } from "ink";
|
|
1105
1153
|
import chalk10 from "chalk";
|
|
1106
|
-
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1154
|
+
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1155
|
+
function CopyUrlModal({ repo, terminalWidth, onClose, onCopy }) {
|
|
1156
|
+
const [copyError, setCopyError] = useState10(null);
|
|
1157
|
+
const [selectedType, setSelectedType] = useState10("SSH");
|
|
1158
|
+
const urlTypes = ["SSH", "HTTPS"];
|
|
1159
|
+
useInput10((input, key) => {
|
|
1160
|
+
if (!repo) return;
|
|
1161
|
+
const ch = input?.toLowerCase();
|
|
1162
|
+
if (key.escape || ch === "c" || ch === "q") {
|
|
1163
|
+
onClose();
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
if (key.leftArrow || key.rightArrow) {
|
|
1167
|
+
const currentIndex = urlTypes.indexOf(selectedType);
|
|
1168
|
+
let newIndex;
|
|
1169
|
+
if (key.leftArrow) {
|
|
1170
|
+
newIndex = currentIndex === 0 ? urlTypes.length - 1 : currentIndex - 1;
|
|
1171
|
+
} else {
|
|
1172
|
+
newIndex = currentIndex === urlTypes.length - 1 ? 0 : currentIndex + 1;
|
|
1173
|
+
}
|
|
1174
|
+
setSelectedType(urlTypes[newIndex]);
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
if (key.upArrow) {
|
|
1178
|
+
setSelectedType("SSH");
|
|
1179
|
+
return;
|
|
1180
|
+
}
|
|
1181
|
+
if (key.downArrow) {
|
|
1182
|
+
setSelectedType("HTTPS");
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
if (key.return || ch === "y") {
|
|
1186
|
+
const sshUrl2 = `git@github.com:${repo.nameWithOwner}.git`;
|
|
1187
|
+
const httpsUrl2 = `https://github.com/${repo.nameWithOwner}.git`;
|
|
1188
|
+
const urlToCopy = selectedType === "SSH" ? sshUrl2 : httpsUrl2;
|
|
1189
|
+
handleCopy(urlToCopy, selectedType);
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
if (ch === "s") {
|
|
1193
|
+
const sshUrl2 = `git@github.com:${repo.nameWithOwner}.git`;
|
|
1194
|
+
handleCopy(sshUrl2, "SSH");
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
if (ch === "h") {
|
|
1198
|
+
const httpsUrl2 = `https://github.com/${repo.nameWithOwner}.git`;
|
|
1199
|
+
handleCopy(httpsUrl2, "HTTPS");
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
if (!repo) {
|
|
1204
|
+
return /* @__PURE__ */ jsx11(Text11, { color: "red", children: "No repository selected." });
|
|
1205
|
+
}
|
|
1206
|
+
const sshUrl = `git@github.com:${repo.nameWithOwner}.git`;
|
|
1207
|
+
const httpsUrl = `https://github.com/${repo.nameWithOwner}.git`;
|
|
1208
|
+
const handleCopy = async (url, type) => {
|
|
1209
|
+
try {
|
|
1210
|
+
setCopyError(null);
|
|
1211
|
+
await onCopy(url, type);
|
|
1212
|
+
onClose();
|
|
1213
|
+
} catch (error) {
|
|
1214
|
+
const message = error instanceof Error ? error.message : String(error) || "Unknown error";
|
|
1215
|
+
setCopyError(`Failed to copy ${type} URL: ${message}`);
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
return /* @__PURE__ */ jsxs10(
|
|
1219
|
+
Box10,
|
|
1220
|
+
{
|
|
1221
|
+
flexDirection: "column",
|
|
1222
|
+
borderStyle: "round",
|
|
1223
|
+
borderColor: "blue",
|
|
1224
|
+
paddingX: 3,
|
|
1225
|
+
paddingY: 2,
|
|
1226
|
+
width: Math.min(terminalWidth - 8, 80),
|
|
1227
|
+
children: [
|
|
1228
|
+
/* @__PURE__ */ jsx11(Text11, { bold: true, color: "blue", children: "Copy Repository URL" }),
|
|
1229
|
+
/* @__PURE__ */ jsx11(Box10, { height: 1, children: /* @__PURE__ */ jsx11(Text11, { children: " " }) }),
|
|
1230
|
+
/* @__PURE__ */ jsx11(Text11, { children: chalk10.bold(repo.nameWithOwner) }),
|
|
1231
|
+
/* @__PURE__ */ jsx11(Box10, { height: 1, children: /* @__PURE__ */ jsx11(Text11, { children: " " }) }),
|
|
1232
|
+
/* @__PURE__ */ jsx11(Text11, { color: "gray", children: "SSH URL:" }),
|
|
1233
|
+
/* @__PURE__ */ jsx11(
|
|
1234
|
+
Box10,
|
|
1235
|
+
{
|
|
1236
|
+
paddingX: 2,
|
|
1237
|
+
paddingY: 1,
|
|
1238
|
+
borderStyle: "single",
|
|
1239
|
+
borderColor: selectedType === "SSH" ? "blue" : "gray",
|
|
1240
|
+
children: /* @__PURE__ */ jsxs10(Text11, { color: selectedType === "SSH" ? "blue" : void 0, children: [
|
|
1241
|
+
selectedType === "SSH" ? "\u25B6 " : " ",
|
|
1242
|
+
sshUrl
|
|
1243
|
+
] })
|
|
1244
|
+
}
|
|
1245
|
+
),
|
|
1246
|
+
/* @__PURE__ */ jsx11(Box10, { height: 1, children: /* @__PURE__ */ jsx11(Text11, { children: " " }) }),
|
|
1247
|
+
/* @__PURE__ */ jsx11(Text11, { color: "gray", children: "HTTPS URL:" }),
|
|
1248
|
+
/* @__PURE__ */ jsx11(
|
|
1249
|
+
Box10,
|
|
1250
|
+
{
|
|
1251
|
+
paddingX: 2,
|
|
1252
|
+
paddingY: 1,
|
|
1253
|
+
borderStyle: "single",
|
|
1254
|
+
borderColor: selectedType === "HTTPS" ? "blue" : "gray",
|
|
1255
|
+
children: /* @__PURE__ */ jsxs10(Text11, { color: selectedType === "HTTPS" ? "blue" : void 0, children: [
|
|
1256
|
+
selectedType === "HTTPS" ? "\u25B6 " : " ",
|
|
1257
|
+
httpsUrl
|
|
1258
|
+
] })
|
|
1259
|
+
}
|
|
1260
|
+
),
|
|
1261
|
+
/* @__PURE__ */ jsx11(Box10, { height: 1, children: /* @__PURE__ */ jsx11(Text11, { children: " " }) }),
|
|
1262
|
+
/* @__PURE__ */ jsxs10(Text11, { color: "gray", children: [
|
|
1263
|
+
"\u2191\u2193 Select \u2022 Enter/Y to copy ",
|
|
1264
|
+
selectedType,
|
|
1265
|
+
" \u2022 S copy SSH \u2022 H copy HTTPS \u2022 Esc/Q/C to close"
|
|
1266
|
+
] }),
|
|
1267
|
+
copyError && /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
1268
|
+
/* @__PURE__ */ jsx11(Box10, { height: 1, children: /* @__PURE__ */ jsx11(Text11, { children: " " }) }),
|
|
1269
|
+
/* @__PURE__ */ jsx11(Text11, { color: "red", children: copyError })
|
|
1270
|
+
] })
|
|
1271
|
+
]
|
|
1272
|
+
}
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
// src/ui/components/modals/RenameModal.tsx
|
|
1277
|
+
import { useState as useState11, useEffect as useEffect7 } from "react";
|
|
1278
|
+
import { Box as Box11, Text as Text12, useInput as useInput11 } from "ink";
|
|
1279
|
+
import TextInput3 from "ink-text-input";
|
|
1280
|
+
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1281
|
+
function RenameModal({ repo, onRename, onCancel }) {
|
|
1282
|
+
const [newName, setNewName] = useState11("");
|
|
1283
|
+
const [renaming, setRenaming] = useState11(false);
|
|
1284
|
+
const [renameError, setRenameError] = useState11(null);
|
|
1285
|
+
useEffect7(() => {
|
|
1286
|
+
if (repo) {
|
|
1287
|
+
setNewName(repo.name);
|
|
1288
|
+
setRenameError(null);
|
|
1289
|
+
}
|
|
1290
|
+
}, [repo]);
|
|
1291
|
+
useInput11((input, key) => {
|
|
1292
|
+
if (renaming) return;
|
|
1293
|
+
if (key.escape) {
|
|
1294
|
+
onCancel();
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
if (key.return) {
|
|
1298
|
+
if (newName.trim() && newName !== repo?.name) {
|
|
1299
|
+
handleRenameConfirm();
|
|
1300
|
+
}
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
const handleRenameConfirm = async () => {
|
|
1305
|
+
if (!repo || renaming || !newName.trim() || newName === repo.name) return;
|
|
1306
|
+
try {
|
|
1307
|
+
setRenaming(true);
|
|
1308
|
+
setRenameError(null);
|
|
1309
|
+
await onRename(repo, newName.trim());
|
|
1310
|
+
} catch (e) {
|
|
1311
|
+
setRenameError(e.message || "Failed to rename repository");
|
|
1312
|
+
setRenaming(false);
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
const handleNameChange = (value) => {
|
|
1316
|
+
const filtered = value.replace(/[^a-zA-Z0-9\-_.]/g, "");
|
|
1317
|
+
setNewName(filtered);
|
|
1318
|
+
};
|
|
1319
|
+
if (!repo) return null;
|
|
1320
|
+
const owner = repo.nameWithOwner.split("/")[0];
|
|
1321
|
+
const isDisabled = !newName.trim() || newName === repo.name;
|
|
1322
|
+
return /* @__PURE__ */ jsxs11(
|
|
1323
|
+
Box11,
|
|
1324
|
+
{
|
|
1325
|
+
flexDirection: "column",
|
|
1326
|
+
borderStyle: "round",
|
|
1327
|
+
borderColor: "cyan",
|
|
1328
|
+
paddingX: 3,
|
|
1329
|
+
paddingY: 2,
|
|
1330
|
+
width: 80,
|
|
1331
|
+
children: [
|
|
1332
|
+
/* @__PURE__ */ jsx12(Text12, { bold: true, color: "cyan", children: "Rename Repository" }),
|
|
1333
|
+
/* @__PURE__ */ jsx12(Box11, { height: 1, children: /* @__PURE__ */ jsx12(Text12, { children: " " }) }),
|
|
1334
|
+
/* @__PURE__ */ jsxs11(Text12, { color: "gray", children: [
|
|
1335
|
+
"Current: ",
|
|
1336
|
+
repo.nameWithOwner
|
|
1337
|
+
] }),
|
|
1338
|
+
/* @__PURE__ */ jsx12(Box11, { height: 1, children: /* @__PURE__ */ jsx12(Text12, { children: " " }) }),
|
|
1339
|
+
/* @__PURE__ */ jsx12(Text12, { children: "New name:" }),
|
|
1340
|
+
/* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", alignItems: "center", children: [
|
|
1341
|
+
/* @__PURE__ */ jsxs11(Text12, { children: [
|
|
1342
|
+
owner,
|
|
1343
|
+
"/"
|
|
1344
|
+
] }),
|
|
1345
|
+
/* @__PURE__ */ jsx12(
|
|
1346
|
+
TextInput3,
|
|
1347
|
+
{
|
|
1348
|
+
value: newName,
|
|
1349
|
+
onChange: handleNameChange,
|
|
1350
|
+
placeholder: repo.name,
|
|
1351
|
+
focus: !renaming
|
|
1352
|
+
}
|
|
1353
|
+
)
|
|
1354
|
+
] }),
|
|
1355
|
+
renaming ? /* @__PURE__ */ jsx12(Box11, { marginTop: 2, justifyContent: "center", children: /* @__PURE__ */ jsxs11(Box11, { flexDirection: "row", children: [
|
|
1356
|
+
/* @__PURE__ */ jsx12(Box11, { marginRight: 1, children: /* @__PURE__ */ jsx12(SlowSpinner, {}) }),
|
|
1357
|
+
/* @__PURE__ */ jsx12(Text12, { color: "cyan", children: "Renaming repository..." })
|
|
1358
|
+
] }) }) : /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
1359
|
+
/* @__PURE__ */ jsx12(Box11, { marginTop: 2, children: /* @__PURE__ */ jsx12(Text12, { color: "gray", children: isDisabled ? "Enter a different name to rename" : `Press Enter to rename to "${newName}"` }) }),
|
|
1360
|
+
/* @__PURE__ */ jsx12(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text12, { color: "gray", children: "Press Esc to cancel" }) })
|
|
1361
|
+
] }),
|
|
1362
|
+
renameError && /* @__PURE__ */ jsx12(Box11, { marginTop: 1, children: /* @__PURE__ */ jsx12(Text12, { color: "red", children: renameError }) })
|
|
1363
|
+
]
|
|
1364
|
+
}
|
|
1365
|
+
);
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
// src/ui/components/repo/RepoRow.tsx
|
|
1369
|
+
import { Box as Box12, Text as Text13 } from "ink";
|
|
1370
|
+
import chalk11 from "chalk";
|
|
1371
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1107
1372
|
function RepoRow({
|
|
1108
1373
|
repo,
|
|
1109
1374
|
selected,
|
|
@@ -1119,50 +1384,50 @@ function RepoRow({
|
|
|
1119
1384
|
const commitsBehind = hasCommitData ? repo.parent.defaultBranchRef.target.history.totalCount - repo.defaultBranchRef.target.history.totalCount : 0;
|
|
1120
1385
|
const showCommitsBehind = forkTracking && hasCommitData;
|
|
1121
1386
|
let line1 = "";
|
|
1122
|
-
const numColor = selected ?
|
|
1123
|
-
const nameColor = selected ?
|
|
1387
|
+
const numColor = selected ? chalk11.cyan : chalk11.gray;
|
|
1388
|
+
const nameColor = selected ? chalk11.cyan.bold : chalk11.white;
|
|
1124
1389
|
line1 += numColor(`${String(index).padStart(3, " ")}.`);
|
|
1125
1390
|
line1 += nameColor(` ${repo.nameWithOwner}`);
|
|
1126
1391
|
if (repo.visibility === "INTERNAL") {
|
|
1127
|
-
line1 +=
|
|
1392
|
+
line1 += chalk11.magenta(" Internal");
|
|
1128
1393
|
} else if (repo.visibility === "PRIVATE" || repo.isPrivate && !repo.visibility) {
|
|
1129
|
-
line1 +=
|
|
1394
|
+
line1 += chalk11.yellow(" Private");
|
|
1130
1395
|
}
|
|
1131
|
-
if (repo.isArchived) line1 += " " +
|
|
1396
|
+
if (repo.isArchived) line1 += " " + chalk11.bgGray.whiteBright(" Archived ") + " ";
|
|
1132
1397
|
if (repo.isFork && repo.parent) {
|
|
1133
|
-
line1 +=
|
|
1398
|
+
line1 += chalk11.blue(` Fork of ${repo.parent.nameWithOwner}`);
|
|
1134
1399
|
if (showCommitsBehind) {
|
|
1135
1400
|
if (commitsBehind > 0) {
|
|
1136
|
-
line1 +=
|
|
1401
|
+
line1 += chalk11.yellow(` (${commitsBehind} behind)`);
|
|
1137
1402
|
} else {
|
|
1138
|
-
line1 +=
|
|
1403
|
+
line1 += chalk11.green(` (0 behind)`);
|
|
1139
1404
|
}
|
|
1140
1405
|
}
|
|
1141
1406
|
}
|
|
1142
1407
|
let line2 = " ";
|
|
1143
|
-
const metaColor = selected ?
|
|
1144
|
-
if (langName) line2 +=
|
|
1408
|
+
const metaColor = selected ? chalk11.white : chalk11.gray;
|
|
1409
|
+
if (langName) line2 += chalk11.hex(langColor)("\u25CF ") + metaColor(`${langName} `);
|
|
1145
1410
|
line2 += metaColor(`\u2605 ${repo.stargazerCount} \u2442 ${repo.forkCount} Updated ${formatDate(repo.updatedAt)}`);
|
|
1146
1411
|
const line3 = repo.description ? ` ${truncate(repo.description, Math.max(30, maxWidth - 10))}` : null;
|
|
1147
1412
|
let fullText = line1 + "\n" + line2;
|
|
1148
1413
|
if (line3) fullText += "\n" + metaColor(line3);
|
|
1149
1414
|
const spacingAbove = Math.floor(spacingLines / 2);
|
|
1150
1415
|
const spacingBelow = spacingLines - spacingAbove;
|
|
1151
|
-
return /* @__PURE__ */
|
|
1152
|
-
spacingAbove > 0 && /* @__PURE__ */
|
|
1153
|
-
/* @__PURE__ */
|
|
1154
|
-
spacingBelow > 0 && /* @__PURE__ */
|
|
1416
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", backgroundColor: selected ? "gray" : void 0, children: [
|
|
1417
|
+
spacingAbove > 0 && /* @__PURE__ */ jsx13(Box12, { height: spacingAbove, children: /* @__PURE__ */ jsx13(Text13, { children: " " }) }),
|
|
1418
|
+
/* @__PURE__ */ jsx13(Text13, { children: dim ? chalk11.dim(fullText) : fullText }),
|
|
1419
|
+
spacingBelow > 0 && /* @__PURE__ */ jsx13(Box12, { height: spacingBelow, children: /* @__PURE__ */ jsx13(Text13, { children: " " }) })
|
|
1155
1420
|
] });
|
|
1156
1421
|
}
|
|
1157
1422
|
|
|
1158
1423
|
// src/ui/components/repo/FilterInput.tsx
|
|
1159
|
-
import { Box as
|
|
1160
|
-
import
|
|
1161
|
-
import { jsx as
|
|
1424
|
+
import { Box as Box13, Text as Text14 } from "ink";
|
|
1425
|
+
import TextInput4 from "ink-text-input";
|
|
1426
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1162
1427
|
|
|
1163
1428
|
// src/ui/components/repo/RepoListHeader.tsx
|
|
1164
|
-
import { Box as
|
|
1165
|
-
import { Fragment as
|
|
1429
|
+
import { Box as Box14, Text as Text15 } from "ink";
|
|
1430
|
+
import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1166
1431
|
function RepoListHeader({
|
|
1167
1432
|
ownerContext,
|
|
1168
1433
|
sortKey,
|
|
@@ -1176,43 +1441,43 @@ function RepoListHeader({
|
|
|
1176
1441
|
}) {
|
|
1177
1442
|
const contextLabel = ownerContext === "personal" ? "Personal Account" : ownerContext?.type === "organization" ? `Organization: ${ownerContext.name ?? ownerContext.login}` : "";
|
|
1178
1443
|
const visibilityLabel = visibilityFilter === "public" ? "Public" : visibilityFilter === "private" ? isEnterprise ? "Private/Internal" : "Private" : visibilityFilter === "internal" ? "Internal" : "";
|
|
1179
|
-
return /* @__PURE__ */
|
|
1180
|
-
contextLabel && /* @__PURE__ */
|
|
1181
|
-
/* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "row", gap: 2, marginBottom: 1, children: [
|
|
1445
|
+
contextLabel && /* @__PURE__ */ jsx15(Text15, { children: contextLabel }),
|
|
1446
|
+
/* @__PURE__ */ jsxs14(Text15, { color: "gray", dimColor: true, children: [
|
|
1182
1447
|
"Sort: ",
|
|
1183
1448
|
sortKey,
|
|
1184
1449
|
" ",
|
|
1185
1450
|
sortDir === "asc" ? "\u2191" : "\u2193"
|
|
1186
1451
|
] }),
|
|
1187
|
-
/* @__PURE__ */
|
|
1452
|
+
/* @__PURE__ */ jsxs14(Text15, { color: "gray", dimColor: true, children: [
|
|
1188
1453
|
"Fork Status - Commits Behind: ",
|
|
1189
1454
|
forkTracking ? "ON" : "OFF"
|
|
1190
1455
|
] }),
|
|
1191
|
-
!!visibilityLabel && /* @__PURE__ */
|
|
1456
|
+
!!visibilityLabel && /* @__PURE__ */ jsxs14(Text15, { color: "yellow", children: [
|
|
1192
1457
|
"Visibility: ",
|
|
1193
1458
|
visibilityLabel
|
|
1194
1459
|
] }),
|
|
1195
|
-
filter && !searchActive && /* @__PURE__ */
|
|
1460
|
+
filter && !searchActive && /* @__PURE__ */ jsxs14(Text15, { color: "cyan", children: [
|
|
1196
1461
|
'Filter: "',
|
|
1197
1462
|
filter,
|
|
1198
1463
|
'"'
|
|
1199
1464
|
] }),
|
|
1200
|
-
searchActive && /* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */
|
|
1465
|
+
searchActive && /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
1466
|
+
/* @__PURE__ */ jsxs14(Text15, { color: "cyan", children: [
|
|
1202
1467
|
'Search: "',
|
|
1203
1468
|
filter.trim(),
|
|
1204
1469
|
'"'
|
|
1205
1470
|
] }),
|
|
1206
|
-
searchLoading && /* @__PURE__ */
|
|
1207
|
-
/* @__PURE__ */
|
|
1471
|
+
searchLoading && /* @__PURE__ */ jsx15(Box14, { marginLeft: 1, children: /* @__PURE__ */ jsxs14(Text15, { color: "cyan", children: [
|
|
1472
|
+
/* @__PURE__ */ jsx15(SlowSpinner, {}),
|
|
1208
1473
|
" Searching\u2026"
|
|
1209
1474
|
] }) })
|
|
1210
1475
|
] })
|
|
1211
1476
|
] });
|
|
1212
1477
|
}
|
|
1213
1478
|
|
|
1214
|
-
// src/ui/RepoList.tsx
|
|
1215
|
-
import { Fragment as
|
|
1479
|
+
// src/ui/views/RepoList.tsx
|
|
1480
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1216
1481
|
var getPageSize = () => {
|
|
1217
1482
|
const envValue = process.env.REPOS_PER_FETCH;
|
|
1218
1483
|
if (envValue) {
|
|
@@ -1228,17 +1493,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1228
1493
|
const { exit } = useApp();
|
|
1229
1494
|
const { stdout } = useStdout();
|
|
1230
1495
|
const client = useMemo(() => makeClient(token), [token]);
|
|
1231
|
-
const [debugMessages, setDebugMessages] =
|
|
1496
|
+
const [debugMessages, setDebugMessages] = useState12([]);
|
|
1232
1497
|
const addDebugMessage = useCallback((msg) => {
|
|
1233
1498
|
if (process.env.GH_MANAGER_DEBUG === "1") {
|
|
1234
1499
|
setDebugMessages((prev) => [...prev.slice(-9), msg]);
|
|
1235
1500
|
}
|
|
1236
1501
|
}, []);
|
|
1237
1502
|
const handleOrgContextChangeRef = useRef(onOrgContextChange);
|
|
1238
|
-
|
|
1503
|
+
useEffect8(() => {
|
|
1239
1504
|
handleOrgContextChangeRef.current = onOrgContextChange;
|
|
1240
1505
|
}, [onOrgContextChange]);
|
|
1241
|
-
|
|
1506
|
+
React12.useEffect(() => {
|
|
1242
1507
|
addDebugMessage(`[RepoList] Component mounted`);
|
|
1243
1508
|
logger.info("RepoList component mounted", {
|
|
1244
1509
|
token: token ? "present" : "missing",
|
|
@@ -1250,64 +1515,69 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1250
1515
|
}, []);
|
|
1251
1516
|
const terminalWidth = stdout?.columns ?? 80;
|
|
1252
1517
|
const availableHeight = maxVisibleRows ?? 20;
|
|
1253
|
-
const [items, setItems] =
|
|
1254
|
-
const [cursor, setCursor] =
|
|
1255
|
-
const [endCursor, setEndCursor] =
|
|
1256
|
-
const [hasNextPage, setHasNextPage] =
|
|
1257
|
-
const [totalCount, setTotalCount] =
|
|
1258
|
-
const [loading, setLoading] =
|
|
1259
|
-
const [sortingLoading, setSortingLoading] =
|
|
1260
|
-
const [refreshing, setRefreshing] =
|
|
1261
|
-
const [loadingMore, setLoadingMore] =
|
|
1262
|
-
const [error, setError] =
|
|
1263
|
-
const [rateLimit, setRateLimit] =
|
|
1264
|
-
const [prevRateLimit, setPrevRateLimit] =
|
|
1265
|
-
const [restRateLimit, setRestRateLimit] =
|
|
1266
|
-
const [prevRestRateLimit, setPrevRestRateLimit] =
|
|
1267
|
-
const [density, setDensity] =
|
|
1268
|
-
const [prefsLoaded, setPrefsLoaded] =
|
|
1269
|
-
const [ownerContext, setOwnerContext] =
|
|
1270
|
-
const [ownerAffiliations, setOwnerAffiliations] =
|
|
1271
|
-
const [orgSwitcherOpen, setOrgSwitcherOpen] =
|
|
1272
|
-
const [searchItems, setSearchItems] =
|
|
1273
|
-
const [searchEndCursor, setSearchEndCursor] =
|
|
1274
|
-
const [searchHasNextPage, setSearchHasNextPage] =
|
|
1275
|
-
const [searchTotalCount, setSearchTotalCount] =
|
|
1276
|
-
const [searchLoading, setSearchLoading] =
|
|
1277
|
-
const [deleteMode, setDeleteMode] =
|
|
1278
|
-
const [deleteTarget, setDeleteTarget] =
|
|
1279
|
-
const [deleteCode, setDeleteCode] =
|
|
1280
|
-
const [typedCode, setTypedCode] =
|
|
1281
|
-
const [deleting, setDeleting] =
|
|
1282
|
-
const [deleteError, setDeleteError] =
|
|
1283
|
-
const [deleteConfirmStage, setDeleteConfirmStage] =
|
|
1284
|
-
const [confirmFocus, setConfirmFocus] =
|
|
1285
|
-
const [archiveMode, setArchiveMode] =
|
|
1286
|
-
const [archiveTarget, setArchiveTarget] =
|
|
1287
|
-
const [archiving, setArchiving] =
|
|
1288
|
-
const [archiveError, setArchiveError] =
|
|
1289
|
-
const [archiveFocus, setArchiveFocus] =
|
|
1290
|
-
const [syncMode, setSyncMode] =
|
|
1291
|
-
const [syncTarget, setSyncTarget] =
|
|
1292
|
-
const [syncing, setSyncing] =
|
|
1293
|
-
const [syncError, setSyncError] =
|
|
1294
|
-
const [syncFocus, setSyncFocus] =
|
|
1295
|
-
const [
|
|
1296
|
-
const [
|
|
1297
|
-
const [
|
|
1298
|
-
const [
|
|
1299
|
-
const [
|
|
1300
|
-
const [
|
|
1301
|
-
const [
|
|
1302
|
-
const [
|
|
1303
|
-
const [
|
|
1304
|
-
const [
|
|
1305
|
-
const [
|
|
1306
|
-
const [
|
|
1307
|
-
const [
|
|
1308
|
-
const [
|
|
1518
|
+
const [items, setItems] = useState12([]);
|
|
1519
|
+
const [cursor, setCursor] = useState12(0);
|
|
1520
|
+
const [endCursor, setEndCursor] = useState12(null);
|
|
1521
|
+
const [hasNextPage, setHasNextPage] = useState12(false);
|
|
1522
|
+
const [totalCount, setTotalCount] = useState12(0);
|
|
1523
|
+
const [loading, setLoading] = useState12(true);
|
|
1524
|
+
const [sortingLoading, setSortingLoading] = useState12(false);
|
|
1525
|
+
const [refreshing, setRefreshing] = useState12(false);
|
|
1526
|
+
const [loadingMore, setLoadingMore] = useState12(false);
|
|
1527
|
+
const [error, setError] = useState12(null);
|
|
1528
|
+
const [rateLimit, setRateLimit] = useState12(void 0);
|
|
1529
|
+
const [prevRateLimit, setPrevRateLimit] = useState12(void 0);
|
|
1530
|
+
const [restRateLimit, setRestRateLimit] = useState12(void 0);
|
|
1531
|
+
const [prevRestRateLimit, setPrevRestRateLimit] = useState12(void 0);
|
|
1532
|
+
const [density, setDensity] = useState12(2);
|
|
1533
|
+
const [prefsLoaded, setPrefsLoaded] = useState12(false);
|
|
1534
|
+
const [ownerContext, setOwnerContext] = useState12("personal");
|
|
1535
|
+
const [ownerAffiliations, setOwnerAffiliations] = useState12(["OWNER"]);
|
|
1536
|
+
const [orgSwitcherOpen, setOrgSwitcherOpen] = useState12(false);
|
|
1537
|
+
const [searchItems, setSearchItems] = useState12([]);
|
|
1538
|
+
const [searchEndCursor, setSearchEndCursor] = useState12(null);
|
|
1539
|
+
const [searchHasNextPage, setSearchHasNextPage] = useState12(false);
|
|
1540
|
+
const [searchTotalCount, setSearchTotalCount] = useState12(0);
|
|
1541
|
+
const [searchLoading, setSearchLoading] = useState12(false);
|
|
1542
|
+
const [deleteMode, setDeleteMode] = useState12(false);
|
|
1543
|
+
const [deleteTarget, setDeleteTarget] = useState12(null);
|
|
1544
|
+
const [deleteCode, setDeleteCode] = useState12("");
|
|
1545
|
+
const [typedCode, setTypedCode] = useState12("");
|
|
1546
|
+
const [deleting, setDeleting] = useState12(false);
|
|
1547
|
+
const [deleteError, setDeleteError] = useState12(null);
|
|
1548
|
+
const [deleteConfirmStage, setDeleteConfirmStage] = useState12(false);
|
|
1549
|
+
const [confirmFocus, setConfirmFocus] = useState12("delete");
|
|
1550
|
+
const [archiveMode, setArchiveMode] = useState12(false);
|
|
1551
|
+
const [archiveTarget, setArchiveTarget] = useState12(null);
|
|
1552
|
+
const [archiving, setArchiving] = useState12(false);
|
|
1553
|
+
const [archiveError, setArchiveError] = useState12(null);
|
|
1554
|
+
const [archiveFocus, setArchiveFocus] = useState12("confirm");
|
|
1555
|
+
const [syncMode, setSyncMode] = useState12(false);
|
|
1556
|
+
const [syncTarget, setSyncTarget] = useState12(null);
|
|
1557
|
+
const [syncing, setSyncing] = useState12(false);
|
|
1558
|
+
const [syncError, setSyncError] = useState12(null);
|
|
1559
|
+
const [syncFocus, setSyncFocus] = useState12("confirm");
|
|
1560
|
+
const [renameMode, setRenameMode] = useState12(false);
|
|
1561
|
+
const [renameTarget, setRenameTarget] = useState12(null);
|
|
1562
|
+
const [copyUrlMode, setCopyUrlMode] = useState12(false);
|
|
1563
|
+
const [copyUrlTarget, setCopyUrlTarget] = useState12(null);
|
|
1564
|
+
const [copyToast, setCopyToast] = useState12(null);
|
|
1565
|
+
const [syncTrigger, setSyncTrigger] = useState12(false);
|
|
1566
|
+
const [infoMode, setInfoMode] = useState12(false);
|
|
1567
|
+
const [infoRepo, setInfoRepo] = useState12(null);
|
|
1568
|
+
const [logoutMode, setLogoutMode] = useState12(false);
|
|
1569
|
+
const [logoutFocus, setLogoutFocus] = useState12("confirm");
|
|
1570
|
+
const [logoutError, setLogoutError] = useState12(null);
|
|
1571
|
+
const [visibilityMode, setVisibilityMode] = useState12(false);
|
|
1572
|
+
const [isEnterpriseOrg, setIsEnterpriseOrg] = useState12(false);
|
|
1573
|
+
const [hasInternalRepos, setHasInternalRepos] = useState12(false);
|
|
1574
|
+
const [changeVisibilityMode, setChangeVisibilityMode] = useState12(false);
|
|
1575
|
+
const [changeVisibilityTarget, setChangeVisibilityTarget] = useState12(null);
|
|
1576
|
+
const [changingVisibility, setChangingVisibility] = useState12(false);
|
|
1577
|
+
const [changeVisibilityError, setChangeVisibilityError] = useState12(null);
|
|
1578
|
+
const [sortMode, setSortMode] = useState12(false);
|
|
1309
1579
|
const appliedInitialOrg = useRef(false);
|
|
1310
|
-
|
|
1580
|
+
useEffect8(() => {
|
|
1311
1581
|
(async () => {
|
|
1312
1582
|
if (appliedInitialOrg.current) return;
|
|
1313
1583
|
if (!initialOrgSlug2) return;
|
|
@@ -1356,6 +1626,18 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1356
1626
|
setSyncFocus("confirm");
|
|
1357
1627
|
setSyncTrigger(false);
|
|
1358
1628
|
}
|
|
1629
|
+
function closeRenameModal() {
|
|
1630
|
+
setRenameMode(false);
|
|
1631
|
+
setRenameTarget(null);
|
|
1632
|
+
}
|
|
1633
|
+
function closeCopyUrlModal() {
|
|
1634
|
+
setCopyUrlMode(false);
|
|
1635
|
+
setCopyUrlTarget(null);
|
|
1636
|
+
}
|
|
1637
|
+
function openCopyUrlModal(repo) {
|
|
1638
|
+
setCopyUrlMode(true);
|
|
1639
|
+
setCopyUrlTarget(repo);
|
|
1640
|
+
}
|
|
1359
1641
|
async function executeSync() {
|
|
1360
1642
|
if (!syncTarget || syncing) return;
|
|
1361
1643
|
try {
|
|
@@ -1416,6 +1698,56 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1416
1698
|
setArchiveError("Failed to update archive state. Check permissions.");
|
|
1417
1699
|
}
|
|
1418
1700
|
}
|
|
1701
|
+
async function executeRename(repo, newName) {
|
|
1702
|
+
if (!repo || !newName.trim()) return;
|
|
1703
|
+
try {
|
|
1704
|
+
const id = repo.id;
|
|
1705
|
+
const owner = repo.nameWithOwner.split("/")[0];
|
|
1706
|
+
const newNameWithOwner = `${owner}/${newName}`;
|
|
1707
|
+
await renameRepositoryById(client, id, newName);
|
|
1708
|
+
await updateCacheAfterRename(token, id, newName, newNameWithOwner);
|
|
1709
|
+
const updateRepo = (r) => r.id === id ? { ...r, name: newName, nameWithOwner: newNameWithOwner } : r;
|
|
1710
|
+
setItems((prev) => prev.map(updateRepo));
|
|
1711
|
+
setSearchItems((prev) => prev.map(updateRepo));
|
|
1712
|
+
closeRenameModal();
|
|
1713
|
+
} catch (error2) {
|
|
1714
|
+
throw error2;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
const copyToastTimerRef = useRef(null);
|
|
1718
|
+
async function handleCopyUrl(url, type) {
|
|
1719
|
+
try {
|
|
1720
|
+
if (copyToastTimerRef.current) {
|
|
1721
|
+
clearTimeout(copyToastTimerRef.current);
|
|
1722
|
+
copyToastTimerRef.current = null;
|
|
1723
|
+
}
|
|
1724
|
+
await copyToClipboard(url);
|
|
1725
|
+
setCopyToast(`Copied ${type} URL to clipboard`);
|
|
1726
|
+
copyToastTimerRef.current = setTimeout(() => {
|
|
1727
|
+
setCopyToast(null);
|
|
1728
|
+
copyToastTimerRef.current = null;
|
|
1729
|
+
}, 3e3);
|
|
1730
|
+
} catch (error2) {
|
|
1731
|
+
if (copyToastTimerRef.current) {
|
|
1732
|
+
clearTimeout(copyToastTimerRef.current);
|
|
1733
|
+
copyToastTimerRef.current = null;
|
|
1734
|
+
}
|
|
1735
|
+
const message = error2 instanceof Error ? error2.message : String(error2) || "Unknown error";
|
|
1736
|
+
setCopyToast(`Failed to copy: ${message}`);
|
|
1737
|
+
copyToastTimerRef.current = setTimeout(() => {
|
|
1738
|
+
setCopyToast(null);
|
|
1739
|
+
copyToastTimerRef.current = null;
|
|
1740
|
+
}, 3e3);
|
|
1741
|
+
throw error2;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
useEffect8(() => {
|
|
1745
|
+
return () => {
|
|
1746
|
+
if (copyToastTimerRef.current) {
|
|
1747
|
+
clearTimeout(copyToastTimerRef.current);
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
}, []);
|
|
1419
1751
|
async function handleVisibilityChange(newVisibility) {
|
|
1420
1752
|
if (!changeVisibilityTarget || changingVisibility) return;
|
|
1421
1753
|
try {
|
|
@@ -1509,12 +1841,12 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1509
1841
|
setDeleteError("Failed to delete repository. Ensure delete_repo scope and admin permissions.");
|
|
1510
1842
|
}
|
|
1511
1843
|
}
|
|
1512
|
-
const [filter, setFilter] =
|
|
1513
|
-
const [filterMode, setFilterMode] =
|
|
1514
|
-
const [sortKey, setSortKey] =
|
|
1515
|
-
const [sortDir, setSortDir] =
|
|
1516
|
-
const [forkTracking, setForkTracking] =
|
|
1517
|
-
const [visibilityFilter, setVisibilityFilter] =
|
|
1844
|
+
const [filter, setFilter] = useState12("");
|
|
1845
|
+
const [filterMode, setFilterMode] = useState12(false);
|
|
1846
|
+
const [sortKey, setSortKey] = useState12("updated");
|
|
1847
|
+
const [sortDir, setSortDir] = useState12("desc");
|
|
1848
|
+
const [forkTracking, setForkTracking] = useState12(true);
|
|
1849
|
+
const [visibilityFilter, setVisibilityFilter] = useState12("all");
|
|
1518
1850
|
const previousVisibilityFilter = useRef("all");
|
|
1519
1851
|
const sortFieldMap = {
|
|
1520
1852
|
"updated": "UPDATED_AT",
|
|
@@ -1675,7 +2007,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1675
2007
|
setSearchLoading(false);
|
|
1676
2008
|
}
|
|
1677
2009
|
};
|
|
1678
|
-
|
|
2010
|
+
useEffect8(() => {
|
|
1679
2011
|
const ui = getUIPrefs();
|
|
1680
2012
|
if (ui.density !== void 0) setDensity(ui.density);
|
|
1681
2013
|
if (ui.sortKey && ["updated", "pushed", "name", "stars"].includes(ui.sortKey)) {
|
|
@@ -1706,7 +2038,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1706
2038
|
}
|
|
1707
2039
|
setPrefsLoaded(true);
|
|
1708
2040
|
}, [onOrgContextChange]);
|
|
1709
|
-
|
|
2041
|
+
useEffect8(() => {
|
|
1710
2042
|
if (!prefsLoaded) return;
|
|
1711
2043
|
let policy = "cache-first";
|
|
1712
2044
|
const orgLogin = ownerContext !== "personal" ? ownerContext.login : void 0;
|
|
@@ -1726,7 +2058,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1726
2058
|
setCursor(0);
|
|
1727
2059
|
fetchPage(null, true, false, void 0, policy);
|
|
1728
2060
|
}, [client, prefsLoaded, ownerContext, ownerAffiliations]);
|
|
1729
|
-
|
|
2061
|
+
useEffect8(() => {
|
|
1730
2062
|
if (!searchActive) {
|
|
1731
2063
|
if (items.length > 0) {
|
|
1732
2064
|
let policy = "cache-first";
|
|
@@ -1765,7 +2097,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1765
2097
|
}
|
|
1766
2098
|
}
|
|
1767
2099
|
}, [sortKey, sortDir]);
|
|
1768
|
-
|
|
2100
|
+
useEffect8(() => {
|
|
1769
2101
|
if (visibilityFilter !== "all" || previousVisibilityFilter.current && previousVisibilityFilter.current !== visibilityFilter) {
|
|
1770
2102
|
if (!searchActive) {
|
|
1771
2103
|
if (items.length > 0) {
|
|
@@ -1782,7 +2114,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1782
2114
|
}
|
|
1783
2115
|
previousVisibilityFilter.current = visibilityFilter;
|
|
1784
2116
|
}, [visibilityFilter]);
|
|
1785
|
-
|
|
2117
|
+
useEffect8(() => {
|
|
1786
2118
|
if (viewerLogin && searchActive && !searchLoading && searchItems.length === 0) {
|
|
1787
2119
|
let policy = "cache-first";
|
|
1788
2120
|
try {
|
|
@@ -1803,7 +2135,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1803
2135
|
fetchSearchPage(null, true, policy);
|
|
1804
2136
|
}
|
|
1805
2137
|
}, [viewerLogin]);
|
|
1806
|
-
|
|
2138
|
+
useInput12((input, key) => {
|
|
1807
2139
|
if (error) {
|
|
1808
2140
|
if (input && input.toUpperCase() === "Q") {
|
|
1809
2141
|
try {
|
|
@@ -1948,6 +2280,12 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1948
2280
|
}
|
|
1949
2281
|
return;
|
|
1950
2282
|
}
|
|
2283
|
+
if (renameMode) {
|
|
2284
|
+
return;
|
|
2285
|
+
}
|
|
2286
|
+
if (copyUrlMode) {
|
|
2287
|
+
return;
|
|
2288
|
+
}
|
|
1951
2289
|
if (visibilityMode) {
|
|
1952
2290
|
return;
|
|
1953
2291
|
}
|
|
@@ -2113,6 +2451,21 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2113
2451
|
setInfoMode(true);
|
|
2114
2452
|
return;
|
|
2115
2453
|
}
|
|
2454
|
+
if (input && input.toUpperCase() === "C") {
|
|
2455
|
+
const repo = visibleItems[cursor];
|
|
2456
|
+
if (repo) {
|
|
2457
|
+
openCopyUrlModal(repo);
|
|
2458
|
+
}
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2461
|
+
if (key.ctrl && (input === "r" || input === "R")) {
|
|
2462
|
+
const repo = visibleItems[cursor];
|
|
2463
|
+
if (repo) {
|
|
2464
|
+
setRenameMode(true);
|
|
2465
|
+
setRenameTarget(repo);
|
|
2466
|
+
}
|
|
2467
|
+
return;
|
|
2468
|
+
}
|
|
2116
2469
|
if (input && input.toUpperCase() === "W") {
|
|
2117
2470
|
setOrgSwitcherOpen(true);
|
|
2118
2471
|
return;
|
|
@@ -2207,12 +2560,12 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2207
2560
|
return result;
|
|
2208
2561
|
}, [searchItems, visibilityFilter]);
|
|
2209
2562
|
const visibleItems = searchActive ? filteredSearchItems : filteredAndSorted;
|
|
2210
|
-
|
|
2563
|
+
useEffect8(() => {
|
|
2211
2564
|
if (searchActive) {
|
|
2212
2565
|
addDebugMessage(`[State] searchActive=${searchActive}, searchItems=${searchItems.length}, visibleItems=${visibleItems.length}, filter="${filter}"`);
|
|
2213
2566
|
}
|
|
2214
2567
|
}, [searchActive, searchItems.length, visibleItems.length, filter]);
|
|
2215
|
-
|
|
2568
|
+
useEffect8(() => {
|
|
2216
2569
|
setCursor((c) => Math.min(c, Math.max(0, (searchActive ? searchItems.length : items.length) - 1)));
|
|
2217
2570
|
}, [searchActive, searchItems.length, items.length]);
|
|
2218
2571
|
const headerHeight = 2;
|
|
@@ -2233,7 +2586,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2233
2586
|
const end = Math.min(total, start + visibleRepos + buffer);
|
|
2234
2587
|
return { start, end };
|
|
2235
2588
|
}, [visibleItems.length, cursor, listHeight, spacingLines]);
|
|
2236
|
-
|
|
2589
|
+
useEffect8(() => {
|
|
2237
2590
|
const prefetchThreshold = Math.floor(visibleItems.length * 0.8);
|
|
2238
2591
|
const nearEnd = visibleItems.length > 0 && cursor >= prefetchThreshold;
|
|
2239
2592
|
if (searchActive) {
|
|
@@ -2255,96 +2608,96 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2255
2608
|
}
|
|
2256
2609
|
const lowRate = rateLimit && rateLimit.remaining <= Math.ceil(rateLimit.limit * 0.1) || restRateLimit && restRateLimit.core.remaining <= Math.ceil(restRateLimit.core.limit * 0.1);
|
|
2257
2610
|
const modalOpen = deleteMode || archiveMode || syncMode || logoutMode || infoMode || visibilityMode;
|
|
2258
|
-
const headerBar = useMemo(() => /* @__PURE__ */
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
/* @__PURE__ */
|
|
2611
|
+
const headerBar = useMemo(() => /* @__PURE__ */ jsxs15(Box15, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: [
|
|
2612
|
+
/* @__PURE__ */ jsxs15(Box15, { flexDirection: "row", gap: 1, children: [
|
|
2613
|
+
/* @__PURE__ */ jsxs15(Text16, { color: "cyan", bold: !modalOpen, dimColor: modalOpen, children: [
|
|
2261
2614
|
" ",
|
|
2262
2615
|
ownerContext === "personal" ? "Personal" : ownerContext.name || ownerContext.login,
|
|
2263
2616
|
ownerContext !== "personal" && isEnterpriseOrg && " (ENT)"
|
|
2264
2617
|
] }),
|
|
2265
|
-
/* @__PURE__ */
|
|
2266
|
-
/* @__PURE__ */
|
|
2618
|
+
/* @__PURE__ */ jsx16(Text16, { bold: true, color: modalOpen ? "gray" : void 0, dimColor: modalOpen ? true : void 0, children: "Repositories" }),
|
|
2619
|
+
/* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
2267
2620
|
"(",
|
|
2268
2621
|
visibleItems.length,
|
|
2269
2622
|
"/",
|
|
2270
2623
|
searchActive ? searchTotalCount : totalCount,
|
|
2271
2624
|
")"
|
|
2272
2625
|
] }),
|
|
2273
|
-
(loading || searchLoading) && /* @__PURE__ */
|
|
2626
|
+
(loading || searchLoading) && /* @__PURE__ */ jsx16(Box15, { width: 2, flexShrink: 0, flexGrow: 0, marginLeft: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "yellow", children: /* @__PURE__ */ jsx16(SlowSpinner, {}) }) })
|
|
2274
2627
|
] }),
|
|
2275
|
-
(rateLimit || restRateLimit) && /* @__PURE__ */
|
|
2628
|
+
(rateLimit || restRateLimit) && /* @__PURE__ */ jsxs15(Text16, { color: lowRate ? "yellow" : "gray", children: [
|
|
2276
2629
|
"GraphQL: ",
|
|
2277
2630
|
rateLimit ? `${rateLimit.remaining}/${rateLimit.limit}` : "---/---",
|
|
2278
|
-
prevRateLimit !== void 0 && rateLimit && prevRateLimit !== rateLimit.remaining && /* @__PURE__ */
|
|
2631
|
+
prevRateLimit !== void 0 && rateLimit && prevRateLimit !== rateLimit.remaining && /* @__PURE__ */ jsx16(Text16, { color: rateLimit.remaining < prevRateLimit ? "red" : "green", children: ` (${rateLimit.remaining - prevRateLimit > 0 ? "+" : ""}${rateLimit.remaining - prevRateLimit})` }),
|
|
2279
2632
|
" | ",
|
|
2280
2633
|
"REST: ",
|
|
2281
2634
|
restRateLimit ? `${restRateLimit.core.remaining}/${restRateLimit.core.limit}` : "---/---",
|
|
2282
|
-
prevRestRateLimit !== void 0 && restRateLimit && prevRestRateLimit !== restRateLimit.core.remaining && /* @__PURE__ */
|
|
2635
|
+
prevRestRateLimit !== void 0 && restRateLimit && prevRestRateLimit !== restRateLimit.core.remaining && /* @__PURE__ */ jsx16(Text16, { color: restRateLimit.core.remaining < prevRestRateLimit ? "red" : "green", children: ` (${restRateLimit.core.remaining - prevRestRateLimit > 0 ? "+" : ""}${restRateLimit.core.remaining - prevRestRateLimit})` }),
|
|
2283
2636
|
" "
|
|
2284
2637
|
] })
|
|
2285
2638
|
] }), [visibleItems.length, searchActive, searchTotalCount, totalCount, loading, searchLoading, rateLimit, lowRate, modalOpen, prevRateLimit, ownerContext, isEnterpriseOrg, restRateLimit, prevRestRateLimit]);
|
|
2286
2639
|
if (error) {
|
|
2287
|
-
return /* @__PURE__ */
|
|
2288
|
-
/* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
2290
|
-
/* @__PURE__ */
|
|
2640
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", height: availableHeight, children: [
|
|
2641
|
+
/* @__PURE__ */ jsx16(Box15, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "row", gap: 1, children: [
|
|
2642
|
+
/* @__PURE__ */ jsx16(Text16, { bold: true, children: " Repositories" }),
|
|
2643
|
+
/* @__PURE__ */ jsx16(Text16, { color: "red", children: "(Error)" })
|
|
2291
2644
|
] }) }),
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2645
|
+
/* @__PURE__ */ jsx16(Box15, { borderStyle: "single", borderColor: "red", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: /* @__PURE__ */ jsx16(Box15, { height: contentHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", alignItems: "center", children: [
|
|
2646
|
+
/* @__PURE__ */ jsx16(Text16, { color: "red", children: error }),
|
|
2647
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "gray", dimColor: true, children: "Press R to retry \u2022 Ctrl+L to logout \u2022 Q to quit" }) })
|
|
2295
2648
|
] }) }) }),
|
|
2296
|
-
/* @__PURE__ */
|
|
2649
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "gray", children: "Press R to retry \u2022 Ctrl+L to logout \u2022 Q to quit" }) })
|
|
2297
2650
|
] });
|
|
2298
2651
|
}
|
|
2299
2652
|
if (loading && items.length === 0 || sortingLoading) {
|
|
2300
|
-
return /* @__PURE__ */
|
|
2301
|
-
/* @__PURE__ */
|
|
2302
|
-
/* @__PURE__ */
|
|
2303
|
-
/* @__PURE__ */
|
|
2653
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", height: availableHeight, children: [
|
|
2654
|
+
/* @__PURE__ */ jsx16(Box15, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "row", gap: 1, children: [
|
|
2655
|
+
/* @__PURE__ */ jsx16(Text16, { bold: true, children: " Repositories" }),
|
|
2656
|
+
/* @__PURE__ */ jsx16(Text16, { color: "gray", children: "(Loading...)" })
|
|
2304
2657
|
] }) }),
|
|
2305
|
-
/* @__PURE__ */
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
/* @__PURE__ */
|
|
2658
|
+
/* @__PURE__ */ jsx16(Box15, { borderStyle: "single", borderColor: "yellow", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: /* @__PURE__ */ jsx16(Box15, { height: contentHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx16(Box15, { flexDirection: "column", alignItems: "center", children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", alignItems: "center", children: [
|
|
2659
|
+
/* @__PURE__ */ jsxs15(Box15, { height: 1, flexDirection: "row", children: [
|
|
2660
|
+
/* @__PURE__ */ jsx16(Box15, { width: 2, flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx16(Text16, { color: "cyan", children: /* @__PURE__ */ jsx16(SlowSpinner, {}) }) }),
|
|
2661
|
+
/* @__PURE__ */ jsx16(Text16, { color: "cyan", children: refreshing ? "Refreshing..." : sortingLoading ? "Applying sort..." : "Loading repositories..." })
|
|
2309
2662
|
] }),
|
|
2310
|
-
/* @__PURE__ */
|
|
2663
|
+
/* @__PURE__ */ jsx16(Box15, { height: 1, marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "gray", children: refreshing ? "Fetching latest repository data" : sortingLoading ? `Sorting by ${sortKey} (${sortDir === "asc" ? "ascending" : "descending"})` : "Fetching your GitHub repositories" }) })
|
|
2311
2664
|
] }) }) }) }),
|
|
2312
|
-
/* @__PURE__ */
|
|
2665
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "gray", children: "Please wait..." }) })
|
|
2313
2666
|
] });
|
|
2314
2667
|
}
|
|
2315
|
-
return /* @__PURE__ */
|
|
2668
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", height: availableHeight, children: [
|
|
2316
2669
|
headerBar,
|
|
2317
|
-
/* @__PURE__ */
|
|
2670
|
+
/* @__PURE__ */ jsx16(Box15, { borderStyle: "single", borderColor: modalOpen ? "gray" : "yellow", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: deleteMode && deleteTarget ? (
|
|
2318
2671
|
// Centered modal; hide list content while modal is open
|
|
2319
|
-
/* @__PURE__ */
|
|
2320
|
-
/* @__PURE__ */
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2672
|
+
/* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
2673
|
+
/* @__PURE__ */ jsx16(Text16, { bold: true, children: "Delete Confirmation" }),
|
|
2674
|
+
/* @__PURE__ */ jsx16(Text16, { color: "red", children: "\u26A0\uFE0F Delete repository?" }),
|
|
2675
|
+
/* @__PURE__ */ jsx16(Box15, { height: 2, children: /* @__PURE__ */ jsx16(Text16, { children: " " }) }),
|
|
2323
2676
|
(() => {
|
|
2324
2677
|
const langName = deleteTarget.primaryLanguage?.name || "";
|
|
2325
2678
|
const langColor = deleteTarget.primaryLanguage?.color || "#666666";
|
|
2326
2679
|
let line1 = "";
|
|
2327
|
-
line1 +=
|
|
2328
|
-
if (deleteTarget.isPrivate) line1 +=
|
|
2329
|
-
if (deleteTarget.isArchived) line1 +=
|
|
2330
|
-
if (deleteTarget.isFork && deleteTarget.parent) line1 +=
|
|
2680
|
+
line1 += chalk12.white(deleteTarget.nameWithOwner);
|
|
2681
|
+
if (deleteTarget.isPrivate) line1 += chalk12.yellow(" Private");
|
|
2682
|
+
if (deleteTarget.isArchived) line1 += chalk12.gray.dim(" Archived");
|
|
2683
|
+
if (deleteTarget.isFork && deleteTarget.parent) line1 += chalk12.blue(` Fork of ${deleteTarget.parent.nameWithOwner}`);
|
|
2331
2684
|
let line2 = "";
|
|
2332
|
-
if (langName) line2 +=
|
|
2333
|
-
line2 +=
|
|
2334
|
-
return /* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */
|
|
2685
|
+
if (langName) line2 += chalk12.hex(langColor)("\u25CF ") + chalk12.gray(`${langName} `);
|
|
2686
|
+
line2 += chalk12.gray(`\u2605 ${deleteTarget.stargazerCount} \u2442 ${deleteTarget.forkCount} Updated ${formatDate(deleteTarget.updatedAt)}`);
|
|
2687
|
+
return /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
2688
|
+
/* @__PURE__ */ jsx16(Text16, { children: line1 }),
|
|
2689
|
+
/* @__PURE__ */ jsx16(Text16, { children: line2 })
|
|
2337
2690
|
] });
|
|
2338
2691
|
})(),
|
|
2339
|
-
/* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsxs15(Text16, { children: [
|
|
2340
2693
|
"Type ",
|
|
2341
|
-
/* @__PURE__ */
|
|
2694
|
+
/* @__PURE__ */ jsx16(Text16, { color: "yellow", bold: true, children: deleteCode }),
|
|
2342
2695
|
" to confirm."
|
|
2343
2696
|
] }) }),
|
|
2344
|
-
!deleteConfirmStage && /* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2347
|
-
|
|
2697
|
+
!deleteConfirmStage && /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, children: [
|
|
2698
|
+
/* @__PURE__ */ jsx16(Text16, { children: "Confirm code: " }),
|
|
2699
|
+
/* @__PURE__ */ jsx16(
|
|
2700
|
+
TextInput5,
|
|
2348
2701
|
{
|
|
2349
2702
|
value: typedCode,
|
|
2350
2703
|
onChange: (v) => {
|
|
@@ -2370,11 +2723,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2370
2723
|
}
|
|
2371
2724
|
)
|
|
2372
2725
|
] }),
|
|
2373
|
-
deleteConfirmStage && /* @__PURE__ */
|
|
2374
|
-
/* @__PURE__ */
|
|
2375
|
-
/* @__PURE__ */
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
|
|
2726
|
+
deleteConfirmStage && /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "column", children: [
|
|
2727
|
+
/* @__PURE__ */ jsx16(Text16, { color: "red", children: "This action will permanently delete the repository. This cannot be undone." }),
|
|
2728
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
2729
|
+
/* @__PURE__ */ jsx16(
|
|
2730
|
+
Box15,
|
|
2378
2731
|
{
|
|
2379
2732
|
borderStyle: "round",
|
|
2380
2733
|
borderColor: "red",
|
|
@@ -2383,11 +2736,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2383
2736
|
alignItems: "center",
|
|
2384
2737
|
justifyContent: "center",
|
|
2385
2738
|
flexDirection: "column",
|
|
2386
|
-
children: /* @__PURE__ */
|
|
2739
|
+
children: /* @__PURE__ */ jsx16(Text16, { children: confirmFocus === "delete" ? chalk12.bgRed.white.bold(" Delete ") : chalk12.red.bold("Delete") })
|
|
2387
2740
|
}
|
|
2388
2741
|
),
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
|
|
2742
|
+
/* @__PURE__ */ jsx16(
|
|
2743
|
+
Box15,
|
|
2391
2744
|
{
|
|
2392
2745
|
borderStyle: "round",
|
|
2393
2746
|
borderColor: confirmFocus === "cancel" ? "white" : "gray",
|
|
@@ -2396,17 +2749,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2396
2749
|
alignItems: "center",
|
|
2397
2750
|
justifyContent: "center",
|
|
2398
2751
|
flexDirection: "column",
|
|
2399
|
-
children: /* @__PURE__ */
|
|
2752
|
+
children: /* @__PURE__ */ jsx16(Text16, { children: confirmFocus === "cancel" ? chalk12.bgGray.white.bold(" Cancel ") : chalk12.gray.bold("Cancel") })
|
|
2400
2753
|
}
|
|
2401
2754
|
)
|
|
2402
2755
|
] }),
|
|
2403
|
-
/* @__PURE__ */
|
|
2756
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
2404
2757
|
"Press Enter to ",
|
|
2405
2758
|
confirmFocus === "delete" ? "Delete" : "Cancel",
|
|
2406
2759
|
" | Y to Delete | C to Cancel"
|
|
2407
2760
|
] }) }),
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
|
|
2761
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(
|
|
2762
|
+
TextInput5,
|
|
2410
2763
|
{
|
|
2411
2764
|
value: "",
|
|
2412
2765
|
onChange: () => {
|
|
@@ -2419,18 +2772,18 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2419
2772
|
}
|
|
2420
2773
|
) })
|
|
2421
2774
|
] }),
|
|
2422
|
-
deleteError && /* @__PURE__ */
|
|
2423
|
-
deleting && /* @__PURE__ */
|
|
2775
|
+
deleteError && /* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "magenta", children: deleteError }) }),
|
|
2776
|
+
deleting && /* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "yellow", children: "Deleting..." }) })
|
|
2424
2777
|
] }) })
|
|
2425
|
-
) : archiveMode && archiveTarget ? /* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
2427
|
-
/* @__PURE__ */
|
|
2428
|
-
/* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
/* @__PURE__ */
|
|
2431
|
-
/* @__PURE__ */
|
|
2432
|
-
/* @__PURE__ */
|
|
2433
|
-
|
|
2778
|
+
) : archiveMode && archiveTarget ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: archiveTarget.isArchived ? "green" : "yellow", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
2779
|
+
/* @__PURE__ */ jsx16(Text16, { bold: true, children: archiveTarget.isArchived ? "Unarchive Confirmation" : "Archive Confirmation" }),
|
|
2780
|
+
/* @__PURE__ */ jsx16(Text16, { color: archiveTarget.isArchived ? "green" : "yellow", children: archiveTarget.isArchived ? "\u21BA Unarchive repository?" : "\u26A0\uFE0F Archive repository?" }),
|
|
2781
|
+
/* @__PURE__ */ jsx16(Box15, { height: 1, children: /* @__PURE__ */ jsx16(Text16, { children: " " }) }),
|
|
2782
|
+
/* @__PURE__ */ jsx16(Text16, { children: archiveTarget.nameWithOwner }),
|
|
2783
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { children: archiveTarget.isArchived ? "This will make the repository active again." : "This will make the repository read-only." }) }),
|
|
2784
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
2785
|
+
/* @__PURE__ */ jsx16(
|
|
2786
|
+
Box15,
|
|
2434
2787
|
{
|
|
2435
2788
|
borderStyle: "round",
|
|
2436
2789
|
borderColor: archiveTarget.isArchived ? "green" : "yellow",
|
|
@@ -2439,11 +2792,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2439
2792
|
alignItems: "center",
|
|
2440
2793
|
justifyContent: "center",
|
|
2441
2794
|
flexDirection: "column",
|
|
2442
|
-
children: /* @__PURE__ */
|
|
2795
|
+
children: /* @__PURE__ */ jsx16(Text16, { children: archiveFocus === "confirm" ? chalk12.bgGreen.white.bold(` ${archiveTarget.isArchived ? "Unarchive" : "Archive"} `) : chalk12.bold[archiveTarget.isArchived ? "green" : "yellow"](archiveTarget.isArchived ? "Unarchive" : "Archive") })
|
|
2443
2796
|
}
|
|
2444
2797
|
),
|
|
2445
|
-
/* @__PURE__ */
|
|
2446
|
-
|
|
2798
|
+
/* @__PURE__ */ jsx16(
|
|
2799
|
+
Box15,
|
|
2447
2800
|
{
|
|
2448
2801
|
borderStyle: "round",
|
|
2449
2802
|
borderColor: archiveFocus === "cancel" ? "white" : "gray",
|
|
@@ -2452,19 +2805,19 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2452
2805
|
alignItems: "center",
|
|
2453
2806
|
justifyContent: "center",
|
|
2454
2807
|
flexDirection: "column",
|
|
2455
|
-
children: /* @__PURE__ */
|
|
2808
|
+
children: /* @__PURE__ */ jsx16(Text16, { children: archiveFocus === "cancel" ? chalk12.bgGray.white.bold(" Cancel ") : chalk12.gray.bold("Cancel") })
|
|
2456
2809
|
}
|
|
2457
2810
|
)
|
|
2458
2811
|
] }),
|
|
2459
|
-
/* @__PURE__ */
|
|
2812
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
2460
2813
|
"Press Enter to ",
|
|
2461
2814
|
archiveFocus === "confirm" ? archiveTarget.isArchived ? "Unarchive" : "Archive" : "Cancel",
|
|
2462
2815
|
" | Y to ",
|
|
2463
2816
|
archiveTarget.isArchived ? "Unarchive" : "Archive",
|
|
2464
2817
|
" | C to Cancel"
|
|
2465
2818
|
] }) }),
|
|
2466
|
-
/* @__PURE__ */
|
|
2467
|
-
|
|
2819
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(
|
|
2820
|
+
TextInput5,
|
|
2468
2821
|
{
|
|
2469
2822
|
value: "",
|
|
2470
2823
|
onChange: () => {
|
|
@@ -2478,21 +2831,21 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2478
2831
|
}
|
|
2479
2832
|
}
|
|
2480
2833
|
) }),
|
|
2481
|
-
archiveError && /* @__PURE__ */
|
|
2482
|
-
archiving && /* @__PURE__ */
|
|
2483
|
-
] }) }) : syncMode && syncTarget ? /* @__PURE__ */
|
|
2484
|
-
/* @__PURE__ */
|
|
2485
|
-
/* @__PURE__ */
|
|
2486
|
-
/* @__PURE__ */
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
syncTarget.parent && /* @__PURE__ */
|
|
2834
|
+
archiveError && /* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "magenta", children: archiveError }) }),
|
|
2835
|
+
archiving && /* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "yellow", children: archiveTarget.isArchived ? "Unarchiving..." : "Archiving..." }) })
|
|
2836
|
+
] }) }) : syncMode && syncTarget ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: "blue", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
2837
|
+
/* @__PURE__ */ jsx16(Text16, { bold: true, children: "Sync Fork Confirmation" }),
|
|
2838
|
+
/* @__PURE__ */ jsx16(Text16, { color: "blue", children: "\u27F2 Sync fork with upstream?" }),
|
|
2839
|
+
/* @__PURE__ */ jsx16(Box15, { height: 1, children: /* @__PURE__ */ jsx16(Text16, { children: " " }) }),
|
|
2840
|
+
/* @__PURE__ */ jsx16(Text16, { children: syncTarget.nameWithOwner }),
|
|
2841
|
+
syncTarget.parent && /* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
2489
2842
|
"Upstream: ",
|
|
2490
2843
|
syncTarget.parent.nameWithOwner
|
|
2491
2844
|
] }),
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2495
|
-
|
|
2845
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { children: "This will merge upstream changes into your fork." }) }),
|
|
2846
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
2847
|
+
/* @__PURE__ */ jsx16(
|
|
2848
|
+
Box15,
|
|
2496
2849
|
{
|
|
2497
2850
|
borderStyle: "round",
|
|
2498
2851
|
borderColor: "blue",
|
|
@@ -2501,11 +2854,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2501
2854
|
alignItems: "center",
|
|
2502
2855
|
justifyContent: "center",
|
|
2503
2856
|
flexDirection: "column",
|
|
2504
|
-
children: /* @__PURE__ */
|
|
2857
|
+
children: /* @__PURE__ */ jsx16(Text16, { children: syncFocus === "confirm" ? chalk12.bgBlue.white.bold(" Sync ") : chalk12.blue.bold("Sync") })
|
|
2505
2858
|
}
|
|
2506
2859
|
),
|
|
2507
|
-
/* @__PURE__ */
|
|
2508
|
-
|
|
2860
|
+
/* @__PURE__ */ jsx16(
|
|
2861
|
+
Box15,
|
|
2509
2862
|
{
|
|
2510
2863
|
borderStyle: "round",
|
|
2511
2864
|
borderColor: syncFocus === "cancel" ? "white" : "gray",
|
|
@@ -2514,17 +2867,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2514
2867
|
alignItems: "center",
|
|
2515
2868
|
justifyContent: "center",
|
|
2516
2869
|
flexDirection: "column",
|
|
2517
|
-
children: /* @__PURE__ */
|
|
2870
|
+
children: /* @__PURE__ */ jsx16(Text16, { children: syncFocus === "cancel" ? chalk12.bgGray.white.bold(" Cancel ") : chalk12.gray.bold("Cancel") })
|
|
2518
2871
|
}
|
|
2519
2872
|
)
|
|
2520
2873
|
] }),
|
|
2521
|
-
/* @__PURE__ */
|
|
2874
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
2522
2875
|
"Press Enter to ",
|
|
2523
2876
|
syncFocus === "confirm" ? "Sync" : "Cancel",
|
|
2524
2877
|
" | Y to Sync | C to Cancel"
|
|
2525
2878
|
] }) }),
|
|
2526
|
-
/* @__PURE__ */
|
|
2527
|
-
|
|
2879
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(
|
|
2880
|
+
TextInput5,
|
|
2528
2881
|
{
|
|
2529
2882
|
value: "",
|
|
2530
2883
|
onChange: () => {
|
|
@@ -2538,14 +2891,14 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2538
2891
|
}
|
|
2539
2892
|
}
|
|
2540
2893
|
) }),
|
|
2541
|
-
syncError && /* @__PURE__ */
|
|
2542
|
-
syncing && /* @__PURE__ */
|
|
2543
|
-
] }) }) : logoutMode ? /* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2547
|
-
/* @__PURE__ */
|
|
2548
|
-
|
|
2894
|
+
syncError && /* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "magenta", children: syncError }) }),
|
|
2895
|
+
syncing && /* @__PURE__ */ jsx16(Box15, { marginTop: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "yellow", children: "Syncing..." }) })
|
|
2896
|
+
] }) }) : logoutMode ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
2897
|
+
/* @__PURE__ */ jsx16(Text16, { bold: true, children: "Logout Confirmation" }),
|
|
2898
|
+
/* @__PURE__ */ jsx16(Text16, { color: "cyan", children: "Are you sure you want to log out?" }),
|
|
2899
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
2900
|
+
/* @__PURE__ */ jsx16(
|
|
2901
|
+
Box15,
|
|
2549
2902
|
{
|
|
2550
2903
|
borderStyle: "round",
|
|
2551
2904
|
borderColor: "cyan",
|
|
@@ -2554,11 +2907,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2554
2907
|
alignItems: "center",
|
|
2555
2908
|
justifyContent: "center",
|
|
2556
2909
|
flexDirection: "column",
|
|
2557
|
-
children: /* @__PURE__ */
|
|
2910
|
+
children: /* @__PURE__ */ jsx16(Text16, { children: logoutFocus === "confirm" ? chalk12.bgCyan.white.bold(" Logout ") : chalk12.cyan.bold("Logout") })
|
|
2558
2911
|
}
|
|
2559
2912
|
),
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
|
|
2913
|
+
/* @__PURE__ */ jsx16(
|
|
2914
|
+
Box15,
|
|
2562
2915
|
{
|
|
2563
2916
|
borderStyle: "round",
|
|
2564
2917
|
borderColor: logoutFocus === "cancel" ? "white" : "gray",
|
|
@@ -2567,16 +2920,16 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2567
2920
|
alignItems: "center",
|
|
2568
2921
|
justifyContent: "center",
|
|
2569
2922
|
flexDirection: "column",
|
|
2570
|
-
children: /* @__PURE__ */
|
|
2923
|
+
children: /* @__PURE__ */ jsx16(Text16, { children: logoutFocus === "cancel" ? chalk12.bgGray.white.bold(" Cancel ") : chalk12.gray.bold("Cancel") })
|
|
2571
2924
|
}
|
|
2572
2925
|
)
|
|
2573
2926
|
] }),
|
|
2574
|
-
/* @__PURE__ */
|
|
2927
|
+
/* @__PURE__ */ jsx16(Box15, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
2575
2928
|
"Press Enter to ",
|
|
2576
2929
|
logoutFocus === "confirm" ? "Logout" : "Cancel",
|
|
2577
2930
|
" | Y to Logout | C to Cancel"
|
|
2578
2931
|
] }) })
|
|
2579
|
-
] }) }) : orgSwitcherOpen ? /* @__PURE__ */
|
|
2932
|
+
] }) }) : orgSwitcherOpen ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx16(
|
|
2580
2933
|
OrgSwitcher,
|
|
2581
2934
|
{
|
|
2582
2935
|
token,
|
|
@@ -2584,45 +2937,45 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2584
2937
|
onSelect: handleOrgContextChange,
|
|
2585
2938
|
onClose: () => setOrgSwitcherOpen(false)
|
|
2586
2939
|
}
|
|
2587
|
-
) }) : infoMode ? /* @__PURE__ */
|
|
2940
|
+
) }) : infoMode ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: (() => {
|
|
2588
2941
|
const repo = infoRepo || visibleItems[cursor];
|
|
2589
|
-
if (!repo) return /* @__PURE__ */
|
|
2942
|
+
if (!repo) return /* @__PURE__ */ jsx16(Text16, { color: "red", children: "No repository selected." });
|
|
2590
2943
|
const langName = repo.primaryLanguage?.name || "N/A";
|
|
2591
2944
|
const langColor = repo.primaryLanguage?.color || "#666666";
|
|
2592
|
-
return /* @__PURE__ */
|
|
2593
|
-
/* @__PURE__ */
|
|
2945
|
+
return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 90), children: [
|
|
2946
|
+
/* @__PURE__ */ jsxs15(Text16, { bold: true, children: [
|
|
2594
2947
|
"Repository Info ",
|
|
2595
|
-
infoRepo ?
|
|
2948
|
+
infoRepo ? chalk12.dim("(cached)") : ""
|
|
2596
2949
|
] }),
|
|
2597
|
-
/* @__PURE__ */
|
|
2598
|
-
/* @__PURE__ */
|
|
2599
|
-
repo.description && /* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
repo.visibility === "PRIVATE" ?
|
|
2603
|
-
repo.isArchived ?
|
|
2604
|
-
repo.isFork ?
|
|
2950
|
+
/* @__PURE__ */ jsx16(Box15, { height: 1, children: /* @__PURE__ */ jsx16(Text16, { children: " " }) }),
|
|
2951
|
+
/* @__PURE__ */ jsx16(Text16, { children: chalk12.bold(repo.nameWithOwner) }),
|
|
2952
|
+
repo.description && /* @__PURE__ */ jsx16(Text16, { color: "gray", children: repo.description }),
|
|
2953
|
+
/* @__PURE__ */ jsx16(Box15, { height: 1, children: /* @__PURE__ */ jsx16(Text16, { children: " " }) }),
|
|
2954
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
2955
|
+
repo.visibility === "PRIVATE" ? chalk12.yellow("Private") : repo.visibility === "INTERNAL" ? chalk12.magenta("Internal") : chalk12.green("Public"),
|
|
2956
|
+
repo.isArchived ? chalk12.gray(" Archived") : "",
|
|
2957
|
+
repo.isFork ? chalk12.blue(" Fork") : ""
|
|
2605
2958
|
] }),
|
|
2606
|
-
/* @__PURE__ */
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
|
|
2609
|
-
|
|
2959
|
+
/* @__PURE__ */ jsx16(Text16, { children: chalk12.gray(`\u2605 ${repo.stargazerCount} \u2442 ${repo.forkCount}`) }),
|
|
2960
|
+
/* @__PURE__ */ jsxs15(Text16, { children: [
|
|
2961
|
+
chalk12.hex(langColor)(`\u25CF `),
|
|
2962
|
+
chalk12.gray(`${langName}`)
|
|
2610
2963
|
] }),
|
|
2611
|
-
/* @__PURE__ */
|
|
2964
|
+
/* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
2612
2965
|
"Updated: ",
|
|
2613
2966
|
formatDate(repo.updatedAt),
|
|
2614
2967
|
" \u2022 Pushed: ",
|
|
2615
2968
|
formatDate(repo.pushedAt)
|
|
2616
2969
|
] }),
|
|
2617
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsxs15(Text16, { color: "gray", children: [
|
|
2618
2971
|
"Size: ",
|
|
2619
2972
|
repo.diskUsage,
|
|
2620
2973
|
" KB"
|
|
2621
2974
|
] }),
|
|
2622
|
-
/* @__PURE__ */
|
|
2623
|
-
/* @__PURE__ */
|
|
2975
|
+
/* @__PURE__ */ jsx16(Box15, { height: 1, children: /* @__PURE__ */ jsx16(Text16, { children: " " }) }),
|
|
2976
|
+
/* @__PURE__ */ jsx16(Text16, { color: "gray", children: "Press Esc or I to close" })
|
|
2624
2977
|
] });
|
|
2625
|
-
})() }) : visibilityMode ? /* @__PURE__ */
|
|
2978
|
+
})() }) : visibilityMode ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx16(
|
|
2626
2979
|
VisibilityModal,
|
|
2627
2980
|
{
|
|
2628
2981
|
currentFilter: visibilityFilter,
|
|
@@ -2635,7 +2988,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2635
2988
|
},
|
|
2636
2989
|
onCancel: () => setVisibilityMode(false)
|
|
2637
2990
|
}
|
|
2638
|
-
) }) : sortMode ? /* @__PURE__ */
|
|
2991
|
+
) }) : sortMode ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx16(
|
|
2639
2992
|
SortModal,
|
|
2640
2993
|
{
|
|
2641
2994
|
currentSort: sortKey,
|
|
@@ -2647,7 +3000,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2647
3000
|
},
|
|
2648
3001
|
onCancel: () => setSortMode(false)
|
|
2649
3002
|
}
|
|
2650
|
-
) }) : changeVisibilityMode && changeVisibilityTarget ? /* @__PURE__ */
|
|
3003
|
+
) }) : changeVisibilityMode && changeVisibilityTarget ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx16(
|
|
2651
3004
|
ChangeVisibilityModal,
|
|
2652
3005
|
{
|
|
2653
3006
|
isOpen: changeVisibilityMode,
|
|
@@ -2660,8 +3013,23 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2660
3013
|
changing: changingVisibility,
|
|
2661
3014
|
error: changeVisibilityError
|
|
2662
3015
|
}
|
|
2663
|
-
) }) : /* @__PURE__ */
|
|
2664
|
-
|
|
3016
|
+
) }) : renameMode && renameTarget ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx16(
|
|
3017
|
+
RenameModal,
|
|
3018
|
+
{
|
|
3019
|
+
repo: renameTarget,
|
|
3020
|
+
onRename: executeRename,
|
|
3021
|
+
onCancel: closeRenameModal
|
|
3022
|
+
}
|
|
3023
|
+
) }) : copyUrlMode ? /* @__PURE__ */ jsx16(Box15, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx16(
|
|
3024
|
+
CopyUrlModal,
|
|
3025
|
+
{
|
|
3026
|
+
repo: copyUrlTarget,
|
|
3027
|
+
terminalWidth,
|
|
3028
|
+
onClose: closeCopyUrlModal,
|
|
3029
|
+
onCopy: handleCopyUrl
|
|
3030
|
+
}
|
|
3031
|
+
) }) : /* @__PURE__ */ jsxs15(Fragment8, { children: [
|
|
3032
|
+
/* @__PURE__ */ jsx16(
|
|
2665
3033
|
RepoListHeader,
|
|
2666
3034
|
{
|
|
2667
3035
|
ownerContext,
|
|
@@ -2675,10 +3043,10 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2675
3043
|
isEnterprise: isEnterpriseOrg
|
|
2676
3044
|
}
|
|
2677
3045
|
),
|
|
2678
|
-
filterMode && /* @__PURE__ */
|
|
2679
|
-
/* @__PURE__ */
|
|
2680
|
-
/* @__PURE__ */
|
|
2681
|
-
|
|
3046
|
+
filterMode && /* @__PURE__ */ jsxs15(Box15, { marginBottom: 1, children: [
|
|
3047
|
+
/* @__PURE__ */ jsx16(Text16, { children: "Search: " }),
|
|
3048
|
+
/* @__PURE__ */ jsx16(
|
|
3049
|
+
TextInput5,
|
|
2682
3050
|
{
|
|
2683
3051
|
value: filter,
|
|
2684
3052
|
onChange: (val) => {
|
|
@@ -2717,10 +3085,10 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2717
3085
|
}
|
|
2718
3086
|
)
|
|
2719
3087
|
] }),
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
filterMode && filter.trim().length > 0 && filter.trim().length < 3 ? /* @__PURE__ */
|
|
3088
|
+
/* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", height: listHeight, children: [
|
|
3089
|
+
filterMode && filter.trim().length > 0 && filter.trim().length < 3 ? /* @__PURE__ */ jsx16(Box15, { justifyContent: "center", alignItems: "center", flexGrow: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "gray", dimColor: true, children: "Type at least 3 characters to search" }) }) : visibleItems.slice(windowed.start, windowed.end).map((repo, i) => {
|
|
2722
3090
|
const idx = windowed.start + i;
|
|
2723
|
-
return /* @__PURE__ */
|
|
3091
|
+
return /* @__PURE__ */ jsx16(
|
|
2724
3092
|
RepoRow,
|
|
2725
3093
|
{
|
|
2726
3094
|
repo,
|
|
@@ -2733,32 +3101,34 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
2733
3101
|
repo.nameWithOwner
|
|
2734
3102
|
);
|
|
2735
3103
|
}),
|
|
2736
|
-
loadingMore && hasNextPage && /* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
3104
|
+
loadingMore && hasNextPage && /* @__PURE__ */ jsx16(Box15, { justifyContent: "center", alignItems: "center", marginTop: 1, children: /* @__PURE__ */ jsxs15(Box15, { flexDirection: "row", children: [
|
|
3105
|
+
/* @__PURE__ */ jsx16(Box15, { width: 2, flexShrink: 0, flexGrow: 0, marginRight: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "cyan", children: /* @__PURE__ */ jsx16(SlowSpinner, {}) }) }),
|
|
3106
|
+
/* @__PURE__ */ jsx16(Text16, { color: "cyan", children: "Loading more repositories..." })
|
|
2739
3107
|
] }) }),
|
|
2740
|
-
!loading && !searchLoading && visibleItems.length === 0 && /* @__PURE__ */
|
|
3108
|
+
!loading && !searchLoading && visibleItems.length === 0 && /* @__PURE__ */ jsx16(Box15, { justifyContent: "center", alignItems: "center", flexGrow: 1, children: /* @__PURE__ */ jsx16(Text16, { color: "gray", dimColor: true, children: searchActive ? "No repositories match your search" : filter ? "No repositories match your filter" : "No repositories found" }) })
|
|
2741
3109
|
] })
|
|
2742
3110
|
] }) }),
|
|
2743
|
-
/* @__PURE__ */
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
3111
|
+
/* @__PURE__ */ jsxs15(Box15, { marginTop: 1, paddingX: 1, flexDirection: "column", children: [
|
|
3112
|
+
/* @__PURE__ */ jsx16(Box15, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx16(Text16, { color: "gray", dimColor: modalOpen ? true : void 0, children: "\u2191\u2193 Navigate \u2022 Ctrl+G Top \u2022 G Bottom \u2022 \u23CE/O Open \u2022 R Refresh" }) }),
|
|
3113
|
+
/* @__PURE__ */ jsx16(Box15, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx16(Text16, { color: "gray", dimColor: modalOpen ? true : void 0, children: "/ Search \u2022 S Sort \u2022 D Direction \u2022 T Density \u2022 F Fork Status \u2022 V Visibility" }) }),
|
|
3114
|
+
/* @__PURE__ */ jsx16(Box15, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx16(Text16, { color: "gray", dimColor: modalOpen ? true : void 0, children: "I Info \u2022 C Copy URL \u2022 Ctrl+R Rename \u2022 Ctrl+A Un/Archive \u2022 Ctrl+V Change Visibility \u2022 Ctrl+S Sync Fork" }) }),
|
|
3115
|
+
/* @__PURE__ */ jsx16(Box15, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx16(Text16, { color: "gray", dimColor: modalOpen ? true : void 0, children: "K Cache Info \u2022 W Org Switch \u2022 Del/Backspace Delete \u2022 Ctrl+L Logout \u2022 Q Quit" }) })
|
|
2747
3116
|
] }),
|
|
2748
|
-
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */
|
|
2749
|
-
/* @__PURE__ */
|
|
2750
|
-
debugMessages.length === 0 ? /* @__PURE__ */
|
|
2751
|
-
] })
|
|
3117
|
+
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */ jsxs15(Box15, { marginTop: 1, borderStyle: "single", borderColor: "yellow", paddingX: 1, flexDirection: "column", children: [
|
|
3118
|
+
/* @__PURE__ */ jsx16(Text16, { bold: true, color: "yellow", children: "Debug Messages:" }),
|
|
3119
|
+
debugMessages.length === 0 ? /* @__PURE__ */ jsx16(Text16, { color: "gray", children: "No debug messages yet..." }) : debugMessages.map((msg, i) => /* @__PURE__ */ jsx16(Text16, { color: "gray", children: msg }, i))
|
|
3120
|
+
] }),
|
|
3121
|
+
copyToast && /* @__PURE__ */ jsx16(Box15, { marginTop: 1, justifyContent: "center", children: /* @__PURE__ */ jsx16(Box15, { borderStyle: "round", borderColor: copyToast.includes("Failed") ? "red" : "green", paddingX: 2, paddingY: 0, children: /* @__PURE__ */ jsx16(Text16, { color: copyToast.includes("Failed") ? "red" : "green", children: copyToast }) }) })
|
|
2752
3122
|
] });
|
|
2753
3123
|
}
|
|
2754
3124
|
|
|
2755
3125
|
// src/ui/components/auth/AuthMethodSelector.tsx
|
|
2756
|
-
import { useState as
|
|
2757
|
-
import { Box as
|
|
2758
|
-
import
|
|
2759
|
-
import { jsx as
|
|
3126
|
+
import { useState as useState13 } from "react";
|
|
3127
|
+
import { Box as Box16, Text as Text17, useInput as useInput13 } from "ink";
|
|
3128
|
+
import chalk13 from "chalk";
|
|
3129
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2760
3130
|
function AuthMethodSelector({ onSelect, onQuit }) {
|
|
2761
|
-
const [selectedIndex, setSelectedIndex] =
|
|
3131
|
+
const [selectedIndex, setSelectedIndex] = useState13(0);
|
|
2762
3132
|
const methods = [
|
|
2763
3133
|
{
|
|
2764
3134
|
key: "oauth",
|
|
@@ -2771,7 +3141,7 @@ function AuthMethodSelector({ onSelect, onQuit }) {
|
|
|
2771
3141
|
description: "Manually enter a GitHub Personal Access Token"
|
|
2772
3142
|
}
|
|
2773
3143
|
];
|
|
2774
|
-
|
|
3144
|
+
useInput13((input, key) => {
|
|
2775
3145
|
if (key.escape || input?.toLowerCase() === "q") {
|
|
2776
3146
|
if (onQuit) {
|
|
2777
3147
|
onQuit();
|
|
@@ -2790,34 +3160,34 @@ function AuthMethodSelector({ onSelect, onQuit }) {
|
|
|
2790
3160
|
onSelect("pat");
|
|
2791
3161
|
}
|
|
2792
3162
|
});
|
|
2793
|
-
return /* @__PURE__ */
|
|
2794
|
-
/* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
3163
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", paddingX: 2, paddingY: 1, children: [
|
|
3164
|
+
/* @__PURE__ */ jsx17(Text17, { bold: true, marginBottom: 1, children: "Choose Authentication Method" }),
|
|
3165
|
+
/* @__PURE__ */ jsx17(Box16, { flexDirection: "column", marginY: 1, children: methods.map((method, index) => {
|
|
2796
3166
|
const isSelected = index === selectedIndex;
|
|
2797
|
-
const prefix = isSelected ?
|
|
3167
|
+
const prefix = isSelected ? chalk13.cyan("\u203A") : " ";
|
|
2798
3168
|
const numberPrefix = `${index + 1}.`;
|
|
2799
|
-
return /* @__PURE__ */
|
|
2800
|
-
/* @__PURE__ */
|
|
3169
|
+
return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", marginBottom: 1, children: [
|
|
3170
|
+
/* @__PURE__ */ jsx17(Text17, { children: /* @__PURE__ */ jsxs16(Text17, { color: isSelected ? "cyan" : void 0, bold: isSelected, children: [
|
|
2801
3171
|
prefix,
|
|
2802
3172
|
" ",
|
|
2803
3173
|
numberPrefix,
|
|
2804
3174
|
" ",
|
|
2805
3175
|
method.label
|
|
2806
3176
|
] }) }),
|
|
2807
|
-
/* @__PURE__ */
|
|
3177
|
+
/* @__PURE__ */ jsxs16(Text17, { color: "gray", dimColor: true, children: [
|
|
2808
3178
|
" ",
|
|
2809
3179
|
method.description
|
|
2810
3180
|
] })
|
|
2811
3181
|
] }, method.key);
|
|
2812
3182
|
}) }),
|
|
2813
|
-
/* @__PURE__ */
|
|
3183
|
+
/* @__PURE__ */ jsx17(Text17, { color: "gray", dimColor: true, marginTop: 1, children: "Use arrow keys to navigate, Enter to select, or press 1/2 \u2022 Q/Esc to quit" })
|
|
2814
3184
|
] });
|
|
2815
3185
|
}
|
|
2816
3186
|
|
|
2817
3187
|
// src/ui/components/auth/OAuthProgress.tsx
|
|
2818
|
-
import { Box as
|
|
3188
|
+
import { Box as Box17, Text as Text18 } from "ink";
|
|
2819
3189
|
import Spinner from "ink-spinner";
|
|
2820
|
-
import { jsx as
|
|
3190
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2821
3191
|
function OAuthProgress({ status, error, deviceCode }) {
|
|
2822
3192
|
const statusMessages = {
|
|
2823
3193
|
initializing: {
|
|
@@ -2854,69 +3224,69 @@ function OAuthProgress({ status, error, deviceCode }) {
|
|
|
2854
3224
|
}
|
|
2855
3225
|
};
|
|
2856
3226
|
const { message, showSpinner } = statusMessages[status];
|
|
2857
|
-
return /* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */
|
|
3227
|
+
return /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", borderStyle: "single", borderColor: status === "error" ? "red" : "cyan", paddingX: 2, paddingY: 1, children: [
|
|
3228
|
+
/* @__PURE__ */ jsx18(Text18, { bold: true, marginBottom: 1, children: "GitHub OAuth Authentication" }),
|
|
3229
|
+
/* @__PURE__ */ jsx18(Box17, { marginY: 1, children: showSpinner ? /* @__PURE__ */ jsxs17(Box17, { children: [
|
|
3230
|
+
/* @__PURE__ */ jsx18(Text18, { color: "green", children: /* @__PURE__ */ jsx18(Spinner, { type: "dots" }) }),
|
|
3231
|
+
/* @__PURE__ */ jsxs17(Text18, { children: [
|
|
2862
3232
|
" ",
|
|
2863
3233
|
message
|
|
2864
3234
|
] })
|
|
2865
|
-
] }) : /* @__PURE__ */
|
|
3235
|
+
] }) : /* @__PURE__ */ jsxs17(Text18, { color: status === "error" ? "red" : "green", children: [
|
|
2866
3236
|
status === "error" ? "\u2717" : "\u2713",
|
|
2867
3237
|
" ",
|
|
2868
3238
|
message
|
|
2869
3239
|
] }) }),
|
|
2870
|
-
(status === "waiting_for_authorization" || status === "polling_for_token") && deviceCode && /* @__PURE__ */
|
|
2871
|
-
/* @__PURE__ */
|
|
2872
|
-
/* @__PURE__ */
|
|
2873
|
-
/* @__PURE__ */
|
|
2874
|
-
/* @__PURE__ */
|
|
3240
|
+
(status === "waiting_for_authorization" || status === "polling_for_token") && deviceCode && /* @__PURE__ */ jsxs17(Box17, { marginY: 1, flexDirection: "column", children: [
|
|
3241
|
+
/* @__PURE__ */ jsx18(Text18, { bold: true, color: "cyan", marginBottom: 1, children: "\u{1F4CB} Please complete these steps:" }),
|
|
3242
|
+
/* @__PURE__ */ jsxs17(Box17, { marginBottom: 1, children: [
|
|
3243
|
+
/* @__PURE__ */ jsx18(Text18, { children: "1. Visit: " }),
|
|
3244
|
+
/* @__PURE__ */ jsx18(Text18, { bold: true, color: "blue", children: deviceCode.verification_uri })
|
|
2875
3245
|
] }),
|
|
2876
|
-
/* @__PURE__ */
|
|
2877
|
-
/* @__PURE__ */
|
|
2878
|
-
/* @__PURE__ */
|
|
3246
|
+
/* @__PURE__ */ jsxs17(Box17, { marginBottom: 1, flexDirection: "column", children: [
|
|
3247
|
+
/* @__PURE__ */ jsx18(Text18, { children: "2. Enter this code:" }),
|
|
3248
|
+
/* @__PURE__ */ jsx18(Box17, { borderStyle: "single", borderColor: "yellow", paddingX: 2, paddingY: 1, marginTop: 1, children: /* @__PURE__ */ jsx18(Text18, { bold: true, color: "yellow", children: deviceCode.user_code }) })
|
|
2879
3249
|
] }),
|
|
2880
|
-
status === "waiting_for_authorization" && /* @__PURE__ */
|
|
2881
|
-
status === "polling_for_token" && /* @__PURE__ */
|
|
2882
|
-
/* @__PURE__ */
|
|
2883
|
-
/* @__PURE__ */
|
|
3250
|
+
status === "waiting_for_authorization" && /* @__PURE__ */ jsx18(Text18, { color: "gray", marginTop: 1, children: "Your browser should open automatically." }),
|
|
3251
|
+
status === "polling_for_token" && /* @__PURE__ */ jsxs17(Box17, { flexDirection: "column", marginTop: 1, children: [
|
|
3252
|
+
/* @__PURE__ */ jsx18(Text18, { color: "gray", children: "Waiting for you to complete authorization in your browser..." }),
|
|
3253
|
+
/* @__PURE__ */ jsx18(Text18, { color: "gray", dimColor: true, marginTop: 1, children: "This will timeout in 15 minutes. Press Esc to cancel." })
|
|
2884
3254
|
] })
|
|
2885
3255
|
] }),
|
|
2886
|
-
status === "error" && error && /* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
/* @__PURE__ */
|
|
3256
|
+
status === "error" && error && /* @__PURE__ */ jsxs17(Box17, { marginY: 1, flexDirection: "column", children: [
|
|
3257
|
+
/* @__PURE__ */ jsx18(Text18, { color: "red", children: error }),
|
|
3258
|
+
/* @__PURE__ */ jsx18(Text18, { color: "gray", marginTop: 1, children: "Press Esc to go back and try again." })
|
|
2889
3259
|
] }),
|
|
2890
|
-
status === "success" && /* @__PURE__ */
|
|
3260
|
+
status === "success" && /* @__PURE__ */ jsx18(Text18, { color: "gray", marginTop: 1, children: "Returning to application..." })
|
|
2891
3261
|
] });
|
|
2892
3262
|
}
|
|
2893
3263
|
|
|
2894
3264
|
// src/ui/App.tsx
|
|
2895
|
-
import { jsx as
|
|
3265
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2896
3266
|
var packageJson = require_package();
|
|
2897
3267
|
function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlineTokenEphemeral }) {
|
|
2898
3268
|
const { exit } = useApp2();
|
|
2899
3269
|
const { stdout } = useStdout2();
|
|
2900
|
-
const [mode, setMode] =
|
|
2901
|
-
const [token, setToken] =
|
|
2902
|
-
const [input, setInput] =
|
|
2903
|
-
const [error, setError] =
|
|
2904
|
-
const [viewer, setViewer] =
|
|
2905
|
-
const [rateLimitReset, setRateLimitReset] =
|
|
2906
|
-
const [wasRateLimited, setWasRateLimited] =
|
|
2907
|
-
const [orgContext, setOrgContext] =
|
|
2908
|
-
const [authMethod, setAuthMethod] =
|
|
2909
|
-
const [oauthStatus, setOAuthStatus] =
|
|
2910
|
-
const [tokenSource, setTokenSource] =
|
|
2911
|
-
const [sessionTokenOrigin, setSessionTokenOrigin] =
|
|
2912
|
-
const [deviceCodeResponse, setDeviceCodeResponse] =
|
|
2913
|
-
const [oauthDeviceCode, setOauthDeviceCode] =
|
|
2914
|
-
const [dims, setDims] =
|
|
3270
|
+
const [mode, setMode] = useState14("checking");
|
|
3271
|
+
const [token, setToken] = useState14(null);
|
|
3272
|
+
const [input, setInput] = useState14("");
|
|
3273
|
+
const [error, setError] = useState14(null);
|
|
3274
|
+
const [viewer, setViewer] = useState14(null);
|
|
3275
|
+
const [rateLimitReset, setRateLimitReset] = useState14(null);
|
|
3276
|
+
const [wasRateLimited, setWasRateLimited] = useState14(false);
|
|
3277
|
+
const [orgContext, setOrgContext] = useState14("personal");
|
|
3278
|
+
const [authMethod, setAuthMethod] = useState14("pat");
|
|
3279
|
+
const [oauthStatus, setOAuthStatus] = useState14("initializing");
|
|
3280
|
+
const [tokenSource, setTokenSource] = useState14("pat");
|
|
3281
|
+
const [sessionTokenOrigin, setSessionTokenOrigin] = useState14("stored");
|
|
3282
|
+
const [deviceCodeResponse, setDeviceCodeResponse] = useState14(null);
|
|
3283
|
+
const [oauthDeviceCode, setOauthDeviceCode] = useState14(null);
|
|
3284
|
+
const [dims, setDims] = useState14(() => {
|
|
2915
3285
|
const cols = stdout?.columns ?? 100;
|
|
2916
3286
|
const rows = stdout?.rows ?? 30;
|
|
2917
3287
|
return { cols, rows };
|
|
2918
3288
|
});
|
|
2919
|
-
|
|
3289
|
+
useEffect9(() => {
|
|
2920
3290
|
if (!stdout) return;
|
|
2921
3291
|
const onResize = () => {
|
|
2922
3292
|
const cols = stdout.columns ?? 100;
|
|
@@ -2928,7 +3298,7 @@ function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlin
|
|
|
2928
3298
|
stdout.off?.("resize", onResize);
|
|
2929
3299
|
};
|
|
2930
3300
|
}, [stdout]);
|
|
2931
|
-
|
|
3301
|
+
useEffect9(() => {
|
|
2932
3302
|
const env = getTokenFromEnv();
|
|
2933
3303
|
const stored = getStoredToken();
|
|
2934
3304
|
const source = getTokenSource();
|
|
@@ -2952,7 +3322,7 @@ function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlin
|
|
|
2952
3322
|
setMode("auth_method_selection");
|
|
2953
3323
|
}
|
|
2954
3324
|
}, [inlineToken2]);
|
|
2955
|
-
|
|
3325
|
+
useEffect9(() => {
|
|
2956
3326
|
if (mode !== "oauth_flow") return;
|
|
2957
3327
|
(async () => {
|
|
2958
3328
|
try {
|
|
@@ -3004,7 +3374,7 @@ function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlin
|
|
|
3004
3374
|
setMode("oauth_flow");
|
|
3005
3375
|
}
|
|
3006
3376
|
};
|
|
3007
|
-
|
|
3377
|
+
useEffect9(() => {
|
|
3008
3378
|
(async () => {
|
|
3009
3379
|
if (mode !== "validating" || !token) return;
|
|
3010
3380
|
const timeoutId = setTimeout(() => {
|
|
@@ -3116,7 +3486,7 @@ function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlin
|
|
|
3116
3486
|
setTokenSource("pat");
|
|
3117
3487
|
setMode("auth_method_selection");
|
|
3118
3488
|
};
|
|
3119
|
-
|
|
3489
|
+
useInput14((input2, key) => {
|
|
3120
3490
|
if ((mode === "prompt" || mode === "auth_method_selection") && key.escape) {
|
|
3121
3491
|
exit();
|
|
3122
3492
|
}
|
|
@@ -3148,19 +3518,19 @@ function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlin
|
|
|
3148
3518
|
}
|
|
3149
3519
|
});
|
|
3150
3520
|
const verticalPadding = Math.floor(dims.rows * 0.15);
|
|
3151
|
-
const header = useMemo2(() => /* @__PURE__ */
|
|
3152
|
-
/* @__PURE__ */
|
|
3153
|
-
/* @__PURE__ */
|
|
3521
|
+
const header = useMemo2(() => /* @__PURE__ */ jsxs18(Box18, { flexDirection: "row", justifyContent: "space-between", marginBottom: 1, children: [
|
|
3522
|
+
/* @__PURE__ */ jsxs18(Box18, { flexDirection: "row", gap: 1, children: [
|
|
3523
|
+
/* @__PURE__ */ jsxs18(Text19, { bold: true, color: "cyan", children: [
|
|
3154
3524
|
" ",
|
|
3155
3525
|
"GitHub Repository Manager"
|
|
3156
3526
|
] }),
|
|
3157
|
-
/* @__PURE__ */
|
|
3527
|
+
/* @__PURE__ */ jsxs18(Text19, { color: "gray", dimColor: true, children: [
|
|
3158
3528
|
"v",
|
|
3159
3529
|
packageJson.version
|
|
3160
3530
|
] }),
|
|
3161
|
-
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */
|
|
3531
|
+
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */ jsx19(Text19, { backgroundColor: "blue", color: "white", children: " debug mode " })
|
|
3162
3532
|
] }),
|
|
3163
|
-
viewer && /* @__PURE__ */
|
|
3533
|
+
viewer && /* @__PURE__ */ jsx19(Text19, { color: "gray", children: orgContext !== "personal" && orgContext.login ? `${orgContext.login}/@${viewer} ` : `@${viewer} ` })
|
|
3164
3534
|
] }), [viewer, orgContext]);
|
|
3165
3535
|
if (mode === "rate_limited") {
|
|
3166
3536
|
const formatResetTime = (resetTime) => {
|
|
@@ -3183,71 +3553,71 @@ function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlin
|
|
|
3183
3553
|
return "Unknown";
|
|
3184
3554
|
}
|
|
3185
3555
|
};
|
|
3186
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
3187
3557
|
header,
|
|
3188
|
-
/* @__PURE__ */
|
|
3189
|
-
/* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3191
|
-
/* @__PURE__ */
|
|
3192
|
-
rateLimitReset && /* @__PURE__ */
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
/* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ jsx19(Box18, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs18(Box18, { borderStyle: "single", borderColor: "yellow", paddingX: 3, paddingY: 2, flexDirection: "column", width: Math.min(dims.cols - 8, 80), children: [
|
|
3559
|
+
/* @__PURE__ */ jsx19(Text19, { bold: true, color: "yellow", marginBottom: 1, children: "\u26A0\uFE0F Rate Limit Exceeded" }),
|
|
3560
|
+
/* @__PURE__ */ jsx19(Text19, { color: "gray", marginBottom: 1, children: "You've hit GitHub's API rate limit for your token." }),
|
|
3561
|
+
/* @__PURE__ */ jsx19(Text19, { color: "gray", marginBottom: 1, children: "This happens when you make too many requests in a short time." }),
|
|
3562
|
+
rateLimitReset && /* @__PURE__ */ jsxs18(Box18, { marginTop: 1, marginBottom: 1, children: [
|
|
3563
|
+
/* @__PURE__ */ jsxs18(Text19, { children: [
|
|
3564
|
+
/* @__PURE__ */ jsx19(Text19, { color: "cyan", children: "Reset in:" }),
|
|
3195
3565
|
" ",
|
|
3196
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsx19(Text19, { bold: true, children: formatResetTime(rateLimitReset) })
|
|
3197
3567
|
] }),
|
|
3198
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsxs18(Text19, { color: "gray", dimColor: true, children: [
|
|
3199
3569
|
"(",
|
|
3200
3570
|
new Date(rateLimitReset).toLocaleTimeString(),
|
|
3201
3571
|
")"
|
|
3202
3572
|
] })
|
|
3203
3573
|
] }),
|
|
3204
|
-
/* @__PURE__ */
|
|
3205
|
-
/* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3208
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsxs18(Box18, { marginTop: 2, flexDirection: "column", gap: 1, children: [
|
|
3575
|
+
/* @__PURE__ */ jsx19(Text19, { bold: true, children: "What would you like to do?" }),
|
|
3576
|
+
/* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", paddingLeft: 2, children: [
|
|
3577
|
+
/* @__PURE__ */ jsxs18(Text19, { children: [
|
|
3578
|
+
/* @__PURE__ */ jsx19(Text19, { color: "cyan", bold: true, children: "R" }),
|
|
3209
3579
|
" - Retry now ",
|
|
3210
3580
|
rateLimitReset && formatResetTime(rateLimitReset) !== "Now (should be reset)" ? "(likely to fail until reset)" : "(should work now)"
|
|
3211
3581
|
] }),
|
|
3212
|
-
/* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */
|
|
3582
|
+
/* @__PURE__ */ jsxs18(Text19, { children: [
|
|
3583
|
+
/* @__PURE__ */ jsx19(Text19, { color: "cyan", bold: true, children: "L" }),
|
|
3214
3584
|
" - Logout and choose authentication method"
|
|
3215
3585
|
] }),
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsxs18(Text19, { children: [
|
|
3587
|
+
/* @__PURE__ */ jsx19(Text19, { color: "gray", bold: true, children: "Q/Esc" }),
|
|
3218
3588
|
" - Quit application"
|
|
3219
3589
|
] })
|
|
3220
3590
|
] })
|
|
3221
3591
|
] }),
|
|
3222
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx19(Text19, { color: "gray", dimColor: true, marginTop: 2, children: "Tip: Using multiple tokens or waiting between requests can help avoid rate limits." })
|
|
3223
3593
|
] }) })
|
|
3224
3594
|
] });
|
|
3225
3595
|
}
|
|
3226
3596
|
if (mode === "auth_method_selection") {
|
|
3227
|
-
return /* @__PURE__ */
|
|
3597
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
3228
3598
|
header,
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
error && /* @__PURE__ */
|
|
3599
|
+
/* @__PURE__ */ jsx19(Box18, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", alignItems: "center", children: [
|
|
3600
|
+
/* @__PURE__ */ jsx19(AuthMethodSelector, { onSelect: handleAuthMethodSelect }),
|
|
3601
|
+
error && /* @__PURE__ */ jsx19(Text19, { color: "red", marginTop: 1, children: error })
|
|
3232
3602
|
] }) })
|
|
3233
3603
|
] });
|
|
3234
3604
|
}
|
|
3235
3605
|
if (mode === "oauth_flow") {
|
|
3236
|
-
return /* @__PURE__ */
|
|
3606
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
3237
3607
|
header,
|
|
3238
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ jsx19(Box18, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx19(OAuthProgress, { status: oauthStatus, error: error || void 0, deviceCode: oauthDeviceCode || void 0 }) })
|
|
3239
3609
|
] });
|
|
3240
3610
|
}
|
|
3241
3611
|
if (mode === "prompt") {
|
|
3242
|
-
return /* @__PURE__ */
|
|
3612
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
3243
3613
|
header,
|
|
3244
|
-
/* @__PURE__ */
|
|
3245
|
-
/* @__PURE__ */
|
|
3246
|
-
/* @__PURE__ */
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3249
|
-
/* @__PURE__ */
|
|
3250
|
-
|
|
3614
|
+
/* @__PURE__ */ jsx19(Box18, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs18(Box18, { borderStyle: "single", borderColor: "cyan", paddingX: 2, paddingY: 1, flexDirection: "column", children: [
|
|
3615
|
+
/* @__PURE__ */ jsx19(Text19, { bold: true, marginBottom: 1, children: "Authentication Required" }),
|
|
3616
|
+
/* @__PURE__ */ jsx19(Text19, { color: "gray", marginBottom: 1, children: "Enter your GitHub Personal Access Token" }),
|
|
3617
|
+
/* @__PURE__ */ jsxs18(Box18, { children: [
|
|
3618
|
+
/* @__PURE__ */ jsx19(Text19, { children: "Token: " }),
|
|
3619
|
+
/* @__PURE__ */ jsx19(
|
|
3620
|
+
TextInput6,
|
|
3251
3621
|
{
|
|
3252
3622
|
value: input,
|
|
3253
3623
|
onChange: setInput,
|
|
@@ -3256,30 +3626,30 @@ function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlin
|
|
|
3256
3626
|
}
|
|
3257
3627
|
)
|
|
3258
3628
|
] }),
|
|
3259
|
-
error && /* @__PURE__ */
|
|
3260
|
-
/* @__PURE__ */
|
|
3261
|
-
/* @__PURE__ */
|
|
3629
|
+
error && /* @__PURE__ */ jsx19(Text19, { color: "red", marginTop: 1, children: error }),
|
|
3630
|
+
/* @__PURE__ */ jsx19(Text19, { color: "gray", dimColor: true, marginTop: 1, children: "The token will be stored securely in your local config" }),
|
|
3631
|
+
/* @__PURE__ */ jsx19(Text19, { color: "gray", dimColor: true, marginTop: 1, children: "Press Esc to go back" })
|
|
3262
3632
|
] }) })
|
|
3263
3633
|
] });
|
|
3264
3634
|
}
|
|
3265
3635
|
if (mode === "validating" || mode === "checking") {
|
|
3266
|
-
return /* @__PURE__ */
|
|
3636
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
3267
3637
|
header,
|
|
3268
|
-
/* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3270
|
-
mode === "validating" && /* @__PURE__ */
|
|
3638
|
+
/* @__PURE__ */ jsx19(Box18, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", alignItems: "center", children: [
|
|
3639
|
+
/* @__PURE__ */ jsx19(Text19, { color: "yellow", children: "Validating token..." }),
|
|
3640
|
+
mode === "validating" && /* @__PURE__ */ jsx19(Text19, { color: "gray", dimColor: true, marginTop: 1, children: "Press Esc to cancel" })
|
|
3271
3641
|
] }) })
|
|
3272
3642
|
] });
|
|
3273
3643
|
}
|
|
3274
3644
|
if (mode === "error") {
|
|
3275
|
-
return /* @__PURE__ */
|
|
3645
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
3276
3646
|
header,
|
|
3277
|
-
/* @__PURE__ */
|
|
3647
|
+
/* @__PURE__ */ jsx19(Box18, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx19(Text19, { color: "red", children: error ?? "Unexpected error" }) })
|
|
3278
3648
|
] });
|
|
3279
3649
|
}
|
|
3280
|
-
return /* @__PURE__ */
|
|
3650
|
+
return /* @__PURE__ */ jsxs18(Box18, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
3281
3651
|
header,
|
|
3282
|
-
/* @__PURE__ */
|
|
3652
|
+
/* @__PURE__ */ jsx19(
|
|
3283
3653
|
RepoList,
|
|
3284
3654
|
{
|
|
3285
3655
|
token,
|
|
@@ -3294,7 +3664,7 @@ function App({ initialOrgSlug: initialOrgSlug2, inlineToken: inlineToken2, inlin
|
|
|
3294
3664
|
}
|
|
3295
3665
|
|
|
3296
3666
|
// src/index.tsx
|
|
3297
|
-
import { jsx as
|
|
3667
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3298
3668
|
var argv = process.argv.slice(2);
|
|
3299
3669
|
var getFlagValue = (name) => {
|
|
3300
3670
|
const idx = argv.findIndex((a) => a === `--${name}` || a.startsWith(`--${name}=`));
|
|
@@ -3328,8 +3698,10 @@ if (argv.includes("--version") || argv.includes("-v")) {
|
|
|
3328
3698
|
process.exit(0);
|
|
3329
3699
|
}
|
|
3330
3700
|
if (argv.includes("--help") || argv.includes("-h")) {
|
|
3331
|
-
|
|
3332
|
-
gh-manager-cli
|
|
3701
|
+
const version = import_package.default?.version || "0.0.0";
|
|
3702
|
+
process.stdout.write(`gh-manager-cli v${version}
|
|
3703
|
+
|
|
3704
|
+
GitHub repo manager (Ink TUI)
|
|
3333
3705
|
|
|
3334
3706
|
Usage:
|
|
3335
3707
|
gh-manager-cli Launch the TUI
|
|
@@ -3389,8 +3761,8 @@ var inlineToken = (() => {
|
|
|
3389
3761
|
})();
|
|
3390
3762
|
logger.debug("Rendering UI");
|
|
3391
3763
|
var { unmount } = render(
|
|
3392
|
-
/* @__PURE__ */
|
|
3393
|
-
/* @__PURE__ */
|
|
3394
|
-
/* @__PURE__ */
|
|
3764
|
+
/* @__PURE__ */ jsxs19(Box19, { flexDirection: "column", children: [
|
|
3765
|
+
/* @__PURE__ */ jsx20(App, { initialOrgSlug, inlineToken, inlineTokenEphemeral: Boolean(inlineToken) }),
|
|
3766
|
+
/* @__PURE__ */ jsx20(Text20, { color: "gray" })
|
|
3395
3767
|
] })
|
|
3396
3768
|
);
|