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

Function extract_finding

atomic-agent/src/learnings.rs:289–304  ·  view source on GitHub ↗

Extract the finding portion from a learning line. Given `"- src/auth.rs:42 — Wrong timezone [bug]"`, returns `"Wrong timezone"`. Given `"- Auth uses RS256"`, returns `"Auth uses RS256"`.

(line: &str)

Source from the content-addressed store, hash-verified

287/// Given `"- src/auth.rs:42 — Wrong timezone [bug]"`, returns `"Wrong timezone"`.
288/// Given `"- Auth uses RS256"`, returns `"Auth uses RS256"`.
289fn extract_finding(line: &str) -> String {
290 let stripped = line.strip_prefix("- ").unwrap_or(line);
291
292 // Code learnings have " — " separator
293 if let Some(idx) = stripped.find(" — ") {
294 let after = &stripped[idx + 4..]; // skip " — "
295 // Strip category suffix like " [bug]"
296 if let Some(bracket) = after.rfind(" [") {
297 return after[..bracket].trim().to_string();
298 }
299 return after.trim().to_string();
300 }
301
302 // Repo/workflow learnings are just the text
303 stripped.trim().to_string()
304}
305
306// Deduplication
307

Callers 1

is_duplicateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected