Skip to main content

ai_agent/utils/
release_notes.rs

1//! Release notes utilities.
2
3use serde::{Deserialize, Serialize};
4
5/// Release note entry
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct ReleaseNote {
8    pub version: String,
9    pub date: String,
10    pub changes: Vec<Change>,
11}
12
13/// Type of change
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub enum ChangeType {
16    Added,
17    Changed,
18    Deprecated,
19    Removed,
20    Fixed,
21    Security,
22}
23
24/// A single change
25#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct Change {
27    pub change_type: ChangeType,
28    pub description: String,
29}
30
31/// Parse release notes from markdown
32pub fn parse_release_notes(markdown: &str) -> Vec<ReleaseNote> {
33    let mut notes = Vec::new();
34
35    // Simple parsing - look for version headers
36    for line in markdown.lines() {
37        if line.starts_with("## ") && line.contains("v") {
38            // Extract version
39            let version = line
40                .trim_start_matches("## ")
41                .trim_start_matches("v")
42                .split_whitespace()
43                .next()
44                .unwrap_or("0.0.0")
45                .to_string();
46
47            notes.push(ReleaseNote {
48                version,
49                date: String::new(),
50                changes: Vec::new(),
51            });
52        }
53    }
54
55    notes
56}