refactor(cli): resource-command refactors — --kb resolver, MCP session_ask, session stop (BREAKING)
Unify the --kb resolver (accepts name or UUID) across kb/doc/chunk/session/ search/chat/link; `agent create` attaches knowledge bases via --attach-kb (no longer --kb). Rename the MCP tool agent_invoke → session_ask and drop dead MCP error codes. Add `session stop` (StopSession), completing the start / continue-stream / stop triad. Across these commands, bring the agent contract up to par: --dry-run previews on mutations (incl. kb pin/unpin, session stop), agent-help blobs on the read/health surface, accurate destructive-confirmation verbs, and search has_more truncation signalling so an agent can tell its results were capped.
This commit is contained in:
@@ -137,6 +137,23 @@ func TestRunSearch_NilService(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "server.error")
|
||||
}
|
||||
|
||||
// TestNewCmdChunks_RequiresKB asserts that running `search chunks "<query>"`
|
||||
// without --kb returns an error containing `required flag(s) "kb"`.
|
||||
// This locks the behavior so a later refactor cannot silently introduce a
|
||||
// project-link fallback for this destructive-free read path.
|
||||
func TestNewCmdChunks_RequiresKB(t *testing.T) {
|
||||
iostreams.SetForTest(t)
|
||||
cmd := NewCmdChunks(&cmdutil.Factory{
|
||||
Client: func() (*sdk.Client, error) { return nil, nil },
|
||||
})
|
||||
cmd.SetArgs([]string{"some query"}) // query but no --kb
|
||||
cmd.SilenceErrors = true
|
||||
cmd.SilenceUsage = true
|
||||
err := cmd.Execute()
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), `required flag(s) "kb"`)
|
||||
}
|
||||
|
||||
func TestNewCmdChunks_RequiresQuery(t *testing.T) {
|
||||
iostreams.SetForTest(t)
|
||||
cmd := NewCmdChunks(&cmdutil.Factory{
|
||||
|
||||
Reference in New Issue
Block a user