BuilderIO / micro-agent

An AI agent that writes (actually useful) code for you
https://www.builder.io/blog/micro-agent
MIT License
2.61k stars 206 forks source link

Support for other test folder structures #13

Open tpaulshippy opened 3 months ago

tpaulshippy commented 3 months ago

In many frameworks, rails for example, the tests or specs are placed in a separate folder from the implementation. The folder structure of the tests often mirrors that of the implementation. Would like this project to support that.

tpaulshippy commented 3 months ago

I'm interested in working on this if no one else gets to it first.

steve8708 commented 3 months ago

ah yes! would make a great contribution. maybe as a config?

tpaulshippy commented 3 months ago

Taking another look...looks like this flag already provides some support for this --

-f, --test-file

I guess the config would be to change the behavior so that files generated from the tool without any flags provided would be structured properly.

tpaulshippy commented 3 months ago

And make the interactive mode work for these kinds of projects.

steve8708 commented 3 months ago

a potentially even better approach - let the llm figure that out. there is a part where we pass in a file tree, so maybe theres a world where it can look at your existing files and determine what the pattern should be

this may be hard for large projects with too many files to include, but could be worth exploring

tpaulshippy commented 3 months ago

Interesting. I'll play with the tool more and see if this could work.

Would love to use the tool to make this change on itself.

steve8708 commented 3 months ago

Oh wow ya! The tough part would probably be is we want to use an LLM for part of the solution then that would be costly to run in a unit test - though if we add ollama ( https://github.com/BuilderIO/micro-agent/issues/12 ) support that would solve that and allow the LLM to run in the unit tests locally which would be pretty interesting

On Fri, Jun 07, 2024 at 9:24 AM, Paul Shippy < @.*** > wrote:

Interesting. I'll play with the tool more and see if this could work.

Would love to use the tool to make this change on itself.

— Reply to this email directly, view it on GitHub ( https://github.com/BuilderIO/micro-agent/issues/13#issuecomment-2155157386 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAGOEA4YGXBRSHIT4FGDSETZGHNDVAVCNFSM6AAAAABI64DWOWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGE2TOMZYGY ). You are receiving this because you commented. Message ID: <BuilderIO/micro-agent/issues/13/2155157386 @ github. com>

tpaulshippy commented 3 months ago

True or we could mock the AI and just make assertions on the prompts.

tpaulshippy commented 3 months ago

a potentially even better approach - let the llm figure that out. there is a part where we pass in a file tree, so maybe theres a world where it can look at your existing files and determine what the pattern should be

Reading more of the code I'm seeing that it should already be doing this. With the limitation of 100 files. Going to try this on my rails project and open a separate issue if there are things that aren't working.

tpaulshippy commented 2 months ago

Cancel that. The code I saw was https://github.com/BuilderIO/micro-agent/blob/05070973b9c71bd7f3b6f24e203d67314954f5ad/src/helpers/interactive-mode.ts#L58 but this is for the implementation file, not the test file. Looks like we need a recommendedTestFilePath with the option to confirm.

tpaulshippy commented 2 months ago

I wonder if another way to improve the 100 file limitation would be to just grab the first file from each folder. This way your sampling would have a better chance of covering all the folders.

steve8708 commented 2 months ago

Oh yeah that’s an interesting idea. Or max one of each suffix (so we can see at least one example of the potential patterns used like .js or .test.ts or .py etc)

I agree that more than one example file name of each suffix

On Sat, Jun 8 2024 at 1:42 PM, Paul Shippy < @.*** > wrote:

I wonder if another way to improve the 100 file limitation would be to just grab the first file from each folder. This way your sampling would have a better chance of covering all the folders.

— Reply to this email directly, view it on GitHub ( https://github.com/BuilderIO/micro-agent/issues/13#issuecomment-2156176297 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAGOEAY4RZUMDWJS6J72ZXDZGNUDBAVCNFSM6AAAAABI64DWOWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJWGE3TMMRZG4 ). You are receiving this because you commented. Message ID: <BuilderIO/micro-agent/issues/13/2156176297 @ github. com>