Skip to content

Fix _WT_ROOT resolution and make install.sh context setup optional#16

Merged
guodong-sq merged 2 commits intomainfrom
fix/install-and-script-path
Feb 12, 2026
Merged

Fix _WT_ROOT resolution and make install.sh context setup optional#16
guodong-sq merged 2 commits intomainfrom
fix/install-and-script-path

Conversation

@guodong-sq
Copy link
Copy Markdown
Collaborator

@guodong-sq guodong-sq commented Feb 12, 2026

Summary

  • install.sh: Prompt before running the repository context setup and cron job steps, so users can re-install to sync bin/lib without repeating the interactive setup flow
  • wt.sh: Fix _WT_ROOT resolving to the current working directory instead of the install directory in zsh when FUNCTION_ARGZERO is unset (where $0 returns -zsh). Uses zsh's %x prompt expansion via print -P for reliable source file detection, and adds a ~/.wt validation fallback in _wt_resolve_root

Test plan

  • Open a new iTerm tab from home directory, verify echo "$_WT_ROOT" shows ~/.wt (not ~)
  • Run wt switch and confirm it works (no "command not found" error)
  • Run install.sh, decline context setup, verify it completes without running the setup flow
  • Run install.sh, accept context setup, verify it works as before
  • All 167 existing BATS tests pass

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.
@guodong-sq guodong-sq merged commit 5949654 into main Feb 12, 2026
4 checks passed
@guodong-sq guodong-sq deleted the fix/install-and-script-path branch March 10, 2026 06:24
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.

1 participant