nushell-plugins/guides/distribution-installer-workflow.md

1 line
7.9 KiB
Markdown
Raw Normal View History

# Nushell Plugin Distribution Installer Workflow\n\nComplete workflow for creating and distributing Nushell plugins with manifest-based installation.\n\n## Overview\n\nThe distribution installer system has three main components:\n\n1. **Manifest Generator** - Scans plugins and creates a manifest\n2. **Manifest File** - JSON file listing all available plugins\n3. **Distribution Installer** - Lets users choose which plugins to install/register\n\n## Workflow\n\n### Step 1: Create Distribution Manifest\n\nWhen you're packaging the distribution:\n\n```bash\n# Scan plugin directory and create manifest\n./scripts/create_distribution_manifest.nu /path/to/plugins --output DISTRIBUTION_MANIFEST.json\n```\n\n**Output:** `DISTRIBUTION_MANIFEST.json` containing:\n\n- All available plugins\n- Plugin descriptions\n- Plugin paths\n- File sizes\n- Metadata (version, creation date)\n\n**Example manifest structure:**\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### Step 2: Package Distribution\n\nInclude in your distribution:\n\n```plaintext\ndistribution/\n├── bin/\n│ ├── nu_plugin_auth\n│ ├── nu_plugin_kms\n│ ├── ...\n├── install_from_manifest.nu (or ./install.nu - symlink)\n└── DISTRIBUTION_MANIFEST.json (manifest file)\n```\n\n### Step 3: User Installation\n\nEnd users run the installer:\n\n```bash\n# List available plugins\n./install_from_manifest.nu --list\n\n# Install essential preset\n./install_from_manifest.nu --preset essential\n\n# Install all plugins\n./install_from_manifest.nu --all\n\n# Install specific plugins\n./install_from_manifest.nu --select auth kms orchestrator\n\n# Dry-run (preview)\n./install_from_manifest.nu --preset development --check\n```\n\n## Manifest Generator\n\n**Script:** `./scripts/create_distribution_manifest.nu`\n\n### Usage\n\n```bash\n# Scan current directory\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 /path/to/plugins --output my_manifest.json\n```\n\n### What It Does\n\n1. Scans for plugin binaries (files matching `nu_plugin_*`)\n2. Extracts plugin information (name, purpose, path, size)\n3. Creates JSON manifest file\n4. Ready to be included in distribution\n\n## Distribution Installer\n\n**Script:** `./install_from_manifest.nu`\n\n### Usage Options\n\n```bash\n# Interactive menu\n./install_from_manifest.nu\n\n# List available plugins\n./install_from_manifest.nu --list\n\n# Use preset\n./install_from_manifest.nu --preset essential # 5 core plugins\n./install_from_manifest.nu --preset development # 8 plugins\n./install_from_manifest.nu --preset full # All plugins\n\n# Select specific plugins\n./install_from_manifest.nu --select auth kms orchestrator\n\n# Install all\n./install_from_manifest.nu --all\n\n# Dry-run (preview)\n./install_from_manifest.nu --check\n\n# Install only (skip registration)\n./install_from_manifest.nu --all --install-only\n\n# Register only (skip install)\n./install_from_manifest.nu --all --register-only\n```\n\n### What It Does\n\n1. **Loads manifest** - Reads DISTRIBUTION_MANIFEST.json\n2. **Displays options** - Shows available plugins or presets\n3. **User selects** - Interactive menu or command-line options\n4. **Installs** - Copies selected plugins to ~/.local/bin/\n5. **Registers** - Updates Nushell config (~/.config/nushell/env.nu)\n6. **Confirms** - Asks user before making changes\n\n## Available Presets\n\n### Essential (5 plugins)\n\n```plaintext\n• nu_plugin_auth - Authentication\n• nu_plugin_kms - Encryption\n• nu_plugin_orchestrator - Orchestration\n• nu_plugin_kcl - KCL config\n• nu_plugin_tera