Skip to content

feat(shell): add nushell shell hook integration - #720

Open
AdamMagued wants to merge 3 commits into
version-fox:mainfrom
AdamMagued:feat-issue-719-nushell-plugin
Open

AdamMagued wants to merge 3 commits into
version-fox:mainfrom
AdamMagued:feat-issue-719-nushell-plugin

Conversation

@AdamMagued

@AdamMagued AdamMagued commented Oct 11, 2026 •

Copy link
Copy Markdown

Summary

This change enhances Nushell shell integration across vfox:

  • Recognizes nu alongside nushell (as well as powershell alongside pwsh) in shell.NewShell.
  • Supports direct Nushell activation script generation (vfox activate nu / vfox activate nushell) without requiring explicit config path arguments. When called without arguments, the rendered activation script is emitted directly to standard output.
  • Retains existing behavior when a configuration directory is provided as an argument (vfox activate nu $nu.default-config-dir), continuing to write vfox.nu to the target directory and returning the source command.
  • Guards hide-env and load-env execution in Nushell so variables are only processed when non-empty, avoiding errors when attempting to hide empty variable lists.
  • Updates English and Chinese quick-start documentation to cover Nushell hook options (direct activation script emission, vendor autoload directory, and config directory writing).
  • Adds full unit test coverage for Nushell methods and branches, ensuring 100% patch test coverage.

Support direct Nushell activation script generation, recognize nu and powershell shell aliases in NewShell, and avoid invoking hide-env with empty variable lists.
Copilot AI balanced review requested due to automatic review settings October 11, 2026 00:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.67%. Comparing base (10c9f96) to head (6a17dad).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     version-fox/vfox#720      +/-   ##
==========================================
+ Coverage   51.39%   51.67%   +0.28%     
==========================================
  Files         111      111              
  Lines        8240     8245       +5     
==========================================
+ Hits         4235     4261      +26     
+ Misses       3583     3565      -18     
+ Partials      422      419       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linghengqian linghengqian added the enhancement New feature or request label Oct 11, 2026

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supports direct Nushell activation script generation (vfox activate nu / vfox activate nushell) without requiring explicit config path arguments.

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do not provide an explanation regarding https://github.com/version-fox/vfox/issues/719#issuecomment-6104802936 , I will close this PR in a month.

@AdamMagued AdamMagued changed the title feat(shell): add nushell integration support feat(shell): add nushell shell hook integration Oct 13, 2026
@AdamMagued

Copy link
Copy Markdown
Author

@linghengqian

Thank you for the review.

To clarify the relationship with issue version-fox/vfox-plugins#44:

Regarding the documentation and tests:

  1. Documentation: Updated both docs/guides/quick-start.md and docs/zh-hans/guides/quick-start.md to document Nushell shell hooking. This covers direct activation script generation (vfox activate nu | save --append $nu.config-path), Nushell 0.96+ vendor autoload (vendor/autoload/vfox.nu), and the existing directory argument workflow (vfox activate nu $nu.default-config-dir).
  2. Test coverage: Added comprehensive unit tests in internal/shell/nushell_test.go covering direct activation without arguments, activation with target directories (including directory creation), empty/non-empty environment unsetting guards, and error cases, bringing patch test coverage to 100%.

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

analogous to the existing Bash, Zsh, Fish, and PowerShell hooks.

  • You haven't explained at all what you are doing. Given that Nushell integration already exists, what is the point of opening this PR?
  • Image

@sweetrollsuranusbear

Copy link
Copy Markdown

w.r.t. this - #720 (review)

Thanks for the review it seems the PR description now more lucid and covers your concern, if this gets included into a pre-release ping me I wanna test it out.

Thanks for the hard work.

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sweetrollsuranusbear Who are you?

@sweetrollsuranusbear

Copy link
Copy Markdown

wrt #720 (review)

I dunno. if you wanna know wouldn't it make more sense to have a GitHub Discussions enabled? I am also more interested in collaboration or contribution on vfox whichever you personally prefer. Don't wanna pollute the PR with that discussion, it would get long.

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sweetrollsuranusbear If you continue to use an ai agent to generate these kinds of rambling, off-topic responses, I will block you from the vfox organization. We do not use the discussion forum.

@aooohan aooohan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks good to me. I checked 58f1a63 and ran all three documented setup methods in native Nushell 0.116.1: the config-directory form, appending the hook directly, and vendor autoload. With an isolated home/config and a fixture SDK, startup loaded the SDK environment and the prompt hook worked in each case.

The build, go vet ./..., and CI=true go test ./... all passed with Go 1.24.0 on macOS arm64.

There's still a merge conflict in internal/shell/nushell_test.go. Please keep both the baseline regression test from main and the new activation tests when resolving it. I tested a temporary merge with main at feb6092 that retained both sets of tests: the full suite, vet, and build passed. I also reran all three setup methods in native Nushell and checked that inherited PATH entries moved behind the SDK while entries added after activation stayed in front.

No blocking code findings from me. The conflict still needs to be resolved on the PR before merging.

@AdamMagued

Copy link
Copy Markdown
Author

@aooohan Merged upstream main and resolved the conflict in internal/shell/nushell_test.go. Both the baseline PATH recording regression test (TestNushellActivateRecordsTheBaseline) and the activation test suite (TestNushellActivateWithPidCheck, TestNushellActivateDirect, TestNushellActivateErrors, TestNushellActivateCreatesConfigDir) have been retained.

Verified locally and in a clean container environment:

  • go vet ./... passed cleanly.
  • CI=true go test ./... passed across all packages.
  • go build ./... built without issues.

The branch is clean and ready for merge.

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don’t see how this PR relates to https://github.com/version-fox/vfox/issues/719 at all. If you encountered a bug while using vfox in Nushell, which issue contains the original bug report?

@AdamMagued

Copy link
Copy Markdown
Author

To eliminate any confusion, I have removed the reference to version-fox/vfox-plugins#44 from the PR description.

This PR was not opened to address a bug report issue, but as a standalone feature contribution providing native shell hook integration for Nushell (vfox activate nu), aligning Nushell support with the existing Bash, Zsh, Fish, and PowerShell implementations.

As @aooohan confirmed and approved after testing in native Nushell 0.116.1, the integration is verified and the merge conflict in internal/shell/nushell_test.go has been cleanly resolved with all tests passing.

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might have misunderstood what I meant. Documentation on how to configure Nushell has always been included in previous versions. What would happen if your PR weren't there?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants