Repository navigation
feat: add --skip-brew-update flag to update command - #15
Conversation
Add a boolean --skip-brew-update flag to wt update. When set, it skips only the internal 'brew update' tap-metadata refresh; the 'brew info' version check, the up-to-date short-circuit, and the interactive 'brew upgrade' all run exactly as before. When the flag is absent (the default) behavior is preserved byte-for-byte, so existing callers are unaffected. This removes the redundant network-bound metadata refresh from automation, CI, and rapid local-iteration flows where the caller has already refreshed tap metadata or wants to upgrade against already-fetched data. The flag name and semantics conform to a cross-toolkit contract shared across six tools. - update.Run gains a leading skipBrewUpdate bool parameter; the 'brew update' block is gated behind 'if !skipBrewUpdate' and nothing else moves. brew-not-found detection still works: with the update call skipped, the subsequent 'brew info' call surfaces the same ErrBrewNotFound via identical errors.Is handling. - cmd/wt/update.go registers the cobra BoolVar flag (long-form only) and threads its value into update.Run. - Adds a unit test driving Run with a fake 'brew' on PATH that logs which subcommands ran, asserting --skip-brew-update omits 'brew update' while still running 'brew info' and 'brew upgrade', and that the default still runs 'brew update'.
There was a problem hiding this comment.
Pull request overview
Adds a --skip-brew-update opt-out to wt update, preserving default Homebrew update behavior while allowing callers to skip only the tap metadata refresh.
Changes:
- Threads
skipBrewUpdatethroughinternal/update.Runand gates only thebrew update --quietstep. - Registers the new cobra flag on
wt update. - Adds internal update tests and documents the new command contract in memory/fab docs.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/internal/update/update.go |
Adds skip flag parameter, gates brew update, and adds a test seam for brew-installed detection. |
src/internal/update/update_test.go |
Covers skip/default update behavior with a fake brew. |
src/cmd/wt/update.go |
Registers and passes through --skip-brew-update. |
fab/changes/260531-ipe5-skip-brew-update-flag/spec.md |
Adds the feature specification. |
fab/changes/260531-ipe5-skip-brew-update-flag/plan.md |
Adds implementation and verification plan. |
fab/changes/260531-ipe5-skip-brew-update-flag/intake.md |
Captures the original feature request and assumptions. |
fab/changes/260531-ipe5-skip-brew-update-flag/.status.yaml |
Adds pipeline status metadata. |
fab/changes/260531-ipe5-skip-brew-update-flag/.history.jsonl |
Adds pipeline history metadata. |
docs/memory/wt-cli/update-command-contract.md |
Documents the update command contract and new flag. |
docs/memory/index.md |
Links the new update command contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cmd.Flags().BoolVar(&skipBrewUpdate, "skip-brew-update", false, | ||
| "skip the internal `brew update` tap-metadata refresh (version check and upgrade still run)") |
There was a problem hiding this comment.
Fixed — added two cmd/wt tests: TestUpdate_SkipBrewUpdateFlagInHelp asserts --skip-brew-update appears in wt update --help, and TestUpdate_SkipBrewUpdateFlagAccepted asserts wt update --skip-brew-update is accepted and reaches update.Run. These catch command-level regressions (misspelled flag name/default, value not threaded into Run) that the internal/update.Run tests cannot see. (ed2cf5e)
Add cmd/wt tests that verify the --skip-brew-update flag is registered and wired through cobra end-to-end: one asserting the flag appears in `wt update --help`, and one asserting `wt update --skip-brew-update` is accepted and reaches update.Run. The existing internal/update.Run tests exercise Run directly and cannot catch command-level regressions such as a misspelled flag name or the parsed value not being threaded into Run.
Meta
Pipeline: intake ✓ → spec ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr
Impact: +113/−14 code (excluding
fab/,docs/) · +608/−15 totalSummary
wt updatealways runsbrew updatefirst — a full Homebrew tap-metadata refresh that hits the network and can take many seconds even when only thesahil87/tap/wtformula needs checking. This adds a--skip-brew-updateflag that elides only that metadata refresh, so automation, CI, and rapid local-iteration flows can upgrade against already-fetched tap metadata. The flag name and semantics conform to a cross-toolkit contract shared across six tools; the default (flag absent) preserves today's behavior exactly.Changes
skipBrewUpdate boolthroughupdate.Run— new leading parameter; thebrew updateblock is gated behindif !skipBrewUpdateand nothing else moves. With the update call skipped, the subsequentbrew infocall still surfacesexec.ErrNotFound→ErrBrewNotFoundvia identical handling, so brew-not-found detection is preserved.brew updateblock — thebrew infoversion check, the up-to-date short-circuit, and the interactivebrew upgradeall run exactly as before; output routing (stdout capture for update/info, interactive stdin/stdout/stderr for upgrade) is unchanged.cmd/wt/update.go— registers--skip-brew-update(long-form only, defaultfalse) and threads its value intoupdate.Run.brew update, still runsbrew upgrade— drivesRunwith a fakebrewonPATHthat logs which subcommands ran; asserts--skip-brew-updateomitsbrew updatewhile still runningbrew infoandbrew upgrade, and that the default still runsbrew update. Uses the existing env-var test seam convention (mirroringapps.goWT_TEST_NO_LAUNCH).