Repository navigation
fix: Conform update, version, and shell-init to the shll toolkit standards - #49
Conversation
Un-deprecate --skip-brew-update, replace brew upgrade/update/info SIGKILL timeouts with SIGTERM+grace (or none), and make shell-init a strict usage-error contract (exit 2, empty stdout, no $SHELL inference).
There was a problem hiding this comment.
Pull request overview
This PR brings wt’s update, --version, and shell-init behaviors (plus their help/docs surfaces) into conformance with the shll toolkit standards, and adds tests that pin those contracts to prevent future regressions.
Changes:
- Restores
--skip-brew-updateas a visible, non-deprecated flag (keeping--no-brew-updateas a visible alias) and updates tests/docs accordingly. - Reworks Homebrew subprocess handling to avoid SIGKILL mid-transaction:
brew upgradebecomes unbounded; bounded brew metadata calls use SIGTERM + grace. - Makes
wt shell-initrequire an explicitzsh|basharg with strict usage-error behavior (exit 2, stderr usage, empty stdout), and updates docs/hints + adds eval-in-subshell tests.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/internal/worktree/apps.go | Updates wrapper hint text to the explicit shell-init <shell> form. |
| src/internal/worktree/apps_test.go | Updates assertion to match the new wrapper hint text. |
| src/internal/update/update.go | Introduces SIGTERM+grace bounded brew helper; removes timeout for brew upgrade. |
| src/internal/update/update_test.go | Adds tests pinning brew bounds and verifying graceful SIGTERM cancellation. |
| src/cmd/wt/version_test.go | Adds a contract test for wt --version first-line output shape. |
| src/cmd/wt/update.go | Makes --skip-brew-update visible/non-deprecated; adds --no-brew-update alias. |
| src/cmd/wt/update_test.go | Updates tests to assert both flags are visible and no deprecation warning is emitted. |
| src/cmd/wt/skill.md | Updates embedded skill bundle to the explicit shell-init <shell> usage. |
| src/cmd/wt/shell_init.go | Enforces explicit `zsh |
| src/cmd/wt/shell_init_test.go | Rewrites tests for strict shell-init contract; adds eval-in-subshell checks. |
| src/cmd/wt/main.go | Updates root help text to show explicit `shell-init zsh |
| src/cmd/wt/go.go | Updates help/hints to reference explicit shell-init <shell> usage. |
| README.md | Updates user-facing docs to require explicit `wt shell-init zsh |
| fab/changes/260719-32su-conform-update-version-shell-init/plan.md | Adds/updates change plan documenting requirements, decisions, and acceptance checks. |
| fab/changes/260719-32su-conform-update-version-shell-init/intake.md | Adds intake/audit record motivating the conformance work. |
| fab/changes/260719-32su-conform-update-version-shell-init/.status.yaml | Records change tracking metadata/status for the fab pipeline. |
| fab/changes/260719-32su-conform-update-version-shell-init/.history.jsonl | Records stage transition history for the fab pipeline. |
| docs/specs/cli-surface.md | Updates CLI spec for update flags and strict shell-init <shell> contract. |
| docs/site/workflows.md | Updates workflows docs for explicit shell-init usage and update-flag surface. |
| docs/site/skill.md | Updates docs skill bundle to match embedded src/cmd/wt/skill.md. |
| docs/site/install.md | Updates install instructions to the explicit `shell-init zsh |
| docs/memory/wt-cli/update-command-contract.md | Updates the update-command contract (flag surface + brew-handling safety). |
| docs/memory/wt-cli/toolkit-standards-conformance.md | Updates standards baseline/verdicts to include update/version/shell-init. |
| docs/memory/wt-cli/shell-init-contract.md | Adds a new memory/contract doc for strict shell-init <shell> behavior. |
| docs/memory/wt-cli/index.md | Adds the new shell-init contract doc to the memory index. |
| docs/memory/wt-cli/go-command-contract.md | Updates shell-wrapper hint reference to explicit shell-init zsh form. |
| docs/memory/wt-cli/flag-naming-conventions.md | Adds carve-out for standard-frozen contract flags (no MarkDeprecated hiding). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func newBoundedBrewCmd(ctx context.Context, args ...string) *exec.Cmd { | ||
| cmd := exec.CommandContext(ctx, "brew", args...) | ||
| cmd.Cancel = func() error { | ||
| return cmd.Process.Signal(syscall.SIGTERM) | ||
| } | ||
| cmd.WaitDelay = brewGraceDelay | ||
| return cmd | ||
| } |
There was a problem hiding this comment.
Skipped — already handled by the Go runtime: os.(*Process).Signal converts ESRCH / already-finished into os.ErrProcessDone, and os/exec's context watchdog explicitly treats an os.ErrProcessDone return from Cancel as a spurious exit race (no error recorded), so it can never override a successful exit or make the test flaky. Cancel is only invoked by the watchdog goroutine started after a successful Start, so cmd.Process is never nil in the hook — this is the canonical Cancel pattern from the os/exec docs.
Meta
32suexcludes
fab/,docs/· generated by fab-kit v2.16.5Pipeline: intake ✓ → apply ✓ → review ✓ → hydrate ✓ → ship → review-pr
Summary
shllcomposes the toolkit —shll updatedelegates towt update,shll version/shll doctorprobewt --version, andshll shell-initcomposeswt shell-init's stdout into anevaled blob. Each shll toolkit standard (update,version,shell-init) freezes a textual/behavioral contract thatwtwas breaking in specific, verified ways: a hidden--skip-brew-updateflag brokeshll update's substring probe, a 120s SIGKILL timeout onbrew upgraderisked keg corruption, andwt shell-initemitted its wrapper with exit 0 even on unsupported/missing shell args instead of failing safely.Changes
wt updateflag surface: restore--skip-brew-updateas a visible, non-deprecated flag (keeping--no-brew-updateas an alias) sowt update --helpcontains the literal substring the standard requires.brew upgradeentirely (plainexec.Command, Ctrl-C available); raisebrew update/brew infobounds and switch their cancellation to SIGTERM + grace instead of SIGKILL.wt shell-initstrict argument contract: missing or unsupported shell argument now exits 2 with a usage message on stderr and empty stdout, instead of warning and still emitting the wrapper with exit 0. Removes$SHELL-inference.--skip-brew-updatehelp substring,--versionoutput shape, and shell-init's exit-2/empty-stdout/eval-in-subshell behavior.eval "$(wt shell-init)"(no-arg) reference toeval "$(wt shell-init zsh)"across README, docs/site, and docs/specs.