Commit graph

2330 commits

Author SHA1 Message Date
Paul Gauthier
a01208d9c0 copy 2023-07-07 13:32:51 -07:00
Paul Gauthier
cffeb275a6 cleanup 2023-07-07 12:27:13 -07:00
Paul Gauthier
552bdc4f71 handle diff output for new file 2023-07-07 11:58:27 -07:00
Paul Gauthier
93d4fe5f14 Updated HISTORY 2023-07-07 11:30:52 -07:00
Paul Gauthier
f98ab4005d fix tests 2023-07-07 11:29:56 -07:00
Paul Gauthier
a764efa82b fix test 2023-07-07 11:25:41 -07:00
Paul Gauthier
b5c497b6a6 Allow adding of existing non-git files 2023-07-07 11:21:55 -07:00
Paul Gauthier
63d98b30d8 honor --no-git 2023-07-07 11:13:52 -07:00
Paul Gauthier
181062dc06 confirm_ask 2023-07-07 11:12:36 -07:00
Paul Gauthier
95c1aa2f2e aider: Initialized a new git repository in the current working directory and output a message to inform the user.
# Context:
USER: do the TODO
ASSISTANT: To clarify, are you referring to the TODO comment in the `main.py` file? The comment is:

```python
    if not git_root:
        if io.ask_confirm("Create git repo (recommended)?"):
            # TODO: create at cwd
            pass
```

It seems like the task is to create a git repository in the current working directory if one does not already exist. Is that correct?
USER: yes
ASSISTANT: To create a git repository in the current working directory, we need to use the `git` module's `Repo.init` method. Here's how to modify the `main.py` file:

```python
aider/main.py
<<<<<<< ORIGINAL
    if not git_root:
        if io.ask_confirm("Create git repo (recommended)?"):
            # TODO: create at cwd
            pass
=======
    if not git_root:
        if io.ask_confirm("Create git repo (recommended)?"):
            git.Repo.init(os.getcwd())
            io.tool_output("Git repository created in the current working directory.")
>>>>>>> UPDATED
```

This change will initialize a new git repository in the current working directory when the user confirms. It also outputs a message to inform the user that the repository has been created.
2023-07-07 11:10:25 -07:00
Paul Gauthier
b75cfaac28 Look for conf yml in cwd, gitroot and homedir 2023-07-07 11:08:34 -07:00
Paul Gauthier
3498a1494a copy 2023-07-07 10:17:15 -07:00
Paul Gauthier
a0a06123f5 copy 2023-07-07 10:16:45 -07:00
Paul Gauthier
fb5af6ec8b catch and report json errors parsing ctags output #63 2023-07-07 09:54:50 -07:00
Paul Gauthier
9c0ae45317 change faq links to aider.chat 2023-07-07 09:48:41 -07:00
Paul Gauthier
0716684b34 copy 2023-07-07 09:45:12 -07:00
Paul Gauthier
57d93f8f99 link to ctags faq 2023-07-07 09:41:03 -07:00
Paul Gauthier
f3434418c9 Merge remote-tracking branch 'origin/main' 2023-07-07 09:39:21 -07:00
Paul Gauthier
9e92eaef59 Added FAQ link 2023-07-07 09:39:01 -07:00
Paul Gauthier
07560483cf added faq 2023-07-07 09:36:27 -07:00
paul-gauthier
6e8695999d
Merge pull request #59 from paul-gauthier/glob-add
Updated the /add and /drop commands to glob files
2023-07-07 09:19:27 -07:00
Paul Gauthier
033541d01f Merge branch 'main' into glob-add 2023-07-07 09:10:56 -07:00
Paul Gauthier
681ef38463 Corrected .aider.config.yml -> .aider.conf.yml 2023-07-07 09:07:34 -07:00
Paul Gauthier
1654ee422f add test for conf yml 2023-07-07 09:07:02 -07:00
Paul Gauthier
d8e125f552 added test_no_files_new_file_should_ask 2023-07-07 08:35:22 -07:00
Paul Gauthier
61e9003ce0 handle valerr in render_incremental_response 2023-07-07 08:29:53 -07:00
Paul Gauthier
40787b3637 test case to tickle bug in wholefiles 2023-07-07 08:25:19 -07:00
Paul Gauthier
75b533b4c3 commit new files to git 2023-07-07 08:24:44 -07:00
Paul Gauthier
6a0cff50f8 filter against git 2023-07-06 18:09:26 -07:00
Paul Gauthier
cb2b2c5ce3 Merge branch 'main' into glob-add 2023-07-06 17:53:46 -07:00
Paul Gauthier
d0b7753091 Merge remote-tracking branch 'origin/main' 2023-07-06 17:44:45 -07:00
Paul Gauthier
42977230b1 Mark gpt-4 as always_available to skip the availability check on startup 2023-07-06 17:44:12 -07:00
paul-gauthier
e3497a3fcb
Update README.md 2023-07-06 16:09:39 -07:00
Paul Gauthier
c45074b937 version bump to 0.8.0 2023-07-06 14:08:47 -07:00
Paul Gauthier
25f3db6a72 preparing for v0.8.0 2023-07-06 14:04:20 -07:00
Paul Gauthier
44311f4737 preparing for v0.8.0 2023-07-06 14:03:06 -07:00
paul-gauthier
c5f8f564a4
Merge pull request #58 from paul-gauthier/encodings
Use an explicit encoding to read/write text files, utf-8 by default
2023-07-06 13:40:02 -07:00
Paul Gauthier
95a777a48c More accurate /tokens 2023-07-06 13:35:17 -07:00
Paul Gauthier
6cb4428cb7 Merge branch 'main' into encodings 2023-07-06 13:33:53 -07:00
Paul Gauthier
1291c2424a better message for no /ls output 2023-07-06 12:52:33 -07:00
Paul Gauthier
274caab6b1 Merge branch 'main' into glob-add 2023-07-06 12:43:53 -07:00
Paul Gauthier
09f79e5a42 fix PermErr in test on windows 2023-07-06 12:37:32 -07:00
Paul Gauthier
0f1af1d991 improve filehandle hygene 2023-07-06 12:29:49 -07:00
Paul Gauthier
656af5cd83 rename did not help 2023-07-06 12:26:29 -07:00
Paul Gauthier
2b69c11672 Try renaming to avoid windows PermErr 2023-07-06 12:08:07 -07:00
Paul Gauthier
4a15b6c010 test_run_with_file_utf_unicode_error 2023-07-06 11:57:44 -07:00
Paul Gauthier
7cadfd9b4c aider: Changed encoding to 'latin-1' and provided content that will cause an error when read with 'utf-8' encoding in the test_run_with_file_utf_unicode_error method.
# Context:
USER: do the TODOs
ASSISTANT: I see two TODOs in the provided code.

