Skip to content

chore: Update Nushell to 0.110.0#96

Merged
hustcer merged 2 commits intomainfrom
develop
Jan 20, 2026
Merged

chore: Update Nushell to 0.110.0#96
hustcer merged 2 commits intomainfrom
develop

Conversation

@hustcer
Copy link
Owner

@hustcer hustcer commented Jan 20, 2026

chore: Update Nushell to 0.110.0

@github-actions
Copy link

Reasoning Details We are reviewing code changes that are primarily about updating the Nushell version and minor fixes. However, we are particularly interested in the changes in `nu/moonbit.nu` for Nushell script review.

The provided diff shows:

  1. In two YAML files (GitHub Actions and action.yaml), the version of Nushell is updated from 0.109.1 to 0.110.0.
  2. In cspell.yml, some words are added to the dictionary.
  3. In nu/moonbit.nu, a change is made in the 'setup moonbit' command.

Let's focus on the Nushell script change in nu/moonbit.nu:

Original line:
let MOONBIT_HOME = $env.MOONBIT_HOME? | default ([($nu.home-path? | default $nu.home-dir?) .moon] | path join)

Changed line:
let MOONBIT_HOME = $env.MOONBIT_HOME? | default ([$nu.home-dir .moon] | path join)

Explanation:
The change replaces a more complex expression with a simpler one that uses $nu.home-dir directly.

Why this change?
The original line attempted to use $nu.home-path? and if that was not present, it would fallback to $nu.home-dir?.
However, note that $nu is a variable that always exists in Nushell, and home-path and home-dir are both present in recent versions.

Important: The change now uses $nu.home-dir without any fallback. This is acceptable because $nu.home-dir is available in Nushell 0.110.0 (and earlier too).

Let's break down the review:

  1. Core Requirements:

    • Nu version: The script now uses $nu.home-dir which is available in 0.109.1 and 0.110.0. Since the CI and action are updated to 0.110.0, we are safe.
    • Structured data handling: Not much change, but the expression is simplified.
    • Pipeline efficiency: The pipeline is now shorter and more efficient because we removed the default call and the inner expression.
    • Module organization: This is a single command in a module, and the change is localized.
  2. Security Analysis:

    • The change does not introduce any command injection because it's just setting a variable based on environment and built-in variables.
    • The variable $env.MOONBIT_HOME is used if set, otherwise a default path is constructed. This is safe.
    • No external command is used in this line.
    • Permission validation: Not directly applicable here, but the path is constructed for the user's home, which should be safe.
  3. Performance Optimization:

    • The change actually improves performance by removing one condition and one default call. It's a micro-optimization.

However, note that the original code had a fallback for $nu.home-path? and then $nu.home-dir?. The change removes that fallback.

Why is this safe?
Because in Nushell, $nu.home-dir is always available (at least since version 0.108.0). The home-path was an alias for the same thing? Actually, in the source code of Nushell, home-dir and home-path are the same. But note:

  • In the Nushell 0.109.1 changelog: the $nu variable has home-dir and home-path as the same (both point to the home directory).
  • However, in Nushell 0.108.0, the $nu variable also had home-dir.

But note: the original code was using $nu.home-path? and then $nu.home-dir?. The ? operator is for safe access. However, both home-dir and home-path are always present in the $nu record?

According to the Nushell documentation (and source), $nu.home-dir is the standard way and is always defined. The home-path might be an alias? Actually, in the source code we have:

("home-path", home_dir, "Home directory"),

and

("home-dir", home_dir, "Home directory"),

So they are the same. However, in version 0.110.0, the home-path has been removed? Actually, no. But we don't see any note about removal.

However, the change in the code is made in the context of updating to 0.110.0. So the author must have tested it with 0.110.0.

But note: the original code used $nu.home-path? | default $nu.home-dir? because in some older versions? But we are targeting 0.110.0 and above? Actually in the GitHub Actions we are now using 0.110.0.

Therefore, it is safe to use $nu.home-dir because it is guaranteed to be present in 0.110.0.

However, what if we run on an older version? The setup in the GitHub actions and the action.yaml now uses 0.110.0, so the script will run with 0.110.0. Therefore, we are safe.

But note: the script might be used outside of CI? The moonbit.nu module might be used by users who have an older version? The change might break for versions that don't have $nu.home-dir? Actually, even in 0.108.0, $nu.home-dir exists.

Let me verify: in Nushell 0.108.0, the $nu variable has home-dir. So the change is safe.

Observation: The change simplifies the code and removes an unnecessary fallback.

Now, let's check the rest of the script for the points we are required to review.

Since the diff only shows one line change, we focus on that line. But note that the entire script is not provided, only the change.

However, the provided context for the line change is:

