MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / validateName

Function validateName

internal/providers/store.go:183–193  ·  view source on GitHub ↗

validateName rejects empty names and names containing whitespace. JSON itself permits arbitrary key strings, but whitespace would make the provider unusable from the shell flag parser.

(name string)

Source from the content-addressed store, hash-verified

181// itself permits arbitrary key strings, but whitespace would make the
182// provider unusable from the shell flag parser.
183func validateName(name string) error {
184 if name == "" {
185 return fmt.Errorf("empty name: %w", ErrInvalidName)
186 }
187 for _, r := range name {
188 if r == ' ' || r == '\t' || r == '\n' || r == '\r' {
189 return fmt.Errorf("name %q contains whitespace: %w", name, ErrInvalidName)
190 }
191 }
192 return nil
193}
194
195// applyListPatch combines current with patch according to patch.Op.
196// The function preserves input order and de-duplicates results so a

Callers 2

AddFunction · 0.70
RenameFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected