mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
coq for in-chat commands
This commit is contained in:
parent
47346af823
commit
e3cc69d0c8
3 changed files with 63 additions and 27 deletions
|
@ -639,6 +639,22 @@ class Commands:
|
||||||
else:
|
else:
|
||||||
self.io.tool_output(f"{cmd} No description available.")
|
self.io.tool_output(f"{cmd} No description available.")
|
||||||
|
|
||||||
|
def get_help_md(self):
|
||||||
|
"Show help about all commands in markdown"
|
||||||
|
|
||||||
|
res = ""
|
||||||
|
commands = sorted(self.get_commands())
|
||||||
|
for cmd in commands:
|
||||||
|
cmd_method_name = f"cmd_{cmd[1:]}"
|
||||||
|
cmd_method = getattr(self, cmd_method_name, None)
|
||||||
|
if cmd_method:
|
||||||
|
description = cmd_method.__doc__
|
||||||
|
res += f"- **{cmd}** {description}\n"
|
||||||
|
else:
|
||||||
|
res += f"- **{cmd}**\n"
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
def cmd_voice(self, args):
|
def cmd_voice(self, args):
|
||||||
"Record and transcribe voice input"
|
"Record and transcribe voice input"
|
||||||
|
|
||||||
|
@ -702,3 +718,22 @@ def parse_quoted_filenames(args):
|
||||||
filenames = re.findall(r"\"(.+?)\"|(\S+)", args)
|
filenames = re.findall(r"\"(.+?)\"|(\S+)", args)
|
||||||
filenames = [name for sublist in filenames for name in sublist if name]
|
filenames = [name for sublist in filenames for name in sublist if name]
|
||||||
return filenames
|
return filenames
|
||||||
|
|
||||||
|
|
||||||
|
def get_help_md():
|
||||||
|
from aider.coders import Coder
|
||||||
|
from aider.models import Model
|
||||||
|
|
||||||
|
coder = Coder(Model("gpt-3.5-turbo"), None)
|
||||||
|
md = coder.commands.get_help_md()
|
||||||
|
return md
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
md = get_help_md()
|
||||||
|
print(md)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
status = main()
|
||||||
|
sys.exit(status)
|
||||||
|
|
|
@ -9,5 +9,7 @@ else
|
||||||
ARG=$1
|
ARG=$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cog $ARG website/index.md
|
cog $ARG \
|
||||||
cog $ARG website/docs/usage.md
|
website/index.md \
|
||||||
|
website/docs/usage.md \
|
||||||
|
website/docs/commands.md \
|
||||||
|
|
|
@ -7,32 +7,31 @@ nav_order: 50
|
||||||
## In-chat commands
|
## In-chat commands
|
||||||
|
|
||||||
Aider supports commands from within the chat, which all start with `/`.
|
Aider supports commands from within the chat, which all start with `/`.
|
||||||
Here are some of the most useful in-chat commands:
|
|
||||||
|
|
||||||
- `/help`: Show help about all commands
|
<!--[[[cog
|
||||||
- `/exit`: Exit the application
|
from aider.commands import get_help_md
|
||||||
|
cog.out(get_help_md())
|
||||||
## Context management
|
]]]-->
|
||||||
|
- **/add** Add files to the chat so GPT can edit them or review them in detail
|
||||||
- `/add <file>`: Add matching files to the chat session using glob patterns
|
- **/clear** Clear the chat history
|
||||||
- `/drop <file>`: Remove matching files from the chat session
|
- **/commit** Commit edits to the repo made outside the chat (commit message optional)
|
||||||
- `/web <url>`: Add the contents of a webpage to the chat
|
- **/diff** Display the diff of the last aider commit
|
||||||
- `/clear`: Clear the chat history
|
- **/drop** Remove files from the chat session to free up context space
|
||||||
- `/ls`: List all known files and those included in the chat session
|
- **/exit** Exit the application
|
||||||
- `/tokens`: Report on the number of tokens used by the current chat context
|
- **/git** Run a git command
|
||||||
|
- **/help** Show help about all commands
|
||||||
## Git
|
- **/lint** Lint and fix provided files or in-chat files if none provided
|
||||||
|
- **/ls** List all known files and indicate which are included in the chat session
|
||||||
- `/undo`: Undo the last git commit if it was done by aider
|
- **/model** Switch to a new LLM
|
||||||
- `/diff`: Display the diff of the last aider commit
|
- **/models** Search the list of available models
|
||||||
- `/commit <message>`: Commit edits to the repo made outside the chat (commit message optional)
|
- **/quit** Exit the application
|
||||||
- `/git <command>`: Run a git command
|
- **/run** Run a shell command and optionally add the output to the chat (alias: !)
|
||||||
|
- **/test** Run a shell command and add the output to the chat on non-zero exit code
|
||||||
## Other
|
- **/tokens** Report on the number of tokens used by the current chat context
|
||||||
|
- **/undo** Undo the last git commit if it was done by aider
|
||||||
- `/run <command>`: Run a shell command and optionally add the output to the chat, or use `!<command>`.
|
- **/voice** Record and transcribe voice input
|
||||||
- `/test <command>`: Like run, but automatically adds the output to the chat on non-zero exit codes.
|
- **/web** Use headless selenium to scrape a webpage and add the content to the chat
|
||||||
- `/voice`: Speak to aider to [request code changes with your voice](https://aider.chat/docs/voice.html).
|
<!--[[[end]]]-->
|
||||||
|
|
||||||
# Keybindings
|
# Keybindings
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue