gh-manager-cli 1.10.3 → 1.10.4
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 +7 -0
- package/dist/index.js +49 -81
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.10.4](https://github.com/wiiiimm/gh-manager-cli/compare/v1.10.3...v1.10.4) (2025-09-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* eliminate duplicate sync handler to prevent double execution ([bf838b6](https://github.com/wiiiimm/gh-manager-cli/commit/bf838b66f5c8b7def294d3835278cd32254bce1f))
|
|
7
|
+
|
|
1
8
|
## [1.10.3](https://github.com/wiiiimm/gh-manager-cli/compare/v1.10.2...v1.10.3) (2025-09-01)
|
|
2
9
|
|
|
3
10
|
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var require_package = __commonJS({
|
|
|
23
23
|
"package.json"(exports, module) {
|
|
24
24
|
module.exports = {
|
|
25
25
|
name: "gh-manager-cli",
|
|
26
|
-
version: "1.10.
|
|
26
|
+
version: "1.10.4",
|
|
27
27
|
private: false,
|
|
28
28
|
description: "Interactive CLI to manage your GitHub repos (personal) with Ink",
|
|
29
29
|
license: "MIT",
|
|
@@ -486,6 +486,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
486
486
|
const [syncing, setSyncing] = useState3(false);
|
|
487
487
|
const [syncError, setSyncError] = useState3(null);
|
|
488
488
|
const [syncFocus, setSyncFocus] = useState3("confirm");
|
|
489
|
+
const [syncTrigger, setSyncTrigger] = useState3(false);
|
|
489
490
|
const [infoMode, setInfoMode] = useState3(false);
|
|
490
491
|
const [infoRepo, setInfoRepo] = useState3(null);
|
|
491
492
|
const [logoutMode, setLogoutMode] = useState3(false);
|
|
@@ -504,6 +505,46 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
504
505
|
setSyncing(false);
|
|
505
506
|
setSyncError(null);
|
|
506
507
|
setSyncFocus("confirm");
|
|
508
|
+
setSyncTrigger(false);
|
|
509
|
+
}
|
|
510
|
+
async function executeSync() {
|
|
511
|
+
if (!syncTarget || syncing) return;
|
|
512
|
+
try {
|
|
513
|
+
setSyncing(true);
|
|
514
|
+
const [owner, repo] = syncTarget.nameWithOwner.split("/");
|
|
515
|
+
const branchName = syncTarget.defaultBranchRef?.name || "main";
|
|
516
|
+
const result = await syncForkWithUpstream(token, owner, repo, branchName);
|
|
517
|
+
const updatedRepo = {
|
|
518
|
+
...syncTarget,
|
|
519
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
520
|
+
// If we're tracking fork commits and this is a fork with parent data, set commits to be in sync
|
|
521
|
+
...forkTracking && syncTarget.isFork && syncTarget.parent && syncTarget.defaultBranchRef?.target?.history && syncTarget.parent.defaultBranchRef?.target?.history ? {
|
|
522
|
+
defaultBranchRef: {
|
|
523
|
+
...syncTarget.defaultBranchRef,
|
|
524
|
+
target: {
|
|
525
|
+
...syncTarget.defaultBranchRef.target,
|
|
526
|
+
history: {
|
|
527
|
+
// Set fork's commit count equal to parent's (0 commits behind)
|
|
528
|
+
totalCount: syncTarget.parent.defaultBranchRef.target.history.totalCount
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
} : {}
|
|
533
|
+
};
|
|
534
|
+
await updateCacheWithRepository(token, updatedRepo);
|
|
535
|
+
const updateSyncedRepo = (r) => {
|
|
536
|
+
if (r.id === syncTarget.id) {
|
|
537
|
+
return updatedRepo;
|
|
538
|
+
}
|
|
539
|
+
return r;
|
|
540
|
+
};
|
|
541
|
+
setItems((prev) => prev.map(updateSyncedRepo));
|
|
542
|
+
setSearchItems((prev) => prev.map(updateSyncedRepo));
|
|
543
|
+
closeSyncModal();
|
|
544
|
+
} catch (e) {
|
|
545
|
+
setSyncing(false);
|
|
546
|
+
setSyncError(e.message || "Failed to sync fork. Check permissions and network.");
|
|
547
|
+
}
|
|
507
548
|
}
|
|
508
549
|
function handleOrgContextChange(newContext) {
|
|
509
550
|
setOwnerContext(newContext);
|
|
@@ -860,53 +901,17 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
860
901
|
setSyncFocus("cancel");
|
|
861
902
|
return;
|
|
862
903
|
}
|
|
863
|
-
if (
|
|
904
|
+
if (input && input.toUpperCase() === "Y") {
|
|
864
905
|
if (syncFocus === "cancel") {
|
|
865
906
|
closeSyncModal();
|
|
866
|
-
|
|
907
|
+
} else {
|
|
908
|
+
executeSync();
|
|
867
909
|
}
|
|
868
|
-
if (!syncTarget) return;
|
|
869
|
-
(async () => {
|
|
870
|
-
try {
|
|
871
|
-
setSyncing(true);
|
|
872
|
-
const [owner, repo] = syncTarget.nameWithOwner.split("/");
|
|
873
|
-
const branchName = syncTarget.defaultBranchRef?.name || "main";
|
|
874
|
-
const result = await syncForkWithUpstream(token, owner, repo, branchName);
|
|
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
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
}
|
|
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));
|
|
901
|
-
closeSyncModal();
|
|
902
|
-
} catch (e) {
|
|
903
|
-
setSyncing(false);
|
|
904
|
-
setSyncError(e.message || "Failed to sync fork. Check permissions and network.");
|
|
905
|
-
}
|
|
906
|
-
})();
|
|
907
910
|
return;
|
|
908
911
|
}
|
|
909
|
-
return
|
|
912
|
+
if (!key.return) {
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
910
915
|
}
|
|
911
916
|
if (logoutMode) {
|
|
912
917
|
if (key.escape || input && input.toUpperCase() === "C") {
|
|
@@ -1503,44 +1508,7 @@ function RepoList({ token, maxVisibleRows, onLogout, viewerLogin, onOrgContextCh
|
|
|
1503
1508
|
},
|
|
1504
1509
|
onSubmit: () => {
|
|
1505
1510
|
if (syncFocus === "confirm") {
|
|
1506
|
-
(
|
|
1507
|
-
try {
|
|
1508
|
-
setSyncing(true);
|
|
1509
|
-
const [owner, repo] = syncTarget.nameWithOwner.split("/");
|
|
1510
|
-
const branchName = syncTarget.defaultBranchRef?.name || "main";
|
|
1511
|
-
const result = await syncForkWithUpstream(token, owner, repo, branchName);
|
|
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
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
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));
|
|
1538
|
-
closeSyncModal();
|
|
1539
|
-
} catch (e) {
|
|
1540
|
-
setSyncing(false);
|
|
1541
|
-
setSyncError(e.message || "Failed to sync fork. Check permissions and network.");
|
|
1542
|
-
}
|
|
1543
|
-
})();
|
|
1511
|
+
executeSync();
|
|
1544
1512
|
} else {
|
|
1545
1513
|
closeSyncModal();
|
|
1546
1514
|
}
|