auto-git:
[change] main.js
This commit is contained in:
33
main.js
33
main.js
@@ -663,6 +663,39 @@ async function main() {
|
||||
|
||||
const tray = createTray(win);
|
||||
|
||||
|
||||
// (1) Die Kernfunktion
|
||||
async function addFolderByPath(newFolder) {
|
||||
await initGitRepo(newFolder);
|
||||
let folders = store.get('folders') || [];
|
||||
let folderObj = folders.find(f => f.path === newFolder);
|
||||
if (!folderObj) {
|
||||
folderObj = { path: newFolder, monitoring: true, linesChanged: 0, llmCandidates: [] };
|
||||
folders.push(folderObj);
|
||||
store.set('folders', folders);
|
||||
}
|
||||
store.set('selected', newFolder);
|
||||
watchRepo(newFolder, win);
|
||||
startMonitoringWatcher(newFolder, win);
|
||||
return store.get('folders');
|
||||
}
|
||||
|
||||
// (2) Die IPC-Handler anpassen:
|
||||
ipcMain.handle('add-folder', async () => {
|
||||
const { canceled, filePaths } = await dialog.showOpenDialog({
|
||||
properties: ['openDirectory']
|
||||
});
|
||||
if (canceled || !filePaths[0]) {
|
||||
return store.get('folders');
|
||||
}
|
||||
return await addFolderByPath(filePaths[0]);
|
||||
});
|
||||
|
||||
ipcMain.handle('add-folder-by-path', async (_e, folderPath) => {
|
||||
return await addFolderByPath(folderPath);
|
||||
});
|
||||
|
||||
|
||||
// --- Context Menu bauen ---
|
||||
function buildTrayMenu() {
|
||||
const folders = store.get('folders') || [];
|
||||
|
||||
Reference in New Issue
Block a user