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

Function sanitize_id

atomic-cli/src/commands/intent/bridge.rs:91–101  ·  view source on GitHub ↗

Sanitize an intent id/key for use as a directory name in the sidecar/vault path. Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`.

(id: &str)

Source from the content-addressed store, hash-verified

89/// Sanitize an intent id/key for use as a directory name in the sidecar/vault
90/// path. Keeps ASCII alphanumerics, `-` and `_`; everything else becomes `_`.
91fn sanitize_id(id: &str) -> String {
92 id.chars()
93 .map(|c| {
94 if c.is_ascii_alphanumeric() || c == '-' || c == '_' {
95 c
96 } else {
97 '_'
98 }
99 })
100 .collect()
101}
102
103/// The normalized intent id used to key BOTH the tracked vault attestation path
104/// and the legacy `.atomic` sidecar dir, so the dual-read fallback lines up

Callers 3

sidecar_dirFunction · 0.70

Calls

no outgoing calls