docs(cli): README / AGENTS.md / CHANGELOG + CI parity test
Wire-contract documentation and the CI check that keeps it honest.
* cli/README.md gains a verbatim --help block (top-level + subtrees),
an Exit codes table covering 0/1/2/3/4/5/6/7/10/124/130, a "Status
vs check" verb-pair subtable, and a "doc wait" paragraph spelling out
the four exit codes (0 / 1 / 124 / 130). The api passthrough note
trims storage provider out of the deep-config list now that
kb create --storage-provider is a polished flag.
* cli/AGENTS.md becomes the contributor guide: build/test, CRUD flag
conventions, the status/check verb pattern, long-poll wait commands,
the SetAgentHelp pattern, and a full Error code reference with 35
typed codes mapped to namespaces, exit codes, retryable / hint
guidance. Reference section is bracketed by HTML markers so a CI
parity test can keep it in sync with AllCodes().
* cli/internal/cmdutil/errors_doc_test.go enforces parity: every code
in AllCodes() must appear in AGENTS.md inside the markers, and
AGENTS.md must not reference codes that no longer exist. Fails CI
if a new typed code is added without documentation.
* CHANGELOG.md gets the v0.6 entry: BREAKING (--json / --no-stream /
WEKNORA_SDK_DEBUG / kb create --name), Added (--format / --jq /
doc wait / --log-level / kb-and-agent status & check / multi-id
delete / api --paginate / MCP schema extension / SetAgentHelp /
signal-aware ctx / kb create --storage-provider / new operation.*
namespace), Changed (multi-id partial-failure exit code, doc upload
FlagError, --log-level FlagError, multi-id stdout cleanup, README /
AGENTS.md changes), with a Migration from v0.5 section walking
every BREAKING through its v0.6 replacement.
2026-05-17 17:38:42 +00:00
|
|
|
// Package chunkcmd implements the `chunk` command subtree for managing
|
2026-05-15 17:22:14 +00:00
|
|
|
// document chunks in a knowledge base. The directory is named `chunk/`
|
docs(cli): README / AGENTS.md / CHANGELOG + CI parity test
Wire-contract documentation and the CI check that keeps it honest.
* cli/README.md gains a verbatim --help block (top-level + subtrees),
an Exit codes table covering 0/1/2/3/4/5/6/7/10/124/130, a "Status
vs check" verb-pair subtable, and a "doc wait" paragraph spelling out
the four exit codes (0 / 1 / 124 / 130). The api passthrough note
trims storage provider out of the deep-config list now that
kb create --storage-provider is a polished flag.
* cli/AGENTS.md becomes the contributor guide: build/test, CRUD flag
conventions, the status/check verb pattern, long-poll wait commands,
the SetAgentHelp pattern, and a full Error code reference with 35
typed codes mapped to namespaces, exit codes, retryable / hint
guidance. Reference section is bracketed by HTML markers so a CI
parity test can keep it in sync with AllCodes().
* cli/internal/cmdutil/errors_doc_test.go enforces parity: every code
in AllCodes() must appear in AGENTS.md inside the markers, and
AGENTS.md must not reference codes that no longer exist. Fails CI
if a new typed code is added without documentation.
* CHANGELOG.md gets the v0.6 entry: BREAKING (--json / --no-stream /
WEKNORA_SDK_DEBUG / kb create --name), Added (--format / --jq /
doc wait / --log-level / kb-and-agent status & check / multi-id
delete / api --paginate / MCP schema extension / SetAgentHelp /
signal-aware ctx / kb create --storage-provider / new operation.*
namespace), Changed (multi-id partial-failure exit code, doc upload
FlagError, --log-level FlagError, multi-id stdout cleanup, README /
AGENTS.md changes), with a Migration from v0.5 section walking
every BREAKING through its v0.6 replacement.
2026-05-17 17:38:42 +00:00
|
|
|
// to match the cobra subcommand; the Go package is `chunkcmd` to avoid
|
|
|
|
|
// colliding with cobra's *cobra.Command identifier.
|
2026-05-15 17:22:14 +00:00
|
|
|
//
|
|
|
|
|
// "chunk" in this subtree refers to indexed pieces of a knowledge
|
|
|
|
|
// document (server resource: GET/DELETE /chunks/...). Each document
|
|
|
|
|
// has many chunks; the chunking pipeline produces them at ingest time.
|
|
|
|
|
package chunkcmd
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
|
|
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const chunkLong = `Manage and inspect document chunks.
|
|
|
|
|
|
|
|
|
|
Chunks are the indexed pieces of a knowledge document (1 doc → many chunks).
|
|
|
|
|
Use 'chunk list' to enumerate chunks in stored order (RAG admin / debug).
|
|
|
|
|
For relevance-ranked retrieval, use 'search chunks "<query>" --kb <id>'
|
|
|
|
|
instead — that runs hybrid vector + keyword scoring across all chunks.`
|
|
|
|
|
|
|
|
|
|
// NewCmdChunk builds the parent `chunk` command. Called from cli/cmd/root.go.
|
|
|
|
|
func NewCmdChunk(f *cmdutil.Factory) *cobra.Command {
|
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
|
Use: "chunk <subcommand>",
|
|
|
|
|
Short: "Manage document chunks (RAG retrieval debug)",
|
|
|
|
|
Long: chunkLong,
|
|
|
|
|
Args: cobra.NoArgs,
|
|
|
|
|
Run: func(c *cobra.Command, _ []string) { _ = c.Help() },
|
|
|
|
|
}
|
|
|
|
|
cmd.AddCommand(NewCmdList(f))
|
|
|
|
|
cmd.AddCommand(NewCmdView(f))
|
|
|
|
|
cmd.AddCommand(NewCmdDelete(f))
|
|
|
|
|
return cmd
|
|
|
|
|
}
|