Commit graph

270 commits

Author SHA1 Message Date
Paul Gauthier (aider)
bcc7b4c120 style: Apply consistent string formatting in io.py 2024-08-21 05:17:23 -07:00
Paul Gauthier (aider)
4537e1a9f5 feat: Add shell command to input history before execution 2024-08-21 05:17:18 -07:00
Paul Gauthier
543fa68b45 fix: Use Text() to format user input in console.print() 2024-08-11 10:09:36 -07:00
Paul Gauthier
9cf672b428 fix: Add bold formatting to announcement messages
feat: Add bold formatting to commit message output
refactor: Simplify tool_output method in io.py
2024-08-09 19:26:22 -04:00
Paul Gauthier (aider)
416fd164d8 fix: Handle None value for abs_read_only_fnames in AutoCompleter 2024-08-09 18:47:21 -04:00
Paul Gauthier (aider)
31606d5d70 style: Apply linter formatting to io.py 2024-08-09 18:46:53 -04:00
Paul Gauthier (aider)
26698488d3 feat: make abs_read_only_fnames optional in get_input 2024-08-09 18:46:49 -04:00
Paul Gauthier (aider)
f542c65b58 feat: make abs_read_only_fnames an optional param in AutoCompleter class 2024-08-09 18:45:57 -04:00
Paul Gauthier (aider)
ac4c339904 style: Format AutoCompleter class constructor 2024-08-09 18:39:35 -04:00
Paul Gauthier (aider)
f77c6719fe feat: Add abs_read_only_fnames to io.get_input() and AutoCompleter 2024-08-09 18:39:31 -04:00
Paul Gauthier
e984d9cd66 fix: Add abs_read_only_fnames parameter to AutoCompleter and get_input 2024-08-09 18:39:29 -04:00
Paul Gauthier (aider)
c1ef85640f fix: Remove unused confirm import from prompt_toolkit.shortcuts 2024-08-09 17:35:18 -04:00
Paul Gauthier (aider)
4e01668054 feat: replace confirm() with prompt() in confirm_ask method 2024-08-09 17:35:07 -04:00
Paul Gauthier
51ec18b711 fix: Replace prompt with confirm for yes/no questions 2024-08-08 15:35:35 -03:00
Paul Gauthier
c67d10749c fix: Remove unused spinner method from InputOutput class 2024-08-05 19:31:54 -03:00
Paul Gauthier (aider)
f8d161382e style: Format code with linter 2024-08-05 19:31:21 -03:00
Paul Gauthier (aider)
b1003949c0 fix: Remove unused imports and fix undefined Spinner issue in aider/io.py 2024-08-05 19:31:18 -03:00
Paul Gauthier (aider)
d3a9247b3c style: Apply linter formatting to aider/io.py 2024-08-05 19:31:06 -03:00
Paul Gauthier (aider)
30b2460a7a feat: Move Spinner class to utils.py 2024-08-05 19:31:03 -03:00
Paul Gauthier
c2254001b5 fix: Remove unused Spinner class
diff --git a/aider/io.py b/aider/io.py
index ea4d25d0..d4d4d4d0 100644
--- a/aider/io.py
+++ b/aider/io.py
@@ -420,4 +420,4 @@ class InputOutput:
                 f.write(text)

     def spinner(self, text):
