chore(cli): remove unused v0.0 scaffolding
Foundation PR-1 reserved several internal packages and helpers as
scaffolding for follow-up PRs that ended up taking different routes.
Audit confirms zero production references; this commit removes them so
the cli/ tree reflects what's actually shipped.
Removed (148 LOC):
cli/internal/safepaths/ — `Validate` / `WithinRoot` /
three sentinel errors. Reserved
for `weknora doc upload`'s path
scrubbing; that command landed
in PR-10 using its own
`validateUploadPath` (os.Stat +
regular-file check) — sufficient
for the actual threat model
(local CLI invocations).
cli/internal/cmdutil/json_flags.go — `AddJSONFlags` helper +
unused --jq / --template flag
registration. Reserved for PR-3
"lipgloss tables / jq evaluator"
which never materialized; every
command directly registers
BoolVar(&JSONOut, "json", ...)
since v0.0 ship time.
cmdutil.NewTableExporter — empty alias for jsonExporter,
reserved for the same PR-3
renderer. Removed; jsonExporter
stays under NewJSONExporter.
cmdutil.Options marker interface — empty interface{} reserved as a
convention; no command embeds
or asserts against it.
Stale comments fixed:
- cmd/root.go: package comment updated kb (list+get) → kb
(list+view+create+delete) and noted the `get` cobra alias.
- cmd/root.go: dropped --no-version-check forward-reference (no such flag).
- cmd/root.go: removed "(PR-7)" attribution from NewRootCmd doc comment.
- cmd/kb/kb.go: same package-comment update.
- cmd/chat/chat.go: replaced "PR-7" mention in --help example with a
generic placeholder so cobra-rendered help is review-clean.
- cmd/search/search.go: removed "Lipgloss tables arrive in PR-3"
forward-reference; the inline indent helper is the shipped form.
- internal/agent/annotations.go: ShouldUseAgentMode → DetectAIAgent
(removed in PR-12).
AGENTS.md "Known limitations" section added:
Documents that chat / search / doc upload currently surface server-side
precondition misses (LLM / vector store / storage engine not configured)
as `network.error` with `context deadline exceeded`. A planned future
release will introduce a `precondition.*` typed error namespace
(server returns HTTP 412 before opening the SSE / streaming response).
This documents the limitation honestly for reviewers and integrators
rather than claiming a behavior we don't yet have.
Tests: 27 cli packages pass (safepaths_test was the 28th — gone with the
package). go vet clean.
This commit is contained in:
@@ -78,7 +78,7 @@ Modes:
|
||||
TTY (default): live token streaming + reference footer
|
||||
Pipe / --no-stream / --json: buffered, emitted once on completion`,
|
||||
Example: ` weknora chat "What is RRF?" --kb-id kb_123
|
||||
weknora chat "Summarise PR-7" --kb my-kb --json
|
||||
weknora chat "Summarise this design doc" --kb my-kb --json
|
||||
weknora chat "Continue?" --session-id sess_abc`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
// Package kb holds `weknora kb` command tree (list / get; create / delete in v0.2).
|
||||
// Package kb holds the `weknora kb` command tree: list / view / create / delete.
|
||||
// `view` is the primary read verb (gh repo view convention); `get` survives as
|
||||
// a cobra alias on the view subcommand for v0.0/v0.1 callers.
|
||||
package kb
|
||||
|
||||
import (
|
||||
|
||||
+1
-4
@@ -134,7 +134,7 @@ var cobraFlagErrorPrefixes = []string{
|
||||
}
|
||||
|
||||
// NewRootCmd builds the cobra tree. Splitting it from Execute() lets tests
|
||||
// drive the tree directly with their own factory. Exported (PR-7) so the
|
||||
// drive the tree directly with their own factory. Exported so the
|
||||
// acceptance/contract suite can construct the tree in-process.
|
||||
func NewRootCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
v, commit, date := build.Info()
|
||||
@@ -192,9 +192,6 @@ hybrid searches against a WeKnora server from your shell or an AI agent.`,
|
||||
// addGlobalFlags registers persistent flags available on every subcommand.
|
||||
// Only flags whose behavior is actually wired are listed — a flag that
|
||||
// accepts values but does nothing is a worse contract than no flag.
|
||||
//
|
||||
// --context lands here in v0.1 (spec §1.2); --no-version-check waits for
|
||||
// v0.7's compat probe consumer.
|
||||
func addGlobalFlags(cmd *cobra.Command) {
|
||||
pf := cmd.PersistentFlags()
|
||||
pf.BoolP("yes", "y", false, "Skip confirmation prompts on destructive operations")
|
||||
|
||||
@@ -133,10 +133,9 @@ func runSearch(ctx context.Context, opts *Options, svc Service) error {
|
||||
return renderHumanResults(results, opts.KBID)
|
||||
}
|
||||
|
||||
// renderHumanResults prints a compact pretty list to stdout.
|
||||
//
|
||||
// Lipgloss tables arrive in PR-3; the inline indent helper here is a minimal
|
||||
// stopgap so search is usable in a terminal without color today.
|
||||
// renderHumanResults prints a compact pretty list to stdout. The inline
|
||||
// indent helper is a minimal stopgap so search output is usable in a plain
|
||||
// terminal; a richer tabular renderer can replace this later.
|
||||
func renderHumanResults(results []*sdk.SearchResult, kbID string) error {
|
||||
if len(results) == 0 {
|
||||
fmt.Fprintln(iostreams.IO.Out, "(no results)")
|
||||
|
||||
Reference in New Issue
Block a user