@@ -142,18 +142,26 @@ export function formatGitHubSummary(githubStats: {
142142 totalDocuments : number ;
143143 byType : { issue ?: number ; pull_request ?: number } ;
144144 byState : { open ?: number ; closed ?: number ; merged ?: number } ;
145+ issuesByState ?: { open : number ; closed : number } ;
146+ prsByState ?: { open : number ; closed : number ; merged : number } ;
145147 lastIndexed : string ;
146148} ) : string {
147149 const issues = githubStats . byType . issue || 0 ;
148150 const prs = githubStats . byType . pull_request || 0 ;
149- const open = githubStats . byState . open || 0 ;
150- const merged = githubStats . byState . merged || 0 ;
151+
152+ // Use per-type state counts if available (new format), fall back to aggregate (old format)
153+ const issuesOpen = githubStats . issuesByState ?. open ?? 0 ;
154+ const issuesClosed = githubStats . issuesByState ?. closed ?? 0 ;
155+ const prsOpen = githubStats . prsByState ?. open ?? 0 ;
156+ const prsMerged = githubStats . prsByState ?. merged ?? 0 ;
151157
152158 const timeSince = getTimeSince ( new Date ( githubStats . lastIndexed ) ) ;
153159
154160 return [
155161 `🔗 ${ chalk . bold ( githubStats . repository ) } • ${ formatNumber ( githubStats . totalDocuments ) } documents` ,
156- ` ${ chalk . gray ( issues . toString ( ) ) } issues • ${ chalk . gray ( prs . toString ( ) ) } PRs • ${ chalk . gray ( open . toString ( ) ) } open • ${ chalk . gray ( merged . toString ( ) ) } merged • Synced ${ timeSince } ` ,
162+ ` Issues: ${ chalk . gray ( issues . toString ( ) ) } total (${ issuesOpen } open, ${ issuesClosed } closed)` ,
163+ ` Pull Requests: ${ chalk . gray ( prs . toString ( ) ) } total (${ prsOpen } open, ${ prsMerged } merged)` ,
164+ ` Last synced: ${ timeSince } ` ,
157165 ] . join ( '\n' ) ;
158166}
159167
@@ -369,6 +377,8 @@ export function printRepositoryStats(data: {
369377 totalDocuments : number ;
370378 byType : { issue ?: number ; pull_request ?: number } ;
371379 byState : { open ?: number ; closed ?: number ; merged ?: number } ;
380+ issuesByState ?: { open : number ; closed : number } ;
381+ prsByState ?: { open : number ; closed : number ; merged : number } ;
372382 lastIndexed : string ;
373383 } | null ;
374384} ) : void {
@@ -471,19 +481,21 @@ export function printRepositoryStats(data: {
471481 const issues = githubStats . byType . issue || 0 ;
472482 const prs = githubStats . byType . pull_request || 0 ;
473483
484+ // Use per-type state counts if available (new format), fall back to aggregate (old format)
485+ const issuesOpen = githubStats . issuesByState ?. open ?? githubStats . byState . open ?? 0 ;
486+ const issuesClosed = githubStats . issuesByState ?. closed ?? githubStats . byState . closed ?? 0 ;
487+ const prsOpen = githubStats . prsByState ?. open ?? githubStats . byState . open ?? 0 ;
488+ const prsMerged = githubStats . prsByState ?. merged ?? githubStats . byState . merged ?? 0 ;
489+
474490 if ( issues > 0 ) {
475- const openIssues = githubStats . byState . open || 0 ;
476- const closedIssues = githubStats . byState . closed || 0 ;
477491 output . log (
478- ` Issues: ${ chalk . bold ( issues . toString ( ) ) } total (${ chalk . green ( ` ${ openIssues } open` ) } , ${ chalk . gray ( ` ${ closedIssues } closed` ) } )`
492+ ` Issues: ${ chalk . bold ( issues . toString ( ) ) } total (${ issuesOpen } open, ${ issuesClosed } closed)`
479493 ) ;
480494 }
481495
482496 if ( prs > 0 ) {
483- const openPRs = githubStats . byState . open || 0 ;
484- const mergedPRs = githubStats . byState . merged || 0 ;
485497 output . log (
486- ` Pull Requests: ${ chalk . bold ( prs . toString ( ) ) } total (${ chalk . green ( ` ${ openPRs } open` ) } , ${ chalk . magenta ( ` ${ mergedPRs } merged` ) } )`
498+ ` Pull Requests: ${ chalk . bold ( prs . toString ( ) ) } total (${ prsOpen } open, ${ prsMerged } merged)`
487499 ) ;
488500 }
489501
@@ -905,16 +917,21 @@ export function printGitHubStats(githubStats: {
905917 totalDocuments : number ;
906918 byType : { issue ?: number ; pull_request ?: number ; discussion ?: number } ;
907919 byState : { open ?: number ; closed ?: number ; merged ?: number } ;
920+ issuesByState ?: { open : number ; closed : number } ;
921+ prsByState ?: { open : number ; closed : number ; merged : number } ;
908922 lastIndexed : string ;
909923 indexDuration ?: number ;
910924} ) : void {
911925 const issues = githubStats . byType . issue || 0 ;
912926 const prs = githubStats . byType . pull_request || 0 ;
913927 const discussions = githubStats . byType . discussion || 0 ;
914928
915- const openCount = githubStats . byState . open || 0 ;
916- const closedCount = githubStats . byState . closed || 0 ;
917- const mergedCount = githubStats . byState . merged || 0 ;
929+ // Use per-type state counts if available (new format), fall back to aggregate (old format)
930+ const issueOpen = githubStats . issuesByState ?. open ?? 0 ;
931+ const issueClosed = githubStats . issuesByState ?. closed ?? 0 ;
932+ const prOpen = githubStats . prsByState ?. open ?? 0 ;
933+ const prClosed = githubStats . prsByState ?. closed ?? 0 ;
934+ const prMerged = githubStats . prsByState ?. merged ?? 0 ;
918935
919936 const timeSince = getTimeSince ( new Date ( githubStats . lastIndexed ) ) ;
920937
@@ -928,9 +945,6 @@ export function printGitHubStats(githubStats: {
928945 // Issues breakdown
929946 if ( issues > 0 ) {
930947 const issueStates : string [ ] = [ ] ;
931- // Calculate issue-specific counts (open + closed, no merged for issues)
932- const issueOpen = openCount > 0 ? openCount : 0 ;
933- const issueClosed = closedCount > 0 ? closedCount : 0 ;
934948
935949 if ( issueOpen > 0 ) {
936950 issueStates . push ( `${ chalk . green ( '●' ) } ${ issueOpen } open` ) ;
@@ -949,13 +963,13 @@ export function printGitHubStats(githubStats: {
949963 // Pull requests breakdown
950964 if ( prs > 0 ) {
951965 const prStates : string [ ] = [ ] ;
952- // For PRs, we show open and merged
953- const prOpen = openCount > 0 ? openCount : 0 ;
954- const prMerged = mergedCount > 0 ? mergedCount : 0 ;
955966
956967 if ( prOpen > 0 ) {
957968 prStates . push ( `${ chalk . green ( '●' ) } ${ prOpen } open` ) ;
958969 }
970+ if ( prClosed > 0 ) {
971+ prStates . push ( `${ chalk . gray ( '●' ) } ${ prClosed } closed` ) ;
972+ }
959973 if ( prMerged > 0 ) {
960974 prStates . push ( `${ chalk . magenta ( '●' ) } ${ prMerged } merged` ) ;
961975 }
0 commit comments