docs: sync CLI reference with current commands

This commit is contained in:
Luca Martial 2026-05-14 09:45:00 -07:00
parent 84a795104f
commit a66afaf885
8 changed files with 61 additions and 16 deletions

View file

@ -89,11 +89,12 @@ ktx connection list --project-dir "$PROJECT_DIR"
ktx connection test warehouse --project-dir "$PROJECT_DIR"
```
The connection test prints the configured driver and discovered table count:
The connection test prints the configured driver and connector-specific status:
```text
Connection test passed: warehouse
Driver: sqlite
Tables: 1
Status: ok
```
## What's in a project

View file

@ -14,7 +14,7 @@ ktx
setup
connection
list
test <connectionId>
test [connectionId]
ingest [connectionId]
text [files...]
wiki
@ -28,6 +28,7 @@ ktx
status
dev
init [directory]
schema
runtime
install
start

View file

@ -18,13 +18,18 @@ 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
`ktx connection` uses the shared global options such as `--project-dir` and
`--debug`. The `list` and `test` subcommands do not currently define
command-specific options.
`--debug`.
### `connection test`
| Flag | Description | Default |
|------|-------------|---------|
| `--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.
@ -38,6 +43,9 @@ 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
```
@ -58,13 +66,26 @@ my-warehouse postgres
```
`ktx connection test <connectionId>` performs a lightweight connection probe.
Database connections report a table count. Metabase connections report a
database count.
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
Tables: 42
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

View file

@ -20,6 +20,7 @@ ktx dev <subcommand> [options]
| Subcommand | Description |
|-----------|-------------|
| `init [directory]` | Initialize a Git-backed KTX project directory for maintenance scripts |
| `schema` | Print a JSON Schema describing `ktx.yaml` |
| `runtime` | Install, start, stop, and inspect the KTX-managed Python runtime |
## `dev init`
@ -28,6 +29,12 @@ ktx dev <subcommand> [options]
|------|-------------|---------|
| `--force` | Rewrite `ktx.yaml` and scaffold files in an existing project | `false` |
## `dev schema`
| Flag | Description | Default |
|------|-------------|---------|
| `--output <file>` | Write the schema to a file instead of stdout | — |
## `dev runtime` Subcommands
| Subcommand | Description |
@ -54,6 +61,9 @@ ktx dev init
ktx dev init ./my-project
ktx dev init --force
ktx dev schema
ktx dev schema --output ./ktx.schema.json
ktx dev runtime install --yes
ktx dev runtime install --feature local-embeddings --yes
ktx dev runtime status

View file

@ -20,6 +20,7 @@ ktx status [options]
|------|-------------|---------|
| `--json` | Print JSON output | `false` |
| `-v`, `--verbose` | Show every check, including passing ones | `false` |
| `--validate` | Only validate the `ktx.yaml` schema; skip readiness checks | `false` |
| `--no-input` | Disable interactive terminal input | - |
## Examples
@ -34,6 +35,9 @@ ktx status --json --no-input
# Show all checks, not only warnings and failures
ktx status --verbose
# Validate ktx.yaml without running readiness checks
ktx status --validate
# Check a project from another directory
ktx status --project-dir ./analytics
```
@ -63,5 +67,6 @@ ktx status --project-dir ./analytics
|-------|-------|----------|
| No KTX project found | Current directory has no `ktx.yaml` and `KTX_PROJECT_DIR` is unset | `ktx status` runs setup checks; run from a KTX project or set `KTX_PROJECT_DIR` for project checks |
| Project config check fails | The project directory is missing or has an invalid `ktx.yaml` | Run `ktx setup` to resume setup |
| Schema validation fails | `ktx.yaml` does not match the current config schema | Run `ktx status --validate --json` for structured issue details, then edit `ktx.yaml` or rerun `ktx setup` |
| Semantic search check warns | Embeddings are not configured or the provider probe failed | Run `ktx setup` or inspect the check's `fix` field in JSON output |
| Query history check warns | A database has query history enabled but the warehouse prerequisites are missing | Fix the warehouse extension, grants, or history access, then rerun `ktx status` |

View file

@ -30,16 +30,18 @@ need to add or update wiki knowledge.
| Flag | Description | Default |
|------|-------------|---------|
| `--json` | Print JSON output | `false` |
| `--user-id <id>` | Local user id | `local` |
| `--output <mode>` | Output mode: `pretty` (default in TTY), `plain` (TSV), or `json` | `pretty` |
| `--json` | Shortcut for `--output=json` (overrides `--output`) | `false` |
### `wiki search`
| Flag | Description | Default |
|------|-------------|---------|
| `--json` | Print JSON output | `false` |
| `--user-id <id>` | Local user id | `local` |
| `--limit <number>` | Maximum search results | - |
| `--output <mode>` | Output mode: `pretty` (default in TTY), `plain` (TSV), or `json` | `pretty` |
| `--json` | Shortcut for `--output=json` (overrides `--output`) | `false` |
## Examples
@ -55,13 +57,17 @@ ktx wiki search "monthly recurring revenue"
# Search wiki pages as JSON
ktx wiki search "monthly recurring revenue" --json --limit 10
# Print search results as TSV
ktx wiki search "monthly recurring revenue" --output plain
```
## Output
Wiki commands print local wiki page listings and search results. Plain output
is tab-separated. JSON output wraps the items with a command metadata envelope.
Open the matching Markdown files directly when you need the full page contents.
Wiki commands print clack-style pretty output in a TTY and TSV-style plain
output when requested. JSON output wraps the items with a command metadata
envelope. Open the matching Markdown files directly when you need the full page
contents.
```json
{

View file

@ -100,7 +100,7 @@ schema context:
```
Testing postgres-warehouse
Connection test passed
Driver: PostgreSQL - Tables: 42
Driver: PostgreSQL - Status: ok
Building schema context for postgres-warehouse
Running fast database ingest

View file

@ -181,8 +181,9 @@ describe('standalone example docs', () => {
assert.match(connectionReference, /ktx connection list/);
assert.match(connectionReference, /ktx connection test my-warehouse/);
assert.match(connectionReference, /ktx connection test --all/);
assert.match(quickstart, /Connection test passed/);
assert.match(quickstart, /Driver: PostgreSQL .* Tables: 42/);
assert.match(quickstart, /Driver: PostgreSQL .* Status: ok/);
});
it('documents public npm and managed runtime usage', async () => {