hc99 commited on
Commit
a89d35f
·
verified ·
1 Parent(s): 63de8ce

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. testbed/Aider-AI__aider/.dockerignore +9 -0
  2. testbed/Aider-AI__aider/.flake8 +3 -0
  3. testbed/Aider-AI__aider/.pre-commit-config.yaml +16 -0
  4. testbed/Aider-AI__aider/CNAME +1 -0
  5. testbed/Aider-AI__aider/HISTORY.md +131 -0
  6. testbed/Aider-AI__aider/LICENSE.txt +202 -0
  7. testbed/Aider-AI__aider/MANIFEST.in +1 -0
  8. testbed/Aider-AI__aider/README.md +172 -0
  9. testbed/Aider-AI__aider/_config.yml +9 -0
  10. testbed/Aider-AI__aider/assets/figure.png +3 -0
  11. testbed/Aider-AI__aider/benchmark/Dockerfile +7 -0
  12. testbed/Aider-AI__aider/docs/benchmarks.md +358 -0
  13. testbed/Aider-AI__aider/docs/commands.md +37 -0
  14. testbed/Aider-AI__aider/docs/ctags.md +233 -0
  15. testbed/Aider-AI__aider/docs/faq.md +205 -0
  16. testbed/Aider-AI__aider/docs/voice.md +114 -0
  17. testbed/Aider-AI__aider/examples/2048-game.md +88 -0
  18. testbed/Aider-AI__aider/examples/README.md +56 -0
  19. testbed/Aider-AI__aider/examples/add-test.md +173 -0
  20. testbed/Aider-AI__aider/examples/asciinema.md +26 -0
  21. testbed/Aider-AI__aider/examples/census.md +305 -0
  22. testbed/Aider-AI__aider/examples/chat-transcript-css.md +453 -0
  23. testbed/Aider-AI__aider/examples/complex-change.md +353 -0
  24. testbed/Aider-AI__aider/examples/css-exercises.md +77 -0
  25. testbed/Aider-AI__aider/examples/hello-world-flask.md +124 -0
  26. testbed/Aider-AI__aider/examples/hello.md +31 -0
  27. testbed/Aider-AI__aider/examples/no-color.md +160 -0
  28. testbed/Aider-AI__aider/examples/semantic-search-replace.md +56 -0
  29. testbed/Aider-AI__aider/examples/update-docs.md +38 -0
  30. testbed/Aider-AI__aider/hello.py +0 -0
  31. testbed/Aider-AI__aider/pytest.ini +3 -0
  32. testbed/Aider-AI__aider/requirements.txt +35 -0
  33. testbed/Aider-AI__aider/scripts/versionbump.py +80 -0
  34. testbed/Aider-AI__aider/setup.py +31 -0
  35. testbed/Aider-AI__aider/share/index.md +71 -0
  36. testbed/Aider-AI__aider/tests/__init__.py +0 -0
  37. testbed/Aider-AI__aider/tests/test_commands.py +278 -0
  38. testbed/Aider-AI__aider/tests/test_models.py +28 -0
  39. testbed/Aider-AI__aider/tests/test_sendchat.py +41 -0
  40. testbed/Aider-AI__aider/tests/test_wholefile.py +324 -0
  41. testbed/Cog-Creators__Red-DiscordBot/.bandit.yml +396 -0
  42. testbed/Cog-Creators__Red-DiscordBot/.cherry_picker.toml +5 -0
  43. testbed/Cog-Creators__Red-DiscordBot/.codeclimate.yml +52 -0
  44. testbed/Cog-Creators__Red-DiscordBot/.git_archive_info.txt +2 -0
  45. testbed/Cog-Creators__Red-DiscordBot/.gitattributes +7 -0
  46. testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/01_command_bug.yml +86 -0
  47. testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/02_other_bugs.yml +54 -0
  48. testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/03_enhancements.yml +29 -0
  49. testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/04_feature_request.yml +52 -0
  50. testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/config.yml +5 -0
