nushell-plugins/scripts/check_version.nu
Jesús Pérez d9ef2f0d5b
Some checks failed
Build and Test / Validate Setup (push) Has been cancelled
Build and Test / Build (darwin-amd64) (push) Has been cancelled
Build and Test / Build (darwin-arm64) (push) Has been cancelled
Build and Test / Build (linux-amd64) (push) Has been cancelled
Build and Test / Build (windows-amd64) (push) Has been cancelled
Build and Test / Build (linux-arm64) (push) Has been cancelled
Build and Test / Security Audit (push) Has been cancelled
Build and Test / Package Results (push) Has been cancelled
Build and Test / Quality Gate (push) Has been cancelled
Nightly Build / Check for Changes (push) Has been cancelled
Nightly Build / Validate Setup (push) Has been cancelled
Nightly Build / Nightly Build (darwin-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (darwin-arm64) (push) Has been cancelled
Nightly Build / Nightly Build (linux-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (windows-amd64) (push) Has been cancelled
Nightly Build / Nightly Build (linux-arm64) (push) Has been cancelled
Nightly Build / Create Nightly Pre-release (push) Has been cancelled
Nightly Build / Notify Build Status (push) Has been cancelled
Nightly Build / Nightly Maintenance (push) Has been cancelled
chore: update all plugins to Nushell 0.111.0
- Bump all 18 plugins from 0.110.0 to 0.111.0
  - Update rust-toolchain.toml channel to 1.93.1 (nu 0.111.0 requires ≥1.91.1)

  Fixes:
  - interprocess pin =2.2.x → ^2.3.1 in nu_plugin_mcp, nu_plugin_nats, nu_plugin_typedialog
    (required by nu-plugin-core 0.111.0)
  - nu_plugin_typedialog: BackendType::Web initializer — add open_browser: false field
  - nu_plugin_auth: implement missing user_info_to_value helper referenced in tests

  Scripts:
  - update_all_plugins.nu: fix [package].version update on minor bumps; add [dev-dependencies]
    pass; add nu-plugin-test-support to managed crates
  - download_nushell.nu: rustup override unset before rm -rf on nushell dir replace;
    fix unclosed ) in string interpolation
2026-03-11 03:22:42 +00:00

115 lines
3.6 KiB
Plaintext

#!/usr/bin/env nu
# Version Consistency Checker
# Ensures nushell system version matches submodule version
# Get nushell version from submodule Cargo.toml
def get_submodule_version [] {
let nushell_cargo = "nushell/Cargo.toml"
if not ($nushell_cargo | path exists) {
error make {msg: "Nushell submodule not found. Please run 'git submodule update --init --recursive'"}
}
try {
let content = open $nushell_cargo
$content.package.version
} catch {
error make {msg: "Could not read nushell version from submodule"}
}
}
# Get installed nushell version - try project binary first, then system
def get_system_version [] {
# Try project binary first (more reliable, avoids broken system nu)
let project_binary = "nushell/target/release/nu"
if ($project_binary | path exists) {
try {
let version = (do { ^$project_binary --version } | complete)
if $version.exit_code == 0 {
return ($version.stdout | str trim)
}
} catch {
# Fall through to system nu
}
}
# Fall back to system nu
try {
nu --version | str trim
} catch {
error make {msg: "Could not get system nushell version - system binary appears broken or missing"}
}
}
# Check if versions match
def check_versions [] {
let submodule_version = get_submodule_version
let system_version = get_system_version
{
submodule: $submodule_version,
system: $system_version,
match: ($submodule_version == $system_version)
}
}
# Main function for version checking
def main [
--fix # Attempt to fix version mismatch
--quiet # Suppress output except errors
] {
let versions = check_versions
if not $quiet {
print $"🔍 Version Check:"
print $" Submodule: ($versions.submodule)"
print $" Project Binary: ($versions.system)"
}
if $versions.match {
if not $quiet {
print "✅ Versions match - OK"
}
return true
} else {
print "❌ Version mismatch detected!"
print $" Expected: ($versions.submodule) - from nushell submodule (Cargo.toml)"
print $" Found: ($versions.system) - project or system binary"
print ""
if $fix {
print "🔧 Attempting to fix version mismatch..."
print "💡 Running update_nushell.sh to install correct version..."
try {
# Call the update_nushell.sh script to fix the installation
let result = run-external "bash" ["scripts/sh/update_nushell.sh", "update"]
print "✅ Nushell updated successfully"
return true
} catch {
print "❌ Failed to update nushell automatically"
print "🛠️ Manual fix required:"
print $" 1. Run: ./scripts/sh/update_nushell.sh update"
print $" 2. Or install nushell ($versions.submodule) manually"
return false
}
} else {
print "🛠️ To fix this issue:"
print " 1. Run: nu scripts/nu/check_version.nu --fix"
print " 2. Or manually: ./scripts/sh/update_nushell.sh update"
return false
}
}
}
# Export function for use by other scripts
export def version_check [--quiet] {
let versions = check_versions
if not $versions.match {
if not $quiet {
print $"❌ Version mismatch: system=($versions.system), required=($versions.submodule)"
}
return false
}
return true
}