# IcarusPCB CLI

Command-line tool for IcarusPCB — simulate, generate, and validate embedded hardware configurations using Renode.

## Installation

```bash
npm install -g icaruspcb-cli
```

## Quick Start

```bash
# Authenticate
icaruspcb login

# Initialize a project
icaruspcb init

# Generate Renode scripts
icaruspcb generate --mcu STM32F407VG --sensors BME280,MPU6050

# Validate generated scripts
icaruspcb validate ./renode/stm32f407vg.repl

# Run a simulation
icaruspcb simulate --mcu STM32F407VG --firmware main.elf

# Check API status
icaruspcb status
```

## Commands

| Command | Description |
|---------|-------------|
| `icaruspcb init` | Interactive project setup — select MCU, sensors, create `.icaruspcb.json` |
| `icaruspcb simulate` | Submit simulation to API, poll for results |
| `icaruspcb generate` | Generate `.repl` and `.resc` Renode scripts |
| `icaruspcb validate <file>` | Offline validation of `.repl`/`.resc` files |
| `icaruspcb login` | Authenticate with API key |
| `icaruspcb status` | Check API health and usage |
| `icaruspcb list mcus` | List supported MCU families |
| `icaruspcb list sensors` | List supported sensors |

## Configuration

### API Key

Set via one of:
- `icaruspcb login` (saves to `~/.icaruspcb/config.json`)
- Environment variable: `ICARUSPCB_API_KEY`

### Project Config

Create `.icaruspcb.json` in your project root (or run `icaruspcb init`):

```json
{
  "mcu": "STM32F407VG",
  "sensors": ["BME280", "MPU6050"],
  "firmware": "./build/main.elf",
  "outputDir": "./renode"
}
```

## Global Options

- `--json` — Machine-readable JSON output on all commands
- `--help` — Show help for any command
- `--version` — Show CLI version

## Development

```bash
git clone <repo>
cd icaruspcb-cli
npm install
npm run build
npm link
```
