Commit graph

10395 commits

Author SHA1 Message Date
Paul Gauthier
f344d26b3d copy 2023-05-14 21:45:34 -07:00
Paul Gauthier
aafd9f519d copy 2023-05-14 21:44:29 -07:00
Paul Gauthier
a31a29bca6 copy 2023-05-14 21:44:12 -07:00
Paul Gauthier
3923aab5f0 copy 2023-05-14 21:40:16 -07:00
Paul Gauthier
44a5cabf85 copy 2023-05-14 21:38:19 -07:00
Paul Gauthier
d66c11ad99 copy 2023-05-14 21:34:46 -07:00
Paul Gauthier
d23c5e29ec copy 2023-05-14 21:33:37 -07:00
Paul Gauthier
1c1cbed33b copy 2023-05-14 21:32:55 -07:00
Paul Gauthier
6f6a3a9dd6 aider: Added screenshot to README.md.
# Context:
USER: add the screenshot at below the 1st para of the readme
ASSISTANT: ```markdown
README.md
<<<<<<< ORIGINAL
`aider` is a command-line tool that allows you to chat with GPT-4 about your code.
Ask GPT for features, improvements, or bug fixes and `aider` will directly apply the suggested changes to your source files.
Each change is automatically committed to git with a descriptive commit message.
=======
`aider` is a command-line tool that allows you to chat with GPT-4 about your code.
Ask GPT for features, improvements, or bug fixes and `aider` will directly apply the suggested changes to your source files.
Each change is automatically committed to git with a descriptive commit message.

![aider screenshot](screenshot.png)
>>>>>>> UPDATED
```
I've added the screenshot below the first paragraph in the README.md file.
2023-05-14 21:26:04 -07:00
Paul Gauthier
2473c40d71 initial 2023-05-14 21:25:17 -07:00
Paul Gauthier
75e1355887 copy 2023-05-14 21:17:00 -07:00
Paul Gauthier
e0500046f7 copy 2023-05-14 21:15:35 -07:00
Paul Gauthier
bf73c71659 copy 2023-05-14 21:14:45 -07:00
Paul Gauthier
481c5f879f copy 2023-05-14 21:12:21 -07:00
Paul Gauthier
c28543debd copy 2023-05-14 21:11:09 -07:00
Paul Gauthier
5ad7253e2a fixed urls 2023-05-14 21:09:59 -07:00
Paul Gauthier
5f99edd4d6 initial 2023-05-14 21:08:30 -07:00
paul-gauthier
c2fd7c4438
Update _config.yml 2023-05-14 19:52:33 -07:00
paul-gauthier
9da6e39b54
Update _config.yml 2023-05-14 19:14:52 -07:00
paul-gauthier
be35cace6d
Update _config.yml 2023-05-14 19:13:00 -07:00
Paul Gauthier
0c83a2b218 copy 2023-05-14 16:48:10 -07:00
Paul Gauthier
9969641a69 copy 2023-05-14 16:45:57 -07:00
Paul Gauthier
2081711660 initial 2023-05-14 16:39:56 -07:00
Paul Gauthier
8c2d01b0b3 copy 2023-05-14 16:21:50 -07:00
Paul Gauthier
967607aba4 copy 2023-05-14 16:21:34 -07:00
Paul Gauthier
6a456cbfd5 copy 2023-05-14 15:13:19 -07:00
Paul Gauthier
bb596db9e4 copy 2023-05-14 15:11:48 -07:00
Paul Gauthier
37a4c47282 Refactor apply_updates method to return edit_error instead of err. 2023-05-14 15:01:50 -07:00
Paul Gauthier
28533ad23e aider: Refactored try/except block around self.update_files() call into a new method called apply_updates(). 2023-05-14 14:57:57 -07:00
Paul Gauthier
3374ae19be wip: Changed prompt messages to use proper grammar and formatting. 2023-05-14 14:54:55 -07:00
Paul Gauthier
ddc8fa6f0b Merge branch 'main' into dotdotdot 2023-05-14 14:50:36 -07:00
Paul Gauthier
c1242bd961 copy 2023-05-14 14:47:56 -07:00
Paul Gauthier
fc7eecdc44 copy 2023-05-14 14:41:17 -07:00
Paul Gauthier
90f9c53480 copy 2023-05-14 14:33:01 -07:00
Paul Gauthier
451f257573 copy 2023-05-14 14:32:12 -07:00
Paul Gauthier
f4cdbbf2e3 copy 2023-05-14 14:25:31 -07:00
Paul Gauthier
7b4c9079c3 copy 2023-05-14 14:24:27 -07:00
Paul Gauthier
5bc835cb31 copy 2023-05-14 14:23:17 -07:00
Paul Gauthier
0c05e3d957 Handle case where part="" and replace is non-empty 2023-05-14 11:07:22 -07:00
Paul Gauthier
e9debe71e8 Attempt to honot edit blocks which elide content using ... 2023-05-14 11:00:45 -07:00
Paul Gauthier
ed138d1940 changed output if dryrun 2023-05-14 10:16:43 -07:00
Paul Gauthier
ab68022fb9 wip: Added a dry-run option to do_replace function. 2023-05-14 10:15:08 -07:00
Paul Gauthier
0b8690654e aider: Added dry_run parameter to do_replace function and passed it from Coder class.
# Context:
USER: pass dry run into do_replace and only write to the file if false
ASSISTANT: To implement this change, we need to modify the `do_replace` function in the `aider/utils.py` file. We will add a new parameter `dry_run` to the function and only write to the file if `dry_run` is `False`.

