Skip to content

feat: add --skip-brew-update flag to update command - #15

Merged
sahil-noon merged 3 commits into
mainfrom
260531-ipe5-skip-brew-update-flag
May 31, 2026
Merged

sahil-noon merged 3 commits into
mainfrom
260531-ipe5-skip-brew-update-flag

Conversation

@sahil87

@sahil87 sahil87 commented May 31, 2026

Copy link
Copy Markdown
Owner

Meta

ID Type Confidence Plan Review
ipe5 feat 4.1/5.0 7/7 tasks, 0/12 acceptance ✓ 1 cycle

Pipeline: intake ✓ → spec ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr

Impact: +113/−14 code (excluding fab/, docs/) · +608/−15 total

Summary

wt update always runs brew update first — a full Homebrew tap-metadata refresh that hits the network and can take many seconds even when only the sahil87/tap/wt formula needs checking. This adds a --skip-brew-update flag 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

  • Thread skipBrewUpdate bool through update.Run — new leading parameter; the brew update block is gated behind if !skipBrewUpdate and nothing else moves. With the update call skipped, the subsequent brew info call still surfaces exec.ErrNotFound → ErrBrewNotFound via identical handling, so brew-not-found detection is preserved.
  • Gate ONLY the brew update block — the brew info version check, the up-to-date short-circuit, and the interactive brew upgrade all run exactly as before; output routing (stdout capture for update/info, interactive stdin/stdout/stderr for upgrade) is unchanged.
  • Wire the cobra bool flag in cmd/wt/update.go — registers --skip-brew-update (long-form only, default false) and threads its value into update.Run.
  • Test: flag omits brew update, still runs brew upgrade — drives Run with a fake brew on PATH that logs which subcommands ran; asserts --skip-brew-update omits brew update while still running brew info and brew upgrade, and that the default still runs brew update. Uses the existing env-var test seam convention (mirroring apps.go WT_TEST_NO_LAUNCH).

sahil87 added 2 commits May 31, 2026 11:04
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'.
@sahil87
sahil87 marked this pull request as ready for review May 31, 2026 05:35
@sahil-noon
sahil-noon requested a review from Copilot May 31, 2026 06:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 skipBrewUpdate through internal/update.Run and gates only the brew update --quiet step.
  • 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.

Comment thread src/cmd/wt/update.go
Comment on lines +33 to +34
cmd.Flags().BoolVar(&skipBrewUpdate, "skip-brew-update", false,
"skip the internal `brew update` tap-metadata refresh (version check and upgrade still run)")

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@sahil-noon
sahil-noon merged commit a012b03 into main May 31, 2026
1 check passed
@sahil-noon
sahil-noon deleted the 260531-ipe5-skip-brew-update-flag branch May 31, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants