mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-22 08:38:08 +02:00
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:
parent
14626c294b
commit
2c9a58bb56
33 changed files with 438 additions and 380 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,35 +1,44 @@
|
|||
---
|
||||
title: "ktx ingest"
|
||||
description: "Build or refresh KTX context from configured connections."
|
||||
description: "Build or refresh KTX context, or capture text into KTX memory."
|
||||
---
|
||||
|
||||
`ktx ingest` builds or refreshes KTX context from configured connections.
|
||||
Database connections build schema context. Context-source connections ingest
|
||||
metadata from tools such as dbt, Looker, Metabase, MetricFlow, LookML, and
|
||||
Notion. The current public command is connection-centric: pass one
|
||||
`connectionId`, or pass `--all`.
|
||||
`ktx ingest` builds or refreshes KTX context from configured connections, and
|
||||
can also capture free-form text into KTX memory. Database connections build
|
||||
schema context. Context-source connections ingest metadata from tools such as
|
||||
dbt, Looker, Metabase, MetricFlow, LookML, and Notion. Pass `--text` or
|
||||
`--file` to capture inline text or text files into memory instead.
|
||||
|
||||
## Command signature
|
||||
|
||||
```bash
|
||||
ktx ingest [options] [connectionId]
|
||||
ktx ingest text [options] [files...]
|
||||
```
|
||||
|
||||
Use a connection id to build one configured connection. Use `--all` to build
|
||||
every configured connection. Database connections run before context-source
|
||||
connections when you use `--all`.
|
||||
- Bare `ktx ingest` (no positional, no `--all`) ingests every configured
|
||||
connection.
|
||||
- `ktx ingest <connectionId>` ingests one configured connection.
|
||||
- `ktx ingest --text "..."` (or `--file <path>`) captures notes into KTX
|
||||
memory instead of ingesting a connection.
|
||||
|
||||
## `ktx ingest` Options
|
||||
Database connections run before context-source connections when more than one
|
||||
connection is selected.
|
||||
|
||||
## Options
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--all` | Ingest all configured connections | `false` |
|
||||
| `--all` | Ingest all configured connections (same as bare invocation) | `false` |
|
||||
| `--fast` | Use deterministic database schema ingest | Stored connection default, or `fast` |
|
||||
| `--deep` | Use AI-enriched database ingest | Stored connection default, or `fast` |
|
||||
| `--query-history` | Include database query-history usage patterns | Stored connection default |
|
||||
| `--no-query-history` | Skip database query-history usage patterns for this run | Stored connection default |
|
||||
| `--query-history-window-days <days>` | BigQuery/Snowflake query-history lookback window for this run | Stored connection default |
|
||||
| `--text <content>` | Capture inline text into KTX memory; repeatable | `[]` |
|
||||
| `--file <path>` | Capture a text file into KTX memory; use `-` for stdin; repeatable | `[]` |
|
||||
| `--connection-id <connectionId>` | KTX connection id to tag captured text/file notes | - |
|
||||
| `--user-id <id>` | Memory user id for text/file capture attribution | `local-cli` |
|
||||
| `--fail-fast` | Stop after the first failed text/file item | `false` |
|
||||
| `--plain` | Print plain text output | `true` |
|
||||
| `--json` | Print JSON output | `false` |
|
||||
| `--yes` | Install required managed runtime features without prompting | `false` |
|
||||
|
|
@ -42,8 +51,8 @@ Postgres reads the current `pg_stat_statements` aggregate data instead of a
|
|||
time-windowed history table. Query-history ingest runs after schema ingest and
|
||||
requires deep ingest readiness.
|
||||
|
||||
When `--all` selects both databases and context sources, database ingest runs
|
||||
first, then source ingest and memory updates run for source connections.
|
||||
When more than one connection is selected, database ingest runs first, then
|
||||
source ingest and memory updates run for source connections.
|
||||
|
||||
Some ingest paths use the managed KTX Python runtime. Query-history ingest uses
|
||||
it for SQL analysis, and Looker source ingest uses it for Looker identifier
|
||||
|
|
@ -51,23 +60,15 @@ parsing. In an interactive terminal, `ktx ingest` prompts before installing the
|
|||
required runtime features. Use `--yes` to install them without prompting, or
|
||||
use `--no-input` to fail fast with install guidance.
|
||||
|
||||
## `ktx ingest text` Options
|
||||
|
||||
Use `ktx ingest text` to capture free-form text artifacts into KTX memory.
|
||||
Provide files, pass `--text` one or more times, or use `-` as a file argument to
|
||||
read one item from stdin.
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--text <content>` | Text content to ingest; repeat for a batch | `[]` |
|
||||
| `--connection-id <connectionId>` | Optional KTX connection id for semantic-layer capture | - |
|
||||
| `--user-id <id>` | Memory user id for capture attribution | `local-cli` |
|
||||
| `--json` | Print JSON output | `false` |
|
||||
| `--fail-fast` | Stop after the first failed text item | `false` |
|
||||
`--text` and `--file` cannot be combined with a positional `connectionId` or
|
||||
`--all`; pass `--connection-id <id>` instead to tag captured notes.
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
# Build every configured connection (bare = --all)
|
||||
ktx ingest
|
||||
|
||||
# Build one database or source connection
|
||||
ktx ingest warehouse
|
||||
|
||||
|
|
@ -85,15 +86,17 @@ ktx ingest warehouse --query-history-window-days 30
|
|||
# Build a source connection
|
||||
ktx ingest notion
|
||||
|
||||
# Build all configured connections
|
||||
ktx ingest --all
|
||||
ktx ingest --all --deep
|
||||
# Capture inline text into memory
|
||||
ktx ingest --text "Refunds are excluded from net revenue."
|
||||
|
||||
# Capture local Markdown notes into memory
|
||||
ktx ingest text docs/revenue-notes.md --connection-id warehouse
|
||||
# Capture multiple text snippets in one call
|
||||
ktx ingest --text "Revenue is gross receipts." --text "Orders are completed purchases."
|
||||
|
||||
# Capture a local Markdown file into memory and tag it to a connection
|
||||
ktx ingest --file docs/revenue-notes.md --connection-id warehouse
|
||||
|
||||
# Capture one stdin item
|
||||
printf "Refunds are excluded from net revenue." | ktx ingest text -
|
||||
printf "Refunds are excluded from net revenue." | ktx ingest --file -
|
||||
```
|
||||
|
||||
## Output
|
||||
|
|
@ -154,6 +157,5 @@ KTX_INGEST_TRACE_LEVEL=trace ktx ingest metabase
|
|||
| Deep readiness is missing | `--deep` or query history needs model, embedding, and scan-enrichment configuration | Run `ktx setup` or rerun with `--fast` |
|
||||
| Query history is unsupported | The selected database driver does not support query history | Run schema ingest without query-history flags |
|
||||
| Python runtime is missing | The selected ingest target needs runtime-backed SQL analysis or source parsing | Accept the interactive prompt, rerun with `--yes`, or run the suggested `ktx admin runtime install` command |
|
||||
| No ingest target was selected | No connection id was provided and `--all` was omitted | Run `ktx ingest <connectionId>` or `ktx ingest --all` |
|
||||
| Source options were ignored | Depth and query-history flags were supplied for a non-database source | Omit database-only flags when ingesting source connections |
|
||||
| Text ingest stops early | `--fail-fast` was used and one item failed | Fix the failed item or rerun without `--fail-fast` to collect all failures |
|
||||
|
|
|
|||
|
|
@ -10,34 +10,33 @@ the vocabulary agents use to generate correct SQL.
|
|||
## Command signature
|
||||
|
||||
```bash
|
||||
ktx sl <subcommand> [options]
|
||||
ktx sl [options] [query...] # list (bare) or search (with query)
|
||||
ktx sl validate <sourceName> [options]
|
||||
ktx sl query [options]
|
||||
```
|
||||
|
||||
- Bare `ktx sl` lists semantic-layer sources.
|
||||
- `ktx sl <query...>` searches semantic-layer sources (multi-word queries are
|
||||
joined with a space).
|
||||
- `ktx sl validate` and `ktx sl query` remain as explicit subcommands.
|
||||
|
||||
## Subcommands
|
||||
|
||||
| Subcommand | Description |
|
||||
|-----------|-------------|
|
||||
| `list` | List semantic-layer sources |
|
||||
| `search <query>` | Search semantic-layer sources |
|
||||
| (none, no query) | List semantic-layer sources |
|
||||
| (none, with query) | Search semantic-layer sources |
|
||||
| `validate <sourceName>` | Validate a semantic-layer source against the database schema |
|
||||
| `query` | Compile or execute a Semantic Query |
|
||||
|
||||
## Options
|
||||
|
||||
### `sl list`
|
||||
### `sl` (list or search)
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--connection-id <id>` | Filter by KTX connection id | - |
|
||||
| `--output <mode>` | Output mode: `pretty` (default in TTY), `plain` (TSV), or `json` | `pretty` |
|
||||
| `--json` | Shortcut for `--output=json` (overrides `--output`) | `false` |
|
||||
|
||||
### `sl search`
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--connection-id <id>` | Filter by KTX connection id | - |
|
||||
| `--limit <number>` | Maximum search results | - |
|
||||
| `--limit <number>` | Maximum search results (search mode only) | - |
|
||||
| `--output <mode>` | Output mode: `pretty` (default in TTY), `plain` (TSV), or `json` | `pretty` |
|
||||
| `--json` | Shortcut for `--output=json` (overrides `--output`) | `false` |
|
||||
|
||||
|
|
@ -73,16 +72,16 @@ ktx sl <subcommand> [options]
|
|||
|
||||
```bash
|
||||
# List all semantic sources
|
||||
ktx sl list
|
||||
ktx sl
|
||||
|
||||
# List sources for a specific connection
|
||||
ktx sl list --connection-id my-warehouse
|
||||
ktx sl --connection-id my-warehouse
|
||||
|
||||
# List sources as JSON
|
||||
ktx sl list --json
|
||||
ktx sl --json
|
||||
|
||||
# Search sources as JSON
|
||||
ktx sl search "revenue" --json
|
||||
ktx sl "revenue" --json
|
||||
|
||||
# Validate a source against the live schema
|
||||
ktx sl validate orders --connection-id my-warehouse
|
||||
|
|
@ -137,13 +136,13 @@ ktx sl query \
|
|||
|
||||
## Output
|
||||
|
||||
Semantic-layer list and search commands return human-readable output by
|
||||
default. Use `--json` on `list` or `search` when an agent needs structured
|
||||
output. Use `--format sql` on `query` to inspect generated SQL before
|
||||
execution, or leave `--format json` for the compiled query and optional rows.
|
||||
Pretty `sl search` output shows `#1`, `#2`, and later rank badges for the
|
||||
displayed results. Plain and JSON output keep the raw `score` value, which is a
|
||||
ranking score rather than a percentage.
|
||||
Bare `ktx sl` (list) and `ktx sl <query>` (search) return human-readable
|
||||
output by default. Use `--json` when an agent needs structured output. Use
|
||||
`--format sql` on `query` to inspect generated SQL before execution, or leave
|
||||
`--format json` for the compiled query and optional rows. Pretty search output
|
||||
shows `#1`, `#2`, and later rank badges for the displayed results. Plain and
|
||||
JSON output keep the raw `score` value, which is a ranking score rather than a
|
||||
percentage.
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
@ -161,8 +160,8 @@ ranking score rather than a percentage.
|
|||
|
||||
| Error | Cause | Recovery |
|
||||
|-------|-------|----------|
|
||||
| Source not found | Source name or connection id is wrong | Run `ktx sl list --json` and retry with an exact source name and connection id |
|
||||
| Source not found | Source name or connection id is wrong | Run `ktx sl --json` and retry with an exact source name and connection id |
|
||||
| Validation fails | YAML references missing columns, invalid joins, or invalid SQL expressions | Fix the source YAML and rerun `ktx sl validate` |
|
||||
| Query compile fails | Measure, dimension, filter, or segment name is invalid | Search sources with `ktx sl search`, inspect the source YAML in your project files, then retry using declared fields |
|
||||
| Query compile fails | Measure, dimension, filter, or segment name is invalid | Search sources with `ktx sl <query>`, inspect the source YAML in your project files, then retry using declared fields |
|
||||
| Execution returns too many rows | `--max-rows` is missing or too high | Add `--max-rows` with a bounded value before executing |
|
||||
| Runtime install is blocked | Query execution needs the managed Python runtime and prompts are disabled | Run `ktx admin runtime install --feature core --yes`, or rerun `ktx sl query --yes` |
|
||||
|
|
|
|||
|
|
@ -10,42 +10,28 @@ them for context when answering questions about your data.
|
|||
## Command signature
|
||||
|
||||
```bash
|
||||
ktx wiki <subcommand> [options]
|
||||
ktx wiki [options] [query...]
|
||||
```
|
||||
|
||||
## Subcommands
|
||||
- Bare `ktx wiki` lists local wiki pages.
|
||||
- `ktx wiki <query...>` searches local wiki pages (multi-word queries are
|
||||
joined with a space).
|
||||
|
||||
| Subcommand | Description |
|
||||
|-----------|-------------|
|
||||
| `list` | List local wiki pages |
|
||||
| `search <query>` | Search local wiki pages |
|
||||
|
||||
The current public CLI lists and searches wiki pages. Edit the Markdown files
|
||||
under `wiki/` directly, or ingest source content with `ktx ingest`, when you
|
||||
need to add or update wiki knowledge.
|
||||
Edit the Markdown files under `wiki/` directly, or ingest source content with
|
||||
`ktx ingest`, when you need to add or update wiki knowledge.
|
||||
|
||||
## Options
|
||||
|
||||
### `wiki list`
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--user-id <id>` | Local user id | `local` |
|
||||
| `--limit <number>` | Maximum search results (search mode only) | - |
|
||||
| `--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 |
|
||||
|------|-------------|---------|
|
||||
| `--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` |
|
||||
|
||||
`wiki search` uses hybrid search when `storage.search` is `sqlite-fts5`. KTX
|
||||
combines lexical SQLite FTS5 matches, token matches, and semantic matches from
|
||||
wiki page embeddings stored in `.ktx/db.sqlite`. If embeddings are not
|
||||
`ktx wiki <query>` uses hybrid search when `storage.search` is `sqlite-fts5`.
|
||||
KTX combines lexical SQLite FTS5 matches, token matches, and semantic matches
|
||||
from wiki page embeddings stored in `.ktx/db.sqlite`. If embeddings are not
|
||||
configured or the embedding backend is unavailable, KTX skips the semantic lane
|
||||
and keeps lexical and token results.
|
||||
|
||||
|
|
@ -53,22 +39,22 @@ and keeps lexical and token results.
|
|||
|
||||
```bash
|
||||
# List all wiki pages
|
||||
ktx wiki list
|
||||
ktx wiki
|
||||
|
||||
# List all wiki pages as JSON
|
||||
ktx wiki list --json
|
||||
ktx wiki --json
|
||||
|
||||
# Search wiki pages
|
||||
ktx wiki search "monthly recurring revenue"
|
||||
ktx wiki "monthly recurring revenue"
|
||||
|
||||
# Search wiki pages as JSON
|
||||
ktx wiki search "monthly recurring revenue" --json --limit 10
|
||||
ktx wiki "monthly recurring revenue" --json --limit 10
|
||||
|
||||
# Print search results as TSV
|
||||
ktx wiki search "monthly recurring revenue" --output plain
|
||||
ktx wiki "monthly recurring revenue" --output plain
|
||||
|
||||
# Inspect which search lanes were used
|
||||
ktx --debug wiki search "monthly recurring revenue" --json
|
||||
ktx --debug wiki "monthly recurring revenue" --json
|
||||
```
|
||||
|
||||
## Output
|
||||
|
|
|
|||
|
|
@ -91,11 +91,11 @@ ktx status
|
|||
ktx ingest warehouse
|
||||
|
||||
# Build every configured connection
|
||||
ktx ingest --all
|
||||
ktx ingest
|
||||
|
||||
# Search semantic-layer sources and wiki pages
|
||||
ktx sl search "revenue"
|
||||
ktx wiki search "revenue recognition"
|
||||
ktx sl "revenue"
|
||||
ktx wiki "revenue recognition"
|
||||
|
||||
# Execute read-only SQL
|
||||
ktx sql --connection warehouse "select count(*) from public.orders"
|
||||
|
|
|
|||
|
|
@ -106,28 +106,30 @@ edits.
|
|||
|
||||
## Text ingest
|
||||
|
||||
Use `ktx ingest text` for notes, Markdown, runbooks, Slack exports, or other
|
||||
searchable memory.
|
||||
Use `ktx ingest --text` / `ktx ingest --file` for notes, Markdown, runbooks,
|
||||
Slack exports, or other searchable memory.
|
||||
|
||||
```bash
|
||||
# Capture a Markdown file
|
||||
ktx ingest text docs/revenue-notes.md --connection-id warehouse
|
||||
ktx ingest --file docs/revenue-notes.md --connection-id warehouse
|
||||
|
||||
# Capture one stdin item
|
||||
printf "Refunds are excluded from net revenue." | ktx ingest text -
|
||||
printf "Refunds are excluded from net revenue." | ktx ingest --file -
|
||||
|
||||
# Capture direct text
|
||||
ktx ingest text --text "ARR excludes one-time implementation fees."
|
||||
ktx ingest --text "ARR excludes one-time implementation fees."
|
||||
```
|
||||
|
||||
Useful flags:
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--text <content>` | Capture inline text into memory; repeatable |
|
||||
| `--file <path>` | Capture a text file (or `-` for stdin) into memory; repeatable |
|
||||
| `--connection-id <connectionId>` | Attach the captured memory to a KTX connection |
|
||||
| `--user-id <id>` | Attribute capture to a user scope, default `local-cli` |
|
||||
| `--json` | Print structured output |
|
||||
| `--fail-fast` | Stop after the first failed text item |
|
||||
| `--fail-fast` | Stop after the first failed text/file item |
|
||||
|
||||
Use text ingest for small, high-signal documents. Prefer configured source
|
||||
ingest for Notion, dbt, Metabase, and similar systems.
|
||||
|
|
@ -165,8 +167,8 @@ Then inspect what changed:
|
|||
|
||||
```bash
|
||||
git status --short
|
||||
ktx sl list --json
|
||||
ktx wiki search "revenue" --json --limit 10
|
||||
ktx sl --json
|
||||
ktx wiki "revenue" --json --limit 10
|
||||
```
|
||||
|
||||
## Common errors
|
||||
|
|
@ -176,6 +178,6 @@ ktx wiki search "revenue" --json --limit 10
|
|||
| Connection not configured | The connection id is missing from `ktx.yaml` | Add it with `ktx setup` |
|
||||
| Deep readiness is missing | LLM or embeddings are not setup-ready | Run `ktx setup`, or rerun with `--fast` |
|
||||
| Query history is unsupported | The selected database driver does not expose query history | Run schema ingest without query-history flags |
|
||||
| No target selected | You omitted both a connection id and `--all` | Run `ktx ingest <connectionId>` or `ktx ingest --all` |
|
||||
| No connections configured | The project has no entries under `connections` | Run `ktx setup` and add a database or source connection |
|
||||
| Source flags have no effect | Depth and query-history flags were supplied for a source connector | Use those flags only for database connections |
|
||||
| Text ingest stops early | `--fail-fast` stopped on the first failed item | Fix the item or rerun without `--fail-fast` |
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ context-build, and agent-integration readiness.
|
|||
### Semantic layer discovery
|
||||
|
||||
```bash
|
||||
ktx sl list --json
|
||||
ktx sl list --connection-id warehouse --json
|
||||
ktx sl search "revenue" --json --limit 10
|
||||
ktx sl --json
|
||||
ktx sl --connection-id warehouse --json
|
||||
ktx sl "revenue" --json --limit 10
|
||||
```
|
||||
|
||||
Use these commands to find source names, connection ids, measures, dimensions,
|
||||
|
|
@ -99,8 +99,8 @@ For complex calls, agents can write a JSON query object and pass it with
|
|||
### Wiki context
|
||||
|
||||
```bash
|
||||
ktx wiki list --json
|
||||
ktx wiki search "revenue recognition" --json --limit 10
|
||||
ktx wiki --json
|
||||
ktx wiki "revenue recognition" --json --limit 10
|
||||
```
|
||||
|
||||
Search wiki context for business definitions, metric caveats, process rules, and
|
||||
|
|
@ -112,8 +112,8 @@ Agents can refresh context when the user asks them to:
|
|||
|
||||
```bash
|
||||
ktx ingest warehouse --fast
|
||||
ktx ingest --all
|
||||
ktx ingest text docs/revenue-notes.md --connection-id warehouse
|
||||
ktx ingest
|
||||
ktx ingest --file docs/revenue-notes.md --connection-id warehouse
|
||||
```
|
||||
|
||||
Use `--deep` only when LLM and embedding setup is ready.
|
||||
|
|
@ -123,7 +123,7 @@ Use `--deep` only when LLM and embedding setup is ready.
|
|||
Agents should:
|
||||
|
||||
- Run `ktx status --json` before using KTX context.
|
||||
- Use `ktx sl search` and `ktx wiki search` before writing SQL from memory.
|
||||
- Use `ktx sl <query>` and `ktx wiki <query>` before writing SQL from memory.
|
||||
- Inspect the relevant YAML or Markdown files after search returns candidates.
|
||||
- Compile SQL with `ktx sl query --format sql` before executing.
|
||||
- Use `--max-rows` whenever executing a live query.
|
||||
|
|
@ -156,5 +156,5 @@ For per-client notes, see [Agent Clients](/docs/integrations/agent-clients).
|
|||
| Agent says KTX is unavailable | Agent did not load the generated instruction file | Rerun `ktx setup --agents --target <target>` and restart the agent session |
|
||||
| Agent command cannot find the project | Agent is running outside the KTX directory | Add `--project-dir <path>` or open the agent in the project root |
|
||||
| Generated rules point at a missing CLI path | CLI was moved, rebuilt, or reinstalled | Rerun `ktx setup --agents` |
|
||||
| Agent cannot find a metric | Context is missing or stale | Run `ktx sl search`, inspect source YAML, then refresh with `ktx ingest` if needed |
|
||||
| Agent cannot find a metric | Context is missing or stale | Run `ktx sl <query>`, inspect source YAML, then refresh with `ktx ingest` if needed |
|
||||
| Agent query returns too many rows | The command executed without a result cap | Require `--max-rows` for executed queries |
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ Use this order for most context changes:
|
|||
1. Discover existing context.
|
||||
|
||||
```bash
|
||||
ktx sl list --json
|
||||
ktx sl search "revenue" --json
|
||||
ktx wiki search "revenue recognition" --json --limit 10
|
||||
ktx sl --json
|
||||
ktx sl "revenue" --json
|
||||
ktx wiki "revenue recognition" --json --limit 10
|
||||
```
|
||||
|
||||
2. Edit the smallest relevant files under `semantic-layer/<connection-id>/` or
|
||||
|
|
@ -306,7 +306,7 @@ Useful frontmatter:
|
|||
1. Search first.
|
||||
|
||||
```bash
|
||||
ktx wiki search "active customer definition" --json --limit 10
|
||||
ktx wiki "active customer definition" --json --limit 10
|
||||
```
|
||||
|
||||
2. If no page covers the rule, create or edit a Markdown file under
|
||||
|
|
@ -323,8 +323,8 @@ Before accepting agent-written context:
|
|||
```bash
|
||||
git diff -- semantic-layer wiki
|
||||
ktx sl validate orders --connection-id warehouse
|
||||
ktx sl search "revenue" --json
|
||||
ktx wiki search "revenue recognition" --json --limit 10
|
||||
ktx sl "revenue" --json
|
||||
ktx wiki "revenue recognition" --json --limit 10
|
||||
```
|
||||
|
||||
Check definitions, hidden columns, join relationships, and generated SQL.
|
||||
|
|
|
|||
|
|
@ -130,10 +130,10 @@ description: Use local KTX semantic context and wiki knowledge for this project.
|
|||
|
||||
Available commands:
|
||||
- `ktx status --json --project-dir /path/to/project`
|
||||
- `ktx sl list --json --project-dir /path/to/project`
|
||||
- `ktx sl search '<text>' --json --project-dir /path/to/project --connection-id '<id>'`
|
||||
- `ktx sl --json --project-dir /path/to/project`
|
||||
- `ktx sl '<text>' --json --project-dir /path/to/project --connection-id '<id>'`
|
||||
- `ktx sl query --project-dir /path/to/project --connection-id '<id>' --query-file '<path>' --format json --execute --max-rows 100`
|
||||
- `ktx wiki search '<query>' --json --project-dir /path/to/project --limit 10`
|
||||
- `ktx wiki '<query>' --json --project-dir /path/to/project --limit 10`
|
||||
```
|
||||
|
||||
### Workflow tips
|
||||
|
|
@ -281,9 +281,9 @@ Admin CLI skills call the same KTX CLI commands:
|
|||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `ktx status --json` | Return project setup and context readiness |
|
||||
| `ktx wiki search <query> --json` | Search wiki pages |
|
||||
| `ktx sl list --json` | List semantic-layer sources |
|
||||
| `ktx sl search <query> --json` | Search semantic-layer sources |
|
||||
| `ktx wiki <query> --json` | Search wiki pages |
|
||||
| `ktx sl --json` | List semantic-layer sources |
|
||||
| `ktx sl <query> --json` | Search semantic-layer sources |
|
||||
| `ktx sl validate <source> --connection-id <id>` | Validate semantic source definitions |
|
||||
| `ktx sl query --format json` | Execute a Semantic Query when semantic compute is configured |
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue