-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Integrate Git functionality and enable container-based agent support #9
base: main
Are you sure you want to change the base?
feat: Integrate Git functionality and enable container-based agent support #9
Conversation
feat: Integrate Git functionality and enable container-based agent support WIP: This commit is still under development and not all features are fully implemented. Just opening an early PR to get feedback on the approach, and maybe someone wants to join in. This is based off some work I have been doing in my own project, only that uses Go. The basic idea is to let the LLMs loose inside Docker containers, where they get to use the full power of the OS. Their prompting mechanism is hooked up to stdout and stderr of the container, and their responses are fed back into the stdin. This has worked really well in my project, and I think it's a great way to let the LLMs interact with the code, without messing things up. The have shown to be very capable of using Git workflows as well. We can prompt them to use a specific Git flow, and always work on a branch, create early PRs, etc. If you also implement Github WebHooks, you could even create a cycle of development and code review. All AI. - **Git Integration:** - Extended `ActionType` to include `git` actions. - Implemented `GitAction` type in `actions.ts` to handle repository URL, branch creation, commit messages, and pull requests. - Updated `ActionRunner` to process Git actions, including cloning repositories, creating branches, committing changes, pushing to remote, and creating pull requests via GitHub API. - Added `DockerGitActionForm` component to the frontend for users to input Git-related details and initiate Git actions. - **Docker Enhancements:** - Created a custom Docker image (`my-node-git:latest`) with Git installed to support Git operations within containers. - Updated `DockerService` to utilize the custom Docker image for Git-related actions. - Ensured Docker containers are properly managed and cleaned up after executing Git commands to prevent resource leaks. - **Security Improvements:** - Implemented secure handling of GitHub tokens, recommending the use of OAuth for enhanced security. - Added environment variables for GitHub OAuth credentials. - **Documentation:** - Updated `README.md` to include instructions on using the new Git integration features. - Provided examples and important notes regarding token security and permissions. - **Testing:** - Added unit tests for Git actions in `action-runner.spec.ts` to ensure reliability and handle error scenarios. This commit enhances Bolt.new by enabling AI agents to interact with Git repositories directly from Docker containers, facilitating automated branch management and pull request creation. These features streamline the development workflow, allowing for more efficient version control and collaboration.
This makes this repo fully local. I am interested in hosting such things online, meaning that it should work in a browser/worker I never tried anything with git purely from frontends or through the backend |
Could use Kubernetes for running containers, depends on what you mean by hosting online... I mean, you can install Docker on any virtual machine, if you have control over it. I will look into providing an alternate option though keeping in mind a non-local situation :) |
But then you would need the ability to spawn those containers per user, may be even multiple per user if he is working on multiple things at the same time. I have a feeling there are two types of "demand" from open-source Bolt.New I wonder if it even makes sense to try to do both and I wonder which demand is bigger. Could be that its running it locally. |
I would say running it online for others is a way higher demand. |
If I understand your thinking here, you would deploy Bolt.new in a docker container, and expose the docker socket (file) to the container, such hat the bolt.new application could itself, issue docker commands (via the docker API) to be run on the parent bare metal/VM. This is the approach taken by Coolify in their efforts to crate a deployment management platform much like hat offered by Vercel. This use case could be either much simplified, or alternatively, forego local docker management entirely in favor of integration with the likes of Coolify, at the Git actions/triggers level and avoid the hassles associated with reinventing the wheel. |
Docker just has an API, so you don't need to to anything manually, you can just use the library not only to build and run a container, you could even configure it, as in you would not need a dockerfile. The question otherwise is, how are you going to let the AI work on your code, without being in your way? It is the same dilemma the cursor people are dealing with. |
There is a multitude of options. You could run Docker in Docker (DinD), you could even run Kubernetes in Docker (Kind, wich is what the k8s team uses in their test workflows), you could probably also do this entirely without docker, I figured I'd start with what I knew :) I had actually not considered the whole online/offline thing, I just saw a feature I happen to be working on myself, so it was a natural switch to make I guess. |
Why not use a CloudFlare tunnel, or ngrok or something? |
Maybe I am not understanding you fully, but what I was thinking (and doing in my own project) is not letting the AI execute on the bare metal, but the other way around. So let's say I have an "environment" tool for the AI, what it ultimately does: Build container: https://github.com/TheApeMachine/amsh/blob/master/container/builder.go stdout and stderr are the output of the terminal inside the container, feed it in as the prompt for the AI. stdin is the terminal input mechanism, connect it to the response the AI generates. Give it the system prompt below, and it will happily start to use raw terminal commands like grep for searching code, and sed for making changes. Plus it will use git as you describe it in the system prompt. System Prompt:
|
Never mind, I misunderstood what this does with docker. |
This looks phenomenal, thank you for working on this @TheApeMachine! I'll be following your progress here! |
This pull request has been marked as stale due to inactivity. If no further activity occurs, it will be closed in 7 days. |
WIP: This commit is still under development and not all features are fully implemented.
Just opening an early PR to get feedback on the approach, and maybe someone wants to join in.
This is based off some work I have been doing in my own project, only that uses Go. The basic idea is to let the LLMs loose inside Docker containers, where they get to use the full power of the OS. Their prompting mechanism is hooked up to stdout and stderr of the container, and their responses are fed back into the stdin. This has worked really well in my project, and I think it's a great way to let the LLMs interact with the code, without messing things up. The have shown to be very capable of using Git workflows as well.
We can prompt them to use a specific Git flow, and always work on a branch, create early PRs, etc.
If you also implement Github WebHooks, you could even create a cycle of development and code review. All AI.
Git Integration:
ActionType
to includegit
actions.GitAction
type inactions.ts
to handle repository URL, branch creation, commit messages, and pull requests.ActionRunner
to process Git actions, including cloning repositories, creating branches, committing changes, pushing to remote, and creating pull requests via GitHub API.DockerGitActionForm
component to the frontend for users to input Git-related details and initiate Git actions.Docker Enhancements:
my-node-git:latest
) with Git installed to support Git operations within containers.DockerService
to utilize the custom Docker image for Git-related actions.Security Improvements:
Documentation:
README.md
to include instructions on using the new Git integration features.Testing:
action-runner.spec.ts
to ensure reliability and handle error scenarios.This commit enhances Bolt.new by enabling AI agents to interact with Git repositories directly from Docker containers, facilitating automated branch management and pull request creation. These features streamline the development workflow, allowing for more efficient version control and collaboration.