MCPcopy Create free account
hub / github.com/diillson/chatcli / Update

Method Update

cli/context_adapter.go:252–271  ·  view source on GitHub ↗

Update re-ingests or modifies an existing context. Empty fields keep the current value (mirrors /context update).

(name string, paths []string, mode, description string, tags []string)

Source from the content-addressed store, hash-verified

250// Update re-ingests or modifies an existing context. Empty fields keep the
251// current value (mirrors /context update).
252func (a *contextPluginAdapter) Update(name string, paths []string, mode, description string, tags []string) (string, error) {
253 mgr := a.manager()
254 if mgr == nil {
255 return "", fmt.Errorf("context manager unavailable in this session")
256 }
257 if mode != "" {
258 if _, ok := validContextMode(mode); !ok {
259 return "", fmt.Errorf("invalid mode %q (valid: knowledge|full|summary|chunked|smart)", mode)
260 }
261 }
262 ctx, cancel := context.WithTimeout(context.Background(), contextOpTimeout)
263 defer cancel()
264 fc, err := mgr.UpdateContext(ctx, name, paths, ctxmgr.ProcessingMode(mode), tags, description)
265 if err != nil {
266 return "", err
267 }
268 var b strings.Builder
269 fmt.Fprintf(&b, "Updated context %q (mode=%s) — %d unit(s), %s.", fc.Name, fc.Mode, fc.FileCount, humanMB(fc.TotalSize))
270 return b.String(), nil
271}
272
273// Show renders one context's metadata.
274func (a *contextPluginAdapter) Show(name string) (string, error) {

Callers 1

Calls 7

managerMethod · 0.95
ProcessingModeTypeAlias · 0.92
validContextModeFunction · 0.85
humanMBFunction · 0.85
ErrorfMethod · 0.80
UpdateContextMethod · 0.80
StringMethod · 0.45

Tested by 1