Commit graph

2367 commits

Author SHA1 Message Date
Paul Gauthier
c3045ddfef copy 2023-07-13 10:52:12 -07:00
Paul Gauthier
b09c95c9c6 added hello aider example 2023-07-13 10:46:49 -07:00
Paul Gauthier
6ab4f09a3a cleanup --show-repo-map 2023-07-13 10:06:46 -07:00
Paul Gauthier
041c19b7dd show universal ctags output 2023-07-13 10:03:01 -07:00
Paul Gauthier
f78977cd5b finished --show-repo-map 2023-07-12 13:46:27 -07:00
Paul Gauthier
a10b08e8de aider: Add --show-map option to print the repo map and then exit.
# Aider chat conversation:

USER: add --show-map which will just print the repomap and then exit

ASSISTANT: To add the `--show-map` option, we need to modify the `aider/main.py` file. We will add a new argument to the argument parser and then use this argument to conditionally print the repo map and exit.

Here are the changes:

```python
aider/main.py
<<<<<<< ORIGINAL
    ##########
    other_group = parser.add_argument_group("Other Settings")
    other_group.add_argument(
        "--version",
        action="version",
        version=f"%(prog)s {__version__}",
        help="Show the version number and exit",
    )
=======
    ##########
    other_group = parser.add_argument_group("Other Settings")
    other_group.add_argument(
        "--show-map",
        action="store_true",
        help="Print the repo map and exit",
        default=False,
    )
    other_group.add_argument(
        "--version",
        action="version",
        version=f"%(prog)s {__version__}",
        help="Show the version number and exit",
    )
>>>>>>> UPDATED
```

```python
aider/main.py
<<<<<<< ORIGINAL
    coder = Coder.create(
        main_model,
        args.edit_format,
        io,
        ##
        fnames=args.files,
        pretty=args.pretty,
        show_diffs=args.show_diffs,
        auto_commits=args.auto_commits,
        dirty_commits=args.dirty_commits,
        dry_run=args.dry_run,
        map_tokens=args.map_tokens,
        verbose=args.verbose,
        assistant_output_color=args.assistant_output_color,
        code_theme=args.code_theme,
        stream=args.stream,
        use_git=args.git,
    )
=======
    if args.show_map:
        repo_map = RepoMap(map_tokens=args.map_tokens, root=git_root, main_model=main_model, io=io, verbose=args.verbose)
        print(repo_map)
        sys.exit(0)
    else:
        coder = Coder.create(
            main_model,
            args.edit_format,
            io,
            ##
            fnames=args.files,
            pretty=args.pretty,
            show_diffs=args.show_diffs,
            auto_commits=args.auto_commits,
            dirty_commits=args.dirty_commits,
            dry_run=args.dry_run,
            map_tokens=args.map_tokens,
            verbose=args.verbose,
            assistant_output_color=args.assistant_output_color,
            code_theme=args.code_theme,
            stream=args.stream,
            use_git=args.git,
        )
>>>>>>> UPDATED
```

Please note that the `RepoMap` class is used to create the repo map. If the `--show-map` option is used, the repo map is printed and the program exits. If not, the program continues as before.
2023-07-12 13:40:10 -07:00
Paul Gauthier
e3aa9db5a2 Updated HISTORY 2023-07-12 07:34:24 -07:00
paul-gauthier
549a1a7640
Merge pull request #88 from paul-gauthier/azure
Added args to configure openai module to access Azure
2023-07-12 07:32:10 -07:00
Paul Gauthier
ec65822369 copy 2023-07-12 06:39:13 -07:00
Paul Gauthier
7f8ab9c895 Merge remote-tracking branch 'origin/main' 2023-07-12 06:38:07 -07:00
paul-gauthier
789909bdea
Update faq.md 2023-07-11 19:17:39 -07:00
Paul Gauthier
1f3fc8481d Updated HISTORY 2023-07-11 18:50:09 -07:00
Paul Gauthier
d5497dcf27 set version to 0.8.3-dev 2023-07-11 18:48:15 -07:00
Paul Gauthier
a70ffddacc version bump to 0.8.3 2023-07-11 18:48:02 -07:00
Paul Gauthier
bb183e2e4e copy 2023-07-11 18:46:15 -07:00
Paul Gauthier
63124a56e9 Updated HISTORY 2023-07-11 18:45:56 -07:00
Paul Gauthier
c54740c617 Show version on startup 2023-07-11 18:44:28 -07:00
Paul Gauthier
aab636f4e9 print 2023-07-11 18:42:27 -07:00
Paul Gauthier
410769ba9b cleanup 2023-07-11 18:41:46 -07:00
Paul Gauthier
86a418d899 print even when dry_run 2023-07-11 18:38:52 -07:00
Paul Gauthier
cace9675b0 aider: The current version is now parsed and the "-dev" suffix is ignored.
# Aider chat conversation:

