
    	D,j                         d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	 d dl
mZ d dlmZ dZd Zd Zd Zdd
Zd Zd Zd Zd Zedk    r e             dS dS )    N)__version__)github_issues)VERSION_CHECK_FNAMEz```c                  t    t          j                    } t          j        t          j        k    }d|  d|rdnd S )NzPython implementation: z
Virtual environment: YesNo)platformpython_implementationsysprefixbase_prefix)implementationis_venvs     [/home/rurouni/.local/share/uv/tools/aider-chat/lib/python3.11/site-packages/aider/report.pyget_python_infor      sJ    355NjCO+G	). 	) 	)&EE$	) 	)    c                      dt          j                     dt          j                     dt          j                    d          dS )NzOS:  z (r   ))r	   systemreleasearchitecture r   r   get_os_infor      sC    Y(/##YYh&6&8&8YYH<Q<S<STU<VYYYYr   c                      	 t          j        ddg                                                                          } d|  S # t          $ r Y dS w xY w)Ngitz	--versionzGit version: zGit information unavailable)
subprocesscheck_outputdecodestrip	Exception)git_versions    r   get_git_infor#      sf    - -uk.BCCJJLLRRTT,{,,, - - -,,,-s   >A 
AATc                 >   dt            d}dt          j                                        d          d}dt	          j                     d}t                      dz   }t                      dz   }t                      dz   }||z   |z   |z   |z   |z   dz   }	|	| z   } d| i}
|d}||
d	<   t           d
t          j
                            |
           }|rt          d| d           t          |                                            t                       t          d           d}t          |                                                                          }| p|                    d          }|sdS t          d           	 t#          j        |          rt          d           n# t&          $ r Y nw xY w|rft                       t                       t          d           t                       t          |           t                       t                       dS dS )ae  
    Compose a URL to open a new GitHub issue with the given text prefilled,
    and attempt to launch it in the default web browser.

    :param issue_text: The text of the issue to file
    :param title: The title of the issue (optional)
    :param confirm: Whether to ask for confirmation before opening the browser (default: True)
    :return: None
    zAider version: 
zPython version: r   z
Platform: bodyNz
Bug reporttitle?z
# z9Please consider reporting this bug to help improve aider!zKOpen a GitHub Issue pre-filled with the above error in your browser? (Y/n) yz?Attempting to open the issue URL in your default web browser...z Browser window should be opened.z3You can also use this URL to file the GitHub Issue:)r   r   versionsplitr	   r   r   r#   r   urllibparse	urlencodeprintr    inputlower
startswith
webbrowseropenr!   )
issue_textr'   confirmversion_infopython_versionplatform_infopython_infoos_infogit_infosystem_infoparams	issue_urlpromptconfirmationyess                  r   report_github_issuerC   %   sN    5[444LB(9(9(;(;A(>BBBN8!2!4!4888M!##d*Kmmd"G~~$H 	~%5CgMPXX[__  z)Jj!F}F7O CC6<#9#9&#A#ACCI 
Uj  !!!IJJJ^V}}**,,2244>,"9"9#">"> 	F	
KLLL?9%% 	64555     CDDDi s   #F% %
F21F2c                    t          | t                    rt          j        | ||          S d t          _        	 t          j                    rt          j                     n# t          $ r Y nw xY wt          j
        | ||          }g }|D ]}	 d|v re|                    d          }t          |          dk    r=|d         }t          j                            |          }|                    ||          }n# t          $ r Y nw xY w|                    |           d                    |          }	|}
|
j        r|
j        }
|
j        |
j        j        j        }|
j        }	 t          j                            |          }n# t          $ r |}Y nw xY w| j        }dt2           d|	 dt2           }d| d| d	| }t5          ||
           t          j        | ||           d S )NzFile "    z!An uncaught exception occurred:

r%   z	Uncaught z in z line )r'   )
issubclassKeyboardInterruptr   __excepthook__
excepthookr   existsunlinkr!   	tracebackformat_exceptionr+   lenospathbasenamereplaceappendjointb_nexttb_framef_codeco_filename	tb_lineno__name__FENCErC   )exc_type	exc_valueexc_tracebacktb_linestb_lines_with_basenameslineparts	full_pathrS   tb_textinnermost_tbfilenameline_numberexception_typer5   r'   s                   r   exception_handlerrk   ^   sI   (-.. F!(I}EEE CN%'' 	)&(((    )(I}MMH ! 
- 
-	$

3u::>> %aI!w//	::H<<	8<<D 	 	 	D	&&t,,,,gg-..G !L

 ,#+ 
 , $+7H(K7##H--    &N SuRRRR5RRJ JIIHIIKIIE 
%0000 xM:::::s6   &A   
A-,A-A)C77
DD"F FFc                  (    t           t          _        dS )zL
    Set up the global exception handler to report uncaught exceptions.
    N)rk   r   rK   r   r   r   report_uncaught_exceptionsrm      s     'CNNNr   c                       d }  |              d S )Nc                       d }  |              d S )Nc                       t          d          )Nboo)
ValueErrorr   r   r   dummy_function3zAdummy_function1.<locals>.dummy_function2.<locals>.dummy_function3   s    U###r   r   )rs   s    r   dummy_function2z(dummy_function1.<locals>.dummy_function2   s'    	$ 	$ 	$ 	r   r   )rt   s    r   dummy_function1ru      s'       Or   c                  *   t                       t                       d } t          t          j                  dk    r%t          j        d         } t          j        d         }nt          t          j                  dk    rt          j        d         }nrt          d           t                                                      } | sd } t          d           t          j        	                                                                }t          ||            d S )N   rF   z6Enter the issue title (optional, press Enter to skip):z(Enter the issue text (Ctrl+D to finish):)rm   ru   rP   r   argvr/   r0   r    stdinreadrC   )r'   r5   s     r   mainr{      s       E
38}}qXa[

	SX		Xa[

 	FGGG 	E8999Y^^%%++--

E*****r   __main__)NT)rQ   r	   r   r   rN   urllib.parser,   r3   aiderr   
aider.urlsr   aider.versioncheckr   r]   r   r   r#   rC   rk   rm   ru   r{   r\   r   r   r   <module>r      s1   				      



                   $ $ $ $ $ $ 2 2 2 2 2 2  Z Z Z- - -6 6 6 6r<; <; <;~' ' '  + + +2 zDFFFFF r   