Commit graph

2677 commits

Author SHA1 Message Date
Paul Gauthier
2eeee67ee5 support --keywords 2023-08-09 11:12:27 -03:00
Paul Gauthier
00512e3d1c no fuzy matching, stronger prompt for whitespace 2023-08-09 08:25:49 -03:00
Paul Gauthier
c6f6ab6070 corrected perfect replace 2023-08-09 08:20:16 -03:00
Paul Gauthier
6c2cafc1ed Removed "pause often to ask the user" prompting 2023-08-08 17:40:45 -03:00
Paul Gauthier
c43d7e9a69 initial --diffs implementation 2023-08-08 17:40:32 -03:00
Paul Gauthier
77be993708 Merge branch 'main' into indent-bad-edit 2023-08-08 12:43:57 -03:00
Paul Gauthier
68a3e4f74d set version to 0.11.2-dev 2023-08-08 12:32:49 -03:00
Paul Gauthier
655f6aef2a version bump to 0.11.1 2023-08-08 12:32:25 -03:00
Paul Gauthier
237dc09c26 Updated HISTORY 2023-08-08 12:32:19 -03:00
Paul Gauthier
ae645f929e Updated HISTORY 2023-08-08 12:07:01 -03:00
Paul Gauthier
f26e40d48e Skip non-files when building repomap #174 2023-08-08 12:02:40 -03:00
Paul Gauthier
500a22c306 copy 2023-08-08 09:05:58 -03:00
Paul Gauthier
486bcdb815 Merge remote-tracking branch 'origin/main' 2023-08-08 09:01:09 -03:00
Paul Gauthier
589e7eefea We always want diffs of working-dir + index versus repo #184 2023-08-08 09:00:19 -03:00
Paul Gauthier
af854182dc added failing test case for diffs of empty repo with new file added 2023-08-08 08:20:26 -03:00
paul-gauthier
67b7107786
Merge pull request #187 from joshuavial/fix-git-editor-crash
disabling GIT_EDITOR when calling /git
2023-08-08 08:11:41 -03:00
Paul Gauthier
fe44627042 copy 2023-08-08 08:02:56 -03:00
Joshua Vial
88d7e2ed09 disabling GIT_EDITOR when calling /git 2023-08-08 23:01:36 +12:00
Paul Gauthier
20c7eb549c aider: Mocked get_commit_message to return "I added str(fname)".
# Aider chat conversation:

USER: mock `get_commit_message` to return "I added str(fname)"

ASSISTANT: To mock the `get_commit_message` method to return "I added str(fname)", we need to modify the `test_new_file_commit_message` function in the `tests/test_coder.py` file.

Here is the change needed:

<source>python
tests/test_coder.py
<<<<<<< ORIGINAL
            # Get the latest commit message
            commit_message = repo.head.commit.message
            # Check that the latest commit message contains the filename
            self.assertIn(str(fname), commit_message)
=======
            # Mock the get_commit_message method to return "I added str(fname)"
            repo.get_commit_message = MagicMock(return_value=f"I added {str(fname)}")
            # Get the latest commit message
            commit_message = repo.get_commit_message()
            # Check that the latest commit message is "I added str(fname)"
            self.assertEqual(commit_message, f"I added {str(fname)}")
>>>>>>> UPDATED
</source>
2023-08-08 08:01:15 -03:00
Paul Gauthier
737c2e0b5f aider: Check that the latest commit message contains the filename.
# Aider chat conversation:

USER: do the todo

ASSISTANT: To complete the TODO task in the `test_new_file_commit_message` function, we need to check that the latest commit message contains the filename. We can do this by getting the latest commit message from the git repository and checking if the filename is in it.

Here is the change needed in the `tests/test_coder.py` file:

<source>python
tests/test_coder.py
<<<<<<< ORIGINAL
            # TODO: check that the latest commit message contains str(fname)
=======
            # Get the latest commit message
            commit_message = repo.head.commit.message
            # Check that the latest commit message contains the filename
            self.assertIn(str(fname), commit_message)
>>>>>>> UPDATED
</source>
2023-08-08 07:59:57 -03:00
Paul Gauthier
3698b12215 copy 2023-08-08 07:55:42 -03:00
Paul Gauthier
75d8115597 copy 2023-08-08 07:53:14 -03:00
Paul Gauthier
9cb1a9b186 cleanup 2023-08-08 07:38:37 -03:00
Paul Gauthier
6c4017ecfe Merge remote-tracking branch 'origin/main' 2023-08-08 07:38:14 -03:00
paul-gauthier
6a88d0f2b9
Merge pull request #177 from h0x91b/h0x91b-patch-1
Update base_coder.py
2023-08-08 07:37:51 -03:00
Paul Gauthier
445785a3a1 Updated HISTORY 2023-08-08 07:04:16 -03:00
Paul Gauthier
3c0720ff1c Fix corner case of undefined text when using --no-pretty 2023-08-08 07:00:21 -03:00
Paul Gauthier
94e5aeac62 copy 2023-08-07 13:00:21 -03:00
Paul Gauthier
b12899f8f3 copy 2023-08-07 11:35:20 -03:00
Paul Gauthier
14c683bfdf more specific selector 2023-08-07 11:33:06 -03:00
Paul Gauthier
68f043bd96 copy 2023-08-07 11:30:22 -03:00
Paul Gauthier
0f682570a4 aider: Fix the issue with forming the raw URL for a non-raw GitHub gist by including the username in the URL.
# Aider chat conversation:

USER: if the mdurl is a non-raw github gist like this `https://gist.github.com/paul-gauthier/2a4ac695b77f6374c923b0b165a6872b` pull out the h
ash and turn into a raw url like this: `4fd2ac290d
64100e51206fb6874e9ac20644fcd`. Right now it's not including the username (paul-gauthier) portion in the raw url

ASSISTANT: To fix this issue, we need to modify the JavaScript code in the `share/index.md` file. The current code is not correctly forming the raw URL for a non-raw GitHub gist. It's missing the username in the raw URL.

Here is the step-by-step plan:

1. Modify the regular expression to capture the username and the gist hash.
2. Update the raw URL formation to include the captured username.

Here is the *edit block* for the change:

```markdown
share/index.md
<<<<<<< ORIGINAL
    var gistRegex = /^https:\/\/gist\.github\.com\/[^\/]+\/([a-f0-9]+)$/;
    var match = gistRegex.exec(conv);
    if (match) {
        // If it is, convert it into a raw URL
        conv = 'https://gist.githubusercontent.com/' + match[1] + '/raw';
    }
=======
    var gistRegex = /^https:\/\/gist\.github\.com\/([^\/]+)\/([a-f0-9]+)$/;
    var match = gistRegex.exec(conv);
    if (match) {
        // If it is, convert it into a raw URL
        conv = 'https://gist.githubusercontent.com/' + match[1] + '/' + match[2] + '/raw';
    }
>>>>>>> UPDATED
```

This change will correctly form the raw URL for a non-raw GitHub gist by including the username in the URL.
2023-08-07 11:16:56 -03:00
Paul Gauthier
8e1a1f5886 aider: Add condition to convert non-raw GitHub gist URLs into raw URLs.
# Aider chat conversation:

USER: if the mdurl is a non-raw github gist like this `https://gist.github.com/paul-gauthier/2a4ac695b77f6374c923b0b165a6872b` pull out the hash and turn into a raw url like this: `4fd2ac290d`

ASSISTANT: To implement this change, we need to modify the `share/index.md` file. We will add a condition to check if the `mdurl` parameter is a non-raw GitHub gist URL. If it is, we will extract the gist ID and convert it into a raw URL.

Here is the proposed change:

```markdown
share/index.md
<<<<<<< ORIGINAL
var conv = urlParams.get('mdurl');
if (!conv) {
    return;
}
fetch(conv)
=======
var conv = urlParams.get('mdurl');
if (!conv) {
    return;
}
// Check if the URL is a non-raw GitHub gist
var gistRegex = /^https:\/\/gist\.github\.com\/[^\/]+\/([a-f0-9]+)$/;
var match = gistRegex.exec(conv);
if (match) {
    // If it is, convert it into a raw URL
    conv = 'https://gist.githubusercontent.com/' + match[1] + '/raw';
}
fetch(conv)
>>>>>>> UPDATED
```

This change adds a regular expression to match non-raw GitHub gist URLs. If the `mdurl` parameter matches this pattern, the gist ID is extracted and used to construct a raw URL. The fetch operation then uses this raw URL instead of the original URL.
2023-08-07 11:12:45 -03:00
Paul Gauthier
7aed0438fe aider: If the fetch fails, skip the rest.
# Aider chat conversation:

USER: if the fetch fails, skip the rest

ASSISTANT: To handle fetch failures, we need to modify the `share/index.md` file. We will add a `.catch` block to the fetch promise chain to handle any errors that occur during the fetch operation.

Here is the proposed change:

```markdown
share/index.md
<<<<<<< ORIGINAL
fetch(conv)
.then(response => response.text())
.then(markdown => {
    // Ensure every line that starts with '>' ends with exactly 2 spaces
    markdown = markdown.split('\n').map(function(line) {
        if (line.startsWith('>')) {
            return line.trimEnd() + '  ';
        }
        return line;
    }).join('\n');
    var html = marked.parse(markdown);
    var divElement = document.querySelector('.chat-transcript');
    divElement.innerHTML = html;
});
=======
fetch(conv)
.then(response => response.text())
.then(markdown => {
    // Ensure every line that starts with '>' ends with exactly 2 spaces
    markdown = markdown.split('\n').map(function(line) {
        if (line.startsWith('>')) {
            return line.trimEnd() + '  ';
        }
        return line;
    }).join('\n');
    var html = marked.parse(markdown);
    var divElement = document.querySelector('.chat-transcript');
    divElement.innerHTML = html;
})
.catch(error => {
    console.error('Error fetching markdown:', error);
});
>>>>>>> UPDATED
```

