Skip to content

fix(shell): auto-detect nushell for install even without vendor/autoload - #1032

Merged
max-sixty merged 2 commits into
max-sixty:mainfrom
arnaudlimbourg:fix/nushell-vendor-autoload-detection
Feb 15, 2026
Merged

max-sixty merged 2 commits into
max-sixty:mainfrom
arnaudlimbourg:fix/nushell-vendor-autoload-detection

Conversation

@arnaudlimbourg

Copy link
Copy Markdown
Contributor

When nu is in PATH, wt config shell install now creates the vendor/autoload directory automatically instead of skipping nushell. The directory was introduced in nushell v0.96.0 and isn't always pre-created, causing install to silently skip nushell users.

Follows the existing PowerShell pattern: detect the shell binary, then set should_configure and allow_create so the directory gets created on the user's behalf.

This fixes issue reported in #964 about installation being skipped on nushell

@arnaudlimbourg
arnaudlimbourg force-pushed the fix/nushell-vendor-autoload-detection branch from c4083e1 to c6895cb Compare February 15, 2026 09:32
When `nu` is in PATH, `wt config shell install` now creates the
vendor/autoload directory automatically instead of skipping nushell.
The directory was introduced in nushell v0.96.0 and isn't always
pre-created, causing install to silently skip nushell users.

Follows the existing PowerShell pattern: detect the shell binary,
then set should_configure and allow_create so the directory gets
created on the user's behalf.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@arnaudlimbourg
arnaudlimbourg force-pushed the fix/nushell-vendor-autoload-detection branch from c6895cb to d6ca5cc Compare February 15, 2026 09:35
@arnaudlimbourg

Copy link
Copy Markdown
Contributor Author

@max-sixty tested locally, works well

…ssertion

Move WORKTRUNK_TEST_NUSHELL_ENV alongside WORKTRUNK_TEST_POWERSHELL_ENV in
configure_cli_command for consistency — both are shell detection overrides.

Add negative assertion (!contains("Skipped nu")) to directly test the
failure mode this fix addresses.

Co-Authored-By: Claude <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner

thank you!

(fwiw I was happy to take a pass on this, but didn't finish before I went to bed, thank you for taking it...)

@max-sixty
max-sixty merged commit dba80e3 into max-sixty:main Feb 15, 2026
20 checks passed
@arnaudlimbourg
arnaudlimbourg deleted the fix/nushell-vendor-autoload-detection branch February 15, 2026 20:09
arnaudlimbourg added a commit to arnaudlimbourg/worktrunk that referenced this pull request Feb 15, 2026
When shell integration is installed, nushell config might be in different
locations depending on the user's environment:
- Installation queries `nu -c "echo $nu.default-config-dir"` → creates file at that path
- Runtime check should find it regardless of which path was used

Previously, is_shell_configured() only checked the single path returned by
nushell_config_dir(). If the `nu` command failed during runtime (PATH issues,
timeout, etc.) but succeeded during install, detection would fail.

Fix: Return multiple candidate paths for nushell checking:
1. The path from querying nu (if available)
2. XDG_CONFIG_HOME/nushell (if set)
3. ~/.config/nushell (XDG default)
4. ~/Library/Application Support/nushell (macOS)

This ensures is_shell_configured() finds the nushell integration file
regardless of which path was used during installation, fixing the issue
where users got "Cannot change directory — shell integration not installed"
despite having successfully configured nushell.

Resolves the follow-up issue from PR max-sixty#1032 where nushell detection failed
at runtime even after successful installation.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
arnaudlimbourg added a commit to arnaudlimbourg/worktrunk that referenced this pull request Feb 15, 2026
When shell integration is installed, nushell config might be in different
locations depending on the user's environment:
- Installation queries `nu -c "echo $nu.default-config-dir"` → creates file at that path
- Runtime check should find it regardless of which path was used

Previously, is_shell_configured() only checked the single path returned by
nushell_config_dir(). If the `nu` command failed during runtime (PATH issues,
timeout, etc.) but succeeded during install, detection would fail.

Fix: Return multiple candidate paths for nushell checking:
1. The path from querying nu (if available)
2. XDG_CONFIG_HOME/nushell (if set)
3. ~/.config/nushell (XDG default)
4. ~/Library/Application Support/nushell (macOS)

This ensures is_shell_configured() finds the nushell integration file
regardless of which path was used during installation, fixing the issue
where users got "Cannot change directory — shell integration not installed"
despite having successfully configured nushell.

Resolves the follow-up issue from PR max-sixty#1032 where nushell detection failed
at runtime even after successful installation.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
max-sixty pushed a commit that referenced this pull request Feb 15, 2026
* fix(shell): nushell detection checks multiple config paths

When shell integration is installed, nushell config might be in different
locations depending on the user's environment:
- Installation queries `nu -c "echo $nu.default-config-dir"` → creates file at that path
- Runtime check should find it regardless of which path was used

Previously, is_shell_configured() only checked the single path returned by
nushell_config_dir(). If the `nu` command failed during runtime (PATH issues,
timeout, etc.) but succeeded during install, detection would fail.

Fix: Return multiple candidate paths for nushell checking:
1. The path from querying nu (if available)
2. XDG_CONFIG_HOME/nushell (if set)
3. ~/.config/nushell (XDG default)
4. ~/Library/Application Support/nushell (macOS)

This ensures is_shell_configured() finds the nushell integration file
regardless of which path was used during installation, fixing the issue
where users got "Cannot change directory — shell integration not installed"
despite having successfully configured nushell.

Resolves the follow-up issue from PR #1032 where nushell detection failed
at runtime even after successful installation.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>

* test(shell): add unit tests for nushell config path resolution

Extract parse_nu_config_output and resolve_nushell_config_dir as testable
functions to close the codecov/patch coverage gap. The fallback path in
resolve_nushell_config_dir was only covered locally (no nu binary) but
not in CI (where nu is installed), causing the patch check to fail.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Haiku 4.5 <[email protected]>
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.

2 participants