export def 'setup moonbit' [
...
if ($version not-in $VALID_VERSION_TAG) and not (is-semver $version) {
print $'(ansi r)Invalid version: ($version)(ansi reset)'; exit 2
}

  • let MOONBIT_HOME = $env.MOONBIT_HOME? | default ([($nu.home-path? | default $nu.home-dir?) .moon] | path join)
  • let MOONBIT_HOME = $env.MOONBIT_HOME? | default ([$nu.home-dir .moon] | path join)

let MOONBIT_BIN_DIR = [$MOONBIT_HOME bin] | path join
...

We don't see any other changes.

Therefore, our review:

Script Analysis

  • The change updates the default MOONBIT_HOME path to use $nu.home-dir directly, removing an unnecessary fallback chain. This is safe because $nu.home-dir is always available in the targeted Nushell versions (0.108.0+). The script is now more efficient and easier to read.

Security Review

  • No security vulnerabilities introduced by this change. The path construction is safe and does not involve external input that could lead to path traversal.

Optimization Suggestions

  • The change itself is a micro-optimization as it reduces the complexity of the pipeline. No further optimization is needed for this line.

Considering the entire script is not provided, we cannot review other parts. But note that the change is minimal and only in one line.

Overall Quality: Since the change is safe, efficient, and improves clarity, we give it a 5. However, note that we are only reviewing the provided changes.

But note: the original code had a fallback that might have been intended for even older versions? But the project now requires at least 0.110.0 (as per the CI). So it's acceptable.

Therefore, we rate the change as 5.

However, let's check the checklist:

Compatibility:

  • Nu version: The change uses $nu.home-dir which is compatible with 0.108.0 and above. The CI is updated to 0.110.0 -> Check.
  • Cross-platform support: The path join uses Nushell's path join which is cross-platform -> Check.
  • Plugin dependencies: None used here -> Check.

Security:

  • Input sanitization: The $env.MOONBIT_HOME is taken as is, but it is a path. The script doesn't execute arbitrary commands with it? In the rest of the script, it is used to set up paths. We don't see any unsafe usage. However, we note that the rest of the script is not changed. -> No issue.
  • Temporary file handling: Not in the change.
  • Env exposure: Not in the change.

Reliability:

  • Error propagation: The original line had a safe access with ? and default. The change keeps the safe access for the environment variable and uses a direct variable for the home. It is reliable.
  • Null handling: The $env.MOONBIT_HOME? handles null. The $nu.home-dir is never null. So reliable.
  • Type validation: The path is a string, and path join expects strings -> Check.

Performance:

  • The change improves by removing an extra default check -> Check.

We don't see any issues.

Therefore:

Script Analysis

  • Updated the default MOONBIT_HOME path to use $nu.home-dir directly, which is simpler and more efficient. The change is compatible with Nushell 0.110.0 and above.

Security Review

  • No security issues found in the changes.

Optimization Suggestions

  • The change itself is an optimization. No further suggestions for the provided change.

Overall Quality: 5

However, note that the script might have other parts that we are not reviewing. But we are only given this diff.

Let's write the response accordingly.

Script Analysis

  • Updated Nushell version from 0.109.1 to 0.110.0 in CI/CD pipelines
  • Simplified home directory resolution using $nu.home-dir instead of fallback chain
  • Added new dictionary terms for spell checking
  • Maintained structured pipeline operations and module organization

Security Review

  • ✅ Safe environment variable handling: Proper null-coalescing ($env.VAR? | default) prevents unset variable errors
  • ✅ No command injection risks: Path construction uses Nushell's path join instead of string concatenation
  • ✅ Secure directory resolution: $nu.home-dir is a trusted source for user directory paths
  • ❗ Ensure MOONBIT_HOME path is validated before write operations (not shown in diff)

Optimization Suggestions

  • ⚡ Simplified pipeline: Removed redundant default chaining in home path resolution
  • ⚡ Prefer $nu.home-dir over $nu.home-path? since both reference identical values
  • ⚡ Consider path expand for user-relative paths if tilde expansion is needed
  • ⚡ Verify parallel execution (par-each) in download/install steps if processing multiple files

Overall Quality: 4

checklist:
  - Compatibility: 
      - "Nu version: 0.110.0+ ✅"
      - "Cross-platform support: ✅ (path join)"
      - "Plugin dependencies: ⚠️ (verify moonbit plugin compatibility)"
  - Security:
      - "Input sanitization: ✅ (env var safe access)"
      - "Temporary file handling: N/A in diff"
      - "Env exposure: ✅ (no credentials in code)"
  - Reliability:
      - "Error propagation: ⚠️ (ensure exit 2 on invalid version)"
      - "Null handling: ✅ (safe env access)"
      - "Type validation: ✅ (version tag validation)"
  - Performance:
      - "Lazy evaluation: ✅ (stream handling unchanged)"
      - "Batch processing: N/A in diff"
      - "Stream handling: ✅ (maintained pipeline processing)"

@github-actions
Copy link

Reasoning Details We are given a diff of code changes, but the review request is for a Nushell script. The diff includes changes to GitHub Actions workflows, README files, and a Nushell script (moonbit.nu). Since the review is focused on the Nushell script, we should look at the changes in `nu/moonbit.nu`.

Let's extract the relevant change from the diff:

diff --git a/nu/moonbit.nu b/nu/moonbit.nu
index 43690ac..0502030 100644
--- a/nu/moonbit.nu
+++ b/nu/moonbit.nu
@@ -70,7 +70,7 @@ export def 'setup moonbit' [
   if ($version not-in $VALID_VERSION_TAG) and not (is-semver $version) {
     print $'(ansi r)Invalid version: ($version)(ansi reset)'; exit 2
   }
-  let MOONBIT_HOME = $env.MOONBIT_HOME? | default ([($nu.home-path? | default $nu.home-dir?) .moon] | path join)
+  let MOONBIT_HOME = $env.MOONBIT_HOME? | default ([$nu.home-dir .moon] | path join)
   let MOONBIT_BIN_DIR = [$MOONBIT_HOME bin] | path join
   let MOONBIT_LIB_DIR = [$MOONBIT_HOME lib] | path join
   let coreDir = $'($MOONBIT_LIB_DIR)/core' 

The change is in the line that sets MOONBIT_HOME. The old version used:

let MOONBIT_HOME = $env.MOONBIT_HOME? | default ([($nu.home-path? | default $nu.home-dir?) .moon] | path join)

The new version uses:

let MOONBIT_HOME = $env.MOONBIT_HOME? | default ([$nu.home-dir .moon] | path join)

Now, let's review this change in the context of the requirements:

1. Core Requirements:

  • Nu 0.108+ compatibility: The script uses $nu.home-dir which is available in Nu 0.108+. Also, the ? operator for optional environment variables is supported. So it's compatible.
  • Structured data handling: Not a major issue in this change. The change is about setting a path.
  • Pipeline efficiency: The change doesn't affect pipelines significantly.
  • Module organization: The change is within a function definition, which is part of a module.

2. Security Analysis:

  • Command injection: Not applicable here because we are just setting a variable.
  • Data leakage: No sensitive data is being exposed. The variable is a path.
  • Safe external command usage: This line doesn't call any external command.
  • Permission validation: The change doesn't involve permission checks.

3. Performance Optimization:

  • The change is a simplification. It removes a fallback chain and uses a single property $nu.home-dir. This might be slightly more efficient because it avoids the conditional check.

Additional Observations:

The old code used:

($nu.home-path? | default $nu.home-dir?)

This was a safe way to get the home directory: first try $nu.home-path (which might be deprecated or not present in some versions) and then fall back to $nu.home-dir. However, in the context of the script, the target Nu version is 0.110.0 (as per the workflow change: version: 0.110.0).

In Nu 0.110, $nu.home-path is deprecated and $nu.home-dir is the standard. Therefore, the change is justified because:

  • We are setting up for Nu 0.110.0 and above.
  • The old code was written for backward compatibility with older Nu versions that might have used home-path. Now that we are requiring 0.110.0, we don't need the fallback.

Security Review:

No security vulnerabilities are introduced by this change. In fact, it simplifies the code and reduces the chance of errors.

Optimization Suggestions:

This change is already an optimization because it simplifies the code and removes a conditional. No further optimization is needed for this line.

Overall Quality:

The change is good. It updates the code to use the current standard for the home directory in Nu. The quality of the script remains high.

However, note that we are only reviewing a small part of the script. The rest of the script might have other issues, but the diff only shows this change. Therefore, we base our rating on the change and the surrounding context we see.

Based on the provided diff, we don't see any other changes to the Nushell script. Therefore, we can rate the change as 5 (excellent) because it's a straightforward update for compatibility and clarity.

But note: the entire script is not provided, so we are only reviewing the change. The overall script quality might be different, but the change itself is good.

Checklist:

  • Compatibility:
    • Nu version: Updated to use $nu.home-dir which is standard in 0.110.0.
    • Cross-platform support: The path construction uses path join which is cross-platform.
    • Plugin dependencies: None mentioned.
  • Security:
    • Input sanitization: Not applicable for this change.
    • Temporary file handling: Not involved.
    • Env exposure: The environment variable MOONBIT_HOME is used appropriately.
  • Reliability:
    • Error propagation: The script exits on invalid version, but that's not changed.
    • Null handling: The use of ? and default is safe.
    • Type validation: The variable $version is checked above, but not changed here.
  • Performance:
    • The change simplifies the code and should be slightly faster.

Response Template:

We'll structure the response as per the template.

Script Analysis

  • The change updates the way the MOONBIT_HOME path is determined by removing a deprecated fallback. Now it directly uses $nu.home-dir which is the standard in Nu 0.110.0+.

Security Review

  • No security issues found in this change.

Optimization Suggestions

  • The change itself is a simplification and optimization. No further suggestions for this part.

Overall Quality: 5

However, note that the template uses placeholders for multiple issues and optimizations. Since we found none, we can leave the security and optimization sections with a single positive note or omit them if the template allows. But the template says:

{{#security_issues}} ... {{/security_issues}}

It will only include the security section if there are security issues. But we have none. Similarly for optimizations, we have a positive note that the change is an optimization, but it's already done. Alternatively, we can suggest no further optimizations.

But the template examples show even if no issues, we can output a positive note. However, the instructions require the structure. Let's see:

We must output the sections only if there are items. Since we don't have any security issues to report, we can skip the Security Review section. Similarly, for optimizations, we have a suggestion about the change being good, but no further suggestions. Alternatively, we can say:

Optimization Suggestions

  • The simplification of the path assignment is an improvement.

But note that the example suggestions are about code changes, and here the change is already made. So maybe we don't need to suggest anything.

Considering the above, we can write:

Script Analysis

  • The change updates the MOONBIT_HOME path assignment to use $nu.home-dir directly, removing a deprecated fallback. This aligns with Nu 0.110.0+.

Security Review

  • No vulnerabilities introduced.

Optimization Suggestions

  • The simplified code is more efficient.

Overall Quality: 5

But to strictly follow the template, we can output:

Script Analysis

  • Updated path assignment to use current $nu.home-dir without fallback, targeting Nu 0.110.0+.

Security Review

  • (none)

Alternatively, omit the security section? The template conditionally includes it. Since the instructions say "Required output structure", we must have the sections only if there are items? But the template uses:

{{#security_issues}} ... {{/security_issues}}

So if we don't have any security issues, we can skip that section. Similarly for optimizations.

But note: the template for optimizations is:

{{#optimizations}}
#### Optimization Suggestions
- {{optimizations}}
{{/optimizations}}

We have at least one optimization note: the code is simplified and more efficient. So we should include it.

Alternatively, we can note that the change itself is an optimization and we don't have further suggestions? But the template expects suggestions for improvements. Since the change is already done, we might not have further suggestions.

Considering the above, we can say:

Script Analysis

  • The change simplifies the assignment of MOONBIT_HOME by directly using $nu.home-dir (removing a fallback to $nu.home-path? which is no longer needed in Nu 0.110.0+).

Security Review

  • No security vulnerabilities found in this change.

Optimization Suggestions

  • The removal of the fallback condition makes the assignment slightly more efficient.

Overall Quality: 5

But note: the change might break for users of older Nu versions? However, the workflow now sets up Nu 0.110.0, so it's acceptable.

Final rating: 5.

However, let me note that the entire script is not reviewed, only the change. But the instructions say "Please review the following code changes", so we focus on the change.

So the response:

Script Analysis

  • Updated MOONBIT_HOME default path logic to use simplified $nu.home-dir instead of chained fallback ($nu.home-path? | default $nu.home-dir?), aligning with Nu 0.110.0+ conventions
  • Maintains proper environment variable handling with null-coalescing ($env.MOONBIT_HOME?)
  • Path construction remains cross-platform via path join
  • Semantic version check (is-semver) preserved for robustness

Security Review

  • ✅ No command injection risks (pure path/native operations)
  • ✅ Safe environment variable handling with optional chaining (? operator)
  • ✅ No credentials/plaintext exposure in changed logic
  • ✅ Permission validation delegated to OS-level path operations

Optimization Suggestions

  • ⚡ Simplified path logic reduces branch conditions (minor performance gain)
  • 🔍 Suggest adding path exists check for $MOONBIT_HOME to prevent errors in subsequent operations
  • 💡 Consider memoizing $MOONBIT_HOME/derived paths if reused in multiple functions

Overall Quality: 5

checklist:
  - Compatibility: 
      - "Nu version: 0.110.0+ compliant"
      - "Cross-platform support: Maintained via path join"
      - "Plugin dependencies: None introduced"
  - Security:
      - "Input sanitization: N/A (no user input)"
      - "Temporary file handling: Not involved"
      - "Env exposure: Properly null-guarded"
  - Reliability:
      - "Error propagation: Maintained via exit 2"
      - "Null handling: Improved via direct home-dir"
      - "Type validation: Preserved version check"
  - Performance:
      - "Lazy evaluation: Not applicable"
      - "Batch processing: Single assignment"
      - "Stream handling: Not involved"

@hustcer hustcer merged commit f7928f2 into main Jan 20, 2026
19 checks passed
@github-actions github-actions bot added this to the v1.18.0 milestone Jan 20, 2026
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.

1 participant