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
- 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
1 line
11 KiB
Markdown
1 line
11 KiB
Markdown
# Registering Nushell Core Plugins\n\n**Version**: 1.0.0\n**Updated**: 2025-10-22\n**Nushell**: 0.108.0+\n\n## Overview\n\nNushell core plugins are built-in plugins that come with Nushell when you build it with the `--workspace` flag. They provide essential functionality like data analysis, format conversion, Git integration, and more.\n\n**Core plugins include**:\n\n- `nu_plugin_polars` - Data analysis with Polars\n- `nu_plugin_formats` - Format conversion\n- `nu_plugin_inc` - Increment operations\n- `nu_plugin_gstat` - Git status information\n- `nu_plugin_query` - Advanced querying\n- `nu_plugin_custom_values` - Custom value handling\n- `nu_plugin_example` - Example plugin template\n- `nu_plugin_stress_internals` - Stress testing\n\n---\n\n## How Plugin Registration Works\n\nWhen you register a plugin, you're telling Nushell where to find the plugin binary and to load it automatically. This happens by:\n\n1. **Registering**: `nu -c "plugin add /path/to/nu_plugin_*"`\n - Adds plugin path to Nushell config\n - Plugin loads on next Nushell startup\n\n2. **Listing**: `nu -c "plugin list"`\n - Shows all registered plugins\n - Verifies registration worked\n\n3. **Removing**: `nu -c "plugin rm plugin_name"`\n - Removes plugin from config\n - Plugin unloads after restart\n\n---\n\n## Method 1: Manual Registration\n\n### Register a Single Core Plugin\n\n```bash\n# After building nushell with --workspace\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_polars"\n```\n\nReplace the path with your actual Nushell target directory.\n\n### Register Multiple Core Plugins\n\n```bash\n# Register all built plugins\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_polars"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_formats"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_inc"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_gstat"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_query"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_custom_values"\n```\n\n### Verify Registration\n\n```bash\nnu -c "plugin list"\n```\n\nExpected output shows all registered plugins with their versions.\n\n---\n\n## Method 2: Script-Based Registration\n\n### Using the Installation Script\n\nIf plugins are in `~/.local/bin/`:\n\n```bash\n./install_from_manifest.nu --all --register-only\n```\n\nThis registers all plugins from the manifest.\n\n### Using a Custom Nushell Script\n\nCreate a file `register_core_plugins.nu`:\n\n```nushell\n#!/usr/bin/env nu\n\n# Register Nushell core plugins\ndef register_core_plugins [plugin_dir: string] {\n let core_plugins = [\n "nu_plugin_polars"\n "nu_plugin_formats"\n "nu_plugin_inc"\n "nu_plugin_gstat"\n "nu_plugin_query"\n "nu_plugin_custom_values"\n ]\n\n for plugin in $core_plugins {\n let plugin_path = $"($plugin_dir)/($plugin)"\n\n if ($plugin_path | path exists) {\n try {\n # Remove old registration if exists\n nu -c $"plugin rm ($plugin | str replace '^nu_plugin_' '')" out+err>| null\n } catch {}\n\n # Register new\n nu -c $"plugin add ($plugin_path)"\n print $"✓ Registered: ($plugin)"\n } else {\n print $"✗ Not found: ($plugin_path)"\n }\n }\n}\n\n# Main\nlet plugin_dir = if ($env | get -i NUSHELL_PLUGIN_DIR) != null {\n $env.NUSHELL_PLUGIN_DIR\n} else {\n "/path/to/nushell/target/release"\n}\n\nregister_core_plugins $plugin_dir\n```\n\nRun it:\n\n```bash\nchmod +x register_core_plugins.nu\n./register_core_plugins.nu\n```\n\n---\n\n## Method 3: After Building Nushell\n\n### Step-by-Step After `cargo build --workspace`\n\n**1. Build Nushell with workspace (includes core plugins)**:\n\n```bash\ncd nushell\ncargo build --release --workspace\n```\n\n**2. Find where core plugins were built**:\n\n```bash\nls nushell/target/release/nu_plugin_*\n```\n\n**3. Copy to installation directory** (optional, for easy access):\n\n```bash\ncp nushell/target/release/nu_plugin_* ~/.local/bin/\n```\n\n**4. Register plugins**:\n\n```bash\n# Option A: Register from build directory\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_polars"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_formats"\n# ... repeat for all core plugins\n\n# Option B: Register from ~/.local/bin/\nnu -c "plugin add ~/.local/bin/nu_plugin_polars"\nnu -c "plugin add ~/.local/bin/nu_plugin_formats"\n# ... repeat for all core plugins\n```\n\n**5. Verify**:\n\n```bash\nnu -c "plugin list"\n```\n\n---\n\n## Method 4: Bulk Registration Script\n\n### Create `register_all_core_plugins.sh`\n\n```bash\n#!/bin/bash\n\n# Nushell core plugins registration script\n# Usage: ./register_all_core_plugins.sh /path/to/nushell/target/release\n\nPLUGIN_DIR="${1:-.}"\n\nif [ ! -d "$PLUGIN_DIR" ]; then\n echo "Error: Plugin directory not found: $PLUGIN_DIR"\n exit 1\nfi\n\nPLUGINS=(\n "nu_plugin_polars"\n "nu_plugin_formats"\n "nu_plugin_inc"\n "nu_plugin_gstat"\n "nu_plugin_query"\n "nu_plugin_custom_values"\n)\n\necho "Registering Nushell core plugins from: $PLUGIN_DIR"\necho ""\n\nfor plugin in "${PLUGINS[@]}"; do\n plugin_path="$PLUGIN_DIR/$plugin"\n\n if [ -f "$plugin_path" ]; then\n echo "Registering: $plugin"\n\n # Remove old registration\n nu -c "plugin rm ${plugin#nu_plugin_}" 2>/dev/null || true\n\n # Register new\n nu -c "plugin add $plugin_path"\n\n if [ $? -eq 0 ]; then\n echo "✓ Success: $plugin"\n else\n echo "✗ Failed: $plugin"\n fi\n else\n echo "✗ Not found: $plugin_path"\n fi\ndone\n\necho ""\necho "Registration complete!"\necho ""\necho "Verify with: nu -c \"plugin list\""\n```\n\nRun it:\n\n```bash\nchmod +x register_all_core_plugins.sh\n./register_all_core_plugins.sh /path/to/nushell/target/release\n```\n\n---\n\n## Finding Core Plugins\n\n### After Building with `--workspace`\n\nCore plugins are built in the same directory as the `nu` binary:\n\n```bash\n# Find where they're built\nfind nushell/target/release -name "nu_plugin_*" -type f\n\n# List them\nls -lh nushell/target/release/nu_plugin_*\n```\n\n### Checking Installed Plugins\n\n```bash\n# See what's currently registered\nnu -c "plugin list"\n\n# Get detailed info\nnu -c "plugin list | each { |it| {name: $it.name, version: $it.version, path: $it.path} }"\n```\n\n---\n\n## Troubleshooting\n\n### Problem: "Plugin not found"\n\n**Cause**: Plugin binary doesn't exist at specified path\n\n**Solution**:\n\n1. Verify you built with `--workspace`: `cargo build --release --workspace`\n2. Check plugin exists: `ls nushell/target/release/nu_plugin_*`\n3. Use correct full path: `nu -c "plugin add /full/path/to/nu_plugin_name"`\n\n### Problem: "Plugin already registered"\n\n**Solution**: Remove old registration first:\n\n```bash\nnu -c "plugin rm polars" # Remove by short name\n```\n\nThen register new path:\n\n```bash\nnu -c "plugin add /path/to/nu_plugin_polars"\n```\n\n### Problem: Plugin not loading after registration\n\n**Solution**:\n\n1. Restart Nushell: `exit && nu`\n2. Check registration: `nu -c "plugin list"`\n3. Verify plugin path exists: `ls -l /path/to/plugin`\n4. Check permissions: `chmod +x /path/to/nu_plugin_*`\n\n### Problem: Multiple versions of same plugin\n\n**Solution**: Remove old versions before registering new:\n\n```bash\n# Remove\nnu -c "plugin rm polars"\n\n# Verify removed\nnu -c "plugin list"\n\n# Register new path\nnu -c "plugin add /new/path/to/nu_plugin_polars"\n```\n\n---\n\n## Common Registration Scenarios\n\n### Scenario 1: Fresh Nushell Build\n\n```bash\n# 1. Build with workspace\ncd ~/nushell\ncargo build --release --workspace\n\n# 2. Register all core plugins\nfor plugin in ~/nushell/target/release/nu_plugin_*; do\n nu -c "plugin add $plugin"\ndone\n\n# 3. Verify\nnu -c "plugin list"\n```\n\n### Scenario 2: Multiple Nushell Versions\n\n```bash\n# Register from specific version\nnu -c "plugin add /opt/nushell-0.108.0/nu_plugin_polars"\n```\n\nEach Nushell version can have different plugins.\n\n### Scenario 3: Distribution Installation\n\n```bash\n# If plugins are in distribution\n./install_from_manifest.nu --all --register-only\n\n# Or manually\nnu -c "plugin add ./bin/nu_plugin_polars"\nnu -c "plugin add ./bin/nu_plugin_formats"\n```\n\n### Scenario 4: Development Workflow\n\n```bash\n# After each build during development\ncargo build --release --workspace -p nu_plugin_polars\n\n# Re-register\nnu -c "plugin rm polars"\nnu -c "plugin add ./target/release/nu_plugin_polars"\n\n# Test in new shell\nexit && nu\n```\n\n---\n\n## Plugin Configuration\n\n### Where Registration Happens\n\nPlugins are registered in:\n\n```plaintext\n~/.config/nushell/env.nu\n```\n\nEach registration adds a line like:\n\n```nushell\nplugin add /path/to/nu_plugin_polars\n```\n\n### Manual Configuration\n\nIf needed, you can manually edit `env.nu`:\n\n```bash\n$EDITOR ~/.config/nushell/env.nu\n\n# Add:\nplugin add /path/to/nu_plugin_polars\nplugin add /path/to/nu_plugin_formats\n```\n\nThen restart Nushell.\n\n---\n\n## Best Practices\n\n✅ **DO**:\n\n- Use absolute paths: `/full/path/to/nu_plugin_name`\n- Remove old registration before re-registering\n- Verify plugins exist before registering\n- Check permissions: `chmod +x /path/to/plugin`\n- Test after registration: `exit && nu`\n- Use consistent plugin directory (e.g., `~/.local/bin/`)\n\n❌ **DON'T**:\n\n- Use relative paths (they may not work after shell restart)\n- Register plugins that don't exist\n- Register without absolute paths\n- Forget to restart shell after registration\n- Keep multiple copies of same plugin in different locations\n\n---\n\n## Quick Reference\n\n| Task | Command |\n|------|---------|\n| Register single | `nu -c "plugin add /path/to/nu_plugin_name"` |\n| Register all | Use loop or script (see above) |\n| List all | `nu -c "plugin list"` |\n| Remove | `nu -c "plugin rm plugin_name"` |\n| Verify | `nu -c "plugin list"` or restart shell |\n| Check path | `nu -c "plugin list \| get path"` |\n\n---\n\n## Related Documentation\n\n- **Nushell Official**: <https://www.nushell.sh/book/plugins.html>\n- **Distribution System**: See `DISTRIBUTION_SYSTEM.md`\n- **Installation**: See `INSTALLATION_QUICK_START.md`\n- **Full Workflow**: See `DISTRIBUTION_INSTALLER_WORKFLOW.md`\n\n---\n\n## Summary\n\n**To register Nushell core plugins**:\n\n1. **Build with workspace**: `cargo build --release --workspace`\n2. **Register each plugin**: `nu -c "plugin add /path/to/nu_plugin_name"`\n3. **Verify**: `nu -c "plugin list"`\n4. **Restart**: `exit && nu`\n\nThat's it! Core plugins work exactly like external plugins - just `plugin add` with the full path to the binary. |