-        return Spinner(text)
+        return Spinner(self, text)
2024-08-05 19:31:01 -03:00
Paul Gauthier
49874cb8a1 fix: Improve spinner behavior 2024-08-05 19:30:40 -03:00
Paul Gauthier (aider)
168a1d070d feat: add delay before showing spinner and text 2024-08-05 17:44:30 -03:00
Paul Gauthier
c160a5fa65 show progress of the repo map 2024-08-05 17:39:21 -03:00
Paul Gauthier (aider)
249c85e20f fix: Replace dump('end') with traceback.print_stack() in Spinner.end() 2024-08-05 17:37:38 -03:00
Paul Gauthier
44e05e82b0 fix: Add logging to Spinner.end method 2024-08-05 17:37:37 -03:00
Paul Gauthier (aider)
54a481813a fix: update spinner every 0.1 sec at most 2024-08-05 17:32:07 -03:00
Paul Gauthier
b76434f5e0 fix: Add space before spinner text 2024-08-05 17:32:06 -03:00
Paul Gauthier (aider)
44f3ed6433 fix: Move Spinner class to top level and remove elapsed time display 2024-08-05 17:25:55 -03:00
Paul Gauthier (aider)
17f1f2862d style: Apply linter formatting changes 2024-08-05 17:25:23 -03:00
Paul Gauthier (aider)
5cac0b764f feat: move Spinner to top level, don't show elapsed 2024-08-05 17:25:20 -03:00
Paul Gauthier (aider)
8f8b0ed06e fix: limit spinner update rate to at most 1/10 second 2024-08-05 17:24:54 -03:00
Paul Gauthier (aider)
11bf7defea style: Apply linter formatting to io.py 2024-08-05 17:24:20 -03:00
Paul Gauthier (aider)
49b33ec85e feat: Add spinner functionality to IO class 2024-08-05 17:24:16 -03:00
Paul Gauthier
1677f7ede8 Do general autocomplete if /cmd doesn't have its own 2024-07-30 16:43:29 -03:00
Paul Gauthier (aider)
5d0ba54e07 Refactor get_completions method to extract command completion logic into a separate function 2024-07-30 16:36:13 -03:00
Paul Gauthier
50732a7b58 Do case insensitive completions in /add 2024-07-23 09:50:03 +02:00
Paul Gauthier
aaceec1e1f fix for tests 2024-07-03 21:02:26 -03:00
Paul Gauthier
3c1a6acc0d handle files with spaces 2024-07-03 20:12:04 -03:00
Paul Gauthier
4b0192ffd9 cache the completions in AutoCompleter 2024-07-03 20:08:51 -03:00
Paul Gauthier
60e838df9f roughed in faster completions 2024-07-03 19:49:37 -03:00
Daniel Vainsencher
3e9f6dcca2
Merge branch 'main' into dvf_llm_log 2024-06-12 18:32:48 -04:00
Paul Gauthier
05a74d67de finished --vim 2024-06-10 21:16:33 -07:00
Paul Gauthier
eae9a1e065 aider: Add editingmode argument to InputOutput class for EditingMode.VI and EditingMode.EMACS.
# Aider chat conversation:

USER: `InputOutput` should accept an arg editingmode of either EditingMode.VI EditingMode.EMACS

ASSISTANT: To add the `editingmode` argument to the `InputOutput` class, we need to:

1. Import `EditingMode` from `prompt_toolkit`.
2. Add the `editingmode` parameter to the `__init__` method.
3. Use the `editingmode` parameter when creating the `PromptSession`.

Here are the *SEARCH/REPLACE* blocks:

aider/io.py
```python
<<<<<<< SEARCH
from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt
=======
from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt, EditingMode
>>>>>>> REPLACE
```

aider/io.py
```python
<<<<<<< SEARCH
    ):
=======
        editingmode=EditingMode.EMACS,
    ):
        self.editingmode = editingmode
>>>>>>> REPLACE
```

aider/io.py
```python
<<<<<<< SEARCH
            session = PromptSession(key_bindings=kb, **session_kwargs)
=======
            session = PromptSession(key_bindings=kb, editing_mode=self.editingmode, **session_kwargs)
>>>>>>> REPLACE
```
2024-06-10 21:08:40 -07:00
Daniel Vainsencher
e6e360a4ef Added support for logging LLM history to a specified file. 2024-06-07 10:40:32 -04:00
Paul Gauthier
a395d9bb5c fix double lines for confirm_ask 2024-05-23 13:55:53 -07:00
Paul Gauthier
cda9565cae aider: Handle IsADirectoryError when trying to create a file where a directory exists.
# Aider chat conversation:

USER: https://github.com/paul-gauthier/aider/issues/606

https://github.com/paul-gauthier/aider/issues/606:

