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

Function sanitize_id

atomic-cli/src/commands/memory/bridge.rs:121–131  ·  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

119/// Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`.
120/// Copied verbatim from `intent/bridge.rs::sanitize_id`.
121fn sanitize_id(id: &str) -> String {
122 id.chars()
123 .map(|c| {
124 if c.is_ascii_alphanumeric() || c == '-' || c == '_' {
125 c
126 } else {
127 '_'
128 }
129 })
130 .collect()
131}
132
133/// The tracked-vault path for a memory's attestation:
134/// `attestations/memory/<sanitized-id>/attested.md`.

Callers 1

sidecar_dirFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected