gh-manager-cli 1.7.0 → 1.8.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 +20 -7
- package/dist/chunk-OQGG2X5P.js +648 -0
- package/dist/github-TWXF5AWM.js +29 -0
- package/dist/index.js +506 -794
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import {
|
|
3
|
+
__commonJS,
|
|
4
|
+
archiveRepositoryById,
|
|
5
|
+
deleteRepositoryRest,
|
|
6
|
+
fetchViewerOrganizations,
|
|
7
|
+
fetchViewerReposPageUnified,
|
|
8
|
+
getViewerLogin,
|
|
9
|
+
inspectCacheStatus,
|
|
10
|
+
makeClient,
|
|
11
|
+
purgeApolloCacheFiles,
|
|
12
|
+
searchRepositoriesUnified,
|
|
13
|
+
syncForkWithUpstream,
|
|
14
|
+
unarchiveRepositoryById
|
|
15
|
+
} from "./chunk-OQGG2X5P.js";
|
|
6
16
|
|
|
7
17
|
// package.json
|
|
8
18
|
var require_package = __commonJS({
|
|
9
19
|
"package.json"(exports, module) {
|
|
10
20
|
module.exports = {
|
|
11
21
|
name: "gh-manager-cli",
|
|
12
|
-
version: "1.
|
|
22
|
+
version: "1.8.1",
|
|
13
23
|
private: false,
|
|
14
24
|
description: "Interactive CLI to manage your GitHub repos (personal) with Ink",
|
|
15
25
|
license: "MIT",
|
|
@@ -125,13 +135,13 @@ var require_package = __commonJS({
|
|
|
125
135
|
});
|
|
126
136
|
|
|
127
137
|
// src/index.tsx
|
|
128
|
-
import { render, Box as
|
|
138
|
+
import { render, Box as Box7, Text as Text8 } from "ink";
|
|
129
139
|
import "dotenv/config";
|
|
130
140
|
|
|
131
141
|
// src/ui/App.tsx
|
|
132
|
-
import { useEffect as
|
|
133
|
-
import { Box as
|
|
134
|
-
import
|
|
142
|
+
import { useEffect as useEffect4, useMemo as useMemo2, useState as useState4 } from "react";
|
|
143
|
+
import { Box as Box6, Text as Text7, useApp as useApp2, useStdout as useStdout2, useInput as useInput3 } from "ink";
|
|
144
|
+
import TextInput3 from "ink-text-input";
|
|
135
145
|
|
|
136
146
|
// src/config.ts
|
|
137
147
|
import fs from "fs";
|
|
@@ -186,490 +196,23 @@ function storeUIPrefs(patch) {
|
|
|
186
196
|
writeConfig({ ...existing, ui: mergedUI });
|
|
187
197
|
}
|
|
188
198
|
|
|
189
|
-
// src/github.ts
|
|
190
|
-
import { graphql as makeGraphQL } from "@octokit/graphql";
|
|
191
|
-
import { ApolloClient, InMemoryCache, HttpLink, gql } from "@apollo/client/core/index.js";
|
|
192
|
-
import { persistCache } from "apollo3-cache-persist";
|
|
193
|
-
import fs2 from "fs";
|
|
194
|
-
import path2 from "path";
|
|
195
|
-
import envPaths2 from "env-paths";
|
|
196
|
-
function makeClient(token) {
|
|
197
|
-
return makeGraphQL.defaults({
|
|
198
|
-
headers: { authorization: `token ${token}` }
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
async function makeApolloClient(token) {
|
|
202
|
-
try {
|
|
203
|
-
if (typeof globalThis.fetch === "undefined") {
|
|
204
|
-
throw new Error("Fetch API not available. Node 18+ is required.");
|
|
205
|
-
}
|
|
206
|
-
const cache = new InMemoryCache();
|
|
207
|
-
const storage = {
|
|
208
|
-
async getItem(key) {
|
|
209
|
-
try {
|
|
210
|
-
const p = envPaths2("gh-manager-cli").data;
|
|
211
|
-
const file = path2.join(p, "apollo-cache.json");
|
|
212
|
-
return fs2.readFileSync(file, "utf8");
|
|
213
|
-
} catch {
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
async setItem(key, value) {
|
|
218
|
-
try {
|
|
219
|
-
const p = envPaths2("gh-manager-cli").data;
|
|
220
|
-
fs2.mkdirSync(p, { recursive: true });
|
|
221
|
-
const file = path2.join(p, "apollo-cache.json");
|
|
222
|
-
fs2.writeFileSync(file, value, "utf8");
|
|
223
|
-
if (process.platform !== "win32") {
|
|
224
|
-
try {
|
|
225
|
-
fs2.chmodSync(file, 384);
|
|
226
|
-
} catch {
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
} catch {
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
async removeItem(key) {
|
|
233
|
-
try {
|
|
234
|
-
const p = envPaths2("gh-manager-cli").data;
|
|
235
|
-
const file = path2.join(p, "apollo-cache.json");
|
|
236
|
-
fs2.unlinkSync(file);
|
|
237
|
-
} catch {
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
await persistCache({ cache, storage, debounce: 500, maxSize: 5 * 1024 * 1024 });
|
|
242
|
-
const link = new HttpLink({
|
|
243
|
-
uri: "https://api.github.com/graphql",
|
|
244
|
-
fetch: globalThis.fetch,
|
|
245
|
-
headers: { authorization: `Bearer ${token}` }
|
|
246
|
-
});
|
|
247
|
-
const client = new ApolloClient({ cache, link });
|
|
248
|
-
return { client, gql };
|
|
249
|
-
} catch (error) {
|
|
250
|
-
const debug = process.env.GH_MANAGER_DEBUG === "1";
|
|
251
|
-
if (debug) {
|
|
252
|
-
process.stderr.write(`
|
|
253
|
-
\u274C Failed to initialize Apollo Client: ${error.message}
|
|
254
|
-
`);
|
|
255
|
-
if (error.stack) {
|
|
256
|
-
process.stderr.write(`Stack: ${error.stack}
|
|
257
|
-
`);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
throw new Error(`Apollo Client initialization failed: ${error.message}`);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
async function getViewerLogin(client) {
|
|
264
|
-
const query = (
|
|
265
|
-
/* GraphQL */
|
|
266
|
-
`
|
|
267
|
-
query ViewerLogin {
|
|
268
|
-
viewer {
|
|
269
|
-
login
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
`
|
|
273
|
-
);
|
|
274
|
-
const res = await client(query);
|
|
275
|
-
return res.viewer.login;
|
|
276
|
-
}
|
|
277
|
-
async function fetchViewerReposPage(client, first, after, orderBy, includeForkTracking = true) {
|
|
278
|
-
const sortField = orderBy?.field || "UPDATED_AT";
|
|
279
|
-
const sortDirection = orderBy?.direction || "DESC";
|
|
280
|
-
const query = (
|
|
281
|
-
/* GraphQL */
|
|
282
|
-
`
|
|
283
|
-
query ViewerRepos(
|
|
284
|
-
$first: Int!
|
|
285
|
-
$after: String
|
|
286
|
-
$sortField: RepositoryOrderField!
|
|
287
|
-
$sortDirection: OrderDirection!
|
|
288
|
-
) {
|
|
289
|
-
rateLimit {
|
|
290
|
-
limit
|
|
291
|
-
remaining
|
|
292
|
-
resetAt
|
|
293
|
-
}
|
|
294
|
-
viewer {
|
|
295
|
-
repositories(
|
|
296
|
-
ownerAffiliations: OWNER
|
|
297
|
-
first: $first
|
|
298
|
-
after: $after
|
|
299
|
-
orderBy: { field: $sortField, direction: $sortDirection }
|
|
300
|
-
) {
|
|
301
|
-
totalCount
|
|
302
|
-
pageInfo {
|
|
303
|
-
endCursor
|
|
304
|
-
hasNextPage
|
|
305
|
-
}
|
|
306
|
-
nodes {
|
|
307
|
-
id
|
|
308
|
-
name
|
|
309
|
-
nameWithOwner
|
|
310
|
-
description
|
|
311
|
-
visibility
|
|
312
|
-
isPrivate
|
|
313
|
-
isFork
|
|
314
|
-
isArchived
|
|
315
|
-
stargazerCount
|
|
316
|
-
forkCount
|
|
317
|
-
primaryLanguage {
|
|
318
|
-
name
|
|
319
|
-
color
|
|
320
|
-
}
|
|
321
|
-
updatedAt
|
|
322
|
-
pushedAt
|
|
323
|
-
diskUsage
|
|
324
|
-
${includeForkTracking ? `
|
|
325
|
-
parent {
|
|
326
|
-
nameWithOwner
|
|
327
|
-
defaultBranchRef {
|
|
328
|
-
name
|
|
329
|
-
target {
|
|
330
|
-
... on Commit {
|
|
331
|
-
history(first: 0) {
|
|
332
|
-
totalCount
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
defaultBranchRef {
|
|
339
|
-
name
|
|
340
|
-
target {
|
|
341
|
-
... on Commit {
|
|
342
|
-
history(first: 0) {
|
|
343
|
-
totalCount
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
}` : `
|
|
348
|
-
parent {
|
|
349
|
-
nameWithOwner
|
|
350
|
-
}
|
|
351
|
-
defaultBranchRef { name }
|
|
352
|
-
`}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
`
|
|
358
|
-
);
|
|
359
|
-
const res = await client(query, {
|
|
360
|
-
first,
|
|
361
|
-
after: after ?? null,
|
|
362
|
-
sortField,
|
|
363
|
-
sortDirection
|
|
364
|
-
});
|
|
365
|
-
const data = res.viewer.repositories;
|
|
366
|
-
return {
|
|
367
|
-
nodes: data.nodes,
|
|
368
|
-
endCursor: data.pageInfo.endCursor,
|
|
369
|
-
hasNextPage: data.pageInfo.hasNextPage,
|
|
370
|
-
totalCount: data.totalCount,
|
|
371
|
-
rateLimit: res.rateLimit
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
async function fetchViewerReposPageUnified(token, first, after, orderBy, includeForkTracking = true, fetchPolicy = "cache-first") {
|
|
375
|
-
const isApolloEnabled = true;
|
|
376
|
-
const debug = process.env.GH_MANAGER_DEBUG === "1";
|
|
377
|
-
if (debug) {
|
|
378
|
-
console.log(`\u{1F50D} Apollo enabled: ${isApolloEnabled}, Policy: ${fetchPolicy}, After: ${after || "null"}`);
|
|
379
|
-
}
|
|
380
|
-
try {
|
|
381
|
-
if (isApolloEnabled) {
|
|
382
|
-
if (debug) console.log("\u{1F680} Attempting Apollo Client...");
|
|
383
|
-
const ap = await makeApolloClient(token);
|
|
384
|
-
const sortField = orderBy?.field || "UPDATED_AT";
|
|
385
|
-
const sortDirection = orderBy?.direction || "DESC";
|
|
386
|
-
const q = ap.gql`
|
|
387
|
-
query ViewerRepos($first: Int!, $after: String, $sortField: RepositoryOrderField!, $sortDirection: OrderDirection!) {
|
|
388
|
-
rateLimit { limit remaining resetAt }
|
|
389
|
-
viewer {
|
|
390
|
-
repositories(ownerAffiliations: OWNER, first: $first, after: $after, orderBy: { field: $sortField, direction: $sortDirection }) {
|
|
391
|
-
totalCount
|
|
392
|
-
pageInfo { endCursor hasNextPage }
|
|
393
|
-
nodes {
|
|
394
|
-
id
|
|
395
|
-
name
|
|
396
|
-
nameWithOwner
|
|
397
|
-
description
|
|
398
|
-
visibility
|
|
399
|
-
isPrivate
|
|
400
|
-
isFork
|
|
401
|
-
isArchived
|
|
402
|
-
stargazerCount
|
|
403
|
-
forkCount
|
|
404
|
-
primaryLanguage { name color }
|
|
405
|
-
updatedAt
|
|
406
|
-
pushedAt
|
|
407
|
-
diskUsage
|
|
408
|
-
${includeForkTracking ? `
|
|
409
|
-
parent { nameWithOwner defaultBranchRef { name target { ... on Commit { history(first: 0) { totalCount } } } } }
|
|
410
|
-
defaultBranchRef { name target { ... on Commit { history(first: 0) { totalCount } } } }` : `
|
|
411
|
-
parent { nameWithOwner }
|
|
412
|
-
defaultBranchRef { name }`}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
`;
|
|
418
|
-
const startTime = Date.now();
|
|
419
|
-
const res = await ap.client.query({
|
|
420
|
-
query: q,
|
|
421
|
-
variables: { first, after: after ?? null, sortField, sortDirection },
|
|
422
|
-
fetchPolicy
|
|
423
|
-
});
|
|
424
|
-
const duration = Date.now() - startTime;
|
|
425
|
-
if (debug) {
|
|
426
|
-
console.log(`\u26A1 Apollo query completed in ${duration}ms`);
|
|
427
|
-
console.log(`\u{1F4CA} From cache: ${res.loading === false && duration < 50 ? "YES" : "NO"}`);
|
|
428
|
-
console.log(`\u{1F504} Network status: ${res.networkStatus}`);
|
|
429
|
-
}
|
|
430
|
-
const data = res.data.viewer.repositories;
|
|
431
|
-
return {
|
|
432
|
-
nodes: data.nodes,
|
|
433
|
-
endCursor: data.pageInfo.endCursor,
|
|
434
|
-
hasNextPage: data.pageInfo.hasNextPage,
|
|
435
|
-
totalCount: data.totalCount,
|
|
436
|
-
rateLimit: res.data.rateLimit
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
} catch (e) {
|
|
440
|
-
if (debug) console.log(`\u274C Apollo failed, falling back to Octokit:`, e.message);
|
|
441
|
-
}
|
|
442
|
-
if (debug) console.log("\u{1F4E1} Using Octokit fallback...");
|
|
443
|
-
const octo = makeClient(token);
|
|
444
|
-
return fetchViewerReposPage(octo, first, after, orderBy, includeForkTracking);
|
|
445
|
-
}
|
|
446
|
-
async function searchRepositoriesUnified(token, viewer, text, first, after, sortKey = "UPDATED_AT", sortDir = "DESC", includeForkTracking = true, fetchPolicy = "network-only") {
|
|
447
|
-
const q = `${text} user:${viewer} in:name,description fork:true`;
|
|
448
|
-
try {
|
|
449
|
-
const ap = await makeApolloClient(token);
|
|
450
|
-
const queryDoc = ap.gql`
|
|
451
|
-
query SearchRepos($q: String!, $first: Int!, $after: String) {
|
|
452
|
-
rateLimit { limit remaining resetAt }
|
|
453
|
-
search(query: $q, type: REPOSITORY, first: $first, after: $after) {
|
|
454
|
-
repositoryCount
|
|
455
|
-
pageInfo { endCursor hasNextPage }
|
|
456
|
-
nodes {
|
|
457
|
-
... on Repository {
|
|
458
|
-
id
|
|
459
|
-
name
|
|
460
|
-
nameWithOwner
|
|
461
|
-
description
|
|
462
|
-
visibility
|
|
463
|
-
isPrivate
|
|
464
|
-
isFork
|
|
465
|
-
isArchived
|
|
466
|
-
stargazerCount
|
|
467
|
-
forkCount
|
|
468
|
-
primaryLanguage { name color }
|
|
469
|
-
updatedAt
|
|
470
|
-
pushedAt
|
|
471
|
-
diskUsage
|
|
472
|
-
${includeForkTracking ? `
|
|
473
|
-
parent { nameWithOwner defaultBranchRef { name target { ... on Commit { history(first: 0) { totalCount } } } } }
|
|
474
|
-
defaultBranchRef { name target { ... on Commit { history(first: 0) { totalCount } } } }` : `
|
|
475
|
-
parent { nameWithOwner }
|
|
476
|
-
defaultBranchRef { name }`}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
`;
|
|
482
|
-
const res = await ap.client.query({
|
|
483
|
-
query: queryDoc,
|
|
484
|
-
variables: { q, first, after: after ?? null },
|
|
485
|
-
fetchPolicy
|
|
486
|
-
});
|
|
487
|
-
const data = res.data.search;
|
|
488
|
-
return {
|
|
489
|
-
nodes: data.nodes,
|
|
490
|
-
endCursor: data.pageInfo.endCursor,
|
|
491
|
-
hasNextPage: data.pageInfo.hasNextPage,
|
|
492
|
-
totalCount: data.repositoryCount,
|
|
493
|
-
rateLimit: res.data.rateLimit
|
|
494
|
-
};
|
|
495
|
-
} catch (e) {
|
|
496
|
-
const debug = process.env.GH_MANAGER_DEBUG === "1";
|
|
497
|
-
if (debug) {
|
|
498
|
-
process.stderr.write(`
|
|
499
|
-
\u274C Search failed: ${e.message}
|
|
500
|
-
`);
|
|
501
|
-
if (e.graphQLErrors) {
|
|
502
|
-
process.stderr.write(`GraphQL errors: ${JSON.stringify(e.graphQLErrors, null, 2)}
|
|
503
|
-
`);
|
|
504
|
-
}
|
|
505
|
-
if (e.networkError) {
|
|
506
|
-
process.stderr.write(`Network error: ${e.networkError.message}
|
|
507
|
-
`);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
throw e;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
async function deleteRepositoryRest(token, owner, repo) {
|
|
514
|
-
const url = `https://api.github.com/repos/${owner}/${repo}`;
|
|
515
|
-
const res = await fetch(url, {
|
|
516
|
-
method: "DELETE",
|
|
517
|
-
headers: {
|
|
518
|
-
"Authorization": `token ${token}`,
|
|
519
|
-
"Accept": "application/vnd.github+json",
|
|
520
|
-
"User-Agent": "gh-manager-cli"
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
if (res.status === 204) return;
|
|
524
|
-
let msg = `GitHub REST delete failed (status ${res.status})`;
|
|
525
|
-
try {
|
|
526
|
-
const body = await res.json();
|
|
527
|
-
if (body && body.message) msg += `: ${body.message}`;
|
|
528
|
-
} catch {
|
|
529
|
-
}
|
|
530
|
-
throw new Error(msg);
|
|
531
|
-
}
|
|
532
|
-
async function archiveRepositoryById(client, repositoryId) {
|
|
533
|
-
const mutation = (
|
|
534
|
-
/* GraphQL */
|
|
535
|
-
`
|
|
536
|
-
mutation ArchiveRepo($repositoryId: ID!) {
|
|
537
|
-
archiveRepository(input: { repositoryId: $repositoryId }) {
|
|
538
|
-
clientMutationId
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
`
|
|
542
|
-
);
|
|
543
|
-
await client(mutation, { repositoryId });
|
|
544
|
-
}
|
|
545
|
-
async function unarchiveRepositoryById(client, repositoryId) {
|
|
546
|
-
const mutation = (
|
|
547
|
-
/* GraphQL */
|
|
548
|
-
`
|
|
549
|
-
mutation UnarchiveRepo($repositoryId: ID!) {
|
|
550
|
-
unarchiveRepository(input: { repositoryId: $repositoryId }) {
|
|
551
|
-
clientMutationId
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
`
|
|
555
|
-
);
|
|
556
|
-
await client(mutation, { repositoryId });
|
|
557
|
-
}
|
|
558
|
-
async function syncForkWithUpstream(token, owner, repo, branch = "main") {
|
|
559
|
-
const url = `https://api.github.com/repos/${owner}/${repo}/merge-upstream`;
|
|
560
|
-
const res = await fetch(url, {
|
|
561
|
-
method: "POST",
|
|
562
|
-
headers: {
|
|
563
|
-
"Authorization": `token ${token}`,
|
|
564
|
-
"Accept": "application/vnd.github+json",
|
|
565
|
-
"User-Agent": "gh-manager-cli"
|
|
566
|
-
},
|
|
567
|
-
body: JSON.stringify({ branch })
|
|
568
|
-
});
|
|
569
|
-
if (res.status === 204) {
|
|
570
|
-
return { message: "Already up-to-date", merge_type: "none", base_branch: branch };
|
|
571
|
-
}
|
|
572
|
-
if (res.status === 200) {
|
|
573
|
-
const body = await res.json();
|
|
574
|
-
return body;
|
|
575
|
-
}
|
|
576
|
-
let msg = `Fork sync failed (status ${res.status})`;
|
|
577
|
-
try {
|
|
578
|
-
const body = await res.json();
|
|
579
|
-
if (body && body.message) {
|
|
580
|
-
msg += `: ${body.message}`;
|
|
581
|
-
if (res.status === 409) {
|
|
582
|
-
msg += " (conflicts detected - manual merge required)";
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
} catch {
|
|
586
|
-
}
|
|
587
|
-
throw new Error(msg);
|
|
588
|
-
}
|
|
589
|
-
async function purgeApolloCacheFiles() {
|
|
590
|
-
try {
|
|
591
|
-
const fs4 = await import("fs");
|
|
592
|
-
const path4 = await import("path");
|
|
593
|
-
const envPaths4 = (await import("env-paths")).default;
|
|
594
|
-
const p = envPaths4("gh-manager-cli").data;
|
|
595
|
-
const cacheFile = path4.join(p, "apollo-cache.json");
|
|
596
|
-
const metaFile = path4.join(p, "apollo-cache-meta.json");
|
|
597
|
-
if (process.env.GH_MANAGER_DEBUG === "1") {
|
|
598
|
-
console.log(`\u{1F5D1}\uFE0F Purging cache files from: ${p}`);
|
|
599
|
-
}
|
|
600
|
-
try {
|
|
601
|
-
fs4.unlinkSync(cacheFile);
|
|
602
|
-
} catch {
|
|
603
|
-
}
|
|
604
|
-
try {
|
|
605
|
-
fs4.unlinkSync(metaFile);
|
|
606
|
-
} catch {
|
|
607
|
-
}
|
|
608
|
-
} catch {
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
async function inspectCacheStatus() {
|
|
612
|
-
try {
|
|
613
|
-
const fs4 = await import("fs");
|
|
614
|
-
const path4 = await import("path");
|
|
615
|
-
const envPaths4 = (await import("env-paths")).default;
|
|
616
|
-
const p = envPaths4("gh-manager-cli").data;
|
|
617
|
-
const cacheFile = path4.join(p, "apollo-cache.json");
|
|
618
|
-
const metaFile = path4.join(p, "apollo-cache-meta.json");
|
|
619
|
-
process.stderr.write(`
|
|
620
|
-
\u{1F4C2} Cache directory: ${p}
|
|
621
|
-
`);
|
|
622
|
-
try {
|
|
623
|
-
const cacheStats = fs4.statSync(cacheFile);
|
|
624
|
-
process.stderr.write(`\u{1F4BE} Cache file: ${Math.round(cacheStats.size / 1024)}KB (${cacheStats.mtime.toISOString()})
|
|
625
|
-
`);
|
|
626
|
-
} catch {
|
|
627
|
-
process.stderr.write(`\u{1F4BE} Cache file: NOT FOUND
|
|
628
|
-
`);
|
|
629
|
-
}
|
|
630
|
-
try {
|
|
631
|
-
const metaStats = fs4.statSync(metaFile);
|
|
632
|
-
const metaContent = fs4.readFileSync(metaFile, "utf8");
|
|
633
|
-
const meta = JSON.parse(metaContent);
|
|
634
|
-
process.stderr.write(`\u{1F4CA} Meta file: ${Object.keys(meta.fetched || {}).length} entries (${metaStats.mtime.toISOString()})
|
|
635
|
-
`);
|
|
636
|
-
const entries = Object.entries(meta.fetched || {});
|
|
637
|
-
if (entries.length > 0) {
|
|
638
|
-
process.stderr.write("\u{1F4CB} Recent cache entries:\n");
|
|
639
|
-
entries.slice(-3).forEach(([key, timestamp]) => {
|
|
640
|
-
const age = Date.now() - Date.parse(timestamp);
|
|
641
|
-
process.stderr.write(` ${key} (${Math.round(age / 1e3)}s ago)
|
|
642
|
-
`);
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
} catch {
|
|
646
|
-
process.stderr.write(`\u{1F4CA} Meta file: NOT FOUND
|
|
647
|
-
`);
|
|
648
|
-
}
|
|
649
|
-
process.stderr.write("\n");
|
|
650
|
-
} catch (e) {
|
|
651
|
-
process.stderr.write(`\u274C Cache inspection failed: ${e.message}
|
|
652
|
-
`);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
199
|
// src/ui/RepoList.tsx
|
|
657
|
-
import
|
|
658
|
-
import { Box, Text, useApp, useInput, useStdout } from "ink";
|
|
659
|
-
import
|
|
660
|
-
import
|
|
200
|
+
import React3, { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
|
|
201
|
+
import { Box as Box5, Text as Text6, useApp, useInput as useInput2, useStdout } from "ink";
|
|
202
|
+
import TextInput2 from "ink-text-input";
|
|
203
|
+
import chalk3 from "chalk";
|
|
661
204
|
|
|
662
205
|
// src/apolloMeta.ts
|
|
663
|
-
import
|
|
664
|
-
import
|
|
665
|
-
import
|
|
666
|
-
var paths2 =
|
|
206
|
+
import fs2 from "fs";
|
|
207
|
+
import path2 from "path";
|
|
208
|
+
import envPaths2 from "env-paths";
|
|
209
|
+
var paths2 = envPaths2("gh-manager-cli");
|
|
667
210
|
var dataDir = paths2.data;
|
|
668
|
-
var metaPath =
|
|
211
|
+
var metaPath = path2.join(dataDir, "apollo-cache-meta.json");
|
|
669
212
|
var VERSION = 1;
|
|
670
213
|
function readMeta() {
|
|
671
214
|
try {
|
|
672
|
-
const raw =
|
|
215
|
+
const raw = fs2.readFileSync(metaPath, "utf8");
|
|
673
216
|
const parsed = JSON.parse(raw);
|
|
674
217
|
if (parsed && typeof parsed === "object" && parsed.fetched) return parsed;
|
|
675
218
|
} catch {
|
|
@@ -678,11 +221,11 @@ function readMeta() {
|
|
|
678
221
|
}
|
|
679
222
|
function writeMeta(meta) {
|
|
680
223
|
try {
|
|
681
|
-
|
|
682
|
-
|
|
224
|
+
fs2.mkdirSync(dataDir, { recursive: true });
|
|
225
|
+
fs2.writeFileSync(metaPath, JSON.stringify(meta, null, 2), "utf8");
|
|
683
226
|
if (process.platform !== "win32") {
|
|
684
227
|
try {
|
|
685
|
-
|
|
228
|
+
fs2.chmodSync(metaPath, 384);
|
|
686
229
|
} catch {
|
|
687
230
|
}
|
|
688
231
|
}
|
|
@@ -691,7 +234,9 @@ function writeMeta(meta) {
|
|
|
691
234
|
}
|
|
692
235
|
function makeApolloKey(opts) {
|
|
693
236
|
const v = opts.viewer || "unknown";
|
|
694
|
-
|
|
237
|
+
const context = opts.ownerContext || "personal";
|
|
238
|
+
const affiliations = opts.affiliations || "OWNER";
|
|
239
|
+
return `viewer:${v}|context:${context}|affiliations:${affiliations}|sort:${opts.sortKey}:${opts.sortDir}|ps:${opts.pageSize}|forks:${opts.forkTracking ? "1" : "0"}`;
|
|
695
240
|
}
|
|
696
241
|
function makeSearchKey(opts) {
|
|
697
242
|
const v = opts.viewer || "unknown";
|
|
@@ -714,19 +259,81 @@ function markFetched(key) {
|
|
|
714
259
|
|
|
715
260
|
// src/ui/RepoList.tsx
|
|
716
261
|
import { exec } from "child_process";
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
262
|
+
|
|
263
|
+
// src/ui/OrgSwitcher.tsx
|
|
264
|
+
import { useEffect, useState } from "react";
|
|
265
|
+
import { Box, Text, useInput } from "ink";
|
|
266
|
+
import chalk from "chalk";
|
|
267
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
268
|
+
function OrgSwitcher({ token, currentContext, onSelect, onClose }) {
|
|
269
|
+
const [organizations, setOrganizations] = useState([]);
|
|
270
|
+
const [loading, setLoading] = useState(true);
|
|
271
|
+
const [error, setError] = useState(null);
|
|
272
|
+
const [cursor, setCursor] = useState(0);
|
|
273
|
+
const isPersonalContext = currentContext === "personal";
|
|
722
274
|
useEffect(() => {
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
275
|
+
const loadOrgs = async () => {
|
|
276
|
+
try {
|
|
277
|
+
setLoading(true);
|
|
278
|
+
const client = await import("./github-TWXF5AWM.js").then((m) => m.makeClient(token));
|
|
279
|
+
const orgs = await fetchViewerOrganizations(client);
|
|
280
|
+
setOrganizations(orgs);
|
|
281
|
+
if (!isPersonalContext) {
|
|
282
|
+
const orgLogin2 = currentContext.login;
|
|
283
|
+
const index = orgs.findIndex((org) => org.login === orgLogin2);
|
|
284
|
+
if (index !== -1) {
|
|
285
|
+
setCursor(index + 1);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
} catch (e) {
|
|
289
|
+
setError(e.message || "Failed to load organizations");
|
|
290
|
+
} finally {
|
|
291
|
+
setLoading(false);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
loadOrgs();
|
|
295
|
+
}, [token, currentContext, isPersonalContext]);
|
|
296
|
+
useInput((input, key) => {
|
|
297
|
+
if (key.escape) {
|
|
298
|
+
onClose();
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (key.return) {
|
|
302
|
+
if (cursor === 0) {
|
|
303
|
+
onSelect("personal");
|
|
304
|
+
} else if (cursor <= organizations.length) {
|
|
305
|
+
const org = organizations[cursor - 1];
|
|
306
|
+
onSelect({
|
|
307
|
+
type: "organization",
|
|
308
|
+
login: org.login,
|
|
309
|
+
name: org.name || void 0
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (key.upArrow) {
|
|
315
|
+
setCursor((c) => Math.max(0, c - 1));
|
|
316
|
+
} else if (key.downArrow) {
|
|
317
|
+
setCursor((c) => Math.min(organizations.length, c + 1));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
const totalItems = organizations.length + 1;
|
|
321
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 3, paddingY: 2, width: 60, children: [
|
|
322
|
+
/* @__PURE__ */ jsx(Text, { bold: true, children: "Switch Account/Organization" }),
|
|
323
|
+
loading ? /* @__PURE__ */ jsx(Text, { color: "yellow", children: "Loading organizations..." }) : error ? /* @__PURE__ */ jsx(Text, { color: "red", children: error }) : /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginTop: 1, children: [
|
|
324
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: cursor === 0 ? chalk.bgCyan.black(" \u2192 ") + " " + chalk.bold("Personal Account") : " " + chalk.gray("Personal Account") }) }),
|
|
325
|
+
organizations.map((org, index) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: cursor === index + 1 ? chalk.bgCyan.black(" \u2192 ") + " " + chalk.bold(org.name || org.login) + chalk.gray(` (@${org.login})`) : " " + chalk.gray(org.name || org.login) + chalk.gray(` (@${org.login})`) }) }, org.id)),
|
|
326
|
+
organizations.length === 0 && /* @__PURE__ */ jsx(Text, { color: "gray", dimColor: true, children: "No organizations found" })
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 2, children: /* @__PURE__ */ jsx(Text, { color: "gray", children: "\u2191/\u2193 Navigate \u2022 Enter Select \u2022 Esc Cancel" }) })
|
|
329
|
+
] });
|
|
729
330
|
}
|
|
331
|
+
|
|
332
|
+
// src/ui/components/repo/RepoRow.tsx
|
|
333
|
+
import { Box as Box2, Text as Text2 } from "ink";
|
|
334
|
+
import chalk2 from "chalk";
|
|
335
|
+
|
|
336
|
+
// src/utils.ts
|
|
730
337
|
function truncate(str, max = 80) {
|
|
731
338
|
if (str.length <= max) return str;
|
|
732
339
|
return str.slice(0, Math.max(0, max - 1)) + "\u2026";
|
|
@@ -743,97 +350,142 @@ function formatDate(dateStr) {
|
|
|
743
350
|
if (diffDays < 365) return `${Math.floor(diffDays / 30)} months ago`;
|
|
744
351
|
return `${Math.floor(diffDays / 365)} years ago`;
|
|
745
352
|
}
|
|
746
|
-
|
|
353
|
+
|
|
354
|
+
// src/ui/components/repo/RepoRow.tsx
|
|
355
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
356
|
+
function RepoRow({
|
|
357
|
+
repo,
|
|
358
|
+
selected,
|
|
359
|
+
index,
|
|
360
|
+
maxWidth,
|
|
361
|
+
spacingLines,
|
|
362
|
+
dim,
|
|
363
|
+
forkTracking
|
|
364
|
+
}) {
|
|
747
365
|
const langName = repo.primaryLanguage?.name || "";
|
|
748
366
|
const langColor = repo.primaryLanguage?.color || "#666666";
|
|
749
367
|
const hasCommitData = repo.isFork && repo.parent && repo.defaultBranchRef && repo.parent.defaultBranchRef && repo.parent.defaultBranchRef.target?.history && repo.defaultBranchRef.target?.history;
|
|
750
368
|
const commitsBehind = hasCommitData ? repo.parent.defaultBranchRef.target.history.totalCount - repo.defaultBranchRef.target.history.totalCount : 0;
|
|
751
369
|
const showCommitsBehind = forkTracking && hasCommitData;
|
|
752
370
|
let line1 = "";
|
|
753
|
-
const numColor = selected ?
|
|
754
|
-
const nameColor = selected ?
|
|
371
|
+
const numColor = selected ? chalk2.cyan : chalk2.gray;
|
|
372
|
+
const nameColor = selected ? chalk2.cyan.bold : chalk2.white;
|
|
755
373
|
line1 += numColor(`${String(index).padStart(3, " ")}.`);
|
|
756
374
|
line1 += nameColor(` ${repo.nameWithOwner}`);
|
|
757
|
-
if (repo.isPrivate) line1 +=
|
|
758
|
-
if (repo.isArchived) line1 += " " +
|
|
375
|
+
if (repo.isPrivate) line1 += chalk2.yellow(" Private");
|
|
376
|
+
if (repo.isArchived) line1 += " " + chalk2.bgGray.whiteBright(" Archived ") + " ";
|
|
759
377
|
if (repo.isFork && repo.parent) {
|
|
760
|
-
line1 +=
|
|
378
|
+
line1 += chalk2.blue(` Fork of ${repo.parent.nameWithOwner}`);
|
|
761
379
|
if (showCommitsBehind) {
|
|
762
380
|
if (commitsBehind > 0) {
|
|
763
|
-
line1 +=
|
|
381
|
+
line1 += chalk2.yellow(` (${commitsBehind} behind)`);
|
|
764
382
|
} else {
|
|
765
|
-
line1 +=
|
|
383
|
+
line1 += chalk2.green(` (0 behind)`);
|
|
766
384
|
}
|
|
767
385
|
}
|
|
768
386
|
}
|
|
769
387
|
let line2 = " ";
|
|
770
|
-
const metaColor = selected ?
|
|
771
|
-
if (langName) line2 +=
|
|
388
|
+
const metaColor = selected ? chalk2.white : chalk2.gray;
|
|
389
|
+
if (langName) line2 += chalk2.hex(langColor)("\u25CF ") + metaColor(`${langName} `);
|
|
772
390
|
line2 += metaColor(`\u2605 ${repo.stargazerCount} \u2442 ${repo.forkCount} Updated ${formatDate(repo.updatedAt)}`);
|
|
773
391
|
const line3 = repo.description ? ` ${truncate(repo.description, Math.max(30, maxWidth - 10))}` : null;
|
|
774
392
|
let fullText = line1 + "\n" + line2;
|
|
775
393
|
if (line3) fullText += "\n" + metaColor(line3);
|
|
776
|
-
return /* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */
|
|
778
|
-
spacingLines > 0 && /* @__PURE__ */
|
|
394
|
+
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", backgroundColor: selected ? "gray" : void 0, children: [
|
|
395
|
+
/* @__PURE__ */ jsx2(Text2, { children: dim ? chalk2.dim(fullText) : fullText }),
|
|
396
|
+
spacingLines > 0 && /* @__PURE__ */ jsx2(Box2, { height: spacingLines, children: /* @__PURE__ */ jsx2(Text2, { children: " " }) })
|
|
779
397
|
] });
|
|
780
398
|
}
|
|
781
|
-
|
|
399
|
+
|
|
400
|
+
// src/ui/components/repo/FilterInput.tsx
|
|
401
|
+
import { Box as Box3, Text as Text3 } from "ink";
|
|
402
|
+
import TextInput from "ink-text-input";
|
|
403
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
404
|
+
|
|
405
|
+
// src/ui/components/repo/RepoListHeader.tsx
|
|
406
|
+
import { Box as Box4, Text as Text5 } from "ink";
|
|
407
|
+
|
|
408
|
+
// src/ui/components/common/SlowSpinner.tsx
|
|
409
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
410
|
+
import { Text as Text4 } from "ink";
|
|
411
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
412
|
+
function SlowSpinner() {
|
|
413
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
414
|
+
const [frame, setFrame] = useState2(0);
|
|
415
|
+
useEffect2(() => {
|
|
416
|
+
const timer = setInterval(() => {
|
|
417
|
+
setFrame((f) => (f + 1) % frames.length);
|
|
418
|
+
}, 500);
|
|
419
|
+
return () => clearInterval(timer);
|
|
420
|
+
}, [frames.length]);
|
|
421
|
+
return /* @__PURE__ */ jsx4(Text4, { children: frames[frame] });
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// src/ui/components/repo/RepoListHeader.tsx
|
|
425
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
426
|
+
|
|
427
|
+
// src/ui/RepoList.tsx
|
|
428
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
429
|
+
var PAGE_SIZE = process.env.GH_MANAGER_DEV === "1" || process.env.NODE_ENV === "development" ? 5 : 15;
|
|
430
|
+
function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextChange }) {
|
|
782
431
|
const { exit } = useApp();
|
|
783
432
|
const { stdout } = useStdout();
|
|
784
433
|
const client = useMemo(() => makeClient(token), [token]);
|
|
785
|
-
const [debugMessages, setDebugMessages] =
|
|
434
|
+
const [debugMessages, setDebugMessages] = useState3([]);
|
|
786
435
|
const addDebugMessage = (msg) => {
|
|
787
436
|
if (process.env.GH_MANAGER_DEBUG === "1") {
|
|
788
437
|
setDebugMessages((prev) => [...prev.slice(-9), msg]);
|
|
789
438
|
}
|
|
790
439
|
};
|
|
791
|
-
|
|
440
|
+
React3.useEffect(() => {
|
|
792
441
|
addDebugMessage(`[RepoList] Component mounted`);
|
|
793
442
|
}, []);
|
|
794
443
|
const terminalWidth = stdout?.columns ?? 80;
|
|
795
444
|
const availableHeight = maxVisibleRows ?? 20;
|
|
796
|
-
const [items, setItems] =
|
|
797
|
-
const [cursor, setCursor] =
|
|
798
|
-
const [endCursor, setEndCursor] =
|
|
799
|
-
const [hasNextPage, setHasNextPage] =
|
|
800
|
-
const [totalCount, setTotalCount] =
|
|
801
|
-
const [loading, setLoading] =
|
|
802
|
-
const [sortingLoading, setSortingLoading] =
|
|
803
|
-
const [refreshing, setRefreshing] =
|
|
804
|
-
const [loadingMore, setLoadingMore] =
|
|
805
|
-
const [error, setError] =
|
|
806
|
-
const [rateLimit, setRateLimit] =
|
|
807
|
-
const [prevRateLimit, setPrevRateLimit] =
|
|
808
|
-
const [density, setDensity] =
|
|
809
|
-
const [prefsLoaded, setPrefsLoaded] =
|
|
810
|
-
const [
|
|
811
|
-
const [
|
|
812
|
-
const [
|
|
813
|
-
const [
|
|
814
|
-
const [
|
|
815
|
-
const [
|
|
816
|
-
const [
|
|
817
|
-
const [
|
|
818
|
-
const [
|
|
819
|
-
const [
|
|
820
|
-
const [
|
|
821
|
-
const [
|
|
822
|
-
const [
|
|
823
|
-
const [
|
|
824
|
-
const [
|
|
825
|
-
const [
|
|
826
|
-
const [
|
|
827
|
-
const [
|
|
828
|
-
const [
|
|
829
|
-
const [
|
|
830
|
-
const [
|
|
831
|
-
const [
|
|
832
|
-
const [
|
|
833
|
-
const [
|
|
834
|
-
const [
|
|
835
|
-
const [
|
|
836
|
-
const [
|
|
445
|
+
const [items, setItems] = useState3([]);
|
|
446
|
+
const [cursor, setCursor] = useState3(0);
|
|
447
|
+
const [endCursor, setEndCursor] = useState3(null);
|
|
448
|
+
const [hasNextPage, setHasNextPage] = useState3(false);
|
|
449
|
+
const [totalCount, setTotalCount] = useState3(0);
|
|
450
|
+
const [loading, setLoading] = useState3(true);
|
|
451
|
+
const [sortingLoading, setSortingLoading] = useState3(false);
|
|
452
|
+
const [refreshing, setRefreshing] = useState3(false);
|
|
453
|
+
const [loadingMore, setLoadingMore] = useState3(false);
|
|
454
|
+
const [error, setError] = useState3(null);
|
|
455
|
+
const [rateLimit, setRateLimit] = useState3(void 0);
|
|
456
|
+
const [prevRateLimit, setPrevRateLimit] = useState3(void 0);
|
|
457
|
+
const [density, setDensity] = useState3(2);
|
|
458
|
+
const [prefsLoaded, setPrefsLoaded] = useState3(false);
|
|
459
|
+
const [ownerContext, setOwnerContext] = useState3("personal");
|
|
460
|
+
const [ownerAffiliations, setOwnerAffiliations] = useState3(["OWNER"]);
|
|
461
|
+
const [orgSwitcherOpen, setOrgSwitcherOpen] = useState3(false);
|
|
462
|
+
const [searchItems, setSearchItems] = useState3([]);
|
|
463
|
+
const [searchEndCursor, setSearchEndCursor] = useState3(null);
|
|
464
|
+
const [searchHasNextPage, setSearchHasNextPage] = useState3(false);
|
|
465
|
+
const [searchTotalCount, setSearchTotalCount] = useState3(0);
|
|
466
|
+
const [searchLoading, setSearchLoading] = useState3(false);
|
|
467
|
+
const [deleteMode, setDeleteMode] = useState3(false);
|
|
468
|
+
const [deleteTarget, setDeleteTarget] = useState3(null);
|
|
469
|
+
const [deleteCode, setDeleteCode] = useState3("");
|
|
470
|
+
const [typedCode, setTypedCode] = useState3("");
|
|
471
|
+
const [deleting, setDeleting] = useState3(false);
|
|
472
|
+
const [deleteError, setDeleteError] = useState3(null);
|
|
473
|
+
const [deleteConfirmStage, setDeleteConfirmStage] = useState3(false);
|
|
474
|
+
const [confirmFocus, setConfirmFocus] = useState3("delete");
|
|
475
|
+
const [archiveMode, setArchiveMode] = useState3(false);
|
|
476
|
+
const [archiveTarget, setArchiveTarget] = useState3(null);
|
|
477
|
+
const [archiving, setArchiving] = useState3(false);
|
|
478
|
+
const [archiveError, setArchiveError] = useState3(null);
|
|
479
|
+
const [archiveFocus, setArchiveFocus] = useState3("confirm");
|
|
480
|
+
const [syncMode, setSyncMode] = useState3(false);
|
|
481
|
+
const [syncTarget, setSyncTarget] = useState3(null);
|
|
482
|
+
const [syncing, setSyncing] = useState3(false);
|
|
483
|
+
const [syncError, setSyncError] = useState3(null);
|
|
484
|
+
const [syncFocus, setSyncFocus] = useState3("confirm");
|
|
485
|
+
const [infoMode, setInfoMode] = useState3(false);
|
|
486
|
+
const [logoutMode, setLogoutMode] = useState3(false);
|
|
487
|
+
const [logoutFocus, setLogoutFocus] = useState3("confirm");
|
|
488
|
+
const [logoutError, setLogoutError] = useState3(null);
|
|
837
489
|
function closeArchiveModal() {
|
|
838
490
|
setArchiveMode(false);
|
|
839
491
|
setArchiveTarget(null);
|
|
@@ -848,6 +500,18 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
848
500
|
setSyncError(null);
|
|
849
501
|
setSyncFocus("confirm");
|
|
850
502
|
}
|
|
503
|
+
function handleOrgContextChange(newContext) {
|
|
504
|
+
setOwnerContext(newContext);
|
|
505
|
+
storeUIPrefs({ ownerContext: newContext });
|
|
506
|
+
setCursor(0);
|
|
507
|
+
setOrgSwitcherOpen(false);
|
|
508
|
+
const newAffiliations = newContext === "personal" ? ["OWNER"] : ["ORGANIZATION_MEMBER"];
|
|
509
|
+
setOwnerAffiliations(newAffiliations);
|
|
510
|
+
storeUIPrefs({ ownerAffiliations: newAffiliations });
|
|
511
|
+
if (onOrgContextChange) {
|
|
512
|
+
onOrgContextChange(newContext);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
851
515
|
function cancelDeleteModal() {
|
|
852
516
|
setDeleteMode(false);
|
|
853
517
|
setDeleteTarget(null);
|
|
@@ -877,11 +541,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
877
541
|
setDeleteError("Failed to delete repository. Ensure delete_repo scope and admin permissions.");
|
|
878
542
|
}
|
|
879
543
|
}
|
|
880
|
-
const [filter, setFilter] =
|
|
881
|
-
const [filterMode, setFilterMode] =
|
|
882
|
-
const [sortKey, setSortKey] =
|
|
883
|
-
const [sortDir, setSortDir] =
|
|
884
|
-
const [forkTracking, setForkTracking] =
|
|
544
|
+
const [filter, setFilter] = useState3("");
|
|
545
|
+
const [filterMode, setFilterMode] = useState3(false);
|
|
546
|
+
const [sortKey, setSortKey] = useState3("updated");
|
|
547
|
+
const [sortDir, setSortDir] = useState3("desc");
|
|
548
|
+
const [forkTracking, setForkTracking] = useState3(true);
|
|
885
549
|
const sortFieldMap = {
|
|
886
550
|
"updated": "UPDATED_AT",
|
|
887
551
|
"pushed": "PUSHED_AT",
|
|
@@ -901,13 +565,16 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
901
565
|
field: sortFieldMap[sortKey],
|
|
902
566
|
direction: sortDir.toUpperCase()
|
|
903
567
|
};
|
|
568
|
+
const orgLogin2 = ownerContext !== "personal" ? ownerContext.login : void 0;
|
|
904
569
|
const page = await fetchViewerReposPageUnified(
|
|
905
570
|
token,
|
|
906
571
|
PAGE_SIZE,
|
|
907
572
|
after ?? null,
|
|
908
573
|
orderBy,
|
|
909
574
|
overrideForkTracking ?? forkTracking,
|
|
910
|
-
policy ?? (after ? "network-only" : "cache-first")
|
|
575
|
+
policy ?? (after ? "network-only" : "cache-first"),
|
|
576
|
+
ownerAffiliations,
|
|
577
|
+
orgLogin2
|
|
911
578
|
);
|
|
912
579
|
setItems((prev) => reset || !after ? page.nodes : [...prev, ...page.nodes]);
|
|
913
580
|
setEndCursor(page.endCursor);
|
|
@@ -920,7 +587,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
920
587
|
sortKey,
|
|
921
588
|
sortDir,
|
|
922
589
|
pageSize: PAGE_SIZE,
|
|
923
|
-
forkTracking: overrideForkTracking ?? forkTracking
|
|
590
|
+
forkTracking: overrideForkTracking ?? forkTracking,
|
|
591
|
+
ownerContext: orgLogin2 ? `org:${orgLogin2}` : "personal",
|
|
592
|
+
affiliations: ownerAffiliations.join(",")
|
|
924
593
|
});
|
|
925
594
|
markFetched(key);
|
|
926
595
|
} catch {
|
|
@@ -996,7 +665,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
996
665
|
setSearchLoading(false);
|
|
997
666
|
}
|
|
998
667
|
};
|
|
999
|
-
|
|
668
|
+
useEffect3(() => {
|
|
1000
669
|
const ui = getUIPrefs();
|
|
1001
670
|
if (ui.density !== void 0) setDensity(ui.density);
|
|
1002
671
|
if (ui.sortKey && ["updated", "pushed", "name", "stars"].includes(ui.sortKey)) {
|
|
@@ -1007,35 +676,51 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1007
676
|
}
|
|
1008
677
|
if (ui.forkTracking !== void 0) setForkTracking(ui.forkTracking);
|
|
1009
678
|
else setForkTracking(true);
|
|
679
|
+
if (ui.ownerContext) {
|
|
680
|
+
setOwnerContext(ui.ownerContext);
|
|
681
|
+
if (onOrgContextChange) {
|
|
682
|
+
onOrgContextChange(ui.ownerContext);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
if (ui.ownerAffiliations && Array.isArray(ui.ownerAffiliations)) {
|
|
686
|
+
setOwnerAffiliations(ui.ownerAffiliations);
|
|
687
|
+
}
|
|
1010
688
|
setPrefsLoaded(true);
|
|
1011
|
-
}, []);
|
|
1012
|
-
|
|
689
|
+
}, [onOrgContextChange]);
|
|
690
|
+
useEffect3(() => {
|
|
1013
691
|
if (!prefsLoaded) return;
|
|
1014
692
|
let policy = "cache-first";
|
|
693
|
+
const orgLogin2 = ownerContext !== "personal" ? ownerContext.login : void 0;
|
|
1015
694
|
try {
|
|
1016
695
|
const key = makeApolloKey({
|
|
1017
696
|
viewer: viewerLogin || "unknown",
|
|
1018
697
|
sortKey,
|
|
1019
698
|
sortDir,
|
|
1020
699
|
pageSize: PAGE_SIZE,
|
|
1021
|
-
forkTracking
|
|
700
|
+
forkTracking,
|
|
701
|
+
ownerContext: orgLogin2 ? `org:${orgLogin2}` : "personal",
|
|
702
|
+
affiliations: ownerAffiliations.join(",")
|
|
1022
703
|
});
|
|
1023
704
|
policy = isFresh(key) ? "cache-first" : "network-only";
|
|
1024
705
|
} catch {
|
|
1025
706
|
}
|
|
707
|
+
setCursor(0);
|
|
1026
708
|
fetchPage(null, true, false, void 0, policy);
|
|
1027
|
-
}, [client, prefsLoaded]);
|
|
1028
|
-
|
|
709
|
+
}, [client, prefsLoaded, ownerContext, ownerAffiliations]);
|
|
710
|
+
useEffect3(() => {
|
|
1029
711
|
if (!searchActive) {
|
|
1030
712
|
if (items.length > 0) {
|
|
1031
713
|
let policy = "cache-first";
|
|
714
|
+
const orgLogin2 = ownerContext !== "personal" ? ownerContext.login : void 0;
|
|
1032
715
|
try {
|
|
1033
716
|
const key = makeApolloKey({
|
|
1034
717
|
viewer: viewerLogin || "unknown",
|
|
1035
718
|
sortKey,
|
|
1036
719
|
sortDir,
|
|
1037
720
|
pageSize: PAGE_SIZE,
|
|
1038
|
-
forkTracking
|
|
721
|
+
forkTracking,
|
|
722
|
+
ownerContext: orgLogin2 ? `org:${orgLogin2}` : "personal",
|
|
723
|
+
affiliations: ownerAffiliations.join(",")
|
|
1039
724
|
});
|
|
1040
725
|
policy = isFresh(key) ? "cache-first" : "network-only";
|
|
1041
726
|
} catch {
|
|
@@ -1061,7 +746,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1061
746
|
}
|
|
1062
747
|
}
|
|
1063
748
|
}, [sortKey, sortDir]);
|
|
1064
|
-
|
|
749
|
+
useEffect3(() => {
|
|
1065
750
|
if (viewerLogin && searchActive && !searchLoading && searchItems.length === 0) {
|
|
1066
751
|
let policy = "cache-first";
|
|
1067
752
|
try {
|
|
@@ -1071,7 +756,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1071
756
|
sortKey,
|
|
1072
757
|
sortDir,
|
|
1073
758
|
pageSize: PAGE_SIZE,
|
|
1074
|
-
forkTracking
|
|
759
|
+
forkTracking,
|
|
760
|
+
ownerContext: orgLogin ? `org:${orgLogin}` : "personal",
|
|
761
|
+
affiliations: ownerAffiliations.join(",")
|
|
1075
762
|
});
|
|
1076
763
|
policy = isFresh(key, 90 * 1e3) ? "cache-first" : "network-only";
|
|
1077
764
|
} catch {
|
|
@@ -1079,7 +766,10 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1079
766
|
fetchSearchPage(null, true, policy);
|
|
1080
767
|
}
|
|
1081
768
|
}, [viewerLogin]);
|
|
1082
|
-
|
|
769
|
+
useInput2((input, key) => {
|
|
770
|
+
if (orgSwitcherOpen) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
1083
773
|
if (deleteMode) {
|
|
1084
774
|
if (key.escape || input && input.toUpperCase() === "C") {
|
|
1085
775
|
cancelDeleteModal();
|
|
@@ -1315,6 +1005,10 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1315
1005
|
fetchPage(null, true, true, void 0, "network-only");
|
|
1316
1006
|
})();
|
|
1317
1007
|
}
|
|
1008
|
+
if (input && input.toUpperCase() === "W") {
|
|
1009
|
+
setOrgSwitcherOpen(true);
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1318
1012
|
if (key.ctrl && (input === "a" || input === "A")) {
|
|
1319
1013
|
const repo = visibleItems[cursor];
|
|
1320
1014
|
if (repo) {
|
|
@@ -1364,6 +1058,10 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1364
1058
|
setInfoMode(true);
|
|
1365
1059
|
return;
|
|
1366
1060
|
}
|
|
1061
|
+
if (input && input.toUpperCase() === "W") {
|
|
1062
|
+
setOrgSwitcherOpen(true);
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1367
1065
|
if (input && input.toUpperCase() === "S") {
|
|
1368
1066
|
const order = ["updated", "pushed", "name", "stars"];
|
|
1369
1067
|
const idx = order.indexOf(sortKey);
|
|
@@ -1440,12 +1138,12 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1440
1138
|
}, [filtered, sortKey, sortDir]);
|
|
1441
1139
|
const searchActive = filter.trim().length >= 3;
|
|
1442
1140
|
const visibleItems = searchActive ? searchItems : filteredAndSorted;
|
|
1443
|
-
|
|
1141
|
+
useEffect3(() => {
|
|
1444
1142
|
if (searchActive) {
|
|
1445
1143
|
addDebugMessage(`[State] searchActive=${searchActive}, searchItems=${searchItems.length}, visibleItems=${visibleItems.length}, filter="${filter}"`);
|
|
1446
1144
|
}
|
|
1447
1145
|
}, [searchActive, searchItems.length, visibleItems.length, filter]);
|
|
1448
|
-
|
|
1146
|
+
useEffect3(() => {
|
|
1449
1147
|
setCursor((c) => Math.min(c, Math.max(0, (searchActive ? searchItems.length : items.length) - 1)));
|
|
1450
1148
|
}, [searchActive, searchItems.length, items.length]);
|
|
1451
1149
|
const headerHeight = 2;
|
|
@@ -1466,7 +1164,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1466
1164
|
const end = Math.min(total, start + visibleRepos + buffer);
|
|
1467
1165
|
return { start, end };
|
|
1468
1166
|
}, [visibleItems.length, cursor, listHeight, spacingLines]);
|
|
1469
|
-
|
|
1167
|
+
useEffect3(() => {
|
|
1470
1168
|
const prefetchThreshold = Math.floor(visibleItems.length * 0.8);
|
|
1471
1169
|
const nearEnd = visibleItems.length > 0 && cursor >= prefetchThreshold;
|
|
1472
1170
|
if (searchActive) {
|
|
@@ -1488,81 +1186,88 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1488
1186
|
}
|
|
1489
1187
|
const lowRate = rateLimit && rateLimit.remaining <= Math.ceil(rateLimit.limit * 0.1);
|
|
1490
1188
|
const modalOpen = deleteMode || archiveMode || syncMode || logoutMode || infoMode;
|
|
1491
|
-
const headerBar = useMemo(() => /* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1189
|
+
const headerBar = useMemo(() => /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: [
|
|
1190
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 1, children: [
|
|
1191
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, color: modalOpen ? "gray" : void 0, dimColor: modalOpen ? true : void 0, children: " Repositories" }),
|
|
1192
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1495
1193
|
"(",
|
|
1496
1194
|
visibleItems.length,
|
|
1497
1195
|
"/",
|
|
1498
1196
|
searchActive ? searchTotalCount : totalCount,
|
|
1499
1197
|
")"
|
|
1500
1198
|
] }),
|
|
1501
|
-
(loading || searchLoading) && /* @__PURE__ */
|
|
1199
|
+
(loading || searchLoading) && /* @__PURE__ */ jsx6(Box5, { width: 2, flexShrink: 0, flexGrow: 0, marginLeft: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "yellow", children: /* @__PURE__ */ jsx6(SlowSpinner, {}) }) })
|
|
1502
1200
|
] }),
|
|
1503
|
-
rateLimit && /* @__PURE__ */
|
|
1201
|
+
rateLimit && /* @__PURE__ */ jsxs5(Text6, { color: lowRate ? "yellow" : "gray", children: [
|
|
1504
1202
|
"API: ",
|
|
1505
1203
|
rateLimit.remaining,
|
|
1506
1204
|
"/",
|
|
1507
1205
|
rateLimit.limit,
|
|
1508
|
-
prevRateLimit !== void 0 && prevRateLimit !== rateLimit.remaining && /* @__PURE__ */
|
|
1206
|
+
prevRateLimit !== void 0 && prevRateLimit !== rateLimit.remaining && /* @__PURE__ */ jsx6(Text6, { color: rateLimit.remaining < prevRateLimit ? "red" : "green", children: ` (${rateLimit.remaining - prevRateLimit > 0 ? "+" : ""}${rateLimit.remaining - prevRateLimit})` })
|
|
1509
1207
|
] })
|
|
1510
1208
|
] }), [visibleItems.length, searchActive, searchTotalCount, totalCount, loading, searchLoading, rateLimit, lowRate, modalOpen, prevRateLimit]);
|
|
1511
1209
|
if (error) {
|
|
1512
|
-
return /* @__PURE__ */
|
|
1513
|
-
/* @__PURE__ */
|
|
1514
|
-
|
|
1210
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", height: availableHeight, children: [
|
|
1211
|
+
/* @__PURE__ */ jsx6(Box5, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 1, children: [
|
|
1212
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: " Repositories" }),
|
|
1213
|
+
/* @__PURE__ */ jsx6(Text6, { color: "red", children: "(Error)" })
|
|
1214
|
+
] }) }),
|
|
1215
|
+
/* @__PURE__ */ jsx6(Box5, { borderStyle: "single", borderColor: "red", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: /* @__PURE__ */ jsx6(Box5, { height: contentHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", alignItems: "center", children: [
|
|
1216
|
+
/* @__PURE__ */ jsx6(Text6, { color: "red", children: error }),
|
|
1217
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: true, children: "Press 'r' to retry or 'q' to quit" }) })
|
|
1218
|
+
] }) }) }),
|
|
1219
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", children: "Press 'r' to retry \u2022 'q' to quit" }) })
|
|
1515
1220
|
] });
|
|
1516
1221
|
}
|
|
1517
1222
|
if (loading && items.length === 0 || sortingLoading) {
|
|
1518
|
-
return /* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
/* @__PURE__ */
|
|
1223
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", height: availableHeight, children: [
|
|
1224
|
+
/* @__PURE__ */ jsx6(Box5, { flexDirection: "row", justifyContent: "space-between", height: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 1, children: [
|
|
1225
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: " Repositories" }),
|
|
1226
|
+
/* @__PURE__ */ jsx6(Text6, { color: "gray", children: "(Loading...)" })
|
|
1522
1227
|
] }) }),
|
|
1523
|
-
/* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */
|
|
1228
|
+
/* @__PURE__ */ jsx6(Box5, { borderStyle: "single", borderColor: "yellow", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: /* @__PURE__ */ jsx6(Box5, { height: contentHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx6(Box5, { flexDirection: "column", alignItems: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", alignItems: "center", children: [
|
|
1229
|
+
/* @__PURE__ */ jsxs5(Box5, { height: 1, flexDirection: "row", children: [
|
|
1230
|
+
/* @__PURE__ */ jsx6(Box5, { width: 2, flexShrink: 0, flexGrow: 0, children: /* @__PURE__ */ jsx6(Text6, { color: "cyan", children: /* @__PURE__ */ jsx6(SlowSpinner, {}) }) }),
|
|
1231
|
+
/* @__PURE__ */ jsx6(Text6, { color: "cyan", children: refreshing ? "Refreshing..." : sortingLoading ? "Applying sort..." : "Loading repositories..." })
|
|
1527
1232
|
] }),
|
|
1528
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", children: refreshing ? "Fetching latest repository data" : sortingLoading ? `Sorting by ${sortKey} (${sortDir === "asc" ? "ascending" : "descending"})` : "Fetching your GitHub repositories" }) })
|
|
1529
1234
|
] }) }) }) }),
|
|
1530
|
-
/* @__PURE__ */
|
|
1235
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, paddingX: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", children: "Please wait..." }) })
|
|
1531
1236
|
] });
|
|
1532
1237
|
}
|
|
1533
|
-
return /* @__PURE__ */
|
|
1238
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", height: availableHeight, children: [
|
|
1534
1239
|
headerBar,
|
|
1535
|
-
/* @__PURE__ */
|
|
1240
|
+
/* @__PURE__ */ jsx6(Box5, { borderStyle: "single", borderColor: modalOpen ? "gray" : "yellow", paddingX: 1, paddingY: 1, marginX: 1, height: contentHeight + containerPadding + 2, flexDirection: "column", children: deleteMode && deleteTarget ? (
|
|
1536
1241
|
// Centered modal; hide list content while modal is open
|
|
1537
|
-
/* @__PURE__ */
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1243
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Delete Confirmation" }),
|
|
1244
|
+
/* @__PURE__ */ jsx6(Text6, { color: "red", children: "\u26A0\uFE0F Delete repository?" }),
|
|
1245
|
+
/* @__PURE__ */ jsx6(Box5, { height: 2, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1541
1246
|
(() => {
|
|
1542
1247
|
const langName = deleteTarget.primaryLanguage?.name || "";
|
|
1543
1248
|
const langColor = deleteTarget.primaryLanguage?.color || "#666666";
|
|
1544
1249
|
let line1 = "";
|
|
1545
|
-
line1 +=
|
|
1546
|
-
if (deleteTarget.isPrivate) line1 +=
|
|
1547
|
-
if (deleteTarget.isArchived) line1 +=
|
|
1548
|
-
if (deleteTarget.isFork && deleteTarget.parent) line1 +=
|
|
1250
|
+
line1 += chalk3.white(deleteTarget.nameWithOwner);
|
|
1251
|
+
if (deleteTarget.isPrivate) line1 += chalk3.yellow(" Private");
|
|
1252
|
+
if (deleteTarget.isArchived) line1 += chalk3.gray.dim(" Archived");
|
|
1253
|
+
if (deleteTarget.isFork && deleteTarget.parent) line1 += chalk3.blue(` Fork of ${deleteTarget.parent.nameWithOwner}`);
|
|
1549
1254
|
let line2 = "";
|
|
1550
|
-
if (langName) line2 +=
|
|
1551
|
-
line2 +=
|
|
1552
|
-
return /* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1554
|
-
/* @__PURE__ */
|
|
1255
|
+
if (langName) line2 += chalk3.hex(langColor)("\u25CF ") + chalk3.gray(`${langName} `);
|
|
1256
|
+
line2 += chalk3.gray(`\u2605 ${deleteTarget.stargazerCount} \u2442 ${deleteTarget.forkCount} Updated ${formatDate(deleteTarget.updatedAt)}`);
|
|
1257
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1258
|
+
/* @__PURE__ */ jsx6(Text6, { children: line1 }),
|
|
1259
|
+
/* @__PURE__ */ jsx6(Text6, { children: line2 })
|
|
1555
1260
|
] });
|
|
1556
1261
|
})(),
|
|
1557
|
-
/* @__PURE__ */
|
|
1262
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsxs5(Text6, { children: [
|
|
1558
1263
|
"Type ",
|
|
1559
|
-
/* @__PURE__ */
|
|
1264
|
+
/* @__PURE__ */ jsx6(Text6, { color: "yellow", bold: true, children: deleteCode }),
|
|
1560
1265
|
" to confirm."
|
|
1561
1266
|
] }) }),
|
|
1562
|
-
!deleteConfirmStage && /* @__PURE__ */
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1565
|
-
|
|
1267
|
+
!deleteConfirmStage && /* @__PURE__ */ jsxs5(Box5, { marginTop: 1, children: [
|
|
1268
|
+
/* @__PURE__ */ jsx6(Text6, { children: "Confirm code: " }),
|
|
1269
|
+
/* @__PURE__ */ jsx6(
|
|
1270
|
+
TextInput2,
|
|
1566
1271
|
{
|
|
1567
1272
|
value: typedCode,
|
|
1568
1273
|
onChange: (v) => {
|
|
@@ -1588,11 +1293,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1588
1293
|
}
|
|
1589
1294
|
)
|
|
1590
1295
|
] }),
|
|
1591
|
-
deleteConfirmStage && /* @__PURE__ */
|
|
1592
|
-
/* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
|
|
1296
|
+
deleteConfirmStage && /* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "column", children: [
|
|
1297
|
+
/* @__PURE__ */ jsx6(Text6, { color: "red", children: "This action will permanently delete the repository. This cannot be undone." }),
|
|
1298
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
1299
|
+
/* @__PURE__ */ jsx6(
|
|
1300
|
+
Box5,
|
|
1596
1301
|
{
|
|
1597
1302
|
borderStyle: "round",
|
|
1598
1303
|
borderColor: "red",
|
|
@@ -1601,11 +1306,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1601
1306
|
alignItems: "center",
|
|
1602
1307
|
justifyContent: "center",
|
|
1603
1308
|
flexDirection: "column",
|
|
1604
|
-
children: /* @__PURE__ */
|
|
1309
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: confirmFocus === "delete" ? chalk3.bgRed.white.bold(" Delete ") : chalk3.red.bold("Delete") })
|
|
1605
1310
|
}
|
|
1606
1311
|
),
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
|
|
1312
|
+
/* @__PURE__ */ jsx6(
|
|
1313
|
+
Box5,
|
|
1609
1314
|
{
|
|
1610
1315
|
borderStyle: "round",
|
|
1611
1316
|
borderColor: confirmFocus === "cancel" ? "white" : "gray",
|
|
@@ -1614,17 +1319,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1614
1319
|
alignItems: "center",
|
|
1615
1320
|
justifyContent: "center",
|
|
1616
1321
|
flexDirection: "column",
|
|
1617
|
-
children: /* @__PURE__ */
|
|
1322
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: confirmFocus === "cancel" ? chalk3.bgGray.white.bold(" Cancel ") : chalk3.gray.bold("Cancel") })
|
|
1618
1323
|
}
|
|
1619
1324
|
)
|
|
1620
1325
|
] }),
|
|
1621
|
-
/* @__PURE__ */
|
|
1326
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1622
1327
|
"Press Enter to ",
|
|
1623
1328
|
confirmFocus === "delete" ? "Delete" : "Cancel",
|
|
1624
1329
|
" \u2022 Y to confirm \u2022 C to cancel"
|
|
1625
1330
|
] }) }),
|
|
1626
|
-
/* @__PURE__ */
|
|
1627
|
-
|
|
1331
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(
|
|
1332
|
+
TextInput2,
|
|
1628
1333
|
{
|
|
1629
1334
|
value: "",
|
|
1630
1335
|
onChange: () => {
|
|
@@ -1637,18 +1342,18 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1637
1342
|
}
|
|
1638
1343
|
) })
|
|
1639
1344
|
] }),
|
|
1640
|
-
deleteError && /* @__PURE__ */
|
|
1641
|
-
deleting && /* @__PURE__ */
|
|
1345
|
+
deleteError && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "magenta", children: deleteError }) }),
|
|
1346
|
+
deleting && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "yellow", children: "Deleting..." }) })
|
|
1642
1347
|
] }) })
|
|
1643
|
-
) : archiveMode && archiveTarget ? /* @__PURE__ */
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
/* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1647
|
-
/* @__PURE__ */
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
/* @__PURE__ */
|
|
1651
|
-
|
|
1348
|
+
) : archiveMode && archiveTarget ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: archiveTarget.isArchived ? "green" : "yellow", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1349
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: archiveTarget.isArchived ? "Unarchive Confirmation" : "Archive Confirmation" }),
|
|
1350
|
+
/* @__PURE__ */ jsx6(Text6, { color: archiveTarget.isArchived ? "green" : "yellow", children: archiveTarget.isArchived ? "\u21BA Unarchive repository?" : "\u26A0\uFE0F Archive repository?" }),
|
|
1351
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1352
|
+
/* @__PURE__ */ jsx6(Text6, { children: archiveTarget.nameWithOwner }),
|
|
1353
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { children: archiveTarget.isArchived ? "This will make the repository active again." : "This will make the repository read-only." }) }),
|
|
1354
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
1355
|
+
/* @__PURE__ */ jsx6(
|
|
1356
|
+
Box5,
|
|
1652
1357
|
{
|
|
1653
1358
|
borderStyle: "round",
|
|
1654
1359
|
borderColor: archiveTarget.isArchived ? "green" : "yellow",
|
|
@@ -1657,11 +1362,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1657
1362
|
alignItems: "center",
|
|
1658
1363
|
justifyContent: "center",
|
|
1659
1364
|
flexDirection: "column",
|
|
1660
|
-
children: /* @__PURE__ */
|
|
1365
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: archiveFocus === "confirm" ? chalk3.bgGreen.white.bold(` ${archiveTarget.isArchived ? "Unarchive" : "Archive"} `) : chalk3.bold[archiveTarget.isArchived ? "green" : "yellow"](archiveTarget.isArchived ? "Unarchive" : "Archive") })
|
|
1661
1366
|
}
|
|
1662
1367
|
),
|
|
1663
|
-
/* @__PURE__ */
|
|
1664
|
-
|
|
1368
|
+
/* @__PURE__ */ jsx6(
|
|
1369
|
+
Box5,
|
|
1665
1370
|
{
|
|
1666
1371
|
borderStyle: "round",
|
|
1667
1372
|
borderColor: archiveFocus === "cancel" ? "white" : "gray",
|
|
@@ -1670,17 +1375,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1670
1375
|
alignItems: "center",
|
|
1671
1376
|
justifyContent: "center",
|
|
1672
1377
|
flexDirection: "column",
|
|
1673
|
-
children: /* @__PURE__ */
|
|
1378
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: archiveFocus === "cancel" ? chalk3.bgGray.white.bold(" Cancel ") : chalk3.gray.bold("Cancel") })
|
|
1674
1379
|
}
|
|
1675
1380
|
)
|
|
1676
1381
|
] }),
|
|
1677
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1678
1383
|
"Press Enter to ",
|
|
1679
1384
|
archiveFocus === "confirm" ? archiveTarget.isArchived ? "Unarchive" : "Archive" : "Cancel",
|
|
1680
1385
|
" \u2022 Y to confirm \u2022 C to cancel"
|
|
1681
1386
|
] }) }),
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
|
|
1387
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(
|
|
1388
|
+
TextInput2,
|
|
1684
1389
|
{
|
|
1685
1390
|
value: "",
|
|
1686
1391
|
onChange: () => {
|
|
@@ -1707,21 +1412,21 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1707
1412
|
}
|
|
1708
1413
|
}
|
|
1709
1414
|
) }),
|
|
1710
|
-
archiveError && /* @__PURE__ */
|
|
1711
|
-
archiving && /* @__PURE__ */
|
|
1712
|
-
] }) }) : syncMode && syncTarget ? /* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
syncTarget.parent && /* @__PURE__ */
|
|
1415
|
+
archiveError && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "magenta", children: archiveError }) }),
|
|
1416
|
+
archiving && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "yellow", children: archiveTarget.isArchived ? "Unarchiving..." : "Archiving..." }) })
|
|
1417
|
+
] }) }) : syncMode && syncTarget ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: "blue", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1418
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Sync Fork Confirmation" }),
|
|
1419
|
+
/* @__PURE__ */ jsx6(Text6, { color: "blue", children: "\u27F2 Sync fork with upstream?" }),
|
|
1420
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1421
|
+
/* @__PURE__ */ jsx6(Text6, { children: syncTarget.nameWithOwner }),
|
|
1422
|
+
syncTarget.parent && /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1718
1423
|
"Upstream: ",
|
|
1719
1424
|
syncTarget.parent.nameWithOwner
|
|
1720
1425
|
] }),
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
1724
|
-
|
|
1426
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { children: "This will merge upstream changes into your fork." }) }),
|
|
1427
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
1428
|
+
/* @__PURE__ */ jsx6(
|
|
1429
|
+
Box5,
|
|
1725
1430
|
{
|
|
1726
1431
|
borderStyle: "round",
|
|
1727
1432
|
borderColor: "blue",
|
|
@@ -1730,11 +1435,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1730
1435
|
alignItems: "center",
|
|
1731
1436
|
justifyContent: "center",
|
|
1732
1437
|
flexDirection: "column",
|
|
1733
|
-
children: /* @__PURE__ */
|
|
1438
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: syncFocus === "confirm" ? chalk3.bgBlue.white.bold(" Sync ") : chalk3.blue.bold("Sync") })
|
|
1734
1439
|
}
|
|
1735
1440
|
),
|
|
1736
|
-
/* @__PURE__ */
|
|
1737
|
-
|
|
1441
|
+
/* @__PURE__ */ jsx6(
|
|
1442
|
+
Box5,
|
|
1738
1443
|
{
|
|
1739
1444
|
borderStyle: "round",
|
|
1740
1445
|
borderColor: syncFocus === "cancel" ? "white" : "gray",
|
|
@@ -1743,17 +1448,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1743
1448
|
alignItems: "center",
|
|
1744
1449
|
justifyContent: "center",
|
|
1745
1450
|
flexDirection: "column",
|
|
1746
|
-
children: /* @__PURE__ */
|
|
1451
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: syncFocus === "cancel" ? chalk3.bgGray.white.bold(" Cancel ") : chalk3.gray.bold("Cancel") })
|
|
1747
1452
|
}
|
|
1748
1453
|
)
|
|
1749
1454
|
] }),
|
|
1750
|
-
/* @__PURE__ */
|
|
1455
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1751
1456
|
"Press Enter to ",
|
|
1752
1457
|
syncFocus === "confirm" ? "Sync" : "Cancel",
|
|
1753
1458
|
" \u2022 y to confirm \u2022 c to cancel"
|
|
1754
1459
|
] }) }),
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
|
|
1460
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(
|
|
1461
|
+
TextInput2,
|
|
1757
1462
|
{
|
|
1758
1463
|
value: "",
|
|
1759
1464
|
onChange: () => {
|
|
@@ -1794,14 +1499,14 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1794
1499
|
}
|
|
1795
1500
|
}
|
|
1796
1501
|
) }),
|
|
1797
|
-
syncError && /* @__PURE__ */
|
|
1798
|
-
syncing && /* @__PURE__ */
|
|
1799
|
-
] }) }) : logoutMode ? /* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
/* @__PURE__ */
|
|
1802
|
-
/* @__PURE__ */
|
|
1803
|
-
/* @__PURE__ */
|
|
1804
|
-
|
|
1502
|
+
syncError && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "magenta", children: syncError }) }),
|
|
1503
|
+
syncing && /* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "yellow", children: "Syncing..." }) })
|
|
1504
|
+
] }) }) : logoutMode ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 80), children: [
|
|
1505
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Logout Confirmation" }),
|
|
1506
|
+
/* @__PURE__ */ jsx6(Text6, { color: "cyan", children: "Are you sure you want to log out?" }),
|
|
1507
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", gap: 6, children: [
|
|
1508
|
+
/* @__PURE__ */ jsx6(
|
|
1509
|
+
Box5,
|
|
1805
1510
|
{
|
|
1806
1511
|
borderStyle: "round",
|
|
1807
1512
|
borderColor: "cyan",
|
|
@@ -1810,11 +1515,11 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1810
1515
|
alignItems: "center",
|
|
1811
1516
|
justifyContent: "center",
|
|
1812
1517
|
flexDirection: "column",
|
|
1813
|
-
children: /* @__PURE__ */
|
|
1518
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: logoutFocus === "confirm" ? chalk3.bgCyan.white.bold(" Logout ") : chalk3.cyan.bold("Logout") })
|
|
1814
1519
|
}
|
|
1815
1520
|
),
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
|
|
1521
|
+
/* @__PURE__ */ jsx6(
|
|
1522
|
+
Box5,
|
|
1818
1523
|
{
|
|
1819
1524
|
borderStyle: "round",
|
|
1820
1525
|
borderColor: logoutFocus === "cancel" ? "white" : "gray",
|
|
@@ -1823,83 +1528,92 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1823
1528
|
alignItems: "center",
|
|
1824
1529
|
justifyContent: "center",
|
|
1825
1530
|
flexDirection: "column",
|
|
1826
|
-
children: /* @__PURE__ */
|
|
1531
|
+
children: /* @__PURE__ */ jsx6(Text6, { children: logoutFocus === "cancel" ? chalk3.bgGray.white.bold(" Cancel ") : chalk3.gray.bold("Cancel") })
|
|
1827
1532
|
}
|
|
1828
1533
|
)
|
|
1829
1534
|
] }),
|
|
1830
|
-
/* @__PURE__ */
|
|
1535
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "row", justifyContent: "center", children: /* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1831
1536
|
"Press Enter to ",
|
|
1832
1537
|
logoutFocus === "confirm" ? "Logout" : "Cancel",
|
|
1833
1538
|
" \u2022 Y to confirm \u2022 C to cancel"
|
|
1834
1539
|
] }) })
|
|
1835
|
-
] }) }) :
|
|
1540
|
+
] }) }) : orgSwitcherOpen ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx6(
|
|
1541
|
+
OrgSwitcher,
|
|
1542
|
+
{
|
|
1543
|
+
token,
|
|
1544
|
+
currentContext: ownerContext,
|
|
1545
|
+
onSelect: handleOrgContextChange,
|
|
1546
|
+
onClose: () => setOrgSwitcherOpen(false)
|
|
1547
|
+
}
|
|
1548
|
+
) }) : infoMode ? /* @__PURE__ */ jsx6(Box5, { height: contentHeight, alignItems: "center", justifyContent: "center", children: (() => {
|
|
1836
1549
|
const repo = visibleItems[cursor];
|
|
1837
|
-
if (!repo) return /* @__PURE__ */
|
|
1550
|
+
if (!repo) return /* @__PURE__ */ jsx6(Text6, { color: "red", children: "No repository selected." });
|
|
1838
1551
|
const langName = repo.primaryLanguage?.name || "N/A";
|
|
1839
1552
|
const langColor = repo.primaryLanguage?.color || "#666666";
|
|
1840
|
-
return /* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
repo.description && /* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
1847
|
-
repo.isPrivate ?
|
|
1848
|
-
repo.isArchived ?
|
|
1849
|
-
repo.isFork ?
|
|
1553
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 3, paddingY: 2, width: Math.min(terminalWidth - 8, 90), children: [
|
|
1554
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, children: "Repository Info" }),
|
|
1555
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1556
|
+
/* @__PURE__ */ jsx6(Text6, { children: chalk3.bold(repo.nameWithOwner) }),
|
|
1557
|
+
repo.description && /* @__PURE__ */ jsx6(Text6, { color: "gray", children: repo.description }),
|
|
1558
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1559
|
+
/* @__PURE__ */ jsxs5(Text6, { children: [
|
|
1560
|
+
repo.isPrivate ? chalk3.yellow("Private") : chalk3.green("Public"),
|
|
1561
|
+
repo.isArchived ? chalk3.gray(" Archived") : "",
|
|
1562
|
+
repo.isFork ? chalk3.blue(" Fork") : ""
|
|
1850
1563
|
] }),
|
|
1851
|
-
/* @__PURE__ */
|
|
1852
|
-
/* @__PURE__ */
|
|
1853
|
-
|
|
1854
|
-
|
|
1564
|
+
/* @__PURE__ */ jsx6(Text6, { children: chalk3.gray(`\u2605 ${repo.stargazerCount} \u2442 ${repo.forkCount}`) }),
|
|
1565
|
+
/* @__PURE__ */ jsxs5(Text6, { children: [
|
|
1566
|
+
chalk3.hex(langColor)(`\u25CF `),
|
|
1567
|
+
chalk3.gray(`${langName}`)
|
|
1855
1568
|
] }),
|
|
1856
|
-
/* @__PURE__ */
|
|
1569
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1857
1570
|
"Updated: ",
|
|
1858
1571
|
formatDate(repo.updatedAt),
|
|
1859
1572
|
" \u2022 Pushed: ",
|
|
1860
1573
|
formatDate(repo.pushedAt)
|
|
1861
1574
|
] }),
|
|
1862
|
-
/* @__PURE__ */
|
|
1575
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", children: [
|
|
1863
1576
|
"Size: ",
|
|
1864
1577
|
repo.diskUsage,
|
|
1865
1578
|
" KB"
|
|
1866
1579
|
] }),
|
|
1867
|
-
/* @__PURE__ */
|
|
1868
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ jsx6(Box5, { height: 1, children: /* @__PURE__ */ jsx6(Text6, { children: " " }) }),
|
|
1581
|
+
/* @__PURE__ */ jsx6(Text6, { color: "gray", children: "Press Esc or I to close" })
|
|
1869
1582
|
] });
|
|
1870
|
-
})() }) : /* @__PURE__ */
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
/* @__PURE__ */
|
|
1583
|
+
})() }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1584
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", gap: 2, marginBottom: 1, children: [
|
|
1585
|
+
/* @__PURE__ */ jsx6(Text6, { color: "cyan", bold: true, children: ownerContext === "personal" ? "Personal Account" : `Organization: ${ownerContext.name || ownerContext.login}` }),
|
|
1586
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", dimColor: true, children: [
|
|
1873
1587
|
"Sort: ",
|
|
1874
1588
|
sortKey,
|
|
1875
1589
|
" ",
|
|
1876
1590
|
sortDir === "asc" ? "\u2191" : "\u2193"
|
|
1877
1591
|
] }),
|
|
1878
|
-
/* @__PURE__ */
|
|
1592
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "gray", dimColor: true, children: [
|
|
1879
1593
|
"Forks - Commits Behind: ",
|
|
1880
1594
|
forkTracking ? "ON" : "OFF"
|
|
1881
1595
|
] }),
|
|
1882
|
-
filter && !searchActive && /* @__PURE__ */
|
|
1596
|
+
filter && !searchActive && /* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
|
|
1883
1597
|
'Filter: "',
|
|
1884
1598
|
filter,
|
|
1885
1599
|
'"'
|
|
1886
1600
|
] }),
|
|
1887
|
-
searchActive && /* @__PURE__ */
|
|
1888
|
-
/* @__PURE__ */
|
|
1601
|
+
searchActive && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1602
|
+
/* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
|
|
1889
1603
|
'Search: "',
|
|
1890
1604
|
filter.trim(),
|
|
1891
1605
|
'"'
|
|
1892
1606
|
] }),
|
|
1893
|
-
searchLoading && /* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1607
|
+
searchLoading && /* @__PURE__ */ jsx6(Box5, { marginLeft: 1, children: /* @__PURE__ */ jsxs5(Text6, { color: "cyan", children: [
|
|
1608
|
+
/* @__PURE__ */ jsx6(SlowSpinner, {}),
|
|
1895
1609
|
" Searching\u2026"
|
|
1896
1610
|
] }) })
|
|
1897
1611
|
] })
|
|
1898
1612
|
] }),
|
|
1899
|
-
filterMode && /* @__PURE__ */
|
|
1900
|
-
/* @__PURE__ */
|
|
1901
|
-
/* @__PURE__ */
|
|
1902
|
-
|
|
1613
|
+
filterMode && /* @__PURE__ */ jsxs5(Box5, { marginBottom: 1, children: [
|
|
1614
|
+
/* @__PURE__ */ jsx6(Text6, { children: "Filter: " }),
|
|
1615
|
+
/* @__PURE__ */ jsx6(
|
|
1616
|
+
TextInput2,
|
|
1903
1617
|
{
|
|
1904
1618
|
value: filter,
|
|
1905
1619
|
onChange: (val) => {
|
|
@@ -1938,10 +1652,10 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1938
1652
|
}
|
|
1939
1653
|
)
|
|
1940
1654
|
] }),
|
|
1941
|
-
/* @__PURE__ */
|
|
1942
|
-
filterMode && filter.trim().length > 0 && filter.trim().length < 3 ? /* @__PURE__ */
|
|
1655
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", height: listHeight, children: [
|
|
1656
|
+
filterMode && filter.trim().length > 0 && filter.trim().length < 3 ? /* @__PURE__ */ jsx6(Box5, { justifyContent: "center", alignItems: "center", flexGrow: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: true, children: "Type at least 3 characters to search" }) }) : visibleItems.slice(windowed.start, windowed.end).map((repo, i) => {
|
|
1943
1657
|
const idx = windowed.start + i;
|
|
1944
|
-
return /* @__PURE__ */
|
|
1658
|
+
return /* @__PURE__ */ jsx6(
|
|
1945
1659
|
RepoRow,
|
|
1946
1660
|
{
|
|
1947
1661
|
repo,
|
|
@@ -1954,42 +1668,43 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin }) {
|
|
|
1954
1668
|
repo.nameWithOwner
|
|
1955
1669
|
);
|
|
1956
1670
|
}),
|
|
1957
|
-
loadingMore && hasNextPage && /* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1671
|
+
loadingMore && hasNextPage && /* @__PURE__ */ jsx6(Box5, { justifyContent: "center", alignItems: "center", marginTop: 1, children: /* @__PURE__ */ jsxs5(Box5, { flexDirection: "row", children: [
|
|
1672
|
+
/* @__PURE__ */ jsx6(Box5, { width: 2, flexShrink: 0, flexGrow: 0, marginRight: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "cyan", children: /* @__PURE__ */ jsx6(SlowSpinner, {}) }) }),
|
|
1673
|
+
/* @__PURE__ */ jsx6(Text6, { color: "cyan", children: "Loading more repositories..." })
|
|
1960
1674
|
] }) }),
|
|
1961
|
-
!loading && !searchLoading && visibleItems.length === 0 && /* @__PURE__ */
|
|
1675
|
+
!loading && !searchLoading && visibleItems.length === 0 && /* @__PURE__ */ jsx6(Box5, { justifyContent: "center", alignItems: "center", flexGrow: 1, children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: true, children: searchActive ? "No repositories match your search" : filter ? "No repositories match your filter" : "No repositories found" }) })
|
|
1962
1676
|
] })
|
|
1963
1677
|
] }) }),
|
|
1964
|
-
/* @__PURE__ */
|
|
1965
|
-
/* @__PURE__ */
|
|
1966
|
-
/* @__PURE__ */
|
|
1678
|
+
/* @__PURE__ */ jsxs5(Box5, { marginTop: 1, paddingX: 1, flexDirection: "column", children: [
|
|
1679
|
+
/* @__PURE__ */ jsx6(Box5, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: modalOpen ? true : void 0, children: "\u2191\u2193 Navigate \u2022 Ctrl+G Top \u2022 G Bottom \u2022 / Filter \u2022 W Org Switcher \u2022 S Sort \u2022 D Direction \u2022 T Density \u2022 F Forks \u2022 \u23CE/O Open" }) }),
|
|
1680
|
+
/* @__PURE__ */ jsx6(Box5, { width: terminalWidth, justifyContent: "center", children: /* @__PURE__ */ jsx6(Text6, { color: "gray", dimColor: modalOpen ? true : void 0, children: "Del/Ctrl+Backspace Delete \u2022 Ctrl+A Un/Archive \u2022 Ctrl+U Sync Fork \u2022 I Info \u2022 Ctrl+I Cache \u2022 Ctrl+L Logout \u2022 R Refresh \u2022 Q Quit" }) })
|
|
1967
1681
|
] }),
|
|
1968
|
-
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
debugMessages.length === 0 ? /* @__PURE__ */
|
|
1682
|
+
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */ jsxs5(Box5, { marginTop: 1, borderStyle: "single", borderColor: "yellow", paddingX: 1, flexDirection: "column", children: [
|
|
1683
|
+
/* @__PURE__ */ jsx6(Text6, { bold: true, color: "yellow", children: "Debug Messages:" }),
|
|
1684
|
+
debugMessages.length === 0 ? /* @__PURE__ */ jsx6(Text6, { color: "gray", children: "No debug messages yet..." }) : debugMessages.map((msg, i) => /* @__PURE__ */ jsx6(Text6, { color: "gray", children: msg }, i))
|
|
1971
1685
|
] })
|
|
1972
1686
|
] });
|
|
1973
1687
|
}
|
|
1974
1688
|
|
|
1975
1689
|
// src/ui/App.tsx
|
|
1976
|
-
import { jsx as
|
|
1690
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1977
1691
|
var packageJson = require_package();
|
|
1978
1692
|
function App() {
|
|
1979
1693
|
const { exit } = useApp2();
|
|
1980
1694
|
const { stdout } = useStdout2();
|
|
1981
|
-
const [mode, setMode] =
|
|
1982
|
-
const [token, setToken] =
|
|
1983
|
-
const [input, setInput] =
|
|
1984
|
-
const [error, setError] =
|
|
1985
|
-
const [viewer, setViewer] =
|
|
1986
|
-
const [rateLimitReset, setRateLimitReset] =
|
|
1987
|
-
const [
|
|
1695
|
+
const [mode, setMode] = useState4("checking");
|
|
1696
|
+
const [token, setToken] = useState4(null);
|
|
1697
|
+
const [input, setInput] = useState4("");
|
|
1698
|
+
const [error, setError] = useState4(null);
|
|
1699
|
+
const [viewer, setViewer] = useState4(null);
|
|
1700
|
+
const [rateLimitReset, setRateLimitReset] = useState4(null);
|
|
1701
|
+
const [orgContext, setOrgContext] = useState4("personal");
|
|
1702
|
+
const [dims, setDims] = useState4(() => {
|
|
1988
1703
|
const cols = stdout?.columns ?? 100;
|
|
1989
1704
|
const rows = stdout?.rows ?? 30;
|
|
1990
1705
|
return { cols, rows };
|
|
1991
1706
|
});
|
|
1992
|
-
|
|
1707
|
+
useEffect4(() => {
|
|
1993
1708
|
if (!stdout) return;
|
|
1994
1709
|
const onResize = () => {
|
|
1995
1710
|
const cols = stdout.columns ?? 100;
|
|
@@ -2001,7 +1716,7 @@ function App() {
|
|
|
2001
1716
|
stdout.off?.("resize", onResize);
|
|
2002
1717
|
};
|
|
2003
1718
|
}, [stdout]);
|
|
2004
|
-
|
|
1719
|
+
useEffect4(() => {
|
|
2005
1720
|
const env = getTokenFromEnv();
|
|
2006
1721
|
const stored = getStoredToken();
|
|
2007
1722
|
if (env) {
|
|
@@ -2014,7 +1729,7 @@ function App() {
|
|
|
2014
1729
|
setMode("prompt");
|
|
2015
1730
|
}
|
|
2016
1731
|
}, []);
|
|
2017
|
-
|
|
1732
|
+
useEffect4(() => {
|
|
2018
1733
|
(async () => {
|
|
2019
1734
|
if (mode !== "validating" || !token) return;
|
|
2020
1735
|
const timeoutId = setTimeout(() => {
|
|
@@ -2099,7 +1814,7 @@ function App() {
|
|
|
2099
1814
|
setViewer(null);
|
|
2100
1815
|
setMode("prompt");
|
|
2101
1816
|
};
|
|
2102
|
-
|
|
1817
|
+
useInput3((input2, key) => {
|
|
2103
1818
|
if (mode === "prompt" && key.escape) {
|
|
2104
1819
|
exit();
|
|
2105
1820
|
}
|
|
@@ -2125,24 +1840,20 @@ function App() {
|
|
|
2125
1840
|
}
|
|
2126
1841
|
});
|
|
2127
1842
|
const verticalPadding = Math.floor(dims.rows * 0.15);
|
|
2128
|
-
const header = useMemo2(() => /* @__PURE__ */
|
|
2129
|
-
/* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
1843
|
+
const header = useMemo2(() => /* @__PURE__ */ jsxs6(Box6, { flexDirection: "row", justifyContent: "space-between", marginBottom: 1, children: [
|
|
1844
|
+
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "row", gap: 1, children: [
|
|
1845
|
+
/* @__PURE__ */ jsxs6(Text7, { bold: true, color: "cyan", children: [
|
|
2131
1846
|
" ",
|
|
2132
1847
|
"GitHub Repository Manager"
|
|
2133
1848
|
] }),
|
|
2134
|
-
/* @__PURE__ */
|
|
1849
|
+
/* @__PURE__ */ jsxs6(Text7, { color: "gray", dimColor: true, children: [
|
|
2135
1850
|
"v",
|
|
2136
1851
|
packageJson.version
|
|
2137
1852
|
] }),
|
|
2138
|
-
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */
|
|
1853
|
+
process.env.GH_MANAGER_DEBUG === "1" && /* @__PURE__ */ jsx7(Text7, { backgroundColor: "blue", color: "white", children: " debug mode " })
|
|
2139
1854
|
] }),
|
|
2140
|
-
viewer && /* @__PURE__ */
|
|
2141
|
-
|
|
2142
|
-
viewer,
|
|
2143
|
-
" "
|
|
2144
|
-
] })
|
|
2145
|
-
] }), [viewer]);
|
|
1855
|
+
viewer && /* @__PURE__ */ jsx7(Text7, { color: "gray", children: orgContext !== "personal" && orgContext.login ? `${orgContext.login}/@${viewer} ` : `@${viewer} ` })
|
|
1856
|
+
] }), [viewer, orgContext]);
|
|
2146
1857
|
if (mode === "rate_limited") {
|
|
2147
1858
|
const formatResetTime = (resetTime) => {
|
|
2148
1859
|
if (!resetTime) return "Unknown";
|
|
@@ -2164,56 +1875,56 @@ function App() {
|
|
|
2164
1875
|
return "Unknown";
|
|
2165
1876
|
}
|
|
2166
1877
|
};
|
|
2167
|
-
return /* @__PURE__ */
|
|
1878
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2168
1879
|
header,
|
|
2169
|
-
/* @__PURE__ */
|
|
2170
|
-
/* @__PURE__ */
|
|
2171
|
-
/* @__PURE__ */
|
|
2172
|
-
/* @__PURE__ */
|
|
2173
|
-
rateLimitReset && /* @__PURE__ */
|
|
2174
|
-
/* @__PURE__ */
|
|
2175
|
-
/* @__PURE__ */
|
|
1880
|
+
/* @__PURE__ */ jsx7(Box6, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs6(Box6, { borderStyle: "single", borderColor: "yellow", paddingX: 3, paddingY: 2, flexDirection: "column", width: Math.min(dims.cols - 8, 80), children: [
|
|
1881
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, color: "yellow", marginBottom: 1, children: "\u26A0\uFE0F Rate Limit Exceeded" }),
|
|
1882
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", marginBottom: 1, children: "You've hit GitHub's API rate limit for your token." }),
|
|
1883
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", marginBottom: 1, children: "This happens when you make too many requests in a short time." }),
|
|
1884
|
+
rateLimitReset && /* @__PURE__ */ jsxs6(Box6, { marginTop: 1, marginBottom: 1, children: [
|
|
1885
|
+
/* @__PURE__ */ jsxs6(Text7, { children: [
|
|
1886
|
+
/* @__PURE__ */ jsx7(Text7, { color: "cyan", children: "Reset in:" }),
|
|
2176
1887
|
" ",
|
|
2177
|
-
/* @__PURE__ */
|
|
1888
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: formatResetTime(rateLimitReset) })
|
|
2178
1889
|
] }),
|
|
2179
|
-
/* @__PURE__ */
|
|
1890
|
+
/* @__PURE__ */ jsxs6(Text7, { color: "gray", dimColor: true, children: [
|
|
2180
1891
|
"(",
|
|
2181
1892
|
new Date(rateLimitReset).toLocaleTimeString(),
|
|
2182
1893
|
")"
|
|
2183
1894
|
] })
|
|
2184
1895
|
] }),
|
|
2185
|
-
/* @__PURE__ */
|
|
2186
|
-
/* @__PURE__ */
|
|
2187
|
-
/* @__PURE__ */
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ jsxs6(Box6, { marginTop: 2, flexDirection: "column", gap: 1, children: [
|
|
1897
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, children: "What would you like to do?" }),
|
|
1898
|
+
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingLeft: 2, children: [
|
|
1899
|
+
/* @__PURE__ */ jsxs6(Text7, { children: [
|
|
1900
|
+
/* @__PURE__ */ jsx7(Text7, { color: "cyan", bold: true, children: "r" }),
|
|
2190
1901
|
" - Retry now ",
|
|
2191
1902
|
rateLimitReset && formatResetTime(rateLimitReset) !== "Now (should be reset)" ? "(likely to fail until reset)" : "(should work now)"
|
|
2192
1903
|
] }),
|
|
2193
|
-
/* @__PURE__ */
|
|
2194
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ jsxs6(Text7, { children: [
|
|
1905
|
+
/* @__PURE__ */ jsx7(Text7, { color: "cyan", bold: true, children: "l" }),
|
|
2195
1906
|
" - Logout and use a different token"
|
|
2196
1907
|
] }),
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
/* @__PURE__ */
|
|
1908
|
+
/* @__PURE__ */ jsxs6(Text7, { children: [
|
|
1909
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", bold: true, children: "q/Esc" }),
|
|
2199
1910
|
" - Quit application"
|
|
2200
1911
|
] })
|
|
2201
1912
|
] })
|
|
2202
1913
|
] }),
|
|
2203
|
-
/* @__PURE__ */
|
|
1914
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, marginTop: 2, children: "Tip: Using multiple tokens or waiting between requests can help avoid rate limits." })
|
|
2204
1915
|
] }) })
|
|
2205
1916
|
] });
|
|
2206
1917
|
}
|
|
2207
1918
|
if (mode === "prompt") {
|
|
2208
|
-
return /* @__PURE__ */
|
|
1919
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2209
1920
|
header,
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
/* @__PURE__ */
|
|
2215
|
-
/* @__PURE__ */
|
|
2216
|
-
|
|
1921
|
+
/* @__PURE__ */ jsx7(Box6, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs6(Box6, { borderStyle: "single", borderColor: "cyan", paddingX: 2, paddingY: 1, flexDirection: "column", children: [
|
|
1922
|
+
/* @__PURE__ */ jsx7(Text7, { bold: true, marginBottom: 1, children: "Authentication Required" }),
|
|
1923
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", marginBottom: 1, children: "Enter your GitHub Personal Access Token" }),
|
|
1924
|
+
/* @__PURE__ */ jsxs6(Box6, { children: [
|
|
1925
|
+
/* @__PURE__ */ jsx7(Text7, { children: "Token: " }),
|
|
1926
|
+
/* @__PURE__ */ jsx7(
|
|
1927
|
+
TextInput3,
|
|
2217
1928
|
{
|
|
2218
1929
|
value: input,
|
|
2219
1930
|
onChange: setInput,
|
|
@@ -2222,43 +1933,44 @@ function App() {
|
|
|
2222
1933
|
}
|
|
2223
1934
|
)
|
|
2224
1935
|
] }),
|
|
2225
|
-
error && /* @__PURE__ */
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
1936
|
+
error && /* @__PURE__ */ jsx7(Text7, { color: "red", marginTop: 1, children: error }),
|
|
1937
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, marginTop: 1, children: "The token will be stored securely in your local config" }),
|
|
1938
|
+
/* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, marginTop: 1, children: "Press Esc to quit" })
|
|
2228
1939
|
] }) })
|
|
2229
1940
|
] });
|
|
2230
1941
|
}
|
|
2231
1942
|
if (mode === "validating" || mode === "checking") {
|
|
2232
|
-
return /* @__PURE__ */
|
|
1943
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2233
1944
|
header,
|
|
2234
|
-
/* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
mode === "validating" && /* @__PURE__ */
|
|
1945
|
+
/* @__PURE__ */ jsx7(Box6, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", alignItems: "center", children: [
|
|
1946
|
+
/* @__PURE__ */ jsx7(Text7, { color: "yellow", children: "Validating token..." }),
|
|
1947
|
+
mode === "validating" && /* @__PURE__ */ jsx7(Text7, { color: "gray", dimColor: true, marginTop: 1, children: "Press Esc to cancel" })
|
|
2237
1948
|
] }) })
|
|
2238
1949
|
] });
|
|
2239
1950
|
}
|
|
2240
1951
|
if (mode === "error") {
|
|
2241
|
-
return /* @__PURE__ */
|
|
1952
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2242
1953
|
header,
|
|
2243
|
-
/* @__PURE__ */
|
|
1954
|
+
/* @__PURE__ */ jsx7(Box6, { flexGrow: 1, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx7(Text7, { color: "red", children: error ?? "Unexpected error" }) })
|
|
2244
1955
|
] });
|
|
2245
1956
|
}
|
|
2246
|
-
return /* @__PURE__ */
|
|
1957
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", height: dims.rows, paddingX: 2, paddingTop: verticalPadding, paddingBottom: verticalPadding, children: [
|
|
2247
1958
|
header,
|
|
2248
|
-
/* @__PURE__ */
|
|
1959
|
+
/* @__PURE__ */ jsx7(
|
|
2249
1960
|
RepoList,
|
|
2250
1961
|
{
|
|
2251
1962
|
token,
|
|
2252
1963
|
maxVisibleRows: dims.rows - verticalPadding * 2 - 4,
|
|
2253
1964
|
onLogout: handleLogout,
|
|
2254
|
-
viewerLogin: viewer ?? void 0
|
|
1965
|
+
viewerLogin: viewer ?? void 0,
|
|
1966
|
+
onOrgContextChange: setOrgContext
|
|
2255
1967
|
}
|
|
2256
1968
|
)
|
|
2257
1969
|
] });
|
|
2258
1970
|
}
|
|
2259
1971
|
|
|
2260
1972
|
// src/index.tsx
|
|
2261
|
-
import { jsx as
|
|
1973
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2262
1974
|
if (process.env.GH_MANAGER_DEBUG === "1") {
|
|
2263
1975
|
process.stderr.write("\u{1F41B} Debug mode enabled\n");
|
|
2264
1976
|
}
|
|
@@ -2271,8 +1983,8 @@ process.on("unhandledRejection", (reason) => {
|
|
|
2271
1983
|
process.exit(1);
|
|
2272
1984
|
});
|
|
2273
1985
|
render(
|
|
2274
|
-
/* @__PURE__ */
|
|
2275
|
-
/* @__PURE__ */
|
|
2276
|
-
/* @__PURE__ */
|
|
1986
|
+
/* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
1987
|
+
/* @__PURE__ */ jsx8(App, {}),
|
|
1988
|
+
/* @__PURE__ */ jsx8(Text8, { color: "gray" })
|
|
2277
1989
|
] })
|
|
2278
1990
|
);
|