@nbardy/oompa 0.5.0 → 0.5.1
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.
|
@@ -308,13 +308,19 @@
|
|
|
308
308
|
{:output (:out result)
|
|
309
309
|
:exit (:exit result)}))
|
|
310
310
|
|
|
311
|
+
(defn- worktree-has-changes?
|
|
312
|
+
"Check if worktree has any uncommitted changes (new/modified/deleted files)."
|
|
313
|
+
[wt-path]
|
|
314
|
+
(let [result (process/sh ["git" "status" "--porcelain"] {:dir wt-path :out :string :err :string})]
|
|
315
|
+
(not (str/blank? (:out result)))))
|
|
316
|
+
|
|
311
317
|
(defn- merge-to-main!
|
|
312
318
|
"Merge worktree changes to main branch"
|
|
313
319
|
[wt-path wt-id worker-id project-root]
|
|
314
320
|
(println (format "[%s] Merging changes to main" worker-id))
|
|
315
321
|
(let [;; Commit in worktree if needed
|
|
316
322
|
_ (process/sh ["git" "add" "-A"] {:dir wt-path})
|
|
317
|
-
_ (process/sh ["git" "commit" "-m" (str "Work from " wt-id)
|
|
323
|
+
_ (process/sh ["git" "commit" "-m" (str "Work from " wt-id)]
|
|
318
324
|
{:dir wt-path})
|
|
319
325
|
;; Checkout main and merge (in project root, not worktree)
|
|
320
326
|
checkout-result (process/sh ["git" "checkout" "main"]
|
|
@@ -417,7 +423,13 @@
|
|
|
417
423
|
(println (format "[%s] Agent error (exit %d): %s" worker-id exit (subs (or output "") 0 (min 200 (count (or output ""))))))
|
|
418
424
|
{:status :error :exit exit})
|
|
419
425
|
|
|
420
|
-
;;
|
|
426
|
+
;; Agent produced no file changes — wasted iteration
|
|
427
|
+
(not (worktree-has-changes? wt-path))
|
|
428
|
+
(do
|
|
429
|
+
(println (format "[%s] No changes produced, skipping review" worker-id))
|
|
430
|
+
{:status :no-changes})
|
|
431
|
+
|
|
432
|
+
;; Success with changes - run review loop before merge
|
|
421
433
|
:else
|
|
422
434
|
(let [{:keys [approved?]} (review-loop! worker wt-path worker-id)]
|
|
423
435
|
(if approved?
|
|
@@ -503,6 +515,9 @@
|
|
|
503
515
|
id iter iterations errors max-consecutive-errors))
|
|
504
516
|
(recur (inc iter) completed errors))))
|
|
505
517
|
|
|
518
|
+
:no-changes
|
|
519
|
+
(recur (inc iter) completed consec-errors)
|
|
520
|
+
|
|
506
521
|
:continue
|
|
507
522
|
(recur (inc iter) (inc completed) 0)))))))
|
|
508
523
|
|