Refactor config loading to use runtime parsing#10
Merged
guodong-sq merged 3 commits intomainfrom Feb 9, 2026
Merged
Conversation
This eliminates the need to reload the shell after context switching. Previously, `wt context` required re-sourcing wt-common to pick up new context variables. Now configuration is parsed at runtime from ~/.wt/current, allowing immediate effect. Changes: - Add wt_read_config() that parses config files without sourcing - Update ~/.wt/current format to include full config (not just name) - Add WT_CONTEXT_NAME variable to track current context - Remove re-source logic from wt.sh context handler - Add wt_read_config() calls to completion and help functions - Maintain backward compatibility with old current file format The new current file format: # Active context: java WT_CONTEXT_NAME="java" WT_MAIN_REPO_ROOT="..." ... Environment variables still override config file values.
00b3c98 to
ae79d80
Compare
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/currentinstead of being sourcedwt_read_config()function for safe config parsing without shell sourcing~/.wt/currentfile format to include full config (maintains backward compatibility)Test plan
./install.shcreates proper current file formatwt context <name>takes effect immediately without shell reloadWT_MAIN_REPO_ROOT=/tmp/test wt listuses override🤖 Generated with Claude Code