Commit graph

863 commits

Author SHA1 Message Date
Paul Gauthier
4cbdb9b9ad Added a method to check if input is a command. 2023-05-18 09:54:54 -07:00
Paul Gauthier
891d5b2263 aider: Added line numbers to the output of the get_quoted_file function.
# Context:
USER: git get_files_content prefix each line with a line number, starting at 1, padded out like '  1'
ASSISTANT: To add line numbers to the `get_files_content` method, we will modify the method in the `aider/coder.py` file. We will read the file content line by line and add the line number with padding to each line.

Here's the change:

```python
aider/coder.py
<<<<<<< ORIGINAL
    def get_files_content(self, fnames=None):
        if not fnames:
            fnames = self.abs_fnames

        prompt = ""
        for fname in fnames:
            relative_fname = self.get_rel_fname(fname)
            prompt += utils.quoted_file(fname, relative_fname)
        return prompt
=======
    def get_files_content(self, fnames=None):

^C KeyboardInterrupt
USER: sorry, in get_quoted_file prefix each line with a line number, starting at 1, padded out like '  1'
ASSISTANT:
^C KeyboardInterrupt
USER: Please note that I shared content of these additional files: aider/utils.py
ASSISTANT: To add line
^C KeyboardInterrupt
USER: in get_quoted_file prefix each line with a line number, starting at 1, padded out like '  1'
ASSISTANT: To add line numbers to the `get_quoted_file` function in the `aider/utils.py` file, we will read the file content line by line and add the line number with padding to each line.

Here's the change:

```python
aider/utils.py
<<<<<<< ORIGINAL
def quoted_file(fname, display_fname):
    prompt = "\n"
    prompt += display_fname
    prompt += "\n```\n"
    prompt += Path(fname).read_text()
    prompt += "\n```\n"
    return prompt
=======
def quoted_file(fname, display_fname):
    prompt = "\n"
    prompt += display_fname
    prompt += "\n```\n"
    file_content = Path(fname).read_text()
    lines = file_content.splitlines()
    for i, line in enumerate(lines, start=1):
        prompt += f"{i:3d} {line}\n"
    prompt += "```\n"
    return prompt
>>>>>>> UPDATED
```

This change will add line numbers to the output of the `get_quoted_file` function, starting at 1 and padded out like '  1'.
2023-05-18 07:00:50 -07:00
Paul Gauthier
8913eb5066 aider: Removed unused import statement for 'sys' in tests/test_main.py.
# Context:
USER: tests/test_main.py:2:1: F401 'sys' imported but unused
import sys
^

ASSISTANT: To fix the unused import issue, you can remove the import statement for 'sys' in the `tests/test_main.py` file.

```python
tests/test_main.py
<<<<<<< ORIGINAL
import sys
=======
>>>>>>> UPDATED
```
2023-05-17 18:26:43 -07:00
Paul Gauthier
943084fba2 aider: Removed unused imports in aider/io.py.
# Context:
USER: aider/io.py:12:1: F401 'time' imported but unused
import time
^
aider/io.py:13:1: F401 'random' imported but unused
import random
^

ASSISTANT: I see that there are unused imports in the `aider/io.py` file. I will remove them.

```python
aider/io.py
<<<<<<< ORIGINAL
import time
import random
=======
>>>>>>> UPDATED
```
2023-05-17 18:26:15 -07:00
Paul Gauthier
d5f2bef29e aider: Import git module in aider/commands.py.
# Context:
USER: aider/commands.py:101:20: F821 undefined name 'git'
            except git.exc.GitCommandError:
                   ^

ASSISTANT: It seems like the `git` module is not imported in the `aider/commands.py` file. To fix this issue, we need to import the `git` module at the beginning of the file.

Here's the change to import the `git` module:

```python
aider/commands.py
<<<<<<< ORIGINAL
import os
from rich.prompt import Confirm
from prompt_toolkit.completion import Completion
from aider import prompts
=======
import os
import git
from rich.prompt import Confirm
from prompt_toolkit.completion import Completion
from aider import prompts
>>>>>>> UPDATED
```
2023-05-17 18:25:47 -07:00
Paul Gauthier
6e83df4c8d aider: Removed unused import of rich.text.Text in aider/commands.py.
# Context:
USER: aider/commands.py:2:1: F401 'rich.text.Text' imported but unused
from rich.text import Text
^

ASSISTANT: I will remove the unused import from the `aider/commands.py` file.

```python
aider/commands.py
<<<<<<< ORIGINAL
from rich.text import Text
from rich.prompt import Confirm
=======
from rich.prompt import Confirm
>>>>>>> UPDATED
```
2023-05-17 18:25:03 -07:00
Paul Gauthier
9a413d351d black formatting 2023-05-17 18:24:35 -07:00
Paul Gauthier
3c26f90269 aider: Added --show-source argument to flake8 hook in .pre-commit-config.yaml.
# Context:
USER: can we make flake8 output the actual lines that have each error?
ASSISTANT: Yes, we can modify the `.pre-commit-config.yaml` file to include the `--show-source` argument for flake8. This will show the source code lines that have errors.

Here's the change:

```yaml
.pre-commit-config.yaml
<<<<<<< ORIGINAL
  - repo: https://github.com/pycqa/flake8
    rev: 6.0.0
    hooks:
      - id: flake8
