Commit graph

1570 commits

Author SHA1 Message Date
Paul Gauthier
8afae8b38f prettier 2023-06-05 21:57:22 -07:00
Paul Gauthier
6081baa32b better 2023-06-05 21:37:56 -07:00
Paul Gauthier
2336af2886 better 2023-06-05 19:41:14 -07:00
Paul Gauthier
2f0d9279d2 works 2023-06-05 19:36:12 -07:00
Paul Gauthier
0be54922da Merge branch 'main' into diffs 2023-06-05 17:17:48 -07:00
Paul Gauthier
c8beac9a2d cleaned up 35/4 logic 2023-06-05 17:14:44 -07:00
Paul Gauthier
169e450b1a Merge branch 'main' into diffs 2023-06-05 17:06:41 -07:00
Paul Gauthier
fcd8a6df73 Use the Models enum instead of .value 2023-06-05 17:06:34 -07:00
Paul Gauthier
78782e2d90 better 2023-06-05 16:59:11 -07:00
Paul Gauthier
67121a9834 aider: Added function to print unified diff and find last non-deleted line.
# Context:
USER: do the todo
2023-06-05 16:47:52 -07:00
Paul Gauthier
2f684bf99e cleanup 2023-06-05 16:46:38 -07:00
Paul Gauthier
33d1a43845 initial 2023-06-05 16:42:36 -07:00
Paul Gauthier
efb903303f aider: Added diff_files.py script that reads two file names from the command line, reads the contents of the files, and then uses the difflib module to print their differences.
# Context:
USER: read 2 files named on the cmd line, use difflib to print their differences
ASSISTANT: To achieve this, we'll create a new Python script that reads two file names from the command line, reads the contents of the files, and then uses the `difflib` module to print their differences.

1. Create a new Python script called `diff_files.py` in the `aider` directory.
2. Import the necessary modules: `sys` and `difflib`.
3. Read the file names from the command line arguments.
4. Read the contents of the files.
5. Use `difflib.unified_diff()` to generate the differences.
6. Print the differences.

Here's the code for the new `diff_files.py` script:

```python
aider/diff_files
^C KeyboardInterrupt
USER: put it in `aider/diffs.py`
2023-06-05 14:33:38 -07:00
Paul Gauthier
130f73c864 Added /tokens cmd 2023-06-05 12:30:20 -07:00
Paul Gauthier
b6f682151d Fix issue with quoting /commands 2023-06-05 11:49:27 -07:00
Paul Gauthier
579fc39d61 rename 2023-06-05 11:32:26 -07:00
Paul Gauthier
c17e454608 Added /clear cmd 2023-06-05 11:31:47 -07:00
Paul Gauthier
c30b302363 improved --help 2023-06-05 11:15:38 -07:00
Paul Gauthier
95b32a74a9 Moved all model names into an enum 2023-06-05 09:19:29 -07:00
Paul Gauthier
efb8cad881 Merge branch 'main' into gpt-35 2023-06-05 09:07:03 -07:00
Paul Gauthier
ac2d75ed09 Added scipy==1.10.1 2023-06-05 09:05:08 -07:00
Paul Gauthier
b824cf4eb3 Added numpy==1.24.3 2023-06-05 09:03:59 -07:00
Paul Gauthier
c361366dd9 Added diskcache==5.6.1 2023-06-05 09:02:36 -07:00
Paul Gauthier
4121b9900e aider: Added cache versioning to RepoMap class.
# Context:
USER: is there a standard way to version these cache files?
ASSISTANT: Yes, a standard way to version cache files is to include a version number in the cache file name or within the cache data. This allows you to easily identify and manage different versions of the cache, and update the cache handling logic when needed.

Here's how you can implement cache versioning in your `RepoMap` class:

1. Add a constant for the cache version at the beginning of the class.
2. Modify the cache directory names to include the version number.
3. When loading the cache, check if the version matches the current version. If not, clear the cache and start fresh.

Here are the changes you need to make in `aider/repomap.py`:

```python
aider/repomap.py
<<<<<<< ORIGINAL
class RepoMap:
    ctags_cmd = ["ctags", "--fields=+S", "--extras=-F", "--output-format=json"]
    IDENT_CACHE_DIR = ".aider.ident.cache"
    TAGS_CACHE_DIR = ".aider.tags.cache"
=======
class RepoMap:
    CACHE_VERSION = 1
    ctags_cmd = ["ctags", "--fields=+S", "--extras=-F", "--output-format=json"]
    IDENT_CACHE_DIR = f".aider.ident.cache.v{CACHE_VERSION}"
    TAGS_CACHE_DIR = f".aider.tags.cache.v{CACHE_VERSION}"
