Fix _WT_ROOT resolution and make install.sh context setup optional#16
Merged
guodong-sq merged 2 commits intomainfrom Feb 12, 2026
Merged
Fix _WT_ROOT resolution and make install.sh context setup optional#16guodong-sq merged 2 commits intomainfrom
guodong-sq merged 2 commits intomainfrom
Conversation
install.sh now prompts before running the repository context setup and cron job steps, so users can re-install (to sync bin/lib) without being forced through the interactive setup flow again.
In zsh, $0 can return the shell name (e.g. "-zsh") instead of the sourced file path when FUNCTION_ARGZERO is unset. This caused _wt_resolve_root to resolve to whichever directory the shell happened to open in, breaking all wt-* command lookups. Use zsh's %x prompt expansion (via print -P) which reliably returns the current source file path regardless of FUNCTION_ARGZERO. Also add a validation fallback in _wt_resolve_root: if the resolved directory doesn't contain bin/ and lib/, fall back to ~/.wt.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_WT_ROOTresolving to the current working directory instead of the install directory in zsh whenFUNCTION_ARGZEROis unset (where$0returns-zsh). Uses zsh's%xprompt expansion viaprint -Pfor reliable source file detection, and adds a~/.wtvalidation fallback in_wt_resolve_rootTest plan
echo "$_WT_ROOT"shows~/.wt(not~)wt switchand confirm it works (no "command not found" error)install.sh, decline context setup, verify it completes without running the setup flowinstall.sh, accept context setup, verify it works as before