gh-manager-cli 1.10.1 → 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,17 @@
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
+
8
+ ## [1.10.2](https://github.com/wiiiimm/gh-manager-cli/compare/v1.10.1...v1.10.2) (2025-09-01)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * handle GitHub API 422 status for sync-upstream as potential success ([9a13e8a](https://github.com/wiiiimm/gh-manager-cli/commit/9a13e8a76d4ed09eb7af18b5b8de9e0f2d4c978f))
14
+
1
15
  ## [1.10.1](https://github.com/wiiiimm/gh-manager-cli/compare/v1.10.0...v1.10.1) (2025-09-01)
2
16
 
3
17
 
@@ -668,6 +668,19 @@ async function syncForkWithUpstream(token, owner, repo, branch = "main") {
668
668
  const body = await res.json();
669
669
  return body;
670
670
  }
671
+ if (res.status === 422) {
672
+ try {
673
+ const body = await res.json();
674
+ if (body && body.message && body.message.includes("There was a problem updating the branch")) {
675
+ return {
676
+ message: "Sync completed (with warnings)",
677
+ merge_type: "merge",
678
+ base_branch: branch
679
+ };
680
+ }
681
+ } catch {
682
+ }
683
+ }
671
684
  let msg = `Fork sync failed (status ${res.status})`;
672
685
  try {
673
686
  const body = await res.json();
@@ -17,7 +17,7 @@ import {
17
17
  updateCacheAfterArchive,
18
18
  updateCacheAfterDelete,
19
19
  updateCacheWithRepository
20
- } from "./chunk-X5PZ5T27.js";
20
+ } from "./chunk-KOZ6QCTU.js";
21
21
  export {
22
22
  archiveRepositoryById,
23
23
  deleteRepositoryRest,
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,
@@ -17,14 +16,14 @@ import {
17
16
  updateCacheAfterArchive,
18
17
  updateCacheAfterDelete,
19
18
  updateCacheWithRepository
20
- } from "./chunk-X5PZ5T27.js";
19
+ } from "./chunk-KOZ6QCTU.js";
21
20
 
22
21
  // package.json
23
22
  var require_package = __commonJS({
24
23
  "package.json"(exports, module) {
25
24
  module.exports = {
26
25
  name: "gh-manager-cli",
27
- version: "1.10.1",
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",
@@ -280,7 +279,7 @@ function OrgSwitcher({ token, currentContext, onSelect, onClose }) {
280
279
  const loadOrgs = async () => {
281
280
  try {
282
281
  setLoading(true);
283
- const client = await import("./github-OM6QOCRV.js").then((m) => m.makeClient(token));
282
+ const client = await import("./github-HC6GZCKR.js").then((m) => m.makeClient(token));
284
283
  const orgs = await fetchViewerOrganizations(client);
285
284
  setOrganizations(orgs);
286
285
  if (!isPersonalContext) {
@@ -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.1",
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",