aider icon indicating copy to clipboard operation
aider copied to clipboard

[FeatReq] Add support for apps and libs that require two console to develop (like Textual)

Open Emasoft opened this issue 1 year ago • 1 comments

Issue

Certain python apps and libraries require multiple terminal consoles open at the same time. This is because the TUI interface is displayed in one console, while the debug messages are displayed in another console. Textual is an example. Textual is the most popular TUI framework for Python, used to develop apps like Elia, Memray, Parllama and Posting. The dev mode of Textual requires some special setup on two consoles. You can read about it here:

https://textual.textualize.io/guide/devtools/ https://github.com/Textualize/textual-dev

Currently Aider cannot monitor or display two consoles at the same time, and consequently developing Textual apps with it is impossible. Because the AI needs both the console outputs (the debug logs messages and the TUI snapshots) added to the chat to understand what is going on. This is also somewhat related to this issue: https://github.com/paul-gauthier/aider/issues/912 . Please add support for displaying and adding to chat multiple consoles output.

P.S. Writing tests for Textual is also difficult for the same reason. But you can use a tool like pytest-textual-snapshot to handle those UI tests in Aider once you implement the dual console output. Please add support for it. You can read about it here:

https://textual.textualize.io/guide/testing/ https://github.com/Textualize/pytest-textual-snapshot

Thanks! 😊 🙏

Version and model info

No response

Emasoft avatar Jul 27 '24 17:07 Emasoft

Thanks for trying aider and filing this issue.

I don't think there is a natural way for aider to support this. Aider's /run command simply runs a program captures its stdout/stderr. That won't work with a TUI app at all that uses complex terminal control sequences.

You need a CLI program you can run that will simply dump the textual console logs and then exit. It doesn't look like textual console supports that, as it runs forever printing logs. You may be able to write such a CLI program without too much trouble (maybe even using aider to write it).

paul-gauthier avatar Jul 28 '24 11:07 paul-gauthier

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.

paul-gauthier avatar Jul 30 '24 16:07 paul-gauthier

Can you implement a plug-in system for Aider? I would be happy to write a plugin for letting Aider receive the log output from Textual (all I need to do is to adapt the code from here: https://github.com/Textualize/textual-dev/blob/main/src/textual_dev/client.py ).

Emasoft avatar Jul 31 '24 09:07 Emasoft