1 line
12 KiB
Markdown
Raw Normal View History

# Orchestrator Plugin Usage Examples\n\nThis document provides comprehensive examples for using the `nu_plugin_orchestrator` plugin.\n\n## Installation\n\nFirst, register the plugin with Nushell:\n\n```bash\n# Build the plugin\ncd provisioning/core/plugins/nushell-plugins/nu_plugin_orchestrator\ncargo build --release\n\n# Register with Nushell\nplugin add target/release/nu_plugin_orchestrator\n```\n\n## Commands Overview\n\nThe plugin provides three main commands:\n\n1. **`orch status`** - Get orchestrator status from local state\n2. **`orch validate`** - Validate workflow KCL files\n3. **`orch tasks`** - List orchestrator tasks from local queue\n\n---\n\n## 1. Checking Orchestrator Status\n\n### Basic Status Check\n\n```nushell\norch status\n```\n\n**Output:**\n\n```plaintext\n╭─────────────────┬────────────────────────────────────────────────────────╮\n│ running │ false │\n│ tasks_pending │ 5 │\n│ tasks_running │ 2 │\n│ tasks_completed │ 10 │\n│ last_check │ 2025-10-09T12:00:00Z │\n│ data_dir │ provisioning/platform/orchestrator/data │\n╰─────────────────┴────────────────────────────────────────────────────────╯\n```\n\n### Custom Data Directory\n\n```nushell\norch status --data-dir /custom/path/to/orchestrator/data\n```\n\n### Format as JSON\n\n```nushell\norch status | to json\n```\n\n**Output:**\n\n```json\n{\n "running": false,\n "tasks_pending": 5,\n "tasks_running": 2,\n "tasks_completed": 10,\n "last_check": "2025-10-09T12:00:00Z",\n "data_dir": "provisioning/platform/orchestrator/data"\n}\n```\n\n### Check if Orchestrator is Running\n\n```nushell\nif (orch status | get running) {\n print "Orchestrator is running"\n} else {\n print "Orchestrator is not running"\n}\n```\n\n---\n\n## 2. Validating Workflow Files\n\n### Basic Validation\n\n```nushell\norch validate test-workflow.k\n```\n\n**Output (Valid):**\n\n```plaintext\n╭──────────┬──────╮\n│ valid │ true │\n│ errors │ [] │\n│ warnings │ [] │\n╰──────────┴──────╯\n```\n\n**Output (Invalid):**\n\n```plaintext\n╭──────────┬─────────────────────────────────────────────────────────────╮\n│ valid │ false │\n│ errors │ ["File not found: nonexistent.k"] │\n│ warnings │ [] │\n╰──────────┴─────────────────────────────────────────────────────────────╯\n```\n\n### Strict Validation\n\nStrict mode performs additional checks for required fields:\n\n```nushell\norch validate workflow.k --strict\n```\n\n**Output:**\n\n```plaintext\n╭──────────┬──────────────────────────────────────────────────────────╮\n│ valid │ false │\n│ errors │ ["Missing 'operations' field (required)"] │\n│ warnings │ ["Missing 'name' field", "Missing 'version' field"] │\n╰──────────┴