Commit graph

3377 commits

Author SHA1 Message Date
Paul Gauthier
24f1e01177 Refactored MarkdownStream to use rich.live for real-time updates and improved text rendering. 2024-01-23 09:50:23 -08:00
Paul Gauthier
b143bc56ac switch to mdstream 2024-01-23 09:20:31 -08:00
Paul Gauthier
e50a0e8b09 noop 2024-01-23 08:55:28 -08:00
Paul Gauthier
85383079f6 cleanup 2024-01-23 08:55:08 -08:00
Paul Gauthier
e6a4edf2e2 aider: Mark _text as noqa 501.
# Aider chat conversation:

USER: mark _text as noqa 501

ASSISTANT: To mark `_text` as `noqa 501`, we need to modify `aider/mdstream.py`:

1. Add `# noqa: 501` at the end of the `_text` variable declaration.

Here is the *SEARCH/REPLACE* block:

aider/mdstream.py
<source>python
<<<<<<< SEARCH
_text = 5 * _text
=======
_text = 5 * _text  # noqa: 501
>>>>>>> REPLACE
</source>
2024-01-23 08:53:34 -08:00
Paul Gauthier
c051104dc0 Add MarkdownStream class for displaying markdown content in a stream. 2024-01-23 08:53:29 -08:00
Paul Gauthier
009c5c3c0d set version to 0.22.1-dev 2024-01-22 17:52:04 -08:00
Paul Gauthier
28b69f381c version bump to 0.22.0 2024-01-22 17:51:33 -08:00
Paul Gauthier
51810aa4d2 Updated HISTORY 2024-01-22 17:50:54 -08:00
Paul Gauthier
b2f36a786d Updated HISTORY 2024-01-22 14:49:15 -08:00
Paul Gauthier
4e3ace6199 Added ! as alias for /run #334 2024-01-22 13:52:59 -08:00
Paul Gauthier
96d60624cb added /test cmd #335 2024-01-22 13:50:21 -08:00
Paul Gauthier
06973d85a3 When autocompleting /add and /drop quote the filename if needed #440 2024-01-22 13:28:56 -08:00
Paul Gauthier
23cc78f36b typo 2024-01-22 13:21:16 -08:00
Paul Gauthier
a8b854fe8d fix f-string 2024-01-22 13:10:15 -08:00
Paul Gauthier
877dda2f3d On /undo, ask GPT to wait before retrying the changes #450 2024-01-22 13:05:38 -08:00
Paul Gauthier
f0531b8b75 speed up animation 2024-01-20 11:54:14 -08:00
Paul Gauthier
05539929ad renamed issue template 2024-01-10 07:58:10 -08:00
Paul Gauthier
ed2829fa03 updated issue template 2024-01-10 07:57:53 -08:00
paul-gauthier
552390f298
Update issue templates 2024-01-10 07:55:33 -08:00
Paul Gauthier
61e68ffe9d set version to 0.21.2-dev 2024-01-10 07:50:45 -08:00
Paul Gauthier
0d11880a4a version bump to 0.21.1 2024-01-10 07:50:15 -08:00
Paul Gauthier
cb6e43f2fd Updated HISTORY 2024-01-10 07:49:27 -08:00
Paul Gauthier
6a77657d95 added --4turbo and --4 aliases 2024-01-10 07:48:17 -08:00
Paul Gauthier
29a578c621 Complete the search for viable hunks all the way down to 0 space context lines #435 2024-01-09 08:34:33 -08:00
Paul Gauthier
e0e454fe82 set version to 0.21.1-dev 2024-01-08 10:44:34 -08:00
Paul Gauthier
942cb2d147 version bump to 0.21.0 2024-01-08 10:44:03 -08:00
Paul Gauthier
27e970eb59 Updated HISTORY 2024-01-08 10:39:24 -08:00
Paul Gauthier
460e12494c added 3.12 to pypi classifiers 2024-01-05 14:50:37 -08:00
Paul Gauthier
fb1e6ad8a0 bump the python version to <3.13 2024-01-05 14:49:09 -08:00
Paul Gauthier
d5f4ba2278 handle multiple udiffs inside a single fenced block 2024-01-04 12:53:01 -08:00
Paul Gauthier
bd1c8b625d aider: Add --check-update to make aider check for update and return status in the exit code.
# Aider chat conversation:

USER: add --check-update to make aider check for update and return status in the exit code.

ASSISTANT: To implement the `--check-update` option, I will make the following changes:

1. Add the `--check-update` argument to the argument parser in `aider/main.py`.
2. Modify the `check_version` function in `aider/versioncheck.py` to return a boolean indicating whether an update is available.
3. Use the returned value from `check_version` in `aider/main.py` to set the exit status code when `--check-update` is used.

Here are the diffs for those changes:

