@@ -30,6 +30,31 @@ const STATUS_LABELS: Record<IssueStatus, string> = {
3030 ignored : "− Ignored" ,
3131} ;
3232
33+ /** Maximum features to display before truncating with "... and N more" */
34+ const MAX_DISPLAY_FEATURES = 10 ;
35+
36+ /**
37+ * Format a features array for display, truncating if necessary.
38+ *
39+ * @param features - Array of feature names (may be undefined)
40+ * @returns Formatted lines to append to output, or empty array if no features
41+ */
42+ function formatFeaturesList ( features : string [ ] | undefined ) : string [ ] {
43+ if ( ! features || features . length === 0 ) {
44+ return [ ] ;
45+ }
46+
47+ const lines : string [ ] = [ "" , `Features (${ features . length } ):` ] ;
48+ const displayFeatures = features . slice ( 0 , MAX_DISPLAY_FEATURES ) ;
49+ lines . push ( ` ${ displayFeatures . join ( ", " ) } ` ) ;
50+
51+ if ( features . length > MAX_DISPLAY_FEATURES ) {
52+ lines . push ( ` ... and ${ features . length - MAX_DISPLAY_FEATURES } more` ) ;
53+ }
54+
55+ return lines ;
56+ }
57+
3358/**
3459 * Get status icon for an issue status
3560 */
@@ -283,16 +308,7 @@ export function formatOrgDetails(org: SentryOrganization): string[] {
283308 lines . push ( `Early Adopter: ${ org . isEarlyAdopter ? "Yes" : "No" } ` ) ;
284309
285310 // Features
286- if ( org . features && org . features . length > 0 ) {
287- lines . push ( "" ) ;
288- lines . push ( `Features (${ org . features . length } ):` ) ;
289- const maxFeatures = 10 ;
290- const displayFeatures = org . features . slice ( 0 , maxFeatures ) ;
291- lines . push ( ` ${ displayFeatures . join ( ", " ) } ` ) ;
292- if ( org . features . length > maxFeatures ) {
293- lines . push ( ` ... and ${ org . features . length - maxFeatures } more` ) ;
294- }
295- }
311+ lines . push ( ...formatFeaturesList ( org . features ) ) ;
296312
297313 return lines ;
298314}
@@ -386,16 +402,7 @@ export function formatProjectDetails(project: SentryProject): string[] {
386402 lines . push ( ` Monitors: ${ project . hasMonitors ? "Yes" : "No" } ` ) ;
387403
388404 // Features
389- if ( project . features && project . features . length > 0 ) {
390- lines . push ( "" ) ;
391- lines . push ( `Features (${ project . features . length } ):` ) ;
392- const maxFeatures = 10 ;
393- const displayFeatures = project . features . slice ( 0 , maxFeatures ) ;
394- lines . push ( ` ${ displayFeatures . join ( ", " ) } ` ) ;
395- if ( project . features . length > maxFeatures ) {
396- lines . push ( ` ... and ${ project . features . length - maxFeatures } more` ) ;
397- }
398- }
405+ lines . push ( ...formatFeaturesList ( project . features ) ) ;
399406
400407 return lines ;
401408}
0 commit comments