gitxelectron 1.3.3 → 1.3.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/out/main/index.js CHANGED
@@ -1038,6 +1038,14 @@ async function pullFromRemote(sessionId, remote, branch) {
1038
1038
  if (!targetBranch) {
1039
1039
  const status = await git.status();
1040
1040
  targetBranch = status.current || "main";
1041
+ if (targetBranch.includes("(no") || targetBranch === "HEAD") {
1042
+ try {
1043
+ const remoteHead = await git.raw(["rev-parse", "--abbrev-ref", `${targetRemote}/HEAD`]);
1044
+ targetBranch = remoteHead.trim().replace(`${targetRemote}/`, "");
1045
+ } catch {
1046
+ targetBranch = "main";
1047
+ }
1048
+ }
1041
1049
  }
1042
1050
  const authUrl = remoteObj.refs?.fetch ? injectAuthToken(sessionId, remoteObj.refs.fetch) : targetRemote;
1043
1051
  let didStash = false;
@@ -1244,7 +1252,25 @@ async function getBranches(sessionId) {
1244
1252
  }
1245
1253
  async function checkoutBranch(sessionId, branch) {
1246
1254
  const { git } = getGitSession(sessionId);
1247
- return await git.checkout(branch);
1255
+ let didStash = false;
1256
+ try {
1257
+ const status = await git.status();
1258
+ if (!status.isClean()) {
1259
+ await git.raw(["stash", "push", "-u", "-m", "gitquickpush-autostash-before-checkout"]);
1260
+ didStash = true;
1261
+ }
1262
+ } catch (err) {
1263
+ console.warn("Stash check before checkout warning:", err);
1264
+ }
1265
+ const res = await git.checkout(branch);
1266
+ if (didStash) {
1267
+ try {
1268
+ await git.raw(["stash", "pop"]);
1269
+ } catch (popErr) {
1270
+ console.warn("Auto-stash pop after checkout had merge notice:", popErr?.message);
1271
+ }
1272
+ }
1273
+ return res;
1248
1274
  }
1249
1275
  async function createBranch(sessionId, branch, baseBranch) {
1250
1276
  const { git } = getGitSession(sessionId);
@@ -1779,6 +1805,20 @@ async function removeGitLock(sessionId) {
1779
1805
  return false;
1780
1806
  }
1781
1807
  }
1808
+ async function masterPush(sessionId, remote, branch) {
1809
+ const { git } = getGitSession(sessionId);
1810
+ const remotes = await getRemotes(sessionId);
1811
+ const remoteObj = (remote ? remotes.find((r) => r.name === remote) : null) || remotes[0];
1812
+ if (!remoteObj) throw new Error("No remote repository configured.");
1813
+ const targetRemote = remoteObj.name;
1814
+ const authUrl = remoteObj.refs?.push ? injectAuthToken(sessionId, remoteObj.refs.push) : targetRemote;
1815
+ await git.add(".");
1816
+ try {
1817
+ await git.commit("Master Override Push", ["--no-verify"]);
1818
+ } catch (e) {
1819
+ }
1820
+ return await git.push(authUrl, branch, ["--force"]);
1821
+ }
1782
1822
  const SYSTEM_PROMPT = `You are an autonomous Git Healer Agent for the "GitElectron" app.
1783
1823
  The user has encountered a Git error during a push, pull, or merge operation and you are executing as a background process to silently fix it.
1784
1824
  You will receive the Git Status and the Raw Error Message.
@@ -2482,6 +2522,9 @@ electron.app.whenReady().then(async () => {
2482
2522
  electron.ipcMain.handle("check-remote-updates", async (event) => {
2483
2523
  return await checkRemoteUpdates(event.sender.id);
2484
2524
  });
2525
+ electron.ipcMain.handle("master-push", async (event, remote, branch) => {
2526
+ return await masterPush(event.sender.id, remote, branch);
2527
+ });
2485
2528
  electron.ipcMain.handle("reset-to-remote", async (event, remote, branch) => {
2486
2529
  return await resetToRemote(event.sender.id, remote, branch);
2487
2530
  });
@@ -20,6 +20,7 @@ const api = {
20
20
  unstageFiles: (files) => electron.ipcRenderer.invoke("unstage-files", files),
21
21
  commitChanges: (message) => electron.ipcRenderer.invoke("commit-changes", message),
22
22
  pushToRemote: (remote, branch) => electron.ipcRenderer.invoke("push-to-remote", remote, branch),
23
+ masterPush: (remote, branch) => electron.ipcRenderer.invoke("master-push", remote, branch),
23
24
  pullFromRemote: (remote, branch) => electron.ipcRenderer.invoke("pull-from-remote", remote, branch),
24
25
  checkRemoteUpdates: () => electron.ipcRenderer.invoke("check-remote-updates"),
25
26
  resetToRemote: (remote, branch) => electron.ipcRenderer.invoke("reset-to-remote", remote, branch),
@@ -26710,6 +26710,41 @@ Are you SURE you want to link "${repoName}" to this folder?`
26710
26710
  )
