gitxelectron 1.3.4 → 1.3.5

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
@@ -1920,8 +1920,40 @@ ${errorMsg}
1920
1920
  lastError = e;
1921
1921
  }
1922
1922
  }
1923
+ console.warn("[AI Service] Falling back to local heuristic analysis...");
1924
+ const lowerError = errorMsg.toLowerCase();
1925
+ if (lowerError.includes("fetch first") || lowerError.includes("non-fast-forward") || lowerError.includes("updates were rejected") || lowerError.includes("remote contains work")) {
1926
+ return {
1927
+ explanation: "Diverged branch detected. Pulling remote changes to reconcile...",
1928
+ commandsToRun: ["git pull --no-edit"]
1929
+ };
1930
+ }
1931
+ if (lowerError.includes("merge conflict") || lowerError.includes("conflict") || lowerError.includes("automatic merge failed")) {
1932
+ return {
1933
+ explanation: "Merge conflict detected. Forcing resolution by keeping local changes...",
1934
+ commandsToRun: ["git merge --abort", "git pull -X ours --no-edit", "git add .", 'git commit -m "Auto-resolve merge conflict"']
1935
+ };
1936
+ }
1937
+ if (lowerError.includes("unmerged files") || lowerError.includes("you have unmerged paths")) {
1938
+ return {
1939
+ explanation: "Unmerged paths detected. Committing current state to proceed...",
1940
+ commandsToRun: ["git add .", 'git commit -m "Auto-resolve unmerged paths"']
1941
+ };
1942
+ }
1943
+ if (lowerError.includes("please tell me who you are")) {
1944
+ return {
1945
+ explanation: "Git identity not set. Setting temporary identity...",
1946
+ commandsToRun: ['git config user.email "gitelectron@example.com"', 'git config user.name "Git Electron"']
1947
+ };
1948
+ }
1949
+ if (lowerError.includes("would be overwritten by merge") || lowerError.includes("local changes to the following files would be overwritten")) {
1950
+ return {
1951
+ explanation: "Local changes would be overwritten. Stashing, pulling, and popping...",
1952
+ commandsToRun: ["git stash", "git pull --no-edit", "git stash pop", "git add .", 'git commit -m "Auto-resolved stashed changes"']
1953
+ };
1954
+ }
1923
1955
  throw new Error(
1924
- `AI Analysis failed after trying all provided keys. Last error: ${lastError?.message}`
1956
+ `AI Analysis failed after trying all provided keys and no local heuristics matched. Last error: ${lastError?.message || "Unknown"}`
1925
1957
  );
1926
1958
  }
1927
1959
  const AUTO_SYNC_SYSTEM_PROMPT = `You are an autonomous Git Healer Agent for the "GitQuickPush" app.