Skip to content

Commit c7bd262

Browse files
authored
Merge pull request #136 from dwash96/v0.88.15
V0.88.15
2 parents 20f3649 + 65d40b3 commit c7bd262

5 files changed

Lines changed: 62 additions & 34 deletions

File tree

aider/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from packaging import version
22

3-
__version__ = "0.88.14.dev"
3+
__version__ = "0.88.15.dev"
44
safe_version = __version__
55

66
try:

aider/commands.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ async def cmd_lint(self, args="", fnames=None):
414414
)
415415

416416
lint_coder.add_rel_fname(fname)
417-
await lint_coder.run(errors)
417+
await self.coder.io.recreate_input()
418+
await lint_coder.run_one(errors, preproc=False)
418419
lint_coder.abs_fnames = set()
419420

420421
if lint_coder and self.coder.repo.is_dirty() and self.coder.auto_commits:
@@ -536,7 +537,7 @@ def cmd_tokens(self, args):
536537
tokens = self.coder.main_model.token_count_for_image(fname)
537538
else:
538539
# approximate
539-
content = f"{relative_fname}\n{fence}\n" + content + "{fence}\n"
540+
content = f"{relative_fname}\n{fence}\n" + content + f"{fence}\n"
540541
tokens = self.coder.main_model.token_count(content)
541542
file_res.append((tokens, f"{relative_fname}", "/drop to remove"))
542543

@@ -556,7 +557,7 @@ def cmd_tokens(self, args):
556557
content = self.io.read_text(fname)
557558
if content is not None and not is_image_file(relative_fname):
558559
# approximate
559-
content = f"{relative_fname}\n{fence}\n" + content + "{fence}\n"
560+
content = f"{relative_fname}\n{fence}\n" + content + f"{fence}\n"
560561
tokens = self.coder.main_model.token_count(content)
561562
file_res.append((tokens, f"{relative_fname} (read-only)", "/drop to remove"))
562563

@@ -1215,9 +1216,17 @@ async def cmd_run(self, args, add_on_nonzero_exit=False):
12151216
finally:
12161217
self.cmd_running = False
12171218

1218-
def cmd_exit(self, args):
1219+
async def cmd_exit(self, args):
12191220
"Exit the application"
12201221
self.coder.event("exit", reason="/exit")
1222+
1223+
for server in self.coder.mcp_servers:
1224+
try:
1225+
await server.exit_stack.aclose()
1226+
except Exception:
1227+
pass
1228+
1229+
await asyncio.sleep(0)
12211230
sys.exit()
12221231

12231232
def cmd_quit(self, args):

aider/io.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,8 @@ async def recreate_input(self, future=None):
699699
if coder:
700700
self.input_task = asyncio.create_task(coder.get_input())
701701
await asyncio.sleep(0)
702+
else:
703+
self.input_task = asyncio.create_task(self.get_input(None, [], [], []))
702704

703705
async def get_input(
704706
self,
@@ -1359,13 +1361,18 @@ def stream_output(self, text, final=False):
13591361
incomplete_line = ""
13601362
output = ""
13611363

1364+
lines = self.remove_consecutive_empty_strings(lines)
1365+
needs_new_line = False if len(lines) == 2 and lines[0] and not lines[-1] else True
1366+
13621367
if len(lines) > 1 or final:
13631368
# All lines except the last one are complete
13641369
complete_lines = lines[:-1] if not final else lines
13651370
incomplete_line = lines[-1] if not final else ""
1371+
last_index = len(complete_lines) - 1
13661372

1367-
for complete_line in complete_lines:
1373+
for index, complete_line in enumerate(complete_lines):
13681374
output += complete_line
1375+
output += "\n" if needs_new_line and index != last_index else ""
13691376
self._stream_line_count += 1
13701377

13711378
self._stream_buffer = incomplete_line
@@ -1380,6 +1387,17 @@ def stream_output(self, text, final=False):
13801387
self.console.print(Text.from_ansi(output) if self.has_ansi_codes(output) else output)
13811388
self.reset_streaming_response()
13821389

1390+
def remove_consecutive_empty_strings(self, string_list):
1391+
new_list = []
1392+
first_item = True
1393+
1394+
for item in string_list:
1395+
if first_item or item != "" or (new_list and new_list[-1] != ""):
1396+
first_item = False
1397+
new_list.append(item)
1398+
1399+
return new_list
1400+
13831401
def has_ansi_codes(self, s: str) -> bool:
13841402
"""Check if a string contains the ANSI escape character."""
13851403
return "\x1b" in s

aider/main.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async def setup_git(git_root, io):
124124
)
125125
return
126126
elif cwd and await io.confirm_ask(
127-
"No git repo found, create one to track aider's changes (recommended)?"
127+
"No git repo found, create one to track aider's changes (recommended)?", acknowledge=True
128128
):
129129
git_root = str(cwd.resolve())
130130
repo = await make_new_repo(git_root, io)
@@ -193,7 +193,8 @@ async def check_gitignore(git_root, io, ask=True):
193193
if ask:
194194
io.tool_output("You can skip this check with --no-gitignore")
195195
if not await io.confirm_ask(
196-
f"Add {', '.join(patterns_to_add)} to .gitignore (recommended)?"
196+
f"Add {', '.join(patterns_to_add)} to .gitignore (recommended)?",
197+
acknowledge=True,
197198
):
198199
return
199200

