@@ -26,9 +26,13 @@ type ReleaseNotesGenerator struct {
2626}
2727
2828type ReleaseNotesJSON struct {
29- Title string `json:"title"`
30- Summary string `json:"summary"`
31- Highlights []string `json:"highlights"`
29+ Title string `json:"title"`
30+ Summary string `json:"summary"`
31+ Highlights []string `json:"highlights"`
32+ Sections []struct {
33+ Title string `json:"title"`
34+ Items []string `json:"items"`
35+ } `json:"sections"`
3236 BreakingChanges []string `json:"breaking_changes"`
3337 Contributors string `json:"contributors"`
3438}
@@ -47,12 +51,33 @@ func getReleaseNotesSchema() *genai.Schema {
4751 Type : genai .TypeString ,
4852 Description : "2-3 sentences explaining the release focus in first person plural" ,
4953 },
54+ "sections" : {
55+ Type : genai .TypeArray ,
56+ Items : & genai.Schema {
57+ Type : genai .TypeObject ,
58+ Properties : map [string ]* genai.Schema {
59+ "title" : {
60+ Type : genai .TypeString ,
61+ Description : "Section title (e.g. '🎨 UI/UX Improvements')" ,
62+ },
63+ "items" : {
64+ Type : genai .TypeArray ,
65+ Items : & genai.Schema {
66+ Type : genai .TypeString ,
67+ },
68+ Description : "List of items in this section" ,
69+ },
70+ },
71+ Required : []string {"title" , "items" },
72+ },
73+ Description : "Categorized sections of the release notes" ,
74+ },
5075 "highlights" : {
5176 Type : genai .TypeArray ,
5277 Items : & genai.Schema {
5378 Type : genai .TypeString ,
5479 },
55- Description : "Array of highlights as strings " ,
80+ Description : "Legacy flat list of highlights (keep empty if sections are used) " ,
5681 },
5782 "breaking_changes" : {
5883 Type : genai .TypeArray ,
@@ -351,6 +376,16 @@ func (g *ReleaseNotesGenerator) parseJSONResponse(content string, release *model
351376 Links : make (map [string ]string ),
352377 }
353378
379+ if len (jsonNotes .Sections ) > 0 {
380+ notes .Sections = make ([]models.ReleaseNotesSection , len (jsonNotes .Sections ))
381+ for i , s := range jsonNotes .Sections {
382+ notes .Sections [i ] = models.ReleaseNotesSection {
383+ Title : s .Title ,
384+ Items : s .Items ,
385+ }
386+ }
387+ }
388+
354389 if jsonNotes .Contributors != "" && jsonNotes .Contributors != "N/A" {
355390 notes .Links ["Contributors" ] = jsonNotes .Contributors
356391 }
0 commit comments