Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
22.55k stars 2.1k forks source link

Feature request - templates for aider #1815

Open lockmeister opened 1 month ago

lockmeister commented 1 month ago

Issue

Some inspiration could be taken from https://github.com/simonw/llm by Simon Willison, his LLM tool allows the creation of plugins (#1814) . He also has a prompt template system that allows users to save prompt templates. This can be used to interesting effect, for example (note in this example I wrote it out in full without using a template for clarity):

#!/bin/sh
llm -s "Output the keystrokes required to achieve the following task in vim. Answer in as few words as possible. Print the keystrokes, then on a newline print a succinct explanation." -m claude-3.5-sonnet "$*"

I alias that script to vh and then use it like this:

~$ vh copy line under cursor

yy Yank (copy) the current line

I think that custom commands would be handy for aider, for example when using aider as interactive help for itself, the following command would be handy to check what's new in aider:

/run git log --since="1 month ago" --pretty=format:"%h - %s" --grep="feature\|add\|new"

it would be handy to save things like that, but they're probably not worthy of a plugin - therefore ability to save them as a template would be handy.

Version and model info

No response

fry69 commented 1 month ago

Possible related issues: #1745 #1704

I think that custom commands would be handy for aider, for example when using aider as interactive help for itself, the following command would be handy to check what's new in aider:

/run git log --since="1 month ago" --pretty=format:"%h - %s" --grep="feature\|add\|new"

Another "trick" to get the latest changes is something like this (being in the aider repository root and on the current main branch) ->

$ git diff HEAD~100 aider/website/HISTORY.md

The raw git commit log is a bit too noisy for this, IMHO.

If you leave out the path specifier, this also works to summarize changes in aider in general, as the commit log is often not helpful in this regard. Hypothetically ->

$ git diff v0.57.1 | llm -s "Summarize the supplied git diff changes briefly"

Of course you can specific an amount of commits relative to the current HEAD like in the first example instead of the git tag v0.57.1 for this, or even a specific commit id.

For bigger ranges it may be helpful to check the size of the git diff first before sending it to the LLM ->

$ git diff v0.57.1 | wc
    6492   24095  217919
lockmeister commented 1 month ago

I've also found lot of good info in the issues and PRs; these can be explored with gh

gh pr list --state merged --limit 10

fry69 commented 1 month ago

I've also found lot of good info in the issues and PRs; these can be explored with gh

gh pr list --state merged --limit 10

You will only see outside contributions this way, not Paul's changes (which are the vast majority).

paul-gauthier commented 3 weeks ago

@lockmeister Also, you can simply use up-arrow or control-r to search for previous commands you have input. You can then re-use them easily.