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

Function safeName

internal/instructions/paths.go:19–30  ·  view source on GitHub ↗

safeName maps a human instruction name to a filesystem-safe basename by replacing every character outside [A-Za-z0-9._-] with '_'.

(name string)

Source from the content-addressed store, hash-verified

17// safeName maps a human instruction name to a filesystem-safe basename by
18// replacing every character outside [A-Za-z0-9._-] with '_'.
19func safeName(name string) string {
20 var b strings.Builder
21 for _, r := range name {
22 switch {
23 case r >= 'A' && r <= 'Z', r >= 'a' && r <= 'z', r >= '0' && r <= '9', r == '.', r == '_', r == '-':
24 b.WriteRune(r)
25 default:
26 b.WriteByte('_')
27 }
28 }
29 return b.String()
30}
31
32// managedFilePath returns the absolute path of the managed file for name.
33func managedFilePath(name string) string {

Callers 1

managedFilePathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected