npm package: @lindy-robotics/cli
Description: CLI tool for deploying and managing ROS2 robot fleets
Author: Yerzhan Zhamashev
Latest version: 0.1.2

# Lindy CLI

> CLI tool for deploying and managing ROS2 robot fleets

[![Version](https://img.shields.io/npm/v/@lindyai/cli.svg)](https://npmjs.org/package/@lindyai/cli)
[![License](https://img.shields.io/npm/l/@lindyai/cli.svg)](https://github.com/lindyai/lindy-cli/blob/main/package.json)

Lindy CLI simplifies robot fleet management by providing a powerful command-line interface for deploying code, monitoring status, and managing SSH connections across multiple ROS2 robots.

## Features

- 🤖 **Fleet Management** - Add, remove, and organize robots into environments
- 🚀 **Parallel Deployment** - Deploy code to multiple robots simultaneously
- 📊 **Status Monitoring** - Check robot health and running ROS2 nodes
- 🔧 **SSH Integration** - Seamless SSH connection management
- 🎯 **Environment Support** - Group robots (production, staging, etc.)
- ⚡ **Fast & Efficient** - Uses rsync-like file transfer with exclude patterns

## Installation

```bash
# Install globally
npm install -g @lindyai/cli

# Or with pnpm
pnpm add -g @lindyai/cli

# Or with yarn
yarn global add @lindyai/cli
```

## Quick Start

### 1. Initialize Configuration

```bash
lindy init
```

This interactive wizard will help you:
- Configure deployment settings (source/destination paths)
- Add robots with SSH credentials
- Create environments (production, staging, etc.)

### 2. Test Connections

```bash
lindy test
```

Verify SSH connections to all configured robots.

### 3. Deploy Code

```bash
# Deploy to production environment
lindy push production

# Deploy to specific robot
lindy push robot-01
```

### 4. Monitor Status

```bash
# Check all robots
lindy status

# Check specific environment
lindy status production
```

## Commands

### Configuration & Setup
- `lindy init` - Initialize configuration with interactive wizard
- `lindy test [target]` - Test SSH connections to robots

### Fleet Management
- `lindy fleet add [connection]` - Add robot to fleet
- `lindy fleet list` - List all robots with details
- `lindy fleet remove <name>` - Remove robot from fleet

### Deployment
- `lindy push <target>` - Deploy code to environment or specific robot
  - `--dry-run` - Preview without deploying
  - `--skip-build` - Skip build step
  - `--skip-restart` - Skip restart step
  - `--no-parallel` - Deploy sequentially

### Status & Monitoring
- `lindy status [target]` - Check robot status and running processes
  - `--process <pattern>` - Filter by process name/pattern
  - `--json` - JSON output for automation

## Configuration File

Lindy uses a `lindy.config.yaml` file:

```yaml
robots:
  - name: robot-01
    host: 192.168.10.101
    port: 22
    user: ubuntu
    password: secret  # or use privateKeyPath
  
  - name: robot-02
    host: 192.168.10.102
    port: 22
    user: ubuntu
    privateKeyPath: ~/.ssh/robot_key

environments:
  - name: production
    robots:
      - robot-01
      - robot-02
  
  - name: staging
    robots:
      - robot-03

deployment:
  source: ./ros2_ws/src
  destination: /home/ubuntu/ros2_ws/src
  exclude:
    - "*.pyc"
    - __pycache__
    - "*.log"
  buildCommand: "cd ~/ros2_ws && source /opt/ros/humble/setup.bash && colcon build"
  restartCommand: "pkill -f my_node; source ~/ros2_ws/install/setup.bash && nohup ros2 run my_package my_node &"
```

## Example Workflow

```bash
# 1. Setup (one-time)
lindy init
lindy test

# 2. Daily development
# ... make code changes ...

# 3. Deploy to staging first
lindy push staging
lindy status staging

# 4. If staging looks good, deploy to production
lindy push production
lindy status production

# 5. Monitor fleet health
lindy status --process my_node
```

## Use Cases

- **Multi-Robot Deployments** - Deploy code to entire robot fleets in parallel
- **Staged Rollouts** - Test on staging before deploying to production
- **Fleet Monitoring** - Check which robots are online and what's running
- **DevOps Automation** - Integrate with CI/CD pipelines using JSON output
- **Development** - Quick iteration with `--skip-build` for Python-only changes

## Requirements

- Node.js >= 18.0.0
- SSH access to target robots
- ROS2 (Humble or newer) on target robots

## Documentation

For detailed guides and examples, see:
- [DEMO.md](./DEMO.md) - Complete feature walkthrough
- [WORKFLOW_DEMO.md](./WORKFLOW_DEMO.md) - End-to-end workflow examples

## Development

```bash
# Clone the repository
git clone https://github.com/lindyai/lindy-cli
cd lindy-cli

# Install dependencies
pnpm install

# Build
pnpm run build

# Run locally
./bin/dev.js --help

# Run tests
pnpm test
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

MIT © Yerzhan Zhamashev

## Support

- 🐛 [Report bugs](https://github.com/lindyai/lindy-cli/issues)
- 💡 [Request features](https://github.com/lindyai/lindy-cli/issues)
- 📖 [Documentation](https://github.com/lindyai/lindy-cli)

---

Made with ❤️ for the robotics community