@@ -456,31 +456,65 @@ test('parseArgs rejects invalid swipe pattern', () => {
456456 ) ;
457457} ) ;
458458
459- test ( 'usage includes --relaunch flag' , ( ) => {
460- assert . match ( usage ( ) , / - - r e l a u n c h / ) ;
461- assert . match ( usage ( ) , / i n s t a l l - f r o m - s o u r c e < u r l > / ) ;
462- assert . match ( usage ( ) , / m e t r o p r e p a r e / ) ;
463- assert . match ( usage ( ) , / - - h e a d e r < n a m e : v a l u e > / ) ;
464- assert . match ( usage ( ) , / - - p u b l i c - b a s e - u r l < u r l > / ) ;
465- assert . match ( usage ( ) , / - - r e s t a r t / ) ;
466- assert . match ( usage ( ) , / - - t a r g e t m o b i l e \| t v / ) ;
467- assert . match ( usage ( ) , / - - i o s - s i m u l a t o r - d e v i c e - s e t < p a t h > / ) ;
468- assert . match ( usage ( ) , / - - a n d r o i d - d e v i c e - a l l o w l i s t < s e r i a l s > / ) ;
469- assert . match ( usage ( ) , / - - f p s < n > / ) ;
470- assert . match ( usage ( ) , / n e t w o r k d u m p / ) ;
471- assert . match ( usage ( ) , / - - s a v e - s c r i p t \[ p a t h \] / ) ;
472- assert . match ( usage ( ) , / c l i p b o a r d r e a d \| c l i p b o a r d w r i t e < t e x t > / ) ;
473- assert . match ( usage ( ) , / k e y b o a r d \[ s t a t u s \| g e t \| d i s m i s s \] / ) ;
474- assert . match ( usage ( ) , / t r i g g e r - a p p - e v e n t < e v e n t > \[ p a y l o a d J s o n \] / ) ;
475- assert . match ( usage ( ) , / p i n c h < s c a l e > \[ x \] \[ y \] / ) ;
476- assert . match ( usage ( ) , / - - s t a t e - d i r < p a t h > / ) ;
477- assert . match ( usage ( ) , / - - d a e m o n - t r a n s p o r t a u t o \| s o c k e t \| h t t p / ) ;
478- assert . match ( usage ( ) , / - - d a e m o n - s e r v e r - m o d e s o c k e t \| h t t p \| d u a l / ) ;
479- assert . match ( usage ( ) , / - - t e n a n t < i d > / ) ;
480- assert . match ( usage ( ) , / - - s e s s i o n - i s o l a t i o n n o n e \| t e n a n t / ) ;
481- assert . match ( usage ( ) , / - - r u n - i d < i d > / ) ;
482- assert . match ( usage ( ) , / - - l e a s e - i d < i d > / ) ;
483- assert . doesNotMatch ( usage ( ) , / - - m e t a d a t a / ) ;
459+ test ( 'usage includes concise top-level commands' , ( ) => {
460+ const usageText = usage ( ) ;
461+ assert . match ( usageText , / i n s t a l l - f r o m - s o u r c e < u r l > / ) ;
462+ assert . match ( usageText , / m e t r o p r e p a r e - - p u b l i c - b a s e - u r l < u r l > / ) ;
463+ assert . match ( usageText , / b a t c h - - s t e p s < j s o n > \| - - s t e p s - f i l e < p a t h > / ) ;
464+ assert . match ( usageText , / n e t w o r k d u m p / ) ;
465+ assert . match ( usageText , / c l i p b o a r d r e a d \| c l i p b o a r d w r i t e < t e x t > / ) ;
466+ assert . match ( usageText , / k e y b o a r d \[ a c t i o n \] / ) ;
467+ assert . match ( usageText , / t r i g g e r - a p p - e v e n t < e v e n t > \[ p a y l o a d J s o n \] / ) ;
468+ assert . match ( usageText , / p i n c h < s c a l e > \[ x \] \[ y \] / ) ;
469+ assert . match ( usageText , / r e c o r d s t a r t \[ p a t h \] \| r e c o r d s t o p / ) ;
470+ assert . match ( usageText , / t r a c e s t a r t \[ p a t h \] \| t r a c e s t o p / ) ;
471+ } ) ;
472+
473+ test ( 'usage includes only global flags in the top-level flags section' , ( ) => {
474+ const usageText = usage ( ) ;
475+ assert . match ( usageText , / - - t a r g e t m o b i l e \| t v / ) ;
476+ assert . match ( usageText , / - - i o s - s i m u l a t o r - d e v i c e - s e t < p a t h > / ) ;
477+ assert . match ( usageText , / - - a n d r o i d - d e v i c e - a l l o w l i s t < s e r i a l s > / ) ;
478+ assert . match ( usageText , / - - s t a t e - d i r < p a t h > / ) ;
479+ assert . match ( usageText , / - - d a e m o n - t r a n s p o r t a u t o \| s o c k e t \| h t t p / ) ;
480+ assert . match ( usageText , / - - d a e m o n - s e r v e r - m o d e s o c k e t \| h t t p \| d u a l / ) ;
481+ assert . match ( usageText , / - - t e n a n t < i d > / ) ;
482+ assert . match ( usageText , / - - s e s s i o n - i s o l a t i o n n o n e \| t e n a n t / ) ;
483+ assert . match ( usageText , / - - r u n - i d < i d > / ) ;
484+ assert . match ( usageText , / - - l e a s e - i d < i d > / ) ;
485+ assert . doesNotMatch ( usageText , / - - r e l a u n c h / ) ;
486+ assert . doesNotMatch ( usageText , / - - h e a d e r < n a m e : v a l u e > / ) ;
487+ assert . doesNotMatch ( usageText , / - - r e s t a r t / ) ;
488+ assert . doesNotMatch ( usageText , / - - f p s < n > / ) ;
489+ assert . doesNotMatch ( usageText , / - - s a v e - s c r i p t \[ p a t h \] / ) ;
490+ assert . doesNotMatch ( usageText , / - - m e t a d a t a / ) ;
491+ } ) ;
492+
493+ test ( 'usage includes skills, config, environment, and examples footers' , ( ) => {
494+ const usageText = usage ( ) ;
495+ assert . match ( usageText , / A g e n t S k i l l s : / ) ;
496+ assert . match ( usageText , / a g e n t - d e v i c e \s + C a n o n i c a l m o b i l e a u t o m a t i o n f l o w s / ) ;
497+ assert . match ( usageText , / d o g f o o d \s + E x p l o r a t o r y Q A a n d b u g h u n t s / ) ;
498+ assert . match ( usageText , / S e e ` s k i l l s \/ < n a m e > \/ S K I L L \. m d ` i n t h e i n s t a l l e d p a c k a g e \. / ) ;
499+ assert . match ( usageText , / C o n f i g u r a t i o n : / ) ;
500+ assert . match (
501+ usageText ,
502+ / D e f a u l t c o n f i g f i l e s : ~ \/ \. a g e n t - d e v i c e \/ c o n f i g \. j s o n , \. \/ a g e n t - d e v i c e \. j s o n / ,
503+ ) ;
504+ assert . match (
505+ usageText ,
506+ / U s e - - c o n f i g < p a t h > o r A G E N T _ D E V I C E _ C O N F I G t o l o a d o n e e x p l i c i t c o n f i g f i l e \. / ,
507+ ) ;
508+ assert . match ( usageText , / E n v i r o n m e n t : / ) ;
509+ assert . match ( usageText , / A G E N T _ D E V I C E _ S E S S I O N \s + D e f a u l t s e s s i o n n a m e / ) ;
510+ assert . match ( usageText , / A G E N T _ D E V I C E _ P L A T F O R M \s + D e f a u l t p l a t f o r m b i n d i n g / ) ;
511+ assert . match ( usageText , / A G E N T _ D E V I C E _ S E S S I O N _ L O C K \s + B o u n d - s e s s i o n c o n f l i c t m o d e / ) ;
512+ assert . match ( usageText , / A G E N T _ D E V I C E _ D A E M O N _ B A S E _ U R L \s + C o n n e c t t o r e m o t e d a e m o n / ) ;
513+ assert . match ( usageText , / E x a m p l e s : / ) ;
514+ assert . match ( usageText , / a g e n t - d e v i c e o p e n S e t t i n g s - - p l a t f o r m i o s / ) ;
515+ assert . match ( usageText , / a g e n t - d e v i c e s n a p s h o t - i / ) ;
516+ assert . match ( usageText , / a g e n t - d e v i c e f i l l @ e 3 " t e s t @ e x a m p l e \. c o m " / ) ;
517+ assert . match ( usageText , / a g e n t - d e v i c e r e p l a y \. \/ s e s s i o n \. a d / ) ;
484518} ) ;
485519
486520test ( 'apps defaults to --all filter and allows overrides' , ( ) => {
@@ -617,13 +651,25 @@ test('invalid range errors are deterministic', () => {
617651
618652test ( 'usage includes swipe and press series options' , ( ) => {
619653 const help = usage ( ) ;
620- assert . match ( help , / d i f f s n a p s h o t / ) ;
654+ assert . match ( help , / d i f f < k i n d > / ) ;
621655 assert . match ( help , / s w i p e < x 1 > < y 1 > < x 2 > < y 2 > / ) ;
622- assert . match ( help , / - - p a t t e r n o n e - w a y \| p i n g - p o n g / ) ;
623- assert . match ( help , / - - i n t e r v a l - m s / ) ;
624- assert . match ( help , / s e t t i n g s < w i f i \| a i r p l a n e \| l o c a t i o n > < o n \| o f f > / ) ;
625- assert . match ( help , / s e t t i n g s a p p e a r a n c e < l i g h t \| d a r k \| t o g g l e > / ) ;
626- assert . match ( help , / s e t t i n g s p e r m i s s i o n < g r a n t \| d e n y \| r e s e t > / ) ;
656+ assert . match ( help , / s e t t i n g s \[ a r e a \] \[ o p t i o n s \] / ) ;
657+ assert . doesNotMatch ( help , / - - p a t t e r n o n e - w a y \| p i n g - p o n g / ) ;
658+ assert . doesNotMatch ( help , / - - i n t e r v a l - m s / ) ;
659+ } ) ;
660+
661+ test ( 'usage renders concise commands inline with descriptions' , ( ) => {
662+ const help = usage ( ) ;
663+ assert . match ( help , / C o m m a n d s : [ \s \S ] * \n b o o t \s { 2 , } B o o t t a r g e t d e v i c e \/ s i m u l a t o r / ) ;
664+ assert . match ( help , / m e t r o p r e p a r e - - p u b l i c - b a s e - u r l < u r l > \s { 2 , } P r e p a r e l o c a l M e t r o r u n t i m e / ) ;
665+ assert . match ( help , / b a t c h - - s t e p s < j s o n > \| - - s t e p s - f i l e < p a t h > \s { 2 , } R u n m u l t i p l e c o m m a n d s / ) ;
666+ assert . match ( help , / s e s s i o n l i s t \s { 2 , } L i s t a c t i v e s e s s i o n s / ) ;
667+ assert . doesNotMatch ( help , / m e t r o p r e p a r e [ ^ \n ] * - - p r o j e c t - r o o t / ) ;
668+ assert . doesNotMatch ( help , / \n b a t c h \s { 2 , } R u n m u l t i p l e c o m m a n d s / ) ;
669+ assert . doesNotMatch (
670+ help ,
671+ / P r e p a r e a l o c a l M e t r o r u n t i m e a n d o p t i o n a l l y b r i d g e i t t h r o u g h a g e n t - d e v i c e - p r o x y / ,
672+ ) ;
627673} ) ;
628674
629675test ( 'command usage shows command and global flags separately' , ( ) => {
@@ -636,6 +682,15 @@ test('command usage shows command and global flags separately', () => {
636682 assert . match ( help , / - - p l a t f o r m i o s \| a n d r o i d \| a p p l e / ) ;
637683} ) ;
638684
685+ test ( 'command usage keeps detailed descriptions' , ( ) => {
686+ const help = usageForCommand ( 'metro' ) ;
687+ if ( help === null ) throw new Error ( 'Expected command help text' ) ;
688+ assert . match (
689+ help ,
690+ / P r e p a r e a l o c a l M e t r o r u n t i m e a n d o p t i o n a l l y b r i d g e i t t h r o u g h a g e n t - d e v i c e - p r o x y / ,
691+ ) ;
692+ } ) ;
693+
639694test ( 'command usage shows no command flags when unsupported' , ( ) => {
640695 const help = usageForCommand ( 'appstate' ) ;
641696 if ( help === null ) throw new Error ( 'Expected command help text' ) ;
0 commit comments