# rok-cli

Developer CLI for rok-based Axum applications. Scaffold models, controllers,
migrations, jobs, and events; manage databases; run the TUI dashboard; and
orchestrate AI agents for automated phase execution.

## Installation

```bash
cargo install rok-cli
```

## Commands

### Code Generation

```bash
rok make:model User --migration               # model + migration
rok make:controller UserController --resource # CRUD controller
rok make:migration create_posts_table
rok make:middleware AuthMiddleware
rok make:job SendWelcomeEmail
rok make:event UserRegistered
rok make:listener SendWelcomeEmailListener
rok make:scaffold auth                        # full auth scaffold (20 templates)
rok make:scaffold billing
rok make:feature --spec feature.json          # generate full feature from JSON
```

### Database

```bash
rok db:migrate
rok db:rollback
rok db:rollback --steps 3
rok db:status
rok db:fresh                    # drop all + re-run migrations
rok db:pull                     # introspect DB → generate model stubs
```

### Planning & Agents

```bash
rok plan:next                   # print next unimplemented phase
rok plan:list                   # all phases with status
rok plan:graph                  # DOT graph for Graphviz
rok plan:status --phase 40
rok agent:rules                 # print rok coding conventions
rok agent:context --phase 40    # print phase context
rok agent:claude --phase 40     # launch claude with rok system prompt
rok agent:opencode              # launch opencode with rok context
```

### Utilities

```bash
rok key:generate                # generate APP_KEY / JWT_SECRET
rok ts-client --output types/   # generate TypeScript API client
rok routes                      # list all registered routes
rok dev                         # hot-reload dev server (wraps cargo-watch)
rok new my-app                  # interactive project scaffolding
```

### TUI / Studio

```bash
rok tui                         # launch rok-tui terminal dashboard
rok studio                      # launch rok-studio API testing client
```

## JSON Output

All commands support `--json` / `-j` for machine-readable output:

```bash
rok plan:next --json
rok plan:list --json | jq '.[] | select(.complete == false)'
```