USER: we need to parse `current_version` and ignore the -dev if it is present

ASSISTANT: To implement this, we need to modify the `scripts/versionbump.py` file.

Here is the proposed change:

```python
scripts/versionbump.py
<<<<<<< ORIGINAL
    current_version = re.search(r'__version__ = "(.+?)"', content).group(1)
    if new_version <= version.parse(current_version):
        raise ValueError(
            f"New version {new_version} must be greater than the current version {current_version}"
        )
=======
    current_version = re.search(r'__version__ = "(.+?)"', content).group(1).split('-dev')[0]
    if new_version <= version.parse(current_version):
        raise ValueError(
            f"New version {new_version} must be greater than the current version {current_version}"
        )
>>>>>>> UPDATED
```

This change will ensure that the '-dev' suffix is discarded when parsing the `current_version`.
2023-07-11 18:36:54 -07:00
Paul Gauthier
54939d5f6c aider: Set version to x.y.z-dev and push to origin.
# Aider chat conversation:

USER: I did `git reset --hard HEAD~1` to discard the last edits.

ASSISTANT: Okay, that command will undo the last commit and discard the changes. If you need to make any further changes or need assistance with anything else, feel free to ask.

USER: we need to commit __init__ with x.y.z, tag it, push it. and THEN write a new __init__ with the -dev version, and then commit that.

ASSISTANT: Understood. We need to modify the `scripts/versionbump.py` file to implement this.

Here are the proposed changes:

```python
scripts/versionbump.py
<<<<<<< ORIGINAL
    updated_content = re.sub(r'__version__ = ".+?"', f'__version__ = "{new_version}"', content)

    if dry_run:
        print("Updating aider/__init__.py with new version:")
        print(updated_content)
    else:
        with open("aider/__init__.py", "w") as f:
            f.write(updated_content)

    git_commands = [
        ["git", "add", "aider/__init__.py"],
        ["git", "commit", "-m", f"version bump to {new_version}"],
        ["git", "tag", f"v{new_version}"],
        ["git", "push", "origin"],
        ["git", "push", "origin", f"v{new_version}"],
    ]
=======
    updated_content = re.sub(r'__version__ = ".+?"', f'__version__ = "{new_version}"', content)

    if dry_run:
        print("Updating aider/__init__.py with new version:")
        print(updated_content)
    else:
        with open("aider/__init__.py", "w") as f:
            f.write(updated_content)

    git_commands = [
        ["git", "add", "aider/__init__.py"],
        ["git", "commit", "-m", f"version bump to {new_version}"],
        ["git", "tag", f"v{new_version}"],
        ["git", "push", "origin"],
        ["git", "push", "origin", f"v{new_version}"],
    ]

    for cmd in git_commands:
        if dry_run:
            print(f"Running: {' '.join(cmd)}")
        else:
            subprocess.run(cmd, check=True)

    updated_dev_content = re.sub(r'__version__ = ".+?"', f'__version__ = "{new_version}-dev"', content)

    if dry_run:
        print("Updating aider/__init__.py with new dev version:")
        print(updated_dev_content)
    else:
        with open("aider/__init__.py", "w") as f:
            f.write(updated_dev_content)

    git_commands_dev = [
        ["git", "add", "aider/__init__.py"],
        ["git", "commit", "-m", f"set version to {new_version}-dev"],
        ["git", "push", "origin"],
    ]

    for cmd in git_commands_dev:
        if dry_run:
            print(f"Running: {' '.join(cmd)}")
        else:
            subprocess.run(cmd, check=True)
>>>>>>> UPDATED
```

