Set Up a Sandbox Environment
Set up a sandbox environment to significantly improve the quality of generated code
Configuring a sandbox environment with a Dockerfile and commands allows Ellipsis to test its own code before submitting it back to a human. This is highly recommended as it greatly increases the quality of generated code.
By default, when Ellipsis writes code in response to comments, messages, and issues, it doesn’t have a way to test the code it generates. As a result, linter errors or failing tests can be common.
To fix this, you can provide a Dockerfile and a list of commands that Ellipsis can use to test the code it generates before submitting that code back to you.
For example, if you notice that Ellipsis constantly suggests code that doesn’t pass your linter, you should configure a Dockerfile and a lint command (e.g., npm run lint
). Ellipsis will then attempt to lint its own code before opening a pull request. If the lint command fails, Ellipsis will fix the problem before moving on, or at least notify you why it wasn’t able to resolve the lint error.
Here’s an example Dockerfile that might work for a Node.js project:
Instructions
Set up takes 5 minutes using our web UI. Open the console. Click “code” on the sidebar. Select your repository from the drop-down menu.
Add environment variables
Only required if your project needs environment variables to run the commands! Be sure to use dev env vars, not prod.
Add Commands
Add commands through the UI. Commands are executed from the root of the repository and can lint, build, and even run your tests. Include whichever commands you use while developing.
For each command, provide:
- The command to run (e.g.,
npm run lint
) - A description that helps Ellipsis understand when and why to use this command
Add a Dockerfile
Use the UI to create a Dockerfile that installs dependencies and copies your code into the container. We build this from the root of the repository.
- The Dockerfile needs to include the Git CLI.
- Do not include an
ENTRYPOINT
orCMD
. - You can either upload an existing Dockerfile or create one directly in the UI.
Test
Click “Test build and commands” and wait. If it fails, inspect the logs and fix the issue.
Add files to repository
Once the build passes, use the “Add to repository using PR” button to send the Dockerfile to your repository. Merge the PR, and now, Ellipsis will use these commands to fix its own mistakes before opening a PR!