chatmcp-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aider/__init__.py +20 -0
- aider/__main__.py +4 -0
- aider/_version.py +21 -0
- aider/analytics.py +250 -0
- aider/args.py +926 -0
- aider/args_formatter.py +228 -0
- aider/coders/__init__.py +34 -0
- aider/coders/architect_coder.py +48 -0
- aider/coders/architect_prompts.py +40 -0
- aider/coders/ask_coder.py +9 -0
- aider/coders/ask_prompts.py +35 -0
- aider/coders/base_coder.py +2483 -0
- aider/coders/base_prompts.py +60 -0
- aider/coders/chat_chunks.py +64 -0
- aider/coders/context_coder.py +53 -0
- aider/coders/context_prompts.py +75 -0
- aider/coders/editblock_coder.py +657 -0
- aider/coders/editblock_fenced_coder.py +10 -0
- aider/coders/editblock_fenced_prompts.py +143 -0
- aider/coders/editblock_func_coder.py +141 -0
- aider/coders/editblock_func_prompts.py +27 -0
- aider/coders/editblock_prompts.py +174 -0
- aider/coders/editor_diff_fenced_coder.py +9 -0
- aider/coders/editor_diff_fenced_prompts.py +11 -0
- aider/coders/editor_editblock_coder.py +8 -0
- aider/coders/editor_editblock_prompts.py +18 -0
- aider/coders/editor_whole_coder.py +8 -0
- aider/coders/editor_whole_prompts.py +10 -0
- aider/coders/help_coder.py +16 -0
- aider/coders/help_prompts.py +46 -0
- aider/coders/patch_coder.py +706 -0
- aider/coders/patch_prompts.py +161 -0
- aider/coders/search_replace.py +757 -0
- aider/coders/shell.py +37 -0
- aider/coders/single_wholefile_func_coder.py +102 -0
- aider/coders/single_wholefile_func_prompts.py +27 -0
- aider/coders/udiff_coder.py +429 -0
- aider/coders/udiff_prompts.py +115 -0
- aider/coders/udiff_simple.py +14 -0
- aider/coders/udiff_simple_prompts.py +25 -0
- aider/coders/wholefile_coder.py +144 -0
- aider/coders/wholefile_func_coder.py +134 -0
- aider/coders/wholefile_func_prompts.py +27 -0
- aider/coders/wholefile_prompts.py +67 -0
- aider/commands.py +1665 -0
- aider/copypaste.py +72 -0
- aider/deprecated.py +126 -0
- aider/diffs.py +128 -0
- aider/dump.py +29 -0
- aider/editor.py +147 -0
- aider/exceptions.py +107 -0
- aider/format_settings.py +26 -0
- aider/gui.py +545 -0
- aider/help.py +163 -0
- aider/help_pats.py +19 -0
- aider/history.py +143 -0
- aider/io.py +1175 -0
- aider/linter.py +304 -0
- aider/llm.py +47 -0
- aider/main.py +1267 -0
- aider/mdstream.py +243 -0
- aider/models.py +1286 -0
- aider/onboarding.py +428 -0
- aider/openrouter.py +128 -0
- aider/prompts.py +64 -0
- aider/queries/tree-sitter-language-pack/README.md +7 -0
- aider/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/c-tags.scm +9 -0
- aider/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
- aider/queries/tree-sitter-language-pack/commonlisp-tags.scm +122 -0
- aider/queries/tree-sitter-language-pack/cpp-tags.scm +15 -0
- aider/queries/tree-sitter-language-pack/csharp-tags.scm +26 -0
- aider/queries/tree-sitter-language-pack/d-tags.scm +26 -0
- aider/queries/tree-sitter-language-pack/dart-tags.scm +92 -0
- aider/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/elixir-tags.scm +54 -0
- aider/queries/tree-sitter-language-pack/elm-tags.scm +19 -0
- aider/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
- aider/queries/tree-sitter-language-pack/go-tags.scm +42 -0
- aider/queries/tree-sitter-language-pack/java-tags.scm +20 -0
- aider/queries/tree-sitter-language-pack/javascript-tags.scm +88 -0
- aider/queries/tree-sitter-language-pack/lua-tags.scm +34 -0
- aider/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
- aider/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +98 -0
- aider/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
- aider/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/python-tags.scm +14 -0
- aider/queries/tree-sitter-language-pack/r-tags.scm +21 -0
- aider/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
- aider/queries/tree-sitter-language-pack/ruby-tags.scm +64 -0
- aider/queries/tree-sitter-language-pack/rust-tags.scm +60 -0
- aider/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
- aider/queries/tree-sitter-language-pack/swift-tags.scm +51 -0
- aider/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
- aider/queries/tree-sitter-languages/README.md +23 -0
- aider/queries/tree-sitter-languages/c-tags.scm +9 -0
- aider/queries/tree-sitter-languages/c_sharp-tags.scm +46 -0
- aider/queries/tree-sitter-languages/cpp-tags.scm +15 -0
- aider/queries/tree-sitter-languages/dart-tags.scm +91 -0
- aider/queries/tree-sitter-languages/elisp-tags.scm +8 -0
- aider/queries/tree-sitter-languages/elixir-tags.scm +54 -0
- aider/queries/tree-sitter-languages/elm-tags.scm +19 -0
- aider/queries/tree-sitter-languages/go-tags.scm +30 -0
- aider/queries/tree-sitter-languages/hcl-tags.scm +77 -0
- aider/queries/tree-sitter-languages/java-tags.scm +20 -0
- aider/queries/tree-sitter-languages/javascript-tags.scm +88 -0
- aider/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
- aider/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
- aider/queries/tree-sitter-languages/ocaml_interface-tags.scm +98 -0
- aider/queries/tree-sitter-languages/php-tags.scm +26 -0
- aider/queries/tree-sitter-languages/python-tags.scm +12 -0
- aider/queries/tree-sitter-languages/ql-tags.scm +26 -0
- aider/queries/tree-sitter-languages/ruby-tags.scm +64 -0
- aider/queries/tree-sitter-languages/rust-tags.scm +60 -0
- aider/queries/tree-sitter-languages/scala-tags.scm +65 -0
- aider/queries/tree-sitter-languages/typescript-tags.scm +41 -0
- aider/reasoning_tags.py +82 -0
- aider/repo.py +623 -0
- aider/repomap.py +847 -0
- aider/report.py +200 -0
- aider/resources/__init__.py +3 -0
- aider/resources/model-metadata.json +468 -0
- aider/resources/model-settings.yml +1767 -0
- aider/run_cmd.py +132 -0
- aider/scrape.py +284 -0
- aider/sendchat.py +61 -0
- aider/special.py +203 -0
- aider/urls.py +17 -0
- aider/utils.py +338 -0
- aider/versioncheck.py +113 -0
- aider/voice.py +187 -0
- aider/waiting.py +221 -0
- aider/watch.py +318 -0
- aider/watch_prompts.py +12 -0
- aider/website/Gemfile +8 -0
- aider/website/_includes/blame.md +162 -0
- aider/website/_includes/get-started.md +22 -0
- aider/website/_includes/help-tip.md +5 -0
- aider/website/_includes/help.md +24 -0
- aider/website/_includes/install.md +5 -0
- aider/website/_includes/keys.md +4 -0
- aider/website/_includes/model-warnings.md +67 -0
- aider/website/_includes/multi-line.md +22 -0
- aider/website/_includes/python-m-aider.md +5 -0
- aider/website/_includes/recording.css +228 -0
- aider/website/_includes/recording.md +34 -0
- aider/website/_includes/replit-pipx.md +9 -0
- aider/website/_includes/works-best.md +1 -0
- aider/website/_sass/custom/custom.scss +103 -0
- aider/website/docs/config/adv-model-settings.md +1881 -0
- aider/website/docs/config/aider_conf.md +527 -0
- aider/website/docs/config/api-keys.md +90 -0
- aider/website/docs/config/dotenv.md +478 -0
- aider/website/docs/config/editor.md +127 -0
- aider/website/docs/config/model-aliases.md +103 -0
- aider/website/docs/config/options.md +843 -0
- aider/website/docs/config/reasoning.md +209 -0
- aider/website/docs/config.md +44 -0
- aider/website/docs/faq.md +378 -0
- aider/website/docs/git.md +76 -0
- aider/website/docs/index.md +47 -0
- aider/website/docs/install/codespaces.md +39 -0
- aider/website/docs/install/docker.md +57 -0
- aider/website/docs/install/optional.md +100 -0
- aider/website/docs/install/replit.md +8 -0
- aider/website/docs/install.md +115 -0
- aider/website/docs/languages.md +264 -0
- aider/website/docs/legal/contributor-agreement.md +111 -0
- aider/website/docs/legal/privacy.md +104 -0
- aider/website/docs/llms/anthropic.md +77 -0
- aider/website/docs/llms/azure.md +48 -0
- aider/website/docs/llms/bedrock.md +132 -0
- aider/website/docs/llms/cohere.md +34 -0
- aider/website/docs/llms/deepseek.md +32 -0
- aider/website/docs/llms/gemini.md +49 -0
- aider/website/docs/llms/github.md +105 -0
- aider/website/docs/llms/groq.md +36 -0
- aider/website/docs/llms/lm-studio.md +39 -0
- aider/website/docs/llms/ollama.md +75 -0
- aider/website/docs/llms/openai-compat.md +39 -0
- aider/website/docs/llms/openai.md +58 -0
- aider/website/docs/llms/openrouter.md +78 -0
- aider/website/docs/llms/other.md +103 -0
- aider/website/docs/llms/vertex.md +50 -0
- aider/website/docs/llms/warnings.md +10 -0
- aider/website/docs/llms/xai.md +53 -0
- aider/website/docs/llms.md +54 -0
- aider/website/docs/more/analytics.md +122 -0
- aider/website/docs/more/edit-formats.md +116 -0
- aider/website/docs/more/infinite-output.md +137 -0
- aider/website/docs/more-info.md +8 -0
- aider/website/docs/recordings/auto-accept-architect.md +31 -0
- aider/website/docs/recordings/dont-drop-original-read-files.md +35 -0
- aider/website/docs/recordings/index.md +21 -0
- aider/website/docs/recordings/model-accepts-settings.md +69 -0
- aider/website/docs/recordings/tree-sitter-language-pack.md +80 -0
- aider/website/docs/repomap.md +112 -0
- aider/website/docs/scripting.md +100 -0
- aider/website/docs/troubleshooting/aider-not-found.md +24 -0
- aider/website/docs/troubleshooting/edit-errors.md +76 -0
- aider/website/docs/troubleshooting/imports.md +62 -0
- aider/website/docs/troubleshooting/models-and-keys.md +54 -0
- aider/website/docs/troubleshooting/support.md +79 -0
- aider/website/docs/troubleshooting/token-limits.md +96 -0
- aider/website/docs/troubleshooting/warnings.md +12 -0
- aider/website/docs/troubleshooting.md +11 -0
- aider/website/docs/usage/browser.md +57 -0
- aider/website/docs/usage/caching.md +49 -0
- aider/website/docs/usage/commands.md +132 -0
- aider/website/docs/usage/conventions.md +119 -0
- aider/website/docs/usage/copypaste.md +121 -0
- aider/website/docs/usage/images-urls.md +48 -0
- aider/website/docs/usage/lint-test.md +118 -0
- aider/website/docs/usage/modes.md +211 -0
- aider/website/docs/usage/not-code.md +179 -0
- aider/website/docs/usage/notifications.md +87 -0
- aider/website/docs/usage/tips.md +79 -0
- aider/website/docs/usage/tutorials.md +30 -0
- aider/website/docs/usage/voice.md +121 -0
- aider/website/docs/usage/watch.md +294 -0
- aider/website/docs/usage.md +92 -0
- aider/website/share/index.md +101 -0
- chatmcp_cli-0.1.0.dist-info/METADATA +502 -0
- chatmcp_cli-0.1.0.dist-info/RECORD +228 -0
- chatmcp_cli-0.1.0.dist-info/WHEEL +5 -0
- chatmcp_cli-0.1.0.dist-info/entry_points.txt +3 -0
- chatmcp_cli-0.1.0.dist-info/licenses/LICENSE.txt +202 -0
- chatmcp_cli-0.1.0.dist-info/top_level.txt +1 -0
aider/mdstream.py
ADDED
@@ -0,0 +1,243 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
|
3
|
+
import io
|
4
|
+
import time
|
5
|
+
|
6
|
+
from rich import box
|
7
|
+
from rich.console import Console
|
8
|
+
from rich.live import Live
|
9
|
+
from rich.markdown import CodeBlock, Heading, Markdown
|
10
|
+
from rich.panel import Panel
|
11
|
+
from rich.syntax import Syntax
|
12
|
+
from rich.text import Text
|
13
|
+
|
14
|
+
from aider.dump import dump # noqa: F401
|
15
|
+
|
16
|
+
_text_prefix = """
|
17
|
+
# Header
|
18
|
+
|
19
|
+
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
20
|
+
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
|
21
|
+
when an unknown printer took a galley of type and scrambled it to make a type
|
22
|
+
specimen book. It has survived not only five centuries, but also the leap into
|
23
|
+
electronic typesetting, remaining essentially unchanged. It was popularised in
|
24
|
+
the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
|
25
|
+
and more recently with desktop publishing software like Aldus PageMaker
|
26
|
+
including versions of Lorem Ipsum.
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
## Sub header
|
31
|
+
|
32
|
+
- List 1
|
33
|
+
- List 2
|
34
|
+
- List me
|
35
|
+
- List you
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
```python
|
40
|
+
"""
|
41
|
+
|
42
|
+
_text_suffix = """
|
43
|
+
```
|
44
|
+
|
45
|
+
## Sub header too
|
46
|
+
|
47
|
+
The end.
|
48
|
+
|
49
|
+
""" # noqa: E501
|
50
|
+
|
51
|
+
|
52
|
+
class NoInsetCodeBlock(CodeBlock):
|
53
|
+
"""A code block with syntax highlighting and no padding."""
|
54
|
+
|
55
|
+
def __rich_console__(self, console, options):
|
56
|
+
code = str(self.text).rstrip()
|
57
|
+
syntax = Syntax(code, self.lexer_name, theme=self.theme, word_wrap=True, padding=(1, 0))
|
58
|
+
yield syntax
|
59
|
+
|
60
|
+
|
61
|
+
class LeftHeading(Heading):
|
62
|
+
"""A heading class that renders left-justified."""
|
63
|
+
|
64
|
+
def __rich_console__(self, console, options):
|
65
|
+
text = self.text
|
66
|
+
text.justify = "left" # Override justification
|
67
|
+
if self.tag == "h1":
|
68
|
+
# Draw a border around h1s, but keep text left-aligned
|
69
|
+
yield Panel(
|
70
|
+
text,
|
71
|
+
box=box.HEAVY,
|
72
|
+
style="markdown.h1.border",
|
73
|
+
)
|
74
|
+
else:
|
75
|
+
# Styled text for h2 and beyond
|
76
|
+
if self.tag == "h2":
|
77
|
+
yield Text("") # Keep the blank line before h2
|
78
|
+
yield text
|
79
|
+
|
80
|
+
|
81
|
+
class NoInsetMarkdown(Markdown):
|
82
|
+
"""Markdown with code blocks that have no padding and left-justified headings."""
|
83
|
+
|
84
|
+
elements = {
|
85
|
+
**Markdown.elements,
|
86
|
+
"fence": NoInsetCodeBlock,
|
87
|
+
"code_block": NoInsetCodeBlock,
|
88
|
+
"heading_open": LeftHeading,
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
class MarkdownStream:
|
93
|
+
"""Streaming markdown renderer that progressively displays content with a live updating window.
|
94
|
+
|
95
|
+
Uses rich.console and rich.live to render markdown content with smooth scrolling
|
96
|
+
and partial updates. Maintains a sliding window of visible content while streaming
|
97
|
+
in new markdown text.
|
98
|
+
"""
|
99
|
+
|
100
|
+
live = None # Rich Live display instance
|
101
|
+
when = 0 # Timestamp of last update
|
102
|
+
min_delay = 1.0 / 20 # Minimum time between updates (20fps)
|
103
|
+
live_window = 6 # Number of lines to keep visible at bottom during streaming
|
104
|
+
|
105
|
+
def __init__(self, mdargs=None):
|
106
|
+
"""Initialize the markdown stream.
|
107
|
+
|
108
|
+
Args:
|
109
|
+
mdargs (dict, optional): Additional arguments to pass to rich Markdown renderer
|
110
|
+
"""
|
111
|
+
self.printed = [] # Stores lines that have already been printed
|
112
|
+
|
113
|
+
if mdargs:
|
114
|
+
self.mdargs = mdargs
|
115
|
+
else:
|
116
|
+
self.mdargs = dict()
|
117
|
+
|
118
|
+
# Defer Live creation until the first update.
|
119
|
+
self.live = None
|
120
|
+
self._live_started = False
|
121
|
+
|
122
|
+
def _render_markdown_to_lines(self, text):
|
123
|
+
"""Render markdown text to a list of lines.
|
124
|
+
|
125
|
+
Args:
|
126
|
+
text (str): Markdown text to render
|
127
|
+
|
128
|
+
Returns:
|
129
|
+
list: List of rendered lines with line endings preserved
|
130
|
+
"""
|
131
|
+
# Render the markdown to a string buffer
|
132
|
+
string_io = io.StringIO()
|
133
|
+
console = Console(file=string_io, force_terminal=True)
|
134
|
+
markdown = NoInsetMarkdown(text, **self.mdargs)
|
135
|
+
console.print(markdown)
|
136
|
+
output = string_io.getvalue()
|
137
|
+
|
138
|
+
# Split rendered output into lines
|
139
|
+
return output.splitlines(keepends=True)
|
140
|
+
|
141
|
+
def __del__(self):
|
142
|
+
"""Destructor to ensure Live display is properly cleaned up."""
|
143
|
+
if self.live:
|
144
|
+
try:
|
145
|
+
self.live.stop()
|
146
|
+
except Exception:
|
147
|
+
pass # Ignore any errors during cleanup
|
148
|
+
|
149
|
+
def update(self, text, final=False):
|
150
|
+
"""Update the displayed markdown content.
|
151
|
+
|
152
|
+
Args:
|
153
|
+
text (str): The markdown text received so far
|
154
|
+
final (bool): If True, this is the final update and we should clean up
|
155
|
+
|
156
|
+
Splits the output into "stable" older lines and the "last few" lines
|
157
|
+
which aren't considered stable. They may shift around as new chunks
|
158
|
+
are appended to the markdown text.
|
159
|
+
|
160
|
+
The stable lines emit to the console above the Live window.
|
161
|
+
The unstable lines emit into the Live window so they can be repainted.
|
162
|
+
|
163
|
+
Markdown going to the console works better in terminal scrollback buffers.
|
164
|
+
The live window doesn't play nice with terminal scrollback.
|
165
|
+
"""
|
166
|
+
# On the first call, stop the spinner and start the Live renderer
|
167
|
+
if not getattr(self, "_live_started", False):
|
168
|
+
self.live = Live(Text(""), refresh_per_second=1.0 / self.min_delay)
|
169
|
+
self.live.start()
|
170
|
+
self._live_started = True
|
171
|
+
|
172
|
+
now = time.time()
|
173
|
+
# Throttle updates to maintain smooth rendering
|
174
|
+
if not final and now - self.when < self.min_delay:
|
175
|
+
return
|
176
|
+
self.when = now
|
177
|
+
|
178
|
+
# Measure render time and adjust min_delay to maintain smooth rendering
|
179
|
+
start = time.time()
|
180
|
+
lines = self._render_markdown_to_lines(text)
|
181
|
+
render_time = time.time() - start
|
182
|
+
|
183
|
+
# Set min_delay to render time plus a small buffer
|
184
|
+
self.min_delay = min(max(render_time * 10, 1.0 / 20), 2)
|
185
|
+
|
186
|
+
num_lines = len(lines)
|
187
|
+
|
188
|
+
# How many lines have "left" the live window and are now considered stable?
|
189
|
+
# Or if final, consider all lines to be stable.
|
190
|
+
if not final:
|
191
|
+
num_lines -= self.live_window
|
192
|
+
|
193
|
+
# If we have stable content to display...
|
194
|
+
if final or num_lines > 0:
|
195
|
+
# How many stable lines do we need to newly show above the live window?
|
196
|
+
num_printed = len(self.printed)
|
197
|
+
show = num_lines - num_printed
|
198
|
+
|
199
|
+
# Skip if no new lines to show above live window
|
200
|
+
if show <= 0:
|
201
|
+
return
|
202
|
+
|
203
|
+
# Get the new lines and display them
|
204
|
+
show = lines[num_printed:num_lines]
|
205
|
+
show = "".join(show)
|
206
|
+
show = Text.from_ansi(show)
|
207
|
+
self.live.console.print(show) # to the console above the live area
|
208
|
+
|
209
|
+
# Update our record of printed lines
|
210
|
+
self.printed = lines[:num_lines]
|
211
|
+
|
212
|
+
# Handle final update cleanup
|
213
|
+
if final:
|
214
|
+
self.live.update(Text(""))
|
215
|
+
self.live.stop()
|
216
|
+
self.live = None
|
217
|
+
return
|
218
|
+
|
219
|
+
# Update the live window with remaining lines
|
220
|
+
rest = lines[num_lines:]
|
221
|
+
rest = "".join(rest)
|
222
|
+
rest = Text.from_ansi(rest)
|
223
|
+
self.live.update(rest)
|
224
|
+
|
225
|
+
def find_minimal_suffix(self, text, match_lines=50):
|
226
|
+
"""
|
227
|
+
Splits text into chunks on blank lines "\n\n".
|
228
|
+
"""
|
229
|
+
|
230
|
+
|
231
|
+
if __name__ == "__main__":
|
232
|
+
with open("aider/io.py", "r") as f:
|
233
|
+
code = f.read()
|
234
|
+
_text = _text_prefix + code + _text_suffix
|
235
|
+
_text = _text * 10
|
236
|
+
|
237
|
+
pm = MarkdownStream()
|
238
|
+
print("Using NoInsetMarkdown for code blocks with padding=0")
|
239
|
+
for i in range(6, len(_text), 5):
|
240
|
+
pm.update(_text[:i])
|
241
|
+
time.sleep(0.01)
|
242
|
+
|
243
|
+
pm.update(_text, final=True)
|