These changes will ensure that the version in `aider/__init__.py` is set to 'x.y.z', committed, tagged, and pushed. Then, it will be updated to 'x.y.z-dev', committed, and pushed.
2023-07-11 18:36:02 -07:00
Paul Gauthier
2a595afca9 Updated FAQ 2023-07-11 15:24:58 -07:00
Paul Gauthier
f6be208d77 updated tests 2023-07-11 15:17:00 -07:00
Paul Gauthier
bcdf8968f1 updated tests 2023-07-11 15:15:56 -07:00
Paul Gauthier
2190435780 updated tests 2023-07-11 15:15:26 -07:00
Paul Gauthier
d97707a5c0 Added --openai-api-engine 2023-07-11 15:11:35 -07:00
Paul Gauthier
084132a5f8 refactor initialization of openai into main 2023-07-11 15:06:50 -07:00
Paul Gauthier
fa3283802a aider: Add --openai-api-type, --openai-api-version, and openai-api-deployment-id args, pass them into coder.create.
# Aider chat conversation:

USER: add --openai-api-type --openai-api-version and openai-api-deployment-id args. pass them into coder.create

ASSISTANT: To add the `--openai-api-type`, `--openai-api-version`, and `--openai-api-deployment-id` arguments and pass them into `coder.create`, we need to modify the `aider/main.py` file.

Here are the steps:

1. Add the new arguments to the argument parser in the `main` function.
2. Pass these arguments to the `coder.create` function.

Here are the changes:

```python
aider/main.py
<<<<<<< ORIGINAL
    ##########
    model_group = parser.add_argument_group("Advanced Model Settings")
    model_group.add_argument(
        "--openai-api-base",
        metavar="OPENAI_API_BASE",
        default="https://api.openai.com/v1",
        help="Specify the OpenAI API base endpoint (default: https://api.openai.com/v1)",
    )
=======
    ##########
    model_group = parser.add_argument_group("Advanced Model Settings")
    model_group.add_argument(
        "--openai-api-base",
        metavar="OPENAI_API_BASE",
        default="https://api.openai.com/v1",
        help="Specify the OpenAI API base endpoint (default: https://api.openai.com/v1)",
    )
    model_group.add_argument(
        "--openai-api-type",
        metavar="OPENAI_API_TYPE",
        help="Specify the OpenAI API type",
    )
    model_group.add_argument(
        "--openai-api-version",
        metavar="OPENAI_API_VERSION",
        help="Specify the OpenAI API version",
    )
    model_group.add_argument(
        "--openai-api-deployment-id",
        metavar="OPENAI_API_DEPLOYMENT_ID",
        help="Specify the OpenAI API deployment ID",
    )
>>>>>>> UPDATED
```

```python
aider/main.py
<<<<<<< ORIGINAL
    coder = Coder.create(
        main_model,
        args.edit_format,
        io,
        args.openai_api_key,
        args.openai_api_base,
        ##
        fnames=args.files,
        pretty=args.pretty,
        show_diffs=args.show_diffs,
        auto_commits=args.auto_commits,
        dirty_commits=args.dirty_commits,
        dry_run=args.dry_run,
        map_tokens=args.map_tokens,
        verbose=args.verbose,
        assistant_output_color=args.assistant_output_color,
        code_theme=args.code_theme,
        stream=args.stream,
        use_git=args.git,
    )
=======
    coder = Coder.create(
        main_model,
        args.edit_format,
        io,
        args.openai_api_key,
        args.openai_api_base,
        ##
        fnames=args.files,
        pretty=args.pretty,
        show_diffs=args.show_diffs,
        auto_commits=args.auto_commits,
        dirty_commits=args.dirty_commits,
        dry_run=args.dry_run,
        map_tokens=args.map_tokens,
        verbose=args.verbose,
        assistant_output_color=args.assistant_output_color,
        code_theme=args.code_theme,
        stream=args.stream,
        use_git=args.git,
        openai_api_type=args.openai_api_type,
        openai_api_version=args.openai_api_version,
        openai_api_deployment_id=args.openai_api_deployment_id,
    )
>>>>>>> UPDATED
```

