gh-manager-cli 1.8.2 → 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,10 @@
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
+
1
8
  ## [1.8.2](https://github.com/wiiiimm/gh-manager-cli/compare/v1.8.1...v1.8.2) (2025-09-01)
2
9
 
3
10
 
@@ -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-OQGG2X5P.js";
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-OQGG2X5P.js";
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.8.2",
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-TWXF5AWM.js").then((m) => m.makeClient(token));
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) {
@@ -865,25 +866,37 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
865
866
  const [owner, repo] = syncTarget.nameWithOwner.split("/");
866
867
  const branchName = syncTarget.defaultBranchRef?.name || "main";
867
868
  const result = await syncForkWithUpstream(token, owner, repo, branchName);
868
- const updateSyncedRepo = (r) => {
869
- if (r.id === syncTarget.id && r.parent && r.defaultBranchRef?.target?.history && r.parent.defaultBranchRef?.target?.history) {
870
- return {
871
- ...r,
872
- defaultBranchRef: {
873
- ...r.defaultBranchRef,
874
- target: {
875
- ...r.defaultBranchRef.target,
876
- history: {
877
- totalCount: r.parent.defaultBranchRef.target.history.totalCount
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
+ }
878
891
  }
879
892
  }
880
- }
881
- };
882
- }
883
- return r;
884
- };
885
- setItems((prev) => prev.map(updateSyncedRepo));
886
- setSearchItems((prev) => prev.map(updateSyncedRepo));
893
+ };
894
+ }
895
+ return r;
896
+ };
897
+ setItems((prev) => prev.map(updateSyncedRepo));
898
+ setSearchItems((prev) => prev.map(updateSyncedRepo));
899
+ }
887
900
  closeSyncModal();
888
901
  } catch (e) {
889
902
  setSyncing(false);
@@ -1480,26 +1493,39 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
1480
1493
  try {
1481
1494
  setSyncing(true);
1482
1495
  const [owner, repo] = syncTarget.nameWithOwner.split("/");
1483
- const result = await syncForkWithUpstream(token, owner, repo);
1484
- const updateSyncedRepo = (r) => {
1485
- if (r.id === syncTarget.id && r.parent && r.defaultBranchRef?.target?.history && r.parent.defaultBranchRef?.target?.history) {
1486
- return {
1487
- ...r,
1488
- defaultBranchRef: {
1489
- ...r.defaultBranchRef,
1490
- target: {
1491
- ...r.defaultBranchRef.target,
1492
- history: {
1493
- totalCount: r.parent.defaultBranchRef.target.history.totalCount
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
+ }
1494
1520
  }
1495
1521
  }
1496
- }
1497
- };
1498
- }
1499
- return r;
1500
- };
1501
- setItems((prev) => prev.map(updateSyncedRepo));
1502
- setSearchItems((prev) => prev.map(updateSyncedRepo));
1522
+ };
1523
+ }
1524
+ return r;
1525
+ };
1526
+ setItems((prev) => prev.map(updateSyncedRepo));
1527
+ setSearchItems((prev) => prev.map(updateSyncedRepo));
1528
+ }
1503
1529
  closeSyncModal();
1504
1530
  } catch (e) {
1505
1531
  setSyncing(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gh-manager-cli",
3
- "version": "1.8.2",
3
+ "version": "1.9.0",
4
4
  "private": false,
5
5
  "description": "Interactive CLI to manage your GitHub repos (personal) with Ink",
6
6
  "license": "MIT",