codetether-agent 4.7.0-a-002.2

A2A-native AI coding agent for the CodeTether ecosystem
Documentation
use std::path::Path;

pub fn target(path: &str, text: &str) -> Option<String> {
    let stem = Path::new(path).file_stem()?.to_string_lossy();
    let expected = format!("{stem}Root");
    if !text.contains(&expected) {
        return None;
    }
    if text.contains(&format!("<{expected}")) || text.contains(&format!("{expected}(")) {
        Some(expected)
    } else {
        None
    }
}

pub fn stem(path: &str) -> Option<String> {
    Path::new(path)
        .file_stem()
        .map(|stem| stem.to_string_lossy().to_string())
}