---
title: "CLI Inspection"
description: "Inspect project configuration and database state with CLI commands."
canonical: "https://roomsharp.dev/docs/v0.4.7/cli-inspection"
source: "src/content/v0.4.7/cli-inspection.mdx"
---
# Inspection Commands
Commands for inspecting project configuration and database state.
## info
Display project and database information:
```bash
room info
```
**Sample Output:**
```
┌ RoomSharp Project Info
│
│ Project
│ Name MyApp.csproj
│ Root C:\path\to\project
│ Provider sqlite
│ Connection ✓ configured
│ Namespace MyApp
│
│ Paths
│ Entities Data/Models
│ DAOs Data/Daos
│ Database Data/Database
│ Migrations Data/Migrations
│ Seeders Data/Database/Seeders
│
│ Database
│ Class AppDatabaseImpl
│ Schema Version 2
│ Entities 3
│ Current Version 2
│ Migrations 1 total, 0 pending
│ Tables 5
│
└ ✓ Info retrieved
```
## doctor
Run health checks on project configuration:
```bash
room doctor
```
**Sample Output:**
```
┌ RoomSharp Doctor
│ • room.config.json found
│ • Provider: sqlite
│ • Connection string configured
│ • RoomDatabase found: AppDatabaseImpl
│ Entities: 3
│ Version: 2
│ • Database connection successful
│ • Migrations up to date
│
└ ✓ All checks passed
```
Run `room doctor` after setting up a new project or when troubleshooting configuration issues.
## db:tables
List all tables in the database with row counts:
```bash
room db:tables
```
**Sample Output:**
```
✓ Found 3 table(s) (90ms)
┌ Database Tables
│ Table Rows
│ ─────────────────────────────
│ __room_migrations 1
│ __room_state 1
│ users 150
│
└ 3 table(s)
```
## db:describe
Show table structure with columns, types, and keys:
```bash
room db:describe
room db:describe users
```
**Sample Output:**
```
✓ Found 3 column(s) (91ms)
┌ Table: users
│ Column Type Null Key Default
│ ──────────────────────────────────────────────────────
│ Id INTEGER YES PK NULL
│ Name TEXT YES NULL
│ Email TEXT NO NULL
│
└ 3 column(s)
```
## db:stats
Display database statistics including size, table counts, and index information:
```bash
room db:stats
```
**Sample Output:**
```
✓ Statistics gathered (91ms)
┌ Database Statistics
Provider: SQLite
Size: 36.0 KB
Tables: 4
Total Rows: 3
Indexes: 3
Table │ Rows │ Cols │ Idx
────────────────────────────────────────────────────────
__room_migrations │ 1 │ 9 │ 1
__room_state │ 1 │ 7 │ 0
notes │ 1 │ 4 │ 1
documents │ 0 │ 4 │ 1
└ 4 table(s), 3 row(s)
```
## generate:diagram
Generate an Entity-Relationship Diagram (ERD) in Mermaid or DBML format:
```bash
room generate:diagram [options]
```
**Options:**
| Option | Description |
|--------|-------------|
| `--output=path` | Save to file (prints to console if omitted) |
| `--format=mermaid\|dbml` | Output format (default: mermaid) |
**Examples:**
```bash
# Print Mermaid diagram to console
room generate:diagram
# Save DBML to file
room generate:diagram --output=schema.dbml --format=dbml
# Save Mermaid to file
room generate:diagram --output=docs/erd.md --format=mermaid
```
**Mermaid Output:**
````markdown
```mermaid
erDiagram
users {
INTEGER Id PK
TEXT Name
TEXT Email
}
todos {
INTEGER Id PK
TEXT Title
INTEGER UserId FK
}
users ||--o{ todos : "has"
```
````
**DBML Output:**
```dbml
Table users {
Id INTEGER [pk]
Name TEXT
Email TEXT
}
Table todos {
Id INTEGER [pk]
Title TEXT
UserId INTEGER
}
Ref: todos.UserId > users.Id
```
Use DBML format with [dbdiagram.io](https://dbdiagram.io) for visual diagram editing. Mermaid format works great in GitHub READMEs and documentation.
# Query Command
Execute raw SQL queries against the database:
```bash
room query [options]
```
**Options:**
| Option | Description |
|--------|-------------|
| `--format=table\|json\|csv` | Output format (default: table) |
| `--max-rows=100` | Maximum rows to return |
| `--file=path` | Save output to file |
| `--allow-writes` | Allow INSERT/UPDATE/DELETE statements |
**Examples:**
```bash
# Simple query
room query "SELECT * FROM users LIMIT 10"
# JSON output
room query "SELECT Id, Email FROM users" --format=json
# Save to file
room query "SELECT * FROM todos" --format=csv --file=todos.csv
# Execute write operation (requires --allow-writes)
room query "UPDATE users SET Name = 'Updated' WHERE Id = 1" --allow-writes
```
By default, only SELECT queries are allowed. Use `--allow-writes` to execute INSERT, UPDATE, or DELETE statements.
**Output Formats:**
The query command supports three output formats:
**Table (default):**
```
+----+-----------+-------------------+--------+
| Id | Name | Email | Active |
+----+-----------+-------------------+--------+
| 1 | Ahmed | ahmed@example.com | true |
| 2 | Sara | sara@example.com | false |
+----+-----------+-------------------+--------+
```
**JSON:**
```json
[
{"Id": 1, "Name": "Ahmed", "Email": "ahmed@example.com", "Active": true},
{"Id": 2, "Name": "Sara", "Email": "sara@example.com", "Active": false}
]
```
**CSV:**
```csv
"Id","Name","Email","Active"
1,"Ahmed","ahmed@example.com","True"
2,"Sara","sara@example.com","False"
```
---
# Interactive Mode
Launch a menu-driven interface with the `--interactive` (or `-i`) flag:
```bash
room --interactive
room -i
```
The TUI (Text User Interface) provides a guided experience for:
- **Scaffolding**: Create entities, DAOs, databases, migrations, and seeders
- **Migrations**: Run, verify, and check migration status
- **Database**: Seed data, reset, and drop databases
- **Schema**: Export and validate schemas
- **Inspection**: View project info and run health checks
Interactive mode is great for new users or when you want to explore available commands without memorizing the CLI syntax.
**Available Menu Options:**
| Option | Description |
|--------|-------------|
| Create Entity | Generate a new entity class |
| Create DAO | Generate a data access object interface |
| Create Database | Generate the database class |
| Create Migration | Generate a manual migration |
| Create Auto-Migration | Generate an auto-migration spec |
| Create Seeder | Generate a seeder class |
| Create Repository | Generate a repository implementation |
| Run Migrations | Apply pending migrations |
| Check Migration Status | View current vs target version |
| Seed Database | Run all or selected seeders |
| Reset Database | Drop and recreate with migrations |
| Export Schema | Export schema to files |
| Run Doctor | Check project health |
---
# SQLite Smart Path Resolution
For SQLite provider, the CLI intelligently searches for database files when only a filename is provided:
```json
{
"provider": "sqlite",
"connectionString": "Data Source=app.db"
}
```
**Search Order:**
1. Project root: `./app.db`
2. Debug output: `bin/Debug/net*/app.db`
3. Release output: `bin/Release/net*/app.db`
If the file doesn't exist, it will be created in the project root.
Full paths (absolute or explicit relative) are used as-is without searching.
---
# Providers
RoomSharp CLI supports multiple database providers:
| Provider | Value | Package |
|----------|-------|---------|
| SQLite | `sqlite` | Built-in in RoomSharp |
| PostgreSQL | `pgsql` | `RoomSharp.PostgreSql` |
| MySQL | `mysql` | `RoomSharp.MySql` |
| SQL Server | `sqlserver` | `RoomSharp.SqlServer` |
For non-SQLite providers, make sure you reference the corresponding RoomSharp provider package.