|
| 1 | +# CLI Reference |
| 2 | + |
| 3 | +The `nl2sql` Command Line Interface (CLI) is the primary way to interact with the platform. |
| 4 | + |
| 5 | +## Global Options |
| 6 | + |
| 7 | +These flags apply to all commands and must be specified **before** the subcommand. |
| 8 | + |
| 9 | +* `--env`, `-e TEXT`: Environment name (e.g. `dev`, `demo`, `prod`). Isolates configurations and vector stores. Defaults to `default` (Production). |
| 10 | + |
| 11 | +Example: |
| 12 | + |
| 13 | +```bash |
| 14 | +# Uses configs/datasources.yaml |
| 15 | +nl2sql run "query" |
| 16 | + |
| 17 | +# Uses configs/datasources.demo.yaml |
| 18 | +nl2sql --env demo run "query" |
| 19 | +``` |
| 20 | + |
| 21 | +## Commands |
| 22 | + |
| 23 | +### `setup` |
| 24 | + |
| 25 | +Interactive wizard to initialize the platform. |
| 26 | + |
| 27 | +```bash |
| 28 | +nl2sql setup [OPTIONS] |
| 29 | +``` |
| 30 | + |
| 31 | +**Options:** |
| 32 | + |
| 33 | +* `--demo`: **Quickstart Mode**. Automatically generates a "Manufacturing" demo environment with 4 SQLite databases and sample questions. |
| 34 | +* `--docker`: Used with `--demo` to generate a `docker-compose.yml` for full-fidelity testing (Postgres/MySQL) instead of SQLite. |
| 35 | + |
| 36 | +### Example: Try it Now |
| 37 | + |
| 38 | +```bash |
| 39 | +nl2sql setup --demo |
| 40 | +``` |
| 41 | + |
| 42 | +### `index` |
| 43 | + |
| 44 | +Indexes database schemas and examples into the vector store for retrieval. |
| 45 | + |
| 46 | +```bash |
| 47 | +nl2sql index [OPTIONS] |
| 48 | +``` |
| 49 | + |
| 50 | +**Features:** |
| 51 | + |
| 52 | +* **Schema Indexing**: Introspects tables, columns, foreign keys, and comments. |
| 53 | +* **Example Indexing**: Indexes sample questions for few-shot routing. |
| 54 | +* **Granular Feedback**: Displays a checklist of indexed items per datasource. |
| 55 | +* **Summary Table**: Shows total tables, columns, and examples indexed. |
| 56 | + |
| 57 | +**Options:** |
| 58 | + |
| 59 | +* `--config PATH`: Path to datasource config. |
| 60 | +* `--vector-store PATH`: Path to vector store directory. |
| 61 | + |
| 62 | +**Example:** |
| 63 | + |
| 64 | +```bash |
| 65 | +nl2sql --env demo index |
| 66 | +``` |
| 67 | + |
| 68 | +### `run` |
| 69 | + |
| 70 | +Executes a natural language query against the configured datasources. |
| 71 | + |
| 72 | +```bash |
| 73 | +nl2sql run [QUERY] [OPTIONS] |
| 74 | +``` |
| 75 | + |
| 76 | +**Arguments:** |
| 77 | + |
| 78 | +* `QUERY`: The natural language question (e.g. "Show me active users"). |
| 79 | + |
| 80 | +**Options:** |
| 81 | + |
| 82 | +* `--role TEXT`: The RBAC role to assume (e.g. `admin`, `analyst`). Defaults to `admin`. |
| 83 | +* `--no-exec`: Plan and Validate only, do not execute SQL. |
| 84 | +* `--verbose`, `-v`: Show detailed reasoning traces and intermediate node outputs. |
| 85 | +* `--show-perf`: Display timing metrics. |
| 86 | + |
| 87 | +**Example:** |
| 88 | + |
| 89 | +```bash |
| 90 | +nl2sql run "Who bought the Bolt M5?" --role sales_analyst --verbose |
| 91 | +``` |
| 92 | + |
| 93 | +### `policy` |
| 94 | + |
| 95 | +Manage RBAC policies. |
| 96 | + |
| 97 | +* `validate`: Validates syntax and integrity of `policies.json`. |
| 98 | + |
| 99 | +```bash |
| 100 | +nl2sql policy validate |
| 101 | +``` |
| 102 | + |
| 103 | +### `doctor` |
| 104 | + |
| 105 | +Diagnoses environment issues (Python version, missing adapters, connectivity). |
| 106 | + |
| 107 | +```bash |
| 108 | +nl2sql doctor |
| 109 | +``` |
| 110 | + |
| 111 | +### `benchmark` |
| 112 | + |
| 113 | +Runs the evaluation suite against a "Golden Dataset". |
| 114 | + |
| 115 | +```bash |
| 116 | +nl2sql benchmark --dataset configs/benchmark.yaml |
| 117 | +``` |
0 commit comments