Skip to content

fix(shell): nushell detection checks multiple config paths - #1038

Merged
max-sixty merged 2 commits into
max-sixty:mainfrom
arnaudlimbourg:fix-nushell-config-location-handling
Feb 15, 2026
Merged

max-sixty merged 2 commits into
max-sixty:mainfrom
arnaudlimbourg:fix-nushell-config-location-handling

Conversation

@arnaudlimbourg

Copy link
Copy Markdown
Contributor

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.

Refs #1036

arnaudlimbourg and others added 2 commits February 15, 2026 22:09
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]>
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]>
@arnaudlimbourg
arnaudlimbourg force-pushed the fix-nushell-config-location-handling branch from 192533d to 4cec58b Compare February 15, 2026 21:10
@arnaudlimbourg

Copy link
Copy Markdown
Contributor Author

@max-sixty the code coverage was failing, it should be fine now. The claude-review is new I see but it fails with

Warning: Actor has insufficient permissions: read
Error: Action failed with error: Actor does not have write permissions to the repository
Error: Process completed with exit code 1.

@arnaudlimbourg arnaudlimbourg mentioned this pull request Feb 15, 2026
@max-sixty

Copy link
Copy Markdown
Owner

merging! later we can clean up the code a bit

@max-sixty
max-sixty merged commit 2f01ea4 into max-sixty:main Feb 15, 2026
20 of 21 checks passed
max-sixty added a commit that referenced this pull request Feb 15, 2026
The review workflow was failing for PRs from users without write
permissions (e.g., arnaudlimbourg on #1038) because claude-code-action
requires write access by default. Set allowed_non_write_users to "*"
since the whole purpose of this workflow is reviewing external PRs.

Co-Authored-By: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Feb 15, 2026
The review workflow was failing for PRs from users without write
permissions (e.g., arnaudlimbourg on #1038) because claude-code-action
requires write access by default. Set allowed_non_write_users to "*"
since the whole purpose of this workflow is reviewing external PRs.

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Feb 16, 2026
…andidates

Follow-up fixes to #1038 where config_paths() was changed to return
multiple Nushell candidates but not all consumers were updated:

- Uninstall now iterates all candidate paths instead of only the first,
  so config files installed at a different location (e.g., nu was in PATH
  during install but not during uninstall) get cleaned up
- has_config_location checks any candidate's parent directory for
  auto-detection, not just the first
- Removed redundant etcetera entry from nushell_config_candidates() (always
  duplicated either $XDG_CONFIG_HOME/nushell or ~/.config/nushell) and added
  HashSet-based dedup for remaining edge cases

Co-Authored-By: Claude <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Feb 16, 2026
…andidates (#1050)

* fix(shell): nushell uninstall cleans all candidate locations, dedup candidates

Follow-up fixes to #1038 where config_paths() was changed to return
multiple Nushell candidates but not all consumers were updated:

- Uninstall now iterates all candidate paths instead of only the first,
  so config files installed at a different location (e.g., nu was in PATH
  during install but not during uninstall) get cleaned up
- has_config_location checks any candidate's parent directory for
  auto-detection, not just the first
- Removed redundant etcetera entry from nushell_config_candidates() (always
  duplicated either $XDG_CONFIG_HOME/nushell or ~/.config/nushell) and added
  HashSet-based dedup for remaining edge cases

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

* refactor(shell): extract remove_config_file helper for uninstall

Deduplicate 4 identical remove_file + map_err + format! patterns into
a shared remove_config_file() helper. Improves patch coverage by making
the nushell uninstall block a simple function call.

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

---------

Co-authored-by: Claude <[email protected]>
@arnaudlimbourg
arnaudlimbourg deleted the fix-nushell-config-location-handling branch February 16, 2026 07:50

This branch was previously deployed

1 inactive deployment
claude-review — 4cec58bd Deployed Feb 15, 2026 by arnaudlimbourg via review #2
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