nushell-plugins/justfile

422 lines
13 KiB
Makefile
Raw Normal View History

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
# 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