curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Rust
cargo install just # Just (optional but recommended)
# Note: Nushell will be auto-installed if missing
```
### Basic Usage
```bash
# Clone the repository
git clone <repository-url>
cd nushell-plugins
# Validate nushell version consistency (recommended first step)
just validate-nushell
# Using Just (recommended)
just status # Show plugin status
just status-mark-locals-ok # Mark local plugins as OK (recommended)
just upstream-check # Check for upstream updates
just build # Build all plugins
just dev-flow # Complete development workflow
# Using scripts directly (with automatic version checking)
./scripts/run.sh plugin_status.nu
./scripts/run.sh check_upstream_changes.nu
./scripts/run.sh build_all.nu
```
### ⚠️ Critical: Version Consistency
**This system requires version consistency between your installed nushell and the submodule version.** All operations automatically check version consistency and will fail if versions don't match.
- **Auto-fix**: `just fix-nushell` or `./scripts/run.sh --fix --check-only`
- **Manual check**: `just validate-nushell`
## 🎯 Why This Repository?
### The Challenge
Developing nushell plugins involves several challenges:
nu install_nu_plugins.nu --plugins [nu_plugin_clipboard]
```
### Method 3: Individual Plugin Installation
```bash
# Build and install single plugin
cd nu_plugin_clipboard
cargo build --release
plugin add target/release/nu_plugin_clipboard
```
### Method 4: Using Cargo
```bash
# For plugins published to crates.io
cargo install nu_plugin_clipboard
plugin add ~/.cargo/bin/nu_plugin_clipboard
```
## 🎮 Using Just Recipes
Just provides convenient shortcuts for all common tasks with **automatic version validation**:
### Version Validation Commands (New!)
```bash
just validate-nushell # Check nushell version consistency
just fix-nushell # Auto-fix version mismatches
```
### Basic Commands
```bash
just # Show all available recipes
just status # Plugin status dashboard
just build # Build all plugins
just test # Test all plugins
just clean # Clean build artifacts
```
### Upstream Management
```bash
just upstream-check # Check for upstream updates
just upstream-merge highlight # Merge specific plugin
just upstream-merge-all # Merge all pending
```
### Development Workflows
**All workflows now include mandatory version validation as the first step:**
```bash
just dev-flow # Validate → Check → Build → Test → Status
just release-flow # Validate → Build → Collect → Package
just quality-flow # Validate → Format → Lint → Test
just update-flow # Update → Fix Version → Update versions → Check upstream
```
### Plugin-Specific Operations
```bash
just build-plugin clipboard # Build specific plugin
just test-plugin clipboard # Test specific plugin
just install-plugin clipboard # Install plugin locally
```
### Advanced Features
```bash
just interactive # Interactive plugin selection (requires fzf)
just watch clipboard # Watch for changes and rebuild (requires entr)
just validate # Validate setup and dependencies
```
## ❓ FAQ
### Q: Why do I get "Version mismatch detected" errors?
**A:** This system requires your installed nushell version to match the submodule version for consistency. All operations automatically check version consistency and will fail if versions don't match.
**Solutions:**
- **Auto-fix**: `just fix-nushell` or `./scripts/run.sh --fix --check-only`
**A:** The repository has been consolidated to eliminate script duplication. The old bash wrappers in `scripts/sh/` have been removed in favor of:
- **Universal wrapper**: `./scripts/run.sh` with automatic version checking
- **Direct nu scripts**: All scripts moved from `scripts/nu/` to `scripts/`
- **Just recipes**: Updated to use the new system
### Q: How does the new script system work?
**A:** The new system provides:
1.**Universal wrapper** (`scripts/run.sh`) with automatic nushell detection and version validation
2.**Consolidated scripts** - all nu scripts in `scripts/` directory
3.**Mandatory version checking** - every operation validates version consistency
4.**Auto-installation** - missing nushell is automatically installed
### Q: How does automatic upstream tracking work?
**A:** The system fetches changes from upstream repositories and analyzes them. If only nu_* dependencies changed (like nu-plugin, nu-protocol), it automatically marks the plugin as "OK". Other changes are flagged for manual review. You can exclude specific plugins from tracking using the `etc/upstream_exclude.toml` file.
### Q: What happens to my local changes during upstream merges?
**A:** Local changes are preserved. The system:
1. Creates backup branches before any merge
2. Applies upstream changes in a temporary branch
3. Restores your local nu_* dependency versions
4. Tests compilation before applying changes
5. Rolls back on any failure
### Q: Can I disable automatic upstream tracking for a plugin?
**A:** Yes, set `auto_ok_on_nu_deps_only = false` in `etc/plugin_registry.toml` for that plugin.
### Q: How do I add a new plugin to the repository?
**A:** Use the template generator:
```bash
just make-plugin nu_plugin_myfeature
# or
nu scripts/nu/make_plugin.nu nu_plugin_myfeature
```
### Q: What if upstream tracking fails?
**A:** Check the plugin status with `just status`. Failed plugins show error details. Common issues:
- Network connectivity to upstream repository
- Authentication for private repositories
- Merge conflicts requiring manual resolution
### Q: How do I update nushell dependency versions?
**A:** Use the version updater:
```bash
just update-nu-versions # Update all plugins
just list-nu-versions # Show current versions
```
### Q: Can I use this with my own private plugins?
**A:** Yes! Add your private repository URLs to `etc/plugin_registry.toml`. The system supports SSH URLs for private repositories.
### Q: How do I distribute plugins to other systems?
**A:** Use the distribution pipeline:
```bash
just build # Build all plugins
just collect # Collect binaries
just pack # Create archive
```
The resulting archive contains all binaries and installation scripts.
### Q: What's the difference between shell scripts and nushell scripts?
**A:**
- **Nushell scripts** (`scripts/nu/`): Primary implementation with full features
- **Shell scripts** (`scripts/sh/`): Wrappers for compatibility with non-nushell environments
- Both provide the same functionality, use whichever fits your environment
### Q: How do I contribute a new plugin?
**A:**
1. Create the plugin: `just make-plugin nu_plugin_yourname`
2. Implement your functionality
3. Add upstream URL to `etc/plugin_registry.toml` if it has one
4. Test: `just build-plugin nu_plugin_yourname`
5. Submit a pull request
### Q: How do I exclude plugins from upstream tracking?
**A:** Edit `etc/upstream_exclude.toml` to exclude plugins from specific operations:
- Add to `[exclude]` section to exclude from all operations
- Add to `[exclude.check]` to skip automatic checks
- Add to `[exclude.merge]` to prevent automatic merging
- Use patterns like `nu_plugin_test_*` to exclude multiple plugins
You can also use Just commands:
```bash
just exclude nu_plugin_test add # Add to exclusion
just exclude nu_plugin_test remove # Remove from exclusion
just exclude-list # Show excluded plugins
```
### Q: Can I use this system for other Rust projects?
**A:** The upstream tracking and dependency management concepts can be adapted, but this system is specifically designed for nushell plugins with nu_* dependencies.
## 🤝 Contributing
1. Fork the repository
2. Create a feature branch: `git checkout -b feature/amazing-feature`
3. Make your changes
4. Test thoroughly: `just quality-flow`
5. Commit your changes: `git commit -m 'Add amazing feature'`
6. Push to the branch: `git push origin feature/amazing-feature`
7. Open a pull request
### Development Guidelines
- Follow existing code style and patterns
- Add tests for new functionality
- Update documentation for user-facing changes
- Use `just quality-flow` before submitting
- All scripts should work from repository root
### Adding New Plugins
- Use the template generator: `just make-plugin nu_plugin_name`
- Follow nushell plugin conventions
- Add comprehensive documentation
- Include examples and tests
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 🙏 Acknowledgments
- [Nushell Team](https://www.nushell.sh/) for the amazing shell and plugin system
- Plugin authors for their contributions to the nushell ecosystem