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

Function resolveListKey

cli/workspace/memory/profile_ops.go:59–74  ·  view source on GitHub ↗

resolveListKey maps an update key — optionally carrying an operation affix ("goals_replace", "remove_goals") — to its canonical list field and op.

(key string)

Source from the content-addressed store, hash-verified

57// resolveListKey maps an update key — optionally carrying an operation affix
58// ("goals_replace", "remove_goals") — to its canonical list field and op.
59func resolveListKey(key string) (field string, op listOp, ok bool) {
60 k := strings.ToLower(strings.TrimSpace(key))
61 op = opUpsert
62 for _, a := range opAffixes {
63 if strings.HasSuffix(k, "_"+a.affix) {
64 k, op = strings.TrimSuffix(k, "_"+a.affix), a.op
65 break
66 }
67 if strings.HasPrefix(k, a.affix+"_") {
68 k, op = strings.TrimPrefix(k, a.affix+"_"), a.op
69 break
70 }
71 }
72 field, ok = listFieldAliases[k]
73 return field, op, ok
74}
75
76// splitListItems splits a comma/semicolon-separated value into items WITHOUT
77// splitting inside parentheses/brackets, so "Quiz X (Anthropic, 60 questões)"

Callers 1

applyUpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected