# Nushell Plugins Development Justfile # Convenient recipes for common development tasks # Set shell to bash for compatibility set shell := ["bash", "-c"] # Default recipe - show help default: @just --list # ๐Ÿ” Version Validation Commands # Check nushell version consistency validate-nushell: @echo "๐Ÿ” Validating nushell version consistency..." @./scripts/run.sh --check-only # Fix nushell version mismatches fix-nushell: @echo "๐Ÿ”ง Fixing nushell version mismatches..." @./scripts/run.sh --fix --check-only # ๐Ÿ“Š Status and Information Commands # Show plugin status dashboard status: @echo "๐Ÿ“Š Plugin Status Dashboard" @./scripts/run.sh plugin_status.nu # Show detailed status for all plugins status-all: @echo "๐Ÿ“Š All Plugins Status" @./scripts/run.sh plugin_status.nu --all # Show plugins requiring attention status-attention: @echo "๐Ÿšจ Plugins Requiring Attention" @./scripts/run.sh plugin_status.nu attention # Show summary only status-summary: @echo "๐Ÿ“Š Quick Summary" @./scripts/run.sh plugin_status.nu summary # Update plugin status manually status-update PLUGIN STATUS: @echo "๐Ÿ”„ Updating {{PLUGIN}} status to {{STATUS}}..." @./scripts/run.sh plugin_status.nu update {{PLUGIN}} {{STATUS}} # Mark local development plugins as OK status-mark-locals-ok: @echo "โœ… Marking local development plugins as OK..." @./scripts/run.sh plugin_status.nu update nu_plugin_image ok @./scripts/run.sh plugin_status.nu update nu_plugin_hashes ok @./scripts/run.sh plugin_status.nu update nu_plugin_desktop_notifications ok @echo "โœ… All local plugins marked as OK" # ๐Ÿ”„ Upstream Tracking Commands # Check upstream changes for all plugins upstream-check: @echo "๐Ÿ” Checking upstream changes..." @./scripts/run.sh check_upstream_changes.nu # Check upstream for specific plugin upstream-check-plugin PLUGIN: @echo "๐Ÿ” Checking upstream for {{PLUGIN}}..." @./scripts/run.sh check_upstream_changes.nu --plugin {{PLUGIN}} # Preview merge changes for a plugin upstream-preview PLUGIN: @echo "๐Ÿ‘€ Preview merge for {{PLUGIN}}..." @./scripts/run.sh safe_merge_upstream.nu --preview {{PLUGIN}} # Safely merge upstream changes for a plugin upstream-merge PLUGIN: @echo "๐Ÿ”€ Merging upstream changes for {{PLUGIN}}..." @./scripts/run.sh safe_merge_upstream.nu {{PLUGIN}} # Merge all pending upstream changes upstream-merge-all: @echo "๐Ÿ”€ Merging all pending upstream changes..." @./scripts/run.sh safe_merge_upstream.nu --all # Force merge upstream for a plugin (even if status is OK) upstream-merge-force PLUGIN: @echo "๐Ÿ’ช Force merging {{PLUGIN}}..." @./scripts/run.sh safe_merge_upstream.nu --force {{PLUGIN}} # ๐Ÿ”ง Development Commands # Build all plugins build: @echo "๐Ÿ”จ Building all plugins..." @./scripts/run.sh build_all.nu # Build all plugins with verbose output build-verbose: @echo "๐Ÿ”จ Building all plugins (verbose)..." @./scripts/run.sh build_all.nu --verbose # Build all plugins in parallel (experimental) build-parallel: @echo "โšก Building all plugins in parallel..." @./scripts/run.sh build_all.nu --parallel # Create a new plugin from template make-plugin PLUGIN_NAME: @echo "๐Ÿ†• Creating new plugin: {{PLUGIN_NAME}}" @./scripts/run.sh make_plugin.nu {{PLUGIN_NAME}} # Update nu dependency versions update-nu-versions: @echo "๐Ÿ”„ Updating nu dependency versions..." @./scripts/run.sh update_nu_versions.nu # List current nu dependency versions list-nu-versions: @echo "๐Ÿ“‹ Current nu dependency versions:" @./scripts/run.sh update_nu_versions.nu list # Update nushell submodule update-nushell: @echo "๐Ÿ”„ Updating nushell submodule..." @bash scripts/sh/update_nushell.sh update # ๐Ÿ“ฆ Distribution Commands # Collect built plugins for distribution collect: @echo "๐Ÿ“ฆ Collecting plugins for distribution..." @./scripts/run.sh collect_install.nu # List available built plugins collect-list: @echo "๐Ÿ“‹ Available built plugins:" @./scripts/run.sh collect_install.nu --list # Create distribution package pack: @echo "๐Ÿ“ฆ Creating distribution package..." @./scripts/run.sh pack_dist.nu # Show what would be packaged pack-list: @echo "๐Ÿ“‹ Files that would be packaged:" @./scripts/run.sh pack_dist.nu --list # ๐Ÿงช Testing and Quality Commands # Run cargo check on all plugins check: @echo "๐Ÿ” Running cargo check on all plugins..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Checking $$plugin..."; \ cd "$$plugin" && cargo check && cd ..; \ fi; \ done # Run cargo test on all plugins test: @echo "๐Ÿงช Running tests on all plugins..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Testing $$plugin..."; \ cd "$$plugin" && cargo test && cd ..; \ fi; \ done # Run cargo clippy on all plugins lint: @echo "๐Ÿ“ Running clippy on all plugins..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Linting $$plugin..."; \ cd "$$plugin" && cargo clippy -- -D warnings && cd ..; \ fi; \ done # Format all Rust code fmt: @echo "๐ŸŽจ Formatting Rust code..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Formatting $$plugin..."; \ cd "$$plugin" && cargo fmt && cd ..; \ fi; \ done # ๐Ÿ”’ Security and Maintenance Commands # Run cargo audit on all plugins audit: @echo "๐Ÿ”’ Running security audit..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Auditing $$plugin..."; \ cd "$$plugin" && cargo audit && cd ..; \ fi; \ done # Update all dependencies (careful!) update-deps: @echo "โฌ†๏ธ Updating dependencies (this may break things)..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Updating deps in $$plugin..."; \ cd "$$plugin" && cargo update && cd ..; \ fi; \ done # Clean all build artifacts clean: @echo "๐Ÿงน Cleaning build artifacts..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Cleaning $$plugin..."; \ cd "$$plugin" && cargo clean && cd ..; \ fi; \ done # ๐Ÿ“‹ Plugin-specific Commands # Run command on specific plugin plugin PLUGIN CMD: @echo "๐Ÿ”ง Running '{{CMD}}' on {{PLUGIN}}" @cd {{PLUGIN}} && {{CMD}} # Build specific plugin build-plugin PLUGIN: @echo "๐Ÿ”จ Building {{PLUGIN}}..." @cd {{PLUGIN}} && cargo build --release # Test specific plugin test-plugin PLUGIN: @echo "๐Ÿงช Testing {{PLUGIN}}..." @cd {{PLUGIN}} && cargo test # Check specific plugin check-plugin PLUGIN: @echo "๐Ÿ” Checking {{PLUGIN}}..." @cd {{PLUGIN}} && cargo check # Install specific plugin locally install-plugin PLUGIN: @echo "๐Ÿ“ฅ Installing {{PLUGIN}} locally..." @cd {{PLUGIN}} && cargo build --release @echo "To add to nushell: plugin add ./{{PLUGIN}}/target/release/{{PLUGIN}}" # ๐ŸŽฏ Workflow Commands # Complete development workflow: check version, upstream, build, test dev-flow: @echo "๐ŸŽฏ Running complete development workflow..." @just validate-nushell @just upstream-check @just build @just test @just status # Complete release workflow: check version, build, collect, package release-flow: @echo "๐Ÿš€ Running complete release workflow..." @just validate-nushell @just build @just collect @just pack # Quality check workflow: check version, format, lint, test quality-flow: @echo "โœจ Running quality check workflow..." @just validate-nushell @just fmt @just lint @just test # Update workflow: update nushell, fix version, update versions, check upstream update-flow: @echo "๐Ÿ”„ Running update workflow..." @just update-nushell @just fix-nushell @just update-nu-versions @just upstream-check # ๐Ÿ†˜ Help and Information # Show plugin registry information registry: @echo "๐Ÿ“‹ Plugin Registry Information:" @if [ -f etc/plugin_registry.toml ]; then \ echo "Registry file: etc/plugin_registry.toml"; \ echo ""; \ echo "Plugins with upstream:"; \ grep -A2 "upstream_url.*=" etc/plugin_registry.toml | grep -v "^--" || true; \ else \ echo "Registry file not found!"; \ fi # Manage upstream exclusions exclude PLUGIN ACTION="add": #!/usr/bin/env bash EXCLUDE_FILE="etc/upstream_exclude.toml" if [ "$ACTION" = "add" ]; then echo "๐Ÿšซ Adding {{PLUGIN}} to exclusion list..." # This is a simplified version - you might want to use a proper TOML parser if grep -q "^plugins = \[" "$EXCLUDE_FILE"; then sed -i.bak "/^plugins = \[/s/\]/\"{{PLUGIN}}\", \]/" "$EXCLUDE_FILE" echo "โœ… Added {{PLUGIN}} to exclusions" else echo "โš ๏ธ Please manually add {{PLUGIN}} to $EXCLUDE_FILE" fi elif [ "$ACTION" = "remove" ]; then echo "โœ… Removing {{PLUGIN}} from exclusion list..." sed -i.bak "s/\"{{PLUGIN}}\",*[[:space:]]*//" "$EXCLUDE_FILE" echo "โœ… Removed {{PLUGIN}} from exclusions" elif [ "$ACTION" = "list" ]; then echo "๐Ÿ“‹ Currently excluded plugins:" if [ -f "$EXCLUDE_FILE" ]; then grep -A10 "\[exclude\]" "$EXCLUDE_FILE" | grep -E "^[[:space:]]*\"" | sed 's/[",]//g' | sed 's/^[[:space:]]*/ - /' else echo "No exclusions file found" fi else echo "โŒ Unknown action: $ACTION" echo "Usage: just exclude PLUGIN [add|remove|list]" fi # Show excluded plugins exclude-list: @just exclude "" list # Show environment configuration env-info: @echo "๐ŸŒ Environment Configuration:" @if [ -f env ]; then \ cat env; \ else \ echo "No env file found"; \ fi # Show system information system-info: @echo "๐Ÿ’ป System Information:" @echo "OS: $$(uname -s)" @echo "Architecture: $$(uname -m)" @echo "Nushell: $$(nu --version 2>/dev/null || echo 'Not installed')" @echo "Rust: $$(rustc --version 2>/dev/null || echo 'Not installed')" @echo "Cargo: $$(cargo --version 2>/dev/null || echo 'Not installed')" @echo "Just: $$(just --version 2>/dev/null || echo 'Not installed')" # Validate setup and dependencies validate: @echo "โœ… Validating setup..." @echo "Checking required tools:" @command -v nu >/dev/null 2>&1 && echo "โœ… nushell" || echo "โŒ nushell (required)" @command -v cargo >/dev/null 2>&1 && echo "โœ… cargo" || echo "โŒ cargo (required)" @command -v git >/dev/null 2>&1 && echo "โœ… git" || echo "โŒ git (required)" @command -v just >/dev/null 2>&1 && echo "โœ… just" || echo "โŒ just (optional but recommended)" @echo "" @echo "Checking directory structure:" @[ -d scripts ] && echo "โœ… scripts directory" || echo "โŒ scripts directory" @[ -d etc ] && echo "โœ… etc directory" || echo "โŒ etc directory" @[ -f etc/plugin_registry.toml ] && echo "โœ… plugin registry" || echo "โŒ plugin registry" @[ -f etc/upstream_exclude.toml ] && echo "โœ… upstream exclusions" || echo "โš ๏ธ upstream exclusions (optional)" @[ -f env ] && echo "โœ… env file" || echo "โš ๏ธ env file (optional)" @echo "" @echo "Plugin directories:" @ls -d nu_plugin_* 2>/dev/null | wc -l | xargs echo "๐Ÿ“ฆ Found plugins:" # ๐Ÿ“š Documentation Commands # Generate plugin documentation docs: @echo "๐Ÿ“š Generating documentation..." @for plugin in nu_plugin_*; do \ if [ -d "$$plugin" ]; then \ echo "Generating docs for $$plugin..."; \ cd "$$plugin" && cargo doc --no-deps && cd ..; \ fi; \ done # Open documentation in browser docs-open PLUGIN: @echo "๐Ÿ“– Opening documentation for {{PLUGIN}}..." @cd {{PLUGIN}} && cargo doc --open # ๐Ÿงฐ Advanced Commands # Interactive plugin selection (requires fzf) interactive: #!/usr/bin/env bash if command -v fzf >/dev/null 2>&1; then echo "๐ŸŽฏ Interactive Plugin Selection" PLUGIN=$(ls -d nu_plugin_* | fzf --prompt="Select plugin: ") if [ -n "$PLUGIN" ]; then ACTION=$(echo -e "build\ntest\ncheck\nlint\nupstream-check\nupstream-merge\ninstall" | fzf --prompt="Select action: ") if [ -n "$ACTION" ]; then case $ACTION in "upstream-check") just upstream-check-plugin $PLUGIN ;; "upstream-merge") just upstream-merge $PLUGIN ;; "build") just build-plugin $PLUGIN ;; "test") just test-plugin $PLUGIN ;; "check") just check-plugin $PLUGIN ;; "lint") cd $PLUGIN && cargo clippy ;; "install") just install-plugin $PLUGIN ;; esac fi fi else echo "โŒ fzf not installed. Install with: brew install fzf (macOS) or apt install fzf (Ubuntu)" fi # Watch for changes and rebuild (requires entr) watch PLUGIN: #!/usr/bin/env bash if command -v entr >/dev/null 2>&1; then echo "๐Ÿ‘€ Watching {{PLUGIN}} for changes..." find {{PLUGIN}}/src -name "*.rs" | entr just build-plugin {{PLUGIN}} else echo "โŒ entr not installed. Install with: brew install entr (macOS) or apt install entr (Ubuntu)" fi