nushell-plugins/scripts/check_version.nu
Jesús Pérez b99dcc83c3 feat: major repository modernization and tracking cleanup
## Summary

Comprehensive repository cleanup focusing on plugin dependency management, documentation improvements, and git tracking optimization.

## Key Changes

### 🔧 Core Infrastructure
- Synchronized all nu-* dependencies across plugins for version consistency
- Enhanced upstream tracking and automation systems
- Removed nushell directory from git tracking for cleaner repository management

### 📚 Documentation
- Significantly expanded README.md with comprehensive development guides
- Added detailed workflow documentation and command references
- Improved plugin collection overview and usage examples

### 🧹 Repository Cleanup
- Removed legacy bash scripts (build-all.sh, collect-install.sh, make_plugin.sh)
- Streamlined automation through unified justfile and nushell script approach
- Updated .gitignore with nushell directory and archive patterns
- Removed nushell directory from git tracking to prevent unwanted changes

### 🔌 Plugin Updates
- **nu_plugin_image**: Major refactoring with modular architecture improvements
- **nu_plugin_hashes**: Enhanced functionality and build system improvements
- **nu_plugin_highlight**: Updated for new plugin API compatibility
- **nu_plugin_clipboard**: Dependency synchronization
- **nu_plugin_desktop_notifications**: Version alignment
- **nu_plugin_port_extension & nu_plugin_qr_maker**: Consistency updates
- **nu_plugin_kcl & nu_plugin_tera**: Submodule synchronization

### 🏗️ Git Tracking Optimization
- Removed nushell directory from version control for cleaner repository management
- Added comprehensive .gitignore patterns for build artifacts and archives

## Statistics
- 2,082 files changed
- 2,373 insertions, 339,936 deletions
- Net reduction of 337,563 lines (primarily from removing nushell directory tracking)

## Benefits
- Complete version consistency across all plugins
- Cleaner repository with optimized git tracking
- Improved developer experience with streamlined workflows
- Enhanced documentation and automation
- Reduced repository size and complexity

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 15:18:58 +01:00

101 lines
3.0 KiB
Plaintext
Executable File

#!/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
def get_system_version [] {
try {
nu --version | str trim
} catch {
error make {msg: "Could not get system nushell version"}
}
}
# 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 $" System: ($versions.system)"
}
if $versions.match {
if not $quiet {
print "✅ Versions match - OK"
}
return true
} else {
print "❌ Version mismatch detected!"
print $" Expected: ($versions.submodule) - from submodule"
print $" Found: ($versions.system) - system nushell"
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
}