testbed/Aider-AI__aider/.dockerignore ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ .BC.*
2
+ tmp*
3
+ *~
4
+ OLD*
5
+ *.pyc
6
+ .DS_Store
7
+ .env
8
+ .venv
9
+ .aider.*
testbed/Aider-AI__aider/.flake8 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [flake8]
2
+ ignore = E203,W503
3
+ max-line-length = 100
testbed/Aider-AI__aider/.pre-commit-config.yaml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pycqa/isort
3
+ rev: 5.12.0
4
+ hooks:
5
+ - id: isort
6
+ args: ["--profile", "black"]
7
+ - repo: https://github.com/psf/black
8
+ rev: 23.3.0
9
+ hooks:
10
+ - id: black
11
+ args: ["--line-length", "100", "--preview"]
12
+ - repo: https://github.com/pycqa/flake8
13
+ rev: 6.0.0
14
+ hooks:
15
+ - id: flake8
16
+ args: ["--show-source"]
testbed/Aider-AI__aider/CNAME ADDED
@@ -0,0 +1 @@
 
 
1
+ aider.chat
testbed/Aider-AI__aider/HISTORY.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Release history
2
+
3
+ ### main branch
4
+
5
+ - Send chat history as prompt/context for Whisper voice transcription
6
+ - Added `--voice-language` switch to constrain `/voice` to transcribe to a specific language
7
+
8
+ ### v0.12.0
9
+
10
+ - [Voice-to-code](https://aider.chat/docs/voice.html) support, which allows you to code with your voice.
11
+ - Fixed bug where /diff was causing crash.
12
+ - Improved prompting for gpt-4, refactor of editblock coder.
13
+ - [Benchmarked](https://aider.chat/docs/benchmarks.html) at 63.2% for gpt-4/diff, no regression.
14
+
15
+ ### v0.11.1
16
+
17
+ - Added a progress bar when initially creating a repo map.
18
+ - Fixed bad commit message when adding new file to empty repo.
19
+ - Fixed corner case of pending chat history summarization when dirty committing.
20
+ - Fixed corner case of undefined `text` when using `--no-pretty`.
21
+ - Fixed /commit bug from repo refactor, added test coverage.
22
+ - [Benchmarked](https://aider.chat/docs/benchmarks.html) at 53.4% for gpt-3.5/whole (no regression).
23
+
24
+ ### v0.11.0
25
+
26
+ - Automatically summarize chat history to avoid exhausting context window.
27
+ - More detail on dollar costs when running with `--no-stream`
28
+ - Stronger GPT-3.5 prompt against skipping/eliding code in replies (51.9% [benchmark](https://aider.chat/docs/benchmarks.html), no regression)
29
+ - Defend against GPT-3.5 or non-OpenAI models suggesting filenames surrounded by asterisks.
30
+ - Refactored GitRepo code out of the Coder class.
31
+
32
+ ### v0.10.1
33
+
34
+ - /add and /drop always use paths relative to the git root
35
+ - Encourage GPT to use language like "add files to the chat" to ask users for permission to edit them.
36
+
37
+ ### v0.10.0
38
+
39
+ - Added `/git` command to run git from inside aider chats.
40
+ - Use Meta-ENTER (Esc+ENTER in some environments) to enter multiline chat messages.
41
+ - Create a `.gitignore` with `.aider*` to prevent users from accidentaly adding aider files to git.
42
+ - Check pypi for newer versions and notify user.
43
+ - Updated keyboard interrupt logic so that 2 ^C in 2 seconds always forces aider to exit.
44
+ - Provide GPT with detailed error if it makes a bad edit block, ask for a retry.
45
+ - Force `--no-pretty` if aider detects it is running inside a VSCode terminal.
46
+ - [Benchmarked](https://aider.chat/docs/benchmarks.html) at 64.7% for gpt-4/diff (no regression)
47
+
48
+
49
+ ### v0.9.0
50
+
51
+ - Support for the OpenAI models in [Azure](https://aider.chat/docs/faq.html#azure)
52
+ - Added `--show-repo-map`
53
+ - Improved output when retrying connections to the OpenAI API
54
+ - Redacted api key from `--verbose` output
55
+ - Bugfix: recognize and add files in subdirectories mentioned by user or GPT
56
+ - [Benchmarked](https://aider.chat/docs/benchmarks.html) at 53.8% for gpt-3.5-turbo/whole (no regression)
57
+
58
+ ### v0.8.3
59
+
60
+ - Added `--dark-mode` and `--light-mode` to select colors optimized for terminal background
61
+ - Install docs link to [NeoVim plugin](https://github.com/joshuavial/aider.nvim) by @joshuavial
62
+ - Reorganized the `--help` output
63
+ - Bugfix/improvement to whole edit format, may improve coding editing for GPT-3.5
64
+ - Bugfix and tests around git filenames with unicode characters
65
+ - Bugfix so that aider throws an exception when OpenAI returns InvalidRequest
66
+ - Bugfix/improvement to /add and /drop to recurse selected directories
67
+ - Bugfix for live diff output when using "whole" edit format
68
+
69
+ ### v0.8.2
70
+
71
+ - Disabled general availability of gpt-4 (it's rolling out, not 100% available yet)
72
+
73
+ ### v0.8.1
74
+
75
+ - Ask to create a git repo if none found, to better track GPT's code changes
76
+ - Glob wildcards are now supported in `/add` and `/drop` commands
77
+ - Pass `--encoding` into ctags, require it to return `utf-8`
78
+ - More robust handling of filepaths, to avoid 8.3 windows filenames
79
+ - Added [FAQ](https://aider.chat/docs/faq.html)
80
+ - Marked GPT-4 as generally available
81
+ - Bugfix for live diffs of whole coder with missing filenames
82
+ - Bugfix for chats with multiple files
83
+ - Bugfix in editblock coder prompt
84
+
85
+ ### v0.8.0
86
+
87
+ - [Benchmark comparing code editing in GPT-3.5 and GPT-4](https://aider.chat/docs/benchmarks.html)
88
+ - Improved Windows support:
89
+ - Fixed bugs related to path separators in Windows
90
+ - Added a CI step to run all tests on Windows
91
+ - Improved handling of Unicode encoding/decoding
92
+ - Explicitly read/write text files with utf-8 encoding by default (mainly benefits Windows)
93
+ - Added `--encoding` switch to specify another encoding
94
+ - Gracefully handle decoding errors
95
+ - Added `--code-theme` switch to control the pygments styling of code blocks (by @kwmiebach)
96
+ - Better status messages explaining the reason when ctags is disabled
97
+
98
+ ### v0.7.2:
99
+
100
+ - Fixed a bug to allow aider to edit files that contain triple backtick fences.
101
+
102
+ ### v0.7.1:
103
+
104
+ - Fixed a bug in the display of streaming diffs in GPT-3.5 chats
105
+
106
+ ### v0.7.0:
107
+
108
+ - Graceful handling of context window exhaustion, including helpful tips.
109
+ - Added `--message` to give GPT that one instruction and then exit after it replies and any edits are performed.
110
+ - Added `--no-stream` to disable streaming GPT responses.
111
+ - Non-streaming responses include token usage info.
112
+ - Enables display of cost info based on OpenAI advertised pricing.
113
+ - Coding competence benchmarking tool against suite of programming tasks based on Execism's python repo.
114
+ - https://github.com/exercism/python
115
+ - Major refactor in preparation for supporting new function calls api.
116
+ - Initial implementation of a function based code editing backend for 3.5.
117
+ - Initial experiments show that using functions makes 3.5 less competent at coding.
118
+ - Limit automatic retries when GPT returns a malformed edit response.
119
+
120
+ ### v0.6.2
121
+
122
+ * Support for `gpt-3.5-turbo-16k`, and all OpenAI chat models
123
+ * Improved ability to correct when gpt-4 omits leading whitespace in code edits
124
+ * Added `--openai-api-base` to support API proxies, etc.
125
+
126
+ ### v0.5.0
127
+
128
+ - Added support for `gpt-3.5-turbo` and `gpt-4-32k`.
129
+ - Added `--map-tokens` to set a token budget for the repo map, along with a PageRank based algorithm for prioritizing which files and identifiers to include in the map.
130
+ - Added in-chat command `/tokens` to report on context window token usage.
131
+ - Added in-chat command `/clear` to clear the conversation history.
testbed/Aider-AI__aider/LICENSE.txt ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
testbed/Aider-AI__aider/MANIFEST.in ADDED
@@ -0,0 +1 @@
 
 
1
+ include requirements.txt
testbed/Aider-AI__aider/README.md ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # aider is AI pair programming in your terminal
2
+
3
+ Aider is a command line tool that lets you pair program with GPT-3.5/GPT-4,
4
+ to edit code stored in your local git repository.
5
+ You can start a new project or work with an existing repo.
6
+ And you can fluidly switch back and forth between the aider chat where you ask
7
+ GPT to edit the code and your own editor to make changes yourself.
8
+ Aider makes sure edits from you and GPT are
9
+ [committed to git](https://aider.chat/docs/faq.html#how-does-aider-use-git)
10
+ with sensible commit messages.
11
+ Aider is unique in that it [works well with pre-existing, larger codebases](https://aider.chat/docs/ctags.html).
12
+
13
+ <p align="center">
14
+ <img src="assets/screencast.svg" alt="aider screencast">
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="https://discord.gg/Tv2uQnR88V">
19
+ <img src="https://img.shields.io/badge/Join-Discord-blue.svg"/>
20
+ </a>
21
+ </p>
22
+
23
+ - [Getting started](#getting-started)
24
+ - [Example chat transcripts](#example-chat-transcripts)
25
+ - [Features](#features)
26
+ - [Usage](#usage)
27
+ - [In-chat commands](#in-chat-commands)
28
+ - [Tips](#tips)
29
+ - [GPT-4 vs GPT-3.5](https://aider.chat/docs/faq.html#gpt-4-vs-gpt-35)
30
+ - [Installation](https://aider.chat/docs/install.html)
31
+ - [Voice-to-code](https://aider.chat/docs/voice.html)
32
+ - [FAQ](https://aider.chat/docs/faq.html)
33
+ - [Discord](https://discord.gg/Tv2uQnR88V)
34
+
35
+ ## Getting started
36
+
37
+ See the
38
+ [installation instructions](https://aider.chat/docs/install.html)
39
+ for more details, but you can
40
+ get started quickly like this:
41
+
42
+ ```
43
+ $ pip install aider-chat
44
+ $ export OPENAI_API_KEY=your-key-goes-here
45
+ $ aider hello.js
46
+
47
+ Using git repo: .git
48
+ Added hello.js to the chat.
49
+
50
+ hello.js> write a js script that prints hello world
51
+ ```
52
+
53
+ ## Example chat transcripts
54
+
55
+ Here are some example transcripts that show how you can chat with `aider` to write and edit code with GPT-4.
56
+
57
+ * [**Hello World Flask App**](https://aider.chat/examples/hello-world-flask.html): Start from scratch and have GPT create a simple Flask app with various endpoints, such as adding two numbers and calculating the Fibonacci sequence.
58
+
59
+ * [**Javascript Game Modification**](https://aider.chat/examples/2048-game.html): Dive into an existing open-source repo, and get GPT's help to understand it and make modifications.
60
+
61
+ * [**Complex Multi-file Change with Debugging**](https://aider.chat/examples/complex-change.html): GPT makes a complex code change that is coordinated across multiple source files, and resolves bugs by reviewing error output and doc snippets.
62
+
63
+ * [**Create a Black Box Test Case**](https://aider.chat/examples/add-test.html): GPT creates a "black box" test case without access to the source of the method being tested, using only a
64
+ [high level map of the repository based on ctags](https://aider.chat/docs/ctags.html).
65
+
66
+ You can find more chat transcripts on the [examples page](https://aider.chat/examples/).
67
+
68
+ ## Features
69
+
70
+ * Chat with GPT about your code by launching `aider` from the command line with set of source files to discuss and edit together. Aider lets GPT see and edit the content of those files.
71
+ * GPT can write and edit code in most popular languages: python, javascript, typescript, html, css, etc.
72
+ * Request new features, changes, improvements, or bug fixes to your code. Ask for new test cases, updated documentation or code refactors.
73
+ * Aider will apply the edits suggested by GPT directly to your source files.
74
+ * Aider will [automatically commit each changeset to your local git repo](https://aider.chat/docs/faq.html#how-does-aider-use-git) with a descriptive commit message. These frequent, automatic commits provide a safety net. It's easy to undo changes or use standard git workflows to manage longer sequences of changes.
75
+ * You can use aider with multiple source files at once, so GPT can make coordinated code changes across all of them in a single changeset/commit.
76
+ * Aider can [give *GPT-4* a map of your entire git repo](https://aider.chat/docs/ctags.html), which helps it understand and modify large codebases.
77
+ * You can also edit files by hand using your editor while chatting with aider. Aider will notice these out-of-band edits and ask if you'd like to commit them. This lets you bounce back and forth between the aider chat and your editor, to collaboratively code with GPT.
78
+
79
+
80
+ ## Usage
81
+
82
+ Run the `aider` tool by executing the following command:
83
+
84
+ ```
85
+ aider <file1> <file2> ...
86
+ ```
87
+
88
+ If your pip install did not place the `aider` executable on your path, you can invoke aider like this:
89
+
90
+ ```
91
+ python -m aider.main <file1> <file2>
92
+ ```
93
+
94
+ Replace `<file1>`, `<file2>`, etc., with the paths to the source code files you want to work on.
95
+ These files will be "added to the chat session", so that GPT can see their contents and edit them according to your instructions.
96
+
97
+ You can also just launch `aider` anywhere in a git repo without naming
98
+ files on the command line. It will discover all the files in the
99
+ repo. You can then add and remove individual files in the chat
100
+ session with the `/add` and `/drop` chat commands described below.
101
+ If you or GPT mention one of the repo's filenames in the conversation,
102
+ aider will ask if you'd like to add it to the chat.
103
+
104
+ Aider will work best if you think about which files need to be edited to make your change and add them to the chat.
105
+ Aider has some ability to help GPT figure out which files to edit all by itself, but the most effective approach is to explicitly add the needed files to the chat yourself.
106
+
107
+ Aider also has many
108
+ additional command-line options, environment variables or configuration file
109
+ to set many options. See `aider --help` for details.
110
+
111
+
112
+ ## In-chat commands
113
+
114
+ Aider supports commands from within the chat, which all start with `/`. Here are some of the most useful in-chat commands:
115
+
116
+ * `/add <file>`: Add matching files to the chat session.
117
+ * `/drop <file>`: Remove matching files from the chat session.
118
+ * `/undo`: Undo the last git commit if it was done by aider.
119
+ * `/diff`: Display the diff of the last aider commit.
120
+ * `/run <command>`: Run a shell command and optionally add the output to the chat.
121
+ * `/help`: Show help about all commands.
122
+
123
+ See the [full command docs](https://aider.chat/docs/commands.html) for more information.
124
+
125
+
126
+ ## Tips
127
+
128
+ * Think about which files need to be edited to make your change and add them to the chat.
129
+ Aider has some ability to help GPT figure out which files to edit all by itself, but the most effective approach is to explicitly add the needed files to the chat yourself.
130
+ * Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk GPT through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements.
131
+ * Use Control-C to safely interrupt GPT if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply to GPT with more information or direction.
132
+ * Use the `/run` command to run tests, linters, etc and show the output to GPT so it can fix any issues.
133
+ * Use Meta-ENTER (Esc+ENTER in some environments) to enter multiline chat messages. Or enter `{` alone on the first line to start a multiline message and `}` alone on the last line to end it.
134
+ * If your code is throwing an error, share the error output with GPT using `/run` or by pasting it into the chat. Let GPT figure out and fix the bug.
135
+ * GPT knows about a lot of standard tools and libraries, but may get some of the fine details wrong about APIs and function arguments. You can paste doc snippets into the chat to resolve these issues.
136
+ * [Aider will notice if you launch it on a git repo with uncommitted changes and offer to commit them before proceeding](https://aider.chat/docs/faq.html#how-does-aider-use-git).
137
+ * GPT can only see the content of the files you specifically "add to the chat". Aider also sends GPT-4 a [map of your entire git repo](https://aider.chat/docs/ctags.html). So GPT may ask to see additional files if it feels that's needed for your requests.
138
+ * I also shared some general [GPT coding tips on Hacker News](https://news.ycombinator.com/item?id=36211879).
139
+
140
+
141
+ ## GPT-4 vs GPT-3.5
142
+
143
+ Aider supports all of OpenAI's chat models.
144
+ You can choose a model with the `--model` command line argument.
145
+
146
+ You should probably use GPT-4 if you can. For more details see the
147
+ [FAQ entry that compares GPT-4 vs GPT-3.5](https://aider.chat/docs/faq.html#gpt-4-vs-gpt-35).
148
+
149
+ For a discussion of using other non-OpenAI models, see the
150
+ [FAQ about other LLMs](https://aider.chat/docs/faq.html#can-i-use-aider-with-other-llms-local-llms-etc).
151
+
152
+ ## Installation
153
+
154
+ See the [installation instructions](https://aider.chat/docs/install.html).
155
+
156
+ ## FAQ
157
+
158
+ For more information, see the [FAQ](https://aider.chat/docs/faq.html).
159
+
160
+ ## Kind words from users
161
+
162
+ * *The best AI coding assistant so far.* -- [Matthew Berman](https://www.youtube.com/watch?v=df8afeb1FY8)
163
+ * *Hands down, this is the best AI coding assistant tool so far.* -- [IndyDevDan](https://www.youtube.com/watch?v=MPYFPvxfGZs)
164
+ * *Aider ... has easily quadrupled my coding productivity.* -- [SOLAR_FIELDS](https://news.ycombinator.com/item?id=36212100)
165
+ * *It's really like having your senior developer live right in your Git repo - truly amazing!* -- [rappster](https://github.com/paul-gauthier/aider/issues/124)
166
+ * *What an amazing tool. It's incredible.* -- [valyagolev](https://github.com/paul-gauthier/aider/issues/6#issue-1722897858)
167
+ * *Aider is such an astounding thing!* -- [cgrothaus](https://github.com/paul-gauthier/aider/issues/82#issuecomment-1631876700)
168
+ * *It was WAY faster than I would be getting off the ground and making the first few working versions.* -- [Daniel Feldman](https://twitter.com/d_feldman/status/1662295077387923456)
169
+ * *This project is stellar.* -- [funkytaco](https://github.com/paul-gauthier/aider/issues/112#issuecomment-1637429008)
170
+ * *Amazing project, definitely the best AI coding assistant I've used.* -- [joshuavial](https://github.com/paul-gauthier/aider/issues/84)
171
+ * *I am an aider addict. I'm getting so much more work done, but in less time.* -- [dandandan](https://discord.com/channels/1131200896827654144/1131200896827654149/1135913253483069470)
172
+ * *Best agent for actual dev work in existing codebases.* -- [Nick Dobos](https://twitter.com/NickADobos/status/1690408967963652097?s=20)
testbed/Aider-AI__aider/_config.yml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ theme: jekyll-theme-cayman
2
+ url: "https://aider.chat"
3
+
4
+ defaults:
5
+ - scope:
6
+ path: "README.md"
7
+ type: "pages"
8
+ values:
9
+ description: "A command-line chat tool for coding with GPT"
testbed/Aider-AI__aider/assets/figure.png ADDED

Git LFS Details

  • SHA256: ae69ec5370b0ced731a36d621e213c6bf6fb1aee77e8883220935bdd6b2b1bbd
  • Pointer size: 130 Bytes
  • Size of remote file: 29 kB
testbed/Aider-AI__aider/benchmark/Dockerfile ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ FROM python:3.8-slim
2
+ RUN apt-get update && apt-get install -y less git
3
+ COPY requirements.txt /aider/requirements.txt
4
+ RUN pip install lox typer pandas matplotlib imgcat aider-chat
5
+ RUN pip install --upgrade pip && pip install -r /aider/requirements.txt
6
+ WORKDIR /aider
7
+
testbed/Aider-AI__aider/docs/benchmarks.md ADDED
@@ -0,0 +1,358 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GPT code editing benchmarks
2
+
3
+ [![benchmark results](../assets/benchmarks.svg)](https://aider.chat/assets/benchmarks.svg)
4
+
5
+ Aider is an open source command line chat tool that lets you work with GPT to edit
6
+ code in your local git repo.
7
+ To do this, aider needs to be able to reliably recognize when GPT wants to edit local files,
8
+ determine which files it wants to modify and what changes to save.
9
+ Such automated
10
+ code editing hinges on using the system prompt
11
+ to tell GPT how to structure code edits in its responses.
12
+
13
+ Aider currently asks GPT to use simple text based "edit formats", but
14
+ [OpenAI's new function calling
15
+ API](https://openai.com/blog/function-calling-and-other-api-updates)
16
+ looks like a promising way to create more structured edit formats.
17
+ After implementing a couple of function based edit formats,
18
+ I wanted
19
+ to measure the potential benefits
20
+ of switching aider to use them by default.
21
+
22
+ With this in mind, I developed a
23
+ benchmark based on the [Exercism
24
+ python](https://github.com/exercism/python) coding exercises.
25
+ This
26
+ benchmark evaluates how effectively aider and GPT can translate a
27
+ natural language coding request into executable code saved into
28
+ files that pass unit tests.
29
+ It provides an end-to-end evaluation of not just
30
+ GPT's coding ability, but also its capacity to *edit existing code*
31
+ and *format those code edits* so that aider can save the
32
+ edits to the local source files.
33
+
34
+ I ran the benchmark
35
+ on all the ChatGPT models (except `gpt-4-32k`), using a variety of edit formats.
36
+ The results were interesting:
37
+
38
+ - **Plain text edit formats worked best.** Asking GPT to return an updated copy of the whole file in a standard markdown fenced code block proved to be the most reliable and effective edit format across all GPT-3.5 and GPT-4 models. The results for this `whole` edit format are shown in solid blue in the graph.
39
+ - **Function calls performed worse.** Using the new functions API for edits performed worse than the above whole file method, for all the models. GPT-3.5 especially produced inferior code and frequently mangled this output format. This was surprising, as the functions API was introduced to enhance the reliability of structured outputs. The results for these `...-func` edit methods are shown as patterned bars in the graph (both green and blue).
40
+ - **The new June GPT-3.5 models did a bit worse than the old June model.** The performance of the new June (`0613`) versions of GPT-3.5 appears to be a bit worse than the February (`0301`) version. This is visible if you look at the "first attempt" markers on the first three solid blue bars and also by comparing the first three solid green `diff` bars.
41
+ - **GPT-4 does better than GPT-3.5,** as expected.
42
+
43
+ The quantitative benchmark results agree with my intuitions
44
+ about prompting GPT for complex tasks like coding. It's beneficial to
45
+ minimize the "cognitive overhead" of formatting the response, allowing
46
+ GPT to concentrate on the coding task at hand.
47
+
48
+ As a thought experiment, imagine a slack conversation with a junior developer where
49
+ you ask them to write the code to add some new feature to your app.
50
+ They're going to type the response back to you by hand in the chat.
51
+ Should they type out the
52
+ code and wrap it in a normal markdown code block?
53
+ Or should they type up a properly escaped and
54
+ syntactically correct json data structure
55
+ that contains the text of the new code?
56
+
57
+ Using more complex output formats with GPT seems to cause two issues:
58
+
59
+ - It makes GPT write worse code. Keeping the output format simple seems to allow GPT to devote more attention to the actual coding task.
60
+ - It reduces GPT's adherence to the output format, making it more challenging for tools like aider to accurately identify and apply the edits GPT is attempting to make.
61
+
62
+ I was expecting to start using function call based edits in aider for both GPT-3.5 and GPT-4.
63
+ But given these benchmark results, I won't be adopting the functions API
64
+ at this time.
65
+ I will certainly plan to benchmark functions again with future versions of the models.
66
+
67
+ More details on the benchmark, edit formats and results are discussed below.
68
+
69
+
70
+ ## The benchmark
71
+
72
+ The benchmark uses
73
+ [133 practice exercises from the Exercism python repository](https://github.com/exercism/python/tree/main/exercises/practice).
74
+ These
75
+ exercises were designed to help individuals learn Python and hone
76
+ their coding skills.
77
+
78
+ Each exercise includes:
79
+
80
+ - [Instructions](https://github.com/exercism/python/blob/main/exercises/practice/anagram/.docs/instructions.md), provided in markdown files.
81
+ - [Stub python code](https://github.com/exercism/python/blob/main/exercises/practice/anagram/anagram.py) in an *implementation file*, specifying the functions or classes that need to be implemented.
82
+ - [Unit tests](https://github.com/exercism/python/blob/main/exercises/practice/anagram/anagram_test.py) in a separate python file.
83
+
84
+ The goal is for GPT to read the instructions, implement the provided function/class skeletons
85
+ and pass all the unit tests. The benchmark measures what percentage of
86
+ the 133 exercises are completed successfully, causing all the associated unit tests to pass.
87
+
88
+ To start each exercise, aider sends GPT
89
+ the initial contents of the implementation file,
90
+ the Exercism instructions
91
+ and a final instruction:
92
+
93
+ ```
94
+ Use the above instructions to modify the supplied files: <implementation file>
95
+ Keep and implement the existing function or class stubs, they will be called from unit tests.
96
+ Only use standard python libraries, don't suggest installing any packages.
97
+ ```
98
+
99
+ Aider updates the implementation file based on GPT's reply and runs
100
+ the unit tests. If all tests pass, the exercise is considered
101
+ complete. If some tests fail, aider sends GPT a second message with
102
+ the test error output. It only sends the first 50 lines of test errors
103
+ to try and avoid exceeding the context window of the smaller models. Aider
104
+ also includes this final instruction:
105
+
106
+ ```
107
+ See the testing errors above.
108
+ The tests are correct.
109
+ Fix the code in <implementation file> to resolve the errors.
110
+ ```
111
+
112
+ Requiring GPT to fix its first implementation in response to test failures
113
+ is another way in which this benchmark stresses code editing skill.
114
+ This second chance is also important because it
115
+ gives GPT the opportunity to adjust if the
116
+ instructions were imprecise with respect to the
117
+ specific requirements of the unit tests.
118
+ Many of the exercises have multiple paragraphs of instructions,
119
+ and most human coders would likely fail some tests on their
120
+ first try.
121
+
122
+ The bars in the graph show the percent of exercises that were completed by
123
+ each model and edit format combination. The full bar height represents
124
+ the final outcome following both coding attempts.
125
+ Each bar also has a horizontal mark that shows
126
+ the intermediate performance after the first coding attempt,
127
+ without the benefit of the second try that includes the test error output.
128
+
129
+ It's worth noting that GPT never gets to see the source code of the
130
+ unit tests during the benchmark. It only sees the error output from
131
+ failed tests. Of course, all of this code was probably part of its
132
+ original training data!
133
+
134
+ In summary, passing an exercise means GPT was able to:
135
+
136
+ - Write the required code (possibly after reviewing test error output),
137
+ - Correctly package all of the code edits into the edit format so that aider can process and save it to the implementation file.
138
+
139
+ Conversely, failing an exercise only requires a breakdown in one of
140
+ those steps. In practice, GPT fails at different steps in different
141
+ exercises. Sometimes it simply writes the wrong code. Other times, it
142
+ fails to format the code edits in a way that conforms to the edit
143
+ format, resulting in the code not being saved correctly.
144
+
145
+ It's worth keeping in mind that changing the edit format often affects
146
+ both aspects of GPT's performance.
147
+ Complex edit formats often lead GPT to write worse code *and* make it less
148
+ successful at formatting the edits correctly.
149
+
150
+
151
+ ## Edit formats
152
+
153
+ I benchmarked 4 different edit formats, described below.
154
+ Each description includes a sample response that GPT might provide to a user who
155
+ requests:
156
+ "Change the print from hello to goodbye."
157
+
158
+ ### whole
159
+
160
+ The
161
+ [whole](https://github.com/paul-gauthier/aider/blob/main/aider/coders/wholefile_prompts.py)
162
+ format asks GPT to return an updated copy of the entire file, including any changes.
163
+ The file should be
164
+ formatted with normal markdown triple-backtick fences, inlined with the rest of its response text.
165
+
166
+ This format is very similar to how ChatGPT returns code snippets during normal chats, except with the addition of a filename right before the opening triple-backticks.
167
+
168
+ ````
169
+ Here is the updated copy of your file demo.py:
170
+
171
+ demo.py
172
+ ```python
173
+ def main():
174
+ print("goodbye")
175
+ ```
176
+ ````
177
+
178
+ ### diff
179
+
180
+ The [diff](https://github.com/paul-gauthier/aider/blob/main/aider/coders/editblock_prompts.py)
181
+ format also asks GPT to return edits as part of the normal response text,
182
+ in a simple diff format.
183
+ Each edit is a fenced code block that
184
+ specifies the filename and a chunk of ORIGINAL and UPDATED code.
185
+ GPT provides some original lines from the file and then a new updated set of lines.
186
+
187
+ ````
188
+ Here are the changes you requested to demo.py:
189
+
190
+ ```python
191
+ demo.py
192
+ <<<<<<< ORIGINAL
193
+ print("hello")
194
+ =======
195
+ print("goodbye")
196
+ >>>>>>> UPDATED
197
+ ```
198
+ ````
199
+
200
+ ### whole-func
201
+
202
+ The [whole-func](https://github.com/paul-gauthier/aider/blob/main/aider/coders/wholefile_func_coder.py)
203
+ format requests updated copies of whole files to be returned using the function call API.
204
+
205
+
206
+ ```
207
+ {
208
+ "explanation": "Changed hello to goodbye.",
209
+ "files": [
210
+ {
211
+ "path": "demo.py",
212
+ "content": "def main():\n print(\"goodbye\")\n"
213
+ }
214
+ }
215
+ ```
216
+
217
+ ### diff-func
218
+
219
+ The
220
+ [diff-func](https://github.com/paul-gauthier/aider/blob/main/aider/coders/editblock_func_coder.py)
221
+ format requests a list of
222
+ original/updated style edits to be returned using the function call API.
223
+
224
+ ```
225
+ {
226
+ "explanation": "Changed hello to goodbye.",
227
+ "edits": [
228
+ {
229
+ "path": "demo.py",
230
+ "original_lines": [
231
+ " print(\"hello\")"
232
+ ],
233
+ "updated_lines": [
234
+ " print(\"goodbye\")"
235
+ ],
236
+ }
237
+ ]
238
+ }
239
+ ```
240
+
241
+ ## GPT-3.5's performance
242
+
243
+ ### The `0613` models seem worse?
244
+
245
+ The GPT-3.5 benchmark results have me fairly convinced that the new
246
+ `gpt-3.5-turbo-0613` and `gpt-3.5-16k-0613` models
247
+ are a bit worse at code editing than
248
+ the older `gpt-3.5-turbo-0301` model.
249
+
250
+ This is visible in the "first attempt"
251
+ portion of each result, before GPT gets a second chance to edit the code.
252
+ Look at the horizontal white line in the middle of the first three blue bars.
253
+ Performance with the `whole` edit format was 46% for the
254
+ February model and only 39% for the June models.
255
+
256
+ But also note how much the solid green `diff` bars
257
+ degrade between the February and June GPT-3.5 models.
258
+ They drop from 30% down to about 19%.
259
+
260
+ I saw other signs of this degraded performance
261
+ in earlier versions of the
262
+ benchmark as well.
263
+
264
+ ### Pathological use of `diff`
265
+
266
+ When GPT-3.5 is able to correctly generate the `diff` edit format,
267
+ it often uses it in a pathological manner. It places the *entire*
268
+ original source file in the ORIGINAL block and the entire updated file
269
+ in the UPDATED block. This is strictly worse than just using the
270
+ `whole` edit format, as GPT is sending two full copies of the file.
271
+
272
+ ### Hallucinated function calls
273
+
274
+ When GPT-3.5 uses the functions API
275
+ it is prone to ignoring the JSON Schema that specifies valid functions.
276
+ It often returns a completely novel and semantically
277
+ invalid `function_call` fragment with `"name": "python"`.
278
+
279
+ The `arguments` attribute is supposed to be a set of key/value pairs
280
+ with the arguments to the function specified in the `name` field.
281
+ Instead, GPT-3.5 frequently just stuffs an entire python
282
+ file into that field.
283
+
284
+ ```
285
+ "function_call": {
286
+ "name": "python",
287
+ "arguments": "def main():\n print(\"hello\")\n"
288
+ },
289
+ ```
290
+
291
+ It seems like it might be getting confused by fine-tuning that was
292
+ done for the ChatGPT code interpreter plugin?
293
+
294
+
295
+
296
+
297
+ ## Randomness
298
+
299
+ The benchmark attempts to be deterministic, always sending identical
300
+ requests for each exercise on repeated runs.
301
+ As part of this effort,
302
+ when sending test error output to GPT,
303
+ it removes the wall-clock timing information that
304
+ is normally included by the `unittest` module.
305
+
306
+ The benchmark harness also logs SHA hashes of
307
+ all the OpenAI API requests and replies.
308
+ This makes it possible to
309
+ detect randomness or nondeterminism
310
+ in the bechmarking process.
311
+
312
+ It turns out that the OpenAI chat APIs are not deterministic, even at
313
+ `temperature=0`. The same identical request will produce multiple
314
+ distinct responses, usually less than 5-10 variations. This suggests
315
+ that OpenAI may be load balancing their API across a number of
316
+ slightly different instances of the model?
317
+
318
+ For certain exercises, some of these variable responses pass the unit tests while
319
+ other variants do not. Results for exercises like this, which are
320
+ "on the bubble",
321
+ are therefore a bit random, depending on which variant OpenAI returns.
322
+
323
+ Given that, it would be ideal to run all 133 exercises many times for each
324
+ model/edit-format combination and report an average performance.
325
+ This would average away the effect of the API variance.
326
+ It would also significantly increase the cost of this sort of benchmarking.
327
+ So I didn't do that.
328
+
329
+ Benchmarking against 133 exercises already provides some robustness, since
330
+ we are measuring the performance across many exercises.
331
+
332
+ But to get a sense of how much the API variance impacts the benchmark outcomes,
333
+ I ran all 133 exercises 10 times each
334
+ against `gpt-3.5-turbo-0613` with the `whole` edit format.
335
+ You'll see one set of error bars in the graph, which show
336
+ the range of results from those 10 runs.
337
+
338
+ The OpenAI API randomness doesn't seem to
339
+ cause a large variance in the overall benchmark results.
340
+
341
+ ## Conclusions
342
+
343
+ Based on these benchmark results, aider will continue to use
344
+ the `whole` edit format for GPT-3.5, and `diff` for GPT-4.
345
+
346
+ GPT-4 gets comparable results with the `whole` and `diff` edit formats,
347
+ but using `whole` significantly increases costs and latency compared to `diff`.
348
+
349
+ The latency of streaming back the entire updated copy of each edited file
350
+ is a real challenge with the `whole` format.
351
+ The GPT-3.5 models are quite responsive, and can
352
+ stream back entire files at reasonable speed.
353
+ Aider displays a progress bar and
354
+ live diffs of the files as they stream in,
355
+ which helps pass the time.
356
+
357
+ The GPT-4 models are much slower, and waiting for even small files
358
+ to be completely "retyped" on each request is probably unacceptable.
testbed/Aider-AI__aider/docs/commands.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Commands
2
+
3
+ - `/help`: Show help about all commands
4
+ - `/exit`: Exit the application
5
+
6
+ ## token/context management
7
+ - `/add <file>`: Add matching files to the chat session using glob patterns
8
+ - `/drop <file>`: Remove matching files from the chat session
9
+ - `/clear`: Clear the chat history
10
+ - `/ls`: List all known files and those included in the chat session
11
+ - `/tokens`: Report on the number of tokens used by the current chat context
12
+ - `/run <command>`: Run a shell command and optionally add the output to the chat
13
+
14
+ ## git
15
+ - `/undo`: Undo the last git commit if it was done by aider
16
+ - `/diff`: Display the diff of the last aider commit
17
+ - `/commit <message>`: Commit edits to the repo made outside the chat (commit message optional)
18
+ - `/git <command>`: Run a git command
19
+
20
+ # Prompt Toolkit defaults
21
+
22
+ The interactive prompt is built with [prompt-toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit) which provides a lot of Emacs and Vi-style keyboard. Some emacs bindings you may find useful are
23
+
24
+ - `Ctrl-A` : Move cursor to the start of the line.
25
+ - `Ctrl-B` : Move cursor back one character.
26
+ - `Ctrl-D` : Delete the character under the cursor.
27
+ - `Ctrl-E` : Move cursor to the end of the line.
28
+ - `Ctrl-F` : Move cursor forward one character.
29
+ - `Ctrl-K` : Delete from the cursor to the end of the line.
30
+ - `Ctrl-L` : Clear the screen.
31
+ - `Ctrl-N` : Move down to the next history entry.
32
+ - `Ctrl-P` : Move up to the previous history entry.
33
+ - `Ctrl-R` : Reverse search in command history.
34
+
35
+ Note: aider currently exits vi normal mode after a single command, (maybe something to do with the esc keybinding?). Feel free to investigate and make a PR if you would like to see it fully supported.
36
+
37
+ Prompt toolkit also does not provide clear documentation on the bindings they support - maybe you can take aider and help them out with that and we can then link to the authoritative docs.
testbed/Aider-AI__aider/docs/ctags.md ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Improving GPT-4's codebase understanding with ctags
3
+
4
+ ![robot flowchat](../assets/robot-flowchart.png)
5
+
6
+ GPT-4 is extremely useful for "self-contained" coding tasks,
7
+ like generating brand new code or modifying a pure function
8
+ that has no dependencies.
9
+
10
+ But it's difficult to use GPT-4 to modify or extend
11
+ a large, complex pre-existing codebase.
12
+ To modify such code, GPT needs to understand the dependencies and APIs
13
+ which interconnect its subsystems.
14
+ Somehow we need to provide this "code context" to GPT
15
+ when we ask it to accomplish a coding task. Specifically, we need to:
16
+
17
+ - Help GPT understand the overall codebase, so that it
18
+ can decifer the meaning of code with complex dependencies and generate
19
+ new code that respects and utilizes existing abstractions.
20
+ - Convey all of this "code context" to GPT in an
21
+ efficient manner that fits within the 8k-token context window.
22
+
23
+ To address these issues, `aider` now
24
+ sends GPT a **concise map of your whole git repository**
25
+ that includes
26
+ all declared variables and functions with call signatures.
27
+ This *repo map* is built automatically using `ctags`, which
28
+ extracts symbol definitions from source files. Historically,
29
+ ctags were generated and indexed by IDEs and editors to
30
+ help humans search and navigate large codebases.
31
+ Instead, we're going to use ctags to help GPT better comprehend, navigate
32
+ and edit code in larger repos.
33
+
34
+ To get a sense of how effective this can be, this
35
+ [chat transcript](https://aider.chat/examples/add-test.html)
36
+ shows GPT-4 creating a black box test case, **without being given
37
+ access to the source code of the function being tested or any of the
38
+ other code in the repo.**
39
+ Using only the meta-data in the repo map, GPT is able to figure out how to
40
+ call the method to be tested, as well as how to instantiate multiple
41
+ class objects that are required to prepare for the test.
42
+
43
+ To code with GPT-4 using the techniques discussed here:
44
+
45
+
46
+ - Install [aider](https://aider.chat/docs/install.html).
47
+ - Install [universal ctags](https://aider.chat/docs/install.html#install-universal-ctags-optional).
48
+ - Run `aider` inside your repo, and it should say "Repo-map: universal-ctags using 1024 tokens".
49
+
50
+ ## The problem: code context
51
+
52
+ GPT-4 is great at "self contained" coding tasks, like writing or
53
+ modifying a pure function with no external dependencies.
54
+ GPT can easily handle requests like "write a
55
+ Fibonacci function" or "rewrite the loop using list
56
+ comprehensions", because they require no context beyond the code
57
+ being discussed.
58
+
59
+ Most real code is not pure and self-contained, it is intertwined with
60
+ and depends on code from many different files in a repo.
61
+ If you ask GPT to "switch all the print statements in class Foo to
62
+ use the BarLog logging system", it needs to see the code in the Foo class
63
+ with the prints, and it also needs to understand the project's BarLog
64
+ subsystem.
65
+
66
+ A simple solution is to **send the entire codebase** to GPT along with
67
+ each change request. Now GPT has all the context! But this won't work
68
+ for even moderately
69
+ sized repos, because they won't fit into the 8k-token context window.
70
+
71
+ A better approach is to be selective,
72
+ and **hand pick which files to send**.
73
+ For the example above, you could send the file that
74
+ contains the Foo class
75
+ and the file that contains the BarLog logging subsystem.
76
+ This works pretty well, and is supported by `aider` -- you
77
+ can manually specify which files to "add to the chat" you are having with GPT.
78
+
79
+ But it's not ideal to have to manually identify the right
80
+ set of files to add to the chat.
81
+ And sending whole files is a bulky way to send code context,
82
+ wasting the precious 8k context window.
83
+ GPT doesn't need to see the entire implementation of BarLog,
84
+ it just needs to understand it well enough to use it.
85
+ You may quickly run out of context window if you
86
+ send many files worth of code just to convey context.
87
+
88
+ ## Using a repo map to provide context
89
+
90
+ The latest version of `aider` sends a **repo map** to GPT along with
91
+ each change request. The map contains a list of all the files in the
92
+ repo, along with the symbols which are defined in each file. Callables
93
+ like functions and methods also include their signatures.
94
+
95
+ Here's a
96
+ sample of the map of the aider repo, just showing the maps of
97
+ [main.py](https://github.com/paul-gauthier/aider/blob/main/aider/main.py)
98
+ and
99
+ [io.py](https://github.com/paul-gauthier/aider/blob/main/aider/io.py)
100
+ :
101
+
102
+ ```
103
+ aider/
104
+ ...
105
+ main.py:
106
+ function
107
+ main (args=None, input=None, output=None)
108
+ variable
109
+ status
110
+ ...
111
+ io.py:
112
+ class
113
+ FileContentCompleter
114
+ InputOutput
115
+ FileContentCompleter
116
+ member
117
+ __init__ (self, fnames, commands)
118
+ get_completions (self, document, complete_event)
119
+ InputOutput
120
+ member
121
+ __init__ (self, pretty, yes, input_history_file=None, chat_history_file=None, input=None, output=None)
122
+ ai_output (self, content)
123
+ append_chat_history (self, text, linebreak=False, blockquote=False)
124
+ confirm_ask (self, question, default="y")
125
+ get_input (self, fnames, commands)
126
+ prompt_ask (self, question, default=None)
127
+ tool (self, *messages, log_only=False)
128
+ tool_error (self, message)
129
+ ...
130
+ ```
131
+
132
+ Mapping out the repo like this provides some benefits:
133
+
134
+ - GPT can see variables, classes, methods and function signatures from everywhere in the repo. This alone may give it enough context to solve many tasks. For example, it can probably figure out how to use the API exported from a module just based on the details shown in the map.
135
+ - If it needs to see more code, GPT can use the map to figure out by itself which files it needs to look at. GPT will then ask to see these specific files, and `aider` will automatically add them to the chat context (with user approval).
136
+
137
+ Of course, for large repositories even just the map might be too large
138
+ for the context window. However, this mapping approach opens up the
139
+ ability to collaborate with GPT-4 on larger codebases than previous
140
+ methods. It also reduces the need to manually curate which files to
141
+ add to the chat context, empowering GPT to autonomously identify
142
+ relevant files for the task at hand.
143
+
144
+ ## Using ctags to make the map
145
+
146
+ Under the hood, `aider` uses
147
+ [universal ctags](https://github.com/universal-ctags/ctags)
148
+ to build the
149
+ map. Universal ctags can scan source code written in many
150
+ languages, and extract data about all the symbols defined in each
151
+ file.
152
+
153
+ Historically, ctags were generated and indexed by IDEs or code editors
154
+ to make it easier for a human to search and navigate a
155
+ codebase, find the implementation of functions, etc.
156
+ Instead, we're going to use ctags to help GPT navigate and understand the codebase.
157
+
158
+ Here is the type of output you get when you run ctags on source code. Specifically,
159
+ this is the
160
+ `ctags --fields=+S --output-format=json` output for the `main.py` file mapped above:
161
+
162
+ ```json
163
+ {
164
+ "_type": "tag",
165
+ "name": "main",
166
+ "path": "aider/main.py",
167
+ "pattern": "/^def main(args=None, input=None, output=None):$/",
168
+ "kind": "function",
169
+ "signature": "(args=None, input=None, output=None)"
170
+ }
171
+ {
172
+ "_type": "tag",
173
+ "name": "status",
174
+ "path": "aider/main.py",
175
+ "pattern": "/^ status = main()$/",
176
+ "kind": "variable"
177
+ }
178
+ ```
179
+
180
+ The repo map is built using this type of `ctags` data,
181
+ but formatted into the space
182
+ efficient hierarchical tree format shown earlier.
183
+ This is a format that GPT can easily understand
184
+ and which conveys the map data using a
185
+ minimal number of tokens.
186
+
187
+ ## Example chat transcript
188
+
189
+ This
190
+ [chat transcript](https://aider.chat/examples/add-test.html)
191
+ shows GPT-4 creating a black box test case, **without being given
192
+ access to the source code of the function being tested or any of the
193
+ other code in the repo.** Instead, GPT is operating solely off
194
+ the repo map.
195
+
196
+ Using only the meta-data in the map, GPT is able to figure out how to call the method to be tested, as well as how to instantiate multiple class objects that are required to prepare for the test.
197
+
198
+ GPT makes one reasonable mistake writing the first version of the test, but is
199
+ able to quickly fix the issue after being shown the `pytest` error output.
200
+
201
+ ## Future work
202
+
203
+ Just as "send the whole codebase to GPT with every request"
204
+ is not an efficient solution to this problem,
205
+ there are probably better approaches than
206
+ "send the whole repo map with every request".
207
+ Sending an appropriate subset of the repo map would help `aider` work
208
+ better with even larger repositories which have large maps.
209
+
210
+ Some possible approaches to reducing the amount of map data are:
211
+
212
+ - Distill the global map, to prioritize important symbols and discard "internal" or otherwise less globally relevant identifiers. Possibly enlist `gpt-3.5-turbo` to perform this distillation in a flexible and language agnostic way.
213
+ - Provide a mechanism for GPT to start with a distilled subset of the global map, and let it ask to see more detail about subtrees or keywords that it feels are relevant to the current coding task.
214
+ - Attempt to analyize the natural language coding task given by the user and predict which subset of the repo map is relevant. Possibly by analysis of prior coding chats within the specific repo. Work on certain files or types of features may require certain somewhat predictable context from elsewhere in the repo. Vector and keyword search against the chat history, repo map or codebase may help here.
215
+
216
+ One key goal is to prefer solutions which are language agnostic or
217
+ which can be easily deployed against most popular code languages.
218
+ The `ctags` solution has this benefit, since it comes pre-built
219
+ with support for most popular languages.
220
+ I suspect that Language Server Protocol might be an even
221
+ better tool than `ctags` for this problem.
222
+ But it is more cumbersome to deploy for a broad
223
+ array of languages.
224
+ Users would need to stand up an LSP server for their
225
+ specific language(s) of interest.
226
+
227
+ ## Try it out
228
+
229
+ To use this experimental repo map feature:
230
+
231
+ - Install [aider](https://aider.chat/docs/install.html).
232
+ - Install [universal ctags](https://aider.chat/docs/install.html#install-universal-ctags-optional).
233
+ - Run `aider` inside your repo, and it should say "Repo-map: universal-ctags using 1024 tokens".
testbed/Aider-AI__aider/docs/faq.md ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Frequently asked questions
3
+
4
+ - [How does aider use git?](#how-does-aider-use-git)
5
+ - [GPT-4 vs GPT-3.5](#gpt-4-vs-gpt-35)
6
+ - [Aider isn't editing my files?](#aider-isnt-editing-my-files)
7
+ - [Can I use aider with other LLMs, local LLMs, etc?](#can-i-use-aider-with-other-llms-local-llms-etc)
8
+ - [Can I change the system prompts that aider uses?](#can-i-change-the-system-prompts-that-aider-uses)
9
+ - [Can I run aider in Google Colab?](#can-i-run-aider-in-google-colab)
10
+
11
+ ## How does aider use git?
12
+
13
+ It is recommended that you use aider with code that is part of a git repo.
14
+ This allows aider to maintain the safety of your code. Using git makes it easy to:
15
+
16
+ - Review the changes GPT made to your code
17
+ - Undo changes that weren't appropriate
18
+ - Manage a series of GPT's changes on a git branch
19
+ - etc
20
+
21
+ Working without git means that GPT might drastically change your code without an easy way to undo the changes.
22
+
23
+ Aider tries to provide safety using git in a few ways:
24
+
25
+ - It asks to create a git repo if you launch it in a directory without one.
26
+ - When you add a file to the chat, aider asks permission to add it to the git repo if needed.
27
+ - At launch and before sending requests to GPT, aider checks if the repo is dirty and offers to commit those changes for you. This way, the GPT changes will be applied to a clean repo and won't be intermingled with your own changes.
28
+ - After GPT changes your code, aider commits those changes with a descriptive commit message.
29
+
30
+ Aider also allows you to use in-chat commands to `/diff` or `/undo` the last change made by GPT.
31
+ To do more complex management of your git history, you should use `git` on the command line outside of aider.
32
+ You can start a branch before using aider to make a sequence of changes.
33
+ Or you can `git reset` a longer series of aider changes that didn't pan out. Etc.
34
+
35
+ While it is not recommended, you can disable aider's use of git in a few ways:
36
+
37
+ - `--no-auto-commits` will stop aider from git committing each of GPT's changes.
38
+ - `--no-dirty-commits` will stop aider from ensuring your repo is clean before sending requests to GPT.
39
+ - `--no-git` will completely stop aider from using git on your files. You should ensure you are keeping sensible backups of the files you are working with.
40
+
41
+
42
+ ## GPT-4 vs GPT-3.5
43
+
44
+ Aider supports all of OpenAI's chat models.
45
+ You can choose a model with the `--model` command line argument.
46
+
47
+ You will probably get the best results with one of the GPT-4 models.
48
+ They have large context windows, better coding skills and
49
+ they generally obey the instructions in the system prompt.
50
+ GPT-4 is able to structure code edits as simple "diffs"
51
+ and use a
52
+ [repository map](https://aider.chat/docs/ctags.html)
53
+ to improve its ability to make changes in larger codebases.
54
+
55
+ GPT-3.5 is supported more experimentally
56
+ and is limited to editing somewhat smaller codebases.
57
+ It is less able to follow instructions and
58
+ can't reliably return code edits as "diffs".
59
+ Aider disables the
60
+ repository map
61
+ when using GPT-3.5.
62
+
63
+ For a detailed and quantitative comparison, please see the
64
+ [code editing benchmark results for GPT-3.5 and GPT-4](https://aider.chat/docs/benchmarks.html).
65
+
66
+ In practice, this means you can use aider to edit a set of source files
67
+ that total up to the sizes below.
68
+ Just add the specific set of files to the chat
69
+ that are relevant to the change you are requesting.
70
+ This minimizes your use of the context window, as well as costs.
71
+
72
+ | Model | Context<br>Size | Edit<br>Format | Max<br>File Size | Max<br>File Size | Repo<br>Map? |
73
+ | ----------------- | -- | -- | -----| -- | -- |
74
+ | gpt-3.5-turbo | 4k tokens | whole file | 2k tokens | ~8k bytes | no |
75
+ | gpt-3.5-turbo-16k | 16k tokens | whole file | 8k tokens | ~32k bytes | no |
76
+ | gpt-4 | 8k tokens | diffs | 8k tokens | ~32k bytes | yes |
77
+ | gpt-4-32k | 32k tokens | diffs | 32k tokens | ~128k bytes | yes |
78
+
79
+ ## Aider isn't editing my files?
80
+
81
+ Sometimes GPT will reply with some code changes that don't get applied to your local files.
82
+ In these cases, aider might say something like "Failed to apply edit to *filename*".
83
+
84
+ This usually happens because GPT is not specifying the edits
85
+ to make in the format that aider expects.
86
+ GPT-3.5 is especially prone to disobeying the system prompt instructions in this manner, but it also happens with GPT-4.
87
+
88
+ Aider makes every effort to get GPT to conform, and works hard to deal with
89
+ replies that are "almost" correctly formatted.
90
+ If Aider detects an improperly formatted reply, it gives GPT feedback to try again.
91
+ Also, before each release new versions of aider are
92
+ [benchmarked](https://aider.chat/docs/benchmarks.html).
93
+ This helps prevent regressions in the code editing
94
+ performance of GPT that could have been inadvertantly
95
+ introduced.
96
+
97
+ But sometimes GPT just won't cooperate.
98
+ In these cases, here are some things you might try:
99
+
100
+ - Just ask it to try again. Explain the problem with the response if you can. Here is some suggested language which will be familiar to GPT based on its system prompt.
101
+ - With GPT-3.5, you could say something like "Send me back the new code as a properly formatted **file listing**".
102
+ - With GPT-4, you could say something like "Format those code changes properly as an **edit block**".
103
+ - "Don't skip code and replace it with comments, send me back all the code!"
104
+ - Etc...
105
+ - Use `/drop` to remove files from the chat session which aren't needed for the task at hand. This will reduce distractions and may help GPT produce properly formatted edits.
106
+ - Use `/clear` to remove the conversation history, again to help GPT focus.
107
+
108
+ ## Can I use aider with other LLMs, local LLMs, etc?
109
+
110
+ Aider only has experimental support for LLMs other than OpenAI's GPT-3.5 and GPT-4. This is for two reasons:
111
+
112
+ - GPT-3.5 is just barely capable of *editing code* to provide aider's interactive "pair programming" style workflow. None of the other models seem to be as capable as GPT-3.5.
113
+ - Just "hooking up" aider to a new model by connecting to its API is almost certainly not enough to get it working in a useful way. Getting aider working well with GPT-3.5 and GPT-4 was a significant undertaking, involving [specific code editing prompts and backends for each model and extensive benchmarking](https://aider.chat/docs/benchmarks.html). Officially supporting each new LLM will probably require a similar effort to tailor the prompts and editing backends.
114
+
115
+ That said, aider does provide features to experiment with other models. Numerous users have already done experiments with numerous models. None of these experiments have yet identified other models that look like they are capable of working with aider.
116
+
117
+ Once we see signs that a *particular* model is capable of code editing, it would be reasonable for aider to attempt to officially support such a model. Until then, aider will simply maintain experimental support for using alternative models.
118
+
119
+ There are ongoing discussions about [LLM integrations in the aider discord](https://discord.com/channels/1131200896827654144/1133060780649087048).
120
+
121
+ Here are some [GitHub issues which may contain relevant information](https://github.com/paul-gauthier/aider/issues?q=is%3Aissue+%23172).
122
+
123
+ ### OpenAI API compatible LLMs
124
+
125
+ If you can make the model accessible via an OpenAI compatible API,
126
+ you can use `--openai-api-base` to connect to a different API endpoint.
127
+
128
+ ### Local LLMs
129
+
130
+ [LocalAI](https://github.com/go-skynet/LocalAI)
131
+ and
132
+ [SimpleAI](https://github.com/lhenault/simpleAI)
133
+ look like relevant tools to serve local models via a compatible API.
134
+
135
+
136
+ ### Azure
137
+
138
+ Aider can be configured to connect to the OpenAI models on Azure.
139
+ Aider supports the configuration changes specified in the
140
+ [official openai python library docs](https://github.com/openai/openai-python#microsoft-azure-endpoints).
141
+ You should be able to run aider with the following arguments to connect to Azure:
142
+
143
+ ```
144
+ $ aider \
145
+ --openai-api-type azure \
146
+ --openai-api-key your-key-goes-here \
147
+ --openai-api-base https://example-endpoint.openai.azure.com \
148
+ --openai-api-version 2023-05-15 \
149
+ --openai-api-deployment-id deployment-name \
150
+ ...
151
+ ```
152
+
153
+ You could also store those values in an `.aider.conf.yml` file in your home directory:
154
+
155
+ ```
156
+ openai-api-type: azure
157
+ openai-api-key: your-key-goes-here
158
+ openai-api-base: https://example-endpoint.openai.azure.com
159
+ openai-api-version: 2023-05-15
160
+ openai-api-deployment-id: deployment-name
161
+ ```
162
+
163
+ See the
164
+ [official Azure documentation on using OpenAI models](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/chatgpt-quickstart?tabs=command-line&pivots=programming-language-python)
165
+ for more information on how to populate the above configuration values.
166
+
167
+
168
+
169
+
170
+ ## Can I change the system prompts that aider uses?
171
+
172
+ Aider is set up to support different system prompts and edit formats
173
+ in a modular way. If you look in the `aider/coders` subdirectory, you'll
174
+ see there's a base coder with base prompts, and then there are
175
+ a number of
176
+ different specific coder implementations.
177
+
178
+ If you're thinking about experimenting with system prompts
179
+ this document about
180
+ [benchmarking GPT-3.5 and GPT-4 on code editing](https://aider.chat/docs/benchmarks.html)
181
+ might be useful background.
182
+
183
+ While it's not well documented how to add new coder subsystems, you may be able
184
+ to modify an existing implementation or use it as a template to add another.
185
+
186
+ To get started, try looking at and modifying these files.
187
+
188
+ The wholefile coder is currently used by GPT-3.5 by default. You can manually select it with `--edit-format whole`.
189
+
190
+ - wholefile_coder.py
191
+ - wholefile_prompts.py
192
+
193
+ The editblock coder is currently used by GPT-4 by default. You can manually select it with `--edit-format diff`.
194
+
195
+ - editblock_coder.py
196
+ - editblock_prompts.py
197
+
198
+ When experimenting with coder backends, it helps to run aider with `--verbose --no-pretty` so you can see
199
+ all the raw information being sent to/from GPT in the conversation.
200
+
201
+ ## Can I run aider in Google Colab?
202
+
203
+ User [imabutahersiddik](https://github.com/imabutahersiddik)
204
+ has provided this
205
+ [Colab notebook](https://colab.research.google.com/drive/1J9XynhrCqekPL5PR6olHP6eE--rnnjS9?usp=sharing).
testbed/Aider-AI__aider/docs/voice.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Voice-to-code with aider
3
+
4
+ Speak with GPT about your code! Request new features, test cases or bug fixes using your voice and let GPT do the work of editing the files in your local git repo. As with all of aider's capabilities, you can use voice-to-code with an existing repo or to start a new project.
5
+
6
+ Voice support fits quite naturally into aider's AI pair programming chat interface. Now you can fluidly switch between voice and text chat where you ask GPT to edit the code and your own editor when it makes more sense for you to drive.
7
+
8
+ ## How to use voice-to-code
9
+
10
+ Use the in-chat `/voice` command to start recording,
11
+ and press `ENTER` when you're done speaking.
12
+ Your voice coding instructions will be transcribed
13
+ and sent to GPT, as if you had typed them into
14
+ the aider chat session.
15
+
16
+ See the [installation instructions](https://aider.chat/docs/install.html#install-portaudio-optional) for
17
+ information on how to enable the `/voice` command.
18
+
19
+ <br/>
20
+ <div class="chat-transcript" markdown="1">
21
+
22
+ > Aider v0.11.2-dev
23
+ > Added app.py to the chat.
24
+
25
+ #### /voice
26
+
27
+ <blockquote>
28
+ <div class="recording-line">
29
+ <p style="display: inline;">Recording, press ENTER when done... <span id="timer">3.5</span>sec</p>
30
+ <div id="progress-bar">
31
+ <div id="progress"></div>
32
+ </div>
33
+ </div>
34
+ </blockquote>
35
+
36
+ <style>
37
+ .recording-line > * {
38
+ display: inline-block;
39
+ vertical-align: middle;
40
+ }
41
+ #progress-bar {
42
+ width: 100px;
43
+ height: 20px;
44
+ background-color: #333;
45
+ margin-left: 10px;
46
+ }
47
+ #progress {
48
+ height: 100%;
49
+ background-color: #f0f0f0;
50
+ animation: progress 3s infinite;
51
+ }
52
+ @keyframes progress {
53
+ 0% { width: 10%; }
54
+ 20% { width: 90%; }
55
+ 50% { width: 30%; }
56
+ 60% { width: 90%; }
57
+ 80% { width: 20%; }
58
+ 100% { width: 10%; }
59
+
60
+ }
61
+ </style>
62
+
63
+ <script>
64
+ window.onload = function() {
65
+ var counter = 0;
66
+ var timer = document.getElementById('timer');
67
+ setInterval(function() {
68
+ counter = (counter + 0.1) % 9;
69
+ timer.textContent = counter.toFixed(1);
70
+ }, 100);
71
+ }
72
+ </script>
73
+
74
+ <div style="display: inline-block; position: relative; width: 200px; background-color: #f0f0f0; border-radius: 10px; padding: 10px; color: #333; font-family: 'Comic Sans MS', 'Comic Sans', 'Marker Felt', sans-serif;">
75
+ <span style="position: absolute; top: 0; left: 50%; transform: translate(-50%, -100%); width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid #f0f0f0;"></span>
76
+ “&nbsp;add a factorial endpoint that uses math factorial&nbsp;”
77
+ </div>
78
+
79
+ #### Add a factorial endpoint that uses math.factorial.
80
+
81
+ To add a factorial endpoint to the Flask application, we need to modify the `app.py` file.
82
+
83
+ Here are the steps:
84
+
85
+ 1. Add a new route `/fact/<int:x>` to the Flask application.
86
+ 2. In the function for this route, call `math.factorial(x)` and return the result as a string.
87
+
88
+ Here is the *edit block* for these changes:
89
+
90
+ ```python
91
+ app.py
92
+ <<<<<<< HEAD
93
+ if __name__ == '__main__':
94
+ print("Starting...")
95
+ app.run()
96
+ =======
97
+ @app.route('/fact/<int:x>')
98
+ def factorial(x):
99
+ result = math.factorial(x)
100
+ return str(result)
101
+
102
+ if __name__ == '__main__':
103
+ print("Starting...")
104
+ app.run()
105
+ >>>>>>> updated
106
+ ```
107
+
108
+ > Applied edit to app.py
109
+ > Commit ef9e3e7 aider: Add a factorial endpoint that uses math.factorial.
110
+
111
+ </div>
112
+ <br/>
113
+ <br/>
114
+ <br/>
testbed/Aider-AI__aider/examples/2048-game.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Modify an open source 2048 game with aider and gpt-4
3
+
4
+ In this chat transcript, the user explores and modifies an open source [javascript 2048 game repo](https://github.com/gabrielecirulli/2048).
5
+
6
+ Notice that GPT-4 asks to see a particular source file, and aider automatically includes it in the chat session after getting permission from the user.
7
+
8
+ <div class="chat-transcript" markdown="1">
9
+
10
+ > $ git clone https://github.com/gabrielecirulli/2048
11
+ > $ cd 2048
12
+ > $ aider
13
+
14
+ #### what is this repo?
15
+
16
+ Based on the file names you provided, it seems like this repository is for a web-based game, possibly a 2048 game clone. The files include JavaScript files for game logic, HTML and CSS files for the user interface, and various meta files for icons and touch startup images.
17
+
18
+ If you need help with any specific part of the code or want to add new features, please let me know, and I'll be happy to assist you.
19
+
20
+
21
+ #### how does the scoring work?
22
+
23
+ To help you with the scoring mechanism, I need to see the relevant code. Please provide the contents of the `js/game_manager.js` file, as it is likely to contain the scoring logic.
24
+
25
+
26
+ > js/game_manager.js
27
+ > Add these files to the chat? y
28
+
29
+
30
+ Apologies for the oversight. I see the contents of the `js/game_manager.js` file now.
31
+
32
+ The scoring in this 2048 game works as follows:
33
+
34
+ 1. When two tiles with the same value merge, they create a new tile with a value equal to the sum of the merged tiles' values.
35
+ 2. The score is updated by adding the value of the new merged tile.
36
+
37
+ Here's the relevant code snippet from the `js/game_manager.js` file:
38
+
39
+ ```javascript
40
+ if (next && next.value === tile.value && !next.mergedFrom) {
41
+ var merged = new Tile(positions.next, tile.value * 2);
42
+ merged.mergedFrom = [tile, next];
43
+
44
+ self.grid.insertTile(merged);
45
+ self.grid.removeTile(tile);
46
+
47
+ // Converge the two tiles' positions
48
+ tile.updatePosition(positions.next);
49
+
50
+ // Update the score
51
+ self.score += merged.value;
52
+
53
+ // The mighty 2048 tile
54
+ if (merged.value === 2048) self.won = true;
55
+ }
56
+ ```
57
+
58
+ In this code snippet, when two tiles with the same value (`tile` and `next`) are found, they are merged into a new tile (`merged`). The value of the new tile is added to the current score (`self.score += merged.value`). If the merged tile's value is 2048, the game is considered won (`self.won = true`).
59
+
60
+
61
+ #### can we add some randomness? maybe 10% of the time give the user a 10x bonus?
62
+
63
+ Sure, we can add a 10% chance of giving the user a 10x bonus when two tiles merge. To implement this, we'll modify the scoring logic in the `js/game_manager.js` file. Here's the step-by-step plan:
64
+
65
+ 1. Generate a random number between 0 and 1.
66
+ 2. Check if the random number is less than or equal to 0.1 (10% chance).
67
+ 3. If the condition is met, multiply the merged tile's value by 10 before adding it to the score.
68
+
69
+ Here's the code change for the `js/game_manager.js` file:
70
+
71
+ ```javascript
72
+ js/game_manager.js
73
+ <<<<<<< ORIGINAL
74
+ // Update the score
75
+ self.score += merged.value;
76
+ =======
77
+ // Update the score with a 10% chance of 10x bonus
78
+ var bonus = Math.random() <= 0.1 ? 10 : 1;
79
+ self.score += merged.value * bonus;
80
+ >>>>>>> UPDATED
81
+ ```
82
+
83
+ This change will give the user a 10x bonus 10% of the time when two tiles merge.
84
+
85
+ > Applied edit to js/game_manager.js
86
+ > Commit eb9d882 aider: Added a 10% chance of giving the user a 10x bonus when two tiles merge.
87
+
88
+ </div>
testbed/Aider-AI__aider/examples/README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # What's it like to code with GPT-4 and aider?
2
+
3
+ Below are some chat transcripts showing what it's like to code with the help of GPT-4 using the `aider` command-line chat tool.
4
+ In the chats, you'll see a varity of coding tasks like generating new code, editing existing code, debugging, exploring unfamiliar code, etc.
5
+
6
+ * [**Hello World Flask App**](https://aider.chat/examples/hello-world-flask.html): Start from scratch and have GPT create a simple Flask app with various endpoints, such as adding two numbers and calculating the Fibonacci sequence.
7
+
8
+ * [**Javascript Game Modification**](https://aider.chat/examples/2048-game.html): Dive into an existing open-source repo, and get GPT's help to understand it and make modifications.
9
+
10
+ * [**Complex Multi-file Change with Debugging**](https://aider.chat/examples/complex-change.html): GPT makes a complex code change that is coordinated across multiple source files, and resolves bugs by reviewing error output and doc snippets.
11
+
12
+ * [**Create a Black Box Test Case**](https://aider.chat/examples/add-test.html): GPT creates a "black box" test case without access to the source of the method being tested, using only a [high level map of the repository based on ctags](https://aider.chat/docs/ctags.html).
13
+
14
+ * [**Honor the NO_COLOR env var**](https://aider.chat/examples/no-color.html): The user pastes the NO_COLOR spec from no-color.org into the chat, and GPT-4 modifies the application to conform.
15
+
16
+ * [**Download, analyze and plot US Census data**](https://aider.chat/examples/census.html): GPT-4 downloads census data, suggests some hypotheses to test, tests one and then summarizes and plots a graph of the results.
17
+
18
+ * [**Semantic Search & Replace**](semantic-search-replace.md): Updating a collection of function calls, which requires dealing with various formatting and semantic differences in the various function call sites.
19
+
20
+ * [**Pong Game with Pygame**](pong.md): Creating a simple Pong game using the Pygame library, with customizations for paddle size and color, and ball speed adjustments.
21
+
22
+ * [**CSS Exercise: Animation Dropdown Menu**](css-exercises.md): A small CSS exercise involving adding animation to a dropdown menu.
23
+
24
+ * [**Automatically Update Docs**](update-docs.md): Automatically updating documentation based on the latest version of the main() function.
25
+
26
+ * [**Editing an Asciinema Cast File**](asciinema.md): Editing escape sequences in an `asciinema` screencast file.
27
+
28
+ ## What's happening in these chats?
29
+
30
+ To better understand the chat transcripts, it's worth knowing that:
31
+
32
+ - Each time GPT-4 suggests a code change, `aider` automatically applies it to the source files.
33
+ - After applying the edits, `aider` commits them to git with a descriptive commit message.
34
+ - GPT-4 can only see and edit files which have been "added to the chat session". The user adds files either via the command line or the in-chat `/add` command. If GPT-4 asks to see specific files, `aider` asks the user for permission to add them to the chat. The transcripts contain notifications from `aider` whenever a file is added or dropped from the session.
35
+
36
+ ## Transcript formatting
37
+
38
+ <div class="chat-transcript" markdown="1">
39
+
40
+ > This is output from the aider tool.
41
+
42
+ #### These are chat messages written by the user.
43
+
44
+ Chat responses from GPT-4 are in a blue font like this, and often include colorized "edit blocks" that specify edits to the code.
45
+ Here's a sample edit block that switches from printing "hello" to "goodbye":
46
+
47
+ ```python
48
+ hello.py
49
+ <<<<<<< ORIGINAL
50
+ print("hello")
51
+ =======
52
+ print("goodbye")
53
+ >>>>>>> UPDATED
54
+ ```
55
+
56
+ </div>
testbed/Aider-AI__aider/examples/add-test.md ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Create a "black box" test case
3
+
4
+ This transcript shows GPT-4 creating a black box test case,
5
+ **without being given
6
+ access to the source code of the function being tested or any of the
7
+ other code in the repo.**
8
+
9
+ Instead, GPT is operating entirely off a
10
+ [high level map of the repository based on ctags](https://aider.chat/docs/ctags.html),
11
+ which provides details on all the symbols and function signatures in the repo.
12
+ Using only the meta-data in the map, GPT is able to figure out how to call the method to be tested, as well as how to instantiate multiple class objects that are required to prepare for the test.
13
+
14
+ In detail, GPT is able to use the repo map to:
15
+
16
+ - Find the function signature of the `cmd_add()` function which the user wants a test case for.
17
+ - Determine that it is a method of the `Command` class, so the test case will need to instantiate an instance to conduct the test.
18
+ - Identify that creating a `Command` instance requires passing in `InputOutput` and `Coder` instances.
19
+ - Figure out the arguments required to instantiate the `InputOutput` instance.
20
+ - Decide that the `Coder` class looks complex enough to use a `MagickMock`.
21
+
22
+ The `cmd_add()` method is defined without type annotations, so GPT makes a
23
+ reasonable but incorrect guess that it accepts a `list` of files. The
24
+ user invokes the `/run` command to run the new unit test, which throws an
25
+ error based on this misunderstanding.
26
+
27
+ GPT reviews the error message and fixes the call to `cmd_add()` to
28
+ correctly pass a `str` with a space-separated list of filenames
29
+ instead. The test then passes on the next `/run`.
30
+
31
+ <div class="chat-transcript" markdown="1">
32
+
33
+ > $ aider tests/test_commands.py
34
+ > Creating empty file tests/test_commands.py
35
+ > Added tests/test_commands.py to the chat
36
+ > Files not tracked in .git:
37
+ > - tests/test_commands.py
38
+ >
39
+ > Add them? y
40
+ > Added tests/test_commands.py to the git repo
41
+ > Commit b9cea2c Added new files to the git repo: tests/test_commands.py
42
+ > Using git repo: .git
43
+
44
+ #### add a test for cmd_add that passes in 'foo.txt' and 'bar.txt' and ensures they have both been created after the test. run the test in a tmp dir.
45
+
46
+ I will add a new test method called `test_cmd_add` in the `tests/test_commands.py` file. This test will create a temporary directory, change the current working directory to the temporary directory, and then call the `cmd_add` method with 'foo.txt' and 'bar.txt' as arguments. After that, it will check if both files have been created in the temporary directory.
47
+
48
+ Here's the code change:
49
+
50
+ ```python
51
+ tests/test_commands.py
52
+ <<<<<<< ORIGINAL
53
+ =======
54
+ import os
55
+ import tempfile
56
+ from unittest import TestCase
57
+ from unittest.mock import MagicMock
58
+ from aider.commands import Commands
59
+ from aider.io import InputOutput
60
+
61
+ class TestCommands(TestCase):
62
+ def test_cmd_add(self):
63
+ # Create a temporary directory and change the current working directory
64
+ with tempfile.TemporaryDirectory() as tmpdir:
65
+ os.chdir(tmpdir)
66
+
67
+ # Initialize the Commands and InputOutput objects
68
+ io = InputOutput(pretty=False, yes=True)
69
+ coder = MagicMock()
70
+ commands = Commands(io, coder)
71
+
72
+ # Call the cmd_add method with 'foo.txt' and 'bar.txt'
73
+ commands.cmd_add(["foo.txt", "bar.txt"])
74
+
75
+ # Check if both files have been created in the temporary directory
76
+ self.assertTrue(os.path.exists("foo.txt"))
77
+ self.assertTrue(os.path.exists("bar.txt"))
78
+ >>>>>>> UPDATED
79
+ ```
80
+
81
+ This test will ensure that the `cmd_add` method creates the specified files in the current working directory.
82
+
83
+ > Applied edit to tests/test_commands.py
84
+ > Commit e2d5212 aider: Added a test method `test_cmd_add` that creates a temporary directory, calls the `cmd_add` method with 'foo.txt' and 'bar.txt', and checks if both files have been created in the temporary directory.
85
+
86
+ #### /run pytest tests/test_commands.py
87
+
88
+ > ```
89
+ > ============================= test session starts ==============================
90
+ > platform darwin -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
91
+ > rootdir: /Users/gauthier/Projects/aider
92
+ > collected 1 item
93
+ >
94
+ > tests/test_commands.py F [100%]
95
+ >
96
+ > =================================== FAILURES ===================================
97
+ > __________________________ TestCommands.test_cmd_add ___________________________
98
+ >
99
+ > self = <tests.test_commands.TestCommands testMethod=test_cmd_add>
100
+ >
101
+ > def test_cmd_add(self):
102
+ > # Create a temporary directory and change the current working directory
103
+ > with tempfile.TemporaryDirectory() as tmpdir:
104
+ > os.chdir(tmpdir)
105
+ >
106
+ > # Initialize the Commands and InputOutput objects
107
+ > io = InputOutput(pretty=False, yes=True)
108
+ > coder = MagicMock()
109
+ > commands = Commands(io, coder)
110
+ >
111
+ > # Call the cmd_add method with 'foo.txt' and 'bar.txt'
112
+ > > commands.cmd_add(["foo.txt", "bar.txt"])
113
+ >
114
+ > /Users/gauthier/Projects/aider/tests/test_commands.py:20:
115
+ > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
116
+ >
117
+ > self = <aider.commands.Commands object at 0x10b412b50>
118
+ > args = ['foo.txt', 'bar.txt']
119
+ >
120
+ > def cmd_add(self, args):
121
+ > "Add matching files to the chat session"
122
+ >
123
+ > added_fnames = []
124
+ > files = self.coder.get_all_relative_files()
125
+ > > for word in args.split():
126
+ > E AttributeError: 'list' object has no attribute 'split'
127
+ >
128
+ > /Users/gauthier/Projects/aider/aider/commands.py:161: AttributeError
129
+ > =========================== short test summary info ============================
130
+ > FAILED tests/test_commands.py::TestCommands::test_cmd_add - AttributeError: '...
131
+ > ============================== 1 failed in 0.34s ===============================
132
+ > ```
133
+ >
134
+ > Add the output to the chat? [y/n] (y): y
135
+
136
+ It seems that the `cmd_add` method in `aider/commands.py` is expecting a string as input, but in the test, we are passing a list. I will update the test to pass a string instead of a list.
137
+
138
+ Here's the code change:
139
+
140
+ ```python
141
+ tests/test_commands.py
142
+ <<<<<<< ORIGINAL
143
+ # Call the cmd_add method with 'foo.txt' and 'bar.txt'
144
+ commands.cmd_add(["foo.txt", "bar.txt"])
145
+ =======
146
+ # Call the cmd_add method with 'foo.txt' and 'bar.txt' as a single string
147
+ commands.cmd_add("foo.txt bar.txt")
148
+ >>>>>>> UPDATED
149
+ ```
150
+
151
+ Now, run the test again with the updated test method:
152
+
153
+ ```
154
+ pytest tests/test_commands.py
155
+ ```
156
+
157
+ > Applied edit to tests/test_commands.py
158
+ > Commit d1551b4 aider: Updated test to pass a string instead of a list when calling `cmd_add` method.
159
+
160
+ #### /run pytest tests/test_commands.py
161
+
162
+ > ```
163
+ > ============================= test session starts ==============================
164
+ > platform darwin -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
165
+ > rootdir: /Users/gauthier/Projects/aider
166
+ > collected 1 item
167
+ >
168
+ > tests/test_commands.py . [100%]
169
+ >
170
+ > ============================== 1 passed in 0.38s ===============================
171
+ > ```
172
+
173
+ </div>
testbed/Aider-AI__aider/examples/asciinema.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Editing an asciinema cast file with aider and gpt-4
3
+
4
+ The user needs to make some tedious edits to the escape sequences in an `asciinema` screencast file.
5
+
6
+ <div class="chat-transcript" markdown="1">
7
+
8
+ > $ aider hello.cast
9
+ > Added hello.cast to the chat
10
+
11
+ #### when the "hello.py> " prompt is displayed, it's including some escape codes to add a few blank lines below the prompt and then bringing the cursor back up. remove all that. just show the prompt followed by a space and leave the cursor showing right after that.
12
+
13
+ ```python
14
+ hello.cast
15
+ <<<<<<< ORIGINAL
16
+ [19.534013, "o", "\u001b[?2004h\u001b[?1l\u001b[?25l\u001b[0m\u001b[?7l\u001b[0m\u001b[J\u001b[0;38;5;28mhello.py> \u001b[0m\r\r\n\r\r\n\r\r\n\u001b[0;38;5;28m \r\u001b[64C \r\u001b[3A\u001b[10C\u001b[?7h\u001b[0m\u001b[?12l\u001b[?25h"]
17
+ =======
18
+ [19.534013, "o", "\u001b[?2004h\u001b[?1l\u001b[?25l\u001b[0m\u001b[?7l\u001b[0m\u001b[J\u001b[0;38;5;28mhello.py> \u001b[0m\u001b[?7h\u001b[0m\u001b[?12l\u001b[?25h"]
19
+ >>>>>>> UPDATED
20
+ ```
21
+
22
+ > Applied edit to hello.cast
23
+ > Commit a3fa4d2 aider: Removed escape codes to display prompt and cursor correctly.
24
+
25
+
26
+ </div>
testbed/Aider-AI__aider/examples/census.md ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Download, analyze and plot US Census data
3
+
4
+ Inspired by
5
+ [Ethan Mollick's recent blog article about ChatGPT plugins](https://www.oneusefulthing.org/p/it-is-starting-to-get-strange),
6
+ I used `aider` and GPT-4 to do data analysis of some US Census data.
7
+ I asked GPT-4 how to download census data and to suggest some
8
+ hypotheses to test. I asked it to write the code to get the data, test one of the
9
+ hypotheses and provide a summary and plot of the results.
10
+
11
+ <div class="chat-transcript" markdown="1">
12
+
13
+ > $ aider
14
+ > Using git repo: .git
15
+
16
+ #### what is a good basic us census dataset to analyze for interesting patterns?
17
+
18
+ A good basic US Census dataset to analyze for interesting patterns is the American Community Survey (ACS) dataset. The ACS is an ongoing survey conducted by the US Census Bureau that provides vital information on a yearly basis about the US population and its characteristics. The dataset includes information on demographics, social, economic, and housing characteristics.
19
+
20
+ You can find the ACS dataset on the US Census Bureau's website: https://www.census.gov/programs-surveys/acs/data.html
21
+
22
+ Some interesting patterns to analyze in the ACS dataset could include:
23
+
24
+ 1. Population growth and decline in different regions.
25
+ 2. Changes in racial and ethnic composition.
26
+ 3. Income inequality and poverty levels.
27
+ 4. Educational attainment and its relationship with income.
28
+ 5. Housing affordability and homeownership rates.
29
+
30
+ Remember to consider the dataset's documentation and guidelines to understand the data and its limitations.
31
+
32
+
33
+ #### do you know how to download American Community Survey data?
34
+
35
+ Yes, I can guide you on how to download American Community Survey (ACS) data. You can use the Census Bureau's API to access the data. To do this, you'll need an API key, which you can obtain from the Census Bureau's website.
36
+
37
+ Here's a Python example using the `requests` library to download ACS data:
38
+
39
+ 1. Install the `requests` library if you haven't already:
40
+
41
+ ```
42
+ pip install requests
43
+ ```
44
+
45
+ 2. Use the following code to download ACS data:
46
+
47
+ ```python
48
+ import requests
49
+
50
+ # Replace 'your_api_key' with your actual API key
51
+ api_key = 'your_api_key'
52
+
53
+ # Define the API endpoint and parameters
54
+ url = 'https://api.census.gov/data/2019/acs/acs5'
55
+ params = {
56
+ 'get': 'NAME,B01001_001E', # Variables to retrieve (NAME: Geographic area name, B01001_001E: Total population)
57
+ 'for': 'state:*', # Geographic area (all states)
58
+ 'key': api_key
59
+ }
60
+
61
+ # Send the request and parse the response
62
+ response = requests.get(url, params=params)
63
+ data = response.json()
64
+
65
+ # Print the data
66
+ for row in data:
67
+ print(row)
68
+ ```
69
+
70
+ Replace `'your_api_key'` with the API key you obtained from the Census Bureau's website. This example retrieves the total population (variable `B01001_001E`) for all states. You can modify the `get` and `for` parameters to download different variables and geographic areas.
71
+
72
+ For more information on available variables and geographic areas, refer to the ACS documentation:
73
+
74
+ - Variables: https://api.census.gov/data/2019/acs/acs5/variables.html
75
+ - Geographic Areas: https://api.census.gov/data/2019/acs/acs5/geography.html
76
+
77
+
78
+ #### how do i get an api key?
79
+
80
+ To obtain an API key from the Census Bureau, follow these steps:
81
+
82
+ 1. Go to the Census Bureau's API key request page: https://api.census.gov/data/key_signup.html
83
+
84
+ 2. Fill out the form with your name, email address, organization (if applicable), and a brief description of your intended use of the API.
85
+
86
+ 3. Click the "Request Key" button.
87
+
88
+ 4. You will receive an email containing your API key. It may take a few minutes for the email to arrive. Make sure to check your spam folder if you don't see it in your inbox.
89
+
90
+ Once you have your API key, you can use it in your Python code to access the American Community Survey data, as shown in the previous example. Replace `'your_api_key'` with the API key you received in the email.
91
+
92
+
93
+ #### please save your download script as `getdata.py`
94
+
95
+ Here's the `getdata.py` file with the download script:
96
+
97
+ ```python
98
+ new_file/getdata.py
99
+ <<<<<<< ORIGINAL
100
+ =======
101
+ import requests
102
+
103
+ # Replace 'your_api_key' with your actual API key
104
+ api_key = 'your_api_key'
105
+
106
+ # Define the API endpoint and parameters
107
+ url = 'https://api.census.gov/data/2019/acs/acs5'
108
+ params = {
109
+ 'get': 'NAME,B01001_001E', # Variables to retrieve (NAME: Geographic area name, B01001_001E: Total population)
110
+ 'for': 'state:*', # Geographic area (all states)
111
+ 'key': api_key
112
+ }
113
+
114
+ # Send the request and parse the response
115
+ response = requests.get(url, params=params)
116
+ data = response.json()
117
+
118
+ # Print the data
119
+ for row in data:
120
+ print(row)
121
+ >>>>>>> UPDATED
122
+ ```
123
+
124
+ Save this code in a new file named `getdata.py`. Remember to replace `'your_api_key'` with your actual API key obtained from the Census Bureau.
125
+
126
+ > Allow creation of new file new_file/getdata.py? y
127
+ > Add new_file/getdata.py to git? y
128
+ > Applied edit to new_file/getdata.py
129
+ > Commit afcb9d1 aider: Added `getdata.py` file with download script.
130
+
131
+ #### add my api key: 4ae31ed2a0f0dd62609e51cd95deadbeefe7774f
132
+
133
+ I will update the API key in the file.
134
+
135
+ ```python
136
+ new_file/getdata.py
137
+ <<<<<<< ORIGINAL
138
+ api_key = 'your_api_key'
139
+ =======
140
+ api_key = '4ae31ed2a0f0dd62609e51cd95deadbeefe7774f'
141
+ >>>>>>> UPDATED
142
+ ```
143
+
144
+ > Applied edit to new_file/getdata.py
145
+ > Commit 1d8b4a6 aider: Updated the API key in new_file/getdata.py.
146
+
147
+
148
+ #### what are some interesting hypothesis that you might be able to test using ACS data?
149
+
150
+ Here are some interesting hypotheses that you can test using ACS (American Community Survey) data:
151
+
152
+ 1. Relationship between income and education level: Higher education levels lead to higher income.
153
+ 2. Impact of population density on housing prices: Higher population density areas have higher housing prices.
154
+ 3. Relationship between employment rate and crime rate: Higher employment rates lead to lower crime rates.
155
+ 4. Effect of public transportation availability on car ownership: Areas with better public transportation have lower car ownership rates.
156
+ 5. Relationship between age distribution and healthcare facilities: Areas with a higher percentage of elderly population have more healthcare facilities.
157
+
158
+ These are just a few examples. ACS data provides a wealth of information on various demographic, social, economic, and housing characteristics, allowing you to explore many different hypotheses.
159
+
160
+
161
+ #### can you download the data to test #2 Impact of population density on housing prices: Higher population density areas have higher housing prices.
162
+
163
+ As an AI language model, I cannot directly download or access data. However, I can help you with the code to download the required data for testing hypothesis #2 using the ACS data.
164
+
165
+ To test the hypothesis, you'll need to obtain population density and housing price data. You can use the following ACS variables:
166
+
167
+ - B01003_001E: Total population
168
+ - B25077_001E: Median value of owner-occupied housing units
169
+
170
+ Here's the updated code to fetch the required data:
171
+
172
+ ```python
173
+ new_file/getdata.py
174
+ <<<<<<< ORIGINAL
175
+ 'get': 'NAME,B01001_001E', # Variables to retrieve (NAME: Geographic area name, B01001_001E: Total population)
176
+ =======
177
+ 'get': 'NAME,B01003_001E,B25077_001E', # Variables to retrieve (NAME: Geographic area name, B01003_001E: Total population, B25077_001E: Median value of owner-occupied housing units)
178
+ >>>>>>> UPDATED
179
+ ```
180
+
181
+ After running the updated code, you'll have the population and housing price data for each geographic area. You can then analyze the data to test the hypothesis.
182
+
183
+ > Applied edit to new_file/getdata.py
184
+ > Commit 81549ab aider: Updated code to fetch population and housing price data for testing hypothesis #2.
185
+
186
+ #### instead of printing all the data, print a summary table that shows whether the data supports the hypothesis
187
+
188
+ To print a summary table, you can use the pandas library to analyze the data and calculate the correlation between population density and housing prices. Here's how to modify the code:
189
+
190
+ 1. Import pandas.
191
+ 2. Convert the JSON data to a pandas DataFrame.
192
+ 3. Calculate the correlation between population density and housing prices.
193
+ 4. Print the correlation as a summary table.
194
+
195
+ Here are the changes to the code:
196
+
197
+ ```python
198
+ new_file/getdata.py
199
+ <<<<<<< ORIGINAL
200
+ import requests
201
+ =======
202
+ import requests
203
+ import pandas as pd
204
+ >>>>>>> UPDATED
205
+ ```
206
+
207
+ ```python
208
+ new_file/getdata.py
209
+ <<<<<<< ORIGINAL
210
+ data = response.json()
211
+ =======
212
+ data = response.json()
213
+ # Convert the JSON data to a pandas DataFrame
214
+ df = pd.DataFrame(data[1:], columns=data[0])
215
+ df[['B01003_001E', 'B25077_001E']] = df[['B01003_001E', 'B25077_001E']].apply(pd.to_numeric)
216
+ >>>>>>> UPDATED
217
+ ```
218
+
219
+ ```python
220
+ new_file/getdata.py
221
+ <<<<<<< ORIGINAL
222
+ for row in data:
223
+ print(row)
224
+ =======
225
+ # Calculate the correlation between population density and housing prices
226
+ correlation = df['B01003_001E'].corr(df['B25077_001E'])
227
+
228
+ # Print the correlation as a summary table
229
+ print("Summary Table:")
230
+ print("Correlation between population density and housing prices:", correlation)
231
+ >>>>>>> UPDATED
232
+ ```
233
+
234
+ After applying these changes, the code will print a summary table showing the correlation between population density and housing prices. A positive correlation value indicates that higher population density areas have higher housing prices, supporting the hypothesis.
235
+
236
+ > Applied edit to new_file/getdata.py
237
+ > Applied edit to new_file/getdata.py
238
+ > Applied edit to new_file/getdata.py
239
+ > Commit 2f4fcd4 aider: Added pandas library to analyze data and calculate correlation between population density and housing prices, and printed the correlation as a summary table.
240
+
241
+
242
+ #### /run python3 new_file/getdata.py
243
+ >```
244
+ >Summary Table:
245
+ >Correlation between population density and housing prices: 0.16020298445808737
246
+ >```
247
+ >
248
+ > Add the output to the chat? y
249
+
250
+ Great! The script seems to be working as expected. The correlation between population density and housing prices is 0.1602. If you need any further assistance or modifications to the code, please let me know.
251
+
252
+
253
+ #### can you also plot a graph which would show any correlation?
254
+
255
+ To plot a graph showing the correlation between population density and housing prices, we'll need to modify the `new_file/getdata.py` file. We'll use the `matplotlib` library to create the plot. If you don't have it installed, you can install it using `pip install matplotlib`.
256
+
257
+ Here are the changes to make:
258
+
259
+ 1. Import the `matplotlib.pyplot` module.
260
+ 2. Create a scatter plot of population density (x-axis) and housing prices (y-axis).
261
+ 3. Add labels to the axes and a title to the plot.
262
+ 4. Display the plot.
263
+
264
+ Here's the updated code:
265
+
266
+ ```python
267
+ new_file/getdata.py
268
+ <<<<<<< ORIGINAL
269
+ import requests
270
+ import pandas as pd
271
+ =======
272
+ import requests
273
+ import pandas as pd
274
+ import matplotlib.pyplot as plt
275
+ >>>>>>> UPDATED
276
+
277
+ ...
278
+
279
+ new_file/getdata.py
280
+ <<<<<<< ORIGINAL
281
+ print("Summary Table:")
282
+ print("Correlation between population density and housing prices:", correlation)
283
+ =======
284
+ print("Summary Table:")
285
+ print("Correlation between population density and housing prices:", correlation)
286
+
287
+ # Create a scatter plot of population density and housing prices
288
+ plt.scatter(df['B01003_001E'], df['B25077_001E'])
289
+ plt.xlabel('Population Density')
290
+ plt.ylabel('Housing Prices')
291
+ plt.title('Correlation between Population Density and Housing Prices')
292
+ plt.show()
293
+ >>>>>>> UPDATED
294
+ ```
295
+
296
+ This will create a scatter plot of population density and housing prices, which will help visualize the correlation between the two variables.
297
+
298
+ > Applied edit to new_file/getdata.py
299
+ > Applied edit to new_file/getdata.py
300
+ > Commit 9ff3666 aider: Added scatter plot of population density and housing prices to visualize correlation.
301
+
302
+
303
+ </div>
304
+
305
+ ![aider screenshot](../assets/figure.png)
testbed/Aider-AI__aider/examples/chat-transcript-css.md ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Improve css styling of chat transcripts
3
+
4
+ <div class="chat-transcript" markdown="1">
5
+
6
+ > $ aider index.html assets/css/style.css
7
+ > Added index.html to the chat
8
+ > Added assets/css/style.css to the chat
9
+
10
+
11
+ #### add a rounded border to all sides of the boxquote
12
+
13
+ ```css
14
+ assets/css/style.css
15
+ <<<<<<< ORIGINAL
16
+ .main-content blockquote{padding:0 1rem;margin-left:0;color:#819198;border-left:0.3rem solid #dce6f0}
17
+ =======
18
+ .main-content blockquote{
19
+ padding: 0 1rem;
20
+ margin
21
+ ```
22
+
23
+ > ^C KeyboardInterrupt
24
+ > ^C again to quit
25
+
26
+
27
+ #### make all the edits to the embedded style tag in the html
28
+
29
+ ```html
30
+ index.html
31
+ <<<<<<< ORIGINAL
32
+ <style>
33
+ .main-content blockquote {
34
+ border-left-color: #159957;
35
+ }
36
+ .btn {
37
+ display: inline-block;
38
+ width: auto;
39
+ }
40
+ .btn + .btn {
41
+ margin-top: 0;
42
+ }
43
+ </style>
44
+ =======
45
+ <style>
46
+ .main-content blockquote {
47
+ border-left-color: #159957;
48
+ border: 0.3rem solid #dce6f0;
49
+ border-radius: 0.5rem;
50
+ }
51
+ .btn {
52
+ display: inline-block;
53
+ width: auto;
54
+ }
55
+ .btn + .btn {
56
+ margin-top: 0;
57
+ }
58
+ </style>
59
+ >>>>>>> UPDATED
60
+ ```
61
+
62
+ > Applied edit to index.html
63
+ > Commit e7a5cb5 aider: Added rounded border to all sides of the boxquote.
64
+
65
+
66
+ #### (blank)
67
+ > Git repo has uncommitted changes.
68
+ > Commit before the chat proceeds [y/n/commit message]? Changed border color and width of blockquote in index.html.
69
+ > Commit 6898a1d Changed border color and width of blockquote in index.html.
70
+
71
+
72
+ #### make the blockquote font color the same as the p color
73
+ > Git repo has uncommitted changes.
74
+ > Commit before the chat proceeds [y/n/commit message]? Added note about missing method and incorrect method calls in index.html.
75
+ > Commit 2d31f5b Added note about missing method and incorrect method calls in index.html.
76
+
77
+ ```css
78
+ assets/css/style.css
79
+ <<<<<<< ORIGINAL
80
+ .main-content blockquote{padding:0 1rem;margin-left:0;color:#819198;border-left
81
+ ```
82
+
83
+ > ^C KeyboardInterrupt
84
+
85
+
86
+ #### only edit index.html
87
+
88
+ ```html
89
+ index.html
90
+ <<<<<<< ORIGINAL
91
+ <style>
92
+ .main-content blockquote {
93
+ border: 0.1rem solid #159957;
94
+ border-radius: 0.5rem;
95
+ }
96
+ .btn {
97
+ display: inline-block;
98
+ width: auto;
99
+ }
100
+ .btn + .btn {
101
+ margin-top: 0;
102
+ }
103
+ </style>
104
+ =======
105
+ <style>
106
+ .main-content blockquote {
107
+ border: 0.1rem solid #159957;
108
+ border-radius: 0.5rem;
109
+ color: #606c71;
110
+ }
111
+ .btn {
112
+ display: inline-block;
113
+ width: auto;
114
+ }
115
+ .btn + .btn {
116
+ margin-top: 0;
117
+ }
118
+ </style>
119
+ >>>>>>> UPDATED
120
+ ```
121
+
122
+ > Applied edit to index.html
123
+ > Commit 8645217 aider: Changed blockquote font color to match <p> color in index.html.
124
+
125
+
126
+ #### (blank)
127
+ > Git repo has uncommitted changes.
128
+ > Commit before the chat proceeds [y/n/commit message]? Removed color and button styles from blockquote in index.html.
129
+ > Commit f8d4782 Removed color and button styles from blockquote in index.html.
130
+
131
+
132
+ #### make the blockquote background a lighter shade of the same green as the border
133
+
134
+ ```html
135
+ index.html
136
+ <<<<<<< ORIGINAL
137
+ <style>
138
+ .main-content blockquote {
139
+ border: 0.1rem solid #159957;
140
+ border-radius: 0.5rem;
141
+ }
142
+ =======
143
+ <style>
144
+ .main-content blockquote {
145
+ border: 0.1rem solid #159957;
146
+ border-radius: 0.5rem;
147
+ background-color: #e0f2ef;
148
+ }
149
+ >>>>>>> UPDATED
150
+ ```
151
+
152
+ > Applied edit to index.html
153
+ > Commit 57b7b10 aider: Changed blockquote background color to a lighter shade of green.
154
+
155
+
156
+ #### add some space inside the border of the blockquote
157
+
158
+ ```html
159
+ index.html
160
+ <<<<<<< ORIGINAL
161
+ <style>
162
+ .main-content blockquote {
163
+ border: 0.1rem solid #159957;
164
+ border-radius: 0.5rem;
165
+ background-color: #e0f2ef;
166
+ }
167
+ =======
168
+ <style>
169
+ .main-content blockquote {
170
+ border: 0.1rem solid #159957;
171
+ border-radius: 0.5rem;
172
+ background-color: #e0f2ef;
173
+ padding: 1rem;
174
+ }
175
+ >>>>>>> UPDATED
176
+ ```
177
+
178
+ > Applied edit to index.html
179
+ > Commit dd7dcb6 aider: Added padding inside the border of the blockquote.
180
+
181
+
182
+ #### can we add a label "aider" along the top of the blockquote box only using style
183
+
184
+ ```html
185
+ index.html
186
+ <<<<<<< ORIGINAL
187
+ <style>
188
+ .main-content blockquote {
189
+ border: 0.1rem solid #159957;
190
+ border-radius: 0.5rem;
191
+ background-color: #e0f2ef;
192
+ padding: 1rem;
193
+ }
194
+ </style>
195
+ =======
196
+ <style>
197
+ .main-content blockquote {
198
+ border: 0.1rem solid #159957;
199
+ border-radius: 0.5rem;
200
+ background-color: #e0f2ef;
201
+ padding: 1rem;
202
+ position: relative;
203
+ }
204
+ .main-content blockquote::before {
205
+ content: "aider";
206
+ display: inline-block;
207
+ position: absolute;
208
+ top: -0.5rem;
209
+ left: 1rem;
210
+ background-color: #e0f2ef;
211
+ padding: 0 0.5rem;
212
+ font-weight: bold;
213
+ color: #159957;
214
+ }
215
+ </style>
216
+ >>>>>>> UPDATED
217
+ ```
218
+
219
+ > Applied edit to index.html
220
+ > Commit 0b0e332 aider: Added label "aider" to the top of the blockquote box using style.
221
+
222
+
223
+ #### add more padding on the top of the box and bring the label into the box so it doesn't intersect the border
224
+
225
+ ```html
226
+ index.html
227
+ <<<<<<< ORIGINAL
228
+ <style>
229
+ .main-content blockquote {
230
+ border: 0.1rem solid #159957;
231
+ border-radius: 0.5rem;
232
+ background-color: #e0f2ef;
233
+ padding: 1rem;
234
+ position: relative;
235
+ }
236
+ .main-content blockquote::before {
237
+ content: "aider";
238
+ display: inline-block;
239
+ position: absolute;
240
+ top: -0.5rem;
241
+ left: 1rem;
242
+ background-color: #e0f2ef;
243
+ padding: 0 0.5rem;
244
+ font-weight: bold;
245
+ color: #159957;
246
+ }
247
+ </style>
248
+ =======
249
+ <style>
250
+ .main-content blockquote {
251
+ border: 0.1rem solid #159957;
252
+ border-radius: 0.5rem;
253
+ background-color: #e0f2ef;
254
+ padding: 1.5rem 1rem 1rem 1rem;
255
+ position: relative;
256
+ }
257
+ .main-content blockquote::before {
258
+ content: "aider";
259
+ display: inline-block;
260
+ position: absolute;
261
+ top: 0.5rem;
262
+ left: 1rem;
263
+ background-color: #e0f2ef;
264
+ padding: 0 0.5rem;
265
+ font-weight: bold;
266
+ color: #159957;
267
+ }
268
+ </style>
269
+ >>>>>>> UPDATED
270
+ ```
271
+
272
+ > Applied edit to index.html
273
+ > Commit eee902e aider: Added more padding on the top of the box and brought the label into the box so it doesn't intersect the border.
274
+
275
+
276
+ #### (blank)
277
+ > Git repo has uncommitted changes.
278
+ > Commit before the chat proceeds [y/n/commit message]? Changed padding and added margin to main-content blockquote.
279
+ > Commit c9128d1 Changed padding and added margin to main-content blockquote.
280
+
281
+
282
+ #### change all the blockquote colors to be shades of blue instead of green. choose the blue based on the blue in the header gradient
283
+
284
+ ```html
285
+ index.html
286
+ <<<<<<< ORIGINAL
287
+ <style>
288
+ .main-content blockquote {
289
+ border: 0.1rem solid #159957;
290
+ border-radius: 0.5rem;
291
+ background-color: #e0f2ef;
292
+ padding: 0.75rem;
293
+ position: relative;
294
+ margin-top: 2rem;
295
+ }
296
+ .main-content blockquote::before {
297
+ content: "aider";
298
+ display: inline-block;
299
+ position: absolute;
300
+ top: -1.75rem;
301
+ left: -0.5rem;
302
+ padding: 0 0.5rem;
303
+ font-weight: bold;
304
+ color: #159957;
305
+ }
306
+ </style>
307
+ =======
308
+ <style>
309
+ .main-content blockquote {
310
+ border: 0.1rem solid #155799;
311
+ border-radius: 0.5rem;
312
+ background-color: #e0ecf4;
313
+ padding: 0.75rem;
314
+ position: relative;
315
+ margin-top: 2rem;
316
+ }
317
+ .main-content blockquote::before {
318
+ content: "aider";
319
+ display: inline-block;
320
+ position: absolute;
321
+ top: -1.75rem;
322
+ left: -0.5rem;
323
+ padding: 0 0.5rem;
324
+ font-weight: bold;
325
+ color: #155799;
326
+ }
327
+ </style>
328
+ >>>>>>> UPDATED
329
+ ```
330
+
331
+ > Applied edit to index.html
332
+ > Commit a26c135 aider: Changed blockquote colors to shades of blue based on the blue in the header gradient.
333
+
334
+ #### can you style the "aider" label on the blockquote as a "tab" that docks onto the top of the box?
335
+
336
+ ```html
337
+ index.html
338
+ <<<<<<< ORIGINAL
339
+ .main-content blockquote {
340
+ border: 0.1rem solid #155799;
341
+ border-radius: 0.5rem;
342
+ background-color: #e0ecf4;
343
+ padding: 0.75rem;
344
+ position: relative;
345
+ margin-top: 2rem;
346
+ }
347
+ .main-content blockquote::before {
348
+ content: "aider";
349
+ display: inline-block;
350
+ position: absolute;
351
+ top: -1.75rem;
352
+ left: -0.5rem;
353
+ padding: 0 0.5rem;
354
+ font-weight: bold;
355
+ color: #155799;
356
+ }
357
+ =======
358
+ .main-content blockquote {
359
+ border: 0.1rem solid #155799;
360
+ border-radius: 0.5rem;
361
+ background-color: #e0ecf4;
362
+ padding: 0.75rem;
363
+ position: relative;
364
+ margin-top: 2rem;
365
+ }
366
+ .main-content blockquote::before {
367
+ content: "aider";
368
+ display: inline-block;
369
+ position: absolute;
370
+ top: -0.5rem;
371
+ left: 0;
372
+ padding: 0.25rem 0.5rem;
373
+ font-weight: bold;
374
+ color: #155799;
375
+ background-color: #e0ecf4;
376
+ border-top-left-radius: 0.5rem;
377
+ border-top-right-radius: 0.5rem;
378
+ border: 0.1rem solid #155799;
379
+ border-bottom: none;
380
+ }
381
+ >>>>>>> UPDATED
382
+ ```
383
+
384
+ > Applied edit to index.html
385
+ > Commit 292eda3 aider: Styled the "aider" label on the blockquote as a "tab" that docks onto the top of the box.
386
+
387
+
388
+ #### (blank)
389
+ > Git repo has uncommitted changes.
390
+ > Commit before the chat proceeds [y/n/commit message]? Changed padding and positioning of a CSS element and updated its border.
391
+ > Commit 01fda51 Changed padding and positioning of a CSS element and updated its border.
392
+
393
+
394
+ #### apply the same box around the h4 element
395
+
396
+ ```html
397
+ index.html
398
+ <<<<<<< ORIGINAL
399
+ <style>
400
+ .main-content blockquote {
401
+ border: 0.1rem solid #155799;
402
+ border-radius: 0.5rem;
403
+ background-color: #e0ecf4;
404
+ padding: 1.25rem 0.75rem 0.75rem 0.75rem;
405
+ position: relative;
406
+ margin-top: 2rem;
407
+ }
408
+ .main-content blockquote::before {
409
+ content: "aider";
410
+ display: inline-block;
411
+ position: absolute;
412
+ top: -1rem;
413
+ left: 0.5;
414
+ padding: 0rem 0.5rem;
415
+ font-weight: bold;
416
+ color: #155799;
417
+ background-color: #e0ecf4;
418
+ border: 0.05rem solid #155799;
419
+ border-radius: 0.5rem;
420
+ }
421
+ </style>
422
+ =======
423
+ <style>
424
+ .main-content blockquote, .main-content h4 {
425
+ border: 0.1rem solid #155799;
426
+ border-radius: 0.5rem;
427
+ background-color: #e0ecf4;
428
+ padding: 1.25rem 0.75rem 0.75rem 0.75rem;
429
+ position: relative;
430
+ margin-top: 2rem;
431
+ }
432
+ .main-content blockquote::before {
433
+ content: "aider";
434
+ display: inline-block;
435
+ position: absolute;
436
+ top: -1rem;
437
+ left: 0.5;
438
+ padding: 0rem 0.5rem;
439
+ font-weight: bold;
440
+ color: #155799;
441
+ background-color: #e0ecf4;
442
+ border: 0.05rem solid #155799;
443
+ border-radius: 0.5rem;
444
+ }
445
+ </style>
446
+ >>>>>>> UPDATED
447
+ ```
448
+
449
+ > Applied edit to index.html
450
+ > Commit 6a8cd27 aider: Added box around h4 element.
451
+
452
+
453
+ </div>
testbed/Aider-AI__aider/examples/complex-change.md ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # A complex multi-file change, with debugging
3
+
4
+ This is a chat transcript of a fairly complex code change. The user is trying to update tests to use an input mock provided by `prompt_toolkit`. This requires changes to multiple source files.
5
+
6
+ Some things to notice:
7
+ - The initial changes don't work, so the user provides error messages and snippets from the `prompt_toolkit` docs to collaboratively debug and solve the problem.
8
+ - The user edits a file outside the chat using their editor. `aider` notices these out-of-band changes and offers to commit them.
9
+ - At one point the user hits `^C` to interrupt the GPT-4 response, since it's not a useful response. The user gives clarifications and gets a better result on the next reply.
10
+
11
+ <div class="chat-transcript" markdown="1">
12
+
13
+ > $ aider tests/test_main.py aider/getinput.py
14
+ > Added tests/test_main.py to the chat
15
+ > Added aider/getinput.py to the chat
16
+
17
+ #### instead of using /dev/null to send no input in the main tests, can we use the prompt_toolkit input mocking functions?
18
+
19
+ Yes, we can use the `prompt_toolkit.input` module to mock the input in the tests. Here's how to modify the `tests/test_main.py` file:
20
+
21
+ ```python
22
+ tests/test_main.py
23
+ <<<<<<< ORIGINAL
24
+ import os
25
+ import sys
26
+ import tempfile
27
+ from unittest import TestCase
28
+ from aider.main import main
29
+ import subprocess
30
+ =======
31
+ import os
32
+ import tempfile
33
+ from unittest import TestCase
34
+ from aider.main import main
35
+ import subprocess
36
+ from prompt_toolkit.input import create_pipe_input
37
+ from prompt_toolkit.output import DummyOutput
38
+ >>>>>>> UPDATED
39
+ ```
40
+
41
+ Now, update the tests to use the `create_pipe_input` and `DummyOutput`:
42
+
43
+ ```python
44
+ tests/test_main.py
45
+ <<<<<<< ORIGINAL
46
+ with open(os.devnull, "r") as dev_null:
47
+ save_stdin = sys.stdin
48
+ sys.stdin = dev_null
49
+ main([])
50
+ sys.stdin = save_stdin
51
+ =======
52
+ pipe_input = create_pipe_input()
53
+ save_stdin = sys.stdin
54
+ sys.stdin = pipe_input
55
+ main([], input=pipe_input, output=DummyOutput())
56
+ sys.stdin = save_stdin
57
+ pipe_input.close()
58
+ >>>>>>> UPDATED
59
+ ```
60
+
61
+ ```python
62
+ tests/test_main.py
63
+ <<<<<<< ORIGINAL
64
+ with open(os.devnull, "r") as dev_null:
65
+ save_stdin = sys.stdin
66
+ sys.stdin = dev_null
67
+ main(["foo.txt"])
68
+ sys.stdin = save_stdin
69
+ self.assertTrue(os.path.exists("foo.txt"))
70
+ =======
71
+ pipe_input = create_pipe_input()
72
+ save_stdin = sys.stdin
73
+ sys.stdin = pipe_input
74
+ main(["foo.txt"], input=pipe_input, output=DummyOutput())
75
+ sys.stdin = save_stdin
76
+ pipe_input.close()
77
+ self.assertTrue(os.path.exists("foo.txt"))
78
+ >>>>>>> UPDATED
79
+ ```
80
+
81
+ ```python
82
+ tests/test_main.py
83
+ <<<<<<< ORIGINAL
84
+ with open(os.devnull, "r") as dev_null:
85
+ save_stdin = sys.stdin
86
+ sys.stdin = dev_null
87
+ main(["--yes", "foo.txt"])
88
+ sys.stdin = save_stdin
89
+ self.assertTrue(os.path.exists("foo.txt"))
90
+ =======
91
+ pipe_input = create_pipe_input()
92
+ save_stdin = sys.stdin
93
+ sys.stdin = pipe_input
94
+ main(["--yes", "foo.txt"], input=pipe_input, output=DummyOutput())
95
+ sys.stdin = save_stdin
96
+ pipe_input.close()
97
+ self.assertTrue(os.path.exists("foo.txt"))
98
+ >>>>>>> UPDATED
99
+ ```
100
+
101
+ These changes will replace the usage of `/dev/null` with `prompt_toolkit`'s input mocking functions.
102
+
103
+ > Applied edit to tests/test_main.py
104
+ > Applied edit to tests/test_main.py
105
+ > Applied edit to tests/test_main.py
106
+ > Applied edit to tests/test_main.py
107
+ > Commit c177e29 aider: Replaced usage of /dev/null with prompt_toolkit's input mocking functions in tests.
108
+
109
+
110
+ > Git repo has uncommitted changes.
111
+ > Suggested commit message:
112
+ > Added import statement for sys module in test_main.py.
113
+ > Commit before the chat proceeds [y/n/commit message]? y
114
+ > Commit 6724fcd Added import statement for sys module in test_main.py.
115
+
116
+
117
+ #### /add aider/main.py
118
+
119
+ > Added aider/main.py to the chat
120
+
121
+
122
+ #### I am getting this error: FAILED tests/test_main.py::TestMain::test_main_with_empty_git_dir_new_file - TypeError: main() got an unexpected keyword argument 'input'
123
+
124
+ I apologize for the confusion. It seems I made a mistake in the `main()` function definition in `aider/main.py`. The `main()` function should accept `input` and `output` keyword arguments. Here's the fix:
125
+
126
+ ```python
127
+ aider/main.py
128
+ <<<<<<< ORIGINAL
129
+ def main(args=None):
130
+ if args is None:
131
+ args = sys.argv[1:]
132
+ =======
133
+ def main(args=None, input=None, output=None):
134
+ if args is None:
135
+ args = sys.argv[1:]
136
+ if input is None:
137
+ input = sys.stdin
138
+ if output is None:
139
+ output = sys.stdout
140
+ >>>>>>> UPDATED
141
+ ```
142
+
143
+ Now, the `main()` function will accept the `input` and `output` keyword arguments, and the tests should pass.
144
+
145
+ > Applied edit to aider/main.py
146
+ > Commit 79dfba9 aider: Fixed main() function to accept input and output keyword arguments.
147
+
148
+ #### we need to pass those into InputOutput and to prompt_toolkit right?
149
+
150
+ Yes, you're right. We need to pass the `input` and `output` arguments to the `InputOutput` class and then to the `prompt_toolkit.prompt()` function. Here's how to modify the `aider/getinput.py` and `aider/main.py` files:
151
+
152
+ In `aider/getinput.py`, update the `InputOutput` class to accept `input` and `output` arguments:
153
+
154
+ ```python
155
+ aider/getinput.py
156
+ <<<<<<< ORIGINAL
157
+ class InputOutput:
158
+ def __init__(self, pretty, yes, input_history_file, chat_history_file):
159
+ =======
160
+ class InputOutput:
161
+ def __init__(self, pretty, yes, input_history_file, chat_history_file, input=None, output=None):
162
+ self.input = input
163
+ self.output = output
164
+ >>>>>>> UPDATED
165
+ ```
166
+
167
+ Now, update the `prompt()` function calls in the `get_input()` method to use the `input` and `output` arguments:
168
+
169
+ ```python
170
+ aider/getinput.py
171
+ <<<<<<< ORIGINAL
172
+ line = prompt(
173
+ show,
174
+ completer=completer_instance,
175
+ history=FileHistory(self.input_history_file),
176
+ style=style,
177
+ reserve_space_for_menu=4,
178
+ complete_style=CompleteStyle.MULTI_COLUMN,
179
+ )
180
+ =======
181
+ line = prompt(
182
+ show,
183
+ completer=completer_instance,
184
+ history=FileHistory(self.input_history_file),
185
+ style=style,
186
+ reserve_space_for_menu=4,
187
+ complete_style=CompleteStyle.MULTI_COLUMN,
188
+ input=self.input,
189
+ output=self.output,
190
+ )
191
+ >>>>>>> UPDATED
192
+ ```
193
+
194
+ In `aider/main.py`, pass the `input` and `output` arguments to the `InputOutput` class:
195
+
196
+ ```python
197
+ aider/main.py
198
+ <<<<<<< ORIGINAL
199
+ io = InputOutput(args.pretty, args.yes, args.input_history_file, args.chat_history_file)
200
+ =======
201
+ io = InputOutput(args.pretty, args.yes, args.input_history_file, args.chat_history_file, input=input, output=output)
202
+ >>>>>>> UPDATED
203
+ ```
204
+
205
+ These changes will ensure that the `input` and `output` arguments are passed to the `InputOutput` class and then to the `prompt_toolkit.prompt()` function.
206
+
207
+ > Applied edit to aider/getinput.py
208
+ > Applied edit to aider/getinput.py
209
+ > Applied edit to aider/main.py
210
+ > Commit cea9d2a aider: Updated InputOutput class to accept input and output arguments and passed them to prompt_toolkit.prompt() function.
211
+
212
+ #### FAILED tests/test_main.py::TestMain::test_main_with_empty_git_dir_new_file - TypeError: prompt() got an unexpected keyword argument 'input'
213
+
214
+ I apologize for the confusion. It seems I made a mistake in the `prompt_toolkit.prompt()` function call. The `prompt()` function accepts `stdin` and `stdout` arguments instead of `input` and `output`. Here's the fix:
215
+
216
+ Update the `prompt()` function call in the `get_input()` method in `aider/getinput.py`:
217
+
218
+ ```python
219
+ aider/getinput.py
220
+ <<<<<<< ORIGINAL
221
+ input=self.input,
222
+ output=self.output,
223
+ =======
224
+ stdin=self.input,
225
+ stdout=self.output,
226
+ >>>>>>> UPDATED
227
+ ```
228
+
229
+ These changes will ensure that the `input` and `output` arguments are passed correctly to the `prompt_toolkit.prompt()` function.
230
+
231
+ > Applied edit to aider/getinput.py
232
+ > Commit 55d3540 aider: Fixed `prompt()` function call in `get_input()` method to pass `stdin` and `stdout` arguments instead of `input` and `output`.
233
+
234
+ #### prompt_toolkit.shortcuts.prompt(message: AnyFormattedText | None = None, *, history: History | None = None, editing_mode: EditingMode | None = None, refresh_interval: float | None = None, vi_mode: bool | None = None, lexer: Lexer | None = None, completer: Completer | None = None, complete_in_thread: bool | None = None, is_password: bool | None = None, key_bindings: KeyBindingsBase | None = None, bottom_toolbar: AnyFormattedText | None = None, style: BaseStyle | None = None, color_depth: ColorDepth | None = None, cursor: AnyCursorShapeConfig = None, include_default_pygments_style: FilterOrBool | None = None, style_transformation: StyleTransformation | None = None, swap_light_and_dark_colors: FilterOrBool | None = None, rprompt: AnyFormattedText | None = None, multiline: FilterOrBool | None = None, prompt_continuation: PromptContinuationText | None = None, wrap_lines: FilterOrBool | None = None, enable_history_search: FilterOrBool | None = None, search_ignore_case: FilterOrBool | None = None, complete_while_typing: FilterOrBool | None = None, validate_while_typing: FilterOrBool | None = None, complete_style: CompleteStyle | None = None, auto_suggest: AutoSuggest | None = None, validator: Validator | None = None, clipboard: Clipboard | None = None, mouse_support: FilterOrBool | None = None, input_processors: list[Processor] | None = None, placeholder: AnyFormattedText | None = None, reserve_space_for_menu: int | None = None, enable_system_prompt: FilterOrBool | None = None, enable_suspend: FilterOrBool | None = None, enable_open_in_editor: FilterOrBool | None = None, tempfile_suffix: str | Callable[[], str] | None = None, tempfile: str | Callable[[], str] | None = None, default: str = '', accept_default: bool = False, pre_run: Callable[[], None] | None = None) → str
235
+
236
+ I apologize for the confusion earlier. It seems that the `prompt_toolkit.prompt()` function does not accept `stdin` and `stdout` arguments directly. Instead, we need to use the `Application` class from `prompt_toolkit` to create a custom application with the desired input and output. Here's how to modify the `aider/getinput.py` file:
237
+
238
+ First, import the necessary classes and functions from `prompt_tool
239
+
240
+ > ^C KeyboardInterrupt
241
+
242
+ #### class prompt_toolkit.shortcuts.PromptSession(message: AnyFormattedText = '', *, multiline: FilterOrBool = False, wrap_lines: FilterOrBool = True, is_password: FilterOrBool = False, vi_mode: bool = False, editing_mode: EditingMode = <EditingMode.EMACS: 'EMACS'>, complete_while_typing: FilterOrBool = True, validate_while_typing: FilterOrBool = True, enable_history_search: FilterOrBool = False, search_ignore_case: FilterOrBool = False, lexer: Lexer | None = None, enable_system_prompt: FilterOrBool = False, enable_suspend: FilterOrBool = False, enable_open_in_editor: FilterOrBool = False, validator: Validator | None = None, completer: Completer | None = None, complete_in_thread: bool = False, reserve_space_for_menu: int = 8, complete_style: CompleteStyle = <CompleteStyle.COLUMN: 'COLUMN'>, auto_suggest: AutoSuggest | None = None, style: BaseStyle | None = None, style_transformation: StyleTransformation | None = None, swap_light_and_dark_colors: FilterOrBool = False, color_depth: ColorDepth | None = None, cursor: AnyCursorShapeConfig = None, include_default_pygments_style: FilterOrBool = True, history: History | None = None, clipboard: Clipboard | None = None, prompt_continuation: PromptContinuationText | None = None, rprompt: AnyFormattedText = None, bottom_toolbar: AnyFormattedText = None, mouse_support: FilterOrBool = False, input_processors: list[Processor] | None = None, placeholder: AnyFormattedText | None = None, key_bindings: KeyBindingsBase | None = None, erase_when_done: bool = False, tempfile_suffix: str | Callable[[], str] | None = '.txt', tempfile: str | Callable[[], str] | None = None, refresh_interval: float = 0, input: Input | None = None, output: Output | None = None)
243
+
244
+ Thank you for providing the `PromptSession` class information. We can use the `PromptSession` class to create a custom session with the desired input and output. Here's how to modify the `aider/getinput.py` file:
245
+
246
+ First, import the `PromptSession` class from `prompt_toolkit.shortcuts`:
247
+
248
+ ```python
249
+ aider/getinput.py
250
+ <<<<<<< ORIGINAL
251
+ from prompt_toolkit import prompt
252
+ =======
253
+ from prompt_toolkit.shortcuts import PromptSession
254
+ >>>>>>> UPDATED
255
+ ```
256
+
257
+ Now, update the `get_input()` method to use the `PromptSession` class:
258
+
259
+ ```python
260
+ aider/getinput.py
261
+ <<<<<<< ORIGINAL
262
+ line = prompt(
263
+ show,
264
+ completer=completer_instance,
265
+ history=FileHistory(self.input_history_file),
266
+ style=style,
267
+ reserve_space_for_menu=4,
268
+ complete_style=CompleteStyle.MULTI_COLUMN,
269
+ input=self.input,
270
+ output=self.output,
271
+ )
272
+ =======
273
+ session = PromptSession(
274
+ message=show,
275
+ completer=completer_instance,
276
+ history=FileHistory(self.input_history_file),
277
+ style=style,
278
+ reserve_space_for_menu=4,
279
+ complete_style=CompleteStyle.MULTI_COLUMN,
280
+ input=self.input,
281
+ output=self.output,
282
+ )
283
+ line = session.prompt()
284
+ >>>>>>> UPDATED
285
+ ```
286
+
287
+ These changes will ensure that the `input` and `output` arguments are passed correctly to the `prompt_toolkit`'s `PromptSession` class.
288
+
289
+ > Applied edit to aider/getinput.py
290
+ > Applied edit to aider/getinput.py
291
+ > Commit ac92cca aider: Replaced `prompt()` with `PromptSession()` to correctly pass input and output arguments.
292
+
293
+ #### try using create_input(StringIO('')) in the tests
294
+
295
+
296
+ I understand that you want to use `create_input(StringIO(''))` in the tests. However, I need more information about which test cases you want to apply this change to and how you want to use it. Please provide more details or examples.
297
+
298
+
299
+ #### the ones that currently use create_pipe_input()
300
+
301
+ I see that you want to replace `create_pipe_input()` with `create_input(StringIO(''))` in the test cases. Here are the changes for the `tests/test_main.py` file:
302
+
303
+ ```python
304
+ tests/test_main.py
305
+ <<<<<<< ORIGINAL
306
+ from prompt_toolkit.input import create_pipe_input
307
+ =======
308
+ from prompt_toolkit.input import create_input
309
+ from io import StringIO
310
+ >>>>>>> UPDATED
311
+ ```
312
+
313
+ ```python
314
+ tests/test_main.py
315
+ <<<<<<< ORIGINAL
316
+ pipe_input = create_pipe_input()
317
+ =======
318
+ pipe_input = create_input(StringIO(''))
319
+ >>>>>>> UPDATED
320
+ ```
321
+
322
+ ```python
323
+ tests/test_main.py
324
+ <<<<<<< ORIGINAL
325
+ pipe_input = create_pipe_input()
326
+ =======
327
+ pipe_input = create_input(StringIO(''))
328
+ >>>>>>> UPDATED
329
+ ```
330
+
331
+ ```python
332
+ tests/test_main.py
333
+ <<<<<<< ORIGINAL
334
+ pipe_input = create_pipe_input()
335
+ =======
336
+ pipe_input = create_input(StringIO(''))
337
+ >>>>>>> UPDATED
338
+ ```
339
+
340
+ These changes will replace the usage of `create_pipe_input()` with `create_input(StringIO(''))` in the test cases.
341
+
342
+ > Applied edit to tests/test_main.py
343
+ > Applied edit to tests/test_main.py
344
+ > Applied edit to tests/test_main.py
345
+ > Applied edit to tests/test_main.py
346
+ > Commit 4bb043f aider: Replaced the usage of `create_pipe_input()` with `create_input(StringIO(''))` in the test cases.
347
+
348
+ #### nice, that worked!
349
+
350
+ I'm glad the changes worked for you! If you have any more requests or need further assistance, feel free to ask.
351
+
352
+
353
+ </div>
testbed/Aider-AI__aider/examples/css-exercises.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Complete a css exercise with aider and GPT-4
3
+
4
+ In this chat transcript, the user asks about the open source [CSS Exercises repo](https://github.com/TheOdinProject/css-exercises) and completes an animation exercise.
5
+
6
+ <div class="chat-transcript" markdown="1">
7
+
8
+ > $ aider
9
+
10
+ #### what is this repo?
11
+
12
+ Based on the file list provided, it seems like this repository contains a collection of CSS and HTML exercises, solutions, and examples. The exercises cover various topics such as Flexbox, Grid, Animation, Foundations, and Margin & Padding. The repository also includes images and other assets used in the exercises.
13
+
14
+
15
+ #### /add animation/03-dropdown-menu/README.md
16
+
17
+ > Added animation/03-dropdown-menu/README.md to the chat
18
+
19
+ Yes, I see the content of the `animation/03-dropdown-menu/README.md` file. It describes an exercise to add animation to a dropdown menu, creating a bounce illusion when the dropdown expands close to its final end state. The desired outcome is shown in a GIF file, and the hints provided suggest using the `transform-origin` property and adding an intermediate step to the keyframe at-rule to achieve the bounce effect.
20
+
21
+ Is there any specific change or improvement you would like me to make to this file or any other file in the repository?
22
+
23
+
24
+ #### can you make the changes suggested in the readme?
25
+
26
+ To make the changes suggested in the `animation/03-dropdown-menu/README.md`, I need to see the contents of the following files:
27
+
28
+ 1. `animation/03-dropdown-menu/style.css`
29
+ 2. `animation/03-dropdown-menu/script.js`
30
+
31
+ Please provide the contents of these files so I can suggest the necessary changes.
32
+
33
+
34
+ > animation/03-dropdown-menu/style.css
35
+ > animation/03-dropdown-menu/script.js
36
+ > Add these files to the chat? y
37
+
38
+
39
+ Apologies for the oversight. I see the content of the `animation/03-dropdown-menu/style.css` and `animation/03-dropdown-menu/script.js` files now. I will suggest the necessary changes to add the bounce animation to the dropdown menu.
40
+
41
+ ```css
42
+ animation/03-dropdown-menu/style.css
43
+ <<<<<<< ORIGINAL
44
+ .visible {
45
+ display: block;
46
+ }
47
+ =======
48
+ .visible {
49
+ display: block;
50
+ animation: expand 0.3s ease-out;
51
+ transform-origin: top;
52
+ }
53
+
54
+ @keyframes expand {
55
+ 0% {
56
+ transform: scaleY(0);
57
+ }
58
+ 80% {
59
+ transform: scaleY(1.1);
60
+ }
61
+ 100% {
62
+ transform: scaleY(1);
63
+ }
64
+ }
65
+ >>>>>>> UPDATED
66
+ ```
67
+
68
+ These changes add the bounce animation to the dropdown menu by creating a new keyframe animation called `expand`. The `transform-origin` property is set to `top` to make the dropdown menu start transforming from the top. The intermediate step at 80% of the animation creates the bounce illusion.
69
+
70
+ > Applied edit to animation/03-dropdown-menu/style.css
71
+ > Commit bb3a813 aider: Added bounce animation to dropdown menu.
72
+
73
+ #### that worked!
74
+
75
+ I'm glad the changes worked for you! If you have any more requests or need assistance with other parts of the code, feel free to ask. I'm here to help!
76
+
77
+ </div>
testbed/Aider-AI__aider/examples/hello-world-flask.md ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Create a simple flask app with aider & gpt-4
3
+
4
+ In this chat transcript, the user asks to make a simple flask app with various endpoints.
5
+
6
+ <div class="chat-transcript" markdown="1">
7
+
8
+ > $ aider app.py
9
+ > Creating empty file app.py
10
+ > Added app.py to the chat
11
+
12
+ #### make a flask app with a /hello endpoint that returns hello world
13
+
14
+ To create a Flask app with a `/hello` endpoint that returns "Hello, World!", we need to install Flask, import it, create an app instance, and define a route for the `/hello` endpoint. Here's how to update the `app.py` file:
15
+
16
+ ```python
17
+ app.py
18
+ <<<<<<< ORIGINAL
19
+
20
+ =======
21
+ from flask import Flask
22
+
23
+ app = Flask(__name__)
24
+
25
+ @app.route('/hello')
26
+ def hello():
27
+ return "Hello, World!"
28
+
29
+ if __name__ == '__main__':
30
+ app.run()
31
+ >>>>>>> UPDATED
32
+ ```
33
+
34
+ Make sure to install Flask in your project environment using `pip install flask` before running the app.
35
+
36
+ > Applied edit to app.py
37
+ > Commit 414c394 aider: Added a `/hello` endpoint that returns "Hello, World!" to the Flask app.
38
+
39
+ #### add an endpoint like /add/3/5 which returns the sum of the 2 numbers
40
+
41
+ To add an endpoint like `/add/3/5` that returns the sum of the two numbers, you can create a new route with two URL parameters. Update the `app.py` file as follows:
42
+
43
+ ```python
44
+ app.py
45
+ <<<<<<< ORIGINAL
46
+ @app.route('/hello')
47
+ def hello():
48
+ return "Hello, World!"
49
+ =======
50
+ @app.route('/add/<int:num1>/<int:num2>')
51
+ def add(num1, num2):
52
+ return str(num1 + num2)
53
+
54
+ @app.route('/hello')
55
+ def hello():
56
+ return "Hello, World!"
57
+ >>>>>>> UPDATED
58
+ ```
59
+
60
+ Now, when you visit `/add/3/5`, it will return the sum of the two numbers, which is `8`.
61
+
62
+ > Applied edit to app.py
63
+ > Commit 0872c51 aider: Added an endpoint `/add/<int:num1>/<int:num2>` that returns the sum of the two numbers.
64
+
65
+ #### add /fibonacci/X
66
+
67
+ To add a `/fibonacci/X` endpoint that returns the Xth number in the Fibonacci sequence, you can create a new route with a URL parameter for X and a function to calculate the Fibonacci number. Update the `app.py` file as follows:
68
+
69
+ ```python
70
+ app.py
71
+ <<<<<<< ORIGINAL
72
+ @app.route('/hello')
73
+ def hello():
74
+ return "Hello, World!"
75
+ =======
76
+ def fibonacci(n):
77
+ if n <= 0:
78
+ return "Invalid input. Please enter a positive integer."
79
+ elif n == 1:
80
+ return 0
81
+ elif n == 2:
82
+ return 1
83
+ else:
84
+ a, b = 0, 1
85
+ for _ in range(n - 2):
86
+ a, b = b, a + b
87
+ return b
88
+
89
+ @app.route('/fibonacci/<int:x>')
90
+ def fibonacci_x(x):
91
+ return str(fibonacci(x))
92
+
93
+ @app.route('/hello')
94
+ def hello():
95
+ return "Hello, World!"
96
+ >>>>>>> UPDATED
97
+ ```
98
+
99
+ Now, when you visit `/fibonacci/X`, it will return the Xth number in the Fibonacci sequence. For example, `/fibonacci/5` will return `3`.
100
+
101
+ > Applied edit to app.py
102
+ > Commit 163fba8 aider: Added a `/fibonacci/X` endpoint that returns the Xth number in the Fibonacci sequence.
103
+
104
+ #### remove the hello endpoint
105
+
106
+ To remove the `/hello` endpoint, you can simply delete the corresponding route and function in the `app.py` file. Here's the update:
107
+
108
+ ```python
109
+ app.py
110
+ <<<<<<< ORIGINAL
111
+ @app.route('/hello')
112
+ def hello():
113
+ return "Hello, World!"
114
+ =======
115
+ >>>>>>> UPDATED
116
+ ```
117
+
118
+ Now, the `/hello` endpoint has been removed from the Flask app.
119
+
120
+ > Applied edit to app.py
121
+ > Commit eab6620 aider: Removed the `/hello` endpoint from the Flask app.
122
+
123
+
124
+ </div>
testbed/Aider-AI__aider/examples/hello.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hello aider!
2
+
3
+ Here is the simplest possible "hello world" example of using aider:
4
+
5
+ <br/>
6
+ <br/>
7
+ <br/>
8
+ <div class="chat-transcript" markdown="1">
9
+
10
+ #### change hello to goodbye
11
+
12
+ To change the output from "hello" to "goodbye", we need to modify the `hello.py` file.
13
+
14
+ Here is the change:
15
+
16
+ ```python
17
+ hello.py
18
+ <<<<<<< ORIGINAL
19
+ print("hello")
20
+ =======
21
+ print("goodbye")
22
+ >>>>>>> UPDATED
23
+ ```
24
+
25
+ > Applied edit to hello.py
26
+ > Commit 672ae42 aider: Changed output from "hello" to "goodbye" in hello.py.
27
+
28
+ </div>
29
+ <br/>
30
+ <br/>
31
+ <br/>
testbed/Aider-AI__aider/examples/no-color.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Honor the NO_COLOR environment variable
3
+
4
+ The user pastes the specification of the NO_COLOR environment variable protocol
5
+ from [no-color.org](https://no-color.org) into the chat with GPT-4.
6
+
7
+ GPT figures out which files need to be edited, and asks permission to make changes.
8
+ It then disables all the color and pretty-printing functions if NO_COLOR is
9
+ set, so the tool conforms to the specification.
10
+
11
+ The user then asks for a test case, which GPT adds as well.
12
+
13
+ <div class="chat-transcript" markdown="1">
14
+
15
+ > $ aider
16
+ > Using git repo: .git
17
+ > Use /help to see in-chat commands.
18
+
19
+ #### Command-line software which adds ANSI color to its output by default should check for a NO_COLOR environment variable that, when present and not an empty string (regardless of its value), prevents the addition of ANSI color.
20
+
21
+ To implement this feature, we need to modify the `aider/io.py` file. Please make it *read-write* so I can provide the necessary changes.
22
+
23
+ > aider/io.py
24
+ > Add these files to the chat? y
25
+
26
+ Great! Now, I will make the necessary changes to check for the `NO_COLOR` environment variable and disable ANSI color when it is present and not an empty string.
27
+
28
+ ```python
29
+ aider/io.py
30
+ <<<<<<< ORIGINAL
31
+ import os
32
+ =======
33
+ import os
34
+ import os.path
35
+ >>>>>>> UPDATED
36
+ ```
37
+
38
+ ```python
39
+ aider/io.py
40
+ <<<<<<< ORIGINAL
41
+ def __init__(
42
+ self,
43
+ pretty=True,
44
+ yes=False,
45
+ input_history_file=None,
46
+ chat_history_file=None,
47
+ input=None,
48
+ output=None,
49
+ user_input_color="blue",
50
+ tool_output_color=None,
51
+ tool_error_color="red",
52
+ ):
53
+ self.user_input_color = user_input_color
54
+ self.tool_output_color = tool_output_color
55
+ self.tool_error_color = tool_error_color
56
+ self.input = input
57
+ self.output = output
58
+ self.pretty = pretty
59
+ self.yes = yes
60
+ self.input_history_file = input_history_file
61
+ if chat_history_file is not None:
62
+ self.chat_history_file = Path(chat_history_file)
63
+ else:
64
+ self.chat_history_file = None
65
+
66
+ if pretty:
67
+ self.console = Console()
68
+ else:
69
+ self.console = Console(force_terminal=True, no_color=True)
70
+ =======
71
+ def __init__(
72
+ self,
73
+ pretty=True,
74
+ yes=False,
75
+ input_history_file=None,
76
+ chat_history_file=None,
77
+ input=None,
78
+ output=None,
79
+ user_input_color="blue",
80
+ tool_output_color=None,
81
+ tool_error_color="red",
82
+ ):
83
+ no_color = os.environ.get("NO_COLOR")
84
+ if no_color is not None and no_color != "":
85
+ pretty = False
86
+
87
+ self.user_input_color = user_input_color if pretty else None
88
+ self.tool_output_color = tool_output_color if pretty else None
89
+ self.tool_error_color = tool_error_color if pretty else None
90
+ self.input = input
91
+ self.output = output
92
+ self.pretty = pretty
93
+ self.yes = yes
94
+ self.input_history_file = input_history_file
95
+ if chat_history_file is not None:
96
+ self.chat_history_file = Path(chat_history_file)
97
+ else:
98
+ self.chat_history_file = None
99
+
100
+ self.console = Console(force_terminal=not pretty, no_color=not pretty)
101
+ >>>>>>> UPDATED
102
+ ```
103
+
104
+ These changes will make the software check for the `NO_COLOR` environment variable and disable ANSI color when it is present and not an empty string.
105
+
106
+ > Applied edit to aider/io.py
107
+ > Applied edit to aider/io.py
108
+ > Commit 3218242 aider: Added check for NO_COLOR environment variable to disable ANSI color.
109
+
110
+ #### add a test
111
+
112
+ To add a test for the `NO_COLOR` environment variable, we will create a new test function in the `tests/test_io.py` file. Since this file does not exist, we will create it first.
113
+
114
+ ```python
115
+ tests/test_io.py
116
+ <<<<<<< ORIGINAL
117
+ =======
118
+ import os
119
+ import unittest
120
+ from unittest.mock import patch
121
+ from aider.io import InputOutput
122
+
123
+ class TestInputOutput(unittest.TestCase):
124
+ def test_no_color_environment_variable(self):
125
+ with patch.dict(os.environ, {"NO_COLOR": "1"}):
126
+ io = InputOutput()
127
+ self.assertFalse(io.pretty)
128
+
129
+ if __name__ == "__main__":
130
+ unittest.main()
131
+ >>>>>>> UPDATED
132
+ ```
133
+
134
+ This test function checks if the `pretty` attribute of the `InputOutput` class is set to `False` when the `NO_COLOR` environment variable is set.
135
+
136
+ > Allow creation of new file tests/test_io.py? y
137
+ > Add tests/test_io.py to git? y
138
+ > Applied edit to tests/test_io.py
139
+ > Commit 52a9df5 aider: Added a test function to check if the `pretty` attribute of the `InputOutput` class is set to `False` when the `NO_COLOR` environment variable is set.
140
+
141
+ #### /run pytest
142
+
143
+ > ============================= test session starts ==============================
144
+ > platform darwin -- Python 3.11.3, pytest-7.3.1, pluggy-1.0.0
145
+ > rootdir: /Users/gauthier/Projects/aider
146
+ > collected 25 items
147
+ >
148
+ > tests/test_coder.py ...... [ 24%]
149
+ > tests/test_commands.py . [ 28%]
150
+ > tests/test_io.py . [ 32%]
151
+ > tests/test_main.py .... [ 48%]
152
+ > tests/test_repomap.py ... [ 60%]
153
+ > tests/test_utils.py .......... [100%]
154
+ >
155
+ > ============================== 25 passed in 1.41s ==============================
156
+ >
157
+ > Add the output to the chat? y
158
+
159
+
160
+ </div>
testbed/Aider-AI__aider/examples/semantic-search-replace.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Semantic search & replace code with aider and gpt-4
2
+
3
+ In this chat transcript, the user asks to modify a series of function calls.
4
+
5
+ Notice that it isn't replacing exact strings.
6
+ Making the change requires dealing with various formatting and semantic differences in the calls that it is updating.
7
+
8
+ Some edits were elided from this transcript for brevity.
9
+
10
+ <div class="chat-transcript" markdown="1">
11
+
12
+ > $ aider aider/coder.py
13
+ > Added aider/coder.py to the chat
14
+
15
+ #### replace all the self.console.print() calls that contain [red] with calls to self.io.tool_error() with [red] removed from the string
16
+
17
+ ```python
18
+ aider/coder.py
19
+ <<<<<<< ORIGINAL
20
+ self.console.print(
21
+ f"[red]This tool will almost certainly fail to work with {main_model}"
22
+ )
23
+ =======
24
+ self.io.tool_error(f"This tool will almost certainly fail to work with {main_model}")
25
+ >>>>>>> UPDATED
26
+ ```
27
+
28
+ ```python
29
+ aider/coder.py
30
+ <<<<<<< ORIGINAL
31
+ self.console.print("[red]Files are not in a git repo.")
32
+ =======
33
+ self.io.tool_error("Files are not in a git repo.")
34
+ >>>>>>> UPDATED
35
+ ```
36
+
37
+ ```python
38
+ aider/coder.py
39
+ <<<<<<< ORIGINAL
40
+ self.console.print("[red]Malformed ORIGINAL/UPDATE blocks, retrying...")
41
+ self.console.print("[red]", Text(err))
42
+ =======
43
+ self.io.tool_error("Malformed ORIGINAL/UPDATE blocks, retrying...")
44
+ self.io.tool_error(Text(err))
45
+ >>>>>>> UPDATED
46
+ ```
47
+
48
+ Please note that I couldn't find the `self.io.tool_error()` method in the provided code. You may need to create this method in the appropriate class or provide the correct method name to replace the `self.console.print()` calls.
49
+
50
+ > Applied edit to aider/coder.py
51
+ > Applied edit to aider/coder.py
52
+ > Applied edit to aider/coder.py
53
+ > Commit 919cfc2 aider: Replaced all self.console.print() calls with self.io.tool_error() calls with [red] removed from the string.
54
+
55
+
56
+ </div>
testbed/Aider-AI__aider/examples/update-docs.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Automatically update docs with aider and gpt-4
2
+
3
+ In this chat transcript, the user asks to automatically update the Usage docs based on the latest version of the main() function in the code.
4
+
5
+ <div class="chat-transcript" markdown="1">
6
+
7
+ > $ aider ./README.md aider/main.py
8
+ > Added README.md to the chat
9
+ > Added aider/main.py to the chat
10
+
11
+ #### the cmd line args in main() have been updated. update the readme to accurately describe them.
12
+
13
+ ```markdown
14
+ README.md
15
+ <<<<<<< ORIGINAL
16
+ - `--history-file HISTORY_FILE`: Specify the chat input history file (default: .aider.history). Override the default with the environment variable `AIDER_HISTORY_FILE`.
17
+ - `--model MODEL`: Specify the model to use for the main chat (default: gpt-4). Override the default with the environment variable `AIDER_MODEL`.
18
+ - `-3`: Use gpt-3.5-turbo model for the main chat (basically won't work). No environment variable override.
19
+ - `--no-pretty`: Disable pretty, colorized output. Override the default with the environment variable `AIDER_PRETTY` (default: 1 for enabled, 0 for disabled).
20
+ - `--show-diffs`: Show diffs when committing changes (default: False). Override the default with the environment variable `AIDER_SHOW_DIFFS` (default: 0 for False, 1 for True).
21
+ - `--no-auto-commits`: Disable auto commit of changes. Override the default with the environment variable `AIDER_AUTO_COMMITS` (default: 1 for enabled, 0 for disabled).
22
+ =======
23
+ - `--input-history-file INPUT_HISTORY_FILE`: Specify the chat input history file (default: .aider.input.history). Override the default with the environment variable `AIDER_INPUT_HISTORY_FILE`.
24
+ - `--chat-history-file CHAT_HISTORY_FILE`: Specify the chat history file (default: .aider.chat.history.md). Override the default with the environment variable `AIDER_CHAT_HISTORY_FILE`.
25
+ - `--model MODEL`: Specify the model to use for the main chat (default: gpt-4). Override the default with the environment variable `AIDER_MODEL`.
26
+ - `-3`: Use gpt-3.5-turbo model for the main chat (basically won't work). No environment variable override.
27
+ - `--no-pretty`: Disable pretty, colorized output. Override the default with the environment variable `AIDER_PRETTY` (default: 1 for enabled, 0 for disabled).
28
+ - `--apply FILE`: Apply the changes from the given file instead of running the chat (debug).
29
+ - `--no-auto-commits`: Disable auto commit of changes. Override the default with the environment variable `AIDER_AUTO_COMMITS` (default: 1 for enabled, 0 for disabled).
30
+ - `--show-diffs`: Show diffs when committing changes (default: False). Override the default with the environment variable `AIDER_SHOW_DIFFS` (default: 0 for False, 1 for True).
31
+ - `--yes`: Always say yes to every confirmation (default: False).
32
+ >>>>>>> UPDATED
33
+ ```
34
+
35
+ > Applied edit to README.md
36
+ > Commit 024f45e aider: Updated command line arguments in main() and updated README.md to accurately describe them.
37
+
38
+ </div>
testbed/Aider-AI__aider/hello.py ADDED
File without changes
testbed/Aider-AI__aider/pytest.ini ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [pytest]
2
+ norecursedirs = tmp.* build benchmark
3
+
testbed/Aider-AI__aider/requirements.txt ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiohttp==3.8.4
2
+ aiosignal==1.3.1
3
+ async-timeout==4.0.2
4
+ attrs==23.1.0
5
+ certifi==2023.5.7
6
+ charset-normalizer==3.1.0
7
+ frozenlist==1.3.3
8
+ gitdb==4.0.10
9
+ GitPython==3.1.31
10
+ idna==3.4
11
+ markdown-it-py==2.2.0
12
+ mdurl==0.1.2
13
+ multidict==6.0.4
14
+ openai==0.27.6
15
+ prompt-toolkit==3.0.38
16
+ Pygments==2.15.1
17
+ requests==2.30.0
18
+ rich==13.3.5
19
+ smmap==5.0.0
20
+ tqdm==4.65.0
21
+ urllib3==2.0.2
22
+ wcwidth==0.2.6
23
+ yarl==1.9.2
24
+ pytest==7.3.1
25
+ tiktoken==0.4.0
26
+ configargparse
27
+ PyYAML
28
+ backoff==2.2.1
29
+ networkx==3.1
30
+ diskcache==5.6.1
31
+ numpy==1.24.3
32
+ scipy==1.10.1
33
+ jsonschema==4.17.3
34
+ sounddevice==0.4.6
35
+ soundfile==0.12.1
testbed/Aider-AI__aider/scripts/versionbump.py ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import re
3
+ import subprocess
4
+
5
+ from packaging import version
6
+
7
+
8
+ def main():
9
+ parser = argparse.ArgumentParser(description="Bump version")
10
+ parser.add_argument("new_version", help="New version in x.y.z format")
11
+ parser.add_argument(
12
+ "--dry-run", action="store_true", help="Print each step without actually executing them"
13
+ )
14
+ args = parser.parse_args()
15
+ dry_run = args.dry_run
16
+
17
+ new_version_str = args.new_version
18
+ if not re.match(r"^\d+\.\d+\.\d+$", new_version_str):
19
+ raise ValueError(f"Invalid version format, must be x.y.z: {new_version_str}")
20
+
21
+ new_version = version.parse(new_version_str)
22
+ incremented_version = version.Version(
23
+ f"{new_version.major}.{new_version.minor}.{new_version.micro + 1}"
24
+ )
25
+
26
+ with open("aider/__init__.py", "r") as f:
27
+ content = f.read()
28
+
29
+ current_version = re.search(r'__version__ = "(.+?)"', content).group(1)
30
+ if new_version <= version.parse(current_version):
31
+ raise ValueError(
32
+ f"New version {new_version} must be greater than the current version {current_version}"
33
+ )
34
+
35
+ updated_content = re.sub(r'__version__ = ".+?"', f'__version__ = "{new_version}"', content)
36
+
37
+ print("Updating aider/__init__.py with new version:")
38
+ print(updated_content)
39
+ if not dry_run:
40
+ with open("aider/__init__.py", "w") as f:
41
+ f.write(updated_content)
42
+
43
+ git_commands = [
44
+ ["git", "add", "aider/__init__.py"],
45
+ ["git", "commit", "-m", f"version bump to {new_version}"],
46
+ ["git", "tag", f"v{new_version}"],
47
+ ["git", "push", "origin"],
48
+ ["git", "push", "origin", f"v{new_version}"],
49
+ ]
50
+
51
+ for cmd in git_commands:
52
+ print(f"Running: {' '.join(cmd)}")
53
+ if not dry_run:
54
+ subprocess.run(cmd, check=True)
55
+
56
+ updated_dev_content = re.sub(
57
+ r'__version__ = ".+?"', f'__version__ = "{incremented_version}-dev"', content
58
+ )
59
+
60
+ print()
61
+ print("Updating aider/__init__.py with new dev version:")
62
+ print(updated_dev_content)
63
+ if not dry_run:
64
+ with open("aider/__init__.py", "w") as f:
65
+ f.write(updated_dev_content)
66
+
67
+ git_commands_dev = [
68
+ ["git", "add", "aider/__init__.py"],
69
+ ["git", "commit", "-m", f"set version to {incremented_version}-dev"],
70
+ ["git", "push", "origin"],
71
+ ]
72
+
73
+ for cmd in git_commands_dev:
74
+ print(f"Running: {' '.join(cmd)}")
75
+ if not dry_run:
76
+ subprocess.run(cmd, check=True)
77
+
78
+
79
+ if __name__ == "__main__":
80
+ main()
testbed/Aider-AI__aider/setup.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+
3
+ from setuptools import find_packages, setup
4
+
5
+ with open("requirements.txt") as f:
6
+ requirements = f.read().splitlines()
7
+
8
+ from aider import __version__
9
+
10
+ with open("README.md", "r", encoding="utf-8") as f:
11
+ long_description = f.read()
12
+ long_description = re.sub(r"\n!\[.*\]\(.*\)", "", long_description)
13
+ long_description = re.sub(r"\n- \[.*\]\(.*\)", "", long_description)
14
+
15
+ setup(
16
+ name="aider-chat",
17
+ version=__version__,
18
+ packages=find_packages(),
19
+ include_package_data=True,
20
+ install_requires=requirements,
21
+ python_requires='>=3.9',
22
+ entry_points={
23
+ "console_scripts": [
24
+ "aider = aider.main:main",
25
+ ],
26
+ },
27
+ description="aider is GPT powered coding in your terminal",
28
+ long_description=long_description,
29
+ long_description_content_type="text/markdown",
30
+ url="https://github.com/paul-gauthier/aider",
31
+ )
testbed/Aider-AI__aider/share/index.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Shared aider chat transcript
3
+
4
+ A user has shared the following transcript of a pair programming chat session
5
+ created using <a href="https://aider.chat">aider</a>.
6
+ Aider is a command line tool that lets you pair program with GPT-3.5 or
7
+ GPT-4, to edit code stored in your local git repository.
8
+
9
+ The transcript is based on <a id="mdurl" href="">this chat transcript data</a>.
10
+
11
+ <div class="chat-transcript" id="shared-transcript">
12
+ </div>
13
+
14
+ ## Transcript format
15
+
16
+ <div class="chat-transcript" markdown="1">
17
+
18
+ > This is output from the aider tool.
19
+
20
+ #### These are chat messages written by the user.
21
+
22
+ Chat responses from GPT are in a blue font like this,
23
+ and often include colorized "diffs" where GPT is editing code:
24
+
25
+
26
+ ```python
27
+ hello.py
28
+ <<<<<<< ORIGINAL
29
+ print("hello")
30
+ =======
31
+ print("goodbye")
32
+ >>>>>>> UPDATED
33
+ ```
34
+ </div>
35
+
36
+ <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
37
+ <script>
38
+ window.onload = function() {
39
+ var urlParams = new URLSearchParams(window.location.search);
40
+ var conv = urlParams.get('mdurl');
41
+ if (!conv) {
42
+ return;
43
+ }
44
+ document.getElementById('mdurl').href = conv;
45
+ // Check if the URL is a non-raw GitHub gist
46
+ var gistRegex = /^https:\/\/gist\.github\.com\/([^\/]+)\/([a-f0-9]+)$/;
47
+ var match = gistRegex.exec(conv);
48
+ if (match) {
49
+ // If it is, convert it into a raw URL
50
+ conv = 'https://gist.githubusercontent.com/' + match[1] + '/' + match[2] + '/raw';
51
+ }
52
+ fetch(conv)
53
+ .then(response => response.text())
54
+ .then(markdown => {
55
+ // Ensure every line that starts with '>' ends with exactly 2 spaces
56
+ markdown = markdown.split('\n').map(function(line) {
57
+ if (line.startsWith('>')) {
58
+ return line.trimEnd() + ' ';
59
+ }
60
+ return line;
61
+ }).join('\n');
62
+ var html = marked.parse(markdown);
63
+ var divElement = document.querySelector('#shared-transcript');
64
+ divElement.innerHTML = html;
65
+ })
66
+ .catch(error => {
67
+ console.error('Error fetching markdown:', error);
68
+ });
69
+ }
70
+ </script>
71
+
testbed/Aider-AI__aider/tests/__init__.py ADDED
File without changes
testbed/Aider-AI__aider/tests/test_commands.py ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import codecs
2
+ import os
3
+ import shutil
4
+ import sys
5
+ import tempfile
6
+ from io import StringIO
7
+ from pathlib import Path
8
+ from unittest import TestCase
9
+
10
+ import git
11
+
12
+ from aider import models
13
+ from aider.coders import Coder
14
+ from aider.commands import Commands
15
+ from aider.dump import dump # noqa: F401
16
+ from aider.io import InputOutput
17
+ from tests.utils import GitTemporaryDirectory
18
+
19
+
20
+ class TestCommands(TestCase):
21
+ def setUp(self):
22
+ self.original_cwd = os.getcwd()
23
+ self.tempdir = tempfile.mkdtemp()
24
+ os.chdir(self.tempdir)
25
+
26
+ def tearDown(self):
27
+ os.chdir(self.original_cwd)
28
+ shutil.rmtree(self.tempdir, ignore_errors=True)
29
+
30
+ def test_cmd_add(self):
31
+ # Initialize the Commands and InputOutput objects
32
+ io = InputOutput(pretty=False, yes=True)
33
+ from aider.coders import Coder
34
+
35
+ coder = Coder.create(models.GPT35, None, io)
36
+ commands = Commands(io, coder)
37
+
38
+ # Call the cmd_add method with 'foo.txt' and 'bar.txt' as a single string
39
+ commands.cmd_add("foo.txt bar.txt")
40
+
41
+ # Check if both files have been created in the temporary directory
42
+ self.assertTrue(os.path.exists("foo.txt"))
43
+ self.assertTrue(os.path.exists("bar.txt"))
44
+
45
+ def test_cmd_add_with_glob_patterns(self):
46
+ # Initialize the Commands and InputOutput objects
47
+ io = InputOutput(pretty=False, yes=True)
48
+ from aider.coders import Coder
49
+
50
+ coder = Coder.create(models.GPT35, None, io)
51
+ commands = Commands(io, coder)
52
+
53
+ # Create some test files
54
+ with open("test1.py", "w") as f:
55
+ f.write("print('test1')")
56
+ with open("test2.py", "w") as f:
57
+ f.write("print('test2')")
58
+ with open("test.txt", "w") as f:
59
+ f.write("test")
60
+
61
+ # Call the cmd_add method with a glob pattern
62
+ commands.cmd_add("*.py")
63
+
64
+ # Check if the Python files have been added to the chat session
65
+ self.assertIn(str(Path("test1.py").resolve()), coder.abs_fnames)
66
+ self.assertIn(str(Path("test2.py").resolve()), coder.abs_fnames)
67
+
68
+ # Check if the text file has not been added to the chat session
69
+ self.assertNotIn(str(Path("test.txt").resolve()), coder.abs_fnames)
70
+
71
+ def test_cmd_add_no_match(self):
72
+ # Initialize the Commands and InputOutput objects
73
+ io = InputOutput(pretty=False, yes=True)
74
+ from aider.coders import Coder
75
+
76
+ coder = Coder.create(models.GPT35, None, io)
77
+ commands = Commands(io, coder)
78
+
79
+ # Call the cmd_add method with a non-existent file pattern
80
+ commands.cmd_add("*.nonexistent")
81
+
82
+ # Check if no files have been added to the chat session
83
+ self.assertEqual(len(coder.abs_fnames), 0)
84
+
85
+ def test_cmd_add_drop_directory(self):
86
+ # Initialize the Commands and InputOutput objects
87
+ io = InputOutput(pretty=False, yes=False)
88
+ from aider.coders import Coder
89
+
90
+ coder = Coder.create(models.GPT35, None, io)
91
+ commands = Commands(io, coder)
92
+
93
+ # Create a directory and add files to it using pathlib
94
+ Path("test_dir").mkdir()
95
+ Path("test_dir/another_dir").mkdir()
96
+ Path("test_dir/test_file1.txt").write_text("Test file 1")
97
+ Path("test_dir/test_file2.txt").write_text("Test file 2")
98
+ Path("test_dir/another_dir/test_file.txt").write_text("Test file 3")
99
+
100
+ # Call the cmd_add method with a directory
101
+ commands.cmd_add("test_dir test_dir/test_file2.txt")
102
+
103
+ # Check if the files have been added to the chat session
104
+ self.assertIn(str(Path("test_dir/test_file1.txt").resolve()), coder.abs_fnames)
105
+ self.assertIn(str(Path("test_dir/test_file2.txt").resolve()), coder.abs_fnames)
106
+ self.assertIn(str(Path("test_dir/another_dir/test_file.txt").resolve()), coder.abs_fnames)
107
+
108
+ commands.cmd_drop("test_dir/another_dir")
109
+ self.assertIn(str(Path("test_dir/test_file1.txt").resolve()), coder.abs_fnames)
110
+ self.assertIn(str(Path("test_dir/test_file2.txt").resolve()), coder.abs_fnames)
111
+ self.assertNotIn(
112
+ str(Path("test_dir/another_dir/test_file.txt").resolve()), coder.abs_fnames
113
+ )
114
+
115
+ # Issue #139 /add problems when cwd != git_root
116
+
117
+ # remember the proper abs path to this file
118
+ abs_fname = str(Path("test_dir/another_dir/test_file.txt").resolve())
119
+
120
+ # chdir to someplace other than git_root
121
+ Path("side_dir").mkdir()
122
+ os.chdir("side_dir")
123
+
124
+ # add it via it's git_root referenced name
125
+ commands.cmd_add("test_dir/another_dir/test_file.txt")
126
+
127
+ # it should be there, but was not in v0.10.0
128
+ self.assertIn(abs_fname, coder.abs_fnames)
129
+
130
+ # drop it via it's git_root referenced name
131
+ commands.cmd_drop("test_dir/another_dir/test_file.txt")
132
+
133
+ # it should be there, but was not in v0.10.0
134
+ self.assertNotIn(abs_fname, coder.abs_fnames)
135
+
136
+ def test_cmd_drop_with_glob_patterns(self):
137
+ # Initialize the Commands and InputOutput objects
138
+ io = InputOutput(pretty=False, yes=True)
139
+ from aider.coders import Coder
140
+
141
+ coder = Coder.create(models.GPT35, None, io)
142
+ commands = Commands(io, coder)
143
+
144
+ subdir = Path("subdir")
145
+ subdir.mkdir()
146
+ (subdir / "subtest1.py").touch()
147
+ (subdir / "subtest2.py").touch()
148
+
149
+ Path("test1.py").touch()
150
+ Path("test2.py").touch()
151
+
152
+ # Add some files to the chat session
153
+ commands.cmd_add("*.py")
154
+
155
+ self.assertEqual(len(coder.abs_fnames), 2)
156
+
157
+ # Call the cmd_drop method with a glob pattern
158
+ commands.cmd_drop("*2.py")
159
+
160
+ self.assertIn(str(Path("test1.py").resolve()), coder.abs_fnames)
161
+ self.assertNotIn(str(Path("test2.py").resolve()), coder.abs_fnames)
162
+
163
+ def test_cmd_add_bad_encoding(self):
164
+ # Initialize the Commands and InputOutput objects
165
+ io = InputOutput(pretty=False, yes=True)
166
+ from aider.coders import Coder
167
+
168
+ coder = Coder.create(models.GPT35, None, io)
169
+ commands = Commands(io, coder)
170
+
171
+ # Create a new file foo.bad which will fail to decode as utf-8
172
+ with codecs.open("foo.bad", "w", encoding="iso-8859-15") as f:
173
+ f.write("ÆØÅ") # Characters not present in utf-8
174
+
175
+ commands.cmd_add("foo.bad")
176
+
177
+ self.assertEqual(coder.abs_fnames, set())
178
+
179
+ def test_cmd_git(self):
180
+ # Initialize the Commands and InputOutput objects
181
+ io = InputOutput(pretty=False, yes=True)
182
+
183
+ with GitTemporaryDirectory() as tempdir:
184
+ # Create a file in the temporary directory
185
+ with open(f"{tempdir}/test.txt", "w") as f:
186
+ f.write("test")
187
+
188
+ coder = Coder.create(models.GPT35, None, io)
189
+ commands = Commands(io, coder)
190
+
191
+ # Run the cmd_git method with the arguments "commit -a -m msg"
192
+ commands.cmd_git("add test.txt")
193
+ commands.cmd_git("commit -a -m msg")
194
+
195
+ # Check if the file has been committed to the repository
196
+ repo = git.Repo(tempdir)
197
+ files_in_repo = repo.git.ls_files()
198
+ self.assertIn("test.txt", files_in_repo)
199
+
200
+ def test_cmd_tokens(self):
201
+ # Initialize the Commands and InputOutput objects
202
+ io = InputOutput(pretty=False, yes=True)
203
+
204
+ coder = Coder.create(models.GPT35, None, io)
205
+ commands = Commands(io, coder)
206
+
207
+ commands.cmd_add("foo.txt bar.txt")
208
+
209
+ # Redirect the standard output to an instance of io.StringIO
210
+ stdout = StringIO()
211
+ sys.stdout = stdout
212
+
213
+ commands.cmd_tokens("")
214
+
215
+ # Reset the standard output
216
+ sys.stdout = sys.__stdout__
217
+
218
+ # Get the console output
219
+ console_output = stdout.getvalue()
220
+
221
+ self.assertIn("foo.txt", console_output)
222
+ self.assertIn("bar.txt", console_output)
223
+
224
+ def test_cmd_add_from_subdir(self):
225
+ repo = git.Repo.init()
226
+ repo.config_writer().set_value("user", "name", "Test User").release()
227
+ repo.config_writer().set_value("user", "email", "testuser@example.com").release()
228
+
229
+ # Create three empty files and add them to the git repository
230
+ filenames = ["one.py", Path("subdir") / "two.py", Path("anotherdir") / "three.py"]
231
+ for filename in filenames:
232
+ file_path = Path(filename)
233
+ file_path.parent.mkdir(parents=True, exist_ok=True)
234
+ file_path.touch()
235
+ repo.git.add(str(file_path))
236
+ repo.git.commit("-m", "added")
237
+
238
+ filenames = [str(Path(fn).resolve()) for fn in filenames]
239
+
240
+ ###
241
+
242
+ os.chdir("subdir")
243
+
244
+ io = InputOutput(pretty=False, yes=True)
245
+ coder = Coder.create(models.GPT35, None, io)
246
+ commands = Commands(io, coder)
247
+
248
+ # this should get added
249
+ commands.cmd_add(str(Path("anotherdir") / "three.py"))
250
+
251
+ # this should add one.py
252
+ commands.cmd_add("*.py")
253
+
254
+ self.assertIn(filenames[0], coder.abs_fnames)
255
+ self.assertNotIn(filenames[1], coder.abs_fnames)
256
+ self.assertIn(filenames[2], coder.abs_fnames)
257
+
258
+ def test_cmd_commit(self):
259
+ with GitTemporaryDirectory():
260
+ fname = "test.txt"
261
+ with open(fname, "w") as f:
262
+ f.write("test")
263
+ repo = git.Repo()
264
+ repo.git.add(fname)
265
+ repo.git.commit("-m", "initial")
266
+
267
+ io = InputOutput(pretty=False, yes=True)
268
+ coder = Coder.create(models.GPT35, None, io)
269
+ commands = Commands(io, coder)
270
+
271
+ self.assertFalse(repo.is_dirty())
272
+ with open(fname, "w") as f:
273
+ f.write("new")
274
+ self.assertTrue(repo.is_dirty())
275
+
276
+ commit_message = "Test commit message"
277
+ commands.cmd_commit(commit_message)
278
+ self.assertFalse(repo.is_dirty())
testbed/Aider-AI__aider/tests/test_models.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import unittest
2
+
3
+ from aider.models import Model
4
+
5
+
6
+ class TestModels(unittest.TestCase):
7
+ def test_max_context_tokens(self):
8
+ model = Model("gpt-3.5-turbo")
9
+ self.assertEqual(model.max_context_tokens, 4 * 1024)
10
+
11
+ model = Model("gpt-3.5-turbo-16k")
12
+ self.assertEqual(model.max_context_tokens, 16 * 1024)
13
+
14
+ model = Model("gpt-4")
15
+ self.assertEqual(model.max_context_tokens, 8 * 1024)
16
+
17
+ model = Model("gpt-4-32k")
18
+ self.assertEqual(model.max_context_tokens, 32 * 1024)
19
+
20
+ model = Model("gpt-4-0101")
21
+ self.assertEqual(model.max_context_tokens, 8 * 1024)
22
+
23
+ model = Model("gpt-4-32k-2123")
24
+ self.assertEqual(model.max_context_tokens, 32 * 1024)
25
+
26
+
27
+ if __name__ == "__main__":
28
+ unittest.main()
testbed/Aider-AI__aider/tests/test_sendchat.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import unittest
2
+ from unittest.mock import patch
3
+
4
+ import openai
5
+ import requests
6
+
7
+ from aider.sendchat import send_with_retries
8
+
9
+
10
+ class TestSendChat(unittest.TestCase):
11
+ @patch("aider.sendchat.openai.ChatCompletion.create")
12
+ @patch("builtins.print")
13
+ def test_send_with_retries_rate_limit_error(self, mock_print, mock_chat_completion_create):
14
+ # Set up the mock to raise RateLimitError on
15
+ # the first call and return None on the second call
16
+ mock_chat_completion_create.side_effect = [
17
+ openai.error.RateLimitError("Rate limit exceeded"),
18
+ None,
19
+ ]
20
+
21
+ # Call the send_with_retries method
22
+ send_with_retries("model", ["message"], None, False)
23
+
24
+ # Assert that print was called once
25
+ mock_print.assert_called_once()
26
+
27
+ @patch("aider.sendchat.openai.ChatCompletion.create")
28
+ @patch("builtins.print")
29
+ def test_send_with_retries_connection_error(self, mock_print, mock_chat_completion_create):
30
+ # Set up the mock to raise ConnectionError on the first call
31
+ # and return None on the second call
32
+ mock_chat_completion_create.side_effect = [
33
+ requests.exceptions.ConnectionError("Connection error"),
34
+ None,
35
+ ]
36
+
37
+ # Call the send_with_retries method
38
+ send_with_retries("model", ["message"], None, False)
39
+
40
+ # Assert that print was called once
41
+ mock_print.assert_called_once()
testbed/Aider-AI__aider/tests/test_wholefile.py ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+ import tempfile
4
+ import unittest
5
+ from pathlib import Path
6
+ from unittest.mock import MagicMock, patch
7
+
8
+ from aider import models
9
+ from aider.coders import Coder
10
+ from aider.coders.wholefile_coder import WholeFileCoder
11
+ from aider.dump import dump # noqa: F401
12
+ from aider.io import InputOutput
13
+
14
+
15
+ class TestWholeFileCoder(unittest.TestCase):
16
+ def setUp(self):
17
+ self.original_cwd = os.getcwd()
18
+ self.tempdir = tempfile.mkdtemp()
19
+ os.chdir(self.tempdir)
20
+
21
+ self.patcher = patch("aider.coders.base_coder.check_model_availability")
22
+ self.mock_check = self.patcher.start()
23
+ self.mock_check.return_value = True
24
+
25
+ def tearDown(self):
26
+ os.chdir(self.original_cwd)
27
+ shutil.rmtree(self.tempdir, ignore_errors=True)
28
+
29
+ self.patcher.stop()
30
+
31
+ def test_no_files(self):
32
+ # Initialize WholeFileCoder with the temporary directory
33
+ io = InputOutput(yes=True)
34
+
35
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[])
36
+ coder.partial_response_content = (
37
+ 'To print "Hello, World!" in most programming languages, you can use the following'
38
+ ' code:\n\n```python\nprint("Hello, World!")\n```\n\nThis code will output "Hello,'
39
+ ' World!" to the console.'
40
+ )
41
+
42
+ # This is throwing ValueError!
43
+ coder.render_incremental_response(True)
44
+
45
+ def test_no_files_new_file_should_ask(self):
46
+ io = InputOutput(yes=False) # <- yes=FALSE
47
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[])
48
+ coder.partial_response_content = (
49
+ 'To print "Hello, World!" in most programming languages, you can use the following'
50
+ ' code:\n\nfoo.js\n```python\nprint("Hello, World!")\n```\n\nThis code will output'
51
+ ' "Hello, World!" to the console.'
52
+ )
53
+ coder.update_files()
54
+ self.assertFalse(Path("foo.js").exists())
55
+
56
+ def test_update_files(self):
57
+ # Create a sample file in the temporary directory
58
+ sample_file = "sample.txt"
59
+ with open(sample_file, "w") as f:
60
+ f.write("Original content\n")
61
+
62
+ # Initialize WholeFileCoder with the temporary directory
63
+ io = InputOutput(yes=True)
64
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[sample_file])
65
+
66
+ # Set the partial response content with the updated content
67
+ coder.partial_response_content = f"{sample_file}\n```\nUpdated content\n```"
68
+
69
+ # Call update_files method
70
+ edited_files = coder.update_files()
71
+
72
+ # Check if the sample file was updated
73
+ self.assertIn("sample.txt", edited_files)
74
+
75
+ # Check if the content of the sample file was updated
76
+ with open(sample_file, "r") as f:
77
+ updated_content = f.read()
78
+ self.assertEqual(updated_content, "Updated content\n")
79
+
80
+ def test_update_files_live_diff(self):
81
+ # Create a sample file in the temporary directory
82
+ sample_file = "sample.txt"
83
+ with open(sample_file, "w") as f:
84
+ f.write("\n".join(map(str, range(0, 100))))
85
+
86
+ # Initialize WholeFileCoder with the temporary directory
87
+ io = InputOutput(yes=True)
88
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[sample_file])
89
+
90
+ # Set the partial response content with the updated content
91
+ coder.partial_response_content = f"{sample_file}\n```\n0\n\1\n2\n"
92
+
93
+ lines = coder.update_files(mode="diff").splitlines()
94
+
95
+ # the live diff should be concise, since we haven't changed anything yet
96
+ self.assertLess(len(lines), 20)
97
+
98
+ def test_update_files_with_existing_fence(self):
99
+ # Create a sample file in the temporary directory
100
+ sample_file = "sample.txt"
101
+ original_content = """
102
+ Here is some quoted text:
103
+ ```
104
+ Quote!
105
+ ```
106
+ """
107
+ with open(sample_file, "w") as f:
108
+ f.write(original_content)
109
+
110
+ # Initialize WholeFileCoder with the temporary directory
111
+ io = InputOutput(yes=True)
112
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[sample_file])
113
+
114
+ coder.choose_fence()
115
+
116
+ self.assertNotEqual(coder.fence[0], "```")
117
+
118
+ # Set the partial response content with the updated content
119
+ coder.partial_response_content = (
120
+ f"{sample_file}\n{coder.fence[0]}\nUpdated content\n{coder.fence[1]}"
121
+ )
122
+
123
+ # Call update_files method
124
+ edited_files = coder.update_files()
125
+
126
+ # Check if the sample file was updated
127
+ self.assertIn("sample.txt", edited_files)
128
+
129
+ # Check if the content of the sample file was updated
130
+ with open(sample_file, "r") as f:
131
+ updated_content = f.read()
132
+ self.assertEqual(updated_content, "Updated content\n")
133
+
134
+ def test_update_files_bogus_path_prefix(self):
135
+ # Create a sample file in the temporary directory
136
+ sample_file = "sample.txt"
137
+ with open(sample_file, "w") as f:
138
+ f.write("Original content\n")
139
+
140
+ # Initialize WholeFileCoder with the temporary directory
141
+ io = InputOutput(yes=True)
142
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[sample_file])
143
+
144
+ # Set the partial response content with the updated content
145
+ # With path/to/ prepended onto the filename
146
+ coder.partial_response_content = f"path/to/{sample_file}\n```\nUpdated content\n```"
147
+
148
+ # Call update_files method
149
+ edited_files = coder.update_files()
150
+
151
+ # Check if the sample file was updated
152
+ self.assertIn("sample.txt", edited_files)
153
+
154
+ # Check if the content of the sample file was updated
155
+ with open(sample_file, "r") as f:
156
+ updated_content = f.read()
157
+ self.assertEqual(updated_content, "Updated content\n")
158
+
159
+ def test_update_files_not_in_chat(self):
160
+ # Create a sample file in the temporary directory
161
+ sample_file = "sample.txt"
162
+ with open(sample_file, "w") as f:
163
+ f.write("Original content\n")
164
+
165
+ # Initialize WholeFileCoder with the temporary directory
166
+ io = InputOutput(yes=True)
167
+ coder = WholeFileCoder(main_model=models.GPT35, io=io)
168
+
169
+ # Set the partial response content with the updated content
170
+ coder.partial_response_content = f"{sample_file}\n```\nUpdated content\n```"
171
+
172
+ # Call update_files method
173
+ edited_files = coder.update_files()
174
+
175
+ # Check if the sample file was updated
176
+ self.assertIn("sample.txt", edited_files)
177
+
178
+ # Check if the content of the sample file was updated
179
+ with open(sample_file, "r") as f:
180
+ updated_content = f.read()
181
+ self.assertEqual(updated_content, "Updated content\n")
182
+
183
+ def test_update_files_no_filename_single_file_in_chat(self):
184
+ sample_file = "accumulate.py"
185
+ content = (
186
+ "def accumulate(collection, operation):\n return [operation(x) for x in"
187
+ " collection]\n"
188
+ )
189
+
190
+ with open(sample_file, "w") as f:
191
+ f.write("Original content\n")
192
+
193
+ # Initialize WholeFileCoder with the temporary directory
194
+ io = InputOutput(yes=True)
195
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[sample_file])
196
+
197
+ # Set the partial response content with the updated content
198
+ coder.partial_response_content = (
199
+ f"Here's the modified `{sample_file}` file that implements the `accumulate`"
200
+ f" function as per the given instructions:\n\n```\n{content}```\n\nThis"
201
+ " implementation uses a list comprehension to apply the `operation` function to"
202
+ " each element of the `collection` and returns the resulting list."
203
+ )
204
+
205
+ # Call update_files method
206
+ edited_files = coder.update_files()
207
+
208
+ # Check if the sample file was updated
209
+ self.assertIn(sample_file, edited_files)
210
+
211
+ # Check if the content of the sample file was updated
212
+ with open(sample_file, "r") as f:
213
+ updated_content = f.read()
214
+ self.assertEqual(updated_content, content)
215
+
216
+ def test_update_files_earlier_filename(self):
217
+ fname_a = Path("a.txt")
218
+ fname_b = Path("b.txt")
219
+
220
+ fname_a.write_text("before a\n")
221
+ fname_b.write_text("before b\n")
222
+
223
+ response = """
224
+ Here is a new version of `a.txt` for you to consider:
225
+
226
+ ```
227
+ after a
228
+ ```
229
+
230
+ And here is `b.txt`:
231
+
232
+ ```
233
+ after b
234
+ ```
235
+ """
236
+ # Initialize WholeFileCoder with the temporary directory
237
+ io = InputOutput(yes=True)
238
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[fname_a, fname_b])
239
+
240
+ # Set the partial response content with the updated content
241
+ coder.partial_response_content = response
242
+
243
+ # Call update_files method
244
+ edited_files = coder.update_files()
245
+
246
+ # Check if the sample file was updated
247
+ self.assertIn(str(fname_a), edited_files)
248
+ self.assertIn(str(fname_b), edited_files)
249
+
250
+ self.assertEqual(fname_a.read_text(), "after a\n")
251
+ self.assertEqual(fname_b.read_text(), "after b\n")
252
+
253
+ def test_update_named_file_but_extra_unnamed_code_block(self):
254
+ sample_file = "hello.py"
255
+ new_content = "new\ncontent\ngoes\nhere\n"
256
+
257
+ with open(sample_file, "w") as f:
258
+ f.write("Original content\n")
259
+
260
+ # Initialize WholeFileCoder with the temporary directory
261
+ io = InputOutput(yes=True)
262
+ coder = WholeFileCoder(main_model=models.GPT35, io=io, fnames=[sample_file])
263
+
264
+ # Set the partial response content with the updated content
265
+ coder.partial_response_content = (
266
+ f"Here's the modified `{sample_file}` file that implements the `accumulate`"
267
+ f" function as per the given instructions:\n\n```\n{new_content}```\n\nThis"
268
+ " implementation uses a list comprehension to apply the `operation` function to"
269
+ " each element of the `collection` and returns the resulting list.\n"
270
+ "Run it like this:\n\n"
271
+ "```\npython {sample_file}\n```\n\n"
272
+ )
273
+
274
+ # Call update_files method
275
+ edited_files = coder.update_files()
276
+
277
+ # Check if the sample file was updated
278
+ self.assertIn(sample_file, edited_files)
279
+
280
+ # Check if the content of the sample file was updated
281
+ with open(sample_file, "r") as f:
282
+ updated_content = f.read()
283
+ self.assertEqual(updated_content, new_content)
284
+
285
+ def test_full_edit(self):
286
+ # Create a few temporary files
287
+ _, file1 = tempfile.mkstemp()
288
+
289
+ with open(file1, "w", encoding="utf-8") as f:
290
+ f.write("one\ntwo\nthree\n")
291
+
292
+ files = [file1]
293
+
294
+ # Initialize the Coder object with the mocked IO and mocked repo
295
+ coder = Coder.create(models.GPT4, "whole", io=InputOutput(), fnames=files)
296
+
297
+ # no trailing newline so the response content below doesn't add ANOTHER newline
298
+ new_content = "new\ntwo\nthree"
299
+
300
+ def mock_send(*args, **kwargs):
301
+ coder.partial_response_content = f"""
302
+ Do this:
303
+
304
+ {Path(file1).name}
305
+ ```
306
+ {new_content}
307
+ ```
308
+
309
+ """
310
+ coder.partial_response_function_call = dict()
311
+
312
+ coder.send = MagicMock(side_effect=mock_send)
313
+
314
+ # Call the run method with a message
315
+ coder.run(with_message="hi")
316
+
317
+ content = Path(file1).read_text(encoding="utf-8")
318
+
319
+ # check for one trailing newline
320
+ self.assertEqual(content, new_content + "\n")
321
+
322
+
323
+ if __name__ == "__main__":
324
+ unittest.main()
testbed/Cog-Creators__Red-DiscordBot/.bandit.yml ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ### Bandit config file generated
3
+
4
+ ### This config may optionally select a subset of tests to run or skip by
5
+ ### filling out the 'tests' and 'skips' lists given below. If no tests are
6
+ ### specified for inclusion then it is assumed all tests are desired. The skips
7
+ ### set will remove specific tests from the include set. This can be controlled
8
+ ### using the -t/-s CLI options. Note that the same test ID should not appear
9
+ ### in both 'tests' and 'skips', this would be nonsensical and is detected by
10
+ ### Bandit at runtime.
11
+
12
+ # Available tests:
13
+ # B101 : assert_used
14
+ # B102 : exec_used
15
+ # B103 : set_bad_file_permissions
16
+ # B104 : hardcoded_bind_all_interfaces
17
+ # B105 : hardcoded_password_string
18
+ # B106 : hardcoded_password_funcarg
19
+ # B107 : hardcoded_password_default
20
+ # B108 : hardcoded_tmp_directory
21
+ # B110 : try_except_pass
22
+ # B112 : try_except_continue
23
+ # B201 : flask_debug_true
24
+ # B301 : pickle
25
+ # B302 : marshal
26
+ # B303 : md5
27
+ # B304 : ciphers
28
+ # B305 : cipher_modes
29
+ # B306 : mktemp_q
30
+ # B307 : eval
31
+ # B308 : mark_safe
32
+ # B309 : httpsconnection
33
+ # B310 : urllib_urlopen
34
+ # B311 : random
35
+ # B312 : telnetlib
36
+ # B313 : xml_bad_cElementTree
37
+ # B314 : xml_bad_ElementTree
38
+ # B315 : xml_bad_expatreader
39
+ # B316 : xml_bad_expatbuilder
40
+ # B317 : xml_bad_sax
41
+ # B318 : xml_bad_minidom
42
+ # B319 : xml_bad_pulldom
43
+ # B320 : xml_bad_etree
44
+ # B321 : ftplib
45
+ # B322 : input
46
+ # B323 : unverified_context
47
+ # B324 : hashlib_new_insecure_functions
48
+ # B325 : tempnam
49
+ # B401 : import_telnetlib
50
+ # B402 : import_ftplib
51
+ # B403 : import_pickle
52
+ # B404 : import_subprocess
53
+ # B405 : import_xml_etree
54
+ # B406 : import_xml_sax
55
+ # B407 : import_xml_expat
56
+ # B408 : import_xml_minidom
57
+ # B409 : import_xml_pulldom
58
+ # B410 : import_lxml
59
+ # B411 : import_xmlrpclib
60
+ # B412 : import_httpoxy
61
+ # B413 : import_pycrypto
62
+ # B501 : request_with_no_cert_validation
63
+ # B502 : ssl_with_bad_version
64
+ # B503 : ssl_with_bad_defaults
65
+ # B504 : ssl_with_no_version
66
+ # B505 : weak_cryptographic_key
67
+ # B506 : yaml_load
68
+ # B507 : ssh_no_host_key_verification
69
+ # B601 : paramiko_calls
70
+ # B602 : subprocess_popen_with_shell_equals_true
71
+ # B603 : subprocess_without_shell_equals_true
72
+ # B604 : any_other_function_with_shell_equals_true
73
+ # B605 : start_process_with_a_shell
74
+ # B606 : start_process_with_no_shell
75
+ # B607 : start_process_with_partial_path
76
+ # B608 : hardcoded_sql_expressions
77
+ # B609 : linux_commands_wildcard_injection
78
+ # B610 : django_extra_used
79
+ # B611 : django_rawsql_used
80
+ # B701 : jinja2_autoescape_false
81
+ # B702 : use_of_mako_templates
82
+ # B703 : django_mark_safe
83
+
84
+ # (optional) list included test IDs here, eg '[B101, B406]':
85
+ tests:
86
+
87
+ # (optional) list skipped test IDs here, eg '[B101, B406]':
88
+ skips: ['B322']
89
+
90
+ ### (optional) plugin settings - some test plugins require configuration data
91
+ ### that may be given here, per-plugin. All bandit test plugins have a built in
92
+ ### set of sensible defaults and these will be used if no configuration is
93
+ ### provided. It is not necessary to provide settings for every (or any) plugin
94
+ ### if the defaults are acceptable.
95
+
96
+ any_other_function_with_shell_equals_true:
97
+ no_shell:
98
+ - os.execl
99
+ - os.execle
100
+ - os.execlp
101
+ - os.execlpe
102
+ - os.execv
103
+ - os.execve
104
+ - os.execvp
105
+ - os.execvpe
106
+ - os.spawnl
107
+ - os.spawnle
108
+ - os.spawnlp
109
+ - os.spawnlpe
110
+ - os.spawnv
111
+ - os.spawnve
112
+ - os.spawnvp
113
+ - os.spawnvpe
114
+ - os.startfile
115
+ shell:
116
+ - os.system
117
+ - os.popen
118
+ - os.popen2
119
+ - os.popen3
120
+ - os.popen4
121
+ - popen2.popen2
122
+ - popen2.popen3
123
+ - popen2.popen4
124
+ - popen2.Popen3
125
+ - popen2.Popen4
126
+ - commands.getoutput
127
+ - commands.getstatusoutput
128
+ subprocess:
129
+ - subprocess.Popen
130
+ - subprocess.call
131
+ - subprocess.check_call
132
+ - subprocess.check_output
133
+ - subprocess.run
134
+ hardcoded_tmp_directory:
135
+ tmp_dirs:
136
+ - /tmp
137
+ - /var/tmp
138
+ - /dev/shm
139
+ linux_commands_wildcard_injection:
140
+ no_shell:
141
+ - os.execl
142
+ - os.execle
143
+ - os.execlp
144
+ - os.execlpe
145
+ - os.execv
146
+ - os.execve
147
+ - os.execvp
148
+ - os.execvpe
149
+ - os.spawnl
150
+ - os.spawnle
151
+ - os.spawnlp
152
+ - os.spawnlpe
153
+ - os.spawnv
154
+ - os.spawnve
155
+ - os.spawnvp
156
+ - os.spawnvpe
157
+ - os.startfile
158
+ shell:
159
+ - os.system
160
+ - os.popen
161
+ - os.popen2
162
+ - os.popen3
163
+ - os.popen4
164
+ - popen2.popen2
165
+ - popen2.popen3
166
+ - popen2.popen4
167
+ - popen2.Popen3
168
+ - popen2.Popen4
169
+ - commands.getoutput
170
+ - commands.getstatusoutput
171
+ subprocess:
172
+ - subprocess.Popen
173
+ - subprocess.call
174
+ - subprocess.check_call
175
+ - subprocess.check_output
176
+ - subprocess.run
177
+ ssl_with_bad_defaults:
178
+ bad_protocol_versions:
179
+ - PROTOCOL_SSLv2
180
+ - SSLv2_METHOD
181
+ - SSLv23_METHOD
182
+ - PROTOCOL_SSLv3
183
+ - PROTOCOL_TLSv1
184
+ - SSLv3_METHOD
185
+ - TLSv1_METHOD
186
+ ssl_with_bad_version:
187
+ bad_protocol_versions:
188
+ - PROTOCOL_SSLv2
189
+ - SSLv2_METHOD
190
+ - SSLv23_METHOD
191
+ - PROTOCOL_SSLv3
192
+ - PROTOCOL_TLSv1
193
+ - SSLv3_METHOD
194
+ - TLSv1_METHOD
195
+ start_process_with_a_shell:
196
+ no_shell:
197
+ - os.execl
198
+ - os.execle
199
+ - os.execlp
200
+ - os.execlpe
201
+ - os.execv
202
+ - os.execve
203
+ - os.execvp
204
+ - os.execvpe
205
+ - os.spawnl
206
+ - os.spawnle
207
+ - os.spawnlp
208
+ - os.spawnlpe
209
+ - os.spawnv
210
+ - os.spawnve
211
+ - os.spawnvp
212
+ - os.spawnvpe
213
+ - os.startfile
214
+ shell:
215
+ - os.system
216
+ - os.popen
217
+ - os.popen2
218
+ - os.popen3
219
+ - os.popen4
220
+ - popen2.popen2
221
+ - popen2.popen3
222
+ - popen2.popen4
223
+ - popen2.Popen3
224
+ - popen2.Popen4
225
+ - commands.getoutput
226
+ - commands.getstatusoutput
227
+ subprocess:
228
+ - subprocess.Popen
229
+ - subprocess.call
230
+ - subprocess.check_call
231
+ - subprocess.check_output
232
+ - subprocess.run
233
+ start_process_with_no_shell:
234
+ no_shell:
235
+ - os.execl
236
+ - os.execle
237
+ - os.execlp
238
+ - os.execlpe
239
+ - os.execv
240
+ - os.execve
241
+ - os.execvp
242
+ - os.execvpe
243
+ - os.spawnl
244
+ - os.spawnle
245
+ - os.spawnlp
246
+ - os.spawnlpe
247
+ - os.spawnv
248
+ - os.spawnve
249
+ - os.spawnvp
250
+ - os.spawnvpe
251
+ - os.startfile
252
+ shell:
253
+ - os.system
254
+ - os.popen
255
+ - os.popen2
256
+ - os.popen3
257
+ - os.popen4
258
+ - popen2.popen2
259
+ - popen2.popen3
260
+ - popen2.popen4
261
+ - popen2.Popen3
262
+ - popen2.Popen4
263
+ - commands.getoutput
264
+ - commands.getstatusoutput
265
+ subprocess:
266
+ - subprocess.Popen
267
+ - subprocess.call
268
+ - subprocess.check_call
269
+ - subprocess.check_output
270
+ - subprocess.run
271
+ start_process_with_partial_path:
272
+ no_shell:
273
+ - os.execl
274
+ - os.execle
275
+ - os.execlp
276
+ - os.execlpe
277
+ - os.execv
278
+ - os.execve
279
+ - os.execvp
280
+ - os.execvpe
281
+ - os.spawnl
282
+ - os.spawnle
283
+ - os.spawnlp
284
+ - os.spawnlpe
285
+ - os.spawnv
286
+ - os.spawnve
287
+ - os.spawnvp
288
+ - os.spawnvpe
289
+ - os.startfile
290
+ shell:
291
+ - os.system
292
+ - os.popen
293
+ - os.popen2
294
+ - os.popen3
295
+ - os.popen4
296
+ - popen2.popen2
297
+ - popen2.popen3
298
+ - popen2.popen4
299
+ - popen2.Popen3
300
+ - popen2.Popen4
301
+ - commands.getoutput
302
+ - commands.getstatusoutput
303
+ subprocess:
304
+ - subprocess.Popen
305
+ - subprocess.call
306
+ - subprocess.check_call
307
+ - subprocess.check_output
308
+ - subprocess.run
309
+ subprocess_popen_with_shell_equals_true:
310
+ no_shell:
311
+ - os.execl
312
+ - os.execle
313
+ - os.execlp
314
+ - os.execlpe
315
+ - os.execv
316
+ - os.execve
317
+ - os.execvp
318
+ - os.execvpe
319
+ - os.spawnl
320
+ - os.spawnle
321
+ - os.spawnlp
322
+ - os.spawnlpe
323
+ - os.spawnv
324
+ - os.spawnve
325
+ - os.spawnvp
326
+ - os.spawnvpe
327
+ - os.startfile
328
+ shell:
329
+ - os.system
330
+ - os.popen
331
+ - os.popen2
332
+ - os.popen3
333
+ - os.popen4
334
+ - popen2.popen2
335
+ - popen2.popen3
336
+ - popen2.popen4
337
+ - popen2.Popen3
338
+ - popen2.Popen4
339
+ - commands.getoutput
340
+ - commands.getstatusoutput
341
+ subprocess:
342
+ - subprocess.Popen
343
+ - subprocess.call
344
+ - subprocess.check_call
345
+ - subprocess.check_output
346
+ - subprocess.run
347
+ subprocess_without_shell_equals_true:
348
+ no_shell:
349
+ - os.execl
350
+ - os.execle
351
+ - os.execlp
352
+ - os.execlpe
353
+ - os.execv
354
+ - os.execve
355
+ - os.execvp
356
+ - os.execvpe
357
+ - os.spawnl
358
+ - os.spawnle
359
+ - os.spawnlp
360
+ - os.spawnlpe
361
+ - os.spawnv
362
+ - os.spawnve
363
+ - os.spawnvp
364
+ - os.spawnvpe
365
+ - os.startfile
366
+ shell:
367
+ - os.system
368
+ - os.popen
369
+ - os.popen2
370
+ - os.popen3
371
+ - os.popen4
372
+ - popen2.popen2
373
+ - popen2.popen3
374
+ - popen2.popen4
375
+ - popen2.Popen3
376
+ - popen2.Popen4
377
+ - commands.getoutput
378
+ - commands.getstatusoutput
379
+ subprocess:
380
+ - subprocess.Popen
381
+ - subprocess.call
382
+ - subprocess.check_call
383
+ - subprocess.check_output
384
+ - subprocess.run
385
+ try_except_continue:
386
+ check_typed_exception: false
387
+ try_except_pass:
388
+ check_typed_exception: false
389
+ weak_cryptographic_key:
390
+ weak_key_size_dsa_high: 1024
391
+ weak_key_size_dsa_medium: 2048
392
+ weak_key_size_ec_high: 160
393
+ weak_key_size_ec_medium: 224
394
+ weak_key_size_rsa_high: 1024
395
+ weak_key_size_rsa_medium: 2048
396
+
testbed/Cog-Creators__Red-DiscordBot/.cherry_picker.toml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ team = "Cog-Creators"
2
+ repo = "Red-DiscordBot"
3
+ check_sha = "6251c585e4ec0a53813a9993ede3ab5309024579"
4
+ fix_commit_msg = false
5
+ default_branch = "V3/develop"
testbed/Cog-Creators__Red-DiscordBot/.codeclimate.yml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: "2" # required to adjust maintainability checks
2
+ checks:
3
+ argument-count:
4
+ config:
5
+ threshold: 8 # work on this later
6
+ complex-logic:
7
+ enabled: false # Disabled in favor of using Radon for this
8
+ config:
9
+ threshold: 4
10
+ file-lines:
11
+ enabled: false # enable after audio stuff...
12
+ config:
13
+ threshold: 2000 # I would set this lower if not for cogs as command containers.
14
+ method-complexity:
15
+ enabled: false # Disabled in favor of using Radon for this
16
+ config:
17
+ threshold: 5
18
+ method-count:
19
+ enabled: false # I would set this lower if not for cogs as command containers.
20
+ config:
21
+ threshold: 20
22
+ method-lines:
23
+ enabled: false
24
+ config:
25
+ threshold: 25 # I'm fine with long methods, cautious about the complexity of a single method.
26
+ nested-control-flow:
27
+ config:
28
+ threshold: 6
29
+ return-statements:
30
+ config:
31
+ threshold: 6
32
+ similar-code:
33
+ enabled: false
34
+ config:
35
+ threshold: # language-specific defaults. an override will affect all languages.
36
+ identical-code:
37
+ enabled: false
38
+ config:
39
+ threshold: # language-specific defaults. an override will affect all languages.
40
+ plugins:
41
+ bandit:
42
+ enabled: false
43
+ radon:
44
+ enabled: false
45
+ config:
46
+ threshold: "D"
47
+ duplication:
48
+ enabled: false
49
+ config:
50
+ languages:
51
+ python:
52
+ python_version: 3
testbed/Cog-Creators__Red-DiscordBot/.git_archive_info.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ $Format:%h$
2
+ $Format:%(describe:tags=true)$
testbed/Cog-Creators__Red-DiscordBot/.gitattributes ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ * text eol=lf
2
+
3
+ # binary file excludsions
4
+ *.png binary
5
+
6
+ # include commit/tag information in `.git_archive_info.txt` when packing with git-archive
7
+ .git_archive_info.txt export-subst
testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/01_command_bug.yml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Bug reports for commands
2
+ description: For bugs that involve commands found within Red.
3
+ labels: 'Type: Bug'
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thank you for taking the time to fill out an issue. This template is meant for any issues related to commands.
9
+ If you require help with installing Red we ask that you join our [Discord server](https://discord.gg/red)
10
+ - type: input
11
+ id: red-version
12
+ attributes:
13
+ label: "What Red version are you using?"
14
+ placeholder: 3.4.5
15
+ validations:
16
+ required: true
17
+ - type: dropdown
18
+ id: cog-name
19
+ attributes:
20
+ label: "Cog name"
21
+ description: "From which cog does the command come from?"
22
+ options:
23
+ - Admin
24
+ - Alias
25
+ - Audio
26
+ - Bank
27
+ - Cleanup
28
+ - CogManagerUI
29
+ - Core
30
+ - Customcom
31
+ - Dev
32
+ - Downloader
33
+ - Economy
34
+ - Filter
35
+ - General
36
+ - Image
37
+ - Mod
38
+ - Modlog
39
+ - Mutes
40
+ - Permissions
41
+ - Reports
42
+ - Streams
43
+ - Trivia
44
+ - Warnings
45
+ validations:
46
+ required: true
47
+ - type: input
48
+ id: command-name
49
+ attributes:
50
+ label: "Command name"
51
+ description: "What is the command that caused the error?"
52
+ placeholder: "play"
53
+ validations:
54
+ required: true
55
+ - type: textarea
56
+ id: weh
57
+ attributes:
58
+ label: "What did you expect to happen?"
59
+ validations:
60
+ required: true
61
+ - type: textarea
62
+ id: wah
63
+ attributes:
64
+ label: "What actually happened?"
65
+ description: |
66
+ A clear and concise description of what the bug is.
67
+ If the issue is visual in nature, consider posting a screenshot.
68
+ validations:
69
+ required: true
70
+ - type: textarea
71
+ id: reproduction-steps
72
+ attributes:
73
+ label: "How can we reproduce this error?"
74
+ description: "List of steps required to reproduce this error."
75
+ value: |
76
+ 1.
77
+ 2.
78
+ 3.
79
+ ...
80
+ validations:
81
+ required: true
82
+ - type: textarea
83
+ id: anything-else
84
+ attributes:
85
+ label: Anything else?
86
+ description: Let us know if you have anything else to share.
testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/02_other_bugs.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Bug report
2
+ description: "For bugs that don't involve a command."
3
+ labels: 'Type: Bug'
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thank you for taking the time to fill out an issue. This template is meant for any issues not related to any existing command.
9
+ If you require help with installing Red we ask that you join our [Discord server](https://discord.gg/red)
10
+ - type: input
11
+ id: red-version
12
+ attributes:
13
+ label: "What Red version are you using?"
14
+ placeholder: 3.4.5
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: what-happened
19
+ attributes:
20
+ label: "What were you trying to do?"
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ id: weh
25
+ attributes:
26
+ label: "What did you expect to happen?"
27
+ validations:
28
+ required: true
29
+ - type: textarea
30
+ id: wah
31
+ attributes:
32
+ label: "What actually happened?"
33
+ description: |
34
+ If the issue is visual in nature, consider posting a screenshot.
35
+ validations:
36
+ required: true
37
+ - type: textarea
38
+ id: reproduction-steps
39
+ attributes:
40
+ label: "How can we reproduce this error?"
41
+ description: |
42
+ List of steps required to reproduce the error. If the bug is code related, a minimal code example that reproduces the problem would be a big help.
43
+ value: |
44
+ 1.
45
+ 2.
46
+ 3.
47
+ ...
48
+ validations:
49
+ required: true
50
+ - type: textarea
51
+ id: anything-else
52
+ attributes:
53
+ label: Anything else?
54
+ description: Let us know if you have anything else to share.
testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/03_enhancements.yml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Enhancement proposal
2
+ description: For feature requests and improvements related to already existing functionality.
3
+ labels: 'Type: Enhancement'
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thank you for taking the time to fill out an issue. This template is meant for feature requests and improvements to already existing functionality.
9
+ If you require help with installing Red we ask that you join our [Discord server](https://discord.gg/red)
10
+ - type: input
11
+ id: component-name
12
+ attributes:
13
+ label: "What component of Red (cog, command, API) would you like to see improvements on?"
14
+ placeholder: Audio
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: proposal
19
+ attributes:
20
+ label: "Describe the enhancement you're suggesting."
21
+ description: |
22
+ Feel free to describe in as much detail as you wish.
23
+ validations:
24
+ required: true
25
+ - type: textarea
26
+ id: anything-else
27
+ attributes:
28
+ label: Anything else?
29
+ description: Let us know if you have anything else to share.
testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/04_feature_request.yml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Feature request
2
+ description: For feature requests regarding Red itself.
3
+ labels: 'Type: Feature'
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thank you for taking the time to fill out an issue, this template is meant for any feature suggestions.
9
+ If you require help with installing Red we ask that you join our [Discord server](https://discord.gg/red)
10
+ - type: dropdown
11
+ id: feature-name
12
+ attributes:
13
+ label: "Type of feature request"
14
+ description: "What type of feature would you like to request?"
15
+ multiple: true
16
+ options:
17
+ - API functionality
18
+ - Cog
19
+ - Command
20
+ - Other
21
+ validations:
22
+ required: true
23
+ - type: textarea
24
+ id: proposal
25
+ attributes:
26
+ label: "Description of the feature you're suggesting"
27
+ description: |
28
+ Feel free to describe in as much detail as you wish.
29
+
30
+ If you are requesting API functionality:
31
+ - Describe what it should do
32
+ - Note whether it is to extend existing functionality or introduce new functionality
33
+
34
+ If you are requesting a cog to be included in core:
35
+ - Describe the functionality in as much detail as possible
36
+ - Include the command structure, if possible
37
+ - Please note that unless it's something that should be core functionality,
38
+ we reserve the right to reject your suggestion and point you to our cog
39
+ board to request it for a third-party cog
40
+
41
+ If you are requesting a command:
42
+ - Include what cog it should be in and a name for the command
43
+ - Describe the intended functionality for the command
44
+ - Note any restrictions on who can use the command or where it can be used
45
+ validations:
46
+ required: true
47
+ - type: textarea
48
+ id: anything-else
49
+ attributes:
50
+ label: Anything else?
51
+ description: Let us know if you have anything else to share.
52
+
testbed/Cog-Creators__Red-DiscordBot/.github/ISSUE_TEMPLATE/config.yml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Support question
4
+ url: https://discord.gg/red
5
+ about: For any questions regarding on how to operate and run Red.