Enhance autoCommit function with rewrite buffer and progress tracking
This commit is contained in:
18
main.js
18
main.js
@@ -1421,6 +1421,8 @@ async function autoCommit(folderPath, message, win) {
|
|||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
folders[idx].linesChanged = (folders[idx].linesChanged || 0) + changedLines;
|
folders[idx].linesChanged = (folders[idx].linesChanged || 0) + changedLines;
|
||||||
folders[idx].llmCandidates = folders[idx].llmCandidates || [];
|
folders[idx].llmCandidates = folders[idx].llmCandidates || [];
|
||||||
|
folders[idx].llmBuffer = folders[idx].llmBuffer || [];
|
||||||
|
folders[idx].rewriteInProgress = folders[idx].rewriteInProgress || false;
|
||||||
|
|
||||||
// ===> WICHTIG: Wir commiten ja jetzt, daher merken wir uns gleich die neue Commit-Hash
|
// ===> WICHTIG: Wir commiten ja jetzt, daher merken wir uns gleich die neue Commit-Hash
|
||||||
// Vor git.commit: Merke alten HEAD
|
// Vor git.commit: Merke alten HEAD
|
||||||
@@ -1440,18 +1442,22 @@ async function autoCommit(folderPath, message, win) {
|
|||||||
|
|
||||||
// Nach Commit: neuen HEAD ermitteln und in llmCandidates speichern
|
// Nach Commit: neuen HEAD ermitteln und in llmCandidates speichern
|
||||||
const newHead = (await git.revparse(['HEAD'])).trim();
|
const newHead = (await git.revparse(['HEAD'])).trim();
|
||||||
folders[idx].llmCandidates = folders[idx].llmCandidates || [];
|
if (folders[idx].rewriteInProgress) {
|
||||||
folders[idx].llmCandidates.push(newHead);
|
// Buffer commits while a rewrite is running to avoid losing them to rebase hash changes.
|
||||||
if(folders[idx].llmCandidates.length == 1){
|
folders[idx].llmBuffer.push(newHead);
|
||||||
folders[idx].firstCandidateBirthday = Date.now();
|
} else {
|
||||||
debug('[autoCommit] Erster Commit aufgenommen.');
|
folders[idx].llmCandidates.push(newHead);
|
||||||
|
if(folders[idx].llmCandidates.length == 1){
|
||||||
|
folders[idx].firstCandidateBirthday = Date.now();
|
||||||
|
debug('[autoCommit] Erster Commit aufgenommen.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
folders[idx].lastHeadHash = newHead;
|
folders[idx].lastHeadHash = newHead;
|
||||||
console.log(folders[idx].llmCandidates)
|
console.log(folders[idx].llmCandidates)
|
||||||
|
|
||||||
// Threshold holen
|
// Threshold holen
|
||||||
const threshold = store.get('intelligentCommitThreshold') || 10;
|
const threshold = store.get('intelligentCommitThreshold') || 10;
|
||||||
if (folders[idx].linesChanged >= threshold) {
|
if (!folders[idx].rewriteInProgress && folders[idx].linesChanged >= threshold) {
|
||||||
debug('Congratulations! You changed enough lines of code :)');
|
debug('Congratulations! You changed enough lines of code :)');
|
||||||
await runLLMCommitRewrite(folders[idx], win);
|
await runLLMCommitRewrite(folders[idx], win);
|
||||||
//folders[idx].linesChanged = 0; // !!!!!!!!!!!!!!!!!!!! needs logic to handle several llm runs called at the same time test
|
//folders[idx].linesChanged = 0; // !!!!!!!!!!!!!!!!!!!! needs logic to handle several llm runs called at the same time test
|
||||||
|
|||||||
Reference in New Issue
Block a user