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

Function extract_finding

atomic-agent/src/learnings.rs:287–302  ·  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

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

Callers 1

is_duplicateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected