nushell-plugins/guides/distribution-system.md

1 line
8.7 KiB
Markdown
Raw Permalink Normal View History

# Nushell Distribution System (Streamlined)\n\n**Version**: 1.0.0 (Consolidated)\n**Date**: 2025-10-22\n**Status**: ✅ Complete and tested\n\n## Overview\n\nThis is a **smart, minimal distribution system** for Nushell plugins that:\n\n- ✅ Installs Nushell binary and/or plugins\n- ✅ Automatically discovers available components\n- ✅ Provides preset plugin selections (essential, development, full)\n- ✅ Supports interactive selection or command-line specification\n- ✅ Includes dry-run mode for previewing changes\n- ✅ Manages both installation and plugin registration\n\n## Core Components\n\n### 1. **Distribution Manifest Generator** (`scripts/create_distribution_manifest.nu`)\n\n**Purpose**: Auto-generate manifest from actual binaries in distribution\n\n```bash\n# Scan current directory for plugins\n./scripts/create_distribution_manifest.nu\n\n# Scan specific directory\n./scripts/create_distribution_manifest.nu /path/to/plugins\n\n# Custom output file\n./scripts/create_distribution_manifest.nu --output manifest.json\n```\n\n**Output**: `DISTRIBUTION_MANIFEST.json`\n\n```json\n{\n "version": "1.0.0",\n "created": "2025-10-22T10:52:08Z",\n "source_directory": "/path/to/plugins",\n "total_plugins": 13,\n "plugins": [\n {\n "name": "nu_plugin_auth",\n "purpose": "Authentication (JWT, MFA)",\n "path": "/path/to/plugins/nu_plugin_auth",\n "size_bytes": 11846592\n }\n // ... more plugins\n ]\n}\n```\n\n### 2. **Smart Distribution Installer** (`scripts/install_from_manifest.nu`)\n\n**Purpose**: Install and register Nushell + plugins based on manifest\n\n```bash\n# Interactive menu (prompts for selection)\n./install_from_manifest.nu\n\n# List available plugins\n./install_from_manifest.nu --list\n\n# Install everything\n./install_from_manifest.nu --all\n\n# Use preset (essential, development, full)\n./install_from_manifest.nu --preset essential\n\n# Install specific plugins\n./install_from_manifest.nu --select auth kms orchestrator\n\n# Dry-run (preview without changes)\n./install_from_manifest.nu --all --check\n\n# Install only, skip registration\n./install_from_manifest.nu --all --install-only\n\n# Register only, skip installation\n./install_from_manifest.nu --all --register-only\n\n# Custom manifest location\n./install_from_manifest.nu --manifest /path/to/manifest.json\n```\n\n## Usage Workflow\n\n### For Distribution Creators\n\n**Step 1: Prepare Distribution Directory**\n\n```plaintext\ndistribution/\n├── bin/\n│ ├── nu_plugin_auth\n│ ├── nu_plugin_kms\n│ ├── nu_plugin_orchestrator\n│ └── ... (all plugin binaries)\n├── nu (optional - nushell binary)\n└── install_from_manifest.nu (symlink to script)\n```\n\n**Step 2: Generate Manifest**\n\n```bash\ncd distribution\n../../scripts/create_distribution_manifest.nu bin --output DISTRIBUTION_MANIFEST.json\n```\n\n**Step 3: Package for Distribution**\n\n```bash\ntar -czf nushell-plugins-distribution.tar.gz distribution/\n```\n\n### For End Users\n\n**Step 1: Extract Distribution**\n\n```bash\ntar -xzf nushell-plugins-distribution.tar.gz\ncd distribution\n```\n\n**Step 2: Preview Available Plugins**\n\n```bash\n./install_from_manifest.nu --list\n```\n\n**Step 3: Install Preferred Preset**\n\n```bash\n# Essential plugins (5 core plugins)\n./install_from_manifest.nu --preset essential\n\n# Development plugins (8 plugins)\n./install_from_manifest.nu --preset development\n\n# All plugins\n./install_from_manifest.nu --all\n```\n\n**Step 4: Verify Installation**\n\n```bash\nnu -c "plugin list"\n```\n\n## Available Presets\n\n### Essential (5 plugins)\n\n- `nu_plugin_auth` - Authentication (JWT, MFA)\n- `nu_plugin_kms` - Encryption & KMS\n- `nu_plugin_orchestrator` - Orchestration operations\n- `nu_plugin_kcl` - KCL configuration\n- `nu_plugin_tera` - Template rendering\n\n### Development (8 plugins)\n\nEssential +\n\n- `nu_plugin_highlight` - Syntax highlighting\n- `nu_plugin_image` - Image processing\n- `nu_plugin_clipboard` - Clipboard operations\n\n### Full (All plugins in manifest)\n\n