gh-manager-cli 1.10.2 → 1.10.3

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.10.3](https://github.com/wiiiimm/gh-manager-cli/compare/v1.10.2...v1.10.3) (2025-09-01)
2
+
3
+
4
+ ### Performance Improvements
5
+
6
+ * optimize sync operation to update locally without API call ([b851c85](https://github.com/wiiiimm/gh-manager-cli/commit/b851c854a277b53f908e92d330622c4513642600))
7
+
1
8
  ## [1.10.2](https://github.com/wiiiimm/gh-manager-cli/compare/v1.10.1...v1.10.2) (2025-09-01)
2
9
 
3
10
 
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@ import {
3
3
  __commonJS,
4
4
  archiveRepositoryById,
5
5
  deleteRepositoryRest,
6
- fetchRepositoryById,
7
6
  fetchViewerOrganizations,
8
7
  fetchViewerReposPageUnified,
9
8
  getRepositoryFromCache,
@@ -24,7 +23,7 @@ var require_package = __commonJS({
24
23
  "package.json"(exports, module) {
25
24
  module.exports = {
26
25
  name: "gh-manager-cli",
27
- version: "1.10.2",
26
+ version: "1.10.3",
28
27
  private: false,
29
28
  description: "Interactive CLI to manage your GitHub repos (personal) with Ink",
30
29
  license: "MIT",
@@ -873,38 +872,32 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
873
872
  const [owner, repo] = syncTarget.nameWithOwner.split("/");
874
873
  const branchName = syncTarget.defaultBranchRef?.name || "main";
875
874
  const result = await syncForkWithUpstream(token, owner, repo, branchName);
876
- const updatedRepo = await fetchRepositoryById(client, syncTarget.id, forkTracking);
877
- if (updatedRepo) {
878
- await updateCacheWithRepository(token, updatedRepo);
879
- const updateSyncedRepo = (r) => {
880
- if (r.id === syncTarget.id) {
881
- return updatedRepo;
882
- }
883
- return r;
884
- };
885
- setItems((prev) => prev.map(updateSyncedRepo));
886
- setSearchItems((prev) => prev.map(updateSyncedRepo));
887
- } else {
888
- const updateSyncedRepo = (r) => {
889
- if (r.id === syncTarget.id && r.parent && r.defaultBranchRef?.target?.history && r.parent.defaultBranchRef?.target?.history) {
890
- return {
891
- ...r,
892
- defaultBranchRef: {
893
- ...r.defaultBranchRef,
894
- target: {
895
- ...r.defaultBranchRef.target,
896
- history: {
897
- totalCount: r.parent.defaultBranchRef.target.history.totalCount
898
- }
899
- }
875
+ const updatedRepo = {
876
+ ...syncTarget,
877
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
878
+ // If we're tracking fork commits and this is a fork with parent data, set commits to be in sync
879
+ ...forkTracking && syncTarget.isFork && syncTarget.parent && syncTarget.defaultBranchRef?.target?.history && syncTarget.parent.defaultBranchRef?.target?.history ? {
880
+ defaultBranchRef: {
881
+ ...syncTarget.defaultBranchRef,
882
+ target: {
883
+ ...syncTarget.defaultBranchRef.target,
884
+ history: {
885
+ // Set fork's commit count equal to parent's (0 commits behind)
886
+ totalCount: syncTarget.parent.defaultBranchRef.target.history.totalCount
900
887
  }
901
- };
888
+ }
902
889
  }
903
- return r;
904
- };
905
- setItems((prev) => prev.map(updateSyncedRepo));
906
- setSearchItems((prev) => prev.map(updateSyncedRepo));
907
- }
890
+ } : {}
891
+ };
892
+ await updateCacheWithRepository(token, updatedRepo);
893
+ const updateSyncedRepo = (r) => {
894
+ if (r.id === syncTarget.id) {
895
+ return updatedRepo;
896
+ }
897
+ return r;
898
+ };
899
+ setItems((prev) => prev.map(updateSyncedRepo));
900
+ setSearchItems((prev) => prev.map(updateSyncedRepo));
908
901
  closeSyncModal();
909
902
  } catch (e) {
910
903
  setSyncing(false);
@@ -1516,38 +1509,32 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
1516
1509
  const [owner, repo] = syncTarget.nameWithOwner.split("/");
1517
1510
  const branchName = syncTarget.defaultBranchRef?.name || "main";
1518
1511
  const result = await syncForkWithUpstream(token, owner, repo, branchName);
1519
- const updatedRepo = await fetchRepositoryById(client, syncTarget.id, forkTracking);
1520
- if (updatedRepo) {
1521
- await updateCacheWithRepository(token, updatedRepo);
1522
- const updateSyncedRepo = (r) => {
1523
- if (r.id === syncTarget.id) {
1524
- return updatedRepo;
1525
- }
1526
- return r;
1527
- };
1528
- setItems((prev) => prev.map(updateSyncedRepo));
1529
- setSearchItems((prev) => prev.map(updateSyncedRepo));
1530
- } else {
1531
- const updateSyncedRepo = (r) => {
1532
- if (r.id === syncTarget.id && r.parent && r.defaultBranchRef?.target?.history && r.parent.defaultBranchRef?.target?.history) {
1533
- return {
1534
- ...r,
1535
- defaultBranchRef: {
1536
- ...r.defaultBranchRef,
1537
- target: {
1538
- ...r.defaultBranchRef.target,
1539
- history: {
1540
- totalCount: r.parent.defaultBranchRef.target.history.totalCount
1541
- }
1542
- }
1512
+ const updatedRepo = {
1513
+ ...syncTarget,
1514
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1515
+ // If we're tracking fork commits and this is a fork with parent data, set commits to be in sync
1516
+ ...forkTracking && syncTarget.isFork && syncTarget.parent && syncTarget.defaultBranchRef?.target?.history && syncTarget.parent.defaultBranchRef?.target?.history ? {
1517
+ defaultBranchRef: {
1518
+ ...syncTarget.defaultBranchRef,
1519
+ target: {
1520
+ ...syncTarget.defaultBranchRef.target,
1521
+ history: {
1522
+ // Set fork's commit count equal to parent's (0 commits behind)
1523
+ totalCount: syncTarget.parent.defaultBranchRef.target.history.totalCount
1543
1524
  }
1544
- };
1525
+ }
1545
1526
  }
1546
- return r;
1547
- };
1548
- setItems((prev) => prev.map(updateSyncedRepo));
1549
- setSearchItems((prev) => prev.map(updateSyncedRepo));
1550
- }
1527
+ } : {}
1528
+ };
1529
+ await updateCacheWithRepository(token, updatedRepo);
1530
+ const updateSyncedRepo = (r) => {
1531
+ if (r.id === syncTarget.id) {
1532
+ return updatedRepo;
1533
+ }
1534
+ return r;
1535
+ };
1536
+ setItems((prev) => prev.map(updateSyncedRepo));
1537
+ setSearchItems((prev) => prev.map(updateSyncedRepo));
1551
1538
  closeSyncModal();
1552
1539
  } catch (e) {
1553
1540
  setSyncing(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gh-manager-cli",
3
- "version": "1.10.2",
3
+ "version": "1.10.3",
4
4
  "private": false,
5
5
  "description": "Interactive CLI to manage your GitHub repos (personal) with Ink",
6
6
  "license": "MIT",