Here's the change:

```python
aider/utils.py
<<<<<<< ORIGINAL
def do_replace(fname, before_text, after_text):
=======
def do_replace(fname, before_text, after_text, dry_run=False):
>>>>>>> UPDATED
    before_text = strip_quoted_wrapping(before_text, fname)
    after_text = strip_quoted_wrapping(after_text, fname)
    fname = Path(fname)

    # does it want to make a new file?
    if not fname.exists() and not before_text.strip():
        fname.touch()

    content = fname.read_text()

    if not before_text.strip():
        if content:
            new_content = content + after_text
        else:
            # first populating an empty file
            new_content = after_text
    else:
        new_content = replace_most_similar_chunk(content, before_text, after_text)
        if not new_content:
            return

    if not dry_run:
        fname.write_text(new_content)
    return True
```

Now, you need to pass the `dry_run` parameter from the `Coder` class in the `aider/coder.py` file to the `do_replace` function. Here's the change:

```python
aider/coder.py
<<<<<<< ORIGINAL
if utils.do_replace(full_path, original, updated):
=======
if utils.do_replace(full_path, original, updated, self.dry_run):
>>>>>>> UPDATED
    self.io.tool(f"Applied edit to {path}")
else:
    self.io.tool_error(f"Failed to apply edit to {path}")
```

These changes will ensure that the file is only written to when `dry_run` is `False`.
2023-05-14 10:14:20 -07:00
Paul Gauthier
a8acca9366 aider: Added a --dry-run argument to the main.py file and passed it to the Coder class, setting the self.dry_run attribute in the Coder class.
# Context:
USER: add a --dry-run arg, no env, default false. pass it into Coder and set self.dry_run
ASSISTANT: I will add a `--dry-run` argument to the `main.py` file and pass it to the `Coder` class. Then, I will set the `self.dry_run` attribute in the `Coder` class.

Here are the changes:

```python
aider/main.py
<<<<<<< ORIGINAL
    parser.add_argument(
        "--show-diffs",
        action="store_true",
        help=f"Show diffs when committing changes (default: False, ${env_prefix}SHOW_DIFFS)",
        default=bool(int(os.environ.get(f"{env_prefix}SHOW_DIFFS", 0))),
    )
=======
    parser.add_argument(
        "--dry-run",
        action="store_true",
        help="Perform a dry run without applying changes (default: False)",
        default=False,
    )
    parser.add_argument(
        "--show-diffs",
        action="store_true",
        help=f"Show diffs when committing changes (default: False, ${env_prefix}SHOW_DIFFS)",
        default=bool(int(os.environ.get(f"{env_prefix}SHOW_DIFFS", 0))),
    )
>>>>>>> UPDATED
```

```python
aider/main.py
<<<<<<< ORIGINAL
    io = InputOutput(
        args.pretty,
        args.yes,
        args.input_history_file,
        args.chat_history_file,
        input=input,
        output=output,
    )

    coder = Coder(
        args.model,
        fnames,
        pretty,
        args.show_diffs,
        args.auto_commits,
        io,
    )
=======
    io = InputOutput(
        args.pretty,
        args.yes,
        args.input_history_file,
        args.chat_history_file,
        input=input,
        output=output,
    )

    coder = Coder(
        args.model,
        fnames,
        pretty,
        args.show_diffs,
        args.auto_commits,
        io,
        args.dry_run,
    )
>>>>>>> UPDATED
```

```python
aider/coder.py
<<<<<<< ORIGINAL
    def __init__(self, main_model, fnames, pretty, show_diffs, auto_commits, io):
        self.abs_fnames = set()

        self.io = io

        self.auto_commits = auto_commits
=======
    def __init__(self, main_model, fnames, pretty, show_diffs, auto_commits, io, dry_run):
        self.abs_fnames = set()

        self.io = io

        self.auto_commits = auto_commits
        self.dry_run = dry_run
>>>>>>> UPDATED
```

Please review the changes and let me know if you need any further modifications.
2023-05-14 10:06:16 -07:00
Paul Gauthier
708653290f Creating empty file 2023-05-14 09:09:37 -07:00
Paul Gauthier
3f26a3ec05 main prompt in normal mixed case 2023-05-14 08:19:32 -07:00
Paul Gauthier
70ea500783 improved --no-auto-commits support 2023-05-14 07:37:04 -07:00
Paul Gauthier
78b1296e0e Added auto_commit method to Coder class. 2023-05-14 07:23:20 -07:00
Paul Gauthier
57fff7f360 copy 2023-05-14 07:12:01 -07:00
Paul Gauthier
d55f8a94e3 Changed the name of the project to "aider". 2023-05-14 07:02:32 -07:00