feat(cli): smart defaults and flatter command surface for ktx (#177)

Bare invocations now do the obvious thing instead of erroring out, and mode-as-subcommand patterns collapse into flags on the parent. No new top-level commands.

- `ktx ingest` (bare) ingests every configured connection. The `text` subcommand is gone; capture inline notes with `ktx ingest --text "..."` and files with `ktx ingest --file path` (use `-` for stdin). `--text`/`--file` reject a positional connection id; pass `--connection-id` to tag captured notes.
- `ktx connection` (bare) lists; `ktx connection test` (bare) tests every configured connection.
- `ktx wiki` and `ktx sl` flatten `list`/`search`: bare lists, with a `[query...]` positional searches (multi-word joined with spaces). `sl validate` and `sl query` stay as distinct verbs and now read `--connection-id` from the parent.
- `ktx mcp` (bare) prints daemon status.

Adds a shared `resolveConnectionSelection` helper consumed by ingest and connection test. Updates README, docs-site cli-reference and guides, next-steps strings, agent SKILL templates, and all affected tests. Per-package type-check, unit tests (605), smoke tests, and dead-code checks all pass.
This commit is contained in:
Andrey Avtomonov 2026-05-20 01:52:37 +02:00 committed by GitHub
parent 14626c294b
commit 2c9a58bb56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 438 additions and 380 deletions

View file

@ -10,15 +10,21 @@ systems. Use `ktx setup` to add, remove, or reconfigure them.
## Command signature
```bash
ktx connection <subcommand> [options]
ktx connection # list all configured connections
ktx connection list # explicit list
ktx connection test [connectionId] # test one (or all, when omitted)
```
Bare `ktx connection` lists configured connections. `ktx connection test`
with no positional and no flag tests every configured connection.
## Subcommands
| Subcommand | Description |
|-----------|-------------|
| (none) | List configured connections (alias for `list`) |
| `list` | List configured connections |
| `test [connectionId]` | Test one configured connection, or every connection with `--all` |
| `test [connectionId]` | Test one configured connection; omit the id (or pass `--all`) to test every connection |
## Options
@ -29,7 +35,7 @@ ktx connection <subcommand> [options]
| Flag | Description | Default |
|------|-------------|---------|
| `--all` | Test every configured connection and print a summary list | `false` |
| `--all` | Test every configured connection and print a summary list | implicit when no `connectionId` is supplied |
Project directory resolution defaults to `KTX_PROJECT_DIR`, then the nearest
`ktx.yaml`, then the current working directory.
@ -38,12 +44,15 @@ Project directory resolution defaults to `KTX_PROJECT_DIR`, then the nearest
```bash
# List all configured connections
ktx connection list
# Test a connection
ktx connection test my-warehouse
ktx connection
# Test every configured connection
ktx connection test
# Test one connection
ktx connection test my-warehouse
# Test every connection explicitly
ktx connection test --all
# Test a connection from outside the project
@ -58,7 +67,8 @@ Metabase mapping prompts for BI-to-warehouse mappings.
## Output
`ktx connection list` prints a table of configured ids and drivers.
`ktx connection` (or `ktx connection list`) prints a table of configured ids
and drivers.
```text
ID DRIVER
@ -76,8 +86,8 @@ Driver: postgres
Status: ok
```
`ktx connection test --all` prints one row per configured connection and exits
non-zero if any probe fails.
`ktx connection test` (bare) and `ktx connection test --all` print one row per
configured connection and exit non-zero if any probe fails.
```text
╭ connection test --all