@@ -62,6 +62,7 @@ export async function handleUrlCapture(
6262 sessionKey,
6363 skipStaleCheck : true , // Don't check for stale files in oneshot mode
6464 viewportOnly : options ?. viewportOnly ,
65+ headed : options ?. headed ,
6566 } ) ;
6667
6768 if ( options ?. save && result . failed === 0 ) {
@@ -75,18 +76,23 @@ export async function handleUrlCapture(
7576 return result . failed === 0 ;
7677}
7778
79+ type DefaultCommandOptions = {
80+ configPath : string ;
81+ sessionKey : string | undefined ;
82+ hasExplicitConfig : boolean ;
83+ clean ?: boolean ;
84+ workers ?: number ;
85+ headed ?: boolean ;
86+ } ;
87+
7888/**
7989 * Handle default command (setup or sync).
8090 */
81- export async function handleDefaultCommand (
82- configPath : string ,
83- sessionKey : string | undefined ,
84- hasExplicitConfig : boolean ,
85- clean ?: boolean ,
86- workers ?: number
87- ) : Promise < boolean > {
91+ export async function handleDefaultCommand ( options : DefaultCommandOptions ) : Promise < boolean > {
92+ const { configPath, sessionKey, hasExplicitConfig, clean, workers, headed } = options ;
93+
8894 if ( existsSync ( configPath ) ) {
89- const result = await sync ( { configPath, sessionKey, clean, workers } ) ;
95+ const result = await sync ( { configPath, sessionKey, clean, workers, headed } ) ;
9096 return result . failed === 0 ;
9197 }
9298
@@ -97,7 +103,7 @@ export async function handleDefaultCommand(
97103
98104 const { hasScreenshots } = await setup ( ) ;
99105 if ( hasScreenshots ) {
100- const result = await sync ( { clean, workers } ) ;
106+ const result = await sync ( { clean, workers, headed } ) ;
101107 return result . failed === 0 ;
102108 }
103109 return true ;
@@ -126,17 +132,19 @@ export async function shotAction(
126132 filter : url ,
127133 clean : options ?. clean ,
128134 workers : options ?. workers ,
135+ headed : options ?. headed ,
129136 } ) ;
130137 return result . failed === 0 ;
131138 }
132139
133- return handleDefaultCommand (
140+ return handleDefaultCommand ( {
134141 configPath,
135- globalOptions . sessionKey ,
136- ! ! globalOptions . config ,
137- options ?. clean ,
138- options ?. workers
139- ) ;
142+ sessionKey : globalOptions . sessionKey ,
143+ hasExplicitConfig : ! ! globalOptions . config ,
144+ clean : options ?. clean ,
145+ workers : options ?. workers ,
146+ headed : options ?. headed ,
147+ } ) ;
140148}
141149
142150/**
0 commit comments