=======
  - repo: https://github.com/pycqa/flake8
    rev: 6.0.0
    hooks:
      - id: flake8
        args: ["--show-source"]
>>>>>>> UPDATED
```
2023-05-17 17:55:40 -07:00
Paul Gauthier
bdae74a9a8 Ask the user to retry their cmd if we interrupt with an autocommit 2023-05-17 16:19:15 -07:00
Paul Gauthier
cc0ee034f4 aider: Added a check to ensure that part appears in whole exactly once in try_dotdotdots.
# Context:
USER: in try_dotdotdots, after checking that part is in whole add a check that part is in whole exactly 1 time
ASSISTANT: ```python
aider/utils.py
<<<<<<< ORIGINAL
        if part not in whole:
            raise ValueError("No perfect matching chunk in edit block with ...")

        whole = whole.replace(part, replace)
=======
        if whole.count(part) != 1:
            raise ValueError("No perfect matching chunk in edit block with ... or part appears more than once")

        whole = whole.replace(part, replace, 1)
>>>>>>> UPDATED
```
2023-05-17 16:15:09 -07:00
Paul Gauthier
de69a3095a aider: Removed all the save_stdin stuff.
# Context:
USER: remove all the save_stdin stuff
ASSISTANT: ```python
tests/test_main.py
<<<<<<< ORIGINAL
            save_stdin = sys.stdin
            sys.stdin = pipe_input
            main([], input=pipe_input, output=DummyOutput())
            sys.stdin = save_stdin
=======
            main([], input=pipe_input, output=DummyOutput())
>>>>>>> UPDATED
```

```python
tests/test_main.py
<<<<<<< ORIGINAL
            save_stdin = sys.stdin
            sys.stdin = pipe_input
            main(["foo.txt"], input=pipe_input, output=DummyOutput())
            sys.stdin = save_stdin
=======
            main(["foo.txt"], input=pipe_input, output=DummyOutput())
>>>>>>> UPDATED
```

```python
tests/test_main.py
<<<<<<< ORIGINAL
            save_stdin = sys.stdin
            sys.stdin = pipe_input
            main(["--yes", "foo.txt"], input=pipe_input, output=DummyOutput())
            sys.stdin = save_stdin
=======
            main(["--yes", "foo.txt"], input=pipe_input, output=DummyOutput())
>>>>>>> UPDATED
```
2023-05-17 16:13:01 -07:00
Paul Gauthier
2e53e59cf3 aider: Changed print statement to show actual repo directory instead of working tree.
# Context:
USER: after Using git repo print the actual repo dir, not the working tree
ASSISTANT: To print the actual repo directory instead of the working tree, you can use the `git rev-parse --git-dir` command. I need to see the relevant code file where you want to implement this change.
^C KeyboardInterrupt
USER: Please note that I shared content of these additional files: aider/coder.py
ASSISTANT: I apologize for the oversight. Here's the change to print the actual repo directory instead of the working tree in the `aider/coder.py` file:

```python
aider/coder.py
<<<<<<< ORIGINAL
        if self.repo:
            self.io.tool("Using git repo:", self.root)
