
    	D,jZv                         d dl Z d dlZd dlZd dlmZ d dlZd dlZd dlmZ d dl	m
Z
mZmZ d dlmZ ddlmZ ddZd	 Zd
 Zd Zd Zd Zd Zedk    r e            Z ej        e           dS dS )    N)Path)__version__)DotEnvFormatterMarkdownHelpFormatterYamlHelpFormatter)add_deprecated_model_args   )dumpc                     t          |           }|                                rt          |          S |rt          t          |          |z            S t          |          S N)r   is_absolutestr)path_strgit_rootpaths      Y/home/rurouni/.local/share/uv/tools/aider-chat/lib/python3.11/site-packages/aider/args.pyresolve_aiderignore_pathr      sZ    >>D *4yy	 *4>>D()))t99    c                 J    | r t           j                            | d          ndS )Nz.env)osr   join)r   s    r   default_env_filer      s"    -5A27<<&)))6Ar   c           	      x!   t          j        dd| t           j        d          }ddlm} t          d |j        D                       }|                    d          }t          j	        |
                    d	d
dd          _        |
                    ddd d           |                    d          }|
                    dd           |
                    dd           |
                    dd           |
                    dd           |
                    dd           |
                    dd           |
                    d d!           |
                    d"d#d$d%g &           |
                    d'd#d(d)g &           |                    d*          }|
                    d+d,dd-.           t          j	        |
                    d/d0d1d2          _        t          j	        |
                    d3d4d5d6          _        |
                    d7d#d8d9:           |
                    d;t          d<=           |
                    d>t          d?=           |
                    d@t          j        ddAB           |
                    dCt          d dDE           |
                    dFdGdH|d dIJ           |
                    dKdLdMdNdOP           |
                    dQt          j        ddRB           |
                    dSdTd dU           |
                    dVdWd dX           |
                    dYdZ|d d[J           |
                    d\t          j        dd]B           |
                    d^t          j        dd_B           |
                    d`t           d daE           |                    db          }|
                    dct          j        dddeB           |
                    dft           ddgE           |                    dh          }|
                    dit           d djE           |
                    dkg dldmdno           |
                    dpt          dqdrE           |                    ds          }r t"          j                            dt          ndt}r t"          j                            du          ndu}t          j	        |
                    dvdw|dx| dy          _        t          j	        |
                    dzd{|d|| dy          _        |
                    d}t          j        ddd~B           t          j	        |
                    ddd d          _        |                    d          }|
                    ddddd           |
                    ddddd           |
                    dt          j        ddB           |
                    dt          j        ddB           |
                    ddd           |
                    dd d           |
                    ddd           |
                    ddd           |
                    ddd           |
                    ddd d           |
                    ddd d           |
                    ddd d           |
                    ddd d           |
                    ddd           |
                    ddddd           |                    d          }|
                    dt          j        ddB           |
                    dt          j        ddB           |
                    dt          j        dddB           r t"          j                            d          nd}t          j	        |
                    ddfd|d          _        |
                    ddddd           |
                    dt          j        ddB           |
                    dt          j        ddB           |
                    dt          j        d dB           |
                    dt          j        d dB           |
                    dt          j        ddd¬B           |
                    dt          j        dddĬB           |
                    dt          j        ddƬB           |
                    dt          j        dddȬB           |
                    ddddd           |
                    dddͬ.           |
                    dt          j        dddϬB           |
                    ddddd           |
                    dt          j        dddӬB           |                    dԦ          }|
                    ddddd           |
                    dd#dg            |
                    dt          j        ddڬB           |
                    ddg ݦ           |
                    dt          j        ddd߬B           |
                    ddddd           |                    d          }|
                    dt          j        d dB           t          j	        |
                    ddd.          _        |
                    ddddd           |
                    ddd.           |
                    ddd.           |                    d          }|
                    ddddd           |
                    dt          j        dd           |
                    dt          j        dd            |
                    ddddd           |
                    dddddd           |
                    dddt(           d            |                    d          }|
                    ddddd.           t          j	        |
                    ddd	d
.          _        |
                    ddt          j        ddd           |
                    dt          j        dddB           t          j	        |
                    dd
d.          _        |
                    ddddd           |
                    ddddd           |
                    ddddd           |
                    ddddd           |                    d          }|
                    dddg dd            |
                    d!d"d#d$           |
                    d%d&d d'           |                    d(          }|
                    d)dd*dd           t          j	        |
                    d+d#d
d,:          _        t          j	        |
                    d-d#d
d.:          _        |
                    d/dd0dd           |
                    d1d2d d3           |
                    d4d5d d6           |
                    d7dd8d            |
                    d9d:dd;dd           t          j	        |
                    d<d=d>.          _        |
                    d?d@dA           |
                    dBg dCdDdEo           t          j	        |
                    dFdGddHdIJ          _        t          j	        |
                    dKdLt+                    dM          _        |
                    dNt          j        ddOB           |
                    dPt          j        ddQB           |
                    dRt          j        dddSB           |
                    dTt          j        dddUB           |
                    dVdd dW           |
                    dXt          j        ddYB           |
                    dZd[           t          t-          t          j                            }	|
                    d\d]|	d^d_                    |	           d`a           |                    db          }t1          ||           |S (c  Nz-aider is AI pair programming in your terminalTAIDER_)descriptionadd_config_file_helpdefault_config_filesconfig_file_parser_classauto_env_var_prefixr   )codersc                 J    h | ] }t          |d           r|j        |j        !S )edit_format)hasattrr"   ).0cs     r   	<setcomp>zget_parser.<locals>.<setcomp>1   s@     	
 	
 	