This change adds a `.catch` block to the fetch promise chain. If an error occurs during the fetch operation, the error will be logged to the console and the rest of the script will be skipped.
2023-08-07 11:11:02 -03:00
Paul Gauthier
c5d80e9f7a aider: Check if there is a mdurl param and skip the rest if not.
# Aider chat conversation:

USER: check to make sure there is a mdurl param, skip the rest if not

ASSISTANT: To implement this change, we need to modify the `share/index.md` file. We will add a condition to check if the `mdurl` parameter exists before proceeding with the rest of the script.

Here is the proposed change:

```markdown
share/index.md
<<<<<<< ORIGINAL
window.onload = function() {
    var urlParams = new URLSearchParams(window.location.search);
    var conv = urlParams.get('mdurl');
    fetch(conv)
=======
window.onload = function() {
    var urlParams = new URLSearchParams(window.location.search);
    var conv = urlParams.get('mdurl');
    if (!conv) {
        return;
    }
    fetch(conv)
>>>>>>> UPDATED
```

This change checks if `conv` (which holds the value of the `mdurl` parameter) is not present. If it's not, the function returns immediately, skipping the rest of the script.
2023-08-07 11:10:28 -03:00
Paul Gauthier
49b1b228bd aider: Add script tag to load marked.min.js from CDN.
# Aider chat conversation:

USER: also load https://cdn.jsdelivr.net/npm/marked/marked.min.js

ASSISTANT: To load the `marked.min.js` library from the CDN, we need to add a script tag in the `index.md` file. Here is the change:

```markdown
share/index.md
<<<<<<< ORIGINAL
<script>
window.onload = function() {
=======
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
window.onload = function() {
>>>>>>> UPDATED
```

This change adds a new script tag before the existing script tag. The new script tag loads the `marked.min.js` library from the CDN. The existing script tag remains unchanged.
2023-08-07 11:06:35 -03:00
Paul Gauthier
4f8627e81f Add script to fetch and display a shared aider chat transcript. 2023-08-07 11:06:14 -03:00
Paul Gauthier
03ac5202dd Handle a pending summarization 2023-08-07 08:33:06 -03:00
Paul Gauthier
fcce0c2c39 copy 2023-08-04 07:40:29 -03:00
Paul Gauthier
0328e0b4c1 copy 2023-08-04 07:27:43 -03:00
Paul Gauthier
6f6ff03338 Merge branch 'main' into indent-bad-edit 2023-08-04 06:41:43 -03:00
Paul Gauthier
973884d8a1 Updated HISTORY 2023-08-04 06:40:00 -03:00
Paul Gauthier
c271bfd932 Fixed /commit after repo refactor, added test coverage 2023-08-04 06:39:04 -03:00
Arseniy Pavlenko
aedd6ed8d0
Update base_coder.py
It fixes 2 exceptions on Azure GPT-4

1)
Traceback (most recent call last):
  File "/opt/homebrew/bin//aider", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.10/site-packages/aider/main.py", line 523, in main
    coder.run()
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 339, in run
    new_user_message = self.run_loop()
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 423, in run_loop
    return self.send_new_user_message(inp)
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 456, in send_new_user_message
    interrupted = self.send(messages, functions=self.functions)
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 580, in send
    self.show_send_output_stream(completion)
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 680, in show_send_output_stream
    sys.stdout.write(text)
UnboundLocalError: local variable 'text' referenced before assignment

2) 
Traceback (most recent call last):
  File "/opt/homebrew/bin//aider", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.10/site-packages/aider/main.py", line 523, in main
    coder.run()
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 339, in run
    new_user_message = self.run_loop()
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 423, in run_loop
    return self.send_new_user_message(inp)
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 456, in send_new_user_message
    interrupted = self.send(messages, functions=self.functions)
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 580, in send
    self.show_send_output_stream(completion)
  File "/opt/homebrew/lib/python3.10/site-packages/aider/coders/base_coder.py", line 656, in show_send_output_stream
    if chunk.choices[0].finish_reason == "length":
IndexError: list index out of range
2023-08-03 23:37:44 +03:00
Paul Gauthier
a30f7cf3c3 Merge branch 'main' into indent-bad-edit 2023-08-03 16:33:17 -03:00
Paul Gauthier
8c401ceae7 cleanup 2023-08-03 16:30:38 -03:00
Paul Gauthier
5f7e1d8675 only add newline for non-empty blocks 2023-08-03 16:24:48 -03:00
Paul Gauthier
26ebc715eb works 2023-08-03 16:22:49 -03:00
Paul Gauthier
a0f03ab0ce regularize inputs 2023-08-03 15:39:46 -03:00
Paul Gauthier
a6c2841342 noop 2023-08-03 15:37:18 -03:00