From 27fee8217af6473a7274de660521a01f5123e98b Mon Sep 17 00:00:00 2001 From: fullstackjam Date: Tue, 19 May 2026 23:35:45 +0800 Subject: [PATCH] fix(sync): route brew installs through InstallWithProgress MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sync flow (used by `openboot install` when a saved sync source exists) called brew.Install / brew.InstallCask directly, bypassing the StickyProgress + CacheTracker path that the wizard flow uses. The visible symptom: re-running `openboot install` showed brew's raw `Cask X # Downloading 425.8MB/ 2.9GB` output instead of the byte-proportional progress bar — even though curl|bash (first-time install) rendered it fine. Run formulae and casks through brew.InstallWithProgress as a single combined step. Tap and npm steps stay separate. Dry-run counts are preserved (per-category lengths summed on success, 0 on early error). --- internal/sync/plan.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/internal/sync/plan.go b/internal/sync/plan.go index e06d2ff..07df758 100644 --- a/internal/sync/plan.go +++ b/internal/sync/plan.go @@ -96,16 +96,23 @@ func Execute(plan *SyncPlan, dryRun bool) (*SyncResult, error) { executeSyncStep(plan.InstallTaps, "taps", func() error { return brew.InstallTaps(plan.InstallTaps, dryRun) }), - executeSyncStep(plan.InstallFormulae, "formulae", func() error { - return brew.Install(plan.InstallFormulae, dryRun) - }), - executeSyncStep(plan.InstallCasks, "casks", func() error { - return brew.InstallCask(plan.InstallCasks, dryRun) - }), + } + // Run formulae+casks through one shared StickyProgress bar — same flow + // the wizard path uses. Skipping this and calling brew.Install / + // brew.InstallCask separately would lose the byte-level progress bar. + if len(plan.InstallFormulae) > 0 || len(plan.InstallCasks) > 0 { + _, _, err := brew.InstallWithProgress(plan.InstallFormulae, plan.InstallCasks, dryRun) + step := stepResult{label: "brew", err: err} + if err == nil { + step.count = len(plan.InstallFormulae) + len(plan.InstallCasks) + } + installSteps = append(installSteps, step) + } + installSteps = append(installSteps, executeSyncStep(plan.InstallNpm, "npm", func() error { return npm.Install(plan.InstallNpm, dryRun) }), - } + ) for _, s := range installSteps { if s.err != nil { errs = append(errs, fmt.Errorf("install %s: %w", s.label, s.err))