```diff
--- aider/versioncheck.py
+++ aider/versioncheck.py
@@ ... @@
 def check_version(print_cmd):
     try:
         response = requests.get("https://pypi.org/pypi/aider-chat/json")
         data = response.json()
         latest_version = data["info"]["version"]
         current_version = aider.__version__

-        if packaging.version.parse(latest_version) <= packaging.version.parse(current_version):
-            return
+        is_update_available = packaging.version.parse(latest_version) > packaging.version.parse(current_version)

-        print_cmd(f"Newer version v{latest_version} is available. To upgrade, run:")
-        py = sys.executable
-        print_cmd(f"{py} -m pip install --upgrade aider-chat")
+        if is_update_available:
+            print_cmd(f"Newer version v{latest_version} is available. To upgrade, run:")
+            py = sys.executable
+            print_cmd(f"{py} -m pip install --upgrade aider-chat")
+
+        return is_update_available
     except Exception as err:
         print_cmd(f"Error checking pypi for new version: {err}")
+        return False

--- aider/main.py
+++ aider/main.py
@@ ... @@
     other_group.add_argument(
         "--version",
         action="version",
         version=f"%(prog)s {__version__}",
         help="Show the version number and exit",
     )
+    other_group.add_argument(
+        "--check-update",
+        action="store_true",
+        help="Check for updates and return status in the exit code",
+        default=False,
+    )
     other_group.add_argument(
         "--apply",
         metavar="FILE",
@@ ... @@
     check_version(io.tool_error)

+    if args.check_update:
+        update_available = check_version(lambda msg: None)
+        sys.exit(0 if not update_available else 1)
+
     if "VSCODE_GIT_IPC_HANDLE" in os.environ:
         args.pretty = False
         io.tool_output("VSCode terminal detected, pretty output has been disabled.")
```

These changes will add the `--check-update` option to the command-line interface and use the `check_version` function to determine if an update is available, exiting with status code `0` if no update is available and `1` if an update is available.

USER: UnifiedDiffNoMatch: hunk failed to apply!

aider/versioncheck.py does not contain lines that match the diff you provided!
Try again.
DO NOT skip blank lines, comments, docstrings, etc!
The diff needs to apply cleanly to the lines in aider/versioncheck.py!

aider/versioncheck.py does not contain these 17 exact lines in a row:
```
def check_version(print_cmd):
    try:
        response = requests.get("https://pypi.org/pypi/aider-chat/json")
        data = response.json()
        latest_version = data["info"]["version"]
        current_version = aider.__version__

        if packaging.version.parse(latest_version) <= packaging.version.parse(current_version):
            return

        print_cmd(f"Newer version v{latest_version} is available. To upgrade, run:")
        py = sys.executable
        print_cmd(f"{py} -m pip install --upgrade aider-chat")
    except Exception as err:
        print_cmd(f"Error checking pypi for new version: {err}")

-- aider/main.py
```

UnifiedDiffNoMatch: hunk failed to apply!

aider/versioncheck.py does not contain lines that match the diff you provided!
Try again.
DO NOT skip blank lines, comments, docstrings, etc!
The diff needs to apply cleanly to the lines in aider/versioncheck.py!

aider/versioncheck.py does not contain these 9 exact lines in a row:
```
    other_group.add_argument(
        "--version",
        action="version",
        version=f"%(prog)s {__version__}",
        help="Show the version number and exit",
    )
    other_group.add_argument(
        "--apply",
        metavar="FILE",
```

UnifiedDiffNoMatch: hunk failed to apply!

aider/versioncheck.py does not contain lines that match the diff you provided!
Try again.
DO NOT skip blank lines, comments, docstrings, etc!
The diff needs to apply cleanly to the lines in aider/versioncheck.py!

aider/versioncheck.py does not contain these 5 exact lines in a row:
```
    check_version(io.tool_error)

    if "VSCODE_GIT_IPC_HANDLE" in os.environ:
        args.pretty = False
        io.tool_output("VSCode terminal detected, pretty output has been disabled.")
```

ASSISTANT: I apologize for the confusion. Let's try again with the correct diffs.

Here are the diffs for the changes to `aider/versioncheck.py` and `aider/main.py`:

```diff
--- aider/versioncheck.py
+++ aider/versioncheck.py
@@ ... @@
 import sys

 import packaging.version
 import requests

 import aider

 def check_version(print_cmd):
     try:
         response = requests.get("https://pypi.org/pypi/aider-chat/json")
         data = response.json()
         latest_version = data["info"]["version"]
         current_version = aider.__version__

-        if packaging.version.parse(latest_version) <= packaging.version.parse(current_version):
-            return
+        is_update_available = packaging.version.parse(latest_version) > packaging.version.parse(current_version)

-        print_cmd(f"Newer version v{latest_version} is available. To upgrade, run:")
-        py = sys.executable
-        print_cmd(f"{py} -m pip install --upgrade aider-chat")
+        if is_update_available:
+            print_cmd(f"Newer version v{latest_version} is available. To upgrade, run:")
+            py = sys.executable
+            print_cmd(f"{py} -m pip install --upgrade aider-chat")
+
+        return is_update_available
     except Exception as err:
         print_cmd(f"Error checking pypi for new version: {err}")
+        return False
```