1. In the `test_run_with_file_utf_unicode_error` method, you need to specify an encoding other than 'utf-8'.
2. In the same method, you need to provide content that will cause an error when read with 'utf-8' encoding.

Here are the proposed changes:

```python
tests/test_coder.py
<<<<<<< ORIGINAL
        encoding = 'pick something other than utf-8' # TODO
=======
        encoding = 'latin-1'
>>>>>>> UPDATED
```

```python
tests/test_coder.py
<<<<<<< ORIGINAL
        some_content_which_will_error_if_read_with_encoding_utf8 = '' # TODO
=======
        some_content_which_will_error_if_read_with_encoding_utf8 = 'ÅÍÎÏ'.encode('utf-16')
>>>>>>> UPDATED
```

In the first change, I've chosen 'latin-1' as the encoding. It's a common encoding that's different from 'utf-8'.

In the second change, I've provided a string of characters that are not valid 'utf-8' when encoded with 'utf-16'. This will cause an error when trying to read the file with 'utf-8' encoding.
2023-07-06 11:56:15 -07:00
Paul Gauthier
5ec5b60660 better /tokens test 2023-07-06 11:50:13 -07:00
Paul Gauthier
eb6ac6841f aider: Redirected the standard output to an instance of io.StringIO and captured the console output of cmd_tokens.
# Context:
USER: how can i capture the console output of `cmd_tokens`?
ASSISTANT: To capture the console output of `cmd_tokens`, you can modify the `test_cmd_tokens` method in the `tests/test_commands.py` file. You can use the `io.StringIO` class to capture the standard output.

Here's how you can do it:

1. Import the `io` module at the top of the file.
2. In the `test_cmd_tokens` method, redirect the standard output to an instance of `io.StringIO` before calling `commands.cmd_tokens("")`.
3. After calling `commands.cmd_tokens("")`, you can get the console output from the `io.StringIO` instance.

Here is the *edit block* for the changes:

```python
tests/test_commands.py
<<<<<<< ORIGINAL
import codecs
import os
import shutil
import tempfile
from unittest import TestCase

from aider import models
from aider.commands import Commands
from aider.io import InputOutput
=======
import codecs
import os
import shutil
import tempfile
from unittest import TestCase
import io

from aider import models
from aider.commands import Commands
from aider.io import InputOutput
>>>>>>> UPDATED

tests/test_commands.py
<<<<<<< ORIGINAL
    def test_cmd_tokens(self):
        # Initialize the Commands and InputOutput objects
        io = InputOutput(pretty=False, yes=True)
        from aider.coders import Coder

        coder = Coder.create(models.GPT35, None, io, openai_api_key="deadbeef")
        commands = Commands(io, coder)

        commands.cmd_add("foo.txt bar.txt")
        commands.cmd_tokens("")
=======
    def test_cmd_tokens(self):
        # Initialize the Commands and InputOutput objects
        io = InputOutput(pretty=False, yes=True)
        from aider.coders import Coder

        coder = Coder.create(models.GPT35, None, io, openai_api_key="deadbeef")
        commands = Commands(io, coder)

        commands.cmd_add("foo.txt bar.txt")

        # Redirect the standard output to an instance of io.StringIO
        stdout = io.StringIO()
        sys.stdout = stdout

        commands.cmd_tokens("")

        # Reset the standard output
        sys.stdout = sys.__stdout__

        # Get the console output
        console_output = stdout.getvalue()
        print(console_output)
>>>>>>> UPDATED
```

Please note that this will only capture the output of `print` statements. If the `cmd_tokens` method writes to the console in a different way (for example, by writing directly to `sys.stdout`), this might not capture that output.
2023-07-06 11:46:20 -07:00
Paul Gauthier
089fa57ede full edit for wholefile 2023-07-06 11:43:20 -07:00