+
    Q(i(                         R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ]! ]4      tR
 R ltR R ltR R ltR# )z&Shared utilities for install commands.N)Path)urlparse)dotenv_values)ValidationError)print)
get_logger)MCPServerConfig)FileSystemSourcec                R    V ^8  d   QhR\         R\        \         \         3,          /# )   env_varreturn)strtuple)formats   "`/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/fastmcp/cli/install/shared.py__annotate__r      s"     & &3 &5c? &    c                    RV 9  d&   \        RV  R24       \        P                  ! ^4       V P                  R^4      w  rVP	                  4       VP	                  4       3# )z6Parse environment variable string in format KEY=VALUE.=z1[red]Invalid environment variable format: '[bold]z![/bold]'. Must be KEY=VALUE[/red])r   sysexitsplitstrip)r   keyvalues   &  r   parse_env_varr      sU    
'?yHij	
 	sA&JC99;%%r   c                X   V ^8  d   QhR\         R\         R,          R\        \         ,          R,          R\        \         ,          R,          R\        R,          R\        \        \         R,          \         \        \         ,          \        \         \         3,          R,          3,          /# )r   server_specserver_nameNwith_packagesenv_varsenv_filer   )r   listr   r   dict)r   s   "r   r   r       s     q> q>q>tq> 9t#q> 3i$	q>
 Tkq> 4tS$s)T#s(^d-BBCq>r   c                  "   T;'       g    . pT;'       g    . pRpRpV P                  R4      '       Ed   \        V 4      P                  4       pVP                  4       '       g&   \	        RV R24       \
        P                  ! ^4        \        V4      ;_uu_ 4       p\        P                  ! V4      pRRR4       RX9   d#   \	        R4       \
        P                  ! ^4       M\        P                  ! V4      pVP                  P                  '       d:   \        VP                  P                  4      p	\        \        W),           4      4      pM\%        V R7      p\        VR	7      p\        VP&                  P(                  4      P+                  4       pVP-                  4       '       g'   Ve#   VP.                  V,          P                  4       pMVP                  4       p\1        V4      VP&                  n        \3        VP&                  R
4      '       d   VP&                  P4                  MRp\6        P9                  RR\1        V4      RVRVRV/R7       VP;                  4       '       g&   \	        RV R24       \
        P                  ! ^4       TpRpV'       g0    VP&                  P=                  4       G Rj  xL
 pVP>                  pRpV'       g	   V'       dd   / pV'       d>    T\I        V4      PK                  4        UUu/ uF  w  ppVf   K  VVbK  	  upp,          pV F  p\O        V4      w  ppVVV&   K  	  WWV3#   + '       g   i     EL; i  \        P                   \"        3 d1   p
\	        RT
 R24       \
        P                  ! ^4        Rp
?
EL9Rp
?
ii ; i L  \@        \B        \D        3 d:   p
\6        P9                  RR\1        T
4      /R7       TPF                  p Rp
?
EL(Rp
?
ii ; iu uppi   \L         d1   p
\	        RT
 R24       \
        P                  ! ^4        Rp
?
ELRp
?
ii ; i5i)zProcess common arguments shared by all install commands.

Handles both fastmcp.json config files and traditional file.py:object syntax.
Nz.jsonz#[red]Configuration file not found: z[/red]
mcpServersz=[red]MCPConfig files are not supported for installation[/red]z![red]Invalid configuration file: )path)source
entrypointzInstalling serverfiler   server_objectr    )extraz[red]Server file not found: zFCould not import server (likely missing dependencies), using file nameerrorz[red]Failed to load .env file: )(endswithr   resolveexistsr   r   r   openjsonloadr   	from_fileenvironmentdependenciesr#   setJSONDecodeErrorr   r	   r(   r'   
expanduseris_absoluteparentr   hasattrr)   loggerdebugis_fileload_servernameImportErrorModuleNotFoundError
SystemExitstemr   items	Exceptionr   )r   r   r    r!   r"   configconfig_pathfdataconfig_packageser(   source_pathr*   r+   rA   serverenv_dictkvr   r   r   s   &&&&&                  r   process_common_argsrS       s     "''RM~~2HF#KG$$;'//1!!##7}FKLHHQK	k""ayy| # t#UV )22;? %%222&*6+=+=+J+J&KO$(]-L)M$NM "{3 / v}}))*557K""$$)@""[099;""$TFMM$+FMM<$H$H  d  LLCI;]]	
   <<>>,TF&9:
 DF	!==4466F;;D '+H8%28%<%B%B%D%DTQDAqD%D   G&w/JC!HSM   X==s #""" $$o6 	5aS?@HHQKK	X 70*= 	LLXA'   99D	  7s&ABs   QQAQM M
60M &Q'1M 9M EQ"N. ?N, N. 	QQ"	Q-P 
	P P 
P )!Q
M		M N)9%N$Q$N))Q,N. .O=.O82Q8O==Q P Q%P<6Q<QQc                <    V ^8  d   QhR\         R\         R\        /# )r   urlexpected_schemer   )r   bool)r   s   "r   r   r      s!      s   r   c                  \        V 4      pVP                  V8w  d(   \        P                  RVP                   RV 24       R#  \        P
                  R8X  d   \        P                  ! RV .RRR7       R# \        P
                  R8X  d   \        P                  ! V 4       R# \        P                  ! R	V .RRR7       R#   \        P                  \        \        3 d     R# i ; i)
zAttempt to open a deeplink URL using the system's default handler.

Args:
    url: The deeplink URL to open.
    expected_scheme: The URL scheme to validate (e.g. "cursor", "goose").

Returns:
    True if the command succeeded, False otherwise.
zInvalid deeplink scheme: z, expected Fdarwinr1   T)checkcapture_outputwin32zxdg-open)r   schemer=   warningr   platform
subprocessrunos	startfileCalledProcessErrorFileNotFoundErrorOSError)rU   rV   parseds   &$ r   open_deeplinkrh      s     c]F}}''k/ARS	
 	<<8#NNFC=TJ
 	 \\W$LL  NNJ,DN))+<gF s   0C 7+C $C  C%$C%)__doc__r2   rb   r`   r   pathlibr   urllib.parser   dotenvr   pydanticr   richr   fastmcp.utilities.loggingr   #fastmcp.utilities.mcp_server_configr   9fastmcp.utilities.mcp_server_config.v1.sources.filesystemr	   __name__r=   r   rS   rh    r   r   <module>rt      sG    ,  	  
  !   $  0 ? V	H	&q>hr   