```diff
--- aider/main.py
+++ aider/main.py
@@ ... @@
     other_group.add_argument(
         "--version",
         action="version",
         version=f"%(prog)s {__version__}",
         help="Show the version number and exit",
     )
+    other_group.add_argument(
+        "--check-update",
+        action="store_true",
+        help="Check for updates and return status in the exit code",
+        default=False,
+    )
     other_group.add_argument(
         "--apply",
         metavar="FILE",
@@ ... @@
     check_version(io.tool_error)

+    if args.check_update:
+        update_available = check_version(lambda msg: None)
+        sys.exit(0 if not update_available else 1)
+
     if "VSCODE_GIT_IPC_HANDLE" in os.environ:
         args.pretty = False
         io.tool_output("VSCode terminal detected, pretty output has been disabled.")
```

These diffs should apply cleanly to the current contents of the files. The `check_version` function in `aider/versioncheck.py` now returns a boolean indicating whether an update is available, and `aider/main.py` has been updated to include the `--check-update` argument and to use the return value from `check_version` to set the exit status code.
2024-01-04 12:27:31 -08:00
Paul Gauthier
79ae43cb59 make udiff more clear when some hunks did apply 2024-01-04 12:23:19 -08:00
paul-gauthier
c7f520129f
Merge pull request #431 from paul-gauthier/py12
Bump all dependencies, to pick up py-tree-sitter-languages 1.9.1 with python 3.12 support
2024-01-04 08:32:46 -08:00
Paul Gauthier
f0f28af98b updated install docs 2024-01-04 08:29:25 -08:00
Paul Gauthier
5c9bd4d405 Bump all dependencies, to pick up py-tree-sitter-languages 1.9.1 with py12 support 2024-01-04 07:48:00 -08:00
Paul Gauthier
ca0ef601c6 set version to 0.20.1-dev 2024-01-04 07:43:35 -08:00
Paul Gauthier
e5ff5ac7f0 version bump to 0.20.0 2024-01-04 07:43:02 -08:00
Paul Gauthier
c5e62e5e30 Updated HISTORY 2024-01-04 07:41:50 -08:00
Paul Gauthier
2918edc38e Updated HISTORY 2024-01-04 07:40:33 -08:00
Paul Gauthier
f37488447f handle RecursionError 2024-01-02 10:12:44 -08:00
Paul Gauthier
cc3da03a0b add helpful warnings on launch 2024-01-02 09:58:50 -08:00
Paul Gauthier
a279adc5fc Update output to include number of files in git repo with comma separator. 2024-01-02 09:50:52 -08:00
Paul Gauthier
0371b0f58b try and make windows tests happy 2024-01-02 09:44:47 -08:00
Paul Gauthier
369d746f2f added assistant:ok turn after image message 2024-01-02 09:40:03 -08:00
paul-gauthier
2824acb5c2
Merge pull request #379 from joshuavial/gpt4-vision
add support for gpt-4-vision
2024-01-02 13:37:17 -04:00
Paul Gauthier
2241741316 dirty commits shouldn't move back the messages; was clipping the earlier USER: messages and preventing them from appearing in the commit message transcript 2024-01-02 09:23:00 -08:00
Paul Gauthier
e09a2033e2 Refactored the cmd_undo method to handle dirty files not in the last commit. 2024-01-02 09:04:57 -08:00
Paul Gauthier
695299be3d aider: Update changed_files_last_commit to diff against the prior commit instead of the working directory.
# Aider chat conversation:

ASSISTANT: Here is the diff to update the `changed_files_last_commit` to diff against the prior commit:

```diff
--- aider/commands.py
+++ aider/commands.py
@@ ... @@
     def cmd_undo(self, args):
         "Undo the last git commit if it was done by aider"
         if not self.coder.repo:
             self.io.tool_error("No git repository found.")
             return

         last_commit = self.coder.repo.repo.head.commit
-        changed_files_last_commit = {item.a_path for item in last_commit.diff(None)}
+        changed_files_last_commit = {item.a_path for item in last_commit.diff(last_commit.parents[0])}
         dirty_files = [item.a_path for item in self.coder.repo.repo.index.diff(None)]
         dirty_files_in_last_commit = changed_files_last_commit.intersection(dirty_files)
         dump(changed_files_last_commit)
         dump(dirty_files)
         dump(dirty_files_in_last_commit)

         if dirty_files_in_last_commit:
             self.io.tool_error(
                 "The repository has uncommitted changes in files that were modified in the last commit. "
                 "Please commit or stash them before undoing."
             )
             return
@@ ... @@
```

This change will ensure that `changed_files_last_commit` contains the files that were changed in the last commit by comparing it to its parent commit, rather than comparing it to the working directory.
2024-01-02 09:04:44 -08:00
Paul Gauthier
34c4331110 Refactor dirty_files to only include indexed changes. 2024-01-02 09:04:42 -08:00