=======
        if self.repo:
            self.io.tool("Using git repo:", self.repo.git_dir)
>>>>>>> UPDATED
```

This change will print the actual repo directory when a suitable git repo is found.
2023-05-17 16:11:40 -07:00
Paul Gauthier
d0c729469d Added logging for when a suitable git repo is found. 2023-05-17 16:10:38 -07:00
Paul Gauthier
a120063d45 updated demo gif 2023-05-17 15:42:30 -07:00
Paul Gauthier
4ce6e279d3 Removed the canned_input method and commented out related code. 2023-05-17 15:24:40 -07:00
Paul Gauthier
7dc406d0b4 Print aider in lowercase 2023-05-17 15:22:34 -07:00
Paul Gauthier
a9511b85b6 Added log_only parameter to io.tool function call. 2023-05-17 15:21:21 -07:00
Paul Gauthier
bca4674e07 aider: Added a log_only parameter to tool() to allow emitting only to the log.
# Context:
USER: add a log_only=False param to tool() which only emits to the log, not to the scren
ASSISTANT: ```python
aider/io.py
<<<<<<< ORIGINAL
    def tool(self, *messages):
        if messages:
            hist = " ".join(messages)
            hist = f"{hist.strip()}"
            self.append_chat_history(hist, linebreak=True, blockquote=True)

        messages = list(map(Text, messages))
        self.console.print(*messages)
=======
    def tool(self, *messages, log_only=False):
        if messages:
            hist = " ".join(messages)
            hist = f"{hist.strip()}"
            self.append_chat_history(hist, linebreak=True, blockquote=True)

        if not log_only:
            messages = list(map(Text, messages))
            self.console.print(*messages)
>>>>>>> UPDATED
```
2023-05-17 15:20:52 -07:00
Paul Gauthier
fc1dac4ac3 log the cmd line to the chat history 2023-05-17 13:47:34 -07:00
Paul Gauthier
6ea9085eec updated md chat log format 2023-05-17 13:45:27 -07:00
Paul Gauthier
11c0dd89d9 Renamed getinput -> io 2023-05-17 13:41:58 -07:00
Paul Gauthier
7b04f5ab8d link to the open source repos in transcripts 2023-05-17 09:55:54 -07:00
Paul Gauthier
6bc6aa240b copy 2023-05-16 10:15:40 -07:00
Paul Gauthier
5429ed9e62 copy 2023-05-16 06:51:40 -07:00
Paul Gauthier
7074db7ea4 better title/desc for homepage 2023-05-16 06:48:20 -07:00
Paul Gauthier
1575e885b7 title 2023-05-16 06:41:03 -07:00
Paul Gauthier
c499b5d8ed page.url 2023-05-16 06:39:49 -07:00
Paul Gauthier
3b69df6a82 undo 2023-05-16 06:33:56 -07:00
Paul Gauthier
72b7721fbd aider: Added a trailing slash to site.baseurl in if statement.
# Context:
USER: in the if page.url == site.baseurl, add a trailing slash to site.baseurl
ASSISTANT: ```html
_layouts/default.html
<<<<<<< ORIGINAL
      {% if page.url == site.baseurl %}
=======
      {% if page.url == site.baseurl | append: '/' %}
>>>>>>> UPDATED
```
2023-05-16 06:31:50 -07:00
Paul Gauthier
a716d3fb6f Updated README.md with a new project description. 2023-05-16 06:29:46 -07:00
Paul Gauthier
263988a27c aider: Added if statement to always display "aider" and "aider is GPT-4 powered coding in your terminal" on home page.
# Context:
USER: add an if statement, so the home page always has <h1>aider</h1> and <h2>aider is GPT-4 powered coding in your terminal</h2>
ASSISTANT: ```html
_layouts/default.html
<<<<<<< ORIGINAL
      <h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1>
      <h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2>
=======
      {% if page.url == site.baseurl %}
      <h1 class="project-name">aider</h1>
      <h2 class="project-tagline">aider is GPT-4 powered coding in your terminal</h2>
      {% else %}
      <h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1>
      <h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2>
      {% endif %}