q-((	
 ./]-F M-F-F-Fr   z
Main modelfilesFILE*z$files to edit with an LLM (optional))metavarnargshelpz--modelMODELz*Specify the model to use for the main chat)r*   defaultr,   zAPI Keys and settingsz--openai-api-keyzSpecify the OpenAI API key)r,   z--anthropic-api-keyzSpecify the Anthropic API keyz--openai-api-basezSpecify the api base urlz--openai-api-typez3(deprecated, use --set-env OPENAI_API_TYPE=<value>)z--openai-api-versionz6(deprecated, use --set-env OPENAI_API_VERSION=<value>)z--openai-api-deployment-idz<(deprecated, use --set-env OPENAI_API_DEPLOYMENT_ID=<value>)z--openai-organization-idz7(deprecated, use --set-env OPENAI_ORGANIZATION=<value>)z	--set-envappendzENV_VAR_NAME=valuezQSet an environment variable (to control API settings, can be used multiple times))actionr*   r,   r.   z	--api-keyzPROVIDER=KEYzXSet an API key for a provider (eg: --api-key provider=<key> sets PROVIDER_API_KEY=<key>)zModel settingsz--list-modelsz--modelsz6List known models which match the (partial) MODEL name)r*   r,   z--model-settings-fileMODEL_SETTINGS_FILEz.aider.model.settings.ymlz;Specify a file with aider model settings for unknown modelsz--model-metadata-fileMODEL_METADATA_FILEz.aider.model.metadata.jsonz?Specify a file with context window and costs for unknown modelsz--aliaszALIAS:MODELz.Add a model alias (can be used multiple times))r0   r*   r,   z--reasoning-effortz9Set the reasoning_effort API parameter (default: not set))typer,   z--thinking-tokensz^Set the thinking token budget for models that support it. Use 0 to disable. (default: not set)z--verify-sslz=Verify the SSL cert when connecting to models (default: True))r0   r.   r,   z	--timeoutz0Timeout in seconds for API calls (default: None))r3   r.   r,   z--edit-formatz--chat-modeEDIT_FORMATzFSpecify what edit format the LLM should use (default depends on model))r*   choicesr.   r,   z--architectstore_constr"   	architectz+Use architect edit format for the main chat)r0   destconstr,   z--auto-accept-architectzHEnable/disable automatic acceptance of architect changes (default: True)z--weak-model
WEAK_MODELzhSpecify the model to use for commit messages and chat history summarization (default depends on --model)z--editor-modelEDITOR_MODELzFSpecify the model to use for editor tasks (default depends on --model)z--editor-edit-formatEDITOR_EDIT_FORMATzOSpecify the edit format for the editor model (default: depends on editor model)z--show-model-warningszCOnly work with models that have meta-data available (default: True)z--check-model-accepts-settingszUCheck if model accepts settings like reasoning_effort/thinking_tokens (default: True)z--max-chat-history-tokenszSoft limit on tokens for chat history, after which summarization begins. If unspecified, defaults to the model's max_chat_history_tokens.zCache settingsz--cache-promptsFz*Enable caching of prompts (default: False)z--cache-keepalive-pingszPNumber of times to ping at 5min intervals to keep prompt cache warm (default: 0)zRepomap settingsz--map-tokensz@Suggested number of tokens to use for repo map, use 0 to disablez--map-refresh)autoalwaysr'   manualr=   zaControl how often the repo map is refreshed. Options: auto, always, files, manual (default: auto))r5   r.   r,   z--map-multiplier-no-files   zBMultiplier for map tokens when no files are specified (default: 2)zHistory Filesz.aider.input.historyz.aider.chat.history.mdz--input-history-fileINPUT_HISTORY_FILEz.Specify the chat input history file (default: )z--chat-history-fileCHAT_HISTORY_FILEz(Specify the chat history file (default: z--restore-chat-historyz;Restore the previous chat history messages (default: False)z--llm-history-fileLLM_HISTORY_FILEzPLog the conversation with the LLM to this file (for example, .aider.llm.history)zOutput settingsz--dark-mode
store_truezCUse colors suitable for a dark terminal background (default: False))r0   r,   r.   z--light-modezDUse colors suitable for a light terminal background (default: False)z--prettyz7Enable/disable pretty, colorized output (default: True)z--streamz2Enable/disable streaming responses (default: True)z--user-input-colorz#00cc00z/Set the color for user input (default: #00cc00))r.   r,   z--tool-output-colorz-Set the color for tool output (default: None)z--tool-error-colorz#FF2222z8Set the color for tool error messages (default: #FF2222)z--tool-warning-colorz#FFA500z:Set the color for tool warning messages (default: #FFA500)z--assistant-output-colorz#0088ffz5Set the color for assistant output (default: #0088ff)z--completion-menu-colorCOLORzNSet the color for the completion menu (default: terminal's default text color)z--completion-menu-bg-colorz_Set the background color for the completion menu (default: terminal's default background color)z--completion-menu-current-colorzhSet the color for the current item in the completion menu (default: terminal's default background color)z"--completion-menu-current-bg-colorzmSet the background color for the current item in the completion menu (default: terminal's default text color)z--code-themer.   zSet the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light, or a Pygments builtin style, see https://pygments.org/styles for available themes)z--show-diffsz3Show diffs when committing changes (default: False)zGit settingsz--gitz5Enable/disable looking for a git repo (default: True)z--gitignorez;Enable/disable adding .aider* to .gitignore (default: True)z--add-gitignore-fileszSEnable/disable the addition of files listed in .gitignore to Aider's editing scope.z.aiderignorez--aiderignoreAIDERIGNOREc                 $    t          |           S r   )r   )r   r   s    r   <lambda>zget_parser.<locals>.<lambda>  s    6xJJ r   zASpecify the aider ignore file (default: .aiderignore in git root))r*   r3   r.   r,   z--subtree-onlyz@Only consider files in the current subtree of the git repositoryz--auto-commitsz9Enable/disable auto commit of LLM changes (default: True)z--dirty-commitsz?Enable/disable commits when repo is found dirty (default: True)z--attribute-authorzAttribute aider code changes in the git author name (default: True). If explicitly set to True, overrides --attribute-co-authored-by precedence.z--attribute-committerzAttribute aider commits in the git committer name (default: True). If explicitly set to True, overrides --attribute-co-authored-by precedence for aider edits.z!--attribute-commit-message-authorzTPrefix commit messages with 'aider: ' if aider authored the changes (default: False)z$--attribute-commit-message-committerz:Prefix all commit messages with 'aider: ' (default: False)z--attribute-co-authored-byzAttribute aider edits using the Co-authored-by trailer in the commit message (default: True). If True, this takes precedence over default --attribute-author and --attribute-committer behavior unless they are explicitly set to True.z--git-commit-verifyzEEnable/disable git pre-commit hooks with --no-verify (default: False)z--commitzDCommit all pending changes with a suitable commit message, then exitz--commit-promptPROMPTz6Specify a custom prompt for generating commit messagesz	--dry-runz:Perform a dry run without modifying files (default: False)z--skip-sanity-check-repoz=Skip the sanity check for the git repository (default: False)z--watch-fileszEEnable/disable watching files for ai coding comments (default: False)zFixing and committingz--lintz<Lint and fix provided files, or dirty files if none providedz
--lint-cmdztSpecify lint commands to run for different languages, eg: "python: flake8 --select=..." (can be used multiple times)z--auto-lintz>Enable/disable automatic linting after changes (default: True)z
--test-cmdzSpecify command to run tests)r,   r.   z--auto-testz?Enable/disable automatic testing after changes (default: False)z--testz+Run tests, fix problems found and then exit	Analyticsz--analyticsz>Enable/disable analytics for current session (default: random)z--analytics-logANALYTICS_LOG_FILEz&Specify a file to log analytics eventsz--analytics-disablezPermanently disable analyticsz--analytics-posthog-hostANALYTICS_POSTHOG_HOSTz)Send analytics to custom PostHog instancez#--analytics-posthog-project-api-key!ANALYTICS_POSTHOG_PROJECT_API_KEYz(Send analytics to custom PostHog project	Upgradingz--just-check-updatez4Check for updates and return status in the exit codez--check-updatez&Check for new aider versions on launchz--show-release-noteszHShow release notes on first run of new version (default: None, ask user)z--install-main-branchz/Install the latest version from the main branchz	--upgradez--updatez-Upgrade aider to the latest version from PyPIz	--versionversionz	%(prog)s z Show the version number and exit)r0   rP   r,   Modesz	--messagez--msgz-mCOMMANDzVSpecify a single message to send the LLM, process reply then exit (disables chat mode)z--message-filez-fMESSAGE_FILEzdSpecify a file containing the message to send the LLM, process reply, then exit (disables chat mode)z--guiz	--browserz*Run aider in your browser (default: False)z--copy-pastezMEnable automatic copy/paste of chat between aider and web UI (default: False)z--applyzIApply the changes from the given file instead of running the chat (debug)z--apply-clipboard-editszFApply clipboard contents as edits using the main model's editor formatz--exitzGDo all startup activities then exit before accepting user input (debug)z--show-repo-mapz#Print the repo map and exit (debug)z--show-promptsz)Print the system prompts and exit (debug)zVoice settingsz--voice-formatVOICE_FORMATwav)rU   mp3webmzLAudio format for voice recording (default: wav). webm and mp3 require ffmpeg)r*   r.   r5   r,   z--voice-languageVOICE_LANGUAGEenzCSpecify the language for voice using ISO 639-1 code (default: auto)z--voice-input-deviceVOICE_INPUT_DEVICEz1Specify the input device name for voice recordingzOther settingsz--disable-playwrightzTNever prompt for or attempt to install Playwright for web scraping (default: False).z--filez3specify a file to edit (can be used multiple times)z--readz5specify a read-only file (can be used multiple times)z--vimz4Use VI editing mode in the terminal (default: False)z--chat-languageCHAT_LANGUAGEzMSpecify the language to use in the chat (default: None, uses system settings)z--commit-languageCOMMIT_LANGUAGEzPSpecify the language to use in the commit message (default: None, user language)z--yes-alwaysz$Always say yes to every confirmationz-vz	--verbosezEnable verbose outputz--load	LOAD_FILEz0Load and execute /commands from a file on launchz
--encodingzutf-8z:Specify the encoding for input and output (default: utf-8)z--line-endings)platformlfcrlfr^   z:Line endings to use when writing files (default: platform)z-cz--configCONFIG_FILEz`Specify the config file (default: search for .aider.conf.yml in git root, cwd or home directory))is_config_filer*   r,   z
--env-fileENV_FILEz9Specify the .env file to load (default: .env in git root)z--suggest-shell-commandsz8Enable/disable suggesting shell commands (default: True)z--fancy-inputzFEnable/disable fancy input with history and completion (default: True)z--multilinezOEnable/disable multi-line input mode with Meta-Enter to submit (default: False)z--notificationszXEnable/disable terminal bell notifications when LLM responses are ready (default: False)z--notifications-commandzSpecify a command to run for notifications instead of the terminal bell. If not specified, a default command for your OS may be used.z--detect-urlszIEnable/disable detection and offering to add URLs to chat (default: True)z--editorz3Specify which editor to use for the /editor commandz--shell-completionsSHELLzRPrint shell completion script for the specified SHELL and exit. Supported shells: , z). Example: aider --shell-completions bash)r*   r5   r,   zDeprecated model settings)configargparseArgumentParserYAMLConfigFileParseraiderr    sorted__all__add_argument_groupshtabr(   add_argumentcompleter   argparseBooleanOptionalActionfloatintr   r   r   r   r   listSUPPORTED_SHELLSr   )
r   r   parser_aider_codersedit_format_choicesgroupdefault_input_history_filedefault_chat_history_filedefault_aiderignore_filesupported_shells_lists
    `        r   
get_parserr~   #   so   *C!1!/!D$  F .----- 	
 	
"*	
 	
 	
  %%l33E  
s1W   	9	     %%&=>>E	)     
,     
'     
B     
E     
$K     
"F     
$`     
'   	 	 	 %%&677E	E	      
%+J	   
   
%,N	   
 	=	     
H    
 
	     
-L	     
?	     
#U     
:     
!-W	     
#     
U	     
$#^     
-R	     
(-c     
#P     %%&677E	-9	     
!_	     %%&899E	O	     
555     
#Q	     %%o66E:B^X5666H^  =EbX7888Jb   
$*[>X[[[	   
   
#)T8QTTT	   
 	 -J	      
"_	   
  %%&788E	R	     
S	     
-F	     
-A	     
>    
 
<    
 
G    
 
I    
 
"D    
 
!]	     
$!     
)!     
,.     
E	     
B	     %%n55E	-D	     
-J	     
-b	     3;NX~...   
JJJJ(P    	O	     
-H	     
-N	     
-I     
-Y     
+-c	     
.-I	     
$-V  	 	 	 
-T	     
S	     
E    
 
-I	     
"L	     
-T	     %%&=>>E	K	     
:      
-M	     
+    
 
-N	     
:	     %%k22E	-M	     	 
$5    	,	     
"(8    
 
-37     %%k22E	C	     
-5	     
-W	     
>	     
<     
)K))/	     %%g..E	d    "  
$    	-9     
-\	     	 
X    	!U	     
V	     
2	     
8	     %%&677E	&&&[     
 R	     
$@	     %%&677E	c	      
B	   
   
D	   
 	C	     
\	     
!_	     
3	     
$     	 
?    	I    
 
***I	      
"  	 	   
 **H	   
 	"-G	     
-U	     
-^	     
-     
!E     
-X	     
B    
 #4(>#?#?@@	%\		/00\ \ \     %%&ABBEfe,,,Mr   c                      dt           j        d<   dgt          _        t	          g d           } |                                  t          | _        t          j	        
                    |           S )N70COLUMNSri   )r   environsysargvr~   parse_known_argsr   formatter_classrp   rg   format_helprv   s    r   get_md_helpr   h  sY     BJyyCHD!!F 2F"..v666r   c                      dt           j        d<   dgt          _        t	          g d           } |                                  t          | _        t          j	        
                    |           S )N100r   ri   )r   r   r   r   r~   r   r   r   rp   rg   r   r   s    r   get_sample_yamlr   u  sY    !BJyyCHD!!F .F"..v666r   c                      dt           j        d<   dgt          _        t	          g d           } |                                  t          | _        t          j	        
                    |           S )N120r   ri   )r   r   r   r   r~   r   r   r   rp   rg   r   r   s    r   get_sample_dotenvr     sY    !BJyyCHD!!F ,F"..v666r   c                     t          t          j                  dk    rt          j        d         } nd} | dk    rt          t	                                 d S | dk    rt          t                                 d S | dk    rt          t                                 d S | dk    rt          t          j                  dk    rt          j        d         }|t          j        vrnt          d| dt          j	        	           t          d
d
                    t          j                   t          j	        	           t          j        d           t          g d           }d|_        t          t          j        ||                     d S t          dt          j	        	           t          dt          j        d          dt          j	        	           t          d
d
                    t          j                   t          j	        	           t          j        d           d S t          t                                 d S )Nr	   yamlmddotenv
completionr@   zError: Unsupported shell 'z'.)filezSupported shells are: re   ri   )shellz-Error: Please specify a shell for completion.zUsage: python r   z completion <shell_name>)lenr   r   printr   r   r   rm   ru   stderrr   exitr~   progro   )commandr   rv   s      r   mainr     s   
38}}q(1+$kmm	H		!!"""""	F		o     	L	 	 sx==1HQKEE222<5<<<3:NNNNRtyy9O/P/PRRY\YcddddD))F!FK%.u55566666A
SSSSH38A;HHHszZZZZN499U5K+L+LNNUXU_````HQKKKKK 	o     r   __main__r   )rp   r   r   pathlibr   rf   rm   ri   r   aider.args_formatterr   r   r   aider.deprecatedr   r
   r   r   r~   r   r   r   r   __name__statusr    r   r   <module>r      sa    				 



                          
 7 6 6 6 6 6         B B BB B BJ
7 
7 
7
7 
7 
7
7 
7 
7! ! !@ zTVVFCHV r   