@@ -41,6 +41,16 @@ export async function handleInteractionCommands(params: {
4141 }
4242 const refInput = req . positionals ?. [ 0 ] ?? '' ;
4343 if ( refInput . startsWith ( '@' ) ) {
44+ const unsupported = unsupportedRefSnapshotFlags ( req . flags ) ;
45+ if ( unsupported . length > 0 ) {
46+ return {
47+ ok : false ,
48+ error : {
49+ code : 'INVALID_ARGS' ,
50+ message : `click @ref does not support ${ unsupported . join ( ', ' ) } .` ,
51+ } ,
52+ } ;
53+ }
4454 if ( ! session . snapshot ) {
4555 return { ok : false , error : { code : 'INVALID_ARGS' , message : 'No snapshot in session. Run snapshot first.' } } ;
4656 }
@@ -126,6 +136,16 @@ export async function handleInteractionCommands(params: {
126136 if ( command === 'fill' ) {
127137 const session = sessionStore . get ( sessionName ) ;
128138 if ( req . positionals ?. [ 0 ] ?. startsWith ( '@' ) ) {
139+ const unsupported = unsupportedRefSnapshotFlags ( req . flags ) ;
140+ if ( unsupported . length > 0 ) {
141+ return {
142+ ok : false ,
143+ error : {
144+ code : 'INVALID_ARGS' ,
145+ message : `fill @ref does not support ${ unsupported . join ( ', ' ) } .` ,
146+ } ,
147+ } ;
148+ }
129149 if ( ! session ?. snapshot ) {
130150 return { ok : false , error : { code : 'INVALID_ARGS' , message : 'No snapshot in session. Run snapshot first.' } } ;
131151 }
@@ -258,6 +278,16 @@ export async function handleInteractionCommands(params: {
258278 }
259279 const refInput = req . positionals ?. [ 1 ] ?? '' ;
260280 if ( refInput . startsWith ( '@' ) ) {
281+ const unsupported = unsupportedRefSnapshotFlags ( req . flags ) ;
282+ if ( unsupported . length > 0 ) {
283+ return {
284+ ok : false ,
285+ error : {
286+ code : 'INVALID_ARGS' ,
287+ message : `get @ref does not support ${ unsupported . join ( ', ' ) } .` ,
288+ } ,
289+ } ;
290+ }
261291 if ( ! session . snapshot ) {
262292 return { ok : false , error : { code : 'INVALID_ARGS' , message : 'No snapshot in session. Run snapshot first.' } } ;
263293 }
@@ -511,3 +541,19 @@ async function captureSnapshotForSession(
511541 sessionStore . set ( session . name , session ) ;
512542 return session . snapshot ;
513543}
544+
545+ const REF_UNSUPPORTED_FLAG_MAP : ReadonlyArray < [ keyof CommandFlags , string ] > = [
546+ [ 'snapshotDepth' , '--depth' ] ,
547+ [ 'snapshotScope' , '--scope' ] ,
548+ [ 'snapshotRaw' , '--raw' ] ,
549+ [ 'snapshotBackend' , '--backend' ] ,
550+ ] ;
551+
552+ export function unsupportedRefSnapshotFlags ( flags : CommandFlags | undefined ) : string [ ] {
553+ if ( ! flags ) return [ ] ;
554+ const unsupported : string [ ] = [ ] ;
555+ for ( const [ key , label ] of REF_UNSUPPORTED_FLAG_MAP ) {
556+ if ( flags [ key ] !== undefined ) unsupported . push ( label ) ;
557+ }
558+ return unsupported ;
559+ }
0 commit comments