package governance import ( "strings" ) // Development headings cannot replace the formal release baseline. func ExtractDevelopmentNotes(changelog, version string) string { return developmentNotes(changelog, version, "") } func ExtractDevelopmentNotesForCommit(changelog, version, sha string) string { return developmentNotes(changelog, version, sha) } func developmentNotes(changelog, version, sha string) string { if !SemverValid(version) { return "" } lines := strings.Split(changelog, "\n") prefix := "## 开发快照 snapshot/v" + version + " - " for i, line := range lines { if strings.HasPrefix(line, prefix) { end := len(lines) for j := i + 1; j < len(lines); j++ { if strings.HasPrefix(lines[j], "## ") { end = j break } } body := strings.TrimSpace(strings.Join(lines[i+1:end], "\n")) if sha == "" { return body } for _, field := range lines[i+1 : end] { if strings.TrimSpace(field) == "目标提交:"+sha { return body } } } } return "" }