@@ -30,8 +30,11 @@ export default {
3030 /** @type string[] */
3131 const usersFromSummary = [ ] ;
3232
33+ // Parse summary to extract scope and description
34+ const summary = changeset . summary ;
35+
3336 // Remove PR, commit, author/user lines from summary
34- const replacedChangelog = changeset . summary
37+ const replacedChangelog = summary
3538 . replace ( / ^ \s * (?: p r | p u l l | p u l l \s + r e q u e s t ) : \s * # ? ( \d + ) / im, ( _ , pr ) => {
3639 const num = Number ( pr ) ;
3740 if ( ! Number . isNaN ( num ) ) {
@@ -49,6 +52,24 @@ export default {
4952 } )
5053 . trim ( ) ;
5154
55+ // Detect scope from **scope**: format
56+ const scopeMatch = replacedChangelog . match ( / ^ \* \* ( [ ^ : ] + ) \* \* : ? \s * ( .* ) $ / ) ;
57+ const scope = scopeMatch ? scopeMatch [ 1 ] : null ;
58+ const description = scopeMatch ? scopeMatch [ 2 ] : replacedChangelog ;
59+
60+ // Detect breaking changes (explicit BREAKING or major version) - for future use
61+ const explicitBreaking =
62+ / ^ B R E A K I N G [: \s] / i. test ( replacedChangelog ) || / \b B R E A K I N G C H A N G E \b / i. test ( replacedChangelog ) ;
63+ void explicitBreaking ;
64+
65+ // Build formatted entry
66+ const entryParts = [ ] ;
67+ if ( scope ) {
68+ entryParts . push ( `**${ scope } **: ${ description } ` ) ;
69+ } else {
70+ entryParts . push ( description ) ;
71+ }
72+
5273 const links = await ( async ( ) => {
5374 if ( prFromSummary !== undefined ) {
5475 let { links } = await getInfoFromPullRequest ( {
@@ -81,27 +102,13 @@ export default {
81102 } ;
82103 } ) ( ) ;
83104
84- const users = usersFromSummary . length
85- ? usersFromSummary
86- . map ( ( userFromSummary ) => `[@${ userFromSummary } ](https://github.com/${ userFromSummary } )` )
87- . join ( ', ' )
88- : links . user ;
89-
90- const metadata = [
91- links . pull === null ? '' : ` (${ links . pull } )` ,
92- links . commit === null ? '' : ` (${ links . commit } )` ,
93- users === null ? '' : ` by ${ users } ` ,
94- ] . join ( '' ) ;
95-
96- // Split summary into first line and the rest
97- const [ firstLine , ...rest ] = replacedChangelog . split ( '\n' ) ;
98- const restSummary = rest . join ( '\n' ) . trim ( ) ;
99-
100- // No code block conversion: preserve original triple backtick code blocks and indentation
101- let releaseLine = `\n- ${ firstLine } ${ metadata } ` ;
102- if ( restSummary ) {
103- releaseLine += '\n\n' + restSummary ;
105+ // Add PR link at end
106+ if ( links . pull ) {
107+ entryParts . push ( `(${ links . pull } )` ) ;
108+ } else if ( prFromSummary !== undefined ) {
109+ entryParts . push ( `([#${ prFromSummary } ](https://github.com/${ repo } /pull/${ prFromSummary } ))` ) ;
104110 }
105- return releaseLine ;
111+
112+ return `\n- ${ entryParts . join ( ' ' ) } ` ;
106113 } ,
107114} ;
0 commit comments