MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / sanitize_filename

Function sanitize_filename

src/command_system/export_command.py:132–139  ·  view source on GitHub ↗

Lowercase + hyphenate into a filesystem-safe slug (export.tsx:43-49).

(text: str)

Source from the content-addressed store, hash-verified

130
131
132def sanitize_filename(text: str) -> str:
133 """Lowercase + hyphenate into a filesystem-safe slug (export.tsx:43-49)."""
134 s = text.lower()
135 s = re.sub(r"[^a-z0-9\s-]", "", s) # drop special chars
136 s = re.sub(r"\s+", "-", s) # spaces -> hyphens
137 s = re.sub(r"-+", "-", s) # collapse repeated hyphens
138 s = re.sub(r"^-|-$", "", s) # trim leading/trailing hyphens
139 return s
140
141
142def _default_filename(messages: Any) -> str:

Calls

no outgoing calls