               (setq success t)))
        (if (not regraft-repos-p)
            (print! (info "Skipping regrafting"))
+         (print! (start "Regrafting %d repos..." (length repos-to-regraft)))
          (and (doom--cli-packages-regraft-repos repos-to-regraft)
               (setq success t)))
        (when success

      (progn (print! (info "No repos to regraft"))
             0)
    (let ((before-size (doom-directory-size (straight--repos-dir))))
      (prog1 (print-group! (delq nil (mapcar #'doom--cli-packages-regraft-repo repos)))
        (let ((after-size (doom-directory-size (straight--repos-dir))))
          (print! (success "Finished regrafting. Size before: %0.1fKB and after: %0.1fKB (%0.1fKB)")
                  before-size after-size
                  (- after-size before-size)))))))

(defun doom--cli-packages-purge-repo (repo)
  (let ((repo-dir (straight--repos-dir repo)))

(defun doom--cli-packages-regraft-repo (repo)
  (let ((default-directory (straight--repos-dir repo)))
    (if (not (file-directory-p ".git"))
        (ignore (print! (warn "\033[Krepos/%s is not a git repo, skipping" repo)))
      (let ((before-size (doom-directory-size default-directory)))
        (straight--call "git" "reset" "--hard")
        (straight--call "git" "clean" "-ffd")
        (if (not (car (straight--call "git" "replace" "--graft" "HEAD")))
            (print! (info "\033[Krepos/%s is already compact\033[1A" repo))
          (straight--call "git" "gc")
          (print! (success "\033[KRegrafted repos/%s (from %0.1fKB to %0.1fKB)")
                  repo before-size (doom-directory-size default-directory))
          (print-group! (print! "%s" (straight--process-get-output)))))
      t)))
