gitxelectron 1.2.8 → 1.3.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/out/main/index.js +260 -65
- package/out/preload/index.js +3 -1
- package/out/renderer/assets/{index-Cn2WMJc6.js → index-BPsK_u-e.js} +273 -119
- package/out/renderer/assets/index-Cl2V4XSJ.css +1365 -0
- package/out/renderer/index.html +2 -2
- package/package.json +1 -1
- package/out/renderer/assets/index-DOm7Sn2B.css +0 -1365
package/out/main/index.js
CHANGED
|
@@ -5,7 +5,6 @@ const fs = require("fs/promises");
|
|
|
5
5
|
const simpleGit = require("simple-git");
|
|
6
6
|
const crypto = require("crypto");
|
|
7
7
|
const child_process = require("child_process");
|
|
8
|
-
const readline = require("readline");
|
|
9
8
|
const generativeAi = require("@google/generative-ai");
|
|
10
9
|
const OpenAI = require("openai");
|
|
11
10
|
const chokidar = require("chokidar");
|
|
@@ -28,7 +27,6 @@ function _interopNamespaceDefault(e) {
|
|
|
28
27
|
}
|
|
29
28
|
const path__namespace = /* @__PURE__ */ _interopNamespaceDefault(path);
|
|
30
29
|
const fs__namespace = /* @__PURE__ */ _interopNamespaceDefault(fs);
|
|
31
|
-
const readline__namespace = /* @__PURE__ */ _interopNamespaceDefault(readline);
|
|
32
30
|
const GITHUB_CLIENT_ID = "Ov23livWfiaPADGiwSXq";
|
|
33
31
|
let accounts = [];
|
|
34
32
|
const activeSessions = /* @__PURE__ */ new Map();
|
|
@@ -867,11 +865,8 @@ async function pushMassiveRepository(sessionId, remote, branch, chunkSize = 5e3,
|
|
|
867
865
|
if (remoteObj && remoteObj.refs.push) {
|
|
868
866
|
authUrl = injectAuthToken(sessionId, remoteObj.refs.push);
|
|
869
867
|
}
|
|
870
|
-
const child = child_process.spawn("git", ["status", "--porcelain"], { cwd: repoPath });
|
|
871
|
-
|
|
872
|
-
input: child.stdout,
|
|
873
|
-
crlfDelay: Infinity
|
|
874
|
-
});
|
|
868
|
+
const child = child_process.spawn("git", ["status", "--porcelain", "-z"], { cwd: repoPath });
|
|
869
|
+
let buffer = "";
|
|
875
870
|
let currentChunk = [];
|
|
876
871
|
let chunkCount = 0;
|
|
877
872
|
let processedFiles = 0;
|
|
@@ -902,10 +897,34 @@ async function pushMassiveRepository(sessionId, remote, branch, chunkSize = 5e3,
|
|
|
902
897
|
eta: etaStr
|
|
903
898
|
});
|
|
904
899
|
}
|
|
900
|
+
const LARGE_FILE_LIMIT = 50 * 1024 * 1024;
|
|
901
|
+
const largeFiles = [];
|
|
902
|
+
await Promise.all(chunk.map(async (file) => {
|
|
903
|
+
try {
|
|
904
|
+
const stats = await fs__namespace.stat(path__namespace.join(repoPath, file));
|
|
905
|
+
if (stats.isFile() && stats.size > LARGE_FILE_LIMIT) {
|
|
906
|
+
largeFiles.push(file);
|
|
907
|
+
}
|
|
908
|
+
} catch (e) {
|
|
909
|
+
}
|
|
910
|
+
}));
|
|
911
|
+
if (largeFiles.length > 0) {
|
|
912
|
+
try {
|
|
913
|
+
await git.raw(["lfs", "install"]);
|
|
914
|
+
for (const file of largeFiles) {
|
|
915
|
+
await git.raw(["lfs", "track", file]);
|
|
916
|
+
}
|
|
917
|
+
if (!chunk.includes(".gitattributes")) {
|
|
918
|
+
chunk.push(".gitattributes");
|
|
919
|
+
}
|
|
920
|
+
} catch (e) {
|
|
921
|
+
console.warn("Git LFS failed:", e);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
905
924
|
const tempFile = path__namespace.join(repoPath, ".git", "massive_chunk.txt");
|
|
906
|
-
await fs__namespace.writeFile(tempFile, chunk.join("\
|
|
925
|
+
await fs__namespace.writeFile(tempFile, chunk.join("\0") + "\0", "utf-8");
|
|
907
926
|
try {
|
|
908
|
-
await git.raw(["-c", "core.safecrlf=false", "add", "--force", "--pathspec-from-file=" + tempFile]);
|
|
927
|
+
await git.raw(["-c", "core.safecrlf=false", "add", "--force", "--pathspec-from-file=" + tempFile, "--pathspec-file-nul"]);
|
|
909
928
|
} catch (e) {
|
|
910
929
|
if (e.message && e.message.includes("fatal:")) {
|
|
911
930
|
throw e;
|
|
@@ -916,41 +935,49 @@ async function pushMassiveRepository(sessionId, remote, branch, chunkSize = 5e3,
|
|
|
916
935
|
} catch (e) {
|
|
917
936
|
}
|
|
918
937
|
}
|
|
919
|
-
try {
|
|
920
|
-
await git.commit(`Auto-sync chunk ${chunkCount} (Massive Push)`);
|
|
921
|
-
} catch (e) {
|
|
922
|
-
}
|
|
923
|
-
try {
|
|
924
|
-
await git.raw(["-c", "credential.helper=", "push", authUrl, branch]);
|
|
925
|
-
} catch (err) {
|
|
926
|
-
if (err.message && (err.message.includes("non-fast-forward") || err.message.includes("fetch first") || err.message.includes("branch is behind"))) {
|
|
927
|
-
await git.pull(authUrl, branch, { "--rebase": null, "--autostash": null });
|
|
928
|
-
await git.raw(["-c", "credential.helper=", "push", authUrl, branch]);
|
|
929
|
-
} else {
|
|
930
|
-
if (err.message && !err.message.includes("nothing to commit")) {
|
|
931
|
-
throw err;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
938
|
};
|
|
936
|
-
for await (const
|
|
937
|
-
|
|
938
|
-
let
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
939
|
+
for await (const chunkData of child.stdout) {
|
|
940
|
+
buffer += chunkData.toString("utf-8");
|
|
941
|
+
let nullIdx;
|
|
942
|
+
while ((nullIdx = buffer.indexOf("\0")) !== -1) {
|
|
943
|
+
const entry = buffer.slice(0, nullIdx);
|
|
944
|
+
buffer = buffer.slice(nullIdx + 1);
|
|
945
|
+
if (entry.length < 3) continue;
|
|
946
|
+
const file = entry.substring(3);
|
|
947
|
+
if (!file) continue;
|
|
948
|
+
currentChunk.push(file);
|
|
949
|
+
if (currentChunk.length >= chunkSize) {
|
|
950
|
+
child.stdout.pause();
|
|
951
|
+
await processChunk(currentChunk);
|
|
952
|
+
currentChunk = [];
|
|
953
|
+
child.stdout.resume();
|
|
954
|
+
}
|
|
949
955
|
}
|
|
950
956
|
}
|
|
951
957
|
if (currentChunk.length > 0) {
|
|
952
958
|
await processChunk(currentChunk);
|
|
953
959
|
}
|
|
960
|
+
if (onProgress) onProgress("Committing all files...");
|
|
961
|
+
try {
|
|
962
|
+
await git.commit(`Auto-sync (Massive Push)`);
|
|
963
|
+
} catch (e) {
|
|
964
|
+
}
|
|
965
|
+
if (onProgress) onProgress("Pushing to remote...");
|
|
966
|
+
const pushArgs = ["-c", "credential.helper=", "-c", "pack.windowMemory=256m", "-c", "pack.packSizeLimit=500m", "-c", "http.postBuffer=524288000", "-c", "lfs.concurrenttransfers=8", "push", "--progress", "--no-verify"];
|
|
967
|
+
try {
|
|
968
|
+
await git.raw([...pushArgs, authUrl, branch]);
|
|
969
|
+
} catch (err) {
|
|
970
|
+
if (err.message && (err.message.includes("non-fast-forward") || err.message.includes("fetch first") || err.message.includes("branch is behind"))) {
|
|
971
|
+
if (onProgress) onProgress("Remote branch is ahead. Pulling changes...");
|
|
972
|
+
await git.pull(authUrl, branch, { "--rebase": null, "--autostash": null });
|
|
973
|
+
if (onProgress) onProgress("Pushing to remote after pull...");
|
|
974
|
+
await git.raw([...pushArgs, authUrl, branch]);
|
|
975
|
+
} else {
|
|
976
|
+
if (err.message && !err.message.includes("nothing to commit")) {
|
|
977
|
+
throw err;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}
|
|
954
981
|
if (onProgress) onProgress("✅ Massive push completed successfully!");
|
|
955
982
|
return true;
|
|
956
983
|
}
|
|
@@ -964,11 +991,12 @@ async function pushToRemote(sessionId, remote, branch) {
|
|
|
964
991
|
GIT_ASKPASS: "echo"
|
|
965
992
|
});
|
|
966
993
|
const doPush = async () => {
|
|
994
|
+
const pushArgs = ["-c", "credential.helper=", "-c", "pack.windowMemory=256m", "-c", "pack.packSizeLimit=500m", "-c", "http.postBuffer=524288000", "-c", "lfs.concurrenttransfers=8", "push", "--progress", "--no-verify"];
|
|
967
995
|
if (remoteObj && remoteObj.refs.push) {
|
|
968
996
|
const authUrl = injectAuthToken(sessionId, remoteObj.refs.push);
|
|
969
|
-
return await tempGit.raw([
|
|
997
|
+
return await tempGit.raw([...pushArgs, authUrl, branch]);
|
|
970
998
|
}
|
|
971
|
-
return await tempGit.raw([
|
|
999
|
+
return await tempGit.raw([...pushArgs, remote, branch]);
|
|
972
1000
|
};
|
|
973
1001
|
try {
|
|
974
1002
|
return await doPush();
|
|
@@ -1377,39 +1405,122 @@ async function cloneRepository(sessionId, remoteUrl, destPath) {
|
|
|
1377
1405
|
await existingGit.raw(["remote", "add", "origin", authUrl]);
|
|
1378
1406
|
}
|
|
1379
1407
|
await existingGit.raw(["-c", "credential.helper=", "fetch", "--progress", "origin"]);
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1408
|
+
await new Promise((resolve) => {
|
|
1409
|
+
const child = child_process.spawn(
|
|
1410
|
+
"git",
|
|
1411
|
+
["-c", "core.longpaths=true", "-c", "filter.lfs.required=false", "-c", "filter.lfs.smudge=", "checkout", "-f"],
|
|
1412
|
+
{
|
|
1413
|
+
cwd: destPath,
|
|
1414
|
+
env: { ...process.env, GIT_LFS_SKIP_SMUDGE: "1" }
|
|
1415
|
+
}
|
|
1416
|
+
);
|
|
1417
|
+
child.on("close", () => resolve());
|
|
1418
|
+
child.on("error", () => resolve());
|
|
1419
|
+
});
|
|
1386
1420
|
return destPath;
|
|
1387
1421
|
} catch (err) {
|
|
1388
1422
|
console.warn("Re-using existing repo failed, falling through to clone attempt:", err);
|
|
1389
1423
|
}
|
|
1390
1424
|
}
|
|
1391
|
-
if (destExists && destIsEmpty) {
|
|
1392
|
-
const emptyDirGit = createSafeGit(destPath, sessionId);
|
|
1393
|
-
await emptyDirGit.raw(["-c", "credential.helper=", "clone", "--progress", authUrl, "."]);
|
|
1394
|
-
try {
|
|
1395
|
-
await createSafeGit(void 0, sessionId).raw(["config", "--global", "--add", "safe.directory", destPath]);
|
|
1396
|
-
} catch (e) {
|
|
1397
|
-
}
|
|
1398
|
-
return destPath;
|
|
1399
|
-
}
|
|
1400
1425
|
if (destExists && !destIsEmpty && !destHasGit) {
|
|
1401
1426
|
throw new Error(
|
|
1402
1427
|
`The folder '${path__namespace.basename(destPath)}' already contains files. Please select an empty folder or a different location to clone.`
|
|
1403
1428
|
);
|
|
1404
1429
|
}
|
|
1405
|
-
const
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1430
|
+
const wc = electron.webContents.fromId(sessionId);
|
|
1431
|
+
const cloneArgs = [
|
|
1432
|
+
"-c",
|
|
1433
|
+
"credential.helper=",
|
|
1434
|
+
"-c",
|
|
1435
|
+
"core.longpaths=true",
|
|
1436
|
+
"-c",
|
|
1437
|
+
"filter.lfs.required=false",
|
|
1438
|
+
"-c",
|
|
1439
|
+
"filter.lfs.smudge=",
|
|
1440
|
+
"-c",
|
|
1441
|
+
"http.postBuffer=524288000",
|
|
1442
|
+
"-c",
|
|
1443
|
+
"core.compression=0",
|
|
1444
|
+
"-c",
|
|
1445
|
+
"pack.windowMemory=256m",
|
|
1446
|
+
"clone",
|
|
1447
|
+
"--progress",
|
|
1448
|
+
authUrl
|
|
1449
|
+
];
|
|
1450
|
+
let cwd;
|
|
1451
|
+
if (destExists && destIsEmpty) {
|
|
1452
|
+
cloneArgs.push(".");
|
|
1453
|
+
cwd = destPath;
|
|
1454
|
+
} else {
|
|
1455
|
+
cloneArgs.push(path__namespace.basename(destPath));
|
|
1456
|
+
cwd = path__namespace.dirname(destPath);
|
|
1412
1457
|
}
|
|
1458
|
+
await new Promise((resolve, reject) => {
|
|
1459
|
+
const child = child_process.spawn("git", cloneArgs, {
|
|
1460
|
+
cwd,
|
|
1461
|
+
env: {
|
|
1462
|
+
...process.env,
|
|
1463
|
+
GIT_LFS_SKIP_SMUDGE: "1",
|
|
1464
|
+
GCM_INTERACTIVE: "false",
|
|
1465
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
1466
|
+
GIT_ASKPASS: "echo"
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
const errorLines = [];
|
|
1470
|
+
child.stderr.on("data", (data) => {
|
|
1471
|
+
const text = data.toString();
|
|
1472
|
+
const match = text.match(
|
|
1473
|
+
/(Receiving objects|Resolving deltas|Counting objects|Compressing objects):\s+(\d+)%/i
|
|
1474
|
+
);
|
|
1475
|
+
if (match && wc) {
|
|
1476
|
+
const stage = match[1];
|
|
1477
|
+
const progress = parseInt(match[2], 10);
|
|
1478
|
+
try {
|
|
1479
|
+
wc.send("git-progress", { method: "clone", stage, progress });
|
|
1480
|
+
} catch {
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
const lines = text.split(/[\r\n]+/).map((l) => l.trim()).filter(Boolean);
|
|
1484
|
+
for (const line of lines) {
|
|
1485
|
+
if (!line.startsWith("Receiving objects:") && !line.startsWith("Resolving deltas:") && !line.startsWith("Counting objects:") && !line.startsWith("Compressing objects:") && !line.startsWith("Cloning into") && !line.startsWith("remote:")) {
|
|
1486
|
+
errorLines.push(line);
|
|
1487
|
+
if (errorLines.length > 10) errorLines.shift();
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
child.on("error", (err) => reject(err));
|
|
1492
|
+
child.on("close", async (code) => {
|
|
1493
|
+
if (code === 0) {
|
|
1494
|
+
try {
|
|
1495
|
+
await createSafeGit(void 0, sessionId).raw([
|
|
1496
|
+
"config",
|
|
1497
|
+
"--global",
|
|
1498
|
+
"--add",
|
|
1499
|
+
"safe.directory",
|
|
1500
|
+
destPath
|
|
1501
|
+
]);
|
|
1502
|
+
} catch {
|
|
1503
|
+
}
|
|
1504
|
+
resolve();
|
|
1505
|
+
} else {
|
|
1506
|
+
const token = getToken(sessionId);
|
|
1507
|
+
let errorMsg = errorLines.join("\n") || `Git clone failed (exit code ${code})`;
|
|
1508
|
+
if (token) {
|
|
1509
|
+
errorMsg = errorMsg.split(token).join("***");
|
|
1510
|
+
}
|
|
1511
|
+
errorMsg = errorMsg.replace(/https:\/\/[^@]+@github\.com/g, "https://github.com");
|
|
1512
|
+
if (errorMsg.includes("terminal prompts disabled") || errorMsg.includes("Authentication failed") || errorMsg.includes("could not read Username")) {
|
|
1513
|
+
reject(
|
|
1514
|
+
new Error(
|
|
1515
|
+
"Authentication failed for GitHub repository. Please verify your account is logged in and has access to this repository."
|
|
1516
|
+
)
|
|
1517
|
+
);
|
|
1518
|
+
} else {
|
|
1519
|
+
reject(new Error(errorMsg));
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
});
|
|
1523
|
+
});
|
|
1413
1524
|
return destPath;
|
|
1414
1525
|
} catch (err) {
|
|
1415
1526
|
const token = getToken(sessionId);
|
|
@@ -1436,6 +1547,75 @@ async function removeGitMetadata(_sessionId, repoPath) {
|
|
|
1436
1547
|
return false;
|
|
1437
1548
|
}
|
|
1438
1549
|
}
|
|
1550
|
+
async function getDirectoryGitInfo(dir) {
|
|
1551
|
+
try {
|
|
1552
|
+
const isRepo = await isGitRepo(dir);
|
|
1553
|
+
if (!isRepo) return { isRepo: false, remotes: [] };
|
|
1554
|
+
const tempGit = createSafeGit(dir);
|
|
1555
|
+
let rootPath = void 0;
|
|
1556
|
+
try {
|
|
1557
|
+
rootPath = (await tempGit.revparse(["--show-toplevel"])).trim();
|
|
1558
|
+
if (rootPath) rootPath = path__namespace.normalize(rootPath);
|
|
1559
|
+
} catch {
|
|
1560
|
+
}
|
|
1561
|
+
const remotes = await tempGit.getRemotes(true);
|
|
1562
|
+
const origin = remotes.find((r) => r.name === "origin") || remotes[0];
|
|
1563
|
+
let repoName = void 0;
|
|
1564
|
+
let remoteUrl = void 0;
|
|
1565
|
+
if (origin && origin.refs && (origin.refs.fetch || origin.refs.push)) {
|
|
1566
|
+
remoteUrl = origin.refs.fetch || origin.refs.push;
|
|
1567
|
+
const match = remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);
|
|
1568
|
+
if (match) {
|
|
1569
|
+
repoName = match[1];
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
return {
|
|
1573
|
+
isRepo: true,
|
|
1574
|
+
rootPath: rootPath || dir,
|
|
1575
|
+
remotes: JSON.parse(JSON.stringify(remotes)),
|
|
1576
|
+
repoName,
|
|
1577
|
+
remoteUrl
|
|
1578
|
+
};
|
|
1579
|
+
} catch {
|
|
1580
|
+
return { isRepo: false, remotes: [] };
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
async function scanForRepoFolder(repoName, candidateBaseDirs) {
|
|
1584
|
+
const cleanName = repoName.toLowerCase().trim();
|
|
1585
|
+
const visited = /* @__PURE__ */ new Set();
|
|
1586
|
+
for (const base of candidateBaseDirs) {
|
|
1587
|
+
if (!base || visited.has(base.toLowerCase())) continue;
|
|
1588
|
+
visited.add(base.toLowerCase());
|
|
1589
|
+
try {
|
|
1590
|
+
const directCandidate = path__namespace.join(base, repoName);
|
|
1591
|
+
try {
|
|
1592
|
+
const stat = await fs__namespace.stat(directCandidate);
|
|
1593
|
+
if (stat.isDirectory()) {
|
|
1594
|
+
const info = await getDirectoryGitInfo(directCandidate);
|
|
1595
|
+
if (info.isRepo) {
|
|
1596
|
+
if (!info.repoName || info.repoName.toLowerCase() === cleanName) {
|
|
1597
|
+
return directCandidate;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
} catch {
|
|
1602
|
+
}
|
|
1603
|
+
const entries = await fs__namespace.readdir(base, { withFileTypes: true }).catch(() => []);
|
|
1604
|
+
for (const entry of entries) {
|
|
1605
|
+
if (!entry.isDirectory()) continue;
|
|
1606
|
+
const childPath = path__namespace.join(base, entry.name);
|
|
1607
|
+
if (entry.name.toLowerCase() === cleanName) {
|
|
1608
|
+
const info = await getDirectoryGitInfo(childPath);
|
|
1609
|
+
if (info.isRepo) {
|
|
1610
|
+
return childPath;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
} catch {
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
return null;
|
|
1618
|
+
}
|
|
1439
1619
|
const SYSTEM_PROMPT = `You are an autonomous Git Healer Agent for the "GitElectron" app.
|
|
1440
1620
|
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.
|
|
1441
1621
|
You will receive the Git Status and the Raw Error Message.
|
|
@@ -2037,11 +2217,15 @@ electron.app.whenReady().then(async () => {
|
|
|
2037
2217
|
electron.ipcMain.handle("get-cli-repo", () => {
|
|
2038
2218
|
return initialRepo;
|
|
2039
2219
|
});
|
|
2040
|
-
electron.ipcMain.handle("select-directory", async (event) => {
|
|
2220
|
+
electron.ipcMain.handle("select-directory", async (event, defaultPath) => {
|
|
2041
2221
|
const sessionId = event.sender.id;
|
|
2042
|
-
const
|
|
2222
|
+
const options = {
|
|
2043
2223
|
properties: ["openDirectory"]
|
|
2044
|
-
}
|
|
2224
|
+
};
|
|
2225
|
+
if (defaultPath) {
|
|
2226
|
+
options.defaultPath = defaultPath;
|
|
2227
|
+
}
|
|
2228
|
+
const result = await electron.dialog.showOpenDialog(options);
|
|
2045
2229
|
if (result.canceled || result.filePaths.length === 0) {
|
|
2046
2230
|
return null;
|
|
2047
2231
|
}
|
|
@@ -2290,6 +2474,17 @@ electron.app.whenReady().then(async () => {
|
|
|
2290
2474
|
return false;
|
|
2291
2475
|
}
|
|
2292
2476
|
});
|
|
2477
|
+
electron.ipcMain.handle("get-directory-git-info", async (_event, dirPath) => {
|
|
2478
|
+
if (!dirPath) return { isRepo: false, remotes: [] };
|
|
2479
|
+
return await getDirectoryGitInfo(dirPath);
|
|
2480
|
+
});
|
|
2481
|
+
electron.ipcMain.handle(
|
|
2482
|
+
"scan-for-repo-folder",
|
|
2483
|
+
async (_event, repoName, candidateDirs) => {
|
|
2484
|
+
if (!repoName || !candidateDirs || !candidateDirs.length) return null;
|
|
2485
|
+
return await scanForRepoFolder(repoName, candidateDirs);
|
|
2486
|
+
}
|
|
2487
|
+
);
|
|
2293
2488
|
electron.ipcMain.handle("upload-files-to-repo", async (event, repoPath) => {
|
|
2294
2489
|
const window = electron.BrowserWindow.fromWebContents(event.sender);
|
|
2295
2490
|
if (!repoPath) throw new Error("No repository path specified");
|
package/out/preload/index.js
CHANGED
|
@@ -10,7 +10,7 @@ const api = {
|
|
|
10
10
|
electron.ipcRenderer.removeAllListeners("git-progress");
|
|
11
11
|
electron.ipcRenderer.on("git-progress", (_event, data) => callback(data));
|
|
12
12
|
},
|
|
13
|
-
selectDirectory: () => electron.ipcRenderer.invoke("select-directory"),
|
|
13
|
+
selectDirectory: (defaultPath) => electron.ipcRenderer.invoke("select-directory", defaultPath),
|
|
14
14
|
setRepoPath: (path) => electron.ipcRenderer.invoke("set-repo-path", path),
|
|
15
15
|
initRepo: (path) => electron.ipcRenderer.invoke("init-repo", path),
|
|
16
16
|
removeGitMetadata: (repoPath) => electron.ipcRenderer.invoke("remove-git-metadata", repoPath),
|
|
@@ -78,6 +78,8 @@ const api = {
|
|
|
78
78
|
getUniversalDiff: (workspacePath, file) => electron.ipcRenderer.invoke("get-universal-diff", workspacePath, file),
|
|
79
79
|
cloneRepository: (remoteUrl, destPath) => electron.ipcRenderer.invoke("clone-repository", remoteUrl, destPath),
|
|
80
80
|
checkPathExists: (targetPath) => electron.ipcRenderer.invoke("check-path-exists", targetPath),
|
|
81
|
+
getDirectoryGitInfo: (dirPath) => electron.ipcRenderer.invoke("get-directory-git-info", dirPath),
|
|
82
|
+
scanForRepoFolder: (repoName, candidateDirs) => electron.ipcRenderer.invoke("scan-for-repo-folder", repoName, candidateDirs),
|
|
81
83
|
uploadFilesToRepo: (repoPath) => electron.ipcRenderer.invoke("upload-files-to-repo", repoPath),
|
|
82
84
|
commitUniversalWorkspace: (workspacePath, msg, branch) => electron.ipcRenderer.invoke("commit-universal-workspace", workspacePath, msg, branch),
|
|
83
85
|
cleanupUniversalWorkspace: (workspacePath) => electron.ipcRenderer.invoke("cleanup-universal-workspace", workspacePath),
|