d i f f   - - g i t   a / d o c s / r e f e r e n c e / c l i - o p t i o n s . m d   b / d o c s / r e f e r e n c e / c l i - o p t i o n s . m d 
 
 i n d e x   3 3 b 9 6 f 3 . . b 4 9 b 9 5 c   1 0 0 6 4 4 
 
 - - -   a / d o c s / r e f e r e n c e / c l i - o p t i o n s . m d 
 
 + + +   b / d o c s / r e f e r e n c e / c l i - o p t i o n s . m d 
 
 @ @   - 1 6 , 6   + 1 6 , 7   @ @   T h e s e   o p t i o n s   a r e   u s e f u l   f o r   o n e - o f f   r u n s ,   s c r i p t i n g ,   o r   e x p e r i m e n t a t i o n .   T h e y   t 
 
   |   ` - - v e r b o s e - t o o l s `   |   P r i n t   i n f o   m e s s a g e s   f o r   t o o l   e x e c u t i o n   i n   t o o l s   a d a p t e r .   | 
 
   |   ` - - v e r b o s e - a g e n t `   |   P r i n t   i n f o   m e s s a g e s   f o r   a g e n t   e v e n t   a n d   m e s s a g e   p a r t   h a n d l i n g .   | 
 
   |   ` - z ` ,   ` - - z e r o `   |   I D E   z e r o   m o d e :   d i s a b l e s   s y s t e m   p r o m p t   &   a l l   t o o l s   f o r   r a w   L L M   i n t e r a c t i o n   | 
 
 + |   ` - u ` ,   ` - - u n r e s t r i c t e d - p a t h s `   |   D i s a b l e   p a t h   s e c u r i t y :   a l l o w   t o o l   a r g u m e n t s   t o   u s e   a n y   f i l e / d i r e c t o r y   p a t h   ( D A N G E R O U S )   | 
 
   |   ` - r ` ,   ` - - r e a d `   |   E n a b l e   t o o l s   t h a t   r e q u i r e   r e a d   p e r m i s s i o n s   ( d e f a u l t :   o f f )   | 
 
   |   ` - w ` ,   ` - - w r i t e `   |   E n a b l e   t o o l s   t h a t   r e q u i r e   w r i t e   p e r m i s s i o n s   ( d e f a u l t :   o f f )   | 
 
   |   ` - x ` ,   ` - - e x e c `   |   E n a b l e   e x e c u t i o n / r u n   t o o l s   ( a l l o w s   r u n n i n g   c o d e   o r   s h e l l   t o o l s   f r o m   t h e   C L I ) .   ( d e f a u l t :   o f f )   | 
 
 @ @   - 4 8 , 7   + 4 9 , 7   @ @   j a n i t o   - p   o p e n a i   - m   g p t - 3 . 5 - t u r b o   " Y o u r   p r o m p t   h e r e " 
 
   j a n i t o   - p   g o o g l e   - m   g e m i n i - 2 . 5 - f l a s h   " Y o u r   p r o m p t   h e r e " 
 
   j a n i t o   - - l i s t - t o o l s 
 
   j a n i t o   - - w e b     #   E n a b l e   c l i c k a b l e   f i l e   l i n k s   v i a   w e b   v i e w e r 
 
 - 
 
 + j a n i t o   - u   - x   - - r e a d   - - w r i t e   " R u n   a   t o o l   w i t h   u n r e s t r i c t e d   p a t h s   ( D A N G E R O U S ) " 
 
   ` ` ` 
 
   
 
   # # #   &  E n a b l i n g   E x e c u t i o n   T o o l s 
 
 @ @   - 6 0 , 6   + 6 1 , 1 5   @ @   j a n i t o   - x   " R u n   t h i s   c o d e :   p r i n t ( ' H e l l o ,   w o r l d ! ' ) " 
 
   ` ` ` 
 
   >   * * W a r n i n g : * *   E n a b l i n g   e x e c u t i o n   t o o l s   a l l o w s   r u n n i n g   a r b i t r a r y   c o d e   o r   s h e l l   c o m m a n d s .   O n l y   u s e   ` - - e x e c `   i f   y o u   t r u s t   y o u r   p r o m p t   a n d   e n v i r o n m e n t . 
 
   
 
 + # # #   &  D i s a b l i n g   P a t h   S e c u r i t y 
 
 + 
 
 + B y   d e f a u l t ,   a l l   f i l e   a n d   d i r e c t o r y   a r g u m e n t s   t o   t o o l s   a r e   r e s t r i c t e d   t o   t h e   w o r k i n g   d i r e c t o r y   ( s e e   ` - - w o r k d i r ` ) .   T o   d i s a b l e   t h i s   s e c u r i t y   a n d   a l l o w   a n y   p a t h   ( i n c l u d i n g   s y s t e m   f i l e s ) ,   u s e   t h e   ` - u `   o r   ` - - u n r e s t r i c t e d - p a t h s `   f l a g : 
 
 + 
 
 + ` ` ` s h 
 
 + j a n i t o   - u   " D o   s o m e t h i n g   w i t h   C : / W i n d o w s / S y s t e m 3 2 / h o s t s " 
 
 + ` ` ` 
 
 + >   * * W a r n i n g : * *   D i s a b l i n g   p a t h   s e c u r i t y   i s   e x t r e m e l y   d a n g e r o u s .   O n l y   u s e   ` - - u n r e s t r i c t e d - p a t h s `   i f   y o u   t r u s t   y o u r   p r o m p t ,   t o o l s ,   a n d   e n v i r o n m e n t . 
 
 + 
 
   _ T h i s   p a g e   i s   g e n e r a t e d   f r o m   t h e   o u t p u t   o f   ` j a n i t o   - - h e l p ` . _ 
 
   
 
   # #   >  A b o u t   ` - - e f f o r t ` 
 
 d i f f   - - g i t   a / j a n i t o / c l i / c o r e / r u n n e r . p y   b / j a n i t o / c l i / c o r e / r u n n e r . p y 
 
 i n d e x   d a 5 2 a c 4 . . 7 e 9 8 1 d 6   1 0 0 6 4 4 
 
 - - -   a / j a n i t o / c l i / c o r e / r u n n e r . p y 
 
 + + +   b / j a n i t o / c l i / c o r e / r u n n e r . p y 
 
 @ @   - 1 1 7 , 7   + 1 1 7 , 1 1   @ @   d e f   h a n d l e _ r u n n e r ( a r g s ,   p r o v i d e r ,   l l m _ d r i v e r _ c o n f i g ,   a g e n t _ r o l e ,   v e r b o s e _ t o o l s = F 
 
           #   S t o r e   t h e   d e f a u l t   p e r m i s s i o n s   f o r   l a t e r   r e s t o r a t i o n   ( e . g . ,   o n   / r e s t a r t ) 
 
           f r o m   j a n i t o . t o o l s . p e r m i s s i o n s   i m p o r t   s e t _ d e f a u l t _ a l l o w e d _ p e r m i s s i o n s 
 
           s e t _ d e f a u l t _ a l l o w e d _ p e r m i s s i o n s ( a l l o w e d _ p e r m i s s i o n s ) 
 
 +         u n r e s t r i c t e d _ p a t h s   =   g e t a t t r ( a r g s ,   " u n r e s t r i c t e d _ p a t h s " ,   F a l s e ) 
 
           a d a p t e r   =   j a n i t o . t o o l s . g e t _ l o c a l _ t o o l s _ a d a p t e r ( w o r k d i r = g e t a t t r ( a r g s ,   " w o r k d i r " ,   N o n e ) ) 
 
 +         i f   u n r e s t r i c t e d _ p a t h s : 
 
 +                 #   P a t c h :   d i s a b l e   p a t h   s e c u r i t y   e n f o r c e m e n t   f o r   t h i s   a d a p t e r   i n s t a n c e 
 
 +                 s e t a t t r ( a d a p t e r ,   " u n r e s t r i c t e d _ p a t h s " ,   T r u e ) 
 
   
 
           #   P r i n t   a l l o w e d   p e r m i s s i o n s   i n   v e r b o s e   m o d e 
 
           i f   g e t a t t r ( a r g s ,   " v e r b o s e " ,   F a l s e ) : 
 
 d i f f   - - g i t   a / j a n i t o / c l i / m a i n _ c l i . p y   b / j a n i t o / c l i / m a i n _ c l i . p y 
 
 i n d e x   4 0 3 0 8 a 2 . . 7 4 0 d 9 0 c   1 0 0 6 4 4 
 
 - - -   a / j a n i t o / c l i / m a i n _ c l i . p y 
 
 + + +   b / j a n i t o / c l i / m a i n _ c l i . p y 
 
 @ @   - 1 4 , 6   + 1 4 , 1 4   @ @   f r o m   j a n i t o . c l i . c o r e . e v e n t _ l o g g e r   i m p o r t   ( 
 
   ) 
 
   
 
   d e f i n i t i o n   =   [ 
 
 +         ( 
 
 +                 [ " - u " ,   " - - u n r e s t r i c t e d - p a t h s " ] , 
 
 +                 { 
 
 +                         " a c t i o n " :   " s t o r e _ t r u e " , 
 
 +                         " h e l p " :   " D i s a b l e   p a t h   s e c u r i t y :   a l l o w   t o o l   a r g u m e n t s   t o   u s e   a n y   f i l e / d i r e c t o r y   p a t h   ( D A N G E R O U S ) " , 
 
 +                 } , 
 
 +         ) , 
 
 + 
 
           ( 
 
                   [ " - - p r o f i l e " ] , 
 
                   { 
 
 d i f f   - - g i t   a / j a n i t o / c l i / r i c h _ t e r m i n a l _ r e p o r t e r . p y   b / j a n i t o / c l i / r i c h _ t e r m i n a l _ r e p o r t e r . p y 
 
 i n d e x   a b c 6 7 d e . . b 1 8 9 e d 6   1 0 0 6 4 4 
 
 - - -   a / j a n i t o / c l i / r i c h _ t e r m i n a l _ r e p o r t e r . p y 
 
 + + +   b / j a n i t o / c l i / r i c h _ t e r m i n a l _ r e p o r t e r . p y 
 
 @ @   - 3 0 , 7   + 3 0 , 8   @ @   c l a s s   R i c h T e r m i n a l R e p o r t e r ( E v e n t H a n d l e r B a s e ) : 
 
                   s e l f . r a w _ m o d e   =   r a w _ m o d e 
 
                   i m p o r t   j a n i t o . r e p o r t _ e v e n t s   a s   r e p o r t _ e v e n t s 
 
   
 
 -                 s u p e r ( ) . _ _ i n i t _ _ ( d r i v e r _ e v e n t s ,   r e p o r t _ e v e n t s ) 
 
 +                 i m p o r t   j a n i t o . t o o l s . t o o l _ e v e n t s   a s   t o o l _ e v e n t s 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( d r i v e r _ e v e n t s ,   r e p o r t _ e v e n t s ,   t o o l _ e v e n t s ) 
 
                   s e l f . _ w a i t i n g _ p r i n t e d   =   F a l s e 
 
   
 
           d e f   o n _ R e q u e s t S t a r t e d ( s e l f ,   e v e n t ) : 
 
 @ @   - 1 0 2 , 7   + 1 0 3 , 2 7   @ @   c l a s s   R i c h T e r m i n a l R e p o r t e r ( E v e n t H a n d l e r B a s e ) : 
 
                                   s e l f . c o n s o l e . f i l e . f l u s h ( ) 
 
                   #   N o   o u t p u t   i f   n o t   r a w _ m o d e   o r   i f   r e s p o n s e   i s   N o n e 
 
   
 
 +         d e f   o n _ T o o l C a l l E r r o r ( s e l f ,   e v e n t ) : 
 
 +                 #   O p t i o n a l l y   h a n d l e   t o o l   c a l l   e r r o r s   i n   a   u s e r - f r i e n d l y   w a y 
 
 +                 e r r o r   =   g e t a t t r ( e v e n t ,   " e r r o r " ,   N o n e ) 
 
 +                 t o o l   =   g e t a t t r ( e v e n t ,   " t o o l _ n a m e " ,   N o n e ) 
 
 +                 i f   e r r o r   a n d   t o o l : 
 
 +                         s e l f . c o n s o l e . p r i n t ( f " [ b o l d   r e d ] T o o l   E r r o r   ( { t o o l } ) : [ / ]   { e r r o r } " ) 
 
 +                         s e l f . c o n s o l e . f i l e . f l u s h ( ) 
 
 + 
 
           d e f   o n _ R e p o r t E v e n t ( s e l f ,   e v e n t ) : 
 
 +                 #   S p e c i a l   h a n d l i n g   f o r   s e c u r i t y - r e l a t e d   r e p o r t   e v e n t s 
 
 +                 s u b t y p e   =   g e t a t t r ( e v e n t ,   " s u b t y p e " ,   N o n e ) 
 
 +                 m s g   =   g e t a t t r ( e v e n t ,   " m e s s a g e " ,   N o n e ) 
 
 +                 a c t i o n   =   g e t a t t r ( e v e n t ,   " a c t i o n " ,   N o n e ) 
 
 +                 t o o l   =   g e t a t t r ( e v e n t ,   " t o o l " ,   N o n e ) 
 
 +                 c o n t e x t   =   g e t a t t r ( e v e n t ,   " c o n t e x t " ,   N o n e ) 
 
 +                 i f   s u b t y p e   = =   R e p o r t S u b t y p e . E R R O R   a n d   m s g   a n d   " [ S E C U R I T Y ]   P a t h   a c c e s s   d e n i e d "   i n   m s g : 
 
 +                         #   H i g h l i g h t   s e c u r i t y   e r r o r s   w i t h   a   d i s t i n c t   s t y l e 
 
 +                         s e l f . c o n s o l e . p r i n t ( P a n e l ( f " { m s g } " ,   t i t l e = " [ r e d ] S E C U R I T Y   V I O L A T I O N [ / r e d ] " ,   s t y l e = " b o l d   r e d " ) ) 
 
 +                         s e l f . c o n s o l e . f i l e . f l u s h ( ) 
 
 +                         r e t u r n 
 
 + 
 
                   m s g   =   e v e n t . m e s s a g e   i f   h a s a t t r ( e v e n t ,   " m e s s a g e " )   e l s e   N o n e 
 
                   s u b t y p e   =   e v e n t . s u b t y p e   i f   h a s a t t r ( e v e n t ,   " s u b t y p e " )   e l s e   N o n e 
 
                   i f   n o t   m s g   o r   n o t   s u b t y p e : 
 
 d i f f   - - g i t   a / j a n i t o / t o o l s / a d a p t e r s / l o c a l / a d a p t e r . p y   b / j a n i t o / t o o l s / a d a p t e r s / l o c a l / a d a p t e r . p y 
 
 i n d e x   8 e 8 9 7 a 9 . . 1 e 4 6 6 a 4   1 0 0 6 4 4 
 
 - - -   a / j a n i t o / t o o l s / a d a p t e r s / l o c a l / a d a p t e r . p y 
 
 + + +   b / j a n i t o / t o o l s / a d a p t e r s / l o c a l / a d a p t e r . p y 
 
 @ @   - 1 8 , 1 6   + 1 8 , 5 1   @ @   c l a s s   L o c a l T o o l s A d a p t e r ( T o o l s A d a p t e r ) : 
 
           " " " 
 
   
 
           d e f   _ _ i n i t _ _ ( s e l f ,   t o o l s = N o n e ,   e v e n t _ b u s = N o n e ,   w o r k d i r = N o n e ) : 
 
 +                 " " " C r e a t e   a   n e w   L o c a l T o o l s A d a p t e r . 
 
 + 
 
 +                 P a r a m e t e r s 
 
 +                 - - - - - - - - - - 
 
 +                 t o o l s   :   l i s t ,   o p t i o n a l 
 
 +                         A n   o p t i o n a l   i t e r a b l e   w i t h   t o o l   * c l a s s e s *   ( n o t   i n s t a n c e s )   t h a t   s h o u l d 
 
 +                         b e   r e g i s t e r e d   i m m e d i a t e l y . 
 
 +                 e v e n t _ b u s   :   j a n i t o . e v e n t _ b u s . b u s . E v e n t B u s ,   o p t i o n a l 
 
 +                         T h e   e v e n t   b u s   t o   w h i c h   t o o l - r e l a t e d   e v e n t s   w i l l   b e   p u b l i s h e d .     W h e n 
 
 +                         * N o n e *   ( d e f a u l t )   t h e   * * g l o b a l * *   : p y d a t a : ` j a n i t o . e v e n t _ b u s . b u s . e v e n t _ b u s ` 
 
 +                         s i n g l e t o n   i s   u s e d   s o   t h a t   C L I   c o m p o n e n t s   s u c h   a s   t h e 
 
 +                         : c l a s s : ` j a n i t o . c l i . r i c h _ t e r m i n a l _ r e p o r t e r . R i c h T e r m i n a l R e p o r t e r `   w i l l 
 
 +                         r e c e i v e   s e c u r i t y   v i o l a t i o n   o r   e x e c u t i o n   e v e n t s   a u t o m a t i c a l l y . 
 
 +                 w o r k d i r   :   s t r   |   p a t h l i b . P a t h ,   o p t i o n a l 
 
 +                         B a s e   d i r e c t o r y   t h a t   p a t h - s e c u r i t y   c h e c k s   w i l l   a l l o w .     D e f a u l t s   t o 
 
 +                         t h e   c u r r e n t   w o r k i n g   d i r e c t o r y   a t   t h e   t i m e   o f   i n s t a n t i a t i o n . 
 
 +                 " " " 
 
 +                 #   F a l l   b a c k   t o   t h e   g l o b a l   e v e n t   b u s   s o   t h a t   R e p o r t E v e n t s   e m i t t e d   f r o m 
 
 +                 #   t h e   t o o l s   a d a p t e r   ( f o r   e x a m p l e   p a t h - s e c u r i t y   v i o l a t i o n s )   a r e   v i s i b l e 
 
 +                 #   t o   U I   c o m p o n e n t s   e v e n   i f   t h e   c a l l e r   d i d   n o t   s u p p l y   a   c u s t o m   b u s . 
 
 +                 i f   e v e n t _ b u s   i s   N o n e : 
 
 +                         f r o m   j a n i t o . e v e n t _ b u s . b u s   i m p o r t   e v e n t _ b u s   a s   g l o b a l _ e v e n t _ b u s 
 
 +                         e v e n t _ b u s   =   g l o b a l _ e v e n t _ b u s 
 
 + 
 
                   s u p e r ( ) . _ _ i n i t _ _ ( t o o l s = t o o l s ,   e v e n t _ b u s = e v e n t _ b u s ) 
 
 + 
 
 +                 #   I n t e r n a l   r e g i s t r y   s t r u c t u r e :   {   t o o l _ n a m e :   { " c l a s s " :   c l s ,   " i n s t a n c e " :   o b j ,   " f u n c t i o n " :   o b j . r u n }   } 
 
                   s e l f . _ t o o l s :   D i c t [ s t r ,   D i c t [ s t r ,   A n y ] ]   =   { } 
 
 -                 s e l f . w o r k d i r   =   w o r k d i r 
 
 -                 i f   s e l f . w o r k d i r : 
 
 -                         i m p o r t   o s 
 
 -                         o s . c h d i r ( s e l f . w o r k d i r ) 
 
 + 
 
 +                 i m p o r t   o s 
 
 +                 s e l f . w o r k d i r   =   w o r k d i r   o r   o s . g e t c w d ( ) 
 
 +                 #   E n s u r e   * s o m e *   w o r k d i r   i s   s e t      f a l l b a c k   t o   C W D . 
 
 +                 i f   n o t   s e l f . w o r k d i r : 
 
 +                         s e l f . w o r k d i r   =   o s . g e t c w d ( ) 
 
 +                 #   N o r m a l i s e   b y   c h a n g i n g   t h e   a c t u a l   p r o c e s s   w o r k i n g   d i r e c t o r y   f o r 
 
 +                 #   c o n s i s t e n c y   w i t h   m a n y   f i l e - s y s t e m   t o o l s . 
 
 +                 o s . c h d i r ( s e l f . w o r k d i r ) 
 
 + 
 
                   i f   t o o l s : 
 
                           f o r   t o o l   i n   t o o l s : 
 
                                   s e l f . r e g i s t e r _ t o o l ( t o o l ) 
 
   
 
 +         #   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 +         #   R e g i s t r a t i o n   h e l p e r s 
 
 +         #   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
           d e f   r e g i s t e r _ t o o l ( s e l f ,   t o o l _ c l a s s :   T y p e ) : 
 
                   i n s t a n c e   =   t o o l _ c l a s s ( ) 
 
                   i f   n o t   h a s a t t r ( i n s t a n c e ,   " r u n " )   o r   n o t   c a l l a b l e ( i n s t a n c e . r u n ) : 
 
 @ @   - 5 4 , 2 8   + 8 9 , 4 3   @ @   c l a s s   L o c a l T o o l s A d a p t e r ( T o o l s A d a p t e r ) : 
 
           d e f   d i s a b l e _ t o o l ( s e l f ,   n a m e :   s t r ) : 
 
                   s e l f . u n r e g i s t e r _ t o o l ( n a m e ) 
 
   
 
 +         #   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 +         #   L o o k u p   h e l p e r s   u s e d   b y   T o o l s A d a p t e r B a s e 
 
 +         #   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
           d e f   g e t _ t o o l ( s e l f ,   n a m e :   s t r ) : 
 
                   r e t u r n   s e l f . _ t o o l s [ n a m e ] [ " i n s t a n c e " ]   i f   n a m e   i n   s e l f . _ t o o l s   e l s e   N o n e 
 
   
 
           d e f   l i s t _ t o o l s ( s e l f ) : 
 
 -                 r e t u r n   [ n a m e   f o r   n a m e ,   e n t r y   i n   s e l f . _ t o o l s . i t e m s ( )   i f   s e l f . i s _ t o o l _ a l l o w e d ( e n t r y [ " i n s t a n c e " ] ) ] 
 
 +                 r e t u r n   [ 
 
 +                         n a m e 
 
 +                         f o r   n a m e ,   e n t r y   i n   s e l f . _ t o o l s . i t e m s ( ) 
 
 +                         i f   s e l f . i s _ t o o l _ a l l o w e d ( e n t r y [ " i n s t a n c e " ] ) 
 
 +                 ] 
 
   
 
           d e f   g e t _ t o o l _ c l a s s e s ( s e l f ) : 
 
 -                 r e t u r n   [ e n t r y [ " c l a s s " ]   f o r   e n t r y   i n   s e l f . _ t o o l s . v a l u e s ( )   i f   s e l f . i s _ t o o l _ a l l o w e d ( e n t r y [ " i n s t a n c e " ] ) ] 
 
 +                 r e t u r n   [ 
 
 +                         e n t r y [ " c l a s s " ] 
 
 +                         f o r   e n t r y   i n   s e l f . _ t o o l s . v a l u e s ( ) 
 
 +                         i f   s e l f . i s _ t o o l _ a l l o w e d ( e n t r y [ " i n s t a n c e " ] ) 
 
 +                 ] 
 
   
 
           d e f   g e t _ t o o l s ( s e l f ) : 
 
 -                 r e t u r n   [ e n t r y [ " i n s t a n c e " ]   f o r   e n t r y   i n   s e l f . _ t o o l s . v a l u e s ( )   i f   s e l f . i s _ t o o l _ a l l o w e d ( e n t r y [ " i n s t a n c e " ] ) ] 
 
 - 
 
 - 
 
 +                 r e t u r n   [ 
 
 +                         e n t r y [ " i n s t a n c e " ] 
 
 +                         f o r   e n t r y   i n   s e l f . _ t o o l s . v a l u e s ( ) 
 
 +                         i f   s e l f . i s _ t o o l _ a l l o w e d ( e n t r y [ " i n s t a n c e " ] ) 
 
 +                 ] 
 
 + 
 
 +         #   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 +         #   C o n v e n i e n c e   m e t h o d s 
 
 +         #   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
           d e f   a d d _ t o o l ( s e l f ,   t o o l ) : 
 
 -                 #   R e g i s t e r   b y   i n s t a n c e   ( u s e f u l   f o r   h a n d - b u i l t   o b j e c t s ) 
 
 +                 " " " R e g i s t e r   a n   * i n s t a n c e *   ( i n s t e a d   o f   a   c l a s s )   a s   a   t o o l . " " " 
 
                   i f   n o t   h a s a t t r ( t o o l ,   " r u n " )   o r   n o t   c a l l a b l e ( t o o l . r u n ) : 
 
                           r a i s e   T y p e E r r o r ( f " T o o l   ' { t o o l } '   m u s t   i m p l e m e n t   a   c a l l a b l e   ' r u n '   m e t h o d . " ) 
 
                   t o o l _ n a m e   =   g e t a t t r ( t o o l ,   " t o o l _ n a m e " ,   N o n e ) 
 
                   i f   n o t   t o o l _ n a m e   o r   n o t   i s i n s t a n c e ( t o o l _ n a m e ,   s t r ) : 
 
 -                         r a i s e   V a l u e E r r o r ( 
 
 -                                 f " T o o l   ' { t o o l } '   m u s t   p r o v i d e   a   ' t o o l _ n a m e '   ( s t r )   a t t r i b u t e . " 
 
 -                         ) 
 
 +                         r a i s e   V a l u e E r r o r ( f " T o o l   ' { t o o l } '   m u s t   p r o v i d e   a   ' t o o l _ n a m e '   ( s t r )   a t t r i b u t e . " ) 
 
                   i f   t o o l _ n a m e   i n   s e l f . _ t o o l s : 
 
                           r a i s e   V a l u e E r r o r ( f " T o o l   ' { t o o l _ n a m e } '   i s   a l r e a d y   r e g i s t e r e d . " ) 
 
                   s e l f . _ t o o l s [ t o o l _ n a m e ]   =   { 
 
 @ @   - 8 5 , 1 7   + 1 3 5 , 2 8   @ @   c l a s s   L o c a l T o o l s A d a p t e r ( T o o l s A d a p t e r ) : 
 
                   } 
 
   
 
   
 
 - #   O p t i o n a l :   a   l o c a l - t o o l   d e c o r a t o r 
 
 - 
 
 + #   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 + #   D e c o r a t o r   h e l p e r   f o r   q u i c k   r e g i s t r a t i o n   o f   l o c a l   t o o l s 
 
 + #   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
   
 
   d e f   r e g i s t e r _ l o c a l _ t o o l ( t o o l = N o n e ) : 
 
 +         " " " C l a s s   d e c o r a t o r   t h a t   r e g i s t e r s   t h e   t o o l   o n   t h e   * s i n g l e t o n *   a d a p t e r . 
 
 + 
 
 +         E x a m p l e 
 
 +         - - - - - - - 
 
 +         > > >   @ r e g i s t e r _ l o c a l _ t o o l 
 
 +         . . .   c l a s s   M y T o o l ( B a s e T o o l ) : 
 
 +         . . .           . . . 
 
 +         " " " 
 
 + 
 
           d e f   d e c o r a t o r ( c l s ) : 
 
 -                 f r o m   j a n i t o . t o o l s . t o o l _ b a s e   i m p o r t   T o o l P e r m i s s i o n s 
 
 -                 f r o m   j a n i t o . t o o l s . p e r m i s s i o n s   i m p o r t   g e t _ g l o b a l _ a l l o w e d _ p e r m i s s i o n s 
 
 +                                 #   R e g i s t e r   t h e   t o o l   o n   a   * f r e s h *   a d a p t e r   i n s t a n c e   t o   a v o i d   c i r c u l a r 
 
 +                 #   i m p o r t   i s s u e s   d u r i n g   p a c k a g e   i n i t i a l i s a t i o n .     T h i s   k e e p s   b e h a v i o u r 
 
 +                 #   i d e n t i c a l   t o   t h e   o r i g i n a l   i m p l e m e n t a t i o n   w h i l e   s t i l l   a l l o w i n g 
 
 +                 #   i m m e d i a t e   u s e   v i a   t h e   s i n g l e t o n   i n   j a n i t o . t o o l s . a d a p t e r s . l o c a l . 
 
                   L o c a l T o o l s A d a p t e r ( ) . r e g i s t e r _ t o o l ( c l s ) 
 
                   r e t u r n   c l s 
 
   
 
           i f   t o o l   i s   N o n e : 
 
                   r e t u r n   d e c o r a t o r 
 
           r e t u r n   d e c o r a t o r ( t o o l ) 
 
 - 
 
 d i f f   - - g i t   a / j a n i t o / t o o l s / a d a p t e r s / l o c a l / c r e a t e _ f i l e . p y   b / j a n i t o / t o o l s / a d a p t e r s / l o c a l / c r e a t e _ f i l e . p y 
 
 i n d e x   f c 4 8 a 2 c . . 2 7 b 3 1 c 7   1 0 0 6 4 4 
 
 - - -   a / j a n i t o / t o o l s / a d a p t e r s / l o c a l / c r e a t e _ f i l e . p y 
 
 + + +   b / j a n i t o / t o o l s / a d a p t e r s / l o c a l / c r e a t e _ f i l e . p y 
 
 @ @   - 4 8 , 7   + 4 8 , 7   @ @   c l a s s   C r e a t e F i l e T o o l ( T o o l B a s e ) : 
 
                   i f   i s _ o v e r w r i t e : 
 
                           #   O v e r w r i t e   b r a n c h :   l o g   o n l y   o v e r w r i t e   w a r n i n g   ( n o   c r e a t e   m e s s a g e ) 
 
                           s e l f . r e p o r t _ a c t i o n ( 
 
 -                                 t r ( " &  O v e r w r i t i n g   f i l e   ' { d i s p _ p a t h } ' " ,   d i s p _ p a t h = d i s p _ p a t h ) , 
 
 +                                 t r ( " &    O v e r w r i t i n g   f i l e   ' { d i s p _ p a t h } ' " ,   d i s p _ p a t h = d i s p _ p a t h ) , 
 
                                   R e p o r t A c t i o n . C R E A T E , 
 
                           ) 
 
                   d i r _ n a m e   =   o s . p a t h . d i r n a m e ( p a t h ) 
 
 d i f f   - - g i t   a / j a n i t o / t o o l s / a d a p t e r s / l o c a l / r e p l a c e _ t e x t _ i n _ f i l e . p y   b / j a n i t o / t o o l s / a d a p t e r s / l o c a l / r e p l a c e _ t e x t _ i n _ f i l e . p y 
 
 i n d e x   1 9 2 6 2 a 9 . . 7 0 b f 5 1 5   1 0 0 6 4 4 
 
 - - -   a / j a n i t o / t o o l s / a d a p t e r s / l o c a l / r e p l a c e _ t e x t _ i n _ f i l e . p y 
 
 + + +   b / j a n i t o / t o o l s / a d a p t e r s / l o c a l / r e p l a c e _ t e x t _ i n _ f i l e . p y 
 
 @ @   - 1 4 4 , 1 4   + 1 4 4 , 1 4   @ @   c l a s s   R e p l a c e T e x t I n F i l e T o o l ( T o o l B a s e ) : 
 
                           w a r n i n g   =   t r ( "   [ W a r n i n g :   S e a r c h   t e x t   n o t   f o u n d   i n   f i l e ] " ) 
 
                   i f   n o t   f i l e _ c h a n g e d : 
 
                           s e l f . r e p o r t _ w a r n i n g ( 
 
 -                                 t r ( "   9!  N o   c h a n g e s   m a d e .   ( n o t   f o u n d ) " ) ,   R e p o r t A c t i o n . C R E A T E 
 
 +                                 t r ( "   9!    N o   c h a n g e s   m a d e .   ( n o t   f o u n d ) " ) ,   R e p o r t A c t i o n . C R E A T E 
 
                           ) 
 
                           c o n c i s e _ w a r n i n g   =   t r ( 
 
                                   " N o   c h a n g e s   m a d e .   T h e   s e a r c h   t e x t   w a s   n o t   f o u n d .   E x p a n d   y o u r   s e a r c h   c o n t e x t   w i t h   s u r r o u n d i n g   l i n e s   i f   n e e d e d . " 
 
                           ) 
 
                   i f   o c c u r r e n c e s   >   1   a n d   r e p l a c e d _ c o u n t   = =   0 : 
 
                           s e l f . r e p o r t _ w a r n i n g ( 
 
 -                                 t r ( "   9!  N o   c h a n g e s   m a d e .   ( n o t   u n i q u e ) " ) ,   R e p o r t A c t i o n . C R E A T E 
 
 +                                 t r ( "   9!    N o   c h a n g e s   m a d e .   ( n o t   u n i q u e ) " ) ,   R e p o r t A c t i o n . C R E A T E 
 
                           ) 
 
                           c o n c i s e _ w a r n i n g   =   t r ( 
 
                                   " N o   c h a n g e s   m a d e .   T h e   s e a r c h   t e x t   i s   n o t   u n i q u e .   E x p a n d   y o u r   s e a r c h   c o n t e x t   w i t h   s u r r o u n d i n g   l i n e s   t o   e n s u r e   u n i q u e n e s s . " 
 
 d i f f   - - g i t   a / j a n i t o / t o o l s / t o o l s _ a d a p t e r . p y   b / j a n i t o / t o o l s / t o o l s _ a d a p t e r . p y 
 
 i n d e x   3 d b f f 0 7 . . 8 0 5 f e 3 6   1 0 0 6 4 4 
 
 - - -   a / j a n i t o / t o o l s / t o o l s _ a d a p t e r . p y 
 
 + + +   b / j a n i t o / t o o l s / t o o l s _ a d a p t e r . p y 
 
 @ @   - 1 6 7 , 6   + 1 6 7 , 3 4   @ @   c l a s s   T o o l s A d a p t e r B a s e : 
 
                   i f   v a l i d a t i o n _ e r r o r : 
 
                           r e t u r n   v a l i d a t i o n _ e r r o r 
 
   
 
 +                 #   - - -   S E C U R I T Y :   P a t h   r e s t r i c t i o n   e n f o r c e m e n t   - - - 
 
 +                 i f   n o t   g e t a t t r ( s e l f ,   ' u n r e s t r i c t e d _ p a t h s ' ,   F a l s e ) : 
 
 +                         w o r k d i r   =   g e t a t t r ( s e l f ,   ' w o r k d i r ' ,   N o n e ) 
 
 +                         #   E n s u r e   w o r k d i r   i s   a l w a y s   s e t ;   d e f a u l t   t o   c u r r e n t   w o r k i n g   d i r e c t o r y . 
 
 +                         i f   n o t   w o r k d i r : 
 
 +                                 i m p o r t   o s 
 
 +                                 w o r k d i r   =   o s . g e t c w d ( ) 
 
 +                         f r o m   j a n i t o . t o o l s . p a t h _ s e c u r i t y   i m p o r t   v a l i d a t e _ p a t h s _ i n _ a r g u m e n t s ,   P a t h S e c u r i t y E r r o r 
 
 +                         s c h e m a   =   g e t a t t r ( t o o l ,   ' s c h e m a ' ,   N o n e ) 
 
 +                         t r y : 
 
 +                                 v a l i d a t e _ p a t h s _ i n _ a r g u m e n t s ( a r g u m e n t s ,   w o r k d i r ,   s c h e m a = s c h e m a ) 
 
 +                         e x c e p t   P a t h S e c u r i t y E r r o r   a s   s e c _ e r r : 
 
 +                                 #   P u b l i s h   b o t h   a   T o o l C a l l E r r o r   a n d   a   u s e r - f a c i n g   R e p o r t E v e n t   f o r   p a t h   s e c u r i t y   e r r o r s 
 
 +                                 s e l f . _ p u b l i s h _ t o o l _ c a l l _ e r r o r ( t o o l _ n a m e ,   r e q u e s t _ i d ,   s t r ( s e c _ e r r ) ,   a r g u m e n t s ) 
 
 +                                 i f   s e l f . _ e v e n t _ b u s : 
 
 +                                         f r o m   j a n i t o . r e p o r t _ e v e n t s   i m p o r t   R e p o r t E v e n t ,   R e p o r t S u b t y p e ,   R e p o r t A c t i o n 
 
 +                                         s e l f . _ e v e n t _ b u s . p u b l i s h ( 
 
 +                                                 R e p o r t E v e n t ( 
 
 +                                                         s u b t y p e = R e p o r t S u b t y p e . E R R O R , 
 
 +                                                         m e s s a g e = f " [ S E C U R I T Y ]   P a t h   a c c e s s   d e n i e d :   { s e c _ e r r } " , 
 
 +                                                         a c t i o n = R e p o r t A c t i o n . E X E C U T E , 
 
 +                                                         t o o l = t o o l _ n a m e , 
 
 +                                                         c o n t e x t = { " a r g u m e n t s " :   a r g u m e n t s ,   " r e q u e s t _ i d " :   r e q u e s t _ i d } 
 
 +                                                 ) 
 
 +                                         ) 
 
 +                                 r e t u r n   f " S e c u r i t y   e r r o r :   { s e c _ e r r } " 
 
 +                 #   - - -   E N D   S E C U R I T Y   - - - 
 
 + 
 
                   s e l f . _ p u b l i s h _ t o o l _ c a l l _ s t a r t e d ( t o o l _ n a m e ,   r e q u e s t _ i d ,   a r g u m e n t s ) 
 
                   s e l f . _ p r i n t _ v e r b o s e ( f " [ t o o l s - a d a p t e r ]   E x e c u t i n g   t o o l :   { t o o l _ n a m e }   w i t h   a r g u m e n t s :   { a r g u m e n t s } " ) 
 
                   t r y : 
 
 