nautilus-orm 0.1.3

Nautilus ORM command-line interface
# nautilus-cli

Command-line interface for the Nautilus ORM. Builds the `nautilus` binary that
orchestrates schema management, code generation, database operations, and the
engine runtime.

## Subcommands

| Command             | Description |
|---------------------|-------------|
| `db push`           | Compute the diff between the local `.nautilus` schema and the live database, then apply every change (with interactive confirmation for destructive ones). |
| `db status`         | Show pending schema changes as a diff summary without applying them. |
| `db pull`           | Introspect the live database and emit an equivalent `.nautilus` schema file. |
| `db reset`          | Drop all tables then re-push the schema from scratch. |
| `db seed <file>`    | Execute a SQL seed script inside a single transaction. |
| `generate [schema]` | Parse and validate a schema file, then generate client code (Rust or Python) via `nautilus-codegen`. |
| `validate [schema]` | Parse and validate a schema file without generating code. |
| `format [schema]`   | Reformat a `.nautilus` file in canonical style (2-space indent, aligned columns). |
| `migrate generate`  | Create a new versioned migration file from the current schema diff. |
| `migrate apply`     | Apply all pending migration files in chronological order. |
| `migrate rollback`  | Roll back the last *N* applied migrations. |
| `migrate status`    | Show the applied/pending status of every migration file. |
| `engine serve`      | Start the JSON-RPC engine server on stdin/stdout (used by client libraries). |

## Key types

| Module / File         | Purpose |
|-----------------------|---------|
| `main.rs`             | Clap `Parser` / `Subcommand` definitions and top-level dispatch. |
| `tui.rs`              | Terminal styling helpers — headers, spinners, diff tables, interactive menus, confirmation prompts. |
| `commands/db/connection.rs` | `Connection` pool abstraction over SQLite/Postgres/MySQL, `DbContext` shared preamble (schema parse → URL resolve → connect), URL helpers, `change_display_name`. |
| `commands/db/*`       | One file per `db` subcommand (`push`, `status`, `pull`, `reset`, `seed`). |
| `commands/migrate/shared.rs` | `MigrateContext` — analogous shared preamble for all `migrate` subcommands. |
| `commands/migrate/*`  | One file per `migrate` subcommand (`generate`, `apply`, `rollback`, `status`). |
| `commands/engine.rs`  | Thin wrapper that delegates to `nautilus_engine::run_engine`. |
| `commands/generate.rs`| Thin wrapper that delegates to `nautilus_codegen`. |
| `commands/format.rs`  | Schema formatter using `nautilus_schema::format_schema`. |

## Workspace dependencies

- **`nautilus-schema`** — lexer, parser, validator, formatter for `.nautilus` files.
- **`nautilus-codegen`** — Rust / Python code generation from validated schemas.
- **`nautilus-migrate`** — schema diffing, DDL generation, migration file store, migration executor.
- **`nautilus-engine`** — JSON-RPC database engine runtime.

## Design notes

- **`DbContext`** and **`MigrateContext`** extract the repeated *"parse schema → resolve URL → connect"*
  boilerplate so each subcommand starts from a ready-to-use context struct.
- **`with_pool!`** macro in `connection.rs` eliminates match-arm duplication across
  the three sqlx pool types for `execute` and `execute_in_transaction`.
- `tokio` features are narrowed to `rt-multi-thread` + `macros` (the minimum needed
  by `#[tokio::main]` and `spawn_blocking`).