@@ -16,7 +16,8 @@ import type {
1616import {
1717 formatActionTitle ,
1818 mapCommandToAction ,
19- FILL_METHODS
19+ FILL_METHODS ,
20+ type TraceAction
2021} from './action-mapping.js'
2122import { networkRequestToHar } from './trace-har.js'
2223import { buildTraceZip , type TraceZipResource } from './trace-zip-writer.js'
@@ -343,12 +344,15 @@ function generateTranscript(
343344 const wallTimeISO = new Date ( startWallTime ) . toISOString ( )
344345 const lines : string [ ] = [ `# ${ title ?? 'Session' } — ${ wallTimeISO } ` , '' ]
345346
346- const captured = commands . filter (
347- ( c ) => mapCommandToAction ( String ( c . command ) ) !== null
348- )
347+ const captured : { entry : CommandLog ; action : TraceAction } [ ] = [ ]
348+ for ( const c of commands ) {
349+ const action = mapCommandToAction ( String ( c . command ) )
350+ if ( action ) {
351+ captured . push ( { entry : c , action } )
352+ }
353+ }
349354
350- captured . forEach ( ( entry , idx ) => {
351- const action = mapCommandToAction ( String ( entry . command ) ) !
355+ captured . forEach ( ( { entry, action } , idx ) => {
352356 const label = formatActionTitle ( action , entry . args as unknown [ ] )
353357
354358 const rawArgs = entry . args as unknown [ ]
@@ -357,7 +361,7 @@ function generateTranscript(
357361 if ( FILL_METHODS . has ( action . method ) && rawArgs ) {
358362 const valueIdx = rawArgs . length >= 2 ? 1 : 0
359363 if ( rawArgs [ valueIdx ] !== undefined ) {
360- parts . push ( `value="${ String ( rawArgs [ valueIdx ] ) . slice ( 0 , 50 ) } "` )
364+ parts . push ( `value="${ String ( rawArgs [ valueIdx ] ) } "` )
361365 }
362366 }
363367
0 commit comments