⚡ Corridor CLI

Unified command-line interface for DRA resources, photonic lanes, Free-Form Memory, and local simulation

🚀 Quick Installation

# Install globally via npm npm install -g @corridoros/cli # Or build from source git clone https://github.com/mostafa-nasr-4277/CorridorOS.git cd CorridorOS/packages/cli npm install && npm run build && npm link # Verify installation corridor version corridor doctor

✨ Key Features

🔧

Three Operating Modes

Sim: Local development with HTTP API simulator. Cloud: Full Kubernetes cluster integration. Lab: Air-gapped BIOS-mode for hardware bringup.

🌐

OS Integration

Automatically wires into CorridOS browser UI with API auto-discovery. Run corridor ui open to launch with simulator connection.

📦

Resource Generators

Generate DRA DeviceClass, ResourceClaimTemplate, PhotonicLaneParameters, and FreeFormMemoryLease YAML with clean, production-ready output.

🔒

BIOS Mode

Export sealed lab bundles with calibration data, convert high-level intents to Kubernetes resources without cluster access on hardware.

📖 Core Commands

Environment & Setup

corridor doctor # Check Node, kubectl, cluster connectivity corridor quickstart # Show 3-command setup guide corridor version # Display CLI version

Simulator SIM

corridor sim start [--port 7777] # Start local API server

Endpoints: /api/health, /api/devices, /api/claims, /api/allocations, /api/ffm/leases, /api/metrics

Resource Generation

# Generate DRA DeviceClass corridor deviceclass generate photonic.lanes > deviceclass.yaml # Generate ResourceClaimTemplate with parameters corridor claim generate \ --wavelength 1310 \ --bandwidth 40G \ --name my-lane > claim.yaml # Generate FreeFormMemoryLease corridor ffm lease generate \ --size 4Gi \ --qos-floor 400MiBps \ --name my-lease > ffm.yaml

Apply & Deployment

# Apply to cluster (cloud mode) or simulator (sim mode) corridor claim apply -f claim.yaml # Check status corridor status [--json] # Export Prometheus metrics corridor metrics [--watch]

Profile Management

# List configured profiles corridor profile list # Switch between environments corridor profile use cloud # Create/update profile corridor profile set prod \ --mode cloud \ --api https://api.example.com \ --kube-context prod-cluster \ --namespace corridor

UI Integration

# Open CorridOS UI (auto-connects to simulator) corridor ui open # Specify API endpoint corridor ui open --api http://127.0.0.1:7777

BIOS Mode LAB

# Export lab profile bundle corridor bios export --out lab-profile.tgz # Import and convert to Kubernetes resources corridor bios import lab-profile.tgz --to-claims > resources.yaml kubectl apply -f resources.yaml

🎯 Complete Workflow Examples

Local Development

# Terminal 1: Start simulator corridor sim start # Terminal 2: Generate & apply corridor claim generate \ --wavelength 1310 \ --bandwidth 40G > lane.yaml corridor claim apply -f lane.yaml # Check status corridor status # Open UI corridor ui open

Cloud Deployment

# Switch to cloud profile corridor profile use cloud # Apply DRA resources kubectl apply -f \ https://corridoros.com/manifests/dra-deviceclass.yaml kubectl apply -f \ https://corridoros.com/manifests/corridor-controller.yaml # Create claim corridor claim generate \ --wavelength 1550 \ --bandwidth 100G | kubectl apply -f - # Monitor corridor status --watch

Lab to Cloud

# On hardware (air-gapped) corridor profile set lab --mode lab corridor bios export --out setup.tgz # On workstation with cluster corridor profile use cloud corridor bios import setup.tgz \ --to-claims | kubectl apply -f - # Verify corridor status

⚙️ Configuration

Config stored at ~/.config/corridor/config.yaml

activeProfile: default profiles: default: mode: sim apiBase: http://127.0.0.1:7777 cloud: mode: cloud kubeContext: corridor-prod namespace: corridor grafana: https://grafana.example.com lab: mode: lab

📊 Exit Codes

Code Meaning Example
0 Success Command completed successfully
1 General error Unexpected failure
2 Validation failure Bad flags or missing required parameters
7 Cluster unreachable kubectl cannot connect to cluster
13 Forbidden Unauthorized access to cluster resources
21 Simulator not running Cannot connect to http://127.0.0.1:7777

🔗 Integration with CorridOS

The CLI seamlessly integrates with the browser-based operating system:

🔍

Auto-Discovery

CorridOS.html automatically detects the local simulator at boot (400ms timeout). No manual configuration needed.

🔗

URL Parameter

corridor ui open passes ?api=http://127.0.0.1:7777 to the browser, instantly connecting to the simulator.

💾

LocalStorage API

All apps read localStorage.getItem('corridor.apiBase') for API calls. Single source of truth for endpoint configuration.

🐚 Shell Completion

# Bash (add to ~/.bashrc) eval "$(corridor completion bash)" # Zsh (add to ~/.zshrc) eval "$(corridor completion zsh)" # Fish corridor completion fish > ~/.config/fish/completions/corridor.fish

📚 Additional Resources