26711
26711
  ] })
26712
26712
  ] }) }),
26713
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-border/50 pt-3 mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
26714
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
26715
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs font-bold text-danger", children: "Emergency Override (Master Push)" }),
26716
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-secondary/60 mt-0.5 leading-tight", children: "Bypass all protections, ignore unpushed changes or missing files, and FORCE push all current files. Warning: This overwrites remote history." })
26717
+ ] }),
26718
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
26719
+ "button",
26720
+ {
26721
+ type: "button",
26722
+ onClick: async () => {
26723
+ const confirmAction = window.confirm("Are you sure? This will force push all current files, overriding remote history and bypassing all safety checks.");
26724
+ if (!confirmAction) return;
26725
+ try {
26726
+ const remotes = await window.api.getRemotes();
26727
+ if (!remotes || remotes.length === 0) {
26728
+ showToast("No remote configured to push to.", "error");
26729
+ return;
26730
+ }
26731
+ showToast("Executing Master Push override...", "info");
26732
+ await window.api.masterPush(remotes[0].name, status?.current || "main");
26733
+ showToast("Master Push successful!", "success");
26734
+ refreshRepoState();
26735
+ setShowSettings(false);
26736
+ } catch (err) {
26737
+ showToast("Master Push failed: " + (err.message || "Unknown error"), "error");
26738
+ }
26739
+ },
26740
+ className: "w-full mt-1 px-3 py-2 bg-danger/10 text-danger border border-danger/30 text-xs font-bold rounded-lg hover:bg-danger/20 hover:border-danger/50 transition-all text-center flex items-center justify-center gap-2",
26741
+ children: [
26742
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "🚀" }),
26743
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Execute Master Push (Force)" })
26744
+ ]
26745
+ }
26746
+ )
26747
+ ] }) }),
26713
26748
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-t border-border/50 pt-4 mt-2", children: [
26714
26749
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
26715
26750
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
@@ -27991,7 +28026,7 @@ Are you SURE you want to link "${repoName}" to this folder?`
27991
28026
  ...branches?.all && branches.all.length > 0 ? branches.all.map((b) => ({ value: b, label: b })) : [{ value: "main", label: "main (new)" }]
27992
28027
  ],
27993
28028
  value: status?.current || "",
27994
- onChange: (val) => window.api.checkoutBranch(val).then(refreshRepoState),
28029
+ onChange: (val) => window.api.checkoutBranch(val).then(refreshRepoState).catch((err) => showToast("Could not switch branch: " + (err.message || "Unknown error"), "error")),
27995
28030
  buttonClassName: "appearance-none bg-surface border border-border rounded-md px-3 py-1.5 text-sm font-medium focus:outline-none focus:border-accent hover:border-secondary transition-colors"
27996
28031
  }
27997
28032
  ) }),
@@ -21,7 +21,7 @@
21
21
  href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"
22
22
  rel="stylesheet"
23
23
  />
24
- <script type="module" crossorigin src="./assets/index-EakO-hPk.js"></script>
24
+ <script type="module" crossorigin src="./assets/index-DBSFqXQe.js"></script>
25
25
  <link rel="stylesheet" crossorigin href="./assets/index-DnYiBoot.css">
26
26
  </head>
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitxelectron",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "An elegant, completely silent auto-syncing Git client. Works as a desktop app and npm CLI tool.",
5
5
  "main": "./out/main/index.js",
6
6
  "files": [