ktx/docs-site
Andrey Avtomonov 0425160857
fix(cli): clear error when ktx setup has no LLM backend under --no-input (#281)
* fix(cli): fail clearly when ktx setup has no LLM backend under --no-input

Non-interactive `ktx setup` silently defaulted the LLM backend to `anthropic`
and then failed with `Missing Anthropic API key: pass --anthropic-api-key-env
or --anthropic-api-key-file` — confusing for users who selected a different
provider (e.g. `--target claude-code`) and never asked for the Anthropic API
backend.

That silent default could never succeed: it was reached only when no backend,
Anthropic key, or Vertex flag was supplied, and in exactly that case the
Anthropic credential resolver always failed (no env fallback in disabled mode).
Unlike embeddings, the LLM has no credential-free default (anthropic needs a
key, vertex needs gcloud ADC, claude-code/codex need a logged-in local CLI), so
there is nothing safe to assume.

`chooseBackend` now fails clearly in disabled mode with no backend, naming the
(hidden) `--llm-backend` flag and its choices and noting each backend's
credential needs. `--llm-backend` stays hidden in `--help`, consistent with the
rest of the documented automation surface; the error message is the discovery
path.

- Add a unit test (no backend, disabled -> clear message) and a CLI/integration
  test (`--target claude-code --no-input` -> exit 1, clear message, not the
  Anthropic red herring).
- Document the no-default behavior and add a Common-errors row in
  docs-site ktx-setup.mdx.

* refactor(cli): single source of truth for setup LLM backends

The set of LLM backends a user can pick during `ktx setup` (claude-code,
codex, anthropic, vertex) was hand-enumerated in five places: the
`--llm-backend` arg parser, the `KtxSetupLlmBackend` union, the interactive
prompt's narrowing, the prompt options, and the missing-backend error. Only
some had TypeScript coverage, so adding a backend could silently drift (e.g.
a valid value rejected by the parser, or routed to anthropic by the prompt's
`? : 'anthropic'` fallback).

Collapse them onto one `KTX_SETUP_LLM_BACKENDS` list:
- `KtxSetupLlmBackend` is derived from it.
- `isKtxSetupLlmBackend` is the shared validator; the arg parser and the
  prompt both route through it instead of re-listing literals.
- The prompt options derive from the list, with a `Record<KtxSetupLlmBackend,
  string>` label map so a new backend fails to compile until it has a label.
- The missing-backend error builds its choice list from the same source.

Behavior-preserving: identical accepted values and parse error, identical
prompt options (asserted by an existing test), and the prompt's unreachable
fallback now cancels rather than silently assuming anthropic.
2026-06-09 17:11:39 +00:00
..
app docs: remove product switcher from docs nav (#272) 2026-06-08 19:53:29 -04:00
components feat: add GitHub star nudges to CLI build view and docs sidebar (#271) 2026-06-08 16:14:56 +02:00
content/docs fix(cli): clear error when ktx setup has no LLM backend under --no-input (#281) 2026-06-09 17:11:39 +00:00
lib docs: consolidate AI Resources into a single page (#274) 2026-06-09 00:28:56 -04:00
public feat: README architecture diagrams + React Flow diagram studio (#245) 2026-06-01 12:06:27 +02:00
tests docs: consolidate AI Resources into a single page (#274) 2026-06-09 00:28:56 -04:00
.gitignore chore: configure docs site deployment 2026-05-11 17:57:55 +02:00
next-env.d.ts docs(quickstart): redesign demo-warehouse callout with sticker icons (#202) 2026-05-21 16:04:58 +02:00
next.config.mjs docs: consolidate AI Resources into a single page (#274) 2026-06-09 00:28:56 -04:00
package.json feat: README architecture diagrams + React Flow diagram studio (#245) 2026-06-01 12:06:27 +02:00
postcss.config.mjs chore: move docs site workspace 2026-05-11 16:53:42 +02:00
proxy.ts docs: rewrite Semantic Querying concept with imperative-vs-declarative diagram (#156) 2026-05-19 23:41:29 +02:00
source.config.ts docs: revamp quickstart and tighten code-block styling (#135) 2026-05-18 19:22:19 +02:00
tsconfig.json feat: merge ingest and scan 2026-05-14 01:43:06 +02:00