[Skip to content](#start-of-content)

## Navigation Menu

Toggle navigation

[](https://github.com/)

[Sign
in](/login?return_to=https%3A%2F%2Fgithub.com%2Fpaul-gauthier%2Faider%2Fissues%2F606)

-   Product

    -   [](https://github.com/features/actions)

        Actions

        Automate any workflow

    -   [](https://github.com/features/packages)

        Packages

        Host and manage packages

    -   [](https://github.com/features/security)

        Security

        Find and fix vulnerabilities

    -   [](https://github.com/features/codespaces)

        Codespaces

        Instant dev environments

    -   [](https://github.com/features/copilot)

        Copilot

        Write better code with AI

    -   [](https://github.com/features/code-review)

        Code review

        Manage code changes

    -   [](https://github.com/features/issues)

        Issues

        Plan and track work

    -   [](https://github.com/features/discussions)

        Discussions

        Collaborate outside of code

    Explore
    -   [All features](https://github.com/features)
    -   [Documentation](https://docs.github.com)
    -   [GitHub Skills](https://skills.github.com)
    -   [Blog](https://github.blog)

-   Solutions

    For
    -   [Enterprise](https://github.com/enterprise)
    -   [Teams](https://github.com/team)
    -   [Startups](https://github.com/enterprise/startups)
    -   [Education](https://education.github.com)

    By Solution
    -   [CI/CD & Automation](https://github.com/solutions/ci-cd)
    -   [DevOps](https://github.com/solutions/devops)
    -   [DevSecOps](https://resources.github.com/devops/fundamentals/devsecops)

    Resources
    -   [Learning Pathways](https://resources.github.com/learn/pathways)
    -   [White papers, Ebooks, Webinars](https://resources.github.com)
    -   [Customer Stories](https://github.com/customer-stories)
    -   [Partners](https://partner.github.com)

-   Open Source

    -   [](https://github.com/sponsors)

        GitHub Sponsors

        Fund open source developers

    -   [](https://github.com/readme)

        The ReadME Project

        GitHub community articles

    Repositories
    -   [Topics](https://github.com/topics)
    -   [Trending](https://github.com/trending)
    -   [Collections](https://github.com/collections)

-   [Pricing](https://github.com/pricing)

Search or jump to\...

# Search code, repositories, users, issues, pull requests\...

Search

Clear

[Search syntax
tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)

# Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

# Saved searches

## Use saved searches to filter your results more quickly

Name

Query

To see all available qualifiers, see our
[documentation](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax).

Cancel

Create saved search

[Sign
in](/login?return_to=https%3A%2F%2Fgithub.com%2Fpaul-gauthier%2Faider%2Fissues%2F606)

[Sign
up](/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=paul-gauthier%2Faider)

You signed in with another tab or window. [Reload]() to refresh your
session. You signed out in another tab or window. [Reload]() to refresh
your session. You switched accounts on another tab or window. [Reload]()
to refresh your session.

Dismiss alert

{{ message }}

::: {role="main"}

[paul-gauthier](/paul-gauthier) / **[aider](/paul-gauthier/aider)**
Public

-   [Notifications](/login?return_to=%2Fpaul-gauthier%2Faider)

-   [Fork 1k](/login?return_to=%2Fpaul-gauthier%2Faider)

-

    [ Star 10.2k](/login?return_to=%2Fpaul-gauthier%2Faider)

-   [Code ](/paul-gauthier/aider)
-   [Issues 55](/paul-gauthier/aider/issues)
-   [Pull requests 8](/paul-gauthier/aider/pulls)
-   [Actions ](/paul-gauthier/aider/actions)
-   [Projects 0](/paul-gauthier/aider/projects)
-   [Security](/paul-gauthier/aider/security)
-   [Insights ](/paul-gauthier/aider/pulse)

Additional navigation options

-   [ Code ](/paul-gauthier/aider)
-   [ Issues ](/paul-gauthier/aider/issues)
-   [ Pull requests ](/paul-gauthier/aider/pulls)
-   [ Actions ](/paul-gauthier/aider/actions)
-   [ Projects ](/paul-gauthier/aider/projects)
-   [ Security ](/paul-gauthier/aider/security)
-   [ Insights ](/paul-gauthier/aider/pulse)

New issue

**Have a question about this project?** Sign up for a free GitHub
account to open an issue and contact its maintainers and the community.

[Sign up for
GitHub](/signup?return_to=%2Fpaul-gauthier%2Faider%2Fissues%2Fnew%2Fchoose)

By clicking "Sign up for GitHub", you agree to our [terms of
service](https://docs.github.com/terms) and [privacy
statement](https://docs.github.com/privacy). We'll occasionally send you
account related emails.

Already on GitHub? [Sign
in](/login?return_to=%2Fpaul-gauthier%2Faider%2Fissues%2Fnew%2Fchoose)
to your account

[Jump to bottom](#issue-comment-box)

# Trying to create a file where a directory exists causes IsADirectoryError and aider to exit #606

Open

[harleypig](/harleypig) opened this issue May 18, 2024 · 0 comments

Open

# [Trying to create a file where a directory exists causes IsADirectoryError and aider to exit](#top) #606

[harleypig](/harleypig) opened this issue May 18, 2024 · 0 comments

Labels

[bug](/paul-gauthier/aider/labels/bug) Something isn\'t working

## Comments

[](/harleypig)

Copy link

###

**[harleypig](/harleypig)** commented [May 18, 2024](#issue-2304113184)
•

edited

+-----------------------------------------------------------------------+
| ### Issue                                                             |
|                                                                       |
| I wasn\'t thinking and asked aider to create a file with the same     |
| name as a directory and got unexpectedly dumped back to the command   |
| line.                                                                 |
|                                                                       |
|                                                                       |
|                                                                       |
|     $ mkdir -p testoops/oops                                          |
|     $ cd testoops                                                     |
|     $ aider                                                           |
|     Aider v0.35.0                                                     |
|                                                                       |
|     Models: openai/gpt-4o with diff edit format, weak model gpt-      |
| 3.5-turbo                                                             |
|     Git repo: .git with 0 files                                       |
|                                                                       |
|     Repo-map: using 2048 tokens                                       |
|                                                                       |
|     Use /help to see in-chat commands, run with --help to see cm      |
| d line args                                                           |
|     ────────────────────────────────────────────────────────────      |
| ───────────────────────────────────────────────────────────────────── |
|     > Create a text file named './oops' that has 'this wont work      |
| '                                                                     |
|                                                                       |
|     Here is the SEARCH/REPLACE block to create the file ./oops w      |
| ith the content this wont work:                                       |
|                                                                       |
|     ./oops                                                            |
|                                                                       |
|                                                                       |
|                                                                       |
|      <<<<<<< SEARCH                                                   |
|                                                                       |
|      =======                                                          |
|                                                                       |
|      this wont work                                                   |
|                                                                       |
|      >>>>>>> REPLACE                                                  |
|                                                                       |
|                                                                       |
|                                                                       |
|                                                                       |
|                                                                       |
|     Allow edits to ./oops which was not previously added to chat? y   |
|     Committing ./oops before applying edits.                          |
|     Cmd('git') failed due to: exit code(1)                            |
|       cmdline: git commit -m Add                                      |
| ed ./oops file. --no-verify -- /home/harleypig/projects/testoops/oops |
|       stderr: 'error: pathspec '/home/harl                            |
| eypig/projects/testoops/oops' did not match any file(s) known to git' |
|     ────────────────────────────────────────────────────────────      |
| ───────────────────────────────────────────────────────────────────── |
|     Traceback (most recent call last):                                |
|       File "/usr/local/bin/aider", line 8, in <module>                |
|         sys.exit(main())                                              |
|       File "/home/harleypig/.local/share/                             |
| python/lib/python3.10/site-packages/aider/main.py", line 408, in main |
|         coder.run()                                                   |
|       File "/home/harleypig/.local/share/python/lib/p                 |
| ython3.10/site-packages/aider/coders/base_coder.py", line 496, in run |
|         new_user_message = self.run_loop()                            |
|       File "/home/harleypig/.local/share/python/lib/python            |
| 3.10/site-packages/aider/coders/base_coder.py", line 512, in run_loop |
|         inp = self.io.get_input(                                      |
|       File "/home/harleypig/.local/share/pyt                          |
| hon/lib/python3.10/site-packages/aider/io.py", line 210, in get_input |
|         completer_instance = AutoCompleter(                           |
|       File "/home/harleypig/.local/share/p                            |
| ython/lib/python3.10/site-packages/aider/io.py", line 47, in __init__ |
|         with open(fname, "r", encoding=self.encoding) as f:           |
|     IsADirectoryError                                                 |
| : [Errno 21] Is a directory: '/home/harleypig/projects/testoops/oops' |
|                                                                       |
|                                                                       |
|                                                                       |
|                                                                       |
|                                                                       |
|                                                                       |
|                                                                       |
| ### Version and model info                                            |
|                                                                       |
| In example above.                                                     |
+-----------------------------------------------------------------------+
|                                                                       |
|                                                                       |
| The text was updated successfully, but these errors were encountered: |
|                                                                       |
|                                                                       |
+-----------------------------------------------------------------------+

All reactions

[paul-gauthier](/paul-gauthier) added the
[bug](/paul-gauthier/aider/labels/bug) Something isn\'t working label
[May 20, 2024](#event-12868798902)

[Sign up for free](/join?source=comment-repo) **to join this
conversation on GitHub**. Already have an account? [Sign in to
comment](/login?return_to=https%3A%2F%2Fgithub.com%2Fpaul-gauthier%2Faider%2Fissues%2F606)

Assignees

No one assigned

Labels

[bug](/paul-gauthier/aider/labels/bug) Something isn\'t working

Projects

None yet

Milestone

No milestone

Development

No branches or pull requests

2 participants

:::

## Footer

[](https://github.com) © 2024 GitHub, Inc.

### Footer navigation

-   [Terms](https://docs.github.com/site-policy/github-terms/github-terms-of-service)
-   [Privacy](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)
-   [Security](https://github.com/security)
-   [Status](https://www.githubstatus.com/)
-   [Docs](https://docs.github.com/)
-   [Contact](https://support.github.com?tags=dotcom-footer)
-   Manage cookies
-   Do not share my personal information

You can't perform that action at this time.

ASSISTANT: To address the issue of `IsADirectoryError` when trying to create a file where a directory exists, we need to handle this exception in the relevant part of the code. The most likely file to need changes is `aider/io.py`.

Please add `aider/io.py` to the chat so I can propose the necessary changes.

USER: I added these files to the chat: aider/io.py.

If you need to propose edits to other existing files not already added to the chat, you *MUST* tell the me their full path names and ask me to *add the files to the chat*. End your reply and wait for my approval. You can keep asking if you then decide you need to edit more files.

ASSISTANT: To handle the `IsADirectoryError` when trying to create a file where a directory exists, we need to catch this exception and handle it appropriately in the `get_input` method of the `InputOutput` class in `aider/io.py`.

Here are the changes:

aider/io.py
```python
<<<<<<< SEARCH
            try:
                with open(fname, "r", encoding=self.encoding) as f:
                    content = f.read()
            except (FileNotFoundError, UnicodeDecodeError):
                continue
=======
            try:
                with open(fname, "r", encoding=self.encoding) as f:
                    content = f.read()
            except (FileNotFoundError, UnicodeDecodeError, IsADirectoryError):
                continue
>>>>>>> REPLACE
```

This change will ensure that if the code tries to open a directory as if it were a file, it will catch the `IsADirectoryError` and continue without crashing.
2024-05-23 13:48:44 -07:00
Paul Gauthier
61165164d8 Run flake8 --isolated 2024-05-20 12:38:41 -07:00
Paul Gauthier
fa0aa60c97 Merge branch 'main' into swe-bench 2024-05-20 09:39:29 -07:00
Paul Gauthier
9c28bbc98e Refactored linting process and error handling in commands. 2024-05-20 08:55:49 -07:00
Paul Gauthier
819fccc7a4 added temp param, prompt strong that files message is truth 2024-05-16 08:52:30 -07:00