Repository navigation
Add nushell support - #964
Conversation
|
cheers @arnaudlimbourg . could we get tests passing and then I'll review more closely? browsing the code initially look good! |
d2be1a7 to
21c9d23
Compare
- Add install/uninstall integration tests for nushell shell configuration
- Add nushell ("nu") to static completions and init shell tests
- Refactor SymlinkMapping::compute() to extract testable from_paths()
- Add unit tests for all from_paths() branches (no symlink, stale PWD,
canonicalize failure, no common suffix, WSL-style, macOS, equal depth)
Addresses codecov/patch coverage gap on PR max-sixty#964.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Add install/uninstall integration tests for nushell shell configuration
- Add nushell ("nu") to static completions and init shell tests
- Refactor SymlinkMapping::compute() to extract testable from_paths()
- Add unit tests for all from_paths() branches (no symlink, stale PWD,
canonicalize failure, no common suffix, WSL-style, macOS, equal depth)
Addresses codecov/patch coverage gap on PR max-sixty#964.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
07fffa5 to
789c07b
Compare
|
@max-sixty tests are much better, I'm not sure if the failing one is flaky, do you often have issues with this particular test? |
| /// 1. etcetera BaseStrategy config_dir (if available) | ||
| /// 2. XDG_CONFIG_HOME environment variable | ||
| /// 3. Falls back to ~/.config | ||
| fn xdg_config_home(home: &std::path::Path, strategy: Option<&dyn BaseStrategy>) -> PathBuf { |
There was a problem hiding this comment.
do we not have this function or an equivalent elsewhere?
(@claude maybe have a look to save @arnaudlimbourg responding, assuming we don't)
| if ($directive | str starts-with "cd '") { | ||
| # Parse cd command: worktrunk emits "cd '<path>'" | ||
| # Use substring 4..-2 to skip "cd '" prefix and exclude trailing "'" | ||
| let target_dir = $directive | str substring 4..-2 |
There was a problem hiding this comment.
is there a more robust way to do this string parsing? can we just run the whole cd command rather than running cd $dir?
There was a problem hiding this comment.
@max-sixty we could but this would require changing worktrunk to emit the path alone since nushell is not posix-compliant.
I suspect this would be better off in another PR
| ); | ||
|
|
||
| // Find wt.nu under temp_home (path depends on platform/nu availability) | ||
| let nu_config = find_file_recursive(temp_home.path(), "wt.nu") |
There was a problem hiding this comment.
@claude could you draft a change that looks for a specific path by platform? let's include if it's not overly complicated...
|
@arnaudlimbourg thank you for the high quality code! please could we label this as experimental in the docs? how would you feel about signing up to handle bug reports for a while? I'm admittedly a bit nervous that this is going to merge and then we're going to have these very-difficult-to-debug bug reports, and people are going to get annoyed at Worktrunk. I would feel very happy to merge in its current state if you would be happy to look at any bugs for the next few weeks (doesn't need to be beyond that) |
|
@claude can you review anywhere in the repo where we need to list Nushell along with other shells, either:
|
|
Claude finished @max-sixty's task in 1m 36s —— View job Review: Nushell Shell ListingsI found 6 locations where nushell should be added to shell lists in documentation and setup instructions, and responded to the 3 review comments. 📝 Documentation updates needed (4 files)1. CLAUDE.md (line 77)Current: Lists Run `task setup-web` to install required shells (zsh, fish), `gh`, and other dev tools.Should mention: File: 2. FAQ documentation (docs/content/faq.md, line 226-229)Current: Shell integration tests require bash, zsh, and fish:
```bash
$ cargo test --test integration --features shell-integration-testsShould say: "bash, zsh, fish, nushell, PowerShell" File: 4. FAQ - Shell integration locations (docs/content/faq.md, lines 96-98)Current: - **Bash**: adds line to `~/.bashrc`
- **Zsh**: adds line to `~/.zshrc` (or `$ZDOTDIR/.zshrc`)
- **Fish**: creates `~/.config/fish/functions/wt.fish` and `~/.config/fish/completions/wt.fish`Should add: Nushell entry showing where it creates files (based on the code, it's File: ⚙️ Development setup updates needed (2 files)5. Taskfile.yaml (lines 43-59)Current: Installs # Install shells
echo ""
echo "Installing shells for integration tests..."
if command -v apt-get &> /dev/null; then
export DEBIAN_FRONTEND=noninteractive
# ... installs zsh fish
fi
for shell in bash zsh fish; do
command -v "$shell" &> /dev/null || { echo "Error: $shell not found"; exit 1; }
echo "$shell available"
doneShould add:
File: 6. CI Workflow Windows comment (.github/workflows/ci.yaml, lines 88-94)Current: - name: Install shells - Windows
if: runner.os == 'Windows'
run: |
# Git Bash is pre-installed on GitHub Actions Windows runners
# Fish and zsh are not commonly available on native Windows (require WSL/MSYS2)
# CI will test with bash only on Windows (tests skip unavailable shells)
echo "Using Git Bash for Windows tests"Should add: Mention that nushell is also not available on Windows CI (or if it should be installed, document that) File: ✅ Already correctThe following locations already include nushell appropriately:
🔍 Review comment responses[Comment on src/shell/paths.rs:27] - "do we not have this function or an equivalent elsewhere?" The [Comment on templates/nushell.nu:39] - "is there a more robust way to do this string parsing?" Line 39 uses [Comment on tests/integration_tests/configure_shell.rs:1692] - Draft a change for platform-specific path checking The test uses |
OK @claude can you make these additions in a single commit, add to this PR? then @arnaudlimbourg can change further if he wants |
|
Claude finished @max-sixty's task in 1m 52s —— View job Nushell Documentation Updates Complete ✓I've added nushell references to all documentation and setup locations where other shells are listed. Changes Made
All changes have been committed and pushed to the PR branch. @arnaudlimbourg can modify these further if needed. --- | Branch: ms/nushell |
a17201c to
e20152e
Compare
|
@max-sixty sorry for the delay! I'm catching up! I have rebased the branch and working on fixing it. I'd be happy to check bug reports that involve nushell. |
Add nushell as an experimental shell for worktrunk's shell integration. - Add Nushell variant to Shell enum with config paths and detection - Create nushell.nu template with --env flag for cd directive handling - Add nushell to default shells in install/uninstall commands - Update completion format to support nushell descriptions - Add nushell installation to CI workflows - Document nushell setup in shell integration and FAQ docs - Extract XDG config home helper in shell/paths - Label nushell as experimental in docs and install output Based on work by MattiasMTS, arnaudlimbourg, and max-sixty. Co-Authored-By: MattiasMTS <[email protected]> Co-Authored-By: Maximilian Roos <[email protected]> Co-Authored-By: Claude Opus 4.6 <[email protected]>
e20152e to
d60d546
Compare
|
@max-sixty done, how does this look? |
Add nushell manual setup instructions with (experimental) label to `wt config shell init --help` and shell-integration skill reference. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
ok, I'll merge! thanks! |
|
LOL just came here looking for this and I see it's been merged 4 hours ago (YAY!) but last release is yesterday 🤣 - me and my timings... |
|
If this is of any interest to anyone @max-sixty / @arnaudlimbourg I just rebuilt the project with this merge (couldn't wait), and ran it locally, doesn't seem to pop in issue but nushell is skipped and while it provides a path I'm not entirely sure what I'm expected to do. Example: |
|
@omerxx would you mind opening an issue and tagging @arnaudlimbourg ? @claude can you review the report and see if you can get any initial hypotheses? |
|
Claude finished @max-sixty's task in 54s —— View job Investigating Nushell Installation Issue
Analysis of @omerxx's ReportThe error message is: This is the expected behavior when the How nushell installation worksThe install flow ( Before writing, the code checks if the parent directory ( let has_config_location = if matches!(shell, Shell::Fish | Shell::Nushell) {
paths.first()
.and_then(|p| p.parent())
.map(|p| p.exists())
.unwrap_or(false)
|| target_path.is_some()
} else {
target_path.is_some()
};If the parent directory doesn't exist and no shell filter is explicitly set (i.e., the user ran HypothesesPrimary hypothesis: The The
Secondary hypothesis: The nushell config directory path resolution might differ.
Suggested FixThe most user-friendly fix would be to create the
For now, @omerxx can work around this by either:
|
|
@arnaudlimbourg @max-sixty I can confirm just creating the path works - just be sure to run a nu-compatible line (lose the Thanks guys for the amazing work! |
|
ok great, I will add the change to creats this path if nushell exists @arnaudlimbourg |
|
@arnaudlimbourg me again :/ and just for context: |
|
@omerxx interesting, I didn't get this behaviour:( what version of nushell and platform are you running? with latest main version, on macOS, I get wt switch -c somename
✓ Created branch somename from main and worktree @ ~/development/worktrunk.somename
◎ Running post-start: project:deps, project:assets, project:docs |
|
Hey @arnaudlimbourg at this point I think I might have a dirty env otherwise I can't find an explanation. Built your fork locally (called it for the chance you may think these are reversed in order (they weren't I just re-ran things for the comment), here's a followup switch: I'm running nu |
This is my second attempt at having nushell support, referring #735
This PR adds:
I tested it manually using nushell v0.110.0 and have not encountered issues.