nushell-plugins/updates/108/NUSHELL_0.108.0_QUICK_REF.md

241 lines
5.4 KiB
Markdown
Raw Normal View History

# Nushell 0.108.0 Quick Reference Card
**Release:** 2025-10-15 | **Version:** 0.108.0
## 🔴 Critical Breaking Changes (Action Required)
### 1. `into value` → `detect type`
```nushell
# ❌ OLD (0.107)
$data | into value
# ✅ NEW (0.108.0)
$data | update cells {detect type} # For table cells
$value | detect type # For non-tables
$custom_value | into value # For plugin values (NEW)
```
### 2. Stream Error Collection
```nushell
# ❌ OLD (0.107)
let results = $stream | collect
# ✅ NEW (0.108.0)
let results = try {
$stream | collect
} catch { |err|
[] # or handle error
}
```
### 3. `format bits` Endian
```nushell
# ✅ NEW (0.108.0) - Be explicit
format bits --endian native # Pre-0.107 behavior
format bits --endian big # 0.107 default
format bits --endian little # Little endian
```
## 🟡 Polars Plugin Changes
```nushell
# ❌ REMOVED
polars fetch # No replacement
# ⚠️ REQUIRES FLAG
polars pivot --stable # Must be explicit
```
## 🟢 New Features
### MCP Server (AI Agents)
```bash
# Compile with MCP support
cargo build --features mcp
# Start as MCP server
nu --mcp
```
### Inline Completions
```nushell
# Simple inline completions
def deploy [env: string@[dev staging prod]] {
print $"Deploying to ($env)"
}
# With const variable
const environments = [dev staging prod]
def deploy [env: string@$environments] {
print $"Deploying to ($env)"
}
```
### New Date/Time Specifiers
```nushell
date now | format date "%J" # 20251015 (compact date)
date now | format date "%Q" # 143022 (compact time)
date now | format date "%J%Q" # 20251015143022 (sortable)
```
### Enhanced Commands
```nushell
# which - list all commands
which # No args = list all
# HTTP metadata (no --full needed)
let response = http get $url
$response | metadata # Headers now included
# metadata merge
$value | metadata set --merge {priority: 1, tag: "important"}
# each flatten
$data | each --flatten { |item| process $item }
# compact empty improvements
$data | compact --empty # Now recognizes 0-byte binary as empty
```
## 🧪 Experimental Features
### Pipefail (Opt-in)
```nushell
# Enable
$env.config.experimental = { pipefail: true }
# Or command line
nu --experimental-options='pipefail'
# Effect
^false | echo ''
$env.LAST_EXIT_CODE # Now returns 1 (was 0)
```
### Runtime Type Checking (Opt-in)
```nushell
# Enable
$env.config.experimental = { enforce-runtime-annotations: true }
# Effect
let x: int = "not a number" # Now throws runtime error
```
### Reorder Cell Paths (Now Default/Opt-out)
```nushell
# Disable if needed
$env.config.experimental = { reorder-cell-paths: false }
# Default = enabled (performance optimization)
```
## 🪟 Windows Improvements
```nushell
# Device paths now work
open \\.\NUL
save \\.\CON
source NUL
# UNC paths no longer get trailing \
\\server\share # Not \\server\share\
```
## 🛠️ Build Changes
```bash
# Network commands now optional
cargo build --no-default-features --features network
# MCP server support
cargo build --features mcp
```
## 📋 Migration Checklist
- [ ] Find all `into value` usage → Replace with `detect type` or keep for plugin values
- [ ] Add try-catch around stream collections
- [ ] Update `polars fetch` calls → Remove (no replacement)
- [ ] Add `--stable` to `polars pivot` calls
- [ ] Add `--endian` flag to `format bits` calls
- [ ] Test chained power operations (`2 ** 3 ** 4` now right-associative)
- [ ] Update custom builds to add `--features network`
- [ ] Test on Windows if applicable (UNC/device paths)
- [ ] Consider enabling experimental features for testing
- [ ] Update plugin implementations for CustomValue enhancements
## 🔍 Find Breaking Changes in Your Code
```bash
# Search for problematic patterns
rg "into value" . --type nu
rg "polars fetch" . --type nu
rg "format bits" . --type nu | grep -v "endian"
# Test with experimental features
nu --experimental-options='pipefail,enforce-runtime-annotations' script.nu
```
## 📊 Using the Data File
```nushell
# Load module
use nushell_0.108.0_changes.nu *
# Get all changes
get-changes
# Get high impact changes only
get-high-impact-changes
# Get experimental features
get-experimental-features
# Search for specific changes
search-changes "into value"
# Generate migration report
generate-migration-report
```
## 🎯 Priority Levels
| Priority | Changes | Action |
|----------|---------|--------|
| **HIGH** | `into value` rename, Stream errors, Polars fetch | Must fix immediately |
| **MEDIUM** | `format bits` endian, Network builds, Power operator | Should address |
| **LOW** | Windows paths, Completions, HTTP metadata, Date formats | Nice to have |
## 📚 Resources
- **Full Docs:** `NUSHELL_0.108.0_CHANGES.md`
- **Data File:** `nushell_0.108.0_changes.nu`
- **Summary:** `NUSHELL_0.108.0_SUMMARY.md`
- **Release:** https://www.nushell.sh/blog/2025-10-15-nushell_v0_108_0.html
- **GitHub:** https://github.com/nushell/nushell/releases/tag/0.108.0
## 🚀 Quick Migration (Most Users)
```nushell
# 1. Update into value
rg "into value" . --type nu
# Replace: | update cells {detect type}
# 2. Add error handling
# Before: let x = $stream | collect
# After: let x = try { $stream | collect } catch { [] }
# 3. Fix polars (if using)
# Remove: polars fetch
# Update: polars pivot → polars pivot --stable
# 4. Test
nu your_script.nu
```
**Most migrations complete in < 30 minutes!**
---
**Created:** 2025-10-18 | **Document Version:** 1.0