The fourth and final v0.0 command — chunk hybrid retrieval, the demo
headline operation per ADR-3 (only one search command in the tree).
Maps to client.HybridSearch / GET /knowledge-bases/{id}/hybrid-search;
no SDK or server changes.
Flags:
- --kb (required): target knowledge base
- --top-k (default 8): max results
- --vector-threshold / --keyword-threshold: similarity floors
- --no-vector / --no-keyword: disable individual channels (mutually
exclusive at the validation gate; checked before the SDK client is
built so flag misuse fails fast)
- --json: emit envelope JSON (otherwise pretty list)
Service interface narrowed to just HybridSearch; tests inject fakes via
Factory.Client closure override.
Pretty rendering is a minimal text indent today; lipgloss tables arrive
in PR-3 of v0.2 (format/ split into presenters/style/tableprinter).
First two leaf commands and the auth/ command group, registered under
the root command tree.
auth login:
- Email + password (interactive huh prompter) OR --with-token (read API
key from stdin) for headless / CI use
- Validates --host (required, must be http/https URL)
- Persists access + refresh tokens (password mode) or api_key (token mode)
into the secrets store wired in PR-3 — uses Store.Ref to record the
URI scheme without leaking concrete backend type
- Writes the named context to ~/.config/weknora/config.yaml and sets it
as current_context
- Typed loginResult payload for --json output (no map[string]any)
auth status:
- Calls client.GetCurrentUser -> /auth/me, prints context / host / user /
tenant. --json emits a typed statusResult envelope with _meta.context
and tenant_id populated for agents.
- Service interface narrowed to just GetCurrentUser; tests inject fakes
by overriding Factory.Client (no runF gymnastics).
cmd/root.go: register \`auth\` parent under the root tree.
Adds the OS keyring secret backend and the huh-based TTY Prompter so
PR-4 (auth login) can persist credentials and read interactive input.
The Factory's Client closure SDK wiring + Secrets closure landed in
PR-1's foundation tree to keep PR-1 self-contained.
internal/secrets/keyring.go:
- KeyringStore: zalando/go-keyring backed; namespace "weknora:<context>".
KeyringStore.Ref -> keychain://weknora/<context>/<key>
- NewBestEffortStore probes the OS keyring with a sentinel get and falls
back to FileStore on unsupported platforms (WSL without DBus, etc.)
internal/prompt/tty.go:
- TTYPrompter: huh.NewForm / huh.NewInput / huh.NewConfirm wrapper
satisfying Prompter. Used when iostreams.IO reports both stdout and
stderr are TTYs.
Dependencies (zalando/go-keyring, charmbracelet/huh) are declared in
PR-1's go.mod since the foundation tree referenced them via the Store
interface and TTY-detection helpers.