>>>>>>> UPDATED
```
2023-05-16 06:29:28 -07:00
Paul Gauthier
2a1b2f8163 wip: Changed README.md header to be more concise. 2023-05-16 06:27:43 -07:00
Paul Gauthier
7c746d27b8 copy 2023-05-16 06:26:07 -07:00
Paul Gauthier
ba3172ba6c revert to old title/desc 2023-05-16 05:49:20 -07:00
Paul Gauthier
defa8717e4 wip: Updated project description and fixed config file paths and descriptions. 2023-05-16 05:44:52 -07:00
Paul Gauthier
9471024dd0 Updated descriptions for home and examples sections in _config.yml. 2023-05-16 05:40:39 -07:00
Paul Gauthier
cd93146ed3 aider: Added a scope to set a custom description for the home page in _config.yml.
# Context:
USER: how do i add a scope that sets the description just for the home page?
ASSISTANT: To add a scope that sets the description just for the home page, you'll need to modify the `_config.yml` file. You can define a new scope with a specific path pointing to the home page (usually `index.md` or `index.html`).

Here's how to add a scope with a custom description for the home page:

```yaml
_config.yml
<<<<<<< ORIGINAL
theme: jekyll-theme-cayman

defaults:
  - scope:
      path: "examples"
      type: "pages"
    values:
      description: "This is a custom description for the examples section."
=======
theme: jekyll-theme-cayman

defaults:
  - scope:
      path: "examples"
      type: "pages"
    values:
      description: "This is a custom description for the examples section."
  - scope:
      path: "index.md" # or "index.html" if your home page is an HTML file
      type: "pages"
    values:
      description: "This is a custom description for the home page."
>>>>>>> UPDATED
```

This will apply the custom description to the home page. Make sure to replace `"index.md"` with `"index.html"` if your home page is an HTML file.
2023-05-16 05:39:59 -07:00
Paul Gauthier
d0a51a85d0 aider: Added a scope with a custom description for the examples section in _config.yml.
# Context:
USER: can i use scope to apply a different description to different parts of the site?
ASSISTANT: Yes, you can use the `scope` feature in Jekyll to apply different descriptions to different parts of the site. You'll need to modify the `_config.yml` file to define the scopes and their respective descriptions.

Here's a step-by-step guide to achieve this:

1. In the `_config.yml` file, add a new `defaults` section.
2. Define the scope by specifying the `path` and `type` attributes.
3. Set the `values` attribute to include the `description` key with the desired description text.

Here's an example of how to add a scope with a custom description for the `examples` directory:

```yaml
_config.yml
<<<<<<< ORIGINAL
theme: jekyll-theme-cayman
=======
theme: jekyll-theme-cayman

defaults:
  - scope:
      path: "examples"
      type: "pages"
    values:
      description: "This is a custom description for the examples section."
>>>>>>> UPDATED
```

This will apply the custom description to all pages within the `examples` directory. You can add more scopes for other directories or specific pages by following the same pattern.
2023-05-16 05:38:40 -07:00
Paul Gauthier
74d090876a cleanup 2023-05-16 05:36:56 -07:00
Paul Gauthier
344018598a wip: Changed title in _config.yml to use variables. 2023-05-16 05:29:07 -07:00
Paul Gauthier
edd06e07c2 ## aider on main readme 2023-05-16 05:22:22 -07:00
Paul Gauthier
892119c7df added title: to _config 2023-05-16 05:20:46 -07:00
Paul Gauthier
07d22a9d66 removed head-custom.css 2023-05-16 05:17:29 -07:00
Paul Gauthier
0ae2815430 moved css to scss 2023-05-16 05:16:14 -07:00
Paul Gauthier
eb5d69c580 Added new files to the git repo: assets/css/style.scss 2023-05-16 05:14:29 -07:00
Paul Gauthier
602aee9f57 moved head-custom.css 2023-05-16 05:11:42 -07:00
Paul Gauthier
566d35aa82 Merge remote-tracking branch 'origin/main' 2023-05-16 05:09:44 -07:00
Paul Gauthier
b6622126e0 moved custom css into .css file 2023-05-16 05:09:29 -07:00
Paul Gauthier
94e1076c61 moved custom css into .css file 2023-05-16 05:09:18 -07:00
paul-gauthier
e2b97d00ae
Update complex-change.md 2023-05-15 21:49:08 -07:00