# Replicas CLI

Official CLI for [Replicas](https://tryreplicas.com) - manage cloud development workspaces with automatic SSH tunneling and an interactive terminal dashboard.

## Installation

```bash
curl -fsSL https://tryreplicas.com/install.sh | bash
```

Or if you already have [Bun](https://bun.sh) installed:

```bash
bun install -g replicas-cli
```

## Quick Start

```bash
# Login to your Replicas account
replicas login

# Connect to a workspace
replicas connect my-workspace

# Launch the interactive terminal dashboard
replicas interact
```

## Commands

### `replicas login`
Authenticate with your Replicas account via browser-based OAuth.

### `replicas logout`
Clear stored credentials.

### `replicas whoami`
Display current authenticated user.

### `replicas org`
Display current organization.

### `replicas org switch`
Switch between organizations.

### `replicas connect <workspace-name>`
Connect to a workspace via SSH.

### `replicas interact`
Launch the interactive terminal dashboard — a full TUI alternative to the web dashboard. View workspaces, chat with agents, monitor environment status, and create workspaces without leaving the terminal.

### Coding agents
Use `replicas claude-auth` or `replicas codex-auth` to connect Claude Code or Codex credentials. Cursor uses a Cursor API key configured in Coding Agents settings.

## Configuration

Create a `replicas.json` or `replicas.yaml` file in your repository root:

```json
{
  "systemPrompt": "Custom instructions for coding agents.",
  "startHook": {
    "commands": ["npm install", "npm run build"]
  }
}
```

Or use YAML for better readability (especially for multiline system prompts):

```yaml
systemPrompt: |
  Custom instructions for coding agents.
  Supports multiline text.

startHook:
  commands:
    - npm install
    - npm run build
```

## Features

- **Secure Authentication**: OAuth-based login with token refresh
- **Quick SSH Access**: Connect to workspaces with a single command
- **SSH Key Caching**: Reuse SSH keys across sessions
- **Multi-Organization**: Switch between different organizations

## How it Works

1. **SSH Key Management**: The CLI securely caches SSH keys in `~/.replicas/keys/`

## Requirements

- Node.js 18+
- SSH client (openssh)

## Support

For issues or questions, visit [https://tryreplicas.com](https://tryreplicas.com)

## License

MIT
