feat(cli): top-level search command (PR-5)

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).
This commit is contained in:
nullkey
2026-05-06 14:24:11 +08:00
committed by lyingbug
parent 811802485e
commit fc5d16e331
3 changed files with 346 additions and 0 deletions
+2
View File
@@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"
"github.com/Tencent/WeKnora/cli/cmd/auth"
"github.com/Tencent/WeKnora/cli/cmd/search"
"github.com/Tencent/WeKnora/cli/internal/agent"
"github.com/Tencent/WeKnora/cli/internal/build"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
@@ -146,6 +147,7 @@ func newRootCmd(f *cmdutil.Factory) *cobra.Command {
cmd.AddCommand(newVersionCmd(f))
cmd.AddCommand(auth.NewCmdAuth(f))
cmd.AddCommand(search.NewCmdSearch(f))
return cmd
}