Revise CLI reference docs (#100)

* docs: revise CLI reference

* docs: sync CLI reference with current commands
This commit is contained in:
Luca Martial 2026-05-14 12:53:55 -04:00 committed by GitHub
parent a9c7c152f1
commit 5cf2c89093
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 430 additions and 73 deletions

View file

@ -4,8 +4,8 @@ description: "List and test configured data sources."
---
Inspect configured connections in your KTX project. Connections define how KTX
reaches your data warehouse, BI tools, and context sources. Use `ktx setup` to
add, remove, or reconfigure connections.
reaches databases, warehouses, BI tools, source projects, and knowledge
systems. Use `ktx setup` to add, remove, or reconfigure them.
## Command signature
@ -18,24 +18,21 @@ ktx connection <subcommand> [options]
| Subcommand | Description |
|-----------|-------------|
| `list` | List configured connections |
| `test <connectionId>` | Test a configured connection |
| `test [connectionId]` | Test one configured connection, or every connection with `--all` |
## Options
The `connection` command has command-level options for listing and testing
existing connections.
### `connection list`
| Flag | Description | Default |
|------|-------------|---------|
| `--json` | Print JSON output | `false` |
`ktx connection` uses the shared global options such as `--project-dir` and
`--debug`.
### `connection test`
| Flag | Description | Default |
|------|-------------|---------|
| `--json` | Print JSON output | `false` |
| `--all` | Test every configured connection and print a summary list | `false` |
Project directory resolution defaults to `KTX_PROJECT_DIR`, then the nearest
`ktx.yaml`, then the current working directory.
## Examples
@ -45,6 +42,12 @@ ktx connection list
# Test a connection
ktx connection test my-warehouse
# Test every configured connection
ktx connection test --all
# Test a connection from outside the project
ktx connection test my-warehouse --project-dir ./analytics
```
## Setup-managed connections
@ -55,24 +58,41 @@ Metabase mapping prompts for BI-to-warehouse mappings.
## Output
Commands with `--json` return machine-readable JSON suitable for scripts and
agents.
`ktx connection list` prints a table of configured ids and drivers.
```json
{
"connections": [
{
"id": "my-warehouse",
"driver": "postgres"
}
]
}
```text
ID DRIVER
my-warehouse postgres
```
`ktx connection test <connectionId>` performs a lightweight connection probe.
Native database connections report `Status: ok` when the connector probe
passes. Source connectors report connector-specific details such as Metabase
database count, Looker user, Notion bot, or Git repo URL.
```text
Connection test passed: my-warehouse
Driver: postgres
Status: ok
```
`ktx connection test --all` prints one row per configured connection and exits
non-zero if any probe fails.
```text
╭ connection test --all
│ • warehouse postgres ✓ ok Status: ok
│ • metabase metabase ✓ ok Databases: 2
╰ 2 tested · 2 passed
```
## Common errors
| Error | Cause | Recovery |
|-------|-------|----------|
| No connections configured | The project has no entries under `connections` | Run `ktx setup` and add a database or source connection |
| Connection test fails | Credentials, network access, database, warehouse, or schema is invalid | Verify the same URL with the database's native client, then rerun `ktx setup` and reconfigure the connection |
| Mapping validation fails during setup | BI database mappings do not point at valid warehouse connections | Rerun `ktx setup` and update the source mapping selections |
| Notion page picker cannot run | The terminal is non-interactive or Notion discovery failed | Rerun interactive `ktx setup`, or use non-interactive setup flags with explicit root page ids |