Please note that these changes assume that the `Coder.create` method and the `Coder` class are prepared to receive and handle these new arguments. If they are not, additional changes will be needed in the `Coder` class and its subclasses.
2023-07-11 14:56:36 -07:00
Paul Gauthier
967cb1bd8d notify when preparing dirty commit; skip if /exit or /commit is input 2023-07-11 13:21:36 -07:00
Paul Gauthier
fde537cd7f aider: Fix regular expression in setup.py to remove all links, not just the internal anchor links.
# Aider chat conversation:

USER: the regex in `setup.py` is supposed to remove the list of links that appears right below the image in README. but it doesn't remove the links to aider.chat urls, just the internal anchor links. fix that.

ASSISTANT: To fix the regular expression in `setup.py` to remove all links, not just the internal anchor links, we need to modify the `setup.py` file.

Here's the change:

```python
setup.py
<<<<<<< ORIGINAL
    long_description = re.sub(r"\n!\[.*\]\(.*\)", "", long_description)
    long_description = re.sub(r"\n- \[.*\]\(#.*\)", "", long_description)
=======
    long_description = re.sub(r"\n!\[.*\]\(.*\)", "", long_description)
    long_description = re.sub(r"\n- \[.*\]\(.*\)", "", long_description)
>>>>>>> UPDATED
```

This change will ensure that all links, including those to `aider.chat` URLs, are removed from the `long_description`.
2023-07-11 13:08:10 -07:00
Paul Gauthier
9e143a1264 copy 2023-07-11 13:05:36 -07:00
Paul Gauthier
46686e6b0e copy 2023-07-11 12:59:14 -07:00
Paul Gauthier
d24256db60 copy 2023-07-11 12:57:07 -07:00
Paul Gauthier
490aaf55ce copy 2023-07-11 12:56:24 -07:00
Paul Gauthier
d984b1ceee copy 2023-07-11 12:53:47 -07:00
Paul Gauthier
12009688ee copy 2023-07-11 12:53:29 -07:00
Paul Gauthier
e0fdf6ce24 copy 2023-07-11 12:52:20 -07:00
Paul Gauthier
ceb84b2cdd broke out instructions, added link to neovim #84 2023-07-11 12:47:35 -07:00
paul-gauthier
7e17059b59
Merge pull request #81 from paul-gauthier/issue-73
Prioritize how to allocate code blocks to filenames in wholefile
2023-07-11 09:44:33 -07:00
Paul Gauthier
d22b1dfb32 small improvement to test 2023-07-11 09:40:54 -07:00
Paul Gauthier
1f83a89192 Merge branch 'main' into issue-73 2023-07-11 09:36:34 -07:00
paul-gauthier
36625abb71
Merge pull request #85 from paul-gauthier/issue-82
Tell git not to quote filenames in ls-files, to handle unicode filenames
2023-07-11 09:31:51 -07:00
Paul Gauthier
3294479c31 Updated HISTORY 2023-07-11 09:24:45 -07:00
Paul Gauthier
c638d305b0 Merge branch 'main' into issue-82 2023-07-11 09:24:09 -07:00
Paul Gauthier
3e3694b38a aider: Set the git user name and email in the get_tracked_files test.
# Aider chat conversation:

USER: set the git user name and email in the `get_tracked_files` test

ASSISTANT: To set the git user name and email in the `get_tracked_files` test, we need to modify the `tests/test_coder.py` file. We will add two lines of code to set the git user name and email after initializing the git repository.

Here is the change:

```python
tests/test_coder.py
<<<<<<< ORIGINAL
        # Initialize a git repository in the temporary directory
        repo = git.Repo.init(tempdir)
=======
        # Initialize a git repository in the temporary directory and set user name and email
        repo = git.Repo.init(tempdir)
        repo.config_writer().set_value("user", "name", "Test User").release()
        repo.config_writer().set_value("user", "email", "testuser@example.com").release()
>>>>>>> UPDATED
```

This change sets the git user name to "Test User" and the email to "testuser@example.com".
2023-07-11 09:20:50 -07:00
Paul Gauthier
8d5f17898a test subdirs too 2023-07-11 09:17:55 -07:00
Paul Gauthier
cccd0d1ebe Make the tests run on windows; added test for files with quotes 2023-07-11 09:15:21 -07:00
Paul Gauthier
68c26a60ef get tracked files by traversing the tree 2023-07-11 09:08:37 -07:00
Paul Gauthier
606a36a273 copy 2023-07-11 08:44:13 -07:00