Commit graph

169 commits

Author SHA1 Message Date
Paul Gauthier
349bcf6973 aider: Removed all the G nodes except the top 10 based on their PageRank.
# Context:
USER: do the todo
ASSISTANT: I see a "todo" comment in the `call_map()` function. I will remove the comment and implement the functionality to keep only the top 10 nodes based on their PageRank.

```python
aider/repomap.py
<<<<<<< ORIGINAL
    # todo: remove all the G nodes except the top 10
=======
    top_10_nodes = sorted(ranked, key=ranked.get, reverse=True)[:10]
    nodes_to_remove = [node for node in G.nodes if node not in top_10_nodes]
    G.remove_nodes_from(nodes_to_remove)
>>>>>>> UPDATED
```

This change will keep only the top 10 nodes in the graph based on their PageRank and remove the rest.
2023-05-26 18:40:41 -07:00
Paul Gauthier
f46feda846 cleap up edge logic 2023-05-26 18:37:59 -07:00
Paul Gauthier
9e40898226 node size 2023-05-26 18:26:34 -07:00
Paul Gauthier
6956ed8f81 aider: Changed the size of the nodes in the graph by modifying the dot.node() function call to include width and height attributes.
# Context:
USER: for the nodes, make their size bigger not just penwidth
ASSISTANT: To change the size of the nodes in the graph, you can modify the `dot.node()` function call by adding the `fontsize` attribute. Here's the change you need to make in the `aider/repomap.py` file:

```python
a
^C KeyboardInterrupt
USER: not the fontsize, the size of the circle
ASSISTANT: To change the size of the circle representing the nodes in the graph, you can modify the `dot.node()` function call by adding the `width` and `height` attributes. Here's the change you need to make in the `aider/repomap.py` file:

```python
aider/repomap.py
<<<<<<< ORIGINAL
        pen = 10 * (rank - min_rank) / (max_rank - min_rank) + 1
        dot.node(fname, penwidth=str(pen))
=======
        size = 10 * (rank - min_rank) / (max_rank - min_rank) + 1
        dot.node(fname, penwidth=str(size), width=str(size), height=str(size))
>>>>>>> UPDATED
```
2023-05-26 17:10:05 -07:00
Paul Gauthier
1e1feeaa21 Merge branch 'main' into call-graph 2023-05-26 17:07:17 -07:00
Paul Gauthier
43413654bd enable ctags if present 2023-05-26 16:03:24 -07:00
Paul Gauthier
ae087287c7 aider: Added check_for_ctags method to RepoMap class and updated __init__ method to set use_ctags to False if check_for_ctags returns False.
# Context:
USER: add a check_for_ctags method that: makes a tempdir with hello.py that defines a hello func. call get_tags on that and catch any error and return false. otherwise true.
ASSISTANT: I will add a `check_for_ctags` method to the `RepoMap` class in the `aider/repomap.py` file. This method will create a temporary directory with a `hello.py` file that defines a `hello` function. It will then call the `get_tags` method on that file, catch any errors, and return `False` if there's an error or `True` otherwise.

Here's the change:

```python
aider/repomap.py
<<<<<<< ORIGINAL
import os
import json
import sys
import subprocess
import tiktoken
=======
import os
import json
import sys
import subprocess
import tiktoken
import tempfile
>>>>>>> UPDATED
```

```python
aider/repomap.py
<<<<<<< ORIGINAL
class RepoMap:
    ctags_cmd = ["ctags", "--fields=+S", "--extras=-F", "--output-format=json"]

    def __init__(self, use_ctags=True, root=None, main_model="gpt-4"):
=======
class RepoMap:
    ctags_cmd = ["ctags", "--fields=+S", "--extras=-F", "--output-format=json"]

    def __init__(self, use_ctags=True, root=None, main_model="gpt-4"):
        if not self.check_for_ctags():
            use_ctags = False
>>>>>>> UPDATED
```

```python
aider/repomap.py
<<<<<<< ORIGINAL
        return tags

if __name__ == "__main__":
    rm = RepoMap()
    res = rm.get_tags_map(sys.argv[1:])
    print(res)
=======
    def check_for_ctags(self):
        try:
            with tempfile.TemporaryDirectory() as tempdir:
                hello_py = os.path.join(tempdir, "hello.py")
                with open(hello_py, "w") as f:
                    f.write("def hello():\n    print('Hello, world!')\n")
                self.get_tags(hello_py)
        except Exception:
            return False
        return True

if __name__ == "__main__":
    rm = RepoMap()
    res = rm.get_tags_map(sys.argv[1:])
    print(res)
>>>>>>> UPDATED
```

This adds the `check_for_ctags` method to the `RepoMap` class and updates the `__init__` method to set `use_ctags` to `False` if `check_for_ctags` returns `False`.
2023-05-26 15:57:31 -07:00
Paul Gauthier
711212ef3c refac 2023-05-26 15:52:35 -07:00
Paul Gauthier
32289bc40f fixed bug caught in tests 2023-05-26 15:50:35 -07:00
Paul Gauthier
a886ea472b Stronger prompting to only modify full files, not parts of the repo map 2023-05-26 12:59:08 -07:00
Paul Gauthier
599a3b2730 wip 2023-05-25 10:45:57 -07:00
Paul Gauthier
959f577aba wip 2023-05-25 10:01:01 -07:00
Paul Gauthier
f70aea7cd1 noop 2023-05-25 08:49:40 -07:00
Paul Gauthier
da8a85fea6 wip 2023-05-25 06:39:40 -07:00
Paul Gauthier
407e47b6ed wip 2023-05-24 22:26:48 -07:00
Paul Gauthier
a1b5206345 wip 2023-05-24 22:04:43 -07:00
Paul Gauthier
3ecf008478 refac 2023-05-24 21:31:08 -07:00
Paul Gauthier
60031ecd29 fixed bug found by testing 2023-05-24 19:09:05 -07:00
Paul Gauthier
dcf1bbf20e renamed ctags->repomap 2023-05-24 18:55:47 -07:00
Renamed from aider/ctags.py (Browse further)