@@ -79,11 +79,15 @@ function formatStandardizedIssuesSection(scoring: ScoringConfig): string {
7979function formatStandardizedTableSection (
8080 insightsTable : InsightsTableConfig | undefined ,
8181) : string {
82- if ( ! insightsTable || insightsTable . length === 0 ) {
82+ if (
83+ ! insightsTable ||
84+ ! insightsTable . groups ||
85+ insightsTable . groups . length === 0
86+ ) {
8387 return '' ; // Hide empty table section
8488 }
8589
86- const groupItems = insightsTable
90+ const groupItems = insightsTable . groups
8791 . filter ( group => group . title )
8892 . map ( group => `*${ group . icon || '' } ${ group . title } *` )
8993 . slice ( 0 , 5 ) ; // Limit to prevent overly long descriptions
@@ -103,23 +107,127 @@ function formatStandardizedTreeSection(
103107 return '' ; // Hide disabled tree section
104108 }
105109
106- const { pruning } = dependencyTree ;
107- let pruningText = 'Default settings' ;
110+ const { pruning, groups, mode } = dependencyTree ;
108111
112+ // Format pruning settings
113+ let pruningText = 'Default settings' ;
109114 if ( pruning ) {
110115 const pruningParts : string [ ] = [ ] ;
111116 if ( pruning . minSize )
112- pruningParts . push ( `\`${ formatBytes ( pruning . minSize ) } \`` ) ;
117+ pruningParts . push ( `Min size: \`${ formatBytes ( pruning . minSize ) } \`` ) ;
113118 if ( pruning . maxChildren )
114- pruningParts . push ( `\`${ pruning . maxChildren } children\`` ) ;
115- if ( pruning . maxDepth ) pruningParts . push ( `\`${ pruning . maxDepth } depth\`` ) ;
119+ pruningParts . push ( `Max children: \`${ pruning . maxChildren } \`` ) ;
120+ if ( pruning . maxDepth )
121+ pruningParts . push ( `Max depth: \`${ pruning . maxDepth } \`` ) ;
122+ if ( pruning . pathLength )
123+ pruningParts . push ( `Path length: \`${ pruning . pathLength } \`` ) ;
116124
117125 if ( pruningParts . length > 0 ) {
118126 pruningText = pruningParts . join ( ', ' ) ;
119127 }
120128 }
121129
122- return `- **Tree:**\n - Groups: Same as table\n - Pruning: ${ pruningText } \n - Rest: Remaining items grouped for clarity` ;
130+ // Format groups
131+ let groupsText = 'None' ;
132+ if ( groups && groups . length > 0 ) {
133+ const groupSummaries = groups . map ( group => {
134+ const parts : string [ ] = [ ] ;
135+ if ( group . title ) parts . push ( `"${ group . title } "` ) ;
136+ if ( group . icon ) parts . push ( `${ group . icon } ` ) ;
137+ if ( group . include ) {
138+ if ( Array . isArray ( group . include ) ) {
139+ const includePatterns = group . include
140+ . slice ( 0 , 2 )
141+ . map ( ( p : string ) => `"${ p } "` )
142+ . join ( ', ' ) ;
143+ const moreCount =
144+ group . include . length > 2
145+ ? `, +${ group . include . length - 2 } more`
146+ : '' ;
147+ parts . push ( `include: [${ includePatterns } ${ moreCount } ]` ) ;
148+ } else {
149+ parts . push ( `include: "${ group . include } "` ) ;
150+ }
151+ }
152+ if ( group . exclude && group . exclude . length > 0 ) {
153+ const excludePatterns = group . exclude
154+ . slice ( 0 , 1 )
155+ . map ( ( p : string ) => `"${ p } "` )
156+ . join ( ', ' ) ;
157+ const moreCount =
158+ group . exclude . length > 1 ? `, +${ group . exclude . length - 1 } more` : '' ;
159+ parts . push ( `exclude: [${ excludePatterns } ${ moreCount } ]` ) ;
160+ }
161+ return parts . join ( ' ' ) ;
162+ } ) ;
163+ groupsText = groupSummaries . join ( '; ' ) ;
164+ }
165+
166+ // Format mode
167+ const modeText = mode || 'onlyMatching' ;
168+
169+ return `- **Tree:**\n - Mode: \`${ modeText } \`\n - Groups: ${ groupsText } \n - Pruning: ${ pruningText } ` ;
170+ }
171+
172+ function formatStandardizedSelectionSection (
173+ selection : SelectionConfig ,
174+ ) : string {
175+ const items : string [ ] = [ ] ;
176+
177+ // Selection mode
178+ items . push ( ` - Mode: \`${ selection . mode } \`` ) ;
179+
180+ // Output patterns
181+ if ( selection . includeOutputs . length > 0 ) {
182+ const patterns = selection . includeOutputs
183+ . slice ( 0 , 3 )
184+ . map ( p => `\`${ p } \`` )
185+ . join ( ', ' ) ;
186+ const extra =
187+ selection . includeOutputs . length > 3
188+ ? ` (+${ selection . includeOutputs . length - 3 } more)`
189+ : '' ;
190+ items . push ( ` - Include Outputs: ${ patterns } ${ extra } ` ) ;
191+ }
192+
193+ if ( selection . excludeOutputs . length > 0 ) {
194+ const patterns = selection . excludeOutputs
195+ . slice ( 0 , 2 )
196+ . map ( p => `\`${ p } \`` )
197+ . join ( ', ' ) ;
198+ const extra =
199+ selection . excludeOutputs . length > 2
200+ ? ` (+${ selection . excludeOutputs . length - 2 } more)`
201+ : '' ;
202+ items . push ( ` - Exclude Outputs: ${ patterns } ${ extra } ` ) ;
203+ }
204+
205+ // Input patterns
206+ if ( selection . includeInputs . length > 0 ) {
207+ const patterns = selection . includeInputs
208+ . slice ( 0 , 3 )
209+ . map ( p => `\`${ p } \`` )
210+ . join ( ', ' ) ;
211+ const extra =
212+ selection . includeInputs . length > 3
213+ ? ` (+${ selection . includeInputs . length - 3 } more)`
214+ : '' ;
215+ items . push ( ` - Include Inputs: ${ patterns } ${ extra } ` ) ;
216+ }
217+
218+ if ( selection . excludeInputs . length > 0 ) {
219+ const patterns = selection . excludeInputs
220+ . slice ( 0 , 2 )
221+ . map ( p => `\`${ p } \`` )
222+ . join ( ', ' ) ;
223+ const extra =
224+ selection . excludeInputs . length > 2
225+ ? ` (+${ selection . excludeInputs . length - 2 } more)`
226+ : '' ;
227+ items . push ( ` - Exclude Inputs: ${ patterns } ${ extra } ` ) ;
228+ }
229+
230+ return `- **Selection:**\n${ items . join ( '\n' ) } ` ;
123231}
124232
125233export function cleanTitleForSlug ( title : string ) : string {
@@ -130,7 +238,8 @@ export function cleanTitleForSlug(title: string): string {
130238}
131239
132240export function prepareDescription ( config : BundleStatsConfig ) : string {
133- const { description, scoring, dependencyTree, insightsTable } = config ;
241+ const { description, scoring, selection, dependencyTree, insightsTable } =
242+ config ;
134243
135244 // Start with the action paragraph (preserve existing custom descriptions)
136245 let enhancedDescription = description || '' ;
@@ -146,6 +255,9 @@ export function prepareDescription(config: BundleStatsConfig): string {
146255 const issuesSection = formatStandardizedIssuesSection ( scoring ) ;
147256 if ( issuesSection ) sections . push ( issuesSection ) ;
148257
258+ const selectionSection = formatStandardizedSelectionSection ( selection ) ;
259+ if ( selectionSection ) sections . push ( selectionSection ) ;
260+
149261 // Handle insightsTable which could be false
150262 const normalizedInsightsTable =
151263 insightsTable === false ? undefined : insightsTable ;
@@ -175,6 +287,7 @@ export function selectionGeneralConfigToOptions(
175287) : SelectionOptions {
176288 return {
177289 ...config ,
290+ mode : 'startup' ,
178291 includeOutputs : [ ] ,
179292 excludeOutputs : [ ] ,
180293 includeInputs : [ ] ,
@@ -190,36 +303,25 @@ export function normalizeSelectionOptions(
190303 options : SelectionOptions | undefined ,
191304) : SelectionConfig {
192305 if ( options === undefined ) {
306+ // Default: include all outputs for startup mode
193307 return {
194- includeOutputs : [ ] ,
308+ mode : 'startup' ,
309+ includeOutputs : [ '**/*' ] ,
195310 excludeOutputs : [ ] ,
196311 includeInputs : [ ] ,
197312 excludeInputs : [ ] ,
198- includeImports : [ ] ,
199- excludeImports : [ ] ,
200- includeEntryPoints : [ ] ,
201- excludeEntryPoints : [ ] ,
202313 } ;
203314 }
204315
205316 const globalInclude = options . include || [ ] ;
206317 const globalExclude = options . exclude || [ ] ;
207318
208319 return {
320+ mode : options . mode || 'startup' ,
209321 includeOutputs : [ ...( options . includeOutputs || [ ] ) , ...globalInclude ] ,
210322 excludeOutputs : [ ...( options . excludeOutputs || [ ] ) , ...globalExclude ] ,
211323 includeInputs : [ ...( options . includeInputs || [ ] ) , ...globalInclude ] ,
212324 excludeInputs : [ ...( options . excludeInputs || [ ] ) , ...globalExclude ] ,
213- includeImports : [ ...( options . includeImports || [ ] ) , ...globalInclude ] ,
214- excludeImports : [ ...( options . excludeImports || [ ] ) , ...globalExclude ] ,
215- includeEntryPoints : [
216- ...( options . includeEntryPoints || [ ] ) ,
217- ...globalInclude ,
218- ] ,
219- excludeEntryPoints : [
220- ...( options . excludeEntryPoints || [ ] ) ,
221- ...globalExclude ,
222- ] ,
223325 } ;
224326}
225327
@@ -243,6 +345,7 @@ export function normalizeBundleStatsOptions(
243345 }
244346
245347 const normalizedScoring : ScoringConfig = {
348+ mode : 'all' ,
246349 totalSize : normalizeRange ( totalSize ?? Infinity ) ,
247350 penalty : normalizedPenalty ,
248351 } ;
@@ -275,6 +378,7 @@ export function normalizeScoringOptions(
275378 const { penalty } = options ;
276379
277380 return {
381+ mode : 'all' ,
278382 totalSize : [ 0 , Infinity ] , // Default range
279383 penalty : penalty
280384 ? {
@@ -299,6 +403,7 @@ export function normalizeDependencyTreeOptions(
299403 }
300404
301405 return {
406+ mode : 'onlyMatching' ,
302407 groups : options . groups || [ ] ,
303408 pruning : options . pruning || DEFAULT_PRUNING_CONFIG ,
304409 } ;
@@ -314,7 +419,17 @@ export function normalizeInsightsTableOptions(
314419 return undefined ;
315420 }
316421
317- return options ;
422+ return {
423+ mode : options . mode || 'onlyMatching' ,
424+ groups : options . groups || [ ] ,
425+ pruning : options . pruning
426+ ? {
427+ enabled : options . pruning . enabled ?? false ,
428+ maxChildren : options . pruning . maxChildren ,
429+ minSize : options . pruning . minSize ,
430+ }
431+ : undefined ,
432+ } ;
318433}
319434
320435export function normalizeRange ( range : MinMax | number ) : MinMax {
0 commit comments