npm package: @insureco/cli
Description: Developer CLI for InsurEco Tawa platform
Author: InsurEco
Latest version: 0.6.6
Deprecated: Package renamed to iec-cli. Install with: npm install -g iec-cli

# @insureco/cli

Developer CLI for the InsurEco Tawa platform. Deploy, manage, and monitor services with a single tool.

## Installation

```bash
npm install -g @insureco/cli
```

Or use without installing:

```bash
npx @insureco/cli deploy
```

## Quick Start

```bash
# Login to the platform
iec login

# Option 1: AI-powered setup (recommended)
iec init --ai

# Option 2: Use a starter template
iec sample --nextjs
cd my-service

# Check everything is configured correctly
iec preflight

# Deploy to sandbox
iec deploy
```

## Commands

### Setup & Configuration

| Command | Description |
|---------|-------------|
| `iec login` | Authenticate with the platform |
| `iec logout` | Sign out |
| `iec whoami` | Show current user |
| `iec config` | View/set CLI configuration |
| `iec init` | Scaffold new service |
| `iec init --ai` | AI-powered interactive setup |
| `iec sample --api` | Scaffold Express/Hono API starter |
| `iec sample --nextjs` | Scaffold Next.js starter |
| `iec sample --crosspod` | Scaffold two services with pod-to-pod auth demo |

### Deployment

| Command | Description |
|---------|-------------|
| `iec preflight` | Run pre-deployment checks |
| `iec register` | Register service with Koko |
| `iec link` | Connect repo to iec-builder |
| `iec deploy` | Build and deploy (via GitHub) |
| `iec push` | Push code directly to builder (no GitHub needed) |
| `iec rollback <version>` | Redeploy a previous version |
| `iec versions` | List deployable versions |
| `iec destroy` | Delete deployment |

### Monitoring

| Command | Description |
|---------|-------------|
| `iec status` | Show service and build status |
| `iec logs` | Stream container logs |
| `iec logs --build <id>` | View build logs |
| `iec builds` | List recent builds |

### Data Management

| Command | Description |
|---------|-------------|
| `iec env` | Manage environments |
| `iec program` | View programs |
| `iec backup` | Manage backups |
| `iec restore` | Restore from backup |

## Configuration

### Global Config (`~/.iec/config.yaml`)

```yaml
koko_url: https://janus.tawa.insureco.io/koko
builder_url: https://builder.tawa.insureco.io
registry: registry.digitalocean.com/insureco
```

### Project Config (`catalog-info.yaml`)

```yaml
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: my-service
  description: My awesome service
  annotations:
    insureco.io/framework: nextjs
    insureco.io/node-version: "20"
spec:
  type: service
  lifecycle: production
  owner: my-team
  routes:
    - path: /api/users
      methods: [GET, POST]
      auth: required
```

## Environment Flags

```bash
iec deploy              # Deploy to sandbox (default)
iec deploy --prod       # Deploy to production
iec deploy --uat        # Deploy to UAT
iec deploy --watch      # Watch build progress
```

## Development

```bash
# Install dependencies
npm install

# Run in development
npm run dev

# Build
npm run build

# Run built CLI
npm start
```

## Publishing

Releases are automated via GitHub Actions. To publish a new version:

```bash
# 1. Bump version in package.json
# 2. Commit and tag
git add -A && git commit -m "chore: release v0.2.0"
git tag v0.2.0
git push && git push --tags
```

The GitHub Action will automatically publish to npm when a `v*` tag is pushed.

### Manual Publishing

```bash
npm login
npm publish
```

## Requirements

- Node.js 20+
- npm or pnpm

## License

MIT