gh-manager-cli 1.8.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.9.0](https://github.com/wiiiimm/gh-manager-cli/compare/v1.8.2...v1.9.0) (2025-09-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* refetch repository data after sync to update timestamps ([b26468d](https://github.com/wiiiimm/gh-manager-cli/commit/b26468de5c3c12e04199f13de1958acd725fd239))
|
|
7
|
+
|
|
8
|
+
## [1.8.2](https://github.com/wiiiimm/gh-manager-cli/compare/v1.8.1...v1.8.2) (2025-09-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* update search results when performing repository actions ([f4edb65](https://github.com/wiiiimm/gh-manager-cli/commit/f4edb65d84501f894dcc012bc6bf6b7495ec0902))
|
|
14
|
+
|
|
1
15
|
## [1.8.1](https://github.com/wiiiimm/gh-manager-cli/compare/v1.8.0...v1.8.1) (2025-09-01)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -533,6 +533,63 @@ async function unarchiveRepositoryById(client, repositoryId) {
|
|
|
533
533
|
);
|
|
534
534
|
await client(mutation, { repositoryId });
|
|
535
535
|
}
|
|
536
|
+
async function fetchRepositoryById(client, repositoryId, includeForkTracking = true) {
|
|
537
|
+
const query = (
|
|
538
|
+
/* GraphQL */
|
|
539
|
+
`
|
|
540
|
+
query GetRepository($id: ID!, $includeForkTracking: Boolean!) {
|
|
541
|
+
node(id: $id) {
|
|
542
|
+
... on Repository {
|
|
543
|
+
id
|
|
544
|
+
name
|
|
545
|
+
nameWithOwner
|
|
546
|
+
description
|
|
547
|
+
url
|
|
548
|
+
pushedAt
|
|
549
|
+
updatedAt
|
|
550
|
+
isPrivate
|
|
551
|
+
isArchived
|
|
552
|
+
isFork
|
|
553
|
+
stargazerCount
|
|
554
|
+
forkCount
|
|
555
|
+
diskUsage
|
|
556
|
+
primaryLanguage {
|
|
557
|
+
name
|
|
558
|
+
color
|
|
559
|
+
}
|
|
560
|
+
parent @include(if: $includeForkTracking) {
|
|
561
|
+
nameWithOwner
|
|
562
|
+
defaultBranchRef {
|
|
563
|
+
target {
|
|
564
|
+
... on Commit {
|
|
565
|
+
history(first: 0) {
|
|
566
|
+
totalCount
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
defaultBranchRef @include(if: $includeForkTracking) {
|
|
573
|
+
name
|
|
574
|
+
target {
|
|
575
|
+
... on Commit {
|
|
576
|
+
history(first: 0) {
|
|
577
|
+
totalCount
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
`
|
|
586
|
+
);
|
|
587
|
+
const result = await client(query, {
|
|
588
|
+
id: repositoryId,
|
|
589
|
+
includeForkTracking
|
|
590
|
+
});
|
|
591
|
+
return result.node;
|
|
592
|
+
}
|
|
536
593
|
async function syncForkWithUpstream(token, owner, repo, branch = "main") {
|
|
537
594
|
const url = `https://api.github.com/repos/${owner}/${repo}/merge-upstream`;
|
|
538
595
|
const res = await fetch(url, {
|
|
@@ -642,6 +699,7 @@ export {
|
|
|
642
699
|
deleteRepositoryRest,
|
|
643
700
|
archiveRepositoryById,
|
|
644
701
|
unarchiveRepositoryById,
|
|
702
|
+
fetchRepositoryById,
|
|
645
703
|
syncForkWithUpstream,
|
|
646
704
|
purgeApolloCacheFiles,
|
|
647
705
|
inspectCacheStatus
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
archiveRepositoryById,
|
|
4
4
|
deleteRepositoryRest,
|
|
5
|
+
fetchRepositoryById,
|
|
5
6
|
fetchViewerOrganizations,
|
|
6
7
|
fetchViewerReposPage,
|
|
7
8
|
fetchViewerReposPageUnified,
|
|
@@ -12,10 +13,11 @@ import {
|
|
|
12
13
|
searchRepositoriesUnified,
|
|
13
14
|
syncForkWithUpstream,
|
|
14
15
|
unarchiveRepositoryById
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZOCWGQ37.js";
|
|
16
17
|
export {
|
|
17
18
|
archiveRepositoryById,
|
|
18
19
|
deleteRepositoryRest,
|
|
20
|
+
fetchRepositoryById,
|
|
19
21
|
fetchViewerOrganizations,
|
|
20
22
|
fetchViewerReposPage,
|
|
21
23
|
fetchViewerReposPageUnified,
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
__commonJS,
|
|
4
4
|
archiveRepositoryById,
|
|
5
5
|
deleteRepositoryRest,
|
|
6
|
+
fetchRepositoryById,
|
|
6
7
|
fetchViewerOrganizations,
|
|
7
8
|
fetchViewerReposPageUnified,
|
|
8
9
|
getViewerLogin,
|
|
@@ -12,14 +13,14 @@ import {
|
|
|
12
13
|
searchRepositoriesUnified,
|
|
13
14
|
syncForkWithUpstream,
|
|
14
15
|
unarchiveRepositoryById
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZOCWGQ37.js";
|
|
16
17
|
|
|
17
18
|
// package.json
|
|
18
19
|
var require_package = __commonJS({
|
|
19
20
|
"package.json"(exports, module) {
|
|
20
21
|
module.exports = {
|
|
21
22
|
name: "gh-manager-cli",
|
|
22
|
-
version: "1.
|
|
23
|
+
version: "1.9.0",
|
|
23
24
|
private: false,
|
|
24
25
|
description: "Interactive CLI to manage your GitHub repos (personal) with Ink",
|
|
25
26
|
license: "MIT",
|
|
@@ -275,7 +276,7 @@ function OrgSwitcher({ token, currentContext, onSelect, onClose }) {
|
|
|
275
276
|
const loadOrgs = async () => {
|
|
276
277
|
try {
|
|
277
278
|
setLoading(true);
|
|
278
|
-
const client = await import("./github-
|
|
279
|
+
const client = await import("./github-RBSLUQTY.js").then((m) => m.makeClient(token));
|
|
279
280
|
const orgs = await fetchViewerOrganizations(client);
|
|
280
281
|
setOrganizations(orgs);
|
|
281
282
|
if (!isPersonalContext) {
|
|
@@ -527,8 +528,13 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
527
528
|
setDeleting(true);
|
|
528
529
|
const [owner, repo] = (deleteTarget.nameWithOwner || "").split("/");
|
|
529
530
|
await deleteRepositoryRest(token, owner, repo);
|
|
530
|
-
|
|
531
|
+
const targetId = deleteTarget.id;
|
|
532
|
+
setItems((prev) => prev.filter((r) => r.id !== targetId));
|
|
533
|
+
setSearchItems((prev) => prev.filter((r) => r.id !== targetId));
|
|
531
534
|
setTotalCount((c) => Math.max(0, c - 1));
|
|
535
|
+
if (searchActive) {
|
|
536
|
+
setSearchTotalCount((c) => Math.max(0, c - 1));
|
|
537
|
+
}
|
|
532
538
|
setDeleteMode(false);
|
|
533
539
|
setDeleteTarget(null);
|
|
534
540
|
setTypedCode("");
|
|
@@ -822,7 +828,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
822
828
|
const id = archiveTarget.id;
|
|
823
829
|
if (isArchived) await unarchiveRepositoryById(client, id);
|
|
824
830
|
else await archiveRepositoryById(client, id);
|
|
825
|
-
|
|
831
|
+
const updateRepo = (r) => r.id === id ? { ...r, isArchived: !isArchived } : r;
|
|
832
|
+
setItems((prev) => prev.map(updateRepo));
|
|
833
|
+
setSearchItems((prev) => prev.map(updateRepo));
|
|
826
834
|
closeArchiveModal();
|
|
827
835
|
} catch (e) {
|
|
828
836
|
setArchiving(false);
|
|
@@ -858,23 +866,37 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
858
866
|
const [owner, repo] = syncTarget.nameWithOwner.split("/");
|
|
859
867
|
const branchName = syncTarget.defaultBranchRef?.name || "main";
|
|
860
868
|
const result = await syncForkWithUpstream(token, owner, repo, branchName);
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
869
|
+
const updatedRepo = await fetchRepositoryById(client, syncTarget.id, forkTracking);
|
|
870
|
+
if (updatedRepo) {
|
|
871
|
+
const updateSyncedRepo = (r) => {
|
|
872
|
+
if (r.id === syncTarget.id) {
|
|
873
|
+
return updatedRepo;
|
|
874
|
+
}
|
|
875
|
+
return r;
|
|
876
|
+
};
|
|
877
|
+
setItems((prev) => prev.map(updateSyncedRepo));
|
|
878
|
+
setSearchItems((prev) => prev.map(updateSyncedRepo));
|
|
879
|
+
} else {
|
|
880
|
+
const updateSyncedRepo = (r) => {
|
|
881
|
+
if (r.id === syncTarget.id && r.parent && r.defaultBranchRef?.target?.history && r.parent.defaultBranchRef?.target?.history) {
|
|
882
|
+
return {
|
|
883
|
+
...r,
|
|
884
|
+
defaultBranchRef: {
|
|
885
|
+
...r.defaultBranchRef,
|
|
886
|
+
target: {
|
|
887
|
+
...r.defaultBranchRef.target,
|
|
888
|
+
history: {
|
|
889
|
+
totalCount: r.parent.defaultBranchRef.target.history.totalCount
|
|
890
|
+
}
|
|
871
891
|
}
|
|
872
892
|
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
return r;
|
|
896
|
+
};
|
|
897
|
+
setItems((prev) => prev.map(updateSyncedRepo));
|
|
898
|
+
setSearchItems((prev) => prev.map(updateSyncedRepo));
|
|
899
|
+
}
|
|
878
900
|
closeSyncModal();
|
|
879
901
|
} catch (e) {
|
|
880
902
|
setSyncing(false);
|
|
@@ -1399,7 +1421,9 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1399
1421
|
const id = archiveTarget.id;
|
|
1400
1422
|
if (isArchived) await unarchiveRepositoryById(client, id);
|
|
1401
1423
|
else await archiveRepositoryById(client, id);
|
|
1402
|
-
|
|
1424
|
+
const updateRepo = (r) => r.id === id ? { ...r, isArchived: !isArchived } : r;
|
|
1425
|
+
setItems((prev) => prev.map(updateRepo));
|
|
1426
|
+
setSearchItems((prev) => prev.map(updateRepo));
|
|
1403
1427
|
closeArchiveModal();
|
|
1404
1428
|
} catch (e) {
|
|
1405
1429
|
setArchiving(false);
|
|
@@ -1469,24 +1493,39 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1469
1493
|
try {
|
|
1470
1494
|
setSyncing(true);
|
|
1471
1495
|
const [owner, repo] = syncTarget.nameWithOwner.split("/");
|
|
1472
|
-
const
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1496
|
+
const branchName = syncTarget.defaultBranchRef?.name || "main";
|
|
1497
|
+
const result = await syncForkWithUpstream(token, owner, repo, branchName);
|
|
1498
|
+
const updatedRepo = await fetchRepositoryById(client, syncTarget.id, forkTracking);
|
|
1499
|
+
if (updatedRepo) {
|
|
1500
|
+
const updateSyncedRepo = (r) => {
|
|
1501
|
+
if (r.id === syncTarget.id) {
|
|
1502
|
+
return updatedRepo;
|
|
1503
|
+
}
|
|
1504
|
+
return r;
|
|
1505
|
+
};
|
|
1506
|
+
setItems((prev) => prev.map(updateSyncedRepo));
|
|
1507
|
+
setSearchItems((prev) => prev.map(updateSyncedRepo));
|
|
1508
|
+
} else {
|
|
1509
|
+
const updateSyncedRepo = (r) => {
|
|
1510
|
+
if (r.id === syncTarget.id && r.parent && r.defaultBranchRef?.target?.history && r.parent.defaultBranchRef?.target?.history) {
|
|
1511
|
+
return {
|
|
1512
|
+
...r,
|
|
1513
|
+
defaultBranchRef: {
|
|
1514
|
+
...r.defaultBranchRef,
|
|
1515
|
+
target: {
|
|
1516
|
+
...r.defaultBranchRef.target,
|
|
1517
|
+
history: {
|
|
1518
|
+
totalCount: r.parent.defaultBranchRef.target.history.totalCount
|
|
1519
|
+
}
|
|
1483
1520
|
}
|
|
1484
1521
|
}
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1522
|
+
};
|
|
1523
|
+
}
|
|
1524
|
+
return r;
|
|
1525
|
+
};
|
|
1526
|
+
setItems((prev) => prev.map(updateSyncedRepo));
|
|
1527
|
+
setSearchItems((prev) => prev.map(updateSyncedRepo));
|
|
1528
|
+
}
|
|
1490
1529
|
closeSyncModal();
|
|
1491
1530
|
} catch (e) {
|
|
1492
1531
|
setSyncing(false);
|