@@ -717,28 +718,27 @@ def get_io(pretty):
717718
posthog_host=args.analytics_posthog_host,
718719
posthog_project_api_key=args.analytics_posthog_project_api_key,
719720
)
720-
if args.analytics is not False:
721-
if analytics.need_to_ask(args.analytics):
722-
io.tool_output(
723-
"Aider respects your privacy and never collects your code, chat messages, keys or"
724-
" personal info."
725-
)
726-
io.tool_output(f"For more info: {urls.analytics}")
727-
disable = not await io.confirm_ask(
728-
"Allow collection of anonymous analytics to help improve aider?"
729-
)
730-
731-
analytics.asked_opt_in = True
732-
if disable:
733-
analytics.disable(permanently=True)
734-
io.tool_output("Analytics have been permanently disabled.")
735-
736-
analytics.save_data()
737-
io.tool_output()
738-
739-
# This is a no-op if the user has opted out
740-
analytics.enable()
741721

722+
# if args.analytics is not False:
723+
# if analytics.need_to_ask(args.analytics):
724+
# io.tool_output(
725+
# "Aider respects your privacy and never collects your code, chat messages, keys or"
726+
# " personal info."
727+
# )
728+
# io.tool_output(f"For more info: {urls.analytics}")
729+
# disable = not await io.confirm_ask(
730+
# "Allow collection of anonymous analytics to help improve aider?"
731+
# )
732+
# analytics.asked_opt_in = True
733+
# if disable:
734+
# analytics.disable(permanently=True)
735+
# io.tool_output("Analytics have been permanently disabled.")
736+
# analytics.save_data()
737+
# io.tool_output()
738+
# # This is a no-op if the user has opted out
739+
# analytics.enable()
740+
741+
analytics.disable(permanently=True)
742742
analytics.event("launched")
743743

744744
if args.gui and not return_coder:
@@ -821,11 +821,6 @@ def get_io(pretty):
821821
if args.check_update:
822822
check_version(io, verbose=args.verbose)
823823

824-
if args.git:
825-
git_root = await setup_git(git_root, io)
826-
if args.gitignore:
827-
await check_gitignore(git_root, io)
828-
829824
if args.verbose:
830825
show = format_settings(parser, args)
831826
io.tool_output(show)
@@ -1118,6 +1113,11 @@ def get_io(pretty):
11181113
analytics.event("exit", reason="Keyboard interrupt during model warnings")
11191114
return 1
11201115

1116+
if args.git:
1117+
git_root = await setup_git(git_root, io)
1118+
if args.gitignore:
1119+
await check_gitignore(git_root, io)
1120+
11211121
except UnknownEditFormat as err:
11221122
io.tool_error(str(err))
11231123
await io.offer_url(urls.edit_formats, "Open documentation about edit formats?")

aider/onboarding.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ async def offer_openrouter_oauth(io, analytics):
9393
if await io.confirm_ask(
9494
"Login to OpenRouter or create a free account?",
9595
default="y",
96+
acknowledge=True,
9697
):
9798
analytics.event("oauth_flow_initiated", provider="openrouter")
9899
openrouter_key = start_openrouter_oauth_flow(io, analytics)

0 commit comments

Comments
 (0)