MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / sanitize_id

Function sanitize_id

atomic-cli/src/commands/memory/bridge.rs:134–144  ·  view source on GitHub ↗

Sanitize a memory id for use as a directory name in the sidecar/vault path. Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`. Copied verbatim from `intent/bridge.rs::sanitize_id`.

(id: &str)

Source from the content-addressed store, hash-verified

132/// Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`.
133/// Copied verbatim from `intent/bridge.rs::sanitize_id`.
134fn sanitize_id(id: &str) -> String {
135 id.chars()
136 .map(|c| {
137 if c.is_ascii_alphanumeric() || c == '-' || c == '_' {
138 c
139 } else {
140 '_'
141 }
142 })
143 .collect()
144}
145
146/// The tracked-vault path for a memory's attestation:
147/// `attestations/memory/<sanitized-id>/attested.md`.

Callers 1

sidecar_dirFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected