Merge branch 'main' into path-completer

This commit is contained in:
Paul Gauthier 2024-09-28 14:33:58 -07:00
commit ffd7364410
11 changed files with 82 additions and 69 deletions

View file

@ -154,6 +154,10 @@ The project's documentation is built using Jekyll and hosted on GitHub Pages. To
``` ```
bundle exec jekyll build bundle exec jekyll build
``` ```
5. Preview the website while editing (optional):
```
bundle exec jekyll serve
```
The built documentation will be available in the `aider/website/_site` directory. The built documentation will be available in the `aider/website/_site` directory.

View file

@ -375,13 +375,13 @@ def get_parser(default_config_files, git_root):
group.add_argument( group.add_argument(
"--completion-menu-color", "--completion-menu-color",
metavar="COLOR", metavar="COLOR",
default="default", default=None,
help="Set the color for the completion menu (default: terminal's default text color)", help="Set the color for the completion menu (default: terminal's default text color)",
) )
group.add_argument( group.add_argument(
"--completion-menu-bg-color", "--completion-menu-bg-color",
metavar="COLOR", metavar="COLOR",
default="default", default=None,
help=( help=(
"Set the background color for the completion menu (default: terminal's default" "Set the background color for the completion menu (default: terminal's default"
" background color)" " background color)"
@ -390,7 +390,7 @@ def get_parser(default_config_files, git_root):
group.add_argument( group.add_argument(
"--completion-menu-current-color", "--completion-menu-current-color",
metavar="COLOR", metavar="COLOR",
default="default", default=None,
help=( help=(
"Set the color for the current item in the completion menu (default: terminal's default" "Set the color for the current item in the completion menu (default: terminal's default"
" background color)" " background color)"
@ -399,7 +399,7 @@ def get_parser(default_config_files, git_root):
group.add_argument( group.add_argument(
"--completion-menu-current-bg-color", "--completion-menu-current-bg-color",
metavar="COLOR", metavar="COLOR",
default="default", default=None,
help=( help=(
"Set the background color for the current item in the completion menu (default:" "Set the background color for the current item in the completion menu (default:"
" terminal's default text color)" " terminal's default text color)"

View file

@ -771,7 +771,7 @@ class Commands:
self.io.tool_output(f"Removed {matched_file} from the chat") self.io.tool_output(f"Removed {matched_file} from the chat")
def cmd_git(self, args): def cmd_git(self, args):
"Run a git command" "Run a git command (output excluded from chat)"
combined_output = None combined_output = None
try: try:
args = "git " + args args = "git " + args
@ -1076,7 +1076,7 @@ class Commands:
return text return text
def cmd_paste(self, args): def cmd_paste(self, args):
"""Paste image/text from the clipboard into the chat. """Paste image/text from the clipboard into the chat.\
Optionally provide a name for the image.""" Optionally provide a name for the image."""
try: try:
# Check for image first # Check for image first

View file

@ -188,10 +188,10 @@ class InputOutput:
tool_error_color="red", tool_error_color="red",
tool_warning_color="#FFA500", tool_warning_color="#FFA500",
assistant_output_color="blue", assistant_output_color="blue",
completion_menu_color="default", completion_menu_color=None,
completion_menu_bg_color="default", completion_menu_bg_color=None,
completion_menu_current_color="default", completion_menu_current_color=None,
completion_menu_current_bg_color="default", completion_menu_current_bg_color=None,
code_theme="default", code_theme="default",
encoding="utf-8", encoding="utf-8",
dry_run=False, dry_run=False,
@ -258,6 +258,41 @@ class InputOutput:
else: else:
self.console = Console(force_terminal=False, no_color=True) # non-pretty self.console = Console(force_terminal=False, no_color=True) # non-pretty
def _get_style(self):
style_dict = {}
if not self.pretty:
return Style.from_dict(style_dict)
if self.user_input_color:
style_dict.setdefault("", self.user_input_color)
style_dict.update(
{
"pygments.literal.string": f"bold italic {self.user_input_color}",
}
)
# Conditionally add 'completion-menu' style
completion_menu_style = []
if self.completion_menu_bg_color:
completion_menu_style.append(f"bg:{self.completion_menu_bg_color}")
if self.completion_menu_color:
completion_menu_style.append(self.completion_menu_color)
if completion_menu_style:
style_dict["completion-menu"] = " ".join(completion_menu_style)
# Conditionally add 'completion-menu.completion.current' style
completion_menu_current_style = []
if self.completion_menu_current_bg_color:
completion_menu_current_style.append(f"bg:{self.completion_menu_current_bg_color}")
if self.completion_menu_current_color:
completion_menu_current_style.append(self.completion_menu_current_color)
if completion_menu_current_style:
style_dict["completion-menu.completion.current"] = " ".join(
completion_menu_current_style
)
return Style.from_dict(style_dict)
def read_image(self, filename): def read_image(self, filename):
try: try:
with open(str(filename), "rb") as image_file: with open(str(filename), "rb") as image_file:
@ -335,22 +370,7 @@ class InputOutput:
inp = "" inp = ""
multiline_input = False multiline_input = False
if self.user_input_color and self.pretty: style = self._get_style()
style = Style.from_dict(
{
"": self.user_input_color,
"pygments.literal.string": f"bold italic {self.user_input_color}",
"completion-menu": (
f"bg:{self.completion_menu_bg_color} {self.completion_menu_color}"
),
"completion-menu.completion.current": (
f"bg:{self.completion_menu_current_bg_color} "
f"{self.completion_menu_current_color}"
),
}
)
else:
style = None
completer_instance = ThreadedCompleter( completer_instance = ThreadedCompleter(
AutoCompleter( AutoCompleter(
@ -490,19 +510,7 @@ class InputOutput:
else: else:
self.tool_output(subject, bold=True) self.tool_output(subject, bold=True)
if self.pretty and self.user_input_color: style = self._get_style()
style = {
"": self.user_input_color,
"completion-menu": (
f"bg:{self.completion_menu_bg_color} {self.completion_menu_color}"
),
"completion-menu.completion.current": (
f"bg:{self.completion_menu_current_bg_color} "
f"{self.completion_menu_current_color}"
),
}
else:
style = dict()
def is_valid_response(text): def is_valid_response(text):
if not text: if not text:
@ -521,7 +529,7 @@ class InputOutput:
if self.prompt_session: if self.prompt_session:
res = self.prompt_session.prompt( res = self.prompt_session.prompt(
question, question,
style=Style.from_dict(style), style=style,
) )
else: else:
res = input(question) res = input(question)
@ -565,10 +573,7 @@ class InputOutput:
self.tool_output() self.tool_output()
self.tool_output(subject, bold=True) self.tool_output(subject, bold=True)
if self.pretty and self.user_input_color: style = self._get_style()
style = Style.from_dict({"": self.user_input_color})
else:
style = None
if self.yes is True: if self.yes is True:
res = "yes" res = "yes"

View file

@ -177,16 +177,16 @@
#assistant-output-color: #0088ff #assistant-output-color: #0088ff
## Set the color for the completion menu (default: terminal's default text color) ## Set the color for the completion menu (default: terminal's default text color)
#completion-menu-color: default #completion-menu-color: xxx
## Set the background color for the completion menu (default: terminal's default background color) ## Set the background color for the completion menu (default: terminal's default background color)
#completion-menu-bg-color: default #completion-menu-bg-color: xxx
## Set the color for the current item in the completion menu (default: terminal's default background color) ## Set the color for the current item in the completion menu (default: terminal's default background color)
#completion-menu-current-color: default #completion-menu-current-color: xxx
## Set the background color for the current item in the completion menu (default: terminal's default text color) ## Set the background color for the current item in the completion menu (default: terminal's default text color)
#completion-menu-current-bg-color: default #completion-menu-current-bg-color: xxx
## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light) ## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light)
#code-theme: default #code-theme: default

View file

@ -181,16 +181,16 @@
#AIDER_ASSISTANT_OUTPUT_COLOR=#0088ff #AIDER_ASSISTANT_OUTPUT_COLOR=#0088ff
## Set the color for the completion menu (default: terminal's default text color) ## Set the color for the completion menu (default: terminal's default text color)
#AIDER_COMPLETION_MENU_COLOR=default #AIDER_COMPLETION_MENU_COLOR=
## Set the background color for the completion menu (default: terminal's default background color) ## Set the background color for the completion menu (default: terminal's default background color)
#AIDER_COMPLETION_MENU_BG_COLOR=default #AIDER_COMPLETION_MENU_BG_COLOR=
## Set the color for the current item in the completion menu (default: terminal's default background color) ## Set the color for the current item in the completion menu (default: terminal's default background color)
#AIDER_COMPLETION_MENU_CURRENT_COLOR=default #AIDER_COMPLETION_MENU_CURRENT_COLOR=
## Set the background color for the current item in the completion menu (default: terminal's default text color) ## Set the background color for the current item in the completion menu (default: terminal's default text color)
#AIDER_COMPLETION_MENU_CURRENT_BG_COLOR=default #AIDER_COMPLETION_MENU_CURRENT_BG_COLOR=
## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light) ## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light)
#AIDER_CODE_THEME=default #AIDER_CODE_THEME=default

View file

@ -225,16 +225,16 @@ cog.outl("```")
#assistant-output-color: #0088ff #assistant-output-color: #0088ff
## Set the color for the completion menu (default: terminal's default text color) ## Set the color for the completion menu (default: terminal's default text color)
#completion-menu-color: default #completion-menu-color: xxx
## Set the background color for the completion menu (default: terminal's default background color) ## Set the background color for the completion menu (default: terminal's default background color)
#completion-menu-bg-color: default #completion-menu-bg-color: xxx
## Set the color for the current item in the completion menu (default: terminal's default background color) ## Set the color for the current item in the completion menu (default: terminal's default background color)
#completion-menu-current-color: default #completion-menu-current-color: xxx
## Set the background color for the current item in the completion menu (default: terminal's default text color) ## Set the background color for the current item in the completion menu (default: terminal's default text color)
#completion-menu-current-bg-color: default #completion-menu-current-bg-color: xxx
## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light) ## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light)
#code-theme: default #code-theme: default

View file

@ -223,16 +223,16 @@ cog.outl("```")
#AIDER_ASSISTANT_OUTPUT_COLOR=#0088ff #AIDER_ASSISTANT_OUTPUT_COLOR=#0088ff
## Set the color for the completion menu (default: terminal's default text color) ## Set the color for the completion menu (default: terminal's default text color)
#AIDER_COMPLETION_MENU_COLOR=default #AIDER_COMPLETION_MENU_COLOR=
## Set the background color for the completion menu (default: terminal's default background color) ## Set the background color for the completion menu (default: terminal's default background color)
#AIDER_COMPLETION_MENU_BG_COLOR=default #AIDER_COMPLETION_MENU_BG_COLOR=
## Set the color for the current item in the completion menu (default: terminal's default background color) ## Set the color for the current item in the completion menu (default: terminal's default background color)
#AIDER_COMPLETION_MENU_CURRENT_COLOR=default #AIDER_COMPLETION_MENU_CURRENT_COLOR=
## Set the background color for the current item in the completion menu (default: terminal's default text color) ## Set the background color for the current item in the completion menu (default: terminal's default text color)
#AIDER_COMPLETION_MENU_CURRENT_BG_COLOR=default #AIDER_COMPLETION_MENU_CURRENT_BG_COLOR=
## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light) ## Set the markdown code theme (default: default, other options include monokai, solarized-dark, solarized-light)
#AIDER_CODE_THEME=default #AIDER_CODE_THEME=default

View file

@ -338,22 +338,18 @@ Environment variable: `AIDER_ASSISTANT_OUTPUT_COLOR`
### `--completion-menu-color COLOR` ### `--completion-menu-color COLOR`
Set the color for the completion menu (default: terminal's default text color) Set the color for the completion menu (default: terminal's default text color)
Default: default
Environment variable: `AIDER_COMPLETION_MENU_COLOR` Environment variable: `AIDER_COMPLETION_MENU_COLOR`
### `--completion-menu-bg-color COLOR` ### `--completion-menu-bg-color COLOR`
Set the background color for the completion menu (default: terminal's default background color) Set the background color for the completion menu (default: terminal's default background color)
Default: default
Environment variable: `AIDER_COMPLETION_MENU_BG_COLOR` Environment variable: `AIDER_COMPLETION_MENU_BG_COLOR`
### `--completion-menu-current-color COLOR` ### `--completion-menu-current-color COLOR`
Set the color for the current item in the completion menu (default: terminal's default background color) Set the color for the current item in the completion menu (default: terminal's default background color)
Default: default
Environment variable: `AIDER_COMPLETION_MENU_CURRENT_COLOR` Environment variable: `AIDER_COMPLETION_MENU_CURRENT_COLOR`
### `--completion-menu-current-bg-color COLOR` ### `--completion-menu-current-bg-color COLOR`
Set the background color for the current item in the completion menu (default: terminal's default text color) Set the background color for the current item in the completion menu (default: terminal's default text color)
Default: default
Environment variable: `AIDER_COMPLETION_MENU_CURRENT_BG_COLOR` Environment variable: `AIDER_COMPLETION_MENU_CURRENT_BG_COLOR`
### `--code-theme VALUE` ### `--code-theme VALUE`

View file

@ -124,6 +124,9 @@ When starting a fresh aider session, you can include recent git history in the c
Remember, the chat history already includes recent changes made during the current session, so this tip is most useful when starting a new aider session and you want to provide context about recent work. Remember, the chat history already includes recent changes made during the current session, so this tip is most useful when starting a new aider session and you want to provide context about recent work.
{: .tip }
The `/git` command will not work for this purpose, as its output is not included in the chat.
## How can I run aider locally from source code? ## How can I run aider locally from source code?
To run the project locally, follow these steps: To run the project locally, follow these steps:
@ -194,12 +197,18 @@ Yes, you can now share aider chat logs in a pretty way.
1. Copy the markdown logs you want to share from `.aider.chat.history.md` and make a github gist. Or publish the raw markdown logs on the web any way you'd like. 1. Copy the markdown logs you want to share from `.aider.chat.history.md` and make a github gist. Or publish the raw markdown logs on the web any way you'd like.
https://gist.github.com/paul-gauthier/2087ab8b64034a078c0a209440ac8be0 ```
https://gist.github.com/paul-gauthier/2087ab8b64034a078c0a209440ac8be0
```
2. Take the gist URL and append it to: 2. Take the gist URL and append it to:
https://aider.chat/share/?mdurl= ```
https://aider.chat/share/?mdurl=
```
This will give you a URL like this, which shows the chat history like you'd see in a terminal: This will give you a URL like this, which shows the chat history like you'd see in a terminal:
```
https://aider.chat/share/?mdurl=https://gist.github.com/paul-gauthier/2087ab8b64034a078c0a209440ac8be0 https://aider.chat/share/?mdurl=https://gist.github.com/paul-gauthier/2087ab8b64034a078c0a209440ac8be0
```

View file

@ -25,7 +25,7 @@ cog.out(get_help_md())
| **/diff** | Display the diff of changes since the last message | | **/diff** | Display the diff of changes since the last message |
| **/drop** | Remove files from the chat session to free up context space | | **/drop** | Remove files from the chat session to free up context space |
| **/exit** | Exit the application | | **/exit** | Exit the application |
| **/git** | Run a git command | | **/git** | Run a git command (output excluded from chat) |
| **/help** | Ask questions about aider | | **/help** | Ask questions about aider |
| **/lint** | Lint and fix in-chat files or all dirty files if none in chat | | **/lint** | Lint and fix in-chat files or all dirty files if none in chat |
| **/ls** | List all known files and indicate which are included in the chat session | | **/ls** | List all known files and indicate which are included in the chat session |
@ -33,8 +33,7 @@ cog.out(get_help_md())
| **/map-refresh** | Force a refresh of the repository map | | **/map-refresh** | Force a refresh of the repository map |
| **/model** | Switch to a new LLM | | **/model** | Switch to a new LLM |
| **/models** | Search the list of available models | | **/models** | Search the list of available models |
| **/paste** | Paste image/text from the clipboard into the chat. | **/paste** | Paste image/text from the clipboard into the chat. Optionally provide a name for the image. |
Optionally provide a name for the image. |
| **/quit** | Exit the application | | **/quit** | Exit the application |
| **/read-only** | Add files to the chat that are for reference, not to be edited | | **/read-only** | Add files to the chat that are for reference, not to be edited |
| **/report** | Report a problem by opening a GitHub Issue | | **/report** | Report a problem by opening a GitHub Issue |