>>>>>>> UPDATED
```

Now, whenever you need to change the cache format or handling logic, you can simply increment the `CACHE_VERSION` constant, and the cache will be automatically invalidated and recreated with the new version.
2023-06-05 08:30:00 -07:00
Paul Gauthier
baa08e12f8 ssh 2023-06-05 08:29:30 -07:00
Paul Gauthier
27db4c038f bugfix 2023-06-05 08:29:08 -07:00
Paul Gauthier
a3075d2da0 Added networkx==3.1 2023-06-05 08:27:39 -07:00
Paul Gauthier
93ca588bab sssh 2023-06-05 08:24:02 -07:00
Paul Gauthier
41ac5b056d Merge branch 'call-graph' into gpt-35 2023-06-04 15:39:49 -07:00
Paul Gauthier
140b03314e Merge branch 'main' into call-graph 2023-06-04 15:39:42 -07:00
Paul Gauthier
6398e5ef18 Support worktrees 2023-06-04 15:37:20 -07:00
Paul Gauthier
0256b8e260 Merge branch 'call-graph' into gpt-35 2023-06-04 15:03:46 -07:00
Paul Gauthier
6b62756703 Merge branch 'main' into call-graph 2023-06-04 15:03:18 -07:00
Paul Gauthier
c0bf25d05b undo trailing newline "fix" 2023-06-04 15:03:13 -07:00
Paul Gauthier
53e8c65745 Return files without any tags at all at the tail of the ranked_tags list 2023-06-04 14:53:14 -07:00
Paul Gauthier
dfcf813ad6 include individual files in the ranked tags list, following specific ranked idents 2023-06-04 14:45:57 -07:00
Paul Gauthier
d1cc4b93be Merge branch 'call-graph' into gpt-35 2023-06-04 14:30:35 -07:00
Paul Gauthier
dedf3fbebb Merge branch 'main' into call-graph 2023-06-04 14:30:27 -07:00
Paul Gauthier
f47f611e65 Handle empty replacement text too 2023-06-04 14:30:22 -07:00
Paul Gauthier
b339df3f70 Merge branch 'call-graph' into gpt-35 2023-06-04 14:28:28 -07:00
Paul Gauthier
1cf29a0166 Merge branch 'main' into call-graph 2023-06-04 14:28:19 -07:00
Paul Gauthier
fe1271114f Avoid stripping a newline when doing nearest search/replace 2023-06-04 14:28:03 -07:00
Paul Gauthier
d12d8ff69a lint 2023-06-04 14:16:06 -07:00
Paul Gauthier
5a61e6acd2 aider: Added a new file that imports MyClass and calls both its methods to test_get_repo_map_with_identifiers.
# Context:
USER: in `test_get_repo_map_with_identifiers` make a 2nd file that imports MyClass and calls both its methods. add that to `other_files`
ASSISTANT: Here are the changes you need to make:

1. Modify `test_get_repo_map_with_identifiers` in `tests/test_repomap.py` to add a new file that imports `MyClass` and calls both its methods:

```python
tests/test_repomap.py
<<<<<<< ORIGINAL
    def test_get_repo_map_with_identifiers(self):
        # Create a temporary directory with a sample Python file containing identifiers
        test_file = "test_file_with_identifiers.py"
        file_content = """\
class MyClass:
    def my_method(self, arg1, arg2):
        return arg1 + arg2

def my_function(arg1, arg2):
    return arg1 * arg2
"""

        with tempfile.TemporaryDirectory() as temp_dir:
            with open(os.path.join(temp_dir, test_file), "w") as f:
                f.write(file_content)

            repo_map = RepoMap(root=temp_dir)
            other_files = [os.path.join(temp_dir, test_file), os.path.join(temp_dir, "test_file_import.py")]
            result = repo_map.get_repo_map([], other_files)

            # Check if the result contains the expected tags map with identifiers
            self.assertIn("test_file_with_identifiers.py", result)
            self.assertIn("MyClass", result)
            self.assertIn("my_method", result)
            self.assertIn("my_function", result)
=======
    def test_get_repo_map_with_identifiers(self):
        # Create a temporary directory with a sample Python file containing identifiers
        test_file1 = "test_file_with_identifiers.py"
        file_content1 = """\
class MyClass:
    def my_method(self, arg1, arg2):
        return arg1 + arg2

def my_function(arg1, arg2):
    return arg1 * arg2
"""

        test_file2 = "test_file_import.py"
        file_content2 = """\
from test_file_with_identifiers import MyClass

obj = MyClass()
print(obj.my_method(1, 2))
print(my_function(3, 4))
"""

        with tempfile.TemporaryDirectory() as temp_dir:
            with open(os.path.join(temp_dir, test_file1), "w") as f:
                f.write(file_content1)

            with open(os.path.join(temp_dir, test_file2), "w") as f:
                f.write(file_content2)

            repo_map = RepoMap(root=temp_dir)
            other_files = [os.path.join(temp_dir, test_file1), os.path.join(temp_dir, test_file2)]
            result = repo_map.get_repo_map([], other_files)

            # Check if the result contains the expected tags map with identifiers
            self.assertIn("test_file_with_identifiers.py", result)
            self.assertIn("MyClass", result)
            self.assertIn("my_method", result)
            self.assertIn("my_function", result)
>>>>>>> UPDATED
```

2. Run the tests to make sure everything is working as expected.
2023-06-04 14:15:25 -07:00
Paul Gauthier
95cb482938 bugfix 2023-06-04 14:13:56 -07:00
Paul Gauthier
676dcd8fd1 fixed some tests 2023-06-04 14:07:50 -07:00
Paul Gauthier
56d2aa59ee 3.5 prompts 2023-06-04 13:59:43 -07:00
Paul Gauthier
2bdfdb11bb Don't add gpt-3.5 replies to the history if they contain edits 2023-06-04 13:44:04 -07:00
Paul Gauthier
05c4f5654f clean up initial status messages 2023-06-04 13:34:06 -07:00
Paul Gauthier
b9ce79909e copy 2023-06-04 13:22:38 -07:00