MCPcopy Create free account
hub / github.com/GCWing/BitFun / validate_agent_name

Function validate_agent_name

src/apps/desktop/src/api/subagent_api.rs:263–277  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

261}
262
263fn validate_agent_name(name: &str) -> Result<(), String> {
264 if name.is_empty() {
265 return Err("Name cannot be empty".to_string());
266 }
267 let mut chars = name.chars();
268 if !chars.next().is_some_and(|c| c.is_ascii_alphabetic()) {
269 return Err("Name must start with a letter".to_string());
270 }
271 for c in chars {
272 if !c.is_ascii_alphanumeric() && c != '-' && c != '_' {
273 return Err("Name can only contain letters, numbers, -, _".to_string());
274 }
275 }
276 Ok(())
277}
278
279#[tauri::command]
280pub async fn create_subagent(

Callers 1

create_subagentFunction · 0.70

Calls 2

nextMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected